|
@@ -10,13 +10,15 @@
|
|
*/
|
|
*/
|
|
#include "tomcrypt.h"
|
|
#include "tomcrypt.h"
|
|
#include <stdarg.h>
|
|
#include <stdarg.h>
|
|
|
|
+
|
|
|
|
+#ifdef LTC_HASH_HELPERS
|
|
/**
|
|
/**
|
|
@file hash_memory_multi.c
|
|
@file hash_memory_multi.c
|
|
Hash (multiple buffers) memory helper, Tom St Denis
|
|
Hash (multiple buffers) memory helper, Tom St Denis
|
|
*/
|
|
*/
|
|
|
|
|
|
/**
|
|
/**
|
|
- Hash multiple (non-adjacent) blocks of memory at once.
|
|
|
|
|
|
+ Hash multiple (non-adjacent) blocks of memory at once.
|
|
@param hash The index of the hash you wish to use
|
|
@param hash The index of the hash you wish to use
|
|
@param out [out] Where to store the digest
|
|
@param out [out] Where to store the digest
|
|
@param outlen [in/out] Max size and resulting size of the digest
|
|
@param outlen [in/out] Max size and resulting size of the digest
|
|
@@ -24,7 +26,7 @@
|
|
@param inlen The length of the data to hash (octets)
|
|
@param inlen The length of the data to hash (octets)
|
|
@param ... tuples of (data,len) pairs to hash, terminated with a (NULL,x) (x=don't care)
|
|
@param ... tuples of (data,len) pairs to hash, terminated with a (NULL,x) (x=don't care)
|
|
@return CRYPT_OK if successful
|
|
@return CRYPT_OK if successful
|
|
-*/
|
|
|
|
|
|
+*/
|
|
int hash_memory_multi(int hash, unsigned char *out, unsigned long *outlen,
|
|
int hash_memory_multi(int hash, unsigned char *out, unsigned long *outlen,
|
|
const unsigned char *in, unsigned long inlen, ...)
|
|
const unsigned char *in, unsigned long inlen, ...)
|
|
{
|
|
{
|
|
@@ -57,7 +59,7 @@ int hash_memory_multi(int hash, unsigned char *out, unsigned long *outlen,
|
|
}
|
|
}
|
|
|
|
|
|
va_start(args, inlen);
|
|
va_start(args, inlen);
|
|
- curptr = in;
|
|
|
|
|
|
+ curptr = in;
|
|
curlen = inlen;
|
|
curlen = inlen;
|
|
for (;;) {
|
|
for (;;) {
|
|
/* process buf */
|
|
/* process buf */
|
|
@@ -81,6 +83,7 @@ LBL_ERR:
|
|
va_end(args);
|
|
va_end(args);
|
|
return err;
|
|
return err;
|
|
}
|
|
}
|
|
|
|
+#endif /* #ifdef LTC_HASH_HELPERS */
|
|
|
|
|
|
/* $Source$ */
|
|
/* $Source$ */
|
|
/* $Revision$ */
|
|
/* $Revision$ */
|