summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/x509
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libcrypto/x509')
-rw-r--r--src/lib/libcrypto/x509/Makefile.ssl273
-rw-r--r--src/lib/libcrypto/x509/by_dir.c26
-rw-r--r--src/lib/libcrypto/x509/x509.h152
-rw-r--r--src/lib/libcrypto/x509/x509_cmp.c28
-rw-r--r--src/lib/libcrypto/x509/x509_lu.c332
-rw-r--r--src/lib/libcrypto/x509/x509_obj.c4
-rw-r--r--src/lib/libcrypto/x509/x509_req.c6
-rw-r--r--src/lib/libcrypto/x509/x509_set.c16
-rw-r--r--src/lib/libcrypto/x509/x509_trs.c16
-rw-r--r--src/lib/libcrypto/x509/x509_txt.c9
-rw-r--r--src/lib/libcrypto/x509/x509_vfy.c491
-rw-r--r--src/lib/libcrypto/x509/x509_vfy.h56
-rw-r--r--src/lib/libcrypto/x509/x509spki.c12
-rw-r--r--src/lib/libcrypto/x509/x_all.c38
14 files changed, 942 insertions, 517 deletions
diff --git a/src/lib/libcrypto/x509/Makefile.ssl b/src/lib/libcrypto/x509/Makefile.ssl
index 48937b43af..4619693733 100644
--- a/src/lib/libcrypto/x509/Makefile.ssl
+++ b/src/lib/libcrypto/x509/Makefile.ssl
@@ -96,15 +96,17 @@ by_dir.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
96by_dir.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h 96by_dir.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h
97by_dir.o: ../../include/openssl/err.h ../../include/openssl/evp.h 97by_dir.o: ../../include/openssl/err.h ../../include/openssl/evp.h
98by_dir.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h 98by_dir.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
99by_dir.o: ../../include/openssl/md2.h ../../include/openssl/md5.h 99by_dir.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
100by_dir.o: ../../include/openssl/mdc2.h ../../include/openssl/objects.h 100by_dir.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
101by_dir.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
101by_dir.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h 102by_dir.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
102by_dir.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h 103by_dir.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
103by_dir.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h 104by_dir.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
104by_dir.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h 105by_dir.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
105by_dir.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h 106by_dir.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
106by_dir.o: ../../include/openssl/stack.h ../../include/openssl/x509.h 107by_dir.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
107by_dir.o: ../../include/openssl/x509_vfy.h ../cryptlib.h 108by_dir.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
109by_dir.o: ../cryptlib.h
108by_file.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h 110by_file.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
109by_file.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h 111by_file.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
110by_file.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h 112by_file.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
@@ -113,52 +115,60 @@ by_file.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
113by_file.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h 115by_file.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h
114by_file.o: ../../include/openssl/err.h ../../include/openssl/evp.h 116by_file.o: ../../include/openssl/err.h ../../include/openssl/evp.h
115by_file.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h 117by_file.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
116by_file.o: ../../include/openssl/md2.h ../../include/openssl/md5.h 118by_file.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
117by_file.o: ../../include/openssl/mdc2.h ../../include/openssl/objects.h 119by_file.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
120by_file.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
118by_file.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h 121by_file.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
119by_file.o: ../../include/openssl/pem.h ../../include/openssl/pem2.h 122by_file.o: ../../include/openssl/pem.h ../../include/openssl/pem2.h
120by_file.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h 123by_file.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
121by_file.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h 124by_file.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
122by_file.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h 125by_file.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
123by_file.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h 126by_file.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
124by_file.o: ../../include/openssl/stack.h ../../include/openssl/x509.h 127by_file.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
125by_file.o: ../../include/openssl/x509_vfy.h ../cryptlib.h 128by_file.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
129by_file.o: ../cryptlib.h
126x509_att.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h 130x509_att.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
127x509_att.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h 131x509_att.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
128x509_att.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h 132x509_att.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
129x509_att.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h 133x509_att.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h
130x509_att.o: ../../include/openssl/des.h ../../include/openssl/dh.h 134x509_att.o: ../../include/openssl/des.h ../../include/openssl/dh.h
131x509_att.o: ../../include/openssl/dsa.h ../../include/openssl/e_os.h 135x509_att.o: ../../include/openssl/dsa.h ../../include/openssl/e_os.h
132x509_att.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h 136x509_att.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h
133x509_att.o: ../../include/openssl/evp.h ../../include/openssl/idea.h 137x509_att.o: ../../include/openssl/err.h ../../include/openssl/evp.h
134x509_att.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h 138x509_att.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
139x509_att.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
135x509_att.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h 140x509_att.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
136x509_att.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h 141x509_att.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
142x509_att.o: ../../include/openssl/opensslconf.h
137x509_att.o: ../../include/openssl/opensslv.h ../../include/openssl/pkcs7.h 143x509_att.o: ../../include/openssl/opensslv.h ../../include/openssl/pkcs7.h
138x509_att.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h 144x509_att.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
139x509_att.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h 145x509_att.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
140x509_att.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h 146x509_att.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
141x509_att.o: ../../include/openssl/sha.h ../../include/openssl/stack.h 147x509_att.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
142x509_att.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h 148x509_att.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
143x509_att.o: ../../include/openssl/x509v3.h ../cryptlib.h 149x509_att.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h
150x509_att.o: ../cryptlib.h
144x509_cmp.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h 151x509_cmp.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
145x509_cmp.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h 152x509_cmp.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
146x509_cmp.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h 153x509_cmp.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
147x509_cmp.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h 154x509_cmp.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h
148x509_cmp.o: ../../include/openssl/des.h ../../include/openssl/dh.h 155x509_cmp.o: ../../include/openssl/des.h ../../include/openssl/dh.h
149x509_cmp.o: ../../include/openssl/dsa.h ../../include/openssl/e_os.h 156x509_cmp.o: ../../include/openssl/dsa.h ../../include/openssl/e_os.h
150x509_cmp.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h 157x509_cmp.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h
151x509_cmp.o: ../../include/openssl/evp.h ../../include/openssl/idea.h 158x509_cmp.o: ../../include/openssl/err.h ../../include/openssl/evp.h
152x509_cmp.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h 159x509_cmp.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
160x509_cmp.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
153x509_cmp.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h 161x509_cmp.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
154x509_cmp.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h 162x509_cmp.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
163x509_cmp.o: ../../include/openssl/opensslconf.h
155x509_cmp.o: ../../include/openssl/opensslv.h ../../include/openssl/pkcs7.h 164x509_cmp.o: ../../include/openssl/opensslv.h ../../include/openssl/pkcs7.h
156x509_cmp.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h 165x509_cmp.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
157x509_cmp.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h 166x509_cmp.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
158x509_cmp.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h 167x509_cmp.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
159x509_cmp.o: ../../include/openssl/sha.h ../../include/openssl/stack.h 168x509_cmp.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
160x509_cmp.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h 169x509_cmp.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
161x509_cmp.o: ../../include/openssl/x509v3.h ../cryptlib.h 170x509_cmp.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h
171x509_cmp.o: ../cryptlib.h
162x509_d2.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h 172x509_d2.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
163x509_d2.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h 173x509_d2.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
164x509_d2.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h 174x509_d2.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
@@ -166,14 +176,16 @@ x509_d2.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
166x509_d2.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h 176x509_d2.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
167x509_d2.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h 177x509_d2.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h
168x509_d2.o: ../../include/openssl/err.h ../../include/openssl/evp.h 178x509_d2.o: ../../include/openssl/err.h ../../include/openssl/evp.h
169x509_d2.o: ../../include/openssl/idea.h ../../include/openssl/md2.h 179x509_d2.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
180x509_d2.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
170x509_d2.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h 181x509_d2.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
171x509_d2.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h 182x509_d2.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
172x509_d2.o: ../../include/openssl/opensslv.h ../../include/openssl/pkcs7.h 183x509_d2.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
173x509_d2.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h 184x509_d2.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
174x509_d2.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h 185x509_d2.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
175x509_d2.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h 186x509_d2.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
176x509_d2.o: ../../include/openssl/sha.h ../../include/openssl/stack.h 187x509_d2.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
188x509_d2.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
177x509_d2.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h 189x509_d2.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
178x509_d2.o: ../cryptlib.h 190x509_d2.o: ../cryptlib.h
179x509_def.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h 191x509_def.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
@@ -183,49 +195,57 @@ x509_def.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
183x509_def.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h 195x509_def.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
184x509_def.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h 196x509_def.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h
185x509_def.o: ../../include/openssl/err.h ../../include/openssl/evp.h 197x509_def.o: ../../include/openssl/err.h ../../include/openssl/evp.h
186x509_def.o: ../../include/openssl/idea.h ../../include/openssl/md2.h 198x509_def.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
199x509_def.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
187x509_def.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h 200x509_def.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
188x509_def.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h 201x509_def.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
202x509_def.o: ../../include/openssl/opensslconf.h
189x509_def.o: ../../include/openssl/opensslv.h ../../include/openssl/pkcs7.h 203x509_def.o: ../../include/openssl/opensslv.h ../../include/openssl/pkcs7.h
190x509_def.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h 204x509_def.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
191x509_def.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h 205x509_def.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
192x509_def.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h 206x509_def.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
193x509_def.o: ../../include/openssl/sha.h ../../include/openssl/stack.h 207x509_def.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
194x509_def.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h 208x509_def.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
195x509_def.o: ../cryptlib.h 209x509_def.o: ../../include/openssl/x509_vfy.h ../cryptlib.h
196x509_err.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h 210x509_err.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
197x509_err.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h 211x509_err.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
198x509_err.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h 212x509_err.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
199x509_err.o: ../../include/openssl/des.h ../../include/openssl/dh.h 213x509_err.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
200x509_err.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h 214x509_err.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
201x509_err.o: ../../include/openssl/err.h ../../include/openssl/evp.h 215x509_err.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
202x509_err.o: ../../include/openssl/idea.h ../../include/openssl/md2.h 216x509_err.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
203x509_err.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h 217x509_err.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
218x509_err.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
219x509_err.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
204x509_err.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h 220x509_err.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
205x509_err.o: ../../include/openssl/opensslv.h ../../include/openssl/pkcs7.h 221x509_err.o: ../../include/openssl/opensslv.h ../../include/openssl/pkcs7.h
206x509_err.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h 222x509_err.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
207x509_err.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h 223x509_err.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
208x509_err.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h 224x509_err.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
209x509_err.o: ../../include/openssl/sha.h ../../include/openssl/stack.h 225x509_err.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
210x509_err.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h 226x509_err.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
227x509_err.o: ../../include/openssl/x509_vfy.h
211x509_ext.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h 228x509_ext.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
212x509_ext.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h 229x509_ext.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
213x509_ext.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h 230x509_ext.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
214x509_ext.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h 231x509_ext.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h
215x509_ext.o: ../../include/openssl/des.h ../../include/openssl/dh.h 232x509_ext.o: ../../include/openssl/des.h ../../include/openssl/dh.h
216x509_ext.o: ../../include/openssl/dsa.h ../../include/openssl/e_os.h 233x509_ext.o: ../../include/openssl/dsa.h ../../include/openssl/e_os.h
217x509_ext.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h 234x509_ext.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h
218x509_ext.o: ../../include/openssl/evp.h ../../include/openssl/idea.h 235x509_ext.o: ../../include/openssl/err.h ../../include/openssl/evp.h
219x509_ext.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h 236x509_ext.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
237x509_ext.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
220x509_ext.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h 238x509_ext.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
221x509_ext.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h 239x509_ext.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
240x509_ext.o: ../../include/openssl/opensslconf.h
222x509_ext.o: ../../include/openssl/opensslv.h ../../include/openssl/pkcs7.h 241x509_ext.o: ../../include/openssl/opensslv.h ../../include/openssl/pkcs7.h
223x509_ext.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h 242x509_ext.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
224x509_ext.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h 243x509_ext.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
225x509_ext.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h 244x509_ext.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
226x509_ext.o: ../../include/openssl/sha.h ../../include/openssl/stack.h 245x509_ext.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
227x509_ext.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h 246x509_ext.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
228x509_ext.o: ../../include/openssl/x509v3.h ../cryptlib.h 247x509_ext.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h
248x509_ext.o: ../cryptlib.h
229x509_lu.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h 249x509_lu.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
230x509_lu.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h 250x509_lu.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
231x509_lu.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h 251x509_lu.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
@@ -234,15 +254,17 @@ x509_lu.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
234x509_lu.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h 254x509_lu.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h
235x509_lu.o: ../../include/openssl/err.h ../../include/openssl/evp.h 255x509_lu.o: ../../include/openssl/err.h ../../include/openssl/evp.h
236x509_lu.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h 256x509_lu.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
237x509_lu.o: ../../include/openssl/md2.h ../../include/openssl/md5.h 257x509_lu.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
238x509_lu.o: ../../include/openssl/mdc2.h ../../include/openssl/objects.h 258x509_lu.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
259x509_lu.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
239x509_lu.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h 260x509_lu.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
240x509_lu.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h 261x509_lu.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
241x509_lu.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h 262x509_lu.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
242x509_lu.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h 263x509_lu.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
243x509_lu.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h 264x509_lu.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
244x509_lu.o: ../../include/openssl/stack.h ../../include/openssl/x509.h 265x509_lu.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
245x509_lu.o: ../../include/openssl/x509_vfy.h ../cryptlib.h 266x509_lu.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
267x509_lu.o: ../cryptlib.h
246x509_obj.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h 268x509_obj.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
247x509_obj.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h 269x509_obj.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
248x509_obj.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h 270x509_obj.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
@@ -251,16 +273,17 @@ x509_obj.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
251x509_obj.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h 273x509_obj.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h
252x509_obj.o: ../../include/openssl/err.h ../../include/openssl/evp.h 274x509_obj.o: ../../include/openssl/err.h ../../include/openssl/evp.h
253x509_obj.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h 275x509_obj.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
254x509_obj.o: ../../include/openssl/md2.h ../../include/openssl/md5.h 276x509_obj.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
255x509_obj.o: ../../include/openssl/mdc2.h ../../include/openssl/objects.h 277x509_obj.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
278x509_obj.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
256x509_obj.o: ../../include/openssl/opensslconf.h 279x509_obj.o: ../../include/openssl/opensslconf.h
257x509_obj.o: ../../include/openssl/opensslv.h ../../include/openssl/pkcs7.h 280x509_obj.o: ../../include/openssl/opensslv.h ../../include/openssl/pkcs7.h
258x509_obj.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h 281x509_obj.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
259x509_obj.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h 282x509_obj.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
260x509_obj.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h 283x509_obj.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
261x509_obj.o: ../../include/openssl/sha.h ../../include/openssl/stack.h 284x509_obj.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
262x509_obj.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h 285x509_obj.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
263x509_obj.o: ../cryptlib.h 286x509_obj.o: ../../include/openssl/x509_vfy.h ../cryptlib.h
264x509_r2x.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h 287x509_r2x.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
265x509_r2x.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h 288x509_r2x.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
266x509_r2x.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h 289x509_r2x.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
@@ -268,16 +291,18 @@ x509_r2x.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
268x509_r2x.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h 291x509_r2x.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
269x509_r2x.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h 292x509_r2x.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h
270x509_r2x.o: ../../include/openssl/err.h ../../include/openssl/evp.h 293x509_r2x.o: ../../include/openssl/err.h ../../include/openssl/evp.h
271x509_r2x.o: ../../include/openssl/idea.h ../../include/openssl/md2.h 294x509_r2x.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
295x509_r2x.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
272x509_r2x.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h 296x509_r2x.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
273x509_r2x.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h 297x509_r2x.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
298x509_r2x.o: ../../include/openssl/opensslconf.h
274x509_r2x.o: ../../include/openssl/opensslv.h ../../include/openssl/pkcs7.h 299x509_r2x.o: ../../include/openssl/opensslv.h ../../include/openssl/pkcs7.h
275x509_r2x.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h 300x509_r2x.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
276x509_r2x.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h 301x509_r2x.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
277x509_r2x.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h 302x509_r2x.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
278x509_r2x.o: ../../include/openssl/sha.h ../../include/openssl/stack.h 303x509_r2x.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
279x509_r2x.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h 304x509_r2x.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
280x509_r2x.o: ../cryptlib.h 305x509_r2x.o: ../../include/openssl/x509_vfy.h ../cryptlib.h
281x509_req.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h 306x509_req.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
282x509_req.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h 307x509_req.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
283x509_req.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h 308x509_req.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
@@ -285,17 +310,19 @@ x509_req.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
285x509_req.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h 310x509_req.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
286x509_req.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h 311x509_req.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h
287x509_req.o: ../../include/openssl/err.h ../../include/openssl/evp.h 312x509_req.o: ../../include/openssl/err.h ../../include/openssl/evp.h
288x509_req.o: ../../include/openssl/idea.h ../../include/openssl/md2.h 313x509_req.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
314x509_req.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
289x509_req.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h 315x509_req.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
290x509_req.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h 316x509_req.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
317x509_req.o: ../../include/openssl/opensslconf.h
291x509_req.o: ../../include/openssl/opensslv.h ../../include/openssl/pem.h 318x509_req.o: ../../include/openssl/opensslv.h ../../include/openssl/pem.h
292x509_req.o: ../../include/openssl/pem2.h ../../include/openssl/pkcs7.h 319x509_req.o: ../../include/openssl/pem2.h ../../include/openssl/pkcs7.h
293x509_req.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h 320x509_req.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
294x509_req.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h 321x509_req.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
295x509_req.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h 322x509_req.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
296x509_req.o: ../../include/openssl/sha.h ../../include/openssl/stack.h 323x509_req.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
297x509_req.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h 324x509_req.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
298x509_req.o: ../cryptlib.h 325x509_req.o: ../../include/openssl/x509_vfy.h ../cryptlib.h
299x509_set.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h 326x509_set.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
300x509_set.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h 327x509_set.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
301x509_set.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h 328x509_set.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
@@ -303,34 +330,39 @@ x509_set.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
303x509_set.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h 330x509_set.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
304x509_set.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h 331x509_set.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h
305x509_set.o: ../../include/openssl/err.h ../../include/openssl/evp.h 332x509_set.o: ../../include/openssl/err.h ../../include/openssl/evp.h
306x509_set.o: ../../include/openssl/idea.h ../../include/openssl/md2.h 333x509_set.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
334x509_set.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
307x509_set.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h 335x509_set.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
308x509_set.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h 336x509_set.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
337x509_set.o: ../../include/openssl/opensslconf.h
309x509_set.o: ../../include/openssl/opensslv.h ../../include/openssl/pkcs7.h 338x509_set.o: ../../include/openssl/opensslv.h ../../include/openssl/pkcs7.h
310x509_set.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h 339x509_set.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
311x509_set.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h 340x509_set.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
312x509_set.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h 341x509_set.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
313x509_set.o: ../../include/openssl/sha.h ../../include/openssl/stack.h 342x509_set.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
314x509_set.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h 343x509_set.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
315x509_set.o: ../cryptlib.h 344x509_set.o: ../../include/openssl/x509_vfy.h ../cryptlib.h
316x509_trs.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h 345x509_trs.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
317x509_trs.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h 346x509_trs.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
318x509_trs.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h 347x509_trs.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
319x509_trs.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h 348x509_trs.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h
320x509_trs.o: ../../include/openssl/des.h ../../include/openssl/dh.h 349x509_trs.o: ../../include/openssl/des.h ../../include/openssl/dh.h
321x509_trs.o: ../../include/openssl/dsa.h ../../include/openssl/e_os.h 350x509_trs.o: ../../include/openssl/dsa.h ../../include/openssl/e_os.h
322x509_trs.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h 351x509_trs.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h
323x509_trs.o: ../../include/openssl/evp.h ../../include/openssl/idea.h 352x509_trs.o: ../../include/openssl/err.h ../../include/openssl/evp.h
324x509_trs.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h 353x509_trs.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
354x509_trs.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
325x509_trs.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h 355x509_trs.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
326x509_trs.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h 356x509_trs.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
357x509_trs.o: ../../include/openssl/opensslconf.h
327x509_trs.o: ../../include/openssl/opensslv.h ../../include/openssl/pkcs7.h 358x509_trs.o: ../../include/openssl/opensslv.h ../../include/openssl/pkcs7.h
328x509_trs.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h 359x509_trs.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
329x509_trs.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h 360x509_trs.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
330x509_trs.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h 361x509_trs.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
331x509_trs.o: ../../include/openssl/sha.h ../../include/openssl/stack.h 362x509_trs.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
332x509_trs.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h 363x509_trs.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
333x509_trs.o: ../../include/openssl/x509v3.h ../cryptlib.h 364x509_trs.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h
365x509_trs.o: ../cryptlib.h
334x509_txt.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h 366x509_txt.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
335x509_txt.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h 367x509_txt.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
336x509_txt.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h 368x509_txt.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
@@ -339,32 +371,35 @@ x509_txt.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
339x509_txt.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h 371x509_txt.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h
340x509_txt.o: ../../include/openssl/err.h ../../include/openssl/evp.h 372x509_txt.o: ../../include/openssl/err.h ../../include/openssl/evp.h
341x509_txt.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h 373x509_txt.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
342x509_txt.o: ../../include/openssl/md2.h ../../include/openssl/md5.h 374x509_txt.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
343x509_txt.o: ../../include/openssl/mdc2.h ../../include/openssl/objects.h 375x509_txt.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
376x509_txt.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
344x509_txt.o: ../../include/openssl/opensslconf.h 377x509_txt.o: ../../include/openssl/opensslconf.h
345x509_txt.o: ../../include/openssl/opensslv.h ../../include/openssl/pkcs7.h 378x509_txt.o: ../../include/openssl/opensslv.h ../../include/openssl/pkcs7.h
346x509_txt.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h 379x509_txt.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
347x509_txt.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h 380x509_txt.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
348x509_txt.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h 381x509_txt.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
349x509_txt.o: ../../include/openssl/sha.h ../../include/openssl/stack.h 382x509_txt.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
350x509_txt.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h 383x509_txt.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
351x509_txt.o: ../cryptlib.h 384x509_txt.o: ../../include/openssl/x509_vfy.h ../cryptlib.h
352x509_v3.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h 385x509_v3.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
353x509_v3.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h 386x509_v3.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
354x509_v3.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h 387x509_v3.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
355x509_v3.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h 388x509_v3.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h
356x509_v3.o: ../../include/openssl/des.h ../../include/openssl/dh.h 389x509_v3.o: ../../include/openssl/des.h ../../include/openssl/dh.h
357x509_v3.o: ../../include/openssl/dsa.h ../../include/openssl/e_os.h 390x509_v3.o: ../../include/openssl/dsa.h ../../include/openssl/e_os.h
358x509_v3.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h 391x509_v3.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h
359x509_v3.o: ../../include/openssl/evp.h ../../include/openssl/idea.h 392x509_v3.o: ../../include/openssl/err.h ../../include/openssl/evp.h
360x509_v3.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h 393x509_v3.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
394x509_v3.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
361x509_v3.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h 395x509_v3.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
362x509_v3.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h 396x509_v3.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
363x509_v3.o: ../../include/openssl/opensslv.h ../../include/openssl/pkcs7.h 397x509_v3.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
364x509_v3.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h 398x509_v3.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
365x509_v3.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h 399x509_v3.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
366x509_v3.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h 400x509_v3.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
367x509_v3.o: ../../include/openssl/sha.h ../../include/openssl/stack.h 401x509_v3.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
402x509_v3.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
368x509_v3.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h 403x509_v3.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
369x509_v3.o: ../../include/openssl/x509v3.h ../cryptlib.h 404x509_v3.o: ../../include/openssl/x509v3.h ../cryptlib.h
370x509_vfy.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h 405x509_vfy.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
@@ -373,18 +408,21 @@ x509_vfy.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
373x509_vfy.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h 408x509_vfy.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h
374x509_vfy.o: ../../include/openssl/des.h ../../include/openssl/dh.h 409x509_vfy.o: ../../include/openssl/des.h ../../include/openssl/dh.h
375x509_vfy.o: ../../include/openssl/dsa.h ../../include/openssl/e_os.h 410x509_vfy.o: ../../include/openssl/dsa.h ../../include/openssl/e_os.h
376x509_vfy.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h 411x509_vfy.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h
377x509_vfy.o: ../../include/openssl/evp.h ../../include/openssl/idea.h 412x509_vfy.o: ../../include/openssl/err.h ../../include/openssl/evp.h
378x509_vfy.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h 413x509_vfy.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
414x509_vfy.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
379x509_vfy.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h 415x509_vfy.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
380x509_vfy.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h 416x509_vfy.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
417x509_vfy.o: ../../include/openssl/opensslconf.h
381x509_vfy.o: ../../include/openssl/opensslv.h ../../include/openssl/pkcs7.h 418x509_vfy.o: ../../include/openssl/opensslv.h ../../include/openssl/pkcs7.h
382x509_vfy.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h 419x509_vfy.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
383x509_vfy.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h 420x509_vfy.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
384x509_vfy.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h 421x509_vfy.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
385x509_vfy.o: ../../include/openssl/sha.h ../../include/openssl/stack.h 422x509_vfy.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
386x509_vfy.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h 423x509_vfy.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
387x509_vfy.o: ../../include/openssl/x509v3.h ../cryptlib.h 424x509_vfy.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h
425x509_vfy.o: ../cryptlib.h
388x509name.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h 426x509name.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
389x509name.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h 427x509name.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
390x509name.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h 428x509name.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
@@ -392,16 +430,18 @@ x509name.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
392x509name.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h 430x509name.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
393x509name.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h 431x509name.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h
394x509name.o: ../../include/openssl/err.h ../../include/openssl/evp.h 432x509name.o: ../../include/openssl/err.h ../../include/openssl/evp.h
395x509name.o: ../../include/openssl/idea.h ../../include/openssl/md2.h 433x509name.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
434x509name.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
396x509name.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h 435x509name.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
397x509name.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h 436x509name.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
437x509name.o: ../../include/openssl/opensslconf.h
398x509name.o: ../../include/openssl/opensslv.h ../../include/openssl/pkcs7.h 438x509name.o: ../../include/openssl/opensslv.h ../../include/openssl/pkcs7.h
399x509name.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h 439x509name.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
400x509name.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h 440x509name.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
401x509name.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h 441x509name.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
402x509name.o: ../../include/openssl/sha.h ../../include/openssl/stack.h 442x509name.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
403x509name.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h 443x509name.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
404x509name.o: ../cryptlib.h 444x509name.o: ../../include/openssl/x509_vfy.h ../cryptlib.h
405x509rset.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h 445x509rset.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
406x509rset.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h 446x509rset.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
407x509rset.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h 447x509rset.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
@@ -409,16 +449,18 @@ x509rset.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
409x509rset.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h 449x509rset.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
410x509rset.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h 450x509rset.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h
411x509rset.o: ../../include/openssl/err.h ../../include/openssl/evp.h 451x509rset.o: ../../include/openssl/err.h ../../include/openssl/evp.h
412x509rset.o: ../../include/openssl/idea.h ../../include/openssl/md2.h 452x509rset.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
453x509rset.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
413x509rset.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h 454x509rset.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
414x509rset.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h 455x509rset.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
456x509rset.o: ../../include/openssl/opensslconf.h
415x509rset.o: ../../include/openssl/opensslv.h ../../include/openssl/pkcs7.h 457x509rset.o: ../../include/openssl/opensslv.h ../../include/openssl/pkcs7.h
416x509rset.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h 458x509rset.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
417x509rset.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h 459x509rset.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
418x509rset.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h 460x509rset.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
419x509rset.o: ../../include/openssl/sha.h ../../include/openssl/stack.h 461x509rset.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
420x509rset.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h 462x509rset.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
421x509rset.o: ../cryptlib.h 463x509rset.o: ../../include/openssl/x509_vfy.h ../cryptlib.h
422x509spki.o: ../../include/openssl/asn1.h ../../include/openssl/asn1_mac.h 464x509spki.o: ../../include/openssl/asn1.h ../../include/openssl/asn1_mac.h
423x509spki.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h 465x509spki.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
424x509spki.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h 466x509spki.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
@@ -427,16 +469,17 @@ x509spki.o: ../../include/openssl/des.h ../../include/openssl/dh.h
427x509spki.o: ../../include/openssl/dsa.h ../../include/openssl/e_os.h 469x509spki.o: ../../include/openssl/dsa.h ../../include/openssl/e_os.h
428x509spki.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h 470x509spki.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
429x509spki.o: ../../include/openssl/evp.h ../../include/openssl/idea.h 471x509spki.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
430x509spki.o: ../../include/openssl/md2.h ../../include/openssl/md5.h 472x509spki.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
431x509spki.o: ../../include/openssl/mdc2.h ../../include/openssl/objects.h 473x509spki.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
432x509spki.o: ../../include/openssl/opensslconf.h 474x509spki.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
475x509spki.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
433x509spki.o: ../../include/openssl/opensslv.h ../../include/openssl/pkcs7.h 476x509spki.o: ../../include/openssl/opensslv.h ../../include/openssl/pkcs7.h
434x509spki.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h 477x509spki.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
435x509spki.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h 478x509spki.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
436x509spki.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h 479x509spki.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
437x509spki.o: ../../include/openssl/sha.h ../../include/openssl/stack.h 480x509spki.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
438x509spki.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h 481x509spki.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
439x509spki.o: ../cryptlib.h 482x509spki.o: ../../include/openssl/x509_vfy.h ../cryptlib.h
440x509type.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h 483x509type.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
441x509type.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h 484x509type.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
442x509type.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h 485x509type.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
@@ -444,16 +487,18 @@ x509type.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
444x509type.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h 487x509type.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
445x509type.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h 488x509type.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h
446x509type.o: ../../include/openssl/err.h ../../include/openssl/evp.h 489x509type.o: ../../include/openssl/err.h ../../include/openssl/evp.h
447x509type.o: ../../include/openssl/idea.h ../../include/openssl/md2.h 490x509type.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
491x509type.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
448x509type.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h 492x509type.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
449x509type.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h 493x509type.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
494x509type.o: ../../include/openssl/opensslconf.h
450x509type.o: ../../include/openssl/opensslv.h ../../include/openssl/pkcs7.h 495x509type.o: ../../include/openssl/opensslv.h ../../include/openssl/pkcs7.h
451x509type.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h 496x509type.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
452x509type.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h 497x509type.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
453x509type.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h 498x509type.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
454x509type.o: ../../include/openssl/sha.h ../../include/openssl/stack.h 499x509type.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
455x509type.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h 500x509type.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
456x509type.o: ../cryptlib.h 501x509type.o: ../../include/openssl/x509_vfy.h ../cryptlib.h
457x_all.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h 502x_all.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
458x_all.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h 503x_all.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
459x_all.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h 504x_all.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
@@ -461,13 +506,15 @@ x_all.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
461x_all.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h 506x_all.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
462x_all.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h 507x_all.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h
463x_all.o: ../../include/openssl/err.h ../../include/openssl/evp.h 508x_all.o: ../../include/openssl/err.h ../../include/openssl/evp.h
464x_all.o: ../../include/openssl/idea.h ../../include/openssl/md2.h 509x_all.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
510x_all.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
465x_all.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h 511x_all.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
466x_all.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h 512x_all.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
467x_all.o: ../../include/openssl/opensslv.h ../../include/openssl/pkcs7.h 513x_all.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
468x_all.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h 514x_all.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
469x_all.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h 515x_all.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
470x_all.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h 516x_all.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
471x_all.o: ../../include/openssl/sha.h ../../include/openssl/stack.h 517x_all.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
518x_all.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
472x_all.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h 519x_all.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
473x_all.o: ../cryptlib.h 520x_all.o: ../cryptlib.h
diff --git a/src/lib/libcrypto/x509/by_dir.c b/src/lib/libcrypto/x509/by_dir.c
index 14d12c56bd..cac64a6f40 100644
--- a/src/lib/libcrypto/x509/by_dir.c
+++ b/src/lib/libcrypto/x509/by_dir.c
@@ -146,11 +146,11 @@ static int new_dir(X509_LOOKUP *lu)
146 { 146 {
147 BY_DIR *a; 147 BY_DIR *a;
148 148
149 if ((a=(BY_DIR *)Malloc(sizeof(BY_DIR))) == NULL) 149 if ((a=(BY_DIR *)OPENSSL_malloc(sizeof(BY_DIR))) == NULL)
150 return(0); 150 return(0);
151 if ((a->buffer=BUF_MEM_new()) == NULL) 151 if ((a->buffer=BUF_MEM_new()) == NULL)
152 { 152 {
153 Free(a); 153 OPENSSL_free(a);
154 return(0); 154 return(0);
155 } 155 }
156 a->num_dirs=0; 156 a->num_dirs=0;
@@ -168,11 +168,11 @@ static void free_dir(X509_LOOKUP *lu)
168 168
169 a=(BY_DIR *)lu->method_data; 169 a=(BY_DIR *)lu->method_data;
170 for (i=0; i<a->num_dirs; i++) 170 for (i=0; i<a->num_dirs; i++)
171 if (a->dirs[i] != NULL) Free(a->dirs[i]); 171 if (a->dirs[i] != NULL) OPENSSL_free(a->dirs[i]);
172 if (a->dirs != NULL) Free(a->dirs); 172 if (a->dirs != NULL) OPENSSL_free(a->dirs);
173 if (a->dirs_type != NULL) Free(a->dirs_type); 173 if (a->dirs_type != NULL) OPENSSL_free(a->dirs_type);
174 if (a->buffer != NULL) BUF_MEM_free(a->buffer); 174 if (a->buffer != NULL) BUF_MEM_free(a->buffer);
175 Free(a); 175 OPENSSL_free(a);
176 } 176 }
177 177
178static int add_cert_dir(BY_DIR *ctx, const char *dir, int type) 178static int add_cert_dir(BY_DIR *ctx, const char *dir, int type)
@@ -204,9 +204,9 @@ static int add_cert_dir(BY_DIR *ctx, const char *dir, int type)
204 if (ctx->num_dirs_alloced < (ctx->num_dirs+1)) 204 if (ctx->num_dirs_alloced < (ctx->num_dirs+1))
205 { 205 {
206 ctx->num_dirs_alloced+=10; 206 ctx->num_dirs_alloced+=10;
207 pp=(char **)Malloc(ctx->num_dirs_alloced* 207 pp=(char **)OPENSSL_malloc(ctx->num_dirs_alloced*
208 sizeof(char *)); 208 sizeof(char *));
209 ip=(int *)Malloc(ctx->num_dirs_alloced* 209 ip=(int *)OPENSSL_malloc(ctx->num_dirs_alloced*
210 sizeof(int)); 210 sizeof(int));
211 if ((pp == NULL) || (ip == NULL)) 211 if ((pp == NULL) || (ip == NULL))
212 { 212 {
@@ -218,14 +218,14 @@ static int add_cert_dir(BY_DIR *ctx, const char *dir, int type)
218 memcpy(ip,ctx->dirs_type,(ctx->num_dirs_alloced-10)* 218 memcpy(ip,ctx->dirs_type,(ctx->num_dirs_alloced-10)*
219 sizeof(int)); 219 sizeof(int));
220 if (ctx->dirs != NULL) 220 if (ctx->dirs != NULL)
221 Free(ctx->dirs); 221 OPENSSL_free(ctx->dirs);
222 if (ctx->dirs_type != NULL) 222 if (ctx->dirs_type != NULL)
223 Free(ctx->dirs_type); 223 OPENSSL_free(ctx->dirs_type);
224 ctx->dirs=pp; 224 ctx->dirs=pp;
225 ctx->dirs_type=ip; 225 ctx->dirs_type=ip;
226 } 226 }
227 ctx->dirs_type[ctx->num_dirs]=type; 227 ctx->dirs_type[ctx->num_dirs]=type;
228 ctx->dirs[ctx->num_dirs]=(char *)Malloc((unsigned int)len+1); 228 ctx->dirs[ctx->num_dirs]=(char *)OPENSSL_malloc((unsigned int)len+1);
229 if (ctx->dirs[ctx->num_dirs] == NULL) return(0); 229 if (ctx->dirs[ctx->num_dirs] == NULL) return(0);
230 strncpy(ctx->dirs[ctx->num_dirs],ss,(unsigned int)len); 230 strncpy(ctx->dirs[ctx->num_dirs],ss,(unsigned int)len);
231 ctx->dirs[ctx->num_dirs][len]='\0'; 231 ctx->dirs[ctx->num_dirs][len]='\0';
@@ -326,7 +326,9 @@ static int get_cert_by_subject(X509_LOOKUP *xl, int type, X509_NAME *name,
326 /* we have added it to the cache so now pull 326 /* we have added it to the cache so now pull
327 * it out again */ 327 * it out again */
328 CRYPTO_r_lock(CRYPTO_LOCK_X509_STORE); 328 CRYPTO_r_lock(CRYPTO_LOCK_X509_STORE);
329 tmp=(X509_OBJECT *)lh_retrieve(xl->store_ctx->certs,&stmp); 329 j = sk_X509_OBJECT_find(xl->store_ctx->objs,&stmp);
330 if(j != -1) tmp=sk_X509_OBJECT_value(xl->store_ctx->objs,i);
331 else tmp = NULL;
330 CRYPTO_r_unlock(CRYPTO_LOCK_X509_STORE); 332 CRYPTO_r_unlock(CRYPTO_LOCK_X509_STORE);
331 333
332 if (tmp != NULL) 334 if (tmp != NULL)
diff --git a/src/lib/libcrypto/x509/x509.h b/src/lib/libcrypto/x509/x509.h
index 0192272e7c..813c8adffd 100644
--- a/src/lib/libcrypto/x509/x509.h
+++ b/src/lib/libcrypto/x509/x509.h
@@ -59,15 +59,16 @@
59#ifndef HEADER_X509_H 59#ifndef HEADER_X509_H
60#define HEADER_X509_H 60#define HEADER_X509_H
61 61
62#ifdef __cplusplus 62#include <openssl/symhacks.h>
63extern "C" { 63#ifndef NO_BUFFER
64#include <openssl/buffer.h>
64#endif 65#endif
65 66#ifndef NO_EVP
66#ifdef VMS 67#include <openssl/evp.h>
67#undef X509_REVOKED_get_ext_by_critical 68#endif
68#define X509_REVOKED_get_ext_by_critical X509_REVOKED_get_ext_by_critic 69#ifndef NO_BIO
70#include <openssl/bio.h>
69#endif 71#endif
70
71#include <openssl/stack.h> 72#include <openssl/stack.h>
72#include <openssl/asn1.h> 73#include <openssl/asn1.h>
73#include <openssl/safestack.h> 74#include <openssl/safestack.h>
@@ -87,11 +88,19 @@ extern "C" {
87#include <openssl/evp.h> 88#include <openssl/evp.h>
88 89
89 90
91#ifdef __cplusplus
92extern "C" {
93#endif
94
90#ifdef WIN32 95#ifdef WIN32
91/* Under Win32 this is defined in wincrypt.h */ 96/* Under Win32 this is defined in wincrypt.h */
92#undef X509_NAME 97#undef X509_NAME
93#endif 98#endif
94 99
100 /* If placed in pkcs12.h, we end up with a circular depency with pkcs7.h */
101#define DECLARE_PKCS12_STACK_OF(type) /* Nothing */
102#define IMPLEMENT_PKCS12_STACK_OF(type) /* Nothing */
103
95#define X509_FILETYPE_PEM 1 104#define X509_FILETYPE_PEM 1
96#define X509_FILETYPE_ASN1 2 105#define X509_FILETYPE_ASN1 2
97#define X509_FILETYPE_DEFAULT 3 106#define X509_FILETYPE_DEFAULT 3
@@ -125,8 +134,8 @@ DECLARE_ASN1_SET_OF(X509_ALGOR)
125 134
126typedef struct X509_val_st 135typedef struct X509_val_st
127 { 136 {
128 ASN1_UTCTIME *notBefore; 137 ASN1_TIME *notBefore;
129 ASN1_UTCTIME *notAfter; 138 ASN1_TIME *notAfter;
130 } X509_VAL; 139 } X509_VAL;
131 140
132typedef struct X509_pubkey_st 141typedef struct X509_pubkey_st
@@ -158,7 +167,7 @@ typedef struct X509_name_st
158 { 167 {
159 STACK_OF(X509_NAME_ENTRY) *entries; 168 STACK_OF(X509_NAME_ENTRY) *entries;
160 int modified; /* true if 'bytes' needs to be built */ 169 int modified; /* true if 'bytes' needs to be built */
161#ifdef HEADER_BUFFER_H 170#ifndef NO_BUFFER
162 BUF_MEM *bytes; 171 BUF_MEM *bytes;
163#else 172#else
164 char *bytes; 173 char *bytes;
@@ -200,6 +209,8 @@ DECLARE_ASN1_SET_OF(X509_ATTRIBUTE)
200 209
201typedef struct X509_req_info_st 210typedef struct X509_req_info_st
202 { 211 {
212 unsigned char *asn1;
213 int length;
203 ASN1_INTEGER *version; 214 ASN1_INTEGER *version;
204 X509_NAME *subject; 215 X509_NAME *subject;
205 X509_PUBKEY *pubkey; 216 X509_PUBKEY *pubkey;
@@ -260,6 +271,8 @@ typedef struct x509_st
260 unsigned long ex_kusage; 271 unsigned long ex_kusage;
261 unsigned long ex_xkusage; 272 unsigned long ex_xkusage;
262 unsigned long ex_nscert; 273 unsigned long ex_nscert;
274 ASN1_OCTET_STRING *skid;
275 struct AUTHORITY_KEYID_st *akid;
263#ifndef NO_SHA 276#ifndef NO_SHA
264 unsigned char sha1_hash[SHA_DIGEST_LENGTH]; 277 unsigned char sha1_hash[SHA_DIGEST_LENGTH];
265#endif 278#endif
@@ -307,10 +320,65 @@ DECLARE_STACK_OF(X509_TRUST)
307#define X509_TRUST_REJECTED 2 320#define X509_TRUST_REJECTED 2
308#define X509_TRUST_UNTRUSTED 3 321#define X509_TRUST_UNTRUSTED 3
309 322
323/* Flags specific to X509_NAME_print_ex() */
324
325/* The field separator information */
326
327#define XN_FLAG_SEP_MASK (0xf << 16)
328
329#define XN_FLAG_COMPAT 0 /* Traditional SSLeay: use old X509_NAME_print */
330#define XN_FLAG_SEP_COMMA_PLUS (1 << 16) /* RFC2253 ,+ */
331#define XN_FLAG_SEP_CPLUS_SPC (2 << 16) /* ,+ spaced: more readable */
332#define XN_FLAG_SEP_SPLUS_SPC (3 << 16) /* ;+ spaced */
333#define XN_FLAG_SEP_MULTILINE (4 << 16) /* One line per field */
334
335#define XN_FLAG_DN_REV (1 << 20) /* Reverse DN order */
336
337/* How the field name is shown */
338
339#define XN_FLAG_FN_MASK (0x3 << 21)
340
341#define XN_FLAG_FN_SN 0 /* Object short name */
342#define XN_FLAG_FN_LN (1 << 21) /* Object long name */
343#define XN_FLAG_FN_OID (2 << 21) /* Always use OIDs */
344#define XN_FLAG_FN_NONE (3 << 21) /* No field names */
345
346#define XN_FLAG_SPC_EQ (1 << 23) /* Put spaces round '=' */
347
348/* This determines if we dump fields we don't recognise:
349 * RFC2253 requires this.
350 */
351
352#define XN_FLAG_DUMP_UNKNOWN_FIELDS (1 << 24)
353
354/* Complete set of RFC2253 flags */
355
356#define XN_FLAG_RFC2253 (ASN1_STRFLGS_RFC2253 | \
357 XN_FLAG_SEP_COMMA_PLUS | \
358 XN_FLAG_DN_REV | \
359 XN_FLAG_FN_SN | \
360 XN_FLAG_DUMP_UNKNOWN_FIELDS)
361
362/* readable oneline form */
363
364#define XN_FLAG_ONELINE (ASN1_STRFLGS_RFC2253 | \
365 ASN1_STRFLGS_ESC_QUOTE | \
366 XN_FLAG_SEP_CPLUS_SPC | \
367 XN_FLAG_SPC_EQ | \
368 XN_FLAG_FN_SN)
369
370/* readable multiline form */
371
372#define XN_FLAG_MULTILINE (ASN1_STRFLGS_ESC_CTRL | \
373 ASN1_STRFLGS_ESC_MSB | \
374 XN_FLAG_SEP_MULTILINE | \
375 XN_FLAG_SPC_EQ | \
376 XN_FLAG_FN_LN)
377
310typedef struct X509_revoked_st 378typedef struct X509_revoked_st
311 { 379 {
312 ASN1_INTEGER *serialNumber; 380 ASN1_INTEGER *serialNumber;
313 ASN1_UTCTIME *revocationDate; 381 ASN1_TIME *revocationDate;
314 STACK_OF(X509_EXTENSION) /* optional */ *extensions; 382 STACK_OF(X509_EXTENSION) /* optional */ *extensions;
315 int sequence; /* load sequence */ 383 int sequence; /* load sequence */
316 } X509_REVOKED; 384 } X509_REVOKED;
@@ -323,8 +391,8 @@ typedef struct X509_crl_info_st
323 ASN1_INTEGER *version; 391 ASN1_INTEGER *version;
324 X509_ALGOR *sig_alg; 392 X509_ALGOR *sig_alg;
325 X509_NAME *issuer; 393 X509_NAME *issuer;
326 ASN1_UTCTIME *lastUpdate; 394 ASN1_TIME *lastUpdate;
327 ASN1_UTCTIME *nextUpdate; 395 ASN1_TIME *nextUpdate;
328 STACK_OF(X509_REVOKED) *revoked; 396 STACK_OF(X509_REVOKED) *revoked;
329 STACK_OF(X509_EXTENSION) /* [0] */ *extensions; 397 STACK_OF(X509_EXTENSION) /* [0] */ *extensions;
330 } X509_CRL_INFO; 398 } X509_CRL_INFO;
@@ -362,7 +430,7 @@ typedef struct private_key_st
362 int references; 430 int references;
363 } X509_PKEY; 431 } X509_PKEY;
364 432
365#ifdef HEADER_ENVELOPE_H 433#ifndef NO_EVP
366typedef struct X509_info_st 434typedef struct X509_info_st
367 { 435 {
368 X509 *x509; 436 X509 *x509;
@@ -445,9 +513,17 @@ typedef struct pkcs8_priv_key_info_st
445 STACK_OF(X509_ATTRIBUTE) *attributes; 513 STACK_OF(X509_ATTRIBUTE) *attributes;
446 } PKCS8_PRIV_KEY_INFO; 514 } PKCS8_PRIV_KEY_INFO;
447 515
516#ifdef __cplusplus
517}
518#endif
519
448#include <openssl/x509_vfy.h> 520#include <openssl/x509_vfy.h>
449#include <openssl/pkcs7.h> 521#include <openssl/pkcs7.h>
450 522
523#ifdef __cplusplus
524extern "C" {
525#endif
526
451#ifdef SSLEAY_MACROS 527#ifdef SSLEAY_MACROS
452#define X509_verify(a,r) ASN1_verify((int (*)())i2d_X509_CINF,a->sig_alg,\ 528#define X509_verify(a,r) ASN1_verify((int (*)())i2d_X509_CINF,a->sig_alg,\
453 a->signature,(char *)a->cert_info,r) 529 a->signature,(char *)a->cert_info,r)
@@ -610,7 +686,7 @@ typedef struct pkcs8_priv_key_info_st
610const char *X509_verify_cert_error_string(long n); 686const char *X509_verify_cert_error_string(long n);
611 687
612#ifndef SSLEAY_MACROS 688#ifndef SSLEAY_MACROS
613#ifdef HEADER_ENVELOPE_H 689#ifndef NO_EVP
614int X509_verify(X509 *a, EVP_PKEY *r); 690int X509_verify(X509 *a, EVP_PKEY *r);
615 691
616int X509_REQ_verify(X509_REQ *a, EVP_PKEY *r); 692int X509_REQ_verify(X509_REQ *a, EVP_PKEY *r);
@@ -629,9 +705,14 @@ int X509_REQ_sign(X509_REQ *x, EVP_PKEY *pkey, const EVP_MD *md);
629int X509_CRL_sign(X509_CRL *x, EVP_PKEY *pkey, const EVP_MD *md); 705int X509_CRL_sign(X509_CRL *x, EVP_PKEY *pkey, const EVP_MD *md);
630int NETSCAPE_SPKI_sign(NETSCAPE_SPKI *x, EVP_PKEY *pkey, const EVP_MD *md); 706int NETSCAPE_SPKI_sign(NETSCAPE_SPKI *x, EVP_PKEY *pkey, const EVP_MD *md);
631 707
632int X509_digest(X509 *data,const EVP_MD *type,unsigned char *md,unsigned int *len); 708int X509_digest(const X509 *data,const EVP_MD *type,
633int X509_NAME_digest(X509_NAME *data,const EVP_MD *type, 709 unsigned char *md, unsigned int *len);
634 unsigned char *md,unsigned int *len); 710int X509_CRL_digest(const X509_CRL *data,const EVP_MD *type,
711 unsigned char *md, unsigned int *len);
712int X509_REQ_digest(const X509_REQ *data,const EVP_MD *type,
713 unsigned char *md, unsigned int *len);
714int X509_NAME_digest(const X509_NAME *data,const EVP_MD *type,
715 unsigned char *md, unsigned int *len);
635#endif 716#endif
636 717
637#ifndef NO_FP_API 718#ifndef NO_FP_API
@@ -663,9 +744,11 @@ int i2d_PKCS8_PRIV_KEY_INFO_fp(FILE *fp,PKCS8_PRIV_KEY_INFO *p8inf);
663int i2d_PKCS8PrivateKeyInfo_fp(FILE *fp, EVP_PKEY *key); 744int i2d_PKCS8PrivateKeyInfo_fp(FILE *fp, EVP_PKEY *key);
664int i2d_PrivateKey_fp(FILE *fp, EVP_PKEY *pkey); 745int i2d_PrivateKey_fp(FILE *fp, EVP_PKEY *pkey);
665EVP_PKEY *d2i_PrivateKey_fp(FILE *fp, EVP_PKEY **a); 746EVP_PKEY *d2i_PrivateKey_fp(FILE *fp, EVP_PKEY **a);
747int i2d_PUBKEY_fp(FILE *fp, EVP_PKEY *pkey);
748EVP_PKEY *d2i_PUBKEY_fp(FILE *fp, EVP_PKEY **a);
666#endif 749#endif
667 750
668#ifdef HEADER_BIO_H 751#ifndef NO_BIO
669X509 *d2i_X509_bio(BIO *bp,X509 **x509); 752X509 *d2i_X509_bio(BIO *bp,X509 **x509);
670int i2d_X509_bio(BIO *bp,X509 *x509); 753int i2d_X509_bio(BIO *bp,X509 *x509);
671X509_CRL *d2i_X509_CRL_bio(BIO *bp,X509_CRL **crl); 754X509_CRL *d2i_X509_CRL_bio(BIO *bp,X509_CRL **crl);
@@ -694,6 +777,8 @@ int i2d_PKCS8_PRIV_KEY_INFO_bio(BIO *bp,PKCS8_PRIV_KEY_INFO *p8inf);
694int i2d_PKCS8PrivateKeyInfo_bio(BIO *bp, EVP_PKEY *key); 777int i2d_PKCS8PrivateKeyInfo_bio(BIO *bp, EVP_PKEY *key);
695int i2d_PrivateKey_bio(BIO *bp, EVP_PKEY *pkey); 778int i2d_PrivateKey_bio(BIO *bp, EVP_PKEY *pkey);
696EVP_PKEY *d2i_PrivateKey_bio(BIO *bp, EVP_PKEY **a); 779EVP_PKEY *d2i_PrivateKey_bio(BIO *bp, EVP_PKEY **a);
780int i2d_PUBKEY_bio(BIO *bp, EVP_PKEY *pkey);
781EVP_PKEY *d2i_PUBKEY_bio(BIO *bp, EVP_PKEY **a);
697#endif 782#endif
698 783
699X509 *X509_dup(X509 *x509); 784X509 *X509_dup(X509 *x509);
@@ -711,8 +796,10 @@ RSA *RSAPrivateKey_dup(RSA *rsa);
711 796
712#endif /* !SSLEAY_MACROS */ 797#endif /* !SSLEAY_MACROS */
713 798
714int X509_cmp_current_time(ASN1_UTCTIME *s); 799int X509_cmp_time(ASN1_TIME *s, time_t *t);
715ASN1_UTCTIME * X509_gmtime_adj(ASN1_UTCTIME *s, long adj); 800int X509_cmp_current_time(ASN1_TIME *s);
801ASN1_TIME * X509_time_adj(ASN1_TIME *s, long adj, time_t *t);
802ASN1_TIME * X509_gmtime_adj(ASN1_TIME *s, long adj);
716 803
717const char * X509_get_default_cert_area(void ); 804const char * X509_get_default_cert_area(void );
718const char * X509_get_default_cert_dir(void ); 805const char * X509_get_default_cert_dir(void );
@@ -825,6 +912,7 @@ int i2d_X509_CERT_AUX(X509_CERT_AUX *a,unsigned char **pp);
825X509_CERT_AUX * d2i_X509_CERT_AUX(X509_CERT_AUX **a,unsigned char **pp, 912X509_CERT_AUX * d2i_X509_CERT_AUX(X509_CERT_AUX **a,unsigned char **pp,
826 long length); 913 long length);
827int X509_alias_set1(X509 *x, unsigned char *name, int len); 914int X509_alias_set1(X509 *x, unsigned char *name, int len);
915int X509_keyid_set1(X509 *x, unsigned char *id, int len);
828unsigned char * X509_alias_get0(X509 *x, int *len); 916unsigned char * X509_alias_get0(X509 *x, int *len);
829int (*X509_TRUST_set_default(int (*trust)(int , X509 *, int)))(int, X509 *, int); 917int (*X509_TRUST_set_default(int (*trust)(int , X509 *, int)))(int, X509 *, int);
830int X509_add1_trust_object(X509 *x, ASN1_OBJECT *obj); 918int X509_add1_trust_object(X509 *x, ASN1_OBJECT *obj);
@@ -871,7 +959,7 @@ NETSCAPE_CERT_SEQUENCE *NETSCAPE_CERT_SEQUENCE_new(void);
871NETSCAPE_CERT_SEQUENCE *d2i_NETSCAPE_CERT_SEQUENCE(NETSCAPE_CERT_SEQUENCE **a, unsigned char **pp, long length); 959NETSCAPE_CERT_SEQUENCE *d2i_NETSCAPE_CERT_SEQUENCE(NETSCAPE_CERT_SEQUENCE **a, unsigned char **pp, long length);
872void NETSCAPE_CERT_SEQUENCE_free(NETSCAPE_CERT_SEQUENCE *a); 960void NETSCAPE_CERT_SEQUENCE_free(NETSCAPE_CERT_SEQUENCE *a);
873 961
874#ifdef HEADER_ENVELOPE_H 962#ifndef NO_EVP
875X509_INFO * X509_INFO_new(void); 963X509_INFO * X509_INFO_new(void);
876void X509_INFO_free(X509_INFO *a); 964void X509_INFO_free(X509_INFO *a);
877char * X509_NAME_oneline(X509_NAME *a,char *buf,int size); 965char * X509_NAME_oneline(X509_NAME *a,char *buf,int size);
@@ -894,8 +982,8 @@ int X509_set_issuer_name(X509 *x, X509_NAME *name);
894X509_NAME * X509_get_issuer_name(X509 *a); 982X509_NAME * X509_get_issuer_name(X509 *a);
895int X509_set_subject_name(X509 *x, X509_NAME *name); 983int X509_set_subject_name(X509 *x, X509_NAME *name);
896X509_NAME * X509_get_subject_name(X509 *a); 984X509_NAME * X509_get_subject_name(X509 *a);
897int X509_set_notBefore(X509 *x, ASN1_UTCTIME *tm); 985int X509_set_notBefore(X509 *x, ASN1_TIME *tm);
898int X509_set_notAfter(X509 *x, ASN1_UTCTIME *tm); 986int X509_set_notAfter(X509 *x, ASN1_TIME *tm);
899int X509_set_pubkey(X509 *x, EVP_PKEY *pkey); 987int X509_set_pubkey(X509 *x, EVP_PKEY *pkey);
900EVP_PKEY * X509_get_pubkey(X509 *x); 988EVP_PKEY * X509_get_pubkey(X509 *x);
901int X509_certificate_type(X509 *x,EVP_PKEY *pubkey /* optional */); 989int X509_certificate_type(X509 *x,EVP_PKEY *pubkey /* optional */);
@@ -931,28 +1019,30 @@ int X509_REQ_add1_attr_by_txt(X509_REQ *req,
931 1019
932int X509_check_private_key(X509 *x509,EVP_PKEY *pkey); 1020int X509_check_private_key(X509 *x509,EVP_PKEY *pkey);
933 1021
934int X509_issuer_and_serial_cmp(X509 *a, X509 *b); 1022int X509_issuer_and_serial_cmp(const X509 *a, const X509 *b);
935unsigned long X509_issuer_and_serial_hash(X509 *a); 1023unsigned long X509_issuer_and_serial_hash(X509 *a);
936 1024
937int X509_issuer_name_cmp(X509 *a, X509 *b); 1025int X509_issuer_name_cmp(const X509 *a, const X509 *b);
938unsigned long X509_issuer_name_hash(X509 *a); 1026unsigned long X509_issuer_name_hash(X509 *a);
939 1027
940int X509_subject_name_cmp(X509 *a,X509 *b); 1028int X509_subject_name_cmp(const X509 *a, const X509 *b);
941unsigned long X509_subject_name_hash(X509 *x); 1029unsigned long X509_subject_name_hash(X509 *x);
942 1030
943int X509_cmp (X509 *a, X509 *b); 1031int X509_cmp(const X509 *a, const X509 *b);
944int X509_NAME_cmp (X509_NAME *a, X509_NAME *b); 1032int X509_NAME_cmp(const X509_NAME *a, const X509_NAME *b);
945unsigned long X509_NAME_hash(X509_NAME *x); 1033unsigned long X509_NAME_hash(X509_NAME *x);
946 1034
947int X509_CRL_cmp(X509_CRL *a,X509_CRL *b); 1035int X509_CRL_cmp(const X509_CRL *a, const X509_CRL *b);
948#ifndef NO_FP_API 1036#ifndef NO_FP_API
949int X509_print_fp(FILE *bp,X509 *x); 1037int X509_print_fp(FILE *bp,X509 *x);
950int X509_CRL_print_fp(FILE *bp,X509_CRL *x); 1038int X509_CRL_print_fp(FILE *bp,X509_CRL *x);
951int X509_REQ_print_fp(FILE *bp,X509_REQ *req); 1039int X509_REQ_print_fp(FILE *bp,X509_REQ *req);
1040int X509_NAME_print_ex_fp(FILE *fp, X509_NAME *nm, int indent, unsigned long flags);
952#endif 1041#endif
953 1042
954#ifdef HEADER_BIO_H 1043#ifndef NO_BIO
955int X509_NAME_print(BIO *bp, X509_NAME *name, int obase); 1044int X509_NAME_print(BIO *bp, X509_NAME *name, int obase);
1045int X509_NAME_print_ex(BIO *out, X509_NAME *nm, int indent, unsigned long flags);
956int X509_print(BIO *bp,X509 *x); 1046int X509_print(BIO *bp,X509 *x);
957int X509_CERT_AUX_print(BIO *bp,X509_CERT_AUX *x, int indent); 1047int X509_CERT_AUX_print(BIO *bp,X509_CERT_AUX *x, int indent);
958int X509_CRL_print(BIO *bp,X509_CRL *x); 1048int X509_CRL_print(BIO *bp,X509_CRL *x);
diff --git a/src/lib/libcrypto/x509/x509_cmp.c b/src/lib/libcrypto/x509/x509_cmp.c
index a8a5ca8b03..b147d573d2 100644
--- a/src/lib/libcrypto/x509/x509_cmp.c
+++ b/src/lib/libcrypto/x509/x509_cmp.c
@@ -63,7 +63,7 @@
63#include <openssl/x509.h> 63#include <openssl/x509.h>
64#include <openssl/x509v3.h> 64#include <openssl/x509v3.h>
65 65
66int X509_issuer_and_serial_cmp(X509 *a, X509 *b) 66int X509_issuer_and_serial_cmp(const X509 *a, const X509 *b)
67 { 67 {
68 int i; 68 int i;
69 X509_CINF *ai,*bi; 69 X509_CINF *ai,*bi;
@@ -97,17 +97,17 @@ unsigned long X509_issuer_and_serial_hash(X509 *a)
97 } 97 }
98#endif 98#endif
99 99
100int X509_issuer_name_cmp(X509 *a, X509 *b) 100int X509_issuer_name_cmp(const X509 *a, const X509 *b)
101 { 101 {
102 return(X509_NAME_cmp(a->cert_info->issuer,b->cert_info->issuer)); 102 return(X509_NAME_cmp(a->cert_info->issuer,b->cert_info->issuer));
103 } 103 }
104 104
105int X509_subject_name_cmp(X509 *a, X509 *b) 105int X509_subject_name_cmp(const X509 *a, const X509 *b)
106 { 106 {
107 return(X509_NAME_cmp(a->cert_info->subject,b->cert_info->subject)); 107 return(X509_NAME_cmp(a->cert_info->subject,b->cert_info->subject));
108 } 108 }
109 109
110int X509_CRL_cmp(X509_CRL *a, X509_CRL *b) 110int X509_CRL_cmp(const X509_CRL *a, const X509_CRL *b)
111 { 111 {
112 return(X509_NAME_cmp(a->crl->issuer,b->crl->issuer)); 112 return(X509_NAME_cmp(a->crl->issuer,b->crl->issuer));
113 } 113 }
@@ -139,19 +139,25 @@ unsigned long X509_subject_name_hash(X509 *x)
139 139
140#ifndef NO_SHA 140#ifndef NO_SHA
141/* Compare two certificates: they must be identical for 141/* Compare two certificates: they must be identical for
142 * this to work. 142 * this to work. NB: Although "cmp" operations are generally
143 * prototyped to take "const" arguments (eg. for use in
144 * STACKs), the way X509 handling is - these operations may
145 * involve ensuring the hashes are up-to-date and ensuring
146 * certain cert information is cached. So this is the point
147 * where the "depth-first" constification tree has to halt
148 * with an evil cast.
143 */ 149 */
144int X509_cmp(X509 *a, X509 *b) 150int X509_cmp(const X509 *a, const X509 *b)
145{ 151{
146 /* ensure hash is valid */ 152 /* ensure hash is valid */
147 X509_check_purpose(a, -1, 0); 153 X509_check_purpose((X509 *)a, -1, 0);
148 X509_check_purpose(b, -1, 0); 154 X509_check_purpose((X509 *)b, -1, 0);
149 155
150 return memcmp(a->sha1_hash, b->sha1_hash, SHA_DIGEST_LENGTH); 156 return memcmp(a->sha1_hash, b->sha1_hash, SHA_DIGEST_LENGTH);
151} 157}
152#endif 158#endif
153 159
154int X509_NAME_cmp(X509_NAME *a, X509_NAME *b) 160int X509_NAME_cmp(const X509_NAME *a, const X509_NAME *b)
155 { 161 {
156 int i,j; 162 int i,j;
157 X509_NAME_ENTRY *na,*nb; 163 X509_NAME_ENTRY *na,*nb;
@@ -198,14 +204,14 @@ unsigned long X509_NAME_hash(X509_NAME *x)
198 204
199 i=i2d_X509_NAME(x,NULL); 205 i=i2d_X509_NAME(x,NULL);
200 if (i > sizeof(str)) 206 if (i > sizeof(str))
201 p=Malloc(i); 207 p=OPENSSL_malloc(i);
202 else 208 else
203 p=str; 209 p=str;
204 210
205 pp=p; 211 pp=p;
206 i2d_X509_NAME(x,&pp); 212 i2d_X509_NAME(x,&pp);
207 MD5((unsigned char *)p,i,&(md[0])); 213 MD5((unsigned char *)p,i,&(md[0]));
208 if (p != str) Free(p); 214 if (p != str) OPENSSL_free(p);
209 215
210 ret=( ((unsigned long)md[0] )|((unsigned long)md[1]<<8L)| 216 ret=( ((unsigned long)md[0] )|((unsigned long)md[1]<<8L)|
211 ((unsigned long)md[2]<<16L)|((unsigned long)md[3]<<24L) 217 ((unsigned long)md[2]<<16L)|((unsigned long)md[3]<<24L)
diff --git a/src/lib/libcrypto/x509/x509_lu.c b/src/lib/libcrypto/x509/x509_lu.c
index a20006d67e..863c738cad 100644
--- a/src/lib/libcrypto/x509/x509_lu.c
+++ b/src/lib/libcrypto/x509/x509_lu.c
@@ -62,14 +62,13 @@
62#include <openssl/x509.h> 62#include <openssl/x509.h>
63 63
64static STACK_OF(CRYPTO_EX_DATA_FUNCS) *x509_store_meth=NULL; 64static STACK_OF(CRYPTO_EX_DATA_FUNCS) *x509_store_meth=NULL;
65static STACK_OF(CRYPTO_EX_DATA_FUNCS) *x509_store_ctx_meth=NULL;
66 65
67X509_LOOKUP *X509_LOOKUP_new(X509_LOOKUP_METHOD *method) 66X509_LOOKUP *X509_LOOKUP_new(X509_LOOKUP_METHOD *method)
68 { 67 {
69 X509_LOOKUP *ret; 68 X509_LOOKUP *ret;
70 69
71 ret=(X509_LOOKUP *)Malloc(sizeof(X509_LOOKUP)); 70 ret=(X509_LOOKUP *)OPENSSL_malloc(sizeof(X509_LOOKUP));
72 if (ret == NULL) return(NULL); 71 if (ret == NULL) return NULL;
73 72
74 ret->init=0; 73 ret->init=0;
75 ret->skip=0; 74 ret->skip=0;
@@ -78,10 +77,10 @@ X509_LOOKUP *X509_LOOKUP_new(X509_LOOKUP_METHOD *method)
78 ret->store_ctx=NULL; 77 ret->store_ctx=NULL;
79 if ((method->new_item != NULL) && !method->new_item(ret)) 78 if ((method->new_item != NULL) && !method->new_item(ret))
80 { 79 {
81 Free(ret); 80 OPENSSL_free(ret);
82 return(NULL); 81 return NULL;
83 } 82 }
84 return(ret); 83 return ret;
85 } 84 }
86 85
87void X509_LOOKUP_free(X509_LOOKUP *ctx) 86void X509_LOOKUP_free(X509_LOOKUP *ctx)
@@ -90,44 +89,44 @@ void X509_LOOKUP_free(X509_LOOKUP *ctx)
90 if ( (ctx->method != NULL) && 89 if ( (ctx->method != NULL) &&
91 (ctx->method->free != NULL)) 90 (ctx->method->free != NULL))
92 ctx->method->free(ctx); 91 ctx->method->free(ctx);
93 Free(ctx); 92 OPENSSL_free(ctx);
94 } 93 }
95 94
96int X509_LOOKUP_init(X509_LOOKUP *ctx) 95int X509_LOOKUP_init(X509_LOOKUP *ctx)
97 { 96 {
98 if (ctx->method == NULL) return(0); 97 if (ctx->method == NULL) return 0;
99 if (ctx->method->init != NULL) 98 if (ctx->method->init != NULL)
100 return(ctx->method->init(ctx)); 99 return ctx->method->init(ctx);
101 else 100 else
102 return(1); 101 return 1;
103 } 102 }
104 103
105int X509_LOOKUP_shutdown(X509_LOOKUP *ctx) 104int X509_LOOKUP_shutdown(X509_LOOKUP *ctx)
106 { 105 {
107 if (ctx->method == NULL) return(0); 106 if (ctx->method == NULL) return 0;
108 if (ctx->method->shutdown != NULL) 107 if (ctx->method->shutdown != NULL)
109 return(ctx->method->shutdown(ctx)); 108 return ctx->method->shutdown(ctx);
110 else 109 else
111 return(1); 110 return 1;
112 } 111 }
113 112
114int X509_LOOKUP_ctrl(X509_LOOKUP *ctx, int cmd, const char *argc, long argl, 113int X509_LOOKUP_ctrl(X509_LOOKUP *ctx, int cmd, const char *argc, long argl,
115 char **ret) 114 char **ret)
116 { 115 {
117 if (ctx->method == NULL) return(-1); 116 if (ctx->method == NULL) return -1;
118 if (ctx->method->ctrl != NULL) 117 if (ctx->method->ctrl != NULL)
119 return(ctx->method->ctrl(ctx,cmd,argc,argl,ret)); 118 return ctx->method->ctrl(ctx,cmd,argc,argl,ret);
120 else 119 else
121 return(1); 120 return 1;
122 } 121 }
123 122
124int X509_LOOKUP_by_subject(X509_LOOKUP *ctx, int type, X509_NAME *name, 123int X509_LOOKUP_by_subject(X509_LOOKUP *ctx, int type, X509_NAME *name,
125 X509_OBJECT *ret) 124 X509_OBJECT *ret)
126 { 125 {
127 if ((ctx->method == NULL) || (ctx->method->get_by_subject == NULL)) 126 if ((ctx->method == NULL) || (ctx->method->get_by_subject == NULL))
128 return(X509_LU_FAIL); 127 return X509_LU_FAIL;
129 if (ctx->skip) return(0); 128 if (ctx->skip) return 0;
130 return(ctx->method->get_by_subject(ctx,type,name,ret)); 129 return ctx->method->get_by_subject(ctx,type,name,ret);
131 } 130 }
132 131
133int X509_LOOKUP_by_issuer_serial(X509_LOOKUP *ctx, int type, X509_NAME *name, 132int X509_LOOKUP_by_issuer_serial(X509_LOOKUP *ctx, int type, X509_NAME *name,
@@ -135,71 +134,55 @@ int X509_LOOKUP_by_issuer_serial(X509_LOOKUP *ctx, int type, X509_NAME *name,
135 { 134 {
136 if ((ctx->method == NULL) || 135 if ((ctx->method == NULL) ||
137 (ctx->method->get_by_issuer_serial == NULL)) 136 (ctx->method->get_by_issuer_serial == NULL))
138 return(X509_LU_FAIL); 137 return X509_LU_FAIL;
139 return(ctx->method->get_by_issuer_serial(ctx,type,name,serial,ret)); 138 return ctx->method->get_by_issuer_serial(ctx,type,name,serial,ret);
140 } 139 }
141 140
142int X509_LOOKUP_by_fingerprint(X509_LOOKUP *ctx, int type, 141int X509_LOOKUP_by_fingerprint(X509_LOOKUP *ctx, int type,
143 unsigned char *bytes, int len, X509_OBJECT *ret) 142 unsigned char *bytes, int len, X509_OBJECT *ret)
144 { 143 {
145 if ((ctx->method == NULL) || (ctx->method->get_by_fingerprint == NULL)) 144 if ((ctx->method == NULL) || (ctx->method->get_by_fingerprint == NULL))
146 return(X509_LU_FAIL); 145 return X509_LU_FAIL;
147 return(ctx->method->get_by_fingerprint(ctx,type,bytes,len,ret)); 146 return ctx->method->get_by_fingerprint(ctx,type,bytes,len,ret);
148 } 147 }
149 148
150int X509_LOOKUP_by_alias(X509_LOOKUP *ctx, int type, char *str, int len, 149int X509_LOOKUP_by_alias(X509_LOOKUP *ctx, int type, char *str, int len,
151 X509_OBJECT *ret) 150 X509_OBJECT *ret)
152 { 151 {
153 if ((ctx->method == NULL) || (ctx->method->get_by_alias == NULL)) 152 if ((ctx->method == NULL) || (ctx->method->get_by_alias == NULL))
154 return(X509_LU_FAIL); 153 return X509_LU_FAIL;
155 return(ctx->method->get_by_alias(ctx,type,str,len,ret)); 154 return ctx->method->get_by_alias(ctx,type,str,len,ret);
156 } 155 }
157 156
158static unsigned long x509_object_hash(X509_OBJECT *a) 157
159 { 158static int x509_object_cmp(const X509_OBJECT * const *a, const X509_OBJECT * const *b)
160 unsigned long h; 159 {
161 160 int ret;
162 switch (a->type) 161
163 { 162 ret=((*a)->type - (*b)->type);
164 case X509_LU_X509: 163 if (ret) return ret;
165 h=X509_NAME_hash(a->data.x509->cert_info->subject); 164 switch ((*a)->type)
166 break; 165 {
167 case X509_LU_CRL: 166 case X509_LU_X509:
168 h=X509_NAME_hash(a->data.crl->crl->issuer); 167 ret=X509_subject_name_cmp((*a)->data.x509,(*b)->data.x509);
169 break; 168 break;
170 default: 169 case X509_LU_CRL:
171 abort(); 170 ret=X509_CRL_cmp((*a)->data.crl,(*b)->data.crl);
172 } 171 break;
173 return(h);
174 }
175
176static int x509_object_cmp(X509_OBJECT *a, X509_OBJECT *b)
177 {
178 int ret;
179
180 ret=(a->type - b->type);
181 if (ret) return(ret);
182 switch (a->type)
183 {
184 case X509_LU_X509:
185 ret=X509_subject_name_cmp(a->data.x509,b->data.x509);
186 break;
187 case X509_LU_CRL:
188 ret=X509_CRL_cmp(a->data.crl,b->data.crl);
189 break;
190 default: 172 default:
191 abort(); 173 /* abort(); */
174 return 0;
192 } 175 }
193 return(ret); 176 return ret;
194 } 177 }
195 178
196X509_STORE *X509_STORE_new(void) 179X509_STORE *X509_STORE_new(void)
197 { 180 {
198 X509_STORE *ret; 181 X509_STORE *ret;
199 182
200 if ((ret=(X509_STORE *)Malloc(sizeof(X509_STORE))) == NULL) 183 if ((ret=(X509_STORE *)OPENSSL_malloc(sizeof(X509_STORE))) == NULL)
201 return(NULL); 184 return NULL;
202 ret->certs=lh_new(x509_object_hash,x509_object_cmp); 185 ret->objs = sk_X509_OBJECT_new(x509_object_cmp);
203 ret->cache=1; 186 ret->cache=1;
204 ret->get_cert_methods=sk_X509_LOOKUP_new_null(); 187 ret->get_cert_methods=sk_X509_LOOKUP_new_null();
205 ret->verify=NULL; 188 ret->verify=NULL;
@@ -207,7 +190,7 @@ X509_STORE *X509_STORE_new(void)
207 memset(&ret->ex_data,0,sizeof(CRYPTO_EX_DATA)); 190 memset(&ret->ex_data,0,sizeof(CRYPTO_EX_DATA));
208 ret->references=1; 191 ret->references=1;
209 ret->depth=0; 192 ret->depth=0;
210 return(ret); 193 return ret;
211 } 194 }
212 195
213static void cleanup(X509_OBJECT *a) 196static void cleanup(X509_OBJECT *a)
@@ -221,9 +204,11 @@ static void cleanup(X509_OBJECT *a)
221 X509_CRL_free(a->data.crl); 204 X509_CRL_free(a->data.crl);
222 } 205 }
223 else 206 else
224 abort(); 207 {
208 /* abort(); */
209 }
225 210
226 Free(a); 211 OPENSSL_free(a);
227 } 212 }
228 213
229void X509_STORE_free(X509_STORE *vfy) 214void X509_STORE_free(X509_STORE *vfy)
@@ -232,7 +217,7 @@ void X509_STORE_free(X509_STORE *vfy)
232 STACK_OF(X509_LOOKUP) *sk; 217 STACK_OF(X509_LOOKUP) *sk;
233 X509_LOOKUP *lu; 218 X509_LOOKUP *lu;
234 219
235 if(vfy == NULL) 220 if (vfy == NULL)
236 return; 221 return;
237 222
238 sk=vfy->get_cert_methods; 223 sk=vfy->get_cert_methods;
@@ -243,11 +228,10 @@ void X509_STORE_free(X509_STORE *vfy)
243 X509_LOOKUP_free(lu); 228 X509_LOOKUP_free(lu);
244 } 229 }
245 sk_X509_LOOKUP_free(sk); 230 sk_X509_LOOKUP_free(sk);
231 sk_X509_OBJECT_pop_free(vfy->objs, cleanup);
246 232
247 CRYPTO_free_ex_data(x509_store_meth,vfy,&vfy->ex_data); 233 CRYPTO_free_ex_data(x509_store_meth,vfy,&vfy->ex_data);
248 lh_doall(vfy->certs,cleanup); 234 OPENSSL_free(vfy);
249 lh_free(vfy->certs);
250 Free(vfy);
251 } 235 }
252 236
253X509_LOOKUP *X509_STORE_add_lookup(X509_STORE *v, X509_LOOKUP_METHOD *m) 237X509_LOOKUP *X509_STORE_add_lookup(X509_STORE *v, X509_LOOKUP_METHOD *m)
@@ -262,22 +246,22 @@ X509_LOOKUP *X509_STORE_add_lookup(X509_STORE *v, X509_LOOKUP_METHOD *m)
262 lu=sk_X509_LOOKUP_value(sk,i); 246 lu=sk_X509_LOOKUP_value(sk,i);
263 if (m == lu->method) 247 if (m == lu->method)
264 { 248 {
265 return(lu); 249 return lu;
266 } 250 }
267 } 251 }
268 /* a new one */ 252 /* a new one */
269 lu=X509_LOOKUP_new(m); 253 lu=X509_LOOKUP_new(m);
270 if (lu == NULL) 254 if (lu == NULL)
271 return(NULL); 255 return NULL;
272 else 256 else
273 { 257 {
274 lu->store_ctx=v; 258 lu->store_ctx=v;
275 if (sk_X509_LOOKUP_push(v->get_cert_methods,lu)) 259 if (sk_X509_LOOKUP_push(v->get_cert_methods,lu))
276 return(lu); 260 return lu;
277 else 261 else
278 { 262 {
279 X509_LOOKUP_free(lu); 263 X509_LOOKUP_free(lu);
280 return(NULL); 264 return NULL;
281 } 265 }
282 } 266 }
283 } 267 }
@@ -290,7 +274,7 @@ int X509_STORE_get_by_subject(X509_STORE_CTX *vs, int type, X509_NAME *name,
290 X509_OBJECT stmp,*tmp; 274 X509_OBJECT stmp,*tmp;
291 int i,j; 275 int i,j;
292 276
293 tmp=X509_OBJECT_retrieve_by_subject(ctx->certs,type,name); 277 tmp=X509_OBJECT_retrieve_by_subject(ctx->objs,type,name);
294 278
295 if (tmp == NULL) 279 if (tmp == NULL)
296 { 280 {
@@ -301,7 +285,7 @@ int X509_STORE_get_by_subject(X509_STORE_CTX *vs, int type, X509_NAME *name,
301 if (j < 0) 285 if (j < 0)
302 { 286 {
303 vs->current_method=j; 287 vs->current_method=j;
304 return(j); 288 return j;
305 } 289 }
306 else if (j) 290 else if (j)
307 { 291 {
@@ -311,7 +295,7 @@ int X509_STORE_get_by_subject(X509_STORE_CTX *vs, int type, X509_NAME *name,
311 } 295 }
312 vs->current_method=0; 296 vs->current_method=0;
313 if (tmp == NULL) 297 if (tmp == NULL)
314 return(0); 298 return 0;
315 } 299 }
316 300
317/* if (ret->data.ptr != NULL) 301/* if (ret->data.ptr != NULL)
@@ -322,7 +306,74 @@ int X509_STORE_get_by_subject(X509_STORE_CTX *vs, int type, X509_NAME *name,
322 306
323 X509_OBJECT_up_ref_count(ret); 307 X509_OBJECT_up_ref_count(ret);
324 308
325 return(1); 309 return 1;
310 }
311
312int X509_STORE_add_cert(X509_STORE *ctx, X509 *x)
313 {
314 X509_OBJECT *obj;
315 int ret=1;
316
317 if (x == NULL) return 0;
318 obj=(X509_OBJECT *)OPENSSL_malloc(sizeof(X509_OBJECT));
319 if (obj == NULL)
320 {
321 X509err(X509_F_X509_STORE_ADD_CERT,ERR_R_MALLOC_FAILURE);
322 return 0;
323 }
324 obj->type=X509_LU_X509;
325 obj->data.x509=x;
326
327 CRYPTO_w_lock(CRYPTO_LOCK_X509_STORE);
328
329 X509_OBJECT_up_ref_count(obj);
330
331
332 if (X509_OBJECT_retrieve_match(ctx->objs, obj))
333 {
334 X509_OBJECT_free_contents(obj);
335 OPENSSL_free(obj);
336 X509err(X509_F_X509_STORE_ADD_CERT,X509_R_CERT_ALREADY_IN_HASH_TABLE);
337 ret=0;
338 }
339 else sk_X509_OBJECT_push(ctx->objs, obj);
340
341 CRYPTO_w_unlock(CRYPTO_LOCK_X509_STORE);
342
343 return ret;
344 }
345
346int X509_STORE_add_crl(X509_STORE *ctx, X509_CRL *x)
347 {
348 X509_OBJECT *obj;
349 int ret=1;
350
351 if (x == NULL) return 0;
352 obj=(X509_OBJECT *)OPENSSL_malloc(sizeof(X509_OBJECT));
353 if (obj == NULL)
354 {
355 X509err(X509_F_X509_STORE_ADD_CRL,ERR_R_MALLOC_FAILURE);
356 return 0;
357 }
358 obj->type=X509_LU_CRL;
359 obj->data.crl=x;
360
361 CRYPTO_w_lock(CRYPTO_LOCK_X509_STORE);
362
363 X509_OBJECT_up_ref_count(obj);
364
365 if (X509_OBJECT_retrieve_match(ctx->objs, obj))
366 {
367 X509_OBJECT_free_contents(obj);
368 OPENSSL_free(obj);
369 X509err(X509_F_X509_STORE_ADD_CRL,X509_R_CERT_ALREADY_IN_HASH_TABLE);
370 ret=0;
371 }
372 else sk_X509_OBJECT_push(ctx->objs, obj);
373
374 CRYPTO_w_unlock(CRYPTO_LOCK_X509_STORE);
375
376 return ret;
326 } 377 }
327 378
328void X509_OBJECT_up_ref_count(X509_OBJECT *a) 379void X509_OBJECT_up_ref_count(X509_OBJECT *a)
@@ -351,10 +402,10 @@ void X509_OBJECT_free_contents(X509_OBJECT *a)
351 } 402 }
352 } 403 }
353 404
354X509_OBJECT *X509_OBJECT_retrieve_by_subject(LHASH *h, int type, 405int X509_OBJECT_idx_by_subject(STACK_OF(X509_OBJECT) *h, int type,
355 X509_NAME *name) 406 X509_NAME *name)
356 { 407 {
357 X509_OBJECT stmp,*tmp; 408 X509_OBJECT stmp;
358 X509 x509_s; 409 X509 x509_s;
359 X509_CINF cinf_s; 410 X509_CINF cinf_s;
360 X509_CRL crl_s; 411 X509_CRL crl_s;
@@ -374,54 +425,105 @@ X509_OBJECT *X509_OBJECT_retrieve_by_subject(LHASH *h, int type,
374 crl_info_s.issuer=name; 425 crl_info_s.issuer=name;
375 break; 426 break;
376 default: 427 default:
377 abort(); 428 /* abort(); */
429 return -1;
378 } 430 }
379 431
380 tmp=(X509_OBJECT *)lh_retrieve(h,&stmp); 432 return sk_X509_OBJECT_find(h,&stmp);
381 return(tmp);
382 } 433 }
383 434
384X509_STORE_CTX *X509_STORE_CTX_new(void) 435X509_OBJECT *X509_OBJECT_retrieve_by_subject(STACK_OF(X509_OBJECT) *h, int type,
436 X509_NAME *name)
385{ 437{
386 X509_STORE_CTX *ctx; 438 int idx;
387 ctx = (X509_STORE_CTX *)Malloc(sizeof(X509_STORE_CTX)); 439 idx = X509_OBJECT_idx_by_subject(h, type, name);
388 if(ctx) memset(ctx, 0, sizeof(X509_STORE_CTX)); 440 if (idx==-1) return NULL;
389 return ctx; 441 return sk_X509_OBJECT_value(h, idx);
390} 442}
391 443
392void X509_STORE_CTX_free(X509_STORE_CTX *ctx) 444X509_OBJECT *X509_OBJECT_retrieve_match(STACK_OF(X509_OBJECT) *h, X509_OBJECT *x)
393{ 445{
394 X509_STORE_CTX_cleanup(ctx); 446 int idx, i;
395 Free(ctx); 447 X509_OBJECT *obj;
448 idx = sk_X509_OBJECT_find(h, x);
449 if (idx == -1) return NULL;
450 if (x->type != X509_LU_X509) return sk_X509_OBJECT_value(h, idx);
451 for (i = idx; i < sk_X509_OBJECT_num(h); i++)
452 {
453 obj = sk_X509_OBJECT_value(h, i);
454 if (x509_object_cmp((const X509_OBJECT **)&obj, (const X509_OBJECT **)&x))
455 return NULL;
456 if ((x->type != X509_LU_X509) || !X509_cmp(obj->data.x509, x->data.x509))
457 return obj;
458 }
459 return NULL;
396} 460}
397 461
398void X509_STORE_CTX_init(X509_STORE_CTX *ctx, X509_STORE *store, X509 *x509,
399 STACK_OF(X509) *chain)
400 {
401 ctx->ctx=store;
402 ctx->current_method=0;
403 ctx->cert=x509;
404 ctx->untrusted=chain;
405 ctx->last_untrusted=0;
406 ctx->purpose=0;
407 ctx->trust=0;
408 ctx->valid=0;
409 ctx->chain=NULL;
410 ctx->depth=9;
411 ctx->error=0;
412 ctx->current_cert=NULL;
413 memset(&(ctx->ex_data),0,sizeof(CRYPTO_EX_DATA));
414 }
415 462
416void X509_STORE_CTX_cleanup(X509_STORE_CTX *ctx) 463/* Try to get issuer certificate from store. Due to limitations
417 { 464 * of the API this can only retrieve a single certificate matching
418 if (ctx->chain != NULL) 465 * a given subject name. However it will fill the cache with all
466 * matching certificates, so we can examine the cache for all
467 * matches.
468 *
469 * Return values are:
470 * 1 lookup successful.
471 * 0 certificate not found.
472 * -1 some other error.
473 */
474
475
476int X509_STORE_CTX_get1_issuer(X509 **issuer, X509_STORE_CTX *ctx, X509 *x)
477{
478 X509_NAME *xn;
479 X509_OBJECT obj, *pobj;
480 int i, ok, idx;
481 xn=X509_get_issuer_name(x);
482 ok=X509_STORE_get_by_subject(ctx,X509_LU_X509,xn,&obj);
483 if (ok != X509_LU_X509)
484 {
485 if (ok == X509_LU_RETRY)
486 {
487 X509_OBJECT_free_contents(&obj);
488 X509err(X509_F_X509_VERIFY_CERT,X509_R_SHOULD_RETRY);
489 return -1;
490 }
491 else if (ok != X509_LU_FAIL)
492 {
493 X509_OBJECT_free_contents(&obj);
494 /* not good :-(, break anyway */
495 return -1;
496 }
497 return 0;
498 }
499 /* If certificate matches all OK */
500 if (ctx->check_issued(ctx, x, obj.data.x509))
419 { 501 {
420 sk_X509_pop_free(ctx->chain,X509_free); 502 *issuer = obj.data.x509;
421 ctx->chain=NULL; 503 return 1;
422 } 504 }
423 CRYPTO_free_ex_data(x509_store_ctx_meth,ctx,&(ctx->ex_data)); 505 X509_OBJECT_free_contents(&obj);
424 memset(&ctx->ex_data,0,sizeof(CRYPTO_EX_DATA)); 506 /* Else find index of first matching cert */
425 } 507 idx = X509_OBJECT_idx_by_subject(ctx->ctx->objs, X509_LU_X509, xn);
508 /* This shouldn't normally happen since we already have one match */
509 if (idx == -1) return 0;
510
511 /* Look through all matching certificates for a suitable issuer */
512 for (i = idx; i < sk_X509_OBJECT_num(ctx->ctx->objs); i++)
513 {
514 pobj = sk_X509_OBJECT_value(ctx->ctx->objs, i);
515 /* See if we've ran out of matches */
516 if (pobj->type != X509_LU_X509) return 0;
517 if (X509_NAME_cmp(xn, X509_get_subject_name(pobj->data.x509))) return 0;
518 if (ctx->check_issued(ctx, x, pobj->data.x509))
519 {
520 *issuer = pobj->data.x509;
521 X509_OBJECT_up_ref_count(pobj);
522 return 1;
523 }
524 }
525 return 0;
526}
426 527
427IMPLEMENT_STACK_OF(X509_LOOKUP) 528IMPLEMENT_STACK_OF(X509_LOOKUP)
529IMPLEMENT_STACK_OF(X509_OBJECT)
diff --git a/src/lib/libcrypto/x509/x509_obj.c b/src/lib/libcrypto/x509/x509_obj.c
index 691b71f031..6a3ba8eb15 100644
--- a/src/lib/libcrypto/x509/x509_obj.c
+++ b/src/lib/libcrypto/x509/x509_obj.c
@@ -91,7 +91,7 @@ int i;
91 if(b) 91 if(b)
92 { 92 {
93 buf=b->data; 93 buf=b->data;
94 Free(b); 94 OPENSSL_free(b);
95 } 95 }
96 strncpy(buf,"NO X509_NAME",len); 96 strncpy(buf,"NO X509_NAME",len);
97 return buf; 97 return buf;
@@ -210,7 +210,7 @@ int i;
210 if (b != NULL) 210 if (b != NULL)
211 { 211 {
212 p=b->data; 212 p=b->data;
213 Free(b); 213 OPENSSL_free(b);
214 } 214 }
215 else 215 else
216 p=buf; 216 p=buf;
diff --git a/src/lib/libcrypto/x509/x509_req.c b/src/lib/libcrypto/x509/x509_req.c
index baef8790eb..7eca1bd57a 100644
--- a/src/lib/libcrypto/x509/x509_req.c
+++ b/src/lib/libcrypto/x509/x509_req.c
@@ -83,7 +83,7 @@ X509_REQ *X509_to_X509_REQ(X509 *x, EVP_PKEY *pkey, const EVP_MD *md)
83 ri=ret->req_info; 83 ri=ret->req_info;
84 84
85 ri->version->length=1; 85 ri->version->length=1;
86 ri->version->data=(unsigned char *)Malloc(1); 86 ri->version->data=(unsigned char *)OPENSSL_malloc(1);
87 if (ri->version->data == NULL) goto err; 87 if (ri->version->data == NULL) goto err;
88 ri->version->data[0]=0; /* version == 0 */ 88 ri->version->data[0]=0; /* version == 0 */
89 89
@@ -188,7 +188,7 @@ int X509_REQ_add_extensions_nid(X509_REQ *req, STACK_OF(X509_EXTENSION) *exts,
188 /* Generate encoding of extensions */ 188 /* Generate encoding of extensions */
189 len = i2d_ASN1_SET_OF_X509_EXTENSION(exts, NULL, i2d_X509_EXTENSION, 189 len = i2d_ASN1_SET_OF_X509_EXTENSION(exts, NULL, i2d_X509_EXTENSION,
190 V_ASN1_SEQUENCE, V_ASN1_UNIVERSAL, IS_SEQUENCE); 190 V_ASN1_SEQUENCE, V_ASN1_UNIVERSAL, IS_SEQUENCE);
191 if(!(p = Malloc(len))) goto err; 191 if(!(p = OPENSSL_malloc(len))) goto err;
192 q = p; 192 q = p;
193 i2d_ASN1_SET_OF_X509_EXTENSION(exts, &q, i2d_X509_EXTENSION, 193 i2d_ASN1_SET_OF_X509_EXTENSION(exts, &q, i2d_X509_EXTENSION,
194 V_ASN1_SEQUENCE, V_ASN1_UNIVERSAL, IS_SEQUENCE); 194 V_ASN1_SEQUENCE, V_ASN1_UNIVERSAL, IS_SEQUENCE);
@@ -204,7 +204,7 @@ int X509_REQ_add_extensions_nid(X509_REQ *req, STACK_OF(X509_EXTENSION) *exts,
204 if(!sk_X509_ATTRIBUTE_push(req->req_info->attributes, attr)) goto err; 204 if(!sk_X509_ATTRIBUTE_push(req->req_info->attributes, attr)) goto err;
205 return 1; 205 return 1;
206 err: 206 err:
207 if(p) Free(p); 207 if(p) OPENSSL_free(p);
208 X509_ATTRIBUTE_free(attr); 208 X509_ATTRIBUTE_free(attr);
209 ASN1_TYPE_free(at); 209 ASN1_TYPE_free(at);
210 return 0; 210 return 0;
diff --git a/src/lib/libcrypto/x509/x509_set.c b/src/lib/libcrypto/x509/x509_set.c
index add842d17a..aaf61ca062 100644
--- a/src/lib/libcrypto/x509/x509_set.c
+++ b/src/lib/libcrypto/x509/x509_set.c
@@ -104,36 +104,36 @@ int X509_set_subject_name(X509 *x, X509_NAME *name)
104 return(X509_NAME_set(&x->cert_info->subject,name)); 104 return(X509_NAME_set(&x->cert_info->subject,name));
105 } 105 }
106 106
107int X509_set_notBefore(X509 *x, ASN1_UTCTIME *tm) 107int X509_set_notBefore(X509 *x, ASN1_TIME *tm)
108 { 108 {
109 ASN1_UTCTIME *in; 109 ASN1_TIME *in;
110 110
111 if ((x == NULL) || (x->cert_info->validity == NULL)) return(0); 111 if ((x == NULL) || (x->cert_info->validity == NULL)) return(0);
112 in=x->cert_info->validity->notBefore; 112 in=x->cert_info->validity->notBefore;
113 if (in != tm) 113 if (in != tm)
114 { 114 {
115 in=M_ASN1_UTCTIME_dup(tm); 115 in=M_ASN1_TIME_dup(tm);
116 if (in != NULL) 116 if (in != NULL)
117 { 117 {
118 M_ASN1_UTCTIME_free(x->cert_info->validity->notBefore); 118 M_ASN1_TIME_free(x->cert_info->validity->notBefore);
119 x->cert_info->validity->notBefore=in; 119 x->cert_info->validity->notBefore=in;
120 } 120 }
121 } 121 }
122 return(in != NULL); 122 return(in != NULL);
123 } 123 }
124 124
125int X509_set_notAfter(X509 *x, ASN1_UTCTIME *tm) 125int X509_set_notAfter(X509 *x, ASN1_TIME *tm)
126 { 126 {
127 ASN1_UTCTIME *in; 127 ASN1_TIME *in;
128 128
129 if ((x == NULL) || (x->cert_info->validity == NULL)) return(0); 129 if ((x == NULL) || (x->cert_info->validity == NULL)) return(0);
130 in=x->cert_info->validity->notAfter; 130 in=x->cert_info->validity->notAfter;
131 if (in != tm) 131 if (in != tm)
132 { 132 {
133 in=M_ASN1_UTCTIME_dup(tm); 133 in=M_ASN1_TIME_dup(tm);
134 if (in != NULL) 134 if (in != NULL)
135 { 135 {
136 M_ASN1_UTCTIME_free(x->cert_info->validity->notAfter); 136 M_ASN1_TIME_free(x->cert_info->validity->notAfter);
137 x->cert_info->validity->notAfter=in; 137 x->cert_info->validity->notAfter=in;
138 } 138 }
139 } 139 }
diff --git a/src/lib/libcrypto/x509/x509_trs.c b/src/lib/libcrypto/x509/x509_trs.c
index c779aaf94d..a7b1543461 100644
--- a/src/lib/libcrypto/x509/x509_trs.c
+++ b/src/lib/libcrypto/x509/x509_trs.c
@@ -61,7 +61,8 @@
61#include <openssl/x509v3.h> 61#include <openssl/x509v3.h>
62 62
63 63
64static int tr_cmp(X509_TRUST **a, X509_TRUST **b); 64static int tr_cmp(const X509_TRUST * const *a,
65 const X509_TRUST * const *b);
65static void trtable_free(X509_TRUST *p); 66static void trtable_free(X509_TRUST *p);
66 67
67static int trust_1oidany(X509_TRUST *trust, X509 *x, int flags); 68static int trust_1oidany(X509_TRUST *trust, X509 *x, int flags);
@@ -88,7 +89,8 @@ IMPLEMENT_STACK_OF(X509_TRUST)
88 89
89static STACK_OF(X509_TRUST) *trtable = NULL; 90static STACK_OF(X509_TRUST) *trtable = NULL;
90 91
91static int tr_cmp(X509_TRUST **a, X509_TRUST **b) 92static int tr_cmp(const X509_TRUST * const *a,
93 const X509_TRUST * const *b)
92{ 94{
93 return (*a)->trust - (*b)->trust; 95 return (*a)->trust - (*b)->trust;
94} 96}
@@ -152,15 +154,15 @@ int X509_TRUST_add(int id, int flags, int (*ck)(X509_TRUST *, X509 *, int),
152 idx = X509_TRUST_get_by_id(id); 154 idx = X509_TRUST_get_by_id(id);
153 /* Need a new entry */ 155 /* Need a new entry */
154 if(idx == -1) { 156 if(idx == -1) {
155 if(!(trtmp = Malloc(sizeof(X509_TRUST)))) { 157 if(!(trtmp = OPENSSL_malloc(sizeof(X509_TRUST)))) {
156 X509err(X509_F_X509_TRUST_ADD,ERR_R_MALLOC_FAILURE); 158 X509err(X509_F_X509_TRUST_ADD,ERR_R_MALLOC_FAILURE);
157 return 0; 159 return 0;
158 } 160 }
159 trtmp->flags = X509_TRUST_DYNAMIC; 161 trtmp->flags = X509_TRUST_DYNAMIC;
160 } else trtmp = X509_TRUST_get0(idx); 162 } else trtmp = X509_TRUST_get0(idx);
161 163
162 /* Free existing name if dynamic */ 164 /* OPENSSL_free existing name if dynamic */
163 if(trtmp->flags & X509_TRUST_DYNAMIC_NAME) Free(trtmp->name); 165 if(trtmp->flags & X509_TRUST_DYNAMIC_NAME) OPENSSL_free(trtmp->name);
164 /* dup supplied name */ 166 /* dup supplied name */
165 if(!(trtmp->name = BUF_strdup(name))) { 167 if(!(trtmp->name = BUF_strdup(name))) {
166 X509err(X509_F_X509_TRUST_ADD,ERR_R_MALLOC_FAILURE); 168 X509err(X509_F_X509_TRUST_ADD,ERR_R_MALLOC_FAILURE);
@@ -196,8 +198,8 @@ static void trtable_free(X509_TRUST *p)
196 if (p->flags & X509_TRUST_DYNAMIC) 198 if (p->flags & X509_TRUST_DYNAMIC)
197 { 199 {
198 if (p->flags & X509_TRUST_DYNAMIC_NAME) 200 if (p->flags & X509_TRUST_DYNAMIC_NAME)
199 Free(p->name); 201 OPENSSL_free(p->name);
200 Free(p); 202 OPENSSL_free(p);
201 } 203 }
202 } 204 }
203 205
diff --git a/src/lib/libcrypto/x509/x509_txt.c b/src/lib/libcrypto/x509/x509_txt.c
index 209cf53191..cfb478d4bc 100644
--- a/src/lib/libcrypto/x509/x509_txt.c
+++ b/src/lib/libcrypto/x509/x509_txt.c
@@ -132,6 +132,15 @@ const char *X509_verify_cert_error_string(long n)
132 return ("certificate rejected"); 132 return ("certificate rejected");
133 case X509_V_ERR_APPLICATION_VERIFICATION: 133 case X509_V_ERR_APPLICATION_VERIFICATION:
134 return("application verification failure"); 134 return("application verification failure");
135 case X509_V_ERR_SUBJECT_ISSUER_MISMATCH:
136 return("subject issuer mismatch");
137 case X509_V_ERR_AKID_SKID_MISMATCH:
138 return("authority and subject key identifier mismatch");
139 case X509_V_ERR_AKID_ISSUER_SERIAL_MISMATCH:
140 return("authority and issuer serial number mismatch");
141 case X509_V_ERR_KEYUSAGE_NO_CERTSIGN:
142 return("key usage does not include certificate signing");
143
135 default: 144 default:
136 sprintf(buf,"error number %ld",n); 145 sprintf(buf,"error number %ld",n);
137 return(buf); 146 return(buf);
diff --git a/src/lib/libcrypto/x509/x509_vfy.c b/src/lib/libcrypto/x509/x509_vfy.c
index 3ddb2303d3..0f4110cc64 100644
--- a/src/lib/libcrypto/x509/x509_vfy.c
+++ b/src/lib/libcrypto/x509/x509_vfy.c
@@ -71,6 +71,8 @@
71#include <openssl/objects.h> 71#include <openssl/objects.h>
72 72
73static int null_callback(int ok,X509_STORE_CTX *e); 73static int null_callback(int ok,X509_STORE_CTX *e);
74static int check_issued(X509_STORE_CTX *ctx, X509 *x, X509 *issuer);
75static X509 *find_issuer(X509_STORE_CTX *ctx, STACK_OF(X509) *sk, X509 *x);
74static int check_chain_purpose(X509_STORE_CTX *ctx); 76static int check_chain_purpose(X509_STORE_CTX *ctx);
75static int check_trust(X509_STORE_CTX *ctx); 77static int check_trust(X509_STORE_CTX *ctx);
76static int internal_verify(X509_STORE_CTX *ctx); 78static int internal_verify(X509_STORE_CTX *ctx);
@@ -85,13 +87,13 @@ static STACK *x509_store_method=NULL;
85 87
86static int null_callback(int ok, X509_STORE_CTX *e) 88static int null_callback(int ok, X509_STORE_CTX *e)
87 { 89 {
88 return(ok); 90 return ok;
89 } 91 }
90 92
91#if 0 93#if 0
92static int x509_subject_cmp(X509 **a, X509 **b) 94static int x509_subject_cmp(X509 **a, X509 **b)
93 { 95 {
94 return(X509_subject_name_cmp(*a,*b)); 96 return X509_subject_name_cmp(*a,*b);
95 } 97 }
96#endif 98#endif
97 99
@@ -99,7 +101,6 @@ int X509_verify_cert(X509_STORE_CTX *ctx)
99 { 101 {
100 X509 *x,*xtmp,*chain_ss=NULL; 102 X509 *x,*xtmp,*chain_ss=NULL;
101 X509_NAME *xn; 103 X509_NAME *xn;
102 X509_OBJECT obj;
103 int depth,i,ok=0; 104 int depth,i,ok=0;
104 int num; 105 int num;
105 int (*cb)(); 106 int (*cb)();
@@ -108,10 +109,10 @@ int X509_verify_cert(X509_STORE_CTX *ctx)
108 if (ctx->cert == NULL) 109 if (ctx->cert == NULL)
109 { 110 {
110 X509err(X509_F_X509_VERIFY_CERT,X509_R_NO_CERT_SET_FOR_US_TO_VERIFY); 111 X509err(X509_F_X509_VERIFY_CERT,X509_R_NO_CERT_SET_FOR_US_TO_VERIFY);
111 return(-1); 112 return -1;
112 } 113 }
113 114
114 cb=ctx->ctx->verify_cb; 115 cb=ctx->verify_cb;
115 if (cb == NULL) cb=null_callback; 116 if (cb == NULL) cb=null_callback;
116 117
117 /* first we make sure the chain we are going to build is 118 /* first we make sure the chain we are going to build is
@@ -152,13 +153,12 @@ int X509_verify_cert(X509_STORE_CTX *ctx)
152 153
153 /* If we are self signed, we break */ 154 /* If we are self signed, we break */
154 xn=X509_get_issuer_name(x); 155 xn=X509_get_issuer_name(x);
155 if (X509_NAME_cmp(X509_get_subject_name(x),xn) == 0) 156 if (ctx->check_issued(ctx, x,x)) break;
156 break;
157 157
158 /* If we were passed a cert chain, use it first */ 158 /* If we were passed a cert chain, use it first */
159 if (ctx->untrusted != NULL) 159 if (ctx->untrusted != NULL)
160 { 160 {
161 xtmp=X509_find_by_subject(sktmp,xn); 161 xtmp=find_issuer(ctx, sktmp,x);
162 if (xtmp != NULL) 162 if (xtmp != NULL)
163 { 163 {
164 if (!sk_X509_push(ctx->chain,xtmp)) 164 if (!sk_X509_push(ctx->chain,xtmp))
@@ -183,11 +183,14 @@ int X509_verify_cert(X509_STORE_CTX *ctx)
183 * certificates. We now need to add at least one trusted one, 183 * certificates. We now need to add at least one trusted one,
184 * if possible, otherwise we complain. */ 184 * if possible, otherwise we complain. */
185 185
186 /* Examine last certificate in chain and see if it
187 * is self signed.
188 */
189
186 i=sk_X509_num(ctx->chain); 190 i=sk_X509_num(ctx->chain);
187 x=sk_X509_value(ctx->chain,i-1); 191 x=sk_X509_value(ctx->chain,i-1);
188 xn = X509_get_subject_name(x); 192 xn = X509_get_subject_name(x);
189 if (X509_NAME_cmp(xn,X509_get_issuer_name(x)) 193 if (ctx->check_issued(ctx, x, x))
190 == 0)
191 { 194 {
192 /* we have a self signed certificate */ 195 /* we have a self signed certificate */
193 if (sk_X509_num(ctx->chain) == 1) 196 if (sk_X509_num(ctx->chain) == 1)
@@ -196,13 +199,13 @@ int X509_verify_cert(X509_STORE_CTX *ctx)
196 * we can find it in the store. We must have an exact 199 * we can find it in the store. We must have an exact
197 * match to avoid possible impersonation. 200 * match to avoid possible impersonation.
198 */ 201 */
199 ok=X509_STORE_get_by_subject(ctx,X509_LU_X509,xn,&obj); 202 ok = ctx->get_issuer(&xtmp, ctx, x);
200 if ((ok != X509_LU_X509) || X509_cmp(x, obj.data.x509)) 203 if ((ok <= 0) || X509_cmp(x, xtmp))
201 { 204 {
202 ctx->error=X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT; 205 ctx->error=X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT;
203 ctx->current_cert=x; 206 ctx->current_cert=x;
204 ctx->error_depth=i-1; 207 ctx->error_depth=i-1;
205 if(ok == X509_LU_X509) X509_OBJECT_free_contents(&obj); 208 if (ok == 1) X509_free(xtmp);
206 ok=cb(0,ctx); 209 ok=cb(0,ctx);
207 if (!ok) goto end; 210 if (!ok) goto end;
208 } 211 }
@@ -212,14 +215,14 @@ int X509_verify_cert(X509_STORE_CTX *ctx)
212 * so we get any trust settings. 215 * so we get any trust settings.
213 */ 216 */
214 X509_free(x); 217 X509_free(x);
215 x = obj.data.x509; 218 x = xtmp;
216 sk_X509_set(ctx->chain, i - 1, x); 219 sk_X509_set(ctx->chain, i - 1, x);
217 ctx->last_untrusted=0; 220 ctx->last_untrusted=0;
218 } 221 }
219 } 222 }
220 else 223 else
221 { 224 {
222 /* worry more about this one elsewhere */ 225 /* extract and save self signed certificate for later use */
223 chain_ss=sk_X509_pop(ctx->chain); 226 chain_ss=sk_X509_pop(ctx->chain);
224 ctx->last_untrusted--; 227 ctx->last_untrusted--;
225 num--; 228 num--;
@@ -235,41 +238,30 @@ int X509_verify_cert(X509_STORE_CTX *ctx)
235 238
236 /* If we are self signed, we break */ 239 /* If we are self signed, we break */
237 xn=X509_get_issuer_name(x); 240 xn=X509_get_issuer_name(x);
238 if (X509_NAME_cmp(X509_get_subject_name(x),xn) == 0) 241 if (ctx->check_issued(ctx,x,x)) break;
239 break;
240 242
241 ok=X509_STORE_get_by_subject(ctx,X509_LU_X509,xn,&obj); 243 ok = ctx->get_issuer(&xtmp, ctx, x);
242 if (ok != X509_LU_X509) 244
243 { 245 if (ok < 0) return ok;
244 if (ok == X509_LU_RETRY) 246 if (ok == 0) break;
245 { 247
246 X509_OBJECT_free_contents(&obj); 248 x = xtmp;
247 X509err(X509_F_X509_VERIFY_CERT,X509_R_SHOULD_RETRY); 249 if (!sk_X509_push(ctx->chain,x))
248 return(ok);
249 }
250 else if (ok != X509_LU_FAIL)
251 {
252 X509_OBJECT_free_contents(&obj);
253 /* not good :-(, break anyway */
254 return(ok);
255 }
256 break;
257 }
258 x=obj.data.x509;
259 if (!sk_X509_push(ctx->chain,obj.data.x509))
260 { 250 {
261 X509_OBJECT_free_contents(&obj); 251 X509_free(xtmp);
262 X509err(X509_F_X509_VERIFY_CERT,ERR_R_MALLOC_FAILURE); 252 X509err(X509_F_X509_VERIFY_CERT,ERR_R_MALLOC_FAILURE);
263 return(0); 253 return 0;
264 } 254 }
265 num++; 255 num++;
266 } 256 }
267 257
268 /* we now have our chain, lets check it... */ 258 /* we now have our chain, lets check it... */
269 xn=X509_get_issuer_name(x); 259 xn=X509_get_issuer_name(x);
270 if (X509_NAME_cmp(X509_get_subject_name(x),xn) != 0) 260
261 /* Is last certificate looked up self signed? */
262 if (!ctx->check_issued(ctx,x,x))
271 { 263 {
272 if ((chain_ss == NULL) || (X509_NAME_cmp(X509_get_subject_name(chain_ss),xn) != 0)) 264 if ((chain_ss == NULL) || !ctx->check_issued(ctx, x, chain_ss))
273 { 265 {
274 if (ctx->last_untrusted >= num) 266 if (ctx->last_untrusted >= num)
275 ctx->error=X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY; 267 ctx->error=X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY;
@@ -294,22 +286,22 @@ int X509_verify_cert(X509_STORE_CTX *ctx)
294 } 286 }
295 287
296 /* We have the chain complete: now we need to check its purpose */ 288 /* We have the chain complete: now we need to check its purpose */
297 if(ctx->purpose > 0) ok = check_chain_purpose(ctx); 289 if (ctx->purpose > 0) ok = check_chain_purpose(ctx);
298 290
299 if(!ok) goto end; 291 if (!ok) goto end;
300 292
301 /* The chain extensions are OK: check trust */ 293 /* The chain extensions are OK: check trust */
302 294
303 if(ctx->trust > 0) ok = check_trust(ctx); 295 if (ctx->trust > 0) ok = check_trust(ctx);
304 296
305 if(!ok) goto end; 297 if (!ok) goto end;
306 298
307 /* We may as well copy down any DSA parameters that are required */ 299 /* We may as well copy down any DSA parameters that are required */
308 X509_get_pubkey_parameters(NULL,ctx->chain); 300 X509_get_pubkey_parameters(NULL,ctx->chain);
309 301
310 /* At this point, we have a chain and just need to verify it */ 302 /* At this point, we have a chain and just need to verify it */
311 if (ctx->ctx->verify != NULL) 303 if (ctx->verify != NULL)
312 ok=ctx->ctx->verify(ctx); 304 ok=ctx->verify(ctx);
313 else 305 else
314 ok=internal_verify(ctx); 306 ok=internal_verify(ctx);
315 if (0) 307 if (0)
@@ -319,9 +311,61 @@ end:
319 } 311 }
320 if (sktmp != NULL) sk_X509_free(sktmp); 312 if (sktmp != NULL) sk_X509_free(sktmp);
321 if (chain_ss != NULL) X509_free(chain_ss); 313 if (chain_ss != NULL) X509_free(chain_ss);
322 return(ok); 314 return ok;
323 } 315 }
324 316
317
318/* Given a STACK_OF(X509) find the issuer of cert (if any)
319 */
320
321static X509 *find_issuer(X509_STORE_CTX *ctx, STACK_OF(X509) *sk, X509 *x)
322{
323 int i;
324 X509 *issuer;
325 for (i = 0; i < sk_X509_num(sk); i++)
326 {
327 issuer = sk_X509_value(sk, i);
328 if (ctx->check_issued(ctx, x, issuer))
329 return issuer;
330 }
331 return NULL;
332}
333
334/* Given a possible certificate and issuer check them */
335
336static int check_issued(X509_STORE_CTX *ctx, X509 *x, X509 *issuer)
337{
338 int ret;
339 ret = X509_check_issued(issuer, x);
340 if (ret == X509_V_OK)
341 return 1;
342 /* If we haven't asked for issuer errors don't set ctx */
343 if (!(ctx->flags & X509_V_FLAG_CB_ISSUER_CHECK))
344 return 0;
345
346 ctx->error = ret;
347 ctx->current_cert = x;
348 ctx->current_issuer = issuer;
349 if (ctx->verify_cb)
350 return ctx->verify_cb(0, ctx);
351 return 0;
352}
353
354/* Alternative lookup method: look from a STACK stored in other_ctx */
355
356static int get_issuer_sk(X509 **issuer, X509_STORE_CTX *ctx, X509 *x)
357{
358 *issuer = find_issuer(ctx, ctx->other_ctx, x);
359 if (*issuer)
360 {
361 CRYPTO_add(&(*issuer)->references,1,CRYPTO_LOCK_X509);
362 return 1;
363 }
364 else
365 return 0;
366}
367
368
325/* Check a certificate chains extensions for consistency 369/* Check a certificate chains extensions for consistency
326 * with the supplied purpose 370 * with the supplied purpose
327 */ 371 */
@@ -334,32 +378,37 @@ static int check_chain_purpose(X509_STORE_CTX *ctx)
334 int i, ok=0; 378 int i, ok=0;
335 X509 *x; 379 X509 *x;
336 int (*cb)(); 380 int (*cb)();
337 cb=ctx->ctx->verify_cb; 381 cb=ctx->verify_cb;
338 if (cb == NULL) cb=null_callback; 382 if (cb == NULL) cb=null_callback;
339 /* Check all untrusted certificates */ 383 /* Check all untrusted certificates */
340 for(i = 0; i < ctx->last_untrusted; i++) { 384 for (i = 0; i < ctx->last_untrusted; i++)
385 {
341 x = sk_X509_value(ctx->chain, i); 386 x = sk_X509_value(ctx->chain, i);
342 if(!X509_check_purpose(x, ctx->purpose, i)) { 387 if (!X509_check_purpose(x, ctx->purpose, i))
343 if(i) ctx->error = X509_V_ERR_INVALID_CA; 388 {
344 else ctx->error = X509_V_ERR_INVALID_PURPOSE; 389 if (i)
390 ctx->error = X509_V_ERR_INVALID_CA;
391 else
392 ctx->error = X509_V_ERR_INVALID_PURPOSE;
345 ctx->error_depth = i; 393 ctx->error_depth = i;
346 ctx->current_cert = x; 394 ctx->current_cert = x;
347 ok=cb(0,ctx); 395 ok=cb(0,ctx);
348 if(!ok) goto end; 396 if (!ok) goto end;
349 } 397 }
350 /* Check pathlen */ 398 /* Check pathlen */
351 if((i > 1) && (x->ex_pathlen != -1) 399 if ((i > 1) && (x->ex_pathlen != -1)
352 && (i > (x->ex_pathlen + 1))) { 400 && (i > (x->ex_pathlen + 1)))
401 {
353 ctx->error = X509_V_ERR_PATH_LENGTH_EXCEEDED; 402 ctx->error = X509_V_ERR_PATH_LENGTH_EXCEEDED;
354 ctx->error_depth = i; 403 ctx->error_depth = i;
355 ctx->current_cert = x; 404 ctx->current_cert = x;
356 ok=cb(0,ctx); 405 ok=cb(0,ctx);
357 if(!ok) goto end; 406 if (!ok) goto end;
407 }
358 } 408 }
359 }
360 ok = 1; 409 ok = 1;
361 end: 410 end:
362 return(ok); 411 return ok;
363#endif 412#endif
364} 413}
365 414
@@ -371,19 +420,22 @@ static int check_trust(X509_STORE_CTX *ctx)
371 int i, ok; 420 int i, ok;
372 X509 *x; 421 X509 *x;
373 int (*cb)(); 422 int (*cb)();
374 cb=ctx->ctx->verify_cb; 423 cb=ctx->verify_cb;
375 if (cb == NULL) cb=null_callback; 424 if (cb == NULL) cb=null_callback;
376/* For now just check the last certificate in the chain */ 425/* For now just check the last certificate in the chain */
377 i = sk_X509_num(ctx->chain) - 1; 426 i = sk_X509_num(ctx->chain) - 1;
378 x = sk_X509_value(ctx->chain, i); 427 x = sk_X509_value(ctx->chain, i);
379 ok = X509_check_trust(x, ctx->trust, 0); 428 ok = X509_check_trust(x, ctx->trust, 0);
380 if(ok == X509_TRUST_TRUSTED) return 1; 429 if (ok == X509_TRUST_TRUSTED)
430 return 1;
381 ctx->error_depth = sk_X509_num(ctx->chain) - 1; 431 ctx->error_depth = sk_X509_num(ctx->chain) - 1;
382 ctx->current_cert = x; 432 ctx->current_cert = x;
383 if(ok == X509_TRUST_REJECTED) ctx->error = X509_V_ERR_CERT_REJECTED; 433 if (ok == X509_TRUST_REJECTED)
384 else ctx->error = X509_V_ERR_CERT_UNTRUSTED; 434 ctx->error = X509_V_ERR_CERT_REJECTED;
435 else
436 ctx->error = X509_V_ERR_CERT_UNTRUSTED;
385 ok = cb(0, ctx); 437 ok = cb(0, ctx);
386 return(ok); 438 return ok;
387#endif 439#endif
388} 440}
389 441
@@ -392,17 +444,21 @@ static int internal_verify(X509_STORE_CTX *ctx)
392 int i,ok=0,n; 444 int i,ok=0,n;
393 X509 *xs,*xi; 445 X509 *xs,*xi;
394 EVP_PKEY *pkey=NULL; 446 EVP_PKEY *pkey=NULL;
447 time_t *ptime;
395 int (*cb)(); 448 int (*cb)();
396 449
397 cb=ctx->ctx->verify_cb; 450 cb=ctx->verify_cb;
398 if (cb == NULL) cb=null_callback; 451 if (cb == NULL) cb=null_callback;
399 452
400 n=sk_X509_num(ctx->chain); 453 n=sk_X509_num(ctx->chain);
401 ctx->error_depth=n-1; 454 ctx->error_depth=n-1;
402 n--; 455 n--;
403 xi=sk_X509_value(ctx->chain,n); 456 xi=sk_X509_value(ctx->chain,n);
404 if (X509_NAME_cmp(X509_get_subject_name(xi), 457 if (ctx->flags & X509_V_FLAG_USE_CHECK_TIME)
405 X509_get_issuer_name(xi)) == 0) 458 ptime = &ctx->check_time;
459 else
460 ptime = NULL;
461 if (ctx->check_issued(ctx, xi, xi))
406 xs=xi; 462 xs=xi;
407 else 463 else
408 { 464 {
@@ -448,7 +504,7 @@ static int internal_verify(X509_STORE_CTX *ctx)
448 EVP_PKEY_free(pkey); 504 EVP_PKEY_free(pkey);
449 pkey=NULL; 505 pkey=NULL;
450 506
451 i=X509_cmp_current_time(X509_get_notBefore(xs)); 507 i=X509_cmp_time(X509_get_notBefore(xs), ptime);
452 if (i == 0) 508 if (i == 0)
453 { 509 {
454 ctx->error=X509_V_ERR_ERROR_IN_CERT_NOT_BEFORE_FIELD; 510 ctx->error=X509_V_ERR_ERROR_IN_CERT_NOT_BEFORE_FIELD;
@@ -466,7 +522,7 @@ static int internal_verify(X509_STORE_CTX *ctx)
466 xs->valid=1; 522 xs->valid=1;
467 } 523 }
468 524
469 i=X509_cmp_current_time(X509_get_notAfter(xs)); 525 i=X509_cmp_time(X509_get_notAfter(xs), ptime);
470 if (i == 0) 526 if (i == 0)
471 { 527 {
472 ctx->error=X509_V_ERR_ERROR_IN_CERT_NOT_AFTER_FIELD; 528 ctx->error=X509_V_ERR_ERROR_IN_CERT_NOT_AFTER_FIELD;
@@ -499,13 +555,18 @@ static int internal_verify(X509_STORE_CTX *ctx)
499 } 555 }
500 ok=1; 556 ok=1;
501end: 557end:
502 return(ok); 558 return ok;
503 } 559 }
504 560
505int X509_cmp_current_time(ASN1_UTCTIME *ctm) 561int X509_cmp_current_time(ASN1_TIME *ctm)
562{
563 return X509_cmp_time(ctm, NULL);
564}
565
566int X509_cmp_time(ASN1_TIME *ctm, time_t *cmp_time)
506 { 567 {
507 char *str; 568 char *str;
508 ASN1_UTCTIME atm; 569 ASN1_TIME atm;
509 time_t offset; 570 time_t offset;
510 char buff1[24],buff2[24],*p; 571 char buff1[24],buff2[24],*p;
511 int i,j; 572 int i,j;
@@ -513,14 +574,35 @@ int X509_cmp_current_time(ASN1_UTCTIME *ctm)
513 p=buff1; 574 p=buff1;
514 i=ctm->length; 575 i=ctm->length;
515 str=(char *)ctm->data; 576 str=(char *)ctm->data;
516 if ((i < 11) || (i > 17)) return(0); 577 if (ctm->type == V_ASN1_UTCTIME)
517 memcpy(p,str,10); 578 {
518 p+=10; 579 if ((i < 11) || (i > 17)) return 0;
519 str+=10; 580 memcpy(p,str,10);
581 p+=10;
582 str+=10;
583 }
584 else
585 {
586 if (i < 13) return 0;
587 memcpy(p,str,12);
588 p+=12;
589 str+=12;
590 }
520 591
521 if ((*str == 'Z') || (*str == '-') || (*str == '+')) 592 if ((*str == 'Z') || (*str == '-') || (*str == '+'))
522 { *(p++)='0'; *(p++)='0'; } 593 { *(p++)='0'; *(p++)='0'; }
523 else { *(p++)= *(str++); *(p++)= *(str++); } 594 else
595 {
596 *(p++)= *(str++);
597 *(p++)= *(str++);
598 /* Skip any fractional seconds... */
599 if (*str == '.')
600 {
601 str++;
602 while ((*str >= '0') && (*str <= '9')) str++;
603 }
604
605 }
524 *(p++)='Z'; 606 *(p++)='Z';
525 *(p++)='\0'; 607 *(p++)='\0';
526 608
@@ -529,39 +611,51 @@ int X509_cmp_current_time(ASN1_UTCTIME *ctm)
529 else 611 else
530 { 612 {
531 if ((*str != '+') && (str[5] != '-')) 613 if ((*str != '+') && (str[5] != '-'))
532 return(0); 614 return 0;
533 offset=((str[1]-'0')*10+(str[2]-'0'))*60; 615 offset=((str[1]-'0')*10+(str[2]-'0'))*60;
534 offset+=(str[3]-'0')*10+(str[4]-'0'); 616 offset+=(str[3]-'0')*10+(str[4]-'0');
535 if (*str == '-') 617 if (*str == '-')
536 offset= -offset; 618 offset= -offset;
537 } 619 }
538 atm.type=V_ASN1_UTCTIME; 620 atm.type=ctm->type;
539 atm.length=sizeof(buff2); 621 atm.length=sizeof(buff2);
540 atm.data=(unsigned char *)buff2; 622 atm.data=(unsigned char *)buff2;
541 623
542 X509_gmtime_adj(&atm,-offset*60); 624 X509_time_adj(&atm,-offset*60, cmp_time);
543 625
544 i=(buff1[0]-'0')*10+(buff1[1]-'0'); 626 if (ctm->type == V_ASN1_UTCTIME)
545 if (i < 50) i+=100; /* cf. RFC 2459 */ 627 {
546 j=(buff2[0]-'0')*10+(buff2[1]-'0'); 628 i=(buff1[0]-'0')*10+(buff1[1]-'0');
547 if (j < 50) j+=100; 629 if (i < 50) i+=100; /* cf. RFC 2459 */
630 j=(buff2[0]-'0')*10+(buff2[1]-'0');
631 if (j < 50) j+=100;
548 632
549 if (i < j) return (-1); 633 if (i < j) return -1;
550 if (i > j) return (1); 634 if (i > j) return 1;
635 }
551 i=strcmp(buff1,buff2); 636 i=strcmp(buff1,buff2);
552 if (i == 0) /* wait a second then return younger :-) */ 637 if (i == 0) /* wait a second then return younger :-) */
553 return(-1); 638 return -1;
554 else 639 else
555 return(i); 640 return i;
556 } 641 }
557 642
558ASN1_UTCTIME *X509_gmtime_adj(ASN1_UTCTIME *s, long adj) 643ASN1_TIME *X509_gmtime_adj(ASN1_TIME *s, long adj)
644{
645 return X509_time_adj(s, adj, NULL);
646}
647
648ASN1_TIME *X509_time_adj(ASN1_TIME *s, long adj, time_t *in_tm)
559 { 649 {
560 time_t t; 650 time_t t;
561 651
562 time(&t); 652 if (in_tm) t = *in_tm;
653 else time(&t);
654
563 t+=adj; 655 t+=adj;
564 return(ASN1_UTCTIME_set(s,t)); 656 if (!s) return ASN1_TIME_set(s, t);
657 if (s->type == V_ASN1_UTCTIME) return ASN1_UTCTIME_set(s,t);
658 return ASN1_GENERALIZEDTIME_set(s, t);
565 } 659 }
566 660
567int X509_get_pubkey_parameters(EVP_PKEY *pkey, STACK_OF(X509) *chain) 661int X509_get_pubkey_parameters(EVP_PKEY *pkey, STACK_OF(X509) *chain)
@@ -569,7 +663,7 @@ int X509_get_pubkey_parameters(EVP_PKEY *pkey, STACK_OF(X509) *chain)
569 EVP_PKEY *ktmp=NULL,*ktmp2; 663 EVP_PKEY *ktmp=NULL,*ktmp2;
570 int i,j; 664 int i,j;
571 665
572 if ((pkey != NULL) && !EVP_PKEY_missing_parameters(pkey)) return(1); 666 if ((pkey != NULL) && !EVP_PKEY_missing_parameters(pkey)) return 1;
573 667
574 for (i=0; i<sk_X509_num(chain); i++) 668 for (i=0; i<sk_X509_num(chain); i++)
575 { 669 {
@@ -577,7 +671,7 @@ int X509_get_pubkey_parameters(EVP_PKEY *pkey, STACK_OF(X509) *chain)
577 if (ktmp == NULL) 671 if (ktmp == NULL)
578 { 672 {
579 X509err(X509_F_X509_GET_PUBKEY_PARAMETERS,X509_R_UNABLE_TO_GET_CERTS_PUBLIC_KEY); 673 X509err(X509_F_X509_GET_PUBKEY_PARAMETERS,X509_R_UNABLE_TO_GET_CERTS_PUBLIC_KEY);
580 return(0); 674 return 0;
581 } 675 }
582 if (!EVP_PKEY_missing_parameters(ktmp)) 676 if (!EVP_PKEY_missing_parameters(ktmp))
583 break; 677 break;
@@ -590,7 +684,7 @@ int X509_get_pubkey_parameters(EVP_PKEY *pkey, STACK_OF(X509) *chain)
590 if (ktmp == NULL) 684 if (ktmp == NULL)
591 { 685 {
592 X509err(X509_F_X509_GET_PUBKEY_PARAMETERS,X509_R_UNABLE_TO_FIND_PARAMETERS_IN_CHAIN); 686 X509err(X509_F_X509_GET_PUBKEY_PARAMETERS,X509_R_UNABLE_TO_FIND_PARAMETERS_IN_CHAIN);
593 return(0); 687 return 0;
594 } 688 }
595 689
596 /* first, populate the other certs */ 690 /* first, populate the other certs */
@@ -603,101 +697,31 @@ int X509_get_pubkey_parameters(EVP_PKEY *pkey, STACK_OF(X509) *chain)
603 697
604 if (pkey != NULL) EVP_PKEY_copy_parameters(pkey,ktmp); 698 if (pkey != NULL) EVP_PKEY_copy_parameters(pkey,ktmp);
605 EVP_PKEY_free(ktmp); 699 EVP_PKEY_free(ktmp);
606 return(1); 700 return 1;
607 }
608
609int X509_STORE_add_cert(X509_STORE *ctx, X509 *x)
610 {
611 X509_OBJECT *obj,*r;
612 int ret=1;
613
614 if (x == NULL) return(0);
615 obj=(X509_OBJECT *)Malloc(sizeof(X509_OBJECT));
616 if (obj == NULL)
617 {
618 X509err(X509_F_X509_STORE_ADD_CERT,ERR_R_MALLOC_FAILURE);
619 return(0);
620 }
621 obj->type=X509_LU_X509;
622 obj->data.x509=x;
623
624 CRYPTO_w_lock(CRYPTO_LOCK_X509_STORE);
625
626 X509_OBJECT_up_ref_count(obj);
627
628 r=(X509_OBJECT *)lh_insert(ctx->certs,obj);
629 if (r != NULL)
630 { /* oops, put it back */
631 lh_delete(ctx->certs,obj);
632 X509_OBJECT_free_contents(obj);
633 Free(obj);
634 lh_insert(ctx->certs,r);
635 X509err(X509_F_X509_STORE_ADD_CERT,X509_R_CERT_ALREADY_IN_HASH_TABLE);
636 ret=0;
637 }
638
639 CRYPTO_w_unlock(CRYPTO_LOCK_X509_STORE);
640
641 return(ret);
642 }
643
644int X509_STORE_add_crl(X509_STORE *ctx, X509_CRL *x)
645 {
646 X509_OBJECT *obj,*r;
647 int ret=1;
648
649 if (x == NULL) return(0);
650 obj=(X509_OBJECT *)Malloc(sizeof(X509_OBJECT));
651 if (obj == NULL)
652 {
653 X509err(X509_F_X509_STORE_ADD_CRL,ERR_R_MALLOC_FAILURE);
654 return(0);
655 }
656 obj->type=X509_LU_CRL;
657 obj->data.crl=x;
658
659 CRYPTO_w_lock(CRYPTO_LOCK_X509_STORE);
660
661 X509_OBJECT_up_ref_count(obj);
662
663 r=(X509_OBJECT *)lh_insert(ctx->certs,obj);
664 if (r != NULL)
665 { /* oops, put it back */
666 lh_delete(ctx->certs,obj);
667 X509_OBJECT_free_contents(obj);
668 Free(obj);
669 lh_insert(ctx->certs,r);
670 X509err(X509_F_X509_STORE_ADD_CRL,X509_R_CERT_ALREADY_IN_HASH_TABLE);
671 ret=0;
672 }
673
674 CRYPTO_w_unlock(CRYPTO_LOCK_X509_STORE);
675
676 return(ret);
677 } 701 }
678 702
679int X509_STORE_CTX_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func, 703int X509_STORE_CTX_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func,
680 CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func) 704 CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func)
681 { 705 {
682 x509_store_ctx_num++; 706 x509_store_ctx_num++;
683 return(CRYPTO_get_ex_new_index(x509_store_ctx_num-1, 707 return CRYPTO_get_ex_new_index(x509_store_ctx_num-1,
684 &x509_store_ctx_method, 708 &x509_store_ctx_method,
685 argl,argp,new_func,dup_func,free_func)); 709 argl,argp,new_func,dup_func,free_func);
686 } 710 }
687 711
688int X509_STORE_CTX_set_ex_data(X509_STORE_CTX *ctx, int idx, void *data) 712int X509_STORE_CTX_set_ex_data(X509_STORE_CTX *ctx, int idx, void *data)
689 { 713 {
690 return(CRYPTO_set_ex_data(&ctx->ex_data,idx,data)); 714 return CRYPTO_set_ex_data(&ctx->ex_data,idx,data);
691 } 715 }
692 716
693void *X509_STORE_CTX_get_ex_data(X509_STORE_CTX *ctx, int idx) 717void *X509_STORE_CTX_get_ex_data(X509_STORE_CTX *ctx, int idx)
694 { 718 {
695 return(CRYPTO_get_ex_data(&ctx->ex_data,idx)); 719 return CRYPTO_get_ex_data(&ctx->ex_data,idx);
696 } 720 }
697 721
698int X509_STORE_CTX_get_error(X509_STORE_CTX *ctx) 722int X509_STORE_CTX_get_error(X509_STORE_CTX *ctx)
699 { 723 {
700 return(ctx->error); 724 return ctx->error;
701 } 725 }
702 726
703void X509_STORE_CTX_set_error(X509_STORE_CTX *ctx, int err) 727void X509_STORE_CTX_set_error(X509_STORE_CTX *ctx, int err)
@@ -707,17 +731,17 @@ void X509_STORE_CTX_set_error(X509_STORE_CTX *ctx, int err)
707 731
708int X509_STORE_CTX_get_error_depth(X509_STORE_CTX *ctx) 732int X509_STORE_CTX_get_error_depth(X509_STORE_CTX *ctx)
709 { 733 {
710 return(ctx->error_depth); 734 return ctx->error_depth;
711 } 735 }
712 736
713X509 *X509_STORE_CTX_get_current_cert(X509_STORE_CTX *ctx) 737X509 *X509_STORE_CTX_get_current_cert(X509_STORE_CTX *ctx)
714 { 738 {
715 return(ctx->current_cert); 739 return ctx->current_cert;
716 } 740 }
717 741
718STACK_OF(X509) *X509_STORE_CTX_get_chain(X509_STORE_CTX *ctx) 742STACK_OF(X509) *X509_STORE_CTX_get_chain(X509_STORE_CTX *ctx)
719 { 743 {
720 return(ctx->chain); 744 return ctx->chain;
721 } 745 }
722 746
723STACK_OF(X509) *X509_STORE_CTX_get1_chain(X509_STORE_CTX *ctx) 747STACK_OF(X509) *X509_STORE_CTX_get1_chain(X509_STORE_CTX *ctx)
@@ -725,12 +749,13 @@ STACK_OF(X509) *X509_STORE_CTX_get1_chain(X509_STORE_CTX *ctx)
725 int i; 749 int i;
726 X509 *x; 750 X509 *x;
727 STACK_OF(X509) *chain; 751 STACK_OF(X509) *chain;
728 if(!ctx->chain || !(chain = sk_X509_dup(ctx->chain))) return NULL; 752 if (!ctx->chain || !(chain = sk_X509_dup(ctx->chain))) return NULL;
729 for(i = 0; i < sk_X509_num(chain); i++) { 753 for (i = 0; i < sk_X509_num(chain); i++)
754 {
730 x = sk_X509_value(chain, i); 755 x = sk_X509_value(chain, i);
731 CRYPTO_add(&x->references, 1, CRYPTO_LOCK_X509); 756 CRYPTO_add(&x->references, 1, CRYPTO_LOCK_X509);
732 } 757 }
733 return(chain); 758 return chain;
734 } 759 }
735 760
736void X509_STORE_CTX_set_cert(X509_STORE_CTX *ctx, X509 *x) 761void X509_STORE_CTX_set_cert(X509_STORE_CTX *ctx, X509 *x)
@@ -768,43 +793,123 @@ int X509_STORE_CTX_purpose_inherit(X509_STORE_CTX *ctx, int def_purpose,
768{ 793{
769 int idx; 794 int idx;
770 /* If purpose not set use default */ 795 /* If purpose not set use default */
771 if(!purpose) purpose = def_purpose; 796 if (!purpose) purpose = def_purpose;
772 /* If we have a purpose then check it is valid */ 797 /* If we have a purpose then check it is valid */
773 if(purpose) { 798 if (purpose)
799 {
774 X509_PURPOSE *ptmp; 800 X509_PURPOSE *ptmp;
775 idx = X509_PURPOSE_get_by_id(purpose); 801 idx = X509_PURPOSE_get_by_id(purpose);
776 if(idx == -1) { 802 if (idx == -1)
803 {
777 X509err(X509_F_X509_STORE_CTX_PURPOSE_INHERIT, 804 X509err(X509_F_X509_STORE_CTX_PURPOSE_INHERIT,
778 X509_R_UNKNOWN_PURPOSE_ID); 805 X509_R_UNKNOWN_PURPOSE_ID);
779 return 0; 806 return 0;
780 } 807 }
781 ptmp = X509_PURPOSE_get0(idx); 808 ptmp = X509_PURPOSE_get0(idx);
782 if(ptmp->trust == X509_TRUST_DEFAULT) { 809 if (ptmp->trust == X509_TRUST_DEFAULT)
810 {
783 idx = X509_PURPOSE_get_by_id(def_purpose); 811 idx = X509_PURPOSE_get_by_id(def_purpose);
784 if(idx == -1) { 812 if (idx == -1)
813 {
785 X509err(X509_F_X509_STORE_CTX_PURPOSE_INHERIT, 814 X509err(X509_F_X509_STORE_CTX_PURPOSE_INHERIT,
786 X509_R_UNKNOWN_PURPOSE_ID); 815 X509_R_UNKNOWN_PURPOSE_ID);
787 return 0; 816 return 0;
788 } 817 }
789 ptmp = X509_PURPOSE_get0(idx); 818 ptmp = X509_PURPOSE_get0(idx);
790 } 819 }
791 /* If trust not set then get from purpose default */ 820 /* If trust not set then get from purpose default */
792 if(!trust) trust = ptmp->trust; 821 if (!trust) trust = ptmp->trust;
793 } 822 }
794 if(trust) { 823 if (trust)
824 {
795 idx = X509_TRUST_get_by_id(trust); 825 idx = X509_TRUST_get_by_id(trust);
796 if(idx == -1) { 826 if (idx == -1)
827 {
797 X509err(X509_F_X509_STORE_CTX_PURPOSE_INHERIT, 828 X509err(X509_F_X509_STORE_CTX_PURPOSE_INHERIT,
798 X509_R_UNKNOWN_TRUST_ID); 829 X509_R_UNKNOWN_TRUST_ID);
799 return 0; 830 return 0;
831 }
800 } 832 }
801 }
802 833
803 if(purpose) ctx->purpose = purpose; 834 if (purpose) ctx->purpose = purpose;
804 if(trust) ctx->trust = trust; 835 if (trust) ctx->trust = trust;
805 return 1; 836 return 1;
806} 837}
807 838
839X509_STORE_CTX *X509_STORE_CTX_new(void)
840{
841 X509_STORE_CTX *ctx;
842 ctx = (X509_STORE_CTX *)OPENSSL_malloc(sizeof(X509_STORE_CTX));
843 if (ctx) memset(ctx, 0, sizeof(X509_STORE_CTX));
844 return ctx;
845}
846
847void X509_STORE_CTX_free(X509_STORE_CTX *ctx)
848{
849 X509_STORE_CTX_cleanup(ctx);
850 OPENSSL_free(ctx);
851}
852
853void X509_STORE_CTX_init(X509_STORE_CTX *ctx, X509_STORE *store, X509 *x509,
854 STACK_OF(X509) *chain)
855 {
856 ctx->ctx=store;
857 ctx->current_method=0;
858 ctx->cert=x509;
859 ctx->untrusted=chain;
860 ctx->last_untrusted=0;
861 ctx->purpose=0;
862 ctx->trust=0;
863 ctx->check_time=0;
864 ctx->flags=0;
865 ctx->other_ctx=NULL;
866 ctx->valid=0;
867 ctx->chain=NULL;
868 ctx->depth=9;
869 ctx->error=0;
870 ctx->error_depth=0;
871 ctx->current_cert=NULL;
872 ctx->current_issuer=NULL;
873 ctx->check_issued = check_issued;
874 ctx->get_issuer = X509_STORE_CTX_get1_issuer;
875 ctx->verify_cb = store->verify_cb;
876 ctx->verify = store->verify;
877 ctx->cleanup = 0;
878 memset(&(ctx->ex_data),0,sizeof(CRYPTO_EX_DATA));
879 }
880
881/* Set alternative lookup method: just a STACK of trusted certificates.
882 * This avoids X509_STORE nastiness where it isn't needed.
883 */
884
885void X509_STORE_CTX_trusted_stack(X509_STORE_CTX *ctx, STACK_OF(X509) *sk)
886{
887 ctx->other_ctx = sk;
888 ctx->get_issuer = get_issuer_sk;
889}
890
891void X509_STORE_CTX_cleanup(X509_STORE_CTX *ctx)
892 {
893 if (ctx->cleanup) ctx->cleanup(ctx);
894 if (ctx->chain != NULL)
895 {
896 sk_X509_pop_free(ctx->chain,X509_free);
897 ctx->chain=NULL;
898 }
899 CRYPTO_free_ex_data(x509_store_ctx_method,ctx,&(ctx->ex_data));
900 memset(&ctx->ex_data,0,sizeof(CRYPTO_EX_DATA));
901 }
902
903void X509_STORE_CTX_set_flags(X509_STORE_CTX *ctx, long flags)
904 {
905 ctx->flags |= flags;
906 }
907
908void X509_STORE_CTX_set_time(X509_STORE_CTX *ctx, long flags, time_t t)
909 {
910 ctx->check_time = t;
911 ctx->flags |= X509_V_FLAG_USE_CHECK_TIME;
912 }
808 913
809IMPLEMENT_STACK_OF(X509) 914IMPLEMENT_STACK_OF(X509)
810IMPLEMENT_ASN1_SET_OF(X509) 915IMPLEMENT_ASN1_SET_OF(X509)
diff --git a/src/lib/libcrypto/x509/x509_vfy.h b/src/lib/libcrypto/x509/x509_vfy.h
index 4637aecedf..e289d5309a 100644
--- a/src/lib/libcrypto/x509/x509_vfy.h
+++ b/src/lib/libcrypto/x509/x509_vfy.h
@@ -65,13 +65,16 @@
65#ifndef HEADER_X509_VFY_H 65#ifndef HEADER_X509_VFY_H
66#define HEADER_X509_VFY_H 66#define HEADER_X509_VFY_H
67 67
68#ifdef __cplusplus 68#ifndef NO_LHASH
69extern "C" { 69#include <openssl/lhash.h>
70#endif 70#endif
71
72#include <openssl/bio.h> 71#include <openssl/bio.h>
73#include <openssl/crypto.h> 72#include <openssl/crypto.h>
74 73
74#ifdef __cplusplus
75extern "C" {
76#endif
77
75/* Outer object */ 78/* Outer object */
76typedef struct x509_hash_dir_st 79typedef struct x509_hash_dir_st
77 { 80 {
@@ -128,6 +131,7 @@ typedef struct x509_object_st
128typedef struct x509_lookup_st X509_LOOKUP; 131typedef struct x509_lookup_st X509_LOOKUP;
129 132
130DECLARE_STACK_OF(X509_LOOKUP) 133DECLARE_STACK_OF(X509_LOOKUP)
134DECLARE_STACK_OF(X509_OBJECT)
131 135
132/* This is a static that defines the function interface */ 136/* This is a static that defines the function interface */
133typedef struct x509_lookup_method_st 137typedef struct x509_lookup_method_st
@@ -150,7 +154,7 @@ typedef struct x509_lookup_method_st
150 X509_OBJECT *ret); 154 X509_OBJECT *ret);
151 } X509_LOOKUP_METHOD; 155 } X509_LOOKUP_METHOD;
152 156
153typedef struct x509_store_state_st X509_STORE_CTX; 157typedef struct x509_store_ctx_st X509_STORE_CTX;
154 158
155/* This is used to hold everything. It is used for all certificate 159/* This is used to hold everything. It is used for all certificate
156 * validation. Once we have a certificate chain, the 'verify' 160 * validation. Once we have a certificate chain, the 'verify'
@@ -159,11 +163,7 @@ typedef struct x509_store_st
159 { 163 {
160 /* The following is a cache of trusted certs */ 164 /* The following is a cache of trusted certs */
161 int cache; /* if true, stash any hits */ 165 int cache; /* if true, stash any hits */
162#ifdef HEADER_LHASH_H 166 STACK_OF(X509_OBJECT) *objs; /* Cache of all objects */
163 LHASH *certs; /* cached certs; */
164#else
165 char *certs;
166#endif
167 167
168 /* These are external lookup methods */ 168 /* These are external lookup methods */
169 STACK_OF(X509_LOOKUP) *get_cert_methods; 169 STACK_OF(X509_LOOKUP) *get_cert_methods;
@@ -191,10 +191,10 @@ struct x509_lookup_st
191 X509_STORE *store_ctx; /* who owns us */ 191 X509_STORE *store_ctx; /* who owns us */
192 }; 192 };
193 193
194/* This is a temporary used when processing cert chains. Since the 194/* This is a used when verifying cert chains. Since the
195 * gathering of the cert chain can take some time (and have to be 195 * gathering of the cert chain can take some time (and have to be
196 * 'retried', this needs to be kept and passed around. */ 196 * 'retried', this needs to be kept and passed around. */
197struct x509_store_state_st /* X509_STORE_CTX */ 197struct x509_store_ctx_st /* X509_STORE_CTX */
198 { 198 {
199 X509_STORE *ctx; 199 X509_STORE *ctx;
200 int current_method; /* used when looking up certs */ 200 int current_method; /* used when looking up certs */
@@ -204,6 +204,16 @@ struct x509_store_state_st /* X509_STORE_CTX */
204 STACK_OF(X509) *untrusted; /* chain of X509s - untrusted - passed in */ 204 STACK_OF(X509) *untrusted; /* chain of X509s - untrusted - passed in */
205 int purpose; /* purpose to check untrusted certificates */ 205 int purpose; /* purpose to check untrusted certificates */
206 int trust; /* trust setting to check */ 206 int trust; /* trust setting to check */
207 time_t check_time; /* time to make verify at */
208 unsigned long flags; /* Various verify flags */
209 void *other_ctx; /* Other info for use with get_issuer() */
210
211 /* Callbacks for various operations */
212 int (*verify)(X509_STORE_CTX *ctx); /* called to verify a certificate */
213 int (*verify_cb)(int ok,X509_STORE_CTX *ctx); /* error callback */
214 int (*get_issuer)(X509 **issuer, X509_STORE_CTX *ctx, X509 *x); /* get issuers cert from ctx */
215 int (*check_issued)(X509_STORE_CTX *ctx, X509 *x, X509 *issuer); /* check issued */
216 int (*cleanup)(X509_STORE_CTX *ctx);
207 217
208 /* The following is built up */ 218 /* The following is built up */
209 int depth; /* how far to go looking up certs */ 219 int depth; /* how far to go looking up certs */
@@ -215,6 +225,7 @@ struct x509_store_state_st /* X509_STORE_CTX */
215 int error_depth; 225 int error_depth;
216 int error; 226 int error;
217 X509 *current_cert; 227 X509 *current_cert;
228 X509 *current_issuer; /* cert currently being tested as valid issuer */
218 229
219 CRYPTO_EX_DATA ex_data; 230 CRYPTO_EX_DATA ex_data;
220 }; 231 };
@@ -265,10 +276,20 @@ struct x509_store_state_st /* X509_STORE_CTX */
265#define X509_V_ERR_INVALID_PURPOSE 26 276#define X509_V_ERR_INVALID_PURPOSE 26
266#define X509_V_ERR_CERT_UNTRUSTED 27 277#define X509_V_ERR_CERT_UNTRUSTED 27
267#define X509_V_ERR_CERT_REJECTED 28 278#define X509_V_ERR_CERT_REJECTED 28
279/* These are 'informational' when looking for issuer cert */
280#define X509_V_ERR_SUBJECT_ISSUER_MISMATCH 29
281#define X509_V_ERR_AKID_SKID_MISMATCH 30
282#define X509_V_ERR_AKID_ISSUER_SERIAL_MISMATCH 31
283#define X509_V_ERR_KEYUSAGE_NO_CERTSIGN 32
268 284
269/* The application is not happy */ 285/* The application is not happy */
270#define X509_V_ERR_APPLICATION_VERIFICATION 50 286#define X509_V_ERR_APPLICATION_VERIFICATION 50
271 287
288/* Certificate verify flags */
289
290#define X509_V_FLAG_CB_ISSUER_CHECK 0x1 /* Send issuer+subject checks to verify_cb */
291#define X509_V_FLAG_USE_CHECK_TIME 0x2 /* Use check time instead of current time */
292
272 /* These functions are being redefined in another directory, 293 /* These functions are being redefined in another directory,
273 and clash when the linker is case-insensitive, so let's 294 and clash when the linker is case-insensitive, so let's
274 hide them a little, by giving them an extra 'o' at the 295 hide them a little, by giving them an extra 'o' at the
@@ -284,18 +305,23 @@ struct x509_store_state_st /* X509_STORE_CTX */
284#define X509v3_add_standard_extensions oX509v3_add_standard_extensions 305#define X509v3_add_standard_extensions oX509v3_add_standard_extensions
285#endif 306#endif
286 307
287#ifdef HEADER_LHASH_H 308int X509_OBJECT_idx_by_subject(STACK_OF(X509_OBJECT) *h, int type,
288X509_OBJECT *X509_OBJECT_retrieve_by_subject(LHASH *h,int type,X509_NAME *name); 309 X509_NAME *name);
289#endif 310X509_OBJECT *X509_OBJECT_retrieve_by_subject(STACK_OF(X509_OBJECT) *h,int type,X509_NAME *name);
311X509_OBJECT *X509_OBJECT_retrieve_match(STACK_OF(X509_OBJECT) *h, X509_OBJECT *x);
290void X509_OBJECT_up_ref_count(X509_OBJECT *a); 312void X509_OBJECT_up_ref_count(X509_OBJECT *a);
291void X509_OBJECT_free_contents(X509_OBJECT *a); 313void X509_OBJECT_free_contents(X509_OBJECT *a);
292X509_STORE *X509_STORE_new(void ); 314X509_STORE *X509_STORE_new(void );
293void X509_STORE_free(X509_STORE *v); 315void X509_STORE_free(X509_STORE *v);
294 316
295X509_STORE_CTX *X509_STORE_CTX_new(void); 317X509_STORE_CTX *X509_STORE_CTX_new(void);
318
319int X509_STORE_CTX_get1_issuer(X509 **issuer, X509_STORE_CTX *ctx, X509 *x);
320
296void X509_STORE_CTX_free(X509_STORE_CTX *ctx); 321void X509_STORE_CTX_free(X509_STORE_CTX *ctx);
297void X509_STORE_CTX_init(X509_STORE_CTX *ctx, X509_STORE *store, 322void X509_STORE_CTX_init(X509_STORE_CTX *ctx, X509_STORE *store,
298 X509 *x509, STACK_OF(X509) *chain); 323 X509 *x509, STACK_OF(X509) *chain);
324void X509_STORE_CTX_trusted_stack(X509_STORE_CTX *ctx, STACK_OF(X509) *sk);
299void X509_STORE_CTX_cleanup(X509_STORE_CTX *ctx); 325void X509_STORE_CTX_cleanup(X509_STORE_CTX *ctx);
300 326
301X509_LOOKUP *X509_STORE_add_lookup(X509_STORE *v, X509_LOOKUP_METHOD *m); 327X509_LOOKUP *X509_STORE_add_lookup(X509_STORE *v, X509_LOOKUP_METHOD *m);
@@ -354,6 +380,8 @@ int X509_STORE_CTX_set_purpose(X509_STORE_CTX *ctx, int purpose);
354int X509_STORE_CTX_set_trust(X509_STORE_CTX *ctx, int trust); 380int X509_STORE_CTX_set_trust(X509_STORE_CTX *ctx, int trust);
355int X509_STORE_CTX_purpose_inherit(X509_STORE_CTX *ctx, int def_purpose, 381int X509_STORE_CTX_purpose_inherit(X509_STORE_CTX *ctx, int def_purpose,
356 int purpose, int trust); 382 int purpose, int trust);
383void X509_STORE_CTX_set_flags(X509_STORE_CTX *ctx, long flags);
384void X509_STORE_CTX_set_time(X509_STORE_CTX *ctx, long flags, time_t t);
357 385
358#ifdef __cplusplus 386#ifdef __cplusplus
359} 387}
diff --git a/src/lib/libcrypto/x509/x509spki.c b/src/lib/libcrypto/x509/x509spki.c
index b35c3f92e7..fd0a534d88 100644
--- a/src/lib/libcrypto/x509/x509spki.c
+++ b/src/lib/libcrypto/x509/x509spki.c
@@ -82,7 +82,7 @@ NETSCAPE_SPKI * NETSCAPE_SPKI_b64_decode(const char *str, int len)
82 int spki_len; 82 int spki_len;
83 NETSCAPE_SPKI *spki; 83 NETSCAPE_SPKI *spki;
84 if(len <= 0) len = strlen(str); 84 if(len <= 0) len = strlen(str);
85 if (!(spki_der = Malloc(len + 1))) { 85 if (!(spki_der = OPENSSL_malloc(len + 1))) {
86 X509err(X509_F_NETSCAPE_SPKI_B64_DECODE, ERR_R_MALLOC_FAILURE); 86 X509err(X509_F_NETSCAPE_SPKI_B64_DECODE, ERR_R_MALLOC_FAILURE);
87 return NULL; 87 return NULL;
88 } 88 }
@@ -90,12 +90,12 @@ NETSCAPE_SPKI * NETSCAPE_SPKI_b64_decode(const char *str, int len)
90 if(spki_len < 0) { 90 if(spki_len < 0) {
91 X509err(X509_F_NETSCAPE_SPKI_B64_DECODE, 91 X509err(X509_F_NETSCAPE_SPKI_B64_DECODE,
92 X509_R_BASE64_DECODE_ERROR); 92 X509_R_BASE64_DECODE_ERROR);
93 Free(spki_der); 93 OPENSSL_free(spki_der);
94 return NULL; 94 return NULL;
95 } 95 }
96 p = spki_der; 96 p = spki_der;
97 spki = d2i_NETSCAPE_SPKI(NULL, &p, spki_len); 97 spki = d2i_NETSCAPE_SPKI(NULL, &p, spki_len);
98 Free(spki_der); 98 OPENSSL_free(spki_der);
99 return spki; 99 return spki;
100} 100}
101 101
@@ -107,8 +107,8 @@ char * NETSCAPE_SPKI_b64_encode(NETSCAPE_SPKI *spki)
107 char *b64_str; 107 char *b64_str;
108 int der_len; 108 int der_len;
109 der_len = i2d_NETSCAPE_SPKI(spki, NULL); 109 der_len = i2d_NETSCAPE_SPKI(spki, NULL);
110 der_spki = Malloc(der_len); 110 der_spki = OPENSSL_malloc(der_len);
111 b64_str = Malloc(der_len * 2); 111 b64_str = OPENSSL_malloc(der_len * 2);
112 if(!der_spki || !b64_str) { 112 if(!der_spki || !b64_str) {
113 X509err(X509_F_NETSCAPE_SPKI_B64_ENCODE, ERR_R_MALLOC_FAILURE); 113 X509err(X509_F_NETSCAPE_SPKI_B64_ENCODE, ERR_R_MALLOC_FAILURE);
114 return NULL; 114 return NULL;
@@ -116,6 +116,6 @@ char * NETSCAPE_SPKI_b64_encode(NETSCAPE_SPKI *spki)
116 p = der_spki; 116 p = der_spki;
117 i2d_NETSCAPE_SPKI(spki, &p); 117 i2d_NETSCAPE_SPKI(spki, &p);
118 EVP_EncodeBlock((unsigned char *)b64_str, der_spki, der_len); 118 EVP_EncodeBlock((unsigned char *)b64_str, der_spki, der_len);
119 Free(der_spki); 119 OPENSSL_free(der_spki);
120 return b64_str; 120 return b64_str;
121} 121}
diff --git a/src/lib/libcrypto/x509/x_all.c b/src/lib/libcrypto/x509/x_all.c
index d2bf3c8e1c..9bd6e2a39b 100644
--- a/src/lib/libcrypto/x509/x_all.c
+++ b/src/lib/libcrypto/x509/x_all.c
@@ -411,13 +411,25 @@ X509_NAME_ENTRY *X509_NAME_ENTRY_dup(X509_NAME_ENTRY *ne)
411 (char *(*)())d2i_X509_NAME_ENTRY,(char *)ne)); 411 (char *(*)())d2i_X509_NAME_ENTRY,(char *)ne));
412 } 412 }
413 413
414int X509_digest(X509 *data, const EVP_MD *type, unsigned char *md, 414int X509_digest(const X509 *data, const EVP_MD *type, unsigned char *md,
415 unsigned int *len) 415 unsigned int *len)
416 { 416 {
417 return(ASN1_digest((int (*)())i2d_X509,type,(char *)data,md,len)); 417 return(ASN1_digest((int (*)())i2d_X509,type,(char *)data,md,len));
418 } 418 }
419 419
420int X509_NAME_digest(X509_NAME *data, const EVP_MD *type, unsigned char *md, 420int X509_CRL_digest(const X509_CRL *data, const EVP_MD *type, unsigned char *md,
421 unsigned int *len)
422 {
423 return(ASN1_digest((int (*)())i2d_X509_CRL,type,(char *)data,md,len));
424 }
425
426int X509_REQ_digest(const X509_REQ *data, const EVP_MD *type, unsigned char *md,
427 unsigned int *len)
428 {
429 return(ASN1_digest((int (*)())i2d_X509_REQ,type,(char *)data,md,len));
430 }
431
432int X509_NAME_digest(const X509_NAME *data, const EVP_MD *type, unsigned char *md,
421 unsigned int *len) 433 unsigned int *len)
422 { 434 {
423 return(ASN1_digest((int (*)())i2d_X509_NAME,type,(char *)data,md,len)); 435 return(ASN1_digest((int (*)())i2d_X509_NAME,type,(char *)data,md,len));
@@ -492,6 +504,17 @@ EVP_PKEY *d2i_PrivateKey_fp(FILE *fp, EVP_PKEY **a)
492 (char *(*)())d2i_AutoPrivateKey, (fp),(unsigned char **)(a))); 504 (char *(*)())d2i_AutoPrivateKey, (fp),(unsigned char **)(a)));
493} 505}
494 506
507int i2d_PUBKEY_fp(FILE *fp, EVP_PKEY *pkey)
508 {
509 return(ASN1_i2d_fp(i2d_PUBKEY,fp,(unsigned char *)pkey));
510 }
511
512EVP_PKEY *d2i_PUBKEY_fp(FILE *fp, EVP_PKEY **a)
513{
514 return((EVP_PKEY *)ASN1_d2i_fp((char *(*)())EVP_PKEY_new,
515 (char *(*)())d2i_PUBKEY, (fp),(unsigned char **)(a)));
516}
517
495#endif 518#endif
496 519
497PKCS8_PRIV_KEY_INFO *d2i_PKCS8_PRIV_KEY_INFO_bio(BIO *bp, 520PKCS8_PRIV_KEY_INFO *d2i_PKCS8_PRIV_KEY_INFO_bio(BIO *bp,
@@ -529,3 +552,14 @@ EVP_PKEY *d2i_PrivateKey_bio(BIO *bp, EVP_PKEY **a)
529 return((EVP_PKEY *)ASN1_d2i_bio((char *(*)())EVP_PKEY_new, 552 return((EVP_PKEY *)ASN1_d2i_bio((char *(*)())EVP_PKEY_new,
530 (char *(*)())d2i_AutoPrivateKey, (bp),(unsigned char **)(a))); 553 (char *(*)())d2i_AutoPrivateKey, (bp),(unsigned char **)(a)));
531 } 554 }
555
556int i2d_PUBKEY_bio(BIO *bp, EVP_PKEY *pkey)
557 {
558 return(ASN1_i2d_bio(i2d_PUBKEY,bp,(unsigned char *)pkey));
559 }
560
561EVP_PKEY *d2i_PUBKEY_bio(BIO *bp, EVP_PKEY **a)
562 {
563 return((EVP_PKEY *)ASN1_d2i_bio((char *(*)())EVP_PKEY_new,
564 (char *(*)())d2i_PUBKEY, (bp),(unsigned char **)(a)));
565 }