diff options
author | beck <> | 2002-05-15 02:29:21 +0000 |
---|---|---|
committer | beck <> | 2002-05-15 02:29:21 +0000 |
commit | b64270d1e45fe7f3241e4c9b6ce60d5ac89bc2e9 (patch) | |
tree | fa27cf82a1250b64ed3bf5f4a18c7354d470bbcc /src/lib/libcrypto/des | |
parent | e471e1ea98d673597b182ea85f29e30c97cd08b5 (diff) | |
download | openbsd-b64270d1e45fe7f3241e4c9b6ce60d5ac89bc2e9.tar.gz openbsd-b64270d1e45fe7f3241e4c9b6ce60d5ac89bc2e9.tar.bz2 openbsd-b64270d1e45fe7f3241e4c9b6ce60d5ac89bc2e9.zip |
OpenSSL 0.9.7 stable 2002 05 08 merge
Diffstat (limited to 'src/lib/libcrypto/des')
44 files changed, 1829 insertions, 819 deletions
diff --git a/src/lib/libcrypto/des/Makefile.ssl b/src/lib/libcrypto/des/Makefile.ssl index cc5379feb2..04a73a9326 100644 --- a/src/lib/libcrypto/des/Makefile.ssl +++ b/src/lib/libcrypto/des/Makefile.ssl | |||
@@ -6,13 +6,14 @@ DIR= des | |||
6 | TOP= ../.. | 6 | TOP= ../.. |
7 | CC= cc | 7 | CC= cc |
8 | CPP= $(CC) -E | 8 | CPP= $(CC) -E |
9 | INCLUDES=-I../../include | 9 | INCLUDES=-I$(TOP) -I../../include |
10 | CFLAG=-g | 10 | CFLAG=-g |
11 | INSTALL_PREFIX= | 11 | INSTALL_PREFIX= |
12 | OPENSSLDIR= /usr/local/ssl | 12 | OPENSSLDIR= /usr/local/ssl |
13 | INSTALLTOP=/usr/local/ssl | 13 | INSTALLTOP=/usr/local/ssl |
14 | MAKE= make -f Makefile.ssl | 14 | MAKE= make -f Makefile.ssl |
15 | MAKEDEPEND= $(TOP)/util/domd $(TOP) | 15 | MAKEDEPPROG= makedepend |
16 | MAKEDEPEND= $(TOP)/util/domd $(TOP) -MD $(MAKEDEPPROG) | ||
16 | MAKEFILE= Makefile.ssl | 17 | MAKEFILE= Makefile.ssl |
17 | AR= ar r | 18 | AR= ar r |
18 | RANLIB= ranlib | 19 | RANLIB= ranlib |
@@ -30,22 +31,23 @@ LIB=$(TOP)/libcrypto.a | |||
30 | LIBSRC= cbc_cksm.c cbc_enc.c cfb64enc.c cfb_enc.c \ | 31 | LIBSRC= cbc_cksm.c cbc_enc.c cfb64enc.c cfb_enc.c \ |
31 | ecb3_enc.c ecb_enc.c enc_read.c enc_writ.c \ | 32 | ecb3_enc.c ecb_enc.c enc_read.c enc_writ.c \ |
32 | fcrypt.c ofb64enc.c ofb_enc.c pcbc_enc.c \ | 33 | fcrypt.c ofb64enc.c ofb_enc.c pcbc_enc.c \ |
33 | qud_cksm.c rand_key.c read_pwd.c rpc_enc.c set_key.c \ | 34 | qud_cksm.c rand_key.c rpc_enc.c set_key.c \ |
34 | des_enc.c fcrypt_b.c read2pwd.c \ | 35 | des_enc.c fcrypt_b.c \ |
35 | xcbc_enc.c \ | 36 | xcbc_enc.c \ |
36 | str2key.c cfb64ede.c ofb64ede.c ede_cbcm_enc.c | 37 | str2key.c cfb64ede.c ofb64ede.c ede_cbcm_enc.c des_old.c des_old2.c \ |
38 | read2pwd.c | ||
37 | 39 | ||
38 | LIBOBJ= set_key.o ecb_enc.o cbc_enc.o \ | 40 | LIBOBJ= set_key.o ecb_enc.o cbc_enc.o \ |
39 | ecb3_enc.o cfb64enc.o cfb64ede.o cfb_enc.o ofb64ede.o \ | 41 | ecb3_enc.o cfb64enc.o cfb64ede.o cfb_enc.o ofb64ede.o \ |
40 | enc_read.o enc_writ.o ofb64enc.o \ | 42 | enc_read.o enc_writ.o ofb64enc.o \ |
41 | ofb_enc.o str2key.o pcbc_enc.o qud_cksm.o rand_key.o \ | 43 | ofb_enc.o str2key.o pcbc_enc.o qud_cksm.o rand_key.o \ |
42 | ${DES_ENC} read2pwd.o \ | 44 | ${DES_ENC} \ |
43 | fcrypt.o xcbc_enc.o read_pwd.o rpc_enc.o cbc_cksm.o \ | 45 | fcrypt.o xcbc_enc.o rpc_enc.o cbc_cksm.o \ |
44 | ede_cbcm_enc.o | 46 | ede_cbcm_enc.o des_old.o des_old2.o read2pwd.o |
45 | 47 | ||
46 | SRC= $(LIBSRC) | 48 | SRC= $(LIBSRC) |
47 | 49 | ||
48 | EXHEADER= des.h | 50 | EXHEADER= des.h des_old.h |
49 | HEADER= des_locl.h rpc_des.h spr.h des_ver.h $(EXHEADER) | 51 | HEADER= des_locl.h rpc_des.h spr.h des_ver.h $(EXHEADER) |
50 | 52 | ||
51 | ALL= $(GENERAL) $(SRC) $(HEADER) | 53 | ALL= $(GENERAL) $(SRC) $(HEADER) |
@@ -57,8 +59,7 @@ all: lib | |||
57 | 59 | ||
58 | lib: $(LIBOBJ) | 60 | lib: $(LIBOBJ) |
59 | $(AR) $(LIB) $(LIBOBJ) | 61 | $(AR) $(LIB) $(LIBOBJ) |
60 | @echo You may get an error following this line. Please ignore. | 62 | $(RANLIB) $(LIB) || echo Never mind. |
61 | - $(RANLIB) $(LIB) | ||
62 | @touch lib | 63 | @touch lib |
63 | 64 | ||
64 | des: des.o cbc3_enc.o lib | 65 | des: des.o cbc3_enc.o lib |
@@ -141,72 +142,184 @@ clean: | |||
141 | 142 | ||
142 | # DO NOT DELETE THIS LINE -- make depend depends on it. | 143 | # DO NOT DELETE THIS LINE -- make depend depends on it. |
143 | 144 | ||
144 | cbc_cksm.o: ../../include/openssl/des.h ../../include/openssl/e_os2.h | 145 | cbc_cksm.o: ../../include/openssl/crypto.h ../../include/openssl/des.h |
145 | cbc_cksm.o: ../../include/openssl/opensslconf.h des_locl.h | 146 | cbc_cksm.o: ../../include/openssl/des_old.h ../../include/openssl/e_os2.h |
146 | cbc_enc.o: ../../include/openssl/des.h ../../include/openssl/e_os2.h | 147 | cbc_cksm.o: ../../include/openssl/opensslconf.h |
147 | cbc_enc.o: ../../include/openssl/opensslconf.h des_locl.h ncbc_enc.c | 148 | cbc_cksm.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h |
148 | cfb64ede.o: ../../include/openssl/des.h ../../include/openssl/e_os2.h | 149 | cbc_cksm.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h |
149 | cfb64ede.o: ../../include/openssl/opensslconf.h des_locl.h | 150 | cbc_cksm.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h |
150 | cfb64enc.o: ../../include/openssl/des.h ../../include/openssl/e_os2.h | 151 | cbc_cksm.o: cbc_cksm.c des_locl.h |
151 | cfb64enc.o: ../../include/openssl/opensslconf.h des_locl.h | 152 | cbc_enc.o: ../../include/openssl/crypto.h ../../include/openssl/des.h |
152 | cfb_enc.o: ../../include/openssl/des.h ../../include/openssl/e_os2.h | 153 | cbc_enc.o: ../../include/openssl/des_old.h ../../include/openssl/e_os2.h |
153 | cfb_enc.o: ../../include/openssl/opensslconf.h des_locl.h | 154 | cbc_enc.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h |
154 | des_enc.o: ../../include/openssl/des.h ../../include/openssl/e_os2.h | 155 | cbc_enc.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h |
155 | des_enc.o: ../../include/openssl/opensslconf.h des_locl.h des_locl.h ncbc_enc.c | 156 | cbc_enc.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h |
156 | ecb3_enc.o: ../../include/openssl/des.h ../../include/openssl/e_os2.h | 157 | cbc_enc.o: ../../include/openssl/ui_compat.h cbc_enc.c des_locl.h ncbc_enc.c |
157 | ecb3_enc.o: ../../include/openssl/opensslconf.h des_locl.h | 158 | cfb64ede.o: ../../include/openssl/crypto.h ../../include/openssl/des.h |
158 | ecb_enc.o: ../../include/openssl/des.h ../../include/openssl/e_os2.h | 159 | cfb64ede.o: ../../include/openssl/des_old.h ../../include/openssl/e_os2.h |
160 | cfb64ede.o: ../../include/openssl/opensslconf.h | ||
161 | cfb64ede.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h | ||
162 | cfb64ede.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
163 | cfb64ede.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h | ||
164 | cfb64ede.o: cfb64ede.c des_locl.h | ||
165 | cfb64enc.o: ../../include/openssl/crypto.h ../../include/openssl/des.h | ||
166 | cfb64enc.o: ../../include/openssl/des_old.h ../../include/openssl/e_os2.h | ||
167 | cfb64enc.o: ../../include/openssl/opensslconf.h | ||
168 | cfb64enc.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h | ||
169 | cfb64enc.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
170 | cfb64enc.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h | ||
171 | cfb64enc.o: cfb64enc.c des_locl.h | ||
172 | cfb_enc.o: ../../include/openssl/crypto.h ../../include/openssl/des.h | ||
173 | cfb_enc.o: ../../include/openssl/des_old.h ../../include/openssl/e_os2.h | ||
174 | cfb_enc.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
175 | cfb_enc.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
176 | cfb_enc.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h | ||
177 | cfb_enc.o: ../../include/openssl/ui_compat.h cfb_enc.c des_locl.h | ||
178 | des_enc.o: ../../include/openssl/crypto.h ../../include/openssl/des.h | ||
179 | des_enc.o: ../../include/openssl/des_old.h ../../include/openssl/e_os2.h | ||
180 | des_enc.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
181 | des_enc.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
182 | des_enc.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h | ||
183 | des_enc.o: ../../include/openssl/ui_compat.h des_enc.c des_locl.h ncbc_enc.c | ||
184 | des_old.o: ../../include/openssl/crypto.h ../../include/openssl/des.h | ||
185 | des_old.o: ../../include/openssl/des_old.h ../../include/openssl/e_os2.h | ||
186 | des_old.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
187 | des_old.o: ../../include/openssl/ossl_typ.h ../../include/openssl/rand.h | ||
188 | des_old.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
189 | des_old.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h | ||
190 | des_old.o: ../../include/openssl/ui_compat.h des_old.c | ||
191 | des_old2.o: ../../include/openssl/crypto.h ../../include/openssl/des.h | ||
192 | des_old2.o: ../../include/openssl/des_old.h ../../include/openssl/e_os2.h | ||
193 | des_old2.o: ../../include/openssl/opensslconf.h | ||
194 | des_old2.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
195 | des_old2.o: ../../include/openssl/rand.h ../../include/openssl/safestack.h | ||
196 | des_old2.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
197 | des_old2.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h | ||
198 | des_old2.o: des_old2.c | ||
199 | ecb3_enc.o: ../../include/openssl/crypto.h ../../include/openssl/des.h | ||
200 | ecb3_enc.o: ../../include/openssl/des_old.h ../../include/openssl/e_os2.h | ||
201 | ecb3_enc.o: ../../include/openssl/opensslconf.h | ||
202 | ecb3_enc.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h | ||
203 | ecb3_enc.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
204 | ecb3_enc.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h | ||
205 | ecb3_enc.o: des_locl.h ecb3_enc.c | ||
206 | ecb_enc.o: ../../include/openssl/crypto.h ../../include/openssl/des.h | ||
207 | ecb_enc.o: ../../include/openssl/des_old.h ../../include/openssl/e_os2.h | ||
159 | ecb_enc.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | 208 | ecb_enc.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h |
160 | ecb_enc.o: des_locl.h spr.h | 209 | ecb_enc.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h |
161 | ede_cbcm_enc.o: ../../include/openssl/des.h ../../include/openssl/e_os2.h | 210 | ecb_enc.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h |
162 | ede_cbcm_enc.o: ../../include/openssl/opensslconf.h des_locl.h | 211 | ecb_enc.o: ../../include/openssl/ui_compat.h des_locl.h ecb_enc.c spr.h |
163 | enc_read.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | 212 | ede_cbcm_enc.o: ../../include/openssl/crypto.h ../../include/openssl/des.h |
164 | enc_read.o: ../../include/openssl/crypto.h ../../include/openssl/des.h | 213 | ede_cbcm_enc.o: ../../include/openssl/des_old.h ../../include/openssl/e_os2.h |
165 | enc_read.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h | 214 | ede_cbcm_enc.o: ../../include/openssl/opensslconf.h |
166 | enc_read.o: ../../include/openssl/err.h ../../include/openssl/lhash.h | 215 | ede_cbcm_enc.o: ../../include/openssl/opensslv.h |
167 | enc_read.o: ../../include/openssl/opensslconf.h | 216 | ede_cbcm_enc.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h |
217 | ede_cbcm_enc.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h | ||
218 | ede_cbcm_enc.o: ../../include/openssl/ui_compat.h des_locl.h ede_cbcm_enc.c | ||
219 | enc_read.o: ../../e_os.h ../../include/openssl/bio.h | ||
220 | enc_read.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
221 | enc_read.o: ../../include/openssl/des.h ../../include/openssl/des_old.h | ||
222 | enc_read.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
223 | enc_read.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
168 | enc_read.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h | 224 | enc_read.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h |
169 | enc_read.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | 225 | enc_read.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h |
170 | enc_read.o: ../cryptlib.h des_locl.h | 226 | enc_read.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h |
171 | enc_writ.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | 227 | enc_read.o: ../cryptlib.h des_locl.h enc_read.c |
172 | enc_writ.o: ../../include/openssl/crypto.h ../../include/openssl/des.h | 228 | enc_writ.o: ../../e_os.h ../../include/openssl/bio.h |
173 | enc_writ.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h | 229 | enc_writ.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h |
174 | enc_writ.o: ../../include/openssl/err.h ../../include/openssl/lhash.h | 230 | enc_writ.o: ../../include/openssl/des.h ../../include/openssl/des_old.h |
175 | enc_writ.o: ../../include/openssl/opensslconf.h | 231 | enc_writ.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h |
176 | enc_writ.o: ../../include/openssl/opensslv.h ../../include/openssl/rand.h | 232 | enc_writ.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h |
177 | enc_writ.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | 233 | enc_writ.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h |
178 | enc_writ.o: ../../include/openssl/symhacks.h ../cryptlib.h des_locl.h | 234 | enc_writ.o: ../../include/openssl/rand.h ../../include/openssl/safestack.h |
179 | fcrypt.o: ../../include/openssl/des.h ../../include/openssl/e_os2.h | 235 | enc_writ.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h |
180 | fcrypt.o: ../../include/openssl/opensslconf.h des_locl.h | 236 | enc_writ.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h |
181 | fcrypt_b.o: ../../include/openssl/des.h ../../include/openssl/e_os2.h | 237 | enc_writ.o: ../cryptlib.h des_locl.h enc_writ.c |
182 | fcrypt_b.o: ../../include/openssl/opensslconf.h des_locl.h | 238 | fcrypt.o: ../../include/openssl/crypto.h ../../include/openssl/des.h |
183 | ofb64ede.o: ../../include/openssl/des.h ../../include/openssl/e_os2.h | 239 | fcrypt.o: ../../include/openssl/des_old.h ../../include/openssl/e_os2.h |
184 | ofb64ede.o: ../../include/openssl/opensslconf.h des_locl.h | 240 | fcrypt.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h |
185 | ofb64enc.o: ../../include/openssl/des.h ../../include/openssl/e_os2.h | 241 | fcrypt.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h |
186 | ofb64enc.o: ../../include/openssl/opensslconf.h des_locl.h | 242 | fcrypt.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h |
187 | ofb_enc.o: ../../include/openssl/des.h ../../include/openssl/e_os2.h | 243 | fcrypt.o: ../../include/openssl/ui_compat.h des_locl.h fcrypt.c |
188 | ofb_enc.o: ../../include/openssl/opensslconf.h des_locl.h | 244 | fcrypt_b.o: ../../include/openssl/crypto.h ../../include/openssl/des.h |
189 | pcbc_enc.o: ../../include/openssl/des.h ../../include/openssl/e_os2.h | 245 | fcrypt_b.o: ../../include/openssl/des_old.h ../../include/openssl/e_os2.h |
190 | pcbc_enc.o: ../../include/openssl/opensslconf.h des_locl.h | 246 | fcrypt_b.o: ../../include/openssl/opensslconf.h |
191 | qud_cksm.o: ../../include/openssl/des.h ../../include/openssl/e_os2.h | 247 | fcrypt_b.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h |
192 | qud_cksm.o: ../../include/openssl/opensslconf.h des_locl.h | 248 | fcrypt_b.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h |
193 | rand_key.o: ../../include/openssl/des.h ../../include/openssl/e_os2.h | 249 | fcrypt_b.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h |
194 | rand_key.o: ../../include/openssl/opensslconf.h ../../include/openssl/rand.h | 250 | fcrypt_b.o: des_locl.h fcrypt_b.c |
195 | read2pwd.o: ../../include/openssl/des.h ../../include/openssl/e_os2.h | 251 | ofb64ede.o: ../../include/openssl/crypto.h ../../include/openssl/des.h |
196 | read2pwd.o: ../../include/openssl/opensslconf.h des_locl.h | 252 | ofb64ede.o: ../../include/openssl/des_old.h ../../include/openssl/e_os2.h |
197 | read_pwd.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | 253 | ofb64ede.o: ../../include/openssl/opensslconf.h |
198 | read_pwd.o: ../../include/openssl/crypto.h ../../include/openssl/des.h | 254 | ofb64ede.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h |
199 | read_pwd.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h | 255 | ofb64ede.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h |
200 | read_pwd.o: ../../include/openssl/err.h ../../include/openssl/lhash.h | 256 | ofb64ede.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h |
201 | read_pwd.o: ../../include/openssl/opensslconf.h | 257 | ofb64ede.o: des_locl.h ofb64ede.c |
202 | read_pwd.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h | 258 | ofb64enc.o: ../../include/openssl/crypto.h ../../include/openssl/des.h |
203 | read_pwd.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | 259 | ofb64enc.o: ../../include/openssl/des_old.h ../../include/openssl/e_os2.h |
204 | read_pwd.o: ../cryptlib.h des_locl.h | 260 | ofb64enc.o: ../../include/openssl/opensslconf.h |
205 | rpc_enc.o: ../../include/openssl/des.h ../../include/openssl/e_os2.h | 261 | ofb64enc.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h |
206 | rpc_enc.o: ../../include/openssl/opensslconf.h des_locl.h des_ver.h rpc_des.h | 262 | ofb64enc.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h |
207 | set_key.o: ../../include/openssl/des.h ../../include/openssl/e_os2.h | 263 | ofb64enc.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h |
208 | set_key.o: ../../include/openssl/opensslconf.h des_locl.h | 264 | ofb64enc.o: des_locl.h ofb64enc.c |
209 | str2key.o: ../../include/openssl/des.h ../../include/openssl/e_os2.h | 265 | ofb_enc.o: ../../include/openssl/crypto.h ../../include/openssl/des.h |
210 | str2key.o: ../../include/openssl/opensslconf.h des_locl.h | 266 | ofb_enc.o: ../../include/openssl/des_old.h ../../include/openssl/e_os2.h |
211 | xcbc_enc.o: ../../include/openssl/des.h ../../include/openssl/e_os2.h | 267 | ofb_enc.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h |
212 | xcbc_enc.o: ../../include/openssl/opensslconf.h des_locl.h | 268 | ofb_enc.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h |
269 | ofb_enc.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h | ||
270 | ofb_enc.o: ../../include/openssl/ui_compat.h des_locl.h ofb_enc.c | ||
271 | pcbc_enc.o: ../../include/openssl/crypto.h ../../include/openssl/des.h | ||
272 | pcbc_enc.o: ../../include/openssl/des_old.h ../../include/openssl/e_os2.h | ||
273 | pcbc_enc.o: ../../include/openssl/opensslconf.h | ||
274 | pcbc_enc.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h | ||
275 | pcbc_enc.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
276 | pcbc_enc.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h | ||
277 | pcbc_enc.o: des_locl.h pcbc_enc.c | ||
278 | qud_cksm.o: ../../include/openssl/crypto.h ../../include/openssl/des.h | ||
279 | qud_cksm.o: ../../include/openssl/des_old.h ../../include/openssl/e_os2.h | ||
280 | qud_cksm.o: ../../include/openssl/opensslconf.h | ||
281 | qud_cksm.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h | ||
282 | qud_cksm.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
283 | qud_cksm.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h | ||
284 | qud_cksm.o: des_locl.h qud_cksm.c | ||
285 | rand_key.o: ../../include/openssl/crypto.h ../../include/openssl/des.h | ||
286 | rand_key.o: ../../include/openssl/des_old.h ../../include/openssl/e_os2.h | ||
287 | rand_key.o: ../../include/openssl/opensslconf.h | ||
288 | rand_key.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
289 | rand_key.o: ../../include/openssl/rand.h ../../include/openssl/safestack.h | ||
290 | rand_key.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
291 | rand_key.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h | ||
292 | rand_key.o: rand_key.c | ||
293 | read2pwd.o: ../../include/openssl/crypto.h ../../include/openssl/des.h | ||
294 | read2pwd.o: ../../include/openssl/des_old.h ../../include/openssl/e_os2.h | ||
295 | read2pwd.o: ../../include/openssl/opensslconf.h | ||
296 | read2pwd.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h | ||
297 | read2pwd.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
298 | read2pwd.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h | ||
299 | read2pwd.o: read2pwd.c | ||
300 | rpc_enc.o: ../../include/openssl/crypto.h ../../include/openssl/des.h | ||
301 | rpc_enc.o: ../../include/openssl/des_old.h ../../include/openssl/e_os2.h | ||
302 | rpc_enc.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
303 | rpc_enc.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
304 | rpc_enc.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h | ||
305 | rpc_enc.o: ../../include/openssl/ui_compat.h des_locl.h des_ver.h rpc_des.h | ||
306 | rpc_enc.o: rpc_enc.c | ||
307 | set_key.o: ../../include/openssl/crypto.h ../../include/openssl/des.h | ||
308 | set_key.o: ../../include/openssl/des_old.h ../../include/openssl/e_os2.h | ||
309 | set_key.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
310 | set_key.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
311 | set_key.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h | ||
312 | set_key.o: ../../include/openssl/ui_compat.h des_locl.h set_key.c | ||
313 | str2key.o: ../../include/openssl/crypto.h ../../include/openssl/des.h | ||
314 | str2key.o: ../../include/openssl/des_old.h ../../include/openssl/e_os2.h | ||
315 | str2key.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
316 | str2key.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
317 | str2key.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h | ||
318 | str2key.o: ../../include/openssl/ui_compat.h des_locl.h str2key.c | ||
319 | xcbc_enc.o: ../../include/openssl/crypto.h ../../include/openssl/des.h | ||
320 | xcbc_enc.o: ../../include/openssl/des_old.h ../../include/openssl/e_os2.h | ||
321 | xcbc_enc.o: ../../include/openssl/opensslconf.h | ||
322 | xcbc_enc.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h | ||
323 | xcbc_enc.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
324 | xcbc_enc.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h | ||
325 | xcbc_enc.o: des_locl.h xcbc_enc.c | ||
diff --git a/src/lib/libcrypto/des/asm/crypt586.pl b/src/lib/libcrypto/des/asm/crypt586.pl index 197c413ea6..3d41d82f69 100644 --- a/src/lib/libcrypto/des/asm/crypt586.pl +++ b/src/lib/libcrypto/des/asm/crypt586.pl | |||
@@ -14,7 +14,7 @@ require "x86asm.pl"; | |||
14 | $L="edi"; | 14 | $L="edi"; |
15 | $R="esi"; | 15 | $R="esi"; |
16 | 16 | ||
17 | &external_label("des_SPtrans"); | 17 | &external_label("DES_SPtrans"); |
18 | &fcrypt_body("fcrypt_body"); | 18 | &fcrypt_body("fcrypt_body"); |
19 | &asm_finish(); | 19 | &asm_finish(); |
20 | 20 | ||
@@ -22,7 +22,7 @@ sub fcrypt_body | |||
22 | { | 22 | { |
23 | local($name,$do_ip)=@_; | 23 | local($name,$do_ip)=@_; |
24 | 24 | ||
25 | &function_begin($name,"EXTRN _des_SPtrans:DWORD"); | 25 | &function_begin($name,"EXTRN _DES_SPtrans:DWORD"); |
26 | 26 | ||
27 | &comment(""); | 27 | &comment(""); |
28 | &comment("Load the 2 words"); | 28 | &comment("Load the 2 words"); |
@@ -39,11 +39,11 @@ sub fcrypt_body | |||
39 | { | 39 | { |
40 | &comment(""); | 40 | &comment(""); |
41 | &comment("Round $i"); | 41 | &comment("Round $i"); |
42 | &D_ENCRYPT($i,$L,$R,$i*2,$ks,"des_SPtrans","eax","ebx","ecx","edx"); | 42 | &D_ENCRYPT($i,$L,$R,$i*2,$ks,"DES_SPtrans","eax","ebx","ecx","edx"); |
43 | 43 | ||
44 | &comment(""); | 44 | &comment(""); |
45 | &comment("Round ".sprintf("%d",$i+1)); | 45 | &comment("Round ".sprintf("%d",$i+1)); |
46 | &D_ENCRYPT($i+1,$R,$L,($i+1)*2,$ks,"des_SPtrans","eax","ebx","ecx","edx"); | 46 | &D_ENCRYPT($i+1,$R,$L,($i+1)*2,$ks,"DES_SPtrans","eax","ebx","ecx","edx"); |
47 | } | 47 | } |
48 | &mov("ebx", &swtmp(0)); | 48 | &mov("ebx", &swtmp(0)); |
49 | &mov("eax", $L); | 49 | &mov("eax", $L); |
diff --git a/src/lib/libcrypto/des/asm/des-586.pl b/src/lib/libcrypto/des/asm/des-586.pl index c890766bc9..0d08e8a3a9 100644 --- a/src/lib/libcrypto/des/asm/des-586.pl +++ b/src/lib/libcrypto/des/asm/des-586.pl | |||
@@ -19,21 +19,21 @@ require "desboth.pl"; | |||
19 | $L="edi"; | 19 | $L="edi"; |
20 | $R="esi"; | 20 | $R="esi"; |
21 | 21 | ||
22 | &external_label("des_SPtrans"); | 22 | &external_label("DES_SPtrans"); |
23 | &des_encrypt("des_encrypt1",1); | 23 | &DES_encrypt("DES_encrypt1",1); |
24 | &des_encrypt("des_encrypt2",0); | 24 | &DES_encrypt("DES_encrypt2",0); |
25 | &des_encrypt3("des_encrypt3",1); | 25 | &DES_encrypt3("DES_encrypt3",1); |
26 | &des_encrypt3("des_decrypt3",0); | 26 | &DES_encrypt3("DES_decrypt3",0); |
27 | &cbc("des_ncbc_encrypt","des_encrypt1","des_encrypt1",0,4,5,3,5,-1); | 27 | &cbc("DES_ncbc_encrypt","DES_encrypt1","DES_encrypt1",0,4,5,3,5,-1); |
28 | &cbc("des_ede3_cbc_encrypt","des_encrypt3","des_decrypt3",0,6,7,3,4,5); | 28 | &cbc("DES_ede3_cbc_encrypt","DES_encrypt3","DES_decrypt3",0,6,7,3,4,5); |
29 | 29 | ||
30 | &asm_finish(); | 30 | &asm_finish(); |
31 | 31 | ||
32 | sub des_encrypt | 32 | sub DES_encrypt |
33 | { | 33 | { |
34 | local($name,$do_ip)=@_; | 34 | local($name,$do_ip)=@_; |
35 | 35 | ||
36 | &function_begin_B($name,"EXTRN _des_SPtrans:DWORD"); | 36 | &function_begin_B($name,"EXTRN _DES_SPtrans:DWORD"); |
37 | 37 | ||
38 | &push("esi"); | 38 | &push("esi"); |
39 | &push("edi"); | 39 | &push("edi"); |
@@ -80,11 +80,11 @@ sub des_encrypt | |||
80 | { | 80 | { |
81 | &comment(""); | 81 | &comment(""); |
82 | &comment("Round $i"); | 82 | &comment("Round $i"); |
83 | &D_ENCRYPT($i,$L,$R,$i*2,$ks,"des_SPtrans","eax","ebx","ecx","edx"); | 83 | &D_ENCRYPT($i,$L,$R,$i*2,$ks,"DES_SPtrans","eax","ebx","ecx","edx"); |
84 | 84 | ||
85 | &comment(""); | 85 | &comment(""); |
86 | &comment("Round ".sprintf("%d",$i+1)); | 86 | &comment("Round ".sprintf("%d",$i+1)); |
87 | &D_ENCRYPT($i+1,$R,$L,($i+1)*2,$ks,"des_SPtrans","eax","ebx","ecx","edx"); | 87 | &D_ENCRYPT($i+1,$R,$L,($i+1)*2,$ks,"DES_SPtrans","eax","ebx","ecx","edx"); |
88 | } | 88 | } |
89 | &jmp(&label("end")); | 89 | &jmp(&label("end")); |
90 | 90 | ||
@@ -94,10 +94,10 @@ sub des_encrypt | |||
94 | { | 94 | { |
95 | &comment(""); | 95 | &comment(""); |
96 | &comment("Round $i"); | 96 | &comment("Round $i"); |
97 | &D_ENCRYPT(15-$i,$L,$R,$i*2,$ks,"des_SPtrans","eax","ebx","ecx","edx"); | 97 | &D_ENCRYPT(15-$i,$L,$R,$i*2,$ks,"DES_SPtrans","eax","ebx","ecx","edx"); |
98 | &comment(""); | 98 | &comment(""); |
99 | &comment("Round ".sprintf("%d",$i-1)); | 99 | &comment("Round ".sprintf("%d",$i-1)); |
100 | &D_ENCRYPT(15-$i+1,$R,$L,($i-1)*2,$ks,"des_SPtrans","eax","ebx","ecx","edx"); | 100 | &D_ENCRYPT(15-$i+1,$R,$L,($i-1)*2,$ks,"DES_SPtrans","eax","ebx","ecx","edx"); |
101 | } | 101 | } |
102 | 102 | ||
103 | &set_label("end"); | 103 | &set_label("end"); |
diff --git a/src/lib/libcrypto/des/asm/des686.pl b/src/lib/libcrypto/des/asm/des686.pl index 84c3e85438..d3ad5d5edd 100644 --- a/src/lib/libcrypto/des/asm/des686.pl +++ b/src/lib/libcrypto/des/asm/des686.pl | |||
@@ -46,19 +46,19 @@ EOF | |||
46 | $L="edi"; | 46 | $L="edi"; |
47 | $R="esi"; | 47 | $R="esi"; |
48 | 48 | ||
49 | &des_encrypt("des_encrypt1",1); | 49 | &DES_encrypt("DES_encrypt1",1); |
50 | &des_encrypt("des_encrypt2",0); | 50 | &DES_encrypt("DES_encrypt2",0); |
51 | 51 | ||
52 | &des_encrypt3("des_encrypt3",1); | 52 | &DES_encrypt3("DES_encrypt3",1); |
53 | &des_encrypt3("des_decrypt3",0); | 53 | &DES_encrypt3("DES_decrypt3",0); |
54 | 54 | ||
55 | &file_end(); | 55 | &file_end(); |
56 | 56 | ||
57 | sub des_encrypt | 57 | sub DES_encrypt |
58 | { | 58 | { |
59 | local($name,$do_ip)=@_; | 59 | local($name,$do_ip)=@_; |
60 | 60 | ||
61 | &function_begin($name,"EXTRN _des_SPtrans:DWORD"); | 61 | &function_begin($name,"EXTRN _DES_SPtrans:DWORD"); |
62 | 62 | ||
63 | &comment(""); | 63 | &comment(""); |
64 | &comment("Load the 2 words"); | 64 | &comment("Load the 2 words"); |
@@ -94,11 +94,11 @@ sub des_encrypt | |||
94 | { | 94 | { |
95 | &comment(""); | 95 | &comment(""); |
96 | &comment("Round $i"); | 96 | &comment("Round $i"); |
97 | &D_ENCRYPT($L,$R,$i*2,"ebp","des_SPtrans","ecx","edx","eax","ebx"); | 97 | &D_ENCRYPT($L,$R,$i*2,"ebp","DES_SPtrans","ecx","edx","eax","ebx"); |
98 | 98 | ||
99 | &comment(""); | 99 | &comment(""); |
100 | &comment("Round ".sprintf("%d",$i+1)); | 100 | &comment("Round ".sprintf("%d",$i+1)); |
101 | &D_ENCRYPT($R,$L,($i+1)*2,"ebp","des_SPtrans","ecx","edx","eax","ebx"); | 101 | &D_ENCRYPT($R,$L,($i+1)*2,"ebp","DES_SPtrans","ecx","edx","eax","ebx"); |
102 | } | 102 | } |
103 | &jmp(&label("end")); | 103 | &jmp(&label("end")); |
104 | 104 | ||
@@ -108,10 +108,10 @@ sub des_encrypt | |||
108 | { | 108 | { |
109 | &comment(""); | 109 | &comment(""); |
110 | &comment("Round $i"); | 110 | &comment("Round $i"); |
111 | &D_ENCRYPT($L,$R,$i*2,"ebp","des_SPtrans","ecx","edx","eax","ebx"); | 111 | &D_ENCRYPT($L,$R,$i*2,"ebp","DES_SPtrans","ecx","edx","eax","ebx"); |
112 | &comment(""); | 112 | &comment(""); |
113 | &comment("Round ".sprintf("%d",$i-1)); | 113 | &comment("Round ".sprintf("%d",$i-1)); |
114 | &D_ENCRYPT($R,$L,($i-1)*2,"ebp","des_SPtrans","ecx","edx","eax","ebx"); | 114 | &D_ENCRYPT($R,$L,($i-1)*2,"ebp","DES_SPtrans","ecx","edx","eax","ebx"); |
115 | } | 115 | } |
116 | 116 | ||
117 | &set_label("end"); | 117 | &set_label("end"); |
diff --git a/src/lib/libcrypto/des/asm/desboth.pl b/src/lib/libcrypto/des/asm/desboth.pl index d5106414db..eec00886e4 100644 --- a/src/lib/libcrypto/des/asm/desboth.pl +++ b/src/lib/libcrypto/des/asm/desboth.pl | |||
@@ -3,7 +3,7 @@ | |||
3 | $L="edi"; | 3 | $L="edi"; |
4 | $R="esi"; | 4 | $R="esi"; |
5 | 5 | ||
6 | sub des_encrypt3 | 6 | sub DES_encrypt3 |
7 | { | 7 | { |
8 | local($name,$enc)=@_; | 8 | local($name,$enc)=@_; |
9 | 9 | ||
@@ -47,15 +47,15 @@ sub des_encrypt3 | |||
47 | &mov(&swtmp(2), (DWC(($enc)?"1":"0"))); | 47 | &mov(&swtmp(2), (DWC(($enc)?"1":"0"))); |
48 | &mov(&swtmp(1), "eax"); | 48 | &mov(&swtmp(1), "eax"); |
49 | &mov(&swtmp(0), "ebx"); | 49 | &mov(&swtmp(0), "ebx"); |
50 | &call("des_encrypt2"); | 50 | &call("DES_encrypt2"); |
51 | &mov(&swtmp(2), (DWC(($enc)?"0":"1"))); | 51 | &mov(&swtmp(2), (DWC(($enc)?"0":"1"))); |
52 | &mov(&swtmp(1), "edi"); | 52 | &mov(&swtmp(1), "edi"); |
53 | &mov(&swtmp(0), "ebx"); | 53 | &mov(&swtmp(0), "ebx"); |
54 | &call("des_encrypt2"); | 54 | &call("DES_encrypt2"); |
55 | &mov(&swtmp(2), (DWC(($enc)?"1":"0"))); | 55 | &mov(&swtmp(2), (DWC(($enc)?"1":"0"))); |
56 | &mov(&swtmp(1), "esi"); | 56 | &mov(&swtmp(1), "esi"); |
57 | &mov(&swtmp(0), "ebx"); | 57 | &mov(&swtmp(0), "ebx"); |
58 | &call("des_encrypt2"); | 58 | &call("DES_encrypt2"); |
59 | 59 | ||
60 | &stack_pop(3); | 60 | &stack_pop(3); |
61 | &mov($L,&DWP(0,"ebx","",0)); | 61 | &mov($L,&DWP(0,"ebx","",0)); |
diff --git a/src/lib/libcrypto/des/cbc3_enc.c b/src/lib/libcrypto/des/cbc3_enc.c index 527e74f3de..b5db4e14f7 100644 --- a/src/lib/libcrypto/des/cbc3_enc.c +++ b/src/lib/libcrypto/des/cbc3_enc.c | |||
@@ -59,41 +59,41 @@ | |||
59 | #include "des_locl.h" | 59 | #include "des_locl.h" |
60 | 60 | ||
61 | /* HAS BUGS! DON'T USE - this is only present for use in des.c */ | 61 | /* HAS BUGS! DON'T USE - this is only present for use in des.c */ |
62 | void des_3cbc_encrypt(des_cblock *input, des_cblock *output, long length, | 62 | void DES_3cbc_encrypt(DES_cblock *input, DES_cblock *output, long length, |
63 | des_key_schedule ks1, des_key_schedule ks2, des_cblock *iv1, | 63 | DES_key_schedule ks1, DES_key_schedule ks2, DES_cblock *iv1, |
64 | des_cblock *iv2, int enc) | 64 | DES_cblock *iv2, int enc) |
65 | { | 65 | { |
66 | int off=((int)length-1)/8; | 66 | int off=((int)length-1)/8; |
67 | long l8=((length+7)/8)*8; | 67 | long l8=((length+7)/8)*8; |
68 | des_cblock niv1,niv2; | 68 | DES_cblock niv1,niv2; |
69 | 69 | ||
70 | if (enc == DES_ENCRYPT) | 70 | if (enc == DES_ENCRYPT) |
71 | { | 71 | { |
72 | des_cbc_encrypt((unsigned char*)input, | 72 | DES_cbc_encrypt((unsigned char*)input, |
73 | (unsigned char*)output,length,ks1,iv1,enc); | 73 | (unsigned char*)output,length,&ks1,iv1,enc); |
74 | if (length >= sizeof(des_cblock)) | 74 | if (length >= sizeof(DES_cblock)) |
75 | memcpy(niv1,output[off],sizeof(des_cblock)); | 75 | memcpy(niv1,output[off],sizeof(DES_cblock)); |
76 | des_cbc_encrypt((unsigned char*)output, | 76 | DES_cbc_encrypt((unsigned char*)output, |
77 | (unsigned char*)output,l8,ks2,iv1,!enc); | 77 | (unsigned char*)output,l8,&ks2,iv1,!enc); |
78 | des_cbc_encrypt((unsigned char*)output, | 78 | DES_cbc_encrypt((unsigned char*)output, |
79 | (unsigned char*)output,l8,ks1,iv2,enc); | 79 | (unsigned char*)output,l8,&ks1,iv2,enc); |
80 | if (length >= sizeof(des_cblock)) | 80 | if (length >= sizeof(DES_cblock)) |
81 | memcpy(niv2,output[off],sizeof(des_cblock)); | 81 | memcpy(niv2,output[off],sizeof(DES_cblock)); |
82 | } | 82 | } |
83 | else | 83 | else |
84 | { | 84 | { |
85 | if (length >= sizeof(des_cblock)) | 85 | if (length >= sizeof(DES_cblock)) |
86 | memcpy(niv2,input[off],sizeof(des_cblock)); | 86 | memcpy(niv2,input[off],sizeof(DES_cblock)); |
87 | des_cbc_encrypt((unsigned char*)input, | 87 | DES_cbc_encrypt((unsigned char*)input, |
88 | (unsigned char*)output,l8,ks1,iv2,enc); | 88 | (unsigned char*)output,l8,&ks1,iv2,enc); |
89 | des_cbc_encrypt((unsigned char*)output, | 89 | DES_cbc_encrypt((unsigned char*)output, |
90 | (unsigned char*)output,l8,ks2,iv1,!enc); | 90 | (unsigned char*)output,l8,&ks2,iv1,!enc); |
91 | if (length >= sizeof(des_cblock)) | 91 | if (length >= sizeof(DES_cblock)) |
92 | memcpy(niv1,output[off],sizeof(des_cblock)); | 92 | memcpy(niv1,output[off],sizeof(DES_cblock)); |
93 | des_cbc_encrypt((unsigned char*)output, | 93 | DES_cbc_encrypt((unsigned char*)output, |
94 | (unsigned char*)output,length,ks1,iv1,enc); | 94 | (unsigned char*)output,length,&ks1,iv1,enc); |
95 | } | 95 | } |
96 | memcpy(*iv1,niv1,sizeof(des_cblock)); | 96 | memcpy(*iv1,niv1,sizeof(DES_cblock)); |
97 | memcpy(*iv2,niv2,sizeof(des_cblock)); | 97 | memcpy(*iv2,niv2,sizeof(DES_cblock)); |
98 | } | 98 | } |
99 | 99 | ||
diff --git a/src/lib/libcrypto/des/cbc_cksm.c b/src/lib/libcrypto/des/cbc_cksm.c index b857df0985..6c5305b99d 100644 --- a/src/lib/libcrypto/des/cbc_cksm.c +++ b/src/lib/libcrypto/des/cbc_cksm.c | |||
@@ -58,9 +58,9 @@ | |||
58 | 58 | ||
59 | #include "des_locl.h" | 59 | #include "des_locl.h" |
60 | 60 | ||
61 | DES_LONG des_cbc_cksum(const unsigned char *in, des_cblock *output, | 61 | DES_LONG DES_cbc_cksum(const unsigned char *in, DES_cblock *output, |
62 | long length, | 62 | long length, DES_key_schedule *schedule, |
63 | des_key_schedule schedule, const_des_cblock *ivec) | 63 | const_DES_cblock *ivec) |
64 | { | 64 | { |
65 | register DES_LONG tout0,tout1,tin0,tin1; | 65 | register DES_LONG tout0,tout1,tin0,tin1; |
66 | register long l=length; | 66 | register long l=length; |
@@ -82,7 +82,7 @@ DES_LONG des_cbc_cksum(const unsigned char *in, des_cblock *output, | |||
82 | 82 | ||
83 | tin0^=tout0; tin[0]=tin0; | 83 | tin0^=tout0; tin[0]=tin0; |
84 | tin1^=tout1; tin[1]=tin1; | 84 | tin1^=tout1; tin[1]=tin1; |
85 | des_encrypt1((DES_LONG *)tin,schedule,DES_ENCRYPT); | 85 | DES_encrypt1((DES_LONG *)tin,schedule,DES_ENCRYPT); |
86 | /* fix 15/10/91 eay - thanks to keithr@sco.COM */ | 86 | /* fix 15/10/91 eay - thanks to keithr@sco.COM */ |
87 | tout0=tin[0]; | 87 | tout0=tin[0]; |
88 | tout1=tin[1]; | 88 | tout1=tin[1]; |
diff --git a/src/lib/libcrypto/des/cfb64ede.c b/src/lib/libcrypto/des/cfb64ede.c index 5362a551bf..60c1aa08db 100644 --- a/src/lib/libcrypto/des/cfb64ede.c +++ b/src/lib/libcrypto/des/cfb64ede.c | |||
@@ -63,9 +63,10 @@ | |||
63 | * 64bit block we have used is contained in *num; | 63 | * 64bit block we have used is contained in *num; |
64 | */ | 64 | */ |
65 | 65 | ||
66 | void des_ede3_cfb64_encrypt(const unsigned char *in, unsigned char *out, | 66 | void DES_ede3_cfb64_encrypt(const unsigned char *in, unsigned char *out, |
67 | long length, des_key_schedule ks1, des_key_schedule ks2, | 67 | long length, DES_key_schedule *ks1, |
68 | des_key_schedule ks3, des_cblock *ivec, int *num, int enc) | 68 | DES_key_schedule *ks2, DES_key_schedule *ks3, |
69 | DES_cblock *ivec, int *num, int enc) | ||
69 | { | 70 | { |
70 | register DES_LONG v0,v1; | 71 | register DES_LONG v0,v1; |
71 | register long l=length; | 72 | register long l=length; |
@@ -85,7 +86,7 @@ void des_ede3_cfb64_encrypt(const unsigned char *in, unsigned char *out, | |||
85 | 86 | ||
86 | ti[0]=v0; | 87 | ti[0]=v0; |
87 | ti[1]=v1; | 88 | ti[1]=v1; |
88 | des_encrypt3(ti,ks1,ks2,ks3); | 89 | DES_encrypt3(ti,ks1,ks2,ks3); |
89 | v0=ti[0]; | 90 | v0=ti[0]; |
90 | v1=ti[1]; | 91 | v1=ti[1]; |
91 | 92 | ||
@@ -111,7 +112,7 @@ void des_ede3_cfb64_encrypt(const unsigned char *in, unsigned char *out, | |||
111 | 112 | ||
112 | ti[0]=v0; | 113 | ti[0]=v0; |
113 | ti[1]=v1; | 114 | ti[1]=v1; |
114 | des_encrypt3(ti,ks1,ks2,ks3); | 115 | DES_encrypt3(ti,ks1,ks2,ks3); |
115 | v0=ti[0]; | 116 | v0=ti[0]; |
116 | v1=ti[1]; | 117 | v1=ti[1]; |
117 | 118 | ||
@@ -132,10 +133,10 @@ void des_ede3_cfb64_encrypt(const unsigned char *in, unsigned char *out, | |||
132 | } | 133 | } |
133 | 134 | ||
134 | #ifdef undef /* MACRO */ | 135 | #ifdef undef /* MACRO */ |
135 | void des_ede2_cfb64_encrypt(unsigned char *in, unsigned char *out, long length, | 136 | void DES_ede2_cfb64_encrypt(unsigned char *in, unsigned char *out, long length, |
136 | des_key_schedule ks1, des_key_schedule ks2, des_cblock (*ivec), | 137 | DES_key_schedule ks1, DES_key_schedule ks2, DES_cblock (*ivec), |
137 | int *num, int enc) | 138 | int *num, int enc) |
138 | { | 139 | { |
139 | des_ede3_cfb64_encrypt(in,out,length,ks1,ks2,ks1,ivec,num,enc); | 140 | DES_ede3_cfb64_encrypt(in,out,length,ks1,ks2,ks1,ivec,num,enc); |
140 | } | 141 | } |
141 | #endif | 142 | #endif |
diff --git a/src/lib/libcrypto/des/cfb64enc.c b/src/lib/libcrypto/des/cfb64enc.c index 105530dfa3..5ec8683e40 100644 --- a/src/lib/libcrypto/des/cfb64enc.c +++ b/src/lib/libcrypto/des/cfb64enc.c | |||
@@ -63,9 +63,9 @@ | |||
63 | * 64bit block we have used is contained in *num; | 63 | * 64bit block we have used is contained in *num; |
64 | */ | 64 | */ |
65 | 65 | ||
66 | void des_cfb64_encrypt(const unsigned char *in, unsigned char *out, | 66 | void DES_cfb64_encrypt(const unsigned char *in, unsigned char *out, |
67 | long length, des_key_schedule schedule, des_cblock *ivec, | 67 | long length, DES_key_schedule *schedule, |
68 | int *num, int enc) | 68 | DES_cblock *ivec, int *num, int enc) |
69 | { | 69 | { |
70 | register DES_LONG v0,v1; | 70 | register DES_LONG v0,v1; |
71 | register long l=length; | 71 | register long l=length; |
@@ -82,7 +82,7 @@ void des_cfb64_encrypt(const unsigned char *in, unsigned char *out, | |||
82 | { | 82 | { |
83 | c2l(iv,v0); ti[0]=v0; | 83 | c2l(iv,v0); ti[0]=v0; |
84 | c2l(iv,v1); ti[1]=v1; | 84 | c2l(iv,v1); ti[1]=v1; |
85 | des_encrypt1(ti,schedule,DES_ENCRYPT); | 85 | DES_encrypt1(ti,schedule,DES_ENCRYPT); |
86 | iv = &(*ivec)[0]; | 86 | iv = &(*ivec)[0]; |
87 | v0=ti[0]; l2c(v0,iv); | 87 | v0=ti[0]; l2c(v0,iv); |
88 | v0=ti[1]; l2c(v0,iv); | 88 | v0=ti[1]; l2c(v0,iv); |
@@ -102,7 +102,7 @@ void des_cfb64_encrypt(const unsigned char *in, unsigned char *out, | |||
102 | { | 102 | { |
103 | c2l(iv,v0); ti[0]=v0; | 103 | c2l(iv,v0); ti[0]=v0; |
104 | c2l(iv,v1); ti[1]=v1; | 104 | c2l(iv,v1); ti[1]=v1; |
105 | des_encrypt1(ti,schedule,DES_ENCRYPT); | 105 | DES_encrypt1(ti,schedule,DES_ENCRYPT); |
106 | iv = &(*ivec)[0]; | 106 | iv = &(*ivec)[0]; |
107 | v0=ti[0]; l2c(v0,iv); | 107 | v0=ti[0]; l2c(v0,iv); |
108 | v0=ti[1]; l2c(v0,iv); | 108 | v0=ti[1]; l2c(v0,iv); |
diff --git a/src/lib/libcrypto/des/cfb_enc.c b/src/lib/libcrypto/des/cfb_enc.c index ec4fd4ea67..17bf77ca9e 100644 --- a/src/lib/libcrypto/des/cfb_enc.c +++ b/src/lib/libcrypto/des/cfb_enc.c | |||
@@ -64,8 +64,8 @@ | |||
64 | * the second. The second 12 bits will come from the 3rd and half the 4th | 64 | * the second. The second 12 bits will come from the 3rd and half the 4th |
65 | * byte. | 65 | * byte. |
66 | */ | 66 | */ |
67 | void des_cfb_encrypt(const unsigned char *in, unsigned char *out, int numbits, | 67 | void DES_cfb_encrypt(const unsigned char *in, unsigned char *out, int numbits, |
68 | long length, des_key_schedule schedule, des_cblock *ivec, int enc) | 68 | long length, DES_key_schedule *schedule, DES_cblock *ivec, int enc) |
69 | { | 69 | { |
70 | register DES_LONG d0,d1,v0,v1,n=(numbits+7)/8; | 70 | register DES_LONG d0,d1,v0,v1,n=(numbits+7)/8; |
71 | register DES_LONG mask0,mask1; | 71 | register DES_LONG mask0,mask1; |
@@ -100,7 +100,7 @@ void des_cfb_encrypt(const unsigned char *in, unsigned char *out, int numbits, | |||
100 | l-=n; | 100 | l-=n; |
101 | ti[0]=v0; | 101 | ti[0]=v0; |
102 | ti[1]=v1; | 102 | ti[1]=v1; |
103 | des_encrypt1((DES_LONG *)ti,schedule,DES_ENCRYPT); | 103 | DES_encrypt1((DES_LONG *)ti,schedule,DES_ENCRYPT); |
104 | c2ln(in,d0,d1,n); | 104 | c2ln(in,d0,d1,n); |
105 | in+=n; | 105 | in+=n; |
106 | d0=(d0^ti[0])&mask0; | 106 | d0=(d0^ti[0])&mask0; |
@@ -132,7 +132,7 @@ void des_cfb_encrypt(const unsigned char *in, unsigned char *out, int numbits, | |||
132 | l-=n; | 132 | l-=n; |
133 | ti[0]=v0; | 133 | ti[0]=v0; |
134 | ti[1]=v1; | 134 | ti[1]=v1; |
135 | des_encrypt1((DES_LONG *)ti,schedule,DES_ENCRYPT); | 135 | DES_encrypt1((DES_LONG *)ti,schedule,DES_ENCRYPT); |
136 | c2ln(in,d0,d1,n); | 136 | c2ln(in,d0,d1,n); |
137 | in+=n; | 137 | in+=n; |
138 | /* 30-08-94 - eay - changed because l>>32 and | 138 | /* 30-08-94 - eay - changed because l>>32 and |
diff --git a/src/lib/libcrypto/des/des-lib.com b/src/lib/libcrypto/des/des-lib.com index 2aea7a0dea..fc2c35a1ce 100644 --- a/src/lib/libcrypto/des/des-lib.com +++ b/src/lib/libcrypto/des/des-lib.com | |||
@@ -846,8 +846,8 @@ $ ENDIF | |||
846 | $! | 846 | $! |
847 | $! Set Up Initial CC Definitions, Possibly With User Ones | 847 | $! Set Up Initial CC Definitions, Possibly With User Ones |
848 | $! | 848 | $! |
849 | $ CCDEFS = "VMS=1" | 849 | $ CCDEFS = "" |
850 | $ IF F$TYPE(USER_CCDEFS) .NES. "" THEN CCDEFS = CCDEFS + "," + USER_CCDEFS | 850 | $ IF F$TYPE(USER_CCDEFS) .NES. "" THEN CCDEFS = USER_CCDEFS |
851 | $ CCEXTRAFLAGS = "" | 851 | $ CCEXTRAFLAGS = "" |
852 | $ IF F$TYPE(USER_CCFLAGS) .NES. "" THEN CCEXTRAFLAGS = USER_CCFLAGS | 852 | $ IF F$TYPE(USER_CCFLAGS) .NES. "" THEN CCEXTRAFLAGS = USER_CCFLAGS |
853 | $ CCDISABLEWARNINGS = "" | 853 | $ CCDISABLEWARNINGS = "" |
diff --git a/src/lib/libcrypto/des/des.c b/src/lib/libcrypto/des/des.c index 215d7413c0..d8c846b23d 100644 --- a/src/lib/libcrypto/des/des.c +++ b/src/lib/libcrypto/des/des.c | |||
@@ -59,25 +59,25 @@ | |||
59 | #include <stdio.h> | 59 | #include <stdio.h> |
60 | #include <stdlib.h> | 60 | #include <stdlib.h> |
61 | #include <string.h> | 61 | #include <string.h> |
62 | #ifndef MSDOS | ||
63 | #ifndef VMS | ||
64 | #include <openssl/opensslconf.h> | 62 | #include <openssl/opensslconf.h> |
63 | #ifndef OPENSSL_SYS_MSDOS | ||
64 | #ifndef OPENSSL_SYS_VMS | ||
65 | #include OPENSSL_UNISTD | 65 | #include OPENSSL_UNISTD |
66 | #else /* VMS */ | 66 | #else /* OPENSSL_SYS_VMS */ |
67 | #ifdef __DECC | 67 | #ifdef __DECC |
68 | #include <unistd.h> | 68 | #include <unistd.h> |
69 | #else /* not __DECC */ | 69 | #else /* not __DECC */ |
70 | #include <math.h> | 70 | #include <math.h> |
71 | #endif /* __DECC */ | 71 | #endif /* __DECC */ |
72 | #endif /* VMS */ | 72 | #endif /* OPENSSL_SYS_VMS */ |
73 | #else /* MSDOS */ | 73 | #else /* OPENSSL_SYS_MSDOS */ |
74 | #include <io.h> | 74 | #include <io.h> |
75 | #endif | 75 | #endif |
76 | 76 | ||
77 | #include <time.h> | 77 | #include <time.h> |
78 | #include "des_ver.h" | 78 | #include "des_ver.h" |
79 | 79 | ||
80 | #ifdef VMS | 80 | #ifdef OPENSSL_SYS_VMS |
81 | #include <types.h> | 81 | #include <types.h> |
82 | #include <stat.h> | 82 | #include <stat.h> |
83 | #else | 83 | #else |
@@ -88,6 +88,7 @@ | |||
88 | #endif | 88 | #endif |
89 | #include <openssl/des.h> | 89 | #include <openssl/des.h> |
90 | #include <openssl/rand.h> | 90 | #include <openssl/rand.h> |
91 | #include <openssl/ui_compat.h> | ||
91 | 92 | ||
92 | void usage(void); | 93 | void usage(void); |
93 | void doencryption(void); | 94 | void doencryption(void); |
@@ -96,10 +97,10 @@ void uufwriteEnd(FILE *fp); | |||
96 | int uufread(unsigned char *out,int size,unsigned int num,FILE *fp); | 97 | int uufread(unsigned char *out,int size,unsigned int num,FILE *fp); |
97 | int uuencode(unsigned char *in,int num,unsigned char *out); | 98 | int uuencode(unsigned char *in,int num,unsigned char *out); |
98 | int uudecode(unsigned char *in,int num,unsigned char *out); | 99 | int uudecode(unsigned char *in,int num,unsigned char *out); |
99 | void des_3cbc_encrypt(des_cblock *input,des_cblock *output,long length, | 100 | void DES_3cbc_encrypt(DES_cblock *input,DES_cblock *output,long length, |
100 | des_key_schedule sk1,des_key_schedule sk2, | 101 | DES_key_schedule sk1,DES_key_schedule sk2, |
101 | des_cblock *ivec1,des_cblock *ivec2,int enc); | 102 | DES_cblock *ivec1,DES_cblock *ivec2,int enc); |
102 | #ifdef VMS | 103 | #ifdef OPENSSL_SYS_VMS |
103 | #define EXIT(a) exit(a&0x10000000L) | 104 | #define EXIT(a) exit(a&0x10000000L) |
104 | #else | 105 | #else |
105 | #define EXIT(a) exit(a) | 106 | #define EXIT(a) exit(a) |
@@ -119,7 +120,7 @@ int uubufnum=0; | |||
119 | #define OUTUUBUF (65*100) | 120 | #define OUTUUBUF (65*100) |
120 | unsigned char b[OUTUUBUF]; | 121 | unsigned char b[OUTUUBUF]; |
121 | unsigned char bb[300]; | 122 | unsigned char bb[300]; |
122 | des_cblock cksum={0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}; | 123 | DES_cblock cksum={0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}; |
123 | char cksumname[200]=""; | 124 | char cksumname[200]=""; |
124 | 125 | ||
125 | int vflag,cflag,eflag,dflag,kflag,bflag,fflag,sflag,uflag,flag3,hflag,error; | 126 | int vflag,cflag,eflag,dflag,kflag,bflag,fflag,sflag,uflag,flag3,hflag,error; |
@@ -152,12 +153,14 @@ int main(int argc, char **argv) | |||
152 | case 'c': | 153 | case 'c': |
153 | cflag=1; | 154 | cflag=1; |
154 | strncpy(cksumname,p,200); | 155 | strncpy(cksumname,p,200); |
156 | cksumname[sizeof(cksumname)-1]='\0'; | ||
155 | p+=strlen(cksumname); | 157 | p+=strlen(cksumname); |
156 | break; | 158 | break; |
157 | case 'C': | 159 | case 'C': |
158 | cflag=1; | 160 | cflag=1; |
159 | longk=1; | 161 | longk=1; |
160 | strncpy(cksumname,p,200); | 162 | strncpy(cksumname,p,200); |
163 | cksumname[sizeof(cksumname)-1]='\0'; | ||
161 | p+=strlen(cksumname); | 164 | p+=strlen(cksumname); |
162 | break; | 165 | break; |
163 | case 'e': | 166 | case 'e': |
@@ -189,6 +192,7 @@ int main(int argc, char **argv) | |||
189 | case 'u': | 192 | case 'u': |
190 | uflag=1; | 193 | uflag=1; |
191 | strncpy(uuname,p,200); | 194 | strncpy(uuname,p,200); |
195 | uuname[sizeof(uuname)-1]='\0'; | ||
192 | p+=strlen(uuname); | 196 | p+=strlen(uuname); |
193 | break; | 197 | break; |
194 | case 'h': | 198 | case 'h': |
@@ -258,12 +262,12 @@ int main(int argc, char **argv) | |||
258 | #endif | 262 | #endif |
259 | if ( (in != NULL) && | 263 | if ( (in != NULL) && |
260 | (out != NULL) && | 264 | (out != NULL) && |
261 | #ifndef MSDOS | 265 | #ifndef OPENSSL_SYS_MSDOS |
262 | (stat(in,&ins) != -1) && | 266 | (stat(in,&ins) != -1) && |
263 | (stat(out,&outs) != -1) && | 267 | (stat(out,&outs) != -1) && |
264 | (ins.st_dev == outs.st_dev) && | 268 | (ins.st_dev == outs.st_dev) && |
265 | (ins.st_ino == outs.st_ino)) | 269 | (ins.st_ino == outs.st_ino)) |
266 | #else /* MSDOS */ | 270 | #else /* OPENSSL_SYS_MSDOS */ |
267 | (strcmp(in,out) == 0)) | 271 | (strcmp(in,out) == 0)) |
268 | #endif | 272 | #endif |
269 | { | 273 | { |
@@ -298,7 +302,7 @@ int main(int argc, char **argv) | |||
298 | EXIT(5); | 302 | EXIT(5); |
299 | } | 303 | } |
300 | 304 | ||
301 | #ifdef MSDOS | 305 | #ifdef OPENSSL_SYS_MSDOS |
302 | /* This should set the file to binary mode. */ | 306 | /* This should set the file to binary mode. */ |
303 | { | 307 | { |
304 | #include <fcntl.h> | 308 | #include <fcntl.h> |
@@ -360,14 +364,14 @@ void doencryption(void) | |||
360 | #endif | 364 | #endif |
361 | 365 | ||
362 | register int i; | 366 | register int i; |
363 | des_key_schedule ks,ks2; | 367 | DES_key_schedule ks,ks2; |
364 | des_cblock iv,iv2; | 368 | DES_cblock iv,iv2; |
365 | char *p; | 369 | char *p; |
366 | int num=0,j,k,l,rem,ll,len,last,ex=0; | 370 | int num=0,j,k,l,rem,ll,len,last,ex=0; |
367 | des_cblock kk,k2; | 371 | DES_cblock kk,k2; |
368 | FILE *O; | 372 | FILE *O; |
369 | int Exit=0; | 373 | int Exit=0; |
370 | #ifndef MSDOS | 374 | #ifndef OPENSSL_SYS_MSDOS |
371 | static unsigned char buf[BUFSIZE+8],obuf[BUFSIZE+8]; | 375 | static unsigned char buf[BUFSIZE+8],obuf[BUFSIZE+8]; |
372 | #else | 376 | #else |
373 | static unsigned char *buf=NULL,*obuf=NULL; | 377 | static unsigned char *buf=NULL,*obuf=NULL; |
@@ -422,19 +426,19 @@ void doencryption(void) | |||
422 | else | 426 | else |
423 | k2[i-8]=k; | 427 | k2[i-8]=k; |
424 | } | 428 | } |
425 | des_set_key_unchecked(&k2,ks2); | 429 | DES_set_key_unchecked(&k2,&ks2); |
426 | memset(k2,0,sizeof(k2)); | 430 | memset(k2,0,sizeof(k2)); |
427 | } | 431 | } |
428 | else if (longk || flag3) | 432 | else if (longk || flag3) |
429 | { | 433 | { |
430 | if (flag3) | 434 | if (flag3) |
431 | { | 435 | { |
432 | des_string_to_2keys(key,&kk,&k2); | 436 | DES_string_to_2keys(key,&kk,&k2); |
433 | des_set_key_unchecked(&k2,ks2); | 437 | DES_set_key_unchecked(&k2,&ks2); |
434 | memset(k2,0,sizeof(k2)); | 438 | memset(k2,0,sizeof(k2)); |
435 | } | 439 | } |
436 | else | 440 | else |
437 | des_string_to_key(key,&kk); | 441 | DES_string_to_key(key,&kk); |
438 | } | 442 | } |
439 | else | 443 | else |
440 | for (i=0; i<KEYSIZ; i++) | 444 | for (i=0; i<KEYSIZ; i++) |
@@ -452,7 +456,7 @@ void doencryption(void) | |||
452 | kk[i]=key[i]|0x80; | 456 | kk[i]=key[i]|0x80; |
453 | } | 457 | } |
454 | 458 | ||
455 | des_set_key_unchecked(&kk,ks); | 459 | DES_set_key_unchecked(&kk,&ks); |
456 | memset(key,0,sizeof(key)); | 460 | memset(key,0,sizeof(key)); |
457 | memset(kk,0,sizeof(kk)); | 461 | memset(kk,0,sizeof(kk)); |
458 | /* woops - A bug that does not showup under unix :-( */ | 462 | /* woops - A bug that does not showup under unix :-( */ |
@@ -491,8 +495,8 @@ void doencryption(void) | |||
491 | 495 | ||
492 | if (cflag) | 496 | if (cflag) |
493 | { | 497 | { |
494 | des_cbc_cksum(buf,&cksum, | 498 | DES_cbc_cksum(buf,&cksum, |
495 | (long)len,ks,&cksum); | 499 | (long)len,&ks,&cksum); |
496 | if (!eflag) | 500 | if (!eflag) |
497 | { | 501 | { |
498 | if (feof(DES_IN)) break; | 502 | if (feof(DES_IN)) break; |
@@ -502,24 +506,24 @@ void doencryption(void) | |||
502 | 506 | ||
503 | if (bflag && !flag3) | 507 | if (bflag && !flag3) |
504 | for (i=0; i<l; i+=8) | 508 | for (i=0; i<l; i+=8) |
505 | des_ecb_encrypt( | 509 | DES_ecb_encrypt( |
506 | (des_cblock *)&(buf[i]), | 510 | (DES_cblock *)&(buf[i]), |
507 | (des_cblock *)&(obuf[i]), | 511 | (DES_cblock *)&(obuf[i]), |
508 | ks,do_encrypt); | 512 | &ks,do_encrypt); |
509 | else if (flag3 && bflag) | 513 | else if (flag3 && bflag) |
510 | for (i=0; i<l; i+=8) | 514 | for (i=0; i<l; i+=8) |
511 | des_ecb2_encrypt( | 515 | DES_ecb2_encrypt( |
512 | (des_cblock *)&(buf[i]), | 516 | (DES_cblock *)&(buf[i]), |
513 | (des_cblock *)&(obuf[i]), | 517 | (DES_cblock *)&(obuf[i]), |
514 | ks,ks2,do_encrypt); | 518 | &ks,&ks2,do_encrypt); |
515 | else if (flag3 && !bflag) | 519 | else if (flag3 && !bflag) |
516 | { | 520 | { |
517 | char tmpbuf[8]; | 521 | char tmpbuf[8]; |
518 | 522 | ||
519 | if (rem) memcpy(tmpbuf,&(buf[l]), | 523 | if (rem) memcpy(tmpbuf,&(buf[l]), |
520 | (unsigned int)rem); | 524 | (unsigned int)rem); |
521 | des_3cbc_encrypt( | 525 | DES_3cbc_encrypt( |
522 | (des_cblock *)buf,(des_cblock *)obuf, | 526 | (DES_cblock *)buf,(DES_cblock *)obuf, |
523 | (long)l,ks,ks2,&iv, | 527 | (long)l,ks,ks2,&iv, |
524 | &iv2,do_encrypt); | 528 | &iv2,do_encrypt); |
525 | if (rem) memcpy(&(buf[l]),tmpbuf, | 529 | if (rem) memcpy(&(buf[l]),tmpbuf, |
@@ -527,9 +531,9 @@ void doencryption(void) | |||
527 | } | 531 | } |
528 | else | 532 | else |
529 | { | 533 | { |
530 | des_cbc_encrypt( | 534 | DES_cbc_encrypt( |
531 | buf,obuf, | 535 | buf,obuf, |
532 | (long)l,ks,&iv,do_encrypt); | 536 | (long)l,&ks,&iv,do_encrypt); |
533 | if (l >= 8) memcpy(iv,&(obuf[l-8]),8); | 537 | if (l >= 8) memcpy(iv,&(obuf[l-8]),8); |
534 | } | 538 | } |
535 | if (rem) memcpy(buf,&(buf[l]),(unsigned int)rem); | 539 | if (rem) memcpy(buf,&(buf[l]),(unsigned int)rem); |
@@ -581,28 +585,28 @@ void doencryption(void) | |||
581 | 585 | ||
582 | if (bflag && !flag3) | 586 | if (bflag && !flag3) |
583 | for (i=0; i<l; i+=8) | 587 | for (i=0; i<l; i+=8) |
584 | des_ecb_encrypt( | 588 | DES_ecb_encrypt( |
585 | (des_cblock *)&(buf[i]), | 589 | (DES_cblock *)&(buf[i]), |
586 | (des_cblock *)&(obuf[i]), | 590 | (DES_cblock *)&(obuf[i]), |
587 | ks,do_encrypt); | 591 | &ks,do_encrypt); |
588 | else if (flag3 && bflag) | 592 | else if (flag3 && bflag) |
589 | for (i=0; i<l; i+=8) | 593 | for (i=0; i<l; i+=8) |
590 | des_ecb2_encrypt( | 594 | DES_ecb2_encrypt( |
591 | (des_cblock *)&(buf[i]), | 595 | (DES_cblock *)&(buf[i]), |
592 | (des_cblock *)&(obuf[i]), | 596 | (DES_cblock *)&(obuf[i]), |
593 | ks,ks2,do_encrypt); | 597 | &ks,&ks2,do_encrypt); |
594 | else if (flag3 && !bflag) | 598 | else if (flag3 && !bflag) |
595 | { | 599 | { |
596 | des_3cbc_encrypt( | 600 | DES_3cbc_encrypt( |
597 | (des_cblock *)buf,(des_cblock *)obuf, | 601 | (DES_cblock *)buf,(DES_cblock *)obuf, |
598 | (long)l,ks,ks2,&iv, | 602 | (long)l,ks,ks2,&iv, |
599 | &iv2,do_encrypt); | 603 | &iv2,do_encrypt); |
600 | } | 604 | } |
601 | else | 605 | else |
602 | { | 606 | { |
603 | des_cbc_encrypt( | 607 | DES_cbc_encrypt( |
604 | buf,obuf, | 608 | buf,obuf, |
605 | (long)l,ks,&iv,do_encrypt); | 609 | (long)l,&ks,&iv,do_encrypt); |
606 | if (l >= 8) memcpy(iv,&(buf[l-8]),8); | 610 | if (l >= 8) memcpy(iv,&(buf[l-8]),8); |
607 | } | 611 | } |
608 | 612 | ||
@@ -627,9 +631,9 @@ void doencryption(void) | |||
627 | l=l-8+last; | 631 | l=l-8+last; |
628 | } | 632 | } |
629 | i=0; | 633 | i=0; |
630 | if (cflag) des_cbc_cksum(obuf, | 634 | if (cflag) DES_cbc_cksum(obuf, |
631 | (des_cblock *)cksum,(long)l/8*8,ks, | 635 | (DES_cblock *)cksum,(long)l/8*8,&ks, |
632 | (des_cblock *)cksum); | 636 | (DES_cblock *)cksum); |
633 | while (i != l) | 637 | while (i != l) |
634 | { | 638 | { |
635 | j=fwrite(obuf,1,(unsigned int)l-i,DES_OUT); | 639 | j=fwrite(obuf,1,(unsigned int)l-i,DES_OUT); |
@@ -664,8 +668,8 @@ void doencryption(void) | |||
664 | problems: | 668 | problems: |
665 | memset(buf,0,sizeof(buf)); | 669 | memset(buf,0,sizeof(buf)); |
666 | memset(obuf,0,sizeof(obuf)); | 670 | memset(obuf,0,sizeof(obuf)); |
667 | memset(ks,0,sizeof(ks)); | 671 | memset(&ks,0,sizeof(ks)); |
668 | memset(ks2,0,sizeof(ks2)); | 672 | memset(&ks2,0,sizeof(ks2)); |
669 | memset(iv,0,sizeof(iv)); | 673 | memset(iv,0,sizeof(iv)); |
670 | memset(iv2,0,sizeof(iv2)); | 674 | memset(iv2,0,sizeof(iv2)); |
671 | memset(kk,0,sizeof(kk)); | 675 | memset(kk,0,sizeof(kk)); |
diff --git a/src/lib/libcrypto/des/des.h b/src/lib/libcrypto/des/des.h index 6b8a7ee11b..dfe5ff64e4 100644 --- a/src/lib/libcrypto/des/des.h +++ b/src/lib/libcrypto/des/des.h | |||
@@ -59,39 +59,52 @@ | |||
59 | #ifndef HEADER_DES_H | 59 | #ifndef HEADER_DES_H |
60 | #define HEADER_DES_H | 60 | #define HEADER_DES_H |
61 | 61 | ||
62 | #ifdef NO_DES | 62 | #ifdef OPENSSL_NO_DES |
63 | #error DES is disabled. | 63 | #error DES is disabled. |
64 | #endif | 64 | #endif |
65 | 65 | ||
66 | #ifdef _KERBEROS_DES_H | ||
67 | #error <openssl/des.h> replaces <kerberos/des.h>. | ||
68 | #endif | ||
69 | |||
70 | #include <openssl/opensslconf.h> /* DES_LONG */ | 66 | #include <openssl/opensslconf.h> /* DES_LONG */ |
71 | #include <openssl/e_os2.h> /* OPENSSL_EXTERN */ | 67 | #include <openssl/e_os2.h> /* OPENSSL_EXTERN */ |
72 | 68 | ||
69 | #ifdef OPENSSL_BUILD_SHLIBCRYPTO | ||
70 | # undef OPENSSL_EXTERN | ||
71 | # define OPENSSL_EXTERN OPENSSL_EXPORT | ||
72 | #endif | ||
73 | |||
74 | #define des_SPtrans DES_SPtrans | ||
75 | |||
73 | #ifdef __cplusplus | 76 | #ifdef __cplusplus |
74 | extern "C" { | 77 | extern "C" { |
75 | #endif | 78 | #endif |
76 | 79 | ||
77 | typedef unsigned char des_cblock[8]; | 80 | typedef unsigned char DES_cblock[8]; |
78 | typedef /* const */ unsigned char const_des_cblock[8]; | 81 | typedef /* const */ unsigned char const_DES_cblock[8]; |
79 | /* With "const", gcc 2.8.1 on Solaris thinks that des_cblock * | 82 | /* With "const", gcc 2.8.1 on Solaris thinks that DES_cblock * |
80 | * and const_des_cblock * are incompatible pointer types. */ | 83 | * and const_DES_cblock * are incompatible pointer types. */ |
81 | 84 | ||
82 | typedef struct des_ks_struct | 85 | typedef struct DES_ks |
86 | { | ||
87 | union | ||
83 | { | 88 | { |
84 | union { | 89 | DES_cblock cblock; |
85 | des_cblock cblock; | 90 | /* make sure things are correct size on machines with |
86 | /* make sure things are correct size on machines with | 91 | * 8 byte longs */ |
87 | * 8 byte longs */ | 92 | DES_LONG deslong[2]; |
88 | DES_LONG deslong[2]; | 93 | } ks[16]; |
89 | } ks; | 94 | } DES_key_schedule; |
90 | int weak_key; | 95 | |
91 | } des_key_schedule[16]; | 96 | #ifndef OPENSSL_DISABLE_OLD_DES_SUPPORT |
97 | # ifndef OPENSSL_ENABLE_OLD_DES_SUPPORT | ||
98 | # define OPENSSL_ENABLE_OLD_DES_SUPPORT | ||
99 | # endif | ||
100 | #endif | ||
92 | 101 | ||
93 | #define DES_KEY_SZ (sizeof(des_cblock)) | 102 | #ifdef OPENSSL_ENABLE_OLD_DES_SUPPORT |
94 | #define DES_SCHEDULE_SZ (sizeof(des_key_schedule)) | 103 | # include <openssl/des_old.h> |
104 | #endif | ||
105 | |||
106 | #define DES_KEY_SZ (sizeof(DES_cblock)) | ||
107 | #define DES_SCHEDULE_SZ (sizeof(DES_key_schedule)) | ||
95 | 108 | ||
96 | #define DES_ENCRYPT 1 | 109 | #define DES_ENCRYPT 1 |
97 | #define DES_DECRYPT 0 | 110 | #define DES_DECRYPT 0 |
@@ -99,44 +112,45 @@ typedef struct des_ks_struct | |||
99 | #define DES_CBC_MODE 0 | 112 | #define DES_CBC_MODE 0 |
100 | #define DES_PCBC_MODE 1 | 113 | #define DES_PCBC_MODE 1 |
101 | 114 | ||
102 | #define des_ecb2_encrypt(i,o,k1,k2,e) \ | 115 | #define DES_ecb2_encrypt(i,o,k1,k2,e) \ |
103 | des_ecb3_encrypt((i),(o),(k1),(k2),(k1),(e)) | 116 | DES_ecb3_encrypt((i),(o),(k1),(k2),(k1),(e)) |
104 | 117 | ||
105 | #define des_ede2_cbc_encrypt(i,o,l,k1,k2,iv,e) \ | 118 | #define DES_ede2_cbc_encrypt(i,o,l,k1,k2,iv,e) \ |
106 | des_ede3_cbc_encrypt((i),(o),(l),(k1),(k2),(k1),(iv),(e)) | 119 | DES_ede3_cbc_encrypt((i),(o),(l),(k1),(k2),(k1),(iv),(e)) |
107 | 120 | ||
108 | #define des_ede2_cfb64_encrypt(i,o,l,k1,k2,iv,n,e) \ | 121 | #define DES_ede2_cfb64_encrypt(i,o,l,k1,k2,iv,n,e) \ |
109 | des_ede3_cfb64_encrypt((i),(o),(l),(k1),(k2),(k1),(iv),(n),(e)) | 122 | DES_ede3_cfb64_encrypt((i),(o),(l),(k1),(k2),(k1),(iv),(n),(e)) |
110 | 123 | ||
111 | #define des_ede2_ofb64_encrypt(i,o,l,k1,k2,iv,n) \ | 124 | #define DES_ede2_ofb64_encrypt(i,o,l,k1,k2,iv,n) \ |
112 | des_ede3_ofb64_encrypt((i),(o),(l),(k1),(k2),(k1),(iv),(n)) | 125 | DES_ede3_ofb64_encrypt((i),(o),(l),(k1),(k2),(k1),(iv),(n)) |
113 | 126 | ||
114 | OPENSSL_EXTERN int des_check_key; /* defaults to false */ | 127 | OPENSSL_DECLARE_GLOBAL(int,DES_check_key); /* defaults to false */ |
115 | OPENSSL_EXTERN int des_rw_mode; /* defaults to DES_PCBC_MODE */ | 128 | #define DES_check_key OPENSSL_GLOBAL_REF(DES_check_key) |
116 | OPENSSL_EXTERN int des_set_weak_key_flag; /* set the weak key flag */ | 129 | OPENSSL_DECLARE_GLOBAL(int,DES_rw_mode); /* defaults to DES_PCBC_MODE */ |
117 | 130 | #define DES_rw_mode OPENSSL_GLOBAL_REF(DES_rw_mode) | |
118 | const char *des_options(void); | 131 | |
119 | void des_ecb3_encrypt(const_des_cblock *input, des_cblock *output, | 132 | const char *DES_options(void); |
120 | des_key_schedule ks1,des_key_schedule ks2, | 133 | void DES_ecb3_encrypt(const_DES_cblock *input, DES_cblock *output, |
121 | des_key_schedule ks3, int enc); | 134 | DES_key_schedule *ks1,DES_key_schedule *ks2, |
122 | DES_LONG des_cbc_cksum(const unsigned char *input,des_cblock *output, | 135 | DES_key_schedule *ks3, int enc); |
123 | long length,des_key_schedule schedule, | 136 | DES_LONG DES_cbc_cksum(const unsigned char *input,DES_cblock *output, |
124 | const_des_cblock *ivec); | 137 | long length,DES_key_schedule *schedule, |
125 | /* des_cbc_encrypt does not update the IV! Use des_ncbc_encrypt instead. */ | 138 | const_DES_cblock *ivec); |
126 | void des_cbc_encrypt(const unsigned char *input,unsigned char *output, | 139 | /* DES_cbc_encrypt does not update the IV! Use DES_ncbc_encrypt instead. */ |
127 | long length,des_key_schedule schedule,des_cblock *ivec, | 140 | void DES_cbc_encrypt(const unsigned char *input,unsigned char *output, |
141 | long length,DES_key_schedule *schedule,DES_cblock *ivec, | ||
128 | int enc); | 142 | int enc); |
129 | void des_ncbc_encrypt(const unsigned char *input,unsigned char *output, | 143 | void DES_ncbc_encrypt(const unsigned char *input,unsigned char *output, |
130 | long length,des_key_schedule schedule,des_cblock *ivec, | 144 | long length,DES_key_schedule *schedule,DES_cblock *ivec, |
131 | int enc); | 145 | int enc); |
132 | void des_xcbc_encrypt(const unsigned char *input,unsigned char *output, | 146 | void DES_xcbc_encrypt(const unsigned char *input,unsigned char *output, |
133 | long length,des_key_schedule schedule,des_cblock *ivec, | 147 | long length,DES_key_schedule *schedule,DES_cblock *ivec, |
134 | const_des_cblock *inw,const_des_cblock *outw,int enc); | 148 | const_DES_cblock *inw,const_DES_cblock *outw,int enc); |
135 | void des_cfb_encrypt(const unsigned char *in,unsigned char *out,int numbits, | 149 | void DES_cfb_encrypt(const unsigned char *in,unsigned char *out,int numbits, |
136 | long length,des_key_schedule schedule,des_cblock *ivec, | 150 | long length,DES_key_schedule *schedule,DES_cblock *ivec, |
137 | int enc); | 151 | int enc); |
138 | void des_ecb_encrypt(const_des_cblock *input,des_cblock *output, | 152 | void DES_ecb_encrypt(const_DES_cblock *input,DES_cblock *output, |
139 | des_key_schedule ks,int enc); | 153 | DES_key_schedule *ks,int enc); |
140 | 154 | ||
141 | /* This is the DES encryption function that gets called by just about | 155 | /* This is the DES encryption function that gets called by just about |
142 | every other DES routine in the library. You should not use this | 156 | every other DES routine in the library. You should not use this |
@@ -145,119 +159,81 @@ void des_ecb_encrypt(const_des_cblock *input,des_cblock *output, | |||
145 | long, and this needs to be done to make sure 'non-aligned' memory | 159 | long, and this needs to be done to make sure 'non-aligned' memory |
146 | access do not occur. The characters are loaded 'little endian'. | 160 | access do not occur. The characters are loaded 'little endian'. |
147 | Data is a pointer to 2 unsigned long's and ks is the | 161 | Data is a pointer to 2 unsigned long's and ks is the |
148 | des_key_schedule to use. enc, is non zero specifies encryption, | 162 | DES_key_schedule to use. enc, is non zero specifies encryption, |
149 | zero if decryption. */ | 163 | zero if decryption. */ |
150 | void des_encrypt1(DES_LONG *data,des_key_schedule ks, int enc); | 164 | void DES_encrypt1(DES_LONG *data,DES_key_schedule *ks, int enc); |
151 | 165 | ||
152 | /* This functions is the same as des_encrypt1() except that the DES | 166 | /* This functions is the same as DES_encrypt1() except that the DES |
153 | initial permutation (IP) and final permutation (FP) have been left | 167 | initial permutation (IP) and final permutation (FP) have been left |
154 | out. As for des_encrypt1(), you should not use this function. | 168 | out. As for DES_encrypt1(), you should not use this function. |
155 | It is used by the routines in the library that implement triple DES. | 169 | It is used by the routines in the library that implement triple DES. |
156 | IP() des_encrypt2() des_encrypt2() des_encrypt2() FP() is the same | 170 | IP() DES_encrypt2() DES_encrypt2() DES_encrypt2() FP() is the same |
157 | as des_encrypt1() des_encrypt1() des_encrypt1() except faster :-). */ | 171 | as DES_encrypt1() DES_encrypt1() DES_encrypt1() except faster :-). */ |
158 | void des_encrypt2(DES_LONG *data,des_key_schedule ks, int enc); | 172 | void DES_encrypt2(DES_LONG *data,DES_key_schedule *ks, int enc); |
159 | 173 | ||
160 | void des_encrypt3(DES_LONG *data, des_key_schedule ks1, | 174 | void DES_encrypt3(DES_LONG *data, DES_key_schedule *ks1, |
161 | des_key_schedule ks2, des_key_schedule ks3); | 175 | DES_key_schedule *ks2, DES_key_schedule *ks3); |
162 | void des_decrypt3(DES_LONG *data, des_key_schedule ks1, | 176 | void DES_decrypt3(DES_LONG *data, DES_key_schedule *ks1, |
163 | des_key_schedule ks2, des_key_schedule ks3); | 177 | DES_key_schedule *ks2, DES_key_schedule *ks3); |
164 | void des_ede3_cbc_encrypt(const unsigned char *input,unsigned char *output, | 178 | void DES_ede3_cbc_encrypt(const unsigned char *input,unsigned char *output, |
165 | long length, | 179 | long length, |
166 | des_key_schedule ks1,des_key_schedule ks2, | 180 | DES_key_schedule *ks1,DES_key_schedule *ks2, |
167 | des_key_schedule ks3,des_cblock *ivec,int enc); | 181 | DES_key_schedule *ks3,DES_cblock *ivec,int enc); |
168 | void des_ede3_cbcm_encrypt(const unsigned char *in,unsigned char *out, | 182 | void DES_ede3_cbcm_encrypt(const unsigned char *in,unsigned char *out, |
169 | long length, | 183 | long length, |
170 | des_key_schedule ks1,des_key_schedule ks2, | 184 | DES_key_schedule *ks1,DES_key_schedule *ks2, |
171 | des_key_schedule ks3, | 185 | DES_key_schedule *ks3, |
172 | des_cblock *ivec1,des_cblock *ivec2, | 186 | DES_cblock *ivec1,DES_cblock *ivec2, |
173 | int enc); | 187 | int enc); |
174 | void des_ede3_cfb64_encrypt(const unsigned char *in,unsigned char *out, | 188 | void DES_ede3_cfb64_encrypt(const unsigned char *in,unsigned char *out, |
175 | long length,des_key_schedule ks1, | 189 | long length,DES_key_schedule *ks1, |
176 | des_key_schedule ks2,des_key_schedule ks3, | 190 | DES_key_schedule *ks2,DES_key_schedule *ks3, |
177 | des_cblock *ivec,int *num,int enc); | 191 | DES_cblock *ivec,int *num,int enc); |
178 | void des_ede3_ofb64_encrypt(const unsigned char *in,unsigned char *out, | 192 | void DES_ede3_ofb64_encrypt(const unsigned char *in,unsigned char *out, |
179 | long length,des_key_schedule ks1, | 193 | long length,DES_key_schedule *ks1, |
180 | des_key_schedule ks2,des_key_schedule ks3, | 194 | DES_key_schedule *ks2,DES_key_schedule *ks3, |
181 | des_cblock *ivec,int *num); | 195 | DES_cblock *ivec,int *num); |
182 | 196 | ||
183 | void des_xwhite_in2out(const_des_cblock *des_key,const_des_cblock *in_white, | 197 | void DES_xwhite_in2out(const_DES_cblock *DES_key,const_DES_cblock *in_white, |
184 | des_cblock *out_white); | 198 | DES_cblock *out_white); |
185 | 199 | ||
186 | int des_enc_read(int fd,void *buf,int len,des_key_schedule sched, | 200 | int DES_enc_read(int fd,void *buf,int len,DES_key_schedule *sched, |
187 | des_cblock *iv); | 201 | DES_cblock *iv); |
188 | int des_enc_write(int fd,const void *buf,int len,des_key_schedule sched, | 202 | int DES_enc_write(int fd,const void *buf,int len,DES_key_schedule *sched, |
189 | des_cblock *iv); | 203 | DES_cblock *iv); |
190 | char *des_fcrypt(const char *buf,const char *salt, char *ret); | 204 | char *DES_fcrypt(const char *buf,const char *salt, char *ret); |
191 | char *des_crypt(const char *buf,const char *salt); | 205 | char *DES_crypt(const char *buf,const char *salt); |
192 | #if !defined(PERL5) && !defined(__FreeBSD__) && !defined(NeXT) | 206 | void DES_ofb_encrypt(const unsigned char *in,unsigned char *out,int numbits, |
193 | char *crypt(const char *buf,const char *salt); | 207 | long length,DES_key_schedule *schedule,DES_cblock *ivec); |
194 | #endif | 208 | void DES_pcbc_encrypt(const unsigned char *input,unsigned char *output, |
195 | void des_ofb_encrypt(const unsigned char *in,unsigned char *out,int numbits, | 209 | long length,DES_key_schedule *schedule,DES_cblock *ivec, |
196 | long length,des_key_schedule schedule,des_cblock *ivec); | ||
197 | void des_pcbc_encrypt(const unsigned char *input,unsigned char *output, | ||
198 | long length,des_key_schedule schedule,des_cblock *ivec, | ||
199 | int enc); | 210 | int enc); |
200 | DES_LONG des_quad_cksum(const unsigned char *input,des_cblock output[], | 211 | DES_LONG DES_quad_cksum(const unsigned char *input,DES_cblock output[], |
201 | long length,int out_count,des_cblock *seed); | 212 | long length,int out_count,DES_cblock *seed); |
202 | void des_random_seed(des_cblock *key); | 213 | int DES_random_key(DES_cblock *ret); |
203 | int des_random_key(des_cblock *ret); | 214 | void DES_set_odd_parity(DES_cblock *key); |
204 | int des_read_password(des_cblock *key,const char *prompt,int verify); | 215 | int DES_check_key_parity(const_DES_cblock *key); |
205 | int des_read_2passwords(des_cblock *key1,des_cblock *key2, | 216 | int DES_is_weak_key(const_DES_cblock *key); |
206 | const char *prompt,int verify); | 217 | /* DES_set_key (= set_key = DES_key_sched = key_sched) calls |
207 | int des_read_pw_string(char *buf,int length,const char *prompt,int verify); | 218 | * DES_set_key_checked if global variable DES_check_key is set, |
208 | void des_set_odd_parity(des_cblock *key); | 219 | * DES_set_key_unchecked otherwise. */ |
209 | int des_check_key_parity(const_des_cblock *key); | 220 | int DES_set_key(const_DES_cblock *key,DES_key_schedule *schedule); |
210 | int des_is_weak_key(const_des_cblock *key); | 221 | int DES_key_sched(const_DES_cblock *key,DES_key_schedule *schedule); |
211 | /* des_set_key (= set_key = des_key_sched = key_sched) calls | 222 | int DES_set_key_checked(const_DES_cblock *key,DES_key_schedule *schedule); |
212 | * des_set_key_checked if global variable des_check_key is set, | 223 | void DES_set_key_unchecked(const_DES_cblock *key,DES_key_schedule *schedule); |
213 | * des_set_key_unchecked otherwise. */ | 224 | void DES_string_to_key(const char *str,DES_cblock *key); |
214 | int des_set_key(const_des_cblock *key,des_key_schedule schedule); | 225 | void DES_string_to_2keys(const char *str,DES_cblock *key1,DES_cblock *key2); |
215 | int des_key_sched(const_des_cblock *key,des_key_schedule schedule); | 226 | void DES_cfb64_encrypt(const unsigned char *in,unsigned char *out,long length, |
216 | int des_set_key_checked(const_des_cblock *key,des_key_schedule schedule); | 227 | DES_key_schedule *schedule,DES_cblock *ivec,int *num, |
217 | void des_set_key_unchecked(const_des_cblock *key,des_key_schedule schedule); | ||
218 | void des_string_to_key(const char *str,des_cblock *key); | ||
219 | void des_string_to_2keys(const char *str,des_cblock *key1,des_cblock *key2); | ||
220 | void des_cfb64_encrypt(const unsigned char *in,unsigned char *out,long length, | ||
221 | des_key_schedule schedule,des_cblock *ivec,int *num, | ||
222 | int enc); | 228 | int enc); |
223 | void des_ofb64_encrypt(const unsigned char *in,unsigned char *out,long length, | 229 | void DES_ofb64_encrypt(const unsigned char *in,unsigned char *out,long length, |
224 | des_key_schedule schedule,des_cblock *ivec,int *num); | 230 | DES_key_schedule *schedule,DES_cblock *ivec,int *num); |
225 | int des_read_pw(char *buf,char *buff,int size,const char *prompt,int verify); | ||
226 | |||
227 | /* The following definitions provide compatibility with the MIT Kerberos | ||
228 | * library. The des_key_schedule structure is not binary compatible. */ | ||
229 | 231 | ||
230 | #define _KERBEROS_DES_H | 232 | int DES_read_password(DES_cblock *key, const char *prompt, int verify); |
231 | 233 | int DES_read_2passwords(DES_cblock *key1, DES_cblock *key2, const char *prompt, | |
232 | #define KRBDES_ENCRYPT DES_ENCRYPT | 234 | int verify); |
233 | #define KRBDES_DECRYPT DES_DECRYPT | ||
234 | |||
235 | #ifdef KERBEROS | ||
236 | # define ENCRYPT DES_ENCRYPT | ||
237 | # define DECRYPT DES_DECRYPT | ||
238 | #endif | ||
239 | |||
240 | #ifndef NCOMPAT | ||
241 | # define C_Block des_cblock | ||
242 | # define Key_schedule des_key_schedule | ||
243 | # define KEY_SZ DES_KEY_SZ | ||
244 | # define string_to_key des_string_to_key | ||
245 | # define read_pw_string des_read_pw_string | ||
246 | # define random_key des_random_key | ||
247 | # define pcbc_encrypt des_pcbc_encrypt | ||
248 | # define set_key des_set_key | ||
249 | # define key_sched des_key_sched | ||
250 | # define ecb_encrypt des_ecb_encrypt | ||
251 | # define cbc_encrypt des_cbc_encrypt | ||
252 | # define ncbc_encrypt des_ncbc_encrypt | ||
253 | # define xcbc_encrypt des_xcbc_encrypt | ||
254 | # define cbc_cksum des_cbc_cksum | ||
255 | # define quad_cksum des_quad_cksum | ||
256 | # define check_parity des_check_key_parity | ||
257 | #endif | ||
258 | 235 | ||
259 | typedef des_key_schedule bit_64; | 236 | #define DES_fixup_key_parity DES_set_odd_parity |
260 | #define des_fixup_key_parity des_set_odd_parity | ||
261 | 237 | ||
262 | #ifdef __cplusplus | 238 | #ifdef __cplusplus |
263 | } | 239 | } |
diff --git a/src/lib/libcrypto/des/des_enc.c b/src/lib/libcrypto/des/des_enc.c index 0bd9fa39bc..1c37ab96d3 100644 --- a/src/lib/libcrypto/des/des_enc.c +++ b/src/lib/libcrypto/des/des_enc.c | |||
@@ -58,11 +58,11 @@ | |||
58 | 58 | ||
59 | #include "des_locl.h" | 59 | #include "des_locl.h" |
60 | 60 | ||
61 | void des_encrypt1(DES_LONG *data, des_key_schedule ks, int enc) | 61 | void DES_encrypt1(DES_LONG *data, DES_key_schedule *ks, int enc) |
62 | { | 62 | { |
63 | register DES_LONG l,r,t,u; | 63 | register DES_LONG l,r,t,u; |
64 | #ifdef DES_PTR | 64 | #ifdef DES_PTR |
65 | register const unsigned char *des_SP=(const unsigned char *)des_SPtrans; | 65 | register const unsigned char *des_SP=(const unsigned char *)DES_SPtrans; |
66 | #endif | 66 | #endif |
67 | #ifndef DES_UNROLL | 67 | #ifndef DES_UNROLL |
68 | register int i; | 68 | register int i; |
@@ -75,7 +75,7 @@ void des_encrypt1(DES_LONG *data, des_key_schedule ks, int enc) | |||
75 | IP(r,l); | 75 | IP(r,l); |
76 | /* Things have been modified so that the initial rotate is | 76 | /* Things have been modified so that the initial rotate is |
77 | * done outside the loop. This required the | 77 | * done outside the loop. This required the |
78 | * des_SPtrans values in sp.h to be rotated 1 bit to the right. | 78 | * DES_SPtrans values in sp.h to be rotated 1 bit to the right. |
79 | * One perl script later and things have a 5% speed up on a sparc2. | 79 | * One perl script later and things have a 5% speed up on a sparc2. |
80 | * Thanks to Richard Outerbridge <71755.204@CompuServe.COM> | 80 | * Thanks to Richard Outerbridge <71755.204@CompuServe.COM> |
81 | * for pointing this out. */ | 81 | * for pointing this out. */ |
@@ -84,7 +84,7 @@ void des_encrypt1(DES_LONG *data, des_key_schedule ks, int enc) | |||
84 | r=ROTATE(r,29)&0xffffffffL; | 84 | r=ROTATE(r,29)&0xffffffffL; |
85 | l=ROTATE(l,29)&0xffffffffL; | 85 | l=ROTATE(l,29)&0xffffffffL; |
86 | 86 | ||
87 | s=ks->ks.deslong; | 87 | s=ks->ks->deslong; |
88 | /* I don't know if it is worth the effort of loop unrolling the | 88 | /* I don't know if it is worth the effort of loop unrolling the |
89 | * inner loop */ | 89 | * inner loop */ |
90 | if (enc) | 90 | if (enc) |
@@ -156,11 +156,11 @@ void des_encrypt1(DES_LONG *data, des_key_schedule ks, int enc) | |||
156 | l=r=t=u=0; | 156 | l=r=t=u=0; |
157 | } | 157 | } |
158 | 158 | ||
159 | void des_encrypt2(DES_LONG *data, des_key_schedule ks, int enc) | 159 | void DES_encrypt2(DES_LONG *data, DES_key_schedule *ks, int enc) |
160 | { | 160 | { |
161 | register DES_LONG l,r,t,u; | 161 | register DES_LONG l,r,t,u; |
162 | #ifdef DES_PTR | 162 | #ifdef DES_PTR |
163 | register const unsigned char *des_SP=(const unsigned char *)des_SPtrans; | 163 | register const unsigned char *des_SP=(const unsigned char *)DES_SPtrans; |
164 | #endif | 164 | #endif |
165 | #ifndef DES_UNROLL | 165 | #ifndef DES_UNROLL |
166 | register int i; | 166 | register int i; |
@@ -172,7 +172,7 @@ void des_encrypt2(DES_LONG *data, des_key_schedule ks, int enc) | |||
172 | 172 | ||
173 | /* Things have been modified so that the initial rotate is | 173 | /* Things have been modified so that the initial rotate is |
174 | * done outside the loop. This required the | 174 | * done outside the loop. This required the |
175 | * des_SPtrans values in sp.h to be rotated 1 bit to the right. | 175 | * DES_SPtrans values in sp.h to be rotated 1 bit to the right. |
176 | * One perl script later and things have a 5% speed up on a sparc2. | 176 | * One perl script later and things have a 5% speed up on a sparc2. |
177 | * Thanks to Richard Outerbridge <71755.204@CompuServe.COM> | 177 | * Thanks to Richard Outerbridge <71755.204@CompuServe.COM> |
178 | * for pointing this out. */ | 178 | * for pointing this out. */ |
@@ -180,7 +180,7 @@ void des_encrypt2(DES_LONG *data, des_key_schedule ks, int enc) | |||
180 | r=ROTATE(r,29)&0xffffffffL; | 180 | r=ROTATE(r,29)&0xffffffffL; |
181 | l=ROTATE(l,29)&0xffffffffL; | 181 | l=ROTATE(l,29)&0xffffffffL; |
182 | 182 | ||
183 | s=ks->ks.deslong; | 183 | s=ks->ks->deslong; |
184 | /* I don't know if it is worth the effort of loop unrolling the | 184 | /* I don't know if it is worth the effort of loop unrolling the |
185 | * inner loop */ | 185 | * inner loop */ |
186 | if (enc) | 186 | if (enc) |
@@ -247,8 +247,8 @@ void des_encrypt2(DES_LONG *data, des_key_schedule ks, int enc) | |||
247 | l=r=t=u=0; | 247 | l=r=t=u=0; |
248 | } | 248 | } |
249 | 249 | ||
250 | void des_encrypt3(DES_LONG *data, des_key_schedule ks1, des_key_schedule ks2, | 250 | void DES_encrypt3(DES_LONG *data, DES_key_schedule *ks1, |
251 | des_key_schedule ks3) | 251 | DES_key_schedule *ks2, DES_key_schedule *ks3) |
252 | { | 252 | { |
253 | register DES_LONG l,r; | 253 | register DES_LONG l,r; |
254 | 254 | ||
@@ -257,9 +257,9 @@ void des_encrypt3(DES_LONG *data, des_key_schedule ks1, des_key_schedule ks2, | |||
257 | IP(l,r); | 257 | IP(l,r); |
258 | data[0]=l; | 258 | data[0]=l; |
259 | data[1]=r; | 259 | data[1]=r; |
260 | des_encrypt2((DES_LONG *)data,ks1,DES_ENCRYPT); | 260 | DES_encrypt2((DES_LONG *)data,ks1,DES_ENCRYPT); |
261 | des_encrypt2((DES_LONG *)data,ks2,DES_DECRYPT); | 261 | DES_encrypt2((DES_LONG *)data,ks2,DES_DECRYPT); |
262 | des_encrypt2((DES_LONG *)data,ks3,DES_ENCRYPT); | 262 | DES_encrypt2((DES_LONG *)data,ks3,DES_ENCRYPT); |
263 | l=data[0]; | 263 | l=data[0]; |
264 | r=data[1]; | 264 | r=data[1]; |
265 | FP(r,l); | 265 | FP(r,l); |
@@ -267,8 +267,8 @@ void des_encrypt3(DES_LONG *data, des_key_schedule ks1, des_key_schedule ks2, | |||
267 | data[1]=r; | 267 | data[1]=r; |
268 | } | 268 | } |
269 | 269 | ||
270 | void des_decrypt3(DES_LONG *data, des_key_schedule ks1, des_key_schedule ks2, | 270 | void DES_decrypt3(DES_LONG *data, DES_key_schedule *ks1, |
271 | des_key_schedule ks3) | 271 | DES_key_schedule *ks2, DES_key_schedule *ks3) |
272 | { | 272 | { |
273 | register DES_LONG l,r; | 273 | register DES_LONG l,r; |
274 | 274 | ||
@@ -277,9 +277,9 @@ void des_decrypt3(DES_LONG *data, des_key_schedule ks1, des_key_schedule ks2, | |||
277 | IP(l,r); | 277 | IP(l,r); |
278 | data[0]=l; | 278 | data[0]=l; |
279 | data[1]=r; | 279 | data[1]=r; |
280 | des_encrypt2((DES_LONG *)data,ks3,DES_DECRYPT); | 280 | DES_encrypt2((DES_LONG *)data,ks3,DES_DECRYPT); |
281 | des_encrypt2((DES_LONG *)data,ks2,DES_ENCRYPT); | 281 | DES_encrypt2((DES_LONG *)data,ks2,DES_ENCRYPT); |
282 | des_encrypt2((DES_LONG *)data,ks1,DES_DECRYPT); | 282 | DES_encrypt2((DES_LONG *)data,ks1,DES_DECRYPT); |
283 | l=data[0]; | 283 | l=data[0]; |
284 | r=data[1]; | 284 | r=data[1]; |
285 | FP(r,l); | 285 | FP(r,l); |
@@ -290,11 +290,12 @@ void des_decrypt3(DES_LONG *data, des_key_schedule ks1, des_key_schedule ks2, | |||
290 | #ifndef DES_DEFAULT_OPTIONS | 290 | #ifndef DES_DEFAULT_OPTIONS |
291 | 291 | ||
292 | #undef CBC_ENC_C__DONT_UPDATE_IV | 292 | #undef CBC_ENC_C__DONT_UPDATE_IV |
293 | #include "ncbc_enc.c" /* des_ncbc_encrypt */ | 293 | #include "ncbc_enc.c" /* DES_ncbc_encrypt */ |
294 | 294 | ||
295 | void des_ede3_cbc_encrypt(const unsigned char *input, unsigned char *output, | 295 | void DES_ede3_cbc_encrypt(const unsigned char *input, unsigned char *output, |
296 | long length, des_key_schedule ks1, des_key_schedule ks2, | 296 | long length, DES_key_schedule *ks1, |
297 | des_key_schedule ks3, des_cblock *ivec, int enc) | 297 | DES_key_schedule *ks2, DES_key_schedule *ks3, |
298 | DES_cblock *ivec, int enc) | ||
298 | { | 299 | { |
299 | register DES_LONG tin0,tin1; | 300 | register DES_LONG tin0,tin1; |
300 | register DES_LONG tout0,tout1,xor0,xor1; | 301 | register DES_LONG tout0,tout1,xor0,xor1; |
@@ -321,7 +322,7 @@ void des_ede3_cbc_encrypt(const unsigned char *input, unsigned char *output, | |||
321 | 322 | ||
322 | tin[0]=tin0; | 323 | tin[0]=tin0; |
323 | tin[1]=tin1; | 324 | tin[1]=tin1; |
324 | des_encrypt3((DES_LONG *)tin,ks1,ks2,ks3); | 325 | DES_encrypt3((DES_LONG *)tin,ks1,ks2,ks3); |
325 | tout0=tin[0]; | 326 | tout0=tin[0]; |
326 | tout1=tin[1]; | 327 | tout1=tin[1]; |
327 | 328 | ||
@@ -336,7 +337,7 @@ void des_ede3_cbc_encrypt(const unsigned char *input, unsigned char *output, | |||
336 | 337 | ||
337 | tin[0]=tin0; | 338 | tin[0]=tin0; |
338 | tin[1]=tin1; | 339 | tin[1]=tin1; |
339 | des_encrypt3((DES_LONG *)tin,ks1,ks2,ks3); | 340 | DES_encrypt3((DES_LONG *)tin,ks1,ks2,ks3); |
340 | tout0=tin[0]; | 341 | tout0=tin[0]; |
341 | tout1=tin[1]; | 342 | tout1=tin[1]; |
342 | 343 | ||
@@ -363,7 +364,7 @@ void des_ede3_cbc_encrypt(const unsigned char *input, unsigned char *output, | |||
363 | 364 | ||
364 | tin[0]=tin0; | 365 | tin[0]=tin0; |
365 | tin[1]=tin1; | 366 | tin[1]=tin1; |
366 | des_decrypt3((DES_LONG *)tin,ks1,ks2,ks3); | 367 | DES_decrypt3((DES_LONG *)tin,ks1,ks2,ks3); |
367 | tout0=tin[0]; | 368 | tout0=tin[0]; |
368 | tout1=tin[1]; | 369 | tout1=tin[1]; |
369 | 370 | ||
@@ -384,7 +385,7 @@ void des_ede3_cbc_encrypt(const unsigned char *input, unsigned char *output, | |||
384 | 385 | ||
385 | tin[0]=tin0; | 386 | tin[0]=tin0; |
386 | tin[1]=tin1; | 387 | tin[1]=tin1; |
387 | des_decrypt3((DES_LONG *)tin,ks1,ks2,ks3); | 388 | DES_decrypt3((DES_LONG *)tin,ks1,ks2,ks3); |
388 | tout0=tin[0]; | 389 | tout0=tin[0]; |
389 | tout1=tin[1]; | 390 | tout1=tin[1]; |
390 | 391 | ||
diff --git a/src/lib/libcrypto/des/des_locl.h b/src/lib/libcrypto/des/des_locl.h index 1ace8f5930..70e833be3f 100644 --- a/src/lib/libcrypto/des/des_locl.h +++ b/src/lib/libcrypto/des/des_locl.h | |||
@@ -59,19 +59,19 @@ | |||
59 | #ifndef HEADER_DES_LOCL_H | 59 | #ifndef HEADER_DES_LOCL_H |
60 | #define HEADER_DES_LOCL_H | 60 | #define HEADER_DES_LOCL_H |
61 | 61 | ||
62 | #if defined(WIN32) || defined(WIN16) | 62 | #include <openssl/e_os2.h> |
63 | #ifndef MSDOS | 63 | |
64 | #define MSDOS | 64 | #if defined(OPENSSL_SYS_WIN32) || defined(OPENSSL_SYS_WIN16) |
65 | #ifndef OPENSSL_SYS_MSDOS | ||
66 | #define OPENSSL_SYS_MSDOS | ||
65 | #endif | 67 | #endif |
66 | #endif | 68 | #endif |
67 | 69 | ||
68 | #include <stdio.h> | 70 | #include <stdio.h> |
69 | #include <stdlib.h> | 71 | #include <stdlib.h> |
70 | 72 | ||
71 | #include <openssl/opensslconf.h> | 73 | #ifndef OPENSSL_SYS_MSDOS |
72 | 74 | #if !defined(OPENSSL_SYS_VMS) || defined(__DECC) | |
73 | #ifndef MSDOS | ||
74 | #if !defined(VMS) || defined(__DECC) | ||
75 | #ifdef OPENSSL_UNISTD | 75 | #ifdef OPENSSL_UNISTD |
76 | # include OPENSSL_UNISTD | 76 | # include OPENSSL_UNISTD |
77 | #else | 77 | #else |
@@ -82,17 +82,22 @@ | |||
82 | #endif | 82 | #endif |
83 | #include <openssl/des.h> | 83 | #include <openssl/des.h> |
84 | 84 | ||
85 | #ifdef MSDOS /* Visual C++ 2.1 (Windows NT/95) */ | 85 | #ifdef OPENSSL_SYS_MSDOS /* Visual C++ 2.1 (Windows NT/95) */ |
86 | #include <stdlib.h> | 86 | #include <stdlib.h> |
87 | #include <errno.h> | 87 | #include <errno.h> |
88 | #include <time.h> | 88 | #include <time.h> |
89 | #include <io.h> | 89 | #include <io.h> |
90 | #endif | 90 | #endif |
91 | 91 | ||
92 | #if defined(__STDC__) || defined(VMS) || defined(M_XENIX) || defined(MSDOS) | 92 | #if defined(__STDC__) || defined(OPENSSL_SYS_VMS) || defined(M_XENIX) || defined(OPENSSL_SYS_MSDOS) |
93 | #include <string.h> | 93 | #include <string.h> |
94 | #endif | 94 | #endif |
95 | 95 | ||
96 | #ifdef OPENSSL_BUILD_SHLIBCRYPTO | ||
97 | # undef OPENSSL_EXTERN | ||
98 | # define OPENSSL_EXTERN OPENSSL_EXPORT | ||
99 | #endif | ||
100 | |||
96 | #define ITERATIONS 16 | 101 | #define ITERATIONS 16 |
97 | #define HALF_ITERATIONS 8 | 102 | #define HALF_ITERATIONS 8 |
98 | 103 | ||
@@ -155,7 +160,7 @@ | |||
155 | } \ | 160 | } \ |
156 | } | 161 | } |
157 | 162 | ||
158 | #if defined(WIN32) && defined(_MSC_VER) | 163 | #if defined(OPENSSL_SYS_WIN32) && defined(_MSC_VER) |
159 | #define ROTATE(a,n) (_lrotr(a,n)) | 164 | #define ROTATE(a,n) (_lrotr(a,n)) |
160 | #else | 165 | #else |
161 | #define ROTATE(a,n) (((a)>>(n))+((a)<<(32-(n)))) | 166 | #define ROTATE(a,n) (((a)>>(n))+((a)<<(32-(n)))) |
@@ -278,24 +283,24 @@ | |||
278 | u1=(int)u&0x3f; \ | 283 | u1=(int)u&0x3f; \ |
279 | u2&=0x3f; \ | 284 | u2&=0x3f; \ |
280 | u>>=16L; \ | 285 | u>>=16L; \ |
281 | LL^=des_SPtrans[0][u1]; \ | 286 | LL^=DES_SPtrans[0][u1]; \ |
282 | LL^=des_SPtrans[2][u2]; \ | 287 | LL^=DES_SPtrans[2][u2]; \ |
283 | u3=(int)u>>8L; \ | 288 | u3=(int)u>>8L; \ |
284 | u1=(int)u&0x3f; \ | 289 | u1=(int)u&0x3f; \ |
285 | u3&=0x3f; \ | 290 | u3&=0x3f; \ |
286 | LL^=des_SPtrans[4][u1]; \ | 291 | LL^=DES_SPtrans[4][u1]; \ |
287 | LL^=des_SPtrans[6][u3]; \ | 292 | LL^=DES_SPtrans[6][u3]; \ |
288 | u2=(int)t>>8L; \ | 293 | u2=(int)t>>8L; \ |
289 | u1=(int)t&0x3f; \ | 294 | u1=(int)t&0x3f; \ |
290 | u2&=0x3f; \ | 295 | u2&=0x3f; \ |
291 | t>>=16L; \ | 296 | t>>=16L; \ |
292 | LL^=des_SPtrans[1][u1]; \ | 297 | LL^=DES_SPtrans[1][u1]; \ |
293 | LL^=des_SPtrans[3][u2]; \ | 298 | LL^=DES_SPtrans[3][u2]; \ |
294 | u3=(int)t>>8L; \ | 299 | u3=(int)t>>8L; \ |
295 | u1=(int)t&0x3f; \ | 300 | u1=(int)t&0x3f; \ |
296 | u3&=0x3f; \ | 301 | u3&=0x3f; \ |
297 | LL^=des_SPtrans[5][u1]; \ | 302 | LL^=DES_SPtrans[5][u1]; \ |
298 | LL^=des_SPtrans[7][u3]; } | 303 | LL^=DES_SPtrans[7][u3]; } |
299 | #endif | 304 | #endif |
300 | #ifdef DES_RISC2 | 305 | #ifdef DES_RISC2 |
301 | #define D_ENCRYPT(LL,R,S) {\ | 306 | #define D_ENCRYPT(LL,R,S) {\ |
@@ -306,25 +311,25 @@ | |||
306 | u2=(int)u>>8L; \ | 311 | u2=(int)u>>8L; \ |
307 | u1=(int)u&0x3f; \ | 312 | u1=(int)u&0x3f; \ |
308 | u2&=0x3f; \ | 313 | u2&=0x3f; \ |
309 | LL^=des_SPtrans[0][u1]; \ | 314 | LL^=DES_SPtrans[0][u1]; \ |
310 | LL^=des_SPtrans[2][u2]; \ | 315 | LL^=DES_SPtrans[2][u2]; \ |
311 | s1=(int)u>>16L; \ | 316 | s1=(int)u>>16L; \ |
312 | s2=(int)u>>24L; \ | 317 | s2=(int)u>>24L; \ |
313 | s1&=0x3f; \ | 318 | s1&=0x3f; \ |
314 | s2&=0x3f; \ | 319 | s2&=0x3f; \ |
315 | LL^=des_SPtrans[4][s1]; \ | 320 | LL^=DES_SPtrans[4][s1]; \ |
316 | LL^=des_SPtrans[6][s2]; \ | 321 | LL^=DES_SPtrans[6][s2]; \ |
317 | u2=(int)t>>8L; \ | 322 | u2=(int)t>>8L; \ |
318 | u1=(int)t&0x3f; \ | 323 | u1=(int)t&0x3f; \ |
319 | u2&=0x3f; \ | 324 | u2&=0x3f; \ |
320 | LL^=des_SPtrans[1][u1]; \ | 325 | LL^=DES_SPtrans[1][u1]; \ |
321 | LL^=des_SPtrans[3][u2]; \ | 326 | LL^=DES_SPtrans[3][u2]; \ |
322 | s1=(int)t>>16; \ | 327 | s1=(int)t>>16; \ |
323 | s2=(int)t>>24L; \ | 328 | s2=(int)t>>24L; \ |
324 | s1&=0x3f; \ | 329 | s1&=0x3f; \ |
325 | s2&=0x3f; \ | 330 | s2&=0x3f; \ |
326 | LL^=des_SPtrans[5][s1]; \ | 331 | LL^=DES_SPtrans[5][s1]; \ |
327 | LL^=des_SPtrans[7][s2]; } | 332 | LL^=DES_SPtrans[7][s2]; } |
328 | #endif | 333 | #endif |
329 | 334 | ||
330 | #else | 335 | #else |
@@ -333,14 +338,14 @@ | |||
333 | LOAD_DATA_tmp(R,S,u,t,E0,E1); \ | 338 | LOAD_DATA_tmp(R,S,u,t,E0,E1); \ |
334 | t=ROTATE(t,4); \ | 339 | t=ROTATE(t,4); \ |
335 | LL^=\ | 340 | LL^=\ |
336 | des_SPtrans[0][(u>> 2L)&0x3f]^ \ | 341 | DES_SPtrans[0][(u>> 2L)&0x3f]^ \ |
337 | des_SPtrans[2][(u>>10L)&0x3f]^ \ | 342 | DES_SPtrans[2][(u>>10L)&0x3f]^ \ |
338 | des_SPtrans[4][(u>>18L)&0x3f]^ \ | 343 | DES_SPtrans[4][(u>>18L)&0x3f]^ \ |
339 | des_SPtrans[6][(u>>26L)&0x3f]^ \ | 344 | DES_SPtrans[6][(u>>26L)&0x3f]^ \ |
340 | des_SPtrans[1][(t>> 2L)&0x3f]^ \ | 345 | DES_SPtrans[1][(t>> 2L)&0x3f]^ \ |
341 | des_SPtrans[3][(t>>10L)&0x3f]^ \ | 346 | DES_SPtrans[3][(t>>10L)&0x3f]^ \ |
342 | des_SPtrans[5][(t>>18L)&0x3f]^ \ | 347 | DES_SPtrans[5][(t>>18L)&0x3f]^ \ |
343 | des_SPtrans[7][(t>>26L)&0x3f]; } | 348 | DES_SPtrans[7][(t>>26L)&0x3f]; } |
344 | #endif | 349 | #endif |
345 | #endif | 350 | #endif |
346 | 351 | ||
@@ -405,8 +410,8 @@ | |||
405 | PERM_OP(l,r,tt, 4,0x0f0f0f0fL); \ | 410 | PERM_OP(l,r,tt, 4,0x0f0f0f0fL); \ |
406 | } | 411 | } |
407 | 412 | ||
408 | OPENSSL_EXTERN const DES_LONG des_SPtrans[8][64]; | 413 | OPENSSL_EXTERN const DES_LONG DES_SPtrans[8][64]; |
409 | 414 | ||
410 | void fcrypt_body(DES_LONG *out,des_key_schedule ks, | 415 | void fcrypt_body(DES_LONG *out,DES_key_schedule *ks, |
411 | DES_LONG Eswap0, DES_LONG Eswap1); | 416 | DES_LONG Eswap0, DES_LONG Eswap1); |
412 | #endif | 417 | #endif |
diff --git a/src/lib/libcrypto/des/des_old.c b/src/lib/libcrypto/des/des_old.c new file mode 100644 index 0000000000..7e4cd7180d --- /dev/null +++ b/src/lib/libcrypto/des/des_old.c | |||
@@ -0,0 +1,271 @@ | |||
1 | /* crypto/des/des_old.c -*- mode:C; c-file-style: "eay" -*- */ | ||
2 | |||
3 | /* WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING | ||
4 | * | ||
5 | * The function names in here are deprecated and are only present to | ||
6 | * provide an interface compatible with libdes. OpenSSL now provides | ||
7 | * functions where "des_" has been replaced with "DES_" in the names, | ||
8 | * to make it possible to make incompatible changes that are needed | ||
9 | * for C type security and other stuff. | ||
10 | * | ||
11 | * Please consider starting to use the DES_ functions rather than the | ||
12 | * des_ ones. The des_ functions will dissapear completely before | ||
13 | * OpenSSL 1.0! | ||
14 | * | ||
15 | * WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING | ||
16 | */ | ||
17 | |||
18 | /* Written by Richard Levitte (richard@levitte.org) for the OpenSSL | ||
19 | * project 2001. | ||
20 | */ | ||
21 | /* ==================================================================== | ||
22 | * Copyright (c) 1998-2001 The OpenSSL Project. All rights reserved. | ||
23 | * | ||
24 | * Redistribution and use in source and binary forms, with or without | ||
25 | * modification, are permitted provided that the following conditions | ||
26 | * are met: | ||
27 | * | ||
28 | * 1. Redistributions of source code must retain the above copyright | ||
29 | * notice, this list of conditions and the following disclaimer. | ||
30 | * | ||
31 | * 2. Redistributions in binary form must reproduce the above copyright | ||
32 | * notice, this list of conditions and the following disclaimer in | ||
33 | * the documentation and/or other materials provided with the | ||
34 | * distribution. | ||
35 | * | ||
36 | * 3. All advertising materials mentioning features or use of this | ||
37 | * software must display the following acknowledgment: | ||
38 | * "This product includes software developed by the OpenSSL Project | ||
39 | * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" | ||
40 | * | ||
41 | * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to | ||
42 | * endorse or promote products derived from this software without | ||
43 | * prior written permission. For written permission, please contact | ||
44 | * openssl-core@openssl.org. | ||
45 | * | ||
46 | * 5. Products derived from this software may not be called "OpenSSL" | ||
47 | * nor may "OpenSSL" appear in their names without prior written | ||
48 | * permission of the OpenSSL Project. | ||
49 | * | ||
50 | * 6. Redistributions of any form whatsoever must retain the following | ||
51 | * acknowledgment: | ||
52 | * "This product includes software developed by the OpenSSL Project | ||
53 | * for use in the OpenSSL Toolkit (http://www.openssl.org/)" | ||
54 | * | ||
55 | * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY | ||
56 | * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
57 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
58 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR | ||
59 | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
60 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
61 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
62 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
63 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
64 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
65 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | ||
66 | * OF THE POSSIBILITY OF SUCH DAMAGE. | ||
67 | * ==================================================================== | ||
68 | * | ||
69 | * This product includes cryptographic software written by Eric Young | ||
70 | * (eay@cryptsoft.com). This product includes software written by Tim | ||
71 | * Hudson (tjh@cryptsoft.com). | ||
72 | * | ||
73 | */ | ||
74 | |||
75 | #define OPENSSL_DES_LIBDES_COMPATIBILITY | ||
76 | #include <openssl/des.h> | ||
77 | #include <openssl/rand.h> | ||
78 | |||
79 | const char *_ossl_old_des_options(void) | ||
80 | { | ||
81 | return DES_options(); | ||
82 | } | ||
83 | void _ossl_old_des_ecb3_encrypt(_ossl_old_des_cblock *input,_ossl_old_des_cblock *output, | ||
84 | des_key_schedule ks1,des_key_schedule ks2, | ||
85 | des_key_schedule ks3, int enc) | ||
86 | { | ||
87 | DES_ecb3_encrypt((const_DES_cblock *)input, output, | ||
88 | (DES_key_schedule *)ks1, (DES_key_schedule *)ks2, | ||
89 | (DES_key_schedule *)ks3, enc); | ||
90 | } | ||
91 | DES_LONG _ossl_old_des_cbc_cksum(_ossl_old_des_cblock *input,_ossl_old_des_cblock *output, | ||
92 | long length,des_key_schedule schedule,_ossl_old_des_cblock *ivec) | ||
93 | { | ||
94 | return DES_cbc_cksum((unsigned char *)input, output, length, | ||
95 | (DES_key_schedule *)schedule, ivec); | ||
96 | } | ||
97 | void _ossl_old_des_cbc_encrypt(_ossl_old_des_cblock *input,_ossl_old_des_cblock *output,long length, | ||
98 | des_key_schedule schedule,_ossl_old_des_cblock *ivec,int enc) | ||
99 | { | ||
100 | DES_cbc_encrypt((unsigned char *)input, (unsigned char *)output, | ||
101 | length, (DES_key_schedule *)schedule, ivec, enc); | ||
102 | } | ||
103 | void _ossl_old_des_ncbc_encrypt(_ossl_old_des_cblock *input,_ossl_old_des_cblock *output,long length, | ||
104 | des_key_schedule schedule,_ossl_old_des_cblock *ivec,int enc) | ||
105 | { | ||
106 | DES_ncbc_encrypt((unsigned char *)input, (unsigned char *)output, | ||
107 | length, (DES_key_schedule *)schedule, ivec, enc); | ||
108 | } | ||
109 | void _ossl_old_des_xcbc_encrypt(_ossl_old_des_cblock *input,_ossl_old_des_cblock *output,long length, | ||
110 | des_key_schedule schedule,_ossl_old_des_cblock *ivec, | ||
111 | _ossl_old_des_cblock *inw,_ossl_old_des_cblock *outw,int enc) | ||
112 | { | ||
113 | DES_xcbc_encrypt((unsigned char *)input, (unsigned char *)output, | ||
114 | length, (DES_key_schedule *)schedule, ivec, inw, outw, enc); | ||
115 | } | ||
116 | void _ossl_old_des_cfb_encrypt(unsigned char *in,unsigned char *out,int numbits, | ||
117 | long length,des_key_schedule schedule,_ossl_old_des_cblock *ivec,int enc) | ||
118 | { | ||
119 | DES_cfb_encrypt(in, out, numbits, length, | ||
120 | (DES_key_schedule *)schedule, ivec, enc); | ||
121 | } | ||
122 | void _ossl_old_des_ecb_encrypt(_ossl_old_des_cblock *input,_ossl_old_des_cblock *output, | ||
123 | des_key_schedule ks,int enc) | ||
124 | { | ||
125 | DES_ecb_encrypt(input, output, (DES_key_schedule *)ks, enc); | ||
126 | } | ||
127 | void _ossl_old_des_encrypt(DES_LONG *data,des_key_schedule ks, int enc) | ||
128 | { | ||
129 | DES_encrypt1(data, (DES_key_schedule *)ks, enc); | ||
130 | } | ||
131 | void _ossl_old_des_encrypt2(DES_LONG *data,des_key_schedule ks, int enc) | ||
132 | { | ||
133 | DES_encrypt2(data, (DES_key_schedule *)ks, enc); | ||
134 | } | ||
135 | void _ossl_old_des_encrypt3(DES_LONG *data, des_key_schedule ks1, | ||
136 | des_key_schedule ks2, des_key_schedule ks3) | ||
137 | { | ||
138 | DES_encrypt3(data, (DES_key_schedule *)ks1, (DES_key_schedule *)ks2, | ||
139 | (DES_key_schedule *)ks3); | ||
140 | } | ||
141 | void _ossl_old_des_decrypt3(DES_LONG *data, des_key_schedule ks1, | ||
142 | des_key_schedule ks2, des_key_schedule ks3) | ||
143 | { | ||
144 | DES_decrypt3(data, (DES_key_schedule *)ks1, (DES_key_schedule *)ks2, | ||
145 | (DES_key_schedule *)ks3); | ||
146 | } | ||
147 | void _ossl_old_des_ede3_cbc_encrypt(_ossl_old_des_cblock *input, _ossl_old_des_cblock *output, | ||
148 | long length, des_key_schedule ks1, des_key_schedule ks2, | ||
149 | des_key_schedule ks3, _ossl_old_des_cblock *ivec, int enc) | ||
150 | { | ||
151 | DES_ede3_cbc_encrypt((unsigned char *)input, (unsigned char *)output, | ||
152 | length, (DES_key_schedule *)ks1, (DES_key_schedule *)ks2, | ||
153 | (DES_key_schedule *)ks3, ivec, enc); | ||
154 | } | ||
155 | void _ossl_old_des_ede3_cfb64_encrypt(unsigned char *in, unsigned char *out, | ||
156 | long length, des_key_schedule ks1, des_key_schedule ks2, | ||
157 | des_key_schedule ks3, _ossl_old_des_cblock *ivec, int *num, int enc) | ||
158 | { | ||
159 | DES_ede3_cfb64_encrypt(in, out, length, | ||
160 | (DES_key_schedule *)ks1, (DES_key_schedule *)ks2, | ||
161 | (DES_key_schedule *)ks3, ivec, num, enc); | ||
162 | } | ||
163 | void _ossl_old_des_ede3_ofb64_encrypt(unsigned char *in, unsigned char *out, | ||
164 | long length, des_key_schedule ks1, des_key_schedule ks2, | ||
165 | des_key_schedule ks3, _ossl_old_des_cblock *ivec, int *num) | ||
166 | { | ||
167 | DES_ede3_ofb64_encrypt(in, out, length, | ||
168 | (DES_key_schedule *)ks1, (DES_key_schedule *)ks2, | ||
169 | (DES_key_schedule *)ks3, ivec, num); | ||
170 | } | ||
171 | |||
172 | void _ossl_old_des_xwhite_in2out(_ossl_old_des_cblock (*des_key), _ossl_old_des_cblock (*in_white), | ||
173 | _ossl_old_des_cblock (*out_white)) | ||
174 | { | ||
175 | DES_xwhite_in2out(des_key, in_white, out_white); | ||
176 | } | ||
177 | |||
178 | int _ossl_old_des_enc_read(int fd,char *buf,int len,des_key_schedule sched, | ||
179 | _ossl_old_des_cblock *iv) | ||
180 | { | ||
181 | return DES_enc_read(fd, buf, len, (DES_key_schedule *)sched, iv); | ||
182 | } | ||
183 | int _ossl_old_des_enc_write(int fd,char *buf,int len,des_key_schedule sched, | ||
184 | _ossl_old_des_cblock *iv) | ||
185 | { | ||
186 | return DES_enc_write(fd, buf, len, (DES_key_schedule *)sched, iv); | ||
187 | } | ||
188 | char *_ossl_old_des_fcrypt(const char *buf,const char *salt, char *ret) | ||
189 | { | ||
190 | return DES_fcrypt(buf, salt, ret); | ||
191 | } | ||
192 | char *_ossl_old_des_crypt(const char *buf,const char *salt) | ||
193 | { | ||
194 | return DES_crypt(buf, salt); | ||
195 | } | ||
196 | char *_ossl_old_crypt(const char *buf,const char *salt) | ||
197 | { | ||
198 | return DES_crypt(buf, salt); | ||
199 | } | ||
200 | void _ossl_old_des_ofb_encrypt(unsigned char *in,unsigned char *out, | ||
201 | int numbits,long length,des_key_schedule schedule,_ossl_old_des_cblock *ivec) | ||
202 | { | ||
203 | DES_ofb_encrypt(in, out, numbits, length, (DES_key_schedule *)schedule, | ||
204 | ivec); | ||
205 | } | ||
206 | void _ossl_old_des_pcbc_encrypt(_ossl_old_des_cblock *input,_ossl_old_des_cblock *output,long length, | ||
207 | des_key_schedule schedule,_ossl_old_des_cblock *ivec,int enc) | ||
208 | { | ||
209 | DES_pcbc_encrypt((unsigned char *)input, (unsigned char *)output, | ||
210 | length, (DES_key_schedule *)schedule, ivec, enc); | ||
211 | } | ||
212 | DES_LONG _ossl_old_des_quad_cksum(_ossl_old_des_cblock *input,_ossl_old_des_cblock *output, | ||
213 | long length,int out_count,_ossl_old_des_cblock *seed) | ||
214 | { | ||
215 | return DES_quad_cksum((unsigned char *)input, output, length, | ||
216 | out_count, seed); | ||
217 | } | ||
218 | void _ossl_old_des_random_seed(_ossl_old_des_cblock key) | ||
219 | { | ||
220 | RAND_seed(key, sizeof(_ossl_old_des_cblock)); | ||
221 | } | ||
222 | void _ossl_old_des_random_key(_ossl_old_des_cblock ret) | ||
223 | { | ||
224 | DES_random_key((DES_cblock *)ret); | ||
225 | } | ||
226 | int _ossl_old_des_read_password(_ossl_old_des_cblock *key, const char *prompt, | ||
227 | int verify) | ||
228 | { | ||
229 | return DES_read_password(key, prompt, verify); | ||
230 | } | ||
231 | int _ossl_old_des_read_2passwords(_ossl_old_des_cblock *key1, _ossl_old_des_cblock *key2, | ||
232 | const char *prompt, int verify) | ||
233 | { | ||
234 | return DES_read_2passwords(key1, key2, prompt, verify); | ||
235 | } | ||
236 | void _ossl_old_des_set_odd_parity(_ossl_old_des_cblock *key) | ||
237 | { | ||
238 | DES_set_odd_parity(key); | ||
239 | } | ||
240 | int _ossl_old_des_is_weak_key(_ossl_old_des_cblock *key) | ||
241 | { | ||
242 | return DES_is_weak_key(key); | ||
243 | } | ||
244 | int _ossl_old_des_set_key(_ossl_old_des_cblock *key,des_key_schedule schedule) | ||
245 | { | ||
246 | return DES_set_key(key, (DES_key_schedule *)schedule); | ||
247 | } | ||
248 | int _ossl_old_des_key_sched(_ossl_old_des_cblock *key,des_key_schedule schedule) | ||
249 | { | ||
250 | return DES_key_sched(key, (DES_key_schedule *)schedule); | ||
251 | } | ||
252 | void _ossl_old_des_string_to_key(char *str,_ossl_old_des_cblock *key) | ||
253 | { | ||
254 | DES_string_to_key(str, key); | ||
255 | } | ||
256 | void _ossl_old_des_string_to_2keys(char *str,_ossl_old_des_cblock *key1,_ossl_old_des_cblock *key2) | ||
257 | { | ||
258 | DES_string_to_2keys(str, key1, key2); | ||
259 | } | ||
260 | void _ossl_old_des_cfb64_encrypt(unsigned char *in, unsigned char *out, long length, | ||
261 | des_key_schedule schedule, _ossl_old_des_cblock *ivec, int *num, int enc) | ||
262 | { | ||
263 | DES_cfb64_encrypt(in, out, length, (DES_key_schedule *)schedule, | ||
264 | ivec, num, enc); | ||
265 | } | ||
266 | void _ossl_old_des_ofb64_encrypt(unsigned char *in, unsigned char *out, long length, | ||
267 | des_key_schedule schedule, _ossl_old_des_cblock *ivec, int *num) | ||
268 | { | ||
269 | DES_ofb64_encrypt(in, out, length, (DES_key_schedule *)schedule, | ||
270 | ivec, num); | ||
271 | } | ||
diff --git a/src/lib/libcrypto/des/des_old.h b/src/lib/libcrypto/des/des_old.h new file mode 100644 index 0000000000..3778f93c15 --- /dev/null +++ b/src/lib/libcrypto/des/des_old.h | |||
@@ -0,0 +1,437 @@ | |||
1 | /* crypto/des/des_old.h -*- mode:C; c-file-style: "eay" -*- */ | ||
2 | |||
3 | /* WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING | ||
4 | * | ||
5 | * The function names in here are deprecated and are only present to | ||
6 | * provide an interface compatible with openssl 0.9.6 and older as | ||
7 | * well as libdes. OpenSSL now provides functions where "des_" has | ||
8 | * been replaced with "DES_" in the names, to make it possible to | ||
9 | * make incompatible changes that are needed for C type security and | ||
10 | * other stuff. | ||
11 | * | ||
12 | * This include files has two compatibility modes: | ||
13 | * | ||
14 | * - If OPENSSL_DES_LIBDES_COMPATIBILITY is defined, you get an API | ||
15 | * that is compatible with libdes and SSLeay. | ||
16 | * - If OPENSSL_DES_LIBDES_COMPATIBILITY isn't defined, you get an | ||
17 | * API that is compatible with OpenSSL 0.9.5x to 0.9.6x. | ||
18 | * | ||
19 | * Note that these modes break earlier snapshots of OpenSSL, where | ||
20 | * libdes compatibility was the only available mode or (later on) the | ||
21 | * prefered compatibility mode. However, after much consideration | ||
22 | * (and more or less violent discussions with external parties), it | ||
23 | * was concluded that OpenSSL should be compatible with earlier versions | ||
24 | * of itself before anything else. Also, in all honesty, libdes is | ||
25 | * an old beast that shouldn't really be used any more. | ||
26 | * | ||
27 | * Please consider starting to use the DES_ functions rather than the | ||
28 | * des_ ones. The des_ functions will disappear completely before | ||
29 | * OpenSSL 1.0! | ||
30 | * | ||
31 | * WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING | ||
32 | */ | ||
33 | |||
34 | /* Written by Richard Levitte (richard@levitte.org) for the OpenSSL | ||
35 | * project 2001. | ||
36 | */ | ||
37 | /* ==================================================================== | ||
38 | * Copyright (c) 1998-2002 The OpenSSL Project. All rights reserved. | ||
39 | * | ||
40 | * Redistribution and use in source and binary forms, with or without | ||
41 | * modification, are permitted provided that the following conditions | ||
42 | * are met: | ||
43 | * | ||
44 | * 1. Redistributions of source code must retain the above copyright | ||
45 | * notice, this list of conditions and the following disclaimer. | ||
46 | * | ||
47 | * 2. Redistributions in binary form must reproduce the above copyright | ||
48 | * notice, this list of conditions and the following disclaimer in | ||
49 | * the documentation and/or other materials provided with the | ||
50 | * distribution. | ||
51 | * | ||
52 | * 3. All advertising materials mentioning features or use of this | ||
53 | * software must display the following acknowledgment: | ||
54 | * "This product includes software developed by the OpenSSL Project | ||
55 | * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" | ||
56 | * | ||
57 | * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to | ||
58 | * endorse or promote products derived from this software without | ||
59 | * prior written permission. For written permission, please contact | ||
60 | * openssl-core@openssl.org. | ||
61 | * | ||
62 | * 5. Products derived from this software may not be called "OpenSSL" | ||
63 | * nor may "OpenSSL" appear in their names without prior written | ||
64 | * permission of the OpenSSL Project. | ||
65 | * | ||
66 | * 6. Redistributions of any form whatsoever must retain the following | ||
67 | * acknowledgment: | ||
68 | * "This product includes software developed by the OpenSSL Project | ||
69 | * for use in the OpenSSL Toolkit (http://www.openssl.org/)" | ||
70 | * | ||
71 | * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY | ||
72 | * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
73 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
74 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR | ||
75 | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
76 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
77 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
78 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
79 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
80 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
81 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | ||
82 | * OF THE POSSIBILITY OF SUCH DAMAGE. | ||
83 | * ==================================================================== | ||
84 | * | ||
85 | * This product includes cryptographic software written by Eric Young | ||
86 | * (eay@cryptsoft.com). This product includes software written by Tim | ||
87 | * Hudson (tjh@cryptsoft.com). | ||
88 | * | ||
89 | */ | ||
90 | |||
91 | #ifndef HEADER_DES_OLD_H | ||
92 | #define HEADER_DES_OLD_H | ||
93 | |||
94 | #ifdef OPENSSL_NO_DES | ||
95 | #error DES is disabled. | ||
96 | #endif | ||
97 | |||
98 | #ifndef HEADER_DES_H | ||
99 | #error You must include des.h, not des_old.h directly. | ||
100 | #endif | ||
101 | |||
102 | #ifdef _KERBEROS_DES_H | ||
103 | #error <openssl/des_old.h> replaces <kerberos/des.h>. | ||
104 | #endif | ||
105 | |||
106 | #include <openssl/opensslconf.h> /* DES_LONG */ | ||
107 | #include <openssl/e_os2.h> /* OPENSSL_EXTERN */ | ||
108 | #include <openssl/symhacks.h> | ||
109 | |||
110 | #ifdef OPENSSL_BUILD_SHLIBCRYPTO | ||
111 | # undef OPENSSL_EXTERN | ||
112 | # define OPENSSL_EXTERN OPENSSL_EXPORT | ||
113 | #endif | ||
114 | |||
115 | #ifdef __cplusplus | ||
116 | extern "C" { | ||
117 | #endif | ||
118 | |||
119 | typedef unsigned char _ossl_old_des_cblock[8]; | ||
120 | typedef struct _ossl_old_des_ks_struct | ||
121 | { | ||
122 | union { | ||
123 | _ossl_old_des_cblock _; | ||
124 | /* make sure things are correct size on machines with | ||
125 | * 8 byte longs */ | ||
126 | DES_LONG pad[2]; | ||
127 | } ks; | ||
128 | } _ossl_old_des_key_schedule[16]; | ||
129 | |||
130 | #ifndef OPENSSL_DES_LIBDES_COMPATIBILITY | ||
131 | #define des_cblock DES_cblock | ||
132 | #define const_des_cblock const_DES_cblock | ||
133 | #define des_key_schedule DES_key_schedule | ||
134 | #define des_ecb3_encrypt(i,o,k1,k2,k3,e)\ | ||
135 | DES_ecb3_encrypt((i),(o),&(k1),&(k2),&(k3),(e)) | ||
136 | #define des_ede3_cbc_encrypt(i,o,l,k1,k2,k3,iv,e)\ | ||
137 | DES_ede3_cbc_encrypt((i),(o),(l),&(k1),&(k2),&(k3),(iv),(e)) | ||
138 | #define des_ede3_cbcm_encrypt(i,o,l,k1,k2,k3,iv1,iv2,e)\ | ||
139 | DES_ede3_cbcm_encrypt((i),(o),(l),&(k1),&(k2),&(k3),(iv1),(iv2),(e)) | ||
140 | #define des_ede3_cfb64_encrypt(i,o,l,k1,k2,k3,iv,n,e)\ | ||
141 | DES_ede3_cfb64_encrypt((i),(o),(l),&(k1),&(k2),&(k3),(iv),(n),(e)) | ||
142 | #define des_ede3_ofb64_encrypt(i,o,l,k1,k2,k3,iv,n)\ | ||
143 | DES_ede3_ofb64_encrypt((i),(o),(l),&(k1),&(k2),&(k3),(iv),(n)) | ||
144 | #define des_options()\ | ||
145 | DES_options() | ||
146 | #define des_cbc_cksum(i,o,l,k,iv)\ | ||
147 | DES_cbc_cksum((i),(o),(l),&(k),(iv)) | ||
148 | #define des_cbc_encrypt(i,o,l,k,iv,e)\ | ||
149 | DES_cbc_encrypt((i),(o),(l),&(k),(iv),(e)) | ||
150 | #define des_ncbc_encrypt(i,o,l,k,iv,e)\ | ||
151 | DES_ncbc_encrypt((i),(o),(l),&(k),(iv),(e)) | ||
152 | #define des_xcbc_encrypt(i,o,l,k,iv,inw,outw,e)\ | ||
153 | DES_xcbc_encrypt((i),(o),(l),&(k),(iv),(inw),(outw),(e)) | ||
154 | #define des_cfb_encrypt(i,o,n,l,k,iv,e)\ | ||
155 | DES_cfb_encrypt((i),(o),(n),(l),&(k),(iv),(e)) | ||
156 | #define des_ecb_encrypt(i,o,k,e)\ | ||
157 | DES_ecb_encrypt((i),(o),&(k),(e)) | ||
158 | #define des_encrypt1(d,k,e)\ | ||
159 | DES_encrypt1((d),&(k),(e)) | ||
160 | #define des_encrypt2(d,k,e)\ | ||
161 | DES_encrypt2((d),&(k),(e)) | ||
162 | #define des_encrypt3(d,k1,k2,k3)\ | ||
163 | DES_encrypt3((d),&(k1),&(k2),&(k3)) | ||
164 | #define des_decrypt3(d,k1,k2,k3)\ | ||
165 | DES_decrypt3((d),&(k1),&(k2),&(k3)) | ||
166 | #define des_xwhite_in2out(k,i,o)\ | ||
167 | DES_xwhite_in2out((k),(i),(o)) | ||
168 | #define des_enc_read(f,b,l,k,iv)\ | ||
169 | DES_enc_read((f),(b),(l),&(k),(iv)) | ||
170 | #define des_enc_write(f,b,l,k,iv)\ | ||
171 | DES_enc_write((f),(b),(l),&(k),(iv)) | ||
172 | #define des_fcrypt(b,s,r)\ | ||
173 | DES_fcrypt((b),(s),(r)) | ||
174 | #define des_crypt(b,s)\ | ||
175 | DES_crypt((b),(s)) | ||
176 | #if !defined(PERL5) && !defined(__FreeBSD__) && !defined(NeXT) | ||
177 | #define crypt(b,s)\ | ||
178 | DES_crypt((b),(s)) | ||
179 | #endif | ||
180 | #define des_ofb_encrypt(i,o,n,l,k,iv)\ | ||
181 | DES_ofb_encrypt((i),(o),(n),(l),&(k),(iv)) | ||
182 | #define des_pcbc_encrypt(i,o,l,k,iv,e)\ | ||
183 | DES_pcbc_encrypt((i),(o),(l),&(k),(iv),(e)) | ||
184 | #define des_quad_cksum(i,o,l,c,s)\ | ||
185 | DES_quad_cksum((i),(o),(l),(c),(s)) | ||
186 | #define des_random_seed(k)\ | ||
187 | _ossl_096_des_random_seed((k)) | ||
188 | #define des_random_key(r)\ | ||
189 | DES_random_key((r)) | ||
190 | #define des_read_password(k,p,v) \ | ||
191 | DES_read_password((k),(p),(v)) | ||
192 | #define des_read_2passwords(k1,k2,p,v) \ | ||
193 | DES_read_2passwords((k1),(k2),(p),(v)) | ||
194 | #define des_set_odd_parity(k)\ | ||
195 | DES_set_odd_parity((k)) | ||
196 | #define des_check_key_parity(k)\ | ||
197 | DES_check_key_parity((k)) | ||
198 | #define des_is_weak_key(k)\ | ||
199 | DES_is_weak_key((k)) | ||
200 | #define des_set_key(k,ks)\ | ||
201 | DES_set_key((k),&(ks)) | ||
202 | #define des_key_sched(k,ks)\ | ||
203 | DES_key_sched((k),&(ks)) | ||
204 | #define des_set_key_checked(k,ks)\ | ||
205 | DES_set_key_checked((k),&(ks)) | ||
206 | #define des_set_key_unchecked(k,ks)\ | ||
207 | DES_set_key_unchecked((k),&(ks)) | ||
208 | #define des_string_to_key(s,k)\ | ||
209 | DES_string_to_key((s),(k)) | ||
210 | #define des_string_to_2keys(s,k1,k2)\ | ||
211 | DES_string_to_2keys((s),(k1),(k2)) | ||
212 | #define des_cfb64_encrypt(i,o,l,ks,iv,n,e)\ | ||
213 | DES_cfb64_encrypt((i),(o),(l),&(ks),(iv),(n),(e)) | ||
214 | #define des_ofb64_encrypt(i,o,l,ks,iv,n)\ | ||
215 | DES_ofb64_encrypt((i),(o),(l),&(ks),(iv),(n)) | ||
216 | |||
217 | |||
218 | #define des_ecb2_encrypt(i,o,k1,k2,e) \ | ||
219 | des_ecb3_encrypt((i),(o),(k1),(k2),(k1),(e)) | ||
220 | |||
221 | #define des_ede2_cbc_encrypt(i,o,l,k1,k2,iv,e) \ | ||
222 | des_ede3_cbc_encrypt((i),(o),(l),(k1),(k2),(k1),(iv),(e)) | ||
223 | |||
224 | #define des_ede2_cfb64_encrypt(i,o,l,k1,k2,iv,n,e) \ | ||
225 | des_ede3_cfb64_encrypt((i),(o),(l),(k1),(k2),(k1),(iv),(n),(e)) | ||
226 | |||
227 | #define des_ede2_ofb64_encrypt(i,o,l,k1,k2,iv,n) \ | ||
228 | des_ede3_ofb64_encrypt((i),(o),(l),(k1),(k2),(k1),(iv),(n)) | ||
229 | |||
230 | #define des_check_key DES_check_key | ||
231 | #define des_rw_mode DES_rw_mode | ||
232 | #else /* libdes compatibility */ | ||
233 | /* Map all symbol names to _ossl_old_des_* form, so we avoid all | ||
234 | clashes with libdes */ | ||
235 | #define des_cblock _ossl_old_des_cblock | ||
236 | #define des_key_schedule _ossl_old_des_key_schedule | ||
237 | #define des_ecb3_encrypt(i,o,k1,k2,k3,e)\ | ||
238 | _ossl_old_des_ecb3_encrypt((i),(o),(k1),(k2),(k3),(e)) | ||
239 | #define des_ede3_cbc_encrypt(i,o,l,k1,k2,k3,iv,e)\ | ||
240 | _ossl_old_des_ede3_cbc_encrypt((i),(o),(l),(k1),(k2),(k3),(iv),(e)) | ||
241 | #define des_ede3_cfb64_encrypt(i,o,l,k1,k2,k3,iv,n,e)\ | ||
242 | _ossl_old_des_ede3_cfb64_encrypt((i),(o),(l),(k1),(k2),(k3),(iv),(n),(e)) | ||
243 | #define des_ede3_ofb64_encrypt(i,o,l,k1,k2,k3,iv,n)\ | ||
244 | _ossl_old_des_ede3_ofb64_encrypt((i),(o),(l),(k1),(k2),(k3),(iv),(n)) | ||
245 | #define des_options()\ | ||
246 | _ossl_old_des_options() | ||
247 | #define des_cbc_cksum(i,o,l,k,iv)\ | ||
248 | _ossl_old_des_cbc_cksum((i),(o),(l),(k),(iv)) | ||
249 | #define des_cbc_encrypt(i,o,l,k,iv,e)\ | ||
250 | _ossl_old_des_cbc_encrypt((i),(o),(l),(k),(iv),(e)) | ||
251 | #define des_ncbc_encrypt(i,o,l,k,iv,e)\ | ||
252 | _ossl_old_des_ncbc_encrypt((i),(o),(l),(k),(iv),(e)) | ||
253 | #define des_xcbc_encrypt(i,o,l,k,iv,inw,outw,e)\ | ||
254 | _ossl_old_des_xcbc_encrypt((i),(o),(l),(k),(iv),(inw),(outw),(e)) | ||
255 | #define des_cfb_encrypt(i,o,n,l,k,iv,e)\ | ||
256 | _ossl_old_des_cfb_encrypt((i),(o),(n),(l),(k),(iv),(e)) | ||
257 | #define des_ecb_encrypt(i,o,k,e)\ | ||
258 | _ossl_old_des_ecb_encrypt((i),(o),(k),(e)) | ||
259 | #define des_encrypt(d,k,e)\ | ||
260 | _ossl_old_des_encrypt((d),(k),(e)) | ||
261 | #define des_encrypt2(d,k,e)\ | ||
262 | _ossl_old_des_encrypt2((d),(k),(e)) | ||
263 | #define des_encrypt3(d,k1,k2,k3)\ | ||
264 | _ossl_old_des_encrypt3((d),(k1),(k2),(k3)) | ||
265 | #define des_decrypt3(d,k1,k2,k3)\ | ||
266 | _ossl_old_des_decrypt3((d),(k1),(k2),(k3)) | ||
267 | #define des_xwhite_in2out(k,i,o)\ | ||
268 | _ossl_old_des_xwhite_in2out((k),(i),(o)) | ||
269 | #define des_enc_read(f,b,l,k,iv)\ | ||
270 | _ossl_old_des_enc_read((f),(b),(l),(k),(iv)) | ||
271 | #define des_enc_write(f,b,l,k,iv)\ | ||
272 | _ossl_old_des_enc_write((f),(b),(l),(k),(iv)) | ||
273 | #define des_fcrypt(b,s,r)\ | ||
274 | _ossl_old_des_fcrypt((b),(s),(r)) | ||
275 | #define des_crypt(b,s)\ | ||
276 | _ossl_old_des_crypt((b),(s)) | ||
277 | #define crypt(b,s)\ | ||
278 | _ossl_old_crypt((b),(s)) | ||
279 | #define des_ofb_encrypt(i,o,n,l,k,iv)\ | ||
280 | _ossl_old_des_ofb_encrypt((i),(o),(n),(l),(k),(iv)) | ||
281 | #define des_pcbc_encrypt(i,o,l,k,iv,e)\ | ||
282 | _ossl_old_des_pcbc_encrypt((i),(o),(l),(k),(iv),(e)) | ||
283 | #define des_quad_cksum(i,o,l,c,s)\ | ||
284 | _ossl_old_des_quad_cksum((i),(o),(l),(c),(s)) | ||
285 | #define des_random_seed(k)\ | ||
286 | _ossl_old_des_random_seed((k)) | ||
287 | #define des_random_key(r)\ | ||
288 | _ossl_old_des_random_key((r)) | ||
289 | #define des_read_password(k,p,v) \ | ||
290 | _ossl_old_des_read_password((k),(p),(v)) | ||
291 | #define des_read_2passwords(k1,k2,p,v) \ | ||
292 | _ossl_old_des_read_2passwords((k1),(k2),(p),(v)) | ||
293 | #define des_set_odd_parity(k)\ | ||
294 | _ossl_old_des_set_odd_parity((k)) | ||
295 | #define des_is_weak_key(k)\ | ||
296 | _ossl_old_des_is_weak_key((k)) | ||
297 | #define des_set_key(k,ks)\ | ||
298 | _ossl_old_des_set_key((k),(ks)) | ||
299 | #define des_key_sched(k,ks)\ | ||
300 | _ossl_old_des_key_sched((k),(ks)) | ||
301 | #define des_string_to_key(s,k)\ | ||
302 | _ossl_old_des_string_to_key((s),(k)) | ||
303 | #define des_string_to_2keys(s,k1,k2)\ | ||
304 | _ossl_old_des_string_to_2keys((s),(k1),(k2)) | ||
305 | #define des_cfb64_encrypt(i,o,l,ks,iv,n,e)\ | ||
306 | _ossl_old_des_cfb64_encrypt((i),(o),(l),(ks),(iv),(n),(e)) | ||
307 | #define des_ofb64_encrypt(i,o,l,ks,iv,n)\ | ||
308 | _ossl_old_des_ofb64_encrypt((i),(o),(l),(ks),(iv),(n)) | ||
309 | |||
310 | |||
311 | #define des_ecb2_encrypt(i,o,k1,k2,e) \ | ||
312 | des_ecb3_encrypt((i),(o),(k1),(k2),(k1),(e)) | ||
313 | |||
314 | #define des_ede2_cbc_encrypt(i,o,l,k1,k2,iv,e) \ | ||
315 | des_ede3_cbc_encrypt((i),(o),(l),(k1),(k2),(k1),(iv),(e)) | ||
316 | |||
317 | #define des_ede2_cfb64_encrypt(i,o,l,k1,k2,iv,n,e) \ | ||
318 | des_ede3_cfb64_encrypt((i),(o),(l),(k1),(k2),(k1),(iv),(n),(e)) | ||
319 | |||
320 | #define des_ede2_ofb64_encrypt(i,o,l,k1,k2,iv,n) \ | ||
321 | des_ede3_ofb64_encrypt((i),(o),(l),(k1),(k2),(k1),(iv),(n)) | ||
322 | |||
323 | #define des_check_key DES_check_key | ||
324 | #define des_rw_mode DES_rw_mode | ||
325 | #endif | ||
326 | |||
327 | const char *_ossl_old_des_options(void); | ||
328 | void _ossl_old_des_ecb3_encrypt(_ossl_old_des_cblock *input,_ossl_old_des_cblock *output, | ||
329 | _ossl_old_des_key_schedule ks1,_ossl_old_des_key_schedule ks2, | ||
330 | _ossl_old_des_key_schedule ks3, int enc); | ||
331 | DES_LONG _ossl_old_des_cbc_cksum(_ossl_old_des_cblock *input,_ossl_old_des_cblock *output, | ||
332 | long length,_ossl_old_des_key_schedule schedule,_ossl_old_des_cblock *ivec); | ||
333 | void _ossl_old_des_cbc_encrypt(_ossl_old_des_cblock *input,_ossl_old_des_cblock *output,long length, | ||
334 | _ossl_old_des_key_schedule schedule,_ossl_old_des_cblock *ivec,int enc); | ||
335 | void _ossl_old_des_ncbc_encrypt(_ossl_old_des_cblock *input,_ossl_old_des_cblock *output,long length, | ||
336 | _ossl_old_des_key_schedule schedule,_ossl_old_des_cblock *ivec,int enc); | ||
337 | void _ossl_old_des_xcbc_encrypt(_ossl_old_des_cblock *input,_ossl_old_des_cblock *output,long length, | ||
338 | _ossl_old_des_key_schedule schedule,_ossl_old_des_cblock *ivec, | ||
339 | _ossl_old_des_cblock *inw,_ossl_old_des_cblock *outw,int enc); | ||
340 | void _ossl_old_des_cfb_encrypt(unsigned char *in,unsigned char *out,int numbits, | ||
341 | long length,_ossl_old_des_key_schedule schedule,_ossl_old_des_cblock *ivec,int enc); | ||
342 | void _ossl_old_des_ecb_encrypt(_ossl_old_des_cblock *input,_ossl_old_des_cblock *output, | ||
343 | _ossl_old_des_key_schedule ks,int enc); | ||
344 | void _ossl_old_des_encrypt(DES_LONG *data,_ossl_old_des_key_schedule ks, int enc); | ||
345 | void _ossl_old_des_encrypt2(DES_LONG *data,_ossl_old_des_key_schedule ks, int enc); | ||
346 | void _ossl_old_des_encrypt3(DES_LONG *data, _ossl_old_des_key_schedule ks1, | ||
347 | _ossl_old_des_key_schedule ks2, _ossl_old_des_key_schedule ks3); | ||
348 | void _ossl_old_des_decrypt3(DES_LONG *data, _ossl_old_des_key_schedule ks1, | ||
349 | _ossl_old_des_key_schedule ks2, _ossl_old_des_key_schedule ks3); | ||
350 | void _ossl_old_des_ede3_cbc_encrypt(_ossl_old_des_cblock *input, _ossl_old_des_cblock *output, | ||
351 | long length, _ossl_old_des_key_schedule ks1, _ossl_old_des_key_schedule ks2, | ||
352 | _ossl_old_des_key_schedule ks3, _ossl_old_des_cblock *ivec, int enc); | ||
353 | void _ossl_old_des_ede3_cfb64_encrypt(unsigned char *in, unsigned char *out, | ||
354 | long length, _ossl_old_des_key_schedule ks1, _ossl_old_des_key_schedule ks2, | ||
355 | _ossl_old_des_key_schedule ks3, _ossl_old_des_cblock *ivec, int *num, int enc); | ||
356 | void _ossl_old_des_ede3_ofb64_encrypt(unsigned char *in, unsigned char *out, | ||
357 | long length, _ossl_old_des_key_schedule ks1, _ossl_old_des_key_schedule ks2, | ||
358 | _ossl_old_des_key_schedule ks3, _ossl_old_des_cblock *ivec, int *num); | ||
359 | |||
360 | void _ossl_old_des_xwhite_in2out(_ossl_old_des_cblock (*des_key), _ossl_old_des_cblock (*in_white), | ||
361 | _ossl_old_des_cblock (*out_white)); | ||
362 | |||
363 | int _ossl_old_des_enc_read(int fd,char *buf,int len,_ossl_old_des_key_schedule sched, | ||
364 | _ossl_old_des_cblock *iv); | ||
365 | int _ossl_old_des_enc_write(int fd,char *buf,int len,_ossl_old_des_key_schedule sched, | ||
366 | _ossl_old_des_cblock *iv); | ||
367 | char *_ossl_old_des_fcrypt(const char *buf,const char *salt, char *ret); | ||
368 | char *_ossl_old_des_crypt(const char *buf,const char *salt); | ||
369 | #if !defined(PERL5) && !defined(__FreeBSD__) && !defined(NeXT) | ||
370 | char *_ossl_old_crypt(const char *buf,const char *salt); | ||
371 | #endif | ||
372 | void _ossl_old_des_ofb_encrypt(unsigned char *in,unsigned char *out, | ||
373 | int numbits,long length,_ossl_old_des_key_schedule schedule,_ossl_old_des_cblock *ivec); | ||
374 | void _ossl_old_des_pcbc_encrypt(_ossl_old_des_cblock *input,_ossl_old_des_cblock *output,long length, | ||
375 | _ossl_old_des_key_schedule schedule,_ossl_old_des_cblock *ivec,int enc); | ||
376 | DES_LONG _ossl_old_des_quad_cksum(_ossl_old_des_cblock *input,_ossl_old_des_cblock *output, | ||
377 | long length,int out_count,_ossl_old_des_cblock *seed); | ||
378 | void _ossl_old_des_random_seed(_ossl_old_des_cblock key); | ||
379 | void _ossl_old_des_random_key(_ossl_old_des_cblock ret); | ||
380 | int _ossl_old_des_read_password(_ossl_old_des_cblock *key,const char *prompt,int verify); | ||
381 | int _ossl_old_des_read_2passwords(_ossl_old_des_cblock *key1,_ossl_old_des_cblock *key2, | ||
382 | const char *prompt,int verify); | ||
383 | void _ossl_old_des_set_odd_parity(_ossl_old_des_cblock *key); | ||
384 | int _ossl_old_des_is_weak_key(_ossl_old_des_cblock *key); | ||
385 | int _ossl_old_des_set_key(_ossl_old_des_cblock *key,_ossl_old_des_key_schedule schedule); | ||
386 | int _ossl_old_des_key_sched(_ossl_old_des_cblock *key,_ossl_old_des_key_schedule schedule); | ||
387 | void _ossl_old_des_string_to_key(char *str,_ossl_old_des_cblock *key); | ||
388 | void _ossl_old_des_string_to_2keys(char *str,_ossl_old_des_cblock *key1,_ossl_old_des_cblock *key2); | ||
389 | void _ossl_old_des_cfb64_encrypt(unsigned char *in, unsigned char *out, long length, | ||
390 | _ossl_old_des_key_schedule schedule, _ossl_old_des_cblock *ivec, int *num, int enc); | ||
391 | void _ossl_old_des_ofb64_encrypt(unsigned char *in, unsigned char *out, long length, | ||
392 | _ossl_old_des_key_schedule schedule, _ossl_old_des_cblock *ivec, int *num); | ||
393 | |||
394 | void _ossl_096_des_random_seed(des_cblock *key); | ||
395 | |||
396 | /* The following definitions provide compatibility with the MIT Kerberos | ||
397 | * library. The _ossl_old_des_key_schedule structure is not binary compatible. */ | ||
398 | |||
399 | #define _KERBEROS_DES_H | ||
400 | |||
401 | #define KRBDES_ENCRYPT DES_ENCRYPT | ||
402 | #define KRBDES_DECRYPT DES_DECRYPT | ||
403 | |||
404 | #ifdef KERBEROS | ||
405 | # define ENCRYPT DES_ENCRYPT | ||
406 | # define DECRYPT DES_DECRYPT | ||
407 | #endif | ||
408 | |||
409 | #ifndef NCOMPAT | ||
410 | # define C_Block des_cblock | ||
411 | # define Key_schedule des_key_schedule | ||
412 | # define KEY_SZ DES_KEY_SZ | ||
413 | # define string_to_key des_string_to_key | ||
414 | # define read_pw_string des_read_pw_string | ||
415 | # define random_key des_random_key | ||
416 | # define pcbc_encrypt des_pcbc_encrypt | ||
417 | # define set_key des_set_key | ||
418 | # define key_sched des_key_sched | ||
419 | # define ecb_encrypt des_ecb_encrypt | ||
420 | # define cbc_encrypt des_cbc_encrypt | ||
421 | # define ncbc_encrypt des_ncbc_encrypt | ||
422 | # define xcbc_encrypt des_xcbc_encrypt | ||
423 | # define cbc_cksum des_cbc_cksum | ||
424 | # define quad_cksum des_quad_cksum | ||
425 | # define check_parity des_check_key_parity | ||
426 | #endif | ||
427 | |||
428 | #define des_fixup_key_parity DES_fixup_key_parity | ||
429 | |||
430 | #ifdef __cplusplus | ||
431 | } | ||
432 | #endif | ||
433 | |||
434 | /* for DES_read_pw_string et al */ | ||
435 | #include <openssl/ui_compat.h> | ||
436 | |||
437 | #endif | ||
diff --git a/src/lib/libcrypto/des/des_old2.c b/src/lib/libcrypto/des/des_old2.c new file mode 100644 index 0000000000..c8fa3ee135 --- /dev/null +++ b/src/lib/libcrypto/des/des_old2.c | |||
@@ -0,0 +1,82 @@ | |||
1 | /* crypto/des/des_old.c -*- mode:C; c-file-style: "eay" -*- */ | ||
2 | |||
3 | /* WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING | ||
4 | * | ||
5 | * The function names in here are deprecated and are only present to | ||
6 | * provide an interface compatible with OpenSSL 0.9.6c. OpenSSL now | ||
7 | * provides functions where "des_" has been replaced with "DES_" in | ||
8 | * the names, to make it possible to make incompatible changes that | ||
9 | * are needed for C type security and other stuff. | ||
10 | * | ||
11 | * Please consider starting to use the DES_ functions rather than the | ||
12 | * des_ ones. The des_ functions will dissapear completely before | ||
13 | * OpenSSL 1.0! | ||
14 | * | ||
15 | * WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING | ||
16 | */ | ||
17 | |||
18 | /* Written by Richard Levitte (richard@levitte.org) for the OpenSSL | ||
19 | * project 2001. | ||
20 | */ | ||
21 | /* ==================================================================== | ||
22 | * Copyright (c) 1998-2001 The OpenSSL Project. All rights reserved. | ||
23 | * | ||
24 | * Redistribution and use in source and binary forms, with or without | ||
25 | * modification, are permitted provided that the following conditions | ||
26 | * are met: | ||
27 | * | ||
28 | * 1. Redistributions of source code must retain the above copyright | ||
29 | * notice, this list of conditions and the following disclaimer. | ||
30 | * | ||
31 | * 2. Redistributions in binary form must reproduce the above copyright | ||
32 | * notice, this list of conditions and the following disclaimer in | ||
33 | * the documentation and/or other materials provided with the | ||
34 | * distribution. | ||
35 | * | ||
36 | * 3. All advertising materials mentioning features or use of this | ||
37 | * software must display the following acknowledgment: | ||
38 | * "This product includes software developed by the OpenSSL Project | ||
39 | * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" | ||
40 | * | ||
41 | * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to | ||
42 | * endorse or promote products derived from this software without | ||
43 | * prior written permission. For written permission, please contact | ||
44 | * openssl-core@openssl.org. | ||
45 | * | ||
46 | * 5. Products derived from this software may not be called "OpenSSL" | ||
47 | * nor may "OpenSSL" appear in their names without prior written | ||
48 | * permission of the OpenSSL Project. | ||
49 | * | ||
50 | * 6. Redistributions of any form whatsoever must retain the following | ||
51 | * acknowledgment: | ||
52 | * "This product includes software developed by the OpenSSL Project | ||
53 | * for use in the OpenSSL Toolkit (http://www.openssl.org/)" | ||
54 | * | ||
55 | * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY | ||
56 | * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
57 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
58 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR | ||
59 | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
60 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
61 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
62 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
63 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
64 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
65 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | ||
66 | * OF THE POSSIBILITY OF SUCH DAMAGE. | ||
67 | * ==================================================================== | ||
68 | * | ||
69 | * This product includes cryptographic software written by Eric Young | ||
70 | * (eay@cryptsoft.com). This product includes software written by Tim | ||
71 | * Hudson (tjh@cryptsoft.com). | ||
72 | * | ||
73 | */ | ||
74 | |||
75 | #undef OPENSSL_DES_LIBDES_COMPATIBILITY | ||
76 | #include <openssl/des.h> | ||
77 | #include <openssl/rand.h> | ||
78 | |||
79 | void _ossl_096_des_random_seed(DES_cblock *key) | ||
80 | { | ||
81 | RAND_seed(key, sizeof(DES_cblock)); | ||
82 | } | ||
diff --git a/src/lib/libcrypto/des/des_opts.c b/src/lib/libcrypto/des/des_opts.c index 138ee1c6b4..79278b920e 100644 --- a/src/lib/libcrypto/des/des_opts.c +++ b/src/lib/libcrypto/des/des_opts.c | |||
@@ -59,12 +59,12 @@ | |||
59 | /* define PART1, PART2, PART3 or PART4 to build only with a few of the options. | 59 | /* define PART1, PART2, PART3 or PART4 to build only with a few of the options. |
60 | * This is for machines with 64k code segment size restrictions. */ | 60 | * This is for machines with 64k code segment size restrictions. */ |
61 | 61 | ||
62 | #if !defined(MSDOS) && (!defined(VMS) || defined(__DECC)) | 62 | #if !defined(OPENSSL_SYS_MSDOS) && (!defined(OPENSSL_SYS_VMS) || defined(__DECC)) && !defined(OPENSSL_SYS_MACOSX) |
63 | #define TIMES | 63 | #define TIMES |
64 | #endif | 64 | #endif |
65 | 65 | ||
66 | #include <stdio.h> | 66 | #include <stdio.h> |
67 | #ifndef MSDOS | 67 | #ifndef OPENSSL_SYS_MSDOS |
68 | #include <openssl/e_os2.h> | 68 | #include <openssl/e_os2.h> |
69 | #include OPENSSL_UNISTD | 69 | #include OPENSSL_UNISTD |
70 | #else | 70 | #else |
@@ -84,7 +84,7 @@ extern void exit(); | |||
84 | The __TMS macro will show if it was. If it wasn't defined, we should | 84 | The __TMS macro will show if it was. If it wasn't defined, we should |
85 | undefine TIMES, since that tells the rest of the program how things | 85 | undefine TIMES, since that tells the rest of the program how things |
86 | should be handled. -- Richard Levitte */ | 86 | should be handled. -- Richard Levitte */ |
87 | #if defined(VMS) && defined(__DECC) && !defined(__TMS) | 87 | #if defined(OPENSSL_SYS_VMS_DECC) && !defined(__TMS) |
88 | #undef TIMES | 88 | #undef TIMES |
89 | #endif | 89 | #endif |
90 | 90 | ||
@@ -118,10 +118,10 @@ extern void exit(); | |||
118 | #undef DES_RISC2 | 118 | #undef DES_RISC2 |
119 | #undef DES_PTR | 119 | #undef DES_PTR |
120 | #undef D_ENCRYPT | 120 | #undef D_ENCRYPT |
121 | #define des_encrypt1 des_encrypt_u4_cisc_idx | 121 | #define DES_encrypt1 des_encrypt_u4_cisc_idx |
122 | #define des_encrypt2 des_encrypt2_u4_cisc_idx | 122 | #define DES_encrypt2 des_encrypt2_u4_cisc_idx |
123 | #define des_encrypt3 des_encrypt3_u4_cisc_idx | 123 | #define DES_encrypt3 des_encrypt3_u4_cisc_idx |
124 | #define des_decrypt3 des_decrypt3_u4_cisc_idx | 124 | #define DES_decrypt3 des_decrypt3_u4_cisc_idx |
125 | #undef HEADER_DES_LOCL_H | 125 | #undef HEADER_DES_LOCL_H |
126 | #include "des_enc.c" | 126 | #include "des_enc.c" |
127 | 127 | ||
@@ -130,14 +130,14 @@ extern void exit(); | |||
130 | #undef DES_RISC2 | 130 | #undef DES_RISC2 |
131 | #undef DES_PTR | 131 | #undef DES_PTR |
132 | #undef D_ENCRYPT | 132 | #undef D_ENCRYPT |
133 | #undef des_encrypt1 | 133 | #undef DES_encrypt1 |
134 | #undef des_encrypt2 | 134 | #undef DES_encrypt2 |
135 | #undef des_encrypt3 | 135 | #undef DES_encrypt3 |
136 | #undef des_decrypt3 | 136 | #undef DES_decrypt3 |
137 | #define des_encrypt1 des_encrypt_u16_cisc_idx | 137 | #define DES_encrypt1 des_encrypt_u16_cisc_idx |
138 | #define des_encrypt2 des_encrypt2_u16_cisc_idx | 138 | #define DES_encrypt2 des_encrypt2_u16_cisc_idx |
139 | #define des_encrypt3 des_encrypt3_u16_cisc_idx | 139 | #define DES_encrypt3 des_encrypt3_u16_cisc_idx |
140 | #define des_decrypt3 des_decrypt3_u16_cisc_idx | 140 | #define DES_decrypt3 des_decrypt3_u16_cisc_idx |
141 | #undef HEADER_DES_LOCL_H | 141 | #undef HEADER_DES_LOCL_H |
142 | #include "des_enc.c" | 142 | #include "des_enc.c" |
143 | 143 | ||
@@ -146,14 +146,14 @@ extern void exit(); | |||
146 | #undef DES_RISC2 | 146 | #undef DES_RISC2 |
147 | #undef DES_PTR | 147 | #undef DES_PTR |
148 | #undef D_ENCRYPT | 148 | #undef D_ENCRYPT |
149 | #undef des_encrypt1 | 149 | #undef DES_encrypt1 |
150 | #undef des_encrypt2 | 150 | #undef DES_encrypt2 |
151 | #undef des_encrypt3 | 151 | #undef DES_encrypt3 |
152 | #undef des_decrypt3 | 152 | #undef DES_decrypt3 |
153 | #define des_encrypt1 des_encrypt_u4_risc1_idx | 153 | #define DES_encrypt1 des_encrypt_u4_risc1_idx |
154 | #define des_encrypt2 des_encrypt2_u4_risc1_idx | 154 | #define DES_encrypt2 des_encrypt2_u4_risc1_idx |
155 | #define des_encrypt3 des_encrypt3_u4_risc1_idx | 155 | #define DES_encrypt3 des_encrypt3_u4_risc1_idx |
156 | #define des_decrypt3 des_decrypt3_u4_risc1_idx | 156 | #define DES_decrypt3 des_decrypt3_u4_risc1_idx |
157 | #undef HEADER_DES_LOCL_H | 157 | #undef HEADER_DES_LOCL_H |
158 | #include "des_enc.c" | 158 | #include "des_enc.c" |
159 | 159 | ||
@@ -166,14 +166,14 @@ extern void exit(); | |||
166 | #define DES_RISC2 | 166 | #define DES_RISC2 |
167 | #undef DES_PTR | 167 | #undef DES_PTR |
168 | #undef D_ENCRYPT | 168 | #undef D_ENCRYPT |
169 | #undef des_encrypt1 | 169 | #undef DES_encrypt1 |
170 | #undef des_encrypt2 | 170 | #undef DES_encrypt2 |
171 | #undef des_encrypt3 | 171 | #undef DES_encrypt3 |
172 | #undef des_decrypt3 | 172 | #undef DES_decrypt3 |
173 | #define des_encrypt1 des_encrypt_u4_risc2_idx | 173 | #define DES_encrypt1 des_encrypt_u4_risc2_idx |
174 | #define des_encrypt2 des_encrypt2_u4_risc2_idx | 174 | #define DES_encrypt2 des_encrypt2_u4_risc2_idx |
175 | #define des_encrypt3 des_encrypt3_u4_risc2_idx | 175 | #define DES_encrypt3 des_encrypt3_u4_risc2_idx |
176 | #define des_decrypt3 des_decrypt3_u4_risc2_idx | 176 | #define DES_decrypt3 des_decrypt3_u4_risc2_idx |
177 | #undef HEADER_DES_LOCL_H | 177 | #undef HEADER_DES_LOCL_H |
178 | #include "des_enc.c" | 178 | #include "des_enc.c" |
179 | 179 | ||
@@ -182,14 +182,14 @@ extern void exit(); | |||
182 | #undef DES_RISC2 | 182 | #undef DES_RISC2 |
183 | #undef DES_PTR | 183 | #undef DES_PTR |
184 | #undef D_ENCRYPT | 184 | #undef D_ENCRYPT |
185 | #undef des_encrypt1 | 185 | #undef DES_encrypt1 |
186 | #undef des_encrypt2 | 186 | #undef DES_encrypt2 |
187 | #undef des_encrypt3 | 187 | #undef DES_encrypt3 |
188 | #undef des_decrypt3 | 188 | #undef DES_decrypt3 |
189 | #define des_encrypt1 des_encrypt_u16_risc1_idx | 189 | #define DES_encrypt1 des_encrypt_u16_risc1_idx |
190 | #define des_encrypt2 des_encrypt2_u16_risc1_idx | 190 | #define DES_encrypt2 des_encrypt2_u16_risc1_idx |
191 | #define des_encrypt3 des_encrypt3_u16_risc1_idx | 191 | #define DES_encrypt3 des_encrypt3_u16_risc1_idx |
192 | #define des_decrypt3 des_decrypt3_u16_risc1_idx | 192 | #define DES_decrypt3 des_decrypt3_u16_risc1_idx |
193 | #undef HEADER_DES_LOCL_H | 193 | #undef HEADER_DES_LOCL_H |
194 | #include "des_enc.c" | 194 | #include "des_enc.c" |
195 | 195 | ||
@@ -198,14 +198,14 @@ extern void exit(); | |||
198 | #define DES_RISC2 | 198 | #define DES_RISC2 |
199 | #undef DES_PTR | 199 | #undef DES_PTR |
200 | #undef D_ENCRYPT | 200 | #undef D_ENCRYPT |
201 | #undef des_encrypt1 | 201 | #undef DES_encrypt1 |
202 | #undef des_encrypt2 | 202 | #undef DES_encrypt2 |
203 | #undef des_encrypt3 | 203 | #undef DES_encrypt3 |
204 | #undef des_decrypt3 | 204 | #undef DES_decrypt3 |
205 | #define des_encrypt1 des_encrypt_u16_risc2_idx | 205 | #define DES_encrypt1 des_encrypt_u16_risc2_idx |
206 | #define des_encrypt2 des_encrypt2_u16_risc2_idx | 206 | #define DES_encrypt2 des_encrypt2_u16_risc2_idx |
207 | #define des_encrypt3 des_encrypt3_u16_risc2_idx | 207 | #define DES_encrypt3 des_encrypt3_u16_risc2_idx |
208 | #define des_decrypt3 des_decrypt3_u16_risc2_idx | 208 | #define DES_decrypt3 des_decrypt3_u16_risc2_idx |
209 | #undef HEADER_DES_LOCL_H | 209 | #undef HEADER_DES_LOCL_H |
210 | #include "des_enc.c" | 210 | #include "des_enc.c" |
211 | 211 | ||
@@ -218,14 +218,14 @@ extern void exit(); | |||
218 | #undef DES_RISC2 | 218 | #undef DES_RISC2 |
219 | #define DES_PTR | 219 | #define DES_PTR |
220 | #undef D_ENCRYPT | 220 | #undef D_ENCRYPT |
221 | #undef des_encrypt1 | 221 | #undef DES_encrypt1 |
222 | #undef des_encrypt2 | 222 | #undef DES_encrypt2 |
223 | #undef des_encrypt3 | 223 | #undef DES_encrypt3 |
224 | #undef des_decrypt3 | 224 | #undef DES_decrypt3 |
225 | #define des_encrypt1 des_encrypt_u4_cisc_ptr | 225 | #define DES_encrypt1 des_encrypt_u4_cisc_ptr |
226 | #define des_encrypt2 des_encrypt2_u4_cisc_ptr | 226 | #define DES_encrypt2 des_encrypt2_u4_cisc_ptr |
227 | #define des_encrypt3 des_encrypt3_u4_cisc_ptr | 227 | #define DES_encrypt3 des_encrypt3_u4_cisc_ptr |
228 | #define des_decrypt3 des_decrypt3_u4_cisc_ptr | 228 | #define DES_decrypt3 des_decrypt3_u4_cisc_ptr |
229 | #undef HEADER_DES_LOCL_H | 229 | #undef HEADER_DES_LOCL_H |
230 | #include "des_enc.c" | 230 | #include "des_enc.c" |
231 | 231 | ||
@@ -234,14 +234,14 @@ extern void exit(); | |||
234 | #undef DES_RISC2 | 234 | #undef DES_RISC2 |
235 | #define DES_PTR | 235 | #define DES_PTR |
236 | #undef D_ENCRYPT | 236 | #undef D_ENCRYPT |
237 | #undef des_encrypt1 | 237 | #undef DES_encrypt1 |
238 | #undef des_encrypt2 | 238 | #undef DES_encrypt2 |
239 | #undef des_encrypt3 | 239 | #undef DES_encrypt3 |
240 | #undef des_decrypt3 | 240 | #undef DES_decrypt3 |
241 | #define des_encrypt1 des_encrypt_u16_cisc_ptr | 241 | #define DES_encrypt1 des_encrypt_u16_cisc_ptr |
242 | #define des_encrypt2 des_encrypt2_u16_cisc_ptr | 242 | #define DES_encrypt2 des_encrypt2_u16_cisc_ptr |
243 | #define des_encrypt3 des_encrypt3_u16_cisc_ptr | 243 | #define DES_encrypt3 des_encrypt3_u16_cisc_ptr |
244 | #define des_decrypt3 des_decrypt3_u16_cisc_ptr | 244 | #define DES_decrypt3 des_decrypt3_u16_cisc_ptr |
245 | #undef HEADER_DES_LOCL_H | 245 | #undef HEADER_DES_LOCL_H |
246 | #include "des_enc.c" | 246 | #include "des_enc.c" |
247 | 247 | ||
@@ -250,14 +250,14 @@ extern void exit(); | |||
250 | #undef DES_RISC2 | 250 | #undef DES_RISC2 |
251 | #define DES_PTR | 251 | #define DES_PTR |
252 | #undef D_ENCRYPT | 252 | #undef D_ENCRYPT |
253 | #undef des_encrypt1 | 253 | #undef DES_encrypt1 |
254 | #undef des_encrypt2 | 254 | #undef DES_encrypt2 |
255 | #undef des_encrypt3 | 255 | #undef DES_encrypt3 |
256 | #undef des_decrypt3 | 256 | #undef DES_decrypt3 |
257 | #define des_encrypt1 des_encrypt_u4_risc1_ptr | 257 | #define DES_encrypt1 des_encrypt_u4_risc1_ptr |
258 | #define des_encrypt2 des_encrypt2_u4_risc1_ptr | 258 | #define DES_encrypt2 des_encrypt2_u4_risc1_ptr |
259 | #define des_encrypt3 des_encrypt3_u4_risc1_ptr | 259 | #define DES_encrypt3 des_encrypt3_u4_risc1_ptr |
260 | #define des_decrypt3 des_decrypt3_u4_risc1_ptr | 260 | #define DES_decrypt3 des_decrypt3_u4_risc1_ptr |
261 | #undef HEADER_DES_LOCL_H | 261 | #undef HEADER_DES_LOCL_H |
262 | #include "des_enc.c" | 262 | #include "des_enc.c" |
263 | 263 | ||
@@ -270,14 +270,14 @@ extern void exit(); | |||
270 | #define DES_RISC2 | 270 | #define DES_RISC2 |
271 | #define DES_PTR | 271 | #define DES_PTR |
272 | #undef D_ENCRYPT | 272 | #undef D_ENCRYPT |
273 | #undef des_encrypt1 | 273 | #undef DES_encrypt1 |
274 | #undef des_encrypt2 | 274 | #undef DES_encrypt2 |
275 | #undef des_encrypt3 | 275 | #undef DES_encrypt3 |
276 | #undef des_decrypt3 | 276 | #undef DES_decrypt3 |
277 | #define des_encrypt1 des_encrypt_u4_risc2_ptr | 277 | #define DES_encrypt1 des_encrypt_u4_risc2_ptr |
278 | #define des_encrypt2 des_encrypt2_u4_risc2_ptr | 278 | #define DES_encrypt2 des_encrypt2_u4_risc2_ptr |
279 | #define des_encrypt3 des_encrypt3_u4_risc2_ptr | 279 | #define DES_encrypt3 des_encrypt3_u4_risc2_ptr |
280 | #define des_decrypt3 des_decrypt3_u4_risc2_ptr | 280 | #define DES_decrypt3 des_decrypt3_u4_risc2_ptr |
281 | #undef HEADER_DES_LOCL_H | 281 | #undef HEADER_DES_LOCL_H |
282 | #include "des_enc.c" | 282 | #include "des_enc.c" |
283 | 283 | ||
@@ -286,14 +286,14 @@ extern void exit(); | |||
286 | #undef DES_RISC2 | 286 | #undef DES_RISC2 |
287 | #define DES_PTR | 287 | #define DES_PTR |
288 | #undef D_ENCRYPT | 288 | #undef D_ENCRYPT |
289 | #undef des_encrypt1 | 289 | #undef DES_encrypt1 |
290 | #undef des_encrypt2 | 290 | #undef DES_encrypt2 |
291 | #undef des_encrypt3 | 291 | #undef DES_encrypt3 |
292 | #undef des_decrypt3 | 292 | #undef DES_decrypt3 |
293 | #define des_encrypt1 des_encrypt_u16_risc1_ptr | 293 | #define DES_encrypt1 des_encrypt_u16_risc1_ptr |
294 | #define des_encrypt2 des_encrypt2_u16_risc1_ptr | 294 | #define DES_encrypt2 des_encrypt2_u16_risc1_ptr |
295 | #define des_encrypt3 des_encrypt3_u16_risc1_ptr | 295 | #define DES_encrypt3 des_encrypt3_u16_risc1_ptr |
296 | #define des_decrypt3 des_decrypt3_u16_risc1_ptr | 296 | #define DES_decrypt3 des_decrypt3_u16_risc1_ptr |
297 | #undef HEADER_DES_LOCL_H | 297 | #undef HEADER_DES_LOCL_H |
298 | #include "des_enc.c" | 298 | #include "des_enc.c" |
299 | 299 | ||
@@ -302,14 +302,14 @@ extern void exit(); | |||
302 | #define DES_RISC2 | 302 | #define DES_RISC2 |
303 | #define DES_PTR | 303 | #define DES_PTR |
304 | #undef D_ENCRYPT | 304 | #undef D_ENCRYPT |
305 | #undef des_encrypt1 | 305 | #undef DES_encrypt1 |
306 | #undef des_encrypt2 | 306 | #undef DES_encrypt2 |
307 | #undef des_encrypt3 | 307 | #undef DES_encrypt3 |
308 | #undef des_decrypt3 | 308 | #undef DES_decrypt3 |
309 | #define des_encrypt1 des_encrypt_u16_risc2_ptr | 309 | #define DES_encrypt1 des_encrypt_u16_risc2_ptr |
310 | #define des_encrypt2 des_encrypt2_u16_risc2_ptr | 310 | #define DES_encrypt2 des_encrypt2_u16_risc2_ptr |
311 | #define des_encrypt3 des_encrypt3_u16_risc2_ptr | 311 | #define DES_encrypt3 des_encrypt3_u16_risc2_ptr |
312 | #define des_decrypt3 des_decrypt3_u16_risc2_ptr | 312 | #define DES_decrypt3 des_decrypt3_u16_risc2_ptr |
313 | #undef HEADER_DES_LOCL_H | 313 | #undef HEADER_DES_LOCL_H |
314 | #include "des_enc.c" | 314 | #include "des_enc.c" |
315 | 315 | ||
@@ -401,7 +401,7 @@ double Time_F(int s) | |||
401 | for (count=0,run=1; COND(cb); count++) \ | 401 | for (count=0,run=1; COND(cb); count++) \ |
402 | { \ | 402 | { \ |
403 | unsigned long d[2]; \ | 403 | unsigned long d[2]; \ |
404 | func(d,&(sch[0]),DES_ENCRYPT); \ | 404 | func(d,&sch,DES_ENCRYPT); \ |
405 | } \ | 405 | } \ |
406 | tm[index]=Time_F(STOP); \ | 406 | tm[index]=Time_F(STOP); \ |
407 | fprintf(stderr,"%ld %s's in %.2f second\n",count,name,tm[index]); \ | 407 | fprintf(stderr,"%ld %s's in %.2f second\n",count,name,tm[index]); \ |
@@ -415,10 +415,10 @@ int main(int argc, char **argv) | |||
415 | { | 415 | { |
416 | long count; | 416 | long count; |
417 | static unsigned char buf[BUFSIZE]; | 417 | static unsigned char buf[BUFSIZE]; |
418 | static des_cblock key ={0x12,0x34,0x56,0x78,0x9a,0xbc,0xde,0xf0}; | 418 | static DES_cblock key ={0x12,0x34,0x56,0x78,0x9a,0xbc,0xde,0xf0}; |
419 | static des_cblock key2={0x34,0x56,0x78,0x9a,0xbc,0xde,0xf0,0x12}; | 419 | static DES_cblock key2={0x34,0x56,0x78,0x9a,0xbc,0xde,0xf0,0x12}; |
420 | static des_cblock key3={0x56,0x78,0x9a,0xbc,0xde,0xf0,0x12,0x34}; | 420 | static DES_cblock key3={0x56,0x78,0x9a,0xbc,0xde,0xf0,0x12,0x34}; |
421 | des_key_schedule sch,sch2,sch3; | 421 | DES_key_schedule sch,sch2,sch3; |
422 | double d,tm[16],max=0; | 422 | double d,tm[16],max=0; |
423 | int rank[16]; | 423 | int rank[16]; |
424 | char *str[16]; | 424 | char *str[16]; |
@@ -438,13 +438,13 @@ int main(int argc, char **argv) | |||
438 | fprintf(stderr,"program when this computer is idle.\n"); | 438 | fprintf(stderr,"program when this computer is idle.\n"); |
439 | #endif | 439 | #endif |
440 | 440 | ||
441 | des_set_key_unchecked(&key,sch); | 441 | DES_set_key_unchecked(&key,&sch); |
442 | des_set_key_unchecked(&key2,sch2); | 442 | DES_set_key_unchecked(&key2,&sch2); |
443 | des_set_key_unchecked(&key3,sch3); | 443 | DES_set_key_unchecked(&key3,&sch3); |
444 | 444 | ||
445 | #ifndef SIGALRM | 445 | #ifndef SIGALRM |
446 | fprintf(stderr,"First we calculate the approximate speed ...\n"); | 446 | fprintf(stderr,"First we calculate the approximate speed ...\n"); |
447 | des_set_key_unchecked(&key,sch); | 447 | DES_set_key_unchecked(&key,sch); |
448 | count=10; | 448 | count=10; |
449 | do { | 449 | do { |
450 | long i; | 450 | long i; |
@@ -453,7 +453,7 @@ int main(int argc, char **argv) | |||
453 | count*=2; | 453 | count*=2; |
454 | Time_F(START); | 454 | Time_F(START); |
455 | for (i=count; i; i--) | 455 | for (i=count; i; i--) |
456 | des_encrypt1(data,&(sch[0]),DES_ENCRYPT); | 456 | DES_encrypt1(data,&(sch[0]),DES_ENCRYPT); |
457 | d=Time_F(STOP); | 457 | d=Time_F(STOP); |
458 | } while (d < 3.0); | 458 | } while (d < 3.0); |
459 | ca=count; | 459 | ca=count; |
@@ -598,7 +598,7 @@ int main(int argc, char **argv) | |||
598 | break; | 598 | break; |
599 | } | 599 | } |
600 | exit(0); | 600 | exit(0); |
601 | #if defined(LINT) || defined(MSDOS) | 601 | #if defined(LINT) || defined(OPENSSL_SYS_MSDOS) |
602 | return(0); | 602 | return(0); |
603 | #endif | 603 | #endif |
604 | } | 604 | } |
diff --git a/src/lib/libcrypto/des/des_ver.h b/src/lib/libcrypto/des/des_ver.h index de3c02f110..0fa94d5368 100644 --- a/src/lib/libcrypto/des/des_ver.h +++ b/src/lib/libcrypto/des/des_ver.h | |||
@@ -57,5 +57,11 @@ | |||
57 | */ | 57 | */ |
58 | 58 | ||
59 | #include <openssl/e_os2.h> | 59 | #include <openssl/e_os2.h> |
60 | |||
61 | #ifdef OPENSSL_BUILD_SHLIBCRYPTO | ||
62 | # undef OPENSSL_EXTERN | ||
63 | # define OPENSSL_EXTERN OPENSSL_EXPORT | ||
64 | #endif | ||
65 | |||
60 | OPENSSL_EXTERN char *DES_version; /* SSLeay version string */ | 66 | OPENSSL_EXTERN char *DES_version; /* SSLeay version string */ |
61 | OPENSSL_EXTERN char *libdes_version; /* old libdes version string */ | 67 | OPENSSL_EXTERN char *libdes_version; /* old libdes version string */ |
diff --git a/src/lib/libcrypto/des/destest.c b/src/lib/libcrypto/des/destest.c index df0d615d6b..58e8c35dcb 100644 --- a/src/lib/libcrypto/des/destest.c +++ b/src/lib/libcrypto/des/destest.c | |||
@@ -56,25 +56,26 @@ | |||
56 | * [including the GNU Public Licence.] | 56 | * [including the GNU Public Licence.] |
57 | */ | 57 | */ |
58 | 58 | ||
59 | #if defined(WIN32) || defined(WIN16) || defined(WINDOWS) | 59 | #include <stdio.h> |
60 | #ifndef MSDOS | 60 | #include <stdlib.h> |
61 | #define MSDOS | 61 | |
62 | #include <openssl/e_os2.h> | ||
63 | #if defined(OPENSSL_SYS_WIN32) || defined(OPENSSL_SYS_WIN16) || defined(OPENSSL_SYS_WINDOWS) | ||
64 | #ifndef OPENSSL_SYS_MSDOS | ||
65 | #define OPENSSL_SYS_MSDOS | ||
62 | #endif | 66 | #endif |
63 | #endif | 67 | #endif |
64 | 68 | ||
65 | #include <stdio.h> | 69 | #ifndef OPENSSL_SYS_MSDOS |
66 | #include <stdlib.h> | 70 | #if !defined(OPENSSL_SYS_VMS) || defined(OPENSSL_SYS_VMS_DECC) |
67 | #ifndef MSDOS | ||
68 | #if !defined(VMS) || defined(__DECC) | ||
69 | #include <openssl/opensslconf.h> | ||
70 | #include OPENSSL_UNISTD | 71 | #include OPENSSL_UNISTD |
71 | #endif /* VMS */ | 72 | #endif |
72 | #else | 73 | #else |
73 | #include <io.h> | 74 | #include <io.h> |
74 | #endif | 75 | #endif |
75 | #include <string.h> | 76 | #include <string.h> |
76 | 77 | ||
77 | #ifdef NO_DES | 78 | #ifdef OPENSSL_NO_DES |
78 | int main(int argc, char *argv[]) | 79 | int main(int argc, char *argv[]) |
79 | { | 80 | { |
80 | printf("No DES support\n"); | 81 | printf("No DES support\n"); |
@@ -83,7 +84,7 @@ int main(int argc, char *argv[]) | |||
83 | #else | 84 | #else |
84 | #include <openssl/des.h> | 85 | #include <openssl/des.h> |
85 | 86 | ||
86 | #if defined(PERL5) || defined(__FreeBSD__) | 87 | #if defined(PERL5) || defined(__FreeBSD__) || defined(NeXT) |
87 | #define crypt(c,s) (des_crypt((c),(s))) | 88 | #define crypt(c,s) (des_crypt((c),(s))) |
88 | #endif | 89 | #endif |
89 | 90 | ||
@@ -348,19 +349,19 @@ int main(int argc, char *argv[]) | |||
348 | int num; | 349 | int num; |
349 | char *str; | 350 | char *str; |
350 | 351 | ||
351 | #ifndef NO_DESCBCM | 352 | #ifndef OPENSSL_NO_DESCBCM |
352 | printf("Doing cbcm\n"); | 353 | printf("Doing cbcm\n"); |
353 | if ((j=des_set_key_checked(&cbc_key,ks)) != 0) | 354 | if ((j=DES_set_key_checked(&cbc_key,&ks)) != 0) |
354 | { | 355 | { |
355 | printf("Key error %d\n",j); | 356 | printf("Key error %d\n",j); |
356 | err=1; | 357 | err=1; |
357 | } | 358 | } |
358 | if ((j=des_set_key_checked(&cbc2_key,ks2)) != 0) | 359 | if ((j=DES_set_key_checked(&cbc2_key,&ks2)) != 0) |
359 | { | 360 | { |
360 | printf("Key error %d\n",j); | 361 | printf("Key error %d\n",j); |
361 | err=1; | 362 | err=1; |
362 | } | 363 | } |
363 | if ((j=des_set_key_checked(&cbc3_key,ks3)) != 0) | 364 | if ((j=DES_set_key_checked(&cbc3_key,&ks3)) != 0) |
364 | { | 365 | { |
365 | printf("Key error %d\n",j); | 366 | printf("Key error %d\n",j); |
366 | err=1; | 367 | err=1; |
@@ -372,9 +373,9 @@ int main(int argc, char *argv[]) | |||
372 | memcpy(iv3,cbc_iv,sizeof(cbc_iv)); | 373 | memcpy(iv3,cbc_iv,sizeof(cbc_iv)); |
373 | memset(iv2,'\0',sizeof iv2); | 374 | memset(iv2,'\0',sizeof iv2); |
374 | 375 | ||
375 | des_ede3_cbcm_encrypt(cbc_data,cbc_out,16L,ks,ks2,ks3,&iv3,&iv2, | 376 | DES_ede3_cbcm_encrypt(cbc_data,cbc_out,16L,&ks,&ks2,&ks3,&iv3,&iv2, |
376 | DES_ENCRYPT); | 377 | DES_ENCRYPT); |
377 | des_ede3_cbcm_encrypt(&cbc_data[16],&cbc_out[16],i-16,ks,ks2,ks3, | 378 | DES_ede3_cbcm_encrypt(&cbc_data[16],&cbc_out[16],i-16,&ks,&ks2,&ks3, |
378 | &iv3,&iv2,DES_ENCRYPT); | 379 | &iv3,&iv2,DES_ENCRYPT); |
379 | /* if (memcmp(cbc_out,cbc3_ok, | 380 | /* if (memcmp(cbc_out,cbc3_ok, |
380 | (unsigned int)(strlen((char *)cbc_data)+1+7)/8*8) != 0) | 381 | (unsigned int)(strlen((char *)cbc_data)+1+7)/8*8) != 0) |
@@ -385,7 +386,7 @@ int main(int argc, char *argv[]) | |||
385 | */ | 386 | */ |
386 | memcpy(iv3,cbc_iv,sizeof(cbc_iv)); | 387 | memcpy(iv3,cbc_iv,sizeof(cbc_iv)); |
387 | memset(iv2,'\0',sizeof iv2); | 388 | memset(iv2,'\0',sizeof iv2); |
388 | des_ede3_cbcm_encrypt(cbc_out,cbc_in,i,ks,ks2,ks3,&iv3,&iv2,DES_DECRYPT); | 389 | DES_ede3_cbcm_encrypt(cbc_out,cbc_in,i,&ks,&ks2,&ks3,&iv3,&iv2,DES_DECRYPT); |
389 | if (memcmp(cbc_in,cbc_data,strlen((char *)cbc_data)+1) != 0) | 390 | if (memcmp(cbc_in,cbc_data,strlen((char *)cbc_data)+1) != 0) |
390 | { | 391 | { |
391 | int n; | 392 | int n; |
@@ -404,7 +405,7 @@ int main(int argc, char *argv[]) | |||
404 | printf("Doing ecb\n"); | 405 | printf("Doing ecb\n"); |
405 | for (i=0; i<NUM_TESTS; i++) | 406 | for (i=0; i<NUM_TESTS; i++) |
406 | { | 407 | { |
407 | des_set_key_unchecked(&key_data[i],ks); | 408 | DES_set_key_unchecked(&key_data[i],&ks); |
408 | memcpy(in,plain_data[i],8); | 409 | memcpy(in,plain_data[i],8); |
409 | memset(out,0,8); | 410 | memset(out,0,8); |
410 | memset(outin,0,8); | 411 | memset(outin,0,8); |
@@ -430,9 +431,9 @@ int main(int argc, char *argv[]) | |||
430 | printf("Doing ede ecb\n"); | 431 | printf("Doing ede ecb\n"); |
431 | for (i=0; i<(NUM_TESTS-1); i++) | 432 | for (i=0; i<(NUM_TESTS-1); i++) |
432 | { | 433 | { |
433 | des_set_key_unchecked(&key_data[i],ks); | 434 | DES_set_key_unchecked(&key_data[i],&ks); |
434 | des_set_key_unchecked(&key_data[i+1],ks2); | 435 | DES_set_key_unchecked(&key_data[i+1],&ks2); |
435 | des_set_key_unchecked(&key_data[i+2],ks3); | 436 | DES_set_key_unchecked(&key_data[i+2],&ks3); |
436 | memcpy(in,plain_data[i],8); | 437 | memcpy(in,plain_data[i],8); |
437 | memset(out,0,8); | 438 | memset(out,0,8); |
438 | memset(outin,0,8); | 439 | memset(outin,0,8); |
@@ -456,7 +457,7 @@ int main(int argc, char *argv[]) | |||
456 | #endif | 457 | #endif |
457 | 458 | ||
458 | printf("Doing cbc\n"); | 459 | printf("Doing cbc\n"); |
459 | if ((j=des_set_key_checked(&cbc_key,ks)) != 0) | 460 | if ((j=DES_set_key_checked(&cbc_key,&ks)) != 0) |
460 | { | 461 | { |
461 | printf("Key error %d\n",j); | 462 | printf("Key error %d\n",j); |
462 | err=1; | 463 | err=1; |
@@ -483,7 +484,7 @@ int main(int argc, char *argv[]) | |||
483 | 484 | ||
484 | #ifndef LIBDES_LIT | 485 | #ifndef LIBDES_LIT |
485 | printf("Doing desx cbc\n"); | 486 | printf("Doing desx cbc\n"); |
486 | if ((j=des_set_key_checked(&cbc_key,ks)) != 0) | 487 | if ((j=DES_set_key_checked(&cbc_key,&ks)) != 0) |
487 | { | 488 | { |
488 | printf("Key error %d\n",j); | 489 | printf("Key error %d\n",j); |
489 | err=1; | 490 | err=1; |
@@ -509,17 +510,17 @@ int main(int argc, char *argv[]) | |||
509 | #endif | 510 | #endif |
510 | 511 | ||
511 | printf("Doing ede cbc\n"); | 512 | printf("Doing ede cbc\n"); |
512 | if ((j=des_set_key_checked(&cbc_key,ks)) != 0) | 513 | if ((j=DES_set_key_checked(&cbc_key,&ks)) != 0) |
513 | { | 514 | { |
514 | printf("Key error %d\n",j); | 515 | printf("Key error %d\n",j); |
515 | err=1; | 516 | err=1; |
516 | } | 517 | } |
517 | if ((j=des_set_key_checked(&cbc2_key,ks2)) != 0) | 518 | if ((j=DES_set_key_checked(&cbc2_key,&ks2)) != 0) |
518 | { | 519 | { |
519 | printf("Key error %d\n",j); | 520 | printf("Key error %d\n",j); |
520 | err=1; | 521 | err=1; |
521 | } | 522 | } |
522 | if ((j=des_set_key_checked(&cbc3_key,ks3)) != 0) | 523 | if ((j=DES_set_key_checked(&cbc3_key,&ks3)) != 0) |
523 | { | 524 | { |
524 | printf("Key error %d\n",j); | 525 | printf("Key error %d\n",j); |
525 | err=1; | 526 | err=1; |
@@ -530,13 +531,22 @@ int main(int argc, char *argv[]) | |||
530 | /* i=((i+7)/8)*8; */ | 531 | /* i=((i+7)/8)*8; */ |
531 | memcpy(iv3,cbc_iv,sizeof(cbc_iv)); | 532 | memcpy(iv3,cbc_iv,sizeof(cbc_iv)); |
532 | 533 | ||
533 | des_ede3_cbc_encrypt(cbc_data,cbc_out,16L,ks,ks2,ks3,&iv3,DES_ENCRYPT); | 534 | des_ede3_cbc_encrypt(cbc_data,cbc_out,16L,ks,ks2,ks3,&iv3, |
535 | DES_ENCRYPT); | ||
534 | des_ede3_cbc_encrypt(&(cbc_data[16]),&(cbc_out[16]),i-16,ks,ks2,ks3, | 536 | des_ede3_cbc_encrypt(&(cbc_data[16]),&(cbc_out[16]),i-16,ks,ks2,ks3, |
535 | &iv3,DES_ENCRYPT); | 537 | &iv3,DES_ENCRYPT); |
536 | if (memcmp(cbc_out,cbc3_ok, | 538 | if (memcmp(cbc_out,cbc3_ok, |
537 | (unsigned int)(strlen((char *)cbc_data)+1+7)/8*8) != 0) | 539 | (unsigned int)(strlen((char *)cbc_data)+1+7)/8*8) != 0) |
538 | { | 540 | { |
541 | int n; | ||
542 | |||
539 | printf("des_ede3_cbc_encrypt encrypt error\n"); | 543 | printf("des_ede3_cbc_encrypt encrypt error\n"); |
544 | for(n=0 ; n < i ; ++n) | ||
545 | printf(" %02x",cbc_out[n]); | ||
546 | printf("\n"); | ||
547 | for(n=0 ; n < i ; ++n) | ||
548 | printf(" %02x",cbc3_ok[n]); | ||
549 | printf("\n"); | ||
540 | err=1; | 550 | err=1; |
541 | } | 551 | } |
542 | 552 | ||
@@ -544,13 +554,21 @@ int main(int argc, char *argv[]) | |||
544 | des_ede3_cbc_encrypt(cbc_out,cbc_in,i,ks,ks2,ks3,&iv3,DES_DECRYPT); | 554 | des_ede3_cbc_encrypt(cbc_out,cbc_in,i,ks,ks2,ks3,&iv3,DES_DECRYPT); |
545 | if (memcmp(cbc_in,cbc_data,strlen((char *)cbc_data)+1) != 0) | 555 | if (memcmp(cbc_in,cbc_data,strlen((char *)cbc_data)+1) != 0) |
546 | { | 556 | { |
557 | int n; | ||
558 | |||
547 | printf("des_ede3_cbc_encrypt decrypt error\n"); | 559 | printf("des_ede3_cbc_encrypt decrypt error\n"); |
560 | for(n=0 ; n < i ; ++n) | ||
561 | printf(" %02x",cbc_data[n]); | ||
562 | printf("\n"); | ||
563 | for(n=0 ; n < i ; ++n) | ||
564 | printf(" %02x",cbc_in[n]); | ||
565 | printf("\n"); | ||
548 | err=1; | 566 | err=1; |
549 | } | 567 | } |
550 | 568 | ||
551 | #ifndef LIBDES_LIT | 569 | #ifndef LIBDES_LIT |
552 | printf("Doing pcbc\n"); | 570 | printf("Doing pcbc\n"); |
553 | if ((j=des_set_key_checked(&cbc_key,ks)) != 0) | 571 | if ((j=DES_set_key_checked(&cbc_key,&ks)) != 0) |
554 | { | 572 | { |
555 | printf("Key error %d\n",j); | 573 | printf("Key error %d\n",j); |
556 | err=1; | 574 | err=1; |
@@ -613,7 +631,7 @@ int main(int argc, char *argv[]) | |||
613 | printf("done\n"); | 631 | printf("done\n"); |
614 | 632 | ||
615 | printf("Doing ofb\n"); | 633 | printf("Doing ofb\n"); |
616 | des_set_key_checked(&ofb_key,ks); | 634 | DES_set_key_checked(&ofb_key,&ks); |
617 | memcpy(ofb_tmp,ofb_iv,sizeof(ofb_iv)); | 635 | memcpy(ofb_tmp,ofb_iv,sizeof(ofb_iv)); |
618 | des_ofb_encrypt(plain,ofb_buf1,64,sizeof(plain)/8,ks,&ofb_tmp); | 636 | des_ofb_encrypt(plain,ofb_buf1,64,sizeof(plain)/8,ks,&ofb_tmp); |
619 | if (memcmp(ofb_cipher,ofb_buf1,sizeof(ofb_buf1)) != 0) | 637 | if (memcmp(ofb_cipher,ofb_buf1,sizeof(ofb_buf1)) != 0) |
@@ -642,7 +660,7 @@ plain[8+4], plain[8+5], plain[8+6], plain[8+7]); | |||
642 | } | 660 | } |
643 | 661 | ||
644 | printf("Doing ofb64\n"); | 662 | printf("Doing ofb64\n"); |
645 | des_set_key_checked(&ofb_key,ks); | 663 | DES_set_key_checked(&ofb_key,&ks); |
646 | memcpy(ofb_tmp,ofb_iv,sizeof(ofb_iv)); | 664 | memcpy(ofb_tmp,ofb_iv,sizeof(ofb_iv)); |
647 | memset(ofb_buf1,0,sizeof(ofb_buf1)); | 665 | memset(ofb_buf1,0,sizeof(ofb_buf1)); |
648 | memset(ofb_buf2,0,sizeof(ofb_buf1)); | 666 | memset(ofb_buf2,0,sizeof(ofb_buf1)); |
@@ -659,7 +677,8 @@ plain[8+4], plain[8+5], plain[8+6], plain[8+7]); | |||
659 | } | 677 | } |
660 | memcpy(ofb_tmp,ofb_iv,sizeof(ofb_iv)); | 678 | memcpy(ofb_tmp,ofb_iv,sizeof(ofb_iv)); |
661 | num=0; | 679 | num=0; |
662 | des_ofb64_encrypt(ofb_buf1,ofb_buf2,sizeof(ofb_buf1),ks,&ofb_tmp,&num); | 680 | des_ofb64_encrypt(ofb_buf1,ofb_buf2,sizeof(ofb_buf1),ks,&ofb_tmp, |
681 | &num); | ||
663 | if (memcmp(plain,ofb_buf2,sizeof(ofb_buf2)) != 0) | 682 | if (memcmp(plain,ofb_buf2,sizeof(ofb_buf2)) != 0) |
664 | { | 683 | { |
665 | printf("ofb64_encrypt decrypt error\n"); | 684 | printf("ofb64_encrypt decrypt error\n"); |
@@ -667,15 +686,15 @@ plain[8+4], plain[8+5], plain[8+6], plain[8+7]); | |||
667 | } | 686 | } |
668 | 687 | ||
669 | printf("Doing ede_ofb64\n"); | 688 | printf("Doing ede_ofb64\n"); |
670 | des_set_key_checked(&ofb_key,ks); | 689 | DES_set_key_checked(&ofb_key,&ks); |
671 | memcpy(ofb_tmp,ofb_iv,sizeof(ofb_iv)); | 690 | memcpy(ofb_tmp,ofb_iv,sizeof(ofb_iv)); |
672 | memset(ofb_buf1,0,sizeof(ofb_buf1)); | 691 | memset(ofb_buf1,0,sizeof(ofb_buf1)); |
673 | memset(ofb_buf2,0,sizeof(ofb_buf1)); | 692 | memset(ofb_buf2,0,sizeof(ofb_buf1)); |
674 | num=0; | 693 | num=0; |
675 | for (i=0; i<sizeof(plain); i++) | 694 | for (i=0; i<sizeof(plain); i++) |
676 | { | 695 | { |
677 | des_ede3_ofb64_encrypt(&(plain[i]),&(ofb_buf1[i]),1,ks,ks,ks, | 696 | des_ede3_ofb64_encrypt(&(plain[i]),&(ofb_buf1[i]),1,ks,ks, |
678 | &ofb_tmp,&num); | 697 | ks,&ofb_tmp,&num); |
679 | } | 698 | } |
680 | if (memcmp(ofb_cipher,ofb_buf1,sizeof(ofb_buf1)) != 0) | 699 | if (memcmp(ofb_cipher,ofb_buf1,sizeof(ofb_buf1)) != 0) |
681 | { | 700 | { |
@@ -684,8 +703,8 @@ plain[8+4], plain[8+5], plain[8+6], plain[8+7]); | |||
684 | } | 703 | } |
685 | memcpy(ofb_tmp,ofb_iv,sizeof(ofb_iv)); | 704 | memcpy(ofb_tmp,ofb_iv,sizeof(ofb_iv)); |
686 | num=0; | 705 | num=0; |
687 | des_ede3_ofb64_encrypt(ofb_buf1,ofb_buf2,sizeof(ofb_buf1),ks, | 706 | des_ede3_ofb64_encrypt(ofb_buf1,ofb_buf2,sizeof(ofb_buf1),ks,ks,ks, |
688 | ks,ks,&ofb_tmp,&num); | 707 | &ofb_tmp,&num); |
689 | if (memcmp(plain,ofb_buf2,sizeof(ofb_buf2)) != 0) | 708 | if (memcmp(plain,ofb_buf2,sizeof(ofb_buf2)) != 0) |
690 | { | 709 | { |
691 | printf("ede_ofb64_encrypt decrypt error\n"); | 710 | printf("ede_ofb64_encrypt decrypt error\n"); |
@@ -693,7 +712,7 @@ plain[8+4], plain[8+5], plain[8+6], plain[8+7]); | |||
693 | } | 712 | } |
694 | 713 | ||
695 | printf("Doing cbc_cksum\n"); | 714 | printf("Doing cbc_cksum\n"); |
696 | des_set_key_checked(&cbc_key,ks); | 715 | DES_set_key_checked(&cbc_key,&ks); |
697 | cs=des_cbc_cksum(cbc_data,&cret,strlen((char *)cbc_data),ks,&cbc_iv); | 716 | cs=des_cbc_cksum(cbc_data,&cret,strlen((char *)cbc_data),ks,&cbc_iv); |
698 | if (cs != cbc_cksum_ret) | 717 | if (cs != cbc_cksum_ret) |
699 | { | 718 | { |
@@ -708,7 +727,7 @@ plain[8+4], plain[8+5], plain[8+6], plain[8+7]); | |||
708 | } | 727 | } |
709 | 728 | ||
710 | printf("Doing quad_cksum\n"); | 729 | printf("Doing quad_cksum\n"); |
711 | cs=quad_cksum(cbc_data,(des_cblock *)lqret, | 730 | cs=des_quad_cksum(cbc_data,(des_cblock *)lqret, |
712 | (long)strlen((char *)cbc_data),2,(des_cblock *)cbc_iv); | 731 | (long)strlen((char *)cbc_data),2,(des_cblock *)cbc_iv); |
713 | if (cs != 0x70d7a63aL) | 732 | if (cs != 0x70d7a63aL) |
714 | { | 733 | { |
@@ -829,7 +848,7 @@ static int cfb_test(int bits, unsigned char *cfb_cipher) | |||
829 | des_key_schedule ks; | 848 | des_key_schedule ks; |
830 | int i,err=0; | 849 | int i,err=0; |
831 | 850 | ||
832 | des_set_key_checked(&cfb_key,ks); | 851 | DES_set_key_checked(&cfb_key,&ks); |
833 | memcpy(cfb_tmp,cfb_iv,sizeof(cfb_iv)); | 852 | memcpy(cfb_tmp,cfb_iv,sizeof(cfb_iv)); |
834 | des_cfb_encrypt(plain,cfb_buf1,bits,sizeof(plain),ks,&cfb_tmp, | 853 | des_cfb_encrypt(plain,cfb_buf1,bits,sizeof(plain),ks,&cfb_tmp, |
835 | DES_ENCRYPT); | 854 | DES_ENCRYPT); |
@@ -858,7 +877,7 @@ static int cfb64_test(unsigned char *cfb_cipher) | |||
858 | des_key_schedule ks; | 877 | des_key_schedule ks; |
859 | int err=0,i,n; | 878 | int err=0,i,n; |
860 | 879 | ||
861 | des_set_key_checked(&cfb_key,ks); | 880 | DES_set_key_checked(&cfb_key,&ks); |
862 | memcpy(cfb_tmp,cfb_iv,sizeof(cfb_iv)); | 881 | memcpy(cfb_tmp,cfb_iv,sizeof(cfb_iv)); |
863 | n=0; | 882 | n=0; |
864 | des_cfb64_encrypt(plain,cfb_buf1,12,ks,&cfb_tmp,&n,DES_ENCRYPT); | 883 | des_cfb64_encrypt(plain,cfb_buf1,12,ks,&cfb_tmp,&n,DES_ENCRYPT); |
@@ -891,7 +910,7 @@ static int ede_cfb64_test(unsigned char *cfb_cipher) | |||
891 | des_key_schedule ks; | 910 | des_key_schedule ks; |
892 | int err=0,i,n; | 911 | int err=0,i,n; |
893 | 912 | ||
894 | des_set_key_checked(&cfb_key,ks); | 913 | DES_set_key_checked(&cfb_key,&ks); |
895 | memcpy(cfb_tmp,cfb_iv,sizeof(cfb_iv)); | 914 | memcpy(cfb_tmp,cfb_iv,sizeof(cfb_iv)); |
896 | n=0; | 915 | n=0; |
897 | des_ede3_cfb64_encrypt(plain,cfb_buf1,12,ks,ks,ks,&cfb_tmp,&n, | 916 | des_ede3_cfb64_encrypt(plain,cfb_buf1,12,ks,ks,ks,&cfb_tmp,&n, |
diff --git a/src/lib/libcrypto/des/ecb3_enc.c b/src/lib/libcrypto/des/ecb3_enc.c index fb28b97e1a..c3437bc606 100644 --- a/src/lib/libcrypto/des/ecb3_enc.c +++ b/src/lib/libcrypto/des/ecb3_enc.c | |||
@@ -58,8 +58,9 @@ | |||
58 | 58 | ||
59 | #include "des_locl.h" | 59 | #include "des_locl.h" |
60 | 60 | ||
61 | void des_ecb3_encrypt(const_des_cblock *input, des_cblock *output, | 61 | void DES_ecb3_encrypt(const_DES_cblock *input, DES_cblock *output, |
62 | des_key_schedule ks1, des_key_schedule ks2, des_key_schedule ks3, | 62 | DES_key_schedule *ks1, DES_key_schedule *ks2, |
63 | DES_key_schedule *ks3, | ||
63 | int enc) | 64 | int enc) |
64 | { | 65 | { |
65 | register DES_LONG l0,l1; | 66 | register DES_LONG l0,l1; |
@@ -72,9 +73,9 @@ void des_ecb3_encrypt(const_des_cblock *input, des_cblock *output, | |||
72 | ll[0]=l0; | 73 | ll[0]=l0; |
73 | ll[1]=l1; | 74 | ll[1]=l1; |
74 | if (enc) | 75 | if (enc) |
75 | des_encrypt3(ll,ks1,ks2,ks3); | 76 | DES_encrypt3(ll,ks1,ks2,ks3); |
76 | else | 77 | else |
77 | des_decrypt3(ll,ks1,ks2,ks3); | 78 | DES_decrypt3(ll,ks1,ks2,ks3); |
78 | l0=ll[0]; | 79 | l0=ll[0]; |
79 | l1=ll[1]; | 80 | l1=ll[1]; |
80 | l2c(l0,out); | 81 | l2c(l0,out); |
diff --git a/src/lib/libcrypto/des/ecb_enc.c b/src/lib/libcrypto/des/ecb_enc.c index d481327ef3..4650f2fa0f 100644 --- a/src/lib/libcrypto/des/ecb_enc.c +++ b/src/lib/libcrypto/des/ecb_enc.c | |||
@@ -63,7 +63,7 @@ | |||
63 | OPENSSL_GLOBAL const char *libdes_version="libdes" OPENSSL_VERSION_PTEXT; | 63 | OPENSSL_GLOBAL const char *libdes_version="libdes" OPENSSL_VERSION_PTEXT; |
64 | OPENSSL_GLOBAL const char *DES_version="DES" OPENSSL_VERSION_PTEXT; | 64 | OPENSSL_GLOBAL const char *DES_version="DES" OPENSSL_VERSION_PTEXT; |
65 | 65 | ||
66 | const char *des_options(void) | 66 | const char *DES_options(void) |
67 | { | 67 | { |
68 | static int init=1; | 68 | static int init=1; |
69 | static char buf[32]; | 69 | static char buf[32]; |
@@ -103,9 +103,8 @@ const char *des_options(void) | |||
103 | } | 103 | } |
104 | 104 | ||
105 | 105 | ||
106 | void des_ecb_encrypt(const_des_cblock *input, des_cblock *output, | 106 | void DES_ecb_encrypt(const_DES_cblock *input, DES_cblock *output, |
107 | des_key_schedule ks, | 107 | DES_key_schedule *ks, int enc) |
108 | int enc) | ||
109 | { | 108 | { |
110 | register DES_LONG l; | 109 | register DES_LONG l; |
111 | DES_LONG ll[2]; | 110 | DES_LONG ll[2]; |
@@ -114,9 +113,8 @@ void des_ecb_encrypt(const_des_cblock *input, des_cblock *output, | |||
114 | 113 | ||
115 | c2l(in,l); ll[0]=l; | 114 | c2l(in,l); ll[0]=l; |
116 | c2l(in,l); ll[1]=l; | 115 | c2l(in,l); ll[1]=l; |
117 | des_encrypt1(ll,ks,enc); | 116 | DES_encrypt1(ll,ks,enc); |
118 | l=ll[0]; l2c(l,out); | 117 | l=ll[0]; l2c(l,out); |
119 | l=ll[1]; l2c(l,out); | 118 | l=ll[1]; l2c(l,out); |
120 | l=ll[0]=ll[1]=0; | 119 | l=ll[0]=ll[1]=0; |
121 | } | 120 | } |
122 | |||
diff --git a/src/lib/libcrypto/des/ede_cbcm_enc.c b/src/lib/libcrypto/des/ede_cbcm_enc.c index b98f7e17af..fa45aa272b 100644 --- a/src/lib/libcrypto/des/ede_cbcm_enc.c +++ b/src/lib/libcrypto/des/ede_cbcm_enc.c | |||
@@ -68,12 +68,12 @@ http://www.cs.technion.ac.il/users/wwwb/cgi-bin/tr-get.cgi/1998/CS/CS0928.ps.gz | |||
68 | 68 | ||
69 | */ | 69 | */ |
70 | 70 | ||
71 | #ifndef NO_DESCBCM | 71 | #ifndef OPENSSL_NO_DESCBCM |
72 | #include "des_locl.h" | 72 | #include "des_locl.h" |
73 | 73 | ||
74 | void des_ede3_cbcm_encrypt(const unsigned char *in, unsigned char *out, | 74 | void DES_ede3_cbcm_encrypt(const unsigned char *in, unsigned char *out, |
75 | long length, des_key_schedule ks1, des_key_schedule ks2, | 75 | long length, DES_key_schedule *ks1, DES_key_schedule *ks2, |
76 | des_key_schedule ks3, des_cblock *ivec1, des_cblock *ivec2, | 76 | DES_key_schedule *ks3, DES_cblock *ivec1, DES_cblock *ivec2, |
77 | int enc) | 77 | int enc) |
78 | { | 78 | { |
79 | register DES_LONG tin0,tin1; | 79 | register DES_LONG tin0,tin1; |
@@ -95,7 +95,7 @@ void des_ede3_cbcm_encrypt(const unsigned char *in, unsigned char *out, | |||
95 | { | 95 | { |
96 | tin[0]=m0; | 96 | tin[0]=m0; |
97 | tin[1]=m1; | 97 | tin[1]=m1; |
98 | des_encrypt1(tin,ks3,1); | 98 | DES_encrypt1(tin,ks3,1); |
99 | m0=tin[0]; | 99 | m0=tin[0]; |
100 | m1=tin[1]; | 100 | m1=tin[1]; |
101 | 101 | ||
@@ -113,13 +113,13 @@ void des_ede3_cbcm_encrypt(const unsigned char *in, unsigned char *out, | |||
113 | 113 | ||
114 | tin[0]=tin0; | 114 | tin[0]=tin0; |
115 | tin[1]=tin1; | 115 | tin[1]=tin1; |
116 | des_encrypt1(tin,ks1,1); | 116 | DES_encrypt1(tin,ks1,1); |
117 | tin[0]^=m0; | 117 | tin[0]^=m0; |
118 | tin[1]^=m1; | 118 | tin[1]^=m1; |
119 | des_encrypt1(tin,ks2,0); | 119 | DES_encrypt1(tin,ks2,0); |
120 | tin[0]^=m0; | 120 | tin[0]^=m0; |
121 | tin[1]^=m1; | 121 | tin[1]^=m1; |
122 | des_encrypt1(tin,ks1,1); | 122 | DES_encrypt1(tin,ks1,1); |
123 | tout0=tin[0]; | 123 | tout0=tin[0]; |
124 | tout1=tin[1]; | 124 | tout1=tin[1]; |
125 | 125 | ||
@@ -146,7 +146,7 @@ void des_ede3_cbcm_encrypt(const unsigned char *in, unsigned char *out, | |||
146 | { | 146 | { |
147 | tin[0]=m0; | 147 | tin[0]=m0; |
148 | tin[1]=m1; | 148 | tin[1]=m1; |
149 | des_encrypt1(tin,ks3,1); | 149 | DES_encrypt1(tin,ks3,1); |
150 | m0=tin[0]; | 150 | m0=tin[0]; |
151 | m1=tin[1]; | 151 | m1=tin[1]; |
152 | 152 | ||
@@ -158,13 +158,13 @@ void des_ede3_cbcm_encrypt(const unsigned char *in, unsigned char *out, | |||
158 | 158 | ||
159 | tin[0]=tin0; | 159 | tin[0]=tin0; |
160 | tin[1]=tin1; | 160 | tin[1]=tin1; |
161 | des_encrypt1(tin,ks1,0); | 161 | DES_encrypt1(tin,ks1,0); |
162 | tin[0]^=m0; | 162 | tin[0]^=m0; |
163 | tin[1]^=m1; | 163 | tin[1]^=m1; |
164 | des_encrypt1(tin,ks2,1); | 164 | DES_encrypt1(tin,ks2,1); |
165 | tin[0]^=m0; | 165 | tin[0]^=m0; |
166 | tin[1]^=m1; | 166 | tin[1]^=m1; |
167 | des_encrypt1(tin,ks1,0); | 167 | DES_encrypt1(tin,ks1,0); |
168 | tout0=tin[0]; | 168 | tout0=tin[0]; |
169 | tout1=tin[1]; | 169 | tout1=tin[1]; |
170 | 170 | ||
diff --git a/src/lib/libcrypto/des/enc_read.c b/src/lib/libcrypto/des/enc_read.c index af2d9177d2..c70fb686b8 100644 --- a/src/lib/libcrypto/des/enc_read.c +++ b/src/lib/libcrypto/des/enc_read.c | |||
@@ -63,15 +63,15 @@ | |||
63 | 63 | ||
64 | /* This has some uglies in it but it works - even over sockets. */ | 64 | /* This has some uglies in it but it works - even over sockets. */ |
65 | /*extern int errno;*/ | 65 | /*extern int errno;*/ |
66 | OPENSSL_GLOBAL int des_rw_mode=DES_PCBC_MODE; | 66 | OPENSSL_IMPLEMENT_GLOBAL(int,DES_rw_mode)=DES_PCBC_MODE; |
67 | 67 | ||
68 | 68 | ||
69 | /* | 69 | /* |
70 | * WARNINGS: | 70 | * WARNINGS: |
71 | * | 71 | * |
72 | * - The data format used by des_enc_write() and des_enc_read() | 72 | * - The data format used by DES_enc_write() and DES_enc_read() |
73 | * has a cryptographic weakness: When asked to write more | 73 | * has a cryptographic weakness: When asked to write more |
74 | * than MAXWRITE bytes, des_enc_write will split the data | 74 | * than MAXWRITE bytes, DES_enc_write will split the data |
75 | * into several chunks that are all encrypted | 75 | * into several chunks that are all encrypted |
76 | * using the same IV. So don't use these functions unless you | 76 | * using the same IV. So don't use these functions unless you |
77 | * are sure you know what you do (in which case you might | 77 | * are sure you know what you do (in which case you might |
@@ -84,8 +84,8 @@ OPENSSL_GLOBAL int des_rw_mode=DES_PCBC_MODE; | |||
84 | */ | 84 | */ |
85 | 85 | ||
86 | 86 | ||
87 | int des_enc_read(int fd, void *buf, int len, des_key_schedule sched, | 87 | int DES_enc_read(int fd, void *buf, int len, DES_key_schedule *sched, |
88 | des_cblock *iv) | 88 | DES_cblock *iv) |
89 | { | 89 | { |
90 | /* data to be unencrypted */ | 90 | /* data to be unencrypted */ |
91 | int net_num=0; | 91 | int net_num=0; |
@@ -180,10 +180,10 @@ int des_enc_read(int fd, void *buf, int len, des_key_schedule sched, | |||
180 | /* Check if there will be data left over. */ | 180 | /* Check if there will be data left over. */ |
181 | if (len < num) | 181 | if (len < num) |
182 | { | 182 | { |
183 | if (des_rw_mode & DES_PCBC_MODE) | 183 | if (DES_rw_mode & DES_PCBC_MODE) |
184 | des_pcbc_encrypt(net,unnet,num,sched,iv,DES_DECRYPT); | 184 | DES_pcbc_encrypt(net,unnet,num,sched,iv,DES_DECRYPT); |
185 | else | 185 | else |
186 | des_cbc_encrypt(net,unnet,num,sched,iv,DES_DECRYPT); | 186 | DES_cbc_encrypt(net,unnet,num,sched,iv,DES_DECRYPT); |
187 | memcpy(buf,unnet,len); | 187 | memcpy(buf,unnet,len); |
188 | unnet_start=len; | 188 | unnet_start=len; |
189 | unnet_left=num-len; | 189 | unnet_left=num-len; |
@@ -202,11 +202,11 @@ int des_enc_read(int fd, void *buf, int len, des_key_schedule sched, | |||
202 | if (len < rnum) | 202 | if (len < rnum) |
203 | { | 203 | { |
204 | 204 | ||
205 | if (des_rw_mode & DES_PCBC_MODE) | 205 | if (DES_rw_mode & DES_PCBC_MODE) |
206 | des_pcbc_encrypt(net,tmpbuf,num,sched,iv, | 206 | DES_pcbc_encrypt(net,tmpbuf,num,sched,iv, |
207 | DES_DECRYPT); | 207 | DES_DECRYPT); |
208 | else | 208 | else |
209 | des_cbc_encrypt(net,tmpbuf,num,sched,iv, | 209 | DES_cbc_encrypt(net,tmpbuf,num,sched,iv, |
210 | DES_DECRYPT); | 210 | DES_DECRYPT); |
211 | 211 | ||
212 | /* eay 26/08/92 fix a bug that returned more | 212 | /* eay 26/08/92 fix a bug that returned more |
@@ -215,11 +215,11 @@ int des_enc_read(int fd, void *buf, int len, des_key_schedule sched, | |||
215 | } | 215 | } |
216 | else | 216 | else |
217 | { | 217 | { |
218 | if (des_rw_mode & DES_PCBC_MODE) | 218 | if (DES_rw_mode & DES_PCBC_MODE) |
219 | des_pcbc_encrypt(net,buf,num,sched,iv, | 219 | DES_pcbc_encrypt(net,buf,num,sched,iv, |
220 | DES_DECRYPT); | 220 | DES_DECRYPT); |
221 | else | 221 | else |
222 | des_cbc_encrypt(net,buf,num,sched,iv, | 222 | DES_cbc_encrypt(net,buf,num,sched,iv, |
223 | DES_DECRYPT); | 223 | DES_DECRYPT); |
224 | } | 224 | } |
225 | } | 225 | } |
diff --git a/src/lib/libcrypto/des/enc_writ.c b/src/lib/libcrypto/des/enc_writ.c index cc2b50fb50..af5b8c2349 100644 --- a/src/lib/libcrypto/des/enc_writ.c +++ b/src/lib/libcrypto/des/enc_writ.c | |||
@@ -66,9 +66,9 @@ | |||
66 | /* | 66 | /* |
67 | * WARNINGS: | 67 | * WARNINGS: |
68 | * | 68 | * |
69 | * - The data format used by des_enc_write() and des_enc_read() | 69 | * - The data format used by DES_enc_write() and DES_enc_read() |
70 | * has a cryptographic weakness: When asked to write more | 70 | * has a cryptographic weakness: When asked to write more |
71 | * than MAXWRITE bytes, des_enc_write will split the data | 71 | * than MAXWRITE bytes, DES_enc_write will split the data |
72 | * into several chunks that are all encrypted | 72 | * into several chunks that are all encrypted |
73 | * using the same IV. So don't use these functions unless you | 73 | * using the same IV. So don't use these functions unless you |
74 | * are sure you know what you do (in which case you might | 74 | * are sure you know what you do (in which case you might |
@@ -77,8 +77,8 @@ | |||
77 | * - This code cannot handle non-blocking sockets. | 77 | * - This code cannot handle non-blocking sockets. |
78 | */ | 78 | */ |
79 | 79 | ||
80 | int des_enc_write(int fd, const void *_buf, int len, | 80 | int DES_enc_write(int fd, const void *_buf, int len, |
81 | des_key_schedule sched, des_cblock *iv) | 81 | DES_key_schedule *sched, DES_cblock *iv) |
82 | { | 82 | { |
83 | #ifdef _LIBC | 83 | #ifdef _LIBC |
84 | extern unsigned long time(); | 84 | extern unsigned long time(); |
@@ -111,7 +111,7 @@ int des_enc_write(int fd, const void *_buf, int len, | |||
111 | j=0; | 111 | j=0; |
112 | for (i=0; i<len; i+=k) | 112 | for (i=0; i<len; i+=k) |
113 | { | 113 | { |
114 | k=des_enc_write(fd,&(buf[i]), | 114 | k=DES_enc_write(fd,&(buf[i]), |
115 | ((len-i) > MAXWRITE)?MAXWRITE:(len-i),sched,iv); | 115 | ((len-i) > MAXWRITE)?MAXWRITE:(len-i),sched,iv); |
116 | if (k < 0) | 116 | if (k < 0) |
117 | return(k); | 117 | return(k); |
@@ -139,11 +139,11 @@ int des_enc_write(int fd, const void *_buf, int len, | |||
139 | rnum=((len+7)/8*8); /* round up to nearest eight */ | 139 | rnum=((len+7)/8*8); /* round up to nearest eight */ |
140 | } | 140 | } |
141 | 141 | ||
142 | if (des_rw_mode & DES_PCBC_MODE) | 142 | if (DES_rw_mode & DES_PCBC_MODE) |
143 | des_pcbc_encrypt(cp,&(outbuf[HDRSIZE]),(len<8)?8:len,sched,iv, | 143 | DES_pcbc_encrypt(cp,&(outbuf[HDRSIZE]),(len<8)?8:len,sched,iv, |
144 | DES_ENCRYPT); | 144 | DES_ENCRYPT); |
145 | else | 145 | else |
146 | des_cbc_encrypt(cp,&(outbuf[HDRSIZE]),(len<8)?8:len,sched,iv, | 146 | DES_cbc_encrypt(cp,&(outbuf[HDRSIZE]),(len<8)?8:len,sched,iv, |
147 | DES_ENCRYPT); | 147 | DES_ENCRYPT); |
148 | 148 | ||
149 | /* output */ | 149 | /* output */ |
diff --git a/src/lib/libcrypto/des/fcrypt.c b/src/lib/libcrypto/des/fcrypt.c index 9b21f81cc2..d3d27de9f7 100644 --- a/src/lib/libcrypto/des/fcrypt.c +++ b/src/lib/libcrypto/des/fcrypt.c | |||
@@ -50,48 +50,55 @@ static unsigned const char cov_2char[64]={ | |||
50 | 0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7A | 50 | 0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7A |
51 | }; | 51 | }; |
52 | 52 | ||
53 | #ifndef NOPROTO | 53 | void fcrypt_body(DES_LONG *out,DES_key_schedule *ks, |
54 | void fcrypt_body(DES_LONG *out,des_key_schedule ks, | 54 | DES_LONG Eswap0, DES_LONG Eswap1); |
55 | DES_LONG Eswap0, DES_LONG Eswap1); | ||
56 | 55 | ||
57 | #if defined(PERL5) || defined(FreeBSD) || defined(__OpenBSD__) | 56 | char *DES_crypt(const char *buf, const char *salt) |
58 | char *des_crypt(const char *buf,const char *salt); | ||
59 | #else | ||
60 | char *crypt(const char *buf,const char *salt); | ||
61 | #endif | ||
62 | #else | ||
63 | void fcrypt_body(); | ||
64 | #ifdef PERL5 | ||
65 | char *des_crypt(); | ||
66 | #else | ||
67 | char *crypt(); | ||
68 | #endif | ||
69 | #endif | ||
70 | |||
71 | #if defined(PERL5) || defined(FreeBSD) || defined(__OpenBSD__) | ||
72 | char *des_crypt(buf,salt) | ||
73 | #else | ||
74 | char *crypt(buf,salt) | ||
75 | #endif | ||
76 | const char *buf; | ||
77 | const char *salt; | ||
78 | { | 57 | { |
79 | static char buff[14]; | 58 | static char buff[14]; |
80 | 59 | ||
81 | return(des_fcrypt(buf,salt,buff)); | 60 | #ifndef CHARSET_EBCDIC |
61 | return(DES_fcrypt(buf,salt,buff)); | ||
62 | #else | ||
63 | char e_salt[2+1]; | ||
64 | char e_buf[32+1]; /* replace 32 by 8 ? */ | ||
65 | char *ret; | ||
66 | |||
67 | /* Copy at most 2 chars of salt */ | ||
68 | if ((e_salt[0] = salt[0]) != '\0') | ||
69 | e_salt[1] = salt[1]; | ||
70 | |||
71 | /* Copy at most 32 chars of password */ | ||
72 | strncpy (e_buf, buf, sizeof(e_buf)); | ||
73 | |||
74 | /* Make sure we have a delimiter */ | ||
75 | e_salt[sizeof(e_salt)-1] = e_buf[sizeof(e_buf)-1] = '\0'; | ||
76 | |||
77 | /* Convert the e_salt to ASCII, as that's what DES_fcrypt works on */ | ||
78 | ebcdic2ascii(e_salt, e_salt, sizeof e_salt); | ||
79 | |||
80 | /* Convert the cleartext password to ASCII */ | ||
81 | ebcdic2ascii(e_buf, e_buf, sizeof e_buf); | ||
82 | |||
83 | /* Encrypt it (from/to ASCII) */ | ||
84 | ret = DES_fcrypt(e_buf,e_salt,buff); | ||
85 | |||
86 | /* Convert the result back to EBCDIC */ | ||
87 | ascii2ebcdic(ret, ret, strlen(ret)); | ||
88 | |||
89 | return ret; | ||
90 | #endif | ||
82 | } | 91 | } |
83 | 92 | ||
84 | 93 | ||
85 | char *des_fcrypt(buf,salt,ret) | 94 | |
86 | const char *buf; | 95 | char *DES_fcrypt(const char *buf, const char *salt, char *ret) |
87 | const char *salt; | ||
88 | char *ret; | ||
89 | { | 96 | { |
90 | unsigned int i,j,x,y; | 97 | unsigned int i,j,x,y; |
91 | DES_LONG Eswap0,Eswap1; | 98 | DES_LONG Eswap0,Eswap1; |
92 | DES_LONG out[2],ll; | 99 | DES_LONG out[2],ll; |
93 | des_cblock key; | 100 | DES_cblock key; |
94 | des_key_schedule ks; | 101 | DES_key_schedule ks; |
95 | unsigned char bb[9]; | 102 | unsigned char bb[9]; |
96 | unsigned char *b=bb; | 103 | unsigned char *b=bb; |
97 | unsigned char c,u; | 104 | unsigned char c,u; |
@@ -104,10 +111,17 @@ char *ret; | |||
104 | * crypt to "*". This was found when replacing the crypt in | 111 | * crypt to "*". This was found when replacing the crypt in |
105 | * our shared libraries. People found that the disabled | 112 | * our shared libraries. People found that the disabled |
106 | * accounts effectively had no passwd :-(. */ | 113 | * accounts effectively had no passwd :-(. */ |
114 | #ifndef CHARSET_EBCDIC | ||
107 | x=ret[0]=((salt[0] == '\0')?'A':salt[0]); | 115 | x=ret[0]=((salt[0] == '\0')?'A':salt[0]); |
108 | Eswap0=con_salt[x]<<2; | 116 | Eswap0=con_salt[x]<<2; |
109 | x=ret[1]=((salt[1] == '\0')?'A':salt[1]); | 117 | x=ret[1]=((salt[1] == '\0')?'A':salt[1]); |
110 | Eswap1=con_salt[x]<<6; | 118 | Eswap1=con_salt[x]<<6; |
119 | #else | ||
120 | x=ret[0]=((salt[0] == '\0')?os_toascii['A']:salt[0]); | ||
121 | Eswap0=con_salt[x]<<2; | ||
122 | x=ret[1]=((salt[1] == '\0')?os_toascii['A']:salt[1]); | ||
123 | Eswap1=con_salt[x]<<6; | ||
124 | #endif | ||
111 | 125 | ||
112 | /* EAY | 126 | /* EAY |
113 | r=strlen(buf); | 127 | r=strlen(buf); |
@@ -122,8 +136,8 @@ r=(r+7)/8; | |||
122 | for (; i<8; i++) | 136 | for (; i<8; i++) |
123 | key[i]=0; | 137 | key[i]=0; |
124 | 138 | ||
125 | des_set_key_unchecked(&key,ks); | 139 | DES_set_key_unchecked(&key,&ks); |
126 | fcrypt_body(&(out[0]),ks,Eswap0,Eswap1); | 140 | fcrypt_body(&(out[0]),&ks,Eswap0,Eswap1); |
127 | 141 | ||
128 | ll=out[0]; l2c(ll,b); | 142 | ll=out[0]; l2c(ll,b); |
129 | ll=out[1]; l2c(ll,b); | 143 | ll=out[1]; l2c(ll,b); |
@@ -149,4 +163,3 @@ r=(r+7)/8; | |||
149 | ret[13]='\0'; | 163 | ret[13]='\0'; |
150 | return(ret); | 164 | return(ret); |
151 | } | 165 | } |
152 | |||
diff --git a/src/lib/libcrypto/des/fcrypt_b.c b/src/lib/libcrypto/des/fcrypt_b.c index 22c87f5983..1390138787 100644 --- a/src/lib/libcrypto/des/fcrypt_b.c +++ b/src/lib/libcrypto/des/fcrypt_b.c | |||
@@ -77,12 +77,12 @@ | |||
77 | #define HPERM_OP(a,t,n,m) ((t)=((((a)<<(16-(n)))^(a))&(m)),\ | 77 | #define HPERM_OP(a,t,n,m) ((t)=((((a)<<(16-(n)))^(a))&(m)),\ |
78 | (a)=(a)^(t)^(t>>(16-(n))))\ | 78 | (a)=(a)^(t)^(t>>(16-(n))))\ |
79 | 79 | ||
80 | void fcrypt_body(DES_LONG *out, des_key_schedule ks, DES_LONG Eswap0, | 80 | void fcrypt_body(DES_LONG *out, DES_key_schedule *ks, DES_LONG Eswap0, |
81 | DES_LONG Eswap1) | 81 | DES_LONG Eswap1) |
82 | { | 82 | { |
83 | register DES_LONG l,r,t,u; | 83 | register DES_LONG l,r,t,u; |
84 | #ifdef DES_PTR | 84 | #ifdef DES_PTR |
85 | register const unsigned char *des_SP=(const unsigned char *)des_SPtrans; | 85 | register const unsigned char *des_SP=(const unsigned char *)DES_SPtrans; |
86 | #endif | 86 | #endif |
87 | register DES_LONG *s; | 87 | register DES_LONG *s; |
88 | register int j; | 88 | register int j; |
diff --git a/src/lib/libcrypto/des/ncbc_enc.c b/src/lib/libcrypto/des/ncbc_enc.c index b8db07b199..fda23d522f 100644 --- a/src/lib/libcrypto/des/ncbc_enc.c +++ b/src/lib/libcrypto/des/ncbc_enc.c | |||
@@ -1,8 +1,8 @@ | |||
1 | /* crypto/des/ncbc_enc.c */ | 1 | /* crypto/des/ncbc_enc.c */ |
2 | /* | 2 | /* |
3 | * #included by: | 3 | * #included by: |
4 | * cbc_enc.c (des_cbc_encrypt) | 4 | * cbc_enc.c (DES_cbc_encrypt) |
5 | * des_enc.c (des_ncbc_encrypt) | 5 | * des_enc.c (DES_ncbc_encrypt) |
6 | */ | 6 | */ |
7 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 7 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
8 | * All rights reserved. | 8 | * All rights reserved. |
@@ -64,11 +64,11 @@ | |||
64 | #include "des_locl.h" | 64 | #include "des_locl.h" |
65 | 65 | ||
66 | #ifdef CBC_ENC_C__DONT_UPDATE_IV | 66 | #ifdef CBC_ENC_C__DONT_UPDATE_IV |
67 | void des_cbc_encrypt(const unsigned char *in, unsigned char *out, long length, | 67 | void DES_cbc_encrypt(const unsigned char *in, unsigned char *out, long length, |
68 | des_key_schedule schedule, des_cblock *ivec, int enc) | 68 | DES_key_schedule *_schedule, DES_cblock *ivec, int enc) |
69 | #else | 69 | #else |
70 | void des_ncbc_encrypt(const unsigned char *in, unsigned char *out, long length, | 70 | void DES_ncbc_encrypt(const unsigned char *in, unsigned char *out, long length, |
71 | des_key_schedule schedule, des_cblock *ivec, int enc) | 71 | DES_key_schedule *_schedule, DES_cblock *ivec, int enc) |
72 | #endif | 72 | #endif |
73 | { | 73 | { |
74 | register DES_LONG tin0,tin1; | 74 | register DES_LONG tin0,tin1; |
@@ -89,7 +89,7 @@ void des_ncbc_encrypt(const unsigned char *in, unsigned char *out, long length, | |||
89 | c2l(in,tin1); | 89 | c2l(in,tin1); |
90 | tin0^=tout0; tin[0]=tin0; | 90 | tin0^=tout0; tin[0]=tin0; |
91 | tin1^=tout1; tin[1]=tin1; | 91 | tin1^=tout1; tin[1]=tin1; |
92 | des_encrypt1((DES_LONG *)tin,schedule,DES_ENCRYPT); | 92 | DES_encrypt1((DES_LONG *)tin,_schedule,DES_ENCRYPT); |
93 | tout0=tin[0]; l2c(tout0,out); | 93 | tout0=tin[0]; l2c(tout0,out); |
94 | tout1=tin[1]; l2c(tout1,out); | 94 | tout1=tin[1]; l2c(tout1,out); |
95 | } | 95 | } |
@@ -98,7 +98,7 @@ void des_ncbc_encrypt(const unsigned char *in, unsigned char *out, long length, | |||
98 | c2ln(in,tin0,tin1,l+8); | 98 | c2ln(in,tin0,tin1,l+8); |
99 | tin0^=tout0; tin[0]=tin0; | 99 | tin0^=tout0; tin[0]=tin0; |
100 | tin1^=tout1; tin[1]=tin1; | 100 | tin1^=tout1; tin[1]=tin1; |
101 | des_encrypt1((DES_LONG *)tin,schedule,DES_ENCRYPT); | 101 | DES_encrypt1((DES_LONG *)tin,_schedule,DES_ENCRYPT); |
102 | tout0=tin[0]; l2c(tout0,out); | 102 | tout0=tin[0]; l2c(tout0,out); |
103 | tout1=tin[1]; l2c(tout1,out); | 103 | tout1=tin[1]; l2c(tout1,out); |
104 | } | 104 | } |
@@ -116,7 +116,7 @@ void des_ncbc_encrypt(const unsigned char *in, unsigned char *out, long length, | |||
116 | { | 116 | { |
117 | c2l(in,tin0); tin[0]=tin0; | 117 | c2l(in,tin0); tin[0]=tin0; |
118 | c2l(in,tin1); tin[1]=tin1; | 118 | c2l(in,tin1); tin[1]=tin1; |
119 | des_encrypt1((DES_LONG *)tin,schedule,DES_DECRYPT); | 119 | DES_encrypt1((DES_LONG *)tin,_schedule,DES_DECRYPT); |
120 | tout0=tin[0]^xor0; | 120 | tout0=tin[0]^xor0; |
121 | tout1=tin[1]^xor1; | 121 | tout1=tin[1]^xor1; |
122 | l2c(tout0,out); | 122 | l2c(tout0,out); |
@@ -128,7 +128,7 @@ void des_ncbc_encrypt(const unsigned char *in, unsigned char *out, long length, | |||
128 | { | 128 | { |
129 | c2l(in,tin0); tin[0]=tin0; | 129 | c2l(in,tin0); tin[0]=tin0; |
130 | c2l(in,tin1); tin[1]=tin1; | 130 | c2l(in,tin1); tin[1]=tin1; |
131 | des_encrypt1((DES_LONG *)tin,schedule,DES_DECRYPT); | 131 | DES_encrypt1((DES_LONG *)tin,_schedule,DES_DECRYPT); |
132 | tout0=tin[0]^xor0; | 132 | tout0=tin[0]^xor0; |
133 | tout1=tin[1]^xor1; | 133 | tout1=tin[1]^xor1; |
134 | l2cn(tout0,tout1,out,l+8); | 134 | l2cn(tout0,tout1,out,l+8); |
diff --git a/src/lib/libcrypto/des/ofb64ede.c b/src/lib/libcrypto/des/ofb64ede.c index 6eafe908da..26bbf9a6a7 100644 --- a/src/lib/libcrypto/des/ofb64ede.c +++ b/src/lib/libcrypto/des/ofb64ede.c | |||
@@ -62,15 +62,16 @@ | |||
62 | * used. The extra state information to record how much of the | 62 | * used. The extra state information to record how much of the |
63 | * 64bit block we have used is contained in *num; | 63 | * 64bit block we have used is contained in *num; |
64 | */ | 64 | */ |
65 | void des_ede3_ofb64_encrypt(register const unsigned char *in, | 65 | void DES_ede3_ofb64_encrypt(register const unsigned char *in, |
66 | register unsigned char *out, long length, des_key_schedule k1, | 66 | register unsigned char *out, long length, |
67 | des_key_schedule k2, des_key_schedule k3, des_cblock *ivec, | 67 | DES_key_schedule *k1, DES_key_schedule *k2, |
68 | int *num) | 68 | DES_key_schedule *k3, DES_cblock *ivec, |
69 | int *num) | ||
69 | { | 70 | { |
70 | register DES_LONG v0,v1; | 71 | register DES_LONG v0,v1; |
71 | register int n= *num; | 72 | register int n= *num; |
72 | register long l=length; | 73 | register long l=length; |
73 | des_cblock d; | 74 | DES_cblock d; |
74 | register char *dp; | 75 | register char *dp; |
75 | DES_LONG ti[2]; | 76 | DES_LONG ti[2]; |
76 | unsigned char *iv; | 77 | unsigned char *iv; |
@@ -90,7 +91,7 @@ void des_ede3_ofb64_encrypt(register const unsigned char *in, | |||
90 | { | 91 | { |
91 | /* ti[0]=v0; */ | 92 | /* ti[0]=v0; */ |
92 | /* ti[1]=v1; */ | 93 | /* ti[1]=v1; */ |
93 | des_encrypt3(ti,k1,k2,k3); | 94 | DES_encrypt3(ti,k1,k2,k3); |
94 | v0=ti[0]; | 95 | v0=ti[0]; |
95 | v1=ti[1]; | 96 | v1=ti[1]; |
96 | 97 | ||
@@ -115,10 +116,10 @@ void des_ede3_ofb64_encrypt(register const unsigned char *in, | |||
115 | } | 116 | } |
116 | 117 | ||
117 | #ifdef undef /* MACRO */ | 118 | #ifdef undef /* MACRO */ |
118 | void des_ede2_ofb64_encrypt(register unsigned char *in, | 119 | void DES_ede2_ofb64_encrypt(register unsigned char *in, |
119 | register unsigned char *out, long length, des_key_schedule k1, | 120 | register unsigned char *out, long length, DES_key_schedule k1, |
120 | des_key_schedule k2, des_cblock (*ivec), int *num) | 121 | DES_key_schedule k2, DES_cblock (*ivec), int *num) |
121 | { | 122 | { |
122 | des_ede3_ofb64_encrypt(in, out, length, k1,k2,k1, ivec, num); | 123 | DES_ede3_ofb64_encrypt(in, out, length, k1,k2,k1, ivec, num); |
123 | } | 124 | } |
124 | #endif | 125 | #endif |
diff --git a/src/lib/libcrypto/des/ofb64enc.c b/src/lib/libcrypto/des/ofb64enc.c index 1a1d1f1ac4..8ca3d49dea 100644 --- a/src/lib/libcrypto/des/ofb64enc.c +++ b/src/lib/libcrypto/des/ofb64enc.c | |||
@@ -62,14 +62,14 @@ | |||
62 | * used. The extra state information to record how much of the | 62 | * used. The extra state information to record how much of the |
63 | * 64bit block we have used is contained in *num; | 63 | * 64bit block we have used is contained in *num; |
64 | */ | 64 | */ |
65 | void des_ofb64_encrypt(register const unsigned char *in, | 65 | void DES_ofb64_encrypt(register const unsigned char *in, |
66 | register unsigned char *out, long length, des_key_schedule schedule, | 66 | register unsigned char *out, long length, |
67 | des_cblock *ivec, int *num) | 67 | DES_key_schedule *schedule, DES_cblock *ivec, int *num) |
68 | { | 68 | { |
69 | register DES_LONG v0,v1,t; | 69 | register DES_LONG v0,v1,t; |
70 | register int n= *num; | 70 | register int n= *num; |
71 | register long l=length; | 71 | register long l=length; |
72 | des_cblock d; | 72 | DES_cblock d; |
73 | register unsigned char *dp; | 73 | register unsigned char *dp; |
74 | DES_LONG ti[2]; | 74 | DES_LONG ti[2]; |
75 | unsigned char *iv; | 75 | unsigned char *iv; |
@@ -87,7 +87,7 @@ void des_ofb64_encrypt(register const unsigned char *in, | |||
87 | { | 87 | { |
88 | if (n == 0) | 88 | if (n == 0) |
89 | { | 89 | { |
90 | des_encrypt1(ti,schedule,DES_ENCRYPT); | 90 | DES_encrypt1(ti,schedule,DES_ENCRYPT); |
91 | dp=d; | 91 | dp=d; |
92 | t=ti[0]; l2c(t,dp); | 92 | t=ti[0]; l2c(t,dp); |
93 | t=ti[1]; l2c(t,dp); | 93 | t=ti[1]; l2c(t,dp); |
diff --git a/src/lib/libcrypto/des/ofb_enc.c b/src/lib/libcrypto/des/ofb_enc.c index 70493e632c..e887a3c6f4 100644 --- a/src/lib/libcrypto/des/ofb_enc.c +++ b/src/lib/libcrypto/des/ofb_enc.c | |||
@@ -64,8 +64,9 @@ | |||
64 | * the second. The second 12 bits will come from the 3rd and half the 4th | 64 | * the second. The second 12 bits will come from the 3rd and half the 4th |
65 | * byte. | 65 | * byte. |
66 | */ | 66 | */ |
67 | void des_ofb_encrypt(const unsigned char *in, unsigned char *out, int numbits, | 67 | void DES_ofb_encrypt(const unsigned char *in, unsigned char *out, int numbits, |
68 | long length, des_key_schedule schedule, des_cblock *ivec) | 68 | long length, DES_key_schedule *schedule, |
69 | DES_cblock *ivec) | ||
69 | { | 70 | { |
70 | register DES_LONG d0,d1,vv0,vv1,v0,v1,n=(numbits+7)/8; | 71 | register DES_LONG d0,d1,vv0,vv1,v0,v1,n=(numbits+7)/8; |
71 | register DES_LONG mask0,mask1; | 72 | register DES_LONG mask0,mask1; |
@@ -101,7 +102,7 @@ void des_ofb_encrypt(const unsigned char *in, unsigned char *out, int numbits, | |||
101 | { | 102 | { |
102 | ti[0]=v0; | 103 | ti[0]=v0; |
103 | ti[1]=v1; | 104 | ti[1]=v1; |
104 | des_encrypt1((DES_LONG *)ti,schedule,DES_ENCRYPT); | 105 | DES_encrypt1((DES_LONG *)ti,schedule,DES_ENCRYPT); |
105 | vv0=ti[0]; | 106 | vv0=ti[0]; |
106 | vv1=ti[1]; | 107 | vv1=ti[1]; |
107 | c2ln(in,d0,d1,n); | 108 | c2ln(in,d0,d1,n); |
diff --git a/src/lib/libcrypto/des/pcbc_enc.c b/src/lib/libcrypto/des/pcbc_enc.c index 5b987f074d..17a40f9520 100644 --- a/src/lib/libcrypto/des/pcbc_enc.c +++ b/src/lib/libcrypto/des/pcbc_enc.c | |||
@@ -58,8 +58,9 @@ | |||
58 | 58 | ||
59 | #include "des_locl.h" | 59 | #include "des_locl.h" |
60 | 60 | ||
61 | void des_pcbc_encrypt(const unsigned char *input, unsigned char *output, | 61 | void DES_pcbc_encrypt(const unsigned char *input, unsigned char *output, |
62 | long length, des_key_schedule schedule, des_cblock *ivec, int enc) | 62 | long length, DES_key_schedule *schedule, |
63 | DES_cblock *ivec, int enc) | ||
63 | { | 64 | { |
64 | register DES_LONG sin0,sin1,xor0,xor1,tout0,tout1; | 65 | register DES_LONG sin0,sin1,xor0,xor1,tout0,tout1; |
65 | DES_LONG tin[2]; | 66 | DES_LONG tin[2]; |
@@ -85,7 +86,7 @@ void des_pcbc_encrypt(const unsigned char *input, unsigned char *output, | |||
85 | c2ln(in,sin0,sin1,length); | 86 | c2ln(in,sin0,sin1,length); |
86 | tin[0]=sin0^xor0; | 87 | tin[0]=sin0^xor0; |
87 | tin[1]=sin1^xor1; | 88 | tin[1]=sin1^xor1; |
88 | des_encrypt1((DES_LONG *)tin,schedule,DES_ENCRYPT); | 89 | DES_encrypt1((DES_LONG *)tin,schedule,DES_ENCRYPT); |
89 | tout0=tin[0]; | 90 | tout0=tin[0]; |
90 | tout1=tin[1]; | 91 | tout1=tin[1]; |
91 | xor0=sin0^tout0; | 92 | xor0=sin0^tout0; |
@@ -103,7 +104,7 @@ void des_pcbc_encrypt(const unsigned char *input, unsigned char *output, | |||
103 | c2l(in,sin1); | 104 | c2l(in,sin1); |
104 | tin[0]=sin0; | 105 | tin[0]=sin0; |
105 | tin[1]=sin1; | 106 | tin[1]=sin1; |
106 | des_encrypt1((DES_LONG *)tin,schedule,DES_DECRYPT); | 107 | DES_encrypt1((DES_LONG *)tin,schedule,DES_DECRYPT); |
107 | tout0=tin[0]^xor0; | 108 | tout0=tin[0]^xor0; |
108 | tout1=tin[1]^xor1; | 109 | tout1=tin[1]^xor1; |
109 | if (length >= 8) | 110 | if (length >= 8) |
diff --git a/src/lib/libcrypto/des/qud_cksm.c b/src/lib/libcrypto/des/qud_cksm.c index 9fff989edb..dac201227e 100644 --- a/src/lib/libcrypto/des/qud_cksm.c +++ b/src/lib/libcrypto/des/qud_cksm.c | |||
@@ -73,8 +73,8 @@ | |||
73 | /* Got the value MIT uses via brute force :-) 2/10/90 eay */ | 73 | /* Got the value MIT uses via brute force :-) 2/10/90 eay */ |
74 | #define NOISE ((DES_LONG)83653421L) | 74 | #define NOISE ((DES_LONG)83653421L) |
75 | 75 | ||
76 | DES_LONG des_quad_cksum(const unsigned char *input, des_cblock output[], | 76 | DES_LONG DES_quad_cksum(const unsigned char *input, DES_cblock output[], |
77 | long length, int out_count, des_cblock *seed) | 77 | long length, int out_count, DES_cblock *seed) |
78 | { | 78 | { |
79 | DES_LONG z0,z1,t0,t1; | 79 | DES_LONG z0,z1,t0,t1; |
80 | int i; | 80 | int i; |
diff --git a/src/lib/libcrypto/des/rand_key.c b/src/lib/libcrypto/des/rand_key.c index ee1a6c274e..2398165568 100644 --- a/src/lib/libcrypto/des/rand_key.c +++ b/src/lib/libcrypto/des/rand_key.c | |||
@@ -56,18 +56,13 @@ | |||
56 | #include <openssl/des.h> | 56 | #include <openssl/des.h> |
57 | #include <openssl/rand.h> | 57 | #include <openssl/rand.h> |
58 | 58 | ||
59 | void des_random_seed(des_cblock *key) | 59 | int DES_random_key(DES_cblock *ret) |
60 | { | ||
61 | RAND_seed(key, sizeof(des_cblock)); | ||
62 | } | ||
63 | |||
64 | int des_random_key(des_cblock *ret) | ||
65 | { | 60 | { |
66 | do | 61 | do |
67 | { | 62 | { |
68 | if (RAND_bytes((unsigned char *)ret, sizeof(des_cblock)) != 1) | 63 | if (RAND_bytes((unsigned char *)ret, sizeof(DES_cblock)) != 1) |
69 | return (0); | 64 | return (0); |
70 | } while (des_is_weak_key(ret)); | 65 | } while (DES_is_weak_key(ret)); |
71 | des_set_odd_parity(ret); | 66 | DES_set_odd_parity(ret); |
72 | return (1); | 67 | return (1); |
73 | } | 68 | } |
diff --git a/src/lib/libcrypto/des/read2pwd.c b/src/lib/libcrypto/des/read2pwd.c index a8ceaf088a..b4720c3a98 100644 --- a/src/lib/libcrypto/des/read2pwd.c +++ b/src/lib/libcrypto/des/read2pwd.c | |||
@@ -1,4 +1,57 @@ | |||
1 | /* crypto/des/read2pwd.c */ | 1 | /* crypto/des/read2pwd.c */ |
2 | /* ==================================================================== | ||
3 | * Copyright (c) 2001-2002 The OpenSSL Project. All rights reserved. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions | ||
7 | * are met: | ||
8 | * | ||
9 | * 1. Redistributions of source code must retain the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer. | ||
11 | * | ||
12 | * 2. Redistributions in binary form must reproduce the above copyright | ||
13 | * notice, this list of conditions and the following disclaimer in | ||
14 | * the documentation and/or other materials provided with the | ||
15 | * distribution. | ||
16 | * | ||
17 | * 3. All advertising materials mentioning features or use of this | ||
18 | * software must display the following acknowledgment: | ||
19 | * "This product includes software developed by the OpenSSL Project | ||
20 | * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" | ||
21 | * | ||
22 | * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to | ||
23 | * endorse or promote products derived from this software without | ||
24 | * prior written permission. For written permission, please contact | ||
25 | * openssl-core@openssl.org. | ||
26 | * | ||
27 | * 5. Products derived from this software may not be called "OpenSSL" | ||
28 | * nor may "OpenSSL" appear in their names without prior written | ||
29 | * permission of the OpenSSL Project. | ||
30 | * | ||
31 | * 6. Redistributions of any form whatsoever must retain the following | ||
32 | * acknowledgment: | ||
33 | * "This product includes software developed by the OpenSSL Project | ||
34 | * for use in the OpenSSL Toolkit (http://www.openssl.org/)" | ||
35 | * | ||
36 | * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY | ||
37 | * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
38 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
39 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR | ||
40 | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
41 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
42 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
43 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
44 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
45 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
46 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | ||
47 | * OF THE POSSIBILITY OF SUCH DAMAGE. | ||
48 | * ==================================================================== | ||
49 | * | ||
50 | * This product includes cryptographic software written by Eric Young | ||
51 | * (eay@cryptsoft.com). This product includes software written by Tim | ||
52 | * Hudson (tjh@cryptsoft.com). | ||
53 | * | ||
54 | */ | ||
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 55 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
3 | * All rights reserved. | 56 | * All rights reserved. |
4 | * | 57 | * |
@@ -56,28 +109,30 @@ | |||
56 | * [including the GNU Public Licence.] | 109 | * [including the GNU Public Licence.] |
57 | */ | 110 | */ |
58 | 111 | ||
59 | #include "des_locl.h" | 112 | #include <string.h> |
113 | #include <openssl/des.h> | ||
114 | #include <openssl/ui.h> | ||
60 | 115 | ||
61 | int des_read_password(des_cblock *key, const char *prompt, int verify) | 116 | int DES_read_password(DES_cblock *key, const char *prompt, int verify) |
62 | { | 117 | { |
63 | int ok; | 118 | int ok; |
64 | char buf[BUFSIZ],buff[BUFSIZ]; | 119 | char buf[BUFSIZ],buff[BUFSIZ]; |
65 | 120 | ||
66 | if ((ok=des_read_pw(buf,buff,BUFSIZ,prompt,verify)) == 0) | 121 | if ((ok=UI_UTIL_read_pw(buf,buff,BUFSIZ,prompt,verify)) == 0) |
67 | des_string_to_key(buf,key); | 122 | DES_string_to_key(buf,key); |
68 | memset(buf,0,BUFSIZ); | 123 | memset(buf,0,BUFSIZ); |
69 | memset(buff,0,BUFSIZ); | 124 | memset(buff,0,BUFSIZ); |
70 | return(ok); | 125 | return(ok); |
71 | } | 126 | } |
72 | 127 | ||
73 | int des_read_2passwords(des_cblock *key1, des_cblock *key2, const char *prompt, | 128 | int DES_read_2passwords(DES_cblock *key1, DES_cblock *key2, const char *prompt, |
74 | int verify) | 129 | int verify) |
75 | { | 130 | { |
76 | int ok; | 131 | int ok; |
77 | char buf[BUFSIZ],buff[BUFSIZ]; | 132 | char buf[BUFSIZ],buff[BUFSIZ]; |
78 | 133 | ||
79 | if ((ok=des_read_pw(buf,buff,BUFSIZ,prompt,verify)) == 0) | 134 | if ((ok=UI_UTIL_read_pw(buf,buff,BUFSIZ,prompt,verify)) == 0) |
80 | des_string_to_2keys(buf,key1,key2); | 135 | DES_string_to_2keys(buf,key1,key2); |
81 | memset(buf,0,BUFSIZ); | 136 | memset(buf,0,BUFSIZ); |
82 | memset(buff,0,BUFSIZ); | 137 | memset(buff,0,BUFSIZ); |
83 | return(ok); | 138 | return(ok); |
diff --git a/src/lib/libcrypto/des/read_pwd.c b/src/lib/libcrypto/des/read_pwd.c index c27ec336e7..ae9aef620b 100644 --- a/src/lib/libcrypto/des/read_pwd.c +++ b/src/lib/libcrypto/des/read_pwd.c | |||
@@ -56,8 +56,8 @@ | |||
56 | * [including the GNU Public Licence.] | 56 | * [including the GNU Public Licence.] |
57 | */ | 57 | */ |
58 | 58 | ||
59 | #if !defined(MSDOS) && !defined(VMS) && !defined(WIN32) | 59 | #include <openssl/e_os2.h> |
60 | #include <openssl/opensslconf.h> | 60 | #if !defined(OPENSSL_SYS_MSDOS) && !defined(OPENSSL_SYS_VMS) && !defined(OPENSSL_SYS_WIN32) |
61 | #ifdef OPENSSL_UNISTD | 61 | #ifdef OPENSSL_UNISTD |
62 | # include OPENSSL_UNISTD | 62 | # include OPENSSL_UNISTD |
63 | #else | 63 | #else |
@@ -78,7 +78,7 @@ | |||
78 | /* #define SIGACTION */ /* Define this if you have sigaction() */ | 78 | /* #define SIGACTION */ /* Define this if you have sigaction() */ |
79 | 79 | ||
80 | #ifdef WIN16TTY | 80 | #ifdef WIN16TTY |
81 | #undef WIN16 | 81 | #undef OPENSSL_SYS_WIN16 |
82 | #undef _WINDOWS | 82 | #undef _WINDOWS |
83 | #include <graph.h> | 83 | #include <graph.h> |
84 | #endif | 84 | #endif |
@@ -92,7 +92,7 @@ | |||
92 | #include <setjmp.h> | 92 | #include <setjmp.h> |
93 | #include <errno.h> | 93 | #include <errno.h> |
94 | 94 | ||
95 | #ifdef VMS /* prototypes for sys$whatever */ | 95 | #ifdef OPENSSL_SYS_VMS /* prototypes for sys$whatever */ |
96 | #include <starlet.h> | 96 | #include <starlet.h> |
97 | #ifdef __DECC | 97 | #ifdef __DECC |
98 | #pragma message disable DOLLARID | 98 | #pragma message disable DOLLARID |
@@ -127,12 +127,18 @@ | |||
127 | #undef SGTTY | 127 | #undef SGTTY |
128 | #endif | 128 | #endif |
129 | 129 | ||
130 | #if !defined(TERMIO) && !defined(TERMIOS) && !defined(VMS) && !defined(MSDOS) && !defined(MAC_OS_pre_X) && !defined(MAC_OS_GUSI_SOURCE) | 130 | #if !defined(TERMIO) && !defined(TERMIOS) && !defined(OPENSSL_SYS_VMS) && !defined(OPENSSL_SYS_MSDOS) && !defined(MAC_OS_pre_X) && !defined(MAC_OS_GUSI_SOURCE) |
131 | #undef TERMIOS | 131 | #undef TERMIOS |
132 | #undef TERMIO | 132 | #undef TERMIO |
133 | #define SGTTY | 133 | #define SGTTY |
134 | #endif | 134 | #endif |
135 | 135 | ||
136 | #if defined(OPENSSL_SYS_VSWORKS) | ||
137 | #undef TERMIOS | ||
138 | #undef TERMIO | ||
139 | #undef SGTTY | ||
140 | #endif | ||
141 | |||
136 | #ifdef TERMIOS | 142 | #ifdef TERMIOS |
137 | #include <termios.h> | 143 | #include <termios.h> |
138 | #define TTY_STRUCT struct termios | 144 | #define TTY_STRUCT struct termios |
@@ -157,16 +163,16 @@ | |||
157 | #define TTY_set(tty,data) ioctl(tty,TIOCSETP,data) | 163 | #define TTY_set(tty,data) ioctl(tty,TIOCSETP,data) |
158 | #endif | 164 | #endif |
159 | 165 | ||
160 | #if !defined(_LIBC) && !defined(MSDOS) && !defined(VMS) && !defined(MAC_OS_pre_X) | 166 | #if !defined(_LIBC) && !defined(OPENSSL_SYS_MSDOS) && !defined(OPENSSL_SYS_VMS) && !defined(MAC_OS_pre_X) |
161 | #include <sys/ioctl.h> | 167 | #include <sys/ioctl.h> |
162 | #endif | 168 | #endif |
163 | 169 | ||
164 | #if defined(MSDOS) && !defined(__CYGWIN32__) | 170 | #if defined(OPENSSL_SYS_MSDOS) && !defined(__CYGWIN32__) |
165 | #include <conio.h> | 171 | #include <conio.h> |
166 | #define fgets(a,b,c) noecho_fgets(a,b,c) | 172 | #define fgets(a,b,c) noecho_fgets(a,b,c) |
167 | #endif | 173 | #endif |
168 | 174 | ||
169 | #ifdef VMS | 175 | #ifdef OPENSSL_SYS_VMS |
170 | #include <ssdef.h> | 176 | #include <ssdef.h> |
171 | #include <iodef.h> | 177 | #include <iodef.h> |
172 | #include <ttdef.h> | 178 | #include <ttdef.h> |
@@ -195,17 +201,17 @@ static void read_till_nl(FILE *); | |||
195 | static void recsig(int); | 201 | static void recsig(int); |
196 | static void pushsig(void); | 202 | static void pushsig(void); |
197 | static void popsig(void); | 203 | static void popsig(void); |
198 | #if defined(MSDOS) && !defined(WIN16) | 204 | #if defined(OPENSSL_SYS_MSDOS) && !defined(OPENSSL_SYS_WIN16) |
199 | static int noecho_fgets(char *buf, int size, FILE *tty); | 205 | static int noecho_fgets(char *buf, int size, FILE *tty); |
200 | #endif | 206 | #endif |
201 | #ifdef SIGACTION | 207 | #ifdef SIGACTION |
202 | static struct sigaction savsig[NX509_SIG]; | 208 | static struct sigaction savsig[NX509_SIG]; |
203 | #else | 209 | #else |
204 | static void (*savsig[NX509_SIG])(int ); | 210 | static void (*savsig[NX509_SIG])(int ); |
205 | #endif | 211 | #endif |
206 | static jmp_buf save; | 212 | static jmp_buf save; |
207 | 213 | ||
208 | int des_read_pw_string(char *buf, int length, const char *prompt, | 214 | int _ossl_old_des_read_pw_string(char *buf, int length, const char *prompt, |
209 | int verify) | 215 | int verify) |
210 | { | 216 | { |
211 | char buff[BUFSIZ]; | 217 | char buff[BUFSIZ]; |
@@ -216,7 +222,7 @@ int des_read_pw_string(char *buf, int length, const char *prompt, | |||
216 | return(ret); | 222 | return(ret); |
217 | } | 223 | } |
218 | 224 | ||
219 | #ifndef WIN16 | 225 | #ifndef OPENSSL_SYS_WIN16 |
220 | 226 | ||
221 | static void read_till_nl(FILE *in) | 227 | static void read_till_nl(FILE *in) |
222 | { | 228 | { |
@@ -233,14 +239,14 @@ static void read_till_nl(FILE *in) | |||
233 | int des_read_pw(char *buf, char *buff, int size, const char *prompt, | 239 | int des_read_pw(char *buf, char *buff, int size, const char *prompt, |
234 | int verify) | 240 | int verify) |
235 | { | 241 | { |
236 | #ifdef VMS | 242 | #ifdef OPENSSL_SYS_VMS |
237 | struct IOSB iosb; | 243 | struct IOSB iosb; |
238 | $DESCRIPTOR(terminal,"TT"); | 244 | $DESCRIPTOR(terminal,"TT"); |
239 | long tty_orig[3], tty_new[3]; | 245 | long tty_orig[3], tty_new[3]; |
240 | long status; | 246 | long status; |
241 | unsigned short channel = 0; | 247 | unsigned short channel = 0; |
242 | #else | 248 | #else |
243 | #ifndef MSDOS | 249 | #ifndef OPENSSL_SYS_MSDOS |
244 | TTY_STRUCT tty_orig,tty_new; | 250 | TTY_STRUCT tty_orig,tty_new; |
245 | #endif | 251 | #endif |
246 | #endif | 252 | #endif |
@@ -265,19 +271,19 @@ int des_read_pw(char *buf, char *buff, int size, const char *prompt, | |||
265 | is_a_tty=1; | 271 | is_a_tty=1; |
266 | tty=NULL; | 272 | tty=NULL; |
267 | 273 | ||
268 | #ifdef MSDOS | 274 | #ifdef OPENSSL_SYS_MSDOS |
269 | if ((tty=fopen("con","r")) == NULL) | 275 | if ((tty=fopen("con","r")) == NULL) |
270 | tty=stdin; | 276 | tty=stdin; |
271 | #elif defined(MAC_OS_pre_X) | 277 | #elif defined(MAC_OS_pre_X) || defined(OPENSSL_SYS_VSWORKS) |
272 | tty=stdin; | 278 | tty=stdin; |
273 | #else | 279 | #else |
274 | #ifndef MPE | 280 | #ifndef OPENSSL_SYS_MPE |
275 | if ((tty=fopen("/dev/tty","r")) == NULL) | 281 | if ((tty=fopen("/dev/tty","r")) == NULL) |
276 | #endif | 282 | #endif |
277 | tty=stdin; | 283 | tty=stdin; |
278 | #endif | 284 | #endif |
279 | 285 | ||
280 | #if defined(TTY_get) && !defined(VMS) | 286 | #if defined(TTY_get) && !defined(OPENSSL_SYS_VMS) |
281 | if (TTY_get(fileno(tty),&tty_orig) == -1) | 287 | if (TTY_get(fileno(tty),&tty_orig) == -1) |
282 | { | 288 | { |
283 | #ifdef ENOTTY | 289 | #ifdef ENOTTY |
@@ -296,7 +302,7 @@ int des_read_pw(char *buf, char *buff, int size, const char *prompt, | |||
296 | } | 302 | } |
297 | memcpy(&(tty_new),&(tty_orig),sizeof(tty_orig)); | 303 | memcpy(&(tty_new),&(tty_orig),sizeof(tty_orig)); |
298 | #endif | 304 | #endif |
299 | #ifdef VMS | 305 | #ifdef OPENSSL_SYS_VMS |
300 | status = sys$assign(&terminal,&channel,0,0); | 306 | status = sys$assign(&terminal,&channel,0,0); |
301 | if (status != SS$_NORMAL) | 307 | if (status != SS$_NORMAL) |
302 | return(-1); | 308 | return(-1); |
@@ -312,15 +318,15 @@ int des_read_pw(char *buf, char *buff, int size, const char *prompt, | |||
312 | tty_new.TTY_FLAGS &= ~ECHO; | 318 | tty_new.TTY_FLAGS &= ~ECHO; |
313 | #endif | 319 | #endif |
314 | 320 | ||
315 | #if defined(TTY_set) && !defined(VMS) | 321 | #if defined(TTY_set) && !defined(OPENSSL_SYS_VMS) |
316 | if (is_a_tty && (TTY_set(fileno(tty),&tty_new) == -1)) | 322 | if (is_a_tty && (TTY_set(fileno(tty),&tty_new) == -1)) |
317 | #ifdef MPE | 323 | #ifdef OPENSSL_SYS_MPE |
318 | ; /* MPE lies -- echo really has been disabled */ | 324 | ; /* MPE lies -- echo really has been disabled */ |
319 | #else | 325 | #else |
320 | return(-1); | 326 | return(-1); |
321 | #endif | 327 | #endif |
322 | #endif | 328 | #endif |
323 | #ifdef VMS | 329 | #ifdef OPENSSL_SYS_VMS |
324 | tty_new[0] = tty_orig[0]; | 330 | tty_new[0] = tty_orig[0]; |
325 | tty_new[1] = tty_orig[1] | TT$M_NOECHO; | 331 | tty_new[1] = tty_orig[1] | TT$M_NOECHO; |
326 | tty_new[2] = tty_orig[2]; | 332 | tty_new[2] = tty_orig[2]; |
@@ -366,14 +372,14 @@ int des_read_pw(char *buf, char *buff, int size, const char *prompt, | |||
366 | 372 | ||
367 | error: | 373 | error: |
368 | fprintf(stderr,"\n"); | 374 | fprintf(stderr,"\n"); |
369 | #ifdef DEBUG | 375 | #if 0 |
370 | perror("fgets(tty)"); | 376 | perror("fgets(tty)"); |
371 | #endif | 377 | #endif |
372 | /* What can we do if there is an error? */ | 378 | /* What can we do if there is an error? */ |
373 | #if defined(TTY_set) && !defined(VMS) | 379 | #if defined(TTY_set) && !defined(OPENSSL_SYS_VMS) |
374 | if (ps >= 2) TTY_set(fileno(tty),&tty_orig); | 380 | if (ps >= 2) TTY_set(fileno(tty),&tty_orig); |
375 | #endif | 381 | #endif |
376 | #ifdef VMS | 382 | #ifdef OPENSSL_SYS_VMS |
377 | if (ps >= 2) | 383 | if (ps >= 2) |
378 | status = sys$qiow(0,channel,IO$_SETMODE,&iosb,0,0 | 384 | status = sys$qiow(0,channel,IO$_SETMODE,&iosb,0,0 |
379 | ,tty_orig,12,0,0,0,0); | 385 | ,tty_orig,12,0,0,0,0); |
@@ -381,13 +387,13 @@ error: | |||
381 | 387 | ||
382 | if (ps >= 1) popsig(); | 388 | if (ps >= 1) popsig(); |
383 | if (stdin != tty) fclose(tty); | 389 | if (stdin != tty) fclose(tty); |
384 | #ifdef VMS | 390 | #ifdef OPENSSL_SYS_VMS |
385 | status = sys$dassgn(channel); | 391 | status = sys$dassgn(channel); |
386 | #endif | 392 | #endif |
387 | return(!ok); | 393 | return(!ok); |
388 | } | 394 | } |
389 | 395 | ||
390 | #else /* WIN16 */ | 396 | #else /* OPENSSL_SYS_WIN16 */ |
391 | 397 | ||
392 | int des_read_pw(char *buf, char *buff, int size, char *prompt, int verify) | 398 | int des_read_pw(char *buf, char *buff, int size, char *prompt, int verify) |
393 | { | 399 | { |
@@ -460,7 +466,7 @@ static void recsig(int i) | |||
460 | #endif | 466 | #endif |
461 | } | 467 | } |
462 | 468 | ||
463 | #if defined(MSDOS) && !defined(WIN16) | 469 | #if defined(OPENSSL_SYS_MSDOS) && !defined(OPENSSL_SYS_WIN16) |
464 | static int noecho_fgets(char *buf, int size, FILE *tty) | 470 | static int noecho_fgets(char *buf, int size, FILE *tty) |
465 | { | 471 | { |
466 | int i; | 472 | int i; |
diff --git a/src/lib/libcrypto/des/rpc_enc.c b/src/lib/libcrypto/des/rpc_enc.c index 32d96d5cae..d937d08da5 100644 --- a/src/lib/libcrypto/des/rpc_enc.c +++ b/src/lib/libcrypto/des/rpc_enc.c | |||
@@ -63,20 +63,20 @@ | |||
63 | int _des_crypt(char *buf,int len,struct desparams *desp); | 63 | int _des_crypt(char *buf,int len,struct desparams *desp); |
64 | int _des_crypt(char *buf, int len, struct desparams *desp) | 64 | int _des_crypt(char *buf, int len, struct desparams *desp) |
65 | { | 65 | { |
66 | des_key_schedule ks; | 66 | DES_key_schedule ks; |
67 | int enc; | 67 | int enc; |
68 | 68 | ||
69 | des_set_key_unchecked(&desp->des_key,ks); | 69 | DES_set_key_unchecked(&desp->des_key,&ks); |
70 | enc=(desp->des_dir == ENCRYPT)?DES_ENCRYPT:DES_DECRYPT; | 70 | enc=(desp->des_dir == ENCRYPT)?DES_ENCRYPT:DES_DECRYPT; |
71 | 71 | ||
72 | if (desp->des_mode == CBC) | 72 | if (desp->des_mode == CBC) |
73 | des_ecb_encrypt((const_des_cblock *)desp->UDES.UDES_buf, | 73 | DES_ecb_encrypt((const_DES_cblock *)desp->UDES.UDES_buf, |
74 | (des_cblock *)desp->UDES.UDES_buf,ks, | 74 | (DES_cblock *)desp->UDES.UDES_buf,&ks, |
75 | enc); | 75 | enc); |
76 | else | 76 | else |
77 | { | 77 | { |
78 | des_ncbc_encrypt(desp->UDES.UDES_buf,desp->UDES.UDES_buf, | 78 | DES_ncbc_encrypt(desp->UDES.UDES_buf,desp->UDES.UDES_buf, |
79 | len,ks,&desp->des_ivec,enc); | 79 | len,&ks,&desp->des_ivec,enc); |
80 | #ifdef undef | 80 | #ifdef undef |
81 | /* len will always be %8 if called from common_crypt | 81 | /* len will always be %8 if called from common_crypt |
82 | * in secure_rpc. | 82 | * in secure_rpc. |
diff --git a/src/lib/libcrypto/des/rpw.c b/src/lib/libcrypto/des/rpw.c index 0b6b1519b0..8a9473c4f9 100644 --- a/src/lib/libcrypto/des/rpw.c +++ b/src/lib/libcrypto/des/rpw.c | |||
@@ -61,7 +61,7 @@ | |||
61 | 61 | ||
62 | int main(int argc, char *argv[]) | 62 | int main(int argc, char *argv[]) |
63 | { | 63 | { |
64 | des_cblock k,k1; | 64 | DES_cblock k,k1; |
65 | int i; | 65 | int i; |
66 | 66 | ||
67 | printf("read passwd\n"); | 67 | printf("read passwd\n"); |
diff --git a/src/lib/libcrypto/des/set_key.c b/src/lib/libcrypto/des/set_key.c index 09afd4fc03..683916e71b 100644 --- a/src/lib/libcrypto/des/set_key.c +++ b/src/lib/libcrypto/des/set_key.c | |||
@@ -65,7 +65,7 @@ | |||
65 | */ | 65 | */ |
66 | #include "des_locl.h" | 66 | #include "des_locl.h" |
67 | 67 | ||
68 | OPENSSL_GLOBAL int des_check_key=0; | 68 | OPENSSL_IMPLEMENT_GLOBAL(int,DES_check_key); /* defaults to false */ |
69 | 69 | ||
70 | static const unsigned char odd_parity[256]={ | 70 | static const unsigned char odd_parity[256]={ |
71 | 1, 1, 2, 2, 4, 4, 7, 7, 8, 8, 11, 11, 13, 13, 14, 14, | 71 | 1, 1, 2, 2, 4, 4, 7, 7, 8, 8, 11, 11, 13, 13, 14, 14, |
@@ -85,7 +85,7 @@ static const unsigned char odd_parity[256]={ | |||
85 | 224,224,227,227,229,229,230,230,233,233,234,234,236,236,239,239, | 85 | 224,224,227,227,229,229,230,230,233,233,234,234,236,236,239,239, |
86 | 241,241,242,242,244,244,247,247,248,248,251,251,253,253,254,254}; | 86 | 241,241,242,242,244,244,247,247,248,248,251,251,253,253,254,254}; |
87 | 87 | ||
88 | void des_set_odd_parity(des_cblock *key) | 88 | void DES_set_odd_parity(DES_cblock *key) |
89 | { | 89 | { |
90 | int i; | 90 | int i; |
91 | 91 | ||
@@ -93,7 +93,7 @@ void des_set_odd_parity(des_cblock *key) | |||
93 | (*key)[i]=odd_parity[(*key)[i]]; | 93 | (*key)[i]=odd_parity[(*key)[i]]; |
94 | } | 94 | } |
95 | 95 | ||
96 | int des_check_key_parity(const_des_cblock *key) | 96 | int DES_check_key_parity(const_DES_cblock *key) |
97 | { | 97 | { |
98 | int i; | 98 | int i; |
99 | 99 | ||
@@ -115,7 +115,7 @@ int des_check_key_parity(const_des_cblock *key) | |||
115 | * (and actual cblock values). | 115 | * (and actual cblock values). |
116 | */ | 116 | */ |
117 | #define NUM_WEAK_KEY 16 | 117 | #define NUM_WEAK_KEY 16 |
118 | static des_cblock weak_keys[NUM_WEAK_KEY]={ | 118 | static DES_cblock weak_keys[NUM_WEAK_KEY]={ |
119 | /* weak keys */ | 119 | /* weak keys */ |
120 | {0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01}, | 120 | {0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01}, |
121 | {0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE}, | 121 | {0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE}, |
@@ -135,7 +135,7 @@ static des_cblock weak_keys[NUM_WEAK_KEY]={ | |||
135 | {0xE0,0xFE,0xE0,0xFE,0xF1,0xFE,0xF1,0xFE}, | 135 | {0xE0,0xFE,0xE0,0xFE,0xF1,0xFE,0xF1,0xFE}, |
136 | {0xFE,0xE0,0xFE,0xE0,0xFE,0xF1,0xFE,0xF1}}; | 136 | {0xFE,0xE0,0xFE,0xE0,0xFE,0xF1,0xFE,0xF1}}; |
137 | 137 | ||
138 | int des_is_weak_key(const_des_cblock *key) | 138 | int DES_is_weak_key(const_DES_cblock *key) |
139 | { | 139 | { |
140 | int i; | 140 | int i; |
141 | 141 | ||
@@ -146,7 +146,7 @@ int des_is_weak_key(const_des_cblock *key) | |||
146 | * eay 93/06/29 | 146 | * eay 93/06/29 |
147 | * Another problem, I was comparing only the first 4 | 147 | * Another problem, I was comparing only the first 4 |
148 | * bytes, 97/03/18 */ | 148 | * bytes, 97/03/18 */ |
149 | if (memcmp(weak_keys[i],key,sizeof(des_cblock)) == 0) return(1); | 149 | if (memcmp(weak_keys[i],key,sizeof(DES_cblock)) == 0) return(1); |
150 | return(0); | 150 | return(0); |
151 | } | 151 | } |
152 | 152 | ||
@@ -307,15 +307,15 @@ static const DES_LONG des_skb[8][64]={ | |||
307 | 0x00002822L,0x04002822L,0x00042822L,0x04042822L, | 307 | 0x00002822L,0x04002822L,0x00042822L,0x04042822L, |
308 | }}; | 308 | }}; |
309 | 309 | ||
310 | int des_set_key(const_des_cblock *key, des_key_schedule schedule) | 310 | int DES_set_key(const_DES_cblock *key, DES_key_schedule *schedule) |
311 | { | 311 | { |
312 | if (des_check_key) | 312 | if (DES_check_key) |
313 | { | 313 | { |
314 | return des_set_key_checked(key, schedule); | 314 | return DES_set_key_checked(key, schedule); |
315 | } | 315 | } |
316 | else | 316 | else |
317 | { | 317 | { |
318 | des_set_key_unchecked(key, schedule); | 318 | DES_set_key_unchecked(key, schedule); |
319 | return 0; | 319 | return 0; |
320 | } | 320 | } |
321 | } | 321 | } |
@@ -324,17 +324,17 @@ int des_set_key(const_des_cblock *key, des_key_schedule schedule) | |||
324 | * return -1 if key parity error, | 324 | * return -1 if key parity error, |
325 | * return -2 if illegal weak key. | 325 | * return -2 if illegal weak key. |
326 | */ | 326 | */ |
327 | int des_set_key_checked(const_des_cblock *key, des_key_schedule schedule) | 327 | int DES_set_key_checked(const_DES_cblock *key, DES_key_schedule *schedule) |
328 | { | 328 | { |
329 | if (!des_check_key_parity(key)) | 329 | if (!DES_check_key_parity(key)) |
330 | return(-1); | 330 | return(-1); |
331 | if (des_is_weak_key(key)) | 331 | if (DES_is_weak_key(key)) |
332 | return(-2); | 332 | return(-2); |
333 | des_set_key_unchecked(key, schedule); | 333 | DES_set_key_unchecked(key, schedule); |
334 | return 0; | 334 | return 0; |
335 | } | 335 | } |
336 | 336 | ||
337 | void des_set_key_unchecked(const_des_cblock *key, des_key_schedule schedule) | 337 | void DES_set_key_unchecked(const_DES_cblock *key, DES_key_schedule *schedule) |
338 | { | 338 | { |
339 | static int shifts2[16]={0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,0}; | 339 | static int shifts2[16]={0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,0}; |
340 | register DES_LONG c,d,t,s,t2; | 340 | register DES_LONG c,d,t,s,t2; |
@@ -342,7 +342,11 @@ void des_set_key_unchecked(const_des_cblock *key, des_key_schedule schedule) | |||
342 | register DES_LONG *k; | 342 | register DES_LONG *k; |
343 | register int i; | 343 | register int i; |
344 | 344 | ||
345 | k = &schedule->ks.deslong[0]; | 345 | #if OPENBSD_DEV_CRYPTO |
346 | memcpy(schedule->key,key,sizeof schedule->key); | ||
347 | schedule->session=NULL; | ||
348 | #endif | ||
349 | k = &schedule->ks->deslong[0]; | ||
346 | in = &(*key)[0]; | 350 | in = &(*key)[0]; |
347 | 351 | ||
348 | c2l(in,c); | 352 | c2l(in,c); |
@@ -390,13 +394,14 @@ void des_set_key_unchecked(const_des_cblock *key, des_key_schedule schedule) | |||
390 | } | 394 | } |
391 | } | 395 | } |
392 | 396 | ||
393 | int des_key_sched(const_des_cblock *key, des_key_schedule schedule) | 397 | int DES_key_sched(const_DES_cblock *key, DES_key_schedule *schedule) |
394 | { | 398 | { |
395 | return(des_set_key(key,schedule)); | 399 | return(DES_set_key(key,schedule)); |
396 | } | 400 | } |
397 | 401 | /* | |
398 | #undef des_fixup_key_parity | 402 | #undef des_fixup_key_parity |
399 | void des_fixup_key_parity(des_cblock *key) | 403 | void des_fixup_key_parity(des_cblock *key) |
400 | { | 404 | { |
401 | des_set_odd_parity(key); | 405 | des_set_odd_parity(key); |
402 | } | 406 | } |
407 | */ | ||
diff --git a/src/lib/libcrypto/des/speed.c b/src/lib/libcrypto/des/speed.c index 1223edf290..48fc1d49fc 100644 --- a/src/lib/libcrypto/des/speed.c +++ b/src/lib/libcrypto/des/speed.c | |||
@@ -59,7 +59,7 @@ | |||
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 | #if !defined(MSDOS) && (!defined(VMS) || defined(__DECC)) | 62 | #if !defined(OPENSSL_SYS_MSDOS) && (!defined(OPENSSL_SYS_VMS) || defined(__DECC)) && !defined(OPENSSL_SYS_MACOSX) |
63 | #define TIMES | 63 | #define TIMES |
64 | #endif | 64 | #endif |
65 | 65 | ||
@@ -82,7 +82,7 @@ OPENSSL_DECLARE_EXIT | |||
82 | The __TMS macro will show if it was. If it wasn't defined, we should | 82 | The __TMS macro will show if it was. If it wasn't defined, we should |
83 | undefine TIMES, since that tells the rest of the program how things | 83 | undefine TIMES, since that tells the rest of the program how things |
84 | should be handled. -- Richard Levitte */ | 84 | should be handled. -- Richard Levitte */ |
85 | #if defined(VMS) && defined(__DECC) && !defined(__TMS) | 85 | #if defined(OPENSSL_SYS_VMS_DECC) && !defined(__TMS) |
86 | #undef TIMES | 86 | #undef TIMES |
87 | #endif | 87 | #endif |
88 | 88 | ||
@@ -176,10 +176,10 @@ int main(int argc, char **argv) | |||
176 | { | 176 | { |
177 | long count; | 177 | long count; |
178 | static unsigned char buf[BUFSIZE]; | 178 | static unsigned char buf[BUFSIZE]; |
179 | static des_cblock key ={0x12,0x34,0x56,0x78,0x9a,0xbc,0xde,0xf0}; | 179 | static DES_cblock key ={0x12,0x34,0x56,0x78,0x9a,0xbc,0xde,0xf0}; |
180 | static des_cblock key2={0x34,0x56,0x78,0x9a,0xbc,0xde,0xf0,0x12}; | 180 | static DES_cblock key2={0x34,0x56,0x78,0x9a,0xbc,0xde,0xf0,0x12}; |
181 | static des_cblock key3={0x56,0x78,0x9a,0xbc,0xde,0xf0,0x12,0x34}; | 181 | static DES_cblock key3={0x56,0x78,0x9a,0xbc,0xde,0xf0,0x12,0x34}; |
182 | des_key_schedule sch,sch2,sch3; | 182 | DES_key_schedule sch,sch2,sch3; |
183 | double a,b,c,d,e; | 183 | double a,b,c,d,e; |
184 | #ifndef SIGALRM | 184 | #ifndef SIGALRM |
185 | long ca,cb,cc,cd,ce; | 185 | long ca,cb,cc,cd,ce; |
@@ -190,12 +190,12 @@ int main(int argc, char **argv) | |||
190 | printf("program when this computer is idle.\n"); | 190 | printf("program when this computer is idle.\n"); |
191 | #endif | 191 | #endif |
192 | 192 | ||
193 | des_set_key_unchecked(&key2,sch2); | 193 | DES_set_key_unchecked(&key2,&sch2); |
194 | des_set_key_unchecked(&key3,sch3); | 194 | DES_set_key_unchecked(&key3,&sch3); |
195 | 195 | ||
196 | #ifndef SIGALRM | 196 | #ifndef SIGALRM |
197 | printf("First we calculate the approximate speed ...\n"); | 197 | printf("First we calculate the approximate speed ...\n"); |
198 | des_set_key_unchecked(&key,sch); | 198 | DES_set_key_unchecked(&key,&sch); |
199 | count=10; | 199 | count=10; |
200 | do { | 200 | do { |
201 | long i; | 201 | long i; |
@@ -204,7 +204,7 @@ int main(int argc, char **argv) | |||
204 | count*=2; | 204 | count*=2; |
205 | Time_F(START); | 205 | Time_F(START); |
206 | for (i=count; i; i--) | 206 | for (i=count; i; i--) |
207 | des_encrypt1(data,&(sch[0]),DES_ENCRYPT); | 207 | DES_encrypt1(data,&sch,DES_ENCRYPT); |
208 | d=Time_F(STOP); | 208 | d=Time_F(STOP); |
209 | } while (d < 3.0); | 209 | } while (d < 3.0); |
210 | ca=count; | 210 | ca=count; |
@@ -225,63 +225,63 @@ int main(int argc, char **argv) | |||
225 | 225 | ||
226 | Time_F(START); | 226 | Time_F(START); |
227 | for (count=0,run=1; COND(ca); count++) | 227 | for (count=0,run=1; COND(ca); count++) |
228 | des_set_key_unchecked(&key,sch); | 228 | DES_set_key_unchecked(&key,&sch); |
229 | d=Time_F(STOP); | 229 | d=Time_F(STOP); |
230 | printf("%ld set_key's in %.2f seconds\n",count,d); | 230 | printf("%ld set_key's in %.2f seconds\n",count,d); |
231 | a=((double)COUNT(ca))/d; | 231 | a=((double)COUNT(ca))/d; |
232 | 232 | ||
233 | #ifdef SIGALRM | 233 | #ifdef SIGALRM |
234 | printf("Doing des_encrypt's for 10 seconds\n"); | 234 | printf("Doing DES_encrypt's for 10 seconds\n"); |
235 | alarm(10); | 235 | alarm(10); |
236 | #else | 236 | #else |
237 | printf("Doing des_encrypt %ld times\n",cb); | 237 | printf("Doing DES_encrypt %ld times\n",cb); |
238 | #endif | 238 | #endif |
239 | Time_F(START); | 239 | Time_F(START); |
240 | for (count=0,run=1; COND(cb); count++) | 240 | for (count=0,run=1; COND(cb); count++) |
241 | { | 241 | { |
242 | DES_LONG data[2]; | 242 | DES_LONG data[2]; |
243 | 243 | ||
244 | des_encrypt1(data,&(sch[0]),DES_ENCRYPT); | 244 | DES_encrypt1(data,&sch,DES_ENCRYPT); |
245 | } | 245 | } |
246 | d=Time_F(STOP); | 246 | d=Time_F(STOP); |
247 | printf("%ld des_encrypt's in %.2f second\n",count,d); | 247 | printf("%ld DES_encrypt's in %.2f second\n",count,d); |
248 | b=((double)COUNT(cb)*8)/d; | 248 | b=((double)COUNT(cb)*8)/d; |
249 | 249 | ||
250 | #ifdef SIGALRM | 250 | #ifdef SIGALRM |
251 | printf("Doing des_cbc_encrypt on %ld byte blocks for 10 seconds\n", | 251 | printf("Doing DES_cbc_encrypt on %ld byte blocks for 10 seconds\n", |
252 | BUFSIZE); | 252 | BUFSIZE); |
253 | alarm(10); | 253 | alarm(10); |
254 | #else | 254 | #else |
255 | printf("Doing des_cbc_encrypt %ld times on %ld byte blocks\n",cc, | 255 | printf("Doing DES_cbc_encrypt %ld times on %ld byte blocks\n",cc, |
256 | BUFSIZE); | 256 | BUFSIZE); |
257 | #endif | 257 | #endif |
258 | Time_F(START); | 258 | Time_F(START); |
259 | for (count=0,run=1; COND(cc); count++) | 259 | for (count=0,run=1; COND(cc); count++) |
260 | des_ncbc_encrypt(buf,buf,BUFSIZE,&(sch[0]), | 260 | DES_ncbc_encrypt(buf,buf,BUFSIZE,&sch, |
261 | &key,DES_ENCRYPT); | 261 | &key,DES_ENCRYPT); |
262 | d=Time_F(STOP); | 262 | d=Time_F(STOP); |
263 | printf("%ld des_cbc_encrypt's of %ld byte blocks in %.2f second\n", | 263 | printf("%ld DES_cbc_encrypt's of %ld byte blocks in %.2f second\n", |
264 | count,BUFSIZE,d); | 264 | count,BUFSIZE,d); |
265 | c=((double)COUNT(cc)*BUFSIZE)/d; | 265 | c=((double)COUNT(cc)*BUFSIZE)/d; |
266 | 266 | ||
267 | #ifdef SIGALRM | 267 | #ifdef SIGALRM |
268 | printf("Doing des_ede_cbc_encrypt on %ld byte blocks for 10 seconds\n", | 268 | printf("Doing DES_ede_cbc_encrypt on %ld byte blocks for 10 seconds\n", |
269 | BUFSIZE); | 269 | BUFSIZE); |
270 | alarm(10); | 270 | alarm(10); |
271 | #else | 271 | #else |
272 | printf("Doing des_ede_cbc_encrypt %ld times on %ld byte blocks\n",cd, | 272 | printf("Doing DES_ede_cbc_encrypt %ld times on %ld byte blocks\n",cd, |
273 | BUFSIZE); | 273 | BUFSIZE); |
274 | #endif | 274 | #endif |
275 | Time_F(START); | 275 | Time_F(START); |
276 | for (count=0,run=1; COND(cd); count++) | 276 | for (count=0,run=1; COND(cd); count++) |
277 | des_ede3_cbc_encrypt(buf,buf,BUFSIZE, | 277 | DES_ede3_cbc_encrypt(buf,buf,BUFSIZE, |
278 | &(sch[0]), | 278 | &sch, |
279 | &(sch2[0]), | 279 | &sch2, |
280 | &(sch3[0]), | 280 | &sch3, |
281 | &key, | 281 | &key, |
282 | DES_ENCRYPT); | 282 | DES_ENCRYPT); |
283 | d=Time_F(STOP); | 283 | d=Time_F(STOP); |
284 | printf("%ld des_ede_cbc_encrypt's of %ld byte blocks in %.2f second\n", | 284 | printf("%ld DES_ede_cbc_encrypt's of %ld byte blocks in %.2f second\n", |
285 | count,BUFSIZE,d); | 285 | count,BUFSIZE,d); |
286 | d=((double)COUNT(cd)*BUFSIZE)/d; | 286 | d=((double)COUNT(cd)*BUFSIZE)/d; |
287 | 287 | ||
@@ -304,7 +304,7 @@ int main(int argc, char **argv) | |||
304 | printf("DES ede cbc bytes per sec = %12.2f (%9.3fuS)\n",d,8.0e6/d); | 304 | printf("DES ede cbc bytes per sec = %12.2f (%9.3fuS)\n",d,8.0e6/d); |
305 | printf("crypt per sec = %12.2f (%9.3fuS)\n",e,1.0e6/e); | 305 | printf("crypt per sec = %12.2f (%9.3fuS)\n",e,1.0e6/e); |
306 | exit(0); | 306 | exit(0); |
307 | #if defined(LINT) || defined(MSDOS) | 307 | #if defined(LINT) || defined(OPENSSL_SYS_MSDOS) |
308 | return(0); | 308 | return(0); |
309 | #endif | 309 | #endif |
310 | } | 310 | } |
diff --git a/src/lib/libcrypto/des/spr.h b/src/lib/libcrypto/des/spr.h index b8fbdcf8d3..b91936a5a5 100644 --- a/src/lib/libcrypto/des/spr.h +++ b/src/lib/libcrypto/des/spr.h | |||
@@ -56,7 +56,7 @@ | |||
56 | * [including the GNU Public Licence.] | 56 | * [including the GNU Public Licence.] |
57 | */ | 57 | */ |
58 | 58 | ||
59 | OPENSSL_GLOBAL const DES_LONG des_SPtrans[8][64]={ | 59 | OPENSSL_GLOBAL const DES_LONG DES_SPtrans[8][64]={ |
60 | { | 60 | { |
61 | /* nibble 0 */ | 61 | /* nibble 0 */ |
62 | 0x02080800L, 0x00080000L, 0x02000002L, 0x02080802L, | 62 | 0x02080800L, 0x00080000L, 0x02000002L, 0x02080802L, |
diff --git a/src/lib/libcrypto/des/str2key.c b/src/lib/libcrypto/des/str2key.c index c6abb87201..36c3f81d99 100644 --- a/src/lib/libcrypto/des/str2key.c +++ b/src/lib/libcrypto/des/str2key.c | |||
@@ -58,9 +58,9 @@ | |||
58 | 58 | ||
59 | #include "des_locl.h" | 59 | #include "des_locl.h" |
60 | 60 | ||
61 | void des_string_to_key(const char *str, des_cblock *key) | 61 | void DES_string_to_key(const char *str, DES_cblock *key) |
62 | { | 62 | { |
63 | des_key_schedule ks; | 63 | DES_key_schedule ks; |
64 | int i,length; | 64 | int i,length; |
65 | register unsigned char j; | 65 | register unsigned char j; |
66 | 66 | ||
@@ -85,16 +85,22 @@ void des_string_to_key(const char *str, des_cblock *key) | |||
85 | } | 85 | } |
86 | } | 86 | } |
87 | #endif | 87 | #endif |
88 | des_set_odd_parity(key); | 88 | DES_set_odd_parity(key); |
89 | des_set_key_unchecked(key,ks); | 89 | #ifdef EXPERIMENTAL_STR_TO_STRONG_KEY |
90 | des_cbc_cksum((const unsigned char*)str,key,length,ks,key); | 90 | if(DES_is_weak_key(key)) |
91 | memset(ks,0,sizeof(ks)); | 91 | (*key)[7] ^= 0xF0; |
92 | des_set_odd_parity(key); | 92 | DES_set_key(key,&ks); |
93 | #else | ||
94 | DES_set_key_unchecked(key,&ks); | ||
95 | #endif | ||
96 | DES_cbc_cksum((const unsigned char*)str,key,length,&ks,key); | ||
97 | memset(&ks,0,sizeof(ks)); | ||
98 | DES_set_odd_parity(key); | ||
93 | } | 99 | } |
94 | 100 | ||
95 | void des_string_to_2keys(const char *str, des_cblock *key1, des_cblock *key2) | 101 | void DES_string_to_2keys(const char *str, DES_cblock *key1, DES_cblock *key2) |
96 | { | 102 | { |
97 | des_key_schedule ks; | 103 | DES_key_schedule ks; |
98 | int i,length; | 104 | int i,length; |
99 | register unsigned char j; | 105 | register unsigned char j; |
100 | 106 | ||
@@ -143,13 +149,25 @@ void des_string_to_2keys(const char *str, des_cblock *key1, des_cblock *key2) | |||
143 | } | 149 | } |
144 | if (length <= 8) memcpy(key2,key1,8); | 150 | if (length <= 8) memcpy(key2,key1,8); |
145 | #endif | 151 | #endif |
146 | des_set_odd_parity(key1); | 152 | DES_set_odd_parity(key1); |
147 | des_set_odd_parity(key2); | 153 | DES_set_odd_parity(key2); |
148 | des_set_key_unchecked(key1,ks); | 154 | #ifdef EXPERIMENTAL_STR_TO_STRONG_KEY |
149 | des_cbc_cksum((const unsigned char*)str,key1,length,ks,key1); | 155 | if(DES_is_weak_key(key1)) |
150 | des_set_key_unchecked(key2,ks); | 156 | (*key1)[7] ^= 0xF0; |
151 | des_cbc_cksum((const unsigned char*)str,key2,length,ks,key2); | 157 | DES_set_key(key1,&ks); |
152 | memset(ks,0,sizeof(ks)); | 158 | #else |
153 | des_set_odd_parity(key1); | 159 | DES_set_key_unchecked(key1,&ks); |
154 | des_set_odd_parity(key2); | 160 | #endif |
161 | DES_cbc_cksum((const unsigned char*)str,key1,length,&ks,key1); | ||
162 | #ifdef EXPERIMENTAL_STR_TO_STRONG_KEY | ||
163 | if(DES_is_weak_key(key2)) | ||
164 | (*key2)[7] ^= 0xF0; | ||
165 | DES_set_key(key2,&ks); | ||
166 | #else | ||
167 | DES_set_key_unchecked(key2,&ks); | ||
168 | #endif | ||
169 | DES_cbc_cksum((const unsigned char*)str,key2,length,&ks,key2); | ||
170 | memset(&ks,0,sizeof(ks)); | ||
171 | DES_set_odd_parity(key1); | ||
172 | DES_set_odd_parity(key2); | ||
155 | } | 173 | } |
diff --git a/src/lib/libcrypto/des/xcbc_enc.c b/src/lib/libcrypto/des/xcbc_enc.c index ccfede13ac..47246eb466 100644 --- a/src/lib/libcrypto/des/xcbc_enc.c +++ b/src/lib/libcrypto/des/xcbc_enc.c | |||
@@ -79,8 +79,8 @@ static unsigned char desx_white_in2out[256]={ | |||
79 | 0xA7,0x1C,0xC9,0x09,0x69,0x9A,0x83,0xCF,0x29,0x39,0xB9,0xE9,0x4C,0xFF,0x43,0xAB, | 79 | 0xA7,0x1C,0xC9,0x09,0x69,0x9A,0x83,0xCF,0x29,0x39,0xB9,0xE9,0x4C,0xFF,0x43,0xAB, |
80 | }; | 80 | }; |
81 | 81 | ||
82 | void des_xwhite_in2out(const_des_cblock *des_key, const_des_cblock *in_white, | 82 | void DES_xwhite_in2out(const_DES_cblock *des_key, const_DES_cblock *in_white, |
83 | des_cblock *out_white) | 83 | DES_cblock *out_white) |
84 | { | 84 | { |
85 | int out0,out1; | 85 | int out0,out1; |
86 | int i; | 86 | int i; |
@@ -107,9 +107,10 @@ void des_xwhite_in2out(const_des_cblock *des_key, const_des_cblock *in_white, | |||
107 | } | 107 | } |
108 | } | 108 | } |
109 | 109 | ||
110 | void des_xcbc_encrypt(const unsigned char *in, unsigned char *out, | 110 | void DES_xcbc_encrypt(const unsigned char *in, unsigned char *out, |
111 | long length, des_key_schedule schedule, des_cblock *ivec, | 111 | long length, DES_key_schedule *schedule, |
112 | const_des_cblock *inw, const_des_cblock *outw, int enc) | 112 | DES_cblock *ivec, const_DES_cblock *inw, |
113 | const_DES_cblock *outw, int enc) | ||
113 | { | 114 | { |
114 | register DES_LONG tin0,tin1; | 115 | register DES_LONG tin0,tin1; |
115 | register DES_LONG tout0,tout1,xor0,xor1; | 116 | register DES_LONG tout0,tout1,xor0,xor1; |
@@ -138,7 +139,7 @@ void des_xcbc_encrypt(const unsigned char *in, unsigned char *out, | |||
138 | c2l(in,tin1); | 139 | c2l(in,tin1); |
139 | tin0^=tout0^inW0; tin[0]=tin0; | 140 | tin0^=tout0^inW0; tin[0]=tin0; |
140 | tin1^=tout1^inW1; tin[1]=tin1; | 141 | tin1^=tout1^inW1; tin[1]=tin1; |
141 | des_encrypt1(tin,schedule,DES_ENCRYPT); | 142 | DES_encrypt1(tin,schedule,DES_ENCRYPT); |
142 | tout0=tin[0]^outW0; l2c(tout0,out); | 143 | tout0=tin[0]^outW0; l2c(tout0,out); |
143 | tout1=tin[1]^outW1; l2c(tout1,out); | 144 | tout1=tin[1]^outW1; l2c(tout1,out); |
144 | } | 145 | } |
@@ -147,7 +148,7 @@ void des_xcbc_encrypt(const unsigned char *in, unsigned char *out, | |||
147 | c2ln(in,tin0,tin1,l+8); | 148 | c2ln(in,tin0,tin1,l+8); |
148 | tin0^=tout0^inW0; tin[0]=tin0; | 149 | tin0^=tout0^inW0; tin[0]=tin0; |
149 | tin1^=tout1^inW1; tin[1]=tin1; | 150 | tin1^=tout1^inW1; tin[1]=tin1; |
150 | des_encrypt1(tin,schedule,DES_ENCRYPT); | 151 | DES_encrypt1(tin,schedule,DES_ENCRYPT); |
151 | tout0=tin[0]^outW0; l2c(tout0,out); | 152 | tout0=tin[0]^outW0; l2c(tout0,out); |
152 | tout1=tin[1]^outW1; l2c(tout1,out); | 153 | tout1=tin[1]^outW1; l2c(tout1,out); |
153 | } | 154 | } |
@@ -163,7 +164,7 @@ void des_xcbc_encrypt(const unsigned char *in, unsigned char *out, | |||
163 | { | 164 | { |
164 | c2l(in,tin0); tin[0]=tin0^outW0; | 165 | c2l(in,tin0); tin[0]=tin0^outW0; |
165 | c2l(in,tin1); tin[1]=tin1^outW1; | 166 | c2l(in,tin1); tin[1]=tin1^outW1; |
166 | des_encrypt1(tin,schedule,DES_DECRYPT); | 167 | DES_encrypt1(tin,schedule,DES_DECRYPT); |
167 | tout0=tin[0]^xor0^inW0; | 168 | tout0=tin[0]^xor0^inW0; |
168 | tout1=tin[1]^xor1^inW1; | 169 | tout1=tin[1]^xor1^inW1; |
169 | l2c(tout0,out); | 170 | l2c(tout0,out); |
@@ -175,7 +176,7 @@ void des_xcbc_encrypt(const unsigned char *in, unsigned char *out, | |||
175 | { | 176 | { |
176 | c2l(in,tin0); tin[0]=tin0^outW0; | 177 | c2l(in,tin0); tin[0]=tin0^outW0; |
177 | c2l(in,tin1); tin[1]=tin1^outW1; | 178 | c2l(in,tin1); tin[1]=tin1^outW1; |
178 | des_encrypt1(tin,schedule,DES_DECRYPT); | 179 | DES_encrypt1(tin,schedule,DES_DECRYPT); |
179 | tout0=tin[0]^xor0^inW0; | 180 | tout0=tin[0]^xor0^inW0; |
180 | tout1=tin[1]^xor1^inW1; | 181 | tout1=tin[1]^xor1^inW1; |
181 | l2cn(tout0,tout1,out,l+8); | 182 | l2cn(tout0,tout1,out,l+8); |