diff --git a/include/mbedtls/md_wrap.h b/include/mbedtls/md_wrap.h index e0c6354d0..418b3f1bf 100644 --- a/include/mbedtls/md_wrap.h +++ b/include/mbedtls/md_wrap.h @@ -73,25 +73,6 @@ struct _md_info_t { /** Generic file digest function */ int (*file_func)( const char *path, unsigned char *output ); - /** HMAC Initialisation function */ - void (*hmac_starts_func)( void *ctx, const unsigned char *key, - size_t keylen ); - - /** HMAC update function */ - void (*hmac_update_func)( void *ctx, const unsigned char *input, - size_t ilen ); - - /** HMAC finalisation function */ - void (*hmac_finish_func)( void *ctx, unsigned char *output); - - /** HMAC context reset function */ - void (*hmac_reset_func)( void *ctx ); - - /** Generic HMAC function */ - void (*hmac_func)( const unsigned char *key, size_t keylen, - const unsigned char *input, size_t ilen, - unsigned char *output ); - /** Allocate a new context */ void * (*ctx_alloc_func)( void ); diff --git a/library/md_wrap.c b/library/md_wrap.c index 603a4ac37..17c6ab435 100644 --- a/library/md_wrap.c +++ b/library/md_wrap.c @@ -104,28 +104,6 @@ static int md2_file_wrap( const char *path, unsigned char *output ) #endif } -static void md2_hmac_starts_wrap( void *ctx, const unsigned char *key, - size_t keylen ) -{ - md2_hmac_starts( (md2_context *) ctx, key, keylen ); -} - -static void md2_hmac_update_wrap( void *ctx, const unsigned char *input, - size_t ilen ) -{ - md2_hmac_update( (md2_context *) ctx, input, ilen ); -} - -static void md2_hmac_finish_wrap( void *ctx, unsigned char *output ) -{ - md2_hmac_finish( (md2_context *) ctx, output ); -} - -static void md2_hmac_reset_wrap( void *ctx ) -{ - md2_hmac_reset( (md2_context *) ctx ); -} - static void * md2_ctx_alloc( void ) { return polarssl_malloc( sizeof( md2_context ) ); @@ -154,11 +132,6 @@ const md_info_t md2_info = { md2_finish_wrap, md2, md2_file_wrap, - md2_hmac_starts_wrap, - md2_hmac_update_wrap, - md2_hmac_finish_wrap, - md2_hmac_reset_wrap, - md2_hmac, md2_ctx_alloc, md2_ctx_free, md2_process_wrap, @@ -195,28 +168,6 @@ static int md4_file_wrap( const char *path, unsigned char *output ) #endif } -static void md4_hmac_starts_wrap( void *ctx, const unsigned char *key, - size_t keylen ) -{ - md4_hmac_starts( (md4_context *) ctx, key, keylen ); -} - -static void md4_hmac_update_wrap( void *ctx, const unsigned char *input, - size_t ilen ) -{ - md4_hmac_update( (md4_context *) ctx, input, ilen ); -} - -static void md4_hmac_finish_wrap( void *ctx, unsigned char *output ) -{ - md4_hmac_finish( (md4_context *) ctx, output ); -} - -static void md4_hmac_reset_wrap( void *ctx ) -{ - md4_hmac_reset( (md4_context *) ctx ); -} - static void *md4_ctx_alloc( void ) { return polarssl_malloc( sizeof( md4_context ) ); @@ -243,11 +194,6 @@ const md_info_t md4_info = { md4_finish_wrap, md4, md4_file_wrap, - md4_hmac_starts_wrap, - md4_hmac_update_wrap, - md4_hmac_finish_wrap, - md4_hmac_reset_wrap, - md4_hmac, md4_ctx_alloc, md4_ctx_free, md4_process_wrap, @@ -284,28 +230,6 @@ static int md5_file_wrap( const char *path, unsigned char *output ) #endif } -static void md5_hmac_starts_wrap( void *ctx, const unsigned char *key, - size_t keylen ) -{ - md5_hmac_starts( (md5_context *) ctx, key, keylen ); -} - -static void md5_hmac_update_wrap( void *ctx, const unsigned char *input, - size_t ilen ) -{ - md5_hmac_update( (md5_context *) ctx, input, ilen ); -} - -static void md5_hmac_finish_wrap( void *ctx, unsigned char *output ) -{ - md5_hmac_finish( (md5_context *) ctx, output ); -} - -static void md5_hmac_reset_wrap( void *ctx ) -{ - md5_hmac_reset( (md5_context *) ctx ); -} - static void * md5_ctx_alloc( void ) { return polarssl_malloc( sizeof( md5_context ) ); @@ -332,11 +256,6 @@ const md_info_t md5_info = { md5_finish_wrap, md5, md5_file_wrap, - md5_hmac_starts_wrap, - md5_hmac_update_wrap, - md5_hmac_finish_wrap, - md5_hmac_reset_wrap, - md5_hmac, md5_ctx_alloc, md5_ctx_free, md5_process_wrap, @@ -373,28 +292,6 @@ static int ripemd160_file_wrap( const char *path, unsigned char *output ) #endif } -static void ripemd160_hmac_starts_wrap( void *ctx, const unsigned char *key, - size_t keylen ) -{ - ripemd160_hmac_starts( (ripemd160_context *) ctx, key, keylen ); -} - -static void ripemd160_hmac_update_wrap( void *ctx, const unsigned char *input, - size_t ilen ) -{ - ripemd160_hmac_update( (ripemd160_context *) ctx, input, ilen ); -} - -static void ripemd160_hmac_finish_wrap( void *ctx, unsigned char *output ) -{ - ripemd160_hmac_finish( (ripemd160_context *) ctx, output ); -} - -static void ripemd160_hmac_reset_wrap( void *ctx ) -{ - ripemd160_hmac_reset( (ripemd160_context *) ctx ); -} - static void * ripemd160_ctx_alloc( void ) { ripemd160_context *ctx; @@ -429,11 +326,6 @@ const md_info_t ripemd160_info = { ripemd160_finish_wrap, ripemd160, ripemd160_file_wrap, - ripemd160_hmac_starts_wrap, - ripemd160_hmac_update_wrap, - ripemd160_hmac_finish_wrap, - ripemd160_hmac_reset_wrap, - ripemd160_hmac, ripemd160_ctx_alloc, ripemd160_ctx_free, ripemd160_process_wrap, @@ -470,28 +362,6 @@ static int sha1_file_wrap( const char *path, unsigned char *output ) #endif } -static void sha1_hmac_starts_wrap( void *ctx, const unsigned char *key, - size_t keylen ) -{ - sha1_hmac_starts( (sha1_context *) ctx, key, keylen ); -} - -static void sha1_hmac_update_wrap( void *ctx, const unsigned char *input, - size_t ilen ) -{ - sha1_hmac_update( (sha1_context *) ctx, input, ilen ); -} - -static void sha1_hmac_finish_wrap( void *ctx, unsigned char *output ) -{ - sha1_hmac_finish( (sha1_context *) ctx, output ); -} - -static void sha1_hmac_reset_wrap( void *ctx ) -{ - sha1_hmac_reset( (sha1_context *) ctx ); -} - static void * sha1_ctx_alloc( void ) { sha1_context *ctx; @@ -526,11 +396,6 @@ const md_info_t sha1_info = { sha1_finish_wrap, sha1, sha1_file_wrap, - sha1_hmac_starts_wrap, - sha1_hmac_update_wrap, - sha1_hmac_finish_wrap, - sha1_hmac_reset_wrap, - sha1_hmac, sha1_ctx_alloc, sha1_ctx_free, sha1_process_wrap, @@ -576,35 +441,6 @@ static int sha224_file_wrap( const char *path, unsigned char *output ) #endif } -static void sha224_hmac_starts_wrap( void *ctx, const unsigned char *key, - size_t keylen ) -{ - sha256_hmac_starts( (sha256_context *) ctx, key, keylen, 1 ); -} - -static void sha224_hmac_update_wrap( void *ctx, const unsigned char *input, - size_t ilen ) -{ - sha256_hmac_update( (sha256_context *) ctx, input, ilen ); -} - -static void sha224_hmac_finish_wrap( void *ctx, unsigned char *output ) -{ - sha256_hmac_finish( (sha256_context *) ctx, output ); -} - -static void sha224_hmac_reset_wrap( void *ctx ) -{ - sha256_hmac_reset( (sha256_context *) ctx ); -} - -static void sha224_hmac_wrap( const unsigned char *key, size_t keylen, - const unsigned char *input, size_t ilen, - unsigned char *output ) -{ - sha256_hmac( key, keylen, input, ilen, output, 1 ); -} - static void * sha224_ctx_alloc( void ) { return polarssl_malloc( sizeof( sha256_context ) ); @@ -631,11 +467,6 @@ const md_info_t sha224_info = { sha224_finish_wrap, sha224_wrap, sha224_file_wrap, - sha224_hmac_starts_wrap, - sha224_hmac_update_wrap, - sha224_hmac_finish_wrap, - sha224_hmac_reset_wrap, - sha224_hmac_wrap, sha224_ctx_alloc, sha224_ctx_free, sha224_process_wrap, @@ -674,35 +505,6 @@ static int sha256_file_wrap( const char *path, unsigned char *output ) #endif } -static void sha256_hmac_starts_wrap( void *ctx, const unsigned char *key, - size_t keylen ) -{ - sha256_hmac_starts( (sha256_context *) ctx, key, keylen, 0 ); -} - -static void sha256_hmac_update_wrap( void *ctx, const unsigned char *input, - size_t ilen ) -{ - sha256_hmac_update( (sha256_context *) ctx, input, ilen ); -} - -static void sha256_hmac_finish_wrap( void *ctx, unsigned char *output ) -{ - sha256_hmac_finish( (sha256_context *) ctx, output ); -} - -static void sha256_hmac_reset_wrap( void *ctx ) -{ - sha256_hmac_reset( (sha256_context *) ctx ); -} - -static void sha256_hmac_wrap( const unsigned char *key, size_t keylen, - const unsigned char *input, size_t ilen, - unsigned char *output ) -{ - sha256_hmac( key, keylen, input, ilen, output, 0 ); -} - static void * sha256_ctx_alloc( void ) { sha256_context *ctx; @@ -737,11 +539,6 @@ const md_info_t sha256_info = { sha256_finish_wrap, sha256_wrap, sha256_file_wrap, - sha256_hmac_starts_wrap, - sha256_hmac_update_wrap, - sha256_hmac_finish_wrap, - sha256_hmac_reset_wrap, - sha256_hmac_wrap, sha256_ctx_alloc, sha256_ctx_free, sha256_process_wrap, @@ -784,35 +581,6 @@ static int sha384_file_wrap( const char *path, unsigned char *output ) #endif } -static void sha384_hmac_starts_wrap( void *ctx, const unsigned char *key, - size_t keylen ) -{ - sha512_hmac_starts( (sha512_context *) ctx, key, keylen, 1 ); -} - -static void sha384_hmac_update_wrap( void *ctx, const unsigned char *input, - size_t ilen ) -{ - sha512_hmac_update( (sha512_context *) ctx, input, ilen ); -} - -static void sha384_hmac_finish_wrap( void *ctx, unsigned char *output ) -{ - sha512_hmac_finish( (sha512_context *) ctx, output ); -} - -static void sha384_hmac_reset_wrap( void *ctx ) -{ - sha512_hmac_reset( (sha512_context *) ctx ); -} - -static void sha384_hmac_wrap( const unsigned char *key, size_t keylen, - const unsigned char *input, size_t ilen, - unsigned char *output ) -{ - sha512_hmac( key, keylen, input, ilen, output, 1 ); -} - static void * sha384_ctx_alloc( void ) { return polarssl_malloc( sizeof( sha512_context ) ); @@ -839,11 +607,6 @@ const md_info_t sha384_info = { sha384_finish_wrap, sha384_wrap, sha384_file_wrap, - sha384_hmac_starts_wrap, - sha384_hmac_update_wrap, - sha384_hmac_finish_wrap, - sha384_hmac_reset_wrap, - sha384_hmac_wrap, sha384_ctx_alloc, sha384_ctx_free, sha384_process_wrap, @@ -882,35 +645,6 @@ static int sha512_file_wrap( const char *path, unsigned char *output ) #endif } -static void sha512_hmac_starts_wrap( void *ctx, const unsigned char *key, - size_t keylen ) -{ - sha512_hmac_starts( (sha512_context *) ctx, key, keylen, 0 ); -} - -static void sha512_hmac_update_wrap( void *ctx, const unsigned char *input, - size_t ilen ) -{ - sha512_hmac_update( (sha512_context *) ctx, input, ilen ); -} - -static void sha512_hmac_finish_wrap( void *ctx, unsigned char *output ) -{ - sha512_hmac_finish( (sha512_context *) ctx, output ); -} - -static void sha512_hmac_reset_wrap( void *ctx ) -{ - sha512_hmac_reset( (sha512_context *) ctx ); -} - -static void sha512_hmac_wrap( const unsigned char *key, size_t keylen, - const unsigned char *input, size_t ilen, - unsigned char *output ) -{ - sha512_hmac( key, keylen, input, ilen, output, 0 ); -} - static void * sha512_ctx_alloc( void ) { sha512_context *ctx; @@ -945,11 +679,6 @@ const md_info_t sha512_info = { sha512_finish_wrap, sha512_wrap, sha512_file_wrap, - sha512_hmac_starts_wrap, - sha512_hmac_update_wrap, - sha512_hmac_finish_wrap, - sha512_hmac_reset_wrap, - sha512_hmac_wrap, sha512_ctx_alloc, sha512_ctx_free, sha512_process_wrap,