diff options
author | markus <> | 2004-04-08 08:03:15 +0000 |
---|---|---|
committer | markus <> | 2004-04-08 08:03:15 +0000 |
commit | 40d673554117d24c9f46be721235d3e302c06e04 (patch) | |
tree | 341e7f38b840f3e503afb6e471123c0f2ba082c3 /src/lib/libcrypto/des | |
parent | cbf88de39286be06cd20e0c65b6cb7633dce25a5 (diff) | |
download | openbsd-40d673554117d24c9f46be721235d3e302c06e04.tar.gz openbsd-40d673554117d24c9f46be721235d3e302c06e04.tar.bz2 openbsd-40d673554117d24c9f46be721235d3e302c06e04.zip |
merge 0.9.7d
Diffstat (limited to 'src/lib/libcrypto/des')
-rw-r--r-- | src/lib/libcrypto/des/Makefile.ssl | 28 | ||||
-rw-r--r-- | src/lib/libcrypto/des/cfb_enc.c | 21 | ||||
-rw-r--r-- | src/lib/libcrypto/des/ecb_enc.c | 5 |
3 files changed, 28 insertions, 26 deletions
diff --git a/src/lib/libcrypto/des/Makefile.ssl b/src/lib/libcrypto/des/Makefile.ssl index 45eba0b3c9..0d9ba2b42f 100644 --- a/src/lib/libcrypto/des/Makefile.ssl +++ b/src/lib/libcrypto/des/Makefile.ssl | |||
@@ -22,6 +22,7 @@ DES_ENC= des_enc.o fcrypt_b.o | |||
22 | #DES_ENC= dx86-elf.o yx86-elf.o | 22 | #DES_ENC= dx86-elf.o yx86-elf.o |
23 | 23 | ||
24 | CFLAGS= $(INCLUDES) $(CFLAG) | 24 | CFLAGS= $(INCLUDES) $(CFLAG) |
25 | ASFLAGS= $(INCLUDES) $(ASFLAG) | ||
25 | 26 | ||
26 | GENERAL=Makefile | 27 | GENERAL=Makefile |
27 | TEST=destest.c | 28 | TEST=destest.c |
@@ -157,12 +158,13 @@ cfb64enc.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h | |||
157 | cfb64enc.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | 158 | cfb64enc.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h |
158 | cfb64enc.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h | 159 | cfb64enc.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h |
159 | cfb64enc.o: cfb64enc.c des_locl.h | 160 | cfb64enc.o: cfb64enc.c des_locl.h |
160 | cfb_enc.o: ../../include/openssl/crypto.h ../../include/openssl/des.h | 161 | cfb_enc.o: ../../e_os.h ../../include/openssl/crypto.h |
161 | cfb_enc.o: ../../include/openssl/des_old.h ../../include/openssl/e_os2.h | 162 | cfb_enc.o: ../../include/openssl/des.h ../../include/openssl/des_old.h |
162 | cfb_enc.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | 163 | cfb_enc.o: ../../include/openssl/e_os2.h ../../include/openssl/opensslconf.h |
163 | cfb_enc.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | 164 | cfb_enc.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h |
164 | cfb_enc.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h | 165 | cfb_enc.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h |
165 | cfb_enc.o: ../../include/openssl/ui_compat.h cfb_enc.c des_locl.h | 166 | cfb_enc.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h |
167 | cfb_enc.o: cfb_enc.c des_locl.h | ||
166 | des_enc.o: ../../include/openssl/crypto.h ../../include/openssl/des.h | 168 | des_enc.o: ../../include/openssl/crypto.h ../../include/openssl/des.h |
167 | des_enc.o: ../../include/openssl/des_old.h ../../include/openssl/e_os2.h | 169 | des_enc.o: ../../include/openssl/des_old.h ../../include/openssl/e_os2.h |
168 | des_enc.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | 170 | des_enc.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h |
@@ -191,13 +193,13 @@ ecb3_enc.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h | |||
191 | ecb3_enc.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | 193 | ecb3_enc.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h |
192 | ecb3_enc.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h | 194 | ecb3_enc.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h |
193 | ecb3_enc.o: des_locl.h ecb3_enc.c | 195 | ecb3_enc.o: des_locl.h ecb3_enc.c |
194 | ecb_enc.o: ../../include/openssl/crypto.h ../../include/openssl/des.h | 196 | ecb_enc.o: ../../include/openssl/bio.h ../../include/openssl/crypto.h |
195 | ecb_enc.o: ../../include/openssl/des_old.h ../../include/openssl/e_os2.h | 197 | ecb_enc.o: ../../include/openssl/des.h ../../include/openssl/des_old.h |
196 | ecb_enc.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | 198 | ecb_enc.o: ../../include/openssl/e_os2.h ../../include/openssl/opensslconf.h |
197 | ecb_enc.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | 199 | ecb_enc.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h |
198 | ecb_enc.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h | 200 | ecb_enc.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h |
199 | ecb_enc.o: ../../include/openssl/ui_compat.h des_locl.h des_ver.h ecb_enc.c | 201 | ecb_enc.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h |
200 | ecb_enc.o: spr.h | 202 | ecb_enc.o: des_locl.h des_ver.h ecb_enc.c spr.h |
201 | ede_cbcm_enc.o: ../../include/openssl/crypto.h ../../include/openssl/des.h | 203 | ede_cbcm_enc.o: ../../include/openssl/crypto.h ../../include/openssl/des.h |
202 | ede_cbcm_enc.o: ../../include/openssl/des_old.h ../../include/openssl/e_os2.h | 204 | ede_cbcm_enc.o: ../../include/openssl/des_old.h ../../include/openssl/e_os2.h |
203 | ede_cbcm_enc.o: ../../include/openssl/opensslconf.h | 205 | ede_cbcm_enc.o: ../../include/openssl/opensslconf.h |
diff --git a/src/lib/libcrypto/des/cfb_enc.c b/src/lib/libcrypto/des/cfb_enc.c index 2600bdfc93..03cabb223c 100644 --- a/src/lib/libcrypto/des/cfb_enc.c +++ b/src/lib/libcrypto/des/cfb_enc.c | |||
@@ -56,6 +56,7 @@ | |||
56 | * [including the GNU Public Licence.] | 56 | * [including the GNU Public Licence.] |
57 | */ | 57 | */ |
58 | 58 | ||
59 | #include "e_os.h" | ||
59 | #include "des_locl.h" | 60 | #include "des_locl.h" |
60 | 61 | ||
61 | /* The input and output are loaded in multiples of 8 bits. | 62 | /* The input and output are loaded in multiples of 8 bits. |
@@ -64,17 +65,15 @@ | |||
64 | * the second. The second 12 bits will come from the 3rd and half the 4th | 65 | * the second. The second 12 bits will come from the 3rd and half the 4th |
65 | * byte. | 66 | * byte. |
66 | */ | 67 | */ |
67 | /* WARNING WARNING: this uses in and out in 8-byte chunks regardless of | ||
68 | * length */ | ||
69 | /* Until Aug 1 2003 this function did not correctly implement CFB-r, so it | 68 | /* Until Aug 1 2003 this function did not correctly implement CFB-r, so it |
70 | * will not be compatible with any encryption prior to that date. Ben. */ | 69 | * will not be compatible with any encryption prior to that date. Ben. */ |
71 | void DES_cfb_encrypt(const unsigned char *in, unsigned char *out, int numbits, | 70 | void DES_cfb_encrypt(const unsigned char *in, unsigned char *out, int numbits, |
72 | long length, DES_key_schedule *schedule, DES_cblock *ivec, | 71 | long length, DES_key_schedule *schedule, DES_cblock *ivec, |
73 | int enc) | 72 | int enc) |
74 | { | 73 | { |
75 | register DES_LONG d0,d1,v0,v1,n=(numbits+7)/8; | 74 | register DES_LONG d0,d1,v0,v1; |
76 | register unsigned long l=length; | 75 | register unsigned long l=length,n=(numbits+7)/8; |
77 | register int num=numbits; | 76 | register int num=numbits,i; |
78 | DES_LONG ti[2]; | 77 | DES_LONG ti[2]; |
79 | unsigned char *iv; | 78 | unsigned char *iv; |
80 | unsigned char ovec[16]; | 79 | unsigned char ovec[16]; |
@@ -114,10 +113,10 @@ void DES_cfb_encrypt(const unsigned char *in, unsigned char *out, int numbits, | |||
114 | memmove(ovec,ovec+num/8,8+(num%8 ? 1 : 0)); | 113 | memmove(ovec,ovec+num/8,8+(num%8 ? 1 : 0)); |
115 | /* now the remaining bits */ | 114 | /* now the remaining bits */ |
116 | if(num%8 != 0) | 115 | if(num%8 != 0) |
117 | for(n=0 ; n < 8 ; ++n) | 116 | for(i=0 ; i < 8 ; ++i) |
118 | { | 117 | { |
119 | ovec[n]<<=num%8; | 118 | ovec[i]<<=num%8; |
120 | ovec[n]|=ovec[n+1]>>(8-num%8); | 119 | ovec[i]|=ovec[i+1]>>(8-num%8); |
121 | } | 120 | } |
122 | iv=&ovec[0]; | 121 | iv=&ovec[0]; |
123 | c2l(iv,v0); | 122 | c2l(iv,v0); |
@@ -152,10 +151,10 @@ void DES_cfb_encrypt(const unsigned char *in, unsigned char *out, int numbits, | |||
152 | memmove(ovec,ovec+num/8,8+(num%8 ? 1 : 0)); | 151 | memmove(ovec,ovec+num/8,8+(num%8 ? 1 : 0)); |
153 | /* now the remaining bits */ | 152 | /* now the remaining bits */ |
154 | if(num%8 != 0) | 153 | if(num%8 != 0) |
155 | for(n=0 ; n < 8 ; ++n) | 154 | for(i=0 ; i < 8 ; ++i) |
156 | { | 155 | { |
157 | ovec[n]<<=num%8; | 156 | ovec[i]<<=num%8; |
158 | ovec[n]|=ovec[n+1]>>(8-num%8); | 157 | ovec[i]|=ovec[i+1]>>(8-num%8); |
159 | } | 158 | } |
160 | iv=&ovec[0]; | 159 | iv=&ovec[0]; |
161 | c2l(iv,v0); | 160 | c2l(iv,v0); |
diff --git a/src/lib/libcrypto/des/ecb_enc.c b/src/lib/libcrypto/des/ecb_enc.c index c828bdd45d..784aa5ba23 100644 --- a/src/lib/libcrypto/des/ecb_enc.c +++ b/src/lib/libcrypto/des/ecb_enc.c | |||
@@ -60,6 +60,7 @@ | |||
60 | #include "des_ver.h" | 60 | #include "des_ver.h" |
61 | #include "spr.h" | 61 | #include "spr.h" |
62 | #include <openssl/opensslv.h> | 62 | #include <openssl/opensslv.h> |
63 | #include <openssl/bio.h> | ||
63 | 64 | ||
64 | OPENSSL_GLOBAL const char *libdes_version="libdes" OPENSSL_VERSION_PTEXT; | 65 | OPENSSL_GLOBAL const char *libdes_version="libdes" OPENSSL_VERSION_PTEXT; |
65 | OPENSSL_GLOBAL const char *DES_version="DES" OPENSSL_VERSION_PTEXT; | 66 | OPENSSL_GLOBAL const char *DES_version="DES" OPENSSL_VERSION_PTEXT; |
@@ -97,8 +98,8 @@ const char *DES_options(void) | |||
97 | size="int"; | 98 | size="int"; |
98 | else | 99 | else |
99 | size="long"; | 100 | size="long"; |
100 | snprintf(buf,sizeof buf,"des(%s,%s,%s,%s)",ptr,risc,unroll, | 101 | BIO_snprintf(buf,sizeof buf,"des(%s,%s,%s,%s)",ptr,risc,unroll, |
101 | size); | 102 | size); |
102 | init=0; | 103 | init=0; |
103 | } | 104 | } |
104 | return(buf); | 105 | return(buf); |