diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2015-02-18 22:50:41 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2015-02-18 22:50:41 +0100 |
commit | e0be5c4fbedd3c27ef784807e0981b1085c656bd (patch) | |
tree | da4e98441c873c2f5f3f6932bc38aa455ba71b56 /libavutil/sha.c | |
parent | 80d278a981efed4ad07e603d38c493eafe01ba5d (diff) | |
download | ffmpeg-e0be5c4fbedd3c27ef784807e0981b1085c656bd.tar.gz |
avutil/sha: Protect macro arguments with ()
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavutil/sha.c')
-rw-r--r-- | libavutil/sha.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/libavutil/sha.c b/libavutil/sha.c index 0cf94245a9..9963043fa0 100644 --- a/libavutil/sha.c +++ b/libavutil/sha.c @@ -51,13 +51,13 @@ struct AVSHA *av_sha_alloc(void) /* (R0+R1), R2, R3, R4 are the different operations used in SHA1 */ #define blk0(i) (block[i] = AV_RB32(buffer + 4 * (i))) -#define blk(i) (block[i] = rol(block[i-3] ^ block[i-8] ^ block[i-14] ^ block[i-16], 1)) +#define blk(i) (block[i] = rol(block[(i)-3] ^ block[(i)-8] ^ block[(i)-14] ^ block[(i)-16], 1)) -#define R0(v,w,x,y,z,i) z += ((w&(x^y))^y) + blk0(i) + 0x5A827999 + rol(v, 5); w = rol(w, 30); -#define R1(v,w,x,y,z,i) z += ((w&(x^y))^y) + blk (i) + 0x5A827999 + rol(v, 5); w = rol(w, 30); -#define R2(v,w,x,y,z,i) z += ( w^x ^y) + blk (i) + 0x6ED9EBA1 + rol(v, 5); w = rol(w, 30); -#define R3(v,w,x,y,z,i) z += (((w|x)&y)|(w&x)) + blk (i) + 0x8F1BBCDC + rol(v, 5); w = rol(w, 30); -#define R4(v,w,x,y,z,i) z += ( w^x ^y) + blk (i) + 0xCA62C1D6 + rol(v, 5); w = rol(w, 30); +#define R0(v,w,x,y,z,i) z += (((w)&((x)^(y)))^(y)) + blk0(i) + 0x5A827999 + rol(v, 5); w = rol(w, 30); +#define R1(v,w,x,y,z,i) z += (((w)&((x)^(y)))^(y)) + blk (i) + 0x5A827999 + rol(v, 5); w = rol(w, 30); +#define R2(v,w,x,y,z,i) z += ( (w)^(x) ^(y)) + blk (i) + 0x6ED9EBA1 + rol(v, 5); w = rol(w, 30); +#define R3(v,w,x,y,z,i) z += ((((w)|(x))&(y))|((w)&(x))) + blk (i) + 0x8F1BBCDC + rol(v, 5); w = rol(w, 30); +#define R4(v,w,x,y,z,i) z += ( (w)^(x) ^(y)) + blk (i) + 0xCA62C1D6 + rol(v, 5); w = rol(w, 30); /* Hash a single 512-bit block. This is the core of the algorithm. */ |