1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* missing/crypt.c: parenthesize macro arguments.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30735 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
akr 2011-01-30 08:20:20 +00:00
parent ce00071053
commit 627e79f13f
2 changed files with 43 additions and 39 deletions

View file

@ -1,3 +1,7 @@
Sun Jan 30 17:19:46 2011 Tanaka Akira <akr@fsij.org>
* missing/crypt.c: parenthesize macro arguments.
Sun Jan 30 16:40:27 2011 Nobuyoshi Nakada <nobu@ruby-lang.org> Sun Jan 30 16:40:27 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
* test/rubygems/test_gem_security.rb (TestGemSecurity): valid only * test/rubygems/test_gem_security.rb (TestGemSecurity): valid only

View file

@ -258,21 +258,21 @@ typedef union {
*/ */
#define TO_SIX_BIT(rslt, src) { \ #define TO_SIX_BIT(rslt, src) { \
C_block cvt; \ C_block cvt; \
cvt.b[0] = (unsigned char)src; src >>= 6; \ cvt.b[0] = (unsigned char)(src); (src) >>= 6; \
cvt.b[1] = (unsigned char)src; src >>= 6; \ cvt.b[1] = (unsigned char)(src); (src) >>= 6; \
cvt.b[2] = (unsigned char)src; src >>= 6; \ cvt.b[2] = (unsigned char)(src); (src) >>= 6; \
cvt.b[3] = (unsigned char)src; \ cvt.b[3] = (unsigned char)(src); \
rslt = (cvt.b32.i0 & 0x3f3f3f3fL) << 2; \ (rslt) = (cvt.b32.i0 & 0x3f3f3f3fL) << 2; \
} }
/* /*
* These macros may someday permit efficient use of 64-bit integers. * These macros may someday permit efficient use of 64-bit integers.
*/ */
#define ZERO(d,d0,d1) d0 = 0, d1 = 0 #define ZERO(d,d0,d1) ((d0) = 0, (d1) = 0)
#define LOAD(d,d0,d1,bl) d0 = (bl).b32.i0, d1 = (bl).b32.i1 #define LOAD(d,d0,d1,bl) ((d0) = (bl).b32.i0, (d1) = (bl).b32.i1)
#define LOADREG(d,d0,d1,s,s0,s1) d0 = s0, d1 = s1 #define LOADREG(d,d0,d1,s,s0,s1) ((d0) = (s0), (d1) = (s1))
#define OR(d,d0,d1,bl) d0 |= (bl).b32.i0, d1 |= (bl).b32.i1 #define OR(d,d0,d1,bl) ((d0) |= (bl).b32.i0, (d1) |= (bl).b32.i1)
#define STORE(s,s0,s1,bl) (bl).b32.i0 = s0, (bl).b32.i1 = s1 #define STORE(s,s0,s1,bl) ((bl).b32.i0 = (s0), (bl).b32.i1 = (s1))
#define DCL_BLOCK(d,d0,d1) long d0, d1 #define DCL_BLOCK(d,d0,d1) long d0, d1
#if defined(LARGEDATA) #if defined(LARGEDATA)
@ -280,27 +280,27 @@ typedef union {
#define LGCHUNKBITS 3 #define LGCHUNKBITS 3
#define CHUNKBITS (1<<LGCHUNKBITS) #define CHUNKBITS (1<<LGCHUNKBITS)
#define PERM6464(d,d0,d1,cpp,p) \ #define PERM6464(d,d0,d1,cpp,p) \
LOAD(d,d0,d1,(p)[(0<<CHUNKBITS)+(cpp)[0]]); \ LOAD((d),(d0),(d1),(p)[(0<<CHUNKBITS)+(cpp)[0]]); \
OR (d,d0,d1,(p)[(1<<CHUNKBITS)+(cpp)[1]]); \ OR ((d),(d0),(d1),(p)[(1<<CHUNKBITS)+(cpp)[1]]); \
OR (d,d0,d1,(p)[(2<<CHUNKBITS)+(cpp)[2]]); \ OR ((d),(d0),(d1),(p)[(2<<CHUNKBITS)+(cpp)[2]]); \
OR (d,d0,d1,(p)[(3<<CHUNKBITS)+(cpp)[3]]); \ OR ((d),(d0),(d1),(p)[(3<<CHUNKBITS)+(cpp)[3]]); \
OR (d,d0,d1,(p)[(4<<CHUNKBITS)+(cpp)[4]]); \ OR (d),(d0),(d1),(p)[(4<<CHUNKBITS)+(cpp)[4]]); \
OR (d,d0,d1,(p)[(5<<CHUNKBITS)+(cpp)[5]]); \ OR (d),(d0),(d1),(p)[(5<<CHUNKBITS)+(cpp)[5]]); \
OR (d,d0,d1,(p)[(6<<CHUNKBITS)+(cpp)[6]]); \ OR (d),(d0),(d1),(p)[(6<<CHUNKBITS)+(cpp)[6]]); \
OR (d,d0,d1,(p)[(7<<CHUNKBITS)+(cpp)[7]]); OR (d),(d0),(d1),(p)[(7<<CHUNKBITS)+(cpp)[7]]);
#define PERM3264(d,d0,d1,cpp,p) \ #define PERM3264(d,d0,d1,cpp,p) \
LOAD(d,d0,d1,(p)[(0<<CHUNKBITS)+(cpp)[0]]); \ LOAD((d),(d0),(d1),(p)[(0<<CHUNKBITS)+(cpp)[0]]); \
OR (d,d0,d1,(p)[(1<<CHUNKBITS)+(cpp)[1]]); \ OR ((d),(d0),(d1),(p)[(1<<CHUNKBITS)+(cpp)[1]]); \
OR (d,d0,d1,(p)[(2<<CHUNKBITS)+(cpp)[2]]); \ OR ((d),(d0),(d1),(p)[(2<<CHUNKBITS)+(cpp)[2]]); \
OR (d,d0,d1,(p)[(3<<CHUNKBITS)+(cpp)[3]]); OR ((d),(d0),(d1),(p)[(3<<CHUNKBITS)+(cpp)[3]]);
#else #else
/* "small data" */ /* "small data" */
#define LGCHUNKBITS 2 #define LGCHUNKBITS 2
#define CHUNKBITS (1<<LGCHUNKBITS) #define CHUNKBITS (1<<LGCHUNKBITS)
#define PERM6464(d,d0,d1,cpp,p) \ #define PERM6464(d,d0,d1,cpp,p) \
{ C_block tblk; permute(cpp,&tblk,p,8); LOAD (d,d0,d1,tblk); } { C_block tblk; permute((cpp),&tblk,(p),8); LOAD ((d),(d0),(d1),tblk); }
#define PERM3264(d,d0,d1,cpp,p) \ #define PERM3264(d,d0,d1,cpp,p) \
{ C_block tblk; permute(cpp,&tblk,p,4); LOAD (d,d0,d1,tblk); } { C_block tblk; permute((cpp),&tblk,(p),4); LOAD ((d),(d0),(d1),tblk); }
STATIC void STATIC void
permute(cp, out, p, chars_in) permute(cp, out, p, chars_in)
@ -694,34 +694,34 @@ des_cipher(in, out, salt, num_iter)
loop_count = 8; loop_count = 8;
do { do {
#define SPTAB(t, i) (*(long *)((unsigned char *)t + i*(sizeof(long)/4))) #define SPTAB(t, i) (*(long *)((unsigned char *)(t) + (i)*(sizeof(long)/4)))
#if defined(gould) #if defined(gould)
/* use this if B.b[i] is evaluated just once ... */ /* use this if B.b[i] is evaluated just once ... */
#define DOXOR(x,y,i) x^=SPTAB(SPE[0][i],B.b[i]); y^=SPTAB(SPE[1][i],B.b[i]); #define DOXOR(x,y,i) (x)^=SPTAB(SPE[0][(i)],B.b[(i)]); (y)^=SPTAB(SPE[1][(i)],B.b[(i)]);
#else #else
#if defined(pdp11) #if defined(pdp11)
/* use this if your "long" int indexing is slow */ /* use this if your "long" int indexing is slow */
#define DOXOR(x,y,i) j=B.b[i]; x^=SPTAB(SPE[0][i],j); y^=SPTAB(SPE[1][i],j); #define DOXOR(x,y,i) j=B.b[(i)]; (x)^=SPTAB(SPE[0][(i)],j); (y)^=SPTAB(SPE[1][(i)],j);
#else #else
/* use this if "k" is allocated to a register ... */ /* use this if "k" is allocated to a register ... */
#define DOXOR(x,y,i) k=B.b[i]; x^=SPTAB(SPE[0][i],k); y^=SPTAB(SPE[1][i],k); #define DOXOR(x,y,i) k=B.b[(i)]; (x)^=SPTAB(SPE[0][(i)],k); (y)^=SPTAB(SPE[1][(i)],k);
#endif #endif
#endif #endif
#define CRUNCH(p0, p1, q0, q1) \ #define CRUNCH(p0, p1, q0, q1) \
k = (q0 ^ q1) & SALT; \ k = ((q0) ^ (q1)) & SALT; \
B.b32.i0 = k ^ q0 ^ kp->b32.i0; \ B.b32.i0 = k ^ (q0) ^ kp->b32.i0; \
B.b32.i1 = k ^ q1 ^ kp->b32.i1; \ B.b32.i1 = k ^ (q1) ^ kp->b32.i1; \
kp = (C_block *)((char *)kp+ks_inc); \ kp = (C_block *)((char *)kp+ks_inc); \
\ \
DOXOR(p0, p1, 0); \ DOXOR((p0), (p1), 0); \
DOXOR(p0, p1, 1); \ DOXOR((p0), (p1), 1); \
DOXOR(p0, p1, 2); \ DOXOR((p0), (p1), 2); \
DOXOR(p0, p1, 3); \ DOXOR((p0), (p1), 3); \
DOXOR(p0, p1, 4); \ DOXOR((p0), (p1), 4); \
DOXOR(p0, p1, 5); \ DOXOR((p0), (p1), 5); \
DOXOR(p0, p1, 6); \ DOXOR((p0), (p1), 6); \
DOXOR(p0, p1, 7); DOXOR((p0), (p1), 7);
CRUNCH(L0, L1, R0, R1); CRUNCH(L0, L1, R0, R1);
CRUNCH(R0, R1, L0, L1); CRUNCH(R0, R1, L0, L1);