Commit e4a28f55 authored by Niels Möller's avatar Niels Möller

Use ROTL32 in the ripemd160 code.

parent a7bd5fa7
...@@ -13,6 +13,8 @@ ...@@ -13,6 +13,8 @@
* cast128.c (ROL): Deleted macro. * cast128.c (ROL): Deleted macro.
(F1, F2, F3): Updated to use ROTL32 (reversed order of arguments). (F1, F2, F3): Updated to use ROTL32 (reversed order of arguments).
Also added proper do { ... } while (0) wrappers. Also added proper do { ... } while (0) wrappers.
* ripemd160-compress.c (ROL32): Deleted macro.
(R): Updated to use ROTL32 (reversed order of arguments).
2012-03-30 Niels Möller <nisse@lysator.liu.se> 2012-03-30 Niels Möller <nisse@lysator.liu.se>
......
...@@ -30,12 +30,6 @@ ...@@ -30,12 +30,6 @@
#include "macros.h" #include "macros.h"
/****************
* Rotate the 32 bit unsigned integer X by N bits left
*/
#define ROL32(x,n) ( ((x) << (n)) | ((x) >> (32-(n))) )
/**************** /****************
* Transform the message X which consists of 16 32-bit-words * Transform the message X which consists of 16 32-bit-words
...@@ -76,8 +70,8 @@ _nettle_ripemd160_compress(uint32_t *state, const uint8_t *data) ...@@ -76,8 +70,8 @@ _nettle_ripemd160_compress(uint32_t *state, const uint8_t *data)
#define F3(x,y,z) ( ((x) & (z)) | ((y) & ~(z)) ) #define F3(x,y,z) ( ((x) & (z)) | ((y) & ~(z)) )
#define F4(x,y,z) ( (x) ^ ((y) | ~(z)) ) #define F4(x,y,z) ( (x) ^ ((y) | ~(z)) )
#define R(a,b,c,d,e,f,k,r,s) do { t = a + f(b,c,d) + k + x[r]; \ #define R(a,b,c,d,e,f,k,r,s) do { t = a + f(b,c,d) + k + x[r]; \
a = ROL32(t,s) + e; \ a = ROTL32(s,t) + e; \
c = ROL32(c,10); \ c = ROTL32(10,c); \
} while(0) } while(0)
/* left lane */ /* left lane */
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment