From 51c0bb09d8f1066555d28ae3824988b318d2f39e Mon Sep 17 00:00:00 2001 From: Pavol Rusnak Date: Thu, 12 May 2016 20:57:55 +0200 Subject: [PATCH] make salt constant in pbkdf2 --- pbkdf2.c | 8 ++++---- pbkdf2.h | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/pbkdf2.c b/pbkdf2.c index 86903204de..86398aa649 100644 --- a/pbkdf2.c +++ b/pbkdf2.c @@ -26,7 +26,7 @@ #include "hmac.h" #include "macros.h" -void pbkdf2_hmac_sha256_Init(PBKDF2_HMAC_SHA256_CTX *pctx, const uint8_t *pass, int passlen, uint8_t *salt, int saltlen) +void pbkdf2_hmac_sha256_Init(PBKDF2_HMAC_SHA256_CTX *pctx, const uint8_t *pass, int passlen, const uint8_t *salt, int saltlen) { HMAC_SHA256_CTX hctx; hmac_sha256_Init(&hctx, pass, passlen); @@ -56,7 +56,7 @@ void pbkdf2_hmac_sha256_Final(PBKDF2_HMAC_SHA256_CTX *pctx, uint8_t *key) MEMSET_BZERO(pctx, sizeof(PBKDF2_HMAC_SHA256_CTX)); } -void pbkdf2_hmac_sha256(const uint8_t *pass, int passlen, uint8_t *salt, int saltlen, uint32_t iterations, uint8_t *key) +void pbkdf2_hmac_sha256(const uint8_t *pass, int passlen, const uint8_t *salt, int saltlen, uint32_t iterations, uint8_t *key) { PBKDF2_HMAC_SHA256_CTX pctx; pbkdf2_hmac_sha256_Init(&pctx, pass, passlen, salt, saltlen); @@ -64,7 +64,7 @@ void pbkdf2_hmac_sha256(const uint8_t *pass, int passlen, uint8_t *salt, int sal pbkdf2_hmac_sha256_Final(&pctx, key); } -void pbkdf2_hmac_sha512_Init(PBKDF2_HMAC_SHA512_CTX *pctx, const uint8_t *pass, int passlen, uint8_t *salt, int saltlen) +void pbkdf2_hmac_sha512_Init(PBKDF2_HMAC_SHA512_CTX *pctx, const uint8_t *pass, int passlen, const uint8_t *salt, int saltlen) { HMAC_SHA512_CTX hctx; hmac_sha512_Init(&hctx, pass, passlen); @@ -94,7 +94,7 @@ void pbkdf2_hmac_sha512_Final(PBKDF2_HMAC_SHA512_CTX *pctx, uint8_t *key) MEMSET_BZERO(pctx, sizeof(PBKDF2_HMAC_SHA512_CTX)); } -void pbkdf2_hmac_sha512(const uint8_t *pass, int passlen, uint8_t *salt, int saltlen, uint32_t iterations, uint8_t *key) +void pbkdf2_hmac_sha512(const uint8_t *pass, int passlen, const uint8_t *salt, int saltlen, uint32_t iterations, uint8_t *key) { PBKDF2_HMAC_SHA512_CTX pctx; pbkdf2_hmac_sha512_Init(&pctx, pass, passlen, salt, saltlen); diff --git a/pbkdf2.h b/pbkdf2.h index c3b56b2a05..2a4c26ec8b 100644 --- a/pbkdf2.h +++ b/pbkdf2.h @@ -43,14 +43,14 @@ typedef struct _PBKDF2_HMAC_SHA512_CTX { char first; } PBKDF2_HMAC_SHA512_CTX; -void pbkdf2_hmac_sha256_Init(PBKDF2_HMAC_SHA256_CTX *pctx, const uint8_t *pass, int passlen, uint8_t *salt, int saltlen); +void pbkdf2_hmac_sha256_Init(PBKDF2_HMAC_SHA256_CTX *pctx, const uint8_t *pass, int passlen, const uint8_t *salt, int saltlen); void pbkdf2_hmac_sha256_Update(PBKDF2_HMAC_SHA256_CTX *pctx, uint32_t iterations); void pbkdf2_hmac_sha256_Final(PBKDF2_HMAC_SHA256_CTX *pctx, uint8_t *key); -void pbkdf2_hmac_sha256(const uint8_t *pass, int passlen, uint8_t *salt, int saltlen, uint32_t iterations, uint8_t *key); +void pbkdf2_hmac_sha256(const uint8_t *pass, int passlen, const uint8_t *salt, int saltlen, uint32_t iterations, uint8_t *key); -void pbkdf2_hmac_sha512_Init(PBKDF2_HMAC_SHA512_CTX *pctx, const uint8_t *pass, int passlen, uint8_t *salt, int saltlen); +void pbkdf2_hmac_sha512_Init(PBKDF2_HMAC_SHA512_CTX *pctx, const uint8_t *pass, int passlen, const uint8_t *salt, int saltlen); void pbkdf2_hmac_sha512_Update(PBKDF2_HMAC_SHA512_CTX *pctx, uint32_t iterations); void pbkdf2_hmac_sha512_Final(PBKDF2_HMAC_SHA512_CTX *pctx, uint8_t *key); -void pbkdf2_hmac_sha512(const uint8_t *pass, int passlen, uint8_t *salt, int saltlen, uint32_t iterations, uint8_t *key); +void pbkdf2_hmac_sha512(const uint8_t *pass, int passlen, const uint8_t *salt, int saltlen, uint32_t iterations, uint8_t *key); #endif