summaryrefslogtreecommitdiff
path: root/test/crypt/crypt.c
diff options
context:
space:
mode:
authorWaldemar Brodkorb <wbx@uclibc-ng.org>2016-10-28 20:29:21 +0200
committerWaldemar Brodkorb <wbx@uclibc-ng.org>2016-10-28 20:31:55 +0200
commit99ef2719fb3d703fe38c4113cd7f5adec516dd3a (patch)
tree2c1f77cb41b60ccbf8faa77a3640491a3546b546 /test/crypt/crypt.c
parent543308f6c46cf2edf8a524bc9c631e472570fe72 (diff)
test: remove test suite
The test suite is now a developed in a separate git repository. See here: http://cgit.uclibc-ng.org/cgi/cgit/uclibc-ng-test.git The test suite should be just like every other software compiled with the cross-toolchain. In the past strange problems where found when the test suite got build in the toolchain creation step.
Diffstat (limited to 'test/crypt/crypt.c')
-rw-r--r--test/crypt/crypt.c103
1 files changed, 0 insertions, 103 deletions
diff --git a/test/crypt/crypt.c b/test/crypt/crypt.c
deleted file mode 100644
index 786464710..000000000
--- a/test/crypt/crypt.c
+++ /dev/null
@@ -1,103 +0,0 @@
-
-/*
- * 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"
-
-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");
- exit(0);
- } else {
- printf("%d failures during DES validation suite!!!\n", totfails);
- exit(1);
- }
-}
-
-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;
- 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();
-}
-
-