Mercurial > dropbear
diff libtomcrypt/src/misc/pkcs5/pkcs_5_2.c @ 1471:6dba84798cd5
Update to libtomcrypt 1.18.1, merged with Dropbear changes
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Fri, 09 Feb 2018 21:44:05 +0800 |
parents | f849a5ca2efc |
children |
line wrap: on
line diff
--- a/libtomcrypt/src/misc/pkcs5/pkcs_5_2.c Thu Feb 08 23:11:40 2018 +0800 +++ b/libtomcrypt/src/misc/pkcs5/pkcs_5_2.c Fri Feb 09 21:44:05 2018 +0800 @@ -5,30 +5,28 @@ * * The library is free for all purposes without any express * guarantee it works. - * - * Tom St Denis, [email protected], 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 @@ 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 @@ #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */