From 61b699ed1b66575e07cd831d73de1f4570d38f77 Mon Sep 17 00:00:00 2001 From: Paul Bakker Date: Wed, 22 Jan 2014 13:35:29 +0100 Subject: [PATCH] Renamed RMD160 to RIPEMD160 --- include/polarssl/config.h | 6 +- include/polarssl/md.h | 2 +- include/polarssl/md_wrap.h | 4 +- include/polarssl/{rmd160.h => ripemd160.h} | 84 +++++------ library/CMakeLists.txt | 2 +- library/Makefile | 2 +- library/md.c | 16 +-- library/md_wrap.c | 80 +++++------ library/{rmd160.c => ripemd160.c} | 156 ++++++++++----------- programs/test/benchmark.c | 16 +-- programs/test/selftest.c | 6 +- tests/suites/test_suite_md.data | 120 ++++++++-------- tests/suites/test_suite_mdx.data | 84 +++++------ tests/suites/test_suite_mdx.function | 28 ++-- visualc/VS2010/PolarSSL.vcxproj | 4 +- visualc/VS6/polarssl.dsp | 4 +- 16 files changed, 307 insertions(+), 307 deletions(-) rename include/polarssl/{rmd160.h => ripemd160.h} (55%) rename library/{rmd160.c => ripemd160.c} (80%) diff --git a/include/polarssl/config.h b/include/polarssl/config.h index 56e6f393e..4861ee107 100644 --- a/include/polarssl/config.h +++ b/include/polarssl/config.h @@ -1559,15 +1559,15 @@ #define POLARSSL_PKCS12_C /** - * \def POLARSSL_RMD160_C + * \def POLARSSL_RIPEMD160_C * * Enable the RIPEMD-160 hash algorithm. * - * Module: library/rmd160.c + * Module: library/ripemd160.c * Caller: library/md.c * */ -#define POLARSSL_RMD160_C +#define POLARSSL_RIPEMD160_C /** * \def POLARSSL_RSA_C diff --git a/include/polarssl/md.h b/include/polarssl/md.h index 424b89f8f..2c772b134 100644 --- a/include/polarssl/md.h +++ b/include/polarssl/md.h @@ -58,7 +58,7 @@ typedef enum { POLARSSL_MD_SHA256, POLARSSL_MD_SHA384, POLARSSL_MD_SHA512, - POLARSSL_MD_RMD160, + POLARSSL_MD_RIPEMD160, } md_type_t; #if defined(POLARSSL_SHA512_C) diff --git a/include/polarssl/md_wrap.h b/include/polarssl/md_wrap.h index c4e2e45c0..d681a0ca2 100644 --- a/include/polarssl/md_wrap.h +++ b/include/polarssl/md_wrap.h @@ -45,8 +45,8 @@ extern const md_info_t md4_info; #if defined(POLARSSL_MD5_C) extern const md_info_t md5_info; #endif -#if defined(POLARSSL_RMD160_C) -extern const md_info_t rmd160_info; +#if defined(POLARSSL_RIPEMD160_C) +extern const md_info_t ripemd160_info; #endif #if defined(POLARSSL_SHA1_C) extern const md_info_t sha1_info; diff --git a/include/polarssl/rmd160.h b/include/polarssl/ripemd160.h similarity index 55% rename from include/polarssl/rmd160.h rename to include/polarssl/ripemd160.h index e9e5f7d34..47a73bd9e 100644 --- a/include/polarssl/rmd160.h +++ b/include/polarssl/ripemd160.h @@ -24,8 +24,8 @@ * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#ifndef POLARSSL_RMD160_H -#define POLARSSL_RMD160_H +#ifndef POLARSSL_RIPEMD160_H +#define POLARSSL_RIPEMD160_H #include "config.h" @@ -38,14 +38,14 @@ typedef UINT32 uint32_t; #include #endif -#define POLARSSL_ERR_RMD160_FILE_IO_ERROR -0x0074 /**< Read/write error in file. */ +#define POLARSSL_ERR_RIPEMD160_FILE_IO_ERROR -0x0074 /**< Read/write error in file. */ #ifdef __cplusplus extern "C" { #endif /** - * \brief RMD160 context structure + * \brief RIPEMD-160 context structure */ typedef struct { @@ -56,115 +56,115 @@ typedef struct unsigned char ipad[64]; /*!< HMAC: inner padding */ unsigned char opad[64]; /*!< HMAC: outer padding */ } -rmd160_context; +ripemd160_context; /** - * \brief RMD160 context setup + * \brief RIPEMD-160 context setup * * \param ctx context to be initialized */ -void rmd160_starts( rmd160_context *ctx ); +void ripemd160_starts( ripemd160_context *ctx ); /** - * \brief RMD160 process buffer + * \brief RIPEMD-160 process buffer * - * \param ctx RMD160 context + * \param ctx RIPEMD-160 context * \param input buffer holding the data * \param ilen length of the input data */ -void rmd160_update( rmd160_context *ctx, - const unsigned char *input, size_t ilen ); +void ripemd160_update( ripemd160_context *ctx, + const unsigned char *input, size_t ilen ); /** - * \brief RMD160 final digest + * \brief RIPEMD-160 final digest * - * \param ctx RMD160 context - * \param output RMD160 checksum result + * \param ctx RIPEMD-160 context + * \param output RIPEMD-160 checksum result */ -void rmd160_finish( rmd160_context *ctx, unsigned char output[20] ); +void ripemd160_finish( ripemd160_context *ctx, unsigned char output[20] ); /** - * \brief Output = RMD160( input buffer ) + * \brief Output = RIPEMD-160( input buffer ) * * \param input buffer holding the data * \param ilen length of the input data - * \param output RMD160 checksum result + * \param output RIPEMD-160 checksum result */ -void rmd160( const unsigned char *input, size_t ilen, - unsigned char output[20] ); +void ripemd160( const unsigned char *input, size_t ilen, + unsigned char output[20] ); #if defined(POLARSSL_FS_IO) /** - * \brief Output = RMD160( file contents ) + * \brief Output = RIPEMD-160( file contents ) * * \param path input file name - * \param output RMD160 checksum result + * \param output RIPEMD-160 checksum result * - * \return 0 if successful, or POLARSSL_ERR_RMD160_FILE_IO_ERROR + * \return 0 if successful, or POLARSSL_ERR_RIPEMD160_FILE_IO_ERROR */ -int rmd160_file( const char *path, unsigned char output[20] ); +int ripemd160_file( const char *path, unsigned char output[20] ); #endif /* POLARSSL_FS_IO */ /** - * \brief RMD160 HMAC context setup + * \brief RIPEMD-160 HMAC context setup * * \param ctx HMAC context to be initialized * \param key HMAC secret key * \param keylen length of the HMAC key */ -void rmd160_hmac_starts( rmd160_context *ctx, - const unsigned char *key, size_t keylen ); +void ripemd160_hmac_starts( ripemd160_context *ctx, + const unsigned char *key, size_t keylen ); /** - * \brief RMD160 HMAC process buffer + * \brief RIPEMD-160 HMAC process buffer * * \param ctx HMAC context * \param input buffer holding the data * \param ilen length of the input data */ -void rmd160_hmac_update( rmd160_context *ctx, - const unsigned char *input, size_t ilen ); +void ripemd160_hmac_update( ripemd160_context *ctx, + const unsigned char *input, size_t ilen ); /** - * \brief RMD160 HMAC final digest + * \brief RIPEMD-160 HMAC final digest * * \param ctx HMAC context - * \param output RMD160 HMAC checksum result + * \param output RIPEMD-160 HMAC checksum result */ -void rmd160_hmac_finish( rmd160_context *ctx, unsigned char output[20] ); +void ripemd160_hmac_finish( ripemd160_context *ctx, unsigned char output[20] ); /** - * \brief RMD160 HMAC context reset + * \brief RIPEMD-160 HMAC context reset * * \param ctx HMAC context to be reset */ -void rmd160_hmac_reset( rmd160_context *ctx ); +void ripemd160_hmac_reset( ripemd160_context *ctx ); /** - * \brief Output = HMAC-RMD160( hmac key, input buffer ) + * \brief Output = HMAC-RIPEMD-160( 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-RMD160 result + * \param output HMAC-RIPEMD-160 result */ -void rmd160_hmac( const unsigned char *key, size_t keylen, - const unsigned char *input, size_t ilen, - unsigned char output[20] ); +void ripemd160_hmac( const unsigned char *key, size_t keylen, + const unsigned char *input, size_t ilen, + unsigned char output[20] ); /** * \brief Checkup routine * * \return 0 if successful, or 1 if the test failed */ -int rmd160_self_test( int verbose ); +int ripemd160_self_test( int verbose ); /* Internal use */ -void rmd160_process( rmd160_context *ctx, const unsigned char data[64] ); +void ripemd160_process( ripemd160_context *ctx, const unsigned char data[64] ); #ifdef __cplusplus } #endif -#endif /* rmd160.h */ +#endif /* ripemd160.h */ diff --git a/library/CMakeLists.txt b/library/CMakeLists.txt index f967bf6c0..c9551af4e 100644 --- a/library/CMakeLists.txt +++ b/library/CMakeLists.txt @@ -45,7 +45,7 @@ set(src pk_wrap.c pkparse.c pkwrite.c - rmd160.c + ripemd160.c rsa.c sha1.c sha256.c diff --git a/library/Makefile b/library/Makefile index 99655853e..a4126f0e1 100644 --- a/library/Makefile +++ b/library/Makefile @@ -51,7 +51,7 @@ OBJS= aes.o aesni.o arc4.o \ padlock.o pbkdf2.o pem.o \ pkcs5.o pkcs11.o pkcs12.o \ pk.o pk_wrap.o pkparse.o \ - pkwrite.o rmd160.o \ + pkwrite.o ripemd160.o \ rsa.o sha1.o sha256.o \ sha512.o ssl_cache.o ssl_cli.o \ ssl_srv.o ssl_ciphersuites.o \ diff --git a/library/md.c b/library/md.c index 291219d03..5ab0fadd3 100644 --- a/library/md.c +++ b/library/md.c @@ -55,8 +55,8 @@ static const int supported_digests[] = { POLARSSL_MD_MD5, #endif -#if defined(POLARSSL_RMD160_C) - POLARSSL_MD_RMD160, +#if defined(POLARSSL_RIPEMD160_C) + POLARSSL_MD_RIPEMD160, #endif #if defined(POLARSSL_SHA1_C) @@ -99,9 +99,9 @@ const md_info_t *md_info_from_string( const char *md_name ) if( !strcasecmp( "MD5", md_name ) ) return md_info_from_type( POLARSSL_MD_MD5 ); #endif -#if defined(POLARSSL_RMD160_C) - if( !strcasecmp( "RMD160", md_name ) ) - return md_info_from_type( POLARSSL_MD_RMD160 ); +#if defined(POLARSSL_RIPEMD160_C) + if( !strcasecmp( "RIPEMD160", md_name ) ) + return md_info_from_type( POLARSSL_MD_RIPEMD160 ); #endif #if defined(POLARSSL_SHA1_C) if( !strcasecmp( "SHA1", md_name ) || !strcasecmp( "SHA", md_name ) ) @@ -138,9 +138,9 @@ const md_info_t *md_info_from_type( md_type_t md_type ) case POLARSSL_MD_MD5: return &md5_info; #endif -#if defined(POLARSSL_RMD160_C) - case POLARSSL_MD_RMD160: - return &rmd160_info; +#if defined(POLARSSL_RIPEMD160_C) + case POLARSSL_MD_RIPEMD160: + return &ripemd160_info; #endif #if defined(POLARSSL_SHA1_C) case POLARSSL_MD_SHA1: diff --git a/library/md_wrap.c b/library/md_wrap.c index bc159ba9f..bca5ab2b6 100644 --- a/library/md_wrap.c +++ b/library/md_wrap.c @@ -45,8 +45,8 @@ #include "polarssl/md5.h" #endif -#if defined(POLARSSL_RMD160_C) -#include "polarssl/rmd160.h" +#if defined(POLARSSL_RIPEMD160_C) +#include "polarssl/ripemd160.h" #endif #if defined(POLARSSL_SHA1_C) @@ -324,27 +324,27 @@ const md_info_t md5_info = { #endif -#if defined(POLARSSL_RMD160_C) +#if defined(POLARSSL_RIPEMD160_C) -static void rmd160_starts_wrap( void *ctx ) +static void ripemd160_starts_wrap( void *ctx ) { - rmd160_starts( (rmd160_context *) ctx ); + ripemd160_starts( (ripemd160_context *) ctx ); } -static void rmd160_update_wrap( void *ctx, const unsigned char *input, size_t ilen ) +static void ripemd160_update_wrap( void *ctx, const unsigned char *input, size_t ilen ) { - rmd160_update( (rmd160_context *) ctx, input, ilen ); + ripemd160_update( (ripemd160_context *) ctx, input, ilen ); } -static void rmd160_finish_wrap( void *ctx, unsigned char *output ) +static void ripemd160_finish_wrap( void *ctx, unsigned char *output ) { - rmd160_finish( (rmd160_context *) ctx, output ); + ripemd160_finish( (ripemd160_context *) ctx, output ); } -static int rmd160_file_wrap( const char *path, unsigned char *output ) +static int ripemd160_file_wrap( const char *path, unsigned char *output ) { #if defined(POLARSSL_FS_IO) - return rmd160_file( path, output ); + return ripemd160_file( path, output ); #else ((void) path); ((void) output); @@ -352,58 +352,58 @@ static int rmd160_file_wrap( const char *path, unsigned char *output ) #endif } -static void rmd160_hmac_starts_wrap( void *ctx, const unsigned char *key, size_t keylen ) +static void ripemd160_hmac_starts_wrap( void *ctx, const unsigned char *key, size_t keylen ) { - rmd160_hmac_starts( (rmd160_context *) ctx, key, keylen ); + ripemd160_hmac_starts( (ripemd160_context *) ctx, key, keylen ); } -static void rmd160_hmac_update_wrap( void *ctx, const unsigned char *input, size_t ilen ) +static void ripemd160_hmac_update_wrap( void *ctx, const unsigned char *input, size_t ilen ) { - rmd160_hmac_update( (rmd160_context *) ctx, input, ilen ); + ripemd160_hmac_update( (ripemd160_context *) ctx, input, ilen ); } -static void rmd160_hmac_finish_wrap( void *ctx, unsigned char *output ) +static void ripemd160_hmac_finish_wrap( void *ctx, unsigned char *output ) { - rmd160_hmac_finish( (rmd160_context *) ctx, output ); + ripemd160_hmac_finish( (ripemd160_context *) ctx, output ); } -static void rmd160_hmac_reset_wrap( void *ctx ) +static void ripemd160_hmac_reset_wrap( void *ctx ) { - rmd160_hmac_reset( (rmd160_context *) ctx ); + ripemd160_hmac_reset( (ripemd160_context *) ctx ); } -static void * rmd160_ctx_alloc( void ) +static void * ripemd160_ctx_alloc( void ) { - return polarssl_malloc( sizeof( rmd160_context ) ); + return polarssl_malloc( sizeof( ripemd160_context ) ); } -static void rmd160_ctx_free( void *ctx ) +static void ripemd160_ctx_free( void *ctx ) { polarssl_free( ctx ); } -static void rmd160_process_wrap( void *ctx, const unsigned char *data ) +static void ripemd160_process_wrap( void *ctx, const unsigned char *data ) { - rmd160_process( (rmd160_context *) ctx, data ); + ripemd160_process( (ripemd160_context *) ctx, data ); } -const md_info_t rmd160_info = { - POLARSSL_MD_RMD160, - "RMD160", +const md_info_t ripemd160_info = { + POLARSSL_MD_RIPEMD160, + "RIPEMD160", 20, - rmd160_starts_wrap, - rmd160_update_wrap, - rmd160_finish_wrap, - rmd160, - rmd160_file_wrap, - rmd160_hmac_starts_wrap, - rmd160_hmac_update_wrap, - rmd160_hmac_finish_wrap, - rmd160_hmac_reset_wrap, - rmd160_hmac, - rmd160_ctx_alloc, - rmd160_ctx_free, - rmd160_process_wrap, + ripemd160_starts_wrap, + ripemd160_update_wrap, + 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, }; #endif diff --git a/library/rmd160.c b/library/ripemd160.c similarity index 80% rename from library/rmd160.c rename to library/ripemd160.c index 5dadb3a28..569cbdec8 100644 --- a/library/rmd160.c +++ b/library/ripemd160.c @@ -31,9 +31,9 @@ #include "polarssl/config.h" -#if defined(POLARSSL_RMD160_C) +#if defined(POLARSSL_RIPEMD160_C) -#include "polarssl/rmd160.h" +#include "polarssl/ripemd160.h" #if defined(POLARSSL_FS_IO) || defined(POLARSSL_SELF_TEST) #include @@ -67,9 +67,9 @@ #endif /* - * RMD160 context setup + * RIPEMD-160 context setup */ -void rmd160_starts( rmd160_context *ctx ) +void ripemd160_starts( ripemd160_context *ctx ) { ctx->total[0] = 0; ctx->total[1] = 0; @@ -84,7 +84,7 @@ void rmd160_starts( rmd160_context *ctx ) /* * Process one block */ -void rmd160_process( rmd160_context *ctx, const unsigned char data[64] ) +void ripemd160_process( ripemd160_context *ctx, const unsigned char data[64] ) { uint32_t A, B, C, D, E, Ap, Bp, Cp, Dp, Ep, X[16]; @@ -262,10 +262,10 @@ void rmd160_process( rmd160_context *ctx, const unsigned char data[64] ) } /* - * RMD160 process buffer + * RIPEMD-160 process buffer */ -void rmd160_update( rmd160_context *ctx, - const unsigned char *input, size_t ilen ) +void ripemd160_update( ripemd160_context *ctx, + const unsigned char *input, size_t ilen ) { size_t fill; uint32_t left; @@ -285,7 +285,7 @@ void rmd160_update( rmd160_context *ctx, if( left && ilen >= fill ) { memcpy( (void *) (ctx->buffer + left), input, fill ); - rmd160_process( ctx, ctx->buffer ); + ripemd160_process( ctx, ctx->buffer ); input += fill; ilen -= fill; left = 0; @@ -293,7 +293,7 @@ void rmd160_update( rmd160_context *ctx, while( ilen >= 64 ) { - rmd160_process( ctx, input ); + ripemd160_process( ctx, input ); input += 64; ilen -= 64; } @@ -304,7 +304,7 @@ void rmd160_update( rmd160_context *ctx, } } -static const unsigned char rmd160_padding[64] = +static const unsigned char ripemd160_padding[64] = { 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, @@ -313,9 +313,9 @@ static const unsigned char rmd160_padding[64] = }; /* - * RMD160 final digest + * RIPEMD-160 final digest */ -void rmd160_finish( rmd160_context *ctx, unsigned char output[20] ) +void ripemd160_finish( ripemd160_context *ctx, unsigned char output[20] ) { uint32_t last, padn; uint32_t high, low; @@ -331,8 +331,8 @@ void rmd160_finish( rmd160_context *ctx, unsigned char output[20] ) last = ctx->total[0] & 0x3F; padn = ( last < 56 ) ? ( 56 - last ) : ( 120 - last ); - rmd160_update( ctx, rmd160_padding, padn ); - rmd160_update( ctx, msglen, 8 ); + ripemd160_update( ctx, ripemd160_padding, padn ); + ripemd160_update( ctx, msglen, 8 ); PUT_UINT32_LE( ctx->state[0], output, 0 ); PUT_UINT32_LE( ctx->state[1], output, 4 ); @@ -342,46 +342,47 @@ void rmd160_finish( rmd160_context *ctx, unsigned char output[20] ) } /* - * output = RMD160( input buffer ) + * output = RIPEMD-160( input buffer ) */ -void rmd160( const unsigned char *input, size_t ilen, unsigned char output[20] ) +void ripemd160( const unsigned char *input, size_t ilen, + unsigned char output[20] ) { - rmd160_context ctx; + ripemd160_context ctx; - rmd160_starts( &ctx ); - rmd160_update( &ctx, input, ilen ); - rmd160_finish( &ctx, output ); + ripemd160_starts( &ctx ); + ripemd160_update( &ctx, input, ilen ); + ripemd160_finish( &ctx, output ); - memset( &ctx, 0, sizeof( rmd160_context ) ); + memset( &ctx, 0, sizeof( ripemd160_context ) ); } #if defined(POLARSSL_FS_IO) /* - * output = RMD160( file contents ) + * output = RIPEMD-160( file contents ) */ -int rmd160_file( const char *path, unsigned char output[20] ) +int ripemd160_file( const char *path, unsigned char output[20] ) { FILE *f; size_t n; - rmd160_context ctx; + ripemd160_context ctx; unsigned char buf[1024]; if( ( f = fopen( path, "rb" ) ) == NULL ) - return( POLARSSL_ERR_RMD160_FILE_IO_ERROR ); + return( POLARSSL_ERR_RIPEMD160_FILE_IO_ERROR ); - rmd160_starts( &ctx ); + ripemd160_starts( &ctx ); while( ( n = fread( buf, 1, sizeof( buf ), f ) ) > 0 ) - rmd160_update( &ctx, buf, n ); + ripemd160_update( &ctx, buf, n ); - rmd160_finish( &ctx, output ); + ripemd160_finish( &ctx, output ); - memset( &ctx, 0, sizeof( rmd160_context ) ); + memset( &ctx, 0, sizeof( ripemd160_context ) ); if( ferror( f ) != 0 ) { fclose( f ); - return( POLARSSL_ERR_RMD160_FILE_IO_ERROR ); + return( POLARSSL_ERR_RIPEMD160_FILE_IO_ERROR ); } fclose( f ); @@ -389,19 +390,18 @@ int rmd160_file( const char *path, unsigned char output[20] ) } #endif /* POLARSSL_FS_IO */ - /* - * RMD160 HMAC context setup + * RIPEMD-160 HMAC context setup */ -void rmd160_hmac_starts( rmd160_context *ctx, - const unsigned char *key, size_t keylen ) +void ripemd160_hmac_starts( ripemd160_context *ctx, + const unsigned char *key, size_t keylen ) { size_t i; unsigned char sum[20]; if( keylen > 64 ) { - rmd160( key, keylen, sum ); + ripemd160( key, keylen, sum ); keylen = 20; key = sum; } @@ -415,60 +415,60 @@ void rmd160_hmac_starts( rmd160_context *ctx, ctx->opad[i] = (unsigned char)( ctx->opad[i] ^ key[i] ); } - rmd160_starts( ctx ); - rmd160_update( ctx, ctx->ipad, 64 ); + ripemd160_starts( ctx ); + ripemd160_update( ctx, ctx->ipad, 64 ); memset( sum, 0, sizeof( sum ) ); } /* - * RMD160 HMAC process buffer + * RIPEMD-160 HMAC process buffer */ -void rmd160_hmac_update( rmd160_context *ctx, - const unsigned char *input, size_t ilen ) +void ripemd160_hmac_update( ripemd160_context *ctx, + const unsigned char *input, size_t ilen ) { - rmd160_update( ctx, input, ilen ); + ripemd160_update( ctx, input, ilen ); } /* - * RMD160 HMAC final digest + * RIPEMD-160 HMAC final digest */ -void rmd160_hmac_finish( rmd160_context *ctx, unsigned char output[20] ) +void ripemd160_hmac_finish( ripemd160_context *ctx, unsigned char output[20] ) { unsigned char tmpbuf[20]; - rmd160_finish( ctx, tmpbuf ); - rmd160_starts( ctx ); - rmd160_update( ctx, ctx->opad, 64 ); - rmd160_update( ctx, tmpbuf, 20 ); - rmd160_finish( ctx, output ); + ripemd160_finish( ctx, tmpbuf ); + ripemd160_starts( ctx ); + ripemd160_update( ctx, ctx->opad, 64 ); + ripemd160_update( ctx, tmpbuf, 20 ); + ripemd160_finish( ctx, output ); memset( tmpbuf, 0, sizeof( tmpbuf ) ); } /* - * RMD160 HMAC context reset + * RIPEMD-160 HMAC context reset */ -void rmd160_hmac_reset( rmd160_context *ctx ) +void ripemd160_hmac_reset( ripemd160_context *ctx ) { - rmd160_starts( ctx ); - rmd160_update( ctx, ctx->ipad, 64 ); + ripemd160_starts( ctx ); + ripemd160_update( ctx, ctx->ipad, 64 ); } /* - * output = HMAC-RMD160( hmac key, input buffer ) + * output = HMAC-RIPEMD-160( hmac key, input buffer ) */ -void rmd160_hmac( const unsigned char *key, size_t keylen, - const unsigned char *input, size_t ilen, - unsigned char output[20] ) +void ripemd160_hmac( const unsigned char *key, size_t keylen, + const unsigned char *input, size_t ilen, + unsigned char output[20] ) { - rmd160_context ctx; + ripemd160_context ctx; - rmd160_hmac_starts( &ctx, key, keylen ); - rmd160_hmac_update( &ctx, input, ilen ); - rmd160_hmac_finish( &ctx, output ); + ripemd160_hmac_starts( &ctx, key, keylen ); + ripemd160_hmac_update( &ctx, input, ilen ); + ripemd160_hmac_finish( &ctx, output ); - memset( &ctx, 0, sizeof( rmd160_context ) ); + memset( &ctx, 0, sizeof( ripemd160_context ) ); } @@ -479,7 +479,7 @@ void rmd160_hmac( const unsigned char *key, size_t keylen, */ #define TESTS 8 #define KEYS 2 -static const char *rmd160_test_input[TESTS] = +static const char *ripemd160_test_input[TESTS] = { "", "a", @@ -492,7 +492,7 @@ static const char *rmd160_test_input[TESTS] = "1234567890123456789012345678901234567890", }; -static const unsigned char rmd160_test_md[TESTS][20] = +static const unsigned char ripemd160_test_md[TESTS][20] = { { 0x9c, 0x11, 0x85, 0xa5, 0xc5, 0xe9, 0xfc, 0x54, 0x61, 0x28, 0x08, 0x97, 0x7e, 0xe8, 0xf5, 0x48, 0xb2, 0x25, 0x8d, 0x31 }, @@ -512,7 +512,7 @@ static const unsigned char rmd160_test_md[TESTS][20] = 0xd3, 0x32, 0x3c, 0xab, 0x82, 0xbf, 0x63, 0x32, 0x6b, 0xfb }, }; -static const unsigned char rmd160_test_hmac[KEYS][TESTS][20] = +static const unsigned char ripemd160_test_hmac[KEYS][TESTS][20] = { { { 0xcf, 0x38, 0x76, 0x77, 0xbf, 0xda, 0x84, 0x83, 0xe6, 0x3b, @@ -552,7 +552,7 @@ static const unsigned char rmd160_test_hmac[KEYS][TESTS][20] = }, }; -static const unsigned char rmd160_test_key[KEYS][20] = +static const unsigned char ripemd160_test_key[KEYS][20] = { { 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff, 0x01, 0x23, 0x45, 0x67 }, @@ -563,7 +563,7 @@ static const unsigned char rmd160_test_key[KEYS][20] = /* * Checkup routine */ -int rmd160_self_test( int verbose ) +int ripemd160_self_test( int verbose ) { int i, j; unsigned char output[20]; @@ -573,13 +573,13 @@ int rmd160_self_test( int verbose ) for( i = 0; i < TESTS; i++ ) { if( verbose != 0 ) - printf( " RMD160 test #%d: ", i + 1 ); + printf( " RIPEMD-160 test #%d: ", i + 1 ); - rmd160( (const unsigned char *) rmd160_test_input[i], - strlen( rmd160_test_input[i] ), - output ); + ripemd160( (const unsigned char *) ripemd160_test_input[i], + strlen( ripemd160_test_input[i] ), + output ); - if( memcmp( output, rmd160_test_md[i], 20 ) != 0 ) + if( memcmp( output, ripemd160_test_md[i], 20 ) != 0 ) { if( verbose != 0 ) printf( "failed\n" ); @@ -593,14 +593,14 @@ int rmd160_self_test( int verbose ) for( j = 0; j < KEYS; j++ ) { if( verbose != 0 ) - printf( " HMAC-RMD160 test #%d, key #%d: ", i + 1, j + 1 ); + printf( " HMAC-RIPEMD-160 test #%d, key #%d: ", i + 1, j + 1 ); - rmd160_hmac( rmd160_test_key[j], 20, - (const unsigned char *) rmd160_test_input[i], - strlen( rmd160_test_input[i] ), - output ); + ripemd160_hmac( ripemd160_test_key[j], 20, + (const unsigned char *) ripemd160_test_input[i], + strlen( ripemd160_test_input[i] ), + output ); - if( memcmp( output, rmd160_test_hmac[j][i], 20 ) != 0 ) + if( memcmp( output, ripemd160_test_hmac[j][i], 20 ) != 0 ) { if( verbose != 0 ) printf( "failed\n" ); diff --git a/programs/test/benchmark.c b/programs/test/benchmark.c index 863bbce0b..57fe67b94 100644 --- a/programs/test/benchmark.c +++ b/programs/test/benchmark.c @@ -33,7 +33,7 @@ #include "polarssl/md4.h" #include "polarssl/md5.h" -#include "polarssl/rmd160.h" +#include "polarssl/ripemd160.h" #include "polarssl/sha1.h" #include "polarssl/sha256.h" #include "polarssl/sha512.h" @@ -139,14 +139,14 @@ do { \ unsigned char buf[BUFSIZE]; typedef struct { - char md4, md5, rmd160, sha1, sha256, sha512, + char md4, md5, ripemd160, sha1, sha256, sha512, arc4, des3, des, aes_cbc, aes_gcm, camellia, blowfish, havege, ctr_drbg, rsa, dhm, ecdsa, ecdh; } todo_list; #define OPTIONS \ - "md4, md5, rmd160, sha1, sha256, sha512,\n" \ + "md4, md5, ripemd160, sha1, sha256, sha512,\n" \ "arc4, des3, des, aes_cbc, aes_gcm, camellia, blowfish,\n" \ "havege, ctr_drbg,\n" \ "rsa, dhm, ecdsa, ecdh.\n" @@ -170,8 +170,8 @@ int main( int argc, char *argv[] ) todo.md4 = 1; else if( strcmp( argv[i], "md5" ) == 0 ) todo.md5 = 1; - else if( strcmp( argv[i], "rmd160" ) == 0 ) - todo.rmd160 = 1; + else if( strcmp( argv[i], "ripemd160" ) == 0 ) + todo.ripemd160 = 1; else if( strcmp( argv[i], "sha1" ) == 0 ) todo.sha1 = 1; else if( strcmp( argv[i], "sha256" ) == 0 ) @@ -226,9 +226,9 @@ int main( int argc, char *argv[] ) TIME_AND_TSC( "MD5", md5( buf, BUFSIZE, tmp ) ); #endif -#if defined(POLARSSL_RMD160_C) - if( todo.rmd160 ) - TIME_AND_TSC( "RMD160", rmd160( buf, BUFSIZE, tmp ) ); +#if defined(POLARSSL_RIPEMD160_C) + if( todo.ripemd160 ) + TIME_AND_TSC( "RIPEMD160", ripemd160( buf, BUFSIZE, tmp ) ); #endif #if defined(POLARSSL_SHA1_C) diff --git a/programs/test/selftest.c b/programs/test/selftest.c index fc990fe93..8a8a82004 100644 --- a/programs/test/selftest.c +++ b/programs/test/selftest.c @@ -34,7 +34,7 @@ #include "polarssl/md2.h" #include "polarssl/md4.h" #include "polarssl/md5.h" -#include "polarssl/rmd160.h" +#include "polarssl/ripemd160.h" #include "polarssl/sha1.h" #include "polarssl/sha256.h" #include "polarssl/sha512.h" @@ -90,8 +90,8 @@ int main( int argc, char *argv[] ) return( ret ); #endif -#if defined(POLARSSL_RMD160_C) - if( ( ret = rmd160_self_test( v ) ) != 0 ) +#if defined(POLARSSL_RIPEMD160_C) + if( ( ret = ripemd160_self_test( v ) ) != 0 ) return( ret ); #endif diff --git a/tests/suites/test_suite_md.data b/tests/suites/test_suite_md.data index 25b881f61..cc1851cd8 100644 --- a/tests/suites/test_suite_md.data +++ b/tests/suites/test_suite_md.data @@ -82,37 +82,37 @@ generic md5 Test vector RFC1321 #7 depends_on:POLARSSL_MD5_C md_text:"md5":"12345678901234567890123456789012345678901234567890123456789012345678901234567890":"57edf4a22be3c955ac49da2e2107b67a" -rmd160 Test vector from paper #1 -depends_on:POLARSSL_RMD160_C -md_text:"rmd160":"":"9c1185a5c5e9fc54612808977ee8f548b2258d31" +ripemd160 Test vector from paper #1 +depends_on:POLARSSL_RIPEMD160_C +md_text:"ripemd160":"":"9c1185a5c5e9fc54612808977ee8f548b2258d31" -rmd160 Test vector from paper #2 -depends_on:POLARSSL_RMD160_C -md_text:"rmd160":"a":"0bdc9d2d256b3ee9daae347be6f4dc835a467ffe" +ripemd160 Test vector from paper #2 +depends_on:POLARSSL_RIPEMD160_C +md_text:"ripemd160":"a":"0bdc9d2d256b3ee9daae347be6f4dc835a467ffe" -rmd160 Test vector from paper #3 -depends_on:POLARSSL_RMD160_C -md_text:"rmd160":"abc":"8eb208f7e05d987a9b044a8e98c6b087f15a0bfc" +ripemd160 Test vector from paper #3 +depends_on:POLARSSL_RIPEMD160_C +md_text:"ripemd160":"abc":"8eb208f7e05d987a9b044a8e98c6b087f15a0bfc" -rmd160 Test vector from paper #4 -depends_on:POLARSSL_RMD160_C -md_text:"rmd160":"message digest":"5d0689ef49d2fae572b881b123a85ffa21595f36" +ripemd160 Test vector from paper #4 +depends_on:POLARSSL_RIPEMD160_C +md_text:"ripemd160":"message digest":"5d0689ef49d2fae572b881b123a85ffa21595f36" -rmd160 Test vector from paper #5 -depends_on:POLARSSL_RMD160_C -md_text:"rmd160":"abcdefghijklmnopqrstuvwxyz":"f71c27109c692c1b56bbdceb5b9d2865b3708dbc" +ripemd160 Test vector from paper #5 +depends_on:POLARSSL_RIPEMD160_C +md_text:"ripemd160":"abcdefghijklmnopqrstuvwxyz":"f71c27109c692c1b56bbdceb5b9d2865b3708dbc" -rmd160 Test vector from paper #6 -depends_on:POLARSSL_RMD160_C -md_text:"rmd160":"abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq":"12a053384a9c0c88e405a06c27dcf49ada62eb2b" +ripemd160 Test vector from paper #6 +depends_on:POLARSSL_RIPEMD160_C +md_text:"ripemd160":"abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq":"12a053384a9c0c88e405a06c27dcf49ada62eb2b" -rmd160 Test vector from paper #7 -depends_on:POLARSSL_RMD160_C -md_text:"rmd160":"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789":"b0e20b6e3116640286ed3a87a5713079b21f5189" +ripemd160 Test vector from paper #7 +depends_on:POLARSSL_RIPEMD160_C +md_text:"ripemd160":"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789":"b0e20b6e3116640286ed3a87a5713079b21f5189" -rmd160 Test vector from paper #8 -depends_on:POLARSSL_RMD160_C -md_text:"rmd160":"12345678901234567890123456789012345678901234567890123456789012345678901234567890":"9b752e45573d4b39f4dbd3323cab82bf63326bfb" +ripemd160 Test vector from paper #8 +depends_on:POLARSSL_RIPEMD160_C +md_text:"ripemd160":"12345678901234567890123456789012345678901234567890123456789012345678901234567890":"9b752e45573d4b39f4dbd3323cab82bf63326bfb" generic HMAC-MD2 Hash File OpenSSL test #1 depends_on:POLARSSL_MD2_C @@ -178,33 +178,33 @@ generic HMAC-MD5 Test Vector RFC2202 #7 depends_on:POLARSSL_MD5_C md_hmac:"md5":16:"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa":"54657374205573696e67204c6172676572205468616e20426c6f636b2d53697a65204b657920616e64204c6172676572205468616e204f6e6520426c6f636b2d53697a652044617461":"6f630fad67cda0ee1fb1f562db3aa53e" -HMAC-RMD160 Test vector RFC 2286 #1 -depends_on:POLARSSL_RMD160_C -md_hmac:"rmd160":20:"0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b":"4869205468657265":"24cb4bd67d20fc1a5d2ed7732dcc39377f0a5668" +HMAC-RIPEMD160 Test vector RFC 2286 #1 +depends_on:POLARSSL_RIPEMD160_C +md_hmac:"ripemd160":20:"0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b":"4869205468657265":"24cb4bd67d20fc1a5d2ed7732dcc39377f0a5668" -HMAC-RMD160 Test vector RFC 2286 #2 -depends_on:POLARSSL_RMD160_C -md_hmac:"rmd160":20:"4a656665":"7768617420646f2079612077616e7420666f72206e6f7468696e673f":"dda6c0213a485a9e24f4742064a7f033b43c4069" +HMAC-RIPEMD160 Test vector RFC 2286 #2 +depends_on:POLARSSL_RIPEMD160_C +md_hmac:"ripemd160":20:"4a656665":"7768617420646f2079612077616e7420666f72206e6f7468696e673f":"dda6c0213a485a9e24f4742064a7f033b43c4069" -HMAC-RMD160 Test vector RFC 2286 #3 -depends_on:POLARSSL_RMD160_C -md_hmac:"rmd160":20:"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa":"dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd":"b0b105360de759960ab4f35298e116e295d8e7c1" +HMAC-RIPEMD160 Test vector RFC 2286 #3 +depends_on:POLARSSL_RIPEMD160_C +md_hmac:"ripemd160":20:"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa":"dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd":"b0b105360de759960ab4f35298e116e295d8e7c1" -HMAC-RMD160 Test vector RFC 2286 #4 -depends_on:POLARSSL_RMD160_C -md_hmac:"rmd160":20:"0102030405060708090a0b0c0d0e0f10111213141516171819":"cdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcd":"d5ca862f4d21d5e610e18b4cf1beb97a4365ecf4" +HMAC-RIPEMD160 Test vector RFC 2286 #4 +depends_on:POLARSSL_RIPEMD160_C +md_hmac:"ripemd160":20:"0102030405060708090a0b0c0d0e0f10111213141516171819":"cdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcd":"d5ca862f4d21d5e610e18b4cf1beb97a4365ecf4" -HMAC-RMD160 Test vector RFC 2286 #5 -depends_on:POLARSSL_RMD160_C -md_hmac:"rmd160":20:"0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c":"546573742057697468205472756e636174696f6e":"7619693978f91d90539ae786500ff3d8e0518e39" +HMAC-RIPEMD160 Test vector RFC 2286 #5 +depends_on:POLARSSL_RIPEMD160_C +md_hmac:"ripemd160":20:"0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c":"546573742057697468205472756e636174696f6e":"7619693978f91d90539ae786500ff3d8e0518e39" -HMAC-RMD160 Test vector RFC 2286 #6 -depends_on:POLARSSL_RMD160_C -md_hmac:"rmd160":20:"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa":"54657374205573696e67204c6172676572205468616e20426c6f636b2d53697a65204b6579202d2048617368204b6579204669727374":"6466ca07ac5eac29e1bd523e5ada7605b791fd8b" +HMAC-RIPEMD160 Test vector RFC 2286 #6 +depends_on:POLARSSL_RIPEMD160_C +md_hmac:"ripemd160":20:"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa":"54657374205573696e67204c6172676572205468616e20426c6f636b2d53697a65204b6579202d2048617368204b6579204669727374":"6466ca07ac5eac29e1bd523e5ada7605b791fd8b" -HMAC-RMD160 Test vector RFC 2286 #7 -depends_on:POLARSSL_RMD160_C -md_hmac:"rmd160":20:"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa":"54657374205573696e67204c6172676572205468616e20426c6f636b2d53697a65204b657920616e64204c6172676572205468616e204f6e6520426c6f636b2d53697a652044617461":"69ea60798d71616cce5fd0871e23754cd75d5a0a" +HMAC-RIPEMD160 Test vector RFC 2286 #7 +depends_on:POLARSSL_RIPEMD160_C +md_hmac:"ripemd160":20:"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa":"54657374205573696e67204c6172676572205468616e20426c6f636b2d53697a65204b657920616e64204c6172676572205468616e204f6e6520426c6f636b2d53697a652044617461":"69ea60798d71616cce5fd0871e23754cd75d5a0a" generic multi step md2 Test vector RFC1319 #1 depends_on:POLARSSL_MD_C:POLARSSL_MD2_C @@ -1010,25 +1010,25 @@ generic multi step SHA-512 Test Vector NIST CAVS #8 depends_on:POLARSSL_SHA512_C md_hex_multi:"sha512":"990d1ae71a62d7bda9bfdaa1762a68d296eee72a4cd946f287a898fbabc002ea941fd8d4d991030b4d27a637cce501a834bb95eab1b7889a3e784c7968e67cbf552006b206b68f76d9191327524fcc251aeb56af483d10b4e0c6c5e599ee8c0fe4faeca8293844a8547c6a9a90d093f2526873a19ad4a5e776794c68c742fb834793d2dfcb7fea46c63af4b70fd11cb6e41834e72ee40edb067b292a794990c288d5007e73f349fb383af6a756b8301ad6e5e0aa8cd614399bb3a452376b1575afa6bdaeaafc286cb064bb91edef97c632b6c1113d107fa93a0905098a105043c2f05397f702514439a08a9e5ddc196100721d45c8fc17d2ed659376f8a00bd5cb9a0860e26d8a29d8d6aaf52de97e9346033d6db501a35dbbaf97c20b830cd2d18c2532f3a59cc497ee64c0e57d8d060e5069b28d86edf1adcf59144b221ce3ddaef134b3124fbc7dd000240eff0f5f5f41e83cd7f5bb37c9ae21953fe302b0f6e8b68fa91c6ab99265c64b2fd9cd4942be04321bb5d6d71932376c6f2f88e02422ba6a5e2cb765df93fd5dd0728c6abdaf03bce22e0678a544e2c3636f741b6f4447ee58a8fc656b43ef817932176adbfc2e04b2c812c273cd6cbfa4098f0be036a34221fa02643f5ee2e0b38135f2a18ecd2f16ebc45f8eb31b8ab967a1567ee016904188910861ca1fa205c7adaa194b286893ffe2f4fbe0384c2aef72a4522aeafd3ebc71f9db71eeeef86c48394a1c86d5b36c352cc33a0a2c800bc99e62fd65b3a2fd69e0b53996ec13d8ce483ce9319efd9a85acefabdb5342226febb83fd1daf4b24265f50c61c6de74077ef89b6fecf9f29a1f871af1e9f89b2d345cda7499bd45c42fa5d195a1e1a6ba84851889e730da3b2b916e96152ae0c92154b49719841db7e7cc707ba8a5d7b101eb4ac7b629bb327817910fff61580b59aab78182d1a2e33473d05b00b170b29e331870826cfe45af206aa7d0246bbd8566ca7cfb2d3c10bfa1db7dd48dd786036469ce7282093d78b5e1a5b0fc81a54c8ed4ceac1e5305305e78284ac276f5d7862727aff246e17addde50c670028d572cbfc0be2e4f8b2eb28fa68ad7b4c6c2a239c460441bfb5ea049f23b08563b4e47729a59e5986a61a6093dbd54f8c36ebe87edae01f251cb060ad1364ce677d7e8d5a4a4ca966a7241cc360bc2acb280e5f9e9c1b032ad6a180a35e0c5180b9d16d026c865b252098cc1d99ba7375ca31c7702c0d943d5e3dd2f6861fa55bd46d94b67ed3e52eccd8dd06d968e01897d6de97ed3058d91dd":"8e4bc6f8b8c60fe4d68c61d9b159c8693c3151c46749af58da228442d927f23359bd6ccd6c2ec8fa3f00a86cecbfa728e1ad60b821ed22fcd309ba91a4138bc9" -RMD160 Hash file #0 (from paper) -depends_on:POLARSSL_RMD160_C -md_file:"rmd160":"data_files/hash_file_5":"52783243c1697bdbe16d37f97f68f08325dc1528" +RIPEMD160 Hash file #0 (from paper) +depends_on:POLARSSL_RIPEMD160_C +md_file:"ripemd160":"data_files/hash_file_5":"52783243c1697bdbe16d37f97f68f08325dc1528" -RMD160 Hash file #1 -depends_on:POLARSSL_RMD160_C -md_file:"rmd160":"data_files/hash_file_1":"82f1d072f0ec0c2b353703a7b575a04c113af1a6" +RIPEMD160 Hash file #1 +depends_on:POLARSSL_RIPEMD160_C +md_file:"ripemd160":"data_files/hash_file_1":"82f1d072f0ec0c2b353703a7b575a04c113af1a6" -RMD160 Hash file #2 -depends_on:POLARSSL_RMD160_C -md_file:"rmd160":"data_files/hash_file_2":"996fbc8b79206ba7393ebcd246584069b1c08f0f" +RIPEMD160 Hash file #2 +depends_on:POLARSSL_RIPEMD160_C +md_file:"ripemd160":"data_files/hash_file_2":"996fbc8b79206ba7393ebcd246584069b1c08f0f" -RMD160 Hash file #3 -depends_on:POLARSSL_RMD160_C -md_file:"rmd160":"data_files/hash_file_3":"8653b46d65998fa8c8846efa17937e742533ae48" +RIPEMD160 Hash file #3 +depends_on:POLARSSL_RIPEMD160_C +md_file:"ripemd160":"data_files/hash_file_3":"8653b46d65998fa8c8846efa17937e742533ae48" -RMD160 Hash file #4 -depends_on:POLARSSL_RMD160_C -md_file:"rmd160":"data_files/hash_file_4":"9c1185a5c5e9fc54612808977ee8f548b2258d31" +RIPEMD160 Hash file #4 +depends_on:POLARSSL_RIPEMD160_C +md_file:"ripemd160":"data_files/hash_file_4":"9c1185a5c5e9fc54612808977ee8f548b2258d31" generic SHA1 Hash file #1 depends_on:POLARSSL_SHA1_C diff --git a/tests/suites/test_suite_mdx.data b/tests/suites/test_suite_mdx.data index 869ae966b..b815bd610 100644 --- a/tests/suites/test_suite_mdx.data +++ b/tests/suites/test_suite_mdx.data @@ -61,29 +61,29 @@ md5_text:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789":"d174a md5 Test vector RFC1321 #7 md5_text:"12345678901234567890123456789012345678901234567890123456789012345678901234567890":"57edf4a22be3c955ac49da2e2107b67a" -rmd160 Test vector from paper #1 -rmd160_text:"":"9c1185a5c5e9fc54612808977ee8f548b2258d31" +ripemd160 Test vector from paper #1 +ripemd160_text:"":"9c1185a5c5e9fc54612808977ee8f548b2258d31" -rmd160 Test vector from paper #2 -rmd160_text:"a":"0bdc9d2d256b3ee9daae347be6f4dc835a467ffe" +ripemd160 Test vector from paper #2 +ripemd160_text:"a":"0bdc9d2d256b3ee9daae347be6f4dc835a467ffe" -rmd160 Test vector from paper #3 -rmd160_text:"abc":"8eb208f7e05d987a9b044a8e98c6b087f15a0bfc" +ripemd160 Test vector from paper #3 +ripemd160_text:"abc":"8eb208f7e05d987a9b044a8e98c6b087f15a0bfc" -rmd160 Test vector from paper #4 -rmd160_text:"message digest":"5d0689ef49d2fae572b881b123a85ffa21595f36" +ripemd160 Test vector from paper #4 +ripemd160_text:"message digest":"5d0689ef49d2fae572b881b123a85ffa21595f36" -rmd160 Test vector from paper #5 -rmd160_text:"abcdefghijklmnopqrstuvwxyz":"f71c27109c692c1b56bbdceb5b9d2865b3708dbc" +ripemd160 Test vector from paper #5 +ripemd160_text:"abcdefghijklmnopqrstuvwxyz":"f71c27109c692c1b56bbdceb5b9d2865b3708dbc" -rmd160 Test vector from paper #6 -rmd160_text:"abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq":"12a053384a9c0c88e405a06c27dcf49ada62eb2b" +ripemd160 Test vector from paper #6 +ripemd160_text:"abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq":"12a053384a9c0c88e405a06c27dcf49ada62eb2b" -rmd160 Test vector from paper #7 -rmd160_text:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789":"b0e20b6e3116640286ed3a87a5713079b21f5189" +ripemd160 Test vector from paper #7 +ripemd160_text:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789":"b0e20b6e3116640286ed3a87a5713079b21f5189" -rmd160 Test vector from paper #8 -rmd160_text:"12345678901234567890123456789012345678901234567890123456789012345678901234567890":"9b752e45573d4b39f4dbd3323cab82bf63326bfb" +ripemd160 Test vector from paper #8 +ripemd160_text:"12345678901234567890123456789012345678901234567890123456789012345678901234567890":"9b752e45573d4b39f4dbd3323cab82bf63326bfb" HMAC-MD2 Hash File OpenSSL test #1 md2_hmac:16:"61616161616161616161616161616161":"b91ce5ac77d33c234e61002ed6":"d5732582f494f5ddf35efd166c85af9c" @@ -142,26 +142,26 @@ md4_hmac:16:"0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b":"4869205468657265":"5570c HMAC-MD5 Bouncy Castle test #1 md5_hmac:16:"0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b":"4869205468657265":"5ccec34ea9656392457fa1ac27f08fbc" -HMAC-RMD160 Test vector RFC 2286 #1 -rmd160_hmac:20:"0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b":"4869205468657265":"24cb4bd67d20fc1a5d2ed7732dcc39377f0a5668" +HMAC-RIPEMD160 Test vector RFC 2286 #1 +ripemd160_hmac:20:"0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b":"4869205468657265":"24cb4bd67d20fc1a5d2ed7732dcc39377f0a5668" -HMAC-RMD160 Test vector RFC 2286 #2 -rmd160_hmac:20:"4a656665":"7768617420646f2079612077616e7420666f72206e6f7468696e673f":"dda6c0213a485a9e24f4742064a7f033b43c4069" +HMAC-RIPEMD160 Test vector RFC 2286 #2 +ripemd160_hmac:20:"4a656665":"7768617420646f2079612077616e7420666f72206e6f7468696e673f":"dda6c0213a485a9e24f4742064a7f033b43c4069" -HMAC-RMD160 Test vector RFC 2286 #3 -rmd160_hmac:20:"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa":"dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd":"b0b105360de759960ab4f35298e116e295d8e7c1" +HMAC-RIPEMD160 Test vector RFC 2286 #3 +ripemd160_hmac:20:"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa":"dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd":"b0b105360de759960ab4f35298e116e295d8e7c1" -HMAC-RMD160 Test vector RFC 2286 #4 -rmd160_hmac:20:"0102030405060708090a0b0c0d0e0f10111213141516171819":"cdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcd":"d5ca862f4d21d5e610e18b4cf1beb97a4365ecf4" +HMAC-RIPEMD160 Test vector RFC 2286 #4 +ripemd160_hmac:20:"0102030405060708090a0b0c0d0e0f10111213141516171819":"cdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcd":"d5ca862f4d21d5e610e18b4cf1beb97a4365ecf4" -HMAC-RMD160 Test vector RFC 2286 #5 -rmd160_hmac:20:"0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c":"546573742057697468205472756e636174696f6e":"7619693978f91d90539ae786500ff3d8e0518e39" +HMAC-RIPEMD160 Test vector RFC 2286 #5 +ripemd160_hmac:20:"0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c":"546573742057697468205472756e636174696f6e":"7619693978f91d90539ae786500ff3d8e0518e39" -HMAC-RMD160 Test vector RFC 2286 #6 -rmd160_hmac:20:"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa":"54657374205573696e67204c6172676572205468616e20426c6f636b2d53697a65204b6579202d2048617368204b6579204669727374":"6466ca07ac5eac29e1bd523e5ada7605b791fd8b" +HMAC-RIPEMD160 Test vector RFC 2286 #6 +ripemd160_hmac:20:"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa":"54657374205573696e67204c6172676572205468616e20426c6f636b2d53697a65204b6579202d2048617368204b6579204669727374":"6466ca07ac5eac29e1bd523e5ada7605b791fd8b" -HMAC-RMD160 Test vector RFC 2286 #7 -rmd160_hmac:20:"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa":"54657374205573696e67204c6172676572205468616e20426c6f636b2d53697a65204b657920616e64204c6172676572205468616e204f6e6520426c6f636b2d53697a652044617461":"69ea60798d71616cce5fd0871e23754cd75d5a0a" +HMAC-RIPEMD160 Test vector RFC 2286 #7 +ripemd160_hmac:20:"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa":"54657374205573696e67204c6172676572205468616e20426c6f636b2d53697a65204b657920616e64204c6172676572205468616e204f6e6520426c6f636b2d53697a652044617461":"69ea60798d71616cce5fd0871e23754cd75d5a0a" MD2 Hash file #1 md2_file:"data_files/hash_file_1":"b593c098712d2e21628c8986695451a8" @@ -199,20 +199,20 @@ md5_file:"data_files/hash_file_3":"d945bcc6200ea95d061a2a818167d920" MD5 Hash file #4 md5_file:"data_files/hash_file_4":"d41d8cd98f00b204e9800998ecf8427e" -RMD160 Hash file #0 (from paper) -rmd160_file:"data_files/hash_file_5":"52783243c1697bdbe16d37f97f68f08325dc1528" +RIPEMD160 Hash file #0 (from paper) +ripemd160_file:"data_files/hash_file_5":"52783243c1697bdbe16d37f97f68f08325dc1528" -RMD160 Hash file #1 -rmd160_file:"data_files/hash_file_1":"82f1d072f0ec0c2b353703a7b575a04c113af1a6" +RIPEMD160 Hash file #1 +ripemd160_file:"data_files/hash_file_1":"82f1d072f0ec0c2b353703a7b575a04c113af1a6" -RMD160 Hash file #2 -rmd160_file:"data_files/hash_file_2":"996fbc8b79206ba7393ebcd246584069b1c08f0f" +RIPEMD160 Hash file #2 +ripemd160_file:"data_files/hash_file_2":"996fbc8b79206ba7393ebcd246584069b1c08f0f" -RMD160 Hash file #3 -rmd160_file:"data_files/hash_file_3":"8653b46d65998fa8c8846efa17937e742533ae48" +RIPEMD160 Hash file #3 +ripemd160_file:"data_files/hash_file_3":"8653b46d65998fa8c8846efa17937e742533ae48" -RMD160 Hash file #4 -rmd160_file:"data_files/hash_file_4":"9c1185a5c5e9fc54612808977ee8f548b2258d31" +RIPEMD160 Hash file #4 +ripemd160_file:"data_files/hash_file_4":"9c1185a5c5e9fc54612808977ee8f548b2258d31" MD2 Selftest md2_selftest: @@ -223,5 +223,5 @@ md4_selftest: MD5 Selftest md5_selftest: -RMD160 Selftest -rmd160_selftest: +RIPEMD160 Selftest +ripemd160_selftest: diff --git a/tests/suites/test_suite_mdx.function b/tests/suites/test_suite_mdx.function index 6f43aac2d..6b21b2d20 100644 --- a/tests/suites/test_suite_mdx.function +++ b/tests/suites/test_suite_mdx.function @@ -2,7 +2,7 @@ #include #include #include -#include +#include /* END_HEADER */ /* BEGIN_CASE depends_on:POLARSSL_MD2_C */ @@ -65,8 +65,8 @@ void md5_text( char *text_src_string, char *hex_hash_string ) } /* END_CASE */ -/* BEGIN_CASE depends_on:POLARSSL_RMD160_C */ -void rmd160_text( char *text_src_string, char *hex_hash_string ) +/* BEGIN_CASE depends_on:POLARSSL_RIPEMD160_C */ +void ripemd160_text( char *text_src_string, char *hex_hash_string ) { unsigned char src_str[100]; unsigned char hash_str[41]; @@ -78,7 +78,7 @@ void rmd160_text( char *text_src_string, char *hex_hash_string ) strcpy( (char *) src_str, text_src_string ); - rmd160( src_str, strlen( (char *) src_str ), output ); + ripemd160( src_str, strlen( (char *) src_str ), output ); hexify( hash_str, output, sizeof output ); TEST_ASSERT( strcmp( (char *) hash_str, hex_hash_string ) == 0 ); @@ -160,9 +160,9 @@ void md5_hmac( int trunc_size, char *hex_key_string, char *hex_src_string, } /* END_CASE */ -/* BEGIN_CASE depends_on:POLARSSL_RMD160_C */ -void rmd160_hmac( int trunc_size, char *hex_key_string, char *hex_src_string, - char *hex_hash_string ) +/* BEGIN_CASE depends_on:POLARSSL_RIPEMD160_C */ +void ripemd160_hmac( int trunc_size, char *hex_key_string, char *hex_src_string, + char *hex_hash_string ) { unsigned char src_str[200]; unsigned char key_str[200]; @@ -178,7 +178,7 @@ void rmd160_hmac( int trunc_size, char *hex_key_string, char *hex_src_string, key_len = unhexify( key_str, hex_key_string ); src_len = unhexify( src_str, hex_src_string ); - rmd160_hmac( key_str, key_len, src_str, src_len, output ); + ripemd160_hmac( key_str, key_len, src_str, src_len, output ); hexify( hash_str, output, sizeof output ); TEST_ASSERT( strncmp( (char *) hash_str, hex_hash_string, trunc_size * 2 ) == 0 ); @@ -233,8 +233,8 @@ void md5_file( char *filename, char *hex_hash_string ) } /* END_CASE */ -/* BEGIN_CASE depends_on:POLARSSL_RMD160_C:POLARSSL_FS_IO */ -void rmd160_file( char *filename, char *hex_hash_string ) +/* BEGIN_CASE depends_on:POLARSSL_RIPEMD160_C:POLARSSL_FS_IO */ +void ripemd160_file( char *filename, char *hex_hash_string ) { unsigned char hash_str[41]; unsigned char output[20]; @@ -242,7 +242,7 @@ void rmd160_file( char *filename, char *hex_hash_string ) memset(hash_str, 0x00, sizeof hash_str ); memset(output, 0x00, sizeof output ); - rmd160_file( filename, output); + ripemd160_file( filename, output); hexify( hash_str, output, sizeof output ); TEST_ASSERT( strcmp( (char *) hash_str, hex_hash_string ) == 0 ); @@ -270,9 +270,9 @@ void md5_selftest() } /* END_CASE */ -/* BEGIN_CASE depends_on:POLARSSL_RMD160_C:POLARSSL_SELF_TEST */ -void rmd160_selftest() +/* BEGIN_CASE depends_on:POLARSSL_RIPEMD160_C:POLARSSL_SELF_TEST */ +void ripemd160_selftest() { - TEST_ASSERT( rmd160_self_test( 0 ) == 0 ); + TEST_ASSERT( ripemd160_self_test( 0 ) == 0 ); } /* END_CASE */ diff --git a/visualc/VS2010/PolarSSL.vcxproj b/visualc/VS2010/PolarSSL.vcxproj index 8acfebeda..127d106a6 100644 --- a/visualc/VS2010/PolarSSL.vcxproj +++ b/visualc/VS2010/PolarSSL.vcxproj @@ -184,7 +184,7 @@ - + @@ -246,7 +246,7 @@ - + diff --git a/visualc/VS6/polarssl.dsp b/visualc/VS6/polarssl.dsp index d48fe8f77..645b29c68 100644 --- a/visualc/VS6/polarssl.dsp +++ b/visualc/VS6/polarssl.dsp @@ -261,7 +261,7 @@ SOURCE=..\..\library\pkwrite.c # End Source File # Begin Source File -SOURCE=..\..\library\rmd160.c +SOURCE=..\..\library\ripemd160.c # End Source File # Begin Source File @@ -521,7 +521,7 @@ SOURCE=..\..\include\polarssl\pk.h # End Source File # Begin Source File -SOURCE=..\..\include\polarssl\rmd160.h +SOURCE=..\..\include\polarssl\ripemd160.h # End Source File # Begin Source File