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.ssl1038
-rw-r--r--src/lib/libcrypto/asn1/a_bitstr.c78
-rw-r--r--src/lib/libcrypto/asn1/a_bmp.c19
-rw-r--r--src/lib/libcrypto/asn1/a_bool.c15
-rw-r--r--src/lib/libcrypto/asn1/a_bytes.c44
-rw-r--r--src/lib/libcrypto/asn1/a_d2i_fp.c18
-rw-r--r--src/lib/libcrypto/asn1/a_digest.c14
-rw-r--r--src/lib/libcrypto/asn1/a_dup.c7
-rw-r--r--src/lib/libcrypto/asn1/a_enum.c326
-rw-r--r--src/lib/libcrypto/asn1/a_gentm.c224
-rw-r--r--src/lib/libcrypto/asn1/a_hdr.c27
-rw-r--r--src/lib/libcrypto/asn1/a_i2d_fp.c14
-rw-r--r--src/lib/libcrypto/asn1/a_int.c215
-rw-r--r--src/lib/libcrypto/asn1/a_meth.c8
-rw-r--r--src/lib/libcrypto/asn1/a_object.c139
-rw-r--r--src/lib/libcrypto/asn1/a_octet.c17
-rw-r--r--src/lib/libcrypto/asn1/a_print.c70
-rw-r--r--src/lib/libcrypto/asn1/a_set.c112
-rw-r--r--src/lib/libcrypto/asn1/a_sign.c28
-rw-r--r--src/lib/libcrypto/asn1/a_time.c123
-rw-r--r--src/lib/libcrypto/asn1/a_type.c91
-rw-r--r--src/lib/libcrypto/asn1/a_utctm.c98
-rw-r--r--src/lib/libcrypto/asn1/a_utf8.c83
-rw-r--r--src/lib/libcrypto/asn1/a_verify.c23
-rw-r--r--src/lib/libcrypto/asn1/a_vis.c83
-rw-r--r--src/lib/libcrypto/asn1/asn1.err182
-rw-r--r--src/lib/libcrypto/asn1/asn1.h606
-rw-r--r--src/lib/libcrypto/asn1/asn1_err.c357
-rw-r--r--src/lib/libcrypto/asn1/asn1_lib.c121
-rw-r--r--src/lib/libcrypto/asn1/asn1_mac.h355
-rw-r--r--src/lib/libcrypto/asn1/asn1_par.c84
-rw-r--r--src/lib/libcrypto/asn1/asn_pack.c145
-rw-r--r--src/lib/libcrypto/asn1/d2i_dhp.c23
-rw-r--r--src/lib/libcrypto/asn1/d2i_dsap.c25
-rw-r--r--src/lib/libcrypto/asn1/d2i_pr.c17
-rw-r--r--src/lib/libcrypto/asn1/d2i_pu.c17
-rw-r--r--src/lib/libcrypto/asn1/d2i_r_pr.c24
-rw-r--r--src/lib/libcrypto/asn1/d2i_r_pu.c23
-rw-r--r--src/lib/libcrypto/asn1/d2i_s_pr.c24
-rw-r--r--src/lib/libcrypto/asn1/d2i_s_pu.c25
-rw-r--r--src/lib/libcrypto/asn1/evp_asn1.c38
-rw-r--r--src/lib/libcrypto/asn1/f.c4
-rw-r--r--src/lib/libcrypto/asn1/f_enum.c207
-rw-r--r--src/lib/libcrypto/asn1/f_int.c25
-rw-r--r--src/lib/libcrypto/asn1/f_string.c26
-rw-r--r--src/lib/libcrypto/asn1/i2d_dhp.c24
-rw-r--r--src/lib/libcrypto/asn1/i2d_dsap.c16
-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/i2d_r_pr.c19
-rw-r--r--src/lib/libcrypto/asn1/i2d_r_pu.c20
-rw-r--r--src/lib/libcrypto/asn1/i2d_s_pr.c19
-rw-r--r--src/lib/libcrypto/asn1/i2d_s_pu.c22
-rw-r--r--src/lib/libcrypto/asn1/n_pkey.c66
-rw-r--r--src/lib/libcrypto/asn1/nsseq.c118
-rw-r--r--src/lib/libcrypto/asn1/p5_pbe.c156
-rw-r--r--src/lib/libcrypto/asn1/p5_pbev2.c274
-rw-r--r--src/lib/libcrypto/asn1/p7_dgst.c25
-rw-r--r--src/lib/libcrypto/asn1/p7_enc.c25
-rw-r--r--src/lib/libcrypto/asn1/p7_enc_c.c28
-rw-r--r--src/lib/libcrypto/asn1/p7_evp.c38
-rw-r--r--src/lib/libcrypto/asn1/p7_i_s.c25
-rw-r--r--src/lib/libcrypto/asn1/p7_lib.c42
-rw-r--r--src/lib/libcrypto/asn1/p7_recip.c29
-rw-r--r--src/lib/libcrypto/asn1/p7_s_e.c81
-rw-r--r--src/lib/libcrypto/asn1/p7_signd.c69
-rw-r--r--src/lib/libcrypto/asn1/p7_signi.c51
-rw-r--r--src/lib/libcrypto/asn1/p8_pkey.c129
-rw-r--r--src/lib/libcrypto/asn1/pkcs8.c23
-rw-r--r--src/lib/libcrypto/asn1/t_crl.c166
-rw-r--r--src/lib/libcrypto/asn1/t_pkey.c71
-rw-r--r--src/lib/libcrypto/asn1/t_req.c36
-rw-r--r--src/lib/libcrypto/asn1/t_x509.c150
-rw-r--r--src/lib/libcrypto/asn1/x_algor.c28
-rw-r--r--src/lib/libcrypto/asn1/x_attrib.c59
-rw-r--r--src/lib/libcrypto/asn1/x_cinf.c56
-rw-r--r--src/lib/libcrypto/asn1/x_crl.c175
-rw-r--r--src/lib/libcrypto/asn1/x_exten.c28
-rw-r--r--src/lib/libcrypto/asn1/x_info.c14
-rw-r--r--src/lib/libcrypto/asn1/x_name.c96
-rw-r--r--src/lib/libcrypto/asn1/x_pkey.c27
-rw-r--r--src/lib/libcrypto/asn1/x_pubkey.c44
-rw-r--r--src/lib/libcrypto/asn1/x_req.c61
-rw-r--r--src/lib/libcrypto/asn1/x_sig.c23
-rw-r--r--src/lib/libcrypto/asn1/x_spki.c43
-rw-r--r--src/lib/libcrypto/asn1/x_val.c43
-rw-r--r--src/lib/libcrypto/asn1/x_x509.c33
87 files changed, 5381 insertions, 2333 deletions
diff --git a/src/lib/libcrypto/asn1/Makefile.ssl b/src/lib/libcrypto/asn1/Makefile.ssl
index 30751bd156..541d1dac4a 100644
--- a/src/lib/libcrypto/asn1/Makefile.ssl
+++ b/src/lib/libcrypto/asn1/Makefile.ssl
@@ -7,51 +7,51 @@ TOP= ../..
7CC= cc 7CC= cc
8INCLUDES= -I.. -I../../include 8INCLUDES= -I.. -I../../include
9CFLAG=-g 9CFLAG=-g
10INSTALL_PREFIX=
11OPENSSLDIR= /usr/local/ssl
10INSTALLTOP=/usr/local/ssl 12INSTALLTOP=/usr/local/ssl
11MAKE= make -f Makefile.ssl 13MAKE= make -f Makefile.ssl
12MAKEDEPEND= makedepend -f Makefile.ssl 14MAKEDEPEND= $(TOP)/util/domd $(TOP)
13MAKEFILE= Makefile.ssl 15MAKEFILE= Makefile.ssl
14AR= ar r 16AR= ar r
15 17
16CFLAGS= $(INCLUDES) $(CFLAG) 18CFLAGS= $(INCLUDES) $(CFLAG)
17 19
18ERR=asn1
19ERRC=asn1_err
20GENERAL=Makefile README 20GENERAL=Makefile README
21TEST= 21TEST=
22APPS= 22APPS=
23 23
24LIB=$(TOP)/libcrypto.a 24LIB=$(TOP)/libcrypto.a
25LIBSRC= a_object.c a_bitstr.c a_utctm.c a_int.c a_octet.c a_print.c \ 25LIBSRC= a_object.c a_bitstr.c a_utctm.c a_gentm.c a_time.c a_int.c a_octet.c \
26 a_type.c a_set.c a_dup.c a_d2i_fp.c a_i2d_fp.c \ 26 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_sign.c a_digest.c a_verify.c \ 27 a_enum.c a_vis.c a_utf8.c a_sign.c a_digest.c a_verify.c \
28 x_algor.c x_val.c x_pubkey.c x_sig.c x_req.c x_attrib.c \ 28 x_algor.c x_val.c x_pubkey.c x_sig.c x_req.c x_attrib.c \
29 x_name.c x_cinf.c x_x509.c x_crl.c x_info.c x_spki.c \ 29 x_name.c x_cinf.c x_x509.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 \ 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 \ 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\ 32 d2i_pu.c d2i_pr.c i2d_pu.c i2d_pr.c\
33 t_req.c t_x509.c t_pkey.c \ 33 t_req.c t_x509.c t_crl.c t_pkey.c \
34 p7_i_s.c p7_signi.c p7_signd.c p7_recip.c p7_enc_c.c p7_evp.c \ 34 p7_i_s.c p7_signi.c p7_signd.c p7_recip.c p7_enc_c.c p7_evp.c \
35 p7_dgst.c p7_s_e.c p7_enc.c p7_lib.c \ 35 p7_dgst.c p7_s_e.c p7_enc.c p7_lib.c \
36 f_int.c f_string.c i2d_dhp.c i2d_dsap.c d2i_dhp.c d2i_dsap.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 a_hdr.c x_pkey.c a_bool.c x_exten.c \ 37 f_enum.c a_hdr.c x_pkey.c a_bool.c x_exten.c \
38 asn1_par.c asn1_lib.c $(ERRC).c a_meth.c a_bytes.c \ 38 asn1_par.c asn1_lib.c asn1_err.c a_meth.c a_bytes.c \
39 evp_asn1.c 39 evp_asn1.c asn_pack.c p5_pbe.c p5_pbev2.c p8_pkey.c
40LIBOBJ= a_object.o a_bitstr.o a_utctm.o a_int.o a_octet.o a_print.o \ 40LIBOBJ= a_object.o a_bitstr.o a_utctm.o a_gentm.o a_time.o a_int.o a_octet.o \
41 a_type.o a_set.o a_dup.o a_d2i_fp.o a_i2d_fp.o \ 41 a_print.o a_type.o a_set.o a_dup.o a_d2i_fp.o a_i2d_fp.o a_bmp.o \
42 a_sign.o a_digest.o a_verify.o \ 42 a_enum.o a_vis.o a_utf8.o a_sign.o a_digest.o a_verify.o \
43 x_algor.o x_val.o x_pubkey.o x_sig.o x_req.o x_attrib.o \ 43 x_algor.o x_val.o x_pubkey.o x_sig.o x_req.o x_attrib.o \
44 x_name.o x_cinf.o x_x509.o x_crl.o x_info.o x_spki.o \ 44 x_name.o x_cinf.o x_x509.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 \ 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 \ 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 \ 47 d2i_pu.o d2i_pr.o i2d_pu.o i2d_pr.o \
48 t_req.o t_x509.o t_pkey.o \ 48 t_req.o t_x509.o t_crl.o t_pkey.o \
49 p7_i_s.o p7_signi.o p7_signd.o p7_recip.o p7_enc_c.o p7_evp.o \ 49 p7_i_s.o p7_signi.o p7_signd.o p7_recip.o p7_enc_c.o p7_evp.o \
50 p7_dgst.o p7_s_e.o p7_enc.o p7_lib.o \ 50 p7_dgst.o p7_s_e.o p7_enc.o p7_lib.o \
51 f_int.o f_string.o i2d_dhp.o i2d_dsap.o d2i_dhp.o d2i_dsap.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 a_hdr.o x_pkey.o a_bool.o x_exten.o \ 52 f_enum.o a_hdr.o x_pkey.o a_bool.o x_exten.o \
53 asn1_par.o asn1_lib.o $(ERRC).o a_meth.o a_bytes.o \ 53 asn1_par.o asn1_lib.o asn1_err.o a_meth.o a_bytes.o \
54 evp_asn1.o 54 evp_asn1.o asn_pack.o p5_pbe.o p5_pbev2.o p8_pkey.o
55 55
56SRC= $(LIBSRC) 56SRC= $(LIBSRC)
57 57
@@ -75,24 +75,23 @@ all: lib
75 75
76lib: $(LIBOBJ) 76lib: $(LIBOBJ)
77 $(AR) $(LIB) $(LIBOBJ) 77 $(AR) $(LIB) $(LIBOBJ)
78 sh $(TOP)/util/ranlib.sh $(LIB) 78 $(RANLIB) $(LIB)
79 @touch lib 79 @touch lib
80 80
81files: 81files:
82 perl $(TOP)/util/files.pl Makefile.ssl >> $(TOP)/MINFO 82 $(PERL) $(TOP)/util/files.pl Makefile.ssl >> $(TOP)/MINFO
83 83
84links: 84links:
85 /bin/rm -f Makefile 85 @$(TOP)/util/point.sh Makefile.ssl Makefile
86 $(TOP)/util/point.sh Makefile.ssl Makefile ; 86 @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER)
87 $(TOP)/util/mklink.sh ../../include $(EXHEADER) 87 @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST)
88 $(TOP)/util/mklink.sh ../../test $(TEST) 88 @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS)
89 $(TOP)/util/mklink.sh ../../apps $(APPS)
90 89
91install: 90install:
92 @for i in $(EXHEADER) ; \ 91 @for i in $(EXHEADER) ; \
93 do \ 92 do \
94 (cp $$i $(INSTALLTOP)/include/$$i; \ 93 (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
95 chmod 644 $(INSTALLTOP)/include/$$i ); \ 94 chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
96 done; 95 done;
97 96
98tags: 97tags:
@@ -104,17 +103,988 @@ lint:
104 lint -DLINT $(INCLUDES) $(SRC)>fluff 103 lint -DLINT $(INCLUDES) $(SRC)>fluff
105 104
106depend: 105depend:
107 $(MAKEDEPEND) $(INCLUDES) $(PROGS) $(LIBSRC) 106 $(MAKEDEPEND) $(INCLUDES) $(DEPFLAG) $(PROGS) $(LIBSRC)
108 107
109dclean: 108dclean:
110 perl -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new 109 $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new
111 mv -f Makefile.new $(MAKEFILE) 110 mv -f Makefile.new $(MAKEFILE)
112 111
113clean: 112clean:
114 /bin/rm -f *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff 113 rm -f *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
115 114
116errors:
117 perl $(TOP)/util/err-ins.pl $(ERR).err $(ERR).h
118 perl ../err/err_genc.pl -s $(ERR).h $(ERRC).c
119 115
120# DO NOT DELETE THIS LINE -- make depend depends on it. 116# DO NOT DELETE THIS LINE -- make depend depends on it.
117
118a_bitstr.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
119a_bitstr.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
120a_bitstr.o: ../../include/openssl/crypto.h ../../include/openssl/e_os.h
121a_bitstr.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
122a_bitstr.o: ../../include/openssl/opensslconf.h
123a_bitstr.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
124a_bitstr.o: ../../include/openssl/stack.h ../cryptlib.h
125a_bmp.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
126a_bmp.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
127a_bmp.o: ../../include/openssl/crypto.h ../../include/openssl/e_os.h
128a_bmp.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
129a_bmp.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
130a_bmp.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
131a_bmp.o: ../cryptlib.h
132a_bool.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
133a_bool.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
134a_bool.o: ../../include/openssl/crypto.h ../../include/openssl/e_os.h
135a_bool.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
136a_bool.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
137a_bool.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
138a_bool.o: ../cryptlib.h
139a_bytes.o: ../../include/openssl/asn1.h ../../include/openssl/asn1_mac.h
140a_bytes.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
141a_bytes.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
142a_bytes.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h
143a_bytes.o: ../../include/openssl/err.h ../../include/openssl/opensslconf.h
144a_bytes.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
145a_bytes.o: ../../include/openssl/stack.h ../cryptlib.h
146a_d2i_fp.o: ../../include/openssl/asn1.h ../../include/openssl/asn1_mac.h
147a_d2i_fp.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
148a_d2i_fp.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
149a_d2i_fp.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h
150a_d2i_fp.o: ../../include/openssl/err.h ../../include/openssl/opensslconf.h
151a_d2i_fp.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
152a_d2i_fp.o: ../../include/openssl/stack.h ../cryptlib.h
153a_digest.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
154a_digest.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
155a_digest.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
156a_digest.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
157a_digest.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
158a_digest.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h
159a_digest.o: ../../include/openssl/err.h ../../include/openssl/evp.h
160a_digest.o: ../../include/openssl/idea.h ../../include/openssl/md2.h
161a_digest.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
162a_digest.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
163a_digest.o: ../../include/openssl/opensslv.h ../../include/openssl/rc2.h
164a_digest.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
165a_digest.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
166a_digest.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
167a_digest.o: ../../include/openssl/stack.h ../cryptlib.h
168a_dup.o: ../../include/openssl/asn1.h ../../include/openssl/asn1_mac.h
169a_dup.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
170a_dup.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
171a_dup.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h
172a_dup.o: ../../include/openssl/err.h ../../include/openssl/opensslconf.h
173a_dup.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
174a_dup.o: ../../include/openssl/stack.h ../cryptlib.h
175a_enum.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
176a_enum.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
177a_enum.o: ../../include/openssl/crypto.h ../../include/openssl/e_os.h
178a_enum.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
179a_enum.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
180a_enum.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
181a_enum.o: ../cryptlib.h
182a_gentm.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
183a_gentm.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
184a_gentm.o: ../../include/openssl/crypto.h ../../include/openssl/e_os.h
185a_gentm.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
186a_gentm.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
187a_gentm.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
188a_gentm.o: ../cryptlib.h
189a_hdr.o: ../../include/openssl/asn1.h ../../include/openssl/asn1_mac.h
190a_hdr.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
191a_hdr.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
192a_hdr.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h
193a_hdr.o: ../../include/openssl/err.h ../../include/openssl/opensslconf.h
194a_hdr.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
195a_hdr.o: ../../include/openssl/stack.h ../cryptlib.h
196a_i2d_fp.o: ../../include/openssl/asn1.h ../../include/openssl/asn1_mac.h
197a_i2d_fp.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
198a_i2d_fp.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
199a_i2d_fp.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h
200a_i2d_fp.o: ../../include/openssl/err.h ../../include/openssl/opensslconf.h
201a_i2d_fp.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
202a_i2d_fp.o: ../../include/openssl/stack.h ../cryptlib.h
203a_int.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
204a_int.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
205a_int.o: ../../include/openssl/crypto.h ../../include/openssl/e_os.h
206a_int.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
207a_int.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
208a_int.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
209a_int.o: ../cryptlib.h
210a_meth.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
211a_meth.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
212a_meth.o: ../../include/openssl/crypto.h ../../include/openssl/e_os.h
213a_meth.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
214a_meth.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
215a_meth.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
216a_meth.o: ../cryptlib.h
217a_object.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
218a_object.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
219a_object.o: ../../include/openssl/crypto.h ../../include/openssl/e_os.h
220a_object.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
221a_object.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
222a_object.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
223a_object.o: ../../include/openssl/stack.h ../cryptlib.h
224a_octet.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
225a_octet.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
226a_octet.o: ../../include/openssl/crypto.h ../../include/openssl/e_os.h
227a_octet.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
228a_octet.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
229a_octet.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
230a_octet.o: ../cryptlib.h
231a_print.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
232a_print.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
233a_print.o: ../../include/openssl/crypto.h ../../include/openssl/e_os.h
234a_print.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
235a_print.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
236a_print.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
237a_print.o: ../cryptlib.h
238a_set.o: ../../include/openssl/asn1.h ../../include/openssl/asn1_mac.h
239a_set.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
240a_set.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
241a_set.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h
242a_set.o: ../../include/openssl/err.h ../../include/openssl/opensslconf.h
243a_set.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
244a_set.o: ../../include/openssl/stack.h ../cryptlib.h
245a_sign.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
246a_sign.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
247a_sign.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
248a_sign.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
249a_sign.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
250a_sign.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h
251a_sign.o: ../../include/openssl/err.h ../../include/openssl/evp.h
252a_sign.o: ../../include/openssl/idea.h ../../include/openssl/md2.h
253a_sign.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
254a_sign.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
255a_sign.o: ../../include/openssl/opensslv.h ../../include/openssl/pkcs7.h
256a_sign.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
257a_sign.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
258a_sign.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
259a_sign.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
260a_sign.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
261a_sign.o: ../cryptlib.h
262a_time.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
263a_time.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
264a_time.o: ../../include/openssl/crypto.h ../../include/openssl/e_os.h
265a_time.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
266a_time.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
267a_time.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
268a_time.o: ../cryptlib.h
269a_type.o: ../../include/openssl/asn1.h ../../include/openssl/asn1_mac.h
270a_type.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
271a_type.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
272a_type.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h
273a_type.o: ../../include/openssl/err.h ../../include/openssl/opensslconf.h
274a_type.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
275a_type.o: ../../include/openssl/stack.h ../cryptlib.h
276a_utctm.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
277a_utctm.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
278a_utctm.o: ../../include/openssl/crypto.h ../../include/openssl/e_os.h
279a_utctm.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
280a_utctm.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
281a_utctm.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
282a_utctm.o: ../cryptlib.h
283a_utf8.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
284a_utf8.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
285a_utf8.o: ../../include/openssl/crypto.h ../../include/openssl/e_os.h
286a_utf8.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
287a_utf8.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
288a_utf8.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
289a_utf8.o: ../cryptlib.h
290a_verify.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
291a_verify.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
292a_verify.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
293a_verify.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
294a_verify.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
295a_verify.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h
296a_verify.o: ../../include/openssl/err.h ../../include/openssl/evp.h
297a_verify.o: ../../include/openssl/idea.h ../../include/openssl/md2.h
298a_verify.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
299a_verify.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
300a_verify.o: ../../include/openssl/opensslv.h ../../include/openssl/pkcs7.h
301a_verify.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
302a_verify.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
303a_verify.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
304a_verify.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
305a_verify.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
306a_verify.o: ../cryptlib.h
307a_vis.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
308a_vis.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
309a_vis.o: ../../include/openssl/crypto.h ../../include/openssl/e_os.h
310a_vis.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
311a_vis.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
312a_vis.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
313a_vis.o: ../cryptlib.h
314asn1_err.o: ../../include/openssl/asn1.h ../../include/openssl/bn.h
315asn1_err.o: ../../include/openssl/err.h ../../include/openssl/opensslconf.h
316asn1_err.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
317asn1_lib.o: ../../include/openssl/asn1.h ../../include/openssl/asn1_mac.h
318asn1_lib.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
319asn1_lib.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
320asn1_lib.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h
321asn1_lib.o: ../../include/openssl/err.h ../../include/openssl/opensslconf.h
322asn1_lib.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
323asn1_lib.o: ../../include/openssl/stack.h ../cryptlib.h
324asn1_par.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
325asn1_par.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
326asn1_par.o: ../../include/openssl/crypto.h ../../include/openssl/e_os.h
327asn1_par.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
328asn1_par.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
329asn1_par.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
330asn1_par.o: ../../include/openssl/stack.h ../cryptlib.h
331asn_pack.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
332asn_pack.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
333asn_pack.o: ../../include/openssl/crypto.h ../../include/openssl/e_os.h
334asn_pack.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
335asn_pack.o: ../../include/openssl/opensslconf.h
336asn_pack.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
337asn_pack.o: ../../include/openssl/stack.h ../cryptlib.h
338d2i_dhp.o: ../../include/openssl/asn1.h ../../include/openssl/asn1_mac.h
339d2i_dhp.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
340d2i_dhp.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
341d2i_dhp.o: ../../include/openssl/dh.h ../../include/openssl/e_os.h
342d2i_dhp.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
343d2i_dhp.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
344d2i_dhp.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
345d2i_dhp.o: ../../include/openssl/stack.h ../cryptlib.h
346d2i_dsap.o: ../../include/openssl/asn1.h ../../include/openssl/asn1_mac.h
347d2i_dsap.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
348d2i_dsap.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
349d2i_dsap.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
350d2i_dsap.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h
351d2i_dsap.o: ../../include/openssl/err.h ../../include/openssl/objects.h
352d2i_dsap.o: ../../include/openssl/opensslconf.h
353d2i_dsap.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
354d2i_dsap.o: ../../include/openssl/stack.h ../cryptlib.h
355d2i_pr.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
356d2i_pr.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
357d2i_pr.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
358d2i_pr.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
359d2i_pr.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
360d2i_pr.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h
361d2i_pr.o: ../../include/openssl/err.h ../../include/openssl/evp.h
362d2i_pr.o: ../../include/openssl/idea.h ../../include/openssl/md2.h
363d2i_pr.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
364d2i_pr.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
365d2i_pr.o: ../../include/openssl/opensslv.h ../../include/openssl/rc2.h
366d2i_pr.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
367d2i_pr.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
368d2i_pr.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
369d2i_pr.o: ../../include/openssl/stack.h ../cryptlib.h
370d2i_pu.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
371d2i_pu.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
372d2i_pu.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
373d2i_pu.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
374d2i_pu.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
375d2i_pu.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h
376d2i_pu.o: ../../include/openssl/err.h ../../include/openssl/evp.h
377d2i_pu.o: ../../include/openssl/idea.h ../../include/openssl/md2.h
378d2i_pu.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
379d2i_pu.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
380d2i_pu.o: ../../include/openssl/opensslv.h ../../include/openssl/rc2.h
381d2i_pu.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
382d2i_pu.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
383d2i_pu.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
384d2i_pu.o: ../../include/openssl/stack.h ../cryptlib.h
385d2i_r_pr.o: ../../include/openssl/asn1.h ../../include/openssl/asn1_mac.h
386d2i_r_pr.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
387d2i_r_pr.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
388d2i_r_pr.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h
389d2i_r_pr.o: ../../include/openssl/err.h ../../include/openssl/objects.h
390d2i_r_pr.o: ../../include/openssl/opensslconf.h
391d2i_r_pr.o: ../../include/openssl/opensslv.h ../../include/openssl/rsa.h
392d2i_r_pr.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
393d2i_r_pr.o: ../cryptlib.h
394d2i_r_pu.o: ../../include/openssl/asn1.h ../../include/openssl/asn1_mac.h
395d2i_r_pu.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
396d2i_r_pu.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
397d2i_r_pu.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h
398d2i_r_pu.o: ../../include/openssl/err.h ../../include/openssl/objects.h
399d2i_r_pu.o: ../../include/openssl/opensslconf.h
400d2i_r_pu.o: ../../include/openssl/opensslv.h ../../include/openssl/rsa.h
401d2i_r_pu.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
402d2i_r_pu.o: ../cryptlib.h
403d2i_s_pr.o: ../../include/openssl/asn1.h ../../include/openssl/asn1_mac.h
404d2i_s_pr.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
405d2i_s_pr.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
406d2i_s_pr.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
407d2i_s_pr.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h
408d2i_s_pr.o: ../../include/openssl/err.h ../../include/openssl/objects.h
409d2i_s_pr.o: ../../include/openssl/opensslconf.h
410d2i_s_pr.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
411d2i_s_pr.o: ../../include/openssl/stack.h ../cryptlib.h
412d2i_s_pu.o: ../../include/openssl/asn1.h ../../include/openssl/asn1_mac.h
413d2i_s_pu.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
414d2i_s_pu.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
415d2i_s_pu.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
416d2i_s_pu.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h
417d2i_s_pu.o: ../../include/openssl/err.h ../../include/openssl/objects.h
418d2i_s_pu.o: ../../include/openssl/opensslconf.h
419d2i_s_pu.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
420d2i_s_pu.o: ../../include/openssl/stack.h ../cryptlib.h
421evp_asn1.o: ../../include/openssl/asn1.h ../../include/openssl/asn1_mac.h
422evp_asn1.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
423evp_asn1.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
424evp_asn1.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h
425evp_asn1.o: ../../include/openssl/err.h ../../include/openssl/opensslconf.h
426evp_asn1.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
427evp_asn1.o: ../../include/openssl/stack.h ../cryptlib.h
428f_enum.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
429f_enum.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
430f_enum.o: ../../include/openssl/crypto.h ../../include/openssl/e_os.h
431f_enum.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
432f_enum.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
433f_enum.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
434f_enum.o: ../cryptlib.h
435f_int.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
436f_int.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
437f_int.o: ../../include/openssl/crypto.h ../../include/openssl/e_os.h
438f_int.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
439f_int.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
440f_int.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
441f_int.o: ../cryptlib.h
442f_string.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
443f_string.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
444f_string.o: ../../include/openssl/crypto.h ../../include/openssl/e_os.h
445f_string.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
446f_string.o: ../../include/openssl/opensslconf.h
447f_string.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
448f_string.o: ../../include/openssl/stack.h ../cryptlib.h
449i2d_dhp.o: ../../include/openssl/asn1.h ../../include/openssl/asn1_mac.h
450i2d_dhp.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
451i2d_dhp.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
452i2d_dhp.o: ../../include/openssl/dh.h ../../include/openssl/e_os.h
453i2d_dhp.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
454i2d_dhp.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
455i2d_dhp.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
456i2d_dhp.o: ../cryptlib.h
457i2d_dsap.o: ../../include/openssl/asn1.h ../../include/openssl/asn1_mac.h
458i2d_dsap.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
459i2d_dsap.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
460i2d_dsap.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
461i2d_dsap.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h
462i2d_dsap.o: ../../include/openssl/err.h ../../include/openssl/opensslconf.h
463i2d_dsap.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
464i2d_dsap.o: ../../include/openssl/stack.h ../cryptlib.h
465i2d_pr.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
466i2d_pr.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
467i2d_pr.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
468i2d_pr.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
469i2d_pr.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
470i2d_pr.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h
471i2d_pr.o: ../../include/openssl/err.h ../../include/openssl/evp.h
472i2d_pr.o: ../../include/openssl/idea.h ../../include/openssl/md2.h
473i2d_pr.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
474i2d_pr.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
475i2d_pr.o: ../../include/openssl/opensslv.h ../../include/openssl/rc2.h
476i2d_pr.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
477i2d_pr.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
478i2d_pr.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
479i2d_pr.o: ../../include/openssl/stack.h ../cryptlib.h
480i2d_pu.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
481i2d_pu.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
482i2d_pu.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
483i2d_pu.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
484i2d_pu.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
485i2d_pu.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h
486i2d_pu.o: ../../include/openssl/err.h ../../include/openssl/evp.h
487i2d_pu.o: ../../include/openssl/idea.h ../../include/openssl/md2.h
488i2d_pu.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
489i2d_pu.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
490i2d_pu.o: ../../include/openssl/opensslv.h ../../include/openssl/rc2.h
491i2d_pu.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
492i2d_pu.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
493i2d_pu.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
494i2d_pu.o: ../../include/openssl/stack.h ../cryptlib.h
495i2d_r_pr.o: ../../include/openssl/asn1.h ../../include/openssl/asn1_mac.h
496i2d_r_pr.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
497i2d_r_pr.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
498i2d_r_pr.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h
499i2d_r_pr.o: ../../include/openssl/err.h ../../include/openssl/objects.h
500i2d_r_pr.o: ../../include/openssl/opensslconf.h
501i2d_r_pr.o: ../../include/openssl/opensslv.h ../../include/openssl/rsa.h
502i2d_r_pr.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
503i2d_r_pr.o: ../cryptlib.h
504i2d_r_pu.o: ../../include/openssl/asn1.h ../../include/openssl/asn1_mac.h
505i2d_r_pu.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
506i2d_r_pu.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
507i2d_r_pu.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h
508i2d_r_pu.o: ../../include/openssl/err.h ../../include/openssl/objects.h
509i2d_r_pu.o: ../../include/openssl/opensslconf.h
510i2d_r_pu.o: ../../include/openssl/opensslv.h ../../include/openssl/rsa.h
511i2d_r_pu.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
512i2d_r_pu.o: ../cryptlib.h
513i2d_s_pr.o: ../../include/openssl/asn1.h ../../include/openssl/asn1_mac.h
514i2d_s_pr.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
515i2d_s_pr.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
516i2d_s_pr.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
517i2d_s_pr.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h
518i2d_s_pr.o: ../../include/openssl/err.h ../../include/openssl/objects.h
519i2d_s_pr.o: ../../include/openssl/opensslconf.h
520i2d_s_pr.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
521i2d_s_pr.o: ../../include/openssl/stack.h ../cryptlib.h
522i2d_s_pu.o: ../../include/openssl/asn1.h ../../include/openssl/asn1_mac.h
523i2d_s_pu.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
524i2d_s_pu.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
525i2d_s_pu.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
526i2d_s_pu.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h
527i2d_s_pu.o: ../../include/openssl/err.h ../../include/openssl/objects.h
528i2d_s_pu.o: ../../include/openssl/opensslconf.h
529i2d_s_pu.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
530i2d_s_pu.o: ../../include/openssl/stack.h ../cryptlib.h
531n_pkey.o: ../../include/openssl/asn1.h ../../include/openssl/asn1_mac.h
532n_pkey.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
533n_pkey.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
534n_pkey.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h
535n_pkey.o: ../../include/openssl/des.h ../../include/openssl/dh.h
536n_pkey.o: ../../include/openssl/dsa.h ../../include/openssl/e_os.h
537n_pkey.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
538n_pkey.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
539n_pkey.o: ../../include/openssl/md2.h ../../include/openssl/md5.h
540n_pkey.o: ../../include/openssl/mdc2.h ../../include/openssl/objects.h
541n_pkey.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
542n_pkey.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
543n_pkey.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
544n_pkey.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
545n_pkey.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
546n_pkey.o: ../../include/openssl/stack.h ../../include/openssl/x509.h
547n_pkey.o: ../../include/openssl/x509_vfy.h ../cryptlib.h
548nsseq.o: ../../include/openssl/asn1.h ../../include/openssl/asn1_mac.h
549nsseq.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
550nsseq.o: ../../include/openssl/bn.h ../../include/openssl/cast.h
551nsseq.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
552nsseq.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
553nsseq.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
554nsseq.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
555nsseq.o: ../../include/openssl/md2.h ../../include/openssl/md5.h
556nsseq.o: ../../include/openssl/mdc2.h ../../include/openssl/objects.h
557nsseq.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
558nsseq.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
559nsseq.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
560nsseq.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
561nsseq.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
562nsseq.o: ../../include/openssl/stack.h ../../include/openssl/x509.h
563nsseq.o: ../../include/openssl/x509_vfy.h
564p5_pbe.o: ../../include/openssl/asn1.h ../../include/openssl/asn1_mac.h
565p5_pbe.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
566p5_pbe.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
567p5_pbe.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h
568p5_pbe.o: ../../include/openssl/des.h ../../include/openssl/dh.h
569p5_pbe.o: ../../include/openssl/dsa.h ../../include/openssl/e_os.h
570p5_pbe.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
571p5_pbe.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
572p5_pbe.o: ../../include/openssl/md2.h ../../include/openssl/md5.h
573p5_pbe.o: ../../include/openssl/mdc2.h ../../include/openssl/objects.h
574p5_pbe.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
575p5_pbe.o: ../../include/openssl/pkcs7.h ../../include/openssl/rand.h
576p5_pbe.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
577p5_pbe.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
578p5_pbe.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
579p5_pbe.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
580p5_pbe.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
581p5_pbe.o: ../cryptlib.h
582p5_pbev2.o: ../../include/openssl/asn1.h ../../include/openssl/asn1_mac.h
583p5_pbev2.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
584p5_pbev2.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
585p5_pbev2.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h
586p5_pbev2.o: ../../include/openssl/des.h ../../include/openssl/dh.h
587p5_pbev2.o: ../../include/openssl/dsa.h ../../include/openssl/e_os.h
588p5_pbev2.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
589p5_pbev2.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
590p5_pbev2.o: ../../include/openssl/md2.h ../../include/openssl/md5.h
591p5_pbev2.o: ../../include/openssl/mdc2.h ../../include/openssl/objects.h
592p5_pbev2.o: ../../include/openssl/opensslconf.h
593p5_pbev2.o: ../../include/openssl/opensslv.h ../../include/openssl/pkcs7.h
594p5_pbev2.o: ../../include/openssl/rand.h ../../include/openssl/rc2.h
595p5_pbev2.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
596p5_pbev2.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
597p5_pbev2.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
598p5_pbev2.o: ../../include/openssl/stack.h ../../include/openssl/x509.h
599p5_pbev2.o: ../../include/openssl/x509_vfy.h ../cryptlib.h
600p7_dgst.o: ../../include/openssl/asn1.h ../../include/openssl/asn1_mac.h
601p7_dgst.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
602p7_dgst.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
603p7_dgst.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h
604p7_dgst.o: ../../include/openssl/des.h ../../include/openssl/dh.h
605p7_dgst.o: ../../include/openssl/dsa.h ../../include/openssl/e_os.h
606p7_dgst.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
607p7_dgst.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
608p7_dgst.o: ../../include/openssl/md2.h ../../include/openssl/md5.h
609p7_dgst.o: ../../include/openssl/mdc2.h ../../include/openssl/objects.h
610p7_dgst.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
611p7_dgst.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
612p7_dgst.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
613p7_dgst.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
614p7_dgst.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
615p7_dgst.o: ../../include/openssl/stack.h ../../include/openssl/x509.h
616p7_dgst.o: ../../include/openssl/x509_vfy.h ../cryptlib.h
617p7_enc.o: ../../include/openssl/asn1.h ../../include/openssl/asn1_mac.h
618p7_enc.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
619p7_enc.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
620p7_enc.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h
621p7_enc.o: ../../include/openssl/des.h ../../include/openssl/dh.h
622p7_enc.o: ../../include/openssl/dsa.h ../../include/openssl/e_os.h
623p7_enc.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
624p7_enc.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
625p7_enc.o: ../../include/openssl/md2.h ../../include/openssl/md5.h
626p7_enc.o: ../../include/openssl/mdc2.h ../../include/openssl/objects.h
627p7_enc.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
628p7_enc.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
629p7_enc.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
630p7_enc.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
631p7_enc.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
632p7_enc.o: ../../include/openssl/stack.h ../../include/openssl/x509.h
633p7_enc.o: ../../include/openssl/x509_vfy.h ../cryptlib.h
634p7_enc_c.o: ../../include/openssl/asn1.h ../../include/openssl/asn1_mac.h
635p7_enc_c.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
636p7_enc_c.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
637p7_enc_c.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h
638p7_enc_c.o: ../../include/openssl/des.h ../../include/openssl/dh.h
639p7_enc_c.o: ../../include/openssl/dsa.h ../../include/openssl/e_os.h
640p7_enc_c.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
641p7_enc_c.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
642p7_enc_c.o: ../../include/openssl/md2.h ../../include/openssl/md5.h
643p7_enc_c.o: ../../include/openssl/mdc2.h ../../include/openssl/objects.h
644p7_enc_c.o: ../../include/openssl/opensslconf.h
645p7_enc_c.o: ../../include/openssl/opensslv.h ../../include/openssl/pkcs7.h
646p7_enc_c.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
647p7_enc_c.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
648p7_enc_c.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
649p7_enc_c.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
650p7_enc_c.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
651p7_enc_c.o: ../cryptlib.h
652p7_evp.o: ../../include/openssl/asn1.h ../../include/openssl/asn1_mac.h
653p7_evp.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
654p7_evp.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
655p7_evp.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h
656p7_evp.o: ../../include/openssl/des.h ../../include/openssl/dh.h
657p7_evp.o: ../../include/openssl/dsa.h ../../include/openssl/e_os.h
658p7_evp.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
659p7_evp.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
660p7_evp.o: ../../include/openssl/md2.h ../../include/openssl/md5.h
661p7_evp.o: ../../include/openssl/mdc2.h ../../include/openssl/objects.h
662p7_evp.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
663p7_evp.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
664p7_evp.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
665p7_evp.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
666p7_evp.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
667p7_evp.o: ../../include/openssl/stack.h ../../include/openssl/x509.h
668p7_evp.o: ../../include/openssl/x509_vfy.h ../cryptlib.h
669p7_i_s.o: ../../include/openssl/asn1.h ../../include/openssl/asn1_mac.h
670p7_i_s.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
671p7_i_s.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
672p7_i_s.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h
673p7_i_s.o: ../../include/openssl/des.h ../../include/openssl/dh.h
674p7_i_s.o: ../../include/openssl/dsa.h ../../include/openssl/e_os.h
675p7_i_s.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
676p7_i_s.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
677p7_i_s.o: ../../include/openssl/md2.h ../../include/openssl/md5.h
678p7_i_s.o: ../../include/openssl/mdc2.h ../../include/openssl/objects.h
679p7_i_s.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
680p7_i_s.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
681p7_i_s.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
682p7_i_s.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
683p7_i_s.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
684p7_i_s.o: ../../include/openssl/stack.h ../../include/openssl/x509.h
685p7_i_s.o: ../../include/openssl/x509_vfy.h ../cryptlib.h
686p7_lib.o: ../../include/openssl/asn1.h ../../include/openssl/asn1_mac.h
687p7_lib.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
688p7_lib.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
689p7_lib.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h
690p7_lib.o: ../../include/openssl/des.h ../../include/openssl/dh.h
691p7_lib.o: ../../include/openssl/dsa.h ../../include/openssl/e_os.h
692p7_lib.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
693p7_lib.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
694p7_lib.o: ../../include/openssl/md2.h ../../include/openssl/md5.h
695p7_lib.o: ../../include/openssl/mdc2.h ../../include/openssl/objects.h
696p7_lib.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
697p7_lib.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
698p7_lib.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
699p7_lib.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
700p7_lib.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
701p7_lib.o: ../../include/openssl/stack.h ../../include/openssl/x509.h
702p7_lib.o: ../../include/openssl/x509_vfy.h ../cryptlib.h
703p7_recip.o: ../../include/openssl/asn1.h ../../include/openssl/asn1_mac.h
704p7_recip.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
705p7_recip.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
706p7_recip.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h
707p7_recip.o: ../../include/openssl/des.h ../../include/openssl/dh.h
708p7_recip.o: ../../include/openssl/dsa.h ../../include/openssl/e_os.h
709p7_recip.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
710p7_recip.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
711p7_recip.o: ../../include/openssl/md2.h ../../include/openssl/md5.h
712p7_recip.o: ../../include/openssl/mdc2.h ../../include/openssl/objects.h
713p7_recip.o: ../../include/openssl/opensslconf.h
714p7_recip.o: ../../include/openssl/opensslv.h ../../include/openssl/pkcs7.h
715p7_recip.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
716p7_recip.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
717p7_recip.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
718p7_recip.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
719p7_recip.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
720p7_recip.o: ../cryptlib.h
721p7_s_e.o: ../../include/openssl/asn1.h ../../include/openssl/asn1_mac.h
722p7_s_e.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
723p7_s_e.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
724p7_s_e.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h
725p7_s_e.o: ../../include/openssl/des.h ../../include/openssl/dh.h
726p7_s_e.o: ../../include/openssl/dsa.h ../../include/openssl/e_os.h
727p7_s_e.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
728p7_s_e.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
729p7_s_e.o: ../../include/openssl/md2.h ../../include/openssl/md5.h
730p7_s_e.o: ../../include/openssl/mdc2.h ../../include/openssl/objects.h
731p7_s_e.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
732p7_s_e.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
733p7_s_e.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
734p7_s_e.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
735p7_s_e.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
736p7_s_e.o: ../../include/openssl/stack.h ../../include/openssl/x509.h
737p7_s_e.o: ../../include/openssl/x509_vfy.h ../cryptlib.h
738p7_signd.o: ../../include/openssl/asn1.h ../../include/openssl/asn1_mac.h
739p7_signd.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
740p7_signd.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
741p7_signd.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h
742p7_signd.o: ../../include/openssl/des.h ../../include/openssl/dh.h
743p7_signd.o: ../../include/openssl/dsa.h ../../include/openssl/e_os.h
744p7_signd.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
745p7_signd.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
746p7_signd.o: ../../include/openssl/md2.h ../../include/openssl/md5.h
747p7_signd.o: ../../include/openssl/mdc2.h ../../include/openssl/objects.h
748p7_signd.o: ../../include/openssl/opensslconf.h
749p7_signd.o: ../../include/openssl/opensslv.h ../../include/openssl/pkcs7.h
750p7_signd.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
751p7_signd.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
752p7_signd.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
753p7_signd.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
754p7_signd.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
755p7_signd.o: ../cryptlib.h
756p7_signi.o: ../../include/openssl/asn1.h ../../include/openssl/asn1_mac.h
757p7_signi.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
758p7_signi.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
759p7_signi.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h
760p7_signi.o: ../../include/openssl/des.h ../../include/openssl/dh.h
761p7_signi.o: ../../include/openssl/dsa.h ../../include/openssl/e_os.h
762p7_signi.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
763p7_signi.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
764p7_signi.o: ../../include/openssl/md2.h ../../include/openssl/md5.h
765p7_signi.o: ../../include/openssl/mdc2.h ../../include/openssl/objects.h
766p7_signi.o: ../../include/openssl/opensslconf.h
767p7_signi.o: ../../include/openssl/opensslv.h ../../include/openssl/pkcs7.h
768p7_signi.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
769p7_signi.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
770p7_signi.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
771p7_signi.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
772p7_signi.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
773p7_signi.o: ../cryptlib.h
774p8_pkey.o: ../../include/openssl/asn1.h ../../include/openssl/asn1_mac.h
775p8_pkey.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
776p8_pkey.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
777p8_pkey.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h
778p8_pkey.o: ../../include/openssl/des.h ../../include/openssl/dh.h
779p8_pkey.o: ../../include/openssl/dsa.h ../../include/openssl/e_os.h
780p8_pkey.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
781p8_pkey.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
782p8_pkey.o: ../../include/openssl/md2.h ../../include/openssl/md5.h
783p8_pkey.o: ../../include/openssl/mdc2.h ../../include/openssl/objects.h
784p8_pkey.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
785p8_pkey.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
786p8_pkey.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
787p8_pkey.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
788p8_pkey.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
789p8_pkey.o: ../../include/openssl/stack.h ../../include/openssl/x509.h
790p8_pkey.o: ../../include/openssl/x509_vfy.h ../cryptlib.h
791t_crl.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
792t_crl.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
793t_crl.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
794t_crl.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h
795t_crl.o: ../../include/openssl/des.h ../../include/openssl/dh.h
796t_crl.o: ../../include/openssl/dsa.h ../../include/openssl/e_os.h
797t_crl.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
798t_crl.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
799t_crl.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
800t_crl.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
801t_crl.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
802t_crl.o: ../../include/openssl/opensslv.h ../../include/openssl/pkcs7.h
803t_crl.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
804t_crl.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
805t_crl.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
806t_crl.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
807t_crl.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
808t_crl.o: ../../include/openssl/x509v3.h ../cryptlib.h
809t_pkey.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
810t_pkey.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
811t_pkey.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
812t_pkey.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h
813t_pkey.o: ../../include/openssl/err.h ../../include/openssl/opensslconf.h
814t_pkey.o: ../../include/openssl/opensslv.h ../../include/openssl/rsa.h
815t_pkey.o: ../../include/openssl/stack.h ../cryptlib.h
816t_req.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
817t_req.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
818t_req.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
819t_req.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
820t_req.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
821t_req.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h
822t_req.o: ../../include/openssl/err.h ../../include/openssl/evp.h
823t_req.o: ../../include/openssl/idea.h ../../include/openssl/md2.h
824t_req.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
825t_req.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
826t_req.o: ../../include/openssl/opensslv.h ../../include/openssl/pkcs7.h
827t_req.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
828t_req.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
829t_req.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
830t_req.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
831t_req.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
832t_req.o: ../cryptlib.h
833t_x509.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
834t_x509.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
835t_x509.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
836t_x509.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h
837t_x509.o: ../../include/openssl/des.h ../../include/openssl/dh.h
838t_x509.o: ../../include/openssl/dsa.h ../../include/openssl/e_os.h
839t_x509.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
840t_x509.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
841t_x509.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
842t_x509.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
843t_x509.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
844t_x509.o: ../../include/openssl/opensslv.h ../../include/openssl/pkcs7.h
845t_x509.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
846t_x509.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
847t_x509.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
848t_x509.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
849t_x509.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
850t_x509.o: ../../include/openssl/x509v3.h ../cryptlib.h
851x_algor.o: ../../include/openssl/asn1.h ../../include/openssl/asn1_mac.h
852x_algor.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
853x_algor.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
854x_algor.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h
855x_algor.o: ../../include/openssl/des.h ../../include/openssl/dh.h
856x_algor.o: ../../include/openssl/dsa.h ../../include/openssl/e_os.h
857x_algor.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
858x_algor.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
859x_algor.o: ../../include/openssl/md2.h ../../include/openssl/md5.h
860x_algor.o: ../../include/openssl/mdc2.h ../../include/openssl/objects.h
861x_algor.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
862x_algor.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
863x_algor.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
864x_algor.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
865x_algor.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
866x_algor.o: ../../include/openssl/stack.h ../../include/openssl/x509.h
867x_algor.o: ../../include/openssl/x509_vfy.h ../cryptlib.h
868x_attrib.o: ../../include/openssl/asn1.h ../../include/openssl/asn1_mac.h
869x_attrib.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
870x_attrib.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
871x_attrib.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h
872x_attrib.o: ../../include/openssl/des.h ../../include/openssl/dh.h
873x_attrib.o: ../../include/openssl/dsa.h ../../include/openssl/e_os.h
874x_attrib.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
875x_attrib.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
876x_attrib.o: ../../include/openssl/md2.h ../../include/openssl/md5.h
877x_attrib.o: ../../include/openssl/mdc2.h ../../include/openssl/objects.h
878x_attrib.o: ../../include/openssl/opensslconf.h
879x_attrib.o: ../../include/openssl/opensslv.h ../../include/openssl/pkcs7.h
880x_attrib.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
881x_attrib.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
882x_attrib.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
883x_attrib.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
884x_attrib.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
885x_attrib.o: ../cryptlib.h
886x_cinf.o: ../../include/openssl/asn1.h ../../include/openssl/asn1_mac.h
887x_cinf.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
888x_cinf.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
889x_cinf.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h
890x_cinf.o: ../../include/openssl/des.h ../../include/openssl/dh.h
891x_cinf.o: ../../include/openssl/dsa.h ../../include/openssl/e_os.h
892x_cinf.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
893x_cinf.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
894x_cinf.o: ../../include/openssl/md2.h ../../include/openssl/md5.h
895x_cinf.o: ../../include/openssl/mdc2.h ../../include/openssl/objects.h
896x_cinf.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
897x_cinf.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
898x_cinf.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
899x_cinf.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
900x_cinf.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
901x_cinf.o: ../../include/openssl/stack.h ../../include/openssl/x509.h
902x_cinf.o: ../../include/openssl/x509_vfy.h ../cryptlib.h
903x_crl.o: ../../include/openssl/asn1.h ../../include/openssl/asn1_mac.h
904x_crl.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
905x_crl.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
906x_crl.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h
907x_crl.o: ../../include/openssl/des.h ../../include/openssl/dh.h
908x_crl.o: ../../include/openssl/dsa.h ../../include/openssl/e_os.h
909x_crl.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
910x_crl.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
911x_crl.o: ../../include/openssl/md2.h ../../include/openssl/md5.h
912x_crl.o: ../../include/openssl/mdc2.h ../../include/openssl/objects.h
913x_crl.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
914x_crl.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
915x_crl.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
916x_crl.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
917x_crl.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
918x_crl.o: ../../include/openssl/stack.h ../../include/openssl/x509.h
919x_crl.o: ../../include/openssl/x509_vfy.h ../cryptlib.h
920x_exten.o: ../../include/openssl/asn1.h ../../include/openssl/asn1_mac.h
921x_exten.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
922x_exten.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
923x_exten.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h
924x_exten.o: ../../include/openssl/des.h ../../include/openssl/dh.h
925x_exten.o: ../../include/openssl/dsa.h ../../include/openssl/e_os.h
926x_exten.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
927x_exten.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
928x_exten.o: ../../include/openssl/md2.h ../../include/openssl/md5.h
929x_exten.o: ../../include/openssl/mdc2.h ../../include/openssl/objects.h
930x_exten.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
931x_exten.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
932x_exten.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
933x_exten.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
934x_exten.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
935x_exten.o: ../../include/openssl/stack.h ../../include/openssl/x509.h
936x_exten.o: ../../include/openssl/x509_vfy.h ../cryptlib.h
937x_info.o: ../../include/openssl/asn1.h ../../include/openssl/asn1_mac.h
938x_info.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
939x_info.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
940x_info.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h
941x_info.o: ../../include/openssl/des.h ../../include/openssl/dh.h
942x_info.o: ../../include/openssl/dsa.h ../../include/openssl/e_os.h
943x_info.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
944x_info.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
945x_info.o: ../../include/openssl/md2.h ../../include/openssl/md5.h
946x_info.o: ../../include/openssl/mdc2.h ../../include/openssl/objects.h
947x_info.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
948x_info.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
949x_info.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
950x_info.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
951x_info.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
952x_info.o: ../../include/openssl/stack.h ../../include/openssl/x509.h
953x_info.o: ../../include/openssl/x509_vfy.h ../cryptlib.h
954x_name.o: ../../include/openssl/asn1.h ../../include/openssl/asn1_mac.h
955x_name.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
956x_name.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
957x_name.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h
958x_name.o: ../../include/openssl/des.h ../../include/openssl/dh.h
959x_name.o: ../../include/openssl/dsa.h ../../include/openssl/e_os.h
960x_name.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
961x_name.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
962x_name.o: ../../include/openssl/md2.h ../../include/openssl/md5.h
963x_name.o: ../../include/openssl/mdc2.h ../../include/openssl/objects.h
964x_name.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
965x_name.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
966x_name.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
967x_name.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
968x_name.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
969x_name.o: ../../include/openssl/stack.h ../../include/openssl/x509.h
970x_name.o: ../../include/openssl/x509_vfy.h ../cryptlib.h
971x_pkey.o: ../../include/openssl/asn1.h ../../include/openssl/asn1_mac.h
972x_pkey.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
973x_pkey.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
974x_pkey.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h
975x_pkey.o: ../../include/openssl/des.h ../../include/openssl/dh.h
976x_pkey.o: ../../include/openssl/dsa.h ../../include/openssl/e_os.h
977x_pkey.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
978x_pkey.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
979x_pkey.o: ../../include/openssl/md2.h ../../include/openssl/md5.h
980x_pkey.o: ../../include/openssl/mdc2.h ../../include/openssl/objects.h
981x_pkey.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
982x_pkey.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
983x_pkey.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
984x_pkey.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
985x_pkey.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
986x_pkey.o: ../../include/openssl/stack.h ../../include/openssl/x509.h
987x_pkey.o: ../../include/openssl/x509_vfy.h ../cryptlib.h
988x_pubkey.o: ../../include/openssl/asn1.h ../../include/openssl/asn1_mac.h
989x_pubkey.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
990x_pubkey.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
991x_pubkey.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h
992x_pubkey.o: ../../include/openssl/des.h ../../include/openssl/dh.h
993x_pubkey.o: ../../include/openssl/dsa.h ../../include/openssl/e_os.h
994x_pubkey.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
995x_pubkey.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
996x_pubkey.o: ../../include/openssl/md2.h ../../include/openssl/md5.h
997x_pubkey.o: ../../include/openssl/mdc2.h ../../include/openssl/objects.h
998x_pubkey.o: ../../include/openssl/opensslconf.h
999x_pubkey.o: ../../include/openssl/opensslv.h ../../include/openssl/pkcs7.h
1000x_pubkey.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
1001x_pubkey.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
1002x_pubkey.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
1003x_pubkey.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
1004x_pubkey.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
1005x_pubkey.o: ../cryptlib.h
1006x_req.o: ../../include/openssl/asn1.h ../../include/openssl/asn1_mac.h
1007x_req.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
1008x_req.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
1009x_req.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h
1010x_req.o: ../../include/openssl/des.h ../../include/openssl/dh.h
1011x_req.o: ../../include/openssl/dsa.h ../../include/openssl/e_os.h
1012x_req.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
1013x_req.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
1014x_req.o: ../../include/openssl/md2.h ../../include/openssl/md5.h
1015x_req.o: ../../include/openssl/mdc2.h ../../include/openssl/objects.h
1016x_req.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
1017x_req.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
1018x_req.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
1019x_req.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
1020x_req.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
1021x_req.o: ../../include/openssl/stack.h ../../include/openssl/x509.h
1022x_req.o: ../../include/openssl/x509_vfy.h ../cryptlib.h
1023x_sig.o: ../../include/openssl/asn1.h ../../include/openssl/asn1_mac.h
1024x_sig.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
1025x_sig.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
1026x_sig.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h
1027x_sig.o: ../../include/openssl/des.h ../../include/openssl/dh.h
1028x_sig.o: ../../include/openssl/dsa.h ../../include/openssl/e_os.h
1029x_sig.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
1030x_sig.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
1031x_sig.o: ../../include/openssl/md2.h ../../include/openssl/md5.h
1032x_sig.o: ../../include/openssl/mdc2.h ../../include/openssl/objects.h
1033x_sig.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
1034x_sig.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
1035x_sig.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
1036x_sig.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
1037x_sig.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
1038x_sig.o: ../../include/openssl/stack.h ../../include/openssl/x509.h
1039x_sig.o: ../../include/openssl/x509_vfy.h ../cryptlib.h
1040x_spki.o: ../../include/openssl/asn1.h ../../include/openssl/asn1_mac.h
1041x_spki.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
1042x_spki.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
1043x_spki.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h
1044x_spki.o: ../../include/openssl/des.h ../../include/openssl/dh.h
1045x_spki.o: ../../include/openssl/dsa.h ../../include/openssl/e_os.h
1046x_spki.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
1047x_spki.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
1048x_spki.o: ../../include/openssl/md2.h ../../include/openssl/md5.h
1049x_spki.o: ../../include/openssl/mdc2.h ../../include/openssl/objects.h
1050x_spki.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
1051x_spki.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
1052x_spki.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
1053x_spki.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
1054x_spki.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
1055x_spki.o: ../../include/openssl/stack.h ../../include/openssl/x509.h
1056x_spki.o: ../../include/openssl/x509_vfy.h ../cryptlib.h
1057x_val.o: ../../include/openssl/asn1.h ../../include/openssl/asn1_mac.h
1058x_val.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
1059x_val.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
1060x_val.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h
1061x_val.o: ../../include/openssl/des.h ../../include/openssl/dh.h
1062x_val.o: ../../include/openssl/dsa.h ../../include/openssl/e_os.h
1063x_val.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
1064x_val.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
1065x_val.o: ../../include/openssl/md2.h ../../include/openssl/md5.h
1066x_val.o: ../../include/openssl/mdc2.h ../../include/openssl/objects.h
1067x_val.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
1068x_val.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
1069x_val.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
1070x_val.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
1071x_val.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
1072x_val.o: ../../include/openssl/stack.h ../../include/openssl/x509.h
1073x_val.o: ../../include/openssl/x509_vfy.h ../cryptlib.h
1074x_x509.o: ../../include/openssl/asn1.h ../../include/openssl/asn1_mac.h
1075x_x509.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
1076x_x509.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
1077x_x509.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h
1078x_x509.o: ../../include/openssl/des.h ../../include/openssl/dh.h
1079x_x509.o: ../../include/openssl/dsa.h ../../include/openssl/e_os.h
1080x_x509.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
1081x_x509.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
1082x_x509.o: ../../include/openssl/md2.h ../../include/openssl/md5.h
1083x_x509.o: ../../include/openssl/mdc2.h ../../include/openssl/objects.h
1084x_x509.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
1085x_x509.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
1086x_x509.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
1087x_x509.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
1088x_x509.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
1089x_x509.o: ../../include/openssl/stack.h ../../include/openssl/x509.h
1090x_x509.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 2c10120651..38ea802be8 100644
--- a/src/lib/libcrypto/asn1/a_bitstr.c
+++ b/src/lib/libcrypto/asn1/a_bitstr.c
@@ -58,45 +58,60 @@
58 58
59#include <stdio.h> 59#include <stdio.h>
60#include "cryptlib.h" 60#include "cryptlib.h"
61#include "asn1.h" 61#include <openssl/asn1.h>
62 62
63/* ASN1err(ASN1_F_ASN1_STRING_NEW,ASN1_R_STRING_TOO_SHORT); 63int i2d_ASN1_BIT_STRING(ASN1_BIT_STRING *a, unsigned char **pp)
64 * ASN1err(ASN1_F_D2I_ASN1_BIT_STRING,ASN1_R_EXPECTING_A_BIT_STRING);
65 */
66
67int i2d_ASN1_BIT_STRING(a,pp)
68ASN1_BIT_STRING *a;
69unsigned char **pp;
70 { 64 {
71 int ret,j,r,bits; 65 int ret,j,r,bits,len;
72 unsigned char *p,*d; 66 unsigned char *p,*d;
73 67
74 if (a == NULL) return(0); 68 if (a == NULL) return(0);
75 69
76 /* our bit strings are always a multiple of 8 :-) */ 70 len=a->length;
77 bits=0; 71
78 ret=1+a->length; 72 if (len > 0)
73 {
74 if (a->flags & ASN1_STRING_FLAG_BITS_LEFT)
75 {
76 bits=(int)a->flags&0x07;
77 }
78 else
79 {
80 for ( ; len > 0; len--)
81 {
82 if (a->data[len-1]) break;
83 }
84 j=a->data[len-1];
85 if (j & 0x01) bits=0;
86 else if (j & 0x02) bits=1;
87 else if (j & 0x04) bits=2;
88 else if (j & 0x08) bits=3;
89 else if (j & 0x10) bits=4;
90 else if (j & 0x20) bits=5;
91 else if (j & 0x40) bits=6;
92 else if (j & 0x80) bits=7;
93 else bits=0; /* should not happen */
94 }
95 }
96 else
97 bits=0;
98 ret=1+len;
79 r=ASN1_object_size(0,ret,V_ASN1_BIT_STRING); 99 r=ASN1_object_size(0,ret,V_ASN1_BIT_STRING);
80 if (pp == NULL) return(r); 100 if (pp == NULL) return(r);
81 p= *pp; 101 p= *pp;
82 102
83 ASN1_put_object(&p,0,ret,V_ASN1_BIT_STRING,V_ASN1_UNIVERSAL); 103 ASN1_put_object(&p,0,ret,V_ASN1_BIT_STRING,V_ASN1_UNIVERSAL);
84 if (bits == 0) 104 *(p++)=(unsigned char)bits;
85 j=0;
86 else j=8-bits;
87 *(p++)=(unsigned char)j;
88 d=a->data; 105 d=a->data;
89 memcpy(p,d,a->length); 106 memcpy(p,d,len);
90 p+=a->length; 107 p+=len;
91 if (a->length > 0) p[-1]&=(0xff<<j); 108 if (len > 0) p[-1]&=(0xff<<bits);
92 *pp=p; 109 *pp=p;
93 return(r); 110 return(r);
94 } 111 }
95 112
96ASN1_BIT_STRING *d2i_ASN1_BIT_STRING(a, pp, length) 113ASN1_BIT_STRING *d2i_ASN1_BIT_STRING(ASN1_BIT_STRING **a, unsigned char **pp,
97ASN1_BIT_STRING **a; 114 long length)
98unsigned char **pp;
99long length;
100 { 115 {
101 ASN1_BIT_STRING *ret=NULL; 116 ASN1_BIT_STRING *ret=NULL;
102 unsigned char *p,*s; 117 unsigned char *p,*s;
@@ -127,6 +142,12 @@ long length;
127 if (len < 1) { i=ASN1_R_STRING_TOO_SHORT; goto err; } 142 if (len < 1) { i=ASN1_R_STRING_TOO_SHORT; goto err; }
128 143
129 i= *(p++); 144 i= *(p++);
145 /* We do this to preserve the settings. If we modify
146 * the settings, via the _set_bit function, we will recalculate
147 * on output */
148 ret->flags&= ~(ASN1_STRING_FLAG_BITS_LEFT|0x07); /* clear */
149 ret->flags|=(ASN1_STRING_FLAG_BITS_LEFT|(i&0x07)); /* set */
150
130 if (len-- > 1) /* using one because of the bits left byte */ 151 if (len-- > 1) /* using one because of the bits left byte */
131 { 152 {
132 s=(unsigned char *)Malloc((int)len); 153 s=(unsigned char *)Malloc((int)len);
@@ -158,10 +179,7 @@ err:
158 179
159/* These next 2 functions from Goetz Babin-Ebell <babinebell@trustcenter.de> 180/* These next 2 functions from Goetz Babin-Ebell <babinebell@trustcenter.de>
160 */ 181 */
161int ASN1_BIT_STRING_set_bit(a,n,value) 182int ASN1_BIT_STRING_set_bit(ASN1_BIT_STRING *a, int n, int value)
162ASN1_BIT_STRING *a;
163int n;
164int value;
165 { 183 {
166 int w,v,iv; 184 int w,v,iv;
167 unsigned char *c; 185 unsigned char *c;
@@ -170,6 +188,8 @@ int value;
170 v=1<<(7-(n&0x07)); 188 v=1<<(7-(n&0x07));
171 iv= ~v; 189 iv= ~v;
172 190
191 a->flags&= ~(ASN1_STRING_FLAG_BITS_LEFT|0x07); /* clear, set on write */
192
173 if (a == NULL) return(0); 193 if (a == NULL) return(0);
174 if ((a->length < (w+1)) || (a->data == NULL)) 194 if ((a->length < (w+1)) || (a->data == NULL))
175 { 195 {
@@ -189,9 +209,7 @@ int value;
189 return(1); 209 return(1);
190 } 210 }
191 211
192int ASN1_BIT_STRING_get_bit(a,n) 212int ASN1_BIT_STRING_get_bit(ASN1_BIT_STRING *a, int n)
193ASN1_BIT_STRING *a;
194int n;
195 { 213 {
196 int w,v; 214 int w,v;
197 215
diff --git a/src/lib/libcrypto/asn1/a_bmp.c b/src/lib/libcrypto/asn1/a_bmp.c
index 774502b1fc..6075871984 100644
--- a/src/lib/libcrypto/asn1/a_bmp.c
+++ b/src/lib/libcrypto/asn1/a_bmp.c
@@ -58,31 +58,24 @@
58 58
59#include <stdio.h> 59#include <stdio.h>
60#include "cryptlib.h" 60#include "cryptlib.h"
61#include "asn1.h" 61#include <openssl/asn1.h>
62 62
63/* ASN1err(ASN1_F_D2I_ASN1_INTEGER,ASN1_R_EXPECTING_AN_INTEGER); 63int i2d_ASN1_BMPSTRING(ASN1_BMPSTRING *a, unsigned char **pp)
64 */
65
66int i2d_ASN1_BMPSTRING(a, pp)
67ASN1_BMPSTRING *a;
68unsigned char **pp;
69 { 64 {
70 return(i2d_ASN1_bytes((ASN1_STRING *)a,pp, 65 return(i2d_ASN1_bytes((ASN1_STRING *)a,pp,
71 V_ASN1_BMPSTRING,V_ASN1_UNIVERSAL)); 66 V_ASN1_BMPSTRING,V_ASN1_UNIVERSAL));
72 } 67 }
73 68
74ASN1_BMPSTRING *d2i_ASN1_BMPSTRING(a, pp, length) 69ASN1_BMPSTRING *d2i_ASN1_BMPSTRING(ASN1_BMPSTRING **a, unsigned char **pp,
75ASN1_BMPSTRING **a; 70 long length)
76unsigned char **pp;
77long length;
78 { 71 {
79 ASN1_BMPSTRING *ret=NULL; 72 ASN1_BMPSTRING *ret=NULL;
80 73
81 ret=(ASN1_BMPSTRING *)d2i_ASN1_bytes((ASN1_STRING **)a, 74 ret=(ASN1_BMPSTRING *)d2i_ASN1_bytes((ASN1_STRING **)a,
82 pp,length,V_ASN1_BMPSTRING,V_ASN1_UNIVERSAL); 75 pp,length,V_ASN1_BMPSTRING,V_ASN1_UNIVERSAL);
83 if (ret == NULL) 76 if (ret == NULL)
84 { 77 {
85 ASN1err(ASN1_F_D2I_ASN1_BMPSTRING,ASN1_R_ERROR_STACK); 78 ASN1err(ASN1_F_D2I_ASN1_BMPSTRING,ERR_R_NESTED_ASN1_ERROR);
86 return(NULL); 79 return(NULL);
87 } 80 }
88 return(ret); 81 return(ret);
diff --git a/src/lib/libcrypto/asn1/a_bool.c b/src/lib/libcrypto/asn1/a_bool.c
index 41a95aa278..18fa61840b 100644
--- a/src/lib/libcrypto/asn1/a_bool.c
+++ b/src/lib/libcrypto/asn1/a_bool.c
@@ -58,15 +58,9 @@
58 58
59#include <stdio.h> 59#include <stdio.h>
60#include "cryptlib.h" 60#include "cryptlib.h"
61#include "asn1.h" 61#include <openssl/asn1.h>
62 62
63/* ASN1err(ASN1_F_D2I_ASN1_BOOLEAN,ASN1_R_EXPECTING_A_BOOLEAN); 63int i2d_ASN1_BOOLEAN(int a, unsigned char **pp)
64 * ASN1err(ASN1_F_D2I_ASN1_BOOLEAN,ASN1_R_BOOLEAN_IS_WRONG_LENGTH);
65 */
66
67int i2d_ASN1_BOOLEAN(a,pp)
68int a;
69unsigned char **pp;
70 { 64 {
71 int r; 65 int r;
72 unsigned char *p; 66 unsigned char *p;
@@ -81,10 +75,7 @@ unsigned char **pp;
81 return(r); 75 return(r);
82 } 76 }
83 77
84int d2i_ASN1_BOOLEAN(a, pp, length) 78int d2i_ASN1_BOOLEAN(int *a, unsigned char **pp, long length)
85int *a;
86unsigned char **pp;
87long length;
88 { 79 {
89 int ret= -1; 80 int ret= -1;
90 unsigned char *p; 81 unsigned char *p;
diff --git a/src/lib/libcrypto/asn1/a_bytes.c b/src/lib/libcrypto/asn1/a_bytes.c
index 14168d61ad..e452e03b88 100644
--- a/src/lib/libcrypto/asn1/a_bytes.c
+++ b/src/lib/libcrypto/asn1/a_bytes.c
@@ -58,38 +58,24 @@
58 58
59#include <stdio.h> 59#include <stdio.h>
60#include "cryptlib.h" 60#include "cryptlib.h"
61#include "asn1_mac.h" 61#include <openssl/asn1_mac.h>
62
63/* ASN1err(ASN1_F_ASN1_TYPE_NEW,ASN1_R_ERROR_STACK);
64 * ASN1err(ASN1_F_D2I_ASN1_TYPE_BYTES,ASN1_R_ERROR_STACK);
65 * ASN1err(ASN1_F_D2I_ASN1_TYPE_BYTES,ASN1_R_WRONG_TYPE);
66 * ASN1err(ASN1_F_ASN1_COLLATE_PRIMATIVE,ASN1_R_WRONG_TAG);
67 */
68 62
69static unsigned long tag2bit[32]={ 63static unsigned long tag2bit[32]={
700, 0, 0, B_ASN1_BIT_STRING, /* tags 0 - 3 */ 640, 0, 0, B_ASN1_BIT_STRING, /* tags 0 - 3 */
71B_ASN1_OCTET_STRING, 0, 0, B_ASN1_UNKNOWN,/* tags 4- 7 */ 65B_ASN1_OCTET_STRING, 0, 0, B_ASN1_UNKNOWN,/* tags 4- 7 */
72B_ASN1_UNKNOWN, B_ASN1_UNKNOWN, B_ASN1_UNKNOWN, B_ASN1_UNKNOWN,/* tags 8-11 */ 66B_ASN1_UNKNOWN, B_ASN1_UNKNOWN, B_ASN1_UNKNOWN, B_ASN1_UNKNOWN,/* tags 8-11 */
73B_ASN1_UNKNOWN, B_ASN1_UNKNOWN, B_ASN1_UNKNOWN, B_ASN1_UNKNOWN,/* tags 12-15 */ 67B_ASN1_UTF8STRING,B_ASN1_UNKNOWN,B_ASN1_UNKNOWN,B_ASN1_UNKNOWN,/* tags 12-15 */
740, 0, B_ASN1_NUMERICSTRING,B_ASN1_PRINTABLESTRING, 680, 0, B_ASN1_NUMERICSTRING,B_ASN1_PRINTABLESTRING,
75B_ASN1_T61STRING,B_ASN1_VIDEOTEXSTRING,B_ASN1_IA5STRING,0, 69B_ASN1_T61STRING,B_ASN1_VIDEOTEXSTRING,B_ASN1_IA5STRING,0,
760,B_ASN1_GRAPHICSTRING,B_ASN1_ISO64STRING,B_ASN1_GENERALSTRING, 700,B_ASN1_GRAPHICSTRING,B_ASN1_ISO64STRING,B_ASN1_GENERALSTRING,
77B_ASN1_UNIVERSALSTRING,B_ASN1_UNKNOWN,B_ASN1_BMPSTRING,B_ASN1_UNKNOWN, 71B_ASN1_UNIVERSALSTRING,B_ASN1_UNKNOWN,B_ASN1_BMPSTRING,B_ASN1_UNKNOWN,
78 }; 72 };
79 73
80#ifndef NOPROTO
81static int asn1_collate_primative(ASN1_STRING *a, ASN1_CTX *c); 74static int asn1_collate_primative(ASN1_STRING *a, ASN1_CTX *c);
82#else 75/* type is a 'bitmap' of acceptable string types.
83static int asn1_collate_primative();
84#endif
85
86/* type is a 'bitmap' of acceptable string types to be accepted.
87 */ 76 */
88ASN1_STRING *d2i_ASN1_type_bytes(a, pp, length, type) 77ASN1_STRING *d2i_ASN1_type_bytes(ASN1_STRING **a, unsigned char **pp,
89ASN1_STRING **a; 78 long length, int type)
90unsigned char **pp;
91long length;
92int type;
93 { 79 {
94 ASN1_STRING *ret=NULL; 80 ASN1_STRING *ret=NULL;
95 unsigned char *p,*s; 81 unsigned char *p,*s;
@@ -152,11 +138,7 @@ err:
152 return(NULL); 138 return(NULL);
153 } 139 }
154 140
155int i2d_ASN1_bytes(a, pp, tag, xclass) 141int i2d_ASN1_bytes(ASN1_STRING *a, unsigned char **pp, int tag, int xclass)
156ASN1_STRING *a;
157unsigned char **pp;
158int tag;
159int xclass;
160 { 142 {
161 int ret,r,constructed; 143 int ret,r,constructed;
162 unsigned char *p; 144 unsigned char *p;
@@ -182,12 +164,8 @@ int xclass;
182 return(r); 164 return(r);
183 } 165 }
184 166
185ASN1_STRING *d2i_ASN1_bytes(a, pp, length, Ptag, Pclass) 167ASN1_STRING *d2i_ASN1_bytes(ASN1_STRING **a, unsigned char **pp, long length,
186ASN1_STRING **a; 168 int Ptag, int Pclass)
187unsigned char **pp;
188long length;
189int Ptag;
190int Pclass;
191 { 169 {
192 ASN1_STRING *ret=NULL; 170 ASN1_STRING *ret=NULL;
193 unsigned char *p,*s; 171 unsigned char *p,*s;
@@ -279,9 +257,7 @@ err:
279 * them into the one struture that is then returned */ 257 * them into the one struture that is then returned */
280/* There have been a few bug fixes for this function from 258/* There have been a few bug fixes for this function from
281 * Paul Keogh <paul.keogh@sse.ie>, many thanks to him */ 259 * Paul Keogh <paul.keogh@sse.ie>, many thanks to him */
282static int asn1_collate_primative(a,c) 260static int asn1_collate_primative(ASN1_STRING *a, ASN1_CTX *c)
283ASN1_STRING *a;
284ASN1_CTX *c;
285 { 261 {
286 ASN1_STRING *os=NULL; 262 ASN1_STRING *os=NULL;
287 BUF_MEM b; 263 BUF_MEM b;
@@ -338,7 +314,7 @@ ASN1_CTX *c;
338 if (os != NULL) ASN1_STRING_free(os); 314 if (os != NULL) ASN1_STRING_free(os);
339 return(1); 315 return(1);
340err: 316err:
341 ASN1err(ASN1_F_ASN1_COLLATE_PRIMATIVE,c->error); 317 ASN1err(ASN1_F_ASN1_COLLATE_PRIMITIVE,c->error);
342 if (os != NULL) ASN1_STRING_free(os); 318 if (os != NULL) ASN1_STRING_free(os);
343 if (b.data != NULL) Free(b.data); 319 if (b.data != NULL) Free(b.data);
344 return(0); 320 return(0);
diff --git a/src/lib/libcrypto/asn1/a_d2i_fp.c b/src/lib/libcrypto/asn1/a_d2i_fp.c
index d952836a91..a49d1cb289 100644
--- a/src/lib/libcrypto/asn1/a_d2i_fp.c
+++ b/src/lib/libcrypto/asn1/a_d2i_fp.c
@@ -58,17 +58,14 @@
58 58
59#include <stdio.h> 59#include <stdio.h>
60#include "cryptlib.h" 60#include "cryptlib.h"
61#include "buffer.h" 61#include <openssl/buffer.h>
62#include "asn1_mac.h" 62#include <openssl/asn1_mac.h>
63 63
64#define HEADER_SIZE 8 64#define HEADER_SIZE 8
65 65
66#ifndef NO_FP_API 66#ifndef NO_FP_API
67char *ASN1_d2i_fp(xnew,d2i,in,x) 67char *ASN1_d2i_fp(char *(*xnew)(), char *(*d2i)(), FILE *in,
68char *(*xnew)(); 68 unsigned char **x)
69char *(*d2i)();
70FILE *in;
71unsigned char **x;
72 { 69 {
73 BIO *b; 70 BIO *b;
74 char *ret; 71 char *ret;
@@ -85,11 +82,8 @@ unsigned char **x;
85 } 82 }
86#endif 83#endif
87 84
88char *ASN1_d2i_bio(xnew,d2i,in,x) 85char *ASN1_d2i_bio(char *(*xnew)(), char *(*d2i)(), BIO *in,
89char *(*xnew)(); 86 unsigned char **x)
90char *(*d2i)();
91BIO *in;
92unsigned char **x;
93 { 87 {
94 BUF_MEM *b; 88 BUF_MEM *b;
95 unsigned char *p; 89 unsigned char *p;
diff --git a/src/lib/libcrypto/asn1/a_digest.c b/src/lib/libcrypto/asn1/a_digest.c
index 8ddb65b0dc..8c45add557 100644
--- a/src/lib/libcrypto/asn1/a_digest.c
+++ b/src/lib/libcrypto/asn1/a_digest.c
@@ -62,16 +62,12 @@
62#include <sys/stat.h> 62#include <sys/stat.h>
63 63
64#include "cryptlib.h" 64#include "cryptlib.h"
65#include "evp.h" 65#include <openssl/evp.h>
66#include "x509.h" 66#include <openssl/buffer.h>
67#include "buffer.h" 67#include <openssl/x509.h>
68 68
69int ASN1_digest(i2d,type,data,md,len) 69int ASN1_digest(int (*i2d)(), EVP_MD *type, char *data, unsigned char *md,
70int (*i2d)(); 70 unsigned int *len)
71EVP_MD *type;
72char *data;
73unsigned char *md;
74unsigned int *len;
75 { 71 {
76 EVP_MD_CTX ctx; 72 EVP_MD_CTX ctx;
77 int i; 73 int i;
diff --git a/src/lib/libcrypto/asn1/a_dup.c b/src/lib/libcrypto/asn1/a_dup.c
index 961b4cb069..c0a8709f3b 100644
--- a/src/lib/libcrypto/asn1/a_dup.c
+++ b/src/lib/libcrypto/asn1/a_dup.c
@@ -58,14 +58,11 @@
58 58
59#include <stdio.h> 59#include <stdio.h>
60#include "cryptlib.h" 60#include "cryptlib.h"
61#include "asn1_mac.h" 61#include <openssl/asn1_mac.h>
62 62
63#define READ_CHUNK 2048 63#define READ_CHUNK 2048
64 64
65char *ASN1_dup(i2d,d2i,x) 65char *ASN1_dup(int (*i2d)(), char *(*d2i)(), char *x)
66int (*i2d)();
67char *(*d2i)();
68char *x;
69 { 66 {
70 unsigned char *b,*p; 67 unsigned char *b,*p;
71 long i; 68 long i;
diff --git a/src/lib/libcrypto/asn1/a_enum.c b/src/lib/libcrypto/asn1/a_enum.c
new file mode 100644
index 0000000000..9239ecc439
--- /dev/null
+++ b/src/lib/libcrypto/asn1/a_enum.c
@@ -0,0 +1,326 @@
1/* crypto/asn1/a_enum.c */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved.
4 *
5 * This package is an SSL implementation written
6 * by Eric Young (eay@cryptsoft.com).
7 * The implementation was written so as to conform with Netscapes SSL.
8 *
9 * This library is free for commercial and non-commercial use as long as
10 * the following conditions are aheared to. The following conditions
11 * apply to all code found in this distribution, be it the RC4, RSA,
12 * lhash, DES, etc., code; not just the SSL code. The SSL documentation
13 * included with this distribution is covered by the same copyright terms
14 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
15 *
16 * Copyright remains Eric Young's, and as such any Copyright notices in
17 * the code are not to be removed.
18 * If this package is used in a product, Eric Young should be given attribution
19 * as the author of the parts of the library used.
20 * This can be in the form of a textual message at program startup or
21 * in documentation (online or textual) provided with the package.
22 *
23 * Redistribution and use in source and binary forms, with or without
24 * modification, are permitted provided that the following conditions
25 * are met:
26 * 1. Redistributions of source code must retain the copyright
27 * notice, this list of conditions and the following disclaimer.
28 * 2. Redistributions in binary form must reproduce the above copyright
29 * notice, this list of conditions and the following disclaimer in the
30 * documentation and/or other materials provided with the distribution.
31 * 3. All advertising materials mentioning features or use of this software
32 * must display the following acknowledgement:
33 * "This product includes cryptographic software written by
34 * Eric Young (eay@cryptsoft.com)"
35 * The word 'cryptographic' can be left out if the rouines from the library
36 * being used are not cryptographic related :-).
37 * 4. If you include any Windows specific code (or a derivative thereof) from
38 * the apps directory (application code) you must include an acknowledgement:
39 * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
40 *
41 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
42 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
43 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
44 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
45 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
46 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
47 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
49 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
50 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
51 * SUCH DAMAGE.
52 *
53 * The licence and distribution terms for any publically available version or
54 * derivative of this code cannot be changed. i.e. this code cannot simply be
55 * copied and put under another distribution licence
56 * [including the GNU Public Licence.]
57 */
58
59#include <stdio.h>
60#include "cryptlib.h"
61#include <openssl/asn1.h>
62
63/*
64 * Code for ENUMERATED type: identical to INTEGER apart from a different tag.
65 * for comments on encoding see a_int.c
66 */
67
68int i2d_ASN1_ENUMERATED(ASN1_ENUMERATED *a, unsigned char **pp)
69 {
70 int pad=0,ret,r,i,t;
71 unsigned char *p,*n,pb=0;
72
73 if ((a == NULL) || (a->data == NULL)) return(0);
74 t=a->type;
75 if (a->length == 0)
76 ret=1;
77 else
78 {
79 ret=a->length;
80 i=a->data[0];
81 if ((t == V_ASN1_ENUMERATED) && (i > 127)) {
82 pad=1;
83 pb=0;
84 } else if(t == V_ASN1_NEG_ENUMERATED) {
85 if(i>128) {
86 pad=1;
87 pb=0xFF;
88 } else if(i == 128) {
89 for(i = 1; i < a->length; i++) if(a->data[i]) {
90 pad=1;
91 pb=0xFF;
92 break;
93 }
94 }
95 }
96 ret+=pad;
97 }
98 r=ASN1_object_size(0,ret,V_ASN1_ENUMERATED);
99 if (pp == NULL) return(r);
100 p= *pp;
101
102 ASN1_put_object(&p,0,ret,V_ASN1_ENUMERATED,V_ASN1_UNIVERSAL);
103 if (pad) *(p++)=pb;
104 if (a->length == 0)
105 *(p++)=0;
106 else if (t == V_ASN1_ENUMERATED)
107 {
108 memcpy(p,a->data,(unsigned int)a->length);
109 p+=a->length;
110 }
111 else {
112 /* Begin at the end of the encoding */
113 n=a->data + a->length - 1;
114 p += a->length - 1;
115 i = a->length;
116 /* Copy zeros to destination as long as source is zero */
117 while(!*n) {
118 *(p--) = 0;
119 n--;
120 i--;
121 }
122 /* Complement and increment next octet */
123 *(p--) = ((*(n--)) ^ 0xff) + 1;
124 i--;
125 /* Complement any octets left */
126 for(;i > 0; i--) *(p--) = *(n--) ^ 0xff;
127 p += a->length;
128 }
129
130 *pp=p;
131 return(r);
132 }
133
134ASN1_ENUMERATED *d2i_ASN1_ENUMERATED(ASN1_ENUMERATED **a, unsigned char **pp,
135 long length)
136 {
137 ASN1_ENUMERATED *ret=NULL;
138 unsigned char *p,*to,*s;
139 long len;
140 int inf,tag,xclass;
141 int i;
142
143 if ((a == NULL) || ((*a) == NULL))
144 {
145 if ((ret=ASN1_ENUMERATED_new()) == NULL) return(NULL);
146 ret->type=V_ASN1_ENUMERATED;
147 }
148 else
149 ret=(*a);
150
151 p= *pp;
152 inf=ASN1_get_object(&p,&len,&tag,&xclass,length);
153 if (inf & 0x80)
154 {
155 i=ASN1_R_BAD_OBJECT_HEADER;
156 goto err;
157 }
158
159 if (tag != V_ASN1_ENUMERATED)
160 {
161 i=ASN1_R_EXPECTING_AN_ENUMERATED;
162 goto err;
163 }
164
165 /* We must Malloc stuff, even for 0 bytes otherwise it
166 * signifies a missing NULL parameter. */
167 s=(unsigned char *)Malloc((int)len+1);
168 if (s == NULL)
169 {
170 i=ERR_R_MALLOC_FAILURE;
171 goto err;
172 }
173 to=s;
174 if (*p & 0x80) /* a negative number */
175 {
176 ret->type=V_ASN1_NEG_ENUMERATED;
177 if ((*p == 0xff) && (len != 1)) {
178 p++;
179 len--;
180 }
181 i = len;
182 p += i - 1;
183 to += i - 1;
184 while((!*p) && i) {
185 *(to--) = 0;
186 i--;
187 p--;
188 }
189 if(!i) {
190 *s = 1;
191 s[len] = 0;
192 p += len;
193 len++;
194 } else {
195 *(to--) = (*(p--) ^ 0xff) + 1;
196 i--;
197 for(;i > 0; i--) *(to--) = *(p--) ^ 0xff;
198 p += len;
199 }
200 } else {
201 ret->type=V_ASN1_ENUMERATED;
202 if ((*p == 0) && (len != 1))
203 {
204 p++;
205 len--;
206 }
207 memcpy(s,p,(int)len);
208 p+=len;
209 }
210
211 if (ret->data != NULL) Free((char *)ret->data);
212 ret->data=s;
213 ret->length=(int)len;
214 if (a != NULL) (*a)=ret;
215 *pp=p;
216 return(ret);
217err:
218 ASN1err(ASN1_F_D2I_ASN1_ENUMERATED,i);
219 if ((ret != NULL) && ((a == NULL) || (*a != ret)))
220 ASN1_ENUMERATED_free(ret);
221 return(NULL);
222 }
223
224int ASN1_ENUMERATED_set(ASN1_ENUMERATED *a, long v)
225 {
226 int i,j,k;
227 unsigned char buf[sizeof(long)+1];
228 long d;
229
230 a->type=V_ASN1_ENUMERATED;
231 if (a->length < (sizeof(long)+1))
232 {
233 if (a->data != NULL)
234 Free((char *)a->data);
235 if ((a->data=(unsigned char *)Malloc(sizeof(long)+1)) != NULL)
236 memset((char *)a->data,0,sizeof(long)+1);
237 }
238 if (a->data == NULL)
239 {
240 ASN1err(ASN1_F_ASN1_ENUMERATED_SET,ERR_R_MALLOC_FAILURE);
241 return(0);
242 }
243 d=v;
244 if (d < 0)
245 {
246 d= -d;
247 a->type=V_ASN1_NEG_ENUMERATED;
248 }
249
250 for (i=0; i<sizeof(long); i++)
251 {
252 if (d == 0) break;
253 buf[i]=(int)d&0xff;
254 d>>=8;
255 }
256 j=0;
257 for (k=i-1; k >=0; k--)
258 a->data[j++]=buf[k];
259 a->length=j;
260 return(1);
261 }
262
263long ASN1_ENUMERATED_get(ASN1_ENUMERATED *a)
264 {
265 int neg=0,i;
266 long r=0;
267
268 if (a == NULL) return(0L);
269 i=a->type;
270 if (i == V_ASN1_NEG_ENUMERATED)
271 neg=1;
272 else if (i != V_ASN1_ENUMERATED)
273 return(0);
274
275 if (a->length > sizeof(long))
276 {
277 /* hmm... a bit ugly */
278 return(0xffffffffL);
279 }
280 if (a->data == NULL)
281 return(0);
282
283 for (i=0; i<a->length; i++)
284 {
285 r<<=8;
286 r|=(unsigned char)a->data[i];
287 }
288 if (neg) r= -r;
289 return(r);
290 }
291
292ASN1_ENUMERATED *BN_to_ASN1_ENUMERATED(BIGNUM *bn, ASN1_ENUMERATED *ai)
293 {
294 ASN1_ENUMERATED *ret;
295 int len,j;
296
297 if (ai == NULL)
298 ret=ASN1_ENUMERATED_new();
299 else
300 ret=ai;
301 if (ret == NULL)
302 {
303 ASN1err(ASN1_F_BN_TO_ASN1_ENUMERATED,ERR_R_NESTED_ASN1_ERROR);
304 goto err;
305 }
306 if(bn->neg) ret->type = V_ASN1_NEG_ENUMERATED;
307 else ret->type=V_ASN1_ENUMERATED;
308 j=BN_num_bits(bn);
309 len=((j == 0)?0:((j/8)+1));
310 ret->data=(unsigned char *)Malloc(len+4);
311 ret->length=BN_bn2bin(bn,ret->data);
312 return(ret);
313err:
314 if (ret != ai) ASN1_ENUMERATED_free(ret);
315 return(NULL);
316 }
317
318BIGNUM *ASN1_ENUMERATED_to_BN(ASN1_ENUMERATED *ai, BIGNUM *bn)
319 {
320 BIGNUM *ret;
321
322 if ((ret=BN_bin2bn(ai->data,ai->length,bn)) == NULL)
323 ASN1err(ASN1_F_ASN1_ENUMERATED_TO_BN,ASN1_R_BN_LIB);
324 if(ai->type == V_ASN1_NEG_ENUMERATED) bn->neg = 1;
325 return(ret);
326 }
diff --git a/src/lib/libcrypto/asn1/a_gentm.c b/src/lib/libcrypto/asn1/a_gentm.c
new file mode 100644
index 0000000000..226474f057
--- /dev/null
+++ b/src/lib/libcrypto/asn1/a_gentm.c
@@ -0,0 +1,224 @@
1/* crypto/asn1/a_gentm.c */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved.
4 *
5 * This package is an SSL implementation written
6 * by Eric Young (eay@cryptsoft.com).
7 * The implementation was written so as to conform with Netscapes SSL.
8 *
9 * This library is free for commercial and non-commercial use as long as
10 * the following conditions are aheared to. The following conditions
11 * apply to all code found in this distribution, be it the RC4, RSA,
12 * lhash, DES, etc., code; not just the SSL code. The SSL documentation
13 * included with this distribution is covered by the same copyright terms
14 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
15 *
16 * Copyright remains Eric Young's, and as such any Copyright notices in
17 * the code are not to be removed.
18 * If this package is used in a product, Eric Young should be given attribution
19 * as the author of the parts of the library used.
20 * This can be in the form of a textual message at program startup or
21 * in documentation (online or textual) provided with the package.
22 *
23 * Redistribution and use in source and binary forms, with or without
24 * modification, are permitted provided that the following conditions
25 * are met:
26 * 1. Redistributions of source code must retain the copyright
27 * notice, this list of conditions and the following disclaimer.
28 * 2. Redistributions in binary form must reproduce the above copyright
29 * notice, this list of conditions and the following disclaimer in the
30 * documentation and/or other materials provided with the distribution.
31 * 3. All advertising materials mentioning features or use of this software
32 * must display the following acknowledgement:
33 * "This product includes cryptographic software written by
34 * Eric Young (eay@cryptsoft.com)"
35 * The word 'cryptographic' can be left out if the rouines from the library
36 * being used are not cryptographic related :-).
37 * 4. If you include any Windows specific code (or a derivative thereof) from
38 * the apps directory (application code) you must include an acknowledgement:
39 * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
40 *
41 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
42 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
43 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
44 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
45 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
46 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
47 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
49 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
50 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
51 * SUCH DAMAGE.
52 *
53 * The licence and distribution terms for any publically available version or
54 * derivative of this code cannot be changed. i.e. this code cannot simply be
55 * copied and put under another distribution licence
56 * [including the GNU Public Licence.]
57 */
58
59/* GENERALIZEDTIME implementation, written by Steve Henson. Based on UTCTIME */
60
61#include <stdio.h>
62#include <time.h>
63#include "cryptlib.h"
64#include <openssl/asn1.h>
65
66int i2d_ASN1_GENERALIZEDTIME(ASN1_GENERALIZEDTIME *a, unsigned char **pp)
67 {
68#ifdef CHARSET_EBCDIC
69 /* KLUDGE! We convert to ascii before writing DER */
70 int len;
71 char tmp[24];
72 ASN1_STRING tmpstr = *(ASN1_STRING *)a;
73
74 len = tmpstr.length;
75 ebcdic2ascii(tmp, tmpstr.data, (len >= sizeof tmp) ? sizeof tmp : len);
76 tmpstr.data = tmp;
77
78 a = (ASN1_GENERALIZEDTIME *) &tmpstr;
79#endif
80 return(i2d_ASN1_bytes((ASN1_STRING *)a,pp,
81 V_ASN1_GENERALIZEDTIME,V_ASN1_UNIVERSAL));
82 }
83
84
85ASN1_GENERALIZEDTIME *d2i_ASN1_GENERALIZEDTIME(ASN1_GENERALIZEDTIME **a,
86 unsigned char **pp, long length)
87 {
88 ASN1_GENERALIZEDTIME *ret=NULL;
89
90 ret=(ASN1_GENERALIZEDTIME *)d2i_ASN1_bytes((ASN1_STRING **)a,pp,length,
91 V_ASN1_GENERALIZEDTIME,V_ASN1_UNIVERSAL);
92 if (ret == NULL)
93 {
94 ASN1err(ASN1_F_D2I_ASN1_GENERALIZEDTIME,ERR_R_NESTED_ASN1_ERROR);
95 return(NULL);
96 }
97#ifdef CHARSET_EBCDIC
98 ascii2ebcdic(ret->data, ret->data, ret->length);
99#endif
100 if (!ASN1_GENERALIZEDTIME_check(ret))
101 {
102 ASN1err(ASN1_F_D2I_ASN1_GENERALIZEDTIME,ASN1_R_INVALID_TIME_FORMAT);
103 goto err;
104 }
105
106 return(ret);
107err:
108 if ((ret != NULL) && ((a == NULL) || (*a != ret)))
109 ASN1_GENERALIZEDTIME_free(ret);
110 return(NULL);
111 }
112
113int ASN1_GENERALIZEDTIME_check(ASN1_GENERALIZEDTIME *d)
114 {
115 static int min[9]={ 0, 0, 1, 1, 0, 0, 0, 0, 0};
116 static int max[9]={99, 99,12,31,23,59,59,12,59};
117 char *a;
118 int n,i,l,o;
119
120 if (d->type != V_ASN1_GENERALIZEDTIME) return(0);
121 l=d->length;
122 a=(char *)d->data;
123 o=0;
124 /* GENERALIZEDTIME is similar to UTCTIME except the year is
125 * represented as YYYY. This stuff treats everything as a two digit
126 * field so make first two fields 00 to 99
127 */
128 if (l < 13) goto err;
129 for (i=0; i<7; i++)
130 {
131 if ((i == 6) && ((a[o] == 'Z') ||
132 (a[o] == '+') || (a[o] == '-')))
133 { i++; break; }
134 if ((a[o] < '0') || (a[o] > '9')) goto err;
135 n= a[o]-'0';
136 if (++o > l) goto err;
137
138 if ((a[o] < '0') || (a[o] > '9')) goto err;
139 n=(n*10)+ a[o]-'0';
140 if (++o > l) goto err;
141
142 if ((n < min[i]) || (n > max[i])) goto err;
143 }
144 if (a[o] == 'Z')
145 o++;
146 else if ((a[o] == '+') || (a[o] == '-'))
147 {
148 o++;
149 if (o+4 > l) goto err;
150 for (i=7; i<9; i++)
151 {
152 if ((a[o] < '0') || (a[o] > '9')) goto err;
153 n= a[o]-'0';
154 o++;
155 if ((a[o] < '0') || (a[o] > '9')) goto err;
156 n=(n*10)+ a[o]-'0';
157 if ((n < min[i]) || (n > max[i])) goto err;
158 o++;
159 }
160 }
161 return(o == l);
162err:
163 return(0);
164 }
165
166int ASN1_GENERALIZEDTIME_set_string(ASN1_GENERALIZEDTIME *s, char *str)
167 {
168 ASN1_GENERALIZEDTIME t;
169
170 t.type=V_ASN1_GENERALIZEDTIME;
171 t.length=strlen(str);
172 t.data=(unsigned char *)str;
173 if (ASN1_GENERALIZEDTIME_check(&t))
174 {
175 if (s != NULL)
176 {
177 ASN1_STRING_set((ASN1_STRING *)s,
178 (unsigned char *)str,t.length);
179 }
180 return(1);
181 }
182 else
183 return(0);
184 }
185
186ASN1_GENERALIZEDTIME *ASN1_GENERALIZEDTIME_set(ASN1_GENERALIZEDTIME *s,
187 time_t t)
188 {
189 char *p;
190 struct tm *ts;
191#if defined(THREADS) && !defined(WIN32)
192 struct tm data;
193#endif
194
195 if (s == NULL)
196 s=ASN1_GENERALIZEDTIME_new();
197 if (s == NULL)
198 return(NULL);
199
200#if defined(THREADS) && !defined(WIN32)
201 gmtime_r(&t,&data); /* should return &data, but doesn't on some systems, so we don't even look at the return value */
202 ts=&data;
203#else
204 ts=gmtime(&t);
205#endif
206 p=(char *)s->data;
207 if ((p == NULL) || (s->length < 16))
208 {
209 p=Malloc(20);
210 if (p == NULL) return(NULL);
211 if (s->data != NULL)
212 Free(s->data);
213 s->data=(unsigned char *)p;
214 }
215
216 sprintf(p,"%04d%02d%02d%02d%02d%02dZ",ts->tm_year + 1900,
217 ts->tm_mon+1,ts->tm_mday,ts->tm_hour,ts->tm_min,ts->tm_sec);
218 s->length=strlen(p);
219 s->type=V_ASN1_GENERALIZEDTIME;
220#ifdef CHARSET_EBCDIC_not
221 ebcdic2ascii(s->data, s->data, s->length);
222#endif
223 return(s);
224 }
diff --git a/src/lib/libcrypto/asn1/a_hdr.c b/src/lib/libcrypto/asn1/a_hdr.c
index 4fb7a5fa75..1171d36443 100644
--- a/src/lib/libcrypto/asn1/a_hdr.c
+++ b/src/lib/libcrypto/asn1/a_hdr.c
@@ -58,19 +58,10 @@
58 58
59#include <stdio.h> 59#include <stdio.h>
60#include "cryptlib.h" 60#include "cryptlib.h"
61#include "asn1_mac.h" 61#include <openssl/asn1_mac.h>
62#include "asn1.h" 62#include <openssl/asn1.h>
63 63
64/* 64int i2d_ASN1_HEADER(ASN1_HEADER *a, unsigned char **pp)
65 * ASN1err(ASN1_F_D2I_ASN1_HEADER,ASN1_R_LENGTH_MISMATCH);
66 * ASN1err(ASN1_F_I2D_ASN1_HEADER,ASN1_R_BAD_GET_OBJECT);
67 * ASN1err(ASN1_F_I2D_ASN1_HEADER,ASN1_R_BAD_GET_OBJECT);
68 * ASN1err(ASN1_F_ASN1_HEADER_NEW,ASN1_R_BAD_GET_OBJECT);
69 */
70
71int i2d_ASN1_HEADER(a,pp)
72ASN1_HEADER *a;
73unsigned char **pp;
74 { 65 {
75 M_ASN1_I2D_vars(a); 66 M_ASN1_I2D_vars(a);
76 67
@@ -85,10 +76,8 @@ unsigned char **pp;
85 M_ASN1_I2D_finish(); 76 M_ASN1_I2D_finish();
86 } 77 }
87 78
88ASN1_HEADER *d2i_ASN1_HEADER(a,pp,length) 79ASN1_HEADER *d2i_ASN1_HEADER(ASN1_HEADER **a, unsigned char **pp,
89ASN1_HEADER **a; 80 long length)
90unsigned char **pp;
91long length;
92 { 81 {
93 M_ASN1_D2I_vars(a,ASN1_HEADER *,ASN1_HEADER_new); 82 M_ASN1_D2I_vars(a,ASN1_HEADER *,ASN1_HEADER_new);
94 83
@@ -107,9 +96,10 @@ long length;
107 M_ASN1_D2I_Finish(a,ASN1_HEADER_free,ASN1_F_D2I_ASN1_HEADER); 96 M_ASN1_D2I_Finish(a,ASN1_HEADER_free,ASN1_F_D2I_ASN1_HEADER);
108 } 97 }
109 98
110ASN1_HEADER *ASN1_HEADER_new() 99ASN1_HEADER *ASN1_HEADER_new(void)
111 { 100 {
112 ASN1_HEADER *ret=NULL; 101 ASN1_HEADER *ret=NULL;
102 ASN1_CTX c;
113 103
114 M_ASN1_New_Malloc(ret,ASN1_HEADER); 104 M_ASN1_New_Malloc(ret,ASN1_HEADER);
115 M_ASN1_New(ret->header,ASN1_OCTET_STRING_new); 105 M_ASN1_New(ret->header,ASN1_OCTET_STRING_new);
@@ -119,8 +109,7 @@ ASN1_HEADER *ASN1_HEADER_new()
119 M_ASN1_New_Error(ASN1_F_ASN1_HEADER_NEW); 109 M_ASN1_New_Error(ASN1_F_ASN1_HEADER_NEW);
120 } 110 }
121 111
122void ASN1_HEADER_free(a) 112void ASN1_HEADER_free(ASN1_HEADER *a)
123ASN1_HEADER *a;
124 { 113 {
125 if (a == NULL) return; 114 if (a == NULL) return;
126 ASN1_OCTET_STRING_free(a->header); 115 ASN1_OCTET_STRING_free(a->header);
diff --git a/src/lib/libcrypto/asn1/a_i2d_fp.c b/src/lib/libcrypto/asn1/a_i2d_fp.c
index 66c3df68d5..6bd845443c 100644
--- a/src/lib/libcrypto/asn1/a_i2d_fp.c
+++ b/src/lib/libcrypto/asn1/a_i2d_fp.c
@@ -58,14 +58,11 @@
58 58
59#include <stdio.h> 59#include <stdio.h>
60#include "cryptlib.h" 60#include "cryptlib.h"
61#include "buffer.h" 61#include <openssl/buffer.h>
62#include "asn1_mac.h" 62#include <openssl/asn1_mac.h>
63 63
64#ifndef NO_FP_API 64#ifndef NO_FP_API
65int ASN1_i2d_fp(i2d,out,x) 65int ASN1_i2d_fp(int (*i2d)(), FILE *out, unsigned char *x)
66int (*i2d)();
67FILE *out;
68unsigned char *x;
69 { 66 {
70 BIO *b; 67 BIO *b;
71 int ret; 68 int ret;
@@ -82,10 +79,7 @@ unsigned char *x;
82 } 79 }
83#endif 80#endif
84 81
85int ASN1_i2d_bio(i2d,out,x) 82int ASN1_i2d_bio(int (*i2d)(), BIO *out, unsigned char *x)
86int (*i2d)();
87BIO *out;
88unsigned char *x;
89 { 83 {
90 char *b; 84 char *b;
91 unsigned char *p; 85 unsigned char *p;
diff --git a/src/lib/libcrypto/asn1/a_int.c b/src/lib/libcrypto/asn1/a_int.c
index df79cf99bb..d05436378b 100644
--- a/src/lib/libcrypto/asn1/a_int.c
+++ b/src/lib/libcrypto/asn1/a_int.c
@@ -58,17 +58,37 @@
58 58
59#include <stdio.h> 59#include <stdio.h>
60#include "cryptlib.h" 60#include "cryptlib.h"
61#include "asn1.h" 61#include <openssl/asn1.h>
62 62
63/* ASN1err(ASN1_F_D2I_ASN1_INTEGER,ASN1_R_EXPECTING_AN_INTEGER); 63/*
64 * This converts an ASN1 INTEGER into its DER encoding.
65 * The internal representation is an ASN1_STRING whose data is a big endian
66 * representation of the value, ignoring the sign. The sign is determined by
67 * the type: V_ASN1_INTEGER for positive and V_ASN1_NEG_INTEGER for negative.
68 *
69 * Positive integers are no problem: they are almost the same as the DER
70 * encoding, except if the first byte is >= 0x80 we need to add a zero pad.
71 *
72 * Negative integers are a bit trickier...
73 * The DER representation of negative integers is in 2s complement form.
74 * The internal form is converted by complementing each octet and finally
75 * adding one to the result. This can be done less messily with a little trick.
76 * If the internal form has trailing zeroes then they will become FF by the
77 * complement and 0 by the add one (due to carry) so just copy as many trailing
78 * zeros to the destination as there are in the source. The carry will add one
79 * to the last none zero octet: so complement this octet and add one and finally
80 * complement any left over until you get to the start of the string.
81 *
82 * Padding is a little trickier too. If the first bytes is > 0x80 then we pad
83 * with 0xff. However if the first byte is 0x80 and one of the following bytes
84 * is non-zero we pad with 0xff. The reason for this distinction is that 0x80
85 * followed by optional zeros isn't padded.
64 */ 86 */
65 87
66int i2d_ASN1_INTEGER(a,pp) 88int i2d_ASN1_INTEGER(ASN1_INTEGER *a, unsigned char **pp)
67ASN1_INTEGER *a;
68unsigned char **pp;
69 { 89 {
70 int pad=0,ret,r,i,t; 90 int pad=0,ret,r,i,t;
71 unsigned char *p,*pt,*n,pb=0; 91 unsigned char *p,*n,pb=0;
72 92
73 if ((a == NULL) || (a->data == NULL)) return(0); 93 if ((a == NULL) || (a->data == NULL)) return(0);
74 t=a->type; 94 t=a->type;
@@ -78,16 +98,25 @@ unsigned char **pp;
78 { 98 {
79 ret=a->length; 99 ret=a->length;
80 i=a->data[0]; 100 i=a->data[0];
81 if ((t == V_ASN1_INTEGER) && (i > 127)) 101 if ((t == V_ASN1_INTEGER) && (i > 127)) {
82 {
83 pad=1; 102 pad=1;
84 pb=0; 103 pb=0;
104 } else if(t == V_ASN1_NEG_INTEGER) {
105 if(i>128) {
106 pad=1;
107 pb=0xFF;
108 } else if(i == 128) {
109 /*
110 * Special case: if any other bytes non zero we pad:
111 * otherwise we don't.
112 */
113 for(i = 1; i < a->length; i++) if(a->data[i]) {
114 pad=1;
115 pb=0xFF;
116 break;
117 }
85 } 118 }
86 else if ((t == V_ASN1_NEG_INTEGER) && (i>128)) 119 }
87 {
88 pad=1;
89 pb=0xFF;
90 }
91 ret+=pad; 120 ret+=pad;
92 } 121 }
93 r=ASN1_object_size(0,ret,V_ASN1_INTEGER); 122 r=ASN1_object_size(0,ret,V_ASN1_INTEGER);
@@ -96,33 +125,35 @@ unsigned char **pp;
96 125
97 ASN1_put_object(&p,0,ret,V_ASN1_INTEGER,V_ASN1_UNIVERSAL); 126 ASN1_put_object(&p,0,ret,V_ASN1_INTEGER,V_ASN1_UNIVERSAL);
98 if (pad) *(p++)=pb; 127 if (pad) *(p++)=pb;
99 if (a->length == 0) 128 if (a->length == 0) *(p++)=0;
100 *(p++)=0; 129 else if (t == V_ASN1_INTEGER) memcpy(p,a->data,(unsigned int)a->length);
101 else if (t == V_ASN1_INTEGER) 130 else {
102 { 131 /* Begin at the end of the encoding */
103 memcpy(p,a->data,(unsigned int)a->length); 132 n=a->data + a->length - 1;
104 p+=a->length; 133 p += a->length - 1;
105 } 134 i = a->length;
106 else 135 /* Copy zeros to destination as long as source is zero */
107 { 136 while(!*n) {
108 n=a->data; 137 *(p--) = 0;
109 pt=p; 138 n--;
110 for (i=a->length; i>0; i--) 139 i--;
111 *(p++)= (*(n++)^0xFF)+1;
112 if (!pad) *pt|=0x80;
113 } 140 }
141 /* Complement and increment next octet */
142 *(p--) = ((*(n--)) ^ 0xff) + 1;
143 i--;
144 /* Complement any octets left */
145 for(;i > 0; i--) *(p--) = *(n--) ^ 0xff;
146 }
114 147
115 *pp=p; 148 *pp+=r;
116 return(r); 149 return(r);
117 } 150 }
118 151
119ASN1_INTEGER *d2i_ASN1_INTEGER(a, pp, length) 152ASN1_INTEGER *d2i_ASN1_INTEGER(ASN1_INTEGER **a, unsigned char **pp,
120ASN1_INTEGER **a; 153 long length)
121unsigned char **pp;
122long length;
123 { 154 {
124 ASN1_INTEGER *ret=NULL; 155 ASN1_INTEGER *ret=NULL;
125 unsigned char *p,*to,*s; 156 unsigned char *p,*to,*s, *pend;
126 long len; 157 long len;
127 int inf,tag,xclass; 158 int inf,tag,xclass;
128 int i; 159 int i;
@@ -137,6 +168,7 @@ long length;
137 168
138 p= *pp; 169 p= *pp;
139 inf=ASN1_get_object(&p,&len,&tag,&xclass,length); 170 inf=ASN1_get_object(&p,&len,&tag,&xclass,length);
171 pend = p + len;
140 if (inf & 0x80) 172 if (inf & 0x80)
141 { 173 {
142 i=ASN1_R_BAD_OBJECT_HEADER; 174 i=ASN1_R_BAD_OBJECT_HEADER;
@@ -161,16 +193,102 @@ long length;
161 if (*p & 0x80) /* a negative number */ 193 if (*p & 0x80) /* a negative number */
162 { 194 {
163 ret->type=V_ASN1_NEG_INTEGER; 195 ret->type=V_ASN1_NEG_INTEGER;
164 if (*p == 0xff) 196 if ((*p == 0xff) && (len != 1)) {
197 p++;
198 len--;
199 }
200 i = len;
201 p += i - 1;
202 to += i - 1;
203 while((!*p) && i) {
204 *(to--) = 0;
205 i--;
206 p--;
207 }
208 /* Special case: if all zeros then the number will be of
209 * the form FF followed by n zero bytes: this corresponds to
210 * 1 followed by n zero bytes. We've already written n zeros
211 * so we just append an extra one and set the first byte to
212 * a 1. This is treated separately because it is the only case
213 * where the number of bytes is larger than len.
214 */
215 if(!i) {
216 *s = 1;
217 s[len] = 0;
218 len++;
219 } else {
220 *(to--) = (*(p--) ^ 0xff) + 1;
221 i--;
222 for(;i > 0; i--) *(to--) = *(p--) ^ 0xff;
223 }
224 } else {
225 ret->type=V_ASN1_INTEGER;
226 if ((*p == 0) && (len != 1))
165 { 227 {
166 p++; 228 p++;
167 len--; 229 len--;
168 } 230 }
169 for (i=(int)len; i>0; i--) 231 memcpy(s,p,(int)len);
170 *(to++)= (*(p++)^0xFF)+1; 232 }
233
234 if (ret->data != NULL) Free((char *)ret->data);
235 ret->data=s;
236 ret->length=(int)len;
237 if (a != NULL) (*a)=ret;
238 *pp=pend;
239 return(ret);
240err:
241 ASN1err(ASN1_F_D2I_ASN1_INTEGER,i);
242 if ((ret != NULL) && ((a == NULL) || (*a != ret)))
243 ASN1_INTEGER_free(ret);
244 return(NULL);
245 }
246
247/* This is a version of d2i_ASN1_INTEGER that ignores the sign bit of
248 * ASN1 integers: some broken software can encode a positive INTEGER
249 * with its MSB set as negative (it doesn't add a padding zero).
250 */
251
252ASN1_INTEGER *d2i_ASN1_UINTEGER(ASN1_INTEGER **a, unsigned char **pp,
253 long length)
254 {
255 ASN1_INTEGER *ret=NULL;
256 unsigned char *p,*to,*s;
257 long len;
258 int inf,tag,xclass;
259 int i;
260
261 if ((a == NULL) || ((*a) == NULL))
262 {
263 if ((ret=ASN1_INTEGER_new()) == NULL) return(NULL);
264 ret->type=V_ASN1_INTEGER;
171 } 265 }
172 else 266 else
267 ret=(*a);
268
269 p= *pp;
270 inf=ASN1_get_object(&p,&len,&tag,&xclass,length);
271 if (inf & 0x80)
272 {
273 i=ASN1_R_BAD_OBJECT_HEADER;
274 goto err;
275 }
276
277 if (tag != V_ASN1_INTEGER)
173 { 278 {
279 i=ASN1_R_EXPECTING_AN_INTEGER;
280 goto err;
281 }
282
283 /* We must Malloc stuff, even for 0 bytes otherwise it
284 * signifies a missing NULL parameter. */
285 s=(unsigned char *)Malloc((int)len+1);
286 if (s == NULL)
287 {
288 i=ERR_R_MALLOC_FAILURE;
289 goto err;
290 }
291 to=s;
174 ret->type=V_ASN1_INTEGER; 292 ret->type=V_ASN1_INTEGER;
175 if ((*p == 0) && (len != 1)) 293 if ((*p == 0) && (len != 1))
176 { 294 {
@@ -179,7 +297,6 @@ long length;
179 } 297 }
180 memcpy(s,p,(int)len); 298 memcpy(s,p,(int)len);
181 p+=len; 299 p+=len;
182 }
183 300
184 if (ret->data != NULL) Free((char *)ret->data); 301 if (ret->data != NULL) Free((char *)ret->data);
185 ret->data=s; 302 ret->data=s;
@@ -188,15 +305,13 @@ long length;
188 *pp=p; 305 *pp=p;
189 return(ret); 306 return(ret);
190err: 307err:
191 ASN1err(ASN1_F_D2I_ASN1_INTEGER,i); 308 ASN1err(ASN1_F_D2I_ASN1_UINTEGER,i);
192 if ((ret != NULL) && ((a == NULL) || (*a != ret))) 309 if ((ret != NULL) && ((a == NULL) || (*a != ret)))
193 ASN1_INTEGER_free(ret); 310 ASN1_INTEGER_free(ret);
194 return(NULL); 311 return(NULL);
195 } 312 }
196 313
197int ASN1_INTEGER_set(a,v) 314int ASN1_INTEGER_set(ASN1_INTEGER *a, long v)
198ASN1_INTEGER *a;
199long v;
200 { 315 {
201 int i,j,k; 316 int i,j,k;
202 unsigned char buf[sizeof(long)+1]; 317 unsigned char buf[sizeof(long)+1];
@@ -229,15 +344,13 @@ long v;
229 d>>=8; 344 d>>=8;
230 } 345 }
231 j=0; 346 j=0;
232 if (v < 0) a->data[j++]=0;
233 for (k=i-1; k >=0; k--) 347 for (k=i-1; k >=0; k--)
234 a->data[j++]=buf[k]; 348 a->data[j++]=buf[k];
235 a->length=j; 349 a->length=j;
236 return(1); 350 return(1);
237 } 351 }
238 352
239long ASN1_INTEGER_get(a) 353long ASN1_INTEGER_get(ASN1_INTEGER *a)
240ASN1_INTEGER *a;
241 { 354 {
242 int neg=0,i; 355 int neg=0,i;
243 long r=0; 356 long r=0;
@@ -266,9 +379,7 @@ ASN1_INTEGER *a;
266 return(r); 379 return(r);
267 } 380 }
268 381
269ASN1_INTEGER *BN_to_ASN1_INTEGER(bn,ai) 382ASN1_INTEGER *BN_to_ASN1_INTEGER(BIGNUM *bn, ASN1_INTEGER *ai)
270BIGNUM *bn;
271ASN1_INTEGER *ai;
272 { 383 {
273 ASN1_INTEGER *ret; 384 ASN1_INTEGER *ret;
274 int len,j; 385 int len,j;
@@ -279,10 +390,11 @@ ASN1_INTEGER *ai;
279 ret=ai; 390 ret=ai;
280 if (ret == NULL) 391 if (ret == NULL)
281 { 392 {
282 ASN1err(ASN1_F_BN_TO_ASN1_INTEGER,ASN1_R_ERROR_STACK); 393 ASN1err(ASN1_F_BN_TO_ASN1_INTEGER,ERR_R_NESTED_ASN1_ERROR);
283 goto err; 394 goto err;
284 } 395 }
285 ret->type=V_ASN1_INTEGER; 396 if(bn->neg) ret->type = V_ASN1_NEG_INTEGER;
397 else ret->type=V_ASN1_INTEGER;
286 j=BN_num_bits(bn); 398 j=BN_num_bits(bn);
287 len=((j == 0)?0:((j/8)+1)); 399 len=((j == 0)?0:((j/8)+1));
288 ret->data=(unsigned char *)Malloc(len+4); 400 ret->data=(unsigned char *)Malloc(len+4);
@@ -293,13 +405,12 @@ err:
293 return(NULL); 405 return(NULL);
294 } 406 }
295 407
296BIGNUM *ASN1_INTEGER_to_BN(ai,bn) 408BIGNUM *ASN1_INTEGER_to_BN(ASN1_INTEGER *ai, BIGNUM *bn)
297ASN1_INTEGER *ai;
298BIGNUM *bn;
299 { 409 {
300 BIGNUM *ret; 410 BIGNUM *ret;
301 411
302 if ((ret=BN_bin2bn(ai->data,ai->length,bn)) == NULL) 412 if ((ret=BN_bin2bn(ai->data,ai->length,bn)) == NULL)
303 ASN1err(ASN1_F_ASN1_INTEGER_TO_BN,ASN1_R_BN_LIB); 413 ASN1err(ASN1_F_ASN1_INTEGER_TO_BN,ASN1_R_BN_LIB);
414 if(ai->type == V_ASN1_NEG_INTEGER) bn->neg = 1;
304 return(ret); 415 return(ret);
305 } 416 }
diff --git a/src/lib/libcrypto/asn1/a_meth.c b/src/lib/libcrypto/asn1/a_meth.c
index 513625c305..63158e9cab 100644
--- a/src/lib/libcrypto/asn1/a_meth.c
+++ b/src/lib/libcrypto/asn1/a_meth.c
@@ -58,8 +58,8 @@
58 58
59#include <stdio.h> 59#include <stdio.h>
60#include "cryptlib.h" 60#include "cryptlib.h"
61#include "buffer.h" 61#include <openssl/buffer.h>
62#include "x509.h" 62#include <openssl/asn1.h>
63 63
64static ASN1_METHOD ia5string_meth={ 64static ASN1_METHOD ia5string_meth={
65 (int (*)()) i2d_ASN1_IA5STRING, 65 (int (*)()) i2d_ASN1_IA5STRING,
@@ -73,12 +73,12 @@ static ASN1_METHOD bit_string_meth={
73 (char *(*)()) ASN1_STRING_new, 73 (char *(*)()) ASN1_STRING_new,
74 (void (*)()) ASN1_STRING_free}; 74 (void (*)()) ASN1_STRING_free};
75 75
76ASN1_METHOD *ASN1_IA5STRING_asn1_meth() 76ASN1_METHOD *ASN1_IA5STRING_asn1_meth(void)
77 { 77 {
78 return(&ia5string_meth); 78 return(&ia5string_meth);
79 } 79 }
80 80
81ASN1_METHOD *ASN1_BIT_STRING_asn1_meth() 81ASN1_METHOD *ASN1_BIT_STRING_asn1_meth(void)
82 { 82 {
83 return(&bit_string_meth); 83 return(&bit_string_meth);
84 } 84 }
diff --git a/src/lib/libcrypto/asn1/a_object.c b/src/lib/libcrypto/asn1/a_object.c
index 5a7eeef8d8..b94b418ee8 100644
--- a/src/lib/libcrypto/asn1/a_object.c
+++ b/src/lib/libcrypto/asn1/a_object.c
@@ -58,18 +58,11 @@
58 58
59#include <stdio.h> 59#include <stdio.h>
60#include "cryptlib.h" 60#include "cryptlib.h"
61#include "buffer.h" 61#include <openssl/buffer.h>
62#include "asn1.h" 62#include <openssl/asn1.h>
63#include "objects.h" 63#include <openssl/objects.h>
64 64
65/* ASN1err(ASN1_F_ASN1_OBJECT_NEW,ASN1_R_EXPECTING_AN_OBJECT); 65int i2d_ASN1_OBJECT(ASN1_OBJECT *a, unsigned char **pp)
66 * ASN1err(ASN1_F_D2I_ASN1_OBJECT,ASN1_R_BAD_OBJECT_HEADER);
67 * ASN1err(ASN1_F_I2T_ASN1_OBJECT,ASN1_R_BAD_OBJECT_HEADER);
68 */
69
70int i2d_ASN1_OBJECT(a, pp)
71ASN1_OBJECT *a;
72unsigned char **pp;
73 { 66 {
74 unsigned char *p; 67 unsigned char *p;
75 68
@@ -87,14 +80,11 @@ unsigned char **pp;
87 return(a->length); 80 return(a->length);
88 } 81 }
89 82
90int a2d_ASN1_OBJECT(out,olen,buf,num) 83int a2d_ASN1_OBJECT(unsigned char *out, int olen, const char *buf, int num)
91unsigned char *out;
92int olen;
93char *buf;
94int num;
95 { 84 {
96 int i,first,len=0,c; 85 int i,first,len=0,c;
97 char tmp[24],*p; 86 char tmp[24];
87 const char *p;
98 unsigned long l; 88 unsigned long l;
99 89
100 if (num == 0) 90 if (num == 0)
@@ -180,85 +170,12 @@ err:
180 return(0); 170 return(0);
181 } 171 }
182 172
183int i2t_ASN1_OBJECT(buf,buf_len,a) 173int i2t_ASN1_OBJECT(char *buf, int buf_len, ASN1_OBJECT *a)
184char *buf; 174{
185int buf_len; 175 return OBJ_obj2txt(buf, buf_len, a, 0);
186ASN1_OBJECT *a; 176}
187 {
188 int i,idx=0,n=0,len,nid;
189 unsigned long l;
190 unsigned char *p;
191 char *s;
192 char tbuf[32];
193
194 if (buf_len <= 0) return(0);
195
196 if ((a == NULL) || (a->data == NULL))
197 {
198 buf[0]='\0';
199 return(0);
200 }
201
202 nid=OBJ_obj2nid(a);
203 if (nid == NID_undef)
204 {
205 len=a->length;
206 p=a->data;
207
208 idx=0;
209 l=0;
210 while (idx < a->length)
211 {
212 l|=(p[idx]&0x7f);
213 if (!(p[idx] & 0x80)) break;
214 l<<=7L;
215 idx++;
216 }
217 idx++;
218 i=(int)(l/40);
219 if (i > 2) i=2;
220 l-=(long)(i*40);
221
222 sprintf(tbuf,"%d.%ld",i,l);
223 i=strlen(tbuf);
224 strncpy(buf,tbuf,buf_len);
225 buf_len-=i;
226 buf+=i;
227 n+=i;
228
229 l=0;
230 for (; idx<len; idx++)
231 {
232 l|=p[idx]&0x7f;
233 if (!(p[idx] & 0x80))
234 {
235 sprintf(tbuf,".%ld",l);
236 i=strlen(tbuf);
237 if (buf_len > 0)
238 strncpy(buf,tbuf,buf_len);
239 buf_len-=i;
240 buf+=i;
241 n+=i;
242 l=0;
243 }
244 l<<=7L;
245 }
246 }
247 else
248 {
249 s=(char *)OBJ_nid2ln(nid);
250 if (s == NULL)
251 s=(char *)OBJ_nid2sn(nid);
252 strncpy(buf,s,buf_len);
253 n=strlen(s);
254 }
255 buf[buf_len-1]='\0';
256 return(n);
257 }
258 177
259int i2a_ASN1_OBJECT(bp,a) 178int i2a_ASN1_OBJECT(BIO *bp, ASN1_OBJECT *a)
260BIO *bp;
261ASN1_OBJECT *a;
262 { 179 {
263 char buf[80]; 180 char buf[80];
264 int i; 181 int i;
@@ -271,10 +188,8 @@ ASN1_OBJECT *a;
271 return(i); 188 return(i);
272 } 189 }
273 190
274ASN1_OBJECT *d2i_ASN1_OBJECT(a, pp, length) 191ASN1_OBJECT *d2i_ASN1_OBJECT(ASN1_OBJECT **a, unsigned char **pp,
275ASN1_OBJECT **a; 192 long length)
276unsigned char **pp;
277long length;
278 { 193 {
279 ASN1_OBJECT *ret=NULL; 194 ASN1_OBJECT *ret=NULL;
280 unsigned char *p; 195 unsigned char *p;
@@ -330,7 +245,7 @@ err:
330 return(NULL); 245 return(NULL);
331 } 246 }
332 247
333ASN1_OBJECT *ASN1_OBJECT_new() 248ASN1_OBJECT *ASN1_OBJECT_new(void)
334 { 249 {
335 ASN1_OBJECT *ret; 250 ASN1_OBJECT *ret;
336 251
@@ -349,14 +264,15 @@ ASN1_OBJECT *ASN1_OBJECT_new()
349 return(ret); 264 return(ret);
350 } 265 }
351 266
352void ASN1_OBJECT_free(a) 267void ASN1_OBJECT_free(ASN1_OBJECT *a)
353ASN1_OBJECT *a;
354 { 268 {
355 if (a == NULL) return; 269 if (a == NULL) return;
356 if (a->flags & ASN1_OBJECT_FLAG_DYNAMIC_STRINGS) 270 if (a->flags & ASN1_OBJECT_FLAG_DYNAMIC_STRINGS)
357 { 271 {
358 if (a->sn != NULL) Free(a->sn); 272#ifndef CONST_STRICT /* disable purely for compile-time strict const checking. Doing this on a "real" compile will cause mempory leaks */
359 if (a->ln != NULL) Free(a->ln); 273 if (a->sn != NULL) Free((void *)a->sn);
274 if (a->ln != NULL) Free((void *)a->ln);
275#endif
360 a->sn=a->ln=NULL; 276 a->sn=a->ln=NULL;
361 } 277 }
362 if (a->flags & ASN1_OBJECT_FLAG_DYNAMIC_DATA) 278 if (a->flags & ASN1_OBJECT_FLAG_DYNAMIC_DATA)
@@ -366,14 +282,11 @@ ASN1_OBJECT *a;
366 a->length=0; 282 a->length=0;
367 } 283 }
368 if (a->flags & ASN1_OBJECT_FLAG_DYNAMIC) 284 if (a->flags & ASN1_OBJECT_FLAG_DYNAMIC)
369 Free((char *)a); 285 Free(a);
370 } 286 }
371 287
372ASN1_OBJECT *ASN1_OBJECT_create(nid,data,len,sn,ln) 288ASN1_OBJECT *ASN1_OBJECT_create(int nid, unsigned char *data, int len,
373int nid; 289 char *sn, char *ln)
374unsigned char *data;
375int len;
376char *sn,*ln;
377 { 290 {
378 ASN1_OBJECT o; 291 ASN1_OBJECT o;
379 292
@@ -382,8 +295,10 @@ char *sn,*ln;
382 o.data=data; 295 o.data=data;
383 o.nid=nid; 296 o.nid=nid;
384 o.length=len; 297 o.length=len;
385 o.flags=ASN1_OBJECT_FLAG_DYNAMIC| 298 o.flags=ASN1_OBJECT_FLAG_DYNAMIC|ASN1_OBJECT_FLAG_DYNAMIC_STRINGS|
386 ASN1_OBJECT_FLAG_DYNAMIC_STRINGS|ASN1_OBJECT_FLAG_DYNAMIC_DATA; 299 ASN1_OBJECT_FLAG_DYNAMIC_DATA;
387 return(OBJ_dup(&o)); 300 return(OBJ_dup(&o));
388 } 301 }
389 302
303IMPLEMENT_STACK_OF(ASN1_OBJECT)
304IMPLEMENT_ASN1_SET_OF(ASN1_OBJECT)
diff --git a/src/lib/libcrypto/asn1/a_octet.c b/src/lib/libcrypto/asn1/a_octet.c
index be3f172a8c..7659a13bd3 100644
--- a/src/lib/libcrypto/asn1/a_octet.c
+++ b/src/lib/libcrypto/asn1/a_octet.c
@@ -58,23 +58,16 @@
58 58
59#include <stdio.h> 59#include <stdio.h>
60#include "cryptlib.h" 60#include "cryptlib.h"
61#include "asn1.h" 61#include <openssl/asn1.h>
62 62
63/* ASN1err(ASN1_F_D2I_ASN1_OCTET_STRING,ASN1_R_EXPECTING_AN_OCTET_STRING); 63int i2d_ASN1_OCTET_STRING(ASN1_OCTET_STRING *a, unsigned char **pp)
64 */
65
66int i2d_ASN1_OCTET_STRING(a, pp)
67ASN1_OCTET_STRING *a;
68unsigned char **pp;
69 { 64 {
70 return(i2d_ASN1_bytes((ASN1_STRING *)a,pp, 65 return(i2d_ASN1_bytes((ASN1_STRING *)a,pp,
71 V_ASN1_OCTET_STRING,V_ASN1_UNIVERSAL)); 66 V_ASN1_OCTET_STRING,V_ASN1_UNIVERSAL));
72 } 67 }
73 68
74ASN1_OCTET_STRING *d2i_ASN1_OCTET_STRING(a, pp, length) 69ASN1_OCTET_STRING *d2i_ASN1_OCTET_STRING(ASN1_OCTET_STRING **a,
75ASN1_OCTET_STRING **a; 70 unsigned char **pp, long length)
76unsigned char **pp;
77long length;
78 { 71 {
79 ASN1_OCTET_STRING *ret=NULL; 72 ASN1_OCTET_STRING *ret=NULL;
80 73
@@ -82,7 +75,7 @@ long length;
82 pp,length,V_ASN1_OCTET_STRING,V_ASN1_UNIVERSAL); 75 pp,length,V_ASN1_OCTET_STRING,V_ASN1_UNIVERSAL);
83 if (ret == NULL) 76 if (ret == NULL)
84 { 77 {
85 ASN1err(ASN1_F_D2I_ASN1_OCTET_STRING,ASN1_R_ERROR_STACK); 78 ASN1err(ASN1_F_D2I_ASN1_OCTET_STRING,ERR_R_NESTED_ASN1_ERROR);
86 return(NULL); 79 return(NULL);
87 } 80 }
88 return(ret); 81 return(ret);
diff --git a/src/lib/libcrypto/asn1/a_print.c b/src/lib/libcrypto/asn1/a_print.c
index 3023361dee..cdec7a1561 100644
--- a/src/lib/libcrypto/asn1/a_print.c
+++ b/src/lib/libcrypto/asn1/a_print.c
@@ -58,49 +58,32 @@
58 58
59#include <stdio.h> 59#include <stdio.h>
60#include "cryptlib.h" 60#include "cryptlib.h"
61#include "asn1.h" 61#include <openssl/asn1.h>
62 62
63/* ASN1err(ASN1_F_D2I_ASN1_PRINT_TYPE,ASN1_R_WRONG_PRINTABLE_TYPE); 63int i2d_ASN1_IA5STRING(ASN1_IA5STRING *a, unsigned char **pp)
64 * ASN1err(ASN1_F_D2I_ASN1_PRINT_TYPE,ASN1_R_TAG_VALUE_TOO_HIGH);
65 */
66
67int i2d_ASN1_IA5STRING(a,pp)
68ASN1_IA5STRING *a;
69unsigned char **pp;
70 { return(M_i2d_ASN1_IA5STRING(a,pp)); } 64 { return(M_i2d_ASN1_IA5STRING(a,pp)); }
71 65
72ASN1_IA5STRING *d2i_ASN1_IA5STRING(a,pp,l) 66ASN1_IA5STRING *d2i_ASN1_IA5STRING(ASN1_IA5STRING **a, unsigned char **pp,
73ASN1_IA5STRING **a; 67 long l)
74unsigned char **pp;
75long l;
76 { return(M_d2i_ASN1_IA5STRING(a,pp,l)); } 68 { return(M_d2i_ASN1_IA5STRING(a,pp,l)); }
77 69
78ASN1_T61STRING *d2i_ASN1_T61STRING(a,pp,l) 70ASN1_T61STRING *d2i_ASN1_T61STRING(ASN1_T61STRING **a, unsigned char **pp,
79ASN1_T61STRING **a; 71 long l)
80unsigned char **pp;
81long l;
82 { return(M_d2i_ASN1_T61STRING(a,pp,l)); } 72 { return(M_d2i_ASN1_T61STRING(a,pp,l)); }
83 73
84ASN1_PRINTABLESTRING *d2i_ASN1_PRINTABLESTRING(a,pp,l) 74ASN1_PRINTABLESTRING *d2i_ASN1_PRINTABLESTRING(ASN1_PRINTABLESTRING **a,
85ASN1_PRINTABLESTRING **a; 75 unsigned char **pp, long l)
86unsigned char **pp; 76 { return(M_d2i_ASN1_PRINTABLESTRING(a,pp,
87long l; 77 l)); }
88 { return(M_d2i_ASN1_PRINTABLESTRING(a,pp,l)); }
89 78
90int i2d_ASN1_PRINTABLE(a,pp) 79int i2d_ASN1_PRINTABLE(ASN1_STRING *a, unsigned char **pp)
91ASN1_STRING *a;
92unsigned char **pp;
93 { return(M_i2d_ASN1_PRINTABLE(a,pp)); } 80 { return(M_i2d_ASN1_PRINTABLE(a,pp)); }
94 81
95ASN1_STRING *d2i_ASN1_PRINTABLE(a,pp,l) 82ASN1_STRING *d2i_ASN1_PRINTABLE(ASN1_STRING **a, unsigned char **pp,
96ASN1_STRING **a; 83 long l)
97unsigned char **pp;
98long l;
99 { return(M_d2i_ASN1_PRINTABLE(a,pp,l)); } 84 { return(M_d2i_ASN1_PRINTABLE(a,pp,l)); }
100 85
101int ASN1_PRINTABLE_type(s,len) 86int ASN1_PRINTABLE_type(unsigned char *s, int len)
102unsigned char *s;
103int len;
104 { 87 {
105 int c; 88 int c;
106 int ia5=0; 89 int ia5=0;
@@ -112,6 +95,7 @@ int len;
112 while ((*s) && (len-- != 0)) 95 while ((*s) && (len-- != 0))
113 { 96 {
114 c= *(s++); 97 c= *(s++);
98#ifndef CHARSET_EBCDIC
115 if (!( ((c >= 'a') && (c <= 'z')) || 99 if (!( ((c >= 'a') && (c <= 'z')) ||
116 ((c >= 'A') && (c <= 'Z')) || 100 ((c >= 'A') && (c <= 'Z')) ||
117 (c == ' ') || 101 (c == ' ') ||
@@ -125,14 +109,20 @@ int len;
125 ia5=1; 109 ia5=1;
126 if (c&0x80) 110 if (c&0x80)
127 t61=1; 111 t61=1;
112#else
113 if (!isalnum(c) && (c != ' ') &&
114 strchr("'()+,-./:=?", c) == NULL)
115 ia5=1;
116 if (os_toascii[c] & 0x80)
117 t61=1;
118#endif
128 } 119 }
129 if (t61) return(V_ASN1_T61STRING); 120 if (t61) return(V_ASN1_T61STRING);
130 if (ia5) return(V_ASN1_IA5STRING); 121 if (ia5) return(V_ASN1_IA5STRING);
131 return(V_ASN1_PRINTABLESTRING); 122 return(V_ASN1_PRINTABLESTRING);
132 } 123 }
133 124
134int ASN1_UNIVERSALSTRING_to_string(s) 125int ASN1_UNIVERSALSTRING_to_string(ASN1_UNIVERSALSTRING *s)
135ASN1_UNIVERSALSTRING *s;
136 { 126 {
137 int i; 127 int i;
138 unsigned char *p; 128 unsigned char *p;
@@ -159,3 +149,17 @@ ASN1_UNIVERSALSTRING *s;
159 return(1); 149 return(1);
160 } 150 }
161 151
152
153int i2d_DIRECTORYSTRING(ASN1_STRING *a, unsigned char **pp)
154 { return(M_i2d_DIRECTORYSTRING(a,pp)); }
155
156ASN1_STRING *d2i_DIRECTORYSTRING(ASN1_STRING **a, unsigned char **pp,
157 long l)
158 { return(M_d2i_DIRECTORYSTRING(a,pp,l)); }
159
160int i2d_DISPLAYTEXT(ASN1_STRING *a, unsigned char **pp)
161 { return(M_i2d_DISPLAYTEXT(a,pp)); }
162
163ASN1_STRING *d2i_DISPLAYTEXT(ASN1_STRING **a, unsigned char **pp,
164 long l)
165 { 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 17c49946cf..c2481e7597 100644
--- a/src/lib/libcrypto/asn1/a_set.c
+++ b/src/lib/libcrypto/asn1/a_set.c
@@ -58,21 +58,40 @@
58 58
59#include <stdio.h> 59#include <stdio.h>
60#include "cryptlib.h" 60#include "cryptlib.h"
61#include "asn1_mac.h" 61#include <openssl/asn1_mac.h>
62 62
63/* ASN1err(ASN1_F_ASN1_TYPE_NEW,ERR_R_MALLOC_FAILURE); 63typedef struct
64 {
65 unsigned char *pbData;
66 int cbData;
67 } MYBLOB;
68
69/* SetBlobCmp
70 * This function compares two elements of SET_OF block
64 */ 71 */
72static int SetBlobCmp(const void *elem1, const void *elem2 )
73 {
74 const MYBLOB *b1 = (const MYBLOB *)elem1;
75 const MYBLOB *b2 = (const MYBLOB *)elem2;
76 int r;
77
78 r = memcmp(b1->pbData, b2->pbData,
79 b1->cbData < b2->cbData ? b1->cbData : b2->cbData);
80 if(r != 0)
81 return r;
82 return b1->cbData-b2->cbData;
83 }
65 84
66int i2d_ASN1_SET(a,pp,func,ex_tag,ex_class) 85/* int is_set: if TRUE, then sort the contents (i.e. it isn't a SEQUENCE) */
67STACK *a; 86int i2d_ASN1_SET(STACK *a, unsigned char **pp, int (*func)(), int ex_tag,
68unsigned char **pp; 87 int ex_class, int is_set)
69int (*func)();
70int ex_tag;
71int ex_class;
72 { 88 {
73 int ret=0,r; 89 int ret=0,r;
74 int i; 90 int i;
75 unsigned char *p; 91 unsigned char *p;
92 unsigned char *pStart, *pTempMem;
93 MYBLOB *rgSetBlob;
94 int totSize;
76 95
77 if (a == NULL) return(0); 96 if (a == NULL) return(0);
78 for (i=sk_num(a)-1; i>=0; i--) 97 for (i=sk_num(a)-1; i>=0; i--)
@@ -82,20 +101,58 @@ int ex_class;
82 101
83 p= *pp; 102 p= *pp;
84 ASN1_put_object(&p,1,ret,ex_tag,ex_class); 103 ASN1_put_object(&p,1,ret,ex_tag,ex_class);
85 for (i=0; i<sk_num(a); i++)
86 func(sk_value(a,i),&p);
87 104
88 *pp=p; 105/* Modified by gp@nsj.co.jp */
89 return(r); 106 /* And then again by Ben */
90 } 107 /* And again by Steve */
108
109 if(!is_set || (sk_num(a) < 2))
110 {
111 for (i=0; i<sk_num(a); i++)
112 func(sk_value(a,i),&p);
113
114 *pp=p;
115 return(r);
116 }
117
118 pStart = p; /* Catch the beg of Setblobs*/
119 rgSetBlob = (MYBLOB *)Malloc( sk_num(a) * sizeof(MYBLOB)); /* In this array
120we will store the SET blobs */
121
122 for (i=0; i<sk_num(a); i++)
123 {
124 rgSetBlob[i].pbData = p; /* catch each set encode blob */
125 func(sk_value(a,i),&p);
126 rgSetBlob[i].cbData = p - rgSetBlob[i].pbData; /* Length of this
127SetBlob
128*/
129 }
130 *pp=p;
131 totSize = p - pStart; /* This is the total size of all set blobs */
132
133 /* Now we have to sort the blobs. I am using a simple algo.
134 *Sort ptrs *Copy to temp-mem *Copy from temp-mem to user-mem*/
135 qsort( rgSetBlob, sk_num(a), sizeof(MYBLOB), SetBlobCmp);
136 pTempMem = Malloc(totSize);
137
138/* Copy to temp mem */
139 p = pTempMem;
140 for(i=0; i<sk_num(a); ++i)
141 {
142 memcpy(p, rgSetBlob[i].pbData, rgSetBlob[i].cbData);
143 p += rgSetBlob[i].cbData;
144 }
91 145
92STACK *d2i_ASN1_SET(a,pp,length,func,ex_tag,ex_class) 146/* Copy back to user mem*/
93STACK **a; 147 memcpy(pStart, pTempMem, totSize);
94unsigned char **pp; 148 Free(pTempMem);
95long length; 149 Free(rgSetBlob);
96char *(*func)(); 150
97int ex_tag; 151 return(r);
98int ex_class; 152 }
153
154STACK *d2i_ASN1_SET(STACK **a, unsigned char **pp, long length,
155 char *(*func)(), void (*free_func)(), int ex_tag, int ex_class)
99 { 156 {
100 ASN1_CTX c; 157 ASN1_CTX c;
101 STACK *ret=NULL; 158 STACK *ret=NULL;
@@ -136,14 +193,25 @@ int ex_class;
136 char *s; 193 char *s;
137 194
138 if (M_ASN1_D2I_end_sequence()) break; 195 if (M_ASN1_D2I_end_sequence()) break;
139 if ((s=func(NULL,&c.p,c.slen,c.max-c.p)) == NULL) goto err; 196 if ((s=func(NULL,&c.p,c.slen,c.max-c.p)) == NULL)
197 {
198 ASN1err(ASN1_F_D2I_ASN1_SET,ASN1_R_ERROR_PARSING_SET_ELEMENT);
199 asn1_add_error(*pp,(int)(c.q- *pp));
200 goto err;
201 }
140 if (!sk_push(ret,s)) goto err; 202 if (!sk_push(ret,s)) goto err;
141 } 203 }
142 if (a != NULL) (*a)=ret; 204 if (a != NULL) (*a)=ret;
143 *pp=c.p; 205 *pp=c.p;
144 return(ret); 206 return(ret);
145err: 207err:
146 if ((ret != NULL) && ((a == NULL) || (*a != ret))) sk_free(ret); 208 if ((ret != NULL) && ((a == NULL) || (*a != ret)))
209 {
210 if (free_func != NULL)
211 sk_pop_free(ret,free_func);
212 else
213 sk_free(ret);
214 }
147 return(NULL); 215 return(NULL);
148 } 216 }
149 217
diff --git a/src/lib/libcrypto/asn1/a_sign.c b/src/lib/libcrypto/asn1/a_sign.c
index 02188e68c4..57595692e5 100644
--- a/src/lib/libcrypto/asn1/a_sign.c
+++ b/src/lib/libcrypto/asn1/a_sign.c
@@ -62,21 +62,15 @@
62#include <sys/stat.h> 62#include <sys/stat.h>
63 63
64#include "cryptlib.h" 64#include "cryptlib.h"
65#include "bn.h" 65#include <openssl/bn.h>
66#include "evp.h" 66#include <openssl/evp.h>
67#include "x509.h" 67#include <openssl/x509.h>
68#include "objects.h" 68#include <openssl/objects.h>
69#include "buffer.h" 69#include <openssl/buffer.h>
70#include "pem.h"
71 70
72int ASN1_sign(i2d,algor1,algor2,signature,data,pkey,type) 71int ASN1_sign(int (*i2d)(), X509_ALGOR *algor1, X509_ALGOR *algor2,
73int (*i2d)(); 72 ASN1_BIT_STRING *signature, char *data, EVP_PKEY *pkey,
74X509_ALGOR *algor1; 73 const EVP_MD *type)
75X509_ALGOR *algor2;
76ASN1_BIT_STRING *signature;
77char *data;
78EVP_PKEY *pkey;
79EVP_MD *type;
80 { 74 {
81 EVP_MD_CTX ctx; 75 EVP_MD_CTX ctx;
82 unsigned char *p,*buf_in=NULL,*buf_out=NULL; 76 unsigned char *p,*buf_in=NULL,*buf_out=NULL;
@@ -136,7 +130,11 @@ EVP_MD *type;
136 signature->data=buf_out; 130 signature->data=buf_out;
137 buf_out=NULL; 131 buf_out=NULL;
138 signature->length=outl; 132 signature->length=outl;
139 133 /* In the interests of compatability, I'll make sure that
134 * the bit string has a 'not-used bits' value of 0
135 */
136 signature->flags&= ~(ASN1_STRING_FLAG_BITS_LEFT|0x07);
137 signature->flags|=ASN1_STRING_FLAG_BITS_LEFT;
140err: 138err:
141 memset(&ctx,0,sizeof(ctx)); 139 memset(&ctx,0,sizeof(ctx));
142 if (buf_in != NULL) 140 if (buf_in != NULL)
diff --git a/src/lib/libcrypto/asn1/a_time.c b/src/lib/libcrypto/asn1/a_time.c
new file mode 100644
index 0000000000..c1690a5694
--- /dev/null
+++ b/src/lib/libcrypto/asn1/a_time.c
@@ -0,0 +1,123 @@
1/* crypto/asn1/a_time.c */
2/* ====================================================================
3 * Copyright (c) 1999 The OpenSSL Project. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 *
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 *
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in
14 * the documentation and/or other materials provided with the
15 * distribution.
16 *
17 * 3. All advertising materials mentioning features or use of this
18 * software must display the following acknowledgment:
19 * "This product includes software developed by the OpenSSL Project
20 * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
21 *
22 * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
23 * endorse or promote products derived from this software without
24 * prior written permission. For written permission, please contact
25 * licensing@OpenSSL.org.
26 *
27 * 5. Products derived from this software may not be called "OpenSSL"
28 * nor may "OpenSSL" appear in their names without prior written
29 * permission of the OpenSSL Project.
30 *
31 * 6. Redistributions of any form whatsoever must retain the following
32 * acknowledgment:
33 * "This product includes software developed by the OpenSSL Project
34 * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
35 *
36 * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
37 * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
38 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
39 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
40 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
41 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
42 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
43 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
44 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
45 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
46 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
47 * OF THE POSSIBILITY OF SUCH DAMAGE.
48 * ====================================================================
49 *
50 * This product includes cryptographic software written by Eric Young
51 * (eay@cryptsoft.com). This product includes software written by Tim
52 * Hudson (tjh@cryptsoft.com).
53 *
54 */
55
56
57/* This is an implementation of the ASN1 Time structure which is:
58 * Time ::= CHOICE {
59 * utcTime UTCTime,
60 * generalTime GeneralizedTime }
61 * written by Steve Henson.
62 */
63
64#include <stdio.h>
65#include <time.h>
66#include "cryptlib.h"
67#include <openssl/asn1.h>
68
69int i2d_ASN1_TIME(ASN1_TIME *a, unsigned char **pp)
70 {
71#ifdef CHARSET_EBCDIC
72 /* KLUDGE! We convert to ascii before writing DER */
73 char tmp[24];
74 ASN1_STRING tmpstr;
75
76 if(a->type == V_ASN1_UTCTIME || a->type == V_ASN1_GENERALIZEDTIME) {
77 int len;
78
79 tmpstr = *(ASN1_STRING *)a;
80 len = tmpstr.length;
81 ebcdic2ascii(tmp, tmpstr.data, (len >= sizeof tmp) ? sizeof tmp : len);
82 tmpstr.data = tmp;
83 a = (ASN1_GENERALIZEDTIME *) &tmpstr;
84 }
85#endif
86 if(a->type == V_ASN1_UTCTIME || a->type == V_ASN1_GENERALIZEDTIME)
87 return(i2d_ASN1_bytes((ASN1_STRING *)a,pp,
88 a->type ,V_ASN1_UNIVERSAL));
89 ASN1err(ASN1_F_I2D_ASN1_TIME,ASN1_R_EXPECTING_A_TIME);
90 return -1;
91 }
92
93
94ASN1_TIME *d2i_ASN1_TIME(ASN1_TIME **a, unsigned char **pp, long length)
95 {
96 unsigned char tag;
97 tag = **pp & ~V_ASN1_CONSTRUCTED;
98 if(tag == (V_ASN1_UTCTIME|V_ASN1_UNIVERSAL))
99 return d2i_ASN1_UTCTIME(a, pp, length);
100 if(tag == (V_ASN1_GENERALIZEDTIME|V_ASN1_UNIVERSAL))
101 return d2i_ASN1_GENERALIZEDTIME(a, pp, length);
102 ASN1err(ASN1_F_D2I_ASN1_TIME,ASN1_R_EXPECTING_A_TIME);
103 return(NULL);
104 }
105
106
107ASN1_TIME *ASN1_TIME_set(ASN1_TIME *s, time_t t)
108 {
109 struct tm *ts;
110#if defined(THREADS) && !defined(WIN32)
111 struct tm data;
112#endif
113
114#if defined(THREADS) && !defined(WIN32)
115 gmtime_r(&t,&data);
116 ts=&data; /* should return &data, but doesn't on some systems, so we don't even look at the return value */
117#else
118 ts=gmtime(&t);
119#endif
120 if((ts->tm_year >= 50) && (ts->tm_year < 150))
121 return ASN1_UTCTIME_set(s, t);
122 return ASN1_GENERALIZEDTIME_set(s,t);
123 }
diff --git a/src/lib/libcrypto/asn1/a_type.c b/src/lib/libcrypto/asn1/a_type.c
index 7c0004084c..3f2ecee5c2 100644
--- a/src/lib/libcrypto/asn1/a_type.c
+++ b/src/lib/libcrypto/asn1/a_type.c
@@ -58,23 +58,10 @@
58 58
59#include <stdio.h> 59#include <stdio.h>
60#include "cryptlib.h" 60#include "cryptlib.h"
61#include "asn1_mac.h" 61#include <openssl/asn1_mac.h>
62 62
63/* ASN1err(ASN1_F_ASN1_TYPE_NEW,ASN1_R_ERROR_STACK);
64 * ASN1err(ASN1_F_D2I_ASN1_BYTES,ASN1_R_ERROR_STACK);
65 * ASN1err(ASN1_F_D2I_ASN1_BYTES,ASN1_R_WRONG_TAG);
66 * ASN1err(ASN1_F_ASN1_COLLATE_PRIMATIVE,ASN1_R_WRONG_TAG);
67 */
68
69#ifndef NOPROTO
70static void ASN1_TYPE_component_free(ASN1_TYPE *a); 63static void ASN1_TYPE_component_free(ASN1_TYPE *a);
71#else 64int i2d_ASN1_TYPE(ASN1_TYPE *a, unsigned char **pp)
72static void ASN1_TYPE_component_free();
73#endif
74
75int i2d_ASN1_TYPE(a,pp)
76ASN1_TYPE *a;
77unsigned char **pp;
78 { 65 {
79 int r=0; 66 int r=0;
80 67
@@ -91,6 +78,10 @@ unsigned char **pp;
91 case V_ASN1_NEG_INTEGER: 78 case V_ASN1_NEG_INTEGER:
92 r=i2d_ASN1_INTEGER(a->value.integer,pp); 79 r=i2d_ASN1_INTEGER(a->value.integer,pp);
93 break; 80 break;
81 case V_ASN1_ENUMERATED:
82 case V_ASN1_NEG_ENUMERATED:
83 r=i2d_ASN1_ENUMERATED(a->value.enumerated,pp);
84 break;
94 case V_ASN1_BIT_STRING: 85 case V_ASN1_BIT_STRING:
95 r=i2d_ASN1_BIT_STRING(a->value.bit_string,pp); 86 r=i2d_ASN1_BIT_STRING(a->value.bit_string,pp);
96 break; 87 break;
@@ -115,12 +106,21 @@ unsigned char **pp;
115 case V_ASN1_UNIVERSALSTRING: 106 case V_ASN1_UNIVERSALSTRING:
116 r=M_i2d_ASN1_UNIVERSALSTRING(a->value.universalstring,pp); 107 r=M_i2d_ASN1_UNIVERSALSTRING(a->value.universalstring,pp);
117 break; 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;
118 case V_ASN1_BMPSTRING: 115 case V_ASN1_BMPSTRING:
119 r=M_i2d_ASN1_BMPSTRING(a->value.bmpstring,pp); 116 r=M_i2d_ASN1_BMPSTRING(a->value.bmpstring,pp);
120 break; 117 break;
121 case V_ASN1_UTCTIME: 118 case V_ASN1_UTCTIME:
122 r=i2d_ASN1_UTCTIME(a->value.utctime,pp); 119 r=i2d_ASN1_UTCTIME(a->value.utctime,pp);
123 break; 120 break;
121 case V_ASN1_GENERALIZEDTIME:
122 r=i2d_ASN1_GENERALIZEDTIME(a->value.generalizedtime,pp);
123 break;
124 case V_ASN1_SET: 124 case V_ASN1_SET:
125 case V_ASN1_SEQUENCE: 125 case V_ASN1_SEQUENCE:
126 if (a->value.set == NULL) 126 if (a->value.set == NULL)
@@ -139,10 +139,7 @@ unsigned char **pp;
139 return(r); 139 return(r);
140 } 140 }
141 141
142ASN1_TYPE *d2i_ASN1_TYPE(a,pp,length) 142ASN1_TYPE *d2i_ASN1_TYPE(ASN1_TYPE **a, unsigned char **pp, long length)
143ASN1_TYPE **a;
144unsigned char **pp;
145long length;
146 { 143 {
147 ASN1_TYPE *ret=NULL; 144 ASN1_TYPE *ret=NULL;
148 unsigned char *q,*p,*max; 145 unsigned char *q,*p,*max;
@@ -176,6 +173,11 @@ long length;
176 d2i_ASN1_INTEGER(NULL,&p,max-p)) == NULL) 173 d2i_ASN1_INTEGER(NULL,&p,max-p)) == NULL)
177 goto err; 174 goto err;
178 break; 175 break;
176 case V_ASN1_ENUMERATED:
177 if ((ret->value.enumerated=
178 d2i_ASN1_ENUMERATED(NULL,&p,max-p)) == NULL)
179 goto err;
180 break;
179 case V_ASN1_BIT_STRING: 181 case V_ASN1_BIT_STRING:
180 if ((ret->value.bit_string= 182 if ((ret->value.bit_string=
181 d2i_ASN1_BIT_STRING(NULL,&p,max-p)) == NULL) 183 d2i_ASN1_BIT_STRING(NULL,&p,max-p)) == NULL)
@@ -186,6 +188,16 @@ long length;
186 d2i_ASN1_OCTET_STRING(NULL,&p,max-p)) == NULL) 188 d2i_ASN1_OCTET_STRING(NULL,&p,max-p)) == NULL)
187 goto err; 189 goto err;
188 break; 190 break;
191 case V_ASN1_VISIBLESTRING:
192 if ((ret->value.visiblestring=
193 d2i_ASN1_VISIBLESTRING(NULL,&p,max-p)) == NULL)
194 goto err;
195 break;
196 case V_ASN1_UTF8STRING:
197 if ((ret->value.utf8string=
198 d2i_ASN1_UTF8STRING(NULL,&p,max-p)) == NULL)
199 goto err;
200 break;
189 case V_ASN1_OBJECT: 201 case V_ASN1_OBJECT:
190 if ((ret->value.object= 202 if ((ret->value.object=
191 d2i_ASN1_OBJECT(NULL,&p,max-p)) == NULL) 203 d2i_ASN1_OBJECT(NULL,&p,max-p)) == NULL)
@@ -226,6 +238,11 @@ long length;
226 d2i_ASN1_UTCTIME(NULL,&p,max-p)) == NULL) 238 d2i_ASN1_UTCTIME(NULL,&p,max-p)) == NULL)
227 goto err; 239 goto err;
228 break; 240 break;
241 case V_ASN1_GENERALIZEDTIME:
242 if ((ret->value.generalizedtime=
243 d2i_ASN1_GENERALIZEDTIME(NULL,&p,max-p)) == NULL)
244 goto err;
245 break;
229 case V_ASN1_SET: 246 case V_ASN1_SET:
230 case V_ASN1_SEQUENCE: 247 case V_ASN1_SEQUENCE:
231 /* Sets and sequences are left complete */ 248 /* Sets and sequences are left complete */
@@ -249,9 +266,10 @@ err:
249 return(NULL); 266 return(NULL);
250 } 267 }
251 268
252ASN1_TYPE *ASN1_TYPE_new() 269ASN1_TYPE *ASN1_TYPE_new(void)
253 { 270 {
254 ASN1_TYPE *ret=NULL; 271 ASN1_TYPE *ret=NULL;
272 ASN1_CTX c;
255 273
256 M_ASN1_New_Malloc(ret,ASN1_TYPE); 274 M_ASN1_New_Malloc(ret,ASN1_TYPE);
257 ret->type= -1; 275 ret->type= -1;
@@ -260,16 +278,14 @@ ASN1_TYPE *ASN1_TYPE_new()
260 M_ASN1_New_Error(ASN1_F_ASN1_TYPE_NEW); 278 M_ASN1_New_Error(ASN1_F_ASN1_TYPE_NEW);
261 } 279 }
262 280
263void ASN1_TYPE_free(a) 281void ASN1_TYPE_free(ASN1_TYPE *a)
264ASN1_TYPE *a;
265 { 282 {
266 if (a == NULL) return; 283 if (a == NULL) return;
267 ASN1_TYPE_component_free(a); 284 ASN1_TYPE_component_free(a);
268 Free((char *)(char *)a); 285 Free((char *)(char *)a);
269 } 286 }
270 287
271int ASN1_TYPE_get(a) 288int ASN1_TYPE_get(ASN1_TYPE *a)
272ASN1_TYPE *a;
273 { 289 {
274 if (a->value.ptr != NULL) 290 if (a->value.ptr != NULL)
275 return(a->type); 291 return(a->type);
@@ -277,10 +293,7 @@ ASN1_TYPE *a;
277 return(0); 293 return(0);
278 } 294 }
279 295
280void ASN1_TYPE_set(a,type,value) 296void ASN1_TYPE_set(ASN1_TYPE *a, int type, void *value)
281ASN1_TYPE *a;
282int type;
283char *value;
284 { 297 {
285 if (a->value.ptr != NULL) 298 if (a->value.ptr != NULL)
286 ASN1_TYPE_component_free(a); 299 ASN1_TYPE_component_free(a);
@@ -288,8 +301,7 @@ char *value;
288 a->value.ptr=value; 301 a->value.ptr=value;
289 } 302 }
290 303
291static void ASN1_TYPE_component_free(a) 304static void ASN1_TYPE_component_free(ASN1_TYPE *a)
292ASN1_TYPE *a;
293 { 305 {
294 if (a == NULL) return; 306 if (a == NULL) return;
295 307
@@ -302,16 +314,25 @@ ASN1_TYPE *a;
302 break; 314 break;
303 case V_ASN1_INTEGER: 315 case V_ASN1_INTEGER:
304 case V_ASN1_NEG_INTEGER: 316 case V_ASN1_NEG_INTEGER:
317 case V_ASN1_ENUMERATED:
318 case V_ASN1_NEG_ENUMERATED:
305 case V_ASN1_BIT_STRING: 319 case V_ASN1_BIT_STRING:
306 case V_ASN1_OCTET_STRING: 320 case V_ASN1_OCTET_STRING:
321 case V_ASN1_SEQUENCE:
322 case V_ASN1_SET:
323 case V_ASN1_NUMERICSTRING:
307 case V_ASN1_PRINTABLESTRING: 324 case V_ASN1_PRINTABLESTRING:
308 case V_ASN1_T61STRING: 325 case V_ASN1_T61STRING:
326 case V_ASN1_VIDEOTEXSTRING:
309 case V_ASN1_IA5STRING: 327 case V_ASN1_IA5STRING:
310 case V_ASN1_UNIVERSALSTRING:
311 case V_ASN1_GENERALSTRING:
312 case V_ASN1_UTCTIME: 328 case V_ASN1_UTCTIME:
313 case V_ASN1_SET: 329 case V_ASN1_GENERALIZEDTIME:
314 case V_ASN1_SEQUENCE: 330 case V_ASN1_GRAPHICSTRING:
331 case V_ASN1_VISIBLESTRING:
332 case V_ASN1_GENERALSTRING:
333 case V_ASN1_UNIVERSALSTRING:
334 case V_ASN1_BMPSTRING:
335 case V_ASN1_UTF8STRING:
315 ASN1_STRING_free((ASN1_STRING *)a->value.ptr); 336 ASN1_STRING_free((ASN1_STRING *)a->value.ptr);
316 break; 337 break;
317 default: 338 default:
@@ -323,3 +344,5 @@ ASN1_TYPE *a;
323 } 344 }
324 } 345 }
325 346
347IMPLEMENT_STACK_OF(ASN1_TYPE)
348IMPLEMENT_ASN1_SET_OF(ASN1_TYPE)
diff --git a/src/lib/libcrypto/asn1/a_utctm.c b/src/lib/libcrypto/asn1/a_utctm.c
index 17a7abbb67..688199fdd2 100644
--- a/src/lib/libcrypto/asn1/a_utctm.c
+++ b/src/lib/libcrypto/asn1/a_utctm.c
@@ -58,26 +58,35 @@
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
61#include "cryptlib.h" 66#include "cryptlib.h"
62#include "asn1.h" 67#include <openssl/asn1.h>
63
64/* ASN1err(ASN1_F_ASN1_UTCTIME_NEW,ASN1_R_UTCTIME_TOO_LONG);
65 * ASN1err(ASN1_F_D2I_ASN1_UTCTIME,ASN1_R_EXPECTING_A_UTCTIME);
66 */
67 68
68int i2d_ASN1_UTCTIME(a,pp) 69int i2d_ASN1_UTCTIME(ASN1_UTCTIME *a, unsigned char **pp)
69ASN1_UTCTIME *a;
70unsigned char **pp;
71 { 70 {
71#ifndef CHARSET_EBCDIC
72 return(i2d_ASN1_bytes((ASN1_STRING *)a,pp, 72 return(i2d_ASN1_bytes((ASN1_STRING *)a,pp,
73 V_ASN1_UTCTIME,V_ASN1_UNIVERSAL)); 73 V_ASN1_UTCTIME,V_ASN1_UNIVERSAL));
74#else
75 /* KLUDGE! We convert to ascii before writing DER */
76 int len;
77 char tmp[24];
78 ASN1_STRING x = *(ASN1_STRING *)a;
79
80 len = x.length;
81 ebcdic2ascii(tmp, x.data, (len >= sizeof tmp) ? sizeof tmp : len);
82 x.data = tmp;
83 return i2d_ASN1_bytes(&x, pp, V_ASN1_UTCTIME,V_ASN1_UNIVERSAL);
84#endif
74 } 85 }
75 86
76 87
77ASN1_UTCTIME *d2i_ASN1_UTCTIME(a, pp, length) 88ASN1_UTCTIME *d2i_ASN1_UTCTIME(ASN1_UTCTIME **a, unsigned char **pp,
78ASN1_UTCTIME **a; 89 long length)
79unsigned char **pp;
80long length;
81 { 90 {
82 ASN1_UTCTIME *ret=NULL; 91 ASN1_UTCTIME *ret=NULL;
83 92
@@ -85,9 +94,12 @@ long length;
85 V_ASN1_UTCTIME,V_ASN1_UNIVERSAL); 94 V_ASN1_UTCTIME,V_ASN1_UNIVERSAL);
86 if (ret == NULL) 95 if (ret == NULL)
87 { 96 {
88 ASN1err(ASN1_F_D2I_ASN1_UTCTIME,ASN1_R_ERROR_STACK); 97 ASN1err(ASN1_F_D2I_ASN1_UTCTIME,ERR_R_NESTED_ASN1_ERROR);
89 return(NULL); 98 return(NULL);
90 } 99 }
100#ifdef CHARSET_EBCDIC
101 ascii2ebcdic(ret->data, ret->data, ret->length);
102#endif
91 if (!ASN1_UTCTIME_check(ret)) 103 if (!ASN1_UTCTIME_check(ret))
92 { 104 {
93 ASN1err(ASN1_F_D2I_ASN1_UTCTIME,ASN1_R_INVALID_TIME_FORMAT); 105 ASN1err(ASN1_F_D2I_ASN1_UTCTIME,ASN1_R_INVALID_TIME_FORMAT);
@@ -101,8 +113,7 @@ err:
101 return(NULL); 113 return(NULL);
102 } 114 }
103 115
104int ASN1_UTCTIME_check(d) 116int ASN1_UTCTIME_check(ASN1_UTCTIME *d)
105ASN1_UTCTIME *d;
106 { 117 {
107 static int min[8]={ 0, 1, 1, 0, 0, 0, 0, 0}; 118 static int min[8]={ 0, 1, 1, 0, 0, 0, 0, 0};
108 static int max[8]={99,12,31,23,59,59,12,59}; 119 static int max[8]={99,12,31,23,59,59,12,59};
@@ -152,9 +163,7 @@ err:
152 return(0); 163 return(0);
153 } 164 }
154 165
155int ASN1_UTCTIME_set_string(s,str) 166int ASN1_UTCTIME_set_string(ASN1_UTCTIME *s, char *str)
156ASN1_UTCTIME *s;
157char *str;
158 { 167 {
159 ASN1_UTCTIME t; 168 ASN1_UTCTIME t;
160 169
@@ -174,13 +183,11 @@ char *str;
174 return(0); 183 return(0);
175 } 184 }
176 185
177ASN1_UTCTIME *ASN1_UTCTIME_set(s, t) 186ASN1_UTCTIME *ASN1_UTCTIME_set(ASN1_UTCTIME *s, time_t t)
178ASN1_UTCTIME *s;
179time_t t;
180 { 187 {
181 char *p; 188 char *p;
182 struct tm *ts; 189 struct tm *ts;
183#if defined(THREADS) 190#if defined(THREADS) && !defined(WIN32)
184 struct tm data; 191 struct tm data;
185#endif 192#endif
186 193
@@ -189,10 +196,48 @@ time_t t;
189 if (s == NULL) 196 if (s == NULL)
190 return(NULL); 197 return(NULL);
191 198
192#if defined(THREADS) 199#if defined(THREADS) && !defined(WIN32)
193 ts=(struct tm *)gmtime_r(&t,&data); 200 gmtime_r(&t,&data); /* should return &data, but doesn't on some systems, so we don't even look at the return value */
201 ts=&data;
194#else 202#else
195 ts=(struct tm *)gmtime(&t); 203 ts=gmtime(&t);
204#endif
205#ifdef VMS
206 if (ts == NULL)
207 {
208 static $DESCRIPTOR(tabnam,"LNM$DCL_LOGICAL");
209 static $DESCRIPTOR(lognam,"SYS$TIMEZONE_DIFFERENTIAL");
210 char result[256];
211 unsigned int reslen = 0;
212 struct {
213 short buflen;
214 short code;
215 void *bufaddr;
216 unsigned int *reslen;
217 } itemlist[] = {
218 { 0, LNM$_STRING, 0, 0 },
219 { 0, 0, 0, 0 },
220 };
221 int status;
222
223 /* Get the value for SYS$TIMEZONE_DIFFERENTIAL */
224 itemlist[0].buflen = sizeof(result);
225 itemlist[0].bufaddr = result;
226 itemlist[0].reslen = &reslen;
227 status = sys$trnlnm(0, &tabnam, &lognam, 0, itemlist);
228 if (!(status & 1))
229 return NULL;
230 result[reslen] = '\0';
231
232 /* Get the numerical value of the equivalence string */
233 status = atoi(result);
234
235 /* and use it to move time to GMT */
236 t -= status;
237
238 /* then convert the result to the time structure */
239 ts=(struct tm *)localtime(&t);
240 }
196#endif 241#endif
197 p=(char *)s->data; 242 p=(char *)s->data;
198 if ((p == NULL) || (s->length < 14)) 243 if ((p == NULL) || (s->length < 14))
@@ -208,5 +253,8 @@ time_t t;
208 ts->tm_mon+1,ts->tm_mday,ts->tm_hour,ts->tm_min,ts->tm_sec); 253 ts->tm_mon+1,ts->tm_mday,ts->tm_hour,ts->tm_min,ts->tm_sec);
209 s->length=strlen(p); 254 s->length=strlen(p);
210 s->type=V_ASN1_UTCTIME; 255 s->type=V_ASN1_UTCTIME;
256#ifdef CHARSET_EBCDIC_not
257 ebcdic2ascii(s->data, s->data, s->length);
258#endif
211 return(s); 259 return(s);
212 } 260 }
diff --git a/src/lib/libcrypto/asn1/a_utf8.c b/src/lib/libcrypto/asn1/a_utf8.c
new file mode 100644
index 0000000000..4a8a92e9e4
--- /dev/null
+++ b/src/lib/libcrypto/asn1/a_utf8.c
@@ -0,0 +1,83 @@
1/* crypto/asn1/a_utf8.c */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved.
4 *
5 * This package is an SSL implementation written
6 * by Eric Young (eay@cryptsoft.com).
7 * The implementation was written so as to conform with Netscapes SSL.
8 *
9 * This library is free for commercial and non-commercial use as long as
10 * the following conditions are aheared to. The following conditions
11 * apply to all code found in this distribution, be it the RC4, RSA,
12 * lhash, DES, etc., code; not just the SSL code. The SSL documentation
13 * included with this distribution is covered by the same copyright terms
14 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
15 *
16 * Copyright remains Eric Young's, and as such any Copyright notices in
17 * the code are not to be removed.
18 * If this package is used in a product, Eric Young should be given attribution
19 * as the author of the parts of the library used.
20 * This can be in the form of a textual message at program startup or
21 * in documentation (online or textual) provided with the package.
22 *
23 * Redistribution and use in source and binary forms, with or without
24 * modification, are permitted provided that the following conditions
25 * are met:
26 * 1. Redistributions of source code must retain the copyright
27 * notice, this list of conditions and the following disclaimer.
28 * 2. Redistributions in binary form must reproduce the above copyright
29 * notice, this list of conditions and the following disclaimer in the
30 * documentation and/or other materials provided with the distribution.
31 * 3. All advertising materials mentioning features or use of this software
32 * must display the following acknowledgement:
33 * "This product includes cryptographic software written by
34 * Eric Young (eay@cryptsoft.com)"
35 * The word 'cryptographic' can be left out if the rouines from the library
36 * being used are not cryptographic related :-).
37 * 4. If you include any Windows specific code (or a derivative thereof) from
38 * the apps directory (application code) you must include an acknowledgement:
39 * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
40 *
41 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
42 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
43 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
44 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
45 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
46 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
47 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
49 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
50 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
51 * SUCH DAMAGE.
52 *
53 * The licence and distribution terms for any publically available version or
54 * derivative of this code cannot be changed. i.e. this code cannot simply be
55 * copied and put under another distribution licence
56 * [including the GNU Public Licence.]
57 */
58
59#include <stdio.h>
60#include "cryptlib.h"
61#include <openssl/asn1.h>
62
63int i2d_ASN1_UTF8STRING(ASN1_UTF8STRING *a, unsigned char **pp)
64 {
65 return(i2d_ASN1_bytes((ASN1_STRING *)a,pp,
66 V_ASN1_UTF8STRING,V_ASN1_UNIVERSAL));
67 }
68
69ASN1_UTF8STRING *d2i_ASN1_UTF8STRING(ASN1_UTF8STRING **a, unsigned char **pp,
70 long length)
71 {
72 ASN1_UTF8STRING *ret=NULL;
73
74 ret=(ASN1_UTF8STRING *)d2i_ASN1_bytes((ASN1_STRING **)a,
75 pp,length,V_ASN1_UTF8STRING,V_ASN1_UNIVERSAL);
76 if (ret == NULL)
77 {
78 ASN1err(ASN1_F_D2I_ASN1_UTF8STRING,ERR_R_NESTED_ASN1_ERROR);
79 return(NULL);
80 }
81 return(ret);
82 }
83
diff --git a/src/lib/libcrypto/asn1/a_verify.c b/src/lib/libcrypto/asn1/a_verify.c
index 03fc63dbef..6383d2c698 100644
--- a/src/lib/libcrypto/asn1/a_verify.c
+++ b/src/lib/libcrypto/asn1/a_verify.c
@@ -62,22 +62,17 @@
62#include <sys/stat.h> 62#include <sys/stat.h>
63 63
64#include "cryptlib.h" 64#include "cryptlib.h"
65#include "bn.h" 65#include <openssl/bn.h>
66#include "x509.h" 66#include <openssl/x509.h>
67#include "objects.h" 67#include <openssl/objects.h>
68#include "buffer.h" 68#include <openssl/buffer.h>
69#include "evp.h" 69#include <openssl/evp.h>
70#include "pem.h"
71 70
72int ASN1_verify(i2d,a,signature,data,pkey) 71int ASN1_verify(int (*i2d)(), X509_ALGOR *a, ASN1_BIT_STRING *signature,
73int (*i2d)(); 72 char *data, EVP_PKEY *pkey)
74X509_ALGOR *a;
75ASN1_BIT_STRING *signature;
76char *data;
77EVP_PKEY *pkey;
78 { 73 {
79 EVP_MD_CTX ctx; 74 EVP_MD_CTX ctx;
80 EVP_MD *type; 75 const EVP_MD *type;
81 unsigned char *p,*buf_in=NULL; 76 unsigned char *p,*buf_in=NULL;
82 int ret= -1,i,inl; 77 int ret= -1,i,inl;
83 78
@@ -90,7 +85,7 @@ EVP_PKEY *pkey;
90 } 85 }
91 86
92 inl=i2d(data,NULL); 87 inl=i2d(data,NULL);
93 buf_in=(unsigned char *)Malloc((unsigned int)inl); 88 buf_in=Malloc((unsigned int)inl);
94 if (buf_in == NULL) 89 if (buf_in == NULL)
95 { 90 {
96 ASN1err(ASN1_F_ASN1_VERIFY,ERR_R_MALLOC_FAILURE); 91 ASN1err(ASN1_F_ASN1_VERIFY,ERR_R_MALLOC_FAILURE);
diff --git a/src/lib/libcrypto/asn1/a_vis.c b/src/lib/libcrypto/asn1/a_vis.c
new file mode 100644
index 0000000000..2072be780d
--- /dev/null
+++ b/src/lib/libcrypto/asn1/a_vis.c
@@ -0,0 +1,83 @@
1/* crypto/asn1/a_vis.c */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved.
4 *
5 * This package is an SSL implementation written
6 * by Eric Young (eay@cryptsoft.com).
7 * The implementation was written so as to conform with Netscapes SSL.
8 *
9 * This library is free for commercial and non-commercial use as long as
10 * the following conditions are aheared to. The following conditions
11 * apply to all code found in this distribution, be it the RC4, RSA,
12 * lhash, DES, etc., code; not just the SSL code. The SSL documentation
13 * included with this distribution is covered by the same copyright terms
14 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
15 *
16 * Copyright remains Eric Young's, and as such any Copyright notices in
17 * the code are not to be removed.
18 * If this package is used in a product, Eric Young should be given attribution
19 * as the author of the parts of the library used.
20 * This can be in the form of a textual message at program startup or
21 * in documentation (online or textual) provided with the package.
22 *
23 * Redistribution and use in source and binary forms, with or without
24 * modification, are permitted provided that the following conditions
25 * are met:
26 * 1. Redistributions of source code must retain the copyright
27 * notice, this list of conditions and the following disclaimer.
28 * 2. Redistributions in binary form must reproduce the above copyright
29 * notice, this list of conditions and the following disclaimer in the
30 * documentation and/or other materials provided with the distribution.
31 * 3. All advertising materials mentioning features or use of this software
32 * must display the following acknowledgement:
33 * "This product includes cryptographic software written by
34 * Eric Young (eay@cryptsoft.com)"
35 * The word 'cryptographic' can be left out if the rouines from the library
36 * being used are not cryptographic related :-).
37 * 4. If you include any Windows specific code (or a derivative thereof) from
38 * the apps directory (application code) you must include an acknowledgement:
39 * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
40 *
41 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
42 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
43 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
44 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
45 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
46 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
47 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
49 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
50 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
51 * SUCH DAMAGE.
52 *
53 * The licence and distribution terms for any publically available version or
54 * derivative of this code cannot be changed. i.e. this code cannot simply be
55 * copied and put under another distribution licence
56 * [including the GNU Public Licence.]
57 */
58
59#include <stdio.h>
60#include "cryptlib.h"
61#include <openssl/asn1.h>
62
63int i2d_ASN1_VISIBLESTRING(ASN1_VISIBLESTRING *a, unsigned char **pp)
64 {
65 return(i2d_ASN1_bytes((ASN1_STRING *)a,pp,
66 V_ASN1_VISIBLESTRING,V_ASN1_UNIVERSAL));
67 }
68
69ASN1_VISIBLESTRING *d2i_ASN1_VISIBLESTRING(ASN1_VISIBLESTRING **a,
70 unsigned char **pp, long length)
71 {
72 ASN1_VISIBLESTRING *ret=NULL;
73
74 ret=(ASN1_VISIBLESTRING *)d2i_ASN1_bytes((ASN1_STRING **)a,
75 pp,length,V_ASN1_VISIBLESTRING,V_ASN1_UNIVERSAL);
76 if (ret == NULL)
77 {
78 ASN1err(ASN1_F_D2I_ASN1_VISIBLESTRING,ERR_R_NESTED_ASN1_ERROR);
79 return(NULL);
80 }
81 return(ret);
82 }
83
diff --git a/src/lib/libcrypto/asn1/asn1.err b/src/lib/libcrypto/asn1/asn1.err
deleted file mode 100644
index c8b7011488..0000000000
--- a/src/lib/libcrypto/asn1/asn1.err
+++ /dev/null
@@ -1,182 +0,0 @@
1/* Error codes for the ASN1 functions. */
2
3/* Function codes. */
4#define ASN1_F_A2D_ASN1_OBJECT 100
5#define ASN1_F_A2I_ASN1_INTEGER 101
6#define ASN1_F_A2I_ASN1_STRING 102
7#define ASN1_F_ASN1_COLLATE_PRIMATIVE 103
8#define ASN1_F_ASN1_D2I_BIO 104
9#define ASN1_F_ASN1_D2I_FP 105
10#define ASN1_F_ASN1_DUP 106
11#define ASN1_F_ASN1_GET_OBJECT 107
12#define ASN1_F_ASN1_HEADER_NEW 108
13#define ASN1_F_ASN1_I2D_BIO 109
14#define ASN1_F_ASN1_I2D_FP 110
15#define ASN1_F_ASN1_INTEGER_SET 111
16#define ASN1_F_ASN1_INTEGER_TO_BN 112
17#define ASN1_F_ASN1_OBJECT_NEW 113
18#define ASN1_F_ASN1_SIGN 114
19#define ASN1_F_ASN1_STRING_NEW 115
20#define ASN1_F_ASN1_STRING_TYPE_NEW 116
21#define ASN1_F_ASN1_TYPE_GET_INT_OCTETSTRING 117
22#define ASN1_F_ASN1_TYPE_GET_OCTETSTRING 118
23#define ASN1_F_ASN1_TYPE_NEW 119
24#define ASN1_F_ASN1_UTCTIME_NEW 120
25#define ASN1_F_ASN1_VERIFY 121
26#define ASN1_F_BN_TO_ASN1_INTEGER 122
27#define ASN1_F_D2I_ASN1_BIT_STRING 123
28#define ASN1_F_D2I_ASN1_BMPSTRING 124
29#define ASN1_F_D2I_ASN1_BOOLEAN 125
30#define ASN1_F_D2I_ASN1_BYTES 126
31#define ASN1_F_D2I_ASN1_HEADER 127
32#define ASN1_F_D2I_ASN1_INTEGER 128
33#define ASN1_F_D2I_ASN1_OBJECT 129
34#define ASN1_F_D2I_ASN1_OCTET_STRING 130
35#define ASN1_F_D2I_ASN1_PRINT_TYPE 131
36#define ASN1_F_D2I_ASN1_SET 132
37#define ASN1_F_D2I_ASN1_TYPE 133
38#define ASN1_F_D2I_ASN1_TYPE_BYTES 134
39#define ASN1_F_D2I_ASN1_UTCTIME 135
40#define ASN1_F_D2I_DHPARAMS 136
41#define ASN1_F_D2I_DSAPARAMS 137
42#define ASN1_F_D2I_DSAPRIVATEKEY 138
43#define ASN1_F_D2I_DSAPUBLICKEY 139
44#define ASN1_F_D2I_NETSCAPE_PKEY 140
45#define ASN1_F_D2I_NETSCAPE_RSA 141
46#define ASN1_F_D2I_NETSCAPE_RSA_2 142
47#define ASN1_F_D2I_NETSCAPE_SPKAC 143
48#define ASN1_F_D2I_NETSCAPE_SPKI 144
49#define ASN1_F_D2I_PKCS7 145
50#define ASN1_F_D2I_PKCS7_DIGEST 146
51#define ASN1_F_D2I_PKCS7_ENCRYPT 147
52#define ASN1_F_D2I_PKCS7_ENC_CONTENT 148
53#define ASN1_F_D2I_PKCS7_ENVELOPE 149
54#define ASN1_F_D2I_PKCS7_ISSUER_AND_SERIAL 150
55#define ASN1_F_D2I_PKCS7_RECIP_INFO 151
56#define ASN1_F_D2I_PKCS7_SIGNED 152
57#define ASN1_F_D2I_PKCS7_SIGNER_INFO 153
58#define ASN1_F_D2I_PKCS7_SIGN_ENVELOPE 154
59#define ASN1_F_D2I_PRIVATEKEY 155
60#define ASN1_F_D2I_PUBLICKEY 156
61#define ASN1_F_D2I_RSAPRIVATEKEY 157
62#define ASN1_F_D2I_RSAPUBLICKEY 158
63#define ASN1_F_D2I_X509 159
64#define ASN1_F_D2I_X509_ALGOR 160
65#define ASN1_F_D2I_X509_ATTRIBUTE 161
66#define ASN1_F_D2I_X509_CINF 162
67#define ASN1_F_D2I_X509_CRL 163
68#define ASN1_F_D2I_X509_CRL_INFO 164
69#define ASN1_F_D2I_X509_EXTENSION 165
70#define ASN1_F_D2I_X509_KEY 166
71#define ASN1_F_D2I_X509_NAME 167
72#define ASN1_F_D2I_X509_NAME_ENTRY 168
73#define ASN1_F_D2I_X509_PKEY 169
74#define ASN1_F_D2I_X509_PUBKEY 170
75#define ASN1_F_D2I_X509_REQ 171
76#define ASN1_F_D2I_X509_REQ_INFO 172
77#define ASN1_F_D2I_X509_REVOKED 173
78#define ASN1_F_D2I_X509_SIG 174
79#define ASN1_F_D2I_X509_VAL 175
80#define ASN1_F_I2D_ASN1_HEADER 176
81#define ASN1_F_I2D_DHPARAMS 177
82#define ASN1_F_I2D_DSAPARAMS 178
83#define ASN1_F_I2D_DSAPRIVATEKEY 179
84#define ASN1_F_I2D_DSAPUBLICKEY 180
85#define ASN1_F_I2D_NETSCAPE_RSA 181
86#define ASN1_F_I2D_PKCS7 182
87#define ASN1_F_I2D_PRIVATEKEY 183
88#define ASN1_F_I2D_PUBLICKEY 184
89#define ASN1_F_I2D_RSAPRIVATEKEY 185
90#define ASN1_F_I2D_RSAPUBLICKEY 186
91#define ASN1_F_I2D_X509_ATTRIBUTE 187
92#define ASN1_F_I2T_ASN1_OBJECT 188
93#define ASN1_F_NETSCAPE_PKEY_NEW 189
94#define ASN1_F_NETSCAPE_SPKAC_NEW 190
95#define ASN1_F_NETSCAPE_SPKI_NEW 191
96#define ASN1_F_PKCS7_DIGEST_NEW 192
97#define ASN1_F_PKCS7_ENCRYPT_NEW 193
98#define ASN1_F_PKCS7_ENC_CONTENT_NEW 194
99#define ASN1_F_PKCS7_ENVELOPE_NEW 195
100#define ASN1_F_PKCS7_ISSUER_AND_SERIAL_NEW 196
101#define ASN1_F_PKCS7_NEW 197
102#define ASN1_F_PKCS7_RECIP_INFO_NEW 198
103#define ASN1_F_PKCS7_SIGNED_NEW 199
104#define ASN1_F_PKCS7_SIGNER_INFO_NEW 200
105#define ASN1_F_PKCS7_SIGN_ENVELOPE_NEW 201
106#define ASN1_F_X509_ALGOR_NEW 202
107#define ASN1_F_X509_ATTRIBUTE_NEW 203
108#define ASN1_F_X509_CINF_NEW 204
109#define ASN1_F_X509_CRL_INFO_NEW 205
110#define ASN1_F_X509_CRL_NEW 206
111#define ASN1_F_X509_DHPARAMS_NEW 207
112#define ASN1_F_X509_EXTENSION_NEW 208
113#define ASN1_F_X509_INFO_NEW 209
114#define ASN1_F_X509_KEY_NEW 210
115#define ASN1_F_X509_NAME_ENTRY_NEW 211
116#define ASN1_F_X509_NAME_NEW 212
117#define ASN1_F_X509_NEW 213
118#define ASN1_F_X509_PKEY_NEW 214
119#define ASN1_F_X509_PUBKEY_NEW 215
120#define ASN1_F_X509_REQ_INFO_NEW 216
121#define ASN1_F_X509_REQ_NEW 217
122#define ASN1_F_X509_REVOKED_NEW 218
123#define ASN1_F_X509_SIG_NEW 219
124#define ASN1_F_X509_VAL_FREE 220
125#define ASN1_F_X509_VAL_NEW 221
126
127/* Reason codes. */
128#define ASN1_R_BAD_CLASS 100
129#define ASN1_R_BAD_GET_OBJECT 101
130#define ASN1_R_BAD_OBJECT_HEADER 102
131#define ASN1_R_BAD_PASSWORD_READ 103
132#define ASN1_R_BAD_PKCS7_CONTENT 104
133#define ASN1_R_BAD_PKCS7_TYPE 105
134#define ASN1_R_BAD_TAG 106
135#define ASN1_R_BAD_TYPE 107
136#define ASN1_R_BN_LIB 108
137#define ASN1_R_BOOLEAN_IS_WRONG_LENGTH 109
138#define ASN1_R_BUFFER_TOO_SMALL 110
139#define ASN1_R_DATA_IS_WRONG 111
140#define ASN1_R_DECODING_ERROR 112
141#define ASN1_R_ERROR_STACK 113
142#define ASN1_R_EXPECTING_AN_INTEGER 114
143#define ASN1_R_EXPECTING_AN_OBJECT 115
144#define ASN1_R_EXPECTING_AN_OCTET_STRING 116
145#define ASN1_R_EXPECTING_A_BIT_STRING 117
146#define ASN1_R_EXPECTING_A_BOOLEAN 118
147#define ASN1_R_EXPECTING_A_SEQUENCE 119
148#define ASN1_R_EXPECTING_A_UTCTIME 120
149#define ASN1_R_FIRST_NUM_TOO_LARGE 121
150#define ASN1_R_HEADER_TOO_LONG 122
151#define ASN1_R_INVALID_DIGIT 123
152#define ASN1_R_INVALID_SEPARATOR 124
153#define ASN1_R_INVALID_TIME_FORMAT 125
154#define ASN1_R_IV_TOO_LARGE 126
155#define ASN1_R_LENGTH_ERROR 127
156#define ASN1_R_LENGTH_MISMATCH 128
157#define ASN1_R_MISSING_EOS 129
158#define ASN1_R_MISSING_SECOND_NUMBER 130
159#define ASN1_R_NON_HEX_CHARACTERS 131
160#define ASN1_R_NOT_ENOUGH_DATA 132
161#define ASN1_R_ODD_NUMBER_OF_CHARS 133
162#define ASN1_R_PARSING 134
163#define ASN1_R_PRIVATE_KEY_HEADER_MISSING 135
164#define ASN1_R_SECOND_NUMBER_TOO_LARGE 136
165#define ASN1_R_SHORT_LINE 137
166#define ASN1_R_STRING_TOO_SHORT 138
167#define ASN1_R_TAG_VALUE_TOO_HIGH 139
168#define ASN1_R_THE_ASN1_OBJECT_IDENTIFIER_IS_NOT_KNOWN_FOR_THIS_MD 140
169#define ASN1_R_TOO_LONG 141
170#define ASN1_R_UNABLE_TO_DECODE_RSA_KEY 142
171#define ASN1_R_UNABLE_TO_DECODE_RSA_PRIVATE_KEY 143
172#define ASN1_R_UNKNOWN_ATTRIBUTE_TYPE 144
173#define ASN1_R_UNKNOWN_MESSAGE_DIGEST_ALGORITHM 145
174#define ASN1_R_UNKNOWN_OBJECT_TYPE 146
175#define ASN1_R_UNKNOWN_PUBLIC_KEY_TYPE 147
176#define ASN1_R_UNSUPPORTED_CIPHER 148
177#define ASN1_R_UNSUPPORTED_ENCRYPTION_ALGORITHM 149
178#define ASN1_R_UNSUPPORTED_PUBLIC_KEY_TYPE 150
179#define ASN1_R_UTCTIME_TOO_LONG 151
180#define ASN1_R_WRONG_PRINTABLE_TYPE 152
181#define ASN1_R_WRONG_TAG 153
182#define ASN1_R_WRONG_TYPE 154
diff --git a/src/lib/libcrypto/asn1/asn1.h b/src/lib/libcrypto/asn1/asn1.h
index 9793db365d..5c2d8999bc 100644
--- a/src/lib/libcrypto/asn1/asn1.h
+++ b/src/lib/libcrypto/asn1/asn1.h
@@ -64,8 +64,9 @@ extern "C" {
64#endif 64#endif
65 65
66#include <time.h> 66#include <time.h>
67#include "bn.h" 67#include <openssl/bn.h>
68#include "stack.h" 68#include <openssl/stack.h>
69#include <openssl/safestack.h>
69 70
70#define V_ASN1_UNIVERSAL 0x00 71#define V_ASN1_UNIVERSAL 0x00
71#define V_ASN1_APPLICATION 0x40 72#define V_ASN1_APPLICATION 0x40
@@ -73,6 +74,7 @@ extern "C" {
73#define V_ASN1_PRIVATE 0xc0 74#define V_ASN1_PRIVATE 0xc0
74 75
75#define V_ASN1_CONSTRUCTED 0x20 76#define V_ASN1_CONSTRUCTED 0x20
77#define V_ASN1_PRIMITIVE_TAG 0x1f
76#define V_ASN1_PRIMATIVE_TAG 0x1f 78#define V_ASN1_PRIMATIVE_TAG 0x1f
77 79
78#define V_ASN1_APP_CHOOSE -2 /* let the recipent choose */ 80#define V_ASN1_APP_CHOOSE -2 /* let the recipent choose */
@@ -89,7 +91,9 @@ extern "C" {
89#define V_ASN1_OBJECT_DESCRIPTOR 7 91#define V_ASN1_OBJECT_DESCRIPTOR 7
90#define V_ASN1_EXTERNAL 8 92#define V_ASN1_EXTERNAL 8
91#define V_ASN1_REAL 9 93#define V_ASN1_REAL 9
92#define V_ASN1_ENUMERATED 10 /* microsoft weirdness */ 94#define V_ASN1_ENUMERATED 10
95#define V_ASN1_NEG_ENUMERATED (10+0x100)
96#define V_ASN1_UTF8STRING 12
93#define V_ASN1_SEQUENCE 16 97#define V_ASN1_SEQUENCE 16
94#define V_ASN1_SET 17 98#define V_ASN1_SET 17
95#define V_ASN1_NUMERICSTRING 18 /**/ 99#define V_ASN1_NUMERICSTRING 18 /**/
@@ -111,111 +115,46 @@ extern "C" {
111#define B_ASN1_NUMERICSTRING 0x0001 115#define B_ASN1_NUMERICSTRING 0x0001
112#define B_ASN1_PRINTABLESTRING 0x0002 116#define B_ASN1_PRINTABLESTRING 0x0002
113#define B_ASN1_T61STRING 0x0004 117#define B_ASN1_T61STRING 0x0004
118#define B_ASN1_TELETEXSTRING 0x0008
114#define B_ASN1_VIDEOTEXSTRING 0x0008 119#define B_ASN1_VIDEOTEXSTRING 0x0008
115#define B_ASN1_IA5STRING 0x0010 120#define B_ASN1_IA5STRING 0x0010
116#define B_ASN1_GRAPHICSTRING 0x0020 121#define B_ASN1_GRAPHICSTRING 0x0020
117#define B_ASN1_ISO64STRING 0x0040 122#define B_ASN1_ISO64STRING 0x0040
123#define B_ASN1_VISIBLESTRING 0x0040
118#define B_ASN1_GENERALSTRING 0x0080 124#define B_ASN1_GENERALSTRING 0x0080
119#define B_ASN1_UNIVERSALSTRING 0x0100 125#define B_ASN1_UNIVERSALSTRING 0x0100
120#define B_ASN1_OCTET_STRING 0x0200 126#define B_ASN1_OCTET_STRING 0x0200
121#define B_ASN1_BIT_STRING 0x0400 127#define B_ASN1_BIT_STRING 0x0400
122#define B_ASN1_BMPSTRING 0x0800 128#define B_ASN1_BMPSTRING 0x0800
123#define B_ASN1_UNKNOWN 0x1000 129#define B_ASN1_UNKNOWN 0x1000
124 130#define B_ASN1_UTF8STRING 0x2000
125#ifndef DEBUG 131
126 132#define DECLARE_ASN1_SET_OF(type) \
127#define ASN1_INTEGER ASN1_STRING 133int i2d_ASN1_SET_OF_##type(STACK_OF(type) *a,unsigned char **pp, \
128#define ASN1_BIT_STRING ASN1_STRING 134 int (*func)(type *,unsigned char **), int ex_tag, \
129#define ASN1_OCTET_STRING ASN1_STRING 135 int ex_class, int is_set); \
130#define ASN1_PRINTABLESTRING ASN1_STRING 136STACK_OF(type) *d2i_ASN1_SET_OF_##type(STACK_OF(type) **a,unsigned char **pp, \
131#define ASN1_T61STRING ASN1_STRING 137 long length, \
132#define ASN1_IA5STRING ASN1_STRING 138 type *(*func)(type **, \
133#define ASN1_UTCTIME ASN1_STRING 139 unsigned char **,long), \
134#define ASN1_GENERALIZEDTIME ASN1_STRING 140 void (*free_func)(type *), \
135#define ASN1_GENERALSTRING ASN1_STRING 141 int ex_tag,int ex_class);
136#define ASN1_UNIVERSALSTRING ASN1_STRING 142
137#define ASN1_BMPSTRING ASN1_STRING 143#define IMPLEMENT_ASN1_SET_OF(type) \
138 144int i2d_ASN1_SET_OF_##type(STACK_OF(type) *a,unsigned char **pp, \
139#else 145 int (*func)(type *,unsigned char **), int ex_tag, \
140 146 int ex_class, int is_set) \
141typedef struct asn1_integer_st 147 { return i2d_ASN1_SET((STACK *)a,pp,func,ex_tag,ex_class,is_set); } \
142 { 148STACK_OF(type) *d2i_ASN1_SET_OF_##type(STACK_OF(type) **a,unsigned char **pp, \
143 int length; 149 long length, \
144 int type; 150 type *(*func)(type **, \
145 unsigned char *data; 151 unsigned char **,long), \
146 } ASN1_INTEGER; 152 void (*free_func)(type *), \
147 153 int ex_tag,int ex_class) \
148typedef struct asn1_bit_string_st 154 { return (STACK_OF(type) *)d2i_ASN1_SET((STACK **)a,pp,length, \
149 { 155 (char *(*)())func, \
150 int length; 156 (void (*)())free_func, \
151 int type; 157 ex_tag,ex_class); }
152 unsigned char *data;
153 } ASN1_BIT_STRING;
154
155typedef struct asn1_octet_string_st
156 {
157 int length;
158 int type;
159 unsigned char *data;
160 } ASN1_OCTET_STRING;
161
162typedef struct asn1_printablestring_st
163 {
164 int length;
165 int type;
166 unsigned char *data;
167 } ASN1_PRINTABLESTRING;
168
169typedef struct asn1_t61string_st
170 {
171 int length;
172 int type;
173 unsigned char *data;
174 } ASN1_T61STRING;
175
176typedef struct asn1_ia5string_st
177 {
178 int length;
179 int type;
180 unsigned char *data;
181 } ASN1_IA5STRING;
182
183typedef struct asn1_generalstring_st
184 {
185 int length;
186 int type;
187 unsigned char *data;
188 } ASN1_GENERALSTRING;
189
190typedef struct asn1_universalstring_st
191 {
192 int length;
193 int type;
194 unsigned char *data;
195 } ASN1_UNIVERSALSTRING;
196
197typedef struct asn1_bmpstring_st
198 {
199 int length;
200 int type;
201 unsigned char *data;
202 } ASN1_BMPSTRING;
203
204typedef struct asn1_utctime_st
205 {
206 int length;
207 int type;
208 unsigned char *data;
209 } ASN1_UTCTIME;
210
211typedef struct asn1_generalizedtime_st
212 {
213 int length;
214 int type;
215 unsigned char *data;
216 } ASN1_GENERALIZEDTIME;
217
218#endif
219 158
220typedef struct asn1_ctx_st 159typedef struct asn1_ctx_st
221 { 160 {
@@ -229,6 +168,7 @@ typedef struct asn1_ctx_st
229 unsigned char *max; /* largest value of p alowed */ 168 unsigned char *max; /* largest value of p alowed */
230 unsigned char *q;/* temporary variable */ 169 unsigned char *q;/* temporary variable */
231 unsigned char **pp;/* variable */ 170 unsigned char **pp;/* variable */
171 int line; /* used in error processing */
232 } ASN1_CTX; 172 } ASN1_CTX;
233 173
234/* These are used internally in the ASN1_OBJECT to keep track of 174/* These are used internally in the ASN1_OBJECT to keep track of
@@ -239,21 +179,61 @@ typedef struct asn1_ctx_st
239#define ASN1_OBJECT_FLAG_DYNAMIC_DATA 0x08 /* internal use */ 179#define ASN1_OBJECT_FLAG_DYNAMIC_DATA 0x08 /* internal use */
240typedef struct asn1_object_st 180typedef struct asn1_object_st
241 { 181 {
242 char *sn,*ln; 182 const char *sn,*ln;
243 int nid; 183 int nid;
244 int length; 184 int length;
245 unsigned char *data; 185 unsigned char *data;
246 int flags; /* Should we free this one */ 186 int flags; /* Should we free this one */
247 } ASN1_OBJECT; 187 } ASN1_OBJECT;
248 188
189#define ASN1_STRING_FLAG_BITS_LEFT 0x08 /* Set if 0x07 has bits left value */
249/* This is the base type that holds just about everything :-) */ 190/* This is the base type that holds just about everything :-) */
250typedef struct asn1_string_st 191typedef struct asn1_string_st
251 { 192 {
252 int length; 193 int length;
253 int type; 194 int type;
254 unsigned char *data; 195 unsigned char *data;
196 /* The value of the following field depends on the type being
197 * held. It is mostly being used for BIT_STRING so if the
198 * input data has a non-zero 'unused bits' value, it will be
199 * handled correctly */
200 long flags;
255 } ASN1_STRING; 201 } ASN1_STRING;
256 202
203#ifndef DEBUG
204#define ASN1_INTEGER ASN1_STRING
205#define ASN1_ENUMERATED ASN1_STRING
206#define ASN1_BIT_STRING ASN1_STRING
207#define ASN1_OCTET_STRING ASN1_STRING
208#define ASN1_PRINTABLESTRING ASN1_STRING
209#define ASN1_T61STRING ASN1_STRING
210#define ASN1_IA5STRING ASN1_STRING
211#define ASN1_UTCTIME ASN1_STRING
212#define ASN1_GENERALIZEDTIME ASN1_STRING
213#define ASN1_TIME ASN1_STRING
214#define ASN1_GENERALSTRING ASN1_STRING
215#define ASN1_UNIVERSALSTRING ASN1_STRING
216#define ASN1_BMPSTRING ASN1_STRING
217#define ASN1_VISIBLESTRING ASN1_STRING
218#define ASN1_UTF8STRING ASN1_STRING
219#else
220typedef struct asn1_string_st ASN1_INTEGER;
221typedef struct asn1_string_st ASN1_ENUMERATED;
222typedef struct asn1_string_st ASN1_BIT_STRING;
223typedef struct asn1_string_st ASN1_OCTET_STRING;
224typedef struct asn1_string_st ASN1_PRINTABLESTRING;
225typedef struct asn1_string_st ASN1_T61STRING;
226typedef struct asn1_string_st ASN1_IA5STRING;
227typedef struct asn1_string_st ASN1_GENERALSTRING;
228typedef struct asn1_string_st ASN1_UNIVERSALSTRING;
229typedef struct asn1_string_st ASN1_BMPSTRING;
230typedef struct asn1_string_st ASN1_UTCTIME;
231typedef struct asn1_string_st ASN1_TIME;
232typedef struct asn1_string_st ASN1_GENERALIZEDTIME;
233typedef struct asn1_string_st ASN1_VISIBLESTRING;
234typedef struct asn1_string_st ASN1_UTF8STRING;
235#endif
236
257typedef struct asn1_type_st 237typedef struct asn1_type_st
258 { 238 {
259 int type; 239 int type;
@@ -262,6 +242,7 @@ typedef struct asn1_type_st
262 ASN1_STRING * asn1_string; 242 ASN1_STRING * asn1_string;
263 ASN1_OBJECT * object; 243 ASN1_OBJECT * object;
264 ASN1_INTEGER * integer; 244 ASN1_INTEGER * integer;
245 ASN1_ENUMERATED * enumerated;
265 ASN1_BIT_STRING * bit_string; 246 ASN1_BIT_STRING * bit_string;
266 ASN1_OCTET_STRING * octet_string; 247 ASN1_OCTET_STRING * octet_string;
267 ASN1_PRINTABLESTRING * printablestring; 248 ASN1_PRINTABLESTRING * printablestring;
@@ -272,6 +253,8 @@ typedef struct asn1_type_st
272 ASN1_UNIVERSALSTRING * universalstring; 253 ASN1_UNIVERSALSTRING * universalstring;
273 ASN1_UTCTIME * utctime; 254 ASN1_UTCTIME * utctime;
274 ASN1_GENERALIZEDTIME * generalizedtime; 255 ASN1_GENERALIZEDTIME * generalizedtime;
256 ASN1_VISIBLESTRING * visiblestring;
257 ASN1_UTF8STRING * utf8string;
275 /* set and sequence are left complete and still 258 /* set and sequence are left complete and still
276 * contain the set or sequence bytes */ 259 * contain the set or sequence bytes */
277 ASN1_STRING * set; 260 ASN1_STRING * set;
@@ -279,6 +262,9 @@ typedef struct asn1_type_st
279 } value; 262 } value;
280 } ASN1_TYPE; 263 } ASN1_TYPE;
281 264
265DECLARE_STACK_OF(ASN1_TYPE)
266DECLARE_ASN1_SET_OF(ASN1_TYPE)
267
282typedef struct asn1_method_st 268typedef struct asn1_method_st
283 { 269 {
284 int (*i2d)(); 270 int (*i2d)();
@@ -322,6 +308,17 @@ typedef struct asn1_header_st
322/* i2d_ASN1_INTEGER() is a function */ 308/* i2d_ASN1_INTEGER() is a function */
323/* d2i_ASN1_INTEGER() is a function */ 309/* d2i_ASN1_INTEGER() is a function */
324 310
311#define ASN1_ENUMERATED_new() (ASN1_ENUMERATED *)\
312 ASN1_STRING_type_new(V_ASN1_ENUMERATED)
313#define ASN1_ENUMERATED_free(a) ASN1_STRING_free((ASN1_STRING *)a)
314#define ASN1_ENUMERATED_dup(a) (ASN1_ENUMERATED *)ASN1_STRING_dup((ASN1_STRING *)a)
315#define ASN1_ENUMERATED_cmp(a,b) ASN1_STRING_cmp(\
316 (ASN1_STRING *)a,(ASN1_STRING *)b)
317/* ASN1_ENUMERATED_set() is a function, also see BN_to_ASN1_ENUMERATED() */
318/* ASN1_ENUMERATED_get() is a function, also see ASN1_ENUMERATED_to_BN() */
319/* i2d_ASN1_ENUMERATED() is a function */
320/* d2i_ASN1_ENUMERATED() is a function */
321
325#define ASN1_OCTET_STRING_new() (ASN1_OCTET_STRING *)\ 322#define ASN1_OCTET_STRING_new() (ASN1_OCTET_STRING *)\
326 ASN1_STRING_type_new(V_ASN1_OCTET_STRING) 323 ASN1_STRING_type_new(V_ASN1_OCTET_STRING)
327#define ASN1_OCTET_STRING_free(a) ASN1_STRING_free((ASN1_STRING *)a) 324#define ASN1_OCTET_STRING_free(a) ASN1_STRING_free((ASN1_STRING *)a)
@@ -350,7 +347,29 @@ typedef struct asn1_header_st
350 B_ASN1_BMPSTRING|\ 347 B_ASN1_BMPSTRING|\
351 B_ASN1_UNKNOWN) 348 B_ASN1_UNKNOWN)
352 349
353#define ASN1_PRINTABLESTRING_new() (ASN1_PRINTABLESTRING_STRING *)\ 350#define DIRECTORYSTRING_new() ASN1_STRING_type_new(V_ASN1_PRINTABLESTRING)
351#define DIRECTORYSTRING_free(a) ASN1_STRING_free((ASN1_STRING *)a)
352#define M_i2d_DIRECTORYSTRING(a,pp) i2d_ASN1_bytes((ASN1_STRING *)a,\
353 pp,a->type,V_ASN1_UNIVERSAL)
354#define M_d2i_DIRECTORYSTRING(a,pp,l) \
355 d2i_ASN1_type_bytes((ASN1_STRING **)a,pp,l, \
356 B_ASN1_PRINTABLESTRING| \
357 B_ASN1_TELETEXSTRING|\
358 B_ASN1_BMPSTRING|\
359 B_ASN1_UNIVERSALSTRING|\
360 B_ASN1_UTF8STRING)
361
362#define DISPLAYTEXT_new() ASN1_STRING_type_new(V_ASN1_VISIBLESTRING)
363#define DISPLAYTEXT_free(a) ASN1_STRING_free((ASN1_STRING *)a)
364#define M_i2d_DISPLAYTEXT(a,pp) i2d_ASN1_bytes((ASN1_STRING *)a,\
365 pp,a->type,V_ASN1_UNIVERSAL)
366#define M_d2i_DISPLAYTEXT(a,pp,l) \
367 d2i_ASN1_type_bytes((ASN1_STRING **)a,pp,l, \
368 B_ASN1_VISIBLESTRING| \
369 B_ASN1_BMPSTRING|\
370 B_ASN1_UTF8STRING)
371
372#define ASN1_PRINTABLESTRING_new() (ASN1_PRINTABLESTRING *)\
354 ASN1_STRING_type_new(V_ASN1_PRINTABLESTRING) 373 ASN1_STRING_type_new(V_ASN1_PRINTABLESTRING)
355#define ASN1_PRINTABLESTRING_free(a) ASN1_STRING_free((ASN1_STRING *)a) 374#define ASN1_PRINTABLESTRING_free(a) ASN1_STRING_free((ASN1_STRING *)a)
356#define M_i2d_ASN1_PRINTABLESTRING(a,pp) \ 375#define M_i2d_ASN1_PRINTABLESTRING(a,pp) \
@@ -373,6 +392,8 @@ typedef struct asn1_header_st
373#define ASN1_IA5STRING_new() (ASN1_IA5STRING *)\ 392#define ASN1_IA5STRING_new() (ASN1_IA5STRING *)\
374 ASN1_STRING_type_new(V_ASN1_IA5STRING) 393 ASN1_STRING_type_new(V_ASN1_IA5STRING)
375#define ASN1_IA5STRING_free(a) ASN1_STRING_free((ASN1_STRING *)a) 394#define ASN1_IA5STRING_free(a) ASN1_STRING_free((ASN1_STRING *)a)
395#define ASN1_IA5STRING_dup(a) \
396 (ASN1_IA5STRING *)ASN1_STRING_dup((ASN1_STRING *)a)
376#define M_i2d_ASN1_IA5STRING(a,pp) \ 397#define M_i2d_ASN1_IA5STRING(a,pp) \
377 i2d_ASN1_bytes((ASN1_STRING *)a,pp,V_ASN1_IA5STRING,\ 398 i2d_ASN1_bytes((ASN1_STRING *)a,pp,V_ASN1_IA5STRING,\
378 V_ASN1_UNIVERSAL) 399 V_ASN1_UNIVERSAL)
@@ -392,12 +413,22 @@ typedef struct asn1_header_st
392#define ASN1_GENERALIZEDTIME_new() (ASN1_GENERALIZEDTIME *)\ 413#define ASN1_GENERALIZEDTIME_new() (ASN1_GENERALIZEDTIME *)\
393 ASN1_STRING_type_new(V_ASN1_GENERALIZEDTIME) 414 ASN1_STRING_type_new(V_ASN1_GENERALIZEDTIME)
394#define ASN1_GENERALIZEDTIME_free(a) ASN1_STRING_free((ASN1_STRING *)a) 415#define ASN1_GENERALIZEDTIME_free(a) ASN1_STRING_free((ASN1_STRING *)a)
395#define ASN1_GENERALIZEDTIME_dup(a) (ASN1_UTCTIME *)ASN1_STRING_dup(\ 416#define ASN1_GENERALIZEDTIME_dup(a) (ASN1_GENERALIZEDTIME *)ASN1_STRING_dup(\
396 (ASN1_STRING *)a) 417 (ASN1_STRING *)a)
397/* DOES NOT EXIST YET i2d_ASN1_GENERALIZEDTIME() is a function */ 418/* i2d_ASN1_GENERALIZEDTIME() is a function */
398/* DOES NOT EXIST YET d2i_ASN1_GENERALIZEDTIME() is a function */ 419/* d2i_ASN1_GENERALIZEDTIME() is a function */
399/* DOES NOT EXIST YET ASN1_GENERALIZEDTIME_set() is a function */ 420/* ASN1_GENERALIZEDTIME_set() is a function */
400/* DOES NOT EXIST YET ASN1_GENERALIZEDTIME_check() is a function */ 421/* ASN1_GENERALIZEDTIME_check() is a function */
422
423#define ASN1_TIME_new() (ASN1_TIME *)\
424 ASN1_STRING_type_new(V_ASN1_UTCTIME)
425#define ASN1_TIME_free(a) ASN1_STRING_free((ASN1_STRING *)a)
426#define ASN1_TIME_dup(a) (ASN1_TIME *)ASN1_STRING_dup((ASN1_STRING *)a)
427
428/* i2d_ASN1_TIME() is a function */
429/* d2i_ASN1_TIME() is a function */
430/* ASN1_TIME_set() is a function */
431/* ASN1_TIME_check() is a function */
401 432
402#define ASN1_GENERALSTRING_new() (ASN1_GENERALSTRING *)\ 433#define ASN1_GENERALSTRING_new() (ASN1_GENERALSTRING *)\
403 ASN1_STRING_type_new(V_ASN1_GENERALSTRING) 434 ASN1_STRING_type_new(V_ASN1_GENERALSTRING)
@@ -429,13 +460,36 @@ typedef struct asn1_header_st
429 (ASN1_BMPSTRING *)d2i_ASN1_type_bytes\ 460 (ASN1_BMPSTRING *)d2i_ASN1_type_bytes\
430 ((ASN1_STRING **)a,pp,l,B_ASN1_BMPSTRING) 461 ((ASN1_STRING **)a,pp,l,B_ASN1_BMPSTRING)
431 462
432#ifndef NOPROTO 463#define ASN1_VISIBLESTRING_new() (ASN1_VISIBLESTRING *)\
464 ASN1_STRING_type_new(V_ASN1_VISIBLESTRING)
465#define ASN1_VISIBLESTRING_free(a) ASN1_STRING_free((ASN1_STRING *)a)
466#define M_i2d_ASN1_VISIBLESTRING(a,pp) \
467 i2d_ASN1_bytes((ASN1_STRING *)a,pp,V_ASN1_VISIBLESTRING,\
468 V_ASN1_UNIVERSAL)
469#define M_d2i_ASN1_VISIBLESTRING(a,pp,l) \
470 (ASN1_VISIBLESTRING *)d2i_ASN1_type_bytes\
471 ((ASN1_STRING **)a,pp,l,B_ASN1_VISIBLESTRING)
472
473#define ASN1_UTF8STRING_new() (ASN1_UTF8STRING *)\
474 ASN1_STRING_type_new(V_ASN1_UTF8STRING)
475#define ASN1_UTF8STRING_free(a) ASN1_STRING_free((ASN1_STRING *)a)
476#define M_i2d_ASN1_UTF8STRING(a,pp) \
477 i2d_ASN1_bytes((ASN1_STRING *)a,pp,V_ASN1_UTF8STRING,\
478 V_ASN1_UNIVERSAL)
479#define M_d2i_ASN1_UTF8STRING(a,pp,l) \
480 (ASN1_UTF8STRING *)d2i_ASN1_type_bytes\
481 ((ASN1_STRING **)a,pp,l,B_ASN1_UTF8STRING)
482
483 /* for the is_set parameter to i2d_ASN1_SET */
484#define IS_SEQUENCE 0
485#define IS_SET 1
486
433ASN1_TYPE * ASN1_TYPE_new(void ); 487ASN1_TYPE * ASN1_TYPE_new(void );
434void ASN1_TYPE_free(ASN1_TYPE *a); 488void ASN1_TYPE_free(ASN1_TYPE *a);
435int i2d_ASN1_TYPE(ASN1_TYPE *a,unsigned char **pp); 489int i2d_ASN1_TYPE(ASN1_TYPE *a,unsigned char **pp);
436ASN1_TYPE * d2i_ASN1_TYPE(ASN1_TYPE **a,unsigned char **pp,long length); 490ASN1_TYPE * d2i_ASN1_TYPE(ASN1_TYPE **a,unsigned char **pp,long length);
437int ASN1_TYPE_get(ASN1_TYPE *a); 491int ASN1_TYPE_get(ASN1_TYPE *a);
438void ASN1_TYPE_set(ASN1_TYPE *a, int type, char *value); 492void ASN1_TYPE_set(ASN1_TYPE *a, int type, void *value);
439 493
440ASN1_OBJECT * ASN1_OBJECT_new(void ); 494ASN1_OBJECT * ASN1_OBJECT_new(void );
441void ASN1_OBJECT_free(ASN1_OBJECT *a); 495void ASN1_OBJECT_free(ASN1_OBJECT *a);
@@ -443,12 +497,17 @@ int i2d_ASN1_OBJECT(ASN1_OBJECT *a,unsigned char **pp);
443ASN1_OBJECT * d2i_ASN1_OBJECT(ASN1_OBJECT **a,unsigned char **pp, 497ASN1_OBJECT * d2i_ASN1_OBJECT(ASN1_OBJECT **a,unsigned char **pp,
444 long length); 498 long length);
445 499
500DECLARE_STACK_OF(ASN1_OBJECT)
501DECLARE_ASN1_SET_OF(ASN1_OBJECT)
502
446ASN1_STRING * ASN1_STRING_new(void ); 503ASN1_STRING * ASN1_STRING_new(void );
447void ASN1_STRING_free(ASN1_STRING *a); 504void ASN1_STRING_free(ASN1_STRING *a);
448ASN1_STRING * ASN1_STRING_dup(ASN1_STRING *a); 505ASN1_STRING * ASN1_STRING_dup(ASN1_STRING *a);
449ASN1_STRING * ASN1_STRING_type_new(int type ); 506ASN1_STRING * ASN1_STRING_type_new(int type );
450int ASN1_STRING_cmp(ASN1_STRING *a, ASN1_STRING *b); 507int ASN1_STRING_cmp(ASN1_STRING *a, ASN1_STRING *b);
451int ASN1_STRING_set(ASN1_STRING *str,unsigned char *data, int len); 508 /* Since this is used to store all sorts of things, via macros, for now, make
509 its data void * */
510int ASN1_STRING_set(ASN1_STRING *str, const void *data, int len);
452 511
453int i2d_ASN1_BIT_STRING(ASN1_BIT_STRING *a,unsigned char **pp); 512int i2d_ASN1_BIT_STRING(ASN1_BIT_STRING *a,unsigned char **pp);
454ASN1_BIT_STRING *d2i_ASN1_BIT_STRING(ASN1_BIT_STRING **a,unsigned char **pp, 513ASN1_BIT_STRING *d2i_ASN1_BIT_STRING(ASN1_BIT_STRING **a,unsigned char **pp,
@@ -463,21 +522,50 @@ int d2i_ASN1_BOOLEAN(int *a,unsigned char **pp,long length);
463int i2d_ASN1_INTEGER(ASN1_INTEGER *a,unsigned char **pp); 522int i2d_ASN1_INTEGER(ASN1_INTEGER *a,unsigned char **pp);
464ASN1_INTEGER *d2i_ASN1_INTEGER(ASN1_INTEGER **a,unsigned char **pp, 523ASN1_INTEGER *d2i_ASN1_INTEGER(ASN1_INTEGER **a,unsigned char **pp,
465 long length); 524 long length);
525ASN1_INTEGER *d2i_ASN1_UINTEGER(ASN1_INTEGER **a,unsigned char **pp,
526 long length);
527
528int i2d_ASN1_ENUMERATED(ASN1_ENUMERATED *a,unsigned char **pp);
529ASN1_ENUMERATED *d2i_ASN1_ENUMERATED(ASN1_ENUMERATED **a,unsigned char **pp,
530 long length);
466 531
467int ASN1_UTCTIME_check(ASN1_UTCTIME *a); 532int ASN1_UTCTIME_check(ASN1_UTCTIME *a);
468ASN1_UTCTIME *ASN1_UTCTIME_set(ASN1_UTCTIME *s,time_t t); 533ASN1_UTCTIME *ASN1_UTCTIME_set(ASN1_UTCTIME *s,time_t t);
469int ASN1_UTCTIME_set_string(ASN1_UTCTIME *s, char *str); 534int ASN1_UTCTIME_set_string(ASN1_UTCTIME *s, char *str);
470 535
536int ASN1_GENERALIZEDTIME_check(ASN1_GENERALIZEDTIME *a);
537ASN1_GENERALIZEDTIME *ASN1_GENERALIZEDTIME_set(ASN1_GENERALIZEDTIME *s,time_t t);
538int ASN1_GENERALIZEDTIME_set_string(ASN1_GENERALIZEDTIME *s, char *str);
539
471int i2d_ASN1_OCTET_STRING(ASN1_OCTET_STRING *a,unsigned char **pp); 540int i2d_ASN1_OCTET_STRING(ASN1_OCTET_STRING *a,unsigned char **pp);
472ASN1_OCTET_STRING *d2i_ASN1_OCTET_STRING(ASN1_OCTET_STRING **a, 541ASN1_OCTET_STRING *d2i_ASN1_OCTET_STRING(ASN1_OCTET_STRING **a,
473 unsigned char **pp,long length); 542 unsigned char **pp,long length);
474 543
544int i2d_ASN1_VISIBLESTRING(ASN1_VISIBLESTRING *a,unsigned char **pp);
545ASN1_VISIBLESTRING *d2i_ASN1_VISIBLESTRING(ASN1_VISIBLESTRING **a,
546 unsigned char **pp,long length);
547
548int i2d_ASN1_UTF8STRING(ASN1_UTF8STRING *a,unsigned char **pp);
549ASN1_UTF8STRING *d2i_ASN1_UTF8STRING(ASN1_UTF8STRING **a,
550 unsigned char **pp,long length);
551
552int i2d_ASN1_BMPSTRING(ASN1_BMPSTRING *a, unsigned char **pp);
553ASN1_BMPSTRING *d2i_ASN1_BMPSTRING(ASN1_BMPSTRING **a, unsigned char **pp,
554 long length);
555
475int i2d_ASN1_PRINTABLE(ASN1_STRING *a,unsigned char **pp); 556int i2d_ASN1_PRINTABLE(ASN1_STRING *a,unsigned char **pp);
476ASN1_STRING *d2i_ASN1_PRINTABLE(ASN1_STRING **a, 557ASN1_STRING *d2i_ASN1_PRINTABLE(ASN1_STRING **a,
477 unsigned char **pp, long l); 558 unsigned char **pp, long l);
478ASN1_PRINTABLESTRING *d2i_ASN1_PRINTABLESTRING(ASN1_PRINTABLESTRING **a, 559ASN1_PRINTABLESTRING *d2i_ASN1_PRINTABLESTRING(ASN1_PRINTABLESTRING **a,
479 unsigned char **pp, long l); 560 unsigned char **pp, long l);
480 561
562int i2d_DIRECTORYSTRING(ASN1_STRING *a,unsigned char **pp);
563ASN1_STRING *d2i_DIRECTORYSTRING(ASN1_STRING **a, unsigned char **pp,
564 long length);
565
566int i2d_DISPLAYTEXT(ASN1_STRING *a,unsigned char **pp);
567ASN1_STRING *d2i_DISPLAYTEXT(ASN1_STRING **a, unsigned char **pp, long length);
568
481ASN1_T61STRING *d2i_ASN1_T61STRING(ASN1_T61STRING **a, 569ASN1_T61STRING *d2i_ASN1_T61STRING(ASN1_T61STRING **a,
482 unsigned char **pp, long l); 570 unsigned char **pp, long l);
483int i2d_ASN1_IA5STRING(ASN1_IA5STRING *a,unsigned char **pp); 571int i2d_ASN1_IA5STRING(ASN1_IA5STRING *a,unsigned char **pp);
@@ -488,21 +576,32 @@ int i2d_ASN1_UTCTIME(ASN1_UTCTIME *a,unsigned char **pp);
488ASN1_UTCTIME * d2i_ASN1_UTCTIME(ASN1_UTCTIME **a,unsigned char **pp, 576ASN1_UTCTIME * d2i_ASN1_UTCTIME(ASN1_UTCTIME **a,unsigned char **pp,
489 long length); 577 long length);
490 578
579int i2d_ASN1_GENERALIZEDTIME(ASN1_GENERALIZEDTIME *a,unsigned char **pp);
580ASN1_GENERALIZEDTIME * d2i_ASN1_GENERALIZEDTIME(ASN1_GENERALIZEDTIME **a,unsigned char **pp,
581 long length);
582
583int i2d_ASN1_TIME(ASN1_TIME *a,unsigned char **pp);
584ASN1_TIME * d2i_ASN1_TIME(ASN1_TIME **a,unsigned char **pp, long length);
585ASN1_TIME *ASN1_TIME_set(ASN1_TIME *s,time_t t);
586
491int i2d_ASN1_SET(STACK *a, unsigned char **pp, 587int i2d_ASN1_SET(STACK *a, unsigned char **pp,
492 int (*func)(), int ex_tag, int ex_class); 588 int (*func)(), int ex_tag, int ex_class, int is_set);
493STACK * d2i_ASN1_SET(STACK **a, unsigned char **pp, long length, 589STACK * d2i_ASN1_SET(STACK **a, unsigned char **pp, long length,
494 char *(*func)(), int ex_tag, int ex_class); 590 char *(*func)(), void (*free_func)(),
591 int ex_tag, int ex_class);
495 592
496#ifdef HEADER_BIO_H 593#ifdef HEADER_BIO_H
497int i2a_ASN1_INTEGER(BIO *bp, ASN1_INTEGER *a); 594int i2a_ASN1_INTEGER(BIO *bp, ASN1_INTEGER *a);
498int a2i_ASN1_INTEGER(BIO *bp,ASN1_INTEGER *bs,char *buf,int size); 595int a2i_ASN1_INTEGER(BIO *bp,ASN1_INTEGER *bs,char *buf,int size);
596int i2a_ASN1_ENUMERATED(BIO *bp, ASN1_ENUMERATED *a);
597int a2i_ASN1_ENUMERATED(BIO *bp,ASN1_ENUMERATED *bs,char *buf,int size);
499int i2a_ASN1_OBJECT(BIO *bp,ASN1_OBJECT *a); 598int i2a_ASN1_OBJECT(BIO *bp,ASN1_OBJECT *a);
500int a2i_ASN1_STRING(BIO *bp,ASN1_STRING *bs,char *buf,int size); 599int a2i_ASN1_STRING(BIO *bp,ASN1_STRING *bs,char *buf,int size);
501int i2a_ASN1_STRING(BIO *bp, ASN1_STRING *a, int type); 600int i2a_ASN1_STRING(BIO *bp, ASN1_STRING *a, int type);
502#endif 601#endif
503int i2t_ASN1_OBJECT(char *buf,int buf_len,ASN1_OBJECT *a); 602int i2t_ASN1_OBJECT(char *buf,int buf_len,ASN1_OBJECT *a);
504 603
505int a2d_ASN1_OBJECT(unsigned char *out,int olen, char *buf, int num); 604int a2d_ASN1_OBJECT(unsigned char *out,int olen, const char *buf, int num);
506ASN1_OBJECT *ASN1_OBJECT_create(int nid, unsigned char *data,int len, 605ASN1_OBJECT *ASN1_OBJECT_create(int nid, unsigned char *data,int len,
507 char *sn, char *ln); 606 char *sn, char *ln);
508 607
@@ -511,6 +610,11 @@ long ASN1_INTEGER_get(ASN1_INTEGER *a);
511ASN1_INTEGER *BN_to_ASN1_INTEGER(BIGNUM *bn, ASN1_INTEGER *ai); 610ASN1_INTEGER *BN_to_ASN1_INTEGER(BIGNUM *bn, ASN1_INTEGER *ai);
512BIGNUM *ASN1_INTEGER_to_BN(ASN1_INTEGER *ai,BIGNUM *bn); 611BIGNUM *ASN1_INTEGER_to_BN(ASN1_INTEGER *ai,BIGNUM *bn);
513 612
613int ASN1_ENUMERATED_set(ASN1_ENUMERATED *a, long v);
614long ASN1_ENUMERATED_get(ASN1_ENUMERATED *a);
615ASN1_ENUMERATED *BN_to_ASN1_ENUMERATED(BIGNUM *bn, ASN1_ENUMERATED *ai);
616BIGNUM *ASN1_ENUMERATED_to_BN(ASN1_ENUMERATED *ai,BIGNUM *bn);
617
514/* General */ 618/* General */
515/* given a string, return the correct type, max is the maximum length */ 619/* given a string, return the correct type, max is the maximum length */
516int ASN1_PRINTABLE_type(unsigned char *s, int max); 620int ASN1_PRINTABLE_type(unsigned char *s, int max);
@@ -545,6 +649,8 @@ int ASN1_i2d_fp(int (*i2d)(),FILE *out,unsigned char *x);
545char *ASN1_d2i_bio(char *(*xnew)(),char *(*d2i)(),BIO *bp,unsigned char **x); 649char *ASN1_d2i_bio(char *(*xnew)(),char *(*d2i)(),BIO *bp,unsigned char **x);
546int ASN1_i2d_bio(int (*i2d)(),BIO *out,unsigned char *x); 650int ASN1_i2d_bio(int (*i2d)(),BIO *out,unsigned char *x);
547int ASN1_UTCTIME_print(BIO *fp,ASN1_UTCTIME *a); 651int ASN1_UTCTIME_print(BIO *fp,ASN1_UTCTIME *a);
652int ASN1_GENERALIZEDTIME_print(BIO *fp,ASN1_GENERALIZEDTIME *a);
653int ASN1_TIME_print(BIO *fp,ASN1_TIME *a);
548int ASN1_STRING_print(BIO *bp,ASN1_STRING *v); 654int ASN1_STRING_print(BIO *bp,ASN1_STRING *v);
549int ASN1_parse(BIO *bp,unsigned char *pp,long len,int indent); 655int ASN1_parse(BIO *bp,unsigned char *pp,long len,int indent);
550#endif 656#endif
@@ -574,111 +680,32 @@ int ASN1_TYPE_set_int_octetstring(ASN1_TYPE *a, long num,
574int ASN1_TYPE_get_int_octetstring(ASN1_TYPE *a,long *num, 680int ASN1_TYPE_get_int_octetstring(ASN1_TYPE *a,long *num,
575 unsigned char *data, int max_len); 681 unsigned char *data, int max_len);
576 682
577#else 683STACK *ASN1_seq_unpack(unsigned char *buf, int len, char *(*d2i)(),
578 684 void (*free_func)() );
579ASN1_TYPE * ASN1_TYPE_new(); 685unsigned char *ASN1_seq_pack(STACK *safes, int (*i2d)(), unsigned char **buf,
580void ASN1_TYPE_free(); 686 int *len );
581int i2d_ASN1_TYPE(); 687void *ASN1_unpack_string(ASN1_STRING *oct, char *(*d2i)());
582ASN1_TYPE * d2i_ASN1_TYPE(); 688ASN1_STRING *ASN1_pack_string(void *obj, int (*i2d)(), ASN1_OCTET_STRING **oct);
583int ASN1_TYPE_get();
584void ASN1_TYPE_set();
585
586ASN1_OBJECT * ASN1_OBJECT_new();
587void ASN1_OBJECT_free();
588int i2d_ASN1_OBJECT();
589ASN1_OBJECT * d2i_ASN1_OBJECT();
590ASN1_STRING * ASN1_STRING_new();
591void ASN1_STRING_free();
592ASN1_STRING * ASN1_STRING_dup();
593ASN1_STRING * ASN1_STRING_type_new();
594int ASN1_STRING_cmp();
595int ASN1_STRING_set();
596int i2d_ASN1_BIT_STRING();
597ASN1_BIT_STRING *d2i_ASN1_BIT_STRING();
598int ASN1_BIT_STRING_set_bit();
599int ASN1_BIT_STRING_get_bit();
600int i2d_ASN1_BOOLEAN();
601int d2i_ASN1_BOOLEAN();
602int i2d_ASN1_INTEGER();
603ASN1_INTEGER *d2i_ASN1_INTEGER();
604int ASN1_UTCTIME_check();
605ASN1_UTCTIME *ASN1_UTCTIME_set();
606int ASN1_UTCTIME_set_string();
607int i2d_ASN1_OCTET_STRING();
608ASN1_OCTET_STRING *d2i_ASN1_OCTET_STRING();
609int i2d_ASN1_PRINTABLE();
610ASN1_STRING *d2i_ASN1_PRINTABLE();
611ASN1_PRINTABLESTRING *d2i_ASN1_PRINTABLESTRING();
612ASN1_T61STRING *d2i_ASN1_T61STRING();
613int i2d_ASN1_IA5STRING();
614ASN1_IA5STRING *d2i_ASN1_IA5STRING();
615int i2d_ASN1_UTCTIME();
616ASN1_UTCTIME * d2i_ASN1_UTCTIME();
617int i2d_ASN1_SET();
618STACK * d2i_ASN1_SET();
619int a2d_ASN1_OBJECT();
620ASN1_OBJECT *ASN1_OBJECT_create();
621int ASN1_INTEGER_set();
622long ASN1_INTEGER_get();
623ASN1_INTEGER *BN_to_ASN1_INTEGER();
624BIGNUM *ASN1_INTEGER_to_BN();
625int ASN1_PRINTABLE_type();
626int i2d_ASN1_bytes();
627ASN1_STRING *d2i_ASN1_bytes();
628ASN1_STRING *d2i_ASN1_type_bytes();
629int asn1_Finish();
630int ASN1_get_object();
631int ASN1_check_infinite_end();
632void ASN1_put_object();
633int ASN1_object_size();
634char *ASN1_dup();
635#ifndef NO_FP_API
636char *ASN1_d2i_fp();
637int ASN1_i2d_fp();
638#endif
639
640char *ASN1_d2i_bio();
641int ASN1_i2d_bio();
642int ASN1_UTCTIME_print();
643int ASN1_STRING_print();
644int ASN1_parse();
645int i2a_ASN1_INTEGER();
646int a2i_ASN1_INTEGER();
647int i2a_ASN1_OBJECT();
648int i2t_ASN1_OBJECT();
649int a2i_ASN1_STRING();
650int i2a_ASN1_STRING();
651
652int i2d_ASN1_HEADER();
653ASN1_HEADER *d2i_ASN1_HEADER();
654ASN1_HEADER *ASN1_HEADER_new();
655void ASN1_HEADER_free();
656void ERR_load_ASN1_strings();
657ASN1_METHOD *X509_asn1_meth();
658ASN1_METHOD *RSAPrivateKey_asn1_meth();
659ASN1_METHOD *ASN1_IA5STRING_asn1_meth();
660ASN1_METHOD *ASN1_BIT_STRING_asn1_meth();
661
662int ASN1_UNIVERSALSTRING_to_string();
663
664int ASN1_TYPE_set_octetstring();
665int ASN1_TYPE_get_octetstring();
666int ASN1_TYPE_set_int_octetstring();
667int ASN1_TYPE_get_int_octetstring();
668
669#endif
670 689
671/* BEGIN ERROR CODES */ 690/* BEGIN ERROR CODES */
691/* The following lines are auto generated by the script mkerr.pl. Any changes
692 * made after this point may be overwritten when the script is next run.
693 */
694
672/* Error codes for the ASN1 functions. */ 695/* Error codes for the ASN1 functions. */
673 696
674/* Function codes. */ 697/* Function codes. */
675#define ASN1_F_A2D_ASN1_OBJECT 100 698#define ASN1_F_A2D_ASN1_OBJECT 100
699#define ASN1_F_A2I_ASN1_ENUMERATED 236
676#define ASN1_F_A2I_ASN1_INTEGER 101 700#define ASN1_F_A2I_ASN1_INTEGER 101
677#define ASN1_F_A2I_ASN1_STRING 102 701#define ASN1_F_A2I_ASN1_STRING 102
678#define ASN1_F_ASN1_COLLATE_PRIMATIVE 103 702#define ASN1_F_ASN1_COLLATE_PRIMITIVE 103
679#define ASN1_F_ASN1_D2I_BIO 104 703#define ASN1_F_ASN1_D2I_BIO 104
680#define ASN1_F_ASN1_D2I_FP 105 704#define ASN1_F_ASN1_D2I_FP 105
681#define ASN1_F_ASN1_DUP 106 705#define ASN1_F_ASN1_DUP 106
706#define ASN1_F_ASN1_ENUMERATED_SET 232
707#define ASN1_F_ASN1_ENUMERATED_TO_BN 233
708#define ASN1_F_ASN1_GENERALIZEDTIME_NEW 222
682#define ASN1_F_ASN1_GET_OBJECT 107 709#define ASN1_F_ASN1_GET_OBJECT 107
683#define ASN1_F_ASN1_HEADER_NEW 108 710#define ASN1_F_ASN1_HEADER_NEW 108
684#define ASN1_F_ASN1_I2D_BIO 109 711#define ASN1_F_ASN1_I2D_BIO 109
@@ -686,37 +713,65 @@ int ASN1_TYPE_get_int_octetstring();
686#define ASN1_F_ASN1_INTEGER_SET 111 713#define ASN1_F_ASN1_INTEGER_SET 111
687#define ASN1_F_ASN1_INTEGER_TO_BN 112 714#define ASN1_F_ASN1_INTEGER_TO_BN 112
688#define ASN1_F_ASN1_OBJECT_NEW 113 715#define ASN1_F_ASN1_OBJECT_NEW 113
716#define ASN1_F_ASN1_PACK_STRING 245
717#define ASN1_F_ASN1_PBE_SET 253
718#define ASN1_F_ASN1_SEQ_PACK 246
719#define ASN1_F_ASN1_SEQ_UNPACK 247
689#define ASN1_F_ASN1_SIGN 114 720#define ASN1_F_ASN1_SIGN 114
690#define ASN1_F_ASN1_STRING_NEW 115 721#define ASN1_F_ASN1_STRING_NEW 115
691#define ASN1_F_ASN1_STRING_TYPE_NEW 116 722#define ASN1_F_ASN1_STRING_TYPE_NEW 116
692#define ASN1_F_ASN1_TYPE_GET_INT_OCTETSTRING 117 723#define ASN1_F_ASN1_TYPE_GET_INT_OCTETSTRING 117
693#define ASN1_F_ASN1_TYPE_GET_OCTETSTRING 118 724#define ASN1_F_ASN1_TYPE_GET_OCTETSTRING 118
694#define ASN1_F_ASN1_TYPE_NEW 119 725#define ASN1_F_ASN1_TYPE_NEW 119
726#define ASN1_F_ASN1_UNPACK_STRING 248
695#define ASN1_F_ASN1_UTCTIME_NEW 120 727#define ASN1_F_ASN1_UTCTIME_NEW 120
696#define ASN1_F_ASN1_VERIFY 121 728#define ASN1_F_ASN1_VERIFY 121
729#define ASN1_F_AUTHORITY_KEYID_NEW 237
730#define ASN1_F_BASIC_CONSTRAINTS_NEW 226
731#define ASN1_F_BN_TO_ASN1_ENUMERATED 234
697#define ASN1_F_BN_TO_ASN1_INTEGER 122 732#define ASN1_F_BN_TO_ASN1_INTEGER 122
698#define ASN1_F_D2I_ASN1_BIT_STRING 123 733#define ASN1_F_D2I_ASN1_BIT_STRING 123
699#define ASN1_F_D2I_ASN1_BMPSTRING 124 734#define ASN1_F_D2I_ASN1_BMPSTRING 124
700#define ASN1_F_D2I_ASN1_BOOLEAN 125 735#define ASN1_F_D2I_ASN1_BOOLEAN 125
701#define ASN1_F_D2I_ASN1_BYTES 126 736#define ASN1_F_D2I_ASN1_BYTES 126
737#define ASN1_F_D2I_ASN1_ENUMERATED 235
738#define ASN1_F_D2I_ASN1_GENERALIZEDTIME 223
702#define ASN1_F_D2I_ASN1_HEADER 127 739#define ASN1_F_D2I_ASN1_HEADER 127
703#define ASN1_F_D2I_ASN1_INTEGER 128 740#define ASN1_F_D2I_ASN1_INTEGER 128
704#define ASN1_F_D2I_ASN1_OBJECT 129 741#define ASN1_F_D2I_ASN1_OBJECT 129
705#define ASN1_F_D2I_ASN1_OCTET_STRING 130 742#define ASN1_F_D2I_ASN1_OCTET_STRING 130
706#define ASN1_F_D2I_ASN1_PRINT_TYPE 131 743#define ASN1_F_D2I_ASN1_PRINT_TYPE 131
707#define ASN1_F_D2I_ASN1_SET 132 744#define ASN1_F_D2I_ASN1_SET 132
745#define ASN1_F_D2I_ASN1_TIME 224
708#define ASN1_F_D2I_ASN1_TYPE 133 746#define ASN1_F_D2I_ASN1_TYPE 133
709#define ASN1_F_D2I_ASN1_TYPE_BYTES 134 747#define ASN1_F_D2I_ASN1_TYPE_BYTES 134
748#define ASN1_F_D2I_ASN1_UINTEGER 280
710#define ASN1_F_D2I_ASN1_UTCTIME 135 749#define ASN1_F_D2I_ASN1_UTCTIME 135
750#define ASN1_F_D2I_ASN1_UTF8STRING 266
751#define ASN1_F_D2I_ASN1_VISIBLESTRING 267
752#define ASN1_F_D2I_AUTHORITY_KEYID 238
753#define ASN1_F_D2I_BASIC_CONSTRAINTS 227
711#define ASN1_F_D2I_DHPARAMS 136 754#define ASN1_F_D2I_DHPARAMS 136
755#define ASN1_F_D2I_DIST_POINT 276
756#define ASN1_F_D2I_DIST_POINT_NAME 277
712#define ASN1_F_D2I_DSAPARAMS 137 757#define ASN1_F_D2I_DSAPARAMS 137
713#define ASN1_F_D2I_DSAPRIVATEKEY 138 758#define ASN1_F_D2I_DSAPRIVATEKEY 138
714#define ASN1_F_D2I_DSAPUBLICKEY 139 759#define ASN1_F_D2I_DSAPUBLICKEY 139
760#define ASN1_F_D2I_GENERAL_NAME 230
761#define ASN1_F_D2I_NETSCAPE_CERT_SEQUENCE 228
715#define ASN1_F_D2I_NETSCAPE_PKEY 140 762#define ASN1_F_D2I_NETSCAPE_PKEY 140
716#define ASN1_F_D2I_NETSCAPE_RSA 141 763#define ASN1_F_D2I_NETSCAPE_RSA 141
717#define ASN1_F_D2I_NETSCAPE_RSA_2 142 764#define ASN1_F_D2I_NETSCAPE_RSA_2 142
718#define ASN1_F_D2I_NETSCAPE_SPKAC 143 765#define ASN1_F_D2I_NETSCAPE_SPKAC 143
719#define ASN1_F_D2I_NETSCAPE_SPKI 144 766#define ASN1_F_D2I_NETSCAPE_SPKI 144
767#define ASN1_F_D2I_NOTICEREF 268
768#define ASN1_F_D2I_PBE2PARAM 262
769#define ASN1_F_D2I_PBEPARAM 249
770#define ASN1_F_D2I_PBKDF2PARAM 263
771#define ASN1_F_D2I_PKCS12 254
772#define ASN1_F_D2I_PKCS12_BAGS 255
773#define ASN1_F_D2I_PKCS12_MAC_DATA 256
774#define ASN1_F_D2I_PKCS12_SAFEBAG 257
720#define ASN1_F_D2I_PKCS7 145 775#define ASN1_F_D2I_PKCS7 145
721#define ASN1_F_D2I_PKCS7_DIGEST 146 776#define ASN1_F_D2I_PKCS7_DIGEST 146
722#define ASN1_F_D2I_PKCS7_ENCRYPT 147 777#define ASN1_F_D2I_PKCS7_ENCRYPT 147
@@ -727,10 +782,17 @@ int ASN1_TYPE_get_int_octetstring();
727#define ASN1_F_D2I_PKCS7_SIGNED 152 782#define ASN1_F_D2I_PKCS7_SIGNED 152
728#define ASN1_F_D2I_PKCS7_SIGNER_INFO 153 783#define ASN1_F_D2I_PKCS7_SIGNER_INFO 153
729#define ASN1_F_D2I_PKCS7_SIGN_ENVELOPE 154 784#define ASN1_F_D2I_PKCS7_SIGN_ENVELOPE 154
785#define ASN1_F_D2I_PKCS8_PRIV_KEY_INFO 250
786#define ASN1_F_D2I_PKEY_USAGE_PERIOD 239
787#define ASN1_F_D2I_POLICYINFO 269
788#define ASN1_F_D2I_POLICYQUALINFO 270
730#define ASN1_F_D2I_PRIVATEKEY 155 789#define ASN1_F_D2I_PRIVATEKEY 155
731#define ASN1_F_D2I_PUBLICKEY 156 790#define ASN1_F_D2I_PUBLICKEY 156
732#define ASN1_F_D2I_RSAPRIVATEKEY 157 791#define ASN1_F_D2I_RSAPRIVATEKEY 157
733#define ASN1_F_D2I_RSAPUBLICKEY 158 792#define ASN1_F_D2I_RSAPUBLICKEY 158
793#define ASN1_F_D2I_SXNET 241
794#define ASN1_F_D2I_SXNETID 243
795#define ASN1_F_D2I_USERNOTICE 271
734#define ASN1_F_D2I_X509 159 796#define ASN1_F_D2I_X509 159
735#define ASN1_F_D2I_X509_ALGOR 160 797#define ASN1_F_D2I_X509_ALGOR 160
736#define ASN1_F_D2I_X509_ATTRIBUTE 161 798#define ASN1_F_D2I_X509_ATTRIBUTE 161
@@ -748,7 +810,11 @@ int ASN1_TYPE_get_int_octetstring();
748#define ASN1_F_D2I_X509_REVOKED 173 810#define ASN1_F_D2I_X509_REVOKED 173
749#define ASN1_F_D2I_X509_SIG 174 811#define ASN1_F_D2I_X509_SIG 174
750#define ASN1_F_D2I_X509_VAL 175 812#define ASN1_F_D2I_X509_VAL 175
813#define ASN1_F_DIST_POINT_NAME_NEW 278
814#define ASN1_F_DIST_POINT_NEW 279
815#define ASN1_F_GENERAL_NAME_NEW 231
751#define ASN1_F_I2D_ASN1_HEADER 176 816#define ASN1_F_I2D_ASN1_HEADER 176
817#define ASN1_F_I2D_ASN1_TIME 225
752#define ASN1_F_I2D_DHPARAMS 177 818#define ASN1_F_I2D_DHPARAMS 177
753#define ASN1_F_I2D_DSAPARAMS 178 819#define ASN1_F_I2D_DSAPARAMS 178
754#define ASN1_F_I2D_DSAPRIVATEKEY 179 820#define ASN1_F_I2D_DSAPRIVATEKEY 179
@@ -761,9 +827,19 @@ int ASN1_TYPE_get_int_octetstring();
761#define ASN1_F_I2D_RSAPUBLICKEY 186 827#define ASN1_F_I2D_RSAPUBLICKEY 186
762#define ASN1_F_I2D_X509_ATTRIBUTE 187 828#define ASN1_F_I2D_X509_ATTRIBUTE 187
763#define ASN1_F_I2T_ASN1_OBJECT 188 829#define ASN1_F_I2T_ASN1_OBJECT 188
830#define ASN1_F_NETSCAPE_CERT_SEQUENCE_NEW 229
764#define ASN1_F_NETSCAPE_PKEY_NEW 189 831#define ASN1_F_NETSCAPE_PKEY_NEW 189
765#define ASN1_F_NETSCAPE_SPKAC_NEW 190 832#define ASN1_F_NETSCAPE_SPKAC_NEW 190
766#define ASN1_F_NETSCAPE_SPKI_NEW 191 833#define ASN1_F_NETSCAPE_SPKI_NEW 191
834#define ASN1_F_NOTICEREF_NEW 272
835#define ASN1_F_PBE2PARAM_NEW 264
836#define ASN1_F_PBEPARAM_NEW 251
837#define ASN1_F_PBKDF2PARAM_NEW 265
838#define ASN1_F_PKCS12_BAGS_NEW 258
839#define ASN1_F_PKCS12_MAC_DATA_NEW 259
840#define ASN1_F_PKCS12_NEW 260
841#define ASN1_F_PKCS12_SAFEBAG_NEW 261
842#define ASN1_F_PKCS5_PBE2_SET 281
767#define ASN1_F_PKCS7_DIGEST_NEW 192 843#define ASN1_F_PKCS7_DIGEST_NEW 192
768#define ASN1_F_PKCS7_ENCRYPT_NEW 193 844#define ASN1_F_PKCS7_ENCRYPT_NEW 193
769#define ASN1_F_PKCS7_ENC_CONTENT_NEW 194 845#define ASN1_F_PKCS7_ENC_CONTENT_NEW 194
@@ -774,6 +850,13 @@ int ASN1_TYPE_get_int_octetstring();
774#define ASN1_F_PKCS7_SIGNED_NEW 199 850#define ASN1_F_PKCS7_SIGNED_NEW 199
775#define ASN1_F_PKCS7_SIGNER_INFO_NEW 200 851#define ASN1_F_PKCS7_SIGNER_INFO_NEW 200
776#define ASN1_F_PKCS7_SIGN_ENVELOPE_NEW 201 852#define ASN1_F_PKCS7_SIGN_ENVELOPE_NEW 201
853#define ASN1_F_PKCS8_PRIV_KEY_INFO_NEW 252
854#define ASN1_F_PKEY_USAGE_PERIOD_NEW 240
855#define ASN1_F_POLICYINFO_NEW 273
856#define ASN1_F_POLICYQUALINFO_NEW 274
857#define ASN1_F_SXNETID_NEW 244
858#define ASN1_F_SXNET_NEW 242
859#define ASN1_F_USERNOTICE_NEW 275
777#define ASN1_F_X509_ALGOR_NEW 202 860#define ASN1_F_X509_ALGOR_NEW 202
778#define ASN1_F_X509_ATTRIBUTE_NEW 203 861#define ASN1_F_X509_ATTRIBUTE_NEW 203
779#define ASN1_F_X509_CINF_NEW 204 862#define ASN1_F_X509_CINF_NEW 204
@@ -797,61 +880,64 @@ int ASN1_TYPE_get_int_octetstring();
797 880
798/* Reason codes. */ 881/* Reason codes. */
799#define ASN1_R_BAD_CLASS 100 882#define ASN1_R_BAD_CLASS 100
800#define ASN1_R_BAD_GET_OBJECT 101 883#define ASN1_R_BAD_OBJECT_HEADER 101
801#define ASN1_R_BAD_OBJECT_HEADER 102 884#define ASN1_R_BAD_PASSWORD_READ 102
802#define ASN1_R_BAD_PASSWORD_READ 103 885#define ASN1_R_BAD_PKCS7_CONTENT 103
803#define ASN1_R_BAD_PKCS7_CONTENT 104 886#define ASN1_R_BAD_PKCS7_TYPE 104
804#define ASN1_R_BAD_PKCS7_TYPE 105 887#define ASN1_R_BAD_TAG 105
805#define ASN1_R_BAD_TAG 106 888#define ASN1_R_BAD_TYPE 106
806#define ASN1_R_BAD_TYPE 107 889#define ASN1_R_BN_LIB 107
807#define ASN1_R_BN_LIB 108 890#define ASN1_R_BOOLEAN_IS_WRONG_LENGTH 108
808#define ASN1_R_BOOLEAN_IS_WRONG_LENGTH 109 891#define ASN1_R_BUFFER_TOO_SMALL 109
809#define ASN1_R_BUFFER_TOO_SMALL 110 892#define ASN1_R_DATA_IS_WRONG 110
810#define ASN1_R_DATA_IS_WRONG 111 893#define ASN1_R_DECODE_ERROR 155
811#define ASN1_R_DECODING_ERROR 112 894#define ASN1_R_DECODING_ERROR 111
812#define ASN1_R_ERROR_STACK 113 895#define ASN1_R_ENCODE_ERROR 156
813#define ASN1_R_EXPECTING_AN_INTEGER 114 896#define ASN1_R_ERROR_PARSING_SET_ELEMENT 112
814#define ASN1_R_EXPECTING_AN_OBJECT 115 897#define ASN1_R_ERROR_SETTING_CIPHER_PARAMS 157
815#define ASN1_R_EXPECTING_AN_OCTET_STRING 116 898#define ASN1_R_EXPECTING_AN_ENUMERATED 154
816#define ASN1_R_EXPECTING_A_BIT_STRING 117 899#define ASN1_R_EXPECTING_AN_INTEGER 113
817#define ASN1_R_EXPECTING_A_BOOLEAN 118 900#define ASN1_R_EXPECTING_AN_OBJECT 114
818#define ASN1_R_EXPECTING_A_SEQUENCE 119 901#define ASN1_R_EXPECTING_AN_OCTET_STRING 115
819#define ASN1_R_EXPECTING_A_UTCTIME 120 902#define ASN1_R_EXPECTING_A_BIT_STRING 116
820#define ASN1_R_FIRST_NUM_TOO_LARGE 121 903#define ASN1_R_EXPECTING_A_BOOLEAN 117
821#define ASN1_R_HEADER_TOO_LONG 122 904#define ASN1_R_EXPECTING_A_GENERALIZEDTIME 151
822#define ASN1_R_INVALID_DIGIT 123 905#define ASN1_R_EXPECTING_A_TIME 152
823#define ASN1_R_INVALID_SEPARATOR 124 906#define ASN1_R_EXPECTING_A_UTCTIME 118
824#define ASN1_R_INVALID_TIME_FORMAT 125 907#define ASN1_R_FIRST_NUM_TOO_LARGE 119
825#define ASN1_R_IV_TOO_LARGE 126 908#define ASN1_R_GENERALIZEDTIME_TOO_LONG 153
826#define ASN1_R_LENGTH_ERROR 127 909#define ASN1_R_HEADER_TOO_LONG 120
827#define ASN1_R_LENGTH_MISMATCH 128 910#define ASN1_R_INVALID_DIGIT 121
828#define ASN1_R_MISSING_EOS 129 911#define ASN1_R_INVALID_SEPARATOR 122
829#define ASN1_R_MISSING_SECOND_NUMBER 130 912#define ASN1_R_INVALID_TIME_FORMAT 123
830#define ASN1_R_NON_HEX_CHARACTERS 131 913#define ASN1_R_IV_TOO_LARGE 124
831#define ASN1_R_NOT_ENOUGH_DATA 132 914#define ASN1_R_LENGTH_ERROR 125
832#define ASN1_R_ODD_NUMBER_OF_CHARS 133 915#define ASN1_R_MISSING_SECOND_NUMBER 126
833#define ASN1_R_PARSING 134 916#define ASN1_R_NON_HEX_CHARACTERS 127
834#define ASN1_R_PRIVATE_KEY_HEADER_MISSING 135 917#define ASN1_R_NOT_ENOUGH_DATA 128
835#define ASN1_R_SECOND_NUMBER_TOO_LARGE 136 918#define ASN1_R_ODD_NUMBER_OF_CHARS 129
836#define ASN1_R_SHORT_LINE 137 919#define ASN1_R_PARSING 130
837#define ASN1_R_STRING_TOO_SHORT 138 920#define ASN1_R_PRIVATE_KEY_HEADER_MISSING 131
838#define ASN1_R_TAG_VALUE_TOO_HIGH 139 921#define ASN1_R_SECOND_NUMBER_TOO_LARGE 132
839#define ASN1_R_THE_ASN1_OBJECT_IDENTIFIER_IS_NOT_KNOWN_FOR_THIS_MD 140 922#define ASN1_R_SHORT_LINE 133
840#define ASN1_R_TOO_LONG 141 923#define ASN1_R_STRING_TOO_SHORT 134
841#define ASN1_R_UNABLE_TO_DECODE_RSA_KEY 142 924#define ASN1_R_TAG_VALUE_TOO_HIGH 135
842#define ASN1_R_UNABLE_TO_DECODE_RSA_PRIVATE_KEY 143 925#define ASN1_R_THE_ASN1_OBJECT_IDENTIFIER_IS_NOT_KNOWN_FOR_THIS_MD 136
843#define ASN1_R_UNKNOWN_ATTRIBUTE_TYPE 144 926#define ASN1_R_TOO_LONG 137
844#define ASN1_R_UNKNOWN_MESSAGE_DIGEST_ALGORITHM 145 927#define ASN1_R_UNABLE_TO_DECODE_RSA_KEY 138
845#define ASN1_R_UNKNOWN_OBJECT_TYPE 146 928#define ASN1_R_UNABLE_TO_DECODE_RSA_PRIVATE_KEY 139
846#define ASN1_R_UNKNOWN_PUBLIC_KEY_TYPE 147 929#define ASN1_R_UNKNOWN_ATTRIBUTE_TYPE 140
847#define ASN1_R_UNSUPPORTED_CIPHER 148 930#define ASN1_R_UNKNOWN_MESSAGE_DIGEST_ALGORITHM 141
848#define ASN1_R_UNSUPPORTED_ENCRYPTION_ALGORITHM 149 931#define ASN1_R_UNKNOWN_OBJECT_TYPE 142
849#define ASN1_R_UNSUPPORTED_PUBLIC_KEY_TYPE 150 932#define ASN1_R_UNKNOWN_PUBLIC_KEY_TYPE 143
850#define ASN1_R_UTCTIME_TOO_LONG 151 933#define ASN1_R_UNSUPPORTED_CIPHER 144
851#define ASN1_R_WRONG_PRINTABLE_TYPE 152 934#define ASN1_R_UNSUPPORTED_ENCRYPTION_ALGORITHM 145
852#define ASN1_R_WRONG_TAG 153 935#define ASN1_R_UNSUPPORTED_PUBLIC_KEY_TYPE 146
853#define ASN1_R_WRONG_TYPE 154 936#define ASN1_R_UTCTIME_TOO_LONG 147
854 937#define ASN1_R_WRONG_PRINTABLE_TYPE 148
938#define ASN1_R_WRONG_TAG 149
939#define ASN1_R_WRONG_TYPE 150
940
855#ifdef __cplusplus 941#ifdef __cplusplus
856} 942}
857#endif 943#endif
diff --git a/src/lib/libcrypto/asn1/asn1_err.c b/src/lib/libcrypto/asn1/asn1_err.c
index 03c2858e7d..16755a0b05 100644
--- a/src/lib/libcrypto/asn1/asn1_err.c
+++ b/src/lib/libcrypto/asn1/asn1_err.c
@@ -1,75 +1,81 @@
1/* lib/asn1/asn1_err.c */ 1/* crypto/asn1/asn1_err.c */
2/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) 2/* ====================================================================
3 * All rights reserved. 3 * Copyright (c) 1999 The OpenSSL Project. All rights reserved.
4 * 4 *
5 * This package is an SSL implementation written
6 * by Eric Young (eay@cryptsoft.com).
7 * The implementation was written so as to conform with Netscapes SSL.
8 *
9 * This library is free for commercial and non-commercial use as long as
10 * the following conditions are aheared to. The following conditions
11 * apply to all code found in this distribution, be it the RC4, RSA,
12 * lhash, DES, etc., code; not just the SSL code. The SSL documentation
13 * included with this distribution is covered by the same copyright terms
14 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
15 *
16 * Copyright remains Eric Young's, and as such any Copyright notices in
17 * the code are not to be removed.
18 * If this package is used in a product, Eric Young should be given attribution
19 * as the author of the parts of the library used.
20 * This can be in the form of a textual message at program startup or
21 * in documentation (online or textual) provided with the package.
22 *
23 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
24 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
25 * are met: 7 * are met:
26 * 1. Redistributions of source code must retain the copyright 8 *
27 * notice, this list of conditions and the following disclaimer. 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 *
28 * 2. Redistributions in binary form must reproduce the above copyright 12 * 2. Redistributions in binary form must reproduce the above copyright
29 * notice, this list of conditions and the following disclaimer in the 13 * notice, this list of conditions and the following disclaimer in
30 * documentation and/or other materials provided with the distribution. 14 * the documentation and/or other materials provided with the
31 * 3. All advertising materials mentioning features or use of this software 15 * distribution.
32 * must display the following acknowledgement: 16 *
33 * "This product includes cryptographic software written by 17 * 3. All advertising materials mentioning features or use of this
34 * Eric Young (eay@cryptsoft.com)" 18 * software must display the following acknowledgment:
35 * The word 'cryptographic' can be left out if the rouines from the library 19 * "This product includes software developed by the OpenSSL Project
36 * being used are not cryptographic related :-). 20 * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
37 * 4. If you include any Windows specific code (or a derivative thereof) from 21 *
38 * the apps directory (application code) you must include an acknowledgement: 22 * 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)" 23 * endorse or promote products derived from this software without
40 * 24 * prior written permission. For written permission, please contact
41 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND 25 * openssl-core@OpenSSL.org.
42 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 26 *
43 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 27 * 5. Products derived from this software may not be called "OpenSSL"
44 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 28 * nor may "OpenSSL" appear in their names without prior written
45 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 29 * permission of the OpenSSL Project.
46 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 30 *
47 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 31 * 6. Redistributions of any form whatsoever must retain the following
48 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 32 * acknowledgment:
49 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 33 * "This product includes software developed by the OpenSSL Project
50 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 34 * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
51 * SUCH DAMAGE. 35 *
52 * 36 * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
53 * The licence and distribution terms for any publically available version or 37 * 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 38 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
55 * copied and put under another distribution licence 39 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
56 * [including the GNU Public Licence.] 40 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
41 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
42 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
43 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
44 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
45 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
46 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
47 * OF THE POSSIBILITY OF SUCH DAMAGE.
48 * ====================================================================
49 *
50 * This product includes cryptographic software written by Eric Young
51 * (eay@cryptsoft.com). This product includes software written by Tim
52 * Hudson (tjh@cryptsoft.com).
53 *
57 */ 54 */
55
56/* NOTE: this file was auto generated by the mkerr.pl script: any changes
57 * made to it will be overwritten when the script next updates this file.
58 */
59
58#include <stdio.h> 60#include <stdio.h>
59#include "err.h" 61#include <openssl/err.h>
60#include "asn1.h" 62#include <openssl/asn1.h>
61 63
62/* BEGIN ERROR CODES */ 64/* BEGIN ERROR CODES */
63#ifndef NO_ERR 65#ifndef NO_ERR
64static ERR_STRING_DATA ASN1_str_functs[]= 66static ERR_STRING_DATA ASN1_str_functs[]=
65 { 67 {
66{ERR_PACK(0,ASN1_F_A2D_ASN1_OBJECT,0), "a2d_ASN1_OBJECT"}, 68{ERR_PACK(0,ASN1_F_A2D_ASN1_OBJECT,0), "a2d_ASN1_OBJECT"},
69{ERR_PACK(0,ASN1_F_A2I_ASN1_ENUMERATED,0), "a2i_ASN1_ENUMERATED"},
67{ERR_PACK(0,ASN1_F_A2I_ASN1_INTEGER,0), "a2i_ASN1_INTEGER"}, 70{ERR_PACK(0,ASN1_F_A2I_ASN1_INTEGER,0), "a2i_ASN1_INTEGER"},
68{ERR_PACK(0,ASN1_F_A2I_ASN1_STRING,0), "a2i_ASN1_STRING"}, 71{ERR_PACK(0,ASN1_F_A2I_ASN1_STRING,0), "a2i_ASN1_STRING"},
69{ERR_PACK(0,ASN1_F_ASN1_COLLATE_PRIMATIVE,0), "ASN1_COLLATE_PRIMATIVE"}, 72{ERR_PACK(0,ASN1_F_ASN1_COLLATE_PRIMITIVE,0), "ASN1_COLLATE_PRIMITIVE"},
70{ERR_PACK(0,ASN1_F_ASN1_D2I_BIO,0), "ASN1_d2i_bio"}, 73{ERR_PACK(0,ASN1_F_ASN1_D2I_BIO,0), "ASN1_d2i_bio"},
71{ERR_PACK(0,ASN1_F_ASN1_D2I_FP,0), "ASN1_d2i_fp"}, 74{ERR_PACK(0,ASN1_F_ASN1_D2I_FP,0), "ASN1_d2i_fp"},
72{ERR_PACK(0,ASN1_F_ASN1_DUP,0), "ASN1_dup"}, 75{ERR_PACK(0,ASN1_F_ASN1_DUP,0), "ASN1_dup"},
76{ERR_PACK(0,ASN1_F_ASN1_ENUMERATED_SET,0), "ASN1_ENUMERATED_set"},
77{ERR_PACK(0,ASN1_F_ASN1_ENUMERATED_TO_BN,0), "ASN1_ENUMERATED_to_BN"},
78{ERR_PACK(0,ASN1_F_ASN1_GENERALIZEDTIME_NEW,0), "ASN1_GENERALIZEDTIME_NEW"},
73{ERR_PACK(0,ASN1_F_ASN1_GET_OBJECT,0), "ASN1_get_object"}, 79{ERR_PACK(0,ASN1_F_ASN1_GET_OBJECT,0), "ASN1_get_object"},
74{ERR_PACK(0,ASN1_F_ASN1_HEADER_NEW,0), "ASN1_HEADER_new"}, 80{ERR_PACK(0,ASN1_F_ASN1_HEADER_NEW,0), "ASN1_HEADER_new"},
75{ERR_PACK(0,ASN1_F_ASN1_I2D_BIO,0), "ASN1_i2d_bio"}, 81{ERR_PACK(0,ASN1_F_ASN1_I2D_BIO,0), "ASN1_i2d_bio"},
@@ -77,121 +83,176 @@ static ERR_STRING_DATA ASN1_str_functs[]=
77{ERR_PACK(0,ASN1_F_ASN1_INTEGER_SET,0), "ASN1_INTEGER_set"}, 83{ERR_PACK(0,ASN1_F_ASN1_INTEGER_SET,0), "ASN1_INTEGER_set"},
78{ERR_PACK(0,ASN1_F_ASN1_INTEGER_TO_BN,0), "ASN1_INTEGER_to_BN"}, 84{ERR_PACK(0,ASN1_F_ASN1_INTEGER_TO_BN,0), "ASN1_INTEGER_to_BN"},
79{ERR_PACK(0,ASN1_F_ASN1_OBJECT_NEW,0), "ASN1_OBJECT_new"}, 85{ERR_PACK(0,ASN1_F_ASN1_OBJECT_NEW,0), "ASN1_OBJECT_new"},
80{ERR_PACK(0,ASN1_F_ASN1_SIGN,0), "ASN1_SIGN"}, 86{ERR_PACK(0,ASN1_F_ASN1_PACK_STRING,0), "ASN1_pack_string"},
87{ERR_PACK(0,ASN1_F_ASN1_PBE_SET,0), "ASN1_PBE_SET"},
88{ERR_PACK(0,ASN1_F_ASN1_SEQ_PACK,0), "ASN1_seq_pack"},
89{ERR_PACK(0,ASN1_F_ASN1_SEQ_UNPACK,0), "ASN1_seq_unpack"},
90{ERR_PACK(0,ASN1_F_ASN1_SIGN,0), "ASN1_sign"},
81{ERR_PACK(0,ASN1_F_ASN1_STRING_NEW,0), "ASN1_STRING_new"}, 91{ERR_PACK(0,ASN1_F_ASN1_STRING_NEW,0), "ASN1_STRING_new"},
82{ERR_PACK(0,ASN1_F_ASN1_STRING_TYPE_NEW,0), "ASN1_STRING_type_new"}, 92{ERR_PACK(0,ASN1_F_ASN1_STRING_TYPE_NEW,0), "ASN1_STRING_type_new"},
83{ERR_PACK(0,ASN1_F_ASN1_TYPE_GET_INT_OCTETSTRING,0), "ASN1_TYPE_get_int_octetstring"}, 93{ERR_PACK(0,ASN1_F_ASN1_TYPE_GET_INT_OCTETSTRING,0), "ASN1_TYPE_get_int_octetstring"},
84{ERR_PACK(0,ASN1_F_ASN1_TYPE_GET_OCTETSTRING,0), "ASN1_TYPE_get_octetstring"}, 94{ERR_PACK(0,ASN1_F_ASN1_TYPE_GET_OCTETSTRING,0), "ASN1_TYPE_get_octetstring"},
85{ERR_PACK(0,ASN1_F_ASN1_TYPE_NEW,0), "ASN1_TYPE_new"}, 95{ERR_PACK(0,ASN1_F_ASN1_TYPE_NEW,0), "ASN1_TYPE_new"},
96{ERR_PACK(0,ASN1_F_ASN1_UNPACK_STRING,0), "ASN1_unpack_string"},
86{ERR_PACK(0,ASN1_F_ASN1_UTCTIME_NEW,0), "ASN1_UTCTIME_NEW"}, 97{ERR_PACK(0,ASN1_F_ASN1_UTCTIME_NEW,0), "ASN1_UTCTIME_NEW"},
87{ERR_PACK(0,ASN1_F_ASN1_VERIFY,0), "ASN1_VERIFY"}, 98{ERR_PACK(0,ASN1_F_ASN1_VERIFY,0), "ASN1_verify"},
99{ERR_PACK(0,ASN1_F_AUTHORITY_KEYID_NEW,0), "AUTHORITY_KEYID_new"},
100{ERR_PACK(0,ASN1_F_BASIC_CONSTRAINTS_NEW,0), "BASIC_CONSTRAINTS_new"},
101{ERR_PACK(0,ASN1_F_BN_TO_ASN1_ENUMERATED,0), "BN_to_ASN1_ENUMERATED"},
88{ERR_PACK(0,ASN1_F_BN_TO_ASN1_INTEGER,0), "BN_to_ASN1_INTEGER"}, 102{ERR_PACK(0,ASN1_F_BN_TO_ASN1_INTEGER,0), "BN_to_ASN1_INTEGER"},
89{ERR_PACK(0,ASN1_F_D2I_ASN1_BIT_STRING,0), "d2i_ASN1_BIT_STRING"}, 103{ERR_PACK(0,ASN1_F_D2I_ASN1_BIT_STRING,0), "d2i_ASN1_BIT_STRING"},
90{ERR_PACK(0,ASN1_F_D2I_ASN1_BMPSTRING,0), "D2I_ASN1_BMPSTRING"}, 104{ERR_PACK(0,ASN1_F_D2I_ASN1_BMPSTRING,0), "d2i_ASN1_BMPSTRING"},
91{ERR_PACK(0,ASN1_F_D2I_ASN1_BOOLEAN,0), "d2i_ASN1_BOOLEAN"}, 105{ERR_PACK(0,ASN1_F_D2I_ASN1_BOOLEAN,0), "d2i_ASN1_BOOLEAN"},
92{ERR_PACK(0,ASN1_F_D2I_ASN1_BYTES,0), "d2i_ASN1_bytes"}, 106{ERR_PACK(0,ASN1_F_D2I_ASN1_BYTES,0), "d2i_ASN1_bytes"},
107{ERR_PACK(0,ASN1_F_D2I_ASN1_ENUMERATED,0), "d2i_ASN1_ENUMERATED"},
108{ERR_PACK(0,ASN1_F_D2I_ASN1_GENERALIZEDTIME,0), "d2i_ASN1_GENERALIZEDTIME"},
93{ERR_PACK(0,ASN1_F_D2I_ASN1_HEADER,0), "d2i_ASN1_HEADER"}, 109{ERR_PACK(0,ASN1_F_D2I_ASN1_HEADER,0), "d2i_ASN1_HEADER"},
94{ERR_PACK(0,ASN1_F_D2I_ASN1_INTEGER,0), "d2i_ASN1_INTEGER"}, 110{ERR_PACK(0,ASN1_F_D2I_ASN1_INTEGER,0), "d2i_ASN1_INTEGER"},
95{ERR_PACK(0,ASN1_F_D2I_ASN1_OBJECT,0), "d2i_ASN1_OBJECT"}, 111{ERR_PACK(0,ASN1_F_D2I_ASN1_OBJECT,0), "d2i_ASN1_OBJECT"},
96{ERR_PACK(0,ASN1_F_D2I_ASN1_OCTET_STRING,0), "d2i_ASN1_OCTET_STRING"}, 112{ERR_PACK(0,ASN1_F_D2I_ASN1_OCTET_STRING,0), "d2i_ASN1_OCTET_STRING"},
97{ERR_PACK(0,ASN1_F_D2I_ASN1_PRINT_TYPE,0), "D2I_ASN1_PRINT_TYPE"}, 113{ERR_PACK(0,ASN1_F_D2I_ASN1_PRINT_TYPE,0), "D2I_ASN1_PRINT_TYPE"},
98{ERR_PACK(0,ASN1_F_D2I_ASN1_SET,0), "d2i_ASN1_SET"}, 114{ERR_PACK(0,ASN1_F_D2I_ASN1_SET,0), "d2i_ASN1_SET"},
115{ERR_PACK(0,ASN1_F_D2I_ASN1_TIME,0), "d2i_ASN1_TIME"},
99{ERR_PACK(0,ASN1_F_D2I_ASN1_TYPE,0), "d2i_ASN1_TYPE"}, 116{ERR_PACK(0,ASN1_F_D2I_ASN1_TYPE,0), "d2i_ASN1_TYPE"},
100{ERR_PACK(0,ASN1_F_D2I_ASN1_TYPE_BYTES,0), "d2i_ASN1_type_bytes"}, 117{ERR_PACK(0,ASN1_F_D2I_ASN1_TYPE_BYTES,0), "d2i_ASN1_type_bytes"},
118{ERR_PACK(0,ASN1_F_D2I_ASN1_UINTEGER,0), "d2i_ASN1_UINTEGER"},
101{ERR_PACK(0,ASN1_F_D2I_ASN1_UTCTIME,0), "d2i_ASN1_UTCTIME"}, 119{ERR_PACK(0,ASN1_F_D2I_ASN1_UTCTIME,0), "d2i_ASN1_UTCTIME"},
102{ERR_PACK(0,ASN1_F_D2I_DHPARAMS,0), "D2I_DHPARAMS"}, 120{ERR_PACK(0,ASN1_F_D2I_ASN1_UTF8STRING,0), "d2i_ASN1_UTF8STRING"},
103{ERR_PACK(0,ASN1_F_D2I_DSAPARAMS,0), "D2I_DSAPARAMS"}, 121{ERR_PACK(0,ASN1_F_D2I_ASN1_VISIBLESTRING,0), "d2i_ASN1_VISIBLESTRING"},
104{ERR_PACK(0,ASN1_F_D2I_DSAPRIVATEKEY,0), "D2I_DSAPRIVATEKEY"}, 122{ERR_PACK(0,ASN1_F_D2I_AUTHORITY_KEYID,0), "d2i_AUTHORITY_KEYID"},
105{ERR_PACK(0,ASN1_F_D2I_DSAPUBLICKEY,0), "D2I_DSAPUBLICKEY"}, 123{ERR_PACK(0,ASN1_F_D2I_BASIC_CONSTRAINTS,0), "d2i_BASIC_CONSTRAINTS"},
124{ERR_PACK(0,ASN1_F_D2I_DHPARAMS,0), "d2i_DHparams"},
125{ERR_PACK(0,ASN1_F_D2I_DIST_POINT,0), "d2i_DIST_POINT"},
126{ERR_PACK(0,ASN1_F_D2I_DIST_POINT_NAME,0), "d2i_DIST_POINT_NAME"},
127{ERR_PACK(0,ASN1_F_D2I_DSAPARAMS,0), "d2i_DSAparams"},
128{ERR_PACK(0,ASN1_F_D2I_DSAPRIVATEKEY,0), "d2i_DSAPrivateKey"},
129{ERR_PACK(0,ASN1_F_D2I_DSAPUBLICKEY,0), "d2i_DSAPublicKey"},
130{ERR_PACK(0,ASN1_F_D2I_GENERAL_NAME,0), "d2i_GENERAL_NAME"},
131{ERR_PACK(0,ASN1_F_D2I_NETSCAPE_CERT_SEQUENCE,0), "d2i_NETSCAPE_CERT_SEQUENCE"},
106{ERR_PACK(0,ASN1_F_D2I_NETSCAPE_PKEY,0), "D2I_NETSCAPE_PKEY"}, 132{ERR_PACK(0,ASN1_F_D2I_NETSCAPE_PKEY,0), "D2I_NETSCAPE_PKEY"},
107{ERR_PACK(0,ASN1_F_D2I_NETSCAPE_RSA,0), "D2I_NETSCAPE_RSA"}, 133{ERR_PACK(0,ASN1_F_D2I_NETSCAPE_RSA,0), "d2i_Netscape_RSA"},
108{ERR_PACK(0,ASN1_F_D2I_NETSCAPE_RSA_2,0), "D2I_NETSCAPE_RSA_2"}, 134{ERR_PACK(0,ASN1_F_D2I_NETSCAPE_RSA_2,0), "d2i_Netscape_RSA_2"},
109{ERR_PACK(0,ASN1_F_D2I_NETSCAPE_SPKAC,0), "D2I_NETSCAPE_SPKAC"}, 135{ERR_PACK(0,ASN1_F_D2I_NETSCAPE_SPKAC,0), "d2i_NETSCAPE_SPKAC"},
110{ERR_PACK(0,ASN1_F_D2I_NETSCAPE_SPKI,0), "D2I_NETSCAPE_SPKI"}, 136{ERR_PACK(0,ASN1_F_D2I_NETSCAPE_SPKI,0), "d2i_NETSCAPE_SPKI"},
111{ERR_PACK(0,ASN1_F_D2I_PKCS7,0), "D2I_PKCS7"}, 137{ERR_PACK(0,ASN1_F_D2I_NOTICEREF,0), "d2i_NOTICEREF"},
112{ERR_PACK(0,ASN1_F_D2I_PKCS7_DIGEST,0), "D2I_PKCS7_DIGEST"}, 138{ERR_PACK(0,ASN1_F_D2I_PBE2PARAM,0), "d2i_PBE2PARAM"},
113{ERR_PACK(0,ASN1_F_D2I_PKCS7_ENCRYPT,0), "D2I_PKCS7_ENCRYPT"}, 139{ERR_PACK(0,ASN1_F_D2I_PBEPARAM,0), "d2i_PBEPARAM"},
114{ERR_PACK(0,ASN1_F_D2I_PKCS7_ENC_CONTENT,0), "D2I_PKCS7_ENC_CONTENT"}, 140{ERR_PACK(0,ASN1_F_D2I_PBKDF2PARAM,0), "d2i_PBKDF2PARAM"},
115{ERR_PACK(0,ASN1_F_D2I_PKCS7_ENVELOPE,0), "D2I_PKCS7_ENVELOPE"}, 141{ERR_PACK(0,ASN1_F_D2I_PKCS12,0), "d2i_PKCS12"},
116{ERR_PACK(0,ASN1_F_D2I_PKCS7_ISSUER_AND_SERIAL,0), "D2I_PKCS7_ISSUER_AND_SERIAL"}, 142{ERR_PACK(0,ASN1_F_D2I_PKCS12_BAGS,0), "d2i_PKCS12_BAGS"},
117{ERR_PACK(0,ASN1_F_D2I_PKCS7_RECIP_INFO,0), "D2I_PKCS7_RECIP_INFO"}, 143{ERR_PACK(0,ASN1_F_D2I_PKCS12_MAC_DATA,0), "d2i_PKCS12_MAC_DATA"},
118{ERR_PACK(0,ASN1_F_D2I_PKCS7_SIGNED,0), "D2I_PKCS7_SIGNED"}, 144{ERR_PACK(0,ASN1_F_D2I_PKCS12_SAFEBAG,0), "d2i_PKCS12_SAFEBAG"},
119{ERR_PACK(0,ASN1_F_D2I_PKCS7_SIGNER_INFO,0), "D2I_PKCS7_SIGNER_INFO"}, 145{ERR_PACK(0,ASN1_F_D2I_PKCS7,0), "d2i_PKCS7"},
120{ERR_PACK(0,ASN1_F_D2I_PKCS7_SIGN_ENVELOPE,0), "D2I_PKCS7_SIGN_ENVELOPE"}, 146{ERR_PACK(0,ASN1_F_D2I_PKCS7_DIGEST,0), "d2i_PKCS7_DIGEST"},
121{ERR_PACK(0,ASN1_F_D2I_PRIVATEKEY,0), "D2I_PRIVATEKEY"}, 147{ERR_PACK(0,ASN1_F_D2I_PKCS7_ENCRYPT,0), "d2i_PKCS7_ENCRYPT"},
122{ERR_PACK(0,ASN1_F_D2I_PUBLICKEY,0), "D2I_PUBLICKEY"}, 148{ERR_PACK(0,ASN1_F_D2I_PKCS7_ENC_CONTENT,0), "d2i_PKCS7_ENC_CONTENT"},
123{ERR_PACK(0,ASN1_F_D2I_RSAPRIVATEKEY,0), "D2I_RSAPRIVATEKEY"}, 149{ERR_PACK(0,ASN1_F_D2I_PKCS7_ENVELOPE,0), "d2i_PKCS7_ENVELOPE"},
124{ERR_PACK(0,ASN1_F_D2I_RSAPUBLICKEY,0), "D2I_RSAPUBLICKEY"}, 150{ERR_PACK(0,ASN1_F_D2I_PKCS7_ISSUER_AND_SERIAL,0), "d2i_PKCS7_ISSUER_AND_SERIAL"},
125{ERR_PACK(0,ASN1_F_D2I_X509,0), "D2I_X509"}, 151{ERR_PACK(0,ASN1_F_D2I_PKCS7_RECIP_INFO,0), "d2i_PKCS7_RECIP_INFO"},
126{ERR_PACK(0,ASN1_F_D2I_X509_ALGOR,0), "D2I_X509_ALGOR"}, 152{ERR_PACK(0,ASN1_F_D2I_PKCS7_SIGNED,0), "d2i_PKCS7_SIGNED"},
127{ERR_PACK(0,ASN1_F_D2I_X509_ATTRIBUTE,0), "D2I_X509_ATTRIBUTE"}, 153{ERR_PACK(0,ASN1_F_D2I_PKCS7_SIGNER_INFO,0), "d2i_PKCS7_SIGNER_INFO"},
128{ERR_PACK(0,ASN1_F_D2I_X509_CINF,0), "D2I_X509_CINF"}, 154{ERR_PACK(0,ASN1_F_D2I_PKCS7_SIGN_ENVELOPE,0), "d2i_PKCS7_SIGN_ENVELOPE"},
129{ERR_PACK(0,ASN1_F_D2I_X509_CRL,0), "D2I_X509_CRL"}, 155{ERR_PACK(0,ASN1_F_D2I_PKCS8_PRIV_KEY_INFO,0), "d2i_PKCS8_PRIV_KEY_INFO"},
130{ERR_PACK(0,ASN1_F_D2I_X509_CRL_INFO,0), "D2I_X509_CRL_INFO"}, 156{ERR_PACK(0,ASN1_F_D2I_PKEY_USAGE_PERIOD,0), "d2i_PKEY_USAGE_PERIOD"},
131{ERR_PACK(0,ASN1_F_D2I_X509_EXTENSION,0), "D2I_X509_EXTENSION"}, 157{ERR_PACK(0,ASN1_F_D2I_POLICYINFO,0), "d2i_POLICYINFO"},
158{ERR_PACK(0,ASN1_F_D2I_POLICYQUALINFO,0), "d2i_POLICYQUALINFO"},
159{ERR_PACK(0,ASN1_F_D2I_PRIVATEKEY,0), "d2i_PrivateKey"},
160{ERR_PACK(0,ASN1_F_D2I_PUBLICKEY,0), "d2i_PublicKey"},
161{ERR_PACK(0,ASN1_F_D2I_RSAPRIVATEKEY,0), "d2i_RSAPrivateKey"},
162{ERR_PACK(0,ASN1_F_D2I_RSAPUBLICKEY,0), "d2i_RSAPublicKey"},
163{ERR_PACK(0,ASN1_F_D2I_SXNET,0), "d2i_SXNET"},
164{ERR_PACK(0,ASN1_F_D2I_SXNETID,0), "d2i_SXNETID"},
165{ERR_PACK(0,ASN1_F_D2I_USERNOTICE,0), "d2i_USERNOTICE"},
166{ERR_PACK(0,ASN1_F_D2I_X509,0), "d2i_X509"},
167{ERR_PACK(0,ASN1_F_D2I_X509_ALGOR,0), "d2i_X509_ALGOR"},
168{ERR_PACK(0,ASN1_F_D2I_X509_ATTRIBUTE,0), "d2i_X509_ATTRIBUTE"},
169{ERR_PACK(0,ASN1_F_D2I_X509_CINF,0), "d2i_X509_CINF"},
170{ERR_PACK(0,ASN1_F_D2I_X509_CRL,0), "d2i_X509_CRL"},
171{ERR_PACK(0,ASN1_F_D2I_X509_CRL_INFO,0), "d2i_X509_CRL_INFO"},
172{ERR_PACK(0,ASN1_F_D2I_X509_EXTENSION,0), "d2i_X509_EXTENSION"},
132{ERR_PACK(0,ASN1_F_D2I_X509_KEY,0), "D2I_X509_KEY"}, 173{ERR_PACK(0,ASN1_F_D2I_X509_KEY,0), "D2I_X509_KEY"},
133{ERR_PACK(0,ASN1_F_D2I_X509_NAME,0), "D2I_X509_NAME"}, 174{ERR_PACK(0,ASN1_F_D2I_X509_NAME,0), "d2i_X509_NAME"},
134{ERR_PACK(0,ASN1_F_D2I_X509_NAME_ENTRY,0), "D2I_X509_NAME_ENTRY"}, 175{ERR_PACK(0,ASN1_F_D2I_X509_NAME_ENTRY,0), "d2i_X509_NAME_ENTRY"},
135{ERR_PACK(0,ASN1_F_D2I_X509_PKEY,0), "D2I_X509_PKEY"}, 176{ERR_PACK(0,ASN1_F_D2I_X509_PKEY,0), "d2i_X509_PKEY"},
136{ERR_PACK(0,ASN1_F_D2I_X509_PUBKEY,0), "D2I_X509_PUBKEY"}, 177{ERR_PACK(0,ASN1_F_D2I_X509_PUBKEY,0), "d2i_X509_PUBKEY"},
137{ERR_PACK(0,ASN1_F_D2I_X509_REQ,0), "D2I_X509_REQ"}, 178{ERR_PACK(0,ASN1_F_D2I_X509_REQ,0), "d2i_X509_REQ"},
138{ERR_PACK(0,ASN1_F_D2I_X509_REQ_INFO,0), "D2I_X509_REQ_INFO"}, 179{ERR_PACK(0,ASN1_F_D2I_X509_REQ_INFO,0), "d2i_X509_REQ_INFO"},
139{ERR_PACK(0,ASN1_F_D2I_X509_REVOKED,0), "D2I_X509_REVOKED"}, 180{ERR_PACK(0,ASN1_F_D2I_X509_REVOKED,0), "d2i_X509_REVOKED"},
140{ERR_PACK(0,ASN1_F_D2I_X509_SIG,0), "D2I_X509_SIG"}, 181{ERR_PACK(0,ASN1_F_D2I_X509_SIG,0), "d2i_X509_SIG"},
141{ERR_PACK(0,ASN1_F_D2I_X509_VAL,0), "D2I_X509_VAL"}, 182{ERR_PACK(0,ASN1_F_D2I_X509_VAL,0), "d2i_X509_VAL"},
183{ERR_PACK(0,ASN1_F_DIST_POINT_NAME_NEW,0), "DIST_POINT_NAME_new"},
184{ERR_PACK(0,ASN1_F_DIST_POINT_NEW,0), "DIST_POINT_new"},
185{ERR_PACK(0,ASN1_F_GENERAL_NAME_NEW,0), "GENERAL_NAME_new"},
142{ERR_PACK(0,ASN1_F_I2D_ASN1_HEADER,0), "i2d_ASN1_HEADER"}, 186{ERR_PACK(0,ASN1_F_I2D_ASN1_HEADER,0), "i2d_ASN1_HEADER"},
143{ERR_PACK(0,ASN1_F_I2D_DHPARAMS,0), "I2D_DHPARAMS"}, 187{ERR_PACK(0,ASN1_F_I2D_ASN1_TIME,0), "i2d_ASN1_TIME"},
144{ERR_PACK(0,ASN1_F_I2D_DSAPARAMS,0), "I2D_DSAPARAMS"}, 188{ERR_PACK(0,ASN1_F_I2D_DHPARAMS,0), "i2d_DHparams"},
145{ERR_PACK(0,ASN1_F_I2D_DSAPRIVATEKEY,0), "I2D_DSAPRIVATEKEY"}, 189{ERR_PACK(0,ASN1_F_I2D_DSAPARAMS,0), "i2d_DSAparams"},
146{ERR_PACK(0,ASN1_F_I2D_DSAPUBLICKEY,0), "I2D_DSAPUBLICKEY"}, 190{ERR_PACK(0,ASN1_F_I2D_DSAPRIVATEKEY,0), "i2d_DSAPrivateKey"},
147{ERR_PACK(0,ASN1_F_I2D_NETSCAPE_RSA,0), "I2D_NETSCAPE_RSA"}, 191{ERR_PACK(0,ASN1_F_I2D_DSAPUBLICKEY,0), "i2d_DSAPublicKey"},
148{ERR_PACK(0,ASN1_F_I2D_PKCS7,0), "I2D_PKCS7"}, 192{ERR_PACK(0,ASN1_F_I2D_NETSCAPE_RSA,0), "i2d_Netscape_RSA"},
149{ERR_PACK(0,ASN1_F_I2D_PRIVATEKEY,0), "I2D_PRIVATEKEY"}, 193{ERR_PACK(0,ASN1_F_I2D_PKCS7,0), "i2d_PKCS7"},
150{ERR_PACK(0,ASN1_F_I2D_PUBLICKEY,0), "I2D_PUBLICKEY"}, 194{ERR_PACK(0,ASN1_F_I2D_PRIVATEKEY,0), "i2d_PrivateKey"},
151{ERR_PACK(0,ASN1_F_I2D_RSAPRIVATEKEY,0), "I2D_RSAPRIVATEKEY"}, 195{ERR_PACK(0,ASN1_F_I2D_PUBLICKEY,0), "i2d_PublicKey"},
152{ERR_PACK(0,ASN1_F_I2D_RSAPUBLICKEY,0), "I2D_RSAPUBLICKEY"}, 196{ERR_PACK(0,ASN1_F_I2D_RSAPRIVATEKEY,0), "i2d_RSAPrivateKey"},
153{ERR_PACK(0,ASN1_F_I2D_X509_ATTRIBUTE,0), "I2D_X509_ATTRIBUTE"}, 197{ERR_PACK(0,ASN1_F_I2D_RSAPUBLICKEY,0), "i2d_RSAPublicKey"},
198{ERR_PACK(0,ASN1_F_I2D_X509_ATTRIBUTE,0), "i2d_X509_ATTRIBUTE"},
154{ERR_PACK(0,ASN1_F_I2T_ASN1_OBJECT,0), "i2t_ASN1_OBJECT"}, 199{ERR_PACK(0,ASN1_F_I2T_ASN1_OBJECT,0), "i2t_ASN1_OBJECT"},
200{ERR_PACK(0,ASN1_F_NETSCAPE_CERT_SEQUENCE_NEW,0), "NETSCAPE_CERT_SEQUENCE_new"},
155{ERR_PACK(0,ASN1_F_NETSCAPE_PKEY_NEW,0), "NETSCAPE_PKEY_NEW"}, 201{ERR_PACK(0,ASN1_F_NETSCAPE_PKEY_NEW,0), "NETSCAPE_PKEY_NEW"},
156{ERR_PACK(0,ASN1_F_NETSCAPE_SPKAC_NEW,0), "NETSCAPE_SPKAC_NEW"}, 202{ERR_PACK(0,ASN1_F_NETSCAPE_SPKAC_NEW,0), "NETSCAPE_SPKAC_new"},
157{ERR_PACK(0,ASN1_F_NETSCAPE_SPKI_NEW,0), "NETSCAPE_SPKI_NEW"}, 203{ERR_PACK(0,ASN1_F_NETSCAPE_SPKI_NEW,0), "NETSCAPE_SPKI_new"},
158{ERR_PACK(0,ASN1_F_PKCS7_DIGEST_NEW,0), "PKCS7_DIGEST_NEW"}, 204{ERR_PACK(0,ASN1_F_NOTICEREF_NEW,0), "NOTICEREF_new"},
159{ERR_PACK(0,ASN1_F_PKCS7_ENCRYPT_NEW,0), "PKCS7_ENCRYPT_NEW"}, 205{ERR_PACK(0,ASN1_F_PBE2PARAM_NEW,0), "PBE2PARAM_new"},
160{ERR_PACK(0,ASN1_F_PKCS7_ENC_CONTENT_NEW,0), "PKCS7_ENC_CONTENT_NEW"}, 206{ERR_PACK(0,ASN1_F_PBEPARAM_NEW,0), "PBEPARAM_new"},
161{ERR_PACK(0,ASN1_F_PKCS7_ENVELOPE_NEW,0), "PKCS7_ENVELOPE_NEW"}, 207{ERR_PACK(0,ASN1_F_PBKDF2PARAM_NEW,0), "PBKDF2PARAM_new"},
162{ERR_PACK(0,ASN1_F_PKCS7_ISSUER_AND_SERIAL_NEW,0), "PKCS7_ISSUER_AND_SERIAL_NEW"}, 208{ERR_PACK(0,ASN1_F_PKCS12_BAGS_NEW,0), "PKCS12_BAGS_new"},
163{ERR_PACK(0,ASN1_F_PKCS7_NEW,0), "PKCS7_NEW"}, 209{ERR_PACK(0,ASN1_F_PKCS12_MAC_DATA_NEW,0), "PKCS12_MAC_DATA_new"},
164{ERR_PACK(0,ASN1_F_PKCS7_RECIP_INFO_NEW,0), "PKCS7_RECIP_INFO_NEW"}, 210{ERR_PACK(0,ASN1_F_PKCS12_NEW,0), "PKCS12_new"},
165{ERR_PACK(0,ASN1_F_PKCS7_SIGNED_NEW,0), "PKCS7_SIGNED_NEW"}, 211{ERR_PACK(0,ASN1_F_PKCS12_SAFEBAG_NEW,0), "PKCS12_SAFEBAG_new"},
166{ERR_PACK(0,ASN1_F_PKCS7_SIGNER_INFO_NEW,0), "PKCS7_SIGNER_INFO_NEW"}, 212{ERR_PACK(0,ASN1_F_PKCS5_PBE2_SET,0), "PKCS5_pbe2_set"},
167{ERR_PACK(0,ASN1_F_PKCS7_SIGN_ENVELOPE_NEW,0), "PKCS7_SIGN_ENVELOPE_NEW"}, 213{ERR_PACK(0,ASN1_F_PKCS7_DIGEST_NEW,0), "PKCS7_DIGEST_new"},
168{ERR_PACK(0,ASN1_F_X509_ALGOR_NEW,0), "X509_ALGOR_NEW"}, 214{ERR_PACK(0,ASN1_F_PKCS7_ENCRYPT_NEW,0), "PKCS7_ENCRYPT_new"},
169{ERR_PACK(0,ASN1_F_X509_ATTRIBUTE_NEW,0), "X509_ATTRIBUTE_NEW"}, 215{ERR_PACK(0,ASN1_F_PKCS7_ENC_CONTENT_NEW,0), "PKCS7_ENC_CONTENT_new"},
170{ERR_PACK(0,ASN1_F_X509_CINF_NEW,0), "X509_CINF_NEW"}, 216{ERR_PACK(0,ASN1_F_PKCS7_ENVELOPE_NEW,0), "PKCS7_ENVELOPE_new"},
171{ERR_PACK(0,ASN1_F_X509_CRL_INFO_NEW,0), "X509_CRL_INFO_NEW"}, 217{ERR_PACK(0,ASN1_F_PKCS7_ISSUER_AND_SERIAL_NEW,0), "PKCS7_ISSUER_AND_SERIAL_new"},
172{ERR_PACK(0,ASN1_F_X509_CRL_NEW,0), "X509_CRL_NEW"}, 218{ERR_PACK(0,ASN1_F_PKCS7_NEW,0), "PKCS7_new"},
219{ERR_PACK(0,ASN1_F_PKCS7_RECIP_INFO_NEW,0), "PKCS7_RECIP_INFO_new"},
220{ERR_PACK(0,ASN1_F_PKCS7_SIGNED_NEW,0), "PKCS7_SIGNED_new"},
221{ERR_PACK(0,ASN1_F_PKCS7_SIGNER_INFO_NEW,0), "PKCS7_SIGNER_INFO_new"},
222{ERR_PACK(0,ASN1_F_PKCS7_SIGN_ENVELOPE_NEW,0), "PKCS7_SIGN_ENVELOPE_new"},
223{ERR_PACK(0,ASN1_F_PKCS8_PRIV_KEY_INFO_NEW,0), "PKCS8_PRIV_KEY_INFO_new"},
224{ERR_PACK(0,ASN1_F_PKEY_USAGE_PERIOD_NEW,0), "PKEY_USAGE_PERIOD_new"},
225{ERR_PACK(0,ASN1_F_POLICYINFO_NEW,0), "POLICYINFO_new"},
226{ERR_PACK(0,ASN1_F_POLICYQUALINFO_NEW,0), "POLICYQUALINFO_new"},
227{ERR_PACK(0,ASN1_F_SXNETID_NEW,0), "SXNETID_new"},
228{ERR_PACK(0,ASN1_F_SXNET_NEW,0), "SXNET_new"},
229{ERR_PACK(0,ASN1_F_USERNOTICE_NEW,0), "USERNOTICE_new"},
230{ERR_PACK(0,ASN1_F_X509_ALGOR_NEW,0), "X509_ALGOR_new"},
231{ERR_PACK(0,ASN1_F_X509_ATTRIBUTE_NEW,0), "X509_ATTRIBUTE_new"},
232{ERR_PACK(0,ASN1_F_X509_CINF_NEW,0), "X509_CINF_new"},
233{ERR_PACK(0,ASN1_F_X509_CRL_INFO_NEW,0), "X509_CRL_INFO_new"},
234{ERR_PACK(0,ASN1_F_X509_CRL_NEW,0), "X509_CRL_new"},
173{ERR_PACK(0,ASN1_F_X509_DHPARAMS_NEW,0), "X509_DHPARAMS_NEW"}, 235{ERR_PACK(0,ASN1_F_X509_DHPARAMS_NEW,0), "X509_DHPARAMS_NEW"},
174{ERR_PACK(0,ASN1_F_X509_EXTENSION_NEW,0), "X509_EXTENSION_NEW"}, 236{ERR_PACK(0,ASN1_F_X509_EXTENSION_NEW,0), "X509_EXTENSION_new"},
175{ERR_PACK(0,ASN1_F_X509_INFO_NEW,0), "X509_INFO_NEW"}, 237{ERR_PACK(0,ASN1_F_X509_INFO_NEW,0), "X509_INFO_new"},
176{ERR_PACK(0,ASN1_F_X509_KEY_NEW,0), "X509_KEY_NEW"}, 238{ERR_PACK(0,ASN1_F_X509_KEY_NEW,0), "X509_KEY_NEW"},
177{ERR_PACK(0,ASN1_F_X509_NAME_ENTRY_NEW,0), "X509_NAME_ENTRY_NEW"}, 239{ERR_PACK(0,ASN1_F_X509_NAME_ENTRY_NEW,0), "X509_NAME_ENTRY_new"},
178{ERR_PACK(0,ASN1_F_X509_NAME_NEW,0), "X509_NAME_NEW"}, 240{ERR_PACK(0,ASN1_F_X509_NAME_NEW,0), "X509_NAME_new"},
179{ERR_PACK(0,ASN1_F_X509_NEW,0), "X509_NEW"}, 241{ERR_PACK(0,ASN1_F_X509_NEW,0), "X509_new"},
180{ERR_PACK(0,ASN1_F_X509_PKEY_NEW,0), "X509_PKEY_NEW"}, 242{ERR_PACK(0,ASN1_F_X509_PKEY_NEW,0), "X509_PKEY_new"},
181{ERR_PACK(0,ASN1_F_X509_PUBKEY_NEW,0), "X509_PUBKEY_NEW"}, 243{ERR_PACK(0,ASN1_F_X509_PUBKEY_NEW,0), "X509_PUBKEY_new"},
182{ERR_PACK(0,ASN1_F_X509_REQ_INFO_NEW,0), "X509_REQ_INFO_NEW"}, 244{ERR_PACK(0,ASN1_F_X509_REQ_INFO_NEW,0), "X509_REQ_INFO_new"},
183{ERR_PACK(0,ASN1_F_X509_REQ_NEW,0), "X509_REQ_NEW"}, 245{ERR_PACK(0,ASN1_F_X509_REQ_NEW,0), "X509_REQ_new"},
184{ERR_PACK(0,ASN1_F_X509_REVOKED_NEW,0), "X509_REVOKED_NEW"}, 246{ERR_PACK(0,ASN1_F_X509_REVOKED_NEW,0), "X509_REVOKED_new"},
185{ERR_PACK(0,ASN1_F_X509_SIG_NEW,0), "X509_SIG_NEW"}, 247{ERR_PACK(0,ASN1_F_X509_SIG_NEW,0), "X509_SIG_new"},
186{ERR_PACK(0,ASN1_F_X509_VAL_FREE,0), "X509_VAL_FREE"}, 248{ERR_PACK(0,ASN1_F_X509_VAL_FREE,0), "X509_VAL_free"},
187{ERR_PACK(0,ASN1_F_X509_VAL_NEW,0), "X509_VAL_NEW"}, 249{ERR_PACK(0,ASN1_F_X509_VAL_NEW,0), "X509_VAL_new"},
188{0,NULL}, 250{0,NULL}
189 }; 251 };
190 252
191static ERR_STRING_DATA ASN1_str_reasons[]= 253static ERR_STRING_DATA ASN1_str_reasons[]=
192 { 254 {
193{ASN1_R_BAD_CLASS ,"bad class"}, 255{ASN1_R_BAD_CLASS ,"bad class"},
194{ASN1_R_BAD_GET_OBJECT ,"bad get object"},
195{ASN1_R_BAD_OBJECT_HEADER ,"bad object header"}, 256{ASN1_R_BAD_OBJECT_HEADER ,"bad object header"},
196{ASN1_R_BAD_PASSWORD_READ ,"bad password read"}, 257{ASN1_R_BAD_PASSWORD_READ ,"bad password read"},
197{ASN1_R_BAD_PKCS7_CONTENT ,"bad pkcs7 content"}, 258{ASN1_R_BAD_PKCS7_CONTENT ,"bad pkcs7 content"},
@@ -202,24 +263,28 @@ static ERR_STRING_DATA ASN1_str_reasons[]=
202{ASN1_R_BOOLEAN_IS_WRONG_LENGTH ,"boolean is wrong length"}, 263{ASN1_R_BOOLEAN_IS_WRONG_LENGTH ,"boolean is wrong length"},
203{ASN1_R_BUFFER_TOO_SMALL ,"buffer too small"}, 264{ASN1_R_BUFFER_TOO_SMALL ,"buffer too small"},
204{ASN1_R_DATA_IS_WRONG ,"data is wrong"}, 265{ASN1_R_DATA_IS_WRONG ,"data is wrong"},
266{ASN1_R_DECODE_ERROR ,"decode error"},
205{ASN1_R_DECODING_ERROR ,"decoding error"}, 267{ASN1_R_DECODING_ERROR ,"decoding error"},
206{ASN1_R_ERROR_STACK ,"error stack"}, 268{ASN1_R_ENCODE_ERROR ,"encode error"},
269{ASN1_R_ERROR_PARSING_SET_ELEMENT ,"error parsing set element"},
270{ASN1_R_ERROR_SETTING_CIPHER_PARAMS ,"error setting cipher params"},
271{ASN1_R_EXPECTING_AN_ENUMERATED ,"expecting an enumerated"},
207{ASN1_R_EXPECTING_AN_INTEGER ,"expecting an integer"}, 272{ASN1_R_EXPECTING_AN_INTEGER ,"expecting an integer"},
208{ASN1_R_EXPECTING_AN_OBJECT ,"expecting an object"}, 273{ASN1_R_EXPECTING_AN_OBJECT ,"expecting an object"},
209{ASN1_R_EXPECTING_AN_OCTET_STRING ,"expecting an octet string"}, 274{ASN1_R_EXPECTING_AN_OCTET_STRING ,"expecting an octet string"},
210{ASN1_R_EXPECTING_A_BIT_STRING ,"expecting a bit string"}, 275{ASN1_R_EXPECTING_A_BIT_STRING ,"expecting a bit string"},
211{ASN1_R_EXPECTING_A_BOOLEAN ,"expecting a boolean"}, 276{ASN1_R_EXPECTING_A_BOOLEAN ,"expecting a boolean"},
212{ASN1_R_EXPECTING_A_SEQUENCE ,"expecting a sequence"}, 277{ASN1_R_EXPECTING_A_GENERALIZEDTIME ,"expecting a generalizedtime"},
278{ASN1_R_EXPECTING_A_TIME ,"expecting a time"},
213{ASN1_R_EXPECTING_A_UTCTIME ,"expecting a utctime"}, 279{ASN1_R_EXPECTING_A_UTCTIME ,"expecting a utctime"},
214{ASN1_R_FIRST_NUM_TOO_LARGE ,"first num too large"}, 280{ASN1_R_FIRST_NUM_TOO_LARGE ,"first num too large"},
281{ASN1_R_GENERALIZEDTIME_TOO_LONG ,"generalizedtime too long"},
215{ASN1_R_HEADER_TOO_LONG ,"header too long"}, 282{ASN1_R_HEADER_TOO_LONG ,"header too long"},
216{ASN1_R_INVALID_DIGIT ,"invalid digit"}, 283{ASN1_R_INVALID_DIGIT ,"invalid digit"},
217{ASN1_R_INVALID_SEPARATOR ,"invalid separator"}, 284{ASN1_R_INVALID_SEPARATOR ,"invalid separator"},
218{ASN1_R_INVALID_TIME_FORMAT ,"invalid time format"}, 285{ASN1_R_INVALID_TIME_FORMAT ,"invalid time format"},
219{ASN1_R_IV_TOO_LARGE ,"iv too large"}, 286{ASN1_R_IV_TOO_LARGE ,"iv too large"},
220{ASN1_R_LENGTH_ERROR ,"length error"}, 287{ASN1_R_LENGTH_ERROR ,"length error"},
221{ASN1_R_LENGTH_MISMATCH ,"length mismatch"},
222{ASN1_R_MISSING_EOS ,"missing eos"},
223{ASN1_R_MISSING_SECOND_NUMBER ,"missing second number"}, 288{ASN1_R_MISSING_SECOND_NUMBER ,"missing second number"},
224{ASN1_R_NON_HEX_CHARACTERS ,"non hex characters"}, 289{ASN1_R_NON_HEX_CHARACTERS ,"non hex characters"},
225{ASN1_R_NOT_ENOUGH_DATA ,"not enough data"}, 290{ASN1_R_NOT_ENOUGH_DATA ,"not enough data"},
@@ -245,17 +310,17 @@ static ERR_STRING_DATA ASN1_str_reasons[]=
245{ASN1_R_WRONG_PRINTABLE_TYPE ,"wrong printable type"}, 310{ASN1_R_WRONG_PRINTABLE_TYPE ,"wrong printable type"},
246{ASN1_R_WRONG_TAG ,"wrong tag"}, 311{ASN1_R_WRONG_TAG ,"wrong tag"},
247{ASN1_R_WRONG_TYPE ,"wrong type"}, 312{ASN1_R_WRONG_TYPE ,"wrong type"},
248{0,NULL}, 313{0,NULL}
249 }; 314 };
250 315
251#endif 316#endif
252 317
253void ERR_load_ASN1_strings() 318void ERR_load_ASN1_strings(void)
254 { 319 {
255 static int init=1; 320 static int init=1;
256 321
257 if (init); 322 if (init)
258 {; 323 {
259 init=0; 324 init=0;
260#ifndef NO_ERR 325#ifndef NO_ERR
261 ERR_load_strings(ERR_LIB_ASN1,ASN1_str_functs); 326 ERR_load_strings(ERR_LIB_ASN1,ASN1_str_functs);
diff --git a/src/lib/libcrypto/asn1/asn1_lib.c b/src/lib/libcrypto/asn1/asn1_lib.c
index ff30b25836..95e54ed626 100644
--- a/src/lib/libcrypto/asn1/asn1_lib.c
+++ b/src/lib/libcrypto/asn1/asn1_lib.c
@@ -58,22 +58,14 @@
58 58
59#include <stdio.h> 59#include <stdio.h>
60#include "cryptlib.h" 60#include "cryptlib.h"
61#include "asn1.h" 61#include <openssl/asn1.h>
62#include "asn1_mac.h" 62#include <openssl/asn1_mac.h>
63 63
64#ifndef NOPROTO
65static int asn1_get_length(unsigned char **pp,int *inf,long *rl,int max); 64static int asn1_get_length(unsigned char **pp,int *inf,long *rl,int max);
66static void asn1_put_length(unsigned char **pp, int length); 65static void asn1_put_length(unsigned char **pp, int length);
67#else 66const char *ASN1_version="ASN.1" OPENSSL_VERSION_PTEXT;
68static int asn1_get_length();
69static void asn1_put_length();
70#endif
71
72char *ASN1_version="ASN1 part of SSLeay 0.9.0b 29-Jun-1998";
73 67
74int ASN1_check_infinite_end(p,len) 68int ASN1_check_infinite_end(unsigned char **p, long len)
75unsigned char **p;
76long len;
77 { 69 {
78 /* If there is 0 or 1 byte left, the length check should pick 70 /* If there is 0 or 1 byte left, the length check should pick
79 * things up */ 71 * things up */
@@ -88,12 +80,8 @@ long len;
88 } 80 }
89 81
90 82
91int ASN1_get_object(pp, plength, ptag, pclass, omax) 83int ASN1_get_object(unsigned char **pp, long *plength, int *ptag, int *pclass,
92unsigned char **pp; 84 long omax)
93long *plength;
94int *ptag;
95int *pclass;
96long omax;
97 { 85 {
98 int i,ret; 86 int i,ret;
99 long l; 87 long l;
@@ -104,8 +92,8 @@ long omax;
104 if (!max) goto err; 92 if (!max) goto err;
105 ret=(*p&V_ASN1_CONSTRUCTED); 93 ret=(*p&V_ASN1_CONSTRUCTED);
106 xclass=(*p&V_ASN1_PRIVATE); 94 xclass=(*p&V_ASN1_PRIVATE);
107 i= *p&V_ASN1_PRIMATIVE_TAG; 95 i= *p&V_ASN1_PRIMITIVE_TAG;
108 if (i == V_ASN1_PRIMATIVE_TAG) 96 if (i == V_ASN1_PRIMITIVE_TAG)
109 { /* high-tag */ 97 { /* high-tag */
110 p++; 98 p++;
111 if (--max == 0) goto err; 99 if (--max == 0) goto err;
@@ -130,11 +118,13 @@ long omax;
130 *pclass=xclass; 118 *pclass=xclass;
131 if (!asn1_get_length(&p,&inf,plength,(int)max)) goto err; 119 if (!asn1_get_length(&p,&inf,plength,(int)max)) goto err;
132 120
133#ifdef undef 121#if 0
134 fprintf(stderr,"p=%d + *plength=%d > omax=%d + *pp=%d (%d > %d)\n", 122 fprintf(stderr,"p=%d + *plength=%ld > omax=%ld + *pp=%d (%d > %d)\n",
135 p,*plength,omax,*pp,(p+ *plength),omax+ *pp); 123 (int)p,*plength,omax,(int)*pp,(int)(p+ *plength),
124 (int)(omax+ *pp));
136 125
137#endif 126#endif
127#if 0
138 if ((p+ *plength) > (omax+ *pp)) 128 if ((p+ *plength) > (omax+ *pp))
139 { 129 {
140 ASN1err(ASN1_F_ASN1_GET_OBJECT,ASN1_R_TOO_LONG); 130 ASN1err(ASN1_F_ASN1_GET_OBJECT,ASN1_R_TOO_LONG);
@@ -142,18 +132,15 @@ long omax;
142 * the values are set correctly */ 132 * the values are set correctly */
143 ret|=0x80; 133 ret|=0x80;
144 } 134 }
135#endif
145 *pp=p; 136 *pp=p;
146 return(ret+inf); 137 return(ret|inf);
147err: 138err:
148 ASN1err(ASN1_F_ASN1_GET_OBJECT,ASN1_R_HEADER_TOO_LONG); 139 ASN1err(ASN1_F_ASN1_GET_OBJECT,ASN1_R_HEADER_TOO_LONG);
149 return(0x80); 140 return(0x80);
150 } 141 }
151 142
152static int asn1_get_length(pp,inf,rl,max) 143static int asn1_get_length(unsigned char **pp, int *inf, long *rl, int max)
153unsigned char **pp;
154int *inf;
155long *rl;
156int max;
157 { 144 {
158 unsigned char *p= *pp; 145 unsigned char *p= *pp;
159 long ret=0; 146 long ret=0;
@@ -190,12 +177,8 @@ int max;
190 177
191/* class 0 is constructed 178/* class 0 is constructed
192 * constructed == 2 for indefinitle length constructed */ 179 * constructed == 2 for indefinitle length constructed */
193void ASN1_put_object(pp,constructed,length,tag,xclass) 180void ASN1_put_object(unsigned char **pp, int constructed, int length, int tag,
194unsigned char **pp; 181 int xclass)
195int constructed;
196int length;
197int tag;
198int xclass;
199 { 182 {
200 unsigned char *p= *pp; 183 unsigned char *p= *pp;
201 int i; 184 int i;
@@ -203,10 +186,10 @@ int xclass;
203 i=(constructed)?V_ASN1_CONSTRUCTED:0; 186 i=(constructed)?V_ASN1_CONSTRUCTED:0;
204 i|=(xclass&V_ASN1_PRIVATE); 187 i|=(xclass&V_ASN1_PRIVATE);
205 if (tag < 31) 188 if (tag < 31)
206 *(p++)=i|(tag&V_ASN1_PRIMATIVE_TAG); 189 *(p++)=i|(tag&V_ASN1_PRIMITIVE_TAG);
207 else 190 else
208 { 191 {
209 *(p++)=i|V_ASN1_PRIMATIVE_TAG; 192 *(p++)=i|V_ASN1_PRIMITIVE_TAG;
210 while (tag > 0x7f) 193 while (tag > 0x7f)
211 { 194 {
212 *(p++)=(tag&0x7f)|0x80; 195 *(p++)=(tag&0x7f)|0x80;
@@ -221,9 +204,7 @@ int xclass;
221 *pp=p; 204 *pp=p;
222 } 205 }
223 206
224static void asn1_put_length(pp, length) 207static void asn1_put_length(unsigned char **pp, int length)
225unsigned char **pp;
226int length;
227 { 208 {
228 unsigned char *p= *pp; 209 unsigned char *p= *pp;
229 int i,l; 210 int i,l;
@@ -246,10 +227,7 @@ int length;
246 *pp=p; 227 *pp=p;
247 } 228 }
248 229
249int ASN1_object_size(constructed, length, tag) 230int ASN1_object_size(int constructed, int length, int tag)
250int constructed;
251int length;
252int tag;
253 { 231 {
254 int ret; 232 int ret;
255 233
@@ -277,29 +255,26 @@ int tag;
277 return(ret); 255 return(ret);
278 } 256 }
279 257
280int asn1_Finish(c) 258int asn1_Finish(ASN1_CTX *c)
281ASN1_CTX *c;
282 { 259 {
283 if ((c->inf == (1|V_ASN1_CONSTRUCTED)) && (!c->eos)) 260 if ((c->inf == (1|V_ASN1_CONSTRUCTED)) && (!c->eos))
284 { 261 {
285 if (!ASN1_check_infinite_end(&c->p,c->slen)) 262 if (!ASN1_check_infinite_end(&c->p,c->slen))
286 { 263 {
287 c->error=ASN1_R_MISSING_EOS; 264 c->error=ERR_R_MISSING_ASN1_EOS;
288 return(0); 265 return(0);
289 } 266 }
290 } 267 }
291 if ( ((c->slen != 0) && !(c->inf & 1)) || 268 if ( ((c->slen != 0) && !(c->inf & 1)) ||
292 ((c->slen < 0) && (c->inf & 1))) 269 ((c->slen < 0) && (c->inf & 1)))
293 { 270 {
294 c->error=ASN1_R_LENGTH_MISMATCH; 271 c->error=ERR_R_ASN1_LENGTH_MISMATCH;
295 return(0); 272 return(0);
296 } 273 }
297 return(1); 274 return(1);
298 } 275 }
299 276
300int asn1_GetSequence(c,length) 277int asn1_GetSequence(ASN1_CTX *c, long *length)
301ASN1_CTX *c;
302long *length;
303 { 278 {
304 unsigned char *q; 279 unsigned char *q;
305 280
@@ -308,18 +283,18 @@ long *length;
308 *length); 283 *length);
309 if (c->inf & 0x80) 284 if (c->inf & 0x80)
310 { 285 {
311 c->error=ASN1_R_BAD_GET_OBJECT; 286 c->error=ERR_R_BAD_GET_ASN1_OBJECT_CALL;
312 return(0); 287 return(0);
313 } 288 }
314 if (c->tag != V_ASN1_SEQUENCE) 289 if (c->tag != V_ASN1_SEQUENCE)
315 { 290 {
316 c->error=ASN1_R_EXPECTING_A_SEQUENCE; 291 c->error=ERR_R_EXPECTING_AN_ASN1_SEQUENCE;
317 return(0); 292 return(0);
318 } 293 }
319 (*length)-=(c->p-q); 294 (*length)-=(c->p-q);
320 if (c->max && (*length < 0)) 295 if (c->max && (*length < 0))
321 { 296 {
322 c->error=ASN1_R_LENGTH_MISMATCH; 297 c->error=ERR_R_ASN1_LENGTH_MISMATCH;
323 return(0); 298 return(0);
324 } 299 }
325 if (c->inf == (1|V_ASN1_CONSTRUCTED)) 300 if (c->inf == (1|V_ASN1_CONSTRUCTED))
@@ -328,8 +303,7 @@ long *length;
328 return(1); 303 return(1);
329 } 304 }
330 305
331ASN1_STRING *ASN1_STRING_dup(str) 306ASN1_STRING *ASN1_STRING_dup(ASN1_STRING *str)
332ASN1_STRING *str;
333 { 307 {
334 ASN1_STRING *ret; 308 ASN1_STRING *ret;
335 309
@@ -341,34 +315,33 @@ ASN1_STRING *str;
341 ASN1_STRING_free(ret); 315 ASN1_STRING_free(ret);
342 return(NULL); 316 return(NULL);
343 } 317 }
318 ret->flags = str->flags;
344 return(ret); 319 return(ret);
345 } 320 }
346 321
347int ASN1_STRING_set(str,data,len) 322int ASN1_STRING_set(ASN1_STRING *str, const void *_data, int len)
348ASN1_STRING *str;
349unsigned char *data;
350int len;
351 { 323 {
352 char *c; 324 unsigned char *c;
325 const char *data=_data;
353 326
354 if (len < 0) 327 if (len < 0)
355 { 328 {
356 if (data == NULL) 329 if (data == NULL)
357 return(0); 330 return(0);
358 else 331 else
359 len=strlen((char *)data); 332 len=strlen(data);
360 } 333 }
361 if ((str->length < len) || (str->data == NULL)) 334 if ((str->length < len) || (str->data == NULL))
362 { 335 {
363 c=(char *)str->data; 336 c=str->data;
364 if (c == NULL) 337 if (c == NULL)
365 str->data=(unsigned char *)Malloc(len+1); 338 str->data=Malloc(len+1);
366 else 339 else
367 str->data=(unsigned char *)Realloc(c,len+1); 340 str->data=Realloc(c,len+1);
368 341
369 if (str->data == NULL) 342 if (str->data == NULL)
370 { 343 {
371 str->data=(unsigned char *)c; 344 str->data=c;
372 return(0); 345 return(0);
373 } 346 }
374 } 347 }
@@ -382,14 +355,13 @@ int len;
382 return(1); 355 return(1);
383 } 356 }
384 357
385ASN1_STRING *ASN1_STRING_new() 358ASN1_STRING *ASN1_STRING_new(void)
386 { 359 {
387 return(ASN1_STRING_type_new(V_ASN1_OCTET_STRING)); 360 return(ASN1_STRING_type_new(V_ASN1_OCTET_STRING));
388 } 361 }
389 362
390 363
391ASN1_STRING *ASN1_STRING_type_new(type) 364ASN1_STRING *ASN1_STRING_type_new(int type)
392int type;
393 { 365 {
394 ASN1_STRING *ret; 366 ASN1_STRING *ret;
395 367
@@ -402,19 +374,18 @@ int type;
402 ret->length=0; 374 ret->length=0;
403 ret->type=type; 375 ret->type=type;
404 ret->data=NULL; 376 ret->data=NULL;
377 ret->flags=0;
405 return(ret); 378 return(ret);
406 } 379 }
407 380
408void ASN1_STRING_free(a) 381void ASN1_STRING_free(ASN1_STRING *a)
409ASN1_STRING *a;
410 { 382 {
411 if (a == NULL) return; 383 if (a == NULL) return;
412 if (a->data != NULL) Free((char *)a->data); 384 if (a->data != NULL) Free((char *)a->data);
413 Free((char *)a); 385 Free((char *)a);
414 } 386 }
415 387
416int ASN1_STRING_cmp(a,b) 388int ASN1_STRING_cmp(ASN1_STRING *a, ASN1_STRING *b)
417ASN1_STRING *a,*b;
418 { 389 {
419 int i; 390 int i;
420 391
@@ -431,9 +402,7 @@ ASN1_STRING *a,*b;
431 return(i); 402 return(i);
432 } 403 }
433 404
434void asn1_add_error(address,offset) 405void asn1_add_error(unsigned char *address, int offset)
435unsigned char *address;
436int offset;
437 { 406 {
438 char buf1[16],buf2[16]; 407 char buf1[16],buf2[16];
439 408
diff --git a/src/lib/libcrypto/asn1/asn1_mac.h b/src/lib/libcrypto/asn1/asn1_mac.h
index 4fba70e4bb..93f9c5193c 100644
--- a/src/lib/libcrypto/asn1/asn1_mac.h
+++ b/src/lib/libcrypto/asn1/asn1_mac.h
@@ -63,18 +63,25 @@
63extern "C" { 63extern "C" {
64#endif 64#endif
65 65
66#include "asn1.h" 66#include <openssl/asn1.h>
67#include "x509.h" 67
68#include "pkcs7.h" 68#ifndef ASN1_MAC_ERR_LIB
69#define ASN1_MAC_ERR_LIB ERR_LIB_ASN1
70#endif
71
72#define ASN1_MAC_H_err(f,r,line) \
73 ERR_PUT_error(ASN1_MAC_ERR_LIB,(f),(r),ERR_file_name,(line))
69 74
70#define M_ASN1_D2I_vars(a,type,func) \ 75#define M_ASN1_D2I_vars(a,type,func) \
71 ASN1_CTX c; \ 76 ASN1_CTX c; \
72 type ret=NULL; \ 77 type ret=NULL; \
73 \ 78 \
74 c.pp=pp; \ 79 c.pp=pp; \
75 c.error=ASN1_R_ERROR_STACK; \ 80 c.q= *pp; \
81 c.error=ERR_R_NESTED_ASN1_ERROR; \
76 if ((a == NULL) || ((*a) == NULL)) \ 82 if ((a == NULL) || ((*a) == NULL)) \
77 { if ((ret=(type)func()) == NULL) goto err; } \ 83 { if ((ret=(type)func()) == NULL) \
84 { c.line=__LINE__; goto err; } } \
78 else ret=(*a); 85 else ret=(*a);
79 86
80#define M_ASN1_D2I_Init() \ 87#define M_ASN1_D2I_Init() \
@@ -82,7 +89,8 @@ extern "C" {
82 c.max=(length == 0)?0:(c.p+length); 89 c.max=(length == 0)?0:(c.p+length);
83 90
84#define M_ASN1_D2I_Finish_2(a) \ 91#define M_ASN1_D2I_Finish_2(a) \
85 if (!asn1_Finish(&c)) goto err; \ 92 if (!asn1_Finish(&c)) \
93 { c.line=__LINE__; goto err; } \
86 *pp=c.p; \ 94 *pp=c.p; \
87 if (a != NULL) (*a)=ret; \ 95 if (a != NULL) (*a)=ret; \
88 return(ret); 96 return(ret);
@@ -90,21 +98,31 @@ extern "C" {
90#define M_ASN1_D2I_Finish(a,func,e) \ 98#define M_ASN1_D2I_Finish(a,func,e) \
91 M_ASN1_D2I_Finish_2(a); \ 99 M_ASN1_D2I_Finish_2(a); \
92err:\ 100err:\
93 ASN1err((e),c.error); \ 101 ASN1_MAC_H_err((e),c.error,c.line); \
94 asn1_add_error(*pp,(int)(c.q- *pp)); \ 102 asn1_add_error(*pp,(int)(c.q- *pp)); \
95 if ((ret != NULL) && ((a == NULL) || (*a != ret))) func(ret); \ 103 if ((ret != NULL) && ((a == NULL) || (*a != ret))) func(ret); \
96 return(NULL) 104 return(NULL)
97 105
98#define M_ASN1_D2I_start_sequence() \ 106#define M_ASN1_D2I_start_sequence() \
99 if (!asn1_GetSequence(&c,&length)) goto err; 107 if (!asn1_GetSequence(&c,&length)) \
108 { c.line=__LINE__; goto err; }
100 109
101#define M_ASN1_D2I_end_sequence() \ 110#define M_ASN1_D2I_end_sequence() \
102 (((c.inf&1) == 0)?(c.slen <= 0): \ 111 (((c.inf&1) == 0)?(c.slen <= 0): \
103 (c.eos=ASN1_check_infinite_end(&c.p,c.slen))) 112 (c.eos=ASN1_check_infinite_end(&c.p,c.slen)))
104 113
114/* Don't use this with d2i_ASN1_BOOLEAN() */
105#define M_ASN1_D2I_get(b,func) \ 115#define M_ASN1_D2I_get(b,func) \
106 c.q=c.p; \ 116 c.q=c.p; \
107 if (func(&(b),&c.p,c.slen) == NULL) goto err; \ 117 if (func(&(b),&c.p,c.slen) == NULL) \
118 {c.line=__LINE__; goto err; } \
119 c.slen-=(c.p-c.q);
120
121/* use this instead () */
122#define M_ASN1_D2I_get_int(b,func) \
123 c.q=c.p; \
124 if (func(&(b),&c.p,c.slen) < 0) \
125 {c.line=__LINE__; goto err; } \
108 c.slen-=(c.p-c.q); 126 c.slen-=(c.p-c.q);
109 127
110#define M_ASN1_D2I_get_opt(b,func,type) \ 128#define M_ASN1_D2I_get_opt(b,func,type) \
@@ -114,49 +132,118 @@ err:\
114 M_ASN1_D2I_get(b,func); \ 132 M_ASN1_D2I_get(b,func); \
115 } 133 }
116 134
135#define M_ASN1_D2I_get_imp(b,func, type) \
136 M_ASN1_next=(_tmp& V_ASN1_CONSTRUCTED)|type; \
137 c.q=c.p; \
138 if (func(&(b),&c.p,c.slen) == NULL) \
139 {c.line=__LINE__; M_ASN1_next_prev = _tmp; goto err; } \
140 c.slen-=(c.p-c.q);\
141 M_ASN1_next_prev=_tmp;
142
117#define M_ASN1_D2I_get_IMP_opt(b,func,tag,type) \ 143#define M_ASN1_D2I_get_IMP_opt(b,func,tag,type) \
118 if ((c.slen != 0) && ((M_ASN1_next & (~V_ASN1_CONSTRUCTED)) == \ 144 if ((c.slen != 0) && ((M_ASN1_next & (~V_ASN1_CONSTRUCTED)) == \
119 (V_ASN1_CONTEXT_SPECIFIC|(tag)))) \ 145 (V_ASN1_CONTEXT_SPECIFIC|(tag)))) \
120 { \ 146 { \
121 unsigned char tmp; \ 147 unsigned char _tmp = M_ASN1_next; \
122 tmp=M_ASN1_next; \ 148 M_ASN1_D2I_get_imp(b,func, type);\
123 M_ASN1_next=(tmp& ~V_ASN1_PRIMATIVE_TAG)|type; \
124 M_ASN1_D2I_get(b,func); \
125 M_ASN1_next_prev=tmp; \
126 } 149 }
127 150
128#define M_ASN1_D2I_get_set(r,func) \ 151#define M_ASN1_D2I_get_set(r,func,free_func) \
129 M_ASN1_D2I_get_imp_set(r,func,V_ASN1_SET,V_ASN1_UNIVERSAL); 152 M_ASN1_D2I_get_imp_set(r,func,free_func, \
153 V_ASN1_SET,V_ASN1_UNIVERSAL);
154
155#define M_ASN1_D2I_get_set_type(type,r,func,free_func) \
156 M_ASN1_D2I_get_imp_set_type(type,r,func,free_func, \
157 V_ASN1_SET,V_ASN1_UNIVERSAL);
158
159#define M_ASN1_D2I_get_set_opt(r,func,free_func) \
160 if ((c.slen != 0) && (M_ASN1_next == (V_ASN1_UNIVERSAL| \
161 V_ASN1_CONSTRUCTED|V_ASN1_SET)))\
162 { M_ASN1_D2I_get_set(r,func,free_func); }
163
164#define M_ASN1_D2I_get_set_opt_type(type,r,func,free_func) \
165 if ((c.slen != 0) && (M_ASN1_next == (V_ASN1_UNIVERSAL| \
166 V_ASN1_CONSTRUCTED|V_ASN1_SET)))\
167 { M_ASN1_D2I_get_set_type(type,r,func,free_func); }
168
169#define M_ASN1_I2D_len_SET_opt(a,f) \
170 if ((a != NULL) && (sk_num(a) != 0)) \
171 M_ASN1_I2D_len_SET(a,f);
172
173#define M_ASN1_I2D_put_SET_opt(a,f) \
174 if ((a != NULL) && (sk_num(a) != 0)) \
175 M_ASN1_I2D_put_SET(a,f);
176
177#define M_ASN1_I2D_put_SEQUENCE_opt(a,f) \
178 if ((a != NULL) && (sk_num(a) != 0)) \
179 M_ASN1_I2D_put_SEQUENCE(a,f);
180
181#define M_ASN1_I2D_put_SEQUENCE_opt_type(type,a,f) \
182 if ((a != NULL) && (sk_##type##_num(a) != 0)) \
183 M_ASN1_I2D_put_SEQUENCE_type(type,a,f);
184
185#define M_ASN1_D2I_get_IMP_set_opt(b,func,free_func,tag) \
186 if ((c.slen != 0) && \
187 (M_ASN1_next == \
188 (V_ASN1_CONTEXT_SPECIFIC|V_ASN1_CONSTRUCTED|(tag))))\
189 { \
190 M_ASN1_D2I_get_imp_set(b,func,free_func,\
191 tag,V_ASN1_CONTEXT_SPECIFIC); \
192 }
130 193
131#define M_ASN1_D2I_get_IMP_set_opt(b,func,tag) \ 194#define M_ASN1_D2I_get_IMP_set_opt_type(type,b,func,free_func,tag) \
132 if ((c.slen != 0) && \ 195 if ((c.slen != 0) && \
133 (M_ASN1_next == \ 196 (M_ASN1_next == \
134 (V_ASN1_CONTEXT_SPECIFIC|V_ASN1_CONSTRUCTED|(tag))))\ 197 (V_ASN1_CONTEXT_SPECIFIC|V_ASN1_CONSTRUCTED|(tag))))\
135 { \ 198 { \
136 M_ASN1_D2I_get_imp_set(b,func,tag,V_ASN1_CONTEXT_SPECIFIC); \ 199 M_ASN1_D2I_get_imp_set_type(type,b,func,free_func,\
200 tag,V_ASN1_CONTEXT_SPECIFIC); \
137 } 201 }
138 202
139#define M_ASN1_D2I_get_seq(r,func) \ 203#define M_ASN1_D2I_get_seq(r,func,free_func) \
140 M_ASN1_D2I_get_imp_set(r,func,V_ASN1_SEQUENCE,V_ASN1_UNIVERSAL); 204 M_ASN1_D2I_get_imp_set(r,func,free_func,\
205 V_ASN1_SEQUENCE,V_ASN1_UNIVERSAL);
206
207#define M_ASN1_D2I_get_seq_type(type,r,func,free_func) \
208 M_ASN1_D2I_get_imp_set_type(type,r,func,free_func,\
209 V_ASN1_SEQUENCE,V_ASN1_UNIVERSAL)
141 210
142#define M_ASN1_D2I_get_seq_opt(r,func) \ 211#define M_ASN1_D2I_get_seq_opt(r,func,free_func) \
143 if ((c.slen != 0) && (M_ASN1_next == (V_ASN1_UNIVERSAL| \ 212 if ((c.slen != 0) && (M_ASN1_next == (V_ASN1_UNIVERSAL| \
144 V_ASN1_CONSTRUCTED|V_ASN1_SEQUENCE)))\ 213 V_ASN1_CONSTRUCTED|V_ASN1_SEQUENCE)))\
145 { M_ASN1_D2I_get_seq(r,func); } 214 { M_ASN1_D2I_get_seq(r,func,free_func); }
146 215
147#define M_ASN1_D2I_get_IMP_set(r,func,x) \ 216#define M_ASN1_D2I_get_seq_opt_type(type,r,func,free_func) \
148 M_ASN1_D2I_get_imp_set(r,func,x,V_ASN1_CONTEXT_SPECIFIC); 217 if ((c.slen != 0) && (M_ASN1_next == (V_ASN1_UNIVERSAL| \
218 V_ASN1_CONSTRUCTED|V_ASN1_SEQUENCE)))\
219 { M_ASN1_D2I_get_seq_type(type,r,func,free_func); }
220
221#define M_ASN1_D2I_get_IMP_set(r,func,free_func,x) \
222 M_ASN1_D2I_get_imp_set(r,func,free_func,\
223 x,V_ASN1_CONTEXT_SPECIFIC);
149 224
150#define M_ASN1_D2I_get_imp_set(r,func,a,b) \ 225#define M_ASN1_D2I_get_IMP_set_type(type,r,func,free_func,x) \
226 M_ASN1_D2I_get_imp_set_type(type,r,func,free_func,\
227 x,V_ASN1_CONTEXT_SPECIFIC);
228
229#define M_ASN1_D2I_get_imp_set(r,func,free_func,a,b) \
151 c.q=c.p; \ 230 c.q=c.p; \
152 if (d2i_ASN1_SET(&(r),&c.p,c.slen,(char *(*)())func,a,b) == NULL) \ 231 if (d2i_ASN1_SET(&(r),&c.p,c.slen,(char *(*)())func,\
153 goto err; \ 232 (void (*)())free_func,a,b) == NULL) \
233 { c.line=__LINE__; goto err; } \
234 c.slen-=(c.p-c.q);
235
236#define M_ASN1_D2I_get_imp_set_type(type,r,func,free_func,a,b) \
237 c.q=c.p; \
238 if (d2i_ASN1_SET_OF_##type(&(r),&c.p,c.slen,func,\
239 free_func,a,b) == NULL) \
240 { c.line=__LINE__; goto err; } \
154 c.slen-=(c.p-c.q); 241 c.slen-=(c.p-c.q);
155 242
156#define M_ASN1_D2I_get_set_strings(r,func,a,b) \ 243#define M_ASN1_D2I_get_set_strings(r,func,a,b) \
157 c.q=c.p; \ 244 c.q=c.p; \
158 if (d2i_ASN1_STRING_SET(&(r),&c.p,c.slen,a,b) == NULL) \ 245 if (d2i_ASN1_STRING_SET(&(r),&c.p,c.slen,a,b) == NULL) \
159 goto err; \ 246 { c.line=__LINE__; goto err; } \
160 c.slen-=(c.p-c.q); 247 c.slen-=(c.p-c.q);
161 248
162#define M_ASN1_D2I_get_EXP_opt(r,func,tag) \ 249#define M_ASN1_D2I_get_EXP_opt(r,func,tag) \
@@ -169,13 +256,22 @@ err:\
169 c.q=c.p; \ 256 c.q=c.p; \
170 Tinf=ASN1_get_object(&c.p,&Tlen,&Ttag,&Tclass,c.slen); \ 257 Tinf=ASN1_get_object(&c.p,&Tlen,&Ttag,&Tclass,c.slen); \
171 if (Tinf & 0x80) \ 258 if (Tinf & 0x80) \
172 { c.error=ASN1_R_BAD_OBJECT_HEADER; goto err; } \ 259 { c.error=ERR_R_BAD_ASN1_OBJECT_HEADER; \
260 c.line=__LINE__; goto err; } \
261 if (Tinf == (V_ASN1_CONSTRUCTED+1)) \
262 Tlen = c.slen - (c.p - c.q) - 2; \
173 if (func(&(r),&c.p,Tlen) == NULL) \ 263 if (func(&(r),&c.p,Tlen) == NULL) \
174 goto err; \ 264 { c.line=__LINE__; goto err; } \
265 if (Tinf == (V_ASN1_CONSTRUCTED+1)) { \
266 Tlen = c.slen - (c.p - c.q); \
267 if(!ASN1_check_infinite_end(&c.p, Tlen)) \
268 { c.error=ERR_R_MISSING_ASN1_EOS; \
269 c.line=__LINE__; goto err; } \
270 }\
175 c.slen-=(c.p-c.q); \ 271 c.slen-=(c.p-c.q); \
176 } 272 }
177 273
178#define M_ASN1_D2I_get_EXP_set_opt(r,func,tag,b) \ 274#define M_ASN1_D2I_get_EXP_set_opt(r,func,free_func,tag,b) \
179 if ((c.slen != 0) && (M_ASN1_next == \ 275 if ((c.slen != 0) && (M_ASN1_next == \
180 (V_ASN1_CONSTRUCTED|V_ASN1_CONTEXT_SPECIFIC|tag))) \ 276 (V_ASN1_CONSTRUCTED|V_ASN1_CONTEXT_SPECIFIC|tag))) \
181 { \ 277 { \
@@ -185,24 +281,61 @@ err:\
185 c.q=c.p; \ 281 c.q=c.p; \
186 Tinf=ASN1_get_object(&c.p,&Tlen,&Ttag,&Tclass,c.slen); \ 282 Tinf=ASN1_get_object(&c.p,&Tlen,&Ttag,&Tclass,c.slen); \
187 if (Tinf & 0x80) \ 283 if (Tinf & 0x80) \
188 { c.error=ASN1_R_BAD_OBJECT_HEADER; goto err; } \ 284 { c.error=ERR_R_BAD_ASN1_OBJECT_HEADER; \
285 c.line=__LINE__; goto err; } \
286 if (Tinf == (V_ASN1_CONSTRUCTED+1)) \
287 Tlen = c.slen - (c.p - c.q) - 2; \
189 if (d2i_ASN1_SET(&(r),&c.p,Tlen,(char *(*)())func, \ 288 if (d2i_ASN1_SET(&(r),&c.p,Tlen,(char *(*)())func, \
289 (void (*)())free_func, \
190 b,V_ASN1_UNIVERSAL) == NULL) \ 290 b,V_ASN1_UNIVERSAL) == NULL) \
191 goto err; \ 291 { c.line=__LINE__; goto err; } \
292 if (Tinf == (V_ASN1_CONSTRUCTED+1)) { \
293 Tlen = c.slen - (c.p - c.q); \
294 if(!ASN1_check_infinite_end(&c.p, Tlen)) \
295 { c.error=ERR_R_MISSING_ASN1_EOS; \
296 c.line=__LINE__; goto err; } \
297 }\
298 c.slen-=(c.p-c.q); \
299 }
300
301#define M_ASN1_D2I_get_EXP_set_opt_type(type,r,func,free_func,tag,b) \
302 if ((c.slen != 0) && (M_ASN1_next == \
303 (V_ASN1_CONSTRUCTED|V_ASN1_CONTEXT_SPECIFIC|tag))) \
304 { \
305 int Tinf,Ttag,Tclass; \
306 long Tlen; \
307 \
308 c.q=c.p; \
309 Tinf=ASN1_get_object(&c.p,&Tlen,&Ttag,&Tclass,c.slen); \
310 if (Tinf & 0x80) \
311 { c.error=ERR_R_BAD_ASN1_OBJECT_HEADER; \
312 c.line=__LINE__; goto err; } \
313 if (Tinf == (V_ASN1_CONSTRUCTED+1)) \
314 Tlen = c.slen - (c.p - c.q) - 2; \
315 if (d2i_ASN1_SET_OF_##type(&(r),&c.p,Tlen,func, \
316 free_func,b,V_ASN1_UNIVERSAL) == NULL) \
317 { c.line=__LINE__; goto err; } \
318 if (Tinf == (V_ASN1_CONSTRUCTED+1)) { \
319 Tlen = c.slen - (c.p - c.q); \
320 if(!ASN1_check_infinite_end(&c.p, Tlen)) \
321 { c.error=ERR_R_MISSING_ASN1_EOS; \
322 c.line=__LINE__; goto err; } \
323 }\
192 c.slen-=(c.p-c.q); \ 324 c.slen-=(c.p-c.q); \
193 } 325 }
194 326
195/* New macros */ 327/* New macros */
196#define M_ASN1_New_Malloc(ret,type) \ 328#define M_ASN1_New_Malloc(ret,type) \
197 if ((ret=(type *)Malloc(sizeof(type))) == NULL) goto err2; 329 if ((ret=(type *)Malloc(sizeof(type))) == NULL) \
330 { c.line=__LINE__; goto err2; }
198 331
199#define M_ASN1_New(arg,func) \ 332#define M_ASN1_New(arg,func) \
200 if (((arg)=func()) == NULL) return(NULL) 333 if (((arg)=func()) == NULL) return(NULL)
201 334
202#define M_ASN1_New_Error(a) \ 335#define M_ASN1_New_Error(a) \
203/* err: ASN1err((a),ASN1_R_ERROR_STACK); \ 336/* err: ASN1_MAC_H_err((a),ERR_R_NESTED_ASN1_ERROR,c.line); \
204 return(NULL);*/ \ 337 return(NULL);*/ \
205 err2: ASN1err((a),ERR_R_MALLOC_FAILURE); \ 338 err2: ASN1_MAC_H_err((a),ERR_R_MALLOC_FAILURE,c.line); \
206 return(NULL) 339 return(NULL)
207 340
208 341
@@ -220,21 +353,59 @@ err:\
220#define M_ASN1_I2D_len_IMP_opt(a,f) if (a != NULL) M_ASN1_I2D_len(a,f) 353#define M_ASN1_I2D_len_IMP_opt(a,f) if (a != NULL) M_ASN1_I2D_len(a,f)
221 354
222#define M_ASN1_I2D_len_SET(a,f) \ 355#define M_ASN1_I2D_len_SET(a,f) \
223 ret+=i2d_ASN1_SET(a,NULL,f,V_ASN1_SET,V_ASN1_UNIVERSAL); 356 ret+=i2d_ASN1_SET(a,NULL,f,V_ASN1_SET,V_ASN1_UNIVERSAL,IS_SET);
224 357
225#define M_ASN1_I2D_len_SEQ(a,f) \ 358#define M_ASN1_I2D_len_SET_type(type,a,f) \
226 ret+=i2d_ASN1_SET(a,NULL,f,V_ASN1_SEQUENCE,V_ASN1_UNIVERSAL); 359 ret+=i2d_ASN1_SET_OF_##type(a,NULL,f,V_ASN1_SET, \
360 V_ASN1_UNIVERSAL,IS_SET);
227 361
228#define M_ASN1_I2D_len_SEQ_opt(a,f) \ 362#define M_ASN1_I2D_len_SEQUENCE(a,f) \
363 ret+=i2d_ASN1_SET(a,NULL,f,V_ASN1_SEQUENCE,V_ASN1_UNIVERSAL, \
364 IS_SEQUENCE);
365
366#define M_ASN1_I2D_len_SEQUENCE_type(type,a,f) \
367 ret+=i2d_ASN1_SET_OF_##type(a,NULL,f,V_ASN1_SEQUENCE, \
368 V_ASN1_UNIVERSAL,IS_SEQUENCE)
369
370#define M_ASN1_I2D_len_SEQUENCE_opt(a,f) \
229 if ((a != NULL) && (sk_num(a) != 0)) \ 371 if ((a != NULL) && (sk_num(a) != 0)) \
230 M_ASN1_I2D_len_SEQ(a,f); 372 M_ASN1_I2D_len_SEQUENCE(a,f);
373
374#define M_ASN1_I2D_len_SEQUENCE_opt_type(type,a,f) \
375 if ((a != NULL) && (sk_##type##_num(a) != 0)) \
376 M_ASN1_I2D_len_SEQUENCE_type(type,a,f);
231 377
232#define M_ASN1_I2D_len_IMP_set(a,f,x) \ 378#define M_ASN1_I2D_len_IMP_SET(a,f,x) \
233 ret+=i2d_ASN1_SET(a,NULL,f,x,V_ASN1_CONTEXT_SPECIFIC); 379 ret+=i2d_ASN1_SET(a,NULL,f,x,V_ASN1_CONTEXT_SPECIFIC,IS_SET);
234 380
235#define M_ASN1_I2D_len_IMP_set_opt(a,f,x) \ 381#define M_ASN1_I2D_len_IMP_SET_type(type,a,f,x) \
382 ret+=i2d_ASN1_SET_OF_##type(a,NULL,f,x, \
383 V_ASN1_CONTEXT_SPECIFIC,IS_SET);
384
385#define M_ASN1_I2D_len_IMP_SET_opt(a,f,x) \
236 if ((a != NULL) && (sk_num(a) != 0)) \ 386 if ((a != NULL) && (sk_num(a) != 0)) \
237 ret+=i2d_ASN1_SET(a,NULL,f,x,V_ASN1_CONTEXT_SPECIFIC); 387 ret+=i2d_ASN1_SET(a,NULL,f,x,V_ASN1_CONTEXT_SPECIFIC, \
388 IS_SET);
389
390#define M_ASN1_I2D_len_IMP_SET_opt_type(type,a,f,x) \
391 if ((a != NULL) && (sk_##type##_num(a) != 0)) \
392 ret+=i2d_ASN1_SET_OF_##type(a,NULL,f,x, \
393 V_ASN1_CONTEXT_SPECIFIC,IS_SET);
394
395#define M_ASN1_I2D_len_IMP_SEQUENCE(a,f,x) \
396 ret+=i2d_ASN1_SET(a,NULL,f,x,V_ASN1_CONTEXT_SPECIFIC, \
397 IS_SEQUENCE);
398
399#define M_ASN1_I2D_len_IMP_SEQUENCE_opt(a,f,x) \
400 if ((a != NULL) && (sk_num(a) != 0)) \
401 ret+=i2d_ASN1_SET(a,NULL,f,x,V_ASN1_CONTEXT_SPECIFIC, \
402 IS_SEQUENCE);
403
404#define M_ASN1_I2D_len_IMP_SEQUENCE_opt_type(type,a,f,x) \
405 if ((a != NULL) && (sk_##type##_num(a) != 0)) \
406 ret+=i2d_ASN1_SET_OF_##type(a,NULL,f,x, \
407 V_ASN1_CONTEXT_SPECIFIC, \
408 IS_SEQUENCE);
238 409
239#define M_ASN1_I2D_len_EXP_opt(a,f,mtag,v) \ 410#define M_ASN1_I2D_len_EXP_opt(a,f,mtag,v) \
240 if (a != NULL)\ 411 if (a != NULL)\
@@ -243,10 +414,27 @@ err:\
243 ret+=ASN1_object_size(1,v,mtag); \ 414 ret+=ASN1_object_size(1,v,mtag); \
244 } 415 }
245 416
246#define M_ASN1_I2D_len_EXP_set_opt(a,f,mtag,tag,v) \ 417#define M_ASN1_I2D_len_EXP_SET_opt(a,f,mtag,tag,v) \
418 if ((a != NULL) && (sk_num(a) != 0))\
419 { \
420 v=i2d_ASN1_SET(a,NULL,f,tag,V_ASN1_UNIVERSAL,IS_SET); \
421 ret+=ASN1_object_size(1,v,mtag); \
422 }
423
424#define M_ASN1_I2D_len_EXP_SEQUENCE_opt(a,f,mtag,tag,v) \
247 if ((a != NULL) && (sk_num(a) != 0))\ 425 if ((a != NULL) && (sk_num(a) != 0))\
248 { \ 426 { \
249 v=i2d_ASN1_SET(a,NULL,f,tag,V_ASN1_UNIVERSAL); \ 427 v=i2d_ASN1_SET(a,NULL,f,tag,V_ASN1_UNIVERSAL, \
428 IS_SEQUENCE); \
429 ret+=ASN1_object_size(1,v,mtag); \
430 }
431
432#define M_ASN1_I2D_len_EXP_SEQUENCE_opt_type(type,a,f,mtag,tag,v) \
433 if ((a != NULL) && (sk_##type##_num(a) != 0))\
434 { \
435 v=i2d_ASN1_SET_OF_##type(a,NULL,f,tag, \
436 V_ASN1_UNIVERSAL, \
437 IS_SEQUENCE); \
250 ret+=ASN1_object_size(1,v,mtag); \ 438 ret+=ASN1_object_size(1,v,mtag); \
251 } 439 }
252 440
@@ -262,20 +450,48 @@ err:\
262 } 450 }
263 451
264#define M_ASN1_I2D_put_SET(a,f) i2d_ASN1_SET(a,&p,f,V_ASN1_SET,\ 452#define M_ASN1_I2D_put_SET(a,f) i2d_ASN1_SET(a,&p,f,V_ASN1_SET,\
265 V_ASN1_UNIVERSAL) 453 V_ASN1_UNIVERSAL,IS_SET)
266#define M_ASN1_I2D_put_IMP_set(a,f,x) i2d_ASN1_SET(a,&p,f,x,\ 454#define M_ASN1_I2D_put_SET_type(type,a,f) \
267 V_ASN1_CONTEXT_SPECIFIC) 455 i2d_ASN1_SET_OF_##type(a,&p,f,V_ASN1_SET,V_ASN1_UNIVERSAL,IS_SET)
268 456#define M_ASN1_I2D_put_IMP_SET(a,f,x) i2d_ASN1_SET(a,&p,f,x,\
269#define M_ASN1_I2D_put_SEQ(a,f) i2d_ASN1_SET(a,&p,f,V_ASN1_SEQUENCE,\ 457 V_ASN1_CONTEXT_SPECIFIC,IS_SET)
270 V_ASN1_UNIVERSAL) 458#define M_ASN1_I2D_put_IMP_SET_type(type,a,f,x) \
459 i2d_ASN1_SET_OF_##type(a,&p,f,x,V_ASN1_CONTEXT_SPECIFIC,IS_SET)
460#define M_ASN1_I2D_put_IMP_SEQUENCE(a,f,x) i2d_ASN1_SET(a,&p,f,x,\
461 V_ASN1_CONTEXT_SPECIFIC,IS_SEQUENCE)
462
463#define M_ASN1_I2D_put_SEQUENCE(a,f) i2d_ASN1_SET(a,&p,f,V_ASN1_SEQUENCE,\
464 V_ASN1_UNIVERSAL,IS_SEQUENCE)
465
466#define M_ASN1_I2D_put_SEQUENCE_type(type,a,f) \
467 i2d_ASN1_SET_OF_##type(a,&p,f,V_ASN1_SEQUENCE,V_ASN1_UNIVERSAL, \
468 IS_SEQUENCE)
469
470#define M_ASN1_I2D_put_SEQUENCE_opt(a,f) \
471 if ((a != NULL) && (sk_num(a) != 0)) \
472 M_ASN1_I2D_put_SEQUENCE(a,f);
271 473
272#define M_ASN1_I2D_put_SEQ_opt(a,f) \ 474#define M_ASN1_I2D_put_IMP_SET_opt(a,f,x) \
273 if ((a != NULL) && (sk_num(a) != 0)) \ 475 if ((a != NULL) && (sk_num(a) != 0)) \
274 M_ASN1_I2D_put_SEQ(a,f); 476 { i2d_ASN1_SET(a,&p,f,x,V_ASN1_CONTEXT_SPECIFIC, \
477 IS_SET); }
478
479#define M_ASN1_I2D_put_IMP_SET_opt_type(type,a,f,x) \
480 if ((a != NULL) && (sk_##type##_num(a) != 0)) \
481 { i2d_ASN1_SET_OF_##type(a,&p,f,x, \
482 V_ASN1_CONTEXT_SPECIFIC, \
483 IS_SET); }
275 484
276#define M_ASN1_I2D_put_IMP_set_opt(a,f,x) \ 485#define M_ASN1_I2D_put_IMP_SEQUENCE_opt(a,f,x) \
277 if ((a != NULL) && (sk_num(a) != 0)) \ 486 if ((a != NULL) && (sk_num(a) != 0)) \
278 { i2d_ASN1_SET(a,&p,f,x,V_ASN1_CONTEXT_SPECIFIC); } 487 { i2d_ASN1_SET(a,&p,f,x,V_ASN1_CONTEXT_SPECIFIC, \
488 IS_SEQUENCE); }
489
490#define M_ASN1_I2D_put_IMP_SEQUENCE_opt_type(type,a,f,x) \
491 if ((a != NULL) && (sk_##type##_num(a) != 0)) \
492 { i2d_ASN1_SET_OF_##type(a,&p,f,x, \
493 V_ASN1_CONTEXT_SPECIFIC, \
494 IS_SEQUENCE); }
279 495
280#define M_ASN1_I2D_put_EXP_opt(a,f,tag,v) \ 496#define M_ASN1_I2D_put_EXP_opt(a,f,tag,v) \
281 if (a != NULL) \ 497 if (a != NULL) \
@@ -284,11 +500,26 @@ err:\
284 f(a,&p); \ 500 f(a,&p); \
285 } 501 }
286 502
287#define M_ASN1_I2D_put_EXP_set_opt(a,f,mtag,tag,v) \ 503#define M_ASN1_I2D_put_EXP_SET_opt(a,f,mtag,tag,v) \
288 if ((a != NULL) && (sk_num(a) != 0)) \ 504 if ((a != NULL) && (sk_num(a) != 0)) \
289 { \ 505 { \
290 ASN1_put_object(&p,1,v,mtag,V_ASN1_CONTEXT_SPECIFIC); \ 506 ASN1_put_object(&p,1,v,mtag,V_ASN1_CONTEXT_SPECIFIC); \
291 i2d_ASN1_SET(a,&p,f,tag,V_ASN1_UNIVERSAL); \ 507 i2d_ASN1_SET(a,&p,f,tag,V_ASN1_UNIVERSAL,IS_SET); \
508 }
509
510#define M_ASN1_I2D_put_EXP_SEQUENCE_opt(a,f,mtag,tag,v) \
511 if ((a != NULL) && (sk_num(a) != 0)) \
512 { \
513 ASN1_put_object(&p,1,v,mtag,V_ASN1_CONTEXT_SPECIFIC); \
514 i2d_ASN1_SET(a,&p,f,tag,V_ASN1_UNIVERSAL,IS_SEQUENCE); \
515 }
516
517#define M_ASN1_I2D_put_EXP_SEQUENCE_opt_type(type,a,f,mtag,tag,v) \
518 if ((a != NULL) && (sk_##type##_num(a) != 0)) \
519 { \
520 ASN1_put_object(&p,1,v,mtag,V_ASN1_CONTEXT_SPECIFIC); \
521 i2d_ASN1_SET_OF_##type(a,&p,f,tag,V_ASN1_UNIVERSAL, \
522 IS_SEQUENCE); \
292 } 523 }
293 524
294#define M_ASN1_I2D_seq_total() \ 525#define M_ASN1_I2D_seq_total() \
@@ -306,14 +537,8 @@ err:\
306#define M_ASN1_I2D_finish() *pp=p; \ 537#define M_ASN1_I2D_finish() *pp=p; \
307 return(r); 538 return(r);
308 539
309#ifndef NOPROTO
310int asn1_GetSequence(ASN1_CTX *c, long *length); 540int asn1_GetSequence(ASN1_CTX *c, long *length);
311void asn1_add_error(unsigned char *address,int offset); 541void asn1_add_error(unsigned char *address,int offset);
312#else
313int asn1_GetSequence();
314void asn1_add_error();
315#endif
316
317#ifdef __cplusplus 542#ifdef __cplusplus
318} 543}
319#endif 544#endif
diff --git a/src/lib/libcrypto/asn1/asn1_par.c b/src/lib/libcrypto/asn1/asn1_par.c
index 3906227d21..86886606ef 100644
--- a/src/lib/libcrypto/asn1/asn1_par.c
+++ b/src/lib/libcrypto/asn1/asn1_par.c
@@ -58,30 +58,21 @@
58 58
59#include <stdio.h> 59#include <stdio.h>
60#include "cryptlib.h" 60#include "cryptlib.h"
61#include "buffer.h" 61#include <openssl/buffer.h>
62#include "objects.h" 62#include <openssl/objects.h>
63#include "x509.h" 63#include <openssl/asn1.h>
64 64
65#ifndef NOPROTO
66static int asn1_print_info(BIO *bp, int tag, int xclass,int constructed, 65static int asn1_print_info(BIO *bp, int tag, int xclass,int constructed,
67 int indent); 66 int indent);
68static int asn1_parse2(BIO *bp, unsigned char **pp, long length, 67static int asn1_parse2(BIO *bp, unsigned char **pp, long length,
69 int offset, int depth, int indent); 68 int offset, int depth, int indent);
70#else 69static int asn1_print_info(BIO *bp, int tag, int xclass, int constructed,
71static int asn1_print_info(); 70 int indent)
72static int asn1_parse2();
73#endif
74
75static int asn1_print_info(bp, tag, xclass, constructed,indent)
76BIO *bp;
77int tag;
78int xclass;
79int constructed;
80int indent;
81 { 71 {
82 static char *fmt="%-18s"; 72 static const char fmt[]="%-18s";
83 static char *fmt2="%2d %-15s"; 73 static const char fmt2[]="%2d %-15s";
84 char *p,str[128],*p2=NULL; 74 char str[128];
75 const char *p,*p2=NULL;
85 76
86 if (constructed & V_ASN1_CONSTRUCTED) 77 if (constructed & V_ASN1_CONSTRUCTED)
87 p="cons: "; 78 p="cons: ";
@@ -108,6 +99,8 @@ int indent;
108 p="BOOLEAN"; 99 p="BOOLEAN";
109 else if (tag == V_ASN1_INTEGER) 100 else if (tag == V_ASN1_INTEGER)
110 p="INTEGER"; 101 p="INTEGER";
102 else if (tag == V_ASN1_ENUMERATED)
103 p="ENUMERATED";
111 else if (tag == V_ASN1_BIT_STRING) 104 else if (tag == V_ASN1_BIT_STRING)
112 p="BIT STRING"; 105 p="BIT STRING";
113 else if (tag == V_ASN1_OCTET_STRING) 106 else if (tag == V_ASN1_OCTET_STRING)
@@ -138,8 +131,8 @@ int indent;
138 p="GENERALIZEDTIME"; 131 p="GENERALIZEDTIME";
139 else if (tag == V_ASN1_GRAPHICSTRING) 132 else if (tag == V_ASN1_GRAPHICSTRING)
140 p="GRAPHICSTRING"; 133 p="GRAPHICSTRING";
141 else if (tag == V_ASN1_ISO64STRING) 134 else if (tag == V_ASN1_VISIBLESTRING)
142 p="ISO64STRING"; 135 p="VISIBLESTRING";
143 else if (tag == V_ASN1_GENERALSTRING) 136 else if (tag == V_ASN1_GENERALSTRING)
144 p="GENERALSTRING"; 137 p="GENERALSTRING";
145 else if (tag == V_ASN1_UNIVERSALSTRING) 138 else if (tag == V_ASN1_UNIVERSALSTRING)
@@ -162,22 +155,13 @@ err:
162 return(0); 155 return(0);
163 } 156 }
164 157
165int ASN1_parse(bp, pp, len, indent) 158int ASN1_parse(BIO *bp, unsigned char *pp, long len, int indent)
166BIO *bp;
167unsigned char *pp;
168long len;
169int indent;
170 { 159 {
171 return(asn1_parse2(bp,&pp,len,0,0,indent)); 160 return(asn1_parse2(bp,&pp,len,0,0,indent));
172 } 161 }
173 162
174static int asn1_parse2(bp, pp, length, offset, depth, indent) 163static int asn1_parse2(BIO *bp, unsigned char **pp, long length, int offset,
175BIO *bp; 164 int depth, int indent)
176unsigned char **pp;
177long length;
178int offset;
179int depth;
180int indent;
181 { 165 {
182 unsigned char *p,*ep,*tot,*op,*opp; 166 unsigned char *p,*ep,*tot,*op,*opp;
183 long len; 167 long len;
@@ -266,7 +250,9 @@ int indent;
266 if ( (tag == V_ASN1_PRINTABLESTRING) || 250 if ( (tag == V_ASN1_PRINTABLESTRING) ||
267 (tag == V_ASN1_T61STRING) || 251 (tag == V_ASN1_T61STRING) ||
268 (tag == V_ASN1_IA5STRING) || 252 (tag == V_ASN1_IA5STRING) ||
269 (tag == V_ASN1_UTCTIME)) 253 (tag == V_ASN1_VISIBLESTRING) ||
254 (tag == V_ASN1_UTCTIME) ||
255 (tag == V_ASN1_GENERALIZEDTIME))
270 { 256 {
271 if (BIO_write(bp,":",1) <= 0) goto end; 257 if (BIO_write(bp,":",1) <= 0) goto end;
272 if ((len > 0) && 258 if ((len > 0) &&
@@ -370,6 +356,38 @@ int indent;
370 } 356 }
371 ASN1_INTEGER_free(bs); 357 ASN1_INTEGER_free(bs);
372 } 358 }
359 else if (tag == V_ASN1_ENUMERATED)
360 {
361 ASN1_ENUMERATED *bs;
362 int i;
363
364 opp=op;
365 bs=d2i_ASN1_ENUMERATED(NULL,&opp,len+hl);
366 if (bs != NULL)
367 {
368 if (BIO_write(bp,":",1) <= 0) goto end;
369 if (bs->type == V_ASN1_NEG_ENUMERATED)
370 if (BIO_write(bp,"-",1) <= 0)
371 goto end;
372 for (i=0; i<bs->length; i++)
373 {
374 if (BIO_printf(bp,"%02X",
375 bs->data[i]) <= 0)
376 goto end;
377 }
378 if (bs->length == 0)
379 {
380 if (BIO_write(bp,"00",2) <= 0)
381 goto end;
382 }
383 }
384 else
385 {
386 if (BIO_write(bp,"BAD ENUMERATED",11) <= 0)
387 goto end;
388 }
389 ASN1_ENUMERATED_free(bs);
390 }
373 391
374 if (!nl) 392 if (!nl)
375 { 393 {
diff --git a/src/lib/libcrypto/asn1/asn_pack.c b/src/lib/libcrypto/asn1/asn_pack.c
new file mode 100644
index 0000000000..662a2626a1
--- /dev/null
+++ b/src/lib/libcrypto/asn1/asn_pack.c
@@ -0,0 +1,145 @@
1/* asn_pack.c */
2/* Written by Dr Stephen N Henson (shenson@bigfoot.com) for the OpenSSL
3 * project 1999.
4 */
5/* ====================================================================
6 * Copyright (c) 1999 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/asn1.h>
62
63/* ASN1 packing and unpacking functions */
64
65/* Turn an ASN1 encoded SEQUENCE OF into a STACK of structures */
66
67STACK *ASN1_seq_unpack(unsigned char *buf, int len, char *(*d2i)(),
68 void (*free_func)())
69{
70 STACK *sk;
71 unsigned char *pbuf;
72 pbuf = buf;
73 if (!(sk = d2i_ASN1_SET(NULL, &pbuf, len, d2i, free_func,
74 V_ASN1_SEQUENCE, V_ASN1_UNIVERSAL)))
75 ASN1err(ASN1_F_ASN1_SEQ_UNPACK,ASN1_R_DECODE_ERROR);
76 return sk;
77}
78
79/* Turn a STACK structures into an ASN1 encoded SEQUENCE OF structure in a
80 * Malloc'ed buffer
81 */
82
83unsigned char *ASN1_seq_pack(STACK *safes, int (*i2d)(), unsigned char **buf,
84 int *len)
85{
86 int safelen;
87 unsigned char *safe, *p;
88 if (!(safelen = i2d_ASN1_SET(safes, NULL, i2d, V_ASN1_SEQUENCE,
89 V_ASN1_UNIVERSAL, IS_SEQUENCE))) {
90 ASN1err(ASN1_F_ASN1_SEQ_PACK,ASN1_R_ENCODE_ERROR);
91 return NULL;
92 }
93 if (!(safe = Malloc (safelen))) {
94 ASN1err(ASN1_F_ASN1_SEQ_PACK,ERR_R_MALLOC_FAILURE);
95 return NULL;
96 }
97 p = safe;
98 i2d_ASN1_SET(safes, &p, i2d, V_ASN1_SEQUENCE, V_ASN1_UNIVERSAL,
99 IS_SEQUENCE);
100 if (len) *len = safelen;
101 if (buf) *buf = safe;
102 return safe;
103}
104
105/* Extract an ASN1 object from an ASN1_STRING */
106
107void *ASN1_unpack_string (ASN1_STRING *oct, char *(*d2i)())
108{
109 unsigned char *p;
110 char *ret;
111
112 p = oct->data;
113 if(!(ret = d2i(NULL, &p, oct->length)))
114 ASN1err(ASN1_F_ASN1_UNPACK_STRING,ASN1_R_DECODE_ERROR);
115 return ret;
116}
117
118/* Pack an ASN1 object into an ASN1_STRING */
119
120ASN1_STRING *ASN1_pack_string (void *obj, int (*i2d)(), ASN1_STRING **oct)
121{
122 unsigned char *p;
123 ASN1_STRING *octmp;
124
125 if (!oct || !*oct) {
126 if (!(octmp = ASN1_STRING_new ())) {
127 ASN1err(ASN1_F_ASN1_PACK_STRING,ERR_R_MALLOC_FAILURE);
128 return NULL;
129 }
130 if (oct) *oct = octmp;
131 } else octmp = *oct;
132
133 if (!(octmp->length = i2d(obj, NULL))) {
134 ASN1err(ASN1_F_ASN1_PACK_STRING,ASN1_R_ENCODE_ERROR);
135 return NULL;
136 }
137 if (!(p = Malloc (octmp->length))) {
138 ASN1err(ASN1_F_ASN1_PACK_STRING,ERR_R_MALLOC_FAILURE);
139 return NULL;
140 }
141 octmp->data = p;
142 i2d (obj, &p);
143 return octmp;
144}
145
diff --git a/src/lib/libcrypto/asn1/d2i_dhp.c b/src/lib/libcrypto/asn1/d2i_dhp.c
index 616a308100..a077211a4c 100644
--- a/src/lib/libcrypto/asn1/d2i_dhp.c
+++ b/src/lib/libcrypto/asn1/d2i_dhp.c
@@ -56,24 +56,17 @@
56 * [including the GNU Public Licence.] 56 * [including the GNU Public Licence.]
57 */ 57 */
58 58
59#ifndef NO_DH
59#include <stdio.h> 60#include <stdio.h>
60#include "cryptlib.h" 61#include "cryptlib.h"
61#include "bn.h" 62#include <openssl/bn.h>
62#include "dh.h" 63#include <openssl/dh.h>
63#include "objects.h" 64#include <openssl/objects.h>
64#include "asn1_mac.h" 65#include <openssl/asn1_mac.h>
65 66
66/* 67DH *d2i_DHparams(DH **a, unsigned char **pp, long length)
67 * ASN1err(ASN1_F_D2I_DHPARAMS,ASN1_R_LENGTH_MISMATCH);
68 * ASN1err(ASN1_F_I2D_DHPARAMS,ASN1_R_UNKNOWN_ATTRIBUTE_TYPE);
69 */
70
71DH *d2i_DHparams(a,pp,length)
72DH **a;
73unsigned char **pp;
74long length;
75 { 68 {
76 int i=ASN1_R_ERROR_STACK; 69 int i=ERR_R_NESTED_ASN1_ERROR;
77 ASN1_INTEGER *bs=NULL; 70 ASN1_INTEGER *bs=NULL;
78 long v=0; 71 long v=0;
79 M_ASN1_D2I_vars(a,DH *,DH_new); 72 M_ASN1_D2I_vars(a,DH *,DH_new);
@@ -105,4 +98,4 @@ err:
105 if (bs != NULL) ASN1_BIT_STRING_free(bs); 98 if (bs != NULL) ASN1_BIT_STRING_free(bs);
106 return(NULL); 99 return(NULL);
107 } 100 }
108 101#endif
diff --git a/src/lib/libcrypto/asn1/d2i_dsap.c b/src/lib/libcrypto/asn1/d2i_dsap.c
index 2c8ac7bbcf..cdd7136f51 100644
--- a/src/lib/libcrypto/asn1/d2i_dsap.c
+++ b/src/lib/libcrypto/asn1/d2i_dsap.c
@@ -56,24 +56,21 @@
56 * [including the GNU Public Licence.] 56 * [including the GNU Public Licence.]
57 */ 57 */
58 58
59#ifndef NO_DSA
59#include <stdio.h> 60#include <stdio.h>
60#include "cryptlib.h" 61#include "cryptlib.h"
61#include "bn.h" 62#include <openssl/bn.h>
62#include "dsa.h" 63#include <openssl/dsa.h>
63#include "objects.h" 64#include <openssl/objects.h>
64#include "asn1_mac.h" 65#include <openssl/asn1_mac.h>
65 66
66/* 67#ifdef NEG_PUBKEY_BUG
67 * ASN1err(ASN1_F_D2I_DSAPARAMS,ASN1_R_LENGTH_MISMATCH); 68#define d2i_ASN1_INTEGER d2i_ASN1_UINTEGER
68 * ASN1err(ASN1_F_I2D_DSAPARAMS,ASN1_R_UNKNOWN_ATTRIBUTE_TYPE); 69#endif
69 */
70 70
71DSA *d2i_DSAparams(a,pp,length) 71DSA *d2i_DSAparams(DSA **a, unsigned char **pp, long length)
72DSA **a;
73unsigned char **pp;
74long length;
75 { 72 {
76 int i=ASN1_R_ERROR_STACK; 73 int i=ERR_R_NESTED_ASN1_ERROR;
77 ASN1_INTEGER *bs=NULL; 74 ASN1_INTEGER *bs=NULL;
78 M_ASN1_D2I_vars(a,DSA *,DSA_new); 75 M_ASN1_D2I_vars(a,DSA *,DSA_new);
79 76
@@ -98,4 +95,4 @@ err:
98 if (bs != NULL) ASN1_BIT_STRING_free(bs); 95 if (bs != NULL) ASN1_BIT_STRING_free(bs);
99 return(NULL); 96 return(NULL);
100 } 97 }
101 98#endif
diff --git a/src/lib/libcrypto/asn1/d2i_pr.c b/src/lib/libcrypto/asn1/d2i_pr.c
index b9eaa9629b..f3d1aa6240 100644
--- a/src/lib/libcrypto/asn1/d2i_pr.c
+++ b/src/lib/libcrypto/asn1/d2i_pr.c
@@ -58,16 +58,13 @@
58 58
59#include <stdio.h> 59#include <stdio.h>
60#include "cryptlib.h" 60#include "cryptlib.h"
61#include "bn.h" 61#include <openssl/bn.h>
62#include "evp.h" 62#include <openssl/evp.h>
63#include "objects.h" 63#include <openssl/objects.h>
64#include "x509.h" 64#include <openssl/asn1.h>
65 65
66EVP_PKEY *d2i_PrivateKey(type,a,pp,length) 66EVP_PKEY *d2i_PrivateKey(int type, EVP_PKEY **a, unsigned char **pp,
67int type; 67 long length)
68EVP_PKEY **a;
69unsigned char **pp;
70long length;
71 { 68 {
72 EVP_PKEY *ret; 69 EVP_PKEY *ret;
73 70
@@ -106,7 +103,7 @@ long length;
106 default: 103 default:
107 ASN1err(ASN1_F_D2I_PRIVATEKEY,ASN1_R_UNKNOWN_PUBLIC_KEY_TYPE); 104 ASN1err(ASN1_F_D2I_PRIVATEKEY,ASN1_R_UNKNOWN_PUBLIC_KEY_TYPE);
108 goto err; 105 goto err;
109 break; 106 /* break; */
110 } 107 }
111 if (a != NULL) (*a)=ret; 108 if (a != NULL) (*a)=ret;
112 return(ret); 109 return(ret);
diff --git a/src/lib/libcrypto/asn1/d2i_pu.c b/src/lib/libcrypto/asn1/d2i_pu.c
index 5d6192f1e5..e0d203cef7 100644
--- a/src/lib/libcrypto/asn1/d2i_pu.c
+++ b/src/lib/libcrypto/asn1/d2i_pu.c
@@ -58,16 +58,13 @@
58 58
59#include <stdio.h> 59#include <stdio.h>
60#include "cryptlib.h" 60#include "cryptlib.h"
61#include "bn.h" 61#include <openssl/bn.h>
62#include "evp.h" 62#include <openssl/evp.h>
63#include "objects.h" 63#include <openssl/objects.h>
64#include "x509.h" 64#include <openssl/asn1.h>
65 65
66EVP_PKEY *d2i_PublicKey(type,a,pp,length) 66EVP_PKEY *d2i_PublicKey(int type, EVP_PKEY **a, unsigned char **pp,
67int type; 67 long length)
68EVP_PKEY **a;
69unsigned char **pp;
70long length;
71 { 68 {
72 EVP_PKEY *ret; 69 EVP_PKEY *ret;
73 70
@@ -106,7 +103,7 @@ long length;
106 default: 103 default:
107 ASN1err(ASN1_F_D2I_PUBLICKEY,ASN1_R_UNKNOWN_PUBLIC_KEY_TYPE); 104 ASN1err(ASN1_F_D2I_PUBLICKEY,ASN1_R_UNKNOWN_PUBLIC_KEY_TYPE);
108 goto err; 105 goto err;
109 break; 106 /* break; */
110 } 107 }
111 if (a != NULL) (*a)=ret; 108 if (a != NULL) (*a)=ret;
112 return(ret); 109 return(ret);
diff --git a/src/lib/libcrypto/asn1/d2i_r_pr.c b/src/lib/libcrypto/asn1/d2i_r_pr.c
index 0c53aa94bf..18f11b6f5e 100644
--- a/src/lib/libcrypto/asn1/d2i_r_pr.c
+++ b/src/lib/libcrypto/asn1/d2i_r_pr.c
@@ -56,18 +56,13 @@
56 * [including the GNU Public Licence.] 56 * [including the GNU Public Licence.]
57 */ 57 */
58 58
59#ifndef NO_RSA
59#include <stdio.h> 60#include <stdio.h>
60#include "cryptlib.h" 61#include "cryptlib.h"
61#include "bn.h" 62#include <openssl/bn.h>
62#include "rsa.h" 63#include <openssl/rsa.h>
63#include "objects.h" 64#include <openssl/objects.h>
64#include "asn1_mac.h" 65#include <openssl/asn1_mac.h>
65
66/*
67 * ASN1err(ASN1_F_D2I_RSAPRIVATEKEY,ASN1_R_LENGTH_MISMATCH);
68 * ASN1err(ASN1_F_I2D_RSAPRIVATEKEY,ASN1_R_UNKNOWN_ATTRIBUTE_TYPE);
69 * ASN1err(ASN1_F_I2D_RSAPRIVATEKEY,ASN1_R_PARSING);
70 */
71 66
72static ASN1_METHOD method={ 67static ASN1_METHOD method={
73 (int (*)()) i2d_RSAPrivateKey, 68 (int (*)()) i2d_RSAPrivateKey,
@@ -75,15 +70,12 @@ static ASN1_METHOD method={
75 (char *(*)())RSA_new, 70 (char *(*)())RSA_new,
76 (void (*)()) RSA_free}; 71 (void (*)()) RSA_free};
77 72
78ASN1_METHOD *RSAPrivateKey_asn1_meth() 73ASN1_METHOD *RSAPrivateKey_asn1_meth(void)
79 { 74 {
80 return(&method); 75 return(&method);
81 } 76 }
82 77
83RSA *d2i_RSAPrivateKey(a,pp,length) 78RSA *d2i_RSAPrivateKey(RSA **a, unsigned char **pp, long length)
84RSA **a;
85unsigned char **pp;
86long length;
87 { 79 {
88 int i=ASN1_R_PARSING; 80 int i=ASN1_R_PARSING;
89 ASN1_INTEGER *bs=NULL; 81 ASN1_INTEGER *bs=NULL;
@@ -126,4 +118,4 @@ err:
126 if (bs != NULL) ASN1_INTEGER_free(bs); 118 if (bs != NULL) ASN1_INTEGER_free(bs);
127 return(NULL); 119 return(NULL);
128 } 120 }
129 121#endif
diff --git a/src/lib/libcrypto/asn1/d2i_r_pu.c b/src/lib/libcrypto/asn1/d2i_r_pu.c
index 778b792b1e..c4ae58b594 100644
--- a/src/lib/libcrypto/asn1/d2i_r_pu.c
+++ b/src/lib/libcrypto/asn1/d2i_r_pu.c
@@ -56,22 +56,19 @@
56 * [including the GNU Public Licence.] 56 * [including the GNU Public Licence.]
57 */ 57 */
58 58
59#ifndef NO_RSA
59#include <stdio.h> 60#include <stdio.h>
60#include "cryptlib.h" 61#include "cryptlib.h"
61#include "bn.h" 62#include <openssl/bn.h>
62#include "rsa.h" 63#include <openssl/rsa.h>
63#include "objects.h" 64#include <openssl/objects.h>
64#include "asn1_mac.h" 65#include <openssl/asn1_mac.h>
65 66
66/* 67#ifdef NEG_PUBKEY_BUG
67 * ASN1err(ASN1_F_D2I_RSAPUBLICKEY,ASN1_R_LENGTH_MISMATCH); 68#define d2i_ASN1_INTEGER d2i_ASN1_UINTEGER
68 * ASN1err(ASN1_F_I2D_RSAPUBLICKEY,ASN1_R_UNKNOWN_ATTRIBUTE_TYPE); 69#endif
69 */
70 70
71RSA *d2i_RSAPublicKey(a,pp,length) 71RSA *d2i_RSAPublicKey(RSA **a, unsigned char **pp, long length)
72RSA **a;
73unsigned char **pp;
74long length;
75 { 72 {
76 int i=ASN1_R_PARSING; 73 int i=ASN1_R_PARSING;
77 ASN1_INTEGER *bs=NULL; 74 ASN1_INTEGER *bs=NULL;
@@ -97,4 +94,4 @@ err:
97 if (bs != NULL) ASN1_INTEGER_free(bs); 94 if (bs != NULL) ASN1_INTEGER_free(bs);
98 return(NULL); 95 return(NULL);
99 } 96 }
100 97#endif
diff --git a/src/lib/libcrypto/asn1/d2i_s_pr.c b/src/lib/libcrypto/asn1/d2i_s_pr.c
index 32ff8ba4b3..050e1cc5fb 100644
--- a/src/lib/libcrypto/asn1/d2i_s_pr.c
+++ b/src/lib/libcrypto/asn1/d2i_s_pr.c
@@ -56,25 +56,17 @@
56 * [including the GNU Public Licence.] 56 * [including the GNU Public Licence.]
57 */ 57 */
58 58
59/* Origional version from Steven Schoch <schoch@sheba.arc.nasa.gov> */ 59/* Original version from Steven Schoch <schoch@sheba.arc.nasa.gov> */
60 60
61#ifndef NO_DSA
61#include <stdio.h> 62#include <stdio.h>
62#include "cryptlib.h" 63#include "cryptlib.h"
63#include "bn.h" 64#include <openssl/bn.h>
64#include "dsa.h" 65#include <openssl/dsa.h>
65#include "objects.h" 66#include <openssl/objects.h>
66#include "asn1_mac.h" 67#include <openssl/asn1_mac.h>
67 68
68/* 69DSA *d2i_DSAPrivateKey(DSA **a, unsigned char **pp, long length)
69 * ASN1err(ASN1_F_D2I_DSAPRIVATEKEY,ASN1_R_LENGTH_MISMATCH);
70 * ASN1err(ASN1_F_I2D_DSAPRIVATEKEY,ASN1_R_UNKNOWN_ATTRIBUTE_TYPE);
71 * ASN1err(ASN1_F_I2D_DSAPRIVATEKEY,ASN1_R_PARSING);
72 */
73
74DSA *d2i_DSAPrivateKey(a,pp,length)
75DSA **a;
76unsigned char **pp;
77long length;
78 { 70 {
79 int i=ASN1_R_PARSING; 71 int i=ASN1_R_PARSING;
80 ASN1_INTEGER *bs=NULL; 72 ASN1_INTEGER *bs=NULL;
@@ -110,4 +102,4 @@ err:
110 if (bs != NULL) ASN1_INTEGER_free(bs); 102 if (bs != NULL) ASN1_INTEGER_free(bs);
111 return(NULL); 103 return(NULL);
112 } 104 }
113 105#endif
diff --git a/src/lib/libcrypto/asn1/d2i_s_pu.c b/src/lib/libcrypto/asn1/d2i_s_pu.c
index 1002f41cd8..94ea1c313b 100644
--- a/src/lib/libcrypto/asn1/d2i_s_pu.c
+++ b/src/lib/libcrypto/asn1/d2i_s_pu.c
@@ -56,24 +56,21 @@
56 * [including the GNU Public Licence.] 56 * [including the GNU Public Licence.]
57 */ 57 */
58 58
59/* Origional version from Steven Schoch <schoch@sheba.arc.nasa.gov> */ 59/* Original version from Steven Schoch <schoch@sheba.arc.nasa.gov> */
60 60
61#ifndef NO_DSA
61#include <stdio.h> 62#include <stdio.h>
62#include "cryptlib.h" 63#include "cryptlib.h"
63#include "bn.h" 64#include <openssl/bn.h>
64#include "dsa.h" 65#include <openssl/dsa.h>
65#include "objects.h" 66#include <openssl/objects.h>
66#include "asn1_mac.h" 67#include <openssl/asn1_mac.h>
67 68
68/* 69#ifdef NEG_PUBKEY_BUG
69 * ASN1err(ASN1_F_D2I_DSAPUBLICKEY,ASN1_R_LENGTH_MISMATCH); 70#define d2i_ASN1_INTEGER d2i_ASN1_UINTEGER
70 * ASN1err(ASN1_F_I2D_DSAPUBLICKEY,ASN1_R_UNKNOWN_ATTRIBUTE_TYPE); 71#endif
71 */
72 72
73DSA *d2i_DSAPublicKey(a,pp,length) 73DSA *d2i_DSAPublicKey(DSA **a, unsigned char **pp, long length)
74DSA **a;
75unsigned char **pp;
76long length;
77 { 74 {
78 int i=ASN1_R_PARSING; 75 int i=ASN1_R_PARSING;
79 ASN1_INTEGER *bs=NULL; 76 ASN1_INTEGER *bs=NULL;
@@ -121,4 +118,4 @@ err:
121 if (bs != NULL) ASN1_INTEGER_free(bs); 118 if (bs != NULL) ASN1_INTEGER_free(bs);
122 return(NULL); 119 return(NULL);
123 } 120 }
124 121#endif
diff --git a/src/lib/libcrypto/asn1/evp_asn1.c b/src/lib/libcrypto/asn1/evp_asn1.c
index ebe34a3362..41ced49c19 100644
--- a/src/lib/libcrypto/asn1/evp_asn1.c
+++ b/src/lib/libcrypto/asn1/evp_asn1.c
@@ -58,26 +58,22 @@
58 58
59#include <stdio.h> 59#include <stdio.h>
60#include "cryptlib.h" 60#include "cryptlib.h"
61#include "asn1.h" 61#include <openssl/asn1.h>
62#include "asn1_mac.h" 62#include <openssl/asn1_mac.h>
63 63
64int ASN1_TYPE_set_octetstring(a,data,len) 64int ASN1_TYPE_set_octetstring(ASN1_TYPE *a, unsigned char *data, int len)
65ASN1_TYPE *a;
66unsigned char *data;
67int len;
68 { 65 {
69 ASN1_STRING *os; 66 ASN1_STRING *os;
70 67
71 if ((os=ASN1_OCTET_STRING_new()) == NULL) return(0); 68 if ((os=ASN1_OCTET_STRING_new()) == NULL) return(0);
72 if (!ASN1_OCTET_STRING_set(os,data,len)) return(0); 69 if (!ASN1_OCTET_STRING_set(os,data,len)) return(0);
73 ASN1_TYPE_set(a,V_ASN1_OCTET_STRING,(char *)os); 70 ASN1_TYPE_set(a,V_ASN1_OCTET_STRING,os);
74 return(1); 71 return(1);
75 } 72 }
76 73
77int ASN1_TYPE_get_octetstring(a,data,max_len) 74/* int max_len: for returned value */
78ASN1_TYPE *a; 75int ASN1_TYPE_get_octetstring(ASN1_TYPE *a, unsigned char *data,
79unsigned char *data; 76 int max_len)
80int max_len; /* for returned value */
81 { 77 {
82 int ret,num; 78 int ret,num;
83 unsigned char *p; 79 unsigned char *p;
@@ -97,11 +93,8 @@ int max_len; /* for returned value */
97 return(ret); 93 return(ret);
98 } 94 }
99 95
100int ASN1_TYPE_set_int_octetstring(a,num,data,len) 96int ASN1_TYPE_set_int_octetstring(ASN1_TYPE *a, long num, unsigned char *data,
101ASN1_TYPE *a; 97 int len)
102long num;
103unsigned char *data;
104int len;
105 { 98 {
106 int n,size; 99 int n,size;
107 ASN1_OCTET_STRING os,*osp; 100 ASN1_OCTET_STRING os,*osp;
@@ -131,16 +124,15 @@ int len;
131 i2d_ASN1_INTEGER(&in,&p); 124 i2d_ASN1_INTEGER(&in,&p);
132 M_i2d_ASN1_OCTET_STRING(&os,&p); 125 M_i2d_ASN1_OCTET_STRING(&os,&p);
133 126
134 ASN1_TYPE_set(a,V_ASN1_SEQUENCE,(char *)osp); 127 ASN1_TYPE_set(a,V_ASN1_SEQUENCE,osp);
135 return(1); 128 return(1);
136 } 129 }
137 130
138/* we return the actual length... */ 131/* we return the actual length..., num may be missing, in which
139int ASN1_TYPE_get_int_octetstring(a,num,data,max_len) 132 * case, set it to zero */
140ASN1_TYPE *a; 133/* int max_len: for returned value */
141long *num; 134int ASN1_TYPE_get_int_octetstring(ASN1_TYPE *a, long *num, unsigned char *data,
142unsigned char *data; 135 int max_len)
143int max_len; /* for returned value */
144 { 136 {
145 int ret= -1,n; 137 int ret= -1,n;
146 ASN1_INTEGER *ai=NULL; 138 ASN1_INTEGER *ai=NULL;
diff --git a/src/lib/libcrypto/asn1/f.c b/src/lib/libcrypto/asn1/f.c
index 2ab3a262ac..82bccdfd51 100644
--- a/src/lib/libcrypto/asn1/f.c
+++ b/src/lib/libcrypto/asn1/f.c
@@ -56,8 +56,8 @@
56 * [including the GNU Public Licence.] 56 * [including the GNU Public Licence.]
57 */ 57 */
58#include <stdio.h> 58#include <stdio.h>
59#include "asn1.h" 59#include <openssl/asn1.h>
60#include "err.h" 60#include <openssl/err.h>
61 61
62main() 62main()
63 { 63 {
diff --git a/src/lib/libcrypto/asn1/f_enum.c b/src/lib/libcrypto/asn1/f_enum.c
new file mode 100644
index 0000000000..3bcceecdb8
--- /dev/null
+++ b/src/lib/libcrypto/asn1/f_enum.c
@@ -0,0 +1,207 @@
1/* crypto/asn1/f_enum.c */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved.
4 *
5 * This package is an SSL implementation written
6 * by Eric Young (eay@cryptsoft.com).
7 * The implementation was written so as to conform with Netscapes SSL.
8 *
9 * This library is free for commercial and non-commercial use as long as
10 * the following conditions are aheared to. The following conditions
11 * apply to all code found in this distribution, be it the RC4, RSA,
12 * lhash, DES, etc., code; not just the SSL code. The SSL documentation
13 * included with this distribution is covered by the same copyright terms
14 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
15 *
16 * Copyright remains Eric Young's, and as such any Copyright notices in
17 * the code are not to be removed.
18 * If this package is used in a product, Eric Young should be given attribution
19 * as the author of the parts of the library used.
20 * This can be in the form of a textual message at program startup or
21 * in documentation (online or textual) provided with the package.
22 *
23 * Redistribution and use in source and binary forms, with or without
24 * modification, are permitted provided that the following conditions
25 * are met:
26 * 1. Redistributions of source code must retain the copyright
27 * notice, this list of conditions and the following disclaimer.
28 * 2. Redistributions in binary form must reproduce the above copyright
29 * notice, this list of conditions and the following disclaimer in the
30 * documentation and/or other materials provided with the distribution.
31 * 3. All advertising materials mentioning features or use of this software
32 * must display the following acknowledgement:
33 * "This product includes cryptographic software written by
34 * Eric Young (eay@cryptsoft.com)"
35 * The word 'cryptographic' can be left out if the rouines from the library
36 * being used are not cryptographic related :-).
37 * 4. If you include any Windows specific code (or a derivative thereof) from
38 * the apps directory (application code) you must include an acknowledgement:
39 * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
40 *
41 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
42 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
43 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
44 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
45 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
46 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
47 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
49 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
50 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
51 * SUCH DAMAGE.
52 *
53 * The licence and distribution terms for any publically available version or
54 * derivative of this code cannot be changed. i.e. this code cannot simply be
55 * copied and put under another distribution licence
56 * [including the GNU Public Licence.]
57 */
58
59#include <stdio.h>
60#include "cryptlib.h"
61#include <openssl/buffer.h>
62#include <openssl/asn1.h>
63
64/* Based on a_int.c: equivalent ENUMERATED functions */
65
66int i2a_ASN1_ENUMERATED(BIO *bp, ASN1_ENUMERATED *a)
67 {
68 int i,n=0;
69 static const char *h="0123456789ABCDEF";
70 char buf[2];
71
72 if (a == NULL) return(0);
73
74 if (a->length == 0)
75 {
76 if (BIO_write(bp,"00",2) != 2) goto err;
77 n=2;
78 }
79 else
80 {
81 for (i=0; i<a->length; i++)
82 {
83 if ((i != 0) && (i%35 == 0))
84 {
85 if (BIO_write(bp,"\\\n",2) != 2) goto err;
86 n+=2;
87 }
88 buf[0]=h[((unsigned char)a->data[i]>>4)&0x0f];
89 buf[1]=h[((unsigned char)a->data[i] )&0x0f];
90 if (BIO_write(bp,buf,2) != 2) goto err;
91 n+=2;
92 }
93 }
94 return(n);
95err:
96 return(-1);
97 }
98
99int a2i_ASN1_ENUMERATED(BIO *bp, ASN1_ENUMERATED *bs, char *buf, int size)
100 {
101 int ret=0;
102 int i,j,k,m,n,again,bufsize;
103 unsigned char *s=NULL,*sp;
104 unsigned char *bufp;
105 int num=0,slen=0,first=1;
106
107 bs->type=V_ASN1_ENUMERATED;
108
109 bufsize=BIO_gets(bp,buf,size);
110 for (;;)
111 {
112 if (bufsize < 1) goto err_sl;
113 i=bufsize;
114 if (buf[i-1] == '\n') buf[--i]='\0';
115 if (i == 0) goto err_sl;
116 if (buf[i-1] == '\r') buf[--i]='\0';
117 if (i == 0) goto err_sl;
118 again=(buf[i-1] == '\\');
119
120 for (j=0; j<i; j++)
121 {
122 if (!( ((buf[j] >= '0') && (buf[j] <= '9')) ||
123 ((buf[j] >= 'a') && (buf[j] <= 'f')) ||
124 ((buf[j] >= 'A') && (buf[j] <= 'F'))))
125 {
126 i=j;
127 break;
128 }
129 }
130 buf[i]='\0';
131 /* We have now cleared all the crap off the end of the
132 * line */
133 if (i < 2) goto err_sl;
134
135 bufp=(unsigned char *)buf;
136 if (first)
137 {
138 first=0;
139 if ((bufp[0] == '0') && (buf[1] == '0'))
140 {
141 bufp+=2;
142 i-=2;
143 }
144 }
145 k=0;
146 i-=again;
147 if (i%2 != 0)
148 {
149 ASN1err(ASN1_F_A2I_ASN1_ENUMERATED,ASN1_R_ODD_NUMBER_OF_CHARS);
150 goto err;
151 }
152 i/=2;
153 if (num+i > slen)
154 {
155 if (s == NULL)
156 sp=(unsigned char *)Malloc(
157 (unsigned int)num+i*2);
158 else
159 sp=(unsigned char *)Realloc(s,
160 (unsigned int)num+i*2);
161 if (sp == NULL)
162 {
163 ASN1err(ASN1_F_A2I_ASN1_ENUMERATED,ERR_R_MALLOC_FAILURE);
164 if (s != NULL) Free((char *)s);
165 goto err;
166 }
167 s=sp;
168 slen=num+i*2;
169 }
170 for (j=0; j<i; j++,k+=2)
171 {
172 for (n=0; n<2; n++)
173 {
174 m=bufp[k+n];
175 if ((m >= '0') && (m <= '9'))
176 m-='0';
177 else if ((m >= 'a') && (m <= 'f'))
178 m=m-'a'+10;
179 else if ((m >= 'A') && (m <= 'F'))
180 m=m-'A'+10;
181 else
182 {
183 ASN1err(ASN1_F_A2I_ASN1_ENUMERATED,ASN1_R_NON_HEX_CHARACTERS);
184 goto err;
185 }
186 s[num+j]<<=4;
187 s[num+j]|=m;
188 }
189 }
190 num+=i;
191 if (again)
192 bufsize=BIO_gets(bp,buf,size);
193 else
194 break;
195 }
196 bs->length=num;
197 bs->data=s;
198 ret=1;
199err:
200 if (0)
201 {
202err_sl:
203 ASN1err(ASN1_F_A2I_ASN1_ENUMERATED,ASN1_R_SHORT_LINE);
204 }
205 return(ret);
206 }
207
diff --git a/src/lib/libcrypto/asn1/f_int.c b/src/lib/libcrypto/asn1/f_int.c
index 4817c45cb7..55560dd814 100644
--- a/src/lib/libcrypto/asn1/f_int.c
+++ b/src/lib/libcrypto/asn1/f_int.c
@@ -58,15 +58,13 @@
58 58
59#include <stdio.h> 59#include <stdio.h>
60#include "cryptlib.h" 60#include "cryptlib.h"
61#include "buffer.h" 61#include <openssl/buffer.h>
62#include "x509.h" 62#include <openssl/asn1.h>
63 63
64int i2a_ASN1_INTEGER(bp, a) 64int i2a_ASN1_INTEGER(BIO *bp, ASN1_INTEGER *a)
65BIO *bp;
66ASN1_INTEGER *a;
67 { 65 {
68 int i,n=0; 66 int i,n=0;
69 static char *h="0123456789ABCDEF"; 67 static const char *h="0123456789ABCDEF";
70 char buf[2]; 68 char buf[2];
71 69
72 if (a == NULL) return(0); 70 if (a == NULL) return(0);
@@ -96,11 +94,7 @@ err:
96 return(-1); 94 return(-1);
97 } 95 }
98 96
99int a2i_ASN1_INTEGER(bp,bs,buf,size) 97int a2i_ASN1_INTEGER(BIO *bp, ASN1_INTEGER *bs, char *buf, int size)
100BIO *bp;
101ASN1_INTEGER *bs;
102char *buf;
103int size;
104 { 98 {
105 int ret=0; 99 int ret=0;
106 int i,j,k,m,n,again,bufsize; 100 int i,j,k,m,n,again,bufsize;
@@ -123,9 +117,18 @@ int size;
123 117
124 for (j=0; j<i; j++) 118 for (j=0; j<i; j++)
125 { 119 {
120#ifndef CHARSET_EBCDIC
126 if (!( ((buf[j] >= '0') && (buf[j] <= '9')) || 121 if (!( ((buf[j] >= '0') && (buf[j] <= '9')) ||
127 ((buf[j] >= 'a') && (buf[j] <= 'f')) || 122 ((buf[j] >= 'a') && (buf[j] <= 'f')) ||
128 ((buf[j] >= 'A') && (buf[j] <= 'F')))) 123 ((buf[j] >= 'A') && (buf[j] <= 'F'))))
124#else
125 /* This #ifdef is not strictly necessary, since
126 * the characters A...F a...f 0...9 are contiguous
127 * (yes, even in EBCDIC - but not the whole alphabet).
128 * Nevertheless, isxdigit() is faster.
129 */
130 if (!isxdigit(buf[j]))
131#endif
129 { 132 {
130 i=j; 133 i=j;
131 break; 134 break;
diff --git a/src/lib/libcrypto/asn1/f_string.c b/src/lib/libcrypto/asn1/f_string.c
index ab2837824e..5d0cf5a46d 100644
--- a/src/lib/libcrypto/asn1/f_string.c
+++ b/src/lib/libcrypto/asn1/f_string.c
@@ -58,16 +58,13 @@
58 58
59#include <stdio.h> 59#include <stdio.h>
60#include "cryptlib.h" 60#include "cryptlib.h"
61#include "buffer.h" 61#include <openssl/buffer.h>
62#include "x509.h" 62#include <openssl/asn1.h>
63 63
64int i2a_ASN1_STRING(bp, a, type) 64int i2a_ASN1_STRING(BIO *bp, ASN1_STRING *a, int type)
65BIO *bp;
66ASN1_STRING *a;
67int type;
68 { 65 {
69 int i,n=0; 66 int i,n=0;
70 static char *h="0123456789ABCDEF"; 67 static const char *h="0123456789ABCDEF";
71 char buf[2]; 68 char buf[2];
72 69
73 if (a == NULL) return(0); 70 if (a == NULL) return(0);
@@ -97,11 +94,7 @@ err:
97 return(-1); 94 return(-1);
98 } 95 }
99 96
100int a2i_ASN1_STRING(bp,bs,buf,size) 97int a2i_ASN1_STRING(BIO *bp, ASN1_STRING *bs, char *buf, int size)
101BIO *bp;
102ASN1_STRING *bs;
103char *buf;
104int size;
105 { 98 {
106 int ret=0; 99 int ret=0;
107 int i,j,k,m,n,again,bufsize; 100 int i,j,k,m,n,again,bufsize;
@@ -130,9 +123,18 @@ int size;
130 123
131 for (j=i-1; j>0; j--) 124 for (j=i-1; j>0; j--)
132 { 125 {
126#ifndef CHARSET_EBCDIC
133 if (!( ((buf[j] >= '0') && (buf[j] <= '9')) || 127 if (!( ((buf[j] >= '0') && (buf[j] <= '9')) ||
134 ((buf[j] >= 'a') && (buf[j] <= 'f')) || 128 ((buf[j] >= 'a') && (buf[j] <= 'f')) ||
135 ((buf[j] >= 'A') && (buf[j] <= 'F')))) 129 ((buf[j] >= 'A') && (buf[j] <= 'F'))))
130#else
131 /* This #ifdef is not strictly necessary, since
132 * the characters A...F a...f 0...9 are contiguous
133 * (yes, even in EBCDIC - but not the whole alphabet).
134 * Nevertheless, isxdigit() is faster.
135 */
136 if (!isxdigit(buf[j]))
137#endif
136 { 138 {
137 i=j; 139 i=j;
138 break; 140 break;
diff --git a/src/lib/libcrypto/asn1/i2d_dhp.c b/src/lib/libcrypto/asn1/i2d_dhp.c
index a454025ce3..fdda4ec41b 100644
--- a/src/lib/libcrypto/asn1/i2d_dhp.c
+++ b/src/lib/libcrypto/asn1/i2d_dhp.c
@@ -56,20 +56,14 @@
56 * [including the GNU Public Licence.] 56 * [including the GNU Public Licence.]
57 */ 57 */
58 58
59#ifndef NO_DH
59#include <stdio.h> 60#include <stdio.h>
60#include "cryptlib.h" 61#include "cryptlib.h"
61#include "bn.h" 62#include <openssl/bn.h>
62#include "asn1_mac.h" 63#include <openssl/asn1_mac.h>
63#include "dh.h" 64#include <openssl/dh.h>
64 65
65/* 66int i2d_DHparams(DH *a, unsigned char **pp)
66 * ASN1err(ASN1_F_D2I_DHPARAMS,ASN1_R_LENGTH_MISMATCH);
67 * ASN1err(ASN1_F_X509_DHPARAMS_NEW,ASN1_R_LENGTH_MISMATCH);
68 */
69
70int i2d_DHparams(a,pp)
71DH *a;
72unsigned char **pp;
73 { 67 {
74 BIGNUM *num[3]; 68 BIGNUM *num[3];
75 ASN1_INTEGER bs; 69 ASN1_INTEGER bs;
@@ -100,7 +94,12 @@ unsigned char **pp;
100 } 94 }
101 95
102 t=ASN1_object_size(1,tot,V_ASN1_SEQUENCE); 96 t=ASN1_object_size(1,tot,V_ASN1_SEQUENCE);
103 if (pp == NULL) return(t); 97 if (pp == NULL)
98 {
99 if (num[2] != NULL)
100 BN_free(num[2]);
101 return(t);
102 }
104 103
105 p= *pp; 104 p= *pp;
106 ASN1_put_object(&p,1,tot,V_ASN1_SEQUENCE,V_ASN1_UNIVERSAL); 105 ASN1_put_object(&p,1,tot,V_ASN1_SEQUENCE,V_ASN1_UNIVERSAL);
@@ -126,3 +125,4 @@ err:
126 *pp=p; 125 *pp=p;
127 return(ret); 126 return(ret);
128 } 127 }
128#endif
diff --git a/src/lib/libcrypto/asn1/i2d_dsap.c b/src/lib/libcrypto/asn1/i2d_dsap.c
index 94ecff1525..f36f0da4e2 100644
--- a/src/lib/libcrypto/asn1/i2d_dsap.c
+++ b/src/lib/libcrypto/asn1/i2d_dsap.c
@@ -56,19 +56,14 @@
56 * [including the GNU Public Licence.] 56 * [including the GNU Public Licence.]
57 */ 57 */
58 58
59#ifndef NO_DSA
59#include <stdio.h> 60#include <stdio.h>
60#include "cryptlib.h" 61#include "cryptlib.h"
61#include "bn.h" 62#include <openssl/bn.h>
62#include "asn1_mac.h" 63#include <openssl/asn1_mac.h>
63#include "dsa.h" 64#include <openssl/dsa.h>
64 65
65/* 66int i2d_DSAparams(DSA *a, unsigned char **pp)
66 * ASN1err(ASN1_F_D2I_DSAPARAMS,ASN1_R_LENGTH_MISMATCH);
67 */
68
69int i2d_DSAparams(a,pp)
70DSA *a;
71unsigned char **pp;
72 { 67 {
73 BIGNUM *num[3]; 68 BIGNUM *num[3];
74 ASN1_INTEGER bs; 69 ASN1_INTEGER bs;
@@ -118,4 +113,5 @@ err:
118 *pp=p; 113 *pp=p;
119 return(ret); 114 return(ret);
120 } 115 }
116#endif
121 117
diff --git a/src/lib/libcrypto/asn1/i2d_pr.c b/src/lib/libcrypto/asn1/i2d_pr.c
index b6b821d73c..71d6910204 100644
--- a/src/lib/libcrypto/asn1/i2d_pr.c
+++ b/src/lib/libcrypto/asn1/i2d_pr.c
@@ -58,13 +58,11 @@
58 58
59#include <stdio.h> 59#include <stdio.h>
60#include "cryptlib.h" 60#include "cryptlib.h"
61#include "bn.h" 61#include <openssl/bn.h>
62#include "evp.h" 62#include <openssl/evp.h>
63#include "objects.h" 63#include <openssl/objects.h>
64 64
65int i2d_PrivateKey(a,pp) 65int i2d_PrivateKey(EVP_PKEY *a, unsigned char **pp)
66EVP_PKEY *a;
67unsigned char **pp;
68 { 66 {
69#ifndef NO_RSA 67#ifndef NO_RSA
70 if (a->type == EVP_PKEY_RSA) 68 if (a->type == EVP_PKEY_RSA)
diff --git a/src/lib/libcrypto/asn1/i2d_pu.c b/src/lib/libcrypto/asn1/i2d_pu.c
index 1b854252b7..8f73d37d03 100644
--- a/src/lib/libcrypto/asn1/i2d_pu.c
+++ b/src/lib/libcrypto/asn1/i2d_pu.c
@@ -58,13 +58,11 @@
58 58
59#include <stdio.h> 59#include <stdio.h>
60#include "cryptlib.h" 60#include "cryptlib.h"
61#include "bn.h" 61#include <openssl/bn.h>
62#include "evp.h" 62#include <openssl/evp.h>
63#include "objects.h" 63#include <openssl/objects.h>
64 64
65int i2d_PublicKey(a,pp) 65int i2d_PublicKey(EVP_PKEY *a, unsigned char **pp)
66EVP_PKEY *a;
67unsigned char **pp;
68 { 66 {
69 switch (a->type) 67 switch (a->type)
70 { 68 {
diff --git a/src/lib/libcrypto/asn1/i2d_r_pr.c b/src/lib/libcrypto/asn1/i2d_r_pr.c
index aadbb92d8e..27e6844a7f 100644
--- a/src/lib/libcrypto/asn1/i2d_r_pr.c
+++ b/src/lib/libcrypto/asn1/i2d_r_pr.c
@@ -56,21 +56,15 @@
56 * [including the GNU Public Licence.] 56 * [including the GNU Public Licence.]
57 */ 57 */
58 58
59#ifndef NO_RSA
59#include <stdio.h> 60#include <stdio.h>
60#include "cryptlib.h" 61#include "cryptlib.h"
61#include "bn.h" 62#include <openssl/bn.h>
62#include "rsa.h" 63#include <openssl/rsa.h>
63#include "objects.h" 64#include <openssl/objects.h>
64#include "asn1_mac.h" 65#include <openssl/asn1_mac.h>
65 66
66/* 67int i2d_RSAPrivateKey(RSA *a, unsigned char **pp)
67 * ASN1err(ASN1_F_D2I_RSAPRIVATEKEY,ASN1_R_LENGTH_MISMATCH);
68 * ASN1err(ASN1_F_I2D_RSAPRIVATEKEY,ASN1_R_UNKNOWN_ATTRIBUTE_TYPE);
69 */
70
71int i2d_RSAPrivateKey(a,pp)
72RSA *a;
73unsigned char **pp;
74 { 68 {
75 BIGNUM *num[9]; 69 BIGNUM *num[9];
76 unsigned char data[1]; 70 unsigned char data[1];
@@ -129,4 +123,5 @@ unsigned char **pp;
129 *pp=p; 123 *pp=p;
130 return(t); 124 return(t);
131 } 125 }
126#endif
132 127
diff --git a/src/lib/libcrypto/asn1/i2d_r_pu.c b/src/lib/libcrypto/asn1/i2d_r_pu.c
index 3c54f6709d..6d01bfa8b5 100644
--- a/src/lib/libcrypto/asn1/i2d_r_pu.c
+++ b/src/lib/libcrypto/asn1/i2d_r_pu.c
@@ -56,21 +56,15 @@
56 * [including the GNU Public Licence.] 56 * [including the GNU Public Licence.]
57 */ 57 */
58 58
59#ifndef NO_RSA
59#include <stdio.h> 60#include <stdio.h>
60#include "cryptlib.h" 61#include "cryptlib.h"
61#include "bn.h" 62#include <openssl/bn.h>
62#include "rsa.h" 63#include <openssl/rsa.h>
63#include "objects.h" 64#include <openssl/objects.h>
64#include "asn1_mac.h" 65#include <openssl/asn1_mac.h>
65 66
66/* 67int i2d_RSAPublicKey(RSA *a, unsigned char **pp)
67 * ASN1err(ASN1_F_D2I_RSAPUBLICKEY,ASN1_R_LENGTH_MISMATCH);
68 * ASN1err(ASN1_F_I2D_RSAPUBLICKEY,ASN1_R_UNKNOWN_ATTRIBUTE_TYPE);
69 */
70
71int i2d_RSAPublicKey(a,pp)
72RSA *a;
73unsigned char **pp;
74 { 68 {
75 BIGNUM *num[2]; 69 BIGNUM *num[2];
76 ASN1_INTEGER bs; 70 ASN1_INTEGER bs;
@@ -115,4 +109,4 @@ unsigned char **pp;
115 *pp=p; 109 *pp=p;
116 return(t); 110 return(t);
117 } 111 }
118 112#endif
diff --git a/src/lib/libcrypto/asn1/i2d_s_pr.c b/src/lib/libcrypto/asn1/i2d_s_pr.c
index 6e95305548..5d3dcdf197 100644
--- a/src/lib/libcrypto/asn1/i2d_s_pr.c
+++ b/src/lib/libcrypto/asn1/i2d_s_pr.c
@@ -56,20 +56,15 @@
56 * [including the GNU Public Licence.] 56 * [including the GNU Public Licence.]
57 */ 57 */
58 58
59#ifndef NO_DSA
59#include <stdio.h> 60#include <stdio.h>
60#include "cryptlib.h" 61#include "cryptlib.h"
61#include "bn.h" 62#include <openssl/bn.h>
62#include "dsa.h" 63#include <openssl/dsa.h>
63#include "objects.h" 64#include <openssl/objects.h>
64#include "asn1_mac.h" 65#include <openssl/asn1_mac.h>
65 66
66/* 67int i2d_DSAPrivateKey(DSA *a, unsigned char **pp)
67 * ASN1err(ASN1_F_I2D_DSAPRIVATEKEY,ASN1_R_UNKNOWN_ATTRIBUTE_TYPE);
68 */
69
70int i2d_DSAPrivateKey(a,pp)
71DSA *a;
72unsigned char **pp;
73 { 68 {
74 BIGNUM *num[6]; 69 BIGNUM *num[6];
75 unsigned char data[1]; 70 unsigned char data[1];
@@ -125,4 +120,4 @@ unsigned char **pp;
125 *pp=p; 120 *pp=p;
126 return(t); 121 return(t);
127 } 122 }
128 123#endif
diff --git a/src/lib/libcrypto/asn1/i2d_s_pu.c b/src/lib/libcrypto/asn1/i2d_s_pu.c
index 5cf2877069..18f790f746 100644
--- a/src/lib/libcrypto/asn1/i2d_s_pu.c
+++ b/src/lib/libcrypto/asn1/i2d_s_pu.c
@@ -56,20 +56,15 @@
56 * [including the GNU Public Licence.] 56 * [including the GNU Public Licence.]
57 */ 57 */
58 58
59#ifndef NO_DSA
59#include <stdio.h> 60#include <stdio.h>
60#include "cryptlib.h" 61#include "cryptlib.h"
61#include "bn.h" 62#include <openssl/bn.h>
62#include "dsa.h" 63#include <openssl/dsa.h>
63#include "objects.h" 64#include <openssl/objects.h>
64#include "asn1_mac.h" 65#include <openssl/asn1_mac.h>
65 66
66/* 67int i2d_DSAPublicKey(DSA *a, unsigned char **pp)
67 * ASN1err(ASN1_F_I2D_DSAPUBLICKEY,ASN1_R_UNKNOWN_ATTRIBUTE_TYPE);
68 */
69
70int i2d_DSAPublicKey(a,pp)
71DSA *a;
72unsigned char **pp;
73 { 68 {
74 BIGNUM *num[4]; 69 BIGNUM *num[4];
75 ASN1_INTEGER bs; 70 ASN1_INTEGER bs;
@@ -128,6 +123,7 @@ unsigned char **pp;
128 } 123 }
129 Free((char *)bs.data); 124 Free((char *)bs.data);
130 *pp=p; 125 *pp=p;
131 return(t); 126 if(all) return(t);
127 else return(tot);
132 } 128 }
133 129#endif
diff --git a/src/lib/libcrypto/asn1/n_pkey.c b/src/lib/libcrypto/asn1/n_pkey.c
index 5110c91bec..cdc0d8b7c4 100644
--- a/src/lib/libcrypto/asn1/n_pkey.c
+++ b/src/lib/libcrypto/asn1/n_pkey.c
@@ -56,13 +56,14 @@
56 * [including the GNU Public Licence.] 56 * [including the GNU Public Licence.]
57 */ 57 */
58 58
59#ifndef NO_RSA
59#include <stdio.h> 60#include <stdio.h>
60#include "cryptlib.h" 61#include "cryptlib.h"
61#include "rsa.h" 62#include <openssl/rsa.h>
62#include "objects.h" 63#include <openssl/objects.h>
63#include "asn1_mac.h" 64#include <openssl/asn1_mac.h>
64#include "evp.h" 65#include <openssl/evp.h>
65#include "x509.h" 66#include <openssl/x509.h>
66 67
67 68
68#ifndef NO_RC4 69#ifndef NO_RC4
@@ -74,28 +75,12 @@ typedef struct netscape_pkey_st
74 ASN1_OCTET_STRING *private_key; 75 ASN1_OCTET_STRING *private_key;
75 } NETSCAPE_PKEY; 76 } NETSCAPE_PKEY;
76 77
77/*
78 * ASN1err(ASN1_F_D2I_NETSCAPE_RSA,ASN1_R_LENGTH_MISMATCH);
79 * ASN1err(ASN1_F_D2I_NETSCAPE_RSA,ASN1_R_DECODING_ERROR);
80 * ASN1err(ASN1_F_D2I_NETSCAPE_PKEY,ASN1_R_DECODING_ERROR);
81 * ASN1err(ASN1_F_NETSCAPE_PKEY_NEW,ASN1_R_DECODING_ERROR);
82 */
83#ifndef NOPROTO
84static int i2d_NETSCAPE_PKEY(NETSCAPE_PKEY *a, unsigned char **pp); 78static int i2d_NETSCAPE_PKEY(NETSCAPE_PKEY *a, unsigned char **pp);
85static NETSCAPE_PKEY *d2i_NETSCAPE_PKEY(NETSCAPE_PKEY **a,unsigned char **pp, long length); 79static NETSCAPE_PKEY *d2i_NETSCAPE_PKEY(NETSCAPE_PKEY **a,unsigned char **pp, long length);
86static NETSCAPE_PKEY *NETSCAPE_PKEY_new(void); 80static NETSCAPE_PKEY *NETSCAPE_PKEY_new(void);
87static void NETSCAPE_PKEY_free(NETSCAPE_PKEY *); 81static void NETSCAPE_PKEY_free(NETSCAPE_PKEY *);
88#else
89static int i2d_NETSCAPE_PKEY();
90static NETSCAPE_PKEY *d2i_NETSCAPE_PKEY();
91static NETSCAPE_PKEY *NETSCAPE_PKEY_new();
92static void NETSCAPE_PKEY_free();
93#endif
94 82
95int i2d_Netscape_RSA(a,pp,cb) 83int i2d_Netscape_RSA(RSA *a, unsigned char **pp, int (*cb)())
96RSA *a;
97unsigned char **pp;
98int (*cb)();
99 { 84 {
100 int i,j,l[6]; 85 int i,j,l[6];
101 NETSCAPE_PKEY *pkey; 86 NETSCAPE_PKEY *pkey;
@@ -138,7 +123,9 @@ int (*cb)();
138 l[2]=i2d_X509_ALGOR(alg,NULL); 123 l[2]=i2d_X509_ALGOR(alg,NULL);
139 l[3]=ASN1_object_size(1,l[2]+l[1],V_ASN1_SEQUENCE); 124 l[3]=ASN1_object_size(1,l[2]+l[1],V_ASN1_SEQUENCE);
140 125
126#ifndef CONST_STRICT
141 os.data=(unsigned char *)"private-key"; 127 os.data=(unsigned char *)"private-key";
128#endif
142 os.length=11; 129 os.length=11;
143 l[4]=i2d_ASN1_OCTET_STRING(&os,NULL); 130 l[4]=i2d_ASN1_OCTET_STRING(&os,NULL);
144 131
@@ -195,18 +182,14 @@ int (*cb)();
195 i2d_ASN1_OCTET_STRING(&os2,&p); 182 i2d_ASN1_OCTET_STRING(&os2,&p);
196 ret=l[5]; 183 ret=l[5];
197err: 184err:
198 if (os2.data != NULL) Free((char *)os2.data); 185 if (os2.data != NULL) Free(os2.data);
199 if (alg != NULL) X509_ALGOR_free(alg); 186 if (alg != NULL) X509_ALGOR_free(alg);
200 if (pkey != NULL) NETSCAPE_PKEY_free(pkey); 187 if (pkey != NULL) NETSCAPE_PKEY_free(pkey);
201 r=r; 188 r=r;
202 return(ret); 189 return(ret);
203 } 190 }
204 191
205RSA *d2i_Netscape_RSA(a,pp,length,cb) 192RSA *d2i_Netscape_RSA(RSA **a, unsigned char **pp, long length, int (*cb)())
206RSA **a;
207unsigned char **pp;
208long length;
209int (*cb)();
210 { 193 {
211 RSA *ret=NULL; 194 RSA *ret=NULL;
212 ASN1_OCTET_STRING *os=NULL; 195 ASN1_OCTET_STRING *os=NULL;
@@ -233,11 +216,8 @@ int (*cb)();
233 M_ASN1_D2I_Finish(a,RSA_free,ASN1_F_D2I_NETSCAPE_RSA); 216 M_ASN1_D2I_Finish(a,RSA_free,ASN1_F_D2I_NETSCAPE_RSA);
234 } 217 }
235 218
236RSA *d2i_Netscape_RSA_2(a,pp,length,cb) 219RSA *d2i_Netscape_RSA_2(RSA **a, unsigned char **pp, long length,
237RSA **a; 220 int (*cb)())
238unsigned char **pp;
239long length;
240int (*cb)();
241 { 221 {
242 NETSCAPE_PKEY *pkey=NULL; 222 NETSCAPE_PKEY *pkey=NULL;
243 RSA *ret=NULL; 223 RSA *ret=NULL;
@@ -249,7 +229,7 @@ int (*cb)();
249 ASN1_OCTET_STRING *os=NULL; 229 ASN1_OCTET_STRING *os=NULL;
250 ASN1_CTX c; 230 ASN1_CTX c;
251 231
252 c.error=ASN1_R_ERROR_STACK; 232 c.error=ERR_R_NESTED_ASN1_ERROR;
253 c.pp=pp; 233 c.pp=pp;
254 234
255 M_ASN1_D2I_Init(); 235 M_ASN1_D2I_Init();
@@ -304,9 +284,7 @@ err:
304 return(ret); 284 return(ret);
305 } 285 }
306 286
307static int i2d_NETSCAPE_PKEY(a,pp) 287static int i2d_NETSCAPE_PKEY(NETSCAPE_PKEY *a, unsigned char **pp)
308NETSCAPE_PKEY *a;
309unsigned char **pp;
310 { 288 {
311 M_ASN1_I2D_vars(a); 289 M_ASN1_I2D_vars(a);
312 290
@@ -324,10 +302,8 @@ unsigned char **pp;
324 M_ASN1_I2D_finish(); 302 M_ASN1_I2D_finish();
325 } 303 }
326 304
327static NETSCAPE_PKEY *d2i_NETSCAPE_PKEY(a,pp,length) 305static NETSCAPE_PKEY *d2i_NETSCAPE_PKEY(NETSCAPE_PKEY **a, unsigned char **pp,
328NETSCAPE_PKEY **a; 306 long length)
329unsigned char **pp;
330long length;
331 { 307 {
332 M_ASN1_D2I_vars(a,NETSCAPE_PKEY *,NETSCAPE_PKEY_new); 308 M_ASN1_D2I_vars(a,NETSCAPE_PKEY *,NETSCAPE_PKEY_new);
333 309
@@ -339,9 +315,10 @@ long length;
339 M_ASN1_D2I_Finish(a,NETSCAPE_PKEY_free,ASN1_F_D2I_NETSCAPE_PKEY); 315 M_ASN1_D2I_Finish(a,NETSCAPE_PKEY_free,ASN1_F_D2I_NETSCAPE_PKEY);
340 } 316 }
341 317
342static NETSCAPE_PKEY *NETSCAPE_PKEY_new() 318static NETSCAPE_PKEY *NETSCAPE_PKEY_new(void)
343 { 319 {
344 NETSCAPE_PKEY *ret=NULL; 320 NETSCAPE_PKEY *ret=NULL;
321 ASN1_CTX c;
345 322
346 M_ASN1_New_Malloc(ret,NETSCAPE_PKEY); 323 M_ASN1_New_Malloc(ret,NETSCAPE_PKEY);
347 M_ASN1_New(ret->version,ASN1_INTEGER_new); 324 M_ASN1_New(ret->version,ASN1_INTEGER_new);
@@ -351,8 +328,7 @@ static NETSCAPE_PKEY *NETSCAPE_PKEY_new()
351 M_ASN1_New_Error(ASN1_F_NETSCAPE_PKEY_NEW); 328 M_ASN1_New_Error(ASN1_F_NETSCAPE_PKEY_NEW);
352 } 329 }
353 330
354static void NETSCAPE_PKEY_free(a) 331static void NETSCAPE_PKEY_free(NETSCAPE_PKEY *a)
355NETSCAPE_PKEY *a;
356 { 332 {
357 if (a == NULL) return; 333 if (a == NULL) return;
358 ASN1_INTEGER_free(a->version); 334 ASN1_INTEGER_free(a->version);
@@ -362,4 +338,4 @@ NETSCAPE_PKEY *a;
362 } 338 }
363 339
364#endif /* NO_RC4 */ 340#endif /* NO_RC4 */
365 341#endif
diff --git a/src/lib/libcrypto/asn1/nsseq.c b/src/lib/libcrypto/asn1/nsseq.c
new file mode 100644
index 0000000000..417d024b81
--- /dev/null
+++ b/src/lib/libcrypto/asn1/nsseq.c
@@ -0,0 +1,118 @@
1/* nsseq.c */
2/* Written by Dr Stephen N Henson (shenson@bigfoot.com) for the OpenSSL
3 * project 1999.
4 */
5/* ====================================================================
6 * Copyright (c) 1999 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 <stdlib.h>
61#include <openssl/asn1_mac.h>
62#include <openssl/err.h>
63#include <openssl/x509.h>
64#include <openssl/objects.h>
65
66/* Netscape certificate sequence structure */
67
68int i2d_NETSCAPE_CERT_SEQUENCE(NETSCAPE_CERT_SEQUENCE *a, unsigned char **pp)
69{
70 int v = 0;
71 M_ASN1_I2D_vars(a);
72 M_ASN1_I2D_len (a->type, i2d_ASN1_OBJECT);
73 M_ASN1_I2D_len_EXP_SEQUENCE_opt_type(X509,a->certs,i2d_X509,0,
74 V_ASN1_SEQUENCE,v);
75
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}
84
85NETSCAPE_CERT_SEQUENCE *NETSCAPE_CERT_SEQUENCE_new(void)
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
97NETSCAPE_CERT_SEQUENCE *d2i_NETSCAPE_CERT_SEQUENCE(NETSCAPE_CERT_SEQUENCE **a,
98 unsigned char **pp, long length)
99{
100 M_ASN1_D2I_vars(a,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
111void NETSCAPE_CERT_SEQUENCE_free (NETSCAPE_CERT_SEQUENCE *a)
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 Free (a);
118}
diff --git a/src/lib/libcrypto/asn1/p5_pbe.c b/src/lib/libcrypto/asn1/p5_pbe.c
new file mode 100644
index 0000000000..b831836e7b
--- /dev/null
+++ b/src/lib/libcrypto/asn1/p5_pbe.c
@@ -0,0 +1,156 @@
1/* p5_pbe.c */
2/* Written by Dr Stephen N Henson (shenson@bigfoot.com) for the OpenSSL
3 * project 1999.
4 */
5/* ====================================================================
6 * Copyright (c) 1999 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/asn1_mac.h>
62#include <openssl/x509.h>
63#include <openssl/rand.h>
64
65/* PKCS#5 password based encryption structure */
66
67int i2d_PBEPARAM(PBEPARAM *a, unsigned char **pp)
68{
69 M_ASN1_I2D_vars(a);
70 M_ASN1_I2D_len (a->salt, i2d_ASN1_OCTET_STRING);
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,ASN1_INTEGER_new);
86 M_ASN1_New(ret->salt,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
101void PBEPARAM_free (PBEPARAM *a)
102{
103 if(a==NULL) return;
104 ASN1_OCTET_STRING_free(a->salt);
105 ASN1_INTEGER_free (a->iter);
106 Free ((char *)a);
107}
108
109/* Return an algorithm identifier for a PKCS#5 PBE algorithm */
110
111X509_ALGOR *PKCS5_pbe_set(int alg, int iter, unsigned char *salt,
112 int saltlen)
113{
114 PBEPARAM *pbe;
115 ASN1_OBJECT *al;
116 X509_ALGOR *algor;
117 ASN1_TYPE *astype;
118
119 if (!(pbe = PBEPARAM_new ())) {
120 ASN1err(ASN1_F_ASN1_PBE_SET,ERR_R_MALLOC_FAILURE);
121 return NULL;
122 }
123 if(iter <= 0) iter = PKCS5_DEFAULT_ITER;
124 ASN1_INTEGER_set (pbe->iter, iter);
125 if (!saltlen) saltlen = PKCS5_SALT_LEN;
126 if (!(pbe->salt->data = Malloc (saltlen))) {
127 ASN1err(ASN1_F_ASN1_PBE_SET,ERR_R_MALLOC_FAILURE);
128 return NULL;
129 }
130 pbe->salt->length = saltlen;
131 if (salt) memcpy (pbe->salt->data, salt, saltlen);
132 else RAND_bytes (pbe->salt->data, saltlen);
133
134 if (!(astype = ASN1_TYPE_new())) {
135 ASN1err(ASN1_F_ASN1_PBE_SET,ERR_R_MALLOC_FAILURE);
136 return NULL;
137 }
138
139 astype->type = V_ASN1_SEQUENCE;
140 if(!ASN1_pack_string(pbe, i2d_PBEPARAM, &astype->value.sequence)) {
141 ASN1err(ASN1_F_ASN1_PBE_SET,ERR_R_MALLOC_FAILURE);
142 return NULL;
143 }
144 PBEPARAM_free (pbe);
145
146 al = OBJ_nid2obj(alg); /* never need to free al */
147 if (!(algor = X509_ALGOR_new())) {
148 ASN1err(ASN1_F_ASN1_PBE_SET,ERR_R_MALLOC_FAILURE);
149 return NULL;
150 }
151 ASN1_OBJECT_free(algor->algorithm);
152 algor->algorithm = al;
153 algor->parameter = astype;
154
155 return (algor);
156}
diff --git a/src/lib/libcrypto/asn1/p5_pbev2.c b/src/lib/libcrypto/asn1/p5_pbev2.c
new file mode 100644
index 0000000000..09f4bf6112
--- /dev/null
+++ b/src/lib/libcrypto/asn1/p5_pbev2.c
@@ -0,0 +1,274 @@
1/* p5_pbev2.c */
2/* Written by Dr Stephen N Henson (shenson@bigfoot.com) for the OpenSSL
3 * project 1999.
4 */
5/* ====================================================================
6 * Copyright (c) 1999 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/asn1_mac.h>
62#include <openssl/x509.h>
63#include <openssl/rand.h>
64
65/* PKCS#5 v2.0 password based encryption structures */
66
67int i2d_PBE2PARAM(PBE2PARAM *a, unsigned char **pp)
68{
69 M_ASN1_I2D_vars(a);
70 M_ASN1_I2D_len (a->keyfunc, i2d_X509_ALGOR);
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 Free ((char *)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
118 M_ASN1_I2D_seq_total ();
119
120 M_ASN1_I2D_put (a->salt, i2d_ASN1_TYPE);
121 M_ASN1_I2D_put (a->iter, i2d_ASN1_INTEGER);
122 M_ASN1_I2D_put (a->keylength, i2d_ASN1_INTEGER);
123 M_ASN1_I2D_put (a->prf, i2d_X509_ALGOR);
124
125 M_ASN1_I2D_finish();
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, 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 ASN1_INTEGER_free(a->iter);
159 ASN1_INTEGER_free(a->keylength);
160 X509_ALGOR_free(a->prf);
161 Free ((char *)a);
162}
163
164/* Return an algorithm identifier for a PKCS#5 v2.0 PBE algorithm:
165 * yes I know this is horrible!
166 */
167
168X509_ALGOR *PKCS5_pbe2_set(const EVP_CIPHER *cipher, int iter,
169 unsigned char *salt, int saltlen)
170{
171 X509_ALGOR *scheme = NULL, *kalg = NULL, *ret = NULL;
172 int alg_nid;
173 EVP_CIPHER_CTX ctx;
174 unsigned char iv[EVP_MAX_IV_LENGTH];
175 PBKDF2PARAM *kdf = NULL;
176 PBE2PARAM *pbe2 = NULL;
177 ASN1_OCTET_STRING *osalt = NULL;
178
179 if(!(pbe2 = PBE2PARAM_new())) goto merr;
180
181 /* Setup the AlgorithmIdentifier for the encryption scheme */
182 scheme = pbe2->encryption;
183
184 alg_nid = EVP_CIPHER_type(cipher);
185
186 scheme->algorithm = OBJ_nid2obj(alg_nid);
187 if(!(scheme->parameter = ASN1_TYPE_new())) goto merr;
188
189 /* Create random IV */
190 RAND_bytes(iv, EVP_CIPHER_iv_length(cipher));
191
192 /* Dummy cipherinit to just setup the IV */
193 EVP_CipherInit(&ctx, cipher, NULL, iv, 0);
194 if(EVP_CIPHER_param_to_asn1(&ctx, scheme->parameter) < 0) {
195 ASN1err(ASN1_F_PKCS5_PBE2_SET,
196 ASN1_R_ERROR_SETTING_CIPHER_PARAMS);
197 goto err;
198 }
199 EVP_CIPHER_CTX_cleanup(&ctx);
200
201 if(!(kdf = PBKDF2PARAM_new())) goto merr;
202 if(!(osalt = ASN1_OCTET_STRING_new())) goto merr;
203
204 if (!saltlen) saltlen = PKCS5_SALT_LEN;
205 if (!(osalt->data = Malloc (saltlen))) goto merr;
206 osalt->length = saltlen;
207 if (salt) memcpy (osalt->data, salt, saltlen);
208 else RAND_bytes (osalt->data, saltlen);
209
210 if(iter <= 0) iter = PKCS5_DEFAULT_ITER;
211 if(!ASN1_INTEGER_set(kdf->iter, iter)) goto merr;
212
213 /* Now include salt in kdf structure */
214 kdf->salt->value.octet_string = osalt;
215 kdf->salt->type = V_ASN1_OCTET_STRING;
216 osalt = NULL;
217
218 /* If its RC2 then we'd better setup the key length */
219
220 if(alg_nid == NID_rc2_cbc) {
221 if(!(kdf->keylength = ASN1_INTEGER_new())) goto merr;
222 if(!ASN1_INTEGER_set (kdf->keylength,
223 EVP_CIPHER_key_length(cipher))) goto merr;
224 }
225
226 /* prf can stay NULL because we are using hmacWithSHA1 */
227
228 /* Now setup the PBE2PARAM keyfunc structure */
229
230 pbe2->keyfunc->algorithm = OBJ_nid2obj(NID_id_pbkdf2);
231
232 /* Encode PBKDF2PARAM into parameter of pbe2 */
233
234 if(!(pbe2->keyfunc->parameter = ASN1_TYPE_new())) goto merr;
235
236 if(!ASN1_pack_string(kdf, i2d_PBKDF2PARAM,
237 &pbe2->keyfunc->parameter->value.sequence)) goto merr;
238 pbe2->keyfunc->parameter->type = V_ASN1_SEQUENCE;
239
240 PBKDF2PARAM_free(kdf);
241 kdf = NULL;
242
243 /* Now set up top level AlgorithmIdentifier */
244
245 if(!(ret = X509_ALGOR_new())) goto merr;
246 if(!(ret->parameter = ASN1_TYPE_new())) goto merr;
247
248 ret->algorithm = OBJ_nid2obj(NID_pbes2);
249
250 /* Encode PBE2PARAM into parameter */
251
252 if(!ASN1_pack_string(pbe2, i2d_PBE2PARAM,
253 &ret->parameter->value.sequence)) goto merr;
254 ret->parameter->type = V_ASN1_SEQUENCE;
255
256 PBE2PARAM_free(pbe2);
257 pbe2 = NULL;
258
259 return ret;
260
261 merr:
262 ASN1err(ASN1_F_PKCS5_PBE2_SET,ERR_R_MALLOC_FAILURE);
263
264 err:
265 PBE2PARAM_free(pbe2);
266 /* Note 'scheme' is freed as part of pbe2 */
267 ASN1_OCTET_STRING_free(osalt);
268 PBKDF2PARAM_free(kdf);
269 X509_ALGOR_free(kalg);
270 X509_ALGOR_free(ret);
271
272 return NULL;
273
274}
diff --git a/src/lib/libcrypto/asn1/p7_dgst.c b/src/lib/libcrypto/asn1/p7_dgst.c
index f71ed8eb1d..62783a2b8d 100644
--- a/src/lib/libcrypto/asn1/p7_dgst.c
+++ b/src/lib/libcrypto/asn1/p7_dgst.c
@@ -58,17 +58,10 @@
58 58
59#include <stdio.h> 59#include <stdio.h>
60#include "cryptlib.h" 60#include "cryptlib.h"
61#include "asn1_mac.h" 61#include <openssl/asn1_mac.h>
62#include "x509.h" 62#include <openssl/x509.h>
63 63
64/* 64int i2d_PKCS7_DIGEST(PKCS7_DIGEST *a, unsigned char **pp)
65 * ASN1err(ASN1_F_PKCS7_DIGEST_NEW,ASN1_R_MISSING_EOS);
66 * ASN1err(ASN1_F_D2I_PKCS7_DIGEST,ASN1_R_LENGTH_MISMATCH);
67 */
68
69int i2d_PKCS7_DIGEST(a,pp)
70PKCS7_DIGEST *a;
71unsigned char **pp;
72 { 65 {
73 M_ASN1_I2D_vars(a); 66 M_ASN1_I2D_vars(a);
74 67
@@ -87,10 +80,8 @@ unsigned char **pp;
87 M_ASN1_I2D_finish(); 80 M_ASN1_I2D_finish();
88 } 81 }
89 82
90PKCS7_DIGEST *d2i_PKCS7_DIGEST(a,pp,length) 83PKCS7_DIGEST *d2i_PKCS7_DIGEST(PKCS7_DIGEST **a, unsigned char **pp,
91PKCS7_DIGEST **a; 84 long length)
92unsigned char **pp;
93long length;
94 { 85 {
95 M_ASN1_D2I_vars(a,PKCS7_DIGEST *,PKCS7_DIGEST_new); 86 M_ASN1_D2I_vars(a,PKCS7_DIGEST *,PKCS7_DIGEST_new);
96 87
@@ -104,9 +95,10 @@ long length;
104 M_ASN1_D2I_Finish(a,PKCS7_DIGEST_free,ASN1_F_D2I_PKCS7_DIGEST); 95 M_ASN1_D2I_Finish(a,PKCS7_DIGEST_free,ASN1_F_D2I_PKCS7_DIGEST);
105 } 96 }
106 97
107PKCS7_DIGEST *PKCS7_DIGEST_new() 98PKCS7_DIGEST *PKCS7_DIGEST_new(void)
108 { 99 {
109 PKCS7_DIGEST *ret=NULL; 100 PKCS7_DIGEST *ret=NULL;
101 ASN1_CTX c;
110 102
111 M_ASN1_New_Malloc(ret,PKCS7_DIGEST); 103 M_ASN1_New_Malloc(ret,PKCS7_DIGEST);
112 M_ASN1_New(ret->version,ASN1_INTEGER_new); 104 M_ASN1_New(ret->version,ASN1_INTEGER_new);
@@ -117,8 +109,7 @@ PKCS7_DIGEST *PKCS7_DIGEST_new()
117 M_ASN1_New_Error(ASN1_F_PKCS7_DIGEST_NEW); 109 M_ASN1_New_Error(ASN1_F_PKCS7_DIGEST_NEW);
118 } 110 }
119 111
120void PKCS7_DIGEST_free(a) 112void PKCS7_DIGEST_free(PKCS7_DIGEST *a)
121PKCS7_DIGEST *a;
122 { 113 {
123 if (a == NULL) return; 114 if (a == NULL) return;
124 ASN1_INTEGER_free(a->version); 115 ASN1_INTEGER_free(a->version);
diff --git a/src/lib/libcrypto/asn1/p7_enc.c b/src/lib/libcrypto/asn1/p7_enc.c
index 874dd78389..4741126587 100644
--- a/src/lib/libcrypto/asn1/p7_enc.c
+++ b/src/lib/libcrypto/asn1/p7_enc.c
@@ -58,17 +58,10 @@
58 58
59#include <stdio.h> 59#include <stdio.h>
60#include "cryptlib.h" 60#include "cryptlib.h"
61#include "asn1_mac.h" 61#include <openssl/asn1_mac.h>
62#include "x509.h" 62#include <openssl/x509.h>
63 63
64/* 64int i2d_PKCS7_ENCRYPT(PKCS7_ENCRYPT *a, unsigned char **pp)
65 * ASN1err(ASN1_F_PKCS7_ENCRYPT_NEW,ASN1_R_LENGTH_MISMATCH);
66 * ASN1err(ASN1_F_D2I_PKCS7_ENCRYPT,ASN1_R_LENGTH_MISMATCH);
67 */
68
69int i2d_PKCS7_ENCRYPT(a,pp)
70PKCS7_ENCRYPT *a;
71unsigned char **pp;
72 { 65 {
73 M_ASN1_I2D_vars(a); 66 M_ASN1_I2D_vars(a);
74 67
@@ -83,10 +76,8 @@ unsigned char **pp;
83 M_ASN1_I2D_finish(); 76 M_ASN1_I2D_finish();
84 } 77 }
85 78
86PKCS7_ENCRYPT *d2i_PKCS7_ENCRYPT(a,pp,length) 79PKCS7_ENCRYPT *d2i_PKCS7_ENCRYPT(PKCS7_ENCRYPT **a, unsigned char **pp,
87PKCS7_ENCRYPT **a; 80 long length)
88unsigned char **pp;
89long length;
90 { 81 {
91 M_ASN1_D2I_vars(a,PKCS7_ENCRYPT *,PKCS7_ENCRYPT_new); 82 M_ASN1_D2I_vars(a,PKCS7_ENCRYPT *,PKCS7_ENCRYPT_new);
92 83
@@ -98,9 +89,10 @@ long length;
98 M_ASN1_D2I_Finish(a,PKCS7_ENCRYPT_free,ASN1_F_D2I_PKCS7_ENCRYPT); 89 M_ASN1_D2I_Finish(a,PKCS7_ENCRYPT_free,ASN1_F_D2I_PKCS7_ENCRYPT);
99 } 90 }
100 91
101PKCS7_ENCRYPT *PKCS7_ENCRYPT_new() 92PKCS7_ENCRYPT *PKCS7_ENCRYPT_new(void)
102 { 93 {
103 PKCS7_ENCRYPT *ret=NULL; 94 PKCS7_ENCRYPT *ret=NULL;
95 ASN1_CTX c;
104 96
105 M_ASN1_New_Malloc(ret,PKCS7_ENCRYPT); 97 M_ASN1_New_Malloc(ret,PKCS7_ENCRYPT);
106 M_ASN1_New(ret->version,ASN1_INTEGER_new); 98 M_ASN1_New(ret->version,ASN1_INTEGER_new);
@@ -109,8 +101,7 @@ PKCS7_ENCRYPT *PKCS7_ENCRYPT_new()
109 M_ASN1_New_Error(ASN1_F_PKCS7_ENCRYPT_NEW); 101 M_ASN1_New_Error(ASN1_F_PKCS7_ENCRYPT_NEW);
110 } 102 }
111 103
112void PKCS7_ENCRYPT_free(a) 104void PKCS7_ENCRYPT_free(PKCS7_ENCRYPT *a)
113PKCS7_ENCRYPT *a;
114 { 105 {
115 if (a == NULL) return; 106 if (a == NULL) return;
116 ASN1_INTEGER_free(a->version); 107 ASN1_INTEGER_free(a->version);
diff --git a/src/lib/libcrypto/asn1/p7_enc_c.c b/src/lib/libcrypto/asn1/p7_enc_c.c
index 2860d3e925..a832737a38 100644
--- a/src/lib/libcrypto/asn1/p7_enc_c.c
+++ b/src/lib/libcrypto/asn1/p7_enc_c.c
@@ -58,17 +58,10 @@
58 58
59#include <stdio.h> 59#include <stdio.h>
60#include "cryptlib.h" 60#include "cryptlib.h"
61#include "asn1_mac.h" 61#include <openssl/asn1_mac.h>
62#include "x509.h" 62#include <openssl/x509.h>
63 63
64/* 64int i2d_PKCS7_ENC_CONTENT(PKCS7_ENC_CONTENT *a, unsigned char **pp)
65 * ASN1err(ASN1_F_PKCS7_ENC_CONTENT_NEW,ASN1_R_LENGTH_MISMATCH);
66 * ASN1err(ASN1_F_D2I_PKCS7_ENC_CONTENT,ASN1_R_LENGTH_MISMATCH);
67 */
68
69int i2d_PKCS7_ENC_CONTENT(a,pp)
70PKCS7_ENC_CONTENT *a;
71unsigned char **pp;
72 { 65 {
73 M_ASN1_I2D_vars(a); 66 M_ASN1_I2D_vars(a);
74 67
@@ -85,10 +78,8 @@ unsigned char **pp;
85 M_ASN1_I2D_finish(); 78 M_ASN1_I2D_finish();
86 } 79 }
87 80
88PKCS7_ENC_CONTENT *d2i_PKCS7_ENC_CONTENT(a,pp,length) 81PKCS7_ENC_CONTENT *d2i_PKCS7_ENC_CONTENT(PKCS7_ENC_CONTENT **a,
89PKCS7_ENC_CONTENT **a; 82 unsigned char **pp, long length)
90unsigned char **pp;
91long length;
92 { 83 {
93 M_ASN1_D2I_vars(a,PKCS7_ENC_CONTENT *,PKCS7_ENC_CONTENT_new); 84 M_ASN1_D2I_vars(a,PKCS7_ENC_CONTENT *,PKCS7_ENC_CONTENT_new);
94 85
@@ -103,20 +94,21 @@ long length;
103 ASN1_F_D2I_PKCS7_ENC_CONTENT); 94 ASN1_F_D2I_PKCS7_ENC_CONTENT);
104 } 95 }
105 96
106PKCS7_ENC_CONTENT *PKCS7_ENC_CONTENT_new() 97PKCS7_ENC_CONTENT *PKCS7_ENC_CONTENT_new(void)
107 { 98 {
108 PKCS7_ENC_CONTENT *ret=NULL; 99 PKCS7_ENC_CONTENT *ret=NULL;
100 ASN1_CTX c;
109 101
110 M_ASN1_New_Malloc(ret,PKCS7_ENC_CONTENT); 102 M_ASN1_New_Malloc(ret,PKCS7_ENC_CONTENT);
111 M_ASN1_New(ret->content_type,ASN1_OBJECT_new); 103 /* M_ASN1_New(ret->content_type,ASN1_OBJECT_new); */
104 ret->content_type=OBJ_nid2obj(NID_pkcs7_encrypted);
112 M_ASN1_New(ret->algorithm,X509_ALGOR_new); 105 M_ASN1_New(ret->algorithm,X509_ALGOR_new);
113 ret->enc_data=NULL; 106 ret->enc_data=NULL;
114 return(ret); 107 return(ret);
115 M_ASN1_New_Error(ASN1_F_PKCS7_ENC_CONTENT_NEW); 108 M_ASN1_New_Error(ASN1_F_PKCS7_ENC_CONTENT_NEW);
116 } 109 }
117 110
118void PKCS7_ENC_CONTENT_free(a) 111void PKCS7_ENC_CONTENT_free(PKCS7_ENC_CONTENT *a)
119PKCS7_ENC_CONTENT *a;
120 { 112 {
121 if (a == NULL) return; 113 if (a == NULL) return;
122 ASN1_OBJECT_free(a->content_type); 114 ASN1_OBJECT_free(a->content_type);
diff --git a/src/lib/libcrypto/asn1/p7_evp.c b/src/lib/libcrypto/asn1/p7_evp.c
index 4db0a7fe62..b2b3d50dcd 100644
--- a/src/lib/libcrypto/asn1/p7_evp.c
+++ b/src/lib/libcrypto/asn1/p7_evp.c
@@ -58,67 +58,61 @@
58 58
59#include <stdio.h> 59#include <stdio.h>
60#include "cryptlib.h" 60#include "cryptlib.h"
61#include "asn1_mac.h" 61#include <openssl/asn1_mac.h>
62#include "x509.h" 62#include <openssl/x509.h>
63 63
64/* 64int i2d_PKCS7_ENVELOPE(PKCS7_ENVELOPE *a, unsigned char **pp)
65 * ASN1err(ASN1_F_PKCS7_ENVELOPE_NEW,ASN1_R_LENGTH_MISMATCH);
66 * ASN1err(ASN1_F_D2I_PKCS7_ENVELOPE,ASN1_R_LENGTH_MISMATCH);
67 */
68
69int i2d_PKCS7_ENVELOPE(a,pp)
70PKCS7_ENVELOPE *a;
71unsigned char **pp;
72 { 65 {
73 M_ASN1_I2D_vars(a); 66 M_ASN1_I2D_vars(a);
74 67
75 M_ASN1_I2D_len(a->version,i2d_ASN1_INTEGER); 68 M_ASN1_I2D_len(a->version,i2d_ASN1_INTEGER);
76 M_ASN1_I2D_len_SET(a->recipientinfo,i2d_PKCS7_RECIP_INFO); 69 M_ASN1_I2D_len_SET_type(PKCS7_RECIP_INFO,a->recipientinfo,
70 i2d_PKCS7_RECIP_INFO);
77 M_ASN1_I2D_len(a->enc_data,i2d_PKCS7_ENC_CONTENT); 71 M_ASN1_I2D_len(a->enc_data,i2d_PKCS7_ENC_CONTENT);
78 72
79 M_ASN1_I2D_seq_total(); 73 M_ASN1_I2D_seq_total();
80 74
81 M_ASN1_I2D_put(a->version,i2d_ASN1_INTEGER); 75 M_ASN1_I2D_put(a->version,i2d_ASN1_INTEGER);
82 M_ASN1_I2D_put_SET(a->recipientinfo,i2d_PKCS7_RECIP_INFO); 76 M_ASN1_I2D_put_SET_type(PKCS7_RECIP_INFO,a->recipientinfo,
77 i2d_PKCS7_RECIP_INFO);
83 M_ASN1_I2D_put(a->enc_data,i2d_PKCS7_ENC_CONTENT); 78 M_ASN1_I2D_put(a->enc_data,i2d_PKCS7_ENC_CONTENT);
84 79
85 M_ASN1_I2D_finish(); 80 M_ASN1_I2D_finish();
86 } 81 }
87 82
88PKCS7_ENVELOPE *d2i_PKCS7_ENVELOPE(a,pp,length) 83PKCS7_ENVELOPE *d2i_PKCS7_ENVELOPE(PKCS7_ENVELOPE **a, unsigned char **pp,
89PKCS7_ENVELOPE **a; 84 long length)
90unsigned char **pp;
91long length;
92 { 85 {
93 M_ASN1_D2I_vars(a,PKCS7_ENVELOPE *,PKCS7_ENVELOPE_new); 86 M_ASN1_D2I_vars(a,PKCS7_ENVELOPE *,PKCS7_ENVELOPE_new);
94 87
95 M_ASN1_D2I_Init(); 88 M_ASN1_D2I_Init();
96 M_ASN1_D2I_start_sequence(); 89 M_ASN1_D2I_start_sequence();
97 M_ASN1_D2I_get(ret->version,d2i_ASN1_INTEGER); 90 M_ASN1_D2I_get(ret->version,d2i_ASN1_INTEGER);
98 M_ASN1_D2I_get_set(ret->recipientinfo,d2i_PKCS7_RECIP_INFO); 91 M_ASN1_D2I_get_set_type(PKCS7_RECIP_INFO,ret->recipientinfo,
92 d2i_PKCS7_RECIP_INFO,PKCS7_RECIP_INFO_free);
99 M_ASN1_D2I_get(ret->enc_data,d2i_PKCS7_ENC_CONTENT); 93 M_ASN1_D2I_get(ret->enc_data,d2i_PKCS7_ENC_CONTENT);
100 94
101 M_ASN1_D2I_Finish(a,PKCS7_ENVELOPE_free,ASN1_F_D2I_PKCS7_ENVELOPE); 95 M_ASN1_D2I_Finish(a,PKCS7_ENVELOPE_free,ASN1_F_D2I_PKCS7_ENVELOPE);
102 } 96 }
103 97
104PKCS7_ENVELOPE *PKCS7_ENVELOPE_new() 98PKCS7_ENVELOPE *PKCS7_ENVELOPE_new(void)
105 { 99 {
106 PKCS7_ENVELOPE *ret=NULL; 100 PKCS7_ENVELOPE *ret=NULL;
101 ASN1_CTX c;
107 102
108 M_ASN1_New_Malloc(ret,PKCS7_ENVELOPE); 103 M_ASN1_New_Malloc(ret,PKCS7_ENVELOPE);
109 M_ASN1_New(ret->version,ASN1_INTEGER_new); 104 M_ASN1_New(ret->version,ASN1_INTEGER_new);
110 M_ASN1_New(ret->recipientinfo,sk_new_null); 105 M_ASN1_New(ret->recipientinfo,sk_PKCS7_RECIP_INFO_new_null);
111 M_ASN1_New(ret->enc_data,PKCS7_ENC_CONTENT_new); 106 M_ASN1_New(ret->enc_data,PKCS7_ENC_CONTENT_new);
112 return(ret); 107 return(ret);
113 M_ASN1_New_Error(ASN1_F_PKCS7_ENVELOPE_NEW); 108 M_ASN1_New_Error(ASN1_F_PKCS7_ENVELOPE_NEW);
114 } 109 }
115 110
116void PKCS7_ENVELOPE_free(a) 111void PKCS7_ENVELOPE_free(PKCS7_ENVELOPE *a)
117PKCS7_ENVELOPE *a;
118 { 112 {
119 if (a == NULL) return; 113 if (a == NULL) return;
120 ASN1_INTEGER_free(a->version); 114 ASN1_INTEGER_free(a->version);
121 sk_pop_free(a->recipientinfo,PKCS7_RECIP_INFO_free); 115 sk_PKCS7_RECIP_INFO_pop_free(a->recipientinfo,PKCS7_RECIP_INFO_free);
122 PKCS7_ENC_CONTENT_free(a->enc_data); 116 PKCS7_ENC_CONTENT_free(a->enc_data);
123 Free((char *)a); 117 Free((char *)a);
124 } 118 }
diff --git a/src/lib/libcrypto/asn1/p7_i_s.c b/src/lib/libcrypto/asn1/p7_i_s.c
index 9b00c556d9..7d4b457e01 100644
--- a/src/lib/libcrypto/asn1/p7_i_s.c
+++ b/src/lib/libcrypto/asn1/p7_i_s.c
@@ -58,17 +58,11 @@
58 58
59#include <stdio.h> 59#include <stdio.h>
60#include "cryptlib.h" 60#include "cryptlib.h"
61#include "asn1_mac.h" 61#include <openssl/asn1_mac.h>
62#include "x509.h" 62#include <openssl/x509.h>
63 63
64/* 64int i2d_PKCS7_ISSUER_AND_SERIAL(PKCS7_ISSUER_AND_SERIAL *a,
65 * ASN1err(ASN1_F_PKCS7_ISSUER_AND_SERIAL_NEW,ASN1_R_LENGTH_MISMATCH); 65 unsigned char **pp)
66 * ASN1err(ASN1_F_D2I_PKCS7_ISSUER_AND_SERIAL,ASN1_R_LENGTH_MISMATCH);
67 */
68
69int i2d_PKCS7_ISSUER_AND_SERIAL(a,pp)
70PKCS7_ISSUER_AND_SERIAL *a;
71unsigned char **pp;
72 { 66 {
73 M_ASN1_I2D_vars(a); 67 M_ASN1_I2D_vars(a);
74 68
@@ -83,10 +77,7 @@ unsigned char **pp;
83 M_ASN1_I2D_finish(); 77 M_ASN1_I2D_finish();
84 } 78 }
85 79
86PKCS7_ISSUER_AND_SERIAL *d2i_PKCS7_ISSUER_AND_SERIAL(a,pp,length) 80PKCS7_ISSUER_AND_SERIAL *d2i_PKCS7_ISSUER_AND_SERIAL(PKCS7_ISSUER_AND_SERIAL **a, unsigned char **pp, long length)
87PKCS7_ISSUER_AND_SERIAL **a;
88unsigned char **pp;
89long length;
90 { 81 {
91 M_ASN1_D2I_vars(a,PKCS7_ISSUER_AND_SERIAL *,PKCS7_ISSUER_AND_SERIAL_new); 82 M_ASN1_D2I_vars(a,PKCS7_ISSUER_AND_SERIAL *,PKCS7_ISSUER_AND_SERIAL_new);
92 83
@@ -98,9 +89,10 @@ long length;
98 ASN1_F_D2I_PKCS7_ISSUER_AND_SERIAL); 89 ASN1_F_D2I_PKCS7_ISSUER_AND_SERIAL);
99 } 90 }
100 91
101PKCS7_ISSUER_AND_SERIAL *PKCS7_ISSUER_AND_SERIAL_new() 92PKCS7_ISSUER_AND_SERIAL *PKCS7_ISSUER_AND_SERIAL_new(void)
102 { 93 {
103 PKCS7_ISSUER_AND_SERIAL *ret=NULL; 94 PKCS7_ISSUER_AND_SERIAL *ret=NULL;
95 ASN1_CTX c;
104 96
105 M_ASN1_New_Malloc(ret,PKCS7_ISSUER_AND_SERIAL); 97 M_ASN1_New_Malloc(ret,PKCS7_ISSUER_AND_SERIAL);
106 M_ASN1_New(ret->issuer,X509_NAME_new); 98 M_ASN1_New(ret->issuer,X509_NAME_new);
@@ -109,8 +101,7 @@ PKCS7_ISSUER_AND_SERIAL *PKCS7_ISSUER_AND_SERIAL_new()
109 M_ASN1_New_Error(ASN1_F_PKCS7_ISSUER_AND_SERIAL_NEW); 101 M_ASN1_New_Error(ASN1_F_PKCS7_ISSUER_AND_SERIAL_NEW);
110 } 102 }
111 103
112void PKCS7_ISSUER_AND_SERIAL_free(a) 104void PKCS7_ISSUER_AND_SERIAL_free(PKCS7_ISSUER_AND_SERIAL *a)
113PKCS7_ISSUER_AND_SERIAL *a;
114 { 105 {
115 if (a == NULL) return; 106 if (a == NULL) return;
116 X509_NAME_free(a->issuer); 107 X509_NAME_free(a->issuer);
diff --git a/src/lib/libcrypto/asn1/p7_lib.c b/src/lib/libcrypto/asn1/p7_lib.c
index 2134e0974a..846be17158 100644
--- a/src/lib/libcrypto/asn1/p7_lib.c
+++ b/src/lib/libcrypto/asn1/p7_lib.c
@@ -58,17 +58,11 @@
58 58
59#include <stdio.h> 59#include <stdio.h>
60#include "cryptlib.h" 60#include "cryptlib.h"
61#include "asn1_mac.h" 61#include <openssl/asn1_mac.h>
62#include "objects.h" 62#include <openssl/pkcs7.h>
63#include <openssl/objects.h>
63 64
64/* ASN1err(ASN1_F_D2I_PKCS7,ASN1_R_BAD_PKCS7_CONTENT); 65int i2d_PKCS7(PKCS7 *a, unsigned char **pp)
65 * ASN1err(ASN1_F_I2D_PKCS7,ASN1_R_BAD_PKCS7_TYPE);
66 * ASN1err(ASN1_F_PKCS7_NEW,ASN1_R_BAD_PKCS7_TYPE);
67 */
68
69int i2d_PKCS7(a,pp)
70PKCS7 *a;
71unsigned char **pp;
72 { 66 {
73 M_ASN1_I2D_vars(a); 67 M_ASN1_I2D_vars(a);
74 68
@@ -150,10 +144,7 @@ unsigned char **pp;
150 M_ASN1_I2D_finish(); 144 M_ASN1_I2D_finish();
151 } 145 }
152 146
153PKCS7 *d2i_PKCS7(a,pp,length) 147PKCS7 *d2i_PKCS7(PKCS7 **a, unsigned char **pp, long length)
154PKCS7 **a;
155unsigned char **pp;
156long length;
157 { 148 {
158 M_ASN1_D2I_vars(a,PKCS7 *,PKCS7_new); 149 M_ASN1_D2I_vars(a,PKCS7 *,PKCS7_new);
159 150
@@ -179,6 +170,7 @@ long length;
179 V_ASN1_CONTEXT_SPECIFIC|0)) 170 V_ASN1_CONTEXT_SPECIFIC|0))
180 { 171 {
181 c.error=ASN1_R_BAD_PKCS7_CONTENT; 172 c.error=ASN1_R_BAD_PKCS7_CONTENT;
173 c.line=__LINE__;
182 goto err; 174 goto err;
183 } 175 }
184 176
@@ -187,7 +179,7 @@ long length;
187 c.q=c.p; 179 c.q=c.p;
188 Tinf=ASN1_get_object(&c.p,&Tlen,&Ttag,&Tclass, 180 Tinf=ASN1_get_object(&c.p,&Tlen,&Ttag,&Tclass,
189 (c.inf & 1)?(length+ *pp-c.q):c.slen); 181 (c.inf & 1)?(length+ *pp-c.q):c.slen);
190 if (Tinf & 0x80) goto err; 182 if (Tinf & 0x80) { c.line=__LINE__; goto err; }
191 c.slen-=(c.p-c.q); 183 c.slen-=(c.p-c.q);
192 184
193 switch (OBJ_obj2nid(ret->type)) 185 switch (OBJ_obj2nid(ret->type))
@@ -215,14 +207,16 @@ long length;
215 break; 207 break;
216 default: 208 default:
217 c.error=ASN1_R_BAD_PKCS7_TYPE; 209 c.error=ASN1_R_BAD_PKCS7_TYPE;
210 c.line=__LINE__;
218 goto err; 211 goto err;
219 break; 212 /* break; */
220 } 213 }
221 if (Tinf == (1|V_ASN1_CONSTRUCTED)) 214 if (Tinf == (1|V_ASN1_CONSTRUCTED))
222 { 215 {
223 if (!ASN1_check_infinite_end(&c.p,c.slen)) 216 if (!ASN1_check_infinite_end(&c.p,c.slen))
224 { 217 {
225 c.error=ASN1_R_MISSING_EOS; 218 c.error=ERR_R_MISSING_ASN1_EOS;
219 c.line=__LINE__;
226 goto err; 220 goto err;
227 } 221 }
228 } 222 }
@@ -233,12 +227,13 @@ long length;
233 M_ASN1_D2I_Finish(a,PKCS7_free,ASN1_F_D2I_PKCS7); 227 M_ASN1_D2I_Finish(a,PKCS7_free,ASN1_F_D2I_PKCS7);
234 } 228 }
235 229
236PKCS7 *PKCS7_new() 230PKCS7 *PKCS7_new(void)
237 { 231 {
238 PKCS7 *ret=NULL; 232 PKCS7 *ret=NULL;
233 ASN1_CTX c;
239 234
240 M_ASN1_New_Malloc(ret,PKCS7); 235 M_ASN1_New_Malloc(ret,PKCS7);
241 ret->type=ASN1_OBJECT_new(); 236 ret->type=OBJ_nid2obj(NID_undef);
242 ret->asn1=NULL; 237 ret->asn1=NULL;
243 ret->length=0; 238 ret->length=0;
244 ret->detached=0; 239 ret->detached=0;
@@ -247,8 +242,7 @@ PKCS7 *PKCS7_new()
247 M_ASN1_New_Error(ASN1_F_PKCS7_NEW); 242 M_ASN1_New_Error(ASN1_F_PKCS7_NEW);
248 } 243 }
249 244
250void PKCS7_free(a) 245void PKCS7_free(PKCS7 *a)
251PKCS7 *a;
252 { 246 {
253 if (a == NULL) return; 247 if (a == NULL) return;
254 248
@@ -260,9 +254,11 @@ PKCS7 *a;
260 Free((char *)(char *)a); 254 Free((char *)(char *)a);
261 } 255 }
262 256
263void PKCS7_content_free(a) 257void PKCS7_content_free(PKCS7 *a)
264PKCS7 *a;
265 { 258 {
259 if(a == NULL)
260 return;
261
266 if (a->asn1 != NULL) Free((char *)a->asn1); 262 if (a->asn1 != NULL) Free((char *)a->asn1);
267 263
268 if (a->d.ptr != NULL) 264 if (a->d.ptr != NULL)
diff --git a/src/lib/libcrypto/asn1/p7_recip.c b/src/lib/libcrypto/asn1/p7_recip.c
index f02233f5a8..9fda4f20d4 100644
--- a/src/lib/libcrypto/asn1/p7_recip.c
+++ b/src/lib/libcrypto/asn1/p7_recip.c
@@ -58,17 +58,10 @@
58 58
59#include <stdio.h> 59#include <stdio.h>
60#include "cryptlib.h" 60#include "cryptlib.h"
61#include "asn1_mac.h" 61#include <openssl/asn1_mac.h>
62#include "x509.h" 62#include <openssl/x509.h>
63 63
64/* 64int i2d_PKCS7_RECIP_INFO(PKCS7_RECIP_INFO *a, unsigned char **pp)
65 * ASN1err(ASN1_F_PKCS7_RECIP_INFO_NEW,ASN1_R_LENGTH_MISMATCH);
66 * ASN1err(ASN1_F_D2I_PKCS7_RECIP_INFO,ASN1_R_LENGTH_MISMATCH);
67 */
68
69int i2d_PKCS7_RECIP_INFO(a,pp)
70PKCS7_RECIP_INFO *a;
71unsigned char **pp;
72 { 65 {
73 M_ASN1_I2D_vars(a); 66 M_ASN1_I2D_vars(a);
74 67
@@ -87,10 +80,8 @@ unsigned char **pp;
87 M_ASN1_I2D_finish(); 80 M_ASN1_I2D_finish();
88 } 81 }
89 82
90PKCS7_RECIP_INFO *d2i_PKCS7_RECIP_INFO(a,pp,length) 83PKCS7_RECIP_INFO *d2i_PKCS7_RECIP_INFO(PKCS7_RECIP_INFO **a,
91PKCS7_RECIP_INFO **a; 84 unsigned char **pp, long length)
92unsigned char **pp;
93long length;
94 { 85 {
95 M_ASN1_D2I_vars(a,PKCS7_RECIP_INFO *,PKCS7_RECIP_INFO_new); 86 M_ASN1_D2I_vars(a,PKCS7_RECIP_INFO *,PKCS7_RECIP_INFO_new);
96 87
@@ -104,9 +95,10 @@ long length;
104 M_ASN1_D2I_Finish(a,PKCS7_RECIP_INFO_free,ASN1_F_D2I_PKCS7_RECIP_INFO); 95 M_ASN1_D2I_Finish(a,PKCS7_RECIP_INFO_free,ASN1_F_D2I_PKCS7_RECIP_INFO);
105 } 96 }
106 97
107PKCS7_RECIP_INFO *PKCS7_RECIP_INFO_new() 98PKCS7_RECIP_INFO *PKCS7_RECIP_INFO_new(void)
108 { 99 {
109 PKCS7_RECIP_INFO *ret=NULL; 100 PKCS7_RECIP_INFO *ret=NULL;
101 ASN1_CTX c;
110 102
111 M_ASN1_New_Malloc(ret,PKCS7_RECIP_INFO); 103 M_ASN1_New_Malloc(ret,PKCS7_RECIP_INFO);
112 M_ASN1_New(ret->version,ASN1_INTEGER_new); 104 M_ASN1_New(ret->version,ASN1_INTEGER_new);
@@ -118,8 +110,7 @@ PKCS7_RECIP_INFO *PKCS7_RECIP_INFO_new()
118 M_ASN1_New_Error(ASN1_F_PKCS7_RECIP_INFO_NEW); 110 M_ASN1_New_Error(ASN1_F_PKCS7_RECIP_INFO_NEW);
119 } 111 }
120 112
121void PKCS7_RECIP_INFO_free(a) 113void PKCS7_RECIP_INFO_free(PKCS7_RECIP_INFO *a)
122PKCS7_RECIP_INFO *a;
123 { 114 {
124 if (a == NULL) return; 115 if (a == NULL) return;
125 ASN1_INTEGER_free(a->version); 116 ASN1_INTEGER_free(a->version);
@@ -127,6 +118,8 @@ PKCS7_RECIP_INFO *a;
127 X509_ALGOR_free(a->key_enc_algor); 118 X509_ALGOR_free(a->key_enc_algor);
128 ASN1_OCTET_STRING_free(a->enc_key); 119 ASN1_OCTET_STRING_free(a->enc_key);
129 if (a->cert != NULL) X509_free(a->cert); 120 if (a->cert != NULL) X509_free(a->cert);
130 Free((char *)a); 121 Free(a);
131 } 122 }
132 123
124IMPLEMENT_STACK_OF(PKCS7_RECIP_INFO)
125IMPLEMENT_ASN1_SET_OF(PKCS7_RECIP_INFO)
diff --git a/src/lib/libcrypto/asn1/p7_s_e.c b/src/lib/libcrypto/asn1/p7_s_e.c
index d344211456..90946695c9 100644
--- a/src/lib/libcrypto/asn1/p7_s_e.c
+++ b/src/lib/libcrypto/asn1/p7_s_e.c
@@ -58,89 +58,88 @@
58 58
59#include <stdio.h> 59#include <stdio.h>
60#include "cryptlib.h" 60#include "cryptlib.h"
61#include "asn1_mac.h" 61#include <openssl/asn1_mac.h>
62#include "x509.h" 62#include <openssl/x509.h>
63 63
64/* 64int i2d_PKCS7_SIGN_ENVELOPE(PKCS7_SIGN_ENVELOPE *a, unsigned char **pp)
65 * ASN1err(ASN1_F_PKCS7_SIGN_ENVELOPE_NEW,ASN1_R_LENGTH_MISMATCH);
66 * ASN1err(ASN1_F_D2I_PKCS7_SIGN_ENVELOPE,ASN1_R_LENGTH_MISMATCH);
67 */
68
69int i2d_PKCS7_SIGN_ENVELOPE(a,pp)
70PKCS7_SIGN_ENVELOPE *a;
71unsigned char **pp;
72 { 65 {
73 M_ASN1_I2D_vars(a); 66 M_ASN1_I2D_vars(a);
74 67
75 M_ASN1_I2D_len(a->version,i2d_ASN1_INTEGER); 68 M_ASN1_I2D_len(a->version,i2d_ASN1_INTEGER);
76 M_ASN1_I2D_len_SET(a->recipientinfo,i2d_PKCS7_RECIP_INFO); 69 M_ASN1_I2D_len_SET_type(PKCS7_RECIP_INFO,a->recipientinfo,
77 M_ASN1_I2D_len_SET(a->md_algs,i2d_X509_ALGOR); 70 i2d_PKCS7_RECIP_INFO);
71 M_ASN1_I2D_len_SET_type(X509_ALGOR,a->md_algs,i2d_X509_ALGOR);
78 M_ASN1_I2D_len(a->enc_data,i2d_PKCS7_ENC_CONTENT); 72 M_ASN1_I2D_len(a->enc_data,i2d_PKCS7_ENC_CONTENT);
79 M_ASN1_I2D_len_IMP_set_opt(a->cert,i2d_X509,0); 73 M_ASN1_I2D_len_IMP_SEQUENCE_opt_type(X509,a->cert,i2d_X509,0);
80 M_ASN1_I2D_len_IMP_set_opt(a->crl,i2d_X509_CRL,1); 74 M_ASN1_I2D_len_IMP_SET_opt_type(X509_CRL,a->crl,i2d_X509_CRL,1);
81 M_ASN1_I2D_len_SET(a->signer_info,i2d_PKCS7_SIGNER_INFO); 75 M_ASN1_I2D_len_SET_type(PKCS7_SIGNER_INFO,a->signer_info,
76 i2d_PKCS7_SIGNER_INFO);
82 77
83 M_ASN1_I2D_seq_total(); 78 M_ASN1_I2D_seq_total();
84 79
85 M_ASN1_I2D_put(a->version,i2d_ASN1_INTEGER); 80 M_ASN1_I2D_put(a->version,i2d_ASN1_INTEGER);
86 M_ASN1_I2D_put_SET(a->recipientinfo,i2d_PKCS7_RECIP_INFO); 81 M_ASN1_I2D_put_SET_type(PKCS7_RECIP_INFO,a->recipientinfo,
87 M_ASN1_I2D_put_SET(a->md_algs,i2d_X509_ALGOR); 82 i2d_PKCS7_RECIP_INFO);
83 M_ASN1_I2D_put_SET_type(X509_ALGOR,a->md_algs,i2d_X509_ALGOR);
88 M_ASN1_I2D_put(a->enc_data,i2d_PKCS7_ENC_CONTENT); 84 M_ASN1_I2D_put(a->enc_data,i2d_PKCS7_ENC_CONTENT);
89 M_ASN1_I2D_put_IMP_set_opt(a->cert,i2d_X509,0); 85 M_ASN1_I2D_put_IMP_SEQUENCE_opt_type(X509,a->cert,i2d_X509,0);
90 M_ASN1_I2D_put_IMP_set_opt(a->crl,i2d_X509_CRL,1); 86 M_ASN1_I2D_put_IMP_SET_opt_type(X509_CRL,a->crl,i2d_X509_CRL,1);
91 M_ASN1_I2D_put_SET(a->signer_info,i2d_PKCS7_SIGNER_INFO); 87 M_ASN1_I2D_put_SET_type(PKCS7_SIGNER_INFO,a->signer_info,
88 i2d_PKCS7_SIGNER_INFO);
92 89
93 M_ASN1_I2D_finish(); 90 M_ASN1_I2D_finish();
94 } 91 }
95 92
96PKCS7_SIGN_ENVELOPE *d2i_PKCS7_SIGN_ENVELOPE(a,pp,length) 93PKCS7_SIGN_ENVELOPE *d2i_PKCS7_SIGN_ENVELOPE(PKCS7_SIGN_ENVELOPE **a,
97PKCS7_SIGN_ENVELOPE **a; 94 unsigned char **pp, long length)
98unsigned char **pp;
99long length;
100 { 95 {
101 M_ASN1_D2I_vars(a,PKCS7_SIGN_ENVELOPE *,PKCS7_SIGN_ENVELOPE_new); 96 M_ASN1_D2I_vars(a,PKCS7_SIGN_ENVELOPE *,PKCS7_SIGN_ENVELOPE_new);
102 97
103 M_ASN1_D2I_Init(); 98 M_ASN1_D2I_Init();
104 M_ASN1_D2I_start_sequence(); 99 M_ASN1_D2I_start_sequence();
105 M_ASN1_D2I_get(ret->version,d2i_ASN1_INTEGER); 100 M_ASN1_D2I_get(ret->version,d2i_ASN1_INTEGER);
106 M_ASN1_D2I_get_set(ret->recipientinfo,d2i_PKCS7_RECIP_INFO); 101 M_ASN1_D2I_get_set_type(PKCS7_RECIP_INFO,ret->recipientinfo,
107 M_ASN1_D2I_get_set(ret->md_algs,d2i_X509_ALGOR); 102 d2i_PKCS7_RECIP_INFO,PKCS7_RECIP_INFO_free);
103 M_ASN1_D2I_get_set_type(X509_ALGOR,ret->md_algs,d2i_X509_ALGOR,
104 X509_ALGOR_free);
108 M_ASN1_D2I_get(ret->enc_data,d2i_PKCS7_ENC_CONTENT); 105 M_ASN1_D2I_get(ret->enc_data,d2i_PKCS7_ENC_CONTENT);
109 M_ASN1_D2I_get_IMP_set_opt(ret->cert,d2i_X509,0); 106 M_ASN1_D2I_get_IMP_set_opt_type(X509,ret->cert,d2i_X509,X509_free,0);
110 M_ASN1_D2I_get_IMP_set_opt(ret->crl,d2i_X509_CRL,1); 107 M_ASN1_D2I_get_IMP_set_opt_type(X509_CRL,ret->crl,d2i_X509_CRL,
111 M_ASN1_D2I_get_set(ret->signer_info,d2i_PKCS7_SIGNER_INFO); 108 X509_CRL_free,1);
109 M_ASN1_D2I_get_set_type(PKCS7_SIGNER_INFO,ret->signer_info,
110 d2i_PKCS7_SIGNER_INFO,PKCS7_SIGNER_INFO_free);
112 111
113 M_ASN1_D2I_Finish(a,PKCS7_SIGN_ENVELOPE_free, 112 M_ASN1_D2I_Finish(a,PKCS7_SIGN_ENVELOPE_free,
114 ASN1_F_D2I_PKCS7_SIGN_ENVELOPE); 113 ASN1_F_D2I_PKCS7_SIGN_ENVELOPE);
115 } 114 }
116 115
117PKCS7_SIGN_ENVELOPE *PKCS7_SIGN_ENVELOPE_new() 116PKCS7_SIGN_ENVELOPE *PKCS7_SIGN_ENVELOPE_new(void)
118 { 117 {
119 PKCS7_SIGN_ENVELOPE *ret=NULL; 118 PKCS7_SIGN_ENVELOPE *ret=NULL;
119 ASN1_CTX c;
120 120
121 M_ASN1_New_Malloc(ret,PKCS7_SIGN_ENVELOPE); 121 M_ASN1_New_Malloc(ret,PKCS7_SIGN_ENVELOPE);
122 M_ASN1_New(ret->version,ASN1_INTEGER_new); 122 M_ASN1_New(ret->version,ASN1_INTEGER_new);
123 M_ASN1_New(ret->recipientinfo,sk_new_null); 123 M_ASN1_New(ret->recipientinfo,sk_PKCS7_RECIP_INFO_new_null);
124 M_ASN1_New(ret->md_algs,sk_new_null); 124 M_ASN1_New(ret->md_algs,sk_X509_ALGOR_new_null);
125 M_ASN1_New(ret->enc_data,PKCS7_ENC_CONTENT_new); 125 M_ASN1_New(ret->enc_data,PKCS7_ENC_CONTENT_new);
126 ret->cert=NULL; 126 ret->cert=NULL;
127 ret->crl=NULL; 127 ret->crl=NULL;
128 M_ASN1_New(ret->signer_info,sk_new_null); 128 M_ASN1_New(ret->signer_info,sk_PKCS7_SIGNER_INFO_new_null);
129 return(ret); 129 return(ret);
130 M_ASN1_New_Error(ASN1_F_PKCS7_SIGN_ENVELOPE_NEW); 130 M_ASN1_New_Error(ASN1_F_PKCS7_SIGN_ENVELOPE_NEW);
131 } 131 }
132 132
133void PKCS7_SIGN_ENVELOPE_free(a) 133void PKCS7_SIGN_ENVELOPE_free(PKCS7_SIGN_ENVELOPE *a)
134PKCS7_SIGN_ENVELOPE *a;
135 { 134 {
136 if (a == NULL) return; 135 if (a == NULL) return;
137 ASN1_INTEGER_free(a->version); 136 ASN1_INTEGER_free(a->version);
138 sk_pop_free(a->recipientinfo,PKCS7_RECIP_INFO_free); 137 sk_PKCS7_RECIP_INFO_pop_free(a->recipientinfo,PKCS7_RECIP_INFO_free);
139 sk_pop_free(a->md_algs,X509_ALGOR_free); 138 sk_X509_ALGOR_pop_free(a->md_algs,X509_ALGOR_free);
140 PKCS7_ENC_CONTENT_free(a->enc_data); 139 PKCS7_ENC_CONTENT_free(a->enc_data);
141 sk_pop_free(a->cert,X509_free); 140 sk_X509_pop_free(a->cert,X509_free);
142 sk_pop_free(a->crl,X509_CRL_free); 141 sk_X509_CRL_pop_free(a->crl,X509_CRL_free);
143 sk_pop_free(a->signer_info,PKCS7_SIGNER_INFO_free); 142 sk_PKCS7_SIGNER_INFO_pop_free(a->signer_info,PKCS7_SIGNER_INFO_free);
144 Free((char *)a); 143 Free(a);
145 } 144 }
146 145
diff --git a/src/lib/libcrypto/asn1/p7_signd.c b/src/lib/libcrypto/asn1/p7_signd.c
index 40f9a44fa8..74f0f522e1 100644
--- a/src/lib/libcrypto/asn1/p7_signd.c
+++ b/src/lib/libcrypto/asn1/p7_signd.c
@@ -58,83 +58,78 @@
58 58
59#include <stdio.h> 59#include <stdio.h>
60#include "cryptlib.h" 60#include "cryptlib.h"
61#include "asn1_mac.h" 61#include <openssl/asn1_mac.h>
62#include "x509.h" 62#include <openssl/x509.h>
63 63
64/* 64int i2d_PKCS7_SIGNED(PKCS7_SIGNED *a, unsigned char **pp)
65 * ASN1err(ASN1_F_PKCS7_SIGNED_NEW,ASN1_R_LENGTH_MISMATCH);
66 * ASN1err(ASN1_F_D2I_PKCS7_SIGNED,ASN1_R_LENGTH_MISMATCH);
67 */
68
69int i2d_PKCS7_SIGNED(a,pp)
70PKCS7_SIGNED *a;
71unsigned char **pp;
72 { 65 {
73 M_ASN1_I2D_vars(a); 66 M_ASN1_I2D_vars(a);
74 67
75 M_ASN1_I2D_len(a->version,i2d_ASN1_INTEGER); 68 M_ASN1_I2D_len(a->version,i2d_ASN1_INTEGER);
76 M_ASN1_I2D_len_SET(a->md_algs,i2d_X509_ALGOR); 69 M_ASN1_I2D_len_SET_type(X509_ALGOR,a->md_algs,i2d_X509_ALGOR);
77 M_ASN1_I2D_len(a->contents,i2d_PKCS7); 70 M_ASN1_I2D_len(a->contents,i2d_PKCS7);
78 M_ASN1_I2D_len_IMP_set_opt(a->cert,i2d_X509,0); 71 M_ASN1_I2D_len_IMP_SEQUENCE_opt_type(X509,a->cert,i2d_X509,0);
79 M_ASN1_I2D_len_IMP_set_opt(a->crl,i2d_X509_CRL,1); 72 M_ASN1_I2D_len_IMP_SET_opt_type(X509_CRL,a->crl,i2d_X509_CRL,1);
80 M_ASN1_I2D_len_SET(a->signer_info,i2d_PKCS7_SIGNER_INFO); 73 M_ASN1_I2D_len_SET_type(PKCS7_SIGNER_INFO,a->signer_info,
74 i2d_PKCS7_SIGNER_INFO);
81 75
82 M_ASN1_I2D_seq_total(); 76 M_ASN1_I2D_seq_total();
83 77
84 M_ASN1_I2D_put(a->version,i2d_ASN1_INTEGER); 78 M_ASN1_I2D_put(a->version,i2d_ASN1_INTEGER);
85 M_ASN1_I2D_put_SET(a->md_algs,i2d_X509_ALGOR); 79 M_ASN1_I2D_put_SET_type(X509_ALGOR,a->md_algs,i2d_X509_ALGOR);
86 M_ASN1_I2D_put(a->contents,i2d_PKCS7); 80 M_ASN1_I2D_put(a->contents,i2d_PKCS7);
87 M_ASN1_I2D_put_IMP_set_opt(a->cert,i2d_X509,0); 81 M_ASN1_I2D_put_IMP_SEQUENCE_opt_type(X509,a->cert,i2d_X509,0);
88 M_ASN1_I2D_put_IMP_set_opt(a->crl,i2d_X509_CRL,1); 82 M_ASN1_I2D_put_IMP_SET_opt_type(X509_CRL,a->crl,i2d_X509_CRL,1);
89 M_ASN1_I2D_put_SET(a->signer_info,i2d_PKCS7_SIGNER_INFO); 83 M_ASN1_I2D_put_SET_type(PKCS7_SIGNER_INFO,a->signer_info,
84 i2d_PKCS7_SIGNER_INFO);
90 85
91 M_ASN1_I2D_finish(); 86 M_ASN1_I2D_finish();
92 } 87 }
93 88
94PKCS7_SIGNED *d2i_PKCS7_SIGNED(a,pp,length) 89PKCS7_SIGNED *d2i_PKCS7_SIGNED(PKCS7_SIGNED **a, unsigned char **pp,
95PKCS7_SIGNED **a; 90 long length)
96unsigned char **pp;
97long length;
98 { 91 {
99 M_ASN1_D2I_vars(a,PKCS7_SIGNED *,PKCS7_SIGNED_new); 92 M_ASN1_D2I_vars(a,PKCS7_SIGNED *,PKCS7_SIGNED_new);
100 93
101 M_ASN1_D2I_Init(); 94 M_ASN1_D2I_Init();
102 M_ASN1_D2I_start_sequence(); 95 M_ASN1_D2I_start_sequence();
103 M_ASN1_D2I_get(ret->version,d2i_ASN1_INTEGER); 96 M_ASN1_D2I_get(ret->version,d2i_ASN1_INTEGER);
104 M_ASN1_D2I_get_set(ret->md_algs,d2i_X509_ALGOR); 97 M_ASN1_D2I_get_set_type(X509_ALGOR,ret->md_algs,d2i_X509_ALGOR,
98 X509_ALGOR_free);
105 M_ASN1_D2I_get(ret->contents,d2i_PKCS7); 99 M_ASN1_D2I_get(ret->contents,d2i_PKCS7);
106 M_ASN1_D2I_get_IMP_set_opt(ret->cert,d2i_X509,0); 100 M_ASN1_D2I_get_IMP_set_opt_type(X509,ret->cert,d2i_X509,X509_free,0);
107 M_ASN1_D2I_get_IMP_set_opt(ret->crl,d2i_X509_CRL,1); 101 M_ASN1_D2I_get_IMP_set_opt_type(X509_CRL,ret->crl,d2i_X509_CRL,
108 M_ASN1_D2I_get_set(ret->signer_info,d2i_PKCS7_SIGNER_INFO); 102 X509_CRL_free,1);
103 M_ASN1_D2I_get_set_type(PKCS7_SIGNER_INFO,ret->signer_info,
104 d2i_PKCS7_SIGNER_INFO,PKCS7_SIGNER_INFO_free);
109 105
110 M_ASN1_D2I_Finish(a,PKCS7_SIGNED_free,ASN1_F_D2I_PKCS7_SIGNED); 106 M_ASN1_D2I_Finish(a,PKCS7_SIGNED_free,ASN1_F_D2I_PKCS7_SIGNED);
111 } 107 }
112 108
113PKCS7_SIGNED *PKCS7_SIGNED_new() 109PKCS7_SIGNED *PKCS7_SIGNED_new(void)
114 { 110 {
115 PKCS7_SIGNED *ret=NULL; 111 PKCS7_SIGNED *ret=NULL;
112 ASN1_CTX c;
116 113
117 M_ASN1_New_Malloc(ret,PKCS7_SIGNED); 114 M_ASN1_New_Malloc(ret,PKCS7_SIGNED);
118 M_ASN1_New(ret->version,ASN1_INTEGER_new); 115 M_ASN1_New(ret->version,ASN1_INTEGER_new);
119 M_ASN1_New(ret->md_algs,sk_new_null); 116 M_ASN1_New(ret->md_algs,sk_X509_ALGOR_new_null);
120 M_ASN1_New(ret->contents,PKCS7_new); 117 M_ASN1_New(ret->contents,PKCS7_new);
121 ret->cert=NULL; 118 ret->cert=NULL;
122 ret->crl=NULL; 119 ret->crl=NULL;
123 M_ASN1_New(ret->signer_info,sk_new_null); 120 M_ASN1_New(ret->signer_info,sk_PKCS7_SIGNER_INFO_new_null);
124 return(ret); 121 return(ret);
125 M_ASN1_New_Error(ASN1_F_PKCS7_SIGNED_NEW); 122 M_ASN1_New_Error(ASN1_F_PKCS7_SIGNED_NEW);
126 } 123 }
127 124
128void PKCS7_SIGNED_free(a) 125void PKCS7_SIGNED_free(PKCS7_SIGNED *a)
129PKCS7_SIGNED *a;
130 { 126 {
131 if (a == NULL) return; 127 if (a == NULL) return;
132 ASN1_INTEGER_free(a->version); 128 ASN1_INTEGER_free(a->version);
133 sk_pop_free(a->md_algs,X509_ALGOR_free); 129 sk_X509_ALGOR_pop_free(a->md_algs,X509_ALGOR_free);
134 PKCS7_free(a->contents); 130 PKCS7_free(a->contents);
135 sk_pop_free(a->cert,X509_free); 131 sk_X509_pop_free(a->cert,X509_free);
136 sk_pop_free(a->crl,X509_CRL_free); 132 sk_X509_CRL_pop_free(a->crl,X509_CRL_free);
137 sk_pop_free(a->signer_info,PKCS7_SIGNER_INFO_free); 133 sk_PKCS7_SIGNER_INFO_pop_free(a->signer_info,PKCS7_SIGNER_INFO_free);
138 Free((char *)a); 134 Free(a);
139 } 135 }
140
diff --git a/src/lib/libcrypto/asn1/p7_signi.c b/src/lib/libcrypto/asn1/p7_signi.c
index 0da92169fc..21132ef4dd 100644
--- a/src/lib/libcrypto/asn1/p7_signi.c
+++ b/src/lib/libcrypto/asn1/p7_signi.c
@@ -58,45 +58,40 @@
58 58
59#include <stdio.h> 59#include <stdio.h>
60#include "cryptlib.h" 60#include "cryptlib.h"
61#include "asn1_mac.h" 61#include <openssl/asn1_mac.h>
62#include "x509.h" 62#include <openssl/x509.h>
63 63
64/* 64int i2d_PKCS7_SIGNER_INFO(PKCS7_SIGNER_INFO *a, unsigned char **pp)
65 * ASN1err(ASN1_F_PKCS7_SIGNER_INFO_NEW,ASN1_R_LENGTH_MISMATCH);
66 * ASN1err(ASN1_F_D2I_PKCS7_SIGNER_INFO,ASN1_R_LENGTH_MISMATCH);
67 */
68
69int i2d_PKCS7_SIGNER_INFO(a,pp)
70PKCS7_SIGNER_INFO *a;
71unsigned char **pp;
72 { 65 {
73 M_ASN1_I2D_vars(a); 66 M_ASN1_I2D_vars(a);
74 67
75 M_ASN1_I2D_len(a->version,i2d_ASN1_INTEGER); 68 M_ASN1_I2D_len(a->version,i2d_ASN1_INTEGER);
76 M_ASN1_I2D_len(a->issuer_and_serial,i2d_PKCS7_ISSUER_AND_SERIAL); 69 M_ASN1_I2D_len(a->issuer_and_serial,i2d_PKCS7_ISSUER_AND_SERIAL);
77 M_ASN1_I2D_len(a->digest_alg,i2d_X509_ALGOR); 70 M_ASN1_I2D_len(a->digest_alg,i2d_X509_ALGOR);
78 M_ASN1_I2D_len_IMP_set_opt(a->auth_attr,i2d_X509_ATTRIBUTE,0); 71 M_ASN1_I2D_len_IMP_SET_opt_type(X509_ATTRIBUTE,a->auth_attr,
72 i2d_X509_ATTRIBUTE,0);
79 M_ASN1_I2D_len(a->digest_enc_alg,i2d_X509_ALGOR); 73 M_ASN1_I2D_len(a->digest_enc_alg,i2d_X509_ALGOR);
80 M_ASN1_I2D_len(a->enc_digest,i2d_ASN1_OCTET_STRING); 74 M_ASN1_I2D_len(a->enc_digest,i2d_ASN1_OCTET_STRING);
81 M_ASN1_I2D_len_IMP_set_opt(a->unauth_attr,i2d_X509_ATTRIBUTE,1); 75 M_ASN1_I2D_len_IMP_SET_opt_type(X509_ATTRIBUTE,a->unauth_attr,
76 i2d_X509_ATTRIBUTE,1);
82 77
83 M_ASN1_I2D_seq_total(); 78 M_ASN1_I2D_seq_total();
84 79
85 M_ASN1_I2D_put(a->version,i2d_ASN1_INTEGER); 80 M_ASN1_I2D_put(a->version,i2d_ASN1_INTEGER);
86 M_ASN1_I2D_put(a->issuer_and_serial,i2d_PKCS7_ISSUER_AND_SERIAL); 81 M_ASN1_I2D_put(a->issuer_and_serial,i2d_PKCS7_ISSUER_AND_SERIAL);
87 M_ASN1_I2D_put(a->digest_alg,i2d_X509_ALGOR); 82 M_ASN1_I2D_put(a->digest_alg,i2d_X509_ALGOR);
88 M_ASN1_I2D_put_IMP_set_opt(a->auth_attr,i2d_X509_ATTRIBUTE,0); 83 M_ASN1_I2D_put_IMP_SET_opt_type(X509_ATTRIBUTE,a->auth_attr,
84 i2d_X509_ATTRIBUTE,0);
89 M_ASN1_I2D_put(a->digest_enc_alg,i2d_X509_ALGOR); 85 M_ASN1_I2D_put(a->digest_enc_alg,i2d_X509_ALGOR);
90 M_ASN1_I2D_put(a->enc_digest,i2d_ASN1_OCTET_STRING); 86 M_ASN1_I2D_put(a->enc_digest,i2d_ASN1_OCTET_STRING);
91 M_ASN1_I2D_put_IMP_set_opt(a->unauth_attr,i2d_X509_ATTRIBUTE,1); 87 M_ASN1_I2D_put_IMP_SET_opt_type(X509_ATTRIBUTE,a->unauth_attr,
88 i2d_X509_ATTRIBUTE,1);
92 89
93 M_ASN1_I2D_finish(); 90 M_ASN1_I2D_finish();
94 } 91 }
95 92
96PKCS7_SIGNER_INFO *d2i_PKCS7_SIGNER_INFO(a,pp,length) 93PKCS7_SIGNER_INFO *d2i_PKCS7_SIGNER_INFO(PKCS7_SIGNER_INFO **a,
97PKCS7_SIGNER_INFO **a; 94 unsigned char **pp, long length)
98unsigned char **pp;
99long length;
100 { 95 {
101 M_ASN1_D2I_vars(a,PKCS7_SIGNER_INFO *,PKCS7_SIGNER_INFO_new); 96 M_ASN1_D2I_vars(a,PKCS7_SIGNER_INFO *,PKCS7_SIGNER_INFO_new);
102 97
@@ -105,18 +100,23 @@ long length;
105 M_ASN1_D2I_get(ret->version,d2i_ASN1_INTEGER); 100 M_ASN1_D2I_get(ret->version,d2i_ASN1_INTEGER);
106 M_ASN1_D2I_get(ret->issuer_and_serial,d2i_PKCS7_ISSUER_AND_SERIAL); 101 M_ASN1_D2I_get(ret->issuer_and_serial,d2i_PKCS7_ISSUER_AND_SERIAL);
107 M_ASN1_D2I_get(ret->digest_alg,d2i_X509_ALGOR); 102 M_ASN1_D2I_get(ret->digest_alg,d2i_X509_ALGOR);
108 M_ASN1_D2I_get_IMP_set_opt(ret->auth_attr,d2i_X509_ATTRIBUTE,0); 103 M_ASN1_D2I_get_IMP_set_opt_type(X509_ATTRIBUTE,ret->auth_attr,
104 d2i_X509_ATTRIBUTE,X509_ATTRIBUTE_free,
105 0);
109 M_ASN1_D2I_get(ret->digest_enc_alg,d2i_X509_ALGOR); 106 M_ASN1_D2I_get(ret->digest_enc_alg,d2i_X509_ALGOR);
110 M_ASN1_D2I_get(ret->enc_digest,d2i_ASN1_OCTET_STRING); 107 M_ASN1_D2I_get(ret->enc_digest,d2i_ASN1_OCTET_STRING);
111 M_ASN1_D2I_get_IMP_set_opt(ret->unauth_attr,d2i_X509_ATTRIBUTE,1); 108 M_ASN1_D2I_get_IMP_set_opt_type(X509_ATTRIBUTE,ret->unauth_attr,
109 d2i_X509_ATTRIBUTE,
110 X509_ATTRIBUTE_free,1);
112 111
113 M_ASN1_D2I_Finish(a,PKCS7_SIGNER_INFO_free, 112 M_ASN1_D2I_Finish(a,PKCS7_SIGNER_INFO_free,
114 ASN1_F_D2I_PKCS7_SIGNER_INFO); 113 ASN1_F_D2I_PKCS7_SIGNER_INFO);
115 } 114 }
116 115
117PKCS7_SIGNER_INFO *PKCS7_SIGNER_INFO_new() 116PKCS7_SIGNER_INFO *PKCS7_SIGNER_INFO_new(void)
118 { 117 {
119 PKCS7_SIGNER_INFO *ret=NULL; 118 PKCS7_SIGNER_INFO *ret=NULL;
119 ASN1_CTX c;
120 120
121 M_ASN1_New_Malloc(ret,PKCS7_SIGNER_INFO); 121 M_ASN1_New_Malloc(ret,PKCS7_SIGNER_INFO);
122 M_ASN1_New(ret->version,ASN1_INTEGER_new); 122 M_ASN1_New(ret->version,ASN1_INTEGER_new);
@@ -131,19 +131,20 @@ PKCS7_SIGNER_INFO *PKCS7_SIGNER_INFO_new()
131 M_ASN1_New_Error(ASN1_F_PKCS7_SIGNER_INFO_NEW); 131 M_ASN1_New_Error(ASN1_F_PKCS7_SIGNER_INFO_NEW);
132 } 132 }
133 133
134void PKCS7_SIGNER_INFO_free(a) 134void PKCS7_SIGNER_INFO_free(PKCS7_SIGNER_INFO *a)
135PKCS7_SIGNER_INFO *a;
136 { 135 {
137 if (a == NULL) return; 136 if (a == NULL) return;
138 ASN1_INTEGER_free(a->version); 137 ASN1_INTEGER_free(a->version);
139 PKCS7_ISSUER_AND_SERIAL_free(a->issuer_and_serial); 138 PKCS7_ISSUER_AND_SERIAL_free(a->issuer_and_serial);
140 X509_ALGOR_free(a->digest_alg); 139 X509_ALGOR_free(a->digest_alg);
141 sk_pop_free(a->auth_attr,X509_ATTRIBUTE_free); 140 sk_X509_ATTRIBUTE_pop_free(a->auth_attr,X509_ATTRIBUTE_free);
142 X509_ALGOR_free(a->digest_enc_alg); 141 X509_ALGOR_free(a->digest_enc_alg);
143 ASN1_OCTET_STRING_free(a->enc_digest); 142 ASN1_OCTET_STRING_free(a->enc_digest);
144 sk_pop_free(a->unauth_attr,X509_ATTRIBUTE_free); 143 sk_X509_ATTRIBUTE_pop_free(a->unauth_attr,X509_ATTRIBUTE_free);
145 if (a->pkey != NULL) 144 if (a->pkey != NULL)
146 EVP_PKEY_free(a->pkey); 145 EVP_PKEY_free(a->pkey);
147 Free((char *)a); 146 Free((char *)a);
148 } 147 }
149 148
149IMPLEMENT_STACK_OF(PKCS7_SIGNER_INFO)
150IMPLEMENT_ASN1_SET_OF(PKCS7_SIGNER_INFO)
diff --git a/src/lib/libcrypto/asn1/p8_pkey.c b/src/lib/libcrypto/asn1/p8_pkey.c
new file mode 100644
index 0000000000..aa9a4f6c96
--- /dev/null
+++ b/src/lib/libcrypto/asn1/p8_pkey.c
@@ -0,0 +1,129 @@
1/* p8_pkey.c */
2/* Written by Dr Stephen N Henson (shenson@bigfoot.com) for the OpenSSL
3 * project 1999.
4 */
5/* ====================================================================
6 * Copyright (c) 1999 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/asn1_mac.h>
62#include <openssl/x509.h>
63
64int i2d_PKCS8_PRIV_KEY_INFO (PKCS8_PRIV_KEY_INFO *a, unsigned char **pp)
65{
66
67 M_ASN1_I2D_vars(a);
68
69 M_ASN1_I2D_len (a->version, i2d_ASN1_INTEGER);
70 M_ASN1_I2D_len (a->pkeyalg, i2d_X509_ALGOR);
71 M_ASN1_I2D_len (a->pkey, i2d_ASN1_TYPE);
72 M_ASN1_I2D_len_IMP_SET_opt_type (X509_ATTRIBUTE, a->attributes,
73 i2d_X509_ATTRIBUTE, 0);
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}
85
86PKCS8_PRIV_KEY_INFO *PKCS8_PRIV_KEY_INFO_new(void)
87{
88 PKCS8_PRIV_KEY_INFO *ret=NULL;
89 ASN1_CTX c;
90 M_ASN1_New_Malloc(ret, PKCS8_PRIV_KEY_INFO);
91 M_ASN1_New (ret->version, ASN1_INTEGER_new);
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
100PKCS8_PRIV_KEY_INFO *d2i_PKCS8_PRIV_KEY_INFO(PKCS8_PRIV_KEY_INFO **a,
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 if (ASN1_TYPE_get(ret->pkey) == V_ASN1_SEQUENCE)
113 ret->broken = PKCS8_NO_OCTET;
114 M_ASN1_D2I_Finish(a, PKCS8_PRIV_KEY_INFO_free, ASN1_F_D2I_PKCS8_PRIV_KEY_INFO);
115}
116
117void PKCS8_PRIV_KEY_INFO_free (PKCS8_PRIV_KEY_INFO *a)
118{
119 if (a == NULL) return;
120 ASN1_INTEGER_free (a->version);
121 X509_ALGOR_free(a->pkeyalg);
122 /* Clear sensitive data */
123 if (a->pkey->value.octet_string)
124 memset (a->pkey->value.octet_string->data,
125 0, a->pkey->value.octet_string->length);
126 ASN1_TYPE_free (a->pkey);
127 sk_X509_ATTRIBUTE_pop_free (a->attributes, X509_ATTRIBUTE_free);
128 Free (a);
129}
diff --git a/src/lib/libcrypto/asn1/pkcs8.c b/src/lib/libcrypto/asn1/pkcs8.c
index 03fdadd51a..29c4ea6a29 100644
--- a/src/lib/libcrypto/asn1/pkcs8.c
+++ b/src/lib/libcrypto/asn1/pkcs8.c
@@ -58,17 +58,10 @@
58 58
59#include <stdio.h> 59#include <stdio.h>
60#include "cryptlib.h" 60#include "cryptlib.h"
61#include "asn1_mac.h" 61#include <openssl/asn1_mac.h>
62#include "objects.h" 62#include <openssl/objects.h>
63 63
64/* 64int i2d_X509_KEY(X509 *a, unsigned char **pp)
65 * ASN1err(ASN1_F_D2I_X509_KEY,ASN1_R_LENGTH_MISMATCH);
66 * ASN1err(ASN1_F_X509_KEY_NEW,ASN1_R_BAD_GET_OBJECT);
67 */
68
69int i2d_X509_KEY(a,pp)
70X509 *a;
71unsigned char **pp;
72 { 65 {
73 M_ASN1_I2D_vars(a); 66 M_ASN1_I2D_vars(a);
74 67
@@ -85,10 +78,7 @@ unsigned char **pp;
85 M_ASN1_I2D_finish(); 78 M_ASN1_I2D_finish();
86 } 79 }
87 80
88X509 *d2i_X509_KEY(a,pp,length) 81X509 *d2i_X509_KEY(X509 **a, unsigned char **pp, long length)
89X509 **a;
90unsigned char **pp;
91long length;
92 { 82 {
93 M_ASN1_D2I_vars(a,X509 *,X509_new); 83 M_ASN1_D2I_vars(a,X509 *,X509_new);
94 84
@@ -100,7 +90,7 @@ long length;
100 M_ASN1_D2I_Finish(a,X509_free,ASN1_F_D2I_X509); 90 M_ASN1_D2I_Finish(a,X509_free,ASN1_F_D2I_X509);
101 } 91 }
102 92
103X509 *X509_KEY_new() 93X509 *X509_KEY_new(void)
104 { 94 {
105 X509_KEY *ret=NULL; 95 X509_KEY *ret=NULL;
106 96
@@ -114,8 +104,7 @@ X509 *X509_KEY_new()
114 M_ASN1_New_Error(ASN1_F_X509_NEW); 104 M_ASN1_New_Error(ASN1_F_X509_NEW);
115 } 105 }
116 106
117void X509_KEY_free(a) 107void X509_KEY_free(X509 *a)
118X509 *a;
119 { 108 {
120 int i; 109 int i;
121 110
diff --git a/src/lib/libcrypto/asn1/t_crl.c b/src/lib/libcrypto/asn1/t_crl.c
new file mode 100644
index 0000000000..c2e447ce6f
--- /dev/null
+++ b/src/lib/libcrypto/asn1/t_crl.c
@@ -0,0 +1,166 @@
1/* t_crl.c */
2/* Written by Dr Stephen N Henson (shenson@bigfoot.com) for the OpenSSL
3 * project 1999.
4 */
5/* ====================================================================
6 * Copyright (c) 1999 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/buffer.h>
62#include <openssl/bn.h>
63#include <openssl/objects.h>
64#include <openssl/x509.h>
65#include <openssl/x509v3.h>
66
67static void ext_print(BIO *out, X509_EXTENSION *ex);
68#ifndef NO_FP_API
69int X509_CRL_print_fp(FILE *fp, X509_CRL *x)
70 {
71 BIO *b;
72 int ret;
73
74 if ((b=BIO_new(BIO_s_file())) == NULL)
75 {
76 X509err(X509_F_X509_PRINT_FP,ERR_R_BUF_LIB);
77 return(0);
78 }
79 BIO_set_fp(b,fp,BIO_NOCLOSE);
80 ret=X509_CRL_print(b, x);
81 BIO_free(b);
82 return(ret);
83 }
84#endif
85
86int X509_CRL_print(BIO *out, X509_CRL *x)
87{
88 char buf[256];
89 unsigned char *s;
90 STACK_OF(X509_REVOKED) *rev;
91 X509_REVOKED *r;
92 long l;
93 int i, j, n;
94
95 BIO_printf(out, "Certificate Revocation List (CRL):\n");
96 l = X509_CRL_get_version(x);
97 BIO_printf(out, "%8sVersion %lu (0x%lx)\n", "", l+1, l);
98 i = OBJ_obj2nid(x->sig_alg->algorithm);
99 BIO_printf(out, "%8sSignature Algorithm: %s\n", "",
100 (i == NID_undef) ? "NONE" : OBJ_nid2ln(i));
101 X509_NAME_oneline(X509_CRL_get_issuer(x),buf,256);
102 BIO_printf(out,"%8sIssuer: %s\n","",buf);
103 BIO_printf(out,"%8sLast Update: ","");
104 ASN1_TIME_print(out,X509_CRL_get_lastUpdate(x));
105 BIO_printf(out,"\n%8sNext Update: ","");
106 if (X509_CRL_get_nextUpdate(x))
107 ASN1_TIME_print(out,X509_CRL_get_nextUpdate(x));
108 else BIO_printf(out,"NONE");
109 BIO_printf(out,"\n");
110
111 n=X509_CRL_get_ext_count(x);
112 if (n > 0) {
113 BIO_printf(out,"%8sCRL extensions:\n","");
114 for (i=0; i<n; i++) ext_print(out, X509_CRL_get_ext(x, i));
115 }
116
117
118 rev = X509_CRL_get_REVOKED(x);
119
120 if(sk_X509_REVOKED_num(rev))
121 BIO_printf(out, "Revoked Certificates:\n");
122 else BIO_printf(out, "No Revoked Certificates.\n");
123
124 for(i = 0; i < sk_X509_REVOKED_num(rev); i++) {
125 r = sk_X509_REVOKED_value(rev, i);
126 BIO_printf(out," Serial Number: ");
127 i2a_ASN1_INTEGER(out,r->serialNumber);
128 BIO_printf(out,"\n Revocation Date: ","");
129 ASN1_TIME_print(out,r->revocationDate);
130 BIO_printf(out,"\n");
131 for(j = 0; j < X509_REVOKED_get_ext_count(r); j++)
132 ext_print(out, X509_REVOKED_get_ext(r, j));
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 }
146 BIO_write(out,"\n",1);
147
148 return 1;
149
150}
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 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 bc518d59a2..0dc6e30c3d 100644
--- a/src/lib/libcrypto/asn1/t_pkey.c
+++ b/src/lib/libcrypto/asn1/t_pkey.c
@@ -58,35 +58,23 @@
58 58
59#include <stdio.h> 59#include <stdio.h>
60#include "cryptlib.h" 60#include "cryptlib.h"
61#include "buffer.h" 61#include <openssl/buffer.h>
62#include "bn.h" 62#include <openssl/bn.h>
63#ifndef NO_RSA 63#ifndef NO_RSA
64#include "rsa.h" 64#include <openssl/rsa.h>
65#endif 65#endif
66#ifndef NO_DH 66#ifndef NO_DH
67#include "dh.h" 67#include <openssl/dh.h>
68#endif 68#endif
69#ifndef NO_DSA 69#ifndef NO_DSA
70#include "dsa.h" 70#include <openssl/dsa.h>
71#endif 71#endif
72 72
73/* DHerr(DH_F_DHPARAMS_PRINT,ERR_R_MALLOC_FAILURE); 73static int print(BIO *fp,const char *str,BIGNUM *num,
74 * DSAerr(DSA_F_DSAPARAMS_PRINT,ERR_R_MALLOC_FAILURE);
75 */
76
77#ifndef NOPROTO
78static int print(BIO *fp,char *str,BIGNUM *num,
79 unsigned char *buf,int off); 74 unsigned char *buf,int off);
80#else
81static int print();
82#endif
83
84#ifndef NO_RSA 75#ifndef NO_RSA
85#ifndef NO_FP_API 76#ifndef NO_FP_API
86int RSA_print_fp(fp,x,off) 77int RSA_print_fp(FILE *fp, RSA *x, int off)
87FILE *fp;
88RSA *x;
89int off;
90 { 78 {
91 BIO *b; 79 BIO *b;
92 int ret; 80 int ret;
@@ -103,12 +91,10 @@ int off;
103 } 91 }
104#endif 92#endif
105 93
106int RSA_print(bp,x,off) 94int RSA_print(BIO *bp, RSA *x, int off)
107BIO *bp;
108RSA *x;
109int off;
110 { 95 {
111 char str[128],*s; 96 char str[128];
97 const char *s;
112 unsigned char *m=NULL; 98 unsigned char *m=NULL;
113 int i,ret=0; 99 int i,ret=0;
114 100
@@ -154,10 +140,7 @@ err:
154 140
155#ifndef NO_DSA 141#ifndef NO_DSA
156#ifndef NO_FP_API 142#ifndef NO_FP_API
157int DSA_print_fp(fp,x,off) 143int DSA_print_fp(FILE *fp, DSA *x, int off)
158FILE *fp;
159DSA *x;
160int off;
161 { 144 {
162 BIO *b; 145 BIO *b;
163 int ret; 146 int ret;
@@ -174,10 +157,7 @@ int off;
174 } 157 }
175#endif 158#endif
176 159
177int DSA_print(bp,x,off) 160int DSA_print(BIO *bp, DSA *x, int off)
178BIO *bp;
179DSA *x;
180int off;
181 { 161 {
182 char str[128]; 162 char str[128];
183 unsigned char *m=NULL; 163 unsigned char *m=NULL;
@@ -229,15 +209,12 @@ err:
229 } 209 }
230#endif /* !NO_DSA */ 210#endif /* !NO_DSA */
231 211
232static int print(bp,number,num,buf,off) 212static int print(BIO *bp, const char *number, BIGNUM *num, unsigned char *buf,
233BIO *bp; 213 int off)
234char *number;
235BIGNUM *num;
236unsigned char *buf;
237int off;
238 { 214 {
239 int n,i; 215 int n,i;
240 char str[128],*neg; 216 char str[128];
217 const char *neg;
241 218
242 if (num == NULL) return(1); 219 if (num == NULL) return(1);
243 neg=(num->neg)?"-":""; 220 neg=(num->neg)?"-":"";
@@ -284,9 +261,7 @@ int off;
284 261
285#ifndef NO_DH 262#ifndef NO_DH
286#ifndef NO_FP_API 263#ifndef NO_FP_API
287int DHparams_print_fp(fp,x) 264int DHparams_print_fp(FILE *fp, DH *x)
288FILE *fp;
289DH *x;
290 { 265 {
291 BIO *b; 266 BIO *b;
292 int ret; 267 int ret;
@@ -303,9 +278,7 @@ DH *x;
303 } 278 }
304#endif 279#endif
305 280
306int DHparams_print(bp,x) 281int DHparams_print(BIO *bp, DH *x)
307BIO *bp;
308DH *x;
309 { 282 {
310 unsigned char *m=NULL; 283 unsigned char *m=NULL;
311 int reason=ERR_R_BUF_LIB,i,ret=0; 284 int reason=ERR_R_BUF_LIB,i,ret=0;
@@ -341,9 +314,7 @@ err:
341 314
342#ifndef NO_DSA 315#ifndef NO_DSA
343#ifndef NO_FP_API 316#ifndef NO_FP_API
344int DSAparams_print_fp(fp,x) 317int DSAparams_print_fp(FILE *fp, DSA *x)
345FILE *fp;
346DSA *x;
347 { 318 {
348 BIO *b; 319 BIO *b;
349 int ret; 320 int ret;
@@ -360,9 +331,7 @@ DSA *x;
360 } 331 }
361#endif 332#endif
362 333
363int DSAparams_print(bp,x) 334int DSAparams_print(BIO *bp, DSA *x)
364BIO *bp;
365DSA *x;
366 { 335 {
367 unsigned char *m=NULL; 336 unsigned char *m=NULL;
368 int reason=ERR_R_BUF_LIB,i,ret=0; 337 int reason=ERR_R_BUF_LIB,i,ret=0;
diff --git a/src/lib/libcrypto/asn1/t_req.c b/src/lib/libcrypto/asn1/t_req.c
index 7df749a48f..bdd749436a 100644
--- a/src/lib/libcrypto/asn1/t_req.c
+++ b/src/lib/libcrypto/asn1/t_req.c
@@ -58,15 +58,13 @@
58 58
59#include <stdio.h> 59#include <stdio.h>
60#include "cryptlib.h" 60#include "cryptlib.h"
61#include "buffer.h" 61#include <openssl/buffer.h>
62#include "bn.h" 62#include <openssl/bn.h>
63#include "objects.h" 63#include <openssl/objects.h>
64#include "x509.h" 64#include <openssl/x509.h>
65 65
66#ifndef NO_FP_API 66#ifndef NO_FP_API
67int X509_REQ_print_fp(fp,x) 67int X509_REQ_print_fp(FILE *fp, X509_REQ *x)
68FILE *fp;
69X509_REQ *x;
70 { 68 {
71 BIO *b; 69 BIO *b;
72 int ret; 70 int ret;
@@ -83,16 +81,15 @@ X509_REQ *x;
83 } 81 }
84#endif 82#endif
85 83
86int X509_REQ_print(bp,x) 84int X509_REQ_print(BIO *bp, X509_REQ *x)
87BIO *bp;
88X509_REQ *x;
89 { 85 {
90 unsigned long l; 86 unsigned long l;
91 int i,n; 87 int i,n;
92 char *s,*neg; 88 char *s;
89 const char *neg;
93 X509_REQ_INFO *ri; 90 X509_REQ_INFO *ri;
94 EVP_PKEY *pkey; 91 EVP_PKEY *pkey;
95 STACK *sk; 92 STACK_OF(X509_ATTRIBUTE) *sk;
96 char str[128]; 93 char str[128];
97 94
98 ri=x->req_info; 95 ri=x->req_info;
@@ -138,12 +135,14 @@ X509_REQ *x;
138#endif 135#endif
139 BIO_printf(bp,"%12sUnknown Public Key:\n",""); 136 BIO_printf(bp,"%12sUnknown Public Key:\n","");
140 137
138 EVP_PKEY_free(pkey);
139
141 /* may not be */ 140 /* may not be */
142 sprintf(str,"%8sAttributes:\n",""); 141 sprintf(str,"%8sAttributes:\n","");
143 if (BIO_puts(bp,str) <= 0) goto err; 142 if (BIO_puts(bp,str) <= 0) goto err;
144 143
145 sk=x->req_info->attributes; 144 sk=x->req_info->attributes;
146 if ((sk == NULL) || (sk_num(sk) == 0)) 145 if ((sk == NULL) || (sk_X509_ATTRIBUTE_num(sk) == 0))
147 { 146 {
148 if (!x->req_info->req_kludge) 147 if (!x->req_info->req_kludge)
149 { 148 {
@@ -153,7 +152,7 @@ X509_REQ *x;
153 } 152 }
154 else 153 else
155 { 154 {
156 for (i=0; i<sk_num(sk); i++) 155 for (i=0; i<sk_X509_ATTRIBUTE_num(sk); i++)
157 { 156 {
158 ASN1_TYPE *at; 157 ASN1_TYPE *at;
159 X509_ATTRIBUTE *a; 158 X509_ATTRIBUTE *a;
@@ -161,17 +160,17 @@ X509_REQ *x;
161 ASN1_TYPE *t; 160 ASN1_TYPE *t;
162 int j,type=0,count=1,ii=0; 161 int j,type=0,count=1,ii=0;
163 162
164 a=(X509_ATTRIBUTE *)sk_value(sk,i); 163 a=sk_X509_ATTRIBUTE_value(sk,i);
165 sprintf(str,"%12s",""); 164 sprintf(str,"%12s","");
166 if (BIO_puts(bp,str) <= 0) goto err; 165 if (BIO_puts(bp,str) <= 0) goto err;
167 if ((j=i2a_ASN1_OBJECT(bp,a->object)) > 0) 166 if ((j=i2a_ASN1_OBJECT(bp,a->object)) > 0)
168 167 {
169 if (a->set) 168 if (a->set)
170 { 169 {
171 ii=0; 170 ii=0;
172 count=sk_num(a->value.set); 171 count=sk_ASN1_TYPE_num(a->value.set);
173get_next: 172get_next:
174 at=(ASN1_TYPE *)sk_value(a->value.set,ii); 173 at=sk_ASN1_TYPE_value(a->value.set,ii);
175 type=at->type; 174 type=at->type;
176 bs=at->value.asn1_string; 175 bs=at->value.asn1_string;
177 } 176 }
@@ -181,6 +180,7 @@ get_next:
181 type=t->type; 180 type=t->type;
182 bs=t->value.bit_string; 181 bs=t->value.bit_string;
183 } 182 }
183 }
184 for (j=25-j; j>0; j--) 184 for (j=25-j; j>0; j--)
185 if (BIO_write(bp," ",1) != 1) goto err; 185 if (BIO_write(bp," ",1) != 1) goto err;
186 if (BIO_puts(bp,":") <= 0) goto err; 186 if (BIO_puts(bp,":") <= 0) goto err;
diff --git a/src/lib/libcrypto/asn1/t_x509.c b/src/lib/libcrypto/asn1/t_x509.c
index b10fbbb992..42f4d498cf 100644
--- a/src/lib/libcrypto/asn1/t_x509.c
+++ b/src/lib/libcrypto/asn1/t_x509.c
@@ -58,21 +58,20 @@
58 58
59#include <stdio.h> 59#include <stdio.h>
60#include "cryptlib.h" 60#include "cryptlib.h"
61#include "buffer.h" 61#include <openssl/buffer.h>
62#include "bn.h" 62#include <openssl/bn.h>
63#ifndef NO_RSA 63#ifndef NO_RSA
64#include "rsa.h" 64#include <openssl/rsa.h>
65#endif 65#endif
66#ifndef NO_DSA 66#ifndef NO_DSA
67#include "dsa.h" 67#include <openssl/dsa.h>
68#endif 68#endif
69#include "objects.h" 69#include <openssl/objects.h>
70#include "x509.h" 70#include <openssl/x509.h>
71#include <openssl/x509v3.h>
71 72
72#ifndef NO_FP_API 73#ifndef NO_FP_API
73int X509_print_fp(fp,x) 74int X509_print_fp(FILE *fp, X509 *x)
74FILE *fp;
75X509 *x;
76 { 75 {
77 BIO *b; 76 BIO *b;
78 int ret; 77 int ret;
@@ -89,9 +88,7 @@ X509 *x;
89 } 88 }
90#endif 89#endif
91 90
92int X509_print(bp,x) 91int X509_print(BIO *bp, X509 *x)
93BIO *bp;
94X509 *x;
95 { 92 {
96 long l; 93 long l;
97 int ret=0,i,j,n; 94 int ret=0,i,j,n;
@@ -99,7 +96,7 @@ X509 *x;
99 X509_CINF *ci; 96 X509_CINF *ci;
100 ASN1_INTEGER *bs; 97 ASN1_INTEGER *bs;
101 EVP_PKEY *pkey=NULL; 98 EVP_PKEY *pkey=NULL;
102 char *neg; 99 const char *neg;
103 X509_EXTENSION *ex; 100 X509_EXTENSION *ex;
104 ASN1_STRING *str=NULL; 101 ASN1_STRING *str=NULL;
105 102
@@ -146,9 +143,9 @@ X509 *x;
146 if (!X509_NAME_print(bp,X509_get_issuer_name(x),16)) goto err; 143 if (!X509_NAME_print(bp,X509_get_issuer_name(x),16)) goto err;
147 if (BIO_write(bp,"\n Validity\n",18) <= 0) goto err; 144 if (BIO_write(bp,"\n Validity\n",18) <= 0) goto err;
148 if (BIO_write(bp," Not Before: ",24) <= 0) goto err; 145 if (BIO_write(bp," Not Before: ",24) <= 0) goto err;
149 if (!ASN1_UTCTIME_print(bp,X509_get_notBefore(x))) goto err; 146 if (!ASN1_TIME_print(bp,X509_get_notBefore(x))) goto err;
150 if (BIO_write(bp,"\n Not After : ",25) <= 0) goto err; 147 if (BIO_write(bp,"\n Not After : ",25) <= 0) goto err;
151 if (!ASN1_UTCTIME_print(bp,X509_get_notAfter(x))) goto err; 148 if (!ASN1_TIME_print(bp,X509_get_notAfter(x))) goto err;
152 if (BIO_write(bp,"\n Subject: ",18) <= 0) goto err; 149 if (BIO_write(bp,"\n Subject: ",18) <= 0) goto err;
153 if (!X509_NAME_print(bp,X509_get_subject_name(x),16)) goto err; 150 if (!X509_NAME_print(bp,X509_get_subject_name(x),16)) goto err;
154 if (BIO_write(bp,"\n Subject Public Key Info:\n",34) <= 0) 151 if (BIO_write(bp,"\n Subject Public Key Info:\n",34) <= 0)
@@ -158,6 +155,12 @@ X509 *x;
158 (i == NID_undef)?"UNKNOWN":OBJ_nid2ln(i)) <= 0) goto err; 155 (i == NID_undef)?"UNKNOWN":OBJ_nid2ln(i)) <= 0) goto err;
159 156
160 pkey=X509_get_pubkey(x); 157 pkey=X509_get_pubkey(x);
158 if (pkey == NULL)
159 {
160 BIO_printf(bp,"%12sUnable to load Public Key\n","");
161 ERR_print_errors(bp);
162 }
163 else
161#ifndef NO_RSA 164#ifndef NO_RSA
162 if (pkey->type == EVP_PKEY_RSA) 165 if (pkey->type == EVP_PKEY_RSA)
163 { 166 {
@@ -175,7 +178,9 @@ X509 *x;
175 } 178 }
176 else 179 else
177#endif 180#endif
178 BIO_printf(bp,"%12sDSA Public Key:\n",""); 181 BIO_printf(bp,"%12sUnknown Public Key:\n","");
182
183 EVP_PKEY_free(pkey);
179 184
180 n=X509_get_ext_count(x); 185 n=X509_get_ext_count(x);
181 if (n > 0) 186 if (n > 0)
@@ -183,7 +188,9 @@ X509 *x;
183 BIO_printf(bp,"%8sX509v3 extensions:\n",""); 188 BIO_printf(bp,"%8sX509v3 extensions:\n","");
184 for (i=0; i<n; i++) 189 for (i=0; i<n; i++)
185 { 190 {
191#if 0
186 int data_type,pack_type; 192 int data_type,pack_type;
193#endif
187 ASN1_OBJECT *obj; 194 ASN1_OBJECT *obj;
188 195
189 ex=X509_get_ext(x,i); 196 ex=X509_get_ext(x,i);
@@ -191,41 +198,11 @@ X509 *x;
191 obj=X509_EXTENSION_get_object(ex); 198 obj=X509_EXTENSION_get_object(ex);
192 i2a_ASN1_OBJECT(bp,obj); 199 i2a_ASN1_OBJECT(bp,obj);
193 j=X509_EXTENSION_get_critical(ex); 200 j=X509_EXTENSION_get_critical(ex);
194 if (BIO_printf(bp,": %s\n%16s",j?"critical":"","") <= 0) 201 if (BIO_printf(bp,": %s\n",j?"critical":"","") <= 0)
195 goto err; 202 goto err;
196 203 if(!X509V3_EXT_print(bp, ex, 0, 16))
197 pack_type=X509v3_pack_type_by_OBJ(obj);
198 data_type=X509v3_data_type_by_OBJ(obj);
199
200 if (pack_type == X509_EXT_PACK_STRING)
201 {
202 if (X509v3_unpack_string(
203 &str,data_type,
204 X509_EXTENSION_get_data(ex)) == NULL)
205 {
206 /* hmm... */
207 goto err;
208 }
209 if ( (data_type == V_ASN1_IA5STRING) ||
210 (data_type == V_ASN1_PRINTABLESTRING) ||
211 (data_type == V_ASN1_T61STRING))
212 {
213 if (BIO_write(bp,(char *)str->data,
214 str->length) <= 0)
215 goto err;
216 }
217 else if (data_type == V_ASN1_BIT_STRING)
218 {
219 BIO_printf(bp,"0x");
220 for (j=0; j<str->length; j++)
221 {
222 BIO_printf(bp,"%02X",
223 str->data[j]);
224 }
225 }
226 }
227 else
228 { 204 {
205 BIO_printf(bp, "%16s", "");
229 ASN1_OCTET_STRING_print(bp,ex->value); 206 ASN1_OCTET_STRING_print(bp,ex->value);
230 } 207 }
231 if (BIO_write(bp,"\n",1) <= 0) goto err; 208 if (BIO_write(bp,"\n",1) <= 0) goto err;
@@ -253,9 +230,7 @@ err:
253 return(ret); 230 return(ret);
254 } 231 }
255 232
256int ASN1_STRING_print(bp,v) 233int ASN1_STRING_print(BIO *bp, ASN1_STRING *v)
257BIO *bp;
258ASN1_STRING *v;
259 { 234 {
260 int i,n; 235 int i,n;
261 char buf[80],*p;; 236 char buf[80],*p;;
@@ -284,15 +259,59 @@ ASN1_STRING *v;
284 return(1); 259 return(1);
285 } 260 }
286 261
287int ASN1_UTCTIME_print(bp,tm) 262int ASN1_TIME_print(BIO *bp, ASN1_TIME *tm)
288BIO *bp; 263{
289ASN1_UTCTIME *tm; 264 if(tm->type == V_ASN1_UTCTIME) return ASN1_UTCTIME_print(bp, tm);
265 if(tm->type == V_ASN1_GENERALIZEDTIME)
266 return ASN1_GENERALIZEDTIME_print(bp, tm);
267 BIO_write(bp,"Bad time value",14);
268 return(0);
269}
270
271static const char *mon[12]=
272 {
273 "Jan","Feb","Mar","Apr","May","Jun",
274 "Jul","Aug","Sep","Oct","Nov","Dec"
275 };
276
277int ASN1_GENERALIZEDTIME_print(BIO *bp, ASN1_GENERALIZEDTIME *tm)
278 {
279 char *v;
280 int gmt=0;
281 int i;
282 int y=0,M=0,d=0,h=0,m=0,s=0;
283
284 i=tm->length;
285 v=(char *)tm->data;
286
287 if (i < 12) goto err;
288 if (v[i-1] == 'Z') gmt=1;
289 for (i=0; i<12; i++)
290 if ((v[i] > '9') || (v[i] < '0')) goto err;
291 y= (v[0]-'0')*1000+(v[1]-'0')*100 + (v[2]-'0')*10+(v[3]-'0');
292 M= (v[4]-'0')*10+(v[5]-'0');
293 if ((M > 12) || (M < 1)) goto err;
294 d= (v[6]-'0')*10+(v[7]-'0');
295 h= (v[8]-'0')*10+(v[9]-'0');
296 m= (v[10]-'0')*10+(v[11]-'0');
297 if ( (v[12] >= '0') && (v[12] <= '9') &&
298 (v[13] >= '0') && (v[13] <= '9'))
299 s= (v[12]-'0')*10+(v[13]-'0');
300
301 if (BIO_printf(bp,"%s %2d %02d:%02d:%02d %d%s",
302 mon[M-1],d,h,m,s,y,(gmt)?" GMT":"") <= 0)
303 return(0);
304 else
305 return(1);
306err:
307 BIO_write(bp,"Bad time value",14);
308 return(0);
309 }
310
311int ASN1_UTCTIME_print(BIO *bp, ASN1_UTCTIME *tm)
290 { 312 {
291 char *v; 313 char *v;
292 int gmt=0; 314 int gmt=0;
293 static char *mon[12]={
294 "Jan","Feb","Mar","Apr","May","Jun",
295 "Jul","Aug","Sep","Oct","Nov","Dec"};
296 int i; 315 int i;
297 int y=0,M=0,d=0,h=0,m=0,s=0; 316 int y=0,M=0,d=0,h=0,m=0,s=0;
298 317
@@ -324,10 +343,7 @@ err:
324 return(0); 343 return(0);
325 } 344 }
326 345
327int X509_NAME_print(bp,name,obase) 346int X509_NAME_print(BIO *bp, X509_NAME *name, int obase)
328BIO *bp;
329X509_NAME *name;
330int obase;
331 { 347 {
332 char *s,*c; 348 char *s,*c;
333 int ret=0,l,ll,i,first=1; 349 int ret=0,l,ll,i,first=1;
@@ -342,6 +358,7 @@ int obase;
342 c=s; 358 c=s;
343 for (;;) 359 for (;;)
344 { 360 {
361#ifndef CHARSET_EBCDIC
345 if ( ((*s == '/') && 362 if ( ((*s == '/') &&
346 ((s[1] >= 'A') && (s[1] <= 'Z') && ( 363 ((s[1] >= 'A') && (s[1] <= 'Z') && (
347 (s[2] == '=') || 364 (s[2] == '=') ||
@@ -349,6 +366,15 @@ int obase;
349 (s[3] == '=')) 366 (s[3] == '='))
350 ))) || 367 ))) ||
351 (*s == '\0')) 368 (*s == '\0'))
369#else
370 if ( ((*s == '/') &&
371 (isupper(s[1]) && (
372 (s[2] == '=') ||
373 (isupper(s[2]) &&
374 (s[3] == '='))
375 ))) ||
376 (*s == '\0'))
377#endif
352 { 378 {
353 if ((l <= 0) && !first) 379 if ((l <= 0) && !first)
354 { 380 {
diff --git a/src/lib/libcrypto/asn1/x_algor.c b/src/lib/libcrypto/asn1/x_algor.c
index 0ed2c87b64..b2c20d139f 100644
--- a/src/lib/libcrypto/asn1/x_algor.c
+++ b/src/lib/libcrypto/asn1/x_algor.c
@@ -58,17 +58,10 @@
58 58
59#include <stdio.h> 59#include <stdio.h>
60#include "cryptlib.h" 60#include "cryptlib.h"
61#include "asn1_mac.h" 61#include <openssl/asn1_mac.h>
62#include <openssl/x509.h>
62 63
63/* 64int i2d_X509_ALGOR(X509_ALGOR *a, unsigned char **pp)
64 * ASN1err(ASN1_F_D2I_X509_ALGOR,ASN1_R_LENGTH_MISMATCH);
65 * ASN1err(ASN1_F_X509_ALGOR_NEW,ASN1_R_EXPECTING_A_SEQUENCE);
66 * ASN1err(ASN1_F_D2I_X509_ALGOR,ASN1_R_LENGTH_MISMATCH);
67 */
68
69int i2d_X509_ALGOR(a,pp)
70X509_ALGOR *a;
71unsigned char **pp;
72 { 65 {
73 M_ASN1_I2D_vars(a); 66 M_ASN1_I2D_vars(a);
74 67
@@ -84,10 +77,7 @@ unsigned char **pp;
84 M_ASN1_I2D_finish(); 77 M_ASN1_I2D_finish();
85 } 78 }
86 79
87X509_ALGOR *d2i_X509_ALGOR(a,pp,length) 80X509_ALGOR *d2i_X509_ALGOR(X509_ALGOR **a, unsigned char **pp, long length)
88X509_ALGOR **a;
89unsigned char **pp;
90long length;
91 { 81 {
92 M_ASN1_D2I_vars(a,X509_ALGOR *,X509_ALGOR_new); 82 M_ASN1_D2I_vars(a,X509_ALGOR *,X509_ALGOR_new);
93 83
@@ -104,19 +94,19 @@ long length;
104 M_ASN1_D2I_Finish(a,X509_ALGOR_free,ASN1_F_D2I_X509_ALGOR); 94 M_ASN1_D2I_Finish(a,X509_ALGOR_free,ASN1_F_D2I_X509_ALGOR);
105 } 95 }
106 96
107X509_ALGOR *X509_ALGOR_new() 97X509_ALGOR *X509_ALGOR_new(void)
108 { 98 {
109 X509_ALGOR *ret=NULL; 99 X509_ALGOR *ret=NULL;
100 ASN1_CTX c;
110 101
111 M_ASN1_New_Malloc(ret,X509_ALGOR); 102 M_ASN1_New_Malloc(ret,X509_ALGOR);
112 M_ASN1_New(ret->algorithm,ASN1_OBJECT_new); 103 ret->algorithm=OBJ_nid2obj(NID_undef);
113 ret->parameter=NULL; 104 ret->parameter=NULL;
114 return(ret); 105 return(ret);
115 M_ASN1_New_Error(ASN1_F_X509_ALGOR_NEW); 106 M_ASN1_New_Error(ASN1_F_X509_ALGOR_NEW);
116 } 107 }
117 108
118void X509_ALGOR_free(a) 109void X509_ALGOR_free(X509_ALGOR *a)
119X509_ALGOR *a;
120 { 110 {
121 if (a == NULL) return; 111 if (a == NULL) return;
122 ASN1_OBJECT_free(a->algorithm); 112 ASN1_OBJECT_free(a->algorithm);
@@ -124,3 +114,5 @@ X509_ALGOR *a;
124 Free((char *)a); 114 Free((char *)a);
125 } 115 }
126 116
117IMPLEMENT_STACK_OF(X509_ALGOR)
118IMPLEMENT_ASN1_SET_OF(X509_ALGOR)
diff --git a/src/lib/libcrypto/asn1/x_attrib.c b/src/lib/libcrypto/asn1/x_attrib.c
index e52ced8627..a1cbebf5a5 100644
--- a/src/lib/libcrypto/asn1/x_attrib.c
+++ b/src/lib/libcrypto/asn1/x_attrib.c
@@ -58,19 +58,12 @@
58 58
59#include <stdio.h> 59#include <stdio.h>
60#include "cryptlib.h" 60#include "cryptlib.h"
61#include "objects.h" 61#include <openssl/objects.h>
62#include "asn1_mac.h" 62#include <openssl/asn1_mac.h>
63 63#include <openssl/x509.h>
64/*
65 * ASN1err(ASN1_F_D2I_X509_ATTRIBUTE,ASN1_R_LENGTH_MISMATCH);
66 * ASN1err(ASN1_F_X509_ATTRIBUTE_NEW,ASN1_R_UNKNOWN_ATTRIBUTE_TYPE);
67 * ASN1err(ASN1_F_I2D_X509_ATTRIBUTE,ASN1_R_UNKNOWN_ATTRIBUTE_TYPE);
68 */
69 64
70/* sequence */ 65/* sequence */
71int i2d_X509_ATTRIBUTE(a,pp) 66int i2d_X509_ATTRIBUTE(X509_ATTRIBUTE *a, unsigned char **pp)
72X509_ATTRIBUTE *a;
73unsigned char **pp;
74 { 67 {
75 int k=0; 68 int k=0;
76 int r=0,ret=0; 69 int r=0,ret=0;
@@ -92,18 +85,16 @@ unsigned char **pp;
92 85
93 ret+=i2d_ASN1_OBJECT(a->object,p); 86 ret+=i2d_ASN1_OBJECT(a->object,p);
94 if (a->set) 87 if (a->set)
95 ret+=i2d_ASN1_SET(a->value.set,p,i2d_ASN1_TYPE, 88 ret+=i2d_ASN1_SET_OF_ASN1_TYPE(a->value.set,p,i2d_ASN1_TYPE,
96 V_ASN1_SET,V_ASN1_UNIVERSAL); 89 V_ASN1_SET,V_ASN1_UNIVERSAL,IS_SET);
97 else 90 else
98 ret+=i2d_ASN1_TYPE(a->value.single,p); 91 ret+=i2d_ASN1_TYPE(a->value.single,p);
99 if (k++) return(r); 92 if (k++) return(r);
100 } 93 }
101 } 94 }
102 95
103X509_ATTRIBUTE *d2i_X509_ATTRIBUTE(a,pp,length) 96X509_ATTRIBUTE *d2i_X509_ATTRIBUTE(X509_ATTRIBUTE **a, unsigned char **pp,
104X509_ATTRIBUTE **a; 97 long length)
105unsigned char **pp;
106long length;
107 { 98 {
108 M_ASN1_D2I_vars(a,X509_ATTRIBUTE *,X509_ATTRIBUTE_new); 99 M_ASN1_D2I_vars(a,X509_ATTRIBUTE *,X509_ATTRIBUTE_new);
109 100
@@ -115,7 +106,8 @@ long length;
115 (M_ASN1_next == (V_ASN1_CONSTRUCTED|V_ASN1_UNIVERSAL|V_ASN1_SET))) 106 (M_ASN1_next == (V_ASN1_CONSTRUCTED|V_ASN1_UNIVERSAL|V_ASN1_SET)))
116 { 107 {
117 ret->set=1; 108 ret->set=1;
118 M_ASN1_D2I_get_set(ret->value.set,d2i_ASN1_TYPE); 109 M_ASN1_D2I_get_set_type(ASN1_TYPE,ret->value.set,d2i_ASN1_TYPE,
110 ASN1_TYPE_free);
119 } 111 }
120 else 112 else
121 { 113 {
@@ -126,25 +118,46 @@ long length;
126 M_ASN1_D2I_Finish(a,X509_ATTRIBUTE_free,ASN1_F_D2I_X509_ATTRIBUTE); 118 M_ASN1_D2I_Finish(a,X509_ATTRIBUTE_free,ASN1_F_D2I_X509_ATTRIBUTE);
127 } 119 }
128 120
129X509_ATTRIBUTE *X509_ATTRIBUTE_new() 121X509_ATTRIBUTE *X509_ATTRIBUTE_create(int nid, int atrtype, void *value)
122 {
123 X509_ATTRIBUTE *ret=NULL;
124 ASN1_TYPE *val=NULL;
125
126 if ((ret=X509_ATTRIBUTE_new()) == NULL)
127 return(NULL);
128 ret->object=OBJ_nid2obj(nid);
129 ret->set=1;
130 if ((ret->value.set=sk_ASN1_TYPE_new_null()) == NULL) goto err;
131 if ((val=ASN1_TYPE_new()) == NULL) goto err;
132 if (!sk_ASN1_TYPE_push(ret->value.set,val)) goto err;
133
134 ASN1_TYPE_set(val,atrtype,value);
135 return(ret);
136err:
137 if (ret != NULL) X509_ATTRIBUTE_free(ret);
138 if (val != NULL) ASN1_TYPE_free(val);
139 return(NULL);
140 }
141
142X509_ATTRIBUTE *X509_ATTRIBUTE_new(void)
130 { 143 {
131 X509_ATTRIBUTE *ret=NULL; 144 X509_ATTRIBUTE *ret=NULL;
145 ASN1_CTX c;
132 146
133 M_ASN1_New_Malloc(ret,X509_ATTRIBUTE); 147 M_ASN1_New_Malloc(ret,X509_ATTRIBUTE);
134 M_ASN1_New(ret->object,ASN1_OBJECT_new); 148 ret->object=OBJ_nid2obj(NID_undef);
135 ret->set=0; 149 ret->set=0;
136 ret->value.ptr=NULL; 150 ret->value.ptr=NULL;
137 return(ret); 151 return(ret);
138 M_ASN1_New_Error(ASN1_F_X509_ATTRIBUTE_NEW); 152 M_ASN1_New_Error(ASN1_F_X509_ATTRIBUTE_NEW);
139 } 153 }
140 154
141void X509_ATTRIBUTE_free(a) 155void X509_ATTRIBUTE_free(X509_ATTRIBUTE *a)
142X509_ATTRIBUTE *a;
143 { 156 {
144 if (a == NULL) return; 157 if (a == NULL) return;
145 ASN1_OBJECT_free(a->object); 158 ASN1_OBJECT_free(a->object);
146 if (a->set) 159 if (a->set)
147 sk_pop_free(a->value.set,ASN1_TYPE_free); 160 sk_ASN1_TYPE_pop_free(a->value.set,ASN1_TYPE_free);
148 else 161 else
149 ASN1_TYPE_free(a->value.single); 162 ASN1_TYPE_free(a->value.single);
150 Free((char *)a); 163 Free((char *)a);
diff --git a/src/lib/libcrypto/asn1/x_cinf.c b/src/lib/libcrypto/asn1/x_cinf.c
index 4fc2cc9f6e..fe1b18a90f 100644
--- a/src/lib/libcrypto/asn1/x_cinf.c
+++ b/src/lib/libcrypto/asn1/x_cinf.c
@@ -58,16 +58,10 @@
58 58
59#include <stdio.h> 59#include <stdio.h>
60#include "cryptlib.h" 60#include "cryptlib.h"
61#include "asn1_mac.h" 61#include <openssl/asn1_mac.h>
62#include <openssl/x509.h>
62 63
63/* 64int i2d_X509_CINF(X509_CINF *a, unsigned char **pp)
64 * ASN1err(ASN1_F_D2I_X509_CINF,ASN1_R_LENGTH_MISMATCH);
65 * ASN1err(ASN1_F_X509_CINF_NEW,ASN1_R_LENGTH_MISMATCH);
66 */
67
68int i2d_X509_CINF(a,pp)
69X509_CINF *a;
70unsigned char **pp;
71 { 65 {
72 int v1=0,v2=0; 66 int v1=0,v2=0;
73 M_ASN1_I2D_vars(a); 67 M_ASN1_I2D_vars(a);
@@ -81,7 +75,9 @@ unsigned char **pp;
81 M_ASN1_I2D_len(a->key, i2d_X509_PUBKEY); 75 M_ASN1_I2D_len(a->key, i2d_X509_PUBKEY);
82 M_ASN1_I2D_len_IMP_opt(a->issuerUID, i2d_ASN1_BIT_STRING); 76 M_ASN1_I2D_len_IMP_opt(a->issuerUID, i2d_ASN1_BIT_STRING);
83 M_ASN1_I2D_len_IMP_opt(a->subjectUID, i2d_ASN1_BIT_STRING); 77 M_ASN1_I2D_len_IMP_opt(a->subjectUID, i2d_ASN1_BIT_STRING);
84 M_ASN1_I2D_len_EXP_set_opt(a->extensions,i2d_X509_EXTENSION,3,V_ASN1_SEQUENCE,v2); 78 M_ASN1_I2D_len_EXP_SEQUENCE_opt_type(X509_EXTENSION,a->extensions,
79 i2d_X509_EXTENSION,3,
80 V_ASN1_SEQUENCE,v2);
85 81
86 M_ASN1_I2D_seq_total(); 82 M_ASN1_I2D_seq_total();
87 83
@@ -94,15 +90,14 @@ unsigned char **pp;
94 M_ASN1_I2D_put(a->key, i2d_X509_PUBKEY); 90 M_ASN1_I2D_put(a->key, i2d_X509_PUBKEY);
95 M_ASN1_I2D_put_IMP_opt(a->issuerUID, i2d_ASN1_BIT_STRING,1); 91 M_ASN1_I2D_put_IMP_opt(a->issuerUID, i2d_ASN1_BIT_STRING,1);
96 M_ASN1_I2D_put_IMP_opt(a->subjectUID, i2d_ASN1_BIT_STRING,2); 92 M_ASN1_I2D_put_IMP_opt(a->subjectUID, i2d_ASN1_BIT_STRING,2);
97 M_ASN1_I2D_put_EXP_set_opt(a->extensions,i2d_X509_EXTENSION,3,V_ASN1_SEQUENCE,v2); 93 M_ASN1_I2D_put_EXP_SEQUENCE_opt_type(X509_EXTENSION,a->extensions,
94 i2d_X509_EXTENSION,3,
95 V_ASN1_SEQUENCE,v2);
98 96
99 M_ASN1_I2D_finish(); 97 M_ASN1_I2D_finish();
100 } 98 }
101 99
102X509_CINF *d2i_X509_CINF(a,pp,length) 100X509_CINF *d2i_X509_CINF(X509_CINF **a, unsigned char **pp, long length)
103X509_CINF **a;
104unsigned char **pp;
105long length;
106 { 101 {
107 int ver=0; 102 int ver=0;
108 M_ASN1_D2I_vars(a,X509_CINF *,X509_CINF_new); 103 M_ASN1_D2I_vars(a,X509_CINF *,X509_CINF_new);
@@ -140,28 +135,38 @@ long length;
140 if (ret->subjectUID != NULL) 135 if (ret->subjectUID != NULL)
141 { 136 {
142 ASN1_BIT_STRING_free(ret->subjectUID); 137 ASN1_BIT_STRING_free(ret->subjectUID);
143 ret->issuerUID=NULL; 138 ret->subjectUID=NULL;
144 } 139 }
145 M_ASN1_D2I_get_IMP_opt(ret->issuerUID,d2i_ASN1_BIT_STRING, 1, 140 M_ASN1_D2I_get_IMP_opt(ret->issuerUID,d2i_ASN1_BIT_STRING, 1,
146 V_ASN1_BIT_STRING); 141 V_ASN1_BIT_STRING);
147 M_ASN1_D2I_get_IMP_opt(ret->subjectUID,d2i_ASN1_BIT_STRING, 2, 142 M_ASN1_D2I_get_IMP_opt(ret->subjectUID,d2i_ASN1_BIT_STRING, 2,
148 V_ASN1_BIT_STRING); 143 V_ASN1_BIT_STRING);
149 } 144 }
145/* Note: some broken certificates include extensions but don't set
146 * the version number properly. By bypassing this check they can
147 * be parsed.
148 */
149
150#ifdef VERSION_EXT_CHECK
150 if (ver >= 2) /* version 3 extensions */ 151 if (ver >= 2) /* version 3 extensions */
152#endif
151 { 153 {
152 if (ret->extensions != NULL) 154 if (ret->extensions != NULL)
153 while (sk_num(ret->extensions)) 155 while (sk_X509_EXTENSION_num(ret->extensions))
154 X509_EXTENSION_free((X509_EXTENSION *) 156 X509_EXTENSION_free(
155 sk_pop(ret->extensions)); 157 sk_X509_EXTENSION_pop(ret->extensions));
156 M_ASN1_D2I_get_EXP_set_opt(ret->extensions,d2i_X509_EXTENSION,3, 158 M_ASN1_D2I_get_EXP_set_opt_type(X509_EXTENSION,ret->extensions,
157 V_ASN1_SEQUENCE); 159 d2i_X509_EXTENSION,
160 X509_EXTENSION_free,3,
161 V_ASN1_SEQUENCE);
158 } 162 }
159 M_ASN1_D2I_Finish(a,X509_CINF_free,ASN1_F_D2I_X509_CINF); 163 M_ASN1_D2I_Finish(a,X509_CINF_free,ASN1_F_D2I_X509_CINF);
160 } 164 }
161 165
162X509_CINF *X509_CINF_new() 166X509_CINF *X509_CINF_new(void)
163 { 167 {
164 X509_CINF *ret=NULL; 168 X509_CINF *ret=NULL;
169 ASN1_CTX c;
165 170
166 M_ASN1_New_Malloc(ret,X509_CINF); 171 M_ASN1_New_Malloc(ret,X509_CINF);
167 ret->version=NULL; 172 ret->version=NULL;
@@ -178,8 +183,7 @@ X509_CINF *X509_CINF_new()
178 M_ASN1_New_Error(ASN1_F_X509_CINF_NEW); 183 M_ASN1_New_Error(ASN1_F_X509_CINF_NEW);
179 } 184 }
180 185
181void X509_CINF_free(a) 186void X509_CINF_free(X509_CINF *a)
182X509_CINF *a;
183 { 187 {
184 if (a == NULL) return; 188 if (a == NULL) return;
185 ASN1_INTEGER_free(a->version); 189 ASN1_INTEGER_free(a->version);
@@ -191,7 +195,7 @@ X509_CINF *a;
191 X509_PUBKEY_free(a->key); 195 X509_PUBKEY_free(a->key);
192 ASN1_BIT_STRING_free(a->issuerUID); 196 ASN1_BIT_STRING_free(a->issuerUID);
193 ASN1_BIT_STRING_free(a->subjectUID); 197 ASN1_BIT_STRING_free(a->subjectUID);
194 sk_pop_free(a->extensions,X509_EXTENSION_free); 198 sk_X509_EXTENSION_pop_free(a->extensions,X509_EXTENSION_free);
195 Free((char *)a); 199 Free(a);
196 } 200 }
197 201
diff --git a/src/lib/libcrypto/asn1/x_crl.c b/src/lib/libcrypto/asn1/x_crl.c
index 13acdab427..cd46bbebc2 100644
--- a/src/lib/libcrypto/asn1/x_crl.c
+++ b/src/lib/libcrypto/asn1/x_crl.c
@@ -58,83 +58,69 @@
58 58
59#include <stdio.h> 59#include <stdio.h>
60#include "cryptlib.h" 60#include "cryptlib.h"
61#include "asn1_mac.h" 61#include <openssl/asn1_mac.h>
62#include "x509.h" 62#include <openssl/x509.h>
63
64/*
65 * ASN1err(ASN1_F_D2I_X509_CRL,ASN1_R_LENGTH_MISMATCH);
66 * ASN1err(ASN1_F_D2I_X509_CRL_INFO,ASN1_R_EXPECTING_A_SEQUENCE);
67 * ASN1err(ASN1_F_D2I_X509_REVOKED,ASN1_R_LENGTH_MISMATCH);
68 * ASN1err(ASN1_F_X509_CRL_NEW,ASN1_R_LENGTH_MISMATCH);
69 * ASN1err(ASN1_F_X509_CRL_INFO_NEW,ASN1_R_EXPECTING_A_SEQUENCE);
70 * ASN1err(ASN1_F_X509_REVOKED_NEW,ASN1_R_LENGTH_MISMATCH);
71 */
72 63
73#ifndef NOPROTO
74static int X509_REVOKED_cmp(X509_REVOKED **a,X509_REVOKED **b); 64static int X509_REVOKED_cmp(X509_REVOKED **a,X509_REVOKED **b);
75static int X509_REVOKED_seq_cmp(X509_REVOKED **a,X509_REVOKED **b); 65static int X509_REVOKED_seq_cmp(X509_REVOKED **a,X509_REVOKED **b);
76#else 66int i2d_X509_REVOKED(X509_REVOKED *a, unsigned char **pp)
77static int X509_REVOKED_cmp();
78static int X509_REVOKED_seq_cmp();
79#endif
80
81int i2d_X509_REVOKED(a,pp)
82X509_REVOKED *a;
83unsigned char **pp;
84 { 67 {
85 M_ASN1_I2D_vars(a); 68 M_ASN1_I2D_vars(a);
86 69
87 M_ASN1_I2D_len(a->serialNumber,i2d_ASN1_INTEGER); 70 M_ASN1_I2D_len(a->serialNumber,i2d_ASN1_INTEGER);
88 M_ASN1_I2D_len(a->revocationDate,i2d_ASN1_UTCTIME); 71 M_ASN1_I2D_len(a->revocationDate,i2d_ASN1_TIME);
89 M_ASN1_I2D_len_SEQ_opt(a->extensions,i2d_X509_EXTENSION); 72 M_ASN1_I2D_len_SEQUENCE_opt_type(X509_EXTENSION,a->extensions,
73 i2d_X509_EXTENSION);
90 74
91 M_ASN1_I2D_seq_total(); 75 M_ASN1_I2D_seq_total();
92 76
93 M_ASN1_I2D_put(a->serialNumber,i2d_ASN1_INTEGER); 77 M_ASN1_I2D_put(a->serialNumber,i2d_ASN1_INTEGER);
94 M_ASN1_I2D_put(a->revocationDate,i2d_ASN1_UTCTIME); 78 M_ASN1_I2D_put(a->revocationDate,i2d_ASN1_TIME);
95 M_ASN1_I2D_put_SEQ_opt(a->extensions,i2d_X509_EXTENSION); 79 M_ASN1_I2D_put_SEQUENCE_opt_type(X509_EXTENSION,a->extensions,
80 i2d_X509_EXTENSION);
96 81
97 M_ASN1_I2D_finish(); 82 M_ASN1_I2D_finish();
98 } 83 }
99 84
100X509_REVOKED *d2i_X509_REVOKED(a,pp,length) 85X509_REVOKED *d2i_X509_REVOKED(X509_REVOKED **a, unsigned char **pp,
101X509_REVOKED **a; 86 long length)
102unsigned char **pp;
103long length;
104 { 87 {
105 M_ASN1_D2I_vars(a,X509_REVOKED *,X509_REVOKED_new); 88 M_ASN1_D2I_vars(a,X509_REVOKED *,X509_REVOKED_new);
106 89
107 M_ASN1_D2I_Init(); 90 M_ASN1_D2I_Init();
108 M_ASN1_D2I_start_sequence(); 91 M_ASN1_D2I_start_sequence();
109 M_ASN1_D2I_get(ret->serialNumber,d2i_ASN1_INTEGER); 92 M_ASN1_D2I_get(ret->serialNumber,d2i_ASN1_INTEGER);
110 M_ASN1_D2I_get(ret->revocationDate,d2i_ASN1_UTCTIME); 93 M_ASN1_D2I_get(ret->revocationDate,d2i_ASN1_TIME);
111 M_ASN1_D2I_get_seq_opt(ret->extensions,d2i_X509_EXTENSION); 94 M_ASN1_D2I_get_seq_opt_type(X509_EXTENSION,ret->extensions,
95 d2i_X509_EXTENSION,X509_EXTENSION_free);
112 M_ASN1_D2I_Finish(a,X509_REVOKED_free,ASN1_F_D2I_X509_REVOKED); 96 M_ASN1_D2I_Finish(a,X509_REVOKED_free,ASN1_F_D2I_X509_REVOKED);
113 } 97 }
114 98
115int i2d_X509_CRL_INFO(a,pp) 99int i2d_X509_CRL_INFO(X509_CRL_INFO *a, unsigned char **pp)
116X509_CRL_INFO *a;
117unsigned char **pp;
118 { 100 {
119 int v1=0; 101 int v1=0;
120 long l=0; 102 long l=0;
103 int (*old_cmp)(X509_REVOKED **,X509_REVOKED **);
121 M_ASN1_I2D_vars(a); 104 M_ASN1_I2D_vars(a);
105
106 old_cmp=sk_X509_REVOKED_set_cmp_func(a->revoked,X509_REVOKED_seq_cmp);
107 sk_X509_REVOKED_sort(a->revoked);
108 sk_X509_REVOKED_set_cmp_func(a->revoked,old_cmp);
122 109
123 if (sk_num(a->revoked) != 0)
124 qsort((char *)a->revoked->data,sk_num(a->revoked),
125 sizeof(X509_REVOKED *),(int (*)(P_CC_CC))X509_REVOKED_seq_cmp);
126 if ((a->version != NULL) && ((l=ASN1_INTEGER_get(a->version)) != 0)) 110 if ((a->version != NULL) && ((l=ASN1_INTEGER_get(a->version)) != 0))
127 { 111 {
128 M_ASN1_I2D_len(a->version,i2d_ASN1_INTEGER); 112 M_ASN1_I2D_len(a->version,i2d_ASN1_INTEGER);
129 } 113 }
130 M_ASN1_I2D_len(a->sig_alg,i2d_X509_ALGOR); 114 M_ASN1_I2D_len(a->sig_alg,i2d_X509_ALGOR);
131 M_ASN1_I2D_len(a->issuer,i2d_X509_NAME); 115 M_ASN1_I2D_len(a->issuer,i2d_X509_NAME);
132 M_ASN1_I2D_len(a->lastUpdate,i2d_ASN1_UTCTIME); 116 M_ASN1_I2D_len(a->lastUpdate,i2d_ASN1_TIME);
133 if (a->nextUpdate != NULL) 117 if (a->nextUpdate != NULL)
134 { M_ASN1_I2D_len(a->nextUpdate,i2d_ASN1_UTCTIME); } 118 { M_ASN1_I2D_len(a->nextUpdate,i2d_ASN1_TIME); }
135 M_ASN1_I2D_len_SEQ_opt(a->revoked,i2d_X509_REVOKED); 119 M_ASN1_I2D_len_SEQUENCE_opt_type(X509_REVOKED,a->revoked,
136 M_ASN1_I2D_len_EXP_set_opt(a->extensions,i2d_X509_EXTENSION,0, 120 i2d_X509_REVOKED);
137 V_ASN1_SEQUENCE,v1); 121 M_ASN1_I2D_len_EXP_SEQUENCE_opt_type(X509_EXTENSION,a->extensions,
122 i2d_X509_EXTENSION,0,
123 V_ASN1_SEQUENCE,v1);
138 124
139 M_ASN1_I2D_seq_total(); 125 M_ASN1_I2D_seq_total();
140 126
@@ -147,17 +133,17 @@ unsigned char **pp;
147 M_ASN1_I2D_put(a->lastUpdate,i2d_ASN1_UTCTIME); 133 M_ASN1_I2D_put(a->lastUpdate,i2d_ASN1_UTCTIME);
148 if (a->nextUpdate != NULL) 134 if (a->nextUpdate != NULL)
149 { M_ASN1_I2D_put(a->nextUpdate,i2d_ASN1_UTCTIME); } 135 { M_ASN1_I2D_put(a->nextUpdate,i2d_ASN1_UTCTIME); }
150 M_ASN1_I2D_put_SEQ_opt(a->revoked,i2d_X509_REVOKED); 136 M_ASN1_I2D_put_SEQUENCE_opt_type(X509_REVOKED,a->revoked,
151 M_ASN1_I2D_put_EXP_set_opt(a->extensions,i2d_X509_EXTENSION,0, 137 i2d_X509_REVOKED);
152 V_ASN1_SEQUENCE,v1); 138 M_ASN1_I2D_put_EXP_SEQUENCE_opt_type(X509_EXTENSION,a->extensions,
139 i2d_X509_EXTENSION,0,
140 V_ASN1_SEQUENCE,v1);
153 141
154 M_ASN1_I2D_finish(); 142 M_ASN1_I2D_finish();
155 } 143 }
156 144
157X509_CRL_INFO *d2i_X509_CRL_INFO(a,pp,length) 145X509_CRL_INFO *d2i_X509_CRL_INFO(X509_CRL_INFO **a, unsigned char **pp,
158X509_CRL_INFO **a; 146 long length)
159unsigned char **pp;
160long length;
161 { 147 {
162 int i,ver=0; 148 int i,ver=0;
163 M_ASN1_D2I_vars(a,X509_CRL_INFO *,X509_CRL_INFO_new); 149 M_ASN1_D2I_vars(a,X509_CRL_INFO *,X509_CRL_INFO_new);
@@ -176,20 +162,31 @@ long length;
176 } 162 }
177 M_ASN1_D2I_get(ret->sig_alg,d2i_X509_ALGOR); 163 M_ASN1_D2I_get(ret->sig_alg,d2i_X509_ALGOR);
178 M_ASN1_D2I_get(ret->issuer,d2i_X509_NAME); 164 M_ASN1_D2I_get(ret->issuer,d2i_X509_NAME);
179 M_ASN1_D2I_get(ret->lastUpdate,d2i_ASN1_UTCTIME); 165 M_ASN1_D2I_get(ret->lastUpdate,d2i_ASN1_TIME);
180 M_ASN1_D2I_get_opt(ret->nextUpdate,d2i_ASN1_UTCTIME,V_ASN1_UTCTIME); 166 /* Manually handle the OPTIONAL ASN1_TIME stuff */
167 if(c.slen != 0
168 && ( (M_ASN1_next & ~V_ASN1_CONSTRUCTED) ==
169 (V_ASN1_UNIVERSAL|V_ASN1_UTCTIME)
170 || (M_ASN1_next & ~V_ASN1_CONSTRUCTED) ==
171 (V_ASN1_UNIVERSAL|V_ASN1_GENERALIZEDTIME) ) ) {
172 M_ASN1_D2I_get(ret->nextUpdate,d2i_ASN1_TIME);
173 }
174 if(!ret->nextUpdate)
175 M_ASN1_D2I_get_opt(ret->nextUpdate,d2i_ASN1_GENERALIZEDTIME,
176 V_ASN1_GENERALIZEDTIME);
181 if (ret->revoked != NULL) 177 if (ret->revoked != NULL)
182 { 178 {
183 while (sk_num(ret->revoked)) 179 while (sk_X509_REVOKED_num(ret->revoked))
184 X509_REVOKED_free((X509_REVOKED *)sk_pop(ret->revoked)); 180 X509_REVOKED_free(sk_X509_REVOKED_pop(ret->revoked));
185 } 181 }
186 M_ASN1_D2I_get_seq_opt(ret->revoked,d2i_X509_REVOKED); 182 M_ASN1_D2I_get_seq_opt_type(X509_REVOKED,ret->revoked,d2i_X509_REVOKED,
183 X509_REVOKED_free);
187 184
188 if (ret->revoked != NULL) 185 if (ret->revoked != NULL)
189 { 186 {
190 for (i=0; i<sk_num(ret->revoked); i++) 187 for (i=0; i<sk_X509_REVOKED_num(ret->revoked); i++)
191 { 188 {
192 ((X509_REVOKED *)sk_value(ret->revoked,i))->sequence=i; 189 sk_X509_REVOKED_value(ret->revoked,i)->sequence=i;
193 } 190 }
194 } 191 }
195 192
@@ -197,21 +194,21 @@ long length;
197 { 194 {
198 if (ret->extensions != NULL) 195 if (ret->extensions != NULL)
199 { 196 {
200 while (sk_num(ret->extensions)) 197 while (sk_X509_EXTENSION_num(ret->extensions))
201 X509_EXTENSION_free((X509_EXTENSION *) 198 X509_EXTENSION_free(
202 sk_pop(ret->extensions)); 199 sk_X509_EXTENSION_pop(ret->extensions));
203 } 200 }
204 201
205 M_ASN1_D2I_get_EXP_set_opt(ret->extensions,d2i_X509_EXTENSION, 202 M_ASN1_D2I_get_EXP_set_opt_type(X509_EXTENSION,ret->extensions,
206 0,V_ASN1_SEQUENCE); 203 d2i_X509_EXTENSION,
204 X509_EXTENSION_free,0,
205 V_ASN1_SEQUENCE);
207 } 206 }
208 207
209 M_ASN1_D2I_Finish(a,X509_CRL_INFO_free,ASN1_F_D2I_X509_CRL_INFO); 208 M_ASN1_D2I_Finish(a,X509_CRL_INFO_free,ASN1_F_D2I_X509_CRL_INFO);
210 } 209 }
211 210
212int i2d_X509_CRL(a,pp) 211int i2d_X509_CRL(X509_CRL *a, unsigned char **pp)
213X509_CRL *a;
214unsigned char **pp;
215 { 212 {
216 M_ASN1_I2D_vars(a); 213 M_ASN1_I2D_vars(a);
217 214
@@ -228,10 +225,7 @@ unsigned char **pp;
228 M_ASN1_I2D_finish(); 225 M_ASN1_I2D_finish();
229 } 226 }
230 227
231X509_CRL *d2i_X509_CRL(a,pp,length) 228X509_CRL *d2i_X509_CRL(X509_CRL **a, unsigned char **pp, long length)
232X509_CRL **a;
233unsigned char **pp;
234long length;
235 { 229 {
236 M_ASN1_D2I_vars(a,X509_CRL *,X509_CRL_new); 230 M_ASN1_D2I_vars(a,X509_CRL *,X509_CRL_new);
237 231
@@ -245,9 +239,10 @@ long length;
245 } 239 }
246 240
247 241
248X509_REVOKED *X509_REVOKED_new() 242X509_REVOKED *X509_REVOKED_new(void)
249 { 243 {
250 X509_REVOKED *ret=NULL; 244 X509_REVOKED *ret=NULL;
245 ASN1_CTX c;
251 246
252 M_ASN1_New_Malloc(ret,X509_REVOKED); 247 M_ASN1_New_Malloc(ret,X509_REVOKED);
253 M_ASN1_New(ret->serialNumber,ASN1_INTEGER_new); 248 M_ASN1_New(ret->serialNumber,ASN1_INTEGER_new);
@@ -257,9 +252,10 @@ X509_REVOKED *X509_REVOKED_new()
257 M_ASN1_New_Error(ASN1_F_X509_REVOKED_NEW); 252 M_ASN1_New_Error(ASN1_F_X509_REVOKED_NEW);
258 } 253 }
259 254
260X509_CRL_INFO *X509_CRL_INFO_new() 255X509_CRL_INFO *X509_CRL_INFO_new(void)
261 { 256 {
262 X509_CRL_INFO *ret=NULL; 257 X509_CRL_INFO *ret=NULL;
258 ASN1_CTX c;
263 259
264 M_ASN1_New_Malloc(ret,X509_CRL_INFO); 260 M_ASN1_New_Malloc(ret,X509_CRL_INFO);
265 ret->version=NULL; 261 ret->version=NULL;
@@ -267,16 +263,17 @@ X509_CRL_INFO *X509_CRL_INFO_new()
267 M_ASN1_New(ret->issuer,X509_NAME_new); 263 M_ASN1_New(ret->issuer,X509_NAME_new);
268 M_ASN1_New(ret->lastUpdate,ASN1_UTCTIME_new); 264 M_ASN1_New(ret->lastUpdate,ASN1_UTCTIME_new);
269 ret->nextUpdate=NULL; 265 ret->nextUpdate=NULL;
270 M_ASN1_New(ret->revoked,sk_new_null); 266 M_ASN1_New(ret->revoked,sk_X509_REVOKED_new_null);
271 M_ASN1_New(ret->extensions,sk_new_null); 267 M_ASN1_New(ret->extensions,sk_X509_EXTENSION_new_null);
272 ret->revoked->comp=(int (*)())X509_REVOKED_cmp; 268 sk_X509_REVOKED_set_cmp_func(ret->revoked,X509_REVOKED_cmp);
273 return(ret); 269 return(ret);
274 M_ASN1_New_Error(ASN1_F_X509_CRL_INFO_NEW); 270 M_ASN1_New_Error(ASN1_F_X509_CRL_INFO_NEW);
275 } 271 }
276 272
277X509_CRL *X509_CRL_new() 273X509_CRL *X509_CRL_new(void)
278 { 274 {
279 X509_CRL *ret=NULL; 275 X509_CRL *ret=NULL;
276 ASN1_CTX c;
280 277
281 M_ASN1_New_Malloc(ret,X509_CRL); 278 M_ASN1_New_Malloc(ret,X509_CRL);
282 ret->references=1; 279 ret->references=1;
@@ -287,18 +284,16 @@ X509_CRL *X509_CRL_new()
287 M_ASN1_New_Error(ASN1_F_X509_CRL_NEW); 284 M_ASN1_New_Error(ASN1_F_X509_CRL_NEW);
288 } 285 }
289 286
290void X509_REVOKED_free(a) 287void X509_REVOKED_free(X509_REVOKED *a)
291X509_REVOKED *a;
292 { 288 {
293 if (a == NULL) return; 289 if (a == NULL) return;
294 ASN1_INTEGER_free(a->serialNumber); 290 ASN1_INTEGER_free(a->serialNumber);
295 ASN1_UTCTIME_free(a->revocationDate); 291 ASN1_UTCTIME_free(a->revocationDate);
296 sk_pop_free(a->extensions,X509_EXTENSION_free); 292 sk_X509_EXTENSION_pop_free(a->extensions,X509_EXTENSION_free);
297 Free((char *)a); 293 Free(a);
298 } 294 }
299 295
300void X509_CRL_INFO_free(a) 296void X509_CRL_INFO_free(X509_CRL_INFO *a)
301X509_CRL_INFO *a;
302 { 297 {
303 if (a == NULL) return; 298 if (a == NULL) return;
304 ASN1_INTEGER_free(a->version); 299 ASN1_INTEGER_free(a->version);
@@ -307,13 +302,12 @@ X509_CRL_INFO *a;
307 ASN1_UTCTIME_free(a->lastUpdate); 302 ASN1_UTCTIME_free(a->lastUpdate);
308 if (a->nextUpdate) 303 if (a->nextUpdate)
309 ASN1_UTCTIME_free(a->nextUpdate); 304 ASN1_UTCTIME_free(a->nextUpdate);
310 sk_pop_free(a->revoked,X509_REVOKED_free); 305 sk_X509_REVOKED_pop_free(a->revoked,X509_REVOKED_free);
311 sk_pop_free(a->extensions,X509_EXTENSION_free); 306 sk_X509_EXTENSION_pop_free(a->extensions,X509_EXTENSION_free);
312 Free((char *)a); 307 Free(a);
313 } 308 }
314 309
315void X509_CRL_free(a) 310void X509_CRL_free(X509_CRL *a)
316X509_CRL *a;
317 { 311 {
318 int i; 312 int i;
319 313
@@ -335,19 +329,22 @@ X509_CRL *a;
335 X509_CRL_INFO_free(a->crl); 329 X509_CRL_INFO_free(a->crl);
336 X509_ALGOR_free(a->sig_alg); 330 X509_ALGOR_free(a->sig_alg);
337 ASN1_BIT_STRING_free(a->signature); 331 ASN1_BIT_STRING_free(a->signature);
338 Free((char *)a); 332 Free(a);
339 } 333 }
340 334
341static int X509_REVOKED_cmp(a,b) 335static int X509_REVOKED_cmp(X509_REVOKED **a, X509_REVOKED **b)
342X509_REVOKED **a,**b;
343 { 336 {
344 return(ASN1_STRING_cmp( 337 return(ASN1_STRING_cmp(
345 (ASN1_STRING *)(*a)->serialNumber, 338 (ASN1_STRING *)(*a)->serialNumber,
346 (ASN1_STRING *)(*b)->serialNumber)); 339 (ASN1_STRING *)(*b)->serialNumber));
347 } 340 }
348 341
349static int X509_REVOKED_seq_cmp(a,b) 342static int X509_REVOKED_seq_cmp(X509_REVOKED **a, X509_REVOKED **b)
350X509_REVOKED **a,**b;
351 { 343 {
352 return((*a)->sequence-(*b)->sequence); 344 return((*a)->sequence-(*b)->sequence);
353 } 345 }
346
347IMPLEMENT_STACK_OF(X509_REVOKED)
348IMPLEMENT_ASN1_SET_OF(X509_REVOKED)
349IMPLEMENT_STACK_OF(X509_CRL)
350IMPLEMENT_ASN1_SET_OF(X509_CRL)
diff --git a/src/lib/libcrypto/asn1/x_exten.c b/src/lib/libcrypto/asn1/x_exten.c
index 54ffe2f00b..d5f9e1df9e 100644
--- a/src/lib/libcrypto/asn1/x_exten.c
+++ b/src/lib/libcrypto/asn1/x_exten.c
@@ -58,17 +58,11 @@
58 58
59#include <stdio.h> 59#include <stdio.h>
60#include "cryptlib.h" 60#include "cryptlib.h"
61#include "objects.h" 61#include <openssl/objects.h>
62#include "asn1_mac.h" 62#include <openssl/asn1_mac.h>
63#include <openssl/x509.h>
63 64
64/* 65int i2d_X509_EXTENSION(X509_EXTENSION *a, unsigned char **pp)
65 * ASN1err(ASN1_F_D2I_X509_EXTENSION,ASN1_R_LENGTH_MISMATCH);
66 * ASN1err(ASN1_F_X509_EXTENSION_NEW,ASN1_R_LENGTH_MISMATCH);
67 */
68
69int i2d_X509_EXTENSION(a,pp)
70X509_EXTENSION *a;
71unsigned char **pp;
72 { 66 {
73 int k=0; 67 int k=0;
74 int r=0,ret=0; 68 int r=0,ret=0;
@@ -96,10 +90,8 @@ unsigned char **pp;
96 } 90 }
97 } 91 }
98 92
99X509_EXTENSION *d2i_X509_EXTENSION(a,pp,length) 93X509_EXTENSION *d2i_X509_EXTENSION(X509_EXTENSION **a, unsigned char **pp,
100X509_EXTENSION **a; 94 long length)
101unsigned char **pp;
102long length;
103 { 95 {
104 int i; 96 int i;
105 M_ASN1_D2I_vars(a,X509_EXTENSION *,X509_EXTENSION_new); 97 M_ASN1_D2I_vars(a,X509_EXTENSION *,X509_EXTENSION_new);
@@ -127,12 +119,13 @@ long length;
127 M_ASN1_D2I_Finish(a,X509_EXTENSION_free,ASN1_F_D2I_X509_EXTENSION); 119 M_ASN1_D2I_Finish(a,X509_EXTENSION_free,ASN1_F_D2I_X509_EXTENSION);
128 } 120 }
129 121
130X509_EXTENSION *X509_EXTENSION_new() 122X509_EXTENSION *X509_EXTENSION_new(void)
131 { 123 {
132 X509_EXTENSION *ret=NULL; 124 X509_EXTENSION *ret=NULL;
125 ASN1_CTX c;
133 126
134 M_ASN1_New_Malloc(ret,X509_EXTENSION); 127 M_ASN1_New_Malloc(ret,X509_EXTENSION);
135 M_ASN1_New(ret->object,ASN1_OBJECT_new); 128 ret->object=OBJ_nid2obj(NID_undef);
136 M_ASN1_New(ret->value,ASN1_OCTET_STRING_new); 129 M_ASN1_New(ret->value,ASN1_OCTET_STRING_new);
137 ret->critical=0; 130 ret->critical=0;
138 ret->netscape_hack=0; 131 ret->netscape_hack=0;
@@ -143,8 +136,7 @@ X509_EXTENSION *X509_EXTENSION_new()
143 M_ASN1_New_Error(ASN1_F_X509_EXTENSION_NEW); 136 M_ASN1_New_Error(ASN1_F_X509_EXTENSION_NEW);
144 } 137 }
145 138
146void X509_EXTENSION_free(a) 139void X509_EXTENSION_free(X509_EXTENSION *a)
147X509_EXTENSION *a;
148 { 140 {
149 if (a == NULL) return; 141 if (a == NULL) return;
150 if ((a->argp != NULL) && (a->ex_free != NULL)) 142 if ((a->argp != NULL) && (a->ex_free != NULL))
diff --git a/src/lib/libcrypto/asn1/x_info.c b/src/lib/libcrypto/asn1/x_info.c
index b55f0ce77a..99ce011f07 100644
--- a/src/lib/libcrypto/asn1/x_info.c
+++ b/src/lib/libcrypto/asn1/x_info.c
@@ -58,11 +58,11 @@
58 58
59#include <stdio.h> 59#include <stdio.h>
60#include "cryptlib.h" 60#include "cryptlib.h"
61#include "evp.h" 61#include <openssl/evp.h>
62#include "asn1_mac.h" 62#include <openssl/asn1_mac.h>
63#include "x509.h" 63#include <openssl/x509.h>
64 64
65X509_INFO *X509_INFO_new() 65X509_INFO *X509_INFO_new(void)
66 { 66 {
67 X509_INFO *ret=NULL; 67 X509_INFO *ret=NULL;
68 68
@@ -84,8 +84,7 @@ X509_INFO *X509_INFO_new()
84 return(ret); 84 return(ret);
85 } 85 }
86 86
87void X509_INFO_free(x) 87void X509_INFO_free(X509_INFO *x)
88X509_INFO *x;
89 { 88 {
90 int i; 89 int i;
91 90
@@ -109,3 +108,6 @@ X509_INFO *x;
109 if (x->x_pkey != NULL) X509_PKEY_free(x->x_pkey); 108 if (x->x_pkey != NULL) X509_PKEY_free(x->x_pkey);
110 Free((char *)x); 109 Free((char *)x);
111 } 110 }
111
112IMPLEMENT_STACK_OF(X509_INFO)
113
diff --git a/src/lib/libcrypto/asn1/x_name.c b/src/lib/libcrypto/asn1/x_name.c
index 28b9c34b58..b09fba33fb 100644
--- a/src/lib/libcrypto/asn1/x_name.c
+++ b/src/lib/libcrypto/asn1/x_name.c
@@ -58,25 +58,12 @@
58 58
59#include <stdio.h> 59#include <stdio.h>
60#include "cryptlib.h" 60#include "cryptlib.h"
61#include "objects.h" 61#include <openssl/objects.h>
62#include "asn1_mac.h" 62#include <openssl/asn1_mac.h>
63 63#include <openssl/x509.h>
64/*
65 * ASN1err(ASN1_F_D2I_X509_NAME,ASN1_R_LENGTH_MISMATCH);
66 * ASN1err(ASN1_F_X509_NAME_NEW,ASN1_R_UNKNOWN_ATTRIBUTE_TYPE);
67 * ASN1err(ASN1_F_D2I_X509_NAME_ENTRY,ASN1_R_LENGTH_MISMATCH);
68 * ASN1err(ASN1_F_X509_NAME_ENTRY_NEW,ASN1_R_UNKNOWN_ATTRIBUTE_TYPE);
69 */
70 64
71#ifndef NOPROTO
72static int i2d_X509_NAME_entries(X509_NAME *a); 65static int i2d_X509_NAME_entries(X509_NAME *a);
73#else 66int i2d_X509_NAME_ENTRY(X509_NAME_ENTRY *a, unsigned char **pp)
74static int i2d_X509_NAME_entries();
75#endif
76
77int i2d_X509_NAME_ENTRY(a,pp)
78X509_NAME_ENTRY *a;
79unsigned char **pp;
80 { 67 {
81 M_ASN1_I2D_vars(a); 68 M_ASN1_I2D_vars(a);
82 69
@@ -91,10 +78,8 @@ unsigned char **pp;
91 M_ASN1_I2D_finish(); 78 M_ASN1_I2D_finish();
92 } 79 }
93 80
94X509_NAME_ENTRY *d2i_X509_NAME_ENTRY(a,pp,length) 81X509_NAME_ENTRY *d2i_X509_NAME_ENTRY(X509_NAME_ENTRY **a, unsigned char **pp,
95X509_NAME_ENTRY **a; 82 long length)
96unsigned char **pp;
97long length;
98 { 83 {
99 M_ASN1_D2I_vars(a,X509_NAME_ENTRY *,X509_NAME_ENTRY_new); 84 M_ASN1_D2I_vars(a,X509_NAME_ENTRY *,X509_NAME_ENTRY_new);
100 85
@@ -106,9 +91,7 @@ long length;
106 M_ASN1_D2I_Finish(a,X509_NAME_ENTRY_free,ASN1_F_D2I_X509_NAME_ENTRY); 91 M_ASN1_D2I_Finish(a,X509_NAME_ENTRY_free,ASN1_F_D2I_X509_NAME_ENTRY);
107 } 92 }
108 93
109int i2d_X509_NAME(a,pp) 94int i2d_X509_NAME(X509_NAME *a, unsigned char **pp)
110X509_NAME *a;
111unsigned char **pp;
112 { 95 {
113 int ret; 96 int ret;
114 97
@@ -128,11 +111,10 @@ unsigned char **pp;
128 return(ret); 111 return(ret);
129 } 112 }
130 113
131static int i2d_X509_NAME_entries(a) 114static int i2d_X509_NAME_entries(X509_NAME *a)
132X509_NAME *a;
133 { 115 {
134 X509_NAME_ENTRY *ne,*fe=NULL; 116 X509_NAME_ENTRY *ne,*fe=NULL;
135 STACK *sk; 117 STACK_OF(X509_NAME_ENTRY) *sk;
136 BUF_MEM *buf=NULL; 118 BUF_MEM *buf=NULL;
137 int set=0,r,ret=0; 119 int set=0,r,ret=0;
138 int i; 120 int i;
@@ -140,9 +122,9 @@ X509_NAME *a;
140 int size=0; 122 int size=0;
141 123
142 sk=a->entries; 124 sk=a->entries;
143 for (i=0; i<sk_num(sk); i++) 125 for (i=0; i<sk_X509_NAME_ENTRY_num(sk); i++)
144 { 126 {
145 ne=(X509_NAME_ENTRY *)sk_value(sk,i); 127 ne=sk_X509_NAME_ENTRY_value(sk,i);
146 if (fe == NULL) 128 if (fe == NULL)
147 { 129 {
148 fe=ne; 130 fe=ne;
@@ -173,9 +155,9 @@ X509_NAME *a;
173 ASN1_put_object(&p,1,ret,V_ASN1_SEQUENCE,V_ASN1_UNIVERSAL); 155 ASN1_put_object(&p,1,ret,V_ASN1_SEQUENCE,V_ASN1_UNIVERSAL);
174 156
175 set= -1; 157 set= -1;
176 for (i=0; i<sk_num(sk); i++) 158 for (i=0; i<sk_X509_NAME_ENTRY_num(sk); i++)
177 { 159 {
178 ne=(X509_NAME_ENTRY *)sk_value(sk,i); 160 ne=sk_X509_NAME_ENTRY_value(sk,i);
179 if (set != ne->set) 161 if (set != ne->set)
180 { 162 {
181 set=ne->set; 163 set=ne->set;
@@ -190,10 +172,7 @@ err:
190 return(-1); 172 return(-1);
191 } 173 }
192 174
193X509_NAME *d2i_X509_NAME(a,pp,length) 175X509_NAME *d2i_X509_NAME(X509_NAME **a, unsigned char **pp, long length)
194X509_NAME **a;
195unsigned char **pp;
196long length;
197 { 176 {
198 int set=0,i; 177 int set=0,i;
199 int idx=0; 178 int idx=0;
@@ -201,11 +180,11 @@ long length;
201 M_ASN1_D2I_vars(a,X509_NAME *,X509_NAME_new); 180 M_ASN1_D2I_vars(a,X509_NAME *,X509_NAME_new);
202 181
203 orig= *pp; 182 orig= *pp;
204 if (sk_num(ret->entries) > 0) 183 if (sk_X509_NAME_ENTRY_num(ret->entries) > 0)
205 { 184 {
206 while (sk_num(ret->entries) > 0) 185 while (sk_X509_NAME_ENTRY_num(ret->entries) > 0)
207 X509_NAME_ENTRY_free((X509_NAME_ENTRY *) 186 X509_NAME_ENTRY_free(
208 sk_pop(ret->entries)); 187 sk_X509_NAME_ENTRY_pop(ret->entries));
209 } 188 }
210 189
211 M_ASN1_D2I_Init(); 190 M_ASN1_D2I_Init();
@@ -213,11 +192,12 @@ long length;
213 for (;;) 192 for (;;)
214 { 193 {
215 if (M_ASN1_D2I_end_sequence()) break; 194 if (M_ASN1_D2I_end_sequence()) break;
216 M_ASN1_D2I_get_set(ret->entries,d2i_X509_NAME_ENTRY); 195 M_ASN1_D2I_get_set_type(X509_NAME_ENTRY,ret->entries,
217 for (; idx < sk_num(ret->entries); idx++) 196 d2i_X509_NAME_ENTRY,
197 X509_NAME_ENTRY_free);
198 for (; idx < sk_X509_NAME_ENTRY_num(ret->entries); idx++)
218 { 199 {
219 ((X509_NAME_ENTRY *)sk_value(ret->entries,idx))->set= 200 sk_X509_NAME_ENTRY_value(ret->entries,idx)->set=set;
220 set;
221 } 201 }
222 set++; 202 set++;
223 } 203 }
@@ -231,21 +211,24 @@ long length;
231 M_ASN1_D2I_Finish(a,X509_NAME_free,ASN1_F_D2I_X509_NAME); 211 M_ASN1_D2I_Finish(a,X509_NAME_free,ASN1_F_D2I_X509_NAME);
232 } 212 }
233 213
234X509_NAME *X509_NAME_new() 214X509_NAME *X509_NAME_new(void)
235 { 215 {
236 X509_NAME *ret=NULL; 216 X509_NAME *ret=NULL;
217 ASN1_CTX c;
237 218
238 M_ASN1_New_Malloc(ret,X509_NAME); 219 M_ASN1_New_Malloc(ret,X509_NAME);
239 if ((ret->entries=sk_new(NULL)) == NULL) goto err2; 220 if ((ret->entries=sk_X509_NAME_ENTRY_new(NULL)) == NULL)
221 { c.line=__LINE__; goto err2; }
240 M_ASN1_New(ret->bytes,BUF_MEM_new); 222 M_ASN1_New(ret->bytes,BUF_MEM_new);
241 ret->modified=1; 223 ret->modified=1;
242 return(ret); 224 return(ret);
243 M_ASN1_New_Error(ASN1_F_X509_NAME_NEW); 225 M_ASN1_New_Error(ASN1_F_X509_NAME_NEW);
244 } 226 }
245 227
246X509_NAME_ENTRY *X509_NAME_ENTRY_new() 228X509_NAME_ENTRY *X509_NAME_ENTRY_new(void)
247 { 229 {
248 X509_NAME_ENTRY *ret=NULL; 230 X509_NAME_ENTRY *ret=NULL;
231 ASN1_CTX c;
249 232
250 M_ASN1_New_Malloc(ret,X509_NAME_ENTRY); 233 M_ASN1_New_Malloc(ret,X509_NAME_ENTRY);
251/* M_ASN1_New(ret->object,ASN1_OBJECT_new);*/ 234/* M_ASN1_New(ret->object,ASN1_OBJECT_new);*/
@@ -256,26 +239,25 @@ X509_NAME_ENTRY *X509_NAME_ENTRY_new()
256 M_ASN1_New_Error(ASN1_F_X509_NAME_ENTRY_NEW); 239 M_ASN1_New_Error(ASN1_F_X509_NAME_ENTRY_NEW);
257 } 240 }
258 241
259void X509_NAME_free(a) 242void X509_NAME_free(X509_NAME *a)
260X509_NAME *a;
261 { 243 {
244 if(a == NULL)
245 return;
246
262 BUF_MEM_free(a->bytes); 247 BUF_MEM_free(a->bytes);
263 sk_pop_free(a->entries,X509_NAME_ENTRY_free); 248 sk_X509_NAME_ENTRY_pop_free(a->entries,X509_NAME_ENTRY_free);
264 Free((char *)a); 249 Free(a);
265 } 250 }
266 251
267void X509_NAME_ENTRY_free(a) 252void X509_NAME_ENTRY_free(X509_NAME_ENTRY *a)
268X509_NAME_ENTRY *a;
269 { 253 {
270 if (a == NULL) return; 254 if (a == NULL) return;
271 ASN1_OBJECT_free(a->object); 255 ASN1_OBJECT_free(a->object);
272 ASN1_BIT_STRING_free(a->value); 256 ASN1_BIT_STRING_free(a->value);
273 Free((char *)a); 257 Free(a);
274 } 258 }
275 259
276int X509_NAME_set(xn,name) 260int X509_NAME_set(X509_NAME **xn, X509_NAME *name)
277X509_NAME **xn;
278X509_NAME *name;
279 { 261 {
280 X509_NAME *in; 262 X509_NAME *in;
281 263
@@ -293,3 +275,5 @@ X509_NAME *name;
293 return(*xn != NULL); 275 return(*xn != NULL);
294 } 276 }
295 277
278IMPLEMENT_STACK_OF(X509_NAME_ENTRY)
279IMPLEMENT_ASN1_SET_OF(X509_NAME_ENTRY)
diff --git a/src/lib/libcrypto/asn1/x_pkey.c b/src/lib/libcrypto/asn1/x_pkey.c
index 1d4d926129..b0057eb212 100644
--- a/src/lib/libcrypto/asn1/x_pkey.c
+++ b/src/lib/libcrypto/asn1/x_pkey.c
@@ -58,25 +58,18 @@
58 58
59#include <stdio.h> 59#include <stdio.h>
60#include "cryptlib.h" 60#include "cryptlib.h"
61#include "evp.h" 61#include <openssl/evp.h>
62#include "objects.h" 62#include <openssl/objects.h>
63#include "asn1_mac.h" 63#include <openssl/asn1_mac.h>
64 64#include <openssl/x509.h>
65/* ASN1err(ASN1_F_D2I_X509_PKEY,ASN1_R_UNSUPPORTED_CIPHER); */
66/* ASN1err(ASN1_F_X509_PKEY_NEW,ASN1_R_IV_TOO_LARGE); */
67 65
68/* need to implement */ 66/* need to implement */
69int i2d_X509_PKEY(a,pp) 67int i2d_X509_PKEY(X509_PKEY *a, unsigned char **pp)
70X509_PKEY *a;
71unsigned char **pp;
72 { 68 {
73 return(0); 69 return(0);
74 } 70 }
75 71
76X509_PKEY *d2i_X509_PKEY(a,pp,length) 72X509_PKEY *d2i_X509_PKEY(X509_PKEY **a, unsigned char **pp, long length)
77X509_PKEY **a;
78unsigned char **pp;
79long length;
80 { 73 {
81 int i; 74 int i;
82 M_ASN1_D2I_vars(a,X509_PKEY *,X509_PKEY_new); 75 M_ASN1_D2I_vars(a,X509_PKEY *,X509_PKEY_new);
@@ -91,6 +84,7 @@ long length;
91 if (ret->cipher.cipher == NULL) 84 if (ret->cipher.cipher == NULL)
92 { 85 {
93 c.error=ASN1_R_UNSUPPORTED_CIPHER; 86 c.error=ASN1_R_UNSUPPORTED_CIPHER;
87 c.line=__LINE__;
94 goto err; 88 goto err;
95 } 89 }
96 if (ret->enc_algor->parameter->type == V_ASN1_OCTET_STRING) 90 if (ret->enc_algor->parameter->type == V_ASN1_OCTET_STRING)
@@ -99,6 +93,7 @@ long length;
99 if (i > EVP_MAX_IV_LENGTH) 93 if (i > EVP_MAX_IV_LENGTH)
100 { 94 {
101 c.error=ASN1_R_IV_TOO_LARGE; 95 c.error=ASN1_R_IV_TOO_LARGE;
96 c.line=__LINE__;
102 goto err; 97 goto err;
103 } 98 }
104 memcpy(ret->cipher.iv, 99 memcpy(ret->cipher.iv,
@@ -109,9 +104,10 @@ long length;
109 M_ASN1_D2I_Finish(a,X509_PKEY_free,ASN1_F_D2I_X509_PKEY); 104 M_ASN1_D2I_Finish(a,X509_PKEY_free,ASN1_F_D2I_X509_PKEY);
110 } 105 }
111 106
112X509_PKEY *X509_PKEY_new() 107X509_PKEY *X509_PKEY_new(void)
113 { 108 {
114 X509_PKEY *ret=NULL; 109 X509_PKEY *ret=NULL;
110 ASN1_CTX c;
115 111
116 M_ASN1_New_Malloc(ret,X509_PKEY); 112 M_ASN1_New_Malloc(ret,X509_PKEY);
117 ret->version=0; 113 ret->version=0;
@@ -128,8 +124,7 @@ X509_PKEY *X509_PKEY_new()
128 M_ASN1_New_Error(ASN1_F_X509_PKEY_NEW); 124 M_ASN1_New_Error(ASN1_F_X509_PKEY_NEW);
129 } 125 }
130 126
131void X509_PKEY_free(x) 127void X509_PKEY_free(X509_PKEY *x)
132X509_PKEY *x;
133 { 128 {
134 int i; 129 int i;
135 130
diff --git a/src/lib/libcrypto/asn1/x_pubkey.c b/src/lib/libcrypto/asn1/x_pubkey.c
index a309cf74a7..4ac32c59dd 100644
--- a/src/lib/libcrypto/asn1/x_pubkey.c
+++ b/src/lib/libcrypto/asn1/x_pubkey.c
@@ -58,16 +58,10 @@
58 58
59#include <stdio.h> 59#include <stdio.h>
60#include "cryptlib.h" 60#include "cryptlib.h"
61#include "asn1_mac.h" 61#include <openssl/asn1_mac.h>
62#include <openssl/x509.h>
62 63
63/* 64int i2d_X509_PUBKEY(X509_PUBKEY *a, unsigned char **pp)
64 * ASN1err(ASN1_F_D2I_X509_PUBKEY,ASN1_R_LENGTH_MISMATCH);
65 * ASN1err(ASN1_F_X509_PUBKEY_NEW,ASN1_R_LENGTH_MISMATCH);
66 */
67
68int i2d_X509_PUBKEY(a,pp)
69X509_PUBKEY *a;
70unsigned char **pp;
71 { 65 {
72 M_ASN1_I2D_vars(a); 66 M_ASN1_I2D_vars(a);
73 67
@@ -82,10 +76,8 @@ unsigned char **pp;
82 M_ASN1_I2D_finish(); 76 M_ASN1_I2D_finish();
83 } 77 }
84 78
85X509_PUBKEY *d2i_X509_PUBKEY(a,pp,length) 79X509_PUBKEY *d2i_X509_PUBKEY(X509_PUBKEY **a, unsigned char **pp,
86X509_PUBKEY **a; 80 long length)
87unsigned char **pp;
88long length;
89 { 81 {
90 M_ASN1_D2I_vars(a,X509_PUBKEY *,X509_PUBKEY_new); 82 M_ASN1_D2I_vars(a,X509_PUBKEY *,X509_PUBKEY_new);
91 83
@@ -101,9 +93,10 @@ long length;
101 M_ASN1_D2I_Finish(a,X509_PUBKEY_free,ASN1_F_D2I_X509_PUBKEY); 93 M_ASN1_D2I_Finish(a,X509_PUBKEY_free,ASN1_F_D2I_X509_PUBKEY);
102 } 94 }
103 95
104X509_PUBKEY *X509_PUBKEY_new() 96X509_PUBKEY *X509_PUBKEY_new(void)
105 { 97 {
106 X509_PUBKEY *ret=NULL; 98 X509_PUBKEY *ret=NULL;
99 ASN1_CTX c;
107 100
108 M_ASN1_New_Malloc(ret,X509_PUBKEY); 101 M_ASN1_New_Malloc(ret,X509_PUBKEY);
109 M_ASN1_New(ret->algor,X509_ALGOR_new); 102 M_ASN1_New(ret->algor,X509_ALGOR_new);
@@ -113,8 +106,7 @@ X509_PUBKEY *X509_PUBKEY_new()
113 M_ASN1_New_Error(ASN1_F_X509_PUBKEY_NEW); 106 M_ASN1_New_Error(ASN1_F_X509_PUBKEY_NEW);
114 } 107 }
115 108
116void X509_PUBKEY_free(a) 109void X509_PUBKEY_free(X509_PUBKEY *a)
117X509_PUBKEY *a;
118 { 110 {
119 if (a == NULL) return; 111 if (a == NULL) return;
120 X509_ALGOR_free(a->algor); 112 X509_ALGOR_free(a->algor);
@@ -123,9 +115,7 @@ X509_PUBKEY *a;
123 Free((char *)a); 115 Free((char *)a);
124 } 116 }
125 117
126int X509_PUBKEY_set(x,pkey) 118int X509_PUBKEY_set(X509_PUBKEY **x, EVP_PKEY *pkey)
127X509_PUBKEY **x;
128EVP_PKEY *pkey;
129 { 119 {
130 int ok=0; 120 int ok=0;
131 X509_PUBKEY *pk; 121 X509_PUBKEY *pk;
@@ -182,11 +172,15 @@ EVP_PKEY *pkey;
182 goto err; 172 goto err;
183 } 173 }
184 174
185 i=i2d_PublicKey(pkey,NULL); 175 if ((i=i2d_PublicKey(pkey,NULL)) <= 0) goto err;
186 if ((s=(unsigned char *)Malloc(i+1)) == NULL) goto err; 176 if ((s=(unsigned char *)Malloc(i+1)) == NULL) goto err;
187 p=s; 177 p=s;
188 i2d_PublicKey(pkey,&p); 178 i2d_PublicKey(pkey,&p);
189 if (!ASN1_BIT_STRING_set(pk->public_key,s,i)) goto err; 179 if (!ASN1_BIT_STRING_set(pk->public_key,s,i)) goto err;
180 /* Set number of unused bits to zero */
181 pk->public_key->flags&= ~(ASN1_STRING_FLAG_BITS_LEFT|0x07);
182 pk->public_key->flags|=ASN1_STRING_FLAG_BITS_LEFT;
183
190 Free(s); 184 Free(s);
191 185
192 CRYPTO_add(&pkey->references,1,CRYPTO_LOCK_EVP_PKEY); 186 CRYPTO_add(&pkey->references,1,CRYPTO_LOCK_EVP_PKEY);
@@ -204,8 +198,7 @@ err:
204 return(ok); 198 return(ok);
205 } 199 }
206 200
207EVP_PKEY *X509_PUBKEY_get(key) 201EVP_PKEY *X509_PUBKEY_get(X509_PUBKEY *key)
208X509_PUBKEY *key;
209 { 202 {
210 EVP_PKEY *ret=NULL; 203 EVP_PKEY *ret=NULL;
211 long j; 204 long j;
@@ -217,7 +210,11 @@ X509_PUBKEY *key;
217 210
218 if (key == NULL) goto err; 211 if (key == NULL) goto err;
219 212
220 if (key->pkey != NULL) return(key->pkey); 213 if (key->pkey != NULL)
214 {
215 CRYPTO_add(&key->pkey->references,1,CRYPTO_LOCK_EVP_PKEY);
216 return(key->pkey);
217 }
221 218
222 if (key->public_key == NULL) goto err; 219 if (key->public_key == NULL) goto err;
223 220
@@ -247,6 +244,7 @@ X509_PUBKEY *key;
247 } 244 }
248#endif 245#endif
249 key->pkey=ret; 246 key->pkey=ret;
247 CRYPTO_add(&ret->references,1,CRYPTO_LOCK_EVP_PKEY);
250 return(ret); 248 return(ret);
251err: 249err:
252 if (ret != NULL) 250 if (ret != NULL)
diff --git a/src/lib/libcrypto/asn1/x_req.c b/src/lib/libcrypto/asn1/x_req.c
index ff0be13d37..9b1d6abe64 100644
--- a/src/lib/libcrypto/asn1/x_req.c
+++ b/src/lib/libcrypto/asn1/x_req.c
@@ -58,19 +58,10 @@
58 58
59#include <stdio.h> 59#include <stdio.h>
60#include "cryptlib.h" 60#include "cryptlib.h"
61#include "asn1_mac.h" 61#include <openssl/asn1_mac.h>
62#include "x509.h" 62#include <openssl/x509.h>
63
64/*
65 * ASN1err(ASN1_F_D2I_X509_REQ,ASN1_R_LENGTH_MISMATCH);
66 * ASN1err(ASN1_F_D2I_X509_REQ_INFO,ASN1_R_LENGTH_MISMATCH);
67 * ASN1err(ASN1_F_X509_REQ_NEW,ASN1_R_LENGTH_MISMATCH);
68 * ASN1err(ASN1_F_X509_REQ_INFO_NEW,ASN1_R_LENGTH_MISMATCH);
69 */
70 63
71int i2d_X509_REQ_INFO(a,pp) 64int i2d_X509_REQ_INFO(X509_REQ_INFO *a, unsigned char **pp)
72X509_REQ_INFO *a;
73unsigned char **pp;
74 { 65 {
75 M_ASN1_I2D_vars(a); 66 M_ASN1_I2D_vars(a);
76 67
@@ -87,11 +78,12 @@ unsigned char **pp;
87 */ 78 */
88 if (a->req_kludge) 79 if (a->req_kludge)
89 { 80 {
90 M_ASN1_I2D_len_IMP_set_opt(a->attributes,i2d_X509_ATTRIBUTE,0); 81 M_ASN1_I2D_len_IMP_SET_opt_type(X509_ATTRIBUTE,a->attributes,i2d_X509_ATTRIBUTE,0);
91 } 82 }
92 else 83 else
93 { 84 {
94 M_ASN1_I2D_len_IMP_set(a->attributes, i2d_X509_ATTRIBUTE,0); 85 M_ASN1_I2D_len_IMP_SET_type(X509_ATTRIBUTE,a->attributes,
86 i2d_X509_ATTRIBUTE,0);
95 } 87 }
96 88
97 M_ASN1_I2D_seq_total(); 89 M_ASN1_I2D_seq_total();
@@ -107,20 +99,20 @@ unsigned char **pp;
107 */ 99 */
108 if (a->req_kludge) 100 if (a->req_kludge)
109 { 101 {
110 M_ASN1_I2D_put_IMP_set_opt(a->attributes,i2d_X509_ATTRIBUTE,0); 102 M_ASN1_I2D_put_IMP_SET_opt_type(X509_ATTRIBUTE,a->attributes,
103 i2d_X509_ATTRIBUTE,0);
111 } 104 }
112 else 105 else
113 { 106 {
114 M_ASN1_I2D_put_IMP_set(a->attributes,i2d_X509_ATTRIBUTE,0); 107 M_ASN1_I2D_put_IMP_SET_type(X509_ATTRIBUTE,a->attributes,
108 i2d_X509_ATTRIBUTE,0);
115 } 109 }
116 110
117 M_ASN1_I2D_finish(); 111 M_ASN1_I2D_finish();
118 } 112 }
119 113
120X509_REQ_INFO *d2i_X509_REQ_INFO(a,pp,length) 114X509_REQ_INFO *d2i_X509_REQ_INFO(X509_REQ_INFO **a, unsigned char **pp,
121X509_REQ_INFO **a; 115 long length)
122unsigned char **pp;
123long length;
124 { 116 {
125 M_ASN1_D2I_vars(a,X509_REQ_INFO *,X509_REQ_INFO_new); 117 M_ASN1_D2I_vars(a,X509_REQ_INFO *,X509_REQ_INFO_new);
126 118
@@ -141,40 +133,40 @@ long length;
141 ret->req_kludge=1; 133 ret->req_kludge=1;
142 else 134 else
143 { 135 {
144 M_ASN1_D2I_get_IMP_set(ret->attributes,d2i_X509_ATTRIBUTE,0); 136 M_ASN1_D2I_get_IMP_set_type(X509_ATTRIBUTE,ret->attributes,
137 d2i_X509_ATTRIBUTE,
138 X509_ATTRIBUTE_free,0);
145 } 139 }
146 140
147 M_ASN1_D2I_Finish(a,X509_REQ_INFO_free,ASN1_F_D2I_X509_REQ_INFO); 141 M_ASN1_D2I_Finish(a,X509_REQ_INFO_free,ASN1_F_D2I_X509_REQ_INFO);
148 } 142 }
149 143
150X509_REQ_INFO *X509_REQ_INFO_new() 144X509_REQ_INFO *X509_REQ_INFO_new(void)
151 { 145 {
152 X509_REQ_INFO *ret=NULL; 146 X509_REQ_INFO *ret=NULL;
147 ASN1_CTX c;
153 148
154 M_ASN1_New_Malloc(ret,X509_REQ_INFO); 149 M_ASN1_New_Malloc(ret,X509_REQ_INFO);
155 M_ASN1_New(ret->version,ASN1_INTEGER_new); 150 M_ASN1_New(ret->version,ASN1_INTEGER_new);
156 M_ASN1_New(ret->subject,X509_NAME_new); 151 M_ASN1_New(ret->subject,X509_NAME_new);
157 M_ASN1_New(ret->pubkey,X509_PUBKEY_new); 152 M_ASN1_New(ret->pubkey,X509_PUBKEY_new);
158 M_ASN1_New(ret->attributes,sk_new_null); 153 M_ASN1_New(ret->attributes,sk_X509_ATTRIBUTE_new_null);
159 ret->req_kludge=0; 154 ret->req_kludge=0;
160 return(ret); 155 return(ret);
161 M_ASN1_New_Error(ASN1_F_X509_REQ_INFO_NEW); 156 M_ASN1_New_Error(ASN1_F_X509_REQ_INFO_NEW);
162 } 157 }
163 158
164void X509_REQ_INFO_free(a) 159void X509_REQ_INFO_free(X509_REQ_INFO *a)
165X509_REQ_INFO *a;
166 { 160 {
167 if (a == NULL) return; 161 if (a == NULL) return;
168 ASN1_INTEGER_free(a->version); 162 ASN1_INTEGER_free(a->version);
169 X509_NAME_free(a->subject); 163 X509_NAME_free(a->subject);
170 X509_PUBKEY_free(a->pubkey); 164 X509_PUBKEY_free(a->pubkey);
171 sk_pop_free(a->attributes,X509_ATTRIBUTE_free); 165 sk_X509_ATTRIBUTE_pop_free(a->attributes,X509_ATTRIBUTE_free);
172 Free((char *)a); 166 Free((char *)a);
173 } 167 }
174 168
175int i2d_X509_REQ(a,pp) 169int i2d_X509_REQ(X509_REQ *a, unsigned char **pp)
176X509_REQ *a;
177unsigned char **pp;
178 { 170 {
179 M_ASN1_I2D_vars(a); 171 M_ASN1_I2D_vars(a);
180 M_ASN1_I2D_len(a->req_info, i2d_X509_REQ_INFO); 172 M_ASN1_I2D_len(a->req_info, i2d_X509_REQ_INFO);
@@ -190,10 +182,7 @@ unsigned char **pp;
190 M_ASN1_I2D_finish(); 182 M_ASN1_I2D_finish();
191 } 183 }
192 184
193X509_REQ *d2i_X509_REQ(a,pp,length) 185X509_REQ *d2i_X509_REQ(X509_REQ **a, unsigned char **pp, long length)
194X509_REQ **a;
195unsigned char **pp;
196long length;
197 { 186 {
198 M_ASN1_D2I_vars(a,X509_REQ *,X509_REQ_new); 187 M_ASN1_D2I_vars(a,X509_REQ *,X509_REQ_new);
199 188
@@ -205,9 +194,10 @@ long length;
205 M_ASN1_D2I_Finish(a,X509_REQ_free,ASN1_F_D2I_X509_REQ); 194 M_ASN1_D2I_Finish(a,X509_REQ_free,ASN1_F_D2I_X509_REQ);
206 } 195 }
207 196
208X509_REQ *X509_REQ_new() 197X509_REQ *X509_REQ_new(void)
209 { 198 {
210 X509_REQ *ret=NULL; 199 X509_REQ *ret=NULL;
200 ASN1_CTX c;
211 201
212 M_ASN1_New_Malloc(ret,X509_REQ); 202 M_ASN1_New_Malloc(ret,X509_REQ);
213 ret->references=1; 203 ret->references=1;
@@ -218,8 +208,7 @@ X509_REQ *X509_REQ_new()
218 M_ASN1_New_Error(ASN1_F_X509_REQ_NEW); 208 M_ASN1_New_Error(ASN1_F_X509_REQ_NEW);
219 } 209 }
220 210
221void X509_REQ_free(a) 211void X509_REQ_free(X509_REQ *a)
222X509_REQ *a;
223 { 212 {
224 int i; 213 int i;
225 214
diff --git a/src/lib/libcrypto/asn1/x_sig.c b/src/lib/libcrypto/asn1/x_sig.c
index f0a2e4c27a..c2782d1b9c 100644
--- a/src/lib/libcrypto/asn1/x_sig.c
+++ b/src/lib/libcrypto/asn1/x_sig.c
@@ -58,16 +58,10 @@
58 58
59#include <stdio.h> 59#include <stdio.h>
60#include "cryptlib.h" 60#include "cryptlib.h"
61#include "asn1_mac.h" 61#include <openssl/asn1_mac.h>
62#include <openssl/x509.h>
62 63
63/* 64int i2d_X509_SIG(X509_SIG *a, unsigned char **pp)
64 * ASN1err(ASN1_F_D2I_X509_SIG,ASN1_R_LENGTH_MISMATCH);
65 * ASN1err(ASN1_F_X509_SIG_NEW,ASN1_R_LENGTH_MISMATCH);
66 */
67
68int i2d_X509_SIG(a,pp)
69X509_SIG *a;
70unsigned char **pp;
71 { 65 {
72 M_ASN1_I2D_vars(a); 66 M_ASN1_I2D_vars(a);
73 67
@@ -82,10 +76,7 @@ unsigned char **pp;
82 M_ASN1_I2D_finish(); 76 M_ASN1_I2D_finish();
83 } 77 }
84 78
85X509_SIG *d2i_X509_SIG(a,pp,length) 79X509_SIG *d2i_X509_SIG(X509_SIG **a, unsigned char **pp, long length)
86X509_SIG **a;
87unsigned char **pp;
88long length;
89 { 80 {
90 M_ASN1_D2I_vars(a,X509_SIG *,X509_SIG_new); 81 M_ASN1_D2I_vars(a,X509_SIG *,X509_SIG_new);
91 82
@@ -96,9 +87,10 @@ long length;
96 M_ASN1_D2I_Finish(a,X509_SIG_free,ASN1_F_D2I_X509_SIG); 87 M_ASN1_D2I_Finish(a,X509_SIG_free,ASN1_F_D2I_X509_SIG);
97 } 88 }
98 89
99X509_SIG *X509_SIG_new() 90X509_SIG *X509_SIG_new(void)
100 { 91 {
101 X509_SIG *ret=NULL; 92 X509_SIG *ret=NULL;
93 ASN1_CTX c;
102 94
103 M_ASN1_New_Malloc(ret,X509_SIG); 95 M_ASN1_New_Malloc(ret,X509_SIG);
104 M_ASN1_New(ret->algor,X509_ALGOR_new); 96 M_ASN1_New(ret->algor,X509_ALGOR_new);
@@ -107,8 +99,7 @@ X509_SIG *X509_SIG_new()
107 M_ASN1_New_Error(ASN1_F_X509_SIG_NEW); 99 M_ASN1_New_Error(ASN1_F_X509_SIG_NEW);
108 } 100 }
109 101
110void X509_SIG_free(a) 102void X509_SIG_free(X509_SIG *a)
111X509_SIG *a;
112 { 103 {
113 if (a == NULL) return; 104 if (a == NULL) return;
114 X509_ALGOR_free(a->algor); 105 X509_ALGOR_free(a->algor);
diff --git a/src/lib/libcrypto/asn1/x_spki.c b/src/lib/libcrypto/asn1/x_spki.c
index 4a80df44b8..43e0023839 100644
--- a/src/lib/libcrypto/asn1/x_spki.c
+++ b/src/lib/libcrypto/asn1/x_spki.c
@@ -62,19 +62,10 @@
62 62
63#include <stdio.h> 63#include <stdio.h>
64#include "cryptlib.h" 64#include "cryptlib.h"
65#include "x509.h" 65#include <openssl/x509.h>
66#include "asn1_mac.h" 66#include <openssl/asn1_mac.h>
67
68/*
69 * ASN1err(ASN1_F_D2I_NETSCAPE_SPKAC,ASN1_R_LENGTH_MISMATCH);
70 * ASN1err(ASN1_F_NETSCAPE_SPKAC_NEW,ASN1_R_LENGTH_MISMATCH);
71 * ASN1err(ASN1_F_D2I_NETSCAPE_SPKI,ASN1_R_LENGTH_MISMATCH);
72 * ASN1err(ASN1_F_NETSCAPE_SPKI_NEW,ASN1_R_LENGTH_MISMATCH);
73 */
74 67
75int i2d_NETSCAPE_SPKAC(a,pp) 68int i2d_NETSCAPE_SPKAC(NETSCAPE_SPKAC *a, unsigned char **pp)
76NETSCAPE_SPKAC *a;
77unsigned char **pp;
78 { 69 {
79 M_ASN1_I2D_vars(a); 70 M_ASN1_I2D_vars(a);
80 71
@@ -89,10 +80,8 @@ unsigned char **pp;
89 M_ASN1_I2D_finish(); 80 M_ASN1_I2D_finish();
90 } 81 }
91 82
92NETSCAPE_SPKAC *d2i_NETSCAPE_SPKAC(a,pp,length) 83NETSCAPE_SPKAC *d2i_NETSCAPE_SPKAC(NETSCAPE_SPKAC **a, unsigned char **pp,
93NETSCAPE_SPKAC **a; 84 long length)
94unsigned char **pp;
95long length;
96 { 85 {
97 M_ASN1_D2I_vars(a,NETSCAPE_SPKAC *,NETSCAPE_SPKAC_new); 86 M_ASN1_D2I_vars(a,NETSCAPE_SPKAC *,NETSCAPE_SPKAC_new);
98 87
@@ -103,9 +92,10 @@ long length;
103 M_ASN1_D2I_Finish(a,NETSCAPE_SPKAC_free,ASN1_F_D2I_NETSCAPE_SPKAC); 92 M_ASN1_D2I_Finish(a,NETSCAPE_SPKAC_free,ASN1_F_D2I_NETSCAPE_SPKAC);
104 } 93 }
105 94
106NETSCAPE_SPKAC *NETSCAPE_SPKAC_new() 95NETSCAPE_SPKAC *NETSCAPE_SPKAC_new(void)
107 { 96 {
108 NETSCAPE_SPKAC *ret=NULL; 97 NETSCAPE_SPKAC *ret=NULL;
98 ASN1_CTX c;
109 99
110 M_ASN1_New_Malloc(ret,NETSCAPE_SPKAC); 100 M_ASN1_New_Malloc(ret,NETSCAPE_SPKAC);
111 M_ASN1_New(ret->pubkey,X509_PUBKEY_new); 101 M_ASN1_New(ret->pubkey,X509_PUBKEY_new);
@@ -114,8 +104,7 @@ NETSCAPE_SPKAC *NETSCAPE_SPKAC_new()
114 M_ASN1_New_Error(ASN1_F_NETSCAPE_SPKAC_NEW); 104 M_ASN1_New_Error(ASN1_F_NETSCAPE_SPKAC_NEW);
115 } 105 }
116 106
117void NETSCAPE_SPKAC_free(a) 107void NETSCAPE_SPKAC_free(NETSCAPE_SPKAC *a)
118NETSCAPE_SPKAC *a;
119 { 108 {
120 if (a == NULL) return; 109 if (a == NULL) return;
121 X509_PUBKEY_free(a->pubkey); 110 X509_PUBKEY_free(a->pubkey);
@@ -123,9 +112,7 @@ NETSCAPE_SPKAC *a;
123 Free((char *)a); 112 Free((char *)a);
124 } 113 }
125 114
126int i2d_NETSCAPE_SPKI(a,pp) 115int i2d_NETSCAPE_SPKI(NETSCAPE_SPKI *a, unsigned char **pp)
127NETSCAPE_SPKI *a;
128unsigned char **pp;
129 { 116 {
130 M_ASN1_I2D_vars(a); 117 M_ASN1_I2D_vars(a);
131 118
@@ -142,10 +129,8 @@ unsigned char **pp;
142 M_ASN1_I2D_finish(); 129 M_ASN1_I2D_finish();
143 } 130 }
144 131
145NETSCAPE_SPKI *d2i_NETSCAPE_SPKI(a,pp,length) 132NETSCAPE_SPKI *d2i_NETSCAPE_SPKI(NETSCAPE_SPKI **a, unsigned char **pp,
146NETSCAPE_SPKI **a; 133 long length)
147unsigned char **pp;
148long length;
149 { 134 {
150 M_ASN1_D2I_vars(a,NETSCAPE_SPKI *,NETSCAPE_SPKI_new); 135 M_ASN1_D2I_vars(a,NETSCAPE_SPKI *,NETSCAPE_SPKI_new);
151 136
@@ -157,9 +142,10 @@ long length;
157 M_ASN1_D2I_Finish(a,NETSCAPE_SPKI_free,ASN1_F_D2I_NETSCAPE_SPKI); 142 M_ASN1_D2I_Finish(a,NETSCAPE_SPKI_free,ASN1_F_D2I_NETSCAPE_SPKI);
158 } 143 }
159 144
160NETSCAPE_SPKI *NETSCAPE_SPKI_new() 145NETSCAPE_SPKI *NETSCAPE_SPKI_new(void)
161 { 146 {
162 NETSCAPE_SPKI *ret=NULL; 147 NETSCAPE_SPKI *ret=NULL;
148 ASN1_CTX c;
163 149
164 M_ASN1_New_Malloc(ret,NETSCAPE_SPKI); 150 M_ASN1_New_Malloc(ret,NETSCAPE_SPKI);
165 M_ASN1_New(ret->spkac,NETSCAPE_SPKAC_new); 151 M_ASN1_New(ret->spkac,NETSCAPE_SPKAC_new);
@@ -169,8 +155,7 @@ NETSCAPE_SPKI *NETSCAPE_SPKI_new()
169 M_ASN1_New_Error(ASN1_F_NETSCAPE_SPKI_NEW); 155 M_ASN1_New_Error(ASN1_F_NETSCAPE_SPKI_NEW);
170 } 156 }
171 157
172void NETSCAPE_SPKI_free(a) 158void NETSCAPE_SPKI_free(NETSCAPE_SPKI *a)
173NETSCAPE_SPKI *a;
174 { 159 {
175 if (a == NULL) return; 160 if (a == NULL) return;
176 NETSCAPE_SPKAC_free(a->spkac); 161 NETSCAPE_SPKAC_free(a->spkac);
diff --git a/src/lib/libcrypto/asn1/x_val.c b/src/lib/libcrypto/asn1/x_val.c
index a9c390f88c..84d6f7ca4d 100644
--- a/src/lib/libcrypto/asn1/x_val.c
+++ b/src/lib/libcrypto/asn1/x_val.c
@@ -58,61 +58,52 @@
58 58
59#include <stdio.h> 59#include <stdio.h>
60#include "cryptlib.h" 60#include "cryptlib.h"
61#include "asn1_mac.h" 61#include <openssl/asn1_mac.h>
62#include <openssl/x509.h>
62 63
63/* ASN1err(ASN1_F_X509_VAL_NEW,ERR_R_MALLOC_FAILURE); 64int i2d_X509_VAL(X509_VAL *a, unsigned char **pp)
64 * ASN1err(ASN1_F_X509_VAL_FREE,ERR_R_MALLOC_FAILURE);
65 * ASN1err(ASN1_F_D2I_X509_VAL,ERR_R_MALLOC_FAILURE);
66 */
67
68int i2d_X509_VAL(a,pp)
69X509_VAL *a;
70unsigned char **pp;
71 { 65 {
72 M_ASN1_I2D_vars(a); 66 M_ASN1_I2D_vars(a);
73 67
74 M_ASN1_I2D_len(a->notBefore,i2d_ASN1_UTCTIME); 68 M_ASN1_I2D_len(a->notBefore,i2d_ASN1_TIME);
75 M_ASN1_I2D_len(a->notAfter,i2d_ASN1_UTCTIME); 69 M_ASN1_I2D_len(a->notAfter,i2d_ASN1_TIME);
76 70
77 M_ASN1_I2D_seq_total(); 71 M_ASN1_I2D_seq_total();
78 72
79 M_ASN1_I2D_put(a->notBefore,i2d_ASN1_UTCTIME); 73 M_ASN1_I2D_put(a->notBefore,i2d_ASN1_TIME);
80 M_ASN1_I2D_put(a->notAfter,i2d_ASN1_UTCTIME); 74 M_ASN1_I2D_put(a->notAfter,i2d_ASN1_TIME);
81 75
82 M_ASN1_I2D_finish(); 76 M_ASN1_I2D_finish();
83 } 77 }
84 78
85X509_VAL *d2i_X509_VAL(a,pp,length) 79X509_VAL *d2i_X509_VAL(X509_VAL **a, unsigned char **pp, long length)
86X509_VAL **a;
87unsigned char **pp;
88long length;
89 { 80 {
90 M_ASN1_D2I_vars(a,X509_VAL *,X509_VAL_new); 81 M_ASN1_D2I_vars(a,X509_VAL *,X509_VAL_new);
91 82
92 M_ASN1_D2I_Init(); 83 M_ASN1_D2I_Init();
93 M_ASN1_D2I_start_sequence(); 84 M_ASN1_D2I_start_sequence();
94 M_ASN1_D2I_get(ret->notBefore,d2i_ASN1_UTCTIME); 85 M_ASN1_D2I_get(ret->notBefore,d2i_ASN1_TIME);
95 M_ASN1_D2I_get(ret->notAfter,d2i_ASN1_UTCTIME); 86 M_ASN1_D2I_get(ret->notAfter,d2i_ASN1_TIME);
96 M_ASN1_D2I_Finish(a,X509_VAL_free,ASN1_F_D2I_X509_VAL); 87 M_ASN1_D2I_Finish(a,X509_VAL_free,ASN1_F_D2I_X509_VAL);
97 } 88 }
98 89
99X509_VAL *X509_VAL_new() 90X509_VAL *X509_VAL_new(void)
100 { 91 {
101 X509_VAL *ret=NULL; 92 X509_VAL *ret=NULL;
93 ASN1_CTX c;
102 94
103 M_ASN1_New_Malloc(ret,X509_VAL); 95 M_ASN1_New_Malloc(ret,X509_VAL);
104 M_ASN1_New(ret->notBefore,ASN1_UTCTIME_new); 96 M_ASN1_New(ret->notBefore,ASN1_TIME_new);
105 M_ASN1_New(ret->notAfter,ASN1_UTCTIME_new); 97 M_ASN1_New(ret->notAfter,ASN1_TIME_new);
106 return(ret); 98 return(ret);
107 M_ASN1_New_Error(ASN1_F_X509_VAL_NEW); 99 M_ASN1_New_Error(ASN1_F_X509_VAL_NEW);
108 } 100 }
109 101
110void X509_VAL_free(a) 102void X509_VAL_free(X509_VAL *a)
111X509_VAL *a;
112 { 103 {
113 if (a == NULL) return; 104 if (a == NULL) return;
114 ASN1_UTCTIME_free(a->notBefore); 105 ASN1_TIME_free(a->notBefore);
115 ASN1_UTCTIME_free(a->notAfter); 106 ASN1_TIME_free(a->notAfter);
116 Free((char *)a); 107 Free((char *)a);
117 } 108 }
118 109
diff --git a/src/lib/libcrypto/asn1/x_x509.c b/src/lib/libcrypto/asn1/x_x509.c
index bc466ce0f6..7abf6b2a6b 100644
--- a/src/lib/libcrypto/asn1/x_x509.c
+++ b/src/lib/libcrypto/asn1/x_x509.c
@@ -58,13 +58,9 @@
58 58
59#include <stdio.h> 59#include <stdio.h>
60#include "cryptlib.h" 60#include "cryptlib.h"
61#include "evp.h" 61#include <openssl/evp.h>
62#include "asn1_mac.h" 62#include <openssl/asn1_mac.h>
63 63#include <openssl/x509.h>
64/*
65 * ASN1err(ASN1_F_D2I_X509,ASN1_R_LENGTH_MISMATCH);
66 * ASN1err(ASN1_F_X509_NEW,ASN1_R_BAD_GET_OBJECT);
67 */
68 64
69static ASN1_METHOD meth={ 65static ASN1_METHOD meth={
70 (int (*)()) i2d_X509, 66 (int (*)()) i2d_X509,
@@ -72,14 +68,12 @@ static ASN1_METHOD meth={
72 (char *(*)())X509_new, 68 (char *(*)())X509_new,
73 (void (*)()) X509_free}; 69 (void (*)()) X509_free};
74 70
75ASN1_METHOD *X509_asn1_meth() 71ASN1_METHOD *X509_asn1_meth(void)
76 { 72 {
77 return(&meth); 73 return(&meth);
78 } 74 }
79 75
80int i2d_X509(a,pp) 76int i2d_X509(X509 *a, unsigned char **pp)
81X509 *a;
82unsigned char **pp;
83 { 77 {
84 M_ASN1_I2D_vars(a); 78 M_ASN1_I2D_vars(a);
85 79
@@ -96,10 +90,7 @@ unsigned char **pp;
96 M_ASN1_I2D_finish(); 90 M_ASN1_I2D_finish();
97 } 91 }
98 92
99X509 *d2i_X509(a,pp,length) 93X509 *d2i_X509(X509 **a, unsigned char **pp, long length)
100X509 **a;
101unsigned char **pp;
102long length;
103 { 94 {
104 M_ASN1_D2I_vars(a,X509 *,X509_new); 95 M_ASN1_D2I_vars(a,X509 *,X509_new);
105 96
@@ -108,15 +99,16 @@ long length;
108 M_ASN1_D2I_get(ret->cert_info,d2i_X509_CINF); 99 M_ASN1_D2I_get(ret->cert_info,d2i_X509_CINF);
109 M_ASN1_D2I_get(ret->sig_alg,d2i_X509_ALGOR); 100 M_ASN1_D2I_get(ret->sig_alg,d2i_X509_ALGOR);
110 M_ASN1_D2I_get(ret->signature,d2i_ASN1_BIT_STRING); 101 M_ASN1_D2I_get(ret->signature,d2i_ASN1_BIT_STRING);
111if (ret->name != NULL) Free(ret->name); 102 if (ret->name != NULL) Free(ret->name);
112ret->name=X509_NAME_oneline(ret->cert_info->subject,NULL,0); 103 ret->name=X509_NAME_oneline(ret->cert_info->subject,NULL,0);
113 104
114 M_ASN1_D2I_Finish(a,X509_free,ASN1_F_D2I_X509); 105 M_ASN1_D2I_Finish(a,X509_free,ASN1_F_D2I_X509);
115 } 106 }
116 107
117X509 *X509_new() 108X509 *X509_new(void)
118 { 109 {
119 X509 *ret=NULL; 110 X509 *ret=NULL;
111 ASN1_CTX c;
120 112
121 M_ASN1_New_Malloc(ret,X509); 113 M_ASN1_New_Malloc(ret,X509);
122 ret->references=1; 114 ret->references=1;
@@ -129,8 +121,7 @@ X509 *X509_new()
129 M_ASN1_New_Error(ASN1_F_X509_NEW); 121 M_ASN1_New_Error(ASN1_F_X509_NEW);
130 } 122 }
131 123
132void X509_free(a) 124void X509_free(X509 *a)
133X509 *a;
134 { 125 {
135 int i; 126 int i;
136 127
@@ -149,9 +140,11 @@ X509 *a;
149 } 140 }
150#endif 141#endif
151 142
143 /* CRYPTO_free_ex_data(bio_meth,(char *)a,&a->ex_data); */
152 X509_CINF_free(a->cert_info); 144 X509_CINF_free(a->cert_info);
153 X509_ALGOR_free(a->sig_alg); 145 X509_ALGOR_free(a->sig_alg);
154 ASN1_BIT_STRING_free(a->signature); 146 ASN1_BIT_STRING_free(a->signature);
147
155 if (a->name != NULL) Free(a->name); 148 if (a->name != NULL) Free(a->name);
156 Free((char *)a); 149 Free((char *)a);
157 } 150 }