Rename PBKDF2_SHA256 to escrypt_PBKDF2_SHA256

This commit is contained in:
Frank Denis 2019-06-09 00:02:23 +02:00
parent 7c44e6a8c4
commit d3787c23b8
4 changed files with 11 additions and 10 deletions

View File

@ -363,7 +363,7 @@ escrypt_kdf_nosse(escrypt_local_t *local, const uint8_t *passwd,
XY = (uint32_t *) ((uint8_t *) V + V_size); XY = (uint32_t *) ((uint8_t *) V + V_size);
/* 1: (B_0 ... B_{p-1}) <-- PBKDF2(P, S, 1, p * MFLen) */ /* 1: (B_0 ... B_{p-1}) <-- PBKDF2(P, S, 1, p * MFLen) */
PBKDF2_SHA256(passwd, passwdlen, salt, saltlen, 1, B, B_size); escrypt_PBKDF2_SHA256(passwd, passwdlen, salt, saltlen, 1, B, B_size);
/* 2: for i = 0 to p - 1 do */ /* 2: for i = 0 to p - 1 do */
for (i = 0; i < p; i++) { for (i = 0; i < p; i++) {
@ -372,7 +372,7 @@ escrypt_kdf_nosse(escrypt_local_t *local, const uint8_t *passwd,
} }
/* 5: DK <-- PBKDF2(P, B, 1, dkLen) */ /* 5: DK <-- PBKDF2(P, B, 1, dkLen) */
PBKDF2_SHA256(passwd, passwdlen, B, B_size, 1, buf, buflen); escrypt_PBKDF2_SHA256(passwd, passwdlen, B, B_size, 1, buf, buflen);
/* Success! */ /* Success! */
return 0; return 0;

View File

@ -39,13 +39,14 @@
#include "utils.h" #include "utils.h"
/** /**
* PBKDF2_SHA256(passwd, passwdlen, salt, saltlen, c, buf, dkLen): * escrypt_PBKDF2_SHA256(passwd, passwdlen, salt, saltlen, c, buf, dkLen):
* Compute PBKDF2(passwd, salt, c, dkLen) using HMAC-SHA256 as the PRF, and * Compute PBKDF2(passwd, salt, c, dkLen) using HMAC-SHA256 as the PRF, and
* write the output to buf. The value dkLen must be at most 32 * (2^32 - 1). * write the output to buf. The value dkLen must be at most 32 * (2^32 - 1).
*/ */
void void
PBKDF2_SHA256(const uint8_t *passwd, size_t passwdlen, const uint8_t *salt, escrypt_PBKDF2_SHA256(const uint8_t *passwd, size_t passwdlen,
size_t saltlen, uint64_t c, uint8_t *buf, size_t dkLen) const uint8_t *salt, size_t saltlen, uint64_t c,
uint8_t *buf, size_t dkLen)
{ {
crypto_auth_hmacsha256_state PShctx, hctx; crypto_auth_hmacsha256_state PShctx, hctx;
size_t i; size_t i;

View File

@ -35,11 +35,11 @@
#include "crypto_auth_hmacsha256.h" #include "crypto_auth_hmacsha256.h"
/** /**
* PBKDF2_SHA256(passwd, passwdlen, salt, saltlen, c, buf, dkLen): * escrypt_PBKDF2_SHA256(passwd, passwdlen, salt, saltlen, c, buf, dkLen):
* Compute PBKDF2(passwd, salt, c, dkLen) using HMAC-SHA256 as the PRF, and * Compute PBKDF2(passwd, salt, c, dkLen) using HMAC-SHA256 as the PRF, and
* write the output to buf. The value dkLen must be at most 32 * (2^32 - 1). * write the output to buf. The value dkLen must be at most 32 * (2^32 - 1).
*/ */
void PBKDF2_SHA256(const uint8_t *, size_t, const uint8_t *, size_t, uint64_t, void escrypt_PBKDF2_SHA256(const uint8_t *, size_t, const uint8_t *, size_t,
uint8_t *, size_t); uint64_t, uint8_t *, size_t);
#endif /* !_SHA256_H_ */ #endif /* !_SHA256_H_ */

View File

@ -383,7 +383,7 @@ escrypt_kdf_sse(escrypt_local_t *local, const uint8_t *passwd, size_t passwdlen,
XY = (uint32_t *) ((uint8_t *) V + V_size); XY = (uint32_t *) ((uint8_t *) V + V_size);
/* 1: (B_0 ... B_{p-1}) <-- PBKDF2(P, S, 1, p * MFLen) */ /* 1: (B_0 ... B_{p-1}) <-- PBKDF2(P, S, 1, p * MFLen) */
PBKDF2_SHA256(passwd, passwdlen, salt, saltlen, 1, B, B_size); escrypt_PBKDF2_SHA256(passwd, passwdlen, salt, saltlen, 1, B, B_size);
/* 2: for i = 0 to p - 1 do */ /* 2: for i = 0 to p - 1 do */
for (i = 0; i < p; i++) { for (i = 0; i < p; i++) {
@ -392,7 +392,7 @@ escrypt_kdf_sse(escrypt_local_t *local, const uint8_t *passwd, size_t passwdlen,
} }
/* 5: DK <-- PBKDF2(P, B, 1, dkLen) */ /* 5: DK <-- PBKDF2(P, B, 1, dkLen) */
PBKDF2_SHA256(passwd, passwdlen, B, B_size, 1, buf, buflen); escrypt_PBKDF2_SHA256(passwd, passwdlen, B, B_size, 1, buf, buflen);
/* Success! */ /* Success! */
return 0; return 0;