diff options
Diffstat (limited to 'secure/lib/libcipher/test')
-rw-r--r-- | secure/lib/libcipher/test/Makefile | 56 | ||||
-rw-r--r-- | secure/lib/libcipher/test/README | 10 | ||||
-rw-r--r-- | secure/lib/libcipher/test/cert.c | 344 | ||||
-rw-r--r-- | secure/lib/libcipher/test/cert.input | 179 | ||||
-rw-r--r-- | secure/lib/libcipher/test/speedcrypt.c | 76 | ||||
-rw-r--r-- | secure/lib/libcipher/test/speeddes.c | 61 |
6 files changed, 0 insertions, 726 deletions
diff --git a/secure/lib/libcipher/test/Makefile b/secure/lib/libcipher/test/Makefile deleted file mode 100644 index dcbf1c7735302..0000000000000 --- a/secure/lib/libcipher/test/Makefile +++ /dev/null @@ -1,56 +0,0 @@ -# -# Hacked Makefile to compile and run the DES-certification program, -# but not install anything. -# -# $Id$ -# -LIBCRYPT!=cd $(.CURDIR)/..; \ - printf "xxx:\n\techo \$${.OBJDIR}/libcipher.a\n" | make -r -s -f - xxx - -#CFLAGS+= -DHAVE_CRYPT16 -LIBCRYPT+= -lcrypt - -TARGETS=cert speedcrypt speeddes - -all: ${TARGETS} - -test: all testcrypt testencrypt testdes testspeed - -testcrypt: cert - @./cert -c - -testencrypt: cert - @./cert -e < ${.CURDIR}/cert.input - -testdes: cert - @./cert -d < ${.CURDIR}/cert.input - -testspeed: cryptspeed desspeed - -cryptspeed: speedcrypt - @./speedcrypt 30 1 - @./speedcrypt 30 1 - @./speedcrypt 30 0 - @./speedcrypt 30 0 - -desspeed: speeddes - @./speeddes 30 1 - @./speeddes 30 1 - @./speeddes 40 25 - @./speeddes 40 25 - -cert: cert.c ${LIBCRYPT} - $(CC) $(CFLAGS) -o cert ${.CURDIR}/cert.c ${LIBCRYPT} - -speedcrypt: speedcrypt.c ${LIBCRYPT} - $(CC) $(CFLAGS) -o speedcrypt ${.CURDIR}/speedcrypt.c ${LIBCRYPT} - -speeddes: speeddes.c ${LIBCRYPT} - $(CC) $(CFLAGS) -o speeddes ${.CURDIR}/speeddes.c ${LIBCRYPT} - -clean: - rm -f ${TARGETS} - -install: - -.include <bsd.prog.mk> diff --git a/secure/lib/libcipher/test/README b/secure/lib/libcipher/test/README deleted file mode 100644 index eb6b0bebbc1de..0000000000000 --- a/secure/lib/libcipher/test/README +++ /dev/null @@ -1,10 +0,0 @@ -This directory contains test programs to certify DES operation and to -time the crypt() call (of curiosity value). - -Simply type `make test` to run the tests. - -The normal `make all` and `make install` that get done during library building -and installation will build these programs BUT NOT INSTALL THEM. After all, -they're only for testing... - -- David Burren, January 1994 diff --git a/secure/lib/libcipher/test/cert.c b/secure/lib/libcipher/test/cert.c deleted file mode 100644 index 56dc88aebf821..0000000000000 --- a/secure/lib/libcipher/test/cert.c +++ /dev/null @@ -1,344 +0,0 @@ -/* - * This DES validation program shipped with FreeSec is derived from that - * shipped with UFC-crypt which is apparently derived from one distributed - * with Phil Karns PD DES package. - * - * $Id$ - */ - -#include <stdio.h> - -int totfails = 0; - -char *crypt(); -#ifdef HAVE_CRYPT16 -char *crypt16(); -#endif /* HAVE_CRYPT16 */ - - -static struct crypt_test { - char *key, *setting, *answer; -} crypt_tests[] = { - "foob", "ar", "arlEKn0OzVJn.", - "holyhooplasbatman!", "_X.......", "_X.......N89y2Z.e4WU", - "holyhooplasbatman!", "_X...X...", "_X...X...rSUDQ5Na/QM", - "holyhooplasbatman!", "_XX..X...", "_XX..X...P8vb9xU4JAk", - "holyhooplasbatman!", "_XX..XX..", "_XX..XX..JDs5IlGLqT2", - "holyhooplasbatman!", "_XX..XXa.", "_XX..XXa.bFVsOnCNh8Y", - "holyhooplasbatman!", "_XXa.X...", "_XXa.X...Ghsb3QKNaps", -#ifdef TAKES_TOO_LONG_ON_SOME_CRYPTS - "holyhooplasbatman!", "_arararar", "_ararararNGMzvpNjeCc", -#endif - NULL, NULL, NULL, -}; - - -static struct crypt_test crypt16_tests[] = { - "foob", "ar", "arxo23jZDD5AYbHbqoy9Dalg", - "holyhooplasbatman!", "ar", "arU5FRLJ3kxIoedlmyrOelEw", - NULL, NULL, NULL -}; - - -void good_bye() -{ - if(totfails == 0) { - printf(" Passed validation\n"); - exit(0); - } else { - printf(" %d failures during validation!!!\n", totfails); - exit(1); - } -} - - -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); - } -} - - -void print_bits(bits) -unsigned char *bits; -{ - int i; - - for (i = 0; i < 8; i++) { - printf("%02x", bits[i]); - } -} - - -int parse_line(buff, salt, key, plain, answer) -char *buff; -long *salt; -char *key, *plain, *answer; -{ - char *ptr1, *ptr2; - int val; - int i,j,t; - - /* - * Extract salt - */ - if (sscanf(buff, "%lu", salt) != 1) - return(-1); - for (ptr2 = buff; *ptr2 && !isspace(*ptr2); ptr2++) - ; - - /* - * Extract key - */ - for (ptr1 = ptr2; *ptr1 && isspace(*ptr1); ptr1++) - ; - for (ptr2 = ptr1; *ptr2 && !isspace(*ptr2); ptr2++) - ; - if (ptr2 - ptr1 != 16) - return(-1); - for (i = 0; i < 8; i++){ - if (sscanf(ptr1 + 2*i, "%2x", &t) != 1) - return(-2); - for (j = 0; j < 8; j++) - *key++ = (t & 1 << (7 - j)) != 0; - } - - /* - * Extract plain - */ - for (ptr1 = ptr2; *ptr1 && isspace(*ptr1); ptr1++) - ; - for (ptr2 = ptr1; *ptr2 && !isspace(*ptr2); ptr2++) - ; - if (ptr2 - ptr1 != 16) - return(-1); - for (i = 0; i < 8; i++){ - if (sscanf(ptr1 + 2*i, "%2x", &t) != 1) - return(-2); - for (j = 0; j < 8; j++) - *plain++ = (t & 1 << (7 - j)) != 0; - } - - /* - * Extract answer - */ - for (ptr1 = ptr2; *ptr1 && isspace(*ptr1); ptr1++) - ; - for (ptr2 = ptr1; *ptr2 && !isspace(*ptr2); ptr2++) - ; - if (ptr2 - ptr1 != 16) - return(-1); - for (i = 0; i < 8; i++){ - if (sscanf(ptr1 + 2*i, "%2x", &t) != 1) - return(-2); - for (j = 0; j < 8; j++) - *answer++ = (t & 1 << (7 - j)) != 0; - } - return(0); -} - -/* - * Test the setkey and encrypt functions - */ -void test_encrypt() -{ - char key[64],plain[64],cipher[64],answer[64]; - char buff[BUFSIZ]; - unsigned long salt; - int i; - int test; - int fail; - - printf("Testing setkey/encrypt\n"); - - for(test=0;fgets(buff, BUFSIZ, stdin);test++){ - - /* - * Allow comments. - */ - if (*buff == '#') - continue; - - if ((fail = parse_line(buff, &salt, key, plain, answer)) < 0){ - printf("test %d garbled (%d)\n", test, fail); - continue; - } - - if (salt) - continue; /* encrypt has no salt support */ - - printf(" K: "); put8(key); - printf(" P: "); put8(plain); - printf(" C: "); put8(answer); - - setkey(key); - 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(" Enc FAIL "); - put8(cipher); - fail++; totfails++; - } - - encrypt(cipher, 1); - - for(i=0;i<64;i++) - if(cipher[i] != plain[i]) - break; - if(i != 64){ - printf(" Dec FAIL"); - fail++; totfails++; - } - - if(fail == 0) - printf(" OK"); - printf("\n"); - } -} - - -void bytes_to_bits(bytes, bits) -char *bytes; -unsigned char *bits; -{ - int i, j; - - for (i = 0; i < 8; i++) { - bits[i] = 0; - for (j = 0; j < 8; j++) { - bits[i] |= (bytes[i*8+j] & 1) << (7 - j); - } - } -} - - -/* - * Test the des_setkey and des_cipher functions - */ -void test_des() -{ - char ckey[64], cplain[64], canswer[64]; - unsigned char key[8], plain[8], cipher[8], answer[8]; - char buff[BUFSIZ]; - unsigned long salt; - int i; - int test; - int fail; - - printf("Testing des_setkey/des_cipher\n"); - - for(test=0;fgets(buff, BUFSIZ, stdin);test++){ - - /* - * Allow comments. - */ - if (*buff == '#') - continue; - - if ((fail = parse_line(buff, &salt, ckey, cplain, canswer)) <0){ - printf("test %d garbled (%d)\n", test, fail); - continue; - } - - printf(" S: %06x", salt); - printf(" K: "); put8(ckey); - printf(" P: "); put8(cplain); - printf(" C: "); put8(canswer); - - bytes_to_bits(ckey, key); - bytes_to_bits(cplain, plain); - bytes_to_bits(canswer, answer); - des_setkey(key); - des_cipher(plain, cipher, salt, 1); - - for(i = 0; i < 8; i++) - if(cipher[i] != answer[i]) - break; - fail = 0; - if(i != 8){ - printf(" Enc FAIL "); - print_bits(cipher); - fail++; totfails++; - } - - des_cipher(cipher, cipher, salt, -1); - - for(i = 0; i < 8; i++) - if(cipher[i] != plain[i]) - break; - if(i != 8){ - printf(" Dec FAIL"); - fail++; totfails++; - } - - if(fail == 0) - printf(" OK"); - printf("\n"); - } -} - - -/* - * Test the old-style crypt(), the new-style crypt(), and crypt16(). - */ -void test_crypt() -{ - char *result; - struct crypt_test *p; - - printf("Testing crypt() family\n"); - - for (p = crypt_tests; p->key; p++) { - printf(" crypt(\"%s\", \"%s\"), \"%s\" expected", - p->key, p->setting, p->answer); - fflush(stdout); - result = crypt(p->key, p->setting); - if(!strcmp(result, p->answer)) { - printf(", OK\n"); - } else { - printf("\n failed (\"%s\")\n", result); - totfails++; - } - } - -#ifdef HAVE_CRYPT16 - for (p = crypt16_tests; p->key; p++) { - printf(" crypt16(\"%s\", \"%s\"), \"%s\" expected", - p->key, p->setting, p->answer); - fflush(stdout); - result = crypt16(p->key, p->setting); - if(!strcmp(result, p->answer)) { - printf(", OK\n"); - } else { - printf("\n failed (\"%s\")\n", result); - totfails++; - } - } -#endif /* HAVE_CRYPT16 */ -} - -main(argc, argv) -int argc; -char *argv[]; -{ - if(argc < 1 || !strcmp(argv[1], "-e")) - test_encrypt(); - else if(!strcmp(argv[1], "-d")) - test_des(); - else if(!strcmp(argv[1], "-c")) - test_crypt(); - good_bye(); -} diff --git a/secure/lib/libcipher/test/cert.input b/secure/lib/libcipher/test/cert.input deleted file mode 100644 index db1749e208861..0000000000000 --- a/secure/lib/libcipher/test/cert.input +++ /dev/null @@ -1,179 +0,0 @@ -# $Id$ -# -# Salt, key, plaintext, ciphertext -# -0 0101010101010101 95f8a5e5dd31d900 8000000000000000 -0 0101010101010101 dd7f121ca5015619 4000000000000000 -0 0101010101010101 2e8653104f3834ea 2000000000000000 -0 0101010101010101 4bd388ff6cd81d4f 1000000000000000 -0 0101010101010101 20b9e767b2fb1456 0800000000000000 -0 0101010101010101 55579380d77138ef 0400000000000000 -0 0101010101010101 6cc5defaaf04512f 0200000000000000 -0 0101010101010101 0d9f279ba5d87260 0100000000000000 -0 0101010101010101 d9031b0271bd5a0a 0080000000000000 -0 0101010101010101 424250b37c3dd951 0040000000000000 -0 0101010101010101 b8061b7ecd9a21e5 0020000000000000 -0 0101010101010101 f15d0f286b65bd28 0010000000000000 -0 0101010101010101 add0cc8d6e5deba1 0008000000000000 -0 0101010101010101 e6d5f82752ad63d1 0004000000000000 -0 0101010101010101 ecbfe3bd3f591a5e 0002000000000000 -0 0101010101010101 f356834379d165cd 0001000000000000 -0 0101010101010101 2b9f982f20037fa9 0000800000000000 -0 0101010101010101 889de068a16f0be6 0000400000000000 -0 0101010101010101 e19e275d846a1298 0000200000000000 -0 0101010101010101 329a8ed523d71aec 0000100000000000 -0 0101010101010101 e7fce22557d23c97 0000080000000000 -0 0101010101010101 12a9f5817ff2d65d 0000040000000000 -0 0101010101010101 a484c3ad38dc9c19 0000020000000000 -0 0101010101010101 fbe00a8a1ef8ad72 0000010000000000 -0 0101010101010101 750d079407521363 0000008000000000 -0 0101010101010101 64feed9c724c2faf 0000004000000000 -0 0101010101010101 f02b263b328e2b60 0000002000000000 -0 0101010101010101 9d64555a9a10b852 0000001000000000 -0 0101010101010101 d106ff0bed5255d7 0000000800000000 -0 0101010101010101 e1652c6b138c64a5 0000000400000000 -0 0101010101010101 e428581186ec8f46 0000000200000000 -0 0101010101010101 aeb5f5ede22d1a36 0000000100000000 -0 0101010101010101 e943d7568aec0c5c 0000000080000000 -0 0101010101010101 df98c8276f54b04b 0000000040000000 -0 0101010101010101 b160e4680f6c696f 0000000020000000 -0 0101010101010101 fa0752b07d9c4ab8 0000000010000000 -0 0101010101010101 ca3a2b036dbc8502 0000000008000000 -0 0101010101010101 5e0905517bb59bcf 0000000004000000 -0 0101010101010101 814eeb3b91d90726 0000000002000000 -0 0101010101010101 4d49db1532919c9f 0000000001000000 -0 0101010101010101 25eb5fc3f8cf0621 0000000000800000 -0 0101010101010101 ab6a20c0620d1c6f 0000000000400000 -0 0101010101010101 79e90dbc98f92cca 0000000000200000 -0 0101010101010101 866ecedd8072bb0e 0000000000100000 -0 0101010101010101 8b54536f2f3e64a8 0000000000080000 -0 0101010101010101 ea51d3975595b86b 0000000000040000 -0 0101010101010101 caffc6ac4542de31 0000000000020000 -0 0101010101010101 8dd45a2ddf90796c 0000000000010000 -0 0101010101010101 1029d55e880ec2d0 0000000000008000 -0 0101010101010101 5d86cb23639dbea9 0000000000004000 -0 0101010101010101 1d1ca853ae7c0c5f 0000000000002000 -0 0101010101010101 ce332329248f3228 0000000000001000 -0 0101010101010101 8405d1abe24fb942 0000000000000800 -0 0101010101010101 e643d78090ca4207 0000000000000400 -0 0101010101010101 48221b9937748a23 0000000000000200 -0 0101010101010101 dd7c0bbd61fafd54 0000000000000100 -0 0101010101010101 2fbc291a570db5c4 0000000000000080 -0 0101010101010101 e07c30d7e4e26e12 0000000000000040 -0 0101010101010101 0953e2258e8e90a1 0000000000000020 -0 0101010101010101 5b711bc4ceebf2ee 0000000000000010 -0 0101010101010101 cc083f1e6d9e85f6 0000000000000008 -0 0101010101010101 d2fd8867d50d2dfe 0000000000000004 -0 0101010101010101 06e7ea22ce92708f 0000000000000002 -0 0101010101010101 166b40b44aba4bd6 0000000000000001 -0 8001010101010101 0000000000000000 95a8d72813daa94d -0 4001010101010101 0000000000000000 0eec1487dd8c26d5 -0 2001010101010101 0000000000000000 7ad16ffb79c45926 -0 1001010101010101 0000000000000000 d3746294ca6a6cf3 -0 0801010101010101 0000000000000000 809f5f873c1fd761 -0 0401010101010101 0000000000000000 c02faffec989d1fc -0 0201010101010101 0000000000000000 4615aa1d33e72f10 -0 0180010101010101 0000000000000000 2055123350c00858 -0 0140010101010101 0000000000000000 df3b99d6577397c8 -0 0120010101010101 0000000000000000 31fe17369b5288c9 -0 0110010101010101 0000000000000000 dfdd3cc64dae1642 -0 0108010101010101 0000000000000000 178c83ce2b399d94 -0 0104010101010101 0000000000000000 50f636324a9b7f80 -0 0102010101010101 0000000000000000 a8468ee3bc18f06d -0 0101800101010101 0000000000000000 a2dc9e92fd3cde92 -0 0101400101010101 0000000000000000 cac09f797d031287 -0 0101200101010101 0000000000000000 90ba680b22aeb525 -0 0101100101010101 0000000000000000 ce7a24f350e280b6 -0 0101080101010101 0000000000000000 882bff0aa01a0b87 -0 0101040101010101 0000000000000000 25610288924511c2 -0 0101020101010101 0000000000000000 c71516c29c75d170 -0 0101018001010101 0000000000000000 5199c29a52c9f059 -0 0101014001010101 0000000000000000 c22f0a294a71f29f -0 0101012001010101 0000000000000000 ee371483714c02ea -0 0101011001010101 0000000000000000 a81fbd448f9e522f -0 0101010801010101 0000000000000000 4f644c92e192dfed -0 0101010401010101 0000000000000000 1afa9a66a6df92ae -0 0101010201010101 0000000000000000 b3c1cc715cb879d8 -0 0101010180010101 0000000000000000 19d032e64ab0bd8b -0 0101010140010101 0000000000000000 3cfaa7a7dc8720dc -0 0101010120010101 0000000000000000 b7265f7f447ac6f3 -0 0101010110010101 0000000000000000 9db73b3c0d163f54 -0 0101010108010101 0000000000000000 8181b65babf4a975 -0 0101010104010101 0000000000000000 93c9b64042eaa240 -0 0101010102010101 0000000000000000 5570530829705592 -0 0101010101800101 0000000000000000 8638809e878787a0 -0 0101010101400101 0000000000000000 41b9a79af79ac208 -0 0101010101200101 0000000000000000 7a9be42f2009a892 -0 0101010101100101 0000000000000000 29038d56ba6d2745 -0 0101010101080101 0000000000000000 5495c6abf1e5df51 -0 0101010101040101 0000000000000000 ae13dbd561488933 -0 0101010101020101 0000000000000000 024d1ffa8904e389 -0 0101010101018001 0000000000000000 d1399712f99bf02e -0 0101010101014001 0000000000000000 14c1d7c1cffec79e -0 0101010101012001 0000000000000000 1de5279dae3bed6f -0 0101010101011001 0000000000000000 e941a33f85501303 -0 0101010101010801 0000000000000000 da99dbbc9a03f379 -0 0101010101010401 0000000000000000 b7fc92f91d8e92e9 -0 0101010101010201 0000000000000000 ae8e5caa3ca04e85 -0 0101010101010180 0000000000000000 9cc62df43b6eed74 -0 0101010101010140 0000000000000000 d863dbb5c59a91a0 -0 0101010101010120 0000000000000000 a1ab2190545b91d7 -0 0101010101010110 0000000000000000 0875041e64c570f7 -0 0101010101010108 0000000000000000 5a594528bebef1cc -0 0101010101010104 0000000000000000 fcdb3291de21f0c0 -0 0101010101010102 0000000000000000 869efd7f9f265a09 -0 1046913489980131 0000000000000000 88d55e54f54c97b4 -0 1007103489988020 0000000000000000 0c0cc00c83ea48fd -0 10071034c8980120 0000000000000000 83bc8ef3a6570183 -0 1046103489988020 0000000000000000 df725dcad94ea2e9 -0 1086911519190101 0000000000000000 e652b53b550be8b0 -0 1086911519580101 0000000000000000 af527120c485cbb0 -0 5107b01519580101 0000000000000000 0f04ce393db926d5 -0 1007b01519190101 0000000000000000 c9f00ffc74079067 -0 3107915498080101 0000000000000000 7cfd82a593252b4e -0 3107919498080101 0000000000000000 cb49a2f9e91363e3 -0 10079115b9080140 0000000000000000 00b588be70d23f56 -0 3107911598080140 0000000000000000 406a9a6ab43399ae -0 1007d01589980101 0000000000000000 6cb773611dca9ada -0 9107911589980101 0000000000000000 67fd21c17dbb5d70 -0 9107d01589190101 0000000000000000 9592cb4110430787 -0 1007d01598980120 0000000000000000 a6b7ff68a318ddd3 -0 1007940498190101 0000000000000000 4d102196c914ca16 -0 0107910491190401 0000000000000000 2dfa9f4573594965 -0 0107910491190101 0000000000000000 b46604816c0e0774 -0 0107940491190401 0000000000000000 6e7e6221a4f34e87 -0 19079210981a0101 0000000000000000 aa85e74643233199 -0 1007911998190801 0000000000000000 2e5a19db4d1962d6 -0 10079119981a0801 0000000000000000 23a866a809d30894 -0 1007921098190101 0000000000000000 d812d961f017d320 -0 100791159819010b 0000000000000000 055605816e58608f -0 1004801598190101 0000000000000000 abd88e8b1b7716f1 -0 1004801598190102 0000000000000000 537ac95be69da1e1 -0 1004801598190108 0000000000000000 aed0f6ae3c25cdd8 -0 1002911598100104 0000000000000000 b3e35a5ee53e7b8d -0 1002911598190104 0000000000000000 61c79c71921a2ef8 -0 1002911598100201 0000000000000000 e2f5728f0995013c -0 1002911698100101 0000000000000000 1aeac39a61f0a464 -0 7ca110454a1a6e57 01a1d6d039776742 690f5b0d9a26939b -0 0131d9619dc1376e 5cd54ca83def57da 7a389d10354bd271 -0 07a1133e4a0b2686 0248d43806f67172 868ebb51cab4599a -0 3849674c2602319e 51454b582ddf440a 7178876e01f19b2a -0 04b915ba43feb5b6 42fd443059577fa2 af37fb421f8c4095 -0 0113b970fd34f2ce 059b5e0851cf143a 86a560f10ec6d85b -0 0170f175468fb5e6 0756d8e0774761d2 0cd3da020021dc09 -0 43297fad38e373fe 762514b829bf486a ea676b2cb7db2b7a -0 07a7137045da2a16 3bdd119049372802 dfd64a815caf1a0f -0 04689104c2fd3b2f 26955f6835af609a 5c513c9c4886c088 -0 37d06bb516cb7546 164d5e404f275232 0a2aeeae3ff4ab77 -0 1f08260d1ac2465e 6b056e18759f5cca ef1bf03e5dfa575a -0 584023641aba6176 004bd6ef09176062 88bf0db6d70dee56 -0 025816164629b007 480d39006ee762f2 a1f9915541020b56 -0 49793ebc79b3258f 437540c8698f3cfa 6fbf1cafcffd0556 -0 4fb05e1515ab73a7 072d43a077075292 2f22e49bab7ca1ac -0 49e95d6d4ca229bf 02fe55778117f12a 5a6b612cc26cce4a -0 018310dc409b26d6 1d9d5c5018f728c2 5f4c038ed12b2e41 -0 1c587f1c13924fef 305532286d6f295a 63fac0d034d9f793 -1 1c587f1c13924fef 305532286d6f295a 400d307ca24fee60 -57 1c587f1c13924fef 305532286d6f295a 28b568f40e7d43ae -1 8001010101010101 0000000000000000 f501029f268e45dc -0 1c587f1c13924fef 305532286d6f295a 63fac0d034d9f793 diff --git a/secure/lib/libcipher/test/speedcrypt.c b/secure/lib/libcipher/test/speedcrypt.c deleted file mode 100644 index f7507fd789f04..0000000000000 --- a/secure/lib/libcipher/test/speedcrypt.c +++ /dev/null @@ -1,76 +0,0 @@ -#include <sys/types.h> -#include <sys/time.h> -#include <sys/resource.h> -#include <signal.h> -#include <stdio.h> - -int keep_going, count, alternate, seconds; -struct rusage prior, now; - -void -finish() -{ - keep_going = 0; -} - - -main(int argc, char *argv[]) -{ - struct itimerval itv; - u_long msecs, key1[8], key2[8]; - char *k1, *k2; - - if (argc < 2 || sscanf(argv[1], "%d", &seconds) != 1) - seconds = 20; - - if (argc < 3 || sscanf(argv[2], "%d", &alternate) != 1) - alternate = 0; - - printf ("Running crypt%s for %d seconds of vtime...\n", - alternate ? " with alternate keys" : "", seconds); - - bzero(&itv, sizeof (itv)); - signal (SIGVTALRM, finish); - itv.it_value.tv_sec = seconds; - itv.it_value.tv_usec = 0; - setitimer(ITIMER_VIRTUAL, &itv, NULL); - - keep_going = 1; - if (getrusage(0, &prior) < 0) { - perror("getrusage"); - exit(1); - } - - k1 = (char *) key1; - k2 = (char *) key2; - strcpy(k1, "fredfredfredfredfred"); - strcpy(k2, "joejoejoejoejoejoejo"); - - if (alternate) - for (count = 0; keep_going; count++) - { -#if defined(LONGCRYPT) - crypt((count & 1) ? k1 : k2, "_ara.X..."); -#else - crypt((count & 1) ? k1 : k2, "eek"); -#endif - } - else - for (count = 0; keep_going; count++) - { -#if defined(LONGCRYPT) - crypt(k1, "_ara.X..."); -#else - crypt(k1, "eek"); -#endif - } - - if (getrusage(0, &now) < 0) { - perror("getrusage"); - exit(1); - } - msecs = (now.ru_utime.tv_sec - prior.ru_utime.tv_sec) * 1000 - + (now.ru_utime.tv_usec - prior.ru_utime.tv_usec) / 1000; - printf ("\tDid %d crypt()s per second.\n", 1000 * count / msecs); - exit(0); -} diff --git a/secure/lib/libcipher/test/speeddes.c b/secure/lib/libcipher/test/speeddes.c deleted file mode 100644 index a5822362f107a..0000000000000 --- a/secure/lib/libcipher/test/speeddes.c +++ /dev/null @@ -1,61 +0,0 @@ -#include <sys/types.h> -#include <sys/time.h> -#include <sys/resource.h> -#include <signal.h> -#include <stdio.h> - -int keep_going, count, alternate, seconds, iters; -struct rusage prior, now; -u_long block[3]; -char *blk; - -void -finish() -{ - keep_going = 0; -} - - -main(int argc, char *argv[]) -{ - struct itimerval itv; - u_long msecs; - - if (argc < 2 || sscanf(argv[1], "%d", &seconds) != 1) - seconds = 20; - - if (argc < 3 || sscanf(argv[2], "%d", &iters) != 1) - iters = 1; - - printf ("Running des_cipher( , , 0L, %d) for %d seconds of vtime...\n", - iters, seconds); - - bzero(&itv, sizeof (itv)); - signal (SIGVTALRM, finish); - itv.it_value.tv_sec = seconds; - itv.it_value.tv_usec = 0; - setitimer(ITIMER_VIRTUAL, &itv, NULL); - - keep_going = 1; - if (getrusage(0, &prior) < 0) { - perror("getrusage"); - exit(1); - } - - blk = (char *) block; - (void)des_setkey(blk); - for (count = 0; keep_going; count++) - (void) des_cipher(blk, blk, 0, iters); - - if (getrusage(0, &now) < 0) { - perror("getrusage"); - exit(1); - } - - msecs = (now.ru_utime.tv_sec - prior.ru_utime.tv_sec) * 1000 - + (now.ru_utime.tv_usec - prior.ru_utime.tv_usec) / 1000; - printf ("Did %d encryptions per second, each of %d iteration(s).\n", - 1000 * count / msecs, iters); - printf ("\tTotal %d blocks per second.\n", (1000*iters*count)/msecs); - exit(0); -} |