diff options
Diffstat (limited to 'libtomcrypt/src/misc/pkcs5/pkcs_5_2.c')
-rw-r--r-- | libtomcrypt/src/misc/pkcs5/pkcs_5_2.c | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/libtomcrypt/src/misc/pkcs5/pkcs_5_2.c b/libtomcrypt/src/misc/pkcs5/pkcs_5_2.c index 0d76d62..2265bcb 100644 --- a/libtomcrypt/src/misc/pkcs5/pkcs_5_2.c +++ b/libtomcrypt/src/misc/pkcs5/pkcs_5_2.c @@ -5,30 +5,28 @@ * * The library is free for all purposes without any express * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ -#include <tomcrypt.h> +#include "tomcrypt.h" -/** +/** @file pkcs_5_2.c - LTC_PKCS #5, Algorithm #2, Tom St Denis + PKCS #5, Algorithm #2, Tom St Denis */ #ifdef LTC_PKCS_5 /** - Execute LTC_PKCS #5 v2 + Execute PKCS #5 v2 @param password The input password (or key) @param password_len The length of the password (octets) @param salt The salt (or nonce) @param salt_len The length of the salt (octets) - @param iteration_count # of iterations desired for LTC_PKCS #5 v2 [read specs for more] + @param iteration_count # of iterations desired for PKCS #5 v2 [read specs for more] @param hash_idx The index of the hash desired @param out [out] The destination for this algorithm @param outlen [in/out] The max size and resulting size of the algorithm output @return CRYPT_OK if successful */ -int pkcs_5_alg2(const unsigned char *password, unsigned long password_len, +int pkcs_5_alg2(const unsigned char *password, unsigned long password_len, const unsigned char *salt, unsigned long salt_len, int iteration_count, int hash_idx, unsigned char *out, unsigned long *outlen) @@ -69,13 +67,13 @@ int pkcs_5_alg2(const unsigned char *password, unsigned long password_len, while (left != 0) { /* process block number blkno */ zeromem(buf[0], MAXBLOCKSIZE*2); - + /* store current block number and increment for next pass */ STORE32H(blkno, buf[1]); ++blkno; /* get PRF(P, S||int(blkno)) */ - if ((err = hmac_init(hmac, hash_idx, password, password_len)) != CRYPT_OK) { + if ((err = hmac_init(hmac, hash_idx, password, password_len)) != CRYPT_OK) { goto LBL_ERR; } if ((err = hmac_process(hmac, salt, salt_len)) != CRYPT_OK) { @@ -124,6 +122,6 @@ LBL_ERR: #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ |