mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2024-11-29 12:24:16 +01:00
- Added reset functionality for HMAC context. Speed-up for some use-cases.
This commit is contained in:
parent
27caa8a17e
commit
7d3b661bfe
@ -16,6 +16,8 @@ Changes
|
|||||||
* Changed symmetric cipher functions to
|
* Changed symmetric cipher functions to
|
||||||
identical interface (returning int result values)
|
identical interface (returning int result values)
|
||||||
* Changed ARC4 to use seperate input/output buffer
|
* Changed ARC4 to use seperate input/output buffer
|
||||||
|
* Added reset function for HMAC context as speed-up
|
||||||
|
for specific use-cases
|
||||||
|
|
||||||
Bug fixes
|
Bug fixes
|
||||||
* Fixed bug resulting in failure to send the last
|
* Fixed bug resulting in failure to send the last
|
||||||
|
@ -112,6 +112,13 @@ void md2_hmac_update( md2_context *ctx, const unsigned char *input, int ilen );
|
|||||||
*/
|
*/
|
||||||
void md2_hmac_finish( md2_context *ctx, unsigned char output[16] );
|
void md2_hmac_finish( md2_context *ctx, unsigned char output[16] );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief MD2 HMAC context reset
|
||||||
|
*
|
||||||
|
* \param ctx HMAC context to be reset
|
||||||
|
*/
|
||||||
|
void md2_hmac_reset( md2_context *ctx );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Output = HMAC-MD2( hmac key, input buffer )
|
* \brief Output = HMAC-MD2( hmac key, input buffer )
|
||||||
*
|
*
|
||||||
|
@ -111,6 +111,13 @@ void md4_hmac_update( md4_context *ctx, const unsigned char *input, int ilen );
|
|||||||
*/
|
*/
|
||||||
void md4_hmac_finish( md4_context *ctx, unsigned char output[16] );
|
void md4_hmac_finish( md4_context *ctx, unsigned char output[16] );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief MD4 HMAC context reset
|
||||||
|
*
|
||||||
|
* \param ctx HMAC context to be reset
|
||||||
|
*/
|
||||||
|
void md4_hmac_reset( md4_context *ctx );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Output = HMAC-MD4( hmac key, input buffer )
|
* \brief Output = HMAC-MD4( hmac key, input buffer )
|
||||||
*
|
*
|
||||||
|
@ -113,6 +113,13 @@ void md5_hmac_update( md5_context *ctx,
|
|||||||
*/
|
*/
|
||||||
void md5_hmac_finish( md5_context *ctx, unsigned char output[16] );
|
void md5_hmac_finish( md5_context *ctx, unsigned char output[16] );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief MD5 HMAC context reset
|
||||||
|
*
|
||||||
|
* \param ctx HMAC context to be reset
|
||||||
|
*/
|
||||||
|
void md5_hmac_reset( md5_context *ctx );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Output = HMAC-MD5( hmac key, input buffer )
|
* \brief Output = HMAC-MD5( hmac key, input buffer )
|
||||||
*
|
*
|
||||||
|
@ -111,6 +111,13 @@ void sha1_hmac_update( sha1_context *ctx, const unsigned char *input, int ilen )
|
|||||||
*/
|
*/
|
||||||
void sha1_hmac_finish( sha1_context *ctx, unsigned char output[20] );
|
void sha1_hmac_finish( sha1_context *ctx, unsigned char output[20] );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief SHA-1 HMAC context reset
|
||||||
|
*
|
||||||
|
* \param ctx HMAC context to be reset
|
||||||
|
*/
|
||||||
|
void sha1_hmac_reset( sha1_context *ctx );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Output = HMAC-SHA-1( hmac key, input buffer )
|
* \brief Output = HMAC-SHA-1( hmac key, input buffer )
|
||||||
*
|
*
|
||||||
|
@ -118,6 +118,13 @@ void sha2_hmac_update( sha2_context *ctx, const unsigned char *input, int ilen )
|
|||||||
*/
|
*/
|
||||||
void sha2_hmac_finish( sha2_context *ctx, unsigned char output[32] );
|
void sha2_hmac_finish( sha2_context *ctx, unsigned char output[32] );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief SHA-256 HMAC context reset
|
||||||
|
*
|
||||||
|
* \param ctx HMAC context to be reset
|
||||||
|
*/
|
||||||
|
void sha2_hmac_reset( sha2_context *ctx );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Output = HMAC-SHA-256( hmac key, input buffer )
|
* \brief Output = HMAC-SHA-256( hmac key, input buffer )
|
||||||
*
|
*
|
||||||
|
@ -126,6 +126,13 @@ void sha4_hmac_update( sha4_context *ctx, const unsigned char *input, int ilen )
|
|||||||
*/
|
*/
|
||||||
void sha4_hmac_finish( sha4_context *ctx, unsigned char output[64] );
|
void sha4_hmac_finish( sha4_context *ctx, unsigned char output[64] );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief SHA-512 HMAC context reset
|
||||||
|
*
|
||||||
|
* \param ctx HMAC context to be reset
|
||||||
|
*/
|
||||||
|
void sha4_hmac_reset( sha4_context *ctx );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Output = HMAC-SHA-512( hmac key, input buffer )
|
* \brief Output = HMAC-SHA-512( hmac key, input buffer )
|
||||||
*
|
*
|
||||||
|
@ -260,6 +260,15 @@ void md2_hmac_finish( md2_context *ctx, unsigned char output[16] )
|
|||||||
memset( tmpbuf, 0, sizeof( tmpbuf ) );
|
memset( tmpbuf, 0, sizeof( tmpbuf ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* MD2 HMAC context reset
|
||||||
|
*/
|
||||||
|
void md2_hmac_reset( md2_context *ctx )
|
||||||
|
{
|
||||||
|
md2_starts( ctx );
|
||||||
|
md2_update( ctx, ctx->ipad, 64 );
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* output = HMAC-MD2( hmac key, input buffer )
|
* output = HMAC-MD2( hmac key, input buffer )
|
||||||
*/
|
*/
|
||||||
|
@ -356,6 +356,15 @@ void md4_hmac_finish( md4_context *ctx, unsigned char output[16] )
|
|||||||
memset( tmpbuf, 0, sizeof( tmpbuf ) );
|
memset( tmpbuf, 0, sizeof( tmpbuf ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* MD4 HMAC context reset
|
||||||
|
*/
|
||||||
|
void md4_hmac_reset( md4_context *ctx )
|
||||||
|
{
|
||||||
|
md4_starts( ctx );
|
||||||
|
md4_update( ctx, ctx->ipad, 64 );
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* output = HMAC-MD4( hmac key, input buffer )
|
* output = HMAC-MD4( hmac key, input buffer )
|
||||||
*/
|
*/
|
||||||
|
@ -375,6 +375,15 @@ void md5_hmac_finish( md5_context *ctx, unsigned char output[16] )
|
|||||||
memset( tmpbuf, 0, sizeof( tmpbuf ) );
|
memset( tmpbuf, 0, sizeof( tmpbuf ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* MD5 HMAC context reset
|
||||||
|
*/
|
||||||
|
void md5_hmac_reset( md5_context *ctx )
|
||||||
|
{
|
||||||
|
md5_starts( ctx );
|
||||||
|
md5_update( ctx, ctx->ipad, 64 );
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* output = HMAC-MD5( hmac key, input buffer )
|
* output = HMAC-MD5( hmac key, input buffer )
|
||||||
*/
|
*/
|
||||||
|
@ -410,6 +410,15 @@ void sha1_hmac_finish( sha1_context *ctx, unsigned char output[20] )
|
|||||||
memset( tmpbuf, 0, sizeof( tmpbuf ) );
|
memset( tmpbuf, 0, sizeof( tmpbuf ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* SHA1 HMAC context reset
|
||||||
|
*/
|
||||||
|
void sha1_hmac_reset( sha1_context *ctx )
|
||||||
|
{
|
||||||
|
sha1_starts( ctx );
|
||||||
|
sha1_update( ctx, ctx->ipad, 64 );
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* output = HMAC-SHA-1( hmac key, input buffer )
|
* output = HMAC-SHA-1( hmac key, input buffer )
|
||||||
*/
|
*/
|
||||||
|
@ -417,6 +417,15 @@ void sha2_hmac_finish( sha2_context *ctx, unsigned char output[32] )
|
|||||||
memset( tmpbuf, 0, sizeof( tmpbuf ) );
|
memset( tmpbuf, 0, sizeof( tmpbuf ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* SHA-256 HMAC context reset
|
||||||
|
*/
|
||||||
|
void sha2_hmac_reset( sha2_context *ctx )
|
||||||
|
{
|
||||||
|
sha2_starts( ctx, ctx->is224 );
|
||||||
|
sha2_update( ctx, ctx->ipad, 64 );
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* output = HMAC-SHA-256( hmac key, input buffer )
|
* output = HMAC-SHA-256( hmac key, input buffer )
|
||||||
*/
|
*/
|
||||||
|
@ -416,6 +416,15 @@ void sha4_hmac_finish( sha4_context *ctx, unsigned char output[64] )
|
|||||||
memset( tmpbuf, 0, sizeof( tmpbuf ) );
|
memset( tmpbuf, 0, sizeof( tmpbuf ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* SHA-512 HMAC context reset
|
||||||
|
*/
|
||||||
|
void sha4_hmac_reset( sha4_context *ctx )
|
||||||
|
{
|
||||||
|
sha4_starts( ctx, ctx->is384 );
|
||||||
|
sha4_update( ctx, ctx->ipad, 128 );
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* output = HMAC-SHA-512( hmac key, input buffer )
|
* output = HMAC-SHA-512( hmac key, input buffer )
|
||||||
*/
|
*/
|
||||||
|
Loading…
Reference in New Issue
Block a user