diff options
| author | Bruce Momjian <bruce@momjian.us> | 2005-05-25 21:40:43 +0000 |
|---|---|---|
| committer | Bruce Momjian <bruce@momjian.us> | 2005-05-25 21:40:43 +0000 |
| commit | b492c3acccb3f8c97559ddfc2a25f25953a026d2 (patch) | |
| tree | a9c42aa2bd86a88a849ffaa005766ffe3dee762a /contrib/pgcrypto/crypt-blowfish.c | |
| parent | 13b729ca5267b58005f1ca9c873a86c2b0db3591 (diff) | |
| download | postgresql-b492c3acccb3f8c97559ddfc2a25f25953a026d2.tar.gz | |
Add parentheses to macros when args are used in computations. Without
them, the executation behavior could be unexpected.
Diffstat (limited to 'contrib/pgcrypto/crypt-blowfish.c')
| -rw-r--r-- | contrib/pgcrypto/crypt-blowfish.c | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/contrib/pgcrypto/crypt-blowfish.c b/contrib/pgcrypto/crypt-blowfish.c index ed32da9a7f..a882cf4c87 100644 --- a/contrib/pgcrypto/crypt-blowfish.c +++ b/contrib/pgcrypto/crypt-blowfish.c @@ -452,41 +452,41 @@ BF_swap(BF_word * x, int count) #if BF_SCALE /* Architectures which can shift addresses left by 2 bits with no extra cost */ #define BF_ROUND(L, R, N) \ - tmp1 = L & 0xFF; \ - tmp2 = L >> 8; \ + tmp1 = (L) & 0xFF; \ + tmp2 = (L) >> 8; \ tmp2 &= 0xFF; \ - tmp3 = L >> 16; \ + tmp3 = (L) >> 16; \ tmp3 &= 0xFF; \ - tmp4 = L >> 24; \ + tmp4 = (L) >> 24; \ tmp1 = data.ctx.S[3][tmp1]; \ tmp2 = data.ctx.S[2][tmp2]; \ tmp3 = data.ctx.S[1][tmp3]; \ tmp3 += data.ctx.S[0][tmp4]; \ tmp3 ^= tmp2; \ - R ^= data.ctx.P[N + 1]; \ + (R) ^= data.ctx.P[(N) + 1]; \ tmp3 += tmp1; \ - R ^= tmp3; + (R) ^= tmp3; #else /* Architectures with no complicated addressing modes supported */ #define BF_INDEX(S, i) \ - (*((BF_word *)(((unsigned char *)S) + (i)))) + (*((BF_word *)(((unsigned char *)(S)) + (i)))) #define BF_ROUND(L, R, N) \ - tmp1 = L & 0xFF; \ + tmp1 = (L) & 0xFF; \ tmp1 <<= 2; \ - tmp2 = L >> 6; \ + tmp2 = (L) >> 6; \ tmp2 &= 0x3FC; \ - tmp3 = L >> 14; \ + tmp3 = (L) >> 14; \ tmp3 &= 0x3FC; \ - tmp4 = L >> 22; \ + tmp4 = (L) >> 22; \ tmp4 &= 0x3FC; \ tmp1 = BF_INDEX(data.ctx.S[3], tmp1); \ tmp2 = BF_INDEX(data.ctx.S[2], tmp2); \ tmp3 = BF_INDEX(data.ctx.S[1], tmp3); \ tmp3 += BF_INDEX(data.ctx.S[0], tmp4); \ tmp3 ^= tmp2; \ - R ^= data.ctx.P[N + 1]; \ + (R) ^= data.ctx.P[(N) + 1]; \ tmp3 += tmp1; \ - R ^= tmp3; + (R) ^= tmp3; #endif /* |
