summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/evp
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libcrypto/evp')
-rw-r--r--src/lib/libcrypto/evp/Makefile733
-rw-r--r--src/lib/libcrypto/evp/bio_ok.c575
-rw-r--r--src/lib/libcrypto/evp/c_allc.c224
-rw-r--r--src/lib/libcrypto/evp/c_alld.c114
-rw-r--r--src/lib/libcrypto/evp/e_acss.c85
-rw-r--r--src/lib/libcrypto/evp/e_dsa.c71
-rw-r--r--src/lib/libcrypto/evp/e_rc5.c126
-rw-r--r--src/lib/libcrypto/evp/e_seed.c83
-rw-r--r--src/lib/libcrypto/evp/encode.c3
-rw-r--r--src/lib/libcrypto/evp/evp.h5
-rw-r--r--src/lib/libcrypto/evp/evp_acnf.c73
-rw-r--r--src/lib/libcrypto/evp/evp_enc.c1
-rw-r--r--src/lib/libcrypto/evp/evp_err.c1
-rw-r--r--src/lib/libcrypto/evp/evp_test.c449
-rw-r--r--src/lib/libcrypto/evp/evptests.txt321
-rw-r--r--src/lib/libcrypto/evp/m_md2.c101
-rw-r--r--src/lib/libcrypto/evp/m_mdc2.c101
-rw-r--r--src/lib/libcrypto/evp/m_sha.c100
-rw-r--r--src/lib/libcrypto/evp/openbsd_hw.c446
-rw-r--r--src/lib/libcrypto/evp/p_lib.c3
-rw-r--r--src/lib/libcrypto/evp/p_sign.c2
-rw-r--r--src/lib/libcrypto/evp/p_verify.c2
22 files changed, 3612 insertions, 7 deletions
diff --git a/src/lib/libcrypto/evp/Makefile b/src/lib/libcrypto/evp/Makefile
new file mode 100644
index 0000000000..82825e5299
--- /dev/null
+++ b/src/lib/libcrypto/evp/Makefile
@@ -0,0 +1,733 @@
1#
2# OpenSSL/crypto/evp/Makefile
3#
4
5DIR= evp
6TOP= ../..
7CC= cc
8INCLUDES= -I.. -I$(TOP) -I../../include
9CFLAG=-g
10MAKEFILE= Makefile
11AR= ar r
12
13CFLAGS= $(INCLUDES) $(CFLAG)
14
15GENERAL=Makefile
16TEST=evp_test.c
17TESTDATA=evptests.txt
18APPS=
19
20LIB=$(TOP)/libcrypto.a
21LIBSRC= encode.c digest.c evp_enc.c evp_key.c evp_acnf.c \
22 e_des.c e_bf.c e_idea.c e_des3.c e_camellia.c\
23 e_rc4.c e_aes.c names.c e_seed.c \
24 e_xcbc_d.c e_rc2.c e_cast.c e_rc5.c \
25 m_null.c m_md2.c m_md4.c m_md5.c m_sha.c m_sha1.c m_wp.c \
26 m_dss.c m_dss1.c m_mdc2.c m_ripemd.c m_ecdsa.c\
27 p_open.c p_seal.c p_sign.c p_verify.c p_lib.c p_enc.c p_dec.c \
28 bio_md.c bio_b64.c bio_enc.c evp_err.c e_null.c \
29 c_all.c c_allc.c c_alld.c evp_lib.c bio_ok.c \
30 evp_pkey.c evp_pbe.c p5_crpt.c p5_crpt2.c \
31 e_old.c pmeth_lib.c pmeth_fn.c pmeth_gn.c m_sigver.c
32
33LIBOBJ= encode.o digest.o evp_enc.o evp_key.o evp_acnf.o \
34 e_des.o e_bf.o e_idea.o e_des3.o e_camellia.o\
35 e_rc4.o e_aes.o names.o e_seed.o \
36 e_xcbc_d.o e_rc2.o e_cast.o e_rc5.o \
37 m_null.o m_md2.o m_md4.o m_md5.o m_sha.o m_sha1.o m_wp.o \
38 m_dss.o m_dss1.o m_mdc2.o m_ripemd.o m_ecdsa.o\
39 p_open.o p_seal.o p_sign.o p_verify.o p_lib.o p_enc.o p_dec.o \
40 bio_md.o bio_b64.o bio_enc.o evp_err.o e_null.o \
41 c_all.o c_allc.o c_alld.o evp_lib.o bio_ok.o \
42 evp_pkey.o evp_pbe.o p5_crpt.o p5_crpt2.o \
43 e_old.o pmeth_lib.o pmeth_fn.o pmeth_gn.o m_sigver.o
44
45SRC= $(LIBSRC)
46
47EXHEADER= evp.h
48HEADER= evp_locl.h $(EXHEADER)
49
50ALL= $(GENERAL) $(SRC) $(HEADER)
51
52top:
53 (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all)
54
55all: lib
56
57lib: $(LIBOBJ)
58 $(AR) $(LIB) $(LIBOBJ)
59 $(RANLIB) $(LIB) || echo Never mind.
60 @touch lib
61
62files:
63 $(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO
64
65links:
66 @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER)
67 @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST)
68 cp $(TESTDATA) ../../test
69 @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS)
70
71install:
72 @[ -n "$(INSTALLTOP)" ] # should be set by top Makefile...
73 @headerlist="$(EXHEADER)"; for i in $$headerlist ; \
74 do \
75 (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
76 chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
77 done;
78
79tags:
80 ctags $(SRC)
81
82tests:
83
84lint:
85 lint -DLINT $(INCLUDES) $(SRC)>fluff
86
87depend:
88 @[ -n "$(MAKEDEPEND)" ] # should be set by upper Makefile...
89 $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(LIBSRC)
90
91dclean:
92 $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new
93 mv -f Makefile.new $(MAKEFILE)
94
95clean:
96 rm -f *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
97
98# DO NOT DELETE THIS LINE -- make depend depends on it.
99
100bio_b64.o: ../../e_os.h ../../include/openssl/asn1.h
101bio_b64.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
102bio_b64.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
103bio_b64.o: ../../include/openssl/err.h ../../include/openssl/evp.h
104bio_b64.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
105bio_b64.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
106bio_b64.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
107bio_b64.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
108bio_b64.o: ../../include/openssl/symhacks.h ../cryptlib.h bio_b64.c
109bio_enc.o: ../../e_os.h ../../include/openssl/asn1.h
110bio_enc.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
111bio_enc.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
112bio_enc.o: ../../include/openssl/err.h ../../include/openssl/evp.h
113bio_enc.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
114bio_enc.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
115bio_enc.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
116bio_enc.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
117bio_enc.o: ../../include/openssl/symhacks.h ../cryptlib.h bio_enc.c
118bio_md.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
119bio_md.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
120bio_md.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
121bio_md.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
122bio_md.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
123bio_md.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
124bio_md.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h
125bio_md.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
126bio_md.o: ../cryptlib.h bio_md.c
127bio_ok.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
128bio_ok.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
129bio_ok.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
130bio_ok.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
131bio_ok.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
132bio_ok.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
133bio_ok.o: ../../include/openssl/ossl_typ.h ../../include/openssl/rand.h
134bio_ok.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
135bio_ok.o: ../../include/openssl/symhacks.h ../cryptlib.h bio_ok.c
136c_all.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
137c_all.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
138c_all.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
139c_all.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
140c_all.o: ../../include/openssl/engine.h ../../include/openssl/err.h
141c_all.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
142c_all.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
143c_all.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
144c_all.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
145c_all.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
146c_all.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
147c_all.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
148c_all.o: ../cryptlib.h c_all.c
149c_allc.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
150c_allc.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
151c_allc.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
152c_allc.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
153c_allc.o: ../../include/openssl/err.h ../../include/openssl/evp.h
154c_allc.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
155c_allc.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
156c_allc.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
157c_allc.o: ../../include/openssl/pkcs12.h ../../include/openssl/pkcs7.h
158c_allc.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
159c_allc.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
160c_allc.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
161c_allc.o: ../cryptlib.h c_allc.c
162c_alld.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
163c_alld.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
164c_alld.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
165c_alld.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
166c_alld.o: ../../include/openssl/err.h ../../include/openssl/evp.h
167c_alld.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
168c_alld.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
169c_alld.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
170c_alld.o: ../../include/openssl/pkcs12.h ../../include/openssl/pkcs7.h
171c_alld.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
172c_alld.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
173c_alld.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
174c_alld.o: ../cryptlib.h c_alld.c
175digest.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
176digest.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
177digest.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
178digest.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
179digest.o: ../../include/openssl/engine.h ../../include/openssl/err.h
180digest.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
181digest.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
182digest.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
183digest.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
184digest.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
185digest.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
186digest.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
187digest.o: ../cryptlib.h digest.c
188e_aes.o: ../../include/openssl/aes.h ../../include/openssl/asn1.h
189e_aes.o: ../../include/openssl/bio.h ../../include/openssl/crypto.h
190e_aes.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
191e_aes.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
192e_aes.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
193e_aes.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
194e_aes.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h
195e_aes.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h e_aes.c
196e_aes.o: evp_locl.h
197e_bf.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
198e_bf.o: ../../include/openssl/blowfish.h ../../include/openssl/buffer.h
199e_bf.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
200e_bf.o: ../../include/openssl/err.h ../../include/openssl/evp.h
201e_bf.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
202e_bf.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
203e_bf.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
204e_bf.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
205e_bf.o: ../../include/openssl/symhacks.h ../cryptlib.h e_bf.c evp_locl.h
206e_camellia.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
207e_camellia.o: ../../include/openssl/camellia.h ../../include/openssl/crypto.h
208e_camellia.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
209e_camellia.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
210e_camellia.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
211e_camellia.o: ../../include/openssl/opensslconf.h
212e_camellia.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
213e_camellia.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
214e_camellia.o: ../../include/openssl/symhacks.h e_camellia.c evp_locl.h
215e_cast.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
216e_cast.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
217e_cast.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
218e_cast.o: ../../include/openssl/err.h ../../include/openssl/evp.h
219e_cast.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
220e_cast.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
221e_cast.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
222e_cast.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
223e_cast.o: ../../include/openssl/symhacks.h ../cryptlib.h e_cast.c evp_locl.h
224e_des.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
225e_des.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
226e_des.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
227e_des.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
228e_des.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
229e_des.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
230e_des.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
231e_des.o: ../../include/openssl/ossl_typ.h ../../include/openssl/rand.h
232e_des.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
233e_des.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
234e_des.o: ../../include/openssl/ui_compat.h ../cryptlib.h e_des.c evp_locl.h
235e_des3.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
236e_des3.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
237e_des3.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
238e_des3.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
239e_des3.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
240e_des3.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
241e_des3.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
242e_des3.o: ../../include/openssl/ossl_typ.h ../../include/openssl/rand.h
243e_des3.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
244e_des3.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
245e_des3.o: ../../include/openssl/ui_compat.h ../cryptlib.h e_des3.c evp_locl.h
246e_idea.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
247e_idea.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
248e_idea.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
249e_idea.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
250e_idea.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
251e_idea.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
252e_idea.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
253e_idea.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
254e_idea.o: ../../include/openssl/symhacks.h ../cryptlib.h e_idea.c evp_locl.h
255e_null.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
256e_null.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
257e_null.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
258e_null.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
259e_null.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
260e_null.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
261e_null.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h
262e_null.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
263e_null.o: ../cryptlib.h e_null.c
264e_old.o: e_old.c
265e_rc2.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
266e_rc2.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
267e_rc2.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
268e_rc2.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
269e_rc2.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
270e_rc2.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
271e_rc2.o: ../../include/openssl/ossl_typ.h ../../include/openssl/rc2.h
272e_rc2.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
273e_rc2.o: ../../include/openssl/symhacks.h ../cryptlib.h e_rc2.c evp_locl.h
274e_rc4.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
275e_rc4.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
276e_rc4.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
277e_rc4.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
278e_rc4.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
279e_rc4.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
280e_rc4.o: ../../include/openssl/ossl_typ.h ../../include/openssl/rc4.h
281e_rc4.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
282e_rc4.o: ../../include/openssl/symhacks.h ../cryptlib.h e_rc4.c
283e_rc5.o: ../../e_os.h ../../include/openssl/bio.h
284e_rc5.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
285e_rc5.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
286e_rc5.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
287e_rc5.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
288e_rc5.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
289e_rc5.o: ../../include/openssl/symhacks.h ../cryptlib.h e_rc5.c
290e_seed.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
291e_seed.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
292e_seed.o: ../../include/openssl/err.h ../../include/openssl/evp.h
293e_seed.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
294e_seed.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
295e_seed.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
296e_seed.o: ../../include/openssl/safestack.h ../../include/openssl/seed.h
297e_seed.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
298e_seed.o: e_seed.c evp_locl.h
299e_xcbc_d.o: ../../e_os.h ../../include/openssl/asn1.h
300e_xcbc_d.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
301e_xcbc_d.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
302e_xcbc_d.o: ../../include/openssl/des_old.h ../../include/openssl/e_os2.h
303e_xcbc_d.o: ../../include/openssl/err.h ../../include/openssl/evp.h
304e_xcbc_d.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
305e_xcbc_d.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
306e_xcbc_d.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
307e_xcbc_d.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
308e_xcbc_d.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
309e_xcbc_d.o: ../../include/openssl/ui_compat.h ../cryptlib.h e_xcbc_d.c
310e_xcbc_d.o: evp_locl.h
311encode.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
312encode.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
313encode.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
314encode.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
315encode.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
316encode.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
317encode.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h
318encode.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
319encode.o: ../cryptlib.h encode.c
320evp_acnf.o: ../../e_os.h ../../include/openssl/asn1.h
321evp_acnf.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
322evp_acnf.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h
323evp_acnf.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
324evp_acnf.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
325evp_acnf.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
326evp_acnf.o: ../../include/openssl/opensslconf.h
327evp_acnf.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
328evp_acnf.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
329evp_acnf.o: ../../include/openssl/symhacks.h ../cryptlib.h evp_acnf.c
330evp_enc.o: ../../e_os.h ../../include/openssl/asn1.h
331evp_enc.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
332evp_enc.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
333evp_enc.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
334evp_enc.o: ../../include/openssl/ecdsa.h ../../include/openssl/engine.h
335evp_enc.o: ../../include/openssl/err.h ../../include/openssl/evp.h
336evp_enc.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
337evp_enc.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
338evp_enc.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
339evp_enc.o: ../../include/openssl/pkcs7.h ../../include/openssl/rand.h
340evp_enc.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
341evp_enc.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
342evp_enc.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
343evp_enc.o: ../cryptlib.h evp_enc.c evp_locl.h
344evp_err.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
345evp_err.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
346evp_err.o: ../../include/openssl/err.h ../../include/openssl/evp.h
347evp_err.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
348evp_err.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
349evp_err.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
350evp_err.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
351evp_err.o: ../../include/openssl/symhacks.h evp_err.c
352evp_key.o: ../../e_os.h ../../include/openssl/asn1.h
353evp_key.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
354evp_key.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
355evp_key.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
356evp_key.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
357evp_key.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
358evp_key.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
359evp_key.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
360evp_key.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
361evp_key.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
362evp_key.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
363evp_key.o: ../../include/openssl/ui.h ../../include/openssl/x509.h
364evp_key.o: ../../include/openssl/x509_vfy.h ../cryptlib.h evp_key.c
365evp_lib.o: ../../e_os.h ../../include/openssl/asn1.h
366evp_lib.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
367evp_lib.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
368evp_lib.o: ../../include/openssl/err.h ../../include/openssl/evp.h
369evp_lib.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
370evp_lib.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
371evp_lib.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
372evp_lib.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
373evp_lib.o: ../../include/openssl/symhacks.h ../cryptlib.h evp_lib.c
374evp_pbe.o: ../../e_os.h ../../include/openssl/asn1.h
375evp_pbe.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
376evp_pbe.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
377evp_pbe.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
378evp_pbe.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
379evp_pbe.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
380evp_pbe.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
381evp_pbe.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
382evp_pbe.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs12.h
383evp_pbe.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
384evp_pbe.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
385evp_pbe.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
386evp_pbe.o: ../../include/openssl/x509_vfy.h ../cryptlib.h evp_pbe.c
387evp_pkey.o: ../../e_os.h ../../include/openssl/asn1.h
388evp_pkey.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
389evp_pkey.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
390evp_pkey.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
391evp_pkey.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
392evp_pkey.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
393evp_pkey.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
394evp_pkey.o: ../../include/openssl/opensslconf.h
395evp_pkey.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
396evp_pkey.o: ../../include/openssl/pkcs7.h ../../include/openssl/rand.h
397evp_pkey.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
398evp_pkey.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
399evp_pkey.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
400evp_pkey.o: ../asn1/asn1_locl.h ../cryptlib.h evp_pkey.c
401m_dss.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
402m_dss.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
403m_dss.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
404m_dss.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
405m_dss.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
406m_dss.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
407m_dss.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
408m_dss.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
409m_dss.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
410m_dss.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
411m_dss.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
412m_dss.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
413m_dss.o: ../cryptlib.h m_dss.c
414m_dss1.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
415m_dss1.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
416m_dss1.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
417m_dss1.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
418m_dss1.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
419m_dss1.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
420m_dss1.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
421m_dss1.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
422m_dss1.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
423m_dss1.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
424m_dss1.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
425m_dss1.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
426m_dss1.o: ../cryptlib.h m_dss1.c
427m_ecdsa.o: ../../e_os.h ../../include/openssl/asn1.h
428m_ecdsa.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
429m_ecdsa.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
430m_ecdsa.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
431m_ecdsa.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
432m_ecdsa.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
433m_ecdsa.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
434m_ecdsa.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
435m_ecdsa.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
436m_ecdsa.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
437m_ecdsa.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
438m_ecdsa.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
439m_ecdsa.o: ../cryptlib.h m_ecdsa.c
440m_md2.o: ../../e_os.h ../../include/openssl/bio.h
441m_md2.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
442m_md2.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
443m_md2.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
444m_md2.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
445m_md2.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
446m_md2.o: ../../include/openssl/symhacks.h ../cryptlib.h m_md2.c
447m_md4.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
448m_md4.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
449m_md4.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
450m_md4.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
451m_md4.o: ../../include/openssl/err.h ../../include/openssl/evp.h
452m_md4.o: ../../include/openssl/lhash.h ../../include/openssl/md4.h
453m_md4.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
454m_md4.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
455m_md4.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
456m_md4.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
457m_md4.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
458m_md4.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
459m_md4.o: ../../include/openssl/x509_vfy.h ../cryptlib.h m_md4.c
460m_md5.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
461m_md5.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
462m_md5.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
463m_md5.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
464m_md5.o: ../../include/openssl/err.h ../../include/openssl/evp.h
465m_md5.o: ../../include/openssl/lhash.h ../../include/openssl/md5.h
466m_md5.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
467m_md5.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
468m_md5.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
469m_md5.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
470m_md5.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
471m_md5.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
472m_md5.o: ../../include/openssl/x509_vfy.h ../cryptlib.h m_md5.c
473m_mdc2.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
474m_mdc2.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
475m_mdc2.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
476m_mdc2.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
477m_mdc2.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
478m_mdc2.o: ../../include/openssl/err.h ../../include/openssl/evp.h
479m_mdc2.o: ../../include/openssl/lhash.h ../../include/openssl/mdc2.h
480m_mdc2.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
481m_mdc2.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
482m_mdc2.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
483m_mdc2.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
484m_mdc2.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
485m_mdc2.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
486m_mdc2.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h
487m_mdc2.o: ../../include/openssl/x509_vfy.h ../cryptlib.h m_mdc2.c
488m_null.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
489m_null.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
490m_null.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
491m_null.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
492m_null.o: ../../include/openssl/err.h ../../include/openssl/evp.h
493m_null.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
494m_null.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
495m_null.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
496m_null.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
497m_null.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
498m_null.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
499m_null.o: ../../include/openssl/x509_vfy.h ../cryptlib.h m_null.c
500m_ripemd.o: ../../e_os.h ../../include/openssl/asn1.h
501m_ripemd.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
502m_ripemd.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
503m_ripemd.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
504m_ripemd.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
505m_ripemd.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
506m_ripemd.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
507m_ripemd.o: ../../include/openssl/opensslconf.h
508m_ripemd.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
509m_ripemd.o: ../../include/openssl/pkcs7.h ../../include/openssl/ripemd.h
510m_ripemd.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
511m_ripemd.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
512m_ripemd.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
513m_ripemd.o: ../../include/openssl/x509_vfy.h ../cryptlib.h m_ripemd.c
514m_sha.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
515m_sha.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
516m_sha.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
517m_sha.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
518m_sha.o: ../../include/openssl/err.h ../../include/openssl/evp.h
519m_sha.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
520m_sha.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
521m_sha.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
522m_sha.o: ../../include/openssl/pkcs7.h ../../include/openssl/rsa.h
523m_sha.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
524m_sha.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
525m_sha.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
526m_sha.o: ../cryptlib.h m_sha.c
527m_sha1.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
528m_sha1.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
529m_sha1.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
530m_sha1.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
531m_sha1.o: ../../include/openssl/err.h ../../include/openssl/evp.h
532m_sha1.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
533m_sha1.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
534m_sha1.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
535m_sha1.o: ../../include/openssl/pkcs7.h ../../include/openssl/rsa.h
536m_sha1.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
537m_sha1.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
538m_sha1.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
539m_sha1.o: ../cryptlib.h m_sha1.c
540m_sigver.o: ../../e_os.h ../../include/openssl/asn1.h
541m_sigver.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
542m_sigver.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
543m_sigver.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
544m_sigver.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
545m_sigver.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
546m_sigver.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
547m_sigver.o: ../../include/openssl/opensslconf.h
548m_sigver.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
549m_sigver.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
550m_sigver.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
551m_sigver.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
552m_sigver.o: ../../include/openssl/x509_vfy.h ../cryptlib.h evp_locl.h
553m_sigver.o: m_sigver.c
554m_wp.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
555m_wp.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
556m_wp.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
557m_wp.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
558m_wp.o: ../../include/openssl/err.h ../../include/openssl/evp.h
559m_wp.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
560m_wp.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
561m_wp.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
562m_wp.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
563m_wp.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
564m_wp.o: ../../include/openssl/symhacks.h ../../include/openssl/whrlpool.h
565m_wp.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
566m_wp.o: ../cryptlib.h m_wp.c
567names.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
568names.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
569names.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
570names.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
571names.o: ../../include/openssl/err.h ../../include/openssl/evp.h
572names.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
573names.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
574names.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
575names.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
576names.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
577names.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
578names.o: ../../include/openssl/x509_vfy.h ../cryptlib.h names.c
579p5_crpt.o: ../../e_os.h ../../include/openssl/asn1.h
580p5_crpt.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
581p5_crpt.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
582p5_crpt.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
583p5_crpt.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
584p5_crpt.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
585p5_crpt.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
586p5_crpt.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
587p5_crpt.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
588p5_crpt.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
589p5_crpt.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
590p5_crpt.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
591p5_crpt.o: ../cryptlib.h p5_crpt.c
592p5_crpt2.o: ../../e_os.h ../../include/openssl/asn1.h
593p5_crpt2.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
594p5_crpt2.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
595p5_crpt2.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
596p5_crpt2.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
597p5_crpt2.o: ../../include/openssl/evp.h ../../include/openssl/hmac.h
598p5_crpt2.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
599p5_crpt2.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
600p5_crpt2.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
601p5_crpt2.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
602p5_crpt2.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
603p5_crpt2.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
604p5_crpt2.o: ../../include/openssl/x509_vfy.h ../cryptlib.h p5_crpt2.c
605p_dec.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
606p_dec.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
607p_dec.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
608p_dec.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
609p_dec.o: ../../include/openssl/err.h ../../include/openssl/evp.h
610p_dec.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
611p_dec.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
612p_dec.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
613p_dec.o: ../../include/openssl/pkcs7.h ../../include/openssl/rand.h
614p_dec.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
615p_dec.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
616p_dec.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
617p_dec.o: ../../include/openssl/x509_vfy.h ../cryptlib.h p_dec.c
618p_enc.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
619p_enc.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
620p_enc.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
621p_enc.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
622p_enc.o: ../../include/openssl/err.h ../../include/openssl/evp.h
623p_enc.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
624p_enc.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
625p_enc.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
626p_enc.o: ../../include/openssl/pkcs7.h ../../include/openssl/rand.h
627p_enc.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
628p_enc.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
629p_enc.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
630p_enc.o: ../../include/openssl/x509_vfy.h ../cryptlib.h p_enc.c
631p_lib.o: ../../e_os.h ../../include/openssl/asn1.h
632p_lib.o: ../../include/openssl/asn1_mac.h ../../include/openssl/bio.h
633p_lib.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
634p_lib.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h
635p_lib.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
636p_lib.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
637p_lib.o: ../../include/openssl/ecdsa.h ../../include/openssl/engine.h
638p_lib.o: ../../include/openssl/err.h ../../include/openssl/evp.h
639p_lib.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
640p_lib.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
641p_lib.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
642p_lib.o: ../../include/openssl/pkcs7.h ../../include/openssl/rsa.h
643p_lib.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
644p_lib.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
645p_lib.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
646p_lib.o: ../asn1/asn1_locl.h ../cryptlib.h p_lib.c
647p_open.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
648p_open.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
649p_open.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
650p_open.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
651p_open.o: ../../include/openssl/err.h ../../include/openssl/evp.h
652p_open.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
653p_open.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
654p_open.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
655p_open.o: ../../include/openssl/pkcs7.h ../../include/openssl/rsa.h
656p_open.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
657p_open.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
658p_open.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
659p_open.o: ../cryptlib.h p_open.c
660p_seal.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
661p_seal.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
662p_seal.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
663p_seal.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
664p_seal.o: ../../include/openssl/err.h ../../include/openssl/evp.h
665p_seal.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
666p_seal.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
667p_seal.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
668p_seal.o: ../../include/openssl/pkcs7.h ../../include/openssl/rand.h
669p_seal.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
670p_seal.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
671p_seal.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
672p_seal.o: ../../include/openssl/x509_vfy.h ../cryptlib.h p_seal.c
673p_sign.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
674p_sign.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
675p_sign.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
676p_sign.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
677p_sign.o: ../../include/openssl/err.h ../../include/openssl/evp.h
678p_sign.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
679p_sign.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
680p_sign.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
681p_sign.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
682p_sign.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
683p_sign.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
684p_sign.o: ../../include/openssl/x509_vfy.h ../cryptlib.h p_sign.c
685p_verify.o: ../../e_os.h ../../include/openssl/asn1.h
686p_verify.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
687p_verify.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
688p_verify.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
689p_verify.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
690p_verify.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
691p_verify.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
692p_verify.o: ../../include/openssl/opensslconf.h
693p_verify.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
694p_verify.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
695p_verify.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
696p_verify.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
697p_verify.o: ../../include/openssl/x509_vfy.h ../cryptlib.h p_verify.c
698pmeth_fn.o: ../../e_os.h ../../include/openssl/asn1.h
699pmeth_fn.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
700pmeth_fn.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
701pmeth_fn.o: ../../include/openssl/err.h ../../include/openssl/evp.h
702pmeth_fn.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
703pmeth_fn.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
704pmeth_fn.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
705pmeth_fn.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
706pmeth_fn.o: ../../include/openssl/symhacks.h ../cryptlib.h evp_locl.h
707pmeth_fn.o: pmeth_fn.c
708pmeth_gn.o: ../../e_os.h ../../include/openssl/asn1.h
709pmeth_gn.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
710pmeth_gn.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
711pmeth_gn.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
712pmeth_gn.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
713pmeth_gn.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
714pmeth_gn.o: ../../include/openssl/opensslconf.h
715pmeth_gn.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
716pmeth_gn.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
717pmeth_gn.o: ../../include/openssl/symhacks.h ../cryptlib.h evp_locl.h
718pmeth_gn.o: pmeth_gn.c
719pmeth_lib.o: ../../e_os.h ../../include/openssl/asn1.h
720pmeth_lib.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
721pmeth_lib.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
722pmeth_lib.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
723pmeth_lib.o: ../../include/openssl/ecdsa.h ../../include/openssl/engine.h
724pmeth_lib.o: ../../include/openssl/err.h ../../include/openssl/evp.h
725pmeth_lib.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
726pmeth_lib.o: ../../include/openssl/objects.h
727pmeth_lib.o: ../../include/openssl/opensslconf.h
728pmeth_lib.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
729pmeth_lib.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
730pmeth_lib.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
731pmeth_lib.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
732pmeth_lib.o: ../../include/openssl/x509_vfy.h ../asn1/asn1_locl.h ../cryptlib.h
733pmeth_lib.o: evp_locl.h pmeth_lib.c
diff --git a/src/lib/libcrypto/evp/bio_ok.c b/src/lib/libcrypto/evp/bio_ok.c
new file mode 100644
index 0000000000..98bc1ab409
--- /dev/null
+++ b/src/lib/libcrypto/evp/bio_ok.c
@@ -0,0 +1,575 @@
1/* crypto/evp/bio_ok.c */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved.
4 *
5 * This package is an SSL implementation written
6 * by Eric Young (eay@cryptsoft.com).
7 * The implementation was written so as to conform with Netscapes SSL.
8 *
9 * This library is free for commercial and non-commercial use as long as
10 * the following conditions are aheared to. The following conditions
11 * apply to all code found in this distribution, be it the RC4, RSA,
12 * lhash, DES, etc., code; not just the SSL code. The SSL documentation
13 * included with this distribution is covered by the same copyright terms
14 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
15 *
16 * Copyright remains Eric Young's, and as such any Copyright notices in
17 * the code are not to be removed.
18 * If this package is used in a product, Eric Young should be given attribution
19 * as the author of the parts of the library used.
20 * This can be in the form of a textual message at program startup or
21 * in documentation (online or textual) provided with the package.
22 *
23 * Redistribution and use in source and binary forms, with or without
24 * modification, are permitted provided that the following conditions
25 * are met:
26 * 1. Redistributions of source code must retain the copyright
27 * notice, this list of conditions and the following disclaimer.
28 * 2. Redistributions in binary form must reproduce the above copyright
29 * notice, this list of conditions and the following disclaimer in the
30 * documentation and/or other materials provided with the distribution.
31 * 3. All advertising materials mentioning features or use of this software
32 * must display the following acknowledgement:
33 * "This product includes cryptographic software written by
34 * Eric Young (eay@cryptsoft.com)"
35 * The word 'cryptographic' can be left out if the rouines from the library
36 * being used are not cryptographic related :-).
37 * 4. If you include any Windows specific code (or a derivative thereof) from
38 * the apps directory (application code) you must include an acknowledgement:
39 * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
40 *
41 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
42 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
43 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
44 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
45 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
46 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
47 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
49 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
50 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
51 * SUCH DAMAGE.
52 *
53 * The licence and distribution terms for any publically available version or
54 * derivative of this code cannot be changed. i.e. this code cannot simply be
55 * copied and put under another distribution licence
56 * [including the GNU Public Licence.]
57 */
58
59/*
60 From: Arne Ansper <arne@cyber.ee>
61
62 Why BIO_f_reliable?
63
64 I wrote function which took BIO* as argument, read data from it
65 and processed it. Then I wanted to store the input file in
66 encrypted form. OK I pushed BIO_f_cipher to the BIO stack
67 and everything was OK. BUT if user types wrong password
68 BIO_f_cipher outputs only garbage and my function crashes. Yes
69 I can and I should fix my function, but BIO_f_cipher is
70 easy way to add encryption support to many existing applications
71 and it's hard to debug and fix them all.
72
73 So I wanted another BIO which would catch the incorrect passwords and
74 file damages which cause garbage on BIO_f_cipher's output.
75
76 The easy way is to push the BIO_f_md and save the checksum at
77 the end of the file. However there are several problems with this
78 approach:
79
80 1) you must somehow separate checksum from actual data.
81 2) you need lot's of memory when reading the file, because you
82 must read to the end of the file and verify the checksum before
83 letting the application to read the data.
84
85 BIO_f_reliable tries to solve both problems, so that you can
86 read and write arbitrary long streams using only fixed amount
87 of memory.
88
89 BIO_f_reliable splits data stream into blocks. Each block is prefixed
90 with it's length and suffixed with it's digest. So you need only
91 several Kbytes of memory to buffer single block before verifying
92 it's digest.
93
94 BIO_f_reliable goes further and adds several important capabilities:
95
96 1) the digest of the block is computed over the whole stream
97 -- so nobody can rearrange the blocks or remove or replace them.
98
99 2) to detect invalid passwords right at the start BIO_f_reliable
100 adds special prefix to the stream. In order to avoid known plain-text
101 attacks this prefix is generated as follows:
102
103 *) digest is initialized with random seed instead of
104 standardized one.
105 *) same seed is written to output
106 *) well-known text is then hashed and the output
107 of the digest is also written to output.
108
109 reader can now read the seed from stream, hash the same string
110 and then compare the digest output.
111
112 Bad things: BIO_f_reliable knows what's going on in EVP_Digest. I
113 initially wrote and tested this code on x86 machine and wrote the
114 digests out in machine-dependent order :( There are people using
115 this code and I cannot change this easily without making existing
116 data files unreadable.
117
118*/
119
120#include <stdio.h>
121#include <errno.h>
122#include <assert.h>
123#include "cryptlib.h"
124#include <openssl/buffer.h>
125#include <openssl/bio.h>
126#include <openssl/evp.h>
127#include <openssl/rand.h>
128
129static int ok_write(BIO *h, const char *buf, int num);
130static int ok_read(BIO *h, char *buf, int size);
131static long ok_ctrl(BIO *h, int cmd, long arg1, void *arg2);
132static int ok_new(BIO *h);
133static int ok_free(BIO *data);
134static long ok_callback_ctrl(BIO *h, int cmd, bio_info_cb *fp);
135
136static void sig_out(BIO* b);
137static void sig_in(BIO* b);
138static void block_out(BIO* b);
139static void block_in(BIO* b);
140#define OK_BLOCK_SIZE (1024*4)
141#define OK_BLOCK_BLOCK 4
142#define IOBS (OK_BLOCK_SIZE+ OK_BLOCK_BLOCK+ 3*EVP_MAX_MD_SIZE)
143#define WELLKNOWN "The quick brown fox jumped over the lazy dog's back."
144
145typedef struct ok_struct
146 {
147 size_t buf_len;
148 size_t buf_off;
149 size_t buf_len_save;
150 size_t buf_off_save;
151 int cont; /* <= 0 when finished */
152 int finished;
153 EVP_MD_CTX md;
154 int blockout; /* output block is ready */
155 int sigio; /* must process signature */
156 unsigned char buf[IOBS];
157 } BIO_OK_CTX;
158
159static BIO_METHOD methods_ok=
160 {
161 BIO_TYPE_CIPHER,"reliable",
162 ok_write,
163 ok_read,
164 NULL, /* ok_puts, */
165 NULL, /* ok_gets, */
166 ok_ctrl,
167 ok_new,
168 ok_free,
169 ok_callback_ctrl,
170 };
171
172BIO_METHOD *BIO_f_reliable(void)
173 {
174 return(&methods_ok);
175 }
176
177static int ok_new(BIO *bi)
178 {
179 BIO_OK_CTX *ctx;
180
181 ctx=(BIO_OK_CTX *)OPENSSL_malloc(sizeof(BIO_OK_CTX));
182 if (ctx == NULL) return(0);
183
184 ctx->buf_len=0;
185 ctx->buf_off=0;
186 ctx->buf_len_save=0;
187 ctx->buf_off_save=0;
188 ctx->cont=1;
189 ctx->finished=0;
190 ctx->blockout= 0;
191 ctx->sigio=1;
192
193 EVP_MD_CTX_init(&ctx->md);
194
195 bi->init=0;
196 bi->ptr=(char *)ctx;
197 bi->flags=0;
198 return(1);
199 }
200
201static int ok_free(BIO *a)
202 {
203 if (a == NULL) return(0);
204 EVP_MD_CTX_cleanup(&((BIO_OK_CTX *)a->ptr)->md);
205 OPENSSL_cleanse(a->ptr,sizeof(BIO_OK_CTX));
206 OPENSSL_free(a->ptr);
207 a->ptr=NULL;
208 a->init=0;
209 a->flags=0;
210 return(1);
211 }
212
213static int ok_read(BIO *b, char *out, int outl)
214 {
215 int ret=0,i,n;
216 BIO_OK_CTX *ctx;
217
218 if (out == NULL) return(0);
219 ctx=(BIO_OK_CTX *)b->ptr;
220
221 if ((ctx == NULL) || (b->next_bio == NULL) || (b->init == 0)) return(0);
222
223 while(outl > 0)
224 {
225
226 /* copy clean bytes to output buffer */
227 if (ctx->blockout)
228 {
229 i=ctx->buf_len-ctx->buf_off;
230 if (i > outl) i=outl;
231 memcpy(out,&(ctx->buf[ctx->buf_off]),i);
232 ret+=i;
233 out+=i;
234 outl-=i;
235 ctx->buf_off+=i;
236
237 /* all clean bytes are out */
238 if (ctx->buf_len == ctx->buf_off)
239 {
240 ctx->buf_off=0;
241
242 /* copy start of the next block into proper place */
243 if(ctx->buf_len_save- ctx->buf_off_save > 0)
244 {
245 ctx->buf_len= ctx->buf_len_save- ctx->buf_off_save;
246 memmove(ctx->buf, &(ctx->buf[ctx->buf_off_save]),
247 ctx->buf_len);
248 }
249 else
250 {
251 ctx->buf_len=0;
252 }
253 ctx->blockout= 0;
254 }
255 }
256
257 /* output buffer full -- cancel */
258 if (outl == 0) break;
259
260 /* no clean bytes in buffer -- fill it */
261 n=IOBS- ctx->buf_len;
262 i=BIO_read(b->next_bio,&(ctx->buf[ctx->buf_len]),n);
263
264 if (i <= 0) break; /* nothing new */
265
266 ctx->buf_len+= i;
267
268 /* no signature yet -- check if we got one */
269 if (ctx->sigio == 1) sig_in(b);
270
271 /* signature ok -- check if we got block */
272 if (ctx->sigio == 0) block_in(b);
273
274 /* invalid block -- cancel */
275 if (ctx->cont <= 0) break;
276
277 }
278
279 BIO_clear_retry_flags(b);
280 BIO_copy_next_retry(b);
281 return(ret);
282 }
283
284static int ok_write(BIO *b, const char *in, int inl)
285 {
286 int ret=0,n,i;
287 BIO_OK_CTX *ctx;
288
289 if (inl <= 0) return inl;
290
291 ctx=(BIO_OK_CTX *)b->ptr;
292 ret=inl;
293
294 if ((ctx == NULL) || (b->next_bio == NULL) || (b->init == 0)) return(0);
295
296 if(ctx->sigio) sig_out(b);
297
298 do{
299 BIO_clear_retry_flags(b);
300 n=ctx->buf_len-ctx->buf_off;
301 while (ctx->blockout && n > 0)
302 {
303 i=BIO_write(b->next_bio,&(ctx->buf[ctx->buf_off]),n);
304 if (i <= 0)
305 {
306 BIO_copy_next_retry(b);
307 if(!BIO_should_retry(b))
308 ctx->cont= 0;
309 return(i);
310 }
311 ctx->buf_off+=i;
312 n-=i;
313 }
314
315 /* at this point all pending data has been written */
316 ctx->blockout= 0;
317 if (ctx->buf_len == ctx->buf_off)
318 {
319 ctx->buf_len=OK_BLOCK_BLOCK;
320 ctx->buf_off=0;
321 }
322
323 if ((in == NULL) || (inl <= 0)) return(0);
324
325 n= (inl+ ctx->buf_len > OK_BLOCK_SIZE+ OK_BLOCK_BLOCK) ?
326 (int)(OK_BLOCK_SIZE+OK_BLOCK_BLOCK-ctx->buf_len) : inl;
327
328 memcpy((unsigned char *)(&(ctx->buf[ctx->buf_len])),(unsigned char *)in,n);
329 ctx->buf_len+= n;
330 inl-=n;
331 in+=n;
332
333 if(ctx->buf_len >= OK_BLOCK_SIZE+ OK_BLOCK_BLOCK)
334 {
335 block_out(b);
336 }
337 }while(inl > 0);
338
339 BIO_clear_retry_flags(b);
340 BIO_copy_next_retry(b);
341 return(ret);
342 }
343
344static long ok_ctrl(BIO *b, int cmd, long num, void *ptr)
345 {
346 BIO_OK_CTX *ctx;
347 EVP_MD *md;
348 const EVP_MD **ppmd;
349 long ret=1;
350 int i;
351
352 ctx=b->ptr;
353
354 switch (cmd)
355 {
356 case BIO_CTRL_RESET:
357 ctx->buf_len=0;
358 ctx->buf_off=0;
359 ctx->buf_len_save=0;
360 ctx->buf_off_save=0;
361 ctx->cont=1;
362 ctx->finished=0;
363 ctx->blockout= 0;
364 ctx->sigio=1;
365 ret=BIO_ctrl(b->next_bio,cmd,num,ptr);
366 break;
367 case BIO_CTRL_EOF: /* More to read */
368 if (ctx->cont <= 0)
369 ret=1;
370 else
371 ret=BIO_ctrl(b->next_bio,cmd,num,ptr);
372 break;
373 case BIO_CTRL_PENDING: /* More to read in buffer */
374 case BIO_CTRL_WPENDING: /* More to read in buffer */
375 ret=ctx->blockout ? ctx->buf_len-ctx->buf_off : 0;
376 if (ret <= 0)
377 ret=BIO_ctrl(b->next_bio,cmd,num,ptr);
378 break;
379 case BIO_CTRL_FLUSH:
380 /* do a final write */
381 if(ctx->blockout == 0)
382 block_out(b);
383
384 while (ctx->blockout)
385 {
386 i=ok_write(b,NULL,0);
387 if (i < 0)
388 {
389 ret=i;
390 break;
391 }
392 }
393
394 ctx->finished=1;
395 ctx->buf_off=ctx->buf_len=0;
396 ctx->cont=(int)ret;
397
398 /* Finally flush the underlying BIO */
399 ret=BIO_ctrl(b->next_bio,cmd,num,ptr);
400 break;
401 case BIO_C_DO_STATE_MACHINE:
402 BIO_clear_retry_flags(b);
403 ret=BIO_ctrl(b->next_bio,cmd,num,ptr);
404 BIO_copy_next_retry(b);
405 break;
406 case BIO_CTRL_INFO:
407 ret=(long)ctx->cont;
408 break;
409 case BIO_C_SET_MD:
410 md=ptr;
411 EVP_DigestInit_ex(&ctx->md, md, NULL);
412 b->init=1;
413 break;
414 case BIO_C_GET_MD:
415 if (b->init)
416 {
417 ppmd=ptr;
418 *ppmd=ctx->md.digest;
419 }
420 else
421 ret=0;
422 break;
423 default:
424 ret=BIO_ctrl(b->next_bio,cmd,num,ptr);
425 break;
426 }
427 return(ret);
428 }
429
430static long ok_callback_ctrl(BIO *b, int cmd, bio_info_cb *fp)
431 {
432 long ret=1;
433
434 if (b->next_bio == NULL) return(0);
435 switch (cmd)
436 {
437 default:
438 ret=BIO_callback_ctrl(b->next_bio,cmd,fp);
439 break;
440 }
441 return(ret);
442 }
443
444static void longswap(void *_ptr, size_t len)
445{ const union { long one; char little; } is_endian = {1};
446
447 if (is_endian.little) {
448 size_t i;
449 unsigned char *p=_ptr,c;
450
451 for(i= 0;i < len;i+= 4) {
452 c=p[0],p[0]=p[3],p[3]=c;
453 c=p[1],p[1]=p[2],p[2]=c;
454 }
455 }
456}
457
458static void sig_out(BIO* b)
459 {
460 BIO_OK_CTX *ctx;
461 EVP_MD_CTX *md;
462
463 ctx=b->ptr;
464 md=&ctx->md;
465
466 if(ctx->buf_len+ 2* md->digest->md_size > OK_BLOCK_SIZE) return;
467
468 EVP_DigestInit_ex(md, md->digest, NULL);
469 /* FIXME: there's absolutely no guarantee this makes any sense at all,
470 * particularly now EVP_MD_CTX has been restructured.
471 */
472 RAND_pseudo_bytes(md->md_data, md->digest->md_size);
473 memcpy(&(ctx->buf[ctx->buf_len]), md->md_data, md->digest->md_size);
474 longswap(&(ctx->buf[ctx->buf_len]), md->digest->md_size);
475 ctx->buf_len+= md->digest->md_size;
476
477 EVP_DigestUpdate(md, WELLKNOWN, strlen(WELLKNOWN));
478 EVP_DigestFinal_ex(md, &(ctx->buf[ctx->buf_len]), NULL);
479 ctx->buf_len+= md->digest->md_size;
480 ctx->blockout= 1;
481 ctx->sigio= 0;
482 }
483
484static void sig_in(BIO* b)
485 {
486 BIO_OK_CTX *ctx;
487 EVP_MD_CTX *md;
488 unsigned char tmp[EVP_MAX_MD_SIZE];
489 int ret= 0;
490
491 ctx=b->ptr;
492 md=&ctx->md;
493
494 if((int)(ctx->buf_len-ctx->buf_off) < 2*md->digest->md_size) return;
495
496 EVP_DigestInit_ex(md, md->digest, NULL);
497 memcpy(md->md_data, &(ctx->buf[ctx->buf_off]), md->digest->md_size);
498 longswap(md->md_data, md->digest->md_size);
499 ctx->buf_off+= md->digest->md_size;
500
501 EVP_DigestUpdate(md, WELLKNOWN, strlen(WELLKNOWN));
502 EVP_DigestFinal_ex(md, tmp, NULL);
503 ret= memcmp(&(ctx->buf[ctx->buf_off]), tmp, md->digest->md_size) == 0;
504 ctx->buf_off+= md->digest->md_size;
505 if(ret == 1)
506 {
507 ctx->sigio= 0;
508 if(ctx->buf_len != ctx->buf_off)
509 {
510 memmove(ctx->buf, &(ctx->buf[ctx->buf_off]), ctx->buf_len- ctx->buf_off);
511 }
512 ctx->buf_len-= ctx->buf_off;
513 ctx->buf_off= 0;
514 }
515 else
516 {
517 ctx->cont= 0;
518 }
519 }
520
521static void block_out(BIO* b)
522 {
523 BIO_OK_CTX *ctx;
524 EVP_MD_CTX *md;
525 unsigned long tl;
526
527 ctx=b->ptr;
528 md=&ctx->md;
529
530 tl= ctx->buf_len- OK_BLOCK_BLOCK;
531 ctx->buf[0]=(unsigned char)(tl>>24);
532 ctx->buf[1]=(unsigned char)(tl>>16);
533 ctx->buf[2]=(unsigned char)(tl>>8);
534 ctx->buf[3]=(unsigned char)(tl);
535 EVP_DigestUpdate(md, (unsigned char*) &(ctx->buf[OK_BLOCK_BLOCK]), tl);
536 EVP_DigestFinal_ex(md, &(ctx->buf[ctx->buf_len]), NULL);
537 ctx->buf_len+= md->digest->md_size;
538 ctx->blockout= 1;
539 }
540
541static void block_in(BIO* b)
542 {
543 BIO_OK_CTX *ctx;
544 EVP_MD_CTX *md;
545 unsigned long tl= 0;
546 unsigned char tmp[EVP_MAX_MD_SIZE];
547
548 ctx=b->ptr;
549 md=&ctx->md;
550
551 assert(sizeof(tl)>=OK_BLOCK_BLOCK); /* always true */
552 tl =ctx->buf[0]; tl<<=8;
553 tl|=ctx->buf[1]; tl<<=8;
554 tl|=ctx->buf[2]; tl<<=8;
555 tl|=ctx->buf[3];
556
557 if (ctx->buf_len < tl+ OK_BLOCK_BLOCK+ md->digest->md_size) return;
558
559 EVP_DigestUpdate(md, (unsigned char*) &(ctx->buf[OK_BLOCK_BLOCK]), tl);
560 EVP_DigestFinal_ex(md, tmp, NULL);
561 if(memcmp(&(ctx->buf[tl+ OK_BLOCK_BLOCK]), tmp, md->digest->md_size) == 0)
562 {
563 /* there might be parts from next block lurking around ! */
564 ctx->buf_off_save= tl+ OK_BLOCK_BLOCK+ md->digest->md_size;
565 ctx->buf_len_save= ctx->buf_len;
566 ctx->buf_off= OK_BLOCK_BLOCK;
567 ctx->buf_len= tl+ OK_BLOCK_BLOCK;
568 ctx->blockout= 1;
569 }
570 else
571 {
572 ctx->cont= 0;
573 }
574 }
575
diff --git a/src/lib/libcrypto/evp/c_allc.c b/src/lib/libcrypto/evp/c_allc.c
new file mode 100644
index 0000000000..c5f9268378
--- /dev/null
+++ b/src/lib/libcrypto/evp/c_allc.c
@@ -0,0 +1,224 @@
1/* crypto/evp/c_allc.c */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved.
4 *
5 * This package is an SSL implementation written
6 * by Eric Young (eay@cryptsoft.com).
7 * The implementation was written so as to conform with Netscapes SSL.
8 *
9 * This library is free for commercial and non-commercial use as long as
10 * the following conditions are aheared to. The following conditions
11 * apply to all code found in this distribution, be it the RC4, RSA,
12 * lhash, DES, etc., code; not just the SSL code. The SSL documentation
13 * included with this distribution is covered by the same copyright terms
14 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
15 *
16 * Copyright remains Eric Young's, and as such any Copyright notices in
17 * the code are not to be removed.
18 * If this package is used in a product, Eric Young should be given attribution
19 * as the author of the parts of the library used.
20 * This can be in the form of a textual message at program startup or
21 * in documentation (online or textual) provided with the package.
22 *
23 * Redistribution and use in source and binary forms, with or without
24 * modification, are permitted provided that the following conditions
25 * are met:
26 * 1. Redistributions of source code must retain the copyright
27 * notice, this list of conditions and the following disclaimer.
28 * 2. Redistributions in binary form must reproduce the above copyright
29 * notice, this list of conditions and the following disclaimer in the
30 * documentation and/or other materials provided with the distribution.
31 * 3. All advertising materials mentioning features or use of this software
32 * must display the following acknowledgement:
33 * "This product includes cryptographic software written by
34 * Eric Young (eay@cryptsoft.com)"
35 * The word 'cryptographic' can be left out if the rouines from the library
36 * being used are not cryptographic related :-).
37 * 4. If you include any Windows specific code (or a derivative thereof) from
38 * the apps directory (application code) you must include an acknowledgement:
39 * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
40 *
41 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
42 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
43 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
44 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
45 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
46 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
47 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
49 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
50 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
51 * SUCH DAMAGE.
52 *
53 * The licence and distribution terms for any publically available version or
54 * derivative of this code cannot be changed. i.e. this code cannot simply be
55 * copied and put under another distribution licence
56 * [including the GNU Public Licence.]
57 */
58
59#include <stdio.h>
60#include "cryptlib.h"
61#include <openssl/evp.h>
62#include <openssl/pkcs12.h>
63#include <openssl/objects.h>
64
65void OpenSSL_add_all_ciphers(void)
66 {
67
68#ifndef OPENSSL_NO_DES
69 EVP_add_cipher(EVP_des_cfb());
70 EVP_add_cipher(EVP_des_cfb1());
71 EVP_add_cipher(EVP_des_cfb8());
72 EVP_add_cipher(EVP_des_ede_cfb());
73 EVP_add_cipher(EVP_des_ede3_cfb());
74 EVP_add_cipher(EVP_des_ede3_cfb1());
75 EVP_add_cipher(EVP_des_ede3_cfb8());
76
77 EVP_add_cipher(EVP_des_ofb());
78 EVP_add_cipher(EVP_des_ede_ofb());
79 EVP_add_cipher(EVP_des_ede3_ofb());
80
81 EVP_add_cipher(EVP_desx_cbc());
82 EVP_add_cipher_alias(SN_desx_cbc,"DESX");
83 EVP_add_cipher_alias(SN_desx_cbc,"desx");
84
85 EVP_add_cipher(EVP_des_cbc());
86 EVP_add_cipher_alias(SN_des_cbc,"DES");
87 EVP_add_cipher_alias(SN_des_cbc,"des");
88 EVP_add_cipher(EVP_des_ede_cbc());
89 EVP_add_cipher(EVP_des_ede3_cbc());
90 EVP_add_cipher_alias(SN_des_ede3_cbc,"DES3");
91 EVP_add_cipher_alias(SN_des_ede3_cbc,"des3");
92
93 EVP_add_cipher(EVP_des_ecb());
94 EVP_add_cipher(EVP_des_ede());
95 EVP_add_cipher(EVP_des_ede3());
96#endif
97
98#ifndef OPENSSL_NO_RC4
99 EVP_add_cipher(EVP_rc4());
100 EVP_add_cipher(EVP_rc4_40());
101#endif
102
103#ifndef OPENSSL_NO_IDEA
104 EVP_add_cipher(EVP_idea_ecb());
105 EVP_add_cipher(EVP_idea_cfb());
106 EVP_add_cipher(EVP_idea_ofb());
107 EVP_add_cipher(EVP_idea_cbc());
108 EVP_add_cipher_alias(SN_idea_cbc,"IDEA");
109 EVP_add_cipher_alias(SN_idea_cbc,"idea");
110#endif
111
112#ifndef OPENSSL_NO_SEED
113 EVP_add_cipher(EVP_seed_ecb());
114 EVP_add_cipher(EVP_seed_cfb());
115 EVP_add_cipher(EVP_seed_ofb());
116 EVP_add_cipher(EVP_seed_cbc());
117 EVP_add_cipher_alias(SN_seed_cbc,"SEED");
118 EVP_add_cipher_alias(SN_seed_cbc,"seed");
119#endif
120
121#ifndef OPENSSL_NO_RC2
122 EVP_add_cipher(EVP_rc2_ecb());
123 EVP_add_cipher(EVP_rc2_cfb());
124 EVP_add_cipher(EVP_rc2_ofb());
125 EVP_add_cipher(EVP_rc2_cbc());
126 EVP_add_cipher(EVP_rc2_40_cbc());
127 EVP_add_cipher(EVP_rc2_64_cbc());
128 EVP_add_cipher_alias(SN_rc2_cbc,"RC2");
129 EVP_add_cipher_alias(SN_rc2_cbc,"rc2");
130#endif
131
132#ifndef OPENSSL_NO_BF
133 EVP_add_cipher(EVP_bf_ecb());
134 EVP_add_cipher(EVP_bf_cfb());
135 EVP_add_cipher(EVP_bf_ofb());
136 EVP_add_cipher(EVP_bf_cbc());
137 EVP_add_cipher_alias(SN_bf_cbc,"BF");
138 EVP_add_cipher_alias(SN_bf_cbc,"bf");
139 EVP_add_cipher_alias(SN_bf_cbc,"blowfish");
140#endif
141
142#ifndef OPENSSL_NO_CAST
143 EVP_add_cipher(EVP_cast5_ecb());
144 EVP_add_cipher(EVP_cast5_cfb());
145 EVP_add_cipher(EVP_cast5_ofb());
146 EVP_add_cipher(EVP_cast5_cbc());
147 EVP_add_cipher_alias(SN_cast5_cbc,"CAST");
148 EVP_add_cipher_alias(SN_cast5_cbc,"cast");
149 EVP_add_cipher_alias(SN_cast5_cbc,"CAST-cbc");
150 EVP_add_cipher_alias(SN_cast5_cbc,"cast-cbc");
151#endif
152
153#ifndef OPENSSL_NO_RC5
154 EVP_add_cipher(EVP_rc5_32_12_16_ecb());
155 EVP_add_cipher(EVP_rc5_32_12_16_cfb());
156 EVP_add_cipher(EVP_rc5_32_12_16_ofb());
157 EVP_add_cipher(EVP_rc5_32_12_16_cbc());
158 EVP_add_cipher_alias(SN_rc5_cbc,"rc5");
159 EVP_add_cipher_alias(SN_rc5_cbc,"RC5");
160#endif
161
162#ifndef OPENSSL_NO_AES
163 EVP_add_cipher(EVP_aes_128_ecb());
164 EVP_add_cipher(EVP_aes_128_cbc());
165 EVP_add_cipher(EVP_aes_128_cfb());
166 EVP_add_cipher(EVP_aes_128_cfb1());
167 EVP_add_cipher(EVP_aes_128_cfb8());
168 EVP_add_cipher(EVP_aes_128_ofb());
169#if 0
170 EVP_add_cipher(EVP_aes_128_ctr());
171#endif
172 EVP_add_cipher_alias(SN_aes_128_cbc,"AES128");
173 EVP_add_cipher_alias(SN_aes_128_cbc,"aes128");
174 EVP_add_cipher(EVP_aes_192_ecb());
175 EVP_add_cipher(EVP_aes_192_cbc());
176 EVP_add_cipher(EVP_aes_192_cfb());
177 EVP_add_cipher(EVP_aes_192_cfb1());
178 EVP_add_cipher(EVP_aes_192_cfb8());
179 EVP_add_cipher(EVP_aes_192_ofb());
180#if 0
181 EVP_add_cipher(EVP_aes_192_ctr());
182#endif
183 EVP_add_cipher_alias(SN_aes_192_cbc,"AES192");
184 EVP_add_cipher_alias(SN_aes_192_cbc,"aes192");
185 EVP_add_cipher(EVP_aes_256_ecb());
186 EVP_add_cipher(EVP_aes_256_cbc());
187 EVP_add_cipher(EVP_aes_256_cfb());
188 EVP_add_cipher(EVP_aes_256_cfb1());
189 EVP_add_cipher(EVP_aes_256_cfb8());
190 EVP_add_cipher(EVP_aes_256_ofb());
191#if 0
192 EVP_add_cipher(EVP_aes_256_ctr());
193#endif
194 EVP_add_cipher_alias(SN_aes_256_cbc,"AES256");
195 EVP_add_cipher_alias(SN_aes_256_cbc,"aes256");
196#endif
197
198#ifndef OPENSSL_NO_CAMELLIA
199 EVP_add_cipher(EVP_camellia_128_ecb());
200 EVP_add_cipher(EVP_camellia_128_cbc());
201 EVP_add_cipher(EVP_camellia_128_cfb());
202 EVP_add_cipher(EVP_camellia_128_cfb1());
203 EVP_add_cipher(EVP_camellia_128_cfb8());
204 EVP_add_cipher(EVP_camellia_128_ofb());
205 EVP_add_cipher_alias(SN_camellia_128_cbc,"CAMELLIA128");
206 EVP_add_cipher_alias(SN_camellia_128_cbc,"camellia128");
207 EVP_add_cipher(EVP_camellia_192_ecb());
208 EVP_add_cipher(EVP_camellia_192_cbc());
209 EVP_add_cipher(EVP_camellia_192_cfb());
210 EVP_add_cipher(EVP_camellia_192_cfb1());
211 EVP_add_cipher(EVP_camellia_192_cfb8());
212 EVP_add_cipher(EVP_camellia_192_ofb());
213 EVP_add_cipher_alias(SN_camellia_192_cbc,"CAMELLIA192");
214 EVP_add_cipher_alias(SN_camellia_192_cbc,"camellia192");
215 EVP_add_cipher(EVP_camellia_256_ecb());
216 EVP_add_cipher(EVP_camellia_256_cbc());
217 EVP_add_cipher(EVP_camellia_256_cfb());
218 EVP_add_cipher(EVP_camellia_256_cfb1());
219 EVP_add_cipher(EVP_camellia_256_cfb8());
220 EVP_add_cipher(EVP_camellia_256_ofb());
221 EVP_add_cipher_alias(SN_camellia_256_cbc,"CAMELLIA256");
222 EVP_add_cipher_alias(SN_camellia_256_cbc,"camellia256");
223#endif
224 }
diff --git a/src/lib/libcrypto/evp/c_alld.c b/src/lib/libcrypto/evp/c_alld.c
new file mode 100644
index 0000000000..311e1fe2f8
--- /dev/null
+++ b/src/lib/libcrypto/evp/c_alld.c
@@ -0,0 +1,114 @@
1/* crypto/evp/c_alld.c */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved.
4 *
5 * This package is an SSL implementation written
6 * by Eric Young (eay@cryptsoft.com).
7 * The implementation was written so as to conform with Netscapes SSL.
8 *
9 * This library is free for commercial and non-commercial use as long as
10 * the following conditions are aheared to. The following conditions
11 * apply to all code found in this distribution, be it the RC4, RSA,
12 * lhash, DES, etc., code; not just the SSL code. The SSL documentation
13 * included with this distribution is covered by the same copyright terms
14 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
15 *
16 * Copyright remains Eric Young's, and as such any Copyright notices in
17 * the code are not to be removed.
18 * If this package is used in a product, Eric Young should be given attribution
19 * as the author of the parts of the library used.
20 * This can be in the form of a textual message at program startup or
21 * in documentation (online or textual) provided with the package.
22 *
23 * Redistribution and use in source and binary forms, with or without
24 * modification, are permitted provided that the following conditions
25 * are met:
26 * 1. Redistributions of source code must retain the copyright
27 * notice, this list of conditions and the following disclaimer.
28 * 2. Redistributions in binary form must reproduce the above copyright
29 * notice, this list of conditions and the following disclaimer in the
30 * documentation and/or other materials provided with the distribution.
31 * 3. All advertising materials mentioning features or use of this software
32 * must display the following acknowledgement:
33 * "This product includes cryptographic software written by
34 * Eric Young (eay@cryptsoft.com)"
35 * The word 'cryptographic' can be left out if the rouines from the library
36 * being used are not cryptographic related :-).
37 * 4. If you include any Windows specific code (or a derivative thereof) from
38 * the apps directory (application code) you must include an acknowledgement:
39 * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
40 *
41 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
42 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
43 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
44 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
45 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
46 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
47 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
49 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
50 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
51 * SUCH DAMAGE.
52 *
53 * The licence and distribution terms for any publically available version or
54 * derivative of this code cannot be changed. i.e. this code cannot simply be
55 * copied and put under another distribution licence
56 * [including the GNU Public Licence.]
57 */
58
59#include <stdio.h>
60#include "cryptlib.h"
61#include <openssl/evp.h>
62#include <openssl/pkcs12.h>
63#include <openssl/objects.h>
64
65void OpenSSL_add_all_digests(void)
66 {
67#ifndef OPENSSL_NO_MD4
68 EVP_add_digest(EVP_md4());
69#endif
70#ifndef OPENSSL_NO_MD5
71 EVP_add_digest(EVP_md5());
72 EVP_add_digest_alias(SN_md5,"ssl2-md5");
73 EVP_add_digest_alias(SN_md5,"ssl3-md5");
74#endif
75#if !defined(OPENSSL_NO_SHA) && !defined(OPENSSL_NO_SHA0)
76 EVP_add_digest(EVP_sha());
77#ifndef OPENSSL_NO_DSA
78 EVP_add_digest(EVP_dss());
79#endif
80#endif
81#if !defined(OPENSSL_NO_SHA) && !defined(OPENSSL_NO_SHA1)
82 EVP_add_digest(EVP_sha1());
83 EVP_add_digest_alias(SN_sha1,"ssl3-sha1");
84 EVP_add_digest_alias(SN_sha1WithRSAEncryption,SN_sha1WithRSA);
85#ifndef OPENSSL_NO_DSA
86 EVP_add_digest(EVP_dss1());
87 EVP_add_digest_alias(SN_dsaWithSHA1,SN_dsaWithSHA1_2);
88 EVP_add_digest_alias(SN_dsaWithSHA1,"DSS1");
89 EVP_add_digest_alias(SN_dsaWithSHA1,"dss1");
90#endif
91#ifndef OPENSSL_NO_ECDSA
92 EVP_add_digest(EVP_ecdsa());
93#endif
94#endif
95#if !defined(OPENSSL_NO_MDC2) && !defined(OPENSSL_NO_DES)
96 EVP_add_digest(EVP_mdc2());
97#endif
98#ifndef OPENSSL_NO_RIPEMD
99 EVP_add_digest(EVP_ripemd160());
100 EVP_add_digest_alias(SN_ripemd160,"ripemd");
101 EVP_add_digest_alias(SN_ripemd160,"rmd160");
102#endif
103#ifndef OPENSSL_NO_SHA256
104 EVP_add_digest(EVP_sha224());
105 EVP_add_digest(EVP_sha256());
106#endif
107#ifndef OPENSSL_NO_SHA512
108 EVP_add_digest(EVP_sha384());
109 EVP_add_digest(EVP_sha512());
110#endif
111#ifndef OPENSSL_NO_WHIRLPOOL
112 EVP_add_digest(EVP_whirlpool());
113#endif
114 }
diff --git a/src/lib/libcrypto/evp/e_acss.c b/src/lib/libcrypto/evp/e_acss.c
new file mode 100644
index 0000000000..9084a63d51
--- /dev/null
+++ b/src/lib/libcrypto/evp/e_acss.c
@@ -0,0 +1,85 @@
1/* $Id: e_acss.c,v 1.3 2010/10/01 23:33:22 djm Exp $ */
2/*
3 * Copyright (c) 2004 The OpenBSD project
4 *
5 * Permission to use, copy, modify, and distribute this software for any
6 * purpose with or without fee is hereby granted, provided that the above
7 * copyright notice and this permission notice appear in all copies.
8 *
9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16 */
17
18#ifndef OPENSSL_NO_ACSS
19
20#include "cryptlib.h"
21#include <openssl/evp.h>
22#include <openssl/objects.h>
23#include "evp_locl.h"
24#include <openssl/acss.h>
25
26typedef struct {
27 ACSS_KEY ks;
28} EVP_ACSS_KEY;
29
30#define data(ctx) EVP_C_DATA(EVP_ACSS_KEY,ctx)
31
32static int acss_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
33 const unsigned char *iv, int enc);
34static int acss_ciph(EVP_CIPHER_CTX *ctx, unsigned char *out,
35 const unsigned char *in, size_t inl);
36static int acss_ctrl(EVP_CIPHER_CTX *ctx, int type, int arg, void *ptr);
37static const EVP_CIPHER acss_cipher = {
38 NID_undef,
39 1,5,0,
40 0,
41 acss_init_key,
42 acss_ciph,
43 NULL,
44 sizeof(EVP_ACSS_KEY),
45 NULL,
46 NULL,
47 acss_ctrl,
48 NULL
49};
50
51const
52EVP_CIPHER *EVP_acss(void)
53{
54 return(&acss_cipher);
55}
56
57static int
58acss_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
59 const unsigned char *iv, int enc)
60{
61 acss_setkey(&data(ctx)->ks,key,enc,ACSS_MODE1);
62 return 1;
63}
64
65static int
66acss_ciph(EVP_CIPHER_CTX *ctx, unsigned char *out, const unsigned char *in,
67 size_t inl)
68{
69 acss(&data(ctx)->ks,inl,in,out);
70 return 1;
71}
72
73static int
74acss_ctrl(EVP_CIPHER_CTX *ctx, int type, int arg, void *ptr)
75{
76 switch(type) {
77 case EVP_CTRL_SET_ACSS_MODE:
78 data(ctx)->ks.mode = arg;
79 return 1;
80
81 default:
82 return -1;
83 }
84}
85#endif
diff --git a/src/lib/libcrypto/evp/e_dsa.c b/src/lib/libcrypto/evp/e_dsa.c
new file mode 100644
index 0000000000..b96f2738b3
--- /dev/null
+++ b/src/lib/libcrypto/evp/e_dsa.c
@@ -0,0 +1,71 @@
1/* crypto/evp/e_dsa.c */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved.
4 *
5 * This package is an SSL implementation written
6 * by Eric Young (eay@cryptsoft.com).
7 * The implementation was written so as to conform with Netscapes SSL.
8 *
9 * This library is free for commercial and non-commercial use as long as
10 * the following conditions are aheared to. The following conditions
11 * apply to all code found in this distribution, be it the RC4, RSA,
12 * lhash, DES, etc., code; not just the SSL code. The SSL documentation
13 * included with this distribution is covered by the same copyright terms
14 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
15 *
16 * Copyright remains Eric Young's, and as such any Copyright notices in
17 * the code are not to be removed.
18 * If this package is used in a product, Eric Young should be given attribution
19 * as the author of the parts of the library used.
20 * This can be in the form of a textual message at program startup or
21 * in documentation (online or textual) provided with the package.
22 *
23 * Redistribution and use in source and binary forms, with or without
24 * modification, are permitted provided that the following conditions
25 * are met:
26 * 1. Redistributions of source code must retain the copyright
27 * notice, this list of conditions and the following disclaimer.
28 * 2. Redistributions in binary form must reproduce the above copyright
29 * notice, this list of conditions and the following disclaimer in the
30 * documentation and/or other materials provided with the distribution.
31 * 3. All advertising materials mentioning features or use of this software
32 * must display the following acknowledgement:
33 * "This product includes cryptographic software written by
34 * Eric Young (eay@cryptsoft.com)"
35 * The word 'cryptographic' can be left out if the rouines from the library
36 * being used are not cryptographic related :-).
37 * 4. If you include any Windows specific code (or a derivative thereof) from
38 * the apps directory (application code) you must include an acknowledgement:
39 * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
40 *
41 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
42 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
43 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
44 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
45 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
46 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
47 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
49 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
50 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
51 * SUCH DAMAGE.
52 *
53 * The licence and distribution terms for any publically available version or
54 * derivative of this code cannot be changed. i.e. this code cannot simply be
55 * copied and put under another distribution licence
56 * [including the GNU Public Licence.]
57 */
58
59#include <stdio.h>
60#include "cryptlib.h"
61#include <openssl/evp.h>
62#include <openssl/objects.h>
63#include <openssl/x509.h>
64
65static EVP_PKEY_METHOD dss_method=
66 {
67 DSA_sign,
68 DSA_verify,
69 {EVP_PKEY_DSA,EVP_PKEY_DSA2,EVP_PKEY_DSA3,NULL},
70 };
71
diff --git a/src/lib/libcrypto/evp/e_rc5.c b/src/lib/libcrypto/evp/e_rc5.c
new file mode 100644
index 0000000000..19a10c6402
--- /dev/null
+++ b/src/lib/libcrypto/evp/e_rc5.c
@@ -0,0 +1,126 @@
1/* crypto/evp/e_rc5.c */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved.
4 *
5 * This package is an SSL implementation written
6 * by Eric Young (eay@cryptsoft.com).
7 * The implementation was written so as to conform with Netscapes SSL.
8 *
9 * This library is free for commercial and non-commercial use as long as
10 * the following conditions are aheared to. The following conditions
11 * apply to all code found in this distribution, be it the RC4, RSA,
12 * lhash, DES, etc., code; not just the SSL code. The SSL documentation
13 * included with this distribution is covered by the same copyright terms
14 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
15 *
16 * Copyright remains Eric Young's, and as such any Copyright notices in
17 * the code are not to be removed.
18 * If this package is used in a product, Eric Young should be given attribution
19 * as the author of the parts of the library used.
20 * This can be in the form of a textual message at program startup or
21 * in documentation (online or textual) provided with the package.
22 *
23 * Redistribution and use in source and binary forms, with or without
24 * modification, are permitted provided that the following conditions
25 * are met:
26 * 1. Redistributions of source code must retain the copyright
27 * notice, this list of conditions and the following disclaimer.
28 * 2. Redistributions in binary form must reproduce the above copyright
29 * notice, this list of conditions and the following disclaimer in the
30 * documentation and/or other materials provided with the distribution.
31 * 3. All advertising materials mentioning features or use of this software
32 * must display the following acknowledgement:
33 * "This product includes cryptographic software written by
34 * Eric Young (eay@cryptsoft.com)"
35 * The word 'cryptographic' can be left out if the rouines from the library
36 * being used are not cryptographic related :-).
37 * 4. If you include any Windows specific code (or a derivative thereof) from
38 * the apps directory (application code) you must include an acknowledgement:
39 * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
40 *
41 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
42 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
43 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
44 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
45 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
46 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
47 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
49 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
50 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
51 * SUCH DAMAGE.
52 *
53 * The licence and distribution terms for any publically available version or
54 * derivative of this code cannot be changed. i.e. this code cannot simply be
55 * copied and put under another distribution licence
56 * [including the GNU Public Licence.]
57 */
58
59#include <stdio.h>
60#include "cryptlib.h"
61
62#ifndef OPENSSL_NO_RC5
63
64#include <openssl/evp.h>
65#include <openssl/objects.h>
66#include "evp_locl.h"
67#include <openssl/rc5.h>
68
69static int r_32_12_16_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
70 const unsigned char *iv,int enc);
71static int rc5_ctrl(EVP_CIPHER_CTX *c, int type, int arg, void *ptr);
72
73typedef struct
74 {
75 int rounds; /* number of rounds */
76 RC5_32_KEY ks; /* key schedule */
77 } EVP_RC5_KEY;
78
79#define data(ctx) EVP_C_DATA(EVP_RC5_KEY,ctx)
80
81IMPLEMENT_BLOCK_CIPHER(rc5_32_12_16, ks, RC5_32, EVP_RC5_KEY, NID_rc5,
82 8, RC5_32_KEY_LENGTH, 8, 64,
83 EVP_CIPH_VARIABLE_LENGTH | EVP_CIPH_CTRL_INIT,
84 r_32_12_16_init_key, NULL,
85 NULL, NULL, rc5_ctrl)
86
87static int rc5_ctrl(EVP_CIPHER_CTX *c, int type, int arg, void *ptr)
88 {
89 switch(type)
90 {
91 case EVP_CTRL_INIT:
92 data(c)->rounds = RC5_12_ROUNDS;
93 return 1;
94
95 case EVP_CTRL_GET_RC5_ROUNDS:
96 *(int *)ptr = data(c)->rounds;
97 return 1;
98
99 case EVP_CTRL_SET_RC5_ROUNDS:
100 switch(arg)
101 {
102 case RC5_8_ROUNDS:
103 case RC5_12_ROUNDS:
104 case RC5_16_ROUNDS:
105 data(c)->rounds = arg;
106 return 1;
107
108 default:
109 EVPerr(EVP_F_RC5_CTRL, EVP_R_UNSUPORTED_NUMBER_OF_ROUNDS);
110 return 0;
111 }
112
113 default:
114 return -1;
115 }
116 }
117
118static int r_32_12_16_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
119 const unsigned char *iv, int enc)
120 {
121 RC5_32_set_key(&data(ctx)->ks,EVP_CIPHER_CTX_key_length(ctx),
122 key,data(ctx)->rounds);
123 return 1;
124 }
125
126#endif
diff --git a/src/lib/libcrypto/evp/e_seed.c b/src/lib/libcrypto/evp/e_seed.c
new file mode 100644
index 0000000000..2d1759d276
--- /dev/null
+++ b/src/lib/libcrypto/evp/e_seed.c
@@ -0,0 +1,83 @@
1/* crypto/evp/e_seed.c -*- mode:C; c-file-style: "eay" -*- */
2/* ====================================================================
3 * Copyright (c) 2007 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 */
55
56#include <openssl/opensslconf.h>
57#ifndef OPENSSL_NO_SEED
58#include <openssl/evp.h>
59#include <openssl/err.h>
60#include <string.h>
61#include <assert.h>
62#include <openssl/seed.h>
63#include "evp_locl.h"
64
65static int seed_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, const unsigned char *iv, int enc);
66
67typedef struct
68 {
69 SEED_KEY_SCHEDULE ks;
70 } EVP_SEED_KEY;
71
72IMPLEMENT_BLOCK_CIPHER(seed, ks, SEED, EVP_SEED_KEY, NID_seed,
73 16, 16, 16, 128,
74 0, seed_init_key, 0, 0, 0, 0)
75
76static int seed_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
77 const unsigned char *iv, int enc)
78 {
79 SEED_set_key(key, ctx->cipher_data);
80 return 1;
81 }
82
83#endif
diff --git a/src/lib/libcrypto/evp/encode.c b/src/lib/libcrypto/evp/encode.c
index 28546a84bc..b42c747249 100644
--- a/src/lib/libcrypto/evp/encode.c
+++ b/src/lib/libcrypto/evp/encode.c
@@ -235,7 +235,7 @@ void EVP_DecodeInit(EVP_ENCODE_CTX *ctx)
235int EVP_DecodeUpdate(EVP_ENCODE_CTX *ctx, unsigned char *out, int *outl, 235int EVP_DecodeUpdate(EVP_ENCODE_CTX *ctx, unsigned char *out, int *outl,
236 const unsigned char *in, int inl) 236 const unsigned char *in, int inl)
237 { 237 {
238 int seof= -1,eof=0,rv= -1,ret=0,i,v,tmp,n,ln,exp_nl; 238 int seof= -1,eof=0,rv= -1,ret=0,i,v,tmp,n,ln,tmp2,exp_nl;
239 unsigned char *d; 239 unsigned char *d;
240 240
241 n=ctx->num; 241 n=ctx->num;
@@ -319,6 +319,7 @@ int EVP_DecodeUpdate(EVP_ENCODE_CTX *ctx, unsigned char *out, int *outl,
319 * lines. We process the line and then need to 319 * lines. We process the line and then need to
320 * accept the '\n' */ 320 * accept the '\n' */
321 if ((v != B64_EOF) && (n >= 64)) exp_nl=1; 321 if ((v != B64_EOF) && (n >= 64)) exp_nl=1;
322 tmp2=v;
322 if (n > 0) 323 if (n > 0)
323 { 324 {
324 v=EVP_DecodeBlock(out,d,n); 325 v=EVP_DecodeBlock(out,d,n);
diff --git a/src/lib/libcrypto/evp/evp.h b/src/lib/libcrypto/evp/evp.h
index 9f9795e2d9..da93e945f5 100644
--- a/src/lib/libcrypto/evp/evp.h
+++ b/src/lib/libcrypto/evp/evp.h
@@ -358,6 +358,7 @@ struct evp_cipher_st
358#define EVP_CTRL_RAND_KEY 0x6 358#define EVP_CTRL_RAND_KEY 0x6
359#define EVP_CTRL_PBE_PRF_NID 0x7 359#define EVP_CTRL_PBE_PRF_NID 0x7
360#define EVP_CTRL_COPY 0x8 360#define EVP_CTRL_COPY 0x8
361#define EVP_CTRL_SET_ACSS_MODE 0x9
361 362
362typedef struct evp_cipher_info_st 363typedef struct evp_cipher_info_st
363 { 364 {
@@ -765,6 +766,9 @@ const EVP_CIPHER *EVP_aes_256_ofb(void);
765const EVP_CIPHER *EVP_aes_256_ctr(void); 766const EVP_CIPHER *EVP_aes_256_ctr(void);
766#endif 767#endif
767#endif 768#endif
769#ifndef OPENSSL_NO_ACSS
770const EVP_CIPHER *EVP_acss(void);
771#endif
768#ifndef OPENSSL_NO_CAMELLIA 772#ifndef OPENSSL_NO_CAMELLIA
769const EVP_CIPHER *EVP_camellia_128_ecb(void); 773const EVP_CIPHER *EVP_camellia_128_ecb(void);
770const EVP_CIPHER *EVP_camellia_128_cbc(void); 774const EVP_CIPHER *EVP_camellia_128_cbc(void);
@@ -1190,6 +1194,7 @@ void ERR_load_EVP_strings(void);
1190/* Error codes for the EVP functions. */ 1194/* Error codes for the EVP functions. */
1191 1195
1192/* Function codes. */ 1196/* Function codes. */
1197#define EVP_F_AESNI_INIT_KEY 165
1193#define EVP_F_AES_INIT_KEY 133 1198#define EVP_F_AES_INIT_KEY 133
1194#define EVP_F_CAMELLIA_INIT_KEY 159 1199#define EVP_F_CAMELLIA_INIT_KEY 159
1195#define EVP_F_D2I_PKEY 100 1200#define EVP_F_D2I_PKEY 100
diff --git a/src/lib/libcrypto/evp/evp_acnf.c b/src/lib/libcrypto/evp/evp_acnf.c
new file mode 100644
index 0000000000..643a1864e8
--- /dev/null
+++ b/src/lib/libcrypto/evp/evp_acnf.c
@@ -0,0 +1,73 @@
1/* evp_acnf.c */
2/* Written by Stephen Henson (steve@openssl.org) for the OpenSSL
3 * project 2001.
4 */
5/* ====================================================================
6 * Copyright (c) 2001 The OpenSSL Project. All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 *
12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 *
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in
17 * the documentation and/or other materials provided with the
18 * distribution.
19 *
20 * 3. All advertising materials mentioning features or use of this
21 * software must display the following acknowledgment:
22 * "This product includes software developed by the OpenSSL Project
23 * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
24 *
25 * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
26 * endorse or promote products derived from this software without
27 * prior written permission. For written permission, please contact
28 * licensing@OpenSSL.org.
29 *
30 * 5. Products derived from this software may not be called "OpenSSL"
31 * nor may "OpenSSL" appear in their names without prior written
32 * permission of the OpenSSL Project.
33 *
34 * 6. Redistributions of any form whatsoever must retain the following
35 * acknowledgment:
36 * "This product includes software developed by the OpenSSL Project
37 * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
38 *
39 * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
40 * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
41 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
42 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
43 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
44 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
45 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
46 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
47 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
48 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
49 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
50 * OF THE POSSIBILITY OF SUCH DAMAGE.
51 * ====================================================================
52 *
53 * This product includes cryptographic software written by Eric Young
54 * (eay@cryptsoft.com). This product includes software written by Tim
55 * Hudson (tjh@cryptsoft.com).
56 *
57 */
58
59#include "cryptlib.h"
60#include <openssl/evp.h>
61#include <openssl/conf.h>
62
63
64/* Load all algorithms and configure OpenSSL.
65 * This function is called automatically when
66 * OPENSSL_LOAD_CONF is set.
67 */
68
69void OPENSSL_add_all_algorithms_conf(void)
70 {
71 OPENSSL_add_all_algorithms_noconf();
72 OPENSSL_config(NULL);
73 }
diff --git a/src/lib/libcrypto/evp/evp_enc.c b/src/lib/libcrypto/evp/evp_enc.c
index c268d25cb4..bead6a2170 100644
--- a/src/lib/libcrypto/evp/evp_enc.c
+++ b/src/lib/libcrypto/evp/evp_enc.c
@@ -204,7 +204,6 @@ skip_to_init:
204 case EVP_CIPH_OFB_MODE: 204 case EVP_CIPH_OFB_MODE:
205 205
206 ctx->num = 0; 206 ctx->num = 0;
207 /* fall-through */
208 207
209 case EVP_CIPH_CBC_MODE: 208 case EVP_CIPH_CBC_MODE:
210 209
diff --git a/src/lib/libcrypto/evp/evp_err.c b/src/lib/libcrypto/evp/evp_err.c
index d8bfec0959..6b585c7483 100644
--- a/src/lib/libcrypto/evp/evp_err.c
+++ b/src/lib/libcrypto/evp/evp_err.c
@@ -70,6 +70,7 @@
70 70
71static ERR_STRING_DATA EVP_str_functs[]= 71static ERR_STRING_DATA EVP_str_functs[]=
72 { 72 {
73{ERR_FUNC(EVP_F_AESNI_INIT_KEY), "AESNI_INIT_KEY"},
73{ERR_FUNC(EVP_F_AES_INIT_KEY), "AES_INIT_KEY"}, 74{ERR_FUNC(EVP_F_AES_INIT_KEY), "AES_INIT_KEY"},
74{ERR_FUNC(EVP_F_CAMELLIA_INIT_KEY), "CAMELLIA_INIT_KEY"}, 75{ERR_FUNC(EVP_F_CAMELLIA_INIT_KEY), "CAMELLIA_INIT_KEY"},
75{ERR_FUNC(EVP_F_D2I_PKEY), "D2I_PKEY"}, 76{ERR_FUNC(EVP_F_D2I_PKEY), "D2I_PKEY"},
diff --git a/src/lib/libcrypto/evp/evp_test.c b/src/lib/libcrypto/evp/evp_test.c
new file mode 100644
index 0000000000..902efac975
--- /dev/null
+++ b/src/lib/libcrypto/evp/evp_test.c
@@ -0,0 +1,449 @@
1/* Written by Ben Laurie, 2001 */
2/*
3 * Copyright (c) 2001 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#include <stdio.h>
51#include <string.h>
52
53#include "../e_os.h"
54
55#include <openssl/opensslconf.h>
56#include <openssl/evp.h>
57#ifndef OPENSSL_NO_ENGINE
58#include <openssl/engine.h>
59#endif
60#include <openssl/err.h>
61#include <openssl/conf.h>
62
63static void hexdump(FILE *f,const char *title,const unsigned char *s,int l)
64 {
65 int n=0;
66
67 fprintf(f,"%s",title);
68 for( ; n < l ; ++n)
69 {
70 if((n%16) == 0)
71 fprintf(f,"\n%04x",n);
72 fprintf(f," %02x",s[n]);
73 }
74 fprintf(f,"\n");
75 }
76
77static int convert(unsigned char *s)
78 {
79 unsigned char *d;
80
81 for(d=s ; *s ; s+=2,++d)
82 {
83 unsigned int n;
84
85 if(!s[1])
86 {
87 fprintf(stderr,"Odd number of hex digits!");
88 EXIT(4);
89 }
90 sscanf((char *)s,"%2x",&n);
91 *d=(unsigned char)n;
92 }
93 return s-d;
94 }
95
96static char *sstrsep(char **string, const char *delim)
97 {
98 char isdelim[256];
99 char *token = *string;
100
101 if (**string == 0)
102 return NULL;
103
104 memset(isdelim, 0, 256);
105 isdelim[0] = 1;
106
107 while (*delim)
108 {
109 isdelim[(unsigned char)(*delim)] = 1;
110 delim++;
111 }
112
113 while (!isdelim[(unsigned char)(**string)])
114 {
115 (*string)++;
116 }
117
118 if (**string)
119 {
120 **string = 0;
121 (*string)++;
122 }
123
124 return token;
125 }
126
127static unsigned char *ustrsep(char **p,const char *sep)
128 { return (unsigned char *)sstrsep(p,sep); }
129
130static int test1_exit(int ec)
131 {
132 EXIT(ec);
133 return(0); /* To keep some compilers quiet */
134 }
135
136static void test1(const EVP_CIPHER *c,const unsigned char *key,int kn,
137 const unsigned char *iv,int in,
138 const unsigned char *plaintext,int pn,
139 const unsigned char *ciphertext,int cn,
140 int encdec)
141 {
142 EVP_CIPHER_CTX ctx;
143 unsigned char out[4096];
144 int outl,outl2;
145
146 printf("Testing cipher %s%s\n",EVP_CIPHER_name(c),
147 (encdec == 1 ? "(encrypt)" : (encdec == 0 ? "(decrypt)" : "(encrypt/decrypt)")));
148 hexdump(stdout,"Key",key,kn);
149 if(in)
150 hexdump(stdout,"IV",iv,in);
151 hexdump(stdout,"Plaintext",plaintext,pn);
152 hexdump(stdout,"Ciphertext",ciphertext,cn);
153
154 if(kn != c->key_len)
155 {
156 fprintf(stderr,"Key length doesn't match, got %d expected %lu\n",kn,
157 (unsigned long)c->key_len);
158 test1_exit(5);
159 }
160 EVP_CIPHER_CTX_init(&ctx);
161 if (encdec != 0)
162 {
163 if(!EVP_EncryptInit_ex(&ctx,c,NULL,key,iv))
164 {
165 fprintf(stderr,"EncryptInit failed\n");
166 ERR_print_errors_fp(stderr);
167 test1_exit(10);
168 }
169 EVP_CIPHER_CTX_set_padding(&ctx,0);
170
171 if(!EVP_EncryptUpdate(&ctx,out,&outl,plaintext,pn))
172 {
173 fprintf(stderr,"Encrypt failed\n");
174 ERR_print_errors_fp(stderr);
175 test1_exit(6);
176 }
177 if(!EVP_EncryptFinal_ex(&ctx,out+outl,&outl2))
178 {
179 fprintf(stderr,"EncryptFinal failed\n");
180 ERR_print_errors_fp(stderr);
181 test1_exit(7);
182 }
183
184 if(outl+outl2 != cn)
185 {
186 fprintf(stderr,"Ciphertext length mismatch got %d expected %d\n",
187 outl+outl2,cn);
188 test1_exit(8);
189 }
190
191 if(memcmp(out,ciphertext,cn))
192 {
193 fprintf(stderr,"Ciphertext mismatch\n");
194 hexdump(stderr,"Got",out,cn);
195 hexdump(stderr,"Expected",ciphertext,cn);
196 test1_exit(9);
197 }
198 }
199
200 if (encdec <= 0)
201 {
202 if(!EVP_DecryptInit_ex(&ctx,c,NULL,key,iv))
203 {
204 fprintf(stderr,"DecryptInit failed\n");
205 ERR_print_errors_fp(stderr);
206 test1_exit(11);
207 }
208 EVP_CIPHER_CTX_set_padding(&ctx,0);
209
210 if(!EVP_DecryptUpdate(&ctx,out,&outl,ciphertext,cn))
211 {
212 fprintf(stderr,"Decrypt failed\n");
213 ERR_print_errors_fp(stderr);
214 test1_exit(6);
215 }
216 if(!EVP_DecryptFinal_ex(&ctx,out+outl,&outl2))
217 {
218 fprintf(stderr,"DecryptFinal failed\n");
219 ERR_print_errors_fp(stderr);
220 test1_exit(7);
221 }
222
223 if(outl+outl2 != pn)
224 {
225 fprintf(stderr,"Plaintext length mismatch got %d expected %d\n",
226 outl+outl2,pn);
227 test1_exit(8);
228 }
229
230 if(memcmp(out,plaintext,pn))
231 {
232 fprintf(stderr,"Plaintext mismatch\n");
233 hexdump(stderr,"Got",out,pn);
234 hexdump(stderr,"Expected",plaintext,pn);
235 test1_exit(9);
236 }
237 }
238
239 EVP_CIPHER_CTX_cleanup(&ctx);
240
241 printf("\n");
242 }
243
244static int test_cipher(const char *cipher,const unsigned char *key,int kn,
245 const unsigned char *iv,int in,
246 const unsigned char *plaintext,int pn,
247 const unsigned char *ciphertext,int cn,
248 int encdec)
249 {
250 const EVP_CIPHER *c;
251
252 c=EVP_get_cipherbyname(cipher);
253 if(!c)
254 return 0;
255
256 test1(c,key,kn,iv,in,plaintext,pn,ciphertext,cn,encdec);
257
258 return 1;
259 }
260
261static int test_digest(const char *digest,
262 const unsigned char *plaintext,int pn,
263 const unsigned char *ciphertext, unsigned int cn)
264 {
265 const EVP_MD *d;
266 EVP_MD_CTX ctx;
267 unsigned char md[EVP_MAX_MD_SIZE];
268 unsigned int mdn;
269
270 d=EVP_get_digestbyname(digest);
271 if(!d)
272 return 0;
273
274 printf("Testing digest %s\n",EVP_MD_name(d));
275 hexdump(stdout,"Plaintext",plaintext,pn);
276 hexdump(stdout,"Digest",ciphertext,cn);
277
278 EVP_MD_CTX_init(&ctx);
279 if(!EVP_DigestInit_ex(&ctx,d, NULL))
280 {
281 fprintf(stderr,"DigestInit failed\n");
282 ERR_print_errors_fp(stderr);
283 EXIT(100);
284 }
285 if(!EVP_DigestUpdate(&ctx,plaintext,pn))
286 {
287 fprintf(stderr,"DigestUpdate failed\n");
288 ERR_print_errors_fp(stderr);
289 EXIT(101);
290 }
291 if(!EVP_DigestFinal_ex(&ctx,md,&mdn))
292 {
293 fprintf(stderr,"DigestFinal failed\n");
294 ERR_print_errors_fp(stderr);
295 EXIT(101);
296 }
297 EVP_MD_CTX_cleanup(&ctx);
298
299 if(mdn != cn)
300 {
301 fprintf(stderr,"Digest length mismatch, got %d expected %d\n",mdn,cn);
302 EXIT(102);
303 }
304
305 if(memcmp(md,ciphertext,cn))
306 {
307 fprintf(stderr,"Digest mismatch\n");
308 hexdump(stderr,"Got",md,cn);
309 hexdump(stderr,"Expected",ciphertext,cn);
310 EXIT(103);
311 }
312
313 printf("\n");
314
315 EVP_MD_CTX_cleanup(&ctx);
316
317 return 1;
318 }
319
320int main(int argc,char **argv)
321 {
322 const char *szTestFile;
323 FILE *f;
324
325 if(argc != 2)
326 {
327 fprintf(stderr,"%s <test file>\n",argv[0]);
328 EXIT(1);
329 }
330 CRYPTO_malloc_debug_init();
331 CRYPTO_set_mem_debug_options(V_CRYPTO_MDEBUG_ALL);
332 CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ON);
333
334 szTestFile=argv[1];
335
336 f=fopen(szTestFile,"r");
337 if(!f)
338 {
339 perror(szTestFile);
340 EXIT(2);
341 }
342
343 /* Load up the software EVP_CIPHER and EVP_MD definitions */
344 OpenSSL_add_all_ciphers();
345 OpenSSL_add_all_digests();
346#ifndef OPENSSL_NO_ENGINE
347 /* Load all compiled-in ENGINEs */
348 ENGINE_load_builtin_engines();
349#endif
350#if 0
351 OPENSSL_config();
352#endif
353#ifndef OPENSSL_NO_ENGINE
354 /* Register all available ENGINE implementations of ciphers and digests.
355 * This could perhaps be changed to "ENGINE_register_all_complete()"? */
356 ENGINE_register_all_ciphers();
357 ENGINE_register_all_digests();
358 /* If we add command-line options, this statement should be switchable.
359 * It'll prevent ENGINEs being ENGINE_init()ialised for cipher/digest use if
360 * they weren't already initialised. */
361 /* ENGINE_set_cipher_flags(ENGINE_CIPHER_FLAG_NOINIT); */
362#endif
363
364 for( ; ; )
365 {
366 char line[4096];
367 char *p;
368 char *cipher;
369 unsigned char *iv,*key,*plaintext,*ciphertext;
370 int encdec;
371 int kn,in,pn,cn;
372
373 if(!fgets((char *)line,sizeof line,f))
374 break;
375 if(line[0] == '#' || line[0] == '\n')
376 continue;
377 p=line;
378 cipher=sstrsep(&p,":");
379 key=ustrsep(&p,":");
380 iv=ustrsep(&p,":");
381 plaintext=ustrsep(&p,":");
382 ciphertext=ustrsep(&p,":");
383 if (p[-1] == '\n') {
384 p[-1] = '\0';
385 encdec = -1;
386 } else {
387 encdec = atoi(sstrsep(&p,"\n"));
388 }
389
390
391 kn=convert(key);
392 in=convert(iv);
393 pn=convert(plaintext);
394 cn=convert(ciphertext);
395
396 if(!test_cipher(cipher,key,kn,iv,in,plaintext,pn,ciphertext,cn,encdec)
397 && !test_digest(cipher,plaintext,pn,ciphertext,cn))
398 {
399#ifdef OPENSSL_NO_AES
400 if (strstr(cipher, "AES") == cipher)
401 {
402 fprintf(stdout, "Cipher disabled, skipping %s\n", cipher);
403 continue;
404 }
405#endif
406#ifdef OPENSSL_NO_DES
407 if (strstr(cipher, "DES") == cipher)
408 {
409 fprintf(stdout, "Cipher disabled, skipping %s\n", cipher);
410 continue;
411 }
412#endif
413#ifdef OPENSSL_NO_RC4
414 if (strstr(cipher, "RC4") == cipher)
415 {
416 fprintf(stdout, "Cipher disabled, skipping %s\n", cipher);
417 continue;
418 }
419#endif
420#ifdef OPENSSL_NO_CAMELLIA
421 if (strstr(cipher, "CAMELLIA") == cipher)
422 {
423 fprintf(stdout, "Cipher disabled, skipping %s\n", cipher);
424 continue;
425 }
426#endif
427#ifdef OPENSSL_NO_SEED
428 if (strstr(cipher, "SEED") == cipher)
429 {
430 fprintf(stdout, "Cipher disabled, skipping %s\n", cipher);
431 continue;
432 }
433#endif
434 fprintf(stderr,"Can't find %s\n",cipher);
435 EXIT(3);
436 }
437 }
438
439#ifndef OPENSSL_NO_ENGINE
440 ENGINE_cleanup();
441#endif
442 EVP_cleanup();
443 CRYPTO_cleanup_all_ex_data();
444 ERR_remove_thread_state(NULL);
445 ERR_free_strings();
446 CRYPTO_mem_leaks_fp(stderr);
447
448 return 0;
449 }
diff --git a/src/lib/libcrypto/evp/evptests.txt b/src/lib/libcrypto/evp/evptests.txt
new file mode 100644
index 0000000000..beb12144b6
--- /dev/null
+++ b/src/lib/libcrypto/evp/evptests.txt
@@ -0,0 +1,321 @@
1#cipher:key:iv:plaintext:ciphertext:0/1(decrypt/encrypt)
2#digest:::input:output
3
4# SHA(1) tests (from shatest.c)
5SHA1:::616263:a9993e364706816aba3e25717850c26c9cd0d89d
6
7# MD5 tests (from md5test.c)
8MD5::::d41d8cd98f00b204e9800998ecf8427e
9MD5:::61:0cc175b9c0f1b6a831c399e269772661
10MD5:::616263:900150983cd24fb0d6963f7d28e17f72
11MD5:::6d65737361676520646967657374:f96b697d7cb7938d525a2f31aaf161d0
12MD5:::6162636465666768696a6b6c6d6e6f707172737475767778797a:c3fcd3d76192e4007dfb496cca67e13b
13MD5:::4142434445464748494a4b4c4d4e4f505152535455565758595a6162636465666768696a6b6c6d6e6f707172737475767778797a30313233343536373839:d174ab98d277d9f5a5611c2c9f419d9f
14MD5:::3132333435363738393031323334353637383930313233343536373839303132333435363738393031323334353637383930313233343536373839303132333435363738393031323334353637383930:57edf4a22be3c955ac49da2e2107b67a
15
16# AES 128 ECB tests (from FIPS-197 test vectors, encrypt)
17
18AES-128-ECB:000102030405060708090A0B0C0D0E0F::00112233445566778899AABBCCDDEEFF:69C4E0D86A7B0430D8CDB78070B4C55A:1
19
20# AES 192 ECB tests (from FIPS-197 test vectors, encrypt)
21
22AES-192-ECB:000102030405060708090A0B0C0D0E0F1011121314151617::00112233445566778899AABBCCDDEEFF:DDA97CA4864CDFE06EAF70A0EC0D7191:1
23
24# AES 256 ECB tests (from FIPS-197 test vectors, encrypt)
25
26AES-256-ECB:000102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1F::00112233445566778899AABBCCDDEEFF:8EA2B7CA516745BFEAFC49904B496089:1
27
28# AES 128 ECB tests (from NIST test vectors, encrypt)
29
30#AES-128-ECB:00000000000000000000000000000000::00000000000000000000000000000000:C34C052CC0DA8D73451AFE5F03BE297F:1
31
32# AES 128 ECB tests (from NIST test vectors, decrypt)
33
34#AES-128-ECB:00000000000000000000000000000000::44416AC2D1F53C583303917E6BE9EBE0:00000000000000000000000000000000:0
35
36# AES 192 ECB tests (from NIST test vectors, decrypt)
37
38#AES-192-ECB:000000000000000000000000000000000000000000000000::48E31E9E256718F29229319C19F15BA4:00000000000000000000000000000000:0
39
40# AES 256 ECB tests (from NIST test vectors, decrypt)
41
42#AES-256-ECB:0000000000000000000000000000000000000000000000000000000000000000::058CCFFDBBCB382D1F6F56585D8A4ADE:00000000000000000000000000000000:0
43
44# AES 128 CBC tests (from NIST test vectors, encrypt)
45
46#AES-128-CBC:00000000000000000000000000000000:00000000000000000000000000000000:00000000000000000000000000000000:8A05FC5E095AF4848A08D328D3688E3D:1
47
48# AES 192 CBC tests (from NIST test vectors, encrypt)
49
50#AES-192-CBC:000000000000000000000000000000000000000000000000:00000000000000000000000000000000:00000000000000000000000000000000:7BD966D53AD8C1BB85D2ADFAE87BB104:1
51
52# AES 256 CBC tests (from NIST test vectors, encrypt)
53
54#AES-256-CBC:0000000000000000000000000000000000000000000000000000000000000000:00000000000000000000000000000000:00000000000000000000000000000000:FE3C53653E2F45B56FCD88B2CC898FF0:1
55
56# AES 128 CBC tests (from NIST test vectors, decrypt)
57
58#AES-128-CBC:00000000000000000000000000000000:00000000000000000000000000000000:FACA37E0B0C85373DF706E73F7C9AF86:00000000000000000000000000000000:0
59
60# AES tests from NIST document SP800-38A
61# For all ECB encrypts and decrypts, the transformed sequence is
62# AES-bits-ECB:key::plaintext:ciphertext:encdec
63# ECB-AES128.Encrypt and ECB-AES128.Decrypt
64AES-128-ECB:2B7E151628AED2A6ABF7158809CF4F3C::6BC1BEE22E409F96E93D7E117393172A:3AD77BB40D7A3660A89ECAF32466EF97
65AES-128-ECB:2B7E151628AED2A6ABF7158809CF4F3C::AE2D8A571E03AC9C9EB76FAC45AF8E51:F5D3D58503B9699DE785895A96FDBAAF
66AES-128-ECB:2B7E151628AED2A6ABF7158809CF4F3C::30C81C46A35CE411E5FBC1191A0A52EF:43B1CD7F598ECE23881B00E3ED030688
67AES-128-ECB:2B7E151628AED2A6ABF7158809CF4F3C::F69F2445DF4F9B17AD2B417BE66C3710:7B0C785E27E8AD3F8223207104725DD4
68# ECB-AES192.Encrypt and ECB-AES192.Decrypt
69AES-192-ECB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B::6BC1BEE22E409F96E93D7E117393172A:BD334F1D6E45F25FF712A214571FA5CC
70AES-192-ECB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B::AE2D8A571E03AC9C9EB76FAC45AF8E51:974104846D0AD3AD7734ECB3ECEE4EEF
71AES-192-ECB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B::30C81C46A35CE411E5FBC1191A0A52EF:EF7AFD2270E2E60ADCE0BA2FACE6444E
72AES-192-ECB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B::F69F2445DF4F9B17AD2B417BE66C3710:9A4B41BA738D6C72FB16691603C18E0E
73# ECB-AES256.Encrypt and ECB-AES256.Decrypt
74AES-256-ECB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4::6BC1BEE22E409F96E93D7E117393172A:F3EED1BDB5D2A03C064B5A7E3DB181F8
75AES-256-ECB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4::AE2D8A571E03AC9C9EB76FAC45AF8E51:591CCB10D410ED26DC5BA74A31362870
76AES-256-ECB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4::30C81C46A35CE411E5FBC1191A0A52EF:B6ED21B99CA6F4F9F153E7B1BEAFED1D
77AES-256-ECB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4::F69F2445DF4F9B17AD2B417BE66C3710:23304B7A39F9F3FF067D8D8F9E24ECC7
78# For all CBC encrypts and decrypts, the transformed sequence is
79# AES-bits-CBC:key:IV/ciphertext':plaintext:ciphertext:encdec
80# CBC-AES128.Encrypt and CBC-AES128.Decrypt
81AES-128-CBC:2B7E151628AED2A6ABF7158809CF4F3C:000102030405060708090A0B0C0D0E0F:6BC1BEE22E409F96E93D7E117393172A:7649ABAC8119B246CEE98E9B12E9197D
82AES-128-CBC:2B7E151628AED2A6ABF7158809CF4F3C:7649ABAC8119B246CEE98E9B12E9197D:AE2D8A571E03AC9C9EB76FAC45AF8E51:5086CB9B507219EE95DB113A917678B2
83AES-128-CBC:2B7E151628AED2A6ABF7158809CF4F3C:5086CB9B507219EE95DB113A917678B2:30C81C46A35CE411E5FBC1191A0A52EF:73BED6B8E3C1743B7116E69E22229516
84AES-128-CBC:2B7E151628AED2A6ABF7158809CF4F3C:73BED6B8E3C1743B7116E69E22229516:F69F2445DF4F9B17AD2B417BE66C3710:3FF1CAA1681FAC09120ECA307586E1A7
85# CBC-AES192.Encrypt and CBC-AES192.Decrypt
86AES-192-CBC:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:000102030405060708090A0B0C0D0E0F:6BC1BEE22E409F96E93D7E117393172A:4F021DB243BC633D7178183A9FA071E8
87AES-192-CBC:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:4F021DB243BC633D7178183A9FA071E8:AE2D8A571E03AC9C9EB76FAC45AF8E51:B4D9ADA9AD7DEDF4E5E738763F69145A
88AES-192-CBC:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:B4D9ADA9AD7DEDF4E5E738763F69145A:30C81C46A35CE411E5FBC1191A0A52EF:571B242012FB7AE07FA9BAAC3DF102E0
89AES-192-CBC:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:571B242012FB7AE07FA9BAAC3DF102E0:F69F2445DF4F9B17AD2B417BE66C3710:08B0E27988598881D920A9E64F5615CD
90# CBC-AES256.Encrypt and CBC-AES256.Decrypt
91AES-256-CBC:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:000102030405060708090A0B0C0D0E0F:6BC1BEE22E409F96E93D7E117393172A:F58C4C04D6E5F1BA779EABFB5F7BFBD6
92AES-256-CBC:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:F58C4C04D6E5F1BA779EABFB5F7BFBD6:AE2D8A571E03AC9C9EB76FAC45AF8E51:9CFC4E967EDB808D679F777BC6702C7D
93AES-256-CBC:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:9CFC4E967EDB808D679F777BC6702C7D:30C81C46A35CE411E5FBC1191A0A52EF:39F23369A9D9BACFA530E26304231461
94AES-256-CBC:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:39F23369A9D9BACFA530E26304231461:F69F2445DF4F9B17AD2B417BE66C3710:B2EB05E2C39BE9FCDA6C19078C6A9D1B
95# We don't support CFB{1,8}-AESxxx.{En,De}crypt
96# For all CFB128 encrypts and decrypts, the transformed sequence is
97# AES-bits-CFB:key:IV/ciphertext':plaintext:ciphertext:encdec
98# CFB128-AES128.Encrypt
99AES-128-CFB:2B7E151628AED2A6ABF7158809CF4F3C:000102030405060708090A0B0C0D0E0F:6BC1BEE22E409F96E93D7E117393172A:3B3FD92EB72DAD20333449F8E83CFB4A:1
100AES-128-CFB:2B7E151628AED2A6ABF7158809CF4F3C:3B3FD92EB72DAD20333449F8E83CFB4A:AE2D8A571E03AC9C9EB76FAC45AF8E51:C8A64537A0B3A93FCDE3CDAD9F1CE58B:1
101AES-128-CFB:2B7E151628AED2A6ABF7158809CF4F3C:C8A64537A0B3A93FCDE3CDAD9F1CE58B:30C81C46A35CE411E5FBC1191A0A52EF:26751F67A3CBB140B1808CF187A4F4DF:1
102AES-128-CFB:2B7E151628AED2A6ABF7158809CF4F3C:26751F67A3CBB140B1808CF187A4F4DF:F69F2445DF4F9B17AD2B417BE66C3710:C04B05357C5D1C0EEAC4C66F9FF7F2E6:1
103# CFB128-AES128.Decrypt
104AES-128-CFB:2B7E151628AED2A6ABF7158809CF4F3C:000102030405060708090A0B0C0D0E0F:6BC1BEE22E409F96E93D7E117393172A:3B3FD92EB72DAD20333449F8E83CFB4A:0
105AES-128-CFB:2B7E151628AED2A6ABF7158809CF4F3C:3B3FD92EB72DAD20333449F8E83CFB4A:AE2D8A571E03AC9C9EB76FAC45AF8E51:C8A64537A0B3A93FCDE3CDAD9F1CE58B:0
106AES-128-CFB:2B7E151628AED2A6ABF7158809CF4F3C:C8A64537A0B3A93FCDE3CDAD9F1CE58B:30C81C46A35CE411E5FBC1191A0A52EF:26751F67A3CBB140B1808CF187A4F4DF:0
107AES-128-CFB:2B7E151628AED2A6ABF7158809CF4F3C:26751F67A3CBB140B1808CF187A4F4DF:F69F2445DF4F9B17AD2B417BE66C3710:C04B05357C5D1C0EEAC4C66F9FF7F2E6:0
108# CFB128-AES192.Encrypt
109AES-192-CFB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:000102030405060708090A0B0C0D0E0F:6BC1BEE22E409F96E93D7E117393172A:CDC80D6FDDF18CAB34C25909C99A4174:1
110AES-192-CFB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:CDC80D6FDDF18CAB34C25909C99A4174:AE2D8A571E03AC9C9EB76FAC45AF8E51:67CE7F7F81173621961A2B70171D3D7A:1
111AES-192-CFB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:67CE7F7F81173621961A2B70171D3D7A:30C81C46A35CE411E5FBC1191A0A52EF:2E1E8A1DD59B88B1C8E60FED1EFAC4C9:1
112AES-192-CFB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:2E1E8A1DD59B88B1C8E60FED1EFAC4C9:F69F2445DF4F9B17AD2B417BE66C3710:C05F9F9CA9834FA042AE8FBA584B09FF:1
113# CFB128-AES192.Decrypt
114AES-192-CFB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:000102030405060708090A0B0C0D0E0F:6BC1BEE22E409F96E93D7E117393172A:CDC80D6FDDF18CAB34C25909C99A4174:0
115AES-192-CFB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:CDC80D6FDDF18CAB34C25909C99A4174:AE2D8A571E03AC9C9EB76FAC45AF8E51:67CE7F7F81173621961A2B70171D3D7A:0
116AES-192-CFB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:67CE7F7F81173621961A2B70171D3D7A:30C81C46A35CE411E5FBC1191A0A52EF:2E1E8A1DD59B88B1C8E60FED1EFAC4C9:0
117AES-192-CFB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:2E1E8A1DD59B88B1C8E60FED1EFAC4C9:F69F2445DF4F9B17AD2B417BE66C3710:C05F9F9CA9834FA042AE8FBA584B09FF:0
118# CFB128-AES256.Encrypt
119AES-256-CFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:000102030405060708090A0B0C0D0E0F:6BC1BEE22E409F96E93D7E117393172A:DC7E84BFDA79164B7ECD8486985D3860:1
120AES-256-CFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:DC7E84BFDA79164B7ECD8486985D3860:AE2D8A571E03AC9C9EB76FAC45AF8E51:39FFED143B28B1C832113C6331E5407B:1
121AES-256-CFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:39FFED143B28B1C832113C6331E5407B:30C81C46A35CE411E5FBC1191A0A52EF:DF10132415E54B92A13ED0A8267AE2F9:1
122AES-256-CFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:DF10132415E54B92A13ED0A8267AE2F9:F69F2445DF4F9B17AD2B417BE66C3710:75A385741AB9CEF82031623D55B1E471:1
123# CFB128-AES256.Decrypt
124AES-256-CFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:000102030405060708090A0B0C0D0E0F:6BC1BEE22E409F96E93D7E117393172A:DC7E84BFDA79164B7ECD8486985D3860:0
125AES-256-CFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:DC7E84BFDA79164B7ECD8486985D3860:AE2D8A571E03AC9C9EB76FAC45AF8E51:39FFED143B28B1C832113C6331E5407B:0
126AES-256-CFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:39FFED143B28B1C832113C6331E5407B:30C81C46A35CE411E5FBC1191A0A52EF:DF10132415E54B92A13ED0A8267AE2F9:0
127AES-256-CFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:DF10132415E54B92A13ED0A8267AE2F9:F69F2445DF4F9B17AD2B417BE66C3710:75A385741AB9CEF82031623D55B1E471:0
128# For all OFB encrypts and decrypts, the transformed sequence is
129# AES-bits-CFB:key:IV/output':plaintext:ciphertext:encdec
130# OFB-AES128.Encrypt
131AES-128-OFB:2B7E151628AED2A6ABF7158809CF4F3C:000102030405060708090A0B0C0D0E0F:6BC1BEE22E409F96E93D7E117393172A:3B3FD92EB72DAD20333449F8E83CFB4A:1
132AES-128-OFB:2B7E151628AED2A6ABF7158809CF4F3C:50FE67CC996D32B6DA0937E99BAFEC60:AE2D8A571E03AC9C9EB76FAC45AF8E51:7789508D16918F03F53C52DAC54ED825:1
133AES-128-OFB:2B7E151628AED2A6ABF7158809CF4F3C:D9A4DADA0892239F6B8B3D7680E15674:30C81C46A35CE411E5FBC1191A0A52EF:9740051E9C5FECF64344F7A82260EDCC:1
134AES-128-OFB:2B7E151628AED2A6ABF7158809CF4F3C:A78819583F0308E7A6BF36B1386ABF23:F69F2445DF4F9B17AD2B417BE66C3710:304C6528F659C77866A510D9C1D6AE5E:1
135# OFB-AES128.Decrypt
136AES-128-OFB:2B7E151628AED2A6ABF7158809CF4F3C:000102030405060708090A0B0C0D0E0F:6BC1BEE22E409F96E93D7E117393172A:3B3FD92EB72DAD20333449F8E83CFB4A:0
137AES-128-OFB:2B7E151628AED2A6ABF7158809CF4F3C:50FE67CC996D32B6DA0937E99BAFEC60:AE2D8A571E03AC9C9EB76FAC45AF8E51:7789508D16918F03F53C52DAC54ED825:0
138AES-128-OFB:2B7E151628AED2A6ABF7158809CF4F3C:D9A4DADA0892239F6B8B3D7680E15674:30C81C46A35CE411E5FBC1191A0A52EF:9740051E9C5FECF64344F7A82260EDCC:0
139AES-128-OFB:2B7E151628AED2A6ABF7158809CF4F3C:A78819583F0308E7A6BF36B1386ABF23:F69F2445DF4F9B17AD2B417BE66C3710:304C6528F659C77866A510D9C1D6AE5E:0
140# OFB-AES192.Encrypt
141AES-192-OFB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:000102030405060708090A0B0C0D0E0F:6BC1BEE22E409F96E93D7E117393172A:CDC80D6FDDF18CAB34C25909C99A4174:1
142AES-192-OFB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:A609B38DF3B1133DDDFF2718BA09565E:AE2D8A571E03AC9C9EB76FAC45AF8E51:FCC28B8D4C63837C09E81700C1100401:1
143AES-192-OFB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:52EF01DA52602FE0975F78AC84BF8A50:30C81C46A35CE411E5FBC1191A0A52EF:8D9A9AEAC0F6596F559C6D4DAF59A5F2:1
144AES-192-OFB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:BD5286AC63AABD7EB067AC54B553F71D:F69F2445DF4F9B17AD2B417BE66C3710:6D9F200857CA6C3E9CAC524BD9ACC92A:1
145# OFB-AES192.Decrypt
146AES-192-OFB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:000102030405060708090A0B0C0D0E0F:6BC1BEE22E409F96E93D7E117393172A:CDC80D6FDDF18CAB34C25909C99A4174:0
147AES-192-OFB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:A609B38DF3B1133DDDFF2718BA09565E:AE2D8A571E03AC9C9EB76FAC45AF8E51:FCC28B8D4C63837C09E81700C1100401:0
148AES-192-OFB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:52EF01DA52602FE0975F78AC84BF8A50:30C81C46A35CE411E5FBC1191A0A52EF:8D9A9AEAC0F6596F559C6D4DAF59A5F2:0
149AES-192-OFB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:BD5286AC63AABD7EB067AC54B553F71D:F69F2445DF4F9B17AD2B417BE66C3710:6D9F200857CA6C3E9CAC524BD9ACC92A:0
150# OFB-AES256.Encrypt
151AES-256-OFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:000102030405060708090A0B0C0D0E0F:6BC1BEE22E409F96E93D7E117393172A:DC7E84BFDA79164B7ECD8486985D3860:1
152AES-256-OFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:B7BF3A5DF43989DD97F0FA97EBCE2F4A:AE2D8A571E03AC9C9EB76FAC45AF8E51:4FEBDC6740D20B3AC88F6AD82A4FB08D:1
153AES-256-OFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:E1C656305ED1A7A6563805746FE03EDC:30C81C46A35CE411E5FBC1191A0A52EF:71AB47A086E86EEDF39D1C5BBA97C408:1
154AES-256-OFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:41635BE625B48AFC1666DD42A09D96E7:F69F2445DF4F9B17AD2B417BE66C3710:0126141D67F37BE8538F5A8BE740E484:1
155# OFB-AES256.Decrypt
156AES-256-OFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:000102030405060708090A0B0C0D0E0F:6BC1BEE22E409F96E93D7E117393172A:DC7E84BFDA79164B7ECD8486985D3860:0
157AES-256-OFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:B7BF3A5DF43989DD97F0FA97EBCE2F4A:AE2D8A571E03AC9C9EB76FAC45AF8E51:4FEBDC6740D20B3AC88F6AD82A4FB08D:0
158AES-256-OFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:E1C656305ED1A7A6563805746FE03EDC:30C81C46A35CE411E5FBC1191A0A52EF:71AB47A086E86EEDF39D1C5BBA97C408:0
159AES-256-OFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:41635BE625B48AFC1666DD42A09D96E7:F69F2445DF4F9B17AD2B417BE66C3710:0126141D67F37BE8538F5A8BE740E484:0
160
161# DES ECB tests (from destest)
162
163DES-ECB:0000000000000000::0000000000000000:8CA64DE9C1B123A7
164DES-ECB:FFFFFFFFFFFFFFFF::FFFFFFFFFFFFFFFF:7359B2163E4EDC58
165DES-ECB:3000000000000000::1000000000000001:958E6E627A05557B
166DES-ECB:1111111111111111::1111111111111111:F40379AB9E0EC533
167DES-ECB:0123456789ABCDEF::1111111111111111:17668DFC7292532D
168DES-ECB:1111111111111111::0123456789ABCDEF:8A5AE1F81AB8F2DD
169DES-ECB:FEDCBA9876543210::0123456789ABCDEF:ED39D950FA74BCC4
170
171# DESX-CBC tests (from destest)
172DESX-CBC:0123456789abcdeff1e0d3c2b5a49786fedcba9876543210:fedcba9876543210:37363534333231204E6F77206973207468652074696D6520666F722000000000:846B2914851E9A2954732F8AA0A611C115CDC2D7951B1053A63C5E03B21AA3C4
173
174# DES EDE3 CBC tests (from destest)
175DES-EDE3-CBC:0123456789abcdeff1e0d3c2b5a49786fedcba9876543210:fedcba9876543210:37363534333231204E6F77206973207468652074696D6520666F722000000000:3FE301C962AC01D02213763C1CBD4CDC799657C064ECF5D41C673812CFDE9675
176
177# RC4 tests (from rc4test)
178RC4:0123456789abcdef0123456789abcdef::0123456789abcdef:75b7878099e0c596
179RC4:0123456789abcdef0123456789abcdef::0000000000000000:7494c2e7104b0879
180RC4:00000000000000000000000000000000::0000000000000000:de188941a3375d3a
181RC4:ef012345ef012345ef012345ef012345::0000000000000000000000000000000000000000:d6a141a7ec3c38dfbd615a1162e1c7ba36b67858
182RC4:0123456789abcdef0123456789abcdef::123456789ABCDEF0123456789ABCDEF0123456789ABCDEF012345678:66a0949f8af7d6891f7f832ba833c00c892ebe30143ce28740011ecf
183RC4:ef012345ef012345ef012345ef012345::00000000000000000000:d6a141a7ec3c38dfbd61
184
185
186# Camellia tests from RFC3713
187# For all ECB encrypts and decrypts, the transformed sequence is
188# CAMELLIA-bits-ECB:key::plaintext:ciphertext:encdec
189CAMELLIA-128-ECB:0123456789abcdeffedcba9876543210::0123456789abcdeffedcba9876543210:67673138549669730857065648eabe43
190CAMELLIA-192-ECB:0123456789abcdeffedcba98765432100011223344556677::0123456789abcdeffedcba9876543210:b4993401b3e996f84ee5cee7d79b09b9
191CAMELLIA-256-ECB:0123456789abcdeffedcba987654321000112233445566778899aabbccddeeff::0123456789abcdeffedcba9876543210:9acc237dff16d76c20ef7c919e3a7509
192
193# ECB-CAMELLIA128.Encrypt
194CAMELLIA-128-ECB:000102030405060708090A0B0C0D0E0F::00112233445566778899AABBCCDDEEFF:77CF412067AF8270613529149919546F:1
195CAMELLIA-192-ECB:000102030405060708090A0B0C0D0E0F1011121314151617::00112233445566778899AABBCCDDEEFF:B22F3C36B72D31329EEE8ADDC2906C68:1
196CAMELLIA-256-ECB:000102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1F::00112233445566778899AABBCCDDEEFF:2EDF1F3418D53B88841FC8985FB1ECF2:1
197
198# ECB-CAMELLIA128.Encrypt and ECB-CAMELLIA128.Decrypt
199CAMELLIA-128-ECB:2B7E151628AED2A6ABF7158809CF4F3C::6BC1BEE22E409F96E93D7E117393172A:432FC5DCD628115B7C388D770B270C96
200CAMELLIA-128-ECB:2B7E151628AED2A6ABF7158809CF4F3C::AE2D8A571E03AC9C9EB76FAC45AF8E51:0BE1F14023782A22E8384C5ABB7FAB2B
201CAMELLIA-128-ECB:2B7E151628AED2A6ABF7158809CF4F3C::30C81C46A35CE411E5FBC1191A0A52EF:A0A1ABCD1893AB6FE0FE5B65DF5F8636
202CAMELLIA-128-ECB:2B7E151628AED2A6ABF7158809CF4F3C::F69F2445DF4F9B17AD2B417BE66C3710:E61925E0D5DFAA9BB29F815B3076E51A
203
204# ECB-CAMELLIA192.Encrypt and ECB-CAMELLIA192.Decrypt
205CAMELLIA-192-ECB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B::6BC1BEE22E409F96E93D7E117393172A:CCCC6C4E138B45848514D48D0D3439D3
206CAMELLIA-192-ECB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B::AE2D8A571E03AC9C9EB76FAC45AF8E51:5713C62C14B2EC0F8393B6AFD6F5785A
207CAMELLIA-192-ECB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B::30C81C46A35CE411E5FBC1191A0A52EF:B40ED2B60EB54D09D030CF511FEEF366
208CAMELLIA-192-ECB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B::F69F2445DF4F9B17AD2B417BE66C3710:909DBD95799096748CB27357E73E1D26
209
210# ECB-CAMELLIA256.Encrypt and ECB-CAMELLIA256.Decrypt
211CAMELLIA-256-ECB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4::6BC1BEE22E409F96E93D7E117393172A:BEFD219B112FA00098919CD101C9CCFA
212CAMELLIA-256-ECB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4::AE2D8A571E03AC9C9EB76FAC45AF8E51:C91D3A8F1AEA08A9386CF4B66C0169EA
213CAMELLIA-256-ECB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4::30C81C46A35CE411E5FBC1191A0A52EF:A623D711DC5F25A51BB8A80D56397D28
214CAMELLIA-256-ECB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4::F69F2445DF4F9B17AD2B417BE66C3710:7960109FB6DC42947FCFE59EA3C5EB6B
215
216# For all CBC encrypts and decrypts, the transformed sequence is
217# CAMELLIA-bits-CBC:key:IV/ciphertext':plaintext:ciphertext:encdec
218# CBC-CAMELLIA128.Encrypt and CBC-CAMELLIA128.Decrypt
219CAMELLIA-128-CBC:2B7E151628AED2A6ABF7158809CF4F3C:000102030405060708090A0B0C0D0E0F:6BC1BEE22E409F96E93D7E117393172A:1607CF494B36BBF00DAEB0B503C831AB
220CAMELLIA-128-CBC:2B7E151628AED2A6ABF7158809CF4F3C:1607CF494B36BBF00DAEB0B503C831AB:AE2D8A571E03AC9C9EB76FAC45AF8E51:A2F2CF671629EF7840C5A5DFB5074887
221CAMELLIA-128-CBC:2B7E151628AED2A6ABF7158809CF4F3C:A2F2CF671629EF7840C5A5DFB5074887:30C81C46A35CE411E5FBC1191A0A52EF:0F06165008CF8B8B5A63586362543E54
222CAMELLIA-128-CBC:2B7E151628AED2A6ABF7158809CF4F3C:36A84CDAFD5F9A85ADA0F0A993D6D577:F69F2445DF4F9B17AD2B417BE66C3710:74C64268CDB8B8FAF5B34E8AF3732980
223
224# CBC-CAMELLIA192.Encrypt and CBC-CAMELLIA192.Decrypt
225CAMELLIA-192-CBC:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:000102030405060708090A0B0C0D0E0F:6BC1BEE22E409F96E93D7E117393172A:2A4830AB5AC4A1A2405955FD2195CF93
226CAMELLIA-192-CBC:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:2A4830AB5AC4A1A2405955FD2195CF93:AE2D8A571E03AC9C9EB76FAC45AF8E51:5D5A869BD14CE54264F892A6DD2EC3D5
227CAMELLIA-192-CBC:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:5D5A869BD14CE54264F892A6DD2EC3D5:30C81C46A35CE411E5FBC1191A0A52EF:37D359C3349836D884E310ADDF68C449
228CAMELLIA-192-CBC:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:37D359C3349836D884E310ADDF68C449:F69F2445DF4F9B17AD2B417BE66C3710:01FAAA930B4AB9916E9668E1428C6B08
229
230# CBC-CAMELLIA256.Encrypt and CBC-CAMELLIA256.Decrypt
231CAMELLIA-256-CBC:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:000102030405060708090A0B0C0D0E0F:6BC1BEE22E409F96E93D7E117393172A:E6CFA35FC02B134A4D2C0B6737AC3EDA
232CAMELLIA-256-CBC:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:E6CFA35FC02B134A4D2C0B6737AC3EDA:AE2D8A571E03AC9C9EB76FAC45AF8E51:36CBEB73BD504B4070B1B7DE2B21EB50
233CAMELLIA-256-CBC:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:36CBEB73BD504B4070B1B7DE2B21EB50:30C81C46A35CE411E5FBC1191A0A52EF:E31A6055297D96CA3330CDF1B1860A83
234CAMELLIA-256-CBC:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:E31A6055297D96CA3330CDF1B1860A83:F69F2445DF4F9B17AD2B417BE66C3710:5D563F6D1CCCF236051C0C5C1C58F28F
235
236# We don't support CFB{1,8}-CAMELLIAxxx.{En,De}crypt
237# For all CFB128 encrypts and decrypts, the transformed sequence is
238# CAMELLIA-bits-CFB:key:IV/ciphertext':plaintext:ciphertext:encdec
239# CFB128-CAMELLIA128.Encrypt
240CAMELLIA-128-CFB:2B7E151628AED2A6ABF7158809CF4F3C:000102030405060708090A0B0C0D0E0F:6BC1BEE22E409F96E93D7E117393172A:14F7646187817EB586599146B82BD719:1
241CAMELLIA-128-CFB:2B7E151628AED2A6ABF7158809CF4F3C:14F7646187817EB586599146B82BD719:AE2D8A571E03AC9C9EB76FAC45AF8E51:A53D28BB82DF741103EA4F921A44880B:1
242CAMELLIA-128-CFB:2B7E151628AED2A6ABF7158809CF4F3C:A53D28BB82DF741103EA4F921A44880B:30C81C46A35CE411E5FBC1191A0A52EF:9C2157A664626D1DEF9EA420FDE69B96:1
243CAMELLIA-128-CFB:2B7E151628AED2A6ABF7158809CF4F3C:9C2157A664626D1DEF9EA420FDE69B96:F69F2445DF4F9B17AD2B417BE66C3710:742A25F0542340C7BAEF24CA8482BB09:1
244
245# CFB128-CAMELLIA128.Decrypt
246CAMELLIA-128-CFB:2B7E151628AED2A6ABF7158809CF4F3C:000102030405060708090A0B0C0D0E0F:6BC1BEE22E409F96E93D7E117393172A:14F7646187817EB586599146B82BD719:0
247CAMELLIA-128-CFB:2B7E151628AED2A6ABF7158809CF4F3C:14F7646187817EB586599146B82BD719:AE2D8A571E03AC9C9EB76FAC45AF8E51:A53D28BB82DF741103EA4F921A44880B:0
248CAMELLIA-128-CFB:2B7E151628AED2A6ABF7158809CF4F3C:A53D28BB82DF741103EA4F921A44880B:30C81C46A35CE411E5FBC1191A0A52EF:9C2157A664626D1DEF9EA420FDE69B96:0
249CAMELLIA-128-CFB:2B7E151628AED2A6ABF7158809CF4F3C:9C2157A664626D1DEF9EA420FDE69B96:F69F2445DF4F9B17AD2B417BE66C3710:742A25F0542340C7BAEF24CA8482BB09:0
250
251# CFB128-CAMELLIA192.Encrypt
252CAMELLIA-192-CFB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:000102030405060708090A0B0C0D0E0F:6BC1BEE22E409F96E93D7E117393172A:C832BB9780677DAA82D9B6860DCD565E:1
253CAMELLIA-192-CFB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:C832BB9780677DAA82D9B6860DCD565E:AE2D8A571E03AC9C9EB76FAC45AF8E51:86F8491627906D780C7A6D46EA331F98:1
254CAMELLIA-192-CFB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:86F8491627906D780C7A6D46EA331F98:30C81C46A35CE411E5FBC1191A0A52EF:69511CCE594CF710CB98BB63D7221F01:1
255CAMELLIA-192-CFB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:69511CCE594CF710CB98BB63D7221F01:F69F2445DF4F9B17AD2B417BE66C3710:D5B5378A3ABED55803F25565D8907B84:1
256
257# CFB128-CAMELLIA192.Decrypt
258CAMELLIA-192-CFB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:000102030405060708090A0B0C0D0E0F:6BC1BEE22E409F96E93D7E117393172A:C832BB9780677DAA82D9B6860DCD565E:0
259CAMELLIA-192-CFB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:C832BB9780677DAA82D9B6860DCD565E:AE2D8A571E03AC9C9EB76FAC45AF8E51:86F8491627906D780C7A6D46EA331F98:0
260CAMELLIA-192-CFB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:86F8491627906D780C7A6D46EA331F98:30C81C46A35CE411E5FBC1191A0A52EF:69511CCE594CF710CB98BB63D7221F01:0
261CAMELLIA-192-CFB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:69511CCE594CF710CB98BB63D7221F01:F69F2445DF4F9B17AD2B417BE66C3710:D5B5378A3ABED55803F25565D8907B84:0
262
263# CFB128-CAMELLIA256.Encrypt
264CAMELLIA-256-CFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:000102030405060708090A0B0C0D0E0F:6BC1BEE22E409F96E93D7E117393172A:CF6107BB0CEA7D7FB1BD31F5E7B06C93:1
265CAMELLIA-256-CFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:CF6107BB0CEA7D7FB1BD31F5E7B06C93:AE2D8A571E03AC9C9EB76FAC45AF8E51:89BEDB4CCDD864EA11BA4CBE849B5E2B:1
266CAMELLIA-256-CFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:89BEDB4CCDD864EA11BA4CBE849B5E2B:30C81C46A35CE411E5FBC1191A0A52EF:555FC3F34BDD2D54C62D9E3BF338C1C4:1
267CAMELLIA-256-CFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:555FC3F34BDD2D54C62D9E3BF338C1C4:F69F2445DF4F9B17AD2B417BE66C3710:5953ADCE14DB8C7F39F1BD39F359BFFA:1
268
269# CFB128-CAMELLIA256.Decrypt
270CAMELLIA-256-CFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:000102030405060708090A0B0C0D0E0F:6BC1BEE22E409F96E93D7E117393172A:CF6107BB0CEA7D7FB1BD31F5E7B06C93:0
271CAMELLIA-256-CFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:CF6107BB0CEA7D7FB1BD31F5E7B06C93:AE2D8A571E03AC9C9EB76FAC45AF8E51:89BEDB4CCDD864EA11BA4CBE849B5E2B:0
272CAMELLIA-256-CFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:89BEDB4CCDD864EA11BA4CBE849B5E2B:30C81C46A35CE411E5FBC1191A0A52EF:555FC3F34BDD2D54C62D9E3BF338C1C4:0
273CAMELLIA-256-CFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:555FC3F34BDD2D54C62D9E3BF338C1C4:F69F2445DF4F9B17AD2B417BE66C3710:5953ADCE14DB8C7F39F1BD39F359BFFA:0
274
275# For all OFB encrypts and decrypts, the transformed sequence is
276# CAMELLIA-bits-OFB:key:IV/output':plaintext:ciphertext:encdec
277# OFB-CAMELLIA128.Encrypt
278CAMELLIA-128-OFB:2B7E151628AED2A6ABF7158809CF4F3C:000102030405060708090A0B0C0D0E0F:6BC1BEE22E409F96E93D7E117393172A:14F7646187817EB586599146B82BD719:1
279CAMELLIA-128-OFB:2B7E151628AED2A6ABF7158809CF4F3C:50FE67CC996D32B6DA0937E99BAFEC60:AE2D8A571E03AC9C9EB76FAC45AF8E51:25623DB569CA51E01482649977E28D84:1
280CAMELLIA-128-OFB:2B7E151628AED2A6ABF7158809CF4F3C:D9A4DADA0892239F6B8B3D7680E15674:30C81C46A35CE411E5FBC1191A0A52EF:C776634A60729DC657D12B9FCA801E98:1
281CAMELLIA-128-OFB:2B7E151628AED2A6ABF7158809CF4F3C:A78819583F0308E7A6BF36B1386ABF23:F69F2445DF4F9B17AD2B417BE66C3710:D776379BE0E50825E681DA1A4C980E8E:1
282
283# OFB-CAMELLIA128.Decrypt
284CAMELLIA-128-OFB:2B7E151628AED2A6ABF7158809CF4F3C:000102030405060708090A0B0C0D0E0F:6BC1BEE22E409F96E93D7E117393172A:14F7646187817EB586599146B82BD719:0
285CAMELLIA-128-OFB:2B7E151628AED2A6ABF7158809CF4F3C:50FE67CC996D32B6DA0937E99BAFEC60:AE2D8A571E03AC9C9EB76FAC45AF8E51:25623DB569CA51E01482649977E28D84:0
286CAMELLIA-128-OFB:2B7E151628AED2A6ABF7158809CF4F3C:D9A4DADA0892239F6B8B3D7680E15674:30C81C46A35CE411E5FBC1191A0A52EF:C776634A60729DC657D12B9FCA801E98:0
287CAMELLIA-128-OFB:2B7E151628AED2A6ABF7158809CF4F3C:A78819583F0308E7A6BF36B1386ABF23:F69F2445DF4F9B17AD2B417BE66C3710:D776379BE0E50825E681DA1A4C980E8E:0
288
289# OFB-CAMELLIA192.Encrypt
290CAMELLIA-192-OFB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:000102030405060708090A0B0C0D0E0F:6BC1BEE22E409F96E93D7E117393172A:C832BB9780677DAA82D9B6860DCD565E:1
291CAMELLIA-192-OFB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:A609B38DF3B1133DDDFF2718BA09565E:AE2D8A571E03AC9C9EB76FAC45AF8E51:8ECEB7D0350D72C7F78562AEBDF99339:1
292CAMELLIA-192-OFB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:52EF01DA52602FE0975F78AC84BF8A50:30C81C46A35CE411E5FBC1191A0A52EF:BDD62DBBB9700846C53B507F544696F0:1
293CAMELLIA-192-OFB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:BD5286AC63AABD7EB067AC54B553F71D:F69F2445DF4F9B17AD2B417BE66C3710:E28014E046B802F385C4C2E13EAD4A72:1
294
295# OFB-CAMELLIA192.Decrypt
296CAMELLIA-192-OFB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:000102030405060708090A0B0C0D0E0F:6BC1BEE22E409F96E93D7E117393172A:C832BB9780677DAA82D9B6860DCD565E:0
297CAMELLIA-192-OFB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:A609B38DF3B1133DDDFF2718BA09565E:AE2D8A571E03AC9C9EB76FAC45AF8E51:8ECEB7D0350D72C7F78562AEBDF99339:0
298CAMELLIA-192-OFB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:52EF01DA52602FE0975F78AC84BF8A50:30C81C46A35CE411E5FBC1191A0A52EF:BDD62DBBB9700846C53B507F544696F0:0
299CAMELLIA-192-OFB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:BD5286AC63AABD7EB067AC54B553F71D:F69F2445DF4F9B17AD2B417BE66C3710:E28014E046B802F385C4C2E13EAD4A72:0
300
301# OFB-CAMELLIA256.Encrypt
302CAMELLIA-256-OFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:000102030405060708090A0B0C0D0E0F:6BC1BEE22E409F96E93D7E117393172A:CF6107BB0CEA7D7FB1BD31F5E7B06C93:1
303CAMELLIA-256-OFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:B7BF3A5DF43989DD97F0FA97EBCE2F4A:AE2D8A571E03AC9C9EB76FAC45AF8E51:127AD97E8E3994E4820027D7BA109368:1
304CAMELLIA-256-OFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:E1C656305ED1A7A6563805746FE03EDC:30C81C46A35CE411E5FBC1191A0A52EF:6BFF6265A6A6B7A535BC65A80B17214E:1
305CAMELLIA-256-OFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:41635BE625B48AFC1666DD42A09D96E7:F69F2445DF4F9B17AD2B417BE66C3710:0A4A0404E26AA78A27CB271E8BF3CF20:1
306
307# OFB-CAMELLIA256.Decrypt
308CAMELLIA-256-OFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:000102030405060708090A0B0C0D0E0F:6BC1BEE22E409F96E93D7E117393172A:CF6107BB0CEA7D7FB1BD31F5E7B06C93:0
309CAMELLIA-256-OFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:B7BF3A5DF43989DD97F0FA97EBCE2F4A:AE2D8A571E03AC9C9EB76FAC45AF8E51:127AD97E8E3994E4820027D7BA109368:0
310CAMELLIA-256-OFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:E1C656305ED1A7A6563805746FE03EDC:30C81C46A35CE411E5FBC1191A0A52EF:6BFF6265A6A6B7A535BC65A80B17214E:0
311CAMELLIA-256-OFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:41635BE625B48AFC1666DD42A09D96E7:F69F2445DF4F9B17AD2B417BE66C3710:0A4A0404E26AA78A27CB271E8BF3CF20:0
312
313# SEED test vectors from RFC4269
314SEED-ECB:00000000000000000000000000000000::000102030405060708090A0B0C0D0E0F:5EBAC6E0054E166819AFF1CC6D346CDB:0
315SEED-ECB:000102030405060708090A0B0C0D0E0F::00000000000000000000000000000000:C11F22F20140505084483597E4370F43:0
316SEED-ECB:4706480851E61BE85D74BFB3FD956185::83A2F8A288641FB9A4E9A5CC2F131C7D:EE54D13EBCAE706D226BC3142CD40D4A:0
317SEED-ECB:28DBC3BC49FFD87DCFA509B11D422BE7::B41E6BE2EBA84A148E2EED84593C5EC7:9B9B7BFCD1813CB95D0B3618F40F5122:0
318SEED-ECB:00000000000000000000000000000000::000102030405060708090A0B0C0D0E0F:5EBAC6E0054E166819AFF1CC6D346CDB:1
319SEED-ECB:000102030405060708090A0B0C0D0E0F::00000000000000000000000000000000:C11F22F20140505084483597E4370F43:1
320SEED-ECB:4706480851E61BE85D74BFB3FD956185::83A2F8A288641FB9A4E9A5CC2F131C7D:EE54D13EBCAE706D226BC3142CD40D4A:1
321SEED-ECB:28DBC3BC49FFD87DCFA509B11D422BE7::B41E6BE2EBA84A148E2EED84593C5EC7:9B9B7BFCD1813CB95D0B3618F40F5122:1
diff --git a/src/lib/libcrypto/evp/m_md2.c b/src/lib/libcrypto/evp/m_md2.c
new file mode 100644
index 0000000000..5ce849f161
--- /dev/null
+++ b/src/lib/libcrypto/evp/m_md2.c
@@ -0,0 +1,101 @@
1/* crypto/evp/m_md2.c */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved.
4 *
5 * This package is an SSL implementation written
6 * by Eric Young (eay@cryptsoft.com).
7 * The implementation was written so as to conform with Netscapes SSL.
8 *
9 * This library is free for commercial and non-commercial use as long as
10 * the following conditions are aheared to. The following conditions
11 * apply to all code found in this distribution, be it the RC4, RSA,
12 * lhash, DES, etc., code; not just the SSL code. The SSL documentation
13 * included with this distribution is covered by the same copyright terms
14 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
15 *
16 * Copyright remains Eric Young's, and as such any Copyright notices in
17 * the code are not to be removed.
18 * If this package is used in a product, Eric Young should be given attribution
19 * as the author of the parts of the library used.
20 * This can be in the form of a textual message at program startup or
21 * in documentation (online or textual) provided with the package.
22 *
23 * Redistribution and use in source and binary forms, with or without
24 * modification, are permitted provided that the following conditions
25 * are met:
26 * 1. Redistributions of source code must retain the copyright
27 * notice, this list of conditions and the following disclaimer.
28 * 2. Redistributions in binary form must reproduce the above copyright
29 * notice, this list of conditions and the following disclaimer in the
30 * documentation and/or other materials provided with the distribution.
31 * 3. All advertising materials mentioning features or use of this software
32 * must display the following acknowledgement:
33 * "This product includes cryptographic software written by
34 * Eric Young (eay@cryptsoft.com)"
35 * The word 'cryptographic' can be left out if the rouines from the library
36 * being used are not cryptographic related :-).
37 * 4. If you include any Windows specific code (or a derivative thereof) from
38 * the apps directory (application code) you must include an acknowledgement:
39 * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
40 *
41 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
42 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
43 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
44 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
45 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
46 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
47 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
49 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
50 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
51 * SUCH DAMAGE.
52 *
53 * The licence and distribution terms for any publically available version or
54 * derivative of this code cannot be changed. i.e. this code cannot simply be
55 * copied and put under another distribution licence
56 * [including the GNU Public Licence.]
57 */
58
59#include <stdio.h>
60#include "cryptlib.h"
61
62#ifndef OPENSSL_NO_MD2
63
64#include <openssl/evp.h>
65#include <openssl/objects.h>
66#include <openssl/x509.h>
67#include <openssl/md2.h>
68#ifndef OPENSSL_NO_RSA
69#include <openssl/rsa.h>
70#endif
71
72static int init(EVP_MD_CTX *ctx)
73 { return MD2_Init(ctx->md_data); }
74
75static int update(EVP_MD_CTX *ctx,const void *data,size_t count)
76 { return MD2_Update(ctx->md_data,data,count); }
77
78static int final(EVP_MD_CTX *ctx,unsigned char *md)
79 { return MD2_Final(md,ctx->md_data); }
80
81static const EVP_MD md2_md=
82 {
83 NID_md2,
84 NID_md2WithRSAEncryption,
85 MD2_DIGEST_LENGTH,
86 0,
87 init,
88 update,
89 final,
90 NULL,
91 NULL,
92 EVP_PKEY_RSA_method,
93 MD2_BLOCK,
94 sizeof(EVP_MD *)+sizeof(MD2_CTX),
95 };
96
97const EVP_MD *EVP_md2(void)
98 {
99 return(&md2_md);
100 }
101#endif
diff --git a/src/lib/libcrypto/evp/m_mdc2.c b/src/lib/libcrypto/evp/m_mdc2.c
new file mode 100644
index 0000000000..b08d559803
--- /dev/null
+++ b/src/lib/libcrypto/evp/m_mdc2.c
@@ -0,0 +1,101 @@
1/* crypto/evp/m_mdc2.c */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved.
4 *
5 * This package is an SSL implementation written
6 * by Eric Young (eay@cryptsoft.com).
7 * The implementation was written so as to conform with Netscapes SSL.
8 *
9 * This library is free for commercial and non-commercial use as long as
10 * the following conditions are aheared to. The following conditions
11 * apply to all code found in this distribution, be it the RC4, RSA,
12 * lhash, DES, etc., code; not just the SSL code. The SSL documentation
13 * included with this distribution is covered by the same copyright terms
14 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
15 *
16 * Copyright remains Eric Young's, and as such any Copyright notices in
17 * the code are not to be removed.
18 * If this package is used in a product, Eric Young should be given attribution
19 * as the author of the parts of the library used.
20 * This can be in the form of a textual message at program startup or
21 * in documentation (online or textual) provided with the package.
22 *
23 * Redistribution and use in source and binary forms, with or without
24 * modification, are permitted provided that the following conditions
25 * are met:
26 * 1. Redistributions of source code must retain the copyright
27 * notice, this list of conditions and the following disclaimer.
28 * 2. Redistributions in binary form must reproduce the above copyright
29 * notice, this list of conditions and the following disclaimer in the
30 * documentation and/or other materials provided with the distribution.
31 * 3. All advertising materials mentioning features or use of this software
32 * must display the following acknowledgement:
33 * "This product includes cryptographic software written by
34 * Eric Young (eay@cryptsoft.com)"
35 * The word 'cryptographic' can be left out if the rouines from the library
36 * being used are not cryptographic related :-).
37 * 4. If you include any Windows specific code (or a derivative thereof) from
38 * the apps directory (application code) you must include an acknowledgement:
39 * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
40 *
41 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
42 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
43 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
44 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
45 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
46 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
47 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
49 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
50 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
51 * SUCH DAMAGE.
52 *
53 * The licence and distribution terms for any publically available version or
54 * derivative of this code cannot be changed. i.e. this code cannot simply be
55 * copied and put under another distribution licence
56 * [including the GNU Public Licence.]
57 */
58
59#include <stdio.h>
60#include "cryptlib.h"
61
62#ifndef OPENSSL_NO_MDC2
63
64#include <openssl/evp.h>
65#include <openssl/objects.h>
66#include <openssl/x509.h>
67#include <openssl/mdc2.h>
68#ifndef OPENSSL_NO_RSA
69#include <openssl/rsa.h>
70#endif
71
72static int init(EVP_MD_CTX *ctx)
73 { return MDC2_Init(ctx->md_data); }
74
75static int update(EVP_MD_CTX *ctx,const void *data,size_t count)
76 { return MDC2_Update(ctx->md_data,data,count); }
77
78static int final(EVP_MD_CTX *ctx,unsigned char *md)
79 { return MDC2_Final(md,ctx->md_data); }
80
81static const EVP_MD mdc2_md=
82 {
83 NID_mdc2,
84 NID_mdc2WithRSA,
85 MDC2_DIGEST_LENGTH,
86 0,
87 init,
88 update,
89 final,
90 NULL,
91 NULL,
92 EVP_PKEY_RSA_ASN1_OCTET_STRING_method,
93 MDC2_BLOCK,
94 sizeof(EVP_MD *)+sizeof(MDC2_CTX),
95 };
96
97const EVP_MD *EVP_mdc2(void)
98 {
99 return(&mdc2_md);
100 }
101#endif
diff --git a/src/lib/libcrypto/evp/m_sha.c b/src/lib/libcrypto/evp/m_sha.c
new file mode 100644
index 0000000000..acccc8f92d
--- /dev/null
+++ b/src/lib/libcrypto/evp/m_sha.c
@@ -0,0 +1,100 @@
1/* crypto/evp/m_sha.c */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved.
4 *
5 * This package is an SSL implementation written
6 * by Eric Young (eay@cryptsoft.com).
7 * The implementation was written so as to conform with Netscapes SSL.
8 *
9 * This library is free for commercial and non-commercial use as long as
10 * the following conditions are aheared to. The following conditions
11 * apply to all code found in this distribution, be it the RC4, RSA,
12 * lhash, DES, etc., code; not just the SSL code. The SSL documentation
13 * included with this distribution is covered by the same copyright terms
14 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
15 *
16 * Copyright remains Eric Young's, and as such any Copyright notices in
17 * the code are not to be removed.
18 * If this package is used in a product, Eric Young should be given attribution
19 * as the author of the parts of the library used.
20 * This can be in the form of a textual message at program startup or
21 * in documentation (online or textual) provided with the package.
22 *
23 * Redistribution and use in source and binary forms, with or without
24 * modification, are permitted provided that the following conditions
25 * are met:
26 * 1. Redistributions of source code must retain the copyright
27 * notice, this list of conditions and the following disclaimer.
28 * 2. Redistributions in binary form must reproduce the above copyright
29 * notice, this list of conditions and the following disclaimer in the
30 * documentation and/or other materials provided with the distribution.
31 * 3. All advertising materials mentioning features or use of this software
32 * must display the following acknowledgement:
33 * "This product includes cryptographic software written by
34 * Eric Young (eay@cryptsoft.com)"
35 * The word 'cryptographic' can be left out if the rouines from the library
36 * being used are not cryptographic related :-).
37 * 4. If you include any Windows specific code (or a derivative thereof) from
38 * the apps directory (application code) you must include an acknowledgement:
39 * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
40 *
41 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
42 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
43 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
44 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
45 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
46 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
47 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
49 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
50 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
51 * SUCH DAMAGE.
52 *
53 * The licence and distribution terms for any publically available version or
54 * derivative of this code cannot be changed. i.e. this code cannot simply be
55 * copied and put under another distribution licence
56 * [including the GNU Public Licence.]
57 */
58
59#include <stdio.h>
60#include "cryptlib.h"
61
62#if !defined(OPENSSL_NO_SHA) && !defined(OPENSSL_NO_SHA0)
63
64#include <openssl/evp.h>
65#include <openssl/objects.h>
66#include <openssl/x509.h>
67#ifndef OPENSSL_NO_RSA
68#include <openssl/rsa.h>
69#endif
70
71static int init(EVP_MD_CTX *ctx)
72 { return SHA_Init(ctx->md_data); }
73
74static int update(EVP_MD_CTX *ctx,const void *data,size_t count)
75 { return SHA_Update(ctx->md_data,data,count); }
76
77static int final(EVP_MD_CTX *ctx,unsigned char *md)
78 { return SHA_Final(md,ctx->md_data); }
79
80static const EVP_MD sha_md=
81 {
82 NID_sha,
83 NID_shaWithRSAEncryption,
84 SHA_DIGEST_LENGTH,
85 0,
86 init,
87 update,
88 final,
89 NULL,
90 NULL,
91 EVP_PKEY_RSA_method,
92 SHA_CBLOCK,
93 sizeof(EVP_MD *)+sizeof(SHA_CTX),
94 };
95
96const EVP_MD *EVP_sha(void)
97 {
98 return(&sha_md);
99 }
100#endif
diff --git a/src/lib/libcrypto/evp/openbsd_hw.c b/src/lib/libcrypto/evp/openbsd_hw.c
new file mode 100644
index 0000000000..3831a5731e
--- /dev/null
+++ b/src/lib/libcrypto/evp/openbsd_hw.c
@@ -0,0 +1,446 @@
1/* Written by Ben Laurie, 2001 */
2/*
3 * Copyright (c) 2001 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#include <openssl/evp.h>
51#include <openssl/objects.h>
52#include <openssl/rsa.h>
53#include "evp_locl.h"
54
55/* This stuff should now all be supported through
56 * crypto/engine/hw_openbsd_dev_crypto.c unless I botched it up */
57static void *dummy=&dummy;
58
59#if 0
60
61/* check flag after OpenSSL headers to ensure make depend works */
62#ifdef OPENSSL_OPENBSD_DEV_CRYPTO
63
64#include <fcntl.h>
65#include <stdio.h>
66#include <errno.h>
67#include <sys/ioctl.h>
68#include <crypto/cryptodev.h>
69#include <unistd.h>
70#include <assert.h>
71
72/* longest key supported in hardware */
73#define MAX_HW_KEY 24
74#define MAX_HW_IV 8
75
76#define MD5_DIGEST_LENGTH 16
77#define MD5_CBLOCK 64
78
79static int fd;
80static int dev_failed;
81
82typedef struct session_op session_op;
83
84#define CDATA(ctx) EVP_C_DATA(session_op,ctx)
85
86static void err(const char *str)
87 {
88 fprintf(stderr,"%s: errno %d\n",str,errno);
89 }
90
91static int dev_crypto_init(session_op *ses)
92 {
93 if(dev_failed)
94 return 0;
95 if(!fd)
96 {
97 int cryptodev_fd;
98
99 if ((cryptodev_fd=open("/dev/crypto",O_RDWR,0)) < 0)
100 {
101 err("/dev/crypto");
102 dev_failed=1;
103 return 0;
104 }
105 if (ioctl(cryptodev_fd,CRIOGET,&fd) == -1)
106 {
107 err("CRIOGET failed");
108 close(cryptodev_fd);
109 dev_failed=1;
110 return 0;
111 }
112 close(cryptodev_fd);
113 }
114 assert(ses);
115 memset(ses,'\0',sizeof *ses);
116
117 return 1;
118 }
119
120static int dev_crypto_cleanup(EVP_CIPHER_CTX *ctx)
121 {
122 if(ioctl(fd,CIOCFSESSION,&CDATA(ctx)->ses) == -1)
123 err("CIOCFSESSION failed");
124
125 OPENSSL_free(CDATA(ctx)->key);
126
127 return 1;
128 }
129
130static int dev_crypto_init_key(EVP_CIPHER_CTX *ctx,int cipher,
131 const unsigned char *key,int klen)
132 {
133 if(!dev_crypto_init(CDATA(ctx)))
134 return 0;
135
136 CDATA(ctx)->key=OPENSSL_malloc(MAX_HW_KEY);
137
138 assert(ctx->cipher->iv_len <= MAX_HW_IV);
139
140 memcpy(CDATA(ctx)->key,key,klen);
141
142 CDATA(ctx)->cipher=cipher;
143 CDATA(ctx)->keylen=klen;
144
145 if (ioctl(fd,CIOCGSESSION,CDATA(ctx)) == -1)
146 {
147 err("CIOCGSESSION failed");
148 return 0;
149 }
150 return 1;
151 }
152
153static int dev_crypto_cipher(EVP_CIPHER_CTX *ctx,unsigned char *out,
154 const unsigned char *in,unsigned int inl)
155 {
156 struct crypt_op cryp;
157 unsigned char lb[MAX_HW_IV];
158
159 if(!inl)
160 return 1;
161
162 assert(CDATA(ctx));
163 assert(!dev_failed);
164
165 memset(&cryp,'\0',sizeof cryp);
166 cryp.ses=CDATA(ctx)->ses;
167 cryp.op=ctx->encrypt ? COP_ENCRYPT : COP_DECRYPT;
168 cryp.flags=0;
169 cryp.len=inl;
170 assert((inl&(ctx->cipher->block_size-1)) == 0);
171 cryp.src=(caddr_t)in;
172 cryp.dst=(caddr_t)out;
173 cryp.mac=0;
174 if(ctx->cipher->iv_len)
175 cryp.iv=(caddr_t)ctx->iv;
176
177 if(!ctx->encrypt)
178 memcpy(lb,&in[cryp.len-ctx->cipher->iv_len],ctx->cipher->iv_len);
179
180 if(ioctl(fd, CIOCCRYPT, &cryp) == -1)
181 {
182 if(errno == EINVAL) /* buffers are misaligned */
183 {
184 unsigned int cinl=0;
185 char *cin=NULL;
186 char *cout=NULL;
187
188 /* NB: this can only make cinl != inl with stream ciphers */
189 cinl=(inl+3)/4*4;
190
191 if(((unsigned long)in&3) || cinl != inl)
192 {
193 cin=OPENSSL_malloc(cinl);
194 memcpy(cin,in,inl);
195 cryp.src=cin;
196 }
197
198 if(((unsigned long)out&3) || cinl != inl)
199 {
200 cout=OPENSSL_malloc(cinl);
201 cryp.dst=cout;
202 }
203
204 cryp.len=cinl;
205
206 if(ioctl(fd, CIOCCRYPT, &cryp) == -1)
207 {
208 err("CIOCCRYPT(2) failed");
209 printf("src=%p dst=%p\n",cryp.src,cryp.dst);
210 abort();
211 return 0;
212 }
213
214 if(cout)
215 {
216 memcpy(out,cout,inl);
217 OPENSSL_free(cout);
218 }
219 if(cin)
220 OPENSSL_free(cin);
221 }
222 else
223 {
224 err("CIOCCRYPT failed");
225 abort();
226 return 0;
227 }
228 }
229
230 if(ctx->encrypt)
231 memcpy(ctx->iv,&out[cryp.len-ctx->cipher->iv_len],ctx->cipher->iv_len);
232 else
233 memcpy(ctx->iv,lb,ctx->cipher->iv_len);
234
235 return 1;
236 }
237
238static int dev_crypto_des_ede3_init_key(EVP_CIPHER_CTX *ctx,
239 const unsigned char *key,
240 const unsigned char *iv, int enc)
241 { return dev_crypto_init_key(ctx,CRYPTO_3DES_CBC,key,24); }
242
243#define dev_crypto_des_ede3_cbc_cipher dev_crypto_cipher
244
245BLOCK_CIPHER_def_cbc(dev_crypto_des_ede3, session_op, NID_des_ede3, 8, 24, 8,
246 0, dev_crypto_des_ede3_init_key,
247 dev_crypto_cleanup,
248 EVP_CIPHER_set_asn1_iv,
249 EVP_CIPHER_get_asn1_iv,
250 NULL)
251
252static int dev_crypto_rc4_init_key(EVP_CIPHER_CTX *ctx,
253 const unsigned char *key,
254 const unsigned char *iv, int enc)
255 { return dev_crypto_init_key(ctx,CRYPTO_ARC4,key,16); }
256
257static const EVP_CIPHER r4_cipher=
258 {
259 NID_rc4,
260 1,16,0, /* FIXME: key should be up to 256 bytes */
261 EVP_CIPH_VARIABLE_LENGTH,
262 dev_crypto_rc4_init_key,
263 dev_crypto_cipher,
264 dev_crypto_cleanup,
265 sizeof(session_op),
266 NULL,
267 NULL,
268 NULL
269 };
270
271const EVP_CIPHER *EVP_dev_crypto_rc4(void)
272 { return &r4_cipher; }
273
274typedef struct
275 {
276 session_op sess;
277 char *data;
278 int len;
279 unsigned char md[EVP_MAX_MD_SIZE];
280 } MD_DATA;
281
282static int dev_crypto_init_digest(MD_DATA *md_data,int mac)
283 {
284 if(!dev_crypto_init(&md_data->sess))
285 return 0;
286
287 md_data->len=0;
288 md_data->data=NULL;
289
290 md_data->sess.mac=mac;
291
292 if (ioctl(fd,CIOCGSESSION,&md_data->sess) == -1)
293 {
294 err("CIOCGSESSION failed");
295 return 0;
296 }
297 return 1;
298 }
299
300static int dev_crypto_cleanup_digest(MD_DATA *md_data)
301 {
302 if (ioctl(fd,CIOCFSESSION,&md_data->sess.ses) == -1)
303 {
304 err("CIOCFSESSION failed");
305 return 0;
306 }
307
308 return 1;
309 }
310
311/* FIXME: if device can do chained MACs, then don't accumulate */
312/* FIXME: move accumulation to the framework */
313static int dev_crypto_md5_init(EVP_MD_CTX *ctx)
314 { return dev_crypto_init_digest(ctx->md_data,CRYPTO_MD5); }
315
316static int do_digest(int ses,unsigned char *md,const void *data,int len)
317 {
318 struct crypt_op cryp;
319 static unsigned char md5zero[16]=
320 {
321 0xd4,0x1d,0x8c,0xd9,0x8f,0x00,0xb2,0x04,
322 0xe9,0x80,0x09,0x98,0xec,0xf8,0x42,0x7e
323 };
324
325 /* some cards can't do zero length */
326 if(!len)
327 {
328 memcpy(md,md5zero,16);
329 return 1;
330 }
331
332 memset(&cryp,'\0',sizeof cryp);
333 cryp.ses=ses;
334 cryp.op=COP_ENCRYPT;/* required to do the MAC rather than check it */
335 cryp.len=len;
336 cryp.src=(caddr_t)data;
337 cryp.dst=(caddr_t)data; // FIXME!!!
338 cryp.mac=(caddr_t)md;
339
340 if(ioctl(fd, CIOCCRYPT, &cryp) == -1)
341 {
342 if(errno == EINVAL) /* buffer is misaligned */
343 {
344 char *dcopy;
345
346 dcopy=OPENSSL_malloc(len);
347 memcpy(dcopy,data,len);
348 cryp.src=dcopy;
349 cryp.dst=cryp.src; // FIXME!!!
350
351 if(ioctl(fd, CIOCCRYPT, &cryp) == -1)
352 {
353 err("CIOCCRYPT(MAC2) failed");
354 abort();
355 return 0;
356 }
357 OPENSSL_free(dcopy);
358 }
359 else
360 {
361 err("CIOCCRYPT(MAC) failed");
362 abort();
363 return 0;
364 }
365 }
366 // printf("done\n");
367
368 return 1;
369 }
370
371static int dev_crypto_md5_update(EVP_MD_CTX *ctx,const void *data,
372 unsigned long len)
373 {
374 MD_DATA *md_data=ctx->md_data;
375
376 if(ctx->flags&EVP_MD_CTX_FLAG_ONESHOT)
377 return do_digest(md_data->sess.ses,md_data->md,data,len);
378
379 md_data->data=OPENSSL_realloc(md_data->data,md_data->len+len);
380 memcpy(md_data->data+md_data->len,data,len);
381 md_data->len+=len;
382
383 return 1;
384 }
385
386static int dev_crypto_md5_final(EVP_MD_CTX *ctx,unsigned char *md)
387 {
388 int ret;
389 MD_DATA *md_data=ctx->md_data;
390
391 if(ctx->flags&EVP_MD_CTX_FLAG_ONESHOT)
392 {
393 memcpy(md,md_data->md,MD5_DIGEST_LENGTH);
394 ret=1;
395 }
396 else
397 {
398 ret=do_digest(md_data->sess.ses,md,md_data->data,md_data->len);
399 OPENSSL_free(md_data->data);
400 md_data->data=NULL;
401 md_data->len=0;
402 }
403
404 return ret;
405 }
406
407static int dev_crypto_md5_copy(EVP_MD_CTX *to,const EVP_MD_CTX *from)
408 {
409 const MD_DATA *from_md=from->md_data;
410 MD_DATA *to_md=to->md_data;
411
412 // How do we copy sessions?
413 assert(from->digest->flags&EVP_MD_FLAG_ONESHOT);
414
415 to_md->data=OPENSSL_malloc(from_md->len);
416 memcpy(to_md->data,from_md->data,from_md->len);
417
418 return 1;
419 }
420
421static int dev_crypto_md5_cleanup(EVP_MD_CTX *ctx)
422 {
423 return dev_crypto_cleanup_digest(ctx->md_data);
424 }
425
426static const EVP_MD md5_md=
427 {
428 NID_md5,
429 NID_md5WithRSAEncryption,
430 MD5_DIGEST_LENGTH,
431 EVP_MD_FLAG_ONESHOT, // XXX: set according to device info...
432 dev_crypto_md5_init,
433 dev_crypto_md5_update,
434 dev_crypto_md5_final,
435 dev_crypto_md5_copy,
436 dev_crypto_md5_cleanup,
437 EVP_PKEY_RSA_method,
438 MD5_CBLOCK,
439 sizeof(MD_DATA),
440 };
441
442const EVP_MD *EVP_dev_crypto_md5(void)
443 { return &md5_md; }
444
445#endif
446#endif
diff --git a/src/lib/libcrypto/evp/p_lib.c b/src/lib/libcrypto/evp/p_lib.c
index e26ccd0d08..1916c61699 100644
--- a/src/lib/libcrypto/evp/p_lib.c
+++ b/src/lib/libcrypto/evp/p_lib.c
@@ -411,10 +411,7 @@ void EVP_PKEY_free(EVP_PKEY *x)
411static void EVP_PKEY_free_it(EVP_PKEY *x) 411static void EVP_PKEY_free_it(EVP_PKEY *x)
412 { 412 {
413 if (x->ameth && x->ameth->pkey_free) 413 if (x->ameth && x->ameth->pkey_free)
414 {
415 x->ameth->pkey_free(x); 414 x->ameth->pkey_free(x);
416 x->pkey.ptr = NULL;
417 }
418#ifndef OPENSSL_NO_ENGINE 415#ifndef OPENSSL_NO_ENGINE
419 if (x->engine) 416 if (x->engine)
420 { 417 {
diff --git a/src/lib/libcrypto/evp/p_sign.c b/src/lib/libcrypto/evp/p_sign.c
index bb893f5bde..8df6d48a7e 100644
--- a/src/lib/libcrypto/evp/p_sign.c
+++ b/src/lib/libcrypto/evp/p_sign.c
@@ -81,7 +81,7 @@ int EVP_SignFinal(EVP_MD_CTX *ctx, unsigned char *sigret, unsigned int *siglen,
81 unsigned char m[EVP_MAX_MD_SIZE]; 81 unsigned char m[EVP_MAX_MD_SIZE];
82 unsigned int m_len; 82 unsigned int m_len;
83 int i,ok=0,v; 83 int i,ok=0,v;
84 EVP_MD_CTX tmp_ctx; 84 MS_STATIC EVP_MD_CTX tmp_ctx;
85 85
86 *siglen=0; 86 *siglen=0;
87 EVP_MD_CTX_init(&tmp_ctx); 87 EVP_MD_CTX_init(&tmp_ctx);
diff --git a/src/lib/libcrypto/evp/p_verify.c b/src/lib/libcrypto/evp/p_verify.c
index 41d4b67130..8db46412f3 100644
--- a/src/lib/libcrypto/evp/p_verify.c
+++ b/src/lib/libcrypto/evp/p_verify.c
@@ -68,7 +68,7 @@ int EVP_VerifyFinal(EVP_MD_CTX *ctx, const unsigned char *sigbuf,
68 unsigned char m[EVP_MAX_MD_SIZE]; 68 unsigned char m[EVP_MAX_MD_SIZE];
69 unsigned int m_len; 69 unsigned int m_len;
70 int i,ok=0,v; 70 int i,ok=0,v;
71 EVP_MD_CTX tmp_ctx; 71 MS_STATIC EVP_MD_CTX tmp_ctx;
72 72
73 EVP_MD_CTX_init(&tmp_ctx); 73 EVP_MD_CTX_init(&tmp_ctx);
74 EVP_MD_CTX_copy_ex(&tmp_ctx,ctx); 74 EVP_MD_CTX_copy_ex(&tmp_ctx,ctx);