diff options
| author | beck <> | 1999-09-29 04:37:45 +0000 |
|---|---|---|
| committer | beck <> | 1999-09-29 04:37:45 +0000 |
| commit | de8f24ea083384bb66b32ec105dc4743c5663cdf (patch) | |
| tree | 1412176ae62a3cab2cf2b0b92150fcbceaac6092 /src/lib/libcrypto/rc2 | |
| parent | cb929d29896bcb87c2a97417fbd03e50078fc178 (diff) | |
| download | openbsd-de8f24ea083384bb66b32ec105dc4743c5663cdf.tar.gz openbsd-de8f24ea083384bb66b32ec105dc4743c5663cdf.tar.bz2 openbsd-de8f24ea083384bb66b32ec105dc4743c5663cdf.zip | |
OpenSSL 0.9.4 merge
Diffstat (limited to 'src/lib/libcrypto/rc2')
| -rw-r--r-- | src/lib/libcrypto/rc2/Makefile.ssl | 40 | ||||
| -rw-r--r-- | src/lib/libcrypto/rc2/Makefile.uni | 3 | ||||
| -rw-r--r-- | src/lib/libcrypto/rc2/rc2.h (renamed from src/lib/libcrypto/rc2/rc2.org) | 31 | ||||
| -rw-r--r-- | src/lib/libcrypto/rc2/rc2_cbc.c | 19 | ||||
| -rw-r--r-- | src/lib/libcrypto/rc2/rc2_ecb.c | 12 | ||||
| -rw-r--r-- | src/lib/libcrypto/rc2/rc2_skey.c | 8 | ||||
| -rw-r--r-- | src/lib/libcrypto/rc2/rc2cfb64.c | 12 | ||||
| -rw-r--r-- | src/lib/libcrypto/rc2/rc2ofb64.c | 11 | ||||
| -rw-r--r-- | src/lib/libcrypto/rc2/rc2speed.c | 59 | ||||
| -rw-r--r-- | src/lib/libcrypto/rc2/rc2test.c | 27 | ||||
| -rw-r--r-- | src/lib/libcrypto/rc2/tab.c | 86 |
11 files changed, 170 insertions, 138 deletions
diff --git a/src/lib/libcrypto/rc2/Makefile.ssl b/src/lib/libcrypto/rc2/Makefile.ssl index c5138f13e2..542397d69a 100644 --- a/src/lib/libcrypto/rc2/Makefile.ssl +++ b/src/lib/libcrypto/rc2/Makefile.ssl | |||
| @@ -7,9 +7,11 @@ TOP= ../.. | |||
| 7 | CC= cc | 7 | CC= cc |
| 8 | INCLUDES= | 8 | INCLUDES= |
| 9 | CFLAG=-g | 9 | CFLAG=-g |
| 10 | INSTALL_PREFIX= | ||
| 11 | OPENSSLDIR= /usr/local/ssl | ||
| 10 | INSTALLTOP=/usr/local/ssl | 12 | INSTALLTOP=/usr/local/ssl |
| 11 | MAKE= make -f Makefile.ssl | 13 | MAKE= make -f Makefile.ssl |
| 12 | MAKEDEPEND= makedepend -f Makefile.ssl | 14 | MAKEDEPEND= $(TOP)/util/domd $(TOP) |
| 13 | MAKEFILE= Makefile.ssl | 15 | MAKEFILE= Makefile.ssl |
| 14 | AR= ar r | 16 | AR= ar r |
| 15 | 17 | ||
| @@ -37,24 +39,23 @@ all: lib | |||
| 37 | 39 | ||
| 38 | lib: $(LIBOBJ) | 40 | lib: $(LIBOBJ) |
| 39 | $(AR) $(LIB) $(LIBOBJ) | 41 | $(AR) $(LIB) $(LIBOBJ) |
| 40 | sh $(TOP)/util/ranlib.sh $(LIB) | 42 | $(RANLIB) $(LIB) |
| 41 | @touch lib | 43 | @touch lib |
| 42 | 44 | ||
| 43 | files: | 45 | files: |
| 44 | perl $(TOP)/util/files.pl Makefile.ssl >> $(TOP)/MINFO | 46 | $(PERL) $(TOP)/util/files.pl Makefile.ssl >> $(TOP)/MINFO |
| 45 | 47 | ||
| 46 | links: | 48 | links: |
| 47 | /bin/rm -f Makefile | 49 | @$(TOP)/util/point.sh Makefile.ssl Makefile |
| 48 | $(TOP)/util/point.sh Makefile.ssl Makefile ; | 50 | @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER) |
| 49 | $(TOP)/util/mklink.sh ../../include $(EXHEADER) | 51 | @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST) |
| 50 | $(TOP)/util/mklink.sh ../../test $(TEST) | 52 | @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS) |
| 51 | $(TOP)/util/mklink.sh ../../apps $(APPS) | ||
| 52 | 53 | ||
| 53 | install: | 54 | install: |
| 54 | @for i in $(EXHEADER) ; \ | 55 | @for i in $(EXHEADER) ; \ |
| 55 | do \ | 56 | do \ |
| 56 | (cp $$i $(INSTALLTOP)/include/$$i; \ | 57 | (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \ |
| 57 | chmod 644 $(INSTALLTOP)/include/$$i ); \ | 58 | chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \ |
| 58 | done; | 59 | done; |
| 59 | 60 | ||
| 60 | tags: | 61 | tags: |
| @@ -66,15 +67,24 @@ lint: | |||
| 66 | lint -DLINT $(INCLUDES) $(SRC)>fluff | 67 | lint -DLINT $(INCLUDES) $(SRC)>fluff |
| 67 | 68 | ||
| 68 | depend: | 69 | depend: |
| 69 | $(MAKEDEPEND) $(INCLUDES) $(PROGS) $(LIBSRC) | 70 | $(MAKEDEPEND) $(INCLUDES) $(DEPFLAG) $(PROGS) $(LIBSRC) |
| 70 | 71 | ||
| 71 | dclean: | 72 | dclean: |
| 72 | perl -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new | 73 | $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new |
| 73 | mv -f Makefile.new $(MAKEFILE) | 74 | mv -f Makefile.new $(MAKEFILE) |
| 74 | 75 | ||
| 75 | clean: | 76 | clean: |
| 76 | /bin/rm -f *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff | 77 | rm -f *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff |
| 77 | |||
| 78 | errors: | ||
| 79 | 78 | ||
| 80 | # DO NOT DELETE THIS LINE -- make depend depends on it. | 79 | # DO NOT DELETE THIS LINE -- make depend depends on it. |
| 80 | |||
| 81 | rc2_cbc.o: ../../include/openssl/opensslconf.h ../../include/openssl/rc2.h | ||
| 82 | rc2_cbc.o: rc2_locl.h | ||
| 83 | rc2_ecb.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 84 | rc2_ecb.o: ../../include/openssl/rc2.h rc2_locl.h | ||
| 85 | rc2_skey.o: ../../include/openssl/opensslconf.h ../../include/openssl/rc2.h | ||
| 86 | rc2_skey.o: rc2_locl.h | ||
| 87 | rc2cfb64.o: ../../include/openssl/opensslconf.h ../../include/openssl/rc2.h | ||
| 88 | rc2cfb64.o: rc2_locl.h | ||
| 89 | rc2ofb64.o: ../../include/openssl/opensslconf.h ../../include/openssl/rc2.h | ||
| 90 | rc2ofb64.o: rc2_locl.h | ||
diff --git a/src/lib/libcrypto/rc2/Makefile.uni b/src/lib/libcrypto/rc2/Makefile.uni index e50b3f2d19..4dc20c6fcf 100644 --- a/src/lib/libcrypto/rc2/Makefile.uni +++ b/src/lib/libcrypto/rc2/Makefile.uni | |||
| @@ -15,6 +15,7 @@ MAKE= make | |||
| 15 | MAKEDEPEND= makedepend | 15 | MAKEDEPEND= makedepend |
| 16 | MAKEFILE= Makefile.uni | 16 | MAKEFILE= Makefile.uni |
| 17 | AR= ar r | 17 | AR= ar r |
| 18 | RANLIB= ranlib | ||
| 18 | 19 | ||
| 19 | IDEA_ENC=rc2_cbc.o | 20 | IDEA_ENC=rc2_cbc.o |
| 20 | 21 | ||
| @@ -39,7 +40,7 @@ all: $(LIB) $(TEST) $(APPS) | |||
| 39 | 40 | ||
| 40 | $(LIB): $(LIBOBJ) | 41 | $(LIB): $(LIBOBJ) |
| 41 | $(AR) $(LIB) $(LIBOBJ) | 42 | $(AR) $(LIB) $(LIBOBJ) |
| 42 | sh $(TOP)/ranlib.sh $(LIB) | 43 | $(RANLIB) $(LIB) |
| 43 | 44 | ||
| 44 | test: $(TEST) | 45 | test: $(TEST) |
| 45 | ./$(TEST) | 46 | ./$(TEST) |
diff --git a/src/lib/libcrypto/rc2/rc2.org b/src/lib/libcrypto/rc2/rc2.h index 37354cfa62..9571efb755 100644 --- a/src/lib/libcrypto/rc2/rc2.org +++ b/src/lib/libcrypto/rc2/rc2.h | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* crypto/rc2/rc2.org */ | 1 | /* crypto/rc2/rc2.h */ |
| 2 | /* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -56,14 +56,6 @@ | |||
| 56 | * [including the GNU Public Licence.] | 56 | * [including the GNU Public Licence.] |
| 57 | */ | 57 | */ |
| 58 | 58 | ||
| 59 | /* WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING | ||
| 60 | * | ||
| 61 | * Always modify rc2.org since rc2.h is automatically generated from | ||
| 62 | * it during SSLeay configuration. | ||
| 63 | * | ||
| 64 | * WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING | ||
| 65 | */ | ||
| 66 | |||
| 67 | #ifndef HEADER_RC2_H | 59 | #ifndef HEADER_RC2_H |
| 68 | #define HEADER_RC2_H | 60 | #define HEADER_RC2_H |
| 69 | 61 | ||
| @@ -71,12 +63,14 @@ | |||
| 71 | extern "C" { | 63 | extern "C" { |
| 72 | #endif | 64 | #endif |
| 73 | 65 | ||
| 66 | #ifdef NO_RC2 | ||
| 67 | #error RC2 is disabled. | ||
| 68 | #endif | ||
| 69 | |||
| 74 | #define RC2_ENCRYPT 1 | 70 | #define RC2_ENCRYPT 1 |
| 75 | #define RC2_DECRYPT 0 | 71 | #define RC2_DECRYPT 0 |
| 76 | 72 | ||
| 77 | /* I need to put in a mod for the alpha - eay */ | 73 | #include <openssl/opensslconf.h> /* RC2_INT */ |
| 78 | #define RC2_INT unsigned short | ||
| 79 | |||
| 80 | #define RC2_BLOCK 8 | 74 | #define RC2_BLOCK 8 |
| 81 | #define RC2_KEY_LENGTH 16 | 75 | #define RC2_KEY_LENGTH 16 |
| 82 | 76 | ||
| @@ -85,7 +79,6 @@ typedef struct rc2_key_st | |||
| 85 | RC2_INT data[64]; | 79 | RC2_INT data[64]; |
| 86 | } RC2_KEY; | 80 | } RC2_KEY; |
| 87 | 81 | ||
| 88 | #ifndef NOPROTO | ||
| 89 | 82 | ||
| 90 | void RC2_set_key(RC2_KEY *key, int len, unsigned char *data,int bits); | 83 | void RC2_set_key(RC2_KEY *key, int len, unsigned char *data,int bits); |
| 91 | void RC2_ecb_encrypt(unsigned char *in,unsigned char *out,RC2_KEY *key, | 84 | void RC2_ecb_encrypt(unsigned char *in,unsigned char *out,RC2_KEY *key, |
| @@ -99,18 +92,6 @@ void RC2_cfb64_encrypt(unsigned char *in, unsigned char *out, long length, | |||
| 99 | void RC2_ofb64_encrypt(unsigned char *in, unsigned char *out, long length, | 92 | void RC2_ofb64_encrypt(unsigned char *in, unsigned char *out, long length, |
| 100 | RC2_KEY *schedule, unsigned char *ivec, int *num); | 93 | RC2_KEY *schedule, unsigned char *ivec, int *num); |
| 101 | 94 | ||
| 102 | #else | ||
| 103 | |||
| 104 | void RC2_set_key(); | ||
| 105 | void RC2_ecb_encrypt(); | ||
| 106 | void RC2_encrypt(); | ||
| 107 | void RC2_decrypt(); | ||
| 108 | void RC2_cbc_encrypt(); | ||
| 109 | void RC2_cfb64_encrypt(); | ||
| 110 | void RC2_ofb64_encrypt(); | ||
| 111 | |||
| 112 | #endif | ||
| 113 | |||
| 114 | #ifdef __cplusplus | 95 | #ifdef __cplusplus |
| 115 | } | 96 | } |
| 116 | #endif | 97 | #endif |
diff --git a/src/lib/libcrypto/rc2/rc2_cbc.c b/src/lib/libcrypto/rc2/rc2_cbc.c index 22e89f0441..1202184e85 100644 --- a/src/lib/libcrypto/rc2/rc2_cbc.c +++ b/src/lib/libcrypto/rc2/rc2_cbc.c | |||
| @@ -56,16 +56,11 @@ | |||
| 56 | * [including the GNU Public Licence.] | 56 | * [including the GNU Public Licence.] |
| 57 | */ | 57 | */ |
| 58 | 58 | ||
| 59 | #include "rc2.h" | 59 | #include <openssl/rc2.h> |
| 60 | #include "rc2_locl.h" | 60 | #include "rc2_locl.h" |
| 61 | 61 | ||
| 62 | void RC2_cbc_encrypt(in, out, length, ks, iv, encrypt) | 62 | void RC2_cbc_encrypt(unsigned char *in, unsigned char *out, long length, |
| 63 | unsigned char *in; | 63 | RC2_KEY *ks, unsigned char *iv, int encrypt) |
| 64 | unsigned char *out; | ||
| 65 | long length; | ||
| 66 | RC2_KEY *ks; | ||
| 67 | unsigned char *iv; | ||
| 68 | int encrypt; | ||
| 69 | { | 64 | { |
| 70 | register unsigned long tin0,tin1; | 65 | register unsigned long tin0,tin1; |
| 71 | register unsigned long tout0,tout1,xor0,xor1; | 66 | register unsigned long tout0,tout1,xor0,xor1; |
| @@ -138,9 +133,7 @@ int encrypt; | |||
| 138 | tin[0]=tin[1]=0; | 133 | tin[0]=tin[1]=0; |
| 139 | } | 134 | } |
| 140 | 135 | ||
| 141 | void RC2_encrypt(d,key) | 136 | void RC2_encrypt(unsigned long *d, RC2_KEY *key) |
| 142 | unsigned long *d; | ||
| 143 | RC2_KEY *key; | ||
| 144 | { | 137 | { |
| 145 | int i,n; | 138 | int i,n; |
| 146 | register RC2_INT *p0,*p1; | 139 | register RC2_INT *p0,*p1; |
| @@ -185,9 +178,7 @@ RC2_KEY *key; | |||
| 185 | d[1]=(unsigned long)(x2&0xffff)|((unsigned long)(x3&0xffff)<<16L); | 178 | d[1]=(unsigned long)(x2&0xffff)|((unsigned long)(x3&0xffff)<<16L); |
| 186 | } | 179 | } |
| 187 | 180 | ||
| 188 | void RC2_decrypt(d,key) | 181 | void RC2_decrypt(unsigned long *d, RC2_KEY *key) |
| 189 | unsigned long *d; | ||
| 190 | RC2_KEY *key; | ||
| 191 | { | 182 | { |
| 192 | int i,n; | 183 | int i,n; |
| 193 | register RC2_INT *p0,*p1; | 184 | register RC2_INT *p0,*p1; |
diff --git a/src/lib/libcrypto/rc2/rc2_ecb.c b/src/lib/libcrypto/rc2/rc2_ecb.c index 96239cd4e0..7d77b9186c 100644 --- a/src/lib/libcrypto/rc2/rc2_ecb.c +++ b/src/lib/libcrypto/rc2/rc2_ecb.c | |||
| @@ -56,10 +56,11 @@ | |||
| 56 | * [including the GNU Public Licence.] | 56 | * [including the GNU Public Licence.] |
| 57 | */ | 57 | */ |
| 58 | 58 | ||
| 59 | #include "rc2.h" | 59 | #include <openssl/rc2.h> |
| 60 | #include "rc2_locl.h" | 60 | #include "rc2_locl.h" |
| 61 | #include <openssl/opensslv.h> | ||
| 61 | 62 | ||
| 62 | char *RC2_version="RC2 part of SSLeay 0.9.0b 29-Jun-1998"; | 63 | const char *RC2_version="RC2" OPENSSL_VERSION_PTEXT; |
| 63 | 64 | ||
| 64 | /* RC2 as implemented frm a posting from | 65 | /* RC2 as implemented frm a posting from |
| 65 | * Newsgroups: sci.crypt | 66 | * Newsgroups: sci.crypt |
| @@ -69,11 +70,8 @@ char *RC2_version="RC2 part of SSLeay 0.9.0b 29-Jun-1998"; | |||
| 69 | * Date: 11 Feb 1996 06:45:03 GMT | 70 | * Date: 11 Feb 1996 06:45:03 GMT |
| 70 | */ | 71 | */ |
| 71 | 72 | ||
| 72 | void RC2_ecb_encrypt(in, out, ks, encrypt) | 73 | void RC2_ecb_encrypt(unsigned char *in, unsigned char *out, RC2_KEY *ks, |
| 73 | unsigned char *in; | 74 | int encrypt) |
| 74 | unsigned char *out; | ||
| 75 | RC2_KEY *ks; | ||
| 76 | int encrypt; | ||
| 77 | { | 75 | { |
| 78 | unsigned long l,d[2]; | 76 | unsigned long l,d[2]; |
| 79 | 77 | ||
diff --git a/src/lib/libcrypto/rc2/rc2_skey.c b/src/lib/libcrypto/rc2/rc2_skey.c index 0f1f253395..7143c4e591 100644 --- a/src/lib/libcrypto/rc2/rc2_skey.c +++ b/src/lib/libcrypto/rc2/rc2_skey.c | |||
| @@ -56,7 +56,7 @@ | |||
| 56 | * [including the GNU Public Licence.] | 56 | * [including the GNU Public Licence.] |
| 57 | */ | 57 | */ |
| 58 | 58 | ||
| 59 | #include "rc2.h" | 59 | #include <openssl/rc2.h> |
| 60 | #include "rc2_locl.h" | 60 | #include "rc2_locl.h" |
| 61 | 61 | ||
| 62 | static unsigned char key_table[256]={ | 62 | static unsigned char key_table[256]={ |
| @@ -90,11 +90,7 @@ static unsigned char key_table[256]={ | |||
| 90 | * BSAFE uses the 'retarded' version. What I previously shipped is | 90 | * BSAFE uses the 'retarded' version. What I previously shipped is |
| 91 | * the same as specifying 1024 for the 'bits' parameter. Bsafe uses | 91 | * the same as specifying 1024 for the 'bits' parameter. Bsafe uses |
| 92 | * a version where the bits parameter is the same as len*8 */ | 92 | * a version where the bits parameter is the same as len*8 */ |
| 93 | void RC2_set_key(key,len,data,bits) | 93 | void RC2_set_key(RC2_KEY *key, int len, unsigned char *data, int bits) |
| 94 | RC2_KEY *key; | ||
| 95 | int len; | ||
| 96 | unsigned char *data; | ||
| 97 | int bits; | ||
| 98 | { | 94 | { |
| 99 | int i,j; | 95 | int i,j; |
| 100 | unsigned char *k; | 96 | unsigned char *k; |
diff --git a/src/lib/libcrypto/rc2/rc2cfb64.c b/src/lib/libcrypto/rc2/rc2cfb64.c index d409fb77e9..5e3fa07d90 100644 --- a/src/lib/libcrypto/rc2/rc2cfb64.c +++ b/src/lib/libcrypto/rc2/rc2cfb64.c | |||
| @@ -56,7 +56,7 @@ | |||
| 56 | * [including the GNU Public Licence.] | 56 | * [including the GNU Public Licence.] |
| 57 | */ | 57 | */ |
| 58 | 58 | ||
| 59 | #include "rc2.h" | 59 | #include <openssl/rc2.h> |
| 60 | #include "rc2_locl.h" | 60 | #include "rc2_locl.h" |
| 61 | 61 | ||
| 62 | /* The input and output encrypted as though 64bit cfb mode is being | 62 | /* The input and output encrypted as though 64bit cfb mode is being |
| @@ -64,14 +64,8 @@ | |||
| 64 | * 64bit block we have used is contained in *num; | 64 | * 64bit block we have used is contained in *num; |
| 65 | */ | 65 | */ |
| 66 | 66 | ||
| 67 | void RC2_cfb64_encrypt(in, out, length, schedule, ivec, num, encrypt) | 67 | void RC2_cfb64_encrypt(unsigned char *in, unsigned char *out, long length, |
| 68 | unsigned char *in; | 68 | RC2_KEY *schedule, unsigned char *ivec, int *num, int encrypt) |
| 69 | unsigned char *out; | ||
| 70 | long length; | ||
| 71 | RC2_KEY *schedule; | ||
| 72 | unsigned char *ivec; | ||
| 73 | int *num; | ||
| 74 | int encrypt; | ||
| 75 | { | 69 | { |
| 76 | register unsigned long v0,v1,t; | 70 | register unsigned long v0,v1,t; |
| 77 | register int n= *num; | 71 | register int n= *num; |
diff --git a/src/lib/libcrypto/rc2/rc2ofb64.c b/src/lib/libcrypto/rc2/rc2ofb64.c index 4f09167447..42cdd40cdd 100644 --- a/src/lib/libcrypto/rc2/rc2ofb64.c +++ b/src/lib/libcrypto/rc2/rc2ofb64.c | |||
| @@ -56,20 +56,15 @@ | |||
| 56 | * [including the GNU Public Licence.] | 56 | * [including the GNU Public Licence.] |
| 57 | */ | 57 | */ |
| 58 | 58 | ||
| 59 | #include "rc2.h" | 59 | #include <openssl/rc2.h> |
| 60 | #include "rc2_locl.h" | 60 | #include "rc2_locl.h" |
| 61 | 61 | ||
| 62 | /* The input and output encrypted as though 64bit ofb mode is being | 62 | /* The input and output encrypted as though 64bit ofb mode is being |
| 63 | * used. The extra state information to record how much of the | 63 | * used. The extra state information to record how much of the |
| 64 | * 64bit block we have used is contained in *num; | 64 | * 64bit block we have used is contained in *num; |
| 65 | */ | 65 | */ |
| 66 | void RC2_ofb64_encrypt(in, out, length, schedule, ivec, num) | 66 | void RC2_ofb64_encrypt(unsigned char *in, unsigned char *out, long length, |
| 67 | unsigned char *in; | 67 | RC2_KEY *schedule, unsigned char *ivec, int *num) |
| 68 | unsigned char *out; | ||
| 69 | long length; | ||
| 70 | RC2_KEY *schedule; | ||
| 71 | unsigned char *ivec; | ||
| 72 | int *num; | ||
| 73 | { | 68 | { |
| 74 | register unsigned long v0,v1,t; | 69 | register unsigned long v0,v1,t; |
| 75 | register int n= *num; | 70 | register int n= *num; |
diff --git a/src/lib/libcrypto/rc2/rc2speed.c b/src/lib/libcrypto/rc2/rc2speed.c index 6cd8ea8f27..c3da63e77e 100644 --- a/src/lib/libcrypto/rc2/rc2speed.c +++ b/src/lib/libcrypto/rc2/rc2speed.c | |||
| @@ -59,19 +59,17 @@ | |||
| 59 | /* 11-Sep-92 Andrew Daviel Support for Silicon Graphics IRIX added */ | 59 | /* 11-Sep-92 Andrew Daviel Support for Silicon Graphics IRIX added */ |
| 60 | /* 06-Apr-92 Luke Brennan Support for VMS and add extra signal calls */ | 60 | /* 06-Apr-92 Luke Brennan Support for VMS and add extra signal calls */ |
| 61 | 61 | ||
| 62 | #ifndef MSDOS | 62 | #if !defined(MSDOS) && (!defined(VMS) || defined(__DECC)) |
| 63 | #define TIMES | 63 | #define TIMES |
| 64 | #endif | 64 | #endif |
| 65 | 65 | ||
| 66 | #include <stdio.h> | 66 | #include <stdio.h> |
| 67 | #ifndef MSDOS | 67 | |
| 68 | #include <unistd.h> | 68 | #include <openssl/e_os2.h> |
| 69 | #else | 69 | #include OPENSSL_UNISTD_IO |
| 70 | #include <io.h> | 70 | OPENSSL_DECLARE_EXIT |
| 71 | extern int exit(); | 71 | |
| 72 | #endif | ||
| 73 | #include <signal.h> | 72 | #include <signal.h> |
| 74 | #ifndef VMS | ||
| 75 | #ifndef _IRIX | 73 | #ifndef _IRIX |
| 76 | #include <time.h> | 74 | #include <time.h> |
| 77 | #endif | 75 | #endif |
| @@ -79,48 +77,40 @@ extern int exit(); | |||
| 79 | #include <sys/types.h> | 77 | #include <sys/types.h> |
| 80 | #include <sys/times.h> | 78 | #include <sys/times.h> |
| 81 | #endif | 79 | #endif |
| 82 | #else /* VMS */ | 80 | |
| 83 | #include <types.h> | 81 | /* Depending on the VMS version, the tms structure is perhaps defined. |
| 84 | struct tms { | 82 | The __TMS macro will show if it was. If it wasn't defined, we should |
| 85 | time_t tms_utime; | 83 | undefine TIMES, since that tells the rest of the program how things |
| 86 | time_t tms_stime; | 84 | should be handled. -- Richard Levitte */ |
| 87 | time_t tms_uchild; /* I dunno... */ | 85 | #if defined(VMS) && defined(__DECC) && !defined(__TMS) |
| 88 | time_t tms_uchildsys; /* so these names are a guess :-) */ | 86 | #undef TIMES |
| 89 | } | ||
| 90 | #endif | 87 | #endif |
| 88 | |||
| 91 | #ifndef TIMES | 89 | #ifndef TIMES |
| 92 | #include <sys/timeb.h> | 90 | #include <sys/timeb.h> |
| 93 | #endif | 91 | #endif |
| 94 | 92 | ||
| 95 | #ifdef sun | 93 | #if defined(sun) || defined(__ultrix) |
| 94 | #define _POSIX_SOURCE | ||
| 96 | #include <limits.h> | 95 | #include <limits.h> |
| 97 | #include <sys/param.h> | 96 | #include <sys/param.h> |
| 98 | #endif | 97 | #endif |
| 99 | 98 | ||
| 100 | #include "rc2.h" | 99 | #include <openssl/rc2.h> |
| 101 | 100 | ||
| 102 | /* The following if from times(3) man page. It may need to be changed */ | 101 | /* The following if from times(3) man page. It may need to be changed */ |
| 103 | #ifndef HZ | 102 | #ifndef HZ |
| 104 | #ifndef CLK_TCK | 103 | #ifndef CLK_TCK |
| 105 | #ifndef VMS | ||
| 106 | #define HZ 100.0 | ||
| 107 | #else /* VMS */ | ||
| 108 | #define HZ 100.0 | 104 | #define HZ 100.0 |
| 109 | #endif | 105 | #endif |
| 110 | #else /* CLK_TCK */ | 106 | #else /* CLK_TCK */ |
| 111 | #define HZ ((double)CLK_TCK) | 107 | #define HZ ((double)CLK_TCK) |
| 112 | #endif | 108 | #endif |
| 113 | #endif | ||
| 114 | 109 | ||
| 115 | #define BUFSIZE ((long)1024) | 110 | #define BUFSIZE ((long)1024) |
| 116 | long run=0; | 111 | long run=0; |
| 117 | 112 | ||
| 118 | #ifndef NOPROTO | ||
| 119 | double Time_F(int s); | 113 | double Time_F(int s); |
| 120 | #else | ||
| 121 | double Time_F(); | ||
| 122 | #endif | ||
| 123 | |||
| 124 | #ifdef SIGALRM | 114 | #ifdef SIGALRM |
| 125 | #if defined(__STDC__) || defined(sgi) || defined(_AIX) | 115 | #if defined(__STDC__) || defined(sgi) || defined(_AIX) |
| 126 | #define SIGRETTYPE void | 116 | #define SIGRETTYPE void |
| @@ -128,14 +118,8 @@ double Time_F(); | |||
| 128 | #define SIGRETTYPE int | 118 | #define SIGRETTYPE int |
| 129 | #endif | 119 | #endif |
| 130 | 120 | ||
| 131 | #ifndef NOPROTO | ||
| 132 | SIGRETTYPE sig_done(int sig); | 121 | SIGRETTYPE sig_done(int sig); |
| 133 | #else | 122 | SIGRETTYPE sig_done(int sig) |
| 134 | SIGRETTYPE sig_done(); | ||
| 135 | #endif | ||
| 136 | |||
| 137 | SIGRETTYPE sig_done(sig) | ||
| 138 | int sig; | ||
| 139 | { | 123 | { |
| 140 | signal(SIGALRM,sig_done); | 124 | signal(SIGALRM,sig_done); |
| 141 | run=0; | 125 | run=0; |
| @@ -148,8 +132,7 @@ int sig; | |||
| 148 | #define START 0 | 132 | #define START 0 |
| 149 | #define STOP 1 | 133 | #define STOP 1 |
| 150 | 134 | ||
| 151 | double Time_F(s) | 135 | double Time_F(int s) |
| 152 | int s; | ||
| 153 | { | 136 | { |
| 154 | double ret; | 137 | double ret; |
| 155 | #ifdef TIMES | 138 | #ifdef TIMES |
| @@ -185,9 +168,7 @@ int s; | |||
| 185 | #endif | 168 | #endif |
| 186 | } | 169 | } |
| 187 | 170 | ||
| 188 | int main(argc,argv) | 171 | int main(int argc, char **argv) |
| 189 | int argc; | ||
| 190 | char **argv; | ||
| 191 | { | 172 | { |
| 192 | long count; | 173 | long count; |
| 193 | static unsigned char buf[BUFSIZE]; | 174 | static unsigned char buf[BUFSIZE]; |
diff --git a/src/lib/libcrypto/rc2/rc2test.c b/src/lib/libcrypto/rc2/rc2test.c index 9d0f8016ec..6a5defa6ea 100644 --- a/src/lib/libcrypto/rc2/rc2test.c +++ b/src/lib/libcrypto/rc2/rc2test.c | |||
| @@ -62,7 +62,15 @@ | |||
| 62 | #include <stdio.h> | 62 | #include <stdio.h> |
| 63 | #include <string.h> | 63 | #include <string.h> |
| 64 | #include <stdlib.h> | 64 | #include <stdlib.h> |
| 65 | #include "rc2.h" | 65 | |
| 66 | #ifdef NO_RC2 | ||
| 67 | int main(int argc, char *argv[]) | ||
| 68 | { | ||
| 69 | printf("No RC2 support\n"); | ||
| 70 | return(0); | ||
| 71 | } | ||
| 72 | #else | ||
| 73 | #include <openssl/rc2.h> | ||
| 66 | 74 | ||
| 67 | unsigned char RC2key[4][16]={ | 75 | unsigned char RC2key[4][16]={ |
| 68 | {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, | 76 | {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, |
| @@ -125,19 +133,11 @@ static unsigned char cfb_cipher64[CFB_TEST_SIZE]={ | |||
| 125 | }; | 133 | }; |
| 126 | 134 | ||
| 127 | 135 | ||
| 128 | #ifndef NOPROTO | ||
| 129 | /*static int cfb64_test(unsigned char *cfb_cipher);*/ | 136 | /*static int cfb64_test(unsigned char *cfb_cipher);*/ |
| 130 | static char *pt(unsigned char *p); | 137 | static char *pt(unsigned char *p); |
| 131 | #else | ||
| 132 | /*static int cfb64_test(); */ | ||
| 133 | static char *pt(); | ||
| 134 | #endif | 138 | #endif |
| 135 | 139 | ||
| 136 | #endif | 140 | int main(int argc, char *argv[]) |
| 137 | |||
| 138 | int main(argc,argv) | ||
| 139 | int argc; | ||
| 140 | char *argv[]; | ||
| 141 | { | 141 | { |
| 142 | int i,n,err=0; | 142 | int i,n,err=0; |
| 143 | RC2_KEY key; | 143 | RC2_KEY key; |
| @@ -208,8 +208,7 @@ char *argv[]; | |||
| 208 | } | 208 | } |
| 209 | 209 | ||
| 210 | #ifdef undef | 210 | #ifdef undef |
| 211 | static int cfb64_test(cfb_cipher) | 211 | static int cfb64_test(unsigned char *cfb_cipher) |
| 212 | unsigned char *cfb_cipher; | ||
| 213 | { | 212 | { |
| 214 | IDEA_KEY_SCHEDULE eks,dks; | 213 | IDEA_KEY_SCHEDULE eks,dks; |
| 215 | int err=0,i,n; | 214 | int err=0,i,n; |
| @@ -247,8 +246,7 @@ unsigned char *cfb_cipher; | |||
| 247 | return(err); | 246 | return(err); |
| 248 | } | 247 | } |
| 249 | 248 | ||
| 250 | static char *pt(p) | 249 | static char *pt(unsigned char *p) |
| 251 | unsigned char *p; | ||
| 252 | { | 250 | { |
| 253 | static char bufs[10][20]; | 251 | static char bufs[10][20]; |
| 254 | static int bnum=0; | 252 | static int bnum=0; |
| @@ -268,3 +266,4 @@ unsigned char *p; | |||
| 268 | } | 266 | } |
| 269 | 267 | ||
| 270 | #endif | 268 | #endif |
| 269 | #endif | ||
diff --git a/src/lib/libcrypto/rc2/tab.c b/src/lib/libcrypto/rc2/tab.c new file mode 100644 index 0000000000..25dc14eeba --- /dev/null +++ b/src/lib/libcrypto/rc2/tab.c | |||
| @@ -0,0 +1,86 @@ | |||
| 1 | #include <stdio.h> | ||
| 2 | |||
| 3 | unsigned char ebits_to_num[256]={ | ||
| 4 | 0xbd,0x56,0xea,0xf2,0xa2,0xf1,0xac,0x2a, | ||
| 5 | 0xb0,0x93,0xd1,0x9c,0x1b,0x33,0xfd,0xd0, | ||
| 6 | 0x30,0x04,0xb6,0xdc,0x7d,0xdf,0x32,0x4b, | ||
| 7 | 0xf7,0xcb,0x45,0x9b,0x31,0xbb,0x21,0x5a, | ||
| 8 | 0x41,0x9f,0xe1,0xd9,0x4a,0x4d,0x9e,0xda, | ||
| 9 | 0xa0,0x68,0x2c,0xc3,0x27,0x5f,0x80,0x36, | ||
| 10 | 0x3e,0xee,0xfb,0x95,0x1a,0xfe,0xce,0xa8, | ||
| 11 | 0x34,0xa9,0x13,0xf0,0xa6,0x3f,0xd8,0x0c, | ||
| 12 | 0x78,0x24,0xaf,0x23,0x52,0xc1,0x67,0x17, | ||
| 13 | 0xf5,0x66,0x90,0xe7,0xe8,0x07,0xb8,0x60, | ||
| 14 | 0x48,0xe6,0x1e,0x53,0xf3,0x92,0xa4,0x72, | ||
| 15 | 0x8c,0x08,0x15,0x6e,0x86,0x00,0x84,0xfa, | ||
| 16 | 0xf4,0x7f,0x8a,0x42,0x19,0xf6,0xdb,0xcd, | ||
| 17 | 0x14,0x8d,0x50,0x12,0xba,0x3c,0x06,0x4e, | ||
| 18 | 0xec,0xb3,0x35,0x11,0xa1,0x88,0x8e,0x2b, | ||
| 19 | 0x94,0x99,0xb7,0x71,0x74,0xd3,0xe4,0xbf, | ||
| 20 | 0x3a,0xde,0x96,0x0e,0xbc,0x0a,0xed,0x77, | ||
| 21 | 0xfc,0x37,0x6b,0x03,0x79,0x89,0x62,0xc6, | ||
| 22 | 0xd7,0xc0,0xd2,0x7c,0x6a,0x8b,0x22,0xa3, | ||
| 23 | 0x5b,0x05,0x5d,0x02,0x75,0xd5,0x61,0xe3, | ||
| 24 | 0x18,0x8f,0x55,0x51,0xad,0x1f,0x0b,0x5e, | ||
| 25 | 0x85,0xe5,0xc2,0x57,0x63,0xca,0x3d,0x6c, | ||
| 26 | 0xb4,0xc5,0xcc,0x70,0xb2,0x91,0x59,0x0d, | ||
| 27 | 0x47,0x20,0xc8,0x4f,0x58,0xe0,0x01,0xe2, | ||
| 28 | 0x16,0x38,0xc4,0x6f,0x3b,0x0f,0x65,0x46, | ||
| 29 | 0xbe,0x7e,0x2d,0x7b,0x82,0xf9,0x40,0xb5, | ||
| 30 | 0x1d,0x73,0xf8,0xeb,0x26,0xc7,0x87,0x97, | ||
| 31 | 0x25,0x54,0xb1,0x28,0xaa,0x98,0x9d,0xa5, | ||
| 32 | 0x64,0x6d,0x7a,0xd4,0x10,0x81,0x44,0xef, | ||
| 33 | 0x49,0xd6,0xae,0x2e,0xdd,0x76,0x5c,0x2f, | ||
| 34 | 0xa7,0x1c,0xc9,0x09,0x69,0x9a,0x83,0xcf, | ||
| 35 | 0x29,0x39,0xb9,0xe9,0x4c,0xff,0x43,0xab, | ||
| 36 | }; | ||
| 37 | |||
| 38 | unsigned char num_to_ebits[256]={ | ||
| 39 | 0x5d,0xbe,0x9b,0x8b,0x11,0x99,0x6e,0x4d, | ||
| 40 | 0x59,0xf3,0x85,0xa6,0x3f,0xb7,0x83,0xc5, | ||
| 41 | 0xe4,0x73,0x6b,0x3a,0x68,0x5a,0xc0,0x47, | ||
| 42 | 0xa0,0x64,0x34,0x0c,0xf1,0xd0,0x52,0xa5, | ||
| 43 | 0xb9,0x1e,0x96,0x43,0x41,0xd8,0xd4,0x2c, | ||
| 44 | 0xdb,0xf8,0x07,0x77,0x2a,0xca,0xeb,0xef, | ||
| 45 | 0x10,0x1c,0x16,0x0d,0x38,0x72,0x2f,0x89, | ||
| 46 | 0xc1,0xf9,0x80,0xc4,0x6d,0xae,0x30,0x3d, | ||
| 47 | 0xce,0x20,0x63,0xfe,0xe6,0x1a,0xc7,0xb8, | ||
| 48 | 0x50,0xe8,0x24,0x17,0xfc,0x25,0x6f,0xbb, | ||
| 49 | 0x6a,0xa3,0x44,0x53,0xd9,0xa2,0x01,0xab, | ||
| 50 | 0xbc,0xb6,0x1f,0x98,0xee,0x9a,0xa7,0x2d, | ||
| 51 | 0x4f,0x9e,0x8e,0xac,0xe0,0xc6,0x49,0x46, | ||
| 52 | 0x29,0xf4,0x94,0x8a,0xaf,0xe1,0x5b,0xc3, | ||
| 53 | 0xb3,0x7b,0x57,0xd1,0x7c,0x9c,0xed,0x87, | ||
| 54 | 0x40,0x8c,0xe2,0xcb,0x93,0x14,0xc9,0x61, | ||
| 55 | 0x2e,0xe5,0xcc,0xf6,0x5e,0xa8,0x5c,0xd6, | ||
| 56 | 0x75,0x8d,0x62,0x95,0x58,0x69,0x76,0xa1, | ||
| 57 | 0x4a,0xb5,0x55,0x09,0x78,0x33,0x82,0xd7, | ||
| 58 | 0xdd,0x79,0xf5,0x1b,0x0b,0xde,0x26,0x21, | ||
| 59 | 0x28,0x74,0x04,0x97,0x56,0xdf,0x3c,0xf0, | ||
| 60 | 0x37,0x39,0xdc,0xff,0x06,0xa4,0xea,0x42, | ||
| 61 | 0x08,0xda,0xb4,0x71,0xb0,0xcf,0x12,0x7a, | ||
| 62 | 0x4e,0xfa,0x6c,0x1d,0x84,0x00,0xc8,0x7f, | ||
| 63 | 0x91,0x45,0xaa,0x2b,0xc2,0xb1,0x8f,0xd5, | ||
| 64 | 0xba,0xf2,0xad,0x19,0xb2,0x67,0x36,0xf7, | ||
| 65 | 0x0f,0x0a,0x92,0x7d,0xe3,0x9d,0xe9,0x90, | ||
| 66 | 0x3e,0x23,0x27,0x66,0x13,0xec,0x81,0x15, | ||
| 67 | 0xbd,0x22,0xbf,0x9f,0x7e,0xa9,0x51,0x4b, | ||
| 68 | 0x4c,0xfb,0x02,0xd3,0x70,0x86,0x31,0xe7, | ||
| 69 | 0x3b,0x05,0x03,0x54,0x60,0x48,0x65,0x18, | ||
| 70 | 0xd2,0xcd,0x5f,0x32,0x88,0x0e,0x35,0xfd, | ||
| 71 | }; | ||
| 72 | |||
| 73 | main() | ||
| 74 | { | ||
| 75 | int i,j; | ||
| 76 | |||
| 77 | for (i=0; i<256; i++) | ||
| 78 | { | ||
| 79 | for (j=0; j<256; j++) | ||
| 80 | if (ebits_to_num[j] == i) | ||
| 81 | { | ||
| 82 | printf("0x%02x,",j); | ||
| 83 | break; | ||
| 84 | } | ||
| 85 | } | ||
| 86 | } | ||
