mirror of
https://github.com/cryb-to/cryb-to.git
synced 2024-12-22 12:31:07 +00:00
Remove HMAC-MD2 and HMAC-MD4. They may or may not reappear at a later
date in libcryb-mac.
This commit is contained in:
parent
729e501b79
commit
30c8e19de7
4 changed files with 0 additions and 222 deletions
|
@ -54,9 +54,6 @@ typedef struct
|
||||||
unsigned char cksum[16]; /*!< checksum of the data block */
|
unsigned char cksum[16]; /*!< checksum of the data block */
|
||||||
unsigned char state[48]; /*!< intermediate digest state */
|
unsigned char state[48]; /*!< intermediate digest state */
|
||||||
unsigned char buffer[16]; /*!< data block being processed */
|
unsigned char buffer[16]; /*!< data block being processed */
|
||||||
|
|
||||||
unsigned char ipad[64]; /*!< HMAC: inner padding */
|
|
||||||
unsigned char opad[64]; /*!< HMAC: outer padding */
|
|
||||||
int left; /*!< amount of data in buffer */
|
int left; /*!< amount of data in buffer */
|
||||||
} md2_ctx;
|
} md2_ctx;
|
||||||
|
|
||||||
|
@ -97,45 +94,6 @@ void md2_final( md2_ctx *ctx, unsigned char output[16] );
|
||||||
*/
|
*/
|
||||||
void md2_complete( const void *input, int ilen, unsigned char output[16] );
|
void md2_complete( const void *input, int ilen, unsigned char output[16] );
|
||||||
|
|
||||||
/**
|
|
||||||
* \brief MD2 HMAC context setup
|
|
||||||
*
|
|
||||||
* \param ctx HMAC context to be initialized
|
|
||||||
* \param key HMAC secret key
|
|
||||||
* \param keylen length of the HMAC key
|
|
||||||
*/
|
|
||||||
void md2_hmac_init( md2_ctx *ctx, unsigned char *key, int keylen );
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \brief MD2 HMAC process buffer
|
|
||||||
*
|
|
||||||
* \param ctx HMAC context
|
|
||||||
* \param input buffer holding the data
|
|
||||||
* \param ilen length of the input data
|
|
||||||
*/
|
|
||||||
void md2_hmac_update( md2_ctx *ctx, unsigned char *input, int ilen );
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \brief MD2 HMAC final digest
|
|
||||||
*
|
|
||||||
* \param ctx HMAC context
|
|
||||||
* \param output MD2 HMAC checksum result
|
|
||||||
*/
|
|
||||||
void md2_hmac_final( md2_ctx *ctx, unsigned char output[16] );
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \brief Output = HMAC-MD2( hmac key, input buffer )
|
|
||||||
*
|
|
||||||
* \param key HMAC secret key
|
|
||||||
* \param keylen length of the HMAC key
|
|
||||||
* \param input buffer holding the data
|
|
||||||
* \param ilen length of the input data
|
|
||||||
* \param output HMAC-MD2 result
|
|
||||||
*/
|
|
||||||
void md2_hmac_complete( unsigned char *key, int keylen,
|
|
||||||
unsigned char *input, int ilen,
|
|
||||||
unsigned char output[16] );
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -54,9 +54,6 @@ typedef struct
|
||||||
unsigned long total[2]; /*!< number of bytes processed */
|
unsigned long total[2]; /*!< number of bytes processed */
|
||||||
unsigned long state[4]; /*!< intermediate digest state */
|
unsigned long state[4]; /*!< intermediate digest state */
|
||||||
unsigned char buffer[64]; /*!< data block being processed */
|
unsigned char buffer[64]; /*!< data block being processed */
|
||||||
|
|
||||||
unsigned char ipad[64]; /*!< HMAC: inner padding */
|
|
||||||
unsigned char opad[64]; /*!< HMAC: outer padding */
|
|
||||||
}
|
}
|
||||||
md4_ctx;
|
md4_ctx;
|
||||||
|
|
||||||
|
@ -97,45 +94,6 @@ void md4_final( md4_ctx *ctx, unsigned char output[16] );
|
||||||
*/
|
*/
|
||||||
void md4_complete( const void *input, int ilen, unsigned char output[16] );
|
void md4_complete( const void *input, int ilen, unsigned char output[16] );
|
||||||
|
|
||||||
/**
|
|
||||||
* \brief MD4 HMAC context setup
|
|
||||||
*
|
|
||||||
* \param ctx HMAC context to be initialized
|
|
||||||
* \param key HMAC secret key
|
|
||||||
* \param keylen length of the HMAC key
|
|
||||||
*/
|
|
||||||
void md4_hmac_init( md4_ctx *ctx, unsigned char *key, int keylen );
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \brief MD4 HMAC process buffer
|
|
||||||
*
|
|
||||||
* \param ctx HMAC context
|
|
||||||
* \param input buffer holding the data
|
|
||||||
* \param ilen length of the input data
|
|
||||||
*/
|
|
||||||
void md4_hmac_update( md4_ctx *ctx, unsigned char *input, int ilen );
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \brief MD4 HMAC final digest
|
|
||||||
*
|
|
||||||
* \param ctx HMAC context
|
|
||||||
* \param output MD4 HMAC checksum result
|
|
||||||
*/
|
|
||||||
void md4_hmac_final( md4_ctx *ctx, unsigned char output[16] );
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \brief Output = HMAC-MD4( hmac key, input buffer )
|
|
||||||
*
|
|
||||||
* \param key HMAC secret key
|
|
||||||
* \param keylen length of the HMAC key
|
|
||||||
* \param input buffer holding the data
|
|
||||||
* \param ilen length of the input data
|
|
||||||
* \param output HMAC-MD4 result
|
|
||||||
*/
|
|
||||||
void md4_hmac_complete( unsigned char *key, int keylen,
|
|
||||||
unsigned char *input, int ilen,
|
|
||||||
unsigned char output[16] );
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -176,75 +176,6 @@ void md2_complete( const void *input, int ilen, unsigned char *output )
|
||||||
memset( &ctx, 0, sizeof( md2_ctx ) );
|
memset( &ctx, 0, sizeof( md2_ctx ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* MD2 HMAC context setup
|
|
||||||
*/
|
|
||||||
void md2_hmac_init( md2_ctx *ctx, unsigned char *key, int keylen )
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
unsigned char sum[MD2_DIGEST_LEN];
|
|
||||||
|
|
||||||
if( keylen > 64 )
|
|
||||||
{
|
|
||||||
md2_complete( key, keylen, sum );
|
|
||||||
keylen = sizeof sum;
|
|
||||||
key = sum;
|
|
||||||
}
|
|
||||||
|
|
||||||
memset( ctx->ipad, 0x36, sizeof ctx->ipad );
|
|
||||||
memset( ctx->opad, 0x5C, sizeof ctx->opad );
|
|
||||||
|
|
||||||
for( i = 0; i < keylen; i++ )
|
|
||||||
{
|
|
||||||
ctx->ipad[i] = (unsigned char)( ctx->ipad[i] ^ key[i] );
|
|
||||||
ctx->opad[i] = (unsigned char)( ctx->opad[i] ^ key[i] );
|
|
||||||
}
|
|
||||||
|
|
||||||
md2_init( ctx );
|
|
||||||
md2_update( ctx, ctx->ipad, sizeof ctx->ipad );
|
|
||||||
|
|
||||||
memset( sum, 0, sizeof( sum ) );
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* MD2 HMAC process buffer
|
|
||||||
*/
|
|
||||||
void md2_hmac_update( md2_ctx *ctx, unsigned char *input, int ilen )
|
|
||||||
{
|
|
||||||
md2_update( ctx, input, ilen );
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* MD2 HMAC final digest
|
|
||||||
*/
|
|
||||||
void md2_hmac_final( md2_ctx *ctx, unsigned char *output )
|
|
||||||
{
|
|
||||||
unsigned char tmpbuf[MD2_DIGEST_LEN];
|
|
||||||
|
|
||||||
md2_final( ctx, tmpbuf );
|
|
||||||
md2_init( ctx );
|
|
||||||
md2_update( ctx, ctx->opad, sizeof ctx->opad );
|
|
||||||
md2_update( ctx, tmpbuf, sizeof tmpbuf );
|
|
||||||
md2_final( ctx, output );
|
|
||||||
|
|
||||||
memset( tmpbuf, 0, sizeof( tmpbuf ) );
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* output = HMAC-MD2( hmac key, input buffer )
|
|
||||||
*/
|
|
||||||
void md2_hmac_complete( unsigned char *key, int keylen, unsigned char *input, int ilen,
|
|
||||||
unsigned char *output )
|
|
||||||
{
|
|
||||||
md2_ctx ctx;
|
|
||||||
|
|
||||||
md2_hmac_init( &ctx, key, keylen );
|
|
||||||
md2_hmac_update( &ctx, input, ilen );
|
|
||||||
md2_hmac_final( &ctx, output );
|
|
||||||
|
|
||||||
memset( &ctx, 0, sizeof( md2_ctx ) );
|
|
||||||
}
|
|
||||||
|
|
||||||
digest_algorithm md2_algorithm = {
|
digest_algorithm md2_algorithm = {
|
||||||
.name = "md2",
|
.name = "md2",
|
||||||
.contextlen = sizeof(md2_ctx),
|
.contextlen = sizeof(md2_ctx),
|
||||||
|
|
|
@ -275,75 +275,6 @@ void md4_complete( const void *input, int ilen, unsigned char *output )
|
||||||
memset( &ctx, 0, sizeof( md4_ctx ) );
|
memset( &ctx, 0, sizeof( md4_ctx ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* MD4 HMAC context setup
|
|
||||||
*/
|
|
||||||
void md4_hmac_init( md4_ctx *ctx, unsigned char *key, int keylen )
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
unsigned char sum[16];
|
|
||||||
|
|
||||||
if( keylen > 64 )
|
|
||||||
{
|
|
||||||
md4_complete( key, keylen, sum );
|
|
||||||
keylen = 16;
|
|
||||||
key = sum;
|
|
||||||
}
|
|
||||||
|
|
||||||
memset( ctx->ipad, 0x36, 64 );
|
|
||||||
memset( ctx->opad, 0x5C, 64 );
|
|
||||||
|
|
||||||
for( i = 0; i < keylen; i++ )
|
|
||||||
{
|
|
||||||
ctx->ipad[i] = (unsigned char)( ctx->ipad[i] ^ key[i] );
|
|
||||||
ctx->opad[i] = (unsigned char)( ctx->opad[i] ^ key[i] );
|
|
||||||
}
|
|
||||||
|
|
||||||
md4_init( ctx );
|
|
||||||
md4_update( ctx, ctx->ipad, 64 );
|
|
||||||
|
|
||||||
memset( sum, 0, sizeof( sum ) );
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* MD4 HMAC process buffer
|
|
||||||
*/
|
|
||||||
void md4_hmac_update( md4_ctx *ctx, unsigned char *input, int ilen )
|
|
||||||
{
|
|
||||||
md4_update( ctx, input, ilen );
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* MD4 HMAC final digest
|
|
||||||
*/
|
|
||||||
void md4_hmac_final( md4_ctx *ctx, unsigned char *output )
|
|
||||||
{
|
|
||||||
unsigned char tmpbuf[MD4_DIGEST_LEN];
|
|
||||||
|
|
||||||
md4_final( ctx, tmpbuf );
|
|
||||||
md4_init( ctx );
|
|
||||||
md4_update( ctx, ctx->opad, 64 );
|
|
||||||
md4_update( ctx, tmpbuf, 16 );
|
|
||||||
md4_final( ctx, output );
|
|
||||||
|
|
||||||
memset( tmpbuf, 0, sizeof( tmpbuf ) );
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* output = HMAC-MD4( hmac key, input buffer )
|
|
||||||
*/
|
|
||||||
void md4_hmac_complete( unsigned char *key, int keylen, unsigned char *input, int ilen,
|
|
||||||
unsigned char output[16] )
|
|
||||||
{
|
|
||||||
md4_ctx ctx;
|
|
||||||
|
|
||||||
md4_hmac_init( &ctx, key, keylen );
|
|
||||||
md4_hmac_update( &ctx, input, ilen );
|
|
||||||
md4_hmac_final( &ctx, output );
|
|
||||||
|
|
||||||
memset( &ctx, 0, sizeof( md4_ctx ) );
|
|
||||||
}
|
|
||||||
|
|
||||||
digest_algorithm md4_algorithm = {
|
digest_algorithm md4_algorithm = {
|
||||||
.name = "md4",
|
.name = "md4",
|
||||||
.contextlen = sizeof(md4_ctx),
|
.contextlen = sizeof(md4_ctx),
|
||||||
|
|
Loading…
Reference in a new issue