Go to the documentation of this file.
32 #define TRACE_LEVEL CRYPTO_TRACE_LEVEL
40 #if (PBKDF_SUPPORT == ENABLED)
43 const uint8_t
PBKDF2_OID[9] = {0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x05, 0x0C};
65 const uint8_t *
s,
size_t sLen,
uint_t c, uint8_t *dk,
size_t dkLen)
69 #if (CRYPTO_STATIC_MEM_SUPPORT == DISABLED)
76 if(hash == NULL ||
p == NULL ||
s == NULL || dk == NULL)
87 #if (CRYPTO_STATIC_MEM_SUPPORT == DISABLED)
91 if(hashContext == NULL)
96 hash->
init(hashContext);
97 hash->
update(hashContext,
p, pLen);
98 hash->
update(hashContext,
s, sLen);
99 hash->
final(hashContext,
t);
102 for(i = 1; i <
c; i++)
105 hash->
init(hashContext);
107 hash->
final(hashContext,
t);
113 #if (CRYPTO_STATIC_MEM_SUPPORT == DISABLED)
141 const uint8_t *
s,
size_t sLen,
uint_t c, uint8_t *dk,
size_t dkLen)
149 #if (CRYPTO_STATIC_MEM_SUPPORT == DISABLED)
156 if(hash == NULL ||
p == NULL ||
s == NULL || dk == NULL)
163 #if (CRYPTO_STATIC_MEM_SUPPORT == DISABLED)
167 if(hmacContext == NULL)
172 for(i = 1; dkLen > 0; i++)
187 for(j = 1; j <
c; j++)
211 #if (CRYPTO_STATIC_MEM_SUPPORT == DISABLED)
Generic hash algorithm context.
#define MAX_HASH_DIGEST_SIZE
@ ERROR_INVALID_PARAMETER
Invalid parameter.
#define osMemcpy(dest, src, length)
General definitions for cryptographic algorithms.
__weak_func void hmacUpdate(HmacContext *context, const void *data, size_t length)
Update the HMAC context with a portion of the message being hashed.
error_t pbkdf2(const HashAlgo *hash, const uint8_t *p, size_t pLen, const uint8_t *s, size_t sLen, uint_t c, uint8_t *dk, size_t dkLen)
PBKDF2 key derivation function.
PBKDF (Password-Based Key Derivation Function)
__weak_func void hmacFinal(HmacContext *context, uint8_t *digest)
Finish the HMAC calculation.
error_t pbkdf1(const HashAlgo *hash, const uint8_t *p, size_t pLen, const uint8_t *s, size_t sLen, uint_t c, uint8_t *dk, size_t dkLen)
PBKDF1 key derivation function.
#define cryptoAllocMem(size)
Common interface for hash algorithms.
const uint8_t PBKDF2_OID[9]
__weak_func error_t hmacInit(HmacContext *context, const HashAlgo *hash, const void *key, size_t keyLen)
Initialize HMAC calculation.
HMAC (Keyed-Hashing for Message Authentication)