rename arguments

This commit is contained in:
Steffen Jaeckel 2019-09-30 17:23:34 +02:00
parent e9ff57d5d7
commit d4233e9156
3 changed files with 19 additions and 19 deletions

View File

@ -7106,13 +7106,13 @@ To hash a password with the bcrypt PBKDF algorithm, the following API function i
\index{bcrypt()}
\begin{alltt}
int bcrypt_pbkdf_openbsd(const char *password, unsigned long password_len,
const unsigned char *salt, unsigned long salt_len,
unsigned int rounds, int hash_idx,
unsigned char *out, unsigned long *outlen);
int bcrypt_pbkdf_openbsd(const void *secret, unsigned long secret_len,
const unsigned char *salt, unsigned long salt_len,
unsigned int rounds, int hash_idx,
unsigned char *out, unsigned long *outlen);
\end{alltt}
The \textit{password} parameter is the utf-8 encoded user password of length \textit{password\_len}.
The \textit{secret} parameter is the secret of length \textit{secret\_len} (most of the time a utf-8 encoded user password).
The \textit{salt} parameter is a pointer to the array of octets of length \textit{salt\_len} containing the salt.
The \textit{rounds} parameter defines the number of iterations of the expensive key setup that shall be executed.
The \textit{hash\_idx} parameter defines the hash algorithm that shall be used.

View File

@ -60,10 +60,10 @@ int base16_decode(const char *in, unsigned long inlen,
#endif
#ifdef LTC_BCRYPT
int bcrypt_pbkdf_openbsd(const char *password, unsigned long password_len,
const unsigned char *salt, unsigned long salt_len,
unsigned int rounds, int hash_idx,
unsigned char *out, unsigned long *outlen);
int bcrypt_pbkdf_openbsd(const void *secret, unsigned long secret_len,
const unsigned char *salt, unsigned long salt_len,
unsigned int rounds, int hash_idx,
unsigned char *out, unsigned long *outlen);
#endif
/* ===> LTC_HKDF -- RFC5869 HMAC-based Key Derivation Function <=== */

View File

@ -78,10 +78,10 @@ static int _bcrypt_pbkdf_hash(const unsigned char *pass, unsigned long passlen,
@param outlen [in/out] The desired size of the algorithm output
@return CRYPT_OK if successful
*/
int bcrypt_pbkdf_openbsd(const char *password, unsigned long password_len,
const unsigned char *salt, unsigned long salt_len,
unsigned int rounds, int hash_idx,
unsigned char *out, unsigned long *outlen)
int bcrypt_pbkdf_openbsd(const void *secret, unsigned long secret_len,
const unsigned char *salt, unsigned long salt_len,
unsigned int rounds, int hash_idx,
unsigned char *out, unsigned long *outlen)
{
int err;
ulong32 blkno;
@ -89,12 +89,12 @@ int bcrypt_pbkdf_openbsd(const char *password, unsigned long password_l
unsigned char *buf[3], blkbuf[4];
unsigned char *hashed_pass;
LTC_ARGCHK(password != NULL);
LTC_ARGCHK(salt != NULL);
LTC_ARGCHK(out != NULL);
LTC_ARGCHK(outlen != NULL);
LTC_ARGCHK(secret != NULL);
LTC_ARGCHK(salt != NULL);
LTC_ARGCHK(out != NULL);
LTC_ARGCHK(outlen != NULL);
if ((password_len == 0) || (salt_len == 0) || (*outlen == 0)) {
if ((secret_len == 0) || (salt_len == 0) || (*outlen == 0)) {
return CRYPT_INVALID_ARG;
}
/* test hash IDX */
@ -127,7 +127,7 @@ int bcrypt_pbkdf_openbsd(const char *password, unsigned long password_l
steps = (*outlen + step_size - 1) / step_size;
hashed_pass_len = MAXBLOCKSIZE;
if ((err = hash_memory(hash_idx, (unsigned char*)password, password_len, hashed_pass, &hashed_pass_len)) != CRYPT_OK) {
if ((err = hash_memory(hash_idx, (unsigned char*)secret, secret_len, hashed_pass, &hashed_pass_len)) != CRYPT_OK) {
goto LBL_ERR;
}