summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/asn1
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libcrypto/asn1')
-rw-r--r--src/lib/libcrypto/asn1/Makefile.ssl1752
-rw-r--r--src/lib/libcrypto/asn1/a_bitstr.c53
-rw-r--r--src/lib/libcrypto/asn1/a_bool.c4
-rw-r--r--src/lib/libcrypto/asn1/a_bytes.c15
-rw-r--r--src/lib/libcrypto/asn1/a_d2i_fp.c69
-rw-r--r--src/lib/libcrypto/asn1/a_digest.c24
-rw-r--r--src/lib/libcrypto/asn1/a_dup.c28
-rw-r--r--src/lib/libcrypto/asn1/a_enum.c58
-rw-r--r--src/lib/libcrypto/asn1/a_gentm.c35
-rw-r--r--src/lib/libcrypto/asn1/a_i2d_fp.c54
-rw-r--r--src/lib/libcrypto/asn1/a_int.c64
-rw-r--r--src/lib/libcrypto/asn1/a_object.c2
-rw-r--r--src/lib/libcrypto/asn1/a_octet.c24
-rw-r--r--src/lib/libcrypto/asn1/a_print.c70
-rw-r--r--src/lib/libcrypto/asn1/a_set.c3
-rw-r--r--src/lib/libcrypto/asn1/a_sign.c152
-rw-r--r--src/lib/libcrypto/asn1/a_strex.c32
-rw-r--r--src/lib/libcrypto/asn1/a_strnid.c8
-rw-r--r--src/lib/libcrypto/asn1/a_time.c79
-rw-r--r--src/lib/libcrypto/asn1/a_type.c275
-rw-r--r--src/lib/libcrypto/asn1/a_utctm.c70
-rw-r--r--src/lib/libcrypto/asn1/a_utf8.c27
-rw-r--r--src/lib/libcrypto/asn1/a_verify.c58
-rw-r--r--src/lib/libcrypto/asn1/asn1.h770
-rw-r--r--src/lib/libcrypto/asn1/asn1_err.c206
-rw-r--r--src/lib/libcrypto/asn1/asn1_lib.c3
-rw-r--r--src/lib/libcrypto/asn1/asn1_mac.h35
-rw-r--r--src/lib/libcrypto/asn1/asn1t.h846
-rw-r--r--src/lib/libcrypto/asn1/asn_moid.c95
-rw-r--r--src/lib/libcrypto/asn1/asn_pack.c48
-rw-r--r--src/lib/libcrypto/asn1/d2i_pr.c16
-rw-r--r--src/lib/libcrypto/asn1/d2i_pu.c16
-rw-r--r--src/lib/libcrypto/asn1/f_int.c8
-rw-r--r--src/lib/libcrypto/asn1/i2d_pr.c10
-rw-r--r--src/lib/libcrypto/asn1/i2d_pu.c10
-rw-r--r--src/lib/libcrypto/asn1/n_pkey.c305
-rw-r--r--src/lib/libcrypto/asn1/nsseq.c64
-rw-r--r--src/lib/libcrypto/asn1/p5_pbe.c47
-rw-r--r--src/lib/libcrypto/asn1/p5_pbev2.c109
-rw-r--r--src/lib/libcrypto/asn1/p8_pkey.c79
-rw-r--r--src/lib/libcrypto/asn1/t_crl.c49
-rw-r--r--src/lib/libcrypto/asn1/t_pkey.c44
-rw-r--r--src/lib/libcrypto/asn1/t_req.c50
-rw-r--r--src/lib/libcrypto/asn1/t_spki.c6
-rw-r--r--src/lib/libcrypto/asn1/t_x509.c295
-rw-r--r--src/lib/libcrypto/asn1/t_x509a.c2
-rw-r--r--src/lib/libcrypto/asn1/tasn_dec.c958
-rw-r--r--src/lib/libcrypto/asn1/tasn_enc.c497
-rw-r--r--src/lib/libcrypto/asn1/tasn_fre.c226
-rw-r--r--src/lib/libcrypto/asn1/tasn_new.c348
-rw-r--r--src/lib/libcrypto/asn1/tasn_prn.c198
-rw-r--r--src/lib/libcrypto/asn1/tasn_typ.c133
-rw-r--r--src/lib/libcrypto/asn1/tasn_utl.c253
-rw-r--r--src/lib/libcrypto/asn1/x_algor.c165
-rw-r--r--src/lib/libcrypto/asn1/x_attrib.c111
-rw-r--r--src/lib/libcrypto/asn1/x_bignum.c137
-rw-r--r--src/lib/libcrypto/asn1/x_crl.c330
-rw-r--r--src/lib/libcrypto/asn1/x_exten.c190
-rw-r--r--src/lib/libcrypto/asn1/x_info.c2
-rw-r--r--src/lib/libcrypto/asn1/x_long.c169
-rw-r--r--src/lib/libcrypto/asn1/x_name.c343
-rw-r--r--src/lib/libcrypto/asn1/x_pubkey.c80
-rw-r--r--src/lib/libcrypto/asn1/x_req.c231
-rw-r--r--src/lib/libcrypto/asn1/x_sig.c53
-rw-r--r--src/lib/libcrypto/asn1/x_spki.c109
-rw-r--r--src/lib/libcrypto/asn1/x_val.c52
-rw-r--r--src/lib/libcrypto/asn1/x_x509.c155
-rw-r--r--src/lib/libcrypto/asn1/x_x509a.c75
68 files changed, 6495 insertions, 4389 deletions
diff --git a/src/lib/libcrypto/asn1/Makefile.ssl b/src/lib/libcrypto/asn1/Makefile.ssl
index dace5be2bc..b423419ba3 100644
--- a/src/lib/libcrypto/asn1/Makefile.ssl
+++ b/src/lib/libcrypto/asn1/Makefile.ssl
@@ -5,13 +5,14 @@
5DIR= asn1 5DIR= asn1
6TOP= ../.. 6TOP= ../..
7CC= cc 7CC= cc
8INCLUDES= -I.. -I../../include 8INCLUDES= -I.. -I$(TOP) -I../../include
9CFLAG=-g 9CFLAG=-g
10INSTALL_PREFIX= 10INSTALL_PREFIX=
11OPENSSLDIR= /usr/local/ssl 11OPENSSLDIR= /usr/local/ssl
12INSTALLTOP=/usr/local/ssl 12INSTALLTOP=/usr/local/ssl
13MAKE= make -f Makefile.ssl 13MAKE= make -f Makefile.ssl
14MAKEDEPEND= $(TOP)/util/domd $(TOP) 14MAKEDEPPROG= makedepend
15MAKEDEPEND= $(TOP)/util/domd $(TOP) -MD $(MAKEDEPPROG)
15MAKEFILE= Makefile.ssl 16MAKEFILE= Makefile.ssl
16AR= ar r 17AR= ar r
17 18
@@ -23,39 +24,33 @@ APPS=
23 24
24LIB=$(TOP)/libcrypto.a 25LIB=$(TOP)/libcrypto.a
25LIBSRC= a_object.c a_bitstr.c a_utctm.c a_gentm.c a_time.c a_int.c a_octet.c \ 26LIBSRC= a_object.c a_bitstr.c a_utctm.c a_gentm.c a_time.c a_int.c a_octet.c \
26 a_null.c a_print.c a_type.c a_set.c a_dup.c a_d2i_fp.c a_i2d_fp.c a_bmp.c \ 27 a_print.c a_type.c a_set.c a_dup.c a_d2i_fp.c a_i2d_fp.c \
27 a_enum.c a_vis.c a_utf8.c a_sign.c a_digest.c a_verify.c a_mbstr.c a_strex.c \ 28 a_enum.c a_utf8.c a_sign.c a_digest.c a_verify.c a_mbstr.c a_strex.c \
28 x_algor.c x_val.c x_pubkey.c x_sig.c x_req.c x_attrib.c \ 29 x_algor.c x_val.c x_pubkey.c x_sig.c x_req.c x_attrib.c x_bignum.c \
29 x_name.c x_cinf.c x_x509.c x_x509a.c x_crl.c x_info.c x_spki.c nsseq.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 \
30 d2i_r_pr.c i2d_r_pr.c d2i_r_pu.c i2d_r_pu.c \
31 d2i_s_pr.c i2d_s_pr.c d2i_s_pu.c i2d_s_pu.c \
32 d2i_pu.c d2i_pr.c i2d_pu.c i2d_pr.c\ 31 d2i_pu.c d2i_pr.c i2d_pu.c i2d_pr.c\
33 t_req.c t_x509.c t_x509a.c t_crl.c t_pkey.c t_spki.c t_bitst.c \ 32 t_req.c t_x509.c t_x509a.c t_crl.c t_pkey.c t_spki.c t_bitst.c \
34 p7_i_s.c p7_signi.c p7_signd.c p7_recip.c p7_enc_c.c p7_evp.c \ 33 tasn_new.c tasn_fre.c tasn_enc.c tasn_dec.c tasn_utl.c tasn_typ.c \
35 p7_dgst.c p7_s_e.c p7_enc.c p7_lib.c \ 34 f_int.c f_string.c n_pkey.c \
36 f_int.c f_string.c i2d_dhp.c i2d_dsap.c d2i_dhp.c d2i_dsap.c n_pkey.c \
37 f_enum.c a_hdr.c x_pkey.c a_bool.c x_exten.c \ 35 f_enum.c a_hdr.c x_pkey.c a_bool.c x_exten.c \
38 asn1_par.c asn1_lib.c asn1_err.c a_meth.c a_bytes.c a_strnid.c \ 36 asn1_par.c asn1_lib.c asn1_err.c a_meth.c a_bytes.c a_strnid.c \
39 evp_asn1.c asn_pack.c p5_pbe.c p5_pbev2.c p8_pkey.c 37 evp_asn1.c asn_pack.c p5_pbe.c p5_pbev2.c p8_pkey.c asn_moid.c
40LIBOBJ= a_object.o a_bitstr.o a_utctm.o a_gentm.o a_time.o a_int.o a_octet.o \ 38LIBOBJ= a_object.o a_bitstr.o a_utctm.o a_gentm.o a_time.o a_int.o a_octet.o \
41 a_null.o a_print.o a_type.o a_set.o a_dup.o a_d2i_fp.o a_i2d_fp.o a_bmp.o \ 39 a_print.o a_type.o a_set.o a_dup.o a_d2i_fp.o a_i2d_fp.o \
42 a_enum.o a_vis.o a_utf8.o a_sign.o a_digest.o a_verify.o a_mbstr.o a_strex.o \ 40 a_enum.o a_utf8.o a_sign.o a_digest.o a_verify.o a_mbstr.o a_strex.o \
43 x_algor.o x_val.o x_pubkey.o x_sig.o x_req.o x_attrib.o \ 41 x_algor.o x_val.o x_pubkey.o x_sig.o x_req.o x_attrib.o x_bignum.o \
44 x_name.o x_cinf.o x_x509.o x_x509a.o x_crl.o x_info.o x_spki.o nsseq.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 \
45 d2i_r_pr.o i2d_r_pr.o d2i_r_pu.o i2d_r_pu.o \
46 d2i_s_pr.o i2d_s_pr.o d2i_s_pu.o i2d_s_pu.o \
47 d2i_pu.o d2i_pr.o i2d_pu.o i2d_pr.o \ 43 d2i_pu.o d2i_pr.o i2d_pu.o i2d_pr.o \
48 t_req.o t_x509.o t_x509a.o t_crl.o t_pkey.o t_spki.o t_bitst.o \ 44 t_req.o t_x509.o t_x509a.o t_crl.o t_pkey.o t_spki.o t_bitst.o \
49 p7_i_s.o p7_signi.o p7_signd.o p7_recip.o p7_enc_c.o p7_evp.o \ 45 tasn_new.o tasn_fre.o tasn_enc.o tasn_dec.o tasn_utl.o tasn_typ.o \
50 p7_dgst.o p7_s_e.o p7_enc.o p7_lib.o \ 46 f_int.o f_string.o n_pkey.o \
51 f_int.o f_string.o i2d_dhp.o i2d_dsap.o d2i_dhp.o d2i_dsap.o n_pkey.o \
52 f_enum.o a_hdr.o x_pkey.o a_bool.o x_exten.o \ 47 f_enum.o a_hdr.o x_pkey.o a_bool.o x_exten.o \
53 asn1_par.o asn1_lib.o asn1_err.o a_meth.o a_bytes.o a_strnid.o \ 48 asn1_par.o asn1_lib.o asn1_err.o a_meth.o a_bytes.o a_strnid.o \
54 evp_asn1.o asn_pack.o p5_pbe.o p5_pbev2.o p8_pkey.o 49 evp_asn1.o asn_pack.o p5_pbe.o p5_pbev2.o p8_pkey.o asn_moid.o
55 50
56SRC= $(LIBSRC) 51SRC= $(LIBSRC)
57 52
58EXHEADER= asn1.h asn1_mac.h 53EXHEADER= asn1.h asn1_mac.h asn1t.h
59HEADER= $(EXHEADER) 54HEADER= $(EXHEADER)
60 55
61ALL= $(GENERAL) $(SRC) $(HEADER) 56ALL= $(GENERAL) $(SRC) $(HEADER)
@@ -75,8 +70,7 @@ all: lib
75 70
76lib: $(LIBOBJ) 71lib: $(LIBOBJ)
77 $(AR) $(LIB) $(LIBOBJ) 72 $(AR) $(LIB) $(LIBOBJ)
78 @echo You may get an error following this line. Please ignore. 73 $(RANLIB) $(LIB) || echo Never mind.
79 - $(RANLIB) $(LIB)
80 @touch lib 74 @touch lib
81 75
82files: 76files:
@@ -116,1231 +110,777 @@ clean:
116 110
117# DO NOT DELETE THIS LINE -- make depend depends on it. 111# DO NOT DELETE THIS LINE -- make depend depends on it.
118 112
119a_bitstr.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h 113a_bitstr.o: ../../e_os.h ../../include/openssl/asn1.h
120a_bitstr.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h 114a_bitstr.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
121a_bitstr.o: ../../include/openssl/crypto.h ../../include/openssl/e_os.h 115a_bitstr.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
122a_bitstr.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h 116a_bitstr.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
123a_bitstr.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h 117a_bitstr.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
124a_bitstr.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h 118a_bitstr.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
125a_bitstr.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h 119a_bitstr.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
126a_bitstr.o: ../cryptlib.h 120a_bitstr.o: ../../include/openssl/symhacks.h ../cryptlib.h a_bitstr.c
127a_bmp.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h 121a_bool.o: ../../e_os.h ../../include/openssl/asn1.h
128a_bmp.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h 122a_bool.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
129a_bmp.o: ../../include/openssl/crypto.h ../../include/openssl/e_os.h
130a_bmp.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
131a_bmp.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
132a_bmp.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
133a_bmp.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
134a_bmp.o: ../cryptlib.h
135a_bool.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
136a_bool.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h 123a_bool.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
137a_bool.o: ../../include/openssl/crypto.h ../../include/openssl/e_os.h 124a_bool.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
138a_bool.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h 125a_bool.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
139a_bool.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h 126a_bool.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
140a_bool.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h 127a_bool.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h
141a_bool.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h 128a_bool.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
142a_bool.o: ../cryptlib.h 129a_bool.o: ../cryptlib.h a_bool.c
143a_bytes.o: ../../include/openssl/asn1.h ../../include/openssl/asn1_mac.h 130a_bytes.o: ../../e_os.h ../../include/openssl/asn1.h
144a_bytes.o: ../../include/openssl/bio.h ../../include/openssl/bn.h 131a_bytes.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
145a_bytes.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h 132a_bytes.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
146a_bytes.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h 133a_bytes.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
147a_bytes.o: ../../include/openssl/err.h ../../include/openssl/lhash.h 134a_bytes.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
148a_bytes.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h 135a_bytes.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
149a_bytes.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h 136a_bytes.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
150a_bytes.o: ../../include/openssl/symhacks.h ../cryptlib.h 137a_bytes.o: ../../include/openssl/symhacks.h ../cryptlib.h a_bytes.c
151a_d2i_fp.o: ../../include/openssl/asn1.h ../../include/openssl/asn1_mac.h 138a_d2i_fp.o: ../../e_os.h ../../include/openssl/asn1.h
152a_d2i_fp.o: ../../include/openssl/bio.h ../../include/openssl/bn.h 139a_d2i_fp.o: ../../include/openssl/asn1_mac.h ../../include/openssl/bio.h
153a_d2i_fp.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h 140a_d2i_fp.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
154a_d2i_fp.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h 141a_d2i_fp.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
155a_d2i_fp.o: ../../include/openssl/err.h ../../include/openssl/lhash.h 142a_d2i_fp.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
156a_d2i_fp.o: ../../include/openssl/opensslconf.h 143a_d2i_fp.o: ../../include/openssl/opensslconf.h
157a_d2i_fp.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h 144a_d2i_fp.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
158a_d2i_fp.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h 145a_d2i_fp.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
159a_d2i_fp.o: ../cryptlib.h 146a_d2i_fp.o: ../../include/openssl/symhacks.h ../cryptlib.h a_d2i_fp.c
160a_digest.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h 147a_digest.o: ../../e_os.h ../../include/openssl/asn1.h
161a_digest.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h 148a_digest.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
162a_digest.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h 149a_digest.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
163a_digest.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
164a_digest.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h 150a_digest.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
165a_digest.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h 151a_digest.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
166a_digest.o: ../../include/openssl/err.h ../../include/openssl/evp.h 152a_digest.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
167a_digest.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
168a_digest.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
169a_digest.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
170a_digest.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h 153a_digest.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
171a_digest.o: ../../include/openssl/opensslconf.h 154a_digest.o: ../../include/openssl/opensslconf.h
172a_digest.o: ../../include/openssl/opensslv.h ../../include/openssl/pkcs7.h 155a_digest.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
173a_digest.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h 156a_digest.o: ../../include/openssl/pkcs7.h ../../include/openssl/rsa.h
174a_digest.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h 157a_digest.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
175a_digest.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h 158a_digest.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
176a_digest.o: ../../include/openssl/sha.h ../../include/openssl/stack.h 159a_digest.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
177a_digest.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h 160a_digest.o: ../cryptlib.h a_digest.c
178a_digest.o: ../../include/openssl/x509_vfy.h ../cryptlib.h 161a_dup.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
179a_dup.o: ../../include/openssl/asn1.h ../../include/openssl/asn1_mac.h 162a_dup.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
180a_dup.o: ../../include/openssl/bio.h ../../include/openssl/bn.h 163a_dup.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
181a_dup.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
182a_dup.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h
183a_dup.o: ../../include/openssl/err.h ../../include/openssl/lhash.h 164a_dup.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
184a_dup.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h 165a_dup.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
185a_dup.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h 166a_dup.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h
186a_dup.o: ../../include/openssl/symhacks.h ../cryptlib.h 167a_dup.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
187a_enum.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h 168a_dup.o: ../cryptlib.h a_dup.c
169a_enum.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
188a_enum.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h 170a_enum.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
189a_enum.o: ../../include/openssl/crypto.h ../../include/openssl/e_os.h 171a_enum.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
190a_enum.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h 172a_enum.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
191a_enum.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h 173a_enum.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
192a_enum.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h 174a_enum.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h
193a_enum.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h 175a_enum.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
194a_enum.o: ../cryptlib.h 176a_enum.o: ../cryptlib.h a_enum.c
195a_gentm.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h 177a_gentm.o: ../../e_os.h ../../include/openssl/asn1.h
196a_gentm.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h 178a_gentm.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
197a_gentm.o: ../../include/openssl/crypto.h ../../include/openssl/e_os.h 179a_gentm.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
198a_gentm.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h 180a_gentm.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
199a_gentm.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h 181a_gentm.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
200a_gentm.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h 182a_gentm.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
201a_gentm.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h 183a_gentm.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
202a_gentm.o: ../cryptlib.h 184a_gentm.o: ../../include/openssl/symhacks.h ../cryptlib.h ../o_time.h a_gentm.c
203a_hdr.o: ../../include/openssl/asn1.h ../../include/openssl/asn1_mac.h 185a_hdr.o: ../../e_os.h ../../include/openssl/asn1.h
204a_hdr.o: ../../include/openssl/bio.h ../../include/openssl/bn.h 186a_hdr.o: ../../include/openssl/asn1_mac.h ../../include/openssl/bio.h
205a_hdr.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h 187a_hdr.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
206a_hdr.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h 188a_hdr.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
207a_hdr.o: ../../include/openssl/err.h ../../include/openssl/lhash.h 189a_hdr.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
208a_hdr.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h 190a_hdr.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
209a_hdr.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h 191a_hdr.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h
210a_hdr.o: ../../include/openssl/symhacks.h ../cryptlib.h 192a_hdr.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
211a_i2d_fp.o: ../../include/openssl/asn1.h ../../include/openssl/asn1_mac.h 193a_hdr.o: ../cryptlib.h a_hdr.c
194a_i2d_fp.o: ../../e_os.h ../../include/openssl/asn1.h
212a_i2d_fp.o: ../../include/openssl/bio.h ../../include/openssl/bn.h 195a_i2d_fp.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
213a_i2d_fp.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h 196a_i2d_fp.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
214a_i2d_fp.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h 197a_i2d_fp.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
215a_i2d_fp.o: ../../include/openssl/err.h ../../include/openssl/lhash.h 198a_i2d_fp.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
216a_i2d_fp.o: ../../include/openssl/opensslconf.h 199a_i2d_fp.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
217a_i2d_fp.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h 200a_i2d_fp.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
218a_i2d_fp.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h 201a_i2d_fp.o: ../../include/openssl/symhacks.h ../cryptlib.h a_i2d_fp.c
219a_i2d_fp.o: ../cryptlib.h 202a_int.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
220a_int.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
221a_int.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h 203a_int.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
222a_int.o: ../../include/openssl/crypto.h ../../include/openssl/e_os.h 204a_int.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
223a_int.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h 205a_int.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
224a_int.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h 206a_int.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
225a_int.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h 207a_int.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h
226a_int.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h 208a_int.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
227a_int.o: ../cryptlib.h 209a_int.o: ../cryptlib.h a_int.c
228a_mbstr.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h 210a_mbstr.o: ../../e_os.h ../../include/openssl/asn1.h
229a_mbstr.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h 211a_mbstr.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
230a_mbstr.o: ../../include/openssl/crypto.h ../../include/openssl/e_os.h 212a_mbstr.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
231a_mbstr.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h 213a_mbstr.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
232a_mbstr.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h 214a_mbstr.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
233a_mbstr.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h 215a_mbstr.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
234a_mbstr.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h 216a_mbstr.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
235a_mbstr.o: ../cryptlib.h 217a_mbstr.o: ../../include/openssl/symhacks.h ../cryptlib.h a_mbstr.c
236a_meth.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h 218a_meth.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
237a_meth.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h 219a_meth.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
238a_meth.o: ../../include/openssl/crypto.h ../../include/openssl/e_os.h 220a_meth.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
239a_meth.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h 221a_meth.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
240a_meth.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h 222a_meth.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
241a_meth.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h 223a_meth.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h
242a_meth.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h 224a_meth.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
243a_meth.o: ../cryptlib.h 225a_meth.o: ../cryptlib.h a_meth.c
244a_null.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h 226a_object.o: ../../e_os.h ../../include/openssl/asn1.h
245a_null.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h 227a_object.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
246a_null.o: ../../include/openssl/crypto.h ../../include/openssl/e_os.h 228a_object.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
247a_null.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
248a_null.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
249a_null.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
250a_null.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
251a_null.o: ../cryptlib.h
252a_object.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
253a_object.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
254a_object.o: ../../include/openssl/crypto.h ../../include/openssl/e_os.h
255a_object.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h 229a_object.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
256a_object.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h 230a_object.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
257a_object.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h 231a_object.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
258a_object.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h 232a_object.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
259a_object.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h 233a_object.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
260a_object.o: ../cryptlib.h 234a_object.o: ../../include/openssl/symhacks.h ../cryptlib.h a_object.c
261a_octet.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h 235a_octet.o: ../../e_os.h ../../include/openssl/asn1.h
262a_octet.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h 236a_octet.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
263a_octet.o: ../../include/openssl/crypto.h ../../include/openssl/e_os.h 237a_octet.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
264a_octet.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h 238a_octet.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
265a_octet.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h 239a_octet.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
266a_octet.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h 240a_octet.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
267a_octet.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h 241a_octet.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
268a_octet.o: ../cryptlib.h 242a_octet.o: ../../include/openssl/symhacks.h ../cryptlib.h a_octet.c
269a_print.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h 243a_print.o: ../../e_os.h ../../include/openssl/asn1.h
270a_print.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h 244a_print.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
271a_print.o: ../../include/openssl/crypto.h ../../include/openssl/e_os.h 245a_print.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
272a_print.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h 246a_print.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
273a_print.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h 247a_print.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
274a_print.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h 248a_print.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
275a_print.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h 249a_print.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
276a_print.o: ../cryptlib.h 250a_print.o: ../../include/openssl/symhacks.h ../cryptlib.h a_print.c
277a_set.o: ../../include/openssl/asn1.h ../../include/openssl/asn1_mac.h 251a_set.o: ../../e_os.h ../../include/openssl/asn1.h
278a_set.o: ../../include/openssl/bio.h ../../include/openssl/bn.h 252a_set.o: ../../include/openssl/asn1_mac.h ../../include/openssl/bio.h
279a_set.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h 253a_set.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
280a_set.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h 254a_set.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
281a_set.o: ../../include/openssl/err.h ../../include/openssl/lhash.h 255a_set.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
282a_set.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h 256a_set.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
283a_set.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h 257a_set.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h
284a_set.o: ../../include/openssl/symhacks.h ../cryptlib.h 258a_set.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
285a_sign.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h 259a_set.o: ../cryptlib.h a_set.c
286a_sign.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h 260a_sign.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
287a_sign.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h 261a_sign.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
288a_sign.o: ../../include/openssl/crypto.h ../../include/openssl/des.h 262a_sign.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h
289a_sign.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h 263a_sign.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
290a_sign.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h
291a_sign.o: ../../include/openssl/err.h ../../include/openssl/evp.h 264a_sign.o: ../../include/openssl/err.h ../../include/openssl/evp.h
292a_sign.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h 265a_sign.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
293a_sign.o: ../../include/openssl/md2.h ../../include/openssl/md4.h 266a_sign.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
294a_sign.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h 267a_sign.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
295a_sign.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h 268a_sign.o: ../../include/openssl/pkcs7.h ../../include/openssl/rsa.h
296a_sign.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
297a_sign.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
298a_sign.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
299a_sign.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
300a_sign.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h 269a_sign.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
301a_sign.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h 270a_sign.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
302a_sign.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h 271a_sign.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
303a_sign.o: ../cryptlib.h 272a_sign.o: ../cryptlib.h a_sign.c
304a_strex.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h 273a_strex.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
305a_strex.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h 274a_strex.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
306a_strex.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h 275a_strex.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h
307a_strex.o: ../../include/openssl/crypto.h ../../include/openssl/des.h 276a_strex.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
308a_strex.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h 277a_strex.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
309a_strex.o: ../../include/openssl/e_os2.h ../../include/openssl/evp.h
310a_strex.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
311a_strex.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
312a_strex.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
313a_strex.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h 278a_strex.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
314a_strex.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h 279a_strex.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
315a_strex.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h 280a_strex.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
316a_strex.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h 281a_strex.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
317a_strex.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h 282a_strex.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
318a_strex.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h 283a_strex.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
319a_strex.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h 284a_strex.o: ../../include/openssl/x509_vfy.h a_strex.c charmap.h
320a_strex.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h 285a_strnid.o: ../../e_os.h ../../include/openssl/asn1.h
321a_strex.o: charmap.h 286a_strnid.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
322a_strnid.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h 287a_strnid.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
323a_strnid.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
324a_strnid.o: ../../include/openssl/crypto.h ../../include/openssl/e_os.h
325a_strnid.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h 288a_strnid.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
326a_strnid.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h 289a_strnid.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
327a_strnid.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h 290a_strnid.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
328a_strnid.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h 291a_strnid.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
329a_strnid.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h 292a_strnid.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
330a_strnid.o: ../cryptlib.h 293a_strnid.o: ../../include/openssl/symhacks.h ../cryptlib.h a_strnid.c
331a_time.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h 294a_time.o: ../../e_os.h ../../include/openssl/asn1.h
295a_time.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
332a_time.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h 296a_time.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
333a_time.o: ../../include/openssl/crypto.h ../../include/openssl/e_os.h 297a_time.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
334a_time.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h 298a_time.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
335a_time.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h 299a_time.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
336a_time.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h 300a_time.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h
337a_time.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h 301a_time.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
338a_time.o: ../cryptlib.h 302a_time.o: ../cryptlib.h ../o_time.h a_time.c
339a_type.o: ../../include/openssl/asn1.h ../../include/openssl/asn1_mac.h 303a_type.o: ../../e_os.h ../../include/openssl/asn1.h
340a_type.o: ../../include/openssl/bio.h ../../include/openssl/bn.h 304a_type.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
341a_type.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h 305a_type.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
342a_type.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h 306a_type.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
343a_type.o: ../../include/openssl/err.h ../../include/openssl/lhash.h 307a_type.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
344a_type.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h 308a_type.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
345a_type.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h 309a_type.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h
346a_type.o: ../../include/openssl/symhacks.h ../cryptlib.h 310a_type.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
347a_utctm.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h 311a_type.o: ../cryptlib.h a_type.c
348a_utctm.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h 312a_utctm.o: ../../e_os.h ../../include/openssl/asn1.h
349a_utctm.o: ../../include/openssl/crypto.h ../../include/openssl/e_os.h 313a_utctm.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
314a_utctm.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
350a_utctm.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h 315a_utctm.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
351a_utctm.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h 316a_utctm.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
352a_utctm.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h 317a_utctm.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
353a_utctm.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h 318a_utctm.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
354a_utctm.o: ../cryptlib.h 319a_utctm.o: ../../include/openssl/symhacks.h ../cryptlib.h ../o_time.h a_utctm.c
355a_utf8.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h 320a_utf8.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
356a_utf8.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h 321a_utf8.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
357a_utf8.o: ../../include/openssl/crypto.h ../../include/openssl/e_os.h 322a_utf8.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
358a_utf8.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h 323a_utf8.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
359a_utf8.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h 324a_utf8.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
360a_utf8.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h 325a_utf8.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h
361a_utf8.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h 326a_utf8.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
362a_utf8.o: ../cryptlib.h 327a_utf8.o: ../cryptlib.h a_utf8.c
363a_verify.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h 328a_verify.o: ../../e_os.h ../../include/openssl/asn1.h
364a_verify.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h 329a_verify.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
365a_verify.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h 330a_verify.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
366a_verify.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
367a_verify.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h 331a_verify.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
368a_verify.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h 332a_verify.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
369a_verify.o: ../../include/openssl/err.h ../../include/openssl/evp.h 333a_verify.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
370a_verify.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
371a_verify.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
372a_verify.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
373a_verify.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h 334a_verify.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
374a_verify.o: ../../include/openssl/opensslconf.h 335a_verify.o: ../../include/openssl/opensslconf.h
375a_verify.o: ../../include/openssl/opensslv.h ../../include/openssl/pkcs7.h 336a_verify.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
376a_verify.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h 337a_verify.o: ../../include/openssl/pkcs7.h ../../include/openssl/rsa.h
377a_verify.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h 338a_verify.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
378a_verify.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h 339a_verify.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
379a_verify.o: ../../include/openssl/sha.h ../../include/openssl/stack.h 340a_verify.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
380a_verify.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h 341a_verify.o: ../cryptlib.h a_verify.c
381a_verify.o: ../../include/openssl/x509_vfy.h ../cryptlib.h
382a_vis.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
383a_vis.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
384a_vis.o: ../../include/openssl/crypto.h ../../include/openssl/e_os.h
385a_vis.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
386a_vis.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
387a_vis.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
388a_vis.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
389a_vis.o: ../cryptlib.h
390asn1_err.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h 342asn1_err.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
391asn1_err.o: ../../include/openssl/bn.h ../../include/openssl/crypto.h 343asn1_err.o: ../../include/openssl/bn.h ../../include/openssl/crypto.h
392asn1_err.o: ../../include/openssl/err.h ../../include/openssl/lhash.h 344asn1_err.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
393asn1_err.o: ../../include/openssl/opensslconf.h 345asn1_err.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
394asn1_err.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h 346asn1_err.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
395asn1_err.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h 347asn1_err.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
396asn1_lib.o: ../../include/openssl/asn1.h ../../include/openssl/asn1_mac.h 348asn1_err.o: ../../include/openssl/symhacks.h asn1_err.c
349asn1_lib.o: ../../e_os.h ../../include/openssl/asn1.h
397asn1_lib.o: ../../include/openssl/bio.h ../../include/openssl/bn.h 350asn1_lib.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
398asn1_lib.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h 351asn1_lib.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
399asn1_lib.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h 352asn1_lib.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
400asn1_lib.o: ../../include/openssl/err.h ../../include/openssl/lhash.h 353asn1_lib.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
401asn1_lib.o: ../../include/openssl/opensslconf.h 354asn1_lib.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
402asn1_lib.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h 355asn1_lib.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
403asn1_lib.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h 356asn1_lib.o: ../../include/openssl/symhacks.h ../cryptlib.h asn1_lib.c
404asn1_lib.o: ../cryptlib.h 357asn1_par.o: ../../e_os.h ../../include/openssl/asn1.h
405asn1_par.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h 358asn1_par.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
406asn1_par.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h 359asn1_par.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
407asn1_par.o: ../../include/openssl/crypto.h ../../include/openssl/e_os.h
408asn1_par.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h 360asn1_par.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
409asn1_par.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h 361asn1_par.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
410asn1_par.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h 362asn1_par.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
411asn1_par.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h 363asn1_par.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
412asn1_par.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h 364asn1_par.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
413asn1_par.o: ../cryptlib.h 365asn1_par.o: ../../include/openssl/symhacks.h ../cryptlib.h asn1_par.c
414asn_pack.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h 366asn_moid.o: ../../e_os.h ../../include/openssl/asn1.h
415asn_pack.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h 367asn_moid.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
416asn_pack.o: ../../include/openssl/crypto.h ../../include/openssl/e_os.h 368asn_moid.o: ../../include/openssl/buffer.h ../../include/openssl/conf.h
369asn_moid.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h
370asn_moid.o: ../../include/openssl/dsa.h ../../include/openssl/dso.h
371asn_moid.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
372asn_moid.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
373asn_moid.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
374asn_moid.o: ../../include/openssl/opensslconf.h
375asn_moid.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
376asn_moid.o: ../../include/openssl/pkcs7.h ../../include/openssl/rsa.h
377asn_moid.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
378asn_moid.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
379asn_moid.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
380asn_moid.o: ../cryptlib.h asn_moid.c
381asn_pack.o: ../../e_os.h ../../include/openssl/asn1.h
382asn_pack.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
383asn_pack.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
417asn_pack.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h 384asn_pack.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
418asn_pack.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h 385asn_pack.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
419asn_pack.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h 386asn_pack.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
420asn_pack.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h 387asn_pack.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
421asn_pack.o: ../cryptlib.h 388asn_pack.o: ../../include/openssl/symhacks.h ../cryptlib.h asn_pack.c
422d2i_dhp.o: ../../include/openssl/asn1.h ../../include/openssl/asn1_mac.h 389d2i_pr.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
423d2i_dhp.o: ../../include/openssl/bio.h ../../include/openssl/bn.h 390d2i_pr.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
424d2i_dhp.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h 391d2i_pr.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h
425d2i_dhp.o: ../../include/openssl/dh.h ../../include/openssl/e_os.h 392d2i_pr.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
426d2i_dhp.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
427d2i_dhp.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
428d2i_dhp.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
429d2i_dhp.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
430d2i_dhp.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
431d2i_dhp.o: ../cryptlib.h
432d2i_dsap.o: ../../include/openssl/asn1.h ../../include/openssl/asn1_mac.h
433d2i_dsap.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
434d2i_dsap.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
435d2i_dsap.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
436d2i_dsap.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h
437d2i_dsap.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
438d2i_dsap.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
439d2i_dsap.o: ../../include/openssl/opensslconf.h
440d2i_dsap.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
441d2i_dsap.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
442d2i_dsap.o: ../cryptlib.h
443d2i_pr.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
444d2i_pr.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
445d2i_pr.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
446d2i_pr.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
447d2i_pr.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
448d2i_pr.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h
449d2i_pr.o: ../../include/openssl/err.h ../../include/openssl/evp.h 393d2i_pr.o: ../../include/openssl/err.h ../../include/openssl/evp.h
450d2i_pr.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h 394d2i_pr.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
451d2i_pr.o: ../../include/openssl/md2.h ../../include/openssl/md4.h 395d2i_pr.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
452d2i_pr.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h 396d2i_pr.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
453d2i_pr.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
454d2i_pr.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
455d2i_pr.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
456d2i_pr.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
457d2i_pr.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h 397d2i_pr.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
458d2i_pr.o: ../../include/openssl/sha.h ../../include/openssl/stack.h 398d2i_pr.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
459d2i_pr.o: ../../include/openssl/symhacks.h ../cryptlib.h 399d2i_pr.o: ../cryptlib.h d2i_pr.c
460d2i_pu.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h 400d2i_pu.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
461d2i_pu.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h 401d2i_pu.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
462d2i_pu.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h 402d2i_pu.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h
463d2i_pu.o: ../../include/openssl/crypto.h ../../include/openssl/des.h 403d2i_pu.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
464d2i_pu.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
465d2i_pu.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h
466d2i_pu.o: ../../include/openssl/err.h ../../include/openssl/evp.h 404d2i_pu.o: ../../include/openssl/err.h ../../include/openssl/evp.h
467d2i_pu.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h 405d2i_pu.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
468d2i_pu.o: ../../include/openssl/md2.h ../../include/openssl/md4.h 406d2i_pu.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
469d2i_pu.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h 407d2i_pu.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
470d2i_pu.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
471d2i_pu.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
472d2i_pu.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
473d2i_pu.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
474d2i_pu.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h 408d2i_pu.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
475d2i_pu.o: ../../include/openssl/sha.h ../../include/openssl/stack.h 409d2i_pu.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
476d2i_pu.o: ../../include/openssl/symhacks.h ../cryptlib.h 410d2i_pu.o: ../cryptlib.h d2i_pu.c
477d2i_r_pr.o: ../../include/openssl/asn1.h ../../include/openssl/asn1_mac.h 411evp_asn1.o: ../../e_os.h ../../include/openssl/asn1.h
478d2i_r_pr.o: ../../include/openssl/bio.h ../../include/openssl/bn.h 412evp_asn1.o: ../../include/openssl/asn1_mac.h ../../include/openssl/bio.h
479d2i_r_pr.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h 413evp_asn1.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
480d2i_r_pr.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h 414evp_asn1.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
481d2i_r_pr.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
482d2i_r_pr.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
483d2i_r_pr.o: ../../include/openssl/opensslconf.h
484d2i_r_pr.o: ../../include/openssl/opensslv.h ../../include/openssl/rsa.h
485d2i_r_pr.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
486d2i_r_pr.o: ../../include/openssl/symhacks.h ../cryptlib.h
487d2i_r_pu.o: ../../include/openssl/asn1.h ../../include/openssl/asn1_mac.h
488d2i_r_pu.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
489d2i_r_pu.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
490d2i_r_pu.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h
491d2i_r_pu.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
492d2i_r_pu.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
493d2i_r_pu.o: ../../include/openssl/opensslconf.h
494d2i_r_pu.o: ../../include/openssl/opensslv.h ../../include/openssl/rsa.h
495d2i_r_pu.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
496d2i_r_pu.o: ../../include/openssl/symhacks.h ../cryptlib.h
497d2i_s_pr.o: ../../include/openssl/asn1.h ../../include/openssl/asn1_mac.h
498d2i_s_pr.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
499d2i_s_pr.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
500d2i_s_pr.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
501d2i_s_pr.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h
502d2i_s_pr.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
503d2i_s_pr.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
504d2i_s_pr.o: ../../include/openssl/opensslconf.h
505d2i_s_pr.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
506d2i_s_pr.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
507d2i_s_pr.o: ../cryptlib.h
508d2i_s_pu.o: ../../include/openssl/asn1.h ../../include/openssl/asn1_mac.h
509d2i_s_pu.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
510d2i_s_pu.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
511d2i_s_pu.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
512d2i_s_pu.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h
513d2i_s_pu.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
514d2i_s_pu.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
515d2i_s_pu.o: ../../include/openssl/opensslconf.h
516d2i_s_pu.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
517d2i_s_pu.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
518d2i_s_pu.o: ../cryptlib.h
519evp_asn1.o: ../../include/openssl/asn1.h ../../include/openssl/asn1_mac.h
520evp_asn1.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
521evp_asn1.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
522evp_asn1.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h
523evp_asn1.o: ../../include/openssl/err.h ../../include/openssl/lhash.h 415evp_asn1.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
524evp_asn1.o: ../../include/openssl/opensslconf.h 416evp_asn1.o: ../../include/openssl/opensslconf.h
525evp_asn1.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h 417evp_asn1.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
526evp_asn1.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h 418evp_asn1.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
527evp_asn1.o: ../cryptlib.h 419evp_asn1.o: ../../include/openssl/symhacks.h ../cryptlib.h evp_asn1.c
528f_enum.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h 420f_enum.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
529f_enum.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h 421f_enum.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
530f_enum.o: ../../include/openssl/crypto.h ../../include/openssl/e_os.h 422f_enum.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
531f_enum.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h 423f_enum.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
532f_enum.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h 424f_enum.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
533f_enum.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h 425f_enum.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h
534f_enum.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h 426f_enum.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
535f_enum.o: ../cryptlib.h 427f_enum.o: ../cryptlib.h f_enum.c
536f_int.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h 428f_int.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
537f_int.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h 429f_int.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
538f_int.o: ../../include/openssl/crypto.h ../../include/openssl/e_os.h 430f_int.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
539f_int.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h 431f_int.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
540f_int.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h 432f_int.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
541f_int.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h 433f_int.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h
542f_int.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h 434f_int.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
543f_int.o: ../cryptlib.h 435f_int.o: ../cryptlib.h f_int.c
544f_string.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h 436f_string.o: ../../e_os.h ../../include/openssl/asn1.h
545f_string.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h 437f_string.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
546f_string.o: ../../include/openssl/crypto.h ../../include/openssl/e_os.h 438f_string.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
547f_string.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h 439f_string.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
548f_string.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h 440f_string.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
549f_string.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h 441f_string.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
550f_string.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h 442f_string.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
551f_string.o: ../cryptlib.h 443f_string.o: ../../include/openssl/symhacks.h ../cryptlib.h f_string.c
552i2d_dhp.o: ../../include/openssl/asn1.h ../../include/openssl/asn1_mac.h 444i2d_pr.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
553i2d_dhp.o: ../../include/openssl/bio.h ../../include/openssl/bn.h 445i2d_pr.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
554i2d_dhp.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h 446i2d_pr.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h
555i2d_dhp.o: ../../include/openssl/dh.h ../../include/openssl/e_os.h 447i2d_pr.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
556i2d_dhp.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
557i2d_dhp.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
558i2d_dhp.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
559i2d_dhp.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
560i2d_dhp.o: ../cryptlib.h
561i2d_dsap.o: ../../include/openssl/asn1.h ../../include/openssl/asn1_mac.h
562i2d_dsap.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
563i2d_dsap.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
564i2d_dsap.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
565i2d_dsap.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h
566i2d_dsap.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
567i2d_dsap.o: ../../include/openssl/opensslconf.h
568i2d_dsap.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
569i2d_dsap.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
570i2d_dsap.o: ../cryptlib.h
571i2d_pr.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
572i2d_pr.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
573i2d_pr.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
574i2d_pr.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
575i2d_pr.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
576i2d_pr.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h
577i2d_pr.o: ../../include/openssl/err.h ../../include/openssl/evp.h 448i2d_pr.o: ../../include/openssl/err.h ../../include/openssl/evp.h
578i2d_pr.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h 449i2d_pr.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
579i2d_pr.o: ../../include/openssl/md2.h ../../include/openssl/md4.h 450i2d_pr.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
580i2d_pr.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h 451i2d_pr.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
581i2d_pr.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
582i2d_pr.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
583i2d_pr.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
584i2d_pr.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
585i2d_pr.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h 452i2d_pr.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
586i2d_pr.o: ../../include/openssl/sha.h ../../include/openssl/stack.h 453i2d_pr.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
587i2d_pr.o: ../../include/openssl/symhacks.h ../cryptlib.h 454i2d_pr.o: ../cryptlib.h i2d_pr.c
588i2d_pu.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h 455i2d_pu.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
589i2d_pu.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h 456i2d_pu.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
590i2d_pu.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h 457i2d_pu.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h
591i2d_pu.o: ../../include/openssl/crypto.h ../../include/openssl/des.h 458i2d_pu.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
592i2d_pu.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
593i2d_pu.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h
594i2d_pu.o: ../../include/openssl/err.h ../../include/openssl/evp.h 459i2d_pu.o: ../../include/openssl/err.h ../../include/openssl/evp.h
595i2d_pu.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h 460i2d_pu.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
596i2d_pu.o: ../../include/openssl/md2.h ../../include/openssl/md4.h 461i2d_pu.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
597i2d_pu.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h 462i2d_pu.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
598i2d_pu.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
599i2d_pu.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
600i2d_pu.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
601i2d_pu.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
602i2d_pu.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h 463i2d_pu.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
603i2d_pu.o: ../../include/openssl/sha.h ../../include/openssl/stack.h 464i2d_pu.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
604i2d_pu.o: ../../include/openssl/symhacks.h ../cryptlib.h 465i2d_pu.o: ../cryptlib.h i2d_pu.c
605i2d_r_pr.o: ../../include/openssl/asn1.h ../../include/openssl/asn1_mac.h 466n_pkey.o: ../../e_os.h ../../include/openssl/asn1.h
606i2d_r_pr.o: ../../include/openssl/bio.h ../../include/openssl/bn.h 467n_pkey.o: ../../include/openssl/asn1_mac.h ../../include/openssl/asn1t.h
607i2d_r_pr.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h 468n_pkey.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
608i2d_r_pr.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h 469n_pkey.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
609i2d_r_pr.o: ../../include/openssl/err.h ../../include/openssl/lhash.h 470n_pkey.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
610i2d_r_pr.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
611i2d_r_pr.o: ../../include/openssl/opensslconf.h
612i2d_r_pr.o: ../../include/openssl/opensslv.h ../../include/openssl/rsa.h
613i2d_r_pr.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
614i2d_r_pr.o: ../../include/openssl/symhacks.h ../cryptlib.h
615i2d_r_pu.o: ../../include/openssl/asn1.h ../../include/openssl/asn1_mac.h
616i2d_r_pu.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
617i2d_r_pu.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
618i2d_r_pu.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h
619i2d_r_pu.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
620i2d_r_pu.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
621i2d_r_pu.o: ../../include/openssl/opensslconf.h
622i2d_r_pu.o: ../../include/openssl/opensslv.h ../../include/openssl/rsa.h
623i2d_r_pu.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
624i2d_r_pu.o: ../../include/openssl/symhacks.h ../cryptlib.h
625i2d_s_pr.o: ../../include/openssl/asn1.h ../../include/openssl/asn1_mac.h
626i2d_s_pr.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
627i2d_s_pr.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
628i2d_s_pr.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
629i2d_s_pr.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h
630i2d_s_pr.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
631i2d_s_pr.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
632i2d_s_pr.o: ../../include/openssl/opensslconf.h
633i2d_s_pr.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
634i2d_s_pr.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
635i2d_s_pr.o: ../cryptlib.h
636i2d_s_pu.o: ../../include/openssl/asn1.h ../../include/openssl/asn1_mac.h
637i2d_s_pu.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
638i2d_s_pu.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
639i2d_s_pu.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
640i2d_s_pu.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h
641i2d_s_pu.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
642i2d_s_pu.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
643i2d_s_pu.o: ../../include/openssl/opensslconf.h
644i2d_s_pu.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
645i2d_s_pu.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
646i2d_s_pu.o: ../cryptlib.h
647n_pkey.o: ../../include/openssl/asn1.h ../../include/openssl/asn1_mac.h
648n_pkey.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
649n_pkey.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
650n_pkey.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h
651n_pkey.o: ../../include/openssl/des.h ../../include/openssl/dh.h
652n_pkey.o: ../../include/openssl/dsa.h ../../include/openssl/e_os.h
653n_pkey.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h 471n_pkey.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
654n_pkey.o: ../../include/openssl/evp.h ../../include/openssl/idea.h 472n_pkey.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
655n_pkey.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h 473n_pkey.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
656n_pkey.o: ../../include/openssl/md4.h ../../include/openssl/md5.h 474n_pkey.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
657n_pkey.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h 475n_pkey.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
658n_pkey.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
659n_pkey.o: ../../include/openssl/opensslv.h ../../include/openssl/pkcs7.h
660n_pkey.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
661n_pkey.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
662n_pkey.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h 476n_pkey.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
663n_pkey.o: ../../include/openssl/sha.h ../../include/openssl/stack.h 477n_pkey.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
664n_pkey.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h 478n_pkey.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
665n_pkey.o: ../../include/openssl/x509_vfy.h ../cryptlib.h 479n_pkey.o: ../../include/openssl/x509_vfy.h ../cryptlib.h n_pkey.c
666nsseq.o: ../../include/openssl/asn1.h ../../include/openssl/asn1_mac.h 480nsseq.o: ../../include/openssl/asn1.h ../../include/openssl/asn1t.h
667nsseq.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h 481nsseq.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
668nsseq.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h 482nsseq.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
669nsseq.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h 483nsseq.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
670nsseq.o: ../../include/openssl/des.h ../../include/openssl/dh.h 484nsseq.o: ../../include/openssl/e_os2.h ../../include/openssl/evp.h
671nsseq.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h 485nsseq.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
672nsseq.o: ../../include/openssl/err.h ../../include/openssl/evp.h 486nsseq.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
673nsseq.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h 487nsseq.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
674nsseq.o: ../../include/openssl/md2.h ../../include/openssl/md4.h 488nsseq.o: ../../include/openssl/pkcs7.h ../../include/openssl/rsa.h
675nsseq.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
676nsseq.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
677nsseq.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
678nsseq.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
679nsseq.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
680nsseq.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
681nsseq.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h 489nsseq.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
682nsseq.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h 490nsseq.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
683nsseq.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h 491nsseq.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h nsseq.c
684p5_pbe.o: ../../include/openssl/asn1.h ../../include/openssl/asn1_mac.h 492p5_pbe.o: ../../e_os.h ../../include/openssl/asn1.h
685p5_pbe.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h 493p5_pbe.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
686p5_pbe.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h 494p5_pbe.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
687p5_pbe.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h 495p5_pbe.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h
688p5_pbe.o: ../../include/openssl/des.h ../../include/openssl/dh.h 496p5_pbe.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
689p5_pbe.o: ../../include/openssl/dsa.h ../../include/openssl/e_os.h 497p5_pbe.o: ../../include/openssl/err.h ../../include/openssl/evp.h
690p5_pbe.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h 498p5_pbe.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
691p5_pbe.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
692p5_pbe.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
693p5_pbe.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
694p5_pbe.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
695p5_pbe.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h 499p5_pbe.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
696p5_pbe.o: ../../include/openssl/opensslv.h ../../include/openssl/pkcs7.h 500p5_pbe.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
697p5_pbe.o: ../../include/openssl/rand.h ../../include/openssl/rc2.h 501p5_pbe.o: ../../include/openssl/pkcs7.h ../../include/openssl/rand.h
698p5_pbe.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h 502p5_pbe.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
699p5_pbe.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h 503p5_pbe.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
700p5_pbe.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h 504p5_pbe.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
701p5_pbe.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h 505p5_pbe.o: ../../include/openssl/x509_vfy.h ../cryptlib.h p5_pbe.c
702p5_pbe.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h 506p5_pbev2.o: ../../e_os.h ../../include/openssl/asn1.h
703p5_pbe.o: ../cryptlib.h 507p5_pbev2.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
704p5_pbev2.o: ../../include/openssl/asn1.h ../../include/openssl/asn1_mac.h
705p5_pbev2.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
706p5_pbev2.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h 508p5_pbev2.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
707p5_pbev2.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h 509p5_pbev2.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h
708p5_pbev2.o: ../../include/openssl/des.h ../../include/openssl/dh.h 510p5_pbev2.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
709p5_pbev2.o: ../../include/openssl/dsa.h ../../include/openssl/e_os.h 511p5_pbev2.o: ../../include/openssl/err.h ../../include/openssl/evp.h
710p5_pbev2.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h 512p5_pbev2.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
711p5_pbev2.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
712p5_pbev2.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
713p5_pbev2.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
714p5_pbev2.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
715p5_pbev2.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h 513p5_pbev2.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
716p5_pbev2.o: ../../include/openssl/opensslv.h ../../include/openssl/pkcs7.h 514p5_pbev2.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
717p5_pbev2.o: ../../include/openssl/rand.h ../../include/openssl/rc2.h 515p5_pbev2.o: ../../include/openssl/pkcs7.h ../../include/openssl/rand.h
718p5_pbev2.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h 516p5_pbev2.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
719p5_pbev2.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h 517p5_pbev2.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
720p5_pbev2.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h 518p5_pbev2.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
721p5_pbev2.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h 519p5_pbev2.o: ../../include/openssl/x509_vfy.h ../cryptlib.h p5_pbev2.c
722p5_pbev2.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h 520p8_pkey.o: ../../e_os.h ../../include/openssl/asn1.h
723p5_pbev2.o: ../cryptlib.h 521p8_pkey.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
724p7_dgst.o: ../../include/openssl/asn1.h ../../include/openssl/asn1_mac.h
725p7_dgst.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
726p7_dgst.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
727p7_dgst.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h
728p7_dgst.o: ../../include/openssl/des.h ../../include/openssl/dh.h
729p7_dgst.o: ../../include/openssl/dsa.h ../../include/openssl/e_os.h
730p7_dgst.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
731p7_dgst.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
732p7_dgst.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
733p7_dgst.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
734p7_dgst.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
735p7_dgst.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
736p7_dgst.o: ../../include/openssl/opensslv.h ../../include/openssl/pkcs7.h
737p7_dgst.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
738p7_dgst.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
739p7_dgst.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
740p7_dgst.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
741p7_dgst.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
742p7_dgst.o: ../../include/openssl/x509_vfy.h ../cryptlib.h
743p7_enc.o: ../../include/openssl/asn1.h ../../include/openssl/asn1_mac.h
744p7_enc.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
745p7_enc.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
746p7_enc.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h
747p7_enc.o: ../../include/openssl/des.h ../../include/openssl/dh.h
748p7_enc.o: ../../include/openssl/dsa.h ../../include/openssl/e_os.h
749p7_enc.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
750p7_enc.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
751p7_enc.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
752p7_enc.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
753p7_enc.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
754p7_enc.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
755p7_enc.o: ../../include/openssl/opensslv.h ../../include/openssl/pkcs7.h
756p7_enc.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
757p7_enc.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
758p7_enc.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
759p7_enc.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
760p7_enc.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
761p7_enc.o: ../../include/openssl/x509_vfy.h ../cryptlib.h
762p7_enc_c.o: ../../include/openssl/asn1.h ../../include/openssl/asn1_mac.h
763p7_enc_c.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
764p7_enc_c.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
765p7_enc_c.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h
766p7_enc_c.o: ../../include/openssl/des.h ../../include/openssl/dh.h
767p7_enc_c.o: ../../include/openssl/dsa.h ../../include/openssl/e_os.h
768p7_enc_c.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
769p7_enc_c.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
770p7_enc_c.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
771p7_enc_c.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
772p7_enc_c.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
773p7_enc_c.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
774p7_enc_c.o: ../../include/openssl/opensslv.h ../../include/openssl/pkcs7.h
775p7_enc_c.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
776p7_enc_c.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
777p7_enc_c.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
778p7_enc_c.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
779p7_enc_c.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
780p7_enc_c.o: ../../include/openssl/x509_vfy.h ../cryptlib.h
781p7_evp.o: ../../include/openssl/asn1.h ../../include/openssl/asn1_mac.h
782p7_evp.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
783p7_evp.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
784p7_evp.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h
785p7_evp.o: ../../include/openssl/des.h ../../include/openssl/dh.h
786p7_evp.o: ../../include/openssl/dsa.h ../../include/openssl/e_os.h
787p7_evp.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
788p7_evp.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
789p7_evp.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
790p7_evp.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
791p7_evp.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
792p7_evp.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
793p7_evp.o: ../../include/openssl/opensslv.h ../../include/openssl/pkcs7.h
794p7_evp.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
795p7_evp.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
796p7_evp.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
797p7_evp.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
798p7_evp.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
799p7_evp.o: ../../include/openssl/x509_vfy.h ../cryptlib.h
800p7_i_s.o: ../../include/openssl/asn1.h ../../include/openssl/asn1_mac.h
801p7_i_s.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
802p7_i_s.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
803p7_i_s.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h
804p7_i_s.o: ../../include/openssl/des.h ../../include/openssl/dh.h
805p7_i_s.o: ../../include/openssl/dsa.h ../../include/openssl/e_os.h
806p7_i_s.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
807p7_i_s.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
808p7_i_s.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
809p7_i_s.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
810p7_i_s.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
811p7_i_s.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
812p7_i_s.o: ../../include/openssl/opensslv.h ../../include/openssl/pkcs7.h
813p7_i_s.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
814p7_i_s.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
815p7_i_s.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
816p7_i_s.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
817p7_i_s.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
818p7_i_s.o: ../../include/openssl/x509_vfy.h ../cryptlib.h
819p7_lib.o: ../../include/openssl/asn1.h ../../include/openssl/asn1_mac.h
820p7_lib.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
821p7_lib.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
822p7_lib.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h
823p7_lib.o: ../../include/openssl/des.h ../../include/openssl/dh.h
824p7_lib.o: ../../include/openssl/dsa.h ../../include/openssl/e_os.h
825p7_lib.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
826p7_lib.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
827p7_lib.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
828p7_lib.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
829p7_lib.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
830p7_lib.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
831p7_lib.o: ../../include/openssl/opensslv.h ../../include/openssl/pkcs7.h
832p7_lib.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
833p7_lib.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
834p7_lib.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
835p7_lib.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
836p7_lib.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
837p7_lib.o: ../../include/openssl/x509_vfy.h ../cryptlib.h
838p7_recip.o: ../../include/openssl/asn1.h ../../include/openssl/asn1_mac.h
839p7_recip.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
840p7_recip.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
841p7_recip.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h
842p7_recip.o: ../../include/openssl/des.h ../../include/openssl/dh.h
843p7_recip.o: ../../include/openssl/dsa.h ../../include/openssl/e_os.h
844p7_recip.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
845p7_recip.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
846p7_recip.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
847p7_recip.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
848p7_recip.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
849p7_recip.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
850p7_recip.o: ../../include/openssl/opensslv.h ../../include/openssl/pkcs7.h
851p7_recip.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
852p7_recip.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
853p7_recip.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
854p7_recip.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
855p7_recip.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
856p7_recip.o: ../../include/openssl/x509_vfy.h ../cryptlib.h
857p7_s_e.o: ../../include/openssl/asn1.h ../../include/openssl/asn1_mac.h
858p7_s_e.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
859p7_s_e.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
860p7_s_e.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h
861p7_s_e.o: ../../include/openssl/des.h ../../include/openssl/dh.h
862p7_s_e.o: ../../include/openssl/dsa.h ../../include/openssl/e_os.h
863p7_s_e.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
864p7_s_e.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
865p7_s_e.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
866p7_s_e.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
867p7_s_e.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
868p7_s_e.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
869p7_s_e.o: ../../include/openssl/opensslv.h ../../include/openssl/pkcs7.h
870p7_s_e.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
871p7_s_e.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
872p7_s_e.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
873p7_s_e.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
874p7_s_e.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
875p7_s_e.o: ../../include/openssl/x509_vfy.h ../cryptlib.h
876p7_signd.o: ../../include/openssl/asn1.h ../../include/openssl/asn1_mac.h
877p7_signd.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
878p7_signd.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
879p7_signd.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h
880p7_signd.o: ../../include/openssl/des.h ../../include/openssl/dh.h
881p7_signd.o: ../../include/openssl/dsa.h ../../include/openssl/e_os.h
882p7_signd.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
883p7_signd.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
884p7_signd.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
885p7_signd.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
886p7_signd.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
887p7_signd.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
888p7_signd.o: ../../include/openssl/opensslv.h ../../include/openssl/pkcs7.h
889p7_signd.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
890p7_signd.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
891p7_signd.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
892p7_signd.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
893p7_signd.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
894p7_signd.o: ../../include/openssl/x509_vfy.h ../cryptlib.h
895p7_signi.o: ../../include/openssl/asn1.h ../../include/openssl/asn1_mac.h
896p7_signi.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
897p7_signi.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
898p7_signi.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h
899p7_signi.o: ../../include/openssl/des.h ../../include/openssl/dh.h
900p7_signi.o: ../../include/openssl/dsa.h ../../include/openssl/e_os.h
901p7_signi.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
902p7_signi.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
903p7_signi.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
904p7_signi.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
905p7_signi.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
906p7_signi.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
907p7_signi.o: ../../include/openssl/opensslv.h ../../include/openssl/pkcs7.h
908p7_signi.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
909p7_signi.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
910p7_signi.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
911p7_signi.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
912p7_signi.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
913p7_signi.o: ../../include/openssl/x509_vfy.h ../cryptlib.h
914p8_pkey.o: ../../include/openssl/asn1.h ../../include/openssl/asn1_mac.h
915p8_pkey.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
916p8_pkey.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h 522p8_pkey.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
917p8_pkey.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h 523p8_pkey.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h
918p8_pkey.o: ../../include/openssl/des.h ../../include/openssl/dh.h 524p8_pkey.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
919p8_pkey.o: ../../include/openssl/dsa.h ../../include/openssl/e_os.h 525p8_pkey.o: ../../include/openssl/err.h ../../include/openssl/evp.h
920p8_pkey.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h 526p8_pkey.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
921p8_pkey.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
922p8_pkey.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
923p8_pkey.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
924p8_pkey.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
925p8_pkey.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h 527p8_pkey.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
926p8_pkey.o: ../../include/openssl/opensslv.h ../../include/openssl/pkcs7.h 528p8_pkey.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
927p8_pkey.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h 529p8_pkey.o: ../../include/openssl/pkcs7.h ../../include/openssl/rsa.h
928p8_pkey.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h 530p8_pkey.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
929p8_pkey.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h 531p8_pkey.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
930p8_pkey.o: ../../include/openssl/sha.h ../../include/openssl/stack.h 532p8_pkey.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
931p8_pkey.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h 533p8_pkey.o: ../cryptlib.h p8_pkey.c
932p8_pkey.o: ../../include/openssl/x509_vfy.h ../cryptlib.h 534t_bitst.o: ../../e_os.h ../../include/openssl/asn1.h
933t_bitst.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h 535t_bitst.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
934t_bitst.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h 536t_bitst.o: ../../include/openssl/buffer.h ../../include/openssl/conf.h
935t_bitst.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h 537t_bitst.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h
936t_bitst.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h 538t_bitst.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
937t_bitst.o: ../../include/openssl/des.h ../../include/openssl/dh.h
938t_bitst.o: ../../include/openssl/dsa.h ../../include/openssl/e_os.h
939t_bitst.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h
940t_bitst.o: ../../include/openssl/err.h ../../include/openssl/evp.h 539t_bitst.o: ../../include/openssl/err.h ../../include/openssl/evp.h
941t_bitst.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h 540t_bitst.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
942t_bitst.o: ../../include/openssl/md2.h ../../include/openssl/md4.h 541t_bitst.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
943t_bitst.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h 542t_bitst.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
944t_bitst.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h 543t_bitst.o: ../../include/openssl/pkcs7.h ../../include/openssl/rsa.h
945t_bitst.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
946t_bitst.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
947t_bitst.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
948t_bitst.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
949t_bitst.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h 544t_bitst.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
950t_bitst.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h 545t_bitst.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
951t_bitst.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h 546t_bitst.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
952t_bitst.o: ../../include/openssl/x509v3.h ../cryptlib.h 547t_bitst.o: ../../include/openssl/x509v3.h ../cryptlib.h t_bitst.c
953t_crl.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h 548t_crl.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
954t_crl.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h 549t_crl.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
955t_crl.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
956t_crl.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h 550t_crl.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h
957t_crl.o: ../../include/openssl/des.h ../../include/openssl/dh.h 551t_crl.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
958t_crl.o: ../../include/openssl/dsa.h ../../include/openssl/e_os.h 552t_crl.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
959t_crl.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h 553t_crl.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
960t_crl.o: ../../include/openssl/err.h ../../include/openssl/evp.h
961t_crl.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
962t_crl.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
963t_crl.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
964t_crl.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h 554t_crl.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
965t_crl.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h 555t_crl.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
966t_crl.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h 556t_crl.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
967t_crl.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h 557t_crl.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
968t_crl.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h 558t_crl.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
969t_crl.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h 559t_crl.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
970t_crl.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h 560t_crl.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h
971t_crl.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h 561t_crl.o: ../cryptlib.h t_crl.c
972t_crl.o: ../../include/openssl/x509v3.h ../cryptlib.h 562t_pkey.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
973t_pkey.o: ../../include/openssl/bio.h ../../include/openssl/bn.h 563t_pkey.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
974t_pkey.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h 564t_pkey.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h
975t_pkey.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h 565t_pkey.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
976t_pkey.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h
977t_pkey.o: ../../include/openssl/err.h ../../include/openssl/lhash.h 566t_pkey.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
978t_pkey.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h 567t_pkey.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
979t_pkey.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h 568t_pkey.o: ../../include/openssl/ossl_typ.h ../../include/openssl/rsa.h
980t_pkey.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h 569t_pkey.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
981t_pkey.o: ../cryptlib.h 570t_pkey.o: ../../include/openssl/symhacks.h ../cryptlib.h t_pkey.c
982t_req.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h 571t_req.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
983t_req.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h 572t_req.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
984t_req.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
985t_req.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h 573t_req.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h
986t_req.o: ../../include/openssl/des.h ../../include/openssl/dh.h 574t_req.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
987t_req.o: ../../include/openssl/dsa.h ../../include/openssl/e_os.h 575t_req.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
988t_req.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h 576t_req.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
989t_req.o: ../../include/openssl/err.h ../../include/openssl/evp.h
990t_req.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
991t_req.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
992t_req.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
993t_req.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h 577t_req.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
994t_req.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h 578t_req.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
995t_req.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h 579t_req.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
996t_req.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h 580t_req.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
997t_req.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h 581t_req.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
998t_req.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h 582t_req.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
999t_req.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h 583t_req.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h
1000t_req.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h 584t_req.o: ../cryptlib.h t_req.c
1001t_req.o: ../../include/openssl/x509v3.h ../cryptlib.h 585t_spki.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
1002t_spki.o: ../../include/openssl/asn1.h ../../include/openssl/asn1_mac.h
1003t_spki.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
1004t_spki.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h 586t_spki.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
1005t_spki.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h 587t_spki.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h
1006t_spki.o: ../../include/openssl/des.h ../../include/openssl/dh.h 588t_spki.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
1007t_spki.o: ../../include/openssl/dsa.h ../../include/openssl/e_os.h 589t_spki.o: ../../include/openssl/err.h ../../include/openssl/evp.h
1008t_spki.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h 590t_spki.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
1009t_spki.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
1010t_spki.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
1011t_spki.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
1012t_spki.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
1013t_spki.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h 591t_spki.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
1014t_spki.o: ../../include/openssl/opensslv.h ../../include/openssl/pkcs7.h 592t_spki.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
1015t_spki.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h 593t_spki.o: ../../include/openssl/pkcs7.h ../../include/openssl/rsa.h
1016t_spki.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h 594t_spki.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
1017t_spki.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h 595t_spki.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
1018t_spki.o: ../../include/openssl/sha.h ../../include/openssl/stack.h 596t_spki.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
1019t_spki.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h 597t_spki.o: ../cryptlib.h t_spki.c
1020t_spki.o: ../../include/openssl/x509_vfy.h ../cryptlib.h 598t_x509.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
1021t_x509.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h 599t_x509.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
1022t_x509.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
1023t_x509.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
1024t_x509.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h 600t_x509.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h
1025t_x509.o: ../../include/openssl/des.h ../../include/openssl/dh.h 601t_x509.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
1026t_x509.o: ../../include/openssl/dsa.h ../../include/openssl/e_os.h 602t_x509.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
1027t_x509.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h 603t_x509.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
1028t_x509.o: ../../include/openssl/err.h ../../include/openssl/evp.h
1029t_x509.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
1030t_x509.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
1031t_x509.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
1032t_x509.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h 604t_x509.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
1033t_x509.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h 605t_x509.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
1034t_x509.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h 606t_x509.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
1035t_x509.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h 607t_x509.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
1036t_x509.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h 608t_x509.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
1037t_x509.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h 609t_x509.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
1038t_x509.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h 610t_x509.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h
1039t_x509.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h 611t_x509.o: ../cryptlib.h t_x509.c
1040t_x509.o: ../../include/openssl/x509v3.h ../cryptlib.h 612t_x509a.o: ../../e_os.h ../../include/openssl/asn1.h
1041t_x509a.o: ../../include/openssl/asn1.h ../../include/openssl/asn1_mac.h 613t_x509a.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
1042t_x509a.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h 614t_x509a.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
1043t_x509a.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h 615t_x509a.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
1044t_x509a.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h
1045t_x509a.o: ../../include/openssl/des.h ../../include/openssl/dh.h
1046t_x509a.o: ../../include/openssl/dsa.h ../../include/openssl/e_os.h
1047t_x509a.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h 616t_x509a.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
1048t_x509a.o: ../../include/openssl/evp.h ../../include/openssl/idea.h 617t_x509a.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
1049t_x509a.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h 618t_x509a.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
1050t_x509a.o: ../../include/openssl/md4.h ../../include/openssl/md5.h 619t_x509a.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
1051t_x509a.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h 620t_x509a.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
1052t_x509a.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
1053t_x509a.o: ../../include/openssl/opensslv.h ../../include/openssl/pkcs7.h
1054t_x509a.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
1055t_x509a.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
1056t_x509a.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h 621t_x509a.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
1057t_x509a.o: ../../include/openssl/sha.h ../../include/openssl/stack.h 622t_x509a.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
1058t_x509a.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h 623t_x509a.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
1059t_x509a.o: ../../include/openssl/x509_vfy.h ../cryptlib.h 624t_x509a.o: ../../include/openssl/x509_vfy.h ../cryptlib.h t_x509a.c
1060x_algor.o: ../../include/openssl/asn1.h ../../include/openssl/asn1_mac.h 625tasn_dec.o: ../../include/openssl/asn1.h ../../include/openssl/asn1t.h
1061x_algor.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h 626tasn_dec.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
1062x_algor.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h 627tasn_dec.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
1063x_algor.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h 628tasn_dec.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
1064x_algor.o: ../../include/openssl/des.h ../../include/openssl/dh.h 629tasn_dec.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
1065x_algor.o: ../../include/openssl/dsa.h ../../include/openssl/e_os.h 630tasn_dec.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
1066x_algor.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h 631tasn_dec.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
1067x_algor.o: ../../include/openssl/evp.h ../../include/openssl/idea.h 632tasn_dec.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
1068x_algor.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h 633tasn_dec.o: ../../include/openssl/symhacks.h tasn_dec.c
1069x_algor.o: ../../include/openssl/md4.h ../../include/openssl/md5.h 634tasn_enc.o: ../../include/openssl/asn1.h ../../include/openssl/asn1t.h
1070x_algor.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h 635tasn_enc.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
636tasn_enc.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
637tasn_enc.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
638tasn_enc.o: ../../include/openssl/opensslconf.h
639tasn_enc.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
640tasn_enc.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
641tasn_enc.o: ../../include/openssl/symhacks.h tasn_enc.c
642tasn_fre.o: ../../include/openssl/asn1.h ../../include/openssl/asn1t.h
643tasn_fre.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
644tasn_fre.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
645tasn_fre.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
646tasn_fre.o: ../../include/openssl/opensslconf.h
647tasn_fre.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
648tasn_fre.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
649tasn_fre.o: ../../include/openssl/symhacks.h tasn_fre.c
650tasn_new.o: ../../include/openssl/asn1.h ../../include/openssl/asn1t.h
651tasn_new.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
652tasn_new.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
653tasn_new.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
654tasn_new.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
655tasn_new.o: ../../include/openssl/opensslconf.h
656tasn_new.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
657tasn_new.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
658tasn_new.o: ../../include/openssl/symhacks.h tasn_new.c
659tasn_typ.o: ../../include/openssl/asn1.h ../../include/openssl/asn1t.h
660tasn_typ.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
661tasn_typ.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
662tasn_typ.o: ../../include/openssl/opensslconf.h
663tasn_typ.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
664tasn_typ.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
665tasn_typ.o: ../../include/openssl/symhacks.h tasn_typ.c
666tasn_utl.o: ../../include/openssl/asn1.h ../../include/openssl/asn1t.h
667tasn_utl.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
668tasn_utl.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
669tasn_utl.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
670tasn_utl.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
671tasn_utl.o: ../../include/openssl/opensslconf.h
672tasn_utl.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
673tasn_utl.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
674tasn_utl.o: ../../include/openssl/symhacks.h tasn_utl.c
675x_algor.o: ../../include/openssl/asn1.h ../../include/openssl/asn1t.h
676x_algor.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
677x_algor.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
678x_algor.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
679x_algor.o: ../../include/openssl/e_os2.h ../../include/openssl/evp.h
680x_algor.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
1071x_algor.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h 681x_algor.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
1072x_algor.o: ../../include/openssl/opensslv.h ../../include/openssl/pkcs7.h 682x_algor.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
1073x_algor.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h 683x_algor.o: ../../include/openssl/pkcs7.h ../../include/openssl/rsa.h
1074x_algor.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h 684x_algor.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
1075x_algor.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h 685x_algor.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
1076x_algor.o: ../../include/openssl/sha.h ../../include/openssl/stack.h 686x_algor.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
1077x_algor.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h 687x_algor.o: x_algor.c
1078x_algor.o: ../../include/openssl/x509_vfy.h ../cryptlib.h 688x_attrib.o: ../../e_os.h ../../include/openssl/asn1.h
1079x_attrib.o: ../../include/openssl/asn1.h ../../include/openssl/asn1_mac.h 689x_attrib.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
1080x_attrib.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
1081x_attrib.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h 690x_attrib.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
1082x_attrib.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h 691x_attrib.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h
1083x_attrib.o: ../../include/openssl/des.h ../../include/openssl/dh.h 692x_attrib.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
1084x_attrib.o: ../../include/openssl/dsa.h ../../include/openssl/e_os.h 693x_attrib.o: ../../include/openssl/err.h ../../include/openssl/evp.h
1085x_attrib.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h 694x_attrib.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
1086x_attrib.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
1087x_attrib.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
1088x_attrib.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
1089x_attrib.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
1090x_attrib.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h 695x_attrib.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
1091x_attrib.o: ../../include/openssl/opensslv.h ../../include/openssl/pkcs7.h 696x_attrib.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
1092x_attrib.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h 697x_attrib.o: ../../include/openssl/pkcs7.h ../../include/openssl/rsa.h
1093x_attrib.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h 698x_attrib.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
1094x_attrib.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h 699x_attrib.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
1095x_attrib.o: ../../include/openssl/sha.h ../../include/openssl/stack.h 700x_attrib.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
1096x_attrib.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h 701x_attrib.o: ../cryptlib.h x_attrib.c
1097x_attrib.o: ../../include/openssl/x509_vfy.h ../cryptlib.h 702x_bignum.o: ../../e_os.h ../../include/openssl/asn1.h
1098x_cinf.o: ../../include/openssl/asn1.h ../../include/openssl/asn1_mac.h 703x_bignum.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
1099x_cinf.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h 704x_bignum.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
1100x_cinf.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h 705x_bignum.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
1101x_cinf.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h 706x_bignum.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
1102x_cinf.o: ../../include/openssl/des.h ../../include/openssl/dh.h 707x_bignum.o: ../../include/openssl/opensslconf.h
1103x_cinf.o: ../../include/openssl/dsa.h ../../include/openssl/e_os.h 708x_bignum.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
1104x_cinf.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h 709x_bignum.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
1105x_cinf.o: ../../include/openssl/evp.h ../../include/openssl/idea.h 710x_bignum.o: ../../include/openssl/symhacks.h ../cryptlib.h x_bignum.c
1106x_cinf.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h 711x_crl.o: ../../e_os.h ../../include/openssl/asn1.h
1107x_cinf.o: ../../include/openssl/md4.h ../../include/openssl/md5.h 712x_crl.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
1108x_cinf.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
1109x_cinf.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
1110x_cinf.o: ../../include/openssl/opensslv.h ../../include/openssl/pkcs7.h
1111x_cinf.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
1112x_cinf.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
1113x_cinf.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
1114x_cinf.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
1115x_cinf.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
1116x_cinf.o: ../../include/openssl/x509_vfy.h ../cryptlib.h
1117x_crl.o: ../../include/openssl/asn1.h ../../include/openssl/asn1_mac.h
1118x_crl.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
1119x_crl.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h 713x_crl.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
1120x_crl.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h 714x_crl.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h
1121x_crl.o: ../../include/openssl/des.h ../../include/openssl/dh.h 715x_crl.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
1122x_crl.o: ../../include/openssl/dsa.h ../../include/openssl/e_os.h 716x_crl.o: ../../include/openssl/err.h ../../include/openssl/evp.h
1123x_crl.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h 717x_crl.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
1124x_crl.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
1125x_crl.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
1126x_crl.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
1127x_crl.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
1128x_crl.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h 718x_crl.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
1129x_crl.o: ../../include/openssl/opensslv.h ../../include/openssl/pkcs7.h 719x_crl.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
1130x_crl.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h 720x_crl.o: ../../include/openssl/pkcs7.h ../../include/openssl/rsa.h
1131x_crl.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h 721x_crl.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
1132x_crl.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h 722x_crl.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
1133x_crl.o: ../../include/openssl/sha.h ../../include/openssl/stack.h 723x_crl.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
1134x_crl.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h 724x_crl.o: ../cryptlib.h x_crl.c
1135x_crl.o: ../../include/openssl/x509_vfy.h ../cryptlib.h 725x_exten.o: ../../include/openssl/asn1.h ../../include/openssl/asn1t.h
1136x_exten.o: ../../include/openssl/asn1.h ../../include/openssl/asn1_mac.h 726x_exten.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
1137x_exten.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h 727x_exten.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
1138x_exten.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h 728x_exten.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
1139x_exten.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h 729x_exten.o: ../../include/openssl/e_os2.h ../../include/openssl/evp.h
1140x_exten.o: ../../include/openssl/des.h ../../include/openssl/dh.h 730x_exten.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
1141x_exten.o: ../../include/openssl/dsa.h ../../include/openssl/e_os.h
1142x_exten.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
1143x_exten.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
1144x_exten.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
1145x_exten.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
1146x_exten.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
1147x_exten.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h 731x_exten.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
1148x_exten.o: ../../include/openssl/opensslv.h ../../include/openssl/pkcs7.h 732x_exten.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
1149x_exten.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h 733x_exten.o: ../../include/openssl/pkcs7.h ../../include/openssl/rsa.h
1150x_exten.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h 734x_exten.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
1151x_exten.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h 735x_exten.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
1152x_exten.o: ../../include/openssl/sha.h ../../include/openssl/stack.h 736x_exten.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
1153x_exten.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h 737x_exten.o: x_exten.c
1154x_exten.o: ../../include/openssl/x509_vfy.h ../cryptlib.h 738x_info.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
1155x_info.o: ../../include/openssl/asn1.h ../../include/openssl/asn1_mac.h
1156x_info.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
1157x_info.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h 739x_info.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
1158x_info.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h 740x_info.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h
1159x_info.o: ../../include/openssl/des.h ../../include/openssl/dh.h 741x_info.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
1160x_info.o: ../../include/openssl/dsa.h ../../include/openssl/e_os.h 742x_info.o: ../../include/openssl/err.h ../../include/openssl/evp.h
1161x_info.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h 743x_info.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
1162x_info.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
1163x_info.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
1164x_info.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
1165x_info.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
1166x_info.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h 744x_info.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
1167x_info.o: ../../include/openssl/opensslv.h ../../include/openssl/pkcs7.h 745x_info.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
1168x_info.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h 746x_info.o: ../../include/openssl/pkcs7.h ../../include/openssl/rsa.h
1169x_info.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h 747x_info.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
1170x_info.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h 748x_info.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
1171x_info.o: ../../include/openssl/sha.h ../../include/openssl/stack.h 749x_info.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
1172x_info.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h 750x_info.o: ../cryptlib.h x_info.c
1173x_info.o: ../../include/openssl/x509_vfy.h ../cryptlib.h 751x_long.o: ../../e_os.h ../../include/openssl/asn1.h
1174x_name.o: ../../include/openssl/asn1.h ../../include/openssl/asn1_mac.h 752x_long.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
1175x_name.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h 753x_long.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
754x_long.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
755x_long.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
756x_long.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
757x_long.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h
758x_long.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
759x_long.o: ../cryptlib.h x_long.c
760x_name.o: ../../e_os.h ../../include/openssl/asn1.h
761x_name.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
1176x_name.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h 762x_name.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
1177x_name.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h 763x_name.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h
1178x_name.o: ../../include/openssl/des.h ../../include/openssl/dh.h 764x_name.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
1179x_name.o: ../../include/openssl/dsa.h ../../include/openssl/e_os.h 765x_name.o: ../../include/openssl/err.h ../../include/openssl/evp.h
1180x_name.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h 766x_name.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
1181x_name.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
1182x_name.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
1183x_name.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
1184x_name.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
1185x_name.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h 767x_name.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
1186x_name.o: ../../include/openssl/opensslv.h ../../include/openssl/pkcs7.h 768x_name.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
1187x_name.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h 769x_name.o: ../../include/openssl/pkcs7.h ../../include/openssl/rsa.h
1188x_name.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h 770x_name.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
1189x_name.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h 771x_name.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
1190x_name.o: ../../include/openssl/sha.h ../../include/openssl/stack.h 772x_name.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
1191x_name.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h 773x_name.o: ../cryptlib.h x_name.c
1192x_name.o: ../../include/openssl/x509_vfy.h ../cryptlib.h 774x_pkey.o: ../../e_os.h ../../include/openssl/asn1.h
1193x_pkey.o: ../../include/openssl/asn1.h ../../include/openssl/asn1_mac.h 775x_pkey.o: ../../include/openssl/asn1_mac.h ../../include/openssl/bio.h
1194x_pkey.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
1195x_pkey.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h 776x_pkey.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
1196x_pkey.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h 777x_pkey.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h
1197x_pkey.o: ../../include/openssl/des.h ../../include/openssl/dh.h 778x_pkey.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
1198x_pkey.o: ../../include/openssl/dsa.h ../../include/openssl/e_os.h 779x_pkey.o: ../../include/openssl/err.h ../../include/openssl/evp.h
1199x_pkey.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h 780x_pkey.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
1200x_pkey.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
1201x_pkey.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
1202x_pkey.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
1203x_pkey.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
1204x_pkey.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h 781x_pkey.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
1205x_pkey.o: ../../include/openssl/opensslv.h ../../include/openssl/pkcs7.h 782x_pkey.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
1206x_pkey.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h 783x_pkey.o: ../../include/openssl/pkcs7.h ../../include/openssl/rsa.h
1207x_pkey.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h 784x_pkey.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
1208x_pkey.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h 785x_pkey.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
1209x_pkey.o: ../../include/openssl/sha.h ../../include/openssl/stack.h 786x_pkey.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
1210x_pkey.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h 787x_pkey.o: ../cryptlib.h x_pkey.c
1211x_pkey.o: ../../include/openssl/x509_vfy.h ../cryptlib.h 788x_pubkey.o: ../../e_os.h ../../include/openssl/asn1.h
1212x_pubkey.o: ../../include/openssl/asn1.h ../../include/openssl/asn1_mac.h 789x_pubkey.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
1213x_pubkey.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
1214x_pubkey.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h 790x_pubkey.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
1215x_pubkey.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h 791x_pubkey.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h
1216x_pubkey.o: ../../include/openssl/des.h ../../include/openssl/dh.h 792x_pubkey.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
1217x_pubkey.o: ../../include/openssl/dsa.h ../../include/openssl/e_os.h 793x_pubkey.o: ../../include/openssl/err.h ../../include/openssl/evp.h
1218x_pubkey.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h 794x_pubkey.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
1219x_pubkey.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
1220x_pubkey.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
1221x_pubkey.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
1222x_pubkey.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
1223x_pubkey.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h 795x_pubkey.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
1224x_pubkey.o: ../../include/openssl/opensslv.h ../../include/openssl/pkcs7.h 796x_pubkey.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
1225x_pubkey.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h 797x_pubkey.o: ../../include/openssl/pkcs7.h ../../include/openssl/rsa.h
1226x_pubkey.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h 798x_pubkey.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
1227x_pubkey.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h 799x_pubkey.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
1228x_pubkey.o: ../../include/openssl/sha.h ../../include/openssl/stack.h 800x_pubkey.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
1229x_pubkey.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h 801x_pubkey.o: ../cryptlib.h x_pubkey.c
1230x_pubkey.o: ../../include/openssl/x509_vfy.h ../cryptlib.h 802x_req.o: ../../e_os.h ../../include/openssl/asn1.h
1231x_req.o: ../../include/openssl/asn1.h ../../include/openssl/asn1_mac.h 803x_req.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
1232x_req.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
1233x_req.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h 804x_req.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
1234x_req.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h 805x_req.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h
1235x_req.o: ../../include/openssl/des.h ../../include/openssl/dh.h 806x_req.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
1236x_req.o: ../../include/openssl/dsa.h ../../include/openssl/e_os.h 807x_req.o: ../../include/openssl/err.h ../../include/openssl/evp.h
1237x_req.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h 808x_req.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
1238x_req.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
1239x_req.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
1240x_req.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
1241x_req.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
1242x_req.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h 809x_req.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
1243x_req.o: ../../include/openssl/opensslv.h ../../include/openssl/pkcs7.h 810x_req.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
1244x_req.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h 811x_req.o: ../../include/openssl/pkcs7.h ../../include/openssl/rsa.h
1245x_req.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h 812x_req.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
1246x_req.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h 813x_req.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
1247x_req.o: ../../include/openssl/sha.h ../../include/openssl/stack.h 814x_req.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
1248x_req.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h 815x_req.o: ../cryptlib.h x_req.c
1249x_req.o: ../../include/openssl/x509_vfy.h ../cryptlib.h 816x_sig.o: ../../e_os.h ../../include/openssl/asn1.h
1250x_sig.o: ../../include/openssl/asn1.h ../../include/openssl/asn1_mac.h 817x_sig.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
1251x_sig.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
1252x_sig.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h 818x_sig.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
1253x_sig.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h 819x_sig.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h
1254x_sig.o: ../../include/openssl/des.h ../../include/openssl/dh.h 820x_sig.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
1255x_sig.o: ../../include/openssl/dsa.h ../../include/openssl/e_os.h 821x_sig.o: ../../include/openssl/err.h ../../include/openssl/evp.h
1256x_sig.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h 822x_sig.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
1257x_sig.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
1258x_sig.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
1259x_sig.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
1260x_sig.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
1261x_sig.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h 823x_sig.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
1262x_sig.o: ../../include/openssl/opensslv.h ../../include/openssl/pkcs7.h 824x_sig.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
1263x_sig.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h 825x_sig.o: ../../include/openssl/pkcs7.h ../../include/openssl/rsa.h
1264x_sig.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h 826x_sig.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
1265x_sig.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h 827x_sig.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
1266x_sig.o: ../../include/openssl/sha.h ../../include/openssl/stack.h 828x_sig.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
1267x_sig.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h 829x_sig.o: ../cryptlib.h x_sig.c
1268x_sig.o: ../../include/openssl/x509_vfy.h ../cryptlib.h 830x_spki.o: ../../e_os.h ../../include/openssl/asn1.h
1269x_spki.o: ../../include/openssl/asn1.h ../../include/openssl/asn1_mac.h 831x_spki.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
1270x_spki.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
1271x_spki.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h 832x_spki.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
1272x_spki.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h 833x_spki.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h
1273x_spki.o: ../../include/openssl/des.h ../../include/openssl/dh.h 834x_spki.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
1274x_spki.o: ../../include/openssl/dsa.h ../../include/openssl/e_os.h 835x_spki.o: ../../include/openssl/err.h ../../include/openssl/evp.h
1275x_spki.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h 836x_spki.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
1276x_spki.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
1277x_spki.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
1278x_spki.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
1279x_spki.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
1280x_spki.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h 837x_spki.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
1281x_spki.o: ../../include/openssl/opensslv.h ../../include/openssl/pkcs7.h 838x_spki.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
1282x_spki.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h 839x_spki.o: ../../include/openssl/pkcs7.h ../../include/openssl/rsa.h
1283x_spki.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h 840x_spki.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
1284x_spki.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h 841x_spki.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
1285x_spki.o: ../../include/openssl/sha.h ../../include/openssl/stack.h 842x_spki.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
1286x_spki.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h 843x_spki.o: ../cryptlib.h x_spki.c
1287x_spki.o: ../../include/openssl/x509_vfy.h ../cryptlib.h 844x_val.o: ../../e_os.h ../../include/openssl/asn1.h
1288x_val.o: ../../include/openssl/asn1.h ../../include/openssl/asn1_mac.h 845x_val.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
1289x_val.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
1290x_val.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h 846x_val.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
1291x_val.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h 847x_val.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h
1292x_val.o: ../../include/openssl/des.h ../../include/openssl/dh.h 848x_val.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
1293x_val.o: ../../include/openssl/dsa.h ../../include/openssl/e_os.h 849x_val.o: ../../include/openssl/err.h ../../include/openssl/evp.h
1294x_val.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h 850x_val.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
1295x_val.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
1296x_val.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
1297x_val.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
1298x_val.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
1299x_val.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h 851x_val.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
1300x_val.o: ../../include/openssl/opensslv.h ../../include/openssl/pkcs7.h 852x_val.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
1301x_val.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h 853x_val.o: ../../include/openssl/pkcs7.h ../../include/openssl/rsa.h
1302x_val.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h 854x_val.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
1303x_val.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h 855x_val.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
1304x_val.o: ../../include/openssl/sha.h ../../include/openssl/stack.h 856x_val.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
1305x_val.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h 857x_val.o: ../cryptlib.h x_val.c
1306x_val.o: ../../include/openssl/x509_vfy.h ../cryptlib.h 858x_x509.o: ../../e_os.h ../../include/openssl/asn1.h
1307x_x509.o: ../../include/openssl/asn1.h ../../include/openssl/asn1_mac.h 859x_x509.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
1308x_x509.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
1309x_x509.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h 860x_x509.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
1310x_x509.o: ../../include/openssl/cast.h ../../include/openssl/conf.h 861x_x509.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h
1311x_x509.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
1312x_x509.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h 862x_x509.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
1313x_x509.o: ../../include/openssl/e_os.h ../../include/openssl/e_os.h
1314x_x509.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h 863x_x509.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
1315x_x509.o: ../../include/openssl/evp.h ../../include/openssl/idea.h 864x_x509.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
1316x_x509.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h 865x_x509.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
1317x_x509.o: ../../include/openssl/md4.h ../../include/openssl/md5.h 866x_x509.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
1318x_x509.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h 867x_x509.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
1319x_x509.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
1320x_x509.o: ../../include/openssl/opensslv.h ../../include/openssl/pkcs7.h
1321x_x509.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
1322x_x509.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
1323x_x509.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h 868x_x509.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
1324x_x509.o: ../../include/openssl/sha.h ../../include/openssl/stack.h 869x_x509.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
1325x_x509.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h 870x_x509.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
1326x_x509.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h 871x_x509.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h
1327x_x509.o: ../cryptlib.h 872x_x509.o: ../cryptlib.h x_x509.c
1328x_x509a.o: ../../include/openssl/asn1.h ../../include/openssl/asn1_mac.h 873x_x509a.o: ../../e_os.h ../../include/openssl/asn1.h
1329x_x509a.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h 874x_x509a.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
1330x_x509a.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h 875x_x509a.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
1331x_x509a.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h 876x_x509a.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h
1332x_x509a.o: ../../include/openssl/des.h ../../include/openssl/dh.h 877x_x509a.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
1333x_x509a.o: ../../include/openssl/dsa.h ../../include/openssl/e_os.h 878x_x509a.o: ../../include/openssl/err.h ../../include/openssl/evp.h
1334x_x509a.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h 879x_x509a.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
1335x_x509a.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
1336x_x509a.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
1337x_x509a.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
1338x_x509a.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
1339x_x509a.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h 880x_x509a.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
1340x_x509a.o: ../../include/openssl/opensslv.h ../../include/openssl/pkcs7.h 881x_x509a.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
1341x_x509a.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h 882x_x509a.o: ../../include/openssl/pkcs7.h ../../include/openssl/rsa.h
1342x_x509a.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h 883x_x509a.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
1343x_x509a.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h 884x_x509a.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
1344x_x509a.o: ../../include/openssl/sha.h ../../include/openssl/stack.h 885x_x509a.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
1345x_x509a.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h 886x_x509a.o: ../cryptlib.h x_x509a.c
1346x_x509a.o: ../../include/openssl/x509_vfy.h ../cryptlib.h
diff --git a/src/lib/libcrypto/asn1/a_bitstr.c b/src/lib/libcrypto/asn1/a_bitstr.c
index 7013a407ad..c36817c1ee 100644
--- a/src/lib/libcrypto/asn1/a_bitstr.c
+++ b/src/lib/libcrypto/asn1/a_bitstr.c
@@ -60,27 +60,9 @@
60#include "cryptlib.h" 60#include "cryptlib.h"
61#include <openssl/asn1.h> 61#include <openssl/asn1.h>
62 62
63ASN1_BIT_STRING *ASN1_BIT_STRING_new(void)
64{ return M_ASN1_BIT_STRING_new(); }
65
66void ASN1_BIT_STRING_free(ASN1_BIT_STRING *x)
67{ M_ASN1_BIT_STRING_free(x); }
68
69int ASN1_BIT_STRING_set(ASN1_BIT_STRING *x, unsigned char *d, int len) 63int ASN1_BIT_STRING_set(ASN1_BIT_STRING *x, unsigned char *d, int len)
70{ return M_ASN1_BIT_STRING_set(x, d, len); } 64{ return M_ASN1_BIT_STRING_set(x, d, len); }
71 65
72int i2d_ASN1_BIT_STRING(ASN1_BIT_STRING *a, unsigned char **pp)
73{
74 int len, ret;
75 len = i2c_ASN1_BIT_STRING(a, NULL);
76 ret=ASN1_object_size(0,len,V_ASN1_BIT_STRING);
77 if(pp) {
78 ASN1_put_object(pp,0,len,V_ASN1_BIT_STRING,V_ASN1_UNIVERSAL);
79 i2c_ASN1_BIT_STRING(a, pp);
80 }
81 return ret;
82}
83
84int i2c_ASN1_BIT_STRING(ASN1_BIT_STRING *a, unsigned char **pp) 66int i2c_ASN1_BIT_STRING(ASN1_BIT_STRING *a, unsigned char **pp)
85 { 67 {
86 int ret,j,bits,len; 68 int ret,j,bits,len;
@@ -129,40 +111,6 @@ int i2c_ASN1_BIT_STRING(ASN1_BIT_STRING *a, unsigned char **pp)
129 return(ret); 111 return(ret);
130 } 112 }
131 113
132
133/* Convert DER encoded ASN1 BIT_STRING to ASN1_BIT_STRING structure */
134ASN1_BIT_STRING *d2i_ASN1_BIT_STRING(ASN1_BIT_STRING **a, unsigned char **pp,
135 long length)
136{
137 unsigned char *p;
138 long len;
139 int i;
140 int inf,tag,xclass;
141 ASN1_BIT_STRING *ret;
142
143 p= *pp;
144 inf=ASN1_get_object(&p,&len,&tag,&xclass,length);
145 if (inf & 0x80)
146 {
147 i=ASN1_R_BAD_OBJECT_HEADER;
148 goto err;
149 }
150
151 if (tag != V_ASN1_BIT_STRING)
152 {
153 i=ASN1_R_EXPECTING_A_BIT_STRING;
154 goto err;
155 }
156 if (len < 1) { i=ASN1_R_STRING_TOO_SHORT; goto err; }
157 ret = c2i_ASN1_BIT_STRING(a, &p, len);
158 if(ret) *pp = p;
159 return ret;
160err:
161 ASN1err(ASN1_F_D2I_ASN1_BIT_STRING,i);
162 return(NULL);
163
164}
165
166ASN1_BIT_STRING *c2i_ASN1_BIT_STRING(ASN1_BIT_STRING **a, unsigned char **pp, 114ASN1_BIT_STRING *c2i_ASN1_BIT_STRING(ASN1_BIT_STRING **a, unsigned char **pp,
167 long len) 115 long len)
168 { 116 {
@@ -224,6 +172,7 @@ int ASN1_BIT_STRING_set_bit(ASN1_BIT_STRING *a, int n, int value)
224 w=n/8; 172 w=n/8;
225 v=1<<(7-(n&0x07)); 173 v=1<<(7-(n&0x07));
226 iv= ~v; 174 iv= ~v;
175 if (!value) v=0;
227 176
228 a->flags&= ~(ASN1_STRING_FLAG_BITS_LEFT|0x07); /* clear, set on write */ 177 a->flags&= ~(ASN1_STRING_FLAG_BITS_LEFT|0x07); /* clear, set on write */
229 178
diff --git a/src/lib/libcrypto/asn1/a_bool.c b/src/lib/libcrypto/asn1/a_bool.c
index 18fa61840b..24333ea4d5 100644
--- a/src/lib/libcrypto/asn1/a_bool.c
+++ b/src/lib/libcrypto/asn1/a_bool.c
@@ -58,7 +58,7 @@
58 58
59#include <stdio.h> 59#include <stdio.h>
60#include "cryptlib.h" 60#include "cryptlib.h"
61#include <openssl/asn1.h> 61#include <openssl/asn1t.h>
62 62
63int i2d_ASN1_BOOLEAN(int a, unsigned char **pp) 63int i2d_ASN1_BOOLEAN(int a, unsigned char **pp)
64 { 64 {
@@ -110,3 +110,5 @@ err:
110 ASN1err(ASN1_F_D2I_ASN1_BOOLEAN,i); 110 ASN1err(ASN1_F_D2I_ASN1_BOOLEAN,i);
111 return(ret); 111 return(ret);
112 } 112 }
113
114
diff --git a/src/lib/libcrypto/asn1/a_bytes.c b/src/lib/libcrypto/asn1/a_bytes.c
index 3a0c0c7835..bb88660f58 100644
--- a/src/lib/libcrypto/asn1/a_bytes.c
+++ b/src/lib/libcrypto/asn1/a_bytes.c
@@ -58,18 +58,7 @@
58 58
59#include <stdio.h> 59#include <stdio.h>
60#include "cryptlib.h" 60#include "cryptlib.h"
61#include <openssl/asn1_mac.h> 61#include <openssl/asn1.h>
62
63static unsigned long tag2bit[32]={
640, 0, 0, B_ASN1_BIT_STRING, /* tags 0 - 3 */
65B_ASN1_OCTET_STRING, 0, 0, B_ASN1_UNKNOWN,/* tags 4- 7 */
66B_ASN1_UNKNOWN, B_ASN1_UNKNOWN, B_ASN1_UNKNOWN, B_ASN1_UNKNOWN,/* tags 8-11 */
67B_ASN1_UTF8STRING,B_ASN1_UNKNOWN,B_ASN1_UNKNOWN,B_ASN1_UNKNOWN,/* tags 12-15 */
680, 0, B_ASN1_NUMERICSTRING,B_ASN1_PRINTABLESTRING,
69B_ASN1_T61STRING,B_ASN1_VIDEOTEXSTRING,B_ASN1_IA5STRING,0,
700,B_ASN1_GRAPHICSTRING,B_ASN1_ISO64STRING,B_ASN1_GENERALSTRING,
71B_ASN1_UNIVERSALSTRING,B_ASN1_UNKNOWN,B_ASN1_BMPSTRING,B_ASN1_UNKNOWN,
72 };
73 62
74static int asn1_collate_primitive(ASN1_STRING *a, ASN1_CTX *c); 63static int asn1_collate_primitive(ASN1_STRING *a, ASN1_CTX *c);
75/* type is a 'bitmap' of acceptable string types. 64/* type is a 'bitmap' of acceptable string types.
@@ -92,7 +81,7 @@ ASN1_STRING *d2i_ASN1_type_bytes(ASN1_STRING **a, unsigned char **pp,
92 i=ASN1_R_TAG_VALUE_TOO_HIGH;; 81 i=ASN1_R_TAG_VALUE_TOO_HIGH;;
93 goto err; 82 goto err;
94 } 83 }
95 if (!(tag2bit[tag] & type)) 84 if (!(ASN1_tag2bit(tag) & type))
96 { 85 {
97 i=ASN1_R_WRONG_TYPE; 86 i=ASN1_R_WRONG_TYPE;
98 goto err; 87 goto err;
diff --git a/src/lib/libcrypto/asn1/a_d2i_fp.c b/src/lib/libcrypto/asn1/a_d2i_fp.c
index a49d1cb289..a80fbe9ff7 100644
--- a/src/lib/libcrypto/asn1/a_d2i_fp.c
+++ b/src/lib/libcrypto/asn1/a_d2i_fp.c
@@ -61,9 +61,11 @@
61#include <openssl/buffer.h> 61#include <openssl/buffer.h>
62#include <openssl/asn1_mac.h> 62#include <openssl/asn1_mac.h>
63 63
64#define HEADER_SIZE 8 64static int asn1_d2i_read_bio(BIO *in, BUF_MEM **pb);
65
66#ifndef NO_OLD_ASN1
67#ifndef OPENSSL_NO_FP_API
65 68
66#ifndef NO_FP_API
67char *ASN1_d2i_fp(char *(*xnew)(), char *(*d2i)(), FILE *in, 69char *ASN1_d2i_fp(char *(*xnew)(), char *(*d2i)(), FILE *in,
68 unsigned char **x) 70 unsigned char **x)
69 { 71 {
@@ -85,10 +87,65 @@ char *ASN1_d2i_fp(char *(*xnew)(), char *(*d2i)(), FILE *in,
85char *ASN1_d2i_bio(char *(*xnew)(), char *(*d2i)(), BIO *in, 87char *ASN1_d2i_bio(char *(*xnew)(), char *(*d2i)(), BIO *in,
86 unsigned char **x) 88 unsigned char **x)
87 { 89 {
90 BUF_MEM *b = NULL;
91 unsigned char *p;
92 char *ret=NULL;
93 int len;
94
95 len = asn1_d2i_read_bio(in, &b);
96 if(len < 0) goto err;
97
98 p=(unsigned char *)b->data;
99 ret=d2i(x,&p,len);
100err:
101 if (b != NULL) BUF_MEM_free(b);
102 return(ret);
103 }
104
105#endif
106
107void *ASN1_item_d2i_bio(const ASN1_ITEM *it, BIO *in, void *x)
108 {
109 BUF_MEM *b = NULL;
110 unsigned char *p;
111 void *ret=NULL;
112 int len;
113
114 len = asn1_d2i_read_bio(in, &b);
115 if(len < 0) goto err;
116
117 p=(unsigned char *)b->data;
118 ret=ASN1_item_d2i(x,&p,len, it);
119err:
120 if (b != NULL) BUF_MEM_free(b);
121 return(ret);
122 }
123
124#ifndef OPENSSL_NO_FP_API
125void *ASN1_item_d2i_fp(const ASN1_ITEM *it, FILE *in, void *x)
126 {
127 BIO *b;
128 char *ret;
129
130 if ((b=BIO_new(BIO_s_file())) == NULL)
131 {
132 ASN1err(ASN1_F_ASN1_D2I_FP,ERR_R_BUF_LIB);
133 return(NULL);
134 }
135 BIO_set_fp(b,in,BIO_NOCLOSE);
136 ret=ASN1_item_d2i_bio(it,b,x);
137 BIO_free(b);
138 return(ret);
139 }
140#endif
141
142#define HEADER_SIZE 8
143static int asn1_d2i_read_bio(BIO *in, BUF_MEM **pb)
144 {
88 BUF_MEM *b; 145 BUF_MEM *b;
89 unsigned char *p; 146 unsigned char *p;
90 int i; 147 int i;
91 char *ret=NULL; 148 int ret=-1;
92 ASN1_CTX c; 149 ASN1_CTX c;
93 int want=HEADER_SIZE; 150 int want=HEADER_SIZE;
94 int eos=0; 151 int eos=0;
@@ -99,7 +156,7 @@ char *ASN1_d2i_bio(char *(*xnew)(), char *(*d2i)(), BIO *in,
99 if (b == NULL) 156 if (b == NULL)
100 { 157 {
101 ASN1err(ASN1_F_ASN1_D2I_BIO,ERR_R_MALLOC_FAILURE); 158 ASN1err(ASN1_F_ASN1_D2I_BIO,ERR_R_MALLOC_FAILURE);
102 return(NULL); 159 return -1;
103 } 160 }
104 161
105 ERR_clear_error(); 162 ERR_clear_error();
@@ -187,8 +244,8 @@ char *ASN1_d2i_bio(char *(*xnew)(), char *(*d2i)(), BIO *in,
187 } 244 }
188 } 245 }
189 246
190 p=(unsigned char *)b->data; 247 *pb = b;
191 ret=d2i(x,&p,off); 248 return off;
192err: 249err:
193 if (b != NULL) BUF_MEM_free(b); 250 if (b != NULL) BUF_MEM_free(b);
194 return(ret); 251 return(ret);
diff --git a/src/lib/libcrypto/asn1/a_digest.c b/src/lib/libcrypto/asn1/a_digest.c
index 8257b8639e..4931e222a0 100644
--- a/src/lib/libcrypto/asn1/a_digest.c
+++ b/src/lib/libcrypto/asn1/a_digest.c
@@ -69,10 +69,11 @@
69#include <openssl/buffer.h> 69#include <openssl/buffer.h>
70#include <openssl/x509.h> 70#include <openssl/x509.h>
71 71
72#ifndef NO_ASN1_OLD
73
72int ASN1_digest(int (*i2d)(), const EVP_MD *type, char *data, 74int ASN1_digest(int (*i2d)(), const EVP_MD *type, char *data,
73 unsigned char *md, unsigned int *len) 75 unsigned char *md, unsigned int *len)
74 { 76 {
75 EVP_MD_CTX ctx;
76 int i; 77 int i;
77 unsigned char *str,*p; 78 unsigned char *str,*p;
78 79
@@ -81,9 +82,24 @@ int ASN1_digest(int (*i2d)(), const EVP_MD *type, char *data,
81 p=str; 82 p=str;
82 i2d(data,&p); 83 i2d(data,&p);
83 84
84 EVP_DigestInit(&ctx,type); 85 EVP_Digest(str, i, md, len, type, NULL);
85 EVP_DigestUpdate(&ctx,str,i); 86 OPENSSL_free(str);
86 EVP_DigestFinal(&ctx,md,len); 87 return(1);
88 }
89
90#endif
91
92
93int ASN1_item_digest(const ASN1_ITEM *it, const EVP_MD *type, void *asn,
94 unsigned char *md, unsigned int *len)
95 {
96 int i;
97 unsigned char *str = NULL;
98
99 i=ASN1_item_i2d(asn,&str, it);
100 if (!str) return(0);
101
102 EVP_Digest(str, i, md, len, type, NULL);
87 OPENSSL_free(str); 103 OPENSSL_free(str);
88 return(1); 104 return(1);
89 } 105 }
diff --git a/src/lib/libcrypto/asn1/a_dup.c b/src/lib/libcrypto/asn1/a_dup.c
index c3bda58a5d..58a017884c 100644
--- a/src/lib/libcrypto/asn1/a_dup.c
+++ b/src/lib/libcrypto/asn1/a_dup.c
@@ -58,9 +58,9 @@
58 58
59#include <stdio.h> 59#include <stdio.h>
60#include "cryptlib.h" 60#include "cryptlib.h"
61#include <openssl/asn1_mac.h> 61#include <openssl/asn1.h>
62 62
63#define READ_CHUNK 2048 63#ifndef NO_OLD_ASN1
64 64
65char *ASN1_dup(int (*i2d)(), char *(*d2i)(), char *x) 65char *ASN1_dup(int (*i2d)(), char *(*d2i)(), char *x)
66 { 66 {
@@ -81,3 +81,27 @@ char *ASN1_dup(int (*i2d)(), char *(*d2i)(), char *x)
81 OPENSSL_free(b); 81 OPENSSL_free(b);
82 return(ret); 82 return(ret);
83 } 83 }
84
85#endif
86
87/* ASN1_ITEM version of dup: this follows the model above except we don't need
88 * to allocate the buffer. At some point this could be rewritten to directly dup
89 * the underlying structure instead of doing and encode and decode.
90 */
91
92void *ASN1_item_dup(const ASN1_ITEM *it, void *x)
93 {
94 unsigned char *b = NULL, *p;
95 long i;
96 void *ret;
97
98 if (x == NULL) return(NULL);
99
100 i=ASN1_item_i2d(x,&b,it);
101 if (b == NULL)
102 { ASN1err(ASN1_F_ASN1_DUP,ERR_R_MALLOC_FAILURE); return(NULL); }
103 p= b;
104 ret=ASN1_item_d2i(NULL,&p,i, it);
105 OPENSSL_free(b);
106 return(ret);
107 }
diff --git a/src/lib/libcrypto/asn1/a_enum.c b/src/lib/libcrypto/asn1/a_enum.c
index 1428d1df7a..8a315fa371 100644
--- a/src/lib/libcrypto/asn1/a_enum.c
+++ b/src/lib/libcrypto/asn1/a_enum.c
@@ -65,60 +65,6 @@
65 * for comments on encoding see a_int.c 65 * for comments on encoding see a_int.c
66 */ 66 */
67 67
68ASN1_ENUMERATED *ASN1_ENUMERATED_new(void)
69{ return M_ASN1_ENUMERATED_new(); }
70
71void ASN1_ENUMERATED_free(ASN1_ENUMERATED *x)
72{ M_ASN1_ENUMERATED_free(x); }
73
74
75int i2d_ASN1_ENUMERATED(ASN1_ENUMERATED *a, unsigned char **pp)
76{
77 int len, ret;
78 if(!a) return 0;
79 len = i2c_ASN1_INTEGER(a, NULL);
80 ret=ASN1_object_size(0,len,V_ASN1_ENUMERATED);
81 if(pp) {
82 ASN1_put_object(pp,0,len,V_ASN1_ENUMERATED,V_ASN1_UNIVERSAL);
83 i2c_ASN1_INTEGER(a, pp);
84 }
85 return ret;
86}
87
88ASN1_ENUMERATED *d2i_ASN1_ENUMERATED(ASN1_ENUMERATED **a, unsigned char **pp,
89 long length)
90{
91 unsigned char *p;
92 long len;
93 int i;
94 int inf,tag,xclass;
95 ASN1_ENUMERATED *ret;
96
97 p= *pp;
98 inf=ASN1_get_object(&p,&len,&tag,&xclass,length);
99 if (inf & 0x80)
100 {
101 i=ASN1_R_BAD_OBJECT_HEADER;
102 goto err;
103 }
104
105 if (tag != V_ASN1_ENUMERATED)
106 {
107 i=ASN1_R_EXPECTING_AN_ENUMERATED;
108 goto err;
109 }
110 ret = c2i_ASN1_INTEGER(a, &p, len);
111 if(ret) {
112 ret->type = (V_ASN1_NEG & ret->type) | V_ASN1_ENUMERATED;
113 *pp = p;
114 }
115 return ret;
116err:
117 ASN1err(ASN1_F_D2I_ASN1_ENUMERATED,i);
118 return(NULL);
119
120}
121
122int ASN1_ENUMERATED_set(ASN1_ENUMERATED *a, long v) 68int ASN1_ENUMERATED_set(ASN1_ENUMERATED *a, long v)
123 { 69 {
124 int i,j,k; 70 int i,j,k;
@@ -168,7 +114,7 @@ long ASN1_ENUMERATED_get(ASN1_ENUMERATED *a)
168 if (i == V_ASN1_NEG_ENUMERATED) 114 if (i == V_ASN1_NEG_ENUMERATED)
169 neg=1; 115 neg=1;
170 else if (i != V_ASN1_ENUMERATED) 116 else if (i != V_ASN1_ENUMERATED)
171 return(0); 117 return -1;
172 118
173 if (a->length > sizeof(long)) 119 if (a->length > sizeof(long))
174 { 120 {
@@ -176,7 +122,7 @@ long ASN1_ENUMERATED_get(ASN1_ENUMERATED *a)
176 return(0xffffffffL); 122 return(0xffffffffL);
177 } 123 }
178 if (a->data == NULL) 124 if (a->data == NULL)
179 return(0); 125 return 0;
180 126
181 for (i=0; i<a->length; i++) 127 for (i=0; i<a->length; i++)
182 { 128 {
diff --git a/src/lib/libcrypto/asn1/a_gentm.c b/src/lib/libcrypto/asn1/a_gentm.c
index 314479a03d..cd09f68b38 100644
--- a/src/lib/libcrypto/asn1/a_gentm.c
+++ b/src/lib/libcrypto/asn1/a_gentm.c
@@ -61,13 +61,10 @@
61#include <stdio.h> 61#include <stdio.h>
62#include <time.h> 62#include <time.h>
63#include "cryptlib.h" 63#include "cryptlib.h"
64#include "o_time.h"
64#include <openssl/asn1.h> 65#include <openssl/asn1.h>
65 66
66ASN1_GENERALIZEDTIME *ASN1_GENERALIZEDTIME_new(void) 67#if 0
67{ return M_ASN1_GENERALIZEDTIME_new(); }
68
69void ASN1_GENERALIZEDTIME_free(ASN1_GENERALIZEDTIME *x)
70{ M_ASN1_GENERALIZEDTIME_free(x); }
71 68
72int i2d_ASN1_GENERALIZEDTIME(ASN1_GENERALIZEDTIME *a, unsigned char **pp) 69int i2d_ASN1_GENERALIZEDTIME(ASN1_GENERALIZEDTIME *a, unsigned char **pp)
73 { 70 {
@@ -116,6 +113,8 @@ err:
116 return(NULL); 113 return(NULL);
117 } 114 }
118 115
116#endif
117
119int ASN1_GENERALIZEDTIME_check(ASN1_GENERALIZEDTIME *d) 118int ASN1_GENERALIZEDTIME_check(ASN1_GENERALIZEDTIME *d)
120 { 119 {
121 static int min[9]={ 0, 0, 1, 1, 0, 0, 0, 0, 0}; 120 static int min[9]={ 0, 0, 1, 1, 0, 0, 0, 0, 0};
@@ -147,6 +146,19 @@ int ASN1_GENERALIZEDTIME_check(ASN1_GENERALIZEDTIME *d)
147 146
148 if ((n < min[i]) || (n > max[i])) goto err; 147 if ((n < min[i]) || (n > max[i])) goto err;
149 } 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
150 if (a[o] == 'Z') 162 if (a[o] == 'Z')
151 o++; 163 o++;
152 else if ((a[o] == '+') || (a[o] == '-')) 164 else if ((a[o] == '+') || (a[o] == '-'))
@@ -182,6 +194,7 @@ int ASN1_GENERALIZEDTIME_set_string(ASN1_GENERALIZEDTIME *s, char *str)
182 { 194 {
183 ASN1_STRING_set((ASN1_STRING *)s, 195 ASN1_STRING_set((ASN1_STRING *)s,
184 (unsigned char *)str,t.length); 196 (unsigned char *)str,t.length);
197 s->type=V_ASN1_GENERALIZEDTIME;
185 } 198 }
186 return(1); 199 return(1);
187 } 200 }
@@ -194,21 +207,17 @@ ASN1_GENERALIZEDTIME *ASN1_GENERALIZEDTIME_set(ASN1_GENERALIZEDTIME *s,
194 { 207 {
195 char *p; 208 char *p;
196 struct tm *ts; 209 struct tm *ts;
197#if defined(THREADS) && !defined(WIN32)
198 struct tm data; 210 struct tm data;
199#endif
200 211
201 if (s == NULL) 212 if (s == NULL)
202 s=M_ASN1_GENERALIZEDTIME_new(); 213 s=M_ASN1_GENERALIZEDTIME_new();
203 if (s == NULL) 214 if (s == NULL)
204 return(NULL); 215 return(NULL);
205 216
206#if defined(THREADS) && !defined(WIN32) 217 ts=OPENSSL_gmtime(&t, &data);
207 gmtime_r(&t,&data); /* should return &data, but doesn't on some systems, so we don't even look at the return value */ 218 if (ts == NULL)
208 ts=&data; 219 return(NULL);
209#else 220
210 ts=gmtime(&t);
211#endif
212 p=(char *)s->data; 221 p=(char *)s->data;
213 if ((p == NULL) || (s->length < 16)) 222 if ((p == NULL) || (s->length < 16))
214 { 223 {
diff --git a/src/lib/libcrypto/asn1/a_i2d_fp.c b/src/lib/libcrypto/asn1/a_i2d_fp.c
index aee29a7790..f4f1b73ebe 100644
--- a/src/lib/libcrypto/asn1/a_i2d_fp.c
+++ b/src/lib/libcrypto/asn1/a_i2d_fp.c
@@ -59,9 +59,11 @@
59#include <stdio.h> 59#include <stdio.h>
60#include "cryptlib.h" 60#include "cryptlib.h"
61#include <openssl/buffer.h> 61#include <openssl/buffer.h>
62#include <openssl/asn1_mac.h> 62#include <openssl/asn1.h>
63 63
64#ifndef NO_FP_API 64#ifndef NO_OLD_ASN1
65
66#ifndef OPENSSL_NO_FP_API
65int ASN1_i2d_fp(int (*i2d)(), FILE *out, unsigned char *x) 67int ASN1_i2d_fp(int (*i2d)(), FILE *out, unsigned char *x)
66 { 68 {
67 BIO *b; 69 BIO *b;
@@ -111,3 +113,51 @@ int ASN1_i2d_bio(int (*i2d)(), BIO *out, unsigned char *x)
111 OPENSSL_free(b); 113 OPENSSL_free(b);
112 return(ret); 114 return(ret);
113 } 115 }
116
117#endif
118
119#ifndef OPENSSL_NO_FP_API
120int ASN1_item_i2d_fp(const ASN1_ITEM *it, FILE *out, void *x)
121 {
122 BIO *b;
123 int ret;
124
125 if ((b=BIO_new(BIO_s_file())) == NULL)
126 {
127 ASN1err(ASN1_F_ASN1_I2D_FP,ERR_R_BUF_LIB);
128 return(0);
129 }
130 BIO_set_fp(b,out,BIO_NOCLOSE);
131 ret=ASN1_item_i2d_bio(it,b,x);
132 BIO_free(b);
133 return(ret);
134 }
135#endif
136
137int ASN1_item_i2d_bio(const ASN1_ITEM *it, BIO *out, void *x)
138 {
139 unsigned char *b = NULL;
140 int i,j=0,n,ret=1;
141
142 n = ASN1_item_i2d(x, &b, it);
143 if (b == NULL)
144 {
145 ASN1err(ASN1_F_ASN1_I2D_BIO,ERR_R_MALLOC_FAILURE);
146 return(0);
147 }
148
149 for (;;)
150 {
151 i=BIO_write(out,&(b[j]),n);
152 if (i == n) break;
153 if (i <= 0)
154 {
155 ret=0;
156 break;
157 }
158 j+=i;
159 n-=i;
160 }
161 OPENSSL_free(b);
162 return(ret);
163 }
diff --git a/src/lib/libcrypto/asn1/a_int.c b/src/lib/libcrypto/asn1/a_int.c
index 6f0413f885..496704b9a5 100644
--- a/src/lib/libcrypto/asn1/a_int.c
+++ b/src/lib/libcrypto/asn1/a_int.c
@@ -60,33 +60,12 @@
60#include "cryptlib.h" 60#include "cryptlib.h"
61#include <openssl/asn1.h> 61#include <openssl/asn1.h>
62 62
63ASN1_INTEGER *ASN1_INTEGER_new(void)
64{ return M_ASN1_INTEGER_new();}
65
66void ASN1_INTEGER_free(ASN1_INTEGER *x)
67{ M_ASN1_INTEGER_free(x);}
68
69ASN1_INTEGER *ASN1_INTEGER_dup(ASN1_INTEGER *x) 63ASN1_INTEGER *ASN1_INTEGER_dup(ASN1_INTEGER *x)
70{ return M_ASN1_INTEGER_dup(x);} 64{ return M_ASN1_INTEGER_dup(x);}
71 65
72int ASN1_INTEGER_cmp(ASN1_INTEGER *x, ASN1_INTEGER *y) 66int ASN1_INTEGER_cmp(ASN1_INTEGER *x, ASN1_INTEGER *y)
73{ return M_ASN1_INTEGER_cmp(x,y);} 67{ return M_ASN1_INTEGER_cmp(x,y);}
74 68
75/* Output ASN1 INTEGER including tag+length */
76
77int i2d_ASN1_INTEGER(ASN1_INTEGER *a, unsigned char **pp)
78{
79 int len, ret;
80 if(!a) return 0;
81 len = i2c_ASN1_INTEGER(a, NULL);
82 ret=ASN1_object_size(0,len,V_ASN1_INTEGER);
83 if(pp) {
84 ASN1_put_object(pp,0,len,V_ASN1_INTEGER,V_ASN1_UNIVERSAL);
85 i2c_ASN1_INTEGER(a, pp);
86 }
87 return ret;
88}
89
90/* 69/*
91 * This converts an ASN1 INTEGER into its content encoding. 70 * This converts an ASN1 INTEGER into its content encoding.
92 * The internal representation is an ASN1_STRING whose data is a big endian 71 * The internal representation is an ASN1_STRING whose data is a big endian
@@ -174,39 +153,6 @@ int i2c_ASN1_INTEGER(ASN1_INTEGER *a, unsigned char **pp)
174 return(ret); 153 return(ret);
175 } 154 }
176 155
177/* Convert DER encoded ASN1 INTEGER to ASN1_INTEGER structure */
178ASN1_INTEGER *d2i_ASN1_INTEGER(ASN1_INTEGER **a, unsigned char **pp,
179 long length)
180{
181 unsigned char *p;
182 long len;
183 int i;
184 int inf,tag,xclass;
185 ASN1_INTEGER *ret;
186
187 p= *pp;
188 inf=ASN1_get_object(&p,&len,&tag,&xclass,length);
189 if (inf & 0x80)
190 {
191 i=ASN1_R_BAD_OBJECT_HEADER;
192 goto err;
193 }
194
195 if (tag != V_ASN1_INTEGER)
196 {
197 i=ASN1_R_EXPECTING_AN_INTEGER;
198 goto err;
199 }
200 ret = c2i_ASN1_INTEGER(a, &p, len);
201 if(ret) *pp = p;
202 return ret;
203err:
204 ASN1err(ASN1_F_D2I_ASN1_INTEGER,i);
205 return(NULL);
206
207}
208
209
210/* Convert just ASN1 INTEGER content octets to ASN1_INTEGER structure */ 156/* Convert just ASN1 INTEGER content octets to ASN1_INTEGER structure */
211 157
212ASN1_INTEGER *c2i_ASN1_INTEGER(ASN1_INTEGER **a, unsigned char **pp, 158ASN1_INTEGER *c2i_ASN1_INTEGER(ASN1_INTEGER **a, unsigned char **pp,
@@ -414,7 +360,7 @@ long ASN1_INTEGER_get(ASN1_INTEGER *a)
414 if (i == V_ASN1_NEG_INTEGER) 360 if (i == V_ASN1_NEG_INTEGER)
415 neg=1; 361 neg=1;
416 else if (i != V_ASN1_INTEGER) 362 else if (i != V_ASN1_INTEGER)
417 return(0); 363 return -1;
418 364
419 if (a->length > sizeof(long)) 365 if (a->length > sizeof(long))
420 { 366 {
@@ -422,7 +368,7 @@ long ASN1_INTEGER_get(ASN1_INTEGER *a)
422 return(0xffffffffL); 368 return(0xffffffffL);
423 } 369 }
424 if (a->data == NULL) 370 if (a->data == NULL)
425 return(0); 371 return 0;
426 372
427 for (i=0; i<a->length; i++) 373 for (i=0; i<a->length; i++)
428 { 374 {
@@ -453,6 +399,12 @@ ASN1_INTEGER *BN_to_ASN1_INTEGER(BIGNUM *bn, ASN1_INTEGER *ai)
453 len=((j == 0)?0:((j/8)+1)); 399 len=((j == 0)?0:((j/8)+1));
454 ret->data=(unsigned char *)OPENSSL_malloc(len+4); 400 ret->data=(unsigned char *)OPENSSL_malloc(len+4);
455 ret->length=BN_bn2bin(bn,ret->data); 401 ret->length=BN_bn2bin(bn,ret->data);
402 /* Correct zero case */
403 if(!ret->length)
404 {
405 ret->data[0] = 0;
406 ret->length = 1;
407 }
456 return(ret); 408 return(ret);
457err: 409err:
458 if (ret != ai) M_ASN1_INTEGER_free(ret); 410 if (ret != ai) M_ASN1_INTEGER_free(ret);
diff --git a/src/lib/libcrypto/asn1/a_object.c b/src/lib/libcrypto/asn1/a_object.c
index 20caa2d3bd..71ce7c3896 100644
--- a/src/lib/libcrypto/asn1/a_object.c
+++ b/src/lib/libcrypto/asn1/a_object.c
@@ -302,7 +302,7 @@ void ASN1_OBJECT_free(ASN1_OBJECT *a)
302 } 302 }
303 303
304ASN1_OBJECT *ASN1_OBJECT_create(int nid, unsigned char *data, int len, 304ASN1_OBJECT *ASN1_OBJECT_create(int nid, unsigned char *data, int len,
305 char *sn, char *ln) 305 const char *sn, const char *ln)
306 { 306 {
307 ASN1_OBJECT o; 307 ASN1_OBJECT o;
308 308
diff --git a/src/lib/libcrypto/asn1/a_octet.c b/src/lib/libcrypto/asn1/a_octet.c
index 2586f4327d..9690bae0f1 100644
--- a/src/lib/libcrypto/asn1/a_octet.c
+++ b/src/lib/libcrypto/asn1/a_octet.c
@@ -60,12 +60,6 @@
60#include "cryptlib.h" 60#include "cryptlib.h"
61#include <openssl/asn1.h> 61#include <openssl/asn1.h>
62 62
63ASN1_OCTET_STRING *ASN1_OCTET_STRING_new(void)
64{ return M_ASN1_OCTET_STRING_new(); }
65
66void ASN1_OCTET_STRING_free(ASN1_OCTET_STRING *x)
67{ M_ASN1_OCTET_STRING_free(x); }
68
69ASN1_OCTET_STRING *ASN1_OCTET_STRING_dup(ASN1_OCTET_STRING *x) 63ASN1_OCTET_STRING *ASN1_OCTET_STRING_dup(ASN1_OCTET_STRING *x)
70{ return M_ASN1_OCTET_STRING_dup(x); } 64{ return M_ASN1_OCTET_STRING_dup(x); }
71 65
@@ -75,21 +69,3 @@ int ASN1_OCTET_STRING_cmp(ASN1_OCTET_STRING *a, ASN1_OCTET_STRING *b)
75int ASN1_OCTET_STRING_set(ASN1_OCTET_STRING *x, unsigned char *d, int len) 69int ASN1_OCTET_STRING_set(ASN1_OCTET_STRING *x, unsigned char *d, int len)
76{ return M_ASN1_OCTET_STRING_set(x, d, len); } 70{ return M_ASN1_OCTET_STRING_set(x, d, len); }
77 71
78int i2d_ASN1_OCTET_STRING(ASN1_OCTET_STRING *a, unsigned char **pp)
79{ return M_i2d_ASN1_OCTET_STRING(a, pp); }
80
81ASN1_OCTET_STRING *d2i_ASN1_OCTET_STRING(ASN1_OCTET_STRING **a,
82 unsigned char **pp, long length)
83 {
84 ASN1_OCTET_STRING *ret=NULL;
85
86 ret=(ASN1_OCTET_STRING *)d2i_ASN1_bytes((ASN1_STRING **)a,
87 pp,length,V_ASN1_OCTET_STRING,V_ASN1_UNIVERSAL);
88 if (ret == NULL)
89 {
90 ASN1err(ASN1_F_D2I_ASN1_OCTET_STRING,ERR_R_NESTED_ASN1_ERROR);
91 return(NULL);
92 }
93 return(ret);
94 }
95
diff --git a/src/lib/libcrypto/asn1/a_print.c b/src/lib/libcrypto/asn1/a_print.c
index b7bd2bd18a..8035513f04 100644
--- a/src/lib/libcrypto/asn1/a_print.c
+++ b/src/lib/libcrypto/asn1/a_print.c
@@ -60,50 +60,6 @@
60#include "cryptlib.h" 60#include "cryptlib.h"
61#include <openssl/asn1.h> 61#include <openssl/asn1.h>
62 62
63ASN1_IA5STRING *ASN1_IA5STRING_new(void)
64{ return M_ASN1_IA5STRING_new();}
65
66void ASN1_IA5STRING_free(ASN1_IA5STRING *x)
67{ M_ASN1_IA5STRING_free(x);}
68
69int i2d_ASN1_IA5STRING(ASN1_IA5STRING *a, unsigned char **pp)
70 { return(M_i2d_ASN1_IA5STRING(a,pp)); }
71
72ASN1_IA5STRING *d2i_ASN1_IA5STRING(ASN1_IA5STRING **a, unsigned char **pp,
73 long l)
74 { return(M_d2i_ASN1_IA5STRING(a,pp,l)); }
75
76ASN1_T61STRING *ASN1_T61STRING_new(void)
77{ return M_ASN1_T61STRING_new();}
78
79void ASN1_T61STRING_free(ASN1_T61STRING *x)
80{ M_ASN1_T61STRING_free(x);}
81
82ASN1_T61STRING *d2i_ASN1_T61STRING(ASN1_T61STRING **a, unsigned char **pp,
83 long l)
84 { return(M_d2i_ASN1_T61STRING(a,pp,l)); }
85
86ASN1_PRINTABLESTRING *ASN1_PRINTABLESTRING_new(void)
87{ return M_ASN1_PRINTABLESTRING_new();}
88
89void ASN1_PRINTABLESTRING_free(ASN1_PRINTABLESTRING *x)
90{ M_ASN1_PRINTABLESTRING_free(x);}
91
92ASN1_PRINTABLESTRING *d2i_ASN1_PRINTABLESTRING(ASN1_PRINTABLESTRING **a,
93 unsigned char **pp, long l)
94 { return(M_d2i_ASN1_PRINTABLESTRING(a,pp,
95 l)); }
96
97int i2d_ASN1_PRINTABLESTRING(ASN1_PRINTABLESTRING *a, unsigned char **pp)
98 { return(M_i2d_ASN1_PRINTABLESTRING(a,pp)); }
99
100int i2d_ASN1_PRINTABLE(ASN1_STRING *a, unsigned char **pp)
101 { return(M_i2d_ASN1_PRINTABLE(a,pp)); }
102
103ASN1_STRING *d2i_ASN1_PRINTABLE(ASN1_STRING **a, unsigned char **pp,
104 long l)
105 { return(M_d2i_ASN1_PRINTABLE(a,pp,l)); }
106
107int ASN1_PRINTABLE_type(unsigned char *s, int len) 63int ASN1_PRINTABLE_type(unsigned char *s, int len)
108 { 64 {
109 int c; 65 int c;
@@ -169,29 +125,3 @@ int ASN1_UNIVERSALSTRING_to_string(ASN1_UNIVERSALSTRING *s)
169 s->type=ASN1_PRINTABLE_type(s->data,s->length); 125 s->type=ASN1_PRINTABLE_type(s->data,s->length);
170 return(1); 126 return(1);
171 } 127 }
172
173ASN1_STRING *DIRECTORYSTRING_new(void)
174{ return M_DIRECTORYSTRING_new();}
175
176void DIRECTORYSTRING_free(ASN1_STRING *x)
177{ M_DIRECTORYSTRING_free(x);}
178
179int i2d_DIRECTORYSTRING(ASN1_STRING *a, unsigned char **pp)
180 { return(M_i2d_DIRECTORYSTRING(a,pp)); }
181
182ASN1_STRING *d2i_DIRECTORYSTRING(ASN1_STRING **a, unsigned char **pp,
183 long l)
184 { return(M_d2i_DIRECTORYSTRING(a,pp,l)); }
185
186ASN1_STRING *DISPLAYTEXT_new(void)
187{ return M_DISPLAYTEXT_new();}
188
189void DISPLAYTEXT_free(ASN1_STRING *x)
190{ M_DISPLAYTEXT_free(x);}
191
192int i2d_DISPLAYTEXT(ASN1_STRING *a, unsigned char **pp)
193 { return(M_i2d_DISPLAYTEXT(a,pp)); }
194
195ASN1_STRING *d2i_DISPLAYTEXT(ASN1_STRING **a, unsigned char **pp,
196 long l)
197 { return(M_d2i_DISPLAYTEXT(a,pp,l)); }
diff --git a/src/lib/libcrypto/asn1/a_set.c b/src/lib/libcrypto/asn1/a_set.c
index caf5a1419c..19bb60fca8 100644
--- a/src/lib/libcrypto/asn1/a_set.c
+++ b/src/lib/libcrypto/asn1/a_set.c
@@ -60,6 +60,8 @@
60#include "cryptlib.h" 60#include "cryptlib.h"
61#include <openssl/asn1_mac.h> 61#include <openssl/asn1_mac.h>
62 62
63#ifndef NO_ASN1_OLD
64
63typedef struct 65typedef struct
64 { 66 {
65 unsigned char *pbData; 67 unsigned char *pbData;
@@ -215,3 +217,4 @@ err:
215 return(NULL); 217 return(NULL);
216 } 218 }
217 219
220#endif
diff --git a/src/lib/libcrypto/asn1/a_sign.c b/src/lib/libcrypto/asn1/a_sign.c
index 4c651706d2..de53b44144 100644
--- a/src/lib/libcrypto/asn1/a_sign.c
+++ b/src/lib/libcrypto/asn1/a_sign.c
@@ -55,6 +55,59 @@
55 * copied and put under another distribution licence 55 * copied and put under another distribution licence
56 * [including the GNU Public Licence.] 56 * [including the GNU Public Licence.]
57 */ 57 */
58/* ====================================================================
59 * Copyright (c) 1998-2002 The OpenSSL Project. All rights reserved.
60 *
61 * Redistribution and use in source and binary forms, with or without
62 * modification, are permitted provided that the following conditions
63 * are met:
64 *
65 * 1. Redistributions of source code must retain the above copyright
66 * notice, this list of conditions and the following disclaimer.
67 *
68 * 2. Redistributions in binary form must reproduce the above copyright
69 * notice, this list of conditions and the following disclaimer in
70 * the documentation and/or other materials provided with the
71 * distribution.
72 *
73 * 3. All advertising materials mentioning features or use of this
74 * software must display the following acknowledgment:
75 * "This product includes software developed by the OpenSSL Project
76 * for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
77 *
78 * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
79 * endorse or promote products derived from this software without
80 * prior written permission. For written permission, please contact
81 * openssl-core@openssl.org.
82 *
83 * 5. Products derived from this software may not be called "OpenSSL"
84 * nor may "OpenSSL" appear in their names without prior written
85 * permission of the OpenSSL Project.
86 *
87 * 6. Redistributions of any form whatsoever must retain the following
88 * acknowledgment:
89 * "This product includes software developed by the OpenSSL Project
90 * for use in the OpenSSL Toolkit (http://www.openssl.org/)"
91 *
92 * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
93 * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
94 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
95 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
96 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
97 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
98 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
99 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
100 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
101 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
102 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
103 * OF THE POSSIBILITY OF SUCH DAMAGE.
104 * ====================================================================
105 *
106 * This product includes cryptographic software written by Eric Young
107 * (eay@cryptsoft.com). This product includes software written by Tim
108 * Hudson (tjh@cryptsoft.com).
109 *
110 */
58 111
59#include <stdio.h> 112#include <stdio.h>
60#include <time.h> 113#include <time.h>
@@ -71,6 +124,8 @@
71#include <openssl/objects.h> 124#include <openssl/objects.h>
72#include <openssl/buffer.h> 125#include <openssl/buffer.h>
73 126
127#ifndef NO_ASN1_OLD
128
74int ASN1_sign(int (*i2d)(), X509_ALGOR *algor1, X509_ALGOR *algor2, 129int ASN1_sign(int (*i2d)(), X509_ALGOR *algor1, X509_ALGOR *algor2,
75 ASN1_BIT_STRING *signature, char *data, EVP_PKEY *pkey, 130 ASN1_BIT_STRING *signature, char *data, EVP_PKEY *pkey,
76 const EVP_MD *type) 131 const EVP_MD *type)
@@ -80,6 +135,7 @@ int ASN1_sign(int (*i2d)(), X509_ALGOR *algor1, X509_ALGOR *algor2,
80 int i,inl=0,outl=0,outll=0; 135 int i,inl=0,outl=0,outll=0;
81 X509_ALGOR *a; 136 X509_ALGOR *a;
82 137
138 EVP_MD_CTX_init(&ctx);
83 for (i=0; i<2; i++) 139 for (i=0; i<2; i++)
84 { 140 {
85 if (i == 0) 141 if (i == 0)
@@ -87,7 +143,14 @@ int ASN1_sign(int (*i2d)(), X509_ALGOR *algor1, X509_ALGOR *algor2,
87 else 143 else
88 a=algor2; 144 a=algor2;
89 if (a == NULL) continue; 145 if (a == NULL) continue;
90 if ( (a->parameter == NULL) || 146 if (type->pkey_type == NID_dsaWithSHA1)
147 {
148 /* special case: RFC 2459 tells us to omit 'parameters'
149 * with id-dsa-with-sha1 */
150 ASN1_TYPE_free(a->parameter);
151 a->parameter = NULL;
152 }
153 else if ((a->parameter == NULL) ||
91 (a->parameter->type != V_ASN1_NULL)) 154 (a->parameter->type != V_ASN1_NULL))
92 { 155 {
93 ASN1_TYPE_free(a->parameter); 156 ASN1_TYPE_free(a->parameter);
@@ -120,7 +183,90 @@ int ASN1_sign(int (*i2d)(), X509_ALGOR *algor1, X509_ALGOR *algor2,
120 p=buf_in; 183 p=buf_in;
121 184
122 i2d(data,&p); 185 i2d(data,&p);
123 EVP_SignInit(&ctx,type); 186 EVP_SignInit_ex(&ctx,type, NULL);
187 EVP_SignUpdate(&ctx,(unsigned char *)buf_in,inl);
188 if (!EVP_SignFinal(&ctx,(unsigned char *)buf_out,
189 (unsigned int *)&outl,pkey))
190 {
191 outl=0;
192 ASN1err(ASN1_F_ASN1_SIGN,ERR_R_EVP_LIB);
193 goto err;
194 }
195 if (signature->data != NULL) OPENSSL_free(signature->data);
196 signature->data=buf_out;
197 buf_out=NULL;
198 signature->length=outl;
199 /* In the interests of compatibility, I'll make sure that
200 * the bit string has a 'not-used bits' value of 0
201 */
202 signature->flags&= ~(ASN1_STRING_FLAG_BITS_LEFT|0x07);
203 signature->flags|=ASN1_STRING_FLAG_BITS_LEFT;
204err:
205 EVP_MD_CTX_cleanup(&ctx);
206 if (buf_in != NULL)
207 { memset((char *)buf_in,0,(unsigned int)inl); OPENSSL_free(buf_in); }
208 if (buf_out != NULL)
209 { memset((char *)buf_out,0,outll); OPENSSL_free(buf_out); }
210 return(outl);
211 }
212
213#endif
214
215int ASN1_item_sign(const ASN1_ITEM *it, X509_ALGOR *algor1, X509_ALGOR *algor2,
216 ASN1_BIT_STRING *signature, void *asn, EVP_PKEY *pkey,
217 const EVP_MD *type)
218 {
219 EVP_MD_CTX ctx;
220 unsigned char *buf_in=NULL,*buf_out=NULL;
221 int i,inl=0,outl=0,outll=0;
222 X509_ALGOR *a;
223
224 EVP_MD_CTX_init(&ctx);
225 for (i=0; i<2; i++)
226 {
227 if (i == 0)
228 a=algor1;
229 else
230 a=algor2;
231 if (a == NULL) continue;
232 if (type->pkey_type == NID_dsaWithSHA1)
233 {
234 /* special case: RFC 2459 tells us to omit 'parameters'
235 * with id-dsa-with-sha1 */
236 ASN1_TYPE_free(a->parameter);
237 a->parameter = NULL;
238 }
239 else if ((a->parameter == NULL) ||
240 (a->parameter->type != V_ASN1_NULL))
241 {
242 ASN1_TYPE_free(a->parameter);
243 if ((a->parameter=ASN1_TYPE_new()) == NULL) goto err;
244 a->parameter->type=V_ASN1_NULL;
245 }
246 ASN1_OBJECT_free(a->algorithm);
247 a->algorithm=OBJ_nid2obj(type->pkey_type);
248 if (a->algorithm == NULL)
249 {
250 ASN1err(ASN1_F_ASN1_SIGN,ASN1_R_UNKNOWN_OBJECT_TYPE);
251 goto err;
252 }
253 if (a->algorithm->length == 0)
254 {
255 ASN1err(ASN1_F_ASN1_SIGN,ASN1_R_THE_ASN1_OBJECT_IDENTIFIER_IS_NOT_KNOWN_FOR_THIS_MD);
256 goto err;
257 }
258 }
259 inl=ASN1_item_i2d(asn,&buf_in, it);
260 outll=outl=EVP_PKEY_size(pkey);
261 buf_out=(unsigned char *)OPENSSL_malloc((unsigned int)outl);
262 if ((buf_in == NULL) || (buf_out == NULL))
263 {
264 outl=0;
265 ASN1err(ASN1_F_ASN1_SIGN,ERR_R_MALLOC_FAILURE);
266 goto err;
267 }
268
269 EVP_SignInit_ex(&ctx,type, NULL);
124 EVP_SignUpdate(&ctx,(unsigned char *)buf_in,inl); 270 EVP_SignUpdate(&ctx,(unsigned char *)buf_in,inl);
125 if (!EVP_SignFinal(&ctx,(unsigned char *)buf_out, 271 if (!EVP_SignFinal(&ctx,(unsigned char *)buf_out,
126 (unsigned int *)&outl,pkey)) 272 (unsigned int *)&outl,pkey))
@@ -139,7 +285,7 @@ int ASN1_sign(int (*i2d)(), X509_ALGOR *algor1, X509_ALGOR *algor2,
139 signature->flags&= ~(ASN1_STRING_FLAG_BITS_LEFT|0x07); 285 signature->flags&= ~(ASN1_STRING_FLAG_BITS_LEFT|0x07);
140 signature->flags|=ASN1_STRING_FLAG_BITS_LEFT; 286 signature->flags|=ASN1_STRING_FLAG_BITS_LEFT;
141err: 287err:
142 memset(&ctx,0,sizeof(ctx)); 288 EVP_MD_CTX_cleanup(&ctx);
143 if (buf_in != NULL) 289 if (buf_in != NULL)
144 { memset((char *)buf_in,0,(unsigned int)inl); OPENSSL_free(buf_in); } 290 { memset((char *)buf_in,0,(unsigned int)inl); OPENSSL_free(buf_in); }
145 if (buf_out != NULL) 291 if (buf_out != NULL)
diff --git a/src/lib/libcrypto/asn1/a_strex.c b/src/lib/libcrypto/asn1/a_strex.c
index 569b811998..128aa7e772 100644
--- a/src/lib/libcrypto/asn1/a_strex.c
+++ b/src/lib/libcrypto/asn1/a_strex.c
@@ -371,6 +371,8 @@ static int do_indent(char_io *io_ch, void *arg, int indent)
371 return 1; 371 return 1;
372} 372}
373 373
374#define FN_WIDTH_LN 25
375#define FN_WIDTH_SN 10
374 376
375static int do_name_ex(char_io *io_ch, void *arg, X509_NAME *n, 377static int do_name_ex(char_io *io_ch, void *arg, X509_NAME *n,
376 int indent, unsigned long flags) 378 int indent, unsigned long flags)
@@ -456,19 +458,29 @@ static int do_name_ex(char_io *io_ch, void *arg, X509_NAME *n,
456 val = X509_NAME_ENTRY_get_data(ent); 458 val = X509_NAME_ENTRY_get_data(ent);
457 fn_nid = OBJ_obj2nid(fn); 459 fn_nid = OBJ_obj2nid(fn);
458 if(fn_opt != XN_FLAG_FN_NONE) { 460 if(fn_opt != XN_FLAG_FN_NONE) {
459 int objlen; 461 int objlen, fld_len;
460 if((fn_opt == XN_FLAG_FN_OID) || (fn_nid==NID_undef) ) { 462 if((fn_opt == XN_FLAG_FN_OID) || (fn_nid==NID_undef) ) {
461 OBJ_obj2txt(objtmp, 80, fn, 1); 463 OBJ_obj2txt(objtmp, 80, fn, 1);
464 fld_len = 0; /* XXX: what should this be? */
462 objbuf = objtmp; 465 objbuf = objtmp;
463 } else { 466 } else {
464 if(fn_opt == XN_FLAG_FN_SN) 467 if(fn_opt == XN_FLAG_FN_SN) {
468 fld_len = FN_WIDTH_SN;
465 objbuf = OBJ_nid2sn(fn_nid); 469 objbuf = OBJ_nid2sn(fn_nid);
466 else if(fn_opt == XN_FLAG_FN_LN) 470 } else if(fn_opt == XN_FLAG_FN_LN) {
471 fld_len = FN_WIDTH_LN;
467 objbuf = OBJ_nid2ln(fn_nid); 472 objbuf = OBJ_nid2ln(fn_nid);
468 else objbuf = ""; 473 } else {
474 fld_len = 0; /* XXX: what should this be? */
475 objbuf = "";
476 }
469 } 477 }
470 objlen = strlen(objbuf); 478 objlen = strlen(objbuf);
471 if(!io_ch(arg, objbuf, objlen)) return -1; 479 if(!io_ch(arg, objbuf, objlen)) return -1;
480 if ((objlen < fld_len) && (flags & XN_FLAG_FN_ALIGN)) {
481 if (!do_indent(io_ch, arg, fld_len - objlen)) return -1;
482 outlen += fld_len - objlen;
483 }
472 if(!io_ch(arg, sep_eq, sep_eq_len)) return -1; 484 if(!io_ch(arg, sep_eq, sep_eq_len)) return -1;
473 outlen += objlen + sep_eq_len; 485 outlen += objlen + sep_eq_len;
474 } 486 }
@@ -491,12 +503,24 @@ static int do_name_ex(char_io *io_ch, void *arg, X509_NAME *n,
491 503
492int X509_NAME_print_ex(BIO *out, X509_NAME *nm, int indent, unsigned long flags) 504int X509_NAME_print_ex(BIO *out, X509_NAME *nm, int indent, unsigned long flags)
493{ 505{
506 if(flags == XN_FLAG_COMPAT)
507 return X509_NAME_print(out, nm, indent);
494 return do_name_ex(send_bio_chars, out, nm, indent, flags); 508 return do_name_ex(send_bio_chars, out, nm, indent, flags);
495} 509}
496 510
497 511
498int X509_NAME_print_ex_fp(FILE *fp, X509_NAME *nm, int indent, unsigned long flags) 512int X509_NAME_print_ex_fp(FILE *fp, X509_NAME *nm, int indent, unsigned long flags)
499{ 513{
514 if(flags == XN_FLAG_COMPAT)
515 {
516 BIO *btmp;
517 int ret;
518 btmp = BIO_new_fp(fp, BIO_NOCLOSE);
519 if(!btmp) return -1;
520 ret = X509_NAME_print(btmp, nm, indent);
521 BIO_free(btmp);
522 return ret;
523 }
500 return do_name_ex(send_fp_chars, fp, nm, indent, flags); 524 return do_name_ex(send_fp_chars, fp, nm, indent, flags);
501} 525}
502 526
diff --git a/src/lib/libcrypto/asn1/a_strnid.c b/src/lib/libcrypto/asn1/a_strnid.c
index 732e68fe46..04789d1c63 100644
--- a/src/lib/libcrypto/asn1/a_strnid.c
+++ b/src/lib/libcrypto/asn1/a_strnid.c
@@ -105,9 +105,9 @@ int ASN1_STRING_set_default_mask_asc(char *p)
105 mask = strtoul(p + 5, &end, 0); 105 mask = strtoul(p + 5, &end, 0);
106 if(*end) return 0; 106 if(*end) return 0;
107 } else if(!strcmp(p, "nombstr")) 107 } else if(!strcmp(p, "nombstr"))
108 mask = ~(B_ASN1_BMPSTRING|B_ASN1_UTF8STRING); 108 mask = ~((unsigned long)(B_ASN1_BMPSTRING|B_ASN1_UTF8STRING));
109 else if(!strcmp(p, "pkix")) 109 else if(!strcmp(p, "pkix"))
110 mask = ~B_ASN1_T61STRING; 110 mask = ~((unsigned long)B_ASN1_T61STRING);
111 else if(!strcmp(p, "utf8only")) mask = B_ASN1_UTF8STRING; 111 else if(!strcmp(p, "utf8only")) mask = B_ASN1_UTF8STRING;
112 else if(!strcmp(p, "default")) 112 else if(!strcmp(p, "default"))
113 mask = 0xFFFFFFFFL; 113 mask = 0xFFFFFFFFL;
@@ -170,8 +170,10 @@ static ASN1_STRING_TABLE tbl_standard[] = {
170{NID_givenName, 1, ub_name, DIRSTRING_TYPE, 0}, 170{NID_givenName, 1, ub_name, DIRSTRING_TYPE, 0},
171{NID_surname, 1, ub_name, DIRSTRING_TYPE, 0}, 171{NID_surname, 1, ub_name, DIRSTRING_TYPE, 0},
172{NID_initials, 1, ub_name, DIRSTRING_TYPE, 0}, 172{NID_initials, 1, ub_name, DIRSTRING_TYPE, 0},
173{NID_friendlyName, -1, -1, B_ASN1_BMPSTRING, STABLE_NO_MASK},
173{NID_name, 1, ub_name, DIRSTRING_TYPE, 0}, 174{NID_name, 1, ub_name, DIRSTRING_TYPE, 0},
174{NID_dnQualifier, -1, -1, B_ASN1_PRINTABLESTRING, STABLE_NO_MASK} 175{NID_dnQualifier, -1, -1, B_ASN1_PRINTABLESTRING, STABLE_NO_MASK},
176{NID_ms_csp_name, -1, -1, B_ASN1_BMPSTRING, STABLE_NO_MASK}
175}; 177};
176 178
177static int sk_table_cmp(const ASN1_STRING_TABLE * const *a, 179static int sk_table_cmp(const ASN1_STRING_TABLE * const *a,
diff --git a/src/lib/libcrypto/asn1/a_time.c b/src/lib/libcrypto/asn1/a_time.c
index 8c0ddee4ac..27ddd30899 100644
--- a/src/lib/libcrypto/asn1/a_time.c
+++ b/src/lib/libcrypto/asn1/a_time.c
@@ -64,14 +64,14 @@
64#include <stdio.h> 64#include <stdio.h>
65#include <time.h> 65#include <time.h>
66#include "cryptlib.h" 66#include "cryptlib.h"
67#include <openssl/asn1.h> 67#include "o_time.h"
68#include <openssl/asn1t.h>
68 69
69ASN1_TIME *ASN1_TIME_new(void) 70IMPLEMENT_ASN1_MSTRING(ASN1_TIME, B_ASN1_TIME)
70{ return M_ASN1_TIME_new(); }
71 71
72void ASN1_TIME_free(ASN1_TIME *x) 72IMPLEMENT_ASN1_FUNCTIONS(ASN1_TIME)
73{ M_ASN1_TIME_free(x); }
74 73
74#if 0
75int i2d_ASN1_TIME(ASN1_TIME *a, unsigned char **pp) 75int i2d_ASN1_TIME(ASN1_TIME *a, unsigned char **pp)
76 { 76 {
77#ifdef CHARSET_EBCDIC 77#ifdef CHARSET_EBCDIC
@@ -95,33 +95,64 @@ int i2d_ASN1_TIME(ASN1_TIME *a, unsigned char **pp)
95 ASN1err(ASN1_F_I2D_ASN1_TIME,ASN1_R_EXPECTING_A_TIME); 95 ASN1err(ASN1_F_I2D_ASN1_TIME,ASN1_R_EXPECTING_A_TIME);
96 return -1; 96 return -1;
97 } 97 }
98 98#endif
99
100ASN1_TIME *d2i_ASN1_TIME(ASN1_TIME **a, unsigned char **pp, long length)
101 {
102 unsigned char tag;
103 tag = **pp & ~V_ASN1_CONSTRUCTED;
104 if(tag == (V_ASN1_UTCTIME|V_ASN1_UNIVERSAL))
105 return d2i_ASN1_UTCTIME(a, pp, length);
106 if(tag == (V_ASN1_GENERALIZEDTIME|V_ASN1_UNIVERSAL))
107 return d2i_ASN1_GENERALIZEDTIME(a, pp, length);
108 ASN1err(ASN1_F_D2I_ASN1_TIME,ASN1_R_EXPECTING_A_TIME);
109 return(NULL);
110 }
111 99
112 100
113ASN1_TIME *ASN1_TIME_set(ASN1_TIME *s, time_t t) 101ASN1_TIME *ASN1_TIME_set(ASN1_TIME *s, time_t t)
114 { 102 {
115 struct tm *ts; 103 struct tm *ts;
116#if defined(THREADS) && !defined(WIN32) && !defined(__CYGWIN32__)
117 struct tm data; 104 struct tm data;
118 105
119 gmtime_r(&t,&data); 106 ts=OPENSSL_gmtime(&t,&data);
120 ts=&data; /* should return &data, but doesn't on some systems, so we don't even look at the return value */ 107 if (ts == NULL)
121#else 108 return NULL;
122 ts=gmtime(&t);
123#endif
124 if((ts->tm_year >= 50) && (ts->tm_year < 150)) 109 if((ts->tm_year >= 50) && (ts->tm_year < 150))
125 return ASN1_UTCTIME_set(s, t); 110 return ASN1_UTCTIME_set(s, t);
126 return ASN1_GENERALIZEDTIME_set(s,t); 111 return ASN1_GENERALIZEDTIME_set(s,t);
127 } 112 }
113
114int ASN1_TIME_check(ASN1_TIME *t)
115 {
116 if (t->type == V_ASN1_GENERALIZEDTIME)
117 return ASN1_GENERALIZEDTIME_check(t);
118 else if (t->type == V_ASN1_UTCTIME)
119 return ASN1_UTCTIME_check(t);
120 return 0;
121 }
122
123/* Convert an ASN1_TIME structure to GeneralizedTime */
124ASN1_GENERALIZEDTIME *ASN1_TIME_to_generalizedtime(ASN1_TIME *t, ASN1_GENERALIZEDTIME **out)
125 {
126 ASN1_GENERALIZEDTIME *ret;
127 char *str;
128
129 if (!ASN1_TIME_check(t)) return NULL;
130
131 if (!out || !*out)
132 {
133 if (!(ret = ASN1_GENERALIZEDTIME_new ()))
134 return NULL;
135 if (out) *out = ret;
136 }
137 else ret = *out;
138
139 /* If already GeneralizedTime just copy across */
140 if (t->type == V_ASN1_GENERALIZEDTIME)
141 {
142 if(!ASN1_STRING_set(ret, t->data, t->length))
143 return NULL;
144 return ret;
145 }
146
147 /* grow the string */
148 if (!ASN1_STRING_set(ret, NULL, t->length + 2))
149 return NULL;
150 str = (char *)ret->data;
151 /* Work out the century and prepend */
152 if (t->data[0] >= '5') strcpy(str, "19");
153 else strcpy(str, "20");
154
155 strcat(str, (char *)t->data);
156
157 return ret;
158 }
diff --git a/src/lib/libcrypto/asn1/a_type.c b/src/lib/libcrypto/asn1/a_type.c
index e72a6b29e0..96e111cf23 100644
--- a/src/lib/libcrypto/asn1/a_type.c
+++ b/src/lib/libcrypto/asn1/a_type.c
@@ -57,236 +57,8 @@
57 */ 57 */
58 58
59#include <stdio.h> 59#include <stdio.h>
60#include <openssl/asn1t.h>
60#include "cryptlib.h" 61#include "cryptlib.h"
61#include <openssl/asn1_mac.h>
62
63static void ASN1_TYPE_component_free(ASN1_TYPE *a);
64int i2d_ASN1_TYPE(ASN1_TYPE *a, unsigned char **pp)
65 {
66 int r=0;
67
68 if (a == NULL) return(0);
69
70 switch (a->type)
71 {
72 case V_ASN1_NULL:
73 if (pp != NULL)
74 ASN1_put_object(pp,0,0,V_ASN1_NULL,V_ASN1_UNIVERSAL);
75 r=2;
76 break;
77 case V_ASN1_INTEGER:
78 case V_ASN1_NEG_INTEGER:
79 r=i2d_ASN1_INTEGER(a->value.integer,pp);
80 break;
81 case V_ASN1_ENUMERATED:
82 case V_ASN1_NEG_ENUMERATED:
83 r=i2d_ASN1_ENUMERATED(a->value.enumerated,pp);
84 break;
85 case V_ASN1_BIT_STRING:
86 r=i2d_ASN1_BIT_STRING(a->value.bit_string,pp);
87 break;
88 case V_ASN1_OCTET_STRING:
89 r=i2d_ASN1_OCTET_STRING(a->value.octet_string,pp);
90 break;
91 case V_ASN1_OBJECT:
92 r=i2d_ASN1_OBJECT(a->value.object,pp);
93 break;
94 case V_ASN1_PRINTABLESTRING:
95 r=M_i2d_ASN1_PRINTABLESTRING(a->value.printablestring,pp);
96 break;
97 case V_ASN1_T61STRING:
98 r=M_i2d_ASN1_T61STRING(a->value.t61string,pp);
99 break;
100 case V_ASN1_IA5STRING:
101 r=M_i2d_ASN1_IA5STRING(a->value.ia5string,pp);
102 break;
103 case V_ASN1_GENERALSTRING:
104 r=M_i2d_ASN1_GENERALSTRING(a->value.generalstring,pp);
105 break;
106 case V_ASN1_UNIVERSALSTRING:
107 r=M_i2d_ASN1_UNIVERSALSTRING(a->value.universalstring,pp);
108 break;
109 case V_ASN1_UTF8STRING:
110 r=M_i2d_ASN1_UTF8STRING(a->value.utf8string,pp);
111 break;
112 case V_ASN1_VISIBLESTRING:
113 r=M_i2d_ASN1_VISIBLESTRING(a->value.visiblestring,pp);
114 break;
115 case V_ASN1_BMPSTRING:
116 r=M_i2d_ASN1_BMPSTRING(a->value.bmpstring,pp);
117 break;
118 case V_ASN1_UTCTIME:
119 r=i2d_ASN1_UTCTIME(a->value.utctime,pp);
120 break;
121 case V_ASN1_GENERALIZEDTIME:
122 r=i2d_ASN1_GENERALIZEDTIME(a->value.generalizedtime,pp);
123 break;
124 case V_ASN1_SET:
125 case V_ASN1_SEQUENCE:
126 case V_ASN1_OTHER:
127 default:
128 if (a->value.set == NULL)
129 r=0;
130 else
131 {
132 r=a->value.set->length;
133 if (pp != NULL)
134 {
135 memcpy(*pp,a->value.set->data,r);
136 *pp+=r;
137 }
138 }
139 break;
140 }
141 return(r);
142 }
143
144ASN1_TYPE *d2i_ASN1_TYPE(ASN1_TYPE **a, unsigned char **pp, long length)
145 {
146 ASN1_TYPE *ret=NULL;
147 unsigned char *q,*p,*max;
148 int inf,tag,xclass;
149 long len;
150
151 if ((a == NULL) || ((*a) == NULL))
152 {
153 if ((ret=ASN1_TYPE_new()) == NULL) goto err;
154 }
155 else
156 ret=(*a);
157
158 p= *pp;
159 q=p;
160 max=(p+length);
161
162 inf=ASN1_get_object(&q,&len,&tag,&xclass,length);
163 if (inf & 0x80) goto err;
164 /* If not universal tag we've no idea what it is */
165 if(xclass != V_ASN1_UNIVERSAL) tag = V_ASN1_OTHER;
166
167 ASN1_TYPE_component_free(ret);
168
169 switch (tag)
170 {
171 case V_ASN1_NULL:
172 p=q;
173 ret->value.ptr=NULL;
174 break;
175 case V_ASN1_INTEGER:
176 if ((ret->value.integer=
177 d2i_ASN1_INTEGER(NULL,&p,max-p)) == NULL)
178 goto err;
179 break;
180 case V_ASN1_ENUMERATED:
181 if ((ret->value.enumerated=
182 d2i_ASN1_ENUMERATED(NULL,&p,max-p)) == NULL)
183 goto err;
184 break;
185 case V_ASN1_BIT_STRING:
186 if ((ret->value.bit_string=
187 d2i_ASN1_BIT_STRING(NULL,&p,max-p)) == NULL)
188 goto err;
189 break;
190 case V_ASN1_OCTET_STRING:
191 if ((ret->value.octet_string=
192 d2i_ASN1_OCTET_STRING(NULL,&p,max-p)) == NULL)
193 goto err;
194 break;
195 case V_ASN1_VISIBLESTRING:
196 if ((ret->value.visiblestring=
197 d2i_ASN1_VISIBLESTRING(NULL,&p,max-p)) == NULL)
198 goto err;
199 break;
200 case V_ASN1_UTF8STRING:
201 if ((ret->value.utf8string=
202 d2i_ASN1_UTF8STRING(NULL,&p,max-p)) == NULL)
203 goto err;
204 break;
205 case V_ASN1_OBJECT:
206 if ((ret->value.object=
207 d2i_ASN1_OBJECT(NULL,&p,max-p)) == NULL)
208 goto err;
209 break;
210 case V_ASN1_PRINTABLESTRING:
211 if ((ret->value.printablestring=
212 d2i_ASN1_PRINTABLESTRING(NULL,&p,max-p)) == NULL)
213 goto err;
214 break;
215 case V_ASN1_T61STRING:
216 if ((ret->value.t61string=
217 M_d2i_ASN1_T61STRING(NULL,&p,max-p)) == NULL)
218 goto err;
219 break;
220 case V_ASN1_IA5STRING:
221 if ((ret->value.ia5string=
222 M_d2i_ASN1_IA5STRING(NULL,&p,max-p)) == NULL)
223 goto err;
224 break;
225 case V_ASN1_GENERALSTRING:
226 if ((ret->value.generalstring=
227 M_d2i_ASN1_GENERALSTRING(NULL,&p,max-p)) == NULL)
228 goto err;
229 break;
230 case V_ASN1_UNIVERSALSTRING:
231 if ((ret->value.universalstring=
232 M_d2i_ASN1_UNIVERSALSTRING(NULL,&p,max-p)) == NULL)
233 goto err;
234 break;
235 case V_ASN1_BMPSTRING:
236 if ((ret->value.bmpstring=
237 M_d2i_ASN1_BMPSTRING(NULL,&p,max-p)) == NULL)
238 goto err;
239 break;
240 case V_ASN1_UTCTIME:
241 if ((ret->value.utctime=
242 d2i_ASN1_UTCTIME(NULL,&p,max-p)) == NULL)
243 goto err;
244 break;
245 case V_ASN1_GENERALIZEDTIME:
246 if ((ret->value.generalizedtime=
247 d2i_ASN1_GENERALIZEDTIME(NULL,&p,max-p)) == NULL)
248 goto err;
249 break;
250 case V_ASN1_SET:
251 case V_ASN1_SEQUENCE:
252 case V_ASN1_OTHER:
253 default:
254 /* Sets and sequences are left complete */
255 if ((ret->value.set=ASN1_STRING_new()) == NULL) goto err;
256 ret->value.set->type=tag;
257 len+=(q-p);
258 if (!ASN1_STRING_set(ret->value.set,p,(int)len)) goto err;
259 p+=len;
260 break;
261 }
262
263 ret->type=tag;
264 if (a != NULL) (*a)=ret;
265 *pp=p;
266 return(ret);
267err:
268 if ((ret != NULL) && ((a == NULL) || (*a != ret))) ASN1_TYPE_free(ret);
269 return(NULL);
270 }
271
272ASN1_TYPE *ASN1_TYPE_new(void)
273 {
274 ASN1_TYPE *ret=NULL;
275 ASN1_CTX c;
276
277 M_ASN1_New_Malloc(ret,ASN1_TYPE);
278 ret->type= -1;
279 ret->value.ptr=NULL;
280 return(ret);
281 M_ASN1_New_Error(ASN1_F_ASN1_TYPE_NEW);
282 }
283
284void ASN1_TYPE_free(ASN1_TYPE *a)
285 {
286 if (a == NULL) return;
287 ASN1_TYPE_component_free(a);
288 OPENSSL_free(a);
289 }
290 62
291int ASN1_TYPE_get(ASN1_TYPE *a) 63int ASN1_TYPE_get(ASN1_TYPE *a)
292 { 64 {
@@ -299,54 +71,11 @@ int ASN1_TYPE_get(ASN1_TYPE *a)
299void ASN1_TYPE_set(ASN1_TYPE *a, int type, void *value) 71void ASN1_TYPE_set(ASN1_TYPE *a, int type, void *value)
300 { 72 {
301 if (a->value.ptr != NULL) 73 if (a->value.ptr != NULL)
302 ASN1_TYPE_component_free(a); 74 ASN1_primitive_free((ASN1_VALUE **)&a, NULL);
303 a->type=type; 75 a->type=type;
304 a->value.ptr=value; 76 a->value.ptr=value;
305 } 77 }
306 78
307static void ASN1_TYPE_component_free(ASN1_TYPE *a)
308 {
309 if (a == NULL) return;
310
311 if (a->value.ptr != NULL)
312 {
313 switch (a->type)
314 {
315 case V_ASN1_OBJECT:
316 ASN1_OBJECT_free(a->value.object);
317 break;
318 case V_ASN1_NULL:
319 break;
320 case V_ASN1_INTEGER:
321 case V_ASN1_NEG_INTEGER:
322 case V_ASN1_ENUMERATED:
323 case V_ASN1_NEG_ENUMERATED:
324 case V_ASN1_BIT_STRING:
325 case V_ASN1_OCTET_STRING:
326 case V_ASN1_SEQUENCE:
327 case V_ASN1_SET:
328 case V_ASN1_NUMERICSTRING:
329 case V_ASN1_PRINTABLESTRING:
330 case V_ASN1_T61STRING:
331 case V_ASN1_VIDEOTEXSTRING:
332 case V_ASN1_IA5STRING:
333 case V_ASN1_UTCTIME:
334 case V_ASN1_GENERALIZEDTIME:
335 case V_ASN1_GRAPHICSTRING:
336 case V_ASN1_VISIBLESTRING:
337 case V_ASN1_GENERALSTRING:
338 case V_ASN1_UNIVERSALSTRING:
339 case V_ASN1_BMPSTRING:
340 case V_ASN1_UTF8STRING:
341 case V_ASN1_OTHER:
342 default:
343 ASN1_STRING_free((ASN1_STRING *)a->value.ptr);
344 break;
345 }
346 a->type=0;
347 a->value.ptr=NULL;
348 }
349 }
350 79
351IMPLEMENT_STACK_OF(ASN1_TYPE) 80IMPLEMENT_STACK_OF(ASN1_TYPE)
352IMPLEMENT_ASN1_SET_OF(ASN1_TYPE) 81IMPLEMENT_ASN1_SET_OF(ASN1_TYPE)
diff --git a/src/lib/libcrypto/asn1/a_utctm.c b/src/lib/libcrypto/asn1/a_utctm.c
index d381c9e0d1..ed2d827db2 100644
--- a/src/lib/libcrypto/asn1/a_utctm.c
+++ b/src/lib/libcrypto/asn1/a_utctm.c
@@ -58,20 +58,11 @@
58 58
59#include <stdio.h> 59#include <stdio.h>
60#include <time.h> 60#include <time.h>
61#ifdef VMS
62#include <descrip.h>
63#include <lnmdef.h>
64#include <starlet.h>
65#endif
66#include "cryptlib.h" 61#include "cryptlib.h"
62#include "o_time.h"
67#include <openssl/asn1.h> 63#include <openssl/asn1.h>
68 64
69ASN1_UTCTIME *ASN1_UTCTIME_new(void) 65#if 0
70{ return M_ASN1_UTCTIME_new(); }
71
72void ASN1_UTCTIME_free(ASN1_UTCTIME *x)
73{ M_ASN1_UTCTIME_free(x); }
74
75int i2d_ASN1_UTCTIME(ASN1_UTCTIME *a, unsigned char **pp) 66int i2d_ASN1_UTCTIME(ASN1_UTCTIME *a, unsigned char **pp)
76 { 67 {
77#ifndef CHARSET_EBCDIC 68#ifndef CHARSET_EBCDIC
@@ -119,6 +110,8 @@ err:
119 return(NULL); 110 return(NULL);
120 } 111 }
121 112
113#endif
114
122int ASN1_UTCTIME_check(ASN1_UTCTIME *d) 115int ASN1_UTCTIME_check(ASN1_UTCTIME *d)
123 { 116 {
124 static int min[8]={ 0, 1, 1, 0, 0, 0, 0, 0}; 117 static int min[8]={ 0, 1, 1, 0, 0, 0, 0, 0};
@@ -182,6 +175,7 @@ int ASN1_UTCTIME_set_string(ASN1_UTCTIME *s, char *str)
182 { 175 {
183 ASN1_STRING_set((ASN1_STRING *)s, 176 ASN1_STRING_set((ASN1_STRING *)s,
184 (unsigned char *)str,t.length); 177 (unsigned char *)str,t.length);
178 s->type = V_ASN1_UTCTIME;
185 } 179 }
186 return(1); 180 return(1);
187 } 181 }
@@ -193,59 +187,17 @@ ASN1_UTCTIME *ASN1_UTCTIME_set(ASN1_UTCTIME *s, time_t t)
193 { 187 {
194 char *p; 188 char *p;
195 struct tm *ts; 189 struct tm *ts;
196#if defined(THREADS) && !defined(WIN32) && !defined(__CYGWIN32__)
197
198 struct tm data; 190 struct tm data;
199#endif
200 191
201 if (s == NULL) 192 if (s == NULL)
202 s=M_ASN1_UTCTIME_new(); 193 s=M_ASN1_UTCTIME_new();
203 if (s == NULL) 194 if (s == NULL)
204 return(NULL); 195 return(NULL);
205 196
206#if defined(THREADS) && !defined(WIN32) && !defined(__CYGWIN32__) 197 ts=OPENSSL_gmtime(&t, &data);
207 gmtime_r(&t,&data); /* should return &data, but doesn't on some systems, so we don't even look at the return value */
208 ts=&data;
209#else
210 ts=gmtime(&t);
211#endif
212#ifdef VMS
213 if (ts == NULL) 198 if (ts == NULL)
214 { 199 return(NULL);
215 static $DESCRIPTOR(tabnam,"LNM$DCL_LOGICAL"); 200
216 static $DESCRIPTOR(lognam,"SYS$TIMEZONE_DIFFERENTIAL");
217 char result[256];
218 unsigned int reslen = 0;
219 struct {
220 short buflen;
221 short code;
222 void *bufaddr;
223 unsigned int *reslen;
224 } itemlist[] = {
225 { 0, LNM$_STRING, 0, 0 },
226 { 0, 0, 0, 0 },
227 };
228 int status;
229
230 /* Get the value for SYS$TIMEZONE_DIFFERENTIAL */
231 itemlist[0].buflen = sizeof(result);
232 itemlist[0].bufaddr = result;
233 itemlist[0].reslen = &reslen;
234 status = sys$trnlnm(0, &tabnam, &lognam, 0, itemlist);
235 if (!(status & 1))
236 return NULL;
237 result[reslen] = '\0';
238
239 /* Get the numerical value of the equivalence string */
240 status = atoi(result);
241
242 /* and use it to move time to GMT */
243 t -= status;
244
245 /* then convert the result to the time structure */
246 ts=(struct tm *)localtime(&t);
247 }
248#endif
249 p=(char *)s->data; 201 p=(char *)s->data;
250 if ((p == NULL) || (s->length < 14)) 202 if ((p == NULL) || (s->length < 14))
251 { 203 {
@@ -286,11 +238,7 @@ int ASN1_UTCTIME_cmp_time_t(const ASN1_UTCTIME *s, time_t t)
286 238
287 t -= offset*60; /* FIXME: may overflow in extreme cases */ 239 t -= offset*60; /* FIXME: may overflow in extreme cases */
288 240
289#if defined(THREADS) && !defined(WIN32) && !defined(__CYGWIN32__) 241 { struct tm data; tm = OPENSSL_gmtime(&t, &data); }
290 { struct tm data; gmtime_r(&t, &data); tm = &data; }
291#else
292 tm = gmtime(&t);
293#endif
294 242
295#define return_cmp(a,b) if ((a)<(b)) return -1; else if ((a)>(b)) return 1 243#define return_cmp(a,b) if ((a)<(b)) return -1; else if ((a)>(b)) return 1
296 year = g2(s->data); 244 year = g2(s->data);
diff --git a/src/lib/libcrypto/asn1/a_utf8.c b/src/lib/libcrypto/asn1/a_utf8.c
index 854278f136..508e11e527 100644
--- a/src/lib/libcrypto/asn1/a_utf8.c
+++ b/src/lib/libcrypto/asn1/a_utf8.c
@@ -60,33 +60,6 @@
60#include "cryptlib.h" 60#include "cryptlib.h"
61#include <openssl/asn1.h> 61#include <openssl/asn1.h>
62 62
63ASN1_UTF8STRING *ASN1_UTF8STRING_new(void)
64{ return M_ASN1_UTF8STRING_new();}
65
66void ASN1_UTF8STRING_free(ASN1_UTF8STRING *x)
67{ M_ASN1_UTF8STRING_free(x);}
68
69int i2d_ASN1_UTF8STRING(ASN1_UTF8STRING *a, unsigned char **pp)
70 {
71 return(i2d_ASN1_bytes((ASN1_STRING *)a,pp,
72 V_ASN1_UTF8STRING,V_ASN1_UNIVERSAL));
73 }
74
75ASN1_UTF8STRING *d2i_ASN1_UTF8STRING(ASN1_UTF8STRING **a, unsigned char **pp,
76 long length)
77 {
78 ASN1_UTF8STRING *ret=NULL;
79
80 ret=(ASN1_UTF8STRING *)d2i_ASN1_bytes((ASN1_STRING **)a,
81 pp,length,V_ASN1_UTF8STRING,V_ASN1_UNIVERSAL);
82 if (ret == NULL)
83 {
84 ASN1err(ASN1_F_D2I_ASN1_UTF8STRING,ERR_R_NESTED_ASN1_ERROR);
85 return(NULL);
86 }
87 return(ret);
88 }
89
90 63
91/* UTF8 utilities */ 64/* UTF8 utilities */
92 65
diff --git a/src/lib/libcrypto/asn1/a_verify.c b/src/lib/libcrypto/asn1/a_verify.c
index 2a11927e5c..bf41de5146 100644
--- a/src/lib/libcrypto/asn1/a_verify.c
+++ b/src/lib/libcrypto/asn1/a_verify.c
@@ -71,6 +71,8 @@
71#include <openssl/buffer.h> 71#include <openssl/buffer.h>
72#include <openssl/evp.h> 72#include <openssl/evp.h>
73 73
74#ifndef NO_ASN1_OLD
75
74int ASN1_verify(int (*i2d)(), X509_ALGOR *a, ASN1_BIT_STRING *signature, 76int ASN1_verify(int (*i2d)(), X509_ALGOR *a, ASN1_BIT_STRING *signature,
75 char *data, EVP_PKEY *pkey) 77 char *data, EVP_PKEY *pkey)
76 { 78 {
@@ -79,6 +81,7 @@ int ASN1_verify(int (*i2d)(), X509_ALGOR *a, ASN1_BIT_STRING *signature,
79 unsigned char *p,*buf_in=NULL; 81 unsigned char *p,*buf_in=NULL;
80 int ret= -1,i,inl; 82 int ret= -1,i,inl;
81 83
84 EVP_MD_CTX_init(&ctx);
82 i=OBJ_obj2nid(a->algorithm); 85 i=OBJ_obj2nid(a->algorithm);
83 type=EVP_get_digestbyname(OBJ_nid2sn(i)); 86 type=EVP_get_digestbyname(OBJ_nid2sn(i));
84 if (type == NULL) 87 if (type == NULL)
@@ -97,7 +100,57 @@ int ASN1_verify(int (*i2d)(), X509_ALGOR *a, ASN1_BIT_STRING *signature,
97 p=buf_in; 100 p=buf_in;
98 101
99 i2d(data,&p); 102 i2d(data,&p);
100 EVP_VerifyInit(&ctx,type); 103 EVP_VerifyInit_ex(&ctx,type, NULL);
104 EVP_VerifyUpdate(&ctx,(unsigned char *)buf_in,inl);
105
106 memset(buf_in,0,(unsigned int)inl);
107 OPENSSL_free(buf_in);
108
109 if (EVP_VerifyFinal(&ctx,(unsigned char *)signature->data,
110 (unsigned int)signature->length,pkey) <= 0)
111 {
112 ASN1err(ASN1_F_ASN1_VERIFY,ERR_R_EVP_LIB);
113 ret=0;
114 goto err;
115 }
116 /* we don't need to zero the 'ctx' because we just checked
117 * public information */
118 /* memset(&ctx,0,sizeof(ctx)); */
119 ret=1;
120err:
121 EVP_MD_CTX_cleanup(&ctx);
122 return(ret);
123 }
124
125#endif
126
127
128int ASN1_item_verify(const ASN1_ITEM *it, X509_ALGOR *a, ASN1_BIT_STRING *signature,
129 void *asn, EVP_PKEY *pkey)
130 {
131 EVP_MD_CTX ctx;
132 const EVP_MD *type;
133 unsigned char *buf_in=NULL;
134 int ret= -1,i,inl;
135
136 EVP_MD_CTX_init(&ctx);
137 i=OBJ_obj2nid(a->algorithm);
138 type=EVP_get_digestbyname(OBJ_nid2sn(i));
139 if (type == NULL)
140 {
141 ASN1err(ASN1_F_ASN1_VERIFY,ASN1_R_UNKNOWN_MESSAGE_DIGEST_ALGORITHM);
142 goto err;
143 }
144
145 inl = ASN1_item_i2d(asn, &buf_in, it);
146
147 if (buf_in == NULL)
148 {
149 ASN1err(ASN1_F_ASN1_VERIFY,ERR_R_MALLOC_FAILURE);
150 goto err;
151 }
152
153 EVP_VerifyInit_ex(&ctx,type, NULL);
101 EVP_VerifyUpdate(&ctx,(unsigned char *)buf_in,inl); 154 EVP_VerifyUpdate(&ctx,(unsigned char *)buf_in,inl);
102 155
103 memset(buf_in,0,(unsigned int)inl); 156 memset(buf_in,0,(unsigned int)inl);
@@ -115,5 +168,8 @@ int ASN1_verify(int (*i2d)(), X509_ALGOR *a, ASN1_BIT_STRING *signature,
115 /* memset(&ctx,0,sizeof(ctx)); */ 168 /* memset(&ctx,0,sizeof(ctx)); */
116 ret=1; 169 ret=1;
117err: 170err:
171 EVP_MD_CTX_cleanup(&ctx);
118 return(ret); 172 return(ret);
119 } 173 }
174
175
diff --git a/src/lib/libcrypto/asn1/asn1.h b/src/lib/libcrypto/asn1/asn1.h
index 6f956b1963..0d1713f8dd 100644
--- a/src/lib/libcrypto/asn1/asn1.h
+++ b/src/lib/libcrypto/asn1/asn1.h
@@ -60,15 +60,24 @@
60#define HEADER_ASN1_H 60#define HEADER_ASN1_H
61 61
62#include <time.h> 62#include <time.h>
63#ifndef NO_BIO 63#ifndef OPENSSL_NO_BIO
64#include <openssl/bio.h> 64#include <openssl/bio.h>
65#endif 65#endif
66#include <openssl/e_os2.h>
66#include <openssl/bn.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
73#include <openssl/e_os2.h>
74#include <openssl/ossl_typ.h>
75
76#ifdef OPENSSL_BUILD_SHLIBCRYPTO
77# undef OPENSSL_EXTERN
78# define OPENSSL_EXTERN OPENSSL_EXPORT
79#endif
80
72#ifdef __cplusplus 81#ifdef __cplusplus
73extern "C" { 82extern "C" {
74#endif 83#endif
@@ -84,6 +93,7 @@ extern "C" {
84 93
85#define V_ASN1_APP_CHOOSE -2 /* let the recipient choose */ 94#define V_ASN1_APP_CHOOSE -2 /* let the recipient choose */
86#define V_ASN1_OTHER -3 /* used in ASN1_TYPE */ 95#define V_ASN1_OTHER -3 /* used in ASN1_TYPE */
96#define V_ASN1_ANY -4 /* used in ASN1 template code */
87 97
88#define V_ASN1_NEG 0x100 /* negative flag */ 98#define V_ASN1_NEG 0x100 /* negative flag */
89 99
@@ -136,6 +146,8 @@ extern "C" {
136#define B_ASN1_BMPSTRING 0x0800 146#define B_ASN1_BMPSTRING 0x0800
137#define B_ASN1_UNKNOWN 0x1000 147#define B_ASN1_UNKNOWN 0x1000
138#define B_ASN1_UTF8STRING 0x2000 148#define B_ASN1_UTF8STRING 0x2000
149#define B_ASN1_UTCTIME 0x4000
150#define B_ASN1_GENERALIZEDTIME 0x8000
139 151
140/* For use with ASN1_mbstring_copy() */ 152/* For use with ASN1_mbstring_copy() */
141#define MBSTRING_FLAG 0x1000 153#define MBSTRING_FLAG 0x1000
@@ -193,6 +205,21 @@ typedef struct asn1_string_st
193 long flags; 205 long flags;
194 } ASN1_STRING; 206 } ASN1_STRING;
195 207
208/* ASN1_ENCODING structure: this is used to save the received
209 * encoding of an ASN1 type. This is useful to get round
210 * problems with invalid encodings which can break signatures.
211 */
212
213typedef struct ASN1_ENCODING_st
214 {
215 unsigned char *enc; /* DER encoding */
216 long len; /* Length of encoding */
217 int modified; /* set to 1 if 'enc' is invalid */
218 } ASN1_ENCODING;
219
220/* Used with ASN1 LONG type: if a long is set to this it is omitted */
221#define ASN1_LONG_UNDEF 0x7fffffffL
222
196#define STABLE_FLAGS_MALLOC 0x01 223#define STABLE_FLAGS_MALLOC 0x01
197#define STABLE_NO_MASK 0x02 224#define STABLE_NO_MASK 0x02
198#define DIRSTRING_TYPE \ 225#define DIRSTRING_TYPE \
@@ -220,43 +247,116 @@ DECLARE_STACK_OF(ASN1_STRING_TABLE)
220#define ub_title 64 247#define ub_title 64
221#define ub_email_address 128 248#define ub_email_address 128
222 249
223#ifdef NO_ASN1_TYPEDEFS 250/* Declarations for template structures: for full definitions
224#define ASN1_INTEGER ASN1_STRING 251 * see asn1t.h
225#define ASN1_ENUMERATED ASN1_STRING 252 */
226#define ASN1_BIT_STRING ASN1_STRING 253typedef struct ASN1_TEMPLATE_st ASN1_TEMPLATE;
227#define ASN1_OCTET_STRING ASN1_STRING 254typedef struct ASN1_ITEM_st ASN1_ITEM;
228#define ASN1_PRINTABLESTRING ASN1_STRING 255typedef struct ASN1_TLC_st ASN1_TLC;
229#define ASN1_T61STRING ASN1_STRING 256/* This is just an opaque pointer */
230#define ASN1_IA5STRING ASN1_STRING 257typedef struct ASN1_VALUE_st ASN1_VALUE;
231#define ASN1_UTCTIME ASN1_STRING 258
232#define ASN1_GENERALIZEDTIME ASN1_STRING 259/* Declare ASN1 functions: the implement macro in in asn1t.h */
233#define ASN1_TIME ASN1_STRING 260
234#define ASN1_GENERALSTRING ASN1_STRING 261#define DECLARE_ASN1_FUNCTIONS(type) DECLARE_ASN1_FUNCTIONS_name(type, type)
235#define ASN1_UNIVERSALSTRING ASN1_STRING 262
236#define ASN1_BMPSTRING ASN1_STRING 263#define DECLARE_ASN1_FUNCTIONS_name(type, name) \
237#define ASN1_VISIBLESTRING ASN1_STRING 264 type *name##_new(void); \
238#define ASN1_UTF8STRING ASN1_STRING 265 void name##_free(type *a); \
239#define ASN1_BOOLEAN int 266 DECLARE_ASN1_ENCODE_FUNCTIONS(type, name, name)
267
268#define DECLARE_ASN1_FUNCTIONS_fname(type, itname, name) \
269 type *name##_new(void); \
270 void name##_free(type *a); \
271 DECLARE_ASN1_ENCODE_FUNCTIONS(type, itname, name)
272
273#define DECLARE_ASN1_ENCODE_FUNCTIONS(type, itname, name) \
274 type *d2i_##name(type **a, unsigned char **in, long len); \
275 int i2d_##name(type *a, unsigned char **out); \
276 DECLARE_ASN1_ITEM(itname)
277
278#define DECLARE_ASN1_ENCODE_FUNCTIONS_const(type, name) \
279 type *d2i_##name(type **a, const unsigned char **in, long len); \
280 int i2d_##name(const type *a, unsigned char **out); \
281 DECLARE_ASN1_ITEM(name)
282
283#define DECLARE_ASN1_FUNCTIONS_const(name) \
284 name *name##_new(void); \
285 void name##_free(name *a);
286
287
288/* The following macros and typedefs allow an ASN1_ITEM
289 * to be embedded in a structure and referenced. Since
290 * the ASN1_ITEM pointers need to be globally accessible
291 * (possibly from shared libraries) they may exist in
292 * different forms. On platforms that support it the
293 * ASN1_ITEM structure itself will be globally exported.
294 * Other platforms will export a function that returns
295 * an ASN1_ITEM pointer.
296 *
297 * To handle both cases transparently the macros below
298 * should be used instead of hard coding an ASN1_ITEM
299 * pointer in a structure.
300 *
301 * The structure will look like this:
302 *
303 * typedef struct SOMETHING_st {
304 * ...
305 * ASN1_ITEM_EXP *iptr;
306 * ...
307 * } SOMETHING;
308 *
309 * It would be initialised as e.g.:
310 *
311 * SOMETHING somevar = {...,ASN1_ITEM_ref(X509),...};
312 *
313 * and the actual pointer extracted with:
314 *
315 * const ASN1_ITEM *it = ASN1_ITEM_ptr(somevar.iptr);
316 *
317 * Finally an ASN1_ITEM pointer can be extracted from an
318 * appropriate reference with: ASN1_ITEM_rptr(X509). This
319 * would be used when a function takes an ASN1_ITEM * argument.
320 *
321 */
322
323#ifndef OPENSSL_EXPORT_VAR_AS_FUNCTION
324
325/* ASN1_ITEM pointer exported type */
326typedef const ASN1_ITEM ASN1_ITEM_EXP;
327
328/* Macro to obtain ASN1_ITEM pointer from exported type */
329#define ASN1_ITEM_ptr(iptr) (iptr)
330
331/* Macro to include ASN1_ITEM pointer from base type */
332#define ASN1_ITEM_ref(iptr) (&(iptr##_it))
333
334#define ASN1_ITEM_rptr(ref) (&(ref##_it))
335
336#define DECLARE_ASN1_ITEM(name) \
337 OPENSSL_EXTERN const ASN1_ITEM name##_it;
338
240#else 339#else
241typedef struct asn1_string_st ASN1_INTEGER;
242typedef struct asn1_string_st ASN1_ENUMERATED;
243typedef struct asn1_string_st ASN1_BIT_STRING;
244typedef struct asn1_string_st ASN1_OCTET_STRING;
245typedef struct asn1_string_st ASN1_PRINTABLESTRING;
246typedef struct asn1_string_st ASN1_T61STRING;
247typedef struct asn1_string_st ASN1_IA5STRING;
248typedef struct asn1_string_st ASN1_GENERALSTRING;
249typedef struct asn1_string_st ASN1_UNIVERSALSTRING;
250typedef struct asn1_string_st ASN1_BMPSTRING;
251typedef struct asn1_string_st ASN1_UTCTIME;
252typedef struct asn1_string_st ASN1_TIME;
253typedef struct asn1_string_st ASN1_GENERALIZEDTIME;
254typedef struct asn1_string_st ASN1_VISIBLESTRING;
255typedef struct asn1_string_st ASN1_UTF8STRING;
256typedef int ASN1_BOOLEAN;
257#endif
258 340
259typedef int ASN1_NULL; 341/* Platforms that can't easily handle shared global variables are declared
342 * as functions returning ASN1_ITEM pointers.
343 */
344
345/* ASN1_ITEM pointer exported type */
346typedef const ASN1_ITEM * ASN1_ITEM_EXP(void);
347
348/* Macro to obtain ASN1_ITEM pointer from exported type */
349#define ASN1_ITEM_ptr(iptr) (iptr())
350
351/* Macro to include ASN1_ITEM pointer from base type */
352#define ASN1_ITEM_ref(iptr) (iptr##_it)
353
354#define ASN1_ITEM_rptr(ref) (ref##_it())
355
356#define DECLARE_ASN1_ITEM(name) \
357 const ASN1_ITEM * name##_it(void);
358
359#endif
260 360
261/* Parameters used by ASN1_STRING_print_ex() */ 361/* Parameters used by ASN1_STRING_print_ex() */
262 362
@@ -340,6 +440,8 @@ typedef int ASN1_NULL;
340DECLARE_STACK_OF(ASN1_INTEGER) 440DECLARE_STACK_OF(ASN1_INTEGER)
341DECLARE_ASN1_SET_OF(ASN1_INTEGER) 441DECLARE_ASN1_SET_OF(ASN1_INTEGER)
342 442
443DECLARE_STACK_OF(ASN1_GENERALSTRING)
444
343typedef struct asn1_type_st 445typedef struct asn1_type_st
344 { 446 {
345 int type; 447 int type;
@@ -438,12 +540,11 @@ typedef struct BIT_STRING_BITNAME_st {
438 i2d_ASN1_bytes((ASN1_STRING *)a,pp,V_ASN1_OCTET_STRING,\ 540 i2d_ASN1_bytes((ASN1_STRING *)a,pp,V_ASN1_OCTET_STRING,\
439 V_ASN1_UNIVERSAL) 541 V_ASN1_UNIVERSAL)
440 542
441#define M_ASN1_PRINTABLE_new() ASN1_STRING_type_new(V_ASN1_T61STRING) 543#define B_ASN1_TIME \
442#define M_ASN1_PRINTABLE_free(a) ASN1_STRING_free((ASN1_STRING *)a) 544 B_ASN1_UTCTIME | \
443#define M_i2d_ASN1_PRINTABLE(a,pp) i2d_ASN1_bytes((ASN1_STRING *)a,\ 545 B_ASN1_GENERALIZEDTIME
444 pp,a->type,V_ASN1_UNIVERSAL) 546
445#define M_d2i_ASN1_PRINTABLE(a,pp,l) \ 547#define B_ASN1_PRINTABLE \
446 d2i_ASN1_type_bytes((ASN1_STRING **)a,pp,l, \
447 B_ASN1_PRINTABLESTRING| \ 548 B_ASN1_PRINTABLESTRING| \
448 B_ASN1_T61STRING| \ 549 B_ASN1_T61STRING| \
449 B_ASN1_IA5STRING| \ 550 B_ASN1_IA5STRING| \
@@ -451,7 +552,28 @@ typedef struct BIT_STRING_BITNAME_st {
451 B_ASN1_UNIVERSALSTRING|\ 552 B_ASN1_UNIVERSALSTRING|\
452 B_ASN1_BMPSTRING|\ 553 B_ASN1_BMPSTRING|\
453 B_ASN1_UTF8STRING|\ 554 B_ASN1_UTF8STRING|\
454 B_ASN1_UNKNOWN) 555 B_ASN1_UNKNOWN
556
557#define B_ASN1_DIRECTORYSTRING \
558 B_ASN1_PRINTABLESTRING| \
559 B_ASN1_TELETEXSTRING|\
560 B_ASN1_BMPSTRING|\
561 B_ASN1_UNIVERSALSTRING|\
562 B_ASN1_UTF8STRING
563
564#define B_ASN1_DISPLAYTEXT \
565 B_ASN1_IA5STRING| \
566 B_ASN1_VISIBLESTRING| \
567 B_ASN1_BMPSTRING|\
568 B_ASN1_UTF8STRING
569
570#define M_ASN1_PRINTABLE_new() ASN1_STRING_type_new(V_ASN1_T61STRING)
571#define M_ASN1_PRINTABLE_free(a) ASN1_STRING_free((ASN1_STRING *)a)
572#define M_i2d_ASN1_PRINTABLE(a,pp) i2d_ASN1_bytes((ASN1_STRING *)a,\
573 pp,a->type,V_ASN1_UNIVERSAL)
574#define M_d2i_ASN1_PRINTABLE(a,pp,l) \
575 d2i_ASN1_type_bytes((ASN1_STRING **)a,pp,l, \
576 B_ASN1_PRINTABLE)
455 577
456#define M_DIRECTORYSTRING_new() ASN1_STRING_type_new(V_ASN1_PRINTABLESTRING) 578#define M_DIRECTORYSTRING_new() ASN1_STRING_type_new(V_ASN1_PRINTABLESTRING)
457#define M_DIRECTORYSTRING_free(a) ASN1_STRING_free((ASN1_STRING *)a) 579#define M_DIRECTORYSTRING_free(a) ASN1_STRING_free((ASN1_STRING *)a)
@@ -459,11 +581,7 @@ typedef struct BIT_STRING_BITNAME_st {
459 pp,a->type,V_ASN1_UNIVERSAL) 581 pp,a->type,V_ASN1_UNIVERSAL)
460#define M_d2i_DIRECTORYSTRING(a,pp,l) \ 582#define M_d2i_DIRECTORYSTRING(a,pp,l) \
461 d2i_ASN1_type_bytes((ASN1_STRING **)a,pp,l, \ 583 d2i_ASN1_type_bytes((ASN1_STRING **)a,pp,l, \
462 B_ASN1_PRINTABLESTRING| \ 584 B_ASN1_DIRECTORYSTRING)
463 B_ASN1_TELETEXSTRING|\
464 B_ASN1_BMPSTRING|\
465 B_ASN1_UNIVERSALSTRING|\
466 B_ASN1_UTF8STRING)
467 585
468#define M_DISPLAYTEXT_new() ASN1_STRING_type_new(V_ASN1_VISIBLESTRING) 586#define M_DISPLAYTEXT_new() ASN1_STRING_type_new(V_ASN1_VISIBLESTRING)
469#define M_DISPLAYTEXT_free(a) ASN1_STRING_free((ASN1_STRING *)a) 587#define M_DISPLAYTEXT_free(a) ASN1_STRING_free((ASN1_STRING *)a)
@@ -471,9 +589,7 @@ typedef struct BIT_STRING_BITNAME_st {
471 pp,a->type,V_ASN1_UNIVERSAL) 589 pp,a->type,V_ASN1_UNIVERSAL)
472#define M_d2i_DISPLAYTEXT(a,pp,l) \ 590#define M_d2i_DISPLAYTEXT(a,pp,l) \
473 d2i_ASN1_type_bytes((ASN1_STRING **)a,pp,l, \ 591 d2i_ASN1_type_bytes((ASN1_STRING **)a,pp,l, \
474 B_ASN1_VISIBLESTRING| \ 592 B_ASN1_DISPLAYTEXT)
475 B_ASN1_BMPSTRING|\
476 B_ASN1_UTF8STRING)
477 593
478#define M_ASN1_PRINTABLESTRING_new() (ASN1_PRINTABLESTRING *)\ 594#define M_ASN1_PRINTABLESTRING_new() (ASN1_PRINTABLESTRING *)\
479 ASN1_STRING_type_new(V_ASN1_PRINTABLESTRING) 595 ASN1_STRING_type_new(V_ASN1_PRINTABLESTRING)
@@ -577,10 +693,8 @@ typedef struct BIT_STRING_BITNAME_st {
577#define IS_SEQUENCE 0 693#define IS_SEQUENCE 0
578#define IS_SET 1 694#define IS_SET 1
579 695
580ASN1_TYPE * ASN1_TYPE_new(void ); 696DECLARE_ASN1_FUNCTIONS_fname(ASN1_TYPE, ASN1_ANY, ASN1_TYPE)
581void ASN1_TYPE_free(ASN1_TYPE *a); 697
582int i2d_ASN1_TYPE(ASN1_TYPE *a,unsigned char **pp);
583ASN1_TYPE * d2i_ASN1_TYPE(ASN1_TYPE **a,unsigned char **pp,long length);
584int ASN1_TYPE_get(ASN1_TYPE *a); 698int ASN1_TYPE_get(ASN1_TYPE *a);
585void ASN1_TYPE_set(ASN1_TYPE *a, int type, void *value); 699void ASN1_TYPE_set(ASN1_TYPE *a, int type, void *value);
586 700
@@ -592,6 +706,8 @@ ASN1_OBJECT * c2i_ASN1_OBJECT(ASN1_OBJECT **a,unsigned char **pp,
592ASN1_OBJECT * d2i_ASN1_OBJECT(ASN1_OBJECT **a,unsigned char **pp, 706ASN1_OBJECT * d2i_ASN1_OBJECT(ASN1_OBJECT **a,unsigned char **pp,
593 long length); 707 long length);
594 708
709DECLARE_ASN1_ITEM(ASN1_OBJECT)
710
595DECLARE_STACK_OF(ASN1_OBJECT) 711DECLARE_STACK_OF(ASN1_OBJECT)
596DECLARE_ASN1_SET_OF(ASN1_OBJECT) 712DECLARE_ASN1_SET_OF(ASN1_OBJECT)
597 713
@@ -608,12 +724,8 @@ void ASN1_STRING_length_set(ASN1_STRING *x, int n);
608int ASN1_STRING_type(ASN1_STRING *x); 724int ASN1_STRING_type(ASN1_STRING *x);
609unsigned char * ASN1_STRING_data(ASN1_STRING *x); 725unsigned char * ASN1_STRING_data(ASN1_STRING *x);
610 726
611ASN1_BIT_STRING * ASN1_BIT_STRING_new(void); 727DECLARE_ASN1_FUNCTIONS(ASN1_BIT_STRING)
612void ASN1_BIT_STRING_free(ASN1_BIT_STRING *a);
613int i2d_ASN1_BIT_STRING(ASN1_BIT_STRING *a,unsigned char **pp);
614int i2c_ASN1_BIT_STRING(ASN1_BIT_STRING *a,unsigned char **pp); 728int i2c_ASN1_BIT_STRING(ASN1_BIT_STRING *a,unsigned char **pp);
615ASN1_BIT_STRING *d2i_ASN1_BIT_STRING(ASN1_BIT_STRING **a,unsigned char **pp,
616 long length);
617ASN1_BIT_STRING *c2i_ASN1_BIT_STRING(ASN1_BIT_STRING **a,unsigned char **pp, 729ASN1_BIT_STRING *c2i_ASN1_BIT_STRING(ASN1_BIT_STRING **a,unsigned char **pp,
618 long length); 730 long length);
619int ASN1_BIT_STRING_set(ASN1_BIT_STRING *a, unsigned char *d, 731int ASN1_BIT_STRING_set(ASN1_BIT_STRING *a, unsigned char *d,
@@ -621,7 +733,7 @@ int ASN1_BIT_STRING_set(ASN1_BIT_STRING *a, unsigned char *d,
621int ASN1_BIT_STRING_set_bit(ASN1_BIT_STRING *a, int n, int value); 733int ASN1_BIT_STRING_set_bit(ASN1_BIT_STRING *a, int n, int value);
622int ASN1_BIT_STRING_get_bit(ASN1_BIT_STRING *a, int n); 734int ASN1_BIT_STRING_get_bit(ASN1_BIT_STRING *a, int n);
623 735
624#ifndef NO_BIO 736#ifndef OPENSSL_NO_BIO
625int ASN1_BIT_STRING_name_print(BIO *out, ASN1_BIT_STRING *bs, 737int ASN1_BIT_STRING_name_print(BIO *out, ASN1_BIT_STRING *bs,
626 BIT_STRING_BITNAME *tbl, int indent); 738 BIT_STRING_BITNAME *tbl, int indent);
627#endif 739#endif
@@ -632,12 +744,8 @@ int ASN1_BIT_STRING_set_asc(ASN1_BIT_STRING *bs, char *name, int value,
632int i2d_ASN1_BOOLEAN(int a,unsigned char **pp); 744int i2d_ASN1_BOOLEAN(int a,unsigned char **pp);
633int d2i_ASN1_BOOLEAN(int *a,unsigned char **pp,long length); 745int d2i_ASN1_BOOLEAN(int *a,unsigned char **pp,long length);
634 746
635ASN1_INTEGER * ASN1_INTEGER_new(void); 747DECLARE_ASN1_FUNCTIONS(ASN1_INTEGER)
636void ASN1_INTEGER_free(ASN1_INTEGER *a);
637int i2d_ASN1_INTEGER(ASN1_INTEGER *a,unsigned char **pp);
638int i2c_ASN1_INTEGER(ASN1_INTEGER *a,unsigned char **pp); 748int i2c_ASN1_INTEGER(ASN1_INTEGER *a,unsigned char **pp);
639ASN1_INTEGER *d2i_ASN1_INTEGER(ASN1_INTEGER **a,unsigned char **pp,
640 long length);
641ASN1_INTEGER *c2i_ASN1_INTEGER(ASN1_INTEGER **a,unsigned char **pp, 749ASN1_INTEGER *c2i_ASN1_INTEGER(ASN1_INTEGER **a,unsigned char **pp,
642 long length); 750 long length);
643ASN1_INTEGER *d2i_ASN1_UINTEGER(ASN1_INTEGER **a,unsigned char **pp, 751ASN1_INTEGER *d2i_ASN1_UINTEGER(ASN1_INTEGER **a,unsigned char **pp,
@@ -645,11 +753,7 @@ ASN1_INTEGER *d2i_ASN1_UINTEGER(ASN1_INTEGER **a,unsigned char **pp,
645ASN1_INTEGER * ASN1_INTEGER_dup(ASN1_INTEGER *x); 753ASN1_INTEGER * ASN1_INTEGER_dup(ASN1_INTEGER *x);
646int ASN1_INTEGER_cmp(ASN1_INTEGER *x, ASN1_INTEGER *y); 754int ASN1_INTEGER_cmp(ASN1_INTEGER *x, ASN1_INTEGER *y);
647 755
648ASN1_ENUMERATED * ASN1_ENUMERATED_new(void); 756DECLARE_ASN1_FUNCTIONS(ASN1_ENUMERATED)
649void ASN1_ENUMERATED_free(ASN1_ENUMERATED *a);
650int i2d_ASN1_ENUMERATED(ASN1_ENUMERATED *a,unsigned char **pp);
651ASN1_ENUMERATED *d2i_ASN1_ENUMERATED(ASN1_ENUMERATED **a,unsigned char **pp,
652 long length);
653 757
654int ASN1_UTCTIME_check(ASN1_UTCTIME *a); 758int ASN1_UTCTIME_check(ASN1_UTCTIME *a);
655ASN1_UTCTIME *ASN1_UTCTIME_set(ASN1_UTCTIME *s,time_t t); 759ASN1_UTCTIME *ASN1_UTCTIME_set(ASN1_UTCTIME *s,time_t t);
@@ -663,91 +767,34 @@ int ASN1_GENERALIZEDTIME_check(ASN1_GENERALIZEDTIME *a);
663ASN1_GENERALIZEDTIME *ASN1_GENERALIZEDTIME_set(ASN1_GENERALIZEDTIME *s,time_t t); 767ASN1_GENERALIZEDTIME *ASN1_GENERALIZEDTIME_set(ASN1_GENERALIZEDTIME *s,time_t t);
664int ASN1_GENERALIZEDTIME_set_string(ASN1_GENERALIZEDTIME *s, char *str); 768int ASN1_GENERALIZEDTIME_set_string(ASN1_GENERALIZEDTIME *s, char *str);
665 769
666ASN1_OCTET_STRING * ASN1_OCTET_STRING_new(void); 770DECLARE_ASN1_FUNCTIONS(ASN1_OCTET_STRING)
667void ASN1_OCTET_STRING_free(ASN1_OCTET_STRING *a);
668int i2d_ASN1_OCTET_STRING(ASN1_OCTET_STRING *a,unsigned char **pp);
669ASN1_OCTET_STRING *d2i_ASN1_OCTET_STRING(ASN1_OCTET_STRING **a,
670 unsigned char **pp,long length);
671ASN1_OCTET_STRING * ASN1_OCTET_STRING_dup(ASN1_OCTET_STRING *a); 771ASN1_OCTET_STRING * ASN1_OCTET_STRING_dup(ASN1_OCTET_STRING *a);
672int ASN1_OCTET_STRING_cmp(ASN1_OCTET_STRING *a, ASN1_OCTET_STRING *b); 772int ASN1_OCTET_STRING_cmp(ASN1_OCTET_STRING *a, ASN1_OCTET_STRING *b);
673int ASN1_OCTET_STRING_set(ASN1_OCTET_STRING *str, unsigned char *data, int len); 773int ASN1_OCTET_STRING_set(ASN1_OCTET_STRING *str, unsigned char *data, int len);
674 774
675ASN1_VISIBLESTRING * ASN1_VISIBLESTRING_new(void); 775DECLARE_ASN1_FUNCTIONS(ASN1_VISIBLESTRING)
676void ASN1_VISIBLESTRING_free(ASN1_VISIBLESTRING *a); 776DECLARE_ASN1_FUNCTIONS(ASN1_UTF8STRING)
677int i2d_ASN1_VISIBLESTRING(ASN1_VISIBLESTRING *a,unsigned char **pp); 777DECLARE_ASN1_FUNCTIONS(ASN1_NULL)
678ASN1_VISIBLESTRING *d2i_ASN1_VISIBLESTRING(ASN1_VISIBLESTRING **a, 778DECLARE_ASN1_FUNCTIONS(ASN1_BMPSTRING)
679 unsigned char **pp,long length);
680
681ASN1_UTF8STRING * ASN1_UTF8STRING_new(void);
682void ASN1_UTF8STRING_free(ASN1_UTF8STRING *a);
683int i2d_ASN1_UTF8STRING(ASN1_UTF8STRING *a,unsigned char **pp);
684ASN1_UTF8STRING *d2i_ASN1_UTF8STRING(ASN1_UTF8STRING **a,
685 unsigned char **pp,long length);
686
687ASN1_NULL * ASN1_NULL_new(void);
688void ASN1_NULL_free(ASN1_NULL *a);
689int i2d_ASN1_NULL(ASN1_NULL *a,unsigned char **pp);
690ASN1_NULL *d2i_ASN1_NULL(ASN1_NULL **a, unsigned char **pp,long length);
691
692ASN1_BMPSTRING * ASN1_BMPSTRING_new(void);
693void ASN1_BMPSTRING_free(ASN1_BMPSTRING *a);
694int i2d_ASN1_BMPSTRING(ASN1_BMPSTRING *a, unsigned char **pp);
695ASN1_BMPSTRING *d2i_ASN1_BMPSTRING(ASN1_BMPSTRING **a, unsigned char **pp,
696 long length);
697
698 779
699int UTF8_getc(const unsigned char *str, int len, unsigned long *val); 780int UTF8_getc(const unsigned char *str, int len, unsigned long *val);
700int UTF8_putc(unsigned char *str, int len, unsigned long value); 781int UTF8_putc(unsigned char *str, int len, unsigned long value);
701 782
702int i2d_ASN1_PRINTABLE(ASN1_STRING *a,unsigned char **pp); 783DECLARE_ASN1_FUNCTIONS_name(ASN1_STRING, ASN1_PRINTABLE)
703ASN1_STRING *d2i_ASN1_PRINTABLE(ASN1_STRING **a,
704 unsigned char **pp, long l);
705
706ASN1_PRINTABLESTRING * ASN1_PRINTABLESTRING_new(void);
707void ASN1_PRINTABLESTRING_free(ASN1_PRINTABLESTRING *a);
708ASN1_PRINTABLESTRING *d2i_ASN1_PRINTABLESTRING(ASN1_PRINTABLESTRING **a,
709 unsigned char **pp, long l);
710int i2d_ASN1_PRINTABLESTRING(ASN1_PRINTABLESTRING *a, unsigned char **pp);
711
712ASN1_STRING * DIRECTORYSTRING_new(void);
713void DIRECTORYSTRING_free(ASN1_STRING *a);
714int i2d_DIRECTORYSTRING(ASN1_STRING *a,unsigned char **pp);
715ASN1_STRING *d2i_DIRECTORYSTRING(ASN1_STRING **a, unsigned char **pp,
716 long length);
717
718ASN1_STRING * DISPLAYTEXT_new(void);
719void DISPLAYTEXT_free(ASN1_STRING *a);
720int i2d_DISPLAYTEXT(ASN1_STRING *a,unsigned char **pp);
721ASN1_STRING *d2i_DISPLAYTEXT(ASN1_STRING **a, unsigned char **pp, long length);
722
723ASN1_T61STRING * ASN1_T61STRING_new(void);
724void ASN1_T61STRING_free(ASN1_IA5STRING *a);
725ASN1_T61STRING *d2i_ASN1_T61STRING(ASN1_T61STRING **a,
726 unsigned char **pp, long l);
727
728ASN1_IA5STRING * ASN1_IA5STRING_new(void);
729void ASN1_IA5STRING_free(ASN1_IA5STRING *a);
730int i2d_ASN1_IA5STRING(ASN1_IA5STRING *a,unsigned char **pp);
731ASN1_IA5STRING *d2i_ASN1_IA5STRING(ASN1_IA5STRING **a,
732 unsigned char **pp, long l);
733
734ASN1_UTCTIME * ASN1_UTCTIME_new(void);
735void ASN1_UTCTIME_free(ASN1_UTCTIME *a);
736int i2d_ASN1_UTCTIME(ASN1_UTCTIME *a,unsigned char **pp);
737ASN1_UTCTIME * d2i_ASN1_UTCTIME(ASN1_UTCTIME **a,unsigned char **pp,
738 long length);
739 784
740ASN1_GENERALIZEDTIME * ASN1_GENERALIZEDTIME_new(void); 785DECLARE_ASN1_FUNCTIONS_name(ASN1_STRING, DIRECTORYSTRING)
741void ASN1_GENERALIZEDTIME_free(ASN1_GENERALIZEDTIME *a); 786DECLARE_ASN1_FUNCTIONS_name(ASN1_STRING, DISPLAYTEXT)
742int i2d_ASN1_GENERALIZEDTIME(ASN1_GENERALIZEDTIME *a,unsigned char **pp); 787DECLARE_ASN1_FUNCTIONS(ASN1_PRINTABLESTRING)
743ASN1_GENERALIZEDTIME * d2i_ASN1_GENERALIZEDTIME(ASN1_GENERALIZEDTIME **a,unsigned char **pp, 788DECLARE_ASN1_FUNCTIONS(ASN1_T61STRING)
744 long length); 789DECLARE_ASN1_FUNCTIONS(ASN1_IA5STRING)
790DECLARE_ASN1_FUNCTIONS(ASN1_GENERALSTRING)
791DECLARE_ASN1_FUNCTIONS(ASN1_UTCTIME)
792DECLARE_ASN1_FUNCTIONS(ASN1_GENERALIZEDTIME)
793DECLARE_ASN1_FUNCTIONS(ASN1_TIME)
745 794
746ASN1_TIME * ASN1_TIME_new(void);
747void ASN1_TIME_free(ASN1_TIME *a);
748int i2d_ASN1_TIME(ASN1_TIME *a,unsigned char **pp);
749ASN1_TIME * d2i_ASN1_TIME(ASN1_TIME **a,unsigned char **pp, long length);
750ASN1_TIME *ASN1_TIME_set(ASN1_TIME *s,time_t t); 795ASN1_TIME *ASN1_TIME_set(ASN1_TIME *s,time_t t);
796int ASN1_TIME_check(ASN1_TIME *t);
797ASN1_GENERALIZEDTIME *ASN1_TIME_to_generalizedtime(ASN1_TIME *t, ASN1_GENERALIZEDTIME **out);
751 798
752int i2d_ASN1_SET(STACK *a, unsigned char **pp, 799int i2d_ASN1_SET(STACK *a, unsigned char **pp,
753 int (*func)(), int ex_tag, int ex_class, int is_set); 800 int (*func)(), int ex_tag, int ex_class, int is_set);
@@ -755,7 +802,7 @@ STACK * d2i_ASN1_SET(STACK **a, unsigned char **pp, long length,
755 char *(*func)(), void (*free_func)(void *), 802 char *(*func)(), void (*free_func)(void *),
756 int ex_tag, int ex_class); 803 int ex_tag, int ex_class);
757 804
758#ifndef NO_BIO 805#ifndef OPENSSL_NO_BIO
759int i2a_ASN1_INTEGER(BIO *bp, ASN1_INTEGER *a); 806int i2a_ASN1_INTEGER(BIO *bp, ASN1_INTEGER *a);
760int a2i_ASN1_INTEGER(BIO *bp,ASN1_INTEGER *bs,char *buf,int size); 807int a2i_ASN1_INTEGER(BIO *bp,ASN1_INTEGER *bs,char *buf,int size);
761int i2a_ASN1_ENUMERATED(BIO *bp, ASN1_ENUMERATED *a); 808int i2a_ASN1_ENUMERATED(BIO *bp, ASN1_ENUMERATED *a);
@@ -768,7 +815,7 @@ int i2t_ASN1_OBJECT(char *buf,int buf_len,ASN1_OBJECT *a);
768 815
769int a2d_ASN1_OBJECT(unsigned char *out,int olen, const char *buf, int num); 816int a2d_ASN1_OBJECT(unsigned char *out,int olen, const char *buf, int num);
770ASN1_OBJECT *ASN1_OBJECT_create(int nid, unsigned char *data,int len, 817ASN1_OBJECT *ASN1_OBJECT_create(int nid, unsigned char *data,int len,
771 char *sn, char *ln); 818 const char *sn, const char *ln);
772 819
773int ASN1_INTEGER_set(ASN1_INTEGER *a, long v); 820int ASN1_INTEGER_set(ASN1_INTEGER *a, long v);
774long ASN1_INTEGER_get(ASN1_INTEGER *a); 821long ASN1_INTEGER_get(ASN1_INTEGER *a);
@@ -787,6 +834,7 @@ int ASN1_PRINTABLE_type(unsigned char *s, int max);
787int 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);
788ASN1_STRING *d2i_ASN1_bytes(ASN1_STRING **a, unsigned char **pp, 835ASN1_STRING *d2i_ASN1_bytes(ASN1_STRING **a, unsigned char **pp,
789 long length, int Ptag, int Pclass); 836 long length, int Ptag, int Pclass);
837unsigned long ASN1_tag2bit(int tag);
790/* type is one or more of the B_ASN1_ values. */ 838/* type is one or more of the B_ASN1_ values. */
791ASN1_STRING *d2i_ASN1_type_bytes(ASN1_STRING **a,unsigned char **pp, 839ASN1_STRING *d2i_ASN1_type_bytes(ASN1_STRING **a,unsigned char **pp,
792 long length,int type); 840 long length,int type);
@@ -805,17 +853,23 @@ int ASN1_object_size(int constructed, int length, int tag);
805/* Used to implement other functions */ 853/* Used to implement other functions */
806char *ASN1_dup(int (*i2d)(),char *(*d2i)(),char *x); 854char *ASN1_dup(int (*i2d)(),char *(*d2i)(),char *x);
807 855
808#ifndef NO_FP_API 856void *ASN1_item_dup(const ASN1_ITEM *it, void *x);
857
858#ifndef OPENSSL_NO_FP_API
809char *ASN1_d2i_fp(char *(*xnew)(),char *(*d2i)(),FILE *fp,unsigned char **x); 859char *ASN1_d2i_fp(char *(*xnew)(),char *(*d2i)(),FILE *fp,unsigned char **x);
860void *ASN1_item_d2i_fp(const ASN1_ITEM *it, FILE *in, void *x);
810int ASN1_i2d_fp(int (*i2d)(),FILE *out,unsigned char *x); 861int ASN1_i2d_fp(int (*i2d)(),FILE *out,unsigned char *x);
862int ASN1_item_i2d_fp(const ASN1_ITEM *it, FILE *out, void *x);
811int 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);
812#endif 864#endif
813 865
814int ASN1_STRING_to_UTF8(unsigned char **out, ASN1_STRING *in); 866int ASN1_STRING_to_UTF8(unsigned char **out, ASN1_STRING *in);
815 867
816#ifndef NO_BIO 868#ifndef OPENSSL_NO_BIO
817char *ASN1_d2i_bio(char *(*xnew)(),char *(*d2i)(),BIO *bp,unsigned char **x); 869char *ASN1_d2i_bio(char *(*xnew)(),char *(*d2i)(),BIO *bp,unsigned char **x);
870void *ASN1_item_d2i_bio(const ASN1_ITEM *it, BIO *in, void *x);
818int ASN1_i2d_bio(int (*i2d)(),BIO *out,unsigned char *x); 871int ASN1_i2d_bio(int (*i2d)(),BIO *out,unsigned char *x);
872int ASN1_item_i2d_bio(const ASN1_ITEM *it, BIO *out, void *x);
819int ASN1_UTCTIME_print(BIO *fp,ASN1_UTCTIME *a); 873int ASN1_UTCTIME_print(BIO *fp,ASN1_UTCTIME *a);
820int ASN1_GENERALIZEDTIME_print(BIO *fp,ASN1_GENERALIZEDTIME *a); 874int ASN1_GENERALIZEDTIME_print(BIO *fp,ASN1_GENERALIZEDTIME *a);
821int ASN1_TIME_print(BIO *fp,ASN1_TIME *a); 875int ASN1_TIME_print(BIO *fp,ASN1_TIME *a);
@@ -834,8 +888,6 @@ void ASN1_HEADER_free(ASN1_HEADER *a);
834 888
835int ASN1_UNIVERSALSTRING_to_string(ASN1_UNIVERSALSTRING *s); 889int ASN1_UNIVERSALSTRING_to_string(ASN1_UNIVERSALSTRING *s);
836 890
837void ERR_load_ASN1_strings(void);
838
839/* Not used that much at this point, except for the first two */ 891/* Not used that much at this point, except for the first two */
840ASN1_METHOD *X509_asn1_meth(void); 892ASN1_METHOD *X509_asn1_meth(void);
841ASN1_METHOD *RSAPrivateKey_asn1_meth(void); 893ASN1_METHOD *RSAPrivateKey_asn1_meth(void);
@@ -856,7 +908,9 @@ STACK *ASN1_seq_unpack(unsigned char *buf, int len, char *(*d2i)(),
856unsigned char *ASN1_seq_pack(STACK *safes, int (*i2d)(), unsigned char **buf, 908unsigned char *ASN1_seq_pack(STACK *safes, int (*i2d)(), unsigned char **buf,
857 int *len ); 909 int *len );
858void *ASN1_unpack_string(ASN1_STRING *oct, char *(*d2i)()); 910void *ASN1_unpack_string(ASN1_STRING *oct, char *(*d2i)());
911void *ASN1_item_unpack(ASN1_STRING *oct, const ASN1_ITEM *it);
859ASN1_STRING *ASN1_pack_string(void *obj, int (*i2d)(), ASN1_OCTET_STRING **oct); 912ASN1_STRING *ASN1_pack_string(void *obj, int (*i2d)(), ASN1_OCTET_STRING **oct);
913ASN1_STRING *ASN1_item_pack(void *obj, const ASN1_ITEM *it, ASN1_OCTET_STRING **oct);
860 914
861void ASN1_STRING_set_default_mask(unsigned long mask); 915void ASN1_STRING_set_default_mask(unsigned long mask);
862int ASN1_STRING_set_default_mask_asc(char *p); 916int ASN1_STRING_set_default_mask_asc(char *p);
@@ -873,279 +927,177 @@ ASN1_STRING_TABLE *ASN1_STRING_TABLE_get(int nid);
873int ASN1_STRING_TABLE_add(int, long, long, unsigned long, unsigned long); 927int ASN1_STRING_TABLE_add(int, long, long, unsigned long, unsigned long);
874void ASN1_STRING_TABLE_cleanup(void); 928void ASN1_STRING_TABLE_cleanup(void);
875 929
930/* ASN1 template functions */
931
932/* Old API compatible functions */
933ASN1_VALUE *ASN1_item_new(const ASN1_ITEM *it);
934void ASN1_item_free(ASN1_VALUE *val, const ASN1_ITEM *it);
935ASN1_VALUE * ASN1_item_d2i(ASN1_VALUE **val, unsigned char **in, long len, const ASN1_ITEM *it);
936int ASN1_item_i2d(ASN1_VALUE *val, unsigned char **out, const ASN1_ITEM *it);
937
938void ASN1_add_oid_module(void);
939
876/* BEGIN ERROR CODES */ 940/* BEGIN ERROR CODES */
877/* 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
878 * 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.
879 */ 943 */
944void ERR_load_ASN1_strings(void);
880 945
881/* Error codes for the ASN1 functions. */ 946/* Error codes for the ASN1 functions. */
882 947
883/* Function codes. */ 948/* Function codes. */
884#define ASN1_F_A2D_ASN1_OBJECT 100 949#define ASN1_F_A2D_ASN1_OBJECT 100
885#define ASN1_F_A2I_ASN1_ENUMERATED 236 950#define ASN1_F_A2I_ASN1_ENUMERATED 101
886#define ASN1_F_A2I_ASN1_INTEGER 101 951#define ASN1_F_A2I_ASN1_INTEGER 102
887#define ASN1_F_A2I_ASN1_STRING 102 952#define ASN1_F_A2I_ASN1_STRING 103
888#define ASN1_F_ACCESS_DESCRIPTION_NEW 291 953#define ASN1_F_ASN1_CHECK_TLEN 104
889#define ASN1_F_ASN1_COLLATE_PRIMITIVE 103 954#define ASN1_F_ASN1_COLLATE_PRIMITIVE 105
890#define ASN1_F_ASN1_D2I_BIO 104 955#define ASN1_F_ASN1_COLLECT 106
891#define ASN1_F_ASN1_D2I_FP 105 956#define ASN1_F_ASN1_D2I_BIO 107
892#define ASN1_F_ASN1_DUP 106 957#define ASN1_F_ASN1_D2I_EX_PRIMITIVE 108
893#define ASN1_F_ASN1_ENUMERATED_SET 232 958#define ASN1_F_ASN1_D2I_FP 109
894#define ASN1_F_ASN1_ENUMERATED_TO_BN 233 959#define ASN1_F_ASN1_DO_ADB 110
895#define ASN1_F_ASN1_GENERALIZEDTIME_NEW 222 960#define ASN1_F_ASN1_DUP 111
896#define ASN1_F_ASN1_GET_OBJECT 107 961#define ASN1_F_ASN1_ENUMERATED_SET 112
897#define ASN1_F_ASN1_HEADER_NEW 108 962#define ASN1_F_ASN1_ENUMERATED_TO_BN 113
898#define ASN1_F_ASN1_I2D_BIO 109 963#define ASN1_F_ASN1_GET_OBJECT 114
899#define ASN1_F_ASN1_I2D_FP 110 964#define ASN1_F_ASN1_HEADER_NEW 115
900#define ASN1_F_ASN1_INTEGER_SET 111 965#define ASN1_F_ASN1_I2D_BIO 116
901#define ASN1_F_ASN1_INTEGER_TO_BN 112 966#define ASN1_F_ASN1_I2D_FP 117
902#define ASN1_F_ASN1_MBSTRING_COPY 282 967#define ASN1_F_ASN1_INTEGER_SET 118
903#define ASN1_F_ASN1_OBJECT_NEW 113 968#define ASN1_F_ASN1_INTEGER_TO_BN 119
904#define ASN1_F_ASN1_PACK_STRING 245 969#define ASN1_F_ASN1_ITEM_EX_D2I 120
905#define ASN1_F_ASN1_PBE_SET 253 970#define ASN1_F_ASN1_ITEM_NEW 121
906#define ASN1_F_ASN1_SEQ_PACK 246 971#define ASN1_F_ASN1_MBSTRING_COPY 122
907#define ASN1_F_ASN1_SEQ_UNPACK 247 972#define ASN1_F_ASN1_OBJECT_NEW 123
908#define ASN1_F_ASN1_SIGN 114 973#define ASN1_F_ASN1_PACK_STRING 124
909#define ASN1_F_ASN1_STRING_NEW 115 974#define ASN1_F_ASN1_PBE_SET 125
910#define ASN1_F_ASN1_STRING_TABLE_ADD 283 975#define ASN1_F_ASN1_SEQ_PACK 126
911#define ASN1_F_ASN1_STRING_TYPE_NEW 116 976#define ASN1_F_ASN1_SEQ_UNPACK 127
912#define ASN1_F_ASN1_TYPE_GET_INT_OCTETSTRING 117 977#define ASN1_F_ASN1_SIGN 128
913#define ASN1_F_ASN1_TYPE_GET_OCTETSTRING 118 978#define ASN1_F_ASN1_STRING_TABLE_ADD 129
914#define ASN1_F_ASN1_TYPE_NEW 119 979#define ASN1_F_ASN1_STRING_TYPE_NEW 130
915#define ASN1_F_ASN1_UNPACK_STRING 248 980#define ASN1_F_ASN1_TEMPLATE_D2I 131
916#define ASN1_F_ASN1_UTCTIME_NEW 120 981#define ASN1_F_ASN1_TEMPLATE_EX_D2I 132
917#define ASN1_F_ASN1_VERIFY 121 982#define ASN1_F_ASN1_TEMPLATE_NEW 133
918#define ASN1_F_AUTHORITY_KEYID_NEW 237 983#define ASN1_F_ASN1_TYPE_GET_INT_OCTETSTRING 134
919#define ASN1_F_BASIC_CONSTRAINTS_NEW 226 984#define ASN1_F_ASN1_TYPE_GET_OCTETSTRING 135
920#define ASN1_F_BN_TO_ASN1_ENUMERATED 234 985#define ASN1_F_ASN1_UNPACK_STRING 136
921#define ASN1_F_BN_TO_ASN1_INTEGER 122 986#define ASN1_F_ASN1_VERIFY 137
922#define ASN1_F_D2I_ACCESS_DESCRIPTION 284 987#define ASN1_F_BN_TO_ASN1_ENUMERATED 138
923#define ASN1_F_D2I_ASN1_BIT_STRING 123 988#define ASN1_F_BN_TO_ASN1_INTEGER 139
924#define ASN1_F_D2I_ASN1_BMPSTRING 124 989#define ASN1_F_COLLECT_DATA 140
925#define ASN1_F_D2I_ASN1_BOOLEAN 125 990#define ASN1_F_D2I_ASN1_BIT_STRING 141
926#define ASN1_F_D2I_ASN1_BYTES 126 991#define ASN1_F_D2I_ASN1_BOOLEAN 142
927#define ASN1_F_D2I_ASN1_ENUMERATED 235 992#define ASN1_F_D2I_ASN1_BYTES 143
928#define ASN1_F_D2I_ASN1_GENERALIZEDTIME 223 993#define ASN1_F_D2I_ASN1_GENERALIZEDTIME 144
929#define ASN1_F_D2I_ASN1_HEADER 127 994#define ASN1_F_D2I_ASN1_HEADER 145
930#define ASN1_F_D2I_ASN1_INTEGER 128 995#define ASN1_F_D2I_ASN1_INTEGER 146
931#define ASN1_F_D2I_ASN1_NULL 292 996#define ASN1_F_D2I_ASN1_OBJECT 147
932#define ASN1_F_D2I_ASN1_OBJECT 129 997#define ASN1_F_D2I_ASN1_SET 148
933#define ASN1_F_D2I_ASN1_OCTET_STRING 130 998#define ASN1_F_D2I_ASN1_TYPE_BYTES 149
934#define ASN1_F_D2I_ASN1_PRINT_TYPE 131 999#define ASN1_F_D2I_ASN1_UINTEGER 150
935#define ASN1_F_D2I_ASN1_SET 132 1000#define ASN1_F_D2I_ASN1_UTCTIME 151
936#define ASN1_F_D2I_ASN1_TIME 224 1001#define ASN1_F_D2I_NETSCAPE_RSA 152
937#define ASN1_F_D2I_ASN1_TYPE 133 1002#define ASN1_F_D2I_NETSCAPE_RSA_2 153
938#define ASN1_F_D2I_ASN1_TYPE_BYTES 134 1003#define ASN1_F_D2I_PRIVATEKEY 154
939#define ASN1_F_D2I_ASN1_UINTEGER 280 1004#define ASN1_F_D2I_PUBLICKEY 155
940#define ASN1_F_D2I_ASN1_UTCTIME 135 1005#define ASN1_F_D2I_X509 156
941#define ASN1_F_D2I_ASN1_UTF8STRING 266 1006#define ASN1_F_D2I_X509_CINF 157
942#define ASN1_F_D2I_ASN1_VISIBLESTRING 267 1007#define ASN1_F_D2I_X509_NAME 158
943#define ASN1_F_D2I_AUTHORITY_KEYID 238 1008#define ASN1_F_D2I_X509_PKEY 159
944#define ASN1_F_D2I_BASIC_CONSTRAINTS 227 1009#define ASN1_F_I2D_ASN1_TIME 160
945#define ASN1_F_D2I_DHPARAMS 136 1010#define ASN1_F_I2D_DSA_PUBKEY 161
946#define ASN1_F_D2I_DIST_POINT 276 1011#define ASN1_F_I2D_NETSCAPE_RSA 162
947#define ASN1_F_D2I_DIST_POINT_NAME 277 1012#define ASN1_F_I2D_PRIVATEKEY 163
948#define ASN1_F_D2I_DSAPARAMS 137 1013#define ASN1_F_I2D_PUBLICKEY 164
949#define ASN1_F_D2I_DSAPRIVATEKEY 138 1014#define ASN1_F_I2D_RSA_PUBKEY 165
950#define ASN1_F_D2I_DSAPUBLICKEY 139 1015#define ASN1_F_LONG_C2I 166
951#define ASN1_F_D2I_GENERAL_NAME 230 1016#define ASN1_F_OID_MODULE_INIT 174
952#define ASN1_F_D2I_NETSCAPE_CERT_SEQUENCE 228 1017#define ASN1_F_PKCS5_PBE2_SET 167
953#define ASN1_F_D2I_NETSCAPE_PKEY 140 1018#define ASN1_F_X509_CINF_NEW 168
954#define ASN1_F_D2I_NETSCAPE_RSA 141 1019#define ASN1_F_X509_CRL_ADD0_REVOKED 169
955#define ASN1_F_D2I_NETSCAPE_RSA_2 142 1020#define ASN1_F_X509_INFO_NEW 170
956#define ASN1_F_D2I_NETSCAPE_SPKAC 143 1021#define ASN1_F_X509_NAME_NEW 171
957#define ASN1_F_D2I_NETSCAPE_SPKI 144 1022#define ASN1_F_X509_NEW 172
958#define ASN1_F_D2I_NOTICEREF 268 1023#define ASN1_F_X509_PKEY_NEW 173
959#define ASN1_F_D2I_OTHERNAME 287
960#define ASN1_F_D2I_PBE2PARAM 262
961#define ASN1_F_D2I_PBEPARAM 249
962#define ASN1_F_D2I_PBKDF2PARAM 263
963#define ASN1_F_D2I_PKCS12 254
964#define ASN1_F_D2I_PKCS12_BAGS 255
965#define ASN1_F_D2I_PKCS12_MAC_DATA 256
966#define ASN1_F_D2I_PKCS12_SAFEBAG 257
967#define ASN1_F_D2I_PKCS7 145
968#define ASN1_F_D2I_PKCS7_DIGEST 146
969#define ASN1_F_D2I_PKCS7_ENCRYPT 147
970#define ASN1_F_D2I_PKCS7_ENC_CONTENT 148
971#define ASN1_F_D2I_PKCS7_ENVELOPE 149
972#define ASN1_F_D2I_PKCS7_ISSUER_AND_SERIAL 150
973#define ASN1_F_D2I_PKCS7_RECIP_INFO 151
974#define ASN1_F_D2I_PKCS7_SIGNED 152
975#define ASN1_F_D2I_PKCS7_SIGNER_INFO 153
976#define ASN1_F_D2I_PKCS7_SIGN_ENVELOPE 154
977#define ASN1_F_D2I_PKCS8_PRIV_KEY_INFO 250
978#define ASN1_F_D2I_PKEY_USAGE_PERIOD 239
979#define ASN1_F_D2I_POLICYINFO 269
980#define ASN1_F_D2I_POLICYQUALINFO 270
981#define ASN1_F_D2I_PRIVATEKEY 155
982#define ASN1_F_D2I_PUBLICKEY 156
983#define ASN1_F_D2I_RSAPRIVATEKEY 157
984#define ASN1_F_D2I_RSAPUBLICKEY 158
985#define ASN1_F_D2I_SXNET 241
986#define ASN1_F_D2I_SXNETID 243
987#define ASN1_F_D2I_USERNOTICE 271
988#define ASN1_F_D2I_X509 159
989#define ASN1_F_D2I_X509_ALGOR 160
990#define ASN1_F_D2I_X509_ATTRIBUTE 161
991#define ASN1_F_D2I_X509_CERT_AUX 285
992#define ASN1_F_D2I_X509_CINF 162
993#define ASN1_F_D2I_X509_CRL 163
994#define ASN1_F_D2I_X509_CRL_INFO 164
995#define ASN1_F_D2I_X509_EXTENSION 165
996#define ASN1_F_D2I_X509_KEY 166
997#define ASN1_F_D2I_X509_NAME 167
998#define ASN1_F_D2I_X509_NAME_ENTRY 168
999#define ASN1_F_D2I_X509_PKEY 169
1000#define ASN1_F_D2I_X509_PUBKEY 170
1001#define ASN1_F_D2I_X509_REQ 171
1002#define ASN1_F_D2I_X509_REQ_INFO 172
1003#define ASN1_F_D2I_X509_REVOKED 173
1004#define ASN1_F_D2I_X509_SIG 174
1005#define ASN1_F_D2I_X509_VAL 175
1006#define ASN1_F_DIST_POINT_NAME_NEW 278
1007#define ASN1_F_DIST_POINT_NEW 279
1008#define ASN1_F_GENERAL_NAME_NEW 231
1009#define ASN1_F_I2D_ASN1_HEADER 176
1010#define ASN1_F_I2D_ASN1_TIME 225
1011#define ASN1_F_I2D_DHPARAMS 177
1012#define ASN1_F_I2D_DSAPARAMS 178
1013#define ASN1_F_I2D_DSAPRIVATEKEY 179
1014#define ASN1_F_I2D_DSAPUBLICKEY 180
1015#define ASN1_F_I2D_DSA_PUBKEY 290
1016#define ASN1_F_I2D_NETSCAPE_RSA 181
1017#define ASN1_F_I2D_PKCS7 182
1018#define ASN1_F_I2D_PRIVATEKEY 183
1019#define ASN1_F_I2D_PUBLICKEY 184
1020#define ASN1_F_I2D_RSAPRIVATEKEY 185
1021#define ASN1_F_I2D_RSAPUBLICKEY 186
1022#define ASN1_F_I2D_RSA_PUBKEY 289
1023#define ASN1_F_I2D_X509_ATTRIBUTE 187
1024#define ASN1_F_I2T_ASN1_OBJECT 188
1025#define ASN1_F_NETSCAPE_CERT_SEQUENCE_NEW 229
1026#define ASN1_F_NETSCAPE_PKEY_NEW 189
1027#define ASN1_F_NETSCAPE_SPKAC_NEW 190
1028#define ASN1_F_NETSCAPE_SPKI_NEW 191
1029#define ASN1_F_NOTICEREF_NEW 272
1030#define ASN1_F_OTHERNAME_NEW 288
1031#define ASN1_F_PBE2PARAM_NEW 264
1032#define ASN1_F_PBEPARAM_NEW 251
1033#define ASN1_F_PBKDF2PARAM_NEW 265
1034#define ASN1_F_PKCS12_BAGS_NEW 258
1035#define ASN1_F_PKCS12_MAC_DATA_NEW 259
1036#define ASN1_F_PKCS12_NEW 260
1037#define ASN1_F_PKCS12_SAFEBAG_NEW 261
1038#define ASN1_F_PKCS5_PBE2_SET 281
1039#define ASN1_F_PKCS7_DIGEST_NEW 192
1040#define ASN1_F_PKCS7_ENCRYPT_NEW 193
1041#define ASN1_F_PKCS7_ENC_CONTENT_NEW 194
1042#define ASN1_F_PKCS7_ENVELOPE_NEW 195
1043#define ASN1_F_PKCS7_ISSUER_AND_SERIAL_NEW 196
1044#define ASN1_F_PKCS7_NEW 197
1045#define ASN1_F_PKCS7_RECIP_INFO_NEW 198
1046#define ASN1_F_PKCS7_SIGNED_NEW 199
1047#define ASN1_F_PKCS7_SIGNER_INFO_NEW 200
1048#define ASN1_F_PKCS7_SIGN_ENVELOPE_NEW 201
1049#define ASN1_F_PKCS8_PRIV_KEY_INFO_NEW 252
1050#define ASN1_F_PKEY_USAGE_PERIOD_NEW 240
1051#define ASN1_F_POLICYINFO_NEW 273
1052#define ASN1_F_POLICYQUALINFO_NEW 274
1053#define ASN1_F_SXNETID_NEW 244
1054#define ASN1_F_SXNET_NEW 242
1055#define ASN1_F_USERNOTICE_NEW 275
1056#define ASN1_F_X509_ALGOR_NEW 202
1057#define ASN1_F_X509_ATTRIBUTE_NEW 203
1058#define ASN1_F_X509_CERT_AUX_NEW 286
1059#define ASN1_F_X509_CINF_NEW 204
1060#define ASN1_F_X509_CRL_INFO_NEW 205
1061#define ASN1_F_X509_CRL_NEW 206
1062#define ASN1_F_X509_DHPARAMS_NEW 207
1063#define ASN1_F_X509_EXTENSION_NEW 208
1064#define ASN1_F_X509_INFO_NEW 209
1065#define ASN1_F_X509_KEY_NEW 210
1066#define ASN1_F_X509_NAME_ENTRY_NEW 211
1067#define ASN1_F_X509_NAME_NEW 212
1068#define ASN1_F_X509_NEW 213
1069#define ASN1_F_X509_PKEY_NEW 214
1070#define ASN1_F_X509_PUBKEY_NEW 215
1071#define ASN1_F_X509_REQ_INFO_NEW 216
1072#define ASN1_F_X509_REQ_NEW 217
1073#define ASN1_F_X509_REVOKED_NEW 218
1074#define ASN1_F_X509_SIG_NEW 219
1075#define ASN1_F_X509_VAL_FREE 220
1076#define ASN1_F_X509_VAL_NEW 221
1077 1024
1078/* Reason codes. */ 1025/* Reason codes. */
1079#define ASN1_R_BAD_CLASS 100 1026#define ASN1_R_ADDING_OBJECT 171
1080#define ASN1_R_BAD_OBJECT_HEADER 101 1027#define ASN1_R_AUX_ERROR 100
1081#define ASN1_R_BAD_PASSWORD_READ 102 1028#define ASN1_R_BAD_CLASS 101
1082#define ASN1_R_BAD_PKCS7_CONTENT 103 1029#define ASN1_R_BAD_OBJECT_HEADER 102
1083#define ASN1_R_BAD_PKCS7_TYPE 104 1030#define ASN1_R_BAD_PASSWORD_READ 103
1084#define ASN1_R_BAD_TAG 105 1031#define ASN1_R_BAD_TAG 104
1085#define ASN1_R_BAD_TYPE 106 1032#define ASN1_R_BN_LIB 105
1086#define ASN1_R_BN_LIB 107 1033#define ASN1_R_BOOLEAN_IS_WRONG_LENGTH 106
1087#define ASN1_R_BOOLEAN_IS_WRONG_LENGTH 108 1034#define ASN1_R_BUFFER_TOO_SMALL 107
1088#define ASN1_R_BUFFER_TOO_SMALL 109 1035#define ASN1_R_CIPHER_HAS_NO_OBJECT_IDENTIFIER 108
1089#define ASN1_R_CIPHER_HAS_NO_OBJECT_IDENTIFIER 166 1036#define ASN1_R_DATA_IS_WRONG 109
1090#define ASN1_R_DATA_IS_WRONG 110 1037#define ASN1_R_DECODE_ERROR 110
1091#define ASN1_R_DECODE_ERROR 155
1092#define ASN1_R_DECODING_ERROR 111 1038#define ASN1_R_DECODING_ERROR 111
1093#define ASN1_R_ENCODE_ERROR 156 1039#define ASN1_R_ENCODE_ERROR 112
1094#define ASN1_R_ERROR_PARSING_SET_ELEMENT 112 1040#define ASN1_R_ERROR_LOADING_SECTION 172
1095#define ASN1_R_ERROR_SETTING_CIPHER_PARAMS 157 1041#define ASN1_R_ERROR_PARSING_SET_ELEMENT 113
1096#define ASN1_R_EXPECTING_AN_ENUMERATED 154 1042#define ASN1_R_ERROR_SETTING_CIPHER_PARAMS 114
1097#define ASN1_R_EXPECTING_AN_INTEGER 113 1043#define ASN1_R_EXPECTING_AN_INTEGER 115
1098#define ASN1_R_EXPECTING_AN_OBJECT 114 1044#define ASN1_R_EXPECTING_AN_OBJECT 116
1099#define ASN1_R_EXPECTING_AN_OCTET_STRING 115
1100#define ASN1_R_EXPECTING_A_BIT_STRING 116
1101#define ASN1_R_EXPECTING_A_BOOLEAN 117 1045#define ASN1_R_EXPECTING_A_BOOLEAN 117
1102#define ASN1_R_EXPECTING_A_GENERALIZEDTIME 151 1046#define ASN1_R_EXPECTING_A_TIME 118
1103#define ASN1_R_EXPECTING_A_NULL 164 1047#define ASN1_R_EXPLICIT_LENGTH_MISMATCH 119
1104#define ASN1_R_EXPECTING_A_TIME 152 1048#define ASN1_R_EXPLICIT_TAG_NOT_CONSTRUCTED 120
1105#define ASN1_R_EXPECTING_A_UTCTIME 118 1049#define ASN1_R_FIELD_MISSING 121
1106#define ASN1_R_FIRST_NUM_TOO_LARGE 119 1050#define ASN1_R_FIRST_NUM_TOO_LARGE 122
1107#define ASN1_R_GENERALIZEDTIME_TOO_LONG 153 1051#define ASN1_R_HEADER_TOO_LONG 123
1108#define ASN1_R_HEADER_TOO_LONG 120 1052#define ASN1_R_ILLEGAL_CHARACTERS 124
1109#define ASN1_R_ILLEGAL_CHARACTERS 158 1053#define ASN1_R_ILLEGAL_NULL 125
1110#define ASN1_R_INVALID_BMPSTRING_LENGTH 159 1054#define ASN1_R_ILLEGAL_OPTIONAL_ANY 126
1111#define ASN1_R_INVALID_DIGIT 121 1055#define ASN1_R_ILLEGAL_OPTIONS_ON_ITEM_TEMPLATE 170
1112#define ASN1_R_INVALID_SEPARATOR 122 1056#define ASN1_R_ILLEGAL_TAGGED_ANY 127
1113#define ASN1_R_INVALID_TIME_FORMAT 123 1057#define ASN1_R_INTEGER_TOO_LARGE_FOR_LONG 128
1114#define ASN1_R_INVALID_UNIVERSALSTRING_LENGTH 160 1058#define ASN1_R_INVALID_BMPSTRING_LENGTH 129
1115#define ASN1_R_INVALID_UTF8STRING 161 1059#define ASN1_R_INVALID_DIGIT 130
1116#define ASN1_R_IV_TOO_LARGE 124 1060#define ASN1_R_INVALID_SEPARATOR 131
1117#define ASN1_R_LENGTH_ERROR 125 1061#define ASN1_R_INVALID_TIME_FORMAT 132
1118#define ASN1_R_MISSING_SECOND_NUMBER 126 1062#define ASN1_R_INVALID_UNIVERSALSTRING_LENGTH 133
1119#define ASN1_R_NON_HEX_CHARACTERS 127 1063#define ASN1_R_INVALID_UTF8STRING 134
1120#define ASN1_R_NOT_ENOUGH_DATA 128 1064#define ASN1_R_IV_TOO_LARGE 135
1121#define ASN1_R_NULL_IS_WRONG_LENGTH 165 1065#define ASN1_R_LENGTH_ERROR 136
1122#define ASN1_R_ODD_NUMBER_OF_CHARS 129 1066#define ASN1_R_MISSING_EOC 137
1123#define ASN1_R_PARSING 130 1067#define ASN1_R_MISSING_SECOND_NUMBER 138
1124#define ASN1_R_PRIVATE_KEY_HEADER_MISSING 131 1068#define ASN1_R_MSTRING_NOT_UNIVERSAL 139
1125#define ASN1_R_SECOND_NUMBER_TOO_LARGE 132 1069#define ASN1_R_MSTRING_WRONG_TAG 140
1126#define ASN1_R_SHORT_LINE 133 1070#define ASN1_R_NON_HEX_CHARACTERS 141
1127#define ASN1_R_STRING_TOO_LONG 163 1071#define ASN1_R_NOT_ENOUGH_DATA 142
1128#define ASN1_R_STRING_TOO_SHORT 134 1072#define ASN1_R_NO_MATCHING_CHOICE_TYPE 143
1129#define ASN1_R_TAG_VALUE_TOO_HIGH 135 1073#define ASN1_R_NULL_IS_WRONG_LENGTH 144
1130#define ASN1_R_THE_ASN1_OBJECT_IDENTIFIER_IS_NOT_KNOWN_FOR_THIS_MD 136 1074#define ASN1_R_ODD_NUMBER_OF_CHARS 145
1131#define ASN1_R_TOO_LONG 137 1075#define ASN1_R_PRIVATE_KEY_HEADER_MISSING 146
1132#define ASN1_R_UNABLE_TO_DECODE_RSA_KEY 138 1076#define ASN1_R_SECOND_NUMBER_TOO_LARGE 147
1133#define ASN1_R_UNABLE_TO_DECODE_RSA_PRIVATE_KEY 139 1077#define ASN1_R_SEQUENCE_LENGTH_MISMATCH 148
1134#define ASN1_R_UNKNOWN_ATTRIBUTE_TYPE 140 1078#define ASN1_R_SEQUENCE_NOT_CONSTRUCTED 149
1135#define ASN1_R_UNKNOWN_FORMAT 162 1079#define ASN1_R_SHORT_LINE 150
1136#define ASN1_R_UNKNOWN_MESSAGE_DIGEST_ALGORITHM 141 1080#define ASN1_R_STRING_TOO_LONG 151
1137#define ASN1_R_UNKNOWN_OBJECT_TYPE 142 1081#define ASN1_R_STRING_TOO_SHORT 152
1138#define ASN1_R_UNKNOWN_PUBLIC_KEY_TYPE 143 1082#define ASN1_R_TAG_VALUE_TOO_HIGH 153
1139#define ASN1_R_UNSUPPORTED_CIPHER 144 1083#define ASN1_R_THE_ASN1_OBJECT_IDENTIFIER_IS_NOT_KNOWN_FOR_THIS_MD 154
1140#define ASN1_R_UNSUPPORTED_ENCRYPTION_ALGORITHM 145 1084#define ASN1_R_TOO_LONG 155
1141#define ASN1_R_UNSUPPORTED_PUBLIC_KEY_TYPE 146 1085#define ASN1_R_TYPE_NOT_CONSTRUCTED 156
1142#define ASN1_R_UTCTIME_TOO_LONG 147 1086#define ASN1_R_UNABLE_TO_DECODE_RSA_KEY 157
1143#define ASN1_R_WRONG_PRINTABLE_TYPE 148 1087#define ASN1_R_UNABLE_TO_DECODE_RSA_PRIVATE_KEY 158
1144#define ASN1_R_WRONG_TAG 149 1088#define ASN1_R_UNEXPECTED_EOC 159
1145#define ASN1_R_WRONG_TYPE 150 1089#define ASN1_R_UNKNOWN_FORMAT 160
1090#define ASN1_R_UNKNOWN_MESSAGE_DIGEST_ALGORITHM 161
1091#define ASN1_R_UNKNOWN_OBJECT_TYPE 162
1092#define ASN1_R_UNKNOWN_PUBLIC_KEY_TYPE 163
1093#define ASN1_R_UNSUPPORTED_ANY_DEFINED_BY_TYPE 164
1094#define ASN1_R_UNSUPPORTED_CIPHER 165
1095#define ASN1_R_UNSUPPORTED_ENCRYPTION_ALGORITHM 166
1096#define ASN1_R_UNSUPPORTED_PUBLIC_KEY_TYPE 167
1097#define ASN1_R_WRONG_TAG 168
1098#define ASN1_R_WRONG_TYPE 169
1146 1099
1147#ifdef __cplusplus 1100#ifdef __cplusplus
1148} 1101}
1149#endif 1102#endif
1150#endif 1103#endif
1151
diff --git a/src/lib/libcrypto/asn1/asn1_err.c b/src/lib/libcrypto/asn1/asn1_err.c
index cecd555c88..c4c3d2a91d 100644
--- a/src/lib/libcrypto/asn1/asn1_err.c
+++ b/src/lib/libcrypto/asn1/asn1_err.c
@@ -63,27 +63,31 @@
63#include <openssl/asn1.h> 63#include <openssl/asn1.h>
64 64
65/* BEGIN ERROR CODES */ 65/* BEGIN ERROR CODES */
66#ifndef NO_ERR 66#ifndef OPENSSL_NO_ERR
67static ERR_STRING_DATA ASN1_str_functs[]= 67static ERR_STRING_DATA ASN1_str_functs[]=
68 { 68 {
69{ERR_PACK(0,ASN1_F_A2D_ASN1_OBJECT,0), "a2d_ASN1_OBJECT"}, 69{ERR_PACK(0,ASN1_F_A2D_ASN1_OBJECT,0), "a2d_ASN1_OBJECT"},
70{ERR_PACK(0,ASN1_F_A2I_ASN1_ENUMERATED,0), "a2i_ASN1_ENUMERATED"}, 70{ERR_PACK(0,ASN1_F_A2I_ASN1_ENUMERATED,0), "a2i_ASN1_ENUMERATED"},
71{ERR_PACK(0,ASN1_F_A2I_ASN1_INTEGER,0), "a2i_ASN1_INTEGER"}, 71{ERR_PACK(0,ASN1_F_A2I_ASN1_INTEGER,0), "a2i_ASN1_INTEGER"},
72{ERR_PACK(0,ASN1_F_A2I_ASN1_STRING,0), "a2i_ASN1_STRING"}, 72{ERR_PACK(0,ASN1_F_A2I_ASN1_STRING,0), "a2i_ASN1_STRING"},
73{ERR_PACK(0,ASN1_F_ACCESS_DESCRIPTION_NEW,0), "ACCESS_DESCRIPTION_new"}, 73{ERR_PACK(0,ASN1_F_ASN1_CHECK_TLEN,0), "ASN1_CHECK_TLEN"},
74{ERR_PACK(0,ASN1_F_ASN1_COLLATE_PRIMITIVE,0), "ASN1_COLLATE_PRIMITIVE"}, 74{ERR_PACK(0,ASN1_F_ASN1_COLLATE_PRIMITIVE,0), "ASN1_COLLATE_PRIMITIVE"},
75{ERR_PACK(0,ASN1_F_ASN1_COLLECT,0), "ASN1_COLLECT"},
75{ERR_PACK(0,ASN1_F_ASN1_D2I_BIO,0), "ASN1_d2i_bio"}, 76{ERR_PACK(0,ASN1_F_ASN1_D2I_BIO,0), "ASN1_d2i_bio"},
77{ERR_PACK(0,ASN1_F_ASN1_D2I_EX_PRIMITIVE,0), "ASN1_D2I_EX_PRIMITIVE"},
76{ERR_PACK(0,ASN1_F_ASN1_D2I_FP,0), "ASN1_d2i_fp"}, 78{ERR_PACK(0,ASN1_F_ASN1_D2I_FP,0), "ASN1_d2i_fp"},
79{ERR_PACK(0,ASN1_F_ASN1_DO_ADB,0), "ASN1_DO_ADB"},
77{ERR_PACK(0,ASN1_F_ASN1_DUP,0), "ASN1_dup"}, 80{ERR_PACK(0,ASN1_F_ASN1_DUP,0), "ASN1_dup"},
78{ERR_PACK(0,ASN1_F_ASN1_ENUMERATED_SET,0), "ASN1_ENUMERATED_set"}, 81{ERR_PACK(0,ASN1_F_ASN1_ENUMERATED_SET,0), "ASN1_ENUMERATED_set"},
79{ERR_PACK(0,ASN1_F_ASN1_ENUMERATED_TO_BN,0), "ASN1_ENUMERATED_to_BN"}, 82{ERR_PACK(0,ASN1_F_ASN1_ENUMERATED_TO_BN,0), "ASN1_ENUMERATED_to_BN"},
80{ERR_PACK(0,ASN1_F_ASN1_GENERALIZEDTIME_NEW,0), "ASN1_GENERALIZEDTIME_new"},
81{ERR_PACK(0,ASN1_F_ASN1_GET_OBJECT,0), "ASN1_get_object"}, 83{ERR_PACK(0,ASN1_F_ASN1_GET_OBJECT,0), "ASN1_get_object"},
82{ERR_PACK(0,ASN1_F_ASN1_HEADER_NEW,0), "ASN1_HEADER_new"}, 84{ERR_PACK(0,ASN1_F_ASN1_HEADER_NEW,0), "ASN1_HEADER_new"},
83{ERR_PACK(0,ASN1_F_ASN1_I2D_BIO,0), "ASN1_i2d_bio"}, 85{ERR_PACK(0,ASN1_F_ASN1_I2D_BIO,0), "ASN1_i2d_bio"},
84{ERR_PACK(0,ASN1_F_ASN1_I2D_FP,0), "ASN1_i2d_fp"}, 86{ERR_PACK(0,ASN1_F_ASN1_I2D_FP,0), "ASN1_i2d_fp"},
85{ERR_PACK(0,ASN1_F_ASN1_INTEGER_SET,0), "ASN1_INTEGER_set"}, 87{ERR_PACK(0,ASN1_F_ASN1_INTEGER_SET,0), "ASN1_INTEGER_set"},
86{ERR_PACK(0,ASN1_F_ASN1_INTEGER_TO_BN,0), "ASN1_INTEGER_to_BN"}, 88{ERR_PACK(0,ASN1_F_ASN1_INTEGER_TO_BN,0), "ASN1_INTEGER_to_BN"},
89{ERR_PACK(0,ASN1_F_ASN1_ITEM_EX_D2I,0), "ASN1_ITEM_EX_D2I"},
90{ERR_PACK(0,ASN1_F_ASN1_ITEM_NEW,0), "ASN1_item_new"},
87{ERR_PACK(0,ASN1_F_ASN1_MBSTRING_COPY,0), "ASN1_mbstring_copy"}, 91{ERR_PACK(0,ASN1_F_ASN1_MBSTRING_COPY,0), "ASN1_mbstring_copy"},
88{ERR_PACK(0,ASN1_F_ASN1_OBJECT_NEW,0), "ASN1_OBJECT_new"}, 92{ERR_PACK(0,ASN1_F_ASN1_OBJECT_NEW,0), "ASN1_OBJECT_new"},
89{ERR_PACK(0,ASN1_F_ASN1_PACK_STRING,0), "ASN1_pack_string"}, 93{ERR_PACK(0,ASN1_F_ASN1_PACK_STRING,0), "ASN1_pack_string"},
@@ -91,186 +95,63 @@ static ERR_STRING_DATA ASN1_str_functs[]=
91{ERR_PACK(0,ASN1_F_ASN1_SEQ_PACK,0), "ASN1_seq_pack"}, 95{ERR_PACK(0,ASN1_F_ASN1_SEQ_PACK,0), "ASN1_seq_pack"},
92{ERR_PACK(0,ASN1_F_ASN1_SEQ_UNPACK,0), "ASN1_seq_unpack"}, 96{ERR_PACK(0,ASN1_F_ASN1_SEQ_UNPACK,0), "ASN1_seq_unpack"},
93{ERR_PACK(0,ASN1_F_ASN1_SIGN,0), "ASN1_sign"}, 97{ERR_PACK(0,ASN1_F_ASN1_SIGN,0), "ASN1_sign"},
94{ERR_PACK(0,ASN1_F_ASN1_STRING_NEW,0), "ASN1_STRING_new"},
95{ERR_PACK(0,ASN1_F_ASN1_STRING_TABLE_ADD,0), "ASN1_STRING_TABLE_add"}, 98{ERR_PACK(0,ASN1_F_ASN1_STRING_TABLE_ADD,0), "ASN1_STRING_TABLE_add"},
96{ERR_PACK(0,ASN1_F_ASN1_STRING_TYPE_NEW,0), "ASN1_STRING_type_new"}, 99{ERR_PACK(0,ASN1_F_ASN1_STRING_TYPE_NEW,0), "ASN1_STRING_type_new"},
100{ERR_PACK(0,ASN1_F_ASN1_TEMPLATE_D2I,0), "ASN1_TEMPLATE_D2I"},
101{ERR_PACK(0,ASN1_F_ASN1_TEMPLATE_EX_D2I,0), "ASN1_TEMPLATE_EX_D2I"},
102{ERR_PACK(0,ASN1_F_ASN1_TEMPLATE_NEW,0), "ASN1_TEMPLATE_NEW"},
97{ERR_PACK(0,ASN1_F_ASN1_TYPE_GET_INT_OCTETSTRING,0), "ASN1_TYPE_get_int_octetstring"}, 103{ERR_PACK(0,ASN1_F_ASN1_TYPE_GET_INT_OCTETSTRING,0), "ASN1_TYPE_get_int_octetstring"},
98{ERR_PACK(0,ASN1_F_ASN1_TYPE_GET_OCTETSTRING,0), "ASN1_TYPE_get_octetstring"}, 104{ERR_PACK(0,ASN1_F_ASN1_TYPE_GET_OCTETSTRING,0), "ASN1_TYPE_get_octetstring"},
99{ERR_PACK(0,ASN1_F_ASN1_TYPE_NEW,0), "ASN1_TYPE_new"},
100{ERR_PACK(0,ASN1_F_ASN1_UNPACK_STRING,0), "ASN1_unpack_string"}, 105{ERR_PACK(0,ASN1_F_ASN1_UNPACK_STRING,0), "ASN1_unpack_string"},
101{ERR_PACK(0,ASN1_F_ASN1_UTCTIME_NEW,0), "ASN1_UTCTIME_new"},
102{ERR_PACK(0,ASN1_F_ASN1_VERIFY,0), "ASN1_verify"}, 106{ERR_PACK(0,ASN1_F_ASN1_VERIFY,0), "ASN1_verify"},
103{ERR_PACK(0,ASN1_F_AUTHORITY_KEYID_NEW,0), "AUTHORITY_KEYID_new"},
104{ERR_PACK(0,ASN1_F_BASIC_CONSTRAINTS_NEW,0), "BASIC_CONSTRAINTS_new"},
105{ERR_PACK(0,ASN1_F_BN_TO_ASN1_ENUMERATED,0), "BN_to_ASN1_ENUMERATED"}, 107{ERR_PACK(0,ASN1_F_BN_TO_ASN1_ENUMERATED,0), "BN_to_ASN1_ENUMERATED"},
106{ERR_PACK(0,ASN1_F_BN_TO_ASN1_INTEGER,0), "BN_to_ASN1_INTEGER"}, 108{ERR_PACK(0,ASN1_F_BN_TO_ASN1_INTEGER,0), "BN_to_ASN1_INTEGER"},
107{ERR_PACK(0,ASN1_F_D2I_ACCESS_DESCRIPTION,0), "d2i_ACCESS_DESCRIPTION"}, 109{ERR_PACK(0,ASN1_F_COLLECT_DATA,0), "COLLECT_DATA"},
108{ERR_PACK(0,ASN1_F_D2I_ASN1_BIT_STRING,0), "d2i_ASN1_BIT_STRING"}, 110{ERR_PACK(0,ASN1_F_D2I_ASN1_BIT_STRING,0), "D2I_ASN1_BIT_STRING"},
109{ERR_PACK(0,ASN1_F_D2I_ASN1_BMPSTRING,0), "d2i_ASN1_BMPSTRING"},
110{ERR_PACK(0,ASN1_F_D2I_ASN1_BOOLEAN,0), "d2i_ASN1_BOOLEAN"}, 111{ERR_PACK(0,ASN1_F_D2I_ASN1_BOOLEAN,0), "d2i_ASN1_BOOLEAN"},
111{ERR_PACK(0,ASN1_F_D2I_ASN1_BYTES,0), "d2i_ASN1_bytes"}, 112{ERR_PACK(0,ASN1_F_D2I_ASN1_BYTES,0), "d2i_ASN1_bytes"},
112{ERR_PACK(0,ASN1_F_D2I_ASN1_ENUMERATED,0), "d2i_ASN1_ENUMERATED"}, 113{ERR_PACK(0,ASN1_F_D2I_ASN1_GENERALIZEDTIME,0), "D2I_ASN1_GENERALIZEDTIME"},
113{ERR_PACK(0,ASN1_F_D2I_ASN1_GENERALIZEDTIME,0), "d2i_ASN1_GENERALIZEDTIME"},
114{ERR_PACK(0,ASN1_F_D2I_ASN1_HEADER,0), "d2i_ASN1_HEADER"}, 114{ERR_PACK(0,ASN1_F_D2I_ASN1_HEADER,0), "d2i_ASN1_HEADER"},
115{ERR_PACK(0,ASN1_F_D2I_ASN1_INTEGER,0), "d2i_ASN1_INTEGER"}, 115{ERR_PACK(0,ASN1_F_D2I_ASN1_INTEGER,0), "D2I_ASN1_INTEGER"},
116{ERR_PACK(0,ASN1_F_D2I_ASN1_NULL,0), "d2i_ASN1_NULL"},
117{ERR_PACK(0,ASN1_F_D2I_ASN1_OBJECT,0), "d2i_ASN1_OBJECT"}, 116{ERR_PACK(0,ASN1_F_D2I_ASN1_OBJECT,0), "d2i_ASN1_OBJECT"},
118{ERR_PACK(0,ASN1_F_D2I_ASN1_OCTET_STRING,0), "d2i_ASN1_OCTET_STRING"},
119{ERR_PACK(0,ASN1_F_D2I_ASN1_PRINT_TYPE,0), "D2I_ASN1_PRINT_TYPE"},
120{ERR_PACK(0,ASN1_F_D2I_ASN1_SET,0), "d2i_ASN1_SET"}, 117{ERR_PACK(0,ASN1_F_D2I_ASN1_SET,0), "d2i_ASN1_SET"},
121{ERR_PACK(0,ASN1_F_D2I_ASN1_TIME,0), "d2i_ASN1_TIME"},
122{ERR_PACK(0,ASN1_F_D2I_ASN1_TYPE,0), "d2i_ASN1_TYPE"},
123{ERR_PACK(0,ASN1_F_D2I_ASN1_TYPE_BYTES,0), "d2i_ASN1_type_bytes"}, 118{ERR_PACK(0,ASN1_F_D2I_ASN1_TYPE_BYTES,0), "d2i_ASN1_type_bytes"},
124{ERR_PACK(0,ASN1_F_D2I_ASN1_UINTEGER,0), "d2i_ASN1_UINTEGER"}, 119{ERR_PACK(0,ASN1_F_D2I_ASN1_UINTEGER,0), "d2i_ASN1_UINTEGER"},
125{ERR_PACK(0,ASN1_F_D2I_ASN1_UTCTIME,0), "d2i_ASN1_UTCTIME"}, 120{ERR_PACK(0,ASN1_F_D2I_ASN1_UTCTIME,0), "D2I_ASN1_UTCTIME"},
126{ERR_PACK(0,ASN1_F_D2I_ASN1_UTF8STRING,0), "d2i_ASN1_UTF8STRING"},
127{ERR_PACK(0,ASN1_F_D2I_ASN1_VISIBLESTRING,0), "d2i_ASN1_VISIBLESTRING"},
128{ERR_PACK(0,ASN1_F_D2I_AUTHORITY_KEYID,0), "d2i_AUTHORITY_KEYID"},
129{ERR_PACK(0,ASN1_F_D2I_BASIC_CONSTRAINTS,0), "d2i_BASIC_CONSTRAINTS"},
130{ERR_PACK(0,ASN1_F_D2I_DHPARAMS,0), "d2i_DHparams"},
131{ERR_PACK(0,ASN1_F_D2I_DIST_POINT,0), "d2i_DIST_POINT"},
132{ERR_PACK(0,ASN1_F_D2I_DIST_POINT_NAME,0), "d2i_DIST_POINT_NAME"},
133{ERR_PACK(0,ASN1_F_D2I_DSAPARAMS,0), "d2i_DSAparams"},
134{ERR_PACK(0,ASN1_F_D2I_DSAPRIVATEKEY,0), "d2i_DSAPrivateKey"},
135{ERR_PACK(0,ASN1_F_D2I_DSAPUBLICKEY,0), "d2i_DSAPublicKey"},
136{ERR_PACK(0,ASN1_F_D2I_GENERAL_NAME,0), "d2i_GENERAL_NAME"},
137{ERR_PACK(0,ASN1_F_D2I_NETSCAPE_CERT_SEQUENCE,0), "d2i_NETSCAPE_CERT_SEQUENCE"},
138{ERR_PACK(0,ASN1_F_D2I_NETSCAPE_PKEY,0), "D2I_NETSCAPE_PKEY"},
139{ERR_PACK(0,ASN1_F_D2I_NETSCAPE_RSA,0), "d2i_Netscape_RSA"}, 121{ERR_PACK(0,ASN1_F_D2I_NETSCAPE_RSA,0), "d2i_Netscape_RSA"},
140{ERR_PACK(0,ASN1_F_D2I_NETSCAPE_RSA_2,0), "d2i_Netscape_RSA_2"}, 122{ERR_PACK(0,ASN1_F_D2I_NETSCAPE_RSA_2,0), "D2I_NETSCAPE_RSA_2"},
141{ERR_PACK(0,ASN1_F_D2I_NETSCAPE_SPKAC,0), "d2i_NETSCAPE_SPKAC"},
142{ERR_PACK(0,ASN1_F_D2I_NETSCAPE_SPKI,0), "d2i_NETSCAPE_SPKI"},
143{ERR_PACK(0,ASN1_F_D2I_NOTICEREF,0), "d2i_NOTICEREF"},
144{ERR_PACK(0,ASN1_F_D2I_OTHERNAME,0), "d2i_OTHERNAME"},
145{ERR_PACK(0,ASN1_F_D2I_PBE2PARAM,0), "d2i_PBE2PARAM"},
146{ERR_PACK(0,ASN1_F_D2I_PBEPARAM,0), "d2i_PBEPARAM"},
147{ERR_PACK(0,ASN1_F_D2I_PBKDF2PARAM,0), "d2i_PBKDF2PARAM"},
148{ERR_PACK(0,ASN1_F_D2I_PKCS12,0), "d2i_PKCS12"},
149{ERR_PACK(0,ASN1_F_D2I_PKCS12_BAGS,0), "d2i_PKCS12_BAGS"},
150{ERR_PACK(0,ASN1_F_D2I_PKCS12_MAC_DATA,0), "d2i_PKCS12_MAC_DATA"},
151{ERR_PACK(0,ASN1_F_D2I_PKCS12_SAFEBAG,0), "d2i_PKCS12_SAFEBAG"},
152{ERR_PACK(0,ASN1_F_D2I_PKCS7,0), "d2i_PKCS7"},
153{ERR_PACK(0,ASN1_F_D2I_PKCS7_DIGEST,0), "d2i_PKCS7_DIGEST"},
154{ERR_PACK(0,ASN1_F_D2I_PKCS7_ENCRYPT,0), "d2i_PKCS7_ENCRYPT"},
155{ERR_PACK(0,ASN1_F_D2I_PKCS7_ENC_CONTENT,0), "d2i_PKCS7_ENC_CONTENT"},
156{ERR_PACK(0,ASN1_F_D2I_PKCS7_ENVELOPE,0), "d2i_PKCS7_ENVELOPE"},
157{ERR_PACK(0,ASN1_F_D2I_PKCS7_ISSUER_AND_SERIAL,0), "d2i_PKCS7_ISSUER_AND_SERIAL"},
158{ERR_PACK(0,ASN1_F_D2I_PKCS7_RECIP_INFO,0), "d2i_PKCS7_RECIP_INFO"},
159{ERR_PACK(0,ASN1_F_D2I_PKCS7_SIGNED,0), "d2i_PKCS7_SIGNED"},
160{ERR_PACK(0,ASN1_F_D2I_PKCS7_SIGNER_INFO,0), "d2i_PKCS7_SIGNER_INFO"},
161{ERR_PACK(0,ASN1_F_D2I_PKCS7_SIGN_ENVELOPE,0), "d2i_PKCS7_SIGN_ENVELOPE"},
162{ERR_PACK(0,ASN1_F_D2I_PKCS8_PRIV_KEY_INFO,0), "d2i_PKCS8_PRIV_KEY_INFO"},
163{ERR_PACK(0,ASN1_F_D2I_PKEY_USAGE_PERIOD,0), "d2i_PKEY_USAGE_PERIOD"},
164{ERR_PACK(0,ASN1_F_D2I_POLICYINFO,0), "d2i_POLICYINFO"},
165{ERR_PACK(0,ASN1_F_D2I_POLICYQUALINFO,0), "d2i_POLICYQUALINFO"},
166{ERR_PACK(0,ASN1_F_D2I_PRIVATEKEY,0), "d2i_PrivateKey"}, 123{ERR_PACK(0,ASN1_F_D2I_PRIVATEKEY,0), "d2i_PrivateKey"},
167{ERR_PACK(0,ASN1_F_D2I_PUBLICKEY,0), "d2i_PublicKey"}, 124{ERR_PACK(0,ASN1_F_D2I_PUBLICKEY,0), "d2i_PublicKey"},
168{ERR_PACK(0,ASN1_F_D2I_RSAPRIVATEKEY,0), "d2i_RSAPrivateKey"}, 125{ERR_PACK(0,ASN1_F_D2I_X509,0), "D2I_X509"},
169{ERR_PACK(0,ASN1_F_D2I_RSAPUBLICKEY,0), "d2i_RSAPublicKey"}, 126{ERR_PACK(0,ASN1_F_D2I_X509_CINF,0), "D2I_X509_CINF"},
170{ERR_PACK(0,ASN1_F_D2I_SXNET,0), "d2i_SXNET"}, 127{ERR_PACK(0,ASN1_F_D2I_X509_NAME,0), "D2I_X509_NAME"},
171{ERR_PACK(0,ASN1_F_D2I_SXNETID,0), "d2i_SXNETID"},
172{ERR_PACK(0,ASN1_F_D2I_USERNOTICE,0), "d2i_USERNOTICE"},
173{ERR_PACK(0,ASN1_F_D2I_X509,0), "d2i_X509"},
174{ERR_PACK(0,ASN1_F_D2I_X509_ALGOR,0), "d2i_X509_ALGOR"},
175{ERR_PACK(0,ASN1_F_D2I_X509_ATTRIBUTE,0), "d2i_X509_ATTRIBUTE"},
176{ERR_PACK(0,ASN1_F_D2I_X509_CERT_AUX,0), "d2i_X509_CERT_AUX"},
177{ERR_PACK(0,ASN1_F_D2I_X509_CINF,0), "d2i_X509_CINF"},
178{ERR_PACK(0,ASN1_F_D2I_X509_CRL,0), "d2i_X509_CRL"},
179{ERR_PACK(0,ASN1_F_D2I_X509_CRL_INFO,0), "d2i_X509_CRL_INFO"},
180{ERR_PACK(0,ASN1_F_D2I_X509_EXTENSION,0), "d2i_X509_EXTENSION"},
181{ERR_PACK(0,ASN1_F_D2I_X509_KEY,0), "D2I_X509_KEY"},
182{ERR_PACK(0,ASN1_F_D2I_X509_NAME,0), "d2i_X509_NAME"},
183{ERR_PACK(0,ASN1_F_D2I_X509_NAME_ENTRY,0), "d2i_X509_NAME_ENTRY"},
184{ERR_PACK(0,ASN1_F_D2I_X509_PKEY,0), "d2i_X509_PKEY"}, 128{ERR_PACK(0,ASN1_F_D2I_X509_PKEY,0), "d2i_X509_PKEY"},
185{ERR_PACK(0,ASN1_F_D2I_X509_PUBKEY,0), "d2i_X509_PUBKEY"}, 129{ERR_PACK(0,ASN1_F_I2D_ASN1_TIME,0), "I2D_ASN1_TIME"},
186{ERR_PACK(0,ASN1_F_D2I_X509_REQ,0), "d2i_X509_REQ"},
187{ERR_PACK(0,ASN1_F_D2I_X509_REQ_INFO,0), "d2i_X509_REQ_INFO"},
188{ERR_PACK(0,ASN1_F_D2I_X509_REVOKED,0), "d2i_X509_REVOKED"},
189{ERR_PACK(0,ASN1_F_D2I_X509_SIG,0), "d2i_X509_SIG"},
190{ERR_PACK(0,ASN1_F_D2I_X509_VAL,0), "d2i_X509_VAL"},
191{ERR_PACK(0,ASN1_F_DIST_POINT_NAME_NEW,0), "DIST_POINT_NAME_new"},
192{ERR_PACK(0,ASN1_F_DIST_POINT_NEW,0), "DIST_POINT_new"},
193{ERR_PACK(0,ASN1_F_GENERAL_NAME_NEW,0), "GENERAL_NAME_new"},
194{ERR_PACK(0,ASN1_F_I2D_ASN1_HEADER,0), "i2d_ASN1_HEADER"},
195{ERR_PACK(0,ASN1_F_I2D_ASN1_TIME,0), "i2d_ASN1_TIME"},
196{ERR_PACK(0,ASN1_F_I2D_DHPARAMS,0), "i2d_DHparams"},
197{ERR_PACK(0,ASN1_F_I2D_DSAPARAMS,0), "i2d_DSAparams"},
198{ERR_PACK(0,ASN1_F_I2D_DSAPRIVATEKEY,0), "i2d_DSAPrivateKey"},
199{ERR_PACK(0,ASN1_F_I2D_DSAPUBLICKEY,0), "i2d_DSAPublicKey"},
200{ERR_PACK(0,ASN1_F_I2D_DSA_PUBKEY,0), "i2d_DSA_PUBKEY"}, 130{ERR_PACK(0,ASN1_F_I2D_DSA_PUBKEY,0), "i2d_DSA_PUBKEY"},
201{ERR_PACK(0,ASN1_F_I2D_NETSCAPE_RSA,0), "i2d_Netscape_RSA"}, 131{ERR_PACK(0,ASN1_F_I2D_NETSCAPE_RSA,0), "i2d_Netscape_RSA"},
202{ERR_PACK(0,ASN1_F_I2D_PKCS7,0), "i2d_PKCS7"},
203{ERR_PACK(0,ASN1_F_I2D_PRIVATEKEY,0), "i2d_PrivateKey"}, 132{ERR_PACK(0,ASN1_F_I2D_PRIVATEKEY,0), "i2d_PrivateKey"},
204{ERR_PACK(0,ASN1_F_I2D_PUBLICKEY,0), "i2d_PublicKey"}, 133{ERR_PACK(0,ASN1_F_I2D_PUBLICKEY,0), "i2d_PublicKey"},
205{ERR_PACK(0,ASN1_F_I2D_RSAPRIVATEKEY,0), "i2d_RSAPrivateKey"},
206{ERR_PACK(0,ASN1_F_I2D_RSAPUBLICKEY,0), "i2d_RSAPublicKey"},
207{ERR_PACK(0,ASN1_F_I2D_RSA_PUBKEY,0), "i2d_RSA_PUBKEY"}, 134{ERR_PACK(0,ASN1_F_I2D_RSA_PUBKEY,0), "i2d_RSA_PUBKEY"},
208{ERR_PACK(0,ASN1_F_I2D_X509_ATTRIBUTE,0), "i2d_X509_ATTRIBUTE"}, 135{ERR_PACK(0,ASN1_F_LONG_C2I,0), "LONG_C2I"},
209{ERR_PACK(0,ASN1_F_I2T_ASN1_OBJECT,0), "i2t_ASN1_OBJECT"}, 136{ERR_PACK(0,ASN1_F_OID_MODULE_INIT,0), "OID_MODULE_INIT"},
210{ERR_PACK(0,ASN1_F_NETSCAPE_CERT_SEQUENCE_NEW,0), "NETSCAPE_CERT_SEQUENCE_new"},
211{ERR_PACK(0,ASN1_F_NETSCAPE_PKEY_NEW,0), "NETSCAPE_PKEY_NEW"},
212{ERR_PACK(0,ASN1_F_NETSCAPE_SPKAC_NEW,0), "NETSCAPE_SPKAC_new"},
213{ERR_PACK(0,ASN1_F_NETSCAPE_SPKI_NEW,0), "NETSCAPE_SPKI_new"},
214{ERR_PACK(0,ASN1_F_NOTICEREF_NEW,0), "NOTICEREF_new"},
215{ERR_PACK(0,ASN1_F_OTHERNAME_NEW,0), "OTHERNAME_new"},
216{ERR_PACK(0,ASN1_F_PBE2PARAM_NEW,0), "PBE2PARAM_new"},
217{ERR_PACK(0,ASN1_F_PBEPARAM_NEW,0), "PBEPARAM_new"},
218{ERR_PACK(0,ASN1_F_PBKDF2PARAM_NEW,0), "PBKDF2PARAM_new"},
219{ERR_PACK(0,ASN1_F_PKCS12_BAGS_NEW,0), "PKCS12_BAGS_new"},
220{ERR_PACK(0,ASN1_F_PKCS12_MAC_DATA_NEW,0), "PKCS12_MAC_DATA_new"},
221{ERR_PACK(0,ASN1_F_PKCS12_NEW,0), "PKCS12_new"},
222{ERR_PACK(0,ASN1_F_PKCS12_SAFEBAG_NEW,0), "PKCS12_SAFEBAG_new"},
223{ERR_PACK(0,ASN1_F_PKCS5_PBE2_SET,0), "PKCS5_pbe2_set"}, 137{ERR_PACK(0,ASN1_F_PKCS5_PBE2_SET,0), "PKCS5_pbe2_set"},
224{ERR_PACK(0,ASN1_F_PKCS7_DIGEST_NEW,0), "PKCS7_DIGEST_new"}, 138{ERR_PACK(0,ASN1_F_X509_CINF_NEW,0), "X509_CINF_NEW"},
225{ERR_PACK(0,ASN1_F_PKCS7_ENCRYPT_NEW,0), "PKCS7_ENCRYPT_new"}, 139{ERR_PACK(0,ASN1_F_X509_CRL_ADD0_REVOKED,0), "X509_CRL_add0_revoked"},
226{ERR_PACK(0,ASN1_F_PKCS7_ENC_CONTENT_NEW,0), "PKCS7_ENC_CONTENT_new"},
227{ERR_PACK(0,ASN1_F_PKCS7_ENVELOPE_NEW,0), "PKCS7_ENVELOPE_new"},
228{ERR_PACK(0,ASN1_F_PKCS7_ISSUER_AND_SERIAL_NEW,0), "PKCS7_ISSUER_AND_SERIAL_new"},
229{ERR_PACK(0,ASN1_F_PKCS7_NEW,0), "PKCS7_new"},
230{ERR_PACK(0,ASN1_F_PKCS7_RECIP_INFO_NEW,0), "PKCS7_RECIP_INFO_new"},
231{ERR_PACK(0,ASN1_F_PKCS7_SIGNED_NEW,0), "PKCS7_SIGNED_new"},
232{ERR_PACK(0,ASN1_F_PKCS7_SIGNER_INFO_NEW,0), "PKCS7_SIGNER_INFO_new"},
233{ERR_PACK(0,ASN1_F_PKCS7_SIGN_ENVELOPE_NEW,0), "PKCS7_SIGN_ENVELOPE_new"},
234{ERR_PACK(0,ASN1_F_PKCS8_PRIV_KEY_INFO_NEW,0), "PKCS8_PRIV_KEY_INFO_new"},
235{ERR_PACK(0,ASN1_F_PKEY_USAGE_PERIOD_NEW,0), "PKEY_USAGE_PERIOD_new"},
236{ERR_PACK(0,ASN1_F_POLICYINFO_NEW,0), "POLICYINFO_new"},
237{ERR_PACK(0,ASN1_F_POLICYQUALINFO_NEW,0), "POLICYQUALINFO_new"},
238{ERR_PACK(0,ASN1_F_SXNETID_NEW,0), "SXNETID_new"},
239{ERR_PACK(0,ASN1_F_SXNET_NEW,0), "SXNET_new"},
240{ERR_PACK(0,ASN1_F_USERNOTICE_NEW,0), "USERNOTICE_new"},
241{ERR_PACK(0,ASN1_F_X509_ALGOR_NEW,0), "X509_ALGOR_new"},
242{ERR_PACK(0,ASN1_F_X509_ATTRIBUTE_NEW,0), "X509_ATTRIBUTE_new"},
243{ERR_PACK(0,ASN1_F_X509_CERT_AUX_NEW,0), "X509_CERT_AUX_new"},
244{ERR_PACK(0,ASN1_F_X509_CINF_NEW,0), "X509_CINF_new"},
245{ERR_PACK(0,ASN1_F_X509_CRL_INFO_NEW,0), "X509_CRL_INFO_new"},
246{ERR_PACK(0,ASN1_F_X509_CRL_NEW,0), "X509_CRL_new"},
247{ERR_PACK(0,ASN1_F_X509_DHPARAMS_NEW,0), "X509_DHPARAMS_NEW"},
248{ERR_PACK(0,ASN1_F_X509_EXTENSION_NEW,0), "X509_EXTENSION_new"},
249{ERR_PACK(0,ASN1_F_X509_INFO_NEW,0), "X509_INFO_new"}, 140{ERR_PACK(0,ASN1_F_X509_INFO_NEW,0), "X509_INFO_new"},
250{ERR_PACK(0,ASN1_F_X509_KEY_NEW,0), "X509_KEY_NEW"}, 141{ERR_PACK(0,ASN1_F_X509_NAME_NEW,0), "X509_NAME_NEW"},
251{ERR_PACK(0,ASN1_F_X509_NAME_ENTRY_NEW,0), "X509_NAME_ENTRY_new"}, 142{ERR_PACK(0,ASN1_F_X509_NEW,0), "X509_NEW"},
252{ERR_PACK(0,ASN1_F_X509_NAME_NEW,0), "X509_NAME_new"},
253{ERR_PACK(0,ASN1_F_X509_NEW,0), "X509_new"},
254{ERR_PACK(0,ASN1_F_X509_PKEY_NEW,0), "X509_PKEY_new"}, 143{ERR_PACK(0,ASN1_F_X509_PKEY_NEW,0), "X509_PKEY_new"},
255{ERR_PACK(0,ASN1_F_X509_PUBKEY_NEW,0), "X509_PUBKEY_new"},
256{ERR_PACK(0,ASN1_F_X509_REQ_INFO_NEW,0), "X509_REQ_INFO_new"},
257{ERR_PACK(0,ASN1_F_X509_REQ_NEW,0), "X509_REQ_new"},
258{ERR_PACK(0,ASN1_F_X509_REVOKED_NEW,0), "X509_REVOKED_new"},
259{ERR_PACK(0,ASN1_F_X509_SIG_NEW,0), "X509_SIG_new"},
260{ERR_PACK(0,ASN1_F_X509_VAL_FREE,0), "X509_VAL_free"},
261{ERR_PACK(0,ASN1_F_X509_VAL_NEW,0), "X509_VAL_new"},
262{0,NULL} 144{0,NULL}
263 }; 145 };
264 146
265static ERR_STRING_DATA ASN1_str_reasons[]= 147static ERR_STRING_DATA ASN1_str_reasons[]=
266 { 148 {
149{ASN1_R_ADDING_OBJECT ,"adding object"},
150{ASN1_R_AUX_ERROR ,"aux error"},
267{ASN1_R_BAD_CLASS ,"bad class"}, 151{ASN1_R_BAD_CLASS ,"bad class"},
268{ASN1_R_BAD_OBJECT_HEADER ,"bad object header"}, 152{ASN1_R_BAD_OBJECT_HEADER ,"bad object header"},
269{ASN1_R_BAD_PASSWORD_READ ,"bad password read"}, 153{ASN1_R_BAD_PASSWORD_READ ,"bad password read"},
270{ASN1_R_BAD_PKCS7_CONTENT ,"bad pkcs7 content"},
271{ASN1_R_BAD_PKCS7_TYPE ,"bad pkcs7 type"},
272{ASN1_R_BAD_TAG ,"bad tag"}, 154{ASN1_R_BAD_TAG ,"bad tag"},
273{ASN1_R_BAD_TYPE ,"bad type"},
274{ASN1_R_BN_LIB ,"bn lib"}, 155{ASN1_R_BN_LIB ,"bn lib"},
275{ASN1_R_BOOLEAN_IS_WRONG_LENGTH ,"boolean is wrong length"}, 156{ASN1_R_BOOLEAN_IS_WRONG_LENGTH ,"boolean is wrong length"},
276{ASN1_R_BUFFER_TOO_SMALL ,"buffer too small"}, 157{ASN1_R_BUFFER_TOO_SMALL ,"buffer too small"},
@@ -279,22 +160,24 @@ static ERR_STRING_DATA ASN1_str_reasons[]=
279{ASN1_R_DECODE_ERROR ,"decode error"}, 160{ASN1_R_DECODE_ERROR ,"decode error"},
280{ASN1_R_DECODING_ERROR ,"decoding error"}, 161{ASN1_R_DECODING_ERROR ,"decoding error"},
281{ASN1_R_ENCODE_ERROR ,"encode error"}, 162{ASN1_R_ENCODE_ERROR ,"encode error"},
163{ASN1_R_ERROR_LOADING_SECTION ,"error loading section"},
282{ASN1_R_ERROR_PARSING_SET_ELEMENT ,"error parsing set element"}, 164{ASN1_R_ERROR_PARSING_SET_ELEMENT ,"error parsing set element"},
283{ASN1_R_ERROR_SETTING_CIPHER_PARAMS ,"error setting cipher params"}, 165{ASN1_R_ERROR_SETTING_CIPHER_PARAMS ,"error setting cipher params"},
284{ASN1_R_EXPECTING_AN_ENUMERATED ,"expecting an enumerated"},
285{ASN1_R_EXPECTING_AN_INTEGER ,"expecting an integer"}, 166{ASN1_R_EXPECTING_AN_INTEGER ,"expecting an integer"},
286{ASN1_R_EXPECTING_AN_OBJECT ,"expecting an object"}, 167{ASN1_R_EXPECTING_AN_OBJECT ,"expecting an object"},
287{ASN1_R_EXPECTING_AN_OCTET_STRING ,"expecting an octet string"},
288{ASN1_R_EXPECTING_A_BIT_STRING ,"expecting a bit string"},
289{ASN1_R_EXPECTING_A_BOOLEAN ,"expecting a boolean"}, 168{ASN1_R_EXPECTING_A_BOOLEAN ,"expecting a boolean"},
290{ASN1_R_EXPECTING_A_GENERALIZEDTIME ,"expecting a generalizedtime"},
291{ASN1_R_EXPECTING_A_NULL ,"expecting a null"},
292{ASN1_R_EXPECTING_A_TIME ,"expecting a time"}, 169{ASN1_R_EXPECTING_A_TIME ,"expecting a time"},
293{ASN1_R_EXPECTING_A_UTCTIME ,"expecting a utctime"}, 170{ASN1_R_EXPLICIT_LENGTH_MISMATCH ,"explicit length mismatch"},
171{ASN1_R_EXPLICIT_TAG_NOT_CONSTRUCTED ,"explicit tag not constructed"},
172{ASN1_R_FIELD_MISSING ,"field missing"},
294{ASN1_R_FIRST_NUM_TOO_LARGE ,"first num too large"}, 173{ASN1_R_FIRST_NUM_TOO_LARGE ,"first num too large"},
295{ASN1_R_GENERALIZEDTIME_TOO_LONG ,"generalizedtime too long"},
296{ASN1_R_HEADER_TOO_LONG ,"header too long"}, 174{ASN1_R_HEADER_TOO_LONG ,"header too long"},
297{ASN1_R_ILLEGAL_CHARACTERS ,"illegal characters"}, 175{ASN1_R_ILLEGAL_CHARACTERS ,"illegal characters"},
176{ASN1_R_ILLEGAL_NULL ,"illegal null"},
177{ASN1_R_ILLEGAL_OPTIONAL_ANY ,"illegal optional any"},
178{ASN1_R_ILLEGAL_OPTIONS_ON_ITEM_TEMPLATE ,"illegal options on item template"},
179{ASN1_R_ILLEGAL_TAGGED_ANY ,"illegal tagged any"},
180{ASN1_R_INTEGER_TOO_LARGE_FOR_LONG ,"integer too large for long"},
298{ASN1_R_INVALID_BMPSTRING_LENGTH ,"invalid bmpstring length"}, 181{ASN1_R_INVALID_BMPSTRING_LENGTH ,"invalid bmpstring length"},
299{ASN1_R_INVALID_DIGIT ,"invalid digit"}, 182{ASN1_R_INVALID_DIGIT ,"invalid digit"},
300{ASN1_R_INVALID_SEPARATOR ,"invalid separator"}, 183{ASN1_R_INVALID_SEPARATOR ,"invalid separator"},
@@ -303,32 +186,37 @@ static ERR_STRING_DATA ASN1_str_reasons[]=
303{ASN1_R_INVALID_UTF8STRING ,"invalid utf8string"}, 186{ASN1_R_INVALID_UTF8STRING ,"invalid utf8string"},
304{ASN1_R_IV_TOO_LARGE ,"iv too large"}, 187{ASN1_R_IV_TOO_LARGE ,"iv too large"},
305{ASN1_R_LENGTH_ERROR ,"length error"}, 188{ASN1_R_LENGTH_ERROR ,"length error"},
189{ASN1_R_MISSING_EOC ,"missing eoc"},
306{ASN1_R_MISSING_SECOND_NUMBER ,"missing second number"}, 190{ASN1_R_MISSING_SECOND_NUMBER ,"missing second number"},
191{ASN1_R_MSTRING_NOT_UNIVERSAL ,"mstring not universal"},
192{ASN1_R_MSTRING_WRONG_TAG ,"mstring wrong tag"},
307{ASN1_R_NON_HEX_CHARACTERS ,"non hex characters"}, 193{ASN1_R_NON_HEX_CHARACTERS ,"non hex characters"},
308{ASN1_R_NOT_ENOUGH_DATA ,"not enough data"}, 194{ASN1_R_NOT_ENOUGH_DATA ,"not enough data"},
195{ASN1_R_NO_MATCHING_CHOICE_TYPE ,"no matching choice type"},
309{ASN1_R_NULL_IS_WRONG_LENGTH ,"null is wrong length"}, 196{ASN1_R_NULL_IS_WRONG_LENGTH ,"null is wrong length"},
310{ASN1_R_ODD_NUMBER_OF_CHARS ,"odd number of chars"}, 197{ASN1_R_ODD_NUMBER_OF_CHARS ,"odd number of chars"},
311{ASN1_R_PARSING ,"parsing"},
312{ASN1_R_PRIVATE_KEY_HEADER_MISSING ,"private key header missing"}, 198{ASN1_R_PRIVATE_KEY_HEADER_MISSING ,"private key header missing"},
313{ASN1_R_SECOND_NUMBER_TOO_LARGE ,"second number too large"}, 199{ASN1_R_SECOND_NUMBER_TOO_LARGE ,"second number too large"},
200{ASN1_R_SEQUENCE_LENGTH_MISMATCH ,"sequence length mismatch"},
201{ASN1_R_SEQUENCE_NOT_CONSTRUCTED ,"sequence not constructed"},
314{ASN1_R_SHORT_LINE ,"short line"}, 202{ASN1_R_SHORT_LINE ,"short line"},
315{ASN1_R_STRING_TOO_LONG ,"string too long"}, 203{ASN1_R_STRING_TOO_LONG ,"string too long"},
316{ASN1_R_STRING_TOO_SHORT ,"string too short"}, 204{ASN1_R_STRING_TOO_SHORT ,"string too short"},
317{ASN1_R_TAG_VALUE_TOO_HIGH ,"tag value too high"}, 205{ASN1_R_TAG_VALUE_TOO_HIGH ,"tag value too high"},
318{ASN1_R_THE_ASN1_OBJECT_IDENTIFIER_IS_NOT_KNOWN_FOR_THIS_MD,"the asn1 object identifier is not known for this md"}, 206{ASN1_R_THE_ASN1_OBJECT_IDENTIFIER_IS_NOT_KNOWN_FOR_THIS_MD,"the asn1 object identifier is not known for this md"},
319{ASN1_R_TOO_LONG ,"too long"}, 207{ASN1_R_TOO_LONG ,"too long"},
208{ASN1_R_TYPE_NOT_CONSTRUCTED ,"type not constructed"},
320{ASN1_R_UNABLE_TO_DECODE_RSA_KEY ,"unable to decode rsa key"}, 209{ASN1_R_UNABLE_TO_DECODE_RSA_KEY ,"unable to decode rsa key"},
321{ASN1_R_UNABLE_TO_DECODE_RSA_PRIVATE_KEY ,"unable to decode rsa private key"}, 210{ASN1_R_UNABLE_TO_DECODE_RSA_PRIVATE_KEY ,"unable to decode rsa private key"},
322{ASN1_R_UNKNOWN_ATTRIBUTE_TYPE ,"unknown attribute type"}, 211{ASN1_R_UNEXPECTED_EOC ,"unexpected eoc"},
323{ASN1_R_UNKNOWN_FORMAT ,"unknown format"}, 212{ASN1_R_UNKNOWN_FORMAT ,"unknown format"},
324{ASN1_R_UNKNOWN_MESSAGE_DIGEST_ALGORITHM ,"unknown message digest algorithm"}, 213{ASN1_R_UNKNOWN_MESSAGE_DIGEST_ALGORITHM ,"unknown message digest algorithm"},
325{ASN1_R_UNKNOWN_OBJECT_TYPE ,"unknown object type"}, 214{ASN1_R_UNKNOWN_OBJECT_TYPE ,"unknown object type"},
326{ASN1_R_UNKNOWN_PUBLIC_KEY_TYPE ,"unknown public key type"}, 215{ASN1_R_UNKNOWN_PUBLIC_KEY_TYPE ,"unknown public key type"},
216{ASN1_R_UNSUPPORTED_ANY_DEFINED_BY_TYPE ,"unsupported any defined by type"},
327{ASN1_R_UNSUPPORTED_CIPHER ,"unsupported cipher"}, 217{ASN1_R_UNSUPPORTED_CIPHER ,"unsupported cipher"},
328{ASN1_R_UNSUPPORTED_ENCRYPTION_ALGORITHM ,"unsupported encryption algorithm"}, 218{ASN1_R_UNSUPPORTED_ENCRYPTION_ALGORITHM ,"unsupported encryption algorithm"},
329{ASN1_R_UNSUPPORTED_PUBLIC_KEY_TYPE ,"unsupported public key type"}, 219{ASN1_R_UNSUPPORTED_PUBLIC_KEY_TYPE ,"unsupported public key type"},
330{ASN1_R_UTCTIME_TOO_LONG ,"utctime too long"},
331{ASN1_R_WRONG_PRINTABLE_TYPE ,"wrong printable type"},
332{ASN1_R_WRONG_TAG ,"wrong tag"}, 220{ASN1_R_WRONG_TAG ,"wrong tag"},
333{ASN1_R_WRONG_TYPE ,"wrong type"}, 221{ASN1_R_WRONG_TYPE ,"wrong type"},
334{0,NULL} 222{0,NULL}
@@ -343,7 +231,7 @@ void ERR_load_ASN1_strings(void)
343 if (init) 231 if (init)
344 { 232 {
345 init=0; 233 init=0;
346#ifndef NO_ERR 234#ifndef OPENSSL_NO_ERR
347 ERR_load_strings(ERR_LIB_ASN1,ASN1_str_functs); 235 ERR_load_strings(ERR_LIB_ASN1,ASN1_str_functs);
348 ERR_load_strings(ERR_LIB_ASN1,ASN1_str_reasons); 236 ERR_load_strings(ERR_LIB_ASN1,ASN1_str_reasons);
349#endif 237#endif
diff --git a/src/lib/libcrypto/asn1/asn1_lib.c b/src/lib/libcrypto/asn1/asn1_lib.c
index a8b651e54e..830ff2af3c 100644
--- a/src/lib/libcrypto/asn1/asn1_lib.c
+++ b/src/lib/libcrypto/asn1/asn1_lib.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/asn1_mac.h>
63 62
64static int asn1_get_length(unsigned char **pp,int *inf,long *rl,int max); 63static int asn1_get_length(unsigned char **pp,int *inf,long *rl,int max);
65static void asn1_put_length(unsigned char **pp, int length); 64static void asn1_put_length(unsigned char **pp, int length);
@@ -301,7 +300,7 @@ int asn1_GetSequence(ASN1_CTX *c, long *length)
301 return(0); 300 return(0);
302 } 301 }
303 if (c->inf == (1|V_ASN1_CONSTRUCTED)) 302 if (c->inf == (1|V_ASN1_CONSTRUCTED))
304 c->slen= *length; 303 c->slen= *length+ *(c->pp)-c->p;
305 c->eos=0; 304 c->eos=0;
306 return(1); 305 return(1);
307 } 306 }
diff --git a/src/lib/libcrypto/asn1/asn1_mac.h b/src/lib/libcrypto/asn1/asn1_mac.h
index af0e664b2d..a48649ceeb 100644
--- a/src/lib/libcrypto/asn1/asn1_mac.h
+++ b/src/lib/libcrypto/asn1/asn1_mac.h
@@ -70,14 +70,14 @@ extern "C" {
70#endif 70#endif
71 71
72#define ASN1_MAC_H_err(f,r,line) \ 72#define ASN1_MAC_H_err(f,r,line) \
73 ERR_PUT_error(ASN1_MAC_ERR_LIB,(f),(r),ERR_file_name,(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_CTX c; \ 76 ASN1_CTX c; \
77 type ret=NULL; \ 77 type ret=NULL; \
78 \ 78 \
79 c.pp=pp; \ 79 c.pp=(unsigned char **)pp; \
80 c.q= *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= *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_Finish(&c)) \ 92 if (!asn1_Finish(&c)) \
93 { c.line=__LINE__; goto err; } \ 93 { c.line=__LINE__; goto err; } \
94 *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(*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
@@ -196,9 +196,6 @@ err:\
196 if ((a != NULL) && (sk_##type##_num(a) != 0)) \ 196 if ((a != NULL) && (sk_##type##_num(a) != 0)) \
197 M_ASN1_I2D_put_SEQUENCE_type(type,a,f); 197 M_ASN1_I2D_put_SEQUENCE_type(type,a,f);
198 198
199#define M_ASN1_I2D_put_SEQUENCE_opt_ex_type(type,a,f) \
200 if (a) M_ASN1_I2D_put_SEQUENCE_type(type,a,f);
201
202#define M_ASN1_D2I_get_IMP_set_opt(b,func,free_func,tag) \ 199#define M_ASN1_D2I_get_IMP_set_opt(b,func,free_func,tag) \
203 if ((c.slen != 0) && \ 200 if ((c.slen != 0) && \
204 (M_ASN1_next == \ 201 (M_ASN1_next == \
@@ -392,9 +389,6 @@ err:\
392 if ((a != NULL) && (sk_##type##_num(a) != 0)) \ 389 if ((a != NULL) && (sk_##type##_num(a) != 0)) \
393 M_ASN1_I2D_len_SEQUENCE_type(type,a,f); 390 M_ASN1_I2D_len_SEQUENCE_type(type,a,f);
394 391
395#define M_ASN1_I2D_len_SEQUENCE_opt_ex_type(type,a,f) \
396 if (a) M_ASN1_I2D_len_SEQUENCE_type(type,a,f);
397
398#define M_ASN1_I2D_len_IMP_SET(a,f,x) \ 392#define M_ASN1_I2D_len_IMP_SET(a,f,x) \
399 ret+=i2d_ASN1_SET(a,NULL,f,x,V_ASN1_CONTEXT_SPECIFIC,IS_SET); 393 ret+=i2d_ASN1_SET(a,NULL,f,x,V_ASN1_CONTEXT_SPECIFIC,IS_SET);
400 394
@@ -458,15 +452,6 @@ err:\
458 ret+=ASN1_object_size(1,v,mtag); \ 452 ret+=ASN1_object_size(1,v,mtag); \
459 } 453 }
460 454
461#define M_ASN1_I2D_len_EXP_SEQUENCE_opt_ex_type(type,a,f,mtag,tag,v) \
462 if (a)\
463 { \
464 v=i2d_ASN1_SET_OF_##type(a,NULL,f,tag, \
465 V_ASN1_UNIVERSAL, \
466 IS_SEQUENCE); \
467 ret+=ASN1_object_size(1,v,mtag); \
468 }
469
470/* Put Macros */ 455/* Put Macros */
471#define M_ASN1_I2D_put(a,f) f(a,&p) 456#define M_ASN1_I2D_put(a,f) f(a,&p)
472 457
@@ -551,14 +536,6 @@ err:\
551 IS_SEQUENCE); \ 536 IS_SEQUENCE); \
552 } 537 }
553 538
554#define M_ASN1_I2D_put_EXP_SEQUENCE_opt_ex_type(type,a,f,mtag,tag,v) \
555 if (a) \
556 { \
557 ASN1_put_object(&p,1,v,mtag,V_ASN1_CONTEXT_SPECIFIC); \
558 i2d_ASN1_SET_OF_##type(a,&p,f,tag,V_ASN1_UNIVERSAL, \
559 IS_SEQUENCE); \
560 }
561
562#define M_ASN1_I2D_seq_total() \ 539#define M_ASN1_I2D_seq_total() \
563 r=ASN1_object_size(1,ret,V_ASN1_SEQUENCE); \ 540 r=ASN1_object_size(1,ret,V_ASN1_SEQUENCE); \
564 if (pp == NULL) return(r); \ 541 if (pp == NULL) return(r); \
diff --git a/src/lib/libcrypto/asn1/asn1t.h b/src/lib/libcrypto/asn1/asn1t.h
new file mode 100644
index 0000000000..ed372f8554
--- /dev/null
+++ b/src/lib/libcrypto/asn1/asn1t.h
@@ -0,0 +1,846 @@
1/* asn1t.h */
2/* Written by Dr Stephen N Henson (shenson@bigfoot.com) for the OpenSSL
3 * project 2000.
4 */
5/* ====================================================================
6 * Copyright (c) 2000 The OpenSSL Project. All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 *
12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 *
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in
17 * the documentation and/or other materials provided with the
18 * distribution.
19 *
20 * 3. All advertising materials mentioning features or use of this
21 * software must display the following acknowledgment:
22 * "This product includes software developed by the OpenSSL Project
23 * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
24 *
25 * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
26 * endorse or promote products derived from this software without
27 * prior written permission. For written permission, please contact
28 * licensing@OpenSSL.org.
29 *
30 * 5. Products derived from this software may not be called "OpenSSL"
31 * nor may "OpenSSL" appear in their names without prior written
32 * permission of the OpenSSL Project.
33 *
34 * 6. Redistributions of any form whatsoever must retain the following
35 * acknowledgment:
36 * "This product includes software developed by the OpenSSL Project
37 * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
38 *
39 * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
40 * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
41 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
42 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
43 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
44 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
45 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
46 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
47 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
48 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
49 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
50 * OF THE POSSIBILITY OF SUCH DAMAGE.
51 * ====================================================================
52 *
53 * This product includes cryptographic software written by Eric Young
54 * (eay@cryptsoft.com). This product includes software written by Tim
55 * Hudson (tjh@cryptsoft.com).
56 *
57 */
58#ifndef HEADER_ASN1T_H
59#define HEADER_ASN1T_H
60
61#include <stddef.h>
62#include <openssl/e_os2.h>
63#include <openssl/asn1.h>
64
65#ifdef OPENSSL_BUILD_SHLIBCRYPTO
66# undef OPENSSL_EXTERN
67# define OPENSSL_EXTERN OPENSSL_EXPORT
68#endif
69
70/* ASN1 template defines, structures and functions */
71
72#ifdef __cplusplus
73extern "C" {
74#endif
75
76
77#ifndef OPENSSL_EXPORT_VAR_AS_FUNCTION
78
79/* Macro to obtain ASN1_ADB pointer from a type (only used internally) */
80#define ASN1_ADB_ptr(iptr) ((const ASN1_ADB *)(iptr))
81
82
83/* Macros for start and end of ASN1_ITEM definition */
84
85#define ASN1_ITEM_start(itname) \
86 OPENSSL_GLOBAL const ASN1_ITEM itname##_it = {
87
88#define ASN1_ITEM_end(itname) \
89 };
90
91#else
92
93/* Macro to obtain ASN1_ADB pointer from a type (only used internally) */
94#define ASN1_ADB_ptr(iptr) ((const ASN1_ADB *)(iptr()))
95
96
97/* Macros for start and end of ASN1_ITEM definition */
98
99#define ASN1_ITEM_start(itname) \
100 const ASN1_ITEM * itname##_it(void) \
101 { \
102 static const ASN1_ITEM local_it = { \
103
104#define ASN1_ITEM_end(itname) \
105 }; \
106 return &local_it; \
107 }
108
109#endif
110
111
112/* Macros to aid ASN1 template writing */
113
114#define ASN1_ITEM_TEMPLATE(tname) \
115 const static ASN1_TEMPLATE tname##_item_tt
116
117#define ASN1_ITEM_TEMPLATE_END(tname) \
118 ;\
119 ASN1_ITEM_start(tname) \
120 ASN1_ITYPE_PRIMITIVE,\
121 -1,\
122 &tname##_item_tt,\
123 0,\
124 NULL,\
125 0,\
126 #tname \
127 ASN1_ITEM_end(tname)
128
129
130/* This is a ASN1 type which just embeds a template */
131
132/* This pair helps declare a SEQUENCE. We can do:
133 *
134 * ASN1_SEQUENCE(stname) = {
135 * ... SEQUENCE components ...
136 * } ASN1_SEQUENCE_END(stname)
137 *
138 * This will produce an ASN1_ITEM called stname_it
139 * for a structure called stname.
140 *
141 * If you want the same structure but a different
142 * name then use:
143 *
144 * ASN1_SEQUENCE(itname) = {
145 * ... SEQUENCE components ...
146 * } ASN1_SEQUENCE_END_name(stname, itname)
147 *
148 * This will create an item called itname_it using
149 * a structure called stname.
150 */
151
152#define ASN1_SEQUENCE(tname) \
153 const static ASN1_TEMPLATE tname##_seq_tt[]
154
155#define ASN1_SEQUENCE_END(stname) ASN1_SEQUENCE_END_name(stname, stname)
156
157#define ASN1_SEQUENCE_END_name(stname, tname) \
158 ;\
159 ASN1_ITEM_start(tname) \
160 ASN1_ITYPE_SEQUENCE,\
161 V_ASN1_SEQUENCE,\
162 tname##_seq_tt,\
163 sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\
164 NULL,\
165 sizeof(stname),\
166 #stname \
167 ASN1_ITEM_end(tname)
168
169#define ASN1_SEQUENCE_cb(tname, cb) \
170 const static ASN1_AUX tname##_aux = {NULL, 0, 0, 0, cb, 0}; \
171 ASN1_SEQUENCE(tname)
172
173#define ASN1_BROKEN_SEQUENCE(tname) \
174 const static ASN1_AUX tname##_aux = {NULL, ASN1_AFLG_BROKEN, 0, 0, 0, 0}; \
175 ASN1_SEQUENCE(tname)
176
177#define ASN1_SEQUENCE_ref(tname, cb, lck) \
178 const static ASN1_AUX tname##_aux = {NULL, ASN1_AFLG_REFCOUNT, offsetof(tname, references), lck, cb, 0}; \
179 ASN1_SEQUENCE(tname)
180
181#define ASN1_SEQUENCE_enc(tname, enc, cb) \
182 const static ASN1_AUX tname##_aux = {NULL, ASN1_AFLG_ENCODING, 0, 0, cb, offsetof(tname, enc)}; \
183 ASN1_SEQUENCE(tname)
184
185#define ASN1_BROKEN_SEQUENCE_END(stname) ASN1_SEQUENCE_END_ref(stname, stname)
186
187#define ASN1_SEQUENCE_END_enc(stname, tname) ASN1_SEQUENCE_END_ref(stname, tname)
188
189#define ASN1_SEQUENCE_END_cb(stname, tname) ASN1_SEQUENCE_END_ref(stname, tname)
190
191#define ASN1_SEQUENCE_END_ref(stname, tname) \
192 ;\
193 ASN1_ITEM_start(tname) \
194 ASN1_ITYPE_SEQUENCE,\
195 V_ASN1_SEQUENCE,\
196 tname##_seq_tt,\
197 sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\
198 &tname##_aux,\
199 sizeof(stname),\
200 #stname \
201 ASN1_ITEM_end(tname)
202
203
204/* This pair helps declare a CHOICE type. We can do:
205 *
206 * ASN1_CHOICE(chname) = {
207 * ... CHOICE options ...
208 * ASN1_CHOICE_END(chname)
209 *
210 * This will produce an ASN1_ITEM called chname_it
211 * for a structure called chname. The structure
212 * definition must look like this:
213 * typedef struct {
214 * int type;
215 * union {
216 * ASN1_SOMETHING *opt1;
217 * ASN1_SOMEOTHER *opt2;
218 * } value;
219 * } chname;
220 *
221 * the name of the selector must be 'type'.
222 * to use an alternative selector name use the
223 * ASN1_CHOICE_END_selector() version.
224 */
225
226#define ASN1_CHOICE(tname) \
227 const static ASN1_TEMPLATE tname##_ch_tt[]
228
229#define ASN1_CHOICE_cb(tname, cb) \
230 const static ASN1_AUX tname##_aux = {NULL, 0, 0, 0, cb, 0}; \
231 ASN1_CHOICE(tname)
232
233#define ASN1_CHOICE_END(stname) ASN1_CHOICE_END_name(stname, stname)
234
235#define ASN1_CHOICE_END_name(stname, tname) ASN1_CHOICE_END_selector(stname, tname, type)
236
237#define ASN1_CHOICE_END_selector(stname, tname, selname) \
238 ;\
239 ASN1_ITEM_start(tname) \
240 ASN1_ITYPE_CHOICE,\
241 offsetof(stname,selname) ,\
242 tname##_ch_tt,\
243 sizeof(tname##_ch_tt) / sizeof(ASN1_TEMPLATE),\
244 NULL,\
245 sizeof(stname),\
246 #stname \
247 ASN1_ITEM_end(tname)
248
249#define ASN1_CHOICE_END_cb(stname, tname, selname) \
250 ;\
251 ASN1_ITEM_start(tname) \
252 ASN1_ITYPE_CHOICE,\
253 offsetof(stname,selname) ,\
254 tname##_ch_tt,\
255 sizeof(tname##_ch_tt) / sizeof(ASN1_TEMPLATE),\
256 &tname##_aux,\
257 sizeof(stname),\
258 #stname \
259 ASN1_ITEM_end(tname)
260
261/* This helps with the template wrapper form of ASN1_ITEM */
262
263#define ASN1_EX_TEMPLATE_TYPE(flags, tag, name, type) { \
264 (flags), (tag), 0,\
265 #name, ASN1_ITEM_ref(type) }
266
267/* These help with SEQUENCE or CHOICE components */
268
269/* used to declare other types */
270
271#define ASN1_EX_TYPE(flags, tag, stname, field, type) { \
272 (flags), (tag), offsetof(stname, field),\
273 #field, ASN1_ITEM_ref(type) }
274
275/* used when the structure is combined with the parent */
276
277#define ASN1_EX_COMBINE(flags, tag, type) { \
278 (flags)|ASN1_TFLG_COMBINE, (tag), 0, NULL, ASN1_ITEM_ref(type) }
279
280/* implicit and explicit helper macros */
281
282#define ASN1_IMP_EX(stname, field, type, tag, ex) \
283 ASN1_EX_TYPE(ASN1_TFLG_IMPLICIT | ex, tag, stname, field, type)
284
285#define ASN1_EXP_EX(stname, field, type, tag, ex) \
286 ASN1_EX_TYPE(ASN1_TFLG_EXPLICIT | ex, tag, stname, field, type)
287
288/* Any defined by macros: the field used is in the table itself */
289
290#ifndef OPENSSL_EXPORT_VAR_AS_FUNCTION
291#define ASN1_ADB_OBJECT(tblname) { ASN1_TFLG_ADB_OID, -1, 0, #tblname, (const ASN1_ITEM *)&(tblname##_adb) }
292#define ASN1_ADB_INTEGER(tblname) { ASN1_TFLG_ADB_INT, -1, 0, #tblname, (const ASN1_ITEM *)&(tblname##_adb) }
293#else
294#define ASN1_ADB_OBJECT(tblname) { ASN1_TFLG_ADB_OID, -1, 0, #tblname, tblname##_adb }
295#define ASN1_ADB_INTEGER(tblname) { ASN1_TFLG_ADB_INT, -1, 0, #tblname, tblname##_adb }
296#endif
297/* Plain simple type */
298#define ASN1_SIMPLE(stname, field, type) ASN1_EX_TYPE(0,0, stname, field, type)
299
300/* OPTIONAL simple type */
301#define ASN1_OPT(stname, field, type) ASN1_EX_TYPE(ASN1_TFLG_OPTIONAL, 0, stname, field, type)
302
303/* IMPLICIT tagged simple type */
304#define ASN1_IMP(stname, field, type, tag) ASN1_IMP_EX(stname, field, type, tag, 0)
305
306/* IMPLICIT tagged OPTIONAL simple type */
307#define ASN1_IMP_OPT(stname, field, type, tag) ASN1_IMP_EX(stname, field, type, tag, ASN1_TFLG_OPTIONAL)
308
309/* Same as above but EXPLICIT */
310
311#define ASN1_EXP(stname, field, type, tag) ASN1_EXP_EX(stname, field, type, tag, 0)
312#define ASN1_EXP_OPT(stname, field, type, tag) ASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_OPTIONAL)
313
314/* SEQUENCE OF type */
315#define ASN1_SEQUENCE_OF(stname, field, type) \
316 ASN1_EX_TYPE(ASN1_TFLG_SEQUENCE_OF, 0, stname, field, type)
317
318/* OPTIONAL SEQUENCE OF */
319#define ASN1_SEQUENCE_OF_OPT(stname, field, type) \
320 ASN1_EX_TYPE(ASN1_TFLG_SEQUENCE_OF|ASN1_TFLG_OPTIONAL, 0, stname, field, type)
321
322/* Same as above but for SET OF */
323
324#define ASN1_SET_OF(stname, field, type) \
325 ASN1_EX_TYPE(ASN1_TFLG_SET_OF, 0, stname, field, type)
326
327#define ASN1_SET_OF_OPT(stname, field, type) \
328 ASN1_EX_TYPE(ASN1_TFLG_SET_OF|ASN1_TFLG_OPTIONAL, 0, stname, field, type)
329
330/* Finally compound types of SEQUENCE, SET, IMPLICIT, EXPLICIT and OPTIONAL */
331
332#define ASN1_IMP_SET_OF(stname, field, type, tag) \
333 ASN1_IMP_EX(stname, field, type, tag, ASN1_TFLG_SET_OF)
334
335#define ASN1_EXP_SET_OF(stname, field, type, tag) \
336 ASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_SET_OF)
337
338#define ASN1_IMP_SET_OF_OPT(stname, field, type, tag) \
339 ASN1_IMP_EX(stname, field, type, tag, ASN1_TFLG_SET_OF|ASN1_TFLG_OPTIONAL)
340
341#define ASN1_EXP_SET_OF_OPT(stname, field, type, tag) \
342 ASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_SET_OF|ASN1_TFLG_OPTIONAL)
343
344#define ASN1_IMP_SEQUENCE_OF(stname, field, type, tag) \
345 ASN1_IMP_EX(stname, field, type, tag, ASN1_TFLG_SEQUENCE_OF)
346
347#define ASN1_IMP_SEQUENCE_OF_OPT(stname, field, type, tag) \
348 ASN1_IMP_EX(stname, field, type, tag, ASN1_TFLG_SEQUENCE_OF|ASN1_TFLG_OPTIONAL)
349
350#define ASN1_EXP_SEQUENCE_OF(stname, field, type, tag) \
351 ASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_SEQUENCE_OF)
352
353#define ASN1_EXP_SEQUENCE_OF_OPT(stname, field, type, tag) \
354 ASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_SEQUENCE_OF|ASN1_TFLG_OPTIONAL)
355
356/* Macros for the ASN1_ADB structure */
357
358#define ASN1_ADB(name) \
359 const static ASN1_ADB_TABLE name##_adbtbl[]
360
361#ifndef OPENSSL_EXPORT_VAR_AS_FUNCTION
362
363#define ASN1_ADB_END(name, flags, field, app_table, def, none) \
364 ;\
365 const static ASN1_ADB name##_adb = {\
366 flags,\
367 offsetof(name, field),\
368 app_table,\
369 name##_adbtbl,\
370 sizeof(name##_adbtbl) / sizeof(ASN1_ADB_TABLE),\
371 def,\
372 none\
373 }
374
375#else
376
377#define ASN1_ADB_END(name, flags, field, app_table, def, none) \
378 ;\
379 const static ASN1_ITEM *name##_adb(void) \
380 { \
381 const static ASN1_ADB internal_adb = \
382 {\
383 flags,\
384 offsetof(name, field),\
385 app_table,\
386 name##_adbtbl,\
387 sizeof(name##_adbtbl) / sizeof(ASN1_ADB_TABLE),\
388 def,\
389 none\
390 }; \
391 return (const ASN1_ITEM *) &internal_adb; \
392 } \
393 void dummy_function(void)
394
395#endif
396
397#define ADB_ENTRY(val, template) {val, template}
398
399#define ASN1_ADB_TEMPLATE(name) \
400 const static ASN1_TEMPLATE name##_tt
401
402/* This is the ASN1 template structure that defines
403 * a wrapper round the actual type. It determines the
404 * actual position of the field in the value structure,
405 * various flags such as OPTIONAL and the field name.
406 */
407
408struct ASN1_TEMPLATE_st {
409unsigned long flags; /* Various flags */
410long tag; /* tag, not used if no tagging */
411unsigned long offset; /* Offset of this field in structure */
412#ifndef NO_ASN1_FIELD_NAMES
413char *field_name; /* Field name */
414#endif
415ASN1_ITEM_EXP *item; /* Relevant ASN1_ITEM or ASN1_ADB */
416};
417
418/* Macro to extract ASN1_ITEM and ASN1_ADB pointer from ASN1_TEMPLATE */
419
420#define ASN1_TEMPLATE_item(t) (t->item_ptr)
421#define ASN1_TEMPLATE_adb(t) (t->item_ptr)
422
423typedef struct ASN1_ADB_TABLE_st ASN1_ADB_TABLE;
424typedef struct ASN1_ADB_st ASN1_ADB;
425
426struct ASN1_ADB_st {
427 unsigned long flags; /* Various flags */
428 unsigned long offset; /* Offset of selector field */
429 STACK_OF(ASN1_ADB_TABLE) **app_items; /* Application defined items */
430 const ASN1_ADB_TABLE *tbl; /* Table of possible types */
431 long tblcount; /* Number of entries in tbl */
432 const ASN1_TEMPLATE *default_tt; /* Type to use if no match */
433 const ASN1_TEMPLATE *null_tt; /* Type to use if selector is NULL */
434};
435
436struct ASN1_ADB_TABLE_st {
437 long value; /* NID for an object or value for an int */
438 const ASN1_TEMPLATE tt; /* item for this value */
439};
440
441/* template flags */
442
443/* Field is optional */
444#define ASN1_TFLG_OPTIONAL (0x1)
445
446/* Field is a SET OF */
447#define ASN1_TFLG_SET_OF (0x1 << 1)
448
449/* Field is a SEQUENCE OF */
450#define ASN1_TFLG_SEQUENCE_OF (0x2 << 1)
451
452/* Special case: this refers to a SET OF that
453 * will be sorted into DER order when encoded *and*
454 * the corresponding STACK will be modified to match
455 * the new order.
456 */
457#define ASN1_TFLG_SET_ORDER (0x3 << 1)
458
459/* Mask for SET OF or SEQUENCE OF */
460#define ASN1_TFLG_SK_MASK (0x3 << 1)
461
462/* These flags mean the tag should be taken from the
463 * tag field. If EXPLICIT then the underlying type
464 * is used for the inner tag.
465 */
466
467/* IMPLICIT tagging */
468#define ASN1_TFLG_IMPTAG (0x1 << 3)
469
470
471/* EXPLICIT tagging, inner tag from underlying type */
472#define ASN1_TFLG_EXPTAG (0x2 << 3)
473
474#define ASN1_TFLG_TAG_MASK (0x3 << 3)
475
476/* context specific IMPLICIT */
477#define ASN1_TFLG_IMPLICIT ASN1_TFLG_IMPTAG|ASN1_TFLG_CONTEXT
478
479/* context specific EXPLICIT */
480#define ASN1_TFLG_EXPLICIT ASN1_TFLG_EXPTAG|ASN1_TFLG_CONTEXT
481
482/* If tagging is in force these determine the
483 * type of tag to use. Otherwise the tag is
484 * determined by the underlying type. These
485 * values reflect the actual octet format.
486 */
487
488/* Universal tag */
489#define ASN1_TFLG_UNIVERSAL (0x0<<6)
490/* Application tag */
491#define ASN1_TFLG_APPLICATION (0x1<<6)
492/* Context specific tag */
493#define ASN1_TFLG_CONTEXT (0x2<<6)
494/* Private tag */
495#define ASN1_TFLG_PRIVATE (0x3<<6)
496
497#define ASN1_TFLG_TAG_CLASS (0x3<<6)
498
499/* These are for ANY DEFINED BY type. In this case
500 * the 'item' field points to an ASN1_ADB structure
501 * which contains a table of values to decode the
502 * relevant type
503 */
504
505#define ASN1_TFLG_ADB_MASK (0x3<<8)
506
507#define ASN1_TFLG_ADB_OID (0x1<<8)
508
509#define ASN1_TFLG_ADB_INT (0x1<<9)
510
511/* This flag means a parent structure is passed
512 * instead of the field: this is useful is a
513 * SEQUENCE is being combined with a CHOICE for
514 * example. Since this means the structure and
515 * item name will differ we need to use the
516 * ASN1_CHOICE_END_name() macro for example.
517 */
518
519#define ASN1_TFLG_COMBINE (0x1<<10)
520
521/* This is the actual ASN1 item itself */
522
523struct ASN1_ITEM_st {
524char itype; /* The item type, primitive, SEQUENCE, CHOICE or extern */
525long utype; /* underlying type */
526const ASN1_TEMPLATE *templates; /* If SEQUENCE or CHOICE this contains the contents */
527long tcount; /* Number of templates if SEQUENCE or CHOICE */
528const void *funcs; /* functions that handle this type */
529long size; /* Structure size (usually)*/
530#ifndef NO_ASN1_FIELD_NAMES
531const char *sname; /* Structure name */
532#endif
533};
534
535/* These are values for the itype field and
536 * determine how the type is interpreted.
537 *
538 * For PRIMITIVE types the underlying type
539 * determines the behaviour if items is NULL.
540 *
541 * Otherwise templates must contain a single
542 * template and the type is treated in the
543 * same way as the type specified in the template.
544 *
545 * For SEQUENCE types the templates field points
546 * to the members, the size field is the
547 * structure size.
548 *
549 * For CHOICE types the templates field points
550 * to each possible member (typically a union)
551 * and the 'size' field is the offset of the
552 * selector.
553 *
554 * The 'funcs' field is used for application
555 * specific functions.
556 *
557 * For COMPAT types the funcs field gives a
558 * set of functions that handle this type, this
559 * supports the old d2i, i2d convention.
560 *
561 * The EXTERN type uses a new style d2i/i2d.
562 * The new style should be used where possible
563 * because it avoids things like the d2i IMPLICIT
564 * hack.
565 *
566 * MSTRING is a multiple string type, it is used
567 * for a CHOICE of character strings where the
568 * actual strings all occupy an ASN1_STRING
569 * structure. In this case the 'utype' field
570 * has a special meaning, it is used as a mask
571 * of acceptable types using the B_ASN1 constants.
572 *
573 */
574
575#define ASN1_ITYPE_PRIMITIVE 0x0
576
577#define ASN1_ITYPE_SEQUENCE 0x1
578
579#define ASN1_ITYPE_CHOICE 0x2
580
581#define ASN1_ITYPE_COMPAT 0x3
582
583#define ASN1_ITYPE_EXTERN 0x4
584
585#define ASN1_ITYPE_MSTRING 0x5
586
587/* Cache for ASN1 tag and length, so we
588 * don't keep re-reading it for things
589 * like CHOICE
590 */
591
592struct ASN1_TLC_st{
593 char valid; /* Values below are valid */
594 int ret; /* return value */
595 long plen; /* length */
596 int ptag; /* class value */
597 int pclass; /* class value */
598 int hdrlen; /* header length */
599};
600
601/* Typedefs for ASN1 function pointers */
602
603typedef ASN1_VALUE * ASN1_new_func(void);
604typedef void ASN1_free_func(ASN1_VALUE *a);
605typedef ASN1_VALUE * ASN1_d2i_func(ASN1_VALUE **a, unsigned char ** in, long length);
606typedef int ASN1_i2d_func(ASN1_VALUE * a, unsigned char **in);
607
608typedef int ASN1_ex_d2i(ASN1_VALUE **pval, unsigned char **in, long len, const ASN1_ITEM *it,
609 int tag, int aclass, char opt, ASN1_TLC *ctx);
610
611typedef int ASN1_ex_i2d(ASN1_VALUE **pval, unsigned char **out, const ASN1_ITEM *it, int tag, int aclass);
612typedef int ASN1_ex_new_func(ASN1_VALUE **pval, const ASN1_ITEM *it);
613typedef void ASN1_ex_free_func(ASN1_VALUE **pval, const ASN1_ITEM *it);
614
615typedef int ASN1_primitive_i2c(ASN1_VALUE **pval, unsigned char *cont, int *putype, 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);
617
618typedef struct ASN1_COMPAT_FUNCS_st {
619 ASN1_new_func *asn1_new;
620 ASN1_free_func *asn1_free;
621 ASN1_d2i_func *asn1_d2i;
622 ASN1_i2d_func *asn1_i2d;
623} ASN1_COMPAT_FUNCS;
624
625typedef struct ASN1_EXTERN_FUNCS_st {
626 void *app_data;
627 ASN1_ex_new_func *asn1_ex_new;
628 ASN1_ex_free_func *asn1_ex_free;
629 ASN1_ex_free_func *asn1_ex_clear;
630 ASN1_ex_d2i *asn1_ex_d2i;
631 ASN1_ex_i2d *asn1_ex_i2d;
632} ASN1_EXTERN_FUNCS;
633
634typedef struct ASN1_PRIMITIVE_FUNCS_st {
635 void *app_data;
636 unsigned long flags;
637 ASN1_ex_new_func *prim_new;
638 ASN1_ex_free_func *prim_free;
639 ASN1_ex_free_func *prim_clear;
640 ASN1_primitive_c2i *prim_c2i;
641 ASN1_primitive_i2c *prim_i2c;
642} ASN1_PRIMITIVE_FUNCS;
643
644/* This is the ASN1_AUX structure: it handles various
645 * miscellaneous requirements. For example the use of
646 * reference counts and an informational callback.
647 *
648 * The "informational callback" is called at various
649 * points during the ASN1 encoding and decoding. It can
650 * be used to provide minor customisation of the structures
651 * used. This is most useful where the supplied routines
652 * *almost* do the right thing but need some extra help
653 * at a few points. If the callback returns zero then
654 * it is assumed a fatal error has occurred and the
655 * main operation should be abandoned.
656 *
657 * If major changes in the default behaviour are required
658 * then an external type is more appropriate.
659 */
660
661typedef int ASN1_aux_cb(int operation, ASN1_VALUE **in, const ASN1_ITEM *it);
662
663typedef struct ASN1_AUX_st {
664 void *app_data;
665 int flags;
666 int ref_offset; /* Offset of reference value */
667 int ref_lock; /* Lock type to use */
668 ASN1_aux_cb *asn1_cb;
669 int enc_offset; /* Offset of ASN1_ENCODING structure */
670} ASN1_AUX;
671
672/* Flags in ASN1_AUX */
673
674/* Use a reference count */
675#define ASN1_AFLG_REFCOUNT 1
676/* Save the encoding of structure (useful for signatures) */
677#define ASN1_AFLG_ENCODING 2
678/* The Sequence length is invalid */
679#define ASN1_AFLG_BROKEN 4
680
681/* operation values for asn1_cb */
682
683#define ASN1_OP_NEW_PRE 0
684#define ASN1_OP_NEW_POST 1
685#define ASN1_OP_FREE_PRE 2
686#define ASN1_OP_FREE_POST 3
687#define ASN1_OP_D2I_PRE 4
688#define ASN1_OP_D2I_POST 5
689#define ASN1_OP_I2D_PRE 6
690#define ASN1_OP_I2D_POST 7
691
692/* Macro to implement a primitive type */
693#define IMPLEMENT_ASN1_TYPE(stname) IMPLEMENT_ASN1_TYPE_ex(stname, stname, 0)
694#define IMPLEMENT_ASN1_TYPE_ex(itname, vname, ex) \
695 ASN1_ITEM_start(itname) \
696 ASN1_ITYPE_PRIMITIVE, V_##vname, NULL, 0, NULL, ex, #itname \
697 ASN1_ITEM_end(itname)
698
699/* Macro to implement a multi string type */
700#define IMPLEMENT_ASN1_MSTRING(itname, mask) \
701 ASN1_ITEM_start(itname) \
702 ASN1_ITYPE_MSTRING, mask, NULL, 0, NULL, sizeof(ASN1_STRING), #itname \
703 ASN1_ITEM_end(itname)
704
705/* Macro to implement an ASN1_ITEM in terms of old style funcs */
706
707#define IMPLEMENT_COMPAT_ASN1(sname) IMPLEMENT_COMPAT_ASN1_type(sname, V_ASN1_SEQUENCE)
708
709#define IMPLEMENT_COMPAT_ASN1_type(sname, tag) \
710 static const ASN1_COMPAT_FUNCS sname##_ff = { \
711 (ASN1_new_func *)sname##_new, \
712 (ASN1_free_func *)sname##_free, \
713 (ASN1_d2i_func *)d2i_##sname, \
714 (ASN1_i2d_func *)i2d_##sname, \
715 }; \
716 ASN1_ITEM_start(sname) \
717 ASN1_ITYPE_COMPAT, \
718 tag, \
719 NULL, \
720 0, \
721 &sname##_ff, \
722 0, \
723 #sname \
724 ASN1_ITEM_end(sname)
725
726#define IMPLEMENT_EXTERN_ASN1(sname, tag, fptrs) \
727 ASN1_ITEM_start(sname) \
728 ASN1_ITYPE_EXTERN, \
729 tag, \
730 NULL, \
731 0, \
732 &fptrs, \
733 0, \
734 #sname \
735 ASN1_ITEM_end(sname)
736
737/* Macro to implement standard functions in terms of ASN1_ITEM structures */
738
739#define IMPLEMENT_ASN1_FUNCTIONS(stname) IMPLEMENT_ASN1_FUNCTIONS_fname(stname, stname, stname)
740
741#define IMPLEMENT_ASN1_FUNCTIONS_name(stname, itname) IMPLEMENT_ASN1_FUNCTIONS_fname(stname, itname, itname)
742
743#define IMPLEMENT_ASN1_FUNCTIONS_ENCODE_name(stname, itname) \
744 IMPLEMENT_ASN1_FUNCTIONS_ENCODE_fname(stname, itname, itname)
745
746#define IMPLEMENT_ASN1_ALLOC_FUNCTIONS_fname(stname, itname, fname) \
747 stname *fname##_new(void) \
748 { \
749 return (stname *)ASN1_item_new(ASN1_ITEM_rptr(itname)); \
750 } \
751 void fname##_free(stname *a) \
752 { \
753 ASN1_item_free((ASN1_VALUE *)a, ASN1_ITEM_rptr(itname)); \
754 }
755
756#define IMPLEMENT_ASN1_FUNCTIONS_fname(stname, itname, fname) \
757 IMPLEMENT_ASN1_ENCODE_FUNCTIONS_fname(stname, itname, fname) \
758 IMPLEMENT_ASN1_ALLOC_FUNCTIONS_fname(stname, itname, fname)
759
760#define IMPLEMENT_ASN1_ENCODE_FUNCTIONS_fname(stname, itname, fname) \
761 stname *d2i_##fname(stname **a, unsigned char **in, long len) \
762 { \
763 return (stname *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, ASN1_ITEM_rptr(itname));\
764 } \
765 int i2d_##fname(stname *a, unsigned char **out) \
766 { \
767 return ASN1_item_i2d((ASN1_VALUE *)a, out, ASN1_ITEM_rptr(itname));\
768 }
769
770/* This includes evil casts to remove const: they will go away when full
771 * ASN1 constification is done.
772 */
773#define IMPLEMENT_ASN1_ENCODE_FUNCTIONS_const_fname(stname, itname, fname) \
774 stname *d2i_##fname(stname **a, const unsigned char **in, long len) \
775 { \
776 return (stname *)ASN1_item_d2i((ASN1_VALUE **)a, (unsigned char **)in, len, ASN1_ITEM_rptr(itname));\
777 } \
778 int i2d_##fname(const stname *a, unsigned char **out) \
779 { \
780 return ASN1_item_i2d((ASN1_VALUE *)a, out, ASN1_ITEM_rptr(itname));\
781 }
782
783#define IMPLEMENT_ASN1_DUP_FUNCTION(stname) \
784 stname * stname##_dup(stname *x) \
785 { \
786 return ASN1_item_dup(ASN1_ITEM_rptr(stname), x); \
787 }
788
789#define IMPLEMENT_ASN1_FUNCTIONS_const(name) \
790 IMPLEMENT_ASN1_FUNCTIONS_const_fname(name, name, name)
791
792#define IMPLEMENT_ASN1_FUNCTIONS_const_fname(stname, itname, fname) \
793 IMPLEMENT_ASN1_ENCODE_FUNCTIONS_const_fname(stname, itname, fname) \
794 IMPLEMENT_ASN1_ALLOC_FUNCTIONS_fname(stname, itname, fname)
795
796/* external definitions for primitive types */
797
798DECLARE_ASN1_ITEM(ASN1_BOOLEAN)
799DECLARE_ASN1_ITEM(ASN1_TBOOLEAN)
800DECLARE_ASN1_ITEM(ASN1_FBOOLEAN)
801DECLARE_ASN1_ITEM(ASN1_ANY)
802DECLARE_ASN1_ITEM(ASN1_SEQUENCE)
803DECLARE_ASN1_ITEM(CBIGNUM)
804DECLARE_ASN1_ITEM(BIGNUM)
805DECLARE_ASN1_ITEM(LONG)
806DECLARE_ASN1_ITEM(ZLONG)
807
808DECLARE_STACK_OF(ASN1_VALUE)
809
810/* Functions used internally by the ASN1 code */
811
812int ASN1_item_ex_new(ASN1_VALUE **pval, const ASN1_ITEM *it);
813void ASN1_item_ex_free(ASN1_VALUE **pval, const ASN1_ITEM *it);
814int ASN1_template_new(ASN1_VALUE **pval, const ASN1_TEMPLATE *tt);
815int ASN1_primitive_new(ASN1_VALUE **pval, const ASN1_ITEM *it);
816
817void ASN1_template_free(ASN1_VALUE **pval, const ASN1_TEMPLATE *tt);
818int ASN1_template_d2i(ASN1_VALUE **pval, unsigned char **in, long len, const ASN1_TEMPLATE *tt);
819int ASN1_item_ex_d2i(ASN1_VALUE **pval, unsigned char **in, long len, const ASN1_ITEM *it,
820 int tag, int aclass, char opt, ASN1_TLC *ctx);
821
822int ASN1_item_ex_i2d(ASN1_VALUE **pval, unsigned char **out, const ASN1_ITEM *it, int tag, int aclass);
823int ASN1_template_i2d(ASN1_VALUE **pval, unsigned char **out, const ASN1_TEMPLATE *tt);
824void ASN1_primitive_free(ASN1_VALUE **pval, const ASN1_ITEM *it);
825
826int asn1_ex_i2c(ASN1_VALUE **pval, unsigned char *cont, int *putype, 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);
828
829int asn1_get_choice_selector(ASN1_VALUE **pval, const ASN1_ITEM *it);
830int asn1_set_choice_selector(ASN1_VALUE **pval, int value, const ASN1_ITEM *it);
831
832ASN1_VALUE ** asn1_get_field_ptr(ASN1_VALUE **pval, const ASN1_TEMPLATE *tt);
833
834const ASN1_TEMPLATE *asn1_do_adb(ASN1_VALUE **pval, const ASN1_TEMPLATE *tt, int nullerr);
835
836int asn1_do_lock(ASN1_VALUE **pval, int op, const ASN1_ITEM *it);
837
838void asn1_enc_init(ASN1_VALUE **pval, const ASN1_ITEM *it);
839void asn1_enc_free(ASN1_VALUE **pval, const ASN1_ITEM *it);
840int asn1_enc_restore(int *len, unsigned char **out, ASN1_VALUE **pval, const ASN1_ITEM *it);
841int asn1_enc_save(ASN1_VALUE **pval, unsigned char *in, int inlen, const ASN1_ITEM *it);
842
843#ifdef __cplusplus
844}
845#endif
846#endif
diff --git a/src/lib/libcrypto/asn1/asn_moid.c b/src/lib/libcrypto/asn1/asn_moid.c
new file mode 100644
index 0000000000..be20db4bad
--- /dev/null
+++ b/src/lib/libcrypto/asn1/asn_moid.c
@@ -0,0 +1,95 @@
1/* asn_moid.c */
2/* Written by Stephen Henson (shenson@bigfoot.com) for the OpenSSL
3 * project 2001.
4 */
5/* ====================================================================
6 * Copyright (c) 2001 The OpenSSL Project. All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 *
12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 *
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in
17 * the documentation and/or other materials provided with the
18 * distribution.
19 *
20 * 3. All advertising materials mentioning features or use of this
21 * software must display the following acknowledgment:
22 * "This product includes software developed by the OpenSSL Project
23 * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
24 *
25 * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
26 * endorse or promote products derived from this software without
27 * prior written permission. For written permission, please contact
28 * licensing@OpenSSL.org.
29 *
30 * 5. Products derived from this software may not be called "OpenSSL"
31 * nor may "OpenSSL" appear in their names without prior written
32 * permission of the OpenSSL Project.
33 *
34 * 6. Redistributions of any form whatsoever must retain the following
35 * acknowledgment:
36 * "This product includes software developed by the OpenSSL Project
37 * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
38 *
39 * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
40 * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
41 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
42 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
43 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
44 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
45 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
46 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
47 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
48 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
49 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
50 * OF THE POSSIBILITY OF SUCH DAMAGE.
51 * ====================================================================
52 *
53 * This product includes cryptographic software written by Eric Young
54 * (eay@cryptsoft.com). This product includes software written by Tim
55 * Hudson (tjh@cryptsoft.com).
56 *
57 */
58
59#include <stdio.h>
60#include <openssl/crypto.h>
61#include "cryptlib.h"
62#include <openssl/conf.h>
63#include <openssl/dso.h>
64#include <openssl/x509.h>
65
66/* Simple ASN1 OID module: add all objects in a given section */
67
68static int oid_module_init(CONF_IMODULE *md, const CONF *cnf)
69 {
70 int i;
71 const char *oid_section;
72 STACK_OF(CONF_VALUE) *sktmp;
73 CONF_VALUE *oval;
74 oid_section = CONF_imodule_get_value(md);
75 if(!(sktmp = NCONF_get_section(cnf, oid_section)))
76 {
77 ASN1err(ASN1_F_OID_MODULE_INIT, ASN1_R_ERROR_LOADING_SECTION);
78 return 0;
79 }
80 for(i = 0; i < sk_CONF_VALUE_num(sktmp); i++)
81 {
82 oval = sk_CONF_VALUE_value(sktmp, i);
83 if(OBJ_create(oval->value, oval->name, oval->name) == NID_undef)
84 {
85 ASN1err(ASN1_F_OID_MODULE_INIT, ASN1_R_ADDING_OBJECT);
86 return 0;
87 }
88 }
89 return 1;
90}
91
92void ASN1_add_oid_module(void)
93 {
94 CONF_module_add("oid_section", oid_module_init, 0);
95 }
diff --git a/src/lib/libcrypto/asn1/asn_pack.c b/src/lib/libcrypto/asn1/asn_pack.c
index bdf5f130b3..e6051db2dc 100644
--- a/src/lib/libcrypto/asn1/asn_pack.c
+++ b/src/lib/libcrypto/asn1/asn_pack.c
@@ -60,6 +60,8 @@
60#include "cryptlib.h" 60#include "cryptlib.h"
61#include <openssl/asn1.h> 61#include <openssl/asn1.h>
62 62
63#ifndef NO_ASN1_OLD
64
63/* ASN1 packing and unpacking functions */ 65/* ASN1 packing and unpacking functions */
64 66
65/* Turn an ASN1 encoded SEQUENCE OF into a STACK of structures */ 67/* Turn an ASN1 encoded SEQUENCE OF into a STACK of structures */
@@ -117,7 +119,7 @@ void *ASN1_unpack_string (ASN1_STRING *oct, char *(*d2i)())
117 119
118/* Pack an ASN1 object into an ASN1_STRING */ 120/* Pack an ASN1 object into an ASN1_STRING */
119 121
120ASN1_STRING *ASN1_pack_string (void *obj, int (*i2d)(), ASN1_STRING **oct) 122ASN1_STRING *ASN1_pack_string(void *obj, int (*i2d)(), ASN1_STRING **oct)
121{ 123{
122 unsigned char *p; 124 unsigned char *p;
123 ASN1_STRING *octmp; 125 ASN1_STRING *octmp;
@@ -143,3 +145,47 @@ ASN1_STRING *ASN1_pack_string (void *obj, int (*i2d)(), ASN1_STRING **oct)
143 return octmp; 145 return octmp;
144} 146}
145 147
148#endif
149
150/* ASN1_ITEM versions of the above */
151
152ASN1_STRING *ASN1_item_pack(void *obj, const ASN1_ITEM *it, ASN1_STRING **oct)
153{
154 ASN1_STRING *octmp;
155
156 if (!oct || !*oct) {
157 if (!(octmp = ASN1_STRING_new ())) {
158 ASN1err(ASN1_F_ASN1_PACK_STRING,ERR_R_MALLOC_FAILURE);
159 return NULL;
160 }
161 if (oct) *oct = octmp;
162 } else octmp = *oct;
163
164 if(octmp->data) {
165 OPENSSL_free(octmp->data);
166 octmp->data = NULL;
167 }
168
169 if (!(octmp->length = ASN1_item_i2d(obj, &octmp->data, it))) {
170 ASN1err(ASN1_F_ASN1_PACK_STRING,ASN1_R_ENCODE_ERROR);
171 return NULL;
172 }
173 if (!octmp->data) {
174 ASN1err(ASN1_F_ASN1_PACK_STRING,ERR_R_MALLOC_FAILURE);
175 return NULL;
176 }
177 return octmp;
178}
179
180/* Extract an ASN1 object from an ASN1_STRING */
181
182void *ASN1_item_unpack(ASN1_STRING *oct, const ASN1_ITEM *it)
183{
184 unsigned char *p;
185 void *ret;
186
187 p = oct->data;
188 if(!(ret = ASN1_item_d2i(NULL, &p, oct->length, it)))
189 ASN1err(ASN1_F_ASN1_UNPACK_STRING,ASN1_R_DECODE_ERROR);
190 return ret;
191}
diff --git a/src/lib/libcrypto/asn1/d2i_pr.c b/src/lib/libcrypto/asn1/d2i_pr.c
index c92b8325d8..2e7d96af90 100644
--- a/src/lib/libcrypto/asn1/d2i_pr.c
+++ b/src/lib/libcrypto/asn1/d2i_pr.c
@@ -62,6 +62,12 @@
62#include <openssl/evp.h> 62#include <openssl/evp.h>
63#include <openssl/objects.h> 63#include <openssl/objects.h>
64#include <openssl/asn1.h> 64#include <openssl/asn1.h>
65#ifndef OPENSSL_NO_RSA
66#include <openssl/rsa.h>
67#endif
68#ifndef OPENSSL_NO_DSA
69#include <openssl/dsa.h>
70#endif
65 71
66EVP_PKEY *d2i_PrivateKey(int type, EVP_PKEY **a, unsigned char **pp, 72EVP_PKEY *d2i_PrivateKey(int type, EVP_PKEY **a, unsigned char **pp,
67 long length) 73 long length)
@@ -82,18 +88,20 @@ EVP_PKEY *d2i_PrivateKey(int type, EVP_PKEY **a, unsigned char **pp,
82 ret->type=EVP_PKEY_type(type); 88 ret->type=EVP_PKEY_type(type);
83 switch (ret->type) 89 switch (ret->type)
84 { 90 {
85#ifndef NO_RSA 91#ifndef OPENSSL_NO_RSA
86 case EVP_PKEY_RSA: 92 case EVP_PKEY_RSA:
87 if ((ret->pkey.rsa=d2i_RSAPrivateKey(NULL,pp,length)) == NULL) 93 if ((ret->pkey.rsa=d2i_RSAPrivateKey(NULL,
94 (const unsigned char **)pp,length)) == NULL) /* TMP UGLY CAST */
88 { 95 {
89 ASN1err(ASN1_F_D2I_PRIVATEKEY,ERR_R_ASN1_LIB); 96 ASN1err(ASN1_F_D2I_PRIVATEKEY,ERR_R_ASN1_LIB);
90 goto err; 97 goto err;
91 } 98 }
92 break; 99 break;
93#endif 100#endif
94#ifndef NO_DSA 101#ifndef OPENSSL_NO_DSA
95 case EVP_PKEY_DSA: 102 case EVP_PKEY_DSA:
96 if ((ret->pkey.dsa=d2i_DSAPrivateKey(NULL,pp,length)) == NULL) 103 if ((ret->pkey.dsa=d2i_DSAPrivateKey(NULL,
104 (const unsigned char **)pp,length)) == NULL) /* TMP UGLY CAST */
97 { 105 {
98 ASN1err(ASN1_F_D2I_PRIVATEKEY,ERR_R_ASN1_LIB); 106 ASN1err(ASN1_F_D2I_PRIVATEKEY,ERR_R_ASN1_LIB);
99 goto err; 107 goto err;
diff --git a/src/lib/libcrypto/asn1/d2i_pu.c b/src/lib/libcrypto/asn1/d2i_pu.c
index e0d203cef7..71f2eb361b 100644
--- a/src/lib/libcrypto/asn1/d2i_pu.c
+++ b/src/lib/libcrypto/asn1/d2i_pu.c
@@ -62,6 +62,12 @@
62#include <openssl/evp.h> 62#include <openssl/evp.h>
63#include <openssl/objects.h> 63#include <openssl/objects.h>
64#include <openssl/asn1.h> 64#include <openssl/asn1.h>
65#ifndef OPENSSL_NO_RSA
66#include <openssl/rsa.h>
67#endif
68#ifndef OPENSSL_NO_DSA
69#include <openssl/dsa.h>
70#endif
65 71
66EVP_PKEY *d2i_PublicKey(int type, EVP_PKEY **a, unsigned char **pp, 72EVP_PKEY *d2i_PublicKey(int type, EVP_PKEY **a, unsigned char **pp,
67 long length) 73 long length)
@@ -82,18 +88,20 @@ EVP_PKEY *d2i_PublicKey(int type, EVP_PKEY **a, unsigned char **pp,
82 ret->type=EVP_PKEY_type(type); 88 ret->type=EVP_PKEY_type(type);
83 switch (ret->type) 89 switch (ret->type)
84 { 90 {
85#ifndef NO_RSA 91#ifndef OPENSSL_NO_RSA
86 case EVP_PKEY_RSA: 92 case EVP_PKEY_RSA:
87 if ((ret->pkey.rsa=d2i_RSAPublicKey(NULL,pp,length)) == NULL) 93 if ((ret->pkey.rsa=d2i_RSAPublicKey(NULL,
94 (const unsigned char **)pp,length)) == NULL) /* TMP UGLY CAST */
88 { 95 {
89 ASN1err(ASN1_F_D2I_PUBLICKEY,ERR_R_ASN1_LIB); 96 ASN1err(ASN1_F_D2I_PUBLICKEY,ERR_R_ASN1_LIB);
90 goto err; 97 goto err;
91 } 98 }
92 break; 99 break;
93#endif 100#endif
94#ifndef NO_DSA 101#ifndef OPENSSL_NO_DSA
95 case EVP_PKEY_DSA: 102 case EVP_PKEY_DSA:
96 if ((ret->pkey.dsa=d2i_DSAPublicKey(NULL,pp,length)) == NULL) 103 if ((ret->pkey.dsa=d2i_DSAPublicKey(NULL,
104 (const unsigned char **)pp,length)) == NULL) /* TMP UGLY CAST */
97 { 105 {
98 ASN1err(ASN1_F_D2I_PUBLICKEY,ERR_R_ASN1_LIB); 106 ASN1err(ASN1_F_D2I_PUBLICKEY,ERR_R_ASN1_LIB);
99 goto err; 107 goto err;
diff --git a/src/lib/libcrypto/asn1/f_int.c b/src/lib/libcrypto/asn1/f_int.c
index 6b090f6740..48cc3bfb90 100644
--- a/src/lib/libcrypto/asn1/f_int.c
+++ b/src/lib/libcrypto/asn1/f_int.c
@@ -69,10 +69,16 @@ int i2a_ASN1_INTEGER(BIO *bp, ASN1_INTEGER *a)
69 69
70 if (a == NULL) return(0); 70 if (a == NULL) return(0);
71 71
72 if (a->type & V_ASN1_NEG)
73 {
74 if (BIO_write(bp, "-", 1) != 1) goto err;
75 n = 1;
76 }
77
72 if (a->length == 0) 78 if (a->length == 0)
73 { 79 {
74 if (BIO_write(bp,"00",2) != 2) goto err; 80 if (BIO_write(bp,"00",2) != 2) goto err;
75 n=2; 81 n += 2;
76 } 82 }
77 else 83 else
78 { 84 {
diff --git a/src/lib/libcrypto/asn1/i2d_pr.c b/src/lib/libcrypto/asn1/i2d_pr.c
index 71d6910204..1e951ae01d 100644
--- a/src/lib/libcrypto/asn1/i2d_pr.c
+++ b/src/lib/libcrypto/asn1/i2d_pr.c
@@ -61,17 +61,23 @@
61#include <openssl/bn.h> 61#include <openssl/bn.h>
62#include <openssl/evp.h> 62#include <openssl/evp.h>
63#include <openssl/objects.h> 63#include <openssl/objects.h>
64#ifndef OPENSSL_NO_RSA
65#include <openssl/rsa.h>
66#endif
67#ifndef OPENSSL_NO_DSA
68#include <openssl/dsa.h>
69#endif
64 70
65int i2d_PrivateKey(EVP_PKEY *a, unsigned char **pp) 71int i2d_PrivateKey(EVP_PKEY *a, unsigned char **pp)
66 { 72 {
67#ifndef NO_RSA 73#ifndef OPENSSL_NO_RSA
68 if (a->type == EVP_PKEY_RSA) 74 if (a->type == EVP_PKEY_RSA)
69 { 75 {
70 return(i2d_RSAPrivateKey(a->pkey.rsa,pp)); 76 return(i2d_RSAPrivateKey(a->pkey.rsa,pp));
71 } 77 }
72 else 78 else
73#endif 79#endif
74#ifndef NO_DSA 80#ifndef OPENSSL_NO_DSA
75 if (a->type == EVP_PKEY_DSA) 81 if (a->type == EVP_PKEY_DSA)
76 { 82 {
77 return(i2d_DSAPrivateKey(a->pkey.dsa,pp)); 83 return(i2d_DSAPrivateKey(a->pkey.dsa,pp));
diff --git a/src/lib/libcrypto/asn1/i2d_pu.c b/src/lib/libcrypto/asn1/i2d_pu.c
index 8f73d37d03..013d19bbf4 100644
--- a/src/lib/libcrypto/asn1/i2d_pu.c
+++ b/src/lib/libcrypto/asn1/i2d_pu.c
@@ -61,16 +61,22 @@
61#include <openssl/bn.h> 61#include <openssl/bn.h>
62#include <openssl/evp.h> 62#include <openssl/evp.h>
63#include <openssl/objects.h> 63#include <openssl/objects.h>
64#ifndef OPENSSL_NO_RSA
65#include <openssl/rsa.h>
66#endif
67#ifndef OPENSSL_NO_DSA
68#include <openssl/dsa.h>
69#endif
64 70
65int i2d_PublicKey(EVP_PKEY *a, unsigned char **pp) 71int i2d_PublicKey(EVP_PKEY *a, unsigned char **pp)
66 { 72 {
67 switch (a->type) 73 switch (a->type)
68 { 74 {
69#ifndef NO_RSA 75#ifndef OPENSSL_NO_RSA
70 case EVP_PKEY_RSA: 76 case EVP_PKEY_RSA:
71 return(i2d_RSAPublicKey(a->pkey.rsa,pp)); 77 return(i2d_RSAPublicKey(a->pkey.rsa,pp));
72#endif 78#endif
73#ifndef NO_DSA 79#ifndef OPENSSL_NO_DSA
74 case EVP_PKEY_DSA: 80 case EVP_PKEY_DSA:
75 return(i2d_DSAPublicKey(a->pkey.dsa,pp)); 81 return(i2d_DSAPublicKey(a->pkey.dsa,pp));
76#endif 82#endif
diff --git a/src/lib/libcrypto/asn1/n_pkey.c b/src/lib/libcrypto/asn1/n_pkey.c
index 9840193538..49f80fffd2 100644
--- a/src/lib/libcrypto/asn1/n_pkey.c
+++ b/src/lib/libcrypto/asn1/n_pkey.c
@@ -56,110 +56,134 @@
56 * [including the GNU Public Licence.] 56 * [including the GNU Public Licence.]
57 */ 57 */
58 58
59#ifndef NO_RSA 59#ifndef OPENSSL_NO_RSA
60#include <stdio.h> 60#include <stdio.h>
61#include "cryptlib.h" 61#include "cryptlib.h"
62#include <openssl/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/asn1_mac.h> 65#include <openssl/asn1_mac.h>
65#include <openssl/evp.h> 66#include <openssl/evp.h>
66#include <openssl/x509.h> 67#include <openssl/x509.h>
67 68
68 69
69#ifndef NO_RC4 70#ifndef OPENSSL_NO_RC4
70 71
71typedef struct netscape_pkey_st 72typedef struct netscape_pkey_st
72 { 73 {
73 ASN1_INTEGER *version; 74 long version;
74 X509_ALGOR *algor; 75 X509_ALGOR *algor;
75 ASN1_OCTET_STRING *private_key; 76 ASN1_OCTET_STRING *private_key;
76 } NETSCAPE_PKEY; 77 } NETSCAPE_PKEY;
77 78
78static int i2d_NETSCAPE_PKEY(NETSCAPE_PKEY *a, unsigned char **pp); 79typedef struct netscape_encrypted_pkey_st
79static NETSCAPE_PKEY *d2i_NETSCAPE_PKEY(NETSCAPE_PKEY **a,unsigned char **pp, long length); 80 {
80static NETSCAPE_PKEY *NETSCAPE_PKEY_new(void); 81 ASN1_OCTET_STRING *os;
81static void NETSCAPE_PKEY_free(NETSCAPE_PKEY *); 82 /* This is the same structure as DigestInfo so use it:
83 * although this isn't really anything to do with
84 * digests.
85 */
86 X509_SIG *enckey;
87 } NETSCAPE_ENCRYPTED_PKEY;
88
89
90ASN1_BROKEN_SEQUENCE(NETSCAPE_ENCRYPTED_PKEY) = {
91 ASN1_SIMPLE(NETSCAPE_ENCRYPTED_PKEY, os, ASN1_OCTET_STRING),
92 ASN1_SIMPLE(NETSCAPE_ENCRYPTED_PKEY, enckey, X509_SIG)
93} ASN1_BROKEN_SEQUENCE_END(NETSCAPE_ENCRYPTED_PKEY)
94
95IMPLEMENT_ASN1_FUNCTIONS_const(NETSCAPE_ENCRYPTED_PKEY)
82 96
83int i2d_Netscape_RSA(RSA *a, unsigned char **pp, int (*cb)()) 97ASN1_SEQUENCE(NETSCAPE_PKEY) = {
98 ASN1_SIMPLE(NETSCAPE_PKEY, version, LONG),
99 ASN1_SIMPLE(NETSCAPE_PKEY, algor, X509_ALGOR),
100 ASN1_SIMPLE(NETSCAPE_PKEY, private_key, ASN1_OCTET_STRING)
101} ASN1_SEQUENCE_END(NETSCAPE_PKEY)
102
103IMPLEMENT_ASN1_FUNCTIONS_const(NETSCAPE_PKEY)
104
105static RSA *d2i_RSA_NET_2(RSA **a, ASN1_OCTET_STRING *os,
106 int (*cb)(), int sgckey);
107
108int i2d_Netscape_RSA(const RSA *a, unsigned char **pp, int (*cb)())
84{ 109{
85 return i2d_RSA_NET(a, pp, cb, 0); 110 return i2d_RSA_NET(a, pp, cb, 0);
86} 111}
87 112
88int i2d_RSA_NET(RSA *a, unsigned char **pp, int (*cb)(), int sgckey) 113int i2d_RSA_NET(const RSA *a, unsigned char **pp, int (*cb)(), int sgckey)
89 { 114 {
90 int i,j,l[6]; 115 int i, j, ret = 0;
91 NETSCAPE_PKEY *pkey; 116 int rsalen, pkeylen, olen;
117 NETSCAPE_PKEY *pkey = NULL;
118 NETSCAPE_ENCRYPTED_PKEY *enckey = NULL;
92 unsigned char buf[256],*zz; 119 unsigned char buf[256],*zz;
93 unsigned char key[EVP_MAX_KEY_LENGTH]; 120 unsigned char key[EVP_MAX_KEY_LENGTH];
94 EVP_CIPHER_CTX ctx; 121 EVP_CIPHER_CTX ctx;
95 X509_ALGOR *alg=NULL;
96 ASN1_OCTET_STRING os,os2;
97 M_ASN1_I2D_vars(a);
98 122
99 if (a == NULL) return(0); 123 if (a == NULL) return(0);
100 124
101#ifdef WIN32
102 r=r; /* shut the damn compiler up :-) */
103#endif
104
105 os.data=os2.data=NULL;
106 if ((pkey=NETSCAPE_PKEY_new()) == NULL) goto err; 125 if ((pkey=NETSCAPE_PKEY_new()) == NULL) goto err;
107 if (!ASN1_INTEGER_set(pkey->version,0)) goto err; 126 if ((enckey=NETSCAPE_ENCRYPTED_PKEY_new()) == NULL) goto err;
127 pkey->version = 0;
108 128
109 if (pkey->algor->algorithm != NULL)
110 ASN1_OBJECT_free(pkey->algor->algorithm);
111 pkey->algor->algorithm=OBJ_nid2obj(NID_rsaEncryption); 129 pkey->algor->algorithm=OBJ_nid2obj(NID_rsaEncryption);
112 if ((pkey->algor->parameter=ASN1_TYPE_new()) == NULL) goto err; 130 if ((pkey->algor->parameter=ASN1_TYPE_new()) == NULL) goto err;
113 pkey->algor->parameter->type=V_ASN1_NULL; 131 pkey->algor->parameter->type=V_ASN1_NULL;
114 132
115 l[0]=i2d_RSAPrivateKey(a,NULL); 133 rsalen = i2d_RSAPrivateKey(a, NULL);
116 pkey->private_key->length=l[0];
117 134
118 os2.length=i2d_NETSCAPE_PKEY(pkey,NULL); 135 /* Fake some octet strings just for the initial length
119 l[1]=i2d_ASN1_OCTET_STRING(&os2,NULL); 136 * calculation.
137 */
120 138
121 if ((alg=X509_ALGOR_new()) == NULL) goto err; 139 pkey->private_key->length=rsalen;
122 if (alg->algorithm != NULL)
123 ASN1_OBJECT_free(alg->algorithm);
124 alg->algorithm=OBJ_nid2obj(NID_rc4);
125 if ((alg->parameter=ASN1_TYPE_new()) == NULL) goto err;
126 alg->parameter->type=V_ASN1_NULL;
127 140
128 l[2]=i2d_X509_ALGOR(alg,NULL); 141 pkeylen=i2d_NETSCAPE_PKEY(pkey,NULL);
129 l[3]=ASN1_object_size(1,l[2]+l[1],V_ASN1_SEQUENCE);
130 142
131#ifndef CONST_STRICT 143 enckey->enckey->digest->length = pkeylen;
132 os.data=(unsigned char *)"private-key";
133#endif
134 os.length=11;
135 l[4]=i2d_ASN1_OCTET_STRING(&os,NULL);
136 144
137 l[5]=ASN1_object_size(1,l[4]+l[3],V_ASN1_SEQUENCE); 145 enckey->os->length = 11; /* "private-key" */
146
147 enckey->enckey->algor->algorithm=OBJ_nid2obj(NID_rc4);
148 if ((enckey->enckey->algor->parameter=ASN1_TYPE_new()) == NULL) goto err;
149 enckey->enckey->algor->parameter->type=V_ASN1_NULL;
138 150
139 if (pp == NULL) 151 if (pp == NULL)
140 { 152 {
141 if (pkey != NULL) NETSCAPE_PKEY_free(pkey); 153 olen = i2d_NETSCAPE_ENCRYPTED_PKEY(enckey, NULL);
142 if (alg != NULL) X509_ALGOR_free(alg); 154 NETSCAPE_PKEY_free(pkey);
143 return(l[5]); 155 NETSCAPE_ENCRYPTED_PKEY_free(enckey);
156 return olen;
144 } 157 }
145 158
146 if (pkey->private_key->data != NULL) 159
147 OPENSSL_free(pkey->private_key->data); 160 /* Since its RC4 encrypted length is actual length */
148 if ((pkey->private_key->data=(unsigned char *)OPENSSL_malloc(l[0])) == NULL) 161 if ((zz=(unsigned char *)OPENSSL_malloc(rsalen)) == NULL)
149 { 162 {
150 ASN1err(ASN1_F_I2D_NETSCAPE_RSA,ERR_R_MALLOC_FAILURE); 163 ASN1err(ASN1_F_I2D_NETSCAPE_RSA,ERR_R_MALLOC_FAILURE);
151 goto err; 164 goto err;
152 } 165 }
153 zz=pkey->private_key->data; 166
167 pkey->private_key->data = zz;
168 /* Write out private key encoding */
154 i2d_RSAPrivateKey(a,&zz); 169 i2d_RSAPrivateKey(a,&zz);
155 170
156 if ((os2.data=(unsigned char *)OPENSSL_malloc(os2.length)) == NULL) 171 if ((zz=OPENSSL_malloc(pkeylen)) == NULL)
157 { 172 {
158 ASN1err(ASN1_F_I2D_NETSCAPE_RSA,ERR_R_MALLOC_FAILURE); 173 ASN1err(ASN1_F_I2D_NETSCAPE_RSA,ERR_R_MALLOC_FAILURE);
159 goto err; 174 goto err;
160 } 175 }
161 zz=os2.data; 176
177 if (!ASN1_STRING_set(enckey->os, "private-key", -1))
178 {
179 ASN1err(ASN1_F_I2D_NETSCAPE_RSA,ERR_R_MALLOC_FAILURE);
180 goto err;
181 }
182 enckey->enckey->digest->data = zz;
162 i2d_NETSCAPE_PKEY(pkey,&zz); 183 i2d_NETSCAPE_PKEY(pkey,&zz);
184
185 /* Wipe the private key encoding */
186 memset(pkey->private_key->data, 0, rsalen);
163 187
164 if (cb == NULL) 188 if (cb == NULL)
165 cb=EVP_read_pw_string; 189 cb=EVP_read_pw_string;
@@ -171,109 +195,86 @@ int i2d_RSA_NET(RSA *a, unsigned char **pp, int (*cb)(), int sgckey)
171 } 195 }
172 i = strlen((char *)buf); 196 i = strlen((char *)buf);
173 /* If the key is used for SGC the algorithm is modified a little. */ 197 /* If the key is used for SGC the algorithm is modified a little. */
174 if(sgckey){ 198 if(sgckey) {
175 EVP_MD_CTX mctx; 199 EVP_Digest(buf, i, buf, NULL, EVP_md5(), NULL);
176 EVP_DigestInit(&mctx, EVP_md5());
177 EVP_DigestUpdate(&mctx, buf, i);
178 EVP_DigestFinal(&mctx, buf, NULL);
179 memcpy(buf + 16, "SGCKEYSALT", 10); 200 memcpy(buf + 16, "SGCKEYSALT", 10);
180 i = 26; 201 i = 26;
181 } 202 }
182 203
183 EVP_BytesToKey(EVP_rc4(),EVP_md5(),NULL,buf,i,1,key,NULL); 204 EVP_BytesToKey(EVP_rc4(),EVP_md5(),NULL,buf,i,1,key,NULL);
184 memset(buf,0,256); 205 memset(buf,0,256);
185 206
207 /* Encrypt private key in place */
208 zz = enckey->enckey->digest->data;
186 EVP_CIPHER_CTX_init(&ctx); 209 EVP_CIPHER_CTX_init(&ctx);
187 EVP_EncryptInit(&ctx,EVP_rc4(),key,NULL); 210 EVP_EncryptInit_ex(&ctx,EVP_rc4(),NULL,key,NULL);
188 EVP_EncryptUpdate(&ctx,os2.data,&i,os2.data,os2.length); 211 EVP_EncryptUpdate(&ctx,zz,&i,zz,pkeylen);
189 EVP_EncryptFinal(&ctx,&(os2.data[i]),&j); 212 EVP_EncryptFinal_ex(&ctx,zz + i,&j);
190 EVP_CIPHER_CTX_cleanup(&ctx); 213 EVP_CIPHER_CTX_cleanup(&ctx);
191 214
192 p= *pp; 215 ret = i2d_NETSCAPE_ENCRYPTED_PKEY(enckey, pp);
193 ASN1_put_object(&p,1,l[4]+l[3],V_ASN1_SEQUENCE,V_ASN1_UNIVERSAL);
194 i2d_ASN1_OCTET_STRING(&os,&p);
195 ASN1_put_object(&p,1,l[2]+l[1],V_ASN1_SEQUENCE,V_ASN1_UNIVERSAL);
196 i2d_X509_ALGOR(alg,&p);
197 i2d_ASN1_OCTET_STRING(&os2,&p);
198 ret=l[5];
199err: 216err:
200 if (os2.data != NULL) OPENSSL_free(os2.data); 217 NETSCAPE_ENCRYPTED_PKEY_free(enckey);
201 if (alg != NULL) X509_ALGOR_free(alg); 218 NETSCAPE_PKEY_free(pkey);
202 if (pkey != NULL) NETSCAPE_PKEY_free(pkey);
203 r=r;
204 return(ret); 219 return(ret);
205 } 220 }
206 221
207 222
208RSA *d2i_Netscape_RSA(RSA **a, unsigned char **pp, long length, int (*cb)()) 223RSA *d2i_Netscape_RSA(RSA **a, const unsigned char **pp, long length, int (*cb)())
209{ 224{
210 return d2i_RSA_NET(a, pp, length, cb, 0); 225 return d2i_RSA_NET(a, pp, length, cb, 0);
211} 226}
212 227
213RSA *d2i_RSA_NET(RSA **a, unsigned char **pp, long length, int (*cb)(), int sgckey) 228RSA *d2i_RSA_NET(RSA **a, const unsigned char **pp, long length, int (*cb)(), int sgckey)
214 { 229 {
215 RSA *ret=NULL; 230 RSA *ret=NULL;
216 ASN1_OCTET_STRING *os=NULL; 231 const unsigned char *p, *kp;
217 ASN1_CTX c; 232 NETSCAPE_ENCRYPTED_PKEY *enckey = NULL;
233
234 p = *pp;
218 235
219 c.pp=pp; 236 enckey = d2i_NETSCAPE_ENCRYPTED_PKEY(NULL, &p, length);
220 c.error=ASN1_R_DECODING_ERROR; 237 if(!enckey) {
238 ASN1err(ASN1_F_D2I_NETSCAPE_RSA,ASN1_R_DECODING_ERROR);
239 return NULL;
240 }
221 241
222 M_ASN1_D2I_Init(); 242 if ((enckey->os->length != 11) || (strncmp("private-key",
223 M_ASN1_D2I_start_sequence(); 243 (char *)enckey->os->data,11) != 0))
224 M_ASN1_D2I_get(os,d2i_ASN1_OCTET_STRING);
225 if ((os->length != 11) || (strncmp("private-key",
226 (char *)os->data,os->length) != 0))
227 { 244 {
228 ASN1err(ASN1_F_D2I_NETSCAPE_RSA,ASN1_R_PRIVATE_KEY_HEADER_MISSING); 245 ASN1err(ASN1_F_D2I_NETSCAPE_RSA,ASN1_R_PRIVATE_KEY_HEADER_MISSING);
229 M_ASN1_BIT_STRING_free(os); 246 NETSCAPE_ENCRYPTED_PKEY_free(enckey);
230 goto err; 247 return NULL;
231 } 248 }
232 M_ASN1_BIT_STRING_free(os); 249 if (OBJ_obj2nid(enckey->enckey->algor->algorithm) != NID_rc4)
233 c.q=c.p; 250 {
234 if ((ret=d2i_RSA_NET_2(a,&c.p,c.slen,cb, sgckey)) == NULL) goto err; 251 ASN1err(ASN1_F_D2I_NETSCAPE_RSA_2,ASN1_R_UNSUPPORTED_ENCRYPTION_ALGORITHM);
235 /* Note: some versions of IIS key files use length values that are 252 goto err;
236 * too small for the surrounding SEQUENCEs. This following line
237 * effectively disable length checking.
238 */
239 c.slen = 0;
240
241 M_ASN1_D2I_Finish(a,RSA_free,ASN1_F_D2I_NETSCAPE_RSA);
242 } 253 }
254 kp = enckey->enckey->digest->data;
255 if (cb == NULL)
256 cb=EVP_read_pw_string;
257 if ((ret=d2i_RSA_NET_2(a, enckey->enckey->digest,cb, sgckey)) == NULL) goto err;
243 258
244RSA *d2i_Netscape_RSA_2(RSA **a, unsigned char **pp, long length, 259 *pp = p;
245 int (*cb)())
246{
247 return d2i_RSA_NET_2(a, pp, length, cb, 0);
248}
249 260
250RSA *d2i_RSA_NET_2(RSA **a, unsigned char **pp, long length, 261 err:
262 NETSCAPE_ENCRYPTED_PKEY_free(enckey);
263 return ret;
264
265 }
266
267static RSA *d2i_RSA_NET_2(RSA **a, ASN1_OCTET_STRING *os,
251 int (*cb)(), int sgckey) 268 int (*cb)(), int sgckey)
252 { 269 {
253 NETSCAPE_PKEY *pkey=NULL; 270 NETSCAPE_PKEY *pkey=NULL;
254 RSA *ret=NULL; 271 RSA *ret=NULL;
255 int i,j; 272 int i,j;
256 unsigned char buf[256],*zz; 273 unsigned char buf[256];
274 const unsigned char *zz;
257 unsigned char key[EVP_MAX_KEY_LENGTH]; 275 unsigned char key[EVP_MAX_KEY_LENGTH];
258 EVP_CIPHER_CTX ctx; 276 EVP_CIPHER_CTX ctx;
259 X509_ALGOR *alg=NULL;
260 ASN1_OCTET_STRING *os=NULL;
261 ASN1_CTX c;
262 277
263 c.error=ERR_R_NESTED_ASN1_ERROR;
264 c.pp=pp;
265
266 M_ASN1_D2I_Init();
267 M_ASN1_D2I_start_sequence();
268 M_ASN1_D2I_get(alg,d2i_X509_ALGOR);
269 if (OBJ_obj2nid(alg->algorithm) != NID_rc4)
270 {
271 ASN1err(ASN1_F_D2I_NETSCAPE_RSA_2,ASN1_R_UNSUPPORTED_ENCRYPTION_ALGORITHM);
272 goto err;
273 }
274 M_ASN1_D2I_get(os,d2i_ASN1_OCTET_STRING);
275 if (cb == NULL)
276 cb=EVP_read_pw_string;
277 i=cb(buf,256,"Enter Private Key password:",0); 278 i=cb(buf,256,"Enter Private Key password:",0);
278 if (i != 0) 279 if (i != 0)
279 { 280 {
@@ -283,10 +284,7 @@ RSA *d2i_RSA_NET_2(RSA **a, unsigned char **pp, long length,
283 284
284 i = strlen((char *)buf); 285 i = strlen((char *)buf);
285 if(sgckey){ 286 if(sgckey){
286 EVP_MD_CTX mctx; 287 EVP_Digest(buf, i, buf, NULL, EVP_md5(), NULL);
287 EVP_DigestInit(&mctx, EVP_md5());
288 EVP_DigestUpdate(&mctx, buf, i);
289 EVP_DigestFinal(&mctx, buf, NULL);
290 memcpy(buf + 16, "SGCKEYSALT", 10); 288 memcpy(buf + 16, "SGCKEYSALT", 10);
291 i = 26; 289 i = 26;
292 } 290 }
@@ -295,9 +293,9 @@ RSA *d2i_RSA_NET_2(RSA **a, unsigned char **pp, long length,
295 memset(buf,0,256); 293 memset(buf,0,256);
296 294
297 EVP_CIPHER_CTX_init(&ctx); 295 EVP_CIPHER_CTX_init(&ctx);
298 EVP_DecryptInit(&ctx,EVP_rc4(),key,NULL); 296 EVP_DecryptInit_ex(&ctx,EVP_rc4(),NULL, key,NULL);
299 EVP_DecryptUpdate(&ctx,os->data,&i,os->data,os->length); 297 EVP_DecryptUpdate(&ctx,os->data,&i,os->data,os->length);
300 EVP_DecryptFinal(&ctx,&(os->data[i]),&j); 298 EVP_DecryptFinal_ex(&ctx,&(os->data[i]),&j);
301 EVP_CIPHER_CTX_cleanup(&ctx); 299 EVP_CIPHER_CTX_cleanup(&ctx);
302 os->length=i+j; 300 os->length=i+j;
303 301
@@ -315,71 +313,14 @@ RSA *d2i_RSA_NET_2(RSA **a, unsigned char **pp, long length,
315 ASN1err(ASN1_F_D2I_NETSCAPE_RSA_2,ASN1_R_UNABLE_TO_DECODE_RSA_KEY); 313 ASN1err(ASN1_F_D2I_NETSCAPE_RSA_2,ASN1_R_UNABLE_TO_DECODE_RSA_KEY);
316 goto err; 314 goto err;
317 } 315 }
318 if (!asn1_Finish(&c)) goto err;
319 *pp=c.p;
320err: 316err:
321 if (pkey != NULL) NETSCAPE_PKEY_free(pkey); 317 NETSCAPE_PKEY_free(pkey);
322 if (os != NULL) M_ASN1_BIT_STRING_free(os);
323 if (alg != NULL) X509_ALGOR_free(alg);
324 return(ret); 318 return(ret);
325 } 319 }
326 320
327static int i2d_NETSCAPE_PKEY(NETSCAPE_PKEY *a, unsigned char **pp) 321#endif /* OPENSSL_NO_RC4 */
328 {
329 M_ASN1_I2D_vars(a);
330
331
332 M_ASN1_I2D_len(a->version, i2d_ASN1_INTEGER);
333 M_ASN1_I2D_len(a->algor, i2d_X509_ALGOR);
334 M_ASN1_I2D_len(a->private_key, i2d_ASN1_OCTET_STRING);
335
336 M_ASN1_I2D_seq_total();
337
338 M_ASN1_I2D_put(a->version, i2d_ASN1_INTEGER);
339 M_ASN1_I2D_put(a->algor, i2d_X509_ALGOR);
340 M_ASN1_I2D_put(a->private_key, i2d_ASN1_OCTET_STRING);
341
342 M_ASN1_I2D_finish();
343 }
344
345static NETSCAPE_PKEY *d2i_NETSCAPE_PKEY(NETSCAPE_PKEY **a, unsigned char **pp,
346 long length)
347 {
348 M_ASN1_D2I_vars(a,NETSCAPE_PKEY *,NETSCAPE_PKEY_new);
349
350 M_ASN1_D2I_Init();
351 M_ASN1_D2I_start_sequence();
352 M_ASN1_D2I_get(ret->version,d2i_ASN1_INTEGER);
353 M_ASN1_D2I_get(ret->algor,d2i_X509_ALGOR);
354 M_ASN1_D2I_get(ret->private_key,d2i_ASN1_OCTET_STRING);
355 M_ASN1_D2I_Finish(a,NETSCAPE_PKEY_free,ASN1_F_D2I_NETSCAPE_PKEY);
356 }
357
358static NETSCAPE_PKEY *NETSCAPE_PKEY_new(void)
359 {
360 NETSCAPE_PKEY *ret=NULL;
361 ASN1_CTX c;
362
363 M_ASN1_New_Malloc(ret,NETSCAPE_PKEY);
364 M_ASN1_New(ret->version,M_ASN1_INTEGER_new);
365 M_ASN1_New(ret->algor,X509_ALGOR_new);
366 M_ASN1_New(ret->private_key,M_ASN1_OCTET_STRING_new);
367 return(ret);
368 M_ASN1_New_Error(ASN1_F_NETSCAPE_PKEY_NEW);
369 }
370
371static void NETSCAPE_PKEY_free(NETSCAPE_PKEY *a)
372 {
373 if (a == NULL) return;
374 M_ASN1_INTEGER_free(a->version);
375 X509_ALGOR_free(a->algor);
376 M_ASN1_OCTET_STRING_free(a->private_key);
377 OPENSSL_free(a);
378 }
379
380#endif /* NO_RC4 */
381 322
382#else /* !NO_RSA */ 323#else /* !OPENSSL_NO_RSA */
383 324
384# if PEDANTIC 325# if PEDANTIC
385static void *dummy=&dummy; 326static void *dummy=&dummy;
diff --git a/src/lib/libcrypto/asn1/nsseq.c b/src/lib/libcrypto/asn1/nsseq.c
index 6e7f09ba23..50e2d4d07a 100644
--- a/src/lib/libcrypto/asn1/nsseq.c
+++ b/src/lib/libcrypto/asn1/nsseq.c
@@ -58,61 +58,25 @@
58 58
59#include <stdio.h> 59#include <stdio.h>
60#include <stdlib.h> 60#include <stdlib.h>
61#include <openssl/asn1_mac.h> 61#include <openssl/asn1t.h>
62#include <openssl/err.h>
63#include <openssl/x509.h> 62#include <openssl/x509.h>
64#include <openssl/objects.h> 63#include <openssl/objects.h>
65 64
66/* Netscape certificate sequence structure */ 65static int nsseq_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it)
67
68int i2d_NETSCAPE_CERT_SEQUENCE(NETSCAPE_CERT_SEQUENCE *a, unsigned char **pp)
69{ 66{
70 int v = 0; 67 if(operation == ASN1_OP_NEW_POST) {
71 M_ASN1_I2D_vars(a); 68 NETSCAPE_CERT_SEQUENCE *nsseq;
72 M_ASN1_I2D_len (a->type, i2d_ASN1_OBJECT); 69 nsseq = (NETSCAPE_CERT_SEQUENCE *)*pval;
73 M_ASN1_I2D_len_EXP_SEQUENCE_opt_type(X509,a->certs,i2d_X509,0, 70 nsseq->type = OBJ_nid2obj(NID_netscape_cert_sequence);
74 V_ASN1_SEQUENCE,v); 71 }
75 72 return 1;
76 M_ASN1_I2D_seq_total();
77
78 M_ASN1_I2D_put (a->type, i2d_ASN1_OBJECT);
79 M_ASN1_I2D_put_EXP_SEQUENCE_opt_type(X509,a->certs,i2d_X509,0,
80 V_ASN1_SEQUENCE,v);
81
82 M_ASN1_I2D_finish();
83} 73}
84 74
85NETSCAPE_CERT_SEQUENCE *NETSCAPE_CERT_SEQUENCE_new(void) 75/* Netscape certificate sequence structure */
86{
87 NETSCAPE_CERT_SEQUENCE *ret=NULL;
88 ASN1_CTX c;
89 M_ASN1_New_Malloc(ret, NETSCAPE_CERT_SEQUENCE);
90 /* Note hardcoded object type */
91 ret->type = OBJ_nid2obj(NID_netscape_cert_sequence);
92 ret->certs = NULL;
93 return (ret);
94 M_ASN1_New_Error(ASN1_F_NETSCAPE_CERT_SEQUENCE_NEW);
95}
96 76
97NETSCAPE_CERT_SEQUENCE *d2i_NETSCAPE_CERT_SEQUENCE(NETSCAPE_CERT_SEQUENCE **a, 77ASN1_SEQUENCE_cb(NETSCAPE_CERT_SEQUENCE, nsseq_cb) = {
98 unsigned char **pp, long length) 78 ASN1_SIMPLE(NETSCAPE_CERT_SEQUENCE, type, ASN1_OBJECT),
99{ 79 ASN1_EXP_SEQUENCE_OF_OPT(NETSCAPE_CERT_SEQUENCE, certs, X509, 0)
100 M_ASN1_D2I_vars(a,NETSCAPE_CERT_SEQUENCE *, 80} ASN1_SEQUENCE_END_cb(NETSCAPE_CERT_SEQUENCE, NETSCAPE_CERT_SEQUENCE)
101 NETSCAPE_CERT_SEQUENCE_new);
102 M_ASN1_D2I_Init();
103 M_ASN1_D2I_start_sequence();
104 M_ASN1_D2I_get (ret->type, d2i_ASN1_OBJECT);
105 M_ASN1_D2I_get_EXP_set_opt_type(X509,ret->certs,d2i_X509,X509_free,0,
106 V_ASN1_SEQUENCE);
107 M_ASN1_D2I_Finish(a, NETSCAPE_CERT_SEQUENCE_free,
108 ASN1_F_D2I_NETSCAPE_CERT_SEQUENCE);
109}
110 81
111void NETSCAPE_CERT_SEQUENCE_free (NETSCAPE_CERT_SEQUENCE *a) 82IMPLEMENT_ASN1_FUNCTIONS(NETSCAPE_CERT_SEQUENCE)
112{
113 if (a == NULL) return;
114 ASN1_OBJECT_free(a->type);
115 if(a->certs)
116 sk_X509_pop_free(a->certs, X509_free);
117 OPENSSL_free (a);
118}
diff --git a/src/lib/libcrypto/asn1/p5_pbe.c b/src/lib/libcrypto/asn1/p5_pbe.c
index b7ed538eb2..891150638e 100644
--- a/src/lib/libcrypto/asn1/p5_pbe.c
+++ b/src/lib/libcrypto/asn1/p5_pbe.c
@@ -58,53 +58,18 @@
58 58
59#include <stdio.h> 59#include <stdio.h>
60#include "cryptlib.h" 60#include "cryptlib.h"
61#include <openssl/asn1_mac.h> 61#include <openssl/asn1t.h>
62#include <openssl/x509.h> 62#include <openssl/x509.h>
63#include <openssl/rand.h> 63#include <openssl/rand.h>
64 64
65/* PKCS#5 password based encryption structure */ 65/* PKCS#5 password based encryption structure */
66 66
67int i2d_PBEPARAM(PBEPARAM *a, unsigned char **pp) 67ASN1_SEQUENCE(PBEPARAM) = {
68{ 68 ASN1_SIMPLE(PBEPARAM, salt, ASN1_OCTET_STRING),
69 M_ASN1_I2D_vars(a); 69 ASN1_SIMPLE(PBEPARAM, iter, ASN1_INTEGER)
70 M_ASN1_I2D_len (a->salt, i2d_ASN1_OCTET_STRING); 70} ASN1_SEQUENCE_END(PBEPARAM)
71 M_ASN1_I2D_len (a->iter, i2d_ASN1_INTEGER);
72
73 M_ASN1_I2D_seq_total ();
74
75 M_ASN1_I2D_put (a->salt, i2d_ASN1_OCTET_STRING);
76 M_ASN1_I2D_put (a->iter, i2d_ASN1_INTEGER);
77 M_ASN1_I2D_finish();
78}
79
80PBEPARAM *PBEPARAM_new(void)
81{
82 PBEPARAM *ret=NULL;
83 ASN1_CTX c;
84 M_ASN1_New_Malloc(ret, PBEPARAM);
85 M_ASN1_New(ret->iter,M_ASN1_INTEGER_new);
86 M_ASN1_New(ret->salt,M_ASN1_OCTET_STRING_new);
87 return (ret);
88 M_ASN1_New_Error(ASN1_F_PBEPARAM_NEW);
89}
90
91PBEPARAM *d2i_PBEPARAM(PBEPARAM **a, unsigned char **pp, long length)
92{
93 M_ASN1_D2I_vars(a,PBEPARAM *,PBEPARAM_new);
94 M_ASN1_D2I_Init();
95 M_ASN1_D2I_start_sequence();
96 M_ASN1_D2I_get (ret->salt, d2i_ASN1_OCTET_STRING);
97 M_ASN1_D2I_get (ret->iter, d2i_ASN1_INTEGER);
98 M_ASN1_D2I_Finish(a, PBEPARAM_free, ASN1_F_D2I_PBEPARAM);
99}
100 71
101void PBEPARAM_free (PBEPARAM *a) 72IMPLEMENT_ASN1_FUNCTIONS(PBEPARAM)
102{
103 if(a==NULL) return;
104 M_ASN1_OCTET_STRING_free(a->salt);
105 M_ASN1_INTEGER_free (a->iter);
106 OPENSSL_free (a);
107}
108 73
109/* Return an algorithm identifier for a PKCS#5 PBE algorithm */ 74/* Return an algorithm identifier for a PKCS#5 PBE algorithm */
110 75
diff --git a/src/lib/libcrypto/asn1/p5_pbev2.c b/src/lib/libcrypto/asn1/p5_pbev2.c
index 6a7b578c0e..43dfe09479 100644
--- a/src/lib/libcrypto/asn1/p5_pbev2.c
+++ b/src/lib/libcrypto/asn1/p5_pbev2.c
@@ -58,108 +58,27 @@
58 58
59#include <stdio.h> 59#include <stdio.h>
60#include "cryptlib.h" 60#include "cryptlib.h"
61#include <openssl/asn1_mac.h> 61#include <openssl/asn1t.h>
62#include <openssl/x509.h> 62#include <openssl/x509.h>
63#include <openssl/rand.h> 63#include <openssl/rand.h>
64 64
65/* PKCS#5 v2.0 password based encryption structures */ 65/* PKCS#5 v2.0 password based encryption structures */
66 66
67int i2d_PBE2PARAM(PBE2PARAM *a, unsigned char **pp) 67ASN1_SEQUENCE(PBE2PARAM) = {
68{ 68 ASN1_SIMPLE(PBE2PARAM, keyfunc, X509_ALGOR),
69 M_ASN1_I2D_vars(a); 69 ASN1_SIMPLE(PBE2PARAM, encryption, X509_ALGOR)
70 M_ASN1_I2D_len (a->keyfunc, i2d_X509_ALGOR); 70} ASN1_SEQUENCE_END(PBE2PARAM)
71 M_ASN1_I2D_len (a->encryption, i2d_X509_ALGOR);
72
73 M_ASN1_I2D_seq_total ();
74
75 M_ASN1_I2D_put (a->keyfunc, i2d_X509_ALGOR);
76 M_ASN1_I2D_put (a->encryption, i2d_X509_ALGOR);
77
78 M_ASN1_I2D_finish();
79}
80
81PBE2PARAM *PBE2PARAM_new(void)
82{
83 PBE2PARAM *ret=NULL;
84 ASN1_CTX c;
85 M_ASN1_New_Malloc(ret, PBE2PARAM);
86 M_ASN1_New(ret->keyfunc,X509_ALGOR_new);
87 M_ASN1_New(ret->encryption,X509_ALGOR_new);
88 return (ret);
89 M_ASN1_New_Error(ASN1_F_PBE2PARAM_NEW);
90}
91
92PBE2PARAM *d2i_PBE2PARAM(PBE2PARAM **a, unsigned char **pp, long length)
93{
94 M_ASN1_D2I_vars(a,PBE2PARAM *,PBE2PARAM_new);
95 M_ASN1_D2I_Init();
96 M_ASN1_D2I_start_sequence();
97 M_ASN1_D2I_get (ret->keyfunc, d2i_X509_ALGOR);
98 M_ASN1_D2I_get (ret->encryption, d2i_X509_ALGOR);
99 M_ASN1_D2I_Finish(a, PBE2PARAM_free, ASN1_F_D2I_PBE2PARAM);
100}
101
102void PBE2PARAM_free (PBE2PARAM *a)
103{
104 if(a==NULL) return;
105 X509_ALGOR_free(a->keyfunc);
106 X509_ALGOR_free(a->encryption);
107 OPENSSL_free (a);
108}
109
110int i2d_PBKDF2PARAM(PBKDF2PARAM *a, unsigned char **pp)
111{
112 M_ASN1_I2D_vars(a);
113 M_ASN1_I2D_len (a->salt, i2d_ASN1_TYPE);
114 M_ASN1_I2D_len (a->iter, i2d_ASN1_INTEGER);
115 M_ASN1_I2D_len (a->keylength, i2d_ASN1_INTEGER);
116 M_ASN1_I2D_len (a->prf, i2d_X509_ALGOR);
117 71
118 M_ASN1_I2D_seq_total (); 72IMPLEMENT_ASN1_FUNCTIONS(PBE2PARAM)
119 73
120 M_ASN1_I2D_put (a->salt, i2d_ASN1_TYPE); 74ASN1_SEQUENCE(PBKDF2PARAM) = {
121 M_ASN1_I2D_put (a->iter, i2d_ASN1_INTEGER); 75 ASN1_SIMPLE(PBKDF2PARAM, salt, ASN1_ANY),
122 M_ASN1_I2D_put (a->keylength, i2d_ASN1_INTEGER); 76 ASN1_SIMPLE(PBKDF2PARAM, iter, ASN1_INTEGER),
123 M_ASN1_I2D_put (a->prf, i2d_X509_ALGOR); 77 ASN1_OPT(PBKDF2PARAM, keylength, ASN1_INTEGER),
78 ASN1_OPT(PBKDF2PARAM, prf, X509_ALGOR)
79} ASN1_SEQUENCE_END(PBKDF2PARAM)
124 80
125 M_ASN1_I2D_finish(); 81IMPLEMENT_ASN1_FUNCTIONS(PBKDF2PARAM)
126}
127
128PBKDF2PARAM *PBKDF2PARAM_new(void)
129{
130 PBKDF2PARAM *ret=NULL;
131 ASN1_CTX c;
132 M_ASN1_New_Malloc(ret, PBKDF2PARAM);
133 M_ASN1_New(ret->salt, ASN1_TYPE_new);
134 M_ASN1_New(ret->iter, M_ASN1_INTEGER_new);
135 ret->keylength = NULL;
136 ret->prf = NULL;
137 return (ret);
138 M_ASN1_New_Error(ASN1_F_PBKDF2PARAM_NEW);
139}
140
141PBKDF2PARAM *d2i_PBKDF2PARAM(PBKDF2PARAM **a, unsigned char **pp,
142 long length)
143{
144 M_ASN1_D2I_vars(a,PBKDF2PARAM *,PBKDF2PARAM_new);
145 M_ASN1_D2I_Init();
146 M_ASN1_D2I_start_sequence();
147 M_ASN1_D2I_get (ret->salt, d2i_ASN1_TYPE);
148 M_ASN1_D2I_get (ret->iter, d2i_ASN1_INTEGER);
149 M_ASN1_D2I_get_opt (ret->keylength, d2i_ASN1_INTEGER, V_ASN1_INTEGER);
150 M_ASN1_D2I_get_opt (ret->prf, d2i_X509_ALGOR, V_ASN1_SEQUENCE);
151 M_ASN1_D2I_Finish(a, PBKDF2PARAM_free, ASN1_F_D2I_PBKDF2PARAM);
152}
153
154void PBKDF2PARAM_free (PBKDF2PARAM *a)
155{
156 if(a==NULL) return;
157 ASN1_TYPE_free(a->salt);
158 M_ASN1_INTEGER_free(a->iter);
159 M_ASN1_INTEGER_free(a->keylength);
160 X509_ALGOR_free(a->prf);
161 OPENSSL_free (a);
162}
163 82
164/* Return an algorithm identifier for a PKCS#5 v2.0 PBE algorithm: 83/* Return an algorithm identifier for a PKCS#5 v2.0 PBE algorithm:
165 * yes I know this is horrible! 84 * yes I know this is horrible!
@@ -198,7 +117,7 @@ X509_ALGOR *PKCS5_pbe2_set(const EVP_CIPHER *cipher, int iter,
198 goto err; 117 goto err;
199 118
200 /* Dummy cipherinit to just setup the IV */ 119 /* Dummy cipherinit to just setup the IV */
201 EVP_CipherInit(&ctx, cipher, NULL, iv, 0); 120 EVP_CipherInit_ex(&ctx, cipher, NULL, NULL, iv, 0);
202 if(EVP_CIPHER_param_to_asn1(&ctx, scheme->parameter) < 0) { 121 if(EVP_CIPHER_param_to_asn1(&ctx, scheme->parameter) < 0) {
203 ASN1err(ASN1_F_PKCS5_PBE2_SET, 122 ASN1err(ASN1_F_PKCS5_PBE2_SET,
204 ASN1_R_ERROR_SETTING_CIPHER_PARAMS); 123 ASN1_R_ERROR_SETTING_CIPHER_PARAMS);
diff --git a/src/lib/libcrypto/asn1/p8_pkey.c b/src/lib/libcrypto/asn1/p8_pkey.c
index fa6cbfb6f8..b634d5bc85 100644
--- a/src/lib/libcrypto/asn1/p8_pkey.c
+++ b/src/lib/libcrypto/asn1/p8_pkey.c
@@ -58,70 +58,27 @@
58 58
59#include <stdio.h> 59#include <stdio.h>
60#include "cryptlib.h" 60#include "cryptlib.h"
61#include <openssl/asn1_mac.h> 61#include <openssl/asn1t.h>
62#include <openssl/x509.h> 62#include <openssl/x509.h>
63 63
64int i2d_PKCS8_PRIV_KEY_INFO (PKCS8_PRIV_KEY_INFO *a, unsigned char **pp) 64/* Minor tweak to operation: zero private key data */
65static int pkey_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it)
65{ 66{
66 67 /* Since the structure must still be valid use ASN1_OP_FREE_PRE */
67 M_ASN1_I2D_vars(a); 68 if(operation == ASN1_OP_FREE_PRE) {
68 69 PKCS8_PRIV_KEY_INFO *key = (PKCS8_PRIV_KEY_INFO *)*pval;
69 M_ASN1_I2D_len (a->version, i2d_ASN1_INTEGER); 70 if (key->pkey->value.octet_string)
70 M_ASN1_I2D_len (a->pkeyalg, i2d_X509_ALGOR); 71 memset(key->pkey->value.octet_string->data,
71 M_ASN1_I2D_len (a->pkey, i2d_ASN1_TYPE); 72 0, key->pkey->value.octet_string->length);
72 M_ASN1_I2D_len_IMP_SET_opt_type (X509_ATTRIBUTE, a->attributes, 73 }
73 i2d_X509_ATTRIBUTE, 0); 74 return 1;
74
75 M_ASN1_I2D_seq_total ();
76
77 M_ASN1_I2D_put (a->version, i2d_ASN1_INTEGER);
78 M_ASN1_I2D_put (a->pkeyalg, i2d_X509_ALGOR);
79 M_ASN1_I2D_put (a->pkey, i2d_ASN1_TYPE);
80 M_ASN1_I2D_put_IMP_SET_opt_type (X509_ATTRIBUTE, a->attributes,
81 i2d_X509_ATTRIBUTE, 0);
82
83 M_ASN1_I2D_finish();
84} 75}
85 76
86PKCS8_PRIV_KEY_INFO *PKCS8_PRIV_KEY_INFO_new(void) 77ASN1_SEQUENCE_cb(PKCS8_PRIV_KEY_INFO, pkey_cb) = {
87{ 78 ASN1_SIMPLE(PKCS8_PRIV_KEY_INFO, version, ASN1_INTEGER),
88 PKCS8_PRIV_KEY_INFO *ret=NULL; 79 ASN1_SIMPLE(PKCS8_PRIV_KEY_INFO, pkeyalg, X509_ALGOR),
89 ASN1_CTX c; 80 ASN1_SIMPLE(PKCS8_PRIV_KEY_INFO, pkey, ASN1_ANY),
90 M_ASN1_New_Malloc(ret, PKCS8_PRIV_KEY_INFO); 81 ASN1_IMP_SET_OF_OPT(PKCS8_PRIV_KEY_INFO, attributes, X509_ATTRIBUTE, 0)
91 M_ASN1_New (ret->version, M_ASN1_INTEGER_new); 82} ASN1_SEQUENCE_END_cb(PKCS8_PRIV_KEY_INFO, PKCS8_PRIV_KEY_INFO)
92 M_ASN1_New (ret->pkeyalg, X509_ALGOR_new);
93 M_ASN1_New (ret->pkey, ASN1_TYPE_new);
94 ret->attributes = NULL;
95 ret->broken = PKCS8_OK;
96 return (ret);
97 M_ASN1_New_Error(ASN1_F_PKCS8_PRIV_KEY_INFO_NEW);
98}
99 83
100PKCS8_PRIV_KEY_INFO *d2i_PKCS8_PRIV_KEY_INFO(PKCS8_PRIV_KEY_INFO **a, 84IMPLEMENT_ASN1_FUNCTIONS(PKCS8_PRIV_KEY_INFO)
101 unsigned char **pp, long length)
102{
103 M_ASN1_D2I_vars(a,PKCS8_PRIV_KEY_INFO *,PKCS8_PRIV_KEY_INFO_new);
104 M_ASN1_D2I_Init();
105 M_ASN1_D2I_start_sequence();
106 M_ASN1_D2I_get (ret->version, d2i_ASN1_INTEGER);
107 M_ASN1_D2I_get (ret->pkeyalg, d2i_X509_ALGOR);
108 M_ASN1_D2I_get (ret->pkey, d2i_ASN1_TYPE);
109 M_ASN1_D2I_get_IMP_set_opt_type(X509_ATTRIBUTE, ret->attributes,
110 d2i_X509_ATTRIBUTE,
111 X509_ATTRIBUTE_free, 0);
112 M_ASN1_D2I_Finish(a, PKCS8_PRIV_KEY_INFO_free, ASN1_F_D2I_PKCS8_PRIV_KEY_INFO);
113}
114
115void PKCS8_PRIV_KEY_INFO_free (PKCS8_PRIV_KEY_INFO *a)
116{
117 if (a == NULL) return;
118 M_ASN1_INTEGER_free (a->version);
119 X509_ALGOR_free(a->pkeyalg);
120 /* Clear sensitive data */
121 if (a->pkey->value.octet_string)
122 memset (a->pkey->value.octet_string->data,
123 0, a->pkey->value.octet_string->length);
124 ASN1_TYPE_free (a->pkey);
125 sk_X509_ATTRIBUTE_pop_free (a->attributes, X509_ATTRIBUTE_free);
126 OPENSSL_free (a);
127}
diff --git a/src/lib/libcrypto/asn1/t_crl.c b/src/lib/libcrypto/asn1/t_crl.c
index d78e4a8f88..60db305756 100644
--- a/src/lib/libcrypto/asn1/t_crl.c
+++ b/src/lib/libcrypto/asn1/t_crl.c
@@ -64,8 +64,7 @@
64#include <openssl/x509.h> 64#include <openssl/x509.h>
65#include <openssl/x509v3.h> 65#include <openssl/x509v3.h>
66 66
67static void ext_print(BIO *out, X509_EXTENSION *ex); 67#ifndef OPENSSL_NO_FP_API
68#ifndef NO_FP_API
69int X509_CRL_print_fp(FILE *fp, X509_CRL *x) 68int X509_CRL_print_fp(FILE *fp, X509_CRL *x)
70 { 69 {
71 BIO *b; 70 BIO *b;
@@ -86,11 +85,10 @@ int X509_CRL_print_fp(FILE *fp, X509_CRL *x)
86int X509_CRL_print(BIO *out, X509_CRL *x) 85int X509_CRL_print(BIO *out, X509_CRL *x)
87{ 86{
88 char buf[256]; 87 char buf[256];
89 unsigned char *s;
90 STACK_OF(X509_REVOKED) *rev; 88 STACK_OF(X509_REVOKED) *rev;
91 X509_REVOKED *r; 89 X509_REVOKED *r;
92 long l; 90 long l;
93 int i, j, n; 91 int i, n;
94 92
95 BIO_printf(out, "Certificate Revocation List (CRL):\n"); 93 BIO_printf(out, "Certificate Revocation List (CRL):\n");
96 l = X509_CRL_get_version(x); 94 l = X509_CRL_get_version(x);
@@ -109,15 +107,12 @@ int X509_CRL_print(BIO *out, X509_CRL *x)
109 BIO_printf(out,"\n"); 107 BIO_printf(out,"\n");
110 108
111 n=X509_CRL_get_ext_count(x); 109 n=X509_CRL_get_ext_count(x);
112 if (n > 0) { 110 X509V3_extensions_print(out, "CRL extensions",
113 BIO_printf(out,"%8sCRL extensions:\n",""); 111 x->crl->extensions, 0, 8);
114 for (i=0; i<n; i++) ext_print(out, X509_CRL_get_ext(x, i));
115 }
116
117 112
118 rev = X509_CRL_get_REVOKED(x); 113 rev = X509_CRL_get_REVOKED(x);
119 114
120 if(sk_X509_REVOKED_num(rev)) 115 if(sk_X509_REVOKED_num(rev) > 0)
121 BIO_printf(out, "Revoked Certificates:\n"); 116 BIO_printf(out, "Revoked Certificates:\n");
122 else BIO_printf(out, "No Revoked Certificates.\n"); 117 else BIO_printf(out, "No Revoked Certificates.\n");
123 118
@@ -128,39 +123,11 @@ int X509_CRL_print(BIO *out, X509_CRL *x)
128 BIO_printf(out,"\n Revocation Date: ",""); 123 BIO_printf(out,"\n Revocation Date: ","");
129 ASN1_TIME_print(out,r->revocationDate); 124 ASN1_TIME_print(out,r->revocationDate);
130 BIO_printf(out,"\n"); 125 BIO_printf(out,"\n");
131 for(j = 0; j < X509_REVOKED_get_ext_count(r); j++) 126 X509V3_extensions_print(out, "CRL entry extensions",
132 ext_print(out, X509_REVOKED_get_ext(r, j)); 127 r->extensions, 0, 8);
133 }
134
135 i=OBJ_obj2nid(x->sig_alg->algorithm);
136 BIO_printf(out," Signature Algorithm: %s",
137 (i == NID_undef)?"UNKNOWN":OBJ_nid2ln(i));
138
139 s = x->signature->data;
140 n = x->signature->length;
141 for (i=0; i<n; i++, s++)
142 {
143 if ((i%18) == 0) BIO_write(out,"\n ",9);
144 BIO_printf(out,"%02x%s",*s, ((i+1) == n)?"":":");
145 } 128 }
146 BIO_write(out,"\n",1); 129 X509_signature_print(out, x->sig_alg, x->signature);
147 130
148 return 1; 131 return 1;
149 132
150} 133}
151
152static void ext_print(BIO *out, X509_EXTENSION *ex)
153{
154 ASN1_OBJECT *obj;
155 int j;
156 BIO_printf(out,"%12s","");
157 obj=X509_EXTENSION_get_object(ex);
158 i2a_ASN1_OBJECT(out,obj);
159 j=X509_EXTENSION_get_critical(ex);
160 BIO_printf(out, ": %s\n", j ? "critical":"","");
161 if(!X509V3_EXT_print(out, ex, 0, 16)) {
162 BIO_printf(out, "%16s", "");
163 M_ASN1_OCTET_STRING_print(out,ex->value);
164 }
165 BIO_write(out,"\n",1);
166}
diff --git a/src/lib/libcrypto/asn1/t_pkey.c b/src/lib/libcrypto/asn1/t_pkey.c
index ae18da96e3..8060115202 100644
--- a/src/lib/libcrypto/asn1/t_pkey.c
+++ b/src/lib/libcrypto/asn1/t_pkey.c
@@ -60,21 +60,21 @@
60#include "cryptlib.h" 60#include "cryptlib.h"
61#include <openssl/buffer.h> 61#include <openssl/buffer.h>
62#include <openssl/bn.h> 62#include <openssl/bn.h>
63#ifndef NO_RSA 63#ifndef OPENSSL_NO_RSA
64#include <openssl/rsa.h> 64#include <openssl/rsa.h>
65#endif 65#endif
66#ifndef NO_DH 66#ifndef OPENSSL_NO_DH
67#include <openssl/dh.h> 67#include <openssl/dh.h>
68#endif 68#endif
69#ifndef NO_DSA 69#ifndef OPENSSL_NO_DSA
70#include <openssl/dsa.h> 70#include <openssl/dsa.h>
71#endif 71#endif
72 72
73static int print(BIO *fp,const char *str,BIGNUM *num, 73static int print(BIO *fp,const char *str,BIGNUM *num,
74 unsigned char *buf,int off); 74 unsigned char *buf,int off);
75#ifndef NO_RSA 75#ifndef OPENSSL_NO_RSA
76#ifndef NO_FP_API 76#ifndef OPENSSL_NO_FP_API
77int RSA_print_fp(FILE *fp, RSA *x, int off) 77int RSA_print_fp(FILE *fp, const RSA *x, int off)
78 { 78 {
79 BIO *b; 79 BIO *b;
80 int ret; 80 int ret;
@@ -91,7 +91,7 @@ int RSA_print_fp(FILE *fp, RSA *x, int off)
91 } 91 }
92#endif 92#endif
93 93
94int RSA_print(BIO *bp, RSA *x, int off) 94int RSA_print(BIO *bp, const RSA *x, int off)
95 { 95 {
96 char str[128]; 96 char str[128];
97 const char *s; 97 const char *s;
@@ -136,11 +136,11 @@ err:
136 if (m != NULL) OPENSSL_free(m); 136 if (m != NULL) OPENSSL_free(m);
137 return(ret); 137 return(ret);
138 } 138 }
139#endif /* NO_RSA */ 139#endif /* OPENSSL_NO_RSA */
140 140
141#ifndef NO_DSA 141#ifndef OPENSSL_NO_DSA
142#ifndef NO_FP_API 142#ifndef OPENSSL_NO_FP_API
143int DSA_print_fp(FILE *fp, DSA *x, int off) 143int DSA_print_fp(FILE *fp, const DSA *x, int off)
144 { 144 {
145 BIO *b; 145 BIO *b;
146 int ret; 146 int ret;
@@ -157,7 +157,7 @@ int DSA_print_fp(FILE *fp, DSA *x, int off)
157 } 157 }
158#endif 158#endif
159 159
160int DSA_print(BIO *bp, DSA *x, int off) 160int DSA_print(BIO *bp, const DSA *x, int off)
161 { 161 {
162 char str[128]; 162 char str[128];
163 unsigned char *m=NULL; 163 unsigned char *m=NULL;
@@ -207,7 +207,7 @@ err:
207 if (m != NULL) OPENSSL_free(m); 207 if (m != NULL) OPENSSL_free(m);
208 return(ret); 208 return(ret);
209 } 209 }
210#endif /* !NO_DSA */ 210#endif /* !OPENSSL_NO_DSA */
211 211
212static int print(BIO *bp, const char *number, BIGNUM *num, unsigned char *buf, 212static int print(BIO *bp, const char *number, BIGNUM *num, unsigned char *buf,
213 int off) 213 int off)
@@ -259,9 +259,9 @@ static int print(BIO *bp, const char *number, BIGNUM *num, unsigned char *buf,
259 return(1); 259 return(1);
260 } 260 }
261 261
262#ifndef NO_DH 262#ifndef OPENSSL_NO_DH
263#ifndef NO_FP_API 263#ifndef OPENSSL_NO_FP_API
264int DHparams_print_fp(FILE *fp, DH *x) 264int DHparams_print_fp(FILE *fp, const DH *x)
265 { 265 {
266 BIO *b; 266 BIO *b;
267 int ret; 267 int ret;
@@ -278,7 +278,7 @@ int DHparams_print_fp(FILE *fp, DH *x)
278 } 278 }
279#endif 279#endif
280 280
281int DHparams_print(BIO *bp, DH *x) 281int DHparams_print(BIO *bp, const DH *x)
282 { 282 {
283 unsigned char *m=NULL; 283 unsigned char *m=NULL;
284 int reason=ERR_R_BUF_LIB,i,ret=0; 284 int reason=ERR_R_BUF_LIB,i,ret=0;
@@ -312,9 +312,9 @@ err:
312 } 312 }
313#endif 313#endif
314 314
315#ifndef NO_DSA 315#ifndef OPENSSL_NO_DSA
316#ifndef NO_FP_API 316#ifndef OPENSSL_NO_FP_API
317int DSAparams_print_fp(FILE *fp, DSA *x) 317int DSAparams_print_fp(FILE *fp, const DSA *x)
318 { 318 {
319 BIO *b; 319 BIO *b;
320 int ret; 320 int ret;
@@ -331,7 +331,7 @@ int DSAparams_print_fp(FILE *fp, DSA *x)
331 } 331 }
332#endif 332#endif
333 333
334int DSAparams_print(BIO *bp, DSA *x) 334int DSAparams_print(BIO *bp, const DSA *x)
335 { 335 {
336 unsigned char *m=NULL; 336 unsigned char *m=NULL;
337 int reason=ERR_R_BUF_LIB,i,ret=0; 337 int reason=ERR_R_BUF_LIB,i,ret=0;
@@ -357,5 +357,5 @@ err:
357 return(ret); 357 return(ret);
358 } 358 }
359 359
360#endif /* !NO_DSA */ 360#endif /* !OPENSSL_NO_DSA */
361 361
diff --git a/src/lib/libcrypto/asn1/t_req.c b/src/lib/libcrypto/asn1/t_req.c
index ea1af092db..848c29a2dd 100644
--- a/src/lib/libcrypto/asn1/t_req.c
+++ b/src/lib/libcrypto/asn1/t_req.c
@@ -64,7 +64,7 @@
64#include <openssl/x509.h> 64#include <openssl/x509.h>
65#include <openssl/x509v3.h> 65#include <openssl/x509v3.h>
66 66
67#ifndef NO_FP_API 67#ifndef OPENSSL_NO_FP_API
68int X509_REQ_print_fp(FILE *fp, X509_REQ *x) 68int X509_REQ_print_fp(FILE *fp, X509_REQ *x)
69 { 69 {
70 BIO *b; 70 BIO *b;
@@ -85,8 +85,7 @@ int X509_REQ_print_fp(FILE *fp, X509_REQ *x)
85int X509_REQ_print(BIO *bp, X509_REQ *x) 85int X509_REQ_print(BIO *bp, X509_REQ *x)
86 { 86 {
87 unsigned long l; 87 unsigned long l;
88 int i,n; 88 int i;
89 char *s;
90 const char *neg; 89 const char *neg;
91 X509_REQ_INFO *ri; 90 X509_REQ_INFO *ri;
92 EVP_PKEY *pkey; 91 EVP_PKEY *pkey;
@@ -118,7 +117,7 @@ int X509_REQ_print(BIO *bp, X509_REQ *x)
118 if (BIO_puts(bp,str) <= 0) goto err; 117 if (BIO_puts(bp,str) <= 0) goto err;
119 118
120 pkey=X509_REQ_get_pubkey(x); 119 pkey=X509_REQ_get_pubkey(x);
121#ifndef NO_RSA 120#ifndef OPENSSL_NO_RSA
122 if (pkey != NULL && pkey->type == EVP_PKEY_RSA) 121 if (pkey != NULL && pkey->type == EVP_PKEY_RSA)
123 { 122 {
124 BIO_printf(bp,"%12sRSA Public Key: (%d bit)\n","", 123 BIO_printf(bp,"%12sRSA Public Key: (%d bit)\n","",
@@ -127,7 +126,7 @@ int X509_REQ_print(BIO *bp, X509_REQ *x)
127 } 126 }
128 else 127 else
129#endif 128#endif
130#ifndef NO_DSA 129#ifndef OPENSSL_NO_DSA
131 if (pkey != NULL && pkey->type == EVP_PKEY_DSA) 130 if (pkey != NULL && pkey->type == EVP_PKEY_DSA)
132 { 131 {
133 BIO_printf(bp,"%12sDSA Public Key:\n",""); 132 BIO_printf(bp,"%12sDSA Public Key:\n","");
@@ -145,13 +144,10 @@ int X509_REQ_print(BIO *bp, X509_REQ *x)
145 if (BIO_puts(bp,str) <= 0) goto err; 144 if (BIO_puts(bp,str) <= 0) goto err;
146 145
147 sk=x->req_info->attributes; 146 sk=x->req_info->attributes;
148 if ((sk == NULL) || (sk_X509_ATTRIBUTE_num(sk) == 0)) 147 if (sk_X509_ATTRIBUTE_num(sk) == 0)
149 { 148 {
150 if (!x->req_info->req_kludge) 149 sprintf(str,"%12sa0:00\n","");
151 { 150 if (BIO_puts(bp,str) <= 0) goto err;
152 sprintf(str,"%12sa0:00\n","");
153 if (BIO_puts(bp,str) <= 0) goto err;
154 }
155 } 151 }
156 else 152 else
157 { 153 {
@@ -170,7 +166,13 @@ int X509_REQ_print(BIO *bp, X509_REQ *x)
170 if (BIO_puts(bp,str) <= 0) goto err; 166 if (BIO_puts(bp,str) <= 0) goto err;
171 if ((j=i2a_ASN1_OBJECT(bp,a->object)) > 0) 167 if ((j=i2a_ASN1_OBJECT(bp,a->object)) > 0)
172 { 168 {
173 if (a->set) 169 if (a->single)
170 {
171 t=a->value.single;
172 type=t->type;
173 bs=t->value.bit_string;
174 }
175 else
174 { 176 {
175 ii=0; 177 ii=0;
176 count=sk_ASN1_TYPE_num(a->value.set); 178 count=sk_ASN1_TYPE_num(a->value.set);
@@ -179,12 +181,6 @@ get_next:
179 type=at->type; 181 type=at->type;
180 bs=at->value.asn1_string; 182 bs=at->value.asn1_string;
181 } 183 }
182 else
183 {
184 t=a->value.single;
185 type=t->type;
186 bs=t->value.bit_string;
187 }
188 } 184 }
189 for (j=25-j; j>0; j--) 185 for (j=25-j; j>0; j--)
190 if (BIO_write(bp," ",1) != 1) goto err; 186 if (BIO_write(bp," ",1) != 1) goto err;
@@ -229,24 +225,8 @@ get_next:
229 sk_X509_EXTENSION_pop_free(exts, X509_EXTENSION_free); 225 sk_X509_EXTENSION_pop_free(exts, X509_EXTENSION_free);
230 } 226 }
231 227
232 i=OBJ_obj2nid(x->sig_alg->algorithm); 228 if(!X509_signature_print(bp, x->sig_alg, x->signature)) goto err;
233 sprintf(str,"%4sSignature Algorithm: %s","",
234 (i == NID_undef)?"UNKNOWN":OBJ_nid2ln(i));
235 if (BIO_puts(bp,str) <= 0) goto err;
236 229
237 n=x->signature->length;
238 s=(char *)x->signature->data;
239 for (i=0; i<n; i++)
240 {
241 if ((i%18) == 0)
242 {
243 sprintf(str,"\n%8s","");
244 if (BIO_puts(bp,str) <= 0) goto err;
245 }
246 sprintf(str,"%02x%s",(unsigned char)s[i],((i+1) == n)?"":":");
247 if (BIO_puts(bp,str) <= 0) goto err;
248 }
249 if (BIO_puts(bp,"\n") <= 0) goto err;
250 return(1); 230 return(1);
251err: 231err:
252 X509err(X509_F_X509_REQ_PRINT,ERR_R_BUF_LIB); 232 X509err(X509_F_X509_REQ_PRINT,ERR_R_BUF_LIB);
diff --git a/src/lib/libcrypto/asn1/t_spki.c b/src/lib/libcrypto/asn1/t_spki.c
index d708434fca..5abfbc815e 100644
--- a/src/lib/libcrypto/asn1/t_spki.c
+++ b/src/lib/libcrypto/asn1/t_spki.c
@@ -59,7 +59,7 @@
59#include <stdio.h> 59#include <stdio.h>
60#include "cryptlib.h" 60#include "cryptlib.h"
61#include <openssl/x509.h> 61#include <openssl/x509.h>
62#include <openssl/asn1_mac.h> 62#include <openssl/asn1.h>
63 63
64/* Print out an SPKI */ 64/* Print out an SPKI */
65 65
@@ -76,7 +76,7 @@ int NETSCAPE_SPKI_print(BIO *out, NETSCAPE_SPKI *spki)
76 pkey = X509_PUBKEY_get(spki->spkac->pubkey); 76 pkey = X509_PUBKEY_get(spki->spkac->pubkey);
77 if(!pkey) BIO_printf(out, " Unable to load public key\n"); 77 if(!pkey) BIO_printf(out, " Unable to load public key\n");
78 else { 78 else {
79#ifndef NO_RSA 79#ifndef OPENSSL_NO_RSA
80 if (pkey->type == EVP_PKEY_RSA) 80 if (pkey->type == EVP_PKEY_RSA)
81 { 81 {
82 BIO_printf(out," RSA Public Key: (%d bit)\n", 82 BIO_printf(out," RSA Public Key: (%d bit)\n",
@@ -85,7 +85,7 @@ int NETSCAPE_SPKI_print(BIO *out, NETSCAPE_SPKI *spki)
85 } 85 }
86 else 86 else
87#endif 87#endif
88#ifndef NO_DSA 88#ifndef OPENSSL_NO_DSA
89 if (pkey->type == EVP_PKEY_DSA) 89 if (pkey->type == EVP_PKEY_DSA)
90 { 90 {
91 BIO_printf(out," DSA Public Key:\n"); 91 BIO_printf(out," DSA Public Key:\n");
diff --git a/src/lib/libcrypto/asn1/t_x509.c b/src/lib/libcrypto/asn1/t_x509.c
index 89ae73a6de..5de4833ed0 100644
--- a/src/lib/libcrypto/asn1/t_x509.c
+++ b/src/lib/libcrypto/asn1/t_x509.c
@@ -60,18 +60,23 @@
60#include "cryptlib.h" 60#include "cryptlib.h"
61#include <openssl/buffer.h> 61#include <openssl/buffer.h>
62#include <openssl/bn.h> 62#include <openssl/bn.h>
63#ifndef NO_RSA 63#ifndef OPENSSL_NO_RSA
64#include <openssl/rsa.h> 64#include <openssl/rsa.h>
65#endif 65#endif
66#ifndef NO_DSA 66#ifndef OPENSSL_NO_DSA
67#include <openssl/dsa.h> 67#include <openssl/dsa.h>
68#endif 68#endif
69#include <openssl/objects.h> 69#include <openssl/objects.h>
70#include <openssl/x509.h> 70#include <openssl/x509.h>
71#include <openssl/x509v3.h> 71#include <openssl/x509v3.h>
72 72
73#ifndef NO_FP_API 73#ifndef OPENSSL_NO_FP_API
74int X509_print_fp(FILE *fp, X509 *x) 74int X509_print_fp(FILE *fp, X509 *x)
75 {
76 return X509_print_ex_fp(fp, x, XN_FLAG_COMPAT, X509_FLAG_COMPAT);
77 }
78
79int X509_print_ex_fp(FILE *fp, X509 *x, unsigned long nmflag, unsigned long cflag)
75 { 80 {
76 BIO *b; 81 BIO *b;
77 int ret; 82 int ret;
@@ -82,144 +87,165 @@ int X509_print_fp(FILE *fp, X509 *x)
82 return(0); 87 return(0);
83 } 88 }
84 BIO_set_fp(b,fp,BIO_NOCLOSE); 89 BIO_set_fp(b,fp,BIO_NOCLOSE);
85 ret=X509_print(b, x); 90 ret=X509_print_ex(b, x, nmflag, cflag);
86 BIO_free(b); 91 BIO_free(b);
87 return(ret); 92 return(ret);
88 } 93 }
89#endif 94#endif
90 95
91int X509_print(BIO *bp, X509 *x) 96int X509_print(BIO *bp, X509 *x)
97{
98 return X509_print_ex(bp, x, XN_FLAG_COMPAT, X509_FLAG_COMPAT);
99}
100
101int X509_print_ex(BIO *bp, X509 *x, unsigned long nmflags, unsigned long cflag)
92 { 102 {
93 long l; 103 long l;
94 int ret=0,i,j,n; 104 int ret=0,i;
95 char *m=NULL,*s; 105 char *m=NULL,mlch = ' ';
106 int nmindent = 0;
96 X509_CINF *ci; 107 X509_CINF *ci;
97 ASN1_INTEGER *bs; 108 ASN1_INTEGER *bs;
98 EVP_PKEY *pkey=NULL; 109 EVP_PKEY *pkey=NULL;
99 const char *neg; 110 const char *neg;
100 X509_EXTENSION *ex;
101 ASN1_STRING *str=NULL; 111 ASN1_STRING *str=NULL;
102 112
113 if((nmflags & XN_FLAG_SEP_MASK) == XN_FLAG_SEP_MULTILINE) {
114 mlch = '\n';
115 nmindent = 12;
116 }
117
118 if(nmflags == X509_FLAG_COMPAT)
119 nmindent = 16;
120
103 ci=x->cert_info; 121 ci=x->cert_info;
104 if (BIO_write(bp,"Certificate:\n",13) <= 0) goto err; 122 if(!(cflag & X509_FLAG_NO_HEADER))
105 if (BIO_write(bp," Data:\n",10) <= 0) goto err;
106 l=X509_get_version(x);
107 if (BIO_printf(bp,"%8sVersion: %lu (0x%lx)\n","",l+1,l) <= 0) goto err;
108 if (BIO_write(bp," Serial Number:",22) <= 0) goto err;
109
110 bs=X509_get_serialNumber(x);
111 if (bs->length <= 4)
112 { 123 {
113 l=ASN1_INTEGER_get(bs); 124 if (BIO_write(bp,"Certificate:\n",13) <= 0) goto err;
114 if (l < 0) 125 if (BIO_write(bp," Data:\n",10) <= 0) goto err;
115 {
116 l= -l;
117 neg="-";
118 }
119 else
120 neg="";
121 if (BIO_printf(bp," %s%lu (%s0x%lx)\n",neg,l,neg,l) <= 0)
122 goto err;
123 } 126 }
124 else 127 if(!(cflag & X509_FLAG_NO_VERSION))
128 {
129 l=X509_get_version(x);
130 if (BIO_printf(bp,"%8sVersion: %lu (0x%lx)\n","",l+1,l) <= 0) goto err;
131 }
132 if(!(cflag & X509_FLAG_NO_SERIAL))
125 { 133 {
126 neg=(bs->type == V_ASN1_NEG_INTEGER)?" (Negative)":"";
127 if (BIO_printf(bp,"\n%12s%s","",neg) <= 0) goto err;
128 134
129 for (i=0; i<bs->length; i++) 135 if (BIO_write(bp," Serial Number:",22) <= 0) goto err;
136
137 bs=X509_get_serialNumber(x);
138 if (bs->length <= 4)
130 { 139 {
131 if (BIO_printf(bp,"%02x%c",bs->data[i], 140 l=ASN1_INTEGER_get(bs);
132 ((i+1 == bs->length)?'\n':':')) <= 0) 141 if (l < 0)
142 {
143 l= -l;
144 neg="-";
145 }
146 else
147 neg="";
148 if (BIO_printf(bp," %s%lu (%s0x%lx)\n",neg,l,neg,l) <= 0)
133 goto err; 149 goto err;
134 } 150 }
135 } 151 else
152 {
153 neg=(bs->type == V_ASN1_NEG_INTEGER)?" (Negative)":"";
154 if (BIO_printf(bp,"\n%12s%s","",neg) <= 0) goto err;
136 155
137 i=OBJ_obj2nid(ci->signature->algorithm); 156 for (i=0; i<bs->length; i++)
138 if (BIO_printf(bp,"%8sSignature Algorithm: %s\n","", 157 {
139 (i == NID_undef)?"UNKNOWN":OBJ_nid2ln(i)) <= 0) 158 if (BIO_printf(bp,"%02x%c",bs->data[i],
140 goto err; 159 ((i+1 == bs->length)?'\n':':')) <= 0)
160 goto err;
161 }
162 }
141 163
142 if (BIO_write(bp," Issuer: ",16) <= 0) goto err; 164 }
143 if (!X509_NAME_print(bp,X509_get_issuer_name(x),16)) goto err;
144 if (BIO_write(bp,"\n Validity\n",18) <= 0) goto err;
145 if (BIO_write(bp," Not Before: ",24) <= 0) goto err;
146 if (!ASN1_TIME_print(bp,X509_get_notBefore(x))) goto err;
147 if (BIO_write(bp,"\n Not After : ",25) <= 0) goto err;
148 if (!ASN1_TIME_print(bp,X509_get_notAfter(x))) goto err;
149 if (BIO_write(bp,"\n Subject: ",18) <= 0) goto err;
150 if (!X509_NAME_print(bp,X509_get_subject_name(x),16)) goto err;
151 if (BIO_write(bp,"\n Subject Public Key Info:\n",34) <= 0)
152 goto err;
153 i=OBJ_obj2nid(ci->key->algor->algorithm);
154 if (BIO_printf(bp,"%12sPublic Key Algorithm: %s\n","",
155 (i == NID_undef)?"UNKNOWN":OBJ_nid2ln(i)) <= 0) goto err;
156 165
157 pkey=X509_get_pubkey(x); 166 if(!(cflag & X509_FLAG_NO_SIGNAME))
158 if (pkey == NULL)
159 { 167 {
160 BIO_printf(bp,"%12sUnable to load Public Key\n",""); 168 if (BIO_printf(bp,"%8sSignature Algorithm: ","") <= 0)
161 ERR_print_errors(bp); 169 goto err;
170 if (i2a_ASN1_OBJECT(bp, ci->signature->algorithm) <= 0)
171 goto err;
172 if (BIO_puts(bp, "\n") <= 0)
173 goto err;
162 } 174 }
163 else 175
164#ifndef NO_RSA 176 if(!(cflag & X509_FLAG_NO_ISSUER))
165 if (pkey->type == EVP_PKEY_RSA)
166 { 177 {
167 BIO_printf(bp,"%12sRSA Public Key: (%d bit)\n","", 178 if (BIO_printf(bp," Issuer:%c",mlch) <= 0) goto err;
168 BN_num_bits(pkey->pkey.rsa->n)); 179 if (X509_NAME_print_ex(bp,X509_get_issuer_name(x),nmindent, nmflags) < 0) goto err;
169 RSA_print(bp,pkey->pkey.rsa,16); 180 if (BIO_write(bp,"\n",1) <= 0) goto err;
170 } 181 }
171 else 182 if(!(cflag & X509_FLAG_NO_VALIDITY))
172#endif
173#ifndef NO_DSA
174 if (pkey->type == EVP_PKEY_DSA)
175 { 183 {
176 BIO_printf(bp,"%12sDSA Public Key:\n",""); 184 if (BIO_write(bp," Validity\n",17) <= 0) goto err;
177 DSA_print(bp,pkey->pkey.dsa,16); 185 if (BIO_write(bp," Not Before: ",24) <= 0) goto err;
186 if (!ASN1_TIME_print(bp,X509_get_notBefore(x))) goto err;
187 if (BIO_write(bp,"\n Not After : ",25) <= 0) goto err;
188 if (!ASN1_TIME_print(bp,X509_get_notAfter(x))) goto err;
189 if (BIO_write(bp,"\n",1) <= 0) goto err;
178 } 190 }
179 else 191 if(!(cflag & X509_FLAG_NO_SUBJECT))
180#endif
181 BIO_printf(bp,"%12sUnknown Public Key:\n","");
182
183 EVP_PKEY_free(pkey);
184
185 n=X509_get_ext_count(x);
186 if (n > 0)
187 { 192 {
188 BIO_printf(bp,"%8sX509v3 extensions:\n",""); 193 if (BIO_printf(bp," Subject:%c",mlch) <= 0) goto err;
189 for (i=0; i<n; i++) 194 if (X509_NAME_print_ex(bp,X509_get_subject_name(x),nmindent, nmflags) < 0) goto err;
195 if (BIO_write(bp,"\n",1) <= 0) goto err;
196 }
197 if(!(cflag & X509_FLAG_NO_PUBKEY))
198 {
199 if (BIO_write(bp," Subject Public Key Info:\n",33) <= 0)
200 goto err;
201 if (BIO_printf(bp,"%12sPublic Key Algorithm: ","") <= 0)
202 goto err;
203 if (i2a_ASN1_OBJECT(bp, ci->key->algor->algorithm) <= 0)
204 goto err;
205 if (BIO_puts(bp, "\n") <= 0)
206 goto err;
207
208 pkey=X509_get_pubkey(x);
209 if (pkey == NULL)
190 { 210 {
191 ASN1_OBJECT *obj; 211 BIO_printf(bp,"%12sUnable to load Public Key\n","");
192 ex=X509_get_ext(x,i); 212 ERR_print_errors(bp);
193 if (BIO_printf(bp,"%12s","") <= 0) goto err; 213 }
194 obj=X509_EXTENSION_get_object(ex); 214 else
195 i2a_ASN1_OBJECT(bp,obj); 215#ifndef OPENSSL_NO_RSA
196 j=X509_EXTENSION_get_critical(ex); 216 if (pkey->type == EVP_PKEY_RSA)
197 if (BIO_printf(bp,": %s\n",j?"critical":"","") <= 0) 217 {
198 goto err; 218 BIO_printf(bp,"%12sRSA Public Key: (%d bit)\n","",
199 if(!X509V3_EXT_print(bp, ex, 0, 16)) 219 BN_num_bits(pkey->pkey.rsa->n));
200 { 220 RSA_print(bp,pkey->pkey.rsa,16);
201 BIO_printf(bp, "%16s", ""); 221 }
202 M_ASN1_OCTET_STRING_print(bp,ex->value); 222 else
203 } 223#endif
204 if (BIO_write(bp,"\n",1) <= 0) goto err; 224#ifndef OPENSSL_NO_DSA
225 if (pkey->type == EVP_PKEY_DSA)
226 {
227 BIO_printf(bp,"%12sDSA Public Key:\n","");
228 DSA_print(bp,pkey->pkey.dsa,16);
205 } 229 }
230 else
231#endif
232 BIO_printf(bp,"%12sUnknown Public Key:\n","");
233
234 EVP_PKEY_free(pkey);
206 } 235 }
207 236
208 i=OBJ_obj2nid(x->sig_alg->algorithm); 237 if (!(cflag & X509_FLAG_NO_EXTENSIONS))
209 if (BIO_printf(bp,"%4sSignature Algorithm: %s","", 238 X509V3_extensions_print(bp, "X509v3 extensions",
210 (i == NID_undef)?"UNKNOWN":OBJ_nid2ln(i)) <= 0) goto err; 239 ci->extensions, cflag, 8);
211 240
212 n=x->signature->length; 241 if(!(cflag & X509_FLAG_NO_SIGDUMP))
213 s=(char *)x->signature->data;
214 for (i=0; i<n; i++)
215 { 242 {
216 if ((i%18) == 0) 243 if(X509_signature_print(bp, x->sig_alg, x->signature) <= 0) goto err;
217 if (BIO_write(bp,"\n ",9) <= 0) goto err; 244 }
218 if (BIO_printf(bp,"%02x%s",(unsigned char)s[i], 245 if(!(cflag & X509_FLAG_NO_AUX))
219 ((i+1) == n)?"":":") <= 0) goto err; 246 {
247 if (!X509_CERT_AUX_print(bp, x->aux, 0)) goto err;
220 } 248 }
221 if (BIO_write(bp,"\n",1) != 1) goto err;
222 if (!X509_CERT_AUX_print(bp, x->aux, 0)) goto err;
223 ret=1; 249 ret=1;
224err: 250err:
225 if (str != NULL) ASN1_STRING_free(str); 251 if (str != NULL) ASN1_STRING_free(str);
@@ -227,6 +253,71 @@ err:
227 return(ret); 253 return(ret);
228 } 254 }
229 255
256int X509_ocspid_print (BIO *bp, X509 *x)
257 {
258 unsigned char *der=NULL ;
259 unsigned char *dertmp;
260 int derlen;
261 int i;
262 unsigned char SHA1md[SHA_DIGEST_LENGTH];
263
264 /* display the hash of the subject as it would appear
265 in OCSP requests */
266 if (BIO_printf(bp," Subject OCSP hash: ") <= 0)
267 goto err;
268 derlen = i2d_X509_NAME(x->cert_info->subject, NULL);
269 if ((der = dertmp = (unsigned char *)OPENSSL_malloc (derlen)) == NULL)
270 goto err;
271 i2d_X509_NAME(x->cert_info->subject, &dertmp);
272
273 EVP_Digest(der, derlen, SHA1md, NULL, EVP_sha1(), NULL);
274 for (i=0; i < SHA_DIGEST_LENGTH; i++)
275 {
276 if (BIO_printf(bp,"%02X",SHA1md[i]) <= 0) goto err;
277 }
278 OPENSSL_free (der);
279 der=NULL;
280
281 /* display the hash of the public key as it would appear
282 in OCSP requests */
283 if (BIO_printf(bp,"\n Public key OCSP hash: ") <= 0)
284 goto err;
285
286 EVP_Digest(x->cert_info->key->public_key->data,
287 x->cert_info->key->public_key->length, SHA1md, NULL, EVP_sha1(), NULL);
288 for (i=0; i < SHA_DIGEST_LENGTH; i++)
289 {
290 if (BIO_printf(bp,"%02X",SHA1md[i]) <= 0)
291 goto err;
292 }
293 BIO_printf(bp,"\n");
294
295 return (1);
296err:
297 if (der != NULL) OPENSSL_free(der);
298 return(0);
299 }
300
301int X509_signature_print(BIO *bp, X509_ALGOR *sigalg, ASN1_STRING *sig)
302{
303 unsigned char *s;
304 int i, n;
305 if (BIO_puts(bp," Signature Algorithm: ") <= 0) return 0;
306 if (i2a_ASN1_OBJECT(bp, sigalg->algorithm) <= 0) return 0;
307
308 n=sig->length;
309 s=sig->data;
310 for (i=0; i<n; i++)
311 {
312 if ((i%18) == 0)
313 if (BIO_write(bp,"\n ",9) <= 0) return 0;
314 if (BIO_printf(bp,"%02x%s",s[i],
315 ((i+1) == n)?"":":") <= 0) return 0;
316 }
317 if (BIO_write(bp,"\n",1) != 1) return 0;
318 return 1;
319}
320
230int ASN1_STRING_print(BIO *bp, ASN1_STRING *v) 321int ASN1_STRING_print(BIO *bp, ASN1_STRING *v)
231 { 322 {
232 int i,n; 323 int i,n;
diff --git a/src/lib/libcrypto/asn1/t_x509a.c b/src/lib/libcrypto/asn1/t_x509a.c
index f06af5b576..7d4a6e6084 100644
--- a/src/lib/libcrypto/asn1/t_x509a.c
+++ b/src/lib/libcrypto/asn1/t_x509a.c
@@ -59,7 +59,7 @@
59#include <stdio.h> 59#include <stdio.h>
60#include "cryptlib.h" 60#include "cryptlib.h"
61#include <openssl/evp.h> 61#include <openssl/evp.h>
62#include <openssl/asn1_mac.h> 62#include <openssl/asn1.h>
63#include <openssl/x509.h> 63#include <openssl/x509.h>
64 64
65/* X509_CERT_AUX and string set routines 65/* X509_CERT_AUX and string set routines
diff --git a/src/lib/libcrypto/asn1/tasn_dec.c b/src/lib/libcrypto/asn1/tasn_dec.c
new file mode 100644
index 0000000000..0fc1f421e2
--- /dev/null
+++ b/src/lib/libcrypto/asn1/tasn_dec.c
@@ -0,0 +1,958 @@
1/* tasn_dec.c */
2/* Written by Dr Stephen N Henson (shenson@bigfoot.com) for the OpenSSL
3 * project 2000.
4 */
5/* ====================================================================
6 * Copyright (c) 2000 The OpenSSL Project. All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 *
12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 *
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in
17 * the documentation and/or other materials provided with the
18 * distribution.
19 *
20 * 3. All advertising materials mentioning features or use of this
21 * software must display the following acknowledgment:
22 * "This product includes software developed by the OpenSSL Project
23 * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
24 *
25 * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
26 * endorse or promote products derived from this software without
27 * prior written permission. For written permission, please contact
28 * licensing@OpenSSL.org.
29 *
30 * 5. Products derived from this software may not be called "OpenSSL"
31 * nor may "OpenSSL" appear in their names without prior written
32 * permission of the OpenSSL Project.
33 *
34 * 6. Redistributions of any form whatsoever must retain the following
35 * acknowledgment:
36 * "This product includes software developed by the OpenSSL Project
37 * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
38 *
39 * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
40 * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
41 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
42 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
43 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
44 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
45 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
46 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
47 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
48 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
49 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
50 * OF THE POSSIBILITY OF SUCH DAMAGE.
51 * ====================================================================
52 *
53 * This product includes cryptographic software written by Eric Young
54 * (eay@cryptsoft.com). This product includes software written by Tim
55 * Hudson (tjh@cryptsoft.com).
56 *
57 */
58
59
60#include <stddef.h>
61#include <string.h>
62#include <openssl/asn1.h>
63#include <openssl/asn1t.h>
64#include <openssl/objects.h>
65#include <openssl/buffer.h>
66#include <openssl/err.h>
67
68static int asn1_check_eoc(unsigned char **in, long len);
69static int asn1_collect(BUF_MEM *buf, unsigned char **in, long len, char inf, int tag, int aclass);
70static int collect_data(BUF_MEM *buf, unsigned char **p, long plen);
71static int asn1_check_tlen(long *olen, int *otag, unsigned char *oclass, char *inf, char *cst,
72 unsigned char **in, long len, int exptag, int expclass, char opt, ASN1_TLC *ctx);
73static int asn1_template_ex_d2i(ASN1_VALUE **pval, unsigned char **in, long len, const ASN1_TEMPLATE *tt, char opt, ASN1_TLC *ctx);
74static int asn1_template_noexp_d2i(ASN1_VALUE **val, unsigned char **in, long len, const ASN1_TEMPLATE *tt, char opt, ASN1_TLC *ctx);
75static int asn1_d2i_ex_primitive(ASN1_VALUE **pval, unsigned char **in, long len,
76 const ASN1_ITEM *it, int tag, int aclass, char opt, ASN1_TLC *ctx);
77
78/* Table to convert tags to bit values, used for MSTRING type */
79static unsigned long tag2bit[32]={
800, 0, 0, B_ASN1_BIT_STRING, /* tags 0 - 3 */
81B_ASN1_OCTET_STRING, 0, 0, B_ASN1_UNKNOWN,/* tags 4- 7 */
82B_ASN1_UNKNOWN, B_ASN1_UNKNOWN, B_ASN1_UNKNOWN, B_ASN1_UNKNOWN,/* tags 8-11 */
83B_ASN1_UTF8STRING,B_ASN1_UNKNOWN,B_ASN1_UNKNOWN,B_ASN1_UNKNOWN,/* tags 12-15 */
840, 0, B_ASN1_NUMERICSTRING,B_ASN1_PRINTABLESTRING, /* tags 16-19 */
85B_ASN1_T61STRING,B_ASN1_VIDEOTEXSTRING,B_ASN1_IA5STRING, /* tags 20-22 */
86B_ASN1_UTCTIME, B_ASN1_GENERALIZEDTIME, /* tags 23-24 */
87B_ASN1_GRAPHICSTRING,B_ASN1_ISO64STRING,B_ASN1_GENERALSTRING, /* tags 25-27 */
88B_ASN1_UNIVERSALSTRING,B_ASN1_UNKNOWN,B_ASN1_BMPSTRING,B_ASN1_UNKNOWN, /* tags 28-31 */
89 };
90
91unsigned long ASN1_tag2bit(int tag)
92{
93 if((tag < 0) || (tag > 30)) return 0;
94 return tag2bit[tag];
95}
96
97/* Macro to initialize and invalidate the cache */
98
99#define asn1_tlc_clear(c) if(c) (c)->valid = 0
100
101/* Decode an ASN1 item, this currently behaves just
102 * like a standard 'd2i' function. 'in' points to
103 * a buffer to read the data from, in future we will
104 * have more advanced versions that can input data
105 * a piece at a time and this will simply be a special
106 * case.
107 */
108
109ASN1_VALUE *ASN1_item_d2i(ASN1_VALUE **pval, unsigned char **in, long len, const ASN1_ITEM *it)
110{
111 ASN1_TLC c;
112 ASN1_VALUE *ptmpval = NULL;
113 if(!pval) pval = &ptmpval;
114 asn1_tlc_clear(&c);
115 if(ASN1_item_ex_d2i(pval, in, len, it, -1, 0, 0, &c) > 0)
116 return *pval;
117 return NULL;
118}
119
120int ASN1_template_d2i(ASN1_VALUE **pval, unsigned char **in, long len, const ASN1_TEMPLATE *tt)
121{
122 ASN1_TLC c;
123 asn1_tlc_clear(&c);
124 return asn1_template_ex_d2i(pval, in, len, tt, 0, &c);
125}
126
127
128/* Decode an item, taking care of IMPLICIT tagging, if any.
129 * If 'opt' set and tag mismatch return -1 to handle OPTIONAL
130 */
131
132int ASN1_item_ex_d2i(ASN1_VALUE **pval, unsigned char **in, long len, const ASN1_ITEM *it,
133 int tag, int aclass, char opt, ASN1_TLC *ctx)
134{
135 const ASN1_TEMPLATE *tt, *errtt = NULL;
136 const ASN1_COMPAT_FUNCS *cf;
137 const ASN1_EXTERN_FUNCS *ef;
138 const ASN1_AUX *aux = it->funcs;
139 ASN1_aux_cb *asn1_cb;
140 unsigned char *p, *q, imphack = 0, oclass;
141 char seq_eoc, seq_nolen, cst, isopt;
142 long tmplen;
143 int i;
144 int otag;
145 int ret = 0;
146 ASN1_VALUE *pchval, **pchptr, *ptmpval;
147 if(!pval) return 0;
148 if(aux && aux->asn1_cb) asn1_cb = aux->asn1_cb;
149 else asn1_cb = 0;
150
151 switch(it->itype) {
152
153 case ASN1_ITYPE_PRIMITIVE:
154 if(it->templates) {
155 /* tagging or OPTIONAL is currently illegal on an item template
156 * because the flags can't get passed down. In practice this isn't
157 * a problem: we include the relevant flags from the item template
158 * in the template itself.
159 */
160 if ((tag != -1) || opt) {
161 ASN1err(ASN1_F_ASN1_ITEM_EX_D2I, ASN1_R_ILLEGAL_OPTIONS_ON_ITEM_TEMPLATE);
162 goto err;
163 }
164 return asn1_template_ex_d2i(pval, in, len, it->templates, opt, ctx);
165 }
166 return asn1_d2i_ex_primitive(pval, in, len, it, tag, aclass, opt, ctx);
167 break;
168
169 case ASN1_ITYPE_MSTRING:
170 p = *in;
171 /* Just read in tag and class */
172 ret = asn1_check_tlen(NULL, &otag, &oclass, NULL, NULL, &p, len, -1, 0, 1, ctx);
173 if(!ret) {
174 ASN1err(ASN1_F_ASN1_ITEM_EX_D2I, ERR_R_NESTED_ASN1_ERROR);
175 goto err;
176 }
177 /* Must be UNIVERSAL class */
178 if(oclass != V_ASN1_UNIVERSAL) {
179 /* If OPTIONAL, assume this is OK */
180 if(opt) return -1;
181 ASN1err(ASN1_F_ASN1_ITEM_EX_D2I, ASN1_R_MSTRING_NOT_UNIVERSAL);
182 goto err;
183 }
184 /* Check tag matches bit map */
185 if(!(ASN1_tag2bit(otag) & it->utype)) {
186 /* If OPTIONAL, assume this is OK */
187 if(opt) return -1;
188 ASN1err(ASN1_F_ASN1_ITEM_EX_D2I, ASN1_R_MSTRING_WRONG_TAG);
189 goto err;
190 }
191 return asn1_d2i_ex_primitive(pval, in, len, it, otag, 0, 0, ctx);
192
193 case ASN1_ITYPE_EXTERN:
194 /* Use new style d2i */
195 ef = it->funcs;
196 return ef->asn1_ex_d2i(pval, in, len, it, tag, aclass, opt, ctx);
197
198 case ASN1_ITYPE_COMPAT:
199 /* we must resort to old style evil hackery */
200 cf = it->funcs;
201
202 /* If OPTIONAL see if it is there */
203 if(opt) {
204 int exptag;
205 p = *in;
206 if(tag == -1) exptag = it->utype;
207 else exptag = tag;
208 /* Don't care about anything other than presence of expected tag */
209 ret = asn1_check_tlen(NULL, NULL, NULL, NULL, NULL, &p, len, exptag, aclass, 1, ctx);
210 if(!ret) {
211 ASN1err(ASN1_F_ASN1_ITEM_EX_D2I, ERR_R_NESTED_ASN1_ERROR);
212 goto err;
213 }
214 if(ret == -1) return -1;
215 }
216 /* This is the old style evil hack IMPLICIT handling:
217 * since the underlying code is expecting a tag and
218 * class other than the one present we change the
219 * buffer temporarily then change it back afterwards.
220 * This doesn't and never did work for tags > 30.
221 *
222 * Yes this is *horrible* but it is only needed for
223 * old style d2i which will hopefully not be around
224 * for much longer.
225 * FIXME: should copy the buffer then modify it so
226 * the input buffer can be const: we should *always*
227 * copy because the old style d2i might modify the
228 * buffer.
229 */
230
231 if(tag != -1) {
232 p = *in;
233 imphack = *p;
234 *p = (unsigned char)((*p & V_ASN1_CONSTRUCTED) | it->utype);
235 }
236
237 ptmpval = cf->asn1_d2i(pval, in, len);
238
239 if(tag != -1) *p = imphack;
240
241 if(ptmpval) return 1;
242 ASN1err(ASN1_F_ASN1_ITEM_EX_D2I, ERR_R_NESTED_ASN1_ERROR);
243 goto err;
244
245
246 case ASN1_ITYPE_CHOICE:
247 if(asn1_cb && !asn1_cb(ASN1_OP_D2I_PRE, pval, it))
248 goto auxerr;
249
250 /* Allocate structure */
251 if(!*pval) {
252 if(!ASN1_item_ex_new(pval, it)) {
253 ASN1err(ASN1_F_ASN1_ITEM_EX_D2I, ERR_R_NESTED_ASN1_ERROR);
254 goto err;
255 }
256 }
257 /* CHOICE type, try each possibility in turn */
258 pchval = NULL;
259 p = *in;
260 for(i = 0, tt=it->templates; i < it->tcount; i++, tt++) {
261 pchptr = asn1_get_field_ptr(pval, tt);
262 /* We mark field as OPTIONAL so its absence
263 * can be recognised.
264 */
265 ret = asn1_template_ex_d2i(pchptr, &p, len, tt, 1, ctx);
266 /* If field not present, try the next one */
267 if(ret == -1) continue;
268 /* If positive return, read OK, break loop */
269 if(ret > 0) break;
270 /* Otherwise must be an ASN1 parsing error */
271 errtt = tt;
272 ASN1err(ASN1_F_ASN1_ITEM_EX_D2I, ERR_R_NESTED_ASN1_ERROR);
273 goto err;
274 }
275 /* Did we fall off the end without reading anything? */
276 if(i == it->tcount) {
277 /* If OPTIONAL, this is OK */
278 if(opt) {
279 /* Free and zero it */
280 ASN1_item_ex_free(pval, it);
281 return -1;
282 }
283 ASN1err(ASN1_F_ASN1_ITEM_EX_D2I, ASN1_R_NO_MATCHING_CHOICE_TYPE);
284 goto err;
285 }
286 asn1_set_choice_selector(pval, i, it);
287 *in = p;
288 if(asn1_cb && !asn1_cb(ASN1_OP_D2I_POST, pval, it))
289 goto auxerr;
290 return 1;
291
292 case ASN1_ITYPE_SEQUENCE:
293 p = *in;
294 tmplen = len;
295
296 /* If no IMPLICIT tagging set to SEQUENCE, UNIVERSAL */
297 if(tag == -1) {
298 tag = V_ASN1_SEQUENCE;
299 aclass = V_ASN1_UNIVERSAL;
300 }
301 /* Get SEQUENCE length and update len, p */
302 ret = asn1_check_tlen(&len, NULL, NULL, &seq_eoc, &cst, &p, len, tag, aclass, opt, ctx);
303 if(!ret) {
304 ASN1err(ASN1_F_ASN1_ITEM_EX_D2I, ERR_R_NESTED_ASN1_ERROR);
305 goto err;
306 } else if(ret == -1) return -1;
307 if(aux && (aux->flags & ASN1_AFLG_BROKEN)) {
308 len = tmplen - (p - *in);
309 seq_nolen = 1;
310 } else seq_nolen = seq_eoc; /* If indefinite we don't do a length check */
311 if(!cst) {
312 ASN1err(ASN1_F_ASN1_ITEM_EX_D2I, ASN1_R_SEQUENCE_NOT_CONSTRUCTED);
313 goto err;
314 }
315
316 if(!*pval) {
317 if(!ASN1_item_ex_new(pval, it)) {
318 ASN1err(ASN1_F_ASN1_ITEM_EX_D2I, ERR_R_NESTED_ASN1_ERROR);
319 goto err;
320 }
321 }
322 if(asn1_cb && !asn1_cb(ASN1_OP_D2I_PRE, pval, it))
323 goto auxerr;
324
325 /* Get each field entry */
326 for(i = 0, tt = it->templates; i < it->tcount; i++, tt++) {
327 const ASN1_TEMPLATE *seqtt;
328 ASN1_VALUE **pseqval;
329 seqtt = asn1_do_adb(pval, tt, 1);
330 if(!seqtt) goto err;
331 pseqval = asn1_get_field_ptr(pval, seqtt);
332 /* Have we ran out of data? */
333 if(!len) break;
334 q = p;
335 if(asn1_check_eoc(&p, len)) {
336 if(!seq_eoc) {
337 ASN1err(ASN1_F_ASN1_ITEM_EX_D2I, ASN1_R_UNEXPECTED_EOC);
338 goto err;
339 }
340 len -= p - q;
341 seq_eoc = 0;
342 q = p;
343 break;
344 }
345 /* This determines the OPTIONAL flag value. The field cannot
346 * be omitted if it is the last of a SEQUENCE and there is
347 * still data to be read. This isn't strictly necessary but
348 * it increases efficiency in some cases.
349 */
350 if(i == (it->tcount - 1)) isopt = 0;
351 else isopt = (char)(seqtt->flags & ASN1_TFLG_OPTIONAL);
352 /* attempt to read in field, allowing each to be OPTIONAL */
353 ret = asn1_template_ex_d2i(pseqval, &p, len, seqtt, isopt, ctx);
354 if(!ret) {
355 errtt = seqtt;
356 goto err;
357 } else if(ret == -1) {
358 /* OPTIONAL component absent. Free and zero the field
359 */
360 ASN1_template_free(pseqval, seqtt);
361 continue;
362 }
363 /* Update length */
364 len -= p - q;
365 }
366 /* Check for EOC if expecting one */
367 if(seq_eoc && !asn1_check_eoc(&p, len)) {
368 ASN1err(ASN1_F_ASN1_ITEM_EX_D2I, ASN1_R_MISSING_EOC);
369 goto err;
370 }
371 /* Check all data read */
372 if(!seq_nolen && len) {
373 ASN1err(ASN1_F_ASN1_ITEM_EX_D2I, ASN1_R_SEQUENCE_LENGTH_MISMATCH);
374 goto err;
375 }
376
377 /* If we get here we've got no more data in the SEQUENCE,
378 * however we may not have read all fields so check all
379 * remaining are OPTIONAL and clear any that are.
380 */
381 for(; i < it->tcount; tt++, i++) {
382 const ASN1_TEMPLATE *seqtt;
383 seqtt = asn1_do_adb(pval, tt, 1);
384 if(!seqtt) goto err;
385 if(seqtt->flags & ASN1_TFLG_OPTIONAL) {
386 ASN1_VALUE **pseqval;
387 pseqval = asn1_get_field_ptr(pval, seqtt);
388 ASN1_template_free(pseqval, seqtt);
389 } else {
390 errtt = seqtt;
391 ASN1err(ASN1_F_ASN1_ITEM_EX_D2I, ASN1_R_FIELD_MISSING);
392 goto err;
393 }
394 }
395 /* Save encoding */
396 if(!asn1_enc_save(pval, *in, p - *in, it)) goto auxerr;
397 *in = p;
398 if(asn1_cb && !asn1_cb(ASN1_OP_D2I_POST, pval, it))
399 goto auxerr;
400 return 1;
401
402 default:
403 return 0;
404 }
405 auxerr:
406 ASN1err(ASN1_F_ASN1_ITEM_EX_D2I, ASN1_R_AUX_ERROR);
407 err:
408 ASN1_item_ex_free(pval, it);
409 if(errtt) ERR_add_error_data(4, "Field=", errtt->field_name, ", Type=", it->sname);
410 else ERR_add_error_data(2, "Type=", it->sname);
411 return 0;
412}
413
414/* Templates are handled with two separate functions. One handles any EXPLICIT tag and the other handles the
415 * rest.
416 */
417
418static int asn1_template_ex_d2i(ASN1_VALUE **val, unsigned char **in, long inlen, const ASN1_TEMPLATE *tt, char opt, ASN1_TLC *ctx)
419{
420 int flags, aclass;
421 int ret;
422 long len;
423 unsigned char *p, *q;
424 char exp_eoc;
425 if(!val) return 0;
426 flags = tt->flags;
427 aclass = flags & ASN1_TFLG_TAG_CLASS;
428
429 p = *in;
430
431 /* Check if EXPLICIT tag expected */
432 if(flags & ASN1_TFLG_EXPTAG) {
433 char cst;
434 /* Need to work out amount of data available to the inner content and where it
435 * starts: so read in EXPLICIT header to get the info.
436 */
437 ret = asn1_check_tlen(&len, NULL, NULL, &exp_eoc, &cst, &p, inlen, tt->tag, aclass, opt, ctx);
438 q = p;
439 if(!ret) {
440 ASN1err(ASN1_F_ASN1_TEMPLATE_EX_D2I, ERR_R_NESTED_ASN1_ERROR);
441 return 0;
442 } else if(ret == -1) return -1;
443 if(!cst) {
444 ASN1err(ASN1_F_ASN1_TEMPLATE_EX_D2I, ASN1_R_EXPLICIT_TAG_NOT_CONSTRUCTED);
445 return 0;
446 }
447 /* We've found the field so it can't be OPTIONAL now */
448 ret = asn1_template_noexp_d2i(val, &p, len, tt, 0, ctx);
449 if(!ret) {
450 ASN1err(ASN1_F_ASN1_TEMPLATE_EX_D2I, ERR_R_NESTED_ASN1_ERROR);
451 return 0;
452 }
453 /* We read the field in OK so update length */
454 len -= p - q;
455 if(exp_eoc) {
456 /* If NDEF we must have an EOC here */
457 if(!asn1_check_eoc(&p, len)) {
458 ASN1err(ASN1_F_ASN1_TEMPLATE_D2I, ASN1_R_MISSING_EOC);
459 goto err;
460 }
461 } else {
462 /* Otherwise we must hit the EXPLICIT tag end or its an error */
463 if(len) {
464 ASN1err(ASN1_F_ASN1_TEMPLATE_D2I, ASN1_R_EXPLICIT_LENGTH_MISMATCH);
465 goto err;
466 }
467 }
468 } else
469 return asn1_template_noexp_d2i(val, in, inlen, tt, opt, ctx);
470
471 *in = p;
472 return 1;
473
474 err:
475 ASN1_template_free(val, tt);
476 *val = NULL;
477 return 0;
478}
479
480static int asn1_template_noexp_d2i(ASN1_VALUE **val, unsigned char **in, long len, const ASN1_TEMPLATE *tt, char opt, ASN1_TLC *ctx)
481{
482 int flags, aclass;
483 int ret;
484 unsigned char *p, *q;
485 if(!val) return 0;
486 flags = tt->flags;
487 aclass = flags & ASN1_TFLG_TAG_CLASS;
488
489 p = *in;
490 q = p;
491
492 if(flags & ASN1_TFLG_SK_MASK) {
493 /* SET OF, SEQUENCE OF */
494 int sktag, skaclass;
495 char sk_eoc;
496 /* First work out expected inner tag value */
497 if(flags & ASN1_TFLG_IMPTAG) {
498 sktag = tt->tag;
499 skaclass = aclass;
500 } else {
501 skaclass = V_ASN1_UNIVERSAL;
502 if(flags & ASN1_TFLG_SET_OF) sktag = V_ASN1_SET;
503 else sktag = V_ASN1_SEQUENCE;
504 }
505 /* Get the tag */
506 ret = asn1_check_tlen(&len, NULL, NULL, &sk_eoc, NULL, &p, len, sktag, skaclass, opt, ctx);
507 if(!ret) {
508 ASN1err(ASN1_F_ASN1_TEMPLATE_EX_D2I, ERR_R_NESTED_ASN1_ERROR);
509 return 0;
510 } else if(ret == -1) return -1;
511 if(!*val) *val = (ASN1_VALUE *)sk_new_null();
512 else {
513 /* We've got a valid STACK: free up any items present */
514 STACK *sktmp = (STACK *)*val;
515 ASN1_VALUE *vtmp;
516 while(sk_num(sktmp) > 0) {
517 vtmp = (ASN1_VALUE *)sk_pop(sktmp);
518 ASN1_item_ex_free(&vtmp, ASN1_ITEM_ptr(tt->item));
519 }
520 }
521
522 if(!*val) {
523 ASN1err(ASN1_F_ASN1_TEMPLATE_EX_D2I, ERR_R_MALLOC_FAILURE);
524 goto err;
525 }
526 /* Read as many items as we can */
527 while(len > 0) {
528 ASN1_VALUE *skfield;
529 q = p;
530 /* See if EOC found */
531 if(asn1_check_eoc(&p, len)) {
532 if(!sk_eoc) {
533 ASN1err(ASN1_F_ASN1_TEMPLATE_D2I, ASN1_R_UNEXPECTED_EOC);
534 goto err;
535 }
536 len -= p - q;
537 sk_eoc = 0;
538 break;
539 }
540 skfield = NULL;
541 if(!ASN1_item_ex_d2i(&skfield, &p, len, ASN1_ITEM_ptr(tt->item), -1, 0, 0, ctx)) {
542 ASN1err(ASN1_F_ASN1_TEMPLATE_D2I, ERR_R_NESTED_ASN1_ERROR);
543 goto err;
544 }
545 len -= p - q;
546 if(!sk_push((STACK *)*val, (char *)skfield)) {
547 ASN1err(ASN1_F_ASN1_TEMPLATE_D2I, ERR_R_MALLOC_FAILURE);
548 goto err;
549 }
550 }
551 if(sk_eoc) {
552 ASN1err(ASN1_F_ASN1_TEMPLATE_D2I, ASN1_R_MISSING_EOC);
553 goto err;
554 }
555 } else if(flags & ASN1_TFLG_IMPTAG) {
556 /* IMPLICIT tagging */
557 ret = ASN1_item_ex_d2i(val, &p, len, ASN1_ITEM_ptr(tt->item), tt->tag, aclass, opt, ctx);
558 if(!ret) {
559 ASN1err(ASN1_F_ASN1_TEMPLATE_D2I, ERR_R_NESTED_ASN1_ERROR);
560 goto err;
561 } else if(ret == -1) return -1;
562 } else {
563 /* Nothing special */
564 ret = ASN1_item_ex_d2i(val, &p, len, ASN1_ITEM_ptr(tt->item), -1, 0, opt, ctx);
565 if(!ret) {
566 ASN1err(ASN1_F_ASN1_TEMPLATE_D2I, ERR_R_NESTED_ASN1_ERROR);
567 goto err;
568 } else if(ret == -1) return -1;
569 }
570
571 *in = p;
572 return 1;
573
574 err:
575 ASN1_template_free(val, tt);
576 *val = NULL;
577 return 0;
578}
579
580static int asn1_d2i_ex_primitive(ASN1_VALUE **pval, unsigned char **in, long inlen,
581 const ASN1_ITEM *it,
582 int tag, int aclass, char opt, ASN1_TLC *ctx)
583{
584 int ret = 0, utype;
585 long plen;
586 char cst, inf, free_cont = 0;
587 unsigned char *p;
588 BUF_MEM buf;
589 unsigned char *cont = NULL;
590 long len;
591 if(!pval) {
592 ASN1err(ASN1_F_ASN1_D2I_EX_PRIMITIVE, ASN1_R_ILLEGAL_NULL);
593 return 0; /* Should never happen */
594 }
595
596 if(it->itype == ASN1_ITYPE_MSTRING) {
597 utype = tag;
598 tag = -1;
599 } else utype = it->utype;
600
601 if(utype == V_ASN1_ANY) {
602 /* If type is ANY need to figure out type from tag */
603 unsigned char oclass;
604 if(tag >= 0) {
605 ASN1err(ASN1_F_ASN1_D2I_EX_PRIMITIVE, ASN1_R_ILLEGAL_TAGGED_ANY);
606 return 0;
607 }
608 if(opt) {
609 ASN1err(ASN1_F_ASN1_D2I_EX_PRIMITIVE, ASN1_R_ILLEGAL_OPTIONAL_ANY);
610 return 0;
611 }
612 p = *in;
613 ret = asn1_check_tlen(NULL, &utype, &oclass, NULL, NULL, &p, inlen, -1, 0, 0, ctx);
614 if(!ret) {
615 ASN1err(ASN1_F_ASN1_D2I_EX_PRIMITIVE, ERR_R_NESTED_ASN1_ERROR);
616 return 0;
617 }
618 if(oclass != V_ASN1_UNIVERSAL) utype = V_ASN1_OTHER;
619 }
620 if(tag == -1) {
621 tag = utype;
622 aclass = V_ASN1_UNIVERSAL;
623 }
624 p = *in;
625 /* Check header */
626 ret = asn1_check_tlen(&plen, NULL, NULL, &inf, &cst, &p, inlen, tag, aclass, opt, ctx);
627 if(!ret) {
628 ASN1err(ASN1_F_ASN1_D2I_EX_PRIMITIVE, ERR_R_NESTED_ASN1_ERROR);
629 return 0;
630 } else if(ret == -1) return -1;
631 /* SEQUENCE, SET and "OTHER" are left in encoded form */
632 if((utype == V_ASN1_SEQUENCE) || (utype == V_ASN1_SET) || (utype == V_ASN1_OTHER)) {
633 /* Clear context cache for type OTHER because the auto clear when
634 * we have a exact match wont work
635 */
636 if(utype == V_ASN1_OTHER) {
637 asn1_tlc_clear(ctx);
638 /* SEQUENCE and SET must be constructed */
639 } else if(!cst) {
640 ASN1err(ASN1_F_ASN1_D2I_EX_PRIMITIVE, ASN1_R_TYPE_NOT_CONSTRUCTED);
641 return 0;
642 }
643
644 cont = *in;
645 /* If indefinite length constructed find the real end */
646 if(inf) {
647 if(!asn1_collect(NULL, &p, plen, inf, -1, -1)) goto err;
648 len = p - cont;
649 } else {
650 len = p - cont + plen;
651 p += plen;
652 buf.data = NULL;
653 }
654 } else if(cst) {
655 buf.length = 0;
656 buf.max = 0;
657 buf.data = NULL;
658 /* Should really check the internal tags are correct but
659 * some things may get this wrong. The relevant specs
660 * say that constructed string types should be OCTET STRINGs
661 * internally irrespective of the type. So instead just check
662 * for UNIVERSAL class and ignore the tag.
663 */
664 if(!asn1_collect(&buf, &p, plen, inf, -1, V_ASN1_UNIVERSAL)) goto err;
665 len = buf.length;
666 /* Append a final null to string */
667 if(!BUF_MEM_grow(&buf, len + 1)) {
668 ASN1err(ASN1_F_ASN1_D2I_EX_PRIMITIVE, ERR_R_MALLOC_FAILURE);
669 return 0;
670 }
671 buf.data[len] = 0;
672 cont = (unsigned char *)buf.data;
673 free_cont = 1;
674 } else {
675 cont = p;
676 len = plen;
677 p += plen;
678 }
679
680 /* We now have content length and type: translate into a structure */
681 if(!asn1_ex_c2i(pval, cont, len, utype, &free_cont, it)) goto err;
682
683 *in = p;
684 ret = 1;
685 err:
686 if(free_cont && buf.data) OPENSSL_free(buf.data);
687 return ret;
688}
689
690/* Translate ASN1 content octets into a structure */
691
692int asn1_ex_c2i(ASN1_VALUE **pval, unsigned char *cont, int len, int utype, char *free_cont, const ASN1_ITEM *it)
693{
694 ASN1_STRING *stmp;
695 ASN1_TYPE *typ = NULL;
696 int ret = 0;
697 const ASN1_PRIMITIVE_FUNCS *pf;
698 ASN1_INTEGER **tint;
699 pf = it->funcs;
700 if(pf && pf->prim_c2i) return pf->prim_c2i(pval, cont, len, utype, free_cont, it);
701 /* If ANY type clear type and set pointer to internal value */
702 if(it->utype == V_ASN1_ANY) {
703 if(!*pval) {
704 typ = ASN1_TYPE_new();
705 *pval = (ASN1_VALUE *)typ;
706 } else typ = (ASN1_TYPE *)*pval;
707 if(utype != typ->type) ASN1_TYPE_set(typ, utype, NULL);
708 pval = (ASN1_VALUE **)&typ->value.ptr;
709 }
710 switch(utype) {
711 case V_ASN1_OBJECT:
712 if(!c2i_ASN1_OBJECT((ASN1_OBJECT **)pval, &cont, len)) goto err;
713 break;
714
715 case V_ASN1_NULL:
716 if(len) {
717 ASN1err(ASN1_F_ASN1_D2I_EX_PRIMITIVE, ASN1_R_NULL_IS_WRONG_LENGTH);
718 goto err;
719 }
720 *pval = (ASN1_VALUE *)1;
721 break;
722
723 case V_ASN1_BOOLEAN:
724 if(len != 1) {
725 ASN1err(ASN1_F_ASN1_D2I_EX_PRIMITIVE, ASN1_R_BOOLEAN_IS_WRONG_LENGTH);
726 goto err;
727 } else {
728 ASN1_BOOLEAN *tbool;
729 tbool = (ASN1_BOOLEAN *)pval;
730 *tbool = *cont;
731 }
732 break;
733
734 case V_ASN1_BIT_STRING:
735 if(!c2i_ASN1_BIT_STRING((ASN1_BIT_STRING **)pval, &cont, len)) goto err;
736 break;
737
738 case V_ASN1_INTEGER:
739 case V_ASN1_NEG_INTEGER:
740 case V_ASN1_ENUMERATED:
741 case V_ASN1_NEG_ENUMERATED:
742 tint = (ASN1_INTEGER **)pval;
743 if(!c2i_ASN1_INTEGER(tint, &cont, len)) goto err;
744 /* Fixup type to match the expected form */
745 (*tint)->type = utype | ((*tint)->type & V_ASN1_NEG);
746 break;
747
748 case V_ASN1_OCTET_STRING:
749 case V_ASN1_NUMERICSTRING:
750 case V_ASN1_PRINTABLESTRING:
751 case V_ASN1_T61STRING:
752 case V_ASN1_VIDEOTEXSTRING:
753 case V_ASN1_IA5STRING:
754 case V_ASN1_UTCTIME:
755 case V_ASN1_GENERALIZEDTIME:
756 case V_ASN1_GRAPHICSTRING:
757 case V_ASN1_VISIBLESTRING:
758 case V_ASN1_GENERALSTRING:
759 case V_ASN1_UNIVERSALSTRING:
760 case V_ASN1_BMPSTRING:
761 case V_ASN1_UTF8STRING:
762 case V_ASN1_OTHER:
763 case V_ASN1_SET:
764 case V_ASN1_SEQUENCE:
765 default:
766 /* All based on ASN1_STRING and handled the same */
767 if(!*pval) {
768 stmp = ASN1_STRING_type_new(utype);
769 if(!stmp) {
770 ASN1err(ASN1_F_ASN1_D2I_EX_PRIMITIVE, ERR_R_MALLOC_FAILURE);
771 goto err;
772 }
773 *pval = (ASN1_VALUE *)stmp;
774 } else {
775 stmp = (ASN1_STRING *)*pval;
776 stmp->type = utype;
777 }
778 /* If we've already allocated a buffer use it */
779 if(*free_cont) {
780 if(stmp->data) OPENSSL_free(stmp->data);
781 stmp->data = cont;
782 stmp->length = len;
783 *free_cont = 0;
784 } else {
785 if(!ASN1_STRING_set(stmp, cont, len)) {
786 ASN1err(ASN1_F_ASN1_D2I_EX_PRIMITIVE, ERR_R_MALLOC_FAILURE);
787 ASN1_STRING_free(stmp);
788 *pval = NULL;
789 goto err;
790 }
791 }
792 break;
793 }
794 /* If ASN1_ANY and NULL type fix up value */
795 if(typ && utype==V_ASN1_NULL) typ->value.ptr = NULL;
796
797 ret = 1;
798 err:
799 if(!ret) ASN1_TYPE_free(typ);
800 return ret;
801}
802
803/* This function collects the asn1 data from a constructred string
804 * type into a buffer. The values of 'in' and 'len' should refer
805 * to the contents of the constructed type and 'inf' should be set
806 * if it is indefinite length. If 'buf' is NULL then we just want
807 * to find the end of the current structure: useful for indefinite
808 * length constructed stuff.
809 */
810
811static int asn1_collect(BUF_MEM *buf, unsigned char **in, long len, char inf, int tag, int aclass)
812{
813 unsigned char *p, *q;
814 long plen;
815 char cst, ininf;
816 p = *in;
817 inf &= 1;
818 /* If no buffer and not indefinite length constructed just pass over the encoded data */
819 if(!buf && !inf) {
820 *in += len;
821 return 1;
822 }
823 while(len > 0) {
824 q = p;
825 /* Check for EOC */
826 if(asn1_check_eoc(&p, len)) {
827 /* EOC is illegal outside indefinite length constructed form */
828 if(!inf) {
829 ASN1err(ASN1_F_ASN1_COLLECT, ASN1_R_UNEXPECTED_EOC);
830 return 0;
831 }
832 inf = 0;
833 break;
834 }
835 if(!asn1_check_tlen(&plen, NULL, NULL, &ininf, &cst, &p, len, tag, aclass, 0, NULL)) {
836 ASN1err(ASN1_F_ASN1_COLLECT, ERR_R_NESTED_ASN1_ERROR);
837 return 0;
838 }
839 /* If indefinite length constructed update max length */
840 if(cst) {
841 if(!asn1_collect(buf, &p, plen, ininf, tag, aclass)) return 0;
842 } else {
843 if(!collect_data(buf, &p, plen)) return 0;
844 }
845 len -= p - q;
846 }
847 if(inf) {
848 ASN1err(ASN1_F_ASN1_COLLECT, ASN1_R_MISSING_EOC);
849 return 0;
850 }
851 *in = p;
852 return 1;
853}
854
855static int collect_data(BUF_MEM *buf, unsigned char **p, long plen)
856{
857 int len;
858 if(buf) {
859 len = buf->length;
860 if(!BUF_MEM_grow(buf, len + plen)) {
861 ASN1err(ASN1_F_COLLECT_DATA, ERR_R_MALLOC_FAILURE);
862 return 0;
863 }
864 memcpy(buf->data + len, *p, plen);
865 }
866 *p += plen;
867 return 1;
868}
869
870/* Check for ASN1 EOC and swallow it if found */
871
872static int asn1_check_eoc(unsigned char **in, long len)
873{
874 unsigned char *p;
875 if(len < 2) return 0;
876 p = *in;
877 if(!p[0] && !p[1]) {
878 *in += 2;
879 return 1;
880 }
881 return 0;
882}
883
884/* Check an ASN1 tag and length: a bit like ASN1_get_object
885 * but it sets the length for indefinite length constructed
886 * form, we don't know the exact length but we can set an
887 * upper bound to the amount of data available minus the
888 * header length just read.
889 */
890
891static int asn1_check_tlen(long *olen, int *otag, unsigned char *oclass, char *inf, char *cst,
892 unsigned char **in, long len, int exptag, int expclass, char opt, ASN1_TLC *ctx)
893{
894 int i;
895 int ptag, pclass;
896 long plen;
897 unsigned char *p, *q;
898 p = *in;
899 q = p;
900
901 if(ctx && ctx->valid) {
902 i = ctx->ret;
903 plen = ctx->plen;
904 pclass = ctx->pclass;
905 ptag = ctx->ptag;
906 p += ctx->hdrlen;
907 } else {
908 i = ASN1_get_object(&p, &plen, &ptag, &pclass, len);
909 if(ctx) {
910 ctx->ret = i;
911 ctx->plen = plen;
912 ctx->pclass = pclass;
913 ctx->ptag = ptag;
914 ctx->hdrlen = p - q;
915 ctx->valid = 1;
916 /* If definite length, length + header can't exceed total
917 * amount of data available.
918 */
919 if(!(i & 1) && ((plen + ctx->hdrlen) > len)) {
920 ASN1err(ASN1_F_ASN1_CHECK_TLEN, ASN1_R_TOO_LONG);
921 asn1_tlc_clear(ctx);
922 return 0;
923 }
924 }
925 }
926
927 if(i & 0x80) {
928 ASN1err(ASN1_F_ASN1_CHECK_TLEN, ASN1_R_BAD_OBJECT_HEADER);
929 asn1_tlc_clear(ctx);
930 return 0;
931 }
932 if(exptag >= 0) {
933 if((exptag != ptag) || (expclass != pclass)) {
934 /* If type is OPTIONAL, not an error, but indicate missing
935 * type.
936 */
937 if(opt) return -1;
938 asn1_tlc_clear(ctx);
939 ASN1err(ASN1_F_ASN1_CHECK_TLEN, ASN1_R_WRONG_TAG);
940 return 0;
941 }
942 /* We have a tag and class match, so assume we are going to do something with it */
943 asn1_tlc_clear(ctx);
944 }
945
946 if(i & 1) plen = len - (p - q);
947
948 if(inf) *inf = i & 1;
949
950 if(cst) *cst = i & V_ASN1_CONSTRUCTED;
951
952 if(olen) *olen = plen;
953 if(oclass) *oclass = pclass;
954 if(otag) *otag = ptag;
955
956 *in = p;
957 return 1;
958}
diff --git a/src/lib/libcrypto/asn1/tasn_enc.c b/src/lib/libcrypto/asn1/tasn_enc.c
new file mode 100644
index 0000000000..f6c8ddef0a
--- /dev/null
+++ b/src/lib/libcrypto/asn1/tasn_enc.c
@@ -0,0 +1,497 @@
1/* tasn_enc.c */
2/* Written by Dr Stephen N Henson (shenson@bigfoot.com) for the OpenSSL
3 * project 2000.
4 */
5/* ====================================================================
6 * Copyright (c) 2000 The OpenSSL Project. All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 *
12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 *
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in
17 * the documentation and/or other materials provided with the
18 * distribution.
19 *
20 * 3. All advertising materials mentioning features or use of this
21 * software must display the following acknowledgment:
22 * "This product includes software developed by the OpenSSL Project
23 * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
24 *
25 * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
26 * endorse or promote products derived from this software without
27 * prior written permission. For written permission, please contact
28 * licensing@OpenSSL.org.
29 *
30 * 5. Products derived from this software may not be called "OpenSSL"
31 * nor may "OpenSSL" appear in their names without prior written
32 * permission of the OpenSSL Project.
33 *
34 * 6. Redistributions of any form whatsoever must retain the following
35 * acknowledgment:
36 * "This product includes software developed by the OpenSSL Project
37 * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
38 *
39 * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
40 * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
41 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
42 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
43 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
44 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
45 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
46 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
47 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
48 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
49 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
50 * OF THE POSSIBILITY OF SUCH DAMAGE.
51 * ====================================================================
52 *
53 * This product includes cryptographic software written by Eric Young
54 * (eay@cryptsoft.com). This product includes software written by Tim
55 * Hudson (tjh@cryptsoft.com).
56 *
57 */
58
59
60#include <stddef.h>
61#include <string.h>
62#include <openssl/asn1.h>
63#include <openssl/asn1t.h>
64#include <openssl/objects.h>
65
66static int asn1_i2d_ex_primitive(ASN1_VALUE **pval, unsigned char **out, const ASN1_ITEM *it, int tag, int aclass);
67static int asn1_set_seq_out(STACK_OF(ASN1_VALUE) *seq, unsigned char **out, int skcontlen, const ASN1_ITEM *item, int isset);
68
69/* Encode an ASN1 item, this is compatible with the
70 * standard 'i2d' function. 'out' points 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.
75 *
76 * The new i2d has one additional feature. If the output
77 * buffer is NULL (i.e. *out == NULL) then a buffer is
78 * allocated and populated with the encoding.
79 */
80
81
82int ASN1_item_i2d(ASN1_VALUE *val, unsigned char **out, const ASN1_ITEM *it)
83{
84 if(out && !*out) {
85 unsigned char *p, *buf;
86 int len;
87 len = ASN1_item_ex_i2d(&val, NULL, it, -1, 0);
88 if(len <= 0) return len;
89 buf = OPENSSL_malloc(len);
90 if(!buf) return -1;
91 p = buf;
92 ASN1_item_ex_i2d(&val, &p, it, -1, 0);
93 *out = buf;
94 return len;
95 }
96
97 return ASN1_item_ex_i2d(&val, out, it, -1, 0);
98}
99
100/* Encode an item, taking care of IMPLICIT tagging (if any).
101 * This function performs the normal item handling: it can be
102 * used in external types.
103 */
104
105int ASN1_item_ex_i2d(ASN1_VALUE **pval, unsigned char **out, const ASN1_ITEM *it, int tag, int aclass)
106{
107 const ASN1_TEMPLATE *tt = NULL;
108 unsigned char *p = NULL;
109 int i, seqcontlen, seqlen;
110 ASN1_STRING *strtmp;
111 const ASN1_COMPAT_FUNCS *cf;
112 const ASN1_EXTERN_FUNCS *ef;
113 const ASN1_AUX *aux = it->funcs;
114 ASN1_aux_cb *asn1_cb;
115 if((it->itype != ASN1_ITYPE_PRIMITIVE) && !*pval) return 0;
116 if(aux && aux->asn1_cb) asn1_cb = aux->asn1_cb;
117 else asn1_cb = 0;
118
119 switch(it->itype) {
120
121 case ASN1_ITYPE_PRIMITIVE:
122 if(it->templates)
123 return ASN1_template_i2d(pval, out, it->templates);
124 return asn1_i2d_ex_primitive(pval, out, it, tag, aclass);
125 break;
126
127 case ASN1_ITYPE_MSTRING:
128 strtmp = (ASN1_STRING *)*pval;
129 return asn1_i2d_ex_primitive(pval, out, it, -1, 0);
130
131 case ASN1_ITYPE_CHOICE:
132 if(asn1_cb && !asn1_cb(ASN1_OP_I2D_PRE, pval, it))
133 return 0;
134 i = asn1_get_choice_selector(pval, it);
135 if((i >= 0) && (i < it->tcount)) {
136 ASN1_VALUE **pchval;
137 const ASN1_TEMPLATE *chtt;
138 chtt = it->templates + i;
139 pchval = asn1_get_field_ptr(pval, chtt);
140 return ASN1_template_i2d(pchval, out, chtt);
141 }
142 /* Fixme: error condition if selector out of range */
143 if(asn1_cb && !asn1_cb(ASN1_OP_I2D_POST, pval, it))
144 return 0;
145 break;
146
147 case ASN1_ITYPE_EXTERN:
148 /* If new style i2d it does all the work */
149 ef = it->funcs;
150 return ef->asn1_ex_i2d(pval, out, it, tag, aclass);
151
152 case ASN1_ITYPE_COMPAT:
153 /* old style hackery... */
154 cf = it->funcs;
155 if(out) p = *out;
156 i = cf->asn1_i2d(*pval, out);
157 /* Fixup for IMPLICIT tag: note this messes up for tags > 30,
158 * but so did the old code. Tags > 30 are very rare anyway.
159 */
160 if(out && (tag != -1))
161 *p = aclass | tag | (*p & V_ASN1_CONSTRUCTED);
162 return i;
163
164 case ASN1_ITYPE_SEQUENCE:
165 i = asn1_enc_restore(&seqcontlen, out, pval, it);
166 /* An error occurred */
167 if(i < 0) return 0;
168 /* We have a valid cached encoding... */
169 if(i > 0) return seqcontlen;
170 /* Otherwise carry on */
171 seqcontlen = 0;
172 /* If no IMPLICIT tagging set to SEQUENCE, UNIVERSAL */
173 if(tag == -1) {
174 tag = V_ASN1_SEQUENCE;
175 aclass = V_ASN1_UNIVERSAL;
176 }
177 if(asn1_cb && !asn1_cb(ASN1_OP_I2D_PRE, pval, it))
178 return 0;
179 /* First work out sequence content length */
180 for(i = 0, tt = it->templates; i < it->tcount; tt++, i++) {
181 const ASN1_TEMPLATE *seqtt;
182 ASN1_VALUE **pseqval;
183 seqtt = asn1_do_adb(pval, tt, 1);
184 if(!seqtt) return 0;
185 pseqval = asn1_get_field_ptr(pval, seqtt);
186 /* FIXME: check for errors in enhanced version */
187 /* FIXME: special handling of indefinite length encoding */
188 seqcontlen += ASN1_template_i2d(pseqval, NULL, seqtt);
189 }
190 seqlen = ASN1_object_size(1, seqcontlen, tag);
191 if(!out) return seqlen;
192 /* Output SEQUENCE header */
193 ASN1_put_object(out, 1, seqcontlen, tag, aclass);
194 for(i = 0, tt = it->templates; i < it->tcount; tt++, i++) {
195 const ASN1_TEMPLATE *seqtt;
196 ASN1_VALUE **pseqval;
197 seqtt = asn1_do_adb(pval, tt, 1);
198 if(!seqtt) return 0;
199 pseqval = asn1_get_field_ptr(pval, seqtt);
200 /* FIXME: check for errors in enhanced version */
201 ASN1_template_i2d(pseqval, out, seqtt);
202 }
203 if(asn1_cb && !asn1_cb(ASN1_OP_I2D_POST, pval, it))
204 return 0;
205 return seqlen;
206
207 default:
208 return 0;
209 }
210 return 0;
211}
212
213int ASN1_template_i2d(ASN1_VALUE **pval, unsigned char **out, const ASN1_TEMPLATE *tt)
214{
215 int i, ret, flags, aclass;
216 flags = tt->flags;
217 aclass = flags & ASN1_TFLG_TAG_CLASS;
218 if(flags & ASN1_TFLG_SK_MASK) {
219 /* SET OF, SEQUENCE OF */
220 STACK_OF(ASN1_VALUE) *sk = (STACK_OF(ASN1_VALUE) *)*pval;
221 int isset, sktag, skaclass;
222 int skcontlen, sklen;
223 ASN1_VALUE *skitem;
224 if(!*pval) return 0;
225 if(flags & ASN1_TFLG_SET_OF) {
226 isset = 1;
227 /* 2 means we reorder */
228 if(flags & ASN1_TFLG_SEQUENCE_OF) isset = 2;
229 } else isset = 0;
230 /* First work out inner tag value */
231 if(flags & ASN1_TFLG_IMPTAG) {
232 sktag = tt->tag;
233 skaclass = aclass;
234 } else {
235 skaclass = V_ASN1_UNIVERSAL;
236 if(isset) sktag = V_ASN1_SET;
237 else sktag = V_ASN1_SEQUENCE;
238 }
239 /* Now work out length of items */
240 skcontlen = 0;
241 for(i = 0; i < sk_ASN1_VALUE_num(sk); i++) {
242 skitem = sk_ASN1_VALUE_value(sk, i);
243 skcontlen += ASN1_item_ex_i2d(&skitem, NULL, ASN1_ITEM_ptr(tt->item), -1, 0);
244 }
245 sklen = ASN1_object_size(1, skcontlen, sktag);
246 /* If EXPLICIT need length of surrounding tag */
247 if(flags & ASN1_TFLG_EXPTAG)
248 ret = ASN1_object_size(1, sklen, tt->tag);
249 else ret = sklen;
250
251 if(!out) return ret;
252
253 /* Now encode this lot... */
254 /* EXPLICIT tag */
255 if(flags & ASN1_TFLG_EXPTAG)
256 ASN1_put_object(out, 1, sklen, tt->tag, aclass);
257 /* SET or SEQUENCE and IMPLICIT tag */
258 ASN1_put_object(out, 1, skcontlen, sktag, skaclass);
259 /* And finally the stuff itself */
260 asn1_set_seq_out(sk, out, skcontlen, ASN1_ITEM_ptr(tt->item), isset);
261
262 return ret;
263 }
264
265 if(flags & ASN1_TFLG_EXPTAG) {
266 /* EXPLICIT tagging */
267 /* Find length of tagged item */
268 i = ASN1_item_ex_i2d(pval, NULL, ASN1_ITEM_ptr(tt->item), -1, 0);
269 if(!i) return 0;
270 /* Find length of EXPLICIT tag */
271 ret = ASN1_object_size(1, i, tt->tag);
272 if(out) {
273 /* Output tag and item */
274 ASN1_put_object(out, 1, i, tt->tag, aclass);
275 ASN1_item_ex_i2d(pval, out, ASN1_ITEM_ptr(tt->item), -1, 0);
276 }
277 return ret;
278 }
279 if(flags & ASN1_TFLG_IMPTAG) {
280 /* IMPLICIT tagging */
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);
285}
286
287/* Temporary structure used to hold DER encoding of items for SET OF */
288
289typedef struct {
290 unsigned char *data;
291 int length;
292 ASN1_VALUE *field;
293} DER_ENC;
294
295static int der_cmp(const void *a, const void *b)
296{
297 const DER_ENC *d1 = a, *d2 = b;
298 int cmplen, i;
299 cmplen = (d1->length < d2->length) ? d1->length : d2->length;
300 i = memcmp(d1->data, d2->data, cmplen);
301 if(i) return i;
302 return d1->length - d2->length;
303}
304
305/* Output the content octets of SET OF or SEQUENCE OF */
306
307static int asn1_set_seq_out(STACK_OF(ASN1_VALUE) *sk, unsigned char **out, int skcontlen, const ASN1_ITEM *item, int do_sort)
308{
309 int i;
310 ASN1_VALUE *skitem;
311 unsigned char *tmpdat = NULL, *p = NULL;
312 DER_ENC *derlst = NULL, *tder;
313 if(do_sort) {
314 /* Don't need to sort less than 2 items */
315 if(sk_ASN1_VALUE_num(sk) < 2) do_sort = 0;
316 else {
317 derlst = OPENSSL_malloc(sk_ASN1_VALUE_num(sk) * sizeof(*derlst));
318 tmpdat = OPENSSL_malloc(skcontlen);
319 if(!derlst || !tmpdat) return 0;
320 }
321 }
322 /* If not sorting just output each item */
323 if(!do_sort) {
324 for(i = 0; i < sk_ASN1_VALUE_num(sk); i++) {
325 skitem = sk_ASN1_VALUE_value(sk, i);
326 ASN1_item_i2d(skitem, out, item);
327 }
328 return 1;
329 }
330 p = tmpdat;
331 /* Doing sort: build up a list of each member's DER encoding */
332 for(i = 0, tder = derlst; i < sk_ASN1_VALUE_num(sk); i++, tder++) {
333 skitem = sk_ASN1_VALUE_value(sk, i);
334 tder->data = p;
335 tder->length = ASN1_item_i2d(skitem, &p, item);
336 tder->field = skitem;
337 }
338 /* Now sort them */
339 qsort(derlst, sk_ASN1_VALUE_num(sk), sizeof(*derlst), der_cmp);
340 /* Output sorted DER encoding */
341 p = *out;
342 for(i = 0, tder = derlst; i < sk_ASN1_VALUE_num(sk); i++, tder++) {
343 memcpy(p, tder->data, tder->length);
344 p += tder->length;
345 }
346 *out = p;
347 /* If do_sort is 2 then reorder the STACK */
348 if(do_sort == 2) {
349 for(i = 0, tder = derlst; i < sk_ASN1_VALUE_num(sk); i++, tder++)
350 sk_ASN1_VALUE_set(sk, i, tder->field);
351 }
352 OPENSSL_free(derlst);
353 OPENSSL_free(tmpdat);
354 return 1;
355}
356
357static int asn1_i2d_ex_primitive(ASN1_VALUE **pval, unsigned char **out, const ASN1_ITEM *it, int tag, int aclass)
358{
359 int len;
360 int utype;
361 int usetag;
362
363 utype = it->utype;
364
365 /* Get length of content octets and maybe find
366 * out the underlying type.
367 */
368
369 len = asn1_ex_i2c(pval, NULL, &utype, it);
370
371 /* If SEQUENCE, SET or OTHER then header is
372 * included in pseudo content octets so don't
373 * include tag+length. We need to check here
374 * because the call to asn1_ex_i2c() could change
375 * utype.
376 */
377 if((utype == V_ASN1_SEQUENCE) || (utype == V_ASN1_SET) ||
378 (utype == V_ASN1_OTHER))
379 usetag = 0;
380 else usetag = 1;
381
382 /* -1 means omit type */
383
384 if(len == -1) return 0;
385
386 /* If not implicitly tagged get tag from underlying type */
387 if(tag == -1) tag = utype;
388
389 /* Output tag+length followed by content octets */
390 if(out) {
391 if(usetag) ASN1_put_object(out, 0, len, tag, aclass);
392 asn1_ex_i2c(pval, *out, &utype, it);
393 *out += len;
394 }
395
396 if(usetag) return ASN1_object_size(0, len, tag);
397 return len;
398}
399
400/* Produce content octets from a structure */
401
402int asn1_ex_i2c(ASN1_VALUE **pval, unsigned char *cout, int *putype, const ASN1_ITEM *it)
403{
404 ASN1_BOOLEAN *tbool = NULL;
405 ASN1_STRING *strtmp;
406 ASN1_OBJECT *otmp;
407 int utype;
408 unsigned char *cont, c;
409 int len;
410 const ASN1_PRIMITIVE_FUNCS *pf;
411 pf = it->funcs;
412 if(pf && pf->prim_i2c) return pf->prim_i2c(pval, cout, putype, it);
413
414 /* Should type be omitted? */
415 if((it->itype != ASN1_ITYPE_PRIMITIVE) || (it->utype != V_ASN1_BOOLEAN)) {
416 if(!*pval) return -1;
417 }
418
419 if(it->itype == ASN1_ITYPE_MSTRING) {
420 /* If MSTRING type set the underlying type */
421 strtmp = (ASN1_STRING *)*pval;
422 utype = strtmp->type;
423 *putype = utype;
424 } else if(it->utype == V_ASN1_ANY) {
425 /* If ANY set type and pointer to value */
426 ASN1_TYPE *typ;
427 typ = (ASN1_TYPE *)*pval;
428 utype = typ->type;
429 *putype = utype;
430 pval = (ASN1_VALUE **)&typ->value.ptr;
431 } else utype = *putype;
432
433 switch(utype) {
434 case V_ASN1_OBJECT:
435 otmp = (ASN1_OBJECT *)*pval;
436 cont = otmp->data;
437 len = otmp->length;
438 break;
439
440 case V_ASN1_NULL:
441 cont = NULL;
442 len = 0;
443 break;
444
445 case V_ASN1_BOOLEAN:
446 tbool = (ASN1_BOOLEAN *)pval;
447 if(*tbool == -1) return -1;
448 /* Default handling if value == size field then omit */
449 if(*tbool && (it->size > 0)) return -1;
450 if(!*tbool && !it->size) return -1;
451 c = (unsigned char)*tbool;
452 cont = &c;
453 len = 1;
454 break;
455
456 case V_ASN1_BIT_STRING:
457 return i2c_ASN1_BIT_STRING((ASN1_BIT_STRING *)*pval, cout ? &cout : NULL);
458 break;
459
460 case V_ASN1_INTEGER:
461 case V_ASN1_NEG_INTEGER:
462 case V_ASN1_ENUMERATED:
463 case V_ASN1_NEG_ENUMERATED:
464 /* These are all have the same content format
465 * as ASN1_INTEGER
466 */
467 return i2c_ASN1_INTEGER((ASN1_INTEGER *)*pval, cout ? &cout : NULL);
468 break;
469
470 case V_ASN1_OCTET_STRING:
471 case V_ASN1_NUMERICSTRING:
472 case V_ASN1_PRINTABLESTRING:
473 case V_ASN1_T61STRING:
474 case V_ASN1_VIDEOTEXSTRING:
475 case V_ASN1_IA5STRING:
476 case V_ASN1_UTCTIME:
477 case V_ASN1_GENERALIZEDTIME:
478 case V_ASN1_GRAPHICSTRING:
479 case V_ASN1_VISIBLESTRING:
480 case V_ASN1_GENERALSTRING:
481 case V_ASN1_UNIVERSALSTRING:
482 case V_ASN1_BMPSTRING:
483 case V_ASN1_UTF8STRING:
484 case V_ASN1_SEQUENCE:
485 case V_ASN1_SET:
486 default:
487 /* All based on ASN1_STRING and handled the same */
488 strtmp = (ASN1_STRING *)*pval;
489 cont = strtmp->data;
490 len = strtmp->length;
491
492 break;
493
494 }
495 if(cout && len) memcpy(cout, cont, len);
496 return len;
497}
diff --git a/src/lib/libcrypto/asn1/tasn_fre.c b/src/lib/libcrypto/asn1/tasn_fre.c
new file mode 100644
index 0000000000..c7610776f2
--- /dev/null
+++ b/src/lib/libcrypto/asn1/tasn_fre.c
@@ -0,0 +1,226 @@
1/* tasn_fre.c */
2/* Written by Dr Stephen N Henson (shenson@bigfoot.com) for the OpenSSL
3 * project 2000.
4 */
5/* ====================================================================
6 * Copyright (c) 2000 The OpenSSL Project. All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 *
12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 *
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in
17 * the documentation and/or other materials provided with the
18 * distribution.
19 *
20 * 3. All advertising materials mentioning features or use of this
21 * software must display the following acknowledgment:
22 * "This product includes software developed by the OpenSSL Project
23 * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
24 *
25 * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
26 * endorse or promote products derived from this software without
27 * prior written permission. For written permission, please contact
28 * licensing@OpenSSL.org.
29 *
30 * 5. Products derived from this software may not be called "OpenSSL"
31 * nor may "OpenSSL" appear in their names without prior written
32 * permission of the OpenSSL Project.
33 *
34 * 6. Redistributions of any form whatsoever must retain the following
35 * acknowledgment:
36 * "This product includes software developed by the OpenSSL Project
37 * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
38 *
39 * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
40 * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
41 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
42 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
43 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
44 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
45 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
46 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
47 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
48 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
49 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
50 * OF THE POSSIBILITY OF SUCH DAMAGE.
51 * ====================================================================
52 *
53 * This product includes cryptographic software written by Eric Young
54 * (eay@cryptsoft.com). This product includes software written by Tim
55 * Hudson (tjh@cryptsoft.com).
56 *
57 */
58
59
60#include <stddef.h>
61#include <openssl/asn1.h>
62#include <openssl/asn1t.h>
63#include <openssl/objects.h>
64
65static void asn1_item_combine_free(ASN1_VALUE **pval, const ASN1_ITEM *it, int combine);
66
67/* Free up an ASN1 structure */
68
69void ASN1_item_free(ASN1_VALUE *val, const ASN1_ITEM *it)
70{
71 asn1_item_combine_free(&val, it, 0);
72}
73
74void ASN1_item_ex_free(ASN1_VALUE **pval, const ASN1_ITEM *it)
75{
76 asn1_item_combine_free(pval, it, 0);
77}
78
79static void asn1_item_combine_free(ASN1_VALUE **pval, const ASN1_ITEM *it, int combine)
80{
81 const ASN1_TEMPLATE *tt = NULL, *seqtt;
82 const ASN1_EXTERN_FUNCS *ef;
83 const ASN1_COMPAT_FUNCS *cf;
84 const ASN1_AUX *aux = it->funcs;
85 ASN1_aux_cb *asn1_cb;
86 int i;
87 if(!pval) return;
88 if((it->itype != ASN1_ITYPE_PRIMITIVE) && !*pval) return;
89 if(aux && aux->asn1_cb) asn1_cb = aux->asn1_cb;
90 else asn1_cb = 0;
91
92 switch(it->itype) {
93
94 case ASN1_ITYPE_PRIMITIVE:
95 if(it->templates) ASN1_template_free(pval, it->templates);
96 else ASN1_primitive_free(pval, it);
97 break;
98
99 case ASN1_ITYPE_MSTRING:
100 ASN1_primitive_free(pval, it);
101 break;
102
103 case ASN1_ITYPE_CHOICE:
104 if(asn1_cb) {
105 i = asn1_cb(ASN1_OP_FREE_PRE, pval, it);
106 if(i == 2) return;
107 }
108 i = asn1_get_choice_selector(pval, it);
109 if(asn1_cb) asn1_cb(ASN1_OP_FREE_PRE, pval, it);
110 if((i >= 0) && (i < it->tcount)) {
111 ASN1_VALUE **pchval;
112 tt = it->templates + i;
113 pchval = asn1_get_field_ptr(pval, tt);
114 ASN1_template_free(pchval, tt);
115 }
116 if(asn1_cb) asn1_cb(ASN1_OP_FREE_POST, pval, it);
117 if(!combine) {
118 OPENSSL_free(*pval);
119 *pval = NULL;
120 }
121 break;
122
123 case ASN1_ITYPE_COMPAT:
124 cf = it->funcs;
125 if(cf && cf->asn1_free) cf->asn1_free(*pval);
126 break;
127
128 case ASN1_ITYPE_EXTERN:
129 ef = it->funcs;
130 if(ef && ef->asn1_ex_free) ef->asn1_ex_free(pval, it);
131 break;
132
133 case ASN1_ITYPE_SEQUENCE:
134 if(asn1_do_lock(pval, -1, it) > 0) return;
135 if(asn1_cb) {
136 i = asn1_cb(ASN1_OP_FREE_PRE, pval, it);
137 if(i == 2) return;
138 }
139 asn1_enc_free(pval, it);
140 /* If we free up as normal we will invalidate any
141 * ANY DEFINED BY field and we wont be able to
142 * determine the type of the field it defines. So
143 * free up in reverse order.
144 */
145 tt = it->templates + it->tcount - 1;
146 for(i = 0; i < it->tcount; tt--, i++) {
147 ASN1_VALUE **pseqval;
148 seqtt = asn1_do_adb(pval, tt, 0);
149 if(!seqtt) continue;
150 pseqval = asn1_get_field_ptr(pval, seqtt);
151 ASN1_template_free(pseqval, seqtt);
152 }
153 if(asn1_cb) asn1_cb(ASN1_OP_FREE_POST, pval, it);
154 if(!combine) {
155 OPENSSL_free(*pval);
156 *pval = NULL;
157 }
158 break;
159 }
160}
161
162void ASN1_template_free(ASN1_VALUE **pval, const ASN1_TEMPLATE *tt)
163{
164 int i;
165 if(tt->flags & ASN1_TFLG_SK_MASK) {
166 STACK_OF(ASN1_VALUE) *sk = (STACK_OF(ASN1_VALUE) *)*pval;
167 for(i = 0; i < sk_ASN1_VALUE_num(sk); i++) {
168 ASN1_VALUE *vtmp;
169 vtmp = sk_ASN1_VALUE_value(sk, i);
170 asn1_item_combine_free(&vtmp, ASN1_ITEM_ptr(tt->item), 0);
171 }
172 sk_ASN1_VALUE_free(sk);
173 *pval = NULL;
174 } else asn1_item_combine_free(pval, ASN1_ITEM_ptr(tt->item),
175 tt->flags & ASN1_TFLG_COMBINE);
176}
177
178void ASN1_primitive_free(ASN1_VALUE **pval, const ASN1_ITEM *it)
179{
180 int utype;
181 if(it) {
182 const ASN1_PRIMITIVE_FUNCS *pf;
183 pf = it->funcs;
184 if(pf && pf->prim_free) {
185 pf->prim_free(pval, it);
186 return;
187 }
188 }
189 /* Special case: if 'it' is NULL free contents of ASN1_TYPE */
190 if(!it) {
191 ASN1_TYPE *typ = (ASN1_TYPE *)*pval;
192 utype = typ->type;
193 pval = (ASN1_VALUE **)&typ->value.ptr;
194 if(!*pval) return;
195 } else if(it->itype == ASN1_ITYPE_MSTRING) {
196 utype = -1;
197 if(!*pval) return;
198 } else {
199 utype = it->utype;
200 if((utype != V_ASN1_BOOLEAN) && !*pval) return;
201 }
202
203 switch(utype) {
204 case V_ASN1_OBJECT:
205 ASN1_OBJECT_free((ASN1_OBJECT *)*pval);
206 break;
207
208 case V_ASN1_BOOLEAN:
209 *(ASN1_BOOLEAN *)pval = it->size;
210 return;
211
212 case V_ASN1_NULL:
213 break;
214
215 case V_ASN1_ANY:
216 ASN1_primitive_free(pval, NULL);
217 OPENSSL_free(*pval);
218 break;
219
220 default:
221 ASN1_STRING_free((ASN1_STRING *)*pval);
222 *pval = NULL;
223 break;
224 }
225 *pval = NULL;
226}
diff --git a/src/lib/libcrypto/asn1/tasn_new.c b/src/lib/libcrypto/asn1/tasn_new.c
new file mode 100644
index 0000000000..e33861f864
--- /dev/null
+++ b/src/lib/libcrypto/asn1/tasn_new.c
@@ -0,0 +1,348 @@
1/* tasn_new.c */
2/* Written by Dr Stephen N Henson (shenson@bigfoot.com) for the OpenSSL
3 * project 2000.
4 */
5/* ====================================================================
6 * Copyright (c) 2000 The OpenSSL Project. All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 *
12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 *
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in
17 * the documentation and/or other materials provided with the
18 * distribution.
19 *
20 * 3. All advertising materials mentioning features or use of this
21 * software must display the following acknowledgment:
22 * "This product includes software developed by the OpenSSL Project
23 * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
24 *
25 * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
26 * endorse or promote products derived from this software without
27 * prior written permission. For written permission, please contact
28 * licensing@OpenSSL.org.
29 *
30 * 5. Products derived from this software may not be called "OpenSSL"
31 * nor may "OpenSSL" appear in their names without prior written
32 * permission of the OpenSSL Project.
33 *
34 * 6. Redistributions of any form whatsoever must retain the following
35 * acknowledgment:
36 * "This product includes software developed by the OpenSSL Project
37 * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
38 *
39 * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
40 * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
41 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
42 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
43 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
44 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
45 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
46 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
47 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
48 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
49 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
50 * OF THE POSSIBILITY OF SUCH DAMAGE.
51 * ====================================================================
52 *
53 * This product includes cryptographic software written by Eric Young
54 * (eay@cryptsoft.com). This product includes software written by Tim
55 * Hudson (tjh@cryptsoft.com).
56 *
57 */
58
59
60#include <stddef.h>
61#include <openssl/asn1.h>
62#include <openssl/objects.h>
63#include <openssl/err.h>
64#include <openssl/asn1t.h>
65#include <string.h>
66
67static int asn1_item_ex_combine_new(ASN1_VALUE **pval, const ASN1_ITEM *it, int combine);
68static void asn1_item_clear(ASN1_VALUE **pval, const ASN1_ITEM *it);
69static void asn1_template_clear(ASN1_VALUE **pval, const ASN1_TEMPLATE *tt);
70void asn1_primitive_clear(ASN1_VALUE **pval, const ASN1_ITEM *it);
71
72ASN1_VALUE *ASN1_item_new(const ASN1_ITEM *it)
73{
74 ASN1_VALUE *ret = NULL;
75 if(ASN1_item_ex_new(&ret, it) > 0) return ret;
76 return NULL;
77}
78
79/* Allocate an ASN1 structure */
80
81int ASN1_item_ex_new(ASN1_VALUE **pval, const ASN1_ITEM *it)
82{
83 return asn1_item_ex_combine_new(pval, it, 0);
84}
85
86static int asn1_item_ex_combine_new(ASN1_VALUE **pval, const ASN1_ITEM *it, int combine)
87{
88 const ASN1_TEMPLATE *tt = NULL;
89 const ASN1_COMPAT_FUNCS *cf;
90 const ASN1_EXTERN_FUNCS *ef;
91 const ASN1_AUX *aux = it->funcs;
92 ASN1_aux_cb *asn1_cb;
93 ASN1_VALUE **pseqval;
94 int i;
95 if(aux && aux->asn1_cb) asn1_cb = aux->asn1_cb;
96 else asn1_cb = 0;
97
98 if(!combine) *pval = NULL;
99
100#ifdef CRYPTO_MDEBUG
101 if(it->sname) CRYPTO_push_info(it->sname);
102#endif
103
104 switch(it->itype) {
105
106 case ASN1_ITYPE_EXTERN:
107 ef = it->funcs;
108 if(ef && ef->asn1_ex_new) {
109 if(!ef->asn1_ex_new(pval, it))
110 goto memerr;
111 }
112 break;
113
114 case ASN1_ITYPE_COMPAT:
115 cf = it->funcs;
116 if(cf && cf->asn1_new) {
117 *pval = cf->asn1_new();
118 if(!*pval) goto memerr;
119 }
120 break;
121
122 case ASN1_ITYPE_PRIMITIVE:
123 if(it->templates) {
124 if(!ASN1_template_new(pval, it->templates))
125 goto memerr;
126 } else {
127 if(!ASN1_primitive_new(pval, it))
128 goto memerr;
129 }
130 break;
131
132 case ASN1_ITYPE_MSTRING:
133 if(!ASN1_primitive_new(pval, it))
134 goto memerr;
135 break;
136
137 case ASN1_ITYPE_CHOICE:
138 if(asn1_cb) {
139 i = asn1_cb(ASN1_OP_NEW_PRE, pval, it);
140 if(!i) goto auxerr;
141 if(i==2) {
142#ifdef CRYPTO_MDEBUG
143 if(it->sname) CRYPTO_pop_info();
144#endif
145 return 1;
146 }
147 }
148 if(!combine) {
149 *pval = OPENSSL_malloc(it->size);
150 if(!*pval) goto memerr;
151 memset(*pval, 0, it->size);
152 }
153 asn1_set_choice_selector(pval, -1, it);
154 if(asn1_cb && !asn1_cb(ASN1_OP_NEW_POST, pval, it))
155 goto auxerr;
156 break;
157
158 case ASN1_ITYPE_SEQUENCE:
159 if(asn1_cb) {
160 i = asn1_cb(ASN1_OP_NEW_PRE, pval, it);
161 if(!i) goto auxerr;
162 if(i==2) {
163#ifdef CRYPTO_MDEBUG
164 if(it->sname) CRYPTO_pop_info();
165#endif
166 return 1;
167 }
168 }
169 if(!combine) {
170 *pval = OPENSSL_malloc(it->size);
171 if(!*pval) goto memerr;
172 memset(*pval, 0, it->size);
173 asn1_do_lock(pval, 0, it);
174 asn1_enc_init(pval, it);
175 }
176 for(i = 0, tt = it->templates; i < it->tcount; tt++, i++) {
177 pseqval = asn1_get_field_ptr(pval, tt);
178 if(!ASN1_template_new(pseqval, tt)) goto memerr;
179 }
180 if(asn1_cb && !asn1_cb(ASN1_OP_NEW_POST, pval, it))
181 goto auxerr;
182 break;
183 }
184#ifdef CRYPTO_MDEBUG
185 if(it->sname) CRYPTO_pop_info();
186#endif
187 return 1;
188
189 memerr:
190 ASN1err(ASN1_F_ASN1_ITEM_NEW, ERR_R_MALLOC_FAILURE);
191#ifdef CRYPTO_MDEBUG
192 if(it->sname) CRYPTO_pop_info();
193#endif
194 return 0;
195
196 auxerr:
197 ASN1err(ASN1_F_ASN1_ITEM_NEW, ASN1_R_AUX_ERROR);
198 ASN1_item_ex_free(pval, it);
199#ifdef CRYPTO_MDEBUG
200 if(it->sname) CRYPTO_pop_info();
201#endif
202 return 0;
203
204}
205
206static void asn1_item_clear(ASN1_VALUE **pval, const ASN1_ITEM *it)
207{
208 const ASN1_EXTERN_FUNCS *ef;
209
210 switch(it->itype) {
211
212 case ASN1_ITYPE_EXTERN:
213 ef = it->funcs;
214 if(ef && ef->asn1_ex_clear)
215 ef->asn1_ex_clear(pval, it);
216 else *pval = NULL;
217 break;
218
219
220 case ASN1_ITYPE_PRIMITIVE:
221 if(it->templates)
222 asn1_template_clear(pval, it->templates);
223 else
224 asn1_primitive_clear(pval, it);
225 break;
226
227 case ASN1_ITYPE_MSTRING:
228 asn1_primitive_clear(pval, it);
229 break;
230
231 case ASN1_ITYPE_COMPAT:
232 case ASN1_ITYPE_CHOICE:
233 case ASN1_ITYPE_SEQUENCE:
234 *pval = NULL;
235 break;
236 }
237}
238
239
240int ASN1_template_new(ASN1_VALUE **pval, const ASN1_TEMPLATE *tt)
241{
242 const ASN1_ITEM *it = ASN1_ITEM_ptr(tt->item);
243 int ret;
244 if(tt->flags & ASN1_TFLG_OPTIONAL) {
245 asn1_template_clear(pval, tt);
246 return 1;
247 }
248 /* If ANY DEFINED BY nothing to do */
249
250 if(tt->flags & ASN1_TFLG_ADB_MASK) {
251 *pval = NULL;
252 return 1;
253 }
254#ifdef CRYPTO_MDEBUG
255 if(tt->field_name) CRYPTO_push_info(tt->field_name);
256#endif
257 /* If SET OF or SEQUENCE OF, its a STACK */
258 if(tt->flags & ASN1_TFLG_SK_MASK) {
259 STACK_OF(ASN1_VALUE) *skval;
260 skval = sk_ASN1_VALUE_new_null();
261 if(!skval) {
262 ASN1err(ASN1_F_ASN1_TEMPLATE_NEW, ERR_R_MALLOC_FAILURE);
263 ret = 0;
264 goto done;
265 }
266 *pval = (ASN1_VALUE *)skval;
267 ret = 1;
268 goto done;
269 }
270 /* Otherwise pass it back to the item routine */
271 ret = asn1_item_ex_combine_new(pval, it, tt->flags & ASN1_TFLG_COMBINE);
272 done:
273#ifdef CRYPTO_MDEBUG
274 if(it->sname) CRYPTO_pop_info();
275#endif
276 return ret;
277}
278
279static void asn1_template_clear(ASN1_VALUE **pval, const ASN1_TEMPLATE *tt)
280{
281 /* If ADB or STACK just NULL the field */
282 if(tt->flags & (ASN1_TFLG_ADB_MASK|ASN1_TFLG_SK_MASK))
283 *pval = NULL;
284 else
285 asn1_item_clear(pval, ASN1_ITEM_ptr(tt->item));
286}
287
288
289/* NB: could probably combine most of the real XXX_new() behaviour and junk all the old
290 * functions.
291 */
292
293int ASN1_primitive_new(ASN1_VALUE **pval, const ASN1_ITEM *it)
294{
295 ASN1_TYPE *typ;
296 int utype;
297 const ASN1_PRIMITIVE_FUNCS *pf;
298 pf = it->funcs;
299 if(pf && pf->prim_new) return pf->prim_new(pval, it);
300 if(!it || (it->itype == ASN1_ITYPE_MSTRING)) utype = -1;
301 else utype = it->utype;
302 switch(utype) {
303 case V_ASN1_OBJECT:
304 *pval = (ASN1_VALUE *)OBJ_nid2obj(NID_undef);
305 return 1;
306
307 case V_ASN1_BOOLEAN:
308 *(ASN1_BOOLEAN *)pval = it->size;
309 return 1;
310
311 case V_ASN1_NULL:
312 *pval = (ASN1_VALUE *)1;
313 return 1;
314
315 case V_ASN1_ANY:
316 typ = OPENSSL_malloc(sizeof(ASN1_TYPE));
317 if(!typ) return 0;
318 typ->value.ptr = NULL;
319 typ->type = -1;
320 *pval = (ASN1_VALUE *)typ;
321 break;
322
323 default:
324 *pval = (ASN1_VALUE *)ASN1_STRING_type_new(utype);
325 break;
326 }
327 if(*pval) return 1;
328 return 0;
329}
330
331void asn1_primitive_clear(ASN1_VALUE **pval, const ASN1_ITEM *it)
332{
333 int utype;
334 const ASN1_PRIMITIVE_FUNCS *pf;
335 pf = it->funcs;
336 if(pf) {
337 if(pf->prim_clear)
338 pf->prim_clear(pval, it);
339 else
340 *pval = NULL;
341 return;
342 }
343 if(!it || (it->itype == ASN1_ITYPE_MSTRING)) utype = -1;
344 else utype = it->utype;
345 if(utype == V_ASN1_BOOLEAN)
346 *(ASN1_BOOLEAN *)pval = it->size;
347 else *pval = NULL;
348}
diff --git a/src/lib/libcrypto/asn1/tasn_prn.c b/src/lib/libcrypto/asn1/tasn_prn.c
new file mode 100644
index 0000000000..fab67ae5ac
--- /dev/null
+++ b/src/lib/libcrypto/asn1/tasn_prn.c
@@ -0,0 +1,198 @@
1/* tasn_prn.c */
2/* Written by Dr Stephen N Henson (shenson@bigfoot.com) for the OpenSSL
3 * project 2000.
4 */
5/* ====================================================================
6 * Copyright (c) 2000 The OpenSSL Project. All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 *
12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 *
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in
17 * the documentation and/or other materials provided with the
18 * distribution.
19 *
20 * 3. All advertising materials mentioning features or use of this
21 * software must display the following acknowledgment:
22 * "This product includes software developed by the OpenSSL Project
23 * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
24 *
25 * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
26 * endorse or promote products derived from this software without
27 * prior written permission. For written permission, please contact
28 * licensing@OpenSSL.org.
29 *
30 * 5. Products derived from this software may not be called "OpenSSL"
31 * nor may "OpenSSL" appear in their names without prior written
32 * permission of the OpenSSL Project.
33 *
34 * 6. Redistributions of any form whatsoever must retain the following
35 * acknowledgment:
36 * "This product includes software developed by the OpenSSL Project
37 * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
38 *
39 * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
40 * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
41 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
42 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
43 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
44 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
45 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
46 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
47 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
48 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
49 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
50 * OF THE POSSIBILITY OF SUCH DAMAGE.
51 * ====================================================================
52 *
53 * This product includes cryptographic software written by Eric Young
54 * (eay@cryptsoft.com). This product includes software written by Tim
55 * Hudson (tjh@cryptsoft.com).
56 *
57 */
58
59
60#include <stddef.h>
61#include <openssl/asn1.h>
62#include <openssl/objects.h>
63#include <openssl/buffer.h>
64#include <openssl/err.h>
65#include <openssl/nasn.h>
66
67/* Print routines. Print out a whole structure from a template.
68 */
69
70static int asn1_item_print_nm(BIO *out, void *fld, int indent, const ASN1_ITEM *it, const char *name);
71
72int ASN1_item_print(BIO *out, void *fld, int indent, const ASN1_ITEM *it)
73{
74 return asn1_item_print_nm(out, fld, indent, it, it->sname);
75}
76
77static int asn1_item_print_nm(BIO *out, void *fld, int indent, const ASN1_ITEM *it, const char *name)
78{
79 ASN1_STRING *str;
80 const ASN1_TEMPLATE *tt;
81 void *tmpfld;
82 int i;
83 if(!fld) {
84 BIO_printf(out, "%*s%s ABSENT\n", indent, "", name);
85 return 1;
86 }
87 switch(it->itype) {
88
89 case ASN1_ITYPE_PRIMITIVE:
90 if(it->templates)
91 return ASN1_template_print(out, fld, indent, it->templates);
92 return asn1_primitive_print(out, fld, it->utype, indent, name);
93 break;
94
95 case ASN1_ITYPE_MSTRING:
96 str = fld;
97 return asn1_primitive_print(out, fld, str->type, indent, name);
98
99 case ASN1_ITYPE_EXTERN:
100 BIO_printf(out, "%*s%s:EXTERNAL TYPE %s %s\n", indent, "", name, it->sname, fld ? "" : "ABSENT");
101 return 1;
102 case ASN1_ITYPE_COMPAT:
103 BIO_printf(out, "%*s%s:COMPATIBLE TYPE %s %s\n", indent, "", name, it->sname, fld ? "" : "ABSENT");
104 return 1;
105
106
107 case ASN1_ITYPE_CHOICE:
108 /* CHOICE type, get selector */
109 i = asn1_get_choice_selector(fld, it);
110 /* This should never happen... */
111 if((i < 0) || (i >= it->tcount)) {
112 BIO_printf(out, "%s selector [%d] out of range\n", it->sname, i);
113 return 1;
114 }
115 tt = it->templates + i;
116 tmpfld = asn1_get_field(fld, tt);
117 return ASN1_template_print(out, tmpfld, indent, tt);
118
119 case ASN1_ITYPE_SEQUENCE:
120 BIO_printf(out, "%*s%s {\n", indent, "", name);
121 /* Get each field entry */
122 for(i = 0, tt = it->templates; i < it->tcount; i++, tt++) {
123 tmpfld = asn1_get_field(fld, tt);
124 ASN1_template_print(out, tmpfld, indent + 2, tt);
125 }
126 BIO_printf(out, "%*s}\n", indent, "");
127 return 1;
128
129 default:
130 return 0;
131 }
132}
133
134int ASN1_template_print(BIO *out, void *fld, int indent, const ASN1_TEMPLATE *tt)
135{
136 int i, flags;
137#if 0
138 if(!fld) return 0;
139#endif
140 flags = tt->flags;
141 if(flags & ASN1_TFLG_SK_MASK) {
142 char *tname;
143 void *skitem;
144 /* SET OF, SEQUENCE OF */
145 if(flags & ASN1_TFLG_SET_OF) tname = "SET";
146 else tname = "SEQUENCE";
147 if(fld) {
148 BIO_printf(out, "%*s%s OF %s {\n", indent, "", tname, tt->field_name);
149 for(i = 0; i < sk_num(fld); i++) {
150 skitem = sk_value(fld, i);
151 asn1_item_print_nm(out, skitem, indent + 2, tt->item, "");
152 }
153 BIO_printf(out, "%*s}\n", indent, "");
154 } else
155 BIO_printf(out, "%*s%s OF %s ABSENT\n", indent, "", tname, tt->field_name);
156 return 1;
157 }
158 return asn1_item_print_nm(out, fld, indent, tt->item, tt->field_name);
159}
160
161static int asn1_primitive_print(BIO *out, void *fld, long utype, int indent, const char *name)
162{
163 ASN1_STRING *str = fld;
164 if(fld) {
165 if(utype == V_ASN1_BOOLEAN) {
166 int *bool = fld;
167if(*bool == -1) printf("BOOL MISSING\n");
168 BIO_printf(out, "%*s%s:%s", indent, "", "BOOLEAN", *bool ? "TRUE" : "FALSE");
169 } else if((utype == V_ASN1_INTEGER)
170 || (utype == V_ASN1_ENUMERATED)) {
171 char *s, *nm;
172 s = i2s_ASN1_INTEGER(NULL, fld);
173 if(utype == V_ASN1_INTEGER) nm = "INTEGER";
174 else nm = "ENUMERATED";
175 BIO_printf(out, "%*s%s:%s", indent, "", nm, s);
176 OPENSSL_free(s);
177 } else if(utype == V_ASN1_NULL) {
178 BIO_printf(out, "%*s%s", indent, "", "NULL");
179 } else if(utype == V_ASN1_UTCTIME) {
180 BIO_printf(out, "%*s%s:%s:", indent, "", name, "UTCTIME");
181 ASN1_UTCTIME_print(out, str);
182 } else if(utype == V_ASN1_GENERALIZEDTIME) {
183 BIO_printf(out, "%*s%s:%s:", indent, "", name, "GENERALIZEDTIME");
184 ASN1_GENERALIZEDTIME_print(out, str);
185 } else if(utype == V_ASN1_OBJECT) {
186 char objbuf[80], *ln;
187 ln = OBJ_nid2ln(OBJ_obj2nid(fld));
188 if(!ln) ln = "";
189 OBJ_obj2txt(objbuf, 80, fld, 1);
190 BIO_printf(out, "%*s%s:%s (%s)", indent, "", "OBJECT", ln, objbuf);
191 } else {
192 BIO_printf(out, "%*s%s:", indent, "", name);
193 ASN1_STRING_print_ex(out, str, ASN1_STRFLGS_DUMP_UNKNOWN|ASN1_STRFLGS_SHOW_TYPE);
194 }
195 BIO_printf(out, "\n");
196 } else BIO_printf(out, "%*s%s [ABSENT]\n", indent, "", name);
197 return 1;
198}
diff --git a/src/lib/libcrypto/asn1/tasn_typ.c b/src/lib/libcrypto/asn1/tasn_typ.c
new file mode 100644
index 0000000000..804d2eeba2
--- /dev/null
+++ b/src/lib/libcrypto/asn1/tasn_typ.c
@@ -0,0 +1,133 @@
1/* tasn_typ.c */
2/* Written by Dr Stephen N Henson (shenson@bigfoot.com) for the OpenSSL
3 * project 2000.
4 */
5/* ====================================================================
6 * Copyright (c) 2000 The OpenSSL Project. All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 *
12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 *
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in
17 * the documentation and/or other materials provided with the
18 * distribution.
19 *
20 * 3. All advertising materials mentioning features or use of this
21 * software must display the following acknowledgment:
22 * "This product includes software developed by the OpenSSL Project
23 * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
24 *
25 * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
26 * endorse or promote products derived from this software without
27 * prior written permission. For written permission, please contact
28 * licensing@OpenSSL.org.
29 *
30 * 5. Products derived from this software may not be called "OpenSSL"
31 * nor may "OpenSSL" appear in their names without prior written
32 * permission of the OpenSSL Project.
33 *
34 * 6. Redistributions of any form whatsoever must retain the following
35 * acknowledgment:
36 * "This product includes software developed by the OpenSSL Project
37 * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
38 *
39 * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
40 * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
41 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
42 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
43 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
44 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
45 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
46 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
47 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
48 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
49 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
50 * OF THE POSSIBILITY OF SUCH DAMAGE.
51 * ====================================================================
52 *
53 * This product includes cryptographic software written by Eric Young
54 * (eay@cryptsoft.com). This product includes software written by Tim
55 * Hudson (tjh@cryptsoft.com).
56 *
57 */
58#include <stdio.h>
59#include <openssl/asn1.h>
60#include <openssl/asn1t.h>
61
62/* Declarations for string types */
63
64
65IMPLEMENT_ASN1_TYPE(ASN1_INTEGER)
66IMPLEMENT_ASN1_FUNCTIONS(ASN1_INTEGER)
67
68IMPLEMENT_ASN1_TYPE(ASN1_ENUMERATED)
69IMPLEMENT_ASN1_FUNCTIONS(ASN1_ENUMERATED)
70
71IMPLEMENT_ASN1_TYPE(ASN1_BIT_STRING)
72IMPLEMENT_ASN1_FUNCTIONS(ASN1_BIT_STRING)
73
74IMPLEMENT_ASN1_TYPE(ASN1_OCTET_STRING)
75IMPLEMENT_ASN1_FUNCTIONS(ASN1_OCTET_STRING)
76
77IMPLEMENT_ASN1_TYPE(ASN1_NULL)
78IMPLEMENT_ASN1_FUNCTIONS(ASN1_NULL)
79
80IMPLEMENT_ASN1_TYPE(ASN1_OBJECT)
81
82IMPLEMENT_ASN1_TYPE(ASN1_UTF8STRING)
83IMPLEMENT_ASN1_FUNCTIONS(ASN1_UTF8STRING)
84
85IMPLEMENT_ASN1_TYPE(ASN1_PRINTABLESTRING)
86IMPLEMENT_ASN1_FUNCTIONS(ASN1_PRINTABLESTRING)
87
88IMPLEMENT_ASN1_TYPE(ASN1_T61STRING)
89IMPLEMENT_ASN1_FUNCTIONS(ASN1_T61STRING)
90
91IMPLEMENT_ASN1_TYPE(ASN1_IA5STRING)
92IMPLEMENT_ASN1_FUNCTIONS(ASN1_IA5STRING)
93
94IMPLEMENT_ASN1_TYPE(ASN1_GENERALSTRING)
95IMPLEMENT_ASN1_FUNCTIONS(ASN1_GENERALSTRING)
96
97IMPLEMENT_ASN1_TYPE(ASN1_UTCTIME)
98IMPLEMENT_ASN1_FUNCTIONS(ASN1_UTCTIME)
99
100IMPLEMENT_ASN1_TYPE(ASN1_GENERALIZEDTIME)
101IMPLEMENT_ASN1_FUNCTIONS(ASN1_GENERALIZEDTIME)
102
103IMPLEMENT_ASN1_TYPE(ASN1_VISIBLESTRING)
104IMPLEMENT_ASN1_FUNCTIONS(ASN1_VISIBLESTRING)
105
106IMPLEMENT_ASN1_TYPE(ASN1_UNIVERSALSTRING)
107IMPLEMENT_ASN1_FUNCTIONS(ASN1_UNIVERSALSTRING)
108
109IMPLEMENT_ASN1_TYPE(ASN1_BMPSTRING)
110IMPLEMENT_ASN1_FUNCTIONS(ASN1_BMPSTRING)
111
112IMPLEMENT_ASN1_TYPE(ASN1_ANY)
113
114/* Just swallow an ASN1_SEQUENCE in an ASN1_STRING */
115IMPLEMENT_ASN1_TYPE(ASN1_SEQUENCE)
116
117IMPLEMENT_ASN1_FUNCTIONS_fname(ASN1_TYPE, ASN1_ANY, ASN1_TYPE)
118
119/* Multistring types */
120
121IMPLEMENT_ASN1_MSTRING(ASN1_PRINTABLE, B_ASN1_PRINTABLE)
122IMPLEMENT_ASN1_FUNCTIONS_name(ASN1_STRING, ASN1_PRINTABLE)
123
124IMPLEMENT_ASN1_MSTRING(DISPLAYTEXT, B_ASN1_DISPLAYTEXT)
125IMPLEMENT_ASN1_FUNCTIONS_name(ASN1_STRING, DISPLAYTEXT)
126
127IMPLEMENT_ASN1_MSTRING(DIRECTORYSTRING, B_ASN1_DIRECTORYSTRING)
128IMPLEMENT_ASN1_FUNCTIONS_name(ASN1_STRING, DIRECTORYSTRING)
129
130/* Three separate BOOLEAN type: normal, DEFAULT TRUE and DEFAULT FALSE */
131IMPLEMENT_ASN1_TYPE_ex(ASN1_BOOLEAN, ASN1_BOOLEAN, -1)
132IMPLEMENT_ASN1_TYPE_ex(ASN1_TBOOLEAN, ASN1_BOOLEAN, 1)
133IMPLEMENT_ASN1_TYPE_ex(ASN1_FBOOLEAN, ASN1_BOOLEAN, 0)
diff --git a/src/lib/libcrypto/asn1/tasn_utl.c b/src/lib/libcrypto/asn1/tasn_utl.c
new file mode 100644
index 0000000000..8996ce8c13
--- /dev/null
+++ b/src/lib/libcrypto/asn1/tasn_utl.c
@@ -0,0 +1,253 @@
1/* tasn_utl.c */
2/* Written by Dr Stephen N Henson (shenson@bigfoot.com) for the OpenSSL
3 * project 2000.
4 */
5/* ====================================================================
6 * Copyright (c) 2000 The OpenSSL Project. All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 *
12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 *
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in
17 * the documentation and/or other materials provided with the
18 * distribution.
19 *
20 * 3. All advertising materials mentioning features or use of this
21 * software must display the following acknowledgment:
22 * "This product includes software developed by the OpenSSL Project
23 * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
24 *
25 * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
26 * endorse or promote products derived from this software without
27 * prior written permission. For written permission, please contact
28 * licensing@OpenSSL.org.
29 *
30 * 5. Products derived from this software may not be called "OpenSSL"
31 * nor may "OpenSSL" appear in their names without prior written
32 * permission of the OpenSSL Project.
33 *
34 * 6. Redistributions of any form whatsoever must retain the following
35 * acknowledgment:
36 * "This product includes software developed by the OpenSSL Project
37 * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
38 *
39 * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
40 * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
41 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
42 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
43 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
44 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
45 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
46 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
47 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
48 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
49 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
50 * OF THE POSSIBILITY OF SUCH DAMAGE.
51 * ====================================================================
52 *
53 * This product includes cryptographic software written by Eric Young
54 * (eay@cryptsoft.com). This product includes software written by Tim
55 * Hudson (tjh@cryptsoft.com).
56 *
57 */
58
59
60#include <stddef.h>
61#include <string.h>
62#include <openssl/asn1.h>
63#include <openssl/asn1t.h>
64#include <openssl/objects.h>
65#include <openssl/err.h>
66
67/* Utility functions for manipulating fields and offsets */
68
69/* Add 'offset' to 'addr' */
70#define offset2ptr(addr, offset) (void *)(((char *) addr) + offset)
71
72/* Given an ASN1_ITEM CHOICE type return
73 * the selector value
74 */
75
76int asn1_get_choice_selector(ASN1_VALUE **pval, const ASN1_ITEM *it)
77{
78 int *sel = offset2ptr(*pval, it->utype);
79 return *sel;
80}
81
82/* Given an ASN1_ITEM CHOICE type set
83 * the selector value, return old value.
84 */
85
86int asn1_set_choice_selector(ASN1_VALUE **pval, int value, const ASN1_ITEM *it)
87{
88 int *sel, ret;
89 sel = offset2ptr(*pval, it->utype);
90 ret = *sel;
91 *sel = value;
92 return ret;
93}
94
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
97 * set to 1. If op is -1 count is decremented and the return value
98 * is the current refrence count or 0 if no reference count exists.
99 */
100
101int asn1_do_lock(ASN1_VALUE **pval, int op, const ASN1_ITEM *it)
102{
103 const ASN1_AUX *aux;
104 int *lck, ret;
105 if(it->itype != ASN1_ITYPE_SEQUENCE) return 0;
106 aux = it->funcs;
107 if(!aux || !(aux->flags & ASN1_AFLG_REFCOUNT)) return 0;
108 lck = offset2ptr(*pval, aux->ref_offset);
109 if(op == 0) {
110 *lck = 1;
111 return 1;
112 }
113 ret = CRYPTO_add(lck, op, aux->ref_lock);
114#ifdef REF_PRINT
115 fprintf(stderr, "%s: Reference Count: %d\n", it->sname, *lck);
116#endif
117#ifdef REF_CHECK
118 if(ret < 0)
119 fprintf(stderr, "%s, bad reference count\n", it->sname);
120#endif
121 return ret;
122}
123
124static ASN1_ENCODING *asn1_get_enc_ptr(ASN1_VALUE **pval, const ASN1_ITEM *it)
125{
126 const ASN1_AUX *aux;
127 if(!pval || !*pval) return NULL;
128 aux = it->funcs;
129 if(!aux || !(aux->flags & ASN1_AFLG_ENCODING)) return NULL;
130 return offset2ptr(*pval, aux->enc_offset);
131}
132
133void asn1_enc_init(ASN1_VALUE **pval, const ASN1_ITEM *it)
134{
135 ASN1_ENCODING *enc;
136 enc = asn1_get_enc_ptr(pval, it);
137 if(enc) {
138 enc->enc = NULL;
139 enc->len = 0;
140 enc->modified = 1;
141 }
142}
143
144void asn1_enc_free(ASN1_VALUE **pval, const ASN1_ITEM *it)
145{
146 ASN1_ENCODING *enc;
147 enc = asn1_get_enc_ptr(pval, it);
148 if(enc) {
149 if(enc->enc) OPENSSL_free(enc->enc);
150 enc->enc = NULL;
151 enc->len = 0;
152 enc->modified = 1;
153 }
154}
155
156int asn1_enc_save(ASN1_VALUE **pval, unsigned char *in, int inlen, const ASN1_ITEM *it)
157{
158 ASN1_ENCODING *enc;
159 enc = asn1_get_enc_ptr(pval, it);
160 if(!enc) return 1;
161
162 if(enc->enc) OPENSSL_free(enc->enc);
163 enc->enc = OPENSSL_malloc(inlen);
164 if(!enc->enc) return 0;
165 memcpy(enc->enc, in, inlen);
166 enc->len = inlen;
167 enc->modified = 0;
168
169 return 1;
170}
171
172int asn1_enc_restore(int *len, unsigned char **out, ASN1_VALUE **pval, const ASN1_ITEM *it)
173{
174 ASN1_ENCODING *enc;
175 enc = asn1_get_enc_ptr(pval, it);
176 if(!enc || enc->modified) return 0;
177 if(out) {
178 memcpy(*out, enc->enc, enc->len);
179 *out += enc->len;
180 }
181 if(len) *len = enc->len;
182 return 1;
183}
184
185/* Given an ASN1_TEMPLATE get a pointer to a field */
186ASN1_VALUE ** asn1_get_field_ptr(ASN1_VALUE **pval, const ASN1_TEMPLATE *tt)
187{
188 ASN1_VALUE **pvaltmp;
189 if(tt->flags & ASN1_TFLG_COMBINE) return pval;
190 pvaltmp = offset2ptr(*pval, tt->offset);
191 /* NOTE for BOOLEAN types the field is just a plain
192 * int so we can't return int **, so settle for
193 * (int *).
194 */
195 return pvaltmp;
196}
197
198/* Handle ANY DEFINED BY template, find the selector, look up
199 * the relevant ASN1_TEMPLATE in the table and return it.
200 */
201
202const ASN1_TEMPLATE *asn1_do_adb(ASN1_VALUE **pval, const ASN1_TEMPLATE *tt, int nullerr)
203{
204 const ASN1_ADB *adb;
205 const ASN1_ADB_TABLE *atbl;
206 long selector;
207 ASN1_VALUE **sfld;
208 int i;
209 if(!(tt->flags & ASN1_TFLG_ADB_MASK)) return tt;
210
211 /* Else ANY DEFINED BY ... get the table */
212 adb = ASN1_ADB_ptr(tt->item);
213
214 /* Get the selector field */
215 sfld = offset2ptr(*pval, adb->offset);
216
217 /* Check if NULL */
218 if(!sfld) {
219 if(!adb->null_tt) goto err;
220 return adb->null_tt;
221 }
222
223 /* Convert type to a long:
224 * NB: don't check for NID_undef here because it
225 * might be a legitimate value in the table
226 */
227 if(tt->flags & ASN1_TFLG_ADB_OID)
228 selector = OBJ_obj2nid((ASN1_OBJECT *)*sfld);
229 else
230 selector = ASN1_INTEGER_get((ASN1_INTEGER *)*sfld);
231
232 /* Try to find matching entry in table
233 * Maybe should check application types first to
234 * allow application override? Might also be useful
235 * to have a flag which indicates table is sorted and
236 * we can do a binary search. For now stick to a
237 * linear search.
238 */
239
240 for(atbl = adb->tbl, i = 0; i < adb->tblcount; i++, atbl++)
241 if(atbl->value == selector) return &atbl->tt;
242
243 /* FIXME: need to search application table too */
244
245 /* No match, return default type */
246 if(!adb->default_tt) goto err;
247 return adb->default_tt;
248
249 err:
250 /* FIXME: should log the value or OID of unsupported type */
251 if(nullerr) ASN1err(ASN1_F_ASN1_DO_ADB, ASN1_R_UNSUPPORTED_ANY_DEFINED_BY_TYPE);
252 return NULL;
253}
diff --git a/src/lib/libcrypto/asn1/x_algor.c b/src/lib/libcrypto/asn1/x_algor.c
index 853a8dfeef..00b9ea54a1 100644
--- a/src/lib/libcrypto/asn1/x_algor.c
+++ b/src/lib/libcrypto/asn1/x_algor.c
@@ -1,118 +1,73 @@
1/* crypto/asn1/x_algor.c */ 1/* x_algor.c */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Written by Dr Stephen N Henson (shenson@bigfoot.com) for the OpenSSL
3 * All rights reserved. 3 * project 2000.
4 */
5/* ====================================================================
6 * Copyright (c) 2000 The OpenSSL Project. All rights reserved.
4 * 7 *
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 8 * Redistribution and use in source and binary forms, with or without
24 * modification, are permitted provided that the following conditions 9 * modification, are permitted provided that the following conditions
25 * are met: 10 * are met:
26 * 1. Redistributions of source code must retain the copyright 11 *
27 * notice, this list of conditions and the following disclaimer. 12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 *
28 * 2. Redistributions in binary form must reproduce the above copyright 15 * 2. Redistributions in binary form must reproduce the above copyright
29 * notice, this list of conditions and the following disclaimer in the 16 * notice, this list of conditions and the following disclaimer in
30 * documentation and/or other materials provided with the distribution. 17 * the documentation and/or other materials provided with the
31 * 3. All advertising materials mentioning features or use of this software 18 * distribution.
32 * must display the following acknowledgement: 19 *
33 * "This product includes cryptographic software written by 20 * 3. All advertising materials mentioning features or use of this
34 * Eric Young (eay@cryptsoft.com)" 21 * software must display the following acknowledgment:
35 * The word 'cryptographic' can be left out if the rouines from the library 22 * "This product includes software developed by the OpenSSL Project
36 * being used are not cryptographic related :-). 23 * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
37 * 4. If you include any Windows specific code (or a derivative thereof) from 24 *
38 * the apps directory (application code) you must include an acknowledgement: 25 * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
39 * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" 26 * endorse or promote products derived from this software without
40 * 27 * prior written permission. For written permission, please contact
41 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND 28 * licensing@OpenSSL.org.
42 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 29 *
43 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 30 * 5. Products derived from this software may not be called "OpenSSL"
44 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 31 * nor may "OpenSSL" appear in their names without prior written
45 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 32 * permission of the OpenSSL Project.
46 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 33 *
47 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 34 * 6. Redistributions of any form whatsoever must retain the following
48 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 35 * acknowledgment:
49 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 36 * "This product includes software developed by the OpenSSL Project
50 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 37 * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
51 * SUCH DAMAGE. 38 *
52 * 39 * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
53 * The licence and distribution terms for any publically available version or 40 * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
54 * derivative of this code cannot be changed. i.e. this code cannot simply be 41 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
55 * copied and put under another distribution licence 42 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
56 * [including the GNU Public Licence.] 43 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
44 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
45 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
46 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
47 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
48 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
49 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
50 * OF THE POSSIBILITY OF SUCH DAMAGE.
51 * ====================================================================
52 *
53 * This product includes cryptographic software written by Eric Young
54 * (eay@cryptsoft.com). This product includes software written by Tim
55 * Hudson (tjh@cryptsoft.com).
56 *
57 */ 57 */
58 58
59#include <stdio.h> 59#include <stddef.h>
60#include "cryptlib.h"
61#include <openssl/asn1_mac.h>
62#include <openssl/x509.h> 60#include <openssl/x509.h>
61#include <openssl/asn1.h>
62#include <openssl/asn1t.h>
63 63
64int i2d_X509_ALGOR(X509_ALGOR *a, unsigned char **pp) 64ASN1_SEQUENCE(X509_ALGOR) = {
65 { 65 ASN1_SIMPLE(X509_ALGOR, algorithm, ASN1_OBJECT),
66 M_ASN1_I2D_vars(a); 66 ASN1_OPT(X509_ALGOR, parameter, ASN1_ANY)
67 67} ASN1_SEQUENCE_END(X509_ALGOR)
68 M_ASN1_I2D_len(a->algorithm,i2d_ASN1_OBJECT);
69 if (a->parameter != NULL)
70 { M_ASN1_I2D_len(a->parameter,i2d_ASN1_TYPE); }
71
72 M_ASN1_I2D_seq_total();
73 M_ASN1_I2D_put(a->algorithm,i2d_ASN1_OBJECT);
74 if (a->parameter != NULL)
75 { M_ASN1_I2D_put(a->parameter,i2d_ASN1_TYPE); }
76
77 M_ASN1_I2D_finish();
78 }
79
80X509_ALGOR *d2i_X509_ALGOR(X509_ALGOR **a, unsigned char **pp, long length)
81 {
82 M_ASN1_D2I_vars(a,X509_ALGOR *,X509_ALGOR_new);
83
84 M_ASN1_D2I_Init();
85 M_ASN1_D2I_start_sequence();
86 M_ASN1_D2I_get(ret->algorithm,d2i_ASN1_OBJECT);
87 if (!M_ASN1_D2I_end_sequence())
88 { M_ASN1_D2I_get(ret->parameter,d2i_ASN1_TYPE); }
89 else
90 {
91 ASN1_TYPE_free(ret->parameter);
92 ret->parameter=NULL;
93 }
94 M_ASN1_D2I_Finish(a,X509_ALGOR_free,ASN1_F_D2I_X509_ALGOR);
95 }
96
97X509_ALGOR *X509_ALGOR_new(void)
98 {
99 X509_ALGOR *ret=NULL;
100 ASN1_CTX c;
101
102 M_ASN1_New_Malloc(ret,X509_ALGOR);
103 ret->algorithm=OBJ_nid2obj(NID_undef);
104 ret->parameter=NULL;
105 return(ret);
106 M_ASN1_New_Error(ASN1_F_X509_ALGOR_NEW);
107 }
108 68
109void X509_ALGOR_free(X509_ALGOR *a) 69IMPLEMENT_ASN1_FUNCTIONS(X509_ALGOR)
110 { 70IMPLEMENT_ASN1_DUP_FUNCTION(X509_ALGOR)
111 if (a == NULL) return;
112 ASN1_OBJECT_free(a->algorithm);
113 ASN1_TYPE_free(a->parameter);
114 OPENSSL_free(a);
115 }
116 71
117IMPLEMENT_STACK_OF(X509_ALGOR) 72IMPLEMENT_STACK_OF(X509_ALGOR)
118IMPLEMENT_ASN1_SET_OF(X509_ALGOR) 73IMPLEMENT_ASN1_SET_OF(X509_ALGOR)
diff --git a/src/lib/libcrypto/asn1/x_attrib.c b/src/lib/libcrypto/asn1/x_attrib.c
index 14e5ea27aa..1e3713f18f 100644
--- a/src/lib/libcrypto/asn1/x_attrib.c
+++ b/src/lib/libcrypto/asn1/x_attrib.c
@@ -59,64 +59,42 @@
59#include <stdio.h> 59#include <stdio.h>
60#include "cryptlib.h" 60#include "cryptlib.h"
61#include <openssl/objects.h> 61#include <openssl/objects.h>
62#include <openssl/asn1_mac.h> 62#include <openssl/asn1t.h>
63#include <openssl/x509.h> 63#include <openssl/x509.h>
64 64
65/* sequence */ 65/* X509_ATTRIBUTE: this has the following form:
66int i2d_X509_ATTRIBUTE(X509_ATTRIBUTE *a, unsigned char **pp) 66 *
67 { 67 * typedef struct x509_attributes_st
68 int k=0; 68 * {
69 int r=0,ret=0; 69 * ASN1_OBJECT *object;
70 unsigned char **p=NULL; 70 * int single;
71 71 * union {
72 if (a == NULL) return(0); 72 * char *ptr;
73 73 * STACK_OF(ASN1_TYPE) *set;
74 p=NULL; 74 * ASN1_TYPE *single;
75 for (;;) 75 * } value;
76 { 76 * } X509_ATTRIBUTE;
77 if (k) 77 *
78 { 78 * this needs some extra thought because the CHOICE type is
79 r=ASN1_object_size(1,ret,V_ASN1_SEQUENCE); 79 * merged with the main structure and because the value can
80 if (pp == NULL) return(r); 80 * be anything at all we *must* try the SET OF first because
81 p=pp; 81 * the ASN1_ANY type will swallow anything including the whole
82 ASN1_put_object(p,1,ret,V_ASN1_SEQUENCE, 82 * SET OF structure.
83 V_ASN1_UNIVERSAL); 83 */
84 }
85
86 ret+=i2d_ASN1_OBJECT(a->object,p);
87 if (a->set)
88 ret+=i2d_ASN1_SET_OF_ASN1_TYPE(a->value.set,p,i2d_ASN1_TYPE,
89 V_ASN1_SET,V_ASN1_UNIVERSAL,IS_SET);
90 else
91 ret+=i2d_ASN1_TYPE(a->value.single,p);
92 if (k++) return(r);
93 }
94 }
95
96X509_ATTRIBUTE *d2i_X509_ATTRIBUTE(X509_ATTRIBUTE **a, unsigned char **pp,
97 long length)
98 {
99 M_ASN1_D2I_vars(a,X509_ATTRIBUTE *,X509_ATTRIBUTE_new);
100 84
101 M_ASN1_D2I_Init(); 85ASN1_CHOICE(X509_ATTRIBUTE_SET) = {
102 M_ASN1_D2I_start_sequence(); 86 ASN1_SET_OF(X509_ATTRIBUTE, value.set, ASN1_ANY),
103 M_ASN1_D2I_get(ret->object,d2i_ASN1_OBJECT); 87 ASN1_SIMPLE(X509_ATTRIBUTE, value.single, ASN1_ANY)
88} ASN1_CHOICE_END_selector(X509_ATTRIBUTE, X509_ATTRIBUTE_SET, single)
104 89
105 if ((c.slen != 0) && 90ASN1_SEQUENCE(X509_ATTRIBUTE) = {
106 (M_ASN1_next == (V_ASN1_CONSTRUCTED|V_ASN1_UNIVERSAL|V_ASN1_SET))) 91 ASN1_SIMPLE(X509_ATTRIBUTE, object, ASN1_OBJECT),
107 { 92 /* CHOICE type merged with parent */
108 ret->set=1; 93 ASN1_EX_COMBINE(0, 0, X509_ATTRIBUTE_SET)
109 M_ASN1_D2I_get_set_type(ASN1_TYPE,ret->value.set,d2i_ASN1_TYPE, 94} ASN1_SEQUENCE_END(X509_ATTRIBUTE)
110 ASN1_TYPE_free);
111 }
112 else
113 {
114 ret->set=0;
115 M_ASN1_D2I_get(ret->value.single,d2i_ASN1_TYPE);
116 }
117 95
118 M_ASN1_D2I_Finish(a,X509_ATTRIBUTE_free,ASN1_F_D2I_X509_ATTRIBUTE); 96IMPLEMENT_ASN1_FUNCTIONS(X509_ATTRIBUTE)
119 } 97IMPLEMENT_ASN1_DUP_FUNCTION(X509_ATTRIBUTE)
120 98
121X509_ATTRIBUTE *X509_ATTRIBUTE_create(int nid, int atrtype, void *value) 99X509_ATTRIBUTE *X509_ATTRIBUTE_create(int nid, int atrtype, void *value)
122 { 100 {
@@ -126,7 +104,7 @@ X509_ATTRIBUTE *X509_ATTRIBUTE_create(int nid, int atrtype, void *value)
126 if ((ret=X509_ATTRIBUTE_new()) == NULL) 104 if ((ret=X509_ATTRIBUTE_new()) == NULL)
127 return(NULL); 105 return(NULL);
128 ret->object=OBJ_nid2obj(nid); 106 ret->object=OBJ_nid2obj(nid);
129 ret->set=1; 107 ret->single=0;
130 if ((ret->value.set=sk_ASN1_TYPE_new_null()) == NULL) goto err; 108 if ((ret->value.set=sk_ASN1_TYPE_new_null()) == NULL) goto err;
131 if ((val=ASN1_TYPE_new()) == NULL) goto err; 109 if ((val=ASN1_TYPE_new()) == NULL) goto err;
132 if (!sk_ASN1_TYPE_push(ret->value.set,val)) goto err; 110 if (!sk_ASN1_TYPE_push(ret->value.set,val)) goto err;
@@ -138,28 +116,3 @@ err:
138 if (val != NULL) ASN1_TYPE_free(val); 116 if (val != NULL) ASN1_TYPE_free(val);
139 return(NULL); 117 return(NULL);
140 } 118 }
141
142X509_ATTRIBUTE *X509_ATTRIBUTE_new(void)
143 {
144 X509_ATTRIBUTE *ret=NULL;
145 ASN1_CTX c;
146
147 M_ASN1_New_Malloc(ret,X509_ATTRIBUTE);
148 ret->object=OBJ_nid2obj(NID_undef);
149 ret->set=0;
150 ret->value.ptr=NULL;
151 return(ret);
152 M_ASN1_New_Error(ASN1_F_X509_ATTRIBUTE_NEW);
153 }
154
155void X509_ATTRIBUTE_free(X509_ATTRIBUTE *a)
156 {
157 if (a == NULL) return;
158 ASN1_OBJECT_free(a->object);
159 if (a->set)
160 sk_ASN1_TYPE_pop_free(a->value.set,ASN1_TYPE_free);
161 else
162 ASN1_TYPE_free(a->value.single);
163 OPENSSL_free(a);
164 }
165
diff --git a/src/lib/libcrypto/asn1/x_bignum.c b/src/lib/libcrypto/asn1/x_bignum.c
new file mode 100644
index 0000000000..848c7a0877
--- /dev/null
+++ b/src/lib/libcrypto/asn1/x_bignum.c
@@ -0,0 +1,137 @@
1/* x_bignum.c */
2/* Written by Dr Stephen N Henson (shenson@bigfoot.com) for the OpenSSL
3 * project 2000.
4 */
5/* ====================================================================
6 * Copyright (c) 2000 The OpenSSL Project. All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 *
12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 *
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in
17 * the documentation and/or other materials provided with the
18 * distribution.
19 *
20 * 3. All advertising materials mentioning features or use of this
21 * software must display the following acknowledgment:
22 * "This product includes software developed by the OpenSSL Project
23 * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
24 *
25 * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
26 * endorse or promote products derived from this software without
27 * prior written permission. For written permission, please contact
28 * licensing@OpenSSL.org.
29 *
30 * 5. Products derived from this software may not be called "OpenSSL"
31 * nor may "OpenSSL" appear in their names without prior written
32 * permission of the OpenSSL Project.
33 *
34 * 6. Redistributions of any form whatsoever must retain the following
35 * acknowledgment:
36 * "This product includes software developed by the OpenSSL Project
37 * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
38 *
39 * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
40 * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
41 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
42 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
43 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
44 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
45 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
46 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
47 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
48 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
49 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
50 * OF THE POSSIBILITY OF SUCH DAMAGE.
51 * ====================================================================
52 *
53 * This product includes cryptographic software written by Eric Young
54 * (eay@cryptsoft.com). This product includes software written by Tim
55 * Hudson (tjh@cryptsoft.com).
56 *
57 */
58
59#include <stdio.h>
60#include "cryptlib.h"
61#include <openssl/asn1t.h>
62
63/* Custom primitive type for BIGNUM handling. This reads in an ASN1_INTEGER as a
64 * BIGNUM directly. Currently it ignores the sign which isn't a problem since all
65 * BIGNUMs used are non negative and anything that looks negative is normally due
66 * to an encoding error.
67 */
68
69#define BN_SENSITIVE 1
70
71static int bn_new(ASN1_VALUE **pval, const ASN1_ITEM *it);
72static void bn_free(ASN1_VALUE **pval, const ASN1_ITEM *it);
73
74static int bn_i2c(ASN1_VALUE **pval, unsigned char *cont, int *putype, 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);
76
77static ASN1_PRIMITIVE_FUNCS bignum_pf = {
78 NULL, 0,
79 bn_new,
80 bn_free,
81 0,
82 bn_c2i,
83 bn_i2c
84};
85
86ASN1_ITEM_start(BIGNUM)
87 ASN1_ITYPE_PRIMITIVE, V_ASN1_INTEGER, NULL, 0, &bignum_pf, 0, "BIGNUM"
88ASN1_ITEM_end(BIGNUM)
89
90ASN1_ITEM_start(CBIGNUM)
91 ASN1_ITYPE_PRIMITIVE, V_ASN1_INTEGER, NULL, 0, &bignum_pf, BN_SENSITIVE, "BIGNUM"
92ASN1_ITEM_end(CBIGNUM)
93
94static int bn_new(ASN1_VALUE **pval, const ASN1_ITEM *it)
95{
96 *pval = (ASN1_VALUE *)BN_new();
97 if(*pval) return 1;
98 else return 0;
99}
100
101static void bn_free(ASN1_VALUE **pval, const ASN1_ITEM *it)
102{
103 if(!*pval) return;
104 if(it->size & BN_SENSITIVE) BN_clear_free((BIGNUM *)*pval);
105 else BN_free((BIGNUM *)*pval);
106 *pval = NULL;
107}
108
109static int bn_i2c(ASN1_VALUE **pval, unsigned char *cont, int *putype, const ASN1_ITEM *it)
110{
111 BIGNUM *bn;
112 int pad;
113 if(!*pval) return -1;
114 bn = (BIGNUM *)*pval;
115 /* If MSB set in an octet we need a padding byte */
116 if(BN_num_bits(bn) & 0x7) pad = 0;
117 else pad = 1;
118 if(cont) {
119 if(pad) *cont++ = 0;
120 BN_bn2bin(bn, cont);
121 }
122 return pad + BN_num_bytes(bn);
123}
124
125static int bn_c2i(ASN1_VALUE **pval, unsigned char *cont, int len, int utype, char *free_cont, const ASN1_ITEM *it)
126{
127 BIGNUM *bn;
128 if(!*pval) bn_new(pval, it);
129 bn = (BIGNUM *)*pval;
130 if(!BN_bin2bn(cont, len, bn)) {
131 bn_free(pval, it);
132 return 0;
133 }
134 return 1;
135}
136
137
diff --git a/src/lib/libcrypto/asn1/x_crl.c b/src/lib/libcrypto/asn1/x_crl.c
index 51518cdf35..11fce96825 100644
--- a/src/lib/libcrypto/asn1/x_crl.c
+++ b/src/lib/libcrypto/asn1/x_crl.c
@@ -58,275 +58,76 @@
58 58
59#include <stdio.h> 59#include <stdio.h>
60#include "cryptlib.h" 60#include "cryptlib.h"
61#include <openssl/asn1_mac.h> 61#include <openssl/asn1t.h>
62#include <openssl/x509.h> 62#include <openssl/x509.h>
63 63
64static int X509_REVOKED_cmp(const X509_REVOKED * const *a, 64static int X509_REVOKED_cmp(const X509_REVOKED * const *a,
65 const X509_REVOKED * const *b); 65 const X509_REVOKED * const *b);
66static int X509_REVOKED_seq_cmp(const X509_REVOKED * const *a, 66static int X509_REVOKED_seq_cmp(const X509_REVOKED * const *a,
67 const X509_REVOKED * const *b); 67 const X509_REVOKED * const *b);
68int i2d_X509_REVOKED(X509_REVOKED *a, unsigned char **pp)
69 {
70 M_ASN1_I2D_vars(a);
71
72 M_ASN1_I2D_len(a->serialNumber,i2d_ASN1_INTEGER);
73 M_ASN1_I2D_len(a->revocationDate,i2d_ASN1_TIME);
74 M_ASN1_I2D_len_SEQUENCE_opt_ex_type(X509_EXTENSION,a->extensions,
75 i2d_X509_EXTENSION);
76
77 M_ASN1_I2D_seq_total();
78 68
79 M_ASN1_I2D_put(a->serialNumber,i2d_ASN1_INTEGER); 69ASN1_SEQUENCE(X509_REVOKED) = {
80 M_ASN1_I2D_put(a->revocationDate,i2d_ASN1_TIME); 70 ASN1_SIMPLE(X509_REVOKED,serialNumber, ASN1_INTEGER),
81 M_ASN1_I2D_put_SEQUENCE_opt_ex_type(X509_EXTENSION,a->extensions, 71 ASN1_SIMPLE(X509_REVOKED,revocationDate, ASN1_TIME),
82 i2d_X509_EXTENSION); 72 ASN1_SEQUENCE_OF_OPT(X509_REVOKED,extensions, X509_EXTENSION)
83 73} ASN1_SEQUENCE_END(X509_REVOKED)
84 M_ASN1_I2D_finish(); 74
85 } 75/* The X509_CRL_INFO structure needs a bit of customisation. This is actually
86 76 * mirroring the old behaviour: its purpose is to allow the use of
87X509_REVOKED *d2i_X509_REVOKED(X509_REVOKED **a, unsigned char **pp, 77 * sk_X509_REVOKED_find to lookup revoked certificates. Unfortunately
88 long length) 78 * this will zap the original order and the signature so we keep a copy
89 { 79 * of the original positions and reorder appropriately before encoding.
90 M_ASN1_D2I_vars(a,X509_REVOKED *,X509_REVOKED_new); 80 *
91 81 * Might want to see if there's a better way of doing this later...
92 M_ASN1_D2I_Init(); 82 */
93 M_ASN1_D2I_start_sequence(); 83static int crl_inf_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it)
94 M_ASN1_D2I_get(ret->serialNumber,d2i_ASN1_INTEGER); 84{
95 M_ASN1_D2I_get(ret->revocationDate,d2i_ASN1_TIME); 85 X509_CRL_INFO *a = (X509_CRL_INFO *)*pval;
96 M_ASN1_D2I_get_seq_opt_type(X509_EXTENSION,ret->extensions, 86 int i;
97 d2i_X509_EXTENSION,X509_EXTENSION_free);
98 M_ASN1_D2I_Finish(a,X509_REVOKED_free,ASN1_F_D2I_X509_REVOKED);
99 }
100
101int i2d_X509_CRL_INFO(X509_CRL_INFO *a, unsigned char **pp)
102 {
103 int v1=0;
104 long l=0;
105 int (*old_cmp)(const X509_REVOKED * const *, 87 int (*old_cmp)(const X509_REVOKED * const *,
106 const X509_REVOKED * const *); 88 const X509_REVOKED * const *);
107 M_ASN1_I2D_vars(a);
108
109 old_cmp=sk_X509_REVOKED_set_cmp_func(a->revoked,X509_REVOKED_seq_cmp);
110 sk_X509_REVOKED_sort(a->revoked);
111 sk_X509_REVOKED_set_cmp_func(a->revoked,old_cmp);
112
113 if ((a->version != NULL) && ((l=ASN1_INTEGER_get(a->version)) != 0))
114 {
115 M_ASN1_I2D_len(a->version,i2d_ASN1_INTEGER);
116 }
117 M_ASN1_I2D_len(a->sig_alg,i2d_X509_ALGOR);
118 M_ASN1_I2D_len(a->issuer,i2d_X509_NAME);
119 M_ASN1_I2D_len(a->lastUpdate,i2d_ASN1_TIME);
120 if (a->nextUpdate != NULL)
121 { M_ASN1_I2D_len(a->nextUpdate,i2d_ASN1_TIME); }
122 M_ASN1_I2D_len_SEQUENCE_opt_type(X509_REVOKED,a->revoked,
123 i2d_X509_REVOKED);
124 M_ASN1_I2D_len_EXP_SEQUENCE_opt_ex_type(X509_EXTENSION,a->extensions,
125 i2d_X509_EXTENSION,0,
126 V_ASN1_SEQUENCE,v1);
127
128 M_ASN1_I2D_seq_total();
129
130 if ((a->version != NULL) && (l != 0))
131 {
132 M_ASN1_I2D_put(a->version,i2d_ASN1_INTEGER);
133 }
134 M_ASN1_I2D_put(a->sig_alg,i2d_X509_ALGOR);
135 M_ASN1_I2D_put(a->issuer,i2d_X509_NAME);
136 M_ASN1_I2D_put(a->lastUpdate,i2d_ASN1_TIME);
137 if (a->nextUpdate != NULL)
138 { M_ASN1_I2D_put(a->nextUpdate,i2d_ASN1_TIME); }
139 M_ASN1_I2D_put_SEQUENCE_opt_type(X509_REVOKED,a->revoked,
140 i2d_X509_REVOKED);
141 M_ASN1_I2D_put_EXP_SEQUENCE_opt_ex_type(X509_EXTENSION,a->extensions,
142 i2d_X509_EXTENSION,0,
143 V_ASN1_SEQUENCE,v1);
144 89
145 M_ASN1_I2D_finish(); 90 if(!a || !a->revoked) return 1;
146 } 91 switch(operation) {
147 92
148X509_CRL_INFO *d2i_X509_CRL_INFO(X509_CRL_INFO **a, unsigned char **pp, 93 /* Save original order */
149 long length) 94 case ASN1_OP_D2I_POST:
150 { 95 for (i=0; i<sk_X509_REVOKED_num(a->revoked); i++)
151 int i,ver=0; 96 sk_X509_REVOKED_value(a->revoked,i)->sequence=i;
152 M_ASN1_D2I_vars(a,X509_CRL_INFO *,X509_CRL_INFO_new); 97 sk_X509_REVOKED_set_cmp_func(a->revoked,X509_REVOKED_cmp);
153 98 break;
154 99
155 M_ASN1_D2I_Init(); 100 /* Restore original order */
156 M_ASN1_D2I_start_sequence(); 101 case ASN1_OP_I2D_PRE:
157 M_ASN1_D2I_get_opt(ret->version,d2i_ASN1_INTEGER,V_ASN1_INTEGER); 102 old_cmp=sk_X509_REVOKED_set_cmp_func(a->revoked,X509_REVOKED_seq_cmp);
158 if (ret->version != NULL) 103 sk_X509_REVOKED_sort(a->revoked);
159 ver=ret->version->data[0]; 104 sk_X509_REVOKED_set_cmp_func(a->revoked,old_cmp);
160 105 break;
161 if ((ver == 0) && (ret->version != NULL))
162 {
163 M_ASN1_INTEGER_free(ret->version);
164 ret->version=NULL;
165 }
166 M_ASN1_D2I_get(ret->sig_alg,d2i_X509_ALGOR);
167 M_ASN1_D2I_get(ret->issuer,d2i_X509_NAME);
168 M_ASN1_D2I_get(ret->lastUpdate,d2i_ASN1_TIME);
169 /* Manually handle the OPTIONAL ASN1_TIME stuff */
170 /* First try UTCTime */
171 M_ASN1_D2I_get_opt(ret->nextUpdate,d2i_ASN1_UTCTIME, V_ASN1_UTCTIME);
172 /* If that doesn't work try GeneralizedTime */
173 if(!ret->nextUpdate)
174 M_ASN1_D2I_get_opt(ret->nextUpdate,d2i_ASN1_GENERALIZEDTIME,
175 V_ASN1_GENERALIZEDTIME);
176 if (ret->revoked != NULL)
177 {
178 while (sk_X509_REVOKED_num(ret->revoked))
179 X509_REVOKED_free(sk_X509_REVOKED_pop(ret->revoked));
180 }
181 M_ASN1_D2I_get_seq_opt_type(X509_REVOKED,ret->revoked,d2i_X509_REVOKED,
182 X509_REVOKED_free);
183
184 if (ret->revoked != NULL)
185 {
186 for (i=0; i<sk_X509_REVOKED_num(ret->revoked); i++)
187 {
188 sk_X509_REVOKED_value(ret->revoked,i)->sequence=i;
189 }
190 }
191
192 if (ret->extensions != NULL)
193 {
194 while (sk_X509_EXTENSION_num(ret->extensions))
195 X509_EXTENSION_free(
196 sk_X509_EXTENSION_pop(ret->extensions));
197 }
198
199 M_ASN1_D2I_get_EXP_set_opt_type(X509_EXTENSION,ret->extensions,
200 d2i_X509_EXTENSION,
201 X509_EXTENSION_free,0,
202 V_ASN1_SEQUENCE);
203
204 M_ASN1_D2I_Finish(a,X509_CRL_INFO_free,ASN1_F_D2I_X509_CRL_INFO);
205 }
206
207int i2d_X509_CRL(X509_CRL *a, unsigned char **pp)
208 {
209 M_ASN1_I2D_vars(a);
210
211 M_ASN1_I2D_len(a->crl,i2d_X509_CRL_INFO);
212 M_ASN1_I2D_len(a->sig_alg,i2d_X509_ALGOR);
213 M_ASN1_I2D_len(a->signature,i2d_ASN1_BIT_STRING);
214
215 M_ASN1_I2D_seq_total();
216
217 M_ASN1_I2D_put(a->crl,i2d_X509_CRL_INFO);
218 M_ASN1_I2D_put(a->sig_alg,i2d_X509_ALGOR);
219 M_ASN1_I2D_put(a->signature,i2d_ASN1_BIT_STRING);
220
221 M_ASN1_I2D_finish();
222 }
223
224X509_CRL *d2i_X509_CRL(X509_CRL **a, unsigned char **pp, long length)
225 {
226 M_ASN1_D2I_vars(a,X509_CRL *,X509_CRL_new);
227
228 M_ASN1_D2I_Init();
229 M_ASN1_D2I_start_sequence();
230 M_ASN1_D2I_get(ret->crl,d2i_X509_CRL_INFO);
231 M_ASN1_D2I_get(ret->sig_alg,d2i_X509_ALGOR);
232 M_ASN1_D2I_get(ret->signature,d2i_ASN1_BIT_STRING);
233
234 M_ASN1_D2I_Finish(a,X509_CRL_free,ASN1_F_D2I_X509_CRL);
235 }
236
237
238X509_REVOKED *X509_REVOKED_new(void)
239 {
240 X509_REVOKED *ret=NULL;
241 ASN1_CTX c;
242
243 M_ASN1_New_Malloc(ret,X509_REVOKED);
244 M_ASN1_New(ret->serialNumber,M_ASN1_INTEGER_new);
245 M_ASN1_New(ret->revocationDate,M_ASN1_UTCTIME_new);
246 ret->extensions=NULL;
247 return(ret);
248 M_ASN1_New_Error(ASN1_F_X509_REVOKED_NEW);
249 }
250
251X509_CRL_INFO *X509_CRL_INFO_new(void)
252 {
253 X509_CRL_INFO *ret=NULL;
254 ASN1_CTX c;
255
256 M_ASN1_New_Malloc(ret,X509_CRL_INFO);
257 ret->version=NULL;
258 M_ASN1_New(ret->sig_alg,X509_ALGOR_new);
259 M_ASN1_New(ret->issuer,X509_NAME_new);
260 M_ASN1_New(ret->lastUpdate,M_ASN1_UTCTIME_new);
261 ret->nextUpdate=NULL;
262 M_ASN1_New(ret->revoked,sk_X509_REVOKED_new_null);
263 ret->extensions = NULL;
264 sk_X509_REVOKED_set_cmp_func(ret->revoked,X509_REVOKED_cmp);
265 return(ret);
266 M_ASN1_New_Error(ASN1_F_X509_CRL_INFO_NEW);
267 }
268
269X509_CRL *X509_CRL_new(void)
270 {
271 X509_CRL *ret=NULL;
272 ASN1_CTX c;
273
274 M_ASN1_New_Malloc(ret,X509_CRL);
275 ret->references=1;
276 M_ASN1_New(ret->crl,X509_CRL_INFO_new);
277 M_ASN1_New(ret->sig_alg,X509_ALGOR_new);
278 M_ASN1_New(ret->signature,M_ASN1_BIT_STRING_new);
279 return(ret);
280 M_ASN1_New_Error(ASN1_F_X509_CRL_NEW);
281 }
282
283void X509_REVOKED_free(X509_REVOKED *a)
284 {
285 if (a == NULL) return;
286 M_ASN1_INTEGER_free(a->serialNumber);
287 M_ASN1_UTCTIME_free(a->revocationDate);
288 sk_X509_EXTENSION_pop_free(a->extensions,X509_EXTENSION_free);
289 OPENSSL_free(a);
290 }
291
292void X509_CRL_INFO_free(X509_CRL_INFO *a)
293 {
294 if (a == NULL) return;
295 M_ASN1_INTEGER_free(a->version);
296 X509_ALGOR_free(a->sig_alg);
297 X509_NAME_free(a->issuer);
298 M_ASN1_UTCTIME_free(a->lastUpdate);
299 if (a->nextUpdate)
300 M_ASN1_UTCTIME_free(a->nextUpdate);
301 sk_X509_REVOKED_pop_free(a->revoked,X509_REVOKED_free);
302 sk_X509_EXTENSION_pop_free(a->extensions,X509_EXTENSION_free);
303 OPENSSL_free(a);
304 }
305
306void X509_CRL_free(X509_CRL *a)
307 {
308 int i;
309
310 if (a == NULL) return;
311
312 i=CRYPTO_add(&a->references,-1,CRYPTO_LOCK_X509_CRL);
313#ifdef REF_PRINT
314 REF_PRINT("X509_CRL",a);
315#endif
316 if (i > 0) return;
317#ifdef REF_CHECK
318 if (i < 0)
319 {
320 fprintf(stderr,"X509_CRL_free, bad reference count\n");
321 abort();
322 }
323#endif
324
325 X509_CRL_INFO_free(a->crl);
326 X509_ALGOR_free(a->sig_alg);
327 M_ASN1_BIT_STRING_free(a->signature);
328 OPENSSL_free(a);
329 } 106 }
107 return 1;
108}
109
110
111ASN1_SEQUENCE_cb(X509_CRL_INFO, crl_inf_cb) = {
112 ASN1_OPT(X509_CRL_INFO, version, ASN1_INTEGER),
113 ASN1_SIMPLE(X509_CRL_INFO, sig_alg, X509_ALGOR),
114 ASN1_SIMPLE(X509_CRL_INFO, issuer, X509_NAME),
115 ASN1_SIMPLE(X509_CRL_INFO, lastUpdate, ASN1_TIME),
116 ASN1_OPT(X509_CRL_INFO, nextUpdate, ASN1_TIME),
117 ASN1_SEQUENCE_OF_OPT(X509_CRL_INFO, revoked, X509_REVOKED),
118 ASN1_EXP_SEQUENCE_OF_OPT(X509_CRL_INFO, extensions, X509_EXTENSION, 0)
119} ASN1_SEQUENCE_END_cb(X509_CRL_INFO, X509_CRL_INFO)
120
121ASN1_SEQUENCE_ref(X509_CRL, 0, CRYPTO_LOCK_X509_CRL) = {
122 ASN1_SIMPLE(X509_CRL, crl, X509_CRL_INFO),
123 ASN1_SIMPLE(X509_CRL, sig_alg, X509_ALGOR),
124 ASN1_SIMPLE(X509_CRL, signature, ASN1_BIT_STRING)
125} ASN1_SEQUENCE_END_ref(X509_CRL, X509_CRL)
126
127IMPLEMENT_ASN1_FUNCTIONS(X509_REVOKED)
128IMPLEMENT_ASN1_FUNCTIONS(X509_CRL_INFO)
129IMPLEMENT_ASN1_FUNCTIONS(X509_CRL)
130IMPLEMENT_ASN1_DUP_FUNCTION(X509_CRL)
330 131
331static int X509_REVOKED_cmp(const X509_REVOKED * const *a, 132static int X509_REVOKED_cmp(const X509_REVOKED * const *a,
332 const X509_REVOKED * const *b) 133 const X509_REVOKED * const *b)
@@ -342,6 +143,19 @@ static int X509_REVOKED_seq_cmp(const X509_REVOKED * const *a,
342 return((*a)->sequence-(*b)->sequence); 143 return((*a)->sequence-(*b)->sequence);
343 } 144 }
344 145
146int X509_CRL_add0_revoked(X509_CRL *crl, X509_REVOKED *rev)
147{
148 X509_CRL_INFO *inf;
149 inf = crl->crl;
150 if(!inf->revoked)
151 inf->revoked = sk_X509_REVOKED_new(X509_REVOKED_cmp);
152 if(!inf->revoked || !sk_X509_REVOKED_push(inf->revoked, rev)) {
153 ASN1err(ASN1_F_X509_CRL_ADD0_REVOKED, ERR_R_MALLOC_FAILURE);
154 return 0;
155 }
156 return 1;
157}
158
345IMPLEMENT_STACK_OF(X509_REVOKED) 159IMPLEMENT_STACK_OF(X509_REVOKED)
346IMPLEMENT_ASN1_SET_OF(X509_REVOKED) 160IMPLEMENT_ASN1_SET_OF(X509_REVOKED)
347IMPLEMENT_STACK_OF(X509_CRL) 161IMPLEMENT_STACK_OF(X509_CRL)
diff --git a/src/lib/libcrypto/asn1/x_exten.c b/src/lib/libcrypto/asn1/x_exten.c
index fbfd963b40..702421b6c8 100644
--- a/src/lib/libcrypto/asn1/x_exten.c
+++ b/src/lib/libcrypto/asn1/x_exten.c
@@ -1,139 +1,71 @@
1/* crypto/asn1/x_exten.c */ 1/* x_exten.c */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Written by Dr Stephen N Henson (shenson@bigfoot.com) for the OpenSSL
3 * All rights reserved. 3 * project 2000.
4 */
5/* ====================================================================
6 * Copyright (c) 2000 The OpenSSL Project. All rights reserved.
4 * 7 *
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 8 * Redistribution and use in source and binary forms, with or without
24 * modification, are permitted provided that the following conditions 9 * modification, are permitted provided that the following conditions
25 * are met: 10 * are met:
26 * 1. Redistributions of source code must retain the copyright 11 *
27 * notice, this list of conditions and the following disclaimer. 12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 *
28 * 2. Redistributions in binary form must reproduce the above copyright 15 * 2. Redistributions in binary form must reproduce the above copyright
29 * notice, this list of conditions and the following disclaimer in the 16 * notice, this list of conditions and the following disclaimer in
30 * documentation and/or other materials provided with the distribution. 17 * the documentation and/or other materials provided with the
31 * 3. All advertising materials mentioning features or use of this software 18 * distribution.
32 * must display the following acknowledgement: 19 *
33 * "This product includes cryptographic software written by 20 * 3. All advertising materials mentioning features or use of this
34 * Eric Young (eay@cryptsoft.com)" 21 * software must display the following acknowledgment:
35 * The word 'cryptographic' can be left out if the rouines from the library 22 * "This product includes software developed by the OpenSSL Project
36 * being used are not cryptographic related :-). 23 * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
37 * 4. If you include any Windows specific code (or a derivative thereof) from 24 *
38 * the apps directory (application code) you must include an acknowledgement: 25 * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
39 * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" 26 * endorse or promote products derived from this software without
40 * 27 * prior written permission. For written permission, please contact
41 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND 28 * licensing@OpenSSL.org.
42 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 29 *
43 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 30 * 5. Products derived from this software may not be called "OpenSSL"
44 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 31 * nor may "OpenSSL" appear in their names without prior written
45 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 32 * permission of the OpenSSL Project.
46 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 33 *
47 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 34 * 6. Redistributions of any form whatsoever must retain the following
48 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 35 * acknowledgment:
49 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 36 * "This product includes software developed by the OpenSSL Project
50 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 37 * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
51 * SUCH DAMAGE. 38 *
52 * 39 * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
53 * The licence and distribution terms for any publically available version or 40 * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
54 * derivative of this code cannot be changed. i.e. this code cannot simply be 41 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
55 * copied and put under another distribution licence 42 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
56 * [including the GNU Public Licence.] 43 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
44 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
45 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
46 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
47 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
48 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
49 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
50 * OF THE POSSIBILITY OF SUCH DAMAGE.
51 * ====================================================================
52 *
53 * This product includes cryptographic software written by Eric Young
54 * (eay@cryptsoft.com). This product includes software written by Tim
55 * Hudson (tjh@cryptsoft.com).
56 *
57 */ 57 */
58 58
59#include <stdio.h> 59#include <stddef.h>
60#include "cryptlib.h"
61#include <openssl/objects.h>
62#include <openssl/asn1_mac.h>
63#include <openssl/x509.h> 60#include <openssl/x509.h>
61#include <openssl/asn1.h>
62#include <openssl/asn1t.h>
64 63
65int i2d_X509_EXTENSION(X509_EXTENSION *a, unsigned char **pp) 64ASN1_SEQUENCE(X509_EXTENSION) = {
66 { 65 ASN1_SIMPLE(X509_EXTENSION, object, ASN1_OBJECT),
67 int k=0; 66 ASN1_OPT(X509_EXTENSION, critical, ASN1_BOOLEAN),
68 int r=0,ret=0; 67 ASN1_SIMPLE(X509_EXTENSION, value, ASN1_OCTET_STRING)
69 unsigned char **p=NULL; 68} ASN1_SEQUENCE_END(X509_EXTENSION)
70
71 if (a == NULL) return(0);
72
73 p=NULL;
74 for (;;)
75 {
76 if (k)
77 {
78 r=ASN1_object_size(1,ret,V_ASN1_SEQUENCE);
79 if (pp == NULL) return(r);
80 p=pp;
81 ASN1_put_object(p,1,ret,V_ASN1_SEQUENCE,
82 V_ASN1_UNIVERSAL);
83 }
84
85 ret+=i2d_ASN1_OBJECT(a->object,p);
86 if ((a->critical) || a->netscape_hack)
87 ret+=i2d_ASN1_BOOLEAN(a->critical,p);
88 ret+=i2d_ASN1_OCTET_STRING(a->value,p);
89 if (k++) return(r);
90 }
91 }
92
93X509_EXTENSION *d2i_X509_EXTENSION(X509_EXTENSION **a, unsigned char **pp,
94 long length)
95 {
96 int i;
97 M_ASN1_D2I_vars(a,X509_EXTENSION *,X509_EXTENSION_new);
98
99 M_ASN1_D2I_Init();
100 M_ASN1_D2I_start_sequence();
101 M_ASN1_D2I_get(ret->object,d2i_ASN1_OBJECT);
102
103 ret->netscape_hack=0;
104 if ((c.slen != 0) &&
105 (M_ASN1_next == (V_ASN1_UNIVERSAL|V_ASN1_BOOLEAN)))
106 {
107 c.q=c.p;
108 if (d2i_ASN1_BOOLEAN(&i,&c.p,c.slen) < 0) goto err;
109 ret->critical=i;
110 c.slen-=(c.p-c.q);
111 if (ret->critical == 0) ret->netscape_hack=1;
112 }
113 M_ASN1_D2I_get(ret->value,d2i_ASN1_OCTET_STRING);
114
115 M_ASN1_D2I_Finish(a,X509_EXTENSION_free,ASN1_F_D2I_X509_EXTENSION);
116 }
117
118X509_EXTENSION *X509_EXTENSION_new(void)
119 {
120 X509_EXTENSION *ret=NULL;
121 ASN1_CTX c;
122
123 M_ASN1_New_Malloc(ret,X509_EXTENSION);
124 ret->object=OBJ_nid2obj(NID_undef);
125 M_ASN1_New(ret->value,M_ASN1_OCTET_STRING_new);
126 ret->critical=0;
127 ret->netscape_hack=0;
128 return(ret);
129 M_ASN1_New_Error(ASN1_F_X509_EXTENSION_NEW);
130 }
131
132void X509_EXTENSION_free(X509_EXTENSION *a)
133 {
134 if (a == NULL) return;
135 ASN1_OBJECT_free(a->object);
136 M_ASN1_OCTET_STRING_free(a->value);
137 OPENSSL_free(a);
138 }
139 69
70IMPLEMENT_ASN1_FUNCTIONS(X509_EXTENSION)
71IMPLEMENT_ASN1_DUP_FUNCTION(X509_EXTENSION)
diff --git a/src/lib/libcrypto/asn1/x_info.c b/src/lib/libcrypto/asn1/x_info.c
index 5e62fc2f6f..d44f6cdb01 100644
--- a/src/lib/libcrypto/asn1/x_info.c
+++ b/src/lib/libcrypto/asn1/x_info.c
@@ -59,7 +59,7 @@
59#include <stdio.h> 59#include <stdio.h>
60#include "cryptlib.h" 60#include "cryptlib.h"
61#include <openssl/evp.h> 61#include <openssl/evp.h>
62#include <openssl/asn1_mac.h> 62#include <openssl/asn1.h>
63#include <openssl/x509.h> 63#include <openssl/x509.h>
64 64
65X509_INFO *X509_INFO_new(void) 65X509_INFO *X509_INFO_new(void)
diff --git a/src/lib/libcrypto/asn1/x_long.c b/src/lib/libcrypto/asn1/x_long.c
new file mode 100644
index 0000000000..c5f25956cb
--- /dev/null
+++ b/src/lib/libcrypto/asn1/x_long.c
@@ -0,0 +1,169 @@
1/* x_long.c */
2/* Written by Dr Stephen N Henson (shenson@bigfoot.com) for the OpenSSL
3 * project 2000.
4 */
5/* ====================================================================
6 * Copyright (c) 2000 The OpenSSL Project. All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 *
12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 *
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in
17 * the documentation and/or other materials provided with the
18 * distribution.
19 *
20 * 3. All advertising materials mentioning features or use of this
21 * software must display the following acknowledgment:
22 * "This product includes software developed by the OpenSSL Project
23 * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
24 *
25 * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
26 * endorse or promote products derived from this software without
27 * prior written permission. For written permission, please contact
28 * licensing@OpenSSL.org.
29 *
30 * 5. Products derived from this software may not be called "OpenSSL"
31 * nor may "OpenSSL" appear in their names without prior written
32 * permission of the OpenSSL Project.
33 *
34 * 6. Redistributions of any form whatsoever must retain the following
35 * acknowledgment:
36 * "This product includes software developed by the OpenSSL Project
37 * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
38 *
39 * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
40 * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
41 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
42 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
43 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
44 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
45 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
46 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
47 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
48 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
49 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
50 * OF THE POSSIBILITY OF SUCH DAMAGE.
51 * ====================================================================
52 *
53 * This product includes cryptographic software written by Eric Young
54 * (eay@cryptsoft.com). This product includes software written by Tim
55 * Hudson (tjh@cryptsoft.com).
56 *
57 */
58
59#include <stdio.h>
60#include "cryptlib.h"
61#include <openssl/asn1t.h>
62
63/* Custom primitive type for long handling. This converts between an ASN1_INTEGER
64 * and a long directly.
65 */
66
67
68static int long_new(ASN1_VALUE **pval, const ASN1_ITEM *it);
69static void long_free(ASN1_VALUE **pval, const ASN1_ITEM *it);
70
71static int long_i2c(ASN1_VALUE **pval, unsigned char *cont, int *putype, 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);
73
74static ASN1_PRIMITIVE_FUNCS long_pf = {
75 NULL, 0,
76 long_new,
77 long_free,
78 long_free, /* Clear should set to initial value */
79 long_c2i,
80 long_i2c
81};
82
83ASN1_ITEM_start(LONG)
84 ASN1_ITYPE_PRIMITIVE, V_ASN1_INTEGER, NULL, 0, &long_pf, ASN1_LONG_UNDEF, "LONG"
85ASN1_ITEM_end(LONG)
86
87ASN1_ITEM_start(ZLONG)
88 ASN1_ITYPE_PRIMITIVE, V_ASN1_INTEGER, NULL, 0, &long_pf, 0, "ZLONG"
89ASN1_ITEM_end(ZLONG)
90
91static int long_new(ASN1_VALUE **pval, const ASN1_ITEM *it)
92{
93 *(long *)pval = it->size;
94 return 1;
95}
96
97static void long_free(ASN1_VALUE **pval, const ASN1_ITEM *it)
98{
99 *(long *)pval = it->size;
100}
101
102static int long_i2c(ASN1_VALUE **pval, unsigned char *cont, int *putype, const ASN1_ITEM *it)
103{
104 long ltmp;
105 unsigned long utmp;
106 int clen, pad, i;
107 /* this exists to bypass broken gcc optimization */
108 char *cp = (char *)pval;
109
110 /* use memcpy, because we may not be long aligned */
111 memcpy(&ltmp, cp, sizeof(long));
112
113 if(ltmp == it->size) return -1;
114 /* Convert the long to positive: we subtract one if negative so
115 * we can cleanly handle the padding if only the MSB of the leading
116 * octet is set.
117 */
118 if(ltmp < 0) utmp = -ltmp - 1;
119 else utmp = ltmp;
120 clen = BN_num_bits_word(utmp);
121 /* If MSB of leading octet set we need to pad */
122 if(!(clen & 0x7)) pad = 1;
123 else pad = 0;
124
125 /* Convert number of bits to number of octets */
126 clen = (clen + 7) >> 3;
127
128 if(cont) {
129 if(pad) *cont++ = (ltmp < 0) ? 0xff : 0;
130 for(i = clen - 1; i >= 0; i--) {
131 cont[i] = (unsigned char)(utmp & 0xff);
132 if(ltmp < 0) cont[i] ^= 0xff;
133 utmp >>= 8;
134 }
135 }
136 return clen + pad;
137}
138
139static int long_c2i(ASN1_VALUE **pval, unsigned char *cont, int len, int utype, char *free_cont, const ASN1_ITEM *it)
140{
141 int neg, i;
142 long ltmp;
143 unsigned long utmp = 0;
144 char *cp = (char *)pval;
145 if(len > sizeof(long)) {
146 ASN1err(ASN1_F_LONG_C2I, ASN1_R_INTEGER_TOO_LARGE_FOR_LONG);
147 return 0;
148 }
149 /* Is it negative? */
150 if(len && (cont[0] & 0x80)) neg = 1;
151 else neg = 0;
152 utmp = 0;
153 for(i = 0; i < len; i++) {
154 utmp <<= 8;
155 if(neg) utmp |= cont[i] ^ 0xff;
156 else utmp |= cont[i];
157 }
158 ltmp = (long)utmp;
159 if(neg) {
160 ltmp++;
161 ltmp = -ltmp;
162 }
163 if(ltmp == it->size) {
164 ASN1err(ASN1_F_LONG_C2I, ASN1_R_INTEGER_TOO_LARGE_FOR_LONG);
165 return 0;
166 }
167 memcpy(cp, &ltmp, sizeof(long));
168 return 1;
169}
diff --git a/src/lib/libcrypto/asn1/x_name.c b/src/lib/libcrypto/asn1/x_name.c
index 1885d699ef..caece0f158 100644
--- a/src/lib/libcrypto/asn1/x_name.c
+++ b/src/lib/libcrypto/asn1/x_name.c
@@ -58,212 +58,203 @@
58 58
59#include <stdio.h> 59#include <stdio.h>
60#include "cryptlib.h" 60#include "cryptlib.h"
61#include <openssl/objects.h> 61#include <openssl/asn1t.h>
62#include <openssl/asn1_mac.h>
63#include <openssl/x509.h> 62#include <openssl/x509.h>
64 63
65static int i2d_X509_NAME_entries(X509_NAME *a); 64static int x509_name_ex_d2i(ASN1_VALUE **val, unsigned char **in, long len, const ASN1_ITEM *it,
66int i2d_X509_NAME_ENTRY(X509_NAME_ENTRY *a, unsigned char **pp) 65 int tag, int aclass, char opt, ASN1_TLC *ctx);
67 {
68 M_ASN1_I2D_vars(a);
69 66
70 M_ASN1_I2D_len(a->object,i2d_ASN1_OBJECT); 67static int x509_name_ex_i2d(ASN1_VALUE **val, unsigned char **out, const ASN1_ITEM *it, int tag, int aclass);
71 M_ASN1_I2D_len(a->value,i2d_ASN1_PRINTABLE); 68static int x509_name_ex_new(ASN1_VALUE **val, const ASN1_ITEM *it);
69static void x509_name_ex_free(ASN1_VALUE **val, const ASN1_ITEM *it);
72 70
73 M_ASN1_I2D_seq_total(); 71static int x509_name_encode(X509_NAME *a);
74 72
75 M_ASN1_I2D_put(a->object,i2d_ASN1_OBJECT); 73ASN1_SEQUENCE(X509_NAME_ENTRY) = {
76 M_ASN1_I2D_put(a->value,i2d_ASN1_PRINTABLE); 74 ASN1_SIMPLE(X509_NAME_ENTRY, object, ASN1_OBJECT),
75 ASN1_SIMPLE(X509_NAME_ENTRY, value, ASN1_PRINTABLE)
76} ASN1_SEQUENCE_END(X509_NAME_ENTRY)
77 77
78 M_ASN1_I2D_finish(); 78IMPLEMENT_ASN1_FUNCTIONS(X509_NAME_ENTRY)
79 } 79IMPLEMENT_ASN1_DUP_FUNCTION(X509_NAME_ENTRY)
80 80
81X509_NAME_ENTRY *d2i_X509_NAME_ENTRY(X509_NAME_ENTRY **a, unsigned char **pp, 81/* For the "Name" type we need a SEQUENCE OF { SET OF X509_NAME_ENTRY }
82 long length) 82 * so declare two template wrappers for this
83 { 83 */
84 M_ASN1_D2I_vars(a,X509_NAME_ENTRY *,X509_NAME_ENTRY_new);
85 84
86 M_ASN1_D2I_Init(); 85ASN1_ITEM_TEMPLATE(X509_NAME_ENTRIES) =
87 M_ASN1_D2I_start_sequence(); 86 ASN1_EX_TEMPLATE_TYPE(ASN1_TFLG_SET_OF, 0, RDNS, X509_NAME_ENTRY)
88 M_ASN1_D2I_get(ret->object,d2i_ASN1_OBJECT); 87ASN1_ITEM_TEMPLATE_END(X509_NAME_ENTRIES)
89 M_ASN1_D2I_get(ret->value,d2i_ASN1_PRINTABLE);
90 ret->set=0;
91 M_ASN1_D2I_Finish(a,X509_NAME_ENTRY_free,ASN1_F_D2I_X509_NAME_ENTRY);
92 }
93 88
94int i2d_X509_NAME(X509_NAME *a, unsigned char **pp) 89ASN1_ITEM_TEMPLATE(X509_NAME_INTERNAL) =
95 { 90 ASN1_EX_TEMPLATE_TYPE(ASN1_TFLG_SEQUENCE_OF, 0, Name, X509_NAME_ENTRIES)
96 int ret; 91ASN1_ITEM_TEMPLATE_END(X509_NAME_INTERNAL)
97 92
98 if (a == NULL) return(0); 93/* Normally that's where it would end: we'd have two nested STACK structures
99 if (a->modified) 94 * representing the ASN1. Unfortunately X509_NAME uses a completely different
100 { 95 * form and caches encodings so we have to process the internal form and convert
101 ret=i2d_X509_NAME_entries(a); 96 * to the external form.
102 if (ret < 0) return(ret); 97 */
103 }
104
105 ret=a->bytes->length;
106 if (pp != NULL)
107 {
108 memcpy(*pp,a->bytes->data,ret);
109 *pp+=ret;
110 }
111 return(ret);
112 }
113
114static int i2d_X509_NAME_entries(X509_NAME *a)
115 {
116 X509_NAME_ENTRY *ne,*fe=NULL;
117 STACK_OF(X509_NAME_ENTRY) *sk;
118 BUF_MEM *buf=NULL;
119 int set=0,r,ret=0;
120 int i;
121 unsigned char *p;
122 int size=0;
123 98
124 sk=a->entries; 99const ASN1_EXTERN_FUNCS x509_name_ff = {
125 for (i=0; i<sk_X509_NAME_ENTRY_num(sk); i++) 100 NULL,
126 { 101 x509_name_ex_new,
127 ne=sk_X509_NAME_ENTRY_value(sk,i); 102 x509_name_ex_free,
128 if (fe == NULL) 103 0, /* Default clear behaviour is OK */
129 { 104 x509_name_ex_d2i,
130 fe=ne; 105 x509_name_ex_i2d
131 size=0; 106};
132 } 107
108IMPLEMENT_EXTERN_ASN1(X509_NAME, V_ASN1_SEQUENCE, x509_name_ff)
109
110IMPLEMENT_ASN1_FUNCTIONS(X509_NAME)
111IMPLEMENT_ASN1_DUP_FUNCTION(X509_NAME)
112
113static int x509_name_ex_new(ASN1_VALUE **val, const ASN1_ITEM *it)
114{
115 X509_NAME *ret = NULL;
116 ret = OPENSSL_malloc(sizeof(X509_NAME));
117 if(!ret) goto memerr;
118 if ((ret->entries=sk_X509_NAME_ENTRY_new_null()) == NULL)
119 goto memerr;
120 if((ret->bytes = BUF_MEM_new()) == NULL) goto memerr;
121 ret->modified=1;
122 *val = (ASN1_VALUE *)ret;
123 return 1;
133 124
134 if (ne->set != set) 125 memerr:
135 { 126 ASN1err(ASN1_F_X509_NAME_NEW, ERR_R_MALLOC_FAILURE);
136 ret+=ASN1_object_size(1,size,V_ASN1_SET); 127 if (ret)
137 fe->size=size;
138 fe=ne;
139 size=0;
140 set=ne->set;
141 }
142 size+=i2d_X509_NAME_ENTRY(ne,NULL);
143 }
144 if (fe != NULL)
145 { 128 {
146 /* SET OF needed only if entries is non empty */ 129 if (ret->entries)
147 ret+=ASN1_object_size(1,size,V_ASN1_SET); 130 sk_X509_NAME_ENTRY_free(ret->entries);
148 fe->size=size; 131 OPENSSL_free(ret);
149 } 132 }
133 return 0;
134}
150 135
151 r=ASN1_object_size(1,ret,V_ASN1_SEQUENCE); 136static void x509_name_ex_free(ASN1_VALUE **pval, const ASN1_ITEM *it)
152 137{
153 buf=a->bytes; 138 X509_NAME *a;
154 if (!BUF_MEM_grow(buf,r)) goto err; 139 if(!pval || !*pval)
155 p=(unsigned char *)buf->data; 140 return;
156 141 a = (X509_NAME *)*pval;
157 ASN1_put_object(&p,1,ret,V_ASN1_SEQUENCE,V_ASN1_UNIVERSAL);
158
159 set= -1;
160 for (i=0; i<sk_X509_NAME_ENTRY_num(sk); i++)
161 {
162 ne=sk_X509_NAME_ENTRY_value(sk,i);
163 if (set != ne->set)
164 {
165 set=ne->set;
166 ASN1_put_object(&p,1,ne->size,
167 V_ASN1_SET,V_ASN1_UNIVERSAL);
168 }
169 i2d_X509_NAME_ENTRY(ne,&p);
170 }
171 a->modified=0;
172 return(r);
173err:
174 return(-1);
175 }
176 142
177X509_NAME *d2i_X509_NAME(X509_NAME **a, unsigned char **pp, long length) 143 BUF_MEM_free(a->bytes);
178 { 144 sk_X509_NAME_ENTRY_pop_free(a->entries,X509_NAME_ENTRY_free);
179 int set=0,i; 145 OPENSSL_free(a);
180 int idx=0; 146 *pval = NULL;
181 unsigned char *orig; 147}
182 M_ASN1_D2I_vars(a,X509_NAME *,X509_NAME_new);
183 148
184 orig= *pp; 149/* Used with sk_pop_free() to free up the internal representation.
185 if (sk_X509_NAME_ENTRY_num(ret->entries) > 0) 150 * NB: we only free the STACK and not its contents because it is
186 { 151 * already present in the X509_NAME structure.
187 while (sk_X509_NAME_ENTRY_num(ret->entries) > 0) 152 */
188 X509_NAME_ENTRY_free(
189 sk_X509_NAME_ENTRY_pop(ret->entries));
190 }
191 153
192 M_ASN1_D2I_Init(); 154static void sk_internal_free(void *a)
193 M_ASN1_D2I_start_sequence(); 155{
194 for (;;) 156 sk_free(a);
195 { 157}
196 if (M_ASN1_D2I_end_sequence()) break; 158
197 M_ASN1_D2I_get_set_type(X509_NAME_ENTRY,ret->entries, 159static int x509_name_ex_d2i(ASN1_VALUE **val, unsigned char **in, long len, const ASN1_ITEM *it,
198 d2i_X509_NAME_ENTRY, 160 int tag, int aclass, char opt, ASN1_TLC *ctx)
199 X509_NAME_ENTRY_free); 161{
200 for (; idx < sk_X509_NAME_ENTRY_num(ret->entries); idx++) 162 unsigned char *p = *in, *q;
201 { 163 STACK *intname = NULL;
202 sk_X509_NAME_ENTRY_value(ret->entries,idx)->set=set; 164 int i, j, ret;
203 } 165 X509_NAME *nm = NULL;
204 set++; 166 STACK_OF(X509_NAME_ENTRY) *entries;
167 X509_NAME_ENTRY *entry;
168 q = p;
169
170 /* Get internal representation of Name */
171 ret = ASN1_item_ex_d2i((ASN1_VALUE **)&intname, &p, len, ASN1_ITEM_rptr(X509_NAME_INTERNAL),
172 tag, aclass, opt, ctx);
173
174 if(ret <= 0) return ret;
175
176 if(*val) x509_name_ex_free(val, NULL);
177 if(!x509_name_ex_new((ASN1_VALUE **)&nm, NULL)) goto err;
178 /* We've decoded it: now cache encoding */
179 if(!BUF_MEM_grow(nm->bytes, p - q)) goto err;
180 memcpy(nm->bytes->data, q, p - q);
181
182 /* Convert internal representation to X509_NAME structure */
183 for(i = 0; i < sk_num(intname); i++) {
184 entries = (STACK_OF(X509_NAME_ENTRY) *)sk_value(intname, i);
185 for(j = 0; j < sk_X509_NAME_ENTRY_num(entries); j++) {
186 entry = sk_X509_NAME_ENTRY_value(entries, j);
187 entry->set = i;
188 if(!sk_X509_NAME_ENTRY_push(nm->entries, entry))
189 goto err;
205 } 190 }
206 191 sk_X509_NAME_ENTRY_free(entries);
207 i=(int)(c.p-orig);
208 if (!BUF_MEM_grow(ret->bytes,i)) goto err;
209 memcpy(ret->bytes->data,orig,i);
210 ret->bytes->length=i;
211 ret->modified=0;
212
213 M_ASN1_D2I_Finish(a,X509_NAME_free,ASN1_F_D2I_X509_NAME);
214 } 192 }
215 193 sk_free(intname);
216X509_NAME *X509_NAME_new(void) 194 nm->modified = 0;
217 { 195 *val = (ASN1_VALUE *)nm;
218 X509_NAME *ret=NULL; 196 *in = p;
219 ASN1_CTX c; 197 return ret;
220 198 err:
221 M_ASN1_New_Malloc(ret,X509_NAME); 199 ASN1err(ASN1_F_D2I_X509_NAME, ERR_R_NESTED_ASN1_ERROR);
222 if ((ret->entries=sk_X509_NAME_ENTRY_new_null()) == NULL) 200 return 0;
223 { c.line=__LINE__; goto err2; } 201}
224 M_ASN1_New(ret->bytes,BUF_MEM_new); 202
225 ret->modified=1; 203static int x509_name_ex_i2d(ASN1_VALUE **val, unsigned char **out, const ASN1_ITEM *it, int tag, int aclass)
226 return(ret); 204{
227 M_ASN1_New_Error(ASN1_F_X509_NAME_NEW); 205 int ret;
206 X509_NAME *a = (X509_NAME *)*val;
207 if(a->modified) {
208 ret = x509_name_encode((X509_NAME *)a);
209 if(ret < 0) return ret;
228 } 210 }
229 211 ret = a->bytes->length;
230X509_NAME_ENTRY *X509_NAME_ENTRY_new(void) 212 if(out != NULL) {
231 { 213 memcpy(*out,a->bytes->data,ret);
232 X509_NAME_ENTRY *ret=NULL; 214 *out+=ret;
233 ASN1_CTX c;
234
235 M_ASN1_New_Malloc(ret,X509_NAME_ENTRY);
236/* M_ASN1_New(ret->object,ASN1_OBJECT_new);*/
237 ret->object=NULL;
238 ret->set=0;
239 M_ASN1_New(ret->value,ASN1_STRING_new);
240 return(ret);
241 M_ASN1_New_Error(ASN1_F_X509_NAME_ENTRY_NEW);
242 } 215 }
216 return ret;
217}
243 218
244void X509_NAME_free(X509_NAME *a) 219static int x509_name_encode(X509_NAME *a)
245 { 220{
246 if(a == NULL) 221 STACK *intname = NULL;
247 return; 222 int len;
248 223 unsigned char *p;
249 BUF_MEM_free(a->bytes); 224 STACK_OF(X509_NAME_ENTRY) *entries = NULL;
250 sk_X509_NAME_ENTRY_pop_free(a->entries,X509_NAME_ENTRY_free); 225 X509_NAME_ENTRY *entry;
251 OPENSSL_free(a); 226 int i, set = -1;
227 intname = sk_new_null();
228 if(!intname) goto memerr;
229 for(i = 0; i < sk_X509_NAME_ENTRY_num(a->entries); i++) {
230 entry = sk_X509_NAME_ENTRY_value(a->entries, i);
231 if(entry->set != set) {
232 entries = sk_X509_NAME_ENTRY_new_null();
233 if(!entries) goto memerr;
234 if(!sk_push(intname, (char *)entries)) goto memerr;
235 set = entry->set;
236 }
237 if(!sk_X509_NAME_ENTRY_push(entries, entry)) goto memerr;
252 } 238 }
239 len = ASN1_item_ex_i2d((ASN1_VALUE **)&intname, NULL, ASN1_ITEM_rptr(X509_NAME_INTERNAL), -1, -1);
240 if (!BUF_MEM_grow(a->bytes,len)) goto memerr;
241 p=(unsigned char *)a->bytes->data;
242 ASN1_item_ex_i2d((ASN1_VALUE **)&intname, &p, ASN1_ITEM_rptr(X509_NAME_INTERNAL), -1, -1);
243 sk_pop_free(intname, sk_internal_free);
244 a->modified = 0;
245 return len;
246 memerr:
247 sk_pop_free(intname, sk_internal_free);
248 ASN1err(ASN1_F_D2I_X509_NAME, ERR_R_MALLOC_FAILURE);
249 return -1;
250}
253 251
254void X509_NAME_ENTRY_free(X509_NAME_ENTRY *a)
255 {
256 if (a == NULL) return;
257 ASN1_OBJECT_free(a->object);
258 M_ASN1_BIT_STRING_free(a->value);
259 OPENSSL_free(a);
260 }
261 252
262int X509_NAME_set(X509_NAME **xn, X509_NAME *name) 253int X509_NAME_set(X509_NAME **xn, X509_NAME *name)
263 { 254 {
264 X509_NAME *in; 255 X509_NAME *in;
265 256
266 if (*xn == NULL) return(0); 257 if (!xn || !name) return(0);
267 258
268 if (*xn != name) 259 if (*xn != name)
269 { 260 {
diff --git a/src/lib/libcrypto/asn1/x_pubkey.c b/src/lib/libcrypto/asn1/x_pubkey.c
index 4397a404b5..55630294b6 100644
--- a/src/lib/libcrypto/asn1/x_pubkey.c
+++ b/src/lib/libcrypto/asn1/x_pubkey.c
@@ -58,62 +58,25 @@
58 58
59#include <stdio.h> 59#include <stdio.h>
60#include "cryptlib.h" 60#include "cryptlib.h"
61#include <openssl/asn1_mac.h> 61#include <openssl/asn1t.h>
62#include <openssl/x509.h> 62#include <openssl/x509.h>
63 63
64int i2d_X509_PUBKEY(X509_PUBKEY *a, unsigned char **pp) 64/* Minor tweak to operation: free up EVP_PKEY */
65 { 65static int pubkey_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it)
66 M_ASN1_I2D_vars(a); 66{
67 67 if(operation == ASN1_OP_FREE_POST) {
68 M_ASN1_I2D_len(a->algor, i2d_X509_ALGOR); 68 X509_PUBKEY *pubkey = (X509_PUBKEY *)*pval;
69 M_ASN1_I2D_len(a->public_key, i2d_ASN1_BIT_STRING); 69 EVP_PKEY_free(pubkey->pkey);
70
71 M_ASN1_I2D_seq_total();
72
73 M_ASN1_I2D_put(a->algor, i2d_X509_ALGOR);
74 M_ASN1_I2D_put(a->public_key, i2d_ASN1_BIT_STRING);
75
76 M_ASN1_I2D_finish();
77 }
78
79X509_PUBKEY *d2i_X509_PUBKEY(X509_PUBKEY **a, unsigned char **pp,
80 long length)
81 {
82 M_ASN1_D2I_vars(a,X509_PUBKEY *,X509_PUBKEY_new);
83
84 M_ASN1_D2I_Init();
85 M_ASN1_D2I_start_sequence();
86 M_ASN1_D2I_get(ret->algor,d2i_X509_ALGOR);
87 M_ASN1_D2I_get(ret->public_key,d2i_ASN1_BIT_STRING);
88 if (ret->pkey != NULL)
89 {
90 EVP_PKEY_free(ret->pkey);
91 ret->pkey=NULL;
92 }
93 M_ASN1_D2I_Finish(a,X509_PUBKEY_free,ASN1_F_D2I_X509_PUBKEY);
94 } 70 }
71 return 1;
72}
95 73
96X509_PUBKEY *X509_PUBKEY_new(void) 74ASN1_SEQUENCE_cb(X509_PUBKEY, pubkey_cb) = {
97 { 75 ASN1_SIMPLE(X509_PUBKEY, algor, X509_ALGOR),
98 X509_PUBKEY *ret=NULL; 76 ASN1_SIMPLE(X509_PUBKEY, public_key, ASN1_BIT_STRING)
99 ASN1_CTX c; 77} ASN1_SEQUENCE_END_cb(X509_PUBKEY, X509_PUBKEY)
100
101 M_ASN1_New_Malloc(ret,X509_PUBKEY);
102 M_ASN1_New(ret->algor,X509_ALGOR_new);
103 M_ASN1_New(ret->public_key,M_ASN1_BIT_STRING_new);
104 ret->pkey=NULL;
105 return(ret);
106 M_ASN1_New_Error(ASN1_F_X509_PUBKEY_NEW);
107 }
108 78
109void X509_PUBKEY_free(X509_PUBKEY *a) 79IMPLEMENT_ASN1_FUNCTIONS(X509_PUBKEY)
110 {
111 if (a == NULL) return;
112 X509_ALGOR_free(a->algor);
113 M_ASN1_BIT_STRING_free(a->public_key);
114 if (a->pkey != NULL) EVP_PKEY_free(a->pkey);
115 OPENSSL_free(a);
116 }
117 80
118int X509_PUBKEY_set(X509_PUBKEY **x, EVP_PKEY *pkey) 81int X509_PUBKEY_set(X509_PUBKEY **x, EVP_PKEY *pkey)
119 { 82 {
@@ -146,7 +109,7 @@ int X509_PUBKEY_set(X509_PUBKEY **x, EVP_PKEY *pkey)
146 } 109 }
147 } 110 }
148 else 111 else
149#ifndef NO_DSA 112#ifndef OPENSSL_NO_DSA
150 if (pkey->type == EVP_PKEY_DSA) 113 if (pkey->type == EVP_PKEY_DSA)
151 { 114 {
152 unsigned char *pp; 115 unsigned char *pp;
@@ -206,7 +169,8 @@ EVP_PKEY *X509_PUBKEY_get(X509_PUBKEY *key)
206 long j; 169 long j;
207 int type; 170 int type;
208 unsigned char *p; 171 unsigned char *p;
209#ifndef NO_DSA 172#ifndef OPENSSL_NO_DSA
173 const unsigned char *cp;
210 X509_ALGOR *a; 174 X509_ALGOR *a;
211#endif 175#endif
212 176
@@ -230,16 +194,16 @@ EVP_PKEY *X509_PUBKEY_get(X509_PUBKEY *key)
230 } 194 }
231 ret->save_parameters=0; 195 ret->save_parameters=0;
232 196
233#ifndef NO_DSA 197#ifndef OPENSSL_NO_DSA
234 a=key->algor; 198 a=key->algor;
235 if (ret->type == EVP_PKEY_DSA) 199 if (ret->type == EVP_PKEY_DSA)
236 { 200 {
237 if (a->parameter && (a->parameter->type == V_ASN1_SEQUENCE)) 201 if (a->parameter && (a->parameter->type == V_ASN1_SEQUENCE))
238 { 202 {
239 ret->pkey.dsa->write_params=0; 203 ret->pkey.dsa->write_params=0;
240 p=a->parameter->value.sequence->data; 204 cp=p=a->parameter->value.sequence->data;
241 j=a->parameter->value.sequence->length; 205 j=a->parameter->value.sequence->length;
242 if (!d2i_DSAparams(&ret->pkey.dsa,&p,(long)j)) 206 if (!d2i_DSAparams(&ret->pkey.dsa,&cp,(long)j))
243 goto err; 207 goto err;
244 } 208 }
245 ret->save_parameters=1; 209 ret->save_parameters=1;
@@ -289,7 +253,7 @@ int i2d_PUBKEY(EVP_PKEY *a, unsigned char **pp)
289/* The following are equivalents but which return RSA and DSA 253/* The following are equivalents but which return RSA and DSA
290 * keys 254 * keys
291 */ 255 */
292#ifndef NO_RSA 256#ifndef OPENSSL_NO_RSA
293RSA *d2i_RSA_PUBKEY(RSA **a, unsigned char **pp, 257RSA *d2i_RSA_PUBKEY(RSA **a, unsigned char **pp,
294 long length) 258 long length)
295{ 259{
@@ -327,7 +291,7 @@ int i2d_RSA_PUBKEY(RSA *a, unsigned char **pp)
327} 291}
328#endif 292#endif
329 293
330#ifndef NO_DSA 294#ifndef OPENSSL_NO_DSA
331DSA *d2i_DSA_PUBKEY(DSA **a, unsigned char **pp, 295DSA *d2i_DSA_PUBKEY(DSA **a, unsigned char **pp,
332 long length) 296 long length)
333{ 297{
diff --git a/src/lib/libcrypto/asn1/x_req.c b/src/lib/libcrypto/asn1/x_req.c
index 6dddd4f653..b3f18ebc12 100644
--- a/src/lib/libcrypto/asn1/x_req.c
+++ b/src/lib/libcrypto/asn1/x_req.c
@@ -58,200 +58,55 @@
58 58
59#include <stdio.h> 59#include <stdio.h>
60#include "cryptlib.h" 60#include "cryptlib.h"
61#include <openssl/asn1_mac.h> 61#include <openssl/asn1t.h>
62#include <openssl/x509.h> 62#include <openssl/x509.h>
63 63
64int i2d_X509_REQ_INFO(X509_REQ_INFO *a, unsigned char **pp) 64/* X509_REQ_INFO is handled in an unusual way to get round
65 { 65 * invalid encodings. Some broken certificate requests don't
66 M_ASN1_I2D_vars(a); 66 * encode the attributes field if it is empty. This is in
67 67 * violation of PKCS#10 but we need to tolerate it. We do
68 if(a->asn1) { 68 * this by making the attributes field OPTIONAL then using
69 if(pp) { 69 * the callback to initialise it to an empty STACK.
70 memcpy(*pp, a->asn1, a->length); 70 *
71 *pp += a->length; 71 * This means that the field will be correctly encoded unless
72 } 72 * we NULL out the field.
73 return a->length; 73 *
74 } 74 * As a result we no longer need the req_kludge field because
75 75 * the information is now contained in the attributes field:
76 M_ASN1_I2D_len(a->version, i2d_ASN1_INTEGER); 76 * 1. If it is NULL then it's the invalid omission.
77 M_ASN1_I2D_len(a->subject, i2d_X509_NAME); 77 * 2. If it is empty it is the correct encoding.
78 M_ASN1_I2D_len(a->pubkey, i2d_X509_PUBKEY); 78 * 3. If it is not empty then some attributes are present.
79 79 *
80 /* this is a *nasty* hack reported to be required to 80 */
81 * allow some CA Software to accept the cert request.
82 * It is not following the PKCS standards ...
83 * PKCS#10 pg 5
84 * attributes [0] IMPLICIT Attributes
85 * NOTE: no OPTIONAL ... so it *must* be there
86 */
87 if (a->req_kludge)
88 {
89 M_ASN1_I2D_len_IMP_SET_opt_type(X509_ATTRIBUTE,a->attributes,i2d_X509_ATTRIBUTE,0);
90 }
91 else
92 {
93 M_ASN1_I2D_len_IMP_SET_type(X509_ATTRIBUTE,a->attributes,
94 i2d_X509_ATTRIBUTE,0);
95 }
96
97 M_ASN1_I2D_seq_total();
98 M_ASN1_I2D_put(a->version, i2d_ASN1_INTEGER);
99 M_ASN1_I2D_put(a->subject, i2d_X509_NAME);
100 M_ASN1_I2D_put(a->pubkey, i2d_X509_PUBKEY);
101 81
102 /* this is a *nasty* hack reported to be required by some CA's. 82static int rinf_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it)
103 * It is not following the PKCS standards ... 83{
104 * PKCS#10 pg 5 84 X509_REQ_INFO *rinf = (X509_REQ_INFO *)*pval;
105 * attributes [0] IMPLICIT Attributes
106 * NOTE: no OPTIONAL ... so it *must* be there
107 */
108 if (a->req_kludge)
109 {
110 M_ASN1_I2D_put_IMP_SET_opt_type(X509_ATTRIBUTE,a->attributes,
111 i2d_X509_ATTRIBUTE,0);
112 }
113 else
114 {
115 M_ASN1_I2D_put_IMP_SET_type(X509_ATTRIBUTE,a->attributes,
116 i2d_X509_ATTRIBUTE,0);
117 }
118 85
119 M_ASN1_I2D_finish(); 86 if(operation == ASN1_OP_NEW_POST) {
87 rinf->attributes = sk_X509_ATTRIBUTE_new_null();
88 if(!rinf->attributes) return 0;
120 } 89 }
121 90 return 1;
122X509_REQ_INFO *d2i_X509_REQ_INFO(X509_REQ_INFO **a, unsigned char **pp, 91}
123 long length) 92
124 { 93ASN1_SEQUENCE_enc(X509_REQ_INFO, enc, rinf_cb) = {
125 M_ASN1_D2I_vars(a,X509_REQ_INFO *,X509_REQ_INFO_new); 94 ASN1_SIMPLE(X509_REQ_INFO, version, ASN1_INTEGER),
126 95 ASN1_SIMPLE(X509_REQ_INFO, subject, X509_NAME),
127 M_ASN1_D2I_Init(); 96 ASN1_SIMPLE(X509_REQ_INFO, pubkey, X509_PUBKEY),
128 M_ASN1_D2I_start_sequence(); 97 /* This isn't really OPTIONAL but it gets round invalid
129 M_ASN1_D2I_get(ret->version,d2i_ASN1_INTEGER); 98 * encodings
130 M_ASN1_D2I_get(ret->subject,d2i_X509_NAME);
131 M_ASN1_D2I_get(ret->pubkey,d2i_X509_PUBKEY);
132
133 /* this is a *nasty* hack to allow for some CA's that
134 * have been reported as requiring it.
135 * It is not following the PKCS standards ...
136 * PKCS#10 pg 5
137 * attributes [0] IMPLICIT Attributes
138 * NOTE: no OPTIONAL ... so it *must* be there
139 */ 99 */
140 if (asn1_Finish(&c)) 100 ASN1_IMP_SET_OF_OPT(X509_REQ_INFO, attributes, X509_ATTRIBUTE, 0)
141 ret->req_kludge=1; 101} ASN1_SEQUENCE_END_enc(X509_REQ_INFO, X509_REQ_INFO)
142 else
143 {
144 M_ASN1_D2I_get_IMP_set_type(X509_ATTRIBUTE,ret->attributes,
145 d2i_X509_ATTRIBUTE,
146 X509_ATTRIBUTE_free,0);
147 }
148
149 M_ASN1_D2I_Finish(a,X509_REQ_INFO_free,ASN1_F_D2I_X509_REQ_INFO);
150 }
151
152X509_REQ_INFO *X509_REQ_INFO_new(void)
153 {
154 X509_REQ_INFO *ret=NULL;
155 ASN1_CTX c;
156
157 M_ASN1_New_Malloc(ret,X509_REQ_INFO);
158 M_ASN1_New(ret->version,M_ASN1_INTEGER_new);
159 M_ASN1_New(ret->subject,X509_NAME_new);
160 M_ASN1_New(ret->pubkey,X509_PUBKEY_new);
161 M_ASN1_New(ret->attributes,sk_X509_ATTRIBUTE_new_null);
162 ret->req_kludge=0;
163 ret->asn1 = NULL;
164 return(ret);
165 M_ASN1_New_Error(ASN1_F_X509_REQ_INFO_NEW);
166 }
167
168void X509_REQ_INFO_free(X509_REQ_INFO *a)
169 {
170 if (a == NULL) return;
171 if(a->asn1) OPENSSL_free(a->asn1);
172 M_ASN1_INTEGER_free(a->version);
173 X509_NAME_free(a->subject);
174 X509_PUBKEY_free(a->pubkey);
175 sk_X509_ATTRIBUTE_pop_free(a->attributes,X509_ATTRIBUTE_free);
176 OPENSSL_free(a);
177 }
178 102
179int i2d_X509_REQ(X509_REQ *a, unsigned char **pp) 103IMPLEMENT_ASN1_FUNCTIONS(X509_REQ_INFO)
180 {
181 M_ASN1_I2D_vars(a);
182 M_ASN1_I2D_len(a->req_info, i2d_X509_REQ_INFO);
183 M_ASN1_I2D_len(a->sig_alg, i2d_X509_ALGOR);
184 M_ASN1_I2D_len(a->signature, i2d_ASN1_BIT_STRING);
185
186 M_ASN1_I2D_seq_total();
187
188 M_ASN1_I2D_put(a->req_info, i2d_X509_REQ_INFO);
189 M_ASN1_I2D_put(a->sig_alg, i2d_X509_ALGOR);
190 M_ASN1_I2D_put(a->signature, i2d_ASN1_BIT_STRING);
191
192 M_ASN1_I2D_finish();
193 }
194
195X509_REQ *d2i_X509_REQ(X509_REQ **a, unsigned char **pp, long length)
196 {
197 M_ASN1_D2I_vars(a,X509_REQ *,X509_REQ_new);
198
199 M_ASN1_D2I_Init();
200 M_ASN1_D2I_start_sequence();
201 M_ASN1_D2I_get(ret->req_info,d2i_X509_REQ_INFO);
202
203 /* Keep a copy of the original encoding for signature checking */
204 ret->req_info->length = c.p - c.q;
205 if(!(ret->req_info->asn1 = OPENSSL_malloc(ret->req_info->length))) {
206 c.line=__LINE__;
207 c.error = ERR_R_MALLOC_FAILURE;
208 goto err;
209 }
210
211 memcpy(ret->req_info->asn1, c.q, ret->req_info->length);
212
213 M_ASN1_D2I_get(ret->sig_alg,d2i_X509_ALGOR);
214 M_ASN1_D2I_get(ret->signature,d2i_ASN1_BIT_STRING);
215 M_ASN1_D2I_Finish(a,X509_REQ_free,ASN1_F_D2I_X509_REQ);
216 }
217
218X509_REQ *X509_REQ_new(void)
219 {
220 X509_REQ *ret=NULL;
221 ASN1_CTX c;
222
223 M_ASN1_New_Malloc(ret,X509_REQ);
224 ret->references=1;
225 M_ASN1_New(ret->req_info,X509_REQ_INFO_new);
226 M_ASN1_New(ret->sig_alg,X509_ALGOR_new);
227 M_ASN1_New(ret->signature,M_ASN1_BIT_STRING_new);
228 return(ret);
229 M_ASN1_New_Error(ASN1_F_X509_REQ_NEW);
230 }
231
232void X509_REQ_free(X509_REQ *a)
233 {
234 int i;
235
236 if (a == NULL) return;
237
238 i=CRYPTO_add(&a->references,-1,CRYPTO_LOCK_X509_REQ);
239#ifdef REF_PRINT
240 REF_PRINT("X509_REQ",a);
241#endif
242 if (i > 0) return;
243#ifdef REF_CHECK
244 if (i < 0)
245 {
246 fprintf(stderr,"X509_REQ_free, bad reference count\n");
247 abort();
248 }
249#endif
250
251 X509_REQ_INFO_free(a->req_info);
252 X509_ALGOR_free(a->sig_alg);
253 M_ASN1_BIT_STRING_free(a->signature);
254 OPENSSL_free(a);
255 }
256 104
105ASN1_SEQUENCE_ref(X509_REQ, 0, CRYPTO_LOCK_X509_INFO) = {
106 ASN1_SIMPLE(X509_REQ, req_info, X509_REQ_INFO),
107 ASN1_SIMPLE(X509_REQ, sig_alg, X509_ALGOR),
108 ASN1_SIMPLE(X509_REQ, signature, ASN1_BIT_STRING)
109} ASN1_SEQUENCE_END_ref(X509_REQ, X509_REQ)
257 110
111IMPLEMENT_ASN1_FUNCTIONS(X509_REQ)
112IMPLEMENT_ASN1_DUP_FUNCTION(X509_REQ)
diff --git a/src/lib/libcrypto/asn1/x_sig.c b/src/lib/libcrypto/asn1/x_sig.c
index d79f147647..42efa86c1c 100644
--- a/src/lib/libcrypto/asn1/x_sig.c
+++ b/src/lib/libcrypto/asn1/x_sig.c
@@ -58,53 +58,12 @@
58 58
59#include <stdio.h> 59#include <stdio.h>
60#include "cryptlib.h" 60#include "cryptlib.h"
61#include <openssl/asn1_mac.h> 61#include <openssl/asn1t.h>
62#include <openssl/x509.h> 62#include <openssl/x509.h>
63 63
64int i2d_X509_SIG(X509_SIG *a, unsigned char **pp) 64ASN1_SEQUENCE(X509_SIG) = {
65 { 65 ASN1_SIMPLE(X509_SIG, algor, X509_ALGOR),
66 M_ASN1_I2D_vars(a); 66 ASN1_SIMPLE(X509_SIG, digest, ASN1_OCTET_STRING)
67 67} ASN1_SEQUENCE_END(X509_SIG)
68 M_ASN1_I2D_len(a->algor, i2d_X509_ALGOR);
69 M_ASN1_I2D_len(a->digest, i2d_ASN1_OCTET_STRING);
70
71 M_ASN1_I2D_seq_total();
72
73 M_ASN1_I2D_put(a->algor, i2d_X509_ALGOR);
74 M_ASN1_I2D_put(a->digest, i2d_ASN1_OCTET_STRING);
75
76 M_ASN1_I2D_finish();
77 }
78
79X509_SIG *d2i_X509_SIG(X509_SIG **a, unsigned char **pp, long length)
80 {
81 M_ASN1_D2I_vars(a,X509_SIG *,X509_SIG_new);
82
83 M_ASN1_D2I_Init();
84 M_ASN1_D2I_start_sequence();
85 M_ASN1_D2I_get(ret->algor,d2i_X509_ALGOR);
86 M_ASN1_D2I_get(ret->digest,d2i_ASN1_OCTET_STRING);
87 M_ASN1_D2I_Finish(a,X509_SIG_free,ASN1_F_D2I_X509_SIG);
88 }
89
90X509_SIG *X509_SIG_new(void)
91 {
92 X509_SIG *ret=NULL;
93 ASN1_CTX c;
94
95 M_ASN1_New_Malloc(ret,X509_SIG);
96 M_ASN1_New(ret->algor,X509_ALGOR_new);
97 M_ASN1_New(ret->digest,M_ASN1_OCTET_STRING_new);
98 return(ret);
99 M_ASN1_New_Error(ASN1_F_X509_SIG_NEW);
100 }
101
102void X509_SIG_free(X509_SIG *a)
103 {
104 if (a == NULL) return;
105 X509_ALGOR_free(a->algor);
106 M_ASN1_OCTET_STRING_free(a->digest);
107 OPENSSL_free(a);
108 }
109
110 68
69IMPLEMENT_ASN1_FUNCTIONS(X509_SIG)
diff --git a/src/lib/libcrypto/asn1/x_spki.c b/src/lib/libcrypto/asn1/x_spki.c
index 4f01888f7d..2aece077c5 100644
--- a/src/lib/libcrypto/asn1/x_spki.c
+++ b/src/lib/libcrypto/asn1/x_spki.c
@@ -63,104 +63,19 @@
63#include <stdio.h> 63#include <stdio.h>
64#include "cryptlib.h" 64#include "cryptlib.h"
65#include <openssl/x509.h> 65#include <openssl/x509.h>
66#include <openssl/asn1_mac.h> 66#include <openssl/asn1t.h>
67 67
68int i2d_NETSCAPE_SPKAC(NETSCAPE_SPKAC *a, unsigned char **pp) 68ASN1_SEQUENCE(NETSCAPE_SPKAC) = {
69 { 69 ASN1_SIMPLE(NETSCAPE_SPKAC, pubkey, X509_PUBKEY),
70 M_ASN1_I2D_vars(a); 70 ASN1_SIMPLE(NETSCAPE_SPKAC, challenge, ASN1_IA5STRING)
71} ASN1_SEQUENCE_END(NETSCAPE_SPKAC)
71 72
72 M_ASN1_I2D_len(a->pubkey, i2d_X509_PUBKEY); 73IMPLEMENT_ASN1_FUNCTIONS(NETSCAPE_SPKAC)
73 M_ASN1_I2D_len(a->challenge, i2d_ASN1_IA5STRING);
74 74
75 M_ASN1_I2D_seq_total(); 75ASN1_SEQUENCE(NETSCAPE_SPKI) = {
76 76 ASN1_SIMPLE(NETSCAPE_SPKI, spkac, NETSCAPE_SPKAC),
77 M_ASN1_I2D_put(a->pubkey, i2d_X509_PUBKEY); 77 ASN1_SIMPLE(NETSCAPE_SPKI, sig_algor, X509_ALGOR),
78 M_ASN1_I2D_put(a->challenge, i2d_ASN1_IA5STRING); 78 ASN1_SIMPLE(NETSCAPE_SPKI, signature, ASN1_BIT_STRING)
79 79} ASN1_SEQUENCE_END(NETSCAPE_SPKI)
80 M_ASN1_I2D_finish();
81 }
82
83NETSCAPE_SPKAC *d2i_NETSCAPE_SPKAC(NETSCAPE_SPKAC **a, unsigned char **pp,
84 long length)
85 {
86 M_ASN1_D2I_vars(a,NETSCAPE_SPKAC *,NETSCAPE_SPKAC_new);
87
88 M_ASN1_D2I_Init();
89 M_ASN1_D2I_start_sequence();
90 M_ASN1_D2I_get(ret->pubkey,d2i_X509_PUBKEY);
91 M_ASN1_D2I_get(ret->challenge,d2i_ASN1_IA5STRING);
92 M_ASN1_D2I_Finish(a,NETSCAPE_SPKAC_free,ASN1_F_D2I_NETSCAPE_SPKAC);
93 }
94
95NETSCAPE_SPKAC *NETSCAPE_SPKAC_new(void)
96 {
97 NETSCAPE_SPKAC *ret=NULL;
98 ASN1_CTX c;
99
100 M_ASN1_New_Malloc(ret,NETSCAPE_SPKAC);
101 M_ASN1_New(ret->pubkey,X509_PUBKEY_new);
102 M_ASN1_New(ret->challenge,M_ASN1_IA5STRING_new);
103 return(ret);
104 M_ASN1_New_Error(ASN1_F_NETSCAPE_SPKAC_NEW);
105 }
106
107void NETSCAPE_SPKAC_free(NETSCAPE_SPKAC *a)
108 {
109 if (a == NULL) return;
110 X509_PUBKEY_free(a->pubkey);
111 M_ASN1_IA5STRING_free(a->challenge);
112 OPENSSL_free(a);
113 }
114
115int i2d_NETSCAPE_SPKI(NETSCAPE_SPKI *a, unsigned char **pp)
116 {
117 M_ASN1_I2D_vars(a);
118
119 M_ASN1_I2D_len(a->spkac, i2d_NETSCAPE_SPKAC);
120 M_ASN1_I2D_len(a->sig_algor, i2d_X509_ALGOR);
121 M_ASN1_I2D_len(a->signature, i2d_ASN1_BIT_STRING);
122
123 M_ASN1_I2D_seq_total();
124
125 M_ASN1_I2D_put(a->spkac, i2d_NETSCAPE_SPKAC);
126 M_ASN1_I2D_put(a->sig_algor, i2d_X509_ALGOR);
127 M_ASN1_I2D_put(a->signature, i2d_ASN1_BIT_STRING);
128
129 M_ASN1_I2D_finish();
130 }
131
132NETSCAPE_SPKI *d2i_NETSCAPE_SPKI(NETSCAPE_SPKI **a, unsigned char **pp,
133 long length)
134 {
135 M_ASN1_D2I_vars(a,NETSCAPE_SPKI *,NETSCAPE_SPKI_new);
136
137 M_ASN1_D2I_Init();
138 M_ASN1_D2I_start_sequence();
139 M_ASN1_D2I_get(ret->spkac,d2i_NETSCAPE_SPKAC);
140 M_ASN1_D2I_get(ret->sig_algor,d2i_X509_ALGOR);
141 M_ASN1_D2I_get(ret->signature,d2i_ASN1_BIT_STRING);
142 M_ASN1_D2I_Finish(a,NETSCAPE_SPKI_free,ASN1_F_D2I_NETSCAPE_SPKI);
143 }
144
145NETSCAPE_SPKI *NETSCAPE_SPKI_new(void)
146 {
147 NETSCAPE_SPKI *ret=NULL;
148 ASN1_CTX c;
149
150 M_ASN1_New_Malloc(ret,NETSCAPE_SPKI);
151 M_ASN1_New(ret->spkac,NETSCAPE_SPKAC_new);
152 M_ASN1_New(ret->sig_algor,X509_ALGOR_new);
153 M_ASN1_New(ret->signature,M_ASN1_BIT_STRING_new);
154 return(ret);
155 M_ASN1_New_Error(ASN1_F_NETSCAPE_SPKI_NEW);
156 }
157
158void NETSCAPE_SPKI_free(NETSCAPE_SPKI *a)
159 {
160 if (a == NULL) return;
161 NETSCAPE_SPKAC_free(a->spkac);
162 X509_ALGOR_free(a->sig_algor);
163 M_ASN1_BIT_STRING_free(a->signature);
164 OPENSSL_free(a);
165 }
166 80
81IMPLEMENT_ASN1_FUNCTIONS(NETSCAPE_SPKI)
diff --git a/src/lib/libcrypto/asn1/x_val.c b/src/lib/libcrypto/asn1/x_val.c
index 0f8f020b57..dc17c67758 100644
--- a/src/lib/libcrypto/asn1/x_val.c
+++ b/src/lib/libcrypto/asn1/x_val.c
@@ -58,52 +58,12 @@
58 58
59#include <stdio.h> 59#include <stdio.h>
60#include "cryptlib.h" 60#include "cryptlib.h"
61#include <openssl/asn1_mac.h> 61#include <openssl/asn1t.h>
62#include <openssl/x509.h> 62#include <openssl/x509.h>
63 63
64int i2d_X509_VAL(X509_VAL *a, unsigned char **pp) 64ASN1_SEQUENCE(X509_VAL) = {
65 { 65 ASN1_SIMPLE(X509_VAL, notBefore, ASN1_TIME),
66 M_ASN1_I2D_vars(a); 66 ASN1_SIMPLE(X509_VAL, notAfter, ASN1_TIME)
67 67} ASN1_SEQUENCE_END(X509_VAL)
68 M_ASN1_I2D_len(a->notBefore,i2d_ASN1_TIME);
69 M_ASN1_I2D_len(a->notAfter,i2d_ASN1_TIME);
70
71 M_ASN1_I2D_seq_total();
72
73 M_ASN1_I2D_put(a->notBefore,i2d_ASN1_TIME);
74 M_ASN1_I2D_put(a->notAfter,i2d_ASN1_TIME);
75
76 M_ASN1_I2D_finish();
77 }
78
79X509_VAL *d2i_X509_VAL(X509_VAL **a, unsigned char **pp, long length)
80 {
81 M_ASN1_D2I_vars(a,X509_VAL *,X509_VAL_new);
82
83 M_ASN1_D2I_Init();
84 M_ASN1_D2I_start_sequence();
85 M_ASN1_D2I_get(ret->notBefore,d2i_ASN1_TIME);
86 M_ASN1_D2I_get(ret->notAfter,d2i_ASN1_TIME);
87 M_ASN1_D2I_Finish(a,X509_VAL_free,ASN1_F_D2I_X509_VAL);
88 }
89
90X509_VAL *X509_VAL_new(void)
91 {
92 X509_VAL *ret=NULL;
93 ASN1_CTX c;
94
95 M_ASN1_New_Malloc(ret,X509_VAL);
96 M_ASN1_New(ret->notBefore,M_ASN1_TIME_new);
97 M_ASN1_New(ret->notAfter,M_ASN1_TIME_new);
98 return(ret);
99 M_ASN1_New_Error(ASN1_F_X509_VAL_NEW);
100 }
101
102void X509_VAL_free(X509_VAL *a)
103 {
104 if (a == NULL) return;
105 M_ASN1_TIME_free(a->notBefore);
106 M_ASN1_TIME_free(a->notAfter);
107 OPENSSL_free(a);
108 }
109 68
69IMPLEMENT_ASN1_FUNCTIONS(X509_VAL)
diff --git a/src/lib/libcrypto/asn1/x_x509.c b/src/lib/libcrypto/asn1/x_x509.c
index 61ba856b17..b50167ce43 100644
--- a/src/lib/libcrypto/asn1/x_x509.c
+++ b/src/lib/libcrypto/asn1/x_x509.c
@@ -59,12 +59,71 @@
59#include <stdio.h> 59#include <stdio.h>
60#include "cryptlib.h" 60#include "cryptlib.h"
61#include <openssl/evp.h> 61#include <openssl/evp.h>
62#include <openssl/asn1_mac.h> 62#include <openssl/asn1t.h>
63#include <openssl/x509.h> 63#include <openssl/x509.h>
64#include <openssl/x509v3.h> 64#include <openssl/x509v3.h>
65 65
66static int x509_meth_num = 0; 66ASN1_SEQUENCE(X509_CINF) = {
67static STACK_OF(CRYPTO_EX_DATA_FUNCS) *x509_meth = NULL; 67 ASN1_EXP_OPT(X509_CINF, version, ASN1_INTEGER, 0),
68 ASN1_SIMPLE(X509_CINF, serialNumber, ASN1_INTEGER),
69 ASN1_SIMPLE(X509_CINF, signature, X509_ALGOR),
70 ASN1_SIMPLE(X509_CINF, issuer, X509_NAME),
71 ASN1_SIMPLE(X509_CINF, validity, X509_VAL),
72 ASN1_SIMPLE(X509_CINF, subject, X509_NAME),
73 ASN1_SIMPLE(X509_CINF, key, X509_PUBKEY),
74 ASN1_IMP_OPT(X509_CINF, issuerUID, ASN1_BIT_STRING, 1),
75 ASN1_IMP_OPT(X509_CINF, subjectUID, ASN1_BIT_STRING, 2),
76 ASN1_EXP_SEQUENCE_OF_OPT(X509_CINF, extensions, X509_EXTENSION, 3)
77} ASN1_SEQUENCE_END(X509_CINF)
78
79IMPLEMENT_ASN1_FUNCTIONS(X509_CINF)
80/* X509 top level structure needs a bit of customisation */
81
82static int x509_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it)
83{
84 X509 *ret = (X509 *)*pval;
85
86 switch(operation) {
87
88 case ASN1_OP_NEW_POST:
89 ret->valid=0;
90 ret->name = NULL;
91 ret->ex_flags = 0;
92 ret->ex_pathlen = -1;
93 ret->skid = NULL;
94 ret->akid = NULL;
95 ret->aux = NULL;
96 CRYPTO_new_ex_data(CRYPTO_EX_INDEX_X509, ret, &ret->ex_data);
97 break;
98
99 case ASN1_OP_D2I_POST:
100 if (ret->name != NULL) OPENSSL_free(ret->name);
101 ret->name=X509_NAME_oneline(ret->cert_info->subject,NULL,0);
102 break;
103
104 case ASN1_OP_FREE_POST:
105 CRYPTO_free_ex_data(CRYPTO_EX_INDEX_X509, ret, &ret->ex_data);
106 X509_CERT_AUX_free(ret->aux);
107 ASN1_OCTET_STRING_free(ret->skid);
108 AUTHORITY_KEYID_free(ret->akid);
109
110 if (ret->name != NULL) OPENSSL_free(ret->name);
111 break;
112
113 }
114
115 return 1;
116
117}
118
119ASN1_SEQUENCE_ref(X509, x509_cb, CRYPTO_LOCK_X509) = {
120 ASN1_SIMPLE(X509, cert_info, X509_CINF),
121 ASN1_SIMPLE(X509, sig_alg, X509_ALGOR),
122 ASN1_SIMPLE(X509, signature, ASN1_BIT_STRING)
123} ASN1_SEQUENCE_END_ref(X509, X509)
124
125IMPLEMENT_ASN1_FUNCTIONS(X509)
126IMPLEMENT_ASN1_DUP_FUNCTION(X509)
68 127
69static ASN1_METHOD meth={ 128static ASN1_METHOD meth={
70 (int (*)()) i2d_X509, 129 (int (*)()) i2d_X509,
@@ -77,97 +136,11 @@ ASN1_METHOD *X509_asn1_meth(void)
77 return(&meth); 136 return(&meth);
78 } 137 }
79 138
80int i2d_X509(X509 *a, unsigned char **pp)
81 {
82 M_ASN1_I2D_vars(a);
83
84 M_ASN1_I2D_len(a->cert_info, i2d_X509_CINF);
85 M_ASN1_I2D_len(a->sig_alg, i2d_X509_ALGOR);
86 M_ASN1_I2D_len(a->signature, i2d_ASN1_BIT_STRING);
87
88 M_ASN1_I2D_seq_total();
89
90 M_ASN1_I2D_put(a->cert_info, i2d_X509_CINF);
91 M_ASN1_I2D_put(a->sig_alg, i2d_X509_ALGOR);
92 M_ASN1_I2D_put(a->signature, i2d_ASN1_BIT_STRING);
93
94 M_ASN1_I2D_finish();
95 }
96
97X509 *d2i_X509(X509 **a, unsigned char **pp, long length)
98 {
99 M_ASN1_D2I_vars(a,X509 *,X509_new);
100
101 M_ASN1_D2I_Init();
102 M_ASN1_D2I_start_sequence();
103 M_ASN1_D2I_get(ret->cert_info,d2i_X509_CINF);
104 M_ASN1_D2I_get(ret->sig_alg,d2i_X509_ALGOR);
105 M_ASN1_D2I_get(ret->signature,d2i_ASN1_BIT_STRING);
106 if (ret->name != NULL) OPENSSL_free(ret->name);
107 ret->name=X509_NAME_oneline(ret->cert_info->subject,NULL,0);
108
109 M_ASN1_D2I_Finish(a,X509_free,ASN1_F_D2I_X509);
110 }
111
112X509 *X509_new(void)
113 {
114 X509 *ret=NULL;
115 ASN1_CTX c;
116
117 M_ASN1_New_Malloc(ret,X509);
118 ret->valid=0;
119 ret->references=1;
120 ret->name = NULL;
121 ret->ex_flags = 0;
122 ret->ex_pathlen = -1;
123 ret->skid = NULL;
124 ret->akid = NULL;
125 ret->aux = NULL;
126 M_ASN1_New(ret->cert_info,X509_CINF_new);
127 M_ASN1_New(ret->sig_alg,X509_ALGOR_new);
128 M_ASN1_New(ret->signature,M_ASN1_BIT_STRING_new);
129 CRYPTO_new_ex_data(x509_meth, ret, &ret->ex_data);
130 return(ret);
131 M_ASN1_New_Error(ASN1_F_X509_NEW);
132 }
133
134void X509_free(X509 *a)
135 {
136 int i;
137
138 if (a == NULL) return;
139
140 i=CRYPTO_add(&a->references,-1,CRYPTO_LOCK_X509);
141#ifdef REF_PRINT
142 REF_PRINT("X509",a);
143#endif
144 if (i > 0) return;
145#ifdef REF_CHECK
146 if (i < 0)
147 {
148 fprintf(stderr,"X509_free, bad reference count\n");
149 abort();
150 }
151#endif
152
153 CRYPTO_free_ex_data(x509_meth,a,&a->ex_data);
154 X509_CINF_free(a->cert_info);
155 X509_ALGOR_free(a->sig_alg);
156 M_ASN1_BIT_STRING_free(a->signature);
157 X509_CERT_AUX_free(a->aux);
158 ASN1_OCTET_STRING_free(a->skid);
159 AUTHORITY_KEYID_free(a->akid);
160
161 if (a->name != NULL) OPENSSL_free(a->name);
162 OPENSSL_free(a);
163 }
164
165int X509_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func, 139int X509_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func,
166 CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func) 140 CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func)
167 { 141 {
168 x509_meth_num++; 142 return CRYPTO_get_ex_new_index(CRYPTO_EX_INDEX_X509, argl, argp,
169 return(CRYPTO_get_ex_new_index(x509_meth_num-1, 143 new_func, dup_func, free_func);
170 &x509_meth,argl,argp,new_func,dup_func,free_func));
171 } 144 }
172 145
173int X509_set_ex_data(X509 *r, int idx, void *arg) 146int X509_set_ex_data(X509 *r, int idx, void *arg)
diff --git a/src/lib/libcrypto/asn1/x_x509a.c b/src/lib/libcrypto/asn1/x_x509a.c
index ebcce87bf2..f244768b7e 100644
--- a/src/lib/libcrypto/asn1/x_x509a.c
+++ b/src/lib/libcrypto/asn1/x_x509a.c
@@ -59,7 +59,7 @@
59#include <stdio.h> 59#include <stdio.h>
60#include "cryptlib.h" 60#include "cryptlib.h"
61#include <openssl/evp.h> 61#include <openssl/evp.h>
62#include <openssl/asn1_mac.h> 62#include <openssl/asn1t.h>
63#include <openssl/x509.h> 63#include <openssl/x509.h>
64 64
65/* X509_CERT_AUX routines. These are used to encode additional 65/* X509_CERT_AUX routines. These are used to encode additional
@@ -71,72 +71,15 @@
71 71
72static X509_CERT_AUX *aux_get(X509 *x); 72static X509_CERT_AUX *aux_get(X509 *x);
73 73
74X509_CERT_AUX *d2i_X509_CERT_AUX(X509_CERT_AUX **a, unsigned char **pp, long length) 74ASN1_SEQUENCE(X509_CERT_AUX) = {
75{ 75 ASN1_SEQUENCE_OF_OPT(X509_CERT_AUX, trust, ASN1_OBJECT),
76 M_ASN1_D2I_vars(a, X509_CERT_AUX *, X509_CERT_AUX_new); 76 ASN1_IMP_SEQUENCE_OF_OPT(X509_CERT_AUX, reject, ASN1_OBJECT, 0),
77 77 ASN1_OPT(X509_CERT_AUX, alias, ASN1_UTF8STRING),
78 M_ASN1_D2I_Init(); 78 ASN1_OPT(X509_CERT_AUX, keyid, ASN1_OCTET_STRING),
79 M_ASN1_D2I_start_sequence(); 79 ASN1_IMP_SEQUENCE_OF_OPT(X509_CERT_AUX, other, X509_ALGOR, 1)
80 80} ASN1_SEQUENCE_END(X509_CERT_AUX)
81 M_ASN1_D2I_get_seq_opt_type(ASN1_OBJECT, ret->trust,
82 d2i_ASN1_OBJECT, ASN1_OBJECT_free);
83 M_ASN1_D2I_get_IMP_set_opt_type(ASN1_OBJECT, ret->reject,
84 d2i_ASN1_OBJECT, ASN1_OBJECT_free, 0);
85 M_ASN1_D2I_get_opt(ret->alias, d2i_ASN1_UTF8STRING, V_ASN1_UTF8STRING);
86 M_ASN1_D2I_get_opt(ret->keyid, d2i_ASN1_OCTET_STRING, V_ASN1_OCTET_STRING);
87 M_ASN1_D2I_get_IMP_set_opt_type(X509_ALGOR, ret->other,
88 d2i_X509_ALGOR, X509_ALGOR_free, 1);
89
90 M_ASN1_D2I_Finish(a, X509_CERT_AUX_free, ASN1_F_D2I_X509_CERT_AUX);
91}
92
93X509_CERT_AUX *X509_CERT_AUX_new()
94{
95 X509_CERT_AUX *ret = NULL;
96 ASN1_CTX c;
97 M_ASN1_New_Malloc(ret, X509_CERT_AUX);
98 ret->trust = NULL;
99 ret->reject = NULL;
100 ret->alias = NULL;
101 ret->keyid = NULL;
102 ret->other = NULL;
103 return(ret);
104 M_ASN1_New_Error(ASN1_F_X509_CERT_AUX_NEW);
105}
106
107void X509_CERT_AUX_free(X509_CERT_AUX *a)
108{
109 if(a == NULL) return;
110 sk_ASN1_OBJECT_pop_free(a->trust, ASN1_OBJECT_free);
111 sk_ASN1_OBJECT_pop_free(a->reject, ASN1_OBJECT_free);
112 ASN1_UTF8STRING_free(a->alias);
113 ASN1_OCTET_STRING_free(a->keyid);
114 sk_X509_ALGOR_pop_free(a->other, X509_ALGOR_free);
115 OPENSSL_free(a);
116}
117
118int i2d_X509_CERT_AUX(X509_CERT_AUX *a, unsigned char **pp)
119{
120 M_ASN1_I2D_vars(a);
121
122 M_ASN1_I2D_len_SEQUENCE_opt_type(ASN1_OBJECT, a->trust, i2d_ASN1_OBJECT);
123 M_ASN1_I2D_len_IMP_SEQUENCE_opt_type(ASN1_OBJECT, a->reject, i2d_ASN1_OBJECT, 0);
124
125 M_ASN1_I2D_len(a->alias, i2d_ASN1_UTF8STRING);
126 M_ASN1_I2D_len(a->keyid, i2d_ASN1_OCTET_STRING);
127 M_ASN1_I2D_len_IMP_SEQUENCE_opt_type(X509_ALGOR, a->other, i2d_X509_ALGOR, 1);
128 81
129 M_ASN1_I2D_seq_total(); 82IMPLEMENT_ASN1_FUNCTIONS(X509_CERT_AUX)
130
131 M_ASN1_I2D_put_SEQUENCE_opt_type(ASN1_OBJECT, a->trust, i2d_ASN1_OBJECT);
132 M_ASN1_I2D_put_IMP_SEQUENCE_opt_type(ASN1_OBJECT, a->reject, i2d_ASN1_OBJECT, 0);
133
134 M_ASN1_I2D_put(a->alias, i2d_ASN1_UTF8STRING);
135 M_ASN1_I2D_put(a->keyid, i2d_ASN1_OCTET_STRING);
136 M_ASN1_I2D_put_IMP_SEQUENCE_opt_type(X509_ALGOR, a->other, i2d_X509_ALGOR, 1);
137
138 M_ASN1_I2D_finish();
139}
140 83
141static X509_CERT_AUX *aux_get(X509 *x) 84static X509_CERT_AUX *aux_get(X509 *x)
142{ 85{