trim trailing spaces/clean up
This commit is contained in:
committed by
Steffen Jaeckel
parent
d78aa37c10
commit
8e7777b554
@@ -9,7 +9,6 @@
|
||||
* Tom St Denis, tomstdenis@gmail.com, http://libtom.org
|
||||
*/
|
||||
#include "tomcrypt.h"
|
||||
#include <signal.h>
|
||||
|
||||
/**
|
||||
@file crypt_argchk.c
|
||||
@@ -17,6 +16,7 @@
|
||||
*/
|
||||
|
||||
#if (ARGTYPE == 0)
|
||||
#include <signal.h>
|
||||
void crypt_argchk(char *v, char *s, int d)
|
||||
{
|
||||
fprintf(stderr, "LTC_ARGCHK '%s' failure on line %d of file %s\n",
|
||||
|
||||
@@ -10,24 +10,24 @@
|
||||
*/
|
||||
#include <tomcrypt.h>
|
||||
|
||||
/**
|
||||
/**
|
||||
@file pkcs_5_1.c
|
||||
LTC_PKCS #5, Algorithm #1, Tom St Denis
|
||||
PKCS #5, Algorithm #1, Tom St Denis
|
||||
*/
|
||||
#ifdef LTC_PKCS_5
|
||||
/**
|
||||
Execute LTC_PKCS #5 v1
|
||||
Execute PKCS #5 v1
|
||||
@param password The password (or key)
|
||||
@param password_len The length of the password (octet)
|
||||
@param salt The salt (or nonce) which is 8 octets long
|
||||
@param iteration_count The LTC_PKCS #5 v1 iteration count
|
||||
@param iteration_count The PKCS #5 v1 iteration count
|
||||
@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_alg1(const unsigned char *password, unsigned long password_len,
|
||||
const unsigned char *salt,
|
||||
int pkcs_5_alg1(const unsigned char *password, unsigned long password_len,
|
||||
const unsigned char *salt,
|
||||
int iteration_count, int hash_idx,
|
||||
unsigned char *out, unsigned long *outlen)
|
||||
{
|
||||
@@ -53,11 +53,11 @@ int pkcs_5_alg1(const unsigned char *password, unsigned long password_len,
|
||||
if (md != NULL) {
|
||||
XFREE(md);
|
||||
}
|
||||
if (buf != NULL) {
|
||||
if (buf != NULL) {
|
||||
XFREE(buf);
|
||||
}
|
||||
return CRYPT_MEM;
|
||||
}
|
||||
}
|
||||
|
||||
/* hash initial password + salt */
|
||||
if ((err = hash_descriptor[hash_idx].init(md)) != CRYPT_OK) {
|
||||
@@ -88,7 +88,7 @@ int pkcs_5_alg1(const unsigned char *password, unsigned long password_len,
|
||||
*outlen = x;
|
||||
err = CRYPT_OK;
|
||||
LBL_ERR:
|
||||
#ifdef LTC_CLEAN_STACK
|
||||
#ifdef LTC_CLEAN_STACK
|
||||
zeromem(buf, MAXBLOCKSIZE);
|
||||
zeromem(md, sizeof(hash_state));
|
||||
#endif
|
||||
|
||||
@@ -10,25 +10,25 @@
|
||||
*/
|
||||
#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 +69,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) {
|
||||
|
||||
Reference in New Issue
Block a user