a72ddc1424
This automatically-generated patch converts 24 function definitions in glibc from old-style K&R to prototype-style. Following my other recent such patches, this one deals with the case of functions with array parameters. Tested for x86_64 and x86 (testsuite, and that installed stripped shared libraries are unchanged by the patch). * crypt/cert.c (main): Convert to prototype-style function definition. * io/pipe.c (__pipe): Likewise. * io/pipe2.c (__pipe2): Likewise. * misc/futimesat.c (futimesat): Likewise. * misc/utimes.c (__utimes): Likewise. * posix/execve.c (__execve): Likewise. * posix/execvp.c (execvp): Likewise. * posix/execvpe.c (__execvpe): Likewise. * posix/fexecve.c (fexecve): Likewise. * socket/socketpair.c (socketpair): Likewise. * stdlib/drand48-iter.c (__drand48_iterate): Likewise. * stdlib/erand48.c (erand48): Likewise. * stdlib/erand48_r.c (__erand48_r): Likewise. * stdlib/jrand48.c (jrand48): Likewise. * stdlib/jrand48_r.c (__jrand48_r): Likewise. * stdlib/lcong48.c (lcong48): Likewise. * stdlib/lcong48_r.c (__lcong48_r): Likewise. * stdlib/nrand48.c (nrand48): Likewise. * stdlib/nrand48_r.c (__nrand48_r): Likewise. * stdlib/seed48.c (seed48): Likewise. * stdlib/seed48_r.c (__seed48_r): Likewise. * sysdeps/mach/hurd/execve.c (__execve): Likewise. * sysdeps/mach/hurd/utimes.c (__utimes): Likewise. * sysdeps/unix/sysv/linux/fexecve.c (fexecve): Likewise.
107 lines
1.6 KiB
C
107 lines
1.6 KiB
C
|
|
/*
|
|
* This crypt(3) validation program shipped with UFC-crypt
|
|
* is derived from one distributed with Phil Karns PD DES package.
|
|
*
|
|
* @(#)cert.c 1.8 11 Aug 1996
|
|
*/
|
|
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include "crypt.h"
|
|
|
|
int totfails = 0;
|
|
|
|
int main (int argc, char *argv[]);
|
|
void get8 (char *cp);
|
|
void put8 (char *cp);
|
|
void good_bye (void) __attribute__ ((noreturn));
|
|
|
|
void
|
|
good_bye (void)
|
|
{
|
|
if(totfails == 0) {
|
|
printf("Passed DES validation suite\n");
|
|
exit(0);
|
|
} else {
|
|
printf("%d failures during DES validation suite!!!\n", totfails);
|
|
exit(1);
|
|
}
|
|
}
|
|
|
|
int
|
|
main (int argc, char *argv[])
|
|
{
|
|
char key[64],plain[64],cipher[64],answer[64];
|
|
int i;
|
|
int test;
|
|
int fail;
|
|
|
|
for(test=0;!feof(stdin);test++){
|
|
|
|
get8(key);
|
|
printf(" K: "); put8(key);
|
|
setkey(key);
|
|
|
|
get8(plain);
|
|
printf(" P: "); put8(plain);
|
|
|
|
get8(answer);
|
|
printf(" C: "); put8(answer);
|
|
|
|
for(i=0;i<64;i++)
|
|
cipher[i] = plain[i];
|
|
encrypt(cipher, 0);
|
|
|
|
for(i=0;i<64;i++)
|
|
if(cipher[i] != answer[i])
|
|
break;
|
|
fail = 0;
|
|
if(i != 64){
|
|
printf(" Encrypt FAIL");
|
|
fail++; totfails++;
|
|
}
|
|
|
|
encrypt(cipher, 1);
|
|
|
|
for(i=0;i<64;i++)
|
|
if(cipher[i] != plain[i])
|
|
break;
|
|
if(i != 64){
|
|
printf(" Decrypt FAIL");
|
|
fail++; totfails++;
|
|
}
|
|
|
|
if(fail == 0)
|
|
printf(" OK");
|
|
printf("\n");
|
|
}
|
|
good_bye();
|
|
}
|
|
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;
|
|
}
|
|
}
|
|
}
|
|
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);
|
|
}
|
|
}
|