ruby-changes:44364
From: nagachika <ko1@a...>
Date: Tue, 18 Oct 2016 02:23:50 +0900 (JST)
Subject: [ruby-changes:44364] nagachika:r56437 (ruby_2_3): merge revision(s) 55232: [Backport #12823]
nagachika 2016-10-18 02:23:32 +0900 (Tue, 18 Oct 2016) New Revision: 56437 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=56437 Log: merge revision(s) 55232: [Backport #12823] crypt.c: protoize * missing/crypt.c: protoize function definitions and make always-zero functions void. Modified directories: branches/ruby_2_3/ Modified files: branches/ruby_2_3/missing/crypt.c branches/ruby_2_3/version.h Index: ruby_2_3/version.h =================================================================== --- ruby_2_3/version.h (revision 56436) +++ ruby_2_3/version.h (revision 56437) @@ -1,10 +1,10 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_3/version.h#L1 #define RUBY_VERSION "2.3.2" -#define RUBY_RELEASE_DATE "2016-10-12" -#define RUBY_PATCHLEVEL 195 +#define RUBY_RELEASE_DATE "2016-10-18" +#define RUBY_PATCHLEVEL 196 #define RUBY_RELEASE_YEAR 2016 #define RUBY_RELEASE_MONTH 10 -#define RUBY_RELEASE_DAY 12 +#define RUBY_RELEASE_DAY 18 #include "ruby/version.h" Index: ruby_2_3/missing/crypt.c =================================================================== --- ruby_2_3/missing/crypt.c (revision 56436) +++ ruby_2_3/missing/crypt.c (revision 56437) @@ -107,16 +107,13 @@ static char sccsid[] = "@(#)crypt.c 8.1 https://github.com/ruby/ruby/blob/trunk/ruby_2_3/missing/crypt.c#L107 #define LARGEDATA #endif -int des_setkey(), des_cipher(); +void des_setkey(const char *key); +void des_cipher(const char *in, char *out, long salt, int num_iter); /* compile with "-DSTATIC=int" when profiling */ #ifndef STATIC #define STATIC static #endif -STATIC void init_des(), init_perm(), permute(); -#ifdef DEBUG -STATIC void prtab(); -#endif /* ==================================== */ @@ -302,11 +299,7 @@ typedef union { https://github.com/ruby/ruby/blob/trunk/ruby_2_3/missing/crypt.c#L299 { C_block tblk; permute((cpp),&tblk,(p),4); LOAD ((d),(d0),(d1),tblk); } STATIC void -permute(cp, out, p, chars_in) - unsigned char *cp; - C_block *out; - register C_block *p; - int chars_in; +permute(unsigned char *cp, C_block *out, register C_block *p, int chars_in) { register DCL_BLOCK(D,D0,D1); register C_block *tp; @@ -322,6 +315,12 @@ permute(cp, out, p, chars_in) https://github.com/ruby/ruby/blob/trunk/ruby_2_3/missing/crypt.c#L315 } #endif /* LARGEDATA */ +STATIC void init_des(void); +STATIC void init_perm(C_block perm[64/CHUNKBITS][1<<CHUNKBITS], unsigned char p[64], int chars_in, int chars_out); + +#ifdef DEBUG +STATIC void prtab(const char *s, const unsigned char *t, int num_rows); +#endif /* ===== (mostly) Standard DES Tables ==================== */ @@ -496,9 +495,7 @@ static char cryptresult[1+4+4+11+1]; /* https://github.com/ruby/ruby/blob/trunk/ruby_2_3/missing/crypt.c#L495 * followed by an encryption produced by the "key" and "setting". */ char * -crypt(key, setting) - register const char *key; - register const char *setting; +crypt(const char *key, const char *setting) { register char *encp; register long i; @@ -512,8 +509,7 @@ crypt(key, setting) https://github.com/ruby/ruby/blob/trunk/ruby_2_3/missing/crypt.c#L509 key++; keyblock.b[i] = t; } - if (des_setkey((char *)keyblock.b)) /* also initializes "a64toi" */ - return (NULL); + des_setkey((char *)keyblock.b); /* also initializes "a64toi" */ encp = &cryptresult[0]; switch (*setting) { @@ -522,16 +518,14 @@ crypt(key, setting) https://github.com/ruby/ruby/blob/trunk/ruby_2_3/missing/crypt.c#L518 * Involve the rest of the password 8 characters at a time. */ while (*key) { - if (des_cipher((char *)&keyblock, - (char *)&keyblock, 0L, 1)) - return (NULL); + des_cipher((char *)&keyblock, + (char *)&keyblock, 0L, 1); for (i = 0; i < 8; i++) { if ((t = 2*(unsigned char)(*key)) != 0) key++; keyblock.b[i] ^= t; } - if (des_setkey((char *)keyblock.b)) - return (NULL); + des_setkey((char *)keyblock.b); } *encp++ = *setting++; @@ -561,9 +555,8 @@ crypt(key, setting) https://github.com/ruby/ruby/blob/trunk/ruby_2_3/missing/crypt.c#L555 salt = (salt<<6) | a64toi[t]; } encp += salt_size; - if (des_cipher((char *)&constdatablock, (char *)&rsltblock, - salt, num_iter)) - return (NULL); + des_cipher((char *)&constdatablock, (char *)&rsltblock, + salt, num_iter); /* * Encode the 64 cipher bits as 11 ascii characters. @@ -598,9 +591,8 @@ static C_block KS[KS_SIZE]; https://github.com/ruby/ruby/blob/trunk/ruby_2_3/missing/crypt.c#L591 /* * Set up the key schedule from the key. */ -int -des_setkey(key) - register const char *key; +void +des_setkey(const char *key) { register DCL_BLOCK(K, K0, K1); register C_block *ptabp; @@ -622,7 +614,6 @@ des_setkey(key) https://github.com/ruby/ruby/blob/trunk/ruby_2_3/missing/crypt.c#L614 PERM6464(K,K0,K1,(unsigned char *)key,ptabp); STORE(K&~0x03030303L, K0&~0x03030303L, K1, *(C_block *)key); } - return (0); } /* @@ -633,12 +624,8 @@ des_setkey(key) https://github.com/ruby/ruby/blob/trunk/ruby_2_3/missing/crypt.c#L624 * NOTE: the performance of this routine is critically dependent on your * compiler and machine architecture. */ -int -des_cipher(in, out, salt, num_iter) - const char *in; - char *out; - long salt; - int num_iter; +void +des_cipher(const char *in, char *out, long salt, int num_iter) { /* variables that we want in registers, most important first */ #if defined(pdp11) @@ -746,7 +733,6 @@ des_cipher(in, out, salt, num_iter) https://github.com/ruby/ruby/blob/trunk/ruby_2_3/missing/crypt.c#L733 #else STORE(L,L0,L1,*(C_block *)out); #endif - return (0); } @@ -755,7 +741,7 @@ des_cipher(in, out, salt, num_iter) https://github.com/ruby/ruby/blob/trunk/ruby_2_3/missing/crypt.c#L741 * done at compile time, if the compiler were capable of that sort of thing. */ STATIC void -init_des() +init_des(void) { register int i, j; register long k; @@ -899,10 +885,8 @@ init_des() https://github.com/ruby/ruby/blob/trunk/ruby_2_3/missing/crypt.c#L885 * "perm" must be all-zeroes on entry to this routine. */ STATIC void -init_perm(perm, p, chars_in, chars_out) - C_block perm[64/CHUNKBITS][1<<CHUNKBITS]; - unsigned char p[64]; - int chars_in, chars_out; +init_perm(C_block perm[64/CHUNKBITS][1<<CHUNKBITS], + unsigned char p[64], int chars_in, int chars_out) { register int i, j, k, l; @@ -922,9 +906,8 @@ init_perm(perm, p, chars_in, chars_out) https://github.com/ruby/ruby/blob/trunk/ruby_2_3/missing/crypt.c#L906 /* * "setkey" routine (for backwards compatibility) */ -int -setkey(key) - register const char *key; +void +setkey(const char *key) { register int i, j, k; C_block keyblock; @@ -937,16 +920,14 @@ setkey(key) https://github.com/ruby/ruby/blob/trunk/ruby_2_3/missing/crypt.c#L920 } keyblock.b[i] = k; } - return (des_setkey((char *)keyblock.b)); + des_setkey((char *)keyblock.b); } /* * "encrypt" routine (for backwards compatibility) */ -int -encrypt(block, flag) - register char *block; - int flag; +void +encrypt(char *block, int flag) { register int i, j, k; C_block cblock; @@ -959,8 +940,7 @@ encrypt(block, flag) https://github.com/ruby/ruby/blob/trunk/ruby_2_3/missing/crypt.c#L940 } cblock.b[i] = k; } - if (des_cipher((char *)&cblock, (char *)&cblock, 0L, (flag ? -1: 1))) - return (1); + des_cipher((char *)&cblock, (char *)&cblock, 0L, (flag ? -1: 1)); for (i = 7; i >= 0; i--) { k = cblock.b[i]; for (j = 7; j >= 0; j--) { @@ -968,15 +948,11 @@ encrypt(block, flag) https://github.com/ruby/ruby/blob/trunk/ruby_2_3/missing/crypt.c#L948 k >>= 1; } } - return (0); } #ifdef DEBUG STATIC void -prtab(s, t, num_rows) - char *s; - unsigned char *t; - int num_rows; +prtab(const char *s, const unsigned char *t, int num_rows) { register int i, j; Property changes on: ruby_2_3 ___________________________________________________________________ Modified: svn:mergeinfo Merged /trunk:r55232 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/