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/Makefile.ssl1129
-rw-r--r--src/lib/libcrypto/evp/bio_b64.c5
-rw-r--r--src/lib/libcrypto/evp/bio_enc.c20
-rw-r--r--src/lib/libcrypto/evp/bio_md.c30
-rw-r--r--src/lib/libcrypto/evp/bio_ok.c52
-rw-r--r--src/lib/libcrypto/evp/c_all.c12
-rw-r--r--src/lib/libcrypto/evp/c_allc.c30
-rw-r--r--src/lib/libcrypto/evp/c_alld.c18
-rw-r--r--src/lib/libcrypto/evp/digest.c254
-rw-r--r--src/lib/libcrypto/evp/e_aes.c99
-rw-r--r--src/lib/libcrypto/evp/e_bf.c14
-rw-r--r--src/lib/libcrypto/evp/e_cast.c16
-rw-r--r--src/lib/libcrypto/evp/e_des.c21
-rw-r--r--src/lib/libcrypto/evp/e_des3.c88
-rw-r--r--src/lib/libcrypto/evp/e_idea.c22
-rw-r--r--src/lib/libcrypto/evp/e_null.c6
-rw-r--r--src/lib/libcrypto/evp/e_rc2.c67
-rw-r--r--src/lib/libcrypto/evp/e_rc4.c37
-rw-r--r--src/lib/libcrypto/evp/e_rc5.c65
-rw-r--r--src/lib/libcrypto/evp/e_xcbc_d.c39
-rw-r--r--src/lib/libcrypto/evp/encode.c7
-rw-r--r--src/lib/libcrypto/evp/evp.h502
-rw-r--r--src/lib/libcrypto/evp/evp_acnf.c74
-rw-r--r--src/lib/libcrypto/evp/evp_enc.c290
-rw-r--r--src/lib/libcrypto/evp/evp_err.c11
-rw-r--r--src/lib/libcrypto/evp/evp_key.c39
-rw-r--r--src/lib/libcrypto/evp/evp_locl.h125
-rw-r--r--src/lib/libcrypto/evp/evp_pbe.c6
-rw-r--r--src/lib/libcrypto/evp/evp_pkey.c24
-rw-r--r--src/lib/libcrypto/evp/evp_test.c365
-rw-r--r--src/lib/libcrypto/evp/evptests.txt82
-rw-r--r--src/lib/libcrypto/evp/m_dss.c24
-rw-r--r--src/lib/libcrypto/evp/m_dss1.c24
-rw-r--r--src/lib/libcrypto/evp/m_md2.c25
-rw-r--r--src/lib/libcrypto/evp/m_md4.c27
-rw-r--r--src/lib/libcrypto/evp/m_md5.c25
-rw-r--r--src/lib/libcrypto/evp/m_mdc2.c25
-rw-r--r--src/lib/libcrypto/evp/m_null.c25
-rw-r--r--src/lib/libcrypto/evp/m_ripemd.c24
-rw-r--r--src/lib/libcrypto/evp/m_sha.c24
-rw-r--r--src/lib/libcrypto/evp/m_sha1.c24
-rw-r--r--src/lib/libcrypto/evp/names.c4
-rw-r--r--src/lib/libcrypto/evp/openbsd_hw.c446
-rw-r--r--src/lib/libcrypto/evp/p5_crpt.c40
-rw-r--r--src/lib/libcrypto/evp/p5_crpt2.c14
-rw-r--r--src/lib/libcrypto/evp/p_dec.c6
-rw-r--r--src/lib/libcrypto/evp/p_enc.c6
-rw-r--r--src/lib/libcrypto/evp/p_lib.c46
-rw-r--r--src/lib/libcrypto/evp/p_open.c14
-rw-r--r--src/lib/libcrypto/evp/p_seal.c17
-rw-r--r--src/lib/libcrypto/evp/p_sign.c8
-rw-r--r--src/lib/libcrypto/evp/p_verify.c6
52 files changed, 2962 insertions, 1441 deletions
diff --git a/src/lib/libcrypto/evp/Makefile.ssl b/src/lib/libcrypto/evp/Makefile.ssl
index 624168031d..4abe93dafe 100644
--- a/src/lib/libcrypto/evp/Makefile.ssl
+++ b/src/lib/libcrypto/evp/Makefile.ssl
@@ -5,26 +5,28 @@
5DIR= evp 5DIR= evp
6TOP= ../.. 6TOP= ../..
7CC= cc 7CC= cc
8INCLUDES= -I.. -I../../include 8INCLUDES= -I.. -I$(TOP) -I../../include
9CFLAG=-g 9CFLAG=-g
10INSTALL_PREFIX= 10INSTALL_PREFIX=
11OPENSSLDIR= /usr/local/ssl 11OPENSSLDIR= /usr/local/ssl
12INSTALLTOP=/usr/local/ssl 12INSTALLTOP=/usr/local/ssl
13MAKE= make -f Makefile.ssl 13MAKE= make -f Makefile.ssl
14MAKEDEPEND= $(TOP)/util/domd $(TOP) 14MAKEDEPPROG= makedepend
15MAKEDEPEND= $(TOP)/util/domd $(TOP) -MD $(MAKEDEPPROG)
15MAKEFILE= Makefile.ssl 16MAKEFILE= Makefile.ssl
16AR= ar r 17AR= ar r
17 18
18CFLAGS= $(INCLUDES) $(CFLAG) 19CFLAGS= $(INCLUDES) $(CFLAG)
19 20
20GENERAL=Makefile 21GENERAL=Makefile
21TEST= 22TEST=evp_test.c
23TESTDATA=evptests.txt
22APPS= 24APPS=
23 25
24LIB=$(TOP)/libcrypto.a 26LIB=$(TOP)/libcrypto.a
25LIBSRC= encode.c digest.c evp_enc.c evp_key.c \ 27LIBSRC= encode.c digest.c evp_enc.c evp_key.c evp_acnf.c \
26 e_des.c e_bf.c e_idea.c e_des3.c \ 28 e_des.c e_bf.c e_idea.c e_des3.c \
27 e_rc4.c names.c \ 29 e_rc4.c e_aes.c names.c \
28 e_xcbc_d.c e_rc2.c e_cast.c e_rc5.c \ 30 e_xcbc_d.c e_rc2.c e_cast.c e_rc5.c \
29 m_null.c m_md2.c m_md4.c m_md5.c m_sha.c m_sha1.c \ 31 m_null.c m_md2.c m_md4.c m_md5.c m_sha.c m_sha1.c \
30 m_dss.c m_dss1.c m_mdc2.c m_ripemd.c \ 32 m_dss.c m_dss1.c m_mdc2.c m_ripemd.c \
@@ -33,9 +35,9 @@ LIBSRC= encode.c digest.c evp_enc.c evp_key.c \
33 c_all.c c_allc.c c_alld.c evp_lib.c bio_ok.c \ 35 c_all.c c_allc.c c_alld.c evp_lib.c bio_ok.c \
34 evp_pkey.c evp_pbe.c p5_crpt.c p5_crpt2.c 36 evp_pkey.c evp_pbe.c p5_crpt.c p5_crpt2.c
35 37
36LIBOBJ= encode.o digest.o evp_enc.o evp_key.o \ 38LIBOBJ= encode.o digest.o evp_enc.o evp_key.o evp_acnf.o \
37 e_des.o e_bf.o e_idea.o e_des3.o \ 39 e_des.o e_bf.o e_idea.o e_des3.o \
38 e_rc4.o names.o \ 40 e_rc4.o e_aes.o names.o \
39 e_xcbc_d.o e_rc2.o e_cast.o e_rc5.o \ 41 e_xcbc_d.o e_rc2.o e_cast.o e_rc5.o \
40 m_null.o m_md2.o m_md4.o m_md5.o m_sha.o m_sha1.o \ 42 m_null.o m_md2.o m_md4.o m_md5.o m_sha.o m_sha1.o \
41 m_dss.o m_dss1.o m_mdc2.o m_ripemd.o \ 43 m_dss.o m_dss1.o m_mdc2.o m_ripemd.o \
@@ -58,8 +60,7 @@ all: lib
58 60
59lib: $(LIBOBJ) 61lib: $(LIBOBJ)
60 $(AR) $(LIB) $(LIBOBJ) 62 $(AR) $(LIB) $(LIBOBJ)
61 @echo You may get an error following this line. Please ignore. 63 $(RANLIB) $(LIB) || echo Never mind.
62 - $(RANLIB) $(LIB)
63 @touch lib 64 @touch lib
64 65
65files: 66files:
@@ -69,6 +70,7 @@ links:
69 @$(SHELL) $(TOP)/util/point.sh Makefile.ssl Makefile 70 @$(SHELL) $(TOP)/util/point.sh Makefile.ssl Makefile
70 @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER) 71 @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER)
71 @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST) 72 @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST)
73 @$(PERL) $(TOP)/util/mklink.pl ../../test $(TESTDATA)
72 @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS) 74 @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS)
73 75
74install: 76install:
@@ -98,820 +100,563 @@ clean:
98 100
99# DO NOT DELETE THIS LINE -- make depend depends on it. 101# DO NOT DELETE THIS LINE -- make depend depends on it.
100 102
101bio_b64.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h 103bio_b64.o: ../../e_os.h ../../include/openssl/asn1.h
102bio_b64.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h 104bio_b64.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
103bio_b64.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h 105bio_b64.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
104bio_b64.o: ../../include/openssl/crypto.h ../../include/openssl/des.h 106bio_b64.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
105bio_b64.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h 107bio_b64.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
106bio_b64.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h
107bio_b64.o: ../../include/openssl/err.h ../../include/openssl/evp.h
108bio_b64.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
109bio_b64.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
110bio_b64.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
111bio_b64.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h 108bio_b64.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
112bio_b64.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h 109bio_b64.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
113bio_b64.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h 110bio_b64.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h
114bio_b64.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h 111bio_b64.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
115bio_b64.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h 112bio_b64.o: ../cryptlib.h bio_b64.c
116bio_b64.o: ../../include/openssl/sha.h ../../include/openssl/stack.h 113bio_enc.o: ../../e_os.h ../../include/openssl/asn1.h
117bio_b64.o: ../../include/openssl/symhacks.h ../cryptlib.h 114bio_enc.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
118bio_enc.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h 115bio_enc.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
119bio_enc.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h 116bio_enc.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
120bio_enc.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h 117bio_enc.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
121bio_enc.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
122bio_enc.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
123bio_enc.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h
124bio_enc.o: ../../include/openssl/err.h ../../include/openssl/evp.h
125bio_enc.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
126bio_enc.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
127bio_enc.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
128bio_enc.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h 118bio_enc.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
129bio_enc.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h 119bio_enc.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
130bio_enc.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h 120bio_enc.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h
131bio_enc.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h 121bio_enc.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
132bio_enc.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h 122bio_enc.o: ../cryptlib.h bio_enc.c
133bio_enc.o: ../../include/openssl/sha.h ../../include/openssl/stack.h 123bio_md.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
134bio_enc.o: ../../include/openssl/symhacks.h ../cryptlib.h 124bio_md.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
135bio_md.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h 125bio_md.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
136bio_md.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
137bio_md.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
138bio_md.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
139bio_md.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
140bio_md.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h
141bio_md.o: ../../include/openssl/err.h ../../include/openssl/evp.h 126bio_md.o: ../../include/openssl/err.h ../../include/openssl/evp.h
142bio_md.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h 127bio_md.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
143bio_md.o: ../../include/openssl/md2.h ../../include/openssl/md4.h 128bio_md.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
144bio_md.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h 129bio_md.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
145bio_md.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h 130bio_md.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
146bio_md.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h 131bio_md.o: ../../include/openssl/symhacks.h ../cryptlib.h bio_md.c
147bio_md.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h 132bio_ok.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
148bio_md.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h 133bio_ok.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
149bio_md.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h 134bio_ok.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
150bio_md.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
151bio_md.o: ../../include/openssl/symhacks.h ../cryptlib.h
152bio_ok.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
153bio_ok.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
154bio_ok.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
155bio_ok.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
156bio_ok.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
157bio_ok.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h
158bio_ok.o: ../../include/openssl/err.h ../../include/openssl/evp.h 135bio_ok.o: ../../include/openssl/err.h ../../include/openssl/evp.h
159bio_ok.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h 136bio_ok.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
160bio_ok.o: ../../include/openssl/md2.h ../../include/openssl/md4.h 137bio_ok.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
161bio_ok.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h 138bio_ok.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
162bio_ok.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h 139bio_ok.o: ../../include/openssl/rand.h ../../include/openssl/safestack.h
163bio_ok.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
164bio_ok.o: ../../include/openssl/rand.h ../../include/openssl/rc2.h
165bio_ok.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
166bio_ok.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
167bio_ok.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
168bio_ok.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h 140bio_ok.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
169bio_ok.o: ../cryptlib.h 141bio_ok.o: ../cryptlib.h bio_ok.c
170c_all.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h 142c_all.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
171c_all.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h 143c_all.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
172c_all.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h 144c_all.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
173c_all.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
174c_all.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
175c_all.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h
176c_all.o: ../../include/openssl/err.h ../../include/openssl/evp.h 145c_all.o: ../../include/openssl/err.h ../../include/openssl/evp.h
177c_all.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h 146c_all.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
178c_all.o: ../../include/openssl/md2.h ../../include/openssl/md4.h 147c_all.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
179c_all.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h 148c_all.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
180c_all.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h 149c_all.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
181c_all.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h 150c_all.o: ../../include/openssl/symhacks.h ../cryptlib.h c_all.c
182c_all.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h 151c_allc.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
183c_all.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h 152c_allc.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
184c_all.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h 153c_allc.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h
185c_all.o: ../../include/openssl/sha.h ../../include/openssl/stack.h 154c_allc.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
186c_all.o: ../../include/openssl/symhacks.h ../cryptlib.h
187c_allc.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
188c_allc.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
189c_allc.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
190c_allc.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
191c_allc.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
192c_allc.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h
193c_allc.o: ../../include/openssl/err.h ../../include/openssl/evp.h 155c_allc.o: ../../include/openssl/err.h ../../include/openssl/evp.h
194c_allc.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h 156c_allc.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
195c_allc.o: ../../include/openssl/md2.h ../../include/openssl/md4.h 157c_allc.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
196c_allc.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h 158c_allc.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
197c_allc.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
198c_allc.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
199c_allc.o: ../../include/openssl/pkcs12.h ../../include/openssl/pkcs7.h 159c_allc.o: ../../include/openssl/pkcs12.h ../../include/openssl/pkcs7.h
200c_allc.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
201c_allc.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
202c_allc.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h 160c_allc.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
203c_allc.o: ../../include/openssl/sha.h ../../include/openssl/stack.h 161c_allc.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
204c_allc.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h 162c_allc.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
205c_allc.o: ../../include/openssl/x509_vfy.h ../cryptlib.h 163c_allc.o: ../../include/openssl/x509_vfy.h ../cryptlib.h c_allc.c
206c_alld.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h 164c_alld.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
207c_alld.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h 165c_alld.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
208c_alld.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h 166c_alld.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h
209c_alld.o: ../../include/openssl/crypto.h ../../include/openssl/des.h 167c_alld.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
210c_alld.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
211c_alld.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h
212c_alld.o: ../../include/openssl/err.h ../../include/openssl/evp.h 168c_alld.o: ../../include/openssl/err.h ../../include/openssl/evp.h
213c_alld.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h 169c_alld.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
214c_alld.o: ../../include/openssl/md2.h ../../include/openssl/md4.h 170c_alld.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
215c_alld.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h 171c_alld.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
216c_alld.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
217c_alld.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
218c_alld.o: ../../include/openssl/pkcs12.h ../../include/openssl/pkcs7.h 172c_alld.o: ../../include/openssl/pkcs12.h ../../include/openssl/pkcs7.h
219c_alld.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
220c_alld.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
221c_alld.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h 173c_alld.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
222c_alld.o: ../../include/openssl/sha.h ../../include/openssl/stack.h 174c_alld.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
223c_alld.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h 175c_alld.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
224c_alld.o: ../../include/openssl/x509_vfy.h ../cryptlib.h 176c_alld.o: ../../include/openssl/x509_vfy.h ../cryptlib.h c_alld.c
225digest.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h 177digest.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
226digest.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h 178digest.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
227digest.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h 179digest.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h
228digest.o: ../../include/openssl/crypto.h ../../include/openssl/des.h 180digest.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
229digest.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h 181digest.o: ../../include/openssl/engine.h ../../include/openssl/err.h
230digest.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h 182digest.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
231digest.o: ../../include/openssl/err.h ../../include/openssl/evp.h
232digest.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
233digest.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
234digest.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
235digest.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h 183digest.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
236digest.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h 184digest.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
237digest.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h 185digest.o: ../../include/openssl/ossl_typ.h ../../include/openssl/rand.h
238digest.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
239digest.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h 186digest.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
240digest.o: ../../include/openssl/sha.h ../../include/openssl/stack.h 187digest.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
241digest.o: ../../include/openssl/symhacks.h ../cryptlib.h 188digest.o: ../../include/openssl/ui.h ../cryptlib.h digest.c
242e_bf.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h 189e_aes.o: ../../include/openssl/aes.h ../../include/openssl/asn1.h
190e_aes.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
191e_aes.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
192e_aes.o: ../../include/openssl/err.h ../../include/openssl/evp.h
193e_aes.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
194e_aes.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
195e_aes.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
196e_aes.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
197e_aes.o: ../../include/openssl/symhacks.h e_aes.c evp_locl.h
198e_bf.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
243e_bf.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h 199e_bf.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
244e_bf.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h 200e_bf.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
245e_bf.o: ../../include/openssl/crypto.h ../../include/openssl/des.h 201e_bf.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
246e_bf.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h 202e_bf.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
247e_bf.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h
248e_bf.o: ../../include/openssl/err.h ../../include/openssl/evp.h
249e_bf.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
250e_bf.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
251e_bf.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
252e_bf.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h 203e_bf.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
253e_bf.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h 204e_bf.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
254e_bf.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h 205e_bf.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h
255e_bf.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h 206e_bf.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
256e_bf.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h 207e_bf.o: ../cryptlib.h e_bf.c evp_locl.h
257e_bf.o: ../../include/openssl/sha.h ../../include/openssl/stack.h 208e_cast.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
258e_bf.o: ../../include/openssl/symhacks.h ../cryptlib.h evp_locl.h 209e_cast.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
259e_cast.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h 210e_cast.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h
260e_cast.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h 211e_cast.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
261e_cast.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h 212e_cast.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
262e_cast.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
263e_cast.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
264e_cast.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h
265e_cast.o: ../../include/openssl/err.h ../../include/openssl/evp.h
266e_cast.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
267e_cast.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
268e_cast.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
269e_cast.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h 213e_cast.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
270e_cast.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h 214e_cast.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
271e_cast.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h 215e_cast.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h
272e_cast.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h 216e_cast.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
273e_cast.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h 217e_cast.o: ../cryptlib.h e_cast.c evp_locl.h
274e_cast.o: ../../include/openssl/sha.h ../../include/openssl/stack.h 218e_des.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
275e_cast.o: ../../include/openssl/symhacks.h ../cryptlib.h evp_locl.h 219e_des.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
276e_des.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
277e_des.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
278e_des.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
279e_des.o: ../../include/openssl/crypto.h ../../include/openssl/des.h 220e_des.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
280e_des.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h 221e_des.o: ../../include/openssl/des_old.h ../../include/openssl/e_os2.h
281e_des.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h
282e_des.o: ../../include/openssl/err.h ../../include/openssl/evp.h 222e_des.o: ../../include/openssl/err.h ../../include/openssl/evp.h
283e_des.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h 223e_des.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
284e_des.o: ../../include/openssl/md2.h ../../include/openssl/md4.h 224e_des.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
285e_des.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h 225e_des.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
286e_des.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h 226e_des.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
287e_des.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h 227e_des.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
288e_des.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h 228e_des.o: ../../include/openssl/ui_compat.h ../cryptlib.h e_des.c evp_locl.h
289e_des.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h 229e_des3.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
290e_des.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h 230e_des3.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
291e_des.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
292e_des.o: ../../include/openssl/symhacks.h ../cryptlib.h evp_locl.h
293e_des3.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
294e_des3.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
295e_des3.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
296e_des3.o: ../../include/openssl/crypto.h ../../include/openssl/des.h 231e_des3.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
297e_des3.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h 232e_des3.o: ../../include/openssl/des_old.h ../../include/openssl/e_os2.h
298e_des3.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h
299e_des3.o: ../../include/openssl/err.h ../../include/openssl/evp.h 233e_des3.o: ../../include/openssl/err.h ../../include/openssl/evp.h
300e_des3.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h 234e_des3.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
301e_des3.o: ../../include/openssl/md2.h ../../include/openssl/md4.h 235e_des3.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
302e_des3.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h 236e_des3.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
303e_des3.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h 237e_des3.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
304e_des3.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h 238e_des3.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
305e_des3.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h 239e_des3.o: ../../include/openssl/ui_compat.h ../cryptlib.h e_des3.c evp_locl.h
306e_des3.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h 240e_idea.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
307e_des3.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h 241e_idea.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
308e_des3.o: ../../include/openssl/sha.h ../../include/openssl/stack.h 242e_idea.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
309e_des3.o: ../../include/openssl/symhacks.h ../cryptlib.h evp_locl.h
310e_idea.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
311e_idea.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
312e_idea.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
313e_idea.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
314e_idea.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
315e_idea.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h
316e_idea.o: ../../include/openssl/err.h ../../include/openssl/evp.h 243e_idea.o: ../../include/openssl/err.h ../../include/openssl/evp.h
317e_idea.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h 244e_idea.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
318e_idea.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
319e_idea.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
320e_idea.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h 245e_idea.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
321e_idea.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h 246e_idea.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
322e_idea.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h 247e_idea.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h
323e_idea.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h 248e_idea.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
324e_idea.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h 249e_idea.o: ../cryptlib.h e_idea.c evp_locl.h
325e_idea.o: ../../include/openssl/sha.h ../../include/openssl/stack.h 250e_null.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
326e_idea.o: ../../include/openssl/symhacks.h ../cryptlib.h evp_locl.h 251e_null.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
327e_null.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h 252e_null.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
328e_null.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
329e_null.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
330e_null.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
331e_null.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
332e_null.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h
333e_null.o: ../../include/openssl/err.h ../../include/openssl/evp.h 253e_null.o: ../../include/openssl/err.h ../../include/openssl/evp.h
334e_null.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h 254e_null.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
335e_null.o: ../../include/openssl/md2.h ../../include/openssl/md4.h 255e_null.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
336e_null.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h 256e_null.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
337e_null.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h 257e_null.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
338e_null.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h 258e_null.o: ../../include/openssl/symhacks.h ../cryptlib.h e_null.c
339e_null.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h 259e_rc2.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
340e_null.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h 260e_rc2.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
341e_null.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h 261e_rc2.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
342e_null.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
343e_null.o: ../../include/openssl/symhacks.h ../cryptlib.h
344e_rc2.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
345e_rc2.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
346e_rc2.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
347e_rc2.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
348e_rc2.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
349e_rc2.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h
350e_rc2.o: ../../include/openssl/err.h ../../include/openssl/evp.h 262e_rc2.o: ../../include/openssl/err.h ../../include/openssl/evp.h
351e_rc2.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h 263e_rc2.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
352e_rc2.o: ../../include/openssl/md2.h ../../include/openssl/md4.h 264e_rc2.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
353e_rc2.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h 265e_rc2.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
354e_rc2.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h 266e_rc2.o: ../../include/openssl/rc2.h ../../include/openssl/safestack.h
355e_rc2.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h 267e_rc2.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
356e_rc2.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h 268e_rc2.o: ../cryptlib.h e_rc2.c evp_locl.h
357e_rc2.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h 269e_rc4.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
358e_rc2.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h 270e_rc4.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
359e_rc2.o: ../../include/openssl/sha.h ../../include/openssl/stack.h 271e_rc4.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
360e_rc2.o: ../../include/openssl/symhacks.h ../cryptlib.h evp_locl.h
361e_rc4.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
362e_rc4.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
363e_rc4.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
364e_rc4.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
365e_rc4.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
366e_rc4.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h
367e_rc4.o: ../../include/openssl/err.h ../../include/openssl/evp.h 272e_rc4.o: ../../include/openssl/err.h ../../include/openssl/evp.h
368e_rc4.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h 273e_rc4.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
369e_rc4.o: ../../include/openssl/md2.h ../../include/openssl/md4.h 274e_rc4.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
370e_rc4.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h 275e_rc4.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
371e_rc4.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h 276e_rc4.o: ../../include/openssl/rc4.h ../../include/openssl/safestack.h
372e_rc4.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h 277e_rc4.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
373e_rc4.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h 278e_rc4.o: ../cryptlib.h e_rc4.c
374e_rc4.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h 279e_rc5.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
375e_rc4.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h 280e_rc5.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
376e_rc4.o: ../../include/openssl/sha.h ../../include/openssl/stack.h 281e_rc5.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
377e_rc4.o: ../../include/openssl/symhacks.h ../cryptlib.h
378e_rc5.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
379e_rc5.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
380e_rc5.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
381e_rc5.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
382e_rc5.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
383e_rc5.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h
384e_rc5.o: ../../include/openssl/err.h ../../include/openssl/evp.h 282e_rc5.o: ../../include/openssl/err.h ../../include/openssl/evp.h
385e_rc5.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h 283e_rc5.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
386e_rc5.o: ../../include/openssl/md2.h ../../include/openssl/md4.h 284e_rc5.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
387e_rc5.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h 285e_rc5.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
388e_rc5.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h 286e_rc5.o: ../../include/openssl/rc5.h ../../include/openssl/safestack.h
389e_rc5.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h 287e_rc5.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
390e_rc5.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h 288e_rc5.o: ../cryptlib.h e_rc5.c evp_locl.h
391e_rc5.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h 289e_xcbc_d.o: ../../e_os.h ../../include/openssl/asn1.h
392e_rc5.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h 290e_xcbc_d.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
393e_rc5.o: ../../include/openssl/sha.h ../../include/openssl/stack.h 291e_xcbc_d.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
394e_rc5.o: ../../include/openssl/symhacks.h ../cryptlib.h evp_locl.h 292e_xcbc_d.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
395e_xcbc_d.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h 293e_xcbc_d.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
396e_xcbc_d.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h 294e_xcbc_d.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
397e_xcbc_d.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
398e_xcbc_d.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
399e_xcbc_d.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
400e_xcbc_d.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h
401e_xcbc_d.o: ../../include/openssl/err.h ../../include/openssl/evp.h
402e_xcbc_d.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
403e_xcbc_d.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
404e_xcbc_d.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
405e_xcbc_d.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h 295e_xcbc_d.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
406e_xcbc_d.o: ../../include/openssl/opensslconf.h 296e_xcbc_d.o: ../../include/openssl/opensslconf.h
407e_xcbc_d.o: ../../include/openssl/opensslv.h ../../include/openssl/rc2.h 297e_xcbc_d.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
408e_xcbc_d.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h 298e_xcbc_d.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
409e_xcbc_d.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h 299e_xcbc_d.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
410e_xcbc_d.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h 300e_xcbc_d.o: ../../include/openssl/ui_compat.h ../cryptlib.h e_xcbc_d.c
411e_xcbc_d.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h 301encode.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
412e_xcbc_d.o: ../cryptlib.h 302encode.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
413encode.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h 303encode.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
414encode.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
415encode.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
416encode.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
417encode.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
418encode.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h
419encode.o: ../../include/openssl/err.h ../../include/openssl/evp.h 304encode.o: ../../include/openssl/err.h ../../include/openssl/evp.h
420encode.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h 305encode.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
421encode.o: ../../include/openssl/md2.h ../../include/openssl/md4.h 306encode.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
422encode.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h 307encode.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
423encode.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h 308encode.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
424encode.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h 309encode.o: ../../include/openssl/symhacks.h ../cryptlib.h encode.c
425encode.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h 310evp_acnf.o: ../../e_os.h ../../include/openssl/asn1.h
426encode.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h 311evp_acnf.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
427encode.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h 312evp_acnf.o: ../../include/openssl/buffer.h ../../include/openssl/conf.h
428encode.o: ../../include/openssl/sha.h ../../include/openssl/stack.h 313evp_acnf.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h
429encode.o: ../../include/openssl/symhacks.h ../cryptlib.h 314evp_acnf.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
430evp_enc.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h 315evp_acnf.o: ../../include/openssl/engine.h ../../include/openssl/err.h
431evp_enc.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h 316evp_acnf.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
432evp_enc.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h 317evp_acnf.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
433evp_enc.o: ../../include/openssl/crypto.h ../../include/openssl/des.h 318evp_acnf.o: ../../include/openssl/opensslconf.h
319evp_acnf.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
320evp_acnf.o: ../../include/openssl/rand.h ../../include/openssl/rsa.h
321evp_acnf.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
322evp_acnf.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
323evp_acnf.o: ../cryptlib.h evp_acnf.c
324evp_enc.o: ../../e_os.h ../../include/openssl/asn1.h
325evp_enc.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
326evp_enc.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
434evp_enc.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h 327evp_enc.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
435evp_enc.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h 328evp_enc.o: ../../include/openssl/e_os2.h ../../include/openssl/engine.h
436evp_enc.o: ../../include/openssl/err.h ../../include/openssl/evp.h 329evp_enc.o: ../../include/openssl/err.h ../../include/openssl/evp.h
437evp_enc.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h 330evp_enc.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
438evp_enc.o: ../../include/openssl/md2.h ../../include/openssl/md4.h 331evp_enc.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
439evp_enc.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h 332evp_enc.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
440evp_enc.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h 333evp_enc.o: ../../include/openssl/rand.h ../../include/openssl/rsa.h
441evp_enc.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h 334evp_enc.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
442evp_enc.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h 335evp_enc.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
443evp_enc.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h 336evp_enc.o: ../cryptlib.h evp_enc.c evp_locl.h
444evp_enc.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
445evp_enc.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
446evp_enc.o: ../../include/openssl/symhacks.h ../cryptlib.h evp_locl.h
447evp_err.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h 337evp_err.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
448evp_err.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h 338evp_err.o: ../../include/openssl/bn.h ../../include/openssl/crypto.h
449evp_err.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h 339evp_err.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
450evp_err.o: ../../include/openssl/des.h ../../include/openssl/dh.h 340evp_err.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
451evp_err.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
452evp_err.o: ../../include/openssl/err.h ../../include/openssl/evp.h
453evp_err.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
454evp_err.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
455evp_err.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
456evp_err.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h 341evp_err.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
457evp_err.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h 342evp_err.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
458evp_err.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h 343evp_err.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h
459evp_err.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h 344evp_err.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
460evp_err.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h 345evp_err.o: evp_err.c
461evp_err.o: ../../include/openssl/sha.h ../../include/openssl/stack.h 346evp_key.o: ../../e_os.h ../../include/openssl/asn1.h
462evp_err.o: ../../include/openssl/symhacks.h 347evp_key.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
463evp_key.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h 348evp_key.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
464evp_key.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
465evp_key.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
466evp_key.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
467evp_key.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h 349evp_key.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
468evp_key.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h 350evp_key.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
469evp_key.o: ../../include/openssl/err.h ../../include/openssl/evp.h 351evp_key.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
470evp_key.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
471evp_key.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
472evp_key.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
473evp_key.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h 352evp_key.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
474evp_key.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h 353evp_key.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
475evp_key.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h 354evp_key.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
476evp_key.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h 355evp_key.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
477evp_key.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h 356evp_key.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
478evp_key.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h 357evp_key.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
479evp_key.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
480evp_key.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h 358evp_key.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
481evp_key.o: ../cryptlib.h 359evp_key.o: ../cryptlib.h evp_key.c
482evp_lib.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h 360evp_lib.o: ../../e_os.h ../../include/openssl/asn1.h
483evp_lib.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h 361evp_lib.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
484evp_lib.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h 362evp_lib.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
485evp_lib.o: ../../include/openssl/crypto.h ../../include/openssl/des.h 363evp_lib.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
486evp_lib.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h 364evp_lib.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
487evp_lib.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h
488evp_lib.o: ../../include/openssl/err.h ../../include/openssl/evp.h
489evp_lib.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
490evp_lib.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
491evp_lib.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
492evp_lib.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h 365evp_lib.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
493evp_lib.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h 366evp_lib.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
494evp_lib.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h 367evp_lib.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h
495evp_lib.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h 368evp_lib.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
496evp_lib.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h 369evp_lib.o: ../cryptlib.h evp_lib.c
497evp_lib.o: ../../include/openssl/sha.h ../../include/openssl/stack.h 370evp_pbe.o: ../../e_os.h ../../include/openssl/asn1.h
498evp_lib.o: ../../include/openssl/symhacks.h ../cryptlib.h 371evp_pbe.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
499evp_pbe.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h 372evp_pbe.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
500evp_pbe.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
501evp_pbe.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
502evp_pbe.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
503evp_pbe.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h 373evp_pbe.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
504evp_pbe.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h 374evp_pbe.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
505evp_pbe.o: ../../include/openssl/err.h ../../include/openssl/evp.h 375evp_pbe.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
506evp_pbe.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
507evp_pbe.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
508evp_pbe.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
509evp_pbe.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h 376evp_pbe.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
510evp_pbe.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h 377evp_pbe.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
511evp_pbe.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h 378evp_pbe.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
512evp_pbe.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h 379evp_pbe.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
513evp_pbe.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h 380evp_pbe.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
514evp_pbe.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h 381evp_pbe.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
515evp_pbe.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h 382evp_pbe.o: ../../include/openssl/x509_vfy.h ../cryptlib.h evp_pbe.c
516evp_pbe.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h 383evp_pkey.o: ../../e_os.h ../../include/openssl/asn1.h
517evp_pbe.o: ../cryptlib.h 384evp_pkey.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
518evp_pkey.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h 385evp_pkey.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
519evp_pkey.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
520evp_pkey.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
521evp_pkey.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
522evp_pkey.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h 386evp_pkey.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
523evp_pkey.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h 387evp_pkey.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
524evp_pkey.o: ../../include/openssl/err.h ../../include/openssl/evp.h 388evp_pkey.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
525evp_pkey.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
526evp_pkey.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
527evp_pkey.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
528evp_pkey.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h 389evp_pkey.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
529evp_pkey.o: ../../include/openssl/opensslconf.h 390evp_pkey.o: ../../include/openssl/opensslconf.h
530evp_pkey.o: ../../include/openssl/opensslv.h ../../include/openssl/pkcs7.h 391evp_pkey.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
531evp_pkey.o: ../../include/openssl/rand.h ../../include/openssl/rc2.h 392evp_pkey.o: ../../include/openssl/pkcs7.h ../../include/openssl/rand.h
532evp_pkey.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h 393evp_pkey.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
533evp_pkey.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h 394evp_pkey.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
534evp_pkey.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h 395evp_pkey.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
535evp_pkey.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h 396evp_pkey.o: ../../include/openssl/x509_vfy.h ../cryptlib.h evp_pkey.c
536evp_pkey.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h 397m_dss.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
537evp_pkey.o: ../cryptlib.h 398m_dss.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
538m_dss.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h 399m_dss.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h
539m_dss.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h 400m_dss.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
540m_dss.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
541m_dss.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
542m_dss.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
543m_dss.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h
544m_dss.o: ../../include/openssl/err.h ../../include/openssl/evp.h 401m_dss.o: ../../include/openssl/err.h ../../include/openssl/evp.h
545m_dss.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h 402m_dss.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
546m_dss.o: ../../include/openssl/md2.h ../../include/openssl/md4.h 403m_dss.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
547m_dss.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h 404m_dss.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
548m_dss.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h 405m_dss.o: ../../include/openssl/pkcs7.h ../../include/openssl/rsa.h
549m_dss.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
550m_dss.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
551m_dss.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
552m_dss.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
553m_dss.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h 406m_dss.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
554m_dss.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h 407m_dss.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
555m_dss.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h 408m_dss.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
556m_dss.o: ../cryptlib.h 409m_dss.o: ../cryptlib.h m_dss.c
557m_dss1.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h 410m_dss1.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
558m_dss1.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h 411m_dss1.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
559m_dss1.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h 412m_dss1.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h
560m_dss1.o: ../../include/openssl/crypto.h ../../include/openssl/des.h 413m_dss1.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
561m_dss1.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
562m_dss1.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h
563m_dss1.o: ../../include/openssl/err.h ../../include/openssl/evp.h 414m_dss1.o: ../../include/openssl/err.h ../../include/openssl/evp.h
564m_dss1.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h 415m_dss1.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
565m_dss1.o: ../../include/openssl/md2.h ../../include/openssl/md4.h 416m_dss1.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
566m_dss1.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h 417m_dss1.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
567m_dss1.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h 418m_dss1.o: ../../include/openssl/pkcs7.h ../../include/openssl/rsa.h
568m_dss1.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
569m_dss1.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
570m_dss1.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
571m_dss1.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
572m_dss1.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h 419m_dss1.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
573m_dss1.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h 420m_dss1.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
574m_dss1.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h 421m_dss1.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
575m_dss1.o: ../cryptlib.h 422m_dss1.o: ../cryptlib.h m_dss1.c
576m_md2.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h 423m_md2.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
577m_md2.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h 424m_md2.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
578m_md2.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h 425m_md2.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h
579m_md2.o: ../../include/openssl/crypto.h ../../include/openssl/des.h 426m_md2.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
580m_md2.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
581m_md2.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h
582m_md2.o: ../../include/openssl/err.h ../../include/openssl/evp.h 427m_md2.o: ../../include/openssl/err.h ../../include/openssl/evp.h
583m_md2.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h 428m_md2.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
584m_md2.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
585m_md2.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
586m_md2.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h 429m_md2.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
587m_md2.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h 430m_md2.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
588m_md2.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h 431m_md2.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
589m_md2.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h 432m_md2.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
590m_md2.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h 433m_md2.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
591m_md2.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h 434m_md2.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
592m_md2.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h 435m_md2.o: ../../include/openssl/x509_vfy.h ../cryptlib.h m_md2.c
593m_md2.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h 436m_md4.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
594m_md2.o: ../cryptlib.h 437m_md4.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
595m_md4.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h 438m_md4.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h
596m_md4.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h 439m_md4.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
597m_md4.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
598m_md4.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
599m_md4.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
600m_md4.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h
601m_md4.o: ../../include/openssl/err.h ../../include/openssl/evp.h 440m_md4.o: ../../include/openssl/err.h ../../include/openssl/evp.h
602m_md4.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h 441m_md4.o: ../../include/openssl/lhash.h ../../include/openssl/md4.h
603m_md4.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
604m_md4.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
605m_md4.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h 442m_md4.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
606m_md4.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h 443m_md4.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
607m_md4.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h 444m_md4.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
608m_md4.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h 445m_md4.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
609m_md4.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h 446m_md4.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
610m_md4.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h 447m_md4.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
611m_md4.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h 448m_md4.o: ../../include/openssl/x509_vfy.h ../cryptlib.h m_md4.c
612m_md4.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h 449m_md5.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
613m_md4.o: ../cryptlib.h 450m_md5.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
614m_md5.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h 451m_md5.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h
615m_md5.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h 452m_md5.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
616m_md5.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
617m_md5.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
618m_md5.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
619m_md5.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h
620m_md5.o: ../../include/openssl/err.h ../../include/openssl/evp.h 453m_md5.o: ../../include/openssl/err.h ../../include/openssl/evp.h
621m_md5.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h 454m_md5.o: ../../include/openssl/lhash.h ../../include/openssl/md5.h
622m_md5.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
623m_md5.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
624m_md5.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h 455m_md5.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
625m_md5.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h 456m_md5.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
626m_md5.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h 457m_md5.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
627m_md5.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h 458m_md5.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
628m_md5.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h 459m_md5.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
629m_md5.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h 460m_md5.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
630m_md5.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h 461m_md5.o: ../../include/openssl/x509_vfy.h ../cryptlib.h m_md5.c
631m_md5.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h 462m_mdc2.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
632m_md5.o: ../cryptlib.h 463m_mdc2.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
633m_mdc2.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
634m_mdc2.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
635m_mdc2.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
636m_mdc2.o: ../../include/openssl/crypto.h ../../include/openssl/des.h 464m_mdc2.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
637m_mdc2.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h 465m_mdc2.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
638m_mdc2.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h 466m_mdc2.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
639m_mdc2.o: ../../include/openssl/err.h ../../include/openssl/evp.h 467m_mdc2.o: ../../include/openssl/err.h ../../include/openssl/evp.h
640m_mdc2.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h 468m_mdc2.o: ../../include/openssl/lhash.h ../../include/openssl/mdc2.h
641m_mdc2.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
642m_mdc2.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
643m_mdc2.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h 469m_mdc2.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
644m_mdc2.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h 470m_mdc2.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
645m_mdc2.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h 471m_mdc2.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
646m_mdc2.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h 472m_mdc2.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
647m_mdc2.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h 473m_mdc2.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
648m_mdc2.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h 474m_mdc2.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
649m_mdc2.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h 475m_mdc2.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h
650m_mdc2.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h 476m_mdc2.o: ../../include/openssl/x509_vfy.h ../cryptlib.h m_mdc2.c
651m_mdc2.o: ../cryptlib.h 477m_null.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
652m_null.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h 478m_null.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
653m_null.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h 479m_null.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h
654m_null.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h 480m_null.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
655m_null.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
656m_null.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
657m_null.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h
658m_null.o: ../../include/openssl/err.h ../../include/openssl/evp.h 481m_null.o: ../../include/openssl/err.h ../../include/openssl/evp.h
659m_null.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h 482m_null.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
660m_null.o: ../../include/openssl/md2.h ../../include/openssl/md4.h 483m_null.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
661m_null.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h 484m_null.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
662m_null.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h 485m_null.o: ../../include/openssl/pkcs7.h ../../include/openssl/rsa.h
663m_null.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
664m_null.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
665m_null.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
666m_null.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
667m_null.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h 486m_null.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
668m_null.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h 487m_null.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
669m_null.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h 488m_null.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
670m_null.o: ../cryptlib.h 489m_null.o: ../cryptlib.h m_null.c
671m_ripemd.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h 490m_ripemd.o: ../../e_os.h ../../include/openssl/asn1.h
672m_ripemd.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h 491m_ripemd.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
673m_ripemd.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h 492m_ripemd.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
674m_ripemd.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
675m_ripemd.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h 493m_ripemd.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
676m_ripemd.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h 494m_ripemd.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
677m_ripemd.o: ../../include/openssl/err.h ../../include/openssl/evp.h 495m_ripemd.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
678m_ripemd.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
679m_ripemd.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
680m_ripemd.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
681m_ripemd.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h 496m_ripemd.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
682m_ripemd.o: ../../include/openssl/opensslconf.h 497m_ripemd.o: ../../include/openssl/opensslconf.h
683m_ripemd.o: ../../include/openssl/opensslv.h ../../include/openssl/pkcs7.h 498m_ripemd.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
684m_ripemd.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h 499m_ripemd.o: ../../include/openssl/pkcs7.h ../../include/openssl/ripemd.h
685m_ripemd.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
686m_ripemd.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h 500m_ripemd.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
687m_ripemd.o: ../../include/openssl/sha.h ../../include/openssl/stack.h 501m_ripemd.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
688m_ripemd.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h 502m_ripemd.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
689m_ripemd.o: ../../include/openssl/x509_vfy.h ../cryptlib.h 503m_ripemd.o: ../../include/openssl/x509_vfy.h ../cryptlib.h m_ripemd.c
690m_sha.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h 504m_sha.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
691m_sha.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h 505m_sha.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
692m_sha.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h 506m_sha.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h
693m_sha.o: ../../include/openssl/crypto.h ../../include/openssl/des.h 507m_sha.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
694m_sha.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
695m_sha.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h
696m_sha.o: ../../include/openssl/err.h ../../include/openssl/evp.h 508m_sha.o: ../../include/openssl/err.h ../../include/openssl/evp.h
697m_sha.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h 509m_sha.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
698m_sha.o: ../../include/openssl/md2.h ../../include/openssl/md4.h 510m_sha.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
699m_sha.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h 511m_sha.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
700m_sha.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h 512m_sha.o: ../../include/openssl/pkcs7.h ../../include/openssl/rsa.h
701m_sha.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
702m_sha.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
703m_sha.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
704m_sha.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
705m_sha.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h 513m_sha.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
706m_sha.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h 514m_sha.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
707m_sha.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h 515m_sha.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
708m_sha.o: ../cryptlib.h 516m_sha.o: ../cryptlib.h m_sha.c
709m_sha1.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h 517m_sha1.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
710m_sha1.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h 518m_sha1.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
711m_sha1.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h 519m_sha1.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h
712m_sha1.o: ../../include/openssl/crypto.h ../../include/openssl/des.h 520m_sha1.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
713m_sha1.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
714m_sha1.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h
715m_sha1.o: ../../include/openssl/err.h ../../include/openssl/evp.h 521m_sha1.o: ../../include/openssl/err.h ../../include/openssl/evp.h
716m_sha1.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h 522m_sha1.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
717m_sha1.o: ../../include/openssl/md2.h ../../include/openssl/md4.h 523m_sha1.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
718m_sha1.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h 524m_sha1.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
719m_sha1.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h 525m_sha1.o: ../../include/openssl/pkcs7.h ../../include/openssl/rsa.h
720m_sha1.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
721m_sha1.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
722m_sha1.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
723m_sha1.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
724m_sha1.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h 526m_sha1.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
725m_sha1.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h 527m_sha1.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
726m_sha1.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h 528m_sha1.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
727m_sha1.o: ../cryptlib.h 529m_sha1.o: ../cryptlib.h m_sha1.c
728names.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h 530names.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
729names.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h 531names.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
730names.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h 532names.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h
731names.o: ../../include/openssl/crypto.h ../../include/openssl/des.h 533names.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
732names.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
733names.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h
734names.o: ../../include/openssl/err.h ../../include/openssl/evp.h 534names.o: ../../include/openssl/err.h ../../include/openssl/evp.h
735names.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h 535names.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
736names.o: ../../include/openssl/md2.h ../../include/openssl/md4.h 536names.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
737names.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h 537names.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
738names.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h 538names.o: ../../include/openssl/pkcs7.h ../../include/openssl/rsa.h
739names.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
740names.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
741names.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
742names.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
743names.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h 539names.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
744names.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h 540names.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
745names.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h 541names.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
746names.o: ../cryptlib.h 542names.o: ../cryptlib.h names.c
747p5_crpt.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h 543p5_crpt.o: ../../e_os.h ../../include/openssl/asn1.h
748p5_crpt.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h 544p5_crpt.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
749p5_crpt.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h 545p5_crpt.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
750p5_crpt.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
751p5_crpt.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h 546p5_crpt.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
752p5_crpt.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h 547p5_crpt.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
753p5_crpt.o: ../../include/openssl/err.h ../../include/openssl/evp.h 548p5_crpt.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
754p5_crpt.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
755p5_crpt.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
756p5_crpt.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
757p5_crpt.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h 549p5_crpt.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
758p5_crpt.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h 550p5_crpt.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
759p5_crpt.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h 551p5_crpt.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
760p5_crpt.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h 552p5_crpt.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
761p5_crpt.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h 553p5_crpt.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
762p5_crpt.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h 554p5_crpt.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
763p5_crpt.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h 555p5_crpt.o: ../../include/openssl/x509_vfy.h ../cryptlib.h p5_crpt.c
764p5_crpt.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h 556p5_crpt2.o: ../../e_os.h ../../include/openssl/asn1.h
765p5_crpt.o: ../cryptlib.h 557p5_crpt2.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
766p5_crpt2.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h 558p5_crpt2.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
767p5_crpt2.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
768p5_crpt2.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
769p5_crpt2.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
770p5_crpt2.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h 559p5_crpt2.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
771p5_crpt2.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h 560p5_crpt2.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
772p5_crpt2.o: ../../include/openssl/err.h ../../include/openssl/evp.h 561p5_crpt2.o: ../../include/openssl/evp.h ../../include/openssl/hmac.h
773p5_crpt2.o: ../../include/openssl/hmac.h ../../include/openssl/idea.h 562p5_crpt2.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
774p5_crpt2.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
775p5_crpt2.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
776p5_crpt2.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
777p5_crpt2.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h 563p5_crpt2.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
778p5_crpt2.o: ../../include/openssl/opensslv.h ../../include/openssl/pkcs7.h 564p5_crpt2.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
779p5_crpt2.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h 565p5_crpt2.o: ../../include/openssl/pkcs7.h ../../include/openssl/rsa.h
780p5_crpt2.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h 566p5_crpt2.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
781p5_crpt2.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h 567p5_crpt2.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
782p5_crpt2.o: ../../include/openssl/sha.h ../../include/openssl/stack.h 568p5_crpt2.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
783p5_crpt2.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h 569p5_crpt2.o: ../cryptlib.h p5_crpt2.c
784p5_crpt2.o: ../../include/openssl/x509_vfy.h ../cryptlib.h 570p_dec.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
785p_dec.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h 571p_dec.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
786p_dec.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h 572p_dec.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h
787p_dec.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h 573p_dec.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
788p_dec.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
789p_dec.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
790p_dec.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h
791p_dec.o: ../../include/openssl/err.h ../../include/openssl/evp.h 574p_dec.o: ../../include/openssl/err.h ../../include/openssl/evp.h
792p_dec.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h 575p_dec.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
793p_dec.o: ../../include/openssl/md2.h ../../include/openssl/md4.h 576p_dec.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
794p_dec.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h 577p_dec.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
795p_dec.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
796p_dec.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
797p_dec.o: ../../include/openssl/pkcs7.h ../../include/openssl/rand.h 578p_dec.o: ../../include/openssl/pkcs7.h ../../include/openssl/rand.h
798p_dec.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
799p_dec.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
800p_dec.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h 579p_dec.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
801p_dec.o: ../../include/openssl/sha.h ../../include/openssl/stack.h 580p_dec.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
802p_dec.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h 581p_dec.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
803p_dec.o: ../../include/openssl/x509_vfy.h ../cryptlib.h 582p_dec.o: ../../include/openssl/x509_vfy.h ../cryptlib.h p_dec.c
804p_enc.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h 583p_enc.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
805p_enc.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h 584p_enc.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
806p_enc.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h 585p_enc.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h
807p_enc.o: ../../include/openssl/crypto.h ../../include/openssl/des.h 586p_enc.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
808p_enc.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
809p_enc.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h
810p_enc.o: ../../include/openssl/err.h ../../include/openssl/evp.h 587p_enc.o: ../../include/openssl/err.h ../../include/openssl/evp.h
811p_enc.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h 588p_enc.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
812p_enc.o: ../../include/openssl/md2.h ../../include/openssl/md4.h 589p_enc.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
813p_enc.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h 590p_enc.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
814p_enc.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
815p_enc.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
816p_enc.o: ../../include/openssl/pkcs7.h ../../include/openssl/rand.h 591p_enc.o: ../../include/openssl/pkcs7.h ../../include/openssl/rand.h
817p_enc.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
818p_enc.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
819p_enc.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h 592p_enc.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
820p_enc.o: ../../include/openssl/sha.h ../../include/openssl/stack.h 593p_enc.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
821p_enc.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h 594p_enc.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
822p_enc.o: ../../include/openssl/x509_vfy.h ../cryptlib.h 595p_enc.o: ../../include/openssl/x509_vfy.h ../cryptlib.h p_enc.c
823p_lib.o: ../../include/openssl/asn1.h ../../include/openssl/asn1_mac.h 596p_lib.o: ../../e_os.h ../../include/openssl/asn1.h
824p_lib.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h 597p_lib.o: ../../include/openssl/asn1_mac.h ../../include/openssl/bio.h
825p_lib.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h 598p_lib.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
826p_lib.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h 599p_lib.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h
827p_lib.o: ../../include/openssl/des.h ../../include/openssl/dh.h 600p_lib.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
828p_lib.o: ../../include/openssl/dsa.h ../../include/openssl/e_os.h 601p_lib.o: ../../include/openssl/err.h ../../include/openssl/evp.h
829p_lib.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h 602p_lib.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
830p_lib.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
831p_lib.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
832p_lib.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
833p_lib.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
834p_lib.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h 603p_lib.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
835p_lib.o: ../../include/openssl/opensslv.h ../../include/openssl/pkcs7.h 604p_lib.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
836p_lib.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h 605p_lib.o: ../../include/openssl/pkcs7.h ../../include/openssl/rsa.h
837p_lib.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h 606p_lib.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
838p_lib.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h 607p_lib.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
839p_lib.o: ../../include/openssl/sha.h ../../include/openssl/stack.h 608p_lib.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
840p_lib.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h 609p_lib.o: ../cryptlib.h p_lib.c
841p_lib.o: ../../include/openssl/x509_vfy.h ../cryptlib.h 610p_open.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
842p_open.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h 611p_open.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
843p_open.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h 612p_open.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h
844p_open.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h 613p_open.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
845p_open.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
846p_open.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
847p_open.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h
848p_open.o: ../../include/openssl/err.h ../../include/openssl/evp.h 614p_open.o: ../../include/openssl/err.h ../../include/openssl/evp.h
849p_open.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h 615p_open.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
850p_open.o: ../../include/openssl/md2.h ../../include/openssl/md4.h 616p_open.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
851p_open.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h 617p_open.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
852p_open.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h 618p_open.o: ../../include/openssl/pkcs7.h ../../include/openssl/rsa.h
853p_open.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
854p_open.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
855p_open.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
856p_open.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
857p_open.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h 619p_open.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
858p_open.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h 620p_open.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
859p_open.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h 621p_open.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
860p_open.o: ../cryptlib.h 622p_open.o: ../cryptlib.h p_open.c
861p_seal.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h 623p_seal.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
862p_seal.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h 624p_seal.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
863p_seal.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h 625p_seal.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h
864p_seal.o: ../../include/openssl/crypto.h ../../include/openssl/des.h 626p_seal.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
865p_seal.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
866p_seal.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h
867p_seal.o: ../../include/openssl/err.h ../../include/openssl/evp.h 627p_seal.o: ../../include/openssl/err.h ../../include/openssl/evp.h
868p_seal.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h 628p_seal.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
869p_seal.o: ../../include/openssl/md2.h ../../include/openssl/md4.h 629p_seal.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
870p_seal.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h 630p_seal.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
871p_seal.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
872p_seal.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
873p_seal.o: ../../include/openssl/pkcs7.h ../../include/openssl/rand.h 631p_seal.o: ../../include/openssl/pkcs7.h ../../include/openssl/rand.h
874p_seal.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
875p_seal.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
876p_seal.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h 632p_seal.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
877p_seal.o: ../../include/openssl/sha.h ../../include/openssl/stack.h 633p_seal.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
878p_seal.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h 634p_seal.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
879p_seal.o: ../../include/openssl/x509_vfy.h ../cryptlib.h 635p_seal.o: ../../include/openssl/x509_vfy.h ../cryptlib.h p_seal.c
880p_sign.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h 636p_sign.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
881p_sign.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h 637p_sign.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
882p_sign.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h 638p_sign.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h
883p_sign.o: ../../include/openssl/crypto.h ../../include/openssl/des.h 639p_sign.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
884p_sign.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
885p_sign.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h
886p_sign.o: ../../include/openssl/err.h ../../include/openssl/evp.h 640p_sign.o: ../../include/openssl/err.h ../../include/openssl/evp.h
887p_sign.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h 641p_sign.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
888p_sign.o: ../../include/openssl/md2.h ../../include/openssl/md4.h 642p_sign.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
889p_sign.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h 643p_sign.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
890p_sign.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h 644p_sign.o: ../../include/openssl/pkcs7.h ../../include/openssl/rsa.h
891p_sign.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
892p_sign.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
893p_sign.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
894p_sign.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
895p_sign.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h 645p_sign.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
896p_sign.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h 646p_sign.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
897p_sign.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h 647p_sign.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
898p_sign.o: ../cryptlib.h 648p_sign.o: ../cryptlib.h p_sign.c
899p_verify.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h 649p_verify.o: ../../e_os.h ../../include/openssl/asn1.h
900p_verify.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h 650p_verify.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
901p_verify.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h 651p_verify.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
902p_verify.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
903p_verify.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h 652p_verify.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
904p_verify.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h 653p_verify.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
905p_verify.o: ../../include/openssl/err.h ../../include/openssl/evp.h 654p_verify.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
906p_verify.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
907p_verify.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
908p_verify.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
909p_verify.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h 655p_verify.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
910p_verify.o: ../../include/openssl/opensslconf.h 656p_verify.o: ../../include/openssl/opensslconf.h
911p_verify.o: ../../include/openssl/opensslv.h ../../include/openssl/pkcs7.h 657p_verify.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
912p_verify.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h 658p_verify.o: ../../include/openssl/pkcs7.h ../../include/openssl/rsa.h
913p_verify.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h 659p_verify.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
914p_verify.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h 660p_verify.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
915p_verify.o: ../../include/openssl/sha.h ../../include/openssl/stack.h 661p_verify.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
916p_verify.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h 662p_verify.o: ../cryptlib.h p_verify.c
917p_verify.o: ../../include/openssl/x509_vfy.h ../cryptlib.h
diff --git a/src/lib/libcrypto/evp/bio_b64.c b/src/lib/libcrypto/evp/bio_b64.c
index af6fa2ae8f..f12eac1b55 100644
--- a/src/lib/libcrypto/evp/bio_b64.c
+++ b/src/lib/libcrypto/evp/bio_b64.c
@@ -465,7 +465,8 @@ static long b64_ctrl(BIO *b, int cmd, long num, void *ptr)
465 break; 465 break;
466 case BIO_CTRL_WPENDING: /* More to write in buffer */ 466 case BIO_CTRL_WPENDING: /* More to write in buffer */
467 ret=ctx->buf_len-ctx->buf_off; 467 ret=ctx->buf_len-ctx->buf_off;
468 if ((ret == 0) && (ctx->base64.num != 0)) 468 if ((ret == 0) && (ctx->encode != B64_NONE)
469 && (ctx->base64.num != 0))
469 ret=1; 470 ret=1;
470 else if (ret <= 0) 471 else if (ret <= 0)
471 ret=BIO_ctrl(b->next_bio,cmd,num,ptr); 472 ret=BIO_ctrl(b->next_bio,cmd,num,ptr);
@@ -500,7 +501,7 @@ again:
500 goto again; 501 goto again;
501 } 502 }
502 } 503 }
503 else if (ctx->base64.num != 0) 504 else if (ctx->encode != B64_NONE && ctx->base64.num != 0)
504 { 505 {
505 ctx->buf_off=0; 506 ctx->buf_off=0;
506 EVP_EncodeFinal(&(ctx->base64), 507 EVP_EncodeFinal(&(ctx->base64),
diff --git a/src/lib/libcrypto/evp/bio_enc.c b/src/lib/libcrypto/evp/bio_enc.c
index 831c71a2b5..05f4249458 100644
--- a/src/lib/libcrypto/evp/bio_enc.c
+++ b/src/lib/libcrypto/evp/bio_enc.c
@@ -71,6 +71,7 @@ static int enc_new(BIO *h);
71static int enc_free(BIO *data); 71static int enc_free(BIO *data);
72static long enc_callback_ctrl(BIO *h, int cmd, bio_info_cb *fps); 72static long enc_callback_ctrl(BIO *h, int cmd, bio_info_cb *fps);
73#define ENC_BLOCK_SIZE (1024*4) 73#define ENC_BLOCK_SIZE (1024*4)
74#define BUF_OFFSET EVP_MAX_BLOCK_LENGTH
74 75
75typedef struct enc_struct 76typedef struct enc_struct
76 { 77 {
@@ -80,7 +81,10 @@ typedef struct enc_struct
80 int finished; 81 int finished;
81 int ok; /* bad decrypt */ 82 int ok; /* bad decrypt */
82 EVP_CIPHER_CTX cipher; 83 EVP_CIPHER_CTX cipher;
83 char buf[ENC_BLOCK_SIZE+10]; 84 /* buf is larger than ENC_BLOCK_SIZE because EVP_DecryptUpdate
85 * can return up to a block more data than is presented to it
86 */
87 char buf[ENC_BLOCK_SIZE+BUF_OFFSET+2];
84 } BIO_ENC_CTX; 88 } BIO_ENC_CTX;
85 89
86static BIO_METHOD methods_enc= 90static BIO_METHOD methods_enc=
@@ -170,9 +174,9 @@ static int enc_read(BIO *b, char *out, int outl)
170 { 174 {
171 if (ctx->cont <= 0) break; 175 if (ctx->cont <= 0) break;
172 176
173 /* read in at offset 8, read the EVP_Cipher 177 /* read in at IV offset, read the EVP_Cipher
174 * documentation about why */ 178 * documentation about why */
175 i=BIO_read(b->next_bio,&(ctx->buf[8]),ENC_BLOCK_SIZE); 179 i=BIO_read(b->next_bio,&(ctx->buf[BUF_OFFSET]),ENC_BLOCK_SIZE);
176 180
177 if (i <= 0) 181 if (i <= 0)
178 { 182 {
@@ -180,7 +184,7 @@ static int enc_read(BIO *b, char *out, int outl)
180 if (!BIO_should_retry(b->next_bio)) 184 if (!BIO_should_retry(b->next_bio))
181 { 185 {
182 ctx->cont=i; 186 ctx->cont=i;
183 i=EVP_CipherFinal(&(ctx->cipher), 187 i=EVP_CipherFinal_ex(&(ctx->cipher),
184 (unsigned char *)ctx->buf, 188 (unsigned char *)ctx->buf,
185 &(ctx->buf_len)); 189 &(ctx->buf_len));
186 ctx->ok=i; 190 ctx->ok=i;
@@ -196,7 +200,7 @@ static int enc_read(BIO *b, char *out, int outl)
196 { 200 {
197 EVP_CipherUpdate(&(ctx->cipher), 201 EVP_CipherUpdate(&(ctx->cipher),
198 (unsigned char *)ctx->buf,&ctx->buf_len, 202 (unsigned char *)ctx->buf,&ctx->buf_len,
199 (unsigned char *)&(ctx->buf[8]),i); 203 (unsigned char *)&(ctx->buf[BUF_OFFSET]),i);
200 ctx->cont=1; 204 ctx->cont=1;
201 /* Note: it is possible for EVP_CipherUpdate to 205 /* Note: it is possible for EVP_CipherUpdate to
202 * decrypt zero bytes because this is or looks like 206 * decrypt zero bytes because this is or looks like
@@ -294,7 +298,7 @@ static long enc_ctrl(BIO *b, int cmd, long num, void *ptr)
294 case BIO_CTRL_RESET: 298 case BIO_CTRL_RESET:
295 ctx->ok=1; 299 ctx->ok=1;
296 ctx->finished=0; 300 ctx->finished=0;
297 EVP_CipherInit(&(ctx->cipher),NULL,NULL,NULL, 301 EVP_CipherInit_ex(&(ctx->cipher),NULL,NULL,NULL,NULL,
298 ctx->cipher.encrypt); 302 ctx->cipher.encrypt);
299 ret=BIO_ctrl(b->next_bio,cmd,num,ptr); 303 ret=BIO_ctrl(b->next_bio,cmd,num,ptr);
300 break; 304 break;
@@ -331,7 +335,7 @@ again:
331 { 335 {
332 ctx->finished=1; 336 ctx->finished=1;
333 ctx->buf_off=0; 337 ctx->buf_off=0;
334 ret=EVP_CipherFinal(&(ctx->cipher), 338 ret=EVP_CipherFinal_ex(&(ctx->cipher),
335 (unsigned char *)ctx->buf, 339 (unsigned char *)ctx->buf,
336 &(ctx->buf_len)); 340 &(ctx->buf_len));
337 ctx->ok=(int)ret; 341 ctx->ok=(int)ret;
@@ -417,7 +421,7 @@ void BIO_set_cipher(BIO *b, const EVP_CIPHER *c, unsigned char *k,
417 421
418 b->init=1; 422 b->init=1;
419 ctx=(BIO_ENC_CTX *)b->ptr; 423 ctx=(BIO_ENC_CTX *)b->ptr;
420 EVP_CipherInit(&(ctx->cipher),c,k,i,e); 424 EVP_CipherInit_ex(&(ctx->cipher),c,NULL, k,i,e);
421 425
422 if (b->callback != NULL) 426 if (b->callback != NULL)
423 b->callback(b,BIO_CB_CTRL,(const char *)c,BIO_CTRL_SET,e,1L); 427 b->callback(b,BIO_CB_CTRL,(const char *)c,BIO_CTRL_SET,e,1L);
diff --git a/src/lib/libcrypto/evp/bio_md.c b/src/lib/libcrypto/evp/bio_md.c
index 2373c247d8..c632dfb202 100644
--- a/src/lib/libcrypto/evp/bio_md.c
+++ b/src/lib/libcrypto/evp/bio_md.c
@@ -96,7 +96,7 @@ static int md_new(BIO *bi)
96 { 96 {
97 EVP_MD_CTX *ctx; 97 EVP_MD_CTX *ctx;
98 98
99 ctx=(EVP_MD_CTX *)OPENSSL_malloc(sizeof(EVP_MD_CTX)); 99 ctx=EVP_MD_CTX_create();
100 if (ctx == NULL) return(0); 100 if (ctx == NULL) return(0);
101 101
102 bi->init=0; 102 bi->init=0;
@@ -108,7 +108,7 @@ static int md_new(BIO *bi)
108static int md_free(BIO *a) 108static int md_free(BIO *a)
109 { 109 {
110 if (a == NULL) return(0); 110 if (a == NULL) return(0);
111 OPENSSL_free(a->ptr); 111 EVP_MD_CTX_destroy(a->ptr);
112 a->ptr=NULL; 112 a->ptr=NULL;
113 a->init=0; 113 a->init=0;
114 a->flags=0; 114 a->flags=0;
@@ -121,7 +121,7 @@ static int md_read(BIO *b, char *out, int outl)
121 EVP_MD_CTX *ctx; 121 EVP_MD_CTX *ctx;
122 122
123 if (out == NULL) return(0); 123 if (out == NULL) return(0);
124 ctx=(EVP_MD_CTX *)b->ptr; 124 ctx=b->ptr;
125 125
126 if ((ctx == NULL) || (b->next_bio == NULL)) return(0); 126 if ((ctx == NULL) || (b->next_bio == NULL)) return(0);
127 127
@@ -145,7 +145,7 @@ static int md_write(BIO *b, const char *in, int inl)
145 EVP_MD_CTX *ctx; 145 EVP_MD_CTX *ctx;
146 146
147 if ((in == NULL) || (inl <= 0)) return(0); 147 if ((in == NULL) || (inl <= 0)) return(0);
148 ctx=(EVP_MD_CTX *)b->ptr; 148 ctx=b->ptr;
149 149
150 if ((ctx != NULL) && (b->next_bio != NULL)) 150 if ((ctx != NULL) && (b->next_bio != NULL))
151 ret=BIO_write(b->next_bio,in,inl); 151 ret=BIO_write(b->next_bio,in,inl);
@@ -170,13 +170,13 @@ static long md_ctrl(BIO *b, int cmd, long num, void *ptr)
170 long ret=1; 170 long ret=1;
171 BIO *dbio; 171 BIO *dbio;
172 172
173 ctx=(EVP_MD_CTX *)b->ptr; 173 ctx=b->ptr;
174 174
175 switch (cmd) 175 switch (cmd)
176 { 176 {
177 case BIO_CTRL_RESET: 177 case BIO_CTRL_RESET:
178 if (b->init) 178 if (b->init)
179 EVP_DigestInit(ctx,ctx->digest); 179 EVP_DigestInit_ex(ctx,ctx->digest, NULL);
180 else 180 else
181 ret=0; 181 ret=0;
182 ret=BIO_ctrl(b->next_bio,cmd,num,ptr); 182 ret=BIO_ctrl(b->next_bio,cmd,num,ptr);
@@ -184,7 +184,7 @@ static long md_ctrl(BIO *b, int cmd, long num, void *ptr)
184 case BIO_C_GET_MD: 184 case BIO_C_GET_MD:
185 if (b->init) 185 if (b->init)
186 { 186 {
187 ppmd=(const EVP_MD **)ptr; 187 ppmd=ptr;
188 *ppmd=ctx->digest; 188 *ppmd=ctx->digest;
189 } 189 }
190 else 190 else
@@ -193,7 +193,7 @@ static long md_ctrl(BIO *b, int cmd, long num, void *ptr)
193 case BIO_C_GET_MD_CTX: 193 case BIO_C_GET_MD_CTX:
194 if (b->init) 194 if (b->init)
195 { 195 {
196 pctx=(EVP_MD_CTX **)ptr; 196 pctx=ptr;
197 *pctx=ctx; 197 *pctx=ctx;
198 } 198 }
199 else 199 else
@@ -206,14 +206,14 @@ static long md_ctrl(BIO *b, int cmd, long num, void *ptr)
206 break; 206 break;
207 207
208 case BIO_C_SET_MD: 208 case BIO_C_SET_MD:
209 md=(EVP_MD *)ptr; 209 md=ptr;
210 EVP_DigestInit(ctx,md); 210 EVP_DigestInit_ex(ctx,md, NULL);
211 b->init=1; 211 b->init=1;
212 break; 212 break;
213 case BIO_CTRL_DUP: 213 case BIO_CTRL_DUP:
214 dbio=(BIO *)ptr; 214 dbio=ptr;
215 dctx=(EVP_MD_CTX *)dbio->ptr; 215 dctx=dbio->ptr;
216 memcpy(dctx,ctx,sizeof(ctx)); 216 EVP_MD_CTX_copy_ex(dctx,ctx);
217 b->init=1; 217 b->init=1;
218 break; 218 break;
219 default: 219 default:
@@ -243,10 +243,10 @@ static int md_gets(BIO *bp, char *buf, int size)
243 unsigned int ret; 243 unsigned int ret;
244 244
245 245
246 ctx=(EVP_MD_CTX *)bp->ptr; 246 ctx=bp->ptr;
247 if (size < ctx->digest->md_size) 247 if (size < ctx->digest->md_size)
248 return(0); 248 return(0);
249 EVP_DigestFinal(ctx,(unsigned char *)buf,&ret); 249 EVP_DigestFinal_ex(ctx,(unsigned char *)buf,&ret);
250 return((int)ret); 250 return((int)ret);
251 } 251 }
252 252
diff --git a/src/lib/libcrypto/evp/bio_ok.c b/src/lib/libcrypto/evp/bio_ok.c
index e617ce1d43..3cbc6e7848 100644
--- a/src/lib/libcrypto/evp/bio_ok.c
+++ b/src/lib/libcrypto/evp/bio_ok.c
@@ -162,7 +162,7 @@ typedef struct ok_struct
162 EVP_MD_CTX md; 162 EVP_MD_CTX md;
163 int blockout; /* output block is ready */ 163 int blockout; /* output block is ready */
164 int sigio; /* must process signature */ 164 int sigio; /* must process signature */
165 char buf[IOBS]; 165 unsigned char buf[IOBS];
166 } BIO_OK_CTX; 166 } BIO_OK_CTX;
167 167
168static BIO_METHOD methods_ok= 168static BIO_METHOD methods_ok=
@@ -199,6 +199,8 @@ static int ok_new(BIO *bi)
199 ctx->blockout= 0; 199 ctx->blockout= 0;
200 ctx->sigio=1; 200 ctx->sigio=1;
201 201
202 EVP_MD_CTX_init(&ctx->md);
203
202 bi->init=0; 204 bi->init=0;
203 bi->ptr=(char *)ctx; 205 bi->ptr=(char *)ctx;
204 bi->flags=0; 206 bi->flags=0;
@@ -208,6 +210,7 @@ static int ok_new(BIO *bi)
208static int ok_free(BIO *a) 210static int ok_free(BIO *a)
209 { 211 {
210 if (a == NULL) return(0); 212 if (a == NULL) return(0);
213 EVP_MD_CTX_cleanup(&((BIO_OK_CTX *)a->ptr)->md);
211 memset(a->ptr,0,sizeof(BIO_OK_CTX)); 214 memset(a->ptr,0,sizeof(BIO_OK_CTX));
212 OPENSSL_free(a->ptr); 215 OPENSSL_free(a->ptr);
213 a->ptr=NULL; 216 a->ptr=NULL;
@@ -353,7 +356,7 @@ static long ok_ctrl(BIO *b, int cmd, long num, void *ptr)
353 long ret=1; 356 long ret=1;
354 int i; 357 int i;
355 358
356 ctx=(BIO_OK_CTX *)b->ptr; 359 ctx=b->ptr;
357 360
358 switch (cmd) 361 switch (cmd)
359 { 362 {
@@ -411,14 +414,14 @@ static long ok_ctrl(BIO *b, int cmd, long num, void *ptr)
411 ret=(long)ctx->cont; 414 ret=(long)ctx->cont;
412 break; 415 break;
413 case BIO_C_SET_MD: 416 case BIO_C_SET_MD:
414 md=(EVP_MD *)ptr; 417 md=ptr;
415 EVP_DigestInit(&(ctx->md),md); 418 EVP_DigestInit_ex(&ctx->md, md, NULL);
416 b->init=1; 419 b->init=1;
417 break; 420 break;
418 case BIO_C_GET_MD: 421 case BIO_C_GET_MD:
419 if (b->init) 422 if (b->init)
420 { 423 {
421 ppmd=(const EVP_MD **)ptr; 424 ppmd=ptr;
422 *ppmd=ctx->md.digest; 425 *ppmd=ctx->md.digest;
423 } 426 }
424 else 427 else
@@ -462,19 +465,22 @@ static void sig_out(BIO* b)
462 BIO_OK_CTX *ctx; 465 BIO_OK_CTX *ctx;
463 EVP_MD_CTX *md; 466 EVP_MD_CTX *md;
464 467
465 ctx=(BIO_OK_CTX *)b->ptr; 468 ctx=b->ptr;
466 md= &(ctx->md); 469 md=&ctx->md;
467 470
468 if(ctx->buf_len+ 2* md->digest->md_size > OK_BLOCK_SIZE) return; 471 if(ctx->buf_len+ 2* md->digest->md_size > OK_BLOCK_SIZE) return;
469 472
470 EVP_DigestInit(md, md->digest); 473 EVP_DigestInit_ex(md, md->digest, NULL);
471 RAND_pseudo_bytes(&(md->md.base[0]), md->digest->md_size); 474 /* FIXME: there's absolutely no guarantee this makes any sense at all,
472 memcpy(&(ctx->buf[ctx->buf_len]), &(md->md.base[0]), md->digest->md_size); 475 * particularly now EVP_MD_CTX has been restructured.
476 */
477 RAND_pseudo_bytes(md->md_data, md->digest->md_size);
478 memcpy(&(ctx->buf[ctx->buf_len]), md->md_data, md->digest->md_size);
473 longswap(&(ctx->buf[ctx->buf_len]), md->digest->md_size); 479 longswap(&(ctx->buf[ctx->buf_len]), md->digest->md_size);
474 ctx->buf_len+= md->digest->md_size; 480 ctx->buf_len+= md->digest->md_size;
475 481
476 EVP_DigestUpdate(md, WELLKNOWN, strlen(WELLKNOWN)); 482 EVP_DigestUpdate(md, WELLKNOWN, strlen(WELLKNOWN));
477 md->digest->final(&(ctx->buf[ctx->buf_len]), &(md->md.base[0])); 483 EVP_DigestFinal_ex(md, &(ctx->buf[ctx->buf_len]), NULL);
478 ctx->buf_len+= md->digest->md_size; 484 ctx->buf_len+= md->digest->md_size;
479 ctx->blockout= 1; 485 ctx->blockout= 1;
480 ctx->sigio= 0; 486 ctx->sigio= 0;
@@ -487,18 +493,18 @@ static void sig_in(BIO* b)
487 unsigned char tmp[EVP_MAX_MD_SIZE]; 493 unsigned char tmp[EVP_MAX_MD_SIZE];
488 int ret= 0; 494 int ret= 0;
489 495
490 ctx=(BIO_OK_CTX *)b->ptr; 496 ctx=b->ptr;
491 md= &(ctx->md); 497 md=&ctx->md;
492 498
493 if(ctx->buf_len- ctx->buf_off < 2* md->digest->md_size) return; 499 if(ctx->buf_len- ctx->buf_off < 2* md->digest->md_size) return;
494 500
495 EVP_DigestInit(md, md->digest); 501 EVP_DigestInit_ex(md, md->digest, NULL);
496 memcpy(&(md->md.base[0]), &(ctx->buf[ctx->buf_off]), md->digest->md_size); 502 memcpy(md->md_data, &(ctx->buf[ctx->buf_off]), md->digest->md_size);
497 longswap(&(md->md.base[0]), md->digest->md_size); 503 longswap(md->md_data, md->digest->md_size);
498 ctx->buf_off+= md->digest->md_size; 504 ctx->buf_off+= md->digest->md_size;
499 505
500 EVP_DigestUpdate(md, WELLKNOWN, strlen(WELLKNOWN)); 506 EVP_DigestUpdate(md, WELLKNOWN, strlen(WELLKNOWN));
501 md->digest->final(tmp, &(md->md.base[0])); 507 EVP_DigestFinal_ex(md, tmp, NULL);
502 ret= memcmp(&(ctx->buf[ctx->buf_off]), tmp, md->digest->md_size) == 0; 508 ret= memcmp(&(ctx->buf[ctx->buf_off]), tmp, md->digest->md_size) == 0;
503 ctx->buf_off+= md->digest->md_size; 509 ctx->buf_off+= md->digest->md_size;
504 if(ret == 1) 510 if(ret == 1)
@@ -523,15 +529,15 @@ static void block_out(BIO* b)
523 EVP_MD_CTX *md; 529 EVP_MD_CTX *md;
524 unsigned long tl; 530 unsigned long tl;
525 531
526 ctx=(BIO_OK_CTX *)b->ptr; 532 ctx=b->ptr;
527 md= &(ctx->md); 533 md=&ctx->md;
528 534
529 tl= ctx->buf_len- OK_BLOCK_BLOCK; 535 tl= ctx->buf_len- OK_BLOCK_BLOCK;
530 tl= swapem(tl); 536 tl= swapem(tl);
531 memcpy(ctx->buf, &tl, OK_BLOCK_BLOCK); 537 memcpy(ctx->buf, &tl, OK_BLOCK_BLOCK);
532 tl= swapem(tl); 538 tl= swapem(tl);
533 EVP_DigestUpdate(md, (unsigned char*) &(ctx->buf[OK_BLOCK_BLOCK]), tl); 539 EVP_DigestUpdate(md, (unsigned char*) &(ctx->buf[OK_BLOCK_BLOCK]), tl);
534 md->digest->final(&(ctx->buf[ctx->buf_len]), &(md->md.base[0])); 540 EVP_DigestFinal_ex(md, &(ctx->buf[ctx->buf_len]), NULL);
535 ctx->buf_len+= md->digest->md_size; 541 ctx->buf_len+= md->digest->md_size;
536 ctx->blockout= 1; 542 ctx->blockout= 1;
537 } 543 }
@@ -543,15 +549,15 @@ static void block_in(BIO* b)
543 long tl= 0; 549 long tl= 0;
544 unsigned char tmp[EVP_MAX_MD_SIZE]; 550 unsigned char tmp[EVP_MAX_MD_SIZE];
545 551
546 ctx=(BIO_OK_CTX *)b->ptr; 552 ctx=b->ptr;
547 md= &(ctx->md); 553 md=&ctx->md;
548 554
549 memcpy(&tl, ctx->buf, OK_BLOCK_BLOCK); 555 memcpy(&tl, ctx->buf, OK_BLOCK_BLOCK);
550 tl= swapem(tl); 556 tl= swapem(tl);
551 if (ctx->buf_len < tl+ OK_BLOCK_BLOCK+ md->digest->md_size) return; 557 if (ctx->buf_len < tl+ OK_BLOCK_BLOCK+ md->digest->md_size) return;
552 558
553 EVP_DigestUpdate(md, (unsigned char*) &(ctx->buf[OK_BLOCK_BLOCK]), tl); 559 EVP_DigestUpdate(md, (unsigned char*) &(ctx->buf[OK_BLOCK_BLOCK]), tl);
554 md->digest->final(tmp, &(md->md.base[0])); 560 EVP_DigestFinal_ex(md, tmp, NULL);
555 if(memcmp(&(ctx->buf[tl+ OK_BLOCK_BLOCK]), tmp, md->digest->md_size) == 0) 561 if(memcmp(&(ctx->buf[tl+ OK_BLOCK_BLOCK]), tmp, md->digest->md_size) == 0)
556 { 562 {
557 /* there might be parts from next block lurking around ! */ 563 /* there might be parts from next block lurking around ! */
diff --git a/src/lib/libcrypto/evp/c_all.c b/src/lib/libcrypto/evp/c_all.c
index 1e185830a3..3d390dfbf1 100644
--- a/src/lib/libcrypto/evp/c_all.c
+++ b/src/lib/libcrypto/evp/c_all.c
@@ -60,8 +60,16 @@
60#include "cryptlib.h" 60#include "cryptlib.h"
61#include <openssl/evp.h> 61#include <openssl/evp.h>
62 62
63#undef OpenSSL_add_all_algorithms
64
63void OpenSSL_add_all_algorithms(void) 65void OpenSSL_add_all_algorithms(void)
64{ 66 {
67 OPENSSL_add_all_algorithms_noconf();
68 }
69
70void OPENSSL_add_all_algorithms_noconf(void)
71 {
65 OpenSSL_add_all_ciphers(); 72 OpenSSL_add_all_ciphers();
66 OpenSSL_add_all_digests(); 73 OpenSSL_add_all_digests();
67} 74 ENGINE_setup_openbsd();
75 }
diff --git a/src/lib/libcrypto/evp/c_allc.c b/src/lib/libcrypto/evp/c_allc.c
index f24d3756c9..37e6ab83a5 100644
--- a/src/lib/libcrypto/evp/c_allc.c
+++ b/src/lib/libcrypto/evp/c_allc.c
@@ -64,7 +64,8 @@
64 64
65void OpenSSL_add_all_ciphers(void) 65void OpenSSL_add_all_ciphers(void)
66 { 66 {
67#ifndef NO_DES 67
68#ifndef OPENSSL_NO_DES
68 EVP_add_cipher(EVP_des_cfb()); 69 EVP_add_cipher(EVP_des_cfb());
69 EVP_add_cipher(EVP_des_ede_cfb()); 70 EVP_add_cipher(EVP_des_ede_cfb());
70 EVP_add_cipher(EVP_des_ede3_cfb()); 71 EVP_add_cipher(EVP_des_ede3_cfb());
@@ -90,12 +91,12 @@ void OpenSSL_add_all_ciphers(void)
90 EVP_add_cipher(EVP_des_ede3()); 91 EVP_add_cipher(EVP_des_ede3());
91#endif 92#endif
92 93
93#ifndef NO_RC4 94#ifndef OPENSSL_NO_RC4
94 EVP_add_cipher(EVP_rc4()); 95 EVP_add_cipher(EVP_rc4());
95 EVP_add_cipher(EVP_rc4_40()); 96 EVP_add_cipher(EVP_rc4_40());
96#endif 97#endif
97 98
98#ifndef NO_IDEA 99#ifndef OPENSSL_NO_IDEA
99 EVP_add_cipher(EVP_idea_ecb()); 100 EVP_add_cipher(EVP_idea_ecb());
100 EVP_add_cipher(EVP_idea_cfb()); 101 EVP_add_cipher(EVP_idea_cfb());
101 EVP_add_cipher(EVP_idea_ofb()); 102 EVP_add_cipher(EVP_idea_ofb());
@@ -104,7 +105,7 @@ void OpenSSL_add_all_ciphers(void)
104 EVP_add_cipher_alias(SN_idea_cbc,"idea"); 105 EVP_add_cipher_alias(SN_idea_cbc,"idea");
105#endif 106#endif
106 107
107#ifndef NO_RC2 108#ifndef OPENSSL_NO_RC2
108 EVP_add_cipher(EVP_rc2_ecb()); 109 EVP_add_cipher(EVP_rc2_ecb());
109 EVP_add_cipher(EVP_rc2_cfb()); 110 EVP_add_cipher(EVP_rc2_cfb());
110 EVP_add_cipher(EVP_rc2_ofb()); 111 EVP_add_cipher(EVP_rc2_ofb());
@@ -115,7 +116,7 @@ void OpenSSL_add_all_ciphers(void)
115 EVP_add_cipher_alias(SN_rc2_cbc,"rc2"); 116 EVP_add_cipher_alias(SN_rc2_cbc,"rc2");
116#endif 117#endif
117 118
118#ifndef NO_BF 119#ifndef OPENSSL_NO_BF
119 EVP_add_cipher(EVP_bf_ecb()); 120 EVP_add_cipher(EVP_bf_ecb());
120 EVP_add_cipher(EVP_bf_cfb()); 121 EVP_add_cipher(EVP_bf_cfb());
121 EVP_add_cipher(EVP_bf_ofb()); 122 EVP_add_cipher(EVP_bf_ofb());
@@ -125,7 +126,7 @@ void OpenSSL_add_all_ciphers(void)
125 EVP_add_cipher_alias(SN_bf_cbc,"blowfish"); 126 EVP_add_cipher_alias(SN_bf_cbc,"blowfish");
126#endif 127#endif
127 128
128#ifndef NO_CAST 129#ifndef OPENSSL_NO_CAST
129 EVP_add_cipher(EVP_cast5_ecb()); 130 EVP_add_cipher(EVP_cast5_ecb());
130 EVP_add_cipher(EVP_cast5_cfb()); 131 EVP_add_cipher(EVP_cast5_cfb());
131 EVP_add_cipher(EVP_cast5_ofb()); 132 EVP_add_cipher(EVP_cast5_ofb());
@@ -136,7 +137,7 @@ void OpenSSL_add_all_ciphers(void)
136 EVP_add_cipher_alias(SN_cast5_cbc,"cast-cbc"); 137 EVP_add_cipher_alias(SN_cast5_cbc,"cast-cbc");
137#endif 138#endif
138 139
139#ifndef NO_RC5 140#ifndef OPENSSL_NO_RC5
140 EVP_add_cipher(EVP_rc5_32_12_16_ecb()); 141 EVP_add_cipher(EVP_rc5_32_12_16_ecb());
141 EVP_add_cipher(EVP_rc5_32_12_16_cfb()); 142 EVP_add_cipher(EVP_rc5_32_12_16_cfb());
142 EVP_add_cipher(EVP_rc5_32_12_16_ofb()); 143 EVP_add_cipher(EVP_rc5_32_12_16_ofb());
@@ -144,6 +145,21 @@ void OpenSSL_add_all_ciphers(void)
144 EVP_add_cipher_alias(SN_rc5_cbc,"rc5"); 145 EVP_add_cipher_alias(SN_rc5_cbc,"rc5");
145 EVP_add_cipher_alias(SN_rc5_cbc,"RC5"); 146 EVP_add_cipher_alias(SN_rc5_cbc,"RC5");
146#endif 147#endif
148
149#ifndef OPENSSL_NO_AES
150 EVP_add_cipher(EVP_aes_128_ecb());
151 EVP_add_cipher(EVP_aes_128_cbc());
152 EVP_add_cipher_alias(SN_aes_128_cbc,"AES128");
153 EVP_add_cipher_alias(SN_aes_128_cbc,"aes128");
154 EVP_add_cipher(EVP_aes_192_ecb());
155 EVP_add_cipher(EVP_aes_192_cbc());
156 EVP_add_cipher_alias(SN_aes_192_cbc,"AES192");
157 EVP_add_cipher_alias(SN_aes_192_cbc,"aes192");
158 EVP_add_cipher(EVP_aes_256_ecb());
159 EVP_add_cipher(EVP_aes_256_cbc());
160 EVP_add_cipher_alias(SN_aes_256_cbc,"AES256");
161 EVP_add_cipher_alias(SN_aes_256_cbc,"aes256");
162#endif
147 PKCS12_PBE_add(); 163 PKCS12_PBE_add();
148 PKCS5_PBE_add(); 164 PKCS5_PBE_add();
149 } 165 }
diff --git a/src/lib/libcrypto/evp/c_alld.c b/src/lib/libcrypto/evp/c_alld.c
index bbf059eb85..be91cdb037 100644
--- a/src/lib/libcrypto/evp/c_alld.c
+++ b/src/lib/libcrypto/evp/c_alld.c
@@ -64,38 +64,38 @@
64 64
65void OpenSSL_add_all_digests(void) 65void OpenSSL_add_all_digests(void)
66 { 66 {
67#ifndef NO_MD2 67#ifndef OPENSSL_NO_MD2
68 EVP_add_digest(EVP_md2()); 68 EVP_add_digest(EVP_md2());
69#endif 69#endif
70#ifndef NO_MD4 70#ifndef OPENSSL_NO_MD4
71 EVP_add_digest(EVP_md4()); 71 EVP_add_digest(EVP_md4());
72#endif 72#endif
73#ifndef NO_MD5 73#ifndef OPENSSL_NO_MD5
74 EVP_add_digest(EVP_md5()); 74 EVP_add_digest(EVP_md5());
75 EVP_add_digest_alias(SN_md5,"ssl2-md5"); 75 EVP_add_digest_alias(SN_md5,"ssl2-md5");
76 EVP_add_digest_alias(SN_md5,"ssl3-md5"); 76 EVP_add_digest_alias(SN_md5,"ssl3-md5");
77#endif 77#endif
78#ifndef NO_SHA 78#ifndef OPENSSL_NO_SHA
79 EVP_add_digest(EVP_sha()); 79 EVP_add_digest(EVP_sha());
80#ifndef NO_DSA 80#ifndef OPENSSL_NO_DSA
81 EVP_add_digest(EVP_dss()); 81 EVP_add_digest(EVP_dss());
82#endif 82#endif
83#endif 83#endif
84#ifndef NO_SHA 84#ifndef OPENSSL_NO_SHA
85 EVP_add_digest(EVP_sha1()); 85 EVP_add_digest(EVP_sha1());
86 EVP_add_digest_alias(SN_sha1,"ssl3-sha1"); 86 EVP_add_digest_alias(SN_sha1,"ssl3-sha1");
87 EVP_add_digest_alias(SN_sha1WithRSAEncryption,SN_sha1WithRSA); 87 EVP_add_digest_alias(SN_sha1WithRSAEncryption,SN_sha1WithRSA);
88#ifndef NO_DSA 88#ifndef OPENSSL_NO_DSA
89 EVP_add_digest(EVP_dss1()); 89 EVP_add_digest(EVP_dss1());
90 EVP_add_digest_alias(SN_dsaWithSHA1,SN_dsaWithSHA1_2); 90 EVP_add_digest_alias(SN_dsaWithSHA1,SN_dsaWithSHA1_2);
91 EVP_add_digest_alias(SN_dsaWithSHA1,"DSS1"); 91 EVP_add_digest_alias(SN_dsaWithSHA1,"DSS1");
92 EVP_add_digest_alias(SN_dsaWithSHA1,"dss1"); 92 EVP_add_digest_alias(SN_dsaWithSHA1,"dss1");
93#endif 93#endif
94#endif 94#endif
95#if !defined(NO_MDC2) && !defined(NO_DES) 95#if !defined(OPENSSL_NO_MDC2) && !defined(OPENSSL_NO_DES)
96 EVP_add_digest(EVP_mdc2()); 96 EVP_add_digest(EVP_mdc2());
97#endif 97#endif
98#ifndef NO_RIPEMD 98#ifndef OPENSSL_NO_RIPEMD
99 EVP_add_digest(EVP_ripemd160()); 99 EVP_add_digest(EVP_ripemd160());
100 EVP_add_digest_alias(SN_ripemd160,"ripemd"); 100 EVP_add_digest_alias(SN_ripemd160,"ripemd");
101 EVP_add_digest_alias(SN_ripemd160,"rmd160"); 101 EVP_add_digest_alias(SN_ripemd160,"rmd160");
diff --git a/src/lib/libcrypto/evp/digest.c b/src/lib/libcrypto/evp/digest.c
index c560733568..a969ac69ed 100644
--- a/src/lib/libcrypto/evp/digest.c
+++ b/src/lib/libcrypto/evp/digest.c
@@ -55,38 +55,258 @@
55 * copied and put under another distribution licence 55 * copied and put under another distribution licence
56 * [including the GNU Public Licence.] 56 * [including the GNU Public Licence.]
57 */ 57 */
58/* ====================================================================
59 * Copyright (c) 1998-2001 The OpenSSL Project. All rights reserved.
60 *
61 * Redistribution and use in source and binary forms, with or without
62 * modification, are permitted provided that the following conditions
63 * are met:
64 *
65 * 1. Redistributions of source code must retain the above copyright
66 * notice, this list of conditions and the following disclaimer.
67 *
68 * 2. Redistributions in binary form must reproduce the above copyright
69 * notice, this list of conditions and the following disclaimer in
70 * the documentation and/or other materials provided with the
71 * distribution.
72 *
73 * 3. All advertising materials mentioning features or use of this
74 * software must display the following acknowledgment:
75 * "This product includes software developed by the OpenSSL Project
76 * for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
77 *
78 * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
79 * endorse or promote products derived from this software without
80 * prior written permission. For written permission, please contact
81 * openssl-core@openssl.org.
82 *
83 * 5. Products derived from this software may not be called "OpenSSL"
84 * nor may "OpenSSL" appear in their names without prior written
85 * permission of the OpenSSL Project.
86 *
87 * 6. Redistributions of any form whatsoever must retain the following
88 * acknowledgment:
89 * "This product includes software developed by the OpenSSL Project
90 * for use in the OpenSSL Toolkit (http://www.openssl.org/)"
91 *
92 * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
93 * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
94 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
95 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
96 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
97 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
98 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
99 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
100 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
101 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
102 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
103 * OF THE POSSIBILITY OF SUCH DAMAGE.
104 * ====================================================================
105 *
106 * This product includes cryptographic software written by Eric Young
107 * (eay@cryptsoft.com). This product includes software written by Tim
108 * Hudson (tjh@cryptsoft.com).
109 *
110 */
58 111
59#include <stdio.h> 112#include <stdio.h>
60#include "cryptlib.h" 113#include "cryptlib.h"
61#include <openssl/objects.h> 114#include <openssl/objects.h>
62#include <openssl/evp.h> 115#include <openssl/evp.h>
116#include <openssl/engine.h>
117
118void EVP_MD_CTX_init(EVP_MD_CTX *ctx)
119 {
120 memset(ctx,'\0',sizeof *ctx);
121 }
122
123EVP_MD_CTX *EVP_MD_CTX_create(void)
124 {
125 EVP_MD_CTX *ctx=OPENSSL_malloc(sizeof *ctx);
126
127 EVP_MD_CTX_init(ctx);
128
129 return ctx;
130 }
131
132int EVP_DigestInit(EVP_MD_CTX *ctx, const EVP_MD *type)
133 {
134 EVP_MD_CTX_init(ctx);
135 return EVP_DigestInit_ex(ctx, type, NULL);
136 }
63 137
64void EVP_DigestInit(EVP_MD_CTX *ctx, const EVP_MD *type) 138int EVP_DigestInit_ex(EVP_MD_CTX *ctx, const EVP_MD *type, ENGINE *impl)
65 { 139 {
66 ctx->digest=type; 140 EVP_MD_CTX_clear_flags(ctx,EVP_MD_CTX_FLAG_CLEANED);
67 type->init(&(ctx->md)); 141 /* Whether it's nice or not, "Inits" can be used on "Final"'d contexts
142 * so this context may already have an ENGINE! Try to avoid releasing
143 * the previous handle, re-querying for an ENGINE, and having a
144 * reinitialisation, when it may all be unecessary. */
145 if (ctx->engine && ctx->digest && (!type ||
146 (type && (type->type == ctx->digest->type))))
147 goto skip_to_init;
148 if (type)
149 {
150 /* Ensure an ENGINE left lying around from last time is cleared
151 * (the previous check attempted to avoid this if the same
152 * ENGINE and EVP_MD could be used). */
153 if(ctx->engine)
154 ENGINE_finish(ctx->engine);
155 if(impl)
156 {
157 if (!ENGINE_init(impl))
158 {
159 EVPerr(EVP_F_EVP_DIGESTINIT, EVP_R_INITIALIZATION_ERROR);
160 return 0;
161 }
162 }
163 else
164 /* Ask if an ENGINE is reserved for this job */
165 impl = ENGINE_get_digest_engine(type->type);
166 if(impl)
167 {
168 /* There's an ENGINE for this job ... (apparently) */
169 const EVP_MD *d = ENGINE_get_digest(impl, type->type);
170 if(!d)
171 {
172 /* Same comment from evp_enc.c */
173 EVPerr(EVP_F_EVP_DIGESTINIT, EVP_R_INITIALIZATION_ERROR);
174 return 0;
175 }
176 /* We'll use the ENGINE's private digest definition */
177 type = d;
178 /* Store the ENGINE functional reference so we know
179 * 'type' came from an ENGINE and we need to release
180 * it when done. */
181 ctx->engine = impl;
182 }
183 else
184 ctx->engine = NULL;
185 }
186 else if(!ctx->digest)
187 {
188 EVPerr(EVP_F_EVP_DIGESTINIT, EVP_R_NO_DIGEST_SET);
189 return 0;
190 }
191 if (ctx->digest != type)
192 {
193 if (ctx->digest && ctx->digest->ctx_size)
194 OPENSSL_free(ctx->md_data);
195 ctx->digest=type;
196 if (type->ctx_size)
197 ctx->md_data=OPENSSL_malloc(type->ctx_size);
198 }
199skip_to_init:
200 return ctx->digest->init(ctx);
68 } 201 }
69 202
70void EVP_DigestUpdate(EVP_MD_CTX *ctx, const void *data, 203int EVP_DigestUpdate(EVP_MD_CTX *ctx, const void *data,
71 unsigned int count) 204 unsigned int count)
72 { 205 {
73 ctx->digest->update(&(ctx->md.base[0]),data,(unsigned long)count); 206 return ctx->digest->update(ctx,data,(unsigned long)count);
207 }
208
209/* The caller can assume that this removes any secret data from the context */
210int EVP_DigestFinal(EVP_MD_CTX *ctx, unsigned char *md, unsigned int *size)
211 {
212 int ret;
213 ret = EVP_DigestFinal_ex(ctx, md, size);
214 EVP_MD_CTX_cleanup(ctx);
215 return ret;
74 } 216 }
75 217
76void EVP_DigestFinal(EVP_MD_CTX *ctx, unsigned char *md, unsigned int *size) 218/* The caller can assume that this removes any secret data from the context */
219int EVP_DigestFinal_ex(EVP_MD_CTX *ctx, unsigned char *md, unsigned int *size)
77 { 220 {
78 ctx->digest->final(md,&(ctx->md.base[0])); 221 int ret;
222 ret=ctx->digest->final(ctx,md);
79 if (size != NULL) 223 if (size != NULL)
80 *size=ctx->digest->md_size; 224 *size=ctx->digest->md_size;
81 memset(&(ctx->md),0,sizeof(ctx->md)); 225 if (ctx->digest->cleanup)
226 {
227 ctx->digest->cleanup(ctx);
228 EVP_MD_CTX_set_flags(ctx,EVP_MD_CTX_FLAG_CLEANED);
229 }
230 memset(ctx->md_data,0,ctx->digest->ctx_size);
231 return ret;
232 }
233
234int EVP_MD_CTX_copy(EVP_MD_CTX *out, const EVP_MD_CTX *in)
235 {
236 EVP_MD_CTX_init(out);
237 return EVP_MD_CTX_copy_ex(out, in);
238 }
239
240int EVP_MD_CTX_copy_ex(EVP_MD_CTX *out, const EVP_MD_CTX *in)
241 {
242 if ((in == NULL) || (in->digest == NULL))
243 {
244 EVPerr(EVP_F_EVP_MD_CTX_COPY,EVP_R_INPUT_NOT_INITIALIZED);
245 return 0;
246 }
247 /* Make sure it's safe to copy a digest context using an ENGINE */
248 if (in->engine && !ENGINE_init(in->engine))
249 {
250 EVPerr(EVP_F_EVP_MD_CTX_COPY,ERR_R_ENGINE_LIB);
251 return 0;
252 }
253
254 EVP_MD_CTX_cleanup(out);
255 memcpy(out,in,sizeof *out);
256
257 if (out->digest->ctx_size)
258 {
259 out->md_data=OPENSSL_malloc(out->digest->ctx_size);
260 memcpy(out->md_data,in->md_data,out->digest->ctx_size);
261 }
262
263 if (out->digest->copy)
264 return out->digest->copy(out,in);
265
266 return 1;
267 }
268
269int EVP_Digest(void *data, unsigned int count,
270 unsigned char *md, unsigned int *size, const EVP_MD *type, ENGINE *impl)
271 {
272 EVP_MD_CTX ctx;
273 int ret;
274
275 EVP_MD_CTX_init(&ctx);
276 EVP_MD_CTX_set_flags(&ctx,EVP_MD_CTX_FLAG_ONESHOT);
277 ret=EVP_DigestInit_ex(&ctx, type, impl)
278 && EVP_DigestUpdate(&ctx, data, count)
279 && EVP_DigestFinal_ex(&ctx, md, size);
280 EVP_MD_CTX_cleanup(&ctx);
281
282 return ret;
82 } 283 }
83 284
84int EVP_MD_CTX_copy(EVP_MD_CTX *out, EVP_MD_CTX *in) 285void EVP_MD_CTX_destroy(EVP_MD_CTX *ctx)
85{ 286 {
86 if ((in == NULL) || (in->digest == NULL)) { 287 EVP_MD_CTX_cleanup(ctx);
87 EVPerr(EVP_F_EVP_MD_CTX_COPY,EVP_R_INPUT_NOT_INITIALIZED); 288 OPENSSL_free(ctx);
88 return 0; 289 }
89 } 290
90 memcpy((char *)out,(char *)in,in->digest->ctx_size); 291/* This call frees resources associated with the context */
91 return 1; 292int EVP_MD_CTX_cleanup(EVP_MD_CTX *ctx)
92} 293 {
294 /* Don't assume ctx->md_data was cleaned in EVP_Digest_Final,
295 * because sometimes only copies of the context are ever finalised.
296 */
297 if (ctx->digest && ctx->digest->cleanup
298 && !EVP_MD_CTX_test_flags(ctx,EVP_MD_CTX_FLAG_CLEANED))
299 ctx->digest->cleanup(ctx);
300 if (ctx->digest && ctx->digest->ctx_size && ctx->md_data)
301 {
302 memset(ctx->md_data,0,ctx->digest->ctx_size);
303 OPENSSL_free(ctx->md_data);
304 }
305 if(ctx->engine)
306 /* The EVP_MD we used belongs to an ENGINE, release the
307 * functional reference we held for this reason. */
308 ENGINE_finish(ctx->engine);
309 memset(ctx,'\0',sizeof *ctx);
310
311 return 1;
312 }
diff --git a/src/lib/libcrypto/evp/e_aes.c b/src/lib/libcrypto/evp/e_aes.c
new file mode 100644
index 0000000000..9d03a9602f
--- /dev/null
+++ b/src/lib/libcrypto/evp/e_aes.c
@@ -0,0 +1,99 @@
1/* ====================================================================
2 * Copyright (c) 2001 The OpenSSL Project. All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 *
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 *
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in
13 * the documentation and/or other materials provided with the
14 * distribution.
15 *
16 * 3. All advertising materials mentioning features or use of this
17 * software must display the following acknowledgment:
18 * "This product includes software developed by the OpenSSL Project
19 * for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
20 *
21 * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
22 * endorse or promote products derived from this software without
23 * prior written permission. For written permission, please contact
24 * openssl-core@openssl.org.
25 *
26 * 5. Products derived from this software may not be called "OpenSSL"
27 * nor may "OpenSSL" appear in their names without prior written
28 * permission of the OpenSSL Project.
29 *
30 * 6. Redistributions of any form whatsoever must retain the following
31 * acknowledgment:
32 * "This product includes software developed by the OpenSSL Project
33 * for use in the OpenSSL Toolkit (http://www.openssl.org/)"
34 *
35 * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
36 * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
37 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
38 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
39 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
40 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
41 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
42 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
43 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
44 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
45 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
46 * OF THE POSSIBILITY OF SUCH DAMAGE.
47 * ====================================================================
48 *
49 */
50
51#ifndef OPENSSL_NO_AES
52#include <openssl/evp.h>
53#include <openssl/err.h>
54#include <string.h>
55#include <assert.h>
56#include <openssl/aes.h>
57#include "evp_locl.h"
58
59static int aes_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
60 const unsigned char *iv, int enc);
61
62typedef struct
63 {
64 AES_KEY ks;
65 } EVP_AES_KEY;
66
67#define data(ctx) EVP_C_DATA(EVP_AES_KEY,ctx)
68
69IMPLEMENT_BLOCK_CIPHER(aes_128, ks, AES, EVP_AES_KEY,
70 NID_aes_128, 16, 16, 16, 128,
71 0, aes_init_key, NULL,
72 EVP_CIPHER_set_asn1_iv,
73 EVP_CIPHER_get_asn1_iv,
74 NULL)
75IMPLEMENT_BLOCK_CIPHER(aes_192, ks, AES, EVP_AES_KEY,
76 NID_aes_192, 16, 24, 16, 128,
77 0, aes_init_key, NULL,
78 EVP_CIPHER_set_asn1_iv,
79 EVP_CIPHER_get_asn1_iv,
80 NULL)
81IMPLEMENT_BLOCK_CIPHER(aes_256, ks, AES, EVP_AES_KEY,
82 NID_aes_256, 16, 32, 16, 128,
83 0, aes_init_key, NULL,
84 EVP_CIPHER_set_asn1_iv,
85 EVP_CIPHER_get_asn1_iv,
86 NULL)
87
88static int aes_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
89 const unsigned char *iv, int enc) {
90
91 if (enc)
92 AES_set_encrypt_key(key, ctx->key_len * 8, ctx->cipher_data);
93 else
94 AES_set_decrypt_key(key, ctx->key_len * 8, ctx->cipher_data);
95
96 return 1;
97}
98
99#endif
diff --git a/src/lib/libcrypto/evp/e_bf.c b/src/lib/libcrypto/evp/e_bf.c
index 53559b0b65..e74337567b 100644
--- a/src/lib/libcrypto/evp/e_bf.c
+++ b/src/lib/libcrypto/evp/e_bf.c
@@ -56,24 +56,32 @@
56 * [including the GNU Public Licence.] 56 * [including the GNU Public Licence.]
57 */ 57 */
58 58
59#ifndef NO_BF 59#ifndef OPENSSL_NO_BF
60#include <stdio.h> 60#include <stdio.h>
61#include "cryptlib.h" 61#include "cryptlib.h"
62#include <openssl/evp.h> 62#include <openssl/evp.h>
63#include "evp_locl.h" 63#include "evp_locl.h"
64#include <openssl/objects.h> 64#include <openssl/objects.h>
65#include <openssl/blowfish.h>
65 66
66static int bf_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, 67static int bf_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
67 const unsigned char *iv, int enc); 68 const unsigned char *iv, int enc);
68 69
69IMPLEMENT_BLOCK_CIPHER(bf, bf_ks, BF, bf_ks, NID_bf, 8, 16, 8, 70typedef struct
71 {
72 BF_KEY ks;
73 } EVP_BF_KEY;
74
75#define data(ctx) EVP_C_DATA(EVP_BF_KEY,ctx)
76
77IMPLEMENT_BLOCK_CIPHER(bf, ks, BF, EVP_BF_KEY, NID_bf, 8, 16, 8, 64,
70 EVP_CIPH_VARIABLE_LENGTH, bf_init_key, NULL, 78 EVP_CIPH_VARIABLE_LENGTH, bf_init_key, NULL,
71 EVP_CIPHER_set_asn1_iv, EVP_CIPHER_get_asn1_iv, NULL) 79 EVP_CIPHER_set_asn1_iv, EVP_CIPHER_get_asn1_iv, NULL)
72 80
73static int bf_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, 81static int bf_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
74 const unsigned char *iv, int enc) 82 const unsigned char *iv, int enc)
75 { 83 {
76 BF_set_key(&(ctx->c.bf_ks),EVP_CIPHER_CTX_key_length(ctx),key); 84 BF_set_key(&data(ctx)->ks,EVP_CIPHER_CTX_key_length(ctx),key);
77 return 1; 85 return 1;
78 } 86 }
79 87
diff --git a/src/lib/libcrypto/evp/e_cast.c b/src/lib/libcrypto/evp/e_cast.c
index e5af7fb4ed..3400fef187 100644
--- a/src/lib/libcrypto/evp/e_cast.c
+++ b/src/lib/libcrypto/evp/e_cast.c
@@ -56,26 +56,34 @@
56 * [including the GNU Public Licence.] 56 * [including the GNU Public Licence.]
57 */ 57 */
58 58
59#ifndef NO_CAST 59#ifndef OPENSSL_NO_CAST
60 60
61#include <stdio.h> 61#include <stdio.h>
62#include "cryptlib.h" 62#include "cryptlib.h"
63#include <openssl/evp.h> 63#include <openssl/evp.h>
64#include <openssl/objects.h> 64#include <openssl/objects.h>
65#include "evp_locl.h" 65#include "evp_locl.h"
66#include <openssl/cast.h>
66 67
67static int cast_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, 68static int cast_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
68 const unsigned char *iv,int enc); 69 const unsigned char *iv,int enc);
69 70
70IMPLEMENT_BLOCK_CIPHER(cast5, cast_ks, CAST, cast_ks, 71typedef struct
71 NID_cast5, 8, EVP_CAST5_KEY_SIZE, 8, 72 {
73 CAST_KEY ks;
74 } EVP_CAST_KEY;
75
76#define data(ctx) EVP_C_DATA(EVP_CAST_KEY,ctx)
77
78IMPLEMENT_BLOCK_CIPHER(cast5, ks, CAST, EVP_CAST_KEY,
79 NID_cast5, 8, CAST_KEY_LENGTH, 8, 64,
72 EVP_CIPH_VARIABLE_LENGTH, cast_init_key, NULL, 80 EVP_CIPH_VARIABLE_LENGTH, cast_init_key, NULL,
73 EVP_CIPHER_set_asn1_iv, EVP_CIPHER_get_asn1_iv, NULL) 81 EVP_CIPHER_set_asn1_iv, EVP_CIPHER_get_asn1_iv, NULL)
74 82
75static int cast_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, 83static int cast_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
76 const unsigned char *iv, int enc) 84 const unsigned char *iv, int enc)
77 { 85 {
78 CAST_set_key(&(ctx->c.cast_ks),EVP_CIPHER_CTX_key_length(ctx),key); 86 CAST_set_key(&data(ctx)->ks,EVP_CIPHER_CTX_key_length(ctx),key);
79 return 1; 87 return 1;
80 } 88 }
81 89
diff --git a/src/lib/libcrypto/evp/e_des.c b/src/lib/libcrypto/evp/e_des.c
index f4e998b81c..105266a4b3 100644
--- a/src/lib/libcrypto/evp/e_des.c
+++ b/src/lib/libcrypto/evp/e_des.c
@@ -56,12 +56,13 @@
56 * [including the GNU Public Licence.] 56 * [including the GNU Public Licence.]
57 */ 57 */
58 58
59#ifndef NO_DES 59#ifndef OPENSSL_NO_DES
60#include <stdio.h> 60#include <stdio.h>
61#include "cryptlib.h" 61#include "cryptlib.h"
62#include <openssl/evp.h> 62#include <openssl/evp.h>
63#include <openssl/objects.h> 63#include <openssl/objects.h>
64#include "evp_locl.h" 64#include "evp_locl.h"
65#include <openssl/des.h>
65 66
66static int des_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, 67static int des_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
67 const unsigned char *iv, int enc); 68 const unsigned char *iv, int enc);
@@ -72,34 +73,34 @@ static int des_ecb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
72 const unsigned char *in, unsigned int inl) 73 const unsigned char *in, unsigned int inl)
73{ 74{
74 BLOCK_CIPHER_ecb_loop() 75 BLOCK_CIPHER_ecb_loop()
75 des_ecb_encrypt((des_cblock *)(in + i), (des_cblock *)(out + i), ctx->c.des_ks, ctx->encrypt); 76 DES_ecb_encrypt((DES_cblock *)(in + i), (DES_cblock *)(out + i), ctx->cipher_data, ctx->encrypt);
76 return 1; 77 return 1;
77} 78}
78 79
79static int des_ofb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, 80static int des_ofb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
80 const unsigned char *in, unsigned int inl) 81 const unsigned char *in, unsigned int inl)
81{ 82{
82 des_ofb64_encrypt(in, out, (long)inl, ctx->c.des_ks, (des_cblock *)ctx->iv, &ctx->num); 83 DES_ofb64_encrypt(in, out, (long)inl, ctx->cipher_data, (DES_cblock *)ctx->iv, &ctx->num);
83 return 1; 84 return 1;
84} 85}
85 86
86static int des_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, 87static int des_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
87 const unsigned char *in, unsigned int inl) 88 const unsigned char *in, unsigned int inl)
88{ 89{
89 des_ncbc_encrypt(in, out, (long)inl, ctx->c.des_ks, 90 DES_ncbc_encrypt(in, out, (long)inl, ctx->cipher_data,
90 (des_cblock *)ctx->iv, ctx->encrypt); 91 (DES_cblock *)ctx->iv, ctx->encrypt);
91 return 1; 92 return 1;
92} 93}
93 94
94static int des_cfb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, 95static int des_cfb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
95 const unsigned char *in, unsigned int inl) 96 const unsigned char *in, unsigned int inl)
96{ 97{
97 des_cfb64_encrypt(in, out, (long)inl, ctx->c.des_ks, 98 DES_cfb64_encrypt(in, out, (long)inl, ctx->cipher_data,
98 (des_cblock *)ctx->iv, &ctx->num, ctx->encrypt); 99 (DES_cblock *)ctx->iv, &ctx->num, ctx->encrypt);
99 return 1; 100 return 1;
100} 101}
101 102
102BLOCK_CIPHER_defs(des, des_ks, NID_des, 8, 8, 8, 103BLOCK_CIPHER_defs(des, DES_key_schedule, NID_des, 8, 8, 8, 64,
103 0, des_init_key, NULL, 104 0, des_init_key, NULL,
104 EVP_CIPHER_set_asn1_iv, 105 EVP_CIPHER_set_asn1_iv,
105 EVP_CIPHER_get_asn1_iv, 106 EVP_CIPHER_get_asn1_iv,
@@ -109,9 +110,9 @@ BLOCK_CIPHER_defs(des, des_ks, NID_des, 8, 8, 8,
109static int des_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, 110static int des_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
110 const unsigned char *iv, int enc) 111 const unsigned char *iv, int enc)
111 { 112 {
112 des_cblock *deskey = (des_cblock *)key; 113 DES_cblock *deskey = (DES_cblock *)key;
113 114
114 des_set_key_unchecked(deskey,ctx->c.des_ks); 115 DES_set_key_unchecked(deskey,ctx->cipher_data);
115 return 1; 116 return 1;
116 } 117 }
117 118
diff --git a/src/lib/libcrypto/evp/e_des3.c b/src/lib/libcrypto/evp/e_des3.c
index a9aba4ae70..077860e7b6 100644
--- a/src/lib/libcrypto/evp/e_des3.c
+++ b/src/lib/libcrypto/evp/e_des3.c
@@ -56,12 +56,13 @@
56 * [including the GNU Public Licence.] 56 * [including the GNU Public Licence.]
57 */ 57 */
58 58
59#ifndef NO_DES 59#ifndef OPENSSL_NO_DES
60#include <stdio.h> 60#include <stdio.h>
61#include "cryptlib.h" 61#include "cryptlib.h"
62#include <openssl/evp.h> 62#include <openssl/evp.h>
63#include <openssl/objects.h> 63#include <openssl/objects.h>
64#include "evp_locl.h" 64#include "evp_locl.h"
65#include <openssl/des.h>
65 66
66static int des_ede_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, 67static int des_ede_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
67 const unsigned char *iv,int enc); 68 const unsigned char *iv,int enc);
@@ -69,60 +70,78 @@ static int des_ede_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
69static int des_ede3_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, 70static int des_ede3_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
70 const unsigned char *iv,int enc); 71 const unsigned char *iv,int enc);
71 72
73typedef struct
74 {
75 DES_key_schedule ks1;/* key schedule */
76 DES_key_schedule ks2;/* key schedule (for ede) */
77 DES_key_schedule ks3;/* key schedule (for ede3) */
78 } DES_EDE_KEY;
79
80#define data(ctx) ((DES_EDE_KEY *)(ctx)->cipher_data)
81
72/* Because of various casts and different args can't use IMPLEMENT_BLOCK_CIPHER */ 82/* Because of various casts and different args can't use IMPLEMENT_BLOCK_CIPHER */
73 83
74static int des_ede_ecb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, 84static int des_ede_ecb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
75 const unsigned char *in, unsigned int inl) 85 const unsigned char *in, unsigned int inl)
76{ 86{
77 BLOCK_CIPHER_ecb_loop() 87 BLOCK_CIPHER_ecb_loop()
78 des_ecb3_encrypt((des_cblock *)(in + i), (des_cblock *)(out + i), 88 DES_ecb3_encrypt((DES_cblock *)(in + i), (DES_cblock *)(out + i),
79 ctx->c.des_ede.ks1, ctx->c.des_ede.ks2, ctx->c.des_ede.ks3, 89 &data(ctx)->ks1, &data(ctx)->ks2,
80 ctx->encrypt); 90 &data(ctx)->ks3,
91 ctx->encrypt);
81 return 1; 92 return 1;
82} 93}
83 94
84static int des_ede_ofb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, 95static int des_ede_ofb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
85 const unsigned char *in, unsigned int inl) 96 const unsigned char *in, unsigned int inl)
86{ 97{
87 des_ede3_ofb64_encrypt(in, out, (long)inl, 98 DES_ede3_ofb64_encrypt(in, out, (long)inl,
88 ctx->c.des_ede.ks1, ctx->c.des_ede.ks2, ctx->c.des_ede.ks3, 99 &data(ctx)->ks1, &data(ctx)->ks2, &data(ctx)->ks3,
89 (des_cblock *)ctx->iv, &ctx->num); 100 (DES_cblock *)ctx->iv, &ctx->num);
90 return 1; 101 return 1;
91} 102}
92 103
93static int des_ede_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, 104static int des_ede_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
94 const unsigned char *in, unsigned int inl) 105 const unsigned char *in, unsigned int inl)
95{ 106{
96 des_ede3_cbc_encrypt(in, out, (long)inl, 107#ifdef KSSL_DEBUG
97 ctx->c.des_ede.ks1, ctx->c.des_ede.ks2, ctx->c.des_ede.ks3, 108 {
98 (des_cblock *)ctx->iv, ctx->encrypt); 109 int i;
110 char *cp;
111 printf("des_ede_cbc_cipher(ctx=%lx, buflen=%d)\n", ctx, ctx->buf_len);
112 printf("\t iv= ");
113 for(i=0;i<8;i++)
114 printf("%02X",ctx->iv[i]);
115 printf("\n");
116 }
117#endif /* KSSL_DEBUG */
118 DES_ede3_cbc_encrypt(in, out, (long)inl,
119 &data(ctx)->ks1, &data(ctx)->ks2, &data(ctx)->ks3,
120 (DES_cblock *)ctx->iv, ctx->encrypt);
99 return 1; 121 return 1;
100} 122}
101 123
102static int des_ede_cfb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, 124static int des_ede_cfb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
103 const unsigned char *in, unsigned int inl) 125 const unsigned char *in, unsigned int inl)
104{ 126{
105 des_ede3_cfb64_encrypt(in, out, (long)inl, 127 DES_ede3_cfb64_encrypt(in, out, (long)inl,
106 ctx->c.des_ede.ks1, ctx->c.des_ede.ks2, ctx->c.des_ede.ks3, 128 &data(ctx)->ks1, &data(ctx)->ks2, &data(ctx)->ks3,
107 (des_cblock *)ctx->iv, &ctx->num, ctx->encrypt); 129 (DES_cblock *)ctx->iv, &ctx->num, ctx->encrypt);
108 return 1; 130 return 1;
109} 131}
110 132
111#define NID_des_ede_ecb NID_des_ede 133BLOCK_CIPHER_defs(des_ede, DES_EDE_KEY, NID_des_ede, 8, 16, 8, 64,
112
113BLOCK_CIPHER_defs(des_ede, des_ede, NID_des_ede, 8, 16, 8,
114 0, des_ede_init_key, NULL, 134 0, des_ede_init_key, NULL,
115 EVP_CIPHER_set_asn1_iv, 135 EVP_CIPHER_set_asn1_iv,
116 EVP_CIPHER_get_asn1_iv, 136 EVP_CIPHER_get_asn1_iv,
117 NULL) 137 NULL)
118 138
119#define NID_des_ede3_ecb NID_des_ede3
120#define des_ede3_cfb_cipher des_ede_cfb_cipher 139#define des_ede3_cfb_cipher des_ede_cfb_cipher
121#define des_ede3_ofb_cipher des_ede_ofb_cipher 140#define des_ede3_ofb_cipher des_ede_ofb_cipher
122#define des_ede3_cbc_cipher des_ede_cbc_cipher 141#define des_ede3_cbc_cipher des_ede_cbc_cipher
123#define des_ede3_ecb_cipher des_ede_ecb_cipher 142#define des_ede3_ecb_cipher des_ede_ecb_cipher
124 143
125BLOCK_CIPHER_defs(des_ede3, des_ede, NID_des_ede3, 8, 24, 8, 144BLOCK_CIPHER_defs(des_ede3, DES_EDE_KEY, NID_des_ede3, 8, 24, 8, 64,
126 0, des_ede3_init_key, NULL, 145 0, des_ede3_init_key, NULL,
127 EVP_CIPHER_set_asn1_iv, 146 EVP_CIPHER_set_asn1_iv,
128 EVP_CIPHER_get_asn1_iv, 147 EVP_CIPHER_get_asn1_iv,
@@ -131,34 +150,43 @@ BLOCK_CIPHER_defs(des_ede3, des_ede, NID_des_ede3, 8, 24, 8,
131static int des_ede_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, 150static int des_ede_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
132 const unsigned char *iv, int enc) 151 const unsigned char *iv, int enc)
133 { 152 {
134 des_cblock *deskey = (des_cblock *)key; 153 DES_cblock *deskey = (DES_cblock *)key;
135 154
136 des_set_key_unchecked(&deskey[0],ctx->c.des_ede.ks1); 155 DES_set_key_unchecked(&deskey[0],&data(ctx)->ks1);
137 des_set_key_unchecked(&deskey[1],ctx->c.des_ede.ks2); 156 DES_set_key_unchecked(&deskey[1],&data(ctx)->ks2);
138 memcpy( (char *)ctx->c.des_ede.ks3, 157 memcpy(&data(ctx)->ks3,&data(ctx)->ks1,
139 (char *)ctx->c.des_ede.ks1, 158 sizeof(data(ctx)->ks1));
140 sizeof(ctx->c.des_ede.ks1));
141 return 1; 159 return 1;
142 } 160 }
143 161
144static int des_ede3_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, 162static int des_ede3_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
145 const unsigned char *iv, int enc) 163 const unsigned char *iv, int enc)
146 { 164 {
147 des_cblock *deskey = (des_cblock *)key; 165 DES_cblock *deskey = (DES_cblock *)key;
166#ifdef KSSL_DEBUG
167 {
168 int i;
169 printf("des_ede3_init_key(ctx=%lx)\n", ctx);
170 printf("\tKEY= ");
171 for(i=0;i<24;i++) printf("%02X",key[i]); printf("\n");
172 printf("\t IV= ");
173 for(i=0;i<8;i++) printf("%02X",iv[i]); printf("\n");
174 }
175#endif /* KSSL_DEBUG */
148 176
149 des_set_key_unchecked(&deskey[0],ctx->c.des_ede.ks1); 177 DES_set_key_unchecked(&deskey[0],&data(ctx)->ks1);
150 des_set_key_unchecked(&deskey[1],ctx->c.des_ede.ks2); 178 DES_set_key_unchecked(&deskey[1],&data(ctx)->ks2);
151 des_set_key_unchecked(&deskey[2],ctx->c.des_ede.ks3); 179 DES_set_key_unchecked(&deskey[2],&data(ctx)->ks3);
152 180
153 return 1; 181 return 1;
154 } 182 }
155 183
156EVP_CIPHER *EVP_des_ede(void) 184const EVP_CIPHER *EVP_des_ede(void)
157{ 185{
158 return &des_ede_ecb; 186 return &des_ede_ecb;
159} 187}
160 188
161EVP_CIPHER *EVP_des_ede3(void) 189const EVP_CIPHER *EVP_des_ede3(void)
162{ 190{
163 return &des_ede3_ecb; 191 return &des_ede3_ecb;
164} 192}
diff --git a/src/lib/libcrypto/evp/e_idea.c b/src/lib/libcrypto/evp/e_idea.c
index 8d3c88deb7..ed838d3e62 100644
--- a/src/lib/libcrypto/evp/e_idea.c
+++ b/src/lib/libcrypto/evp/e_idea.c
@@ -56,13 +56,14 @@
56 * [including the GNU Public Licence.] 56 * [including the GNU Public Licence.]
57 */ 57 */
58 58
59#ifndef NO_IDEA 59#ifndef OPENSSL_NO_IDEA
60 60
61#include <stdio.h> 61#include <stdio.h>
62#include "cryptlib.h" 62#include "cryptlib.h"
63#include <openssl/evp.h> 63#include <openssl/evp.h>
64#include <openssl/objects.h> 64#include <openssl/objects.h>
65#include "evp_locl.h" 65#include "evp_locl.h"
66#include <openssl/idea.h>
66 67
67static int idea_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, 68static int idea_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
68 const unsigned char *iv,int enc); 69 const unsigned char *iv,int enc);
@@ -75,17 +76,22 @@ static int idea_ecb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
75 const unsigned char *in, unsigned int inl) 76 const unsigned char *in, unsigned int inl)
76{ 77{
77 BLOCK_CIPHER_ecb_loop() 78 BLOCK_CIPHER_ecb_loop()
78 idea_ecb_encrypt(in + i, out + i, &ctx->c.idea_ks); 79 idea_ecb_encrypt(in + i, out + i, ctx->cipher_data);
79 return 1; 80 return 1;
80} 81}
81 82
82/* Can't use IMPLEMENT_BLOCK_CIPHER because idea_ecb_encrypt is different */ 83/* Can't use IMPLEMENT_BLOCK_CIPHER because idea_ecb_encrypt is different */
83 84
84BLOCK_CIPHER_func_cbc(idea, idea, idea_ks) 85typedef struct
85BLOCK_CIPHER_func_ofb(idea, idea, idea_ks) 86 {
86BLOCK_CIPHER_func_cfb(idea, idea, idea_ks) 87 IDEA_KEY_SCHEDULE ks;
88 } EVP_IDEA_KEY;
89
90BLOCK_CIPHER_func_cbc(idea, idea, EVP_IDEA_KEY, ks)
91BLOCK_CIPHER_func_ofb(idea, idea, 64, EVP_IDEA_KEY, ks)
92BLOCK_CIPHER_func_cfb(idea, idea, 64, EVP_IDEA_KEY, ks)
87 93
88BLOCK_CIPHER_defs(idea, idea_ks, NID_idea, 8, 16, 8, 94BLOCK_CIPHER_defs(idea, IDEA_KEY_SCHEDULE, NID_idea, 8, 16, 8, 64,
89 0, idea_init_key, NULL, 95 0, idea_init_key, NULL,
90 EVP_CIPHER_set_asn1_iv, EVP_CIPHER_get_asn1_iv, NULL) 96 EVP_CIPHER_set_asn1_iv, EVP_CIPHER_get_asn1_iv, NULL)
91 97
@@ -96,13 +102,13 @@ static int idea_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
96 if (EVP_CIPHER_CTX_mode(ctx) == EVP_CIPH_OFB_MODE) enc = 1; 102 if (EVP_CIPHER_CTX_mode(ctx) == EVP_CIPH_OFB_MODE) enc = 1;
97 else if (EVP_CIPHER_CTX_mode(ctx) == EVP_CIPH_CFB_MODE) enc = 1; 103 else if (EVP_CIPHER_CTX_mode(ctx) == EVP_CIPH_CFB_MODE) enc = 1;
98 } 104 }
99 if (enc) idea_set_encrypt_key(key,&(ctx->c.idea_ks)); 105 if (enc) idea_set_encrypt_key(key,ctx->cipher_data);
100 else 106 else
101 { 107 {
102 IDEA_KEY_SCHEDULE tmp; 108 IDEA_KEY_SCHEDULE tmp;
103 109
104 idea_set_encrypt_key(key,&tmp); 110 idea_set_encrypt_key(key,&tmp);
105 idea_set_decrypt_key(&tmp,&(ctx->c.idea_ks)); 111 idea_set_decrypt_key(&tmp,ctx->cipher_data);
106 memset((unsigned char *)&tmp,0, 112 memset((unsigned char *)&tmp,0,
107 sizeof(IDEA_KEY_SCHEDULE)); 113 sizeof(IDEA_KEY_SCHEDULE));
108 } 114 }
diff --git a/src/lib/libcrypto/evp/e_null.c b/src/lib/libcrypto/evp/e_null.c
index e0702cf818..2420d7e5af 100644
--- a/src/lib/libcrypto/evp/e_null.c
+++ b/src/lib/libcrypto/evp/e_null.c
@@ -65,7 +65,7 @@ static int null_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
65 const unsigned char *iv,int enc); 65 const unsigned char *iv,int enc);
66static int null_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, 66static int null_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
67 const unsigned char *in, unsigned int inl); 67 const unsigned char *in, unsigned int inl);
68static EVP_CIPHER n_cipher= 68static const EVP_CIPHER n_cipher=
69 { 69 {
70 NID_undef, 70 NID_undef,
71 1,0,0, 71 1,0,0,
@@ -79,7 +79,7 @@ static EVP_CIPHER n_cipher=
79 NULL 79 NULL
80 }; 80 };
81 81
82EVP_CIPHER *EVP_enc_null(void) 82const EVP_CIPHER *EVP_enc_null(void)
83 { 83 {
84 return(&n_cipher); 84 return(&n_cipher);
85 } 85 }
@@ -87,7 +87,7 @@ EVP_CIPHER *EVP_enc_null(void)
87static int null_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, 87static int null_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
88 const unsigned char *iv, int enc) 88 const unsigned char *iv, int enc)
89 { 89 {
90 memset(&(ctx->c),0,sizeof(ctx->c)); 90 /* memset(&(ctx->c),0,sizeof(ctx->c));*/
91 return 1; 91 return 1;
92 } 92 }
93 93
diff --git a/src/lib/libcrypto/evp/e_rc2.c b/src/lib/libcrypto/evp/e_rc2.c
index 3955c3ef84..4685198e2e 100644
--- a/src/lib/libcrypto/evp/e_rc2.c
+++ b/src/lib/libcrypto/evp/e_rc2.c
@@ -56,13 +56,14 @@
56 * [including the GNU Public Licence.] 56 * [including the GNU Public Licence.]
57 */ 57 */
58 58
59#ifndef NO_RC2 59#ifndef OPENSSL_NO_RC2
60 60
61#include <stdio.h> 61#include <stdio.h>
62#include "cryptlib.h" 62#include "cryptlib.h"
63#include <openssl/evp.h> 63#include <openssl/evp.h>
64#include <openssl/objects.h> 64#include <openssl/objects.h>
65#include "evp_locl.h" 65#include "evp_locl.h"
66#include <openssl/rc2.h>
66 67
67static int rc2_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, 68static int rc2_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
68 const unsigned char *iv,int enc); 69 const unsigned char *iv,int enc);
@@ -72,9 +73,17 @@ static int rc2_set_asn1_type_and_iv(EVP_CIPHER_CTX *c, ASN1_TYPE *type);
72static int rc2_get_asn1_type_and_iv(EVP_CIPHER_CTX *c, ASN1_TYPE *type); 73static int rc2_get_asn1_type_and_iv(EVP_CIPHER_CTX *c, ASN1_TYPE *type);
73static int rc2_ctrl(EVP_CIPHER_CTX *c, int type, int arg, void *ptr); 74static int rc2_ctrl(EVP_CIPHER_CTX *c, int type, int arg, void *ptr);
74 75
75IMPLEMENT_BLOCK_CIPHER(rc2, rc2.ks, RC2, rc2, NID_rc2, 76typedef struct
77 {
78 int key_bits; /* effective key bits */
79 RC2_KEY ks; /* key schedule */
80 } EVP_RC2_KEY;
81
82#define data(ctx) ((EVP_RC2_KEY *)(ctx)->cipher_data)
83
84IMPLEMENT_BLOCK_CIPHER(rc2, ks, RC2, EVP_RC2_KEY, NID_rc2,
76 8, 85 8,
77 EVP_RC2_KEY_SIZE, 8, 86 RC2_KEY_LENGTH, 8, 64,
78 EVP_CIPH_VARIABLE_LENGTH | EVP_CIPH_CTRL_INIT, 87 EVP_CIPH_VARIABLE_LENGTH | EVP_CIPH_CTRL_INIT,
79 rc2_init_key, NULL, 88 rc2_init_key, NULL,
80 rc2_set_asn1_type_and_iv, rc2_get_asn1_type_and_iv, 89 rc2_set_asn1_type_and_iv, rc2_get_asn1_type_and_iv,
@@ -84,7 +93,7 @@ IMPLEMENT_BLOCK_CIPHER(rc2, rc2.ks, RC2, rc2, NID_rc2,
84#define RC2_64_MAGIC 0x78 93#define RC2_64_MAGIC 0x78
85#define RC2_128_MAGIC 0x3a 94#define RC2_128_MAGIC 0x3a
86 95
87static EVP_CIPHER r2_64_cbc_cipher= 96static const EVP_CIPHER r2_64_cbc_cipher=
88 { 97 {
89 NID_rc2_64_cbc, 98 NID_rc2_64_cbc,
90 8,8 /* 64 bit */,8, 99 8,8 /* 64 bit */,8,
@@ -92,15 +101,14 @@ static EVP_CIPHER r2_64_cbc_cipher=
92 rc2_init_key, 101 rc2_init_key,
93 rc2_cbc_cipher, 102 rc2_cbc_cipher,
94 NULL, 103 NULL,
95 sizeof(EVP_CIPHER_CTX)-sizeof((((EVP_CIPHER_CTX *)NULL)->c))+ 104 sizeof(EVP_RC2_KEY),
96 sizeof((((EVP_CIPHER_CTX *)NULL)->c.rc2)),
97 rc2_set_asn1_type_and_iv, 105 rc2_set_asn1_type_and_iv,
98 rc2_get_asn1_type_and_iv, 106 rc2_get_asn1_type_and_iv,
99 rc2_ctrl, 107 rc2_ctrl,
100 NULL 108 NULL
101 }; 109 };
102 110
103static EVP_CIPHER r2_40_cbc_cipher= 111static const EVP_CIPHER r2_40_cbc_cipher=
104 { 112 {
105 NID_rc2_40_cbc, 113 NID_rc2_40_cbc,
106 8,5 /* 40 bit */,8, 114 8,5 /* 40 bit */,8,
@@ -108,20 +116,19 @@ static EVP_CIPHER r2_40_cbc_cipher=
108 rc2_init_key, 116 rc2_init_key,
109 rc2_cbc_cipher, 117 rc2_cbc_cipher,
110 NULL, 118 NULL,
111 sizeof(EVP_CIPHER_CTX)-sizeof((((EVP_CIPHER_CTX *)NULL)->c))+ 119 sizeof(EVP_RC2_KEY),
112 sizeof((((EVP_CIPHER_CTX *)NULL)->c.rc2)),
113 rc2_set_asn1_type_and_iv, 120 rc2_set_asn1_type_and_iv,
114 rc2_get_asn1_type_and_iv, 121 rc2_get_asn1_type_and_iv,
115 rc2_ctrl, 122 rc2_ctrl,
116 NULL 123 NULL
117 }; 124 };
118 125
119EVP_CIPHER *EVP_rc2_64_cbc(void) 126const EVP_CIPHER *EVP_rc2_64_cbc(void)
120 { 127 {
121 return(&r2_64_cbc_cipher); 128 return(&r2_64_cbc_cipher);
122 } 129 }
123 130
124EVP_CIPHER *EVP_rc2_40_cbc(void) 131const EVP_CIPHER *EVP_rc2_40_cbc(void)
125 { 132 {
126 return(&r2_40_cbc_cipher); 133 return(&r2_40_cbc_cipher);
127 } 134 }
@@ -129,8 +136,8 @@ EVP_CIPHER *EVP_rc2_40_cbc(void)
129static int rc2_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, 136static int rc2_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
130 const unsigned char *iv, int enc) 137 const unsigned char *iv, int enc)
131 { 138 {
132 RC2_set_key(&(ctx->c.rc2.ks),EVP_CIPHER_CTX_key_length(ctx), 139 RC2_set_key(&data(ctx)->ks,EVP_CIPHER_CTX_key_length(ctx),
133 key,ctx->c.rc2.key_bits); 140 key,data(ctx)->key_bits);
134 return 1; 141 return 1;
135 } 142 }
136 143
@@ -173,7 +180,7 @@ static int rc2_get_asn1_type_and_iv(EVP_CIPHER_CTX *c, ASN1_TYPE *type)
173 key_bits =rc2_magic_to_meth((int)num); 180 key_bits =rc2_magic_to_meth((int)num);
174 if (!key_bits) 181 if (!key_bits)
175 return(-1); 182 return(-1);
176 if(i > 0) EVP_CipherInit(c, NULL, NULL, iv, -1); 183 if(i > 0) EVP_CipherInit_ex(c, NULL, NULL, NULL, iv, -1);
177 EVP_CIPHER_CTX_ctrl(c, EVP_CTRL_SET_RC2_KEY_BITS, key_bits, NULL); 184 EVP_CIPHER_CTX_ctrl(c, EVP_CTRL_SET_RC2_KEY_BITS, key_bits, NULL);
178 EVP_CIPHER_CTX_set_key_length(c, key_bits / 8); 185 EVP_CIPHER_CTX_set_key_length(c, key_bits / 8);
179 } 186 }
@@ -196,26 +203,26 @@ static int rc2_set_asn1_type_and_iv(EVP_CIPHER_CTX *c, ASN1_TYPE *type)
196 203
197static int rc2_ctrl(EVP_CIPHER_CTX *c, int type, int arg, void *ptr) 204static int rc2_ctrl(EVP_CIPHER_CTX *c, int type, int arg, void *ptr)
198 { 205 {
199 switch(type) { 206 switch(type)
200 207 {
201 case EVP_CTRL_INIT: 208 case EVP_CTRL_INIT:
202 c->c.rc2.key_bits = EVP_CIPHER_CTX_key_length(c) * 8; 209 data(c)->key_bits = EVP_CIPHER_CTX_key_length(c) * 8;
203 return 1; 210 return 1;
204 211
205 case EVP_CTRL_GET_RC2_KEY_BITS: 212 case EVP_CTRL_GET_RC2_KEY_BITS:
206 *(int *)ptr = c->c.rc2.key_bits; 213 *(int *)ptr = data(c)->key_bits;
207 return 1; 214 return 1;
208 215
209 216 case EVP_CTRL_SET_RC2_KEY_BITS:
210 case EVP_CTRL_SET_RC2_KEY_BITS: 217 if(arg > 0)
211 if(arg > 0) { 218 {
212 c->c.rc2.key_bits = arg; 219 data(c)->key_bits = arg;
213 return 1; 220 return 1;
214 } 221 }
215 return 0; 222 return 0;
216 223
217 default: 224 default:
218 return -1; 225 return -1;
219 } 226 }
220 } 227 }
221 228
diff --git a/src/lib/libcrypto/evp/e_rc4.c b/src/lib/libcrypto/evp/e_rc4.c
index 1c1e3b3857..4064cc5fa0 100644
--- a/src/lib/libcrypto/evp/e_rc4.c
+++ b/src/lib/libcrypto/evp/e_rc4.c
@@ -56,18 +56,31 @@
56 * [including the GNU Public Licence.] 56 * [including the GNU Public Licence.]
57 */ 57 */
58 58
59#ifndef NO_RC4 59#ifndef OPENSSL_NO_RC4
60 60
61#include <stdio.h> 61#include <stdio.h>
62#include "cryptlib.h" 62#include "cryptlib.h"
63#include <openssl/evp.h> 63#include <openssl/evp.h>
64#include <openssl/objects.h> 64#include <openssl/objects.h>
65#include <openssl/rc4.h>
66
67/* FIXME: surely this is available elsewhere? */
68#define EVP_RC4_KEY_SIZE 16
69
70typedef struct
71 {
72 /* FIXME: what is the key for? */
73 unsigned char key[EVP_RC4_KEY_SIZE];
74 RC4_KEY ks; /* working key */
75 } EVP_RC4_KEY;
76
77#define data(ctx) ((EVP_RC4_KEY *)(ctx)->cipher_data)
65 78
66static int rc4_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, 79static int rc4_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
67 const unsigned char *iv,int enc); 80 const unsigned char *iv,int enc);
68static int rc4_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, 81static int rc4_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
69 const unsigned char *in, unsigned int inl); 82 const unsigned char *in, unsigned int inl);
70static EVP_CIPHER r4_cipher= 83static const EVP_CIPHER r4_cipher=
71 { 84 {
72 NID_rc4, 85 NID_rc4,
73 1,EVP_RC4_KEY_SIZE,0, 86 1,EVP_RC4_KEY_SIZE,0,
@@ -75,14 +88,13 @@ static EVP_CIPHER r4_cipher=
75 rc4_init_key, 88 rc4_init_key,
76 rc4_cipher, 89 rc4_cipher,
77 NULL, 90 NULL,
78 sizeof(EVP_CIPHER_CTX)-sizeof((((EVP_CIPHER_CTX *)NULL)->c))+ 91 sizeof(EVP_RC4_KEY),
79 sizeof((((EVP_CIPHER_CTX *)NULL)->c.rc4)),
80 NULL, 92 NULL,
81 NULL, 93 NULL,
82 NULL 94 NULL
83 }; 95 };
84 96
85static EVP_CIPHER r4_40_cipher= 97static const EVP_CIPHER r4_40_cipher=
86 { 98 {
87 NID_rc4_40, 99 NID_rc4_40,
88 1,5 /* 40 bit */,0, 100 1,5 /* 40 bit */,0,
@@ -90,19 +102,18 @@ static EVP_CIPHER r4_40_cipher=
90 rc4_init_key, 102 rc4_init_key,
91 rc4_cipher, 103 rc4_cipher,
92 NULL, 104 NULL,
93 sizeof(EVP_CIPHER_CTX)-sizeof((((EVP_CIPHER_CTX *)NULL)->c))+ 105 sizeof(EVP_RC4_KEY),
94 sizeof((((EVP_CIPHER_CTX *)NULL)->c.rc4)),
95 NULL, 106 NULL,
96 NULL, 107 NULL,
97 NULL 108 NULL
98 }; 109 };
99 110
100EVP_CIPHER *EVP_rc4(void) 111const EVP_CIPHER *EVP_rc4(void)
101 { 112 {
102 return(&r4_cipher); 113 return(&r4_cipher);
103 } 114 }
104 115
105EVP_CIPHER *EVP_rc4_40(void) 116const EVP_CIPHER *EVP_rc4_40(void)
106 { 117 {
107 return(&r4_40_cipher); 118 return(&r4_40_cipher);
108 } 119 }
@@ -110,16 +121,16 @@ EVP_CIPHER *EVP_rc4_40(void)
110static int rc4_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, 121static int rc4_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
111 const unsigned char *iv, int enc) 122 const unsigned char *iv, int enc)
112 { 123 {
113 memcpy(&(ctx->c.rc4.key[0]),key,EVP_CIPHER_CTX_key_length(ctx)); 124 memcpy(&data(ctx)->key[0],key,EVP_CIPHER_CTX_key_length(ctx));
114 RC4_set_key(&(ctx->c.rc4.ks),EVP_CIPHER_CTX_key_length(ctx), 125 RC4_set_key(&data(ctx)->ks,EVP_CIPHER_CTX_key_length(ctx),
115 ctx->c.rc4.key); 126 data(ctx)->key);
116 return 1; 127 return 1;
117 } 128 }
118 129
119static int rc4_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, 130static int rc4_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
120 const unsigned char *in, unsigned int inl) 131 const unsigned char *in, unsigned int inl)
121 { 132 {
122 RC4(&(ctx->c.rc4.ks),inl,in,out); 133 RC4(&data(ctx)->ks,inl,in,out);
123 return 1; 134 return 1;
124 } 135 }
125#endif 136#endif
diff --git a/src/lib/libcrypto/evp/e_rc5.c b/src/lib/libcrypto/evp/e_rc5.c
index 5885f1826b..3c7713b181 100644
--- a/src/lib/libcrypto/evp/e_rc5.c
+++ b/src/lib/libcrypto/evp/e_rc5.c
@@ -56,62 +56,69 @@
56 * [including the GNU Public Licence.] 56 * [including the GNU Public Licence.]
57 */ 57 */
58 58
59#ifndef NO_RC5 59#ifndef OPENSSL_NO_RC5
60 60
61#include <stdio.h> 61#include <stdio.h>
62#include "cryptlib.h" 62#include "cryptlib.h"
63#include <openssl/evp.h> 63#include <openssl/evp.h>
64#include <openssl/objects.h> 64#include <openssl/objects.h>
65#include "evp_locl.h" 65#include "evp_locl.h"
66#include <openssl/rc5.h>
66 67
67static int r_32_12_16_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, 68static int r_32_12_16_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
68 const unsigned char *iv,int enc); 69 const unsigned char *iv,int enc);
69static int rc5_ctrl(EVP_CIPHER_CTX *c, int type, int arg, void *ptr); 70static int rc5_ctrl(EVP_CIPHER_CTX *c, int type, int arg, void *ptr);
70 71
71IMPLEMENT_BLOCK_CIPHER(rc5_32_12_16, rc5.ks, RC5_32, rc5, NID_rc5, 72typedef struct
72 8, EVP_RC5_32_12_16_KEY_SIZE, 8, 73 {
73 EVP_CIPH_VARIABLE_LENGTH | EVP_CIPH_CTRL_INIT, 74 int rounds; /* number of rounds */
74 r_32_12_16_init_key, NULL, 75 RC5_32_KEY ks; /* key schedule */
75 NULL, NULL, rc5_ctrl) 76 } EVP_RC5_KEY;
76 77
78#define data(ctx) EVP_C_DATA(EVP_RC5_KEY,ctx)
77 79
80IMPLEMENT_BLOCK_CIPHER(rc5_32_12_16, ks, RC5_32, EVP_RC5_KEY, NID_rc5,
81 8, RC5_32_KEY_LENGTH, 8, 64,
82 EVP_CIPH_VARIABLE_LENGTH | EVP_CIPH_CTRL_INIT,
83 r_32_12_16_init_key, NULL,
84 NULL, NULL, rc5_ctrl)
78 85
79static int rc5_ctrl(EVP_CIPHER_CTX *c, int type, int arg, void *ptr) 86static int rc5_ctrl(EVP_CIPHER_CTX *c, int type, int arg, void *ptr)
80 { 87 {
81 switch(type) { 88 switch(type)
82 89 {
83 case EVP_CTRL_INIT: 90 case EVP_CTRL_INIT:
84 c->c.rc5.rounds = RC5_12_ROUNDS; 91 data(c)->rounds = RC5_12_ROUNDS;
85 return 1; 92 return 1;
86 93
87 case EVP_CTRL_GET_RC5_ROUNDS: 94 case EVP_CTRL_GET_RC5_ROUNDS:
88 *(int *)ptr = c->c.rc5.rounds; 95 *(int *)ptr = data(c)->rounds;
89 return 1; 96 return 1;
90
91 97
92 case EVP_CTRL_SET_RC5_ROUNDS: 98 case EVP_CTRL_SET_RC5_ROUNDS:
93 switch(arg) { 99 switch(arg)
94 case RC5_8_ROUNDS: 100 {
95 case RC5_12_ROUNDS: 101 case RC5_8_ROUNDS:
96 case RC5_16_ROUNDS: 102 case RC5_12_ROUNDS:
97 c->c.rc5.rounds = arg; 103 case RC5_16_ROUNDS:
98 return 1; 104 data(c)->rounds = arg;
105 return 1;
99 106
100 default: 107 default:
101 EVPerr(EVP_F_RC5_CTRL, EVP_R_UNSUPORTED_NUMBER_OF_ROUNDS); 108 EVPerr(EVP_F_RC5_CTRL, EVP_R_UNSUPORTED_NUMBER_OF_ROUNDS);
102 return 0; 109 return 0;
103 } 110 }
104 111
105 default: 112 default:
106 return -1; 113 return -1;
107 } 114 }
108 } 115 }
109 116
110static int r_32_12_16_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, 117static int r_32_12_16_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
111 const unsigned char *iv, int enc) 118 const unsigned char *iv, int enc)
112 { 119 {
113 RC5_32_set_key(&(ctx->c.rc5.ks),EVP_CIPHER_CTX_key_length(ctx), 120 RC5_32_set_key(&data(ctx)->ks,EVP_CIPHER_CTX_key_length(ctx),
114 key,ctx->c.rc5.rounds); 121 key,data(ctx)->rounds);
115 return 1; 122 return 1;
116 } 123 }
117 124
diff --git a/src/lib/libcrypto/evp/e_xcbc_d.c b/src/lib/libcrypto/evp/e_xcbc_d.c
index e5b15acc7d..a6f849e93d 100644
--- a/src/lib/libcrypto/evp/e_xcbc_d.c
+++ b/src/lib/libcrypto/evp/e_xcbc_d.c
@@ -56,17 +56,29 @@
56 * [including the GNU Public Licence.] 56 * [including the GNU Public Licence.]
57 */ 57 */
58 58
59#ifndef NO_DES 59#ifndef OPENSSL_NO_DES
60#include <stdio.h> 60#include <stdio.h>
61#include "cryptlib.h" 61#include "cryptlib.h"
62#include <openssl/evp.h> 62#include <openssl/evp.h>
63#include <openssl/objects.h> 63#include <openssl/objects.h>
64#include <openssl/des.h>
64 65
65static int desx_cbc_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, 66static int desx_cbc_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
66 const unsigned char *iv,int enc); 67 const unsigned char *iv,int enc);
67static int desx_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, 68static int desx_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
68 const unsigned char *in, unsigned int inl); 69 const unsigned char *in, unsigned int inl);
69static EVP_CIPHER d_xcbc_cipher= 70
71
72typedef struct
73 {
74 DES_key_schedule ks;/* key schedule */
75 DES_cblock inw;
76 DES_cblock outw;
77 } DESX_CBC_KEY;
78
79#define data(ctx) ((DESX_CBC_KEY *)(ctx)->cipher_data)
80
81static const EVP_CIPHER d_xcbc_cipher=
70 { 82 {
71 NID_desx_cbc, 83 NID_desx_cbc,
72 8,24,8, 84 8,24,8,
@@ -74,14 +86,13 @@ static EVP_CIPHER d_xcbc_cipher=
74 desx_cbc_init_key, 86 desx_cbc_init_key,
75 desx_cbc_cipher, 87 desx_cbc_cipher,
76 NULL, 88 NULL,
77 sizeof(EVP_CIPHER_CTX)-sizeof((((EVP_CIPHER_CTX *)NULL)->c))+ 89 sizeof(DESX_CBC_KEY),
78 sizeof((((EVP_CIPHER_CTX *)NULL)->c.desx_cbc)),
79 EVP_CIPHER_set_asn1_iv, 90 EVP_CIPHER_set_asn1_iv,
80 EVP_CIPHER_get_asn1_iv, 91 EVP_CIPHER_get_asn1_iv,
81 NULL 92 NULL
82 }; 93 };
83 94
84EVP_CIPHER *EVP_desx_cbc(void) 95const EVP_CIPHER *EVP_desx_cbc(void)
85 { 96 {
86 return(&d_xcbc_cipher); 97 return(&d_xcbc_cipher);
87 } 98 }
@@ -89,11 +100,11 @@ EVP_CIPHER *EVP_desx_cbc(void)
89static int desx_cbc_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, 100static int desx_cbc_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
90 const unsigned char *iv, int enc) 101 const unsigned char *iv, int enc)
91 { 102 {
92 des_cblock *deskey = (des_cblock *)key; 103 DES_cblock *deskey = (DES_cblock *)key;
93 104
94 des_set_key_unchecked(deskey,ctx->c.desx_cbc.ks); 105 DES_set_key_unchecked(deskey,&data(ctx)->ks);
95 memcpy(&(ctx->c.desx_cbc.inw[0]),&(key[8]),8); 106 memcpy(&data(ctx)->inw[0],&key[8],8);
96 memcpy(&(ctx->c.desx_cbc.outw[0]),&(key[16]),8); 107 memcpy(&data(ctx)->outw[0],&key[16],8);
97 108
98 return 1; 109 return 1;
99 } 110 }
@@ -101,11 +112,11 @@ static int desx_cbc_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
101static int desx_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, 112static int desx_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
102 const unsigned char *in, unsigned int inl) 113 const unsigned char *in, unsigned int inl)
103 { 114 {
104 des_xcbc_encrypt(in,out,inl,ctx->c.desx_cbc.ks, 115 DES_xcbc_encrypt(in,out,inl,&data(ctx)->ks,
105 (des_cblock *)&(ctx->iv[0]), 116 (DES_cblock *)&(ctx->iv[0]),
106 &ctx->c.desx_cbc.inw, 117 &data(ctx)->inw,
107 &ctx->c.desx_cbc.outw, 118 &data(ctx)->outw,
108 ctx->encrypt); 119 ctx->encrypt);
109 return 1; 120 return 1;
110 } 121 }
111#endif 122#endif
diff --git a/src/lib/libcrypto/evp/encode.c b/src/lib/libcrypto/evp/encode.c
index 6ff9c1783c..12c6379df1 100644
--- a/src/lib/libcrypto/evp/encode.c
+++ b/src/lib/libcrypto/evp/encode.c
@@ -277,6 +277,13 @@ int EVP_DecodeUpdate(EVP_ENCODE_CTX *ctx, unsigned char *out, int *outl,
277 eof++; 277 eof++;
278 } 278 }
279 279
280 if (v == B64_CR)
281 {
282 ln = 0;
283 if (exp_nl)
284 continue;
285 }
286
280 /* eoln */ 287 /* eoln */
281 if (v == B64_EOLN) 288 if (v == B64_EOLN)
282 { 289 {
diff --git a/src/lib/libcrypto/evp/evp.h b/src/lib/libcrypto/evp/evp.h
index fd43127092..915fe62341 100644
--- a/src/lib/libcrypto/evp/evp.h
+++ b/src/lib/libcrypto/evp/evp.h
@@ -67,74 +67,30 @@
67# undef OPENSSL_ALGORITHM_DEFINES 67# undef OPENSSL_ALGORITHM_DEFINES
68#endif 68#endif
69 69
70#ifndef NO_BIO 70#include <openssl/ossl_typ.h>
71
72#include <openssl/symhacks.h>
73
74#ifndef OPENSSL_NO_BIO
71#include <openssl/bio.h> 75#include <openssl/bio.h>
72#endif 76#endif
73#ifndef NO_MD2
74#include <openssl/md2.h>
75#endif
76#ifndef NO_MD4
77#include <openssl/md4.h>
78#endif
79#ifndef NO_MD5
80#include <openssl/md5.h>
81#endif
82#ifndef NO_SHA
83#include <openssl/sha.h>
84#endif
85#ifndef NO_RIPEMD
86#include <openssl/ripemd.h>
87#endif
88#ifndef NO_DES
89#include <openssl/des.h>
90#endif
91#ifndef NO_RC4
92#include <openssl/rc4.h>
93#endif
94#ifndef NO_RC2
95#include <openssl/rc2.h>
96#endif
97#ifndef NO_RC5
98#include <openssl/rc5.h>
99#endif
100#ifndef NO_BF
101#include <openssl/blowfish.h>
102#endif
103#ifndef NO_CAST
104#include <openssl/cast.h>
105#endif
106#ifndef NO_IDEA
107#include <openssl/idea.h>
108#endif
109#ifndef NO_MDC2
110#include <openssl/mdc2.h>
111#endif
112 77
78/*
113#define EVP_RC2_KEY_SIZE 16 79#define EVP_RC2_KEY_SIZE 16
114#define EVP_RC4_KEY_SIZE 16 80#define EVP_RC4_KEY_SIZE 16
115#define EVP_BLOWFISH_KEY_SIZE 16 81#define EVP_BLOWFISH_KEY_SIZE 16
116#define EVP_CAST5_KEY_SIZE 16 82#define EVP_CAST5_KEY_SIZE 16
117#define EVP_RC5_32_12_16_KEY_SIZE 16 83#define EVP_RC5_32_12_16_KEY_SIZE 16
84*/
118#define EVP_MAX_MD_SIZE (16+20) /* The SSLv3 md5+sha1 type */ 85#define EVP_MAX_MD_SIZE (16+20) /* The SSLv3 md5+sha1 type */
119#define EVP_MAX_KEY_LENGTH 24 86#define EVP_MAX_KEY_LENGTH 32
120#define EVP_MAX_IV_LENGTH 8 87#define EVP_MAX_IV_LENGTH 16
88#define EVP_MAX_BLOCK_LENGTH 32
121 89
122#define PKCS5_SALT_LEN 8 90#define PKCS5_SALT_LEN 8
123/* Default PKCS#5 iteration count */ 91/* Default PKCS#5 iteration count */
124#define PKCS5_DEFAULT_ITER 2048 92#define PKCS5_DEFAULT_ITER 2048
125 93
126#ifndef NO_RSA
127#include <openssl/rsa.h>
128#endif
129
130#ifndef NO_DSA
131#include <openssl/dsa.h>
132#endif
133
134#ifndef NO_DH
135#include <openssl/dh.h>
136#endif
137
138#include <openssl/objects.h> 94#include <openssl/objects.h>
139 95
140#define EVP_PK_RSA 0x0001 96#define EVP_PK_RSA 0x0001
@@ -164,26 +120,26 @@ extern "C" {
164/* Type needs to be a bit field 120/* Type needs to be a bit field
165 * Sub-type needs to be for variations on the method, as in, can it do 121 * Sub-type needs to be for variations on the method, as in, can it do
166 * arbitrary encryption.... */ 122 * arbitrary encryption.... */
167typedef struct evp_pkey_st 123struct evp_pkey_st
168 { 124 {
169 int type; 125 int type;
170 int save_type; 126 int save_type;
171 int references; 127 int references;
172 union { 128 union {
173 char *ptr; 129 char *ptr;
174#ifndef NO_RSA 130#ifndef OPENSSL_NO_RSA
175 struct rsa_st *rsa; /* RSA */ 131 struct rsa_st *rsa; /* RSA */
176#endif 132#endif
177#ifndef NO_DSA 133#ifndef OPENSSL_NO_DSA
178 struct dsa_st *dsa; /* DSA */ 134 struct dsa_st *dsa; /* DSA */
179#endif 135#endif
180#ifndef NO_DH 136#ifndef OPENSSL_NO_DH
181 struct dh_st *dh; /* DH */ 137 struct dh_st *dh; /* DH */
182#endif 138#endif
183 } pkey; 139 } pkey;
184 int save_parameters; 140 int save_parameters;
185 STACK_OF(X509_ATTRIBUTE) *attributes; /* [ 0 ] */ 141 STACK_OF(X509_ATTRIBUTE) *attributes; /* [ 0 ] */
186 } EVP_PKEY; 142 } /* EVP_PKEY */;
187 143
188#define EVP_PKEY_MO_SIGN 0x0001 144#define EVP_PKEY_MO_SIGN 0x0001
189#define EVP_PKEY_MO_VERIFY 0x0002 145#define EVP_PKEY_MO_VERIFY 0x0002
@@ -258,27 +214,32 @@ typedef struct evp_pkey_method_st
258#endif 214#endif
259 215
260#ifndef EVP_MD 216#ifndef EVP_MD
261typedef struct env_md_st 217struct env_md_st
262 { 218 {
263 int type; 219 int type;
264 int pkey_type; 220 int pkey_type;
265 int md_size; 221 int md_size;
266 void (*init)(); 222 unsigned long flags;
267 void (*update)(); 223 int (*init)(EVP_MD_CTX *ctx);
268 void (*final)(); 224 int (*update)(EVP_MD_CTX *ctx,const void *data,unsigned long count);
269 225 int (*final)(EVP_MD_CTX *ctx,unsigned char *md);
226 int (*copy)(EVP_MD_CTX *to,const EVP_MD_CTX *from);
227 int (*cleanup)(EVP_MD_CTX *ctx);
228
229 /* FIXME: prototype these some day */
270 int (*sign)(); 230 int (*sign)();
271 int (*verify)(); 231 int (*verify)();
272 int required_pkey_type[5]; /*EVP_PKEY_xxx */ 232 int required_pkey_type[5]; /*EVP_PKEY_xxx */
273 int block_size; 233 int block_size;
274 int ctx_size; /* how big does the ctx need to be */ 234 int ctx_size; /* how big does the ctx->md_data need to be */
275 } EVP_MD; 235 } /* EVP_MD */;
276
277 236
237#define EVP_MD_FLAG_ONESHOT 0x0001 /* digest can only handle a single
238 * block */
278 239
279#define EVP_PKEY_NULL_method NULL,NULL,{0,0,0,0} 240#define EVP_PKEY_NULL_method NULL,NULL,{0,0,0,0}
280 241
281#ifndef NO_DSA 242#ifndef OPENSSL_NO_DSA
282#define EVP_PKEY_DSA_method DSA_sign,DSA_verify, \ 243#define EVP_PKEY_DSA_method DSA_sign,DSA_verify, \
283 {EVP_PKEY_DSA,EVP_PKEY_DSA2,EVP_PKEY_DSA3, \ 244 {EVP_PKEY_DSA,EVP_PKEY_DSA2,EVP_PKEY_DSA3, \
284 EVP_PKEY_DSA4,0} 245 EVP_PKEY_DSA4,0}
@@ -286,7 +247,7 @@ typedef struct env_md_st
286#define EVP_PKEY_DSA_method EVP_PKEY_NULL_method 247#define EVP_PKEY_DSA_method EVP_PKEY_NULL_method
287#endif 248#endif
288 249
289#ifndef NO_RSA 250#ifndef OPENSSL_NO_RSA
290#define EVP_PKEY_RSA_method RSA_sign,RSA_verify, \ 251#define EVP_PKEY_RSA_method RSA_sign,RSA_verify, \
291 {EVP_PKEY_RSA,EVP_PKEY_RSA2,0,0} 252 {EVP_PKEY_RSA,EVP_PKEY_RSA2,0,0}
292#define EVP_PKEY_RSA_ASN1_OCTET_STRING_method \ 253#define EVP_PKEY_RSA_ASN1_OCTET_STRING_method \
@@ -300,34 +261,20 @@ typedef struct env_md_st
300 261
301#endif /* !EVP_MD */ 262#endif /* !EVP_MD */
302 263
303typedef struct env_md_ctx_st 264struct env_md_ctx_st
304 { 265 {
305 const EVP_MD *digest; 266 const EVP_MD *digest;
306 union { 267 ENGINE *engine; /* functional reference if 'digest' is ENGINE-provided */
307 unsigned char base[4]; 268 unsigned long flags;
308#ifndef NO_MD2 269 void *md_data;
309 MD2_CTX md2; 270 } /* EVP_MD_CTX */;
310#endif 271
311#ifndef NO_MD5 272/* values for EVP_MD_CTX flags */
312 MD5_CTX md5;
313#endif
314#ifndef NO_MD4
315 MD4_CTX md4;
316#endif
317#ifndef NO_RIPEMD
318 RIPEMD160_CTX ripemd160;
319#endif
320#ifndef NO_SHA
321 SHA_CTX sha;
322#endif
323#ifndef NO_MDC2
324 MDC2_CTX mdc2;
325#endif
326 } md;
327 } EVP_MD_CTX;
328 273
329typedef struct evp_cipher_st EVP_CIPHER; 274#define EVP_MD_CTX_FLAG_ONESHOT 0x0001 /* digest update will be called
330typedef struct evp_cipher_ctx_st EVP_CIPHER_CTX; 275 * once only */
276#define EVP_MD_CTX_FLAG_CLEANED 0x0002 /* context has already been
277 * cleaned */
331 278
332struct evp_cipher_st 279struct evp_cipher_st
333 { 280 {
@@ -341,12 +288,12 @@ struct evp_cipher_st
341 int (*do_cipher)(EVP_CIPHER_CTX *ctx, unsigned char *out, 288 int (*do_cipher)(EVP_CIPHER_CTX *ctx, unsigned char *out,
342 const unsigned char *in, unsigned int inl);/* encrypt/decrypt data */ 289 const unsigned char *in, unsigned int inl);/* encrypt/decrypt data */
343 int (*cleanup)(EVP_CIPHER_CTX *); /* cleanup ctx */ 290 int (*cleanup)(EVP_CIPHER_CTX *); /* cleanup ctx */
344 int ctx_size; /* how big the ctx needs to be */ 291 int ctx_size; /* how big ctx->cipher_data needs to be */
345 int (*set_asn1_parameters)(EVP_CIPHER_CTX *, ASN1_TYPE *); /* Populate a ASN1_TYPE with parameters */ 292 int (*set_asn1_parameters)(EVP_CIPHER_CTX *, ASN1_TYPE *); /* Populate a ASN1_TYPE with parameters */
346 int (*get_asn1_parameters)(EVP_CIPHER_CTX *, ASN1_TYPE *); /* Get parameters from a ASN1_TYPE */ 293 int (*get_asn1_parameters)(EVP_CIPHER_CTX *, ASN1_TYPE *); /* Get parameters from a ASN1_TYPE */
347 int (*ctrl)(EVP_CIPHER_CTX *, int type, int arg, void *ptr); /* Miscellaneous operations */ 294 int (*ctrl)(EVP_CIPHER_CTX *, int type, int arg, void *ptr); /* Miscellaneous operations */
348 void *app_data; /* Application data */ 295 void *app_data; /* Application data */
349 }; 296 } /* EVP_CIPHER */;
350 297
351/* Values for cipher flags */ 298/* Values for cipher flags */
352 299
@@ -368,6 +315,8 @@ struct evp_cipher_st
368#define EVP_CIPH_CTRL_INIT 0x40 315#define EVP_CIPH_CTRL_INIT 0x40
369/* Don't use standard key length function */ 316/* Don't use standard key length function */
370#define EVP_CIPH_CUSTOM_KEY_LENGTH 0x80 317#define EVP_CIPH_CUSTOM_KEY_LENGTH 0x80
318/* Don't use standard block padding */
319#define EVP_CIPH_NO_PADDING 0x100
371 320
372/* ctrl() values */ 321/* ctrl() values */
373 322
@@ -387,62 +336,23 @@ typedef struct evp_cipher_info_st
387struct evp_cipher_ctx_st 336struct evp_cipher_ctx_st
388 { 337 {
389 const EVP_CIPHER *cipher; 338 const EVP_CIPHER *cipher;
339 ENGINE *engine; /* functional reference if 'cipher' is ENGINE-provided */
390 int encrypt; /* encrypt or decrypt */ 340 int encrypt; /* encrypt or decrypt */
391 int buf_len; /* number we have left */ 341 int buf_len; /* number we have left */
392 342
393 unsigned char oiv[EVP_MAX_IV_LENGTH]; /* original iv */ 343 unsigned char oiv[EVP_MAX_IV_LENGTH]; /* original iv */
394 unsigned char iv[EVP_MAX_IV_LENGTH]; /* working iv */ 344 unsigned char iv[EVP_MAX_IV_LENGTH]; /* working iv */
395 unsigned char buf[EVP_MAX_IV_LENGTH]; /* saved partial block */ 345 unsigned char buf[EVP_MAX_BLOCK_LENGTH];/* saved partial block */
396 int num; /* used by cfb/ofb mode */ 346 int num; /* used by cfb/ofb mode */
397 347
398 void *app_data; /* application stuff */ 348 void *app_data; /* application stuff */
399 int key_len; /* May change for variable length cipher */ 349 int key_len; /* May change for variable length cipher */
400 union { 350 unsigned long flags; /* Various flags */
401#ifndef NO_RC4 351 void *cipher_data; /* per EVP data */
402 struct 352 int final_used;
403 { 353 int block_mask;
404 unsigned char key[EVP_RC4_KEY_SIZE]; 354 unsigned char final[EVP_MAX_BLOCK_LENGTH];/* possible final block */
405 RC4_KEY ks; /* working key */ 355 } /* EVP_CIPHER_CTX */;
406 } rc4;
407#endif
408#ifndef NO_DES
409 des_key_schedule des_ks;/* key schedule */
410 struct
411 {
412 des_key_schedule ks;/* key schedule */
413 des_cblock inw;
414 des_cblock outw;
415 } desx_cbc;
416 struct
417 {
418 des_key_schedule ks1;/* key schedule */
419 des_key_schedule ks2;/* key schedule (for ede) */
420 des_key_schedule ks3;/* key schedule (for ede3) */
421 } des_ede;
422#endif
423#ifndef NO_IDEA
424 IDEA_KEY_SCHEDULE idea_ks;/* key schedule */
425#endif
426#ifndef NO_RC2
427 struct {
428 int key_bits; /* effective key bits */
429 RC2_KEY ks;/* key schedule */
430 } rc2;
431#endif
432#ifndef NO_RC5
433 struct {
434 int rounds; /* number of rounds */
435 RC5_32_KEY ks;/* key schedule */
436 } rc5;
437#endif
438#ifndef NO_BF
439 BF_KEY bf_ks;/* key schedule */
440#endif
441#ifndef NO_CAST
442 CAST_KEY cast_ks;/* key schedule */
443#endif
444 } c;
445 };
446 356
447typedef struct evp_Encode_Ctx_st 357typedef struct evp_Encode_Ctx_st
448 { 358 {
@@ -459,20 +369,20 @@ typedef struct evp_Encode_Ctx_st
459 369
460/* Password based encryption function */ 370/* Password based encryption function */
461typedef int (EVP_PBE_KEYGEN)(EVP_CIPHER_CTX *ctx, const char *pass, int passlen, 371typedef int (EVP_PBE_KEYGEN)(EVP_CIPHER_CTX *ctx, const char *pass, int passlen,
462 ASN1_TYPE *param, EVP_CIPHER *cipher, 372 ASN1_TYPE *param, const EVP_CIPHER *cipher,
463 EVP_MD *md, int en_de); 373 const EVP_MD *md, int en_de);
464 374
465#ifndef NO_RSA 375#ifndef OPENSSL_NO_RSA
466#define EVP_PKEY_assign_RSA(pkey,rsa) EVP_PKEY_assign((pkey),EVP_PKEY_RSA,\ 376#define EVP_PKEY_assign_RSA(pkey,rsa) EVP_PKEY_assign((pkey),EVP_PKEY_RSA,\
467 (char *)(rsa)) 377 (char *)(rsa))
468#endif 378#endif
469 379
470#ifndef NO_DSA 380#ifndef OPENSSL_NO_DSA
471#define EVP_PKEY_assign_DSA(pkey,dsa) EVP_PKEY_assign((pkey),EVP_PKEY_DSA,\ 381#define EVP_PKEY_assign_DSA(pkey,dsa) EVP_PKEY_assign((pkey),EVP_PKEY_DSA,\
472 (char *)(dsa)) 382 (char *)(dsa))
473#endif 383#endif
474 384
475#ifndef NO_DH 385#ifndef OPENSSL_NO_DH
476#define EVP_PKEY_assign_DH(pkey,dh) EVP_PKEY_assign((pkey),EVP_PKEY_DH,\ 386#define EVP_PKEY_assign_DH(pkey,dh) EVP_PKEY_assign((pkey),EVP_PKEY_DH,\
477 (char *)(dh)) 387 (char *)(dh))
478#endif 388#endif
@@ -484,6 +394,8 @@ typedef int (EVP_PBE_KEYGEN)(EVP_CIPHER_CTX *ctx, const char *pass, int passlen,
484#define EVP_get_cipherbyobj(a) EVP_get_cipherbynid(OBJ_obj2nid(a)) 394#define EVP_get_cipherbyobj(a) EVP_get_cipherbynid(OBJ_obj2nid(a))
485 395
486#define EVP_MD_type(e) ((e)->type) 396#define EVP_MD_type(e) ((e)->type)
397#define EVP_MD_nid(e) EVP_MD_type(e)
398#define EVP_MD_name(e) OBJ_nid2sn(EVP_MD_nid(e))
487#define EVP_MD_pkey_type(e) ((e)->pkey_type) 399#define EVP_MD_pkey_type(e) ((e)->pkey_type)
488#define EVP_MD_size(e) ((e)->md_size) 400#define EVP_MD_size(e) ((e)->md_size)
489#define EVP_MD_block_size(e) ((e)->block_size) 401#define EVP_MD_block_size(e) ((e)->block_size)
@@ -494,11 +406,12 @@ typedef int (EVP_PBE_KEYGEN)(EVP_CIPHER_CTX *ctx, const char *pass, int passlen,
494#define EVP_MD_CTX_type(e) EVP_MD_type((e)->digest) 406#define EVP_MD_CTX_type(e) EVP_MD_type((e)->digest)
495 407
496#define EVP_CIPHER_nid(e) ((e)->nid) 408#define EVP_CIPHER_nid(e) ((e)->nid)
409#define EVP_CIPHER_name(e) OBJ_nid2sn(EVP_CIPHER_nid(e))
497#define EVP_CIPHER_block_size(e) ((e)->block_size) 410#define EVP_CIPHER_block_size(e) ((e)->block_size)
498#define EVP_CIPHER_key_length(e) ((e)->key_len) 411#define EVP_CIPHER_key_length(e) ((e)->key_len)
499#define EVP_CIPHER_iv_length(e) ((e)->iv_len) 412#define EVP_CIPHER_iv_length(e) ((e)->iv_len)
500#define EVP_CIPHER_flags(e) ((e)->flags) 413#define EVP_CIPHER_flags(e) ((e)->flags)
501#define EVP_CIPHER_mode(e) ((e)->flags) & EVP_CIPH_MODE) 414#define EVP_CIPHER_mode(e) (((e)->flags) & EVP_CIPH_MODE)
502 415
503#define EVP_CIPHER_CTX_cipher(e) ((e)->cipher) 416#define EVP_CIPHER_CTX_cipher(e) ((e)->cipher)
504#define EVP_CIPHER_CTX_nid(e) ((e)->cipher->nid) 417#define EVP_CIPHER_CTX_nid(e) ((e)->cipher->nid)
@@ -514,8 +427,10 @@ typedef int (EVP_PBE_KEYGEN)(EVP_CIPHER_CTX *ctx, const char *pass, int passlen,
514#define EVP_ENCODE_LENGTH(l) (((l+2)/3*4)+(l/48+1)*2+80) 427#define EVP_ENCODE_LENGTH(l) (((l+2)/3*4)+(l/48+1)*2+80)
515#define EVP_DECODE_LENGTH(l) ((l+3)/4*3+80) 428#define EVP_DECODE_LENGTH(l) ((l+3)/4*3+80)
516 429
430#define EVP_SignInit_ex(a,b,c) EVP_DigestInit_ex(a,b,c)
517#define EVP_SignInit(a,b) EVP_DigestInit(a,b) 431#define EVP_SignInit(a,b) EVP_DigestInit(a,b)
518#define EVP_SignUpdate(a,b,c) EVP_DigestUpdate(a,b,c) 432#define EVP_SignUpdate(a,b,c) EVP_DigestUpdate(a,b,c)
433#define EVP_VerifyInit_ex(a,b,c) EVP_DigestInit_ex(a,b,c)
519#define EVP_VerifyInit(a,b) EVP_DigestInit(a,b) 434#define EVP_VerifyInit(a,b) EVP_DigestInit(a,b)
520#define EVP_VerifyUpdate(a,b,c) EVP_DigestUpdate(a,b,c) 435#define EVP_VerifyUpdate(a,b,c) EVP_DigestUpdate(a,b,c)
521#define EVP_OpenUpdate(a,b,c,d,e) EVP_DecryptUpdate(a,b,c,d,e) 436#define EVP_OpenUpdate(a,b,c,d,e) EVP_DecryptUpdate(a,b,c,d,e)
@@ -542,38 +457,61 @@ void BIO_set_md(BIO *,const EVP_MD *md);
542#define EVP_delete_digest_alias(alias) \ 457#define EVP_delete_digest_alias(alias) \
543 OBJ_NAME_remove(alias,OBJ_NAME_TYPE_MD_METH|OBJ_NAME_ALIAS); 458 OBJ_NAME_remove(alias,OBJ_NAME_TYPE_MD_METH|OBJ_NAME_ALIAS);
544 459
545 460void EVP_MD_CTX_init(EVP_MD_CTX *ctx);
546int EVP_MD_CTX_copy(EVP_MD_CTX *out,EVP_MD_CTX *in); 461int EVP_MD_CTX_cleanup(EVP_MD_CTX *ctx);
547void EVP_DigestInit(EVP_MD_CTX *ctx, const EVP_MD *type); 462EVP_MD_CTX *EVP_MD_CTX_create(void);
548void EVP_DigestUpdate(EVP_MD_CTX *ctx,const void *d, 463void EVP_MD_CTX_destroy(EVP_MD_CTX *ctx);
464int EVP_MD_CTX_copy_ex(EVP_MD_CTX *out,const EVP_MD_CTX *in);
465#define EVP_MD_CTX_set_flags(ctx,flgs) ((ctx)->flags|=(flgs))
466#define EVP_MD_CTX_clear_flags(ctx,flgs) ((ctx)->flags&=~(flgs))
467#define EVP_MD_CTX_test_flags(ctx,flgs) ((ctx)->flags&(flgs))
468int EVP_DigestInit_ex(EVP_MD_CTX *ctx, const EVP_MD *type, ENGINE *impl);
469int EVP_DigestUpdate(EVP_MD_CTX *ctx,const void *d,
549 unsigned int cnt); 470 unsigned int cnt);
550void EVP_DigestFinal(EVP_MD_CTX *ctx,unsigned char *md,unsigned int *s); 471int EVP_DigestFinal_ex(EVP_MD_CTX *ctx,unsigned char *md,unsigned int *s);
472int EVP_Digest(void *data, unsigned int count,
473 unsigned char *md, unsigned int *size, const EVP_MD *type, ENGINE *impl);
474
475int EVP_MD_CTX_copy(EVP_MD_CTX *out,const EVP_MD_CTX *in);
476int EVP_DigestInit(EVP_MD_CTX *ctx, const EVP_MD *type);
477int EVP_DigestFinal(EVP_MD_CTX *ctx,unsigned char *md,unsigned int *s);
551 478
552int EVP_read_pw_string(char *buf,int length,const char *prompt,int verify); 479int EVP_read_pw_string(char *buf,int length,const char *prompt,int verify);
553void EVP_set_pw_prompt(char *prompt); 480void EVP_set_pw_prompt(char *prompt);
554char * EVP_get_pw_prompt(void); 481char * EVP_get_pw_prompt(void);
555 482
556int EVP_BytesToKey(const EVP_CIPHER *type, EVP_MD *md, 483int EVP_BytesToKey(const EVP_CIPHER *type,const EVP_MD *md,
557 const unsigned char *salt, const unsigned char *data, int datal, 484 const unsigned char *salt, const unsigned char *data,
558 int count, unsigned char *key, unsigned char *iv); 485 int datal, int count, unsigned char *key,unsigned char *iv);
559 486
560int EVP_EncryptInit(EVP_CIPHER_CTX *ctx,const EVP_CIPHER *type, 487int EVP_EncryptInit(EVP_CIPHER_CTX *ctx,const EVP_CIPHER *cipher,
561 unsigned char *key, unsigned char *iv); 488 const unsigned char *key, const unsigned char *iv);
489int EVP_EncryptInit_ex(EVP_CIPHER_CTX *ctx,const EVP_CIPHER *cipher, ENGINE *impl,
490 const unsigned char *key, const unsigned char *iv);
562int EVP_EncryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, 491int EVP_EncryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out,
563 int *outl, unsigned char *in, int inl); 492 int *outl, const unsigned char *in, int inl);
493int EVP_EncryptFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl);
564int EVP_EncryptFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl); 494int EVP_EncryptFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl);
565 495
566int EVP_DecryptInit(EVP_CIPHER_CTX *ctx,const EVP_CIPHER *type, 496int EVP_DecryptInit(EVP_CIPHER_CTX *ctx,const EVP_CIPHER *cipher,
567 unsigned char *key, unsigned char *iv); 497 const unsigned char *key, const unsigned char *iv);
498int EVP_DecryptInit_ex(EVP_CIPHER_CTX *ctx,const EVP_CIPHER *cipher, ENGINE *impl,
499 const unsigned char *key, const unsigned char *iv);
568int EVP_DecryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, 500int EVP_DecryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out,
569 int *outl, unsigned char *in, int inl); 501 int *outl, const unsigned char *in, int inl);
570int EVP_DecryptFinal(EVP_CIPHER_CTX *ctx, unsigned char *outm, int *outl); 502int EVP_DecryptFinal(EVP_CIPHER_CTX *ctx, unsigned char *outm, int *outl);
571 503int EVP_DecryptFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *outm, int *outl);
572int EVP_CipherInit(EVP_CIPHER_CTX *ctx,const EVP_CIPHER *type, 504
573 unsigned char *key,unsigned char *iv,int enc); 505int EVP_CipherInit(EVP_CIPHER_CTX *ctx,const EVP_CIPHER *cipher,
506 const unsigned char *key,const unsigned char *iv,
507 int enc);
508int EVP_CipherInit_ex(EVP_CIPHER_CTX *ctx,const EVP_CIPHER *cipher, ENGINE *impl,
509 const unsigned char *key,const unsigned char *iv,
510 int enc);
574int EVP_CipherUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, 511int EVP_CipherUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out,
575 int *outl, unsigned char *in, int inl); 512 int *outl, const unsigned char *in, int inl);
576int EVP_CipherFinal(EVP_CIPHER_CTX *ctx, unsigned char *outm, int *outl); 513int EVP_CipherFinal(EVP_CIPHER_CTX *ctx, unsigned char *outm, int *outl);
514int EVP_CipherFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *outm, int *outl);
577 515
578int EVP_SignFinal(EVP_MD_CTX *ctx,unsigned char *md,unsigned int *s, 516int EVP_SignFinal(EVP_MD_CTX *ctx,unsigned char *md,unsigned int *s,
579 EVP_PKEY *pkey); 517 EVP_PKEY *pkey);
@@ -581,11 +519,11 @@ int EVP_SignFinal(EVP_MD_CTX *ctx,unsigned char *md,unsigned int *s,
581int EVP_VerifyFinal(EVP_MD_CTX *ctx,unsigned char *sigbuf, 519int EVP_VerifyFinal(EVP_MD_CTX *ctx,unsigned char *sigbuf,
582 unsigned int siglen,EVP_PKEY *pkey); 520 unsigned int siglen,EVP_PKEY *pkey);
583 521
584int EVP_OpenInit(EVP_CIPHER_CTX *ctx,EVP_CIPHER *type,unsigned char *ek, 522int EVP_OpenInit(EVP_CIPHER_CTX *ctx,const EVP_CIPHER *type,unsigned char *ek,
585 int ekl,unsigned char *iv,EVP_PKEY *priv); 523 int ekl,unsigned char *iv,EVP_PKEY *priv);
586int EVP_OpenFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl); 524int EVP_OpenFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl);
587 525
588int EVP_SealInit(EVP_CIPHER_CTX *ctx, EVP_CIPHER *type, unsigned char **ek, 526int EVP_SealInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *type, unsigned char **ek,
589 int *ekl, unsigned char *iv,EVP_PKEY **pubk, int npubk); 527 int *ekl, unsigned char *iv,EVP_PKEY **pubk, int npubk);
590void EVP_SealFinal(EVP_CIPHER_CTX *ctx,unsigned char *out,int *outl); 528void EVP_SealFinal(EVP_CIPHER_CTX *ctx,unsigned char *out,int *outl);
591 529
@@ -602,14 +540,13 @@ int EVP_DecodeFinal(EVP_ENCODE_CTX *ctx, unsigned
602 char *out, int *outl); 540 char *out, int *outl);
603int EVP_DecodeBlock(unsigned char *t, const unsigned char *f, int n); 541int EVP_DecodeBlock(unsigned char *t, const unsigned char *f, int n);
604 542
605void ERR_load_EVP_strings(void );
606
607void EVP_CIPHER_CTX_init(EVP_CIPHER_CTX *a); 543void EVP_CIPHER_CTX_init(EVP_CIPHER_CTX *a);
608int EVP_CIPHER_CTX_cleanup(EVP_CIPHER_CTX *a); 544int EVP_CIPHER_CTX_cleanup(EVP_CIPHER_CTX *a);
609int EVP_CIPHER_CTX_set_key_length(EVP_CIPHER_CTX *x, int keylen); 545int EVP_CIPHER_CTX_set_key_length(EVP_CIPHER_CTX *x, int keylen);
546int EVP_CIPHER_CTX_set_padding(EVP_CIPHER_CTX *c, int pad);
610int EVP_CIPHER_CTX_ctrl(EVP_CIPHER_CTX *ctx, int type, int arg, void *ptr); 547int EVP_CIPHER_CTX_ctrl(EVP_CIPHER_CTX *ctx, int type, int arg, void *ptr);
611 548
612#ifndef NO_BIO 549#ifndef OPENSSL_NO_BIO
613BIO_METHOD *BIO_f_md(void); 550BIO_METHOD *BIO_f_md(void);
614BIO_METHOD *BIO_f_base64(void); 551BIO_METHOD *BIO_f_base64(void);
615BIO_METHOD *BIO_f_cipher(void); 552BIO_METHOD *BIO_f_cipher(void);
@@ -618,89 +555,117 @@ void BIO_set_cipher(BIO *b,const EVP_CIPHER *c,unsigned char *k,
618 unsigned char *i, int enc); 555 unsigned char *i, int enc);
619#endif 556#endif
620 557
621EVP_MD *EVP_md_null(void); 558const EVP_MD *EVP_md_null(void);
622#ifndef NO_MD2 559#ifndef OPENSSL_NO_MD2
623EVP_MD *EVP_md2(void); 560const EVP_MD *EVP_md2(void);
624#endif 561#endif
625#ifndef NO_MD4 562#ifndef OPENSSL_NO_MD4
626EVP_MD *EVP_md4(void); 563const EVP_MD *EVP_md4(void);
627#endif 564#endif
628#ifndef NO_MD5 565#ifndef OPENSSL_NO_MD5
629EVP_MD *EVP_md5(void); 566const EVP_MD *EVP_md5(void);
630#endif 567#endif
631#ifndef NO_SHA 568#ifndef OPENSSL_NO_SHA
632EVP_MD *EVP_sha(void); 569const EVP_MD *EVP_sha(void);
633EVP_MD *EVP_sha1(void); 570const EVP_MD *EVP_sha1(void);
634EVP_MD *EVP_dss(void); 571const EVP_MD *EVP_dss(void);
635EVP_MD *EVP_dss1(void); 572const EVP_MD *EVP_dss1(void);
636#endif 573#endif
637#ifndef NO_MDC2 574#ifndef OPENSSL_NO_MDC2
638EVP_MD *EVP_mdc2(void); 575const EVP_MD *EVP_mdc2(void);
639#endif 576#endif
640#ifndef NO_RIPEMD 577#ifndef OPENSSL_NO_RIPEMD
641EVP_MD *EVP_ripemd160(void); 578const EVP_MD *EVP_ripemd160(void);
642#endif 579#endif
643EVP_CIPHER *EVP_enc_null(void); /* does nothing :-) */ 580const EVP_CIPHER *EVP_enc_null(void); /* does nothing :-) */
644#ifndef NO_DES 581#ifndef OPENSSL_NO_DES
645EVP_CIPHER *EVP_des_ecb(void); 582const EVP_CIPHER *EVP_des_ecb(void);
646EVP_CIPHER *EVP_des_ede(void); 583const EVP_CIPHER *EVP_des_ede(void);
647EVP_CIPHER *EVP_des_ede3(void); 584const EVP_CIPHER *EVP_des_ede3(void);
648EVP_CIPHER *EVP_des_cfb(void); 585const EVP_CIPHER *EVP_des_cfb(void);
649EVP_CIPHER *EVP_des_ede_cfb(void); 586const EVP_CIPHER *EVP_des_ede_cfb(void);
650EVP_CIPHER *EVP_des_ede3_cfb(void); 587const EVP_CIPHER *EVP_des_ede3_cfb(void);
651EVP_CIPHER *EVP_des_ofb(void); 588const EVP_CIPHER *EVP_des_ofb(void);
652EVP_CIPHER *EVP_des_ede_ofb(void); 589const EVP_CIPHER *EVP_des_ede_ofb(void);
653EVP_CIPHER *EVP_des_ede3_ofb(void); 590const EVP_CIPHER *EVP_des_ede3_ofb(void);
654EVP_CIPHER *EVP_des_cbc(void); 591const EVP_CIPHER *EVP_des_cbc(void);
655EVP_CIPHER *EVP_des_ede_cbc(void); 592const EVP_CIPHER *EVP_des_ede_cbc(void);
656EVP_CIPHER *EVP_des_ede3_cbc(void); 593const EVP_CIPHER *EVP_des_ede3_cbc(void);
657EVP_CIPHER *EVP_desx_cbc(void); 594const EVP_CIPHER *EVP_desx_cbc(void);
658#endif 595/* This should now be supported through the dev_crypto ENGINE. But also, why are
659#ifndef NO_RC4 596 * rc4 and md5 declarations made here inside a "NO_DES" precompiler branch? */
660EVP_CIPHER *EVP_rc4(void); 597#if 0
661EVP_CIPHER *EVP_rc4_40(void); 598# ifdef OPENSSL_OPENBSD_DEV_CRYPTO
662#endif 599const EVP_CIPHER *EVP_dev_crypto_des_ede3_cbc(void);
663#ifndef NO_IDEA 600const EVP_CIPHER *EVP_dev_crypto_rc4(void);
664EVP_CIPHER *EVP_idea_ecb(void); 601const EVP_MD *EVP_dev_crypto_md5(void);
665EVP_CIPHER *EVP_idea_cfb(void); 602# endif
666EVP_CIPHER *EVP_idea_ofb(void); 603#endif
667EVP_CIPHER *EVP_idea_cbc(void); 604#endif
668#endif 605#ifndef OPENSSL_NO_RC4
669#ifndef NO_RC2 606const EVP_CIPHER *EVP_rc4(void);
670EVP_CIPHER *EVP_rc2_ecb(void); 607const EVP_CIPHER *EVP_rc4_40(void);
671EVP_CIPHER *EVP_rc2_cbc(void); 608#endif
672EVP_CIPHER *EVP_rc2_40_cbc(void); 609#ifndef OPENSSL_NO_IDEA
673EVP_CIPHER *EVP_rc2_64_cbc(void); 610const EVP_CIPHER *EVP_idea_ecb(void);
674EVP_CIPHER *EVP_rc2_cfb(void); 611const EVP_CIPHER *EVP_idea_cfb(void);
675EVP_CIPHER *EVP_rc2_ofb(void); 612const EVP_CIPHER *EVP_idea_ofb(void);
676#endif 613const EVP_CIPHER *EVP_idea_cbc(void);
677#ifndef NO_BF 614#endif
678EVP_CIPHER *EVP_bf_ecb(void); 615#ifndef OPENSSL_NO_RC2
679EVP_CIPHER *EVP_bf_cbc(void); 616const EVP_CIPHER *EVP_rc2_ecb(void);
680EVP_CIPHER *EVP_bf_cfb(void); 617const EVP_CIPHER *EVP_rc2_cbc(void);
681EVP_CIPHER *EVP_bf_ofb(void); 618const EVP_CIPHER *EVP_rc2_40_cbc(void);
682#endif 619const EVP_CIPHER *EVP_rc2_64_cbc(void);
683#ifndef NO_CAST 620const EVP_CIPHER *EVP_rc2_cfb(void);
684EVP_CIPHER *EVP_cast5_ecb(void); 621const EVP_CIPHER *EVP_rc2_ofb(void);
685EVP_CIPHER *EVP_cast5_cbc(void); 622#endif
686EVP_CIPHER *EVP_cast5_cfb(void); 623#ifndef OPENSSL_NO_BF
687EVP_CIPHER *EVP_cast5_ofb(void); 624const EVP_CIPHER *EVP_bf_ecb(void);
688#endif 625const EVP_CIPHER *EVP_bf_cbc(void);
689#ifndef NO_RC5 626const EVP_CIPHER *EVP_bf_cfb(void);
690EVP_CIPHER *EVP_rc5_32_12_16_cbc(void); 627const EVP_CIPHER *EVP_bf_ofb(void);
691EVP_CIPHER *EVP_rc5_32_12_16_ecb(void); 628#endif
692EVP_CIPHER *EVP_rc5_32_12_16_cfb(void); 629#ifndef OPENSSL_NO_CAST
693EVP_CIPHER *EVP_rc5_32_12_16_ofb(void); 630const EVP_CIPHER *EVP_cast5_ecb(void);
694#endif 631const EVP_CIPHER *EVP_cast5_cbc(void);
695void OpenSSL_add_all_algorithms(void); 632const EVP_CIPHER *EVP_cast5_cfb(void);
633const EVP_CIPHER *EVP_cast5_ofb(void);
634#endif
635#ifndef OPENSSL_NO_RC5
636const EVP_CIPHER *EVP_rc5_32_12_16_cbc(void);
637const EVP_CIPHER *EVP_rc5_32_12_16_ecb(void);
638const EVP_CIPHER *EVP_rc5_32_12_16_cfb(void);
639const EVP_CIPHER *EVP_rc5_32_12_16_ofb(void);
640#endif
641#ifndef OPENSSL_NO_AES
642const EVP_CIPHER *EVP_aes_128_ecb(void);
643const EVP_CIPHER *EVP_aes_128_cbc(void);
644const EVP_CIPHER *EVP_aes_192_ecb(void);
645const EVP_CIPHER *EVP_aes_192_cbc(void);
646const EVP_CIPHER *EVP_aes_256_ecb(void);
647const EVP_CIPHER *EVP_aes_256_cbc(void);
648#endif
649
650void OPENSSL_add_all_algorithms_noconf(void);
651void OPENSSL_add_all_algorithms_conf(void);
652
653#ifdef OPENSSL_LOAD_CONF
654#define OpenSSL_add_all_algorithms() \
655 OPENSSL_add_all_algorithms_conf()
656#else
657#define OpenSSL_add_all_algorithms() \
658 OPENSSL_add_all_algorithms_noconf()
659#endif
660
696void OpenSSL_add_all_ciphers(void); 661void OpenSSL_add_all_ciphers(void);
697void OpenSSL_add_all_digests(void); 662void OpenSSL_add_all_digests(void);
698#define SSLeay_add_all_algorithms() OpenSSL_add_all_algorithms() 663#define SSLeay_add_all_algorithms() OpenSSL_add_all_algorithms()
699#define SSLeay_add_all_ciphers() OpenSSL_add_all_ciphers() 664#define SSLeay_add_all_ciphers() OpenSSL_add_all_ciphers()
700#define SSLeay_add_all_digests() OpenSSL_add_all_digests() 665#define SSLeay_add_all_digests() OpenSSL_add_all_digests()
701 666
702int EVP_add_cipher(EVP_CIPHER *cipher); 667int EVP_add_cipher(const EVP_CIPHER *cipher);
703int EVP_add_digest(EVP_MD *digest); 668int EVP_add_digest(const EVP_MD *digest);
704 669
705const EVP_CIPHER *EVP_get_cipherbyname(const char *name); 670const EVP_CIPHER *EVP_get_cipherbyname(const char *name);
706const EVP_MD *EVP_get_digestbyname(const char *name); 671const EVP_MD *EVP_get_digestbyname(const char *name);
@@ -714,18 +679,24 @@ int EVP_PKEY_type(int type);
714int EVP_PKEY_bits(EVP_PKEY *pkey); 679int EVP_PKEY_bits(EVP_PKEY *pkey);
715int EVP_PKEY_size(EVP_PKEY *pkey); 680int EVP_PKEY_size(EVP_PKEY *pkey);
716int EVP_PKEY_assign(EVP_PKEY *pkey,int type,char *key); 681int EVP_PKEY_assign(EVP_PKEY *pkey,int type,char *key);
717#ifndef NO_RSA 682
718int EVP_PKEY_set1_RSA(EVP_PKEY *pkey,RSA *key); 683#ifndef OPENSSL_NO_RSA
719RSA * EVP_PKEY_get1_RSA(EVP_PKEY *pkey); 684struct rsa_st;
685int EVP_PKEY_set1_RSA(EVP_PKEY *pkey,struct rsa_st *key);
686struct rsa_st *EVP_PKEY_get1_RSA(EVP_PKEY *pkey);
720#endif 687#endif
721#ifndef NO_DSA 688#ifndef OPENSSL_NO_DSA
722int EVP_PKEY_set1_DSA(EVP_PKEY *pkey,DSA *key); 689struct dsa_st;
723DSA * EVP_PKEY_get1_DSA(EVP_PKEY *pkey); 690int EVP_PKEY_set1_DSA(EVP_PKEY *pkey,struct dsa_st *key);
691struct dsa_st *EVP_PKEY_get1_DSA(EVP_PKEY *pkey);
724#endif 692#endif
725#ifndef NO_DH 693#ifndef OPENSSL_NO_DH
726int EVP_PKEY_set1_DH(EVP_PKEY *pkey,DH *key); 694struct dh_st;
727DH * EVP_PKEY_get1_DH(EVP_PKEY *pkey); 695int EVP_PKEY_set1_DH(EVP_PKEY *pkey,struct dh_st *key);
696struct dh_st *EVP_PKEY_get1_DH(EVP_PKEY *pkey);
728#endif 697#endif
698
699
729EVP_PKEY * EVP_PKEY_new(void); 700EVP_PKEY * EVP_PKEY_new(void);
730void EVP_PKEY_free(EVP_PKEY *pkey); 701void EVP_PKEY_free(EVP_PKEY *pkey);
731EVP_PKEY * d2i_PublicKey(int type,EVP_PKEY **a, unsigned char **pp, 702EVP_PKEY * d2i_PublicKey(int type,EVP_PKEY **a, unsigned char **pp,
@@ -755,20 +726,20 @@ int EVP_CIPHER_get_asn1_iv(EVP_CIPHER_CTX *c,ASN1_TYPE *type);
755 726
756/* PKCS5 password based encryption */ 727/* PKCS5 password based encryption */
757int PKCS5_PBE_keyivgen(EVP_CIPHER_CTX *ctx, const char *pass, int passlen, 728int PKCS5_PBE_keyivgen(EVP_CIPHER_CTX *ctx, const char *pass, int passlen,
758 ASN1_TYPE *param, EVP_CIPHER *cipher, EVP_MD *md, 729 ASN1_TYPE *param, const EVP_CIPHER *cipher, const EVP_MD *md,
759 int en_de); 730 int en_de);
760int PKCS5_PBKDF2_HMAC_SHA1(const char *pass, int passlen, 731int PKCS5_PBKDF2_HMAC_SHA1(const char *pass, int passlen,
761 unsigned char *salt, int saltlen, int iter, 732 unsigned char *salt, int saltlen, int iter,
762 int keylen, unsigned char *out); 733 int keylen, unsigned char *out);
763int PKCS5_v2_PBE_keyivgen(EVP_CIPHER_CTX *ctx, const char *pass, int passlen, 734int PKCS5_v2_PBE_keyivgen(EVP_CIPHER_CTX *ctx, const char *pass, int passlen,
764 ASN1_TYPE *param, EVP_CIPHER *cipher, EVP_MD *md, 735 ASN1_TYPE *param, const EVP_CIPHER *cipher, const EVP_MD *md,
765 int en_de); 736 int en_de);
766 737
767void PKCS5_PBE_add(void); 738void PKCS5_PBE_add(void);
768 739
769int EVP_PBE_CipherInit (ASN1_OBJECT *pbe_obj, const char *pass, int passlen, 740int EVP_PBE_CipherInit (ASN1_OBJECT *pbe_obj, const char *pass, int passlen,
770 ASN1_TYPE *param, EVP_CIPHER_CTX *ctx, int en_de); 741 ASN1_TYPE *param, EVP_CIPHER_CTX *ctx, int en_de);
771int EVP_PBE_alg_add(int nid, EVP_CIPHER *cipher, EVP_MD *md, 742int EVP_PBE_alg_add(int nid, const EVP_CIPHER *cipher, const EVP_MD *md,
772 EVP_PBE_KEYGEN *keygen); 743 EVP_PBE_KEYGEN *keygen);
773void EVP_PBE_cleanup(void); 744void EVP_PBE_cleanup(void);
774 745
@@ -776,6 +747,7 @@ void EVP_PBE_cleanup(void);
776/* The following lines are auto generated by the script mkerr.pl. Any changes 747/* The following lines are auto generated by the script mkerr.pl. Any changes
777 * made after this point may be overwritten when the script is next run. 748 * made after this point may be overwritten when the script is next run.
778 */ 749 */
750void ERR_load_EVP_strings(void);
779 751
780/* Error codes for the EVP functions. */ 752/* Error codes for the EVP functions. */
781 753
@@ -785,6 +757,8 @@ void EVP_PBE_cleanup(void);
785#define EVP_F_EVP_CIPHER_CTX_CTRL 124 757#define EVP_F_EVP_CIPHER_CTX_CTRL 124
786#define EVP_F_EVP_CIPHER_CTX_SET_KEY_LENGTH 122 758#define EVP_F_EVP_CIPHER_CTX_SET_KEY_LENGTH 122
787#define EVP_F_EVP_DECRYPTFINAL 101 759#define EVP_F_EVP_DECRYPTFINAL 101
760#define EVP_F_EVP_DIGESTINIT 128
761#define EVP_F_EVP_ENCRYPTFINAL 127
788#define EVP_F_EVP_MD_CTX_COPY 110 762#define EVP_F_EVP_MD_CTX_COPY 110
789#define EVP_F_EVP_OPENINIT 102 763#define EVP_F_EVP_OPENINIT 102
790#define EVP_F_EVP_PBE_ALG_ADD 115 764#define EVP_F_EVP_PBE_ALG_ADD 115
@@ -799,6 +773,7 @@ void EVP_PBE_cleanup(void);
799#define EVP_F_EVP_PKEY_GET1_DSA 120 773#define EVP_F_EVP_PKEY_GET1_DSA 120
800#define EVP_F_EVP_PKEY_GET1_RSA 121 774#define EVP_F_EVP_PKEY_GET1_RSA 121
801#define EVP_F_EVP_PKEY_NEW 106 775#define EVP_F_EVP_PKEY_NEW 106
776#define EVP_F_EVP_RIJNDAEL 126
802#define EVP_F_EVP_SIGNFINAL 107 777#define EVP_F_EVP_SIGNFINAL 107
803#define EVP_F_EVP_VERIFYFINAL 108 778#define EVP_F_EVP_VERIFYFINAL 108
804#define EVP_F_PKCS5_PBE_KEYIVGEN 117 779#define EVP_F_PKCS5_PBE_KEYIVGEN 117
@@ -807,12 +782,15 @@ void EVP_PBE_cleanup(void);
807#define EVP_F_RC5_CTRL 125 782#define EVP_F_RC5_CTRL 125
808 783
809/* Reason codes. */ 784/* Reason codes. */
785#define EVP_R_BAD_BLOCK_LENGTH 136
810#define EVP_R_BAD_DECRYPT 100 786#define EVP_R_BAD_DECRYPT 100
787#define EVP_R_BAD_KEY_LENGTH 137
811#define EVP_R_BN_DECODE_ERROR 112 788#define EVP_R_BN_DECODE_ERROR 112
812#define EVP_R_BN_PUBKEY_ERROR 113 789#define EVP_R_BN_PUBKEY_ERROR 113
813#define EVP_R_CIPHER_PARAMETER_ERROR 122 790#define EVP_R_CIPHER_PARAMETER_ERROR 122
814#define EVP_R_CTRL_NOT_IMPLEMENTED 132 791#define EVP_R_CTRL_NOT_IMPLEMENTED 132
815#define EVP_R_CTRL_OPERATION_NOT_IMPLEMENTED 133 792#define EVP_R_CTRL_OPERATION_NOT_IMPLEMENTED 133
793#define EVP_R_DATA_NOT_MULTIPLE_OF_BLOCK_LENGTH 138
816#define EVP_R_DECODE_ERROR 114 794#define EVP_R_DECODE_ERROR 114
817#define EVP_R_DIFFERENT_KEY_TYPES 101 795#define EVP_R_DIFFERENT_KEY_TYPES 101
818#define EVP_R_ENCODE_ERROR 115 796#define EVP_R_ENCODE_ERROR 115
@@ -827,6 +805,7 @@ void EVP_PBE_cleanup(void);
827#define EVP_R_KEYGEN_FAILURE 120 805#define EVP_R_KEYGEN_FAILURE 120
828#define EVP_R_MISSING_PARAMETERS 103 806#define EVP_R_MISSING_PARAMETERS 103
829#define EVP_R_NO_CIPHER_SET 131 807#define EVP_R_NO_CIPHER_SET 131
808#define EVP_R_NO_DIGEST_SET 139
830#define EVP_R_NO_DSA_PARAMETERS 116 809#define EVP_R_NO_DSA_PARAMETERS 116
831#define EVP_R_NO_SIGN_FUNCTION_CONFIGURED 104 810#define EVP_R_NO_SIGN_FUNCTION_CONFIGURED 104
832#define EVP_R_NO_VERIFY_FUNCTION_CONFIGURED 105 811#define EVP_R_NO_VERIFY_FUNCTION_CONFIGURED 105
@@ -848,4 +827,3 @@ void EVP_PBE_cleanup(void);
848} 827}
849#endif 828#endif
850#endif 829#endif
851
diff --git a/src/lib/libcrypto/evp/evp_acnf.c b/src/lib/libcrypto/evp/evp_acnf.c
new file mode 100644
index 0000000000..a68b979bdb
--- /dev/null
+++ b/src/lib/libcrypto/evp/evp_acnf.c
@@ -0,0 +1,74 @@
1/* evp_acnf.c */
2/* Written by Stephen Henson (shenson@bigfoot.com) 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#include <openssl/engine.h>
63
64
65/* Load all algorithms and configure OpenSSL.
66 * This function is called automatically when
67 * OPENSSL_LOAD_CONF is set.
68 */
69
70void OPENSSL_add_all_algorithms_conf(void)
71 {
72 OPENSSL_add_all_algorithms_noconf();
73 OPENSSL_config(NULL);
74 }
diff --git a/src/lib/libcrypto/evp/evp_enc.c b/src/lib/libcrypto/evp/evp_enc.c
index e2687f9879..d28a7d266e 100644
--- a/src/lib/libcrypto/evp/evp_enc.c
+++ b/src/lib/libcrypto/evp/evp_enc.c
@@ -60,8 +60,11 @@
60#include "cryptlib.h" 60#include "cryptlib.h"
61#include <openssl/evp.h> 61#include <openssl/evp.h>
62#include <openssl/err.h> 62#include <openssl/err.h>
63#include <openssl/engine.h>
63#include "evp_locl.h" 64#include "evp_locl.h"
64 65
66#include <assert.h>
67
65const char *EVP_version="EVP" OPENSSL_VERSION_PTEXT; 68const char *EVP_version="EVP" OPENSSL_VERSION_PTEXT;
66 69
67void EVP_CIPHER_CTX_init(EVP_CIPHER_CTX *ctx) 70void EVP_CIPHER_CTX_init(EVP_CIPHER_CTX *ctx)
@@ -70,23 +73,97 @@ void EVP_CIPHER_CTX_init(EVP_CIPHER_CTX *ctx)
70 /* ctx->cipher=NULL; */ 73 /* ctx->cipher=NULL; */
71 } 74 }
72 75
76
73int EVP_CipherInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher, 77int EVP_CipherInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher,
74 unsigned char *key, unsigned char *iv, int enc) 78 const unsigned char *key, const unsigned char *iv, int enc)
75 { 79 {
76 if(enc && (enc != -1)) enc = 1; 80 if (cipher)
77 if (cipher) { 81 EVP_CIPHER_CTX_init(ctx);
82 return EVP_CipherInit_ex(ctx,cipher,NULL,key,iv,enc);
83 }
84
85int EVP_CipherInit_ex(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher, ENGINE *impl,
86 const unsigned char *key, const unsigned char *iv, int enc)
87 {
88 if (enc == -1)
89 enc = ctx->encrypt;
90 else
91 {
92 if (enc)
93 enc = 1;
94 ctx->encrypt = enc;
95 }
96 /* Whether it's nice or not, "Inits" can be used on "Final"'d contexts
97 * so this context may already have an ENGINE! Try to avoid releasing
98 * the previous handle, re-querying for an ENGINE, and having a
99 * reinitialisation, when it may all be unecessary. */
100 if (ctx->engine && ctx->cipher && (!cipher ||
101 (cipher && (cipher->nid == ctx->cipher->nid))))
102 goto skip_to_init;
103 if (cipher)
104 {
105 /* Ensure an ENGINE left lying around from last time is cleared
106 * (the previous check attempted to avoid this if the same
107 * ENGINE and EVP_CIPHER could be used). */
108 if(ctx->engine)
109 ENGINE_finish(ctx->engine);
110 if(impl)
111 {
112 if (!ENGINE_init(impl))
113 {
114 EVPerr(EVP_F_EVP_CIPHERINIT, EVP_R_INITIALIZATION_ERROR);
115 return 0;
116 }
117 }
118 else
119 /* Ask if an ENGINE is reserved for this job */
120 impl = ENGINE_get_cipher_engine(cipher->nid);
121 if(impl)
122 {
123 /* There's an ENGINE for this job ... (apparently) */
124 const EVP_CIPHER *c = ENGINE_get_cipher(impl, cipher->nid);
125 if(!c)
126 {
127 /* One positive side-effect of US's export
128 * control history, is that we should at least
129 * be able to avoid using US mispellings of
130 * "initialisation"? */
131 EVPerr(EVP_F_EVP_CIPHERINIT, EVP_R_INITIALIZATION_ERROR);
132 return 0;
133 }
134 /* We'll use the ENGINE's private cipher definition */
135 cipher = c;
136 /* Store the ENGINE functional reference so we know
137 * 'cipher' came from an ENGINE and we need to release
138 * it when done. */
139 ctx->engine = impl;
140 }
141 else
142 ctx->engine = NULL;
78 ctx->cipher=cipher; 143 ctx->cipher=cipher;
144 ctx->cipher_data=OPENSSL_malloc(ctx->cipher->ctx_size);
79 ctx->key_len = cipher->key_len; 145 ctx->key_len = cipher->key_len;
80 if(ctx->cipher->flags & EVP_CIPH_CTRL_INIT) { 146 ctx->flags = 0;
81 if(!EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_INIT, 0, NULL)) { 147 if(ctx->cipher->flags & EVP_CIPH_CTRL_INIT)
148 {
149 if(!EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_INIT, 0, NULL))
150 {
82 EVPerr(EVP_F_EVP_CIPHERINIT, EVP_R_INITIALIZATION_ERROR); 151 EVPerr(EVP_F_EVP_CIPHERINIT, EVP_R_INITIALIZATION_ERROR);
83 return 0; 152 return 0;
153 }
84 } 154 }
85 } 155 }
86 } else if(!ctx->cipher) { 156 else if(!ctx->cipher)
157 {
87 EVPerr(EVP_F_EVP_CIPHERINIT, EVP_R_NO_CIPHER_SET); 158 EVPerr(EVP_F_EVP_CIPHERINIT, EVP_R_NO_CIPHER_SET);
88 return 0; 159 return 0;
89 } 160 }
161skip_to_init:
162 /* we assume block size is a power of 2 in *cryptUpdate */
163 assert(ctx->cipher->block_size == 1
164 || ctx->cipher->block_size == 8
165 || ctx->cipher->block_size == 16);
166
90 if(!(EVP_CIPHER_CTX_flags(ctx) & EVP_CIPH_CUSTOM_IV)) { 167 if(!(EVP_CIPHER_CTX_flags(ctx) & EVP_CIPH_CUSTOM_IV)) {
91 switch(EVP_CIPHER_CTX_mode(ctx)) { 168 switch(EVP_CIPHER_CTX_mode(ctx)) {
92 169
@@ -114,68 +191,101 @@ int EVP_CipherInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher,
114 if(key || (ctx->cipher->flags & EVP_CIPH_ALWAYS_CALL_INIT)) { 191 if(key || (ctx->cipher->flags & EVP_CIPH_ALWAYS_CALL_INIT)) {
115 if(!ctx->cipher->init(ctx,key,iv,enc)) return 0; 192 if(!ctx->cipher->init(ctx,key,iv,enc)) return 0;
116 } 193 }
117 if(enc != -1) ctx->encrypt=enc;
118 ctx->buf_len=0; 194 ctx->buf_len=0;
195 ctx->final_used=0;
196 ctx->block_mask=ctx->cipher->block_size-1;
119 return 1; 197 return 1;
120 } 198 }
121 199
122int EVP_CipherUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl, 200int EVP_CipherUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl,
123 unsigned char *in, int inl) 201 const unsigned char *in, int inl)
124 { 202 {
125 if (ctx->encrypt) 203 if (ctx->encrypt)
126 return EVP_EncryptUpdate(ctx,out,outl,in,inl); 204 return EVP_EncryptUpdate(ctx,out,outl,in,inl);
127 else return EVP_DecryptUpdate(ctx,out,outl,in,inl); 205 else return EVP_DecryptUpdate(ctx,out,outl,in,inl);
128 } 206 }
129 207
208int EVP_CipherFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl)
209 {
210 if (ctx->encrypt)
211 return EVP_EncryptFinal_ex(ctx,out,outl);
212 else return EVP_DecryptFinal_ex(ctx,out,outl);
213 }
214
130int EVP_CipherFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl) 215int EVP_CipherFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl)
131 { 216 {
132 if (ctx->encrypt) 217 if (ctx->encrypt)
133 return EVP_EncryptFinal(ctx,out,outl); 218 return EVP_EncryptFinal(ctx,out,outl);
134 else return(EVP_DecryptFinal(ctx,out,outl)); 219 else return EVP_DecryptFinal(ctx,out,outl);
135 } 220 }
136 221
137int EVP_EncryptInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher, 222int EVP_EncryptInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher,
138 unsigned char *key, unsigned char *iv) 223 const unsigned char *key, const unsigned char *iv)
139 { 224 {
140 return EVP_CipherInit(ctx, cipher, key, iv, 1); 225 return EVP_CipherInit(ctx, cipher, key, iv, 1);
141 } 226 }
142 227
228int EVP_EncryptInit_ex(EVP_CIPHER_CTX *ctx,const EVP_CIPHER *cipher, ENGINE *impl,
229 const unsigned char *key, const unsigned char *iv)
230 {
231 return EVP_CipherInit_ex(ctx, cipher, impl, key, iv, 1);
232 }
233
143int EVP_DecryptInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher, 234int EVP_DecryptInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher,
144 unsigned char *key, unsigned char *iv) 235 const unsigned char *key, const unsigned char *iv)
145 { 236 {
146 return EVP_CipherInit(ctx, cipher, key, iv, 0); 237 return EVP_CipherInit_ex(ctx, cipher, NULL, key, iv, 0);
147 } 238 }
148 239
240int EVP_DecryptInit_ex(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher, ENGINE *impl,
241 const unsigned char *key, const unsigned char *iv)
242 {
243 return EVP_CipherInit_ex(ctx, cipher, impl, key, iv, 0);
244 }
149 245
150int EVP_EncryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl, 246int EVP_EncryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl,
151 unsigned char *in, int inl) 247 const unsigned char *in, int inl)
152 { 248 {
153 int i,j,bl; 249 int i,j,bl;
154 250
251 if(ctx->buf_len == 0 && (inl&(ctx->block_mask)) == 0)
252 {
253 if(ctx->cipher->do_cipher(ctx,out,in,inl))
254 {
255 *outl=inl;
256 return 1;
257 }
258 else
259 {
260 *outl=0;
261 return 0;
262 }
263 }
155 i=ctx->buf_len; 264 i=ctx->buf_len;
156 bl=ctx->cipher->block_size; 265 bl=ctx->cipher->block_size;
157 *outl=0;
158 if ((inl == 0) && (i != bl)) return 1;
159 if (i != 0) 266 if (i != 0)
160 { 267 {
161 if (i+inl < bl) 268 if (i+inl < bl)
162 { 269 {
163 memcpy(&(ctx->buf[i]),in,inl); 270 memcpy(&(ctx->buf[i]),in,inl);
164 ctx->buf_len+=inl; 271 ctx->buf_len+=inl;
272 *outl=0;
165 return 1; 273 return 1;
166 } 274 }
167 else 275 else
168 { 276 {
169 j=bl-i; 277 j=bl-i;
170 if (j != 0) memcpy(&(ctx->buf[i]),in,j); 278 memcpy(&(ctx->buf[i]),in,j);
171 if(!ctx->cipher->do_cipher(ctx,out,ctx->buf,bl)) return 0; 279 if(!ctx->cipher->do_cipher(ctx,out,ctx->buf,bl)) return 0;
172 inl-=j; 280 inl-=j;
173 in+=j; 281 in+=j;
174 out+=bl; 282 out+=bl;
175 *outl+=bl; 283 *outl=bl;
176 } 284 }
177 } 285 }
178 i=inl%bl; /* how much is left */ 286 else
287 *outl = 0;
288 i=inl&(bl-1);
179 inl-=i; 289 inl-=i;
180 if (inl > 0) 290 if (inl > 0)
181 { 291 {
@@ -191,107 +301,153 @@ int EVP_EncryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl,
191 301
192int EVP_EncryptFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl) 302int EVP_EncryptFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl)
193 { 303 {
194 int i,n,b,bl; 304 int ret;
305 ret = EVP_EncryptFinal_ex(ctx, out, outl);
306 EVP_CIPHER_CTX_cleanup(ctx);
307 return ret;
308 }
309
310int EVP_EncryptFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl)
311 {
312 int i,n,b,bl,ret;
195 313
196 b=ctx->cipher->block_size; 314 b=ctx->cipher->block_size;
197 if (b == 1) 315 if (b == 1)
198 { 316 {
317 EVP_CIPHER_CTX_cleanup(ctx);
199 *outl=0; 318 *outl=0;
200 return 1; 319 return 1;
201 } 320 }
202 bl=ctx->buf_len; 321 bl=ctx->buf_len;
322 if (ctx->flags & EVP_CIPH_NO_PADDING)
323 {
324 EVP_CIPHER_CTX_cleanup(ctx);
325 if(bl)
326 {
327 EVPerr(EVP_F_EVP_ENCRYPTFINAL,EVP_R_DATA_NOT_MULTIPLE_OF_BLOCK_LENGTH);
328 return 0;
329 }
330 *outl = 0;
331 return 1;
332 }
333
203 n=b-bl; 334 n=b-bl;
204 for (i=bl; i<b; i++) 335 for (i=bl; i<b; i++)
205 ctx->buf[i]=n; 336 ctx->buf[i]=n;
206 if(!ctx->cipher->do_cipher(ctx,out,ctx->buf,b)) return 0; 337 ret=ctx->cipher->do_cipher(ctx,out,ctx->buf,b);
207 *outl=b; 338
208 return 1; 339 EVP_CIPHER_CTX_cleanup(ctx);
340
341 if(ret)
342 *outl=b;
343
344 return ret;
209 } 345 }
210 346
211int EVP_DecryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl, 347int EVP_DecryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl,
212 unsigned char *in, int inl) 348 const unsigned char *in, int inl)
213 { 349 {
214 int b,bl,n; 350 int b, fix_len;
215 int keep_last=0;
216 351
217 *outl=0; 352 if (inl == 0)
218 if (inl == 0) return 1; 353 {
354 *outl=0;
355 return 1;
356 }
357
358 if (ctx->flags & EVP_CIPH_NO_PADDING)
359 return EVP_EncryptUpdate(ctx, out, outl, in, inl);
219 360
220 b=ctx->cipher->block_size; 361 b=ctx->cipher->block_size;
221 if (b > 1) 362
363 if(ctx->final_used)
222 { 364 {
223 /* Is the input a multiple of the block size? */ 365 memcpy(out,ctx->final,b);
224 bl=ctx->buf_len; 366 out+=b;
225 n=inl+bl; 367 fix_len = 1;
226 if (n%b == 0)
227 {
228 if (inl < b) /* must be 'just one' buff */
229 {
230 memcpy(&(ctx->buf[bl]),in,inl);
231 ctx->buf_len=b;
232 *outl=0;
233 return 1;
234 }
235 keep_last=1;
236 inl-=b; /* don't do the last block */
237 }
238 } 368 }
239 if(!EVP_EncryptUpdate(ctx,out,outl,in,inl)) return 0; 369 else
370 fix_len = 0;
371
372
373 if(!EVP_EncryptUpdate(ctx,out,outl,in,inl))
374 return 0;
240 375
241 /* if we have 'decrypted' a multiple of block size, make sure 376 /* if we have 'decrypted' a multiple of block size, make sure
242 * we have a copy of this last block */ 377 * we have a copy of this last block */
243 if (keep_last) 378 if (b > 1 && !ctx->buf_len)
244 { 379 {
245 memcpy(&(ctx->buf[0]),&(in[inl]),b); 380 *outl-=b;
246#ifdef DEBUG 381 ctx->final_used=1;
247 if (ctx->buf_len != 0) 382 memcpy(ctx->final,&out[*outl],b);
248 {
249 abort();
250 }
251#endif
252 ctx->buf_len=b;
253 } 383 }
384 else
385 ctx->final_used = 0;
386
387 if (fix_len)
388 *outl += b;
389
254 return 1; 390 return 1;
255 } 391 }
256 392
257int EVP_DecryptFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl) 393int EVP_DecryptFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl)
258 { 394 {
395 int ret;
396 ret = EVP_DecryptFinal_ex(ctx, out, outl);
397 EVP_CIPHER_CTX_cleanup(ctx);
398 return ret;
399 }
400
401int EVP_DecryptFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl)
402 {
259 int i,b; 403 int i,b;
260 int n; 404 int n;
261 405
262 *outl=0; 406 *outl=0;
263 b=ctx->cipher->block_size; 407 b=ctx->cipher->block_size;
408 if (ctx->flags & EVP_CIPH_NO_PADDING)
409 {
410 EVP_CIPHER_CTX_cleanup(ctx);
411 if(ctx->buf_len)
412 {
413 EVPerr(EVP_F_EVP_DECRYPTFINAL,EVP_R_DATA_NOT_MULTIPLE_OF_BLOCK_LENGTH);
414 return 0;
415 }
416 *outl = 0;
417 return 1;
418 }
264 if (b > 1) 419 if (b > 1)
265 { 420 {
266 if (ctx->buf_len != b) 421 if (ctx->buf_len || !ctx->final_used)
267 { 422 {
423 EVP_CIPHER_CTX_cleanup(ctx);
268 EVPerr(EVP_F_EVP_DECRYPTFINAL,EVP_R_WRONG_FINAL_BLOCK_LENGTH); 424 EVPerr(EVP_F_EVP_DECRYPTFINAL,EVP_R_WRONG_FINAL_BLOCK_LENGTH);
269 return(0); 425 return(0);
270 } 426 }
271 if(!EVP_EncryptUpdate(ctx,ctx->buf,&n,ctx->buf,0)) return 0; 427 n=ctx->final[b-1];
272 if (n != b)
273 return(0);
274 n=ctx->buf[b-1];
275 if (n > b) 428 if (n > b)
276 { 429 {
430 EVP_CIPHER_CTX_cleanup(ctx);
277 EVPerr(EVP_F_EVP_DECRYPTFINAL,EVP_R_BAD_DECRYPT); 431 EVPerr(EVP_F_EVP_DECRYPTFINAL,EVP_R_BAD_DECRYPT);
278 return(0); 432 return(0);
279 } 433 }
280 for (i=0; i<n; i++) 434 for (i=0; i<n; i++)
281 { 435 {
282 if (ctx->buf[--b] != n) 436 if (ctx->final[--b] != n)
283 { 437 {
438 EVP_CIPHER_CTX_cleanup(ctx);
284 EVPerr(EVP_F_EVP_DECRYPTFINAL,EVP_R_BAD_DECRYPT); 439 EVPerr(EVP_F_EVP_DECRYPTFINAL,EVP_R_BAD_DECRYPT);
285 return(0); 440 return(0);
286 } 441 }
287 } 442 }
288 n=ctx->cipher->block_size-n; 443 n=ctx->cipher->block_size-n;
289 for (i=0; i<n; i++) 444 for (i=0; i<n; i++)
290 out[i]=ctx->buf[i]; 445 out[i]=ctx->final[i];
291 *outl=n; 446 *outl=n;
292 } 447 }
293 else 448 else
294 *outl=0; 449 *outl=0;
450 EVP_CIPHER_CTX_cleanup(ctx);
295 return(1); 451 return(1);
296 } 452 }
297 453
@@ -301,6 +457,11 @@ int EVP_CIPHER_CTX_cleanup(EVP_CIPHER_CTX *c)
301 { 457 {
302 if(!c->cipher->cleanup(c)) return 0; 458 if(!c->cipher->cleanup(c)) return 0;
303 } 459 }
460 OPENSSL_free(c->cipher_data);
461 if (c->engine)
462 /* The EVP_CIPHER we used belongs to an ENGINE, release the
463 * functional reference we held for this reason. */
464 ENGINE_finish(c->engine);
304 memset(c,0,sizeof(EVP_CIPHER_CTX)); 465 memset(c,0,sizeof(EVP_CIPHER_CTX));
305 return 1; 466 return 1;
306 } 467 }
@@ -319,6 +480,13 @@ int EVP_CIPHER_CTX_set_key_length(EVP_CIPHER_CTX *c, int keylen)
319 return 0; 480 return 0;
320 } 481 }
321 482
483int EVP_CIPHER_CTX_set_padding(EVP_CIPHER_CTX *ctx, int pad)
484 {
485 if (pad) ctx->flags &= ~EVP_CIPH_NO_PADDING;
486 else ctx->flags |= EVP_CIPH_NO_PADDING;
487 return 1;
488 }
489
322int EVP_CIPHER_CTX_ctrl(EVP_CIPHER_CTX *ctx, int type, int arg, void *ptr) 490int EVP_CIPHER_CTX_ctrl(EVP_CIPHER_CTX *ctx, int type, int arg, void *ptr)
323{ 491{
324 int ret; 492 int ret;
diff --git a/src/lib/libcrypto/evp/evp_err.c b/src/lib/libcrypto/evp/evp_err.c
index a01412a07c..3a23d21c21 100644
--- a/src/lib/libcrypto/evp/evp_err.c
+++ b/src/lib/libcrypto/evp/evp_err.c
@@ -63,7 +63,7 @@
63#include <openssl/evp.h> 63#include <openssl/evp.h>
64 64
65/* BEGIN ERROR CODES */ 65/* BEGIN ERROR CODES */
66#ifndef NO_ERR 66#ifndef OPENSSL_NO_ERR
67static ERR_STRING_DATA EVP_str_functs[]= 67static ERR_STRING_DATA EVP_str_functs[]=
68 { 68 {
69{ERR_PACK(0,EVP_F_D2I_PKEY,0), "D2I_PKEY"}, 69{ERR_PACK(0,EVP_F_D2I_PKEY,0), "D2I_PKEY"},
@@ -71,6 +71,8 @@ static ERR_STRING_DATA EVP_str_functs[]=
71{ERR_PACK(0,EVP_F_EVP_CIPHER_CTX_CTRL,0), "EVP_CIPHER_CTX_ctrl"}, 71{ERR_PACK(0,EVP_F_EVP_CIPHER_CTX_CTRL,0), "EVP_CIPHER_CTX_ctrl"},
72{ERR_PACK(0,EVP_F_EVP_CIPHER_CTX_SET_KEY_LENGTH,0), "EVP_CIPHER_CTX_set_key_length"}, 72{ERR_PACK(0,EVP_F_EVP_CIPHER_CTX_SET_KEY_LENGTH,0), "EVP_CIPHER_CTX_set_key_length"},
73{ERR_PACK(0,EVP_F_EVP_DECRYPTFINAL,0), "EVP_DecryptFinal"}, 73{ERR_PACK(0,EVP_F_EVP_DECRYPTFINAL,0), "EVP_DecryptFinal"},
74{ERR_PACK(0,EVP_F_EVP_DIGESTINIT,0), "EVP_DigestInit"},
75{ERR_PACK(0,EVP_F_EVP_ENCRYPTFINAL,0), "EVP_EncryptFinal"},
74{ERR_PACK(0,EVP_F_EVP_MD_CTX_COPY,0), "EVP_MD_CTX_copy"}, 76{ERR_PACK(0,EVP_F_EVP_MD_CTX_COPY,0), "EVP_MD_CTX_copy"},
75{ERR_PACK(0,EVP_F_EVP_OPENINIT,0), "EVP_OpenInit"}, 77{ERR_PACK(0,EVP_F_EVP_OPENINIT,0), "EVP_OpenInit"},
76{ERR_PACK(0,EVP_F_EVP_PBE_ALG_ADD,0), "EVP_PBE_alg_add"}, 78{ERR_PACK(0,EVP_F_EVP_PBE_ALG_ADD,0), "EVP_PBE_alg_add"},
@@ -85,6 +87,7 @@ static ERR_STRING_DATA EVP_str_functs[]=
85{ERR_PACK(0,EVP_F_EVP_PKEY_GET1_DSA,0), "EVP_PKEY_get1_DSA"}, 87{ERR_PACK(0,EVP_F_EVP_PKEY_GET1_DSA,0), "EVP_PKEY_get1_DSA"},
86{ERR_PACK(0,EVP_F_EVP_PKEY_GET1_RSA,0), "EVP_PKEY_get1_RSA"}, 88{ERR_PACK(0,EVP_F_EVP_PKEY_GET1_RSA,0), "EVP_PKEY_get1_RSA"},
87{ERR_PACK(0,EVP_F_EVP_PKEY_NEW,0), "EVP_PKEY_new"}, 89{ERR_PACK(0,EVP_F_EVP_PKEY_NEW,0), "EVP_PKEY_new"},
90{ERR_PACK(0,EVP_F_EVP_RIJNDAEL,0), "EVP_RIJNDAEL"},
88{ERR_PACK(0,EVP_F_EVP_SIGNFINAL,0), "EVP_SignFinal"}, 91{ERR_PACK(0,EVP_F_EVP_SIGNFINAL,0), "EVP_SignFinal"},
89{ERR_PACK(0,EVP_F_EVP_VERIFYFINAL,0), "EVP_VerifyFinal"}, 92{ERR_PACK(0,EVP_F_EVP_VERIFYFINAL,0), "EVP_VerifyFinal"},
90{ERR_PACK(0,EVP_F_PKCS5_PBE_KEYIVGEN,0), "PKCS5_PBE_keyivgen"}, 93{ERR_PACK(0,EVP_F_PKCS5_PBE_KEYIVGEN,0), "PKCS5_PBE_keyivgen"},
@@ -96,12 +99,15 @@ static ERR_STRING_DATA EVP_str_functs[]=
96 99
97static ERR_STRING_DATA EVP_str_reasons[]= 100static ERR_STRING_DATA EVP_str_reasons[]=
98 { 101 {
102{EVP_R_BAD_BLOCK_LENGTH ,"bad block length"},
99{EVP_R_BAD_DECRYPT ,"bad decrypt"}, 103{EVP_R_BAD_DECRYPT ,"bad decrypt"},
104{EVP_R_BAD_KEY_LENGTH ,"bad key length"},
100{EVP_R_BN_DECODE_ERROR ,"bn decode error"}, 105{EVP_R_BN_DECODE_ERROR ,"bn decode error"},
101{EVP_R_BN_PUBKEY_ERROR ,"bn pubkey error"}, 106{EVP_R_BN_PUBKEY_ERROR ,"bn pubkey error"},
102{EVP_R_CIPHER_PARAMETER_ERROR ,"cipher parameter error"}, 107{EVP_R_CIPHER_PARAMETER_ERROR ,"cipher parameter error"},
103{EVP_R_CTRL_NOT_IMPLEMENTED ,"ctrl not implemented"}, 108{EVP_R_CTRL_NOT_IMPLEMENTED ,"ctrl not implemented"},
104{EVP_R_CTRL_OPERATION_NOT_IMPLEMENTED ,"ctrl operation not implemented"}, 109{EVP_R_CTRL_OPERATION_NOT_IMPLEMENTED ,"ctrl operation not implemented"},
110{EVP_R_DATA_NOT_MULTIPLE_OF_BLOCK_LENGTH ,"data not multiple of block length"},
105{EVP_R_DECODE_ERROR ,"decode error"}, 111{EVP_R_DECODE_ERROR ,"decode error"},
106{EVP_R_DIFFERENT_KEY_TYPES ,"different key types"}, 112{EVP_R_DIFFERENT_KEY_TYPES ,"different key types"},
107{EVP_R_ENCODE_ERROR ,"encode error"}, 113{EVP_R_ENCODE_ERROR ,"encode error"},
@@ -116,6 +122,7 @@ static ERR_STRING_DATA EVP_str_reasons[]=
116{EVP_R_KEYGEN_FAILURE ,"keygen failure"}, 122{EVP_R_KEYGEN_FAILURE ,"keygen failure"},
117{EVP_R_MISSING_PARAMETERS ,"missing parameters"}, 123{EVP_R_MISSING_PARAMETERS ,"missing parameters"},
118{EVP_R_NO_CIPHER_SET ,"no cipher set"}, 124{EVP_R_NO_CIPHER_SET ,"no cipher set"},
125{EVP_R_NO_DIGEST_SET ,"no digest set"},
119{EVP_R_NO_DSA_PARAMETERS ,"no dsa parameters"}, 126{EVP_R_NO_DSA_PARAMETERS ,"no dsa parameters"},
120{EVP_R_NO_SIGN_FUNCTION_CONFIGURED ,"no sign function configured"}, 127{EVP_R_NO_SIGN_FUNCTION_CONFIGURED ,"no sign function configured"},
121{EVP_R_NO_VERIFY_FUNCTION_CONFIGURED ,"no verify function configured"}, 128{EVP_R_NO_VERIFY_FUNCTION_CONFIGURED ,"no verify function configured"},
@@ -144,7 +151,7 @@ void ERR_load_EVP_strings(void)
144 if (init) 151 if (init)
145 { 152 {
146 init=0; 153 init=0;
147#ifndef NO_ERR 154#ifndef OPENSSL_NO_ERR
148 ERR_load_strings(ERR_LIB_EVP,EVP_str_functs); 155 ERR_load_strings(ERR_LIB_EVP,EVP_str_functs);
149 ERR_load_strings(ERR_LIB_EVP,EVP_str_reasons); 156 ERR_load_strings(ERR_LIB_EVP,EVP_str_reasons);
150#endif 157#endif
diff --git a/src/lib/libcrypto/evp/evp_key.c b/src/lib/libcrypto/evp/evp_key.c
index e7434ef9b2..4271393069 100644
--- a/src/lib/libcrypto/evp/evp_key.c
+++ b/src/lib/libcrypto/evp/evp_key.c
@@ -61,6 +61,7 @@
61#include <openssl/x509.h> 61#include <openssl/x509.h>
62#include <openssl/objects.h> 62#include <openssl/objects.h>
63#include <openssl/evp.h> 63#include <openssl/evp.h>
64#include <openssl/ui.h>
64 65
65/* should be init to zeros. */ 66/* should be init to zeros. */
66static char prompt_string[80]; 67static char prompt_string[80];
@@ -70,7 +71,10 @@ void EVP_set_pw_prompt(char *prompt)
70 if (prompt == NULL) 71 if (prompt == NULL)
71 prompt_string[0]='\0'; 72 prompt_string[0]='\0';
72 else 73 else
74 {
73 strncpy(prompt_string,prompt,79); 75 strncpy(prompt_string,prompt,79);
76 prompt_string[79]='\0';
77 }
74 } 78 }
75 79
76char *EVP_get_pw_prompt(void) 80char *EVP_get_pw_prompt(void)
@@ -86,18 +90,26 @@ char *EVP_get_pw_prompt(void)
86 * this function will fail */ 90 * this function will fail */
87int EVP_read_pw_string(char *buf, int len, const char *prompt, int verify) 91int EVP_read_pw_string(char *buf, int len, const char *prompt, int verify)
88 { 92 {
89#ifndef NO_DES 93 int ret;
94 char buff[BUFSIZ];
95 UI *ui;
96
90 if ((prompt == NULL) && (prompt_string[0] != '\0')) 97 if ((prompt == NULL) && (prompt_string[0] != '\0'))
91 prompt=prompt_string; 98 prompt=prompt_string;
92 return(des_read_pw_string(buf,len,prompt,verify)); 99 ui = UI_new();
93#else 100 UI_add_input_string(ui,prompt,0,buf,0,(len>=BUFSIZ)?BUFSIZ-1:len);
94 return -1; 101 if (verify)
95#endif 102 UI_add_verify_string(ui,prompt,0,
103 buff,0,(len>=BUFSIZ)?BUFSIZ-1:len,buf);
104 ret = UI_process(ui);
105 UI_free(ui);
106 memset(buff,0,BUFSIZ);
107 return ret;
96 } 108 }
97 109
98int EVP_BytesToKey(const EVP_CIPHER *type, EVP_MD *md, 110int EVP_BytesToKey(const EVP_CIPHER *type, const EVP_MD *md,
99 const unsigned char *salt, const unsigned char *data, int datal, 111 const unsigned char *salt, const unsigned char *data, int datal,
100 int count, unsigned char *key, unsigned char *iv) 112 int count, unsigned char *key, unsigned char *iv)
101 { 113 {
102 EVP_MD_CTX c; 114 EVP_MD_CTX c;
103 unsigned char md_buf[EVP_MAX_MD_SIZE]; 115 unsigned char md_buf[EVP_MAX_MD_SIZE];
@@ -109,21 +121,22 @@ int EVP_BytesToKey(const EVP_CIPHER *type, EVP_MD *md,
109 121
110 if (data == NULL) return(nkey); 122 if (data == NULL) return(nkey);
111 123
124 EVP_MD_CTX_init(&c);
112 for (;;) 125 for (;;)
113 { 126 {
114 EVP_DigestInit(&c,md); 127 EVP_DigestInit_ex(&c,md, NULL);
115 if (addmd++) 128 if (addmd++)
116 EVP_DigestUpdate(&c,&(md_buf[0]),mds); 129 EVP_DigestUpdate(&c,&(md_buf[0]),mds);
117 EVP_DigestUpdate(&c,data,datal); 130 EVP_DigestUpdate(&c,data,datal);
118 if (salt != NULL) 131 if (salt != NULL)
119 EVP_DigestUpdate(&c,salt,PKCS5_SALT_LEN); 132 EVP_DigestUpdate(&c,salt,PKCS5_SALT_LEN);
120 EVP_DigestFinal(&c,&(md_buf[0]),&mds); 133 EVP_DigestFinal_ex(&c,&(md_buf[0]),&mds);
121 134
122 for (i=1; i<(unsigned int)count; i++) 135 for (i=1; i<(unsigned int)count; i++)
123 { 136 {
124 EVP_DigestInit(&c,md); 137 EVP_DigestInit_ex(&c,md, NULL);
125 EVP_DigestUpdate(&c,&(md_buf[0]),mds); 138 EVP_DigestUpdate(&c,&(md_buf[0]),mds);
126 EVP_DigestFinal(&c,&(md_buf[0]),&mds); 139 EVP_DigestFinal_ex(&c,&(md_buf[0]),&mds);
127 } 140 }
128 i=0; 141 i=0;
129 if (nkey) 142 if (nkey)
@@ -152,7 +165,7 @@ int EVP_BytesToKey(const EVP_CIPHER *type, EVP_MD *md,
152 } 165 }
153 if ((nkey == 0) && (niv == 0)) break; 166 if ((nkey == 0) && (niv == 0)) break;
154 } 167 }
155 memset(&c,0,sizeof(c)); 168 EVP_MD_CTX_cleanup(&c);
156 memset(&(md_buf[0]),0,EVP_MAX_MD_SIZE); 169 memset(&(md_buf[0]),0,EVP_MAX_MD_SIZE);
157 return(type->key_len); 170 return(type->key_len);
158 } 171 }
diff --git a/src/lib/libcrypto/evp/evp_locl.h b/src/lib/libcrypto/evp/evp_locl.h
index ce49d5b7d8..7b088b4848 100644
--- a/src/lib/libcrypto/evp/evp_locl.h
+++ b/src/lib/libcrypto/evp/evp_locl.h
@@ -61,50 +61,107 @@
61/* Wrapper functions for each cipher mode */ 61/* Wrapper functions for each cipher mode */
62 62
63#define BLOCK_CIPHER_ecb_loop() \ 63#define BLOCK_CIPHER_ecb_loop() \
64 unsigned int i; \ 64 unsigned int i, bl; \
65 if(inl < 8) return 1;\ 65 bl = ctx->cipher->block_size;\
66 inl -= 8; \ 66 if(inl < bl) return 1;\
67 for(i=0; i <= inl; i+=8) \ 67 inl -= bl; \
68 for(i=0; i <= inl; i+=bl) \
68 69
69#define BLOCK_CIPHER_func_ecb(cname, cprefix, kname) \ 70#define BLOCK_CIPHER_func_ecb(cname, cprefix, kstruct, ksched) \
70static int cname##_ecb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, const unsigned char *in, unsigned int inl) \ 71static int cname##_ecb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, const unsigned char *in, unsigned int inl) \
71{\ 72{\
72 BLOCK_CIPHER_ecb_loop() \ 73 BLOCK_CIPHER_ecb_loop() \
73 cprefix##_ecb_encrypt(in + i, out + i, &ctx->c.kname, ctx->encrypt);\ 74 cprefix##_ecb_encrypt(in + i, out + i, &((kstruct *)ctx->cipher_data)->ksched, ctx->encrypt);\
74 return 1;\ 75 return 1;\
75} 76}
76 77
77#define BLOCK_CIPHER_func_ofb(cname, cprefix, kname) \ 78#define BLOCK_CIPHER_func_ofb(cname, cprefix, cbits, kstruct, ksched) \
78static int cname##_ofb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, const unsigned char *in, unsigned int inl) \ 79static int cname##_ofb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, const unsigned char *in, unsigned int inl) \
79{\ 80{\
80 cprefix##_ofb64_encrypt(in, out, (long)inl, &ctx->c.kname, ctx->iv, &ctx->num);\ 81 cprefix##_ofb##cbits##_encrypt(in, out, (long)inl, &((kstruct *)ctx->cipher_data)->ksched, ctx->iv, &ctx->num);\
81 return 1;\ 82 return 1;\
82} 83}
83 84
84#define BLOCK_CIPHER_func_cbc(cname, cprefix, kname) \ 85#define BLOCK_CIPHER_func_cbc(cname, cprefix, kstruct, ksched) \
85static int cname##_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, const unsigned char *in, unsigned int inl) \ 86static int cname##_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, const unsigned char *in, unsigned int inl) \
86{\ 87{\
87 cprefix##_cbc_encrypt(in, out, (long)inl, &ctx->c.kname, ctx->iv, ctx->encrypt);\ 88 cprefix##_cbc_encrypt(in, out, (long)inl, &((kstruct *)ctx->cipher_data)->ksched, ctx->iv, ctx->encrypt);\
88 return 1;\ 89 return 1;\
89} 90}
90 91
91#define BLOCK_CIPHER_func_cfb(cname, cprefix, kname) \ 92#define BLOCK_CIPHER_func_cfb(cname, cprefix, cbits, kstruct, ksched) \
92static int cname##_cfb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, const unsigned char *in, unsigned int inl) \ 93static int cname##_cfb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, const unsigned char *in, unsigned int inl) \
93{\ 94{\
94 cprefix##_cfb64_encrypt(in, out, (long)inl, &ctx->c.kname, ctx->iv, &ctx->num, ctx->encrypt);\ 95 cprefix##_cfb##cbits##_encrypt(in, out, (long)inl, &((kstruct *)ctx->cipher_data)->ksched, ctx->iv, &ctx->num, ctx->encrypt);\
95 return 1;\ 96 return 1;\
96} 97}
97 98
98#define BLOCK_CIPHER_all_funcs(cname, cprefix, kname) \ 99#define BLOCK_CIPHER_all_funcs(cname, cprefix, cbits, kstruct, ksched) \
99 BLOCK_CIPHER_func_cbc(cname, cprefix, kname) \ 100 BLOCK_CIPHER_func_cbc(cname, cprefix, kstruct, ksched) \
100 BLOCK_CIPHER_func_cfb(cname, cprefix, kname) \ 101 BLOCK_CIPHER_func_cfb(cname, cprefix, cbits, kstruct, ksched) \
101 BLOCK_CIPHER_func_ecb(cname, cprefix, kname) \ 102 BLOCK_CIPHER_func_ecb(cname, cprefix, kstruct, ksched) \
102 BLOCK_CIPHER_func_ofb(cname, cprefix, kname) 103 BLOCK_CIPHER_func_ofb(cname, cprefix, cbits, kstruct, ksched)
103 104
105#define BLOCK_CIPHER_def1(cname, nmode, mode, MODE, kstruct, nid, block_size, \
106 key_len, iv_len, flags, init_key, cleanup, \
107 set_asn1, get_asn1, ctrl) \
108static const EVP_CIPHER cname##_##mode = { \
109 nid##_##nmode, block_size, key_len, iv_len, \
110 flags | EVP_CIPH_##MODE##_MODE, \
111 init_key, \
112 cname##_##mode##_cipher, \
113 cleanup, \
114 sizeof(kstruct), \
115 set_asn1, get_asn1,\
116 ctrl, \
117 NULL \
118}; \
119const EVP_CIPHER *EVP_##cname##_##mode(void) { return &cname##_##mode; }
120
121#define BLOCK_CIPHER_def_cbc(cname, kstruct, nid, block_size, key_len, \
122 iv_len, flags, init_key, cleanup, set_asn1, \
123 get_asn1, ctrl) \
124BLOCK_CIPHER_def1(cname, cbc, cbc, CBC, kstruct, nid, block_size, key_len, \
125 iv_len, flags, init_key, cleanup, set_asn1, get_asn1, ctrl)
126
127#define BLOCK_CIPHER_def_cfb(cname, kstruct, nid, block_size, key_len, \
128 iv_len, cbits, flags, init_key, cleanup, \
129 set_asn1, get_asn1, ctrl) \
130BLOCK_CIPHER_def1(cname, cfb##cbits, cfb, CFB, kstruct, nid, block_size, \
131 key_len, iv_len, flags, init_key, cleanup, set_asn1, \
132 get_asn1, ctrl)
133
134#define BLOCK_CIPHER_def_ofb(cname, kstruct, nid, block_size, key_len, \
135 iv_len, cbits, flags, init_key, cleanup, \
136 set_asn1, get_asn1, ctrl) \
137BLOCK_CIPHER_def1(cname, ofb##cbits, ofb, OFB, kstruct, nid, block_size, \
138 key_len, iv_len, flags, init_key, cleanup, set_asn1, \
139 get_asn1, ctrl)
140
141#define BLOCK_CIPHER_def_ecb(cname, kstruct, nid, block_size, key_len, \
142 iv_len, flags, init_key, cleanup, set_asn1, \
143 get_asn1, ctrl) \
144BLOCK_CIPHER_def1(cname, ecb, ecb, ECB, kstruct, nid, block_size, key_len, \
145 iv_len, flags, init_key, cleanup, set_asn1, get_asn1, ctrl)
146
147#define BLOCK_CIPHER_defs(cname, kstruct, \
148 nid, block_size, key_len, iv_len, cbits, flags, \
149 init_key, cleanup, set_asn1, get_asn1, ctrl) \
150BLOCK_CIPHER_def_cbc(cname, kstruct, nid, block_size, key_len, iv_len, flags, \
151 init_key, cleanup, set_asn1, get_asn1, ctrl) \
152BLOCK_CIPHER_def_cfb(cname, kstruct, nid, block_size, key_len, iv_len, cbits, \
153 flags, init_key, cleanup, set_asn1, get_asn1, ctrl) \
154BLOCK_CIPHER_def_ofb(cname, kstruct, nid, block_size, key_len, iv_len, cbits, \
155 flags, init_key, cleanup, set_asn1, get_asn1, ctrl) \
156BLOCK_CIPHER_def_ecb(cname, kstruct, nid, block_size, key_len, iv_len, flags, \
157 init_key, cleanup, set_asn1, get_asn1, ctrl)
158
159
160/*
104#define BLOCK_CIPHER_defs(cname, kstruct, \ 161#define BLOCK_CIPHER_defs(cname, kstruct, \
105 nid, block_size, key_len, iv_len, flags,\ 162 nid, block_size, key_len, iv_len, flags,\
106 init_key, cleanup, set_asn1, get_asn1, ctrl)\ 163 init_key, cleanup, set_asn1, get_asn1, ctrl)\
107static EVP_CIPHER cname##_cbc = {\ 164static const EVP_CIPHER cname##_cbc = {\
108 nid##_cbc, block_size, key_len, iv_len, \ 165 nid##_cbc, block_size, key_len, iv_len, \
109 flags | EVP_CIPH_CBC_MODE,\ 166 flags | EVP_CIPH_CBC_MODE,\
110 init_key,\ 167 init_key,\
@@ -116,8 +173,8 @@ static EVP_CIPHER cname##_cbc = {\
116 ctrl, \ 173 ctrl, \
117 NULL \ 174 NULL \
118};\ 175};\
119EVP_CIPHER *EVP_##cname##_cbc(void) { return &cname##_cbc; }\ 176const EVP_CIPHER *EVP_##cname##_cbc(void) { return &cname##_cbc; }\
120static EVP_CIPHER cname##_cfb = {\ 177static const EVP_CIPHER cname##_cfb = {\
121 nid##_cfb64, 1, key_len, iv_len, \ 178 nid##_cfb64, 1, key_len, iv_len, \
122 flags | EVP_CIPH_CFB_MODE,\ 179 flags | EVP_CIPH_CFB_MODE,\
123 init_key,\ 180 init_key,\
@@ -129,8 +186,8 @@ static EVP_CIPHER cname##_cfb = {\
129 ctrl,\ 186 ctrl,\
130 NULL \ 187 NULL \
131};\ 188};\
132EVP_CIPHER *EVP_##cname##_cfb(void) { return &cname##_cfb; }\ 189const EVP_CIPHER *EVP_##cname##_cfb(void) { return &cname##_cfb; }\
133static EVP_CIPHER cname##_ofb = {\ 190static const EVP_CIPHER cname##_ofb = {\
134 nid##_ofb64, 1, key_len, iv_len, \ 191 nid##_ofb64, 1, key_len, iv_len, \
135 flags | EVP_CIPH_OFB_MODE,\ 192 flags | EVP_CIPH_OFB_MODE,\
136 init_key,\ 193 init_key,\
@@ -142,8 +199,8 @@ static EVP_CIPHER cname##_ofb = {\
142 ctrl,\ 199 ctrl,\
143 NULL \ 200 NULL \
144};\ 201};\
145EVP_CIPHER *EVP_##cname##_ofb(void) { return &cname##_ofb; }\ 202const EVP_CIPHER *EVP_##cname##_ofb(void) { return &cname##_ofb; }\
146static EVP_CIPHER cname##_ecb = {\ 203static const EVP_CIPHER cname##_ecb = {\
147 nid##_ecb, block_size, key_len, iv_len, \ 204 nid##_ecb, block_size, key_len, iv_len, \
148 flags | EVP_CIPH_ECB_MODE,\ 205 flags | EVP_CIPH_ECB_MODE,\
149 init_key,\ 206 init_key,\
@@ -155,14 +212,16 @@ static EVP_CIPHER cname##_ecb = {\
155 ctrl,\ 212 ctrl,\
156 NULL \ 213 NULL \
157};\ 214};\
158EVP_CIPHER *EVP_##cname##_ecb(void) { return &cname##_ecb; } 215const EVP_CIPHER *EVP_##cname##_ecb(void) { return &cname##_ecb; }
159 216*/
160
161 217
162#define IMPLEMENT_BLOCK_CIPHER(cname, kname, cprefix, kstruct, \ 218#define IMPLEMENT_BLOCK_CIPHER(cname, ksched, cprefix, kstruct, nid, \
163 nid, block_size, key_len, iv_len, flags, \ 219 block_size, key_len, iv_len, cbits, \
164 init_key, cleanup, set_asn1, get_asn1, ctrl) \ 220 flags, init_key, \
165 BLOCK_CIPHER_all_funcs(cname, cprefix, kname) \ 221 cleanup, set_asn1, get_asn1, ctrl) \
166 BLOCK_CIPHER_defs(cname, kstruct, nid, block_size, key_len, iv_len, flags,\ 222 BLOCK_CIPHER_all_funcs(cname, cprefix, cbits, kstruct, ksched) \
167 init_key, cleanup, set_asn1, get_asn1, ctrl) 223 BLOCK_CIPHER_defs(cname, kstruct, nid, block_size, key_len, iv_len, \
224 cbits, flags, init_key, cleanup, set_asn1, \
225 get_asn1, ctrl)
168 226
227#define EVP_C_DATA(kstruct, ctx) ((kstruct *)(ctx)->cipher_data)
diff --git a/src/lib/libcrypto/evp/evp_pbe.c b/src/lib/libcrypto/evp/evp_pbe.c
index 224a422b12..06afb9d152 100644
--- a/src/lib/libcrypto/evp/evp_pbe.c
+++ b/src/lib/libcrypto/evp/evp_pbe.c
@@ -69,8 +69,8 @@ static STACK *pbe_algs;
69 69
70typedef struct { 70typedef struct {
71int pbe_nid; 71int pbe_nid;
72EVP_CIPHER *cipher; 72const EVP_CIPHER *cipher;
73EVP_MD *md; 73const EVP_MD *md;
74EVP_PBE_KEYGEN *keygen; 74EVP_PBE_KEYGEN *keygen;
75} EVP_PBE_CTL; 75} EVP_PBE_CTL;
76 76
@@ -112,7 +112,7 @@ static int pbe_cmp(const char * const *a, const char * const *b)
112 112
113/* Add a PBE algorithm */ 113/* Add a PBE algorithm */
114 114
115int EVP_PBE_alg_add (int nid, EVP_CIPHER *cipher, EVP_MD *md, 115int EVP_PBE_alg_add(int nid, const EVP_CIPHER *cipher, const EVP_MD *md,
116 EVP_PBE_KEYGEN *keygen) 116 EVP_PBE_KEYGEN *keygen)
117{ 117{
118 EVP_PBE_CTL *pbe_tmp; 118 EVP_PBE_CTL *pbe_tmp;
diff --git a/src/lib/libcrypto/evp/evp_pkey.c b/src/lib/libcrypto/evp/evp_pkey.c
index 8df2874f3c..34b5b1d21c 100644
--- a/src/lib/libcrypto/evp/evp_pkey.c
+++ b/src/lib/libcrypto/evp/evp_pkey.c
@@ -62,17 +62,19 @@
62#include <openssl/x509.h> 62#include <openssl/x509.h>
63#include <openssl/rand.h> 63#include <openssl/rand.h>
64 64
65#ifndef OPENSSL_NO_DSA
65static int dsa_pkey2pkcs8(PKCS8_PRIV_KEY_INFO *p8inf, EVP_PKEY *pkey); 66static int dsa_pkey2pkcs8(PKCS8_PRIV_KEY_INFO *p8inf, EVP_PKEY *pkey);
67#endif
66 68
67/* Extract a private key from a PKCS8 structure */ 69/* Extract a private key from a PKCS8 structure */
68 70
69EVP_PKEY *EVP_PKCS82PKEY (PKCS8_PRIV_KEY_INFO *p8) 71EVP_PKEY *EVP_PKCS82PKEY (PKCS8_PRIV_KEY_INFO *p8)
70{ 72{
71 EVP_PKEY *pkey = NULL; 73 EVP_PKEY *pkey = NULL;
72#ifndef NO_RSA 74#ifndef OPENSSL_NO_RSA
73 RSA *rsa = NULL; 75 RSA *rsa = NULL;
74#endif 76#endif
75#ifndef NO_DSA 77#ifndef OPENSSL_NO_DSA
76 DSA *dsa = NULL; 78 DSA *dsa = NULL;
77 ASN1_INTEGER *privkey; 79 ASN1_INTEGER *privkey;
78 ASN1_TYPE *t1, *t2, *param = NULL; 80 ASN1_TYPE *t1, *t2, *param = NULL;
@@ -82,6 +84,7 @@ EVP_PKEY *EVP_PKCS82PKEY (PKCS8_PRIV_KEY_INFO *p8)
82#endif 84#endif
83 X509_ALGOR *a; 85 X509_ALGOR *a;
84 unsigned char *p; 86 unsigned char *p;
87 const unsigned char *cp;
85 int pkeylen; 88 int pkeylen;
86 char obj_tmp[80]; 89 char obj_tmp[80];
87 90
@@ -101,16 +104,17 @@ EVP_PKEY *EVP_PKCS82PKEY (PKCS8_PRIV_KEY_INFO *p8)
101 a = p8->pkeyalg; 104 a = p8->pkeyalg;
102 switch (OBJ_obj2nid(a->algorithm)) 105 switch (OBJ_obj2nid(a->algorithm))
103 { 106 {
104#ifndef NO_RSA 107#ifndef OPENSSL_NO_RSA
105 case NID_rsaEncryption: 108 case NID_rsaEncryption:
106 if (!(rsa = d2i_RSAPrivateKey (NULL, &p, pkeylen))) { 109 cp = p;
110 if (!(rsa = d2i_RSAPrivateKey (NULL,&cp, pkeylen))) {
107 EVPerr(EVP_F_EVP_PKCS82PKEY, EVP_R_DECODE_ERROR); 111 EVPerr(EVP_F_EVP_PKCS82PKEY, EVP_R_DECODE_ERROR);
108 return NULL; 112 return NULL;
109 } 113 }
110 EVP_PKEY_assign_RSA (pkey, rsa); 114 EVP_PKEY_assign_RSA (pkey, rsa);
111 break; 115 break;
112#endif 116#endif
113#ifndef NO_DSA 117#ifndef OPENSSL_NO_DSA
114 case NID_dsa: 118 case NID_dsa:
115 /* PKCS#8 DSA is weird: you just get a private key integer 119 /* PKCS#8 DSA is weird: you just get a private key integer
116 * and parameters in the AlgorithmIdentifier the pubkey must 120 * and parameters in the AlgorithmIdentifier the pubkey must
@@ -163,9 +167,9 @@ EVP_PKEY *EVP_PKCS82PKEY (PKCS8_PRIV_KEY_INFO *p8)
163 EVPerr(EVP_F_EVP_PKCS82PKEY, EVP_R_DECODE_ERROR); 167 EVPerr(EVP_F_EVP_PKCS82PKEY, EVP_R_DECODE_ERROR);
164 goto dsaerr; 168 goto dsaerr;
165 } 169 }
166 p = param->value.sequence->data; 170 cp = p = param->value.sequence->data;
167 plen = param->value.sequence->length; 171 plen = param->value.sequence->length;
168 if (!(dsa = d2i_DSAparams (NULL, &p, plen))) { 172 if (!(dsa = d2i_DSAparams (NULL, &cp, plen))) {
169 EVPerr(EVP_F_EVP_PKCS82PKEY, EVP_R_DECODE_ERROR); 173 EVPerr(EVP_F_EVP_PKCS82PKEY, EVP_R_DECODE_ERROR);
170 goto dsaerr; 174 goto dsaerr;
171 } 175 }
@@ -239,7 +243,7 @@ PKCS8_PRIV_KEY_INFO *EVP_PKEY2PKCS8_broken(EVP_PKEY *pkey, int broken)
239 } 243 }
240 p8->pkey->type = V_ASN1_OCTET_STRING; 244 p8->pkey->type = V_ASN1_OCTET_STRING;
241 switch (EVP_PKEY_type(pkey->type)) { 245 switch (EVP_PKEY_type(pkey->type)) {
242#ifndef NO_RSA 246#ifndef OPENSSL_NO_RSA
243 case EVP_PKEY_RSA: 247 case EVP_PKEY_RSA:
244 248
245 if(p8->broken == PKCS8_NO_OCTET) p8->pkey->type = V_ASN1_SEQUENCE; 249 if(p8->broken == PKCS8_NO_OCTET) p8->pkey->type = V_ASN1_SEQUENCE;
@@ -254,7 +258,7 @@ PKCS8_PRIV_KEY_INFO *EVP_PKEY2PKCS8_broken(EVP_PKEY *pkey, int broken)
254 } 258 }
255 break; 259 break;
256#endif 260#endif
257#ifndef NO_DSA 261#ifndef OPENSSL_NO_DSA
258 case EVP_PKEY_DSA: 262 case EVP_PKEY_DSA:
259 if(!dsa_pkey2pkcs8(p8, pkey)) { 263 if(!dsa_pkey2pkcs8(p8, pkey)) {
260 PKCS8_PRIV_KEY_INFO_free (p8); 264 PKCS8_PRIV_KEY_INFO_free (p8);
@@ -296,7 +300,7 @@ PKCS8_PRIV_KEY_INFO *PKCS8_set_broken(PKCS8_PRIV_KEY_INFO *p8, int broken)
296 } 300 }
297} 301}
298 302
299#ifndef NO_DSA 303#ifndef OPENSSL_NO_DSA
300static int dsa_pkey2pkcs8(PKCS8_PRIV_KEY_INFO *p8, EVP_PKEY *pkey) 304static int dsa_pkey2pkcs8(PKCS8_PRIV_KEY_INFO *p8, EVP_PKEY *pkey)
301{ 305{
302 ASN1_STRING *params; 306 ASN1_STRING *params;
diff --git a/src/lib/libcrypto/evp/evp_test.c b/src/lib/libcrypto/evp/evp_test.c
new file mode 100644
index 0000000000..3607fe7776
--- /dev/null
+++ b/src/lib/libcrypto/evp/evp_test.c
@@ -0,0 +1,365 @@
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#include <openssl/evp.h>
53#include <openssl/engine.h>
54#include <openssl/conf.h>
55
56static void hexdump(FILE *f,const char *title,const unsigned char *s,int l)
57 {
58 int n=0;
59
60 fprintf(f,"%s",title);
61 for( ; n < l ; ++n)
62 {
63 if((n%16) == 0)
64 fprintf(f,"\n%04x",n);
65 fprintf(f," %02x",s[n]);
66 }
67 fprintf(f,"\n");
68 }
69
70static int convert(unsigned char *s)
71 {
72 unsigned char *d;
73
74 for(d=s ; *s ; s+=2,++d)
75 {
76 unsigned int n;
77
78 if(!s[1])
79 {
80 fprintf(stderr,"Odd number of hex digits!");
81 exit(4);
82 }
83 sscanf((char *)s,"%2x",&n);
84 *d=(unsigned char)n;
85 }
86 return s-d;
87 }
88
89static char *sstrsep(char **string, const char *delim)
90 {
91 char isdelim[256];
92 char *token = *string;
93
94 if (**string == 0)
95 return NULL;
96
97 memset(isdelim, 0, 256);
98 isdelim[0] = 1;
99
100 while (*delim)
101 {
102 isdelim[(unsigned char)(*delim)] = 1;
103 delim++;
104 }
105
106 while (!isdelim[(unsigned char)(**string)])
107 {
108 (*string)++;
109 }
110
111 if (**string)
112 {
113 **string = 0;
114 (*string)++;
115 }
116
117 return token;
118 }
119
120static unsigned char *ustrsep(char **p,const char *sep)
121 { return (unsigned char *)sstrsep((char **)p,sep); }
122
123static void test1(const EVP_CIPHER *c,const unsigned char *key,int kn,
124 const unsigned char *iv,int in,
125 const unsigned char *plaintext,int pn,
126 const unsigned char *ciphertext,int cn)
127 {
128 EVP_CIPHER_CTX ctx;
129 unsigned char out[4096];
130 int outl,outl2;
131
132 printf("Testing cipher %s\n",EVP_CIPHER_name(c));
133 hexdump(stdout,"Key",key,kn);
134 if(in)
135 hexdump(stdout,"IV",iv,in);
136 hexdump(stdout,"Plaintext",plaintext,pn);
137 hexdump(stdout,"Ciphertext",ciphertext,cn);
138
139 if(kn != c->key_len)
140 {
141 fprintf(stderr,"Key length doesn't match, got %d expected %d\n",kn,
142 c->key_len);
143 exit(5);
144 }
145 EVP_CIPHER_CTX_init(&ctx);
146 if(!EVP_EncryptInit_ex(&ctx,c,NULL,key,iv))
147 {
148 fprintf(stderr,"EncryptInit failed\n");
149 exit(10);
150 }
151 EVP_CIPHER_CTX_set_padding(&ctx,0);
152
153 if(!EVP_EncryptUpdate(&ctx,out,&outl,plaintext,pn))
154 {
155 fprintf(stderr,"Encrypt failed\n");
156 exit(6);
157 }
158 if(!EVP_EncryptFinal_ex(&ctx,out+outl,&outl2))
159 {
160 fprintf(stderr,"EncryptFinal failed\n");
161 exit(7);
162 }
163
164 if(outl+outl2 != cn)
165 {
166 fprintf(stderr,"Ciphertext length mismatch got %d expected %d\n",
167 outl+outl2,cn);
168 exit(8);
169 }
170
171 if(memcmp(out,ciphertext,cn))
172 {
173 fprintf(stderr,"Ciphertext mismatch\n");
174 hexdump(stderr,"Got",out,cn);
175 hexdump(stderr,"Expected",ciphertext,cn);
176 exit(9);
177 }
178
179 if(!EVP_DecryptInit_ex(&ctx,c,NULL,key,iv))
180 {
181 fprintf(stderr,"DecryptInit failed\n");
182 exit(11);
183 }
184 EVP_CIPHER_CTX_set_padding(&ctx,0);
185
186 if(!EVP_DecryptUpdate(&ctx,out,&outl,ciphertext,pn))
187 {
188 fprintf(stderr,"Decrypt failed\n");
189 exit(6);
190 }
191 if(!EVP_DecryptFinal_ex(&ctx,out+outl,&outl2))
192 {
193 fprintf(stderr,"DecryptFinal failed\n");
194 exit(7);
195 }
196
197 if(outl+outl2 != cn)
198 {
199 fprintf(stderr,"Plaintext length mismatch got %d expected %d\n",
200 outl+outl2,cn);
201 exit(8);
202 }
203
204 if(memcmp(out,plaintext,cn))
205 {
206 fprintf(stderr,"Plaintext mismatch\n");
207 hexdump(stderr,"Got",out,cn);
208 hexdump(stderr,"Expected",plaintext,cn);
209 exit(9);
210 }
211
212 printf("\n");
213 }
214
215static int test_cipher(const char *cipher,const unsigned char *key,int kn,
216 const unsigned char *iv,int in,
217 const unsigned char *plaintext,int pn,
218 const unsigned char *ciphertext,int cn)
219 {
220 const EVP_CIPHER *c;
221
222 c=EVP_get_cipherbyname(cipher);
223 if(!c)
224 return 0;
225
226 test1(c,key,kn,iv,in,plaintext,pn,ciphertext,cn);
227
228 return 1;
229 }
230
231static int test_digest(const char *digest,
232 const unsigned char *plaintext,int pn,
233 const unsigned char *ciphertext, unsigned int cn)
234 {
235 const EVP_MD *d;
236 EVP_MD_CTX ctx;
237 unsigned char md[EVP_MAX_MD_SIZE];
238 unsigned int mdn;
239
240 d=EVP_get_digestbyname(digest);
241 if(!d)
242 return 0;
243
244 printf("Testing digest %s\n",EVP_MD_name(d));
245 hexdump(stdout,"Plaintext",plaintext,pn);
246 hexdump(stdout,"Digest",ciphertext,cn);
247
248 EVP_MD_CTX_init(&ctx);
249 if(!EVP_DigestInit_ex(&ctx,d, NULL))
250 {
251 fprintf(stderr,"DigestInit failed\n");
252 exit(100);
253 }
254 if(!EVP_DigestUpdate(&ctx,plaintext,pn))
255 {
256 fprintf(stderr,"DigestUpdate failed\n");
257 exit(101);
258 }
259 if(!EVP_DigestFinal_ex(&ctx,md,&mdn))
260 {
261 fprintf(stderr,"DigestFinal failed\n");
262 exit(101);
263 }
264 EVP_MD_CTX_cleanup(&ctx);
265
266 if(mdn != cn)
267 {
268 fprintf(stderr,"Digest length mismatch, got %d expected %d\n",mdn,cn);
269 exit(102);
270 }
271
272 if(memcmp(md,ciphertext,cn))
273 {
274 fprintf(stderr,"Digest mismatch\n");
275 hexdump(stderr,"Got",md,cn);
276 hexdump(stderr,"Expected",ciphertext,cn);
277 exit(103);
278 }
279
280 printf("\n");
281
282 return 1;
283 }
284
285int main(int argc,char **argv)
286 {
287 const char *szTestFile;
288 FILE *f;
289
290 if(argc != 2)
291 {
292 fprintf(stderr,"%s <test file>\n",argv[0]);
293 exit(1);
294 }
295 CRYPTO_malloc_debug_init();
296 CRYPTO_set_mem_debug_options(V_CRYPTO_MDEBUG_ALL);
297 CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ON);
298
299 szTestFile=argv[1];
300
301 f=fopen(szTestFile,"r");
302 if(!f)
303 {
304 perror(szTestFile);
305 exit(2);
306 }
307
308 /* Load up the software EVP_CIPHER and EVP_MD definitions */
309 OpenSSL_add_all_ciphers();
310 OpenSSL_add_all_digests();
311 /* Load all compiled-in ENGINEs */
312 ENGINE_load_builtin_engines();
313#if 0
314 OPENSSL_config();
315#endif
316 /* Register all available ENGINE implementations of ciphers and digests.
317 * This could perhaps be changed to "ENGINE_register_all_complete()"? */
318 ENGINE_register_all_ciphers();
319 ENGINE_register_all_digests();
320 /* If we add command-line options, this statement should be switchable.
321 * It'll prevent ENGINEs being ENGINE_init()ialised for cipher/digest use if
322 * they weren't already initialised. */
323 /* ENGINE_set_cipher_flags(ENGINE_CIPHER_FLAG_NOINIT); */
324
325 for( ; ; )
326 {
327 char line[4096];
328 char *p;
329 char *cipher;
330 unsigned char *iv,*key,*plaintext,*ciphertext;
331 int kn,in,pn,cn;
332
333 if(!fgets((char *)line,sizeof line,f))
334 break;
335 if(line[0] == '#' || line[0] == '\n')
336 continue;
337 p=line;
338 cipher=sstrsep(&p,":");
339 key=ustrsep(&p,":");
340 iv=ustrsep(&p,":");
341 plaintext=ustrsep(&p,":");
342 ciphertext=ustrsep(&p,"\n");
343
344 kn=convert(key);
345 in=convert(iv);
346 pn=convert(plaintext);
347 cn=convert(ciphertext);
348
349 if(!test_cipher(cipher,key,kn,iv,in,plaintext,pn,ciphertext,cn)
350 && !test_digest(cipher,plaintext,pn,ciphertext,cn))
351 {
352 fprintf(stderr,"Can't find %s\n",cipher);
353 exit(3);
354 }
355 }
356
357 ENGINE_cleanup();
358 EVP_cleanup();
359 CRYPTO_cleanup_all_ex_data();
360 ERR_remove_state(0);
361 ERR_free_strings();
362 CRYPTO_mem_leaks_fp(stderr);
363
364 return 0;
365 }
diff --git a/src/lib/libcrypto/evp/evptests.txt b/src/lib/libcrypto/evp/evptests.txt
new file mode 100644
index 0000000000..6c1529db37
--- /dev/null
+++ b/src/lib/libcrypto/evp/evptests.txt
@@ -0,0 +1,82 @@
1#cipher:key:iv:input:output
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
19
20# AES 192 ECB tests (from FIPS-197 test vectors, encrypt)
21
22AES-192-ECB:000102030405060708090A0B0C0D0E0F1011121314151617::00112233445566778899AABBCCDDEEFF:DDA97CA4864CDFE06EAF70A0EC0D7191
23
24# AES 256 ECB tests (from FIPS-197 test vectors, encrypt)
25
26AES-256-ECB:000102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1F::00112233445566778899AABBCCDDEEFF:8EA2B7CA516745BFEAFC49904B496089
27
28# AES 128 ECB tests (from NIST test vectors, encrypt)
29
30#AES-128-ECB:00000000000000000000000000000000::00000000000000000000000000000000:C34C052CC0DA8D73451AFE5F03BE297F
31
32# AES 128 ECB tests (from NIST test vectors, decrypt)
33
34#AES-128-ECB:00000000000000000000000000000000::44416AC2D1F53C583303917E6BE9EBE0:00000000000000000000000000000000
35
36# AES 192 ECB tests (from NIST test vectors, decrypt)
37
38#AES-192-ECB:000000000000000000000000000000000000000000000000::48E31E9E256718F29229319C19F15BA4:00000000000000000000000000000000
39
40# AES 256 ECB tests (from NIST test vectors, decrypt)
41
42#AES-256-ECB:0000000000000000000000000000000000000000000000000000000000000000::058CCFFDBBCB382D1F6F56585D8A4ADE:00000000000000000000000000000000
43
44# AES 128 CBC tests (from NIST test vectors, encrypt)
45
46#AES-128-CBC:00000000000000000000000000000000:00000000000000000000000000000000:00000000000000000000000000000000:8A05FC5E095AF4848A08D328D3688E3D
47
48# AES 192 CBC tests (from NIST test vectors, encrypt)
49
50#AES-192-CBC:000000000000000000000000000000000000000000000000:00000000000000000000000000000000:00000000000000000000000000000000:7BD966D53AD8C1BB85D2ADFAE87BB104
51
52# AES 256 CBC tests (from NIST test vectors, encrypt)
53
54#AES-256-CBC:0000000000000000000000000000000000000000000000000000000000000000:00000000000000000000000000000000:00000000000000000000000000000000:FE3C53653E2F45B56FCD88B2CC898FF0
55
56# AES 128 CBC tests (from NIST test vectors, decrypt)
57
58#AES-128-CBC:00000000000000000000000000000000:00000000000000000000000000000000:FACA37E0B0C85373DF706E73F7C9AF86:00000000000000000000000000000000
59
60# DES ECB tests (from destest)
61
62DES-ECB:0000000000000000::0000000000000000:8CA64DE9C1B123A7
63DES-ECB:FFFFFFFFFFFFFFFF::FFFFFFFFFFFFFFFF:7359B2163E4EDC58
64DES-ECB:3000000000000000::1000000000000001:958E6E627A05557B
65DES-ECB:1111111111111111::1111111111111111:F40379AB9E0EC533
66DES-ECB:0123456789ABCDEF::1111111111111111:17668DFC7292532D
67DES-ECB:1111111111111111::0123456789ABCDEF:8A5AE1F81AB8F2DD
68DES-ECB:FEDCBA9876543210::0123456789ABCDEF:ED39D950FA74BCC4
69
70# DESX-CBC tests (from destest)
71DESX-CBC:0123456789abcdeff1e0d3c2b5a49786fedcba9876543210:fedcba9876543210:37363534333231204E6F77206973207468652074696D6520666F722000000000:846B2914851E9A2954732F8AA0A611C115CDC2D7951B1053A63C5E03B21AA3C4
72
73# DES EDE3 CBC tests (from destest)
74DES-EDE3-CBC:0123456789abcdeff1e0d3c2b5a49786fedcba9876543210:fedcba9876543210:37363534333231204E6F77206973207468652074696D6520666F722000000000:3FE301C962AC01D02213763C1CBD4CDC799657C064ECF5D41C673812CFDE9675
75
76# RC4 tests (from rc4test)
77RC4:0123456789abcdef0123456789abcdef::0123456789abcdef:75b7878099e0c596
78RC4:0123456789abcdef0123456789abcdef::0000000000000000:7494c2e7104b0879
79RC4:00000000000000000000000000000000::0000000000000000:de188941a3375d3a
80RC4:ef012345ef012345ef012345ef012345::0000000000000000000000000000000000000000:d6a141a7ec3c38dfbd615a1162e1c7ba36b67858
81RC4:0123456789abcdef0123456789abcdef::123456789ABCDEF0123456789ABCDEF0123456789ABCDEF012345678:66a0949f8af7d6891f7f832ba833c00c892ebe30143ce28740011ecf
82RC4:ef012345ef012345ef012345ef012345::00000000000000000000:d6a141a7ec3c38dfbd61
diff --git a/src/lib/libcrypto/evp/m_dss.c b/src/lib/libcrypto/evp/m_dss.c
index 8ea826868e..beb8d7fc5c 100644
--- a/src/lib/libcrypto/evp/m_dss.c
+++ b/src/lib/libcrypto/evp/m_dss.c
@@ -62,21 +62,33 @@
62#include <openssl/objects.h> 62#include <openssl/objects.h>
63#include <openssl/x509.h> 63#include <openssl/x509.h>
64 64
65#ifndef NO_SHA 65#ifndef OPENSSL_NO_SHA
66static EVP_MD dsa_md= 66static int init(EVP_MD_CTX *ctx)
67 { return SHA1_Init(ctx->md_data); }
68
69static int update(EVP_MD_CTX *ctx,const void *data,unsigned long count)
70 { return SHA1_Update(ctx->md_data,data,count); }
71
72static int final(EVP_MD_CTX *ctx,unsigned char *md)
73 { return SHA1_Final(md,ctx->md_data); }
74
75static const EVP_MD dsa_md=
67 { 76 {
68 NID_dsaWithSHA, 77 NID_dsaWithSHA,
69 NID_dsaWithSHA, 78 NID_dsaWithSHA,
70 SHA_DIGEST_LENGTH, 79 SHA_DIGEST_LENGTH,
71 SHA1_Init, 80 0,
72 SHA1_Update, 81 init,
73 SHA1_Final, 82 update,
83 final,
84 NULL,
85 NULL,
74 EVP_PKEY_DSA_method, 86 EVP_PKEY_DSA_method,
75 SHA_CBLOCK, 87 SHA_CBLOCK,
76 sizeof(EVP_MD *)+sizeof(SHA_CTX), 88 sizeof(EVP_MD *)+sizeof(SHA_CTX),
77 }; 89 };
78 90
79EVP_MD *EVP_dss(void) 91const EVP_MD *EVP_dss(void)
80 { 92 {
81 return(&dsa_md); 93 return(&dsa_md);
82 } 94 }
diff --git a/src/lib/libcrypto/evp/m_dss1.c b/src/lib/libcrypto/evp/m_dss1.c
index 9d8d1ce23e..f5668ebda0 100644
--- a/src/lib/libcrypto/evp/m_dss1.c
+++ b/src/lib/libcrypto/evp/m_dss1.c
@@ -56,27 +56,39 @@
56 * [including the GNU Public Licence.] 56 * [including the GNU Public Licence.]
57 */ 57 */
58 58
59#ifndef NO_SHA 59#ifndef OPENSSL_NO_SHA
60#include <stdio.h> 60#include <stdio.h>
61#include "cryptlib.h" 61#include "cryptlib.h"
62#include <openssl/evp.h> 62#include <openssl/evp.h>
63#include <openssl/objects.h> 63#include <openssl/objects.h>
64#include <openssl/x509.h> 64#include <openssl/x509.h>
65 65
66static EVP_MD dss1_md= 66static int init(EVP_MD_CTX *ctx)
67 { return SHA1_Init(ctx->md_data); }
68
69static int update(EVP_MD_CTX *ctx,const void *data,unsigned long count)
70 { return SHA1_Update(ctx->md_data,data,count); }
71
72static int final(EVP_MD_CTX *ctx,unsigned char *md)
73 { return SHA1_Final(md,ctx->md_data); }
74
75static const EVP_MD dss1_md=
67 { 76 {
68 NID_dsa, 77 NID_dsa,
69 NID_dsaWithSHA1, 78 NID_dsaWithSHA1,
70 SHA_DIGEST_LENGTH, 79 SHA_DIGEST_LENGTH,
71 SHA1_Init, 80 0,
72 SHA1_Update, 81 init,
73 SHA1_Final, 82 update,
83 final,
84 NULL,
85 NULL,
74 EVP_PKEY_DSA_method, 86 EVP_PKEY_DSA_method,
75 SHA_CBLOCK, 87 SHA_CBLOCK,
76 sizeof(EVP_MD *)+sizeof(SHA_CTX), 88 sizeof(EVP_MD *)+sizeof(SHA_CTX),
77 }; 89 };
78 90
79EVP_MD *EVP_dss1(void) 91const EVP_MD *EVP_dss1(void)
80 { 92 {
81 return(&dss1_md); 93 return(&dss1_md);
82 } 94 }
diff --git a/src/lib/libcrypto/evp/m_md2.c b/src/lib/libcrypto/evp/m_md2.c
index 3281e91809..50914c83b3 100644
--- a/src/lib/libcrypto/evp/m_md2.c
+++ b/src/lib/libcrypto/evp/m_md2.c
@@ -56,27 +56,40 @@
56 * [including the GNU Public Licence.] 56 * [including the GNU Public Licence.]
57 */ 57 */
58 58
59#ifndef NO_MD2 59#ifndef OPENSSL_NO_MD2
60#include <stdio.h> 60#include <stdio.h>
61#include "cryptlib.h" 61#include "cryptlib.h"
62#include <openssl/evp.h> 62#include <openssl/evp.h>
63#include <openssl/objects.h> 63#include <openssl/objects.h>
64#include <openssl/x509.h> 64#include <openssl/x509.h>
65#include <openssl/md2.h>
65 66
66static EVP_MD md2_md= 67static int init(EVP_MD_CTX *ctx)
68 { return MD2_Init(ctx->md_data); }
69
70static int update(EVP_MD_CTX *ctx,const void *data,unsigned long count)
71 { return MD2_Update(ctx->md_data,data,count); }
72
73static int final(EVP_MD_CTX *ctx,unsigned char *md)
74 { return MD2_Final(md,ctx->md_data); }
75
76static const EVP_MD md2_md=
67 { 77 {
68 NID_md2, 78 NID_md2,
69 NID_md2WithRSAEncryption, 79 NID_md2WithRSAEncryption,
70 MD2_DIGEST_LENGTH, 80 MD2_DIGEST_LENGTH,
71 MD2_Init, 81 0,
72 MD2_Update, 82 init,
73 MD2_Final, 83 update,
84 final,
85 NULL,
86 NULL,
74 EVP_PKEY_RSA_method, 87 EVP_PKEY_RSA_method,
75 MD2_BLOCK, 88 MD2_BLOCK,
76 sizeof(EVP_MD *)+sizeof(MD2_CTX), 89 sizeof(EVP_MD *)+sizeof(MD2_CTX),
77 }; 90 };
78 91
79EVP_MD *EVP_md2(void) 92const EVP_MD *EVP_md2(void)
80 { 93 {
81 return(&md2_md); 94 return(&md2_md);
82 } 95 }
diff --git a/src/lib/libcrypto/evp/m_md4.c b/src/lib/libcrypto/evp/m_md4.c
index 6a24ceb86d..e19b663754 100644
--- a/src/lib/libcrypto/evp/m_md4.c
+++ b/src/lib/libcrypto/evp/m_md4.c
@@ -56,27 +56,40 @@
56 * [including the GNU Public Licence.] 56 * [including the GNU Public Licence.]
57 */ 57 */
58 58
59#ifndef NO_MD4 59#ifndef OPENSSL_NO_MD4
60#include <stdio.h> 60#include <stdio.h>
61#include "cryptlib.h" 61#include "cryptlib.h"
62#include <openssl/evp.h> 62#include <openssl/evp.h>
63#include <openssl/objects.h> 63#include <openssl/objects.h>
64#include <openssl/x509.h> 64#include <openssl/x509.h>
65#include <openssl/md4.h>
65 66
66static EVP_MD md4_md= 67static int init(EVP_MD_CTX *ctx)
68 { return MD4_Init(ctx->md_data); }
69
70static int update(EVP_MD_CTX *ctx,const void *data,unsigned long count)
71 { return MD4_Update(ctx->md_data,data,count); }
72
73static int final(EVP_MD_CTX *ctx,unsigned char *md)
74 { return MD4_Final(md,ctx->md_data); }
75
76static const EVP_MD md4_md=
67 { 77 {
68 NID_md4, 78 NID_md4,
69 0, 79 NID_md4WithRSAEncryption,
70 MD4_DIGEST_LENGTH, 80 MD4_DIGEST_LENGTH,
71 MD4_Init, 81 0,
72 MD4_Update, 82 init,
73 MD4_Final, 83 update,
84 final,
85 NULL,
86 NULL,
74 EVP_PKEY_RSA_method, 87 EVP_PKEY_RSA_method,
75 MD4_CBLOCK, 88 MD4_CBLOCK,
76 sizeof(EVP_MD *)+sizeof(MD4_CTX), 89 sizeof(EVP_MD *)+sizeof(MD4_CTX),
77 }; 90 };
78 91
79EVP_MD *EVP_md4(void) 92const EVP_MD *EVP_md4(void)
80 { 93 {
81 return(&md4_md); 94 return(&md4_md);
82 } 95 }
diff --git a/src/lib/libcrypto/evp/m_md5.c b/src/lib/libcrypto/evp/m_md5.c
index 9fc9530127..b00a03e048 100644
--- a/src/lib/libcrypto/evp/m_md5.c
+++ b/src/lib/libcrypto/evp/m_md5.c
@@ -56,27 +56,40 @@
56 * [including the GNU Public Licence.] 56 * [including the GNU Public Licence.]
57 */ 57 */
58 58
59#ifndef NO_MD5 59#ifndef OPENSSL_NO_MD5
60#include <stdio.h> 60#include <stdio.h>
61#include "cryptlib.h" 61#include "cryptlib.h"
62#include <openssl/evp.h> 62#include <openssl/evp.h>
63#include <openssl/objects.h> 63#include <openssl/objects.h>
64#include <openssl/x509.h> 64#include <openssl/x509.h>
65#include <openssl/md5.h>
65 66
66static EVP_MD md5_md= 67static int init(EVP_MD_CTX *ctx)
68 { return MD5_Init(ctx->md_data); }
69
70static int update(EVP_MD_CTX *ctx,const void *data,unsigned long count)
71 { return MD5_Update(ctx->md_data,data,count); }
72
73static int final(EVP_MD_CTX *ctx,unsigned char *md)
74 { return MD5_Final(md,ctx->md_data); }
75
76static const EVP_MD md5_md=
67 { 77 {
68 NID_md5, 78 NID_md5,
69 NID_md5WithRSAEncryption, 79 NID_md5WithRSAEncryption,
70 MD5_DIGEST_LENGTH, 80 MD5_DIGEST_LENGTH,
71 MD5_Init, 81 0,
72 MD5_Update, 82 init,
73 MD5_Final, 83 update,
84 final,
85 NULL,
86 NULL,
74 EVP_PKEY_RSA_method, 87 EVP_PKEY_RSA_method,
75 MD5_CBLOCK, 88 MD5_CBLOCK,
76 sizeof(EVP_MD *)+sizeof(MD5_CTX), 89 sizeof(EVP_MD *)+sizeof(MD5_CTX),
77 }; 90 };
78 91
79EVP_MD *EVP_md5(void) 92const EVP_MD *EVP_md5(void)
80 { 93 {
81 return(&md5_md); 94 return(&md5_md);
82 } 95 }
diff --git a/src/lib/libcrypto/evp/m_mdc2.c b/src/lib/libcrypto/evp/m_mdc2.c
index 2c7f1ae515..9f6467c931 100644
--- a/src/lib/libcrypto/evp/m_mdc2.c
+++ b/src/lib/libcrypto/evp/m_mdc2.c
@@ -56,27 +56,40 @@
56 * [including the GNU Public Licence.] 56 * [including the GNU Public Licence.]
57 */ 57 */
58 58
59#ifndef NO_MDC2 59#ifndef OPENSSL_NO_MDC2
60#include <stdio.h> 60#include <stdio.h>
61#include "cryptlib.h" 61#include "cryptlib.h"
62#include <openssl/evp.h> 62#include <openssl/evp.h>
63#include <openssl/objects.h> 63#include <openssl/objects.h>
64#include <openssl/x509.h> 64#include <openssl/x509.h>
65#include <openssl/mdc2.h>
65 66
66static EVP_MD mdc2_md= 67static int init(EVP_MD_CTX *ctx)
68 { return MDC2_Init(ctx->md_data); }
69
70static int update(EVP_MD_CTX *ctx,const void *data,unsigned long count)
71 { return MDC2_Update(ctx->md_data,data,count); }
72
73static int final(EVP_MD_CTX *ctx,unsigned char *md)
74 { return MDC2_Final(md,ctx->md_data); }
75
76static const EVP_MD mdc2_md=
67 { 77 {
68 NID_mdc2, 78 NID_mdc2,
69 NID_mdc2WithRSA, 79 NID_mdc2WithRSA,
70 MDC2_DIGEST_LENGTH, 80 MDC2_DIGEST_LENGTH,
71 MDC2_Init, 81 0,
72 MDC2_Update, 82 init,
73 MDC2_Final, 83 update,
84 final,
85 NULL,
86 NULL,
74 EVP_PKEY_RSA_ASN1_OCTET_STRING_method, 87 EVP_PKEY_RSA_ASN1_OCTET_STRING_method,
75 MDC2_BLOCK, 88 MDC2_BLOCK,
76 sizeof(EVP_MD *)+sizeof(MDC2_CTX), 89 sizeof(EVP_MD *)+sizeof(MDC2_CTX),
77 }; 90 };
78 91
79EVP_MD *EVP_mdc2(void) 92const EVP_MD *EVP_mdc2(void)
80 { 93 {
81 return(&mdc2_md); 94 return(&mdc2_md);
82 } 95 }
diff --git a/src/lib/libcrypto/evp/m_null.c b/src/lib/libcrypto/evp/m_null.c
index e2dadf3dab..f6f0a1d2c0 100644
--- a/src/lib/libcrypto/evp/m_null.c
+++ b/src/lib/libcrypto/evp/m_null.c
@@ -62,25 +62,32 @@
62#include <openssl/objects.h> 62#include <openssl/objects.h>
63#include <openssl/x509.h> 63#include <openssl/x509.h>
64 64
65static void function(void) 65static int init(EVP_MD_CTX *ctx)
66 { 66 { return 1; }
67 } 67
68static int update(EVP_MD_CTX *ctx,const void *data,unsigned long count)
69 { return 1; }
68 70
69static EVP_MD null_md= 71static int final(EVP_MD_CTX *ctx,unsigned char *md)
72 { return 1; }
73
74static const EVP_MD null_md=
70 { 75 {
71 NID_undef, 76 NID_undef,
72 NID_undef, 77 NID_undef,
73 0, 78 0,
74 function, 79 0,
75 function, 80 init,
76 function, 81 update,
77 82 final,
83 NULL,
84 NULL,
78 EVP_PKEY_NULL_method, 85 EVP_PKEY_NULL_method,
79 0, 86 0,
80 sizeof(EVP_MD *), 87 sizeof(EVP_MD *),
81 }; 88 };
82 89
83EVP_MD *EVP_md_null(void) 90const EVP_MD *EVP_md_null(void)
84 { 91 {
85 return(&null_md); 92 return(&null_md);
86 } 93 }
diff --git a/src/lib/libcrypto/evp/m_ripemd.c b/src/lib/libcrypto/evp/m_ripemd.c
index 3d781a4e8d..64725528dc 100644
--- a/src/lib/libcrypto/evp/m_ripemd.c
+++ b/src/lib/libcrypto/evp/m_ripemd.c
@@ -56,7 +56,7 @@
56 * [including the GNU Public Licence.] 56 * [including the GNU Public Licence.]
57 */ 57 */
58 58
59#ifndef NO_RIPEMD 59#ifndef OPENSSL_NO_RIPEMD
60#include <stdio.h> 60#include <stdio.h>
61#include "cryptlib.h" 61#include "cryptlib.h"
62#include <openssl/ripemd.h> 62#include <openssl/ripemd.h>
@@ -64,20 +64,32 @@
64#include <openssl/objects.h> 64#include <openssl/objects.h>
65#include <openssl/x509.h> 65#include <openssl/x509.h>
66 66
67static EVP_MD ripemd160_md= 67static int init(EVP_MD_CTX *ctx)
68 { return RIPEMD160_Init(ctx->md_data); }
69
70static int update(EVP_MD_CTX *ctx,const void *data,unsigned long count)
71 { return RIPEMD160_Update(ctx->md_data,data,count); }
72
73static int final(EVP_MD_CTX *ctx,unsigned char *md)
74 { return RIPEMD160_Final(md,ctx->md_data); }
75
76static const EVP_MD ripemd160_md=
68 { 77 {
69 NID_ripemd160, 78 NID_ripemd160,
70 NID_ripemd160WithRSA, 79 NID_ripemd160WithRSA,
71 RIPEMD160_DIGEST_LENGTH, 80 RIPEMD160_DIGEST_LENGTH,
72 RIPEMD160_Init, 81 0,
73 RIPEMD160_Update, 82 init,
74 RIPEMD160_Final, 83 update,
84 final,
85 NULL,
86 NULL,
75 EVP_PKEY_RSA_method, 87 EVP_PKEY_RSA_method,
76 RIPEMD160_CBLOCK, 88 RIPEMD160_CBLOCK,
77 sizeof(EVP_MD *)+sizeof(RIPEMD160_CTX), 89 sizeof(EVP_MD *)+sizeof(RIPEMD160_CTX),
78 }; 90 };
79 91
80EVP_MD *EVP_ripemd160(void) 92const EVP_MD *EVP_ripemd160(void)
81 { 93 {
82 return(&ripemd160_md); 94 return(&ripemd160_md);
83 } 95 }
diff --git a/src/lib/libcrypto/evp/m_sha.c b/src/lib/libcrypto/evp/m_sha.c
index 6d35b71b85..10697c7ed3 100644
--- a/src/lib/libcrypto/evp/m_sha.c
+++ b/src/lib/libcrypto/evp/m_sha.c
@@ -56,27 +56,39 @@
56 * [including the GNU Public Licence.] 56 * [including the GNU Public Licence.]
57 */ 57 */
58 58
59#ifndef NO_SHA 59#ifndef OPENSSL_NO_SHA
60#include <stdio.h> 60#include <stdio.h>
61#include "cryptlib.h" 61#include "cryptlib.h"
62#include <openssl/evp.h> 62#include <openssl/evp.h>
63#include <openssl/objects.h> 63#include <openssl/objects.h>
64#include <openssl/x509.h> 64#include <openssl/x509.h>
65 65
66static EVP_MD sha_md= 66static int init(EVP_MD_CTX *ctx)
67 { return SHA_Init(ctx->md_data); }
68
69static int update(EVP_MD_CTX *ctx,const void *data,unsigned long count)
70 { return SHA_Update(ctx->md_data,data,count); }
71
72static int final(EVP_MD_CTX *ctx,unsigned char *md)
73 { return SHA_Final(md,ctx->md_data); }
74
75static const EVP_MD sha_md=
67 { 76 {
68 NID_sha, 77 NID_sha,
69 NID_shaWithRSAEncryption, 78 NID_shaWithRSAEncryption,
70 SHA_DIGEST_LENGTH, 79 SHA_DIGEST_LENGTH,
71 SHA_Init, 80 0,
72 SHA_Update, 81 init,
73 SHA_Final, 82 update,
83 final,
84 NULL,
85 NULL,
74 EVP_PKEY_RSA_method, 86 EVP_PKEY_RSA_method,
75 SHA_CBLOCK, 87 SHA_CBLOCK,
76 sizeof(EVP_MD *)+sizeof(SHA_CTX), 88 sizeof(EVP_MD *)+sizeof(SHA_CTX),
77 }; 89 };
78 90
79EVP_MD *EVP_sha(void) 91const EVP_MD *EVP_sha(void)
80 { 92 {
81 return(&sha_md); 93 return(&sha_md);
82 } 94 }
diff --git a/src/lib/libcrypto/evp/m_sha1.c b/src/lib/libcrypto/evp/m_sha1.c
index 57a1ab0cce..d6be3502f0 100644
--- a/src/lib/libcrypto/evp/m_sha1.c
+++ b/src/lib/libcrypto/evp/m_sha1.c
@@ -56,27 +56,39 @@
56 * [including the GNU Public Licence.] 56 * [including the GNU Public Licence.]
57 */ 57 */
58 58
59#ifndef NO_SHA 59#ifndef OPENSSL_NO_SHA
60#include <stdio.h> 60#include <stdio.h>
61#include "cryptlib.h" 61#include "cryptlib.h"
62#include <openssl/evp.h> 62#include <openssl/evp.h>
63#include <openssl/objects.h> 63#include <openssl/objects.h>
64#include <openssl/x509.h> 64#include <openssl/x509.h>
65 65
66static EVP_MD sha1_md= 66static int init(EVP_MD_CTX *ctx)
67 { return SHA1_Init(ctx->md_data); }
68
69static int update(EVP_MD_CTX *ctx,const void *data,unsigned long count)
70 { return SHA1_Update(ctx->md_data,data,count); }
71
72static int final(EVP_MD_CTX *ctx,unsigned char *md)
73 { return SHA1_Final(md,ctx->md_data); }
74
75static const EVP_MD sha1_md=
67 { 76 {
68 NID_sha1, 77 NID_sha1,
69 NID_sha1WithRSAEncryption, 78 NID_sha1WithRSAEncryption,
70 SHA_DIGEST_LENGTH, 79 SHA_DIGEST_LENGTH,
71 SHA1_Init, 80 0,
72 SHA1_Update, 81 init,
73 SHA1_Final, 82 update,
83 final,
84 NULL,
85 NULL,
74 EVP_PKEY_RSA_method, 86 EVP_PKEY_RSA_method,
75 SHA_CBLOCK, 87 SHA_CBLOCK,
76 sizeof(EVP_MD *)+sizeof(SHA_CTX), 88 sizeof(EVP_MD *)+sizeof(SHA_CTX),
77 }; 89 };
78 90
79EVP_MD *EVP_sha1(void) 91const EVP_MD *EVP_sha1(void)
80 { 92 {
81 return(&sha1_md); 93 return(&sha1_md);
82 } 94 }
diff --git a/src/lib/libcrypto/evp/names.c b/src/lib/libcrypto/evp/names.c
index 620f43feaa..eb9f4329cd 100644
--- a/src/lib/libcrypto/evp/names.c
+++ b/src/lib/libcrypto/evp/names.c
@@ -62,7 +62,7 @@
62#include <openssl/objects.h> 62#include <openssl/objects.h>
63#include <openssl/x509.h> 63#include <openssl/x509.h>
64 64
65int EVP_add_cipher(EVP_CIPHER *c) 65int EVP_add_cipher(const EVP_CIPHER *c)
66 { 66 {
67 int r; 67 int r;
68 68
@@ -72,7 +72,7 @@ int EVP_add_cipher(EVP_CIPHER *c)
72 return(r); 72 return(r);
73 } 73 }
74 74
75int EVP_add_digest(EVP_MD *md) 75int EVP_add_digest(const EVP_MD *md)
76 { 76 {
77 int r; 77 int r;
78 const char *name; 78 const char *name;
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/p5_crpt.c b/src/lib/libcrypto/evp/p5_crpt.c
index 6bfa2c5acb..113c60fedb 100644
--- a/src/lib/libcrypto/evp/p5_crpt.c
+++ b/src/lib/libcrypto/evp/p5_crpt.c
@@ -67,41 +67,41 @@
67 67
68void PKCS5_PBE_add(void) 68void PKCS5_PBE_add(void)
69{ 69{
70#ifndef NO_DES 70#ifndef OPENSSL_NO_DES
71# ifndef NO_MD5 71# ifndef OPENSSL_NO_MD5
72EVP_PBE_alg_add(NID_pbeWithMD5AndDES_CBC, EVP_des_cbc(), EVP_md5(), 72EVP_PBE_alg_add(NID_pbeWithMD5AndDES_CBC, EVP_des_cbc(), EVP_md5(),
73 PKCS5_PBE_keyivgen); 73 PKCS5_PBE_keyivgen);
74# endif 74# endif
75# ifndef NO_MD2 75# ifndef OPENSSL_NO_MD2
76EVP_PBE_alg_add(NID_pbeWithMD2AndDES_CBC, EVP_des_cbc(), EVP_md2(), 76EVP_PBE_alg_add(NID_pbeWithMD2AndDES_CBC, EVP_des_cbc(), EVP_md2(),
77 PKCS5_PBE_keyivgen); 77 PKCS5_PBE_keyivgen);
78# endif 78# endif
79# ifndef NO_SHA 79# ifndef OPENSSL_NO_SHA
80EVP_PBE_alg_add(NID_pbeWithSHA1AndDES_CBC, EVP_des_cbc(), EVP_sha1(), 80EVP_PBE_alg_add(NID_pbeWithSHA1AndDES_CBC, EVP_des_cbc(), EVP_sha1(),
81 PKCS5_PBE_keyivgen); 81 PKCS5_PBE_keyivgen);
82# endif 82# endif
83#endif 83#endif
84#ifndef NO_RC2 84#ifndef OPENSSL_NO_RC2
85# ifndef NO_MD5 85# ifndef OPENSSL_NO_MD5
86EVP_PBE_alg_add(NID_pbeWithMD5AndRC2_CBC, EVP_rc2_64_cbc(), EVP_md5(), 86EVP_PBE_alg_add(NID_pbeWithMD5AndRC2_CBC, EVP_rc2_64_cbc(), EVP_md5(),
87 PKCS5_PBE_keyivgen); 87 PKCS5_PBE_keyivgen);
88# endif 88# endif
89# ifndef NO_MD2 89# ifndef OPENSSL_NO_MD2
90EVP_PBE_alg_add(NID_pbeWithMD2AndRC2_CBC, EVP_rc2_64_cbc(), EVP_md2(), 90EVP_PBE_alg_add(NID_pbeWithMD2AndRC2_CBC, EVP_rc2_64_cbc(), EVP_md2(),
91 PKCS5_PBE_keyivgen); 91 PKCS5_PBE_keyivgen);
92# endif 92# endif
93# ifndef NO_SHA 93# ifndef OPENSSL_NO_SHA
94EVP_PBE_alg_add(NID_pbeWithSHA1AndRC2_CBC, EVP_rc2_64_cbc(), EVP_sha1(), 94EVP_PBE_alg_add(NID_pbeWithSHA1AndRC2_CBC, EVP_rc2_64_cbc(), EVP_sha1(),
95 PKCS5_PBE_keyivgen); 95 PKCS5_PBE_keyivgen);
96# endif 96# endif
97#endif 97#endif
98#ifndef NO_HMAC 98#ifndef OPENSSL_NO_HMAC
99EVP_PBE_alg_add(NID_pbes2, NULL, NULL, PKCS5_v2_PBE_keyivgen); 99EVP_PBE_alg_add(NID_pbes2, NULL, NULL, PKCS5_v2_PBE_keyivgen);
100#endif 100#endif
101} 101}
102 102
103int PKCS5_PBE_keyivgen(EVP_CIPHER_CTX *cctx, const char *pass, int passlen, 103int PKCS5_PBE_keyivgen(EVP_CIPHER_CTX *cctx, const char *pass, int passlen,
104 ASN1_TYPE *param, EVP_CIPHER *cipher, EVP_MD *md, 104 ASN1_TYPE *param, const EVP_CIPHER *cipher, const EVP_MD *md,
105 int en_de) 105 int en_de)
106{ 106{
107 EVP_MD_CTX ctx; 107 EVP_MD_CTX ctx;
@@ -128,20 +128,22 @@ int PKCS5_PBE_keyivgen(EVP_CIPHER_CTX *cctx, const char *pass, int passlen,
128 if(!pass) passlen = 0; 128 if(!pass) passlen = 0;
129 else if(passlen == -1) passlen = strlen(pass); 129 else if(passlen == -1) passlen = strlen(pass);
130 130
131 EVP_DigestInit (&ctx, md); 131 EVP_MD_CTX_init(&ctx);
132 EVP_DigestUpdate (&ctx, pass, passlen); 132 EVP_DigestInit_ex(&ctx, md, NULL);
133 EVP_DigestUpdate (&ctx, salt, saltlen); 133 EVP_DigestUpdate(&ctx, pass, passlen);
134 EVP_DigestUpdate(&ctx, salt, saltlen);
134 PBEPARAM_free(pbe); 135 PBEPARAM_free(pbe);
135 EVP_DigestFinal (&ctx, md_tmp, NULL); 136 EVP_DigestFinal_ex(&ctx, md_tmp, NULL);
136 for (i = 1; i < iter; i++) { 137 for (i = 1; i < iter; i++) {
137 EVP_DigestInit(&ctx, md); 138 EVP_DigestInit_ex(&ctx, md, NULL);
138 EVP_DigestUpdate(&ctx, md_tmp, EVP_MD_size(md)); 139 EVP_DigestUpdate(&ctx, md_tmp, EVP_MD_size(md));
139 EVP_DigestFinal (&ctx, md_tmp, NULL); 140 EVP_DigestFinal_ex (&ctx, md_tmp, NULL);
140 } 141 }
141 memcpy (key, md_tmp, EVP_CIPHER_key_length(cipher)); 142 EVP_MD_CTX_cleanup(&ctx);
142 memcpy (iv, md_tmp + (16 - EVP_CIPHER_iv_length(cipher)), 143 memcpy(key, md_tmp, EVP_CIPHER_key_length(cipher));
144 memcpy(iv, md_tmp + (16 - EVP_CIPHER_iv_length(cipher)),
143 EVP_CIPHER_iv_length(cipher)); 145 EVP_CIPHER_iv_length(cipher));
144 EVP_CipherInit(cctx, cipher, key, iv, en_de); 146 EVP_CipherInit_ex(cctx, cipher, NULL, key, iv, en_de);
145 memset(md_tmp, 0, EVP_MAX_MD_SIZE); 147 memset(md_tmp, 0, EVP_MAX_MD_SIZE);
146 memset(key, 0, EVP_MAX_KEY_LENGTH); 148 memset(key, 0, EVP_MAX_KEY_LENGTH);
147 memset(iv, 0, EVP_MAX_IV_LENGTH); 149 memset(iv, 0, EVP_MAX_IV_LENGTH);
diff --git a/src/lib/libcrypto/evp/p5_crpt2.c b/src/lib/libcrypto/evp/p5_crpt2.c
index 717fad68ca..7881860b53 100644
--- a/src/lib/libcrypto/evp/p5_crpt2.c
+++ b/src/lib/libcrypto/evp/p5_crpt2.c
@@ -55,7 +55,7 @@
55 * Hudson (tjh@cryptsoft.com). 55 * Hudson (tjh@cryptsoft.com).
56 * 56 *
57 */ 57 */
58#if !defined(NO_HMAC) && !defined(NO_SHA) 58#if !defined(OPENSSL_NO_HMAC) && !defined(OPENSSL_NO_SHA)
59#include <stdio.h> 59#include <stdio.h>
60#include <stdlib.h> 60#include <stdlib.h>
61#include <openssl/x509.h> 61#include <openssl/x509.h>
@@ -84,6 +84,8 @@ int PKCS5_PBKDF2_HMAC_SHA1(const char *pass, int passlen,
84 int cplen, j, k, tkeylen; 84 int cplen, j, k, tkeylen;
85 unsigned long i = 1; 85 unsigned long i = 1;
86 HMAC_CTX hctx; 86 HMAC_CTX hctx;
87
88 HMAC_CTX_init(&hctx);
87 p = out; 89 p = out;
88 tkeylen = keylen; 90 tkeylen = keylen;
89 if(!pass) passlen = 0; 91 if(!pass) passlen = 0;
@@ -98,7 +100,7 @@ int PKCS5_PBKDF2_HMAC_SHA1(const char *pass, int passlen,
98 itmp[1] = (unsigned char)((i >> 16) & 0xff); 100 itmp[1] = (unsigned char)((i >> 16) & 0xff);
99 itmp[2] = (unsigned char)((i >> 8) & 0xff); 101 itmp[2] = (unsigned char)((i >> 8) & 0xff);
100 itmp[3] = (unsigned char)(i & 0xff); 102 itmp[3] = (unsigned char)(i & 0xff);
101 HMAC_Init(&hctx, pass, passlen, EVP_sha1()); 103 HMAC_Init_ex(&hctx, pass, passlen, EVP_sha1(), NULL);
102 HMAC_Update(&hctx, salt, saltlen); 104 HMAC_Update(&hctx, salt, saltlen);
103 HMAC_Update(&hctx, itmp, 4); 105 HMAC_Update(&hctx, itmp, 4);
104 HMAC_Final(&hctx, digtmp, NULL); 106 HMAC_Final(&hctx, digtmp, NULL);
@@ -112,7 +114,7 @@ int PKCS5_PBKDF2_HMAC_SHA1(const char *pass, int passlen,
112 i++; 114 i++;
113 p+= cplen; 115 p+= cplen;
114 } 116 }
115 HMAC_cleanup(&hctx); 117 HMAC_CTX_cleanup(&hctx);
116#ifdef DEBUG_PKCS5V2 118#ifdef DEBUG_PKCS5V2
117 fprintf(stderr, "Password:\n"); 119 fprintf(stderr, "Password:\n");
118 h__dump (pass, passlen); 120 h__dump (pass, passlen);
@@ -143,7 +145,7 @@ main()
143 */ 145 */
144 146
145int PKCS5_v2_PBE_keyivgen(EVP_CIPHER_CTX *ctx, const char *pass, int passlen, 147int PKCS5_v2_PBE_keyivgen(EVP_CIPHER_CTX *ctx, const char *pass, int passlen,
146 ASN1_TYPE *param, EVP_CIPHER *c, EVP_MD *md, 148 ASN1_TYPE *param, const EVP_CIPHER *c, const EVP_MD *md,
147 int en_de) 149 int en_de)
148{ 150{
149 unsigned char *pbuf, *salt, key[EVP_MAX_KEY_LENGTH]; 151 unsigned char *pbuf, *salt, key[EVP_MAX_KEY_LENGTH];
@@ -181,7 +183,7 @@ int PKCS5_v2_PBE_keyivgen(EVP_CIPHER_CTX *ctx, const char *pass, int passlen,
181 } 183 }
182 184
183 /* Fixup cipher based on AlgorithmIdentifier */ 185 /* Fixup cipher based on AlgorithmIdentifier */
184 EVP_CipherInit(ctx, cipher, NULL, NULL, en_de); 186 EVP_CipherInit_ex(ctx, cipher, NULL, NULL, NULL, en_de);
185 if(EVP_CIPHER_asn1_to_param(ctx, pbe2->encryption->parameter) < 0) { 187 if(EVP_CIPHER_asn1_to_param(ctx, pbe2->encryption->parameter) < 0) {
186 EVPerr(EVP_F_PKCS5_V2_PBE_KEYIVGEN, 188 EVPerr(EVP_F_PKCS5_V2_PBE_KEYIVGEN,
187 EVP_R_CIPHER_PARAMETER_ERROR); 189 EVP_R_CIPHER_PARAMETER_ERROR);
@@ -227,7 +229,7 @@ int PKCS5_v2_PBE_keyivgen(EVP_CIPHER_CTX *ctx, const char *pass, int passlen,
227 saltlen = kdf->salt->value.octet_string->length; 229 saltlen = kdf->salt->value.octet_string->length;
228 iter = ASN1_INTEGER_get(kdf->iter); 230 iter = ASN1_INTEGER_get(kdf->iter);
229 PKCS5_PBKDF2_HMAC_SHA1(pass, passlen, salt, saltlen, iter, keylen, key); 231 PKCS5_PBKDF2_HMAC_SHA1(pass, passlen, salt, saltlen, iter, keylen, key);
230 EVP_CipherInit(ctx, NULL, key, NULL, en_de); 232 EVP_CipherInit_ex(ctx, NULL, NULL, key, NULL, en_de);
231 memset(key, 0, keylen); 233 memset(key, 0, keylen);
232 PBKDF2PARAM_free(kdf); 234 PBKDF2PARAM_free(kdf);
233 return 1; 235 return 1;
diff --git a/src/lib/libcrypto/evp/p_dec.c b/src/lib/libcrypto/evp/p_dec.c
index 57b5daa453..8af620400e 100644
--- a/src/lib/libcrypto/evp/p_dec.c
+++ b/src/lib/libcrypto/evp/p_dec.c
@@ -59,7 +59,7 @@
59#include <stdio.h> 59#include <stdio.h>
60#include "cryptlib.h" 60#include "cryptlib.h"
61#include <openssl/rand.h> 61#include <openssl/rand.h>
62#ifndef NO_RSA 62#ifndef OPENSSL_NO_RSA
63#include <openssl/rsa.h> 63#include <openssl/rsa.h>
64#endif 64#endif
65#include <openssl/evp.h> 65#include <openssl/evp.h>
@@ -71,12 +71,12 @@ int EVP_PKEY_decrypt(unsigned char *key, unsigned char *ek, int ekl,
71 { 71 {
72 int ret= -1; 72 int ret= -1;
73 73
74#ifndef NO_RSA 74#ifndef OPENSSL_NO_RSA
75 if (priv->type != EVP_PKEY_RSA) 75 if (priv->type != EVP_PKEY_RSA)
76 { 76 {
77#endif 77#endif
78 EVPerr(EVP_F_EVP_PKEY_DECRYPT,EVP_R_PUBLIC_KEY_NOT_RSA); 78 EVPerr(EVP_F_EVP_PKEY_DECRYPT,EVP_R_PUBLIC_KEY_NOT_RSA);
79#ifndef NO_RSA 79#ifndef OPENSSL_NO_RSA
80 goto err; 80 goto err;
81 } 81 }
82 82
diff --git a/src/lib/libcrypto/evp/p_enc.c b/src/lib/libcrypto/evp/p_enc.c
index 4cf6acaf5d..656883b996 100644
--- a/src/lib/libcrypto/evp/p_enc.c
+++ b/src/lib/libcrypto/evp/p_enc.c
@@ -59,7 +59,7 @@
59#include <stdio.h> 59#include <stdio.h>
60#include "cryptlib.h" 60#include "cryptlib.h"
61#include <openssl/rand.h> 61#include <openssl/rand.h>
62#ifndef NO_RSA 62#ifndef OPENSSL_NO_RSA
63#include <openssl/rsa.h> 63#include <openssl/rsa.h>
64#endif 64#endif
65#include <openssl/evp.h> 65#include <openssl/evp.h>
@@ -71,12 +71,12 @@ int EVP_PKEY_encrypt(unsigned char *ek, unsigned char *key, int key_len,
71 { 71 {
72 int ret=0; 72 int ret=0;
73 73
74#ifndef NO_RSA 74#ifndef OPENSSL_NO_RSA
75 if (pubk->type != EVP_PKEY_RSA) 75 if (pubk->type != EVP_PKEY_RSA)
76 { 76 {
77#endif 77#endif
78 EVPerr(EVP_F_EVP_PKEY_ENCRYPT,EVP_R_PUBLIC_KEY_NOT_RSA); 78 EVPerr(EVP_F_EVP_PKEY_ENCRYPT,EVP_R_PUBLIC_KEY_NOT_RSA);
79#ifndef NO_RSA 79#ifndef OPENSSL_NO_RSA
80 goto err; 80 goto err;
81 } 81 }
82 ret=RSA_public_encrypt(key_len,key,ek,pubk->pkey.rsa,RSA_PKCS1_PADDING); 82 ret=RSA_public_encrypt(key_len,key,ek,pubk->pkey.rsa,RSA_PKCS1_PADDING);
diff --git a/src/lib/libcrypto/evp/p_lib.c b/src/lib/libcrypto/evp/p_lib.c
index 62398ed74d..215b94292a 100644
--- a/src/lib/libcrypto/evp/p_lib.c
+++ b/src/lib/libcrypto/evp/p_lib.c
@@ -64,14 +64,15 @@
64#include <openssl/x509.h> 64#include <openssl/x509.h>
65 65
66static void EVP_PKEY_free_it(EVP_PKEY *x); 66static void EVP_PKEY_free_it(EVP_PKEY *x);
67
67int EVP_PKEY_bits(EVP_PKEY *pkey) 68int EVP_PKEY_bits(EVP_PKEY *pkey)
68 { 69 {
69#ifndef NO_RSA 70#ifndef OPENSSL_NO_RSA
70 if (pkey->type == EVP_PKEY_RSA) 71 if (pkey->type == EVP_PKEY_RSA)
71 return(BN_num_bits(pkey->pkey.rsa->n)); 72 return(BN_num_bits(pkey->pkey.rsa->n));
72 else 73 else
73#endif 74#endif
74#ifndef NO_DSA 75#ifndef OPENSSL_NO_DSA
75 if (pkey->type == EVP_PKEY_DSA) 76 if (pkey->type == EVP_PKEY_DSA)
76 return(BN_num_bits(pkey->pkey.dsa->p)); 77 return(BN_num_bits(pkey->pkey.dsa->p));
77#endif 78#endif
@@ -82,12 +83,12 @@ int EVP_PKEY_size(EVP_PKEY *pkey)
82 { 83 {
83 if (pkey == NULL) 84 if (pkey == NULL)
84 return(0); 85 return(0);
85#ifndef NO_RSA 86#ifndef OPENSSL_NO_RSA
86 if (pkey->type == EVP_PKEY_RSA) 87 if (pkey->type == EVP_PKEY_RSA)
87 return(RSA_size(pkey->pkey.rsa)); 88 return(RSA_size(pkey->pkey.rsa));
88 else 89 else
89#endif 90#endif
90#ifndef NO_DSA 91#ifndef OPENSSL_NO_DSA
91 if (pkey->type == EVP_PKEY_DSA) 92 if (pkey->type == EVP_PKEY_DSA)
92 return(DSA_size(pkey->pkey.dsa)); 93 return(DSA_size(pkey->pkey.dsa));
93#endif 94#endif
@@ -96,10 +97,10 @@ int EVP_PKEY_size(EVP_PKEY *pkey)
96 97
97int EVP_PKEY_save_parameters(EVP_PKEY *pkey, int mode) 98int EVP_PKEY_save_parameters(EVP_PKEY *pkey, int mode)
98 { 99 {
99#ifndef NO_DSA 100#ifndef OPENSSL_NO_DSA
100 if (pkey->type == EVP_PKEY_DSA) 101 if (pkey->type == EVP_PKEY_DSA)
101 { 102 {
102 int ret=pkey->save_parameters=mode; 103 int ret=pkey->save_parameters;
103 104
104 if (mode >= 0) 105 if (mode >= 0)
105 pkey->save_parameters=mode; 106 pkey->save_parameters=mode;
@@ -122,7 +123,7 @@ int EVP_PKEY_copy_parameters(EVP_PKEY *to, EVP_PKEY *from)
122 EVPerr(EVP_F_EVP_PKEY_COPY_PARAMETERS,EVP_R_MISSING_PARAMETERS); 123 EVPerr(EVP_F_EVP_PKEY_COPY_PARAMETERS,EVP_R_MISSING_PARAMETERS);
123 goto err; 124 goto err;
124 } 125 }
125#ifndef NO_DSA 126#ifndef OPENSSL_NO_DSA
126 if (to->type == EVP_PKEY_DSA) 127 if (to->type == EVP_PKEY_DSA)
127 { 128 {
128 BIGNUM *a; 129 BIGNUM *a;
@@ -147,7 +148,7 @@ err:
147 148
148int EVP_PKEY_missing_parameters(EVP_PKEY *pkey) 149int EVP_PKEY_missing_parameters(EVP_PKEY *pkey)
149 { 150 {
150#ifndef NO_DSA 151#ifndef OPENSSL_NO_DSA
151 if (pkey->type == EVP_PKEY_DSA) 152 if (pkey->type == EVP_PKEY_DSA)
152 { 153 {
153 DSA *dsa; 154 DSA *dsa;
@@ -162,7 +163,7 @@ int EVP_PKEY_missing_parameters(EVP_PKEY *pkey)
162 163
163int EVP_PKEY_cmp_parameters(EVP_PKEY *a, EVP_PKEY *b) 164int EVP_PKEY_cmp_parameters(EVP_PKEY *a, EVP_PKEY *b)
164 { 165 {
165#ifndef NO_DSA 166#ifndef OPENSSL_NO_DSA
166 if ((a->type == EVP_PKEY_DSA) && (b->type == EVP_PKEY_DSA)) 167 if ((a->type == EVP_PKEY_DSA) && (b->type == EVP_PKEY_DSA))
167 { 168 {
168 if ( BN_cmp(a->pkey.dsa->p,b->pkey.dsa->p) || 169 if ( BN_cmp(a->pkey.dsa->p,b->pkey.dsa->p) ||
@@ -205,11 +206,12 @@ int EVP_PKEY_assign(EVP_PKEY *pkey, int type, char *key)
205 return(key != NULL); 206 return(key != NULL);
206 } 207 }
207 208
208#ifndef NO_RSA 209#ifndef OPENSSL_NO_RSA
209int EVP_PKEY_set1_RSA(EVP_PKEY *pkey, RSA *key) 210int EVP_PKEY_set1_RSA(EVP_PKEY *pkey, RSA *key)
210{ 211{
211 int ret = EVP_PKEY_assign_RSA(pkey, key); 212 int ret = EVP_PKEY_assign_RSA(pkey, key);
212 if(ret) CRYPTO_add(&key->references, 1, CRYPTO_LOCK_RSA); 213 if(ret)
214 RSA_up_ref(key);
213 return ret; 215 return ret;
214} 216}
215 217
@@ -219,16 +221,17 @@ RSA *EVP_PKEY_get1_RSA(EVP_PKEY *pkey)
219 EVPerr(EVP_F_EVP_PKEY_GET1_RSA, EVP_R_EXPECTING_AN_RSA_KEY); 221 EVPerr(EVP_F_EVP_PKEY_GET1_RSA, EVP_R_EXPECTING_AN_RSA_KEY);
220 return NULL; 222 return NULL;
221 } 223 }
222 CRYPTO_add(&pkey->pkey.rsa->references, 1, CRYPTO_LOCK_RSA); 224 RSA_up_ref(pkey->pkey.rsa);
223 return pkey->pkey.rsa; 225 return pkey->pkey.rsa;
224} 226}
225#endif 227#endif
226 228
227#ifndef NO_DSA 229#ifndef OPENSSL_NO_DSA
228int EVP_PKEY_set1_DSA(EVP_PKEY *pkey, DSA *key) 230int EVP_PKEY_set1_DSA(EVP_PKEY *pkey, DSA *key)
229{ 231{
230 int ret = EVP_PKEY_assign_DSA(pkey, key); 232 int ret = EVP_PKEY_assign_DSA(pkey, key);
231 if(ret) CRYPTO_add(&key->references, 1, CRYPTO_LOCK_DSA); 233 if(ret)
234 DSA_up_ref(key);
232 return ret; 235 return ret;
233} 236}
234 237
@@ -238,17 +241,18 @@ DSA *EVP_PKEY_get1_DSA(EVP_PKEY *pkey)
238 EVPerr(EVP_F_EVP_PKEY_GET1_DSA, EVP_R_EXPECTING_A_DSA_KEY); 241 EVPerr(EVP_F_EVP_PKEY_GET1_DSA, EVP_R_EXPECTING_A_DSA_KEY);
239 return NULL; 242 return NULL;
240 } 243 }
241 CRYPTO_add(&pkey->pkey.dsa->references, 1, CRYPTO_LOCK_DSA); 244 DSA_up_ref(pkey->pkey.dsa);
242 return pkey->pkey.dsa; 245 return pkey->pkey.dsa;
243} 246}
244#endif 247#endif
245 248
246#ifndef NO_DH 249#ifndef OPENSSL_NO_DH
247 250
248int EVP_PKEY_set1_DH(EVP_PKEY *pkey, DH *key) 251int EVP_PKEY_set1_DH(EVP_PKEY *pkey, DH *key)
249{ 252{
250 int ret = EVP_PKEY_assign_DH(pkey, key); 253 int ret = EVP_PKEY_assign_DH(pkey, key);
251 if(ret) CRYPTO_add(&key->references, 1, CRYPTO_LOCK_DH); 254 if(ret)
255 DH_up_ref(key);
252 return ret; 256 return ret;
253} 257}
254 258
@@ -258,7 +262,7 @@ DH *EVP_PKEY_get1_DH(EVP_PKEY *pkey)
258 EVPerr(EVP_F_EVP_PKEY_GET1_DH, EVP_R_EXPECTING_A_DH_KEY); 262 EVPerr(EVP_F_EVP_PKEY_GET1_DH, EVP_R_EXPECTING_A_DH_KEY);
259 return NULL; 263 return NULL;
260 } 264 }
261 CRYPTO_add(&pkey->pkey.dh->references, 1, CRYPTO_LOCK_DH); 265 DH_up_ref(pkey->pkey.dh);
262 return pkey->pkey.dh; 266 return pkey->pkey.dh;
263} 267}
264#endif 268#endif
@@ -309,13 +313,13 @@ static void EVP_PKEY_free_it(EVP_PKEY *x)
309 { 313 {
310 switch (x->type) 314 switch (x->type)
311 { 315 {
312#ifndef NO_RSA 316#ifndef OPENSSL_NO_RSA
313 case EVP_PKEY_RSA: 317 case EVP_PKEY_RSA:
314 case EVP_PKEY_RSA2: 318 case EVP_PKEY_RSA2:
315 RSA_free(x->pkey.rsa); 319 RSA_free(x->pkey.rsa);
316 break; 320 break;
317#endif 321#endif
318#ifndef NO_DSA 322#ifndef OPENSSL_NO_DSA
319 case EVP_PKEY_DSA: 323 case EVP_PKEY_DSA:
320 case EVP_PKEY_DSA2: 324 case EVP_PKEY_DSA2:
321 case EVP_PKEY_DSA3: 325 case EVP_PKEY_DSA3:
@@ -323,7 +327,7 @@ static void EVP_PKEY_free_it(EVP_PKEY *x)
323 DSA_free(x->pkey.dsa); 327 DSA_free(x->pkey.dsa);
324 break; 328 break;
325#endif 329#endif
326#ifndef NO_DH 330#ifndef OPENSSL_NO_DH
327 case EVP_PKEY_DH: 331 case EVP_PKEY_DH:
328 DH_free(x->pkey.dh); 332 DH_free(x->pkey.dh);
329 break; 333 break;
diff --git a/src/lib/libcrypto/evp/p_open.c b/src/lib/libcrypto/evp/p_open.c
index 2760c00fec..6976f2a867 100644
--- a/src/lib/libcrypto/evp/p_open.c
+++ b/src/lib/libcrypto/evp/p_open.c
@@ -56,14 +56,14 @@
56 * [including the GNU Public Licence.] 56 * [including the GNU Public Licence.]
57 */ 57 */
58 58
59#ifndef NO_RSA 59#ifndef OPENSSL_NO_RSA
60#include <stdio.h> 60#include <stdio.h>
61#include "cryptlib.h" 61#include "cryptlib.h"
62#include <openssl/evp.h> 62#include <openssl/evp.h>
63#include <openssl/objects.h> 63#include <openssl/objects.h>
64#include <openssl/x509.h> 64#include <openssl/x509.h>
65 65
66int EVP_OpenInit(EVP_CIPHER_CTX *ctx, EVP_CIPHER *type, unsigned char *ek, 66int EVP_OpenInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *type, unsigned char *ek,
67 int ekl, unsigned char *iv, EVP_PKEY *priv) 67 int ekl, unsigned char *iv, EVP_PKEY *priv)
68 { 68 {
69 unsigned char *key=NULL; 69 unsigned char *key=NULL;
@@ -71,7 +71,7 @@ int EVP_OpenInit(EVP_CIPHER_CTX *ctx, EVP_CIPHER *type, unsigned char *ek,
71 71
72 if(type) { 72 if(type) {
73 EVP_CIPHER_CTX_init(ctx); 73 EVP_CIPHER_CTX_init(ctx);
74 if(!EVP_DecryptInit(ctx,type,NULL,NULL)) return 0; 74 if(!EVP_DecryptInit_ex(ctx,type,NULL, NULL,NULL)) return 0;
75 } 75 }
76 76
77 if(!priv) return 1; 77 if(!priv) return 1;
@@ -97,7 +97,7 @@ int EVP_OpenInit(EVP_CIPHER_CTX *ctx, EVP_CIPHER *type, unsigned char *ek,
97 /* ERROR */ 97 /* ERROR */
98 goto err; 98 goto err;
99 } 99 }
100 if(!EVP_DecryptInit(ctx,NULL,key,iv)) goto err; 100 if(!EVP_DecryptInit_ex(ctx,NULL,NULL,key,iv)) goto err;
101 101
102 ret=1; 102 ret=1;
103err: 103err:
@@ -110,11 +110,11 @@ int EVP_OpenFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl)
110 { 110 {
111 int i; 111 int i;
112 112
113 i=EVP_DecryptFinal(ctx,out,outl); 113 i=EVP_DecryptFinal_ex(ctx,out,outl);
114 EVP_DecryptInit(ctx,NULL,NULL,NULL); 114 EVP_DecryptInit_ex(ctx,NULL,NULL,NULL,NULL);
115 return(i); 115 return(i);
116 } 116 }
117#else /* !NO_RSA */ 117#else /* !OPENSSL_NO_RSA */
118 118
119# ifdef PEDANTIC 119# ifdef PEDANTIC
120static void *dummy=&dummy; 120static void *dummy=&dummy;
diff --git a/src/lib/libcrypto/evp/p_seal.c b/src/lib/libcrypto/evp/p_seal.c
index 2fd1d7e0c2..5570ca3745 100644
--- a/src/lib/libcrypto/evp/p_seal.c
+++ b/src/lib/libcrypto/evp/p_seal.c
@@ -59,14 +59,14 @@
59#include <stdio.h> 59#include <stdio.h>
60#include "cryptlib.h" 60#include "cryptlib.h"
61#include <openssl/rand.h> 61#include <openssl/rand.h>
62#ifndef NO_RSA 62#ifndef OPENSSL_NO_RSA
63#include <openssl/rsa.h> 63#include <openssl/rsa.h>
64#endif 64#endif
65#include <openssl/evp.h> 65#include <openssl/evp.h>
66#include <openssl/objects.h> 66#include <openssl/objects.h>
67#include <openssl/x509.h> 67#include <openssl/x509.h>
68 68
69int EVP_SealInit(EVP_CIPHER_CTX *ctx, EVP_CIPHER *type, unsigned char **ek, 69int EVP_SealInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *type, unsigned char **ek,
70 int *ekl, unsigned char *iv, EVP_PKEY **pubk, int npubk) 70 int *ekl, unsigned char *iv, EVP_PKEY **pubk, int npubk)
71 { 71 {
72 unsigned char key[EVP_MAX_KEY_LENGTH]; 72 unsigned char key[EVP_MAX_KEY_LENGTH];
@@ -74,15 +74,16 @@ int EVP_SealInit(EVP_CIPHER_CTX *ctx, EVP_CIPHER *type, unsigned char **ek,
74 74
75 if(type) { 75 if(type) {
76 EVP_CIPHER_CTX_init(ctx); 76 EVP_CIPHER_CTX_init(ctx);
77 if(!EVP_EncryptInit(ctx,type,NULL,NULL)) return 0; 77 if(!EVP_EncryptInit_ex(ctx,type,NULL,NULL,NULL)) return 0;
78 } 78 }
79 if (npubk <= 0) return(0); 79 if ((npubk <= 0) || !pubk)
80 return 1;
80 if (RAND_bytes(key,EVP_MAX_KEY_LENGTH) <= 0) 81 if (RAND_bytes(key,EVP_MAX_KEY_LENGTH) <= 0)
81 return(0); 82 return 0;
82 if (EVP_CIPHER_CTX_iv_length(ctx)) 83 if (EVP_CIPHER_CTX_iv_length(ctx))
83 RAND_pseudo_bytes(iv,EVP_CIPHER_CTX_iv_length(ctx)); 84 RAND_pseudo_bytes(iv,EVP_CIPHER_CTX_iv_length(ctx));
84 85
85 if(!EVP_EncryptInit(ctx,NULL,key,iv)) return 0; 86 if(!EVP_EncryptInit_ex(ctx,NULL,NULL,key,iv)) return 0;
86 87
87 for (i=0; i<npubk; i++) 88 for (i=0; i<npubk; i++)
88 { 89 {
@@ -107,6 +108,6 @@ int inl;
107 108
108void EVP_SealFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl) 109void EVP_SealFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl)
109 { 110 {
110 EVP_EncryptFinal(ctx,out,outl); 111 EVP_EncryptFinal_ex(ctx,out,outl);
111 EVP_EncryptInit(ctx,NULL,NULL,NULL); 112 EVP_EncryptInit_ex(ctx,NULL,NULL,NULL,NULL);
112 } 113 }
diff --git a/src/lib/libcrypto/evp/p_sign.c b/src/lib/libcrypto/evp/p_sign.c
index 1fa32ac17e..e4ae5906f5 100644
--- a/src/lib/libcrypto/evp/p_sign.c
+++ b/src/lib/libcrypto/evp/p_sign.c
@@ -65,7 +65,7 @@
65#ifdef undef 65#ifdef undef
66void EVP_SignInit(EVP_MD_CTX *ctx, EVP_MD *type) 66void EVP_SignInit(EVP_MD_CTX *ctx, EVP_MD *type)
67 { 67 {
68 EVP_DigestInit(ctx,type); 68 EVP_DigestInit_ex(ctx,type);
69 } 69 }
70 70
71void EVP_SignUpdate(EVP_MD_CTX *ctx, unsigned char *data, 71void EVP_SignUpdate(EVP_MD_CTX *ctx, unsigned char *data,
@@ -84,8 +84,10 @@ int EVP_SignFinal(EVP_MD_CTX *ctx, unsigned char *sigret, unsigned int *siglen,
84 MS_STATIC 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_copy(&tmp_ctx,ctx); 87 EVP_MD_CTX_init(&tmp_ctx);
88 EVP_DigestFinal(&tmp_ctx,&(m[0]),&m_len); 88 EVP_MD_CTX_copy_ex(&tmp_ctx,ctx);
89 EVP_DigestFinal_ex(&tmp_ctx,&(m[0]),&m_len);
90 EVP_MD_CTX_cleanup(&tmp_ctx);
89 for (i=0; i<4; i++) 91 for (i=0; i<4; i++)
90 { 92 {
91 v=ctx->digest->required_pkey_type[i]; 93 v=ctx->digest->required_pkey_type[i];
diff --git a/src/lib/libcrypto/evp/p_verify.c b/src/lib/libcrypto/evp/p_verify.c
index dcb54f3abb..d854d743a5 100644
--- a/src/lib/libcrypto/evp/p_verify.c
+++ b/src/lib/libcrypto/evp/p_verify.c
@@ -85,8 +85,10 @@ int EVP_VerifyFinal(EVP_MD_CTX *ctx, unsigned char *sigbuf,
85 EVPerr(EVP_F_EVP_VERIFYFINAL,EVP_R_WRONG_PUBLIC_KEY_TYPE); 85 EVPerr(EVP_F_EVP_VERIFYFINAL,EVP_R_WRONG_PUBLIC_KEY_TYPE);
86 return(-1); 86 return(-1);
87 } 87 }
88 EVP_MD_CTX_copy(&tmp_ctx,ctx); 88 EVP_MD_CTX_init(&tmp_ctx);
89 EVP_DigestFinal(&tmp_ctx,&(m[0]),&m_len); 89 EVP_MD_CTX_copy_ex(&tmp_ctx,ctx);
90 EVP_DigestFinal_ex(&tmp_ctx,&(m[0]),&m_len);
91 EVP_MD_CTX_cleanup(&tmp_ctx);
90 if (ctx->digest->verify == NULL) 92 if (ctx->digest->verify == NULL)
91 { 93 {
92 EVPerr(EVP_F_EVP_VERIFYFINAL,EVP_R_NO_VERIFY_FUNCTION_CONFIGURED); 94 EVPerr(EVP_F_EVP_VERIFYFINAL,EVP_R_NO_VERIFY_FUNCTION_CONFIGURED);