Add more missing parentheses around macro parameters
diff --git a/library/md4.c b/library/md4.c
index 41c5d54..828fd42 100644
--- a/library/md4.c
+++ b/library/md4.c
@@ -145,9 +145,9 @@
D = ctx->state[3];
#define F(x, y, z) (((x) & (y)) | ((~(x)) & (z)))
-#define P(a,b,c,d,x,s) \
- do \
- { \
+#define P(a,b,c,d,x,s) \
+ do \
+ { \
(a) += F((b),(c),(d)) + (x); \
(a) = S((a),(s)); \
} while( 0 )
@@ -177,8 +177,8 @@
#define P(a,b,c,d,x,s) \
do \
{ \
- (a) += F(b,c,d) + (x) + 0x5A827999; \
- (a) = S(a,s); \
+ (a) += F((b),(c),(d)) + (x) + 0x5A827999; \
+ (a) = S((a),(s)); \
} while( 0 )
P( A, B, C, D, X[ 0], 3 );
@@ -202,11 +202,11 @@
#undef F
#define F(x,y,z) ((x) ^ (y) ^ (z))
-#define P(a,b,c,d,x,s) \
- do \
- { \
- (a) += F(b,c,d) + (x) + 0x6ED9EBA1; \
- (a) = S(a,s); \
+#define P(a,b,c,d,x,s) \
+ do \
+ { \
+ (a) += F((b),(c),(d)) + (x) + 0x6ED9EBA1; \
+ (a) = S((a),(s)); \
} while( 0 )
P( A, B, C, D, X[ 0], 3 );
diff --git a/library/sha512.c b/library/sha512.c
index efc4acb..bdd20b2 100644
--- a/library/sha512.c
+++ b/library/sha512.c
@@ -225,7 +225,7 @@
SHA512_VALIDATE_RET( (const unsigned char *)data != NULL );
#define SHR(x,n) ((x) >> (n))
-#define ROTR(x,n) (SHR(x,n) | ((x) << (64 - (n))))
+#define ROTR(x,n) (SHR((x),(n)) | ((x) << (64 - (n))))
#define S0(x) (ROTR(x, 1) ^ ROTR(x, 8) ^ SHR(x, 7))
#define S1(x) (ROTR(x,19) ^ ROTR(x,61) ^ SHR(x, 6))
@@ -236,12 +236,12 @@
#define F0(x,y,z) (((x) & (y)) | ((z) & ((x) | (y))))
#define F1(x,y,z) ((z) ^ ((x) & ((y) ^ (z))))
-#define P(a,b,c,d,e,f,g,h,x,K) \
- do \
- { \
+#define P(a,b,c,d,e,f,g,h,x,K) \
+ do \
+ { \
temp1 = (h) + S3(e) + F1((e),(f),(g)) + (K) + (x); \
temp2 = S2(a) + F0((a),(b),(c)); \
- (d) += temp1; (h) = temp1 + temp2; \
+ (d) += temp1; (h) = temp1 + temp2; \
} while( 0 )
for( i = 0; i < 16; i++ )