[PATCH] rmd160: restore native-endian store in _gcry_rmd160_mixblock

Jussi Kivilinna jussi.kivilinna at iki.fi
Sat Jan 3 19:21:29 CET 2015


* cipher/rmd160.c (_gcry_rmd160_mixblock): Store result to buffer in
native-endianess.
--

Commit 4515315f61fbf79413e150fbd1d5f5a2435f2bc5 unintendedly changed this
native-endian store to little-endian.

Reported-by: Yuriy Kaminskiy <yumkam at gmail.com>
Signed-off-by: Jussi Kivilinna <jussi.kivilinna at iki.fi>
---
 cipher/rmd160.c |    7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/cipher/rmd160.c b/cipher/rmd160.c
index 2b1f321..2695db2 100644
--- a/cipher/rmd160.c
+++ b/cipher/rmd160.c
@@ -403,15 +403,16 @@ transform ( void *c, const unsigned char *data, size_t nblks )
  * Apply the rmd160 transform function on the buffer which must have
  * a length 64 bytes. Do not use this function together with the
  * other functions, use rmd160_init to initialize internal variables.
- * Returns: 16 bytes in buffer with the mixed contentes of buffer.
+ * Buffer must be 32-bit aligned.
+ * Returns: 20 bytes in buffer with the mixed contents of buffer.
  */
 void
 _gcry_rmd160_mixblock ( RMD160_CONTEXT *hd, void *blockof64byte )
 {
-  char *p = blockof64byte;
+  u32 *p = blockof64byte;
 
   transform ( hd, blockof64byte, 1 );
-#define X(a) do { buf_put_le32(p, hd->h##a); p += 4; } while(0)
+#define X(a) do { p[a] = hd->h##a; } while(0)
   X(0);
   X(1);
   X(2);




More information about the Gcrypt-devel mailing list