diff options
author | Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> | 2012-01-17 10:34:20 +0100 |
---|---|---|
committer | Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> | 2012-01-18 08:05:52 +0100 |
commit | e55d06752f03b0baea58e2a93afd179eb21afba3 (patch) | |
tree | d2a4139f4b1e752fef9bfa9de18c2acc32f5ca7d | |
parent | a4421e60526d3420a9c0bd55bfa4a25a746cbc8e (diff) |
tests: silence warnings in crypt
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
-rw-r--r-- | test/crypt/crypt.c | 76 |
1 files changed, 33 insertions, 43 deletions
diff --git a/test/crypt/crypt.c b/test/crypt/crypt.c index 34d7e4158..786464710 100644 --- a/test/crypt/crypt.c +++ b/test/crypt/crypt.c @@ -10,18 +10,10 @@ #include <stdlib.h> #include "crypt.h" -int totfails = 0; - -#if __STDC__ - 0 -int main (int argc, char *argv[]); -void get8 (char *cp); -void put8 (char *cp); -void good_bye (void) __attribute__ ((noreturn)); -#else -void get8(), put8(); -#endif - -void good_bye () +static int totfails = 0; + +static void good_bye (void) __attribute__ ((noreturn)); +static void good_bye (void) { if(totfails == 0) { printf("Passed DES validation suite\n"); @@ -32,10 +24,33 @@ void good_bye () } } -int -main(argc, argv) - int argc; - char *argv[]; +static void get8(char *cp) +{ + int i,j,t; + + for(i=0;i<8;i++){ + scanf("%2x",&t); + if(feof(stdin)) + good_bye(); + for(j=0; j<8 ; j++) { + *cp++ = (t & (0x01 << (7-j))) != 0; + } + } +} + +static void put8(char *cp) +{ + int i,j,t; + + for(i=0;i<8;i++){ + t = 0; + for(j = 0; j<8; j++) + t = (t<<1) | *cp++; + printf("%02x", t); + } +} + +int main(void) { char key[64],plain[64],cipher[64],answer[64]; int i; @@ -58,9 +73,10 @@ main(argc, argv) cipher[i] = plain[i]; encrypt(cipher, 0); - for(i=0;i<64;i++) + for(i=0;i<64;i++) { if(cipher[i] != answer[i]) break; + } fail = 0; if(i != 64){ printf(" Encrypt FAIL"); @@ -83,31 +99,5 @@ main(argc, argv) } good_bye(); } -void -get8(cp) -char *cp; -{ - int i,j,t; - for(i=0;i<8;i++){ - scanf("%2x",&t); - if(feof(stdin)) - good_bye(); - for(j=0; j<8 ; j++) { - *cp++ = (t & (0x01 << (7-j))) != 0; - } - } -} -void -put8(cp) -char *cp; -{ - int i,j,t; - for(i=0;i<8;i++){ - t = 0; - for(j = 0; j<8; j++) - t = (t<<1) | *cp++; - printf("%02x", t); - } -} |