mirror of
https://github.com/cryb-to/cryb-to.git
synced 2024-11-29 17:15:41 +00:00
Consistently use const void * for data and keys, uint8_t * for digests
and MACs, and uint8_t, uint32_t or uint64_t (as appropriate) for internal state. Also remove a few unnecessary casts.
This commit is contained in:
parent
a9e8aed740
commit
340b3240cf
27 changed files with 126 additions and 137 deletions
|
@ -43,8 +43,8 @@
|
||||||
typedef void digest_ctx;
|
typedef void digest_ctx;
|
||||||
typedef void (*digest_init_func)(digest_ctx *);
|
typedef void (*digest_init_func)(digest_ctx *);
|
||||||
typedef void (*digest_update_func)(digest_ctx *, const void *, size_t);
|
typedef void (*digest_update_func)(digest_ctx *, const void *, size_t);
|
||||||
typedef void (*digest_final_func)(digest_ctx *, void *);
|
typedef void (*digest_final_func)(digest_ctx *, uint8_t *);
|
||||||
typedef int (*digest_complete_func)(const void *, size_t, void *);
|
typedef int (*digest_complete_func)(const void *, size_t, uint8_t *);
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
const char *name; /* algorithm name */
|
const char *name; /* algorithm name */
|
||||||
|
|
|
@ -49,7 +49,7 @@ typedef struct {
|
||||||
|
|
||||||
void hmac_sha1_init(hmac_sha1_ctx *, const void *, size_t);
|
void hmac_sha1_init(hmac_sha1_ctx *, const void *, size_t);
|
||||||
void hmac_sha1_update(hmac_sha1_ctx *, const void *, size_t);
|
void hmac_sha1_update(hmac_sha1_ctx *, const void *, size_t);
|
||||||
void hmac_sha1_final(hmac_sha1_ctx *, void *);
|
void hmac_sha1_final(hmac_sha1_ctx *, uint8_t *);
|
||||||
void hmac_sha1_complete(const void *, size_t, const void *, size_t, void *);
|
void hmac_sha1_complete(const void *, size_t, const void *, size_t, uint8_t *);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -49,7 +49,7 @@ typedef struct {
|
||||||
|
|
||||||
void hmac_sha224_init(hmac_sha224_ctx *, const void *, size_t);
|
void hmac_sha224_init(hmac_sha224_ctx *, const void *, size_t);
|
||||||
void hmac_sha224_update(hmac_sha224_ctx *, const void *, size_t);
|
void hmac_sha224_update(hmac_sha224_ctx *, const void *, size_t);
|
||||||
void hmac_sha224_final(hmac_sha224_ctx *, void *);
|
void hmac_sha224_final(hmac_sha224_ctx *, uint8_t *);
|
||||||
void hmac_sha224_complete(const void *, size_t, const void *, size_t, void *);
|
void hmac_sha224_complete(const void *, size_t, const void *, size_t, uint8_t *);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -49,7 +49,7 @@ typedef struct {
|
||||||
|
|
||||||
void hmac_sha256_init(hmac_sha256_ctx *, const void *, size_t);
|
void hmac_sha256_init(hmac_sha256_ctx *, const void *, size_t);
|
||||||
void hmac_sha256_update(hmac_sha256_ctx *, const void *, size_t);
|
void hmac_sha256_update(hmac_sha256_ctx *, const void *, size_t);
|
||||||
void hmac_sha256_final(hmac_sha256_ctx *, void *);
|
void hmac_sha256_final(hmac_sha256_ctx *, uint8_t *);
|
||||||
void hmac_sha256_complete(const void *, size_t, const void *, size_t, void *);
|
void hmac_sha256_complete(const void *, size_t, const void *, size_t, uint8_t *);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -49,7 +49,7 @@ typedef struct {
|
||||||
|
|
||||||
void hmac_sha384_init(hmac_sha384_ctx *, const void *, size_t);
|
void hmac_sha384_init(hmac_sha384_ctx *, const void *, size_t);
|
||||||
void hmac_sha384_update(hmac_sha384_ctx *, const void *, size_t);
|
void hmac_sha384_update(hmac_sha384_ctx *, const void *, size_t);
|
||||||
void hmac_sha384_final(hmac_sha384_ctx *, void *);
|
void hmac_sha384_final(hmac_sha384_ctx *, uint8_t *);
|
||||||
void hmac_sha384_complete(const void *, size_t, const void *, size_t, void *);
|
void hmac_sha384_complete(const void *, size_t, const void *, size_t, uint8_t *);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -49,7 +49,7 @@ typedef struct {
|
||||||
|
|
||||||
void hmac_sha512_init(hmac_sha512_ctx *, const void *, size_t);
|
void hmac_sha512_init(hmac_sha512_ctx *, const void *, size_t);
|
||||||
void hmac_sha512_update(hmac_sha512_ctx *, const void *, size_t);
|
void hmac_sha512_update(hmac_sha512_ctx *, const void *, size_t);
|
||||||
void hmac_sha512_final(hmac_sha512_ctx *, void *);
|
void hmac_sha512_final(hmac_sha512_ctx *, uint8_t *);
|
||||||
void hmac_sha512_complete(const void *, size_t, const void *, size_t, void *);
|
void hmac_sha512_complete(const void *, size_t, const void *, size_t, uint8_t *);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -51,9 +51,9 @@ extern digest_algorithm md2_algorithm;
|
||||||
*/
|
*/
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
unsigned char cksum[16]; /*!< checksum of the data block */
|
uint8_t cksum[16]; /*!< checksum of the data block */
|
||||||
unsigned char state[48]; /*!< intermediate digest state */
|
uint8_t state[48]; /*!< intermediate digest state */
|
||||||
unsigned char buffer[16]; /*!< data block being processed */
|
uint8_t buffer[16]; /*!< data block being processed */
|
||||||
int left; /*!< amount of data in buffer */
|
int left; /*!< amount of data in buffer */
|
||||||
} md2_ctx;
|
} md2_ctx;
|
||||||
|
|
||||||
|
@ -83,7 +83,7 @@ void md2_update( md2_ctx *ctx, const void *input, int ilen );
|
||||||
* \param ctx MD2 context
|
* \param ctx MD2 context
|
||||||
* \param output MD2 checksum result
|
* \param output MD2 checksum result
|
||||||
*/
|
*/
|
||||||
void md2_final( md2_ctx *ctx, unsigned char output[16] );
|
void md2_final( md2_ctx *ctx, uint8_t *output );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Output = MD2( input buffer )
|
* \brief Output = MD2( input buffer )
|
||||||
|
@ -92,7 +92,7 @@ void md2_final( md2_ctx *ctx, unsigned char output[16] );
|
||||||
* \param ilen length of the input data
|
* \param ilen length of the input data
|
||||||
* \param output MD2 checksum result
|
* \param output MD2 checksum result
|
||||||
*/
|
*/
|
||||||
void md2_complete( const void *input, int ilen, unsigned char output[16] );
|
void md2_complete( const void *input, int ilen, uint8_t *output );
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,9 +51,9 @@ extern digest_algorithm md4_digest;
|
||||||
*/
|
*/
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
unsigned long total[2]; /*!< number of bytes processed */
|
uint32_t total[2]; /*!< number of bytes processed */
|
||||||
unsigned long state[4]; /*!< intermediate digest state */
|
uint32_t state[4]; /*!< intermediate digest state */
|
||||||
unsigned char buffer[64]; /*!< data block being processed */
|
uint8_t buffer[64]; /*!< data block being processed */
|
||||||
}
|
}
|
||||||
md4_ctx;
|
md4_ctx;
|
||||||
|
|
||||||
|
@ -83,7 +83,7 @@ void md4_update( md4_ctx *ctx, const void *input, int ilen );
|
||||||
* \param ctx MD4 context
|
* \param ctx MD4 context
|
||||||
* \param output MD4 checksum result
|
* \param output MD4 checksum result
|
||||||
*/
|
*/
|
||||||
void md4_final( md4_ctx *ctx, unsigned char output[16] );
|
void md4_final( md4_ctx *ctx, uint8_t *output );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Output = MD4( input buffer )
|
* \brief Output = MD4( input buffer )
|
||||||
|
@ -92,7 +92,7 @@ void md4_final( md4_ctx *ctx, unsigned char output[16] );
|
||||||
* \param ilen length of the input data
|
* \param ilen length of the input data
|
||||||
* \param output MD4 checksum result
|
* \param output MD4 checksum result
|
||||||
*/
|
*/
|
||||||
void md4_complete( const void *input, int ilen, unsigned char output[16] );
|
void md4_complete( const void *input, int ilen, uint8_t *output );
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|
|
@ -59,7 +59,7 @@ typedef struct {
|
||||||
|
|
||||||
void md5_init(md5_ctx *);
|
void md5_init(md5_ctx *);
|
||||||
void md5_update(md5_ctx *, const void *, size_t);
|
void md5_update(md5_ctx *, const void *, size_t);
|
||||||
void md5_final(md5_ctx *, void *);
|
void md5_final(md5_ctx *, uint8_t *);
|
||||||
void md5_complete(const void *, size_t, void *);
|
void md5_complete(const void *, size_t, uint8_t *);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -61,7 +61,7 @@ extern digest_algorithm sha1_algorithm;
|
||||||
|
|
||||||
void sha1_init(sha1_ctx *);
|
void sha1_init(sha1_ctx *);
|
||||||
void sha1_update(sha1_ctx *, const void *, size_t);
|
void sha1_update(sha1_ctx *, const void *, size_t);
|
||||||
void sha1_final(sha1_ctx *, void *);
|
void sha1_final(sha1_ctx *, uint8_t *);
|
||||||
void sha1_complete(const void *, size_t, void *);
|
void sha1_complete(const void *, size_t, uint8_t *);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -71,13 +71,13 @@ void sha224_update(sha224_ctx *, const void *, size_t);
|
||||||
* Output the SHA224 hash of the data input to the context ${ctx} into the
|
* Output the SHA224 hash of the data input to the context ${ctx} into the
|
||||||
* buffer ${digest}.
|
* buffer ${digest}.
|
||||||
*/
|
*/
|
||||||
void sha224_final(sha224_ctx *, uint8_t[SHA224_DIGEST_LEN]);
|
void sha224_final(sha224_ctx *, uint8_t *);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* sha224_complete(in, len, digest):
|
* sha224_complete(in, len, digest):
|
||||||
* Compute the SHA224 hash of ${len} bytes from $in} and write it to ${digest}.
|
* Compute the SHA224 hash of ${len} bytes from $in} and write it to ${digest}.
|
||||||
*/
|
*/
|
||||||
void sha224_complete(const void *, size_t, uint8_t[SHA224_DIGEST_LEN]);
|
void sha224_complete(const void *, size_t, uint8_t *);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PBKDF2_SHA224(passwd, passwdlen, salt, saltlen, c, buf, dkLen):
|
* PBKDF2_SHA224(passwd, passwdlen, salt, saltlen, c, buf, dkLen):
|
||||||
|
|
|
@ -71,13 +71,13 @@ void sha256_update(sha256_ctx *, const void *, size_t);
|
||||||
* Output the SHA256 hash of the data input to the context ${ctx} into the
|
* Output the SHA256 hash of the data input to the context ${ctx} into the
|
||||||
* buffer ${digest}.
|
* buffer ${digest}.
|
||||||
*/
|
*/
|
||||||
void sha256_final(sha256_ctx *, uint8_t[SHA256_DIGEST_LEN]);
|
void sha256_final(sha256_ctx *, uint8_t *);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* sha256_complete(in, len, digest):
|
* sha256_complete(in, len, digest):
|
||||||
* Compute the SHA256 hash of ${len} bytes from $in} and write it to ${digest}.
|
* Compute the SHA256 hash of ${len} bytes from $in} and write it to ${digest}.
|
||||||
*/
|
*/
|
||||||
void sha256_complete(const void *, size_t, uint8_t[SHA256_DIGEST_LEN]);
|
void sha256_complete(const void *, size_t, uint8_t *);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PBKDF2_SHA256(passwd, passwdlen, salt, saltlen, c, buf, dkLen):
|
* PBKDF2_SHA256(passwd, passwdlen, salt, saltlen, c, buf, dkLen):
|
||||||
|
|
|
@ -83,7 +83,7 @@ void sha384_update( sha384_ctx *ctx, const void *input, int ilen );
|
||||||
* \param ctx SHA-384 context
|
* \param ctx SHA-384 context
|
||||||
* \param output SHA-384/384 checksum result
|
* \param output SHA-384/384 checksum result
|
||||||
*/
|
*/
|
||||||
void sha384_final( sha384_ctx *ctx, unsigned char output[64] );
|
void sha384_final( sha384_ctx *ctx, uint8_t *output );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Output = SHA-384( input buffer )
|
* \brief Output = SHA-384( input buffer )
|
||||||
|
@ -92,8 +92,7 @@ void sha384_final( sha384_ctx *ctx, unsigned char output[64] );
|
||||||
* \param ilen length of the input data
|
* \param ilen length of the input data
|
||||||
* \param output SHA-384/384 checksum result
|
* \param output SHA-384/384 checksum result
|
||||||
*/
|
*/
|
||||||
void sha384_complete( const void *input, int ilen,
|
void sha384_complete( const void *input, int ilen, uint8_t *output );
|
||||||
unsigned char output[64] );
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|
|
@ -83,7 +83,7 @@ void sha512_update( sha512_ctx *ctx, const void *input, int ilen );
|
||||||
* \param ctx SHA-512 context
|
* \param ctx SHA-512 context
|
||||||
* \param output SHA-384/512 checksum result
|
* \param output SHA-384/512 checksum result
|
||||||
*/
|
*/
|
||||||
void sha512_final( sha512_ctx *ctx, unsigned char output[64] );
|
void sha512_final( sha512_ctx *ctx, uint8_t *output );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Output = SHA-512( input buffer )
|
* \brief Output = SHA-512( input buffer )
|
||||||
|
@ -92,8 +92,7 @@ void sha512_final( sha512_ctx *ctx, unsigned char output[64] );
|
||||||
* \param ilen length of the input data
|
* \param ilen length of the input data
|
||||||
* \param output SHA-384/512 checksum result
|
* \param output SHA-384/512 checksum result
|
||||||
*/
|
*/
|
||||||
void sha512_complete( const void *input, int ilen,
|
void sha512_complete( const void *input, int ilen, uint8_t *output );
|
||||||
unsigned char output[64] );
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,11 +37,12 @@
|
||||||
|
|
||||||
#include "cryb/impl.h"
|
#include "cryb/impl.h"
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include <cryb/md2.h>
|
#include <cryb/md2.h>
|
||||||
|
|
||||||
static const unsigned char PI_SUBST[256] =
|
static const uint8_t PI_SUBST[256] =
|
||||||
{
|
{
|
||||||
0x29, 0x2E, 0x43, 0xC9, 0xA2, 0xD8, 0x7C, 0x01, 0x3D, 0x36,
|
0x29, 0x2E, 0x43, 0xC9, 0xA2, 0xD8, 0x7C, 0x01, 0x3D, 0x36,
|
||||||
0x54, 0xA1, 0xEC, 0xF0, 0x06, 0x13, 0x62, 0xA7, 0x05, 0xF3,
|
0x54, 0xA1, 0xEC, 0xF0, 0x06, 0x13, 0x62, 0xA7, 0x05, 0xF3,
|
||||||
|
@ -82,32 +83,32 @@ void md2_init( md2_ctx *ctx )
|
||||||
static void md2_process( md2_ctx *ctx )
|
static void md2_process( md2_ctx *ctx )
|
||||||
{
|
{
|
||||||
int i, j;
|
int i, j;
|
||||||
unsigned char t = 0;
|
uint8_t t = 0;
|
||||||
|
|
||||||
for( i = 0; i < 16; i++ )
|
for( i = 0; i < 16; i++ )
|
||||||
{
|
{
|
||||||
ctx->state[i + 16] = ctx->buffer[i];
|
ctx->state[i + 16] = ctx->buffer[i];
|
||||||
ctx->state[i + 32] =
|
ctx->state[i + 32] =
|
||||||
(unsigned char)( ctx->buffer[i] ^ ctx->state[i]);
|
(uint8_t)( ctx->buffer[i] ^ ctx->state[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
for( i = 0; i < 18; i++ )
|
for( i = 0; i < 18; i++ )
|
||||||
{
|
{
|
||||||
for( j = 0; j < 48; j++ )
|
for( j = 0; j < 48; j++ )
|
||||||
{
|
{
|
||||||
ctx->state[j] = (unsigned char)
|
ctx->state[j] = (uint8_t)
|
||||||
( ctx->state[j] ^ PI_SUBST[t] );
|
( ctx->state[j] ^ PI_SUBST[t] );
|
||||||
t = ctx->state[j];
|
t = ctx->state[j];
|
||||||
}
|
}
|
||||||
|
|
||||||
t = (unsigned char)( t + i );
|
t = (uint8_t)( t + i );
|
||||||
}
|
}
|
||||||
|
|
||||||
t = ctx->cksum[15];
|
t = ctx->cksum[15];
|
||||||
|
|
||||||
for( i = 0; i < 16; i++ )
|
for( i = 0; i < 16; i++ )
|
||||||
{
|
{
|
||||||
ctx->cksum[i] = (unsigned char)
|
ctx->cksum[i] = (uint8_t)
|
||||||
( ctx->cksum[i] ^ PI_SUBST[ctx->buffer[i] ^ t] );
|
( ctx->cksum[i] ^ PI_SUBST[ctx->buffer[i] ^ t] );
|
||||||
t = ctx->cksum[i];
|
t = ctx->cksum[i];
|
||||||
}
|
}
|
||||||
|
@ -144,12 +145,12 @@ void md2_update( md2_ctx *ctx, const void *input, int ilen )
|
||||||
/*
|
/*
|
||||||
* MD2 final digest
|
* MD2 final digest
|
||||||
*/
|
*/
|
||||||
void md2_final( md2_ctx *ctx, unsigned char *output )
|
void md2_final( md2_ctx *ctx, uint8_t *output )
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
unsigned char x;
|
uint8_t x;
|
||||||
|
|
||||||
x = (unsigned char)( 16 - ctx->left );
|
x = (uint8_t)( 16 - ctx->left );
|
||||||
|
|
||||||
for( i = ctx->left; i < 16; i++ )
|
for( i = ctx->left; i < 16; i++ )
|
||||||
ctx->buffer[i] = x;
|
ctx->buffer[i] = x;
|
||||||
|
@ -165,7 +166,7 @@ void md2_final( md2_ctx *ctx, unsigned char *output )
|
||||||
/*
|
/*
|
||||||
* output = MD2( input buffer )
|
* output = MD2( input buffer )
|
||||||
*/
|
*/
|
||||||
void md2_complete( const void *input, int ilen, unsigned char *output )
|
void md2_complete( const void *input, int ilen, uint8_t *output )
|
||||||
{
|
{
|
||||||
md2_ctx ctx;
|
md2_ctx ctx;
|
||||||
|
|
||||||
|
|
|
@ -37,6 +37,16 @@
|
||||||
|
|
||||||
#include "cryb/impl.h"
|
#include "cryb/impl.h"
|
||||||
|
|
||||||
|
#ifdef HAVE_SYS_ENDIAN_H
|
||||||
|
#include <sys/endian.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAVE_ENDIAN_H
|
||||||
|
#define _BSD_SOURCE
|
||||||
|
#include <endian.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include <cryb/md4.h>
|
#include <cryb/md4.h>
|
||||||
|
@ -44,25 +54,13 @@
|
||||||
/*
|
/*
|
||||||
* 32-bit integer manipulation macros (little endian)
|
* 32-bit integer manipulation macros (little endian)
|
||||||
*/
|
*/
|
||||||
#ifndef GET_ULONG_LE
|
#undef GET_ULONG_LE
|
||||||
#define GET_ULONG_LE(n,b,i) \
|
#define GET_ULONG_LE(n,b,i) \
|
||||||
do { \
|
do { (n) = le32dec((uint8_t *)(b) + (i)); } while (0)
|
||||||
(n) = ( (unsigned long) (b)[(i) ] ) \
|
|
||||||
| ( (unsigned long) (b)[(i) + 1] << 8 ) \
|
|
||||||
| ( (unsigned long) (b)[(i) + 2] << 16 ) \
|
|
||||||
| ( (unsigned long) (b)[(i) + 3] << 24 ); \
|
|
||||||
} while (0)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef PUT_ULONG_LE
|
#undef PUT_ULONG_LE
|
||||||
#define PUT_ULONG_LE(n,b,i) \
|
#define PUT_ULONG_LE(n,b,i) \
|
||||||
do { \
|
do { le32enc((uint8_t *)(b) + (i), (n)); } while (0)
|
||||||
(b)[(i) ] = (unsigned char) ( (n) ); \
|
|
||||||
(b)[(i) + 1] = (unsigned char) ( (n) >> 8 ); \
|
|
||||||
(b)[(i) + 2] = (unsigned char) ( (n) >> 16 ); \
|
|
||||||
(b)[(i) + 3] = (unsigned char) ( (n) >> 24 ); \
|
|
||||||
} while (0)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* MD4 context setup
|
* MD4 context setup
|
||||||
|
@ -78,9 +76,9 @@ void md4_init( md4_ctx *ctx )
|
||||||
ctx->state[3] = 0x10325476;
|
ctx->state[3] = 0x10325476;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void md4_process( md4_ctx *ctx, const unsigned char *data )
|
static void md4_process( md4_ctx *ctx, const uint8_t *data )
|
||||||
{
|
{
|
||||||
unsigned long X[16], A, B, C, D;
|
uint32_t X[16], A, B, C, D;
|
||||||
|
|
||||||
GET_ULONG_LE( X[ 0], data, 0 );
|
GET_ULONG_LE( X[ 0], data, 0 );
|
||||||
GET_ULONG_LE( X[ 1], data, 4 );
|
GET_ULONG_LE( X[ 1], data, 4 );
|
||||||
|
@ -187,7 +185,7 @@ static void md4_process( md4_ctx *ctx, const unsigned char *data )
|
||||||
void md4_update( md4_ctx *ctx, const void *input, int ilen )
|
void md4_update( md4_ctx *ctx, const void *input, int ilen )
|
||||||
{
|
{
|
||||||
int fill;
|
int fill;
|
||||||
unsigned long left;
|
uint32_t left;
|
||||||
|
|
||||||
if( ilen <= 0 )
|
if( ilen <= 0 )
|
||||||
return;
|
return;
|
||||||
|
@ -198,13 +196,12 @@ void md4_update( md4_ctx *ctx, const void *input, int ilen )
|
||||||
ctx->total[0] += ilen;
|
ctx->total[0] += ilen;
|
||||||
ctx->total[0] &= 0xFFFFFFFF;
|
ctx->total[0] &= 0xFFFFFFFF;
|
||||||
|
|
||||||
if( ctx->total[0] < (unsigned long) ilen )
|
if( ctx->total[0] < (uint32_t) ilen )
|
||||||
ctx->total[1]++;
|
ctx->total[1]++;
|
||||||
|
|
||||||
if( left && ilen >= fill )
|
if( left && ilen >= fill )
|
||||||
{
|
{
|
||||||
memcpy( (void *) (ctx->buffer + left),
|
memcpy( (ctx->buffer + left), input, fill );
|
||||||
(void *) input, fill );
|
|
||||||
md4_process( ctx, ctx->buffer );
|
md4_process( ctx, ctx->buffer );
|
||||||
input += fill;
|
input += fill;
|
||||||
ilen -= fill;
|
ilen -= fill;
|
||||||
|
@ -220,12 +217,11 @@ void md4_update( md4_ctx *ctx, const void *input, int ilen )
|
||||||
|
|
||||||
if( ilen > 0 )
|
if( ilen > 0 )
|
||||||
{
|
{
|
||||||
memcpy( (void *) (ctx->buffer + left),
|
memcpy( (ctx->buffer + left), input, ilen );
|
||||||
(void *) input, ilen );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static const unsigned char md4_padding[64] =
|
static const uint8_t md4_padding[64] =
|
||||||
{
|
{
|
||||||
0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
|
@ -236,11 +232,11 @@ static const unsigned char md4_padding[64] =
|
||||||
/*
|
/*
|
||||||
* MD4 final digest
|
* MD4 final digest
|
||||||
*/
|
*/
|
||||||
void md4_final( md4_ctx *ctx, unsigned char *output )
|
void md4_final( md4_ctx *ctx, uint8_t *output )
|
||||||
{
|
{
|
||||||
unsigned long last, padn;
|
uint32_t last, padn;
|
||||||
unsigned long high, low;
|
uint32_t high, low;
|
||||||
unsigned char msglen[8];
|
uint8_t msglen[8];
|
||||||
|
|
||||||
high = ( ctx->total[0] >> 29 )
|
high = ( ctx->total[0] >> 29 )
|
||||||
| ( ctx->total[1] << 3 );
|
| ( ctx->total[1] << 3 );
|
||||||
|
@ -264,7 +260,7 @@ void md4_final( md4_ctx *ctx, unsigned char *output )
|
||||||
/*
|
/*
|
||||||
* output = MD4( input buffer )
|
* output = MD4( input buffer )
|
||||||
*/
|
*/
|
||||||
void md4_complete( const void *input, int ilen, unsigned char *output )
|
void md4_complete( const void *input, int ilen, uint8_t *output )
|
||||||
{
|
{
|
||||||
md4_ctx ctx;
|
md4_ctx ctx;
|
||||||
|
|
||||||
|
|
|
@ -221,7 +221,7 @@ md5_update(md5_ctx *ctx, const void *buf, size_t len)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
md5_final(md5_ctx *ctx, void *digest)
|
md5_final(md5_ctx *ctx, uint8_t *digest)
|
||||||
{
|
{
|
||||||
|
|
||||||
ctx->block[ctx->blocklen++] = 0x80;
|
ctx->block[ctx->blocklen++] = 0x80;
|
||||||
|
@ -241,7 +241,7 @@ md5_final(md5_ctx *ctx, void *digest)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
md5_complete(const void *buf, size_t len, void *digest)
|
md5_complete(const void *buf, size_t len, uint8_t *digest)
|
||||||
{
|
{
|
||||||
md5_ctx ctx;
|
md5_ctx ctx;
|
||||||
|
|
||||||
|
|
|
@ -216,7 +216,7 @@ sha1_update(sha1_ctx *ctx, const void *buf, size_t len)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
sha1_final(sha1_ctx *ctx, void *digest)
|
sha1_final(sha1_ctx *ctx, uint8_t *digest)
|
||||||
{
|
{
|
||||||
uint32_t hi, lo;
|
uint32_t hi, lo;
|
||||||
|
|
||||||
|
@ -239,7 +239,7 @@ sha1_final(sha1_ctx *ctx, void *digest)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
sha1_complete(const void *buf, size_t len, void *digest)
|
sha1_complete(const void *buf, size_t len, uint8_t *digest)
|
||||||
{
|
{
|
||||||
sha1_ctx ctx;
|
sha1_ctx ctx;
|
||||||
|
|
||||||
|
|
|
@ -289,7 +289,7 @@ sha224_update(sha224_ctx * ctx, const void *in, size_t len)
|
||||||
* buffer ${digest}.
|
* buffer ${digest}.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
sha224_final(sha224_ctx * ctx, uint8_t digest[SHA224_DIGEST_LEN])
|
sha224_final(sha224_ctx * ctx, uint8_t *digest)
|
||||||
{
|
{
|
||||||
|
|
||||||
/* Add padding. */
|
/* Add padding. */
|
||||||
|
@ -299,7 +299,7 @@ sha224_final(sha224_ctx * ctx, uint8_t digest[SHA224_DIGEST_LEN])
|
||||||
be32enc_vect(digest, ctx->state, SHA224_DIGEST_LEN);
|
be32enc_vect(digest, ctx->state, SHA224_DIGEST_LEN);
|
||||||
|
|
||||||
/* Clear the context state. */
|
/* Clear the context state. */
|
||||||
memset((void *)ctx, 0, sizeof(*ctx));
|
memset(ctx, 0, sizeof(*ctx));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -307,7 +307,7 @@ sha224_final(sha224_ctx * ctx, uint8_t digest[SHA224_DIGEST_LEN])
|
||||||
* Compute the SHA224 hash of ${len} bytes from $in} and write it to ${digest}.
|
* Compute the SHA224 hash of ${len} bytes from $in} and write it to ${digest}.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
sha224_complete(const void * in, size_t len, uint8_t digest[SHA224_DIGEST_LEN])
|
sha224_complete(const void * in, size_t len, uint8_t *digest)
|
||||||
{
|
{
|
||||||
sha224_ctx ctx;
|
sha224_ctx ctx;
|
||||||
|
|
||||||
|
|
|
@ -289,7 +289,7 @@ sha256_update(sha256_ctx * ctx, const void *in, size_t len)
|
||||||
* buffer ${digest}.
|
* buffer ${digest}.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
sha256_final(sha256_ctx * ctx, uint8_t digest[SHA256_DIGEST_LEN])
|
sha256_final(sha256_ctx * ctx, uint8_t *digest)
|
||||||
{
|
{
|
||||||
|
|
||||||
/* Add padding. */
|
/* Add padding. */
|
||||||
|
@ -299,7 +299,7 @@ sha256_final(sha256_ctx * ctx, uint8_t digest[SHA256_DIGEST_LEN])
|
||||||
be32enc_vect(digest, ctx->state, SHA256_DIGEST_LEN);
|
be32enc_vect(digest, ctx->state, SHA256_DIGEST_LEN);
|
||||||
|
|
||||||
/* Clear the context state. */
|
/* Clear the context state. */
|
||||||
memset((void *)ctx, 0, sizeof(*ctx));
|
memset(ctx, 0, sizeof(*ctx));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -307,7 +307,7 @@ sha256_final(sha256_ctx * ctx, uint8_t digest[SHA256_DIGEST_LEN])
|
||||||
* Compute the SHA256 hash of ${len} bytes from $in} and write it to ${digest}.
|
* Compute the SHA256 hash of ${len} bytes from $in} and write it to ${digest}.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
sha256_complete(const void * in, size_t len, uint8_t digest[SHA256_DIGEST_LEN])
|
sha256_complete(const void * in, size_t len, uint8_t *digest)
|
||||||
{
|
{
|
||||||
sha256_ctx ctx;
|
sha256_ctx ctx;
|
||||||
|
|
||||||
|
|
|
@ -61,14 +61,14 @@ do { \
|
||||||
#ifndef PUT_UINT64_BE
|
#ifndef PUT_UINT64_BE
|
||||||
#define PUT_UINT64_BE(n,b,i) \
|
#define PUT_UINT64_BE(n,b,i) \
|
||||||
do { \
|
do { \
|
||||||
(b)[(i) ] = (unsigned char) ( (n) >> 56 ); \
|
(b)[(i) ] = (uint8_t) ( (n) >> 56 ); \
|
||||||
(b)[(i) + 1] = (unsigned char) ( (n) >> 48 ); \
|
(b)[(i) + 1] = (uint8_t) ( (n) >> 48 ); \
|
||||||
(b)[(i) + 2] = (unsigned char) ( (n) >> 40 ); \
|
(b)[(i) + 2] = (uint8_t) ( (n) >> 40 ); \
|
||||||
(b)[(i) + 3] = (unsigned char) ( (n) >> 32 ); \
|
(b)[(i) + 3] = (uint8_t) ( (n) >> 32 ); \
|
||||||
(b)[(i) + 4] = (unsigned char) ( (n) >> 24 ); \
|
(b)[(i) + 4] = (uint8_t) ( (n) >> 24 ); \
|
||||||
(b)[(i) + 5] = (unsigned char) ( (n) >> 16 ); \
|
(b)[(i) + 5] = (uint8_t) ( (n) >> 16 ); \
|
||||||
(b)[(i) + 6] = (unsigned char) ( (n) >> 8 ); \
|
(b)[(i) + 6] = (uint8_t) ( (n) >> 8 ); \
|
||||||
(b)[(i) + 7] = (unsigned char) ( (n) ); \
|
(b)[(i) + 7] = (uint8_t) ( (n) ); \
|
||||||
} while (0)
|
} while (0)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -140,7 +140,7 @@ void sha384_init( sha384_ctx *ctx )
|
||||||
ctx->state[7] = UL64(0x47B5481DBEFA4FA4);
|
ctx->state[7] = UL64(0x47B5481DBEFA4FA4);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sha384_process( sha384_ctx *ctx, const unsigned char *data )
|
static void sha384_process( sha384_ctx *ctx, const uint8_t *data )
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
uint64_t temp1, temp2, W[80];
|
uint64_t temp1, temp2, W[80];
|
||||||
|
@ -230,8 +230,7 @@ void sha384_update( sha384_ctx *ctx, const void *input, int ilen )
|
||||||
|
|
||||||
if( left && ilen >= fill )
|
if( left && ilen >= fill )
|
||||||
{
|
{
|
||||||
memcpy( (void *) (ctx->buffer + left),
|
memcpy( (ctx->buffer + left), input, fill );
|
||||||
(void *) input, fill );
|
|
||||||
sha384_process( ctx, ctx->buffer );
|
sha384_process( ctx, ctx->buffer );
|
||||||
input += fill;
|
input += fill;
|
||||||
ilen -= fill;
|
ilen -= fill;
|
||||||
|
@ -247,12 +246,11 @@ void sha384_update( sha384_ctx *ctx, const void *input, int ilen )
|
||||||
|
|
||||||
if( ilen > 0 )
|
if( ilen > 0 )
|
||||||
{
|
{
|
||||||
memcpy( (void *) (ctx->buffer + left),
|
memcpy( (ctx->buffer + left), input, ilen );
|
||||||
(void *) input, ilen );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static const unsigned char sha384_padding[128] =
|
static const uint8_t sha384_padding[128] =
|
||||||
{
|
{
|
||||||
0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
|
@ -267,11 +265,11 @@ static const unsigned char sha384_padding[128] =
|
||||||
/*
|
/*
|
||||||
* SHA-384 final digest
|
* SHA-384 final digest
|
||||||
*/
|
*/
|
||||||
void sha384_final( sha384_ctx *ctx, unsigned char output[64] )
|
void sha384_final( sha384_ctx *ctx, uint8_t *output )
|
||||||
{
|
{
|
||||||
int last, padn;
|
int last, padn;
|
||||||
uint64_t high, low;
|
uint64_t high, low;
|
||||||
unsigned char msglen[16];
|
uint8_t msglen[16];
|
||||||
|
|
||||||
high = ( ctx->total[0] >> 61 )
|
high = ( ctx->total[0] >> 61 )
|
||||||
| ( ctx->total[1] << 3 );
|
| ( ctx->total[1] << 3 );
|
||||||
|
@ -283,7 +281,7 @@ void sha384_final( sha384_ctx *ctx, unsigned char output[64] )
|
||||||
last = (int)( ctx->total[0] & 0x7F );
|
last = (int)( ctx->total[0] & 0x7F );
|
||||||
padn = ( last < 112 ) ? ( 112 - last ) : ( 240 - last );
|
padn = ( last < 112 ) ? ( 112 - last ) : ( 240 - last );
|
||||||
|
|
||||||
sha384_update( ctx, (unsigned char *) sha384_padding, padn );
|
sha384_update( ctx, (uint8_t *) sha384_padding, padn );
|
||||||
sha384_update( ctx, msglen, 16 );
|
sha384_update( ctx, msglen, 16 );
|
||||||
|
|
||||||
PUT_UINT64_BE( ctx->state[0], output, 0 );
|
PUT_UINT64_BE( ctx->state[0], output, 0 );
|
||||||
|
@ -297,8 +295,7 @@ void sha384_final( sha384_ctx *ctx, unsigned char output[64] )
|
||||||
/*
|
/*
|
||||||
* output = SHA-384( input buffer )
|
* output = SHA-384( input buffer )
|
||||||
*/
|
*/
|
||||||
void sha384_complete( const void *input, int ilen,
|
void sha384_complete( const void *input, int ilen, uint8_t *output )
|
||||||
unsigned char output[64] )
|
|
||||||
{
|
{
|
||||||
sha384_ctx ctx;
|
sha384_ctx ctx;
|
||||||
|
|
||||||
|
|
|
@ -61,14 +61,14 @@ do { \
|
||||||
#ifndef PUT_UINT64_BE
|
#ifndef PUT_UINT64_BE
|
||||||
#define PUT_UINT64_BE(n,b,i) \
|
#define PUT_UINT64_BE(n,b,i) \
|
||||||
do { \
|
do { \
|
||||||
(b)[(i) ] = (unsigned char) ( (n) >> 56 ); \
|
(b)[(i) ] = (uint8_t) ( (n) >> 56 ); \
|
||||||
(b)[(i) + 1] = (unsigned char) ( (n) >> 48 ); \
|
(b)[(i) + 1] = (uint8_t) ( (n) >> 48 ); \
|
||||||
(b)[(i) + 2] = (unsigned char) ( (n) >> 40 ); \
|
(b)[(i) + 2] = (uint8_t) ( (n) >> 40 ); \
|
||||||
(b)[(i) + 3] = (unsigned char) ( (n) >> 32 ); \
|
(b)[(i) + 3] = (uint8_t) ( (n) >> 32 ); \
|
||||||
(b)[(i) + 4] = (unsigned char) ( (n) >> 24 ); \
|
(b)[(i) + 4] = (uint8_t) ( (n) >> 24 ); \
|
||||||
(b)[(i) + 5] = (unsigned char) ( (n) >> 16 ); \
|
(b)[(i) + 5] = (uint8_t) ( (n) >> 16 ); \
|
||||||
(b)[(i) + 6] = (unsigned char) ( (n) >> 8 ); \
|
(b)[(i) + 6] = (uint8_t) ( (n) >> 8 ); \
|
||||||
(b)[(i) + 7] = (unsigned char) ( (n) ); \
|
(b)[(i) + 7] = (uint8_t) ( (n) ); \
|
||||||
} while (0)
|
} while (0)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -140,7 +140,7 @@ void sha512_init( sha512_ctx *ctx )
|
||||||
ctx->state[7] = UL64(0x5BE0CD19137E2179);
|
ctx->state[7] = UL64(0x5BE0CD19137E2179);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sha512_process( sha512_ctx *ctx, const unsigned char *data )
|
static void sha512_process( sha512_ctx *ctx, const uint8_t *data )
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
uint64_t temp1, temp2, W[80];
|
uint64_t temp1, temp2, W[80];
|
||||||
|
@ -230,8 +230,7 @@ void sha512_update( sha512_ctx *ctx, const void *input, int ilen )
|
||||||
|
|
||||||
if( left && ilen >= fill )
|
if( left && ilen >= fill )
|
||||||
{
|
{
|
||||||
memcpy( (void *) (ctx->buffer + left),
|
memcpy( (ctx->buffer + left), input, fill );
|
||||||
(void *) input, fill );
|
|
||||||
sha512_process( ctx, ctx->buffer );
|
sha512_process( ctx, ctx->buffer );
|
||||||
input += fill;
|
input += fill;
|
||||||
ilen -= fill;
|
ilen -= fill;
|
||||||
|
@ -247,12 +246,11 @@ void sha512_update( sha512_ctx *ctx, const void *input, int ilen )
|
||||||
|
|
||||||
if( ilen > 0 )
|
if( ilen > 0 )
|
||||||
{
|
{
|
||||||
memcpy( (void *) (ctx->buffer + left),
|
memcpy( (ctx->buffer + left), input, ilen );
|
||||||
(void *) input, ilen );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static const unsigned char sha512_padding[128] =
|
static const uint8_t sha512_padding[128] =
|
||||||
{
|
{
|
||||||
0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
|
@ -267,11 +265,11 @@ static const unsigned char sha512_padding[128] =
|
||||||
/*
|
/*
|
||||||
* SHA-512 final digest
|
* SHA-512 final digest
|
||||||
*/
|
*/
|
||||||
void sha512_final( sha512_ctx *ctx, unsigned char output[64] )
|
void sha512_final( sha512_ctx *ctx, uint8_t *output )
|
||||||
{
|
{
|
||||||
int last, padn;
|
int last, padn;
|
||||||
uint64_t high, low;
|
uint64_t high, low;
|
||||||
unsigned char msglen[16];
|
uint8_t msglen[16];
|
||||||
|
|
||||||
high = ( ctx->total[0] >> 61 )
|
high = ( ctx->total[0] >> 61 )
|
||||||
| ( ctx->total[1] << 3 );
|
| ( ctx->total[1] << 3 );
|
||||||
|
@ -283,7 +281,7 @@ void sha512_final( sha512_ctx *ctx, unsigned char output[64] )
|
||||||
last = (int)( ctx->total[0] & 0x7F );
|
last = (int)( ctx->total[0] & 0x7F );
|
||||||
padn = ( last < 112 ) ? ( 112 - last ) : ( 240 - last );
|
padn = ( last < 112 ) ? ( 112 - last ) : ( 240 - last );
|
||||||
|
|
||||||
sha512_update( ctx, (unsigned char *) sha512_padding, padn );
|
sha512_update( ctx, (uint8_t *) sha512_padding, padn );
|
||||||
sha512_update( ctx, msglen, 16 );
|
sha512_update( ctx, msglen, 16 );
|
||||||
|
|
||||||
PUT_UINT64_BE( ctx->state[0], output, 0 );
|
PUT_UINT64_BE( ctx->state[0], output, 0 );
|
||||||
|
@ -300,8 +298,7 @@ void sha512_final( sha512_ctx *ctx, unsigned char output[64] )
|
||||||
/*
|
/*
|
||||||
* output = SHA-512( input buffer )
|
* output = SHA-512( input buffer )
|
||||||
*/
|
*/
|
||||||
void sha512_complete( const void *input, int ilen,
|
void sha512_complete( const void *input, int ilen, uint8_t *output )
|
||||||
unsigned char output[64] )
|
|
||||||
{
|
{
|
||||||
sha512_ctx ctx;
|
sha512_ctx ctx;
|
||||||
|
|
||||||
|
|
|
@ -86,7 +86,7 @@ hmac_sha1_update(hmac_sha1_ctx *ctx, const void *buf, size_t len)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
hmac_sha1_final(hmac_sha1_ctx *ctx, void *mac)
|
hmac_sha1_final(hmac_sha1_ctx *ctx, uint8_t *mac)
|
||||||
{
|
{
|
||||||
uint8_t digest[SHA1_DIGEST_LEN];
|
uint8_t digest[SHA1_DIGEST_LEN];
|
||||||
|
|
||||||
|
@ -98,7 +98,7 @@ hmac_sha1_final(hmac_sha1_ctx *ctx, void *mac)
|
||||||
|
|
||||||
void
|
void
|
||||||
hmac_sha1_complete(const void *key, size_t keylen,
|
hmac_sha1_complete(const void *key, size_t keylen,
|
||||||
const void *buf, size_t len, void *mac)
|
const void *buf, size_t len, uint8_t *mac)
|
||||||
{
|
{
|
||||||
hmac_sha1_ctx ctx;
|
hmac_sha1_ctx ctx;
|
||||||
|
|
||||||
|
|
|
@ -86,7 +86,7 @@ hmac_sha224_update(hmac_sha224_ctx *ctx, const void *buf, size_t len)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
hmac_sha224_final(hmac_sha224_ctx *ctx, void *mac)
|
hmac_sha224_final(hmac_sha224_ctx *ctx, uint8_t *mac)
|
||||||
{
|
{
|
||||||
uint8_t digest[SHA224_DIGEST_LEN];
|
uint8_t digest[SHA224_DIGEST_LEN];
|
||||||
|
|
||||||
|
@ -98,7 +98,7 @@ hmac_sha224_final(hmac_sha224_ctx *ctx, void *mac)
|
||||||
|
|
||||||
void
|
void
|
||||||
hmac_sha224_complete(const void *key, size_t keylen,
|
hmac_sha224_complete(const void *key, size_t keylen,
|
||||||
const void *buf, size_t len, void *mac)
|
const void *buf, size_t len, uint8_t *mac)
|
||||||
{
|
{
|
||||||
hmac_sha224_ctx ctx;
|
hmac_sha224_ctx ctx;
|
||||||
|
|
||||||
|
|
|
@ -86,7 +86,7 @@ hmac_sha256_update(hmac_sha256_ctx *ctx, const void *buf, size_t len)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
hmac_sha256_final(hmac_sha256_ctx *ctx, void *mac)
|
hmac_sha256_final(hmac_sha256_ctx *ctx, uint8_t *mac)
|
||||||
{
|
{
|
||||||
uint8_t digest[SHA256_DIGEST_LEN];
|
uint8_t digest[SHA256_DIGEST_LEN];
|
||||||
|
|
||||||
|
@ -98,7 +98,7 @@ hmac_sha256_final(hmac_sha256_ctx *ctx, void *mac)
|
||||||
|
|
||||||
void
|
void
|
||||||
hmac_sha256_complete(const void *key, size_t keylen,
|
hmac_sha256_complete(const void *key, size_t keylen,
|
||||||
const void *buf, size_t len, void *mac)
|
const void *buf, size_t len, uint8_t *mac)
|
||||||
{
|
{
|
||||||
hmac_sha256_ctx ctx;
|
hmac_sha256_ctx ctx;
|
||||||
|
|
||||||
|
|
|
@ -86,7 +86,7 @@ hmac_sha384_update(hmac_sha384_ctx *ctx, const void *buf, size_t len)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
hmac_sha384_final(hmac_sha384_ctx *ctx, void *mac)
|
hmac_sha384_final(hmac_sha384_ctx *ctx, uint8_t *mac)
|
||||||
{
|
{
|
||||||
uint8_t digest[SHA384_DIGEST_LEN];
|
uint8_t digest[SHA384_DIGEST_LEN];
|
||||||
|
|
||||||
|
@ -98,7 +98,7 @@ hmac_sha384_final(hmac_sha384_ctx *ctx, void *mac)
|
||||||
|
|
||||||
void
|
void
|
||||||
hmac_sha384_complete(const void *key, size_t keylen,
|
hmac_sha384_complete(const void *key, size_t keylen,
|
||||||
const void *buf, size_t len, void *mac)
|
const void *buf, size_t len, uint8_t *mac)
|
||||||
{
|
{
|
||||||
hmac_sha384_ctx ctx;
|
hmac_sha384_ctx ctx;
|
||||||
|
|
||||||
|
|
|
@ -86,7 +86,7 @@ hmac_sha512_update(hmac_sha512_ctx *ctx, const void *buf, size_t len)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
hmac_sha512_final(hmac_sha512_ctx *ctx, void *mac)
|
hmac_sha512_final(hmac_sha512_ctx *ctx, uint8_t *mac)
|
||||||
{
|
{
|
||||||
uint8_t digest[SHA512_DIGEST_LEN];
|
uint8_t digest[SHA512_DIGEST_LEN];
|
||||||
|
|
||||||
|
@ -98,7 +98,7 @@ hmac_sha512_final(hmac_sha512_ctx *ctx, void *mac)
|
||||||
|
|
||||||
void
|
void
|
||||||
hmac_sha512_complete(const void *key, size_t keylen,
|
hmac_sha512_complete(const void *key, size_t keylen,
|
||||||
const void *buf, size_t len, void *mac)
|
const void *buf, size_t len, uint8_t *mac)
|
||||||
{
|
{
|
||||||
hmac_sha512_ctx ctx;
|
hmac_sha512_ctx ctx;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue