summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/asn1
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libcrypto/asn1')
-rw-r--r--src/lib/libcrypto/asn1/Makefile.ssl1152
-rw-r--r--src/lib/libcrypto/asn1/a_bitstr.c23
-rw-r--r--src/lib/libcrypto/asn1/a_dup.c2
-rw-r--r--src/lib/libcrypto/asn1/a_gentm.c23
-rw-r--r--src/lib/libcrypto/asn1/a_hdr.c119
-rw-r--r--src/lib/libcrypto/asn1/a_int.c10
-rw-r--r--src/lib/libcrypto/asn1/a_mbstr.c2
-rw-r--r--src/lib/libcrypto/asn1/a_meth.c84
-rw-r--r--src/lib/libcrypto/asn1/a_object.c35
-rw-r--r--src/lib/libcrypto/asn1/a_octet.c4
-rw-r--r--src/lib/libcrypto/asn1/a_set.c45
-rw-r--r--src/lib/libcrypto/asn1/a_sign.c78
-rw-r--r--src/lib/libcrypto/asn1/a_strnid.c18
-rw-r--r--src/lib/libcrypto/asn1/a_time.c40
-rw-r--r--src/lib/libcrypto/asn1/a_type.c53
-rw-r--r--src/lib/libcrypto/asn1/a_utctm.c21
-rw-r--r--src/lib/libcrypto/asn1/a_verify.c31
-rw-r--r--src/lib/libcrypto/asn1/asn1.h247
-rw-r--r--src/lib/libcrypto/asn1/asn1_err.c22
-rw-r--r--src/lib/libcrypto/asn1/asn1_lib.c36
-rw-r--r--src/lib/libcrypto/asn1/asn1_mac.h7
-rw-r--r--src/lib/libcrypto/asn1/asn1_par.c17
-rw-r--r--src/lib/libcrypto/asn1/asn1t.h71
-rw-r--r--src/lib/libcrypto/asn1/asn_mime.c88
-rw-r--r--src/lib/libcrypto/asn1/asn_pack.c8
-rw-r--r--src/lib/libcrypto/asn1/charmap.h2
-rw-r--r--src/lib/libcrypto/asn1/d2i_pr.c97
-rw-r--r--src/lib/libcrypto/asn1/d2i_pu.c10
-rw-r--r--src/lib/libcrypto/asn1/f.c80
-rw-r--r--src/lib/libcrypto/asn1/i2d_pr.c39
-rw-r--r--src/lib/libcrypto/asn1/nsseq.c5
-rw-r--r--src/lib/libcrypto/asn1/p5_pbe.c105
-rw-r--r--src/lib/libcrypto/asn1/p5_pbev2.c54
-rw-r--r--src/lib/libcrypto/asn1/p8_key.c131
-rw-r--r--src/lib/libcrypto/asn1/p8_pkey.c75
-rw-r--r--src/lib/libcrypto/asn1/t_pkey.c729
-rw-r--r--src/lib/libcrypto/asn1/t_req.c28
-rw-r--r--src/lib/libcrypto/asn1/t_spki.c31
-rw-r--r--src/lib/libcrypto/asn1/t_x509.c64
-rw-r--r--src/lib/libcrypto/asn1/tasn_dec.c24
-rw-r--r--src/lib/libcrypto/asn1/tasn_enc.c11
-rw-r--r--src/lib/libcrypto/asn1/tasn_fre.c8
-rw-r--r--src/lib/libcrypto/asn1/tasn_new.c23
-rw-r--r--src/lib/libcrypto/asn1/tasn_prn.c625
-rw-r--r--src/lib/libcrypto/asn1/tasn_typ.c11
-rw-r--r--src/lib/libcrypto/asn1/x_cinf.c201
-rw-r--r--src/lib/libcrypto/asn1/x_crl.c391
-rw-r--r--src/lib/libcrypto/asn1/x_long.c10
-rw-r--r--src/lib/libcrypto/asn1/x_name.c298
-rw-r--r--src/lib/libcrypto/asn1/x_pubkey.c304
-rw-r--r--src/lib/libcrypto/asn1/x_req.c3
-rw-r--r--src/lib/libcrypto/asn1/x_x509.c20
52 files changed, 2246 insertions, 3369 deletions
diff --git a/src/lib/libcrypto/asn1/Makefile.ssl b/src/lib/libcrypto/asn1/Makefile.ssl
deleted file mode 100644
index cb45194d48..0000000000
--- a/src/lib/libcrypto/asn1/Makefile.ssl
+++ /dev/null
@@ -1,1152 +0,0 @@
1#
2# SSLeay/crypto/asn1/Makefile
3#
4
5DIR= asn1
6TOP= ../..
7CC= cc
8INCLUDES= -I.. -I$(TOP) -I../../include
9CFLAG=-g
10INSTALL_PREFIX=
11OPENSSLDIR= /usr/local/ssl
12INSTALLTOP=/usr/local/ssl
13MAKE= make -f Makefile.ssl
14MAKEDEPPROG= makedepend
15MAKEDEPEND= $(TOP)/util/domd $(TOP) -MD $(MAKEDEPPROG)
16MAKEFILE= Makefile.ssl
17AR= ar r
18
19CFLAGS= $(INCLUDES) $(CFLAG)
20
21GENERAL=Makefile README
22TEST=
23APPS=
24
25LIB=$(TOP)/libcrypto.a
26LIBSRC= a_object.c a_bitstr.c a_utctm.c a_gentm.c a_time.c a_int.c a_octet.c \
27 a_print.c a_type.c a_set.c a_dup.c a_d2i_fp.c a_i2d_fp.c \
28 a_enum.c a_utf8.c a_sign.c a_digest.c a_verify.c a_mbstr.c a_strex.c \
29 x_algor.c x_val.c x_pubkey.c x_sig.c x_req.c x_attrib.c x_bignum.c \
30 x_long.c x_name.c x_x509.c x_x509a.c x_crl.c x_info.c x_spki.c nsseq.c \
31 d2i_pu.c d2i_pr.c i2d_pu.c i2d_pr.c\
32 t_req.c t_x509.c t_x509a.c t_crl.c t_pkey.c t_spki.c t_bitst.c \
33 tasn_new.c tasn_fre.c tasn_enc.c tasn_dec.c tasn_utl.c tasn_typ.c \
34 f_int.c f_string.c n_pkey.c \
35 f_enum.c a_hdr.c x_pkey.c a_bool.c x_exten.c \
36 asn1_par.c asn1_lib.c asn1_err.c a_meth.c a_bytes.c a_strnid.c \
37 evp_asn1.c asn_pack.c p5_pbe.c p5_pbev2.c p8_pkey.c asn_moid.c
38LIBOBJ= a_object.o a_bitstr.o a_utctm.o a_gentm.o a_time.o a_int.o a_octet.o \
39 a_print.o a_type.o a_set.o a_dup.o a_d2i_fp.o a_i2d_fp.o \
40 a_enum.o a_utf8.o a_sign.o a_digest.o a_verify.o a_mbstr.o a_strex.o \
41 x_algor.o x_val.o x_pubkey.o x_sig.o x_req.o x_attrib.o x_bignum.o \
42 x_long.o x_name.o x_x509.o x_x509a.o x_crl.o x_info.o x_spki.o nsseq.o \
43 d2i_pu.o d2i_pr.o i2d_pu.o i2d_pr.o \
44 t_req.o t_x509.o t_x509a.o t_crl.o t_pkey.o t_spki.o t_bitst.o \
45 tasn_new.o tasn_fre.o tasn_enc.o tasn_dec.o tasn_utl.o tasn_typ.o \
46 f_int.o f_string.o n_pkey.o \
47 f_enum.o a_hdr.o x_pkey.o a_bool.o x_exten.o \
48 asn1_par.o asn1_lib.o asn1_err.o a_meth.o a_bytes.o a_strnid.o \
49 evp_asn1.o asn_pack.o p5_pbe.o p5_pbev2.o p8_pkey.o asn_moid.o
50
51SRC= $(LIBSRC)
52
53EXHEADER= asn1.h asn1_mac.h asn1t.h
54HEADER= $(EXHEADER)
55
56ALL= $(GENERAL) $(SRC) $(HEADER)
57
58top:
59 (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all)
60
61test: test.c
62 cc -g -I../../include -c test.c
63 cc -g -I../../include -o test test.o -L../.. -lcrypto
64
65pk: pk.c
66 cc -g -I../../include -c pk.c
67 cc -g -I../../include -o pk pk.o -L../.. -lcrypto
68
69all: lib
70
71lib: $(LIBOBJ)
72 $(AR) $(LIB) $(LIBOBJ)
73 $(RANLIB) $(LIB) || echo Never mind.
74 @touch lib
75
76files:
77 $(PERL) $(TOP)/util/files.pl Makefile.ssl >> $(TOP)/MINFO
78
79links:
80 @sh $(TOP)/util/point.sh Makefile.ssl Makefile
81 @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER)
82 @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST)
83 @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS)
84
85install:
86 @for i in $(EXHEADER) ; \
87 do \
88 (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
89 chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
90 done;
91
92tags:
93 ctags $(SRC)
94
95tests:
96
97lint:
98 lint -DLINT $(INCLUDES) $(SRC)>fluff
99
100depend:
101 $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC)
102
103dclean:
104 $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new
105 mv -f Makefile.new $(MAKEFILE)
106
107clean:
108 rm -f *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
109
110
111# DO NOT DELETE THIS LINE -- make depend depends on it.
112
113a_bitstr.o: ../../e_os.h ../../include/openssl/asn1.h
114a_bitstr.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
115a_bitstr.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
116a_bitstr.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
117a_bitstr.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
118a_bitstr.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
119a_bitstr.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
120a_bitstr.o: ../../include/openssl/symhacks.h ../cryptlib.h a_bitstr.c
121a_bool.o: ../../e_os.h ../../include/openssl/asn1.h
122a_bool.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
123a_bool.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
124a_bool.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
125a_bool.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
126a_bool.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
127a_bool.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h
128a_bool.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
129a_bool.o: ../cryptlib.h a_bool.c
130a_bytes.o: ../../e_os.h ../../include/openssl/asn1.h
131a_bytes.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
132a_bytes.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
133a_bytes.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
134a_bytes.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
135a_bytes.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
136a_bytes.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
137a_bytes.o: ../../include/openssl/symhacks.h ../cryptlib.h a_bytes.c
138a_d2i_fp.o: ../../e_os.h ../../include/openssl/asn1.h
139a_d2i_fp.o: ../../include/openssl/asn1_mac.h ../../include/openssl/bio.h
140a_d2i_fp.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
141a_d2i_fp.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
142a_d2i_fp.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
143a_d2i_fp.o: ../../include/openssl/opensslconf.h
144a_d2i_fp.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
145a_d2i_fp.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
146a_d2i_fp.o: ../../include/openssl/symhacks.h ../cryptlib.h a_d2i_fp.c
147a_digest.o: ../../e_os.h ../../include/openssl/aes.h
148a_digest.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
149a_digest.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
150a_digest.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
151a_digest.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
152a_digest.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
153a_digest.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
154a_digest.o: ../../include/openssl/err.h ../../include/openssl/evp.h
155a_digest.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
156a_digest.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
157a_digest.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
158a_digest.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
159a_digest.o: ../../include/openssl/opensslconf.h
160a_digest.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
161a_digest.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
162a_digest.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
163a_digest.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
164a_digest.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
165a_digest.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
166a_digest.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
167a_digest.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
168a_digest.o: ../cryptlib.h a_digest.c
169a_dup.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
170a_dup.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
171a_dup.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
172a_dup.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
173a_dup.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
174a_dup.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h
175a_dup.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
176a_dup.o: ../cryptlib.h a_dup.c
177a_enum.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
178a_enum.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
179a_enum.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
180a_enum.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
181a_enum.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
182a_enum.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h
183a_enum.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
184a_enum.o: ../cryptlib.h a_enum.c
185a_gentm.o: ../../e_os.h ../../include/openssl/asn1.h
186a_gentm.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
187a_gentm.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
188a_gentm.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
189a_gentm.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
190a_gentm.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
191a_gentm.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
192a_gentm.o: ../../include/openssl/symhacks.h ../cryptlib.h ../o_time.h a_gentm.c
193a_hdr.o: ../../e_os.h ../../include/openssl/asn1.h
194a_hdr.o: ../../include/openssl/asn1_mac.h ../../include/openssl/bio.h
195a_hdr.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
196a_hdr.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
197a_hdr.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
198a_hdr.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
199a_hdr.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h
200a_hdr.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
201a_hdr.o: ../cryptlib.h a_hdr.c
202a_i2d_fp.o: ../../e_os.h ../../include/openssl/asn1.h
203a_i2d_fp.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
204a_i2d_fp.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
205a_i2d_fp.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
206a_i2d_fp.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
207a_i2d_fp.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
208a_i2d_fp.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
209a_i2d_fp.o: ../../include/openssl/symhacks.h ../cryptlib.h a_i2d_fp.c
210a_int.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
211a_int.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
212a_int.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
213a_int.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
214a_int.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
215a_int.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h
216a_int.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
217a_int.o: ../cryptlib.h a_int.c
218a_mbstr.o: ../../e_os.h ../../include/openssl/asn1.h
219a_mbstr.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
220a_mbstr.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
221a_mbstr.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
222a_mbstr.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
223a_mbstr.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
224a_mbstr.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
225a_mbstr.o: ../../include/openssl/symhacks.h ../cryptlib.h a_mbstr.c
226a_meth.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
227a_meth.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
228a_meth.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
229a_meth.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
230a_meth.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
231a_meth.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h
232a_meth.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
233a_meth.o: ../cryptlib.h a_meth.c
234a_object.o: ../../e_os.h ../../include/openssl/asn1.h
235a_object.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
236a_object.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
237a_object.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
238a_object.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
239a_object.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
240a_object.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
241a_object.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
242a_object.o: ../../include/openssl/symhacks.h ../cryptlib.h a_object.c
243a_octet.o: ../../e_os.h ../../include/openssl/asn1.h
244a_octet.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
245a_octet.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
246a_octet.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
247a_octet.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
248a_octet.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
249a_octet.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
250a_octet.o: ../../include/openssl/symhacks.h ../cryptlib.h a_octet.c
251a_print.o: ../../e_os.h ../../include/openssl/asn1.h
252a_print.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
253a_print.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
254a_print.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
255a_print.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
256a_print.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
257a_print.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
258a_print.o: ../../include/openssl/symhacks.h ../cryptlib.h a_print.c
259a_set.o: ../../e_os.h ../../include/openssl/asn1.h
260a_set.o: ../../include/openssl/asn1_mac.h ../../include/openssl/bio.h
261a_set.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
262a_set.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
263a_set.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
264a_set.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
265a_set.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h
266a_set.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
267a_set.o: ../cryptlib.h a_set.c
268a_sign.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h
269a_sign.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
270a_sign.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
271a_sign.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h
272a_sign.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
273a_sign.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
274a_sign.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
275a_sign.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
276a_sign.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
277a_sign.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
278a_sign.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
279a_sign.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
280a_sign.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
281a_sign.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
282a_sign.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
283a_sign.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
284a_sign.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
285a_sign.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
286a_sign.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
287a_sign.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
288a_sign.o: ../cryptlib.h a_sign.c
289a_strex.o: ../../e_os.h ../../include/openssl/aes.h
290a_strex.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
291a_strex.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
292a_strex.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
293a_strex.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
294a_strex.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
295a_strex.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
296a_strex.o: ../../include/openssl/err.h ../../include/openssl/evp.h
297a_strex.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
298a_strex.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
299a_strex.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
300a_strex.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
301a_strex.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
302a_strex.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
303a_strex.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
304a_strex.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
305a_strex.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
306a_strex.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
307a_strex.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
308a_strex.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h
309a_strex.o: ../../include/openssl/x509_vfy.h ../cryptlib.h a_strex.c charmap.h
310a_strnid.o: ../../e_os.h ../../include/openssl/asn1.h
311a_strnid.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
312a_strnid.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
313a_strnid.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
314a_strnid.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
315a_strnid.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
316a_strnid.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
317a_strnid.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
318a_strnid.o: ../../include/openssl/symhacks.h ../cryptlib.h a_strnid.c
319a_time.o: ../../e_os.h ../../include/openssl/asn1.h
320a_time.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
321a_time.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
322a_time.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
323a_time.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
324a_time.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
325a_time.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h
326a_time.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
327a_time.o: ../cryptlib.h ../o_time.h a_time.c
328a_type.o: ../../e_os.h ../../include/openssl/asn1.h
329a_type.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
330a_type.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
331a_type.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
332a_type.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
333a_type.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
334a_type.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h
335a_type.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
336a_type.o: ../cryptlib.h a_type.c
337a_utctm.o: ../../e_os.h ../../include/openssl/asn1.h
338a_utctm.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
339a_utctm.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
340a_utctm.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
341a_utctm.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
342a_utctm.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
343a_utctm.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
344a_utctm.o: ../../include/openssl/symhacks.h ../cryptlib.h ../o_time.h a_utctm.c
345a_utf8.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
346a_utf8.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
347a_utf8.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
348a_utf8.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
349a_utf8.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
350a_utf8.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h
351a_utf8.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
352a_utf8.o: ../cryptlib.h a_utf8.c
353a_verify.o: ../../e_os.h ../../include/openssl/aes.h
354a_verify.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
355a_verify.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
356a_verify.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
357a_verify.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
358a_verify.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
359a_verify.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
360a_verify.o: ../../include/openssl/err.h ../../include/openssl/evp.h
361a_verify.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
362a_verify.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
363a_verify.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
364a_verify.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
365a_verify.o: ../../include/openssl/opensslconf.h
366a_verify.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
367a_verify.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
368a_verify.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
369a_verify.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
370a_verify.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
371a_verify.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
372a_verify.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
373a_verify.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
374a_verify.o: ../cryptlib.h a_verify.c
375asn1_err.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
376asn1_err.o: ../../include/openssl/bn.h ../../include/openssl/crypto.h
377asn1_err.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
378asn1_err.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
379asn1_err.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
380asn1_err.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
381asn1_err.o: ../../include/openssl/symhacks.h asn1_err.c
382asn1_lib.o: ../../e_os.h ../../include/openssl/asn1.h
383asn1_lib.o: ../../include/openssl/asn1_mac.h ../../include/openssl/bio.h
384asn1_lib.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
385asn1_lib.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
386asn1_lib.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
387asn1_lib.o: ../../include/openssl/opensslconf.h
388asn1_lib.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
389asn1_lib.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
390asn1_lib.o: ../../include/openssl/symhacks.h ../cryptlib.h asn1_lib.c
391asn1_par.o: ../../e_os.h ../../include/openssl/asn1.h
392asn1_par.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
393asn1_par.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
394asn1_par.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
395asn1_par.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
396asn1_par.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
397asn1_par.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
398asn1_par.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
399asn1_par.o: ../../include/openssl/symhacks.h ../cryptlib.h asn1_par.c
400asn_moid.o: ../../e_os.h ../../include/openssl/aes.h
401asn_moid.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
402asn_moid.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
403asn_moid.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
404asn_moid.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h
405asn_moid.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
406asn_moid.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
407asn_moid.o: ../../include/openssl/dso.h ../../include/openssl/e_os2.h
408asn_moid.o: ../../include/openssl/err.h ../../include/openssl/evp.h
409asn_moid.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
410asn_moid.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
411asn_moid.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
412asn_moid.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
413asn_moid.o: ../../include/openssl/opensslconf.h
414asn_moid.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
415asn_moid.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
416asn_moid.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
417asn_moid.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
418asn_moid.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
419asn_moid.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
420asn_moid.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
421asn_moid.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
422asn_moid.o: ../cryptlib.h asn_moid.c
423asn_pack.o: ../../e_os.h ../../include/openssl/asn1.h
424asn_pack.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
425asn_pack.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
426asn_pack.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
427asn_pack.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
428asn_pack.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
429asn_pack.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
430asn_pack.o: ../../include/openssl/symhacks.h ../cryptlib.h asn_pack.c
431d2i_pr.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h
432d2i_pr.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
433d2i_pr.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
434d2i_pr.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h
435d2i_pr.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
436d2i_pr.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
437d2i_pr.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
438d2i_pr.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
439d2i_pr.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
440d2i_pr.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
441d2i_pr.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
442d2i_pr.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
443d2i_pr.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
444d2i_pr.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
445d2i_pr.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
446d2i_pr.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
447d2i_pr.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
448d2i_pr.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
449d2i_pr.o: ../../include/openssl/ui_compat.h ../cryptlib.h d2i_pr.c
450d2i_pu.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h
451d2i_pu.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
452d2i_pu.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
453d2i_pu.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h
454d2i_pu.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
455d2i_pu.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
456d2i_pu.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
457d2i_pu.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
458d2i_pu.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
459d2i_pu.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
460d2i_pu.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
461d2i_pu.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
462d2i_pu.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
463d2i_pu.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
464d2i_pu.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
465d2i_pu.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
466d2i_pu.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
467d2i_pu.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
468d2i_pu.o: ../../include/openssl/ui_compat.h ../cryptlib.h d2i_pu.c
469evp_asn1.o: ../../e_os.h ../../include/openssl/asn1.h
470evp_asn1.o: ../../include/openssl/asn1_mac.h ../../include/openssl/bio.h
471evp_asn1.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
472evp_asn1.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
473evp_asn1.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
474evp_asn1.o: ../../include/openssl/opensslconf.h
475evp_asn1.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
476evp_asn1.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
477evp_asn1.o: ../../include/openssl/symhacks.h ../cryptlib.h evp_asn1.c
478f_enum.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
479f_enum.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
480f_enum.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
481f_enum.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
482f_enum.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
483f_enum.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h
484f_enum.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
485f_enum.o: ../cryptlib.h f_enum.c
486f_int.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
487f_int.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
488f_int.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
489f_int.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
490f_int.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
491f_int.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h
492f_int.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
493f_int.o: ../cryptlib.h f_int.c
494f_string.o: ../../e_os.h ../../include/openssl/asn1.h
495f_string.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
496f_string.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
497f_string.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
498f_string.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
499f_string.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
500f_string.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
501f_string.o: ../../include/openssl/symhacks.h ../cryptlib.h f_string.c
502i2d_pr.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h
503i2d_pr.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
504i2d_pr.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
505i2d_pr.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h
506i2d_pr.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
507i2d_pr.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
508i2d_pr.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
509i2d_pr.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
510i2d_pr.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
511i2d_pr.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
512i2d_pr.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
513i2d_pr.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
514i2d_pr.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
515i2d_pr.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
516i2d_pr.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
517i2d_pr.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
518i2d_pr.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
519i2d_pr.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
520i2d_pr.o: ../../include/openssl/ui_compat.h ../cryptlib.h i2d_pr.c
521i2d_pu.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h
522i2d_pu.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
523i2d_pu.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
524i2d_pu.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h
525i2d_pu.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
526i2d_pu.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
527i2d_pu.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
528i2d_pu.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
529i2d_pu.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
530i2d_pu.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
531i2d_pu.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
532i2d_pu.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
533i2d_pu.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
534i2d_pu.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
535i2d_pu.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
536i2d_pu.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
537i2d_pu.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
538i2d_pu.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
539i2d_pu.o: ../../include/openssl/ui_compat.h ../cryptlib.h i2d_pu.c
540n_pkey.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h
541n_pkey.o: ../../include/openssl/asn1_mac.h ../../include/openssl/asn1t.h
542n_pkey.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
543n_pkey.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
544n_pkey.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h
545n_pkey.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
546n_pkey.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
547n_pkey.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
548n_pkey.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
549n_pkey.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
550n_pkey.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
551n_pkey.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
552n_pkey.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
553n_pkey.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
554n_pkey.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
555n_pkey.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
556n_pkey.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
557n_pkey.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
558n_pkey.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
559n_pkey.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
560n_pkey.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
561n_pkey.o: ../cryptlib.h n_pkey.c
562nsseq.o: ../../include/openssl/aes.h ../../include/openssl/asn1.h
563nsseq.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
564nsseq.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
565nsseq.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
566nsseq.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
567nsseq.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
568nsseq.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
569nsseq.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
570nsseq.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
571nsseq.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
572nsseq.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
573nsseq.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
574nsseq.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
575nsseq.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
576nsseq.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
577nsseq.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
578nsseq.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
579nsseq.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
580nsseq.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
581nsseq.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h nsseq.c
582p5_pbe.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h
583p5_pbe.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
584p5_pbe.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
585p5_pbe.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
586p5_pbe.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
587p5_pbe.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
588p5_pbe.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
589p5_pbe.o: ../../include/openssl/err.h ../../include/openssl/evp.h
590p5_pbe.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
591p5_pbe.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
592p5_pbe.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
593p5_pbe.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
594p5_pbe.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
595p5_pbe.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
596p5_pbe.o: ../../include/openssl/rand.h ../../include/openssl/rc2.h
597p5_pbe.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
598p5_pbe.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
599p5_pbe.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
600p5_pbe.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
601p5_pbe.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
602p5_pbe.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
603p5_pbe.o: ../cryptlib.h p5_pbe.c
604p5_pbev2.o: ../../e_os.h ../../include/openssl/aes.h
605p5_pbev2.o: ../../include/openssl/asn1.h ../../include/openssl/asn1t.h
606p5_pbev2.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
607p5_pbev2.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
608p5_pbev2.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h
609p5_pbev2.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
610p5_pbev2.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
611p5_pbev2.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
612p5_pbev2.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
613p5_pbev2.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
614p5_pbev2.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
615p5_pbev2.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
616p5_pbev2.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
617p5_pbev2.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
618p5_pbev2.o: ../../include/openssl/pkcs7.h ../../include/openssl/rand.h
619p5_pbev2.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
620p5_pbev2.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
621p5_pbev2.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
622p5_pbev2.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
623p5_pbev2.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
624p5_pbev2.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h
625p5_pbev2.o: ../../include/openssl/x509_vfy.h ../cryptlib.h p5_pbev2.c
626p8_pkey.o: ../../e_os.h ../../include/openssl/aes.h
627p8_pkey.o: ../../include/openssl/asn1.h ../../include/openssl/asn1t.h
628p8_pkey.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
629p8_pkey.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
630p8_pkey.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h
631p8_pkey.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
632p8_pkey.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
633p8_pkey.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
634p8_pkey.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
635p8_pkey.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
636p8_pkey.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
637p8_pkey.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
638p8_pkey.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
639p8_pkey.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
640p8_pkey.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
641p8_pkey.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
642p8_pkey.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
643p8_pkey.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
644p8_pkey.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
645p8_pkey.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
646p8_pkey.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
647p8_pkey.o: ../cryptlib.h p8_pkey.c
648t_bitst.o: ../../e_os.h ../../include/openssl/aes.h
649t_bitst.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
650t_bitst.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
651t_bitst.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
652t_bitst.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h
653t_bitst.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
654t_bitst.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
655t_bitst.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
656t_bitst.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
657t_bitst.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
658t_bitst.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
659t_bitst.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
660t_bitst.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
661t_bitst.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
662t_bitst.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
663t_bitst.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
664t_bitst.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
665t_bitst.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
666t_bitst.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
667t_bitst.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
668t_bitst.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
669t_bitst.o: ../../include/openssl/x509v3.h ../cryptlib.h t_bitst.c
670t_crl.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h
671t_crl.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
672t_crl.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
673t_crl.o: ../../include/openssl/cast.h ../../include/openssl/conf.h
674t_crl.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
675t_crl.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
676t_crl.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
677t_crl.o: ../../include/openssl/err.h ../../include/openssl/evp.h
678t_crl.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
679t_crl.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
680t_crl.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
681t_crl.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
682t_crl.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
683t_crl.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
684t_crl.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
685t_crl.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
686t_crl.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
687t_crl.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
688t_crl.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
689t_crl.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h
690t_crl.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h
691t_crl.o: ../cryptlib.h t_crl.c
692t_pkey.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
693t_pkey.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
694t_pkey.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h
695t_pkey.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
696t_pkey.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
697t_pkey.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
698t_pkey.o: ../../include/openssl/ossl_typ.h ../../include/openssl/rsa.h
699t_pkey.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
700t_pkey.o: ../../include/openssl/symhacks.h ../cryptlib.h t_pkey.c
701t_req.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h
702t_req.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
703t_req.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
704t_req.o: ../../include/openssl/cast.h ../../include/openssl/conf.h
705t_req.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
706t_req.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
707t_req.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
708t_req.o: ../../include/openssl/err.h ../../include/openssl/evp.h
709t_req.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
710t_req.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
711t_req.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
712t_req.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
713t_req.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
714t_req.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
715t_req.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
716t_req.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
717t_req.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
718t_req.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
719t_req.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
720t_req.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h
721t_req.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h
722t_req.o: ../cryptlib.h t_req.c
723t_spki.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h
724t_spki.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
725t_spki.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
726t_spki.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h
727t_spki.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
728t_spki.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
729t_spki.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
730t_spki.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
731t_spki.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
732t_spki.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
733t_spki.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
734t_spki.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
735t_spki.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
736t_spki.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
737t_spki.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
738t_spki.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
739t_spki.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
740t_spki.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
741t_spki.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
742t_spki.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
743t_spki.o: ../cryptlib.h t_spki.c
744t_x509.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h
745t_x509.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
746t_x509.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
747t_x509.o: ../../include/openssl/cast.h ../../include/openssl/conf.h
748t_x509.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
749t_x509.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
750t_x509.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
751t_x509.o: ../../include/openssl/err.h ../../include/openssl/evp.h
752t_x509.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
753t_x509.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
754t_x509.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
755t_x509.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
756t_x509.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
757t_x509.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
758t_x509.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
759t_x509.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
760t_x509.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
761t_x509.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
762t_x509.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
763t_x509.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h
764t_x509.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h
765t_x509.o: ../cryptlib.h t_x509.c
766t_x509a.o: ../../e_os.h ../../include/openssl/aes.h
767t_x509a.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
768t_x509a.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
769t_x509a.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
770t_x509a.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
771t_x509a.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
772t_x509a.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
773t_x509a.o: ../../include/openssl/err.h ../../include/openssl/evp.h
774t_x509a.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
775t_x509a.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
776t_x509a.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
777t_x509a.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
778t_x509a.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
779t_x509a.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
780t_x509a.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
781t_x509a.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
782t_x509a.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
783t_x509a.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
784t_x509a.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
785t_x509a.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h
786t_x509a.o: ../../include/openssl/x509_vfy.h ../cryptlib.h t_x509a.c
787tasn_dec.o: ../../include/openssl/asn1.h ../../include/openssl/asn1t.h
788tasn_dec.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
789tasn_dec.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
790tasn_dec.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
791tasn_dec.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
792tasn_dec.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
793tasn_dec.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
794tasn_dec.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
795tasn_dec.o: ../../include/openssl/symhacks.h tasn_dec.c
796tasn_enc.o: ../../include/openssl/asn1.h ../../include/openssl/asn1t.h
797tasn_enc.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
798tasn_enc.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
799tasn_enc.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
800tasn_enc.o: ../../include/openssl/opensslconf.h
801tasn_enc.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
802tasn_enc.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
803tasn_enc.o: ../../include/openssl/symhacks.h tasn_enc.c
804tasn_fre.o: ../../include/openssl/asn1.h ../../include/openssl/asn1t.h
805tasn_fre.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
806tasn_fre.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
807tasn_fre.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
808tasn_fre.o: ../../include/openssl/opensslconf.h
809tasn_fre.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
810tasn_fre.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
811tasn_fre.o: ../../include/openssl/symhacks.h tasn_fre.c
812tasn_new.o: ../../include/openssl/asn1.h ../../include/openssl/asn1t.h
813tasn_new.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
814tasn_new.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
815tasn_new.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
816tasn_new.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
817tasn_new.o: ../../include/openssl/opensslconf.h
818tasn_new.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
819tasn_new.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
820tasn_new.o: ../../include/openssl/symhacks.h tasn_new.c
821tasn_typ.o: ../../include/openssl/asn1.h ../../include/openssl/asn1t.h
822tasn_typ.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
823tasn_typ.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
824tasn_typ.o: ../../include/openssl/opensslconf.h
825tasn_typ.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
826tasn_typ.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
827tasn_typ.o: ../../include/openssl/symhacks.h tasn_typ.c
828tasn_utl.o: ../../include/openssl/asn1.h ../../include/openssl/asn1t.h
829tasn_utl.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
830tasn_utl.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
831tasn_utl.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
832tasn_utl.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
833tasn_utl.o: ../../include/openssl/opensslconf.h
834tasn_utl.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
835tasn_utl.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
836tasn_utl.o: ../../include/openssl/symhacks.h tasn_utl.c
837x_algor.o: ../../include/openssl/aes.h ../../include/openssl/asn1.h
838x_algor.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
839x_algor.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
840x_algor.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
841x_algor.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
842x_algor.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
843x_algor.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
844x_algor.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
845x_algor.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
846x_algor.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
847x_algor.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
848x_algor.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
849x_algor.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
850x_algor.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
851x_algor.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
852x_algor.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
853x_algor.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
854x_algor.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
855x_algor.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
856x_algor.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
857x_algor.o: x_algor.c
858x_attrib.o: ../../e_os.h ../../include/openssl/aes.h
859x_attrib.o: ../../include/openssl/asn1.h ../../include/openssl/asn1t.h
860x_attrib.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
861x_attrib.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
862x_attrib.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h
863x_attrib.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
864x_attrib.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
865x_attrib.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
866x_attrib.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
867x_attrib.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
868x_attrib.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
869x_attrib.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
870x_attrib.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
871x_attrib.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
872x_attrib.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
873x_attrib.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
874x_attrib.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
875x_attrib.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
876x_attrib.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
877x_attrib.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
878x_attrib.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
879x_attrib.o: ../cryptlib.h x_attrib.c
880x_bignum.o: ../../e_os.h ../../include/openssl/asn1.h
881x_bignum.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
882x_bignum.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
883x_bignum.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
884x_bignum.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
885x_bignum.o: ../../include/openssl/opensslconf.h
886x_bignum.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
887x_bignum.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
888x_bignum.o: ../../include/openssl/symhacks.h ../cryptlib.h x_bignum.c
889x_crl.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h
890x_crl.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
891x_crl.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
892x_crl.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
893x_crl.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
894x_crl.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
895x_crl.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
896x_crl.o: ../../include/openssl/err.h ../../include/openssl/evp.h
897x_crl.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
898x_crl.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
899x_crl.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
900x_crl.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
901x_crl.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
902x_crl.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
903x_crl.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
904x_crl.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
905x_crl.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
906x_crl.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
907x_crl.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
908x_crl.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h
909x_crl.o: ../../include/openssl/x509_vfy.h ../cryptlib.h x_crl.c
910x_exten.o: ../../include/openssl/aes.h ../../include/openssl/asn1.h
911x_exten.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
912x_exten.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
913x_exten.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
914x_exten.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
915x_exten.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
916x_exten.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
917x_exten.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
918x_exten.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
919x_exten.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
920x_exten.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
921x_exten.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
922x_exten.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
923x_exten.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
924x_exten.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
925x_exten.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
926x_exten.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
927x_exten.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
928x_exten.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
929x_exten.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
930x_exten.o: x_exten.c
931x_info.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h
932x_info.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
933x_info.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
934x_info.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h
935x_info.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
936x_info.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
937x_info.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
938x_info.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
939x_info.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
940x_info.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
941x_info.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
942x_info.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
943x_info.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
944x_info.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
945x_info.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
946x_info.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
947x_info.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
948x_info.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
949x_info.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
950x_info.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
951x_info.o: ../cryptlib.h x_info.c
952x_long.o: ../../e_os.h ../../include/openssl/asn1.h
953x_long.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
954x_long.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
955x_long.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
956x_long.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
957x_long.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
958x_long.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h
959x_long.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
960x_long.o: ../cryptlib.h x_long.c
961x_name.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h
962x_name.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
963x_name.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
964x_name.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
965x_name.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
966x_name.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
967x_name.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
968x_name.o: ../../include/openssl/err.h ../../include/openssl/evp.h
969x_name.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
970x_name.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
971x_name.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
972x_name.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
973x_name.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
974x_name.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
975x_name.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
976x_name.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
977x_name.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
978x_name.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
979x_name.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
980x_name.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h
981x_name.o: ../../include/openssl/x509_vfy.h ../cryptlib.h x_name.c
982x_pkey.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h
983x_pkey.o: ../../include/openssl/asn1_mac.h ../../include/openssl/bio.h
984x_pkey.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
985x_pkey.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
986x_pkey.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
987x_pkey.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
988x_pkey.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
989x_pkey.o: ../../include/openssl/err.h ../../include/openssl/evp.h
990x_pkey.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
991x_pkey.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
992x_pkey.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
993x_pkey.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
994x_pkey.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
995x_pkey.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
996x_pkey.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
997x_pkey.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
998x_pkey.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
999x_pkey.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
1000x_pkey.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
1001x_pkey.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h
1002x_pkey.o: ../../include/openssl/x509_vfy.h ../cryptlib.h x_pkey.c
1003x_pubkey.o: ../../e_os.h ../../include/openssl/aes.h
1004x_pubkey.o: ../../include/openssl/asn1.h ../../include/openssl/asn1t.h
1005x_pubkey.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
1006x_pubkey.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
1007x_pubkey.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h
1008x_pubkey.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
1009x_pubkey.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
1010x_pubkey.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
1011x_pubkey.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
1012x_pubkey.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
1013x_pubkey.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
1014x_pubkey.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
1015x_pubkey.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
1016x_pubkey.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
1017x_pubkey.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
1018x_pubkey.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
1019x_pubkey.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
1020x_pubkey.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
1021x_pubkey.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
1022x_pubkey.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
1023x_pubkey.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
1024x_pubkey.o: ../cryptlib.h x_pubkey.c
1025x_req.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h
1026x_req.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
1027x_req.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
1028x_req.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
1029x_req.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
1030x_req.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
1031x_req.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
1032x_req.o: ../../include/openssl/err.h ../../include/openssl/evp.h
1033x_req.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
1034x_req.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
1035x_req.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
1036x_req.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
1037x_req.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
1038x_req.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
1039x_req.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
1040x_req.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
1041x_req.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
1042x_req.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
1043x_req.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
1044x_req.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h
1045x_req.o: ../../include/openssl/x509_vfy.h ../cryptlib.h x_req.c
1046x_sig.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h
1047x_sig.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
1048x_sig.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
1049x_sig.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
1050x_sig.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
1051x_sig.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
1052x_sig.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
1053x_sig.o: ../../include/openssl/err.h ../../include/openssl/evp.h
1054x_sig.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
1055x_sig.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
1056x_sig.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
1057x_sig.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
1058x_sig.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
1059x_sig.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
1060x_sig.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
1061x_sig.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
1062x_sig.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
1063x_sig.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
1064x_sig.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
1065x_sig.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h
1066x_sig.o: ../../include/openssl/x509_vfy.h ../cryptlib.h x_sig.c
1067x_spki.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h
1068x_spki.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
1069x_spki.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
1070x_spki.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
1071x_spki.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
1072x_spki.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
1073x_spki.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
1074x_spki.o: ../../include/openssl/err.h ../../include/openssl/evp.h
1075x_spki.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
1076x_spki.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
1077x_spki.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
1078x_spki.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
1079x_spki.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
1080x_spki.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
1081x_spki.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
1082x_spki.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
1083x_spki.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
1084x_spki.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
1085x_spki.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
1086x_spki.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h
1087x_spki.o: ../../include/openssl/x509_vfy.h ../cryptlib.h x_spki.c
1088x_val.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h
1089x_val.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
1090x_val.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
1091x_val.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
1092x_val.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
1093x_val.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
1094x_val.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
1095x_val.o: ../../include/openssl/err.h ../../include/openssl/evp.h
1096x_val.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
1097x_val.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
1098x_val.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
1099x_val.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
1100x_val.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
1101x_val.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
1102x_val.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
1103x_val.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
1104x_val.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
1105x_val.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
1106x_val.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
1107x_val.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h
1108x_val.o: ../../include/openssl/x509_vfy.h ../cryptlib.h x_val.c
1109x_x509.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h
1110x_x509.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
1111x_x509.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
1112x_x509.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
1113x_x509.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h
1114x_x509.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
1115x_x509.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
1116x_x509.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
1117x_x509.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
1118x_x509.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
1119x_x509.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
1120x_x509.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
1121x_x509.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
1122x_x509.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
1123x_x509.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
1124x_x509.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
1125x_x509.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
1126x_x509.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
1127x_x509.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
1128x_x509.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
1129x_x509.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
1130x_x509.o: ../../include/openssl/x509v3.h ../cryptlib.h x_x509.c
1131x_x509a.o: ../../e_os.h ../../include/openssl/aes.h
1132x_x509a.o: ../../include/openssl/asn1.h ../../include/openssl/asn1t.h
1133x_x509a.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
1134x_x509a.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
1135x_x509a.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h
1136x_x509a.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
1137x_x509a.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
1138x_x509a.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
1139x_x509a.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
1140x_x509a.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
1141x_x509a.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
1142x_x509a.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
1143x_x509a.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
1144x_x509a.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
1145x_x509a.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
1146x_x509a.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
1147x_x509a.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
1148x_x509a.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
1149x_x509a.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
1150x_x509a.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
1151x_x509a.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
1152x_x509a.o: ../cryptlib.h x_x509a.c
diff --git a/src/lib/libcrypto/asn1/a_bitstr.c b/src/lib/libcrypto/asn1/a_bitstr.c
index 0fb9ce0c2a..34179960b8 100644
--- a/src/lib/libcrypto/asn1/a_bitstr.c
+++ b/src/lib/libcrypto/asn1/a_bitstr.c
@@ -223,3 +223,26 @@ int ASN1_BIT_STRING_get_bit(ASN1_BIT_STRING *a, int n)
223 return((a->data[w]&v) != 0); 223 return((a->data[w]&v) != 0);
224 } 224 }
225 225
226/*
227 * Checks if the given bit string contains only bits specified by
228 * the flags vector. Returns 0 if there is at least one bit set in 'a'
229 * which is not specified in 'flags', 1 otherwise.
230 * 'len' is the length of 'flags'.
231 */
232int ASN1_BIT_STRING_check(ASN1_BIT_STRING *a,
233 unsigned char *flags, int flags_len)
234 {
235 int i, ok;
236 /* Check if there is one bit set at all. */
237 if (!a || !a->data) return 1;
238
239 /* Check each byte of the internal representation of the bit string. */
240 ok = 1;
241 for (i = 0; i < a->length && ok; ++i)
242 {
243 unsigned char mask = i < flags_len ? ~flags[i] : 0xff;
244 /* We are done if there is an unneeded bit set. */
245 ok = (a->data[i] & mask) == 0;
246 }
247 return ok;
248 }
diff --git a/src/lib/libcrypto/asn1/a_dup.c b/src/lib/libcrypto/asn1/a_dup.c
index 199d50f521..d98992548a 100644
--- a/src/lib/libcrypto/asn1/a_dup.c
+++ b/src/lib/libcrypto/asn1/a_dup.c
@@ -62,7 +62,7 @@
62 62
63#ifndef NO_OLD_ASN1 63#ifndef NO_OLD_ASN1
64 64
65void *ASN1_dup(i2d_of_void *i2d, d2i_of_void *d2i, char *x) 65void *ASN1_dup(i2d_of_void *i2d, d2i_of_void *d2i, void *x)
66 { 66 {
67 unsigned char *b,*p; 67 unsigned char *b,*p;
68 const unsigned char *p2; 68 const unsigned char *p2;
diff --git a/src/lib/libcrypto/asn1/a_gentm.c b/src/lib/libcrypto/asn1/a_gentm.c
index def79062a5..c79c6f538c 100644
--- a/src/lib/libcrypto/asn1/a_gentm.c
+++ b/src/lib/libcrypto/asn1/a_gentm.c
@@ -117,8 +117,8 @@ err:
117 117
118int ASN1_GENERALIZEDTIME_check(ASN1_GENERALIZEDTIME *d) 118int ASN1_GENERALIZEDTIME_check(ASN1_GENERALIZEDTIME *d)
119 { 119 {
120 static int min[9]={ 0, 0, 1, 1, 0, 0, 0, 0, 0}; 120 static const int min[9]={ 0, 0, 1, 1, 0, 0, 0, 0, 0};
121 static int max[9]={99, 99,12,31,23,59,59,12,59}; 121 static const int max[9]={99, 99,12,31,23,59,59,12,59};
122 char *a; 122 char *a;
123 int n,i,l,o; 123 int n,i,l,o;
124 124
@@ -176,6 +176,11 @@ int ASN1_GENERALIZEDTIME_check(ASN1_GENERALIZEDTIME *d)
176 o++; 176 o++;
177 } 177 }
178 } 178 }
179 else
180 {
181 /* Missing time zone information. */
182 goto err;
183 }
179 return(o == l); 184 return(o == l);
180err: 185err:
181 return(0); 186 return(0);
@@ -206,6 +211,12 @@ int ASN1_GENERALIZEDTIME_set_string(ASN1_GENERALIZEDTIME *s, const char *str)
206ASN1_GENERALIZEDTIME *ASN1_GENERALIZEDTIME_set(ASN1_GENERALIZEDTIME *s, 211ASN1_GENERALIZEDTIME *ASN1_GENERALIZEDTIME_set(ASN1_GENERALIZEDTIME *s,
207 time_t t) 212 time_t t)
208 { 213 {
214 return ASN1_GENERALIZEDTIME_adj(s, t, 0, 0);
215 }
216
217ASN1_GENERALIZEDTIME *ASN1_GENERALIZEDTIME_adj(ASN1_GENERALIZEDTIME *s,
218 time_t t, int offset_day, long offset_sec)
219 {
209 char *p; 220 char *p;
210 struct tm *ts; 221 struct tm *ts;
211 struct tm data; 222 struct tm data;
@@ -220,13 +231,19 @@ ASN1_GENERALIZEDTIME *ASN1_GENERALIZEDTIME_set(ASN1_GENERALIZEDTIME *s,
220 if (ts == NULL) 231 if (ts == NULL)
221 return(NULL); 232 return(NULL);
222 233
234 if (offset_day || offset_sec)
235 {
236 if (!OPENSSL_gmtime_adj(ts, offset_day, offset_sec))
237 return NULL;
238 }
239
223 p=(char *)s->data; 240 p=(char *)s->data;
224 if ((p == NULL) || ((size_t)s->length < len)) 241 if ((p == NULL) || ((size_t)s->length < len))
225 { 242 {
226 p=OPENSSL_malloc(len); 243 p=OPENSSL_malloc(len);
227 if (p == NULL) 244 if (p == NULL)
228 { 245 {
229 ASN1err(ASN1_F_ASN1_GENERALIZEDTIME_SET, 246 ASN1err(ASN1_F_ASN1_GENERALIZEDTIME_ADJ,
230 ERR_R_MALLOC_FAILURE); 247 ERR_R_MALLOC_FAILURE);
231 return(NULL); 248 return(NULL);
232 } 249 }
diff --git a/src/lib/libcrypto/asn1/a_hdr.c b/src/lib/libcrypto/asn1/a_hdr.c
deleted file mode 100644
index d1c2a7b9e3..0000000000
--- a/src/lib/libcrypto/asn1/a_hdr.c
+++ /dev/null
@@ -1,119 +0,0 @@
1/* crypto/asn1/a_hdr.c */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved.
4 *
5 * This package is an SSL implementation written
6 * by Eric Young (eay@cryptsoft.com).
7 * The implementation was written so as to conform with Netscapes SSL.
8 *
9 * This library is free for commercial and non-commercial use as long as
10 * the following conditions are aheared to. The following conditions
11 * apply to all code found in this distribution, be it the RC4, RSA,
12 * lhash, DES, etc., code; not just the SSL code. The SSL documentation
13 * included with this distribution is covered by the same copyright terms
14 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
15 *
16 * Copyright remains Eric Young's, and as such any Copyright notices in
17 * the code are not to be removed.
18 * If this package is used in a product, Eric Young should be given attribution
19 * as the author of the parts of the library used.
20 * This can be in the form of a textual message at program startup or
21 * in documentation (online or textual) provided with the package.
22 *
23 * Redistribution and use in source and binary forms, with or without
24 * modification, are permitted provided that the following conditions
25 * are met:
26 * 1. Redistributions of source code must retain the copyright
27 * notice, this list of conditions and the following disclaimer.
28 * 2. Redistributions in binary form must reproduce the above copyright
29 * notice, this list of conditions and the following disclaimer in the
30 * documentation and/or other materials provided with the distribution.
31 * 3. All advertising materials mentioning features or use of this software
32 * must display the following acknowledgement:
33 * "This product includes cryptographic software written by
34 * Eric Young (eay@cryptsoft.com)"
35 * The word 'cryptographic' can be left out if the rouines from the library
36 * being used are not cryptographic related :-).
37 * 4. If you include any Windows specific code (or a derivative thereof) from
38 * the apps directory (application code) you must include an acknowledgement:
39 * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
40 *
41 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
42 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
43 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
44 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
45 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
46 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
47 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
49 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
50 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
51 * SUCH DAMAGE.
52 *
53 * The licence and distribution terms for any publically available version or
54 * derivative of this code cannot be changed. i.e. this code cannot simply be
55 * copied and put under another distribution licence
56 * [including the GNU Public Licence.]
57 */
58
59#include <stdio.h>
60#include "cryptlib.h"
61#include <openssl/asn1_mac.h>
62#include <openssl/asn1.h>
63
64int i2d_ASN1_HEADER(ASN1_HEADER *a, unsigned char **pp)
65 {
66 M_ASN1_I2D_vars(a);
67
68 M_ASN1_I2D_len(a->header, i2d_ASN1_OCTET_STRING);
69 M_ASN1_I2D_len(a->data, a->meth->i2d);
70
71 M_ASN1_I2D_seq_total();
72
73 M_ASN1_I2D_put(a->header, i2d_ASN1_OCTET_STRING);
74 M_ASN1_I2D_put(a->data, a->meth->i2d);
75
76 M_ASN1_I2D_finish();
77 }
78
79ASN1_HEADER *d2i_ASN1_HEADER(ASN1_HEADER **a, const unsigned char **pp,
80 long length)
81 {
82 M_ASN1_D2I_vars(a,ASN1_HEADER *,ASN1_HEADER_new);
83
84 M_ASN1_D2I_Init();
85 M_ASN1_D2I_start_sequence();
86 M_ASN1_D2I_get_x(ASN1_OCTET_STRING,ret->header,d2i_ASN1_OCTET_STRING);
87 if (ret->meth != NULL)
88 {
89 M_ASN1_D2I_get_x(void,ret->data,ret->meth->d2i);
90 }
91 else
92 {
93 if (a != NULL) (*a)=ret;
94 return(ret);
95 }
96 M_ASN1_D2I_Finish(a,ASN1_HEADER_free,ASN1_F_D2I_ASN1_HEADER);
97 }
98
99ASN1_HEADER *ASN1_HEADER_new(void)
100 {
101 ASN1_HEADER *ret=NULL;
102 ASN1_CTX c;
103
104 M_ASN1_New_Malloc(ret,ASN1_HEADER);
105 M_ASN1_New(ret->header,M_ASN1_OCTET_STRING_new);
106 ret->meth=NULL;
107 ret->data=NULL;
108 return(ret);
109 M_ASN1_New_Error(ASN1_F_ASN1_HEADER_NEW);
110 }
111
112void ASN1_HEADER_free(ASN1_HEADER *a)
113 {
114 if (a == NULL) return;
115 M_ASN1_OCTET_STRING_free(a->header);
116 if (a->meth != NULL)
117 a->meth->destroy(a->data);
118 OPENSSL_free(a);
119 }
diff --git a/src/lib/libcrypto/asn1/a_int.c b/src/lib/libcrypto/asn1/a_int.c
index f8d198efb1..c6fd204ae3 100644
--- a/src/lib/libcrypto/asn1/a_int.c
+++ b/src/lib/libcrypto/asn1/a_int.c
@@ -61,10 +61,10 @@
61#include <openssl/asn1.h> 61#include <openssl/asn1.h>
62#include <openssl/bn.h> 62#include <openssl/bn.h>
63 63
64ASN1_INTEGER *ASN1_INTEGER_dup(ASN1_INTEGER *x) 64ASN1_INTEGER *ASN1_INTEGER_dup(const ASN1_INTEGER *x)
65{ return M_ASN1_INTEGER_dup(x);} 65{ return M_ASN1_INTEGER_dup(x);}
66 66
67int ASN1_INTEGER_cmp(ASN1_INTEGER *x, ASN1_INTEGER *y) 67int ASN1_INTEGER_cmp(const ASN1_INTEGER *x, const ASN1_INTEGER *y)
68 { 68 {
69 int neg, ret; 69 int neg, ret;
70 /* Compare signs */ 70 /* Compare signs */
@@ -373,7 +373,7 @@ int ASN1_INTEGER_set(ASN1_INTEGER *a, long v)
373 return(1); 373 return(1);
374 } 374 }
375 375
376long ASN1_INTEGER_get(ASN1_INTEGER *a) 376long ASN1_INTEGER_get(const ASN1_INTEGER *a)
377 { 377 {
378 int neg=0,i; 378 int neg=0,i;
379 long r=0; 379 long r=0;
@@ -402,7 +402,7 @@ long ASN1_INTEGER_get(ASN1_INTEGER *a)
402 return(r); 402 return(r);
403 } 403 }
404 404
405ASN1_INTEGER *BN_to_ASN1_INTEGER(BIGNUM *bn, ASN1_INTEGER *ai) 405ASN1_INTEGER *BN_to_ASN1_INTEGER(const BIGNUM *bn, ASN1_INTEGER *ai)
406 { 406 {
407 ASN1_INTEGER *ret; 407 ASN1_INTEGER *ret;
408 int len,j; 408 int len,j;
@@ -444,7 +444,7 @@ err:
444 return(NULL); 444 return(NULL);
445 } 445 }
446 446
447BIGNUM *ASN1_INTEGER_to_BN(ASN1_INTEGER *ai, BIGNUM *bn) 447BIGNUM *ASN1_INTEGER_to_BN(const ASN1_INTEGER *ai, BIGNUM *bn)
448 { 448 {
449 BIGNUM *ret; 449 BIGNUM *ret;
450 450
diff --git a/src/lib/libcrypto/asn1/a_mbstr.c b/src/lib/libcrypto/asn1/a_mbstr.c
index 1bcd046893..1538e0a4fc 100644
--- a/src/lib/libcrypto/asn1/a_mbstr.c
+++ b/src/lib/libcrypto/asn1/a_mbstr.c
@@ -93,7 +93,7 @@ int ASN1_mbstring_ncopy(ASN1_STRING **out, const unsigned char *in, int len,
93 int str_type; 93 int str_type;
94 int ret; 94 int ret;
95 char free_out; 95 char free_out;
96 int outform, outlen; 96 int outform, outlen = 0;
97 ASN1_STRING *dest; 97 ASN1_STRING *dest;
98 unsigned char *p; 98 unsigned char *p;
99 int nchar; 99 int nchar;
diff --git a/src/lib/libcrypto/asn1/a_meth.c b/src/lib/libcrypto/asn1/a_meth.c
deleted file mode 100644
index 50bea917e3..0000000000
--- a/src/lib/libcrypto/asn1/a_meth.c
+++ /dev/null
@@ -1,84 +0,0 @@
1/* crypto/asn1/a_meth.c */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved.
4 *
5 * This package is an SSL implementation written
6 * by Eric Young (eay@cryptsoft.com).
7 * The implementation was written so as to conform with Netscapes SSL.
8 *
9 * This library is free for commercial and non-commercial use as long as
10 * the following conditions are aheared to. The following conditions
11 * apply to all code found in this distribution, be it the RC4, RSA,
12 * lhash, DES, etc., code; not just the SSL code. The SSL documentation
13 * included with this distribution is covered by the same copyright terms
14 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
15 *
16 * Copyright remains Eric Young's, and as such any Copyright notices in
17 * the code are not to be removed.
18 * If this package is used in a product, Eric Young should be given attribution
19 * as the author of the parts of the library used.
20 * This can be in the form of a textual message at program startup or
21 * in documentation (online or textual) provided with the package.
22 *
23 * Redistribution and use in source and binary forms, with or without
24 * modification, are permitted provided that the following conditions
25 * are met:
26 * 1. Redistributions of source code must retain the copyright
27 * notice, this list of conditions and the following disclaimer.
28 * 2. Redistributions in binary form must reproduce the above copyright
29 * notice, this list of conditions and the following disclaimer in the
30 * documentation and/or other materials provided with the distribution.
31 * 3. All advertising materials mentioning features or use of this software
32 * must display the following acknowledgement:
33 * "This product includes cryptographic software written by
34 * Eric Young (eay@cryptsoft.com)"
35 * The word 'cryptographic' can be left out if the rouines from the library
36 * being used are not cryptographic related :-).
37 * 4. If you include any Windows specific code (or a derivative thereof) from
38 * the apps directory (application code) you must include an acknowledgement:
39 * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
40 *
41 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
42 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
43 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
44 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
45 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
46 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
47 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
49 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
50 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
51 * SUCH DAMAGE.
52 *
53 * The licence and distribution terms for any publically available version or
54 * derivative of this code cannot be changed. i.e. this code cannot simply be
55 * copied and put under another distribution licence
56 * [including the GNU Public Licence.]
57 */
58
59#include <stdio.h>
60#include "cryptlib.h"
61#include <openssl/buffer.h>
62#include <openssl/asn1.h>
63
64static ASN1_METHOD ia5string_meth={
65 (I2D_OF(void)) i2d_ASN1_IA5STRING,
66 (D2I_OF(void)) d2i_ASN1_IA5STRING,
67 (void *(*)(void))ASN1_STRING_new,
68 (void (*)(void *))ASN1_STRING_free};
69
70static ASN1_METHOD bit_string_meth={
71 (I2D_OF(void)) i2d_ASN1_BIT_STRING,
72 (D2I_OF(void)) d2i_ASN1_BIT_STRING,
73 (void *(*)(void))ASN1_STRING_new,
74 (void (*)(void *))ASN1_STRING_free};
75
76ASN1_METHOD *ASN1_IA5STRING_asn1_meth(void)
77 {
78 return(&ia5string_meth);
79 }
80
81ASN1_METHOD *ASN1_BIT_STRING_asn1_meth(void)
82 {
83 return(&bit_string_meth);
84 }
diff --git a/src/lib/libcrypto/asn1/a_object.c b/src/lib/libcrypto/asn1/a_object.c
index dc980421d0..e5fbe7cbb1 100644
--- a/src/lib/libcrypto/asn1/a_object.c
+++ b/src/lib/libcrypto/asn1/a_object.c
@@ -281,8 +281,6 @@ ASN1_OBJECT *d2i_ASN1_OBJECT(ASN1_OBJECT **a, const unsigned char **pp,
281 return ret; 281 return ret;
282err: 282err:
283 ASN1err(ASN1_F_D2I_ASN1_OBJECT,i); 283 ASN1err(ASN1_F_D2I_ASN1_OBJECT,i);
284 if ((ret != NULL) && ((a == NULL) || (*a != ret)))
285 ASN1_OBJECT_free(ret);
286 return(NULL); 284 return(NULL);
287} 285}
288ASN1_OBJECT *c2i_ASN1_OBJECT(ASN1_OBJECT **a, const unsigned char **pp, 286ASN1_OBJECT *c2i_ASN1_OBJECT(ASN1_OBJECT **a, const unsigned char **pp,
@@ -290,7 +288,19 @@ ASN1_OBJECT *c2i_ASN1_OBJECT(ASN1_OBJECT **a, const unsigned char **pp,
290 { 288 {
291 ASN1_OBJECT *ret=NULL; 289 ASN1_OBJECT *ret=NULL;
292 const unsigned char *p; 290 const unsigned char *p;
291 unsigned char *data;
293 int i; 292 int i;
293 /* Sanity check OID encoding: can't have leading 0x80 in
294 * subidentifiers, see: X.690 8.19.2
295 */
296 for (i = 0, p = *pp + 1; i < len - 1; i++, p++)
297 {
298 if (*p == 0x80 && (!i || !(p[-1] & 0x80)))
299 {
300 ASN1err(ASN1_F_C2I_ASN1_OBJECT,ASN1_R_INVALID_OBJECT_ENCODING);
301 return NULL;
302 }
303 }
294 304
295 /* only the ASN1_OBJECTs from the 'table' will have values 305 /* only the ASN1_OBJECTs from the 'table' will have values
296 * for ->sn or ->ln */ 306 * for ->sn or ->ln */
@@ -302,15 +312,22 @@ ASN1_OBJECT *c2i_ASN1_OBJECT(ASN1_OBJECT **a, const unsigned char **pp,
302 else ret=(*a); 312 else ret=(*a);
303 313
304 p= *pp; 314 p= *pp;
305 if ((ret->data == NULL) || (ret->length < len)) 315 /* detach data from object */
316 data = (unsigned char *)ret->data;
317 ret->data = NULL;
318 /* once detached we can change it */
319 if ((data == NULL) || (ret->length < len))
306 { 320 {
307 if (ret->data != NULL) OPENSSL_free(ret->data); 321 ret->length=0;
308 ret->data=(unsigned char *)OPENSSL_malloc(len ? (int)len : 1); 322 if (data != NULL) OPENSSL_free(data);
309 ret->flags|=ASN1_OBJECT_FLAG_DYNAMIC_DATA; 323 data=(unsigned char *)OPENSSL_malloc(len ? (int)len : 1);
310 if (ret->data == NULL) 324 if (data == NULL)
311 { i=ERR_R_MALLOC_FAILURE; goto err; } 325 { i=ERR_R_MALLOC_FAILURE; goto err; }
326 ret->flags|=ASN1_OBJECT_FLAG_DYNAMIC_DATA;
312 } 327 }
313 memcpy(ret->data,p,(int)len); 328 memcpy(data,p,(int)len);
329 /* reattach data to object, after which it remains const */
330 ret->data =data;
314 ret->length=(int)len; 331 ret->length=(int)len;
315 ret->sn=NULL; 332 ret->sn=NULL;
316 ret->ln=NULL; 333 ret->ln=NULL;
@@ -359,7 +376,7 @@ void ASN1_OBJECT_free(ASN1_OBJECT *a)
359 } 376 }
360 if (a->flags & ASN1_OBJECT_FLAG_DYNAMIC_DATA) 377 if (a->flags & ASN1_OBJECT_FLAG_DYNAMIC_DATA)
361 { 378 {
362 if (a->data != NULL) OPENSSL_free(a->data); 379 if (a->data != NULL) OPENSSL_free((void *)a->data);
363 a->data=NULL; 380 a->data=NULL;
364 a->length=0; 381 a->length=0;
365 } 382 }
diff --git a/src/lib/libcrypto/asn1/a_octet.c b/src/lib/libcrypto/asn1/a_octet.c
index 24fd0f8e5a..e8725e44f1 100644
--- a/src/lib/libcrypto/asn1/a_octet.c
+++ b/src/lib/libcrypto/asn1/a_octet.c
@@ -60,10 +60,10 @@
60#include "cryptlib.h" 60#include "cryptlib.h"
61#include <openssl/asn1.h> 61#include <openssl/asn1.h>
62 62
63ASN1_OCTET_STRING *ASN1_OCTET_STRING_dup(ASN1_OCTET_STRING *x) 63ASN1_OCTET_STRING *ASN1_OCTET_STRING_dup(const ASN1_OCTET_STRING *x)
64{ return M_ASN1_OCTET_STRING_dup(x); } 64{ return M_ASN1_OCTET_STRING_dup(x); }
65 65
66int ASN1_OCTET_STRING_cmp(ASN1_OCTET_STRING *a, ASN1_OCTET_STRING *b) 66int ASN1_OCTET_STRING_cmp(const ASN1_OCTET_STRING *a, const ASN1_OCTET_STRING *b)
67{ return M_ASN1_OCTET_STRING_cmp(a, b); } 67{ return M_ASN1_OCTET_STRING_cmp(a, b); }
68 68
69int ASN1_OCTET_STRING_set(ASN1_OCTET_STRING *x, const unsigned char *d, int len) 69int ASN1_OCTET_STRING_set(ASN1_OCTET_STRING *x, const unsigned char *d, int len)
diff --git a/src/lib/libcrypto/asn1/a_set.c b/src/lib/libcrypto/asn1/a_set.c
index 958558c204..d726c8d3a8 100644
--- a/src/lib/libcrypto/asn1/a_set.c
+++ b/src/lib/libcrypto/asn1/a_set.c
@@ -85,8 +85,9 @@ static int SetBlobCmp(const void *elem1, const void *elem2 )
85 } 85 }
86 86
87/* int is_set: if TRUE, then sort the contents (i.e. it isn't a SEQUENCE) */ 87/* int is_set: if TRUE, then sort the contents (i.e. it isn't a SEQUENCE) */
88int i2d_ASN1_SET(STACK *a, unsigned char **pp, i2d_of_void *i2d, int ex_tag, 88int i2d_ASN1_SET(STACK_OF(OPENSSL_BLOCK) *a, unsigned char **pp,
89 int ex_class, int is_set) 89 i2d_of_void *i2d, int ex_tag, int ex_class,
90 int is_set)
90 { 91 {
91 int ret=0,r; 92 int ret=0,r;
92 int i; 93 int i;
@@ -96,8 +97,8 @@ int i2d_ASN1_SET(STACK *a, unsigned char **pp, i2d_of_void *i2d, int ex_tag,
96 int totSize; 97 int totSize;
97 98
98 if (a == NULL) return(0); 99 if (a == NULL) return(0);
99 for (i=sk_num(a)-1; i>=0; i--) 100 for (i=sk_OPENSSL_BLOCK_num(a)-1; i>=0; i--)
100 ret+=i2d(sk_value(a,i),NULL); 101 ret+=i2d(sk_OPENSSL_BLOCK_value(a,i),NULL);
101 r=ASN1_object_size(1,ret,ex_tag); 102 r=ASN1_object_size(1,ret,ex_tag);
102 if (pp == NULL) return(r); 103 if (pp == NULL) return(r);
103 104
@@ -108,10 +109,10 @@ int i2d_ASN1_SET(STACK *a, unsigned char **pp, i2d_of_void *i2d, int ex_tag,
108 /* And then again by Ben */ 109 /* And then again by Ben */
109 /* And again by Steve */ 110 /* And again by Steve */
110 111
111 if(!is_set || (sk_num(a) < 2)) 112 if(!is_set || (sk_OPENSSL_BLOCK_num(a) < 2))
112 { 113 {
113 for (i=0; i<sk_num(a); i++) 114 for (i=0; i<sk_OPENSSL_BLOCK_num(a); i++)
114 i2d(sk_value(a,i),&p); 115 i2d(sk_OPENSSL_BLOCK_value(a,i),&p);
115 116
116 *pp=p; 117 *pp=p;
117 return(r); 118 return(r);
@@ -119,17 +120,17 @@ int i2d_ASN1_SET(STACK *a, unsigned char **pp, i2d_of_void *i2d, int ex_tag,
119 120
120 pStart = p; /* Catch the beg of Setblobs*/ 121 pStart = p; /* Catch the beg of Setblobs*/
121 /* In this array we will store the SET blobs */ 122 /* In this array we will store the SET blobs */
122 rgSetBlob = (MYBLOB *)OPENSSL_malloc(sk_num(a) * sizeof(MYBLOB)); 123 rgSetBlob = OPENSSL_malloc(sk_OPENSSL_BLOCK_num(a) * sizeof(MYBLOB));
123 if (rgSetBlob == NULL) 124 if (rgSetBlob == NULL)
124 { 125 {
125 ASN1err(ASN1_F_I2D_ASN1_SET,ERR_R_MALLOC_FAILURE); 126 ASN1err(ASN1_F_I2D_ASN1_SET,ERR_R_MALLOC_FAILURE);
126 return(0); 127 return(0);
127 } 128 }
128 129
129 for (i=0; i<sk_num(a); i++) 130 for (i=0; i<sk_OPENSSL_BLOCK_num(a); i++)
130 { 131 {
131 rgSetBlob[i].pbData = p; /* catch each set encode blob */ 132 rgSetBlob[i].pbData = p; /* catch each set encode blob */
132 i2d(sk_value(a,i),&p); 133 i2d(sk_OPENSSL_BLOCK_value(a,i),&p);
133 rgSetBlob[i].cbData = p - rgSetBlob[i].pbData; /* Length of this 134 rgSetBlob[i].cbData = p - rgSetBlob[i].pbData; /* Length of this
134SetBlob 135SetBlob
135*/ 136*/
@@ -139,7 +140,7 @@ SetBlob
139 140
140 /* Now we have to sort the blobs. I am using a simple algo. 141 /* Now we have to sort the blobs. I am using a simple algo.
141 *Sort ptrs *Copy to temp-mem *Copy from temp-mem to user-mem*/ 142 *Sort ptrs *Copy to temp-mem *Copy from temp-mem to user-mem*/
142 qsort( rgSetBlob, sk_num(a), sizeof(MYBLOB), SetBlobCmp); 143 qsort( rgSetBlob, sk_OPENSSL_BLOCK_num(a), sizeof(MYBLOB), SetBlobCmp);
143 if (!(pTempMem = OPENSSL_malloc(totSize))) 144 if (!(pTempMem = OPENSSL_malloc(totSize)))
144 { 145 {
145 ASN1err(ASN1_F_I2D_ASN1_SET,ERR_R_MALLOC_FAILURE); 146 ASN1err(ASN1_F_I2D_ASN1_SET,ERR_R_MALLOC_FAILURE);
@@ -148,7 +149,7 @@ SetBlob
148 149
149/* Copy to temp mem */ 150/* Copy to temp mem */
150 p = pTempMem; 151 p = pTempMem;
151 for(i=0; i<sk_num(a); ++i) 152 for(i=0; i<sk_OPENSSL_BLOCK_num(a); ++i)
152 { 153 {
153 memcpy(p, rgSetBlob[i].pbData, rgSetBlob[i].cbData); 154 memcpy(p, rgSetBlob[i].pbData, rgSetBlob[i].cbData);
154 p += rgSetBlob[i].cbData; 155 p += rgSetBlob[i].cbData;
@@ -162,16 +163,18 @@ SetBlob
162 return(r); 163 return(r);
163 } 164 }
164 165
165STACK *d2i_ASN1_SET(STACK **a, const unsigned char **pp, long length, 166STACK_OF(OPENSSL_BLOCK) *d2i_ASN1_SET(STACK_OF(OPENSSL_BLOCK) **a,
166 d2i_of_void *d2i, void (*free_func)(void *), int ex_tag, 167 const unsigned char **pp,
167 int ex_class) 168 long length, d2i_of_void *d2i,
169 void (*free_func)(OPENSSL_BLOCK), int ex_tag,
170 int ex_class)
168 { 171 {
169 ASN1_const_CTX c; 172 ASN1_const_CTX c;
170 STACK *ret=NULL; 173 STACK_OF(OPENSSL_BLOCK) *ret=NULL;
171 174
172 if ((a == NULL) || ((*a) == NULL)) 175 if ((a == NULL) || ((*a) == NULL))
173 { 176 {
174 if ((ret=sk_new_null()) == NULL) 177 if ((ret=sk_OPENSSL_BLOCK_new_null()) == NULL)
175 { 178 {
176 ASN1err(ASN1_F_D2I_ASN1_SET,ERR_R_MALLOC_FAILURE); 179 ASN1err(ASN1_F_D2I_ASN1_SET,ERR_R_MALLOC_FAILURE);
177 goto err; 180 goto err;
@@ -216,10 +219,10 @@ STACK *d2i_ASN1_SET(STACK **a, const unsigned char **pp, long length,
216 if ((s=d2i(NULL,&c.p,c.slen)) == NULL) 219 if ((s=d2i(NULL,&c.p,c.slen)) == NULL)
217 { 220 {
218 ASN1err(ASN1_F_D2I_ASN1_SET,ASN1_R_ERROR_PARSING_SET_ELEMENT); 221 ASN1err(ASN1_F_D2I_ASN1_SET,ASN1_R_ERROR_PARSING_SET_ELEMENT);
219 asn1_add_error(*pp,(int)(c.q- *pp)); 222 asn1_add_error(*pp,(int)(c.p- *pp));
220 goto err; 223 goto err;
221 } 224 }
222 if (!sk_push(ret,s)) goto err; 225 if (!sk_OPENSSL_BLOCK_push(ret,s)) goto err;
223 } 226 }
224 if (a != NULL) (*a)=ret; 227 if (a != NULL) (*a)=ret;
225 *pp=c.p; 228 *pp=c.p;
@@ -228,9 +231,9 @@ err:
228 if ((ret != NULL) && ((a == NULL) || (*a != ret))) 231 if ((ret != NULL) && ((a == NULL) || (*a != ret)))
229 { 232 {
230 if (free_func != NULL) 233 if (free_func != NULL)
231 sk_pop_free(ret,free_func); 234 sk_OPENSSL_BLOCK_pop_free(ret,free_func);
232 else 235 else
233 sk_free(ret); 236 sk_OPENSSL_BLOCK_free(ret);
234 } 237 }
235 return(NULL); 238 return(NULL);
236 } 239 }
diff --git a/src/lib/libcrypto/asn1/a_sign.c b/src/lib/libcrypto/asn1/a_sign.c
index 4dee45fbb8..ff63bfc7be 100644
--- a/src/lib/libcrypto/asn1/a_sign.c
+++ b/src/lib/libcrypto/asn1/a_sign.c
@@ -123,6 +123,7 @@
123#include <openssl/x509.h> 123#include <openssl/x509.h>
124#include <openssl/objects.h> 124#include <openssl/objects.h>
125#include <openssl/buffer.h> 125#include <openssl/buffer.h>
126#include "asn1_locl.h"
126 127
127#ifndef NO_ASN1_OLD 128#ifndef NO_ASN1_OLD
128 129
@@ -218,45 +219,47 @@ int ASN1_item_sign(const ASN1_ITEM *it, X509_ALGOR *algor1, X509_ALGOR *algor2,
218 { 219 {
219 EVP_MD_CTX ctx; 220 EVP_MD_CTX ctx;
220 unsigned char *buf_in=NULL,*buf_out=NULL; 221 unsigned char *buf_in=NULL,*buf_out=NULL;
221 int i,inl=0,outl=0,outll=0; 222 int inl=0,outl=0,outll=0;
222 X509_ALGOR *a; 223 int signid, paramtype;
223 224
224 EVP_MD_CTX_init(&ctx); 225 if (type == NULL)
225 for (i=0; i<2; i++)
226 { 226 {
227 if (i == 0) 227 int def_nid;
228 a=algor1; 228 if (EVP_PKEY_get_default_digest_nid(pkey, &def_nid) > 0)
229 else 229 type = EVP_get_digestbynid(def_nid);
230 a=algor2; 230 }
231 if (a == NULL) continue; 231
232 if (type->pkey_type == NID_dsaWithSHA1 || 232 if (type == NULL)
233 type->pkey_type == NID_ecdsa_with_SHA1) 233 {
234 { 234 ASN1err(ASN1_F_ASN1_ITEM_SIGN, ASN1_R_NO_DEFAULT_DIGEST);
235 /* special case: RFC 3279 tells us to omit 'parameters' 235 return 0;
236 * with id-dsa-with-sha1 and ecdsa-with-SHA1 */ 236 }
237 ASN1_TYPE_free(a->parameter); 237
238 a->parameter = NULL; 238 if (type->flags & EVP_MD_FLAG_PKEY_METHOD_SIGNATURE)
239 } 239 {
240 else if ((a->parameter == NULL) || 240 if (!pkey->ameth ||
241 (a->parameter->type != V_ASN1_NULL)) 241 !OBJ_find_sigid_by_algs(&signid, EVP_MD_nid(type),
242 { 242 pkey->ameth->pkey_id))
243 ASN1_TYPE_free(a->parameter);
244 if ((a->parameter=ASN1_TYPE_new()) == NULL) goto err;
245 a->parameter->type=V_ASN1_NULL;
246 }
247 ASN1_OBJECT_free(a->algorithm);
248 a->algorithm=OBJ_nid2obj(type->pkey_type);
249 if (a->algorithm == NULL)
250 {
251 ASN1err(ASN1_F_ASN1_ITEM_SIGN,ASN1_R_UNKNOWN_OBJECT_TYPE);
252 goto err;
253 }
254 if (a->algorithm->length == 0)
255 { 243 {
256 ASN1err(ASN1_F_ASN1_ITEM_SIGN,ASN1_R_THE_ASN1_OBJECT_IDENTIFIER_IS_NOT_KNOWN_FOR_THIS_MD); 244 ASN1err(ASN1_F_ASN1_ITEM_SIGN,
257 goto err; 245 ASN1_R_DIGEST_AND_KEY_TYPE_NOT_SUPPORTED);
246 return 0;
258 } 247 }
259 } 248 }
249 else
250 signid = type->pkey_type;
251
252 if (pkey->ameth->pkey_flags & ASN1_PKEY_SIGPARAM_NULL)
253 paramtype = V_ASN1_NULL;
254 else
255 paramtype = V_ASN1_UNDEF;
256
257 if (algor1)
258 X509_ALGOR_set0(algor1, OBJ_nid2obj(signid), paramtype, NULL);
259 if (algor2)
260 X509_ALGOR_set0(algor2, OBJ_nid2obj(signid), paramtype, NULL);
261
262 EVP_MD_CTX_init(&ctx);
260 inl=ASN1_item_i2d(asn,&buf_in, it); 263 inl=ASN1_item_i2d(asn,&buf_in, it);
261 outll=outl=EVP_PKEY_size(pkey); 264 outll=outl=EVP_PKEY_size(pkey);
262 buf_out=(unsigned char *)OPENSSL_malloc((unsigned int)outl); 265 buf_out=(unsigned char *)OPENSSL_malloc((unsigned int)outl);
@@ -267,12 +270,7 @@ int ASN1_item_sign(const ASN1_ITEM *it, X509_ALGOR *algor1, X509_ALGOR *algor2,
267 goto err; 270 goto err;
268 } 271 }
269 272
270 if (!EVP_SignInit_ex(&ctx,type, NULL)) 273 EVP_SignInit_ex(&ctx,type, NULL);
271 {
272 outl=0;
273 ASN1err(ASN1_F_ASN1_ITEM_SIGN,ERR_R_EVP_LIB);
274 goto err;
275 }
276 EVP_SignUpdate(&ctx,(unsigned char *)buf_in,inl); 274 EVP_SignUpdate(&ctx,(unsigned char *)buf_in,inl);
277 if (!EVP_SignFinal(&ctx,(unsigned char *)buf_out, 275 if (!EVP_SignFinal(&ctx,(unsigned char *)buf_out,
278 (unsigned int *)&outl,pkey)) 276 (unsigned int *)&outl,pkey))
diff --git a/src/lib/libcrypto/asn1/a_strnid.c b/src/lib/libcrypto/asn1/a_strnid.c
index fe515b52ba..753021a7a2 100644
--- a/src/lib/libcrypto/asn1/a_strnid.c
+++ b/src/lib/libcrypto/asn1/a_strnid.c
@@ -67,7 +67,6 @@ static STACK_OF(ASN1_STRING_TABLE) *stable = NULL;
67static void st_free(ASN1_STRING_TABLE *tbl); 67static void st_free(ASN1_STRING_TABLE *tbl);
68static int sk_table_cmp(const ASN1_STRING_TABLE * const *a, 68static int sk_table_cmp(const ASN1_STRING_TABLE * const *a,
69 const ASN1_STRING_TABLE * const *b); 69 const ASN1_STRING_TABLE * const *b);
70static int table_cmp(const void *a, const void *b);
71 70
72 71
73/* This is the global mask for the mbstring functions: this is use to 72/* This is the global mask for the mbstring functions: this is use to
@@ -158,7 +157,7 @@ ASN1_STRING *ASN1_STRING_set_by_NID(ASN1_STRING **out, const unsigned char *in,
158 157
159/* This table must be kept in NID order */ 158/* This table must be kept in NID order */
160 159
161static ASN1_STRING_TABLE tbl_standard[] = { 160static const ASN1_STRING_TABLE tbl_standard[] = {
162{NID_commonName, 1, ub_common_name, DIRSTRING_TYPE, 0}, 161{NID_commonName, 1, ub_common_name, DIRSTRING_TYPE, 0},
163{NID_countryName, 2, 2, B_ASN1_PRINTABLESTRING, STABLE_NO_MASK}, 162{NID_countryName, 2, 2, B_ASN1_PRINTABLESTRING, STABLE_NO_MASK},
164{NID_localityName, 1, ub_locality_name, DIRSTRING_TYPE, 0}, 163{NID_localityName, 1, ub_locality_name, DIRSTRING_TYPE, 0},
@@ -186,22 +185,23 @@ static int sk_table_cmp(const ASN1_STRING_TABLE * const *a,
186 return (*a)->nid - (*b)->nid; 185 return (*a)->nid - (*b)->nid;
187} 186}
188 187
189static int table_cmp(const void *a, const void *b) 188DECLARE_OBJ_BSEARCH_CMP_FN(ASN1_STRING_TABLE, ASN1_STRING_TABLE, table);
189
190static int table_cmp(const ASN1_STRING_TABLE *a, const ASN1_STRING_TABLE *b)
190{ 191{
191 const ASN1_STRING_TABLE *sa = a, *sb = b; 192 return a->nid - b->nid;
192 return sa->nid - sb->nid;
193} 193}
194 194
195IMPLEMENT_OBJ_BSEARCH_CMP_FN(ASN1_STRING_TABLE, ASN1_STRING_TABLE, table);
196
195ASN1_STRING_TABLE *ASN1_STRING_TABLE_get(int nid) 197ASN1_STRING_TABLE *ASN1_STRING_TABLE_get(int nid)
196{ 198{
197 int idx; 199 int idx;
198 ASN1_STRING_TABLE *ttmp; 200 ASN1_STRING_TABLE *ttmp;
199 ASN1_STRING_TABLE fnd; 201 ASN1_STRING_TABLE fnd;
200 fnd.nid = nid; 202 fnd.nid = nid;
201 ttmp = (ASN1_STRING_TABLE *) OBJ_bsearch((char *)&fnd, 203 ttmp = OBJ_bsearch_table(&fnd, tbl_standard,
202 (char *)tbl_standard, 204 sizeof(tbl_standard)/sizeof(ASN1_STRING_TABLE));
203 sizeof(tbl_standard)/sizeof(ASN1_STRING_TABLE),
204 sizeof(ASN1_STRING_TABLE), table_cmp);
205 if(ttmp) return ttmp; 205 if(ttmp) return ttmp;
206 if(!stable) return NULL; 206 if(!stable) return NULL;
207 idx = sk_ASN1_STRING_TABLE_find(stable, &fnd); 207 idx = sk_ASN1_STRING_TABLE_find(stable, &fnd);
diff --git a/src/lib/libcrypto/asn1/a_time.c b/src/lib/libcrypto/asn1/a_time.c
index 159681fbcb..e2eb9b243e 100644
--- a/src/lib/libcrypto/asn1/a_time.c
+++ b/src/lib/libcrypto/asn1/a_time.c
@@ -100,18 +100,29 @@ int i2d_ASN1_TIME(ASN1_TIME *a, unsigned char **pp)
100 100
101ASN1_TIME *ASN1_TIME_set(ASN1_TIME *s, time_t t) 101ASN1_TIME *ASN1_TIME_set(ASN1_TIME *s, time_t t)
102 { 102 {
103 return ASN1_TIME_adj(s, t, 0, 0);
104 }
105
106ASN1_TIME *ASN1_TIME_adj(ASN1_TIME *s, time_t t,
107 int offset_day, long offset_sec)
108 {
103 struct tm *ts; 109 struct tm *ts;
104 struct tm data; 110 struct tm data;
105 111
106 ts=OPENSSL_gmtime(&t,&data); 112 ts=OPENSSL_gmtime(&t,&data);
107 if (ts == NULL) 113 if (ts == NULL)
108 { 114 {
109 ASN1err(ASN1_F_ASN1_TIME_SET, ASN1_R_ERROR_GETTING_TIME); 115 ASN1err(ASN1_F_ASN1_TIME_ADJ, ASN1_R_ERROR_GETTING_TIME);
110 return NULL; 116 return NULL;
111 } 117 }
118 if (offset_day || offset_sec)
119 {
120 if (!OPENSSL_gmtime_adj(ts, offset_day, offset_sec))
121 return NULL;
122 }
112 if((ts->tm_year >= 50) && (ts->tm_year < 150)) 123 if((ts->tm_year >= 50) && (ts->tm_year < 150))
113 return ASN1_UTCTIME_set(s, t); 124 return ASN1_UTCTIME_adj(s, t, offset_day, offset_sec);
114 return ASN1_GENERALIZEDTIME_set(s,t); 125 return ASN1_GENERALIZEDTIME_adj(s, t, offset_day, offset_sec);
115 } 126 }
116 127
117int ASN1_TIME_check(ASN1_TIME *t) 128int ASN1_TIME_check(ASN1_TIME *t)
@@ -162,3 +173,26 @@ ASN1_GENERALIZEDTIME *ASN1_TIME_to_generalizedtime(ASN1_TIME *t, ASN1_GENERALIZE
162 173
163 return ret; 174 return ret;
164 } 175 }
176
177int ASN1_TIME_set_string(ASN1_TIME *s, const char *str)
178 {
179 ASN1_TIME t;
180
181 t.length = strlen(str);
182 t.data = (unsigned char *)str;
183 t.flags = 0;
184
185 t.type = V_ASN1_UTCTIME;
186
187 if (!ASN1_TIME_check(&t))
188 {
189 t.type = V_ASN1_GENERALIZEDTIME;
190 if (!ASN1_TIME_check(&t))
191 return 0;
192 }
193
194 if (s && !ASN1_STRING_copy((ASN1_STRING *)s, (ASN1_STRING *)&t))
195 return 0;
196
197 return 1;
198 }
diff --git a/src/lib/libcrypto/asn1/a_type.c b/src/lib/libcrypto/asn1/a_type.c
index 36beceacdb..a45d2f9d12 100644
--- a/src/lib/libcrypto/asn1/a_type.c
+++ b/src/lib/libcrypto/asn1/a_type.c
@@ -77,7 +77,10 @@ void ASN1_TYPE_set(ASN1_TYPE *a, int type, void *value)
77 ASN1_primitive_free((ASN1_VALUE **)tmp_a, NULL); 77 ASN1_primitive_free((ASN1_VALUE **)tmp_a, NULL);
78 } 78 }
79 a->type=type; 79 a->type=type;
80 a->value.ptr=value; 80 if (type == V_ASN1_BOOLEAN)
81 a->value.boolean = value ? 0xff : 0;
82 else
83 a->value.ptr=value;
81 } 84 }
82 85
83int ASN1_TYPE_set1(ASN1_TYPE *a, int type, const void *value) 86int ASN1_TYPE_set1(ASN1_TYPE *a, int type, const void *value)
@@ -98,7 +101,7 @@ int ASN1_TYPE_set1(ASN1_TYPE *a, int type, const void *value)
98 else 101 else
99 { 102 {
100 ASN1_STRING *sdup; 103 ASN1_STRING *sdup;
101 sdup = ASN1_STRING_dup((ASN1_STRING *)value); 104 sdup = ASN1_STRING_dup(value);
102 if (!sdup) 105 if (!sdup)
103 return 0; 106 return 0;
104 ASN1_TYPE_set(a, type, sdup); 107 ASN1_TYPE_set(a, type, sdup);
@@ -108,3 +111,49 @@ int ASN1_TYPE_set1(ASN1_TYPE *a, int type, const void *value)
108 111
109IMPLEMENT_STACK_OF(ASN1_TYPE) 112IMPLEMENT_STACK_OF(ASN1_TYPE)
110IMPLEMENT_ASN1_SET_OF(ASN1_TYPE) 113IMPLEMENT_ASN1_SET_OF(ASN1_TYPE)
114
115/* Returns 0 if they are equal, != 0 otherwise. */
116int ASN1_TYPE_cmp(ASN1_TYPE *a, ASN1_TYPE *b)
117 {
118 int result = -1;
119
120 if (!a || !b || a->type != b->type) return -1;
121
122 switch (a->type)
123 {
124 case V_ASN1_OBJECT:
125 result = OBJ_cmp(a->value.object, b->value.object);
126 break;
127 case V_ASN1_NULL:
128 result = 0; /* They do not have content. */
129 break;
130 case V_ASN1_INTEGER:
131 case V_ASN1_NEG_INTEGER:
132 case V_ASN1_ENUMERATED:
133 case V_ASN1_NEG_ENUMERATED:
134 case V_ASN1_BIT_STRING:
135 case V_ASN1_OCTET_STRING:
136 case V_ASN1_SEQUENCE:
137 case V_ASN1_SET:
138 case V_ASN1_NUMERICSTRING:
139 case V_ASN1_PRINTABLESTRING:
140 case V_ASN1_T61STRING:
141 case V_ASN1_VIDEOTEXSTRING:
142 case V_ASN1_IA5STRING:
143 case V_ASN1_UTCTIME:
144 case V_ASN1_GENERALIZEDTIME:
145 case V_ASN1_GRAPHICSTRING:
146 case V_ASN1_VISIBLESTRING:
147 case V_ASN1_GENERALSTRING:
148 case V_ASN1_UNIVERSALSTRING:
149 case V_ASN1_BMPSTRING:
150 case V_ASN1_UTF8STRING:
151 case V_ASN1_OTHER:
152 default:
153 result = ASN1_STRING_cmp((ASN1_STRING *) a->value.ptr,
154 (ASN1_STRING *) b->value.ptr);
155 break;
156 }
157
158 return result;
159 }
diff --git a/src/lib/libcrypto/asn1/a_utctm.c b/src/lib/libcrypto/asn1/a_utctm.c
index d31c028193..072e236592 100644
--- a/src/lib/libcrypto/asn1/a_utctm.c
+++ b/src/lib/libcrypto/asn1/a_utctm.c
@@ -114,8 +114,8 @@ err:
114 114
115int ASN1_UTCTIME_check(ASN1_UTCTIME *d) 115int ASN1_UTCTIME_check(ASN1_UTCTIME *d)
116 { 116 {
117 static int min[8]={ 0, 1, 1, 0, 0, 0, 0, 0}; 117 static const int min[8]={ 0, 1, 1, 0, 0, 0, 0, 0};
118 static int max[8]={99,12,31,23,59,59,12,59}; 118 static const int max[8]={99,12,31,23,59,59,12,59};
119 char *a; 119 char *a;
120 int n,i,l,o; 120 int n,i,l,o;
121 121
@@ -186,6 +186,12 @@ int ASN1_UTCTIME_set_string(ASN1_UTCTIME *s, const char *str)
186 186
187ASN1_UTCTIME *ASN1_UTCTIME_set(ASN1_UTCTIME *s, time_t t) 187ASN1_UTCTIME *ASN1_UTCTIME_set(ASN1_UTCTIME *s, time_t t)
188 { 188 {
189 return ASN1_UTCTIME_adj(s, t, 0, 0);
190 }
191
192ASN1_UTCTIME *ASN1_UTCTIME_adj(ASN1_UTCTIME *s, time_t t,
193 int offset_day, long offset_sec)
194 {
189 char *p; 195 char *p;
190 struct tm *ts; 196 struct tm *ts;
191 struct tm data; 197 struct tm data;
@@ -200,13 +206,22 @@ ASN1_UTCTIME *ASN1_UTCTIME_set(ASN1_UTCTIME *s, time_t t)
200 if (ts == NULL) 206 if (ts == NULL)
201 return(NULL); 207 return(NULL);
202 208
209 if (offset_day || offset_sec)
210 {
211 if (!OPENSSL_gmtime_adj(ts, offset_day, offset_sec))
212 return NULL;
213 }
214
215 if((ts->tm_year < 50) || (ts->tm_year >= 150))
216 return NULL;
217
203 p=(char *)s->data; 218 p=(char *)s->data;
204 if ((p == NULL) || ((size_t)s->length < len)) 219 if ((p == NULL) || ((size_t)s->length < len))
205 { 220 {
206 p=OPENSSL_malloc(len); 221 p=OPENSSL_malloc(len);
207 if (p == NULL) 222 if (p == NULL)
208 { 223 {
209 ASN1err(ASN1_F_ASN1_UTCTIME_SET,ERR_R_MALLOC_FAILURE); 224 ASN1err(ASN1_F_ASN1_UTCTIME_ADJ,ERR_R_MALLOC_FAILURE);
210 return(NULL); 225 return(NULL);
211 } 226 }
212 if (s->data != NULL) 227 if (s->data != NULL)
diff --git a/src/lib/libcrypto/asn1/a_verify.c b/src/lib/libcrypto/asn1/a_verify.c
index da3efaaf8d..cecdb13c70 100644
--- a/src/lib/libcrypto/asn1/a_verify.c
+++ b/src/lib/libcrypto/asn1/a_verify.c
@@ -60,6 +60,7 @@
60#include <time.h> 60#include <time.h>
61 61
62#include "cryptlib.h" 62#include "cryptlib.h"
63#include "asn1_locl.h"
63 64
64#ifndef NO_SYS_TYPES_H 65#ifndef NO_SYS_TYPES_H
65# include <sys/types.h> 66# include <sys/types.h>
@@ -100,12 +101,7 @@ int ASN1_verify(i2d_of_void *i2d, X509_ALGOR *a, ASN1_BIT_STRING *signature,
100 p=buf_in; 101 p=buf_in;
101 102
102 i2d(data,&p); 103 i2d(data,&p);
103 if (!EVP_VerifyInit_ex(&ctx,type, NULL)) 104 EVP_VerifyInit_ex(&ctx,type, NULL);
104 {
105 ASN1err(ASN1_F_ASN1_VERIFY,ERR_R_EVP_LIB);
106 ret=0;
107 goto err;
108 }
109 EVP_VerifyUpdate(&ctx,(unsigned char *)buf_in,inl); 105 EVP_VerifyUpdate(&ctx,(unsigned char *)buf_in,inl);
110 106
111 OPENSSL_cleanse(buf_in,(unsigned int)inl); 107 OPENSSL_cleanse(buf_in,(unsigned int)inl);
@@ -134,19 +130,34 @@ int ASN1_item_verify(const ASN1_ITEM *it, X509_ALGOR *a, ASN1_BIT_STRING *signat
134 void *asn, EVP_PKEY *pkey) 130 void *asn, EVP_PKEY *pkey)
135 { 131 {
136 EVP_MD_CTX ctx; 132 EVP_MD_CTX ctx;
137 const EVP_MD *type; 133 const EVP_MD *type = NULL;
138 unsigned char *buf_in=NULL; 134 unsigned char *buf_in=NULL;
139 int ret= -1,i,inl; 135 int ret= -1,inl;
136
137 int mdnid, pknid;
140 138
141 EVP_MD_CTX_init(&ctx); 139 EVP_MD_CTX_init(&ctx);
142 i=OBJ_obj2nid(a->algorithm); 140
143 type=EVP_get_digestbyname(OBJ_nid2sn(i)); 141 /* Convert signature OID into digest and public key OIDs */
142 if (!OBJ_find_sigid_algs(OBJ_obj2nid(a->algorithm), &mdnid, &pknid))
143 {
144 ASN1err(ASN1_F_ASN1_ITEM_VERIFY,ASN1_R_UNKNOWN_SIGNATURE_ALGORITHM);
145 goto err;
146 }
147 type=EVP_get_digestbynid(mdnid);
144 if (type == NULL) 148 if (type == NULL)
145 { 149 {
146 ASN1err(ASN1_F_ASN1_ITEM_VERIFY,ASN1_R_UNKNOWN_MESSAGE_DIGEST_ALGORITHM); 150 ASN1err(ASN1_F_ASN1_ITEM_VERIFY,ASN1_R_UNKNOWN_MESSAGE_DIGEST_ALGORITHM);
147 goto err; 151 goto err;
148 } 152 }
149 153
154 /* Check public key OID matches public key type */
155 if (EVP_PKEY_type(pknid) != pkey->ameth->pkey_id)
156 {
157 ASN1err(ASN1_F_ASN1_ITEM_VERIFY,ASN1_R_WRONG_PUBLIC_KEY_TYPE);
158 goto err;
159 }
160
150 if (!EVP_VerifyInit_ex(&ctx,type, NULL)) 161 if (!EVP_VerifyInit_ex(&ctx,type, NULL))
151 { 162 {
152 ASN1err(ASN1_F_ASN1_ITEM_VERIFY,ERR_R_EVP_LIB); 163 ASN1err(ASN1_F_ASN1_ITEM_VERIFY,ERR_R_EVP_LIB);
diff --git a/src/lib/libcrypto/asn1/asn1.h b/src/lib/libcrypto/asn1/asn1.h
index e3385226d4..f7718b5a94 100644
--- a/src/lib/libcrypto/asn1/asn1.h
+++ b/src/lib/libcrypto/asn1/asn1.h
@@ -213,7 +213,7 @@ typedef struct asn1_object_st
213 const char *sn,*ln; 213 const char *sn,*ln;
214 int nid; 214 int nid;
215 int length; 215 int length;
216 unsigned char *data; 216 const unsigned char *data; /* data remains const after init */
217 int flags; /* Should we free this one */ 217 int flags; /* Should we free this one */
218 } ASN1_OBJECT; 218 } ASN1_OBJECT;
219 219
@@ -228,8 +228,12 @@ typedef struct asn1_object_st
228 * complete and is a place holder for content when it had all been 228 * complete and is a place holder for content when it had all been
229 * accessed. The flag will be reset when content has been written to it. 229 * accessed. The flag will be reset when content has been written to it.
230 */ 230 */
231#define ASN1_STRING_FLAG_CONT 0x020
232 231
232#define ASN1_STRING_FLAG_CONT 0x020
233/* This flag is used by ASN1 code to indicate an ASN1_STRING is an MSTRING
234 * type.
235 */
236#define ASN1_STRING_FLAG_MSTRING 0x040
233/* This is the base type that holds just about everything :-) */ 237/* This is the base type that holds just about everything :-) */
234typedef struct asn1_string_st 238typedef struct asn1_string_st
235 { 239 {
@@ -330,6 +334,13 @@ typedef struct ASN1_VALUE_st ASN1_VALUE;
330 type *name##_new(void); \ 334 type *name##_new(void); \
331 void name##_free(type *a); 335 void name##_free(type *a);
332 336
337#define DECLARE_ASN1_PRINT_FUNCTION(stname) \
338 DECLARE_ASN1_PRINT_FUNCTION_fname(stname, stname)
339
340#define DECLARE_ASN1_PRINT_FUNCTION_fname(stname, fname) \
341 int fname##_print_ctx(BIO *out, stname *x, int indent, \
342 const ASN1_PCTX *pctx);
343
333#define D2I_OF(type) type *(*)(type **,const unsigned char **,long) 344#define D2I_OF(type) type *(*)(type **,const unsigned char **,long)
334#define I2D_OF(type) int (*)(type *,unsigned char **) 345#define I2D_OF(type) int (*)(type *,unsigned char **)
335#define I2D_OF_const(type) int (*)(const type *,unsigned char **) 346#define I2D_OF_const(type) int (*)(const type *,unsigned char **)
@@ -534,28 +545,23 @@ typedef struct asn1_type_st
534 * contain the set or sequence bytes */ 545 * contain the set or sequence bytes */
535 ASN1_STRING * set; 546 ASN1_STRING * set;
536 ASN1_STRING * sequence; 547 ASN1_STRING * sequence;
537 ASN1_VALUE * asn1_value; 548 ASN1_VALUE * asn1_value;
538 } value; 549 } value;
539 } ASN1_TYPE; 550 } ASN1_TYPE;
540 551
541DECLARE_STACK_OF(ASN1_TYPE) 552DECLARE_STACK_OF(ASN1_TYPE)
542DECLARE_ASN1_SET_OF(ASN1_TYPE) 553DECLARE_ASN1_SET_OF(ASN1_TYPE)
543 554
544typedef struct asn1_method_st 555typedef STACK_OF(ASN1_TYPE) ASN1_SEQUENCE_ANY;
545 { 556
546 i2d_of_void *i2d; 557DECLARE_ASN1_ENCODE_FUNCTIONS_const(ASN1_SEQUENCE_ANY, ASN1_SEQUENCE_ANY)
547 d2i_of_void *d2i; 558DECLARE_ASN1_ENCODE_FUNCTIONS_const(ASN1_SEQUENCE_ANY, ASN1_SET_ANY)
548 void *(*create)(void); 559
549 void (*destroy)(void *); 560typedef struct NETSCAPE_X509_st
550 } ASN1_METHOD;
551
552/* This is used when parsing some Netscape objects */
553typedef struct asn1_header_st
554 { 561 {
555 ASN1_OCTET_STRING *header; 562 ASN1_OCTET_STRING *header;
556 void *data; 563 X509 *cert;
557 ASN1_METHOD *meth; 564 } NETSCAPE_X509;
558 } ASN1_HEADER;
559 565
560/* This is used to contain a list of bit names */ 566/* This is used to contain a list of bit names */
561typedef struct BIT_STRING_BITNAME_st { 567typedef struct BIT_STRING_BITNAME_st {
@@ -575,32 +581,34 @@ typedef struct BIT_STRING_BITNAME_st {
575 ASN1_STRING_type_new(V_ASN1_BIT_STRING) 581 ASN1_STRING_type_new(V_ASN1_BIT_STRING)
576#define M_ASN1_BIT_STRING_free(a) ASN1_STRING_free((ASN1_STRING *)a) 582#define M_ASN1_BIT_STRING_free(a) ASN1_STRING_free((ASN1_STRING *)a)
577#define M_ASN1_BIT_STRING_dup(a) (ASN1_BIT_STRING *)\ 583#define M_ASN1_BIT_STRING_dup(a) (ASN1_BIT_STRING *)\
578 ASN1_STRING_dup((ASN1_STRING *)a) 584 ASN1_STRING_dup((const ASN1_STRING *)a)
579#define M_ASN1_BIT_STRING_cmp(a,b) ASN1_STRING_cmp(\ 585#define M_ASN1_BIT_STRING_cmp(a,b) ASN1_STRING_cmp(\
580 (ASN1_STRING *)a,(ASN1_STRING *)b) 586 (const ASN1_STRING *)a,(const ASN1_STRING *)b)
581#define M_ASN1_BIT_STRING_set(a,b,c) ASN1_STRING_set((ASN1_STRING *)a,b,c) 587#define M_ASN1_BIT_STRING_set(a,b,c) ASN1_STRING_set((ASN1_STRING *)a,b,c)
582 588
583#define M_ASN1_INTEGER_new() (ASN1_INTEGER *)\ 589#define M_ASN1_INTEGER_new() (ASN1_INTEGER *)\
584 ASN1_STRING_type_new(V_ASN1_INTEGER) 590 ASN1_STRING_type_new(V_ASN1_INTEGER)
585#define M_ASN1_INTEGER_free(a) ASN1_STRING_free((ASN1_STRING *)a) 591#define M_ASN1_INTEGER_free(a) ASN1_STRING_free((ASN1_STRING *)a)
586#define M_ASN1_INTEGER_dup(a) (ASN1_INTEGER *)ASN1_STRING_dup((ASN1_STRING *)a) 592#define M_ASN1_INTEGER_dup(a) (ASN1_INTEGER *)\
593 ASN1_STRING_dup((const ASN1_STRING *)a)
587#define M_ASN1_INTEGER_cmp(a,b) ASN1_STRING_cmp(\ 594#define M_ASN1_INTEGER_cmp(a,b) ASN1_STRING_cmp(\
588 (ASN1_STRING *)a,(ASN1_STRING *)b) 595 (const ASN1_STRING *)a,(const ASN1_STRING *)b)
589 596
590#define M_ASN1_ENUMERATED_new() (ASN1_ENUMERATED *)\ 597#define M_ASN1_ENUMERATED_new() (ASN1_ENUMERATED *)\
591 ASN1_STRING_type_new(V_ASN1_ENUMERATED) 598 ASN1_STRING_type_new(V_ASN1_ENUMERATED)
592#define M_ASN1_ENUMERATED_free(a) ASN1_STRING_free((ASN1_STRING *)a) 599#define M_ASN1_ENUMERATED_free(a) ASN1_STRING_free((ASN1_STRING *)a)
593#define M_ASN1_ENUMERATED_dup(a) (ASN1_ENUMERATED *)ASN1_STRING_dup((ASN1_STRING *)a) 600#define M_ASN1_ENUMERATED_dup(a) (ASN1_ENUMERATED *)\
601 ASN1_STRING_dup((const ASN1_STRING *)a)
594#define M_ASN1_ENUMERATED_cmp(a,b) ASN1_STRING_cmp(\ 602#define M_ASN1_ENUMERATED_cmp(a,b) ASN1_STRING_cmp(\
595 (ASN1_STRING *)a,(ASN1_STRING *)b) 603 (const ASN1_STRING *)a,(const ASN1_STRING *)b)
596 604
597#define M_ASN1_OCTET_STRING_new() (ASN1_OCTET_STRING *)\ 605#define M_ASN1_OCTET_STRING_new() (ASN1_OCTET_STRING *)\
598 ASN1_STRING_type_new(V_ASN1_OCTET_STRING) 606 ASN1_STRING_type_new(V_ASN1_OCTET_STRING)
599#define M_ASN1_OCTET_STRING_free(a) ASN1_STRING_free((ASN1_STRING *)a) 607#define M_ASN1_OCTET_STRING_free(a) ASN1_STRING_free((ASN1_STRING *)a)
600#define M_ASN1_OCTET_STRING_dup(a) (ASN1_OCTET_STRING *)\ 608#define M_ASN1_OCTET_STRING_dup(a) (ASN1_OCTET_STRING *)\
601 ASN1_STRING_dup((ASN1_STRING *)a) 609 ASN1_STRING_dup((const ASN1_STRING *)a)
602#define M_ASN1_OCTET_STRING_cmp(a,b) ASN1_STRING_cmp(\ 610#define M_ASN1_OCTET_STRING_cmp(a,b) ASN1_STRING_cmp(\
603 (ASN1_STRING *)a,(ASN1_STRING *)b) 611 (const ASN1_STRING *)a,(const ASN1_STRING *)b)
604#define M_ASN1_OCTET_STRING_set(a,b,c) ASN1_STRING_set((ASN1_STRING *)a,b,c) 612#define M_ASN1_OCTET_STRING_set(a,b,c) ASN1_STRING_set((ASN1_STRING *)a,b,c)
605#define M_ASN1_OCTET_STRING_print(a,b) ASN1_STRING_print(a,(ASN1_STRING *)b) 613#define M_ASN1_OCTET_STRING_print(a,b) ASN1_STRING_print(a,(ASN1_STRING *)b)
606#define M_i2d_ASN1_OCTET_STRING(a,pp) \ 614#define M_i2d_ASN1_OCTET_STRING(a,pp) \
@@ -684,7 +692,7 @@ typedef struct BIT_STRING_BITNAME_st {
684 ASN1_STRING_type_new(V_ASN1_IA5STRING) 692 ASN1_STRING_type_new(V_ASN1_IA5STRING)
685#define M_ASN1_IA5STRING_free(a) ASN1_STRING_free((ASN1_STRING *)a) 693#define M_ASN1_IA5STRING_free(a) ASN1_STRING_free((ASN1_STRING *)a)
686#define M_ASN1_IA5STRING_dup(a) \ 694#define M_ASN1_IA5STRING_dup(a) \
687 (ASN1_IA5STRING *)ASN1_STRING_dup((ASN1_STRING *)a) 695 (ASN1_IA5STRING *)ASN1_STRING_dup((const ASN1_STRING *)a)
688#define M_i2d_ASN1_IA5STRING(a,pp) \ 696#define M_i2d_ASN1_IA5STRING(a,pp) \
689 i2d_ASN1_bytes((ASN1_STRING *)a,pp,V_ASN1_IA5STRING,\ 697 i2d_ASN1_bytes((ASN1_STRING *)a,pp,V_ASN1_IA5STRING,\
690 V_ASN1_UNIVERSAL) 698 V_ASN1_UNIVERSAL)
@@ -695,18 +703,20 @@ typedef struct BIT_STRING_BITNAME_st {
695#define M_ASN1_UTCTIME_new() (ASN1_UTCTIME *)\ 703#define M_ASN1_UTCTIME_new() (ASN1_UTCTIME *)\
696 ASN1_STRING_type_new(V_ASN1_UTCTIME) 704 ASN1_STRING_type_new(V_ASN1_UTCTIME)
697#define M_ASN1_UTCTIME_free(a) ASN1_STRING_free((ASN1_STRING *)a) 705#define M_ASN1_UTCTIME_free(a) ASN1_STRING_free((ASN1_STRING *)a)
698#define M_ASN1_UTCTIME_dup(a) (ASN1_UTCTIME *)ASN1_STRING_dup((ASN1_STRING *)a) 706#define M_ASN1_UTCTIME_dup(a) (ASN1_UTCTIME *)\
707 ASN1_STRING_dup((const ASN1_STRING *)a)
699 708
700#define M_ASN1_GENERALIZEDTIME_new() (ASN1_GENERALIZEDTIME *)\ 709#define M_ASN1_GENERALIZEDTIME_new() (ASN1_GENERALIZEDTIME *)\
701 ASN1_STRING_type_new(V_ASN1_GENERALIZEDTIME) 710 ASN1_STRING_type_new(V_ASN1_GENERALIZEDTIME)
702#define M_ASN1_GENERALIZEDTIME_free(a) ASN1_STRING_free((ASN1_STRING *)a) 711#define M_ASN1_GENERALIZEDTIME_free(a) ASN1_STRING_free((ASN1_STRING *)a)
703#define M_ASN1_GENERALIZEDTIME_dup(a) (ASN1_GENERALIZEDTIME *)ASN1_STRING_dup(\ 712#define M_ASN1_GENERALIZEDTIME_dup(a) (ASN1_GENERALIZEDTIME *)ASN1_STRING_dup(\
704 (ASN1_STRING *)a) 713 (const ASN1_STRING *)a)
705 714
706#define M_ASN1_TIME_new() (ASN1_TIME *)\ 715#define M_ASN1_TIME_new() (ASN1_TIME *)\
707 ASN1_STRING_type_new(V_ASN1_UTCTIME) 716 ASN1_STRING_type_new(V_ASN1_UTCTIME)
708#define M_ASN1_TIME_free(a) ASN1_STRING_free((ASN1_STRING *)a) 717#define M_ASN1_TIME_free(a) ASN1_STRING_free((ASN1_STRING *)a)
709#define M_ASN1_TIME_dup(a) (ASN1_TIME *)ASN1_STRING_dup((ASN1_STRING *)a) 718#define M_ASN1_TIME_dup(a) (ASN1_TIME *)\
719 ASN1_STRING_dup((const ASN1_STRING *)a)
710 720
711#define M_ASN1_GENERALSTRING_new() (ASN1_GENERALSTRING *)\ 721#define M_ASN1_GENERALSTRING_new() (ASN1_GENERALSTRING *)\
712 ASN1_STRING_type_new(V_ASN1_GENERALSTRING) 722 ASN1_STRING_type_new(V_ASN1_GENERALSTRING)
@@ -767,6 +777,7 @@ DECLARE_ASN1_FUNCTIONS_fname(ASN1_TYPE, ASN1_ANY, ASN1_TYPE)
767int ASN1_TYPE_get(ASN1_TYPE *a); 777int ASN1_TYPE_get(ASN1_TYPE *a);
768void ASN1_TYPE_set(ASN1_TYPE *a, int type, void *value); 778void ASN1_TYPE_set(ASN1_TYPE *a, int type, void *value);
769int ASN1_TYPE_set1(ASN1_TYPE *a, int type, const void *value); 779int ASN1_TYPE_set1(ASN1_TYPE *a, int type, const void *value);
780int ASN1_TYPE_cmp(ASN1_TYPE *a, ASN1_TYPE *b);
770 781
771ASN1_OBJECT * ASN1_OBJECT_new(void ); 782ASN1_OBJECT * ASN1_OBJECT_new(void );
772void ASN1_OBJECT_free(ASN1_OBJECT *a); 783void ASN1_OBJECT_free(ASN1_OBJECT *a);
@@ -783,14 +794,15 @@ DECLARE_ASN1_SET_OF(ASN1_OBJECT)
783 794
784ASN1_STRING * ASN1_STRING_new(void); 795ASN1_STRING * ASN1_STRING_new(void);
785void ASN1_STRING_free(ASN1_STRING *a); 796void ASN1_STRING_free(ASN1_STRING *a);
786ASN1_STRING * ASN1_STRING_dup(ASN1_STRING *a); 797int ASN1_STRING_copy(ASN1_STRING *dst, const ASN1_STRING *str);
798ASN1_STRING * ASN1_STRING_dup(const ASN1_STRING *a);
787ASN1_STRING * ASN1_STRING_type_new(int type ); 799ASN1_STRING * ASN1_STRING_type_new(int type );
788int ASN1_STRING_cmp(ASN1_STRING *a, ASN1_STRING *b); 800int ASN1_STRING_cmp(const ASN1_STRING *a, const ASN1_STRING *b);
789 /* Since this is used to store all sorts of things, via macros, for now, make 801 /* Since this is used to store all sorts of things, via macros, for now, make
790 its data void * */ 802 its data void * */
791int ASN1_STRING_set(ASN1_STRING *str, const void *data, int len); 803int ASN1_STRING_set(ASN1_STRING *str, const void *data, int len);
792void ASN1_STRING_set0(ASN1_STRING *str, void *data, int len); 804void ASN1_STRING_set0(ASN1_STRING *str, void *data, int len);
793int ASN1_STRING_length(ASN1_STRING *x); 805int ASN1_STRING_length(const ASN1_STRING *x);
794void ASN1_STRING_length_set(ASN1_STRING *x, int n); 806void ASN1_STRING_length_set(ASN1_STRING *x, int n);
795int ASN1_STRING_type(ASN1_STRING *x); 807int ASN1_STRING_type(ASN1_STRING *x);
796unsigned char * ASN1_STRING_data(ASN1_STRING *x); 808unsigned char * ASN1_STRING_data(ASN1_STRING *x);
@@ -803,6 +815,8 @@ int ASN1_BIT_STRING_set(ASN1_BIT_STRING *a, unsigned char *d,
803 int length ); 815 int length );
804int ASN1_BIT_STRING_set_bit(ASN1_BIT_STRING *a, int n, int value); 816int ASN1_BIT_STRING_set_bit(ASN1_BIT_STRING *a, int n, int value);
805int ASN1_BIT_STRING_get_bit(ASN1_BIT_STRING *a, int n); 817int ASN1_BIT_STRING_get_bit(ASN1_BIT_STRING *a, int n);
818int ASN1_BIT_STRING_check(ASN1_BIT_STRING *a,
819 unsigned char *flags, int flags_len);
806 820
807#ifndef OPENSSL_NO_BIO 821#ifndef OPENSSL_NO_BIO
808int ASN1_BIT_STRING_name_print(BIO *out, ASN1_BIT_STRING *bs, 822int ASN1_BIT_STRING_name_print(BIO *out, ASN1_BIT_STRING *bs,
@@ -821,13 +835,15 @@ ASN1_INTEGER *c2i_ASN1_INTEGER(ASN1_INTEGER **a,const unsigned char **pp,
821 long length); 835 long length);
822ASN1_INTEGER *d2i_ASN1_UINTEGER(ASN1_INTEGER **a,const unsigned char **pp, 836ASN1_INTEGER *d2i_ASN1_UINTEGER(ASN1_INTEGER **a,const unsigned char **pp,
823 long length); 837 long length);
824ASN1_INTEGER * ASN1_INTEGER_dup(ASN1_INTEGER *x); 838ASN1_INTEGER * ASN1_INTEGER_dup(const ASN1_INTEGER *x);
825int ASN1_INTEGER_cmp(ASN1_INTEGER *x, ASN1_INTEGER *y); 839int ASN1_INTEGER_cmp(const ASN1_INTEGER *x, const ASN1_INTEGER *y);
826 840
827DECLARE_ASN1_FUNCTIONS(ASN1_ENUMERATED) 841DECLARE_ASN1_FUNCTIONS(ASN1_ENUMERATED)
828 842
829int ASN1_UTCTIME_check(ASN1_UTCTIME *a); 843int ASN1_UTCTIME_check(ASN1_UTCTIME *a);
830ASN1_UTCTIME *ASN1_UTCTIME_set(ASN1_UTCTIME *s,time_t t); 844ASN1_UTCTIME *ASN1_UTCTIME_set(ASN1_UTCTIME *s,time_t t);
845ASN1_UTCTIME *ASN1_UTCTIME_adj(ASN1_UTCTIME *s, time_t t,
846 int offset_day, long offset_sec);
831int ASN1_UTCTIME_set_string(ASN1_UTCTIME *s, const char *str); 847int ASN1_UTCTIME_set_string(ASN1_UTCTIME *s, const char *str);
832int ASN1_UTCTIME_cmp_time_t(const ASN1_UTCTIME *s, time_t t); 848int ASN1_UTCTIME_cmp_time_t(const ASN1_UTCTIME *s, time_t t);
833#if 0 849#if 0
@@ -836,11 +852,13 @@ time_t ASN1_UTCTIME_get(const ASN1_UTCTIME *s);
836 852
837int ASN1_GENERALIZEDTIME_check(ASN1_GENERALIZEDTIME *a); 853int ASN1_GENERALIZEDTIME_check(ASN1_GENERALIZEDTIME *a);
838ASN1_GENERALIZEDTIME *ASN1_GENERALIZEDTIME_set(ASN1_GENERALIZEDTIME *s,time_t t); 854ASN1_GENERALIZEDTIME *ASN1_GENERALIZEDTIME_set(ASN1_GENERALIZEDTIME *s,time_t t);
855ASN1_GENERALIZEDTIME *ASN1_GENERALIZEDTIME_adj(ASN1_GENERALIZEDTIME *s,
856 time_t t, int offset_day, long offset_sec);
839int ASN1_GENERALIZEDTIME_set_string(ASN1_GENERALIZEDTIME *s, const char *str); 857int ASN1_GENERALIZEDTIME_set_string(ASN1_GENERALIZEDTIME *s, const char *str);
840 858
841DECLARE_ASN1_FUNCTIONS(ASN1_OCTET_STRING) 859DECLARE_ASN1_FUNCTIONS(ASN1_OCTET_STRING)
842ASN1_OCTET_STRING * ASN1_OCTET_STRING_dup(ASN1_OCTET_STRING *a); 860ASN1_OCTET_STRING * ASN1_OCTET_STRING_dup(const ASN1_OCTET_STRING *a);
843int ASN1_OCTET_STRING_cmp(ASN1_OCTET_STRING *a, ASN1_OCTET_STRING *b); 861int ASN1_OCTET_STRING_cmp(const ASN1_OCTET_STRING *a, const ASN1_OCTET_STRING *b);
844int ASN1_OCTET_STRING_set(ASN1_OCTET_STRING *str, const unsigned char *data, int len); 862int ASN1_OCTET_STRING_set(ASN1_OCTET_STRING *str, const unsigned char *data, int len);
845 863
846DECLARE_ASN1_FUNCTIONS(ASN1_VISIBLESTRING) 864DECLARE_ASN1_FUNCTIONS(ASN1_VISIBLESTRING)
@@ -867,14 +885,20 @@ DECLARE_ASN1_FUNCTIONS(ASN1_TIME)
867DECLARE_ASN1_ITEM(ASN1_OCTET_STRING_NDEF) 885DECLARE_ASN1_ITEM(ASN1_OCTET_STRING_NDEF)
868 886
869ASN1_TIME *ASN1_TIME_set(ASN1_TIME *s,time_t t); 887ASN1_TIME *ASN1_TIME_set(ASN1_TIME *s,time_t t);
888ASN1_TIME *ASN1_TIME_adj(ASN1_TIME *s,time_t t,
889 int offset_day, long offset_sec);
870int ASN1_TIME_check(ASN1_TIME *t); 890int ASN1_TIME_check(ASN1_TIME *t);
871ASN1_GENERALIZEDTIME *ASN1_TIME_to_generalizedtime(ASN1_TIME *t, ASN1_GENERALIZEDTIME **out); 891ASN1_GENERALIZEDTIME *ASN1_TIME_to_generalizedtime(ASN1_TIME *t, ASN1_GENERALIZEDTIME **out);
892int ASN1_TIME_set_string(ASN1_TIME *s, const char *str);
872 893
873int i2d_ASN1_SET(STACK *a, unsigned char **pp, 894int i2d_ASN1_SET(STACK_OF(OPENSSL_BLOCK) *a, unsigned char **pp,
874 i2d_of_void *i2d, int ex_tag, int ex_class, int is_set); 895 i2d_of_void *i2d, int ex_tag, int ex_class,
875STACK * d2i_ASN1_SET(STACK **a, const unsigned char **pp, long length, 896 int is_set);
876 d2i_of_void *d2i, void (*free_func)(void *), 897STACK_OF(OPENSSL_BLOCK) *d2i_ASN1_SET(STACK_OF(OPENSSL_BLOCK) **a,
877 int ex_tag, int ex_class); 898 const unsigned char **pp,
899 long length, d2i_of_void *d2i,
900 void (*free_func)(OPENSSL_BLOCK), int ex_tag,
901 int ex_class);
878 902
879#ifndef OPENSSL_NO_BIO 903#ifndef OPENSSL_NO_BIO
880int i2a_ASN1_INTEGER(BIO *bp, ASN1_INTEGER *a); 904int i2a_ASN1_INTEGER(BIO *bp, ASN1_INTEGER *a);
@@ -892,9 +916,9 @@ ASN1_OBJECT *ASN1_OBJECT_create(int nid, unsigned char *data,int len,
892 const char *sn, const char *ln); 916 const char *sn, const char *ln);
893 917
894int ASN1_INTEGER_set(ASN1_INTEGER *a, long v); 918int ASN1_INTEGER_set(ASN1_INTEGER *a, long v);
895long ASN1_INTEGER_get(ASN1_INTEGER *a); 919long ASN1_INTEGER_get(const ASN1_INTEGER *a);
896ASN1_INTEGER *BN_to_ASN1_INTEGER(BIGNUM *bn, ASN1_INTEGER *ai); 920ASN1_INTEGER *BN_to_ASN1_INTEGER(const BIGNUM *bn, ASN1_INTEGER *ai);
897BIGNUM *ASN1_INTEGER_to_BN(ASN1_INTEGER *ai,BIGNUM *bn); 921BIGNUM *ASN1_INTEGER_to_BN(const ASN1_INTEGER *ai,BIGNUM *bn);
898 922
899int ASN1_ENUMERATED_set(ASN1_ENUMERATED *a, long v); 923int ASN1_ENUMERATED_set(ASN1_ENUMERATED *a, long v);
900long ASN1_ENUMERATED_get(ASN1_ENUMERATED *a); 924long ASN1_ENUMERATED_get(ASN1_ENUMERATED *a);
@@ -928,7 +952,7 @@ int ASN1_put_eoc(unsigned char **pp);
928int ASN1_object_size(int constructed, int length, int tag); 952int ASN1_object_size(int constructed, int length, int tag);
929 953
930/* Used to implement other functions */ 954/* Used to implement other functions */
931void *ASN1_dup(i2d_of_void *i2d, d2i_of_void *d2i, char *x); 955void *ASN1_dup(i2d_of_void *i2d, d2i_of_void *d2i, void *x);
932 956
933#define ASN1_dup_of(type,i2d,d2i,x) \ 957#define ASN1_dup_of(type,i2d,d2i,x) \
934 ((type*)ASN1_dup(CHECKED_I2D_OF(type, i2d), \ 958 ((type*)ASN1_dup(CHECKED_I2D_OF(type, i2d), \
@@ -999,29 +1023,23 @@ int ASN1_i2d_bio(i2d_of_void *i2d,BIO *out, unsigned char *x);
999 CHECKED_PTR_OF(const type, x))) 1023 CHECKED_PTR_OF(const type, x)))
1000 1024
1001int ASN1_item_i2d_bio(const ASN1_ITEM *it, BIO *out, void *x); 1025int ASN1_item_i2d_bio(const ASN1_ITEM *it, BIO *out, void *x);
1002int ASN1_UTCTIME_print(BIO *fp,ASN1_UTCTIME *a); 1026int ASN1_UTCTIME_print(BIO *fp, const ASN1_UTCTIME *a);
1003int ASN1_GENERALIZEDTIME_print(BIO *fp,ASN1_GENERALIZEDTIME *a); 1027int ASN1_GENERALIZEDTIME_print(BIO *fp, const ASN1_GENERALIZEDTIME *a);
1004int ASN1_TIME_print(BIO *fp,ASN1_TIME *a); 1028int ASN1_TIME_print(BIO *fp, const ASN1_TIME *a);
1005int ASN1_STRING_print(BIO *bp,ASN1_STRING *v); 1029int ASN1_STRING_print(BIO *bp, const ASN1_STRING *v);
1006int ASN1_STRING_print_ex(BIO *out, ASN1_STRING *str, unsigned long flags); 1030int ASN1_STRING_print_ex(BIO *out, ASN1_STRING *str, unsigned long flags);
1031int ASN1_bn_print(BIO *bp, const char *number, const BIGNUM *num,
1032 unsigned char *buf, int off);
1007int ASN1_parse(BIO *bp,const unsigned char *pp,long len,int indent); 1033int ASN1_parse(BIO *bp,const unsigned char *pp,long len,int indent);
1008int ASN1_parse_dump(BIO *bp,const unsigned char *pp,long len,int indent,int dump); 1034int ASN1_parse_dump(BIO *bp,const unsigned char *pp,long len,int indent,int dump);
1009#endif 1035#endif
1010const char *ASN1_tag2str(int tag); 1036const char *ASN1_tag2str(int tag);
1011 1037
1012/* Used to load and write netscape format cert/key */ 1038/* Used to load and write netscape format cert */
1013int i2d_ASN1_HEADER(ASN1_HEADER *a,unsigned char **pp);
1014ASN1_HEADER *d2i_ASN1_HEADER(ASN1_HEADER **a,const unsigned char **pp, long length);
1015ASN1_HEADER *ASN1_HEADER_new(void );
1016void ASN1_HEADER_free(ASN1_HEADER *a);
1017 1039
1018int ASN1_UNIVERSALSTRING_to_string(ASN1_UNIVERSALSTRING *s); 1040DECLARE_ASN1_FUNCTIONS(NETSCAPE_X509)
1019 1041
1020/* Not used that much at this point, except for the first two */ 1042int ASN1_UNIVERSALSTRING_to_string(ASN1_UNIVERSALSTRING *s);
1021ASN1_METHOD *X509_asn1_meth(void);
1022ASN1_METHOD *RSAPrivateKey_asn1_meth(void);
1023ASN1_METHOD *ASN1_IA5STRING_asn1_meth(void);
1024ASN1_METHOD *ASN1_BIT_STRING_asn1_meth(void);
1025 1043
1026int ASN1_TYPE_set_octetstring(ASN1_TYPE *a, 1044int ASN1_TYPE_set_octetstring(ASN1_TYPE *a,
1027 unsigned char *data, int len); 1045 unsigned char *data, int len);
@@ -1032,9 +1050,9 @@ int ASN1_TYPE_set_int_octetstring(ASN1_TYPE *a, long num,
1032int ASN1_TYPE_get_int_octetstring(ASN1_TYPE *a,long *num, 1050int ASN1_TYPE_get_int_octetstring(ASN1_TYPE *a,long *num,
1033 unsigned char *data, int max_len); 1051 unsigned char *data, int max_len);
1034 1052
1035STACK *ASN1_seq_unpack(const unsigned char *buf, int len, 1053STACK_OF(OPENSSL_BLOCK) *ASN1_seq_unpack(const unsigned char *buf, int len,
1036 d2i_of_void *d2i, void (*free_func)(void *)); 1054 d2i_of_void *d2i, void (*free_func)(OPENSSL_BLOCK));
1037unsigned char *ASN1_seq_pack(STACK *safes, i2d_of_void *i2d, 1055unsigned char *ASN1_seq_pack(STACK_OF(OPENSSL_BLOCK) *safes, i2d_of_void *i2d,
1038 unsigned char **buf, int *len ); 1056 unsigned char **buf, int *len );
1039void *ASN1_unpack_string(ASN1_STRING *oct, d2i_of_void *d2i); 1057void *ASN1_unpack_string(ASN1_STRING *oct, d2i_of_void *d2i);
1040void *ASN1_item_unpack(ASN1_STRING *oct, const ASN1_ITEM *it); 1058void *ASN1_item_unpack(ASN1_STRING *oct, const ASN1_ITEM *it);
@@ -1077,15 +1095,58 @@ void ASN1_add_oid_module(void);
1077ASN1_TYPE *ASN1_generate_nconf(char *str, CONF *nconf); 1095ASN1_TYPE *ASN1_generate_nconf(char *str, CONF *nconf);
1078ASN1_TYPE *ASN1_generate_v3(char *str, X509V3_CTX *cnf); 1096ASN1_TYPE *ASN1_generate_v3(char *str, X509V3_CTX *cnf);
1079 1097
1080typedef int asn1_output_data_fn(BIO *out, BIO *data, ASN1_VALUE *val, int flags, 1098/* ASN1 Print flags */
1081 const ASN1_ITEM *it); 1099
1082 1100/* Indicate missing OPTIONAL fields */
1083int int_smime_write_ASN1(BIO *bio, ASN1_VALUE *val, BIO *data, int flags, 1101#define ASN1_PCTX_FLAGS_SHOW_ABSENT 0x001
1102/* Mark start and end of SEQUENCE */
1103#define ASN1_PCTX_FLAGS_SHOW_SEQUENCE 0x002
1104/* Mark start and end of SEQUENCE/SET OF */
1105#define ASN1_PCTX_FLAGS_SHOW_SSOF 0x004
1106/* Show the ASN1 type of primitives */
1107#define ASN1_PCTX_FLAGS_SHOW_TYPE 0x008
1108/* Don't show ASN1 type of ANY */
1109#define ASN1_PCTX_FLAGS_NO_ANY_TYPE 0x010
1110/* Don't show ASN1 type of MSTRINGs */
1111#define ASN1_PCTX_FLAGS_NO_MSTRING_TYPE 0x020
1112/* Don't show field names in SEQUENCE */
1113#define ASN1_PCTX_FLAGS_NO_FIELD_NAME 0x040
1114/* Show structure names of each SEQUENCE field */
1115#define ASN1_PCTX_FLAGS_SHOW_FIELD_STRUCT_NAME 0x080
1116/* Don't show structure name even at top level */
1117#define ASN1_PCTX_FLAGS_NO_STRUCT_NAME 0x100
1118
1119int ASN1_item_print(BIO *out, ASN1_VALUE *ifld, int indent,
1120 const ASN1_ITEM *it, const ASN1_PCTX *pctx);
1121ASN1_PCTX *ASN1_PCTX_new(void);
1122void ASN1_PCTX_free(ASN1_PCTX *p);
1123unsigned long ASN1_PCTX_get_flags(ASN1_PCTX *p);
1124void ASN1_PCTX_set_flags(ASN1_PCTX *p, unsigned long flags);
1125unsigned long ASN1_PCTX_get_nm_flags(ASN1_PCTX *p);
1126void ASN1_PCTX_set_nm_flags(ASN1_PCTX *p, unsigned long flags);
1127unsigned long ASN1_PCTX_get_cert_flags(ASN1_PCTX *p);
1128void ASN1_PCTX_set_cert_flags(ASN1_PCTX *p, unsigned long flags);
1129unsigned long ASN1_PCTX_get_oid_flags(ASN1_PCTX *p);
1130void ASN1_PCTX_set_oid_flags(ASN1_PCTX *p, unsigned long flags);
1131unsigned long ASN1_PCTX_get_str_flags(ASN1_PCTX *p);
1132void ASN1_PCTX_set_str_flags(ASN1_PCTX *p, unsigned long flags);
1133
1134BIO_METHOD *BIO_f_asn1(void);
1135
1136BIO *BIO_new_NDEF(BIO *out, ASN1_VALUE *val, const ASN1_ITEM *it);
1137
1138int i2d_ASN1_bio_stream(BIO *out, ASN1_VALUE *val, BIO *in, int flags,
1139 const ASN1_ITEM *it);
1140int PEM_write_bio_ASN1_stream(BIO *out, ASN1_VALUE *val, BIO *in, int flags,
1141 const char *hdr,
1142 const ASN1_ITEM *it);
1143int SMIME_write_ASN1(BIO *bio, ASN1_VALUE *val, BIO *data, int flags,
1084 int ctype_nid, int econt_nid, 1144 int ctype_nid, int econt_nid,
1085 STACK_OF(X509_ALGOR) *mdalgs, 1145 STACK_OF(X509_ALGOR) *mdalgs,
1086 asn1_output_data_fn *data_fn,
1087 const ASN1_ITEM *it); 1146 const ASN1_ITEM *it);
1088ASN1_VALUE *SMIME_read_ASN1(BIO *bio, BIO **bcont, const ASN1_ITEM *it); 1147ASN1_VALUE *SMIME_read_ASN1(BIO *bio, BIO **bcont, const ASN1_ITEM *it);
1148int SMIME_crlf_copy(BIO *in, BIO *out, int flags);
1149int SMIME_text(BIO *in, BIO *out);
1089 1150
1090/* BEGIN ERROR CODES */ 1151/* BEGIN ERROR CODES */
1091/* The following lines are auto generated by the script mkerr.pl. Any changes 1152/* The following lines are auto generated by the script mkerr.pl. Any changes
@@ -1116,6 +1177,7 @@ void ERR_load_ASN1_strings(void);
1116#define ASN1_F_ASN1_ENUMERATED_TO_BN 113 1177#define ASN1_F_ASN1_ENUMERATED_TO_BN 113
1117#define ASN1_F_ASN1_EX_C2I 204 1178#define ASN1_F_ASN1_EX_C2I 204
1118#define ASN1_F_ASN1_FIND_END 190 1179#define ASN1_F_ASN1_FIND_END 190
1180#define ASN1_F_ASN1_GENERALIZEDTIME_ADJ 216
1119#define ASN1_F_ASN1_GENERALIZEDTIME_SET 185 1181#define ASN1_F_ASN1_GENERALIZEDTIME_SET 185
1120#define ASN1_F_ASN1_GENERATE_V3 178 1182#define ASN1_F_ASN1_GENERATE_V3 178
1121#define ASN1_F_ASN1_GET_OBJECT 114 1183#define ASN1_F_ASN1_GET_OBJECT 114
@@ -1136,7 +1198,7 @@ void ERR_load_ASN1_strings(void);
1136#define ASN1_F_ASN1_ITEM_VERIFY 197 1198#define ASN1_F_ASN1_ITEM_VERIFY 197
1137#define ASN1_F_ASN1_MBSTRING_NCOPY 122 1199#define ASN1_F_ASN1_MBSTRING_NCOPY 122
1138#define ASN1_F_ASN1_OBJECT_NEW 123 1200#define ASN1_F_ASN1_OBJECT_NEW 123
1139#define ASN1_F_ASN1_OUTPUT_DATA 207 1201#define ASN1_F_ASN1_OUTPUT_DATA 214
1140#define ASN1_F_ASN1_PACK_STRING 124 1202#define ASN1_F_ASN1_PACK_STRING 124
1141#define ASN1_F_ASN1_PCTX_NEW 205 1203#define ASN1_F_ASN1_PCTX_NEW 205
1142#define ASN1_F_ASN1_PKCS5_PBE_SET 125 1204#define ASN1_F_ASN1_PKCS5_PBE_SET 125
@@ -1150,14 +1212,17 @@ void ERR_load_ASN1_strings(void);
1150#define ASN1_F_ASN1_TEMPLATE_EX_D2I 132 1212#define ASN1_F_ASN1_TEMPLATE_EX_D2I 132
1151#define ASN1_F_ASN1_TEMPLATE_NEW 133 1213#define ASN1_F_ASN1_TEMPLATE_NEW 133
1152#define ASN1_F_ASN1_TEMPLATE_NOEXP_D2I 131 1214#define ASN1_F_ASN1_TEMPLATE_NOEXP_D2I 131
1215#define ASN1_F_ASN1_TIME_ADJ 217
1153#define ASN1_F_ASN1_TIME_SET 175 1216#define ASN1_F_ASN1_TIME_SET 175
1154#define ASN1_F_ASN1_TYPE_GET_INT_OCTETSTRING 134 1217#define ASN1_F_ASN1_TYPE_GET_INT_OCTETSTRING 134
1155#define ASN1_F_ASN1_TYPE_GET_OCTETSTRING 135 1218#define ASN1_F_ASN1_TYPE_GET_OCTETSTRING 135
1156#define ASN1_F_ASN1_UNPACK_STRING 136 1219#define ASN1_F_ASN1_UNPACK_STRING 136
1220#define ASN1_F_ASN1_UTCTIME_ADJ 218
1157#define ASN1_F_ASN1_UTCTIME_SET 187 1221#define ASN1_F_ASN1_UTCTIME_SET 187
1158#define ASN1_F_ASN1_VERIFY 137 1222#define ASN1_F_ASN1_VERIFY 137
1159#define ASN1_F_B64_READ_ASN1 208 1223#define ASN1_F_B64_READ_ASN1 209
1160#define ASN1_F_B64_WRITE_ASN1 209 1224#define ASN1_F_B64_WRITE_ASN1 210
1225#define ASN1_F_BIO_NEW_NDEF 208
1161#define ASN1_F_BITSTR_CB 180 1226#define ASN1_F_BITSTR_CB 180
1162#define ASN1_F_BN_TO_ASN1_ENUMERATED 138 1227#define ASN1_F_BN_TO_ASN1_ENUMERATED 138
1163#define ASN1_F_BN_TO_ASN1_INTEGER 139 1228#define ASN1_F_BN_TO_ASN1_INTEGER 139
@@ -1176,6 +1241,7 @@ void ERR_load_ASN1_strings(void);
1176#define ASN1_F_D2I_ASN1_TYPE_BYTES 149 1241#define ASN1_F_D2I_ASN1_TYPE_BYTES 149
1177#define ASN1_F_D2I_ASN1_UINTEGER 150 1242#define ASN1_F_D2I_ASN1_UINTEGER 150
1178#define ASN1_F_D2I_ASN1_UTCTIME 151 1243#define ASN1_F_D2I_ASN1_UTCTIME 151
1244#define ASN1_F_D2I_AUTOPRIVATEKEY 207
1179#define ASN1_F_D2I_NETSCAPE_RSA 152 1245#define ASN1_F_D2I_NETSCAPE_RSA 152
1180#define ASN1_F_D2I_NETSCAPE_RSA_2 153 1246#define ASN1_F_D2I_NETSCAPE_RSA_2 153
1181#define ASN1_F_D2I_PRIVATEKEY 154 1247#define ASN1_F_D2I_PRIVATEKEY 154
@@ -1185,6 +1251,7 @@ void ERR_load_ASN1_strings(void);
1185#define ASN1_F_D2I_X509 156 1251#define ASN1_F_D2I_X509 156
1186#define ASN1_F_D2I_X509_CINF 157 1252#define ASN1_F_D2I_X509_CINF 157
1187#define ASN1_F_D2I_X509_PKEY 159 1253#define ASN1_F_D2I_X509_PKEY 159
1254#define ASN1_F_I2D_ASN1_BIO_STREAM 211
1188#define ASN1_F_I2D_ASN1_SET 188 1255#define ASN1_F_I2D_ASN1_SET 188
1189#define ASN1_F_I2D_ASN1_TIME 160 1256#define ASN1_F_I2D_ASN1_TIME 160
1190#define ASN1_F_I2D_DSA_PUBKEY 161 1257#define ASN1_F_I2D_DSA_PUBKEY 161
@@ -1196,10 +1263,11 @@ void ERR_load_ASN1_strings(void);
1196#define ASN1_F_LONG_C2I 166 1263#define ASN1_F_LONG_C2I 166
1197#define ASN1_F_OID_MODULE_INIT 174 1264#define ASN1_F_OID_MODULE_INIT 174
1198#define ASN1_F_PARSE_TAGGING 182 1265#define ASN1_F_PARSE_TAGGING 182
1199#define ASN1_F_PKCS5_PBE2_SET 167 1266#define ASN1_F_PKCS5_PBE2_SET_IV 167
1200#define ASN1_F_PKCS5_PBE_SET 202 1267#define ASN1_F_PKCS5_PBE_SET 202
1201#define ASN1_F_SMIME_READ_ASN1 210 1268#define ASN1_F_PKCS5_PBE_SET0_ALGOR 215
1202#define ASN1_F_SMIME_TEXT 211 1269#define ASN1_F_SMIME_READ_ASN1 212
1270#define ASN1_F_SMIME_TEXT 213
1203#define ASN1_F_X509_CINF_NEW 168 1271#define ASN1_F_X509_CINF_NEW 168
1204#define ASN1_F_X509_CRL_ADD0_REVOKED 169 1272#define ASN1_F_X509_CRL_ADD0_REVOKED 169
1205#define ASN1_F_X509_INFO_NEW 170 1273#define ASN1_F_X509_INFO_NEW 170
@@ -1211,14 +1279,14 @@ void ERR_load_ASN1_strings(void);
1211 1279
1212/* Reason codes. */ 1280/* Reason codes. */
1213#define ASN1_R_ADDING_OBJECT 171 1281#define ASN1_R_ADDING_OBJECT 171
1214#define ASN1_R_ASN1_PARSE_ERROR 198 1282#define ASN1_R_ASN1_PARSE_ERROR 203
1215#define ASN1_R_ASN1_SIG_PARSE_ERROR 199 1283#define ASN1_R_ASN1_SIG_PARSE_ERROR 204
1216#define ASN1_R_AUX_ERROR 100 1284#define ASN1_R_AUX_ERROR 100
1217#define ASN1_R_BAD_CLASS 101 1285#define ASN1_R_BAD_CLASS 101
1218#define ASN1_R_BAD_OBJECT_HEADER 102 1286#define ASN1_R_BAD_OBJECT_HEADER 102
1219#define ASN1_R_BAD_PASSWORD_READ 103 1287#define ASN1_R_BAD_PASSWORD_READ 103
1220#define ASN1_R_BAD_TAG 104 1288#define ASN1_R_BAD_TAG 104
1221#define ASN1_R_BMPSTRING_IS_WRONG_LENGTH 210 1289#define ASN1_R_BMPSTRING_IS_WRONG_LENGTH 214
1222#define ASN1_R_BN_LIB 105 1290#define ASN1_R_BN_LIB 105
1223#define ASN1_R_BOOLEAN_IS_WRONG_LENGTH 106 1291#define ASN1_R_BOOLEAN_IS_WRONG_LENGTH 106
1224#define ASN1_R_BUFFER_TOO_SMALL 107 1292#define ASN1_R_BUFFER_TOO_SMALL 107
@@ -1227,6 +1295,7 @@ void ERR_load_ASN1_strings(void);
1227#define ASN1_R_DECODE_ERROR 110 1295#define ASN1_R_DECODE_ERROR 110
1228#define ASN1_R_DECODING_ERROR 111 1296#define ASN1_R_DECODING_ERROR 111
1229#define ASN1_R_DEPTH_EXCEEDED 174 1297#define ASN1_R_DEPTH_EXCEEDED 174
1298#define ASN1_R_DIGEST_AND_KEY_TYPE_NOT_SUPPORTED 198
1230#define ASN1_R_ENCODE_ERROR 112 1299#define ASN1_R_ENCODE_ERROR 112
1231#define ASN1_R_ERROR_GETTING_TIME 173 1300#define ASN1_R_ERROR_GETTING_TIME 173
1232#define ASN1_R_ERROR_LOADING_SECTION 172 1301#define ASN1_R_ERROR_LOADING_SECTION 172
@@ -1260,9 +1329,10 @@ void ERR_load_ASN1_strings(void);
1260#define ASN1_R_INTEGER_TOO_LARGE_FOR_LONG 128 1329#define ASN1_R_INTEGER_TOO_LARGE_FOR_LONG 128
1261#define ASN1_R_INVALID_BMPSTRING_LENGTH 129 1330#define ASN1_R_INVALID_BMPSTRING_LENGTH 129
1262#define ASN1_R_INVALID_DIGIT 130 1331#define ASN1_R_INVALID_DIGIT 130
1263#define ASN1_R_INVALID_MIME_TYPE 200 1332#define ASN1_R_INVALID_MIME_TYPE 205
1264#define ASN1_R_INVALID_MODIFIER 186 1333#define ASN1_R_INVALID_MODIFIER 186
1265#define ASN1_R_INVALID_NUMBER 187 1334#define ASN1_R_INVALID_NUMBER 187
1335#define ASN1_R_INVALID_OBJECT_ENCODING 216
1266#define ASN1_R_INVALID_SEPARATOR 131 1336#define ASN1_R_INVALID_SEPARATOR 131
1267#define ASN1_R_INVALID_TIME_FORMAT 132 1337#define ASN1_R_INVALID_TIME_FORMAT 132
1268#define ASN1_R_INVALID_UNIVERSALSTRING_LENGTH 133 1338#define ASN1_R_INVALID_UNIVERSALSTRING_LENGTH 133
@@ -1270,9 +1340,9 @@ void ERR_load_ASN1_strings(void);
1270#define ASN1_R_IV_TOO_LARGE 135 1340#define ASN1_R_IV_TOO_LARGE 135
1271#define ASN1_R_LENGTH_ERROR 136 1341#define ASN1_R_LENGTH_ERROR 136
1272#define ASN1_R_LIST_ERROR 188 1342#define ASN1_R_LIST_ERROR 188
1273#define ASN1_R_MIME_NO_CONTENT_TYPE 201 1343#define ASN1_R_MIME_NO_CONTENT_TYPE 206
1274#define ASN1_R_MIME_PARSE_ERROR 202 1344#define ASN1_R_MIME_PARSE_ERROR 207
1275#define ASN1_R_MIME_SIG_PARSE_ERROR 203 1345#define ASN1_R_MIME_SIG_PARSE_ERROR 208
1276#define ASN1_R_MISSING_EOC 137 1346#define ASN1_R_MISSING_EOC 137
1277#define ASN1_R_MISSING_SECOND_NUMBER 138 1347#define ASN1_R_MISSING_SECOND_NUMBER 138
1278#define ASN1_R_MISSING_VALUE 189 1348#define ASN1_R_MISSING_VALUE 189
@@ -1282,11 +1352,12 @@ void ERR_load_ASN1_strings(void);
1282#define ASN1_R_NON_HEX_CHARACTERS 141 1352#define ASN1_R_NON_HEX_CHARACTERS 141
1283#define ASN1_R_NOT_ASCII_FORMAT 190 1353#define ASN1_R_NOT_ASCII_FORMAT 190
1284#define ASN1_R_NOT_ENOUGH_DATA 142 1354#define ASN1_R_NOT_ENOUGH_DATA 142
1285#define ASN1_R_NO_CONTENT_TYPE 204 1355#define ASN1_R_NO_CONTENT_TYPE 209
1356#define ASN1_R_NO_DEFAULT_DIGEST 201
1286#define ASN1_R_NO_MATCHING_CHOICE_TYPE 143 1357#define ASN1_R_NO_MATCHING_CHOICE_TYPE 143
1287#define ASN1_R_NO_MULTIPART_BODY_FAILURE 205 1358#define ASN1_R_NO_MULTIPART_BODY_FAILURE 210
1288#define ASN1_R_NO_MULTIPART_BOUNDARY 206 1359#define ASN1_R_NO_MULTIPART_BOUNDARY 211
1289#define ASN1_R_NO_SIG_CONTENT_TYPE 207 1360#define ASN1_R_NO_SIG_CONTENT_TYPE 212
1290#define ASN1_R_NULL_IS_WRONG_LENGTH 144 1361#define ASN1_R_NULL_IS_WRONG_LENGTH 144
1291#define ASN1_R_OBJECT_NOT_ASCII_FORMAT 191 1362#define ASN1_R_OBJECT_NOT_ASCII_FORMAT 191
1292#define ASN1_R_ODD_NUMBER_OF_CHARS 145 1363#define ASN1_R_ODD_NUMBER_OF_CHARS 145
@@ -1296,8 +1367,8 @@ void ERR_load_ASN1_strings(void);
1296#define ASN1_R_SEQUENCE_NOT_CONSTRUCTED 149 1367#define ASN1_R_SEQUENCE_NOT_CONSTRUCTED 149
1297#define ASN1_R_SEQUENCE_OR_SET_NEEDS_CONFIG 192 1368#define ASN1_R_SEQUENCE_OR_SET_NEEDS_CONFIG 192
1298#define ASN1_R_SHORT_LINE 150 1369#define ASN1_R_SHORT_LINE 150
1299#define ASN1_R_SIG_INVALID_MIME_TYPE 208 1370#define ASN1_R_SIG_INVALID_MIME_TYPE 213
1300#define ASN1_R_STREAMING_NOT_SUPPORTED 209 1371#define ASN1_R_STREAMING_NOT_SUPPORTED 202
1301#define ASN1_R_STRING_TOO_LONG 151 1372#define ASN1_R_STRING_TOO_LONG 151
1302#define ASN1_R_STRING_TOO_SHORT 152 1373#define ASN1_R_STRING_TOO_SHORT 152
1303#define ASN1_R_TAG_VALUE_TOO_HIGH 153 1374#define ASN1_R_TAG_VALUE_TOO_HIGH 153
@@ -1308,11 +1379,12 @@ void ERR_load_ASN1_strings(void);
1308#define ASN1_R_UNABLE_TO_DECODE_RSA_KEY 157 1379#define ASN1_R_UNABLE_TO_DECODE_RSA_KEY 157
1309#define ASN1_R_UNABLE_TO_DECODE_RSA_PRIVATE_KEY 158 1380#define ASN1_R_UNABLE_TO_DECODE_RSA_PRIVATE_KEY 158
1310#define ASN1_R_UNEXPECTED_EOC 159 1381#define ASN1_R_UNEXPECTED_EOC 159
1311#define ASN1_R_UNIVERSALSTRING_IS_WRONG_LENGTH 211 1382#define ASN1_R_UNIVERSALSTRING_IS_WRONG_LENGTH 215
1312#define ASN1_R_UNKNOWN_FORMAT 160 1383#define ASN1_R_UNKNOWN_FORMAT 160
1313#define ASN1_R_UNKNOWN_MESSAGE_DIGEST_ALGORITHM 161 1384#define ASN1_R_UNKNOWN_MESSAGE_DIGEST_ALGORITHM 161
1314#define ASN1_R_UNKNOWN_OBJECT_TYPE 162 1385#define ASN1_R_UNKNOWN_OBJECT_TYPE 162
1315#define ASN1_R_UNKNOWN_PUBLIC_KEY_TYPE 163 1386#define ASN1_R_UNKNOWN_PUBLIC_KEY_TYPE 163
1387#define ASN1_R_UNKNOWN_SIGNATURE_ALGORITHM 199
1316#define ASN1_R_UNKNOWN_TAG 194 1388#define ASN1_R_UNKNOWN_TAG 194
1317#define ASN1_R_UNKOWN_FORMAT 195 1389#define ASN1_R_UNKOWN_FORMAT 195
1318#define ASN1_R_UNSUPPORTED_ANY_DEFINED_BY_TYPE 164 1390#define ASN1_R_UNSUPPORTED_ANY_DEFINED_BY_TYPE 164
@@ -1320,6 +1392,7 @@ void ERR_load_ASN1_strings(void);
1320#define ASN1_R_UNSUPPORTED_ENCRYPTION_ALGORITHM 166 1392#define ASN1_R_UNSUPPORTED_ENCRYPTION_ALGORITHM 166
1321#define ASN1_R_UNSUPPORTED_PUBLIC_KEY_TYPE 167 1393#define ASN1_R_UNSUPPORTED_PUBLIC_KEY_TYPE 167
1322#define ASN1_R_UNSUPPORTED_TYPE 196 1394#define ASN1_R_UNSUPPORTED_TYPE 196
1395#define ASN1_R_WRONG_PUBLIC_KEY_TYPE 200
1323#define ASN1_R_WRONG_TAG 168 1396#define ASN1_R_WRONG_TAG 168
1324#define ASN1_R_WRONG_TYPE 169 1397#define ASN1_R_WRONG_TYPE 169
1325 1398
diff --git a/src/lib/libcrypto/asn1/asn1_err.c b/src/lib/libcrypto/asn1/asn1_err.c
index 5f5de98eed..6e04d08f31 100644
--- a/src/lib/libcrypto/asn1/asn1_err.c
+++ b/src/lib/libcrypto/asn1/asn1_err.c
@@ -1,6 +1,6 @@
1/* crypto/asn1/asn1_err.c */ 1/* crypto/asn1/asn1_err.c */
2/* ==================================================================== 2/* ====================================================================
3 * Copyright (c) 1999-2008 The OpenSSL Project. All rights reserved. 3 * Copyright (c) 1999-2009 The OpenSSL Project. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
@@ -90,10 +90,11 @@ static ERR_STRING_DATA ASN1_str_functs[]=
90{ERR_FUNC(ASN1_F_ASN1_ENUMERATED_TO_BN), "ASN1_ENUMERATED_to_BN"}, 90{ERR_FUNC(ASN1_F_ASN1_ENUMERATED_TO_BN), "ASN1_ENUMERATED_to_BN"},
91{ERR_FUNC(ASN1_F_ASN1_EX_C2I), "ASN1_EX_C2I"}, 91{ERR_FUNC(ASN1_F_ASN1_EX_C2I), "ASN1_EX_C2I"},
92{ERR_FUNC(ASN1_F_ASN1_FIND_END), "ASN1_FIND_END"}, 92{ERR_FUNC(ASN1_F_ASN1_FIND_END), "ASN1_FIND_END"},
93{ERR_FUNC(ASN1_F_ASN1_GENERALIZEDTIME_ADJ), "ASN1_GENERALIZEDTIME_adj"},
93{ERR_FUNC(ASN1_F_ASN1_GENERALIZEDTIME_SET), "ASN1_GENERALIZEDTIME_set"}, 94{ERR_FUNC(ASN1_F_ASN1_GENERALIZEDTIME_SET), "ASN1_GENERALIZEDTIME_set"},
94{ERR_FUNC(ASN1_F_ASN1_GENERATE_V3), "ASN1_generate_v3"}, 95{ERR_FUNC(ASN1_F_ASN1_GENERATE_V3), "ASN1_generate_v3"},
95{ERR_FUNC(ASN1_F_ASN1_GET_OBJECT), "ASN1_get_object"}, 96{ERR_FUNC(ASN1_F_ASN1_GET_OBJECT), "ASN1_get_object"},
96{ERR_FUNC(ASN1_F_ASN1_HEADER_NEW), "ASN1_HEADER_new"}, 97{ERR_FUNC(ASN1_F_ASN1_HEADER_NEW), "ASN1_HEADER_NEW"},
97{ERR_FUNC(ASN1_F_ASN1_I2D_BIO), "ASN1_i2d_bio"}, 98{ERR_FUNC(ASN1_F_ASN1_I2D_BIO), "ASN1_i2d_bio"},
98{ERR_FUNC(ASN1_F_ASN1_I2D_FP), "ASN1_i2d_fp"}, 99{ERR_FUNC(ASN1_F_ASN1_I2D_FP), "ASN1_i2d_fp"},
99{ERR_FUNC(ASN1_F_ASN1_INTEGER_SET), "ASN1_INTEGER_set"}, 100{ERR_FUNC(ASN1_F_ASN1_INTEGER_SET), "ASN1_INTEGER_set"},
@@ -112,7 +113,7 @@ static ERR_STRING_DATA ASN1_str_functs[]=
112{ERR_FUNC(ASN1_F_ASN1_OBJECT_NEW), "ASN1_OBJECT_new"}, 113{ERR_FUNC(ASN1_F_ASN1_OBJECT_NEW), "ASN1_OBJECT_new"},
113{ERR_FUNC(ASN1_F_ASN1_OUTPUT_DATA), "ASN1_OUTPUT_DATA"}, 114{ERR_FUNC(ASN1_F_ASN1_OUTPUT_DATA), "ASN1_OUTPUT_DATA"},
114{ERR_FUNC(ASN1_F_ASN1_PACK_STRING), "ASN1_pack_string"}, 115{ERR_FUNC(ASN1_F_ASN1_PACK_STRING), "ASN1_pack_string"},
115{ERR_FUNC(ASN1_F_ASN1_PCTX_NEW), "ASN1_PCTX_NEW"}, 116{ERR_FUNC(ASN1_F_ASN1_PCTX_NEW), "ASN1_PCTX_new"},
116{ERR_FUNC(ASN1_F_ASN1_PKCS5_PBE_SET), "ASN1_PKCS5_PBE_SET"}, 117{ERR_FUNC(ASN1_F_ASN1_PKCS5_PBE_SET), "ASN1_PKCS5_PBE_SET"},
117{ERR_FUNC(ASN1_F_ASN1_SEQ_PACK), "ASN1_seq_pack"}, 118{ERR_FUNC(ASN1_F_ASN1_SEQ_PACK), "ASN1_seq_pack"},
118{ERR_FUNC(ASN1_F_ASN1_SEQ_UNPACK), "ASN1_seq_unpack"}, 119{ERR_FUNC(ASN1_F_ASN1_SEQ_UNPACK), "ASN1_seq_unpack"},
@@ -124,14 +125,17 @@ static ERR_STRING_DATA ASN1_str_functs[]=
124{ERR_FUNC(ASN1_F_ASN1_TEMPLATE_EX_D2I), "ASN1_TEMPLATE_EX_D2I"}, 125{ERR_FUNC(ASN1_F_ASN1_TEMPLATE_EX_D2I), "ASN1_TEMPLATE_EX_D2I"},
125{ERR_FUNC(ASN1_F_ASN1_TEMPLATE_NEW), "ASN1_TEMPLATE_NEW"}, 126{ERR_FUNC(ASN1_F_ASN1_TEMPLATE_NEW), "ASN1_TEMPLATE_NEW"},
126{ERR_FUNC(ASN1_F_ASN1_TEMPLATE_NOEXP_D2I), "ASN1_TEMPLATE_NOEXP_D2I"}, 127{ERR_FUNC(ASN1_F_ASN1_TEMPLATE_NOEXP_D2I), "ASN1_TEMPLATE_NOEXP_D2I"},
128{ERR_FUNC(ASN1_F_ASN1_TIME_ADJ), "ASN1_TIME_adj"},
127{ERR_FUNC(ASN1_F_ASN1_TIME_SET), "ASN1_TIME_set"}, 129{ERR_FUNC(ASN1_F_ASN1_TIME_SET), "ASN1_TIME_set"},
128{ERR_FUNC(ASN1_F_ASN1_TYPE_GET_INT_OCTETSTRING), "ASN1_TYPE_get_int_octetstring"}, 130{ERR_FUNC(ASN1_F_ASN1_TYPE_GET_INT_OCTETSTRING), "ASN1_TYPE_get_int_octetstring"},
129{ERR_FUNC(ASN1_F_ASN1_TYPE_GET_OCTETSTRING), "ASN1_TYPE_get_octetstring"}, 131{ERR_FUNC(ASN1_F_ASN1_TYPE_GET_OCTETSTRING), "ASN1_TYPE_get_octetstring"},
130{ERR_FUNC(ASN1_F_ASN1_UNPACK_STRING), "ASN1_unpack_string"}, 132{ERR_FUNC(ASN1_F_ASN1_UNPACK_STRING), "ASN1_unpack_string"},
133{ERR_FUNC(ASN1_F_ASN1_UTCTIME_ADJ), "ASN1_UTCTIME_adj"},
131{ERR_FUNC(ASN1_F_ASN1_UTCTIME_SET), "ASN1_UTCTIME_set"}, 134{ERR_FUNC(ASN1_F_ASN1_UTCTIME_SET), "ASN1_UTCTIME_set"},
132{ERR_FUNC(ASN1_F_ASN1_VERIFY), "ASN1_verify"}, 135{ERR_FUNC(ASN1_F_ASN1_VERIFY), "ASN1_verify"},
133{ERR_FUNC(ASN1_F_B64_READ_ASN1), "B64_READ_ASN1"}, 136{ERR_FUNC(ASN1_F_B64_READ_ASN1), "B64_READ_ASN1"},
134{ERR_FUNC(ASN1_F_B64_WRITE_ASN1), "B64_WRITE_ASN1"}, 137{ERR_FUNC(ASN1_F_B64_WRITE_ASN1), "B64_WRITE_ASN1"},
138{ERR_FUNC(ASN1_F_BIO_NEW_NDEF), "BIO_new_NDEF"},
135{ERR_FUNC(ASN1_F_BITSTR_CB), "BITSTR_CB"}, 139{ERR_FUNC(ASN1_F_BITSTR_CB), "BITSTR_CB"},
136{ERR_FUNC(ASN1_F_BN_TO_ASN1_ENUMERATED), "BN_to_ASN1_ENUMERATED"}, 140{ERR_FUNC(ASN1_F_BN_TO_ASN1_ENUMERATED), "BN_to_ASN1_ENUMERATED"},
137{ERR_FUNC(ASN1_F_BN_TO_ASN1_INTEGER), "BN_to_ASN1_INTEGER"}, 141{ERR_FUNC(ASN1_F_BN_TO_ASN1_INTEGER), "BN_to_ASN1_INTEGER"},
@@ -143,13 +147,14 @@ static ERR_STRING_DATA ASN1_str_functs[]=
143{ERR_FUNC(ASN1_F_D2I_ASN1_BOOLEAN), "d2i_ASN1_BOOLEAN"}, 147{ERR_FUNC(ASN1_F_D2I_ASN1_BOOLEAN), "d2i_ASN1_BOOLEAN"},
144{ERR_FUNC(ASN1_F_D2I_ASN1_BYTES), "d2i_ASN1_bytes"}, 148{ERR_FUNC(ASN1_F_D2I_ASN1_BYTES), "d2i_ASN1_bytes"},
145{ERR_FUNC(ASN1_F_D2I_ASN1_GENERALIZEDTIME), "D2I_ASN1_GENERALIZEDTIME"}, 149{ERR_FUNC(ASN1_F_D2I_ASN1_GENERALIZEDTIME), "D2I_ASN1_GENERALIZEDTIME"},
146{ERR_FUNC(ASN1_F_D2I_ASN1_HEADER), "d2i_ASN1_HEADER"}, 150{ERR_FUNC(ASN1_F_D2I_ASN1_HEADER), "D2I_ASN1_HEADER"},
147{ERR_FUNC(ASN1_F_D2I_ASN1_INTEGER), "D2I_ASN1_INTEGER"}, 151{ERR_FUNC(ASN1_F_D2I_ASN1_INTEGER), "D2I_ASN1_INTEGER"},
148{ERR_FUNC(ASN1_F_D2I_ASN1_OBJECT), "d2i_ASN1_OBJECT"}, 152{ERR_FUNC(ASN1_F_D2I_ASN1_OBJECT), "d2i_ASN1_OBJECT"},
149{ERR_FUNC(ASN1_F_D2I_ASN1_SET), "d2i_ASN1_SET"}, 153{ERR_FUNC(ASN1_F_D2I_ASN1_SET), "d2i_ASN1_SET"},
150{ERR_FUNC(ASN1_F_D2I_ASN1_TYPE_BYTES), "d2i_ASN1_type_bytes"}, 154{ERR_FUNC(ASN1_F_D2I_ASN1_TYPE_BYTES), "d2i_ASN1_type_bytes"},
151{ERR_FUNC(ASN1_F_D2I_ASN1_UINTEGER), "d2i_ASN1_UINTEGER"}, 155{ERR_FUNC(ASN1_F_D2I_ASN1_UINTEGER), "d2i_ASN1_UINTEGER"},
152{ERR_FUNC(ASN1_F_D2I_ASN1_UTCTIME), "D2I_ASN1_UTCTIME"}, 156{ERR_FUNC(ASN1_F_D2I_ASN1_UTCTIME), "D2I_ASN1_UTCTIME"},
157{ERR_FUNC(ASN1_F_D2I_AUTOPRIVATEKEY), "d2i_AutoPrivateKey"},
153{ERR_FUNC(ASN1_F_D2I_NETSCAPE_RSA), "d2i_Netscape_RSA"}, 158{ERR_FUNC(ASN1_F_D2I_NETSCAPE_RSA), "d2i_Netscape_RSA"},
154{ERR_FUNC(ASN1_F_D2I_NETSCAPE_RSA_2), "D2I_NETSCAPE_RSA_2"}, 159{ERR_FUNC(ASN1_F_D2I_NETSCAPE_RSA_2), "D2I_NETSCAPE_RSA_2"},
155{ERR_FUNC(ASN1_F_D2I_PRIVATEKEY), "d2i_PrivateKey"}, 160{ERR_FUNC(ASN1_F_D2I_PRIVATEKEY), "d2i_PrivateKey"},
@@ -159,6 +164,7 @@ static ERR_STRING_DATA ASN1_str_functs[]=
159{ERR_FUNC(ASN1_F_D2I_X509), "D2I_X509"}, 164{ERR_FUNC(ASN1_F_D2I_X509), "D2I_X509"},
160{ERR_FUNC(ASN1_F_D2I_X509_CINF), "D2I_X509_CINF"}, 165{ERR_FUNC(ASN1_F_D2I_X509_CINF), "D2I_X509_CINF"},
161{ERR_FUNC(ASN1_F_D2I_X509_PKEY), "d2i_X509_PKEY"}, 166{ERR_FUNC(ASN1_F_D2I_X509_PKEY), "d2i_X509_PKEY"},
167{ERR_FUNC(ASN1_F_I2D_ASN1_BIO_STREAM), "i2d_ASN1_bio_stream"},
162{ERR_FUNC(ASN1_F_I2D_ASN1_SET), "i2d_ASN1_SET"}, 168{ERR_FUNC(ASN1_F_I2D_ASN1_SET), "i2d_ASN1_SET"},
163{ERR_FUNC(ASN1_F_I2D_ASN1_TIME), "I2D_ASN1_TIME"}, 169{ERR_FUNC(ASN1_F_I2D_ASN1_TIME), "I2D_ASN1_TIME"},
164{ERR_FUNC(ASN1_F_I2D_DSA_PUBKEY), "i2d_DSA_PUBKEY"}, 170{ERR_FUNC(ASN1_F_I2D_DSA_PUBKEY), "i2d_DSA_PUBKEY"},
@@ -170,8 +176,9 @@ static ERR_STRING_DATA ASN1_str_functs[]=
170{ERR_FUNC(ASN1_F_LONG_C2I), "LONG_C2I"}, 176{ERR_FUNC(ASN1_F_LONG_C2I), "LONG_C2I"},
171{ERR_FUNC(ASN1_F_OID_MODULE_INIT), "OID_MODULE_INIT"}, 177{ERR_FUNC(ASN1_F_OID_MODULE_INIT), "OID_MODULE_INIT"},
172{ERR_FUNC(ASN1_F_PARSE_TAGGING), "PARSE_TAGGING"}, 178{ERR_FUNC(ASN1_F_PARSE_TAGGING), "PARSE_TAGGING"},
173{ERR_FUNC(ASN1_F_PKCS5_PBE2_SET), "PKCS5_pbe2_set"}, 179{ERR_FUNC(ASN1_F_PKCS5_PBE2_SET_IV), "PKCS5_pbe2_set_iv"},
174{ERR_FUNC(ASN1_F_PKCS5_PBE_SET), "PKCS5_pbe_set"}, 180{ERR_FUNC(ASN1_F_PKCS5_PBE_SET), "PKCS5_pbe_set"},
181{ERR_FUNC(ASN1_F_PKCS5_PBE_SET0_ALGOR), "PKCS5_pbe_set0_algor"},
175{ERR_FUNC(ASN1_F_SMIME_READ_ASN1), "SMIME_read_ASN1"}, 182{ERR_FUNC(ASN1_F_SMIME_READ_ASN1), "SMIME_read_ASN1"},
176{ERR_FUNC(ASN1_F_SMIME_TEXT), "SMIME_text"}, 183{ERR_FUNC(ASN1_F_SMIME_TEXT), "SMIME_text"},
177{ERR_FUNC(ASN1_F_X509_CINF_NEW), "X509_CINF_NEW"}, 184{ERR_FUNC(ASN1_F_X509_CINF_NEW), "X509_CINF_NEW"},
@@ -204,6 +211,7 @@ static ERR_STRING_DATA ASN1_str_reasons[]=
204{ERR_REASON(ASN1_R_DECODE_ERROR) ,"decode error"}, 211{ERR_REASON(ASN1_R_DECODE_ERROR) ,"decode error"},
205{ERR_REASON(ASN1_R_DECODING_ERROR) ,"decoding error"}, 212{ERR_REASON(ASN1_R_DECODING_ERROR) ,"decoding error"},
206{ERR_REASON(ASN1_R_DEPTH_EXCEEDED) ,"depth exceeded"}, 213{ERR_REASON(ASN1_R_DEPTH_EXCEEDED) ,"depth exceeded"},
214{ERR_REASON(ASN1_R_DIGEST_AND_KEY_TYPE_NOT_SUPPORTED),"digest and key type not supported"},
207{ERR_REASON(ASN1_R_ENCODE_ERROR) ,"encode error"}, 215{ERR_REASON(ASN1_R_ENCODE_ERROR) ,"encode error"},
208{ERR_REASON(ASN1_R_ERROR_GETTING_TIME) ,"error getting time"}, 216{ERR_REASON(ASN1_R_ERROR_GETTING_TIME) ,"error getting time"},
209{ERR_REASON(ASN1_R_ERROR_LOADING_SECTION),"error loading section"}, 217{ERR_REASON(ASN1_R_ERROR_LOADING_SECTION),"error loading section"},
@@ -240,6 +248,7 @@ static ERR_STRING_DATA ASN1_str_reasons[]=
240{ERR_REASON(ASN1_R_INVALID_MIME_TYPE) ,"invalid mime type"}, 248{ERR_REASON(ASN1_R_INVALID_MIME_TYPE) ,"invalid mime type"},
241{ERR_REASON(ASN1_R_INVALID_MODIFIER) ,"invalid modifier"}, 249{ERR_REASON(ASN1_R_INVALID_MODIFIER) ,"invalid modifier"},
242{ERR_REASON(ASN1_R_INVALID_NUMBER) ,"invalid number"}, 250{ERR_REASON(ASN1_R_INVALID_NUMBER) ,"invalid number"},
251{ERR_REASON(ASN1_R_INVALID_OBJECT_ENCODING),"invalid object encoding"},
243{ERR_REASON(ASN1_R_INVALID_SEPARATOR) ,"invalid separator"}, 252{ERR_REASON(ASN1_R_INVALID_SEPARATOR) ,"invalid separator"},
244{ERR_REASON(ASN1_R_INVALID_TIME_FORMAT) ,"invalid time format"}, 253{ERR_REASON(ASN1_R_INVALID_TIME_FORMAT) ,"invalid time format"},
245{ERR_REASON(ASN1_R_INVALID_UNIVERSALSTRING_LENGTH),"invalid universalstring length"}, 254{ERR_REASON(ASN1_R_INVALID_UNIVERSALSTRING_LENGTH),"invalid universalstring length"},
@@ -260,6 +269,7 @@ static ERR_STRING_DATA ASN1_str_reasons[]=
260{ERR_REASON(ASN1_R_NOT_ASCII_FORMAT) ,"not ascii format"}, 269{ERR_REASON(ASN1_R_NOT_ASCII_FORMAT) ,"not ascii format"},
261{ERR_REASON(ASN1_R_NOT_ENOUGH_DATA) ,"not enough data"}, 270{ERR_REASON(ASN1_R_NOT_ENOUGH_DATA) ,"not enough data"},
262{ERR_REASON(ASN1_R_NO_CONTENT_TYPE) ,"no content type"}, 271{ERR_REASON(ASN1_R_NO_CONTENT_TYPE) ,"no content type"},
272{ERR_REASON(ASN1_R_NO_DEFAULT_DIGEST) ,"no default digest"},
263{ERR_REASON(ASN1_R_NO_MATCHING_CHOICE_TYPE),"no matching choice type"}, 273{ERR_REASON(ASN1_R_NO_MATCHING_CHOICE_TYPE),"no matching choice type"},
264{ERR_REASON(ASN1_R_NO_MULTIPART_BODY_FAILURE),"no multipart body failure"}, 274{ERR_REASON(ASN1_R_NO_MULTIPART_BODY_FAILURE),"no multipart body failure"},
265{ERR_REASON(ASN1_R_NO_MULTIPART_BOUNDARY),"no multipart boundary"}, 275{ERR_REASON(ASN1_R_NO_MULTIPART_BOUNDARY),"no multipart boundary"},
@@ -290,6 +300,7 @@ static ERR_STRING_DATA ASN1_str_reasons[]=
290{ERR_REASON(ASN1_R_UNKNOWN_MESSAGE_DIGEST_ALGORITHM),"unknown message digest algorithm"}, 300{ERR_REASON(ASN1_R_UNKNOWN_MESSAGE_DIGEST_ALGORITHM),"unknown message digest algorithm"},
291{ERR_REASON(ASN1_R_UNKNOWN_OBJECT_TYPE) ,"unknown object type"}, 301{ERR_REASON(ASN1_R_UNKNOWN_OBJECT_TYPE) ,"unknown object type"},
292{ERR_REASON(ASN1_R_UNKNOWN_PUBLIC_KEY_TYPE),"unknown public key type"}, 302{ERR_REASON(ASN1_R_UNKNOWN_PUBLIC_KEY_TYPE),"unknown public key type"},
303{ERR_REASON(ASN1_R_UNKNOWN_SIGNATURE_ALGORITHM),"unknown signature algorithm"},
293{ERR_REASON(ASN1_R_UNKNOWN_TAG) ,"unknown tag"}, 304{ERR_REASON(ASN1_R_UNKNOWN_TAG) ,"unknown tag"},
294{ERR_REASON(ASN1_R_UNKOWN_FORMAT) ,"unkown format"}, 305{ERR_REASON(ASN1_R_UNKOWN_FORMAT) ,"unkown format"},
295{ERR_REASON(ASN1_R_UNSUPPORTED_ANY_DEFINED_BY_TYPE),"unsupported any defined by type"}, 306{ERR_REASON(ASN1_R_UNSUPPORTED_ANY_DEFINED_BY_TYPE),"unsupported any defined by type"},
@@ -297,6 +308,7 @@ static ERR_STRING_DATA ASN1_str_reasons[]=
297{ERR_REASON(ASN1_R_UNSUPPORTED_ENCRYPTION_ALGORITHM),"unsupported encryption algorithm"}, 308{ERR_REASON(ASN1_R_UNSUPPORTED_ENCRYPTION_ALGORITHM),"unsupported encryption algorithm"},
298{ERR_REASON(ASN1_R_UNSUPPORTED_PUBLIC_KEY_TYPE),"unsupported public key type"}, 309{ERR_REASON(ASN1_R_UNSUPPORTED_PUBLIC_KEY_TYPE),"unsupported public key type"},
299{ERR_REASON(ASN1_R_UNSUPPORTED_TYPE) ,"unsupported type"}, 310{ERR_REASON(ASN1_R_UNSUPPORTED_TYPE) ,"unsupported type"},
311{ERR_REASON(ASN1_R_WRONG_PUBLIC_KEY_TYPE),"wrong public key type"},
300{ERR_REASON(ASN1_R_WRONG_TAG) ,"wrong tag"}, 312{ERR_REASON(ASN1_R_WRONG_TAG) ,"wrong tag"},
301{ERR_REASON(ASN1_R_WRONG_TYPE) ,"wrong type"}, 313{ERR_REASON(ASN1_R_WRONG_TYPE) ,"wrong type"},
302{0,NULL} 314{0,NULL}
diff --git a/src/lib/libcrypto/asn1/asn1_lib.c b/src/lib/libcrypto/asn1/asn1_lib.c
index 5af559ef8d..1bcb44aee2 100644
--- a/src/lib/libcrypto/asn1/asn1_lib.c
+++ b/src/lib/libcrypto/asn1/asn1_lib.c
@@ -340,20 +340,31 @@ int asn1_GetSequence(ASN1_const_CTX *c, long *length)
340 return(1); 340 return(1);
341 } 341 }
342 342
343ASN1_STRING *ASN1_STRING_dup(ASN1_STRING *str) 343int ASN1_STRING_copy(ASN1_STRING *dst, const ASN1_STRING *str)
344 { 344 {
345 ASN1_STRING *ret; 345 if (str == NULL)
346 return 0;
347 dst->type = str->type;
348 if (!ASN1_STRING_set(dst,str->data,str->length))
349 return 0;
350 dst->flags = str->flags;
351 return 1;
352 }
346 353
347 if (str == NULL) return(NULL); 354ASN1_STRING *ASN1_STRING_dup(const ASN1_STRING *str)
348 if ((ret=ASN1_STRING_type_new(str->type)) == NULL) 355 {
349 return(NULL); 356 ASN1_STRING *ret;
350 if (!ASN1_STRING_set(ret,str->data,str->length)) 357 if (!str)
358 return NULL;
359 ret=ASN1_STRING_new();
360 if (!ret)
361 return NULL;
362 if (!ASN1_STRING_copy(ret,str))
351 { 363 {
352 ASN1_STRING_free(ret); 364 ASN1_STRING_free(ret);
353 return(NULL); 365 return NULL;
354 } 366 }
355 ret->flags = str->flags; 367 return ret;
356 return(ret);
357 } 368 }
358 369
359int ASN1_STRING_set(ASN1_STRING *str, const void *_data, int len) 370int ASN1_STRING_set(ASN1_STRING *str, const void *_data, int len)
@@ -427,11 +438,12 @@ ASN1_STRING *ASN1_STRING_type_new(int type)
427void ASN1_STRING_free(ASN1_STRING *a) 438void ASN1_STRING_free(ASN1_STRING *a)
428 { 439 {
429 if (a == NULL) return; 440 if (a == NULL) return;
430 if (a->data != NULL) OPENSSL_free(a->data); 441 if (a->data && !(a->flags & ASN1_STRING_FLAG_NDEF))
442 OPENSSL_free(a->data);
431 OPENSSL_free(a); 443 OPENSSL_free(a);
432 } 444 }
433 445
434int ASN1_STRING_cmp(ASN1_STRING *a, ASN1_STRING *b) 446int ASN1_STRING_cmp(const ASN1_STRING *a, const ASN1_STRING *b)
435 { 447 {
436 int i; 448 int i;
437 449
@@ -457,7 +469,7 @@ void asn1_add_error(const unsigned char *address, int offset)
457 ERR_add_error_data(4,"address=",buf1," offset=",buf2); 469 ERR_add_error_data(4,"address=",buf1," offset=",buf2);
458 } 470 }
459 471
460int ASN1_STRING_length(ASN1_STRING *x) 472int ASN1_STRING_length(const ASN1_STRING *x)
461{ return M_ASN1_STRING_length(x); } 473{ return M_ASN1_STRING_length(x); }
462 474
463void ASN1_STRING_length_set(ASN1_STRING *x, int len) 475void ASN1_STRING_length_set(ASN1_STRING *x, int len)
diff --git a/src/lib/libcrypto/asn1/asn1_mac.h b/src/lib/libcrypto/asn1/asn1_mac.h
index d958ca60d9..87bd0e9e1d 100644
--- a/src/lib/libcrypto/asn1/asn1_mac.h
+++ b/src/lib/libcrypto/asn1/asn1_mac.h
@@ -153,6 +153,13 @@ err:\
153 M_ASN1_D2I_get(b,func); \ 153 M_ASN1_D2I_get(b,func); \
154 } 154 }
155 155
156#define M_ASN1_D2I_get_int_opt(b,func,type) \
157 if ((c.slen != 0) && ((M_ASN1_next & (~V_ASN1_CONSTRUCTED)) \
158 == (V_ASN1_UNIVERSAL|(type)))) \
159 { \
160 M_ASN1_D2I_get_int(b,func); \
161 }
162
156#define M_ASN1_D2I_get_imp(b,func, type) \ 163#define M_ASN1_D2I_get_imp(b,func, type) \
157 M_ASN1_next=(_tmp& V_ASN1_CONSTRUCTED)|type; \ 164 M_ASN1_next=(_tmp& V_ASN1_CONSTRUCTED)|type; \
158 c.q=c.p; \ 165 c.q=c.p; \
diff --git a/src/lib/libcrypto/asn1/asn1_par.c b/src/lib/libcrypto/asn1/asn1_par.c
index 8657f73d66..aaca69aebd 100644
--- a/src/lib/libcrypto/asn1/asn1_par.c
+++ b/src/lib/libcrypto/asn1/asn1_par.c
@@ -70,9 +70,8 @@ static int asn1_print_info(BIO *bp, int tag, int xclass, int constructed,
70 int indent) 70 int indent)
71 { 71 {
72 static const char fmt[]="%-18s"; 72 static const char fmt[]="%-18s";
73 static const char fmt2[]="%2d %-15s";
74 char str[128]; 73 char str[128];
75 const char *p,*p2=NULL; 74 const char *p;
76 75
77 if (constructed & V_ASN1_CONSTRUCTED) 76 if (constructed & V_ASN1_CONSTRUCTED)
78 p="cons: "; 77 p="cons: ";
@@ -93,14 +92,8 @@ static int asn1_print_info(BIO *bp, int tag, int xclass, int constructed,
93 else 92 else
94 p = ASN1_tag2str(tag); 93 p = ASN1_tag2str(tag);
95 94
96 if (p2 != NULL) 95 if (BIO_printf(bp,fmt,p) <= 0)
97 { 96 goto err;
98 if (BIO_printf(bp,fmt2,tag,p2) <= 0) goto err;
99 }
100 else
101 {
102 if (BIO_printf(bp,fmt,p) <= 0) goto err;
103 }
104 return(1); 97 return(1);
105err: 98err:
106 return(0); 99 return(0);
@@ -246,7 +239,7 @@ static int asn1_parse2(BIO *bp, const unsigned char **pp, long length, int offse
246 ii=d2i_ASN1_BOOLEAN(NULL,&opp,len+hl); 239 ii=d2i_ASN1_BOOLEAN(NULL,&opp,len+hl);
247 if (ii < 0) 240 if (ii < 0)
248 { 241 {
249 if (BIO_write(bp,"Bad boolean\n",12)) 242 if (BIO_write(bp,"Bad boolean\n",12) <= 0)
250 goto end; 243 goto end;
251 } 244 }
252 BIO_printf(bp,":%d",ii); 245 BIO_printf(bp,":%d",ii);
@@ -424,7 +417,7 @@ end:
424 417
425const char *ASN1_tag2str(int tag) 418const char *ASN1_tag2str(int tag)
426{ 419{
427 static const char *tag2str[] = { 420 static const char * const tag2str[] = {
428 "EOC", "BOOLEAN", "INTEGER", "BIT STRING", "OCTET STRING", /* 0-4 */ 421 "EOC", "BOOLEAN", "INTEGER", "BIT STRING", "OCTET STRING", /* 0-4 */
429 "NULL", "OBJECT", "OBJECT DESCRIPTOR", "EXTERNAL", "REAL", /* 5-9 */ 422 "NULL", "OBJECT", "OBJECT DESCRIPTOR", "EXTERNAL", "REAL", /* 5-9 */
430 "ENUMERATED", "<ASN1 11>", "UTF8STRING", "<ASN1 13>", /* 10-13 */ 423 "ENUMERATED", "<ASN1 11>", "UTF8STRING", "<ASN1 13>", /* 10-13 */
diff --git a/src/lib/libcrypto/asn1/asn1t.h b/src/lib/libcrypto/asn1/asn1t.h
index ac14f9415b..d230e4bf70 100644
--- a/src/lib/libcrypto/asn1/asn1t.h
+++ b/src/lib/libcrypto/asn1/asn1t.h
@@ -3,7 +3,7 @@
3 * project 2000. 3 * project 2000.
4 */ 4 */
5/* ==================================================================== 5/* ====================================================================
6 * Copyright (c) 2000 The OpenSSL Project. All rights reserved. 6 * Copyright (c) 2000-2005 The OpenSSL Project. All rights reserved.
7 * 7 *
8 * Redistribution and use in source and binary forms, with or without 8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions 9 * modification, are permitted provided that the following conditions
@@ -218,6 +218,18 @@ extern "C" {
218 #stname \ 218 #stname \
219 ASN1_ITEM_end(tname) 219 ASN1_ITEM_end(tname)
220 220
221#define ASN1_NDEF_SEQUENCE_END_cb(stname, tname) \
222 ;\
223 ASN1_ITEM_start(tname) \
224 ASN1_ITYPE_NDEF_SEQUENCE,\
225 V_ASN1_SEQUENCE,\
226 tname##_seq_tt,\
227 sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\
228 &tname##_aux,\
229 sizeof(stname),\
230 #stname \
231 ASN1_ITEM_end(tname)
232
221 233
222/* This pair helps declare a CHOICE type. We can do: 234/* This pair helps declare a CHOICE type. We can do:
223 * 235 *
@@ -651,8 +663,13 @@ typedef int ASN1_ex_i2d(ASN1_VALUE **pval, unsigned char **out, const ASN1_ITEM
651typedef int ASN1_ex_new_func(ASN1_VALUE **pval, const ASN1_ITEM *it); 663typedef int ASN1_ex_new_func(ASN1_VALUE **pval, const ASN1_ITEM *it);
652typedef void ASN1_ex_free_func(ASN1_VALUE **pval, const ASN1_ITEM *it); 664typedef void ASN1_ex_free_func(ASN1_VALUE **pval, const ASN1_ITEM *it);
653 665
666typedef int ASN1_ex_print_func(BIO *out, ASN1_VALUE **pval,
667 int indent, const char *fname,
668 const ASN1_PCTX *pctx);
669
654typedef int ASN1_primitive_i2c(ASN1_VALUE **pval, unsigned char *cont, int *putype, const ASN1_ITEM *it); 670typedef int ASN1_primitive_i2c(ASN1_VALUE **pval, unsigned char *cont, int *putype, const ASN1_ITEM *it);
655typedef int ASN1_primitive_c2i(ASN1_VALUE **pval, const unsigned char *cont, int len, int utype, char *free_cont, const ASN1_ITEM *it); 671typedef int ASN1_primitive_c2i(ASN1_VALUE **pval, const unsigned char *cont, int len, int utype, char *free_cont, const ASN1_ITEM *it);
672typedef int ASN1_primitive_print(BIO *out, ASN1_VALUE **pval, const ASN1_ITEM *it, int indent, const ASN1_PCTX *pctx);
656 673
657typedef struct ASN1_COMPAT_FUNCS_st { 674typedef struct ASN1_COMPAT_FUNCS_st {
658 ASN1_new_func *asn1_new; 675 ASN1_new_func *asn1_new;
@@ -668,6 +685,7 @@ typedef struct ASN1_EXTERN_FUNCS_st {
668 ASN1_ex_free_func *asn1_ex_clear; 685 ASN1_ex_free_func *asn1_ex_clear;
669 ASN1_ex_d2i *asn1_ex_d2i; 686 ASN1_ex_d2i *asn1_ex_d2i;
670 ASN1_ex_i2d *asn1_ex_i2d; 687 ASN1_ex_i2d *asn1_ex_i2d;
688 ASN1_ex_print_func *asn1_ex_print;
671} ASN1_EXTERN_FUNCS; 689} ASN1_EXTERN_FUNCS;
672 690
673typedef struct ASN1_PRIMITIVE_FUNCS_st { 691typedef struct ASN1_PRIMITIVE_FUNCS_st {
@@ -678,6 +696,7 @@ typedef struct ASN1_PRIMITIVE_FUNCS_st {
678 ASN1_ex_free_func *prim_clear; 696 ASN1_ex_free_func *prim_clear;
679 ASN1_primitive_c2i *prim_c2i; 697 ASN1_primitive_c2i *prim_c2i;
680 ASN1_primitive_i2c *prim_i2c; 698 ASN1_primitive_i2c *prim_i2c;
699 ASN1_primitive_print *prim_print;
681} ASN1_PRIMITIVE_FUNCS; 700} ASN1_PRIMITIVE_FUNCS;
682 701
683/* This is the ASN1_AUX structure: it handles various 702/* This is the ASN1_AUX structure: it handles various
@@ -697,7 +716,8 @@ typedef struct ASN1_PRIMITIVE_FUNCS_st {
697 * then an external type is more appropriate. 716 * then an external type is more appropriate.
698 */ 717 */
699 718
700typedef int ASN1_aux_cb(int operation, ASN1_VALUE **in, const ASN1_ITEM *it); 719typedef int ASN1_aux_cb(int operation, ASN1_VALUE **in, const ASN1_ITEM *it,
720 void *exarg);
701 721
702typedef struct ASN1_AUX_st { 722typedef struct ASN1_AUX_st {
703 void *app_data; 723 void *app_data;
@@ -708,6 +728,23 @@ typedef struct ASN1_AUX_st {
708 int enc_offset; /* Offset of ASN1_ENCODING structure */ 728 int enc_offset; /* Offset of ASN1_ENCODING structure */
709} ASN1_AUX; 729} ASN1_AUX;
710 730
731/* For print related callbacks exarg points to this structure */
732typedef struct ASN1_PRINT_ARG_st {
733 BIO *out;
734 int indent;
735 const ASN1_PCTX *pctx;
736} ASN1_PRINT_ARG;
737
738/* For streaming related callbacks exarg points to this structure */
739typedef struct ASN1_STREAM_ARG_st {
740 /* BIO to stream through */
741 BIO *out;
742 /* BIO with filters appended */
743 BIO *ndef_bio;
744 /* Streaming I/O boundary */
745 unsigned char **boundary;
746} ASN1_STREAM_ARG;
747
711/* Flags in ASN1_AUX */ 748/* Flags in ASN1_AUX */
712 749
713/* Use a reference count */ 750/* Use a reference count */
@@ -727,6 +764,12 @@ typedef struct ASN1_AUX_st {
727#define ASN1_OP_D2I_POST 5 764#define ASN1_OP_D2I_POST 5
728#define ASN1_OP_I2D_PRE 6 765#define ASN1_OP_I2D_PRE 6
729#define ASN1_OP_I2D_POST 7 766#define ASN1_OP_I2D_POST 7
767#define ASN1_OP_PRINT_PRE 8
768#define ASN1_OP_PRINT_POST 9
769#define ASN1_OP_STREAM_PRE 10
770#define ASN1_OP_STREAM_POST 11
771#define ASN1_OP_DETACHED_PRE 12
772#define ASN1_OP_DETACHED_POST 13
730 773
731/* Macro to implement a primitive type */ 774/* Macro to implement a primitive type */
732#define IMPLEMENT_ASN1_TYPE(stname) IMPLEMENT_ASN1_TYPE_ex(stname, stname, 0) 775#define IMPLEMENT_ASN1_TYPE(stname) IMPLEMENT_ASN1_TYPE_ex(stname, stname, 0)
@@ -782,9 +825,22 @@ typedef struct ASN1_AUX_st {
782#define IMPLEMENT_ASN1_FUNCTIONS_ENCODE_name(stname, itname) \ 825#define IMPLEMENT_ASN1_FUNCTIONS_ENCODE_name(stname, itname) \
783 IMPLEMENT_ASN1_FUNCTIONS_ENCODE_fname(stname, itname, itname) 826 IMPLEMENT_ASN1_FUNCTIONS_ENCODE_fname(stname, itname, itname)
784 827
828#define IMPLEMENT_STATIC_ASN1_ALLOC_FUNCTIONS(stname) \
829 IMPLEMENT_ASN1_ALLOC_FUNCTIONS_pfname(static, stname, stname, stname)
830
785#define IMPLEMENT_ASN1_ALLOC_FUNCTIONS(stname) \ 831#define IMPLEMENT_ASN1_ALLOC_FUNCTIONS(stname) \
786 IMPLEMENT_ASN1_ALLOC_FUNCTIONS_fname(stname, stname, stname) 832 IMPLEMENT_ASN1_ALLOC_FUNCTIONS_fname(stname, stname, stname)
787 833
834#define IMPLEMENT_ASN1_ALLOC_FUNCTIONS_pfname(pre, stname, itname, fname) \
835 pre stname *fname##_new(void) \
836 { \
837 return (stname *)ASN1_item_new(ASN1_ITEM_rptr(itname)); \
838 } \
839 pre void fname##_free(stname *a) \
840 { \
841 ASN1_item_free((ASN1_VALUE *)a, ASN1_ITEM_rptr(itname)); \
842 }
843
788#define IMPLEMENT_ASN1_ALLOC_FUNCTIONS_fname(stname, itname, fname) \ 844#define IMPLEMENT_ASN1_ALLOC_FUNCTIONS_fname(stname, itname, fname) \
789 stname *fname##_new(void) \ 845 stname *fname##_new(void) \
790 { \ 846 { \
@@ -834,6 +890,17 @@ typedef struct ASN1_AUX_st {
834 return ASN1_item_dup(ASN1_ITEM_rptr(stname), x); \ 890 return ASN1_item_dup(ASN1_ITEM_rptr(stname), x); \
835 } 891 }
836 892
893#define IMPLEMENT_ASN1_PRINT_FUNCTION(stname) \
894 IMPLEMENT_ASN1_PRINT_FUNCTION_fname(stname, stname, stname)
895
896#define IMPLEMENT_ASN1_PRINT_FUNCTION_fname(stname, itname, fname) \
897 int fname##_print_ctx(BIO *out, stname *x, int indent, \
898 const ASN1_PCTX *pctx) \
899 { \
900 return ASN1_item_print(out, (ASN1_VALUE *)x, indent, \
901 ASN1_ITEM_rptr(itname), pctx); \
902 }
903
837#define IMPLEMENT_ASN1_FUNCTIONS_const(name) \ 904#define IMPLEMENT_ASN1_FUNCTIONS_const(name) \
838 IMPLEMENT_ASN1_FUNCTIONS_const_fname(name, name, name) 905 IMPLEMENT_ASN1_FUNCTIONS_const_fname(name, name, name)
839 906
diff --git a/src/lib/libcrypto/asn1/asn_mime.c b/src/lib/libcrypto/asn1/asn_mime.c
index d8d9e76cc0..c1d1b12291 100644
--- a/src/lib/libcrypto/asn1/asn_mime.c
+++ b/src/lib/libcrypto/asn1/asn_mime.c
@@ -59,6 +59,7 @@
59#include <openssl/x509.h> 59#include <openssl/x509.h>
60#include <openssl/asn1.h> 60#include <openssl/asn1.h>
61#include <openssl/asn1t.h> 61#include <openssl/asn1t.h>
62#include "asn1_locl.h"
62 63
63/* Generalised MIME like utilities for streaming ASN1. Although many 64/* Generalised MIME like utilities for streaming ASN1. Although many
64 * have a PKCS7/CMS like flavour others are more general purpose. 65 * have a PKCS7/CMS like flavour others are more general purpose.
@@ -86,6 +87,8 @@ STACK_OF(MIME_PARAM) *params; /* Zero or more parameters */
86DECLARE_STACK_OF(MIME_HEADER) 87DECLARE_STACK_OF(MIME_HEADER)
87IMPLEMENT_STACK_OF(MIME_HEADER) 88IMPLEMENT_STACK_OF(MIME_HEADER)
88 89
90static int asn1_output_data(BIO *out, BIO *data, ASN1_VALUE *val, int flags,
91 const ASN1_ITEM *it);
89static char * strip_ends(char *name); 92static char * strip_ends(char *name);
90static char * strip_start(char *name); 93static char * strip_start(char *name);
91static char * strip_end(char *name); 94static char * strip_end(char *name);
@@ -107,6 +110,39 @@ static void mime_hdr_free(MIME_HEADER *hdr);
107#define MAX_SMLEN 1024 110#define MAX_SMLEN 1024
108#define mime_debug(x) /* x */ 111#define mime_debug(x) /* x */
109 112
113/* Output an ASN1 structure in BER format streaming if necessary */
114
115int i2d_ASN1_bio_stream(BIO *out, ASN1_VALUE *val, BIO *in, int flags,
116 const ASN1_ITEM *it)
117 {
118 /* If streaming create stream BIO and copy all content through it */
119 if (flags & SMIME_STREAM)
120 {
121 BIO *bio, *tbio;
122 bio = BIO_new_NDEF(out, val, it);
123 if (!bio)
124 {
125 ASN1err(ASN1_F_I2D_ASN1_BIO_STREAM,ERR_R_MALLOC_FAILURE);
126 return 0;
127 }
128 SMIME_crlf_copy(in, bio, flags);
129 (void)BIO_flush(bio);
130 /* Free up successive BIOs until we hit the old output BIO */
131 do
132 {
133 tbio = BIO_pop(bio);
134 BIO_free(bio);
135 bio = tbio;
136 } while (bio != out);
137 }
138 /* else just write out ASN1 structure which will have all content
139 * stored internally
140 */
141 else
142 ASN1_item_i2d_bio(it, out, val);
143 return 1;
144 }
145
110/* Base 64 read and write of ASN1 structure */ 146/* Base 64 read and write of ASN1 structure */
111 147
112static int B64_write_ASN1(BIO *out, ASN1_VALUE *val, BIO *in, int flags, 148static int B64_write_ASN1(BIO *out, ASN1_VALUE *val, BIO *in, int flags,
@@ -123,13 +159,26 @@ static int B64_write_ASN1(BIO *out, ASN1_VALUE *val, BIO *in, int flags,
123 /* prepend the b64 BIO so all data is base64 encoded. 159 /* prepend the b64 BIO so all data is base64 encoded.
124 */ 160 */
125 out = BIO_push(b64, out); 161 out = BIO_push(b64, out);
126 r = ASN1_item_i2d_bio(it, out, val); 162 r = i2d_ASN1_bio_stream(out, val, in, flags, it);
127 (void)BIO_flush(out); 163 (void)BIO_flush(out);
128 BIO_pop(out); 164 BIO_pop(out);
129 BIO_free(b64); 165 BIO_free(b64);
130 return r; 166 return r;
131 } 167 }
132 168
169/* Streaming ASN1 PEM write */
170
171int PEM_write_bio_ASN1_stream(BIO *out, ASN1_VALUE *val, BIO *in, int flags,
172 const char *hdr,
173 const ASN1_ITEM *it)
174 {
175 int r;
176 BIO_printf(out, "-----BEGIN %s-----\n", hdr);
177 r = B64_write_ASN1(out, val, in, flags, it);
178 BIO_printf(out, "-----END %s-----\n", hdr);
179 return r;
180 }
181
133static ASN1_VALUE *b64_read_asn1(BIO *bio, const ASN1_ITEM *it) 182static ASN1_VALUE *b64_read_asn1(BIO *bio, const ASN1_ITEM *it)
134{ 183{
135 BIO *b64; 184 BIO *b64;
@@ -152,7 +201,8 @@ static ASN1_VALUE *b64_read_asn1(BIO *bio, const ASN1_ITEM *it)
152 201
153static int asn1_write_micalg(BIO *out, STACK_OF(X509_ALGOR) *mdalgs) 202static int asn1_write_micalg(BIO *out, STACK_OF(X509_ALGOR) *mdalgs)
154 { 203 {
155 int i, have_unknown = 0, write_comma, md_nid; 204 const EVP_MD *md;
205 int i, have_unknown = 0, write_comma, ret = 0, md_nid;
156 have_unknown = 0; 206 have_unknown = 0;
157 write_comma = 0; 207 write_comma = 0;
158 for (i = 0; i < sk_X509_ALGOR_num(mdalgs); i++) 208 for (i = 0; i < sk_X509_ALGOR_num(mdalgs); i++)
@@ -161,6 +211,21 @@ static int asn1_write_micalg(BIO *out, STACK_OF(X509_ALGOR) *mdalgs)
161 BIO_write(out, ",", 1); 211 BIO_write(out, ",", 1);
162 write_comma = 1; 212 write_comma = 1;
163 md_nid = OBJ_obj2nid(sk_X509_ALGOR_value(mdalgs, i)->algorithm); 213 md_nid = OBJ_obj2nid(sk_X509_ALGOR_value(mdalgs, i)->algorithm);
214 md = EVP_get_digestbynid(md_nid);
215 if (md && md->md_ctrl)
216 {
217 int rv;
218 char *micstr;
219 rv = md->md_ctrl(NULL, EVP_MD_CTRL_MICALG, 0, &micstr);
220 if (rv > 0)
221 {
222 BIO_puts(out, micstr);
223 OPENSSL_free(micstr);
224 continue;
225 }
226 if (rv != -2)
227 goto err;
228 }
164 switch(md_nid) 229 switch(md_nid)
165 { 230 {
166 case NID_sha1: 231 case NID_sha1:
@@ -183,6 +248,11 @@ static int asn1_write_micalg(BIO *out, STACK_OF(X509_ALGOR) *mdalgs)
183 BIO_puts(out, "sha-512"); 248 BIO_puts(out, "sha-512");
184 break; 249 break;
185 250
251 case NID_id_GostR3411_94:
252 BIO_puts(out, "gostr3411-94");
253 goto err;
254 break;
255
186 default: 256 default:
187 if (have_unknown) 257 if (have_unknown)
188 write_comma = 0; 258 write_comma = 0;
@@ -196,16 +266,18 @@ static int asn1_write_micalg(BIO *out, STACK_OF(X509_ALGOR) *mdalgs)
196 } 266 }
197 } 267 }
198 268
199 return 1; 269 ret = 1;
270 err:
271
272 return ret;
200 273
201 } 274 }
202 275
203/* SMIME sender */ 276/* SMIME sender */
204 277
205int int_smime_write_ASN1(BIO *bio, ASN1_VALUE *val, BIO *data, int flags, 278int SMIME_write_ASN1(BIO *bio, ASN1_VALUE *val, BIO *data, int flags,
206 int ctype_nid, int econt_nid, 279 int ctype_nid, int econt_nid,
207 STACK_OF(X509_ALGOR) *mdalgs, 280 STACK_OF(X509_ALGOR) *mdalgs,
208 asn1_output_data_fn *data_fn,
209 const ASN1_ITEM *it) 281 const ASN1_ITEM *it)
210{ 282{
211 char bound[33], c; 283 char bound[33], c;
@@ -243,7 +315,7 @@ int int_smime_write_ASN1(BIO *bio, ASN1_VALUE *val, BIO *data, int flags,
243 mime_eol, mime_eol); 315 mime_eol, mime_eol);
244 /* Now write out the first part */ 316 /* Now write out the first part */
245 BIO_printf(bio, "------%s%s", bound, mime_eol); 317 BIO_printf(bio, "------%s%s", bound, mime_eol);
246 if (!data_fn(bio, data, val, flags, it)) 318 if (!asn1_output_data(bio, data, val, flags, it))
247 return 0; 319 return 0;
248 BIO_printf(bio, "%s------%s%s", mime_eol, bound, mime_eol); 320 BIO_printf(bio, "%s------%s%s", mime_eol, bound, mime_eol);
249 321
@@ -296,8 +368,6 @@ int int_smime_write_ASN1(BIO *bio, ASN1_VALUE *val, BIO *data, int flags,
296 return 1; 368 return 1;
297} 369}
298 370
299#if 0
300
301/* Handle output of ASN1 data */ 371/* Handle output of ASN1 data */
302 372
303 373
@@ -350,8 +420,6 @@ static int asn1_output_data(BIO *out, BIO *data, ASN1_VALUE *val, int flags,
350 420
351 } 421 }
352 422
353#endif
354
355/* SMIME reader: handle multipart/signed and opaque signing. 423/* SMIME reader: handle multipart/signed and opaque signing.
356 * in multipart case the content is placed in a memory BIO 424 * in multipart case the content is placed in a memory BIO
357 * pointed to by "bcont". In opaque this is set to NULL 425 * pointed to by "bcont". In opaque this is set to NULL
diff --git a/src/lib/libcrypto/asn1/asn_pack.c b/src/lib/libcrypto/asn1/asn_pack.c
index f1a5a05632..ad738217d7 100644
--- a/src/lib/libcrypto/asn1/asn_pack.c
+++ b/src/lib/libcrypto/asn1/asn_pack.c
@@ -66,10 +66,10 @@
66 66
67/* Turn an ASN1 encoded SEQUENCE OF into a STACK of structures */ 67/* Turn an ASN1 encoded SEQUENCE OF into a STACK of structures */
68 68
69STACK *ASN1_seq_unpack(const unsigned char *buf, int len, 69STACK_OF(OPENSSL_BLOCK) *ASN1_seq_unpack(const unsigned char *buf, int len,
70 d2i_of_void *d2i,void (*free_func)(void *)) 70 d2i_of_void *d2i, void (*free_func)(OPENSSL_BLOCK))
71{ 71{
72 STACK *sk; 72 STACK_OF(OPENSSL_BLOCK) *sk;
73 const unsigned char *pbuf; 73 const unsigned char *pbuf;
74 pbuf = buf; 74 pbuf = buf;
75 if (!(sk = d2i_ASN1_SET(NULL, &pbuf, len, d2i, free_func, 75 if (!(sk = d2i_ASN1_SET(NULL, &pbuf, len, d2i, free_func,
@@ -82,7 +82,7 @@ STACK *ASN1_seq_unpack(const unsigned char *buf, int len,
82 * OPENSSL_malloc'ed buffer 82 * OPENSSL_malloc'ed buffer
83 */ 83 */
84 84
85unsigned char *ASN1_seq_pack(STACK *safes, i2d_of_void *i2d, 85unsigned char *ASN1_seq_pack(STACK_OF(OPENSSL_BLOCK) *safes, i2d_of_void *i2d,
86 unsigned char **buf, int *len) 86 unsigned char **buf, int *len)
87{ 87{
88 int safelen; 88 int safelen;
diff --git a/src/lib/libcrypto/asn1/charmap.h b/src/lib/libcrypto/asn1/charmap.h
index bd020a9562..b55e638725 100644
--- a/src/lib/libcrypto/asn1/charmap.h
+++ b/src/lib/libcrypto/asn1/charmap.h
@@ -2,7 +2,7 @@
2 * Mask of various character properties 2 * Mask of various character properties
3 */ 3 */
4 4
5static unsigned char char_type[] = { 5static const unsigned char char_type[] = {
6 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 6 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
7 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 7 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
8120, 0, 1,40, 0, 0, 0,16,16,16, 0,25,25,16,16,16, 8120, 0, 1,40, 0, 0, 0,16,16,16, 0,25,25,16,16,16,
diff --git a/src/lib/libcrypto/asn1/d2i_pr.c b/src/lib/libcrypto/asn1/d2i_pr.c
index 207ccda5ac..2828944777 100644
--- a/src/lib/libcrypto/asn1/d2i_pr.c
+++ b/src/lib/libcrypto/asn1/d2i_pr.c
@@ -61,16 +61,12 @@
61#include <openssl/bn.h> 61#include <openssl/bn.h>
62#include <openssl/evp.h> 62#include <openssl/evp.h>
63#include <openssl/objects.h> 63#include <openssl/objects.h>
64#include <openssl/asn1.h> 64#ifndef OPENSSL_NO_ENGINE
65#ifndef OPENSSL_NO_RSA 65#include <openssl/engine.h>
66#include <openssl/rsa.h>
67#endif
68#ifndef OPENSSL_NO_DSA
69#include <openssl/dsa.h>
70#endif
71#ifndef OPENSSL_NO_EC
72#include <openssl/ec.h>
73#endif 66#endif
67#include <openssl/x509.h>
68#include <openssl/asn1.h>
69#include "asn1_locl.h"
74 70
75EVP_PKEY *d2i_PrivateKey(int type, EVP_PKEY **a, const unsigned char **pp, 71EVP_PKEY *d2i_PrivateKey(int type, EVP_PKEY **a, const unsigned char **pp,
76 long length) 72 long length)
@@ -85,47 +81,43 @@ EVP_PKEY *d2i_PrivateKey(int type, EVP_PKEY **a, const unsigned char **pp,
85 return(NULL); 81 return(NULL);
86 } 82 }
87 } 83 }
88 else ret= *a; 84 else
89
90 ret->save_type=type;
91 ret->type=EVP_PKEY_type(type);
92 switch (ret->type)
93 { 85 {
94#ifndef OPENSSL_NO_RSA 86 ret= *a;
95 case EVP_PKEY_RSA: 87#ifndef OPENSSL_NO_ENGINE
96 if ((ret->pkey.rsa=d2i_RSAPrivateKey(NULL, 88 if (ret->engine)
97 (const unsigned char **)pp,length)) == NULL) /* TMP UGLY CAST */
98 { 89 {
99 ASN1err(ASN1_F_D2I_PRIVATEKEY,ERR_R_ASN1_LIB); 90 ENGINE_finish(ret->engine);
100 goto err; 91 ret->engine = NULL;
101 } 92 }
102 break;
103#endif 93#endif
104#ifndef OPENSSL_NO_DSA 94 }
105 case EVP_PKEY_DSA: 95
106 if ((ret->pkey.dsa=d2i_DSAPrivateKey(NULL, 96 if (!EVP_PKEY_set_type(ret, type))
107 (const unsigned char **)pp,length)) == NULL) /* TMP UGLY CAST */ 97 {
98 ASN1err(ASN1_F_D2I_PRIVATEKEY,ASN1_R_UNKNOWN_PUBLIC_KEY_TYPE);
99 goto err;
100 }
101
102 if (!ret->ameth->old_priv_decode ||
103 !ret->ameth->old_priv_decode(ret, pp, length))
104 {
105 if (ret->ameth->priv_decode)
108 { 106 {
109 ASN1err(ASN1_F_D2I_PRIVATEKEY,ERR_R_ASN1_LIB); 107 PKCS8_PRIV_KEY_INFO *p8=NULL;
110 goto err; 108 p8=d2i_PKCS8_PRIV_KEY_INFO(NULL,pp,length);
111 } 109 if (!p8) goto err;
112 break; 110 EVP_PKEY_free(ret);
113#endif 111 ret = EVP_PKCS82PKEY(p8);
114#ifndef OPENSSL_NO_EC 112 PKCS8_PRIV_KEY_INFO_free(p8);
115 case EVP_PKEY_EC: 113
116 if ((ret->pkey.ec = d2i_ECPrivateKey(NULL, 114 }
117 (const unsigned char **)pp, length)) == NULL) 115 else
118 { 116 {
119 ASN1err(ASN1_F_D2I_PRIVATEKEY, ERR_R_ASN1_LIB); 117 ASN1err(ASN1_F_D2I_PRIVATEKEY,ERR_R_ASN1_LIB);
120 goto err; 118 goto err;
121 } 119 }
122 break; 120 }
123#endif
124 default:
125 ASN1err(ASN1_F_D2I_PRIVATEKEY,ASN1_R_UNKNOWN_PUBLIC_KEY_TYPE);
126 goto err;
127 /* break; */
128 }
129 if (a != NULL) (*a)=ret; 121 if (a != NULL) (*a)=ret;
130 return(ret); 122 return(ret);
131err: 123err:
@@ -146,8 +138,7 @@ EVP_PKEY *d2i_AutoPrivateKey(EVP_PKEY **a, const unsigned char **pp,
146 * by analyzing it we can determine the passed structure: this 138 * by analyzing it we can determine the passed structure: this
147 * assumes the input is surrounded by an ASN1 SEQUENCE. 139 * assumes the input is surrounded by an ASN1 SEQUENCE.
148 */ 140 */
149 inkey = d2i_ASN1_SET_OF_ASN1_TYPE(NULL, &p, length, d2i_ASN1_TYPE, 141 inkey = d2i_ASN1_SEQUENCE_ANY(NULL, &p, length);
150 ASN1_TYPE_free, V_ASN1_SEQUENCE, V_ASN1_UNIVERSAL);
151 /* Since we only need to discern "traditional format" RSA and DSA 142 /* Since we only need to discern "traditional format" RSA and DSA
152 * keys we can just count the elements. 143 * keys we can just count the elements.
153 */ 144 */
@@ -155,6 +146,24 @@ EVP_PKEY *d2i_AutoPrivateKey(EVP_PKEY **a, const unsigned char **pp,
155 keytype = EVP_PKEY_DSA; 146 keytype = EVP_PKEY_DSA;
156 else if (sk_ASN1_TYPE_num(inkey) == 4) 147 else if (sk_ASN1_TYPE_num(inkey) == 4)
157 keytype = EVP_PKEY_EC; 148 keytype = EVP_PKEY_EC;
149 else if (sk_ASN1_TYPE_num(inkey) == 3)
150 { /* This seems to be PKCS8, not traditional format */
151 PKCS8_PRIV_KEY_INFO *p8 = d2i_PKCS8_PRIV_KEY_INFO(NULL,pp,length);
152 EVP_PKEY *ret;
153
154 sk_ASN1_TYPE_pop_free(inkey, ASN1_TYPE_free);
155 if (!p8)
156 {
157 ASN1err(ASN1_F_D2I_AUTOPRIVATEKEY,ASN1_R_UNSUPPORTED_PUBLIC_KEY_TYPE);
158 return NULL;
159 }
160 ret = EVP_PKCS82PKEY(p8);
161 PKCS8_PRIV_KEY_INFO_free(p8);
162 if (a) {
163 *a = ret;
164 }
165 return ret;
166 }
158 else keytype = EVP_PKEY_RSA; 167 else keytype = EVP_PKEY_RSA;
159 sk_ASN1_TYPE_pop_free(inkey, ASN1_TYPE_free); 168 sk_ASN1_TYPE_pop_free(inkey, ASN1_TYPE_free);
160 return d2i_PrivateKey(keytype, a, pp, length); 169 return d2i_PrivateKey(keytype, a, pp, length);
diff --git a/src/lib/libcrypto/asn1/d2i_pu.c b/src/lib/libcrypto/asn1/d2i_pu.c
index 3694f51a8c..c8f39ceb03 100644
--- a/src/lib/libcrypto/asn1/d2i_pu.c
+++ b/src/lib/libcrypto/asn1/d2i_pu.c
@@ -87,9 +87,13 @@ EVP_PKEY *d2i_PublicKey(int type, EVP_PKEY **a, const unsigned char **pp,
87 } 87 }
88 else ret= *a; 88 else ret= *a;
89 89
90 ret->save_type=type; 90 if (!EVP_PKEY_set_type(ret, type))
91 ret->type=EVP_PKEY_type(type); 91 {
92 switch (ret->type) 92 ASN1err(ASN1_F_D2I_PUBLICKEY,ERR_R_EVP_LIB);
93 goto err;
94 }
95
96 switch (EVP_PKEY_id(ret))
93 { 97 {
94#ifndef OPENSSL_NO_RSA 98#ifndef OPENSSL_NO_RSA
95 case EVP_PKEY_RSA: 99 case EVP_PKEY_RSA:
diff --git a/src/lib/libcrypto/asn1/f.c b/src/lib/libcrypto/asn1/f.c
deleted file mode 100644
index 82bccdfd51..0000000000
--- a/src/lib/libcrypto/asn1/f.c
+++ /dev/null
@@ -1,80 +0,0 @@
1/* crypto/asn1/f.c */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved.
4 *
5 * This package is an SSL implementation written
6 * by Eric Young (eay@cryptsoft.com).
7 * The implementation was written so as to conform with Netscapes SSL.
8 *
9 * This library is free for commercial and non-commercial use as long as
10 * the following conditions are aheared to. The following conditions
11 * apply to all code found in this distribution, be it the RC4, RSA,
12 * lhash, DES, etc., code; not just the SSL code. The SSL documentation
13 * included with this distribution is covered by the same copyright terms
14 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
15 *
16 * Copyright remains Eric Young's, and as such any Copyright notices in
17 * the code are not to be removed.
18 * If this package is used in a product, Eric Young should be given attribution
19 * as the author of the parts of the library used.
20 * This can be in the form of a textual message at program startup or
21 * in documentation (online or textual) provided with the package.
22 *
23 * Redistribution and use in source and binary forms, with or without
24 * modification, are permitted provided that the following conditions
25 * are met:
26 * 1. Redistributions of source code must retain the copyright
27 * notice, this list of conditions and the following disclaimer.
28 * 2. Redistributions in binary form must reproduce the above copyright
29 * notice, this list of conditions and the following disclaimer in the
30 * documentation and/or other materials provided with the distribution.
31 * 3. All advertising materials mentioning features or use of this software
32 * must display the following acknowledgement:
33 * "This product includes cryptographic software written by
34 * Eric Young (eay@cryptsoft.com)"
35 * The word 'cryptographic' can be left out if the rouines from the library
36 * being used are not cryptographic related :-).
37 * 4. If you include any Windows specific code (or a derivative thereof) from
38 * the apps directory (application code) you must include an acknowledgement:
39 * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
40 *
41 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
42 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
43 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
44 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
45 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
46 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
47 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
49 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
50 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
51 * SUCH DAMAGE.
52 *
53 * The licence and distribution terms for any publically available version or
54 * derivative of this code cannot be changed. i.e. this code cannot simply be
55 * copied and put under another distribution licence
56 * [including the GNU Public Licence.]
57 */
58#include <stdio.h>
59#include <openssl/asn1.h>
60#include <openssl/err.h>
61
62main()
63 {
64 ASN1_TYPE *at;
65 char buf[512];
66 int n;
67 long l;
68
69 at=ASN1_TYPE_new();
70
71 n=ASN1_TYPE_set_int_octetstring(at,98736,"01234567",8);
72 printf("%d\n",n);
73 n=ASN1_TYPE_get_int_octetstring(at,&l,buf,8);
74 buf[8]='\0';
75 printf("%ld %d %d\n",l,n,buf[8]);
76 buf[8]='\0';
77 printf("%s\n",buf);
78 ERR_load_crypto_strings();
79 ERR_print_errors_fp(stderr);
80 }
diff --git a/src/lib/libcrypto/asn1/i2d_pr.c b/src/lib/libcrypto/asn1/i2d_pr.c
index 0be52c5b76..e398b62666 100644
--- a/src/lib/libcrypto/asn1/i2d_pr.c
+++ b/src/lib/libcrypto/asn1/i2d_pr.c
@@ -58,41 +58,22 @@
58 58
59#include <stdio.h> 59#include <stdio.h>
60#include "cryptlib.h" 60#include "cryptlib.h"
61#include <openssl/bn.h>
62#include <openssl/evp.h> 61#include <openssl/evp.h>
63#include <openssl/objects.h> 62#include <openssl/x509.h>
64#ifndef OPENSSL_NO_RSA 63#include "asn1_locl.h"
65#include <openssl/rsa.h>
66#endif
67#ifndef OPENSSL_NO_DSA
68#include <openssl/dsa.h>
69#endif
70#ifndef OPENSSL_NO_EC
71#include <openssl/ec.h>
72#endif
73 64
74int i2d_PrivateKey(EVP_PKEY *a, unsigned char **pp) 65int i2d_PrivateKey(EVP_PKEY *a, unsigned char **pp)
75 { 66 {
76#ifndef OPENSSL_NO_RSA 67 if (a->ameth && a->ameth->old_priv_encode)
77 if (a->type == EVP_PKEY_RSA)
78 { 68 {
79 return(i2d_RSAPrivateKey(a->pkey.rsa,pp)); 69 return a->ameth->old_priv_encode(a, pp);
80 } 70 }
81 else 71 if (a->ameth && a->ameth->priv_encode) {
82#endif 72 PKCS8_PRIV_KEY_INFO *p8 = EVP_PKEY2PKCS8(a);
83#ifndef OPENSSL_NO_DSA 73 int ret = i2d_PKCS8_PRIV_KEY_INFO(p8,pp);
84 if (a->type == EVP_PKEY_DSA) 74 PKCS8_PRIV_KEY_INFO_free(p8);
85 { 75 return ret;
86 return(i2d_DSAPrivateKey(a->pkey.dsa,pp)); 76 }
87 }
88#endif
89#ifndef OPENSSL_NO_EC
90 if (a->type == EVP_PKEY_EC)
91 {
92 return(i2d_ECPrivateKey(a->pkey.ec, pp));
93 }
94#endif
95
96 ASN1err(ASN1_F_I2D_PRIVATEKEY,ASN1_R_UNSUPPORTED_PUBLIC_KEY_TYPE); 77 ASN1err(ASN1_F_I2D_PRIVATEKEY,ASN1_R_UNSUPPORTED_PUBLIC_KEY_TYPE);
97 return(-1); 78 return(-1);
98 } 79 }
diff --git a/src/lib/libcrypto/asn1/nsseq.c b/src/lib/libcrypto/asn1/nsseq.c
index e551c57d59..b8c4202230 100644
--- a/src/lib/libcrypto/asn1/nsseq.c
+++ b/src/lib/libcrypto/asn1/nsseq.c
@@ -3,7 +3,7 @@
3 * project 1999. 3 * project 1999.
4 */ 4 */
5/* ==================================================================== 5/* ====================================================================
6 * Copyright (c) 1999 The OpenSSL Project. All rights reserved. 6 * Copyright (c) 1999-2005 The OpenSSL Project. All rights reserved.
7 * 7 *
8 * Redistribution and use in source and binary forms, with or without 8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions 9 * modification, are permitted provided that the following conditions
@@ -62,7 +62,8 @@
62#include <openssl/x509.h> 62#include <openssl/x509.h>
63#include <openssl/objects.h> 63#include <openssl/objects.h>
64 64
65static int nsseq_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it) 65static int nsseq_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it,
66 void *exarg)
66{ 67{
67 if(operation == ASN1_OP_NEW_POST) { 68 if(operation == ASN1_OP_NEW_POST) {
68 NETSCAPE_CERT_SEQUENCE *nsseq; 69 NETSCAPE_CERT_SEQUENCE *nsseq;
diff --git a/src/lib/libcrypto/asn1/p5_pbe.c b/src/lib/libcrypto/asn1/p5_pbe.c
index c4582f8041..94bc38b99f 100644
--- a/src/lib/libcrypto/asn1/p5_pbe.c
+++ b/src/lib/libcrypto/asn1/p5_pbe.c
@@ -71,61 +71,78 @@ ASN1_SEQUENCE(PBEPARAM) = {
71 71
72IMPLEMENT_ASN1_FUNCTIONS(PBEPARAM) 72IMPLEMENT_ASN1_FUNCTIONS(PBEPARAM)
73 73
74/* Return an algorithm identifier for a PKCS#5 PBE algorithm */
75 74
76X509_ALGOR *PKCS5_pbe_set(int alg, int iter, unsigned char *salt, 75/* Set an algorithm identifier for a PKCS#5 PBE algorithm */
77 int saltlen) 76
78{ 77int PKCS5_pbe_set0_algor(X509_ALGOR *algor, int alg, int iter,
78 const unsigned char *salt, int saltlen)
79 {
79 PBEPARAM *pbe=NULL; 80 PBEPARAM *pbe=NULL;
80 ASN1_OBJECT *al; 81 ASN1_STRING *pbe_str=NULL;
81 X509_ALGOR *algor; 82 unsigned char *sstr;
82 ASN1_TYPE *astype=NULL;
83 83
84 if (!(pbe = PBEPARAM_new ())) { 84 pbe = PBEPARAM_new();
85 ASN1err(ASN1_F_PKCS5_PBE_SET,ERR_R_MALLOC_FAILURE); 85 if (!pbe)
86 {
87 ASN1err(ASN1_F_PKCS5_PBE_SET0_ALGOR,ERR_R_MALLOC_FAILURE);
86 goto err; 88 goto err;
87 } 89 }
88 if(iter <= 0) iter = PKCS5_DEFAULT_ITER; 90 if(iter <= 0)
89 if (!ASN1_INTEGER_set(pbe->iter, iter)) { 91 iter = PKCS5_DEFAULT_ITER;
90 ASN1err(ASN1_F_PKCS5_PBE_SET,ERR_R_MALLOC_FAILURE); 92 if (!ASN1_INTEGER_set(pbe->iter, iter))
93 {
94 ASN1err(ASN1_F_PKCS5_PBE_SET0_ALGOR,ERR_R_MALLOC_FAILURE);
91 goto err; 95 goto err;
92 } 96 }
93 if (!saltlen) saltlen = PKCS5_SALT_LEN; 97 if (!saltlen)
94 if (!(pbe->salt->data = OPENSSL_malloc (saltlen))) { 98 saltlen = PKCS5_SALT_LEN;
95 ASN1err(ASN1_F_PKCS5_PBE_SET,ERR_R_MALLOC_FAILURE); 99 if (!ASN1_STRING_set(pbe->salt, NULL, saltlen))
100 {
101 ASN1err(ASN1_F_PKCS5_PBE_SET0_ALGOR,ERR_R_MALLOC_FAILURE);
96 goto err; 102 goto err;
97 } 103 }
98 pbe->salt->length = saltlen; 104 sstr = ASN1_STRING_data(pbe->salt);
99 if (salt) memcpy (pbe->salt->data, salt, saltlen); 105 if (salt)
100 else if (RAND_pseudo_bytes (pbe->salt->data, saltlen) < 0) 106 memcpy(sstr, salt, saltlen);
107 else if (RAND_pseudo_bytes(sstr, saltlen) < 0)
101 goto err; 108 goto err;
102 109
103 if (!(astype = ASN1_TYPE_new())) { 110 if(!ASN1_item_pack(pbe, ASN1_ITEM_rptr(PBEPARAM), &pbe_str))
104 ASN1err(ASN1_F_PKCS5_PBE_SET,ERR_R_MALLOC_FAILURE); 111 {
112 ASN1err(ASN1_F_PKCS5_PBE_SET0_ALGOR,ERR_R_MALLOC_FAILURE);
105 goto err; 113 goto err;
106 } 114 }
107 115
108 astype->type = V_ASN1_SEQUENCE; 116 PBEPARAM_free(pbe);
109 if(!ASN1_pack_string_of(PBEPARAM, pbe, i2d_PBEPARAM,
110 &astype->value.sequence)) {
111 ASN1err(ASN1_F_PKCS5_PBE_SET,ERR_R_MALLOC_FAILURE);
112 goto err;
113 }
114 PBEPARAM_free (pbe);
115 pbe = NULL; 117 pbe = NULL;
116
117 al = OBJ_nid2obj(alg); /* never need to free al */
118 if (!(algor = X509_ALGOR_new())) {
119 ASN1err(ASN1_F_PKCS5_PBE_SET,ERR_R_MALLOC_FAILURE);
120 goto err;
121 }
122 ASN1_OBJECT_free(algor->algorithm);
123 algor->algorithm = al;
124 algor->parameter = astype;
125 118
126 return (algor); 119 if (X509_ALGOR_set0(algor, OBJ_nid2obj(alg), V_ASN1_SEQUENCE, pbe_str))
120 return 1;
121
127err: 122err:
128 if (pbe != NULL) PBEPARAM_free(pbe); 123 if (pbe != NULL)
129 if (astype != NULL) ASN1_TYPE_free(astype); 124 PBEPARAM_free(pbe);
125 if (pbe_str != NULL)
126 ASN1_STRING_free(pbe_str);
127 return 0;
128 }
129
130/* Return an algorithm identifier for a PKCS#5 PBE algorithm */
131
132X509_ALGOR *PKCS5_pbe_set(int alg, int iter,
133 const unsigned char *salt, int saltlen)
134 {
135 X509_ALGOR *ret;
136 ret = X509_ALGOR_new();
137 if (!ret)
138 {
139 ASN1err(ASN1_F_PKCS5_PBE_SET,ERR_R_MALLOC_FAILURE);
140 return NULL;
141 }
142
143 if (PKCS5_pbe_set0_algor(ret, alg, iter, salt, saltlen))
144 return ret;
145
146 X509_ALGOR_free(ret);
130 return NULL; 147 return NULL;
131} 148 }
diff --git a/src/lib/libcrypto/asn1/p5_pbev2.c b/src/lib/libcrypto/asn1/p5_pbev2.c
index 2b0516afee..cb49b6651d 100644
--- a/src/lib/libcrypto/asn1/p5_pbev2.c
+++ b/src/lib/libcrypto/asn1/p5_pbev2.c
@@ -82,10 +82,13 @@ IMPLEMENT_ASN1_FUNCTIONS(PBKDF2PARAM)
82 82
83/* Return an algorithm identifier for a PKCS#5 v2.0 PBE algorithm: 83/* Return an algorithm identifier for a PKCS#5 v2.0 PBE algorithm:
84 * yes I know this is horrible! 84 * yes I know this is horrible!
85 *
86 * Extended version to allow application supplied PRF NID and IV.
85 */ 87 */
86 88
87X509_ALGOR *PKCS5_pbe2_set(const EVP_CIPHER *cipher, int iter, 89X509_ALGOR *PKCS5_pbe2_set_iv(const EVP_CIPHER *cipher, int iter,
88 unsigned char *salt, int saltlen) 90 unsigned char *salt, int saltlen,
91 unsigned char *aiv, int prf_nid)
89{ 92{
90 X509_ALGOR *scheme = NULL, *kalg = NULL, *ret = NULL; 93 X509_ALGOR *scheme = NULL, *kalg = NULL, *ret = NULL;
91 int alg_nid; 94 int alg_nid;
@@ -98,7 +101,7 @@ X509_ALGOR *PKCS5_pbe2_set(const EVP_CIPHER *cipher, int iter,
98 101
99 alg_nid = EVP_CIPHER_type(cipher); 102 alg_nid = EVP_CIPHER_type(cipher);
100 if(alg_nid == NID_undef) { 103 if(alg_nid == NID_undef) {
101 ASN1err(ASN1_F_PKCS5_PBE2_SET, 104 ASN1err(ASN1_F_PKCS5_PBE2_SET_IV,
102 ASN1_R_CIPHER_HAS_NO_OBJECT_IDENTIFIER); 105 ASN1_R_CIPHER_HAS_NO_OBJECT_IDENTIFIER);
103 goto err; 106 goto err;
104 } 107 }
@@ -113,20 +116,33 @@ X509_ALGOR *PKCS5_pbe2_set(const EVP_CIPHER *cipher, int iter,
113 if(!(scheme->parameter = ASN1_TYPE_new())) goto merr; 116 if(!(scheme->parameter = ASN1_TYPE_new())) goto merr;
114 117
115 /* Create random IV */ 118 /* Create random IV */
116 if (EVP_CIPHER_iv_length(cipher) && 119 if (EVP_CIPHER_iv_length(cipher))
117 RAND_pseudo_bytes(iv, EVP_CIPHER_iv_length(cipher)) < 0) 120 {
118 goto err; 121 if (aiv)
122 memcpy(iv, aiv, EVP_CIPHER_iv_length(cipher));
123 else if (RAND_pseudo_bytes(iv, EVP_CIPHER_iv_length(cipher)) < 0)
124 goto err;
125 }
119 126
120 EVP_CIPHER_CTX_init(&ctx); 127 EVP_CIPHER_CTX_init(&ctx);
121 128
122 /* Dummy cipherinit to just setup the IV */ 129 /* Dummy cipherinit to just setup the IV, and PRF */
123 EVP_CipherInit_ex(&ctx, cipher, NULL, NULL, iv, 0); 130 EVP_CipherInit_ex(&ctx, cipher, NULL, NULL, iv, 0);
124 if(EVP_CIPHER_param_to_asn1(&ctx, scheme->parameter) < 0) { 131 if(EVP_CIPHER_param_to_asn1(&ctx, scheme->parameter) < 0) {
125 ASN1err(ASN1_F_PKCS5_PBE2_SET, 132 ASN1err(ASN1_F_PKCS5_PBE2_SET_IV,
126 ASN1_R_ERROR_SETTING_CIPHER_PARAMS); 133 ASN1_R_ERROR_SETTING_CIPHER_PARAMS);
127 EVP_CIPHER_CTX_cleanup(&ctx); 134 EVP_CIPHER_CTX_cleanup(&ctx);
128 goto err; 135 goto err;
129 } 136 }
137 /* If prf NID unspecified see if cipher has a preference.
138 * An error is OK here: just means use default PRF.
139 */
140 if ((prf_nid == -1) &&
141 EVP_CIPHER_CTX_ctrl(&ctx, EVP_CTRL_PBE_PRF_NID, 0, &prf_nid) <= 0)
142 {
143 ERR_clear_error();
144 prf_nid = NID_hmacWithSHA1;
145 }
130 EVP_CIPHER_CTX_cleanup(&ctx); 146 EVP_CIPHER_CTX_cleanup(&ctx);
131 147
132 if(!(kdf = PBKDF2PARAM_new())) goto merr; 148 if(!(kdf = PBKDF2PARAM_new())) goto merr;
@@ -154,7 +170,15 @@ X509_ALGOR *PKCS5_pbe2_set(const EVP_CIPHER *cipher, int iter,
154 EVP_CIPHER_key_length(cipher))) goto merr; 170 EVP_CIPHER_key_length(cipher))) goto merr;
155 } 171 }
156 172
157 /* prf can stay NULL because we are using hmacWithSHA1 */ 173 /* prf can stay NULL if we are using hmacWithSHA1 */
174 if (prf_nid != NID_hmacWithSHA1)
175 {
176 kdf->prf = X509_ALGOR_new();
177 if (!kdf->prf)
178 goto merr;
179 X509_ALGOR_set0(kdf->prf, OBJ_nid2obj(prf_nid),
180 V_ASN1_NULL, NULL);
181 }
158 182
159 /* Now setup the PBE2PARAM keyfunc structure */ 183 /* Now setup the PBE2PARAM keyfunc structure */
160 184
@@ -164,7 +188,7 @@ X509_ALGOR *PKCS5_pbe2_set(const EVP_CIPHER *cipher, int iter,
164 188
165 if(!(pbe2->keyfunc->parameter = ASN1_TYPE_new())) goto merr; 189 if(!(pbe2->keyfunc->parameter = ASN1_TYPE_new())) goto merr;
166 190
167 if(!ASN1_pack_string_of(PBKDF2PARAM, kdf, i2d_PBKDF2PARAM, 191 if(!ASN1_item_pack(kdf, ASN1_ITEM_rptr(PBKDF2PARAM),
168 &pbe2->keyfunc->parameter->value.sequence)) goto merr; 192 &pbe2->keyfunc->parameter->value.sequence)) goto merr;
169 pbe2->keyfunc->parameter->type = V_ASN1_SEQUENCE; 193 pbe2->keyfunc->parameter->type = V_ASN1_SEQUENCE;
170 194
@@ -180,7 +204,7 @@ X509_ALGOR *PKCS5_pbe2_set(const EVP_CIPHER *cipher, int iter,
180 204
181 /* Encode PBE2PARAM into parameter */ 205 /* Encode PBE2PARAM into parameter */
182 206
183 if(!ASN1_pack_string_of(PBE2PARAM, pbe2, i2d_PBE2PARAM, 207 if(!ASN1_item_pack(pbe2, ASN1_ITEM_rptr(PBE2PARAM),
184 &ret->parameter->value.sequence)) goto merr; 208 &ret->parameter->value.sequence)) goto merr;
185 ret->parameter->type = V_ASN1_SEQUENCE; 209 ret->parameter->type = V_ASN1_SEQUENCE;
186 210
@@ -190,7 +214,7 @@ X509_ALGOR *PKCS5_pbe2_set(const EVP_CIPHER *cipher, int iter,
190 return ret; 214 return ret;
191 215
192 merr: 216 merr:
193 ASN1err(ASN1_F_PKCS5_PBE2_SET,ERR_R_MALLOC_FAILURE); 217 ASN1err(ASN1_F_PKCS5_PBE2_SET_IV,ERR_R_MALLOC_FAILURE);
194 218
195 err: 219 err:
196 PBE2PARAM_free(pbe2); 220 PBE2PARAM_free(pbe2);
@@ -203,3 +227,9 @@ X509_ALGOR *PKCS5_pbe2_set(const EVP_CIPHER *cipher, int iter,
203 return NULL; 227 return NULL;
204 228
205} 229}
230
231X509_ALGOR *PKCS5_pbe2_set(const EVP_CIPHER *cipher, int iter,
232 unsigned char *salt, int saltlen)
233 {
234 return PKCS5_pbe2_set_iv(cipher, iter, salt, saltlen, NULL, -1);
235 }
diff --git a/src/lib/libcrypto/asn1/p8_key.c b/src/lib/libcrypto/asn1/p8_key.c
deleted file mode 100644
index 3a31248e14..0000000000
--- a/src/lib/libcrypto/asn1/p8_key.c
+++ /dev/null
@@ -1,131 +0,0 @@
1/* crypto/asn1/p8_key.c */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved.
4 *
5 * This package is an SSL implementation written
6 * by Eric Young (eay@cryptsoft.com).
7 * The implementation was written so as to conform with Netscapes SSL.
8 *
9 * This library is free for commercial and non-commercial use as long as
10 * the following conditions are aheared to. The following conditions
11 * apply to all code found in this distribution, be it the RC4, RSA,
12 * lhash, DES, etc., code; not just the SSL code. The SSL documentation
13 * included with this distribution is covered by the same copyright terms
14 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
15 *
16 * Copyright remains Eric Young's, and as such any Copyright notices in
17 * the code are not to be removed.
18 * If this package is used in a product, Eric Young should be given attribution
19 * as the author of the parts of the library used.
20 * This can be in the form of a textual message at program startup or
21 * in documentation (online or textual) provided with the package.
22 *
23 * Redistribution and use in source and binary forms, with or without
24 * modification, are permitted provided that the following conditions
25 * are met:
26 * 1. Redistributions of source code must retain the copyright
27 * notice, this list of conditions and the following disclaimer.
28 * 2. Redistributions in binary form must reproduce the above copyright
29 * notice, this list of conditions and the following disclaimer in the
30 * documentation and/or other materials provided with the distribution.
31 * 3. All advertising materials mentioning features or use of this software
32 * must display the following acknowledgement:
33 * "This product includes cryptographic software written by
34 * Eric Young (eay@cryptsoft.com)"
35 * The word 'cryptographic' can be left out if the rouines from the library
36 * being used are not cryptographic related :-).
37 * 4. If you include any Windows specific code (or a derivative thereof) from
38 * the apps directory (application code) you must include an acknowledgement:
39 * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
40 *
41 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
42 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
43 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
44 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
45 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
46 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
47 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
49 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
50 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
51 * SUCH DAMAGE.
52 *
53 * The licence and distribution terms for any publically available version or
54 * derivative of this code cannot be changed. i.e. this code cannot simply be
55 * copied and put under another distribution licence
56 * [including the GNU Public Licence.]
57 */
58
59#include <stdio.h>
60#include "cryptlib.h"
61#include <openssl/asn1_mac.h>
62#include <openssl/objects.h>
63
64int i2d_X509_KEY(X509 *a, unsigned char **pp)
65 {
66 M_ASN1_I2D_vars(a);
67
68 M_ASN1_I2D_len(a->cert_info, i2d_X509_CINF);
69 M_ASN1_I2D_len(a->sig_alg, i2d_X509_ALGOR);
70 M_ASN1_I2D_len(a->signature, i2d_ASN1_BIT_STRING);
71
72 M_ASN1_I2D_seq_total();
73
74 M_ASN1_I2D_put(a->cert_info, i2d_X509_CINF);
75 M_ASN1_I2D_put(a->sig_alg, i2d_X509_ALGOR);
76 M_ASN1_I2D_put(a->signature, i2d_ASN1_BIT_STRING);
77
78 M_ASN1_I2D_finish();
79 }
80
81X509 *d2i_X509_KEY(X509 **a, unsigned char **pp, long length)
82 {
83 M_ASN1_D2I_vars(a,X509 *,X509_new);
84
85 M_ASN1_D2I_Init();
86 M_ASN1_D2I_start_sequence();
87 M_ASN1_D2I_get(ret->cert_info,d2i_X509_CINF);
88 M_ASN1_D2I_get(ret->sig_alg,d2i_X509_ALGOR);
89 M_ASN1_D2I_get(ret->signature,d2i_ASN1_BIT_STRING);
90 M_ASN1_D2I_Finish(a,X509_free,ASN1_F_D2I_X509);
91 }
92
93X509 *X509_KEY_new(void)
94 {
95 X509_KEY *ret=NULL;
96
97 M_ASN1_New_OPENSSL_malloc(ret,X509_KEY);
98 ret->references=1;
99 ret->type=NID
100 M_ASN1_New(ret->cert_info,X509_CINF_new);
101 M_ASN1_New(ret->sig_alg,X509_ALGOR_new);
102 M_ASN1_New(ret->signature,ASN1_BIT_STRING_new);
103 return(ret);
104 M_ASN1_New_Error(ASN1_F_X509_NEW);
105 }
106
107void X509_KEY_free(X509 *a)
108 {
109 int i;
110
111 if (a == NULL) return;
112
113 i=CRYPTO_add_lock(&a->references,-1,CRYPTO_LOCK_X509_KEY);
114#ifdef REF_PRINT
115 REF_PRINT("X509_KEY",a);
116#endif
117 if (i > 0) return;
118#ifdef REF_CHECK
119 if (i < 0)
120 {
121 fprintf(stderr,"X509_KEY_free, bad reference count\n");
122 abort();
123 }
124#endif
125
126 X509_CINF_free(a->cert_info);
127 X509_ALGOR_free(a->sig_alg);
128 ASN1_BIT_STRING_free(a->signature);
129 OPENSSL_free(a);
130 }
131
diff --git a/src/lib/libcrypto/asn1/p8_pkey.c b/src/lib/libcrypto/asn1/p8_pkey.c
index 0a1957556e..17b68d386d 100644
--- a/src/lib/libcrypto/asn1/p8_pkey.c
+++ b/src/lib/libcrypto/asn1/p8_pkey.c
@@ -3,7 +3,7 @@
3 * project 1999. 3 * project 1999.
4 */ 4 */
5/* ==================================================================== 5/* ====================================================================
6 * Copyright (c) 1999 The OpenSSL Project. All rights reserved. 6 * Copyright (c) 1999-2005 The OpenSSL Project. All rights reserved.
7 * 7 *
8 * Redistribution and use in source and binary forms, with or without 8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions 9 * modification, are permitted provided that the following conditions
@@ -62,7 +62,8 @@
62#include <openssl/x509.h> 62#include <openssl/x509.h>
63 63
64/* Minor tweak to operation: zero private key data */ 64/* Minor tweak to operation: zero private key data */
65static int pkey_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it) 65static int pkey_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it,
66 void *exarg)
66{ 67{
67 /* Since the structure must still be valid use ASN1_OP_FREE_PRE */ 68 /* Since the structure must still be valid use ASN1_OP_FREE_PRE */
68 if(operation == ASN1_OP_FREE_PRE) { 69 if(operation == ASN1_OP_FREE_PRE) {
@@ -82,3 +83,73 @@ ASN1_SEQUENCE_cb(PKCS8_PRIV_KEY_INFO, pkey_cb) = {
82} ASN1_SEQUENCE_END_cb(PKCS8_PRIV_KEY_INFO, PKCS8_PRIV_KEY_INFO) 83} ASN1_SEQUENCE_END_cb(PKCS8_PRIV_KEY_INFO, PKCS8_PRIV_KEY_INFO)
83 84
84IMPLEMENT_ASN1_FUNCTIONS(PKCS8_PRIV_KEY_INFO) 85IMPLEMENT_ASN1_FUNCTIONS(PKCS8_PRIV_KEY_INFO)
86
87int PKCS8_pkey_set0(PKCS8_PRIV_KEY_INFO *priv, ASN1_OBJECT *aobj,
88 int version,
89 int ptype, void *pval,
90 unsigned char *penc, int penclen)
91 {
92 unsigned char **ppenc = NULL;
93 if (version >= 0)
94 {
95 if (!ASN1_INTEGER_set(priv->version, version))
96 return 0;
97 }
98 if (penc)
99 {
100 int pmtype;
101 ASN1_OCTET_STRING *oct;
102 oct = ASN1_OCTET_STRING_new();
103 if (!oct)
104 return 0;
105 oct->data = penc;
106 ppenc = &oct->data;
107 oct->length = penclen;
108 if (priv->broken == PKCS8_NO_OCTET)
109 pmtype = V_ASN1_SEQUENCE;
110 else
111 pmtype = V_ASN1_OCTET_STRING;
112 ASN1_TYPE_set(priv->pkey, pmtype, oct);
113 }
114 if (!X509_ALGOR_set0(priv->pkeyalg, aobj, ptype, pval))
115 {
116 /* If call fails do not swallow 'enc' */
117 if (ppenc)
118 *ppenc = NULL;
119 return 0;
120 }
121 return 1;
122 }
123
124int PKCS8_pkey_get0(ASN1_OBJECT **ppkalg,
125 const unsigned char **pk, int *ppklen,
126 X509_ALGOR **pa,
127 PKCS8_PRIV_KEY_INFO *p8)
128 {
129 if (ppkalg)
130 *ppkalg = p8->pkeyalg->algorithm;
131 if(p8->pkey->type == V_ASN1_OCTET_STRING)
132 {
133 p8->broken = PKCS8_OK;
134 if (pk)
135 {
136 *pk = p8->pkey->value.octet_string->data;
137 *ppklen = p8->pkey->value.octet_string->length;
138 }
139 }
140 else if (p8->pkey->type == V_ASN1_SEQUENCE)
141 {
142 p8->broken = PKCS8_NO_OCTET;
143 if (pk)
144 {
145 *pk = p8->pkey->value.sequence->data;
146 *ppklen = p8->pkey->value.sequence->length;
147 }
148 }
149 else
150 return 0;
151 if (pa)
152 *pa = p8->pkeyalg;
153 return 1;
154 }
155
diff --git a/src/lib/libcrypto/asn1/t_pkey.c b/src/lib/libcrypto/asn1/t_pkey.c
index afb95d6712..9dd18f6579 100644
--- a/src/lib/libcrypto/asn1/t_pkey.c
+++ b/src/lib/libcrypto/asn1/t_pkey.c
@@ -55,520 +55,15 @@
55 * copied and put under another distribution licence 55 * copied and put under another distribution licence
56 * [including the GNU Public Licence.] 56 * [including the GNU Public Licence.]
57 */ 57 */
58/* ====================================================================
59 * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED.
60 * Binary polynomial ECC support in OpenSSL originally developed by
61 * SUN MICROSYSTEMS, INC., and contributed to the OpenSSL project.
62 */
63 58
64#include <stdio.h> 59#include <stdio.h>
65#include "cryptlib.h" 60#include "cryptlib.h"
66#include <openssl/objects.h> 61#include <openssl/objects.h>
67#include <openssl/buffer.h> 62#include <openssl/buffer.h>
68#include <openssl/bn.h> 63#include <openssl/bn.h>
69#ifndef OPENSSL_NO_RSA
70#include <openssl/rsa.h>
71#endif
72#ifndef OPENSSL_NO_DH
73#include <openssl/dh.h>
74#endif
75#ifndef OPENSSL_NO_DSA
76#include <openssl/dsa.h>
77#endif
78#ifndef OPENSSL_NO_EC
79#include <openssl/ec.h>
80#endif
81
82static int print(BIO *fp,const char *str, const BIGNUM *num,
83 unsigned char *buf,int off);
84#ifndef OPENSSL_NO_EC
85static int print_bin(BIO *fp, const char *str, const unsigned char *num,
86 size_t len, int off);
87#endif
88#ifndef OPENSSL_NO_RSA
89#ifndef OPENSSL_NO_FP_API
90int RSA_print_fp(FILE *fp, const RSA *x, int off)
91 {
92 BIO *b;
93 int ret;
94
95 if ((b=BIO_new(BIO_s_file())) == NULL)
96 {
97 RSAerr(RSA_F_RSA_PRINT_FP,ERR_R_BUF_LIB);
98 return(0);
99 }
100 BIO_set_fp(b,fp,BIO_NOCLOSE);
101 ret=RSA_print(b,x,off);
102 BIO_free(b);
103 return(ret);
104 }
105#endif
106
107int RSA_print(BIO *bp, const RSA *x, int off)
108 {
109 char str[128];
110 const char *s;
111 unsigned char *m=NULL;
112 int ret=0, mod_len = 0;
113 size_t buf_len=0, i;
114
115 if (x->n)
116 buf_len = (size_t)BN_num_bytes(x->n);
117 if (x->e)
118 if (buf_len < (i = (size_t)BN_num_bytes(x->e)))
119 buf_len = i;
120 if (x->d)
121 if (buf_len < (i = (size_t)BN_num_bytes(x->d)))
122 buf_len = i;
123 if (x->p)
124 if (buf_len < (i = (size_t)BN_num_bytes(x->p)))
125 buf_len = i;
126 if (x->q)
127 if (buf_len < (i = (size_t)BN_num_bytes(x->q)))
128 buf_len = i;
129 if (x->dmp1)
130 if (buf_len < (i = (size_t)BN_num_bytes(x->dmp1)))
131 buf_len = i;
132 if (x->dmq1)
133 if (buf_len < (i = (size_t)BN_num_bytes(x->dmq1)))
134 buf_len = i;
135 if (x->iqmp)
136 if (buf_len < (i = (size_t)BN_num_bytes(x->iqmp)))
137 buf_len = i;
138
139 m=(unsigned char *)OPENSSL_malloc(buf_len+10);
140 if (m == NULL)
141 {
142 RSAerr(RSA_F_RSA_PRINT,ERR_R_MALLOC_FAILURE);
143 goto err;
144 }
145
146 if (x->n != NULL)
147 mod_len = BN_num_bits(x->n);
148
149 if (x->d != NULL)
150 {
151 if(!BIO_indent(bp,off,128))
152 goto err;
153 if (BIO_printf(bp,"Private-Key: (%d bit)\n", mod_len)
154 <= 0) goto err;
155 }
156
157 if (x->d == NULL)
158 BIO_snprintf(str,sizeof str,"Modulus (%d bit):", mod_len);
159 else
160 BUF_strlcpy(str,"modulus:",sizeof str);
161 if (!print(bp,str,x->n,m,off)) goto err;
162 s=(x->d == NULL)?"Exponent:":"publicExponent:";
163 if ((x->e != NULL) && !print(bp,s,x->e,m,off))
164 goto err;
165 if ((x->d != NULL) && !print(bp,"privateExponent:",x->d,m,off))
166 goto err;
167 if ((x->p != NULL) && !print(bp,"prime1:",x->p,m,off))
168 goto err;
169 if ((x->q != NULL) && !print(bp,"prime2:",x->q,m,off))
170 goto err;
171 if ((x->dmp1 != NULL) && !print(bp,"exponent1:",x->dmp1,m,off))
172 goto err;
173 if ((x->dmq1 != NULL) && !print(bp,"exponent2:",x->dmq1,m,off))
174 goto err;
175 if ((x->iqmp != NULL) && !print(bp,"coefficient:",x->iqmp,m,off))
176 goto err;
177 ret=1;
178err:
179 if (m != NULL) OPENSSL_free(m);
180 return(ret);
181 }
182#endif /* OPENSSL_NO_RSA */
183
184#ifndef OPENSSL_NO_DSA
185#ifndef OPENSSL_NO_FP_API
186int DSA_print_fp(FILE *fp, const DSA *x, int off)
187 {
188 BIO *b;
189 int ret;
190
191 if ((b=BIO_new(BIO_s_file())) == NULL)
192 {
193 DSAerr(DSA_F_DSA_PRINT_FP,ERR_R_BUF_LIB);
194 return(0);
195 }
196 BIO_set_fp(b,fp,BIO_NOCLOSE);
197 ret=DSA_print(b,x,off);
198 BIO_free(b);
199 return(ret);
200 }
201#endif
202
203int DSA_print(BIO *bp, const DSA *x, int off)
204 {
205 unsigned char *m=NULL;
206 int ret=0;
207 size_t buf_len=0,i;
208
209 if (x->p)
210 buf_len = (size_t)BN_num_bytes(x->p);
211 else
212 {
213 DSAerr(DSA_F_DSA_PRINT,DSA_R_MISSING_PARAMETERS);
214 goto err;
215 }
216 if (x->q)
217 if (buf_len < (i = (size_t)BN_num_bytes(x->q)))
218 buf_len = i;
219 if (x->g)
220 if (buf_len < (i = (size_t)BN_num_bytes(x->g)))
221 buf_len = i;
222 if (x->priv_key)
223 if (buf_len < (i = (size_t)BN_num_bytes(x->priv_key)))
224 buf_len = i;
225 if (x->pub_key)
226 if (buf_len < (i = (size_t)BN_num_bytes(x->pub_key)))
227 buf_len = i;
228
229 m=(unsigned char *)OPENSSL_malloc(buf_len+10);
230 if (m == NULL)
231 {
232 DSAerr(DSA_F_DSA_PRINT,ERR_R_MALLOC_FAILURE);
233 goto err;
234 }
235
236 if (x->priv_key != NULL)
237 {
238 if(!BIO_indent(bp,off,128))
239 goto err;
240 if (BIO_printf(bp,"Private-Key: (%d bit)\n",BN_num_bits(x->p))
241 <= 0) goto err;
242 }
243
244 if ((x->priv_key != NULL) && !print(bp,"priv:",x->priv_key,m,off))
245 goto err;
246 if ((x->pub_key != NULL) && !print(bp,"pub: ",x->pub_key,m,off))
247 goto err;
248 if ((x->p != NULL) && !print(bp,"P: ",x->p,m,off)) goto err;
249 if ((x->q != NULL) && !print(bp,"Q: ",x->q,m,off)) goto err;
250 if ((x->g != NULL) && !print(bp,"G: ",x->g,m,off)) goto err;
251 ret=1;
252err:
253 if (m != NULL) OPENSSL_free(m);
254 return(ret);
255 }
256#endif /* !OPENSSL_NO_DSA */
257
258#ifndef OPENSSL_NO_EC
259#ifndef OPENSSL_NO_FP_API
260int ECPKParameters_print_fp(FILE *fp, const EC_GROUP *x, int off)
261 {
262 BIO *b;
263 int ret;
264
265 if ((b=BIO_new(BIO_s_file())) == NULL)
266 {
267 ECerr(EC_F_ECPKPARAMETERS_PRINT_FP,ERR_R_BUF_LIB);
268 return(0);
269 }
270 BIO_set_fp(b, fp, BIO_NOCLOSE);
271 ret = ECPKParameters_print(b, x, off);
272 BIO_free(b);
273 return(ret);
274 }
275
276int EC_KEY_print_fp(FILE *fp, const EC_KEY *x, int off)
277 {
278 BIO *b;
279 int ret;
280
281 if ((b=BIO_new(BIO_s_file())) == NULL)
282 {
283 ECerr(EC_F_EC_KEY_PRINT_FP, ERR_R_BIO_LIB);
284 return(0);
285 }
286 BIO_set_fp(b, fp, BIO_NOCLOSE);
287 ret = EC_KEY_print(b, x, off);
288 BIO_free(b);
289 return(ret);
290 }
291#endif
292
293int ECPKParameters_print(BIO *bp, const EC_GROUP *x, int off)
294 {
295 unsigned char *buffer=NULL;
296 size_t buf_len=0, i;
297 int ret=0, reason=ERR_R_BIO_LIB;
298 BN_CTX *ctx=NULL;
299 const EC_POINT *point=NULL;
300 BIGNUM *p=NULL, *a=NULL, *b=NULL, *gen=NULL,
301 *order=NULL, *cofactor=NULL;
302 const unsigned char *seed;
303 size_t seed_len=0;
304
305 static const char *gen_compressed = "Generator (compressed):";
306 static const char *gen_uncompressed = "Generator (uncompressed):";
307 static const char *gen_hybrid = "Generator (hybrid):";
308
309 if (!x)
310 {
311 reason = ERR_R_PASSED_NULL_PARAMETER;
312 goto err;
313 }
314
315 if (EC_GROUP_get_asn1_flag(x))
316 {
317 /* the curve parameter are given by an asn1 OID */
318 int nid;
319
320 if (!BIO_indent(bp, off, 128))
321 goto err;
322
323 nid = EC_GROUP_get_curve_name(x);
324 if (nid == 0)
325 goto err;
326
327 if (BIO_printf(bp, "ASN1 OID: %s", OBJ_nid2sn(nid)) <= 0)
328 goto err;
329 if (BIO_printf(bp, "\n") <= 0)
330 goto err;
331 }
332 else
333 {
334 /* explicit parameters */
335 int is_char_two = 0;
336 point_conversion_form_t form;
337 int tmp_nid = EC_METHOD_get_field_type(EC_GROUP_method_of(x));
338
339 if (tmp_nid == NID_X9_62_characteristic_two_field)
340 is_char_two = 1;
341
342 if ((p = BN_new()) == NULL || (a = BN_new()) == NULL ||
343 (b = BN_new()) == NULL || (order = BN_new()) == NULL ||
344 (cofactor = BN_new()) == NULL)
345 {
346 reason = ERR_R_MALLOC_FAILURE;
347 goto err;
348 }
349
350 if (is_char_two)
351 {
352 if (!EC_GROUP_get_curve_GF2m(x, p, a, b, ctx))
353 {
354 reason = ERR_R_EC_LIB;
355 goto err;
356 }
357 }
358 else /* prime field */
359 {
360 if (!EC_GROUP_get_curve_GFp(x, p, a, b, ctx))
361 {
362 reason = ERR_R_EC_LIB;
363 goto err;
364 }
365 }
366
367 if ((point = EC_GROUP_get0_generator(x)) == NULL)
368 {
369 reason = ERR_R_EC_LIB;
370 goto err;
371 }
372 if (!EC_GROUP_get_order(x, order, NULL) ||
373 !EC_GROUP_get_cofactor(x, cofactor, NULL))
374 {
375 reason = ERR_R_EC_LIB;
376 goto err;
377 }
378
379 form = EC_GROUP_get_point_conversion_form(x);
380
381 if ((gen = EC_POINT_point2bn(x, point,
382 form, NULL, ctx)) == NULL)
383 {
384 reason = ERR_R_EC_LIB;
385 goto err;
386 }
387
388 buf_len = (size_t)BN_num_bytes(p);
389 if (buf_len < (i = (size_t)BN_num_bytes(a)))
390 buf_len = i;
391 if (buf_len < (i = (size_t)BN_num_bytes(b)))
392 buf_len = i;
393 if (buf_len < (i = (size_t)BN_num_bytes(gen)))
394 buf_len = i;
395 if (buf_len < (i = (size_t)BN_num_bytes(order)))
396 buf_len = i;
397 if (buf_len < (i = (size_t)BN_num_bytes(cofactor)))
398 buf_len = i;
399
400 if ((seed = EC_GROUP_get0_seed(x)) != NULL)
401 seed_len = EC_GROUP_get_seed_len(x);
402
403 buf_len += 10;
404 if ((buffer = OPENSSL_malloc(buf_len)) == NULL)
405 {
406 reason = ERR_R_MALLOC_FAILURE;
407 goto err;
408 }
409
410 if (!BIO_indent(bp, off, 128))
411 goto err;
412
413 /* print the 'short name' of the field type */
414 if (BIO_printf(bp, "Field Type: %s\n", OBJ_nid2sn(tmp_nid))
415 <= 0)
416 goto err;
417
418 if (is_char_two)
419 {
420 /* print the 'short name' of the base type OID */
421 int basis_type = EC_GROUP_get_basis_type(x);
422 if (basis_type == 0)
423 goto err;
424
425 if (!BIO_indent(bp, off, 128))
426 goto err;
427
428 if (BIO_printf(bp, "Basis Type: %s\n",
429 OBJ_nid2sn(basis_type)) <= 0)
430 goto err;
431
432 /* print the polynomial */
433 if ((p != NULL) && !print(bp, "Polynomial:", p, buffer,
434 off))
435 goto err;
436 }
437 else
438 {
439 if ((p != NULL) && !print(bp, "Prime:", p, buffer,off))
440 goto err;
441 }
442 if ((a != NULL) && !print(bp, "A: ", a, buffer, off))
443 goto err;
444 if ((b != NULL) && !print(bp, "B: ", b, buffer, off))
445 goto err;
446 if (form == POINT_CONVERSION_COMPRESSED)
447 {
448 if ((gen != NULL) && !print(bp, gen_compressed, gen,
449 buffer, off))
450 goto err;
451 }
452 else if (form == POINT_CONVERSION_UNCOMPRESSED)
453 {
454 if ((gen != NULL) && !print(bp, gen_uncompressed, gen,
455 buffer, off))
456 goto err;
457 }
458 else /* form == POINT_CONVERSION_HYBRID */
459 {
460 if ((gen != NULL) && !print(bp, gen_hybrid, gen,
461 buffer, off))
462 goto err;
463 }
464 if ((order != NULL) && !print(bp, "Order: ", order,
465 buffer, off)) goto err;
466 if ((cofactor != NULL) && !print(bp, "Cofactor: ", cofactor,
467 buffer, off)) goto err;
468 if (seed && !print_bin(bp, "Seed:", seed, seed_len, off))
469 goto err;
470 }
471 ret=1;
472err:
473 if (!ret)
474 ECerr(EC_F_ECPKPARAMETERS_PRINT, reason);
475 if (p)
476 BN_free(p);
477 if (a)
478 BN_free(a);
479 if (b)
480 BN_free(b);
481 if (gen)
482 BN_free(gen);
483 if (order)
484 BN_free(order);
485 if (cofactor)
486 BN_free(cofactor);
487 if (ctx)
488 BN_CTX_free(ctx);
489 if (buffer != NULL)
490 OPENSSL_free(buffer);
491 return(ret);
492 }
493 64
494int EC_KEY_print(BIO *bp, const EC_KEY *x, int off) 65int ASN1_bn_print(BIO *bp, const char *number, const BIGNUM *num,
495 { 66 unsigned char *buf, int off)
496 unsigned char *buffer=NULL;
497 size_t buf_len=0, i;
498 int ret=0, reason=ERR_R_BIO_LIB;
499 BIGNUM *pub_key=NULL, *order=NULL;
500 BN_CTX *ctx=NULL;
501 const EC_GROUP *group;
502 const EC_POINT *public_key;
503 const BIGNUM *priv_key;
504
505 if (x == NULL || (group = EC_KEY_get0_group(x)) == NULL)
506 {
507 reason = ERR_R_PASSED_NULL_PARAMETER;
508 goto err;
509 }
510
511 public_key = EC_KEY_get0_public_key(x);
512 if ((pub_key = EC_POINT_point2bn(group, public_key,
513 EC_KEY_get_conv_form(x), NULL, ctx)) == NULL)
514 {
515 reason = ERR_R_EC_LIB;
516 goto err;
517 }
518
519 buf_len = (size_t)BN_num_bytes(pub_key);
520 priv_key = EC_KEY_get0_private_key(x);
521 if (priv_key != NULL)
522 {
523 if ((i = (size_t)BN_num_bytes(priv_key)) > buf_len)
524 buf_len = i;
525 }
526
527 buf_len += 10;
528 if ((buffer = OPENSSL_malloc(buf_len)) == NULL)
529 {
530 reason = ERR_R_MALLOC_FAILURE;
531 goto err;
532 }
533
534 if (priv_key != NULL)
535 {
536 if (!BIO_indent(bp, off, 128))
537 goto err;
538 if ((order = BN_new()) == NULL)
539 goto err;
540 if (!EC_GROUP_get_order(group, order, NULL))
541 goto err;
542 if (BIO_printf(bp, "Private-Key: (%d bit)\n",
543 BN_num_bits(order)) <= 0) goto err;
544 }
545
546 if ((priv_key != NULL) && !print(bp, "priv:", priv_key,
547 buffer, off))
548 goto err;
549 if ((pub_key != NULL) && !print(bp, "pub: ", pub_key,
550 buffer, off))
551 goto err;
552 if (!ECPKParameters_print(bp, group, off))
553 goto err;
554 ret=1;
555err:
556 if (!ret)
557 ECerr(EC_F_EC_KEY_PRINT, reason);
558 if (pub_key)
559 BN_free(pub_key);
560 if (order)
561 BN_free(order);
562 if (ctx)
563 BN_CTX_free(ctx);
564 if (buffer != NULL)
565 OPENSSL_free(buffer);
566 return(ret);
567 }
568#endif /* OPENSSL_NO_EC */
569
570static int print(BIO *bp, const char *number, const BIGNUM *num, unsigned char *buf,
571 int off)
572 { 67 {
573 int n,i; 68 int n,i;
574 const char *neg; 69 const char *neg;
@@ -617,223 +112,3 @@ static int print(BIO *bp, const char *number, const BIGNUM *num, unsigned char *
617 } 112 }
618 return(1); 113 return(1);
619 } 114 }
620
621#ifndef OPENSSL_NO_EC
622static int print_bin(BIO *fp, const char *name, const unsigned char *buf,
623 size_t len, int off)
624 {
625 size_t i;
626 char str[128];
627
628 if (buf == NULL)
629 return 1;
630 if (off)
631 {
632 if (off > 128)
633 off=128;
634 memset(str,' ',off);
635 if (BIO_write(fp, str, off) <= 0)
636 return 0;
637 }
638
639 if (BIO_printf(fp,"%s", name) <= 0)
640 return 0;
641
642 for (i=0; i<len; i++)
643 {
644 if ((i%15) == 0)
645 {
646 str[0]='\n';
647 memset(&(str[1]),' ',off+4);
648 if (BIO_write(fp, str, off+1+4) <= 0)
649 return 0;
650 }
651 if (BIO_printf(fp,"%02x%s",buf[i],((i+1) == len)?"":":") <= 0)
652 return 0;
653 }
654 if (BIO_write(fp,"\n",1) <= 0)
655 return 0;
656
657 return 1;
658 }
659#endif
660
661#ifndef OPENSSL_NO_DH
662#ifndef OPENSSL_NO_FP_API
663int DHparams_print_fp(FILE *fp, const DH *x)
664 {
665 BIO *b;
666 int ret;
667
668 if ((b=BIO_new(BIO_s_file())) == NULL)
669 {
670 DHerr(DH_F_DHPARAMS_PRINT_FP,ERR_R_BUF_LIB);
671 return(0);
672 }
673 BIO_set_fp(b,fp,BIO_NOCLOSE);
674 ret=DHparams_print(b, x);
675 BIO_free(b);
676 return(ret);
677 }
678#endif
679
680int DHparams_print(BIO *bp, const DH *x)
681 {
682 unsigned char *m=NULL;
683 int reason=ERR_R_BUF_LIB,ret=0;
684 size_t buf_len=0, i;
685
686 if (x->p)
687 buf_len = (size_t)BN_num_bytes(x->p);
688 else
689 {
690 reason = ERR_R_PASSED_NULL_PARAMETER;
691 goto err;
692 }
693 if (x->g)
694 if (buf_len < (i = (size_t)BN_num_bytes(x->g)))
695 buf_len = i;
696 m=(unsigned char *)OPENSSL_malloc(buf_len+10);
697 if (m == NULL)
698 {
699 reason=ERR_R_MALLOC_FAILURE;
700 goto err;
701 }
702
703 if (BIO_printf(bp,"Diffie-Hellman-Parameters: (%d bit)\n",
704 BN_num_bits(x->p)) <= 0)
705 goto err;
706 if (!print(bp,"prime:",x->p,m,4)) goto err;
707 if (!print(bp,"generator:",x->g,m,4)) goto err;
708 if (x->length != 0)
709 {
710 if (BIO_printf(bp," recommended-private-length: %d bits\n",
711 (int)x->length) <= 0) goto err;
712 }
713 ret=1;
714 if (0)
715 {
716err:
717 DHerr(DH_F_DHPARAMS_PRINT,reason);
718 }
719 if (m != NULL) OPENSSL_free(m);
720 return(ret);
721 }
722#endif
723
724#ifndef OPENSSL_NO_DSA
725#ifndef OPENSSL_NO_FP_API
726int DSAparams_print_fp(FILE *fp, const DSA *x)
727 {
728 BIO *b;
729 int ret;
730
731 if ((b=BIO_new(BIO_s_file())) == NULL)
732 {
733 DSAerr(DSA_F_DSAPARAMS_PRINT_FP,ERR_R_BUF_LIB);
734 return(0);
735 }
736 BIO_set_fp(b,fp,BIO_NOCLOSE);
737 ret=DSAparams_print(b, x);
738 BIO_free(b);
739 return(ret);
740 }
741#endif
742
743int DSAparams_print(BIO *bp, const DSA *x)
744 {
745 unsigned char *m=NULL;
746 int ret=0;
747 size_t buf_len=0,i;
748
749 if (x->p)
750 buf_len = (size_t)BN_num_bytes(x->p);
751 else
752 {
753 DSAerr(DSA_F_DSAPARAMS_PRINT,DSA_R_MISSING_PARAMETERS);
754 goto err;
755 }
756 if (x->q)
757 if (buf_len < (i = (size_t)BN_num_bytes(x->q)))
758 buf_len = i;
759 if (x->g)
760 if (buf_len < (i = (size_t)BN_num_bytes(x->g)))
761 buf_len = i;
762 m=(unsigned char *)OPENSSL_malloc(buf_len+10);
763 if (m == NULL)
764 {
765 DSAerr(DSA_F_DSAPARAMS_PRINT,ERR_R_MALLOC_FAILURE);
766 goto err;
767 }
768
769 if (BIO_printf(bp,"DSA-Parameters: (%d bit)\n",
770 BN_num_bits(x->p)) <= 0)
771 goto err;
772 if (!print(bp,"p:",x->p,m,4)) goto err;
773 if ((x->q != NULL) && !print(bp,"q:",x->q,m,4)) goto err;
774 if ((x->g != NULL) && !print(bp,"g:",x->g,m,4)) goto err;
775 ret=1;
776err:
777 if (m != NULL) OPENSSL_free(m);
778 return(ret);
779 }
780
781#endif /* !OPENSSL_NO_DSA */
782
783#ifndef OPENSSL_NO_EC
784#ifndef OPENSSL_NO_FP_API
785int ECParameters_print_fp(FILE *fp, const EC_KEY *x)
786 {
787 BIO *b;
788 int ret;
789
790 if ((b=BIO_new(BIO_s_file())) == NULL)
791 {
792 ECerr(EC_F_ECPARAMETERS_PRINT_FP, ERR_R_BIO_LIB);
793 return(0);
794 }
795 BIO_set_fp(b, fp, BIO_NOCLOSE);
796 ret = ECParameters_print(b, x);
797 BIO_free(b);
798 return(ret);
799 }
800#endif
801
802int ECParameters_print(BIO *bp, const EC_KEY *x)
803 {
804 int reason=ERR_R_EC_LIB, ret=0;
805 BIGNUM *order=NULL;
806 const EC_GROUP *group;
807
808 if (x == NULL || (group = EC_KEY_get0_group(x)) == NULL)
809 {
810 reason = ERR_R_PASSED_NULL_PARAMETER;;
811 goto err;
812 }
813
814 if ((order = BN_new()) == NULL)
815 {
816 reason = ERR_R_MALLOC_FAILURE;
817 goto err;
818 }
819
820 if (!EC_GROUP_get_order(group, order, NULL))
821 {
822 reason = ERR_R_EC_LIB;
823 goto err;
824 }
825
826 if (BIO_printf(bp, "ECDSA-Parameters: (%d bit)\n",
827 BN_num_bits(order)) <= 0)
828 goto err;
829 if (!ECPKParameters_print(bp, group, 4))
830 goto err;
831 ret=1;
832err:
833 if (order)
834 BN_free(order);
835 ECerr(EC_F_ECPARAMETERS_PRINT, reason);
836 return(ret);
837 }
838
839#endif
diff --git a/src/lib/libcrypto/asn1/t_req.c b/src/lib/libcrypto/asn1/t_req.c
index 5557e06584..ea1794e3e0 100644
--- a/src/lib/libcrypto/asn1/t_req.c
+++ b/src/lib/libcrypto/asn1/t_req.c
@@ -149,34 +149,10 @@ int X509_REQ_print_ex(BIO *bp, X509_REQ *x, unsigned long nmflags, unsigned long
149 ERR_print_errors(bp); 149 ERR_print_errors(bp);
150 } 150 }
151 else 151 else
152#ifndef OPENSSL_NO_RSA
153 if (pkey->type == EVP_PKEY_RSA)
154 {
155 BIO_printf(bp,"%12sRSA Public Key: (%d bit)\n","",
156 BN_num_bits(pkey->pkey.rsa->n));
157 RSA_print(bp,pkey->pkey.rsa,16);
158 }
159 else
160#endif
161#ifndef OPENSSL_NO_DSA
162 if (pkey->type == EVP_PKEY_DSA)
163 { 152 {
164 BIO_printf(bp,"%12sDSA Public Key:\n",""); 153 EVP_PKEY_print_public(bp, pkey, 16, NULL);
165 DSA_print(bp,pkey->pkey.dsa,16); 154 EVP_PKEY_free(pkey);
166 } 155 }
167 else
168#endif
169#ifndef OPENSSL_NO_EC
170 if (pkey->type == EVP_PKEY_EC)
171 {
172 BIO_printf(bp, "%12sEC Public Key: \n","");
173 EC_KEY_print(bp, pkey->pkey.ec, 16);
174 }
175 else
176#endif
177 BIO_printf(bp,"%12sUnknown Public Key:\n","");
178
179 EVP_PKEY_free(pkey);
180 } 156 }
181 157
182 if(!(cflag & X509_FLAG_NO_ATTRIBUTES)) 158 if(!(cflag & X509_FLAG_NO_ATTRIBUTES))
diff --git a/src/lib/libcrypto/asn1/t_spki.c b/src/lib/libcrypto/asn1/t_spki.c
index a73369b949..079c081a81 100644
--- a/src/lib/libcrypto/asn1/t_spki.c
+++ b/src/lib/libcrypto/asn1/t_spki.c
@@ -82,36 +82,11 @@ int NETSCAPE_SPKI_print(BIO *out, NETSCAPE_SPKI *spki)
82 (i == NID_undef)?"UNKNOWN":OBJ_nid2ln(i)); 82 (i == NID_undef)?"UNKNOWN":OBJ_nid2ln(i));
83 pkey = X509_PUBKEY_get(spki->spkac->pubkey); 83 pkey = X509_PUBKEY_get(spki->spkac->pubkey);
84 if(!pkey) BIO_printf(out, " Unable to load public key\n"); 84 if(!pkey) BIO_printf(out, " Unable to load public key\n");
85 else { 85 else
86#ifndef OPENSSL_NO_RSA
87 if (pkey->type == EVP_PKEY_RSA)
88 {
89 BIO_printf(out," RSA Public Key: (%d bit)\n",
90 BN_num_bits(pkey->pkey.rsa->n));
91 RSA_print(out,pkey->pkey.rsa,2);
92 }
93 else
94#endif
95#ifndef OPENSSL_NO_DSA
96 if (pkey->type == EVP_PKEY_DSA)
97 {
98 BIO_printf(out," DSA Public Key:\n");
99 DSA_print(out,pkey->pkey.dsa,2);
100 }
101 else
102#endif
103#ifndef OPENSSL_NO_EC
104 if (pkey->type == EVP_PKEY_EC)
105 { 86 {
106 BIO_printf(out, " EC Public Key:\n"); 87 EVP_PKEY_print_public(out, pkey, 4, NULL);
107 EC_KEY_print(out, pkey->pkey.ec,2);
108 }
109 else
110#endif
111
112 BIO_printf(out," Unknown Public Key:\n");
113 EVP_PKEY_free(pkey); 88 EVP_PKEY_free(pkey);
114 } 89 }
115 chal = spki->spkac->challenge; 90 chal = spki->spkac->challenge;
116 if(chal->length) 91 if(chal->length)
117 BIO_printf(out, " Challenge String: %s\n", chal->data); 92 BIO_printf(out, " Challenge String: %s\n", chal->data);
diff --git a/src/lib/libcrypto/asn1/t_x509.c b/src/lib/libcrypto/asn1/t_x509.c
index 8f746f9c05..e061f2ffad 100644
--- a/src/lib/libcrypto/asn1/t_x509.c
+++ b/src/lib/libcrypto/asn1/t_x509.c
@@ -111,7 +111,6 @@ int X509_print_ex(BIO *bp, X509 *x, unsigned long nmflags, unsigned long cflag)
111 ASN1_INTEGER *bs; 111 ASN1_INTEGER *bs;
112 EVP_PKEY *pkey=NULL; 112 EVP_PKEY *pkey=NULL;
113 const char *neg; 113 const char *neg;
114 ASN1_STRING *str=NULL;
115 114
116 if((nmflags & XN_FLAG_SEP_MASK) == XN_FLAG_SEP_MULTILINE) { 115 if((nmflags & XN_FLAG_SEP_MASK) == XN_FLAG_SEP_MULTILINE) {
117 mlch = '\n'; 116 mlch = '\n';
@@ -215,34 +214,10 @@ int X509_print_ex(BIO *bp, X509 *x, unsigned long nmflags, unsigned long cflag)
215 ERR_print_errors(bp); 214 ERR_print_errors(bp);
216 } 215 }
217 else 216 else
218#ifndef OPENSSL_NO_RSA
219 if (pkey->type == EVP_PKEY_RSA)
220 {
221 BIO_printf(bp,"%12sRSA Public Key: (%d bit)\n","",
222 BN_num_bits(pkey->pkey.rsa->n));
223 RSA_print(bp,pkey->pkey.rsa,16);
224 }
225 else
226#endif
227#ifndef OPENSSL_NO_DSA
228 if (pkey->type == EVP_PKEY_DSA)
229 {
230 BIO_printf(bp,"%12sDSA Public Key:\n","");
231 DSA_print(bp,pkey->pkey.dsa,16);
232 }
233 else
234#endif
235#ifndef OPENSSL_NO_EC
236 if (pkey->type == EVP_PKEY_EC)
237 { 217 {
238 BIO_printf(bp, "%12sEC Public Key:\n",""); 218 EVP_PKEY_print_public(bp, pkey, 16, NULL);
239 EC_KEY_print(bp, pkey->pkey.ec, 16); 219 EVP_PKEY_free(pkey);
240 } 220 }
241 else
242#endif
243 BIO_printf(bp,"%12sUnknown Public Key:\n","");
244
245 EVP_PKEY_free(pkey);
246 } 221 }
247 222
248 if (!(cflag & X509_FLAG_NO_EXTENSIONS)) 223 if (!(cflag & X509_FLAG_NO_EXTENSIONS))
@@ -259,7 +234,6 @@ int X509_print_ex(BIO *bp, X509 *x, unsigned long nmflags, unsigned long cflag)
259 } 234 }
260 ret=1; 235 ret=1;
261err: 236err:
262 if (str != NULL) ASN1_STRING_free(str);
263 if (m != NULL) OPENSSL_free(m); 237 if (m != NULL) OPENSSL_free(m);
264 return(ret); 238 return(ret);
265 } 239 }
@@ -329,14 +303,15 @@ int X509_signature_print(BIO *bp, X509_ALGOR *sigalg, ASN1_STRING *sig)
329 return 1; 303 return 1;
330} 304}
331 305
332int ASN1_STRING_print(BIO *bp, ASN1_STRING *v) 306int ASN1_STRING_print(BIO *bp, const ASN1_STRING *v)
333 { 307 {
334 int i,n; 308 int i,n;
335 char buf[80],*p; 309 char buf[80];
310 const char *p;
336 311
337 if (v == NULL) return(0); 312 if (v == NULL) return(0);
338 n=0; 313 n=0;
339 p=(char *)v->data; 314 p=(const char *)v->data;
340 for (i=0; i<v->length; i++) 315 for (i=0; i<v->length; i++)
341 { 316 {
342 if ((p[i] > '~') || ((p[i] < ' ') && 317 if ((p[i] > '~') || ((p[i] < ' ') &&
@@ -358,7 +333,7 @@ int ASN1_STRING_print(BIO *bp, ASN1_STRING *v)
358 return(1); 333 return(1);
359 } 334 }
360 335
361int ASN1_TIME_print(BIO *bp, ASN1_TIME *tm) 336int ASN1_TIME_print(BIO *bp, const ASN1_TIME *tm)
362{ 337{
363 if(tm->type == V_ASN1_UTCTIME) return ASN1_UTCTIME_print(bp, tm); 338 if(tm->type == V_ASN1_UTCTIME) return ASN1_UTCTIME_print(bp, tm);
364 if(tm->type == V_ASN1_GENERALIZEDTIME) 339 if(tm->type == V_ASN1_GENERALIZEDTIME)
@@ -373,12 +348,14 @@ static const char *mon[12]=
373 "Jul","Aug","Sep","Oct","Nov","Dec" 348 "Jul","Aug","Sep","Oct","Nov","Dec"
374 }; 349 };
375 350
376int ASN1_GENERALIZEDTIME_print(BIO *bp, ASN1_GENERALIZEDTIME *tm) 351int ASN1_GENERALIZEDTIME_print(BIO *bp, const ASN1_GENERALIZEDTIME *tm)
377 { 352 {
378 char *v; 353 char *v;
379 int gmt=0; 354 int gmt=0;
380 int i; 355 int i;
381 int y=0,M=0,d=0,h=0,m=0,s=0; 356 int y=0,M=0,d=0,h=0,m=0,s=0;
357 char *f = NULL;
358 int f_len = 0;
382 359
383 i=tm->length; 360 i=tm->length;
384 v=(char *)tm->data; 361 v=(char *)tm->data;
@@ -396,10 +373,21 @@ int ASN1_GENERALIZEDTIME_print(BIO *bp, ASN1_GENERALIZEDTIME *tm)
396 if (tm->length >= 14 && 373 if (tm->length >= 14 &&
397 (v[12] >= '0') && (v[12] <= '9') && 374 (v[12] >= '0') && (v[12] <= '9') &&
398 (v[13] >= '0') && (v[13] <= '9')) 375 (v[13] >= '0') && (v[13] <= '9'))
376 {
399 s= (v[12]-'0')*10+(v[13]-'0'); 377 s= (v[12]-'0')*10+(v[13]-'0');
378 /* Check for fractions of seconds. */
379 if (tm->length >= 15 && v[14] == '.')
380 {
381 int l = tm->length;
382 f = &v[14]; /* The decimal point. */
383 f_len = 1;
384 while (14 + f_len < l && f[f_len] >= '0' && f[f_len] <= '9')
385 ++f_len;
386 }
387 }
400 388
401 if (BIO_printf(bp,"%s %2d %02d:%02d:%02d %d%s", 389 if (BIO_printf(bp,"%s %2d %02d:%02d:%02d%.*s %d%s",
402 mon[M-1],d,h,m,s,y,(gmt)?" GMT":"") <= 0) 390 mon[M-1],d,h,m,s,f_len,f,y,(gmt)?" GMT":"") <= 0)
403 return(0); 391 return(0);
404 else 392 else
405 return(1); 393 return(1);
@@ -408,15 +396,15 @@ err:
408 return(0); 396 return(0);
409 } 397 }
410 398
411int ASN1_UTCTIME_print(BIO *bp, ASN1_UTCTIME *tm) 399int ASN1_UTCTIME_print(BIO *bp, const ASN1_UTCTIME *tm)
412 { 400 {
413 char *v; 401 const char *v;
414 int gmt=0; 402 int gmt=0;
415 int i; 403 int i;
416 int y=0,M=0,d=0,h=0,m=0,s=0; 404 int y=0,M=0,d=0,h=0,m=0,s=0;
417 405
418 i=tm->length; 406 i=tm->length;
419 v=(char *)tm->data; 407 v=(const char *)tm->data;
420 408
421 if (i < 10) goto err; 409 if (i < 10) goto err;
422 if (v[i-1] == 'Z') gmt=1; 410 if (v[i-1] == 'Z') gmt=1;
diff --git a/src/lib/libcrypto/asn1/tasn_dec.c b/src/lib/libcrypto/asn1/tasn_dec.c
index 48bc1c0d4d..3bee439968 100644
--- a/src/lib/libcrypto/asn1/tasn_dec.c
+++ b/src/lib/libcrypto/asn1/tasn_dec.c
@@ -114,6 +114,8 @@ unsigned long ASN1_tag2bit(int tag)
114/* Macro to initialize and invalidate the cache */ 114/* Macro to initialize and invalidate the cache */
115 115
116#define asn1_tlc_clear(c) if (c) (c)->valid = 0 116#define asn1_tlc_clear(c) if (c) (c)->valid = 0
117/* Version to avoid compiler warning about 'c' always non-NULL */
118#define asn1_tlc_clear_nc(c) (c)->valid = 0
117 119
118/* Decode an ASN1 item, this currently behaves just 120/* Decode an ASN1 item, this currently behaves just
119 * like a standard 'd2i' function. 'in' points to 121 * like a standard 'd2i' function. 'in' points to
@@ -130,7 +132,7 @@ ASN1_VALUE *ASN1_item_d2i(ASN1_VALUE **pval,
130 ASN1_VALUE *ptmpval = NULL; 132 ASN1_VALUE *ptmpval = NULL;
131 if (!pval) 133 if (!pval)
132 pval = &ptmpval; 134 pval = &ptmpval;
133 c.valid = 0; 135 asn1_tlc_clear_nc(&c);
134 if (ASN1_item_ex_d2i(pval, in, len, it, -1, 0, 0, &c) > 0) 136 if (ASN1_item_ex_d2i(pval, in, len, it, -1, 0, 0, &c) > 0)
135 return *pval; 137 return *pval;
136 return NULL; 138 return NULL;
@@ -140,7 +142,7 @@ int ASN1_template_d2i(ASN1_VALUE **pval,
140 const unsigned char **in, long len, const ASN1_TEMPLATE *tt) 142 const unsigned char **in, long len, const ASN1_TEMPLATE *tt)
141 { 143 {
142 ASN1_TLC c; 144 ASN1_TLC c;
143 c.valid = 0; 145 asn1_tlc_clear_nc(&c);
144 return asn1_template_ex_d2i(pval, in, len, tt, 0, &c); 146 return asn1_template_ex_d2i(pval, in, len, tt, 0, &c);
145 } 147 }
146 148
@@ -306,7 +308,7 @@ int ASN1_item_ex_d2i(ASN1_VALUE **pval, const unsigned char **in, long len,
306 308
307 309
308 case ASN1_ITYPE_CHOICE: 310 case ASN1_ITYPE_CHOICE:
309 if (asn1_cb && !asn1_cb(ASN1_OP_D2I_PRE, pval, it)) 311 if (asn1_cb && !asn1_cb(ASN1_OP_D2I_PRE, pval, it, NULL))
310 goto auxerr; 312 goto auxerr;
311 313
312 /* Allocate structure */ 314 /* Allocate structure */
@@ -356,7 +358,7 @@ int ASN1_item_ex_d2i(ASN1_VALUE **pval, const unsigned char **in, long len,
356 358
357 asn1_set_choice_selector(pval, i, it); 359 asn1_set_choice_selector(pval, i, it);
358 *in = p; 360 *in = p;
359 if (asn1_cb && !asn1_cb(ASN1_OP_D2I_POST, pval, it)) 361 if (asn1_cb && !asn1_cb(ASN1_OP_D2I_POST, pval, it, NULL))
360 goto auxerr; 362 goto auxerr;
361 return 1; 363 return 1;
362 364
@@ -403,7 +405,7 @@ int ASN1_item_ex_d2i(ASN1_VALUE **pval, const unsigned char **in, long len,
403 goto err; 405 goto err;
404 } 406 }
405 407
406 if (asn1_cb && !asn1_cb(ASN1_OP_D2I_PRE, pval, it)) 408 if (asn1_cb && !asn1_cb(ASN1_OP_D2I_PRE, pval, it, NULL))
407 goto auxerr; 409 goto auxerr;
408 410
409 /* Get each field entry */ 411 /* Get each field entry */
@@ -505,7 +507,7 @@ int ASN1_item_ex_d2i(ASN1_VALUE **pval, const unsigned char **in, long len,
505 if (!asn1_enc_save(pval, *in, p - *in, it)) 507 if (!asn1_enc_save(pval, *in, p - *in, it))
506 goto auxerr; 508 goto auxerr;
507 *in = p; 509 *in = p;
508 if (asn1_cb && !asn1_cb(ASN1_OP_D2I_POST, pval, it)) 510 if (asn1_cb && !asn1_cb(ASN1_OP_D2I_POST, pval, it, NULL))
509 goto auxerr; 511 goto auxerr;
510 return 1; 512 return 1;
511 513
@@ -665,11 +667,12 @@ static int asn1_template_noexp_d2i(ASN1_VALUE **val,
665 else 667 else
666 { 668 {
667 /* We've got a valid STACK: free up any items present */ 669 /* We've got a valid STACK: free up any items present */
668 STACK *sktmp = (STACK *)*val; 670 STACK_OF(ASN1_VALUE) *sktmp
671 = (STACK_OF(ASN1_VALUE) *)*val;
669 ASN1_VALUE *vtmp; 672 ASN1_VALUE *vtmp;
670 while(sk_num(sktmp) > 0) 673 while(sk_ASN1_VALUE_num(sktmp) > 0)
671 { 674 {
672 vtmp = (ASN1_VALUE *)sk_pop(sktmp); 675 vtmp = sk_ASN1_VALUE_pop(sktmp);
673 ASN1_item_ex_free(&vtmp, 676 ASN1_item_ex_free(&vtmp,
674 ASN1_ITEM_ptr(tt->item)); 677 ASN1_ITEM_ptr(tt->item));
675 } 678 }
@@ -710,7 +713,8 @@ static int asn1_template_noexp_d2i(ASN1_VALUE **val,
710 goto err; 713 goto err;
711 } 714 }
712 len -= p - q; 715 len -= p - q;
713 if (!sk_push((STACK *)*val, (char *)skfield)) 716 if (!sk_ASN1_VALUE_push((STACK_OF(ASN1_VALUE) *)*val,
717 skfield))
714 { 718 {
715 ASN1err(ASN1_F_ASN1_TEMPLATE_NOEXP_D2I, 719 ASN1err(ASN1_F_ASN1_TEMPLATE_NOEXP_D2I,
716 ERR_R_MALLOC_FAILURE); 720 ERR_R_MALLOC_FAILURE);
diff --git a/src/lib/libcrypto/asn1/tasn_enc.c b/src/lib/libcrypto/asn1/tasn_enc.c
index 2721f904a6..936ad1f767 100644
--- a/src/lib/libcrypto/asn1/tasn_enc.c
+++ b/src/lib/libcrypto/asn1/tasn_enc.c
@@ -158,7 +158,7 @@ int ASN1_item_ex_i2d(ASN1_VALUE **pval, unsigned char **out,
158 return asn1_i2d_ex_primitive(pval, out, it, -1, aclass); 158 return asn1_i2d_ex_primitive(pval, out, it, -1, aclass);
159 159
160 case ASN1_ITYPE_CHOICE: 160 case ASN1_ITYPE_CHOICE:
161 if (asn1_cb && !asn1_cb(ASN1_OP_I2D_PRE, pval, it)) 161 if (asn1_cb && !asn1_cb(ASN1_OP_I2D_PRE, pval, it, NULL))
162 return 0; 162 return 0;
163 i = asn1_get_choice_selector(pval, it); 163 i = asn1_get_choice_selector(pval, it);
164 if ((i >= 0) && (i < it->tcount)) 164 if ((i >= 0) && (i < it->tcount))
@@ -171,7 +171,7 @@ int ASN1_item_ex_i2d(ASN1_VALUE **pval, unsigned char **out,
171 -1, aclass); 171 -1, aclass);
172 } 172 }
173 /* Fixme: error condition if selector out of range */ 173 /* Fixme: error condition if selector out of range */
174 if (asn1_cb && !asn1_cb(ASN1_OP_I2D_POST, pval, it)) 174 if (asn1_cb && !asn1_cb(ASN1_OP_I2D_POST, pval, it, NULL))
175 return 0; 175 return 0;
176 break; 176 break;
177 177
@@ -216,7 +216,7 @@ int ASN1_item_ex_i2d(ASN1_VALUE **pval, unsigned char **out,
216 aclass = (aclass & ~ASN1_TFLG_TAG_CLASS) 216 aclass = (aclass & ~ASN1_TFLG_TAG_CLASS)
217 | V_ASN1_UNIVERSAL; 217 | V_ASN1_UNIVERSAL;
218 } 218 }
219 if (asn1_cb && !asn1_cb(ASN1_OP_I2D_PRE, pval, it)) 219 if (asn1_cb && !asn1_cb(ASN1_OP_I2D_PRE, pval, it, NULL))
220 return 0; 220 return 0;
221 /* First work out sequence content length */ 221 /* First work out sequence content length */
222 for (i = 0, tt = it->templates; i < it->tcount; tt++, i++) 222 for (i = 0, tt = it->templates; i < it->tcount; tt++, i++)
@@ -250,7 +250,7 @@ int ASN1_item_ex_i2d(ASN1_VALUE **pval, unsigned char **out,
250 } 250 }
251 if (ndef == 2) 251 if (ndef == 2)
252 ASN1_put_eoc(out); 252 ASN1_put_eoc(out);
253 if (asn1_cb && !asn1_cb(ASN1_OP_I2D_POST, pval, it)) 253 if (asn1_cb && !asn1_cb(ASN1_OP_I2D_POST, pval, it, NULL))
254 return 0; 254 return 0;
255 return seqlen; 255 return seqlen;
256 256
@@ -569,7 +569,8 @@ int asn1_ex_i2c(ASN1_VALUE **pval, unsigned char *cout, int *putype,
569 ASN1_STRING *strtmp; 569 ASN1_STRING *strtmp;
570 ASN1_OBJECT *otmp; 570 ASN1_OBJECT *otmp;
571 int utype; 571 int utype;
572 unsigned char *cont, c; 572 const unsigned char *cont;
573 unsigned char c;
573 int len; 574 int len;
574 const ASN1_PRIMITIVE_FUNCS *pf; 575 const ASN1_PRIMITIVE_FUNCS *pf;
575 pf = it->funcs; 576 pf = it->funcs;
diff --git a/src/lib/libcrypto/asn1/tasn_fre.c b/src/lib/libcrypto/asn1/tasn_fre.c
index d7c017fa1d..77d3092d31 100644
--- a/src/lib/libcrypto/asn1/tasn_fre.c
+++ b/src/lib/libcrypto/asn1/tasn_fre.c
@@ -110,7 +110,7 @@ static void asn1_item_combine_free(ASN1_VALUE **pval, const ASN1_ITEM *it, int c
110 case ASN1_ITYPE_CHOICE: 110 case ASN1_ITYPE_CHOICE:
111 if (asn1_cb) 111 if (asn1_cb)
112 { 112 {
113 i = asn1_cb(ASN1_OP_FREE_PRE, pval, it); 113 i = asn1_cb(ASN1_OP_FREE_PRE, pval, it, NULL);
114 if (i == 2) 114 if (i == 2)
115 return; 115 return;
116 } 116 }
@@ -123,7 +123,7 @@ static void asn1_item_combine_free(ASN1_VALUE **pval, const ASN1_ITEM *it, int c
123 ASN1_template_free(pchval, tt); 123 ASN1_template_free(pchval, tt);
124 } 124 }
125 if (asn1_cb) 125 if (asn1_cb)
126 asn1_cb(ASN1_OP_FREE_POST, pval, it); 126 asn1_cb(ASN1_OP_FREE_POST, pval, it, NULL);
127 if (!combine) 127 if (!combine)
128 { 128 {
129 OPENSSL_free(*pval); 129 OPENSSL_free(*pval);
@@ -149,7 +149,7 @@ static void asn1_item_combine_free(ASN1_VALUE **pval, const ASN1_ITEM *it, int c
149 return; 149 return;
150 if (asn1_cb) 150 if (asn1_cb)
151 { 151 {
152 i = asn1_cb(ASN1_OP_FREE_PRE, pval, it); 152 i = asn1_cb(ASN1_OP_FREE_PRE, pval, it, NULL);
153 if (i == 2) 153 if (i == 2)
154 return; 154 return;
155 } 155 }
@@ -170,7 +170,7 @@ static void asn1_item_combine_free(ASN1_VALUE **pval, const ASN1_ITEM *it, int c
170 ASN1_template_free(pseqval, seqtt); 170 ASN1_template_free(pseqval, seqtt);
171 } 171 }
172 if (asn1_cb) 172 if (asn1_cb)
173 asn1_cb(ASN1_OP_FREE_POST, pval, it); 173 asn1_cb(ASN1_OP_FREE_POST, pval, it, NULL);
174 if (!combine) 174 if (!combine)
175 { 175 {
176 OPENSSL_free(*pval); 176 OPENSSL_free(*pval);
diff --git a/src/lib/libcrypto/asn1/tasn_new.c b/src/lib/libcrypto/asn1/tasn_new.c
index 5c6a2ebd4d..0d9e78cc7c 100644
--- a/src/lib/libcrypto/asn1/tasn_new.c
+++ b/src/lib/libcrypto/asn1/tasn_new.c
@@ -68,7 +68,7 @@ static int asn1_item_ex_combine_new(ASN1_VALUE **pval, const ASN1_ITEM *it,
68 int combine); 68 int combine);
69static void asn1_item_clear(ASN1_VALUE **pval, const ASN1_ITEM *it); 69static void asn1_item_clear(ASN1_VALUE **pval, const ASN1_ITEM *it);
70static void asn1_template_clear(ASN1_VALUE **pval, const ASN1_TEMPLATE *tt); 70static void asn1_template_clear(ASN1_VALUE **pval, const ASN1_TEMPLATE *tt);
71void asn1_primitive_clear(ASN1_VALUE **pval, const ASN1_ITEM *it); 71static void asn1_primitive_clear(ASN1_VALUE **pval, const ASN1_ITEM *it);
72 72
73ASN1_VALUE *ASN1_item_new(const ASN1_ITEM *it) 73ASN1_VALUE *ASN1_item_new(const ASN1_ITEM *it)
74 { 74 {
@@ -146,7 +146,7 @@ static int asn1_item_ex_combine_new(ASN1_VALUE **pval, const ASN1_ITEM *it,
146 case ASN1_ITYPE_CHOICE: 146 case ASN1_ITYPE_CHOICE:
147 if (asn1_cb) 147 if (asn1_cb)
148 { 148 {
149 i = asn1_cb(ASN1_OP_NEW_PRE, pval, it); 149 i = asn1_cb(ASN1_OP_NEW_PRE, pval, it, NULL);
150 if (!i) 150 if (!i)
151 goto auxerr; 151 goto auxerr;
152 if (i==2) 152 if (i==2)
@@ -166,7 +166,7 @@ static int asn1_item_ex_combine_new(ASN1_VALUE **pval, const ASN1_ITEM *it,
166 memset(*pval, 0, it->size); 166 memset(*pval, 0, it->size);
167 } 167 }
168 asn1_set_choice_selector(pval, -1, it); 168 asn1_set_choice_selector(pval, -1, it);
169 if (asn1_cb && !asn1_cb(ASN1_OP_NEW_POST, pval, it)) 169 if (asn1_cb && !asn1_cb(ASN1_OP_NEW_POST, pval, it, NULL))
170 goto auxerr; 170 goto auxerr;
171 break; 171 break;
172 172
@@ -174,7 +174,7 @@ static int asn1_item_ex_combine_new(ASN1_VALUE **pval, const ASN1_ITEM *it,
174 case ASN1_ITYPE_SEQUENCE: 174 case ASN1_ITYPE_SEQUENCE:
175 if (asn1_cb) 175 if (asn1_cb)
176 { 176 {
177 i = asn1_cb(ASN1_OP_NEW_PRE, pval, it); 177 i = asn1_cb(ASN1_OP_NEW_PRE, pval, it, NULL);
178 if (!i) 178 if (!i)
179 goto auxerr; 179 goto auxerr;
180 if (i==2) 180 if (i==2)
@@ -201,7 +201,7 @@ static int asn1_item_ex_combine_new(ASN1_VALUE **pval, const ASN1_ITEM *it,
201 if (!ASN1_template_new(pseqval, tt)) 201 if (!ASN1_template_new(pseqval, tt))
202 goto memerr; 202 goto memerr;
203 } 203 }
204 if (asn1_cb && !asn1_cb(ASN1_OP_NEW_POST, pval, it)) 204 if (asn1_cb && !asn1_cb(ASN1_OP_NEW_POST, pval, it, NULL))
205 goto auxerr; 205 goto auxerr;
206 break; 206 break;
207 } 207 }
@@ -325,6 +325,7 @@ static void asn1_template_clear(ASN1_VALUE **pval, const ASN1_TEMPLATE *tt)
325int ASN1_primitive_new(ASN1_VALUE **pval, const ASN1_ITEM *it) 325int ASN1_primitive_new(ASN1_VALUE **pval, const ASN1_ITEM *it)
326 { 326 {
327 ASN1_TYPE *typ; 327 ASN1_TYPE *typ;
328 ASN1_STRING *str;
328 int utype; 329 int utype;
329 330
330 if (it && it->funcs) 331 if (it && it->funcs)
@@ -345,10 +346,7 @@ int ASN1_primitive_new(ASN1_VALUE **pval, const ASN1_ITEM *it)
345 return 1; 346 return 1;
346 347
347 case V_ASN1_BOOLEAN: 348 case V_ASN1_BOOLEAN:
348 if (it) 349 *(ASN1_BOOLEAN *)pval = it->size;
349 *(ASN1_BOOLEAN *)pval = it->size;
350 else
351 *(ASN1_BOOLEAN *)pval = -1;
352 return 1; 350 return 1;
353 351
354 case V_ASN1_NULL: 352 case V_ASN1_NULL:
@@ -365,7 +363,10 @@ int ASN1_primitive_new(ASN1_VALUE **pval, const ASN1_ITEM *it)
365 break; 363 break;
366 364
367 default: 365 default:
368 *pval = (ASN1_VALUE *)ASN1_STRING_type_new(utype); 366 str = ASN1_STRING_type_new(utype);
367 if (it->itype == ASN1_ITYPE_MSTRING && str)
368 str->flags |= ASN1_STRING_FLAG_MSTRING;
369 *pval = (ASN1_VALUE *)str;
369 break; 370 break;
370 } 371 }
371 if (*pval) 372 if (*pval)
@@ -373,7 +374,7 @@ int ASN1_primitive_new(ASN1_VALUE **pval, const ASN1_ITEM *it)
373 return 0; 374 return 0;
374 } 375 }
375 376
376void asn1_primitive_clear(ASN1_VALUE **pval, const ASN1_ITEM *it) 377static void asn1_primitive_clear(ASN1_VALUE **pval, const ASN1_ITEM *it)
377 { 378 {
378 int utype; 379 int utype;
379 if (it && it->funcs) 380 if (it && it->funcs)
diff --git a/src/lib/libcrypto/asn1/tasn_prn.c b/src/lib/libcrypto/asn1/tasn_prn.c
index b9c96a6dbe..453698012d 100644
--- a/src/lib/libcrypto/asn1/tasn_prn.c
+++ b/src/lib/libcrypto/asn1/tasn_prn.c
@@ -3,7 +3,7 @@
3 * project 2000. 3 * project 2000.
4 */ 4 */
5/* ==================================================================== 5/* ====================================================================
6 * Copyright (c) 2000 The OpenSSL Project. All rights reserved. 6 * Copyright (c) 2000,2005 The OpenSSL Project. All rights reserved.
7 * 7 *
8 * Redistribution and use in source and binary forms, with or without 8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions 9 * modification, are permitted provided that the following conditions
@@ -58,141 +58,570 @@
58 58
59 59
60#include <stddef.h> 60#include <stddef.h>
61#include "cryptlib.h"
61#include <openssl/asn1.h> 62#include <openssl/asn1.h>
63#include <openssl/asn1t.h>
62#include <openssl/objects.h> 64#include <openssl/objects.h>
63#include <openssl/buffer.h> 65#include <openssl/buffer.h>
64#include <openssl/err.h> 66#include <openssl/err.h>
65#include <openssl/nasn.h> 67#include <openssl/x509v3.h>
68#include "asn1_locl.h"
66 69
67/* Print routines. Print out a whole structure from a template. 70/* Print routines.
68 */ 71 */
69 72
70static int asn1_item_print_nm(BIO *out, void *fld, int indent, const ASN1_ITEM *it, const char *name); 73/* ASN1_PCTX routines */
71 74
72int ASN1_item_print(BIO *out, void *fld, int indent, const ASN1_ITEM *it) 75ASN1_PCTX default_pctx =
73{ 76 {
74 return asn1_item_print_nm(out, fld, indent, it, it->sname); 77 ASN1_PCTX_FLAGS_SHOW_ABSENT, /* flags */
75} 78 0, /* nm_flags */
79 0, /* cert_flags */
80 0, /* oid_flags */
81 0 /* str_flags */
82 };
83
76 84
77static int asn1_item_print_nm(BIO *out, void *fld, int indent, const ASN1_ITEM *it, const char *name) 85ASN1_PCTX *ASN1_PCTX_new(void)
78{ 86 {
79 ASN1_STRING *str; 87 ASN1_PCTX *ret;
88 ret = OPENSSL_malloc(sizeof(ASN1_PCTX));
89 if (ret == NULL)
90 {
91 ASN1err(ASN1_F_ASN1_PCTX_NEW, ERR_R_MALLOC_FAILURE);
92 return NULL;
93 }
94 ret->flags = 0;
95 ret->nm_flags = 0;
96 ret->cert_flags = 0;
97 ret->oid_flags = 0;
98 ret->str_flags = 0;
99 return ret;
100 }
101
102void ASN1_PCTX_free(ASN1_PCTX *p)
103 {
104 OPENSSL_free(p);
105 }
106
107unsigned long ASN1_PCTX_get_flags(ASN1_PCTX *p)
108 {
109 return p->flags;
110 }
111
112void ASN1_PCTX_set_flags(ASN1_PCTX *p, unsigned long flags)
113 {
114 p->flags = flags;
115 }
116
117unsigned long ASN1_PCTX_get_nm_flags(ASN1_PCTX *p)
118 {
119 return p->nm_flags;
120 }
121
122void ASN1_PCTX_set_nm_flags(ASN1_PCTX *p, unsigned long flags)
123 {
124 p->nm_flags = flags;
125 }
126
127unsigned long ASN1_PCTX_get_cert_flags(ASN1_PCTX *p)
128 {
129 return p->cert_flags;
130 }
131
132void ASN1_PCTX_set_cert_flags(ASN1_PCTX *p, unsigned long flags)
133 {
134 p->cert_flags = flags;
135 }
136
137unsigned long ASN1_PCTX_get_oid_flags(ASN1_PCTX *p)
138 {
139 return p->oid_flags;
140 }
141
142void ASN1_PCTX_set_oid_flags(ASN1_PCTX *p, unsigned long flags)
143 {
144 p->oid_flags = flags;
145 }
146
147unsigned long ASN1_PCTX_get_str_flags(ASN1_PCTX *p)
148 {
149 return p->str_flags;
150 }
151
152void ASN1_PCTX_set_str_flags(ASN1_PCTX *p, unsigned long flags)
153 {
154 p->str_flags = flags;
155 }
156
157/* Main print routines */
158
159static int asn1_item_print_ctx(BIO *out, ASN1_VALUE **fld, int indent,
160 const ASN1_ITEM *it,
161 const char *fname, const char *sname,
162 int nohdr, const ASN1_PCTX *pctx);
163
164int asn1_template_print_ctx(BIO *out, ASN1_VALUE **fld, int indent,
165 const ASN1_TEMPLATE *tt, const ASN1_PCTX *pctx);
166
167static int asn1_primitive_print(BIO *out, ASN1_VALUE **fld,
168 const ASN1_ITEM *it, int indent,
169 const char *fname, const char *sname,
170 const ASN1_PCTX *pctx);
171
172static int asn1_print_fsname(BIO *out, int indent,
173 const char *fname, const char *sname,
174 const ASN1_PCTX *pctx);
175
176int ASN1_item_print(BIO *out, ASN1_VALUE *ifld, int indent,
177 const ASN1_ITEM *it, const ASN1_PCTX *pctx)
178 {
179 const char *sname;
180 if (pctx == NULL)
181 pctx = &default_pctx;
182 if (pctx->flags & ASN1_PCTX_FLAGS_NO_STRUCT_NAME)
183 sname = NULL;
184 else
185 sname = it->sname;
186 return asn1_item_print_ctx(out, &ifld, indent, it,
187 NULL, sname, 0, pctx);
188 }
189
190static int asn1_item_print_ctx(BIO *out, ASN1_VALUE **fld, int indent,
191 const ASN1_ITEM *it,
192 const char *fname, const char *sname,
193 int nohdr, const ASN1_PCTX *pctx)
194 {
80 const ASN1_TEMPLATE *tt; 195 const ASN1_TEMPLATE *tt;
81 void *tmpfld; 196 const ASN1_EXTERN_FUNCS *ef;
197 ASN1_VALUE **tmpfld;
198 const ASN1_AUX *aux = it->funcs;
199 ASN1_aux_cb *asn1_cb;
200 ASN1_PRINT_ARG parg;
82 int i; 201 int i;
83 if(!fld) { 202 if (aux && aux->asn1_cb)
84 BIO_printf(out, "%*s%s ABSENT\n", indent, "", name); 203 {
204 parg.out = out;
205 parg.indent = indent;
206 parg.pctx = pctx;
207 asn1_cb = aux->asn1_cb;
208 }
209 else asn1_cb = 0;
210
211 if(*fld == NULL)
212 {
213 if (pctx->flags & ASN1_PCTX_FLAGS_SHOW_ABSENT)
214 {
215 if (!nohdr && !asn1_print_fsname(out, indent,
216 fname, sname, pctx))
217 return 0;
218 if (BIO_puts(out, "<ABSENT>\n") <= 0)
219 return 0;
220 }
85 return 1; 221 return 1;
86 } 222 }
87 switch(it->itype) {
88 223
224 switch(it->itype)
225 {
89 case ASN1_ITYPE_PRIMITIVE: 226 case ASN1_ITYPE_PRIMITIVE:
90 if(it->templates) 227 if(it->templates)
91 return ASN1_template_print(out, fld, indent, it->templates); 228 {
92 return asn1_primitive_print(out, fld, it->utype, indent, name); 229 if (!asn1_template_print_ctx(out, fld, indent,
93 break; 230 it->templates, pctx))
94 231 return 0;
232 }
233 /* fall thru */
95 case ASN1_ITYPE_MSTRING: 234 case ASN1_ITYPE_MSTRING:
96 str = fld; 235 if (!asn1_primitive_print(out, fld, it,
97 return asn1_primitive_print(out, fld, str->type, indent, name); 236 indent, fname, sname,pctx))
237 return 0;
238 break;
98 239
99 case ASN1_ITYPE_EXTERN: 240 case ASN1_ITYPE_EXTERN:
100 BIO_printf(out, "%*s%s:EXTERNAL TYPE %s %s\n", indent, "", name, it->sname, fld ? "" : "ABSENT"); 241 if (!nohdr && !asn1_print_fsname(out, indent, fname, sname, pctx))
101 return 1; 242 return 0;
102 case ASN1_ITYPE_COMPAT: 243 /* Use new style print routine if possible */
103 BIO_printf(out, "%*s%s:COMPATIBLE TYPE %s %s\n", indent, "", name, it->sname, fld ? "" : "ABSENT"); 244 ef = it->funcs;
104 return 1; 245 if (ef && ef->asn1_ex_print)
105 246 {
247 i = ef->asn1_ex_print(out, fld, indent, "", pctx);
248 if (!i)
249 return 0;
250 if ((i == 2) && (BIO_puts(out, "\n") <= 0))
251 return 0;
252 return 1;
253 }
254 else if (sname &&
255 BIO_printf(out, ":EXTERNAL TYPE %s\n", sname) <= 0)
256 return 0;
257 break;
106 258
107 case ASN1_ITYPE_CHOICE: 259 case ASN1_ITYPE_CHOICE:
260#if 0
261 if (!nohdr && !asn1_print_fsname(out, indent, fname, sname, pctx))
262 return 0;
263#endif
108 /* CHOICE type, get selector */ 264 /* CHOICE type, get selector */
109 i = asn1_get_choice_selector(fld, it); 265 i = asn1_get_choice_selector(fld, it);
110 /* This should never happen... */ 266 /* This should never happen... */
111 if((i < 0) || (i >= it->tcount)) { 267 if((i < 0) || (i >= it->tcount))
112 BIO_printf(out, "%s selector [%d] out of range\n", it->sname, i); 268 {
269 if (BIO_printf(out,
270 "ERROR: selector [%d] invalid\n", i) <= 0)
271 return 0;
113 return 1; 272 return 1;
114 } 273 }
115 tt = it->templates + i; 274 tt = it->templates + i;
116 tmpfld = asn1_get_field(fld, tt); 275 tmpfld = asn1_get_field_ptr(fld, tt);
117 return ASN1_template_print(out, tmpfld, indent, tt); 276 if (!asn1_template_print_ctx(out, tmpfld, indent, tt, pctx))
277 return 0;
278 break;
118 279
119 case ASN1_ITYPE_SEQUENCE: 280 case ASN1_ITYPE_SEQUENCE:
120 BIO_printf(out, "%*s%s {\n", indent, "", name); 281 case ASN1_ITYPE_NDEF_SEQUENCE:
121 /* Get each field entry */ 282 if (!nohdr && !asn1_print_fsname(out, indent, fname, sname, pctx))
122 for(i = 0, tt = it->templates; i < it->tcount; i++, tt++) { 283 return 0;
123 tmpfld = asn1_get_field(fld, tt); 284 if (fname || sname)
124 ASN1_template_print(out, tmpfld, indent + 2, tt); 285 {
125 } 286 if (pctx->flags & ASN1_PCTX_FLAGS_SHOW_SEQUENCE)
126 BIO_printf(out, "%*s}\n", indent, ""); 287 {
127 return 1; 288 if (BIO_puts(out, " {\n") <= 0)
289 return 0;
290 }
291 else
292 {
293 if (BIO_puts(out, "\n") <= 0)
294 return 0;
295 }
296 }
297
298 if (asn1_cb)
299 {
300 i = asn1_cb(ASN1_OP_PRINT_PRE, fld, it, &parg);
301 if (i == 0)
302 return 0;
303 if (i == 2)
304 return 1;
305 }
306
307 /* Print each field entry */
308 for(i = 0, tt = it->templates; i < it->tcount; i++, tt++)
309 {
310 const ASN1_TEMPLATE *seqtt;
311 seqtt = asn1_do_adb(fld, tt, 1);
312 tmpfld = asn1_get_field_ptr(fld, seqtt);
313 if (!asn1_template_print_ctx(out, tmpfld,
314 indent + 2, seqtt, pctx))
315 return 0;
316 }
317 if (pctx->flags & ASN1_PCTX_FLAGS_SHOW_SEQUENCE)
318 {
319 if (BIO_printf(out, "%*s}\n", indent, "") < 0)
320 return 0;
321 }
322
323 if (asn1_cb)
324 {
325 i = asn1_cb(ASN1_OP_PRINT_POST, fld, it, &parg);
326 if (i == 0)
327 return 0;
328 }
329 break;
128 330
129 default: 331 default:
332 BIO_printf(out, "Unprocessed type %d\n", it->itype);
130 return 0; 333 return 0;
334 }
335
336 return 1;
131 } 337 }
132}
133 338
134int ASN1_template_print(BIO *out, void *fld, int indent, const ASN1_TEMPLATE *tt) 339int asn1_template_print_ctx(BIO *out, ASN1_VALUE **fld, int indent,
135{ 340 const ASN1_TEMPLATE *tt, const ASN1_PCTX *pctx)
341 {
136 int i, flags; 342 int i, flags;
137#if 0 343 const char *sname, *fname;
138 if(!fld) return 0;
139#endif
140 flags = tt->flags; 344 flags = tt->flags;
141 if(flags & ASN1_TFLG_SK_MASK) { 345 if(pctx->flags & ASN1_PCTX_FLAGS_SHOW_FIELD_STRUCT_NAME)
346 sname = ASN1_ITEM_ptr(tt->item)->sname;
347 else
348 sname = NULL;
349 if(pctx->flags & ASN1_PCTX_FLAGS_NO_FIELD_NAME)
350 fname = NULL;
351 else
352 fname = tt->field_name;
353 if(flags & ASN1_TFLG_SK_MASK)
354 {
142 char *tname; 355 char *tname;
143 void *skitem; 356 ASN1_VALUE *skitem;
357 STACK_OF(ASN1_VALUE) *stack;
358
144 /* SET OF, SEQUENCE OF */ 359 /* SET OF, SEQUENCE OF */
145 if(flags & ASN1_TFLG_SET_OF) tname = "SET"; 360 if (fname)
146 else tname = "SEQUENCE"; 361 {
147 if(fld) { 362 if(pctx->flags & ASN1_PCTX_FLAGS_SHOW_SSOF)
148 BIO_printf(out, "%*s%s OF %s {\n", indent, "", tname, tt->field_name); 363 {
149 for(i = 0; i < sk_num(fld); i++) { 364 if(flags & ASN1_TFLG_SET_OF)
150 skitem = sk_value(fld, i); 365 tname = "SET";
151 asn1_item_print_nm(out, skitem, indent + 2, tt->item, ""); 366 else
367 tname = "SEQUENCE";
368 if (BIO_printf(out, "%*s%s OF %s {\n",
369 indent, "", tname, tt->field_name) <= 0)
370 return 0;
371 }
372 else if (BIO_printf(out, "%*s%s:\n", indent, "",
373 fname) <= 0)
374 return 0;
375 }
376 stack = (STACK_OF(ASN1_VALUE) *)*fld;
377 for(i = 0; i < sk_ASN1_VALUE_num(stack); i++)
378 {
379 if ((i > 0) && (BIO_puts(out, "\n") <= 0))
380 return 0;
381
382 skitem = sk_ASN1_VALUE_value(stack, i);
383 if (!asn1_item_print_ctx(out, &skitem, indent + 2,
384 ASN1_ITEM_ptr(tt->item), NULL, NULL, 1, pctx))
385 return 0;
386 }
387 if (!i && BIO_printf(out, "%*s<EMPTY>\n", indent + 2, "") <= 0)
388 return 0;
389 if(pctx->flags & ASN1_PCTX_FLAGS_SHOW_SEQUENCE)
390 {
391 if (BIO_printf(out, "%*s}\n", indent, "") <= 0)
392 return 0;
152 } 393 }
153 BIO_printf(out, "%*s}\n", indent, "");
154 } else
155 BIO_printf(out, "%*s%s OF %s ABSENT\n", indent, "", tname, tt->field_name);
156 return 1; 394 return 1;
395 }
396 return asn1_item_print_ctx(out, fld, indent, ASN1_ITEM_ptr(tt->item),
397 fname, sname, 0, pctx);
157 } 398 }
158 return asn1_item_print_nm(out, fld, indent, tt->item, tt->field_name); 399
159} 400static int asn1_print_fsname(BIO *out, int indent,
160 401 const char *fname, const char *sname,
161static int asn1_primitive_print(BIO *out, void *fld, long utype, int indent, const char *name) 402 const ASN1_PCTX *pctx)
162{ 403 {
163 ASN1_STRING *str = fld; 404 static char spaces[] = " ";
164 if(fld) { 405 const int nspaces = sizeof(spaces) - 1;
165 if(utype == V_ASN1_BOOLEAN) { 406
166 int *bool = fld; 407#if 0
167if(*bool == -1) printf("BOOL MISSING\n"); 408 if (!sname && !fname)
168 BIO_printf(out, "%*s%s:%s", indent, "", "BOOLEAN", *bool ? "TRUE" : "FALSE"); 409 return 1;
169 } else if((utype == V_ASN1_INTEGER) 410#endif
170 || (utype == V_ASN1_ENUMERATED)) { 411
171 char *s, *nm; 412 while (indent > nspaces)
172 s = i2s_ASN1_INTEGER(NULL, fld); 413 {
173 if(utype == V_ASN1_INTEGER) nm = "INTEGER"; 414 if (BIO_write(out, spaces, nspaces) != nspaces)
174 else nm = "ENUMERATED"; 415 return 0;
175 BIO_printf(out, "%*s%s:%s", indent, "", nm, s); 416 indent -= nspaces;
176 OPENSSL_free(s); 417 }
177 } else if(utype == V_ASN1_NULL) { 418 if (BIO_write(out, spaces, indent) != indent)
178 BIO_printf(out, "%*s%s", indent, "", "NULL"); 419 return 0;
179 } else if(utype == V_ASN1_UTCTIME) { 420 if (pctx->flags & ASN1_PCTX_FLAGS_NO_STRUCT_NAME)
180 BIO_printf(out, "%*s%s:%s:", indent, "", name, "UTCTIME"); 421 sname = NULL;
181 ASN1_UTCTIME_print(out, str); 422 if (pctx->flags & ASN1_PCTX_FLAGS_NO_FIELD_NAME)
182 } else if(utype == V_ASN1_GENERALIZEDTIME) { 423 fname = NULL;
183 BIO_printf(out, "%*s%s:%s:", indent, "", name, "GENERALIZEDTIME"); 424 if (!sname && !fname)
184 ASN1_GENERALIZEDTIME_print(out, str); 425 return 1;
185 } else if(utype == V_ASN1_OBJECT) { 426 if (fname)
186 char objbuf[80], *ln; 427 {
187 ln = OBJ_nid2ln(OBJ_obj2nid(fld)); 428 if (BIO_puts(out, fname) <= 0)
188 if(!ln) ln = ""; 429 return 0;
189 OBJ_obj2txt(objbuf, sizeof objbuf, fld, 1);
190 BIO_printf(out, "%*s%s:%s (%s)", indent, "", "OBJECT", ln, objbuf);
191 } else {
192 BIO_printf(out, "%*s%s:", indent, "", name);
193 ASN1_STRING_print_ex(out, str, ASN1_STRFLGS_DUMP_UNKNOWN|ASN1_STRFLGS_SHOW_TYPE);
194 } 430 }
195 BIO_printf(out, "\n"); 431 if (sname)
196 } else BIO_printf(out, "%*s%s [ABSENT]\n", indent, "", name); 432 {
433 if (fname)
434 {
435 if (BIO_printf(out, " (%s)", sname) <= 0)
436 return 0;
437 }
438 else
439 {
440 if (BIO_puts(out, sname) <= 0)
441 return 0;
442 }
443 }
444 if (BIO_write(out, ": ", 2) != 2)
445 return 0;
197 return 1; 446 return 1;
198} 447 }
448
449static int asn1_print_boolean_ctx(BIO *out, const int bool,
450 const ASN1_PCTX *pctx)
451 {
452 const char *str;
453 switch (bool)
454 {
455 case -1:
456 str = "BOOL ABSENT";
457 break;
458
459 case 0:
460 str = "FALSE";
461 break;
462
463 default:
464 str = "TRUE";
465 break;
466
467 }
468
469 if (BIO_puts(out, str) <= 0)
470 return 0;
471 return 1;
472
473 }
474
475static int asn1_print_integer_ctx(BIO *out, ASN1_INTEGER *str,
476 const ASN1_PCTX *pctx)
477 {
478 char *s;
479 int ret = 1;
480 s = i2s_ASN1_INTEGER(NULL, str);
481 if (BIO_puts(out, s) <= 0)
482 ret = 0;
483 OPENSSL_free(s);
484 return ret;
485 }
486
487static int asn1_print_oid_ctx(BIO *out, const ASN1_OBJECT *oid,
488 const ASN1_PCTX *pctx)
489 {
490 char objbuf[80];
491 const char *ln;
492 ln = OBJ_nid2ln(OBJ_obj2nid(oid));
493 if(!ln)
494 ln = "";
495 OBJ_obj2txt(objbuf, sizeof objbuf, oid, 1);
496 if (BIO_printf(out, "%s (%s)", ln, objbuf) <= 0)
497 return 0;
498 return 1;
499 }
500
501static int asn1_print_obstring_ctx(BIO *out, ASN1_STRING *str, int indent,
502 const ASN1_PCTX *pctx)
503 {
504 if (str->type == V_ASN1_BIT_STRING)
505 {
506 if (BIO_printf(out, " (%ld unused bits)\n",
507 str->flags & 0x7) <= 0)
508 return 0;
509 }
510 else if (BIO_puts(out, "\n") <= 0)
511 return 0;
512 if ((str->length > 0)
513 && BIO_dump_indent(out, (char *)str->data, str->length,
514 indent + 2) <= 0)
515 return 0;
516 return 1;
517 }
518
519static int asn1_primitive_print(BIO *out, ASN1_VALUE **fld,
520 const ASN1_ITEM *it, int indent,
521 const char *fname, const char *sname,
522 const ASN1_PCTX *pctx)
523 {
524 long utype;
525 ASN1_STRING *str;
526 int ret = 1, needlf = 1;
527 const char *pname;
528 const ASN1_PRIMITIVE_FUNCS *pf;
529 pf = it->funcs;
530 if (!asn1_print_fsname(out, indent, fname, sname, pctx))
531 return 0;
532 if (pf && pf->prim_print)
533 return pf->prim_print(out, fld, it, indent, pctx);
534 str = (ASN1_STRING *)*fld;
535 if (it->itype == ASN1_ITYPE_MSTRING)
536 utype = str->type & ~V_ASN1_NEG;
537 else
538 utype = it->utype;
539 if (utype == V_ASN1_ANY)
540 {
541 ASN1_TYPE *atype = (ASN1_TYPE *)*fld;
542 utype = atype->type;
543 fld = &atype->value.asn1_value;
544 str = (ASN1_STRING *)*fld;
545 if (pctx->flags & ASN1_PCTX_FLAGS_NO_ANY_TYPE)
546 pname = NULL;
547 else
548 pname = ASN1_tag2str(utype);
549 }
550 else
551 {
552 if (pctx->flags & ASN1_PCTX_FLAGS_SHOW_TYPE)
553 pname = ASN1_tag2str(utype);
554 else
555 pname = NULL;
556 }
557
558 if (utype == V_ASN1_NULL)
559 {
560 if (BIO_puts(out, "NULL\n") <= 0)
561 return 0;
562 return 1;
563 }
564
565 if (pname)
566 {
567 if (BIO_puts(out, pname) <= 0)
568 return 0;
569 if (BIO_puts(out, ":") <= 0)
570 return 0;
571 }
572
573 switch (utype)
574 {
575 case V_ASN1_BOOLEAN:
576 {
577 int bool = *(int *)fld;
578 if (bool == -1)
579 bool = it->size;
580 ret = asn1_print_boolean_ctx(out, bool, pctx);
581 }
582 break;
583
584 case V_ASN1_INTEGER:
585 case V_ASN1_ENUMERATED:
586 ret = asn1_print_integer_ctx(out, str, pctx);
587 break;
588
589 case V_ASN1_UTCTIME:
590 ret = ASN1_UTCTIME_print(out, str);
591 break;
592
593 case V_ASN1_GENERALIZEDTIME:
594 ret = ASN1_GENERALIZEDTIME_print(out, str);
595 break;
596
597 case V_ASN1_OBJECT:
598 ret = asn1_print_oid_ctx(out, (const ASN1_OBJECT *)*fld, pctx);
599 break;
600
601 case V_ASN1_OCTET_STRING:
602 case V_ASN1_BIT_STRING:
603 ret = asn1_print_obstring_ctx(out, str, indent, pctx);
604 needlf = 0;
605 break;
606
607 case V_ASN1_SEQUENCE:
608 case V_ASN1_SET:
609 case V_ASN1_OTHER:
610 if (BIO_puts(out, "\n") <= 0)
611 return 0;
612 if (ASN1_parse_dump(out, str->data, str->length,
613 indent, 0) <= 0)
614 ret = 0;
615 needlf = 0;
616 break;
617
618 default:
619 ret = ASN1_STRING_print_ex(out, str, pctx->str_flags);
620
621 }
622 if (!ret)
623 return 0;
624 if (needlf && BIO_puts(out, "\n") <= 0)
625 return 0;
626 return 1;
627 }
diff --git a/src/lib/libcrypto/asn1/tasn_typ.c b/src/lib/libcrypto/asn1/tasn_typ.c
index 6252213d15..6fb1c372da 100644
--- a/src/lib/libcrypto/asn1/tasn_typ.c
+++ b/src/lib/libcrypto/asn1/tasn_typ.c
@@ -135,3 +135,14 @@ IMPLEMENT_ASN1_TYPE_ex(ASN1_FBOOLEAN, ASN1_BOOLEAN, 0)
135/* Special, OCTET STRING with indefinite length constructed support */ 135/* Special, OCTET STRING with indefinite length constructed support */
136 136
137IMPLEMENT_ASN1_TYPE_ex(ASN1_OCTET_STRING_NDEF, ASN1_OCTET_STRING, ASN1_TFLG_NDEF) 137IMPLEMENT_ASN1_TYPE_ex(ASN1_OCTET_STRING_NDEF, ASN1_OCTET_STRING, ASN1_TFLG_NDEF)
138
139ASN1_ITEM_TEMPLATE(ASN1_SEQUENCE_ANY) =
140 ASN1_EX_TEMPLATE_TYPE(ASN1_TFLG_SEQUENCE_OF, 0, ASN1_SEQUENCE_ANY, ASN1_ANY)
141ASN1_ITEM_TEMPLATE_END(ASN1_SEQUENCE_ANY)
142
143ASN1_ITEM_TEMPLATE(ASN1_SET_ANY) =
144 ASN1_EX_TEMPLATE_TYPE(ASN1_TFLG_SET_OF, 0, ASN1_SET_ANY, ASN1_ANY)
145ASN1_ITEM_TEMPLATE_END(ASN1_SET_ANY)
146
147IMPLEMENT_ASN1_ENCODE_FUNCTIONS_const_fname(ASN1_SEQUENCE_ANY, ASN1_SEQUENCE_ANY, ASN1_SEQUENCE_ANY)
148IMPLEMENT_ASN1_ENCODE_FUNCTIONS_const_fname(ASN1_SEQUENCE_ANY, ASN1_SET_ANY, ASN1_SET_ANY)
diff --git a/src/lib/libcrypto/asn1/x_cinf.c b/src/lib/libcrypto/asn1/x_cinf.c
deleted file mode 100644
index 339a110eef..0000000000
--- a/src/lib/libcrypto/asn1/x_cinf.c
+++ /dev/null
@@ -1,201 +0,0 @@
1/* crypto/asn1/x_cinf.c */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved.
4 *
5 * This package is an SSL implementation written
6 * by Eric Young (eay@cryptsoft.com).
7 * The implementation was written so as to conform with Netscapes SSL.
8 *
9 * This library is free for commercial and non-commercial use as long as
10 * the following conditions are aheared to. The following conditions
11 * apply to all code found in this distribution, be it the RC4, RSA,
12 * lhash, DES, etc., code; not just the SSL code. The SSL documentation
13 * included with this distribution is covered by the same copyright terms
14 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
15 *
16 * Copyright remains Eric Young's, and as such any Copyright notices in
17 * the code are not to be removed.
18 * If this package is used in a product, Eric Young should be given attribution
19 * as the author of the parts of the library used.
20 * This can be in the form of a textual message at program startup or
21 * in documentation (online or textual) provided with the package.
22 *
23 * Redistribution and use in source and binary forms, with or without
24 * modification, are permitted provided that the following conditions
25 * are met:
26 * 1. Redistributions of source code must retain the copyright
27 * notice, this list of conditions and the following disclaimer.
28 * 2. Redistributions in binary form must reproduce the above copyright
29 * notice, this list of conditions and the following disclaimer in the
30 * documentation and/or other materials provided with the distribution.
31 * 3. All advertising materials mentioning features or use of this software
32 * must display the following acknowledgement:
33 * "This product includes cryptographic software written by
34 * Eric Young (eay@cryptsoft.com)"
35 * The word 'cryptographic' can be left out if the rouines from the library
36 * being used are not cryptographic related :-).
37 * 4. If you include any Windows specific code (or a derivative thereof) from
38 * the apps directory (application code) you must include an acknowledgement:
39 * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
40 *
41 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
42 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
43 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
44 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
45 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
46 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
47 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
49 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
50 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
51 * SUCH DAMAGE.
52 *
53 * The licence and distribution terms for any publically available version or
54 * derivative of this code cannot be changed. i.e. this code cannot simply be
55 * copied and put under another distribution licence
56 * [including the GNU Public Licence.]
57 */
58
59#include <stdio.h>
60#include "cryptlib.h"
61#include <openssl/asn1_mac.h>
62#include <openssl/x509.h>
63
64int i2d_X509_CINF(X509_CINF *a, unsigned char **pp)
65 {
66 int v1=0,v2=0;
67 M_ASN1_I2D_vars(a);
68
69 M_ASN1_I2D_len_EXP_opt(a->version,i2d_ASN1_INTEGER,0,v1);
70 M_ASN1_I2D_len(a->serialNumber, i2d_ASN1_INTEGER);
71 M_ASN1_I2D_len(a->signature, i2d_X509_ALGOR);
72 M_ASN1_I2D_len(a->issuer, i2d_X509_NAME);
73 M_ASN1_I2D_len(a->validity, i2d_X509_VAL);
74 M_ASN1_I2D_len(a->subject, i2d_X509_NAME);
75 M_ASN1_I2D_len(a->key, i2d_X509_PUBKEY);
76 M_ASN1_I2D_len_IMP_opt(a->issuerUID, i2d_ASN1_BIT_STRING);
77 M_ASN1_I2D_len_IMP_opt(a->subjectUID, i2d_ASN1_BIT_STRING);
78 M_ASN1_I2D_len_EXP_SEQUENCE_opt_type(X509_EXTENSION,a->extensions,
79 i2d_X509_EXTENSION,3,
80 V_ASN1_SEQUENCE,v2);
81
82 M_ASN1_I2D_seq_total();
83
84 M_ASN1_I2D_put_EXP_opt(a->version,i2d_ASN1_INTEGER,0,v1);
85 M_ASN1_I2D_put(a->serialNumber, i2d_ASN1_INTEGER);
86 M_ASN1_I2D_put(a->signature, i2d_X509_ALGOR);
87 M_ASN1_I2D_put(a->issuer, i2d_X509_NAME);
88 M_ASN1_I2D_put(a->validity, i2d_X509_VAL);
89 M_ASN1_I2D_put(a->subject, i2d_X509_NAME);
90 M_ASN1_I2D_put(a->key, i2d_X509_PUBKEY);
91 M_ASN1_I2D_put_IMP_opt(a->issuerUID, i2d_ASN1_BIT_STRING,1);
92 M_ASN1_I2D_put_IMP_opt(a->subjectUID, i2d_ASN1_BIT_STRING,2);
93 M_ASN1_I2D_put_EXP_SEQUENCE_opt_type(X509_EXTENSION,a->extensions,
94 i2d_X509_EXTENSION,3,
95 V_ASN1_SEQUENCE,v2);
96
97 M_ASN1_I2D_finish();
98 }
99
100X509_CINF *d2i_X509_CINF(X509_CINF **a, unsigned char **pp, long length)
101 {
102 int ver=0;
103 M_ASN1_D2I_vars(a,X509_CINF *,X509_CINF_new);
104
105 M_ASN1_D2I_Init();
106 M_ASN1_D2I_start_sequence();
107 /* we have the optional version field */
108 if (M_ASN1_next == (V_ASN1_CONTEXT_SPECIFIC | V_ASN1_CONSTRUCTED | 0))
109 {
110 M_ASN1_D2I_get_EXP_opt(ret->version,d2i_ASN1_INTEGER,0);
111 if (ret->version->data != NULL)
112 ver=ret->version->data[0];
113 }
114 else
115 {
116 if (ret->version != NULL)
117 {
118 M_ASN1_INTEGER_free(ret->version);
119 ret->version=NULL;
120 }
121 }
122 M_ASN1_D2I_get(ret->serialNumber,d2i_ASN1_INTEGER);
123 M_ASN1_D2I_get(ret->signature,d2i_X509_ALGOR);
124 M_ASN1_D2I_get(ret->issuer,d2i_X509_NAME);
125 M_ASN1_D2I_get(ret->validity,d2i_X509_VAL);
126 M_ASN1_D2I_get(ret->subject,d2i_X509_NAME);
127 M_ASN1_D2I_get(ret->key,d2i_X509_PUBKEY);
128 if (ver >= 1) /* version 2 extensions */
129 {
130 if (ret->issuerUID != NULL)
131 {
132 M_ASN1_BIT_STRING_free(ret->issuerUID);
133 ret->issuerUID=NULL;
134 }
135 if (ret->subjectUID != NULL)
136 {
137 M_ASN1_BIT_STRING_free(ret->subjectUID);
138 ret->subjectUID=NULL;
139 }
140 M_ASN1_D2I_get_IMP_opt(ret->issuerUID,d2i_ASN1_BIT_STRING, 1,
141 V_ASN1_BIT_STRING);
142 M_ASN1_D2I_get_IMP_opt(ret->subjectUID,d2i_ASN1_BIT_STRING, 2,
143 V_ASN1_BIT_STRING);
144 }
145/* Note: some broken certificates include extensions but don't set
146 * the version number properly. By bypassing this check they can
147 * be parsed.
148 */
149
150#ifdef VERSION_EXT_CHECK
151 if (ver >= 2) /* version 3 extensions */
152#endif
153 {
154 if (ret->extensions != NULL)
155 while (sk_X509_EXTENSION_num(ret->extensions))
156 X509_EXTENSION_free(
157 sk_X509_EXTENSION_pop(ret->extensions));
158 M_ASN1_D2I_get_EXP_set_opt_type(X509_EXTENSION,ret->extensions,
159 d2i_X509_EXTENSION,
160 X509_EXTENSION_free,3,
161 V_ASN1_SEQUENCE);
162 }
163 M_ASN1_D2I_Finish(a,X509_CINF_free,ASN1_F_D2I_X509_CINF);
164 }
165
166X509_CINF *X509_CINF_new(void)
167 {
168 X509_CINF *ret=NULL;
169 ASN1_CTX c;
170
171 M_ASN1_New_Malloc(ret,X509_CINF);
172 ret->version=NULL;
173 M_ASN1_New(ret->serialNumber,M_ASN1_INTEGER_new);
174 M_ASN1_New(ret->signature,X509_ALGOR_new);
175 M_ASN1_New(ret->issuer,X509_NAME_new);
176 M_ASN1_New(ret->validity,X509_VAL_new);
177 M_ASN1_New(ret->subject,X509_NAME_new);
178 M_ASN1_New(ret->key,X509_PUBKEY_new);
179 ret->issuerUID=NULL;
180 ret->subjectUID=NULL;
181 ret->extensions=NULL;
182 return(ret);
183 M_ASN1_New_Error(ASN1_F_X509_CINF_NEW);
184 }
185
186void X509_CINF_free(X509_CINF *a)
187 {
188 if (a == NULL) return;
189 M_ASN1_INTEGER_free(a->version);
190 M_ASN1_INTEGER_free(a->serialNumber);
191 X509_ALGOR_free(a->signature);
192 X509_NAME_free(a->issuer);
193 X509_VAL_free(a->validity);
194 X509_NAME_free(a->subject);
195 X509_PUBKEY_free(a->key);
196 M_ASN1_BIT_STRING_free(a->issuerUID);
197 M_ASN1_BIT_STRING_free(a->subjectUID);
198 sk_X509_EXTENSION_pop_free(a->extensions,X509_EXTENSION_free);
199 OPENSSL_free(a);
200 }
201
diff --git a/src/lib/libcrypto/asn1/x_crl.c b/src/lib/libcrypto/asn1/x_crl.c
index 70d56a67f2..c51c690ba9 100644
--- a/src/lib/libcrypto/asn1/x_crl.c
+++ b/src/lib/libcrypto/asn1/x_crl.c
@@ -58,11 +58,14 @@
58 58
59#include <stdio.h> 59#include <stdio.h>
60#include "cryptlib.h" 60#include "cryptlib.h"
61#include "asn1_locl.h"
61#include <openssl/asn1t.h> 62#include <openssl/asn1t.h>
62#include <openssl/x509.h> 63#include <openssl/x509.h>
64#include <openssl/x509v3.h>
63 65
64static int X509_REVOKED_cmp(const X509_REVOKED * const *a, 66static int X509_REVOKED_cmp(const X509_REVOKED * const *a,
65 const X509_REVOKED * const *b); 67 const X509_REVOKED * const *b);
68static void setup_idp(X509_CRL *crl, ISSUING_DIST_POINT *idp);
66 69
67ASN1_SEQUENCE(X509_REVOKED) = { 70ASN1_SEQUENCE(X509_REVOKED) = {
68 ASN1_SIMPLE(X509_REVOKED,serialNumber, ASN1_INTEGER), 71 ASN1_SIMPLE(X509_REVOKED,serialNumber, ASN1_INTEGER),
@@ -70,11 +73,26 @@ ASN1_SEQUENCE(X509_REVOKED) = {
70 ASN1_SEQUENCE_OF_OPT(X509_REVOKED,extensions, X509_EXTENSION) 73 ASN1_SEQUENCE_OF_OPT(X509_REVOKED,extensions, X509_EXTENSION)
71} ASN1_SEQUENCE_END(X509_REVOKED) 74} ASN1_SEQUENCE_END(X509_REVOKED)
72 75
76static int def_crl_verify(X509_CRL *crl, EVP_PKEY *r);
77static int def_crl_lookup(X509_CRL *crl,
78 X509_REVOKED **ret, ASN1_INTEGER *serial, X509_NAME *issuer);
79
80static X509_CRL_METHOD int_crl_meth =
81 {
82 0,
83 0,0,
84 def_crl_lookup,
85 def_crl_verify
86 };
87
88static const X509_CRL_METHOD *default_crl_method = &int_crl_meth;
89
73/* The X509_CRL_INFO structure needs a bit of customisation. 90/* The X509_CRL_INFO structure needs a bit of customisation.
74 * Since we cache the original encoding the signature wont be affected by 91 * Since we cache the original encoding the signature wont be affected by
75 * reordering of the revoked field. 92 * reordering of the revoked field.
76 */ 93 */
77static int crl_inf_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it) 94static int crl_inf_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it,
95 void *exarg)
78{ 96{
79 X509_CRL_INFO *a = (X509_CRL_INFO *)*pval; 97 X509_CRL_INFO *a = (X509_CRL_INFO *)*pval;
80 98
@@ -101,7 +119,237 @@ ASN1_SEQUENCE_enc(X509_CRL_INFO, enc, crl_inf_cb) = {
101 ASN1_EXP_SEQUENCE_OF_OPT(X509_CRL_INFO, extensions, X509_EXTENSION, 0) 119 ASN1_EXP_SEQUENCE_OF_OPT(X509_CRL_INFO, extensions, X509_EXTENSION, 0)
102} ASN1_SEQUENCE_END_enc(X509_CRL_INFO, X509_CRL_INFO) 120} ASN1_SEQUENCE_END_enc(X509_CRL_INFO, X509_CRL_INFO)
103 121
104ASN1_SEQUENCE_ref(X509_CRL, 0, CRYPTO_LOCK_X509_CRL) = { 122/* Set CRL entry issuer according to CRL certificate issuer extension.
123 * Check for unhandled critical CRL entry extensions.
124 */
125
126static int crl_set_issuers(X509_CRL *crl)
127 {
128
129 int i, j;
130 GENERAL_NAMES *gens, *gtmp;
131 STACK_OF(X509_REVOKED) *revoked;
132
133 revoked = X509_CRL_get_REVOKED(crl);
134
135 gens = NULL;
136 for (i = 0; i < sk_X509_REVOKED_num(revoked); i++)
137 {
138 X509_REVOKED *rev = sk_X509_REVOKED_value(revoked, i);
139 STACK_OF(X509_EXTENSION) *exts;
140 ASN1_ENUMERATED *reason;
141 X509_EXTENSION *ext;
142 gtmp = X509_REVOKED_get_ext_d2i(rev,
143 NID_certificate_issuer,
144 &j, NULL);
145 if (!gtmp && (j != -1))
146 {
147 crl->flags |= EXFLAG_INVALID;
148 return 1;
149 }
150
151 if (gtmp)
152 {
153 gens = gtmp;
154 if (!crl->issuers)
155 {
156 crl->issuers = sk_GENERAL_NAMES_new_null();
157 if (!crl->issuers)
158 return 0;
159 }
160 if (!sk_GENERAL_NAMES_push(crl->issuers, gtmp))
161 return 0;
162 }
163 rev->issuer = gens;
164
165 reason = X509_REVOKED_get_ext_d2i(rev, NID_crl_reason,
166 &j, NULL);
167 if (!reason && (j != -1))
168 {
169 crl->flags |= EXFLAG_INVALID;
170 return 1;
171 }
172
173 if (reason)
174 {
175 rev->reason = ASN1_ENUMERATED_get(reason);
176 ASN1_ENUMERATED_free(reason);
177 }
178 else
179 rev->reason = CRL_REASON_NONE;
180
181 /* Check for critical CRL entry extensions */
182
183 exts = rev->extensions;
184
185 for (j = 0; j < sk_X509_EXTENSION_num(exts); j++)
186 {
187 ext = sk_X509_EXTENSION_value(exts, j);
188 if (ext->critical > 0)
189 {
190 if (OBJ_obj2nid(ext->object) ==
191 NID_certificate_issuer)
192 continue;
193 crl->flags |= EXFLAG_CRITICAL;
194 break;
195 }
196 }
197
198
199 }
200
201 return 1;
202
203 }
204
205/* The X509_CRL structure needs a bit of customisation. Cache some extensions
206 * and hash of the whole CRL.
207 */
208static int crl_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it,
209 void *exarg)
210 {
211 X509_CRL *crl = (X509_CRL *)*pval;
212 STACK_OF(X509_EXTENSION) *exts;
213 X509_EXTENSION *ext;
214 int idx;
215
216 switch(operation)
217 {
218 case ASN1_OP_NEW_POST:
219 crl->idp = NULL;
220 crl->akid = NULL;
221 crl->flags = 0;
222 crl->idp_flags = 0;
223 crl->idp_reasons = CRLDP_ALL_REASONS;
224 crl->meth = default_crl_method;
225 crl->meth_data = NULL;
226 crl->issuers = NULL;
227 crl->crl_number = NULL;
228 crl->base_crl_number = NULL;
229 break;
230
231 case ASN1_OP_D2I_POST:
232#ifndef OPENSSL_NO_SHA
233 X509_CRL_digest(crl, EVP_sha1(), crl->sha1_hash, NULL);
234#endif
235 crl->idp = X509_CRL_get_ext_d2i(crl,
236 NID_issuing_distribution_point, NULL, NULL);
237 if (crl->idp)
238 setup_idp(crl, crl->idp);
239
240 crl->akid = X509_CRL_get_ext_d2i(crl,
241 NID_authority_key_identifier, NULL, NULL);
242
243 crl->crl_number = X509_CRL_get_ext_d2i(crl,
244 NID_crl_number, NULL, NULL);
245
246 crl->base_crl_number = X509_CRL_get_ext_d2i(crl,
247 NID_delta_crl, NULL, NULL);
248 /* Delta CRLs must have CRL number */
249 if (crl->base_crl_number && !crl->crl_number)
250 crl->flags |= EXFLAG_INVALID;
251
252 /* See if we have any unhandled critical CRL extensions and
253 * indicate this in a flag. We only currently handle IDP so
254 * anything else critical sets the flag.
255 *
256 * This code accesses the X509_CRL structure directly:
257 * applications shouldn't do this.
258 */
259
260 exts = crl->crl->extensions;
261
262 for (idx = 0; idx < sk_X509_EXTENSION_num(exts); idx++)
263 {
264 int nid;
265 ext = sk_X509_EXTENSION_value(exts, idx);
266 nid = OBJ_obj2nid(ext->object);
267 if (nid == NID_freshest_crl)
268 crl->flags |= EXFLAG_FRESHEST;
269 if (ext->critical > 0)
270 {
271 /* We handle IDP and deltas */
272 if ((nid == NID_issuing_distribution_point)
273 || (nid == NID_delta_crl))
274 break;;
275 crl->flags |= EXFLAG_CRITICAL;
276 break;
277 }
278 }
279
280
281 if (!crl_set_issuers(crl))
282 return 0;
283
284 if (crl->meth->crl_init)
285 {
286 if (crl->meth->crl_init(crl) == 0)
287 return 0;
288 }
289 break;
290
291 case ASN1_OP_FREE_POST:
292 if (crl->meth->crl_free)
293 {
294 if (!crl->meth->crl_free(crl))
295 return 0;
296 }
297 if (crl->akid)
298 AUTHORITY_KEYID_free(crl->akid);
299 if (crl->idp)
300 ISSUING_DIST_POINT_free(crl->idp);
301 ASN1_INTEGER_free(crl->crl_number);
302 ASN1_INTEGER_free(crl->base_crl_number);
303 sk_GENERAL_NAMES_pop_free(crl->issuers, GENERAL_NAMES_free);
304 break;
305 }
306 return 1;
307 }
308
309/* Convert IDP into a more convenient form */
310
311static void setup_idp(X509_CRL *crl, ISSUING_DIST_POINT *idp)
312 {
313 int idp_only = 0;
314 /* Set various flags according to IDP */
315 crl->idp_flags |= IDP_PRESENT;
316 if (idp->onlyuser > 0)
317 {
318 idp_only++;
319 crl->idp_flags |= IDP_ONLYUSER;
320 }
321 if (idp->onlyCA > 0)
322 {
323 idp_only++;
324 crl->idp_flags |= IDP_ONLYCA;
325 }
326 if (idp->onlyattr > 0)
327 {
328 idp_only++;
329 crl->idp_flags |= IDP_ONLYATTR;
330 }
331
332 if (idp_only > 1)
333 crl->idp_flags |= IDP_INVALID;
334
335 if (idp->indirectCRL > 0)
336 crl->idp_flags |= IDP_INDIRECT;
337
338 if (idp->onlysomereasons)
339 {
340 crl->idp_flags |= IDP_REASONS;
341 if (idp->onlysomereasons->length > 0)
342 crl->idp_reasons = idp->onlysomereasons->data[0];
343 if (idp->onlysomereasons->length > 1)
344 crl->idp_reasons |=
345 (idp->onlysomereasons->data[1] << 8);
346 crl->idp_reasons &= CRLDP_ALL_REASONS;
347 }
348
349 DIST_POINT_set_dpname(idp->distpoint, X509_CRL_get_issuer(crl));
350 }
351
352ASN1_SEQUENCE_ref(X509_CRL, crl_cb, CRYPTO_LOCK_X509_CRL) = {
105 ASN1_SIMPLE(X509_CRL, crl, X509_CRL_INFO), 353 ASN1_SIMPLE(X509_CRL, crl, X509_CRL_INFO),
106 ASN1_SIMPLE(X509_CRL, sig_alg, X509_ALGOR), 354 ASN1_SIMPLE(X509_CRL, sig_alg, X509_ALGOR),
107 ASN1_SIMPLE(X509_CRL, signature, ASN1_BIT_STRING) 355 ASN1_SIMPLE(X509_CRL, signature, ASN1_BIT_STRING)
@@ -134,6 +382,145 @@ int X509_CRL_add0_revoked(X509_CRL *crl, X509_REVOKED *rev)
134 return 1; 382 return 1;
135} 383}
136 384
385int X509_CRL_verify(X509_CRL *crl, EVP_PKEY *r)
386 {
387 if (crl->meth->crl_verify)
388 return crl->meth->crl_verify(crl, r);
389 return 0;
390 }
391
392int X509_CRL_get0_by_serial(X509_CRL *crl,
393 X509_REVOKED **ret, ASN1_INTEGER *serial)
394 {
395 if (crl->meth->crl_lookup)
396 return crl->meth->crl_lookup(crl, ret, serial, NULL);
397 return 0;
398 }
399
400int X509_CRL_get0_by_cert(X509_CRL *crl, X509_REVOKED **ret, X509 *x)
401 {
402 if (crl->meth->crl_lookup)
403 return crl->meth->crl_lookup(crl, ret,
404 X509_get_serialNumber(x),
405 X509_get_issuer_name(x));
406 return 0;
407 }
408
409static int def_crl_verify(X509_CRL *crl, EVP_PKEY *r)
410 {
411 return(ASN1_item_verify(ASN1_ITEM_rptr(X509_CRL_INFO),
412 crl->sig_alg, crl->signature,crl->crl,r));
413 }
414
415static int crl_revoked_issuer_match(X509_CRL *crl, X509_NAME *nm,
416 X509_REVOKED *rev)
417 {
418 int i;
419
420 if (!rev->issuer)
421 {
422 if (!nm)
423 return 1;
424 if (!X509_NAME_cmp(nm, X509_CRL_get_issuer(crl)))
425 return 1;
426 return 0;
427 }
428
429 if (!nm)
430 nm = X509_CRL_get_issuer(crl);
431
432 for (i = 0; i < sk_GENERAL_NAME_num(rev->issuer); i++)
433 {
434 GENERAL_NAME *gen = sk_GENERAL_NAME_value(rev->issuer, i);
435 if (gen->type != GEN_DIRNAME)
436 continue;
437 if (!X509_NAME_cmp(nm, gen->d.directoryName))
438 return 1;
439 }
440 return 0;
441
442 }
443
444static int def_crl_lookup(X509_CRL *crl,
445 X509_REVOKED **ret, ASN1_INTEGER *serial, X509_NAME *issuer)
446 {
447 X509_REVOKED rtmp, *rev;
448 int idx;
449 rtmp.serialNumber = serial;
450 /* Sort revoked into serial number order if not already sorted.
451 * Do this under a lock to avoid race condition.
452 */
453 if (!sk_X509_REVOKED_is_sorted(crl->crl->revoked))
454 {
455 CRYPTO_w_lock(CRYPTO_LOCK_X509_CRL);
456 sk_X509_REVOKED_sort(crl->crl->revoked);
457 CRYPTO_w_unlock(CRYPTO_LOCK_X509_CRL);
458 }
459 idx = sk_X509_REVOKED_find(crl->crl->revoked, &rtmp);
460 if(idx < 0)
461 return 0;
462 /* Need to look for matching name */
463 for(;idx < sk_X509_REVOKED_num(crl->crl->revoked); idx++)
464 {
465 rev = sk_X509_REVOKED_value(crl->crl->revoked, idx);
466 if (ASN1_INTEGER_cmp(rev->serialNumber, serial))
467 return 0;
468 if (crl_revoked_issuer_match(crl, issuer, rev))
469 {
470 if (ret)
471 *ret = rev;
472 if (rev->reason == CRL_REASON_REMOVE_FROM_CRL)
473 return 2;
474 return 1;
475 }
476 }
477 return 0;
478 }
479
480void X509_CRL_set_default_method(const X509_CRL_METHOD *meth)
481 {
482 if (meth == NULL)
483 default_crl_method = &int_crl_meth;
484 else
485 default_crl_method = meth;
486 }
487
488X509_CRL_METHOD *X509_CRL_METHOD_new(
489 int (*crl_init)(X509_CRL *crl),
490 int (*crl_free)(X509_CRL *crl),
491 int (*crl_lookup)(X509_CRL *crl, X509_REVOKED **ret,
492 ASN1_INTEGER *ser, X509_NAME *issuer),
493 int (*crl_verify)(X509_CRL *crl, EVP_PKEY *pk))
494 {
495 X509_CRL_METHOD *m;
496 m = OPENSSL_malloc(sizeof(X509_CRL_METHOD));
497 if (!m)
498 return NULL;
499 m->crl_init = crl_init;
500 m->crl_free = crl_free;
501 m->crl_lookup = crl_lookup;
502 m->crl_verify = crl_verify;
503 m->flags = X509_CRL_METHOD_DYNAMIC;
504 return m;
505 }
506
507void X509_CRL_METHOD_free(X509_CRL_METHOD *m)
508 {
509 if (!(m->flags & X509_CRL_METHOD_DYNAMIC))
510 return;
511 OPENSSL_free(m);
512 }
513
514void X509_CRL_set_meth_data(X509_CRL *crl, void *dat)
515 {
516 crl->meth_data = dat;
517 }
518
519void *X509_CRL_get_meth_data(X509_CRL *crl)
520 {
521 return crl->meth_data;
522 }
523
137IMPLEMENT_STACK_OF(X509_REVOKED) 524IMPLEMENT_STACK_OF(X509_REVOKED)
138IMPLEMENT_ASN1_SET_OF(X509_REVOKED) 525IMPLEMENT_ASN1_SET_OF(X509_REVOKED)
139IMPLEMENT_STACK_OF(X509_CRL) 526IMPLEMENT_STACK_OF(X509_CRL)
diff --git a/src/lib/libcrypto/asn1/x_long.c b/src/lib/libcrypto/asn1/x_long.c
index bf35457c1f..75317418e1 100644
--- a/src/lib/libcrypto/asn1/x_long.c
+++ b/src/lib/libcrypto/asn1/x_long.c
@@ -71,6 +71,7 @@ static void long_free(ASN1_VALUE **pval, const ASN1_ITEM *it);
71 71
72static int long_i2c(ASN1_VALUE **pval, unsigned char *cont, int *putype, const ASN1_ITEM *it); 72static int long_i2c(ASN1_VALUE **pval, unsigned char *cont, int *putype, const ASN1_ITEM *it);
73static int long_c2i(ASN1_VALUE **pval, const unsigned char *cont, int len, int utype, char *free_cont, const ASN1_ITEM *it); 73static int long_c2i(ASN1_VALUE **pval, const unsigned char *cont, int len, int utype, char *free_cont, const ASN1_ITEM *it);
74static int long_print(BIO *out, ASN1_VALUE **pval, const ASN1_ITEM *it, int indent, const ASN1_PCTX *pctx);
74 75
75static ASN1_PRIMITIVE_FUNCS long_pf = { 76static ASN1_PRIMITIVE_FUNCS long_pf = {
76 NULL, 0, 77 NULL, 0,
@@ -78,7 +79,8 @@ static ASN1_PRIMITIVE_FUNCS long_pf = {
78 long_free, 79 long_free,
79 long_free, /* Clear should set to initial value */ 80 long_free, /* Clear should set to initial value */
80 long_c2i, 81 long_c2i,
81 long_i2c 82 long_i2c,
83 long_print
82}; 84};
83 85
84ASN1_ITEM_start(LONG) 86ASN1_ITEM_start(LONG)
@@ -169,3 +171,9 @@ static int long_c2i(ASN1_VALUE **pval, const unsigned char *cont, int len,
169 memcpy(cp, &ltmp, sizeof(long)); 171 memcpy(cp, &ltmp, sizeof(long));
170 return 1; 172 return 1;
171} 173}
174
175static int long_print(BIO *out, ASN1_VALUE **pval, const ASN1_ITEM *it,
176 int indent, const ASN1_PCTX *pctx)
177 {
178 return BIO_printf(out, "%ld\n", *(long *)pval);
179 }
diff --git a/src/lib/libcrypto/asn1/x_name.c b/src/lib/libcrypto/asn1/x_name.c
index 04380abc3f..caa4409feb 100644
--- a/src/lib/libcrypto/asn1/x_name.c
+++ b/src/lib/libcrypto/asn1/x_name.c
@@ -57,18 +57,36 @@
57 */ 57 */
58 58
59#include <stdio.h> 59#include <stdio.h>
60#include <ctype.h>
60#include "cryptlib.h" 61#include "cryptlib.h"
61#include <openssl/asn1t.h> 62#include <openssl/asn1t.h>
62#include <openssl/x509.h> 63#include <openssl/x509.h>
64#include "asn1_locl.h"
63 65
64static int x509_name_ex_d2i(ASN1_VALUE **val, const unsigned char **in, long len, const ASN1_ITEM *it, 66typedef STACK_OF(X509_NAME_ENTRY) STACK_OF_X509_NAME_ENTRY;
65 int tag, int aclass, char opt, ASN1_TLC *ctx); 67DECLARE_STACK_OF(STACK_OF_X509_NAME_ENTRY)
66 68
67static int x509_name_ex_i2d(ASN1_VALUE **val, unsigned char **out, const ASN1_ITEM *it, int tag, int aclass); 69static int x509_name_ex_d2i(ASN1_VALUE **val,
70 const unsigned char **in, long len,
71 const ASN1_ITEM *it,
72 int tag, int aclass, char opt, ASN1_TLC *ctx);
73
74static int x509_name_ex_i2d(ASN1_VALUE **val, unsigned char **out,
75 const ASN1_ITEM *it, int tag, int aclass);
68static int x509_name_ex_new(ASN1_VALUE **val, const ASN1_ITEM *it); 76static int x509_name_ex_new(ASN1_VALUE **val, const ASN1_ITEM *it);
69static void x509_name_ex_free(ASN1_VALUE **val, const ASN1_ITEM *it); 77static void x509_name_ex_free(ASN1_VALUE **val, const ASN1_ITEM *it);
70 78
71static int x509_name_encode(X509_NAME *a); 79static int x509_name_encode(X509_NAME *a);
80static int x509_name_canon(X509_NAME *a);
81static int asn1_string_canon(ASN1_STRING *out, ASN1_STRING *in);
82static int i2d_name_canon(STACK_OF(STACK_OF_X509_NAME_ENTRY) *intname,
83 unsigned char **in);
84
85
86static int x509_name_ex_print(BIO *out, ASN1_VALUE **pval,
87 int indent,
88 const char *fname,
89 const ASN1_PCTX *pctx);
72 90
73ASN1_SEQUENCE(X509_NAME_ENTRY) = { 91ASN1_SEQUENCE(X509_NAME_ENTRY) = {
74 ASN1_SIMPLE(X509_NAME_ENTRY, object, ASN1_OBJECT), 92 ASN1_SIMPLE(X509_NAME_ENTRY, object, ASN1_OBJECT),
@@ -102,7 +120,8 @@ const ASN1_EXTERN_FUNCS x509_name_ff = {
102 x509_name_ex_free, 120 x509_name_ex_free,
103 0, /* Default clear behaviour is OK */ 121 0, /* Default clear behaviour is OK */
104 x509_name_ex_d2i, 122 x509_name_ex_d2i,
105 x509_name_ex_i2d 123 x509_name_ex_i2d,
124 x509_name_ex_print
106}; 125};
107 126
108IMPLEMENT_EXTERN_ASN1(X509_NAME, V_ASN1_SEQUENCE, x509_name_ff) 127IMPLEMENT_EXTERN_ASN1(X509_NAME, V_ASN1_SEQUENCE, x509_name_ff)
@@ -118,6 +137,8 @@ static int x509_name_ex_new(ASN1_VALUE **val, const ASN1_ITEM *it)
118 if ((ret->entries=sk_X509_NAME_ENTRY_new_null()) == NULL) 137 if ((ret->entries=sk_X509_NAME_ENTRY_new_null()) == NULL)
119 goto memerr; 138 goto memerr;
120 if((ret->bytes = BUF_MEM_new()) == NULL) goto memerr; 139 if((ret->bytes = BUF_MEM_new()) == NULL) goto memerr;
140 ret->canon_enc = NULL;
141 ret->canon_enclen = 0;
121 ret->modified=1; 142 ret->modified=1;
122 *val = (ASN1_VALUE *)ret; 143 *val = (ASN1_VALUE *)ret;
123 return 1; 144 return 1;
@@ -142,25 +163,19 @@ static void x509_name_ex_free(ASN1_VALUE **pval, const ASN1_ITEM *it)
142 163
143 BUF_MEM_free(a->bytes); 164 BUF_MEM_free(a->bytes);
144 sk_X509_NAME_ENTRY_pop_free(a->entries,X509_NAME_ENTRY_free); 165 sk_X509_NAME_ENTRY_pop_free(a->entries,X509_NAME_ENTRY_free);
166 if (a->canon_enc)
167 OPENSSL_free(a->canon_enc);
145 OPENSSL_free(a); 168 OPENSSL_free(a);
146 *pval = NULL; 169 *pval = NULL;
147} 170}
148 171
149/* Used with sk_pop_free() to free up the internal representation. 172static int x509_name_ex_d2i(ASN1_VALUE **val,
150 * NB: we only free the STACK and not its contents because it is 173 const unsigned char **in, long len, const ASN1_ITEM *it,
151 * already present in the X509_NAME structure. 174 int tag, int aclass, char opt, ASN1_TLC *ctx)
152 */
153
154static void sk_internal_free(void *a)
155{
156 sk_free(a);
157}
158
159static int x509_name_ex_d2i(ASN1_VALUE **val, const unsigned char **in, long len, const ASN1_ITEM *it,
160 int tag, int aclass, char opt, ASN1_TLC *ctx)
161{ 175{
162 const unsigned char *p = *in, *q; 176 const unsigned char *p = *in, *q;
163 union { STACK *s; ASN1_VALUE *a; } intname = {NULL}; 177 union { STACK_OF(STACK_OF_X509_NAME_ENTRY) *s;
178 ASN1_VALUE *a; } intname = {NULL};
164 union { X509_NAME *x; ASN1_VALUE *a; } nm = {NULL}; 179 union { X509_NAME *x; ASN1_VALUE *a; } nm = {NULL};
165 int i, j, ret; 180 int i, j, ret;
166 STACK_OF(X509_NAME_ENTRY) *entries; 181 STACK_OF(X509_NAME_ENTRY) *entries;
@@ -181,8 +196,8 @@ static int x509_name_ex_d2i(ASN1_VALUE **val, const unsigned char **in, long len
181 memcpy(nm.x->bytes->data, q, p - q); 196 memcpy(nm.x->bytes->data, q, p - q);
182 197
183 /* Convert internal representation to X509_NAME structure */ 198 /* Convert internal representation to X509_NAME structure */
184 for(i = 0; i < sk_num(intname.s); i++) { 199 for(i = 0; i < sk_STACK_OF_X509_NAME_ENTRY_num(intname.s); i++) {
185 entries = (STACK_OF(X509_NAME_ENTRY) *)sk_value(intname.s, i); 200 entries = sk_STACK_OF_X509_NAME_ENTRY_value(intname.s, i);
186 for(j = 0; j < sk_X509_NAME_ENTRY_num(entries); j++) { 201 for(j = 0; j < sk_X509_NAME_ENTRY_num(entries); j++) {
187 entry = sk_X509_NAME_ENTRY_value(entries, j); 202 entry = sk_X509_NAME_ENTRY_value(entries, j);
188 entry->set = i; 203 entry->set = i;
@@ -191,7 +206,10 @@ static int x509_name_ex_d2i(ASN1_VALUE **val, const unsigned char **in, long len
191 } 206 }
192 sk_X509_NAME_ENTRY_free(entries); 207 sk_X509_NAME_ENTRY_free(entries);
193 } 208 }
194 sk_free(intname.s); 209 sk_STACK_OF_X509_NAME_ENTRY_free(intname.s);
210 ret = x509_name_canon(nm.x);
211 if (!ret)
212 goto err;
195 nm.x->modified = 0; 213 nm.x->modified = 0;
196 *val = nm.a; 214 *val = nm.a;
197 *in = p; 215 *in = p;
@@ -206,8 +224,12 @@ static int x509_name_ex_i2d(ASN1_VALUE **val, unsigned char **out, const ASN1_IT
206 int ret; 224 int ret;
207 X509_NAME *a = (X509_NAME *)*val; 225 X509_NAME *a = (X509_NAME *)*val;
208 if(a->modified) { 226 if(a->modified) {
209 ret = x509_name_encode((X509_NAME *)a); 227 ret = x509_name_encode(a);
210 if(ret < 0) return ret; 228 if(ret < 0)
229 return ret;
230 ret = x509_name_canon(a);
231 if(ret < 0)
232 return ret;
211 } 233 }
212 ret = a->bytes->length; 234 ret = a->bytes->length;
213 if(out != NULL) { 235 if(out != NULL) {
@@ -217,22 +239,35 @@ static int x509_name_ex_i2d(ASN1_VALUE **val, unsigned char **out, const ASN1_IT
217 return ret; 239 return ret;
218} 240}
219 241
242static void local_sk_X509_NAME_ENTRY_free(STACK_OF(X509_NAME_ENTRY) *ne)
243 {
244 sk_X509_NAME_ENTRY_free(ne);
245 }
246
247static void local_sk_X509_NAME_ENTRY_pop_free(STACK_OF(X509_NAME_ENTRY) *ne)
248 {
249 sk_X509_NAME_ENTRY_pop_free(ne, X509_NAME_ENTRY_free);
250 }
251
220static int x509_name_encode(X509_NAME *a) 252static int x509_name_encode(X509_NAME *a)
221{ 253{
222 union { STACK *s; ASN1_VALUE *a; } intname = {NULL}; 254 union { STACK_OF(STACK_OF_X509_NAME_ENTRY) *s;
255 ASN1_VALUE *a; } intname = {NULL};
223 int len; 256 int len;
224 unsigned char *p; 257 unsigned char *p;
225 STACK_OF(X509_NAME_ENTRY) *entries = NULL; 258 STACK_OF(X509_NAME_ENTRY) *entries = NULL;
226 X509_NAME_ENTRY *entry; 259 X509_NAME_ENTRY *entry;
227 int i, set = -1; 260 int i, set = -1;
228 intname.s = sk_new_null(); 261 intname.s = sk_STACK_OF_X509_NAME_ENTRY_new_null();
229 if(!intname.s) goto memerr; 262 if(!intname.s) goto memerr;
230 for(i = 0; i < sk_X509_NAME_ENTRY_num(a->entries); i++) { 263 for(i = 0; i < sk_X509_NAME_ENTRY_num(a->entries); i++) {
231 entry = sk_X509_NAME_ENTRY_value(a->entries, i); 264 entry = sk_X509_NAME_ENTRY_value(a->entries, i);
232 if(entry->set != set) { 265 if(entry->set != set) {
233 entries = sk_X509_NAME_ENTRY_new_null(); 266 entries = sk_X509_NAME_ENTRY_new_null();
234 if(!entries) goto memerr; 267 if(!entries) goto memerr;
235 if(!sk_push(intname.s, (char *)entries)) goto memerr; 268 if(!sk_STACK_OF_X509_NAME_ENTRY_push(intname.s,
269 entries))
270 goto memerr;
236 set = entry->set; 271 set = entry->set;
237 } 272 }
238 if(!sk_X509_NAME_ENTRY_push(entries, entry)) goto memerr; 273 if(!sk_X509_NAME_ENTRY_push(entries, entry)) goto memerr;
@@ -243,15 +278,222 @@ static int x509_name_encode(X509_NAME *a)
243 p=(unsigned char *)a->bytes->data; 278 p=(unsigned char *)a->bytes->data;
244 ASN1_item_ex_i2d(&intname.a, 279 ASN1_item_ex_i2d(&intname.a,
245 &p, ASN1_ITEM_rptr(X509_NAME_INTERNAL), -1, -1); 280 &p, ASN1_ITEM_rptr(X509_NAME_INTERNAL), -1, -1);
246 sk_pop_free(intname.s, sk_internal_free); 281 sk_STACK_OF_X509_NAME_ENTRY_pop_free(intname.s,
282 local_sk_X509_NAME_ENTRY_free);
247 a->modified = 0; 283 a->modified = 0;
248 return len; 284 return len;
249 memerr: 285memerr:
250 sk_pop_free(intname.s, sk_internal_free); 286 sk_STACK_OF_X509_NAME_ENTRY_pop_free(intname.s,
287 local_sk_X509_NAME_ENTRY_free);
251 ASN1err(ASN1_F_X509_NAME_ENCODE, ERR_R_MALLOC_FAILURE); 288 ASN1err(ASN1_F_X509_NAME_ENCODE, ERR_R_MALLOC_FAILURE);
252 return -1; 289 return -1;
253} 290}
254 291
292static int x509_name_ex_print(BIO *out, ASN1_VALUE **pval,
293 int indent,
294 const char *fname,
295 const ASN1_PCTX *pctx)
296 {
297 if (X509_NAME_print_ex(out, (X509_NAME *)*pval,
298 indent, pctx->nm_flags) <= 0)
299 return 0;
300 return 2;
301 }
302
303/* This function generates the canonical encoding of the Name structure.
304 * In it all strings are converted to UTF8, leading, trailing and
305 * multiple spaces collapsed, converted to lower case and the leading
306 * SEQUENCE header removed.
307 *
308 * In future we could also normalize the UTF8 too.
309 *
310 * By doing this comparison of Name structures can be rapidly
311 * perfomed by just using memcmp() of the canonical encoding.
312 * By omitting the leading SEQUENCE name constraints of type
313 * dirName can also be checked with a simple memcmp().
314 */
315
316static int x509_name_canon(X509_NAME *a)
317 {
318 unsigned char *p;
319 STACK_OF(STACK_OF_X509_NAME_ENTRY) *intname = NULL;
320 STACK_OF(X509_NAME_ENTRY) *entries = NULL;
321 X509_NAME_ENTRY *entry, *tmpentry = NULL;
322 int i, set = -1, ret = 0;
323
324 if (a->canon_enc)
325 {
326 OPENSSL_free(a->canon_enc);
327 a->canon_enc = NULL;
328 }
329 /* Special case: empty X509_NAME => null encoding */
330 if (sk_X509_NAME_ENTRY_num(a->entries) == 0)
331 {
332 a->canon_enclen = 0;
333 return 1;
334 }
335 intname = sk_STACK_OF_X509_NAME_ENTRY_new_null();
336 if(!intname)
337 goto err;
338 for(i = 0; i < sk_X509_NAME_ENTRY_num(a->entries); i++)
339 {
340 entry = sk_X509_NAME_ENTRY_value(a->entries, i);
341 if(entry->set != set)
342 {
343 entries = sk_X509_NAME_ENTRY_new_null();
344 if(!entries)
345 goto err;
346 if(!sk_STACK_OF_X509_NAME_ENTRY_push(intname, entries))
347 goto err;
348 set = entry->set;
349 }
350 tmpentry = X509_NAME_ENTRY_new();
351 tmpentry->object = OBJ_dup(entry->object);
352 if (!asn1_string_canon(tmpentry->value, entry->value))
353 goto err;
354 if(!sk_X509_NAME_ENTRY_push(entries, tmpentry))
355 goto err;
356 tmpentry = NULL;
357 }
358
359 /* Finally generate encoding */
360
361 a->canon_enclen = i2d_name_canon(intname, NULL);
362
363 p = OPENSSL_malloc(a->canon_enclen);
364
365 if (!p)
366 goto err;
367
368 a->canon_enc = p;
369
370 i2d_name_canon(intname, &p);
371
372 ret = 1;
373
374 err:
375
376 if (tmpentry)
377 X509_NAME_ENTRY_free(tmpentry);
378 if (intname)
379 sk_STACK_OF_X509_NAME_ENTRY_pop_free(intname,
380 local_sk_X509_NAME_ENTRY_pop_free);
381 return ret;
382 }
383
384/* Bitmap of all the types of string that will be canonicalized. */
385
386#define ASN1_MASK_CANON \
387 (B_ASN1_UTF8STRING | B_ASN1_BMPSTRING | B_ASN1_UNIVERSALSTRING \
388 | B_ASN1_PRINTABLESTRING | B_ASN1_T61STRING | B_ASN1_IA5STRING \
389 | B_ASN1_VISIBLESTRING)
390
391
392static int asn1_string_canon(ASN1_STRING *out, ASN1_STRING *in)
393 {
394 unsigned char *to, *from;
395 int len, i;
396
397 /* If type not in bitmask just copy string across */
398 if (!(ASN1_tag2bit(in->type) & ASN1_MASK_CANON))
399 {
400 out->type = in->type;
401 if (!ASN1_STRING_set(out, in->data, in->length))
402 return 0;
403 return 1;
404 }
405
406 out->type = V_ASN1_UTF8STRING;
407 out->length = ASN1_STRING_to_UTF8(&out->data, in);
408 if (out->length == -1)
409 return 0;
410
411 to = out->data;
412 from = to;
413
414 len = out->length;
415
416 /* Convert string in place to canonical form.
417 * Ultimately we may need to handle a wider range of characters
418 * but for now ignore anything with MSB set and rely on the
419 * isspace() and tolower() functions.
420 */
421
422 /* Ignore leading spaces */
423 while((len > 0) && !(*from & 0x80) && isspace(*from))
424 {
425 from++;
426 len--;
427 }
428
429 to = from + len - 1;
430
431 /* Ignore trailing spaces */
432 while ((len > 0) && !(*to & 0x80) && isspace(*to))
433 {
434 to--;
435 len--;
436 }
437
438 to = out->data;
439
440 i = 0;
441 while(i < len)
442 {
443 /* If MSB set just copy across */
444 if (*from & 0x80)
445 {
446 *to++ = *from++;
447 i++;
448 }
449 /* Collapse multiple spaces */
450 else if (isspace(*from))
451 {
452 /* Copy one space across */
453 *to++ = ' ';
454 /* Ignore subsequent spaces. Note: don't need to
455 * check len here because we know the last
456 * character is a non-space so we can't overflow.
457 */
458 do
459 {
460 from++;
461 i++;
462 }
463 while(!(*from & 0x80) && isspace(*from));
464 }
465 else
466 {
467 *to++ = tolower(*from++);
468 i++;
469 }
470 }
471
472 out->length = to - out->data;
473
474 return 1;
475
476 }
477
478static int i2d_name_canon(STACK_OF(STACK_OF_X509_NAME_ENTRY) *_intname,
479 unsigned char **in)
480 {
481 int i, len, ltmp;
482 ASN1_VALUE *v;
483 STACK_OF(ASN1_VALUE) *intname = (STACK_OF(ASN1_VALUE) *)_intname;
484
485 len = 0;
486 for (i = 0; i < sk_ASN1_VALUE_num(intname); i++)
487 {
488 v = sk_ASN1_VALUE_value(intname, i);
489 ltmp = ASN1_item_ex_i2d(&v, in,
490 ASN1_ITEM_rptr(X509_NAME_ENTRIES), -1, -1);
491 if (ltmp < 0)
492 return ltmp;
493 len += ltmp;
494 }
495 return len;
496 }
255 497
256int X509_NAME_set(X509_NAME **xn, X509_NAME *name) 498int X509_NAME_set(X509_NAME **xn, X509_NAME *name)
257 { 499 {
diff --git a/src/lib/libcrypto/asn1/x_pubkey.c b/src/lib/libcrypto/asn1/x_pubkey.c
index 91c2756116..d42b6a2c54 100644
--- a/src/lib/libcrypto/asn1/x_pubkey.c
+++ b/src/lib/libcrypto/asn1/x_pubkey.c
@@ -60,6 +60,7 @@
60#include "cryptlib.h" 60#include "cryptlib.h"
61#include <openssl/asn1t.h> 61#include <openssl/asn1t.h>
62#include <openssl/x509.h> 62#include <openssl/x509.h>
63#include "asn1_locl.h"
63#ifndef OPENSSL_NO_RSA 64#ifndef OPENSSL_NO_RSA
64#include <openssl/rsa.h> 65#include <openssl/rsa.h>
65#endif 66#endif
@@ -68,7 +69,8 @@
68#endif 69#endif
69 70
70/* Minor tweak to operation: free up EVP_PKEY */ 71/* Minor tweak to operation: free up EVP_PKEY */
71static int pubkey_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it) 72static int pubkey_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it,
73 void *exarg)
72 { 74 {
73 if (operation == ASN1_OP_FREE_POST) 75 if (operation == ASN1_OP_FREE_POST)
74 { 76 {
@@ -88,169 +90,42 @@ IMPLEMENT_ASN1_FUNCTIONS(X509_PUBKEY)
88int X509_PUBKEY_set(X509_PUBKEY **x, EVP_PKEY *pkey) 90int X509_PUBKEY_set(X509_PUBKEY **x, EVP_PKEY *pkey)
89 { 91 {
90 X509_PUBKEY *pk=NULL; 92 X509_PUBKEY *pk=NULL;
91 X509_ALGOR *a;
92 ASN1_OBJECT *o;
93 unsigned char *s,*p = NULL;
94 int i;
95 93
96 if (x == NULL) return(0); 94 if (x == NULL) return(0);
97 95
98 if ((pk=X509_PUBKEY_new()) == NULL) goto err; 96 if ((pk=X509_PUBKEY_new()) == NULL) goto error;
99 a=pk->algor;
100 97
101 /* set the algorithm id */ 98 if (pkey->ameth)
102 if ((o=OBJ_nid2obj(pkey->type)) == NULL) goto err;
103 ASN1_OBJECT_free(a->algorithm);
104 a->algorithm=o;
105
106 /* Set the parameter list */
107 if (!pkey->save_parameters || (pkey->type == EVP_PKEY_RSA))
108 { 99 {
109 if ((a->parameter == NULL) || 100 if (pkey->ameth->pub_encode)
110 (a->parameter->type != V_ASN1_NULL))
111 { 101 {
112 ASN1_TYPE_free(a->parameter); 102 if (!pkey->ameth->pub_encode(pk, pkey))
113 if (!(a->parameter=ASN1_TYPE_new()))
114 { 103 {
115 X509err(X509_F_X509_PUBKEY_SET,ERR_R_MALLOC_FAILURE); 104 X509err(X509_F_X509_PUBKEY_SET,
116 goto err; 105 X509_R_PUBLIC_KEY_ENCODE_ERROR);
106 goto error;
117 } 107 }
118 a->parameter->type=V_ASN1_NULL;
119 }
120 }
121#ifndef OPENSSL_NO_DSA
122 else if (pkey->type == EVP_PKEY_DSA)
123 {
124 unsigned char *pp;
125 DSA *dsa;
126
127 dsa=pkey->pkey.dsa;
128 dsa->write_params=0;
129 ASN1_TYPE_free(a->parameter);
130 if ((i=i2d_DSAparams(dsa,NULL)) <= 0)
131 goto err;
132 if (!(p=(unsigned char *)OPENSSL_malloc(i)))
133 {
134 X509err(X509_F_X509_PUBKEY_SET,ERR_R_MALLOC_FAILURE);
135 goto err;
136 }
137 pp=p;
138 i2d_DSAparams(dsa,&pp);
139 if (!(a->parameter=ASN1_TYPE_new()))
140 {
141 OPENSSL_free(p);
142 X509err(X509_F_X509_PUBKEY_SET,ERR_R_MALLOC_FAILURE);
143 goto err;
144 }
145 a->parameter->type=V_ASN1_SEQUENCE;
146 if (!(a->parameter->value.sequence=ASN1_STRING_new()))
147 {
148 OPENSSL_free(p);
149 X509err(X509_F_X509_PUBKEY_SET,ERR_R_MALLOC_FAILURE);
150 goto err;
151 } 108 }
152 if (!ASN1_STRING_set(a->parameter->value.sequence,p,i)) 109 else
153 { 110 {
154 OPENSSL_free(p); 111 X509err(X509_F_X509_PUBKEY_SET,
155 X509err(X509_F_X509_PUBKEY_SET,ERR_R_MALLOC_FAILURE); 112 X509_R_METHOD_NOT_SUPPORTED);
156 goto err; 113 goto error;
157 } 114 }
158 OPENSSL_free(p);
159 } 115 }
160#endif 116 else
161#ifndef OPENSSL_NO_EC
162 else if (pkey->type == EVP_PKEY_EC)
163 {
164 int nid=0;
165 unsigned char *pp;
166 EC_KEY *ec_key;
167 const EC_GROUP *group;
168
169 ec_key = pkey->pkey.ec;
170 ASN1_TYPE_free(a->parameter);
171
172 if ((a->parameter = ASN1_TYPE_new()) == NULL)
173 {
174 X509err(X509_F_X509_PUBKEY_SET, ERR_R_ASN1_LIB);
175 goto err;
176 }
177
178 group = EC_KEY_get0_group(ec_key);
179 if (EC_GROUP_get_asn1_flag(group)
180 && (nid = EC_GROUP_get_curve_name(group)))
181 {
182 /* just set the OID */
183 a->parameter->type = V_ASN1_OBJECT;
184 a->parameter->value.object = OBJ_nid2obj(nid);
185 }
186 else /* explicit parameters */
187 {
188 if ((i = i2d_ECParameters(ec_key, NULL)) == 0)
189 {
190 X509err(X509_F_X509_PUBKEY_SET, ERR_R_EC_LIB);
191 goto err;
192 }
193 if ((p = (unsigned char *) OPENSSL_malloc(i)) == NULL)
194 {
195 X509err(X509_F_X509_PUBKEY_SET, ERR_R_MALLOC_FAILURE);
196 goto err;
197 }
198 pp = p;
199 if (!i2d_ECParameters(ec_key, &pp))
200 {
201 X509err(X509_F_X509_PUBKEY_SET, ERR_R_EC_LIB);
202 OPENSSL_free(p);
203 goto err;
204 }
205 a->parameter->type = V_ASN1_SEQUENCE;
206 if ((a->parameter->value.sequence = ASN1_STRING_new()) == NULL)
207 {
208 X509err(X509_F_X509_PUBKEY_SET, ERR_R_ASN1_LIB);
209 OPENSSL_free(p);
210 goto err;
211 }
212 ASN1_STRING_set(a->parameter->value.sequence, p, i);
213 OPENSSL_free(p);
214 }
215 }
216#endif
217 else if (1)
218 { 117 {
219 X509err(X509_F_X509_PUBKEY_SET,X509_R_UNSUPPORTED_ALGORITHM); 118 X509err(X509_F_X509_PUBKEY_SET,X509_R_UNSUPPORTED_ALGORITHM);
220 goto err; 119 goto error;
221 } 120 }
222 121
223 if ((i=i2d_PublicKey(pkey,NULL)) <= 0) goto err;
224 if ((s=(unsigned char *)OPENSSL_malloc(i+1)) == NULL)
225 {
226 X509err(X509_F_X509_PUBKEY_SET,ERR_R_MALLOC_FAILURE);
227 goto err;
228 }
229 p=s;
230 i2d_PublicKey(pkey,&p);
231 if (!M_ASN1_BIT_STRING_set(pk->public_key,s,i))
232 {
233 X509err(X509_F_X509_PUBKEY_SET,ERR_R_MALLOC_FAILURE);
234 goto err;
235 }
236 /* Set number of unused bits to zero */
237 pk->public_key->flags&= ~(ASN1_STRING_FLAG_BITS_LEFT|0x07);
238 pk->public_key->flags|=ASN1_STRING_FLAG_BITS_LEFT;
239
240 OPENSSL_free(s);
241
242#if 0
243 CRYPTO_add(&pkey->references,1,CRYPTO_LOCK_EVP_PKEY);
244 pk->pkey=pkey;
245#endif
246
247 if (*x != NULL) 122 if (*x != NULL)
248 X509_PUBKEY_free(*x); 123 X509_PUBKEY_free(*x);
249 124
250 *x=pk; 125 *x=pk;
251 126
252 return 1; 127 return 1;
253err: 128error:
254 if (pk != NULL) X509_PUBKEY_free(pk); 129 if (pk != NULL) X509_PUBKEY_free(pk);
255 return 0; 130 return 0;
256 } 131 }
@@ -258,119 +133,50 @@ err:
258EVP_PKEY *X509_PUBKEY_get(X509_PUBKEY *key) 133EVP_PKEY *X509_PUBKEY_get(X509_PUBKEY *key)
259 { 134 {
260 EVP_PKEY *ret=NULL; 135 EVP_PKEY *ret=NULL;
261 long j;
262 int type;
263 const unsigned char *p;
264#if !defined(OPENSSL_NO_DSA) || !defined(OPENSSL_NO_ECDSA)
265 const unsigned char *cp;
266 X509_ALGOR *a;
267#endif
268 136
269 if (key == NULL) goto err; 137 if (key == NULL) goto error;
270 138
271 if (key->pkey != NULL) 139 if (key->pkey != NULL)
272 { 140 {
273 CRYPTO_add(&key->pkey->references, 1, CRYPTO_LOCK_EVP_PKEY); 141 CRYPTO_add(&key->pkey->references, 1, CRYPTO_LOCK_EVP_PKEY);
274 return(key->pkey); 142 return key->pkey;
275 } 143 }
276 144
277 if (key->public_key == NULL) goto err; 145 if (key->public_key == NULL) goto error;
278 146
279 type=OBJ_obj2nid(key->algor->algorithm);
280 if ((ret = EVP_PKEY_new()) == NULL) 147 if ((ret = EVP_PKEY_new()) == NULL)
281 { 148 {
282 X509err(X509_F_X509_PUBKEY_GET, ERR_R_MALLOC_FAILURE); 149 X509err(X509_F_X509_PUBKEY_GET, ERR_R_MALLOC_FAILURE);
283 goto err; 150 goto error;
284 } 151 }
285 ret->type = EVP_PKEY_type(type);
286
287 /* the parameters must be extracted before the public key (ECDSA!) */
288
289#if !defined(OPENSSL_NO_DSA) || !defined(OPENSSL_NO_ECDSA)
290 a=key->algor;
291#endif
292 152
293 if (0) 153 if (!EVP_PKEY_set_type(ret, OBJ_obj2nid(key->algor->algorithm)))
294 ;
295#ifndef OPENSSL_NO_DSA
296 else if (ret->type == EVP_PKEY_DSA)
297 { 154 {
298 if (a->parameter && (a->parameter->type == V_ASN1_SEQUENCE)) 155 X509err(X509_F_X509_PUBKEY_GET,X509_R_UNSUPPORTED_ALGORITHM);
299 { 156 goto error;
300 if ((ret->pkey.dsa = DSA_new()) == NULL)
301 {
302 X509err(X509_F_X509_PUBKEY_GET, ERR_R_MALLOC_FAILURE);
303 goto err;
304 }
305 ret->pkey.dsa->write_params=0;
306 cp=p=a->parameter->value.sequence->data;
307 j=a->parameter->value.sequence->length;
308 if (!d2i_DSAparams(&ret->pkey.dsa, &cp, (long)j))
309 goto err;
310 }
311 ret->save_parameters=1;
312 } 157 }
313#endif 158
314#ifndef OPENSSL_NO_EC 159 if (ret->ameth->pub_decode)
315 else if (ret->type == EVP_PKEY_EC)
316 { 160 {
317 if (a->parameter && (a->parameter->type == V_ASN1_SEQUENCE)) 161 if (!ret->ameth->pub_decode(ret, key))
318 { 162 {
319 /* type == V_ASN1_SEQUENCE => we have explicit parameters 163 X509err(X509_F_X509_PUBKEY_GET,
320 * (e.g. parameters in the X9_62_EC_PARAMETERS-structure ) 164 X509_R_PUBLIC_KEY_DECODE_ERROR);
321 */ 165 goto error;
322 if ((ret->pkey.ec= EC_KEY_new()) == NULL)
323 {
324 X509err(X509_F_X509_PUBKEY_GET,
325 ERR_R_MALLOC_FAILURE);
326 goto err;
327 }
328 cp = p = a->parameter->value.sequence->data;
329 j = a->parameter->value.sequence->length;
330 if (!d2i_ECParameters(&ret->pkey.ec, &cp, (long)j))
331 {
332 X509err(X509_F_X509_PUBKEY_GET, ERR_R_EC_LIB);
333 goto err;
334 }
335 }
336 else if (a->parameter && (a->parameter->type == V_ASN1_OBJECT))
337 {
338 /* type == V_ASN1_OBJECT => the parameters are given
339 * by an asn1 OID
340 */
341 EC_KEY *ec_key;
342 EC_GROUP *group;
343
344 if (ret->pkey.ec == NULL)
345 ret->pkey.ec = EC_KEY_new();
346 ec_key = ret->pkey.ec;
347 if (ec_key == NULL)
348 goto err;
349 group = EC_GROUP_new_by_curve_name(OBJ_obj2nid(a->parameter->value.object));
350 if (group == NULL)
351 goto err;
352 EC_GROUP_set_asn1_flag(group, OPENSSL_EC_NAMED_CURVE);
353 if (EC_KEY_set_group(ec_key, group) == 0)
354 goto err;
355 EC_GROUP_free(group);
356 } 166 }
357 /* the case implicitlyCA is currently not implemented */
358 ret->save_parameters = 1;
359 } 167 }
360#endif 168 else
361
362 p=key->public_key->data;
363 j=key->public_key->length;
364 if (!d2i_PublicKey(type, &ret, &p, (long)j))
365 { 169 {
366 X509err(X509_F_X509_PUBKEY_GET, X509_R_ERR_ASN1_LIB); 170 X509err(X509_F_X509_PUBKEY_GET, X509_R_METHOD_NOT_SUPPORTED);
367 goto err; 171 goto error;
368 } 172 }
369 173
370 key->pkey = ret; 174 key->pkey = ret;
371 CRYPTO_add(&ret->references, 1, CRYPTO_LOCK_EVP_PKEY); 175 CRYPTO_add(&ret->references, 1, CRYPTO_LOCK_EVP_PKEY);
372 return(ret); 176
373err: 177 return ret;
178
179 error:
374 if (ret != NULL) 180 if (ret != NULL)
375 EVP_PKEY_free(ret); 181 EVP_PKEY_free(ret);
376 return(NULL); 182 return(NULL);
@@ -529,3 +335,39 @@ int i2d_EC_PUBKEY(EC_KEY *a, unsigned char **pp)
529 return(ret); 335 return(ret);
530 } 336 }
531#endif 337#endif
338
339int X509_PUBKEY_set0_param(X509_PUBKEY *pub, ASN1_OBJECT *aobj,
340 int ptype, void *pval,
341 unsigned char *penc, int penclen)
342 {
343 if (!X509_ALGOR_set0(pub->algor, aobj, ptype, pval))
344 return 0;
345 if (penc)
346 {
347 if (pub->public_key->data)
348 OPENSSL_free(pub->public_key->data);
349 pub->public_key->data = penc;
350 pub->public_key->length = penclen;
351 /* Set number of unused bits to zero */
352 pub->public_key->flags&= ~(ASN1_STRING_FLAG_BITS_LEFT|0x07);
353 pub->public_key->flags|=ASN1_STRING_FLAG_BITS_LEFT;
354 }
355 return 1;
356 }
357
358int X509_PUBKEY_get0_param(ASN1_OBJECT **ppkalg,
359 const unsigned char **pk, int *ppklen,
360 X509_ALGOR **pa,
361 X509_PUBKEY *pub)
362 {
363 if (ppkalg)
364 *ppkalg = pub->algor->algorithm;
365 if (pk)
366 {
367 *pk = pub->public_key->data;
368 *ppklen = pub->public_key->length;
369 }
370 if (pa)
371 *pa = pub->algor;
372 return 1;
373 }
diff --git a/src/lib/libcrypto/asn1/x_req.c b/src/lib/libcrypto/asn1/x_req.c
index 59ca8ce329..d57555827c 100644
--- a/src/lib/libcrypto/asn1/x_req.c
+++ b/src/lib/libcrypto/asn1/x_req.c
@@ -79,7 +79,8 @@
79 * 79 *
80 */ 80 */
81 81
82static int rinf_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it) 82static int rinf_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it,
83 void *exarg)
83{ 84{
84 X509_REQ_INFO *rinf = (X509_REQ_INFO *)*pval; 85 X509_REQ_INFO *rinf = (X509_REQ_INFO *)*pval;
85 86
diff --git a/src/lib/libcrypto/asn1/x_x509.c b/src/lib/libcrypto/asn1/x_x509.c
index e118696625..dafd3cc921 100644
--- a/src/lib/libcrypto/asn1/x_x509.c
+++ b/src/lib/libcrypto/asn1/x_x509.c
@@ -81,7 +81,8 @@ IMPLEMENT_ASN1_FUNCTIONS(X509_CINF)
81 81
82extern void policy_cache_free(X509_POLICY_CACHE *cache); 82extern void policy_cache_free(X509_POLICY_CACHE *cache);
83 83
84static int x509_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it) 84static int x509_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it,
85 void *exarg)
85{ 86{
86 X509 *ret = (X509 *)*pval; 87 X509 *ret = (X509 *)*pval;
87 88
@@ -99,6 +100,7 @@ static int x509_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it)
99 ret->rfc3779_asid = NULL; 100 ret->rfc3779_asid = NULL;
100#endif 101#endif
101 ret->aux = NULL; 102 ret->aux = NULL;
103 ret->crldp = NULL;
102 CRYPTO_new_ex_data(CRYPTO_EX_INDEX_X509, ret, &ret->ex_data); 104 CRYPTO_new_ex_data(CRYPTO_EX_INDEX_X509, ret, &ret->ex_data);
103 break; 105 break;
104 106
@@ -112,7 +114,10 @@ static int x509_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it)
112 X509_CERT_AUX_free(ret->aux); 114 X509_CERT_AUX_free(ret->aux);
113 ASN1_OCTET_STRING_free(ret->skid); 115 ASN1_OCTET_STRING_free(ret->skid);
114 AUTHORITY_KEYID_free(ret->akid); 116 AUTHORITY_KEYID_free(ret->akid);
117 CRL_DIST_POINTS_free(ret->crldp);
115 policy_cache_free(ret->policy_cache); 118 policy_cache_free(ret->policy_cache);
119 GENERAL_NAMES_free(ret->altname);
120 NAME_CONSTRAINTS_free(ret->nc);
116#ifndef OPENSSL_NO_RFC3779 121#ifndef OPENSSL_NO_RFC3779
117 sk_IPAddressFamily_pop_free(ret->rfc3779_addr, IPAddressFamily_free); 122 sk_IPAddressFamily_pop_free(ret->rfc3779_addr, IPAddressFamily_free);
118 ASIdentifiers_free(ret->rfc3779_asid); 123 ASIdentifiers_free(ret->rfc3779_asid);
@@ -136,19 +141,6 @@ ASN1_SEQUENCE_ref(X509, x509_cb, CRYPTO_LOCK_X509) = {
136IMPLEMENT_ASN1_FUNCTIONS(X509) 141IMPLEMENT_ASN1_FUNCTIONS(X509)
137IMPLEMENT_ASN1_DUP_FUNCTION(X509) 142IMPLEMENT_ASN1_DUP_FUNCTION(X509)
138 143
139static ASN1_METHOD meth=
140 {
141 (I2D_OF(void)) i2d_X509,
142 (D2I_OF(void)) d2i_X509,
143 (void *(*)(void))X509_new,
144 (void (*)(void *)) X509_free
145 };
146
147ASN1_METHOD *X509_asn1_meth(void)
148 {
149 return(&meth);
150 }
151
152int X509_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func, 144int X509_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func,
153 CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func) 145 CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func)
154 { 146 {