diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2014-04-22 20:31:39 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2014-04-22 20:31:39 +0000 |
commit | 9014fdfcd1c1f82ca91f413c59483f1ffe418f2c (patch) | |
tree | c26efbaf51634d785f7b24acc406ce0ae82b2708 /lib/libcrypto | |
parent | 066a99e668fa55b1d8e8a36c88da8f3dae6190af (diff) |
Remove meat which either duplicates code found in apps/, or is only of value
for 20th century historians, and can be put in the Attic.
Diffstat (limited to 'lib/libcrypto')
-rw-r--r-- | lib/libcrypto/bf/bf_opts.c | 330 | ||||
-rw-r--r-- | lib/libcrypto/bn/bn.mul | 19 | ||||
-rw-r--r-- | lib/libcrypto/bn/bnspeed.c | 233 | ||||
-rw-r--r-- | lib/libcrypto/bn/exp.c | 62 | ||||
-rw-r--r-- | lib/libcrypto/bn/expspeed.c | 347 | ||||
-rw-r--r-- | lib/libcrypto/des/FILES0 | 44 | ||||
-rw-r--r-- | lib/libcrypto/des/README | 54 | ||||
-rw-r--r-- | lib/libcrypto/des/VERSION | 412 | ||||
-rw-r--r-- | lib/libcrypto/des/des_opts.c | 608 | ||||
-rw-r--r-- | lib/libcrypto/des/options.txt | 39 | ||||
-rw-r--r-- | lib/libcrypto/idea/idea_spd.c | 298 | ||||
-rw-r--r-- | lib/libcrypto/idea/version | 12 | ||||
-rw-r--r-- | lib/libcrypto/lhash/num.pl | 17 | ||||
-rw-r--r-- | lib/libcrypto/rc2/rc2speed.c | 276 | ||||
-rw-r--r-- | lib/libcrypto/rc2/tab.c | 86 | ||||
-rw-r--r-- | lib/libcrypto/rc4/rc4.c | 193 | ||||
-rw-r--r-- | lib/libcrypto/rc4/rc4speed.c | 252 | ||||
-rw-r--r-- | lib/libcrypto/sha/sha.c | 124 | ||||
-rw-r--r-- | lib/libcrypto/sha/sha1.c | 125 |
19 files changed, 0 insertions, 3531 deletions
diff --git a/lib/libcrypto/bf/bf_opts.c b/lib/libcrypto/bf/bf_opts.c deleted file mode 100644 index da7a48740ed..00000000000 --- a/lib/libcrypto/bf/bf_opts.c +++ /dev/null @@ -1,330 +0,0 @@ -/* crypto/bf/bf_opts.c */ -/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) - * All rights reserved. - * - * This package is an SSL implementation written - * by Eric Young (eay@cryptsoft.com). - * The implementation was written so as to conform with Netscapes SSL. - * - * This library is free for commercial and non-commercial use as long as - * the following conditions are aheared to. The following conditions - * apply to all code found in this distribution, be it the RC4, RSA, - * lhash, DES, etc., code; not just the SSL code. The SSL documentation - * included with this distribution is covered by the same copyright terms - * except that the holder is Tim Hudson (tjh@cryptsoft.com). - * - * Copyright remains Eric Young's, and as such any Copyright notices in - * the code are not to be removed. - * If this package is used in a product, Eric Young should be given attribution - * as the author of the parts of the library used. - * This can be in the form of a textual message at program startup or - * in documentation (online or textual) provided with the package. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * "This product includes cryptographic software written by - * Eric Young (eay@cryptsoft.com)" - * The word 'cryptographic' can be left out if the rouines from the library - * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from - * the apps directory (application code) you must include an acknowledgement: - * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - * - * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * The licence and distribution terms for any publically available version or - * derivative of this code cannot be changed. i.e. this code cannot simply be - * copied and put under another distribution licence - * [including the GNU Public Licence.] - */ - -/* define PART1, PART2, PART3 or PART4 to build only with a few of the options. - * This is for machines with 64k code segment size restrictions. */ - -#if !defined(OPENSSL_SYS_MSDOS) && (!defined(OPENSSL_SYS_VMS) || defined(__DECC)) && !defined(OPENSSL_SYS_MACOSX) -#define TIMES -#endif - -#include <stdio.h> - -#include <openssl/e_os2.h> -#include <unistd.h> - -#ifndef OPENSSL_SYS_NETWARE -#include <signal.h> -#endif - -#ifndef _IRIX -#include <time.h> -#endif -#ifdef TIMES -#include <sys/types.h> -#include <sys/times.h> -#endif - -/* Depending on the VMS version, the tms structure is perhaps defined. - The __TMS macro will show if it was. If it wasn't defined, we should - undefine TIMES, since that tells the rest of the program how things - should be handled. -- Richard Levitte */ -#if defined(OPENSSL_SYS_VMS_DECC) && !defined(__TMS) -#undef TIMES -#endif - -#ifndef TIMES -#include <sys/timeb.h> -#endif - -#if defined(sun) || defined(__ultrix) -#define _POSIX_SOURCE -#include <limits.h> -#include <sys/param.h> -#endif - -#include <openssl/blowfish.h> - -#define BF_DEFAULT_OPTIONS - -#undef BF_ENC -#define BF_encrypt BF_encrypt_normal -#undef HEADER_BF_LOCL_H -#include "bf_enc.c" - -#define BF_PTR -#undef BF_PTR2 -#undef BF_ENC -#undef BF_encrypt -#define BF_encrypt BF_encrypt_ptr -#undef HEADER_BF_LOCL_H -#include "bf_enc.c" - -#undef BF_PTR -#define BF_PTR2 -#undef BF_ENC -#undef BF_encrypt -#define BF_encrypt BF_encrypt_ptr2 -#undef HEADER_BF_LOCL_H -#include "bf_enc.c" - -/* The following if from times(3) man page. It may need to be changed */ -#ifndef HZ -# ifndef CLK_TCK -# ifndef _BSD_CLK_TCK_ /* FreeBSD fix */ -# define HZ 100.0 -# else /* _BSD_CLK_TCK_ */ -# define HZ ((double)_BSD_CLK_TCK_) -# endif -# else /* CLK_TCK */ -# define HZ ((double)CLK_TCK) -# endif -#endif - -#define BUFSIZE ((long)1024) -long run=0; - -double Time_F(int s); -#ifdef SIGALRM -#if defined(__STDC__) || defined(sgi) -#define SIGRETTYPE void -#else -#define SIGRETTYPE int -#endif - -SIGRETTYPE sig_done(int sig); -SIGRETTYPE sig_done(int sig) - { - signal(SIGALRM,sig_done); - run=0; -#ifdef LINT - sig=sig; -#endif - } -#endif - -#define START 0 -#define STOP 1 - -double Time_F(int s) - { - double ret; -#ifdef TIMES - static struct tms tstart,tend; - - if (s == START) - { - times(&tstart); - return(0); - } - else - { - times(&tend); - ret=((double)(tend.tms_utime-tstart.tms_utime))/HZ; - return((ret == 0.0)?1e-6:ret); - } -#else /* !times() */ - static struct timeb tstart,tend; - long i; - - if (s == START) - { - ftime(&tstart); - return(0); - } - else - { - ftime(&tend); - i=(long)tend.millitm-(long)tstart.millitm; - ret=((double)(tend.time-tstart.time))+((double)i)/1000.0; - return((ret == 0.0)?1e-6:ret); - } -#endif - } - -#ifdef SIGALRM -#define print_name(name) fprintf(stderr,"Doing %s's for 10 seconds\n",name); alarm(10); -#else -#define print_name(name) fprintf(stderr,"Doing %s %ld times\n",name,cb); -#endif - -#define time_it(func,name,index) \ - print_name(name); \ - Time_F(START); \ - for (count=0,run=1; COND(cb); count+=4) \ - { \ - unsigned long d[2]; \ - func(d,&sch); \ - func(d,&sch); \ - func(d,&sch); \ - func(d,&sch); \ - } \ - tm[index]=Time_F(STOP); \ - fprintf(stderr,"%ld %s's in %.2f second\n",count,name,tm[index]); \ - tm[index]=((double)COUNT(cb))/tm[index]; - -#define print_it(name,index) \ - fprintf(stderr,"%s bytes per sec = %12.2f (%5.1fuS)\n",name, \ - tm[index]*8,1.0e6/tm[index]); - -int main(int argc, char **argv) - { - long count; - static unsigned char buf[BUFSIZE]; - static char key[16]={ 0x12,0x34,0x56,0x78,0x9a,0xbc,0xde,0xf0, - 0x12,0x34,0x56,0x78,0x9a,0xbc,0xde,0xf0}; - BF_KEY sch; - double d,tm[16],max=0; - int rank[16]; - char *str[16]; - int max_idx=0,i,num=0,j; -#ifndef SIGALARM - long ca,cb,cc,cd,ce; -#endif - - for (i=0; i<12; i++) - { - tm[i]=0.0; - rank[i]=0; - } - -#ifndef TIMES - fprintf(stderr,"To get the most accurate results, try to run this\n"); - fprintf(stderr,"program when this computer is idle.\n"); -#endif - - BF_set_key(&sch,16,key); - -#ifndef SIGALRM - fprintf(stderr,"First we calculate the approximate speed ...\n"); - count=10; - do { - long i; - unsigned long data[2]; - - count*=2; - Time_F(START); - for (i=count; i; i--) - BF_encrypt(data,&sch); - d=Time_F(STOP); - } while (d < 3.0); - ca=count; - cb=count*3; - cc=count*3*8/BUFSIZE+1; - cd=count*8/BUFSIZE+1; - - ce=count/20+1; -#define COND(d) (count != (d)) -#define COUNT(d) (d) -#else -#define COND(c) (run) -#define COUNT(d) (count) - signal(SIGALRM,sig_done); - alarm(10); -#endif - - time_it(BF_encrypt_normal, "BF_encrypt_normal ", 0); - time_it(BF_encrypt_ptr, "BF_encrypt_ptr ", 1); - time_it(BF_encrypt_ptr2, "BF_encrypt_ptr2 ", 2); - num+=3; - - str[0]="<nothing>"; - print_it("BF_encrypt_normal ",0); - max=tm[0]; - max_idx=0; - str[1]="ptr "; - print_it("BF_encrypt_ptr ",1); - if (max < tm[1]) { max=tm[1]; max_idx=1; } - str[2]="ptr2 "; - print_it("BF_encrypt_ptr2 ",2); - if (max < tm[2]) { max=tm[2]; max_idx=2; } - - printf("options BF ecb/s\n"); - printf("%s %12.2f 100.0%%\n",str[max_idx],tm[max_idx]); - d=tm[max_idx]; - tm[max_idx]= -2.0; - max= -1.0; - for (;;) - { - for (i=0; i<3; i++) - { - if (max < tm[i]) { max=tm[i]; j=i; } - } - if (max < 0.0) break; - printf("%s %12.2f %4.1f%%\n",str[j],tm[j],tm[j]/d*100.0); - tm[j]= -2.0; - max= -1.0; - } - - switch (max_idx) - { - case 0: - printf("-DBF_DEFAULT_OPTIONS\n"); - break; - case 1: - printf("-DBF_PTR\n"); - break; - case 2: - printf("-DBF_PTR2\n"); - break; - } - exit(0); -#if defined(LINT) || defined(OPENSSL_SYS_MSDOS) - return(0); -#endif - } diff --git a/lib/libcrypto/bn/bn.mul b/lib/libcrypto/bn/bn.mul deleted file mode 100644 index 9728870d38a..00000000000 --- a/lib/libcrypto/bn/bn.mul +++ /dev/null @@ -1,19 +0,0 @@ -We need - -* bn_mul_comba8 -* bn_mul_comba4 -* bn_mul_normal -* bn_mul_recursive - -* bn_sqr_comba8 -* bn_sqr_comba4 -bn_sqr_normal -> BN_sqr -* bn_sqr_recursive - -* bn_mul_low_recursive -* bn_mul_low_normal -* bn_mul_high - -* bn_mul_part_recursive # symetric but not power of 2 - -bn_mul_asymetric_recursive # uneven, but do the chop up. diff --git a/lib/libcrypto/bn/bnspeed.c b/lib/libcrypto/bn/bnspeed.c deleted file mode 100644 index b554ac8cf85..00000000000 --- a/lib/libcrypto/bn/bnspeed.c +++ /dev/null @@ -1,233 +0,0 @@ -/* unused */ - -/* crypto/bn/bnspeed.c */ -/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) - * All rights reserved. - * - * This package is an SSL implementation written - * by Eric Young (eay@cryptsoft.com). - * The implementation was written so as to conform with Netscapes SSL. - * - * This library is free for commercial and non-commercial use as long as - * the following conditions are aheared to. The following conditions - * apply to all code found in this distribution, be it the RC4, RSA, - * lhash, DES, etc., code; not just the SSL code. The SSL documentation - * included with this distribution is covered by the same copyright terms - * except that the holder is Tim Hudson (tjh@cryptsoft.com). - * - * Copyright remains Eric Young's, and as such any Copyright notices in - * the code are not to be removed. - * If this package is used in a product, Eric Young should be given attribution - * as the author of the parts of the library used. - * This can be in the form of a textual message at program startup or - * in documentation (online or textual) provided with the package. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * "This product includes cryptographic software written by - * Eric Young (eay@cryptsoft.com)" - * The word 'cryptographic' can be left out if the rouines from the library - * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from - * the apps directory (application code) you must include an acknowledgement: - * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - * - * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * The licence and distribution terms for any publically available version or - * derivative of this code cannot be changed. i.e. this code cannot simply be - * copied and put under another distribution licence - * [including the GNU Public Licence.] - */ - -/* most of this code has been pilfered from my libdes speed.c program */ - -#define BASENUM 1000000 -#undef PROG -#define PROG bnspeed_main - -#include <stdio.h> -#include <stdlib.h> -#include <signal.h> -#include <string.h> -#include <openssl/crypto.h> -#include <openssl/err.h> - -#if !defined(OPENSSL_SYS_MSDOS) && (!defined(OPENSSL_SYS_VMS) || defined(__DECC)) && !defined(OPENSSL_SYS_MACOSX) -#define TIMES -#endif - -#ifndef _IRIX -#include <time.h> -#endif -#ifdef TIMES -#include <sys/types.h> -#include <sys/times.h> -#endif - -/* Depending on the VMS version, the tms structure is perhaps defined. - The __TMS macro will show if it was. If it wasn't defined, we should - undefine TIMES, since that tells the rest of the program how things - should be handled. -- Richard Levitte */ -#if defined(OPENSSL_SYS_VMS_DECC) && !defined(__TMS) -#undef TIMES -#endif - -#ifndef TIMES -#include <sys/timeb.h> -#endif - -#if defined(sun) || defined(__ultrix) -#define _POSIX_SOURCE -#include <limits.h> -#include <sys/param.h> -#endif - -#include <openssl/bn.h> -#include <openssl/x509.h> - -/* The following if from times(3) man page. It may need to be changed */ -#ifndef HZ -# ifndef CLK_TCK -# ifndef _BSD_CLK_TCK_ /* FreeBSD hack */ -# define HZ 100.0 -# else /* _BSD_CLK_TCK_ */ -# define HZ ((double)_BSD_CLK_TCK_) -# endif -# else /* CLK_TCK */ -# define HZ ((double)CLK_TCK) -# endif -#endif - -#undef BUFSIZE -#define BUFSIZE ((long)1024*8) -int run=0; - -static double Time_F(int s); -#define START 0 -#define STOP 1 - -static double Time_F(int s) - { - double ret; -#ifdef TIMES - static struct tms tstart,tend; - - if (s == START) - { - times(&tstart); - return(0); - } - else - { - times(&tend); - ret=((double)(tend.tms_utime-tstart.tms_utime))/HZ; - return((ret < 1e-3)?1e-3:ret); - } -#else /* !times() */ - static struct timeb tstart,tend; - long i; - - if (s == START) - { - ftime(&tstart); - return(0); - } - else - { - ftime(&tend); - i=(long)tend.millitm-(long)tstart.millitm; - ret=((double)(tend.time-tstart.time))+((double)i)/1000.0; - return((ret < 0.001)?0.001:ret); - } -#endif - } - -#define NUM_SIZES 5 -static int sizes[NUM_SIZES]={128,256,512,1024,2048}; -/*static int sizes[NUM_SIZES]={59,179,299,419,539}; */ - -void do_mul(BIGNUM *r,BIGNUM *a,BIGNUM *b,BN_CTX *ctx); - -int main(int argc, char **argv) - { - BN_CTX *ctx; - BIGNUM a,b,c; - - ctx=BN_CTX_new(); - BN_init(&a); - BN_init(&b); - BN_init(&c); - - do_mul(&a,&b,&c,ctx); - } - -void do_mul(BIGNUM *r, BIGNUM *a, BIGNUM *b, BN_CTX *ctx) - { - int i,j,k; - double tm; - long num; - - for (i=0; i<NUM_SIZES; i++) - { - num=BASENUM; - if (i) num/=(i*3); - BN_rand(a,sizes[i],1,0); - for (j=i; j<NUM_SIZES; j++) - { - BN_rand(b,sizes[j],1,0); - Time_F(START); - for (k=0; k<num; k++) - BN_mul(r,b,a,ctx); - tm=Time_F(STOP); - printf("mul %4d x %4d -> %8.3fms\n",sizes[i],sizes[j],tm*1000.0/num); - } - } - - for (i=0; i<NUM_SIZES; i++) - { - num=BASENUM; - if (i) num/=(i*3); - BN_rand(a,sizes[i],1,0); - Time_F(START); - for (k=0; k<num; k++) - BN_sqr(r,a,ctx); - tm=Time_F(STOP); - printf("sqr %4d x %4d -> %8.3fms\n",sizes[i],sizes[i],tm*1000.0/num); - } - - for (i=0; i<NUM_SIZES; i++) - { - num=BASENUM/10; - if (i) num/=(i*3); - BN_rand(a,sizes[i]-1,1,0); - for (j=i; j<NUM_SIZES; j++) - { - BN_rand(b,sizes[j],1,0); - Time_F(START); - for (k=0; k<100000; k++) - BN_div(r, NULL, b, a,ctx); - tm=Time_F(STOP); - printf("div %4d / %4d -> %8.3fms\n",sizes[j],sizes[i]-1,tm*1000.0/num); - } - } - } - diff --git a/lib/libcrypto/bn/exp.c b/lib/libcrypto/bn/exp.c deleted file mode 100644 index 4865b0ef742..00000000000 --- a/lib/libcrypto/bn/exp.c +++ /dev/null @@ -1,62 +0,0 @@ -/* unused */ - -#include <stdio.h> -#include <openssl/tmdiff.h> -#include "bn_lcl.h" - -#define SIZE 256 -#define NUM (8*8*8) -#define MOD (8*8*8*8*8) - -main(argc,argv) -int argc; -char *argv[]; - { - BN_CTX ctx; - BIGNUM a,b,c,r,rr,t,l; - int j,i,size=SIZE,num=NUM,mod=MOD; - char *start,*end; - BN_MONT_CTX mont; - double d,md; - - BN_MONT_CTX_init(&mont); - BN_CTX_init(&ctx); - BN_init(&a); - BN_init(&b); - BN_init(&c); - BN_init(&r); - - start=ms_time_new(); - end=ms_time_new(); - while (size <= 1024*8) - { - BN_rand(&a,size,0,0); - BN_rand(&b,size,1,0); - BN_rand(&c,size,0,1); - - BN_mod(&a,&a,&c,&ctx); - - ms_time_get(start); - for (i=0; i<10; i++) - BN_MONT_CTX_set(&mont,&c,&ctx); - ms_time_get(end); - md=ms_time_diff(start,end); - - ms_time_get(start); - for (i=0; i<num; i++) - { - /* bn_mull(&r,&a,&b,&ctx); */ - /* BN_sqr(&r,&a,&ctx); */ - BN_mod_exp_mont(&r,&a,&b,&c,&ctx,&mont); - } - ms_time_get(end); - d=ms_time_diff(start,end)/* *50/33 */; - printf("%5d bit:%6.2f %6d %6.4f %4d m_set(%5.4f)\n",size, - d,num,d/num,(int)((d/num)*mod),md/10.0); - num/=8; - mod/=8; - if (num <= 0) num=1; - size*=2; - } - - } diff --git a/lib/libcrypto/bn/expspeed.c b/lib/libcrypto/bn/expspeed.c deleted file mode 100644 index 1b434db1ab9..00000000000 --- a/lib/libcrypto/bn/expspeed.c +++ /dev/null @@ -1,347 +0,0 @@ -/* unused */ - -/* crypto/bn/expspeed.c */ -/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) - * All rights reserved. - * - * This package is an SSL implementation written - * by Eric Young (eay@cryptsoft.com). - * The implementation was written so as to conform with Netscapes SSL. - * - * This library is free for commercial and non-commercial use as long as - * the following conditions are aheared to. The following conditions - * apply to all code found in this distribution, be it the RC4, RSA, - * lhash, DES, etc., code; not just the SSL code. The SSL documentation - * included with this distribution is covered by the same copyright terms - * except that the holder is Tim Hudson (tjh@cryptsoft.com). - * - * Copyright remains Eric Young's, and as such any Copyright notices in - * the code are not to be removed. - * If this package is used in a product, Eric Young should be given attribution - * as the author of the parts of the library used. - * This can be in the form of a textual message at program startup or - * in documentation (online or textual) provided with the package. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * "This product includes cryptographic software written by - * Eric Young (eay@cryptsoft.com)" - * The word 'cryptographic' can be left out if the rouines from the library - * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from - * the apps directory (application code) you must include an acknowledgement: - * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - * - * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * The licence and distribution terms for any publically available version or - * derivative of this code cannot be changed. i.e. this code cannot simply be - * copied and put under another distribution licence - * [including the GNU Public Licence.] - */ - -/* most of this code has been pilfered from my libdes speed.c program */ - -#define BASENUM 5000 -#define NUM_START 0 - - -/* determine timings for modexp, modmul, modsqr, gcd, Kronecker symbol, - * modular inverse, or modular square roots */ -#define TEST_EXP -#undef TEST_MUL -#undef TEST_SQR -#undef TEST_GCD -#undef TEST_KRON -#undef TEST_INV -#undef TEST_SQRT -#define P_MOD_64 9 /* least significant 6 bits for prime to be used for BN_sqrt timings */ - -#if defined(TEST_EXP) + defined(TEST_MUL) + defined(TEST_SQR) + defined(TEST_GCD) + defined(TEST_KRON) + defined(TEST_INV) +defined(TEST_SQRT) != 1 -# error "choose one test" -#endif - -#if defined(TEST_INV) || defined(TEST_SQRT) -# define C_PRIME -static void genprime_cb(int p, int n, void *arg); -#endif - - - -#undef PROG -#define PROG bnspeed_main - -#include <stdio.h> -#include <stdlib.h> -#include <signal.h> -#include <string.h> -#include <openssl/crypto.h> -#include <openssl/err.h> -#include <openssl/rand.h> - -#if !defined(OPENSSL_SYS_MSDOS) && (!defined(OPENSSL_SYS_VMS) || defined(__DECC)) && !defined(OPENSSL_SYS_MACOSX) -#define TIMES -#endif - -#ifndef _IRIX -#include <time.h> -#endif -#ifdef TIMES -#include <sys/types.h> -#include <sys/times.h> -#endif - -/* Depending on the VMS version, the tms structure is perhaps defined. - The __TMS macro will show if it was. If it wasn't defined, we should - undefine TIMES, since that tells the rest of the program how things - should be handled. -- Richard Levitte */ -#if defined(OPENSSL_SYS_VMS_DECC) && !defined(__TMS) -#undef TIMES -#endif - -#ifndef TIMES -#include <sys/timeb.h> -#endif - -#if defined(sun) || defined(__ultrix) -#define _POSIX_SOURCE -#include <limits.h> -#include <sys/param.h> -#endif - -#include <openssl/bn.h> -#include <openssl/x509.h> - -/* The following if from times(3) man page. It may need to be changed */ -#ifndef HZ -# ifndef CLK_TCK -# ifndef _BSD_CLK_TCK_ /* FreeBSD hack */ -# define HZ 100.0 -# else /* _BSD_CLK_TCK_ */ -# define HZ ((double)_BSD_CLK_TCK_) -# endif -# else /* CLK_TCK */ -# define HZ ((double)CLK_TCK) -# endif -#endif - -#undef BUFSIZE -#define BUFSIZE ((long)1024*8) -int run=0; - -static double Time_F(int s); -#define START 0 -#define STOP 1 - -static double Time_F(int s) - { - double ret; -#ifdef TIMES - static struct tms tstart,tend; - - if (s == START) - { - times(&tstart); - return(0); - } - else - { - times(&tend); - ret=((double)(tend.tms_utime-tstart.tms_utime))/HZ; - return((ret < 1e-3)?1e-3:ret); - } -#else /* !times() */ - static struct timeb tstart,tend; - long i; - - if (s == START) - { - ftime(&tstart); - return(0); - } - else - { - ftime(&tend); - i=(long)tend.millitm-(long)tstart.millitm; - ret=((double)(tend.time-tstart.time))+((double)i)/1000.0; - return((ret < 0.001)?0.001:ret); - } -#endif - } - -#define NUM_SIZES 7 -#if NUM_START > NUM_SIZES -# error "NUM_START > NUM_SIZES" -#endif -static int sizes[NUM_SIZES]={128,256,512,1024,2048,4096,8192}; -static int mul_c[NUM_SIZES]={8*8*8*8*8*8,8*8*8*8*8,8*8*8*8,8*8*8,8*8,8,1}; -/*static int sizes[NUM_SIZES]={59,179,299,419,539}; */ - -void do_mul_exp(BIGNUM *r,BIGNUM *a,BIGNUM *b,BIGNUM *c,BN_CTX *ctx); - -int main(int argc, char **argv) - { - BN_CTX *ctx; - BIGNUM *a,*b,*c,*r; - -#if 1 - if (!CRYPTO_set_mem_debug_functions(0,0,0,0,0)) - abort(); -#endif - - ctx=BN_CTX_new(); - a=BN_new(); - b=BN_new(); - c=BN_new(); - r=BN_new(); - - do_mul_exp(r,a,b,c,ctx); - return 0; - } - -void do_mul_exp(BIGNUM *r, BIGNUM *a, BIGNUM *b, BIGNUM *c, BN_CTX *ctx) - { - int i,k; - double tm; - long num; - - num=BASENUM; - for (i=NUM_START; i<NUM_SIZES; i++) - { -#ifdef C_PRIME -# ifdef TEST_SQRT - if (!BN_set_word(a, 64)) goto err; - if (!BN_set_word(b, P_MOD_64)) goto err; -# define ADD a -# define REM b -# else -# define ADD NULL -# define REM NULL -# endif - if (!BN_generate_prime(c,sizes[i],0,ADD,REM,genprime_cb,NULL)) goto err; - putc('\n', stderr); - fflush(stderr); -#endif - - for (k=0; k<num; k++) - { - if (k%50 == 0) /* Average over num/50 different choices of random numbers. */ - { - if (!BN_pseudo_rand(a,sizes[i],1,0)) goto err; - - if (!BN_pseudo_rand(b,sizes[i],1,0)) goto err; - -#ifndef C_PRIME - if (!BN_pseudo_rand(c,sizes[i],1,1)) goto err; -#endif - -#ifdef TEST_SQRT - if (!BN_mod_sqr(a,a,c,ctx)) goto err; - if (!BN_mod_sqr(b,b,c,ctx)) goto err; -#else - if (!BN_nnmod(a,a,c,ctx)) goto err; - if (!BN_nnmod(b,b,c,ctx)) goto err; -#endif - - if (k == 0) - Time_F(START); - } - -#if defined(TEST_EXP) - if (!BN_mod_exp(r,a,b,c,ctx)) goto err; -#elif defined(TEST_MUL) - { - int i = 0; - for (i = 0; i < 50; i++) - if (!BN_mod_mul(r,a,b,c,ctx)) goto err; - } -#elif defined(TEST_SQR) - { - int i = 0; - for (i = 0; i < 50; i++) - { - if (!BN_mod_sqr(r,a,c,ctx)) goto err; - if (!BN_mod_sqr(r,b,c,ctx)) goto err; - } - } -#elif defined(TEST_GCD) - if (!BN_gcd(r,a,b,ctx)) goto err; - if (!BN_gcd(r,b,c,ctx)) goto err; - if (!BN_gcd(r,c,a,ctx)) goto err; -#elif defined(TEST_KRON) - if (-2 == BN_kronecker(a,b,ctx)) goto err; - if (-2 == BN_kronecker(b,c,ctx)) goto err; - if (-2 == BN_kronecker(c,a,ctx)) goto err; -#elif defined(TEST_INV) - if (!BN_mod_inverse(r,a,c,ctx)) goto err; - if (!BN_mod_inverse(r,b,c,ctx)) goto err; -#else /* TEST_SQRT */ - if (!BN_mod_sqrt(r,a,c,ctx)) goto err; - if (!BN_mod_sqrt(r,b,c,ctx)) goto err; -#endif - } - tm=Time_F(STOP); - printf( -#if defined(TEST_EXP) - "modexp %4d ^ %4d %% %4d" -#elif defined(TEST_MUL) - "50*modmul %4d %4d %4d" -#elif defined(TEST_SQR) - "100*modsqr %4d %4d %4d" -#elif defined(TEST_GCD) - "3*gcd %4d %4d %4d" -#elif defined(TEST_KRON) - "3*kronecker %4d %4d %4d" -#elif defined(TEST_INV) - "2*inv %4d %4d mod %4d" -#else /* TEST_SQRT */ - "2*sqrt [prime == %d (mod 64)] %4d %4d mod %4d" -#endif - " -> %8.6fms %5.1f (%ld)\n", -#ifdef TEST_SQRT - P_MOD_64, -#endif - sizes[i],sizes[i],sizes[i],tm*1000.0/num,tm*mul_c[i]/num, num); - num/=7; - if (num <= 0) num=1; - } - return; - - err: - ERR_print_errors_fp(stderr); - } - - -#ifdef C_PRIME -static void genprime_cb(int p, int n, void *arg) - { - char c='*'; - - if (p == 0) c='.'; - if (p == 1) c='+'; - if (p == 2) c='*'; - if (p == 3) c='\n'; - putc(c, stderr); - fflush(stderr); - (void)n; - (void)arg; - } -#endif diff --git a/lib/libcrypto/des/FILES0 b/lib/libcrypto/des/FILES0 deleted file mode 100644 index 2e8211ad2af..00000000000 --- a/lib/libcrypto/des/FILES0 +++ /dev/null @@ -1,44 +0,0 @@ -/* General stuff */ -COPYRIGHT - Copyright info. -FILES - This file. -README - What this package is. -VERSION - Which version this is and what was changed. - -/* libdes.a source code */ -des.h - Public libdes.a header file. -ecb_enc.c - des_ecb_encrypt() source, this contains the basic DES code. -ecb3_enc.c - des_ecb3_encrypt() source. -cbc_ckm.c - des_cbc_cksum() source. -cbc_enc.c - des_cbc_encrypt() source. -ncbc_enc.c - des_cbc_encrypt() that is 'normal' in that it copies - the new iv values back in the passed iv vector. -ede_enc.c - des_ede3_cbc_encrypt() cbc mode des using triple DES. -cbc3_enc.c - des_3cbc_encrypt() source, don't use this function. -cfb_enc.c - des_cfb_encrypt() source. -cfb64enc.c - des_cfb64_encrypt() cfb in 64 bit mode but setup to be - used as a stream cipher. -cfb64ede.c - des_ede3_cfb64_encrypt() cfb in 64 bit mode but setup to be - used as a stream cipher and using triple DES. -ofb_enc.c - des_cfb_encrypt() source. -ofb64_enc.c - des_ofb_encrypt() ofb in 64 bit mode but setup to be - used as a stream cipher. -ofb64ede.c - des_ede3_ofb64_encrypt() ofb in 64 bit mode but setup to be - used as a stream cipher and using triple DES. -enc_read.c - des_enc_read() source. -enc_writ.c - des_enc_write() source. -pcbc_enc.c - des_pcbc_encrypt() source. -qud_cksm.c - quad_cksum() source. -rand_key.c - des_random_key() source. -read_pwd.c - Source for des_read_password() plus related functions. -set_key.c - Source for des_set_key(). -str2key.c - Covert a string of any length into a key. -fcrypt.c - A small, fast version of crypt(3). -des_locl.h - Internal libdes.a header file. -podd.h - Odd parity tables - used in des_set_key(). -sk.h - Lookup tables used in des_set_key(). -spr.h - What is left of the S tables - used in ecb_encrypt(). -des_ver.h - header file for the external definition of the - version string. -des.doc - SSLeay documentation for the library. - - diff --git a/lib/libcrypto/des/README b/lib/libcrypto/des/README deleted file mode 100644 index 621a5ab4676..00000000000 --- a/lib/libcrypto/des/README +++ /dev/null @@ -1,54 +0,0 @@ - - libdes, Version 4.01 10-Jan-97 - - Copyright (c) 1997, Eric Young - All rights reserved. - - This program is free software; you can redistribute it and/or modify - it under the terms specified in COPYRIGHT. - --- -The primary ftp site for this library is -ftp://ftp.psy.uq.oz.au/pub/Crypto/DES/libdes-x.xx.tar.gz -libdes is now also shipped with SSLeay. Primary ftp site of -ftp://ftp.psy.uq.oz.au/pub/Crypto/SSL/SSLeay-x.x.x.tar.gz - -The best way to build this library is to build it as part of SSLeay. - -This kit builds a DES encryption library and a DES encryption program. -It supports ecb, cbc, ofb, cfb, triple ecb, triple cbc, triple ofb, -triple cfb, desx, and MIT's pcbc encryption modes and also has a fast -implementation of crypt(3). -It contains support routines to read keys from a terminal, -generate a random key, generate a key from an arbitrary length string, -read/write encrypted data from/to a file descriptor. - -The implementation was written so as to conform with the manual entry -for the des_crypt(3) library routines from MIT's project Athena. - -destest should be run after compilation to test the des routines. -rpw should be run after compilation to test the read password routines. -The des program is a replacement for the sun des command. I believe it -conforms to the sun version. - -The Imakefile is setup for use in the kerberos distribution. - -These routines are best compiled with gcc or any other good -optimising compiler. -Just turn you optimiser up to the highest settings and run destest -after the build to make sure everything works. - -I believe these routines are close to the fastest and most portable DES -routines that use small lookup tables (4.5k) that are publicly available. -The fcrypt routine is faster than ufc's fcrypt (when compiling with -gcc2 -O2) on the sparc 2 (1410 vs 1270) but is not so good on other machines -(on a sun3/260 168 vs 336). It is a function of CPU on chip cache size. -[ 10-Jan-97 and a function of an incorrect speed testing program in - ufc which gave much better test figures that reality ]. - -It is worth noting that on sparc and Alpha CPUs, performance of the DES -library can vary by upto %10 due to the positioning of files after application -linkage. - -Eric Young (eay@cryptsoft.com) - diff --git a/lib/libcrypto/des/VERSION b/lib/libcrypto/des/VERSION deleted file mode 100644 index c7d01542bc7..00000000000 --- a/lib/libcrypto/des/VERSION +++ /dev/null @@ -1,412 +0,0 @@ - Fixed the weak key values which were wrong :-( - Defining SIGACTION causes sigaction() to be used instead of signal(). - SIGUSR1/SIGUSR2 are no longer mapped in the read tty stuff because it - can cause problems. This should hopefully not affect normal - applications. - -Version 4.04 - Fixed a few tests in destest. Also added x86 assember for - des_ncbc_encrypt() which is the standard cbc mode function. - This makes a very very large performace difference. - Ariel Glenn ariel@columbia.edu reports that the terminal - 'turn echo off' can return (errno == EINVAL) under solaris - when redirection is used. So I now catch that as well as ENOTTY. - - -Version 4.03 - Left a static out of enc_write.c, which caused to buffer to be - continiously malloc()ed. Does anyone use these functions? I keep - on feeling like removing them since I only had these in there - for a version of kerberised login. Anyway, this was pointed out - by Theo de Raadt <deraadt@cvs.openbsd.org> - The 'n' bit ofb code was wrong, it was not shifting the shift - register. It worked correctly for n == 64. Thanks to - Gigi Ankeny <Gigi.Ankeny@Eng.Sun.COM> for pointing this one out. - -Version 4.02 - I was doing 'if (memcmp(weak_keys[i],key,sizeof(key)) == 0)' - when checking for weak keys which is wrong :-(, pointed out by - Markus F.X.J. Oberhumer <markus.oberhumer@jk.uni-linz.ac.at>. - -Version 4.01 - Even faster inner loop in the DES assembler for x86 and a modification - for IP/FP which is faster on x86. Both of these changes are - from Svend Olaf Mikkelsen <svolaf@inet.uni-c.dk>. His - changes make the assembler run %40 faster on a pentium. This is just - a case of getting the instruction sequence 'just right'. - All credit to 'Svend' :-) - Quite a few special x86 'make' targets. - A libdes-l (lite) distribution. - -Version 4.00 - After a bit of a pause, I'll up the major version number since this - is mostly a performace release. I've added x86 assembler and - added more options for performance. A %28 speedup for gcc - on a pentium and the assembler is a %50 speedup. - MIPS CPU's, sparc and Alpha are the main CPU's with speedups. - Run des_opts to work out which options should be used. - DES_RISC1/DES_RISC2 use alternative inner loops which use - more registers but should give speedups on any CPU that does - dual issue (pentium). DES_UNROLL unrolls the inner loop, - which costs in code size. - -Version 3.26 - I've finally removed one of the shifts in D_ENCRYPT. This - meant I've changed the des_SPtrans table (spr.h), the set_key() - function and some things in des_enc.c. This has definitly - made things faster :-). I've known about this one for some - time but I've been too lazy to follow it up :-). - Noticed that in the D_ENCRYPT() macro, we can just do L^=(..)^(..)^.. - instead of L^=((..)|(..)|(..).. This should save a register at - least. - Assember for x86. The file to replace is des_enc.c, which is replaced - by one of the assembler files found in asm. Look at des/asm/readme - for more info. - - /* Modification to fcrypt so it can be compiled to support - HPUX 10.x's long password format, define -DLONGCRYPT to use this. - Thanks to Jens Kupferschmidt <bt1cu@hpboot.rz.uni-leipzig.de>. */ - - SIGWINCH case put in des_read_passwd() so the function does not - 'exit' if this function is recieved. - -Version 3.25 17/07/96 - Modified read_pwd.c so that stdin can be read if not a tty. - Thanks to Jeff Barber <jeffb@issl.atl.hp.com> for the patches. - des_init_random_number_generator() shortened due to VMS linker - limits. - Added RSA's DESX cbc mode. It is a form of cbc encryption, with 2 - 8 byte quantites xored before and after encryption. - des_xcbc_encryption() - the name is funny to preserve the des_ - prefix on all functions. - -Version 3.24 20/04/96 - The DES_PTR macro option checked and used by SSLeay configuration - -Version 3.23 11/04/96 - Added DES_LONG. If defined to 'unsigned int' on the DEC Alpha, - it gives a %20 speedup :-) - Fixed the problem with des.pl under perl5. The patches were - sent by Ed Kubaitis (ejk@uiuc.edu). - if fcrypt.c, changed values to handle illegal salt values the way - normal crypt() implementations do. Some programs apparently use - them :-(. The patch was sent by Bjorn Gronvall <bg@sics.se> - -Version 3.22 29/11/95 - Bug in des(1), an error with the uuencoding stuff when the - 'data' is small, thanks to Geoff Keating <keagchon@mehta.anu.edu.au> - for the patch. - -Version 3.21 22/11/95 - After some emailing back and forth with - Colin Plumb <colin@nyx10.cs.du.edu>, I've tweaked a few things - and in a future version I will probably put in some of the - optimisation he suggested for use with the DES_USE_PTR option. - Extra routines from Mark Murray <mark@grondar.za> for use in - freeBSD. They mostly involve random number generation for use - with kerberos. They involve evil machine specific system calls - etc so I would normally suggest pushing this stuff into the - application and/or using RAND_seed()/RAND_bytes() if you are - using this DES library as part of SSLeay. - Redone the read_pw() function so that it is cleaner and - supports termios, thanks to Sameer Parekh <sameer@c2.org> - for the initial patches for this. - Renamed 3ecb_encrypt() to ecb3_encrypt(). This has been - done just to make things more consistent. - I have also now added triple DES versions of cfb and ofb. - -Version 3.20 - Damn, Damn, Damn, as pointed out by Mike_Spreitzer.PARC@xerox.com, - my des_random_seed() function was only copying 4 bytes of the - passed seed into the init structure. It is now fixed to copy 8. - My own suggestion is to used something like MD5 :-) - -Version 3.19 - While looking at my code one day, I though, why do I keep on - calling des_encrypt(in,out,ks,enc) when every function that - calls it has in and out the same. So I dropped the 'out' - parameter, people should not be using this function. - -Version 3.18 30/08/95 - Fixed a few bit with the distribution and the filenames. - 3.17 had been munged via a move to DOS and back again. - NO CODE CHANGES - -Version 3.17 14/07/95 - Fixed ede3 cbc which I had broken in 3.16. I have also - removed some unneeded variables in 7-8 of the routines. - -Version 3.16 26/06/95 - Added des_encrypt2() which does not use IP/FP, used by triple - des routines. Tweaked things a bit elsewhere. %13 speedup on - sparc and %6 on a R4400 for ede3 cbc mode. - -Version 3.15 06/06/95 - Added des_ncbc_encrypt(), it is des_cbc mode except that it is - 'normal' and copies the new iv value back over the top of the - passed parameter. - CHANGED des_ede3_cbc_encrypt() so that it too now overwrites - the iv. THIS WILL BREAK EXISTING CODE, but since this function - only new, I feel I can change it, not so with des_cbc_encrypt :-(. - I need to update the documentation. - -Version 3.14 31/05/95 - New release upon the world, as part of my SSL implementation. - New copyright and usage stuff. Basically free for all to use - as long as you say it came from me :-) - -Version 3.13 31/05/95 - A fix in speed.c, if HZ is not defined, I set it to 100.0 - which is reasonable for most unixes except SunOS 4.x. - I now have a #ifdef sun but timing for SunOS 4.x looked very - good :-(. At my last job where I used SunOS 4.x, it was - defined to be 60.0 (look at the old INSTALL documentation), at - the last release had it changed to 100.0 since I now work with - Solaris2 and SVR4 boxes. - Thanks to Rory Chisholm <rchishol@math.ethz.ch> for pointing this - one out. - -Version 3.12 08/05/95 - As pointed out by The Crypt Keeper <tck@bend.UCSD.EDU>, - my D_ENCRYPT macro in crypt() had an un-necessary variable. - It has been removed. - -Version 3.11 03/05/95 - Added des_ede3_cbc_encrypt() which is cbc mode des with 3 keys - and one iv. It is a standard and I needed it for my SSL code. - It makes more sense to use this for triple DES than - 3cbc_encrypt(). I have also added (or should I say tested :-) - cfb64_encrypt() which is cfb64 but it will encrypt a partial - number of bytes - 3 bytes in 3 bytes out. Again this is for - my SSL library, as a form of encryption to use with SSL - telnet. - -Version 3.10 22/03/95 - Fixed a bug in 3cbc_encrypt() :-(. When making repeated calls - to cbc3_encrypt, the 2 iv values that were being returned to - be used in the next call were reversed :-(. - Many thanks to Bill Wade <wade@Stoner.COM> for pointing out - this error. - -Version 3.09 01/02/95 - Fixed des_random_key to far more random, it was rather feeble - with regards to picking the initial seed. The problem was - pointed out by Olaf Kirch <okir@monad.swb.de>. - -Version 3.08 14/12/94 - Added Makefile.PL so libdes can be built into perl5. - Changed des_locl.h so RAND is always defined. - -Version 3.07 05/12/94 - Added GNUmake and stuff so the library can be build with - glibc. - -Version 3.06 30/08/94 - Added rpc_enc.c which contains _des_crypt. This is for use in - secure_rpc v 4.0 - Finally fixed the cfb_enc problems. - Fixed a few parameter parsing bugs in des (-3 and -b), thanks - to Rob McMillan <R.McMillan@its.gu.edu.au> - -Version 3.05 21/04/94 - for unsigned long l; gcc does not produce ((l>>34) == 0) - This causes bugs in cfb_enc. - Thanks to Hadmut Danisch <danisch@ira.uka.de> - -Version 3.04 20/04/94 - Added a version number to des.c and libdes.a - -Version 3.03 12/01/94 - Fixed a bug in non zero iv in 3cbc_enc. - -Version 3.02 29/10/93 - I now work in a place where there are 6+ architectures and 14+ - OS versions :-). - Fixed TERMIO definition so the most sys V boxes will work :-) - -Release upon comp.sources.misc -Version 3.01 08/10/93 - Added des_3cbc_encrypt() - -Version 3.00 07/10/93 - Fixed up documentation. - quad_cksum definitely compatible with MIT's now. - -Version 2.30 24/08/93 - Triple DES now defaults to triple cbc but can do triple ecb - with the -b flag. - Fixed some MSDOS uuen/uudecoding problems, thanks to - Added prototypes. - -Version 2.22 29/06/93 - Fixed a bug in des_is_weak_key() which stopped it working :-( - thanks to engineering@MorningStar.Com. - -Version 2.21 03/06/93 - des(1) with no arguments gives quite a bit of help. - Added -c (generate ckecksum) flag to des(1). - Added -3 (triple DES) flag to des(1). - Added cfb and ofb routines to the library. - -Version 2.20 11/03/93 - Added -u (uuencode) flag to des(1). - I have been playing with byte order in quad_cksum to make it - compatible with MIT's version. All I can say is avid this - function if possible since MIT's output is endian dependent. - -Version 2.12 14/10/92 - Added MSDOS specific macro in ecb_encrypt which gives a %70 - speed up when the code is compiled with turbo C. - -Version 2.11 12/10/92 - Speedup in set_key (recoding of PC-1) - I now do it in 47 simple operations, down from 60. - Thanks to John Fletcher (john_fletcher@lccmail.ocf.llnl.gov) - for motivating me to look for a faster system :-) - The speedup is probably less that 1% but it is still 13 - instructions less :-). - -Version 2.10 06/10/92 - The code now works on the 64bit ETA10 and CRAY without modifications or - #defines. I believe the code should work on any machine that - defines long, int or short to be 8 bytes long. - Thanks to Shabbir J. Safdar (shabby@mentor.cc.purdue.edu) - for helping me fix the code to run on 64bit machines (he had - access to an ETA10). - Thanks also to John Fletcher <john_fletcher@lccmail.ocf.llnl.gov> - for testing the routines on a CRAY. - read_password.c has been renamed to read_passwd.c - string_to_key.c has been renamed to string2key.c - -Version 2.00 14/09/92 - Made mods so that the library should work on 64bit CPU's. - Removed all my uchar and ulong defs. To many different - versions of unix define them in their header files in too many - different combinations :-) - IRIX - Sillicon Graphics mods (mostly in read_password.c). - Thanks to Andrew Daviel (advax@erich.triumf.ca) - -Version 1.99 26/08/92 - Fixed a bug or 2 in enc_read.c - Fixed a bug in enc_write.c - Fixed a pseudo bug in fcrypt.c (very obscure). - -Version 1.98 31/07/92 - Support for the ETA10. This is a strange machine that defines - longs and ints as 8 bytes and shorts as 4 bytes. - Since I do evil things with long * that assume that they are 4 - bytes. Look in the Makefile for the option to compile for - this machine. quad_cksum appears to have problems but I - will don't have the time to fix it right now, and this is not - a function that uses DES and so will not effect the main uses - of the library. - -Version 1.97 20/05/92 eay - Fixed the Imakefile and made some changes to des.h to fix some - problems when building this package with Kerberos v 4. - -Version 1.96 18/05/92 eay - Fixed a small bug in string_to_key() where problems could - occur if des_check_key was set to true and the string - generated a weak key. - -Patch2 posted to comp.sources.misc -Version 1.95 13/05/92 eay - Added an alternative version of the D_ENCRYPT macro in - ecb_encrypt and fcrypt. Depending on the compiler, one version or the - other will be faster. This was inspired by - Dana How <how@isl.stanford.edu>, and her pointers about doing the - *(ulong *)((uchar *)ptr+(value&0xfc)) - vs - ptr[value&0x3f] - to stop the C compiler doing a <<2 to convert the long array index. - -Version 1.94 05/05/92 eay - Fixed an incompatibility between my string_to_key and the MIT - version. When the key is longer than 8 chars, I was wrapping - with a different method. To use the old version, define - OLD_STR_TO_KEY in the makefile. Thanks to - viktor@newsu.shearson.com (Viktor Dukhovni). - -Version 1.93 28/04/92 eay - Fixed the VMS mods so that echo is now turned off in - read_password. Thanks again to brennan@coco.cchs.su.oz.AU. - MSDOS support added. The routines can be compiled with - Turbo C (v2.0) and MSC (v5.1). Make sure MSDOS is defined. - -Patch1 posted to comp.sources.misc -Version 1.92 13/04/92 eay - Changed D_ENCRYPT so that the rotation of R occurs outside of - the loop. This required rotating all the longs in sp.h (now - called spr.h). Thanks to Richard Outerbridge <71755.204@CompuServe.COM> - speed.c has been changed so it will work without SIGALRM. If - times(3) is not present it will try to use ftime() instead. - -Version 1.91 08/04/92 eay - Added -E/-D options to des(1) so it can use string_to_key. - Added SVR4 mods suggested by witr@rwwa.COM - Added VMS mods suggested by brennan@coco.cchs.su.oz.AU. If - anyone knows how to turn of tty echo in VMS please tell me or - implement it yourself :-). - Changed FILE *IN/*OUT to *DES_IN/*DES_OUT since it appears VMS - does not like IN/OUT being used. - -Libdes posted to comp.sources.misc -Version 1.9 24/03/92 eay - Now contains a fast small crypt replacement. - Added des(1) command. - Added des_rw_mode so people can use cbc encryption with - enc_read and enc_write. - -Version 1.8 15/10/91 eay - Bug in cbc_cksum. - Many thanks to Keith Reynolds (keithr@sco.COM) for pointing this - one out. - -Version 1.7 24/09/91 eay - Fixed set_key :-) - set_key is 4 times faster and takes less space. - There are a few minor changes that could be made. - -Version 1.6 19/09/1991 eay - Finally go IP and FP finished. - Now I need to fix set_key. - This version is quite a bit faster that 1.51 - -Version 1.52 15/06/1991 eay - 20% speedup in ecb_encrypt by changing the E bit selection - to use 2 32bit words. This also required modification of the - sp table. There is still a way to speedup the IP and IP-1 - (hints from outer@sq.com) still working on this one :-(. - -Version 1.51 07/06/1991 eay - Faster des_encrypt by loop unrolling - Fixed bug in quad_cksum.c (thanks to hughes@logos.ucs.indiana.edu) - -Version 1.50 28/05/1991 eay - Optimised the code a bit more for the sparc. I have improved the - speed of the inner des_encrypt by speeding up the initial and - final permutations. - -Version 1.40 23/10/1990 eay - Fixed des_random_key, it did not produce a random key :-( - -Version 1.30 2/10/1990 eay - Have made des_quad_cksum the same as MIT's, the full package - should be compatible with MIT's - Have tested on a DECstation 3100 - Still need to fix des_set_key (make it faster). - Does des_cbc_encrypts at 70.5k/sec on a 3100. - -Version 1.20 18/09/1990 eay - Fixed byte order dependencies. - Fixed (I hope) all the word alignment problems. - Speedup in des_ecb_encrypt. - -Version 1.10 11/09/1990 eay - Added des_enc_read and des_enc_write. - Still need to fix des_quad_cksum. - Still need to document des_enc_read and des_enc_write. - -Version 1.00 27/08/1990 eay - diff --git a/lib/libcrypto/des/des_opts.c b/lib/libcrypto/des/des_opts.c deleted file mode 100644 index c713c5e3195..00000000000 --- a/lib/libcrypto/des/des_opts.c +++ /dev/null @@ -1,608 +0,0 @@ -/* crypto/des/des_opts.c */ -/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) - * All rights reserved. - * - * This package is an SSL implementation written - * by Eric Young (eay@cryptsoft.com). - * The implementation was written so as to conform with Netscapes SSL. - * - * This library is free for commercial and non-commercial use as long as - * the following conditions are aheared to. The following conditions - * apply to all code found in this distribution, be it the RC4, RSA, - * lhash, DES, etc., code; not just the SSL code. The SSL documentation - * included with this distribution is covered by the same copyright terms - * except that the holder is Tim Hudson (tjh@cryptsoft.com). - * - * Copyright remains Eric Young's, and as such any Copyright notices in - * the code are not to be removed. - * If this package is used in a product, Eric Young should be given attribution - * as the author of the parts of the library used. - * This can be in the form of a textual message at program startup or - * in documentation (online or textual) provided with the package. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * "This product includes cryptographic software written by - * Eric Young (eay@cryptsoft.com)" - * The word 'cryptographic' can be left out if the rouines from the library - * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from - * the apps directory (application code) you must include an acknowledgement: - * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - * - * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * The licence and distribution terms for any publically available version or - * derivative of this code cannot be changed. i.e. this code cannot simply be - * copied and put under another distribution licence - * [including the GNU Public Licence.] - */ - -/* define PART1, PART2, PART3 or PART4 to build only with a few of the options. - * This is for machines with 64k code segment size restrictions. */ - -#if !defined(OPENSSL_SYS_MSDOS) && (!defined(OPENSSL_SYS_VMS) || defined(__DECC)) && !defined(OPENSSL_SYS_MACOSX) -#define TIMES -#endif - -#include <stdio.h> -#ifndef OPENSSL_SYS_MSDOS -#include <openssl/e_os2.h> -#include <unistd.h> -#else -#include <io.h> -extern void exit(); -#endif - -#ifndef OPENSSL_SYS_NETWARE -#include <signal.h> -#endif - -#ifndef _IRIX -#include <time.h> -#endif -#ifdef TIMES -#include <sys/types.h> -#include <sys/times.h> -#endif - -/* Depending on the VMS version, the tms structure is perhaps defined. - The __TMS macro will show if it was. If it wasn't defined, we should - undefine TIMES, since that tells the rest of the program how things - should be handled. -- Richard Levitte */ -#if defined(OPENSSL_SYS_VMS_DECC) && !defined(__TMS) -#undef TIMES -#endif - -#ifndef TIMES -#include <sys/timeb.h> -#endif - - -#if defined(sun) || defined(__ultrix) -#define _POSIX_SOURCE -#include <limits.h> -#include <sys/param.h> -#endif - -#include <openssl/des.h> -#include "spr.h" - -#define DES_DEFAULT_OPTIONS - -#if !defined(PART1) && !defined(PART2) && !defined(PART3) && !defined(PART4) -#define PART1 -#define PART2 -#define PART3 -#define PART4 -#endif - -#ifdef PART1 - -#undef DES_UNROLL -#undef DES_RISC1 -#undef DES_RISC2 -#undef DES_PTR -#undef D_ENCRYPT -#define DES_encrypt1 des_encrypt_u4_cisc_idx -#define DES_encrypt2 des_encrypt2_u4_cisc_idx -#define DES_encrypt3 des_encrypt3_u4_cisc_idx -#define DES_decrypt3 des_decrypt3_u4_cisc_idx -#undef HEADER_DES_LOCL_H -#include "des_enc.c" - -#define DES_UNROLL -#undef DES_RISC1 -#undef DES_RISC2 -#undef DES_PTR -#undef D_ENCRYPT -#undef DES_encrypt1 -#undef DES_encrypt2 -#undef DES_encrypt3 -#undef DES_decrypt3 -#define DES_encrypt1 des_encrypt_u16_cisc_idx -#define DES_encrypt2 des_encrypt2_u16_cisc_idx -#define DES_encrypt3 des_encrypt3_u16_cisc_idx -#define DES_decrypt3 des_decrypt3_u16_cisc_idx -#undef HEADER_DES_LOCL_H -#include "des_enc.c" - -#undef DES_UNROLL -#define DES_RISC1 -#undef DES_RISC2 -#undef DES_PTR -#undef D_ENCRYPT -#undef DES_encrypt1 -#undef DES_encrypt2 -#undef DES_encrypt3 -#undef DES_decrypt3 -#define DES_encrypt1 des_encrypt_u4_risc1_idx -#define DES_encrypt2 des_encrypt2_u4_risc1_idx -#define DES_encrypt3 des_encrypt3_u4_risc1_idx -#define DES_decrypt3 des_decrypt3_u4_risc1_idx -#undef HEADER_DES_LOCL_H -#include "des_enc.c" - -#endif - -#ifdef PART2 - -#undef DES_UNROLL -#undef DES_RISC1 -#define DES_RISC2 -#undef DES_PTR -#undef D_ENCRYPT -#undef DES_encrypt1 -#undef DES_encrypt2 -#undef DES_encrypt3 -#undef DES_decrypt3 -#define DES_encrypt1 des_encrypt_u4_risc2_idx -#define DES_encrypt2 des_encrypt2_u4_risc2_idx -#define DES_encrypt3 des_encrypt3_u4_risc2_idx -#define DES_decrypt3 des_decrypt3_u4_risc2_idx -#undef HEADER_DES_LOCL_H -#include "des_enc.c" - -#define DES_UNROLL -#define DES_RISC1 -#undef DES_RISC2 -#undef DES_PTR -#undef D_ENCRYPT -#undef DES_encrypt1 -#undef DES_encrypt2 -#undef DES_encrypt3 -#undef DES_decrypt3 -#define DES_encrypt1 des_encrypt_u16_risc1_idx -#define DES_encrypt2 des_encrypt2_u16_risc1_idx -#define DES_encrypt3 des_encrypt3_u16_risc1_idx -#define DES_decrypt3 des_decrypt3_u16_risc1_idx -#undef HEADER_DES_LOCL_H -#include "des_enc.c" - -#define DES_UNROLL -#undef DES_RISC1 -#define DES_RISC2 -#undef DES_PTR -#undef D_ENCRYPT -#undef DES_encrypt1 -#undef DES_encrypt2 -#undef DES_encrypt3 -#undef DES_decrypt3 -#define DES_encrypt1 des_encrypt_u16_risc2_idx -#define DES_encrypt2 des_encrypt2_u16_risc2_idx -#define DES_encrypt3 des_encrypt3_u16_risc2_idx -#define DES_decrypt3 des_decrypt3_u16_risc2_idx -#undef HEADER_DES_LOCL_H -#include "des_enc.c" - -#endif - -#ifdef PART3 - -#undef DES_UNROLL -#undef DES_RISC1 -#undef DES_RISC2 -#define DES_PTR -#undef D_ENCRYPT -#undef DES_encrypt1 -#undef DES_encrypt2 -#undef DES_encrypt3 -#undef DES_decrypt3 -#define DES_encrypt1 des_encrypt_u4_cisc_ptr -#define DES_encrypt2 des_encrypt2_u4_cisc_ptr -#define DES_encrypt3 des_encrypt3_u4_cisc_ptr -#define DES_decrypt3 des_decrypt3_u4_cisc_ptr -#undef HEADER_DES_LOCL_H -#include "des_enc.c" - -#define DES_UNROLL -#undef DES_RISC1 -#undef DES_RISC2 -#define DES_PTR -#undef D_ENCRYPT -#undef DES_encrypt1 -#undef DES_encrypt2 -#undef DES_encrypt3 -#undef DES_decrypt3 -#define DES_encrypt1 des_encrypt_u16_cisc_ptr -#define DES_encrypt2 des_encrypt2_u16_cisc_ptr -#define DES_encrypt3 des_encrypt3_u16_cisc_ptr -#define DES_decrypt3 des_decrypt3_u16_cisc_ptr -#undef HEADER_DES_LOCL_H -#include "des_enc.c" - -#undef DES_UNROLL -#define DES_RISC1 -#undef DES_RISC2 -#define DES_PTR -#undef D_ENCRYPT -#undef DES_encrypt1 -#undef DES_encrypt2 -#undef DES_encrypt3 -#undef DES_decrypt3 -#define DES_encrypt1 des_encrypt_u4_risc1_ptr -#define DES_encrypt2 des_encrypt2_u4_risc1_ptr -#define DES_encrypt3 des_encrypt3_u4_risc1_ptr -#define DES_decrypt3 des_decrypt3_u4_risc1_ptr -#undef HEADER_DES_LOCL_H -#include "des_enc.c" - -#endif - -#ifdef PART4 - -#undef DES_UNROLL -#undef DES_RISC1 -#define DES_RISC2 -#define DES_PTR -#undef D_ENCRYPT -#undef DES_encrypt1 -#undef DES_encrypt2 -#undef DES_encrypt3 -#undef DES_decrypt3 -#define DES_encrypt1 des_encrypt_u4_risc2_ptr -#define DES_encrypt2 des_encrypt2_u4_risc2_ptr -#define DES_encrypt3 des_encrypt3_u4_risc2_ptr -#define DES_decrypt3 des_decrypt3_u4_risc2_ptr -#undef HEADER_DES_LOCL_H -#include "des_enc.c" - -#define DES_UNROLL -#define DES_RISC1 -#undef DES_RISC2 -#define DES_PTR -#undef D_ENCRYPT -#undef DES_encrypt1 -#undef DES_encrypt2 -#undef DES_encrypt3 -#undef DES_decrypt3 -#define DES_encrypt1 des_encrypt_u16_risc1_ptr -#define DES_encrypt2 des_encrypt2_u16_risc1_ptr -#define DES_encrypt3 des_encrypt3_u16_risc1_ptr -#define DES_decrypt3 des_decrypt3_u16_risc1_ptr -#undef HEADER_DES_LOCL_H -#include "des_enc.c" - -#define DES_UNROLL -#undef DES_RISC1 -#define DES_RISC2 -#define DES_PTR -#undef D_ENCRYPT -#undef DES_encrypt1 -#undef DES_encrypt2 -#undef DES_encrypt3 -#undef DES_decrypt3 -#define DES_encrypt1 des_encrypt_u16_risc2_ptr -#define DES_encrypt2 des_encrypt2_u16_risc2_ptr -#define DES_encrypt3 des_encrypt3_u16_risc2_ptr -#define DES_decrypt3 des_decrypt3_u16_risc2_ptr -#undef HEADER_DES_LOCL_H -#include "des_enc.c" - -#endif - -/* The following if from times(3) man page. It may need to be changed */ -#ifndef HZ -# ifndef CLK_TCK -# ifndef _BSD_CLK_TCK_ /* FreeBSD fix */ -# define HZ 100.0 -# else /* _BSD_CLK_TCK_ */ -# define HZ ((double)_BSD_CLK_TCK_) -# endif -# else /* CLK_TCK */ -# define HZ ((double)CLK_TCK) -# endif -#endif - -#define BUFSIZE ((long)1024) -long run=0; - -double Time_F(int s); -#ifdef SIGALRM -#if defined(__STDC__) || defined(sgi) -#define SIGRETTYPE void -#else -#define SIGRETTYPE int -#endif - -SIGRETTYPE sig_done(int sig); -SIGRETTYPE sig_done(int sig) - { - signal(SIGALRM,sig_done); - run=0; -#ifdef LINT - sig=sig; -#endif - } -#endif - -#define START 0 -#define STOP 1 - -double Time_F(int s) - { - double ret; -#ifdef TIMES - static struct tms tstart,tend; - - if (s == START) - { - times(&tstart); - return(0); - } - else - { - times(&tend); - ret=((double)(tend.tms_utime-tstart.tms_utime))/HZ; - return((ret == 0.0)?1e-6:ret); - } -#else /* !times() */ - static struct timeb tstart,tend; - long i; - - if (s == START) - { - ftime(&tstart); - return(0); - } - else - { - ftime(&tend); - i=(long)tend.millitm-(long)tstart.millitm; - ret=((double)(tend.time-tstart.time))+((double)i)/1000.0; - return((ret == 0.0)?1e-6:ret); - } -#endif - } - -#ifdef SIGALRM -#define print_name(name) fprintf(stderr,"Doing %s's for 10 seconds\n",name); alarm(10); -#else -#define print_name(name) fprintf(stderr,"Doing %s %ld times\n",name,cb); -#endif - -#define time_it(func,name,index) \ - print_name(name); \ - Time_F(START); \ - for (count=0,run=1; COND(cb); count++) \ - { \ - unsigned long d[2]; \ - func(d,&sch,DES_ENCRYPT); \ - } \ - tm[index]=Time_F(STOP); \ - fprintf(stderr,"%ld %s's in %.2f second\n",count,name,tm[index]); \ - tm[index]=((double)COUNT(cb))/tm[index]; - -#define print_it(name,index) \ - fprintf(stderr,"%s bytes per sec = %12.2f (%5.1fuS)\n",name, \ - tm[index]*8,1.0e6/tm[index]); - -int main(int argc, char **argv) - { - long count; - static unsigned char buf[BUFSIZE]; - static DES_cblock key ={0x12,0x34,0x56,0x78,0x9a,0xbc,0xde,0xf0}; - static DES_cblock key2={0x34,0x56,0x78,0x9a,0xbc,0xde,0xf0,0x12}; - static DES_cblock key3={0x56,0x78,0x9a,0xbc,0xde,0xf0,0x12,0x34}; - DES_key_schedule sch,sch2,sch3; - double d,tm[16],max=0; - int rank[16]; - char *str[16]; - int max_idx=0,i,num=0,j; -#ifndef SIGALARM - long ca,cb,cc,cd,ce; -#endif - - for (i=0; i<12; i++) - { - tm[i]=0.0; - rank[i]=0; - } - -#ifndef TIMES - fprintf(stderr,"To get the most accurate results, try to run this\n"); - fprintf(stderr,"program when this computer is idle.\n"); -#endif - - DES_set_key_unchecked(&key,&sch); - DES_set_key_unchecked(&key2,&sch2); - DES_set_key_unchecked(&key3,&sch3); - -#ifndef SIGALRM - fprintf(stderr,"First we calculate the approximate speed ...\n"); - DES_set_key_unchecked(&key,sch); - count=10; - do { - long i; - unsigned long data[2]; - - count*=2; - Time_F(START); - for (i=count; i; i--) - DES_encrypt1(data,&(sch[0]),DES_ENCRYPT); - d=Time_F(STOP); - } while (d < 3.0); - ca=count; - cb=count*3; - cc=count*3*8/BUFSIZE+1; - cd=count*8/BUFSIZE+1; - - ce=count/20+1; -#define COND(d) (count != (d)) -#define COUNT(d) (d) -#else -#define COND(c) (run) -#define COUNT(d) (count) - signal(SIGALRM,sig_done); - alarm(10); -#endif - -#ifdef PART1 - time_it(des_encrypt_u4_cisc_idx, "des_encrypt_u4_cisc_idx ", 0); - time_it(des_encrypt_u16_cisc_idx, "des_encrypt_u16_cisc_idx ", 1); - time_it(des_encrypt_u4_risc1_idx, "des_encrypt_u4_risc1_idx ", 2); - num+=3; -#endif -#ifdef PART2 - time_it(des_encrypt_u16_risc1_idx,"des_encrypt_u16_risc1_idx", 3); - time_it(des_encrypt_u4_risc2_idx, "des_encrypt_u4_risc2_idx ", 4); - time_it(des_encrypt_u16_risc2_idx,"des_encrypt_u16_risc2_idx", 5); - num+=3; -#endif -#ifdef PART3 - time_it(des_encrypt_u4_cisc_ptr, "des_encrypt_u4_cisc_ptr ", 6); - time_it(des_encrypt_u16_cisc_ptr, "des_encrypt_u16_cisc_ptr ", 7); - time_it(des_encrypt_u4_risc1_ptr, "des_encrypt_u4_risc1_ptr ", 8); - num+=3; -#endif -#ifdef PART4 - time_it(des_encrypt_u16_risc1_ptr,"des_encrypt_u16_risc1_ptr", 9); - time_it(des_encrypt_u4_risc2_ptr, "des_encrypt_u4_risc2_ptr ",10); - time_it(des_encrypt_u16_risc2_ptr,"des_encrypt_u16_risc2_ptr",11); - num+=3; -#endif - -#ifdef PART1 - str[0]=" 4 c i"; - print_it("des_encrypt_u4_cisc_idx ",0); - max=tm[0]; - max_idx=0; - str[1]="16 c i"; - print_it("des_encrypt_u16_cisc_idx ",1); - if (max < tm[1]) { max=tm[1]; max_idx=1; } - str[2]=" 4 r1 i"; - print_it("des_encrypt_u4_risc1_idx ",2); - if (max < tm[2]) { max=tm[2]; max_idx=2; } -#endif -#ifdef PART2 - str[3]="16 r1 i"; - print_it("des_encrypt_u16_risc1_idx",3); - if (max < tm[3]) { max=tm[3]; max_idx=3; } - str[4]=" 4 r2 i"; - print_it("des_encrypt_u4_risc2_idx ",4); - if (max < tm[4]) { max=tm[4]; max_idx=4; } - str[5]="16 r2 i"; - print_it("des_encrypt_u16_risc2_idx",5); - if (max < tm[5]) { max=tm[5]; max_idx=5; } -#endif -#ifdef PART3 - str[6]=" 4 c p"; - print_it("des_encrypt_u4_cisc_ptr ",6); - if (max < tm[6]) { max=tm[6]; max_idx=6; } - str[7]="16 c p"; - print_it("des_encrypt_u16_cisc_ptr ",7); - if (max < tm[7]) { max=tm[7]; max_idx=7; } - str[8]=" 4 r1 p"; - print_it("des_encrypt_u4_risc1_ptr ",8); - if (max < tm[8]) { max=tm[8]; max_idx=8; } -#endif -#ifdef PART4 - str[9]="16 r1 p"; - print_it("des_encrypt_u16_risc1_ptr",9); - if (max < tm[9]) { max=tm[9]; max_idx=9; } - str[10]=" 4 r2 p"; - print_it("des_encrypt_u4_risc2_ptr ",10); - if (max < tm[10]) { max=tm[10]; max_idx=10; } - str[11]="16 r2 p"; - print_it("des_encrypt_u16_risc2_ptr",11); - if (max < tm[11]) { max=tm[11]; max_idx=11; } -#endif - printf("options des ecb/s\n"); - printf("%s %12.2f 100.0%%\n",str[max_idx],tm[max_idx]); - d=tm[max_idx]; - tm[max_idx]= -2.0; - max= -1.0; - for (;;) - { - for (i=0; i<12; i++) - { - if (max < tm[i]) { max=tm[i]; j=i; } - } - if (max < 0.0) break; - printf("%s %12.2f %4.1f%%\n",str[j],tm[j],tm[j]/d*100.0); - tm[j]= -2.0; - max= -1.0; - } - - switch (max_idx) - { - case 0: - printf("-DDES_DEFAULT_OPTIONS\n"); - break; - case 1: - printf("-DDES_UNROLL\n"); - break; - case 2: - printf("-DDES_RISC1\n"); - break; - case 3: - printf("-DDES_UNROLL -DDES_RISC1\n"); - break; - case 4: - printf("-DDES_RISC2\n"); - break; - case 5: - printf("-DDES_UNROLL -DDES_RISC2\n"); - break; - case 6: - printf("-DDES_PTR\n"); - break; - case 7: - printf("-DDES_UNROLL -DDES_PTR\n"); - break; - case 8: - printf("-DDES_RISC1 -DDES_PTR\n"); - break; - case 9: - printf("-DDES_UNROLL -DDES_RISC1 -DDES_PTR\n"); - break; - case 10: - printf("-DDES_RISC2 -DDES_PTR\n"); - break; - case 11: - printf("-DDES_UNROLL -DDES_RISC2 -DDES_PTR\n"); - break; - } - exit(0); -#if defined(LINT) || defined(OPENSSL_SYS_MSDOS) - return(0); -#endif - } diff --git a/lib/libcrypto/des/options.txt b/lib/libcrypto/des/options.txt deleted file mode 100644 index 6e2b50f765e..00000000000 --- a/lib/libcrypto/des/options.txt +++ /dev/null @@ -1,39 +0,0 @@ -Note that the UNROLL option makes the 'inner' des loop unroll all 16 rounds -instead of the default 4. -RISC1 and RISC2 are 2 alternatives for the inner loop and -PTR means to use pointers arithmatic instead of arrays. - -FreeBSD - Pentium Pro 200mhz - gcc 2.7.2.2 - assembler 577,000 4620k/s -IRIX 6.2 - R10000 195mhz - cc (-O3 -n32) - UNROLL RISC2 PTR 496,000 3968k/s -solaris 2.5.1 usparc 167mhz?? - SC4.0 - UNROLL RISC1 PTR [1] 459,400 3672k/s -FreeBSD - Pentium Pro 200mhz - gcc 2.7.2.2 - UNROLL RISC1 433,000 3468k/s -solaris 2.5.1 usparc 167mhz?? - gcc 2.7.2 - UNROLL 380,000 3041k/s -linux - pentium 100mhz - gcc 2.7.0 - assembler 281,000 2250k/s -NT 4.0 - pentium 100mhz - VC 4.2 - assembler 281,000 2250k/s -AIX 4.1? - PPC604 100mhz - cc - UNROLL 275,000 2200k/s -IRIX 5.3 - R4400 200mhz - gcc 2.6.3 - UNROLL RISC2 PTR 235,300 1882k/s -IRIX 5.3 - R4400 200mhz - cc - UNROLL RISC2 PTR 233,700 1869k/s -NT 4.0 - pentium 100mhz - VC 4.2 - UNROLL RISC1 PTR 191,000 1528k/s -DEC Alpha 165mhz?? - cc - RISC2 PTR [2] 181,000 1448k/s -linux - pentium 100mhz - gcc 2.7.0 - UNROLL RISC1 PTR 158,500 1268k/s -HPUX 10 - 9000/887 - cc - UNROLL [3] 148,000 1190k/s -solaris 2.5.1 - sparc 10 50mhz - gcc 2.7.2 - UNROLL 123,600 989k/s -IRIX 5.3 - R4000 100mhz - cc - UNROLL RISC2 PTR 101,000 808k/s -DGUX - 88100 50mhz(?) - gcc 2.6.3 - UNROLL 81,000 648k/s -solaris 2.4 486 50mhz - gcc 2.6.3 - assembler 65,000 522k/s -HPUX 10 - 9000/887 - k&r cc (default compiler) - UNROLL PTR 76,000 608k/s -solaris 2.4 486 50mhz - gcc 2.6.3 - UNROLL RISC2 43,500 344k/s -AIX - old slow one :-) - cc - 39,000 312k/s - -Notes. -[1] For the ultra sparc, SunC 4.0 - cc -xtarget=ultra -xarch=v8plus -Xa -xO5, running 'des_opts' - gives a speed of 344,000 des/s while 'speed' gives 459,000 des/s. - I'll record the higher since it is coming from the library but it - is all rather weird. -[2] Similar to the ultra sparc ([1]), 181,000 for 'des_opts' vs 175,000. -[3] I was unable to get access to this machine when it was not heavily loaded. - As such, my timing program was never able to get more that %30 of the CPU. - This would cause the program to give much lower speed numbers because - it would be 'fighting' to stay in the cache with the other CPU burning - processes. diff --git a/lib/libcrypto/idea/idea_spd.c b/lib/libcrypto/idea/idea_spd.c deleted file mode 100644 index 7905b779266..00000000000 --- a/lib/libcrypto/idea/idea_spd.c +++ /dev/null @@ -1,298 +0,0 @@ -/* crypto/idea/idea_spd.c */ -/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) - * All rights reserved. - * - * This package is an SSL implementation written - * by Eric Young (eay@cryptsoft.com). - * The implementation was written so as to conform with Netscapes SSL. - * - * This library is free for commercial and non-commercial use as long as - * the following conditions are aheared to. The following conditions - * apply to all code found in this distribution, be it the RC4, RSA, - * lhash, DES, etc., code; not just the SSL code. The SSL documentation - * included with this distribution is covered by the same copyright terms - * except that the holder is Tim Hudson (tjh@cryptsoft.com). - * - * Copyright remains Eric Young's, and as such any Copyright notices in - * the code are not to be removed. - * If this package is used in a product, Eric Young should be given attribution - * as the author of the parts of the library used. - * This can be in the form of a textual message at program startup or - * in documentation (online or textual) provided with the package. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * "This product includes cryptographic software written by - * Eric Young (eay@cryptsoft.com)" - * The word 'cryptographic' can be left out if the rouines from the library - * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from - * the apps directory (application code) you must include an acknowledgement: - * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - * - * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * The licence and distribution terms for any publically available version or - * derivative of this code cannot be changed. i.e. this code cannot simply be - * copied and put under another distribution licence - * [including the GNU Public Licence.] - */ - -/* 11-Sep-92 Andrew Daviel Support for Silicon Graphics IRIX added */ -/* 06-Apr-92 Luke Brennan Support for VMS and add extra signal calls */ - -#if !defined(OPENSSL_SYS_MSDOS) && (!defined(OPENSSL_SYS_VMS) || defined(__DECC)) && !defined(OPENSSL_SYS_MACOSX) -#define TIMES -#endif - -#include <stdio.h> - -#include <openssl/e_os2.h> -#include <unistd.h> - -#ifndef OPENSSL_SYS_NETWARE -#include <signal.h> -#endif - -#ifndef _IRIX -#include <time.h> -#endif -#ifdef TIMES -#include <sys/types.h> -#include <sys/times.h> -#endif - -/* Depending on the VMS version, the tms structure is perhaps defined. - The __TMS macro will show if it was. If it wasn't defined, we should - undefine TIMES, since that tells the rest of the program how things - should be handled. -- Richard Levitte */ -#if defined(OPENSSL_SYS_VMS_DECC) && !defined(__TMS) -#undef TIMES -#endif - -#ifndef TIMES -#include <sys/timeb.h> -#endif - -#if defined(sun) || defined(__ultrix) -#define _POSIX_SOURCE -#include <limits.h> -#include <sys/param.h> -#endif - -#include <openssl/idea.h> - -/* The following if from times(3) man page. It may need to be changed */ -#ifndef HZ -#ifndef CLK_TCK -#define HZ 100.0 -#else /* CLK_TCK */ -#define HZ ((double)CLK_TCK) -#endif -#endif - -#define BUFSIZE ((long)1024) -long run=0; - -double Time_F(int s); -#ifdef SIGALRM -#if defined(__STDC__) || defined(sgi) || defined(_AIX) -#define SIGRETTYPE void -#else -#define SIGRETTYPE int -#endif - -SIGRETTYPE sig_done(int sig); -SIGRETTYPE sig_done(int sig) - { - signal(SIGALRM,sig_done); - run=0; -#ifdef LINT - sig=sig; -#endif - } -#endif - -#define START 0 -#define STOP 1 - -double Time_F(int s) - { - double ret; -#ifdef TIMES - static struct tms tstart,tend; - - if (s == START) - { - times(&tstart); - return(0); - } - else - { - times(&tend); - ret=((double)(tend.tms_utime-tstart.tms_utime))/HZ; - return((ret == 0.0)?1e-6:ret); - } -#else /* !times() */ - static struct timeb tstart,tend; - long i; - - if (s == START) - { - ftime(&tstart); - return(0); - } - else - { - ftime(&tend); - i=(long)tend.millitm-(long)tstart.millitm; - ret=((double)(tend.time-tstart.time))+((double)i)/1e3; - return((ret == 0.0)?1e-6:ret); - } -#endif - } - -int main(int argc, char **argv) - { - long count; - static unsigned char buf[BUFSIZE]; - static unsigned char key[] ={ - 0x12,0x34,0x56,0x78,0x9a,0xbc,0xde,0xf0, - 0xfe,0xdc,0xba,0x98,0x76,0x54,0x32,0x10, - }; - IDEA_KEY_SCHEDULE sch; - double a,aa,b,c,d; -#ifndef SIGALRM - long ca,cca,cb,cc; -#endif - -#ifndef TIMES - printf("To get the most accurate results, try to run this\n"); - printf("program when this computer is idle.\n"); -#endif - -#ifndef SIGALRM - printf("First we calculate the approximate speed ...\n"); - idea_set_encrypt_key(key,&sch); - count=10; - do { - long i; - IDEA_INT data[2]; - - count*=2; - Time_F(START); - for (i=count; i; i--) - idea_encrypt(data,&sch); - d=Time_F(STOP); - } while (d < 3.0); - ca=count/4; - cca=count/200; - cb=count; - cc=count*8/BUFSIZE+1; - printf("idea_set_encrypt_key %ld times\n",ca); -#define COND(d) (count <= (d)) -#define COUNT(d) (d) -#else -#define COND(c) (run) -#define COUNT(d) (count) - signal(SIGALRM,sig_done); - printf("Doing idea_set_encrypt_key for 10 seconds\n"); - alarm(10); -#endif - - Time_F(START); - for (count=0,run=1; COND(ca); count+=4) - { - idea_set_encrypt_key(key,&sch); - idea_set_encrypt_key(key,&sch); - idea_set_encrypt_key(key,&sch); - idea_set_encrypt_key(key,&sch); - } - d=Time_F(STOP); - printf("%ld idea idea_set_encrypt_key's in %.2f seconds\n",count,d); - a=((double)COUNT(ca))/d; - -#ifdef SIGALRM - printf("Doing idea_set_decrypt_key for 10 seconds\n"); - alarm(10); -#else - printf("Doing idea_set_decrypt_key %ld times\n",cca); -#endif - - Time_F(START); - for (count=0,run=1; COND(cca); count+=4) - { - idea_set_decrypt_key(&sch,&sch); - idea_set_decrypt_key(&sch,&sch); - idea_set_decrypt_key(&sch,&sch); - idea_set_decrypt_key(&sch,&sch); - } - d=Time_F(STOP); - printf("%ld idea idea_set_decrypt_key's in %.2f seconds\n",count,d); - aa=((double)COUNT(cca))/d; - -#ifdef SIGALRM - printf("Doing idea_encrypt's for 10 seconds\n"); - alarm(10); -#else - printf("Doing idea_encrypt %ld times\n",cb); -#endif - Time_F(START); - for (count=0,run=1; COND(cb); count+=4) - { - unsigned long data[2]; - - idea_encrypt(data,&sch); - idea_encrypt(data,&sch); - idea_encrypt(data,&sch); - idea_encrypt(data,&sch); - } - d=Time_F(STOP); - printf("%ld idea_encrypt's in %.2f second\n",count,d); - b=((double)COUNT(cb)*8)/d; - -#ifdef SIGALRM - printf("Doing idea_cbc_encrypt on %ld byte blocks for 10 seconds\n", - BUFSIZE); - alarm(10); -#else - printf("Doing idea_cbc_encrypt %ld times on %ld byte blocks\n",cc, - BUFSIZE); -#endif - Time_F(START); - for (count=0,run=1; COND(cc); count++) - idea_cbc_encrypt(buf,buf,BUFSIZE,&sch, - &(key[0]),IDEA_ENCRYPT); - d=Time_F(STOP); - printf("%ld idea_cbc_encrypt's of %ld byte blocks in %.2f second\n", - count,BUFSIZE,d); - c=((double)COUNT(cc)*BUFSIZE)/d; - - printf("IDEA set_encrypt_key per sec = %12.2f (%9.3fuS)\n",a,1.0e6/a); - printf("IDEA set_decrypt_key per sec = %12.2f (%9.3fuS)\n",aa,1.0e6/aa); - printf("IDEA raw ecb bytes per sec = %12.2f (%9.3fuS)\n",b,8.0e6/b); - printf("IDEA cbc bytes per sec = %12.2f (%9.3fuS)\n",c,8.0e6/c); - exit(0); -#if defined(LINT) || defined(OPENSSL_SYS_MSDOS) - return(0); -#endif - } - diff --git a/lib/libcrypto/idea/version b/lib/libcrypto/idea/version deleted file mode 100644 index 3f222937954..00000000000 --- a/lib/libcrypto/idea/version +++ /dev/null @@ -1,12 +0,0 @@ -1.1 07/12/95 - eay - Many thanks to Rhys Weatherley <rweather@us.oracle.com> - for pointing out that I was assuming little endian byte - order for all quantities what idea actually used - bigendian. No where in the spec does it mention - this, it is all in terms of 16 bit numbers and even the example - does not use byte streams for the input example :-(. - If you byte swap each pair of input, keys and iv, the functions - would produce the output as the old version :-(. - -1.0 ??/??/95 - eay - First version. diff --git a/lib/libcrypto/lhash/num.pl b/lib/libcrypto/lhash/num.pl deleted file mode 100644 index 30fedf9cd5a..00000000000 --- a/lib/libcrypto/lhash/num.pl +++ /dev/null @@ -1,17 +0,0 @@ -#!/usr/local/bin/perl - -#node 10 -> 4 - -while (<>) - { - next unless /^node/; - chop; - @a=split; - $num{$a[3]}++; - } - -@a=sort {$a <=> $b } keys %num; -foreach (0 .. $a[$#a]) - { - printf "%4d:%4d\n",$_,$num{$_}; - } diff --git a/lib/libcrypto/rc2/rc2speed.c b/lib/libcrypto/rc2/rc2speed.c deleted file mode 100644 index 1c90ca3e36e..00000000000 --- a/lib/libcrypto/rc2/rc2speed.c +++ /dev/null @@ -1,276 +0,0 @@ -/* crypto/rc2/rc2speed.c */ -/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) - * All rights reserved. - * - * This package is an SSL implementation written - * by Eric Young (eay@cryptsoft.com). - * The implementation was written so as to conform with Netscapes SSL. - * - * This library is free for commercial and non-commercial use as long as - * the following conditions are aheared to. The following conditions - * apply to all code found in this distribution, be it the RC4, RSA, - * lhash, DES, etc., code; not just the SSL code. The SSL documentation - * included with this distribution is covered by the same copyright terms - * except that the holder is Tim Hudson (tjh@cryptsoft.com). - * - * Copyright remains Eric Young's, and as such any Copyright notices in - * the code are not to be removed. - * If this package is used in a product, Eric Young should be given attribution - * as the author of the parts of the library used. - * This can be in the form of a textual message at program startup or - * in documentation (online or textual) provided with the package. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * "This product includes cryptographic software written by - * Eric Young (eay@cryptsoft.com)" - * The word 'cryptographic' can be left out if the rouines from the library - * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from - * the apps directory (application code) you must include an acknowledgement: - * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - * - * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * The licence and distribution terms for any publically available version or - * derivative of this code cannot be changed. i.e. this code cannot simply be - * copied and put under another distribution licence - * [including the GNU Public Licence.] - */ - -/* 11-Sep-92 Andrew Daviel Support for Silicon Graphics IRIX added */ -/* 06-Apr-92 Luke Brennan Support for VMS and add extra signal calls */ - -#if !defined(OPENSSL_SYS_MSDOS) && (!defined(OPENSSL_SYS_VMS) || defined(__DECC)) && !defined(OPENSSL_SYS_MACOSX) -#define TIMES -#endif - -#include <stdio.h> - -#include <openssl/e_os2.h> -#include <unistd.h> - -#ifndef OPENSSL_SYS_NETWARE -#include <signal.h> -#endif - -#ifndef _IRIX -#include <time.h> -#endif -#ifdef TIMES -#include <sys/types.h> -#include <sys/times.h> -#endif - -/* Depending on the VMS version, the tms structure is perhaps defined. - The __TMS macro will show if it was. If it wasn't defined, we should - undefine TIMES, since that tells the rest of the program how things - should be handled. -- Richard Levitte */ -#if defined(OPENSSL_SYS_VMS_DECC) && !defined(__TMS) -#undef TIMES -#endif - -#ifndef TIMES -#include <sys/timeb.h> -#endif - -#if defined(sun) || defined(__ultrix) -#define _POSIX_SOURCE -#include <limits.h> -#include <sys/param.h> -#endif - -#include <openssl/rc2.h> - -/* The following if from times(3) man page. It may need to be changed */ -#ifndef HZ -#ifndef CLK_TCK -#define HZ 100.0 -#else /* CLK_TCK */ -#define HZ ((double)CLK_TCK) -#endif /* CLK_TCK */ -#endif /* HZ */ - -#define BUFSIZE ((long)1024) -long run=0; - -double Time_F(int s); -#ifdef SIGALRM -#if defined(__STDC__) || defined(sgi) || defined(_AIX) -#define SIGRETTYPE void -#else -#define SIGRETTYPE int -#endif - -SIGRETTYPE sig_done(int sig); -SIGRETTYPE sig_done(int sig) - { - signal(SIGALRM,sig_done); - run=0; -#ifdef LINT - sig=sig; -#endif - } -#endif - -#define START 0 -#define STOP 1 - -double Time_F(int s) - { - double ret; -#ifdef TIMES - static struct tms tstart,tend; - - if (s == START) - { - times(&tstart); - return(0); - } - else - { - times(&tend); - ret=((double)(tend.tms_utime-tstart.tms_utime))/HZ; - return((ret == 0.0)?1e-6:ret); - } -#else /* !times() */ - static struct timeb tstart,tend; - long i; - - if (s == START) - { - ftime(&tstart); - return(0); - } - else - { - ftime(&tend); - i=(long)tend.millitm-(long)tstart.millitm; - ret=((double)(tend.time-tstart.time))+((double)i)/1e3; - return((ret == 0.0)?1e-6:ret); - } -#endif - } - -int main(int argc, char **argv) - { - long count; - static unsigned char buf[BUFSIZE]; - static unsigned char key[] ={ - 0x12,0x34,0x56,0x78,0x9a,0xbc,0xde,0xf0, - 0xfe,0xdc,0xba,0x98,0x76,0x54,0x32,0x10, - }; - RC2_KEY sch; - double a,b,c,d; -#ifndef SIGALRM - long ca,cb,cc; -#endif - -#ifndef TIMES - printf("To get the most accurate results, try to run this\n"); - printf("program when this computer is idle.\n"); -#endif - -#ifndef SIGALRM - printf("First we calculate the approximate speed ...\n"); - RC2_set_key(&sch,16,key,128); - count=10; - do { - long i; - unsigned long data[2]; - - count*=2; - Time_F(START); - for (i=count; i; i--) - RC2_encrypt(data,&sch); - d=Time_F(STOP); - } while (d < 3.0); - ca=count/512; - cb=count; - cc=count*8/BUFSIZE+1; - printf("Doing RC2_set_key %ld times\n",ca); -#define COND(d) (count != (d)) -#define COUNT(d) (d) -#else -#define COND(c) (run) -#define COUNT(d) (count) - signal(SIGALRM,sig_done); - printf("Doing RC2_set_key for 10 seconds\n"); - alarm(10); -#endif - - Time_F(START); - for (count=0,run=1; COND(ca); count+=4) - { - RC2_set_key(&sch,16,key,128); - RC2_set_key(&sch,16,key,128); - RC2_set_key(&sch,16,key,128); - RC2_set_key(&sch,16,key,128); - } - d=Time_F(STOP); - printf("%ld RC2_set_key's in %.2f seconds\n",count,d); - a=((double)COUNT(ca))/d; - -#ifdef SIGALRM - printf("Doing RC2_encrypt's for 10 seconds\n"); - alarm(10); -#else - printf("Doing RC2_encrypt %ld times\n",cb); -#endif - Time_F(START); - for (count=0,run=1; COND(cb); count+=4) - { - unsigned long data[2]; - - RC2_encrypt(data,&sch); - RC2_encrypt(data,&sch); - RC2_encrypt(data,&sch); - RC2_encrypt(data,&sch); - } - d=Time_F(STOP); - printf("%ld RC2_encrypt's in %.2f second\n",count,d); - b=((double)COUNT(cb)*8)/d; - -#ifdef SIGALRM - printf("Doing RC2_cbc_encrypt on %ld byte blocks for 10 seconds\n", - BUFSIZE); - alarm(10); -#else - printf("Doing RC2_cbc_encrypt %ld times on %ld byte blocks\n",cc, - BUFSIZE); -#endif - Time_F(START); - for (count=0,run=1; COND(cc); count++) - RC2_cbc_encrypt(buf,buf,BUFSIZE,&sch, - &(key[0]),RC2_ENCRYPT); - d=Time_F(STOP); - printf("%ld RC2_cbc_encrypt's of %ld byte blocks in %.2f second\n", - count,BUFSIZE,d); - c=((double)COUNT(cc)*BUFSIZE)/d; - - printf("RC2 set_key per sec = %12.2f (%9.3fuS)\n",a,1.0e6/a); - printf("RC2 raw ecb bytes per sec = %12.2f (%9.3fuS)\n",b,8.0e6/b); - printf("RC2 cbc bytes per sec = %12.2f (%9.3fuS)\n",c,8.0e6/c); - exit(0); -#if defined(LINT) || defined(OPENSSL_SYS_MSDOS) - return(0); -#endif - } diff --git a/lib/libcrypto/rc2/tab.c b/lib/libcrypto/rc2/tab.c deleted file mode 100644 index 25dc14eeba1..00000000000 --- a/lib/libcrypto/rc2/tab.c +++ /dev/null @@ -1,86 +0,0 @@ -#include <stdio.h> - -unsigned char ebits_to_num[256]={ - 0xbd,0x56,0xea,0xf2,0xa2,0xf1,0xac,0x2a, - 0xb0,0x93,0xd1,0x9c,0x1b,0x33,0xfd,0xd0, - 0x30,0x04,0xb6,0xdc,0x7d,0xdf,0x32,0x4b, - 0xf7,0xcb,0x45,0x9b,0x31,0xbb,0x21,0x5a, - 0x41,0x9f,0xe1,0xd9,0x4a,0x4d,0x9e,0xda, - 0xa0,0x68,0x2c,0xc3,0x27,0x5f,0x80,0x36, - 0x3e,0xee,0xfb,0x95,0x1a,0xfe,0xce,0xa8, - 0x34,0xa9,0x13,0xf0,0xa6,0x3f,0xd8,0x0c, - 0x78,0x24,0xaf,0x23,0x52,0xc1,0x67,0x17, - 0xf5,0x66,0x90,0xe7,0xe8,0x07,0xb8,0x60, - 0x48,0xe6,0x1e,0x53,0xf3,0x92,0xa4,0x72, - 0x8c,0x08,0x15,0x6e,0x86,0x00,0x84,0xfa, - 0xf4,0x7f,0x8a,0x42,0x19,0xf6,0xdb,0xcd, - 0x14,0x8d,0x50,0x12,0xba,0x3c,0x06,0x4e, - 0xec,0xb3,0x35,0x11,0xa1,0x88,0x8e,0x2b, - 0x94,0x99,0xb7,0x71,0x74,0xd3,0xe4,0xbf, - 0x3a,0xde,0x96,0x0e,0xbc,0x0a,0xed,0x77, - 0xfc,0x37,0x6b,0x03,0x79,0x89,0x62,0xc6, - 0xd7,0xc0,0xd2,0x7c,0x6a,0x8b,0x22,0xa3, - 0x5b,0x05,0x5d,0x02,0x75,0xd5,0x61,0xe3, - 0x18,0x8f,0x55,0x51,0xad,0x1f,0x0b,0x5e, - 0x85,0xe5,0xc2,0x57,0x63,0xca,0x3d,0x6c, - 0xb4,0xc5,0xcc,0x70,0xb2,0x91,0x59,0x0d, - 0x47,0x20,0xc8,0x4f,0x58,0xe0,0x01,0xe2, - 0x16,0x38,0xc4,0x6f,0x3b,0x0f,0x65,0x46, - 0xbe,0x7e,0x2d,0x7b,0x82,0xf9,0x40,0xb5, - 0x1d,0x73,0xf8,0xeb,0x26,0xc7,0x87,0x97, - 0x25,0x54,0xb1,0x28,0xaa,0x98,0x9d,0xa5, - 0x64,0x6d,0x7a,0xd4,0x10,0x81,0x44,0xef, - 0x49,0xd6,0xae,0x2e,0xdd,0x76,0x5c,0x2f, - 0xa7,0x1c,0xc9,0x09,0x69,0x9a,0x83,0xcf, - 0x29,0x39,0xb9,0xe9,0x4c,0xff,0x43,0xab, - }; - -unsigned char num_to_ebits[256]={ - 0x5d,0xbe,0x9b,0x8b,0x11,0x99,0x6e,0x4d, - 0x59,0xf3,0x85,0xa6,0x3f,0xb7,0x83,0xc5, - 0xe4,0x73,0x6b,0x3a,0x68,0x5a,0xc0,0x47, - 0xa0,0x64,0x34,0x0c,0xf1,0xd0,0x52,0xa5, - 0xb9,0x1e,0x96,0x43,0x41,0xd8,0xd4,0x2c, - 0xdb,0xf8,0x07,0x77,0x2a,0xca,0xeb,0xef, - 0x10,0x1c,0x16,0x0d,0x38,0x72,0x2f,0x89, - 0xc1,0xf9,0x80,0xc4,0x6d,0xae,0x30,0x3d, - 0xce,0x20,0x63,0xfe,0xe6,0x1a,0xc7,0xb8, - 0x50,0xe8,0x24,0x17,0xfc,0x25,0x6f,0xbb, - 0x6a,0xa3,0x44,0x53,0xd9,0xa2,0x01,0xab, - 0xbc,0xb6,0x1f,0x98,0xee,0x9a,0xa7,0x2d, - 0x4f,0x9e,0x8e,0xac,0xe0,0xc6,0x49,0x46, - 0x29,0xf4,0x94,0x8a,0xaf,0xe1,0x5b,0xc3, - 0xb3,0x7b,0x57,0xd1,0x7c,0x9c,0xed,0x87, - 0x40,0x8c,0xe2,0xcb,0x93,0x14,0xc9,0x61, - 0x2e,0xe5,0xcc,0xf6,0x5e,0xa8,0x5c,0xd6, - 0x75,0x8d,0x62,0x95,0x58,0x69,0x76,0xa1, - 0x4a,0xb5,0x55,0x09,0x78,0x33,0x82,0xd7, - 0xdd,0x79,0xf5,0x1b,0x0b,0xde,0x26,0x21, - 0x28,0x74,0x04,0x97,0x56,0xdf,0x3c,0xf0, - 0x37,0x39,0xdc,0xff,0x06,0xa4,0xea,0x42, - 0x08,0xda,0xb4,0x71,0xb0,0xcf,0x12,0x7a, - 0x4e,0xfa,0x6c,0x1d,0x84,0x00,0xc8,0x7f, - 0x91,0x45,0xaa,0x2b,0xc2,0xb1,0x8f,0xd5, - 0xba,0xf2,0xad,0x19,0xb2,0x67,0x36,0xf7, - 0x0f,0x0a,0x92,0x7d,0xe3,0x9d,0xe9,0x90, - 0x3e,0x23,0x27,0x66,0x13,0xec,0x81,0x15, - 0xbd,0x22,0xbf,0x9f,0x7e,0xa9,0x51,0x4b, - 0x4c,0xfb,0x02,0xd3,0x70,0x86,0x31,0xe7, - 0x3b,0x05,0x03,0x54,0x60,0x48,0x65,0x18, - 0xd2,0xcd,0x5f,0x32,0x88,0x0e,0x35,0xfd, - }; - -main() - { - int i,j; - - for (i=0; i<256; i++) - { - for (j=0; j<256; j++) - if (ebits_to_num[j] == i) - { - printf("0x%02x,",j); - break; - } - } - } diff --git a/lib/libcrypto/rc4/rc4.c b/lib/libcrypto/rc4/rc4.c deleted file mode 100644 index c900b260554..00000000000 --- a/lib/libcrypto/rc4/rc4.c +++ /dev/null @@ -1,193 +0,0 @@ -/* crypto/rc4/rc4.c */ -/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) - * All rights reserved. - * - * This package is an SSL implementation written - * by Eric Young (eay@cryptsoft.com). - * The implementation was written so as to conform with Netscapes SSL. - * - * This library is free for commercial and non-commercial use as long as - * the following conditions are aheared to. The following conditions - * apply to all code found in this distribution, be it the RC4, RSA, - * lhash, DES, etc., code; not just the SSL code. The SSL documentation - * included with this distribution is covered by the same copyright terms - * except that the holder is Tim Hudson (tjh@cryptsoft.com). - * - * Copyright remains Eric Young's, and as such any Copyright notices in - * the code are not to be removed. - * If this package is used in a product, Eric Young should be given attribution - * as the author of the parts of the library used. - * This can be in the form of a textual message at program startup or - * in documentation (online or textual) provided with the package. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * "This product includes cryptographic software written by - * Eric Young (eay@cryptsoft.com)" - * The word 'cryptographic' can be left out if the rouines from the library - * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from - * the apps directory (application code) you must include an acknowledgement: - * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - * - * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * The licence and distribution terms for any publically available version or - * derivative of this code cannot be changed. i.e. this code cannot simply be - * copied and put under another distribution licence - * [including the GNU Public Licence.] - */ - -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <openssl/rc4.h> -#include <openssl/evp.h> - -char *usage[]={ -"usage: rc4 args\n", -"\n", -" -in arg - input file - default stdin\n", -" -out arg - output file - default stdout\n", -" -key key - password\n", -NULL -}; - -int main(int argc, char *argv[]) - { - FILE *in=NULL,*out=NULL; - char *infile=NULL,*outfile=NULL,*keystr=NULL; - RC4_KEY key; - char buf[BUFSIZ]; - int badops=0,i; - char **pp; - unsigned char md[MD5_DIGEST_LENGTH]; - - argc--; - argv++; - while (argc >= 1) - { - if (strcmp(*argv,"-in") == 0) - { - if (--argc < 1) goto bad; - infile= *(++argv); - } - else if (strcmp(*argv,"-out") == 0) - { - if (--argc < 1) goto bad; - outfile= *(++argv); - } - else if (strcmp(*argv,"-key") == 0) - { - if (--argc < 1) goto bad; - keystr= *(++argv); - } - else - { - fprintf(stderr,"unknown option %s\n",*argv); - badops=1; - break; - } - argc--; - argv++; - } - - if (badops) - { -bad: - for (pp=usage; (*pp != NULL); pp++) - fprintf(stderr,"%s",*pp); - exit(1); - } - - if (infile == NULL) - in=stdin; - else - { - in=fopen(infile,"r"); - if (in == NULL) - { - perror("open"); - exit(1); - } - - } - if (outfile == NULL) - out=stdout; - else - { - out=fopen(outfile,"w"); - if (out == NULL) - { - perror("open"); - exit(1); - } - } - -#ifdef OPENSSL_SYS_MSDOS - /* This should set the file to binary mode. */ - { -#include <fcntl.h> - setmode(fileno(in),O_BINARY); - setmode(fileno(out),O_BINARY); - } -#endif - - if (keystr == NULL) - { /* get key */ - i=EVP_read_pw_string(buf,BUFSIZ,"Enter RC4 password:",0); - if (i != 0) - { - OPENSSL_cleanse(buf,BUFSIZ); - fprintf(stderr,"bad password read\n"); - exit(1); - } - keystr=buf; - } - - EVP_Digest((unsigned char *)keystr,strlen(keystr),md,NULL,EVP_md5(),NULL); - OPENSSL_cleanse(keystr,strlen(keystr)); - RC4_set_key(&key,MD5_DIGEST_LENGTH,md); - - for(;;) - { - i=fread(buf,1,BUFSIZ,in); - if (i == 0) break; - if (i < 0) - { - perror("read"); - exit(1); - } - RC4(&key,(unsigned int)i,(unsigned char *)buf, - (unsigned char *)buf); - i=fwrite(buf,(unsigned int)i,1,out); - if (i != 1) - { - perror("write"); - exit(1); - } - } - fclose(out); - fclose(in); - exit(0); - return(1); - } - diff --git a/lib/libcrypto/rc4/rc4speed.c b/lib/libcrypto/rc4/rc4speed.c deleted file mode 100644 index a495a738442..00000000000 --- a/lib/libcrypto/rc4/rc4speed.c +++ /dev/null @@ -1,252 +0,0 @@ -/* crypto/rc4/rc4speed.c */ -/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) - * All rights reserved. - * - * This package is an SSL implementation written - * by Eric Young (eay@cryptsoft.com). - * The implementation was written so as to conform with Netscapes SSL. - * - * This library is free for commercial and non-commercial use as long as - * the following conditions are aheared to. The following conditions - * apply to all code found in this distribution, be it the RC4, RSA, - * lhash, DES, etc., code; not just the SSL code. The SSL documentation - * included with this distribution is covered by the same copyright terms - * except that the holder is Tim Hudson (tjh@cryptsoft.com). - * - * Copyright remains Eric Young's, and as such any Copyright notices in - * the code are not to be removed. - * If this package is used in a product, Eric Young should be given attribution - * as the author of the parts of the library used. - * This can be in the form of a textual message at program startup or - * in documentation (online or textual) provided with the package. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * "This product includes cryptographic software written by - * Eric Young (eay@cryptsoft.com)" - * The word 'cryptographic' can be left out if the rouines from the library - * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from - * the apps directory (application code) you must include an acknowledgement: - * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - * - * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * The licence and distribution terms for any publically available version or - * derivative of this code cannot be changed. i.e. this code cannot simply be - * copied and put under another distribution licence - * [including the GNU Public Licence.] - */ - -/* 11-Sep-92 Andrew Daviel Support for Silicon Graphics IRIX added */ -/* 06-Apr-92 Luke Brennan Support for VMS and add extra signal calls */ - -#if !defined(OPENSSL_SYS_MSDOS) && (!defined(OPENSSL_SYS_VMS) || defined(__DECC)) && !defined(OPENSSL_SYS_MACOSX) -#define TIMES -#endif - -#include <stdio.h> - -#include <openssl/e_os2.h> -#include <unistd.h> - -#ifndef OPENSSL_SYS_NETWARE -#include <signal.h> -#endif - -#ifndef _IRIX -#include <time.h> -#endif -#ifdef TIMES -#include <sys/types.h> -#include <sys/times.h> -#endif - -/* Depending on the VMS version, the tms structure is perhaps defined. - The __TMS macro will show if it was. If it wasn't defined, we should - undefine TIMES, since that tells the rest of the program how things - should be handled. -- Richard Levitte */ -#if defined(OPENSSL_SYS_VMS_DECC) && !defined(__TMS) -#undef TIMES -#endif - -#ifndef TIMES -#include <sys/timeb.h> -#endif - -#if defined(sun) || defined(__ultrix) -#define _POSIX_SOURCE -#include <limits.h> -#include <sys/param.h> -#endif - -#include <openssl/rc4.h> - -/* The following if from times(3) man page. It may need to be changed */ -#ifndef HZ -#ifndef CLK_TCK -#define HZ 100.0 -#else /* CLK_TCK */ -#define HZ ((double)CLK_TCK) -#endif -#endif - -#define BUFSIZE ((long)1024) -long run=0; - -double Time_F(int s); -#ifdef SIGALRM -#if defined(__STDC__) || defined(sgi) || defined(_AIX) -#define SIGRETTYPE void -#else -#define SIGRETTYPE int -#endif - -SIGRETTYPE sig_done(int sig); -SIGRETTYPE sig_done(int sig) - { - signal(SIGALRM,sig_done); - run=0; -#ifdef LINT - sig=sig; -#endif - } -#endif - -#define START 0 -#define STOP 1 - -double Time_F(int s) - { - double ret; -#ifdef TIMES - static struct tms tstart,tend; - - if (s == START) - { - times(&tstart); - return(0); - } - else - { - times(&tend); - ret=((double)(tend.tms_utime-tstart.tms_utime))/HZ; - return((ret == 0.0)?1e-6:ret); - } -#else /* !times() */ - static struct timeb tstart,tend; - long i; - - if (s == START) - { - ftime(&tstart); - return(0); - } - else - { - ftime(&tend); - i=(long)tend.millitm-(long)tstart.millitm; - ret=((double)(tend.time-tstart.time))+((double)i)/1e3; - return((ret == 0.0)?1e-6:ret); - } -#endif - } - -int main(int argc, char **argv) - { - long count; - static unsigned char buf[BUFSIZE]; - static unsigned char key[] ={ - 0x12,0x34,0x56,0x78,0x9a,0xbc,0xde,0xf0, - 0xfe,0xdc,0xba,0x98,0x76,0x54,0x32,0x10, - }; - RC4_KEY sch; - double a,b,c,d; -#ifndef SIGALRM - long ca,cb,cc; -#endif - -#ifndef TIMES - printf("To get the most accurate results, try to run this\n"); - printf("program when this computer is idle.\n"); -#endif - -#ifndef SIGALRM - printf("First we calculate the approximate speed ...\n"); - RC4_set_key(&sch,16,key); - count=10; - do { - long i; - unsigned long data[2]; - - count*=2; - Time_F(START); - for (i=count; i; i--) - RC4(&sch,8,buf,buf); - d=Time_F(STOP); - } while (d < 3.0); - ca=count/512; - cc=count*8/BUFSIZE+1; - printf("Doing RC4_set_key %ld times\n",ca); -#define COND(d) (count != (d)) -#define COUNT(d) (d) -#else -#define COND(c) (run) -#define COUNT(d) (count) - signal(SIGALRM,sig_done); - printf("Doing RC4_set_key for 10 seconds\n"); - alarm(10); -#endif - - Time_F(START); - for (count=0,run=1; COND(ca); count+=4) - { - RC4_set_key(&sch,16,key); - RC4_set_key(&sch,16,key); - RC4_set_key(&sch,16,key); - RC4_set_key(&sch,16,key); - } - d=Time_F(STOP); - printf("%ld RC4_set_key's in %.2f seconds\n",count,d); - a=((double)COUNT(ca))/d; - -#ifdef SIGALRM - printf("Doing RC4 on %ld byte blocks for 10 seconds\n",BUFSIZE); - alarm(10); -#else - printf("Doing RC4 %ld times on %ld byte blocks\n",cc,BUFSIZE); -#endif - Time_F(START); - for (count=0,run=1; COND(cc); count++) - RC4(&sch,BUFSIZE,buf,buf); - d=Time_F(STOP); - printf("%ld RC4's of %ld byte blocks in %.2f second\n", - count,BUFSIZE,d); - c=((double)COUNT(cc)*BUFSIZE)/d; - - printf("RC4 set_key per sec = %12.2f (%9.3fuS)\n",a,1.0e6/a); - printf("RC4 bytes per sec = %12.2f (%9.3fuS)\n",c,8.0e6/c); - exit(0); -#if defined(LINT) || defined(OPENSSL_SYS_MSDOS) - return(0); -#endif - } - diff --git a/lib/libcrypto/sha/sha.c b/lib/libcrypto/sha/sha.c deleted file mode 100644 index 42126551d12..00000000000 --- a/lib/libcrypto/sha/sha.c +++ /dev/null @@ -1,124 +0,0 @@ -/* crypto/sha/sha.c */ -/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) - * All rights reserved. - * - * This package is an SSL implementation written - * by Eric Young (eay@cryptsoft.com). - * The implementation was written so as to conform with Netscapes SSL. - * - * This library is free for commercial and non-commercial use as long as - * the following conditions are aheared to. The following conditions - * apply to all code found in this distribution, be it the RC4, RSA, - * lhash, DES, etc., code; not just the SSL code. The SSL documentation - * included with this distribution is covered by the same copyright terms - * except that the holder is Tim Hudson (tjh@cryptsoft.com). - * - * Copyright remains Eric Young's, and as such any Copyright notices in - * the code are not to be removed. - * If this package is used in a product, Eric Young should be given attribution - * as the author of the parts of the library used. - * This can be in the form of a textual message at program startup or - * in documentation (online or textual) provided with the package. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * "This product includes cryptographic software written by - * Eric Young (eay@cryptsoft.com)" - * The word 'cryptographic' can be left out if the rouines from the library - * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from - * the apps directory (application code) you must include an acknowledgement: - * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - * - * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * The licence and distribution terms for any publically available version or - * derivative of this code cannot be changed. i.e. this code cannot simply be - * copied and put under another distribution licence - * [including the GNU Public Licence.] - */ - -#include <stdio.h> -#include <stdlib.h> -#include <openssl/sha.h> - -#define BUFSIZE 1024*16 - -void do_fp(FILE *f); -void pt(unsigned char *md); -int read(int, void *, unsigned int); -int main(int argc, char **argv) - { - int i,err=0; - FILE *IN; - - if (argc == 1) - { - do_fp(stdin); - } - else - { - for (i=1; i<argc; i++) - { - IN=fopen(argv[i],"r"); - if (IN == NULL) - { - perror(argv[i]); - err++; - continue; - } - printf("SHA(%s)= ",argv[i]); - do_fp(IN); - fclose(IN); - } - } - exit(err); - } - -void do_fp(FILE *f) - { - SHA_CTX c; - unsigned char md[SHA_DIGEST_LENGTH]; - int fd; - int i; - unsigned char buf[BUFSIZE]; - - fd=fileno(f); - SHA_Init(&c); - for (;;) - { - i=read(fd,buf,BUFSIZE); - if (i <= 0) break; - SHA_Update(&c,buf,(unsigned long)i); - } - SHA_Final(&(md[0]),&c); - pt(md); - } - -void pt(unsigned char *md) - { - int i; - - for (i=0; i<SHA_DIGEST_LENGTH; i++) - printf("%02x",md[i]); - printf("\n"); - } - diff --git a/lib/libcrypto/sha/sha1.c b/lib/libcrypto/sha/sha1.c deleted file mode 100644 index fd56a1e7568..00000000000 --- a/lib/libcrypto/sha/sha1.c +++ /dev/null @@ -1,125 +0,0 @@ -/* crypto/sha/sha1.c */ -/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) - * All rights reserved. - * - * This package is an SSL implementation written - * by Eric Young (eay@cryptsoft.com). - * The implementation was written so as to conform with Netscapes SSL. - * - * This library is free for commercial and non-commercial use as long as - * the following conditions are aheared to. The following conditions - * apply to all code found in this distribution, be it the RC4, RSA, - * lhash, DES, etc., code; not just the SSL code. The SSL documentation - * included with this distribution is covered by the same copyright terms - * except that the holder is Tim Hudson (tjh@cryptsoft.com). - * - * Copyright remains Eric Young's, and as such any Copyright notices in - * the code are not to be removed. - * If this package is used in a product, Eric Young should be given attribution - * as the author of the parts of the library used. - * This can be in the form of a textual message at program startup or - * in documentation (online or textual) provided with the package. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * "This product includes cryptographic software written by - * Eric Young (eay@cryptsoft.com)" - * The word 'cryptographic' can be left out if the rouines from the library - * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from - * the apps directory (application code) you must include an acknowledgement: - * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - * - * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * The licence and distribution terms for any publically available version or - * derivative of this code cannot be changed. i.e. this code cannot simply be - * copied and put under another distribution licence - * [including the GNU Public Licence.] - */ - -#include <unistd.h> -#include <stdio.h> -#include <stdlib.h> -#include <openssl/sha.h> - -#define BUFSIZE 1024*16 - -void do_fp(FILE *f); -void pt(unsigned char *md); - -int main(int argc, char **argv) - { - int i,err=0; - FILE *IN; - - if (argc == 1) - { - do_fp(stdin); - } - else - { - for (i=1; i<argc; i++) - { - IN=fopen(argv[i],"r"); - if (IN == NULL) - { - perror(argv[i]); - err++; - continue; - } - printf("SHA1(%s)= ",argv[i]); - do_fp(IN); - fclose(IN); - } - } - exit(err); - } - -void do_fp(FILE *f) - { - SHA_CTX c; - unsigned char md[SHA_DIGEST_LENGTH]; - int fd; - int i; - unsigned char buf[BUFSIZE]; - - fd=fileno(f); - SHA1_Init(&c); - for (;;) - { - i=read(fd,buf,BUFSIZE); - if (i <= 0) break; - SHA1_Update(&c,buf,(unsigned long)i); - } - SHA1_Final(&(md[0]),&c); - pt(md); - } - -void pt(unsigned char *md) - { - int i; - - for (i=0; i<SHA_DIGEST_LENGTH; i++) - printf("%02x",md[i]); - printf("\n"); - } - |