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/Makefile885
-rw-r--r--src/lib/libcrypto/asn1/Makefile.ssl1152
-rw-r--r--src/lib/libcrypto/asn1/a_bitstr.c13
-rw-r--r--src/lib/libcrypto/asn1/a_bool.c4
-rw-r--r--src/lib/libcrypto/asn1/a_bytes.c24
-rw-r--r--src/lib/libcrypto/asn1/a_d2i_fp.c32
-rw-r--r--src/lib/libcrypto/asn1/a_digest.c2
-rw-r--r--src/lib/libcrypto/asn1/a_dup.c18
-rw-r--r--src/lib/libcrypto/asn1/a_enum.c12
-rw-r--r--src/lib/libcrypto/asn1/a_gentm.c246
-rw-r--r--src/lib/libcrypto/asn1/a_hdr.c119
-rw-r--r--src/lib/libcrypto/asn1/a_i2d_fp.c8
-rw-r--r--src/lib/libcrypto/asn1/a_int.c26
-rw-r--r--src/lib/libcrypto/asn1/a_mbstr.c20
-rw-r--r--src/lib/libcrypto/asn1/a_meth.c84
-rw-r--r--src/lib/libcrypto/asn1/a_object.c100
-rw-r--r--src/lib/libcrypto/asn1/a_octet.c2
-rw-r--r--src/lib/libcrypto/asn1/a_set.c21
-rw-r--r--src/lib/libcrypto/asn1/a_sign.c23
-rw-r--r--src/lib/libcrypto/asn1/a_strex.c32
-rw-r--r--src/lib/libcrypto/asn1/a_type.c28
-rw-r--r--src/lib/libcrypto/asn1/a_utctm.c303
-rw-r--r--src/lib/libcrypto/asn1/a_verify.c12
-rw-r--r--src/lib/libcrypto/asn1/asn1.h341
-rw-r--r--src/lib/libcrypto/asn1/asn1_err.c91
-rw-r--r--src/lib/libcrypto/asn1/asn1_lib.c73
-rw-r--r--src/lib/libcrypto/asn1/asn1_mac.h39
-rw-r--r--src/lib/libcrypto/asn1/asn1_par.c58
-rw-r--r--src/lib/libcrypto/asn1/asn1t.h109
-rw-r--r--src/lib/libcrypto/asn1/asn_moid.c64
-rw-r--r--src/lib/libcrypto/asn1/asn_pack.c26
-rw-r--r--src/lib/libcrypto/asn1/d2i_pr.c24
-rw-r--r--src/lib/libcrypto/asn1/d2i_pu.c19
-rw-r--r--src/lib/libcrypto/asn1/evp_asn1.c4
-rw-r--r--src/lib/libcrypto/asn1/f.c80
-rw-r--r--src/lib/libcrypto/asn1/i2d_pr.c9
-rw-r--r--src/lib/libcrypto/asn1/i2d_pu.c7
-rw-r--r--src/lib/libcrypto/asn1/n_pkey.c49
-rw-r--r--src/lib/libcrypto/asn1/p5_pbe.c15
-rw-r--r--src/lib/libcrypto/asn1/p5_pbev2.c6
-rw-r--r--src/lib/libcrypto/asn1/p8_key.c131
-rw-r--r--src/lib/libcrypto/asn1/t_crl.c4
-rw-r--r--src/lib/libcrypto/asn1/t_pkey.c548
-rw-r--r--src/lib/libcrypto/asn1/t_req.c22
-rw-r--r--src/lib/libcrypto/asn1/t_spki.c16
-rw-r--r--src/lib/libcrypto/asn1/t_x509.c39
-rw-r--r--src/lib/libcrypto/asn1/tasn_dec.c1059
-rw-r--r--src/lib/libcrypto/asn1/tasn_enc.c514
-rw-r--r--src/lib/libcrypto/asn1/tasn_fre.c149
-rw-r--r--src/lib/libcrypto/asn1/tasn_new.c234
-rw-r--r--src/lib/libcrypto/asn1/tasn_typ.c4
-rw-r--r--src/lib/libcrypto/asn1/tasn_utl.c128
-rw-r--r--src/lib/libcrypto/asn1/x_algor.c57
-rw-r--r--src/lib/libcrypto/asn1/x_bignum.c6
-rw-r--r--src/lib/libcrypto/asn1/x_cinf.c201
-rw-r--r--src/lib/libcrypto/asn1/x_crl.c2
-rw-r--r--src/lib/libcrypto/asn1/x_exten.c5
-rw-r--r--src/lib/libcrypto/asn1/x_long.c8
-rw-r--r--src/lib/libcrypto/asn1/x_name.c52
-rw-r--r--src/lib/libcrypto/asn1/x_pkey.c6
-rw-r--r--src/lib/libcrypto/asn1/x_pubkey.c285
-rw-r--r--src/lib/libcrypto/asn1/x_req.c2
-rw-r--r--src/lib/libcrypto/asn1/x_x509.c27
-rw-r--r--src/lib/libcrypto/asn1/x_x509a.c29
64 files changed, 4465 insertions, 3243 deletions
diff --git a/src/lib/libcrypto/asn1/Makefile b/src/lib/libcrypto/asn1/Makefile
new file mode 100644
index 0000000000..63066899d0
--- /dev/null
+++ b/src/lib/libcrypto/asn1/Makefile
@@ -0,0 +1,885 @@
1#
2# OpenSSL/crypto/asn1/Makefile
3#
4
5DIR= asn1
6TOP= ../..
7CC= cc
8INCLUDES= -I.. -I$(TOP) -I../../include
9CFLAG=-g
10MAKEFILE= Makefile
11AR= ar r
12
13CFLAGS= $(INCLUDES) $(CFLAG)
14
15GENERAL=Makefile README
16TEST=
17APPS=
18
19LIB=$(TOP)/libcrypto.a
20LIBSRC= a_object.c a_bitstr.c a_utctm.c a_gentm.c a_time.c a_int.c a_octet.c \
21 a_print.c a_type.c a_set.c a_dup.c a_d2i_fp.c a_i2d_fp.c \
22 a_enum.c a_utf8.c a_sign.c a_digest.c a_verify.c a_mbstr.c a_strex.c \
23 x_algor.c x_val.c x_pubkey.c x_sig.c x_req.c x_attrib.c x_bignum.c \
24 x_long.c x_name.c x_x509.c x_x509a.c x_crl.c x_info.c x_spki.c nsseq.c \
25 d2i_pu.c d2i_pr.c i2d_pu.c i2d_pr.c\
26 t_req.c t_x509.c t_x509a.c t_crl.c t_pkey.c t_spki.c t_bitst.c \
27 tasn_new.c tasn_fre.c tasn_enc.c tasn_dec.c tasn_utl.c tasn_typ.c \
28 f_int.c f_string.c n_pkey.c \
29 f_enum.c a_hdr.c x_pkey.c a_bool.c x_exten.c asn_mime.c \
30 asn1_gen.c asn1_par.c asn1_lib.c asn1_err.c a_meth.c a_bytes.c a_strnid.c \
31 evp_asn1.c asn_pack.c p5_pbe.c p5_pbev2.c p8_pkey.c asn_moid.c
32LIBOBJ= a_object.o a_bitstr.o a_utctm.o a_gentm.o a_time.o a_int.o a_octet.o \
33 a_print.o a_type.o a_set.o a_dup.o a_d2i_fp.o a_i2d_fp.o \
34 a_enum.o a_utf8.o a_sign.o a_digest.o a_verify.o a_mbstr.o a_strex.o \
35 x_algor.o x_val.o x_pubkey.o x_sig.o x_req.o x_attrib.o x_bignum.o \
36 x_long.o x_name.o x_x509.o x_x509a.o x_crl.o x_info.o x_spki.o nsseq.o \
37 d2i_pu.o d2i_pr.o i2d_pu.o i2d_pr.o \
38 t_req.o t_x509.o t_x509a.o t_crl.o t_pkey.o t_spki.o t_bitst.o \
39 tasn_new.o tasn_fre.o tasn_enc.o tasn_dec.o tasn_utl.o tasn_typ.o \
40 f_int.o f_string.o n_pkey.o \
41 f_enum.o a_hdr.o x_pkey.o a_bool.o x_exten.o asn_mime.o \
42 asn1_gen.o asn1_par.o asn1_lib.o asn1_err.o a_meth.o a_bytes.o a_strnid.o \
43 evp_asn1.o asn_pack.o p5_pbe.o p5_pbev2.o p8_pkey.o asn_moid.o
44
45SRC= $(LIBSRC)
46
47EXHEADER= asn1.h asn1_mac.h asn1t.h
48HEADER= $(EXHEADER)
49
50ALL= $(GENERAL) $(SRC) $(HEADER)
51
52top:
53 (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all)
54
55test: test.c
56 cc -g -I../../include -c test.c
57 cc -g -I../../include -o test test.o -L../.. -lcrypto
58
59pk: pk.c
60 cc -g -I../../include -c pk.c
61 cc -g -I../../include -o pk pk.o -L../.. -lcrypto
62
63all: lib
64
65lib: $(LIBOBJ)
66 $(AR) $(LIB) $(LIBOBJ)
67 $(RANLIB) $(LIB) || echo Never mind.
68 @touch lib
69
70files:
71 $(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO
72
73links:
74 @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER)
75 @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST)
76 @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS)
77
78install:
79 @[ -n "$(INSTALLTOP)" ] # should be set by top Makefile...
80 @headerlist="$(EXHEADER)"; for i in $$headerlist ; \
81 do \
82 (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
83 chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
84 done;
85
86tags:
87 ctags $(SRC)
88
89tests:
90
91lint:
92 lint -DLINT $(INCLUDES) $(SRC)>fluff
93
94depend:
95 @[ -n "$(MAKEDEPEND)" ] # should be set by top Makefile...
96 $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC)
97
98dclean:
99 $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new
100 mv -f Makefile.new $(MAKEFILE)
101
102clean:
103 rm -f *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
104
105
106# DO NOT DELETE THIS LINE -- make depend depends on it.
107
108a_bitstr.o: ../../e_os.h ../../include/openssl/asn1.h
109a_bitstr.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
110a_bitstr.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
111a_bitstr.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
112a_bitstr.o: ../../include/openssl/opensslconf.h
113a_bitstr.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
114a_bitstr.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
115a_bitstr.o: ../../include/openssl/symhacks.h ../cryptlib.h a_bitstr.c
116a_bool.o: ../../e_os.h ../../include/openssl/asn1.h
117a_bool.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
118a_bool.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
119a_bool.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
120a_bool.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
121a_bool.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
122a_bool.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
123a_bool.o: ../../include/openssl/symhacks.h ../cryptlib.h a_bool.c
124a_bytes.o: ../../e_os.h ../../include/openssl/asn1.h
125a_bytes.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
126a_bytes.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
127a_bytes.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
128a_bytes.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
129a_bytes.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h
130a_bytes.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
131a_bytes.o: ../cryptlib.h a_bytes.c
132a_d2i_fp.o: ../../e_os.h ../../include/openssl/asn1.h
133a_d2i_fp.o: ../../include/openssl/asn1_mac.h ../../include/openssl/bio.h
134a_d2i_fp.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
135a_d2i_fp.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
136a_d2i_fp.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
137a_d2i_fp.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
138a_d2i_fp.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
139a_d2i_fp.o: ../../include/openssl/symhacks.h ../cryptlib.h a_d2i_fp.c
140a_digest.o: ../../e_os.h ../../include/openssl/asn1.h
141a_digest.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
142a_digest.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
143a_digest.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
144a_digest.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
145a_digest.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
146a_digest.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
147a_digest.o: ../../include/openssl/opensslconf.h
148a_digest.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
149a_digest.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
150a_digest.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
151a_digest.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
152a_digest.o: ../../include/openssl/x509_vfy.h ../cryptlib.h a_digest.c
153a_dup.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
154a_dup.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
155a_dup.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
156a_dup.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
157a_dup.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
158a_dup.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
159a_dup.o: ../../include/openssl/symhacks.h ../cryptlib.h a_dup.c
160a_enum.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
161a_enum.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
162a_enum.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
163a_enum.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
164a_enum.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
165a_enum.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h
166a_enum.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
167a_enum.o: ../cryptlib.h a_enum.c
168a_gentm.o: ../../e_os.h ../../include/openssl/asn1.h
169a_gentm.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
170a_gentm.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
171a_gentm.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
172a_gentm.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
173a_gentm.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h
174a_gentm.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
175a_gentm.o: ../cryptlib.h ../o_time.h a_gentm.c
176a_hdr.o: ../../e_os.h ../../include/openssl/asn1.h
177a_hdr.o: ../../include/openssl/asn1_mac.h ../../include/openssl/bio.h
178a_hdr.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
179a_hdr.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
180a_hdr.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
181a_hdr.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
182a_hdr.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
183a_hdr.o: ../../include/openssl/symhacks.h ../cryptlib.h a_hdr.c
184a_i2d_fp.o: ../../e_os.h ../../include/openssl/asn1.h
185a_i2d_fp.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
186a_i2d_fp.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
187a_i2d_fp.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
188a_i2d_fp.o: ../../include/openssl/opensslconf.h
189a_i2d_fp.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
190a_i2d_fp.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
191a_i2d_fp.o: ../../include/openssl/symhacks.h ../cryptlib.h a_i2d_fp.c
192a_int.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
193a_int.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
194a_int.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
195a_int.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
196a_int.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
197a_int.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h
198a_int.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
199a_int.o: ../cryptlib.h a_int.c
200a_mbstr.o: ../../e_os.h ../../include/openssl/asn1.h
201a_mbstr.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
202a_mbstr.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
203a_mbstr.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
204a_mbstr.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
205a_mbstr.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h
206a_mbstr.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
207a_mbstr.o: ../cryptlib.h a_mbstr.c
208a_meth.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
209a_meth.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
210a_meth.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
211a_meth.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
212a_meth.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
213a_meth.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
214a_meth.o: ../../include/openssl/symhacks.h ../cryptlib.h a_meth.c
215a_object.o: ../../e_os.h ../../include/openssl/asn1.h
216a_object.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
217a_object.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
218a_object.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
219a_object.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
220a_object.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
221a_object.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
222a_object.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
223a_object.o: ../../include/openssl/symhacks.h ../cryptlib.h a_object.c
224a_octet.o: ../../e_os.h ../../include/openssl/asn1.h
225a_octet.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
226a_octet.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
227a_octet.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
228a_octet.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
229a_octet.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h
230a_octet.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
231a_octet.o: ../cryptlib.h a_octet.c
232a_print.o: ../../e_os.h ../../include/openssl/asn1.h
233a_print.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
234a_print.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
235a_print.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
236a_print.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
237a_print.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h
238a_print.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
239a_print.o: ../cryptlib.h a_print.c
240a_set.o: ../../e_os.h ../../include/openssl/asn1.h
241a_set.o: ../../include/openssl/asn1_mac.h ../../include/openssl/bio.h
242a_set.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
243a_set.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
244a_set.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
245a_set.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
246a_set.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
247a_set.o: ../../include/openssl/symhacks.h ../cryptlib.h a_set.c
248a_sign.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
249a_sign.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
250a_sign.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
251a_sign.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
252a_sign.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
253a_sign.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
254a_sign.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
255a_sign.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
256a_sign.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
257a_sign.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
258a_sign.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
259a_sign.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
260a_sign.o: ../cryptlib.h a_sign.c
261a_strex.o: ../../e_os.h ../../include/openssl/asn1.h
262a_strex.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
263a_strex.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
264a_strex.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
265a_strex.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
266a_strex.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
267a_strex.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
268a_strex.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
269a_strex.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
270a_strex.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
271a_strex.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
272a_strex.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
273a_strex.o: ../cryptlib.h a_strex.c charmap.h
274a_strnid.o: ../../e_os.h ../../include/openssl/asn1.h
275a_strnid.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
276a_strnid.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
277a_strnid.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
278a_strnid.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
279a_strnid.o: ../../include/openssl/opensslconf.h
280a_strnid.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
281a_strnid.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
282a_strnid.o: ../../include/openssl/symhacks.h ../cryptlib.h a_strnid.c
283a_time.o: ../../e_os.h ../../include/openssl/asn1.h
284a_time.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
285a_time.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
286a_time.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
287a_time.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
288a_time.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
289a_time.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
290a_time.o: ../../include/openssl/symhacks.h ../cryptlib.h ../o_time.h a_time.c
291a_type.o: ../../e_os.h ../../include/openssl/asn1.h
292a_type.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
293a_type.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
294a_type.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
295a_type.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
296a_type.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
297a_type.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
298a_type.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
299a_type.o: ../../include/openssl/symhacks.h ../cryptlib.h a_type.c
300a_utctm.o: ../../e_os.h ../../include/openssl/asn1.h
301a_utctm.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
302a_utctm.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
303a_utctm.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
304a_utctm.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
305a_utctm.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h
306a_utctm.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
307a_utctm.o: ../cryptlib.h ../o_time.h a_utctm.c
308a_utf8.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
309a_utf8.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
310a_utf8.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
311a_utf8.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
312a_utf8.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
313a_utf8.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
314a_utf8.o: ../../include/openssl/symhacks.h ../cryptlib.h a_utf8.c
315a_verify.o: ../../e_os.h ../../include/openssl/asn1.h
316a_verify.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
317a_verify.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
318a_verify.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
319a_verify.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
320a_verify.o: ../../include/openssl/err.h ../../include/openssl/evp.h
321a_verify.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
322a_verify.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
323a_verify.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
324a_verify.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
325a_verify.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
326a_verify.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
327a_verify.o: ../../include/openssl/x509_vfy.h ../cryptlib.h a_verify.c
328asn1_err.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
329asn1_err.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
330asn1_err.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
331asn1_err.o: ../../include/openssl/opensslconf.h
332asn1_err.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
333asn1_err.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
334asn1_err.o: ../../include/openssl/symhacks.h asn1_err.c
335asn1_gen.o: ../../e_os.h ../../include/openssl/asn1.h
336asn1_gen.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
337asn1_gen.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h
338asn1_gen.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
339asn1_gen.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
340asn1_gen.o: ../../include/openssl/err.h ../../include/openssl/evp.h
341asn1_gen.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
342asn1_gen.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
343asn1_gen.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
344asn1_gen.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
345asn1_gen.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
346asn1_gen.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
347asn1_gen.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h
348asn1_gen.o: ../cryptlib.h asn1_gen.c
349asn1_lib.o: ../../e_os.h ../../include/openssl/asn1.h
350asn1_lib.o: ../../include/openssl/asn1_mac.h ../../include/openssl/bio.h
351asn1_lib.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
352asn1_lib.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
353asn1_lib.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
354asn1_lib.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
355asn1_lib.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
356asn1_lib.o: ../../include/openssl/symhacks.h ../cryptlib.h asn1_lib.c
357asn1_par.o: ../../e_os.h ../../include/openssl/asn1.h
358asn1_par.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
359asn1_par.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
360asn1_par.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
361asn1_par.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
362asn1_par.o: ../../include/openssl/opensslconf.h
363asn1_par.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
364asn1_par.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
365asn1_par.o: ../../include/openssl/symhacks.h ../cryptlib.h asn1_par.c
366asn_mime.o: ../../e_os.h ../../include/openssl/asn1.h
367asn_mime.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
368asn_mime.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
369asn_mime.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
370asn_mime.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
371asn_mime.o: ../../include/openssl/err.h ../../include/openssl/evp.h
372asn_mime.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
373asn_mime.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
374asn_mime.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
375asn_mime.o: ../../include/openssl/pkcs7.h ../../include/openssl/rand.h
376asn_mime.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
377asn_mime.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
378asn_mime.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
379asn_mime.o: ../cryptlib.h asn_mime.c
380asn_moid.o: ../../e_os.h ../../include/openssl/asn1.h
381asn_moid.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
382asn_moid.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h
383asn_moid.o: ../../include/openssl/dso.h ../../include/openssl/e_os2.h
384asn_moid.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
385asn_moid.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
386asn_moid.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
387asn_moid.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
388asn_moid.o: ../../include/openssl/opensslconf.h
389asn_moid.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
390asn_moid.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
391asn_moid.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
392asn_moid.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
393asn_moid.o: ../../include/openssl/x509_vfy.h ../cryptlib.h asn_moid.c
394asn_pack.o: ../../e_os.h ../../include/openssl/asn1.h
395asn_pack.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
396asn_pack.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
397asn_pack.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
398asn_pack.o: ../../include/openssl/opensslconf.h
399asn_pack.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
400asn_pack.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
401asn_pack.o: ../../include/openssl/symhacks.h ../cryptlib.h asn_pack.c
402d2i_pr.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
403d2i_pr.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
404d2i_pr.o: ../../include/openssl/crypto.h ../../include/openssl/dsa.h
405d2i_pr.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
406d2i_pr.o: ../../include/openssl/err.h ../../include/openssl/evp.h
407d2i_pr.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
408d2i_pr.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
409d2i_pr.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
410d2i_pr.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
411d2i_pr.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
412d2i_pr.o: ../cryptlib.h d2i_pr.c
413d2i_pu.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
414d2i_pu.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
415d2i_pu.o: ../../include/openssl/crypto.h ../../include/openssl/dsa.h
416d2i_pu.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
417d2i_pu.o: ../../include/openssl/err.h ../../include/openssl/evp.h
418d2i_pu.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
419d2i_pu.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
420d2i_pu.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
421d2i_pu.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
422d2i_pu.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
423d2i_pu.o: ../cryptlib.h d2i_pu.c
424evp_asn1.o: ../../e_os.h ../../include/openssl/asn1.h
425evp_asn1.o: ../../include/openssl/asn1_mac.h ../../include/openssl/bio.h
426evp_asn1.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
427evp_asn1.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
428evp_asn1.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
429evp_asn1.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
430evp_asn1.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
431evp_asn1.o: ../../include/openssl/symhacks.h ../cryptlib.h evp_asn1.c
432f_enum.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
433f_enum.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
434f_enum.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
435f_enum.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
436f_enum.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
437f_enum.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
438f_enum.o: ../../include/openssl/symhacks.h ../cryptlib.h f_enum.c
439f_int.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
440f_int.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
441f_int.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
442f_int.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
443f_int.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
444f_int.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
445f_int.o: ../../include/openssl/symhacks.h ../cryptlib.h f_int.c
446f_string.o: ../../e_os.h ../../include/openssl/asn1.h
447f_string.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
448f_string.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
449f_string.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
450f_string.o: ../../include/openssl/opensslconf.h
451f_string.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
452f_string.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
453f_string.o: ../../include/openssl/symhacks.h ../cryptlib.h f_string.c
454i2d_pr.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
455i2d_pr.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
456i2d_pr.o: ../../include/openssl/crypto.h ../../include/openssl/dsa.h
457i2d_pr.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
458i2d_pr.o: ../../include/openssl/err.h ../../include/openssl/evp.h
459i2d_pr.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
460i2d_pr.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
461i2d_pr.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
462i2d_pr.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
463i2d_pr.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
464i2d_pr.o: ../cryptlib.h i2d_pr.c
465i2d_pu.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
466i2d_pu.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
467i2d_pu.o: ../../include/openssl/crypto.h ../../include/openssl/dsa.h
468i2d_pu.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
469i2d_pu.o: ../../include/openssl/err.h ../../include/openssl/evp.h
470i2d_pu.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
471i2d_pu.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
472i2d_pu.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
473i2d_pu.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
474i2d_pu.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
475i2d_pu.o: ../cryptlib.h i2d_pu.c
476n_pkey.o: ../../e_os.h ../../include/openssl/asn1.h
477n_pkey.o: ../../include/openssl/asn1_mac.h ../../include/openssl/asn1t.h
478n_pkey.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
479n_pkey.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
480n_pkey.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
481n_pkey.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
482n_pkey.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
483n_pkey.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
484n_pkey.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
485n_pkey.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
486n_pkey.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
487n_pkey.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
488n_pkey.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
489n_pkey.o: ../../include/openssl/x509_vfy.h ../cryptlib.h n_pkey.c
490nsseq.o: ../../include/openssl/asn1.h ../../include/openssl/asn1t.h
491nsseq.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
492nsseq.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
493nsseq.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
494nsseq.o: ../../include/openssl/ecdsa.h ../../include/openssl/evp.h
495nsseq.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
496nsseq.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
497nsseq.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
498nsseq.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
499nsseq.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
500nsseq.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
501nsseq.o: ../../include/openssl/x509_vfy.h nsseq.c
502p5_pbe.o: ../../e_os.h ../../include/openssl/asn1.h
503p5_pbe.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
504p5_pbe.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
505p5_pbe.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
506p5_pbe.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
507p5_pbe.o: ../../include/openssl/err.h ../../include/openssl/evp.h
508p5_pbe.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
509p5_pbe.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
510p5_pbe.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
511p5_pbe.o: ../../include/openssl/pkcs7.h ../../include/openssl/rand.h
512p5_pbe.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
513p5_pbe.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
514p5_pbe.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
515p5_pbe.o: ../cryptlib.h p5_pbe.c
516p5_pbev2.o: ../../e_os.h ../../include/openssl/asn1.h
517p5_pbev2.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
518p5_pbev2.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
519p5_pbev2.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
520p5_pbev2.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
521p5_pbev2.o: ../../include/openssl/err.h ../../include/openssl/evp.h
522p5_pbev2.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
523p5_pbev2.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
524p5_pbev2.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
525p5_pbev2.o: ../../include/openssl/pkcs7.h ../../include/openssl/rand.h
526p5_pbev2.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
527p5_pbev2.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
528p5_pbev2.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
529p5_pbev2.o: ../cryptlib.h p5_pbev2.c
530p8_pkey.o: ../../e_os.h ../../include/openssl/asn1.h
531p8_pkey.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
532p8_pkey.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
533p8_pkey.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
534p8_pkey.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
535p8_pkey.o: ../../include/openssl/err.h ../../include/openssl/evp.h
536p8_pkey.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
537p8_pkey.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
538p8_pkey.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
539p8_pkey.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
540p8_pkey.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
541p8_pkey.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
542p8_pkey.o: ../../include/openssl/x509_vfy.h ../cryptlib.h p8_pkey.c
543t_bitst.o: ../../e_os.h ../../include/openssl/asn1.h
544t_bitst.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
545t_bitst.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h
546t_bitst.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
547t_bitst.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
548t_bitst.o: ../../include/openssl/err.h ../../include/openssl/evp.h
549t_bitst.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
550t_bitst.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
551t_bitst.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
552t_bitst.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
553t_bitst.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
554t_bitst.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
555t_bitst.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h
556t_bitst.o: ../cryptlib.h t_bitst.c
557t_crl.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
558t_crl.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
559t_crl.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h
560t_crl.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
561t_crl.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
562t_crl.o: ../../include/openssl/err.h ../../include/openssl/evp.h
563t_crl.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
564t_crl.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
565t_crl.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
566t_crl.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
567t_crl.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
568t_crl.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
569t_crl.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h
570t_crl.o: ../cryptlib.h t_crl.c
571t_pkey.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
572t_pkey.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
573t_pkey.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h
574t_pkey.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
575t_pkey.o: ../../include/openssl/ec.h ../../include/openssl/err.h
576t_pkey.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
577t_pkey.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
578t_pkey.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
579t_pkey.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
580t_pkey.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
581t_pkey.o: ../cryptlib.h t_pkey.c
582t_req.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
583t_req.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
584t_req.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h
585t_req.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
586t_req.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
587t_req.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
588t_req.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
589t_req.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
590t_req.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
591t_req.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
592t_req.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
593t_req.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
594t_req.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
595t_req.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h
596t_req.o: ../cryptlib.h t_req.c
597t_spki.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
598t_spki.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
599t_spki.o: ../../include/openssl/crypto.h ../../include/openssl/dsa.h
600t_spki.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
601t_spki.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
602t_spki.o: ../../include/openssl/err.h ../../include/openssl/evp.h
603t_spki.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
604t_spki.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
605t_spki.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
606t_spki.o: ../../include/openssl/pkcs7.h ../../include/openssl/rsa.h
607t_spki.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
608t_spki.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
609t_spki.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
610t_spki.o: ../cryptlib.h t_spki.c
611t_x509.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
612t_x509.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
613t_x509.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h
614t_x509.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
615t_x509.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
616t_x509.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
617t_x509.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
618t_x509.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
619t_x509.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
620t_x509.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
621t_x509.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
622t_x509.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
623t_x509.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
624t_x509.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h
625t_x509.o: ../cryptlib.h t_x509.c
626t_x509a.o: ../../e_os.h ../../include/openssl/asn1.h
627t_x509a.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
628t_x509a.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
629t_x509a.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
630t_x509a.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
631t_x509a.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
632t_x509a.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
633t_x509a.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
634t_x509a.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
635t_x509a.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
636t_x509a.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
637t_x509a.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
638t_x509a.o: ../cryptlib.h t_x509a.c
639tasn_dec.o: ../../include/openssl/asn1.h ../../include/openssl/asn1t.h
640tasn_dec.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
641tasn_dec.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
642tasn_dec.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
643tasn_dec.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
644tasn_dec.o: ../../include/openssl/opensslconf.h
645tasn_dec.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
646tasn_dec.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
647tasn_dec.o: ../../include/openssl/symhacks.h tasn_dec.c
648tasn_enc.o: ../../e_os.h ../../include/openssl/asn1.h
649tasn_enc.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
650tasn_enc.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
651tasn_enc.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
652tasn_enc.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
653tasn_enc.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
654tasn_enc.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
655tasn_enc.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
656tasn_enc.o: ../../include/openssl/symhacks.h ../cryptlib.h tasn_enc.c
657tasn_fre.o: ../../include/openssl/asn1.h ../../include/openssl/asn1t.h
658tasn_fre.o: ../../include/openssl/bio.h ../../include/openssl/crypto.h
659tasn_fre.o: ../../include/openssl/e_os2.h ../../include/openssl/obj_mac.h
660tasn_fre.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
661tasn_fre.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
662tasn_fre.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
663tasn_fre.o: ../../include/openssl/symhacks.h tasn_fre.c
664tasn_new.o: ../../include/openssl/asn1.h ../../include/openssl/asn1t.h
665tasn_new.o: ../../include/openssl/bio.h ../../include/openssl/crypto.h
666tasn_new.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
667tasn_new.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
668tasn_new.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
669tasn_new.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
670tasn_new.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
671tasn_new.o: ../../include/openssl/symhacks.h tasn_new.c
672tasn_typ.o: ../../include/openssl/asn1.h ../../include/openssl/asn1t.h
673tasn_typ.o: ../../include/openssl/bio.h ../../include/openssl/crypto.h
674tasn_typ.o: ../../include/openssl/e_os2.h ../../include/openssl/opensslconf.h
675tasn_typ.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
676tasn_typ.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
677tasn_typ.o: ../../include/openssl/symhacks.h tasn_typ.c
678tasn_utl.o: ../../include/openssl/asn1.h ../../include/openssl/asn1t.h
679tasn_utl.o: ../../include/openssl/bio.h ../../include/openssl/crypto.h
680tasn_utl.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
681tasn_utl.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
682tasn_utl.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
683tasn_utl.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
684tasn_utl.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
685tasn_utl.o: ../../include/openssl/symhacks.h tasn_utl.c
686x_algor.o: ../../include/openssl/asn1.h ../../include/openssl/asn1t.h
687x_algor.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
688x_algor.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
689x_algor.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
690x_algor.o: ../../include/openssl/ecdsa.h ../../include/openssl/evp.h
691x_algor.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
692x_algor.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
693x_algor.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
694x_algor.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
695x_algor.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
696x_algor.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
697x_algor.o: ../../include/openssl/x509_vfy.h x_algor.c
698x_attrib.o: ../../e_os.h ../../include/openssl/asn1.h
699x_attrib.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
700x_attrib.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
701x_attrib.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
702x_attrib.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
703x_attrib.o: ../../include/openssl/err.h ../../include/openssl/evp.h
704x_attrib.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
705x_attrib.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
706x_attrib.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
707x_attrib.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
708x_attrib.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
709x_attrib.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
710x_attrib.o: ../../include/openssl/x509_vfy.h ../cryptlib.h x_attrib.c
711x_bignum.o: ../../e_os.h ../../include/openssl/asn1.h
712x_bignum.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
713x_bignum.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
714x_bignum.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
715x_bignum.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
716x_bignum.o: ../../include/openssl/opensslconf.h
717x_bignum.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
718x_bignum.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
719x_bignum.o: ../../include/openssl/symhacks.h ../cryptlib.h x_bignum.c
720x_crl.o: ../../e_os.h ../../include/openssl/asn1.h
721x_crl.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
722x_crl.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
723x_crl.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
724x_crl.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
725x_crl.o: ../../include/openssl/err.h ../../include/openssl/evp.h
726x_crl.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
727x_crl.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
728x_crl.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
729x_crl.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
730x_crl.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
731x_crl.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
732x_crl.o: ../../include/openssl/x509_vfy.h ../cryptlib.h x_crl.c
733x_exten.o: ../../include/openssl/asn1.h ../../include/openssl/asn1t.h
734x_exten.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
735x_exten.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
736x_exten.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
737x_exten.o: ../../include/openssl/ecdsa.h ../../include/openssl/evp.h
738x_exten.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
739x_exten.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
740x_exten.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
741x_exten.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
742x_exten.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
743x_exten.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
744x_exten.o: ../../include/openssl/x509_vfy.h x_exten.c
745x_info.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
746x_info.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
747x_info.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
748x_info.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
749x_info.o: ../../include/openssl/err.h ../../include/openssl/evp.h
750x_info.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
751x_info.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
752x_info.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
753x_info.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
754x_info.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
755x_info.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
756x_info.o: ../../include/openssl/x509_vfy.h ../cryptlib.h x_info.c
757x_long.o: ../../e_os.h ../../include/openssl/asn1.h
758x_long.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
759x_long.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
760x_long.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
761x_long.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
762x_long.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
763x_long.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h
764x_long.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
765x_long.o: ../cryptlib.h x_long.c
766x_name.o: ../../e_os.h ../../include/openssl/asn1.h
767x_name.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
768x_name.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
769x_name.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
770x_name.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
771x_name.o: ../../include/openssl/err.h ../../include/openssl/evp.h
772x_name.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
773x_name.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
774x_name.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
775x_name.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
776x_name.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
777x_name.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
778x_name.o: ../../include/openssl/x509_vfy.h ../cryptlib.h x_name.c
779x_pkey.o: ../../e_os.h ../../include/openssl/asn1.h
780x_pkey.o: ../../include/openssl/asn1_mac.h ../../include/openssl/bio.h
781x_pkey.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
782x_pkey.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
783x_pkey.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
784x_pkey.o: ../../include/openssl/err.h ../../include/openssl/evp.h
785x_pkey.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
786x_pkey.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
787x_pkey.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
788x_pkey.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
789x_pkey.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
790x_pkey.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
791x_pkey.o: ../../include/openssl/x509_vfy.h ../cryptlib.h x_pkey.c
792x_pubkey.o: ../../e_os.h ../../include/openssl/asn1.h
793x_pubkey.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
794x_pubkey.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
795x_pubkey.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
796x_pubkey.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
797x_pubkey.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
798x_pubkey.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
799x_pubkey.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
800x_pubkey.o: ../../include/openssl/opensslconf.h
801x_pubkey.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
802x_pubkey.o: ../../include/openssl/pkcs7.h ../../include/openssl/rsa.h
803x_pubkey.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
804x_pubkey.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
805x_pubkey.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
806x_pubkey.o: ../cryptlib.h x_pubkey.c
807x_req.o: ../../e_os.h ../../include/openssl/asn1.h
808x_req.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
809x_req.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
810x_req.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
811x_req.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
812x_req.o: ../../include/openssl/err.h ../../include/openssl/evp.h
813x_req.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
814x_req.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
815x_req.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
816x_req.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
817x_req.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
818x_req.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
819x_req.o: ../../include/openssl/x509_vfy.h ../cryptlib.h x_req.c
820x_sig.o: ../../e_os.h ../../include/openssl/asn1.h
821x_sig.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
822x_sig.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
823x_sig.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
824x_sig.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
825x_sig.o: ../../include/openssl/err.h ../../include/openssl/evp.h
826x_sig.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
827x_sig.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
828x_sig.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
829x_sig.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
830x_sig.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
831x_sig.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
832x_sig.o: ../../include/openssl/x509_vfy.h ../cryptlib.h x_sig.c
833x_spki.o: ../../e_os.h ../../include/openssl/asn1.h
834x_spki.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
835x_spki.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
836x_spki.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
837x_spki.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
838x_spki.o: ../../include/openssl/err.h ../../include/openssl/evp.h
839x_spki.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
840x_spki.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
841x_spki.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
842x_spki.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
843x_spki.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
844x_spki.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
845x_spki.o: ../../include/openssl/x509_vfy.h ../cryptlib.h x_spki.c
846x_val.o: ../../e_os.h ../../include/openssl/asn1.h
847x_val.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
848x_val.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
849x_val.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
850x_val.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
851x_val.o: ../../include/openssl/err.h ../../include/openssl/evp.h
852x_val.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
853x_val.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
854x_val.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
855x_val.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
856x_val.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
857x_val.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
858x_val.o: ../../include/openssl/x509_vfy.h ../cryptlib.h x_val.c
859x_x509.o: ../../e_os.h ../../include/openssl/asn1.h
860x_x509.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
861x_x509.o: ../../include/openssl/buffer.h ../../include/openssl/conf.h
862x_x509.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
863x_x509.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
864x_x509.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
865x_x509.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
866x_x509.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
867x_x509.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
868x_x509.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
869x_x509.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
870x_x509.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
871x_x509.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
872x_x509.o: ../../include/openssl/x509v3.h ../cryptlib.h x_x509.c
873x_x509a.o: ../../e_os.h ../../include/openssl/asn1.h
874x_x509a.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
875x_x509a.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
876x_x509a.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
877x_x509a.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
878x_x509a.o: ../../include/openssl/err.h ../../include/openssl/evp.h
879x_x509a.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
880x_x509a.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
881x_x509a.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
882x_x509a.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
883x_x509a.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
884x_x509a.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
885x_x509a.o: ../../include/openssl/x509_vfy.h ../cryptlib.h x_x509a.c
diff --git a/src/lib/libcrypto/asn1/Makefile.ssl b/src/lib/libcrypto/asn1/Makefile.ssl
new file mode 100644
index 0000000000..cb45194d48
--- /dev/null
+++ b/src/lib/libcrypto/asn1/Makefile.ssl
@@ -0,0 +1,1152 @@
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..b81bf4fc81 100644
--- a/src/lib/libcrypto/asn1/a_bitstr.c
+++ b/src/lib/libcrypto/asn1/a_bitstr.c
@@ -113,12 +113,11 @@ int i2c_ASN1_BIT_STRING(ASN1_BIT_STRING *a, unsigned char **pp)
113 return(ret); 113 return(ret);
114 } 114 }
115 115
116ASN1_BIT_STRING *c2i_ASN1_BIT_STRING(ASN1_BIT_STRING **a, 116ASN1_BIT_STRING *c2i_ASN1_BIT_STRING(ASN1_BIT_STRING **a, unsigned char **pp,
117 const unsigned char **pp, long len) 117 long len)
118 { 118 {
119 ASN1_BIT_STRING *ret=NULL; 119 ASN1_BIT_STRING *ret=NULL;
120 const unsigned char *p; 120 unsigned char *p,*s;
121 unsigned char *s;
122 int i; 121 int i;
123 122
124 if (len < 1) 123 if (len < 1)
@@ -165,7 +164,7 @@ ASN1_BIT_STRING *c2i_ASN1_BIT_STRING(ASN1_BIT_STRING **a,
165 *pp=p; 164 *pp=p;
166 return(ret); 165 return(ret);
167err: 166err:
168 ASN1err(ASN1_F_C2I_ASN1_BIT_STRING,i); 167 ASN1err(ASN1_F_D2I_ASN1_BIT_STRING,i);
169 if ((ret != NULL) && ((a == NULL) || (*a != ret))) 168 if ((ret != NULL) && ((a == NULL) || (*a != ret)))
170 M_ASN1_BIT_STRING_free(ret); 169 M_ASN1_BIT_STRING_free(ret);
171 return(NULL); 170 return(NULL);
@@ -183,11 +182,9 @@ int ASN1_BIT_STRING_set_bit(ASN1_BIT_STRING *a, int n, int value)
183 iv= ~v; 182 iv= ~v;
184 if (!value) v=0; 183 if (!value) v=0;
185 184
186 if (a == NULL)
187 return 0;
188
189 a->flags&= ~(ASN1_STRING_FLAG_BITS_LEFT|0x07); /* clear, set on write */ 185 a->flags&= ~(ASN1_STRING_FLAG_BITS_LEFT|0x07); /* clear, set on write */
190 186
187 if (a == NULL) return(0);
191 if ((a->length < (w+1)) || (a->data == NULL)) 188 if ((a->length < (w+1)) || (a->data == NULL))
192 { 189 {
193 if (!value) return(1); /* Don't need to set */ 190 if (!value) return(1); /* Don't need to set */
diff --git a/src/lib/libcrypto/asn1/a_bool.c b/src/lib/libcrypto/asn1/a_bool.c
index 331acdf053..24333ea4d5 100644
--- a/src/lib/libcrypto/asn1/a_bool.c
+++ b/src/lib/libcrypto/asn1/a_bool.c
@@ -75,10 +75,10 @@ int i2d_ASN1_BOOLEAN(int a, unsigned char **pp)
75 return(r); 75 return(r);
76 } 76 }
77 77
78int d2i_ASN1_BOOLEAN(int *a, const unsigned char **pp, long length) 78int d2i_ASN1_BOOLEAN(int *a, unsigned char **pp, long length)
79 { 79 {
80 int ret= -1; 80 int ret= -1;
81 const unsigned char *p; 81 unsigned char *p;
82 long len; 82 long len;
83 int inf,tag,xclass; 83 int inf,tag,xclass;
84 int i=0; 84 int i=0;
diff --git a/src/lib/libcrypto/asn1/a_bytes.c b/src/lib/libcrypto/asn1/a_bytes.c
index 8d13f9c931..2407f7c87a 100644
--- a/src/lib/libcrypto/asn1/a_bytes.c
+++ b/src/lib/libcrypto/asn1/a_bytes.c
@@ -60,15 +60,14 @@
60#include "cryptlib.h" 60#include "cryptlib.h"
61#include <openssl/asn1.h> 61#include <openssl/asn1.h>
62 62
63static int asn1_collate_primitive(ASN1_STRING *a, ASN1_const_CTX *c); 63static int asn1_collate_primitive(ASN1_STRING *a, ASN1_CTX *c);
64/* type is a 'bitmap' of acceptable string types. 64/* type is a 'bitmap' of acceptable string types.
65 */ 65 */
66ASN1_STRING *d2i_ASN1_type_bytes(ASN1_STRING **a, const unsigned char **pp, 66ASN1_STRING *d2i_ASN1_type_bytes(ASN1_STRING **a, unsigned char **pp,
67 long length, int type) 67 long length, int type)
68 { 68 {
69 ASN1_STRING *ret=NULL; 69 ASN1_STRING *ret=NULL;
70 const unsigned char *p; 70 unsigned char *p,*s;
71 unsigned char *s;
72 long len; 71 long len;
73 int inf,tag,xclass; 72 int inf,tag,xclass;
74 int i=0; 73 int i=0;
@@ -79,7 +78,7 @@ ASN1_STRING *d2i_ASN1_type_bytes(ASN1_STRING **a, const unsigned char **pp,
79 78
80 if (tag >= 32) 79 if (tag >= 32)
81 { 80 {
82 i=ASN1_R_TAG_VALUE_TOO_HIGH;; 81 i=ASN1_R_TAG_VALUE_TOO_HIGH;
83 goto err; 82 goto err;
84 } 83 }
85 if (!(ASN1_tag2bit(tag) & type)) 84 if (!(ASN1_tag2bit(tag) & type))
@@ -154,12 +153,11 @@ int i2d_ASN1_bytes(ASN1_STRING *a, unsigned char **pp, int tag, int xclass)
154 return(r); 153 return(r);
155 } 154 }
156 155
157ASN1_STRING *d2i_ASN1_bytes(ASN1_STRING **a, const unsigned char **pp, 156ASN1_STRING *d2i_ASN1_bytes(ASN1_STRING **a, unsigned char **pp, long length,
158 long length, int Ptag, int Pclass) 157 int Ptag, int Pclass)
159 { 158 {
160 ASN1_STRING *ret=NULL; 159 ASN1_STRING *ret=NULL;
161 const unsigned char *p; 160 unsigned char *p,*s;
162 unsigned char *s;
163 long len; 161 long len;
164 int inf,tag,xclass; 162 int inf,tag,xclass;
165 int i=0; 163 int i=0;
@@ -187,7 +185,7 @@ ASN1_STRING *d2i_ASN1_bytes(ASN1_STRING **a, const unsigned char **pp,
187 185
188 if (inf & V_ASN1_CONSTRUCTED) 186 if (inf & V_ASN1_CONSTRUCTED)
189 { 187 {
190 ASN1_const_CTX c; 188 ASN1_CTX c;
191 189
192 c.pp=pp; 190 c.pp=pp;
193 c.p=p; 191 c.p=p;
@@ -249,7 +247,7 @@ err:
249 * them into the one structure that is then returned */ 247 * them into the one structure that is then returned */
250/* There have been a few bug fixes for this function from 248/* There have been a few bug fixes for this function from
251 * Paul Keogh <paul.keogh@sse.ie>, many thanks to him */ 249 * Paul Keogh <paul.keogh@sse.ie>, many thanks to him */
252static int asn1_collate_primitive(ASN1_STRING *a, ASN1_const_CTX *c) 250static int asn1_collate_primitive(ASN1_STRING *a, ASN1_CTX *c)
253 { 251 {
254 ASN1_STRING *os=NULL; 252 ASN1_STRING *os=NULL;
255 BUF_MEM b; 253 BUF_MEM b;
@@ -270,7 +268,7 @@ static int asn1_collate_primitive(ASN1_STRING *a, ASN1_const_CTX *c)
270 { 268 {
271 if (c->inf & 1) 269 if (c->inf & 1)
272 { 270 {
273 c->eos=ASN1_const_check_infinite_end(&c->p, 271 c->eos=ASN1_check_infinite_end(&c->p,
274 (long)(c->max-c->p)); 272 (long)(c->max-c->p));
275 if (c->eos) break; 273 if (c->eos) break;
276 } 274 }
@@ -298,7 +296,7 @@ static int asn1_collate_primitive(ASN1_STRING *a, ASN1_const_CTX *c)
298 num+=os->length; 296 num+=os->length;
299 } 297 }
300 298
301 if (!asn1_const_Finish(c)) goto err; 299 if (!asn1_Finish(c)) goto err;
302 300
303 a->length=num; 301 a->length=num;
304 if (a->data != NULL) OPENSSL_free(a->data); 302 if (a->data != NULL) OPENSSL_free(a->data);
diff --git a/src/lib/libcrypto/asn1/a_d2i_fp.c b/src/lib/libcrypto/asn1/a_d2i_fp.c
index ece40bc4c0..b67b75e7c2 100644
--- a/src/lib/libcrypto/asn1/a_d2i_fp.c
+++ b/src/lib/libcrypto/asn1/a_d2i_fp.c
@@ -66,10 +66,11 @@ static int asn1_d2i_read_bio(BIO *in, BUF_MEM **pb);
66#ifndef NO_OLD_ASN1 66#ifndef NO_OLD_ASN1
67#ifndef OPENSSL_NO_FP_API 67#ifndef OPENSSL_NO_FP_API
68 68
69void *ASN1_d2i_fp(void *(*xnew)(void), d2i_of_void *d2i, FILE *in, void **x) 69char *ASN1_d2i_fp(char *(*xnew)(), char *(*d2i)(), FILE *in,
70 unsigned char **x)
70 { 71 {
71 BIO *b; 72 BIO *b;
72 void *ret; 73 char *ret;
73 74
74 if ((b=BIO_new(BIO_s_file())) == NULL) 75 if ((b=BIO_new(BIO_s_file())) == NULL)
75 { 76 {
@@ -83,11 +84,12 @@ void *ASN1_d2i_fp(void *(*xnew)(void), d2i_of_void *d2i, FILE *in, void **x)
83 } 84 }
84#endif 85#endif
85 86
86void *ASN1_d2i_bio(void *(*xnew)(void), d2i_of_void *d2i, BIO *in, void **x) 87char *ASN1_d2i_bio(char *(*xnew)(), char *(*d2i)(), BIO *in,
88 unsigned char **x)
87 { 89 {
88 BUF_MEM *b = NULL; 90 BUF_MEM *b = NULL;
89 const unsigned char *p; 91 unsigned char *p;
90 void *ret=NULL; 92 char *ret=NULL;
91 int len; 93 int len;
92 94
93 len = asn1_d2i_read_bio(in, &b); 95 len = asn1_d2i_read_bio(in, &b);
@@ -105,14 +107,14 @@ err:
105void *ASN1_item_d2i_bio(const ASN1_ITEM *it, BIO *in, void *x) 107void *ASN1_item_d2i_bio(const ASN1_ITEM *it, BIO *in, void *x)
106 { 108 {
107 BUF_MEM *b = NULL; 109 BUF_MEM *b = NULL;
108 const unsigned char *p; 110 unsigned char *p;
109 void *ret=NULL; 111 void *ret=NULL;
110 int len; 112 int len;
111 113
112 len = asn1_d2i_read_bio(in, &b); 114 len = asn1_d2i_read_bio(in, &b);
113 if(len < 0) goto err; 115 if(len < 0) goto err;
114 116
115 p=(const unsigned char *)b->data; 117 p=(unsigned char *)b->data;
116 ret=ASN1_item_d2i(x,&p,len, it); 118 ret=ASN1_item_d2i(x,&p,len, it);
117err: 119err:
118 if (b != NULL) BUF_MEM_free(b); 120 if (b != NULL) BUF_MEM_free(b);
@@ -127,7 +129,7 @@ void *ASN1_item_d2i_fp(const ASN1_ITEM *it, FILE *in, void *x)
127 129
128 if ((b=BIO_new(BIO_s_file())) == NULL) 130 if ((b=BIO_new(BIO_s_file())) == NULL)
129 { 131 {
130 ASN1err(ASN1_F_ASN1_ITEM_D2I_FP,ERR_R_BUF_LIB); 132 ASN1err(ASN1_F_ASN1_D2I_FP,ERR_R_BUF_LIB);
131 return(NULL); 133 return(NULL);
132 } 134 }
133 BIO_set_fp(b,in,BIO_NOCLOSE); 135 BIO_set_fp(b,in,BIO_NOCLOSE);
@@ -144,7 +146,7 @@ static int asn1_d2i_read_bio(BIO *in, BUF_MEM **pb)
144 unsigned char *p; 146 unsigned char *p;
145 int i; 147 int i;
146 int ret=-1; 148 int ret=-1;
147 ASN1_const_CTX c; 149 ASN1_CTX c;
148 int want=HEADER_SIZE; 150 int want=HEADER_SIZE;
149 int eos=0; 151 int eos=0;
150#if defined(__GNUC__) && defined(__ia64) 152#if defined(__GNUC__) && defined(__ia64)
@@ -158,7 +160,7 @@ static int asn1_d2i_read_bio(BIO *in, BUF_MEM **pb)
158 b=BUF_MEM_new(); 160 b=BUF_MEM_new();
159 if (b == NULL) 161 if (b == NULL)
160 { 162 {
161 ASN1err(ASN1_F_ASN1_D2I_READ_BIO,ERR_R_MALLOC_FAILURE); 163 ASN1err(ASN1_F_ASN1_D2I_BIO,ERR_R_MALLOC_FAILURE);
162 return -1; 164 return -1;
163 } 165 }
164 166
@@ -171,13 +173,13 @@ static int asn1_d2i_read_bio(BIO *in, BUF_MEM **pb)
171 173
172 if (!BUF_MEM_grow_clean(b,len+want)) 174 if (!BUF_MEM_grow_clean(b,len+want))
173 { 175 {
174 ASN1err(ASN1_F_ASN1_D2I_READ_BIO,ERR_R_MALLOC_FAILURE); 176 ASN1err(ASN1_F_ASN1_D2I_BIO,ERR_R_MALLOC_FAILURE);
175 goto err; 177 goto err;
176 } 178 }
177 i=BIO_read(in,&(b->data[len]),want); 179 i=BIO_read(in,&(b->data[len]),want);
178 if ((i < 0) && ((len-off) == 0)) 180 if ((i < 0) && ((len-off) == 0))
179 { 181 {
180 ASN1err(ASN1_F_ASN1_D2I_READ_BIO,ASN1_R_NOT_ENOUGH_DATA); 182 ASN1err(ASN1_F_ASN1_D2I_BIO,ASN1_R_NOT_ENOUGH_DATA);
181 goto err; 183 goto err;
182 } 184 }
183 if (i > 0) 185 if (i > 0)
@@ -197,7 +199,7 @@ static int asn1_d2i_read_bio(BIO *in, BUF_MEM **pb)
197 if (e != ASN1_R_TOO_LONG) 199 if (e != ASN1_R_TOO_LONG)
198 goto err; 200 goto err;
199 else 201 else
200 ERR_clear_error(); /* clear error */ 202 ERR_get_error(); /* clear error */
201 } 203 }
202 i=c.p-p;/* header length */ 204 i=c.p-p;/* header length */
203 off+=i; /* end of data */ 205 off+=i; /* end of data */
@@ -226,7 +228,7 @@ static int asn1_d2i_read_bio(BIO *in, BUF_MEM **pb)
226 want-=(len-off); 228 want-=(len-off);
227 if (!BUF_MEM_grow_clean(b,len+want)) 229 if (!BUF_MEM_grow_clean(b,len+want))
228 { 230 {
229 ASN1err(ASN1_F_ASN1_D2I_READ_BIO,ERR_R_MALLOC_FAILURE); 231 ASN1err(ASN1_F_ASN1_D2I_BIO,ERR_R_MALLOC_FAILURE);
230 goto err; 232 goto err;
231 } 233 }
232 while (want > 0) 234 while (want > 0)
@@ -234,7 +236,7 @@ static int asn1_d2i_read_bio(BIO *in, BUF_MEM **pb)
234 i=BIO_read(in,&(b->data[len]),want); 236 i=BIO_read(in,&(b->data[len]),want);
235 if (i <= 0) 237 if (i <= 0)
236 { 238 {
237 ASN1err(ASN1_F_ASN1_D2I_READ_BIO, 239 ASN1err(ASN1_F_ASN1_D2I_BIO,
238 ASN1_R_NOT_ENOUGH_DATA); 240 ASN1_R_NOT_ENOUGH_DATA);
239 goto err; 241 goto err;
240 } 242 }
diff --git a/src/lib/libcrypto/asn1/a_digest.c b/src/lib/libcrypto/asn1/a_digest.c
index d00d9e22b1..7182e9fa5d 100644
--- a/src/lib/libcrypto/asn1/a_digest.c
+++ b/src/lib/libcrypto/asn1/a_digest.c
@@ -72,7 +72,7 @@
72 72
73#ifndef NO_ASN1_OLD 73#ifndef NO_ASN1_OLD
74 74
75int ASN1_digest(i2d_of_void *i2d, const EVP_MD *type, char *data, 75int ASN1_digest(int (*i2d)(), const EVP_MD *type, char *data,
76 unsigned char *md, unsigned int *len) 76 unsigned char *md, unsigned int *len)
77 { 77 {
78 int i; 78 int i;
diff --git a/src/lib/libcrypto/asn1/a_dup.c b/src/lib/libcrypto/asn1/a_dup.c
index 199d50f521..58a017884c 100644
--- a/src/lib/libcrypto/asn1/a_dup.c
+++ b/src/lib/libcrypto/asn1/a_dup.c
@@ -62,23 +62,22 @@
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) 65char *ASN1_dup(int (*i2d)(), char *(*d2i)(), char *x)
66 { 66 {
67 unsigned char *b,*p; 67 unsigned char *b,*p;
68 const unsigned char *p2; 68 long i;
69 int i;
70 char *ret; 69 char *ret;
71 70
72 if (x == NULL) return(NULL); 71 if (x == NULL) return(NULL);
73 72
74 i=i2d(x,NULL); 73 i=(long)i2d(x,NULL);
75 b=OPENSSL_malloc(i+10); 74 b=(unsigned char *)OPENSSL_malloc((unsigned int)i+10);
76 if (b == NULL) 75 if (b == NULL)
77 { ASN1err(ASN1_F_ASN1_DUP,ERR_R_MALLOC_FAILURE); return(NULL); } 76 { ASN1err(ASN1_F_ASN1_DUP,ERR_R_MALLOC_FAILURE); return(NULL); }
78 p= b; 77 p= b;
79 i=i2d(x,&p); 78 i=i2d(x,&p);
80 p2= b; 79 p= b;
81 ret=d2i(NULL,&p2,i); 80 ret=d2i(NULL,&p,i);
82 OPENSSL_free(b); 81 OPENSSL_free(b);
83 return(ret); 82 return(ret);
84 } 83 }
@@ -92,8 +91,7 @@ void *ASN1_dup(i2d_of_void *i2d, d2i_of_void *d2i, char *x)
92 91
93void *ASN1_item_dup(const ASN1_ITEM *it, void *x) 92void *ASN1_item_dup(const ASN1_ITEM *it, void *x)
94 { 93 {
95 unsigned char *b = NULL; 94 unsigned char *b = NULL, *p;
96 const unsigned char *p;
97 long i; 95 long i;
98 void *ret; 96 void *ret;
99 97
@@ -101,7 +99,7 @@ void *ASN1_item_dup(const ASN1_ITEM *it, void *x)
101 99
102 i=ASN1_item_i2d(x,&b,it); 100 i=ASN1_item_i2d(x,&b,it);
103 if (b == NULL) 101 if (b == NULL)
104 { ASN1err(ASN1_F_ASN1_ITEM_DUP,ERR_R_MALLOC_FAILURE); return(NULL); } 102 { ASN1err(ASN1_F_ASN1_DUP,ERR_R_MALLOC_FAILURE); return(NULL); }
105 p= b; 103 p= b;
106 ret=ASN1_item_d2i(NULL,&p,i, it); 104 ret=ASN1_item_d2i(NULL,&p,i, it);
107 OPENSSL_free(b); 105 OPENSSL_free(b);
diff --git a/src/lib/libcrypto/asn1/a_enum.c b/src/lib/libcrypto/asn1/a_enum.c
index fe9aa13b9c..03ede68d1c 100644
--- a/src/lib/libcrypto/asn1/a_enum.c
+++ b/src/lib/libcrypto/asn1/a_enum.c
@@ -59,7 +59,6 @@
59#include <stdio.h> 59#include <stdio.h>
60#include "cryptlib.h" 60#include "cryptlib.h"
61#include <openssl/asn1.h> 61#include <openssl/asn1.h>
62#include <openssl/bn.h>
63 62
64/* 63/*
65 * Code for ENUMERATED type: identical to INTEGER apart from a different tag. 64 * Code for ENUMERATED type: identical to INTEGER apart from a different tag.
@@ -68,13 +67,12 @@
68 67
69int ASN1_ENUMERATED_set(ASN1_ENUMERATED *a, long v) 68int ASN1_ENUMERATED_set(ASN1_ENUMERATED *a, long v)
70 { 69 {
71 int j,k; 70 int i,j,k;
72 unsigned int i;
73 unsigned char buf[sizeof(long)+1]; 71 unsigned char buf[sizeof(long)+1];
74 long d; 72 long d;
75 73
76 a->type=V_ASN1_ENUMERATED; 74 a->type=V_ASN1_ENUMERATED;
77 if (a->length < (int)(sizeof(long)+1)) 75 if (a->length < (sizeof(long)+1))
78 { 76 {
79 if (a->data != NULL) 77 if (a->data != NULL)
80 OPENSSL_free(a->data); 78 OPENSSL_free(a->data);
@@ -118,7 +116,7 @@ long ASN1_ENUMERATED_get(ASN1_ENUMERATED *a)
118 else if (i != V_ASN1_ENUMERATED) 116 else if (i != V_ASN1_ENUMERATED)
119 return -1; 117 return -1;
120 118
121 if (a->length > (int)sizeof(long)) 119 if (a->length > sizeof(long))
122 { 120 {
123 /* hmm... a bit ugly */ 121 /* hmm... a bit ugly */
124 return(0xffffffffL); 122 return(0xffffffffL);
@@ -149,7 +147,7 @@ ASN1_ENUMERATED *BN_to_ASN1_ENUMERATED(BIGNUM *bn, ASN1_ENUMERATED *ai)
149 ASN1err(ASN1_F_BN_TO_ASN1_ENUMERATED,ERR_R_NESTED_ASN1_ERROR); 147 ASN1err(ASN1_F_BN_TO_ASN1_ENUMERATED,ERR_R_NESTED_ASN1_ERROR);
150 goto err; 148 goto err;
151 } 149 }
152 if(BN_is_negative(bn)) ret->type = V_ASN1_NEG_ENUMERATED; 150 if(bn->neg) ret->type = V_ASN1_NEG_ENUMERATED;
153 else ret->type=V_ASN1_ENUMERATED; 151 else ret->type=V_ASN1_ENUMERATED;
154 j=BN_num_bits(bn); 152 j=BN_num_bits(bn);
155 len=((j == 0)?0:((j/8)+1)); 153 len=((j == 0)?0:((j/8)+1));
@@ -177,6 +175,6 @@ BIGNUM *ASN1_ENUMERATED_to_BN(ASN1_ENUMERATED *ai, BIGNUM *bn)
177 175
178 if ((ret=BN_bin2bn(ai->data,ai->length,bn)) == NULL) 176 if ((ret=BN_bin2bn(ai->data,ai->length,bn)) == NULL)
179 ASN1err(ASN1_F_ASN1_ENUMERATED_TO_BN,ASN1_R_BN_LIB); 177 ASN1err(ASN1_F_ASN1_ENUMERATED_TO_BN,ASN1_R_BN_LIB);
180 else if(ai->type == V_ASN1_NEG_ENUMERATED) BN_set_negative(ret,1); 178 else if(ai->type == V_ASN1_NEG_ENUMERATED) ret->neg = 1;
181 return(ret); 179 return(ret);
182 } 180 }
diff --git a/src/lib/libcrypto/asn1/a_gentm.c b/src/lib/libcrypto/asn1/a_gentm.c
new file mode 100644
index 0000000000..0dfd576211
--- /dev/null
+++ b/src/lib/libcrypto/asn1/a_gentm.c
@@ -0,0 +1,246 @@
1/* crypto/asn1/a_gentm.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/* GENERALIZEDTIME implementation, written by Steve Henson. Based on UTCTIME */
60
61#include <stdio.h>
62#include <time.h>
63#include "cryptlib.h"
64#include "o_time.h"
65#include <openssl/asn1.h>
66
67#if 0
68
69int i2d_ASN1_GENERALIZEDTIME(ASN1_GENERALIZEDTIME *a, unsigned char **pp)
70 {
71#ifdef CHARSET_EBCDIC
72 /* KLUDGE! We convert to ascii before writing DER */
73 int len;
74 char tmp[24];
75 ASN1_STRING tmpstr = *(ASN1_STRING *)a;
76
77 len = tmpstr.length;
78 ebcdic2ascii(tmp, tmpstr.data, (len >= sizeof tmp) ? sizeof tmp : len);
79 tmpstr.data = tmp;
80
81 a = (ASN1_GENERALIZEDTIME *) &tmpstr;
82#endif
83 return(i2d_ASN1_bytes((ASN1_STRING *)a,pp,
84 V_ASN1_GENERALIZEDTIME,V_ASN1_UNIVERSAL));
85 }
86
87
88ASN1_GENERALIZEDTIME *d2i_ASN1_GENERALIZEDTIME(ASN1_GENERALIZEDTIME **a,
89 unsigned char **pp, long length)
90 {
91 ASN1_GENERALIZEDTIME *ret=NULL;
92
93 ret=(ASN1_GENERALIZEDTIME *)d2i_ASN1_bytes((ASN1_STRING **)a,pp,length,
94 V_ASN1_GENERALIZEDTIME,V_ASN1_UNIVERSAL);
95 if (ret == NULL)
96 {
97 ASN1err(ASN1_F_D2I_ASN1_GENERALIZEDTIME,ERR_R_NESTED_ASN1_ERROR);
98 return(NULL);
99 }
100#ifdef CHARSET_EBCDIC
101 ascii2ebcdic(ret->data, ret->data, ret->length);
102#endif
103 if (!ASN1_GENERALIZEDTIME_check(ret))
104 {
105 ASN1err(ASN1_F_D2I_ASN1_GENERALIZEDTIME,ASN1_R_INVALID_TIME_FORMAT);
106 goto err;
107 }
108
109 return(ret);
110err:
111 if ((ret != NULL) && ((a == NULL) || (*a != ret)))
112 M_ASN1_GENERALIZEDTIME_free(ret);
113 return(NULL);
114 }
115
116#endif
117
118int ASN1_GENERALIZEDTIME_check(ASN1_GENERALIZEDTIME *d)
119 {
120 static 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};
122 char *a;
123 int n,i,l,o;
124
125 if (d->type != V_ASN1_GENERALIZEDTIME) return(0);
126 l=d->length;
127 a=(char *)d->data;
128 o=0;
129 /* GENERALIZEDTIME is similar to UTCTIME except the year is
130 * represented as YYYY. This stuff treats everything as a two digit
131 * field so make first two fields 00 to 99
132 */
133 if (l < 13) goto err;
134 for (i=0; i<7; i++)
135 {
136 if ((i == 6) && ((a[o] == 'Z') ||
137 (a[o] == '+') || (a[o] == '-')))
138 { i++; break; }
139 if ((a[o] < '0') || (a[o] > '9')) goto err;
140 n= a[o]-'0';
141 if (++o > l) goto err;
142
143 if ((a[o] < '0') || (a[o] > '9')) goto err;
144 n=(n*10)+ a[o]-'0';
145 if (++o > l) goto err;
146
147 if ((n < min[i]) || (n > max[i])) goto err;
148 }
149 /* Optional fractional seconds: decimal point followed by one
150 * or more digits.
151 */
152 if (a[o] == '.')
153 {
154 if (++o > l) goto err;
155 i = o;
156 while ((a[o] >= '0') && (a[o] <= '9') && (o <= l))
157 o++;
158 /* Must have at least one digit after decimal point */
159 if (i == o) goto err;
160 }
161
162 if (a[o] == 'Z')
163 o++;
164 else if ((a[o] == '+') || (a[o] == '-'))
165 {
166 o++;
167 if (o+4 > l) goto err;
168 for (i=7; i<9; i++)
169 {
170 if ((a[o] < '0') || (a[o] > '9')) goto err;
171 n= a[o]-'0';
172 o++;
173 if ((a[o] < '0') || (a[o] > '9')) goto err;
174 n=(n*10)+ a[o]-'0';
175 if ((n < min[i]) || (n > max[i])) goto err;
176 o++;
177 }
178 }
179 return(o == l);
180err:
181 return(0);
182 }
183
184int ASN1_GENERALIZEDTIME_set_string(ASN1_GENERALIZEDTIME *s, char *str)
185 {
186 ASN1_GENERALIZEDTIME t;
187
188 t.type=V_ASN1_GENERALIZEDTIME;
189 t.length=strlen(str);
190 t.data=(unsigned char *)str;
191 if (ASN1_GENERALIZEDTIME_check(&t))
192 {
193 if (s != NULL)
194 {
195 if (!ASN1_STRING_set((ASN1_STRING *)s,
196 (unsigned char *)str,t.length))
197 return 0;
198 s->type=V_ASN1_GENERALIZEDTIME;
199 }
200 return(1);
201 }
202 else
203 return(0);
204 }
205
206ASN1_GENERALIZEDTIME *ASN1_GENERALIZEDTIME_set(ASN1_GENERALIZEDTIME *s,
207 time_t t)
208 {
209 char *p;
210 struct tm *ts;
211 struct tm data;
212 size_t len = 20;
213
214 if (s == NULL)
215 s=M_ASN1_GENERALIZEDTIME_new();
216 if (s == NULL)
217 return(NULL);
218
219 ts=OPENSSL_gmtime(&t, &data);
220 if (ts == NULL)
221 return(NULL);
222
223 p=(char *)s->data;
224 if ((p == NULL) || ((size_t)s->length < len))
225 {
226 p=OPENSSL_malloc(len);
227 if (p == NULL)
228 {
229 ASN1err(ASN1_F_ASN1_GENERALIZEDTIME_SET,
230 ERR_R_MALLOC_FAILURE);
231 return(NULL);
232 }
233 if (s->data != NULL)
234 OPENSSL_free(s->data);
235 s->data=(unsigned char *)p;
236 }
237
238 BIO_snprintf(p,len,"%04d%02d%02d%02d%02d%02dZ",ts->tm_year + 1900,
239 ts->tm_mon+1,ts->tm_mday,ts->tm_hour,ts->tm_min,ts->tm_sec);
240 s->length=strlen(p);
241 s->type=V_ASN1_GENERALIZEDTIME;
242#ifdef CHARSET_EBCDIC_not
243 ebcdic2ascii(s->data, s->data, s->length);
244#endif
245 return(s);
246 }
diff --git a/src/lib/libcrypto/asn1/a_hdr.c b/src/lib/libcrypto/asn1/a_hdr.c
new file mode 100644
index 0000000000..b1aad81f77
--- /dev/null
+++ b/src/lib/libcrypto/asn1/a_hdr.c
@@ -0,0 +1,119 @@
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, 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(ret->header,d2i_ASN1_OCTET_STRING);
87 if (ret->meth != NULL)
88 {
89 M_ASN1_D2I_get(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_i2d_fp.c b/src/lib/libcrypto/asn1/a_i2d_fp.c
index a3ad76d356..f4f1b73ebe 100644
--- a/src/lib/libcrypto/asn1/a_i2d_fp.c
+++ b/src/lib/libcrypto/asn1/a_i2d_fp.c
@@ -64,7 +64,7 @@
64#ifndef NO_OLD_ASN1 64#ifndef NO_OLD_ASN1
65 65
66#ifndef OPENSSL_NO_FP_API 66#ifndef OPENSSL_NO_FP_API
67int ASN1_i2d_fp(i2d_of_void *i2d, FILE *out, void *x) 67int ASN1_i2d_fp(int (*i2d)(), FILE *out, unsigned char *x)
68 { 68 {
69 BIO *b; 69 BIO *b;
70 int ret; 70 int ret;
@@ -81,7 +81,7 @@ int ASN1_i2d_fp(i2d_of_void *i2d, FILE *out, void *x)
81 } 81 }
82#endif 82#endif
83 83
84int ASN1_i2d_bio(i2d_of_void *i2d, BIO *out, unsigned char *x) 84int ASN1_i2d_bio(int (*i2d)(), BIO *out, unsigned char *x)
85 { 85 {
86 char *b; 86 char *b;
87 unsigned char *p; 87 unsigned char *p;
@@ -124,7 +124,7 @@ int ASN1_item_i2d_fp(const ASN1_ITEM *it, FILE *out, void *x)
124 124
125 if ((b=BIO_new(BIO_s_file())) == NULL) 125 if ((b=BIO_new(BIO_s_file())) == NULL)
126 { 126 {
127 ASN1err(ASN1_F_ASN1_ITEM_I2D_FP,ERR_R_BUF_LIB); 127 ASN1err(ASN1_F_ASN1_I2D_FP,ERR_R_BUF_LIB);
128 return(0); 128 return(0);
129 } 129 }
130 BIO_set_fp(b,out,BIO_NOCLOSE); 130 BIO_set_fp(b,out,BIO_NOCLOSE);
@@ -142,7 +142,7 @@ int ASN1_item_i2d_bio(const ASN1_ITEM *it, BIO *out, void *x)
142 n = ASN1_item_i2d(x, &b, it); 142 n = ASN1_item_i2d(x, &b, it);
143 if (b == NULL) 143 if (b == NULL)
144 { 144 {
145 ASN1err(ASN1_F_ASN1_ITEM_I2D_BIO,ERR_R_MALLOC_FAILURE); 145 ASN1err(ASN1_F_ASN1_I2D_BIO,ERR_R_MALLOC_FAILURE);
146 return(0); 146 return(0);
147 } 147 }
148 148
diff --git a/src/lib/libcrypto/asn1/a_int.c b/src/lib/libcrypto/asn1/a_int.c
index f8d198efb1..21cc64bb23 100644
--- a/src/lib/libcrypto/asn1/a_int.c
+++ b/src/lib/libcrypto/asn1/a_int.c
@@ -59,7 +59,6 @@
59#include <stdio.h> 59#include <stdio.h>
60#include "cryptlib.h" 60#include "cryptlib.h"
61#include <openssl/asn1.h> 61#include <openssl/asn1.h>
62#include <openssl/bn.h>
63 62
64ASN1_INTEGER *ASN1_INTEGER_dup(ASN1_INTEGER *x) 63ASN1_INTEGER *ASN1_INTEGER_dup(ASN1_INTEGER *x)
65{ return M_ASN1_INTEGER_dup(x);} 64{ return M_ASN1_INTEGER_dup(x);}
@@ -175,12 +174,11 @@ int i2c_ASN1_INTEGER(ASN1_INTEGER *a, unsigned char **pp)
175 174
176/* Convert just ASN1 INTEGER content octets to ASN1_INTEGER structure */ 175/* Convert just ASN1 INTEGER content octets to ASN1_INTEGER structure */
177 176
178ASN1_INTEGER *c2i_ASN1_INTEGER(ASN1_INTEGER **a, const unsigned char **pp, 177ASN1_INTEGER *c2i_ASN1_INTEGER(ASN1_INTEGER **a, unsigned char **pp,
179 long len) 178 long len)
180 { 179 {
181 ASN1_INTEGER *ret=NULL; 180 ASN1_INTEGER *ret=NULL;
182 const unsigned char *p, *pend; 181 unsigned char *p,*to,*s, *pend;
183 unsigned char *to,*s;
184 int i; 182 int i;
185 183
186 if ((a == NULL) || ((*a) == NULL)) 184 if ((a == NULL) || ((*a) == NULL))
@@ -256,7 +254,7 @@ ASN1_INTEGER *c2i_ASN1_INTEGER(ASN1_INTEGER **a, const unsigned char **pp,
256 *pp=pend; 254 *pp=pend;
257 return(ret); 255 return(ret);
258err: 256err:
259 ASN1err(ASN1_F_C2I_ASN1_INTEGER,i); 257 ASN1err(ASN1_F_D2I_ASN1_INTEGER,i);
260 if ((ret != NULL) && ((a == NULL) || (*a != ret))) 258 if ((ret != NULL) && ((a == NULL) || (*a != ret)))
261 M_ASN1_INTEGER_free(ret); 259 M_ASN1_INTEGER_free(ret);
262 return(NULL); 260 return(NULL);
@@ -268,12 +266,11 @@ err:
268 * with its MSB set as negative (it doesn't add a padding zero). 266 * with its MSB set as negative (it doesn't add a padding zero).
269 */ 267 */
270 268
271ASN1_INTEGER *d2i_ASN1_UINTEGER(ASN1_INTEGER **a, const unsigned char **pp, 269ASN1_INTEGER *d2i_ASN1_UINTEGER(ASN1_INTEGER **a, unsigned char **pp,
272 long length) 270 long length)
273 { 271 {
274 ASN1_INTEGER *ret=NULL; 272 ASN1_INTEGER *ret=NULL;
275 const unsigned char *p; 273 unsigned char *p,*to,*s;
276 unsigned char *to,*s;
277 long len; 274 long len;
278 int inf,tag,xclass; 275 int inf,tag,xclass;
279 int i; 276 int i;
@@ -335,13 +332,12 @@ err:
335 332
336int ASN1_INTEGER_set(ASN1_INTEGER *a, long v) 333int ASN1_INTEGER_set(ASN1_INTEGER *a, long v)
337 { 334 {
338 int j,k; 335 int i,j,k;
339 unsigned int i;
340 unsigned char buf[sizeof(long)+1]; 336 unsigned char buf[sizeof(long)+1];
341 long d; 337 long d;
342 338
343 a->type=V_ASN1_INTEGER; 339 a->type=V_ASN1_INTEGER;
344 if (a->length < (int)(sizeof(long)+1)) 340 if (a->length < (sizeof(long)+1))
345 { 341 {
346 if (a->data != NULL) 342 if (a->data != NULL)
347 OPENSSL_free(a->data); 343 OPENSSL_free(a->data);
@@ -385,7 +381,7 @@ long ASN1_INTEGER_get(ASN1_INTEGER *a)
385 else if (i != V_ASN1_INTEGER) 381 else if (i != V_ASN1_INTEGER)
386 return -1; 382 return -1;
387 383
388 if (a->length > (int)sizeof(long)) 384 if (a->length > sizeof(long))
389 { 385 {
390 /* hmm... a bit ugly */ 386 /* hmm... a bit ugly */
391 return(0xffffffffL); 387 return(0xffffffffL);
@@ -416,8 +412,7 @@ ASN1_INTEGER *BN_to_ASN1_INTEGER(BIGNUM *bn, ASN1_INTEGER *ai)
416 ASN1err(ASN1_F_BN_TO_ASN1_INTEGER,ERR_R_NESTED_ASN1_ERROR); 412 ASN1err(ASN1_F_BN_TO_ASN1_INTEGER,ERR_R_NESTED_ASN1_ERROR);
417 goto err; 413 goto err;
418 } 414 }
419 if (BN_is_negative(bn)) 415 if(bn->neg) ret->type = V_ASN1_NEG_INTEGER;
420 ret->type = V_ASN1_NEG_INTEGER;
421 else ret->type=V_ASN1_INTEGER; 416 else ret->type=V_ASN1_INTEGER;
422 j=BN_num_bits(bn); 417 j=BN_num_bits(bn);
423 len=((j == 0)?0:((j/8)+1)); 418 len=((j == 0)?0:((j/8)+1));
@@ -450,8 +445,7 @@ BIGNUM *ASN1_INTEGER_to_BN(ASN1_INTEGER *ai, BIGNUM *bn)
450 445
451 if ((ret=BN_bin2bn(ai->data,ai->length,bn)) == NULL) 446 if ((ret=BN_bin2bn(ai->data,ai->length,bn)) == NULL)
452 ASN1err(ASN1_F_ASN1_INTEGER_TO_BN,ASN1_R_BN_LIB); 447 ASN1err(ASN1_F_ASN1_INTEGER_TO_BN,ASN1_R_BN_LIB);
453 else if(ai->type == V_ASN1_NEG_INTEGER) 448 else if(ai->type == V_ASN1_NEG_INTEGER) ret->neg = 1;
454 BN_set_negative(ret, 1);
455 return(ret); 449 return(ret);
456 } 450 }
457 451
diff --git a/src/lib/libcrypto/asn1/a_mbstr.c b/src/lib/libcrypto/asn1/a_mbstr.c
index 2d4800a22a..208b3ec395 100644
--- a/src/lib/libcrypto/asn1/a_mbstr.c
+++ b/src/lib/libcrypto/asn1/a_mbstr.c
@@ -107,7 +107,7 @@ int ASN1_mbstring_ncopy(ASN1_STRING **out, const unsigned char *in, int len,
107 107
108 case MBSTRING_BMP: 108 case MBSTRING_BMP:
109 if(len & 1) { 109 if(len & 1) {
110 ASN1err(ASN1_F_ASN1_MBSTRING_NCOPY, 110 ASN1err(ASN1_F_ASN1_MBSTRING_COPY,
111 ASN1_R_INVALID_BMPSTRING_LENGTH); 111 ASN1_R_INVALID_BMPSTRING_LENGTH);
112 return -1; 112 return -1;
113 } 113 }
@@ -116,7 +116,7 @@ int ASN1_mbstring_ncopy(ASN1_STRING **out, const unsigned char *in, int len,
116 116
117 case MBSTRING_UNIV: 117 case MBSTRING_UNIV:
118 if(len & 3) { 118 if(len & 3) {
119 ASN1err(ASN1_F_ASN1_MBSTRING_NCOPY, 119 ASN1err(ASN1_F_ASN1_MBSTRING_COPY,
120 ASN1_R_INVALID_UNIVERSALSTRING_LENGTH); 120 ASN1_R_INVALID_UNIVERSALSTRING_LENGTH);
121 return -1; 121 return -1;
122 } 122 }
@@ -128,7 +128,7 @@ int ASN1_mbstring_ncopy(ASN1_STRING **out, const unsigned char *in, int len,
128 /* This counts the characters and does utf8 syntax checking */ 128 /* This counts the characters and does utf8 syntax checking */
129 ret = traverse_string(in, len, MBSTRING_UTF8, in_utf8, &nchar); 129 ret = traverse_string(in, len, MBSTRING_UTF8, in_utf8, &nchar);
130 if(ret < 0) { 130 if(ret < 0) {
131 ASN1err(ASN1_F_ASN1_MBSTRING_NCOPY, 131 ASN1err(ASN1_F_ASN1_MBSTRING_COPY,
132 ASN1_R_INVALID_UTF8STRING); 132 ASN1_R_INVALID_UTF8STRING);
133 return -1; 133 return -1;
134 } 134 }
@@ -139,19 +139,19 @@ int ASN1_mbstring_ncopy(ASN1_STRING **out, const unsigned char *in, int len,
139 break; 139 break;
140 140
141 default: 141 default:
142 ASN1err(ASN1_F_ASN1_MBSTRING_NCOPY, ASN1_R_UNKNOWN_FORMAT); 142 ASN1err(ASN1_F_ASN1_MBSTRING_COPY, ASN1_R_UNKNOWN_FORMAT);
143 return -1; 143 return -1;
144 } 144 }
145 145
146 if((minsize > 0) && (nchar < minsize)) { 146 if((minsize > 0) && (nchar < minsize)) {
147 ASN1err(ASN1_F_ASN1_MBSTRING_NCOPY, ASN1_R_STRING_TOO_SHORT); 147 ASN1err(ASN1_F_ASN1_MBSTRING_COPY, ASN1_R_STRING_TOO_SHORT);
148 BIO_snprintf(strbuf, sizeof strbuf, "%ld", minsize); 148 BIO_snprintf(strbuf, sizeof strbuf, "%ld", minsize);
149 ERR_add_error_data(2, "minsize=", strbuf); 149 ERR_add_error_data(2, "minsize=", strbuf);
150 return -1; 150 return -1;
151 } 151 }
152 152
153 if((maxsize > 0) && (nchar > maxsize)) { 153 if((maxsize > 0) && (nchar > maxsize)) {
154 ASN1err(ASN1_F_ASN1_MBSTRING_NCOPY, ASN1_R_STRING_TOO_LONG); 154 ASN1err(ASN1_F_ASN1_MBSTRING_COPY, ASN1_R_STRING_TOO_LONG);
155 BIO_snprintf(strbuf, sizeof strbuf, "%ld", maxsize); 155 BIO_snprintf(strbuf, sizeof strbuf, "%ld", maxsize);
156 ERR_add_error_data(2, "maxsize=", strbuf); 156 ERR_add_error_data(2, "maxsize=", strbuf);
157 return -1; 157 return -1;
@@ -159,7 +159,7 @@ int ASN1_mbstring_ncopy(ASN1_STRING **out, const unsigned char *in, int len,
159 159
160 /* Now work out minimal type (if any) */ 160 /* Now work out minimal type (if any) */
161 if(traverse_string(in, len, inform, type_str, &mask) < 0) { 161 if(traverse_string(in, len, inform, type_str, &mask) < 0) {
162 ASN1err(ASN1_F_ASN1_MBSTRING_NCOPY, ASN1_R_ILLEGAL_CHARACTERS); 162 ASN1err(ASN1_F_ASN1_MBSTRING_COPY, ASN1_R_ILLEGAL_CHARACTERS);
163 return -1; 163 return -1;
164 } 164 }
165 165
@@ -193,7 +193,7 @@ int ASN1_mbstring_ncopy(ASN1_STRING **out, const unsigned char *in, int len,
193 free_out = 1; 193 free_out = 1;
194 dest = ASN1_STRING_type_new(str_type); 194 dest = ASN1_STRING_type_new(str_type);
195 if(!dest) { 195 if(!dest) {
196 ASN1err(ASN1_F_ASN1_MBSTRING_NCOPY, 196 ASN1err(ASN1_F_ASN1_MBSTRING_COPY,
197 ERR_R_MALLOC_FAILURE); 197 ERR_R_MALLOC_FAILURE);
198 return -1; 198 return -1;
199 } 199 }
@@ -202,7 +202,7 @@ int ASN1_mbstring_ncopy(ASN1_STRING **out, const unsigned char *in, int len,
202 /* If both the same type just copy across */ 202 /* If both the same type just copy across */
203 if(inform == outform) { 203 if(inform == outform) {
204 if(!ASN1_STRING_set(dest, in, len)) { 204 if(!ASN1_STRING_set(dest, in, len)) {
205 ASN1err(ASN1_F_ASN1_MBSTRING_NCOPY,ERR_R_MALLOC_FAILURE); 205 ASN1err(ASN1_F_ASN1_MBSTRING_COPY,ERR_R_MALLOC_FAILURE);
206 return -1; 206 return -1;
207 } 207 }
208 return str_type; 208 return str_type;
@@ -233,7 +233,7 @@ int ASN1_mbstring_ncopy(ASN1_STRING **out, const unsigned char *in, int len,
233 } 233 }
234 if(!(p = OPENSSL_malloc(outlen + 1))) { 234 if(!(p = OPENSSL_malloc(outlen + 1))) {
235 if(free_out) ASN1_STRING_free(dest); 235 if(free_out) ASN1_STRING_free(dest);
236 ASN1err(ASN1_F_ASN1_MBSTRING_NCOPY,ERR_R_MALLOC_FAILURE); 236 ASN1err(ASN1_F_ASN1_MBSTRING_COPY,ERR_R_MALLOC_FAILURE);
237 return -1; 237 return -1;
238 } 238 }
239 dest->length = outlen; 239 dest->length = outlen;
diff --git a/src/lib/libcrypto/asn1/a_meth.c b/src/lib/libcrypto/asn1/a_meth.c
new file mode 100644
index 0000000000..63158e9cab
--- /dev/null
+++ b/src/lib/libcrypto/asn1/a_meth.c
@@ -0,0 +1,84 @@
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 (int (*)()) i2d_ASN1_IA5STRING,
66 (char *(*)()) d2i_ASN1_IA5STRING,
67 (char *(*)()) ASN1_STRING_new,
68 (void (*)()) ASN1_STRING_free};
69
70static ASN1_METHOD bit_string_meth={
71 (int (*)()) i2d_ASN1_BIT_STRING,
72 (char *(*)()) d2i_ASN1_BIT_STRING,
73 (char *(*)()) ASN1_STRING_new,
74 (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..0a8e6c287c 100644
--- a/src/lib/libcrypto/asn1/a_object.c
+++ b/src/lib/libcrypto/asn1/a_object.c
@@ -57,12 +57,10 @@
57 */ 57 */
58 58
59#include <stdio.h> 59#include <stdio.h>
60#include <limits.h>
61#include "cryptlib.h" 60#include "cryptlib.h"
62#include <openssl/buffer.h> 61#include <openssl/buffer.h>
63#include <openssl/asn1.h> 62#include <openssl/asn1.h>
64#include <openssl/objects.h> 63#include <openssl/objects.h>
65#include <openssl/bn.h>
66 64
67int i2d_ASN1_OBJECT(ASN1_OBJECT *a, unsigned char **pp) 65int i2d_ASN1_OBJECT(ASN1_OBJECT *a, unsigned char **pp)
68 { 66 {
@@ -85,12 +83,10 @@ int i2d_ASN1_OBJECT(ASN1_OBJECT *a, unsigned char **pp)
85 83
86int a2d_ASN1_OBJECT(unsigned char *out, int olen, const char *buf, int num) 84int a2d_ASN1_OBJECT(unsigned char *out, int olen, const char *buf, int num)
87 { 85 {
88 int i,first,len=0,c, use_bn; 86 int i,first,len=0,c;
89 char ftmp[24], *tmp = ftmp; 87 char tmp[24];
90 int tmpsize = sizeof ftmp;
91 const char *p; 88 const char *p;
92 unsigned long l; 89 unsigned long l;
93 BIGNUM *bl = NULL;
94 90
95 if (num == 0) 91 if (num == 0)
96 return(0); 92 return(0);
@@ -102,7 +98,7 @@ int a2d_ASN1_OBJECT(unsigned char *out, int olen, const char *buf, int num)
102 num--; 98 num--;
103 if ((c >= '0') && (c <= '2')) 99 if ((c >= '0') && (c <= '2'))
104 { 100 {
105 first= c-'0'; 101 first=(c-'0')*40;
106 } 102 }
107 else 103 else
108 { 104 {
@@ -126,7 +122,6 @@ int a2d_ASN1_OBJECT(unsigned char *out, int olen, const char *buf, int num)
126 goto err; 122 goto err;
127 } 123 }
128 l=0; 124 l=0;
129 use_bn = 0;
130 for (;;) 125 for (;;)
131 { 126 {
132 if (num <= 0) break; 127 if (num <= 0) break;
@@ -139,22 +134,7 @@ int a2d_ASN1_OBJECT(unsigned char *out, int olen, const char *buf, int num)
139 ASN1err(ASN1_F_A2D_ASN1_OBJECT,ASN1_R_INVALID_DIGIT); 134 ASN1err(ASN1_F_A2D_ASN1_OBJECT,ASN1_R_INVALID_DIGIT);
140 goto err; 135 goto err;
141 } 136 }
142 if (!use_bn && l > (ULONG_MAX / 10L)) 137 l=l*10L+(long)(c-'0');
143 {
144 use_bn = 1;
145 if (!bl)
146 bl = BN_new();
147 if (!bl || !BN_set_word(bl, l))
148 goto err;
149 }
150 if (use_bn)
151 {
152 if (!BN_mul_word(bl, 10L)
153 || !BN_add_word(bl, c-'0'))
154 goto err;
155 }
156 else
157 l=l*10L+(long)(c-'0');
158 } 138 }
159 if (len == 0) 139 if (len == 0)
160 { 140 {
@@ -163,42 +143,14 @@ int a2d_ASN1_OBJECT(unsigned char *out, int olen, const char *buf, int num)
163 ASN1err(ASN1_F_A2D_ASN1_OBJECT,ASN1_R_SECOND_NUMBER_TOO_LARGE); 143 ASN1err(ASN1_F_A2D_ASN1_OBJECT,ASN1_R_SECOND_NUMBER_TOO_LARGE);
164 goto err; 144 goto err;
165 } 145 }
166 if (use_bn) 146 l+=(long)first;
167 {
168 if (!BN_add_word(bl, first * 40))
169 goto err;
170 }
171 else
172 l+=(long)first*40;
173 } 147 }
174 i=0; 148 i=0;
175 if (use_bn) 149 for (;;)
176 {
177 int blsize;
178 blsize = BN_num_bits(bl);
179 blsize = (blsize + 6)/7;
180 if (blsize > tmpsize)
181 {
182 if (tmp != ftmp)
183 OPENSSL_free(tmp);
184 tmpsize = blsize + 32;
185 tmp = OPENSSL_malloc(tmpsize);
186 if (!tmp)
187 goto err;
188 }
189 while(blsize--)
190 tmp[i++] = (unsigned char)BN_div_word(bl, 0x80L);
191 }
192 else
193 { 150 {
194 151 tmp[i++]=(unsigned char)l&0x7f;
195 for (;;) 152 l>>=7L;
196 { 153 if (l == 0L) break;
197 tmp[i++]=(unsigned char)l&0x7f;
198 l>>=7L;
199 if (l == 0L) break;
200 }
201
202 } 154 }
203 if (out != NULL) 155 if (out != NULL)
204 { 156 {
@@ -214,16 +166,8 @@ int a2d_ASN1_OBJECT(unsigned char *out, int olen, const char *buf, int num)
214 else 166 else
215 len+=i; 167 len+=i;
216 } 168 }
217 if (tmp != ftmp)
218 OPENSSL_free(tmp);
219 if (bl)
220 BN_free(bl);
221 return(len); 169 return(len);
222err: 170err:
223 if (tmp != ftmp)
224 OPENSSL_free(tmp);
225 if (bl)
226 BN_free(bl);
227 return(0); 171 return(0);
228 } 172 }
229 173
@@ -234,31 +178,21 @@ int i2t_ASN1_OBJECT(char *buf, int buf_len, ASN1_OBJECT *a)
234 178
235int i2a_ASN1_OBJECT(BIO *bp, ASN1_OBJECT *a) 179int i2a_ASN1_OBJECT(BIO *bp, ASN1_OBJECT *a)
236 { 180 {
237 char buf[80], *p = buf; 181 char buf[80];
238 int i; 182 int i;
239 183
240 if ((a == NULL) || (a->data == NULL)) 184 if ((a == NULL) || (a->data == NULL))
241 return(BIO_write(bp,"NULL",4)); 185 return(BIO_write(bp,"NULL",4));
242 i=i2t_ASN1_OBJECT(buf,sizeof buf,a); 186 i=i2t_ASN1_OBJECT(buf,sizeof buf,a);
243 if (i > (int)(sizeof(buf) - 1)) 187 if (i > sizeof buf) i=sizeof buf;
244 { 188 BIO_write(bp,buf,i);
245 p = OPENSSL_malloc(i + 1);
246 if (!p)
247 return -1;
248 i2t_ASN1_OBJECT(p,i + 1,a);
249 }
250 if (i <= 0)
251 return BIO_write(bp, "<INVALID>", 9);
252 BIO_write(bp,p,i);
253 if (p != buf)
254 OPENSSL_free(p);
255 return(i); 189 return(i);
256 } 190 }
257 191
258ASN1_OBJECT *d2i_ASN1_OBJECT(ASN1_OBJECT **a, const unsigned char **pp, 192ASN1_OBJECT *d2i_ASN1_OBJECT(ASN1_OBJECT **a, unsigned char **pp,
259 long length) 193 long length)
260{ 194{
261 const unsigned char *p; 195 unsigned char *p;
262 long len; 196 long len;
263 int tag,xclass; 197 int tag,xclass;
264 int inf,i; 198 int inf,i;
@@ -285,11 +219,11 @@ err:
285 ASN1_OBJECT_free(ret); 219 ASN1_OBJECT_free(ret);
286 return(NULL); 220 return(NULL);
287} 221}
288ASN1_OBJECT *c2i_ASN1_OBJECT(ASN1_OBJECT **a, const unsigned char **pp, 222ASN1_OBJECT *c2i_ASN1_OBJECT(ASN1_OBJECT **a, unsigned char **pp,
289 long len) 223 long len)
290 { 224 {
291 ASN1_OBJECT *ret=NULL; 225 ASN1_OBJECT *ret=NULL;
292 const unsigned char *p; 226 unsigned char *p;
293 int i; 227 int i;
294 228
295 /* only the ASN1_OBJECTs from the 'table' will have values 229 /* only the ASN1_OBJECTs from the 'table' will have values
@@ -321,7 +255,7 @@ ASN1_OBJECT *c2i_ASN1_OBJECT(ASN1_OBJECT **a, const unsigned char **pp,
321 *pp=p; 255 *pp=p;
322 return(ret); 256 return(ret);
323err: 257err:
324 ASN1err(ASN1_F_C2I_ASN1_OBJECT,i); 258 ASN1err(ASN1_F_D2I_ASN1_OBJECT,i);
325 if ((ret != NULL) && ((a == NULL) || (*a != ret))) 259 if ((ret != NULL) && ((a == NULL) || (*a != ret)))
326 ASN1_OBJECT_free(ret); 260 ASN1_OBJECT_free(ret);
327 return(NULL); 261 return(NULL);
diff --git a/src/lib/libcrypto/asn1/a_octet.c b/src/lib/libcrypto/asn1/a_octet.c
index 24fd0f8e5a..9690bae0f1 100644
--- a/src/lib/libcrypto/asn1/a_octet.c
+++ b/src/lib/libcrypto/asn1/a_octet.c
@@ -66,6 +66,6 @@ ASN1_OCTET_STRING *ASN1_OCTET_STRING_dup(ASN1_OCTET_STRING *x)
66int ASN1_OCTET_STRING_cmp(ASN1_OCTET_STRING *a, ASN1_OCTET_STRING *b) 66int ASN1_OCTET_STRING_cmp(ASN1_OCTET_STRING *a, 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, unsigned char *d, int len)
70{ return M_ASN1_OCTET_STRING_set(x, d, len); } 70{ return M_ASN1_OCTET_STRING_set(x, d, len); }
71 71
diff --git a/src/lib/libcrypto/asn1/a_set.c b/src/lib/libcrypto/asn1/a_set.c
index 958558c204..e24061c545 100644
--- a/src/lib/libcrypto/asn1/a_set.c
+++ b/src/lib/libcrypto/asn1/a_set.c
@@ -85,8 +85,8 @@ 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 *a, unsigned char **pp, int (*func)(), int ex_tag,
89 int ex_class, int is_set) 89 int ex_class, int is_set)
90 { 90 {
91 int ret=0,r; 91 int ret=0,r;
92 int i; 92 int i;
@@ -97,7 +97,7 @@ int i2d_ASN1_SET(STACK *a, unsigned char **pp, i2d_of_void *i2d, int ex_tag,
97 97
98 if (a == NULL) return(0); 98 if (a == NULL) return(0);
99 for (i=sk_num(a)-1; i>=0; i--) 99 for (i=sk_num(a)-1; i>=0; i--)
100 ret+=i2d(sk_value(a,i),NULL); 100 ret+=func(sk_value(a,i),NULL);
101 r=ASN1_object_size(1,ret,ex_tag); 101 r=ASN1_object_size(1,ret,ex_tag);
102 if (pp == NULL) return(r); 102 if (pp == NULL) return(r);
103 103
@@ -111,7 +111,7 @@ int i2d_ASN1_SET(STACK *a, unsigned char **pp, i2d_of_void *i2d, int ex_tag,
111 if(!is_set || (sk_num(a) < 2)) 111 if(!is_set || (sk_num(a) < 2))
112 { 112 {
113 for (i=0; i<sk_num(a); i++) 113 for (i=0; i<sk_num(a); i++)
114 i2d(sk_value(a,i),&p); 114 func(sk_value(a,i),&p);
115 115
116 *pp=p; 116 *pp=p;
117 return(r); 117 return(r);
@@ -129,7 +129,7 @@ int i2d_ASN1_SET(STACK *a, unsigned char **pp, i2d_of_void *i2d, int ex_tag,
129 for (i=0; i<sk_num(a); i++) 129 for (i=0; i<sk_num(a); i++)
130 { 130 {
131 rgSetBlob[i].pbData = p; /* catch each set encode blob */ 131 rgSetBlob[i].pbData = p; /* catch each set encode blob */
132 i2d(sk_value(a,i),&p); 132 func(sk_value(a,i),&p);
133 rgSetBlob[i].cbData = p - rgSetBlob[i].pbData; /* Length of this 133 rgSetBlob[i].cbData = p - rgSetBlob[i].pbData; /* Length of this
134SetBlob 134SetBlob
135*/ 135*/
@@ -162,11 +162,10 @@ SetBlob
162 return(r); 162 return(r);
163 } 163 }
164 164
165STACK *d2i_ASN1_SET(STACK **a, const unsigned char **pp, long length, 165STACK *d2i_ASN1_SET(STACK **a, unsigned char **pp, long length,
166 d2i_of_void *d2i, void (*free_func)(void *), int ex_tag, 166 char *(*func)(), void (*free_func)(void *), int ex_tag, int ex_class)
167 int ex_class)
168 { 167 {
169 ASN1_const_CTX c; 168 ASN1_CTX c;
170 STACK *ret=NULL; 169 STACK *ret=NULL;
171 170
172 if ((a == NULL) || ((*a) == NULL)) 171 if ((a == NULL) || ((*a) == NULL))
@@ -211,9 +210,7 @@ STACK *d2i_ASN1_SET(STACK **a, const unsigned char **pp, long length,
211 char *s; 210 char *s;
212 211
213 if (M_ASN1_D2I_end_sequence()) break; 212 if (M_ASN1_D2I_end_sequence()) break;
214 /* XXX: This was called with 4 arguments, incorrectly, it seems 213 if ((s=func(NULL,&c.p,c.slen,c.max-c.p)) == NULL)
215 if ((s=func(NULL,&c.p,c.slen,c.max-c.p)) == NULL) */
216 if ((s=d2i(NULL,&c.p,c.slen)) == NULL)
217 { 214 {
218 ASN1err(ASN1_F_D2I_ASN1_SET,ASN1_R_ERROR_PARSING_SET_ELEMENT); 215 ASN1err(ASN1_F_D2I_ASN1_SET,ASN1_R_ERROR_PARSING_SET_ELEMENT);
219 asn1_add_error(*pp,(int)(c.q- *pp)); 216 asn1_add_error(*pp,(int)(c.q- *pp));
diff --git a/src/lib/libcrypto/asn1/a_sign.c b/src/lib/libcrypto/asn1/a_sign.c
index 1081950518..52ce7e3974 100644
--- a/src/lib/libcrypto/asn1/a_sign.c
+++ b/src/lib/libcrypto/asn1/a_sign.c
@@ -56,7 +56,7 @@
56 * [including the GNU Public Licence.] 56 * [including the GNU Public Licence.]
57 */ 57 */
58/* ==================================================================== 58/* ====================================================================
59 * Copyright (c) 1998-2003 The OpenSSL Project. All rights reserved. 59 * Copyright (c) 1998-2002 The OpenSSL Project. All rights reserved.
60 * 60 *
61 * Redistribution and use in source and binary forms, with or without 61 * Redistribution and use in source and binary forms, with or without
62 * modification, are permitted provided that the following conditions 62 * modification, are permitted provided that the following conditions
@@ -126,9 +126,9 @@
126 126
127#ifndef NO_ASN1_OLD 127#ifndef NO_ASN1_OLD
128 128
129int ASN1_sign(i2d_of_void *i2d, X509_ALGOR *algor1, X509_ALGOR *algor2, 129int ASN1_sign(int (*i2d)(), X509_ALGOR *algor1, X509_ALGOR *algor2,
130 ASN1_BIT_STRING *signature, char *data, EVP_PKEY *pkey, 130 ASN1_BIT_STRING *signature, char *data, EVP_PKEY *pkey,
131 const EVP_MD *type) 131 const EVP_MD *type)
132 { 132 {
133 EVP_MD_CTX ctx; 133 EVP_MD_CTX ctx;
134 unsigned char *p,*buf_in=NULL,*buf_out=NULL; 134 unsigned char *p,*buf_in=NULL,*buf_out=NULL;
@@ -229,11 +229,10 @@ int ASN1_item_sign(const ASN1_ITEM *it, X509_ALGOR *algor1, X509_ALGOR *algor2,
229 else 229 else
230 a=algor2; 230 a=algor2;
231 if (a == NULL) continue; 231 if (a == NULL) continue;
232 if (type->pkey_type == NID_dsaWithSHA1 || 232 if (type->pkey_type == NID_dsaWithSHA1)
233 type->pkey_type == NID_ecdsa_with_SHA1)
234 { 233 {
235 /* special case: RFC 3279 tells us to omit 'parameters' 234 /* special case: RFC 2459 tells us to omit 'parameters'
236 * with id-dsa-with-sha1 and ecdsa-with-SHA1 */ 235 * with id-dsa-with-sha1 */
237 ASN1_TYPE_free(a->parameter); 236 ASN1_TYPE_free(a->parameter);
238 a->parameter = NULL; 237 a->parameter = NULL;
239 } 238 }
@@ -248,12 +247,12 @@ int ASN1_item_sign(const ASN1_ITEM *it, X509_ALGOR *algor1, X509_ALGOR *algor2,
248 a->algorithm=OBJ_nid2obj(type->pkey_type); 247 a->algorithm=OBJ_nid2obj(type->pkey_type);
249 if (a->algorithm == NULL) 248 if (a->algorithm == NULL)
250 { 249 {
251 ASN1err(ASN1_F_ASN1_ITEM_SIGN,ASN1_R_UNKNOWN_OBJECT_TYPE); 250 ASN1err(ASN1_F_ASN1_SIGN,ASN1_R_UNKNOWN_OBJECT_TYPE);
252 goto err; 251 goto err;
253 } 252 }
254 if (a->algorithm->length == 0) 253 if (a->algorithm->length == 0)
255 { 254 {
256 ASN1err(ASN1_F_ASN1_ITEM_SIGN,ASN1_R_THE_ASN1_OBJECT_IDENTIFIER_IS_NOT_KNOWN_FOR_THIS_MD); 255 ASN1err(ASN1_F_ASN1_SIGN,ASN1_R_THE_ASN1_OBJECT_IDENTIFIER_IS_NOT_KNOWN_FOR_THIS_MD);
257 goto err; 256 goto err;
258 } 257 }
259 } 258 }
@@ -263,7 +262,7 @@ int ASN1_item_sign(const ASN1_ITEM *it, X509_ALGOR *algor1, X509_ALGOR *algor2,
263 if ((buf_in == NULL) || (buf_out == NULL)) 262 if ((buf_in == NULL) || (buf_out == NULL))
264 { 263 {
265 outl=0; 264 outl=0;
266 ASN1err(ASN1_F_ASN1_ITEM_SIGN,ERR_R_MALLOC_FAILURE); 265 ASN1err(ASN1_F_ASN1_SIGN,ERR_R_MALLOC_FAILURE);
267 goto err; 266 goto err;
268 } 267 }
269 268
@@ -273,7 +272,7 @@ int ASN1_item_sign(const ASN1_ITEM *it, X509_ALGOR *algor1, X509_ALGOR *algor2,
273 (unsigned int *)&outl,pkey)) 272 (unsigned int *)&outl,pkey))
274 { 273 {
275 outl=0; 274 outl=0;
276 ASN1err(ASN1_F_ASN1_ITEM_SIGN,ERR_R_EVP_LIB); 275 ASN1err(ASN1_F_ASN1_SIGN,ERR_R_EVP_LIB);
277 goto err; 276 goto err;
278 } 277 }
279 if (signature->data != NULL) OPENSSL_free(signature->data); 278 if (signature->data != NULL) OPENSSL_free(signature->data);
diff --git a/src/lib/libcrypto/asn1/a_strex.c b/src/lib/libcrypto/asn1/a_strex.c
index c2dbb6f9a5..a07122ba47 100644
--- a/src/lib/libcrypto/asn1/a_strex.c
+++ b/src/lib/libcrypto/asn1/a_strex.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-2004 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,12 +58,12 @@
58 58
59#include <stdio.h> 59#include <stdio.h>
60#include <string.h> 60#include <string.h>
61#include "cryptlib.h"
62#include <openssl/crypto.h> 61#include <openssl/crypto.h>
63#include <openssl/x509.h> 62#include <openssl/x509.h>
64#include <openssl/asn1.h> 63#include <openssl/asn1.h>
65 64
66#include "charmap.h" 65#include "charmap.h"
66#include "cryptlib.h"
67 67
68/* ASN1_STRING_print_ex() and X509_NAME_print_ex(). 68/* ASN1_STRING_print_ex() and X509_NAME_print_ex().
69 * Enhanced string and name printing routines handling 69 * Enhanced string and name printing routines handling
@@ -170,7 +170,7 @@ static int do_buf(unsigned char *buf, int buflen,
170 q = buf + buflen; 170 q = buf + buflen;
171 outlen = 0; 171 outlen = 0;
172 while(p != q) { 172 while(p != q) {
173 if(p == buf && flags & ASN1_STRFLGS_ESC_2253) orflags = CHARTYPE_FIRST_ESC_2253; 173 if(p == buf) orflags = CHARTYPE_FIRST_ESC_2253;
174 else orflags = 0; 174 else orflags = 0;
175 switch(type & BUF_TYPE_WIDTH_MASK) { 175 switch(type & BUF_TYPE_WIDTH_MASK) {
176 case 4: 176 case 4:
@@ -194,10 +194,8 @@ static int do_buf(unsigned char *buf, int buflen,
194 if(i < 0) return -1; /* Invalid UTF8String */ 194 if(i < 0) return -1; /* Invalid UTF8String */
195 p += i; 195 p += i;
196 break; 196 break;
197 default:
198 return -1; /* invalid width */
199 } 197 }
200 if (p == q && flags & ASN1_STRFLGS_ESC_2253) orflags = CHARTYPE_LAST_ESC_2253; 198 if (p == q) orflags = CHARTYPE_LAST_ESC_2253;
201 if(type & BUF_TYPE_CONVUTF8) { 199 if(type & BUF_TYPE_CONVUTF8) {
202 unsigned char utfbuf[6]; 200 unsigned char utfbuf[6];
203 int utflen; 201 int utflen;
@@ -225,7 +223,7 @@ static int do_buf(unsigned char *buf, int buflen,
225 223
226static int do_hex_dump(char_io *io_ch, void *arg, unsigned char *buf, int buflen) 224static int do_hex_dump(char_io *io_ch, void *arg, unsigned char *buf, int buflen)
227{ 225{
228 static const char hexdig[] = "0123456789ABCDEF"; 226 const static char hexdig[] = "0123456789ABCDEF";
229 unsigned char *p, *q; 227 unsigned char *p, *q;
230 char hextmp[2]; 228 char hextmp[2];
231 if(arg) { 229 if(arg) {
@@ -281,7 +279,7 @@ static int do_dump(unsigned long lflags, char_io *io_ch, void *arg, ASN1_STRING
281 * otherwise it is the number of bytes per character 279 * otherwise it is the number of bytes per character
282 */ 280 */
283 281
284static const signed char tag2nbyte[] = { 282const static signed char tag2nbyte[] = {
285 -1, -1, -1, -1, -1, /* 0-4 */ 283 -1, -1, -1, -1, -1, /* 0-4 */
286 -1, -1, -1, -1, -1, /* 5-9 */ 284 -1, -1, -1, -1, -1, /* 5-9 */
287 -1, -1, 0, -1, /* 10-13 */ 285 -1, -1, 0, -1, /* 10-13 */
@@ -358,13 +356,12 @@ static int do_print_ex(char_io *io_ch, void *arg, unsigned long lflags, ASN1_STR
358 } 356 }
359 357
360 len = do_buf(str->data, str->length, type, flags, &quotes, io_ch, NULL); 358 len = do_buf(str->data, str->length, type, flags, &quotes, io_ch, NULL);
361 if(len < 0) return -1; 359 if(outlen < 0) return -1;
362 outlen += len; 360 outlen += len;
363 if(quotes) outlen += 2; 361 if(quotes) outlen += 2;
364 if(!arg) return outlen; 362 if(!arg) return outlen;
365 if(quotes && !io_ch(arg, "\"", 1)) return -1; 363 if(quotes && !io_ch(arg, "\"", 1)) return -1;
366 if(do_buf(str->data, str->length, type, flags, NULL, io_ch, arg) < 0) 364 do_buf(str->data, str->length, type, flags, NULL, io_ch, arg);
367 return -1;
368 if(quotes && !io_ch(arg, "\"", 1)) return -1; 365 if(quotes && !io_ch(arg, "\"", 1)) return -1;
369 return outlen; 366 return outlen;
370} 367}
@@ -516,7 +513,7 @@ int X509_NAME_print_ex(BIO *out, X509_NAME *nm, int indent, unsigned long flags)
516 return do_name_ex(send_bio_chars, out, nm, indent, flags); 513 return do_name_ex(send_bio_chars, out, nm, indent, flags);
517} 514}
518 515
519#ifndef OPENSSL_NO_FP_API 516
520int X509_NAME_print_ex_fp(FILE *fp, X509_NAME *nm, int indent, unsigned long flags) 517int X509_NAME_print_ex_fp(FILE *fp, X509_NAME *nm, int indent, unsigned long flags)
521{ 518{
522 if(flags == XN_FLAG_COMPAT) 519 if(flags == XN_FLAG_COMPAT)
@@ -531,19 +528,17 @@ int X509_NAME_print_ex_fp(FILE *fp, X509_NAME *nm, int indent, unsigned long fla
531 } 528 }
532 return do_name_ex(send_fp_chars, fp, nm, indent, flags); 529 return do_name_ex(send_fp_chars, fp, nm, indent, flags);
533} 530}
534#endif
535 531
536int ASN1_STRING_print_ex(BIO *out, ASN1_STRING *str, unsigned long flags) 532int ASN1_STRING_print_ex(BIO *out, ASN1_STRING *str, unsigned long flags)
537{ 533{
538 return do_print_ex(send_bio_chars, out, flags, str); 534 return do_print_ex(send_bio_chars, out, flags, str);
539} 535}
540 536
541#ifndef OPENSSL_NO_FP_API 537
542int ASN1_STRING_print_ex_fp(FILE *fp, ASN1_STRING *str, unsigned long flags) 538int ASN1_STRING_print_ex_fp(FILE *fp, ASN1_STRING *str, unsigned long flags)
543{ 539{
544 return do_print_ex(send_fp_chars, fp, flags, str); 540 return do_print_ex(send_fp_chars, fp, flags, str);
545} 541}
546#endif
547 542
548/* Utility function: convert any string type to UTF8, returns number of bytes 543/* Utility function: convert any string type to UTF8, returns number of bytes
549 * in output string or a negative error code 544 * in output string or a negative error code
@@ -558,7 +553,12 @@ int ASN1_STRING_to_UTF8(unsigned char **out, ASN1_STRING *in)
558 if((type < 0) || (type > 30)) return -1; 553 if((type < 0) || (type > 30)) return -1;
559 mbflag = tag2nbyte[type]; 554 mbflag = tag2nbyte[type];
560 if(mbflag == -1) return -1; 555 if(mbflag == -1) return -1;
561 mbflag |= MBSTRING_FLAG; 556 if (mbflag == 0)
557 mbflag = MBSTRING_UTF8;
558 else if (mbflag == 4)
559 mbflag = MBSTRING_UNIV;
560 else
561 mbflag |= MBSTRING_FLAG;
562 stmp.data = NULL; 562 stmp.data = NULL;
563 ret = ASN1_mbstring_copy(&str, in->data, in->length, mbflag, B_ASN1_UTF8STRING); 563 ret = ASN1_mbstring_copy(&str, in->data, in->length, mbflag, B_ASN1_UTF8STRING);
564 if(ret < 0) return ret; 564 if(ret < 0) return ret;
diff --git a/src/lib/libcrypto/asn1/a_type.c b/src/lib/libcrypto/asn1/a_type.c
index 36beceacdb..2292d49b93 100644
--- a/src/lib/libcrypto/asn1/a_type.c
+++ b/src/lib/libcrypto/asn1/a_type.c
@@ -57,9 +57,8 @@
57 */ 57 */
58 58
59#include <stdio.h> 59#include <stdio.h>
60#include "cryptlib.h"
61#include <openssl/asn1t.h> 60#include <openssl/asn1t.h>
62#include <openssl/objects.h> 61#include "cryptlib.h"
63 62
64int ASN1_TYPE_get(ASN1_TYPE *a) 63int ASN1_TYPE_get(ASN1_TYPE *a)
65 { 64 {
@@ -80,31 +79,6 @@ void ASN1_TYPE_set(ASN1_TYPE *a, int type, void *value)
80 a->value.ptr=value; 79 a->value.ptr=value;
81 } 80 }
82 81
83int ASN1_TYPE_set1(ASN1_TYPE *a, int type, const void *value)
84 {
85 if (!value || (type == V_ASN1_BOOLEAN))
86 {
87 void *p = (void *)value;
88 ASN1_TYPE_set(a, type, p);
89 }
90 else if (type == V_ASN1_OBJECT)
91 {
92 ASN1_OBJECT *odup;
93 odup = OBJ_dup(value);
94 if (!odup)
95 return 0;
96 ASN1_TYPE_set(a, type, odup);
97 }
98 else
99 {
100 ASN1_STRING *sdup;
101 sdup = ASN1_STRING_dup((ASN1_STRING *)value);
102 if (!sdup)
103 return 0;
104 ASN1_TYPE_set(a, type, sdup);
105 }
106 return 1;
107 }
108 82
109IMPLEMENT_STACK_OF(ASN1_TYPE) 83IMPLEMENT_STACK_OF(ASN1_TYPE)
110IMPLEMENT_ASN1_SET_OF(ASN1_TYPE) 84IMPLEMENT_ASN1_SET_OF(ASN1_TYPE)
diff --git a/src/lib/libcrypto/asn1/a_utctm.c b/src/lib/libcrypto/asn1/a_utctm.c
new file mode 100644
index 0000000000..7b25fed331
--- /dev/null
+++ b/src/lib/libcrypto/asn1/a_utctm.c
@@ -0,0 +1,303 @@
1/* crypto/asn1/a_utctm.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 <time.h>
61#include "cryptlib.h"
62#include "o_time.h"
63#include <openssl/asn1.h>
64
65#if 0
66int i2d_ASN1_UTCTIME(ASN1_UTCTIME *a, unsigned char **pp)
67 {
68#ifndef CHARSET_EBCDIC
69 return(i2d_ASN1_bytes((ASN1_STRING *)a,pp,
70 V_ASN1_UTCTIME,V_ASN1_UNIVERSAL));
71#else
72 /* KLUDGE! We convert to ascii before writing DER */
73 int len;
74 char tmp[24];
75 ASN1_STRING x = *(ASN1_STRING *)a;
76
77 len = x.length;
78 ebcdic2ascii(tmp, x.data, (len >= sizeof tmp) ? sizeof tmp : len);
79 x.data = tmp;
80 return i2d_ASN1_bytes(&x, pp, V_ASN1_UTCTIME,V_ASN1_UNIVERSAL);
81#endif
82 }
83
84
85ASN1_UTCTIME *d2i_ASN1_UTCTIME(ASN1_UTCTIME **a, unsigned char **pp,
86 long length)
87 {
88 ASN1_UTCTIME *ret=NULL;
89
90 ret=(ASN1_UTCTIME *)d2i_ASN1_bytes((ASN1_STRING **)a,pp,length,
91 V_ASN1_UTCTIME,V_ASN1_UNIVERSAL);
92 if (ret == NULL)
93 {
94 ASN1err(ASN1_F_D2I_ASN1_UTCTIME,ERR_R_NESTED_ASN1_ERROR);
95 return(NULL);
96 }
97#ifdef CHARSET_EBCDIC
98 ascii2ebcdic(ret->data, ret->data, ret->length);
99#endif
100 if (!ASN1_UTCTIME_check(ret))
101 {
102 ASN1err(ASN1_F_D2I_ASN1_UTCTIME,ASN1_R_INVALID_TIME_FORMAT);
103 goto err;
104 }
105
106 return(ret);
107err:
108 if ((ret != NULL) && ((a == NULL) || (*a != ret)))
109 M_ASN1_UTCTIME_free(ret);
110 return(NULL);
111 }
112
113#endif
114
115int ASN1_UTCTIME_check(ASN1_UTCTIME *d)
116 {
117 static int min[8]={ 0, 1, 1, 0, 0, 0, 0, 0};
118 static int max[8]={99,12,31,23,59,59,12,59};
119 char *a;
120 int n,i,l,o;
121
122 if (d->type != V_ASN1_UTCTIME) return(0);
123 l=d->length;
124 a=(char *)d->data;
125 o=0;
126
127 if (l < 11) goto err;
128 for (i=0; i<6; i++)
129 {
130 if ((i == 5) && ((a[o] == 'Z') ||
131 (a[o] == '+') || (a[o] == '-')))
132 { i++; break; }
133 if ((a[o] < '0') || (a[o] > '9')) goto err;
134 n= a[o]-'0';
135 if (++o > l) goto err;
136
137 if ((a[o] < '0') || (a[o] > '9')) goto err;
138 n=(n*10)+ a[o]-'0';
139 if (++o > l) goto err;
140
141 if ((n < min[i]) || (n > max[i])) goto err;
142 }
143 if (a[o] == 'Z')
144 o++;
145 else if ((a[o] == '+') || (a[o] == '-'))
146 {
147 o++;
148 if (o+4 > l) goto err;
149 for (i=6; i<8; i++)
150 {
151 if ((a[o] < '0') || (a[o] > '9')) goto err;
152 n= a[o]-'0';
153 o++;
154 if ((a[o] < '0') || (a[o] > '9')) goto err;
155 n=(n*10)+ a[o]-'0';
156 if ((n < min[i]) || (n > max[i])) goto err;
157 o++;
158 }
159 }
160 return(o == l);
161err:
162 return(0);
163 }
164
165int ASN1_UTCTIME_set_string(ASN1_UTCTIME *s, char *str)
166 {
167 ASN1_UTCTIME t;
168
169 t.type=V_ASN1_UTCTIME;
170 t.length=strlen(str);
171 t.data=(unsigned char *)str;
172 if (ASN1_UTCTIME_check(&t))
173 {
174 if (s != NULL)
175 {
176 if (!ASN1_STRING_set((ASN1_STRING *)s,
177 (unsigned char *)str,t.length))
178 return 0;
179 s->type = V_ASN1_UTCTIME;
180 }
181 return(1);
182 }
183 else
184 return(0);
185 }
186
187ASN1_UTCTIME *ASN1_UTCTIME_set(ASN1_UTCTIME *s, time_t t)
188 {
189 char *p;
190 struct tm *ts;
191 struct tm data;
192 size_t len = 20;
193
194 if (s == NULL)
195 s=M_ASN1_UTCTIME_new();
196 if (s == NULL)
197 return(NULL);
198
199 ts=OPENSSL_gmtime(&t, &data);
200 if (ts == NULL)
201 return(NULL);
202
203 p=(char *)s->data;
204 if ((p == NULL) || ((size_t)s->length < len))
205 {
206 p=OPENSSL_malloc(len);
207 if (p == NULL)
208 {
209 ASN1err(ASN1_F_ASN1_UTCTIME_SET,ERR_R_MALLOC_FAILURE);
210 return(NULL);
211 }
212 if (s->data != NULL)
213 OPENSSL_free(s->data);
214 s->data=(unsigned char *)p;
215 }
216
217 BIO_snprintf(p,len,"%02d%02d%02d%02d%02d%02dZ",ts->tm_year%100,
218 ts->tm_mon+1,ts->tm_mday,ts->tm_hour,ts->tm_min,ts->tm_sec);
219 s->length=strlen(p);
220 s->type=V_ASN1_UTCTIME;
221#ifdef CHARSET_EBCDIC_not
222 ebcdic2ascii(s->data, s->data, s->length);
223#endif
224 return(s);
225 }
226
227
228int ASN1_UTCTIME_cmp_time_t(const ASN1_UTCTIME *s, time_t t)
229 {
230 struct tm *tm;
231 struct tm data;
232 int offset;
233 int year;
234
235#define g2(p) (((p)[0]-'0')*10+(p)[1]-'0')
236
237 if (s->data[12] == 'Z')
238 offset=0;
239 else
240 {
241 offset = g2(s->data+13)*60+g2(s->data+15);
242 if (s->data[12] == '-')
243 offset = -offset;
244 }
245
246 t -= offset*60; /* FIXME: may overflow in extreme cases */
247
248 tm = OPENSSL_gmtime(&t, &data);
249
250#define return_cmp(a,b) if ((a)<(b)) return -1; else if ((a)>(b)) return 1
251 year = g2(s->data);
252 if (year < 50)
253 year += 100;
254 return_cmp(year, tm->tm_year);
255 return_cmp(g2(s->data+2) - 1, tm->tm_mon);
256 return_cmp(g2(s->data+4), tm->tm_mday);
257 return_cmp(g2(s->data+6), tm->tm_hour);
258 return_cmp(g2(s->data+8), tm->tm_min);
259 return_cmp(g2(s->data+10), tm->tm_sec);
260#undef g2
261#undef return_cmp
262
263 return 0;
264 }
265
266
267#if 0
268time_t ASN1_UTCTIME_get(const ASN1_UTCTIME *s)
269 {
270 struct tm tm;
271 int offset;
272
273 memset(&tm,'\0',sizeof tm);
274
275#define g2(p) (((p)[0]-'0')*10+(p)[1]-'0')
276 tm.tm_year=g2(s->data);
277 if(tm.tm_year < 50)
278 tm.tm_year+=100;
279 tm.tm_mon=g2(s->data+2)-1;
280 tm.tm_mday=g2(s->data+4);
281 tm.tm_hour=g2(s->data+6);
282 tm.tm_min=g2(s->data+8);
283 tm.tm_sec=g2(s->data+10);
284 if(s->data[12] == 'Z')
285 offset=0;
286 else
287 {
288 offset=g2(s->data+13)*60+g2(s->data+15);
289 if(s->data[12] == '-')
290 offset= -offset;
291 }
292#undef g2
293
294 return mktime(&tm)-offset*60; /* FIXME: mktime assumes the current timezone
295 * instead of UTC, and unless we rewrite OpenSSL
296 * in Lisp we cannot locally change the timezone
297 * without possibly interfering with other parts
298 * of the program. timegm, which uses UTC, is
299 * non-standard.
300 * Also time_t is inappropriate for general
301 * UTC times because it may a 32 bit type. */
302 }
303#endif
diff --git a/src/lib/libcrypto/asn1/a_verify.c b/src/lib/libcrypto/asn1/a_verify.c
index fdce6e4380..18ef0acf00 100644
--- a/src/lib/libcrypto/asn1/a_verify.c
+++ b/src/lib/libcrypto/asn1/a_verify.c
@@ -73,8 +73,8 @@
73 73
74#ifndef NO_ASN1_OLD 74#ifndef NO_ASN1_OLD
75 75
76int ASN1_verify(i2d_of_void *i2d, X509_ALGOR *a, ASN1_BIT_STRING *signature, 76int ASN1_verify(int (*i2d)(), X509_ALGOR *a, ASN1_BIT_STRING *signature,
77 char *data, EVP_PKEY *pkey) 77 char *data, EVP_PKEY *pkey)
78 { 78 {
79 EVP_MD_CTX ctx; 79 EVP_MD_CTX ctx;
80 const EVP_MD *type; 80 const EVP_MD *type;
@@ -138,13 +138,13 @@ int ASN1_item_verify(const ASN1_ITEM *it, X509_ALGOR *a, ASN1_BIT_STRING *signat
138 type=EVP_get_digestbyname(OBJ_nid2sn(i)); 138 type=EVP_get_digestbyname(OBJ_nid2sn(i));
139 if (type == NULL) 139 if (type == NULL)
140 { 140 {
141 ASN1err(ASN1_F_ASN1_ITEM_VERIFY,ASN1_R_UNKNOWN_MESSAGE_DIGEST_ALGORITHM); 141 ASN1err(ASN1_F_ASN1_VERIFY,ASN1_R_UNKNOWN_MESSAGE_DIGEST_ALGORITHM);
142 goto err; 142 goto err;
143 } 143 }
144 144
145 if (!EVP_VerifyInit_ex(&ctx,type, NULL)) 145 if (!EVP_VerifyInit_ex(&ctx,type, NULL))
146 { 146 {
147 ASN1err(ASN1_F_ASN1_ITEM_VERIFY,ERR_R_EVP_LIB); 147 ASN1err(ASN1_F_ASN1_VERIFY,ERR_R_EVP_LIB);
148 ret=0; 148 ret=0;
149 goto err; 149 goto err;
150 } 150 }
@@ -153,7 +153,7 @@ int ASN1_item_verify(const ASN1_ITEM *it, X509_ALGOR *a, ASN1_BIT_STRING *signat
153 153
154 if (buf_in == NULL) 154 if (buf_in == NULL)
155 { 155 {
156 ASN1err(ASN1_F_ASN1_ITEM_VERIFY,ERR_R_MALLOC_FAILURE); 156 ASN1err(ASN1_F_ASN1_VERIFY,ERR_R_MALLOC_FAILURE);
157 goto err; 157 goto err;
158 } 158 }
159 159
@@ -165,7 +165,7 @@ int ASN1_item_verify(const ASN1_ITEM *it, X509_ALGOR *a, ASN1_BIT_STRING *signat
165 if (EVP_VerifyFinal(&ctx,(unsigned char *)signature->data, 165 if (EVP_VerifyFinal(&ctx,(unsigned char *)signature->data,
166 (unsigned int)signature->length,pkey) <= 0) 166 (unsigned int)signature->length,pkey) <= 0)
167 { 167 {
168 ASN1err(ASN1_F_ASN1_ITEM_VERIFY,ERR_R_EVP_LIB); 168 ASN1err(ASN1_F_ASN1_VERIFY,ERR_R_EVP_LIB);
169 ret=0; 169 ret=0;
170 goto err; 170 goto err;
171 } 171 }
diff --git a/src/lib/libcrypto/asn1/asn1.h b/src/lib/libcrypto/asn1/asn1.h
index 424cd348bb..0184b475a7 100644
--- a/src/lib/libcrypto/asn1/asn1.h
+++ b/src/lib/libcrypto/asn1/asn1.h
@@ -60,19 +60,17 @@
60#define HEADER_ASN1_H 60#define HEADER_ASN1_H
61 61
62#include <time.h> 62#include <time.h>
63#include <openssl/e_os2.h>
64#ifndef OPENSSL_NO_BIO 63#ifndef OPENSSL_NO_BIO
65#include <openssl/bio.h> 64#include <openssl/bio.h>
66#endif 65#endif
66#include <openssl/e_os2.h>
67#include <openssl/bn.h>
67#include <openssl/stack.h> 68#include <openssl/stack.h>
68#include <openssl/safestack.h> 69#include <openssl/safestack.h>
69 70
70#include <openssl/symhacks.h> 71#include <openssl/symhacks.h>
71 72
72#include <openssl/ossl_typ.h> 73#include <openssl/ossl_typ.h>
73#ifndef OPENSSL_NO_DEPRECATED
74#include <openssl/bn.h>
75#endif
76 74
77#ifdef OPENSSL_BUILD_SHLIBCRYPTO 75#ifdef OPENSSL_BUILD_SHLIBCRYPTO
78# undef OPENSSL_EXTERN 76# undef OPENSSL_EXTERN
@@ -149,29 +147,19 @@ extern "C" {
149#define B_ASN1_UTF8STRING 0x2000 147#define B_ASN1_UTF8STRING 0x2000
150#define B_ASN1_UTCTIME 0x4000 148#define B_ASN1_UTCTIME 0x4000
151#define B_ASN1_GENERALIZEDTIME 0x8000 149#define B_ASN1_GENERALIZEDTIME 0x8000
152#define B_ASN1_SEQUENCE 0x10000
153 150
154/* For use with ASN1_mbstring_copy() */ 151/* For use with ASN1_mbstring_copy() */
155#define MBSTRING_FLAG 0x1000 152#define MBSTRING_FLAG 0x1000
156#define MBSTRING_UTF8 (MBSTRING_FLAG)
157#define MBSTRING_ASC (MBSTRING_FLAG|1) 153#define MBSTRING_ASC (MBSTRING_FLAG|1)
158#define MBSTRING_BMP (MBSTRING_FLAG|2) 154#define MBSTRING_BMP (MBSTRING_FLAG|2)
159#define MBSTRING_UNIV (MBSTRING_FLAG|4) 155#define MBSTRING_UNIV (MBSTRING_FLAG|3)
160 156#define MBSTRING_UTF8 (MBSTRING_FLAG|4)
161#define SMIME_OLDMIME 0x400
162#define SMIME_CRLFEOL 0x800
163#define SMIME_STREAM 0x1000
164 157
165struct X509_algor_st; 158struct X509_algor_st;
166DECLARE_STACK_OF(X509_ALGOR)
167 159
168#define DECLARE_ASN1_SET_OF(type) /* filled in by mkstack.pl */ 160#define DECLARE_ASN1_SET_OF(type) /* filled in by mkstack.pl */
169#define IMPLEMENT_ASN1_SET_OF(type) /* nothing, no longer needed */ 161#define IMPLEMENT_ASN1_SET_OF(type) /* nothing, no longer needed */
170 162
171/* We MUST make sure that, except for constness, asn1_ctx_st and
172 asn1_const_ctx are exactly the same. Fortunately, as soon as
173 the old ASN1 parsing macros are gone, we can throw this away
174 as well... */
175typedef struct asn1_ctx_st 163typedef struct asn1_ctx_st
176 { 164 {
177 unsigned char *p;/* work char pointer */ 165 unsigned char *p;/* work char pointer */
@@ -187,21 +175,6 @@ typedef struct asn1_ctx_st
187 int line; /* used in error processing */ 175 int line; /* used in error processing */
188 } ASN1_CTX; 176 } ASN1_CTX;
189 177
190typedef struct asn1_const_ctx_st
191 {
192 const unsigned char *p;/* work char pointer */
193 int eos; /* end of sequence read for indefinite encoding */
194 int error; /* error code to use when returning an error */
195 int inf; /* constructed if 0x20, indefinite is 0x21 */
196 int tag; /* tag from last 'get object' */
197 int xclass; /* class from last 'get object' */
198 long slen; /* length of last 'get object' */
199 const unsigned char *max; /* largest value of p allowed */
200 const unsigned char *q;/* temporary variable */
201 const unsigned char **pp;/* variable */
202 int line; /* used in error processing */
203 } ASN1_const_CTX;
204
205/* These are used internally in the ASN1_OBJECT to keep track of 178/* These are used internally in the ASN1_OBJECT to keep track of
206 * whether the names and data need to be free()ed */ 179 * whether the names and data need to be free()ed */
207#define ASN1_OBJECT_FLAG_DYNAMIC 0x01 /* internal use */ 180#define ASN1_OBJECT_FLAG_DYNAMIC 0x01 /* internal use */
@@ -218,18 +191,6 @@ typedef struct asn1_object_st
218 } ASN1_OBJECT; 191 } ASN1_OBJECT;
219 192
220#define ASN1_STRING_FLAG_BITS_LEFT 0x08 /* Set if 0x07 has bits left value */ 193#define ASN1_STRING_FLAG_BITS_LEFT 0x08 /* Set if 0x07 has bits left value */
221/* This indicates that the ASN1_STRING is not a real value but just a place
222 * holder for the location where indefinite length constructed data should
223 * be inserted in the memory buffer
224 */
225#define ASN1_STRING_FLAG_NDEF 0x010
226
227/* This flag is used by the CMS code to indicate that a string is not
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.
230 */
231#define ASN1_STRING_FLAG_CONT 0x020
232
233/* This is the base type that holds just about everything :-) */ 194/* This is the base type that holds just about everything :-) */
234typedef struct asn1_string_st 195typedef struct asn1_string_st
235 { 196 {
@@ -298,19 +259,18 @@ typedef struct ASN1_VALUE_st ASN1_VALUE;
298 259
299#define DECLARE_ASN1_FUNCTIONS(type) DECLARE_ASN1_FUNCTIONS_name(type, type) 260#define DECLARE_ASN1_FUNCTIONS(type) DECLARE_ASN1_FUNCTIONS_name(type, type)
300 261
301#define DECLARE_ASN1_ALLOC_FUNCTIONS(type) \
302 DECLARE_ASN1_ALLOC_FUNCTIONS_name(type, type)
303
304#define DECLARE_ASN1_FUNCTIONS_name(type, name) \ 262#define DECLARE_ASN1_FUNCTIONS_name(type, name) \
305 DECLARE_ASN1_ALLOC_FUNCTIONS_name(type, name) \ 263 type *name##_new(void); \
264 void name##_free(type *a); \
306 DECLARE_ASN1_ENCODE_FUNCTIONS(type, name, name) 265 DECLARE_ASN1_ENCODE_FUNCTIONS(type, name, name)
307 266
308#define DECLARE_ASN1_FUNCTIONS_fname(type, itname, name) \ 267#define DECLARE_ASN1_FUNCTIONS_fname(type, itname, name) \
309 DECLARE_ASN1_ALLOC_FUNCTIONS_name(type, name) \ 268 type *name##_new(void); \
269 void name##_free(type *a); \
310 DECLARE_ASN1_ENCODE_FUNCTIONS(type, itname, name) 270 DECLARE_ASN1_ENCODE_FUNCTIONS(type, itname, name)
311 271
312#define DECLARE_ASN1_ENCODE_FUNCTIONS(type, itname, name) \ 272#define DECLARE_ASN1_ENCODE_FUNCTIONS(type, itname, name) \
313 type *d2i_##name(type **a, const unsigned char **in, long len); \ 273 type *d2i_##name(type **a, unsigned char **in, long len); \
314 int i2d_##name(type *a, unsigned char **out); \ 274 int i2d_##name(type *a, unsigned char **out); \
315 DECLARE_ASN1_ITEM(itname) 275 DECLARE_ASN1_ITEM(itname)
316 276
@@ -319,37 +279,10 @@ typedef struct ASN1_VALUE_st ASN1_VALUE;
319 int i2d_##name(const type *a, unsigned char **out); \ 279 int i2d_##name(const type *a, unsigned char **out); \
320 DECLARE_ASN1_ITEM(name) 280 DECLARE_ASN1_ITEM(name)
321 281
322#define DECLARE_ASN1_NDEF_FUNCTION(name) \
323 int i2d_##name##_NDEF(name *a, unsigned char **out);
324
325#define DECLARE_ASN1_FUNCTIONS_const(name) \ 282#define DECLARE_ASN1_FUNCTIONS_const(name) \
326 DECLARE_ASN1_ALLOC_FUNCTIONS(name) \ 283 name *name##_new(void); \
327 DECLARE_ASN1_ENCODE_FUNCTIONS_const(name, name) 284 void name##_free(name *a);
328 285
329#define DECLARE_ASN1_ALLOC_FUNCTIONS_name(type, name) \
330 type *name##_new(void); \
331 void name##_free(type *a);
332
333#define D2I_OF(type) type *(*)(type **,const unsigned char **,long)
334#define I2D_OF(type) int (*)(type *,unsigned char **)
335#define I2D_OF_const(type) int (*)(const type *,unsigned char **)
336
337#define CHECKED_D2I_OF(type, d2i) \
338 ((d2i_of_void*) (1 ? d2i : ((D2I_OF(type))0)))
339#define CHECKED_I2D_OF(type, i2d) \
340 ((i2d_of_void*) (1 ? i2d : ((I2D_OF(type))0)))
341#define CHECKED_NEW_OF(type, xnew) \
342 ((void *(*)(void)) (1 ? xnew : ((type *(*)(void))0)))
343#define CHECKED_PTR_OF(type, p) \
344 ((void*) (1 ? p : (type*)0))
345#define CHECKED_PPTR_OF(type, p) \
346 ((void**) (1 ? p : (type**)0))
347
348#define TYPEDEF_D2I_OF(type) typedef type *d2i_of_##type(type **,const unsigned char **,long)
349#define TYPEDEF_I2D_OF(type) typedef int i2d_of_##type(type *,unsigned char **)
350#define TYPEDEF_D2I2D_OF(type) TYPEDEF_D2I_OF(type); TYPEDEF_I2D_OF(type)
351
352TYPEDEF_D2I2D_OF(void);
353 286
354/* The following macros and typedefs allow an ASN1_ITEM 287/* The following macros and typedefs allow an ASN1_ITEM
355 * to be embedded in a structure and referenced. Since 288 * to be embedded in a structure and referenced. Since
@@ -534,7 +467,6 @@ typedef struct asn1_type_st
534 * contain the set or sequence bytes */ 467 * contain the set or sequence bytes */
535 ASN1_STRING * set; 468 ASN1_STRING * set;
536 ASN1_STRING * sequence; 469 ASN1_STRING * sequence;
537 ASN1_VALUE * asn1_value;
538 } value; 470 } value;
539 } ASN1_TYPE; 471 } ASN1_TYPE;
540 472
@@ -543,17 +475,17 @@ DECLARE_ASN1_SET_OF(ASN1_TYPE)
543 475
544typedef struct asn1_method_st 476typedef struct asn1_method_st
545 { 477 {
546 i2d_of_void *i2d; 478 int (*i2d)();
547 d2i_of_void *d2i; 479 char *(*d2i)();
548 void *(*create)(void); 480 char *(*create)();
549 void (*destroy)(void *); 481 void (*destroy)();
550 } ASN1_METHOD; 482 } ASN1_METHOD;
551 483
552/* This is used when parsing some Netscape objects */ 484/* This is used when parsing some Netscape objects */
553typedef struct asn1_header_st 485typedef struct asn1_header_st
554 { 486 {
555 ASN1_OCTET_STRING *header; 487 ASN1_OCTET_STRING *header;
556 void *data; 488 char *data;
557 ASN1_METHOD *meth; 489 ASN1_METHOD *meth;
558 } ASN1_HEADER; 490 } ASN1_HEADER;
559 491
@@ -619,7 +551,6 @@ typedef struct BIT_STRING_BITNAME_st {
619 B_ASN1_UNIVERSALSTRING|\ 551 B_ASN1_UNIVERSALSTRING|\
620 B_ASN1_BMPSTRING|\ 552 B_ASN1_BMPSTRING|\
621 B_ASN1_UTF8STRING|\ 553 B_ASN1_UTF8STRING|\
622 B_ASN1_SEQUENCE|\
623 B_ASN1_UNKNOWN 554 B_ASN1_UNKNOWN
624 555
625#define B_ASN1_DIRECTORYSTRING \ 556#define B_ASN1_DIRECTORYSTRING \
@@ -765,14 +696,13 @@ DECLARE_ASN1_FUNCTIONS_fname(ASN1_TYPE, ASN1_ANY, ASN1_TYPE)
765 696
766int ASN1_TYPE_get(ASN1_TYPE *a); 697int ASN1_TYPE_get(ASN1_TYPE *a);
767void ASN1_TYPE_set(ASN1_TYPE *a, int type, void *value); 698void ASN1_TYPE_set(ASN1_TYPE *a, int type, void *value);
768int ASN1_TYPE_set1(ASN1_TYPE *a, int type, const void *value);
769 699
770ASN1_OBJECT * ASN1_OBJECT_new(void ); 700ASN1_OBJECT * ASN1_OBJECT_new(void );
771void ASN1_OBJECT_free(ASN1_OBJECT *a); 701void ASN1_OBJECT_free(ASN1_OBJECT *a);
772int i2d_ASN1_OBJECT(ASN1_OBJECT *a,unsigned char **pp); 702int i2d_ASN1_OBJECT(ASN1_OBJECT *a,unsigned char **pp);
773ASN1_OBJECT * c2i_ASN1_OBJECT(ASN1_OBJECT **a,const unsigned char **pp, 703ASN1_OBJECT * c2i_ASN1_OBJECT(ASN1_OBJECT **a,unsigned char **pp,
774 long length); 704 long length);
775ASN1_OBJECT * d2i_ASN1_OBJECT(ASN1_OBJECT **a,const unsigned char **pp, 705ASN1_OBJECT * d2i_ASN1_OBJECT(ASN1_OBJECT **a,unsigned char **pp,
776 long length); 706 long length);
777 707
778DECLARE_ASN1_ITEM(ASN1_OBJECT) 708DECLARE_ASN1_ITEM(ASN1_OBJECT)
@@ -788,7 +718,6 @@ int ASN1_STRING_cmp(ASN1_STRING *a, ASN1_STRING *b);
788 /* Since this is used to store all sorts of things, via macros, for now, make 718 /* Since this is used to store all sorts of things, via macros, for now, make
789 its data void * */ 719 its data void * */
790int ASN1_STRING_set(ASN1_STRING *str, const void *data, int len); 720int ASN1_STRING_set(ASN1_STRING *str, const void *data, int len);
791void ASN1_STRING_set0(ASN1_STRING *str, void *data, int len);
792int ASN1_STRING_length(ASN1_STRING *x); 721int ASN1_STRING_length(ASN1_STRING *x);
793void ASN1_STRING_length_set(ASN1_STRING *x, int n); 722void ASN1_STRING_length_set(ASN1_STRING *x, int n);
794int ASN1_STRING_type(ASN1_STRING *x); 723int ASN1_STRING_type(ASN1_STRING *x);
@@ -796,7 +725,7 @@ unsigned char * ASN1_STRING_data(ASN1_STRING *x);
796 725
797DECLARE_ASN1_FUNCTIONS(ASN1_BIT_STRING) 726DECLARE_ASN1_FUNCTIONS(ASN1_BIT_STRING)
798int i2c_ASN1_BIT_STRING(ASN1_BIT_STRING *a,unsigned char **pp); 727int i2c_ASN1_BIT_STRING(ASN1_BIT_STRING *a,unsigned char **pp);
799ASN1_BIT_STRING *c2i_ASN1_BIT_STRING(ASN1_BIT_STRING **a,const unsigned char **pp, 728ASN1_BIT_STRING *c2i_ASN1_BIT_STRING(ASN1_BIT_STRING **a,unsigned char **pp,
800 long length); 729 long length);
801int ASN1_BIT_STRING_set(ASN1_BIT_STRING *a, unsigned char *d, 730int ASN1_BIT_STRING_set(ASN1_BIT_STRING *a, unsigned char *d,
802 int length ); 731 int length );
@@ -812,13 +741,13 @@ int ASN1_BIT_STRING_set_asc(ASN1_BIT_STRING *bs, char *name, int value,
812 BIT_STRING_BITNAME *tbl); 741 BIT_STRING_BITNAME *tbl);
813 742
814int i2d_ASN1_BOOLEAN(int a,unsigned char **pp); 743int i2d_ASN1_BOOLEAN(int a,unsigned char **pp);
815int d2i_ASN1_BOOLEAN(int *a,const unsigned char **pp,long length); 744int d2i_ASN1_BOOLEAN(int *a,unsigned char **pp,long length);
816 745
817DECLARE_ASN1_FUNCTIONS(ASN1_INTEGER) 746DECLARE_ASN1_FUNCTIONS(ASN1_INTEGER)
818int i2c_ASN1_INTEGER(ASN1_INTEGER *a,unsigned char **pp); 747int i2c_ASN1_INTEGER(ASN1_INTEGER *a,unsigned char **pp);
819ASN1_INTEGER *c2i_ASN1_INTEGER(ASN1_INTEGER **a,const unsigned char **pp, 748ASN1_INTEGER *c2i_ASN1_INTEGER(ASN1_INTEGER **a,unsigned char **pp,
820 long length); 749 long length);
821ASN1_INTEGER *d2i_ASN1_UINTEGER(ASN1_INTEGER **a,const unsigned char **pp, 750ASN1_INTEGER *d2i_ASN1_UINTEGER(ASN1_INTEGER **a,unsigned char **pp,
822 long length); 751 long length);
823ASN1_INTEGER * ASN1_INTEGER_dup(ASN1_INTEGER *x); 752ASN1_INTEGER * ASN1_INTEGER_dup(ASN1_INTEGER *x);
824int ASN1_INTEGER_cmp(ASN1_INTEGER *x, ASN1_INTEGER *y); 753int ASN1_INTEGER_cmp(ASN1_INTEGER *x, ASN1_INTEGER *y);
@@ -827,7 +756,7 @@ DECLARE_ASN1_FUNCTIONS(ASN1_ENUMERATED)
827 756
828int ASN1_UTCTIME_check(ASN1_UTCTIME *a); 757int ASN1_UTCTIME_check(ASN1_UTCTIME *a);
829ASN1_UTCTIME *ASN1_UTCTIME_set(ASN1_UTCTIME *s,time_t t); 758ASN1_UTCTIME *ASN1_UTCTIME_set(ASN1_UTCTIME *s,time_t t);
830int ASN1_UTCTIME_set_string(ASN1_UTCTIME *s, const char *str); 759int ASN1_UTCTIME_set_string(ASN1_UTCTIME *s, char *str);
831int ASN1_UTCTIME_cmp_time_t(const ASN1_UTCTIME *s, time_t t); 760int ASN1_UTCTIME_cmp_time_t(const ASN1_UTCTIME *s, time_t t);
832#if 0 761#if 0
833time_t ASN1_UTCTIME_get(const ASN1_UTCTIME *s); 762time_t ASN1_UTCTIME_get(const ASN1_UTCTIME *s);
@@ -835,12 +764,12 @@ time_t ASN1_UTCTIME_get(const ASN1_UTCTIME *s);
835 764
836int ASN1_GENERALIZEDTIME_check(ASN1_GENERALIZEDTIME *a); 765int ASN1_GENERALIZEDTIME_check(ASN1_GENERALIZEDTIME *a);
837ASN1_GENERALIZEDTIME *ASN1_GENERALIZEDTIME_set(ASN1_GENERALIZEDTIME *s,time_t t); 766ASN1_GENERALIZEDTIME *ASN1_GENERALIZEDTIME_set(ASN1_GENERALIZEDTIME *s,time_t t);
838int ASN1_GENERALIZEDTIME_set_string(ASN1_GENERALIZEDTIME *s, const char *str); 767int ASN1_GENERALIZEDTIME_set_string(ASN1_GENERALIZEDTIME *s, char *str);
839 768
840DECLARE_ASN1_FUNCTIONS(ASN1_OCTET_STRING) 769DECLARE_ASN1_FUNCTIONS(ASN1_OCTET_STRING)
841ASN1_OCTET_STRING * ASN1_OCTET_STRING_dup(ASN1_OCTET_STRING *a); 770ASN1_OCTET_STRING * ASN1_OCTET_STRING_dup(ASN1_OCTET_STRING *a);
842int ASN1_OCTET_STRING_cmp(ASN1_OCTET_STRING *a, ASN1_OCTET_STRING *b); 771int ASN1_OCTET_STRING_cmp(ASN1_OCTET_STRING *a, ASN1_OCTET_STRING *b);
843int ASN1_OCTET_STRING_set(ASN1_OCTET_STRING *str, const unsigned char *data, int len); 772int ASN1_OCTET_STRING_set(ASN1_OCTET_STRING *str, unsigned char *data, int len);
844 773
845DECLARE_ASN1_FUNCTIONS(ASN1_VISIBLESTRING) 774DECLARE_ASN1_FUNCTIONS(ASN1_VISIBLESTRING)
846DECLARE_ASN1_FUNCTIONS(ASN1_UNIVERSALSTRING) 775DECLARE_ASN1_FUNCTIONS(ASN1_UNIVERSALSTRING)
@@ -863,17 +792,15 @@ DECLARE_ASN1_FUNCTIONS(ASN1_UTCTIME)
863DECLARE_ASN1_FUNCTIONS(ASN1_GENERALIZEDTIME) 792DECLARE_ASN1_FUNCTIONS(ASN1_GENERALIZEDTIME)
864DECLARE_ASN1_FUNCTIONS(ASN1_TIME) 793DECLARE_ASN1_FUNCTIONS(ASN1_TIME)
865 794
866DECLARE_ASN1_ITEM(ASN1_OCTET_STRING_NDEF)
867
868ASN1_TIME *ASN1_TIME_set(ASN1_TIME *s,time_t t); 795ASN1_TIME *ASN1_TIME_set(ASN1_TIME *s,time_t t);
869int ASN1_TIME_check(ASN1_TIME *t); 796int ASN1_TIME_check(ASN1_TIME *t);
870ASN1_GENERALIZEDTIME *ASN1_TIME_to_generalizedtime(ASN1_TIME *t, ASN1_GENERALIZEDTIME **out); 797ASN1_GENERALIZEDTIME *ASN1_TIME_to_generalizedtime(ASN1_TIME *t, ASN1_GENERALIZEDTIME **out);
871 798
872int i2d_ASN1_SET(STACK *a, unsigned char **pp, 799int i2d_ASN1_SET(STACK *a, unsigned char **pp,
873 i2d_of_void *i2d, int ex_tag, int ex_class, int is_set); 800 int (*func)(), int ex_tag, int ex_class, int is_set);
874STACK * d2i_ASN1_SET(STACK **a, const unsigned char **pp, long length, 801STACK * d2i_ASN1_SET(STACK **a, unsigned char **pp, long length,
875 d2i_of_void *d2i, void (*free_func)(void *), 802 char *(*func)(), void (*free_func)(void *),
876 int ex_tag, int ex_class); 803 int ex_tag, int ex_class);
877 804
878#ifndef OPENSSL_NO_BIO 805#ifndef OPENSSL_NO_BIO
879int i2a_ASN1_INTEGER(BIO *bp, ASN1_INTEGER *a); 806int i2a_ASN1_INTEGER(BIO *bp, ASN1_INTEGER *a);
@@ -905,70 +832,33 @@ BIGNUM *ASN1_ENUMERATED_to_BN(ASN1_ENUMERATED *ai,BIGNUM *bn);
905int ASN1_PRINTABLE_type(const unsigned char *s, int max); 832int ASN1_PRINTABLE_type(const unsigned char *s, int max);
906 833
907int i2d_ASN1_bytes(ASN1_STRING *a, unsigned char **pp, int tag, int xclass); 834int i2d_ASN1_bytes(ASN1_STRING *a, unsigned char **pp, int tag, int xclass);
908ASN1_STRING *d2i_ASN1_bytes(ASN1_STRING **a, const unsigned char **pp, 835ASN1_STRING *d2i_ASN1_bytes(ASN1_STRING **a, unsigned char **pp,
909 long length, int Ptag, int Pclass); 836 long length, int Ptag, int Pclass);
910unsigned long ASN1_tag2bit(int tag); 837unsigned long ASN1_tag2bit(int tag);
911/* type is one or more of the B_ASN1_ values. */ 838/* type is one or more of the B_ASN1_ values. */
912ASN1_STRING *d2i_ASN1_type_bytes(ASN1_STRING **a,const unsigned char **pp, 839ASN1_STRING *d2i_ASN1_type_bytes(ASN1_STRING **a,unsigned char **pp,
913 long length,int type); 840 long length,int type);
914 841
915/* PARSING */ 842/* PARSING */
916int asn1_Finish(ASN1_CTX *c); 843int asn1_Finish(ASN1_CTX *c);
917int asn1_const_Finish(ASN1_const_CTX *c);
918 844
919/* SPECIALS */ 845/* SPECIALS */
920int ASN1_get_object(const unsigned char **pp, long *plength, int *ptag, 846int ASN1_get_object(unsigned char **pp, long *plength, int *ptag,
921 int *pclass, long omax); 847 int *pclass, long omax);
922int ASN1_check_infinite_end(unsigned char **p,long len); 848int ASN1_check_infinite_end(unsigned char **p,long len);
923int ASN1_const_check_infinite_end(const unsigned char **p,long len);
924void ASN1_put_object(unsigned char **pp, int constructed, int length, 849void ASN1_put_object(unsigned char **pp, int constructed, int length,
925 int tag, int xclass); 850 int tag, int xclass);
926int ASN1_put_eoc(unsigned char **pp);
927int ASN1_object_size(int constructed, int length, int tag); 851int ASN1_object_size(int constructed, int length, int tag);
928 852
929/* Used to implement other functions */ 853/* Used to implement other functions */
930void *ASN1_dup(i2d_of_void *i2d, d2i_of_void *d2i, char *x); 854char *ASN1_dup(int (*i2d)(),char *(*d2i)(),char *x);
931
932#define ASN1_dup_of(type,i2d,d2i,x) \
933 ((type*)ASN1_dup(CHECKED_I2D_OF(type, i2d), \
934 CHECKED_D2I_OF(type, d2i), \
935 CHECKED_PTR_OF(type, x)))
936
937#define ASN1_dup_of_const(type,i2d,d2i,x) \
938 ((type*)ASN1_dup(CHECKED_I2D_OF(const type, i2d), \
939 CHECKED_D2I_OF(type, d2i), \
940 CHECKED_PTR_OF(const type, x)))
941 855
942void *ASN1_item_dup(const ASN1_ITEM *it, void *x); 856void *ASN1_item_dup(const ASN1_ITEM *it, void *x);
943 857
944/* ASN1 alloc/free macros for when a type is only used internally */
945
946#define M_ASN1_new_of(type) (type *)ASN1_item_new(ASN1_ITEM_rptr(type))
947#define M_ASN1_free_of(x, type) \
948 ASN1_item_free(CHECKED_PTR_OF(type, x), ASN1_ITEM_rptr(type))
949
950#ifndef OPENSSL_NO_FP_API 858#ifndef OPENSSL_NO_FP_API
951void *ASN1_d2i_fp(void *(*xnew)(void), d2i_of_void *d2i, FILE *in, void **x); 859char *ASN1_d2i_fp(char *(*xnew)(),char *(*d2i)(),FILE *fp,unsigned char **x);
952
953#define ASN1_d2i_fp_of(type,xnew,d2i,in,x) \
954 ((type*)ASN1_d2i_fp(CHECKED_NEW_OF(type, xnew), \
955 CHECKED_D2I_OF(type, d2i), \
956 in, \
957 CHECKED_PPTR_OF(type, x)))
958
959void *ASN1_item_d2i_fp(const ASN1_ITEM *it, FILE *in, void *x); 860void *ASN1_item_d2i_fp(const ASN1_ITEM *it, FILE *in, void *x);
960int ASN1_i2d_fp(i2d_of_void *i2d,FILE *out,void *x); 861int ASN1_i2d_fp(int (*i2d)(),FILE *out,unsigned char *x);
961
962#define ASN1_i2d_fp_of(type,i2d,out,x) \
963 (ASN1_i2d_fp(CHECKED_I2D_OF(type, i2d), \
964 out, \
965 CHECKED_PTR_OF(type, x)))
966
967#define ASN1_i2d_fp_of_const(type,i2d,out,x) \
968 (ASN1_i2d_fp(CHECKED_I2D_OF(const type, i2d), \
969 out, \
970 CHECKED_PTR_OF(const type, x)))
971
972int ASN1_item_i2d_fp(const ASN1_ITEM *it, FILE *out, void *x); 862int ASN1_item_i2d_fp(const ASN1_ITEM *it, FILE *out, void *x);
973int ASN1_STRING_print_ex_fp(FILE *fp, ASN1_STRING *str, unsigned long flags); 863int ASN1_STRING_print_ex_fp(FILE *fp, ASN1_STRING *str, unsigned long flags);
974#endif 864#endif
@@ -976,41 +866,23 @@ int ASN1_STRING_print_ex_fp(FILE *fp, ASN1_STRING *str, unsigned long flags);
976int ASN1_STRING_to_UTF8(unsigned char **out, ASN1_STRING *in); 866int ASN1_STRING_to_UTF8(unsigned char **out, ASN1_STRING *in);
977 867
978#ifndef OPENSSL_NO_BIO 868#ifndef OPENSSL_NO_BIO
979void *ASN1_d2i_bio(void *(*xnew)(void), d2i_of_void *d2i, BIO *in, void **x); 869char *ASN1_d2i_bio(char *(*xnew)(),char *(*d2i)(),BIO *bp,unsigned char **x);
980
981#define ASN1_d2i_bio_of(type,xnew,d2i,in,x) \
982 ((type*)ASN1_d2i_bio( CHECKED_NEW_OF(type, xnew), \
983 CHECKED_D2I_OF(type, d2i), \
984 in, \
985 CHECKED_PPTR_OF(type, x)))
986
987void *ASN1_item_d2i_bio(const ASN1_ITEM *it, BIO *in, void *x); 870void *ASN1_item_d2i_bio(const ASN1_ITEM *it, BIO *in, void *x);
988int ASN1_i2d_bio(i2d_of_void *i2d,BIO *out, unsigned char *x); 871int ASN1_i2d_bio(int (*i2d)(),BIO *out,unsigned char *x);
989
990#define ASN1_i2d_bio_of(type,i2d,out,x) \
991 (ASN1_i2d_bio(CHECKED_I2D_OF(type, i2d), \
992 out, \
993 CHECKED_PTR_OF(type, x)))
994
995#define ASN1_i2d_bio_of_const(type,i2d,out,x) \
996 (ASN1_i2d_bio(CHECKED_I2D_OF(const type, i2d), \
997 out, \
998 CHECKED_PTR_OF(const type, x)))
999
1000int ASN1_item_i2d_bio(const ASN1_ITEM *it, BIO *out, void *x); 872int ASN1_item_i2d_bio(const ASN1_ITEM *it, BIO *out, void *x);
1001int ASN1_UTCTIME_print(BIO *fp,ASN1_UTCTIME *a); 873int ASN1_UTCTIME_print(BIO *fp,ASN1_UTCTIME *a);
1002int ASN1_GENERALIZEDTIME_print(BIO *fp,ASN1_GENERALIZEDTIME *a); 874int ASN1_GENERALIZEDTIME_print(BIO *fp,ASN1_GENERALIZEDTIME *a);
1003int ASN1_TIME_print(BIO *fp,ASN1_TIME *a); 875int ASN1_TIME_print(BIO *fp,ASN1_TIME *a);
1004int ASN1_STRING_print(BIO *bp,ASN1_STRING *v); 876int ASN1_STRING_print(BIO *bp,ASN1_STRING *v);
1005int ASN1_STRING_print_ex(BIO *out, ASN1_STRING *str, unsigned long flags); 877int ASN1_STRING_print_ex(BIO *out, ASN1_STRING *str, unsigned long flags);
1006int ASN1_parse(BIO *bp,const unsigned char *pp,long len,int indent); 878int ASN1_parse(BIO *bp,unsigned char *pp,long len,int indent);
1007int ASN1_parse_dump(BIO *bp,const unsigned char *pp,long len,int indent,int dump); 879int ASN1_parse_dump(BIO *bp,unsigned char *pp,long len,int indent,int dump);
1008#endif 880#endif
1009const char *ASN1_tag2str(int tag); 881const char *ASN1_tag2str(int tag);
1010 882
1011/* Used to load and write netscape format cert/key */ 883/* Used to load and write netscape format cert/key */
1012int i2d_ASN1_HEADER(ASN1_HEADER *a,unsigned char **pp); 884int i2d_ASN1_HEADER(ASN1_HEADER *a,unsigned char **pp);
1013ASN1_HEADER *d2i_ASN1_HEADER(ASN1_HEADER **a,const unsigned char **pp, long length); 885ASN1_HEADER *d2i_ASN1_HEADER(ASN1_HEADER **a,unsigned char **pp, long length);
1014ASN1_HEADER *ASN1_HEADER_new(void ); 886ASN1_HEADER *ASN1_HEADER_new(void );
1015void ASN1_HEADER_free(ASN1_HEADER *a); 887void ASN1_HEADER_free(ASN1_HEADER *a);
1016 888
@@ -1031,20 +903,13 @@ int ASN1_TYPE_set_int_octetstring(ASN1_TYPE *a, long num,
1031int ASN1_TYPE_get_int_octetstring(ASN1_TYPE *a,long *num, 903int ASN1_TYPE_get_int_octetstring(ASN1_TYPE *a,long *num,
1032 unsigned char *data, int max_len); 904 unsigned char *data, int max_len);
1033 905
1034STACK *ASN1_seq_unpack(const unsigned char *buf, int len, 906STACK *ASN1_seq_unpack(unsigned char *buf, int len, char *(*d2i)(),
1035 d2i_of_void *d2i, void (*free_func)(void *)); 907 void (*free_func)(void *) );
1036unsigned char *ASN1_seq_pack(STACK *safes, i2d_of_void *i2d, 908unsigned char *ASN1_seq_pack(STACK *safes, int (*i2d)(), unsigned char **buf,
1037 unsigned char **buf, int *len ); 909 int *len );
1038void *ASN1_unpack_string(ASN1_STRING *oct, d2i_of_void *d2i); 910void *ASN1_unpack_string(ASN1_STRING *oct, char *(*d2i)());
1039void *ASN1_item_unpack(ASN1_STRING *oct, const ASN1_ITEM *it); 911void *ASN1_item_unpack(ASN1_STRING *oct, const ASN1_ITEM *it);
1040ASN1_STRING *ASN1_pack_string(void *obj, i2d_of_void *i2d, 912ASN1_STRING *ASN1_pack_string(void *obj, int (*i2d)(), ASN1_OCTET_STRING **oct);
1041 ASN1_OCTET_STRING **oct);
1042
1043#define ASN1_pack_string_of(type,obj,i2d,oct) \
1044 (ASN1_pack_string(CHECKED_PTR_OF(type, obj), \
1045 CHECKED_I2D_OF(type, i2d), \
1046 oct))
1047
1048ASN1_STRING *ASN1_item_pack(void *obj, const ASN1_ITEM *it, ASN1_OCTET_STRING **oct); 913ASN1_STRING *ASN1_item_pack(void *obj, const ASN1_ITEM *it, ASN1_OCTET_STRING **oct);
1049 914
1050void ASN1_STRING_set_default_mask(unsigned long mask); 915void ASN1_STRING_set_default_mask(unsigned long mask);
@@ -1067,25 +932,11 @@ void ASN1_STRING_TABLE_cleanup(void);
1067/* Old API compatible functions */ 932/* Old API compatible functions */
1068ASN1_VALUE *ASN1_item_new(const ASN1_ITEM *it); 933ASN1_VALUE *ASN1_item_new(const ASN1_ITEM *it);
1069void ASN1_item_free(ASN1_VALUE *val, const ASN1_ITEM *it); 934void ASN1_item_free(ASN1_VALUE *val, const ASN1_ITEM *it);
1070ASN1_VALUE * ASN1_item_d2i(ASN1_VALUE **val, const unsigned char **in, long len, const ASN1_ITEM *it); 935ASN1_VALUE * ASN1_item_d2i(ASN1_VALUE **val, unsigned char **in, long len, const ASN1_ITEM *it);
1071int ASN1_item_i2d(ASN1_VALUE *val, unsigned char **out, const ASN1_ITEM *it); 936int ASN1_item_i2d(ASN1_VALUE *val, unsigned char **out, const ASN1_ITEM *it);
1072int ASN1_item_ndef_i2d(ASN1_VALUE *val, unsigned char **out, const ASN1_ITEM *it);
1073 937
1074void ASN1_add_oid_module(void); 938void ASN1_add_oid_module(void);
1075 939
1076ASN1_TYPE *ASN1_generate_nconf(char *str, CONF *nconf);
1077ASN1_TYPE *ASN1_generate_v3(char *str, X509V3_CTX *cnf);
1078
1079typedef int asn1_output_data_fn(BIO *out, BIO *data, ASN1_VALUE *val, int flags,
1080 const ASN1_ITEM *it);
1081
1082int int_smime_write_ASN1(BIO *bio, ASN1_VALUE *val, BIO *data, int flags,
1083 int ctype_nid, int econt_nid,
1084 STACK_OF(X509_ALGOR) *mdalgs,
1085 asn1_output_data_fn *data_fn,
1086 const ASN1_ITEM *it);
1087ASN1_VALUE *SMIME_read_ASN1(BIO *bio, BIO **bcont, const ASN1_ITEM *it);
1088
1089/* BEGIN ERROR CODES */ 940/* BEGIN ERROR CODES */
1090/* The following lines are auto generated by the script mkerr.pl. Any changes 941/* The following lines are auto generated by the script mkerr.pl. Any changes
1091 * made after this point may be overwritten when the script is next run. 942 * made after this point may be overwritten when the script is next run.
@@ -1099,70 +950,49 @@ void ERR_load_ASN1_strings(void);
1099#define ASN1_F_A2I_ASN1_ENUMERATED 101 950#define ASN1_F_A2I_ASN1_ENUMERATED 101
1100#define ASN1_F_A2I_ASN1_INTEGER 102 951#define ASN1_F_A2I_ASN1_INTEGER 102
1101#define ASN1_F_A2I_ASN1_STRING 103 952#define ASN1_F_A2I_ASN1_STRING 103
1102#define ASN1_F_APPEND_EXP 176 953#define ASN1_F_ASN1_BIT_STRING_SET_BIT 176
1103#define ASN1_F_ASN1_BIT_STRING_SET_BIT 183
1104#define ASN1_F_ASN1_CB 177
1105#define ASN1_F_ASN1_CHECK_TLEN 104 954#define ASN1_F_ASN1_CHECK_TLEN 104
1106#define ASN1_F_ASN1_COLLATE_PRIMITIVE 105 955#define ASN1_F_ASN1_COLLATE_PRIMITIVE 105
1107#define ASN1_F_ASN1_COLLECT 106 956#define ASN1_F_ASN1_COLLECT 106
957#define ASN1_F_ASN1_D2I_BIO 107
1108#define ASN1_F_ASN1_D2I_EX_PRIMITIVE 108 958#define ASN1_F_ASN1_D2I_EX_PRIMITIVE 108
1109#define ASN1_F_ASN1_D2I_FP 109 959#define ASN1_F_ASN1_D2I_FP 109
1110#define ASN1_F_ASN1_D2I_READ_BIO 107 960#define ASN1_F_ASN1_DIGEST 177
1111#define ASN1_F_ASN1_DIGEST 184
1112#define ASN1_F_ASN1_DO_ADB 110 961#define ASN1_F_ASN1_DO_ADB 110
1113#define ASN1_F_ASN1_DUP 111 962#define ASN1_F_ASN1_DUP 111
1114#define ASN1_F_ASN1_ENUMERATED_SET 112 963#define ASN1_F_ASN1_ENUMERATED_SET 112
1115#define ASN1_F_ASN1_ENUMERATED_TO_BN 113 964#define ASN1_F_ASN1_ENUMERATED_TO_BN 113
1116#define ASN1_F_ASN1_EX_C2I 204 965#define ASN1_F_ASN1_FIND_END 182
1117#define ASN1_F_ASN1_FIND_END 190 966#define ASN1_F_ASN1_GENERALIZEDTIME_SET 178
1118#define ASN1_F_ASN1_GENERALIZEDTIME_SET 185
1119#define ASN1_F_ASN1_GENERATE_V3 178
1120#define ASN1_F_ASN1_GET_OBJECT 114 967#define ASN1_F_ASN1_GET_OBJECT 114
1121#define ASN1_F_ASN1_HEADER_NEW 115 968#define ASN1_F_ASN1_HEADER_NEW 115
1122#define ASN1_F_ASN1_I2D_BIO 116 969#define ASN1_F_ASN1_I2D_BIO 116
1123#define ASN1_F_ASN1_I2D_FP 117 970#define ASN1_F_ASN1_I2D_FP 117
1124#define ASN1_F_ASN1_INTEGER_SET 118 971#define ASN1_F_ASN1_INTEGER_SET 118
1125#define ASN1_F_ASN1_INTEGER_TO_BN 119 972#define ASN1_F_ASN1_INTEGER_TO_BN 119
1126#define ASN1_F_ASN1_ITEM_D2I_FP 206
1127#define ASN1_F_ASN1_ITEM_DUP 191
1128#define ASN1_F_ASN1_ITEM_EX_COMBINE_NEW 121
1129#define ASN1_F_ASN1_ITEM_EX_D2I 120 973#define ASN1_F_ASN1_ITEM_EX_D2I 120
1130#define ASN1_F_ASN1_ITEM_I2D_BIO 192 974#define ASN1_F_ASN1_ITEM_NEW 121
1131#define ASN1_F_ASN1_ITEM_I2D_FP 193 975#define ASN1_F_ASN1_MBSTRING_COPY 122
1132#define ASN1_F_ASN1_ITEM_PACK 198
1133#define ASN1_F_ASN1_ITEM_SIGN 195
1134#define ASN1_F_ASN1_ITEM_UNPACK 199
1135#define ASN1_F_ASN1_ITEM_VERIFY 197
1136#define ASN1_F_ASN1_MBSTRING_NCOPY 122
1137#define ASN1_F_ASN1_OBJECT_NEW 123 976#define ASN1_F_ASN1_OBJECT_NEW 123
1138#define ASN1_F_ASN1_OUTPUT_DATA 207
1139#define ASN1_F_ASN1_PACK_STRING 124 977#define ASN1_F_ASN1_PACK_STRING 124
1140#define ASN1_F_ASN1_PCTX_NEW 205 978#define ASN1_F_ASN1_PBE_SET 125
1141#define ASN1_F_ASN1_PKCS5_PBE_SET 125
1142#define ASN1_F_ASN1_SEQ_PACK 126 979#define ASN1_F_ASN1_SEQ_PACK 126
1143#define ASN1_F_ASN1_SEQ_UNPACK 127 980#define ASN1_F_ASN1_SEQ_UNPACK 127
1144#define ASN1_F_ASN1_SIGN 128 981#define ASN1_F_ASN1_SIGN 128
1145#define ASN1_F_ASN1_STR2TYPE 179 982#define ASN1_F_ASN1_STRING_SET 179
1146#define ASN1_F_ASN1_STRING_SET 186
1147#define ASN1_F_ASN1_STRING_TABLE_ADD 129 983#define ASN1_F_ASN1_STRING_TABLE_ADD 129
1148#define ASN1_F_ASN1_STRING_TYPE_NEW 130 984#define ASN1_F_ASN1_STRING_TYPE_NEW 130
985#define ASN1_F_ASN1_TEMPLATE_D2I 131
1149#define ASN1_F_ASN1_TEMPLATE_EX_D2I 132 986#define ASN1_F_ASN1_TEMPLATE_EX_D2I 132
1150#define ASN1_F_ASN1_TEMPLATE_NEW 133 987#define ASN1_F_ASN1_TEMPLATE_NEW 133
1151#define ASN1_F_ASN1_TEMPLATE_NOEXP_D2I 131
1152#define ASN1_F_ASN1_TIME_SET 175 988#define ASN1_F_ASN1_TIME_SET 175
1153#define ASN1_F_ASN1_TYPE_GET_INT_OCTETSTRING 134 989#define ASN1_F_ASN1_TYPE_GET_INT_OCTETSTRING 134
1154#define ASN1_F_ASN1_TYPE_GET_OCTETSTRING 135 990#define ASN1_F_ASN1_TYPE_GET_OCTETSTRING 135
1155#define ASN1_F_ASN1_UNPACK_STRING 136 991#define ASN1_F_ASN1_UNPACK_STRING 136
1156#define ASN1_F_ASN1_UTCTIME_SET 187 992#define ASN1_F_ASN1_UTCTIME_SET 180
1157#define ASN1_F_ASN1_VERIFY 137 993#define ASN1_F_ASN1_VERIFY 137
1158#define ASN1_F_B64_READ_ASN1 208
1159#define ASN1_F_B64_WRITE_ASN1 209
1160#define ASN1_F_BITSTR_CB 180
1161#define ASN1_F_BN_TO_ASN1_ENUMERATED 138 994#define ASN1_F_BN_TO_ASN1_ENUMERATED 138
1162#define ASN1_F_BN_TO_ASN1_INTEGER 139 995#define ASN1_F_BN_TO_ASN1_INTEGER 139
1163#define ASN1_F_C2I_ASN1_BIT_STRING 189
1164#define ASN1_F_C2I_ASN1_INTEGER 194
1165#define ASN1_F_C2I_ASN1_OBJECT 196
1166#define ASN1_F_COLLECT_DATA 140 996#define ASN1_F_COLLECT_DATA 140
1167#define ASN1_F_D2I_ASN1_BIT_STRING 141 997#define ASN1_F_D2I_ASN1_BIT_STRING 141
1168#define ASN1_F_D2I_ASN1_BOOLEAN 142 998#define ASN1_F_D2I_ASN1_BOOLEAN 142
@@ -1179,39 +1009,29 @@ void ERR_load_ASN1_strings(void);
1179#define ASN1_F_D2I_NETSCAPE_RSA_2 153 1009#define ASN1_F_D2I_NETSCAPE_RSA_2 153
1180#define ASN1_F_D2I_PRIVATEKEY 154 1010#define ASN1_F_D2I_PRIVATEKEY 154
1181#define ASN1_F_D2I_PUBLICKEY 155 1011#define ASN1_F_D2I_PUBLICKEY 155
1182#define ASN1_F_D2I_RSA_NET 200
1183#define ASN1_F_D2I_RSA_NET_2 201
1184#define ASN1_F_D2I_X509 156 1012#define ASN1_F_D2I_X509 156
1185#define ASN1_F_D2I_X509_CINF 157 1013#define ASN1_F_D2I_X509_CINF 157
1014#define ASN1_F_D2I_X509_NAME 158
1186#define ASN1_F_D2I_X509_PKEY 159 1015#define ASN1_F_D2I_X509_PKEY 159
1187#define ASN1_F_I2D_ASN1_SET 188 1016#define ASN1_F_I2D_ASN1_SET 181
1188#define ASN1_F_I2D_ASN1_TIME 160 1017#define ASN1_F_I2D_ASN1_TIME 160
1189#define ASN1_F_I2D_DSA_PUBKEY 161 1018#define ASN1_F_I2D_DSA_PUBKEY 161
1190#define ASN1_F_I2D_EC_PUBKEY 181 1019#define ASN1_F_I2D_NETSCAPE_RSA 162
1191#define ASN1_F_I2D_PRIVATEKEY 163 1020#define ASN1_F_I2D_PRIVATEKEY 163
1192#define ASN1_F_I2D_PUBLICKEY 164 1021#define ASN1_F_I2D_PUBLICKEY 164
1193#define ASN1_F_I2D_RSA_NET 162
1194#define ASN1_F_I2D_RSA_PUBKEY 165 1022#define ASN1_F_I2D_RSA_PUBKEY 165
1195#define ASN1_F_LONG_C2I 166 1023#define ASN1_F_LONG_C2I 166
1196#define ASN1_F_OID_MODULE_INIT 174 1024#define ASN1_F_OID_MODULE_INIT 174
1197#define ASN1_F_PARSE_TAGGING 182
1198#define ASN1_F_PKCS5_PBE2_SET 167 1025#define ASN1_F_PKCS5_PBE2_SET 167
1199#define ASN1_F_PKCS5_PBE_SET 202
1200#define ASN1_F_SMIME_READ_ASN1 210
1201#define ASN1_F_SMIME_TEXT 211
1202#define ASN1_F_X509_CINF_NEW 168 1026#define ASN1_F_X509_CINF_NEW 168
1203#define ASN1_F_X509_CRL_ADD0_REVOKED 169 1027#define ASN1_F_X509_CRL_ADD0_REVOKED 169
1204#define ASN1_F_X509_INFO_NEW 170 1028#define ASN1_F_X509_INFO_NEW 170
1205#define ASN1_F_X509_NAME_ENCODE 203 1029#define ASN1_F_X509_NAME_NEW 171
1206#define ASN1_F_X509_NAME_EX_D2I 158
1207#define ASN1_F_X509_NAME_EX_NEW 171
1208#define ASN1_F_X509_NEW 172 1030#define ASN1_F_X509_NEW 172
1209#define ASN1_F_X509_PKEY_NEW 173 1031#define ASN1_F_X509_PKEY_NEW 173
1210 1032
1211/* Reason codes. */ 1033/* Reason codes. */
1212#define ASN1_R_ADDING_OBJECT 171 1034#define ASN1_R_ADDING_OBJECT 171
1213#define ASN1_R_ASN1_PARSE_ERROR 198
1214#define ASN1_R_ASN1_SIG_PARSE_ERROR 199
1215#define ASN1_R_AUX_ERROR 100 1035#define ASN1_R_AUX_ERROR 100
1216#define ASN1_R_BAD_CLASS 101 1036#define ASN1_R_BAD_CLASS 101
1217#define ASN1_R_BAD_OBJECT_HEADER 102 1037#define ASN1_R_BAD_OBJECT_HEADER 102
@@ -1224,7 +1044,6 @@ void ERR_load_ASN1_strings(void);
1224#define ASN1_R_DATA_IS_WRONG 109 1044#define ASN1_R_DATA_IS_WRONG 109
1225#define ASN1_R_DECODE_ERROR 110 1045#define ASN1_R_DECODE_ERROR 110
1226#define ASN1_R_DECODING_ERROR 111 1046#define ASN1_R_DECODING_ERROR 111
1227#define ASN1_R_DEPTH_EXCEEDED 174
1228#define ASN1_R_ENCODE_ERROR 112 1047#define ASN1_R_ENCODE_ERROR 112
1229#define ASN1_R_ERROR_GETTING_TIME 173 1048#define ASN1_R_ERROR_GETTING_TIME 173
1230#define ASN1_R_ERROR_LOADING_SECTION 172 1049#define ASN1_R_ERROR_LOADING_SECTION 172
@@ -1239,68 +1058,39 @@ void ERR_load_ASN1_strings(void);
1239#define ASN1_R_FIELD_MISSING 121 1058#define ASN1_R_FIELD_MISSING 121
1240#define ASN1_R_FIRST_NUM_TOO_LARGE 122 1059#define ASN1_R_FIRST_NUM_TOO_LARGE 122
1241#define ASN1_R_HEADER_TOO_LONG 123 1060#define ASN1_R_HEADER_TOO_LONG 123
1242#define ASN1_R_ILLEGAL_BITSTRING_FORMAT 175
1243#define ASN1_R_ILLEGAL_BOOLEAN 176
1244#define ASN1_R_ILLEGAL_CHARACTERS 124 1061#define ASN1_R_ILLEGAL_CHARACTERS 124
1245#define ASN1_R_ILLEGAL_FORMAT 177
1246#define ASN1_R_ILLEGAL_HEX 178
1247#define ASN1_R_ILLEGAL_IMPLICIT_TAG 179
1248#define ASN1_R_ILLEGAL_INTEGER 180
1249#define ASN1_R_ILLEGAL_NESTED_TAGGING 181
1250#define ASN1_R_ILLEGAL_NULL 125 1062#define ASN1_R_ILLEGAL_NULL 125
1251#define ASN1_R_ILLEGAL_NULL_VALUE 182
1252#define ASN1_R_ILLEGAL_OBJECT 183
1253#define ASN1_R_ILLEGAL_OPTIONAL_ANY 126 1063#define ASN1_R_ILLEGAL_OPTIONAL_ANY 126
1254#define ASN1_R_ILLEGAL_OPTIONS_ON_ITEM_TEMPLATE 170 1064#define ASN1_R_ILLEGAL_OPTIONS_ON_ITEM_TEMPLATE 170
1255#define ASN1_R_ILLEGAL_TAGGED_ANY 127 1065#define ASN1_R_ILLEGAL_TAGGED_ANY 127
1256#define ASN1_R_ILLEGAL_TIME_VALUE 184
1257#define ASN1_R_INTEGER_NOT_ASCII_FORMAT 185
1258#define ASN1_R_INTEGER_TOO_LARGE_FOR_LONG 128 1066#define ASN1_R_INTEGER_TOO_LARGE_FOR_LONG 128
1259#define ASN1_R_INVALID_BMPSTRING_LENGTH 129 1067#define ASN1_R_INVALID_BMPSTRING_LENGTH 129
1260#define ASN1_R_INVALID_DIGIT 130 1068#define ASN1_R_INVALID_DIGIT 130
1261#define ASN1_R_INVALID_MIME_TYPE 200
1262#define ASN1_R_INVALID_MODIFIER 186
1263#define ASN1_R_INVALID_NUMBER 187
1264#define ASN1_R_INVALID_SEPARATOR 131 1069#define ASN1_R_INVALID_SEPARATOR 131
1265#define ASN1_R_INVALID_TIME_FORMAT 132 1070#define ASN1_R_INVALID_TIME_FORMAT 132
1266#define ASN1_R_INVALID_UNIVERSALSTRING_LENGTH 133 1071#define ASN1_R_INVALID_UNIVERSALSTRING_LENGTH 133
1267#define ASN1_R_INVALID_UTF8STRING 134 1072#define ASN1_R_INVALID_UTF8STRING 134
1268#define ASN1_R_IV_TOO_LARGE 135 1073#define ASN1_R_IV_TOO_LARGE 135
1269#define ASN1_R_LENGTH_ERROR 136 1074#define ASN1_R_LENGTH_ERROR 136
1270#define ASN1_R_LIST_ERROR 188
1271#define ASN1_R_MIME_NO_CONTENT_TYPE 201
1272#define ASN1_R_MIME_PARSE_ERROR 202
1273#define ASN1_R_MIME_SIG_PARSE_ERROR 203
1274#define ASN1_R_MISSING_EOC 137 1075#define ASN1_R_MISSING_EOC 137
1275#define ASN1_R_MISSING_SECOND_NUMBER 138 1076#define ASN1_R_MISSING_SECOND_NUMBER 138
1276#define ASN1_R_MISSING_VALUE 189
1277#define ASN1_R_MSTRING_NOT_UNIVERSAL 139 1077#define ASN1_R_MSTRING_NOT_UNIVERSAL 139
1278#define ASN1_R_MSTRING_WRONG_TAG 140 1078#define ASN1_R_MSTRING_WRONG_TAG 140
1279#define ASN1_R_NESTED_ASN1_STRING 197 1079#define ASN1_R_NESTED_ASN1_STRING 174
1280#define ASN1_R_NON_HEX_CHARACTERS 141 1080#define ASN1_R_NON_HEX_CHARACTERS 141
1281#define ASN1_R_NOT_ASCII_FORMAT 190
1282#define ASN1_R_NOT_ENOUGH_DATA 142 1081#define ASN1_R_NOT_ENOUGH_DATA 142
1283#define ASN1_R_NO_CONTENT_TYPE 204
1284#define ASN1_R_NO_MATCHING_CHOICE_TYPE 143 1082#define ASN1_R_NO_MATCHING_CHOICE_TYPE 143
1285#define ASN1_R_NO_MULTIPART_BODY_FAILURE 205
1286#define ASN1_R_NO_MULTIPART_BOUNDARY 206
1287#define ASN1_R_NO_SIG_CONTENT_TYPE 207
1288#define ASN1_R_NULL_IS_WRONG_LENGTH 144 1083#define ASN1_R_NULL_IS_WRONG_LENGTH 144
1289#define ASN1_R_OBJECT_NOT_ASCII_FORMAT 191
1290#define ASN1_R_ODD_NUMBER_OF_CHARS 145 1084#define ASN1_R_ODD_NUMBER_OF_CHARS 145
1291#define ASN1_R_PRIVATE_KEY_HEADER_MISSING 146 1085#define ASN1_R_PRIVATE_KEY_HEADER_MISSING 146
1292#define ASN1_R_SECOND_NUMBER_TOO_LARGE 147 1086#define ASN1_R_SECOND_NUMBER_TOO_LARGE 147
1293#define ASN1_R_SEQUENCE_LENGTH_MISMATCH 148 1087#define ASN1_R_SEQUENCE_LENGTH_MISMATCH 148
1294#define ASN1_R_SEQUENCE_NOT_CONSTRUCTED 149 1088#define ASN1_R_SEQUENCE_NOT_CONSTRUCTED 149
1295#define ASN1_R_SEQUENCE_OR_SET_NEEDS_CONFIG 192
1296#define ASN1_R_SHORT_LINE 150 1089#define ASN1_R_SHORT_LINE 150
1297#define ASN1_R_SIG_INVALID_MIME_TYPE 208
1298#define ASN1_R_STREAMING_NOT_SUPPORTED 209
1299#define ASN1_R_STRING_TOO_LONG 151 1090#define ASN1_R_STRING_TOO_LONG 151
1300#define ASN1_R_STRING_TOO_SHORT 152 1091#define ASN1_R_STRING_TOO_SHORT 152
1301#define ASN1_R_TAG_VALUE_TOO_HIGH 153 1092#define ASN1_R_TAG_VALUE_TOO_HIGH 153
1302#define ASN1_R_THE_ASN1_OBJECT_IDENTIFIER_IS_NOT_KNOWN_FOR_THIS_MD 154 1093#define ASN1_R_THE_ASN1_OBJECT_IDENTIFIER_IS_NOT_KNOWN_FOR_THIS_MD 154
1303#define ASN1_R_TIME_NOT_ASCII_FORMAT 193
1304#define ASN1_R_TOO_LONG 155 1094#define ASN1_R_TOO_LONG 155
1305#define ASN1_R_TYPE_NOT_CONSTRUCTED 156 1095#define ASN1_R_TYPE_NOT_CONSTRUCTED 156
1306#define ASN1_R_UNABLE_TO_DECODE_RSA_KEY 157 1096#define ASN1_R_UNABLE_TO_DECODE_RSA_KEY 157
@@ -1310,13 +1100,10 @@ void ERR_load_ASN1_strings(void);
1310#define ASN1_R_UNKNOWN_MESSAGE_DIGEST_ALGORITHM 161 1100#define ASN1_R_UNKNOWN_MESSAGE_DIGEST_ALGORITHM 161
1311#define ASN1_R_UNKNOWN_OBJECT_TYPE 162 1101#define ASN1_R_UNKNOWN_OBJECT_TYPE 162
1312#define ASN1_R_UNKNOWN_PUBLIC_KEY_TYPE 163 1102#define ASN1_R_UNKNOWN_PUBLIC_KEY_TYPE 163
1313#define ASN1_R_UNKNOWN_TAG 194
1314#define ASN1_R_UNKOWN_FORMAT 195
1315#define ASN1_R_UNSUPPORTED_ANY_DEFINED_BY_TYPE 164 1103#define ASN1_R_UNSUPPORTED_ANY_DEFINED_BY_TYPE 164
1316#define ASN1_R_UNSUPPORTED_CIPHER 165 1104#define ASN1_R_UNSUPPORTED_CIPHER 165
1317#define ASN1_R_UNSUPPORTED_ENCRYPTION_ALGORITHM 166 1105#define ASN1_R_UNSUPPORTED_ENCRYPTION_ALGORITHM 166
1318#define ASN1_R_UNSUPPORTED_PUBLIC_KEY_TYPE 167 1106#define ASN1_R_UNSUPPORTED_PUBLIC_KEY_TYPE 167
1319#define ASN1_R_UNSUPPORTED_TYPE 196
1320#define ASN1_R_WRONG_TAG 168 1107#define ASN1_R_WRONG_TAG 168
1321#define ASN1_R_WRONG_TYPE 169 1108#define ASN1_R_WRONG_TYPE 169
1322 1109
diff --git a/src/lib/libcrypto/asn1/asn1_err.c b/src/lib/libcrypto/asn1/asn1_err.c
index f8a3e2e6cd..315d0a0807 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-2005 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
@@ -74,70 +74,49 @@ static ERR_STRING_DATA ASN1_str_functs[]=
74{ERR_FUNC(ASN1_F_A2I_ASN1_ENUMERATED), "a2i_ASN1_ENUMERATED"}, 74{ERR_FUNC(ASN1_F_A2I_ASN1_ENUMERATED), "a2i_ASN1_ENUMERATED"},
75{ERR_FUNC(ASN1_F_A2I_ASN1_INTEGER), "a2i_ASN1_INTEGER"}, 75{ERR_FUNC(ASN1_F_A2I_ASN1_INTEGER), "a2i_ASN1_INTEGER"},
76{ERR_FUNC(ASN1_F_A2I_ASN1_STRING), "a2i_ASN1_STRING"}, 76{ERR_FUNC(ASN1_F_A2I_ASN1_STRING), "a2i_ASN1_STRING"},
77{ERR_FUNC(ASN1_F_APPEND_EXP), "APPEND_EXP"},
78{ERR_FUNC(ASN1_F_ASN1_BIT_STRING_SET_BIT), "ASN1_BIT_STRING_set_bit"}, 77{ERR_FUNC(ASN1_F_ASN1_BIT_STRING_SET_BIT), "ASN1_BIT_STRING_set_bit"},
79{ERR_FUNC(ASN1_F_ASN1_CB), "ASN1_CB"},
80{ERR_FUNC(ASN1_F_ASN1_CHECK_TLEN), "ASN1_CHECK_TLEN"}, 78{ERR_FUNC(ASN1_F_ASN1_CHECK_TLEN), "ASN1_CHECK_TLEN"},
81{ERR_FUNC(ASN1_F_ASN1_COLLATE_PRIMITIVE), "ASN1_COLLATE_PRIMITIVE"}, 79{ERR_FUNC(ASN1_F_ASN1_COLLATE_PRIMITIVE), "ASN1_COLLATE_PRIMITIVE"},
82{ERR_FUNC(ASN1_F_ASN1_COLLECT), "ASN1_COLLECT"}, 80{ERR_FUNC(ASN1_F_ASN1_COLLECT), "ASN1_COLLECT"},
81{ERR_FUNC(ASN1_F_ASN1_D2I_BIO), "ASN1_d2i_bio"},
83{ERR_FUNC(ASN1_F_ASN1_D2I_EX_PRIMITIVE), "ASN1_D2I_EX_PRIMITIVE"}, 82{ERR_FUNC(ASN1_F_ASN1_D2I_EX_PRIMITIVE), "ASN1_D2I_EX_PRIMITIVE"},
84{ERR_FUNC(ASN1_F_ASN1_D2I_FP), "ASN1_d2i_fp"}, 83{ERR_FUNC(ASN1_F_ASN1_D2I_FP), "ASN1_d2i_fp"},
85{ERR_FUNC(ASN1_F_ASN1_D2I_READ_BIO), "ASN1_D2I_READ_BIO"},
86{ERR_FUNC(ASN1_F_ASN1_DIGEST), "ASN1_digest"}, 84{ERR_FUNC(ASN1_F_ASN1_DIGEST), "ASN1_digest"},
87{ERR_FUNC(ASN1_F_ASN1_DO_ADB), "ASN1_DO_ADB"}, 85{ERR_FUNC(ASN1_F_ASN1_DO_ADB), "ASN1_DO_ADB"},
88{ERR_FUNC(ASN1_F_ASN1_DUP), "ASN1_dup"}, 86{ERR_FUNC(ASN1_F_ASN1_DUP), "ASN1_dup"},
89{ERR_FUNC(ASN1_F_ASN1_ENUMERATED_SET), "ASN1_ENUMERATED_set"}, 87{ERR_FUNC(ASN1_F_ASN1_ENUMERATED_SET), "ASN1_ENUMERATED_set"},
90{ERR_FUNC(ASN1_F_ASN1_ENUMERATED_TO_BN), "ASN1_ENUMERATED_to_BN"}, 88{ERR_FUNC(ASN1_F_ASN1_ENUMERATED_TO_BN), "ASN1_ENUMERATED_to_BN"},
91{ERR_FUNC(ASN1_F_ASN1_EX_C2I), "ASN1_EX_C2I"},
92{ERR_FUNC(ASN1_F_ASN1_FIND_END), "ASN1_FIND_END"}, 89{ERR_FUNC(ASN1_F_ASN1_FIND_END), "ASN1_FIND_END"},
93{ERR_FUNC(ASN1_F_ASN1_GENERALIZEDTIME_SET), "ASN1_GENERALIZEDTIME_set"}, 90{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_GET_OBJECT), "ASN1_get_object"}, 91{ERR_FUNC(ASN1_F_ASN1_GET_OBJECT), "ASN1_get_object"},
96{ERR_FUNC(ASN1_F_ASN1_HEADER_NEW), "ASN1_HEADER_new"}, 92{ERR_FUNC(ASN1_F_ASN1_HEADER_NEW), "ASN1_HEADER_new"},
97{ERR_FUNC(ASN1_F_ASN1_I2D_BIO), "ASN1_i2d_bio"}, 93{ERR_FUNC(ASN1_F_ASN1_I2D_BIO), "ASN1_i2d_bio"},
98{ERR_FUNC(ASN1_F_ASN1_I2D_FP), "ASN1_i2d_fp"}, 94{ERR_FUNC(ASN1_F_ASN1_I2D_FP), "ASN1_i2d_fp"},
99{ERR_FUNC(ASN1_F_ASN1_INTEGER_SET), "ASN1_INTEGER_set"}, 95{ERR_FUNC(ASN1_F_ASN1_INTEGER_SET), "ASN1_INTEGER_set"},
100{ERR_FUNC(ASN1_F_ASN1_INTEGER_TO_BN), "ASN1_INTEGER_to_BN"}, 96{ERR_FUNC(ASN1_F_ASN1_INTEGER_TO_BN), "ASN1_INTEGER_to_BN"},
101{ERR_FUNC(ASN1_F_ASN1_ITEM_D2I_FP), "ASN1_item_d2i_fp"},
102{ERR_FUNC(ASN1_F_ASN1_ITEM_DUP), "ASN1_item_dup"},
103{ERR_FUNC(ASN1_F_ASN1_ITEM_EX_COMBINE_NEW), "ASN1_ITEM_EX_COMBINE_NEW"},
104{ERR_FUNC(ASN1_F_ASN1_ITEM_EX_D2I), "ASN1_ITEM_EX_D2I"}, 97{ERR_FUNC(ASN1_F_ASN1_ITEM_EX_D2I), "ASN1_ITEM_EX_D2I"},
105{ERR_FUNC(ASN1_F_ASN1_ITEM_I2D_BIO), "ASN1_item_i2d_bio"}, 98{ERR_FUNC(ASN1_F_ASN1_ITEM_NEW), "ASN1_item_new"},
106{ERR_FUNC(ASN1_F_ASN1_ITEM_I2D_FP), "ASN1_item_i2d_fp"}, 99{ERR_FUNC(ASN1_F_ASN1_MBSTRING_COPY), "ASN1_mbstring_copy"},
107{ERR_FUNC(ASN1_F_ASN1_ITEM_PACK), "ASN1_item_pack"},
108{ERR_FUNC(ASN1_F_ASN1_ITEM_SIGN), "ASN1_item_sign"},
109{ERR_FUNC(ASN1_F_ASN1_ITEM_UNPACK), "ASN1_item_unpack"},
110{ERR_FUNC(ASN1_F_ASN1_ITEM_VERIFY), "ASN1_item_verify"},
111{ERR_FUNC(ASN1_F_ASN1_MBSTRING_NCOPY), "ASN1_mbstring_ncopy"},
112{ERR_FUNC(ASN1_F_ASN1_OBJECT_NEW), "ASN1_OBJECT_new"}, 100{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_PACK_STRING), "ASN1_pack_string"}, 101{ERR_FUNC(ASN1_F_ASN1_PACK_STRING), "ASN1_pack_string"},
115{ERR_FUNC(ASN1_F_ASN1_PCTX_NEW), "ASN1_PCTX_NEW"}, 102{ERR_FUNC(ASN1_F_ASN1_PBE_SET), "ASN1_PBE_SET"},
116{ERR_FUNC(ASN1_F_ASN1_PKCS5_PBE_SET), "ASN1_PKCS5_PBE_SET"},
117{ERR_FUNC(ASN1_F_ASN1_SEQ_PACK), "ASN1_seq_pack"}, 103{ERR_FUNC(ASN1_F_ASN1_SEQ_PACK), "ASN1_seq_pack"},
118{ERR_FUNC(ASN1_F_ASN1_SEQ_UNPACK), "ASN1_seq_unpack"}, 104{ERR_FUNC(ASN1_F_ASN1_SEQ_UNPACK), "ASN1_seq_unpack"},
119{ERR_FUNC(ASN1_F_ASN1_SIGN), "ASN1_sign"}, 105{ERR_FUNC(ASN1_F_ASN1_SIGN), "ASN1_sign"},
120{ERR_FUNC(ASN1_F_ASN1_STR2TYPE), "ASN1_STR2TYPE"},
121{ERR_FUNC(ASN1_F_ASN1_STRING_SET), "ASN1_STRING_set"}, 106{ERR_FUNC(ASN1_F_ASN1_STRING_SET), "ASN1_STRING_set"},
122{ERR_FUNC(ASN1_F_ASN1_STRING_TABLE_ADD), "ASN1_STRING_TABLE_add"}, 107{ERR_FUNC(ASN1_F_ASN1_STRING_TABLE_ADD), "ASN1_STRING_TABLE_add"},
123{ERR_FUNC(ASN1_F_ASN1_STRING_TYPE_NEW), "ASN1_STRING_type_new"}, 108{ERR_FUNC(ASN1_F_ASN1_STRING_TYPE_NEW), "ASN1_STRING_type_new"},
109{ERR_FUNC(ASN1_F_ASN1_TEMPLATE_D2I), "ASN1_TEMPLATE_D2I"},
124{ERR_FUNC(ASN1_F_ASN1_TEMPLATE_EX_D2I), "ASN1_TEMPLATE_EX_D2I"}, 110{ERR_FUNC(ASN1_F_ASN1_TEMPLATE_EX_D2I), "ASN1_TEMPLATE_EX_D2I"},
125{ERR_FUNC(ASN1_F_ASN1_TEMPLATE_NEW), "ASN1_TEMPLATE_NEW"}, 111{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_TIME_SET), "ASN1_TIME_set"}, 112{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"}, 113{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"}, 114{ERR_FUNC(ASN1_F_ASN1_TYPE_GET_OCTETSTRING), "ASN1_TYPE_get_octetstring"},
130{ERR_FUNC(ASN1_F_ASN1_UNPACK_STRING), "ASN1_unpack_string"}, 115{ERR_FUNC(ASN1_F_ASN1_UNPACK_STRING), "ASN1_unpack_string"},
131{ERR_FUNC(ASN1_F_ASN1_UTCTIME_SET), "ASN1_UTCTIME_set"}, 116{ERR_FUNC(ASN1_F_ASN1_UTCTIME_SET), "ASN1_UTCTIME_set"},
132{ERR_FUNC(ASN1_F_ASN1_VERIFY), "ASN1_verify"}, 117{ERR_FUNC(ASN1_F_ASN1_VERIFY), "ASN1_verify"},
133{ERR_FUNC(ASN1_F_B64_READ_ASN1), "B64_READ_ASN1"},
134{ERR_FUNC(ASN1_F_B64_WRITE_ASN1), "B64_WRITE_ASN1"},
135{ERR_FUNC(ASN1_F_BITSTR_CB), "BITSTR_CB"},
136{ERR_FUNC(ASN1_F_BN_TO_ASN1_ENUMERATED), "BN_to_ASN1_ENUMERATED"}, 118{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"}, 119{ERR_FUNC(ASN1_F_BN_TO_ASN1_INTEGER), "BN_to_ASN1_INTEGER"},
138{ERR_FUNC(ASN1_F_C2I_ASN1_BIT_STRING), "c2i_ASN1_BIT_STRING"},
139{ERR_FUNC(ASN1_F_C2I_ASN1_INTEGER), "c2i_ASN1_INTEGER"},
140{ERR_FUNC(ASN1_F_C2I_ASN1_OBJECT), "c2i_ASN1_OBJECT"},
141{ERR_FUNC(ASN1_F_COLLECT_DATA), "COLLECT_DATA"}, 120{ERR_FUNC(ASN1_F_COLLECT_DATA), "COLLECT_DATA"},
142{ERR_FUNC(ASN1_F_D2I_ASN1_BIT_STRING), "D2I_ASN1_BIT_STRING"}, 121{ERR_FUNC(ASN1_F_D2I_ASN1_BIT_STRING), "D2I_ASN1_BIT_STRING"},
143{ERR_FUNC(ASN1_F_D2I_ASN1_BOOLEAN), "d2i_ASN1_BOOLEAN"}, 122{ERR_FUNC(ASN1_F_D2I_ASN1_BOOLEAN), "d2i_ASN1_BOOLEAN"},
@@ -154,32 +133,24 @@ static ERR_STRING_DATA ASN1_str_functs[]=
154{ERR_FUNC(ASN1_F_D2I_NETSCAPE_RSA_2), "D2I_NETSCAPE_RSA_2"}, 133{ERR_FUNC(ASN1_F_D2I_NETSCAPE_RSA_2), "D2I_NETSCAPE_RSA_2"},
155{ERR_FUNC(ASN1_F_D2I_PRIVATEKEY), "d2i_PrivateKey"}, 134{ERR_FUNC(ASN1_F_D2I_PRIVATEKEY), "d2i_PrivateKey"},
156{ERR_FUNC(ASN1_F_D2I_PUBLICKEY), "d2i_PublicKey"}, 135{ERR_FUNC(ASN1_F_D2I_PUBLICKEY), "d2i_PublicKey"},
157{ERR_FUNC(ASN1_F_D2I_RSA_NET), "d2i_RSA_NET"},
158{ERR_FUNC(ASN1_F_D2I_RSA_NET_2), "D2I_RSA_NET_2"},
159{ERR_FUNC(ASN1_F_D2I_X509), "D2I_X509"}, 136{ERR_FUNC(ASN1_F_D2I_X509), "D2I_X509"},
160{ERR_FUNC(ASN1_F_D2I_X509_CINF), "D2I_X509_CINF"}, 137{ERR_FUNC(ASN1_F_D2I_X509_CINF), "D2I_X509_CINF"},
138{ERR_FUNC(ASN1_F_D2I_X509_NAME), "D2I_X509_NAME"},
161{ERR_FUNC(ASN1_F_D2I_X509_PKEY), "d2i_X509_PKEY"}, 139{ERR_FUNC(ASN1_F_D2I_X509_PKEY), "d2i_X509_PKEY"},
162{ERR_FUNC(ASN1_F_I2D_ASN1_SET), "i2d_ASN1_SET"}, 140{ERR_FUNC(ASN1_F_I2D_ASN1_SET), "i2d_ASN1_SET"},
163{ERR_FUNC(ASN1_F_I2D_ASN1_TIME), "I2D_ASN1_TIME"}, 141{ERR_FUNC(ASN1_F_I2D_ASN1_TIME), "I2D_ASN1_TIME"},
164{ERR_FUNC(ASN1_F_I2D_DSA_PUBKEY), "i2d_DSA_PUBKEY"}, 142{ERR_FUNC(ASN1_F_I2D_DSA_PUBKEY), "i2d_DSA_PUBKEY"},
165{ERR_FUNC(ASN1_F_I2D_EC_PUBKEY), "i2d_EC_PUBKEY"}, 143{ERR_FUNC(ASN1_F_I2D_NETSCAPE_RSA), "i2d_Netscape_RSA"},
166{ERR_FUNC(ASN1_F_I2D_PRIVATEKEY), "i2d_PrivateKey"}, 144{ERR_FUNC(ASN1_F_I2D_PRIVATEKEY), "i2d_PrivateKey"},
167{ERR_FUNC(ASN1_F_I2D_PUBLICKEY), "i2d_PublicKey"}, 145{ERR_FUNC(ASN1_F_I2D_PUBLICKEY), "i2d_PublicKey"},
168{ERR_FUNC(ASN1_F_I2D_RSA_NET), "i2d_RSA_NET"},
169{ERR_FUNC(ASN1_F_I2D_RSA_PUBKEY), "i2d_RSA_PUBKEY"}, 146{ERR_FUNC(ASN1_F_I2D_RSA_PUBKEY), "i2d_RSA_PUBKEY"},
170{ERR_FUNC(ASN1_F_LONG_C2I), "LONG_C2I"}, 147{ERR_FUNC(ASN1_F_LONG_C2I), "LONG_C2I"},
171{ERR_FUNC(ASN1_F_OID_MODULE_INIT), "OID_MODULE_INIT"}, 148{ERR_FUNC(ASN1_F_OID_MODULE_INIT), "OID_MODULE_INIT"},
172{ERR_FUNC(ASN1_F_PARSE_TAGGING), "PARSE_TAGGING"},
173{ERR_FUNC(ASN1_F_PKCS5_PBE2_SET), "PKCS5_pbe2_set"}, 149{ERR_FUNC(ASN1_F_PKCS5_PBE2_SET), "PKCS5_pbe2_set"},
174{ERR_FUNC(ASN1_F_PKCS5_PBE_SET), "PKCS5_pbe_set"},
175{ERR_FUNC(ASN1_F_SMIME_READ_ASN1), "SMIME_read_ASN1"},
176{ERR_FUNC(ASN1_F_SMIME_TEXT), "SMIME_text"},
177{ERR_FUNC(ASN1_F_X509_CINF_NEW), "X509_CINF_NEW"}, 150{ERR_FUNC(ASN1_F_X509_CINF_NEW), "X509_CINF_NEW"},
178{ERR_FUNC(ASN1_F_X509_CRL_ADD0_REVOKED), "X509_CRL_add0_revoked"}, 151{ERR_FUNC(ASN1_F_X509_CRL_ADD0_REVOKED), "X509_CRL_add0_revoked"},
179{ERR_FUNC(ASN1_F_X509_INFO_NEW), "X509_INFO_new"}, 152{ERR_FUNC(ASN1_F_X509_INFO_NEW), "X509_INFO_new"},
180{ERR_FUNC(ASN1_F_X509_NAME_ENCODE), "X509_NAME_ENCODE"}, 153{ERR_FUNC(ASN1_F_X509_NAME_NEW), "X509_NAME_NEW"},
181{ERR_FUNC(ASN1_F_X509_NAME_EX_D2I), "X509_NAME_EX_D2I"},
182{ERR_FUNC(ASN1_F_X509_NAME_EX_NEW), "X509_NAME_EX_NEW"},
183{ERR_FUNC(ASN1_F_X509_NEW), "X509_NEW"}, 154{ERR_FUNC(ASN1_F_X509_NEW), "X509_NEW"},
184{ERR_FUNC(ASN1_F_X509_PKEY_NEW), "X509_PKEY_new"}, 155{ERR_FUNC(ASN1_F_X509_PKEY_NEW), "X509_PKEY_new"},
185{0,NULL} 156{0,NULL}
@@ -188,8 +159,6 @@ static ERR_STRING_DATA ASN1_str_functs[]=
188static ERR_STRING_DATA ASN1_str_reasons[]= 159static ERR_STRING_DATA ASN1_str_reasons[]=
189 { 160 {
190{ERR_REASON(ASN1_R_ADDING_OBJECT) ,"adding object"}, 161{ERR_REASON(ASN1_R_ADDING_OBJECT) ,"adding object"},
191{ERR_REASON(ASN1_R_ASN1_PARSE_ERROR) ,"asn1 parse error"},
192{ERR_REASON(ASN1_R_ASN1_SIG_PARSE_ERROR) ,"asn1 sig parse error"},
193{ERR_REASON(ASN1_R_AUX_ERROR) ,"aux error"}, 162{ERR_REASON(ASN1_R_AUX_ERROR) ,"aux error"},
194{ERR_REASON(ASN1_R_BAD_CLASS) ,"bad class"}, 163{ERR_REASON(ASN1_R_BAD_CLASS) ,"bad class"},
195{ERR_REASON(ASN1_R_BAD_OBJECT_HEADER) ,"bad object header"}, 164{ERR_REASON(ASN1_R_BAD_OBJECT_HEADER) ,"bad object header"},
@@ -202,7 +171,6 @@ static ERR_STRING_DATA ASN1_str_reasons[]=
202{ERR_REASON(ASN1_R_DATA_IS_WRONG) ,"data is wrong"}, 171{ERR_REASON(ASN1_R_DATA_IS_WRONG) ,"data is wrong"},
203{ERR_REASON(ASN1_R_DECODE_ERROR) ,"decode error"}, 172{ERR_REASON(ASN1_R_DECODE_ERROR) ,"decode error"},
204{ERR_REASON(ASN1_R_DECODING_ERROR) ,"decoding error"}, 173{ERR_REASON(ASN1_R_DECODING_ERROR) ,"decoding error"},
205{ERR_REASON(ASN1_R_DEPTH_EXCEEDED) ,"depth exceeded"},
206{ERR_REASON(ASN1_R_ENCODE_ERROR) ,"encode error"}, 174{ERR_REASON(ASN1_R_ENCODE_ERROR) ,"encode error"},
207{ERR_REASON(ASN1_R_ERROR_GETTING_TIME) ,"error getting time"}, 175{ERR_REASON(ASN1_R_ERROR_GETTING_TIME) ,"error getting time"},
208{ERR_REASON(ASN1_R_ERROR_LOADING_SECTION),"error loading section"}, 176{ERR_REASON(ASN1_R_ERROR_LOADING_SECTION),"error loading section"},
@@ -217,68 +185,39 @@ static ERR_STRING_DATA ASN1_str_reasons[]=
217{ERR_REASON(ASN1_R_FIELD_MISSING) ,"field missing"}, 185{ERR_REASON(ASN1_R_FIELD_MISSING) ,"field missing"},
218{ERR_REASON(ASN1_R_FIRST_NUM_TOO_LARGE) ,"first num too large"}, 186{ERR_REASON(ASN1_R_FIRST_NUM_TOO_LARGE) ,"first num too large"},
219{ERR_REASON(ASN1_R_HEADER_TOO_LONG) ,"header too long"}, 187{ERR_REASON(ASN1_R_HEADER_TOO_LONG) ,"header too long"},
220{ERR_REASON(ASN1_R_ILLEGAL_BITSTRING_FORMAT),"illegal bitstring format"},
221{ERR_REASON(ASN1_R_ILLEGAL_BOOLEAN) ,"illegal boolean"},
222{ERR_REASON(ASN1_R_ILLEGAL_CHARACTERS) ,"illegal characters"}, 188{ERR_REASON(ASN1_R_ILLEGAL_CHARACTERS) ,"illegal characters"},
223{ERR_REASON(ASN1_R_ILLEGAL_FORMAT) ,"illegal format"},
224{ERR_REASON(ASN1_R_ILLEGAL_HEX) ,"illegal hex"},
225{ERR_REASON(ASN1_R_ILLEGAL_IMPLICIT_TAG) ,"illegal implicit tag"},
226{ERR_REASON(ASN1_R_ILLEGAL_INTEGER) ,"illegal integer"},
227{ERR_REASON(ASN1_R_ILLEGAL_NESTED_TAGGING),"illegal nested tagging"},
228{ERR_REASON(ASN1_R_ILLEGAL_NULL) ,"illegal null"}, 189{ERR_REASON(ASN1_R_ILLEGAL_NULL) ,"illegal null"},
229{ERR_REASON(ASN1_R_ILLEGAL_NULL_VALUE) ,"illegal null value"},
230{ERR_REASON(ASN1_R_ILLEGAL_OBJECT) ,"illegal object"},
231{ERR_REASON(ASN1_R_ILLEGAL_OPTIONAL_ANY) ,"illegal optional any"}, 190{ERR_REASON(ASN1_R_ILLEGAL_OPTIONAL_ANY) ,"illegal optional any"},
232{ERR_REASON(ASN1_R_ILLEGAL_OPTIONS_ON_ITEM_TEMPLATE),"illegal options on item template"}, 191{ERR_REASON(ASN1_R_ILLEGAL_OPTIONS_ON_ITEM_TEMPLATE),"illegal options on item template"},
233{ERR_REASON(ASN1_R_ILLEGAL_TAGGED_ANY) ,"illegal tagged any"}, 192{ERR_REASON(ASN1_R_ILLEGAL_TAGGED_ANY) ,"illegal tagged any"},
234{ERR_REASON(ASN1_R_ILLEGAL_TIME_VALUE) ,"illegal time value"},
235{ERR_REASON(ASN1_R_INTEGER_NOT_ASCII_FORMAT),"integer not ascii format"},
236{ERR_REASON(ASN1_R_INTEGER_TOO_LARGE_FOR_LONG),"integer too large for long"}, 193{ERR_REASON(ASN1_R_INTEGER_TOO_LARGE_FOR_LONG),"integer too large for long"},
237{ERR_REASON(ASN1_R_INVALID_BMPSTRING_LENGTH),"invalid bmpstring length"}, 194{ERR_REASON(ASN1_R_INVALID_BMPSTRING_LENGTH),"invalid bmpstring length"},
238{ERR_REASON(ASN1_R_INVALID_DIGIT) ,"invalid digit"}, 195{ERR_REASON(ASN1_R_INVALID_DIGIT) ,"invalid digit"},
239{ERR_REASON(ASN1_R_INVALID_MIME_TYPE) ,"invalid mime type"},
240{ERR_REASON(ASN1_R_INVALID_MODIFIER) ,"invalid modifier"},
241{ERR_REASON(ASN1_R_INVALID_NUMBER) ,"invalid number"},
242{ERR_REASON(ASN1_R_INVALID_SEPARATOR) ,"invalid separator"}, 196{ERR_REASON(ASN1_R_INVALID_SEPARATOR) ,"invalid separator"},
243{ERR_REASON(ASN1_R_INVALID_TIME_FORMAT) ,"invalid time format"}, 197{ERR_REASON(ASN1_R_INVALID_TIME_FORMAT) ,"invalid time format"},
244{ERR_REASON(ASN1_R_INVALID_UNIVERSALSTRING_LENGTH),"invalid universalstring length"}, 198{ERR_REASON(ASN1_R_INVALID_UNIVERSALSTRING_LENGTH),"invalid universalstring length"},
245{ERR_REASON(ASN1_R_INVALID_UTF8STRING) ,"invalid utf8string"}, 199{ERR_REASON(ASN1_R_INVALID_UTF8STRING) ,"invalid utf8string"},
246{ERR_REASON(ASN1_R_IV_TOO_LARGE) ,"iv too large"}, 200{ERR_REASON(ASN1_R_IV_TOO_LARGE) ,"iv too large"},
247{ERR_REASON(ASN1_R_LENGTH_ERROR) ,"length error"}, 201{ERR_REASON(ASN1_R_LENGTH_ERROR) ,"length error"},
248{ERR_REASON(ASN1_R_LIST_ERROR) ,"list error"},
249{ERR_REASON(ASN1_R_MIME_NO_CONTENT_TYPE) ,"mime no content type"},
250{ERR_REASON(ASN1_R_MIME_PARSE_ERROR) ,"mime parse error"},
251{ERR_REASON(ASN1_R_MIME_SIG_PARSE_ERROR) ,"mime sig parse error"},
252{ERR_REASON(ASN1_R_MISSING_EOC) ,"missing eoc"}, 202{ERR_REASON(ASN1_R_MISSING_EOC) ,"missing eoc"},
253{ERR_REASON(ASN1_R_MISSING_SECOND_NUMBER),"missing second number"}, 203{ERR_REASON(ASN1_R_MISSING_SECOND_NUMBER),"missing second number"},
254{ERR_REASON(ASN1_R_MISSING_VALUE) ,"missing value"},
255{ERR_REASON(ASN1_R_MSTRING_NOT_UNIVERSAL),"mstring not universal"}, 204{ERR_REASON(ASN1_R_MSTRING_NOT_UNIVERSAL),"mstring not universal"},
256{ERR_REASON(ASN1_R_MSTRING_WRONG_TAG) ,"mstring wrong tag"}, 205{ERR_REASON(ASN1_R_MSTRING_WRONG_TAG) ,"mstring wrong tag"},
257{ERR_REASON(ASN1_R_NESTED_ASN1_STRING) ,"nested asn1 string"}, 206{ERR_REASON(ASN1_R_NESTED_ASN1_STRING) ,"nested asn1 string"},
258{ERR_REASON(ASN1_R_NON_HEX_CHARACTERS) ,"non hex characters"}, 207{ERR_REASON(ASN1_R_NON_HEX_CHARACTERS) ,"non hex characters"},
259{ERR_REASON(ASN1_R_NOT_ASCII_FORMAT) ,"not ascii format"},
260{ERR_REASON(ASN1_R_NOT_ENOUGH_DATA) ,"not enough data"}, 208{ERR_REASON(ASN1_R_NOT_ENOUGH_DATA) ,"not enough data"},
261{ERR_REASON(ASN1_R_NO_CONTENT_TYPE) ,"no content type"},
262{ERR_REASON(ASN1_R_NO_MATCHING_CHOICE_TYPE),"no matching choice type"}, 209{ERR_REASON(ASN1_R_NO_MATCHING_CHOICE_TYPE),"no matching choice type"},
263{ERR_REASON(ASN1_R_NO_MULTIPART_BODY_FAILURE),"no multipart body failure"},
264{ERR_REASON(ASN1_R_NO_MULTIPART_BOUNDARY),"no multipart boundary"},
265{ERR_REASON(ASN1_R_NO_SIG_CONTENT_TYPE) ,"no sig content type"},
266{ERR_REASON(ASN1_R_NULL_IS_WRONG_LENGTH) ,"null is wrong length"}, 210{ERR_REASON(ASN1_R_NULL_IS_WRONG_LENGTH) ,"null is wrong length"},
267{ERR_REASON(ASN1_R_OBJECT_NOT_ASCII_FORMAT),"object not ascii format"},
268{ERR_REASON(ASN1_R_ODD_NUMBER_OF_CHARS) ,"odd number of chars"}, 211{ERR_REASON(ASN1_R_ODD_NUMBER_OF_CHARS) ,"odd number of chars"},
269{ERR_REASON(ASN1_R_PRIVATE_KEY_HEADER_MISSING),"private key header missing"}, 212{ERR_REASON(ASN1_R_PRIVATE_KEY_HEADER_MISSING),"private key header missing"},
270{ERR_REASON(ASN1_R_SECOND_NUMBER_TOO_LARGE),"second number too large"}, 213{ERR_REASON(ASN1_R_SECOND_NUMBER_TOO_LARGE),"second number too large"},
271{ERR_REASON(ASN1_R_SEQUENCE_LENGTH_MISMATCH),"sequence length mismatch"}, 214{ERR_REASON(ASN1_R_SEQUENCE_LENGTH_MISMATCH),"sequence length mismatch"},
272{ERR_REASON(ASN1_R_SEQUENCE_NOT_CONSTRUCTED),"sequence not constructed"}, 215{ERR_REASON(ASN1_R_SEQUENCE_NOT_CONSTRUCTED),"sequence not constructed"},
273{ERR_REASON(ASN1_R_SEQUENCE_OR_SET_NEEDS_CONFIG),"sequence or set needs config"},
274{ERR_REASON(ASN1_R_SHORT_LINE) ,"short line"}, 216{ERR_REASON(ASN1_R_SHORT_LINE) ,"short line"},
275{ERR_REASON(ASN1_R_SIG_INVALID_MIME_TYPE),"sig invalid mime type"},
276{ERR_REASON(ASN1_R_STREAMING_NOT_SUPPORTED),"streaming not supported"},
277{ERR_REASON(ASN1_R_STRING_TOO_LONG) ,"string too long"}, 217{ERR_REASON(ASN1_R_STRING_TOO_LONG) ,"string too long"},
278{ERR_REASON(ASN1_R_STRING_TOO_SHORT) ,"string too short"}, 218{ERR_REASON(ASN1_R_STRING_TOO_SHORT) ,"string too short"},
279{ERR_REASON(ASN1_R_TAG_VALUE_TOO_HIGH) ,"tag value too high"}, 219{ERR_REASON(ASN1_R_TAG_VALUE_TOO_HIGH) ,"tag value too high"},
280{ERR_REASON(ASN1_R_THE_ASN1_OBJECT_IDENTIFIER_IS_NOT_KNOWN_FOR_THIS_MD),"the asn1 object identifier is not known for this md"}, 220{ERR_REASON(ASN1_R_THE_ASN1_OBJECT_IDENTIFIER_IS_NOT_KNOWN_FOR_THIS_MD),"the asn1 object identifier is not known for this md"},
281{ERR_REASON(ASN1_R_TIME_NOT_ASCII_FORMAT),"time not ascii format"},
282{ERR_REASON(ASN1_R_TOO_LONG) ,"too long"}, 221{ERR_REASON(ASN1_R_TOO_LONG) ,"too long"},
283{ERR_REASON(ASN1_R_TYPE_NOT_CONSTRUCTED) ,"type not constructed"}, 222{ERR_REASON(ASN1_R_TYPE_NOT_CONSTRUCTED) ,"type not constructed"},
284{ERR_REASON(ASN1_R_UNABLE_TO_DECODE_RSA_KEY),"unable to decode rsa key"}, 223{ERR_REASON(ASN1_R_UNABLE_TO_DECODE_RSA_KEY),"unable to decode rsa key"},
@@ -288,13 +227,10 @@ static ERR_STRING_DATA ASN1_str_reasons[]=
288{ERR_REASON(ASN1_R_UNKNOWN_MESSAGE_DIGEST_ALGORITHM),"unknown message digest algorithm"}, 227{ERR_REASON(ASN1_R_UNKNOWN_MESSAGE_DIGEST_ALGORITHM),"unknown message digest algorithm"},
289{ERR_REASON(ASN1_R_UNKNOWN_OBJECT_TYPE) ,"unknown object type"}, 228{ERR_REASON(ASN1_R_UNKNOWN_OBJECT_TYPE) ,"unknown object type"},
290{ERR_REASON(ASN1_R_UNKNOWN_PUBLIC_KEY_TYPE),"unknown public key type"}, 229{ERR_REASON(ASN1_R_UNKNOWN_PUBLIC_KEY_TYPE),"unknown public key type"},
291{ERR_REASON(ASN1_R_UNKNOWN_TAG) ,"unknown tag"},
292{ERR_REASON(ASN1_R_UNKOWN_FORMAT) ,"unkown format"},
293{ERR_REASON(ASN1_R_UNSUPPORTED_ANY_DEFINED_BY_TYPE),"unsupported any defined by type"}, 230{ERR_REASON(ASN1_R_UNSUPPORTED_ANY_DEFINED_BY_TYPE),"unsupported any defined by type"},
294{ERR_REASON(ASN1_R_UNSUPPORTED_CIPHER) ,"unsupported cipher"}, 231{ERR_REASON(ASN1_R_UNSUPPORTED_CIPHER) ,"unsupported cipher"},
295{ERR_REASON(ASN1_R_UNSUPPORTED_ENCRYPTION_ALGORITHM),"unsupported encryption algorithm"}, 232{ERR_REASON(ASN1_R_UNSUPPORTED_ENCRYPTION_ALGORITHM),"unsupported encryption algorithm"},
296{ERR_REASON(ASN1_R_UNSUPPORTED_PUBLIC_KEY_TYPE),"unsupported public key type"}, 233{ERR_REASON(ASN1_R_UNSUPPORTED_PUBLIC_KEY_TYPE),"unsupported public key type"},
297{ERR_REASON(ASN1_R_UNSUPPORTED_TYPE) ,"unsupported type"},
298{ERR_REASON(ASN1_R_WRONG_TAG) ,"wrong tag"}, 234{ERR_REASON(ASN1_R_WRONG_TAG) ,"wrong tag"},
299{ERR_REASON(ASN1_R_WRONG_TYPE) ,"wrong type"}, 235{ERR_REASON(ASN1_R_WRONG_TYPE) ,"wrong type"},
300{0,NULL} 236{0,NULL}
@@ -304,12 +240,15 @@ static ERR_STRING_DATA ASN1_str_reasons[]=
304 240
305void ERR_load_ASN1_strings(void) 241void ERR_load_ASN1_strings(void)
306 { 242 {
307#ifndef OPENSSL_NO_ERR 243 static int init=1;
308 244
309 if (ERR_func_error_string(ASN1_str_functs[0].error) == NULL) 245 if (init)
310 { 246 {
247 init=0;
248#ifndef OPENSSL_NO_ERR
311 ERR_load_strings(0,ASN1_str_functs); 249 ERR_load_strings(0,ASN1_str_functs);
312 ERR_load_strings(0,ASN1_str_reasons); 250 ERR_load_strings(0,ASN1_str_reasons);
313 }
314#endif 251#endif
252
253 }
315 } 254 }
diff --git a/src/lib/libcrypto/asn1/asn1_lib.c b/src/lib/libcrypto/asn1/asn1_lib.c
index 5af559ef8d..97b9b35f4b 100644
--- a/src/lib/libcrypto/asn1/asn1_lib.c
+++ b/src/lib/libcrypto/asn1/asn1_lib.c
@@ -62,11 +62,11 @@
62#include <openssl/asn1.h> 62#include <openssl/asn1.h>
63#include <openssl/asn1_mac.h> 63#include <openssl/asn1_mac.h>
64 64
65static int asn1_get_length(const unsigned char **pp,int *inf,long *rl,int max); 65static int asn1_get_length(unsigned char **pp,int *inf,long *rl,int max);
66static void asn1_put_length(unsigned char **pp, int length); 66static void asn1_put_length(unsigned char **pp, int length);
67const char ASN1_version[]="ASN.1" OPENSSL_VERSION_PTEXT; 67const char *ASN1_version="ASN.1" OPENSSL_VERSION_PTEXT;
68 68
69static int _asn1_check_infinite_end(const unsigned char **p, long len) 69int ASN1_check_infinite_end(unsigned char **p, long len)
70 { 70 {
71 /* If there is 0 or 1 byte left, the length check should pick 71 /* If there is 0 or 1 byte left, the length check should pick
72 * things up */ 72 * things up */
@@ -80,23 +80,13 @@ static int _asn1_check_infinite_end(const unsigned char **p, long len)
80 return(0); 80 return(0);
81 } 81 }
82 82
83int ASN1_check_infinite_end(unsigned char **p, long len)
84 {
85 return _asn1_check_infinite_end((const unsigned char **)p, len);
86 }
87 83
88int ASN1_const_check_infinite_end(const unsigned char **p, long len) 84int ASN1_get_object(unsigned char **pp, long *plength, int *ptag, int *pclass,
89 { 85 long omax)
90 return _asn1_check_infinite_end(p, len);
91 }
92
93
94int ASN1_get_object(const unsigned char **pp, long *plength, int *ptag,
95 int *pclass, long omax)
96 { 86 {
97 int i,ret; 87 int i,ret;
98 long l; 88 long l;
99 const unsigned char *p= *pp; 89 unsigned char *p= *pp;
100 int tag,xclass,inf; 90 int tag,xclass,inf;
101 long max=omax; 91 long max=omax;
102 92
@@ -151,11 +141,11 @@ err:
151 return(0x80); 141 return(0x80);
152 } 142 }
153 143
154static int asn1_get_length(const unsigned char **pp, int *inf, long *rl, int max) 144static int asn1_get_length(unsigned char **pp, int *inf, long *rl, int max)
155 { 145 {
156 const unsigned char *p= *pp; 146 unsigned char *p= *pp;
157 unsigned long ret=0; 147 unsigned long ret=0;
158 unsigned int i; 148 int i;
159 149
160 if (max-- < 1) return(0); 150 if (max-- < 1) return(0);
161 if (*p == 0x80) 151 if (*p == 0x80)
@@ -215,22 +205,13 @@ void ASN1_put_object(unsigned char **pp, int constructed, int length, int tag,
215 } 205 }
216 p += ttag; 206 p += ttag;
217 } 207 }
218 if (constructed == 2) 208 if ((constructed == 2) && (length == 0))
219 *(p++)=0x80; 209 *(p++)=0x80; /* der_put_length would output 0 instead */
220 else 210 else
221 asn1_put_length(&p,length); 211 asn1_put_length(&p,length);
222 *pp=p; 212 *pp=p;
223 } 213 }
224 214
225int ASN1_put_eoc(unsigned char **pp)
226 {
227 unsigned char *p = *pp;
228 *p++ = 0;
229 *p++ = 0;
230 *pp = p;
231 return 2;
232 }
233
234static void asn1_put_length(unsigned char **pp, int length) 215static void asn1_put_length(unsigned char **pp, int length)
235 { 216 {
236 unsigned char *p= *pp; 217 unsigned char *p= *pp;
@@ -268,8 +249,8 @@ int ASN1_object_size(int constructed, int length, int tag)
268 ret++; 249 ret++;
269 } 250 }
270 } 251 }
271 if (constructed == 2) 252 if ((length == 0) && (constructed == 2))
272 return ret + 3; 253 ret+=2;
273 ret++; 254 ret++;
274 if (length > 127) 255 if (length > 127)
275 { 256 {
@@ -282,11 +263,11 @@ int ASN1_object_size(int constructed, int length, int tag)
282 return(ret); 263 return(ret);
283 } 264 }
284 265
285static int _asn1_Finish(ASN1_const_CTX *c) 266int asn1_Finish(ASN1_CTX *c)
286 { 267 {
287 if ((c->inf == (1|V_ASN1_CONSTRUCTED)) && (!c->eos)) 268 if ((c->inf == (1|V_ASN1_CONSTRUCTED)) && (!c->eos))
288 { 269 {
289 if (!ASN1_const_check_infinite_end(&c->p,c->slen)) 270 if (!ASN1_check_infinite_end(&c->p,c->slen))
290 { 271 {
291 c->error=ERR_R_MISSING_ASN1_EOS; 272 c->error=ERR_R_MISSING_ASN1_EOS;
292 return(0); 273 return(0);
@@ -301,19 +282,9 @@ static int _asn1_Finish(ASN1_const_CTX *c)
301 return(1); 282 return(1);
302 } 283 }
303 284
304int asn1_Finish(ASN1_CTX *c) 285int asn1_GetSequence(ASN1_CTX *c, long *length)
305 {
306 return _asn1_Finish((ASN1_const_CTX *)c);
307 }
308
309int asn1_const_Finish(ASN1_const_CTX *c)
310 { 286 {
311 return _asn1_Finish(c); 287 unsigned char *q;
312 }
313
314int asn1_GetSequence(ASN1_const_CTX *c, long *length)
315 {
316 const unsigned char *q;
317 288
318 q=c->p; 289 q=c->p;
319 c->inf=ASN1_get_object(&(c->p),&(c->slen),&(c->tag),&(c->xclass), 290 c->inf=ASN1_get_object(&(c->p),&(c->slen),&(c->tag),&(c->xclass),
@@ -393,14 +364,6 @@ int ASN1_STRING_set(ASN1_STRING *str, const void *_data, int len)
393 return(1); 364 return(1);
394 } 365 }
395 366
396void ASN1_STRING_set0(ASN1_STRING *str, void *data, int len)
397 {
398 if (str->data)
399 OPENSSL_free(str->data);
400 str->data = data;
401 str->length = len;
402 }
403
404ASN1_STRING *ASN1_STRING_new(void) 367ASN1_STRING *ASN1_STRING_new(void)
405 { 368 {
406 return(ASN1_STRING_type_new(V_ASN1_OCTET_STRING)); 369 return(ASN1_STRING_type_new(V_ASN1_OCTET_STRING));
@@ -448,7 +411,7 @@ int ASN1_STRING_cmp(ASN1_STRING *a, ASN1_STRING *b)
448 return(i); 411 return(i);
449 } 412 }
450 413
451void asn1_add_error(const unsigned char *address, int offset) 414void asn1_add_error(unsigned char *address, int offset)
452 { 415 {
453 char buf1[DECIMAL_SIZE(address)+1],buf2[DECIMAL_SIZE(offset)+1]; 416 char buf1[DECIMAL_SIZE(address)+1],buf2[DECIMAL_SIZE(offset)+1];
454 417
diff --git a/src/lib/libcrypto/asn1/asn1_mac.h b/src/lib/libcrypto/asn1/asn1_mac.h
index d958ca60d9..a48649ceeb 100644
--- a/src/lib/libcrypto/asn1/asn1_mac.h
+++ b/src/lib/libcrypto/asn1/asn1_mac.h
@@ -73,11 +73,11 @@ extern "C" {
73 ERR_PUT_error(ASN1_MAC_ERR_LIB,(f),(r),__FILE__,(line)) 73 ERR_PUT_error(ASN1_MAC_ERR_LIB,(f),(r),__FILE__,(line))
74 74
75#define M_ASN1_D2I_vars(a,type,func) \ 75#define M_ASN1_D2I_vars(a,type,func) \
76 ASN1_const_CTX c; \ 76 ASN1_CTX c; \
77 type ret=NULL; \ 77 type ret=NULL; \
78 \ 78 \
79 c.pp=(const unsigned char **)pp; \ 79 c.pp=(unsigned char **)pp; \
80 c.q= *(const unsigned char **)pp; \ 80 c.q= *(unsigned char **)pp; \
81 c.error=ERR_R_NESTED_ASN1_ERROR; \ 81 c.error=ERR_R_NESTED_ASN1_ERROR; \
82 if ((a == NULL) || ((*a) == NULL)) \ 82 if ((a == NULL) || ((*a) == NULL)) \
83 { if ((ret=(type)func()) == NULL) \ 83 { if ((ret=(type)func()) == NULL) \
@@ -85,13 +85,13 @@ extern "C" {
85 else ret=(*a); 85 else ret=(*a);
86 86
87#define M_ASN1_D2I_Init() \ 87#define M_ASN1_D2I_Init() \
88 c.p= *(const unsigned char **)pp; \ 88 c.p= *(unsigned char **)pp; \
89 c.max=(length == 0)?0:(c.p+length); 89 c.max=(length == 0)?0:(c.p+length);
90 90
91#define M_ASN1_D2I_Finish_2(a) \ 91#define M_ASN1_D2I_Finish_2(a) \
92 if (!asn1_const_Finish(&c)) \ 92 if (!asn1_Finish(&c)) \
93 { c.line=__LINE__; goto err; } \ 93 { c.line=__LINE__; goto err; } \
94 *(const unsigned char **)pp=c.p; \ 94 *(unsigned char **)pp=c.p; \
95 if (a != NULL) (*a)=ret; \ 95 if (a != NULL) (*a)=ret; \
96 return(ret); 96 return(ret);
97 97
@@ -99,7 +99,7 @@ extern "C" {
99 M_ASN1_D2I_Finish_2(a); \ 99 M_ASN1_D2I_Finish_2(a); \
100err:\ 100err:\
101 ASN1_MAC_H_err((e),c.error,c.line); \ 101 ASN1_MAC_H_err((e),c.error,c.line); \
102 asn1_add_error(*(const unsigned char **)pp,(int)(c.q- *pp)); \ 102 asn1_add_error(*(unsigned char **)pp,(int)(c.q- *pp)); \
103 if ((ret != NULL) && ((a == NULL) || (*a != ret))) func(ret); \ 103 if ((ret != NULL) && ((a == NULL) || (*a != ret))) func(ret); \
104 return(NULL) 104 return(NULL)
105 105
@@ -123,22 +123,15 @@ err:\
123 123
124#define M_ASN1_D2I_end_sequence() \ 124#define M_ASN1_D2I_end_sequence() \
125 (((c.inf&1) == 0)?(c.slen <= 0): \ 125 (((c.inf&1) == 0)?(c.slen <= 0): \
126 (c.eos=ASN1_const_check_infinite_end(&c.p,c.slen))) 126 (c.eos=ASN1_check_infinite_end(&c.p,c.slen)))
127 127
128/* Don't use this with d2i_ASN1_BOOLEAN() */ 128/* Don't use this with d2i_ASN1_BOOLEAN() */
129#define M_ASN1_D2I_get(b, func) \ 129#define M_ASN1_D2I_get(b,func) \
130 c.q=c.p; \ 130 c.q=c.p; \
131 if (func(&(b),&c.p,c.slen) == NULL) \ 131 if (func(&(b),&c.p,c.slen) == NULL) \
132 {c.line=__LINE__; goto err; } \ 132 {c.line=__LINE__; goto err; } \
133 c.slen-=(c.p-c.q); 133 c.slen-=(c.p-c.q);
134 134
135/* Don't use this with d2i_ASN1_BOOLEAN() */
136#define M_ASN1_D2I_get_x(type,b,func) \
137 c.q=c.p; \
138 if (((D2I_OF(type))func)(&(b),&c.p,c.slen) == NULL) \
139 {c.line=__LINE__; goto err; } \
140 c.slen-=(c.p-c.q);
141
142/* use this instead () */ 135/* use this instead () */
143#define M_ASN1_D2I_get_int(b,func) \ 136#define M_ASN1_D2I_get_int(b,func) \
144 c.q=c.p; \ 137 c.q=c.p; \
@@ -285,7 +278,7 @@ err:\
285 { c.line=__LINE__; goto err; } \ 278 { c.line=__LINE__; goto err; } \
286 if (Tinf == (V_ASN1_CONSTRUCTED+1)) { \ 279 if (Tinf == (V_ASN1_CONSTRUCTED+1)) { \
287 Tlen = c.slen - (c.p - c.q); \ 280 Tlen = c.slen - (c.p - c.q); \
288 if(!ASN1_const_check_infinite_end(&c.p, Tlen)) \ 281 if(!ASN1_check_infinite_end(&c.p, Tlen)) \
289 { c.error=ERR_R_MISSING_ASN1_EOS; \ 282 { c.error=ERR_R_MISSING_ASN1_EOS; \
290 c.line=__LINE__; goto err; } \ 283 c.line=__LINE__; goto err; } \
291 }\ 284 }\
@@ -360,12 +353,8 @@ err:\
360 return(NULL) 353 return(NULL)
361 354
362 355
363/* BIG UGLY WARNING! This is so damn ugly I wanna puke. Unfortunately, 356#define M_ASN1_next (*c.p)
364 some macros that use ASN1_const_CTX still insist on writing in the input 357#define M_ASN1_next_prev (*c.q)
365 stream. ARGH! ARGH! ARGH! Let's get rid of this macro package.
366 Please? -- Richard Levitte */
367#define M_ASN1_next (*((unsigned char *)(c.p)))
368#define M_ASN1_next_prev (*((unsigned char *)(c.q)))
369 358
370/*************************************************/ 359/*************************************************/
371 360
@@ -562,8 +551,8 @@ err:\
562#define M_ASN1_I2D_finish() *pp=p; \ 551#define M_ASN1_I2D_finish() *pp=p; \
563 return(r); 552 return(r);
564 553
565int asn1_GetSequence(ASN1_const_CTX *c, long *length); 554int asn1_GetSequence(ASN1_CTX *c, long *length);
566void asn1_add_error(const unsigned char *address,int offset); 555void asn1_add_error(unsigned char *address,int offset);
567#ifdef __cplusplus 556#ifdef __cplusplus
568} 557}
569#endif 558#endif
diff --git a/src/lib/libcrypto/asn1/asn1_par.c b/src/lib/libcrypto/asn1/asn1_par.c
index 501b62a4b1..676d434f03 100644
--- a/src/lib/libcrypto/asn1/asn1_par.c
+++ b/src/lib/libcrypto/asn1/asn1_par.c
@@ -64,7 +64,7 @@
64 64
65static int asn1_print_info(BIO *bp, int tag, int xclass,int constructed, 65static int asn1_print_info(BIO *bp, int tag, int xclass,int constructed,
66 int indent); 66 int indent);
67static int asn1_parse2(BIO *bp, const unsigned char **pp, long length, 67static int asn1_parse2(BIO *bp, unsigned char **pp, long length,
68 int offset, int depth, int indent, int dump); 68 int offset, int depth, int indent, int dump);
69static int asn1_print_info(BIO *bp, int tag, int xclass, int constructed, 69static int asn1_print_info(BIO *bp, int tag, int xclass, int constructed,
70 int indent) 70 int indent)
@@ -88,10 +88,7 @@ static int asn1_print_info(BIO *bp, int tag, int xclass, int constructed,
88 BIO_snprintf(str,sizeof str,"cont [ %d ]",tag); 88 BIO_snprintf(str,sizeof str,"cont [ %d ]",tag);
89 else if ((xclass & V_ASN1_APPLICATION) == V_ASN1_APPLICATION) 89 else if ((xclass & V_ASN1_APPLICATION) == V_ASN1_APPLICATION)
90 BIO_snprintf(str,sizeof str,"appl [ %d ]",tag); 90 BIO_snprintf(str,sizeof str,"appl [ %d ]",tag);
91 else if (tag > 30) 91 else p = ASN1_tag2str(tag);
92 BIO_snprintf(str,sizeof str,"<ASN1 %d>",tag);
93 else
94 p = ASN1_tag2str(tag);
95 92
96 if (p2 != NULL) 93 if (p2 != NULL)
97 { 94 {
@@ -106,20 +103,20 @@ err:
106 return(0); 103 return(0);
107 } 104 }
108 105
109int ASN1_parse(BIO *bp, const unsigned char *pp, long len, int indent) 106int ASN1_parse(BIO *bp, unsigned char *pp, long len, int indent)
110 { 107 {
111 return(asn1_parse2(bp,&pp,len,0,0,indent,0)); 108 return(asn1_parse2(bp,&pp,len,0,0,indent,0));
112 } 109 }
113 110
114int ASN1_parse_dump(BIO *bp, const unsigned char *pp, long len, int indent, int dump) 111int ASN1_parse_dump(BIO *bp, unsigned char *pp, long len, int indent, int dump)
115 { 112 {
116 return(asn1_parse2(bp,&pp,len,0,0,indent,dump)); 113 return(asn1_parse2(bp,&pp,len,0,0,indent,dump));
117 } 114 }
118 115
119static int asn1_parse2(BIO *bp, const unsigned char **pp, long length, int offset, 116static int asn1_parse2(BIO *bp, unsigned char **pp, long length, int offset,
120 int depth, int indent, int dump) 117 int depth, int indent, int dump)
121 { 118 {
122 const unsigned char *p,*ep,*tot,*op,*opp; 119 unsigned char *p,*ep,*tot,*op,*opp;
123 long len; 120 long len;
124 int tag,xclass,ret=0; 121 int tag,xclass,ret=0;
125 int nl,hl,j,r; 122 int nl,hl,j,r;
@@ -218,7 +215,7 @@ static int asn1_parse2(BIO *bp, const unsigned char **pp, long length, int offse
218 { 215 {
219 if (BIO_write(bp,":",1) <= 0) goto end; 216 if (BIO_write(bp,":",1) <= 0) goto end;
220 if ((len > 0) && 217 if ((len > 0) &&
221 BIO_write(bp,(const char *)p,(int)len) 218 BIO_write(bp,(char *)p,(int)len)
222 != (int)len) 219 != (int)len)
223 goto end; 220 goto end;
224 } 221 }
@@ -259,11 +256,9 @@ static int asn1_parse2(BIO *bp, const unsigned char **pp, long length, int offse
259 256
260 opp=op; 257 opp=op;
261 os=d2i_ASN1_OCTET_STRING(NULL,&opp,len+hl); 258 os=d2i_ASN1_OCTET_STRING(NULL,&opp,len+hl);
262 if (os != NULL && os->length > 0) 259 if (os != NULL)
263 { 260 {
264 opp = os->data; 261 opp=os->data;
265 /* testing whether the octet string is
266 * printable */
267 for (i=0; i<os->length; i++) 262 for (i=0; i<os->length; i++)
268 { 263 {
269 if (( (opp[i] < ' ') && 264 if (( (opp[i] < ' ') &&
@@ -276,47 +271,28 @@ static int asn1_parse2(BIO *bp, const unsigned char **pp, long length, int offse
276 break; 271 break;
277 } 272 }
278 } 273 }
279 if (printable) 274 if (printable && (os->length > 0))
280 /* printable string */
281 { 275 {
282 if (BIO_write(bp,":",1) <= 0) 276 if (BIO_write(bp,":",1) <= 0)
283 goto end; 277 goto end;
284 if (BIO_write(bp,(const char *)opp, 278 if (BIO_write(bp,(char *)opp,
285 os->length) <= 0) 279 os->length) <= 0)
286 goto end; 280 goto end;
287 } 281 }
288 else if (!dump) 282 if (!printable && (os->length > 0)
289 /* not printable => print octet string 283 && dump)
290 * as hex dump */
291 {
292 if (BIO_write(bp,"[HEX DUMP]:",11) <= 0)
293 goto end;
294 for (i=0; i<os->length; i++)
295 {
296 if (BIO_printf(bp,"%02X"
297 , opp[i]) <= 0)
298 goto end;
299 }
300 }
301 else
302 /* print the normal dump */
303 { 284 {
304 if (!nl) 285 if (!nl)
305 { 286 {
306 if (BIO_write(bp,"\n",1) <= 0) 287 if (BIO_write(bp,"\n",1) <= 0)
307 goto end; 288 goto end;
308 } 289 }
309 if (BIO_dump_indent(bp, 290 if (BIO_dump_indent(bp,(char *)opp,
310 (const char *)opp, 291 ((dump == -1 || dump > os->length)?os->length:dump),
311 ((dump == -1 || dump >
312 os->length)?os->length:dump),
313 dump_indent) <= 0) 292 dump_indent) <= 0)
314 goto end; 293 goto end;
315 nl=1; 294 nl=1;
316 } 295 }
317 }
318 if (os != NULL)
319 {
320 M_ASN1_OCTET_STRING_free(os); 296 M_ASN1_OCTET_STRING_free(os);
321 os=NULL; 297 os=NULL;
322 } 298 }
@@ -392,7 +368,7 @@ static int asn1_parse2(BIO *bp, const unsigned char **pp, long length, int offse
392 if (BIO_write(bp,"\n",1) <= 0) 368 if (BIO_write(bp,"\n",1) <= 0)
393 goto end; 369 goto end;
394 } 370 }
395 if (BIO_dump_indent(bp,(const char *)p, 371 if (BIO_dump_indent(bp,(char *)p,
396 ((dump == -1 || dump > len)?len:dump), 372 ((dump == -1 || dump > len)?len:dump),
397 dump_indent) <= 0) 373 dump_indent) <= 0)
398 goto end; 374 goto end;
@@ -422,7 +398,7 @@ end:
422 398
423const char *ASN1_tag2str(int tag) 399const char *ASN1_tag2str(int tag)
424{ 400{
425 static const char *tag2str[] = { 401 const static char *tag2str[] = {
426 "EOC", "BOOLEAN", "INTEGER", "BIT STRING", "OCTET STRING", /* 0-4 */ 402 "EOC", "BOOLEAN", "INTEGER", "BIT STRING", "OCTET STRING", /* 0-4 */
427 "NULL", "OBJECT", "OBJECT DESCRIPTOR", "EXTERNAL", "REAL", /* 5-9 */ 403 "NULL", "OBJECT", "OBJECT DESCRIPTOR", "EXTERNAL", "REAL", /* 5-9 */
428 "ENUMERATED", "<ASN1 11>", "UTF8STRING", "<ASN1 13>", /* 10-13 */ 404 "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 bf315e65ed..ed372f8554 100644
--- a/src/lib/libcrypto/asn1/asn1t.h
+++ b/src/lib/libcrypto/asn1/asn1t.h
@@ -99,7 +99,7 @@ extern "C" {
99#define ASN1_ITEM_start(itname) \ 99#define ASN1_ITEM_start(itname) \
100 const ASN1_ITEM * itname##_it(void) \ 100 const ASN1_ITEM * itname##_it(void) \
101 { \ 101 { \
102 static const ASN1_ITEM local_it = { 102 static const ASN1_ITEM local_it = { \
103 103
104#define ASN1_ITEM_end(itname) \ 104#define ASN1_ITEM_end(itname) \
105 }; \ 105 }; \
@@ -112,7 +112,7 @@ extern "C" {
112/* Macros to aid ASN1 template writing */ 112/* Macros to aid ASN1 template writing */
113 113
114#define ASN1_ITEM_TEMPLATE(tname) \ 114#define ASN1_ITEM_TEMPLATE(tname) \
115 static const ASN1_TEMPLATE tname##_item_tt 115 const static ASN1_TEMPLATE tname##_item_tt
116 116
117#define ASN1_ITEM_TEMPLATE_END(tname) \ 117#define ASN1_ITEM_TEMPLATE_END(tname) \
118 ;\ 118 ;\
@@ -150,7 +150,7 @@ extern "C" {
150 */ 150 */
151 151
152#define ASN1_SEQUENCE(tname) \ 152#define ASN1_SEQUENCE(tname) \
153 static const ASN1_TEMPLATE tname##_seq_tt[] 153 const static ASN1_TEMPLATE tname##_seq_tt[]
154 154
155#define ASN1_SEQUENCE_END(stname) ASN1_SEQUENCE_END_name(stname, stname) 155#define ASN1_SEQUENCE_END(stname) ASN1_SEQUENCE_END_name(stname, stname)
156 156
@@ -166,40 +166,22 @@ extern "C" {
166 #stname \ 166 #stname \
167 ASN1_ITEM_end(tname) 167 ASN1_ITEM_end(tname)
168 168
169#define ASN1_NDEF_SEQUENCE(tname) \
170 ASN1_SEQUENCE(tname)
171
172#define ASN1_NDEF_SEQUENCE_cb(tname, cb) \
173 ASN1_SEQUENCE_cb(tname, cb)
174
175#define ASN1_SEQUENCE_cb(tname, cb) \ 169#define ASN1_SEQUENCE_cb(tname, cb) \
176 static const ASN1_AUX tname##_aux = {NULL, 0, 0, 0, cb, 0}; \ 170 const static ASN1_AUX tname##_aux = {NULL, 0, 0, 0, cb, 0}; \
177 ASN1_SEQUENCE(tname) 171 ASN1_SEQUENCE(tname)
178 172
179#define ASN1_BROKEN_SEQUENCE(tname) \ 173#define ASN1_BROKEN_SEQUENCE(tname) \
180 static const ASN1_AUX tname##_aux = {NULL, ASN1_AFLG_BROKEN, 0, 0, 0, 0}; \ 174 const static ASN1_AUX tname##_aux = {NULL, ASN1_AFLG_BROKEN, 0, 0, 0, 0}; \
181 ASN1_SEQUENCE(tname) 175 ASN1_SEQUENCE(tname)
182 176
183#define ASN1_SEQUENCE_ref(tname, cb, lck) \ 177#define ASN1_SEQUENCE_ref(tname, cb, lck) \
184 static const ASN1_AUX tname##_aux = {NULL, ASN1_AFLG_REFCOUNT, offsetof(tname, references), lck, cb, 0}; \ 178 const static ASN1_AUX tname##_aux = {NULL, ASN1_AFLG_REFCOUNT, offsetof(tname, references), lck, cb, 0}; \
185 ASN1_SEQUENCE(tname) 179 ASN1_SEQUENCE(tname)
186 180
187#define ASN1_SEQUENCE_enc(tname, enc, cb) \ 181#define ASN1_SEQUENCE_enc(tname, enc, cb) \
188 static const ASN1_AUX tname##_aux = {NULL, ASN1_AFLG_ENCODING, 0, 0, cb, offsetof(tname, enc)}; \ 182 const static ASN1_AUX tname##_aux = {NULL, ASN1_AFLG_ENCODING, 0, 0, cb, offsetof(tname, enc)}; \
189 ASN1_SEQUENCE(tname) 183 ASN1_SEQUENCE(tname)
190 184
191#define ASN1_NDEF_SEQUENCE_END(tname) \
192 ;\
193 ASN1_ITEM_start(tname) \
194 ASN1_ITYPE_NDEF_SEQUENCE,\
195 V_ASN1_SEQUENCE,\
196 tname##_seq_tt,\
197 sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\
198 NULL,\
199 sizeof(tname),\
200 #tname \
201 ASN1_ITEM_end(tname)
202
203#define ASN1_BROKEN_SEQUENCE_END(stname) ASN1_SEQUENCE_END_ref(stname, stname) 185#define ASN1_BROKEN_SEQUENCE_END(stname) ASN1_SEQUENCE_END_ref(stname, stname)
204 186
205#define ASN1_SEQUENCE_END_enc(stname, tname) ASN1_SEQUENCE_END_ref(stname, tname) 187#define ASN1_SEQUENCE_END_enc(stname, tname) ASN1_SEQUENCE_END_ref(stname, tname)
@@ -242,10 +224,10 @@ extern "C" {
242 */ 224 */
243 225
244#define ASN1_CHOICE(tname) \ 226#define ASN1_CHOICE(tname) \
245 static const ASN1_TEMPLATE tname##_ch_tt[] 227 const static ASN1_TEMPLATE tname##_ch_tt[]
246 228
247#define ASN1_CHOICE_cb(tname, cb) \ 229#define ASN1_CHOICE_cb(tname, cb) \
248 static const ASN1_AUX tname##_aux = {NULL, 0, 0, 0, cb, 0}; \ 230 const static ASN1_AUX tname##_aux = {NULL, 0, 0, 0, cb, 0}; \
249 ASN1_CHOICE(tname) 231 ASN1_CHOICE(tname)
250 232
251#define ASN1_CHOICE_END(stname) ASN1_CHOICE_END_name(stname, stname) 233#define ASN1_CHOICE_END(stname) ASN1_CHOICE_END_name(stname, stname)
@@ -371,24 +353,16 @@ extern "C" {
371#define ASN1_EXP_SEQUENCE_OF_OPT(stname, field, type, tag) \ 353#define ASN1_EXP_SEQUENCE_OF_OPT(stname, field, type, tag) \
372 ASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_SEQUENCE_OF|ASN1_TFLG_OPTIONAL) 354 ASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_SEQUENCE_OF|ASN1_TFLG_OPTIONAL)
373 355
374/* EXPLICIT using indefinite length constructed form */
375#define ASN1_NDEF_EXP(stname, field, type, tag) \
376 ASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_NDEF)
377
378/* EXPLICIT OPTIONAL using indefinite length constructed form */
379#define ASN1_NDEF_EXP_OPT(stname, field, type, tag) \
380 ASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_OPTIONAL|ASN1_TFLG_NDEF)
381
382/* Macros for the ASN1_ADB structure */ 356/* Macros for the ASN1_ADB structure */
383 357
384#define ASN1_ADB(name) \ 358#define ASN1_ADB(name) \
385 static const ASN1_ADB_TABLE name##_adbtbl[] 359 const static ASN1_ADB_TABLE name##_adbtbl[]
386 360
387#ifndef OPENSSL_EXPORT_VAR_AS_FUNCTION 361#ifndef OPENSSL_EXPORT_VAR_AS_FUNCTION
388 362
389#define ASN1_ADB_END(name, flags, field, app_table, def, none) \ 363#define ASN1_ADB_END(name, flags, field, app_table, def, none) \
390 ;\ 364 ;\
391 static const ASN1_ADB name##_adb = {\ 365 const static ASN1_ADB name##_adb = {\
392 flags,\ 366 flags,\
393 offsetof(name, field),\ 367 offsetof(name, field),\
394 app_table,\ 368 app_table,\
@@ -402,9 +376,9 @@ extern "C" {
402 376
403#define ASN1_ADB_END(name, flags, field, app_table, def, none) \ 377#define ASN1_ADB_END(name, flags, field, app_table, def, none) \
404 ;\ 378 ;\
405 static const ASN1_ITEM *name##_adb(void) \ 379 const static ASN1_ITEM *name##_adb(void) \
406 { \ 380 { \
407 static const ASN1_ADB internal_adb = \ 381 const static ASN1_ADB internal_adb = \
408 {\ 382 {\
409 flags,\ 383 flags,\
410 offsetof(name, field),\ 384 offsetof(name, field),\
@@ -423,7 +397,7 @@ extern "C" {
423#define ADB_ENTRY(val, template) {val, template} 397#define ADB_ENTRY(val, template) {val, template}
424 398
425#define ASN1_ADB_TEMPLATE(name) \ 399#define ASN1_ADB_TEMPLATE(name) \
426 static const ASN1_TEMPLATE name##_tt 400 const static ASN1_TEMPLATE name##_tt
427 401
428/* This is the ASN1 template structure that defines 402/* This is the ASN1 template structure that defines
429 * a wrapper round the actual type. It determines the 403 * a wrapper round the actual type. It determines the
@@ -436,7 +410,7 @@ unsigned long flags; /* Various flags */
436long tag; /* tag, not used if no tagging */ 410long tag; /* tag, not used if no tagging */
437unsigned long offset; /* Offset of this field in structure */ 411unsigned long offset; /* Offset of this field in structure */
438#ifndef NO_ASN1_FIELD_NAMES 412#ifndef NO_ASN1_FIELD_NAMES
439const char *field_name; /* Field name */ 413char *field_name; /* Field name */
440#endif 414#endif
441ASN1_ITEM_EXP *item; /* Relevant ASN1_ITEM or ASN1_ADB */ 415ASN1_ITEM_EXP *item; /* Relevant ASN1_ITEM or ASN1_ADB */
442}; 416};
@@ -544,13 +518,6 @@ struct ASN1_ADB_TABLE_st {
544 518
545#define ASN1_TFLG_COMBINE (0x1<<10) 519#define ASN1_TFLG_COMBINE (0x1<<10)
546 520
547/* This flag when present in a SEQUENCE OF, SET OF
548 * or EXPLICIT causes indefinite length constructed
549 * encoding to be used if required.
550 */
551
552#define ASN1_TFLG_NDEF (0x1<<11)
553
554/* This is the actual ASN1 item itself */ 521/* This is the actual ASN1 item itself */
555 522
556struct ASN1_ITEM_st { 523struct ASN1_ITEM_st {
@@ -603,25 +570,19 @@ const char *sname; /* Structure name */
603 * has a special meaning, it is used as a mask 570 * has a special meaning, it is used as a mask
604 * of acceptable types using the B_ASN1 constants. 571 * of acceptable types using the B_ASN1 constants.
605 * 572 *
606 * NDEF_SEQUENCE is the same as SEQUENCE except
607 * that it will use indefinite length constructed
608 * encoding if requested.
609 *
610 */ 573 */
611 574
612#define ASN1_ITYPE_PRIMITIVE 0x0 575#define ASN1_ITYPE_PRIMITIVE 0x0
613
614#define ASN1_ITYPE_SEQUENCE 0x1
615 576
616#define ASN1_ITYPE_CHOICE 0x2 577#define ASN1_ITYPE_SEQUENCE 0x1
617 578
618#define ASN1_ITYPE_COMPAT 0x3 579#define ASN1_ITYPE_CHOICE 0x2
619 580
620#define ASN1_ITYPE_EXTERN 0x4 581#define ASN1_ITYPE_COMPAT 0x3
621 582
622#define ASN1_ITYPE_MSTRING 0x5 583#define ASN1_ITYPE_EXTERN 0x4
623 584
624#define ASN1_ITYPE_NDEF_SEQUENCE 0x6 585#define ASN1_ITYPE_MSTRING 0x5
625 586
626/* Cache for ASN1 tag and length, so we 587/* Cache for ASN1 tag and length, so we
627 * don't keep re-reading it for things 588 * don't keep re-reading it for things
@@ -641,10 +602,10 @@ struct ASN1_TLC_st{
641 602
642typedef ASN1_VALUE * ASN1_new_func(void); 603typedef ASN1_VALUE * ASN1_new_func(void);
643typedef void ASN1_free_func(ASN1_VALUE *a); 604typedef void ASN1_free_func(ASN1_VALUE *a);
644typedef ASN1_VALUE * ASN1_d2i_func(ASN1_VALUE **a, const unsigned char ** in, long length); 605typedef ASN1_VALUE * ASN1_d2i_func(ASN1_VALUE **a, unsigned char ** in, long length);
645typedef int ASN1_i2d_func(ASN1_VALUE * a, unsigned char **in); 606typedef int ASN1_i2d_func(ASN1_VALUE * a, unsigned char **in);
646 607
647typedef int ASN1_ex_d2i(ASN1_VALUE **pval, const unsigned char **in, long len, const ASN1_ITEM *it, 608typedef int ASN1_ex_d2i(ASN1_VALUE **pval, unsigned char **in, long len, const ASN1_ITEM *it,
648 int tag, int aclass, char opt, ASN1_TLC *ctx); 609 int tag, int aclass, char opt, ASN1_TLC *ctx);
649 610
650typedef int ASN1_ex_i2d(ASN1_VALUE **pval, unsigned char **out, const ASN1_ITEM *it, int tag, int aclass); 611typedef int ASN1_ex_i2d(ASN1_VALUE **pval, unsigned char **out, const ASN1_ITEM *it, int tag, int aclass);
@@ -652,7 +613,7 @@ typedef 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); 613typedef void ASN1_ex_free_func(ASN1_VALUE **pval, const ASN1_ITEM *it);
653 614
654typedef int ASN1_primitive_i2c(ASN1_VALUE **pval, unsigned char *cont, int *putype, const ASN1_ITEM *it); 615typedef 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); 616typedef int ASN1_primitive_c2i(ASN1_VALUE **pval, unsigned char *cont, int len, int utype, char *free_cont, const ASN1_ITEM *it);
656 617
657typedef struct ASN1_COMPAT_FUNCS_st { 618typedef struct ASN1_COMPAT_FUNCS_st {
658 ASN1_new_func *asn1_new; 619 ASN1_new_func *asn1_new;
@@ -782,9 +743,6 @@ typedef struct ASN1_AUX_st {
782#define IMPLEMENT_ASN1_FUNCTIONS_ENCODE_name(stname, itname) \ 743#define IMPLEMENT_ASN1_FUNCTIONS_ENCODE_name(stname, itname) \
783 IMPLEMENT_ASN1_FUNCTIONS_ENCODE_fname(stname, itname, itname) 744 IMPLEMENT_ASN1_FUNCTIONS_ENCODE_fname(stname, itname, itname)
784 745
785#define IMPLEMENT_ASN1_ALLOC_FUNCTIONS(stname) \
786 IMPLEMENT_ASN1_ALLOC_FUNCTIONS_fname(stname, stname, stname)
787
788#define IMPLEMENT_ASN1_ALLOC_FUNCTIONS_fname(stname, itname, fname) \ 746#define IMPLEMENT_ASN1_ALLOC_FUNCTIONS_fname(stname, itname, fname) \
789 stname *fname##_new(void) \ 747 stname *fname##_new(void) \
790 { \ 748 { \
@@ -800,7 +758,7 @@ typedef struct ASN1_AUX_st {
800 IMPLEMENT_ASN1_ALLOC_FUNCTIONS_fname(stname, itname, fname) 758 IMPLEMENT_ASN1_ALLOC_FUNCTIONS_fname(stname, itname, fname)
801 759
802#define IMPLEMENT_ASN1_ENCODE_FUNCTIONS_fname(stname, itname, fname) \ 760#define IMPLEMENT_ASN1_ENCODE_FUNCTIONS_fname(stname, itname, fname) \
803 stname *d2i_##fname(stname **a, const unsigned char **in, long len) \ 761 stname *d2i_##fname(stname **a, unsigned char **in, long len) \
804 { \ 762 { \
805 return (stname *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, ASN1_ITEM_rptr(itname));\ 763 return (stname *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, ASN1_ITEM_rptr(itname));\
806 } \ 764 } \
@@ -809,19 +767,13 @@ typedef struct ASN1_AUX_st {
809 return ASN1_item_i2d((ASN1_VALUE *)a, out, ASN1_ITEM_rptr(itname));\ 767 return ASN1_item_i2d((ASN1_VALUE *)a, out, ASN1_ITEM_rptr(itname));\
810 } 768 }
811 769
812#define IMPLEMENT_ASN1_NDEF_FUNCTION(stname) \
813 int i2d_##stname##_NDEF(stname *a, unsigned char **out) \
814 { \
815 return ASN1_item_ndef_i2d((ASN1_VALUE *)a, out, ASN1_ITEM_rptr(stname));\
816 }
817
818/* This includes evil casts to remove const: they will go away when full 770/* This includes evil casts to remove const: they will go away when full
819 * ASN1 constification is done. 771 * ASN1 constification is done.
820 */ 772 */
821#define IMPLEMENT_ASN1_ENCODE_FUNCTIONS_const_fname(stname, itname, fname) \ 773#define IMPLEMENT_ASN1_ENCODE_FUNCTIONS_const_fname(stname, itname, fname) \
822 stname *d2i_##fname(stname **a, const unsigned char **in, long len) \ 774 stname *d2i_##fname(stname **a, const unsigned char **in, long len) \
823 { \ 775 { \
824 return (stname *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, ASN1_ITEM_rptr(itname));\ 776 return (stname *)ASN1_item_d2i((ASN1_VALUE **)a, (unsigned char **)in, len, ASN1_ITEM_rptr(itname));\
825 } \ 777 } \
826 int i2d_##fname(const stname *a, unsigned char **out) \ 778 int i2d_##fname(const stname *a, unsigned char **out) \
827 { \ 779 { \
@@ -846,6 +798,7 @@ typedef struct ASN1_AUX_st {
846DECLARE_ASN1_ITEM(ASN1_BOOLEAN) 798DECLARE_ASN1_ITEM(ASN1_BOOLEAN)
847DECLARE_ASN1_ITEM(ASN1_TBOOLEAN) 799DECLARE_ASN1_ITEM(ASN1_TBOOLEAN)
848DECLARE_ASN1_ITEM(ASN1_FBOOLEAN) 800DECLARE_ASN1_ITEM(ASN1_FBOOLEAN)
801DECLARE_ASN1_ITEM(ASN1_ANY)
849DECLARE_ASN1_ITEM(ASN1_SEQUENCE) 802DECLARE_ASN1_ITEM(ASN1_SEQUENCE)
850DECLARE_ASN1_ITEM(CBIGNUM) 803DECLARE_ASN1_ITEM(CBIGNUM)
851DECLARE_ASN1_ITEM(BIGNUM) 804DECLARE_ASN1_ITEM(BIGNUM)
@@ -862,8 +815,8 @@ int ASN1_template_new(ASN1_VALUE **pval, const ASN1_TEMPLATE *tt);
862int ASN1_primitive_new(ASN1_VALUE **pval, const ASN1_ITEM *it); 815int ASN1_primitive_new(ASN1_VALUE **pval, const ASN1_ITEM *it);
863 816
864void ASN1_template_free(ASN1_VALUE **pval, const ASN1_TEMPLATE *tt); 817void ASN1_template_free(ASN1_VALUE **pval, const ASN1_TEMPLATE *tt);
865int ASN1_template_d2i(ASN1_VALUE **pval, const unsigned char **in, long len, const ASN1_TEMPLATE *tt); 818int ASN1_template_d2i(ASN1_VALUE **pval, unsigned char **in, long len, const ASN1_TEMPLATE *tt);
866int ASN1_item_ex_d2i(ASN1_VALUE **pval, const unsigned char **in, long len, const ASN1_ITEM *it, 819int ASN1_item_ex_d2i(ASN1_VALUE **pval, unsigned char **in, long len, const ASN1_ITEM *it,
867 int tag, int aclass, char opt, ASN1_TLC *ctx); 820 int tag, int aclass, char opt, ASN1_TLC *ctx);
868 821
869int ASN1_item_ex_i2d(ASN1_VALUE **pval, unsigned char **out, const ASN1_ITEM *it, int tag, int aclass); 822int ASN1_item_ex_i2d(ASN1_VALUE **pval, unsigned char **out, const ASN1_ITEM *it, int tag, int aclass);
@@ -871,7 +824,7 @@ int ASN1_template_i2d(ASN1_VALUE **pval, unsigned char **out, const ASN1_TEMPLAT
871void ASN1_primitive_free(ASN1_VALUE **pval, const ASN1_ITEM *it); 824void ASN1_primitive_free(ASN1_VALUE **pval, const ASN1_ITEM *it);
872 825
873int asn1_ex_i2c(ASN1_VALUE **pval, unsigned char *cont, int *putype, const ASN1_ITEM *it); 826int asn1_ex_i2c(ASN1_VALUE **pval, unsigned char *cont, int *putype, const ASN1_ITEM *it);
874int asn1_ex_c2i(ASN1_VALUE **pval, const unsigned char *cont, int len, int utype, char *free_cont, const ASN1_ITEM *it); 827int asn1_ex_c2i(ASN1_VALUE **pval, unsigned char *cont, int len, int utype, char *free_cont, const ASN1_ITEM *it);
875 828
876int asn1_get_choice_selector(ASN1_VALUE **pval, const ASN1_ITEM *it); 829int asn1_get_choice_selector(ASN1_VALUE **pval, const ASN1_ITEM *it);
877int asn1_set_choice_selector(ASN1_VALUE **pval, int value, const ASN1_ITEM *it); 830int asn1_set_choice_selector(ASN1_VALUE **pval, int value, const ASN1_ITEM *it);
@@ -885,7 +838,7 @@ int asn1_do_lock(ASN1_VALUE **pval, int op, const ASN1_ITEM *it);
885void asn1_enc_init(ASN1_VALUE **pval, const ASN1_ITEM *it); 838void asn1_enc_init(ASN1_VALUE **pval, const ASN1_ITEM *it);
886void asn1_enc_free(ASN1_VALUE **pval, const ASN1_ITEM *it); 839void asn1_enc_free(ASN1_VALUE **pval, const ASN1_ITEM *it);
887int asn1_enc_restore(int *len, unsigned char **out, ASN1_VALUE **pval, const ASN1_ITEM *it); 840int asn1_enc_restore(int *len, unsigned char **out, ASN1_VALUE **pval, const ASN1_ITEM *it);
888int asn1_enc_save(ASN1_VALUE **pval, const unsigned char *in, int inlen, const ASN1_ITEM *it); 841int asn1_enc_save(ASN1_VALUE **pval, unsigned char *in, int inlen, const ASN1_ITEM *it);
889 842
890#ifdef __cplusplus 843#ifdef __cplusplus
891} 844}
diff --git a/src/lib/libcrypto/asn1/asn_moid.c b/src/lib/libcrypto/asn1/asn_moid.c
index 9132350f10..edb44c988f 100644
--- a/src/lib/libcrypto/asn1/asn_moid.c
+++ b/src/lib/libcrypto/asn1/asn_moid.c
@@ -3,7 +3,7 @@
3 * project 2001. 3 * project 2001.
4 */ 4 */
5/* ==================================================================== 5/* ====================================================================
6 * Copyright (c) 2001-2004 The OpenSSL Project. All rights reserved. 6 * Copyright (c) 2001 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
@@ -57,7 +57,6 @@
57 */ 57 */
58 58
59#include <stdio.h> 59#include <stdio.h>
60#include <ctype.h>
61#include <openssl/crypto.h> 60#include <openssl/crypto.h>
62#include "cryptlib.h" 61#include "cryptlib.h"
63#include <openssl/conf.h> 62#include <openssl/conf.h>
@@ -66,8 +65,6 @@
66 65
67/* Simple ASN1 OID module: add all objects in a given section */ 66/* Simple ASN1 OID module: add all objects in a given section */
68 67
69static int do_create(char *value, char *name);
70
71static int oid_module_init(CONF_IMODULE *md, const CONF *cnf) 68static int oid_module_init(CONF_IMODULE *md, const CONF *cnf)
72 { 69 {
73 int i; 70 int i;
@@ -83,7 +80,7 @@ static int oid_module_init(CONF_IMODULE *md, const CONF *cnf)
83 for(i = 0; i < sk_CONF_VALUE_num(sktmp); i++) 80 for(i = 0; i < sk_CONF_VALUE_num(sktmp); i++)
84 { 81 {
85 oval = sk_CONF_VALUE_value(sktmp, i); 82 oval = sk_CONF_VALUE_value(sktmp, i);
86 if(!do_create(oval->value, oval->name)) 83 if(OBJ_create(oval->value, oval->name, oval->name) == NID_undef)
87 { 84 {
88 ASN1err(ASN1_F_OID_MODULE_INIT, ASN1_R_ADDING_OBJECT); 85 ASN1err(ASN1_F_OID_MODULE_INIT, ASN1_R_ADDING_OBJECT);
89 return 0; 86 return 0;
@@ -101,60 +98,3 @@ void ASN1_add_oid_module(void)
101 { 98 {
102 CONF_module_add("oid_section", oid_module_init, oid_module_finish); 99 CONF_module_add("oid_section", oid_module_init, oid_module_finish);
103 } 100 }
104
105/* Create an OID based on a name value pair. Accept two formats.
106 * shortname = 1.2.3.4
107 * shortname = some long name, 1.2.3.4
108 */
109
110
111static int do_create(char *value, char *name)
112 {
113 int nid;
114 ASN1_OBJECT *oid;
115 char *ln, *ostr, *p, *lntmp;
116 p = strrchr(value, ',');
117 if (!p)
118 {
119 ln = name;
120 ostr = value;
121 }
122 else
123 {
124 ln = NULL;
125 ostr = p + 1;
126 if (!*ostr)
127 return 0;
128 while(isspace((unsigned char)*ostr)) ostr++;
129 }
130
131 nid = OBJ_create(ostr, name, ln);
132
133 if (nid == NID_undef)
134 return 0;
135
136 if (p)
137 {
138 ln = value;
139 while(isspace((unsigned char)*ln)) ln++;
140 p--;
141 while(isspace((unsigned char)*p))
142 {
143 if (p == ln)
144 return 0;
145 p--;
146 }
147 p++;
148 lntmp = OPENSSL_malloc((p - ln) + 1);
149 if (lntmp == NULL)
150 return 0;
151 memcpy(lntmp, ln, p - ln);
152 lntmp[p - ln] = 0;
153 oid = OBJ_nid2obj(nid);
154 oid->ln = lntmp;
155 }
156
157 return 1;
158 }
159
160
diff --git a/src/lib/libcrypto/asn1/asn_pack.c b/src/lib/libcrypto/asn1/asn_pack.c
index e8b671b7b5..e6051db2dc 100644
--- a/src/lib/libcrypto/asn1/asn_pack.c
+++ b/src/lib/libcrypto/asn1/asn_pack.c
@@ -66,11 +66,11 @@
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 *ASN1_seq_unpack(unsigned char *buf, int len, char *(*d2i)(),
70 d2i_of_void *d2i,void (*free_func)(void *)) 70 void (*free_func)(void *))
71{ 71{
72 STACK *sk; 72 STACK *sk;
73 const unsigned char *pbuf; 73 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,
76 V_ASN1_SEQUENCE, V_ASN1_UNIVERSAL))) 76 V_ASN1_SEQUENCE, V_ASN1_UNIVERSAL)))
@@ -82,8 +82,8 @@ 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 *safes, int (*i2d)(), unsigned char **buf,
86 unsigned char **buf, int *len) 86 int *len)
87{ 87{
88 int safelen; 88 int safelen;
89 unsigned char *safe, *p; 89 unsigned char *safe, *p;
@@ -106,9 +106,9 @@ unsigned char *ASN1_seq_pack(STACK *safes, i2d_of_void *i2d,
106 106
107/* Extract an ASN1 object from an ASN1_STRING */ 107/* Extract an ASN1 object from an ASN1_STRING */
108 108
109void *ASN1_unpack_string(ASN1_STRING *oct, d2i_of_void *d2i) 109void *ASN1_unpack_string (ASN1_STRING *oct, char *(*d2i)())
110{ 110{
111 const unsigned char *p; 111 unsigned char *p;
112 char *ret; 112 char *ret;
113 113
114 p = oct->data; 114 p = oct->data;
@@ -119,7 +119,7 @@ void *ASN1_unpack_string(ASN1_STRING *oct, d2i_of_void *d2i)
119 119
120/* Pack an ASN1 object into an ASN1_STRING */ 120/* Pack an ASN1 object into an ASN1_STRING */
121 121
122ASN1_STRING *ASN1_pack_string(void *obj, i2d_of_void *i2d, ASN1_STRING **oct) 122ASN1_STRING *ASN1_pack_string(void *obj, int (*i2d)(), ASN1_STRING **oct)
123{ 123{
124 unsigned char *p; 124 unsigned char *p;
125 ASN1_STRING *octmp; 125 ASN1_STRING *octmp;
@@ -155,7 +155,7 @@ ASN1_STRING *ASN1_item_pack(void *obj, const ASN1_ITEM *it, ASN1_STRING **oct)
155 155
156 if (!oct || !*oct) { 156 if (!oct || !*oct) {
157 if (!(octmp = ASN1_STRING_new ())) { 157 if (!(octmp = ASN1_STRING_new ())) {
158 ASN1err(ASN1_F_ASN1_ITEM_PACK,ERR_R_MALLOC_FAILURE); 158 ASN1err(ASN1_F_ASN1_PACK_STRING,ERR_R_MALLOC_FAILURE);
159 return NULL; 159 return NULL;
160 } 160 }
161 if (oct) *oct = octmp; 161 if (oct) *oct = octmp;
@@ -167,11 +167,11 @@ ASN1_STRING *ASN1_item_pack(void *obj, const ASN1_ITEM *it, ASN1_STRING **oct)
167 } 167 }
168 168
169 if (!(octmp->length = ASN1_item_i2d(obj, &octmp->data, it))) { 169 if (!(octmp->length = ASN1_item_i2d(obj, &octmp->data, it))) {
170 ASN1err(ASN1_F_ASN1_ITEM_PACK,ASN1_R_ENCODE_ERROR); 170 ASN1err(ASN1_F_ASN1_PACK_STRING,ASN1_R_ENCODE_ERROR);
171 return NULL; 171 return NULL;
172 } 172 }
173 if (!octmp->data) { 173 if (!octmp->data) {
174 ASN1err(ASN1_F_ASN1_ITEM_PACK,ERR_R_MALLOC_FAILURE); 174 ASN1err(ASN1_F_ASN1_PACK_STRING,ERR_R_MALLOC_FAILURE);
175 return NULL; 175 return NULL;
176 } 176 }
177 return octmp; 177 return octmp;
@@ -181,11 +181,11 @@ ASN1_STRING *ASN1_item_pack(void *obj, const ASN1_ITEM *it, ASN1_STRING **oct)
181 181
182void *ASN1_item_unpack(ASN1_STRING *oct, const ASN1_ITEM *it) 182void *ASN1_item_unpack(ASN1_STRING *oct, const ASN1_ITEM *it)
183{ 183{
184 const unsigned char *p; 184 unsigned char *p;
185 void *ret; 185 void *ret;
186 186
187 p = oct->data; 187 p = oct->data;
188 if(!(ret = ASN1_item_d2i(NULL, &p, oct->length, it))) 188 if(!(ret = ASN1_item_d2i(NULL, &p, oct->length, it)))
189 ASN1err(ASN1_F_ASN1_ITEM_UNPACK,ASN1_R_DECODE_ERROR); 189 ASN1err(ASN1_F_ASN1_UNPACK_STRING,ASN1_R_DECODE_ERROR);
190 return ret; 190 return ret;
191} 191}
diff --git a/src/lib/libcrypto/asn1/d2i_pr.c b/src/lib/libcrypto/asn1/d2i_pr.c
index 207ccda5ac..2e7d96af90 100644
--- a/src/lib/libcrypto/asn1/d2i_pr.c
+++ b/src/lib/libcrypto/asn1/d2i_pr.c
@@ -68,11 +68,8 @@
68#ifndef OPENSSL_NO_DSA 68#ifndef OPENSSL_NO_DSA
69#include <openssl/dsa.h> 69#include <openssl/dsa.h>
70#endif 70#endif
71#ifndef OPENSSL_NO_EC
72#include <openssl/ec.h>
73#endif
74 71
75EVP_PKEY *d2i_PrivateKey(int type, EVP_PKEY **a, const unsigned char **pp, 72EVP_PKEY *d2i_PrivateKey(int type, EVP_PKEY **a, unsigned char **pp,
76 long length) 73 long length)
77 { 74 {
78 EVP_PKEY *ret; 75 EVP_PKEY *ret;
@@ -111,16 +108,6 @@ EVP_PKEY *d2i_PrivateKey(int type, EVP_PKEY **a, const unsigned char **pp,
111 } 108 }
112 break; 109 break;
113#endif 110#endif
114#ifndef OPENSSL_NO_EC
115 case EVP_PKEY_EC:
116 if ((ret->pkey.ec = d2i_ECPrivateKey(NULL,
117 (const unsigned char **)pp, length)) == NULL)
118 {
119 ASN1err(ASN1_F_D2I_PRIVATEKEY, ERR_R_ASN1_LIB);
120 goto err;
121 }
122 break;
123#endif
124 default: 111 default:
125 ASN1err(ASN1_F_D2I_PRIVATEKEY,ASN1_R_UNKNOWN_PUBLIC_KEY_TYPE); 112 ASN1err(ASN1_F_D2I_PRIVATEKEY,ASN1_R_UNKNOWN_PUBLIC_KEY_TYPE);
126 goto err; 113 goto err;
@@ -135,11 +122,11 @@ err:
135 122
136/* This works like d2i_PrivateKey() except it automatically works out the type */ 123/* This works like d2i_PrivateKey() except it automatically works out the type */
137 124
138EVP_PKEY *d2i_AutoPrivateKey(EVP_PKEY **a, const unsigned char **pp, 125EVP_PKEY *d2i_AutoPrivateKey(EVP_PKEY **a, unsigned char **pp,
139 long length) 126 long length)
140{ 127{
141 STACK_OF(ASN1_TYPE) *inkey; 128 STACK_OF(ASN1_TYPE) *inkey;
142 const unsigned char *p; 129 unsigned char *p;
143 int keytype; 130 int keytype;
144 p = *pp; 131 p = *pp;
145 /* Dirty trick: read in the ASN1 data into a STACK_OF(ASN1_TYPE): 132 /* Dirty trick: read in the ASN1 data into a STACK_OF(ASN1_TYPE):
@@ -151,10 +138,7 @@ EVP_PKEY *d2i_AutoPrivateKey(EVP_PKEY **a, const unsigned char **pp,
151 /* Since we only need to discern "traditional format" RSA and DSA 138 /* Since we only need to discern "traditional format" RSA and DSA
152 * keys we can just count the elements. 139 * keys we can just count the elements.
153 */ 140 */
154 if(sk_ASN1_TYPE_num(inkey) == 6) 141 if(sk_ASN1_TYPE_num(inkey) == 6) keytype = EVP_PKEY_DSA;
155 keytype = EVP_PKEY_DSA;
156 else if (sk_ASN1_TYPE_num(inkey) == 4)
157 keytype = EVP_PKEY_EC;
158 else keytype = EVP_PKEY_RSA; 142 else keytype = EVP_PKEY_RSA;
159 sk_ASN1_TYPE_pop_free(inkey, ASN1_TYPE_free); 143 sk_ASN1_TYPE_pop_free(inkey, ASN1_TYPE_free);
160 return d2i_PrivateKey(keytype, a, pp, length); 144 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..71f2eb361b 100644
--- a/src/lib/libcrypto/asn1/d2i_pu.c
+++ b/src/lib/libcrypto/asn1/d2i_pu.c
@@ -68,11 +68,8 @@
68#ifndef OPENSSL_NO_DSA 68#ifndef OPENSSL_NO_DSA
69#include <openssl/dsa.h> 69#include <openssl/dsa.h>
70#endif 70#endif
71#ifndef OPENSSL_NO_EC
72#include <openssl/ec.h>
73#endif
74 71
75EVP_PKEY *d2i_PublicKey(int type, EVP_PKEY **a, const unsigned char **pp, 72EVP_PKEY *d2i_PublicKey(int type, EVP_PKEY **a, unsigned char **pp,
76 long length) 73 long length)
77 { 74 {
78 EVP_PKEY *ret; 75 EVP_PKEY *ret;
@@ -103,24 +100,14 @@ EVP_PKEY *d2i_PublicKey(int type, EVP_PKEY **a, const unsigned char **pp,
103#endif 100#endif
104#ifndef OPENSSL_NO_DSA 101#ifndef OPENSSL_NO_DSA
105 case EVP_PKEY_DSA: 102 case EVP_PKEY_DSA:
106 if (!d2i_DSAPublicKey(&(ret->pkey.dsa), 103 if ((ret->pkey.dsa=d2i_DSAPublicKey(NULL,
107 (const unsigned char **)pp,length)) /* TMP UGLY CAST */ 104 (const unsigned char **)pp,length)) == NULL) /* TMP UGLY CAST */
108 { 105 {
109 ASN1err(ASN1_F_D2I_PUBLICKEY,ERR_R_ASN1_LIB); 106 ASN1err(ASN1_F_D2I_PUBLICKEY,ERR_R_ASN1_LIB);
110 goto err; 107 goto err;
111 } 108 }
112 break; 109 break;
113#endif 110#endif
114#ifndef OPENSSL_NO_EC
115 case EVP_PKEY_EC:
116 if (!o2i_ECPublicKey(&(ret->pkey.ec),
117 (const unsigned char **)pp, length))
118 {
119 ASN1err(ASN1_F_D2I_PUBLICKEY, ERR_R_ASN1_LIB);
120 goto err;
121 }
122 break;
123#endif
124 default: 111 default:
125 ASN1err(ASN1_F_D2I_PUBLICKEY,ASN1_R_UNKNOWN_PUBLIC_KEY_TYPE); 112 ASN1err(ASN1_F_D2I_PUBLICKEY,ASN1_R_UNKNOWN_PUBLIC_KEY_TYPE);
126 goto err; 113 goto err;
diff --git a/src/lib/libcrypto/asn1/evp_asn1.c b/src/lib/libcrypto/asn1/evp_asn1.c
index f3d9804860..f92ce6cb5d 100644
--- a/src/lib/libcrypto/asn1/evp_asn1.c
+++ b/src/lib/libcrypto/asn1/evp_asn1.c
@@ -141,9 +141,9 @@ int ASN1_TYPE_get_int_octetstring(ASN1_TYPE *a, long *num, unsigned char *data,
141 int ret= -1,n; 141 int ret= -1,n;
142 ASN1_INTEGER *ai=NULL; 142 ASN1_INTEGER *ai=NULL;
143 ASN1_OCTET_STRING *os=NULL; 143 ASN1_OCTET_STRING *os=NULL;
144 const unsigned char *p; 144 unsigned char *p;
145 long length; 145 long length;
146 ASN1_const_CTX c; 146 ASN1_CTX c;
147 147
148 if ((a->type != V_ASN1_SEQUENCE) || (a->value.sequence == NULL)) 148 if ((a->type != V_ASN1_SEQUENCE) || (a->value.sequence == NULL))
149 { 149 {
diff --git a/src/lib/libcrypto/asn1/f.c b/src/lib/libcrypto/asn1/f.c
new file mode 100644
index 0000000000..82bccdfd51
--- /dev/null
+++ b/src/lib/libcrypto/asn1/f.c
@@ -0,0 +1,80 @@
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..1e951ae01d 100644
--- a/src/lib/libcrypto/asn1/i2d_pr.c
+++ b/src/lib/libcrypto/asn1/i2d_pr.c
@@ -67,9 +67,6 @@
67#ifndef OPENSSL_NO_DSA 67#ifndef OPENSSL_NO_DSA
68#include <openssl/dsa.h> 68#include <openssl/dsa.h>
69#endif 69#endif
70#ifndef OPENSSL_NO_EC
71#include <openssl/ec.h>
72#endif
73 70
74int i2d_PrivateKey(EVP_PKEY *a, unsigned char **pp) 71int i2d_PrivateKey(EVP_PKEY *a, unsigned char **pp)
75 { 72 {
@@ -86,12 +83,6 @@ int i2d_PrivateKey(EVP_PKEY *a, unsigned char **pp)
86 return(i2d_DSAPrivateKey(a->pkey.dsa,pp)); 83 return(i2d_DSAPrivateKey(a->pkey.dsa,pp));
87 } 84 }
88#endif 85#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 86
96 ASN1err(ASN1_F_I2D_PRIVATEKEY,ASN1_R_UNSUPPORTED_PUBLIC_KEY_TYPE); 87 ASN1err(ASN1_F_I2D_PRIVATEKEY,ASN1_R_UNSUPPORTED_PUBLIC_KEY_TYPE);
97 return(-1); 88 return(-1);
diff --git a/src/lib/libcrypto/asn1/i2d_pu.c b/src/lib/libcrypto/asn1/i2d_pu.c
index 34286dbd35..013d19bbf4 100644
--- a/src/lib/libcrypto/asn1/i2d_pu.c
+++ b/src/lib/libcrypto/asn1/i2d_pu.c
@@ -67,9 +67,6 @@
67#ifndef OPENSSL_NO_DSA 67#ifndef OPENSSL_NO_DSA
68#include <openssl/dsa.h> 68#include <openssl/dsa.h>
69#endif 69#endif
70#ifndef OPENSSL_NO_EC
71#include <openssl/ec.h>
72#endif
73 70
74int i2d_PublicKey(EVP_PKEY *a, unsigned char **pp) 71int i2d_PublicKey(EVP_PKEY *a, unsigned char **pp)
75 { 72 {
@@ -83,10 +80,6 @@ int i2d_PublicKey(EVP_PKEY *a, unsigned char **pp)
83 case EVP_PKEY_DSA: 80 case EVP_PKEY_DSA:
84 return(i2d_DSAPublicKey(a->pkey.dsa,pp)); 81 return(i2d_DSAPublicKey(a->pkey.dsa,pp));
85#endif 82#endif
86#ifndef OPENSSL_NO_EC
87 case EVP_PKEY_EC:
88 return(i2o_ECPublicKey(a->pkey.ec, pp));
89#endif
90 default: 83 default:
91 ASN1err(ASN1_F_I2D_PUBLICKEY,ASN1_R_UNSUPPORTED_PUBLIC_KEY_TYPE); 84 ASN1err(ASN1_F_I2D_PUBLICKEY,ASN1_R_UNSUPPORTED_PUBLIC_KEY_TYPE);
92 return(-1); 85 return(-1);
diff --git a/src/lib/libcrypto/asn1/n_pkey.c b/src/lib/libcrypto/asn1/n_pkey.c
index 60bc437938..766b51c538 100644
--- a/src/lib/libcrypto/asn1/n_pkey.c
+++ b/src/lib/libcrypto/asn1/n_pkey.c
@@ -56,9 +56,9 @@
56 * [including the GNU Public Licence.] 56 * [including the GNU Public Licence.]
57 */ 57 */
58 58
59#ifndef OPENSSL_NO_RSA
59#include <stdio.h> 60#include <stdio.h>
60#include "cryptlib.h" 61#include "cryptlib.h"
61#ifndef OPENSSL_NO_RSA
62#include <openssl/rsa.h> 62#include <openssl/rsa.h>
63#include <openssl/objects.h> 63#include <openssl/objects.h>
64#include <openssl/asn1t.h> 64#include <openssl/asn1t.h>
@@ -107,20 +107,14 @@ DECLARE_ASN1_ENCODE_FUNCTIONS_const(NETSCAPE_PKEY,NETSCAPE_PKEY)
107IMPLEMENT_ASN1_FUNCTIONS_const(NETSCAPE_PKEY) 107IMPLEMENT_ASN1_FUNCTIONS_const(NETSCAPE_PKEY)
108 108
109static RSA *d2i_RSA_NET_2(RSA **a, ASN1_OCTET_STRING *os, 109static RSA *d2i_RSA_NET_2(RSA **a, ASN1_OCTET_STRING *os,
110 int (*cb)(char *buf, int len, const char *prompt, 110 int (*cb)(), int sgckey);
111 int verify),
112 int sgckey);
113 111
114int i2d_Netscape_RSA(const RSA *a, unsigned char **pp, 112int i2d_Netscape_RSA(const RSA *a, unsigned char **pp, int (*cb)())
115 int (*cb)(char *buf, int len, const char *prompt,
116 int verify))
117{ 113{
118 return i2d_RSA_NET(a, pp, cb, 0); 114 return i2d_RSA_NET(a, pp, cb, 0);
119} 115}
120 116
121int i2d_RSA_NET(const RSA *a, unsigned char **pp, 117int i2d_RSA_NET(const RSA *a, unsigned char **pp, int (*cb)(), int sgckey)
122 int (*cb)(char *buf, int len, const char *prompt, int verify),
123 int sgckey)
124 { 118 {
125 int i, j, ret = 0; 119 int i, j, ret = 0;
126 int rsalen, pkeylen, olen; 120 int rsalen, pkeylen, olen;
@@ -170,7 +164,7 @@ int i2d_RSA_NET(const RSA *a, unsigned char **pp,
170 /* Since its RC4 encrypted length is actual length */ 164 /* Since its RC4 encrypted length is actual length */
171 if ((zz=(unsigned char *)OPENSSL_malloc(rsalen)) == NULL) 165 if ((zz=(unsigned char *)OPENSSL_malloc(rsalen)) == NULL)
172 { 166 {
173 ASN1err(ASN1_F_I2D_RSA_NET,ERR_R_MALLOC_FAILURE); 167 ASN1err(ASN1_F_I2D_NETSCAPE_RSA,ERR_R_MALLOC_FAILURE);
174 goto err; 168 goto err;
175 } 169 }
176 170
@@ -180,13 +174,13 @@ int i2d_RSA_NET(const RSA *a, unsigned char **pp,
180 174
181 if ((zz=OPENSSL_malloc(pkeylen)) == NULL) 175 if ((zz=OPENSSL_malloc(pkeylen)) == NULL)
182 { 176 {
183 ASN1err(ASN1_F_I2D_RSA_NET,ERR_R_MALLOC_FAILURE); 177 ASN1err(ASN1_F_I2D_NETSCAPE_RSA,ERR_R_MALLOC_FAILURE);
184 goto err; 178 goto err;
185 } 179 }
186 180
187 if (!ASN1_STRING_set(enckey->os, "private-key", -1)) 181 if (!ASN1_STRING_set(enckey->os, "private-key", -1))
188 { 182 {
189 ASN1err(ASN1_F_I2D_RSA_NET,ERR_R_MALLOC_FAILURE); 183 ASN1err(ASN1_F_I2D_NETSCAPE_RSA,ERR_R_MALLOC_FAILURE);
190 goto err; 184 goto err;
191 } 185 }
192 enckey->enckey->digest->data = zz; 186 enckey->enckey->digest->data = zz;
@@ -197,10 +191,10 @@ int i2d_RSA_NET(const RSA *a, unsigned char **pp,
197 191
198 if (cb == NULL) 192 if (cb == NULL)
199 cb=EVP_read_pw_string; 193 cb=EVP_read_pw_string;
200 i=cb((char *)buf,256,"Enter Private Key password:",1); 194 i=cb(buf,256,"Enter Private Key password:",1);
201 if (i != 0) 195 if (i != 0)
202 { 196 {
203 ASN1err(ASN1_F_I2D_RSA_NET,ASN1_R_BAD_PASSWORD_READ); 197 ASN1err(ASN1_F_I2D_NETSCAPE_RSA,ASN1_R_BAD_PASSWORD_READ);
204 goto err; 198 goto err;
205 } 199 }
206 i = strlen((char *)buf); 200 i = strlen((char *)buf);
@@ -230,16 +224,12 @@ err:
230 } 224 }
231 225
232 226
233RSA *d2i_Netscape_RSA(RSA **a, const unsigned char **pp, long length, 227RSA *d2i_Netscape_RSA(RSA **a, const unsigned char **pp, long length, int (*cb)())
234 int (*cb)(char *buf, int len, const char *prompt,
235 int verify))
236{ 228{
237 return d2i_RSA_NET(a, pp, length, cb, 0); 229 return d2i_RSA_NET(a, pp, length, cb, 0);
238} 230}
239 231
240RSA *d2i_RSA_NET(RSA **a, const unsigned char **pp, long length, 232RSA *d2i_RSA_NET(RSA **a, const unsigned char **pp, long length, int (*cb)(), int sgckey)
241 int (*cb)(char *buf, int len, const char *prompt, int verify),
242 int sgckey)
243 { 233 {
244 RSA *ret=NULL; 234 RSA *ret=NULL;
245 const unsigned char *p, *kp; 235 const unsigned char *p, *kp;
@@ -249,20 +239,20 @@ RSA *d2i_RSA_NET(RSA **a, const unsigned char **pp, long length,
249 239
250 enckey = d2i_NETSCAPE_ENCRYPTED_PKEY(NULL, &p, length); 240 enckey = d2i_NETSCAPE_ENCRYPTED_PKEY(NULL, &p, length);
251 if(!enckey) { 241 if(!enckey) {
252 ASN1err(ASN1_F_D2I_RSA_NET,ASN1_R_DECODING_ERROR); 242 ASN1err(ASN1_F_D2I_NETSCAPE_RSA,ASN1_R_DECODING_ERROR);
253 return NULL; 243 return NULL;
254 } 244 }
255 245
256 if ((enckey->os->length != 11) || (strncmp("private-key", 246 if ((enckey->os->length != 11) || (strncmp("private-key",
257 (char *)enckey->os->data,11) != 0)) 247 (char *)enckey->os->data,11) != 0))
258 { 248 {
259 ASN1err(ASN1_F_D2I_RSA_NET,ASN1_R_PRIVATE_KEY_HEADER_MISSING); 249 ASN1err(ASN1_F_D2I_NETSCAPE_RSA,ASN1_R_PRIVATE_KEY_HEADER_MISSING);
260 NETSCAPE_ENCRYPTED_PKEY_free(enckey); 250 NETSCAPE_ENCRYPTED_PKEY_free(enckey);
261 return NULL; 251 return NULL;
262 } 252 }
263 if (OBJ_obj2nid(enckey->enckey->algor->algorithm) != NID_rc4) 253 if (OBJ_obj2nid(enckey->enckey->algor->algorithm) != NID_rc4)
264 { 254 {
265 ASN1err(ASN1_F_D2I_RSA_NET,ASN1_R_UNSUPPORTED_ENCRYPTION_ALGORITHM); 255 ASN1err(ASN1_F_D2I_NETSCAPE_RSA_2,ASN1_R_UNSUPPORTED_ENCRYPTION_ALGORITHM);
266 goto err; 256 goto err;
267 } 257 }
268 kp = enckey->enckey->digest->data; 258 kp = enckey->enckey->digest->data;
@@ -279,8 +269,7 @@ RSA *d2i_RSA_NET(RSA **a, const unsigned char **pp, long length,
279 } 269 }
280 270
281static RSA *d2i_RSA_NET_2(RSA **a, ASN1_OCTET_STRING *os, 271static RSA *d2i_RSA_NET_2(RSA **a, ASN1_OCTET_STRING *os,
282 int (*cb)(char *buf, int len, const char *prompt, 272 int (*cb)(), int sgckey)
283 int verify), int sgckey)
284 { 273 {
285 NETSCAPE_PKEY *pkey=NULL; 274 NETSCAPE_PKEY *pkey=NULL;
286 RSA *ret=NULL; 275 RSA *ret=NULL;
@@ -290,10 +279,10 @@ static RSA *d2i_RSA_NET_2(RSA **a, ASN1_OCTET_STRING *os,
290 unsigned char key[EVP_MAX_KEY_LENGTH]; 279 unsigned char key[EVP_MAX_KEY_LENGTH];
291 EVP_CIPHER_CTX ctx; 280 EVP_CIPHER_CTX ctx;
292 281
293 i=cb((char *)buf,256,"Enter Private Key password:",0); 282 i=cb(buf,256,"Enter Private Key password:",0);
294 if (i != 0) 283 if (i != 0)
295 { 284 {
296 ASN1err(ASN1_F_D2I_RSA_NET_2,ASN1_R_BAD_PASSWORD_READ); 285 ASN1err(ASN1_F_D2I_NETSCAPE_RSA_2,ASN1_R_BAD_PASSWORD_READ);
297 goto err; 286 goto err;
298 } 287 }
299 288
@@ -318,14 +307,14 @@ static RSA *d2i_RSA_NET_2(RSA **a, ASN1_OCTET_STRING *os,
318 307
319 if ((pkey=d2i_NETSCAPE_PKEY(NULL,&zz,os->length)) == NULL) 308 if ((pkey=d2i_NETSCAPE_PKEY(NULL,&zz,os->length)) == NULL)
320 { 309 {
321 ASN1err(ASN1_F_D2I_RSA_NET_2,ASN1_R_UNABLE_TO_DECODE_RSA_PRIVATE_KEY); 310 ASN1err(ASN1_F_D2I_NETSCAPE_RSA_2,ASN1_R_UNABLE_TO_DECODE_RSA_PRIVATE_KEY);
322 goto err; 311 goto err;
323 } 312 }
324 313
325 zz=pkey->private_key->data; 314 zz=pkey->private_key->data;
326 if ((ret=d2i_RSAPrivateKey(a,&zz,pkey->private_key->length)) == NULL) 315 if ((ret=d2i_RSAPrivateKey(a,&zz,pkey->private_key->length)) == NULL)
327 { 316 {
328 ASN1err(ASN1_F_D2I_RSA_NET_2,ASN1_R_UNABLE_TO_DECODE_RSA_KEY); 317 ASN1err(ASN1_F_D2I_NETSCAPE_RSA_2,ASN1_R_UNABLE_TO_DECODE_RSA_KEY);
329 goto err; 318 goto err;
330 } 319 }
331err: 320err:
diff --git a/src/lib/libcrypto/asn1/p5_pbe.c b/src/lib/libcrypto/asn1/p5_pbe.c
index da91170094..ec788267e0 100644
--- a/src/lib/libcrypto/asn1/p5_pbe.c
+++ b/src/lib/libcrypto/asn1/p5_pbe.c
@@ -82,17 +82,17 @@ X509_ALGOR *PKCS5_pbe_set(int alg, int iter, unsigned char *salt,
82 ASN1_TYPE *astype=NULL; 82 ASN1_TYPE *astype=NULL;
83 83
84 if (!(pbe = PBEPARAM_new ())) { 84 if (!(pbe = PBEPARAM_new ())) {
85 ASN1err(ASN1_F_PKCS5_PBE_SET,ERR_R_MALLOC_FAILURE); 85 ASN1err(ASN1_F_ASN1_PBE_SET,ERR_R_MALLOC_FAILURE);
86 goto err; 86 goto err;
87 } 87 }
88 if(iter <= 0) iter = PKCS5_DEFAULT_ITER; 88 if(iter <= 0) iter = PKCS5_DEFAULT_ITER;
89 if (!ASN1_INTEGER_set(pbe->iter, iter)) { 89 if (!ASN1_INTEGER_set(pbe->iter, iter)) {
90 ASN1err(ASN1_F_PKCS5_PBE_SET,ERR_R_MALLOC_FAILURE); 90 ASN1err(ASN1_F_ASN1_PBE_SET,ERR_R_MALLOC_FAILURE);
91 goto err; 91 goto err;
92 } 92 }
93 if (!saltlen) saltlen = PKCS5_SALT_LEN; 93 if (!saltlen) saltlen = PKCS5_SALT_LEN;
94 if (!(pbe->salt->data = OPENSSL_malloc (saltlen))) { 94 if (!(pbe->salt->data = OPENSSL_malloc (saltlen))) {
95 ASN1err(ASN1_F_PKCS5_PBE_SET,ERR_R_MALLOC_FAILURE); 95 ASN1err(ASN1_F_ASN1_PBE_SET,ERR_R_MALLOC_FAILURE);
96 goto err; 96 goto err;
97 } 97 }
98 pbe->salt->length = saltlen; 98 pbe->salt->length = saltlen;
@@ -101,14 +101,13 @@ X509_ALGOR *PKCS5_pbe_set(int alg, int iter, unsigned char *salt,
101 goto err; 101 goto err;
102 102
103 if (!(astype = ASN1_TYPE_new())) { 103 if (!(astype = ASN1_TYPE_new())) {
104 ASN1err(ASN1_F_PKCS5_PBE_SET,ERR_R_MALLOC_FAILURE); 104 ASN1err(ASN1_F_ASN1_PBE_SET,ERR_R_MALLOC_FAILURE);
105 goto err; 105 goto err;
106 } 106 }
107 107
108 astype->type = V_ASN1_SEQUENCE; 108 astype->type = V_ASN1_SEQUENCE;
109 if(!ASN1_pack_string_of(PBEPARAM, pbe, i2d_PBEPARAM, 109 if(!ASN1_pack_string(pbe, i2d_PBEPARAM, &astype->value.sequence)) {
110 &astype->value.sequence)) { 110 ASN1err(ASN1_F_ASN1_PBE_SET,ERR_R_MALLOC_FAILURE);
111 ASN1err(ASN1_F_PKCS5_PBE_SET,ERR_R_MALLOC_FAILURE);
112 goto err; 111 goto err;
113 } 112 }
114 PBEPARAM_free (pbe); 113 PBEPARAM_free (pbe);
@@ -116,7 +115,7 @@ X509_ALGOR *PKCS5_pbe_set(int alg, int iter, unsigned char *salt,
116 115
117 al = OBJ_nid2obj(alg); /* never need to free al */ 116 al = OBJ_nid2obj(alg); /* never need to free al */
118 if (!(algor = X509_ALGOR_new())) { 117 if (!(algor = X509_ALGOR_new())) {
119 ASN1err(ASN1_F_PKCS5_PBE_SET,ERR_R_MALLOC_FAILURE); 118 ASN1err(ASN1_F_ASN1_PBE_SET,ERR_R_MALLOC_FAILURE);
120 goto err; 119 goto err;
121 } 120 }
122 ASN1_OBJECT_free(algor->algorithm); 121 ASN1_OBJECT_free(algor->algorithm);
diff --git a/src/lib/libcrypto/asn1/p5_pbev2.c b/src/lib/libcrypto/asn1/p5_pbev2.c
index c834a38ddf..e0dc0ec4ee 100644
--- a/src/lib/libcrypto/asn1/p5_pbev2.c
+++ b/src/lib/libcrypto/asn1/p5_pbev2.c
@@ -115,7 +115,7 @@ X509_ALGOR *PKCS5_pbe2_set(const EVP_CIPHER *cipher, int iter,
115 /* Create random IV */ 115 /* Create random IV */
116 if (EVP_CIPHER_iv_length(cipher) && 116 if (EVP_CIPHER_iv_length(cipher) &&
117 RAND_pseudo_bytes(iv, EVP_CIPHER_iv_length(cipher)) < 0) 117 RAND_pseudo_bytes(iv, EVP_CIPHER_iv_length(cipher)) < 0)
118 goto err; 118 goto err;
119 119
120 EVP_CIPHER_CTX_init(&ctx); 120 EVP_CIPHER_CTX_init(&ctx);
121 121
@@ -164,7 +164,7 @@ X509_ALGOR *PKCS5_pbe2_set(const EVP_CIPHER *cipher, int iter,
164 164
165 if(!(pbe2->keyfunc->parameter = ASN1_TYPE_new())) goto merr; 165 if(!(pbe2->keyfunc->parameter = ASN1_TYPE_new())) goto merr;
166 166
167 if(!ASN1_pack_string_of(PBKDF2PARAM, kdf, i2d_PBKDF2PARAM, 167 if(!ASN1_pack_string(kdf, i2d_PBKDF2PARAM,
168 &pbe2->keyfunc->parameter->value.sequence)) goto merr; 168 &pbe2->keyfunc->parameter->value.sequence)) goto merr;
169 pbe2->keyfunc->parameter->type = V_ASN1_SEQUENCE; 169 pbe2->keyfunc->parameter->type = V_ASN1_SEQUENCE;
170 170
@@ -180,7 +180,7 @@ X509_ALGOR *PKCS5_pbe2_set(const EVP_CIPHER *cipher, int iter,
180 180
181 /* Encode PBE2PARAM into parameter */ 181 /* Encode PBE2PARAM into parameter */
182 182
183 if(!ASN1_pack_string_of(PBE2PARAM, pbe2, i2d_PBE2PARAM, 183 if(!ASN1_pack_string(pbe2, i2d_PBE2PARAM,
184 &ret->parameter->value.sequence)) goto merr; 184 &ret->parameter->value.sequence)) goto merr;
185 ret->parameter->type = V_ASN1_SEQUENCE; 185 ret->parameter->type = V_ASN1_SEQUENCE;
186 186
diff --git a/src/lib/libcrypto/asn1/p8_key.c b/src/lib/libcrypto/asn1/p8_key.c
new file mode 100644
index 0000000000..3a31248e14
--- /dev/null
+++ b/src/lib/libcrypto/asn1/p8_key.c
@@ -0,0 +1,131 @@
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/t_crl.c b/src/lib/libcrypto/asn1/t_crl.c
index 929b3e5904..757c148df8 100644
--- a/src/lib/libcrypto/asn1/t_crl.c
+++ b/src/lib/libcrypto/asn1/t_crl.c
@@ -72,7 +72,7 @@ int X509_CRL_print_fp(FILE *fp, X509_CRL *x)
72 72
73 if ((b=BIO_new(BIO_s_file())) == NULL) 73 if ((b=BIO_new(BIO_s_file())) == NULL)
74 { 74 {
75 X509err(X509_F_X509_CRL_PRINT_FP,ERR_R_BUF_LIB); 75 X509err(X509_F_X509_PRINT_FP,ERR_R_BUF_LIB);
76 return(0); 76 return(0);
77 } 77 }
78 BIO_set_fp(b,fp,BIO_NOCLOSE); 78 BIO_set_fp(b,fp,BIO_NOCLOSE);
@@ -121,7 +121,7 @@ int X509_CRL_print(BIO *out, X509_CRL *x)
121 r = sk_X509_REVOKED_value(rev, i); 121 r = sk_X509_REVOKED_value(rev, i);
122 BIO_printf(out," Serial Number: "); 122 BIO_printf(out," Serial Number: ");
123 i2a_ASN1_INTEGER(out,r->serialNumber); 123 i2a_ASN1_INTEGER(out,r->serialNumber);
124 BIO_printf(out,"\n Revocation Date: "); 124 BIO_printf(out,"\n Revocation Date: ","");
125 ASN1_TIME_print(out,r->revocationDate); 125 ASN1_TIME_print(out,r->revocationDate);
126 BIO_printf(out,"\n"); 126 BIO_printf(out,"\n");
127 X509V3_extensions_print(out, "CRL entry extensions", 127 X509V3_extensions_print(out, "CRL entry extensions",
diff --git a/src/lib/libcrypto/asn1/t_pkey.c b/src/lib/libcrypto/asn1/t_pkey.c
index afb95d6712..d15006e654 100644
--- a/src/lib/libcrypto/asn1/t_pkey.c
+++ b/src/lib/libcrypto/asn1/t_pkey.c
@@ -55,15 +55,9 @@
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>
67#include <openssl/buffer.h> 61#include <openssl/buffer.h>
68#include <openssl/bn.h> 62#include <openssl/bn.h>
69#ifndef OPENSSL_NO_RSA 63#ifndef OPENSSL_NO_RSA
@@ -75,33 +69,26 @@
75#ifndef OPENSSL_NO_DSA 69#ifndef OPENSSL_NO_DSA
76#include <openssl/dsa.h> 70#include <openssl/dsa.h>
77#endif 71#endif
78#ifndef OPENSSL_NO_EC
79#include <openssl/ec.h>
80#endif
81 72
82static int print(BIO *fp,const char *str, const BIGNUM *num, 73static int print(BIO *fp,const char *str,BIGNUM *num,
83 unsigned char *buf,int off); 74 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 75#ifndef OPENSSL_NO_RSA
89#ifndef OPENSSL_NO_FP_API 76#ifndef OPENSSL_NO_FP_API
90int RSA_print_fp(FILE *fp, const RSA *x, int off) 77int RSA_print_fp(FILE *fp, const RSA *x, int off)
91 { 78 {
92 BIO *b; 79 BIO *b;
93 int ret; 80 int ret;
94 81
95 if ((b=BIO_new(BIO_s_file())) == NULL) 82 if ((b=BIO_new(BIO_s_file())) == NULL)
96 { 83 {
97 RSAerr(RSA_F_RSA_PRINT_FP,ERR_R_BUF_LIB); 84 RSAerr(RSA_F_RSA_PRINT_FP,ERR_R_BUF_LIB);
98 return(0); 85 return(0);
99 } 86 }
100 BIO_set_fp(b,fp,BIO_NOCLOSE); 87 BIO_set_fp(b,fp,BIO_NOCLOSE);
101 ret=RSA_print(b,x,off); 88 ret=RSA_print(b,x,off);
102 BIO_free(b); 89 BIO_free(b);
103 return(ret); 90 return(ret);
104 } 91 }
105#endif 92#endif
106 93
107int RSA_print(BIO *bp, const RSA *x, int off) 94int RSA_print(BIO *bp, const RSA *x, int off)
@@ -109,7 +96,7 @@ int RSA_print(BIO *bp, const RSA *x, int off)
109 char str[128]; 96 char str[128];
110 const char *s; 97 const char *s;
111 unsigned char *m=NULL; 98 unsigned char *m=NULL;
112 int ret=0, mod_len = 0; 99 int ret=0;
113 size_t buf_len=0, i; 100 size_t buf_len=0, i;
114 101
115 if (x->n) 102 if (x->n)
@@ -143,37 +130,27 @@ int RSA_print(BIO *bp, const RSA *x, int off)
143 goto err; 130 goto err;
144 } 131 }
145 132
146 if (x->n != NULL)
147 mod_len = BN_num_bits(x->n);
148
149 if (x->d != NULL) 133 if (x->d != NULL)
150 { 134 {
151 if(!BIO_indent(bp,off,128)) 135 if(!BIO_indent(bp,off,128))
152 goto err; 136 goto err;
153 if (BIO_printf(bp,"Private-Key: (%d bit)\n", mod_len) 137 if (BIO_printf(bp,"Private-Key: (%d bit)\n",BN_num_bits(x->n))
154 <= 0) goto err; 138 <= 0) goto err;
155 } 139 }
156 140
157 if (x->d == NULL) 141 if (x->d == NULL)
158 BIO_snprintf(str,sizeof str,"Modulus (%d bit):", mod_len); 142 BIO_snprintf(str,sizeof str,"Modulus (%d bit):",BN_num_bits(x->n));
159 else 143 else
160 BUF_strlcpy(str,"modulus:",sizeof str); 144 BUF_strlcpy(str,"modulus:",sizeof str);
161 if (!print(bp,str,x->n,m,off)) goto err; 145 if (!print(bp,str,x->n,m,off)) goto err;
162 s=(x->d == NULL)?"Exponent:":"publicExponent:"; 146 s=(x->d == NULL)?"Exponent:":"publicExponent:";
163 if ((x->e != NULL) && !print(bp,s,x->e,m,off)) 147 if (!print(bp,s,x->e,m,off)) goto err;
164 goto err; 148 if (!print(bp,"privateExponent:",x->d,m,off)) goto err;
165 if ((x->d != NULL) && !print(bp,"privateExponent:",x->d,m,off)) 149 if (!print(bp,"prime1:",x->p,m,off)) goto err;
166 goto err; 150 if (!print(bp,"prime2:",x->q,m,off)) goto err;
167 if ((x->p != NULL) && !print(bp,"prime1:",x->p,m,off)) 151 if (!print(bp,"exponent1:",x->dmp1,m,off)) goto err;
168 goto err; 152 if (!print(bp,"exponent2:",x->dmq1,m,off)) goto err;
169 if ((x->q != NULL) && !print(bp,"prime2:",x->q,m,off)) 153 if (!print(bp,"coefficient:",x->iqmp,m,off)) goto err;
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; 154 ret=1;
178err: 155err:
179 if (m != NULL) OPENSSL_free(m); 156 if (m != NULL) OPENSSL_free(m);
@@ -208,11 +185,6 @@ int DSA_print(BIO *bp, const DSA *x, int off)
208 185
209 if (x->p) 186 if (x->p)
210 buf_len = (size_t)BN_num_bytes(x->p); 187 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) 188 if (x->q)
217 if (buf_len < (i = (size_t)BN_num_bytes(x->q))) 189 if (buf_len < (i = (size_t)BN_num_bytes(x->q)))
218 buf_len = i; 190 buf_len = i;
@@ -255,334 +227,16 @@ err:
255 } 227 }
256#endif /* !OPENSSL_NO_DSA */ 228#endif /* !OPENSSL_NO_DSA */
257 229
258#ifndef OPENSSL_NO_EC 230static int print(BIO *bp, const char *number, BIGNUM *num, unsigned char *buf,
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
494int EC_KEY_print(BIO *bp, const EC_KEY *x, int off)
495 {
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) 231 int off)
572 { 232 {
573 int n,i; 233 int n,i;
574 const char *neg; 234 const char *neg;
575 235
576 if (num == NULL) return(1); 236 if (num == NULL) return(1);
577 neg = (BN_is_negative(num))?"-":""; 237 neg=(num->neg)?"-":"";
578 if(!BIO_indent(bp,off,128)) 238 if(!BIO_indent(bp,off,128))
579 return 0; 239 return 0;
580 if (BN_is_zero(num))
581 {
582 if (BIO_printf(bp, "%s 0\n", number) <= 0)
583 return 0;
584 return 1;
585 }
586 240
587 if (BN_num_bytes(num) <= BN_BYTES) 241 if (BN_num_bytes(num) <= BN_BYTES)
588 { 242 {
@@ -618,63 +272,23 @@ static int print(BIO *bp, const char *number, const BIGNUM *num, unsigned char *
618 return(1); 272 return(1);
619 } 273 }
620 274
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 275#ifndef OPENSSL_NO_DH
662#ifndef OPENSSL_NO_FP_API 276#ifndef OPENSSL_NO_FP_API
663int DHparams_print_fp(FILE *fp, const DH *x) 277int DHparams_print_fp(FILE *fp, const DH *x)
664 { 278 {
665 BIO *b; 279 BIO *b;
666 int ret; 280 int ret;
667 281
668 if ((b=BIO_new(BIO_s_file())) == NULL) 282 if ((b=BIO_new(BIO_s_file())) == NULL)
669 { 283 {
670 DHerr(DH_F_DHPARAMS_PRINT_FP,ERR_R_BUF_LIB); 284 DHerr(DH_F_DHPARAMS_PRINT_FP,ERR_R_BUF_LIB);
671 return(0); 285 return(0);
672 } 286 }
673 BIO_set_fp(b,fp,BIO_NOCLOSE); 287 BIO_set_fp(b,fp,BIO_NOCLOSE);
674 ret=DHparams_print(b, x); 288 ret=DHparams_print(b, x);
675 BIO_free(b); 289 BIO_free(b);
676 return(ret); 290 return(ret);
677 } 291 }
678#endif 292#endif
679 293
680int DHparams_print(BIO *bp, const DH *x) 294int DHparams_print(BIO *bp, const DH *x)
@@ -685,11 +299,6 @@ int DHparams_print(BIO *bp, const DH *x)
685 299
686 if (x->p) 300 if (x->p)
687 buf_len = (size_t)BN_num_bytes(x->p); 301 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) 302 if (x->g)
694 if (buf_len < (i = (size_t)BN_num_bytes(x->g))) 303 if (buf_len < (i = (size_t)BN_num_bytes(x->g)))
695 buf_len = i; 304 buf_len = i;
@@ -724,35 +333,30 @@ err:
724#ifndef OPENSSL_NO_DSA 333#ifndef OPENSSL_NO_DSA
725#ifndef OPENSSL_NO_FP_API 334#ifndef OPENSSL_NO_FP_API
726int DSAparams_print_fp(FILE *fp, const DSA *x) 335int DSAparams_print_fp(FILE *fp, const DSA *x)
727 { 336 {
728 BIO *b; 337 BIO *b;
729 int ret; 338 int ret;
730 339
731 if ((b=BIO_new(BIO_s_file())) == NULL) 340 if ((b=BIO_new(BIO_s_file())) == NULL)
732 { 341 {
733 DSAerr(DSA_F_DSAPARAMS_PRINT_FP,ERR_R_BUF_LIB); 342 DSAerr(DSA_F_DSAPARAMS_PRINT_FP,ERR_R_BUF_LIB);
734 return(0); 343 return(0);
735 } 344 }
736 BIO_set_fp(b,fp,BIO_NOCLOSE); 345 BIO_set_fp(b,fp,BIO_NOCLOSE);
737 ret=DSAparams_print(b, x); 346 ret=DSAparams_print(b, x);
738 BIO_free(b); 347 BIO_free(b);
739 return(ret); 348 return(ret);
740 } 349 }
741#endif 350#endif
742 351
743int DSAparams_print(BIO *bp, const DSA *x) 352int DSAparams_print(BIO *bp, const DSA *x)
744 { 353 {
745 unsigned char *m=NULL; 354 unsigned char *m=NULL;
746 int ret=0; 355 int reason=ERR_R_BUF_LIB,ret=0;
747 size_t buf_len=0,i; 356 size_t buf_len=0,i;
748 357
749 if (x->p) 358 if (x->p)
750 buf_len = (size_t)BN_num_bytes(x->p); 359 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) 360 if (x->q)
757 if (buf_len < (i = (size_t)BN_num_bytes(x->q))) 361 if (buf_len < (i = (size_t)BN_num_bytes(x->q)))
758 buf_len = i; 362 buf_len = i;
@@ -762,7 +366,7 @@ int DSAparams_print(BIO *bp, const DSA *x)
762 m=(unsigned char *)OPENSSL_malloc(buf_len+10); 366 m=(unsigned char *)OPENSSL_malloc(buf_len+10);
763 if (m == NULL) 367 if (m == NULL)
764 { 368 {
765 DSAerr(DSA_F_DSAPARAMS_PRINT,ERR_R_MALLOC_FAILURE); 369 reason=ERR_R_MALLOC_FAILURE;
766 goto err; 370 goto err;
767 } 371 }
768 372
@@ -770,70 +374,14 @@ int DSAparams_print(BIO *bp, const DSA *x)
770 BN_num_bits(x->p)) <= 0) 374 BN_num_bits(x->p)) <= 0)
771 goto err; 375 goto err;
772 if (!print(bp,"p:",x->p,m,4)) goto err; 376 if (!print(bp,"p:",x->p,m,4)) goto err;
773 if ((x->q != NULL) && !print(bp,"q:",x->q,m,4)) goto err; 377 if (!print(bp,"q:",x->q,m,4)) goto err;
774 if ((x->g != NULL) && !print(bp,"g:",x->g,m,4)) goto err; 378 if (!print(bp,"g:",x->g,m,4)) goto err;
775 ret=1; 379 ret=1;
776err: 380err:
777 if (m != NULL) OPENSSL_free(m); 381 if (m != NULL) OPENSSL_free(m);
382 DSAerr(DSA_F_DSAPARAMS_PRINT,reason);
778 return(ret); 383 return(ret);
779 } 384 }
780 385
781#endif /* !OPENSSL_NO_DSA */ 386#endif /* !OPENSSL_NO_DSA */
782 387
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..740cee80c0 100644
--- a/src/lib/libcrypto/asn1/t_req.c
+++ b/src/lib/libcrypto/asn1/t_req.c
@@ -63,12 +63,6 @@
63#include <openssl/objects.h> 63#include <openssl/objects.h>
64#include <openssl/x509.h> 64#include <openssl/x509.h>
65#include <openssl/x509v3.h> 65#include <openssl/x509v3.h>
66#ifndef OPENSSL_NO_RSA
67#include <openssl/rsa.h>
68#endif
69#ifndef OPENSSL_NO_DSA
70#include <openssl/dsa.h>
71#endif
72 66
73#ifndef OPENSSL_NO_FP_API 67#ifndef OPENSSL_NO_FP_API
74int X509_REQ_print_fp(FILE *fp, X509_REQ *x) 68int X509_REQ_print_fp(FILE *fp, X509_REQ *x)
@@ -166,14 +160,6 @@ int X509_REQ_print_ex(BIO *bp, X509_REQ *x, unsigned long nmflags, unsigned long
166 } 160 }
167 else 161 else
168#endif 162#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",""); 163 BIO_printf(bp,"%12sUnknown Public Key:\n","");
178 164
179 EVP_PKEY_free(pkey); 165 EVP_PKEY_free(pkey);
@@ -244,7 +230,7 @@ get_next:
244 } 230 }
245 } 231 }
246 } 232 }
247 if(!(cflag & X509_FLAG_NO_EXTENSIONS)) 233 if(!(cflag & X509_FLAG_NO_ATTRIBUTES))
248 { 234 {
249 exts = X509_REQ_get_extensions(x); 235 exts = X509_REQ_get_extensions(x);
250 if(exts) 236 if(exts)
@@ -260,9 +246,9 @@ get_next:
260 obj=X509_EXTENSION_get_object(ex); 246 obj=X509_EXTENSION_get_object(ex);
261 i2a_ASN1_OBJECT(bp,obj); 247 i2a_ASN1_OBJECT(bp,obj);
262 j=X509_EXTENSION_get_critical(ex); 248 j=X509_EXTENSION_get_critical(ex);
263 if (BIO_printf(bp,": %s\n",j?"critical":"") <= 0) 249 if (BIO_printf(bp,": %s\n",j?"critical":"","") <= 0)
264 goto err; 250 goto err;
265 if(!X509V3_EXT_print(bp, ex, cflag, 16)) 251 if(!X509V3_EXT_print(bp, ex, 0, 16))
266 { 252 {
267 BIO_printf(bp, "%16s", ""); 253 BIO_printf(bp, "%16s", "");
268 M_ASN1_OCTET_STRING_print(bp,ex->value); 254 M_ASN1_OCTET_STRING_print(bp,ex->value);
@@ -280,7 +266,7 @@ get_next:
280 266
281 return(1); 267 return(1);
282err: 268err:
283 X509err(X509_F_X509_REQ_PRINT_EX,ERR_R_BUF_LIB); 269 X509err(X509_F_X509_REQ_PRINT,ERR_R_BUF_LIB);
284 return(0); 270 return(0);
285 } 271 }
286 272
diff --git a/src/lib/libcrypto/asn1/t_spki.c b/src/lib/libcrypto/asn1/t_spki.c
index c2a5797dd8..5abfbc815e 100644
--- a/src/lib/libcrypto/asn1/t_spki.c
+++ b/src/lib/libcrypto/asn1/t_spki.c
@@ -60,13 +60,6 @@
60#include "cryptlib.h" 60#include "cryptlib.h"
61#include <openssl/x509.h> 61#include <openssl/x509.h>
62#include <openssl/asn1.h> 62#include <openssl/asn1.h>
63#ifndef OPENSSL_NO_RSA
64#include <openssl/rsa.h>
65#endif
66#ifndef OPENSSL_NO_DSA
67#include <openssl/dsa.h>
68#endif
69#include <openssl/bn.h>
70 63
71/* Print out an SPKI */ 64/* Print out an SPKI */
72 65
@@ -100,15 +93,6 @@ int NETSCAPE_SPKI_print(BIO *out, NETSCAPE_SPKI *spki)
100 } 93 }
101 else 94 else
102#endif 95#endif
103#ifndef OPENSSL_NO_EC
104 if (pkey->type == EVP_PKEY_EC)
105 {
106 BIO_printf(out, " EC Public Key:\n");
107 EC_KEY_print(out, pkey->pkey.ec,2);
108 }
109 else
110#endif
111
112 BIO_printf(out," Unknown Public Key:\n"); 96 BIO_printf(out," Unknown Public Key:\n");
113 EVP_PKEY_free(pkey); 97 EVP_PKEY_free(pkey);
114 } 98 }
diff --git a/src/lib/libcrypto/asn1/t_x509.c b/src/lib/libcrypto/asn1/t_x509.c
index eb776b7b3b..30f68561b7 100644
--- a/src/lib/libcrypto/asn1/t_x509.c
+++ b/src/lib/libcrypto/asn1/t_x509.c
@@ -66,9 +66,6 @@
66#ifndef OPENSSL_NO_DSA 66#ifndef OPENSSL_NO_DSA
67#include <openssl/dsa.h> 67#include <openssl/dsa.h>
68#endif 68#endif
69#ifndef OPENSSL_NO_EC
70#include <openssl/ec.h>
71#endif
72#include <openssl/objects.h> 69#include <openssl/objects.h>
73#include <openssl/x509.h> 70#include <openssl/x509.h>
74#include <openssl/x509v3.h> 71#include <openssl/x509v3.h>
@@ -86,7 +83,7 @@ int X509_print_ex_fp(FILE *fp, X509 *x, unsigned long nmflag, unsigned long cfla
86 83
87 if ((b=BIO_new(BIO_s_file())) == NULL) 84 if ((b=BIO_new(BIO_s_file())) == NULL)
88 { 85 {
89 X509err(X509_F_X509_PRINT_EX_FP,ERR_R_BUF_LIB); 86 X509err(X509_F_X509_PRINT_FP,ERR_R_BUF_LIB);
90 return(0); 87 return(0);
91 } 88 }
92 BIO_set_fp(b,fp,BIO_NOCLOSE); 89 BIO_set_fp(b,fp,BIO_NOCLOSE);
@@ -232,14 +229,6 @@ int X509_print_ex(BIO *bp, X509 *x, unsigned long nmflags, unsigned long cflag)
232 } 229 }
233 else 230 else
234#endif 231#endif
235#ifndef OPENSSL_NO_EC
236 if (pkey->type == EVP_PKEY_EC)
237 {
238 BIO_printf(bp, "%12sEC Public Key:\n","");
239 EC_KEY_print(bp, pkey->pkey.ec, 16);
240 }
241 else
242#endif
243 BIO_printf(bp,"%12sUnknown Public Key:\n",""); 232 BIO_printf(bp,"%12sUnknown Public Key:\n","");
244 233
245 EVP_PKEY_free(pkey); 234 EVP_PKEY_free(pkey);
@@ -332,7 +321,7 @@ int X509_signature_print(BIO *bp, X509_ALGOR *sigalg, ASN1_STRING *sig)
332int ASN1_STRING_print(BIO *bp, ASN1_STRING *v) 321int ASN1_STRING_print(BIO *bp, ASN1_STRING *v)
333 { 322 {
334 int i,n; 323 int i,n;
335 char buf[80],*p;; 324 char buf[80],*p;
336 325
337 if (v == NULL) return(0); 326 if (v == NULL) return(0);
338 n=0; 327 n=0;
@@ -445,18 +434,19 @@ err:
445int X509_NAME_print(BIO *bp, X509_NAME *name, int obase) 434int X509_NAME_print(BIO *bp, X509_NAME *name, int obase)
446 { 435 {
447 char *s,*c,*b; 436 char *s,*c,*b;
448 int ret=0,l,i; 437 int ret=0,l,ll,i,first=1;
449 438
450 l=80-2-obase; 439 ll=80-2-obase;
451 440
452 b=X509_NAME_oneline(name,NULL,0); 441 b=s=X509_NAME_oneline(name,NULL,0);
453 if (!*b) 442 if (!*s)
454 { 443 {
455 OPENSSL_free(b); 444 OPENSSL_free(b);
456 return 1; 445 return 1;
457 } 446 }
458 s=b+1; /* skip the first slash */ 447 s++; /* skip the first slash */
459 448
449 l=ll;
460 c=s; 450 c=s;
461 for (;;) 451 for (;;)
462 { 452 {
@@ -478,9 +468,20 @@ int X509_NAME_print(BIO *bp, X509_NAME *name, int obase)
478 (*s == '\0')) 468 (*s == '\0'))
479#endif 469#endif
480 { 470 {
471 if ((l <= 0) && !first)
472 {
473 first=0;
474 if (BIO_write(bp,"\n",1) != 1) goto err;
475 for (i=0; i<obase; i++)
476 {
477 if (BIO_write(bp," ",1) != 1) goto err;
478 }
479 l=ll;
480 }
481 i=s-c; 481 i=s-c;
482 if (BIO_write(bp,c,i) != i) goto err; 482 if (BIO_write(bp,c,i) != i) goto err;
483 c=s+1; /* skip following slash */ 483 c+=i;
484 c++;
484 if (*s != '\0') 485 if (*s != '\0')
485 { 486 {
486 if (BIO_write(bp,", ",2) != 2) goto err; 487 if (BIO_write(bp,", ",2) != 2) goto err;
diff --git a/src/lib/libcrypto/asn1/tasn_dec.c b/src/lib/libcrypto/asn1/tasn_dec.c
index 0ee406231e..b7e916ef36 100644
--- a/src/lib/libcrypto/asn1/tasn_dec.c
+++ b/src/lib/libcrypto/asn1/tasn_dec.c
@@ -3,7 +3,7 @@
3 * project 2000. 3 * project 2000.
4 */ 4 */
5/* ==================================================================== 5/* ====================================================================
6 * Copyright (c) 2000-2005 The OpenSSL Project. All rights reserved. 6 * Copyright (c) 2000 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
@@ -65,40 +65,24 @@
65#include <openssl/buffer.h> 65#include <openssl/buffer.h>
66#include <openssl/err.h> 66#include <openssl/err.h>
67 67
68static int asn1_check_eoc(const unsigned char **in, long len); 68static int asn1_check_eoc(unsigned char **in, long len);
69static int asn1_find_end(const unsigned char **in, long len, char inf); 69static int asn1_find_end(unsigned char **in, long len, char inf);
70 70static int asn1_collect(BUF_MEM *buf, unsigned char **in, long len, char inf, int tag, int aclass);
71static int asn1_collect(BUF_MEM *buf, const unsigned char **in, long len, 71static int collect_data(BUF_MEM *buf, unsigned char **p, long plen);
72 char inf, int tag, int aclass); 72static int asn1_check_tlen(long *olen, int *otag, unsigned char *oclass, char *inf, char *cst,
73 73 unsigned char **in, long len, int exptag, int expclass, char opt, ASN1_TLC *ctx);
74static int collect_data(BUF_MEM *buf, const unsigned char **p, long plen); 74static int asn1_template_ex_d2i(ASN1_VALUE **pval, unsigned char **in, long len, const ASN1_TEMPLATE *tt, char opt, ASN1_TLC *ctx);
75 75static int asn1_template_noexp_d2i(ASN1_VALUE **val, unsigned char **in, long len, const ASN1_TEMPLATE *tt, char opt, ASN1_TLC *ctx);
76static int asn1_check_tlen(long *olen, int *otag, unsigned char *oclass, 76static int asn1_d2i_ex_primitive(ASN1_VALUE **pval, unsigned char **in, long len,
77 char *inf, char *cst, 77 const ASN1_ITEM *it, int tag, int aclass, char opt, ASN1_TLC *ctx);
78 const unsigned char **in, long len,
79 int exptag, int expclass, char opt,
80 ASN1_TLC *ctx);
81
82static int asn1_template_ex_d2i(ASN1_VALUE **pval,
83 const unsigned char **in, long len,
84 const ASN1_TEMPLATE *tt, char opt,
85 ASN1_TLC *ctx);
86static int asn1_template_noexp_d2i(ASN1_VALUE **val,
87 const unsigned char **in, long len,
88 const ASN1_TEMPLATE *tt, char opt,
89 ASN1_TLC *ctx);
90static int asn1_d2i_ex_primitive(ASN1_VALUE **pval,
91 const unsigned char **in, long len,
92 const ASN1_ITEM *it,
93 int tag, int aclass, char opt, ASN1_TLC *ctx);
94 78
95/* Table to convert tags to bit values, used for MSTRING type */ 79/* Table to convert tags to bit values, used for MSTRING type */
96static const unsigned long tag2bit[32] = { 80static unsigned long tag2bit[32]={
970, 0, 0, B_ASN1_BIT_STRING, /* tags 0 - 3 */ 810, 0, 0, B_ASN1_BIT_STRING, /* tags 0 - 3 */
98B_ASN1_OCTET_STRING, 0, 0, B_ASN1_UNKNOWN,/* tags 4- 7 */ 82B_ASN1_OCTET_STRING, 0, 0, B_ASN1_UNKNOWN,/* tags 4- 7 */
99B_ASN1_UNKNOWN, B_ASN1_UNKNOWN, B_ASN1_UNKNOWN, B_ASN1_UNKNOWN,/* tags 8-11 */ 83B_ASN1_UNKNOWN, B_ASN1_UNKNOWN, B_ASN1_UNKNOWN, B_ASN1_UNKNOWN,/* tags 8-11 */
100B_ASN1_UTF8STRING,B_ASN1_UNKNOWN,B_ASN1_UNKNOWN,B_ASN1_UNKNOWN,/* tags 12-15 */ 84B_ASN1_UTF8STRING,B_ASN1_UNKNOWN,B_ASN1_UNKNOWN,B_ASN1_UNKNOWN,/* tags 12-15 */
101B_ASN1_SEQUENCE,0,B_ASN1_NUMERICSTRING,B_ASN1_PRINTABLESTRING, /* tags 16-19 */ 850, 0, B_ASN1_NUMERICSTRING,B_ASN1_PRINTABLESTRING, /* tags 16-19 */
102B_ASN1_T61STRING,B_ASN1_VIDEOTEXSTRING,B_ASN1_IA5STRING, /* tags 20-22 */ 86B_ASN1_T61STRING,B_ASN1_VIDEOTEXSTRING,B_ASN1_IA5STRING, /* tags 20-22 */
103B_ASN1_UTCTIME, B_ASN1_GENERALIZEDTIME, /* tags 23-24 */ 87B_ASN1_UTCTIME, B_ASN1_GENERALIZEDTIME, /* tags 23-24 */
104B_ASN1_GRAPHICSTRING,B_ASN1_ISO64STRING,B_ASN1_GENERALSTRING, /* tags 25-27 */ 88B_ASN1_GRAPHICSTRING,B_ASN1_ISO64STRING,B_ASN1_GENERALSTRING, /* tags 25-27 */
@@ -106,14 +90,14 @@ B_ASN1_UNIVERSALSTRING,B_ASN1_UNKNOWN,B_ASN1_BMPSTRING,B_ASN1_UNKNOWN, /* tags 2
106 }; 90 };
107 91
108unsigned long ASN1_tag2bit(int tag) 92unsigned long ASN1_tag2bit(int tag)
109 { 93{
110 if ((tag < 0) || (tag > 30)) return 0; 94 if((tag < 0) || (tag > 30)) return 0;
111 return tag2bit[tag]; 95 return tag2bit[tag];
112 } 96}
113 97
114/* Macro to initialize and invalidate the cache */ 98/* Macro to initialize and invalidate the cache */
115 99
116#define asn1_tlc_clear(c) if (c) (c)->valid = 0 100#define asn1_tlc_clear(c) if(c) (c)->valid = 0
117 101
118/* Decode an ASN1 item, this currently behaves just 102/* Decode an ASN1 item, this currently behaves just
119 * like a standard 'd2i' function. 'in' points to 103 * like a standard 'd2i' function. 'in' points to
@@ -123,147 +107,113 @@ unsigned long ASN1_tag2bit(int tag)
123 * case. 107 * case.
124 */ 108 */
125 109
126ASN1_VALUE *ASN1_item_d2i(ASN1_VALUE **pval, 110ASN1_VALUE *ASN1_item_d2i(ASN1_VALUE **pval, unsigned char **in, long len, const ASN1_ITEM *it)
127 const unsigned char **in, long len, const ASN1_ITEM *it) 111{
128 {
129 ASN1_TLC c; 112 ASN1_TLC c;
130 ASN1_VALUE *ptmpval = NULL; 113 ASN1_VALUE *ptmpval = NULL;
131 if (!pval) 114 if(!pval) pval = &ptmpval;
132 pval = &ptmpval; 115 asn1_tlc_clear(&c);
133 c.valid = 0; 116 if(ASN1_item_ex_d2i(pval, in, len, it, -1, 0, 0, &c) > 0)
134 if (ASN1_item_ex_d2i(pval, in, len, it, -1, 0, 0, &c) > 0)
135 return *pval; 117 return *pval;
136 return NULL; 118 return NULL;
137 } 119}
138 120
139int ASN1_template_d2i(ASN1_VALUE **pval, 121int ASN1_template_d2i(ASN1_VALUE **pval, unsigned char **in, long len, const ASN1_TEMPLATE *tt)
140 const unsigned char **in, long len, const ASN1_TEMPLATE *tt) 122{
141 {
142 ASN1_TLC c; 123 ASN1_TLC c;
143 c.valid = 0; 124 asn1_tlc_clear(&c);
144 return asn1_template_ex_d2i(pval, in, len, tt, 0, &c); 125 return asn1_template_ex_d2i(pval, in, len, tt, 0, &c);
145 } 126}
146 127
147 128
148/* Decode an item, taking care of IMPLICIT tagging, if any. 129/* Decode an item, taking care of IMPLICIT tagging, if any.
149 * If 'opt' set and tag mismatch return -1 to handle OPTIONAL 130 * If 'opt' set and tag mismatch return -1 to handle OPTIONAL
150 */ 131 */
151 132
152int ASN1_item_ex_d2i(ASN1_VALUE **pval, const unsigned char **in, long len, 133int ASN1_item_ex_d2i(ASN1_VALUE **pval, unsigned char **in, long len, const ASN1_ITEM *it,
153 const ASN1_ITEM *it, 134 int tag, int aclass, char opt, ASN1_TLC *ctx)
154 int tag, int aclass, char opt, ASN1_TLC *ctx) 135{
155 {
156 const ASN1_TEMPLATE *tt, *errtt = NULL; 136 const ASN1_TEMPLATE *tt, *errtt = NULL;
157 const ASN1_COMPAT_FUNCS *cf; 137 const ASN1_COMPAT_FUNCS *cf;
158 const ASN1_EXTERN_FUNCS *ef; 138 const ASN1_EXTERN_FUNCS *ef;
159 const ASN1_AUX *aux = it->funcs; 139 const ASN1_AUX *aux = it->funcs;
160 ASN1_aux_cb *asn1_cb; 140 ASN1_aux_cb *asn1_cb;
161 const unsigned char *p = NULL, *q; 141 unsigned char *p, *q, imphack = 0, oclass;
162 unsigned char *wp=NULL; /* BIG FAT WARNING! BREAKS CONST WHERE USED */
163 unsigned char imphack = 0, oclass;
164 char seq_eoc, seq_nolen, cst, isopt; 142 char seq_eoc, seq_nolen, cst, isopt;
165 long tmplen; 143 long tmplen;
166 int i; 144 int i;
167 int otag; 145 int otag;
168 int ret = 0; 146 int ret = 0;
169 ASN1_VALUE *pchval, **pchptr, *ptmpval; 147 ASN1_VALUE *pchval, **pchptr, *ptmpval;
170 if (!pval) 148 if(!pval) return 0;
171 return 0; 149 if(aux && aux->asn1_cb) asn1_cb = aux->asn1_cb;
172 if (aux && aux->asn1_cb)
173 asn1_cb = aux->asn1_cb;
174 else asn1_cb = 0; 150 else asn1_cb = 0;
175 151
176 switch(it->itype) 152 switch(it->itype) {
177 { 153
178 case ASN1_ITYPE_PRIMITIVE: 154 case ASN1_ITYPE_PRIMITIVE:
179 if (it->templates) 155 if(it->templates) {
180 { 156 /* tagging or OPTIONAL is currently illegal on an item template
181 /* tagging or OPTIONAL is currently illegal on an item 157 * because the flags can't get passed down. In practice this isn't
182 * template because the flags can't get passed down. 158 * a problem: we include the relevant flags from the item template
183 * In practice this isn't a problem: we include the 159 * in the template itself.
184 * relevant flags from the item template in the
185 * template itself.
186 */ 160 */
187 if ((tag != -1) || opt) 161 if ((tag != -1) || opt) {
188 { 162 ASN1err(ASN1_F_ASN1_ITEM_EX_D2I, ASN1_R_ILLEGAL_OPTIONS_ON_ITEM_TEMPLATE);
189 ASN1err(ASN1_F_ASN1_ITEM_EX_D2I,
190 ASN1_R_ILLEGAL_OPTIONS_ON_ITEM_TEMPLATE);
191 goto err; 163 goto err;
192 } 164 }
193 return asn1_template_ex_d2i(pval, in, len, 165 return asn1_template_ex_d2i(pval, in, len, it->templates, opt, ctx);
194 it->templates, opt, ctx);
195 } 166 }
196 return asn1_d2i_ex_primitive(pval, in, len, it, 167 return asn1_d2i_ex_primitive(pval, in, len, it, tag, aclass, opt, ctx);
197 tag, aclass, opt, ctx);
198 break; 168 break;
199 169
200 case ASN1_ITYPE_MSTRING: 170 case ASN1_ITYPE_MSTRING:
201 p = *in; 171 p = *in;
202 /* Just read in tag and class */ 172 /* Just read in tag and class */
203 ret = asn1_check_tlen(NULL, &otag, &oclass, NULL, NULL, 173 ret = asn1_check_tlen(NULL, &otag, &oclass, NULL, NULL, &p, len, -1, 0, 1, ctx);
204 &p, len, -1, 0, 1, ctx); 174 if(!ret) {
205 if (!ret) 175 ASN1err(ASN1_F_ASN1_ITEM_EX_D2I, ERR_R_NESTED_ASN1_ERROR);
206 {
207 ASN1err(ASN1_F_ASN1_ITEM_EX_D2I,
208 ERR_R_NESTED_ASN1_ERROR);
209 goto err; 176 goto err;
210 } 177 }
211
212 /* Must be UNIVERSAL class */ 178 /* Must be UNIVERSAL class */
213 if (oclass != V_ASN1_UNIVERSAL) 179 if(oclass != V_ASN1_UNIVERSAL) {
214 {
215 /* If OPTIONAL, assume this is OK */ 180 /* If OPTIONAL, assume this is OK */
216 if (opt) return -1; 181 if(opt) return -1;
217 ASN1err(ASN1_F_ASN1_ITEM_EX_D2I, 182 ASN1err(ASN1_F_ASN1_ITEM_EX_D2I, ASN1_R_MSTRING_NOT_UNIVERSAL);
218 ASN1_R_MSTRING_NOT_UNIVERSAL);
219 goto err; 183 goto err;
220 } 184 }
221 /* Check tag matches bit map */ 185 /* Check tag matches bit map */
222 if (!(ASN1_tag2bit(otag) & it->utype)) 186 if(!(ASN1_tag2bit(otag) & it->utype)) {
223 {
224 /* If OPTIONAL, assume this is OK */ 187 /* If OPTIONAL, assume this is OK */
225 if (opt) 188 if(opt) return -1;
226 return -1; 189 ASN1err(ASN1_F_ASN1_ITEM_EX_D2I, ASN1_R_MSTRING_WRONG_TAG);
227 ASN1err(ASN1_F_ASN1_ITEM_EX_D2I,
228 ASN1_R_MSTRING_WRONG_TAG);
229 goto err; 190 goto err;
230 } 191 }
231 return asn1_d2i_ex_primitive(pval, in, len, 192 return asn1_d2i_ex_primitive(pval, in, len, it, otag, 0, 0, ctx);
232 it, otag, 0, 0, ctx);
233 193
234 case ASN1_ITYPE_EXTERN: 194 case ASN1_ITYPE_EXTERN:
235 /* Use new style d2i */ 195 /* Use new style d2i */
236 ef = it->funcs; 196 ef = it->funcs;
237 return ef->asn1_ex_d2i(pval, in, len, 197 return ef->asn1_ex_d2i(pval, in, len, it, tag, aclass, opt, ctx);
238 it, tag, aclass, opt, ctx);
239 198
240 case ASN1_ITYPE_COMPAT: 199 case ASN1_ITYPE_COMPAT:
241 /* we must resort to old style evil hackery */ 200 /* we must resort to old style evil hackery */
242 cf = it->funcs; 201 cf = it->funcs;
243 202
244 /* If OPTIONAL see if it is there */ 203 /* If OPTIONAL see if it is there */
245 if (opt) 204 if(opt) {
246 {
247 int exptag; 205 int exptag;
248 p = *in; 206 p = *in;
249 if (tag == -1) 207 if(tag == -1) exptag = it->utype;
250 exptag = it->utype;
251 else exptag = tag; 208 else exptag = tag;
252 /* Don't care about anything other than presence 209 /* Don't care about anything other than presence of expected tag */
253 * of expected tag */ 210 ret = asn1_check_tlen(NULL, NULL, NULL, NULL, NULL, &p, len, exptag, aclass, 1, ctx);
254 211 if(!ret) {
255 ret = asn1_check_tlen(NULL, NULL, NULL, NULL, NULL, 212 ASN1err(ASN1_F_ASN1_ITEM_EX_D2I, ERR_R_NESTED_ASN1_ERROR);
256 &p, len, exptag, aclass, 1, ctx);
257 if (!ret)
258 {
259 ASN1err(ASN1_F_ASN1_ITEM_EX_D2I,
260 ERR_R_NESTED_ASN1_ERROR);
261 goto err; 213 goto err;
262 }
263 if (ret == -1)
264 return -1;
265 } 214 }
266 215 if(ret == -1) return -1;
216 }
267 /* This is the old style evil hack IMPLICIT handling: 217 /* This is the old style evil hack IMPLICIT handling:
268 * since the underlying code is expecting a tag and 218 * since the underlying code is expecting a tag and
269 * class other than the one present we change the 219 * class other than the one present we change the
@@ -279,332 +229,245 @@ int ASN1_item_ex_d2i(ASN1_VALUE **pval, const unsigned char **in, long len,
279 * buffer. 229 * buffer.
280 */ 230 */
281 231
282 if (tag != -1) 232 if(tag != -1) {
283 { 233 p = *in;
284 wp = *(unsigned char **)in; 234 imphack = *p;
285 imphack = *wp; 235 *p = (unsigned char)((*p & V_ASN1_CONSTRUCTED) | it->utype);
286 if (p == NULL) 236 }
287 {
288 ASN1err(ASN1_F_ASN1_ITEM_EX_D2I,
289 ERR_R_NESTED_ASN1_ERROR);
290 goto err;
291 }
292 *wp = (unsigned char)((*p & V_ASN1_CONSTRUCTED)
293 | it->utype);
294 }
295 237
296 ptmpval = cf->asn1_d2i(pval, in, len); 238 ptmpval = cf->asn1_d2i(pval, in, len);
297 239
298 if (tag != -1) 240 if(tag != -1) *p = imphack;
299 *wp = imphack;
300
301 if (ptmpval)
302 return 1;
303 241
242 if(ptmpval) return 1;
304 ASN1err(ASN1_F_ASN1_ITEM_EX_D2I, ERR_R_NESTED_ASN1_ERROR); 243 ASN1err(ASN1_F_ASN1_ITEM_EX_D2I, ERR_R_NESTED_ASN1_ERROR);
305 goto err; 244 goto err;
306 245
307 246
308 case ASN1_ITYPE_CHOICE: 247 case ASN1_ITYPE_CHOICE:
309 if (asn1_cb && !asn1_cb(ASN1_OP_D2I_PRE, pval, it)) 248 if(asn1_cb && !asn1_cb(ASN1_OP_D2I_PRE, pval, it))
310 goto auxerr; 249 goto auxerr;
311 250
312 /* Allocate structure */ 251 /* Allocate structure */
313 if (!*pval && !ASN1_item_ex_new(pval, it)) 252 if(!*pval) {
314 { 253 if(!ASN1_item_ex_new(pval, it)) {
315 ASN1err(ASN1_F_ASN1_ITEM_EX_D2I, 254 ASN1err(ASN1_F_ASN1_ITEM_EX_D2I, ERR_R_NESTED_ASN1_ERROR);
316 ERR_R_NESTED_ASN1_ERROR); 255 goto err;
317 goto err;
318 } 256 }
257 }
319 /* CHOICE type, try each possibility in turn */ 258 /* CHOICE type, try each possibility in turn */
320 pchval = NULL; 259 pchval = NULL;
321 p = *in; 260 p = *in;
322 for (i = 0, tt=it->templates; i < it->tcount; i++, tt++) 261 for(i = 0, tt=it->templates; i < it->tcount; i++, tt++) {
323 {
324 pchptr = asn1_get_field_ptr(pval, tt); 262 pchptr = asn1_get_field_ptr(pval, tt);
325 /* We mark field as OPTIONAL so its absence 263 /* We mark field as OPTIONAL so its absence
326 * can be recognised. 264 * can be recognised.
327 */ 265 */
328 ret = asn1_template_ex_d2i(pchptr, &p, len, tt, 1, ctx); 266 ret = asn1_template_ex_d2i(pchptr, &p, len, tt, 1, ctx);
329 /* If field not present, try the next one */ 267 /* If field not present, try the next one */
330 if (ret == -1) 268 if(ret == -1) continue;
331 continue;
332 /* If positive return, read OK, break loop */ 269 /* If positive return, read OK, break loop */
333 if (ret > 0) 270 if(ret > 0) break;
334 break;
335 /* Otherwise must be an ASN1 parsing error */ 271 /* Otherwise must be an ASN1 parsing error */
336 errtt = tt; 272 errtt = tt;
337 ASN1err(ASN1_F_ASN1_ITEM_EX_D2I, 273 ASN1err(ASN1_F_ASN1_ITEM_EX_D2I, ERR_R_NESTED_ASN1_ERROR);
338 ERR_R_NESTED_ASN1_ERROR);
339 goto err; 274 goto err;
340 } 275 }
341
342 /* Did we fall off the end without reading anything? */ 276 /* Did we fall off the end without reading anything? */
343 if (i == it->tcount) 277 if(i == it->tcount) {
344 {
345 /* If OPTIONAL, this is OK */ 278 /* If OPTIONAL, this is OK */
346 if (opt) 279 if(opt) {
347 {
348 /* Free and zero it */ 280 /* Free and zero it */
349 ASN1_item_ex_free(pval, it); 281 ASN1_item_ex_free(pval, it);
350 return -1; 282 return -1;
351 }
352 ASN1err(ASN1_F_ASN1_ITEM_EX_D2I,
353 ASN1_R_NO_MATCHING_CHOICE_TYPE);
354 goto err;
355 } 283 }
356 284 ASN1err(ASN1_F_ASN1_ITEM_EX_D2I, ASN1_R_NO_MATCHING_CHOICE_TYPE);
285 goto err;
286 }
357 asn1_set_choice_selector(pval, i, it); 287 asn1_set_choice_selector(pval, i, it);
358 *in = p; 288 *in = p;
359 if (asn1_cb && !asn1_cb(ASN1_OP_D2I_POST, pval, it)) 289 if(asn1_cb && !asn1_cb(ASN1_OP_D2I_POST, pval, it))
360 goto auxerr; 290 goto auxerr;
361 return 1; 291 return 1;
362 292
363 case ASN1_ITYPE_NDEF_SEQUENCE:
364 case ASN1_ITYPE_SEQUENCE: 293 case ASN1_ITYPE_SEQUENCE:
365 p = *in; 294 p = *in;
366 tmplen = len; 295 tmplen = len;
367 296
368 /* If no IMPLICIT tagging set to SEQUENCE, UNIVERSAL */ 297 /* If no IMPLICIT tagging set to SEQUENCE, UNIVERSAL */
369 if (tag == -1) 298 if(tag == -1) {
370 {
371 tag = V_ASN1_SEQUENCE; 299 tag = V_ASN1_SEQUENCE;
372 aclass = V_ASN1_UNIVERSAL; 300 aclass = V_ASN1_UNIVERSAL;
373 } 301 }
374 /* Get SEQUENCE length and update len, p */ 302 /* Get SEQUENCE length and update len, p */
375 ret = asn1_check_tlen(&len, NULL, NULL, &seq_eoc, &cst, 303 ret = asn1_check_tlen(&len, NULL, NULL, &seq_eoc, &cst, &p, len, tag, aclass, opt, ctx);
376 &p, len, tag, aclass, opt, ctx); 304 if(!ret) {
377 if (!ret) 305 ASN1err(ASN1_F_ASN1_ITEM_EX_D2I, ERR_R_NESTED_ASN1_ERROR);
378 {
379 ASN1err(ASN1_F_ASN1_ITEM_EX_D2I,
380 ERR_R_NESTED_ASN1_ERROR);
381 goto err; 306 goto err;
382 } 307 } else if(ret == -1) return -1;
383 else if (ret == -1) 308 if(aux && (aux->flags & ASN1_AFLG_BROKEN)) {
384 return -1;
385 if (aux && (aux->flags & ASN1_AFLG_BROKEN))
386 {
387 len = tmplen - (p - *in); 309 len = tmplen - (p - *in);
388 seq_nolen = 1; 310 seq_nolen = 1;
389 } 311 } else seq_nolen = seq_eoc; /* If indefinite we don't do a length check */
390 /* If indefinite we don't do a length check */ 312 if(!cst) {
391 else seq_nolen = seq_eoc; 313 ASN1err(ASN1_F_ASN1_ITEM_EX_D2I, ASN1_R_SEQUENCE_NOT_CONSTRUCTED);
392 if (!cst)
393 {
394 ASN1err(ASN1_F_ASN1_ITEM_EX_D2I,
395 ASN1_R_SEQUENCE_NOT_CONSTRUCTED);
396 goto err; 314 goto err;
397 } 315 }
398 316
399 if (!*pval && !ASN1_item_ex_new(pval, it)) 317 if(!*pval) {
400 { 318 if(!ASN1_item_ex_new(pval, it)) {
401 ASN1err(ASN1_F_ASN1_ITEM_EX_D2I, 319 ASN1err(ASN1_F_ASN1_ITEM_EX_D2I, ERR_R_NESTED_ASN1_ERROR);
402 ERR_R_NESTED_ASN1_ERROR); 320 goto err;
403 goto err;
404 } 321 }
405 322 }
406 if (asn1_cb && !asn1_cb(ASN1_OP_D2I_PRE, pval, it)) 323 if(asn1_cb && !asn1_cb(ASN1_OP_D2I_PRE, pval, it))
407 goto auxerr; 324 goto auxerr;
408 325
409 /* Get each field entry */ 326 /* Get each field entry */
410 for (i = 0, tt = it->templates; i < it->tcount; i++, tt++) 327 for(i = 0, tt = it->templates; i < it->tcount; i++, tt++) {
411 {
412 const ASN1_TEMPLATE *seqtt; 328 const ASN1_TEMPLATE *seqtt;
413 ASN1_VALUE **pseqval; 329 ASN1_VALUE **pseqval;
414 seqtt = asn1_do_adb(pval, tt, 1); 330 seqtt = asn1_do_adb(pval, tt, 1);
415 if (!seqtt) 331 if(!seqtt) goto err;
416 goto err;
417 pseqval = asn1_get_field_ptr(pval, seqtt); 332 pseqval = asn1_get_field_ptr(pval, seqtt);
418 /* Have we ran out of data? */ 333 /* Have we ran out of data? */
419 if (!len) 334 if(!len) break;
420 break;
421 q = p; 335 q = p;
422 if (asn1_check_eoc(&p, len)) 336 if(asn1_check_eoc(&p, len)) {
423 { 337 if(!seq_eoc) {
424 if (!seq_eoc) 338 ASN1err(ASN1_F_ASN1_ITEM_EX_D2I, ASN1_R_UNEXPECTED_EOC);
425 {
426 ASN1err(ASN1_F_ASN1_ITEM_EX_D2I,
427 ASN1_R_UNEXPECTED_EOC);
428 goto err; 339 goto err;
429 } 340 }
430 len -= p - q; 341 len -= p - q;
431 seq_eoc = 0; 342 seq_eoc = 0;
432 q = p; 343 q = p;
433 break; 344 break;
434 } 345 }
435 /* This determines the OPTIONAL flag value. The field 346 /* This determines the OPTIONAL flag value. The field cannot
436 * cannot be omitted if it is the last of a SEQUENCE 347 * be omitted if it is the last of a SEQUENCE and there is
437 * and there is still data to be read. This isn't 348 * still data to be read. This isn't strictly necessary but
438 * strictly necessary but it increases efficiency in 349 * it increases efficiency in some cases.
439 * some cases.
440 */ 350 */
441 if (i == (it->tcount - 1)) 351 if(i == (it->tcount - 1)) isopt = 0;
442 isopt = 0;
443 else isopt = (char)(seqtt->flags & ASN1_TFLG_OPTIONAL); 352 else isopt = (char)(seqtt->flags & ASN1_TFLG_OPTIONAL);
444 /* attempt to read in field, allowing each to be 353 /* attempt to read in field, allowing each to be OPTIONAL */
445 * OPTIONAL */ 354 ret = asn1_template_ex_d2i(pseqval, &p, len, seqtt, isopt, ctx);
446 355 if(!ret) {
447 ret = asn1_template_ex_d2i(pseqval, &p, len,
448 seqtt, isopt, ctx);
449 if (!ret)
450 {
451 errtt = seqtt; 356 errtt = seqtt;
452 goto err; 357 goto err;
453 } 358 } else if(ret == -1) {
454 else if (ret == -1) 359 /* OPTIONAL component absent. Free and zero the field
455 {
456 /* OPTIONAL component absent.
457 * Free and zero the field.
458 */ 360 */
459 ASN1_template_free(pseqval, seqtt); 361 ASN1_template_free(pseqval, seqtt);
460 continue; 362 continue;
461 } 363 }
462 /* Update length */ 364 /* Update length */
463 len -= p - q; 365 len -= p - q;
464 } 366 }
465
466 /* Check for EOC if expecting one */ 367 /* Check for EOC if expecting one */
467 if (seq_eoc && !asn1_check_eoc(&p, len)) 368 if(seq_eoc && !asn1_check_eoc(&p, len)) {
468 {
469 ASN1err(ASN1_F_ASN1_ITEM_EX_D2I, ASN1_R_MISSING_EOC); 369 ASN1err(ASN1_F_ASN1_ITEM_EX_D2I, ASN1_R_MISSING_EOC);
470 goto err; 370 goto err;
471 } 371 }
472 /* Check all data read */ 372 /* Check all data read */
473 if (!seq_nolen && len) 373 if(!seq_nolen && len) {
474 { 374 ASN1err(ASN1_F_ASN1_ITEM_EX_D2I, ASN1_R_SEQUENCE_LENGTH_MISMATCH);
475 ASN1err(ASN1_F_ASN1_ITEM_EX_D2I,
476 ASN1_R_SEQUENCE_LENGTH_MISMATCH);
477 goto err; 375 goto err;
478 } 376 }
479 377
480 /* If we get here we've got no more data in the SEQUENCE, 378 /* If we get here we've got no more data in the SEQUENCE,
481 * however we may not have read all fields so check all 379 * however we may not have read all fields so check all
482 * remaining are OPTIONAL and clear any that are. 380 * remaining are OPTIONAL and clear any that are.
483 */ 381 */
484 for (; i < it->tcount; tt++, i++) 382 for(; i < it->tcount; tt++, i++) {
485 {
486 const ASN1_TEMPLATE *seqtt; 383 const ASN1_TEMPLATE *seqtt;
487 seqtt = asn1_do_adb(pval, tt, 1); 384 seqtt = asn1_do_adb(pval, tt, 1);
488 if (!seqtt) 385 if(!seqtt) goto err;
489 goto err; 386 if(seqtt->flags & ASN1_TFLG_OPTIONAL) {
490 if (seqtt->flags & ASN1_TFLG_OPTIONAL)
491 {
492 ASN1_VALUE **pseqval; 387 ASN1_VALUE **pseqval;
493 pseqval = asn1_get_field_ptr(pval, seqtt); 388 pseqval = asn1_get_field_ptr(pval, seqtt);
494 ASN1_template_free(pseqval, seqtt); 389 ASN1_template_free(pseqval, seqtt);
495 } 390 } else {
496 else
497 {
498 errtt = seqtt; 391 errtt = seqtt;
499 ASN1err(ASN1_F_ASN1_ITEM_EX_D2I, 392 ASN1err(ASN1_F_ASN1_ITEM_EX_D2I, ASN1_R_FIELD_MISSING);
500 ASN1_R_FIELD_MISSING);
501 goto err; 393 goto err;
502 }
503 } 394 }
395 }
504 /* Save encoding */ 396 /* Save encoding */
505 if (!asn1_enc_save(pval, *in, p - *in, it)) 397 if(!asn1_enc_save(pval, *in, p - *in, it)) goto auxerr;
506 goto auxerr;
507 *in = p; 398 *in = p;
508 if (asn1_cb && !asn1_cb(ASN1_OP_D2I_POST, pval, it)) 399 if(asn1_cb && !asn1_cb(ASN1_OP_D2I_POST, pval, it))
509 goto auxerr; 400 goto auxerr;
510 return 1; 401 return 1;
511 402
512 default: 403 default:
513 return 0; 404 return 0;
514 } 405 }
515 auxerr: 406 auxerr:
516 ASN1err(ASN1_F_ASN1_ITEM_EX_D2I, ASN1_R_AUX_ERROR); 407 ASN1err(ASN1_F_ASN1_ITEM_EX_D2I, ASN1_R_AUX_ERROR);
517 err: 408 err:
518 ASN1_item_ex_free(pval, it); 409 ASN1_item_ex_free(pval, it);
519 if (errtt) 410 if(errtt) ERR_add_error_data(4, "Field=", errtt->field_name, ", Type=", it->sname);
520 ERR_add_error_data(4, "Field=", errtt->field_name, 411 else ERR_add_error_data(2, "Type=", it->sname);
521 ", Type=", it->sname);
522 else
523 ERR_add_error_data(2, "Type=", it->sname);
524 return 0; 412 return 0;
525 } 413}
526 414
527/* Templates are handled with two separate functions. 415/* Templates are handled with two separate functions. One handles any EXPLICIT tag and the other handles the
528 * One handles any EXPLICIT tag and the other handles the rest. 416 * rest.
529 */ 417 */
530 418
531static int asn1_template_ex_d2i(ASN1_VALUE **val, 419static int asn1_template_ex_d2i(ASN1_VALUE **val, unsigned char **in, long inlen, const ASN1_TEMPLATE *tt, char opt, ASN1_TLC *ctx)
532 const unsigned char **in, long inlen, 420{
533 const ASN1_TEMPLATE *tt, char opt,
534 ASN1_TLC *ctx)
535 {
536 int flags, aclass; 421 int flags, aclass;
537 int ret; 422 int ret;
538 long len; 423 long len;
539 const unsigned char *p, *q; 424 unsigned char *p, *q;
540 char exp_eoc; 425 char exp_eoc;
541 if (!val) 426 if(!val) return 0;
542 return 0;
543 flags = tt->flags; 427 flags = tt->flags;
544 aclass = flags & ASN1_TFLG_TAG_CLASS; 428 aclass = flags & ASN1_TFLG_TAG_CLASS;
545 429
546 p = *in; 430 p = *in;
547 431
548 /* Check if EXPLICIT tag expected */ 432 /* Check if EXPLICIT tag expected */
549 if (flags & ASN1_TFLG_EXPTAG) 433 if(flags & ASN1_TFLG_EXPTAG) {
550 {
551 char cst; 434 char cst;
552 /* Need to work out amount of data available to the inner 435 /* Need to work out amount of data available to the inner content and where it
553 * content and where it starts: so read in EXPLICIT header to 436 * starts: so read in EXPLICIT header to get the info.
554 * get the info.
555 */ 437 */
556 ret = asn1_check_tlen(&len, NULL, NULL, &exp_eoc, &cst, 438 ret = asn1_check_tlen(&len, NULL, NULL, &exp_eoc, &cst, &p, inlen, tt->tag, aclass, opt, ctx);
557 &p, inlen, tt->tag, aclass, opt, ctx);
558 q = p; 439 q = p;
559 if (!ret) 440 if(!ret) {
560 { 441 ASN1err(ASN1_F_ASN1_TEMPLATE_EX_D2I, ERR_R_NESTED_ASN1_ERROR);
561 ASN1err(ASN1_F_ASN1_TEMPLATE_EX_D2I,
562 ERR_R_NESTED_ASN1_ERROR);
563 return 0; 442 return 0;
564 } 443 } else if(ret == -1) return -1;
565 else if (ret == -1) 444 if(!cst) {
566 return -1; 445 ASN1err(ASN1_F_ASN1_TEMPLATE_EX_D2I, ASN1_R_EXPLICIT_TAG_NOT_CONSTRUCTED);
567 if (!cst)
568 {
569 ASN1err(ASN1_F_ASN1_TEMPLATE_EX_D2I,
570 ASN1_R_EXPLICIT_TAG_NOT_CONSTRUCTED);
571 return 0; 446 return 0;
572 } 447 }
573 /* We've found the field so it can't be OPTIONAL now */ 448 /* We've found the field so it can't be OPTIONAL now */
574 ret = asn1_template_noexp_d2i(val, &p, len, tt, 0, ctx); 449 ret = asn1_template_noexp_d2i(val, &p, len, tt, 0, ctx);
575 if (!ret) 450 if(!ret) {
576 { 451 ASN1err(ASN1_F_ASN1_TEMPLATE_EX_D2I, ERR_R_NESTED_ASN1_ERROR);
577 ASN1err(ASN1_F_ASN1_TEMPLATE_EX_D2I,
578 ERR_R_NESTED_ASN1_ERROR);
579 return 0; 452 return 0;
580 } 453 }
581 /* We read the field in OK so update length */ 454 /* We read the field in OK so update length */
582 len -= p - q; 455 len -= p - q;
583 if (exp_eoc) 456 if(exp_eoc) {
584 {
585 /* If NDEF we must have an EOC here */ 457 /* If NDEF we must have an EOC here */
586 if (!asn1_check_eoc(&p, len)) 458 if(!asn1_check_eoc(&p, len)) {
587 { 459 ASN1err(ASN1_F_ASN1_TEMPLATE_D2I, ASN1_R_MISSING_EOC);
588 ASN1err(ASN1_F_ASN1_TEMPLATE_EX_D2I,
589 ASN1_R_MISSING_EOC);
590 goto err; 460 goto err;
591 }
592 } 461 }
593 else 462 } else {
594 { 463 /* Otherwise we must hit the EXPLICIT tag end or its an error */
595 /* Otherwise we must hit the EXPLICIT tag end or its 464 if(len) {
596 * an error */ 465 ASN1err(ASN1_F_ASN1_TEMPLATE_D2I, ASN1_R_EXPLICIT_LENGTH_MISMATCH);
597 if (len)
598 {
599 ASN1err(ASN1_F_ASN1_TEMPLATE_EX_D2I,
600 ASN1_R_EXPLICIT_LENGTH_MISMATCH);
601 goto err; 466 goto err;
602 }
603 } 467 }
604 } 468 }
605 else 469 } else
606 return asn1_template_noexp_d2i(val, in, inlen, 470 return asn1_template_noexp_d2i(val, in, inlen, tt, opt, ctx);
607 tt, opt, ctx);
608 471
609 *in = p; 472 *in = p;
610 return 1; 473 return 1;
@@ -613,145 +476,98 @@ static int asn1_template_ex_d2i(ASN1_VALUE **val,
613 ASN1_template_free(val, tt); 476 ASN1_template_free(val, tt);
614 *val = NULL; 477 *val = NULL;
615 return 0; 478 return 0;
616 } 479}
617 480
618static int asn1_template_noexp_d2i(ASN1_VALUE **val, 481static int asn1_template_noexp_d2i(ASN1_VALUE **val, unsigned char **in, long len, const ASN1_TEMPLATE *tt, char opt, ASN1_TLC *ctx)
619 const unsigned char **in, long len, 482{
620 const ASN1_TEMPLATE *tt, char opt,
621 ASN1_TLC *ctx)
622 {
623 int flags, aclass; 483 int flags, aclass;
624 int ret; 484 int ret;
625 const unsigned char *p, *q; 485 unsigned char *p, *q;
626 if (!val) 486 if(!val) return 0;
627 return 0;
628 flags = tt->flags; 487 flags = tt->flags;
629 aclass = flags & ASN1_TFLG_TAG_CLASS; 488 aclass = flags & ASN1_TFLG_TAG_CLASS;
630 489
631 p = *in; 490 p = *in;
632 q = p; 491 q = p;
633 492
634 if (flags & ASN1_TFLG_SK_MASK) 493 if(flags & ASN1_TFLG_SK_MASK) {
635 {
636 /* SET OF, SEQUENCE OF */ 494 /* SET OF, SEQUENCE OF */
637 int sktag, skaclass; 495 int sktag, skaclass;
638 char sk_eoc; 496 char sk_eoc;
639 /* First work out expected inner tag value */ 497 /* First work out expected inner tag value */
640 if (flags & ASN1_TFLG_IMPTAG) 498 if(flags & ASN1_TFLG_IMPTAG) {
641 {
642 sktag = tt->tag; 499 sktag = tt->tag;
643 skaclass = aclass; 500 skaclass = aclass;
644 } 501 } else {
645 else
646 {
647 skaclass = V_ASN1_UNIVERSAL; 502 skaclass = V_ASN1_UNIVERSAL;
648 if (flags & ASN1_TFLG_SET_OF) 503 if(flags & ASN1_TFLG_SET_OF) sktag = V_ASN1_SET;
649 sktag = V_ASN1_SET; 504 else sktag = V_ASN1_SEQUENCE;
650 else 505 }
651 sktag = V_ASN1_SEQUENCE;
652 }
653 /* Get the tag */ 506 /* Get the tag */
654 ret = asn1_check_tlen(&len, NULL, NULL, &sk_eoc, NULL, 507 ret = asn1_check_tlen(&len, NULL, NULL, &sk_eoc, NULL, &p, len, sktag, skaclass, opt, ctx);
655 &p, len, sktag, skaclass, opt, ctx); 508 if(!ret) {
656 if (!ret) 509 ASN1err(ASN1_F_ASN1_TEMPLATE_EX_D2I, ERR_R_NESTED_ASN1_ERROR);
657 {
658 ASN1err(ASN1_F_ASN1_TEMPLATE_NOEXP_D2I,
659 ERR_R_NESTED_ASN1_ERROR);
660 return 0; 510 return 0;
661 } 511 } else if(ret == -1) return -1;
662 else if (ret == -1) 512 if(!*val) *val = (ASN1_VALUE *)sk_new_null();
663 return -1; 513 else {
664 if (!*val)
665 *val = (ASN1_VALUE *)sk_new_null();
666 else
667 {
668 /* We've got a valid STACK: free up any items present */ 514 /* We've got a valid STACK: free up any items present */
669 STACK *sktmp = (STACK *)*val; 515 STACK *sktmp = (STACK *)*val;
670 ASN1_VALUE *vtmp; 516 ASN1_VALUE *vtmp;
671 while(sk_num(sktmp) > 0) 517 while(sk_num(sktmp) > 0) {
672 {
673 vtmp = (ASN1_VALUE *)sk_pop(sktmp); 518 vtmp = (ASN1_VALUE *)sk_pop(sktmp);
674 ASN1_item_ex_free(&vtmp, 519 ASN1_item_ex_free(&vtmp, ASN1_ITEM_ptr(tt->item));
675 ASN1_ITEM_ptr(tt->item));
676 }
677 } 520 }
521 }
678 522
679 if (!*val) 523 if(!*val) {
680 { 524 ASN1err(ASN1_F_ASN1_TEMPLATE_EX_D2I, ERR_R_MALLOC_FAILURE);
681 ASN1err(ASN1_F_ASN1_TEMPLATE_NOEXP_D2I,
682 ERR_R_MALLOC_FAILURE);
683 goto err; 525 goto err;
684 } 526 }
685
686 /* Read as many items as we can */ 527 /* Read as many items as we can */
687 while(len > 0) 528 while(len > 0) {
688 {
689 ASN1_VALUE *skfield; 529 ASN1_VALUE *skfield;
690 q = p; 530 q = p;
691 /* See if EOC found */ 531 /* See if EOC found */
692 if (asn1_check_eoc(&p, len)) 532 if(asn1_check_eoc(&p, len)) {
693 { 533 if(!sk_eoc) {
694 if (!sk_eoc) 534 ASN1err(ASN1_F_ASN1_TEMPLATE_D2I, ASN1_R_UNEXPECTED_EOC);
695 {
696 ASN1err(ASN1_F_ASN1_TEMPLATE_NOEXP_D2I,
697 ASN1_R_UNEXPECTED_EOC);
698 goto err; 535 goto err;
699 } 536 }
700 len -= p - q; 537 len -= p - q;
701 sk_eoc = 0; 538 sk_eoc = 0;
702 break; 539 break;
703 } 540 }
704 skfield = NULL; 541 skfield = NULL;
705 if (!ASN1_item_ex_d2i(&skfield, &p, len, 542 if(!ASN1_item_ex_d2i(&skfield, &p, len, ASN1_ITEM_ptr(tt->item), -1, 0, 0, ctx)) {
706 ASN1_ITEM_ptr(tt->item), 543 ASN1err(ASN1_F_ASN1_TEMPLATE_D2I, ERR_R_NESTED_ASN1_ERROR);
707 -1, 0, 0, ctx))
708 {
709 ASN1err(ASN1_F_ASN1_TEMPLATE_NOEXP_D2I,
710 ERR_R_NESTED_ASN1_ERROR);
711 goto err; 544 goto err;
712 } 545 }
713 len -= p - q; 546 len -= p - q;
714 if (!sk_push((STACK *)*val, (char *)skfield)) 547 if(!sk_push((STACK *)*val, (char *)skfield)) {
715 { 548 ASN1err(ASN1_F_ASN1_TEMPLATE_D2I, ERR_R_MALLOC_FAILURE);
716 ASN1err(ASN1_F_ASN1_TEMPLATE_NOEXP_D2I,
717 ERR_R_MALLOC_FAILURE);
718 goto err; 549 goto err;
719 }
720 } 550 }
721 if (sk_eoc) 551 }
722 { 552 if(sk_eoc) {
723 ASN1err(ASN1_F_ASN1_TEMPLATE_NOEXP_D2I, ASN1_R_MISSING_EOC); 553 ASN1err(ASN1_F_ASN1_TEMPLATE_D2I, ASN1_R_MISSING_EOC);
724 goto err; 554 goto err;
725 }
726 } 555 }
727 else if (flags & ASN1_TFLG_IMPTAG) 556 } else if(flags & ASN1_TFLG_IMPTAG) {
728 {
729 /* IMPLICIT tagging */ 557 /* IMPLICIT tagging */
730 ret = ASN1_item_ex_d2i(val, &p, len, 558 ret = ASN1_item_ex_d2i(val, &p, len, ASN1_ITEM_ptr(tt->item), tt->tag, aclass, opt, ctx);
731 ASN1_ITEM_ptr(tt->item), tt->tag, aclass, opt, ctx); 559 if(!ret) {
732 if (!ret) 560 ASN1err(ASN1_F_ASN1_TEMPLATE_D2I, ERR_R_NESTED_ASN1_ERROR);
733 {
734 ASN1err(ASN1_F_ASN1_TEMPLATE_NOEXP_D2I,
735 ERR_R_NESTED_ASN1_ERROR);
736 goto err; 561 goto err;
737 } 562 } else if(ret == -1) return -1;
738 else if (ret == -1) 563 } else {
739 return -1;
740 }
741 else
742 {
743 /* Nothing special */ 564 /* Nothing special */
744 ret = ASN1_item_ex_d2i(val, &p, len, ASN1_ITEM_ptr(tt->item), 565 ret = ASN1_item_ex_d2i(val, &p, len, ASN1_ITEM_ptr(tt->item), -1, 0, opt, ctx);
745 -1, 0, opt, ctx); 566 if(!ret) {
746 if (!ret) 567 ASN1err(ASN1_F_ASN1_TEMPLATE_D2I, ERR_R_NESTED_ASN1_ERROR);
747 {
748 ASN1err(ASN1_F_ASN1_TEMPLATE_NOEXP_D2I,
749 ERR_R_NESTED_ASN1_ERROR);
750 goto err; 568 goto err;
751 } 569 } else if(ret == -1) return -1;
752 else if (ret == -1) 570 }
753 return -1;
754 }
755 571
756 *in = p; 572 *in = p;
757 return 1; 573 return 1;
@@ -760,115 +576,85 @@ static int asn1_template_noexp_d2i(ASN1_VALUE **val,
760 ASN1_template_free(val, tt); 576 ASN1_template_free(val, tt);
761 *val = NULL; 577 *val = NULL;
762 return 0; 578 return 0;
763 } 579}
764 580
765static int asn1_d2i_ex_primitive(ASN1_VALUE **pval, 581static int asn1_d2i_ex_primitive(ASN1_VALUE **pval, unsigned char **in, long inlen,
766 const unsigned char **in, long inlen, 582 const ASN1_ITEM *it,
767 const ASN1_ITEM *it, 583 int tag, int aclass, char opt, ASN1_TLC *ctx)
768 int tag, int aclass, char opt, ASN1_TLC *ctx) 584{
769 {
770 int ret = 0, utype; 585 int ret = 0, utype;
771 long plen; 586 long plen;
772 char cst, inf, free_cont = 0; 587 char cst, inf, free_cont = 0;
773 const unsigned char *p; 588 unsigned char *p;
774 BUF_MEM buf; 589 BUF_MEM buf;
775 const unsigned char *cont = NULL; 590 unsigned char *cont = NULL;
776 long len; 591 long len;
777 if (!pval) 592 if(!pval) {
778 {
779 ASN1err(ASN1_F_ASN1_D2I_EX_PRIMITIVE, ASN1_R_ILLEGAL_NULL); 593 ASN1err(ASN1_F_ASN1_D2I_EX_PRIMITIVE, ASN1_R_ILLEGAL_NULL);
780 return 0; /* Should never happen */ 594 return 0; /* Should never happen */
781 } 595 }
782 596
783 if (it->itype == ASN1_ITYPE_MSTRING) 597 if(it->itype == ASN1_ITYPE_MSTRING) {
784 {
785 utype = tag; 598 utype = tag;
786 tag = -1; 599 tag = -1;
787 } 600 } else utype = it->utype;
788 else
789 utype = it->utype;
790 601
791 if (utype == V_ASN1_ANY) 602 if(utype == V_ASN1_ANY) {
792 {
793 /* If type is ANY need to figure out type from tag */ 603 /* If type is ANY need to figure out type from tag */
794 unsigned char oclass; 604 unsigned char oclass;
795 if (tag >= 0) 605 if(tag >= 0) {
796 { 606 ASN1err(ASN1_F_ASN1_D2I_EX_PRIMITIVE, ASN1_R_ILLEGAL_TAGGED_ANY);
797 ASN1err(ASN1_F_ASN1_D2I_EX_PRIMITIVE,
798 ASN1_R_ILLEGAL_TAGGED_ANY);
799 return 0; 607 return 0;
800 } 608 }
801 if (opt) 609 if(opt) {
802 { 610 ASN1err(ASN1_F_ASN1_D2I_EX_PRIMITIVE, ASN1_R_ILLEGAL_OPTIONAL_ANY);
803 ASN1err(ASN1_F_ASN1_D2I_EX_PRIMITIVE,
804 ASN1_R_ILLEGAL_OPTIONAL_ANY);
805 return 0; 611 return 0;
806 } 612 }
807 p = *in; 613 p = *in;
808 ret = asn1_check_tlen(NULL, &utype, &oclass, NULL, NULL, 614 ret = asn1_check_tlen(NULL, &utype, &oclass, NULL, NULL, &p, inlen, -1, 0, 0, ctx);
809 &p, inlen, -1, 0, 0, ctx); 615 if(!ret) {
810 if (!ret) 616 ASN1err(ASN1_F_ASN1_D2I_EX_PRIMITIVE, ERR_R_NESTED_ASN1_ERROR);
811 {
812 ASN1err(ASN1_F_ASN1_D2I_EX_PRIMITIVE,
813 ERR_R_NESTED_ASN1_ERROR);
814 return 0; 617 return 0;
815 }
816 if (oclass != V_ASN1_UNIVERSAL)
817 utype = V_ASN1_OTHER;
818 } 618 }
819 if (tag == -1) 619 if(oclass != V_ASN1_UNIVERSAL) utype = V_ASN1_OTHER;
820 { 620 }
621 if(tag == -1) {
821 tag = utype; 622 tag = utype;
822 aclass = V_ASN1_UNIVERSAL; 623 aclass = V_ASN1_UNIVERSAL;
823 } 624 }
824 p = *in; 625 p = *in;
825 /* Check header */ 626 /* Check header */
826 ret = asn1_check_tlen(&plen, NULL, NULL, &inf, &cst, 627 ret = asn1_check_tlen(&plen, NULL, NULL, &inf, &cst, &p, inlen, tag, aclass, opt, ctx);
827 &p, inlen, tag, aclass, opt, ctx); 628 if(!ret) {
828 if (!ret)
829 {
830 ASN1err(ASN1_F_ASN1_D2I_EX_PRIMITIVE, ERR_R_NESTED_ASN1_ERROR); 629 ASN1err(ASN1_F_ASN1_D2I_EX_PRIMITIVE, ERR_R_NESTED_ASN1_ERROR);
831 return 0; 630 return 0;
832 } 631 } else if(ret == -1) return -1;
833 else if (ret == -1) 632
834 return -1; 633 ret = 0;
835 ret = 0;
836 /* SEQUENCE, SET and "OTHER" are left in encoded form */ 634 /* SEQUENCE, SET and "OTHER" are left in encoded form */
837 if ((utype == V_ASN1_SEQUENCE) 635 if((utype == V_ASN1_SEQUENCE) || (utype == V_ASN1_SET) || (utype == V_ASN1_OTHER)) {
838 || (utype == V_ASN1_SET) || (utype == V_ASN1_OTHER)) 636 /* Clear context cache for type OTHER because the auto clear when
839 { 637 * we have a exact match wont work
840 /* Clear context cache for type OTHER because the auto clear
841 * when we have a exact match wont work
842 */ 638 */
843 if (utype == V_ASN1_OTHER) 639 if(utype == V_ASN1_OTHER) {
844 {
845 asn1_tlc_clear(ctx); 640 asn1_tlc_clear(ctx);
846 }
847 /* SEQUENCE and SET must be constructed */ 641 /* SEQUENCE and SET must be constructed */
848 else if (!cst) 642 } else if(!cst) {
849 { 643 ASN1err(ASN1_F_ASN1_D2I_EX_PRIMITIVE, ASN1_R_TYPE_NOT_CONSTRUCTED);
850 ASN1err(ASN1_F_ASN1_D2I_EX_PRIMITIVE,
851 ASN1_R_TYPE_NOT_CONSTRUCTED);
852 return 0; 644 return 0;
853 } 645 }
854 646
855 cont = *in; 647 cont = *in;
856 /* If indefinite length constructed find the real end */ 648 /* If indefinite length constructed find the real end */
857 if (inf) 649 if(inf) {
858 { 650 if(!asn1_find_end(&p, plen, inf)) goto err;
859 if (!asn1_find_end(&p, plen, inf))
860 goto err;
861 len = p - cont; 651 len = p - cont;
862 } 652 } else {
863 else
864 {
865 len = p - cont + plen; 653 len = p - cont + plen;
866 p += plen; 654 p += plen;
867 buf.data = NULL; 655 buf.data = NULL;
868 }
869 } 656 }
870 else if (cst) 657 } else if(cst) {
871 {
872 buf.length = 0; 658 buf.length = 0;
873 buf.max = 0; 659 buf.max = 0;
874 buf.data = NULL; 660 buf.data = NULL;
@@ -878,46 +664,36 @@ static int asn1_d2i_ex_primitive(ASN1_VALUE **pval,
878 * internally irrespective of the type. So instead just check 664 * internally irrespective of the type. So instead just check
879 * for UNIVERSAL class and ignore the tag. 665 * for UNIVERSAL class and ignore the tag.
880 */ 666 */
881 if (!asn1_collect(&buf, &p, plen, inf, -1, V_ASN1_UNIVERSAL)) 667 if(!asn1_collect(&buf, &p, plen, inf, -1, V_ASN1_UNIVERSAL)) goto err;
882 {
883 free_cont = 1;
884 goto err;
885 }
886 len = buf.length; 668 len = buf.length;
887 /* Append a final null to string */ 669 /* Append a final null to string */
888 if (!BUF_MEM_grow_clean(&buf, len + 1)) 670 if(!BUF_MEM_grow_clean(&buf, len + 1)) {
889 { 671 ASN1err(ASN1_F_ASN1_D2I_EX_PRIMITIVE, ERR_R_MALLOC_FAILURE);
890 ASN1err(ASN1_F_ASN1_D2I_EX_PRIMITIVE,
891 ERR_R_MALLOC_FAILURE);
892 return 0; 672 return 0;
893 } 673 }
894 buf.data[len] = 0; 674 buf.data[len] = 0;
895 cont = (const unsigned char *)buf.data; 675 cont = (unsigned char *)buf.data;
896 free_cont = 1; 676 free_cont = 1;
897 } 677 } else {
898 else
899 {
900 cont = p; 678 cont = p;
901 len = plen; 679 len = plen;
902 p += plen; 680 p += plen;
903 } 681 }
904 682
905 /* We now have content length and type: translate into a structure */ 683 /* We now have content length and type: translate into a structure */
906 if (!asn1_ex_c2i(pval, cont, len, utype, &free_cont, it)) 684 if(!asn1_ex_c2i(pval, cont, len, utype, &free_cont, it)) goto err;
907 goto err;
908 685
909 *in = p; 686 *in = p;
910 ret = 1; 687 ret = 1;
911 err: 688 err:
912 if (free_cont && buf.data) OPENSSL_free(buf.data); 689 if(free_cont && buf.data) OPENSSL_free(buf.data);
913 return ret; 690 return ret;
914 } 691}
915 692
916/* Translate ASN1 content octets into a structure */ 693/* Translate ASN1 content octets into a structure */
917 694
918int asn1_ex_c2i(ASN1_VALUE **pval, const unsigned char *cont, int len, 695int asn1_ex_c2i(ASN1_VALUE **pval, unsigned char *cont, int len, int utype, char *free_cont, const ASN1_ITEM *it)
919 int utype, char *free_cont, const ASN1_ITEM *it) 696{
920 {
921 ASN1_VALUE **opval = NULL; 697 ASN1_VALUE **opval = NULL;
922 ASN1_STRING *stmp; 698 ASN1_STRING *stmp;
923 ASN1_TYPE *typ = NULL; 699 ASN1_TYPE *typ = NULL;
@@ -925,62 +701,43 @@ int asn1_ex_c2i(ASN1_VALUE **pval, const unsigned char *cont, int len,
925 const ASN1_PRIMITIVE_FUNCS *pf; 701 const ASN1_PRIMITIVE_FUNCS *pf;
926 ASN1_INTEGER **tint; 702 ASN1_INTEGER **tint;
927 pf = it->funcs; 703 pf = it->funcs;
928 704 if(pf && pf->prim_c2i) return pf->prim_c2i(pval, cont, len, utype, free_cont, it);
929 if (pf && pf->prim_c2i)
930 return pf->prim_c2i(pval, cont, len, utype, free_cont, it);
931 /* If ANY type clear type and set pointer to internal value */ 705 /* If ANY type clear type and set pointer to internal value */
932 if (it->utype == V_ASN1_ANY) 706 if(it->utype == V_ASN1_ANY) {
933 { 707 if(!*pval) {
934 if (!*pval)
935 {
936 typ = ASN1_TYPE_new(); 708 typ = ASN1_TYPE_new();
937 if (typ == NULL)
938 goto err;
939 *pval = (ASN1_VALUE *)typ; 709 *pval = (ASN1_VALUE *)typ;
940 } 710 } else typ = (ASN1_TYPE *)*pval;
941 else 711 if(utype != typ->type) ASN1_TYPE_set(typ, utype, NULL);
942 typ = (ASN1_TYPE *)*pval;
943
944 if (utype != typ->type)
945 ASN1_TYPE_set(typ, utype, NULL);
946 opval = pval; 712 opval = pval;
947 pval = &typ->value.asn1_value; 713 pval = (ASN1_VALUE **)&typ->value.ptr;
948 } 714 }
949 switch(utype) 715 switch(utype) {
950 {
951 case V_ASN1_OBJECT: 716 case V_ASN1_OBJECT:
952 if (!c2i_ASN1_OBJECT((ASN1_OBJECT **)pval, &cont, len)) 717 if(!c2i_ASN1_OBJECT((ASN1_OBJECT **)pval, &cont, len)) goto err;
953 goto err;
954 break; 718 break;
955 719
956 case V_ASN1_NULL: 720 case V_ASN1_NULL:
957 if (len) 721 if(len) {
958 { 722 ASN1err(ASN1_F_ASN1_D2I_EX_PRIMITIVE, ASN1_R_NULL_IS_WRONG_LENGTH);
959 ASN1err(ASN1_F_ASN1_EX_C2I,
960 ASN1_R_NULL_IS_WRONG_LENGTH);
961 goto err; 723 goto err;
962 } 724 }
963 *pval = (ASN1_VALUE *)1; 725 *pval = (ASN1_VALUE *)1;
964 break; 726 break;
965 727
966 case V_ASN1_BOOLEAN: 728 case V_ASN1_BOOLEAN:
967 if (len != 1) 729 if(len != 1) {
968 { 730 ASN1err(ASN1_F_ASN1_D2I_EX_PRIMITIVE, ASN1_R_BOOLEAN_IS_WRONG_LENGTH);
969 ASN1err(ASN1_F_ASN1_EX_C2I,
970 ASN1_R_BOOLEAN_IS_WRONG_LENGTH);
971 goto err; 731 goto err;
972 } 732 } else {
973 else
974 {
975 ASN1_BOOLEAN *tbool; 733 ASN1_BOOLEAN *tbool;
976 tbool = (ASN1_BOOLEAN *)pval; 734 tbool = (ASN1_BOOLEAN *)pval;
977 *tbool = *cont; 735 *tbool = *cont;
978 } 736 }
979 break; 737 break;
980 738
981 case V_ASN1_BIT_STRING: 739 case V_ASN1_BIT_STRING:
982 if (!c2i_ASN1_BIT_STRING((ASN1_BIT_STRING **)pval, &cont, len)) 740 if(!c2i_ASN1_BIT_STRING((ASN1_BIT_STRING **)pval, &cont, len)) goto err;
983 goto err;
984 break; 741 break;
985 742
986 case V_ASN1_INTEGER: 743 case V_ASN1_INTEGER:
@@ -988,8 +745,7 @@ int asn1_ex_c2i(ASN1_VALUE **pval, const unsigned char *cont, int len,
988 case V_ASN1_ENUMERATED: 745 case V_ASN1_ENUMERATED:
989 case V_ASN1_NEG_ENUMERATED: 746 case V_ASN1_NEG_ENUMERATED:
990 tint = (ASN1_INTEGER **)pval; 747 tint = (ASN1_INTEGER **)pval;
991 if (!c2i_ASN1_INTEGER(tint, &cont, len)) 748 if(!c2i_ASN1_INTEGER(tint, &cont, len)) goto err;
992 goto err;
993 /* Fixup type to match the expected form */ 749 /* Fixup type to match the expected form */
994 (*tint)->type = utype | ((*tint)->type & V_ASN1_NEG); 750 (*tint)->type = utype | ((*tint)->type & V_ASN1_NEG);
995 break; 751 break;
@@ -1013,59 +769,46 @@ int asn1_ex_c2i(ASN1_VALUE **pval, const unsigned char *cont, int len,
1013 case V_ASN1_SEQUENCE: 769 case V_ASN1_SEQUENCE:
1014 default: 770 default:
1015 /* All based on ASN1_STRING and handled the same */ 771 /* All based on ASN1_STRING and handled the same */
1016 if (!*pval) 772 if(!*pval) {
1017 {
1018 stmp = ASN1_STRING_type_new(utype); 773 stmp = ASN1_STRING_type_new(utype);
1019 if (!stmp) 774 if(!stmp) {
1020 { 775 ASN1err(ASN1_F_ASN1_D2I_EX_PRIMITIVE, ERR_R_MALLOC_FAILURE);
1021 ASN1err(ASN1_F_ASN1_EX_C2I,
1022 ERR_R_MALLOC_FAILURE);
1023 goto err; 776 goto err;
1024 }
1025 *pval = (ASN1_VALUE *)stmp;
1026 } 777 }
1027 else 778 *pval = (ASN1_VALUE *)stmp;
1028 { 779 } else {
1029 stmp = (ASN1_STRING *)*pval; 780 stmp = (ASN1_STRING *)*pval;
1030 stmp->type = utype; 781 stmp->type = utype;
1031 } 782 }
1032 /* If we've already allocated a buffer use it */ 783 /* If we've already allocated a buffer use it */
1033 if (*free_cont) 784 if(*free_cont) {
1034 { 785 if(stmp->data) OPENSSL_free(stmp->data);
1035 if (stmp->data) 786 stmp->data = cont;
1036 OPENSSL_free(stmp->data);
1037 stmp->data = (unsigned char *)cont; /* UGLY CAST! RL */
1038 stmp->length = len; 787 stmp->length = len;
1039 *free_cont = 0; 788 *free_cont = 0;
1040 } 789 } else {
1041 else 790 if(!ASN1_STRING_set(stmp, cont, len)) {
1042 { 791 ASN1err(ASN1_F_ASN1_D2I_EX_PRIMITIVE, ERR_R_MALLOC_FAILURE);
1043 if (!ASN1_STRING_set(stmp, cont, len))
1044 {
1045 ASN1err(ASN1_F_ASN1_EX_C2I,
1046 ERR_R_MALLOC_FAILURE);
1047 ASN1_STRING_free(stmp); 792 ASN1_STRING_free(stmp);
1048 *pval = NULL; 793 *pval = NULL;
1049 goto err; 794 goto err;
1050 }
1051 } 795 }
1052 break;
1053 } 796 }
797 break;
798 }
1054 /* If ASN1_ANY and NULL type fix up value */ 799 /* If ASN1_ANY and NULL type fix up value */
1055 if (typ && (utype == V_ASN1_NULL)) 800 if(typ && utype==V_ASN1_NULL) typ->value.ptr = NULL;
1056 typ->value.ptr = NULL;
1057 801
1058 ret = 1; 802 ret = 1;
1059 err: 803 err:
1060 if (!ret) 804 if(!ret)
1061 { 805 {
1062 ASN1_TYPE_free(typ); 806 ASN1_TYPE_free(typ);
1063 if (opval) 807 if (opval)
1064 *opval = NULL; 808 *opval = NULL;
1065 } 809 }
1066 return ret; 810 return ret;
1067 } 811}
1068
1069 812
1070/* This function finds the end of an ASN1 structure when passed its maximum 813/* This function finds the end of an ASN1 structure when passed its maximum
1071 * length, whether it is indefinite length and a pointer to the content. 814 * length, whether it is indefinite length and a pointer to the content.
@@ -1073,11 +816,11 @@ int asn1_ex_c2i(ASN1_VALUE **pval, const unsigned char *cont, int len,
1073 * recurse on each indefinite length header. 816 * recurse on each indefinite length header.
1074 */ 817 */
1075 818
1076static int asn1_find_end(const unsigned char **in, long len, char inf) 819static int asn1_find_end(unsigned char **in, long len, char inf)
1077 { 820 {
1078 int expected_eoc; 821 int expected_eoc;
1079 long plen; 822 long plen;
1080 const unsigned char *p = *in, *q; 823 unsigned char *p = *in, *q;
1081 /* If not indefinite length constructed just add length */ 824 /* If not indefinite length constructed just add length */
1082 if (inf == 0) 825 if (inf == 0)
1083 { 826 {
@@ -1087,7 +830,7 @@ static int asn1_find_end(const unsigned char **in, long len, char inf)
1087 expected_eoc = 1; 830 expected_eoc = 1;
1088 /* Indefinite length constructed form. Find the end when enough EOCs 831 /* Indefinite length constructed form. Find the end when enough EOCs
1089 * are found. If more indefinite length constructed headers 832 * are found. If more indefinite length constructed headers
1090 * are encountered increment the expected eoc count otherwise just 833 * are encountered increment the expected eoc count otherwise justi
1091 * skip to the end of the data. 834 * skip to the end of the data.
1092 */ 835 */
1093 while (len > 0) 836 while (len > 0)
@@ -1122,55 +865,38 @@ static int asn1_find_end(const unsigned char **in, long len, char inf)
1122 *in = p; 865 *in = p;
1123 return 1; 866 return 1;
1124 } 867 }
868
1125/* This function collects the asn1 data from a constructred string 869/* This function collects the asn1 data from a constructred string
1126 * type into a buffer. The values of 'in' and 'len' should refer 870 * type into a buffer. The values of 'in' and 'len' should refer
1127 * to the contents of the constructed type and 'inf' should be set 871 * to the contents of the constructed type and 'inf' should be set
1128 * if it is indefinite length. 872 * if it is indefinite length.
1129 */ 873 */
1130 874
1131static int asn1_collect(BUF_MEM *buf, const unsigned char **in, long len, 875static int asn1_collect(BUF_MEM *buf, unsigned char **in, long len, char inf, int tag, int aclass)
1132 char inf, int tag, int aclass) 876{
1133 { 877 unsigned char *p, *q;
1134 const unsigned char *p, *q;
1135 long plen; 878 long plen;
1136 char cst, ininf; 879 char cst, ininf;
1137 p = *in; 880 p = *in;
1138 inf &= 1; 881 inf &= 1;
1139 /* If no buffer and not indefinite length constructed just pass over 882 while(len > 0) {
1140 * the encoded data */
1141 if (!buf && !inf)
1142 {
1143 *in += len;
1144 return 1;
1145 }
1146 while(len > 0)
1147 {
1148 q = p; 883 q = p;
1149 /* Check for EOC */ 884 /* Check for EOC */
1150 if (asn1_check_eoc(&p, len)) 885 if(asn1_check_eoc(&p, len)) {
1151 { 886 /* EOC is illegal outside indefinite length constructed form */
1152 /* EOC is illegal outside indefinite length 887 if(!inf) {
1153 * constructed form */ 888 ASN1err(ASN1_F_ASN1_COLLECT, ASN1_R_UNEXPECTED_EOC);
1154 if (!inf)
1155 {
1156 ASN1err(ASN1_F_ASN1_COLLECT,
1157 ASN1_R_UNEXPECTED_EOC);
1158 return 0; 889 return 0;
1159 } 890 }
1160 inf = 0; 891 inf = 0;
1161 break; 892 break;
1162 } 893 }
1163 894 if(!asn1_check_tlen(&plen, NULL, NULL, &ininf, &cst, &p, len, tag, aclass, 0, NULL)) {
1164 if (!asn1_check_tlen(&plen, NULL, NULL, &ininf, &cst, &p,
1165 len, tag, aclass, 0, NULL))
1166 {
1167 ASN1err(ASN1_F_ASN1_COLLECT, ERR_R_NESTED_ASN1_ERROR); 895 ASN1err(ASN1_F_ASN1_COLLECT, ERR_R_NESTED_ASN1_ERROR);
1168 return 0; 896 return 0;
1169 } 897 }
1170
1171 /* If indefinite length constructed update max length */ 898 /* If indefinite length constructed update max length */
1172 if (cst) 899 if(cst) {
1173 {
1174#ifdef OPENSSL_ALLOW_NESTED_ASN1_STRINGS 900#ifdef OPENSSL_ALLOW_NESTED_ASN1_STRINGS
1175 if (!asn1_collect(buf, &p, plen, ininf, tag, aclass)) 901 if (!asn1_collect(buf, &p, plen, ininf, tag, aclass))
1176 return 0; 902 return 0;
@@ -1178,51 +904,47 @@ static int asn1_collect(BUF_MEM *buf, const unsigned char **in, long len,
1178 ASN1err(ASN1_F_ASN1_COLLECT, ASN1_R_NESTED_ASN1_STRING); 904 ASN1err(ASN1_F_ASN1_COLLECT, ASN1_R_NESTED_ASN1_STRING);
1179 return 0; 905 return 0;
1180#endif 906#endif
1181 } 907 } else {
1182 else if (plen && !collect_data(buf, &p, plen)) 908 if(plen && !collect_data(buf, &p, plen)) return 0;
1183 return 0;
1184 len -= p - q;
1185 } 909 }
1186 if (inf) 910 len -= p - q;
1187 { 911 }
912 if(inf) {
1188 ASN1err(ASN1_F_ASN1_COLLECT, ASN1_R_MISSING_EOC); 913 ASN1err(ASN1_F_ASN1_COLLECT, ASN1_R_MISSING_EOC);
1189 return 0; 914 return 0;
1190 } 915 }
1191 *in = p; 916 *in = p;
1192 return 1; 917 return 1;
1193 } 918}
1194 919
1195static int collect_data(BUF_MEM *buf, const unsigned char **p, long plen) 920static int collect_data(BUF_MEM *buf, unsigned char **p, long plen)
1196 { 921{
1197 int len; 922 int len;
1198 if (buf) 923 if(buf) {
1199 { 924 len = buf->length;
1200 len = buf->length; 925 if(!BUF_MEM_grow_clean(buf, len + plen)) {
1201 if (!BUF_MEM_grow_clean(buf, len + plen)) 926 ASN1err(ASN1_F_COLLECT_DATA, ERR_R_MALLOC_FAILURE);
1202 { 927 return 0;
1203 ASN1err(ASN1_F_COLLECT_DATA, ERR_R_MALLOC_FAILURE);
1204 return 0;
1205 } 928 }
1206 memcpy(buf->data + len, *p, plen); 929 memcpy(buf->data + len, *p, plen);
1207 } 930 }
1208 *p += plen; 931 *p += plen;
1209 return 1; 932 return 1;
1210 } 933}
1211 934
1212/* Check for ASN1 EOC and swallow it if found */ 935/* Check for ASN1 EOC and swallow it if found */
1213 936
1214static int asn1_check_eoc(const unsigned char **in, long len) 937static int asn1_check_eoc(unsigned char **in, long len)
1215 { 938{
1216 const unsigned char *p; 939 unsigned char *p;
1217 if (len < 2) return 0; 940 if(len < 2) return 0;
1218 p = *in; 941 p = *in;
1219 if (!p[0] && !p[1]) 942 if(!p[0] && !p[1]) {
1220 {
1221 *in += 2; 943 *in += 2;
1222 return 1; 944 return 1;
1223 }
1224 return 0;
1225 } 945 }
946 return 0;
947}
1226 948
1227/* Check an ASN1 tag and length: a bit like ASN1_get_object 949/* Check an ASN1 tag and length: a bit like ASN1_get_object
1228 * but it sets the length for indefinite length constructed 950 * but it sets the length for indefinite length constructed
@@ -1231,32 +953,25 @@ static int asn1_check_eoc(const unsigned char **in, long len)
1231 * header length just read. 953 * header length just read.
1232 */ 954 */
1233 955
1234static int asn1_check_tlen(long *olen, int *otag, unsigned char *oclass, 956static int asn1_check_tlen(long *olen, int *otag, unsigned char *oclass, char *inf, char *cst,
1235 char *inf, char *cst, 957 unsigned char **in, long len, int exptag, int expclass, char opt, ASN1_TLC *ctx)
1236 const unsigned char **in, long len, 958{
1237 int exptag, int expclass, char opt,
1238 ASN1_TLC *ctx)
1239 {
1240 int i; 959 int i;
1241 int ptag, pclass; 960 int ptag, pclass;
1242 long plen; 961 long plen;
1243 const unsigned char *p, *q; 962 unsigned char *p, *q;
1244 p = *in; 963 p = *in;
1245 q = p; 964 q = p;
1246 965
1247 if (ctx && ctx->valid) 966 if(ctx && ctx->valid) {
1248 {
1249 i = ctx->ret; 967 i = ctx->ret;
1250 plen = ctx->plen; 968 plen = ctx->plen;
1251 pclass = ctx->pclass; 969 pclass = ctx->pclass;
1252 ptag = ctx->ptag; 970 ptag = ctx->ptag;
1253 p += ctx->hdrlen; 971 p += ctx->hdrlen;
1254 } 972 } else {
1255 else
1256 {
1257 i = ASN1_get_object(&p, &plen, &ptag, &pclass, len); 973 i = ASN1_get_object(&p, &plen, &ptag, &pclass, len);
1258 if (ctx) 974 if(ctx) {
1259 {
1260 ctx->ret = i; 975 ctx->ret = i;
1261 ctx->plen = plen; 976 ctx->plen = plen;
1262 ctx->pclass = pclass; 977 ctx->pclass = pclass;
@@ -1266,57 +981,43 @@ static int asn1_check_tlen(long *olen, int *otag, unsigned char *oclass,
1266 /* If definite length, and no error, length + 981 /* If definite length, and no error, length +
1267 * header can't exceed total amount of data available. 982 * header can't exceed total amount of data available.
1268 */ 983 */
1269 if (!(i & 0x81) && ((plen + ctx->hdrlen) > len)) 984 if(!(i & 0x81) && ((plen + ctx->hdrlen) > len)) {
1270 { 985 ASN1err(ASN1_F_ASN1_CHECK_TLEN, ASN1_R_TOO_LONG);
1271 ASN1err(ASN1_F_ASN1_CHECK_TLEN,
1272 ASN1_R_TOO_LONG);
1273 asn1_tlc_clear(ctx); 986 asn1_tlc_clear(ctx);
1274 return 0; 987 return 0;
1275 }
1276 } 988 }
1277 } 989 }
990 }
1278 991
1279 if (i & 0x80) 992 if(i & 0x80) {
1280 {
1281 ASN1err(ASN1_F_ASN1_CHECK_TLEN, ASN1_R_BAD_OBJECT_HEADER); 993 ASN1err(ASN1_F_ASN1_CHECK_TLEN, ASN1_R_BAD_OBJECT_HEADER);
1282 asn1_tlc_clear(ctx); 994 asn1_tlc_clear(ctx);
1283 return 0; 995 return 0;
1284 } 996 }
1285 if (exptag >= 0) 997 if(exptag >= 0) {
1286 { 998 if((exptag != ptag) || (expclass != pclass)) {
1287 if ((exptag != ptag) || (expclass != pclass)) 999 /* If type is OPTIONAL, not an error, but indicate missing
1288 { 1000 * type.
1289 /* If type is OPTIONAL, not an error:
1290 * indicate missing type.
1291 */ 1001 */
1292 if (opt) return -1; 1002 if(opt) return -1;
1293 asn1_tlc_clear(ctx); 1003 asn1_tlc_clear(ctx);
1294 ASN1err(ASN1_F_ASN1_CHECK_TLEN, ASN1_R_WRONG_TAG); 1004 ASN1err(ASN1_F_ASN1_CHECK_TLEN, ASN1_R_WRONG_TAG);
1295 return 0; 1005 return 0;
1296 }
1297 /* We have a tag and class match:
1298 * assume we are going to do something with it */
1299 asn1_tlc_clear(ctx);
1300 } 1006 }
1007 /* We have a tag and class match, so assume we are going to do something with it */
1008 asn1_tlc_clear(ctx);
1009 }
1301 1010
1302 if (i & 1) 1011 if(i & 1) plen = len - (p - q);
1303 plen = len - (p - q);
1304
1305 if (inf)
1306 *inf = i & 1;
1307
1308 if (cst)
1309 *cst = i & V_ASN1_CONSTRUCTED;
1310 1012
1311 if (olen) 1013 if(inf) *inf = i & 1;
1312 *olen = plen;
1313 1014
1314 if (oclass) 1015 if(cst) *cst = i & V_ASN1_CONSTRUCTED;
1315 *oclass = pclass;
1316 1016
1317 if (otag) 1017 if(olen) *olen = plen;
1318 *otag = ptag; 1018 if(oclass) *oclass = pclass;
1019 if(otag) *otag = ptag;
1319 1020
1320 *in = p; 1021 *in = p;
1321 return 1; 1022 return 1;
1322 } 1023}
diff --git a/src/lib/libcrypto/asn1/tasn_enc.c b/src/lib/libcrypto/asn1/tasn_enc.c
index be19b36acd..c675c3c832 100644
--- a/src/lib/libcrypto/asn1/tasn_enc.c
+++ b/src/lib/libcrypto/asn1/tasn_enc.c
@@ -3,7 +3,7 @@
3 * project 2000. 3 * project 2000.
4 */ 4 */
5/* ==================================================================== 5/* ====================================================================
6 * Copyright (c) 2000-2004 The OpenSSL Project. All rights reserved. 6 * Copyright (c) 2000 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
@@ -59,119 +59,88 @@
59 59
60#include <stddef.h> 60#include <stddef.h>
61#include <string.h> 61#include <string.h>
62#include "cryptlib.h"
63#include <openssl/asn1.h> 62#include <openssl/asn1.h>
64#include <openssl/asn1t.h> 63#include <openssl/asn1t.h>
65#include <openssl/objects.h> 64#include <openssl/objects.h>
66 65
67static int asn1_i2d_ex_primitive(ASN1_VALUE **pval, unsigned char **out, 66static int asn1_i2d_ex_primitive(ASN1_VALUE **pval, unsigned char **out, const ASN1_ITEM *it, int tag, int aclass);
68 const ASN1_ITEM *it, 67static int asn1_set_seq_out(STACK_OF(ASN1_VALUE) *seq, unsigned char **out, int skcontlen, const ASN1_ITEM *item, int isset);
69 int tag, int aclass);
70static int asn1_set_seq_out(STACK_OF(ASN1_VALUE) *sk, unsigned char **out,
71 int skcontlen, const ASN1_ITEM *item,
72 int do_sort, int iclass);
73static int asn1_template_ex_i2d(ASN1_VALUE **pval, unsigned char **out,
74 const ASN1_TEMPLATE *tt,
75 int tag, int aclass);
76static int asn1_item_flags_i2d(ASN1_VALUE *val, unsigned char **out,
77 const ASN1_ITEM *it, int flags);
78
79/* Top level i2d equivalents: the 'ndef' variant instructs the encoder
80 * to use indefinite length constructed encoding, where appropriate
81 */
82
83int ASN1_item_ndef_i2d(ASN1_VALUE *val, unsigned char **out,
84 const ASN1_ITEM *it)
85 {
86 return asn1_item_flags_i2d(val, out, it, ASN1_TFLG_NDEF);
87 }
88
89int ASN1_item_i2d(ASN1_VALUE *val, unsigned char **out, const ASN1_ITEM *it)
90 {
91 return asn1_item_flags_i2d(val, out, it, 0);
92 }
93 68
94/* Encode an ASN1 item, this is use by the 69/* Encode an ASN1 item, this is compatible with the
95 * standard 'i2d' function. 'out' points to 70 * standard 'i2d' function. 'out' points to
96 * a buffer to output the data to. 71 * a buffer to output the data to, in future we will
72 * have more advanced versions that can output data
73 * a piece at a time and this will simply be a special
74 * case.
97 * 75 *
98 * The new i2d has one additional feature. If the output 76 * The new i2d has one additional feature. If the output
99 * buffer is NULL (i.e. *out == NULL) then a buffer is 77 * buffer is NULL (i.e. *out == NULL) then a buffer is
100 * allocated and populated with the encoding. 78 * allocated and populated with the encoding.
101 */ 79 */
102 80
103static int asn1_item_flags_i2d(ASN1_VALUE *val, unsigned char **out, 81
104 const ASN1_ITEM *it, int flags) 82int ASN1_item_i2d(ASN1_VALUE *val, unsigned char **out, const ASN1_ITEM *it)
105 { 83{
106 if (out && !*out) 84 if(out && !*out) {
107 {
108 unsigned char *p, *buf; 85 unsigned char *p, *buf;
109 int len; 86 int len;
110 len = ASN1_item_ex_i2d(&val, NULL, it, -1, flags); 87 len = ASN1_item_ex_i2d(&val, NULL, it, -1, 0);
111 if (len <= 0) 88 if(len <= 0) return len;
112 return len;
113 buf = OPENSSL_malloc(len); 89 buf = OPENSSL_malloc(len);
114 if (!buf) 90 if(!buf) return -1;
115 return -1;
116 p = buf; 91 p = buf;
117 ASN1_item_ex_i2d(&val, &p, it, -1, flags); 92 ASN1_item_ex_i2d(&val, &p, it, -1, 0);
118 *out = buf; 93 *out = buf;
119 return len; 94 return len;
120 }
121
122 return ASN1_item_ex_i2d(&val, out, it, -1, flags);
123 } 95 }
96
97 return ASN1_item_ex_i2d(&val, out, it, -1, 0);
98}
124 99
125/* Encode an item, taking care of IMPLICIT tagging (if any). 100/* Encode an item, taking care of IMPLICIT tagging (if any).
126 * This function performs the normal item handling: it can be 101 * This function performs the normal item handling: it can be
127 * used in external types. 102 * used in external types.
128 */ 103 */
129 104
130int ASN1_item_ex_i2d(ASN1_VALUE **pval, unsigned char **out, 105int ASN1_item_ex_i2d(ASN1_VALUE **pval, unsigned char **out, const ASN1_ITEM *it, int tag, int aclass)
131 const ASN1_ITEM *it, int tag, int aclass) 106{
132 {
133 const ASN1_TEMPLATE *tt = NULL; 107 const ASN1_TEMPLATE *tt = NULL;
134 unsigned char *p = NULL; 108 unsigned char *p = NULL;
135 int i, seqcontlen, seqlen, ndef = 1; 109 int i, seqcontlen, seqlen;
110 ASN1_STRING *strtmp;
136 const ASN1_COMPAT_FUNCS *cf; 111 const ASN1_COMPAT_FUNCS *cf;
137 const ASN1_EXTERN_FUNCS *ef; 112 const ASN1_EXTERN_FUNCS *ef;
138 const ASN1_AUX *aux = it->funcs; 113 const ASN1_AUX *aux = it->funcs;
139 ASN1_aux_cb *asn1_cb = 0; 114 ASN1_aux_cb *asn1_cb;
140 115 if((it->itype != ASN1_ITYPE_PRIMITIVE) && !*pval) return 0;
141 if ((it->itype != ASN1_ITYPE_PRIMITIVE) && !*pval) 116 if(aux && aux->asn1_cb) asn1_cb = aux->asn1_cb;
142 return 0; 117 else asn1_cb = 0;
143 118
144 if (aux && aux->asn1_cb) 119 switch(it->itype) {
145 asn1_cb = aux->asn1_cb;
146
147 switch(it->itype)
148 {
149 120
150 case ASN1_ITYPE_PRIMITIVE: 121 case ASN1_ITYPE_PRIMITIVE:
151 if (it->templates) 122 if(it->templates)
152 return asn1_template_ex_i2d(pval, out, it->templates, 123 return ASN1_template_i2d(pval, out, it->templates);
153 tag, aclass);
154 return asn1_i2d_ex_primitive(pval, out, it, tag, aclass); 124 return asn1_i2d_ex_primitive(pval, out, it, tag, aclass);
155 break; 125 break;
156 126
157 case ASN1_ITYPE_MSTRING: 127 case ASN1_ITYPE_MSTRING:
158 return asn1_i2d_ex_primitive(pval, out, it, -1, aclass); 128 strtmp = (ASN1_STRING *)*pval;
129 return asn1_i2d_ex_primitive(pval, out, it, -1, 0);
159 130
160 case ASN1_ITYPE_CHOICE: 131 case ASN1_ITYPE_CHOICE:
161 if (asn1_cb && !asn1_cb(ASN1_OP_I2D_PRE, pval, it)) 132 if(asn1_cb && !asn1_cb(ASN1_OP_I2D_PRE, pval, it))
162 return 0; 133 return 0;
163 i = asn1_get_choice_selector(pval, it); 134 i = asn1_get_choice_selector(pval, it);
164 if ((i >= 0) && (i < it->tcount)) 135 if((i >= 0) && (i < it->tcount)) {
165 {
166 ASN1_VALUE **pchval; 136 ASN1_VALUE **pchval;
167 const ASN1_TEMPLATE *chtt; 137 const ASN1_TEMPLATE *chtt;
168 chtt = it->templates + i; 138 chtt = it->templates + i;
169 pchval = asn1_get_field_ptr(pval, chtt); 139 pchval = asn1_get_field_ptr(pval, chtt);
170 return asn1_template_ex_i2d(pchval, out, chtt, 140 return ASN1_template_i2d(pchval, out, chtt);
171 -1, aclass); 141 }
172 }
173 /* Fixme: error condition if selector out of range */ 142 /* Fixme: error condition if selector out of range */
174 if (asn1_cb && !asn1_cb(ASN1_OP_I2D_POST, pval, it)) 143 if(asn1_cb && !asn1_cb(ASN1_OP_I2D_POST, pval, it))
175 return 0; 144 return 0;
176 break; 145 break;
177 146
@@ -183,236 +152,136 @@ int ASN1_item_ex_i2d(ASN1_VALUE **pval, unsigned char **out,
183 case ASN1_ITYPE_COMPAT: 152 case ASN1_ITYPE_COMPAT:
184 /* old style hackery... */ 153 /* old style hackery... */
185 cf = it->funcs; 154 cf = it->funcs;
186 if (out) 155 if(out) p = *out;
187 p = *out;
188 i = cf->asn1_i2d(*pval, out); 156 i = cf->asn1_i2d(*pval, out);
189 /* Fixup for IMPLICIT tag: note this messes up for tags > 30, 157 /* Fixup for IMPLICIT tag: note this messes up for tags > 30,
190 * but so did the old code. Tags > 30 are very rare anyway. 158 * but so did the old code. Tags > 30 are very rare anyway.
191 */ 159 */
192 if (out && (tag != -1)) 160 if(out && (tag != -1))
193 *p = aclass | tag | (*p & V_ASN1_CONSTRUCTED); 161 *p = aclass | tag | (*p & V_ASN1_CONSTRUCTED);
194 return i; 162 return i;
195 163
196 case ASN1_ITYPE_NDEF_SEQUENCE:
197 /* Use indefinite length constructed if requested */
198 if (aclass & ASN1_TFLG_NDEF) ndef = 2;
199 /* fall through */
200
201 case ASN1_ITYPE_SEQUENCE: 164 case ASN1_ITYPE_SEQUENCE:
202 i = asn1_enc_restore(&seqcontlen, out, pval, it); 165 i = asn1_enc_restore(&seqcontlen, out, pval, it);
203 /* An error occurred */ 166 /* An error occurred */
204 if (i < 0) 167 if(i < 0) return 0;
205 return 0;
206 /* We have a valid cached encoding... */ 168 /* We have a valid cached encoding... */
207 if (i > 0) 169 if(i > 0) return seqcontlen;
208 return seqcontlen;
209 /* Otherwise carry on */ 170 /* Otherwise carry on */
210 seqcontlen = 0; 171 seqcontlen = 0;
211 /* If no IMPLICIT tagging set to SEQUENCE, UNIVERSAL */ 172 /* If no IMPLICIT tagging set to SEQUENCE, UNIVERSAL */
212 if (tag == -1) 173 if(tag == -1) {
213 {
214 tag = V_ASN1_SEQUENCE; 174 tag = V_ASN1_SEQUENCE;
215 /* Retain any other flags in aclass */ 175 aclass = V_ASN1_UNIVERSAL;
216 aclass = (aclass & ~ASN1_TFLG_TAG_CLASS) 176 }
217 | V_ASN1_UNIVERSAL; 177 if(asn1_cb && !asn1_cb(ASN1_OP_I2D_PRE, pval, it))
218 }
219 if (asn1_cb && !asn1_cb(ASN1_OP_I2D_PRE, pval, it))
220 return 0; 178 return 0;
221 /* First work out sequence content length */ 179 /* First work out sequence content length */
222 for (i = 0, tt = it->templates; i < it->tcount; tt++, i++) 180 for(i = 0, tt = it->templates; i < it->tcount; tt++, i++) {
223 {
224 const ASN1_TEMPLATE *seqtt; 181 const ASN1_TEMPLATE *seqtt;
225 ASN1_VALUE **pseqval; 182 ASN1_VALUE **pseqval;
226 seqtt = asn1_do_adb(pval, tt, 1); 183 seqtt = asn1_do_adb(pval, tt, 1);
227 if (!seqtt) 184 if(!seqtt) return 0;
228 return 0;
229 pseqval = asn1_get_field_ptr(pval, seqtt); 185 pseqval = asn1_get_field_ptr(pval, seqtt);
230 /* FIXME: check for errors in enhanced version */ 186 /* FIXME: check for errors in enhanced version */
231 seqcontlen += asn1_template_ex_i2d(pseqval, NULL, seqtt, 187 /* FIXME: special handling of indefinite length encoding */
232 -1, aclass); 188 seqcontlen += ASN1_template_i2d(pseqval, NULL, seqtt);
233 } 189 }
234 190 seqlen = ASN1_object_size(1, seqcontlen, tag);
235 seqlen = ASN1_object_size(ndef, seqcontlen, tag); 191 if(!out) return seqlen;
236 if (!out)
237 return seqlen;
238 /* Output SEQUENCE header */ 192 /* Output SEQUENCE header */
239 ASN1_put_object(out, ndef, seqcontlen, tag, aclass); 193 ASN1_put_object(out, 1, seqcontlen, tag, aclass);
240 for (i = 0, tt = it->templates; i < it->tcount; tt++, i++) 194 for(i = 0, tt = it->templates; i < it->tcount; tt++, i++) {
241 {
242 const ASN1_TEMPLATE *seqtt; 195 const ASN1_TEMPLATE *seqtt;
243 ASN1_VALUE **pseqval; 196 ASN1_VALUE **pseqval;
244 seqtt = asn1_do_adb(pval, tt, 1); 197 seqtt = asn1_do_adb(pval, tt, 1);
245 if (!seqtt) 198 if(!seqtt) return 0;
246 return 0;
247 pseqval = asn1_get_field_ptr(pval, seqtt); 199 pseqval = asn1_get_field_ptr(pval, seqtt);
248 /* FIXME: check for errors in enhanced version */ 200 /* FIXME: check for errors in enhanced version */
249 asn1_template_ex_i2d(pseqval, out, seqtt, -1, aclass); 201 ASN1_template_i2d(pseqval, out, seqtt);
250 } 202 }
251 if (ndef == 2) 203 if(asn1_cb && !asn1_cb(ASN1_OP_I2D_POST, pval, it))
252 ASN1_put_eoc(out);
253 if (asn1_cb && !asn1_cb(ASN1_OP_I2D_POST, pval, it))
254 return 0; 204 return 0;
255 return seqlen; 205 return seqlen;
256 206
257 default: 207 default:
258 return 0; 208 return 0;
259
260 }
261 return 0;
262 }
263
264int ASN1_template_i2d(ASN1_VALUE **pval, unsigned char **out,
265 const ASN1_TEMPLATE *tt)
266 {
267 return asn1_template_ex_i2d(pval, out, tt, -1, 0);
268 } 209 }
210 return 0;
211}
269 212
270static int asn1_template_ex_i2d(ASN1_VALUE **pval, unsigned char **out, 213int ASN1_template_i2d(ASN1_VALUE **pval, unsigned char **out, const ASN1_TEMPLATE *tt)
271 const ASN1_TEMPLATE *tt, int tag, int iclass) 214{
272 { 215 int i, ret, flags, aclass;
273 int i, ret, flags, ttag, tclass, ndef;
274 flags = tt->flags; 216 flags = tt->flags;
275 /* Work out tag and class to use: tagging may come 217 aclass = flags & ASN1_TFLG_TAG_CLASS;
276 * either from the template or the arguments, not both 218 if(flags & ASN1_TFLG_SK_MASK) {
277 * because this would create ambiguity. Additionally
278 * the iclass argument may contain some additional flags
279 * which should be noted and passed down to other levels.
280 */
281 if (flags & ASN1_TFLG_TAG_MASK)
282 {
283 /* Error if argument and template tagging */
284 if (tag != -1)
285 /* FIXME: error code here */
286 return -1;
287 /* Get tagging from template */
288 ttag = tt->tag;
289 tclass = flags & ASN1_TFLG_TAG_CLASS;
290 }
291 else if (tag != -1)
292 {
293 /* No template tagging, get from arguments */
294 ttag = tag;
295 tclass = iclass & ASN1_TFLG_TAG_CLASS;
296 }
297 else
298 {
299 ttag = -1;
300 tclass = 0;
301 }
302 /*
303 * Remove any class mask from iflag.
304 */
305 iclass &= ~ASN1_TFLG_TAG_CLASS;
306
307 /* At this point 'ttag' contains the outer tag to use,
308 * 'tclass' is the class and iclass is any flags passed
309 * to this function.
310 */
311
312 /* if template and arguments require ndef, use it */
313 if ((flags & ASN1_TFLG_NDEF) && (iclass & ASN1_TFLG_NDEF))
314 ndef = 2;
315 else ndef = 1;
316
317 if (flags & ASN1_TFLG_SK_MASK)
318 {
319 /* SET OF, SEQUENCE OF */ 219 /* SET OF, SEQUENCE OF */
320 STACK_OF(ASN1_VALUE) *sk = (STACK_OF(ASN1_VALUE) *)*pval; 220 STACK_OF(ASN1_VALUE) *sk = (STACK_OF(ASN1_VALUE) *)*pval;
321 int isset, sktag, skaclass; 221 int isset, sktag, skaclass;
322 int skcontlen, sklen; 222 int skcontlen, sklen;
323 ASN1_VALUE *skitem; 223 ASN1_VALUE *skitem;
324 224 if(!*pval) return 0;
325 if (!*pval) 225 if(flags & ASN1_TFLG_SET_OF) {
326 return 0;
327
328 if (flags & ASN1_TFLG_SET_OF)
329 {
330 isset = 1; 226 isset = 1;
331 /* 2 means we reorder */ 227 /* 2 means we reorder */
332 if (flags & ASN1_TFLG_SEQUENCE_OF) 228 if(flags & ASN1_TFLG_SEQUENCE_OF) isset = 2;
333 isset = 2; 229 } else isset = 0;
334 } 230 /* First work out inner tag value */
335 else isset = 0; 231 if(flags & ASN1_TFLG_IMPTAG) {
336 232 sktag = tt->tag;
337 /* Work out inner tag value: if EXPLICIT 233 skaclass = aclass;
338 * or no tagging use underlying type. 234 } else {
339 */
340 if ((ttag != -1) && !(flags & ASN1_TFLG_EXPTAG))
341 {
342 sktag = ttag;
343 skaclass = tclass;
344 }
345 else
346 {
347 skaclass = V_ASN1_UNIVERSAL; 235 skaclass = V_ASN1_UNIVERSAL;
348 if (isset) 236 if(isset) sktag = V_ASN1_SET;
349 sktag = V_ASN1_SET;
350 else sktag = V_ASN1_SEQUENCE; 237 else sktag = V_ASN1_SEQUENCE;
351 } 238 }
352 239 /* Now work out length of items */
353 /* Determine total length of items */
354 skcontlen = 0; 240 skcontlen = 0;
355 for (i = 0; i < sk_ASN1_VALUE_num(sk); i++) 241 for(i = 0; i < sk_ASN1_VALUE_num(sk); i++) {
356 {
357 skitem = sk_ASN1_VALUE_value(sk, i); 242 skitem = sk_ASN1_VALUE_value(sk, i);
358 skcontlen += ASN1_item_ex_i2d(&skitem, NULL, 243 skcontlen += ASN1_item_ex_i2d(&skitem, NULL, ASN1_ITEM_ptr(tt->item), -1, 0);
359 ASN1_ITEM_ptr(tt->item), 244 }
360 -1, iclass); 245 sklen = ASN1_object_size(1, skcontlen, sktag);
361 }
362 sklen = ASN1_object_size(ndef, skcontlen, sktag);
363 /* If EXPLICIT need length of surrounding tag */ 246 /* If EXPLICIT need length of surrounding tag */
364 if (flags & ASN1_TFLG_EXPTAG) 247 if(flags & ASN1_TFLG_EXPTAG)
365 ret = ASN1_object_size(ndef, sklen, ttag); 248 ret = ASN1_object_size(1, sklen, tt->tag);
366 else ret = sklen; 249 else ret = sklen;
367 250
368 if (!out) 251 if(!out) return ret;
369 return ret;
370 252
371 /* Now encode this lot... */ 253 /* Now encode this lot... */
372 /* EXPLICIT tag */ 254 /* EXPLICIT tag */
373 if (flags & ASN1_TFLG_EXPTAG) 255 if(flags & ASN1_TFLG_EXPTAG)
374 ASN1_put_object(out, ndef, sklen, ttag, tclass); 256 ASN1_put_object(out, 1, sklen, tt->tag, aclass);
375 /* SET or SEQUENCE and IMPLICIT tag */ 257 /* SET or SEQUENCE and IMPLICIT tag */
376 ASN1_put_object(out, ndef, skcontlen, sktag, skaclass); 258 ASN1_put_object(out, 1, skcontlen, sktag, skaclass);
377 /* And the stuff itself */ 259 /* And finally the stuff itself */
378 asn1_set_seq_out(sk, out, skcontlen, ASN1_ITEM_ptr(tt->item), 260 asn1_set_seq_out(sk, out, skcontlen, ASN1_ITEM_ptr(tt->item), isset);
379 isset, iclass);
380 if (ndef == 2)
381 {
382 ASN1_put_eoc(out);
383 if (flags & ASN1_TFLG_EXPTAG)
384 ASN1_put_eoc(out);
385 }
386 261
387 return ret; 262 return ret;
388 } 263 }
389 264
390 if (flags & ASN1_TFLG_EXPTAG) 265 if(flags & ASN1_TFLG_EXPTAG) {
391 {
392 /* EXPLICIT tagging */ 266 /* EXPLICIT tagging */
393 /* Find length of tagged item */ 267 /* Find length of tagged item */
394 i = ASN1_item_ex_i2d(pval, NULL, ASN1_ITEM_ptr(tt->item), 268 i = ASN1_item_ex_i2d(pval, NULL, ASN1_ITEM_ptr(tt->item), -1, 0);
395 -1, iclass); 269 if(!i) return 0;
396 if (!i)
397 return 0;
398 /* Find length of EXPLICIT tag */ 270 /* Find length of EXPLICIT tag */
399 ret = ASN1_object_size(ndef, i, ttag); 271 ret = ASN1_object_size(1, i, tt->tag);
400 if (out) 272 if(out) {
401 {
402 /* Output tag and item */ 273 /* Output tag and item */
403 ASN1_put_object(out, ndef, i, ttag, tclass); 274 ASN1_put_object(out, 1, i, tt->tag, aclass);
404 ASN1_item_ex_i2d(pval, out, ASN1_ITEM_ptr(tt->item), 275 ASN1_item_ex_i2d(pval, out, ASN1_ITEM_ptr(tt->item), -1, 0);
405 -1, iclass);
406 if (ndef == 2)
407 ASN1_put_eoc(out);
408 }
409 return ret;
410 } 276 }
411 277 return ret;
412 /* Either normal or IMPLICIT tagging: combine class and flags */ 278 }
413 return ASN1_item_ex_i2d(pval, out, ASN1_ITEM_ptr(tt->item), 279 if(flags & ASN1_TFLG_IMPTAG) {
414 ttag, tclass | iclass); 280 /* IMPLICIT tagging */
415 281 return ASN1_item_ex_i2d(pval, out, ASN1_ITEM_ptr(tt->item), tt->tag, aclass);
282 }
283 /* Nothing special: treat as normal */
284 return ASN1_item_ex_i2d(pval, out, ASN1_ITEM_ptr(tt->item), -1, 0);
416} 285}
417 286
418/* Temporary structure used to hold DER encoding of items for SET OF */ 287/* Temporary structure used to hold DER encoding of items for SET OF */
@@ -424,90 +293,72 @@ typedef struct {
424} DER_ENC; 293} DER_ENC;
425 294
426static int der_cmp(const void *a, const void *b) 295static int der_cmp(const void *a, const void *b)
427 { 296{
428 const DER_ENC *d1 = a, *d2 = b; 297 const DER_ENC *d1 = a, *d2 = b;
429 int cmplen, i; 298 int cmplen, i;
430 cmplen = (d1->length < d2->length) ? d1->length : d2->length; 299 cmplen = (d1->length < d2->length) ? d1->length : d2->length;
431 i = memcmp(d1->data, d2->data, cmplen); 300 i = memcmp(d1->data, d2->data, cmplen);
432 if (i) 301 if(i) return i;
433 return i;
434 return d1->length - d2->length; 302 return d1->length - d2->length;
435 } 303}
436 304
437/* Output the content octets of SET OF or SEQUENCE OF */ 305/* Output the content octets of SET OF or SEQUENCE OF */
438 306
439static int asn1_set_seq_out(STACK_OF(ASN1_VALUE) *sk, unsigned char **out, 307static int asn1_set_seq_out(STACK_OF(ASN1_VALUE) *sk, unsigned char **out, int skcontlen, const ASN1_ITEM *item, int do_sort)
440 int skcontlen, const ASN1_ITEM *item, 308{
441 int do_sort, int iclass)
442 {
443 int i; 309 int i;
444 ASN1_VALUE *skitem; 310 ASN1_VALUE *skitem;
445 unsigned char *tmpdat = NULL, *p = NULL; 311 unsigned char *tmpdat = NULL, *p = NULL;
446 DER_ENC *derlst = NULL, *tder; 312 DER_ENC *derlst = NULL, *tder;
447 if (do_sort) 313 if(do_sort) {
448 {
449 /* Don't need to sort less than 2 items */ 314 /* Don't need to sort less than 2 items */
450 if (sk_ASN1_VALUE_num(sk) < 2) 315 if(sk_ASN1_VALUE_num(sk) < 2) do_sort = 0;
451 do_sort = 0; 316 else {
452 else 317 derlst = OPENSSL_malloc(sk_ASN1_VALUE_num(sk) * sizeof(*derlst));
453 {
454 derlst = OPENSSL_malloc(sk_ASN1_VALUE_num(sk)
455 * sizeof(*derlst));
456 tmpdat = OPENSSL_malloc(skcontlen); 318 tmpdat = OPENSSL_malloc(skcontlen);
457 if (!derlst || !tmpdat) 319 if(!derlst || !tmpdat) return 0;
458 return 0;
459 }
460 } 320 }
321 }
461 /* If not sorting just output each item */ 322 /* If not sorting just output each item */
462 if (!do_sort) 323 if(!do_sort) {
463 { 324 for(i = 0; i < sk_ASN1_VALUE_num(sk); i++) {
464 for (i = 0; i < sk_ASN1_VALUE_num(sk); i++)
465 {
466 skitem = sk_ASN1_VALUE_value(sk, i); 325 skitem = sk_ASN1_VALUE_value(sk, i);
467 ASN1_item_ex_i2d(&skitem, out, item, -1, iclass); 326 ASN1_item_i2d(skitem, out, item);
468 }
469 return 1;
470 } 327 }
328 return 1;
329 }
471 p = tmpdat; 330 p = tmpdat;
472
473 /* Doing sort: build up a list of each member's DER encoding */ 331 /* Doing sort: build up a list of each member's DER encoding */
474 for (i = 0, tder = derlst; i < sk_ASN1_VALUE_num(sk); i++, tder++) 332 for(i = 0, tder = derlst; i < sk_ASN1_VALUE_num(sk); i++, tder++) {
475 {
476 skitem = sk_ASN1_VALUE_value(sk, i); 333 skitem = sk_ASN1_VALUE_value(sk, i);
477 tder->data = p; 334 tder->data = p;
478 tder->length = ASN1_item_ex_i2d(&skitem, &p, item, -1, iclass); 335 tder->length = ASN1_item_i2d(skitem, &p, item);
479 tder->field = skitem; 336 tder->field = skitem;
480 } 337 }
481
482 /* Now sort them */ 338 /* Now sort them */
483 qsort(derlst, sk_ASN1_VALUE_num(sk), sizeof(*derlst), der_cmp); 339 qsort(derlst, sk_ASN1_VALUE_num(sk), sizeof(*derlst), der_cmp);
484 /* Output sorted DER encoding */ 340 /* Output sorted DER encoding */
485 p = *out; 341 p = *out;
486 for (i = 0, tder = derlst; i < sk_ASN1_VALUE_num(sk); i++, tder++) 342 for(i = 0, tder = derlst; i < sk_ASN1_VALUE_num(sk); i++, tder++) {
487 {
488 memcpy(p, tder->data, tder->length); 343 memcpy(p, tder->data, tder->length);
489 p += tder->length; 344 p += tder->length;
490 } 345 }
491 *out = p; 346 *out = p;
492 /* If do_sort is 2 then reorder the STACK */ 347 /* If do_sort is 2 then reorder the STACK */
493 if (do_sort == 2) 348 if(do_sort == 2) {
494 { 349 for(i = 0, tder = derlst; i < sk_ASN1_VALUE_num(sk); i++, tder++)
495 for (i = 0, tder = derlst; i < sk_ASN1_VALUE_num(sk); 350 sk_ASN1_VALUE_set(sk, i, tder->field);
496 i++, tder++) 351 }
497 (void)sk_ASN1_VALUE_set(sk, i, tder->field);
498 }
499 OPENSSL_free(derlst); 352 OPENSSL_free(derlst);
500 OPENSSL_free(tmpdat); 353 OPENSSL_free(tmpdat);
501 return 1; 354 return 1;
502 } 355}
503 356
504static int asn1_i2d_ex_primitive(ASN1_VALUE **pval, unsigned char **out, 357static int asn1_i2d_ex_primitive(ASN1_VALUE **pval, unsigned char **out, const ASN1_ITEM *it, int tag, int aclass)
505 const ASN1_ITEM *it, int tag, int aclass) 358{
506 {
507 int len; 359 int len;
508 int utype; 360 int utype;
509 int usetag; 361 int usetag;
510 int ndef = 0;
511 362
512 utype = it->utype; 363 utype = it->utype;
513 364
@@ -523,48 +374,33 @@ static int asn1_i2d_ex_primitive(ASN1_VALUE **pval, unsigned char **out,
523 * because the call to asn1_ex_i2c() could change 374 * because the call to asn1_ex_i2c() could change
524 * utype. 375 * utype.
525 */ 376 */
526 if ((utype == V_ASN1_SEQUENCE) || (utype == V_ASN1_SET) || 377 if((utype == V_ASN1_SEQUENCE) || (utype == V_ASN1_SET) ||
527 (utype == V_ASN1_OTHER)) 378 (utype == V_ASN1_OTHER))
528 usetag = 0; 379 usetag = 0;
529 else usetag = 1; 380 else usetag = 1;
530 381
531 /* -1 means omit type */ 382 /* -1 means omit type */
532 383
533 if (len == -1) 384 if(len == -1) return 0;
534 return 0;
535
536 /* -2 return is special meaning use ndef */
537 if (len == -2)
538 {
539 ndef = 2;
540 len = 0;
541 }
542 385
543 /* If not implicitly tagged get tag from underlying type */ 386 /* If not implicitly tagged get tag from underlying type */
544 if (tag == -1) tag = utype; 387 if(tag == -1) tag = utype;
545 388
546 /* Output tag+length followed by content octets */ 389 /* Output tag+length followed by content octets */
547 if (out) 390 if(out) {
548 { 391 if(usetag) ASN1_put_object(out, 0, len, tag, aclass);
549 if (usetag)
550 ASN1_put_object(out, ndef, len, tag, aclass);
551 asn1_ex_i2c(pval, *out, &utype, it); 392 asn1_ex_i2c(pval, *out, &utype, it);
552 if (ndef) 393 *out += len;
553 ASN1_put_eoc(out); 394 }
554 else
555 *out += len;
556 }
557 395
558 if (usetag) 396 if(usetag) return ASN1_object_size(0, len, tag);
559 return ASN1_object_size(ndef, len, tag);
560 return len; 397 return len;
561 } 398}
562 399
563/* Produce content octets from a structure */ 400/* Produce content octets from a structure */
564 401
565int asn1_ex_i2c(ASN1_VALUE **pval, unsigned char *cout, int *putype, 402int asn1_ex_i2c(ASN1_VALUE **pval, unsigned char *cout, int *putype, const ASN1_ITEM *it)
566 const ASN1_ITEM *it) 403{
567 {
568 ASN1_BOOLEAN *tbool = NULL; 404 ASN1_BOOLEAN *tbool = NULL;
569 ASN1_STRING *strtmp; 405 ASN1_STRING *strtmp;
570 ASN1_OBJECT *otmp; 406 ASN1_OBJECT *otmp;
@@ -573,36 +409,28 @@ int asn1_ex_i2c(ASN1_VALUE **pval, unsigned char *cout, int *putype,
573 int len; 409 int len;
574 const ASN1_PRIMITIVE_FUNCS *pf; 410 const ASN1_PRIMITIVE_FUNCS *pf;
575 pf = it->funcs; 411 pf = it->funcs;
576 if (pf && pf->prim_i2c) 412 if(pf && pf->prim_i2c) return pf->prim_i2c(pval, cout, putype, it);
577 return pf->prim_i2c(pval, cout, putype, it);
578 413
579 /* Should type be omitted? */ 414 /* Should type be omitted? */
580 if ((it->itype != ASN1_ITYPE_PRIMITIVE) 415 if((it->itype != ASN1_ITYPE_PRIMITIVE) || (it->utype != V_ASN1_BOOLEAN)) {
581 || (it->utype != V_ASN1_BOOLEAN)) 416 if(!*pval) return -1;
582 { 417 }
583 if (!*pval) return -1;
584 }
585 418
586 if (it->itype == ASN1_ITYPE_MSTRING) 419 if(it->itype == ASN1_ITYPE_MSTRING) {
587 {
588 /* If MSTRING type set the underlying type */ 420 /* If MSTRING type set the underlying type */
589 strtmp = (ASN1_STRING *)*pval; 421 strtmp = (ASN1_STRING *)*pval;
590 utype = strtmp->type; 422 utype = strtmp->type;
591 *putype = utype; 423 *putype = utype;
592 } 424 } else if(it->utype == V_ASN1_ANY) {
593 else if (it->utype == V_ASN1_ANY)
594 {
595 /* If ANY set type and pointer to value */ 425 /* If ANY set type and pointer to value */
596 ASN1_TYPE *typ; 426 ASN1_TYPE *typ;
597 typ = (ASN1_TYPE *)*pval; 427 typ = (ASN1_TYPE *)*pval;
598 utype = typ->type; 428 utype = typ->type;
599 *putype = utype; 429 *putype = utype;
600 pval = &typ->value.asn1_value; 430 pval = (ASN1_VALUE **)&typ->value.ptr;
601 } 431 } else utype = *putype;
602 else utype = *putype;
603 432
604 switch(utype) 433 switch(utype) {
605 {
606 case V_ASN1_OBJECT: 434 case V_ASN1_OBJECT:
607 otmp = (ASN1_OBJECT *)*pval; 435 otmp = (ASN1_OBJECT *)*pval;
608 cont = otmp->data; 436 cont = otmp->data;
@@ -616,15 +444,12 @@ int asn1_ex_i2c(ASN1_VALUE **pval, unsigned char *cout, int *putype,
616 444
617 case V_ASN1_BOOLEAN: 445 case V_ASN1_BOOLEAN:
618 tbool = (ASN1_BOOLEAN *)pval; 446 tbool = (ASN1_BOOLEAN *)pval;
619 if (*tbool == -1) 447 if(*tbool == -1) return -1;
620 return -1;
621 if (it->utype != V_ASN1_ANY) 448 if (it->utype != V_ASN1_ANY)
622 { 449 {
623 /* Default handling if value == size field then omit */ 450 /* Default handling if value == size field then omit */
624 if (*tbool && (it->size > 0)) 451 if(*tbool && (it->size > 0)) return -1;
625 return -1; 452 if(!*tbool && !it->size) return -1;
626 if (!*tbool && !it->size)
627 return -1;
628 } 453 }
629 c = (unsigned char)*tbool; 454 c = (unsigned char)*tbool;
630 cont = &c; 455 cont = &c;
@@ -632,8 +457,7 @@ int asn1_ex_i2c(ASN1_VALUE **pval, unsigned char *cout, int *putype,
632 break; 457 break;
633 458
634 case V_ASN1_BIT_STRING: 459 case V_ASN1_BIT_STRING:
635 return i2c_ASN1_BIT_STRING((ASN1_BIT_STRING *)*pval, 460 return i2c_ASN1_BIT_STRING((ASN1_BIT_STRING *)*pval, cout ? &cout : NULL);
636 cout ? &cout : NULL);
637 break; 461 break;
638 462
639 case V_ASN1_INTEGER: 463 case V_ASN1_INTEGER:
@@ -643,8 +467,7 @@ int asn1_ex_i2c(ASN1_VALUE **pval, unsigned char *cout, int *putype,
643 /* These are all have the same content format 467 /* These are all have the same content format
644 * as ASN1_INTEGER 468 * as ASN1_INTEGER
645 */ 469 */
646 return i2c_ASN1_INTEGER((ASN1_INTEGER *)*pval, 470 return i2c_ASN1_INTEGER((ASN1_INTEGER *)*pval, cout ? &cout : NULL);
647 cout ? &cout : NULL);
648 break; 471 break;
649 472
650 case V_ASN1_OCTET_STRING: 473 case V_ASN1_OCTET_STRING:
@@ -666,25 +489,12 @@ int asn1_ex_i2c(ASN1_VALUE **pval, unsigned char *cout, int *putype,
666 default: 489 default:
667 /* All based on ASN1_STRING and handled the same */ 490 /* All based on ASN1_STRING and handled the same */
668 strtmp = (ASN1_STRING *)*pval; 491 strtmp = (ASN1_STRING *)*pval;
669 /* Special handling for NDEF */
670 if ((it->size == ASN1_TFLG_NDEF)
671 && (strtmp->flags & ASN1_STRING_FLAG_NDEF))
672 {
673 if (cout)
674 {
675 strtmp->data = cout;
676 strtmp->length = 0;
677 }
678 /* Special return code */
679 return -2;
680 }
681 cont = strtmp->data; 492 cont = strtmp->data;
682 len = strtmp->length; 493 len = strtmp->length;
683 494
684 break; 495 break;
685 496
686 }
687 if (cout && len)
688 memcpy(cout, cont, len);
689 return len;
690 } 497 }
498 if(cout && len) memcpy(cout, cont, len);
499 return len;
500}
diff --git a/src/lib/libcrypto/asn1/tasn_fre.c b/src/lib/libcrypto/asn1/tasn_fre.c
index bb7c1e2af4..2dd844159e 100644
--- a/src/lib/libcrypto/asn1/tasn_fre.c
+++ b/src/lib/libcrypto/asn1/tasn_fre.c
@@ -67,40 +67,33 @@ static void asn1_item_combine_free(ASN1_VALUE **pval, const ASN1_ITEM *it, int c
67/* Free up an ASN1 structure */ 67/* Free up an ASN1 structure */
68 68
69void ASN1_item_free(ASN1_VALUE *val, const ASN1_ITEM *it) 69void ASN1_item_free(ASN1_VALUE *val, const ASN1_ITEM *it)
70 { 70{
71 asn1_item_combine_free(&val, it, 0); 71 asn1_item_combine_free(&val, it, 0);
72 } 72}
73 73
74void ASN1_item_ex_free(ASN1_VALUE **pval, const ASN1_ITEM *it) 74void ASN1_item_ex_free(ASN1_VALUE **pval, const ASN1_ITEM *it)
75 { 75{
76 asn1_item_combine_free(pval, it, 0); 76 asn1_item_combine_free(pval, it, 0);
77 } 77}
78 78
79static void asn1_item_combine_free(ASN1_VALUE **pval, const ASN1_ITEM *it, int combine) 79static void asn1_item_combine_free(ASN1_VALUE **pval, const ASN1_ITEM *it, int combine)
80 { 80{
81 const ASN1_TEMPLATE *tt = NULL, *seqtt; 81 const ASN1_TEMPLATE *tt = NULL, *seqtt;
82 const ASN1_EXTERN_FUNCS *ef; 82 const ASN1_EXTERN_FUNCS *ef;
83 const ASN1_COMPAT_FUNCS *cf; 83 const ASN1_COMPAT_FUNCS *cf;
84 const ASN1_AUX *aux = it->funcs; 84 const ASN1_AUX *aux = it->funcs;
85 ASN1_aux_cb *asn1_cb; 85 ASN1_aux_cb *asn1_cb;
86 int i; 86 int i;
87 if (!pval) 87 if(!pval) return;
88 return; 88 if((it->itype != ASN1_ITYPE_PRIMITIVE) && !*pval) return;
89 if ((it->itype != ASN1_ITYPE_PRIMITIVE) && !*pval) 89 if(aux && aux->asn1_cb) asn1_cb = aux->asn1_cb;
90 return; 90 else asn1_cb = 0;
91 if (aux && aux->asn1_cb)
92 asn1_cb = aux->asn1_cb;
93 else
94 asn1_cb = 0;
95 91
96 switch(it->itype) 92 switch(it->itype) {
97 {
98 93
99 case ASN1_ITYPE_PRIMITIVE: 94 case ASN1_ITYPE_PRIMITIVE:
100 if (it->templates) 95 if(it->templates) ASN1_template_free(pval, it->templates);
101 ASN1_template_free(pval, it->templates); 96 else ASN1_primitive_free(pval, it);
102 else
103 ASN1_primitive_free(pval, it);
104 break; 97 break;
105 98
106 case ASN1_ITYPE_MSTRING: 99 case ASN1_ITYPE_MSTRING:
@@ -108,51 +101,41 @@ static void asn1_item_combine_free(ASN1_VALUE **pval, const ASN1_ITEM *it, int c
108 break; 101 break;
109 102
110 case ASN1_ITYPE_CHOICE: 103 case ASN1_ITYPE_CHOICE:
111 if (asn1_cb) 104 if(asn1_cb) {
112 {
113 i = asn1_cb(ASN1_OP_FREE_PRE, pval, it); 105 i = asn1_cb(ASN1_OP_FREE_PRE, pval, it);
114 if (i == 2) 106 if(i == 2) return;
115 return; 107 }
116 }
117 i = asn1_get_choice_selector(pval, it); 108 i = asn1_get_choice_selector(pval, it);
118 if ((i >= 0) && (i < it->tcount)) 109 if(asn1_cb) asn1_cb(ASN1_OP_FREE_PRE, pval, it);
119 { 110 if((i >= 0) && (i < it->tcount)) {
120 ASN1_VALUE **pchval; 111 ASN1_VALUE **pchval;
121 tt = it->templates + i; 112 tt = it->templates + i;
122 pchval = asn1_get_field_ptr(pval, tt); 113 pchval = asn1_get_field_ptr(pval, tt);
123 ASN1_template_free(pchval, tt); 114 ASN1_template_free(pchval, tt);
124 } 115 }
125 if (asn1_cb) 116 if(asn1_cb) asn1_cb(ASN1_OP_FREE_POST, pval, it);
126 asn1_cb(ASN1_OP_FREE_POST, pval, it); 117 if(!combine) {
127 if (!combine)
128 {
129 OPENSSL_free(*pval); 118 OPENSSL_free(*pval);
130 *pval = NULL; 119 *pval = NULL;
131 } 120 }
132 break; 121 break;
133 122
134 case ASN1_ITYPE_COMPAT: 123 case ASN1_ITYPE_COMPAT:
135 cf = it->funcs; 124 cf = it->funcs;
136 if (cf && cf->asn1_free) 125 if(cf && cf->asn1_free) cf->asn1_free(*pval);
137 cf->asn1_free(*pval);
138 break; 126 break;
139 127
140 case ASN1_ITYPE_EXTERN: 128 case ASN1_ITYPE_EXTERN:
141 ef = it->funcs; 129 ef = it->funcs;
142 if (ef && ef->asn1_ex_free) 130 if(ef && ef->asn1_ex_free) ef->asn1_ex_free(pval, it);
143 ef->asn1_ex_free(pval, it);
144 break; 131 break;
145 132
146 case ASN1_ITYPE_NDEF_SEQUENCE:
147 case ASN1_ITYPE_SEQUENCE: 133 case ASN1_ITYPE_SEQUENCE:
148 if (asn1_do_lock(pval, -1, it) > 0) 134 if(asn1_do_lock(pval, -1, it) > 0) return;
149 return; 135 if(asn1_cb) {
150 if (asn1_cb)
151 {
152 i = asn1_cb(ASN1_OP_FREE_PRE, pval, it); 136 i = asn1_cb(ASN1_OP_FREE_PRE, pval, it);
153 if (i == 2) 137 if(i == 2) return;
154 return; 138 }
155 }
156 asn1_enc_free(pval, it); 139 asn1_enc_free(pval, it);
157 /* If we free up as normal we will invalidate any 140 /* If we free up as normal we will invalidate any
158 * ANY DEFINED BY field and we wont be able to 141 * ANY DEFINED BY field and we wont be able to
@@ -160,84 +143,64 @@ static void asn1_item_combine_free(ASN1_VALUE **pval, const ASN1_ITEM *it, int c
160 * free up in reverse order. 143 * free up in reverse order.
161 */ 144 */
162 tt = it->templates + it->tcount - 1; 145 tt = it->templates + it->tcount - 1;
163 for (i = 0; i < it->tcount; tt--, i++) 146 for(i = 0; i < it->tcount; tt--, i++) {
164 {
165 ASN1_VALUE **pseqval; 147 ASN1_VALUE **pseqval;
166 seqtt = asn1_do_adb(pval, tt, 0); 148 seqtt = asn1_do_adb(pval, tt, 0);
167 if (!seqtt) 149 if(!seqtt) continue;
168 continue;
169 pseqval = asn1_get_field_ptr(pval, seqtt); 150 pseqval = asn1_get_field_ptr(pval, seqtt);
170 ASN1_template_free(pseqval, seqtt); 151 ASN1_template_free(pseqval, seqtt);
171 } 152 }
172 if (asn1_cb) 153 if(asn1_cb) asn1_cb(ASN1_OP_FREE_POST, pval, it);
173 asn1_cb(ASN1_OP_FREE_POST, pval, it); 154 if(!combine) {
174 if (!combine)
175 {
176 OPENSSL_free(*pval); 155 OPENSSL_free(*pval);
177 *pval = NULL; 156 *pval = NULL;
178 }
179 break;
180 } 157 }
158 break;
181 } 159 }
160}
182 161
183void ASN1_template_free(ASN1_VALUE **pval, const ASN1_TEMPLATE *tt) 162void ASN1_template_free(ASN1_VALUE **pval, const ASN1_TEMPLATE *tt)
184 { 163{
185 int i; 164 int i;
186 if (tt->flags & ASN1_TFLG_SK_MASK) 165 if(tt->flags & ASN1_TFLG_SK_MASK) {
187 {
188 STACK_OF(ASN1_VALUE) *sk = (STACK_OF(ASN1_VALUE) *)*pval; 166 STACK_OF(ASN1_VALUE) *sk = (STACK_OF(ASN1_VALUE) *)*pval;
189 for (i = 0; i < sk_ASN1_VALUE_num(sk); i++) 167 for(i = 0; i < sk_ASN1_VALUE_num(sk); i++) {
190 {
191 ASN1_VALUE *vtmp; 168 ASN1_VALUE *vtmp;
192 vtmp = sk_ASN1_VALUE_value(sk, i); 169 vtmp = sk_ASN1_VALUE_value(sk, i);
193 asn1_item_combine_free(&vtmp, ASN1_ITEM_ptr(tt->item), 170 asn1_item_combine_free(&vtmp, ASN1_ITEM_ptr(tt->item), 0);
194 0); 171 }
195 }
196 sk_ASN1_VALUE_free(sk); 172 sk_ASN1_VALUE_free(sk);
197 *pval = NULL; 173 *pval = NULL;
198 } 174 } else asn1_item_combine_free(pval, ASN1_ITEM_ptr(tt->item),
199 else
200 asn1_item_combine_free(pval, ASN1_ITEM_ptr(tt->item),
201 tt->flags & ASN1_TFLG_COMBINE); 175 tt->flags & ASN1_TFLG_COMBINE);
202 } 176}
203 177
204void ASN1_primitive_free(ASN1_VALUE **pval, const ASN1_ITEM *it) 178void ASN1_primitive_free(ASN1_VALUE **pval, const ASN1_ITEM *it)
205 { 179{
206 int utype; 180 int utype;
207 if (it) 181 if(it) {
208 {
209 const ASN1_PRIMITIVE_FUNCS *pf; 182 const ASN1_PRIMITIVE_FUNCS *pf;
210 pf = it->funcs; 183 pf = it->funcs;
211 if (pf && pf->prim_free) 184 if(pf && pf->prim_free) {
212 {
213 pf->prim_free(pval, it); 185 pf->prim_free(pval, it);
214 return; 186 return;
215 }
216 } 187 }
188 }
217 /* Special case: if 'it' is NULL free contents of ASN1_TYPE */ 189 /* Special case: if 'it' is NULL free contents of ASN1_TYPE */
218 if (!it) 190 if(!it) {
219 {
220 ASN1_TYPE *typ = (ASN1_TYPE *)*pval; 191 ASN1_TYPE *typ = (ASN1_TYPE *)*pval;
221 utype = typ->type; 192 utype = typ->type;
222 pval = &typ->value.asn1_value; 193 pval = (ASN1_VALUE **)&typ->value.ptr;
223 if (!*pval) 194 if(!*pval) return;
224 return; 195 } else if(it->itype == ASN1_ITYPE_MSTRING) {
225 }
226 else if (it->itype == ASN1_ITYPE_MSTRING)
227 {
228 utype = -1; 196 utype = -1;
229 if (!*pval) 197 if(!*pval) return;
230 return; 198 } else {
231 }
232 else
233 {
234 utype = it->utype; 199 utype = it->utype;
235 if ((utype != V_ASN1_BOOLEAN) && !*pval) 200 if((utype != V_ASN1_BOOLEAN) && !*pval) return;
236 return; 201 }
237 }
238 202
239 switch(utype) 203 switch(utype) {
240 {
241 case V_ASN1_OBJECT: 204 case V_ASN1_OBJECT:
242 ASN1_OBJECT_free((ASN1_OBJECT *)*pval); 205 ASN1_OBJECT_free((ASN1_OBJECT *)*pval);
243 break; 206 break;
@@ -261,6 +224,6 @@ void ASN1_primitive_free(ASN1_VALUE **pval, const ASN1_ITEM *it)
261 ASN1_STRING_free((ASN1_STRING *)*pval); 224 ASN1_STRING_free((ASN1_STRING *)*pval);
262 *pval = NULL; 225 *pval = NULL;
263 break; 226 break;
264 }
265 *pval = NULL;
266 } 227 }
228 *pval = NULL;
229}
diff --git a/src/lib/libcrypto/asn1/tasn_new.c b/src/lib/libcrypto/asn1/tasn_new.c
index 531dad365c..a0e3db574f 100644
--- a/src/lib/libcrypto/asn1/tasn_new.c
+++ b/src/lib/libcrypto/asn1/tasn_new.c
@@ -3,7 +3,7 @@
3 * project 2000. 3 * project 2000.
4 */ 4 */
5/* ==================================================================== 5/* ====================================================================
6 * Copyright (c) 2000-2004 The OpenSSL Project. All rights reserved. 6 * Copyright (c) 2000 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
@@ -64,30 +64,27 @@
64#include <openssl/asn1t.h> 64#include <openssl/asn1t.h>
65#include <string.h> 65#include <string.h>
66 66
67static int asn1_item_ex_combine_new(ASN1_VALUE **pval, const ASN1_ITEM *it, 67static int asn1_item_ex_combine_new(ASN1_VALUE **pval, const ASN1_ITEM *it, int combine);
68 int combine);
69static void asn1_item_clear(ASN1_VALUE **pval, const ASN1_ITEM *it); 68static void asn1_item_clear(ASN1_VALUE **pval, const ASN1_ITEM *it);
70static void asn1_template_clear(ASN1_VALUE **pval, const ASN1_TEMPLATE *tt); 69static void asn1_template_clear(ASN1_VALUE **pval, const ASN1_TEMPLATE *tt);
71void asn1_primitive_clear(ASN1_VALUE **pval, const ASN1_ITEM *it); 70void asn1_primitive_clear(ASN1_VALUE **pval, const ASN1_ITEM *it);
72 71
73ASN1_VALUE *ASN1_item_new(const ASN1_ITEM *it) 72ASN1_VALUE *ASN1_item_new(const ASN1_ITEM *it)
74 { 73{
75 ASN1_VALUE *ret = NULL; 74 ASN1_VALUE *ret = NULL;
76 if (ASN1_item_ex_new(&ret, it) > 0) 75 if(ASN1_item_ex_new(&ret, it) > 0) return ret;
77 return ret;
78 return NULL; 76 return NULL;
79 } 77}
80 78
81/* Allocate an ASN1 structure */ 79/* Allocate an ASN1 structure */
82 80
83int ASN1_item_ex_new(ASN1_VALUE **pval, const ASN1_ITEM *it) 81int ASN1_item_ex_new(ASN1_VALUE **pval, const ASN1_ITEM *it)
84 { 82{
85 return asn1_item_ex_combine_new(pval, it, 0); 83 return asn1_item_ex_combine_new(pval, it, 0);
86 } 84}
87 85
88static int asn1_item_ex_combine_new(ASN1_VALUE **pval, const ASN1_ITEM *it, 86static int asn1_item_ex_combine_new(ASN1_VALUE **pval, const ASN1_ITEM *it, int combine)
89 int combine) 87{
90 {
91 const ASN1_TEMPLATE *tt = NULL; 88 const ASN1_TEMPLATE *tt = NULL;
92 const ASN1_COMPAT_FUNCS *cf; 89 const ASN1_COMPAT_FUNCS *cf;
93 const ASN1_EXTERN_FUNCS *ef; 90 const ASN1_EXTERN_FUNCS *ef;
@@ -95,155 +92,133 @@ static int asn1_item_ex_combine_new(ASN1_VALUE **pval, const ASN1_ITEM *it,
95 ASN1_aux_cb *asn1_cb; 92 ASN1_aux_cb *asn1_cb;
96 ASN1_VALUE **pseqval; 93 ASN1_VALUE **pseqval;
97 int i; 94 int i;
98 if (aux && aux->asn1_cb) 95 if(aux && aux->asn1_cb) asn1_cb = aux->asn1_cb;
99 asn1_cb = aux->asn1_cb; 96 else asn1_cb = 0;
100 else
101 asn1_cb = 0;
102 97
103 if (!combine) *pval = NULL; 98 if(!combine) *pval = NULL;
104 99
105#ifdef CRYPTO_MDEBUG 100#ifdef CRYPTO_MDEBUG
106 if (it->sname) 101 if(it->sname) CRYPTO_push_info(it->sname);
107 CRYPTO_push_info(it->sname);
108#endif 102#endif
109 103
110 switch(it->itype) 104 switch(it->itype) {
111 {
112 105
113 case ASN1_ITYPE_EXTERN: 106 case ASN1_ITYPE_EXTERN:
114 ef = it->funcs; 107 ef = it->funcs;
115 if (ef && ef->asn1_ex_new) 108 if(ef && ef->asn1_ex_new) {
116 { 109 if(!ef->asn1_ex_new(pval, it))
117 if (!ef->asn1_ex_new(pval, it))
118 goto memerr; 110 goto memerr;
119 } 111 }
120 break; 112 break;
121 113
122 case ASN1_ITYPE_COMPAT: 114 case ASN1_ITYPE_COMPAT:
123 cf = it->funcs; 115 cf = it->funcs;
124 if (cf && cf->asn1_new) { 116 if(cf && cf->asn1_new) {
125 *pval = cf->asn1_new(); 117 *pval = cf->asn1_new();
126 if (!*pval) 118 if(!*pval) goto memerr;
127 goto memerr;
128 } 119 }
129 break; 120 break;
130 121
131 case ASN1_ITYPE_PRIMITIVE: 122 case ASN1_ITYPE_PRIMITIVE:
132 if (it->templates) 123 if(it->templates) {
133 { 124 if(!ASN1_template_new(pval, it->templates))
134 if (!ASN1_template_new(pval, it->templates))
135 goto memerr; 125 goto memerr;
136 } 126 } else {
137 else if (!ASN1_primitive_new(pval, it)) 127 if(!ASN1_primitive_new(pval, it))
138 goto memerr; 128 goto memerr;
129 }
139 break; 130 break;
140 131
141 case ASN1_ITYPE_MSTRING: 132 case ASN1_ITYPE_MSTRING:
142 if (!ASN1_primitive_new(pval, it)) 133 if(!ASN1_primitive_new(pval, it))
143 goto memerr; 134 goto memerr;
144 break; 135 break;
145 136
146 case ASN1_ITYPE_CHOICE: 137 case ASN1_ITYPE_CHOICE:
147 if (asn1_cb) 138 if(asn1_cb) {
148 {
149 i = asn1_cb(ASN1_OP_NEW_PRE, pval, it); 139 i = asn1_cb(ASN1_OP_NEW_PRE, pval, it);
150 if (!i) 140 if(!i) goto auxerr;
151 goto auxerr; 141 if(i==2) {
152 if (i==2)
153 {
154#ifdef CRYPTO_MDEBUG 142#ifdef CRYPTO_MDEBUG
155 if (it->sname) 143 if(it->sname) CRYPTO_pop_info();
156 CRYPTO_pop_info();
157#endif 144#endif
158 return 1; 145 return 1;
159 }
160 } 146 }
161 if (!combine) 147 }
162 { 148 if(!combine) {
163 *pval = OPENSSL_malloc(it->size); 149 *pval = OPENSSL_malloc(it->size);
164 if (!*pval) 150 if(!*pval) goto memerr;
165 goto memerr;
166 memset(*pval, 0, it->size); 151 memset(*pval, 0, it->size);
167 } 152 }
168 asn1_set_choice_selector(pval, -1, it); 153 asn1_set_choice_selector(pval, -1, it);
169 if (asn1_cb && !asn1_cb(ASN1_OP_NEW_POST, pval, it)) 154 if(asn1_cb && !asn1_cb(ASN1_OP_NEW_POST, pval, it))
170 goto auxerr; 155 goto auxerr;
171 break; 156 break;
172 157
173 case ASN1_ITYPE_NDEF_SEQUENCE:
174 case ASN1_ITYPE_SEQUENCE: 158 case ASN1_ITYPE_SEQUENCE:
175 if (asn1_cb) 159 if(asn1_cb) {
176 {
177 i = asn1_cb(ASN1_OP_NEW_PRE, pval, it); 160 i = asn1_cb(ASN1_OP_NEW_PRE, pval, it);
178 if (!i) 161 if(!i) goto auxerr;
179 goto auxerr; 162 if(i==2) {
180 if (i==2)
181 {
182#ifdef CRYPTO_MDEBUG 163#ifdef CRYPTO_MDEBUG
183 if (it->sname) 164 if(it->sname) CRYPTO_pop_info();
184 CRYPTO_pop_info();
185#endif 165#endif
186 return 1; 166 return 1;
187 }
188 } 167 }
189 if (!combine) 168 }
190 { 169 if(!combine) {
191 *pval = OPENSSL_malloc(it->size); 170 *pval = OPENSSL_malloc(it->size);
192 if (!*pval) 171 if(!*pval) goto memerr;
193 goto memerr;
194 memset(*pval, 0, it->size); 172 memset(*pval, 0, it->size);
195 asn1_do_lock(pval, 0, it); 173 asn1_do_lock(pval, 0, it);
196 asn1_enc_init(pval, it); 174 asn1_enc_init(pval, it);
197 } 175 }
198 for (i = 0, tt = it->templates; i < it->tcount; tt++, i++) 176 for(i = 0, tt = it->templates; i < it->tcount; tt++, i++) {
199 {
200 pseqval = asn1_get_field_ptr(pval, tt); 177 pseqval = asn1_get_field_ptr(pval, tt);
201 if (!ASN1_template_new(pseqval, tt)) 178 if(!ASN1_template_new(pseqval, tt)) goto memerr;
202 goto memerr; 179 }
203 } 180 if(asn1_cb && !asn1_cb(ASN1_OP_NEW_POST, pval, it))
204 if (asn1_cb && !asn1_cb(ASN1_OP_NEW_POST, pval, it))
205 goto auxerr; 181 goto auxerr;
206 break; 182 break;
207 } 183 }
208#ifdef CRYPTO_MDEBUG 184#ifdef CRYPTO_MDEBUG
209 if (it->sname) CRYPTO_pop_info(); 185 if(it->sname) CRYPTO_pop_info();
210#endif 186#endif
211 return 1; 187 return 1;
212 188
213 memerr: 189 memerr:
214 ASN1err(ASN1_F_ASN1_ITEM_EX_COMBINE_NEW, ERR_R_MALLOC_FAILURE); 190 ASN1err(ASN1_F_ASN1_ITEM_NEW, ERR_R_MALLOC_FAILURE);
215#ifdef CRYPTO_MDEBUG 191#ifdef CRYPTO_MDEBUG
216 if (it->sname) CRYPTO_pop_info(); 192 if(it->sname) CRYPTO_pop_info();
217#endif 193#endif
218 return 0; 194 return 0;
219 195
220 auxerr: 196 auxerr:
221 ASN1err(ASN1_F_ASN1_ITEM_EX_COMBINE_NEW, ASN1_R_AUX_ERROR); 197 ASN1err(ASN1_F_ASN1_ITEM_NEW, ASN1_R_AUX_ERROR);
222 ASN1_item_ex_free(pval, it); 198 ASN1_item_ex_free(pval, it);
223#ifdef CRYPTO_MDEBUG 199#ifdef CRYPTO_MDEBUG
224 if (it->sname) CRYPTO_pop_info(); 200 if(it->sname) CRYPTO_pop_info();
225#endif 201#endif
226 return 0; 202 return 0;
227 203
228 } 204}
229 205
230static void asn1_item_clear(ASN1_VALUE **pval, const ASN1_ITEM *it) 206static void asn1_item_clear(ASN1_VALUE **pval, const ASN1_ITEM *it)
231 { 207{
232 const ASN1_EXTERN_FUNCS *ef; 208 const ASN1_EXTERN_FUNCS *ef;
233 209
234 switch(it->itype) 210 switch(it->itype) {
235 {
236 211
237 case ASN1_ITYPE_EXTERN: 212 case ASN1_ITYPE_EXTERN:
238 ef = it->funcs; 213 ef = it->funcs;
239 if (ef && ef->asn1_ex_clear) 214 if(ef && ef->asn1_ex_clear)
240 ef->asn1_ex_clear(pval, it); 215 ef->asn1_ex_clear(pval, it);
241 else *pval = NULL; 216 else *pval = NULL;
242 break; 217 break;
243 218
244 219
245 case ASN1_ITYPE_PRIMITIVE: 220 case ASN1_ITYPE_PRIMITIVE:
246 if (it->templates) 221 if(it->templates)
247 asn1_template_clear(pval, it->templates); 222 asn1_template_clear(pval, it->templates);
248 else 223 else
249 asn1_primitive_clear(pval, it); 224 asn1_primitive_clear(pval, it);
@@ -256,90 +231,75 @@ static void asn1_item_clear(ASN1_VALUE **pval, const ASN1_ITEM *it)
256 case ASN1_ITYPE_COMPAT: 231 case ASN1_ITYPE_COMPAT:
257 case ASN1_ITYPE_CHOICE: 232 case ASN1_ITYPE_CHOICE:
258 case ASN1_ITYPE_SEQUENCE: 233 case ASN1_ITYPE_SEQUENCE:
259 case ASN1_ITYPE_NDEF_SEQUENCE:
260 *pval = NULL; 234 *pval = NULL;
261 break; 235 break;
262 }
263 } 236 }
237}
264 238
265 239
266int ASN1_template_new(ASN1_VALUE **pval, const ASN1_TEMPLATE *tt) 240int ASN1_template_new(ASN1_VALUE **pval, const ASN1_TEMPLATE *tt)
267 { 241{
268 const ASN1_ITEM *it = ASN1_ITEM_ptr(tt->item); 242 const ASN1_ITEM *it = ASN1_ITEM_ptr(tt->item);
269 int ret; 243 int ret;
270 if (tt->flags & ASN1_TFLG_OPTIONAL) 244 if(tt->flags & ASN1_TFLG_OPTIONAL) {
271 {
272 asn1_template_clear(pval, tt); 245 asn1_template_clear(pval, tt);
273 return 1; 246 return 1;
274 } 247 }
275 /* If ANY DEFINED BY nothing to do */ 248 /* If ANY DEFINED BY nothing to do */
276 249
277 if (tt->flags & ASN1_TFLG_ADB_MASK) 250 if(tt->flags & ASN1_TFLG_ADB_MASK) {
278 {
279 *pval = NULL; 251 *pval = NULL;
280 return 1; 252 return 1;
281 } 253 }
282#ifdef CRYPTO_MDEBUG 254#ifdef CRYPTO_MDEBUG
283 if (tt->field_name) 255 if(tt->field_name) CRYPTO_push_info(tt->field_name);
284 CRYPTO_push_info(tt->field_name);
285#endif 256#endif
286 /* If SET OF or SEQUENCE OF, its a STACK */ 257 /* If SET OF or SEQUENCE OF, its a STACK */
287 if (tt->flags & ASN1_TFLG_SK_MASK) 258 if(tt->flags & ASN1_TFLG_SK_MASK) {
288 {
289 STACK_OF(ASN1_VALUE) *skval; 259 STACK_OF(ASN1_VALUE) *skval;
290 skval = sk_ASN1_VALUE_new_null(); 260 skval = sk_ASN1_VALUE_new_null();
291 if (!skval) 261 if(!skval) {
292 {
293 ASN1err(ASN1_F_ASN1_TEMPLATE_NEW, ERR_R_MALLOC_FAILURE); 262 ASN1err(ASN1_F_ASN1_TEMPLATE_NEW, ERR_R_MALLOC_FAILURE);
294 ret = 0; 263 ret = 0;
295 goto done; 264 goto done;
296 } 265 }
297 *pval = (ASN1_VALUE *)skval; 266 *pval = (ASN1_VALUE *)skval;
298 ret = 1; 267 ret = 1;
299 goto done; 268 goto done;
300 } 269 }
301 /* Otherwise pass it back to the item routine */ 270 /* Otherwise pass it back to the item routine */
302 ret = asn1_item_ex_combine_new(pval, it, tt->flags & ASN1_TFLG_COMBINE); 271 ret = asn1_item_ex_combine_new(pval, it, tt->flags & ASN1_TFLG_COMBINE);
303 done: 272 done:
304#ifdef CRYPTO_MDEBUG 273#ifdef CRYPTO_MDEBUG
305 if (it->sname) 274 if(it->sname) CRYPTO_pop_info();
306 CRYPTO_pop_info();
307#endif 275#endif
308 return ret; 276 return ret;
309 } 277}
310 278
311static void asn1_template_clear(ASN1_VALUE **pval, const ASN1_TEMPLATE *tt) 279static void asn1_template_clear(ASN1_VALUE **pval, const ASN1_TEMPLATE *tt)
312 { 280{
313 /* If ADB or STACK just NULL the field */ 281 /* If ADB or STACK just NULL the field */
314 if (tt->flags & (ASN1_TFLG_ADB_MASK|ASN1_TFLG_SK_MASK)) 282 if(tt->flags & (ASN1_TFLG_ADB_MASK|ASN1_TFLG_SK_MASK))
315 *pval = NULL; 283 *pval = NULL;
316 else 284 else
317 asn1_item_clear(pval, ASN1_ITEM_ptr(tt->item)); 285 asn1_item_clear(pval, ASN1_ITEM_ptr(tt->item));
318 } 286}
319 287
320 288
321/* NB: could probably combine most of the real XXX_new() behaviour and junk 289/* NB: could probably combine most of the real XXX_new() behaviour and junk all the old
322 * all the old functions. 290 * functions.
323 */ 291 */
324 292
325int ASN1_primitive_new(ASN1_VALUE **pval, const ASN1_ITEM *it) 293int ASN1_primitive_new(ASN1_VALUE **pval, const ASN1_ITEM *it)
326 { 294{
327 ASN1_TYPE *typ; 295 ASN1_TYPE *typ;
328 int utype; 296 int utype;
329 297 const ASN1_PRIMITIVE_FUNCS *pf;
330 if (it && it->funcs) 298 pf = it->funcs;
331 { 299 if(pf && pf->prim_new) return pf->prim_new(pval, it);
332 const ASN1_PRIMITIVE_FUNCS *pf = it->funcs; 300 if(!it || (it->itype == ASN1_ITYPE_MSTRING)) utype = -1;
333 if (pf->prim_new) 301 else utype = it->utype;
334 return pf->prim_new(pval, it); 302 switch(utype) {
335 }
336
337 if (!it || (it->itype == ASN1_ITYPE_MSTRING))
338 utype = -1;
339 else
340 utype = it->utype;
341 switch(utype)
342 {
343 case V_ASN1_OBJECT: 303 case V_ASN1_OBJECT:
344 *pval = (ASN1_VALUE *)OBJ_nid2obj(NID_undef); 304 *pval = (ASN1_VALUE *)OBJ_nid2obj(NID_undef);
345 return 1; 305 return 1;
@@ -357,8 +317,7 @@ int ASN1_primitive_new(ASN1_VALUE **pval, const ASN1_ITEM *it)
357 317
358 case V_ASN1_ANY: 318 case V_ASN1_ANY:
359 typ = OPENSSL_malloc(sizeof(ASN1_TYPE)); 319 typ = OPENSSL_malloc(sizeof(ASN1_TYPE));
360 if (!typ) 320 if(!typ) return 0;
361 return 0;
362 typ->value.ptr = NULL; 321 typ->value.ptr = NULL;
363 typ->type = -1; 322 typ->type = -1;
364 *pval = (ASN1_VALUE *)typ; 323 *pval = (ASN1_VALUE *)typ;
@@ -367,29 +326,26 @@ int ASN1_primitive_new(ASN1_VALUE **pval, const ASN1_ITEM *it)
367 default: 326 default:
368 *pval = (ASN1_VALUE *)ASN1_STRING_type_new(utype); 327 *pval = (ASN1_VALUE *)ASN1_STRING_type_new(utype);
369 break; 328 break;
370 }
371 if (*pval)
372 return 1;
373 return 0;
374 } 329 }
330 if(*pval) return 1;
331 return 0;
332}
375 333
376void asn1_primitive_clear(ASN1_VALUE **pval, const ASN1_ITEM *it) 334void asn1_primitive_clear(ASN1_VALUE **pval, const ASN1_ITEM *it)
377 { 335{
378 int utype; 336 int utype;
379 if (it && it->funcs) 337 const ASN1_PRIMITIVE_FUNCS *pf;
380 { 338 pf = it->funcs;
381 const ASN1_PRIMITIVE_FUNCS *pf = it->funcs; 339 if(pf) {
382 if (pf->prim_clear) 340 if(pf->prim_clear)
383 pf->prim_clear(pval, it); 341 pf->prim_clear(pval, it);
384 else 342 else
385 *pval = NULL; 343 *pval = NULL;
386 return; 344 return;
387 } 345 }
388 if (!it || (it->itype == ASN1_ITYPE_MSTRING)) 346 if(!it || (it->itype == ASN1_ITYPE_MSTRING)) utype = -1;
389 utype = -1; 347 else utype = it->utype;
390 else 348 if(utype == V_ASN1_BOOLEAN)
391 utype = it->utype;
392 if (utype == V_ASN1_BOOLEAN)
393 *(ASN1_BOOLEAN *)pval = it->size; 349 *(ASN1_BOOLEAN *)pval = it->size;
394 else *pval = NULL; 350 else *pval = NULL;
395 } 351}
diff --git a/src/lib/libcrypto/asn1/tasn_typ.c b/src/lib/libcrypto/asn1/tasn_typ.c
index 6f17f1bec7..804d2eeba2 100644
--- a/src/lib/libcrypto/asn1/tasn_typ.c
+++ b/src/lib/libcrypto/asn1/tasn_typ.c
@@ -131,7 +131,3 @@ IMPLEMENT_ASN1_FUNCTIONS_name(ASN1_STRING, DIRECTORYSTRING)
131IMPLEMENT_ASN1_TYPE_ex(ASN1_BOOLEAN, ASN1_BOOLEAN, -1) 131IMPLEMENT_ASN1_TYPE_ex(ASN1_BOOLEAN, ASN1_BOOLEAN, -1)
132IMPLEMENT_ASN1_TYPE_ex(ASN1_TBOOLEAN, ASN1_BOOLEAN, 1) 132IMPLEMENT_ASN1_TYPE_ex(ASN1_TBOOLEAN, ASN1_BOOLEAN, 1)
133IMPLEMENT_ASN1_TYPE_ex(ASN1_FBOOLEAN, ASN1_BOOLEAN, 0) 133IMPLEMENT_ASN1_TYPE_ex(ASN1_FBOOLEAN, ASN1_BOOLEAN, 0)
134
135/* Special, OCTET STRING with indefinite length constructed support */
136
137IMPLEMENT_ASN1_TYPE_ex(ASN1_OCTET_STRING_NDEF, ASN1_OCTET_STRING, ASN1_TFLG_NDEF)
diff --git a/src/lib/libcrypto/asn1/tasn_utl.c b/src/lib/libcrypto/asn1/tasn_utl.c
index 34d520b180..8996ce8c13 100644
--- a/src/lib/libcrypto/asn1/tasn_utl.c
+++ b/src/lib/libcrypto/asn1/tasn_utl.c
@@ -3,7 +3,7 @@
3 * project 2000. 3 * project 2000.
4 */ 4 */
5/* ==================================================================== 5/* ====================================================================
6 * Copyright (c) 2000-2004 The OpenSSL Project. All rights reserved. 6 * Copyright (c) 2000 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
@@ -74,23 +74,23 @@
74 */ 74 */
75 75
76int asn1_get_choice_selector(ASN1_VALUE **pval, const ASN1_ITEM *it) 76int asn1_get_choice_selector(ASN1_VALUE **pval, const ASN1_ITEM *it)
77 { 77{
78 int *sel = offset2ptr(*pval, it->utype); 78 int *sel = offset2ptr(*pval, it->utype);
79 return *sel; 79 return *sel;
80 } 80}
81 81
82/* Given an ASN1_ITEM CHOICE type set 82/* Given an ASN1_ITEM CHOICE type set
83 * the selector value, return old value. 83 * the selector value, return old value.
84 */ 84 */
85 85
86int asn1_set_choice_selector(ASN1_VALUE **pval, int value, const ASN1_ITEM *it) 86int asn1_set_choice_selector(ASN1_VALUE **pval, int value, const ASN1_ITEM *it)
87 { 87{
88 int *sel, ret; 88 int *sel, ret;
89 sel = offset2ptr(*pval, it->utype); 89 sel = offset2ptr(*pval, it->utype);
90 ret = *sel; 90 ret = *sel;
91 *sel = value; 91 *sel = value;
92 return ret; 92 return ret;
93 } 93}
94 94
95/* Do reference counting. The value 'op' decides what to do. 95/* Do reference counting. The value 'op' decides what to do.
96 * if it is +1 then the count is incremented. If op is 0 count is 96 * if it is +1 then the count is incremented. If op is 0 count is
@@ -99,134 +99,114 @@ int asn1_set_choice_selector(ASN1_VALUE **pval, int value, const ASN1_ITEM *it)
99 */ 99 */
100 100
101int asn1_do_lock(ASN1_VALUE **pval, int op, const ASN1_ITEM *it) 101int asn1_do_lock(ASN1_VALUE **pval, int op, const ASN1_ITEM *it)
102 { 102{
103 const ASN1_AUX *aux; 103 const ASN1_AUX *aux;
104 int *lck, ret; 104 int *lck, ret;
105 if ((it->itype != ASN1_ITYPE_SEQUENCE) 105 if(it->itype != ASN1_ITYPE_SEQUENCE) return 0;
106 && (it->itype != ASN1_ITYPE_NDEF_SEQUENCE))
107 return 0;
108 aux = it->funcs; 106 aux = it->funcs;
109 if (!aux || !(aux->flags & ASN1_AFLG_REFCOUNT)) 107 if(!aux || !(aux->flags & ASN1_AFLG_REFCOUNT)) return 0;
110 return 0;
111 lck = offset2ptr(*pval, aux->ref_offset); 108 lck = offset2ptr(*pval, aux->ref_offset);
112 if (op == 0) 109 if(op == 0) {
113 {
114 *lck = 1; 110 *lck = 1;
115 return 1; 111 return 1;
116 } 112 }
117 ret = CRYPTO_add(lck, op, aux->ref_lock); 113 ret = CRYPTO_add(lck, op, aux->ref_lock);
118#ifdef REF_PRINT 114#ifdef REF_PRINT
119 fprintf(stderr, "%s: Reference Count: %d\n", it->sname, *lck); 115 fprintf(stderr, "%s: Reference Count: %d\n", it->sname, *lck);
120#endif 116#endif
121#ifdef REF_CHECK 117#ifdef REF_CHECK
122 if (ret < 0) 118 if(ret < 0)
123 fprintf(stderr, "%s, bad reference count\n", it->sname); 119 fprintf(stderr, "%s, bad reference count\n", it->sname);
124#endif 120#endif
125 return ret; 121 return ret;
126 } 122}
127 123
128static ASN1_ENCODING *asn1_get_enc_ptr(ASN1_VALUE **pval, const ASN1_ITEM *it) 124static ASN1_ENCODING *asn1_get_enc_ptr(ASN1_VALUE **pval, const ASN1_ITEM *it)
129 { 125{
130 const ASN1_AUX *aux; 126 const ASN1_AUX *aux;
131 if (!pval || !*pval) 127 if(!pval || !*pval) return NULL;
132 return NULL;
133 aux = it->funcs; 128 aux = it->funcs;
134 if (!aux || !(aux->flags & ASN1_AFLG_ENCODING)) 129 if(!aux || !(aux->flags & ASN1_AFLG_ENCODING)) return NULL;
135 return NULL;
136 return offset2ptr(*pval, aux->enc_offset); 130 return offset2ptr(*pval, aux->enc_offset);
137 } 131}
138 132
139void asn1_enc_init(ASN1_VALUE **pval, const ASN1_ITEM *it) 133void asn1_enc_init(ASN1_VALUE **pval, const ASN1_ITEM *it)
140 { 134{
141 ASN1_ENCODING *enc; 135 ASN1_ENCODING *enc;
142 enc = asn1_get_enc_ptr(pval, it); 136 enc = asn1_get_enc_ptr(pval, it);
143 if (enc) 137 if(enc) {
144 {
145 enc->enc = NULL; 138 enc->enc = NULL;
146 enc->len = 0; 139 enc->len = 0;
147 enc->modified = 1; 140 enc->modified = 1;
148 }
149 } 141 }
142}
150 143
151void asn1_enc_free(ASN1_VALUE **pval, const ASN1_ITEM *it) 144void asn1_enc_free(ASN1_VALUE **pval, const ASN1_ITEM *it)
152 { 145{
153 ASN1_ENCODING *enc; 146 ASN1_ENCODING *enc;
154 enc = asn1_get_enc_ptr(pval, it); 147 enc = asn1_get_enc_ptr(pval, it);
155 if (enc) 148 if(enc) {
156 { 149 if(enc->enc) OPENSSL_free(enc->enc);
157 if (enc->enc)
158 OPENSSL_free(enc->enc);
159 enc->enc = NULL; 150 enc->enc = NULL;
160 enc->len = 0; 151 enc->len = 0;
161 enc->modified = 1; 152 enc->modified = 1;
162 }
163 } 153 }
154}
164 155
165int asn1_enc_save(ASN1_VALUE **pval, const unsigned char *in, int inlen, 156int asn1_enc_save(ASN1_VALUE **pval, unsigned char *in, int inlen, const ASN1_ITEM *it)
166 const ASN1_ITEM *it) 157{
167 {
168 ASN1_ENCODING *enc; 158 ASN1_ENCODING *enc;
169 enc = asn1_get_enc_ptr(pval, it); 159 enc = asn1_get_enc_ptr(pval, it);
170 if (!enc) 160 if(!enc) return 1;
171 return 1;
172 161
173 if (enc->enc) 162 if(enc->enc) OPENSSL_free(enc->enc);
174 OPENSSL_free(enc->enc);
175 enc->enc = OPENSSL_malloc(inlen); 163 enc->enc = OPENSSL_malloc(inlen);
176 if (!enc->enc) 164 if(!enc->enc) return 0;
177 return 0;
178 memcpy(enc->enc, in, inlen); 165 memcpy(enc->enc, in, inlen);
179 enc->len = inlen; 166 enc->len = inlen;
180 enc->modified = 0; 167 enc->modified = 0;
181 168
182 return 1; 169 return 1;
183 } 170}
184 171
185int asn1_enc_restore(int *len, unsigned char **out, ASN1_VALUE **pval, 172int asn1_enc_restore(int *len, unsigned char **out, ASN1_VALUE **pval, const ASN1_ITEM *it)
186 const ASN1_ITEM *it) 173{
187 {
188 ASN1_ENCODING *enc; 174 ASN1_ENCODING *enc;
189 enc = asn1_get_enc_ptr(pval, it); 175 enc = asn1_get_enc_ptr(pval, it);
190 if (!enc || enc->modified) 176 if(!enc || enc->modified) return 0;
191 return 0; 177 if(out) {
192 if (out)
193 {
194 memcpy(*out, enc->enc, enc->len); 178 memcpy(*out, enc->enc, enc->len);
195 *out += enc->len; 179 *out += enc->len;
196 }
197 if (len)
198 *len = enc->len;
199 return 1;
200 } 180 }
181 if(len) *len = enc->len;
182 return 1;
183}
201 184
202/* Given an ASN1_TEMPLATE get a pointer to a field */ 185/* Given an ASN1_TEMPLATE get a pointer to a field */
203ASN1_VALUE ** asn1_get_field_ptr(ASN1_VALUE **pval, const ASN1_TEMPLATE *tt) 186ASN1_VALUE ** asn1_get_field_ptr(ASN1_VALUE **pval, const ASN1_TEMPLATE *tt)
204 { 187{
205 ASN1_VALUE **pvaltmp; 188 ASN1_VALUE **pvaltmp;
206 if (tt->flags & ASN1_TFLG_COMBINE) 189 if(tt->flags & ASN1_TFLG_COMBINE) return pval;
207 return pval;
208 pvaltmp = offset2ptr(*pval, tt->offset); 190 pvaltmp = offset2ptr(*pval, tt->offset);
209 /* NOTE for BOOLEAN types the field is just a plain 191 /* NOTE for BOOLEAN types the field is just a plain
210 * int so we can't return int **, so settle for 192 * int so we can't return int **, so settle for
211 * (int *). 193 * (int *).
212 */ 194 */
213 return pvaltmp; 195 return pvaltmp;
214 } 196}
215 197
216/* Handle ANY DEFINED BY template, find the selector, look up 198/* Handle ANY DEFINED BY template, find the selector, look up
217 * the relevant ASN1_TEMPLATE in the table and return it. 199 * the relevant ASN1_TEMPLATE in the table and return it.
218 */ 200 */
219 201
220const ASN1_TEMPLATE *asn1_do_adb(ASN1_VALUE **pval, const ASN1_TEMPLATE *tt, 202const ASN1_TEMPLATE *asn1_do_adb(ASN1_VALUE **pval, const ASN1_TEMPLATE *tt, int nullerr)
221 int nullerr) 203{
222 {
223 const ASN1_ADB *adb; 204 const ASN1_ADB *adb;
224 const ASN1_ADB_TABLE *atbl; 205 const ASN1_ADB_TABLE *atbl;
225 long selector; 206 long selector;
226 ASN1_VALUE **sfld; 207 ASN1_VALUE **sfld;
227 int i; 208 int i;
228 if (!(tt->flags & ASN1_TFLG_ADB_MASK)) 209 if(!(tt->flags & ASN1_TFLG_ADB_MASK)) return tt;
229 return tt;
230 210
231 /* Else ANY DEFINED BY ... get the table */ 211 /* Else ANY DEFINED BY ... get the table */
232 adb = ASN1_ADB_ptr(tt->item); 212 adb = ASN1_ADB_ptr(tt->item);
@@ -235,18 +215,16 @@ const ASN1_TEMPLATE *asn1_do_adb(ASN1_VALUE **pval, const ASN1_TEMPLATE *tt,
235 sfld = offset2ptr(*pval, adb->offset); 215 sfld = offset2ptr(*pval, adb->offset);
236 216
237 /* Check if NULL */ 217 /* Check if NULL */
238 if (!sfld) 218 if(!sfld) {
239 { 219 if(!adb->null_tt) goto err;
240 if (!adb->null_tt)
241 goto err;
242 return adb->null_tt; 220 return adb->null_tt;
243 } 221 }
244 222
245 /* Convert type to a long: 223 /* Convert type to a long:
246 * NB: don't check for NID_undef here because it 224 * NB: don't check for NID_undef here because it
247 * might be a legitimate value in the table 225 * might be a legitimate value in the table
248 */ 226 */
249 if (tt->flags & ASN1_TFLG_ADB_OID) 227 if(tt->flags & ASN1_TFLG_ADB_OID)
250 selector = OBJ_obj2nid((ASN1_OBJECT *)*sfld); 228 selector = OBJ_obj2nid((ASN1_OBJECT *)*sfld);
251 else 229 else
252 selector = ASN1_INTEGER_get((ASN1_INTEGER *)*sfld); 230 selector = ASN1_INTEGER_get((ASN1_INTEGER *)*sfld);
@@ -259,21 +237,17 @@ const ASN1_TEMPLATE *asn1_do_adb(ASN1_VALUE **pval, const ASN1_TEMPLATE *tt,
259 * linear search. 237 * linear search.
260 */ 238 */
261 239
262 for (atbl = adb->tbl, i = 0; i < adb->tblcount; i++, atbl++) 240 for(atbl = adb->tbl, i = 0; i < adb->tblcount; i++, atbl++)
263 if (atbl->value == selector) 241 if(atbl->value == selector) return &atbl->tt;
264 return &atbl->tt;
265 242
266 /* FIXME: need to search application table too */ 243 /* FIXME: need to search application table too */
267 244
268 /* No match, return default type */ 245 /* No match, return default type */
269 if (!adb->default_tt) 246 if(!adb->default_tt) goto err;
270 goto err;
271 return adb->default_tt; 247 return adb->default_tt;
272 248
273 err: 249 err:
274 /* FIXME: should log the value or OID of unsupported type */ 250 /* FIXME: should log the value or OID of unsupported type */
275 if (nullerr) 251 if(nullerr) ASN1err(ASN1_F_ASN1_DO_ADB, ASN1_R_UNSUPPORTED_ANY_DEFINED_BY_TYPE);
276 ASN1err(ASN1_F_ASN1_DO_ADB,
277 ASN1_R_UNSUPPORTED_ANY_DEFINED_BY_TYPE);
278 return NULL; 252 return NULL;
279 } 253}
diff --git a/src/lib/libcrypto/asn1/x_algor.c b/src/lib/libcrypto/asn1/x_algor.c
index 33533aba86..00b9ea54a1 100644
--- a/src/lib/libcrypto/asn1/x_algor.c
+++ b/src/lib/libcrypto/asn1/x_algor.c
@@ -66,65 +66,8 @@ ASN1_SEQUENCE(X509_ALGOR) = {
66 ASN1_OPT(X509_ALGOR, parameter, ASN1_ANY) 66 ASN1_OPT(X509_ALGOR, parameter, ASN1_ANY)
67} ASN1_SEQUENCE_END(X509_ALGOR) 67} ASN1_SEQUENCE_END(X509_ALGOR)
68 68
69ASN1_ITEM_TEMPLATE(X509_ALGORS) =
70 ASN1_EX_TEMPLATE_TYPE(ASN1_TFLG_SEQUENCE_OF, 0, algorithms, X509_ALGOR)
71ASN1_ITEM_TEMPLATE_END(X509_ALGORS)
72
73IMPLEMENT_ASN1_FUNCTIONS(X509_ALGOR) 69IMPLEMENT_ASN1_FUNCTIONS(X509_ALGOR)
74IMPLEMENT_ASN1_ENCODE_FUNCTIONS_fname(X509_ALGORS, X509_ALGORS, X509_ALGORS)
75IMPLEMENT_ASN1_DUP_FUNCTION(X509_ALGOR) 70IMPLEMENT_ASN1_DUP_FUNCTION(X509_ALGOR)
76 71
77IMPLEMENT_STACK_OF(X509_ALGOR) 72IMPLEMENT_STACK_OF(X509_ALGOR)
78IMPLEMENT_ASN1_SET_OF(X509_ALGOR) 73IMPLEMENT_ASN1_SET_OF(X509_ALGOR)
79
80int X509_ALGOR_set0(X509_ALGOR *alg, ASN1_OBJECT *aobj, int ptype, void *pval)
81 {
82 if (!alg)
83 return 0;
84 if (ptype != V_ASN1_UNDEF)
85 {
86 if (alg->parameter == NULL)
87 alg->parameter = ASN1_TYPE_new();
88 if (alg->parameter == NULL)
89 return 0;
90 }
91 if (alg)
92 {
93 if (alg->algorithm)
94 ASN1_OBJECT_free(alg->algorithm);
95 alg->algorithm = aobj;
96 }
97 if (ptype == 0)
98 return 1;
99 if (ptype == V_ASN1_UNDEF)
100 {
101 if (alg->parameter)
102 {
103 ASN1_TYPE_free(alg->parameter);
104 alg->parameter = NULL;
105 }
106 }
107 else
108 ASN1_TYPE_set(alg->parameter, ptype, pval);
109 return 1;
110 }
111
112void X509_ALGOR_get0(ASN1_OBJECT **paobj, int *pptype, void **ppval,
113 X509_ALGOR *algor)
114 {
115 if (paobj)
116 *paobj = algor->algorithm;
117 if (pptype)
118 {
119 if (algor->parameter == NULL)
120 {
121 *pptype = V_ASN1_UNDEF;
122 return;
123 }
124 else
125 *pptype = algor->parameter->type;
126 if (ppval)
127 *ppval = algor->parameter->value.ptr;
128 }
129 }
130
diff --git a/src/lib/libcrypto/asn1/x_bignum.c b/src/lib/libcrypto/asn1/x_bignum.c
index 869c05d931..848c7a0877 100644
--- a/src/lib/libcrypto/asn1/x_bignum.c
+++ b/src/lib/libcrypto/asn1/x_bignum.c
@@ -59,7 +59,6 @@
59#include <stdio.h> 59#include <stdio.h>
60#include "cryptlib.h" 60#include "cryptlib.h"
61#include <openssl/asn1t.h> 61#include <openssl/asn1t.h>
62#include <openssl/bn.h>
63 62
64/* Custom primitive type for BIGNUM handling. This reads in an ASN1_INTEGER as a 63/* Custom primitive type for BIGNUM handling. This reads in an ASN1_INTEGER as a
65 * BIGNUM directly. Currently it ignores the sign which isn't a problem since all 64 * BIGNUM directly. Currently it ignores the sign which isn't a problem since all
@@ -73,7 +72,7 @@ static int bn_new(ASN1_VALUE **pval, const ASN1_ITEM *it);
73static void bn_free(ASN1_VALUE **pval, const ASN1_ITEM *it); 72static void bn_free(ASN1_VALUE **pval, const ASN1_ITEM *it);
74 73
75static int bn_i2c(ASN1_VALUE **pval, unsigned char *cont, int *putype, const ASN1_ITEM *it); 74static int bn_i2c(ASN1_VALUE **pval, unsigned char *cont, int *putype, const ASN1_ITEM *it);
76static int bn_c2i(ASN1_VALUE **pval, const unsigned char *cont, int len, int utype, char *free_cont, const ASN1_ITEM *it); 75static int bn_c2i(ASN1_VALUE **pval, unsigned char *cont, int len, int utype, char *free_cont, const ASN1_ITEM *it);
77 76
78static ASN1_PRIMITIVE_FUNCS bignum_pf = { 77static ASN1_PRIMITIVE_FUNCS bignum_pf = {
79 NULL, 0, 78 NULL, 0,
@@ -123,8 +122,7 @@ static int bn_i2c(ASN1_VALUE **pval, unsigned char *cont, int *putype, const ASN
123 return pad + BN_num_bytes(bn); 122 return pad + BN_num_bytes(bn);
124} 123}
125 124
126static int bn_c2i(ASN1_VALUE **pval, const unsigned char *cont, int len, 125static int bn_c2i(ASN1_VALUE **pval, unsigned char *cont, int len, int utype, char *free_cont, const ASN1_ITEM *it)
127 int utype, char *free_cont, const ASN1_ITEM *it)
128{ 126{
129 BIGNUM *bn; 127 BIGNUM *bn;
130 if(!*pval) bn_new(pval, it); 128 if(!*pval) bn_new(pval, it);
diff --git a/src/lib/libcrypto/asn1/x_cinf.c b/src/lib/libcrypto/asn1/x_cinf.c
new file mode 100644
index 0000000000..339a110eef
--- /dev/null
+++ b/src/lib/libcrypto/asn1/x_cinf.c
@@ -0,0 +1,201 @@
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..b99f8fc522 100644
--- a/src/lib/libcrypto/asn1/x_crl.c
+++ b/src/lib/libcrypto/asn1/x_crl.c
@@ -84,7 +84,7 @@ static int crl_inf_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it)
84 * would affect the output of X509_CRL_print(). 84 * would affect the output of X509_CRL_print().
85 */ 85 */
86 case ASN1_OP_D2I_POST: 86 case ASN1_OP_D2I_POST:
87 (void)sk_X509_REVOKED_set_cmp_func(a->revoked,X509_REVOKED_cmp); 87 sk_X509_REVOKED_set_cmp_func(a->revoked,X509_REVOKED_cmp);
88 break; 88 break;
89 } 89 }
90 return 1; 90 return 1;
diff --git a/src/lib/libcrypto/asn1/x_exten.c b/src/lib/libcrypto/asn1/x_exten.c
index 1732e66712..702421b6c8 100644
--- a/src/lib/libcrypto/asn1/x_exten.c
+++ b/src/lib/libcrypto/asn1/x_exten.c
@@ -67,10 +67,5 @@ ASN1_SEQUENCE(X509_EXTENSION) = {
67 ASN1_SIMPLE(X509_EXTENSION, value, ASN1_OCTET_STRING) 67 ASN1_SIMPLE(X509_EXTENSION, value, ASN1_OCTET_STRING)
68} ASN1_SEQUENCE_END(X509_EXTENSION) 68} ASN1_SEQUENCE_END(X509_EXTENSION)
69 69
70ASN1_ITEM_TEMPLATE(X509_EXTENSIONS) =
71 ASN1_EX_TEMPLATE_TYPE(ASN1_TFLG_SEQUENCE_OF, 0, Extension, X509_EXTENSION)
72ASN1_ITEM_TEMPLATE_END(X509_EXTENSIONS)
73
74IMPLEMENT_ASN1_FUNCTIONS(X509_EXTENSION) 70IMPLEMENT_ASN1_FUNCTIONS(X509_EXTENSION)
75IMPLEMENT_ASN1_ENCODE_FUNCTIONS_fname(X509_EXTENSIONS, X509_EXTENSIONS, X509_EXTENSIONS)
76IMPLEMENT_ASN1_DUP_FUNCTION(X509_EXTENSION) 71IMPLEMENT_ASN1_DUP_FUNCTION(X509_EXTENSION)
diff --git a/src/lib/libcrypto/asn1/x_long.c b/src/lib/libcrypto/asn1/x_long.c
index 0db233cb95..c5f25956cb 100644
--- a/src/lib/libcrypto/asn1/x_long.c
+++ b/src/lib/libcrypto/asn1/x_long.c
@@ -59,7 +59,6 @@
59#include <stdio.h> 59#include <stdio.h>
60#include "cryptlib.h" 60#include "cryptlib.h"
61#include <openssl/asn1t.h> 61#include <openssl/asn1t.h>
62#include <openssl/bn.h>
63 62
64/* Custom primitive type for long handling. This converts between an ASN1_INTEGER 63/* Custom primitive type for long handling. This converts between an ASN1_INTEGER
65 * and a long directly. 64 * and a long directly.
@@ -70,7 +69,7 @@ static int long_new(ASN1_VALUE **pval, const ASN1_ITEM *it);
70static void long_free(ASN1_VALUE **pval, const ASN1_ITEM *it); 69static void long_free(ASN1_VALUE **pval, const ASN1_ITEM *it);
71 70
72static int long_i2c(ASN1_VALUE **pval, unsigned char *cont, int *putype, const ASN1_ITEM *it); 71static 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); 72static int long_c2i(ASN1_VALUE **pval, unsigned char *cont, int len, int utype, char *free_cont, const ASN1_ITEM *it);
74 73
75static ASN1_PRIMITIVE_FUNCS long_pf = { 74static ASN1_PRIMITIVE_FUNCS long_pf = {
76 NULL, 0, 75 NULL, 0,
@@ -137,14 +136,13 @@ static int long_i2c(ASN1_VALUE **pval, unsigned char *cont, int *putype, const A
137 return clen + pad; 136 return clen + pad;
138} 137}
139 138
140static int long_c2i(ASN1_VALUE **pval, const unsigned char *cont, int len, 139static int long_c2i(ASN1_VALUE **pval, unsigned char *cont, int len, int utype, char *free_cont, const ASN1_ITEM *it)
141 int utype, char *free_cont, const ASN1_ITEM *it)
142{ 140{
143 int neg, i; 141 int neg, i;
144 long ltmp; 142 long ltmp;
145 unsigned long utmp = 0; 143 unsigned long utmp = 0;
146 char *cp = (char *)pval; 144 char *cp = (char *)pval;
147 if(len > (int)sizeof(long)) { 145 if(len > sizeof(long)) {
148 ASN1err(ASN1_F_LONG_C2I, ASN1_R_INTEGER_TOO_LARGE_FOR_LONG); 146 ASN1err(ASN1_F_LONG_C2I, ASN1_R_INTEGER_TOO_LARGE_FOR_LONG);
149 return 0; 147 return 0;
150 } 148 }
diff --git a/src/lib/libcrypto/asn1/x_name.c b/src/lib/libcrypto/asn1/x_name.c
index 04380abc3f..31f3377b64 100644
--- a/src/lib/libcrypto/asn1/x_name.c
+++ b/src/lib/libcrypto/asn1/x_name.c
@@ -61,7 +61,7 @@
61#include <openssl/asn1t.h> 61#include <openssl/asn1t.h>
62#include <openssl/x509.h> 62#include <openssl/x509.h>
63 63
64static int x509_name_ex_d2i(ASN1_VALUE **val, const unsigned char **in, long len, const ASN1_ITEM *it, 64static int x509_name_ex_d2i(ASN1_VALUE **val, unsigned char **in, long len, const ASN1_ITEM *it,
65 int tag, int aclass, char opt, ASN1_TLC *ctx); 65 int tag, int aclass, char opt, ASN1_TLC *ctx);
66 66
67static int x509_name_ex_i2d(ASN1_VALUE **val, unsigned char **out, const ASN1_ITEM *it, int tag, int aclass); 67static int x509_name_ex_i2d(ASN1_VALUE **val, unsigned char **out, const ASN1_ITEM *it, int tag, int aclass);
@@ -123,7 +123,7 @@ static int x509_name_ex_new(ASN1_VALUE **val, const ASN1_ITEM *it)
123 return 1; 123 return 1;
124 124
125 memerr: 125 memerr:
126 ASN1err(ASN1_F_X509_NAME_EX_NEW, ERR_R_MALLOC_FAILURE); 126 ASN1err(ASN1_F_X509_NAME_NEW, ERR_R_MALLOC_FAILURE);
127 if (ret) 127 if (ret)
128 { 128 {
129 if (ret->entries) 129 if (ret->entries)
@@ -156,48 +156,48 @@ static void sk_internal_free(void *a)
156 sk_free(a); 156 sk_free(a);
157} 157}
158 158
159static int x509_name_ex_d2i(ASN1_VALUE **val, const unsigned char **in, long len, const ASN1_ITEM *it, 159static int x509_name_ex_d2i(ASN1_VALUE **val, unsigned char **in, long len, const ASN1_ITEM *it,
160 int tag, int aclass, char opt, ASN1_TLC *ctx) 160 int tag, int aclass, char opt, ASN1_TLC *ctx)
161{ 161{
162 const unsigned char *p = *in, *q; 162 unsigned char *p = *in, *q;
163 union { STACK *s; ASN1_VALUE *a; } intname = {NULL}; 163 STACK *intname = NULL, **intname_pp = &intname;
164 union { X509_NAME *x; ASN1_VALUE *a; } nm = {NULL};
165 int i, j, ret; 164 int i, j, ret;
165 X509_NAME *nm = NULL, **nm_pp = &nm;
166 STACK_OF(X509_NAME_ENTRY) *entries; 166 STACK_OF(X509_NAME_ENTRY) *entries;
167 X509_NAME_ENTRY *entry; 167 X509_NAME_ENTRY *entry;
168 q = p; 168 q = p;
169 169
170 /* Get internal representation of Name */ 170 /* Get internal representation of Name */
171 ret = ASN1_item_ex_d2i(&intname.a, 171 ret = ASN1_item_ex_d2i((ASN1_VALUE **)intname_pp,
172 &p, len, ASN1_ITEM_rptr(X509_NAME_INTERNAL), 172 &p, len, ASN1_ITEM_rptr(X509_NAME_INTERNAL),
173 tag, aclass, opt, ctx); 173 tag, aclass, opt, ctx);
174 174
175 if(ret <= 0) return ret; 175 if(ret <= 0) return ret;
176 176
177 if(*val) x509_name_ex_free(val, NULL); 177 if(*val) x509_name_ex_free(val, NULL);
178 if(!x509_name_ex_new(&nm.a, NULL)) goto err; 178 if(!x509_name_ex_new((ASN1_VALUE **)nm_pp, NULL)) goto err;
179 /* We've decoded it: now cache encoding */ 179 /* We've decoded it: now cache encoding */
180 if(!BUF_MEM_grow(nm.x->bytes, p - q)) goto err; 180 if(!BUF_MEM_grow(nm->bytes, p - q)) goto err;
181 memcpy(nm.x->bytes->data, q, p - q); 181 memcpy(nm->bytes->data, q, p - q);
182 182
183 /* Convert internal representation to X509_NAME structure */ 183 /* Convert internal representation to X509_NAME structure */
184 for(i = 0; i < sk_num(intname.s); i++) { 184 for(i = 0; i < sk_num(intname); i++) {
185 entries = (STACK_OF(X509_NAME_ENTRY) *)sk_value(intname.s, i); 185 entries = (STACK_OF(X509_NAME_ENTRY) *)sk_value(intname, i);
186 for(j = 0; j < sk_X509_NAME_ENTRY_num(entries); j++) { 186 for(j = 0; j < sk_X509_NAME_ENTRY_num(entries); j++) {
187 entry = sk_X509_NAME_ENTRY_value(entries, j); 187 entry = sk_X509_NAME_ENTRY_value(entries, j);
188 entry->set = i; 188 entry->set = i;
189 if(!sk_X509_NAME_ENTRY_push(nm.x->entries, entry)) 189 if(!sk_X509_NAME_ENTRY_push(nm->entries, entry))
190 goto err; 190 goto err;
191 } 191 }
192 sk_X509_NAME_ENTRY_free(entries); 192 sk_X509_NAME_ENTRY_free(entries);
193 } 193 }
194 sk_free(intname.s); 194 sk_free(intname);
195 nm.x->modified = 0; 195 nm->modified = 0;
196 *val = nm.a; 196 *val = (ASN1_VALUE *)nm;
197 *in = p; 197 *in = p;
198 return ret; 198 return ret;
199 err: 199 err:
200 ASN1err(ASN1_F_X509_NAME_EX_D2I, ERR_R_NESTED_ASN1_ERROR); 200 ASN1err(ASN1_F_D2I_X509_NAME, ERR_R_NESTED_ASN1_ERROR);
201 return 0; 201 return 0;
202} 202}
203 203
@@ -219,36 +219,36 @@ static int x509_name_ex_i2d(ASN1_VALUE **val, unsigned char **out, const ASN1_IT
219 219
220static int x509_name_encode(X509_NAME *a) 220static int x509_name_encode(X509_NAME *a)
221{ 221{
222 union { STACK *s; ASN1_VALUE *a; } intname = {NULL}; 222 STACK *intname = NULL, **intname_pp = &intname;
223 int len; 223 int len;
224 unsigned char *p; 224 unsigned char *p;
225 STACK_OF(X509_NAME_ENTRY) *entries = NULL; 225 STACK_OF(X509_NAME_ENTRY) *entries = NULL;
226 X509_NAME_ENTRY *entry; 226 X509_NAME_ENTRY *entry;
227 int i, set = -1; 227 int i, set = -1;
228 intname.s = sk_new_null(); 228 intname = sk_new_null();
229 if(!intname.s) goto memerr; 229 if(!intname) goto memerr;
230 for(i = 0; i < sk_X509_NAME_ENTRY_num(a->entries); i++) { 230 for(i = 0; i < sk_X509_NAME_ENTRY_num(a->entries); i++) {
231 entry = sk_X509_NAME_ENTRY_value(a->entries, i); 231 entry = sk_X509_NAME_ENTRY_value(a->entries, i);
232 if(entry->set != set) { 232 if(entry->set != set) {
233 entries = sk_X509_NAME_ENTRY_new_null(); 233 entries = sk_X509_NAME_ENTRY_new_null();
234 if(!entries) goto memerr; 234 if(!entries) goto memerr;
235 if(!sk_push(intname.s, (char *)entries)) goto memerr; 235 if(!sk_push(intname, (char *)entries)) goto memerr;
236 set = entry->set; 236 set = entry->set;
237 } 237 }
238 if(!sk_X509_NAME_ENTRY_push(entries, entry)) goto memerr; 238 if(!sk_X509_NAME_ENTRY_push(entries, entry)) goto memerr;
239 } 239 }
240 len = ASN1_item_ex_i2d(&intname.a, NULL, 240 len = ASN1_item_ex_i2d((ASN1_VALUE **)intname_pp, NULL,
241 ASN1_ITEM_rptr(X509_NAME_INTERNAL), -1, -1); 241 ASN1_ITEM_rptr(X509_NAME_INTERNAL), -1, -1);
242 if (!BUF_MEM_grow(a->bytes,len)) goto memerr; 242 if (!BUF_MEM_grow(a->bytes,len)) goto memerr;
243 p=(unsigned char *)a->bytes->data; 243 p=(unsigned char *)a->bytes->data;
244 ASN1_item_ex_i2d(&intname.a, 244 ASN1_item_ex_i2d((ASN1_VALUE **)intname_pp,
245 &p, ASN1_ITEM_rptr(X509_NAME_INTERNAL), -1, -1); 245 &p, ASN1_ITEM_rptr(X509_NAME_INTERNAL), -1, -1);
246 sk_pop_free(intname.s, sk_internal_free); 246 sk_pop_free(intname, sk_internal_free);
247 a->modified = 0; 247 a->modified = 0;
248 return len; 248 return len;
249 memerr: 249 memerr:
250 sk_pop_free(intname.s, sk_internal_free); 250 sk_pop_free(intname, sk_internal_free);
251 ASN1err(ASN1_F_X509_NAME_ENCODE, ERR_R_MALLOC_FAILURE); 251 ASN1err(ASN1_F_D2I_X509_NAME, ERR_R_MALLOC_FAILURE);
252 return -1; 252 return -1;
253} 253}
254 254
diff --git a/src/lib/libcrypto/asn1/x_pkey.c b/src/lib/libcrypto/asn1/x_pkey.c
index 8453618426..f1c6221ac3 100644
--- a/src/lib/libcrypto/asn1/x_pkey.c
+++ b/src/lib/libcrypto/asn1/x_pkey.c
@@ -69,15 +69,15 @@ int i2d_X509_PKEY(X509_PKEY *a, unsigned char **pp)
69 return(0); 69 return(0);
70 } 70 }
71 71
72X509_PKEY *d2i_X509_PKEY(X509_PKEY **a, const unsigned char **pp, long length) 72X509_PKEY *d2i_X509_PKEY(X509_PKEY **a, unsigned char **pp, long length)
73 { 73 {
74 int i; 74 int i;
75 M_ASN1_D2I_vars(a,X509_PKEY *,X509_PKEY_new); 75 M_ASN1_D2I_vars(a,X509_PKEY *,X509_PKEY_new);
76 76
77 M_ASN1_D2I_Init(); 77 M_ASN1_D2I_Init();
78 M_ASN1_D2I_start_sequence(); 78 M_ASN1_D2I_start_sequence();
79 M_ASN1_D2I_get_x(X509_ALGOR,ret->enc_algor,d2i_X509_ALGOR); 79 M_ASN1_D2I_get(ret->enc_algor,d2i_X509_ALGOR);
80 M_ASN1_D2I_get_x(ASN1_OCTET_STRING,ret->enc_pkey,d2i_ASN1_OCTET_STRING); 80 M_ASN1_D2I_get(ret->enc_pkey,d2i_ASN1_OCTET_STRING);
81 81
82 ret->cipher.cipher=EVP_get_cipherbyname( 82 ret->cipher.cipher=EVP_get_cipherbyname(
83 OBJ_nid2ln(OBJ_obj2nid(ret->enc_algor->algorithm))); 83 OBJ_nid2ln(OBJ_obj2nid(ret->enc_algor->algorithm)));
diff --git a/src/lib/libcrypto/asn1/x_pubkey.c b/src/lib/libcrypto/asn1/x_pubkey.c
index 91c2756116..7d6d71af88 100644
--- a/src/lib/libcrypto/asn1/x_pubkey.c
+++ b/src/lib/libcrypto/asn1/x_pubkey.c
@@ -60,23 +60,16 @@
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#ifndef OPENSSL_NO_RSA
64#include <openssl/rsa.h>
65#endif
66#ifndef OPENSSL_NO_DSA
67#include <openssl/dsa.h>
68#endif
69 63
70/* Minor tweak to operation: free up EVP_PKEY */ 64/* Minor tweak to operation: free up EVP_PKEY */
71static int pubkey_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it) 65static int pubkey_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it)
72 { 66{
73 if (operation == ASN1_OP_FREE_POST) 67 if(operation == ASN1_OP_FREE_POST) {
74 {
75 X509_PUBKEY *pubkey = (X509_PUBKEY *)*pval; 68 X509_PUBKEY *pubkey = (X509_PUBKEY *)*pval;
76 EVP_PKEY_free(pubkey->pkey); 69 EVP_PKEY_free(pubkey->pkey);
77 }
78 return 1;
79 } 70 }
71 return 1;
72}
80 73
81ASN1_SEQUENCE_cb(X509_PUBKEY, pubkey_cb) = { 74ASN1_SEQUENCE_cb(X509_PUBKEY, pubkey_cb) = {
82 ASN1_SIMPLE(X509_PUBKEY, algor, X509_ALGOR), 75 ASN1_SIMPLE(X509_PUBKEY, algor, X509_ALGOR),
@@ -118,12 +111,13 @@ int X509_PUBKEY_set(X509_PUBKEY **x, EVP_PKEY *pkey)
118 a->parameter->type=V_ASN1_NULL; 111 a->parameter->type=V_ASN1_NULL;
119 } 112 }
120 } 113 }
114 else
121#ifndef OPENSSL_NO_DSA 115#ifndef OPENSSL_NO_DSA
122 else if (pkey->type == EVP_PKEY_DSA) 116 if (pkey->type == EVP_PKEY_DSA)
123 { 117 {
124 unsigned char *pp; 118 unsigned char *pp;
125 DSA *dsa; 119 DSA *dsa;
126 120
127 dsa=pkey->pkey.dsa; 121 dsa=pkey->pkey.dsa;
128 dsa->write_params=0; 122 dsa->write_params=0;
129 ASN1_TYPE_free(a->parameter); 123 ASN1_TYPE_free(a->parameter);
@@ -157,64 +151,8 @@ int X509_PUBKEY_set(X509_PUBKEY **x, EVP_PKEY *pkey)
157 } 151 }
158 OPENSSL_free(p); 152 OPENSSL_free(p);
159 } 153 }
154 else
160#endif 155#endif
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 { 156 {
219 X509err(X509_F_X509_PUBKEY_SET,X509_R_UNSUPPORTED_ALGORITHM); 157 X509err(X509_F_X509_PUBKEY_SET,X509_R_UNSUPPORTED_ALGORITHM);
220 goto err; 158 goto err;
@@ -233,7 +171,7 @@ int X509_PUBKEY_set(X509_PUBKEY **x, EVP_PKEY *pkey)
233 X509err(X509_F_X509_PUBKEY_SET,ERR_R_MALLOC_FAILURE); 171 X509err(X509_F_X509_PUBKEY_SET,ERR_R_MALLOC_FAILURE);
234 goto err; 172 goto err;
235 } 173 }
236 /* Set number of unused bits to zero */ 174 /* Set number of unused bits to zero */
237 pk->public_key->flags&= ~(ASN1_STRING_FLAG_BITS_LEFT|0x07); 175 pk->public_key->flags&= ~(ASN1_STRING_FLAG_BITS_LEFT|0x07);
238 pk->public_key->flags|=ASN1_STRING_FLAG_BITS_LEFT; 176 pk->public_key->flags|=ASN1_STRING_FLAG_BITS_LEFT;
239 177
@@ -260,8 +198,8 @@ EVP_PKEY *X509_PUBKEY_get(X509_PUBKEY *key)
260 EVP_PKEY *ret=NULL; 198 EVP_PKEY *ret=NULL;
261 long j; 199 long j;
262 int type; 200 int type;
263 const unsigned char *p; 201 unsigned char *p;
264#if !defined(OPENSSL_NO_DSA) || !defined(OPENSSL_NO_ECDSA) 202#ifndef OPENSSL_NO_DSA
265 const unsigned char *cp; 203 const unsigned char *cp;
266 X509_ALGOR *a; 204 X509_ALGOR *a;
267#endif 205#endif
@@ -269,106 +207,40 @@ EVP_PKEY *X509_PUBKEY_get(X509_PUBKEY *key)
269 if (key == NULL) goto err; 207 if (key == NULL) goto err;
270 208
271 if (key->pkey != NULL) 209 if (key->pkey != NULL)
272 { 210 {
273 CRYPTO_add(&key->pkey->references, 1, CRYPTO_LOCK_EVP_PKEY); 211 CRYPTO_add(&key->pkey->references,1,CRYPTO_LOCK_EVP_PKEY);
274 return(key->pkey); 212 return(key->pkey);
275 } 213 }
276 214
277 if (key->public_key == NULL) goto err; 215 if (key->public_key == NULL) goto err;
278 216
279 type=OBJ_obj2nid(key->algor->algorithm); 217 type=OBJ_obj2nid(key->algor->algorithm);
280 if ((ret = EVP_PKEY_new()) == NULL) 218 p=key->public_key->data;
219 j=key->public_key->length;
220 if ((ret=d2i_PublicKey(type,NULL,&p,(long)j)) == NULL)
281 { 221 {
282 X509err(X509_F_X509_PUBKEY_GET, ERR_R_MALLOC_FAILURE); 222 X509err(X509_F_X509_PUBKEY_GET,X509_R_ERR_ASN1_LIB);
283 goto err; 223 goto err;
284 } 224 }
285 ret->type = EVP_PKEY_type(type); 225 ret->save_parameters=0;
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 226
293 if (0)
294 ;
295#ifndef OPENSSL_NO_DSA 227#ifndef OPENSSL_NO_DSA
296 else if (ret->type == EVP_PKEY_DSA) 228 a=key->algor;
229 if (ret->type == EVP_PKEY_DSA)
297 { 230 {
298 if (a->parameter && (a->parameter->type == V_ASN1_SEQUENCE)) 231 if (a->parameter && (a->parameter->type == V_ASN1_SEQUENCE))
299 { 232 {
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; 233 ret->pkey.dsa->write_params=0;
306 cp=p=a->parameter->value.sequence->data; 234 cp=p=a->parameter->value.sequence->data;
307 j=a->parameter->value.sequence->length; 235 j=a->parameter->value.sequence->length;
308 if (!d2i_DSAparams(&ret->pkey.dsa, &cp, (long)j)) 236 if (!d2i_DSAparams(&ret->pkey.dsa,&cp,(long)j))
309 goto err; 237 goto err;
310 } 238 }
311 ret->save_parameters=1; 239 ret->save_parameters=1;
312 } 240 }
313#endif 241#endif
314#ifndef OPENSSL_NO_EC 242 key->pkey=ret;
315 else if (ret->type == EVP_PKEY_EC) 243 CRYPTO_add(&ret->references,1,CRYPTO_LOCK_EVP_PKEY);
316 {
317 if (a->parameter && (a->parameter->type == V_ASN1_SEQUENCE))
318 {
319 /* type == V_ASN1_SEQUENCE => we have explicit parameters
320 * (e.g. parameters in the X9_62_EC_PARAMETERS-structure )
321 */
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 }
357 /* the case implicitlyCA is currently not implemented */
358 ret->save_parameters = 1;
359 }
360#endif
361
362 p=key->public_key->data;
363 j=key->public_key->length;
364 if (!d2i_PublicKey(type, &ret, &p, (long)j))
365 {
366 X509err(X509_F_X509_PUBKEY_GET, X509_R_ERR_ASN1_LIB);
367 goto err;
368 }
369
370 key->pkey = ret;
371 CRYPTO_add(&ret->references, 1, CRYPTO_LOCK_EVP_PKEY);
372 return(ret); 244 return(ret);
373err: 245err:
374 if (ret != NULL) 246 if (ret != NULL)
@@ -380,9 +252,9 @@ err:
380 * and encode or decode as X509_PUBKEY 252 * and encode or decode as X509_PUBKEY
381 */ 253 */
382 254
383EVP_PKEY *d2i_PUBKEY(EVP_PKEY **a, const unsigned char **pp, 255EVP_PKEY *d2i_PUBKEY(EVP_PKEY **a, unsigned char **pp,
384 long length) 256 long length)
385 { 257{
386 X509_PUBKEY *xpk; 258 X509_PUBKEY *xpk;
387 EVP_PKEY *pktmp; 259 EVP_PKEY *pktmp;
388 xpk = d2i_X509_PUBKEY(NULL, pp, length); 260 xpk = d2i_X509_PUBKEY(NULL, pp, length);
@@ -390,16 +262,15 @@ EVP_PKEY *d2i_PUBKEY(EVP_PKEY **a, const unsigned char **pp,
390 pktmp = X509_PUBKEY_get(xpk); 262 pktmp = X509_PUBKEY_get(xpk);
391 X509_PUBKEY_free(xpk); 263 X509_PUBKEY_free(xpk);
392 if(!pktmp) return NULL; 264 if(!pktmp) return NULL;
393 if(a) 265 if(a) {
394 {
395 EVP_PKEY_free(*a); 266 EVP_PKEY_free(*a);
396 *a = pktmp; 267 *a = pktmp;
397 }
398 return pktmp;
399 } 268 }
269 return pktmp;
270}
400 271
401int i2d_PUBKEY(EVP_PKEY *a, unsigned char **pp) 272int i2d_PUBKEY(EVP_PKEY *a, unsigned char **pp)
402 { 273{
403 X509_PUBKEY *xpk=NULL; 274 X509_PUBKEY *xpk=NULL;
404 int ret; 275 int ret;
405 if(!a) return 0; 276 if(!a) return 0;
@@ -407,125 +278,83 @@ int i2d_PUBKEY(EVP_PKEY *a, unsigned char **pp)
407 ret = i2d_X509_PUBKEY(xpk, pp); 278 ret = i2d_X509_PUBKEY(xpk, pp);
408 X509_PUBKEY_free(xpk); 279 X509_PUBKEY_free(xpk);
409 return ret; 280 return ret;
410 } 281}
411 282
412/* The following are equivalents but which return RSA and DSA 283/* The following are equivalents but which return RSA and DSA
413 * keys 284 * keys
414 */ 285 */
415#ifndef OPENSSL_NO_RSA 286#ifndef OPENSSL_NO_RSA
416RSA *d2i_RSA_PUBKEY(RSA **a, const unsigned char **pp, 287RSA *d2i_RSA_PUBKEY(RSA **a, unsigned char **pp,
417 long length) 288 long length)
418 { 289{
419 EVP_PKEY *pkey; 290 EVP_PKEY *pkey;
420 RSA *key; 291 RSA *key;
421 const unsigned char *q; 292 unsigned char *q;
422 q = *pp; 293 q = *pp;
423 pkey = d2i_PUBKEY(NULL, &q, length); 294 pkey = d2i_PUBKEY(NULL, &q, length);
424 if (!pkey) return NULL; 295 if(!pkey) return NULL;
425 key = EVP_PKEY_get1_RSA(pkey); 296 key = EVP_PKEY_get1_RSA(pkey);
426 EVP_PKEY_free(pkey); 297 EVP_PKEY_free(pkey);
427 if (!key) return NULL; 298 if(!key) return NULL;
428 *pp = q; 299 *pp = q;
429 if (a) 300 if(a) {
430 {
431 RSA_free(*a); 301 RSA_free(*a);
432 *a = key; 302 *a = key;
433 }
434 return key;
435 } 303 }
304 return key;
305}
436 306
437int i2d_RSA_PUBKEY(RSA *a, unsigned char **pp) 307int i2d_RSA_PUBKEY(RSA *a, unsigned char **pp)
438 { 308{
439 EVP_PKEY *pktmp; 309 EVP_PKEY *pktmp;
440 int ret; 310 int ret;
441 if (!a) return 0; 311 if(!a) return 0;
442 pktmp = EVP_PKEY_new(); 312 pktmp = EVP_PKEY_new();
443 if (!pktmp) 313 if(!pktmp) {
444 {
445 ASN1err(ASN1_F_I2D_RSA_PUBKEY, ERR_R_MALLOC_FAILURE); 314 ASN1err(ASN1_F_I2D_RSA_PUBKEY, ERR_R_MALLOC_FAILURE);
446 return 0; 315 return 0;
447 } 316 }
448 EVP_PKEY_set1_RSA(pktmp, a); 317 EVP_PKEY_set1_RSA(pktmp, a);
449 ret = i2d_PUBKEY(pktmp, pp); 318 ret = i2d_PUBKEY(pktmp, pp);
450 EVP_PKEY_free(pktmp); 319 EVP_PKEY_free(pktmp);
451 return ret; 320 return ret;
452 } 321}
453#endif 322#endif
454 323
455#ifndef OPENSSL_NO_DSA 324#ifndef OPENSSL_NO_DSA
456DSA *d2i_DSA_PUBKEY(DSA **a, const unsigned char **pp, 325DSA *d2i_DSA_PUBKEY(DSA **a, unsigned char **pp,
457 long length) 326 long length)
458 { 327{
459 EVP_PKEY *pkey; 328 EVP_PKEY *pkey;
460 DSA *key; 329 DSA *key;
461 const unsigned char *q; 330 unsigned char *q;
462 q = *pp; 331 q = *pp;
463 pkey = d2i_PUBKEY(NULL, &q, length); 332 pkey = d2i_PUBKEY(NULL, &q, length);
464 if (!pkey) return NULL; 333 if(!pkey) return NULL;
465 key = EVP_PKEY_get1_DSA(pkey); 334 key = EVP_PKEY_get1_DSA(pkey);
466 EVP_PKEY_free(pkey); 335 EVP_PKEY_free(pkey);
467 if (!key) return NULL; 336 if(!key) return NULL;
468 *pp = q; 337 *pp = q;
469 if (a) 338 if(a) {
470 {
471 DSA_free(*a); 339 DSA_free(*a);
472 *a = key; 340 *a = key;
473 }
474 return key;
475 } 341 }
342 return key;
343}
476 344
477int i2d_DSA_PUBKEY(DSA *a, unsigned char **pp) 345int i2d_DSA_PUBKEY(DSA *a, unsigned char **pp)
478 { 346{
479 EVP_PKEY *pktmp; 347 EVP_PKEY *pktmp;
480 int ret; 348 int ret;
481 if(!a) return 0; 349 if(!a) return 0;
482 pktmp = EVP_PKEY_new(); 350 pktmp = EVP_PKEY_new();
483 if(!pktmp) 351 if(!pktmp) {
484 {
485 ASN1err(ASN1_F_I2D_DSA_PUBKEY, ERR_R_MALLOC_FAILURE); 352 ASN1err(ASN1_F_I2D_DSA_PUBKEY, ERR_R_MALLOC_FAILURE);
486 return 0; 353 return 0;
487 } 354 }
488 EVP_PKEY_set1_DSA(pktmp, a); 355 EVP_PKEY_set1_DSA(pktmp, a);
489 ret = i2d_PUBKEY(pktmp, pp); 356 ret = i2d_PUBKEY(pktmp, pp);
490 EVP_PKEY_free(pktmp); 357 EVP_PKEY_free(pktmp);
491 return ret; 358 return ret;
492 } 359}
493#endif
494
495#ifndef OPENSSL_NO_EC
496EC_KEY *d2i_EC_PUBKEY(EC_KEY **a, const unsigned char **pp, long length)
497 {
498 EVP_PKEY *pkey;
499 EC_KEY *key;
500 const unsigned char *q;
501 q = *pp;
502 pkey = d2i_PUBKEY(NULL, &q, length);
503 if (!pkey) return(NULL);
504 key = EVP_PKEY_get1_EC_KEY(pkey);
505 EVP_PKEY_free(pkey);
506 if (!key) return(NULL);
507 *pp = q;
508 if (a)
509 {
510 EC_KEY_free(*a);
511 *a = key;
512 }
513 return(key);
514 }
515
516int i2d_EC_PUBKEY(EC_KEY *a, unsigned char **pp)
517 {
518 EVP_PKEY *pktmp;
519 int ret;
520 if (!a) return(0);
521 if ((pktmp = EVP_PKEY_new()) == NULL)
522 {
523 ASN1err(ASN1_F_I2D_EC_PUBKEY, ERR_R_MALLOC_FAILURE);
524 return(0);
525 }
526 EVP_PKEY_set1_EC_KEY(pktmp, a);
527 ret = i2d_PUBKEY(pktmp, pp);
528 EVP_PKEY_free(pktmp);
529 return(ret);
530 }
531#endif 360#endif
diff --git a/src/lib/libcrypto/asn1/x_req.c b/src/lib/libcrypto/asn1/x_req.c
index 59ca8ce329..b3f18ebc12 100644
--- a/src/lib/libcrypto/asn1/x_req.c
+++ b/src/lib/libcrypto/asn1/x_req.c
@@ -102,7 +102,7 @@ ASN1_SEQUENCE_enc(X509_REQ_INFO, enc, rinf_cb) = {
102 102
103IMPLEMENT_ASN1_FUNCTIONS(X509_REQ_INFO) 103IMPLEMENT_ASN1_FUNCTIONS(X509_REQ_INFO)
104 104
105ASN1_SEQUENCE_ref(X509_REQ, 0, CRYPTO_LOCK_X509_REQ) = { 105ASN1_SEQUENCE_ref(X509_REQ, 0, CRYPTO_LOCK_X509_INFO) = {
106 ASN1_SIMPLE(X509_REQ, req_info, X509_REQ_INFO), 106 ASN1_SIMPLE(X509_REQ, req_info, X509_REQ_INFO),
107 ASN1_SIMPLE(X509_REQ, sig_alg, X509_ALGOR), 107 ASN1_SIMPLE(X509_REQ, sig_alg, X509_ALGOR),
108 ASN1_SIMPLE(X509_REQ, signature, ASN1_BIT_STRING) 108 ASN1_SIMPLE(X509_REQ, signature, ASN1_BIT_STRING)
diff --git a/src/lib/libcrypto/asn1/x_x509.c b/src/lib/libcrypto/asn1/x_x509.c
index e118696625..b50167ce43 100644
--- a/src/lib/libcrypto/asn1/x_x509.c
+++ b/src/lib/libcrypto/asn1/x_x509.c
@@ -79,8 +79,6 @@ ASN1_SEQUENCE(X509_CINF) = {
79IMPLEMENT_ASN1_FUNCTIONS(X509_CINF) 79IMPLEMENT_ASN1_FUNCTIONS(X509_CINF)
80/* X509 top level structure needs a bit of customisation */ 80/* X509 top level structure needs a bit of customisation */
81 81
82extern void policy_cache_free(X509_POLICY_CACHE *cache);
83
84static int x509_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it) 82static int x509_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it)
85{ 83{
86 X509 *ret = (X509 *)*pval; 84 X509 *ret = (X509 *)*pval;
@@ -94,10 +92,6 @@ static int x509_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it)
94 ret->ex_pathlen = -1; 92 ret->ex_pathlen = -1;
95 ret->skid = NULL; 93 ret->skid = NULL;
96 ret->akid = NULL; 94 ret->akid = NULL;
97#ifndef OPENSSL_NO_RFC3779
98 ret->rfc3779_addr = NULL;
99 ret->rfc3779_asid = NULL;
100#endif
101 ret->aux = NULL; 95 ret->aux = NULL;
102 CRYPTO_new_ex_data(CRYPTO_EX_INDEX_X509, ret, &ret->ex_data); 96 CRYPTO_new_ex_data(CRYPTO_EX_INDEX_X509, ret, &ret->ex_data);
103 break; 97 break;
@@ -112,11 +106,6 @@ static int x509_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it)
112 X509_CERT_AUX_free(ret->aux); 106 X509_CERT_AUX_free(ret->aux);
113 ASN1_OCTET_STRING_free(ret->skid); 107 ASN1_OCTET_STRING_free(ret->skid);
114 AUTHORITY_KEYID_free(ret->akid); 108 AUTHORITY_KEYID_free(ret->akid);
115 policy_cache_free(ret->policy_cache);
116#ifndef OPENSSL_NO_RFC3779
117 sk_IPAddressFamily_pop_free(ret->rfc3779_addr, IPAddressFamily_free);
118 ASIdentifiers_free(ret->rfc3779_asid);
119#endif
120 109
121 if (ret->name != NULL) OPENSSL_free(ret->name); 110 if (ret->name != NULL) OPENSSL_free(ret->name);
122 break; 111 break;
@@ -136,13 +125,11 @@ ASN1_SEQUENCE_ref(X509, x509_cb, CRYPTO_LOCK_X509) = {
136IMPLEMENT_ASN1_FUNCTIONS(X509) 125IMPLEMENT_ASN1_FUNCTIONS(X509)
137IMPLEMENT_ASN1_DUP_FUNCTION(X509) 126IMPLEMENT_ASN1_DUP_FUNCTION(X509)
138 127
139static ASN1_METHOD meth= 128static ASN1_METHOD meth={
140 { 129 (int (*)()) i2d_X509,
141 (I2D_OF(void)) i2d_X509, 130 (char *(*)())d2i_X509,
142 (D2I_OF(void)) d2i_X509, 131 (char *(*)())X509_new,
143 (void *(*)(void))X509_new, 132 (void (*)()) X509_free};
144 (void (*)(void *)) X509_free
145 };
146 133
147ASN1_METHOD *X509_asn1_meth(void) 134ASN1_METHOD *X509_asn1_meth(void)
148 { 135 {
@@ -174,9 +161,9 @@ void *X509_get_ex_data(X509 *r, int idx)
174 * 161 *
175 */ 162 */
176 163
177X509 *d2i_X509_AUX(X509 **a, const unsigned char **pp, long length) 164X509 *d2i_X509_AUX(X509 **a, unsigned char **pp, long length)
178{ 165{
179 const unsigned char *q; 166 unsigned char *q;
180 X509 *ret; 167 X509 *ret;
181 /* Save start position */ 168 /* Save start position */
182 q = *pp; 169 q = *pp;
diff --git a/src/lib/libcrypto/asn1/x_x509a.c b/src/lib/libcrypto/asn1/x_x509a.c
index 13db5fd03f..f244768b7e 100644
--- a/src/lib/libcrypto/asn1/x_x509a.c
+++ b/src/lib/libcrypto/asn1/x_x509a.c
@@ -91,14 +91,6 @@ static X509_CERT_AUX *aux_get(X509 *x)
91int X509_alias_set1(X509 *x, unsigned char *name, int len) 91int X509_alias_set1(X509 *x, unsigned char *name, int len)
92{ 92{
93 X509_CERT_AUX *aux; 93 X509_CERT_AUX *aux;
94 if (!name)
95 {
96 if (!x || !x->aux || !x->aux->alias)
97 return 1;
98 ASN1_UTF8STRING_free(x->aux->alias);
99 x->aux->alias = NULL;
100 return 1;
101 }
102 if(!(aux = aux_get(x))) return 0; 94 if(!(aux = aux_get(x))) return 0;
103 if(!aux->alias && !(aux->alias = ASN1_UTF8STRING_new())) return 0; 95 if(!aux->alias && !(aux->alias = ASN1_UTF8STRING_new())) return 0;
104 return ASN1_STRING_set(aux->alias, name, len); 96 return ASN1_STRING_set(aux->alias, name, len);
@@ -107,14 +99,6 @@ int X509_alias_set1(X509 *x, unsigned char *name, int len)
107int X509_keyid_set1(X509 *x, unsigned char *id, int len) 99int X509_keyid_set1(X509 *x, unsigned char *id, int len)
108{ 100{
109 X509_CERT_AUX *aux; 101 X509_CERT_AUX *aux;
110 if (!id)
111 {
112 if (!x || !x->aux || !x->aux->keyid)
113 return 1;
114 ASN1_OCTET_STRING_free(x->aux->keyid);
115 x->aux->keyid = NULL;
116 return 1;
117 }
118 if(!(aux = aux_get(x))) return 0; 102 if(!(aux = aux_get(x))) return 0;
119 if(!aux->keyid && !(aux->keyid = ASN1_OCTET_STRING_new())) return 0; 103 if(!aux->keyid && !(aux->keyid = ASN1_OCTET_STRING_new())) return 0;
120 return ASN1_STRING_set(aux->keyid, id, len); 104 return ASN1_STRING_set(aux->keyid, id, len);
@@ -127,13 +111,6 @@ unsigned char *X509_alias_get0(X509 *x, int *len)
127 return x->aux->alias->data; 111 return x->aux->alias->data;
128} 112}
129 113
130unsigned char *X509_keyid_get0(X509 *x, int *len)
131{
132 if(!x->aux || !x->aux->keyid) return NULL;
133 if(len) *len = x->aux->keyid->length;
134 return x->aux->keyid->data;
135}
136
137int X509_add1_trust_object(X509 *x, ASN1_OBJECT *obj) 114int X509_add1_trust_object(X509 *x, ASN1_OBJECT *obj)
138{ 115{
139 X509_CERT_AUX *aux; 116 X509_CERT_AUX *aux;
@@ -172,9 +149,3 @@ void X509_reject_clear(X509 *x)
172 } 149 }
173} 150}
174 151
175ASN1_SEQUENCE(X509_CERT_PAIR) = {
176 ASN1_EXP_OPT(X509_CERT_PAIR, forward, X509, 0),
177 ASN1_EXP_OPT(X509_CERT_PAIR, reverse, X509, 1)
178} ASN1_SEQUENCE_END(X509_CERT_PAIR)
179
180IMPLEMENT_ASN1_FUNCTIONS(X509_CERT_PAIR)