From 9f4c162df13ebbbd38e9505329be4fea9785d551 Mon Sep 17 00:00:00 2001
From: Paul Bakker
Date: Wed, 22 Jan 2014 14:14:26 +0100
Subject: [PATCH] Support alternative implementation for RIPEMD-160
(POLARSSL_RIPEMD160_ALT)
---
include/polarssl/config.h | 1 +
include/polarssl/ripemd160.h | 22 +++++++++++++++++++---
2 files changed, 20 insertions(+), 3 deletions(-)
diff --git a/include/polarssl/config.h b/include/polarssl/config.h
index 4861ee1076..89fd261c5d 100644
--- a/include/polarssl/config.h
+++ b/include/polarssl/config.h
@@ -148,6 +148,7 @@
//#define POLARSSL_MD2_ALT
//#define POLARSSL_MD4_ALT
//#define POLARSSL_MD5_ALT
+//#define POLARSSL_RIPEMD160_ALT
//#define POLARSSL_SHA1_ALT
//#define POLARSSL_SHA256_ALT
//#define POLARSSL_SHA512_ALT
diff --git a/include/polarssl/ripemd160.h b/include/polarssl/ripemd160.h
index 47a73bd9e6..02a92f5aa1 100644
--- a/include/polarssl/ripemd160.h
+++ b/include/polarssl/ripemd160.h
@@ -40,6 +40,10 @@ typedef UINT32 uint32_t;
#define POLARSSL_ERR_RIPEMD160_FILE_IO_ERROR -0x0074 /**< Read/write error in file. */
+#if !defined(POLARSSL_RIPEMD160_ALT)
+// Regular implementation
+//
+
#ifdef __cplusplus
extern "C" {
#endif
@@ -83,6 +87,21 @@ void ripemd160_update( ripemd160_context *ctx,
*/
void ripemd160_finish( ripemd160_context *ctx, unsigned char output[20] );
+/* Internal use */
+void ripemd160_process( ripemd160_context *ctx, const unsigned char data[64] );
+
+#ifdef __cplusplus
+}
+#endif
+
+#else /* POLARSSL_RIPEMD160_ALT */
+#include "ripemd160.h"
+#endif /* POLARSSL_RIPEMD160_ALT */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/**
* \brief Output = RIPEMD-160( input buffer )
*
@@ -160,9 +179,6 @@ void ripemd160_hmac( const unsigned char *key, size_t keylen,
*/
int ripemd160_self_test( int verbose );
-/* Internal use */
-void ripemd160_process( ripemd160_context *ctx, const unsigned char data[64] );
-
#ifdef __cplusplus
}
#endif