From de8f24ea083384bb66b32ec105dc4743c5663cdf Mon Sep 17 00:00:00 2001 From: beck <> Date: Wed, 29 Sep 1999 04:37:45 +0000 Subject: OpenSSL 0.9.4 merge --- src/lib/libcrypto/asn1/Makefile.ssl | 1038 +++++++++++++++++++++++++++++++++-- src/lib/libcrypto/asn1/a_bitstr.c | 78 ++- src/lib/libcrypto/asn1/a_bmp.c | 19 +- src/lib/libcrypto/asn1/a_bool.c | 15 +- src/lib/libcrypto/asn1/a_bytes.c | 44 +- src/lib/libcrypto/asn1/a_d2i_fp.c | 18 +- src/lib/libcrypto/asn1/a_digest.c | 14 +- src/lib/libcrypto/asn1/a_dup.c | 7 +- src/lib/libcrypto/asn1/a_enum.c | 326 +++++++++++ src/lib/libcrypto/asn1/a_gentm.c | 224 ++++++++ src/lib/libcrypto/asn1/a_hdr.c | 27 +- src/lib/libcrypto/asn1/a_i2d_fp.c | 14 +- src/lib/libcrypto/asn1/a_int.c | 215 ++++++-- src/lib/libcrypto/asn1/a_meth.c | 8 +- src/lib/libcrypto/asn1/a_object.c | 139 +---- src/lib/libcrypto/asn1/a_octet.c | 17 +- src/lib/libcrypto/asn1/a_print.c | 70 +-- src/lib/libcrypto/asn1/a_set.c | 112 +++- src/lib/libcrypto/asn1/a_sign.c | 28 +- src/lib/libcrypto/asn1/a_time.c | 123 +++++ src/lib/libcrypto/asn1/a_type.c | 91 +-- src/lib/libcrypto/asn1/a_utctm.c | 98 +++- src/lib/libcrypto/asn1/a_utf8.c | 83 +++ src/lib/libcrypto/asn1/a_verify.c | 23 +- src/lib/libcrypto/asn1/a_vis.c | 83 +++ src/lib/libcrypto/asn1/asn1.err | 182 ------ src/lib/libcrypto/asn1/asn1.h | 606 +++++++++++--------- src/lib/libcrypto/asn1/asn1_err.c | 357 +++++++----- src/lib/libcrypto/asn1/asn1_lib.c | 121 ++-- src/lib/libcrypto/asn1/asn1_mac.h | 355 +++++++++--- src/lib/libcrypto/asn1/asn1_par.c | 84 +-- src/lib/libcrypto/asn1/asn_pack.c | 145 +++++ src/lib/libcrypto/asn1/d2i_dhp.c | 23 +- src/lib/libcrypto/asn1/d2i_dsap.c | 25 +- src/lib/libcrypto/asn1/d2i_pr.c | 17 +- src/lib/libcrypto/asn1/d2i_pu.c | 17 +- src/lib/libcrypto/asn1/d2i_r_pr.c | 24 +- src/lib/libcrypto/asn1/d2i_r_pu.c | 23 +- src/lib/libcrypto/asn1/d2i_s_pr.c | 24 +- src/lib/libcrypto/asn1/d2i_s_pu.c | 25 +- src/lib/libcrypto/asn1/evp_asn1.c | 38 +- src/lib/libcrypto/asn1/f.c | 4 +- src/lib/libcrypto/asn1/f_enum.c | 207 +++++++ src/lib/libcrypto/asn1/f_int.c | 25 +- src/lib/libcrypto/asn1/f_string.c | 26 +- src/lib/libcrypto/asn1/i2d_dhp.c | 24 +- src/lib/libcrypto/asn1/i2d_dsap.c | 16 +- src/lib/libcrypto/asn1/i2d_pr.c | 10 +- src/lib/libcrypto/asn1/i2d_pu.c | 10 +- src/lib/libcrypto/asn1/i2d_r_pr.c | 19 +- src/lib/libcrypto/asn1/i2d_r_pu.c | 20 +- src/lib/libcrypto/asn1/i2d_s_pr.c | 19 +- src/lib/libcrypto/asn1/i2d_s_pu.c | 22 +- src/lib/libcrypto/asn1/n_pkey.c | 66 +-- src/lib/libcrypto/asn1/nsseq.c | 118 ++++ src/lib/libcrypto/asn1/p5_pbe.c | 156 ++++++ src/lib/libcrypto/asn1/p5_pbev2.c | 274 +++++++++ src/lib/libcrypto/asn1/p7_dgst.c | 25 +- src/lib/libcrypto/asn1/p7_enc.c | 25 +- src/lib/libcrypto/asn1/p7_enc_c.c | 28 +- src/lib/libcrypto/asn1/p7_evp.c | 38 +- src/lib/libcrypto/asn1/p7_i_s.c | 25 +- src/lib/libcrypto/asn1/p7_lib.c | 42 +- src/lib/libcrypto/asn1/p7_recip.c | 29 +- src/lib/libcrypto/asn1/p7_s_e.c | 81 ++- src/lib/libcrypto/asn1/p7_signd.c | 69 ++- src/lib/libcrypto/asn1/p7_signi.c | 51 +- src/lib/libcrypto/asn1/p8_pkey.c | 129 +++++ src/lib/libcrypto/asn1/pkcs8.c | 23 +- src/lib/libcrypto/asn1/t_crl.c | 166 ++++++ src/lib/libcrypto/asn1/t_pkey.c | 71 +-- src/lib/libcrypto/asn1/t_req.c | 36 +- src/lib/libcrypto/asn1/t_x509.c | 150 ++--- src/lib/libcrypto/asn1/x_algor.c | 28 +- src/lib/libcrypto/asn1/x_attrib.c | 59 +- src/lib/libcrypto/asn1/x_cinf.c | 56 +- src/lib/libcrypto/asn1/x_crl.c | 175 +++--- src/lib/libcrypto/asn1/x_exten.c | 28 +- src/lib/libcrypto/asn1/x_info.c | 14 +- src/lib/libcrypto/asn1/x_name.c | 96 ++-- src/lib/libcrypto/asn1/x_pkey.c | 27 +- src/lib/libcrypto/asn1/x_pubkey.c | 44 +- src/lib/libcrypto/asn1/x_req.c | 61 +- src/lib/libcrypto/asn1/x_sig.c | 23 +- src/lib/libcrypto/asn1/x_spki.c | 43 +- src/lib/libcrypto/asn1/x_val.c | 43 +- src/lib/libcrypto/asn1/x_x509.c | 33 +- 87 files changed, 5381 insertions(+), 2333 deletions(-) create mode 100644 src/lib/libcrypto/asn1/a_enum.c create mode 100644 src/lib/libcrypto/asn1/a_gentm.c create mode 100644 src/lib/libcrypto/asn1/a_time.c create mode 100644 src/lib/libcrypto/asn1/a_utf8.c create mode 100644 src/lib/libcrypto/asn1/a_vis.c delete mode 100644 src/lib/libcrypto/asn1/asn1.err create mode 100644 src/lib/libcrypto/asn1/asn_pack.c create mode 100644 src/lib/libcrypto/asn1/f_enum.c create mode 100644 src/lib/libcrypto/asn1/nsseq.c create mode 100644 src/lib/libcrypto/asn1/p5_pbe.c create mode 100644 src/lib/libcrypto/asn1/p5_pbev2.c create mode 100644 src/lib/libcrypto/asn1/p8_pkey.c create mode 100644 src/lib/libcrypto/asn1/t_crl.c (limited to 'src/lib/libcrypto/asn1') 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= ../.. CC= cc INCLUDES= -I.. -I../../include CFLAG=-g +INSTALL_PREFIX= +OPENSSLDIR= /usr/local/ssl INSTALLTOP=/usr/local/ssl MAKE= make -f Makefile.ssl -MAKEDEPEND= makedepend -f Makefile.ssl +MAKEDEPEND= $(TOP)/util/domd $(TOP) MAKEFILE= Makefile.ssl AR= ar r CFLAGS= $(INCLUDES) $(CFLAG) -ERR=asn1 -ERRC=asn1_err GENERAL=Makefile README TEST= APPS= LIB=$(TOP)/libcrypto.a -LIBSRC= a_object.c a_bitstr.c a_utctm.c a_int.c a_octet.c a_print.c \ - a_type.c a_set.c a_dup.c a_d2i_fp.c a_i2d_fp.c \ - a_sign.c a_digest.c a_verify.c \ +LIBSRC= a_object.c a_bitstr.c a_utctm.c a_gentm.c a_time.c a_int.c a_octet.c \ + a_print.c a_type.c a_set.c a_dup.c a_d2i_fp.c a_i2d_fp.c a_bmp.c \ + a_enum.c a_vis.c a_utf8.c a_sign.c a_digest.c a_verify.c \ x_algor.c x_val.c x_pubkey.c x_sig.c x_req.c x_attrib.c \ - x_name.c x_cinf.c x_x509.c x_crl.c x_info.c x_spki.c \ + x_name.c x_cinf.c x_x509.c x_crl.c x_info.c x_spki.c nsseq.c \ d2i_r_pr.c i2d_r_pr.c d2i_r_pu.c i2d_r_pu.c \ d2i_s_pr.c i2d_s_pr.c d2i_s_pu.c i2d_s_pu.c \ d2i_pu.c d2i_pr.c i2d_pu.c i2d_pr.c\ - t_req.c t_x509.c t_pkey.c \ + t_req.c t_x509.c t_crl.c t_pkey.c \ p7_i_s.c p7_signi.c p7_signd.c p7_recip.c p7_enc_c.c p7_evp.c \ p7_dgst.c p7_s_e.c p7_enc.c p7_lib.c \ f_int.c f_string.c i2d_dhp.c i2d_dsap.c d2i_dhp.c d2i_dsap.c n_pkey.c \ - a_hdr.c x_pkey.c a_bool.c x_exten.c \ - asn1_par.c asn1_lib.c $(ERRC).c a_meth.c a_bytes.c \ - evp_asn1.c -LIBOBJ= a_object.o a_bitstr.o a_utctm.o a_int.o a_octet.o a_print.o \ - a_type.o a_set.o a_dup.o a_d2i_fp.o a_i2d_fp.o \ - a_sign.o a_digest.o a_verify.o \ + f_enum.c a_hdr.c x_pkey.c a_bool.c x_exten.c \ + asn1_par.c asn1_lib.c asn1_err.c a_meth.c a_bytes.c \ + evp_asn1.c asn_pack.c p5_pbe.c p5_pbev2.c p8_pkey.c +LIBOBJ= a_object.o a_bitstr.o a_utctm.o a_gentm.o a_time.o a_int.o a_octet.o \ + a_print.o a_type.o a_set.o a_dup.o a_d2i_fp.o a_i2d_fp.o a_bmp.o \ + a_enum.o a_vis.o a_utf8.o a_sign.o a_digest.o a_verify.o \ x_algor.o x_val.o x_pubkey.o x_sig.o x_req.o x_attrib.o \ - x_name.o x_cinf.o x_x509.o x_crl.o x_info.o x_spki.o \ + x_name.o x_cinf.o x_x509.o x_crl.o x_info.o x_spki.o nsseq.o \ d2i_r_pr.o i2d_r_pr.o d2i_r_pu.o i2d_r_pu.o \ d2i_s_pr.o i2d_s_pr.o d2i_s_pu.o i2d_s_pu.o \ d2i_pu.o d2i_pr.o i2d_pu.o i2d_pr.o \ - t_req.o t_x509.o t_pkey.o \ + t_req.o t_x509.o t_crl.o t_pkey.o \ p7_i_s.o p7_signi.o p7_signd.o p7_recip.o p7_enc_c.o p7_evp.o \ p7_dgst.o p7_s_e.o p7_enc.o p7_lib.o \ f_int.o f_string.o i2d_dhp.o i2d_dsap.o d2i_dhp.o d2i_dsap.o n_pkey.o \ - a_hdr.o x_pkey.o a_bool.o x_exten.o \ - asn1_par.o asn1_lib.o $(ERRC).o a_meth.o a_bytes.o \ - evp_asn1.o + f_enum.o a_hdr.o x_pkey.o a_bool.o x_exten.o \ + asn1_par.o asn1_lib.o asn1_err.o a_meth.o a_bytes.o \ + evp_asn1.o asn_pack.o p5_pbe.o p5_pbev2.o p8_pkey.o SRC= $(LIBSRC) @@ -75,24 +75,23 @@ all: lib lib: $(LIBOBJ) $(AR) $(LIB) $(LIBOBJ) - sh $(TOP)/util/ranlib.sh $(LIB) + $(RANLIB) $(LIB) @touch lib files: - perl $(TOP)/util/files.pl Makefile.ssl >> $(TOP)/MINFO + $(PERL) $(TOP)/util/files.pl Makefile.ssl >> $(TOP)/MINFO links: - /bin/rm -f Makefile - $(TOP)/util/point.sh Makefile.ssl Makefile ; - $(TOP)/util/mklink.sh ../../include $(EXHEADER) - $(TOP)/util/mklink.sh ../../test $(TEST) - $(TOP)/util/mklink.sh ../../apps $(APPS) + @$(TOP)/util/point.sh Makefile.ssl Makefile + @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER) + @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST) + @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS) install: @for i in $(EXHEADER) ; \ do \ - (cp $$i $(INSTALLTOP)/include/$$i; \ - chmod 644 $(INSTALLTOP)/include/$$i ); \ + (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \ + chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \ done; tags: @@ -104,17 +103,988 @@ lint: lint -DLINT $(INCLUDES) $(SRC)>fluff depend: - $(MAKEDEPEND) $(INCLUDES) $(PROGS) $(LIBSRC) + $(MAKEDEPEND) $(INCLUDES) $(DEPFLAG) $(PROGS) $(LIBSRC) dclean: - perl -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new + $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new mv -f Makefile.new $(MAKEFILE) clean: - /bin/rm -f *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff + rm -f *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff -errors: - perl $(TOP)/util/err-ins.pl $(ERR).err $(ERR).h - perl ../err/err_genc.pl -s $(ERR).h $(ERRC).c # DO NOT DELETE THIS LINE -- make depend depends on it. + +a_bitstr.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h +a_bitstr.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h +a_bitstr.o: ../../include/openssl/crypto.h ../../include/openssl/e_os.h +a_bitstr.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h +a_bitstr.o: ../../include/openssl/opensslconf.h +a_bitstr.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h +a_bitstr.o: ../../include/openssl/stack.h ../cryptlib.h +a_bmp.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h +a_bmp.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h +a_bmp.o: ../../include/openssl/crypto.h ../../include/openssl/e_os.h +a_bmp.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h +a_bmp.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h +a_bmp.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h +a_bmp.o: ../cryptlib.h +a_bool.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h +a_bool.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h +a_bool.o: ../../include/openssl/crypto.h ../../include/openssl/e_os.h +a_bool.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h +a_bool.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h +a_bool.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h +a_bool.o: ../cryptlib.h +a_bytes.o: ../../include/openssl/asn1.h ../../include/openssl/asn1_mac.h +a_bytes.o: ../../include/openssl/bio.h ../../include/openssl/bn.h +a_bytes.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h +a_bytes.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h +a_bytes.o: ../../include/openssl/err.h ../../include/openssl/opensslconf.h +a_bytes.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h +a_bytes.o: ../../include/openssl/stack.h ../cryptlib.h +a_d2i_fp.o: ../../include/openssl/asn1.h ../../include/openssl/asn1_mac.h +a_d2i_fp.o: ../../include/openssl/bio.h ../../include/openssl/bn.h +a_d2i_fp.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h +a_d2i_fp.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h +a_d2i_fp.o: ../../include/openssl/err.h ../../include/openssl/opensslconf.h +a_d2i_fp.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h +a_d2i_fp.o: ../../include/openssl/stack.h ../cryptlib.h +a_digest.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h +a_digest.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h +a_digest.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h +a_digest.o: ../../include/openssl/crypto.h ../../include/openssl/des.h +a_digest.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h +a_digest.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h +a_digest.o: ../../include/openssl/err.h ../../include/openssl/evp.h +a_digest.o: ../../include/openssl/idea.h ../../include/openssl/md2.h +a_digest.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h +a_digest.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h +a_digest.o: ../../include/openssl/opensslv.h ../../include/openssl/rc2.h +a_digest.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h +a_digest.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h +a_digest.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h +a_digest.o: ../../include/openssl/stack.h ../cryptlib.h +a_dup.o: ../../include/openssl/asn1.h ../../include/openssl/asn1_mac.h +a_dup.o: ../../include/openssl/bio.h ../../include/openssl/bn.h +a_dup.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h +a_dup.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h +a_dup.o: ../../include/openssl/err.h ../../include/openssl/opensslconf.h +a_dup.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h +a_dup.o: ../../include/openssl/stack.h ../cryptlib.h +a_enum.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h +a_enum.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h +a_enum.o: ../../include/openssl/crypto.h ../../include/openssl/e_os.h +a_enum.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h +a_enum.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h +a_enum.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h +a_enum.o: ../cryptlib.h +a_gentm.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h +a_gentm.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h +a_gentm.o: ../../include/openssl/crypto.h ../../include/openssl/e_os.h +a_gentm.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h +a_gentm.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h +a_gentm.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h +a_gentm.o: ../cryptlib.h +a_hdr.o: ../../include/openssl/asn1.h ../../include/openssl/asn1_mac.h +a_hdr.o: ../../include/openssl/bio.h ../../include/openssl/bn.h +a_hdr.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h +a_hdr.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h +a_hdr.o: ../../include/openssl/err.h ../../include/openssl/opensslconf.h +a_hdr.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h +a_hdr.o: ../../include/openssl/stack.h ../cryptlib.h +a_i2d_fp.o: ../../include/openssl/asn1.h ../../include/openssl/asn1_mac.h +a_i2d_fp.o: ../../include/openssl/bio.h ../../include/openssl/bn.h +a_i2d_fp.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h +a_i2d_fp.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h +a_i2d_fp.o: ../../include/openssl/err.h ../../include/openssl/opensslconf.h +a_i2d_fp.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h +a_i2d_fp.o: ../../include/openssl/stack.h ../cryptlib.h +a_int.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h +a_int.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h +a_int.o: ../../include/openssl/crypto.h ../../include/openssl/e_os.h +a_int.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h +a_int.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h +a_int.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h +a_int.o: ../cryptlib.h +a_meth.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h +a_meth.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h +a_meth.o: ../../include/openssl/crypto.h ../../include/openssl/e_os.h +a_meth.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h +a_meth.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h +a_meth.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h +a_meth.o: ../cryptlib.h +a_object.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h +a_object.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h +a_object.o: ../../include/openssl/crypto.h ../../include/openssl/e_os.h +a_object.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h +a_object.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h +a_object.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h +a_object.o: ../../include/openssl/stack.h ../cryptlib.h +a_octet.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h +a_octet.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h +a_octet.o: ../../include/openssl/crypto.h ../../include/openssl/e_os.h +a_octet.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h +a_octet.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h +a_octet.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h +a_octet.o: ../cryptlib.h +a_print.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h +a_print.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h +a_print.o: ../../include/openssl/crypto.h ../../include/openssl/e_os.h +a_print.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h +a_print.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h +a_print.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h +a_print.o: ../cryptlib.h +a_set.o: ../../include/openssl/asn1.h ../../include/openssl/asn1_mac.h +a_set.o: ../../include/openssl/bio.h ../../include/openssl/bn.h +a_set.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h +a_set.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h +a_set.o: ../../include/openssl/err.h ../../include/openssl/opensslconf.h +a_set.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h +a_set.o: ../../include/openssl/stack.h ../cryptlib.h +a_sign.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h +a_sign.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h +a_sign.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h +a_sign.o: ../../include/openssl/crypto.h ../../include/openssl/des.h +a_sign.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h +a_sign.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h +a_sign.o: ../../include/openssl/err.h ../../include/openssl/evp.h +a_sign.o: ../../include/openssl/idea.h ../../include/openssl/md2.h +a_sign.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h +a_sign.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h +a_sign.o: ../../include/openssl/opensslv.h ../../include/openssl/pkcs7.h +a_sign.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h +a_sign.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h +a_sign.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h +a_sign.o: ../../include/openssl/sha.h ../../include/openssl/stack.h +a_sign.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h +a_sign.o: ../cryptlib.h +a_time.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h +a_time.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h +a_time.o: ../../include/openssl/crypto.h ../../include/openssl/e_os.h +a_time.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h +a_time.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h +a_time.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h +a_time.o: ../cryptlib.h +a_type.o: ../../include/openssl/asn1.h ../../include/openssl/asn1_mac.h +a_type.o: ../../include/openssl/bio.h ../../include/openssl/bn.h +a_type.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h +a_type.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h +a_type.o: ../../include/openssl/err.h ../../include/openssl/opensslconf.h +a_type.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h +a_type.o: ../../include/openssl/stack.h ../cryptlib.h +a_utctm.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h +a_utctm.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h +a_utctm.o: ../../include/openssl/crypto.h ../../include/openssl/e_os.h +a_utctm.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h +a_utctm.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h +a_utctm.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h +a_utctm.o: ../cryptlib.h +a_utf8.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h +a_utf8.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h +a_utf8.o: ../../include/openssl/crypto.h ../../include/openssl/e_os.h +a_utf8.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h +a_utf8.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h +a_utf8.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h +a_utf8.o: ../cryptlib.h +a_verify.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h +a_verify.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h +a_verify.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h +a_verify.o: ../../include/openssl/crypto.h ../../include/openssl/des.h +a_verify.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h +a_verify.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h +a_verify.o: ../../include/openssl/err.h ../../include/openssl/evp.h +a_verify.o: ../../include/openssl/idea.h ../../include/openssl/md2.h +a_verify.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h +a_verify.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h +a_verify.o: ../../include/openssl/opensslv.h ../../include/openssl/pkcs7.h +a_verify.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h +a_verify.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h +a_verify.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h +a_verify.o: ../../include/openssl/sha.h ../../include/openssl/stack.h +a_verify.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h +a_verify.o: ../cryptlib.h +a_vis.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h +a_vis.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h +a_vis.o: ../../include/openssl/crypto.h ../../include/openssl/e_os.h +a_vis.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h +a_vis.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h +a_vis.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h +a_vis.o: ../cryptlib.h +asn1_err.o: ../../include/openssl/asn1.h ../../include/openssl/bn.h +asn1_err.o: ../../include/openssl/err.h ../../include/openssl/opensslconf.h +asn1_err.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h +asn1_lib.o: ../../include/openssl/asn1.h ../../include/openssl/asn1_mac.h +asn1_lib.o: ../../include/openssl/bio.h ../../include/openssl/bn.h +asn1_lib.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h +asn1_lib.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h +asn1_lib.o: ../../include/openssl/err.h ../../include/openssl/opensslconf.h +asn1_lib.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h +asn1_lib.o: ../../include/openssl/stack.h ../cryptlib.h +asn1_par.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h +asn1_par.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h +asn1_par.o: ../../include/openssl/crypto.h ../../include/openssl/e_os.h +asn1_par.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h +asn1_par.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h +asn1_par.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h +asn1_par.o: ../../include/openssl/stack.h ../cryptlib.h +asn_pack.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h +asn_pack.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h +asn_pack.o: ../../include/openssl/crypto.h ../../include/openssl/e_os.h +asn_pack.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h +asn_pack.o: ../../include/openssl/opensslconf.h +asn_pack.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h +asn_pack.o: ../../include/openssl/stack.h ../cryptlib.h +d2i_dhp.o: ../../include/openssl/asn1.h ../../include/openssl/asn1_mac.h +d2i_dhp.o: ../../include/openssl/bio.h ../../include/openssl/bn.h +d2i_dhp.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h +d2i_dhp.o: ../../include/openssl/dh.h ../../include/openssl/e_os.h +d2i_dhp.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h +d2i_dhp.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h +d2i_dhp.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h +d2i_dhp.o: ../../include/openssl/stack.h ../cryptlib.h +d2i_dsap.o: ../../include/openssl/asn1.h ../../include/openssl/asn1_mac.h +d2i_dsap.o: ../../include/openssl/bio.h ../../include/openssl/bn.h +d2i_dsap.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h +d2i_dsap.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h +d2i_dsap.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h +d2i_dsap.o: ../../include/openssl/err.h ../../include/openssl/objects.h +d2i_dsap.o: ../../include/openssl/opensslconf.h +d2i_dsap.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h +d2i_dsap.o: ../../include/openssl/stack.h ../cryptlib.h +d2i_pr.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h +d2i_pr.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h +d2i_pr.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h +d2i_pr.o: ../../include/openssl/crypto.h ../../include/openssl/des.h +d2i_pr.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h +d2i_pr.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h +d2i_pr.o: ../../include/openssl/err.h ../../include/openssl/evp.h +d2i_pr.o: ../../include/openssl/idea.h ../../include/openssl/md2.h +d2i_pr.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h +d2i_pr.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h +d2i_pr.o: ../../include/openssl/opensslv.h ../../include/openssl/rc2.h +d2i_pr.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h +d2i_pr.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h +d2i_pr.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h +d2i_pr.o: ../../include/openssl/stack.h ../cryptlib.h +d2i_pu.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h +d2i_pu.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h +d2i_pu.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h +d2i_pu.o: ../../include/openssl/crypto.h ../../include/openssl/des.h +d2i_pu.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h +d2i_pu.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h +d2i_pu.o: ../../include/openssl/err.h ../../include/openssl/evp.h +d2i_pu.o: ../../include/openssl/idea.h ../../include/openssl/md2.h +d2i_pu.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h +d2i_pu.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h +d2i_pu.o: ../../include/openssl/opensslv.h ../../include/openssl/rc2.h +d2i_pu.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h +d2i_pu.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h +d2i_pu.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h +d2i_pu.o: ../../include/openssl/stack.h ../cryptlib.h +d2i_r_pr.o: ../../include/openssl/asn1.h ../../include/openssl/asn1_mac.h +d2i_r_pr.o: ../../include/openssl/bio.h ../../include/openssl/bn.h +d2i_r_pr.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h +d2i_r_pr.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h +d2i_r_pr.o: ../../include/openssl/err.h ../../include/openssl/objects.h +d2i_r_pr.o: ../../include/openssl/opensslconf.h +d2i_r_pr.o: ../../include/openssl/opensslv.h ../../include/openssl/rsa.h +d2i_r_pr.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h +d2i_r_pr.o: ../cryptlib.h +d2i_r_pu.o: ../../include/openssl/asn1.h ../../include/openssl/asn1_mac.h +d2i_r_pu.o: ../../include/openssl/bio.h ../../include/openssl/bn.h +d2i_r_pu.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h +d2i_r_pu.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h +d2i_r_pu.o: ../../include/openssl/err.h ../../include/openssl/objects.h +d2i_r_pu.o: ../../include/openssl/opensslconf.h +d2i_r_pu.o: ../../include/openssl/opensslv.h ../../include/openssl/rsa.h +d2i_r_pu.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h +d2i_r_pu.o: ../cryptlib.h +d2i_s_pr.o: ../../include/openssl/asn1.h ../../include/openssl/asn1_mac.h +d2i_s_pr.o: ../../include/openssl/bio.h ../../include/openssl/bn.h +d2i_s_pr.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h +d2i_s_pr.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h +d2i_s_pr.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h +d2i_s_pr.o: ../../include/openssl/err.h ../../include/openssl/objects.h +d2i_s_pr.o: ../../include/openssl/opensslconf.h +d2i_s_pr.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h +d2i_s_pr.o: ../../include/openssl/stack.h ../cryptlib.h +d2i_s_pu.o: ../../include/openssl/asn1.h ../../include/openssl/asn1_mac.h +d2i_s_pu.o: ../../include/openssl/bio.h ../../include/openssl/bn.h +d2i_s_pu.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h +d2i_s_pu.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h +d2i_s_pu.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h +d2i_s_pu.o: ../../include/openssl/err.h ../../include/openssl/objects.h +d2i_s_pu.o: ../../include/openssl/opensslconf.h +d2i_s_pu.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h +d2i_s_pu.o: ../../include/openssl/stack.h ../cryptlib.h +evp_asn1.o: ../../include/openssl/asn1.h ../../include/openssl/asn1_mac.h +evp_asn1.o: ../../include/openssl/bio.h ../../include/openssl/bn.h +evp_asn1.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h +evp_asn1.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h +evp_asn1.o: ../../include/openssl/err.h ../../include/openssl/opensslconf.h +evp_asn1.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h +evp_asn1.o: ../../include/openssl/stack.h ../cryptlib.h +f_enum.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h +f_enum.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h +f_enum.o: ../../include/openssl/crypto.h ../../include/openssl/e_os.h +f_enum.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h +f_enum.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h +f_enum.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h +f_enum.o: ../cryptlib.h +f_int.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h +f_int.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h +f_int.o: ../../include/openssl/crypto.h ../../include/openssl/e_os.h +f_int.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h +f_int.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h +f_int.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h +f_int.o: ../cryptlib.h +f_string.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h +f_string.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h +f_string.o: ../../include/openssl/crypto.h ../../include/openssl/e_os.h +f_string.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h +f_string.o: ../../include/openssl/opensslconf.h +f_string.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h +f_string.o: ../../include/openssl/stack.h ../cryptlib.h +i2d_dhp.o: ../../include/openssl/asn1.h ../../include/openssl/asn1_mac.h +i2d_dhp.o: ../../include/openssl/bio.h ../../include/openssl/bn.h +i2d_dhp.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h +i2d_dhp.o: ../../include/openssl/dh.h ../../include/openssl/e_os.h +i2d_dhp.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h +i2d_dhp.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h +i2d_dhp.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h +i2d_dhp.o: ../cryptlib.h +i2d_dsap.o: ../../include/openssl/asn1.h ../../include/openssl/asn1_mac.h +i2d_dsap.o: ../../include/openssl/bio.h ../../include/openssl/bn.h +i2d_dsap.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h +i2d_dsap.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h +i2d_dsap.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h +i2d_dsap.o: ../../include/openssl/err.h ../../include/openssl/opensslconf.h +i2d_dsap.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h +i2d_dsap.o: ../../include/openssl/stack.h ../cryptlib.h +i2d_pr.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h +i2d_pr.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h +i2d_pr.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h +i2d_pr.o: ../../include/openssl/crypto.h ../../include/openssl/des.h +i2d_pr.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h +i2d_pr.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h +i2d_pr.o: ../../include/openssl/err.h ../../include/openssl/evp.h +i2d_pr.o: ../../include/openssl/idea.h ../../include/openssl/md2.h +i2d_pr.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h +i2d_pr.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h +i2d_pr.o: ../../include/openssl/opensslv.h ../../include/openssl/rc2.h +i2d_pr.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h +i2d_pr.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h +i2d_pr.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h +i2d_pr.o: ../../include/openssl/stack.h ../cryptlib.h +i2d_pu.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h +i2d_pu.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h +i2d_pu.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h +i2d_pu.o: ../../include/openssl/crypto.h ../../include/openssl/des.h +i2d_pu.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h +i2d_pu.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h +i2d_pu.o: ../../include/openssl/err.h ../../include/openssl/evp.h +i2d_pu.o: ../../include/openssl/idea.h ../../include/openssl/md2.h +i2d_pu.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h +i2d_pu.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h +i2d_pu.o: ../../include/openssl/opensslv.h ../../include/openssl/rc2.h +i2d_pu.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h +i2d_pu.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h +i2d_pu.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h +i2d_pu.o: ../../include/openssl/stack.h ../cryptlib.h +i2d_r_pr.o: ../../include/openssl/asn1.h ../../include/openssl/asn1_mac.h +i2d_r_pr.o: ../../include/openssl/bio.h ../../include/openssl/bn.h +i2d_r_pr.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h +i2d_r_pr.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h +i2d_r_pr.o: ../../include/openssl/err.h ../../include/openssl/objects.h +i2d_r_pr.o: ../../include/openssl/opensslconf.h +i2d_r_pr.o: ../../include/openssl/opensslv.h ../../include/openssl/rsa.h +i2d_r_pr.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h +i2d_r_pr.o: ../cryptlib.h +i2d_r_pu.o: ../../include/openssl/asn1.h ../../include/openssl/asn1_mac.h +i2d_r_pu.o: ../../include/openssl/bio.h ../../include/openssl/bn.h +i2d_r_pu.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h +i2d_r_pu.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h +i2d_r_pu.o: ../../include/openssl/err.h ../../include/openssl/objects.h +i2d_r_pu.o: ../../include/openssl/opensslconf.h +i2d_r_pu.o: ../../include/openssl/opensslv.h ../../include/openssl/rsa.h +i2d_r_pu.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h +i2d_r_pu.o: ../cryptlib.h +i2d_s_pr.o: ../../include/openssl/asn1.h ../../include/openssl/asn1_mac.h +i2d_s_pr.o: ../../include/openssl/bio.h ../../include/openssl/bn.h +i2d_s_pr.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h +i2d_s_pr.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h +i2d_s_pr.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h +i2d_s_pr.o: ../../include/openssl/err.h ../../include/openssl/objects.h +i2d_s_pr.o: ../../include/openssl/opensslconf.h +i2d_s_pr.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h +i2d_s_pr.o: ../../include/openssl/stack.h ../cryptlib.h +i2d_s_pu.o: ../../include/openssl/asn1.h ../../include/openssl/asn1_mac.h +i2d_s_pu.o: ../../include/openssl/bio.h ../../include/openssl/bn.h +i2d_s_pu.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h +i2d_s_pu.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h +i2d_s_pu.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h +i2d_s_pu.o: ../../include/openssl/err.h ../../include/openssl/objects.h +i2d_s_pu.o: ../../include/openssl/opensslconf.h +i2d_s_pu.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h +i2d_s_pu.o: ../../include/openssl/stack.h ../cryptlib.h +n_pkey.o: ../../include/openssl/asn1.h ../../include/openssl/asn1_mac.h +n_pkey.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h +n_pkey.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h +n_pkey.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h +n_pkey.o: ../../include/openssl/des.h ../../include/openssl/dh.h +n_pkey.o: ../../include/openssl/dsa.h ../../include/openssl/e_os.h +n_pkey.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h +n_pkey.o: ../../include/openssl/evp.h ../../include/openssl/idea.h +n_pkey.o: ../../include/openssl/md2.h ../../include/openssl/md5.h +n_pkey.o: ../../include/openssl/mdc2.h ../../include/openssl/objects.h +n_pkey.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h +n_pkey.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h +n_pkey.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h +n_pkey.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h +n_pkey.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h +n_pkey.o: ../../include/openssl/stack.h ../../include/openssl/x509.h +n_pkey.o: ../../include/openssl/x509_vfy.h ../cryptlib.h +nsseq.o: ../../include/openssl/asn1.h ../../include/openssl/asn1_mac.h +nsseq.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h +nsseq.o: ../../include/openssl/bn.h ../../include/openssl/cast.h +nsseq.o: ../../include/openssl/crypto.h ../../include/openssl/des.h +nsseq.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h +nsseq.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h +nsseq.o: ../../include/openssl/evp.h ../../include/openssl/idea.h +nsseq.o: ../../include/openssl/md2.h ../../include/openssl/md5.h +nsseq.o: ../../include/openssl/mdc2.h ../../include/openssl/objects.h +nsseq.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h +nsseq.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h +nsseq.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h +nsseq.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h +nsseq.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h +nsseq.o: ../../include/openssl/stack.h ../../include/openssl/x509.h +nsseq.o: ../../include/openssl/x509_vfy.h +p5_pbe.o: ../../include/openssl/asn1.h ../../include/openssl/asn1_mac.h +p5_pbe.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h +p5_pbe.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h +p5_pbe.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h +p5_pbe.o: ../../include/openssl/des.h ../../include/openssl/dh.h +p5_pbe.o: ../../include/openssl/dsa.h ../../include/openssl/e_os.h +p5_pbe.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h +p5_pbe.o: ../../include/openssl/evp.h ../../include/openssl/idea.h +p5_pbe.o: ../../include/openssl/md2.h ../../include/openssl/md5.h +p5_pbe.o: ../../include/openssl/mdc2.h ../../include/openssl/objects.h +p5_pbe.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h +p5_pbe.o: ../../include/openssl/pkcs7.h ../../include/openssl/rand.h +p5_pbe.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h +p5_pbe.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h +p5_pbe.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h +p5_pbe.o: ../../include/openssl/sha.h ../../include/openssl/stack.h +p5_pbe.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h +p5_pbe.o: ../cryptlib.h +p5_pbev2.o: ../../include/openssl/asn1.h ../../include/openssl/asn1_mac.h +p5_pbev2.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h +p5_pbev2.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h +p5_pbev2.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h +p5_pbev2.o: ../../include/openssl/des.h ../../include/openssl/dh.h +p5_pbev2.o: ../../include/openssl/dsa.h ../../include/openssl/e_os.h +p5_pbev2.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h +p5_pbev2.o: ../../include/openssl/evp.h ../../include/openssl/idea.h +p5_pbev2.o: ../../include/openssl/md2.h ../../include/openssl/md5.h +p5_pbev2.o: ../../include/openssl/mdc2.h ../../include/openssl/objects.h +p5_pbev2.o: ../../include/openssl/opensslconf.h +p5_pbev2.o: ../../include/openssl/opensslv.h ../../include/openssl/pkcs7.h +p5_pbev2.o: ../../include/openssl/rand.h ../../include/openssl/rc2.h +p5_pbev2.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h +p5_pbev2.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h +p5_pbev2.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h +p5_pbev2.o: ../../include/openssl/stack.h ../../include/openssl/x509.h +p5_pbev2.o: ../../include/openssl/x509_vfy.h ../cryptlib.h +p7_dgst.o: ../../include/openssl/asn1.h ../../include/openssl/asn1_mac.h +p7_dgst.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h +p7_dgst.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h +p7_dgst.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h +p7_dgst.o: ../../include/openssl/des.h ../../include/openssl/dh.h +p7_dgst.o: ../../include/openssl/dsa.h ../../include/openssl/e_os.h +p7_dgst.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h +p7_dgst.o: ../../include/openssl/evp.h ../../include/openssl/idea.h +p7_dgst.o: ../../include/openssl/md2.h ../../include/openssl/md5.h +p7_dgst.o: ../../include/openssl/mdc2.h ../../include/openssl/objects.h +p7_dgst.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h +p7_dgst.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h +p7_dgst.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h +p7_dgst.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h +p7_dgst.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h +p7_dgst.o: ../../include/openssl/stack.h ../../include/openssl/x509.h +p7_dgst.o: ../../include/openssl/x509_vfy.h ../cryptlib.h +p7_enc.o: ../../include/openssl/asn1.h ../../include/openssl/asn1_mac.h +p7_enc.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h +p7_enc.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h +p7_enc.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h +p7_enc.o: ../../include/openssl/des.h ../../include/openssl/dh.h +p7_enc.o: ../../include/openssl/dsa.h ../../include/openssl/e_os.h +p7_enc.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h +p7_enc.o: ../../include/openssl/evp.h ../../include/openssl/idea.h +p7_enc.o: ../../include/openssl/md2.h ../../include/openssl/md5.h +p7_enc.o: ../../include/openssl/mdc2.h ../../include/openssl/objects.h +p7_enc.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h +p7_enc.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h +p7_enc.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h +p7_enc.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h +p7_enc.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h +p7_enc.o: ../../include/openssl/stack.h ../../include/openssl/x509.h +p7_enc.o: ../../include/openssl/x509_vfy.h ../cryptlib.h +p7_enc_c.o: ../../include/openssl/asn1.h ../../include/openssl/asn1_mac.h +p7_enc_c.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h +p7_enc_c.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h +p7_enc_c.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h +p7_enc_c.o: ../../include/openssl/des.h ../../include/openssl/dh.h +p7_enc_c.o: ../../include/openssl/dsa.h ../../include/openssl/e_os.h +p7_enc_c.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h +p7_enc_c.o: ../../include/openssl/evp.h ../../include/openssl/idea.h +p7_enc_c.o: ../../include/openssl/md2.h ../../include/openssl/md5.h +p7_enc_c.o: ../../include/openssl/mdc2.h ../../include/openssl/objects.h +p7_enc_c.o: ../../include/openssl/opensslconf.h +p7_enc_c.o: ../../include/openssl/opensslv.h ../../include/openssl/pkcs7.h +p7_enc_c.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h +p7_enc_c.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h +p7_enc_c.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h +p7_enc_c.o: ../../include/openssl/sha.h ../../include/openssl/stack.h +p7_enc_c.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h +p7_enc_c.o: ../cryptlib.h +p7_evp.o: ../../include/openssl/asn1.h ../../include/openssl/asn1_mac.h +p7_evp.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h +p7_evp.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h +p7_evp.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h +p7_evp.o: ../../include/openssl/des.h ../../include/openssl/dh.h +p7_evp.o: ../../include/openssl/dsa.h ../../include/openssl/e_os.h +p7_evp.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h +p7_evp.o: ../../include/openssl/evp.h ../../include/openssl/idea.h +p7_evp.o: ../../include/openssl/md2.h ../../include/openssl/md5.h +p7_evp.o: ../../include/openssl/mdc2.h ../../include/openssl/objects.h +p7_evp.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h +p7_evp.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h +p7_evp.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h +p7_evp.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h +p7_evp.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h +p7_evp.o: ../../include/openssl/stack.h ../../include/openssl/x509.h +p7_evp.o: ../../include/openssl/x509_vfy.h ../cryptlib.h +p7_i_s.o: ../../include/openssl/asn1.h ../../include/openssl/asn1_mac.h +p7_i_s.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h +p7_i_s.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h +p7_i_s.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h +p7_i_s.o: ../../include/openssl/des.h ../../include/openssl/dh.h +p7_i_s.o: ../../include/openssl/dsa.h ../../include/openssl/e_os.h +p7_i_s.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h +p7_i_s.o: ../../include/openssl/evp.h ../../include/openssl/idea.h +p7_i_s.o: ../../include/openssl/md2.h ../../include/openssl/md5.h +p7_i_s.o: ../../include/openssl/mdc2.h ../../include/openssl/objects.h +p7_i_s.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h +p7_i_s.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h +p7_i_s.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h +p7_i_s.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h +p7_i_s.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h +p7_i_s.o: ../../include/openssl/stack.h ../../include/openssl/x509.h +p7_i_s.o: ../../include/openssl/x509_vfy.h ../cryptlib.h +p7_lib.o: ../../include/openssl/asn1.h ../../include/openssl/asn1_mac.h +p7_lib.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h +p7_lib.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h +p7_lib.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h +p7_lib.o: ../../include/openssl/des.h ../../include/openssl/dh.h +p7_lib.o: ../../include/openssl/dsa.h ../../include/openssl/e_os.h +p7_lib.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h +p7_lib.o: ../../include/openssl/evp.h ../../include/openssl/idea.h +p7_lib.o: ../../include/openssl/md2.h ../../include/openssl/md5.h +p7_lib.o: ../../include/openssl/mdc2.h ../../include/openssl/objects.h +p7_lib.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h +p7_lib.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h +p7_lib.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h +p7_lib.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h +p7_lib.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h +p7_lib.o: ../../include/openssl/stack.h ../../include/openssl/x509.h +p7_lib.o: ../../include/openssl/x509_vfy.h ../cryptlib.h +p7_recip.o: ../../include/openssl/asn1.h ../../include/openssl/asn1_mac.h +p7_recip.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h +p7_recip.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h +p7_recip.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h +p7_recip.o: ../../include/openssl/des.h ../../include/openssl/dh.h +p7_recip.o: ../../include/openssl/dsa.h ../../include/openssl/e_os.h +p7_recip.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h +p7_recip.o: ../../include/openssl/evp.h ../../include/openssl/idea.h +p7_recip.o: ../../include/openssl/md2.h ../../include/openssl/md5.h +p7_recip.o: ../../include/openssl/mdc2.h ../../include/openssl/objects.h +p7_recip.o: ../../include/openssl/opensslconf.h +p7_recip.o: ../../include/openssl/opensslv.h ../../include/openssl/pkcs7.h +p7_recip.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h +p7_recip.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h +p7_recip.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h +p7_recip.o: ../../include/openssl/sha.h ../../include/openssl/stack.h +p7_recip.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h +p7_recip.o: ../cryptlib.h +p7_s_e.o: ../../include/openssl/asn1.h ../../include/openssl/asn1_mac.h +p7_s_e.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h +p7_s_e.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h +p7_s_e.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h +p7_s_e.o: ../../include/openssl/des.h ../../include/openssl/dh.h +p7_s_e.o: ../../include/openssl/dsa.h ../../include/openssl/e_os.h +p7_s_e.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h +p7_s_e.o: ../../include/openssl/evp.h ../../include/openssl/idea.h +p7_s_e.o: ../../include/openssl/md2.h ../../include/openssl/md5.h +p7_s_e.o: ../../include/openssl/mdc2.h ../../include/openssl/objects.h +p7_s_e.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h +p7_s_e.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h +p7_s_e.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h +p7_s_e.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h +p7_s_e.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h +p7_s_e.o: ../../include/openssl/stack.h ../../include/openssl/x509.h +p7_s_e.o: ../../include/openssl/x509_vfy.h ../cryptlib.h +p7_signd.o: ../../include/openssl/asn1.h ../../include/openssl/asn1_mac.h +p7_signd.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h +p7_signd.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h +p7_signd.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h +p7_signd.o: ../../include/openssl/des.h ../../include/openssl/dh.h +p7_signd.o: ../../include/openssl/dsa.h ../../include/openssl/e_os.h +p7_signd.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h +p7_signd.o: ../../include/openssl/evp.h ../../include/openssl/idea.h +p7_signd.o: ../../include/openssl/md2.h ../../include/openssl/md5.h +p7_signd.o: ../../include/openssl/mdc2.h ../../include/openssl/objects.h +p7_signd.o: ../../include/openssl/opensslconf.h +p7_signd.o: ../../include/openssl/opensslv.h ../../include/openssl/pkcs7.h +p7_signd.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h +p7_signd.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h +p7_signd.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h +p7_signd.o: ../../include/openssl/sha.h ../../include/openssl/stack.h +p7_signd.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h +p7_signd.o: ../cryptlib.h +p7_signi.o: ../../include/openssl/asn1.h ../../include/openssl/asn1_mac.h +p7_signi.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h +p7_signi.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h +p7_signi.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h +p7_signi.o: ../../include/openssl/des.h ../../include/openssl/dh.h +p7_signi.o: ../../include/openssl/dsa.h ../../include/openssl/e_os.h +p7_signi.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h +p7_signi.o: ../../include/openssl/evp.h ../../include/openssl/idea.h +p7_signi.o: ../../include/openssl/md2.h ../../include/openssl/md5.h +p7_signi.o: ../../include/openssl/mdc2.h ../../include/openssl/objects.h +p7_signi.o: ../../include/openssl/opensslconf.h +p7_signi.o: ../../include/openssl/opensslv.h ../../include/openssl/pkcs7.h +p7_signi.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h +p7_signi.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h +p7_signi.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h +p7_signi.o: ../../include/openssl/sha.h ../../include/openssl/stack.h +p7_signi.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h +p7_signi.o: ../cryptlib.h +p8_pkey.o: ../../include/openssl/asn1.h ../../include/openssl/asn1_mac.h +p8_pkey.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h +p8_pkey.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h +p8_pkey.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h +p8_pkey.o: ../../include/openssl/des.h ../../include/openssl/dh.h +p8_pkey.o: ../../include/openssl/dsa.h ../../include/openssl/e_os.h +p8_pkey.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h +p8_pkey.o: ../../include/openssl/evp.h ../../include/openssl/idea.h +p8_pkey.o: ../../include/openssl/md2.h ../../include/openssl/md5.h +p8_pkey.o: ../../include/openssl/mdc2.h ../../include/openssl/objects.h +p8_pkey.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h +p8_pkey.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h +p8_pkey.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h +p8_pkey.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h +p8_pkey.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h +p8_pkey.o: ../../include/openssl/stack.h ../../include/openssl/x509.h +p8_pkey.o: ../../include/openssl/x509_vfy.h ../cryptlib.h +t_crl.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h +t_crl.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h +t_crl.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h +t_crl.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h +t_crl.o: ../../include/openssl/des.h ../../include/openssl/dh.h +t_crl.o: ../../include/openssl/dsa.h ../../include/openssl/e_os.h +t_crl.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h +t_crl.o: ../../include/openssl/evp.h ../../include/openssl/idea.h +t_crl.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h +t_crl.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h +t_crl.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h +t_crl.o: ../../include/openssl/opensslv.h ../../include/openssl/pkcs7.h +t_crl.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h +t_crl.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h +t_crl.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h +t_crl.o: ../../include/openssl/sha.h ../../include/openssl/stack.h +t_crl.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h +t_crl.o: ../../include/openssl/x509v3.h ../cryptlib.h +t_pkey.o: ../../include/openssl/bio.h ../../include/openssl/bn.h +t_pkey.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h +t_pkey.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h +t_pkey.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h +t_pkey.o: ../../include/openssl/err.h ../../include/openssl/opensslconf.h +t_pkey.o: ../../include/openssl/opensslv.h ../../include/openssl/rsa.h +t_pkey.o: ../../include/openssl/stack.h ../cryptlib.h +t_req.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h +t_req.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h +t_req.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h +t_req.o: ../../include/openssl/crypto.h ../../include/openssl/des.h +t_req.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h +t_req.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h +t_req.o: ../../include/openssl/err.h ../../include/openssl/evp.h +t_req.o: ../../include/openssl/idea.h ../../include/openssl/md2.h +t_req.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h +t_req.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h +t_req.o: ../../include/openssl/opensslv.h ../../include/openssl/pkcs7.h +t_req.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h +t_req.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h +t_req.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h +t_req.o: ../../include/openssl/sha.h ../../include/openssl/stack.h +t_req.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h +t_req.o: ../cryptlib.h +t_x509.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h +t_x509.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h +t_x509.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h +t_x509.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h +t_x509.o: ../../include/openssl/des.h ../../include/openssl/dh.h +t_x509.o: ../../include/openssl/dsa.h ../../include/openssl/e_os.h +t_x509.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h +t_x509.o: ../../include/openssl/evp.h ../../include/openssl/idea.h +t_x509.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h +t_x509.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h +t_x509.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h +t_x509.o: ../../include/openssl/opensslv.h ../../include/openssl/pkcs7.h +t_x509.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h +t_x509.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h +t_x509.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h +t_x509.o: ../../include/openssl/sha.h ../../include/openssl/stack.h +t_x509.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h +t_x509.o: ../../include/openssl/x509v3.h ../cryptlib.h +x_algor.o: ../../include/openssl/asn1.h ../../include/openssl/asn1_mac.h +x_algor.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h +x_algor.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h +x_algor.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h +x_algor.o: ../../include/openssl/des.h ../../include/openssl/dh.h +x_algor.o: ../../include/openssl/dsa.h ../../include/openssl/e_os.h +x_algor.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h +x_algor.o: ../../include/openssl/evp.h ../../include/openssl/idea.h +x_algor.o: ../../include/openssl/md2.h ../../include/openssl/md5.h +x_algor.o: ../../include/openssl/mdc2.h ../../include/openssl/objects.h +x_algor.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h +x_algor.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h +x_algor.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h +x_algor.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h +x_algor.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h +x_algor.o: ../../include/openssl/stack.h ../../include/openssl/x509.h +x_algor.o: ../../include/openssl/x509_vfy.h ../cryptlib.h +x_attrib.o: ../../include/openssl/asn1.h ../../include/openssl/asn1_mac.h +x_attrib.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h +x_attrib.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h +x_attrib.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h +x_attrib.o: ../../include/openssl/des.h ../../include/openssl/dh.h +x_attrib.o: ../../include/openssl/dsa.h ../../include/openssl/e_os.h +x_attrib.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h +x_attrib.o: ../../include/openssl/evp.h ../../include/openssl/idea.h +x_attrib.o: ../../include/openssl/md2.h ../../include/openssl/md5.h +x_attrib.o: ../../include/openssl/mdc2.h ../../include/openssl/objects.h +x_attrib.o: ../../include/openssl/opensslconf.h +x_attrib.o: ../../include/openssl/opensslv.h ../../include/openssl/pkcs7.h +x_attrib.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h +x_attrib.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h +x_attrib.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h +x_attrib.o: ../../include/openssl/sha.h ../../include/openssl/stack.h +x_attrib.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h +x_attrib.o: ../cryptlib.h +x_cinf.o: ../../include/openssl/asn1.h ../../include/openssl/asn1_mac.h +x_cinf.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h +x_cinf.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h +x_cinf.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h +x_cinf.o: ../../include/openssl/des.h ../../include/openssl/dh.h +x_cinf.o: ../../include/openssl/dsa.h ../../include/openssl/e_os.h +x_cinf.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h +x_cinf.o: ../../include/openssl/evp.h ../../include/openssl/idea.h +x_cinf.o: ../../include/openssl/md2.h ../../include/openssl/md5.h +x_cinf.o: ../../include/openssl/mdc2.h ../../include/openssl/objects.h +x_cinf.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h +x_cinf.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h +x_cinf.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h +x_cinf.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h +x_cinf.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h +x_cinf.o: ../../include/openssl/stack.h ../../include/openssl/x509.h +x_cinf.o: ../../include/openssl/x509_vfy.h ../cryptlib.h +x_crl.o: ../../include/openssl/asn1.h ../../include/openssl/asn1_mac.h +x_crl.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h +x_crl.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h +x_crl.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h +x_crl.o: ../../include/openssl/des.h ../../include/openssl/dh.h +x_crl.o: ../../include/openssl/dsa.h ../../include/openssl/e_os.h +x_crl.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h +x_crl.o: ../../include/openssl/evp.h ../../include/openssl/idea.h +x_crl.o: ../../include/openssl/md2.h ../../include/openssl/md5.h +x_crl.o: ../../include/openssl/mdc2.h ../../include/openssl/objects.h +x_crl.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h +x_crl.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h +x_crl.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h +x_crl.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h +x_crl.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h +x_crl.o: ../../include/openssl/stack.h ../../include/openssl/x509.h +x_crl.o: ../../include/openssl/x509_vfy.h ../cryptlib.h +x_exten.o: ../../include/openssl/asn1.h ../../include/openssl/asn1_mac.h +x_exten.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h +x_exten.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h +x_exten.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h +x_exten.o: ../../include/openssl/des.h ../../include/openssl/dh.h +x_exten.o: ../../include/openssl/dsa.h ../../include/openssl/e_os.h +x_exten.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h +x_exten.o: ../../include/openssl/evp.h ../../include/openssl/idea.h +x_exten.o: ../../include/openssl/md2.h ../../include/openssl/md5.h +x_exten.o: ../../include/openssl/mdc2.h ../../include/openssl/objects.h +x_exten.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h +x_exten.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h +x_exten.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h +x_exten.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h +x_exten.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h +x_exten.o: ../../include/openssl/stack.h ../../include/openssl/x509.h +x_exten.o: ../../include/openssl/x509_vfy.h ../cryptlib.h +x_info.o: ../../include/openssl/asn1.h ../../include/openssl/asn1_mac.h +x_info.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h +x_info.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h +x_info.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h +x_info.o: ../../include/openssl/des.h ../../include/openssl/dh.h +x_info.o: ../../include/openssl/dsa.h ../../include/openssl/e_os.h +x_info.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h +x_info.o: ../../include/openssl/evp.h ../../include/openssl/idea.h +x_info.o: ../../include/openssl/md2.h ../../include/openssl/md5.h +x_info.o: ../../include/openssl/mdc2.h ../../include/openssl/objects.h +x_info.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h +x_info.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h +x_info.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h +x_info.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h +x_info.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h +x_info.o: ../../include/openssl/stack.h ../../include/openssl/x509.h +x_info.o: ../../include/openssl/x509_vfy.h ../cryptlib.h +x_name.o: ../../include/openssl/asn1.h ../../include/openssl/asn1_mac.h +x_name.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h +x_name.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h +x_name.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h +x_name.o: ../../include/openssl/des.h ../../include/openssl/dh.h +x_name.o: ../../include/openssl/dsa.h ../../include/openssl/e_os.h +x_name.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h +x_name.o: ../../include/openssl/evp.h ../../include/openssl/idea.h +x_name.o: ../../include/openssl/md2.h ../../include/openssl/md5.h +x_name.o: ../../include/openssl/mdc2.h ../../include/openssl/objects.h +x_name.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h +x_name.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h +x_name.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h +x_name.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h +x_name.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h +x_name.o: ../../include/openssl/stack.h ../../include/openssl/x509.h +x_name.o: ../../include/openssl/x509_vfy.h ../cryptlib.h +x_pkey.o: ../../include/openssl/asn1.h ../../include/openssl/asn1_mac.h +x_pkey.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h +x_pkey.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h +x_pkey.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h +x_pkey.o: ../../include/openssl/des.h ../../include/openssl/dh.h +x_pkey.o: ../../include/openssl/dsa.h ../../include/openssl/e_os.h +x_pkey.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h +x_pkey.o: ../../include/openssl/evp.h ../../include/openssl/idea.h +x_pkey.o: ../../include/openssl/md2.h ../../include/openssl/md5.h +x_pkey.o: ../../include/openssl/mdc2.h ../../include/openssl/objects.h +x_pkey.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h +x_pkey.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h +x_pkey.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h +x_pkey.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h +x_pkey.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h +x_pkey.o: ../../include/openssl/stack.h ../../include/openssl/x509.h +x_pkey.o: ../../include/openssl/x509_vfy.h ../cryptlib.h +x_pubkey.o: ../../include/openssl/asn1.h ../../include/openssl/asn1_mac.h +x_pubkey.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h +x_pubkey.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h +x_pubkey.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h +x_pubkey.o: ../../include/openssl/des.h ../../include/openssl/dh.h +x_pubkey.o: ../../include/openssl/dsa.h ../../include/openssl/e_os.h +x_pubkey.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h +x_pubkey.o: ../../include/openssl/evp.h ../../include/openssl/idea.h +x_pubkey.o: ../../include/openssl/md2.h ../../include/openssl/md5.h +x_pubkey.o: ../../include/openssl/mdc2.h ../../include/openssl/objects.h +x_pubkey.o: ../../include/openssl/opensslconf.h +x_pubkey.o: ../../include/openssl/opensslv.h ../../include/openssl/pkcs7.h +x_pubkey.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h +x_pubkey.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h +x_pubkey.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h +x_pubkey.o: ../../include/openssl/sha.h ../../include/openssl/stack.h +x_pubkey.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h +x_pubkey.o: ../cryptlib.h +x_req.o: ../../include/openssl/asn1.h ../../include/openssl/asn1_mac.h +x_req.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h +x_req.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h +x_req.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h +x_req.o: ../../include/openssl/des.h ../../include/openssl/dh.h +x_req.o: ../../include/openssl/dsa.h ../../include/openssl/e_os.h +x_req.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h +x_req.o: ../../include/openssl/evp.h ../../include/openssl/idea.h +x_req.o: ../../include/openssl/md2.h ../../include/openssl/md5.h +x_req.o: ../../include/openssl/mdc2.h ../../include/openssl/objects.h +x_req.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h +x_req.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h +x_req.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h +x_req.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h +x_req.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h +x_req.o: ../../include/openssl/stack.h ../../include/openssl/x509.h +x_req.o: ../../include/openssl/x509_vfy.h ../cryptlib.h +x_sig.o: ../../include/openssl/asn1.h ../../include/openssl/asn1_mac.h +x_sig.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h +x_sig.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h +x_sig.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h +x_sig.o: ../../include/openssl/des.h ../../include/openssl/dh.h +x_sig.o: ../../include/openssl/dsa.h ../../include/openssl/e_os.h +x_sig.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h +x_sig.o: ../../include/openssl/evp.h ../../include/openssl/idea.h +x_sig.o: ../../include/openssl/md2.h ../../include/openssl/md5.h +x_sig.o: ../../include/openssl/mdc2.h ../../include/openssl/objects.h +x_sig.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h +x_sig.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h +x_sig.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h +x_sig.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h +x_sig.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h +x_sig.o: ../../include/openssl/stack.h ../../include/openssl/x509.h +x_sig.o: ../../include/openssl/x509_vfy.h ../cryptlib.h +x_spki.o: ../../include/openssl/asn1.h ../../include/openssl/asn1_mac.h +x_spki.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h +x_spki.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h +x_spki.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h +x_spki.o: ../../include/openssl/des.h ../../include/openssl/dh.h +x_spki.o: ../../include/openssl/dsa.h ../../include/openssl/e_os.h +x_spki.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h +x_spki.o: ../../include/openssl/evp.h ../../include/openssl/idea.h +x_spki.o: ../../include/openssl/md2.h ../../include/openssl/md5.h +x_spki.o: ../../include/openssl/mdc2.h ../../include/openssl/objects.h +x_spki.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h +x_spki.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h +x_spki.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h +x_spki.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h +x_spki.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h +x_spki.o: ../../include/openssl/stack.h ../../include/openssl/x509.h +x_spki.o: ../../include/openssl/x509_vfy.h ../cryptlib.h +x_val.o: ../../include/openssl/asn1.h ../../include/openssl/asn1_mac.h +x_val.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h +x_val.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h +x_val.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h +x_val.o: ../../include/openssl/des.h ../../include/openssl/dh.h +x_val.o: ../../include/openssl/dsa.h ../../include/openssl/e_os.h +x_val.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h +x_val.o: ../../include/openssl/evp.h ../../include/openssl/idea.h +x_val.o: ../../include/openssl/md2.h ../../include/openssl/md5.h +x_val.o: ../../include/openssl/mdc2.h ../../include/openssl/objects.h +x_val.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h +x_val.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h +x_val.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h +x_val.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h +x_val.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h +x_val.o: ../../include/openssl/stack.h ../../include/openssl/x509.h +x_val.o: ../../include/openssl/x509_vfy.h ../cryptlib.h +x_x509.o: ../../include/openssl/asn1.h ../../include/openssl/asn1_mac.h +x_x509.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h +x_x509.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h +x_x509.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h +x_x509.o: ../../include/openssl/des.h ../../include/openssl/dh.h +x_x509.o: ../../include/openssl/dsa.h ../../include/openssl/e_os.h +x_x509.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h +x_x509.o: ../../include/openssl/evp.h ../../include/openssl/idea.h +x_x509.o: ../../include/openssl/md2.h ../../include/openssl/md5.h +x_x509.o: ../../include/openssl/mdc2.h ../../include/openssl/objects.h +x_x509.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h +x_x509.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h +x_x509.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h +x_x509.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h +x_x509.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h +x_x509.o: ../../include/openssl/stack.h ../../include/openssl/x509.h +x_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 @@ #include #include "cryptlib.h" -#include "asn1.h" +#include -/* ASN1err(ASN1_F_ASN1_STRING_NEW,ASN1_R_STRING_TOO_SHORT); - * ASN1err(ASN1_F_D2I_ASN1_BIT_STRING,ASN1_R_EXPECTING_A_BIT_STRING); - */ - -int i2d_ASN1_BIT_STRING(a,pp) -ASN1_BIT_STRING *a; -unsigned char **pp; +int i2d_ASN1_BIT_STRING(ASN1_BIT_STRING *a, unsigned char **pp) { - int ret,j,r,bits; + int ret,j,r,bits,len; unsigned char *p,*d; if (a == NULL) return(0); - /* our bit strings are always a multiple of 8 :-) */ - bits=0; - ret=1+a->length; + len=a->length; + + if (len > 0) + { + if (a->flags & ASN1_STRING_FLAG_BITS_LEFT) + { + bits=(int)a->flags&0x07; + } + else + { + for ( ; len > 0; len--) + { + if (a->data[len-1]) break; + } + j=a->data[len-1]; + if (j & 0x01) bits=0; + else if (j & 0x02) bits=1; + else if (j & 0x04) bits=2; + else if (j & 0x08) bits=3; + else if (j & 0x10) bits=4; + else if (j & 0x20) bits=5; + else if (j & 0x40) bits=6; + else if (j & 0x80) bits=7; + else bits=0; /* should not happen */ + } + } + else + bits=0; + ret=1+len; r=ASN1_object_size(0,ret,V_ASN1_BIT_STRING); if (pp == NULL) return(r); p= *pp; ASN1_put_object(&p,0,ret,V_ASN1_BIT_STRING,V_ASN1_UNIVERSAL); - if (bits == 0) - j=0; - else j=8-bits; - *(p++)=(unsigned char)j; + *(p++)=(unsigned char)bits; d=a->data; - memcpy(p,d,a->length); - p+=a->length; - if (a->length > 0) p[-1]&=(0xff< 0) p[-1]&=(0xff<flags&= ~(ASN1_STRING_FLAG_BITS_LEFT|0x07); /* clear */ + ret->flags|=(ASN1_STRING_FLAG_BITS_LEFT|(i&0x07)); /* set */ + if (len-- > 1) /* using one because of the bits left byte */ { s=(unsigned char *)Malloc((int)len); @@ -158,10 +179,7 @@ err: /* These next 2 functions from Goetz Babin-Ebell */ -int ASN1_BIT_STRING_set_bit(a,n,value) -ASN1_BIT_STRING *a; -int n; -int value; +int ASN1_BIT_STRING_set_bit(ASN1_BIT_STRING *a, int n, int value) { int w,v,iv; unsigned char *c; @@ -170,6 +188,8 @@ int value; v=1<<(7-(n&0x07)); iv= ~v; + a->flags&= ~(ASN1_STRING_FLAG_BITS_LEFT|0x07); /* clear, set on write */ + if (a == NULL) return(0); if ((a->length < (w+1)) || (a->data == NULL)) { @@ -189,9 +209,7 @@ int value; return(1); } -int ASN1_BIT_STRING_get_bit(a,n) -ASN1_BIT_STRING *a; -int n; +int ASN1_BIT_STRING_get_bit(ASN1_BIT_STRING *a, int n) { int w,v; 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 @@ #include #include "cryptlib.h" -#include "asn1.h" +#include -/* ASN1err(ASN1_F_D2I_ASN1_INTEGER,ASN1_R_EXPECTING_AN_INTEGER); - */ - -int i2d_ASN1_BMPSTRING(a, pp) -ASN1_BMPSTRING *a; -unsigned char **pp; +int i2d_ASN1_BMPSTRING(ASN1_BMPSTRING *a, unsigned char **pp) { return(i2d_ASN1_bytes((ASN1_STRING *)a,pp, V_ASN1_BMPSTRING,V_ASN1_UNIVERSAL)); } -ASN1_BMPSTRING *d2i_ASN1_BMPSTRING(a, pp, length) -ASN1_BMPSTRING **a; -unsigned char **pp; -long length; +ASN1_BMPSTRING *d2i_ASN1_BMPSTRING(ASN1_BMPSTRING **a, unsigned char **pp, + long length) { ASN1_BMPSTRING *ret=NULL; ret=(ASN1_BMPSTRING *)d2i_ASN1_bytes((ASN1_STRING **)a, - pp,length,V_ASN1_BMPSTRING,V_ASN1_UNIVERSAL); + pp,length,V_ASN1_BMPSTRING,V_ASN1_UNIVERSAL); if (ret == NULL) { - ASN1err(ASN1_F_D2I_ASN1_BMPSTRING,ASN1_R_ERROR_STACK); + ASN1err(ASN1_F_D2I_ASN1_BMPSTRING,ERR_R_NESTED_ASN1_ERROR); return(NULL); } 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 @@ #include #include "cryptlib.h" -#include "asn1.h" +#include -/* ASN1err(ASN1_F_D2I_ASN1_BOOLEAN,ASN1_R_EXPECTING_A_BOOLEAN); - * ASN1err(ASN1_F_D2I_ASN1_BOOLEAN,ASN1_R_BOOLEAN_IS_WRONG_LENGTH); - */ - -int i2d_ASN1_BOOLEAN(a,pp) -int a; -unsigned char **pp; +int i2d_ASN1_BOOLEAN(int a, unsigned char **pp) { int r; unsigned char *p; @@ -81,10 +75,7 @@ unsigned char **pp; return(r); } -int d2i_ASN1_BOOLEAN(a, pp, length) -int *a; -unsigned char **pp; -long length; +int d2i_ASN1_BOOLEAN(int *a, unsigned char **pp, long length) { int ret= -1; 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 @@ #include #include "cryptlib.h" -#include "asn1_mac.h" - -/* ASN1err(ASN1_F_ASN1_TYPE_NEW,ASN1_R_ERROR_STACK); - * ASN1err(ASN1_F_D2I_ASN1_TYPE_BYTES,ASN1_R_ERROR_STACK); - * ASN1err(ASN1_F_D2I_ASN1_TYPE_BYTES,ASN1_R_WRONG_TYPE); - * ASN1err(ASN1_F_ASN1_COLLATE_PRIMATIVE,ASN1_R_WRONG_TAG); - */ +#include static unsigned long tag2bit[32]={ 0, 0, 0, B_ASN1_BIT_STRING, /* tags 0 - 3 */ B_ASN1_OCTET_STRING, 0, 0, B_ASN1_UNKNOWN,/* tags 4- 7 */ B_ASN1_UNKNOWN, B_ASN1_UNKNOWN, B_ASN1_UNKNOWN, B_ASN1_UNKNOWN,/* tags 8-11 */ -B_ASN1_UNKNOWN, B_ASN1_UNKNOWN, B_ASN1_UNKNOWN, B_ASN1_UNKNOWN,/* tags 12-15 */ +B_ASN1_UTF8STRING,B_ASN1_UNKNOWN,B_ASN1_UNKNOWN,B_ASN1_UNKNOWN,/* tags 12-15 */ 0, 0, B_ASN1_NUMERICSTRING,B_ASN1_PRINTABLESTRING, B_ASN1_T61STRING,B_ASN1_VIDEOTEXSTRING,B_ASN1_IA5STRING,0, 0,B_ASN1_GRAPHICSTRING,B_ASN1_ISO64STRING,B_ASN1_GENERALSTRING, B_ASN1_UNIVERSALSTRING,B_ASN1_UNKNOWN,B_ASN1_BMPSTRING,B_ASN1_UNKNOWN, }; -#ifndef NOPROTO static int asn1_collate_primative(ASN1_STRING *a, ASN1_CTX *c); -#else -static int asn1_collate_primative(); -#endif - -/* type is a 'bitmap' of acceptable string types to be accepted. +/* type is a 'bitmap' of acceptable string types. */ -ASN1_STRING *d2i_ASN1_type_bytes(a, pp, length, type) -ASN1_STRING **a; -unsigned char **pp; -long length; -int type; +ASN1_STRING *d2i_ASN1_type_bytes(ASN1_STRING **a, unsigned char **pp, + long length, int type) { ASN1_STRING *ret=NULL; unsigned char *p,*s; @@ -152,11 +138,7 @@ err: return(NULL); } -int i2d_ASN1_bytes(a, pp, tag, xclass) -ASN1_STRING *a; -unsigned char **pp; -int tag; -int xclass; +int i2d_ASN1_bytes(ASN1_STRING *a, unsigned char **pp, int tag, int xclass) { int ret,r,constructed; unsigned char *p; @@ -182,12 +164,8 @@ int xclass; return(r); } -ASN1_STRING *d2i_ASN1_bytes(a, pp, length, Ptag, Pclass) -ASN1_STRING **a; -unsigned char **pp; -long length; -int Ptag; -int Pclass; +ASN1_STRING *d2i_ASN1_bytes(ASN1_STRING **a, unsigned char **pp, long length, + int Ptag, int Pclass) { ASN1_STRING *ret=NULL; unsigned char *p,*s; @@ -279,9 +257,7 @@ err: * them into the one struture that is then returned */ /* There have been a few bug fixes for this function from * Paul Keogh , many thanks to him */ -static int asn1_collate_primative(a,c) -ASN1_STRING *a; -ASN1_CTX *c; +static int asn1_collate_primative(ASN1_STRING *a, ASN1_CTX *c) { ASN1_STRING *os=NULL; BUF_MEM b; @@ -338,7 +314,7 @@ ASN1_CTX *c; if (os != NULL) ASN1_STRING_free(os); return(1); err: - ASN1err(ASN1_F_ASN1_COLLATE_PRIMATIVE,c->error); + ASN1err(ASN1_F_ASN1_COLLATE_PRIMITIVE,c->error); if (os != NULL) ASN1_STRING_free(os); if (b.data != NULL) Free(b.data); 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 @@ #include #include "cryptlib.h" -#include "buffer.h" -#include "asn1_mac.h" +#include +#include #define HEADER_SIZE 8 #ifndef NO_FP_API -char *ASN1_d2i_fp(xnew,d2i,in,x) -char *(*xnew)(); -char *(*d2i)(); -FILE *in; -unsigned char **x; +char *ASN1_d2i_fp(char *(*xnew)(), char *(*d2i)(), FILE *in, + unsigned char **x) { BIO *b; char *ret; @@ -85,11 +82,8 @@ unsigned char **x; } #endif -char *ASN1_d2i_bio(xnew,d2i,in,x) -char *(*xnew)(); -char *(*d2i)(); -BIO *in; -unsigned char **x; +char *ASN1_d2i_bio(char *(*xnew)(), char *(*d2i)(), BIO *in, + unsigned char **x) { BUF_MEM *b; 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 @@ #include #include "cryptlib.h" -#include "evp.h" -#include "x509.h" -#include "buffer.h" +#include +#include +#include -int ASN1_digest(i2d,type,data,md,len) -int (*i2d)(); -EVP_MD *type; -char *data; -unsigned char *md; -unsigned int *len; +int ASN1_digest(int (*i2d)(), EVP_MD *type, char *data, unsigned char *md, + unsigned int *len) { EVP_MD_CTX ctx; 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 @@ #include #include "cryptlib.h" -#include "asn1_mac.h" +#include #define READ_CHUNK 2048 -char *ASN1_dup(i2d,d2i,x) -int (*i2d)(); -char *(*d2i)(); -char *x; +char *ASN1_dup(int (*i2d)(), char *(*d2i)(), char *x) { unsigned char *b,*p; 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 @@ +/* crypto/asn1/a_enum.c */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#include +#include "cryptlib.h" +#include + +/* + * Code for ENUMERATED type: identical to INTEGER apart from a different tag. + * for comments on encoding see a_int.c + */ + +int i2d_ASN1_ENUMERATED(ASN1_ENUMERATED *a, unsigned char **pp) + { + int pad=0,ret,r,i,t; + unsigned char *p,*n,pb=0; + + if ((a == NULL) || (a->data == NULL)) return(0); + t=a->type; + if (a->length == 0) + ret=1; + else + { + ret=a->length; + i=a->data[0]; + if ((t == V_ASN1_ENUMERATED) && (i > 127)) { + pad=1; + pb=0; + } else if(t == V_ASN1_NEG_ENUMERATED) { + if(i>128) { + pad=1; + pb=0xFF; + } else if(i == 128) { + for(i = 1; i < a->length; i++) if(a->data[i]) { + pad=1; + pb=0xFF; + break; + } + } + } + ret+=pad; + } + r=ASN1_object_size(0,ret,V_ASN1_ENUMERATED); + if (pp == NULL) return(r); + p= *pp; + + ASN1_put_object(&p,0,ret,V_ASN1_ENUMERATED,V_ASN1_UNIVERSAL); + if (pad) *(p++)=pb; + if (a->length == 0) + *(p++)=0; + else if (t == V_ASN1_ENUMERATED) + { + memcpy(p,a->data,(unsigned int)a->length); + p+=a->length; + } + else { + /* Begin at the end of the encoding */ + n=a->data + a->length - 1; + p += a->length - 1; + i = a->length; + /* Copy zeros to destination as long as source is zero */ + while(!*n) { + *(p--) = 0; + n--; + i--; + } + /* Complement and increment next octet */ + *(p--) = ((*(n--)) ^ 0xff) + 1; + i--; + /* Complement any octets left */ + for(;i > 0; i--) *(p--) = *(n--) ^ 0xff; + p += a->length; + } + + *pp=p; + return(r); + } + +ASN1_ENUMERATED *d2i_ASN1_ENUMERATED(ASN1_ENUMERATED **a, unsigned char **pp, + long length) + { + ASN1_ENUMERATED *ret=NULL; + unsigned char *p,*to,*s; + long len; + int inf,tag,xclass; + int i; + + if ((a == NULL) || ((*a) == NULL)) + { + if ((ret=ASN1_ENUMERATED_new()) == NULL) return(NULL); + ret->type=V_ASN1_ENUMERATED; + } + else + ret=(*a); + + p= *pp; + inf=ASN1_get_object(&p,&len,&tag,&xclass,length); + if (inf & 0x80) + { + i=ASN1_R_BAD_OBJECT_HEADER; + goto err; + } + + if (tag != V_ASN1_ENUMERATED) + { + i=ASN1_R_EXPECTING_AN_ENUMERATED; + goto err; + } + + /* We must Malloc stuff, even for 0 bytes otherwise it + * signifies a missing NULL parameter. */ + s=(unsigned char *)Malloc((int)len+1); + if (s == NULL) + { + i=ERR_R_MALLOC_FAILURE; + goto err; + } + to=s; + if (*p & 0x80) /* a negative number */ + { + ret->type=V_ASN1_NEG_ENUMERATED; + if ((*p == 0xff) && (len != 1)) { + p++; + len--; + } + i = len; + p += i - 1; + to += i - 1; + while((!*p) && i) { + *(to--) = 0; + i--; + p--; + } + if(!i) { + *s = 1; + s[len] = 0; + p += len; + len++; + } else { + *(to--) = (*(p--) ^ 0xff) + 1; + i--; + for(;i > 0; i--) *(to--) = *(p--) ^ 0xff; + p += len; + } + } else { + ret->type=V_ASN1_ENUMERATED; + if ((*p == 0) && (len != 1)) + { + p++; + len--; + } + memcpy(s,p,(int)len); + p+=len; + } + + if (ret->data != NULL) Free((char *)ret->data); + ret->data=s; + ret->length=(int)len; + if (a != NULL) (*a)=ret; + *pp=p; + return(ret); +err: + ASN1err(ASN1_F_D2I_ASN1_ENUMERATED,i); + if ((ret != NULL) && ((a == NULL) || (*a != ret))) + ASN1_ENUMERATED_free(ret); + return(NULL); + } + +int ASN1_ENUMERATED_set(ASN1_ENUMERATED *a, long v) + { + int i,j,k; + unsigned char buf[sizeof(long)+1]; + long d; + + a->type=V_ASN1_ENUMERATED; + if (a->length < (sizeof(long)+1)) + { + if (a->data != NULL) + Free((char *)a->data); + if ((a->data=(unsigned char *)Malloc(sizeof(long)+1)) != NULL) + memset((char *)a->data,0,sizeof(long)+1); + } + if (a->data == NULL) + { + ASN1err(ASN1_F_ASN1_ENUMERATED_SET,ERR_R_MALLOC_FAILURE); + return(0); + } + d=v; + if (d < 0) + { + d= -d; + a->type=V_ASN1_NEG_ENUMERATED; + } + + for (i=0; i>=8; + } + j=0; + for (k=i-1; k >=0; k--) + a->data[j++]=buf[k]; + a->length=j; + return(1); + } + +long ASN1_ENUMERATED_get(ASN1_ENUMERATED *a) + { + int neg=0,i; + long r=0; + + if (a == NULL) return(0L); + i=a->type; + if (i == V_ASN1_NEG_ENUMERATED) + neg=1; + else if (i != V_ASN1_ENUMERATED) + return(0); + + if (a->length > sizeof(long)) + { + /* hmm... a bit ugly */ + return(0xffffffffL); + } + if (a->data == NULL) + return(0); + + for (i=0; ilength; i++) + { + r<<=8; + r|=(unsigned char)a->data[i]; + } + if (neg) r= -r; + return(r); + } + +ASN1_ENUMERATED *BN_to_ASN1_ENUMERATED(BIGNUM *bn, ASN1_ENUMERATED *ai) + { + ASN1_ENUMERATED *ret; + int len,j; + + if (ai == NULL) + ret=ASN1_ENUMERATED_new(); + else + ret=ai; + if (ret == NULL) + { + ASN1err(ASN1_F_BN_TO_ASN1_ENUMERATED,ERR_R_NESTED_ASN1_ERROR); + goto err; + } + if(bn->neg) ret->type = V_ASN1_NEG_ENUMERATED; + else ret->type=V_ASN1_ENUMERATED; + j=BN_num_bits(bn); + len=((j == 0)?0:((j/8)+1)); + ret->data=(unsigned char *)Malloc(len+4); + ret->length=BN_bn2bin(bn,ret->data); + return(ret); +err: + if (ret != ai) ASN1_ENUMERATED_free(ret); + return(NULL); + } + +BIGNUM *ASN1_ENUMERATED_to_BN(ASN1_ENUMERATED *ai, BIGNUM *bn) + { + BIGNUM *ret; + + if ((ret=BN_bin2bn(ai->data,ai->length,bn)) == NULL) + ASN1err(ASN1_F_ASN1_ENUMERATED_TO_BN,ASN1_R_BN_LIB); + if(ai->type == V_ASN1_NEG_ENUMERATED) bn->neg = 1; + return(ret); + } 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 @@ +/* crypto/asn1/a_gentm.c */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +/* GENERALIZEDTIME implementation, written by Steve Henson. Based on UTCTIME */ + +#include +#include +#include "cryptlib.h" +#include + +int i2d_ASN1_GENERALIZEDTIME(ASN1_GENERALIZEDTIME *a, unsigned char **pp) + { +#ifdef CHARSET_EBCDIC + /* KLUDGE! We convert to ascii before writing DER */ + int len; + char tmp[24]; + ASN1_STRING tmpstr = *(ASN1_STRING *)a; + + len = tmpstr.length; + ebcdic2ascii(tmp, tmpstr.data, (len >= sizeof tmp) ? sizeof tmp : len); + tmpstr.data = tmp; + + a = (ASN1_GENERALIZEDTIME *) &tmpstr; +#endif + return(i2d_ASN1_bytes((ASN1_STRING *)a,pp, + V_ASN1_GENERALIZEDTIME,V_ASN1_UNIVERSAL)); + } + + +ASN1_GENERALIZEDTIME *d2i_ASN1_GENERALIZEDTIME(ASN1_GENERALIZEDTIME **a, + unsigned char **pp, long length) + { + ASN1_GENERALIZEDTIME *ret=NULL; + + ret=(ASN1_GENERALIZEDTIME *)d2i_ASN1_bytes((ASN1_STRING **)a,pp,length, + V_ASN1_GENERALIZEDTIME,V_ASN1_UNIVERSAL); + if (ret == NULL) + { + ASN1err(ASN1_F_D2I_ASN1_GENERALIZEDTIME,ERR_R_NESTED_ASN1_ERROR); + return(NULL); + } +#ifdef CHARSET_EBCDIC + ascii2ebcdic(ret->data, ret->data, ret->length); +#endif + if (!ASN1_GENERALIZEDTIME_check(ret)) + { + ASN1err(ASN1_F_D2I_ASN1_GENERALIZEDTIME,ASN1_R_INVALID_TIME_FORMAT); + goto err; + } + + return(ret); +err: + if ((ret != NULL) && ((a == NULL) || (*a != ret))) + ASN1_GENERALIZEDTIME_free(ret); + return(NULL); + } + +int ASN1_GENERALIZEDTIME_check(ASN1_GENERALIZEDTIME *d) + { + static int min[9]={ 0, 0, 1, 1, 0, 0, 0, 0, 0}; + static int max[9]={99, 99,12,31,23,59,59,12,59}; + char *a; + int n,i,l,o; + + if (d->type != V_ASN1_GENERALIZEDTIME) return(0); + l=d->length; + a=(char *)d->data; + o=0; + /* GENERALIZEDTIME is similar to UTCTIME except the year is + * represented as YYYY. This stuff treats everything as a two digit + * field so make first two fields 00 to 99 + */ + if (l < 13) goto err; + for (i=0; i<7; i++) + { + if ((i == 6) && ((a[o] == 'Z') || + (a[o] == '+') || (a[o] == '-'))) + { i++; break; } + if ((a[o] < '0') || (a[o] > '9')) goto err; + n= a[o]-'0'; + if (++o > l) goto err; + + if ((a[o] < '0') || (a[o] > '9')) goto err; + n=(n*10)+ a[o]-'0'; + if (++o > l) goto err; + + if ((n < min[i]) || (n > max[i])) goto err; + } + if (a[o] == 'Z') + o++; + else if ((a[o] == '+') || (a[o] == '-')) + { + o++; + if (o+4 > l) goto err; + for (i=7; i<9; i++) + { + if ((a[o] < '0') || (a[o] > '9')) goto err; + n= a[o]-'0'; + o++; + if ((a[o] < '0') || (a[o] > '9')) goto err; + n=(n*10)+ a[o]-'0'; + if ((n < min[i]) || (n > max[i])) goto err; + o++; + } + } + return(o == l); +err: + return(0); + } + +int ASN1_GENERALIZEDTIME_set_string(ASN1_GENERALIZEDTIME *s, char *str) + { + ASN1_GENERALIZEDTIME t; + + t.type=V_ASN1_GENERALIZEDTIME; + t.length=strlen(str); + t.data=(unsigned char *)str; + if (ASN1_GENERALIZEDTIME_check(&t)) + { + if (s != NULL) + { + ASN1_STRING_set((ASN1_STRING *)s, + (unsigned char *)str,t.length); + } + return(1); + } + else + return(0); + } + +ASN1_GENERALIZEDTIME *ASN1_GENERALIZEDTIME_set(ASN1_GENERALIZEDTIME *s, + time_t t) + { + char *p; + struct tm *ts; +#if defined(THREADS) && !defined(WIN32) + struct tm data; +#endif + + if (s == NULL) + s=ASN1_GENERALIZEDTIME_new(); + if (s == NULL) + return(NULL); + +#if defined(THREADS) && !defined(WIN32) + gmtime_r(&t,&data); /* should return &data, but doesn't on some systems, so we don't even look at the return value */ + ts=&data; +#else + ts=gmtime(&t); +#endif + p=(char *)s->data; + if ((p == NULL) || (s->length < 16)) + { + p=Malloc(20); + if (p == NULL) return(NULL); + if (s->data != NULL) + Free(s->data); + s->data=(unsigned char *)p; + } + + sprintf(p,"%04d%02d%02d%02d%02d%02dZ",ts->tm_year + 1900, + ts->tm_mon+1,ts->tm_mday,ts->tm_hour,ts->tm_min,ts->tm_sec); + s->length=strlen(p); + s->type=V_ASN1_GENERALIZEDTIME; +#ifdef CHARSET_EBCDIC_not + ebcdic2ascii(s->data, s->data, s->length); +#endif + return(s); + } 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 @@ #include #include "cryptlib.h" -#include "asn1_mac.h" -#include "asn1.h" +#include +#include -/* - * ASN1err(ASN1_F_D2I_ASN1_HEADER,ASN1_R_LENGTH_MISMATCH); - * ASN1err(ASN1_F_I2D_ASN1_HEADER,ASN1_R_BAD_GET_OBJECT); - * ASN1err(ASN1_F_I2D_ASN1_HEADER,ASN1_R_BAD_GET_OBJECT); - * ASN1err(ASN1_F_ASN1_HEADER_NEW,ASN1_R_BAD_GET_OBJECT); - */ - -int i2d_ASN1_HEADER(a,pp) -ASN1_HEADER *a; -unsigned char **pp; +int i2d_ASN1_HEADER(ASN1_HEADER *a, unsigned char **pp) { M_ASN1_I2D_vars(a); @@ -85,10 +76,8 @@ unsigned char **pp; M_ASN1_I2D_finish(); } -ASN1_HEADER *d2i_ASN1_HEADER(a,pp,length) -ASN1_HEADER **a; -unsigned char **pp; -long length; +ASN1_HEADER *d2i_ASN1_HEADER(ASN1_HEADER **a, unsigned char **pp, + long length) { M_ASN1_D2I_vars(a,ASN1_HEADER *,ASN1_HEADER_new); @@ -107,9 +96,10 @@ long length; M_ASN1_D2I_Finish(a,ASN1_HEADER_free,ASN1_F_D2I_ASN1_HEADER); } -ASN1_HEADER *ASN1_HEADER_new() +ASN1_HEADER *ASN1_HEADER_new(void) { ASN1_HEADER *ret=NULL; + ASN1_CTX c; M_ASN1_New_Malloc(ret,ASN1_HEADER); M_ASN1_New(ret->header,ASN1_OCTET_STRING_new); @@ -119,8 +109,7 @@ ASN1_HEADER *ASN1_HEADER_new() M_ASN1_New_Error(ASN1_F_ASN1_HEADER_NEW); } -void ASN1_HEADER_free(a) -ASN1_HEADER *a; +void ASN1_HEADER_free(ASN1_HEADER *a) { if (a == NULL) return; 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 @@ #include #include "cryptlib.h" -#include "buffer.h" -#include "asn1_mac.h" +#include +#include #ifndef NO_FP_API -int ASN1_i2d_fp(i2d,out,x) -int (*i2d)(); -FILE *out; -unsigned char *x; +int ASN1_i2d_fp(int (*i2d)(), FILE *out, unsigned char *x) { BIO *b; int ret; @@ -82,10 +79,7 @@ unsigned char *x; } #endif -int ASN1_i2d_bio(i2d,out,x) -int (*i2d)(); -BIO *out; -unsigned char *x; +int ASN1_i2d_bio(int (*i2d)(), BIO *out, unsigned char *x) { char *b; 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 @@ #include #include "cryptlib.h" -#include "asn1.h" +#include -/* ASN1err(ASN1_F_D2I_ASN1_INTEGER,ASN1_R_EXPECTING_AN_INTEGER); +/* + * This converts an ASN1 INTEGER into its DER encoding. + * The internal representation is an ASN1_STRING whose data is a big endian + * representation of the value, ignoring the sign. The sign is determined by + * the type: V_ASN1_INTEGER for positive and V_ASN1_NEG_INTEGER for negative. + * + * Positive integers are no problem: they are almost the same as the DER + * encoding, except if the first byte is >= 0x80 we need to add a zero pad. + * + * Negative integers are a bit trickier... + * The DER representation of negative integers is in 2s complement form. + * The internal form is converted by complementing each octet and finally + * adding one to the result. This can be done less messily with a little trick. + * If the internal form has trailing zeroes then they will become FF by the + * complement and 0 by the add one (due to carry) so just copy as many trailing + * zeros to the destination as there are in the source. The carry will add one + * to the last none zero octet: so complement this octet and add one and finally + * complement any left over until you get to the start of the string. + * + * Padding is a little trickier too. If the first bytes is > 0x80 then we pad + * with 0xff. However if the first byte is 0x80 and one of the following bytes + * is non-zero we pad with 0xff. The reason for this distinction is that 0x80 + * followed by optional zeros isn't padded. */ -int i2d_ASN1_INTEGER(a,pp) -ASN1_INTEGER *a; -unsigned char **pp; +int i2d_ASN1_INTEGER(ASN1_INTEGER *a, unsigned char **pp) { int pad=0,ret,r,i,t; - unsigned char *p,*pt,*n,pb=0; + unsigned char *p,*n,pb=0; if ((a == NULL) || (a->data == NULL)) return(0); t=a->type; @@ -78,16 +98,25 @@ unsigned char **pp; { ret=a->length; i=a->data[0]; - if ((t == V_ASN1_INTEGER) && (i > 127)) - { + if ((t == V_ASN1_INTEGER) && (i > 127)) { pad=1; pb=0; + } else if(t == V_ASN1_NEG_INTEGER) { + if(i>128) { + pad=1; + pb=0xFF; + } else if(i == 128) { + /* + * Special case: if any other bytes non zero we pad: + * otherwise we don't. + */ + for(i = 1; i < a->length; i++) if(a->data[i]) { + pad=1; + pb=0xFF; + break; + } } - else if ((t == V_ASN1_NEG_INTEGER) && (i>128)) - { - pad=1; - pb=0xFF; - } + } ret+=pad; } r=ASN1_object_size(0,ret,V_ASN1_INTEGER); @@ -96,33 +125,35 @@ unsigned char **pp; ASN1_put_object(&p,0,ret,V_ASN1_INTEGER,V_ASN1_UNIVERSAL); if (pad) *(p++)=pb; - if (a->length == 0) - *(p++)=0; - else if (t == V_ASN1_INTEGER) - { - memcpy(p,a->data,(unsigned int)a->length); - p+=a->length; - } - else - { - n=a->data; - pt=p; - for (i=a->length; i>0; i--) - *(p++)= (*(n++)^0xFF)+1; - if (!pad) *pt|=0x80; + if (a->length == 0) *(p++)=0; + else if (t == V_ASN1_INTEGER) memcpy(p,a->data,(unsigned int)a->length); + else { + /* Begin at the end of the encoding */ + n=a->data + a->length - 1; + p += a->length - 1; + i = a->length; + /* Copy zeros to destination as long as source is zero */ + while(!*n) { + *(p--) = 0; + n--; + i--; } + /* Complement and increment next octet */ + *(p--) = ((*(n--)) ^ 0xff) + 1; + i--; + /* Complement any octets left */ + for(;i > 0; i--) *(p--) = *(n--) ^ 0xff; + } - *pp=p; + *pp+=r; return(r); } -ASN1_INTEGER *d2i_ASN1_INTEGER(a, pp, length) -ASN1_INTEGER **a; -unsigned char **pp; -long length; +ASN1_INTEGER *d2i_ASN1_INTEGER(ASN1_INTEGER **a, unsigned char **pp, + long length) { ASN1_INTEGER *ret=NULL; - unsigned char *p,*to,*s; + unsigned char *p,*to,*s, *pend; long len; int inf,tag,xclass; int i; @@ -137,6 +168,7 @@ long length; p= *pp; inf=ASN1_get_object(&p,&len,&tag,&xclass,length); + pend = p + len; if (inf & 0x80) { i=ASN1_R_BAD_OBJECT_HEADER; @@ -161,16 +193,102 @@ long length; if (*p & 0x80) /* a negative number */ { ret->type=V_ASN1_NEG_INTEGER; - if (*p == 0xff) + if ((*p == 0xff) && (len != 1)) { + p++; + len--; + } + i = len; + p += i - 1; + to += i - 1; + while((!*p) && i) { + *(to--) = 0; + i--; + p--; + } + /* Special case: if all zeros then the number will be of + * the form FF followed by n zero bytes: this corresponds to + * 1 followed by n zero bytes. We've already written n zeros + * so we just append an extra one and set the first byte to + * a 1. This is treated separately because it is the only case + * where the number of bytes is larger than len. + */ + if(!i) { + *s = 1; + s[len] = 0; + len++; + } else { + *(to--) = (*(p--) ^ 0xff) + 1; + i--; + for(;i > 0; i--) *(to--) = *(p--) ^ 0xff; + } + } else { + ret->type=V_ASN1_INTEGER; + if ((*p == 0) && (len != 1)) { p++; len--; } - for (i=(int)len; i>0; i--) - *(to++)= (*(p++)^0xFF)+1; + memcpy(s,p,(int)len); + } + + if (ret->data != NULL) Free((char *)ret->data); + ret->data=s; + ret->length=(int)len; + if (a != NULL) (*a)=ret; + *pp=pend; + return(ret); +err: + ASN1err(ASN1_F_D2I_ASN1_INTEGER,i); + if ((ret != NULL) && ((a == NULL) || (*a != ret))) + ASN1_INTEGER_free(ret); + return(NULL); + } + +/* This is a version of d2i_ASN1_INTEGER that ignores the sign bit of + * ASN1 integers: some broken software can encode a positive INTEGER + * with its MSB set as negative (it doesn't add a padding zero). + */ + +ASN1_INTEGER *d2i_ASN1_UINTEGER(ASN1_INTEGER **a, unsigned char **pp, + long length) + { + ASN1_INTEGER *ret=NULL; + unsigned char *p,*to,*s; + long len; + int inf,tag,xclass; + int i; + + if ((a == NULL) || ((*a) == NULL)) + { + if ((ret=ASN1_INTEGER_new()) == NULL) return(NULL); + ret->type=V_ASN1_INTEGER; } else + ret=(*a); + + p= *pp; + inf=ASN1_get_object(&p,&len,&tag,&xclass,length); + if (inf & 0x80) + { + i=ASN1_R_BAD_OBJECT_HEADER; + goto err; + } + + if (tag != V_ASN1_INTEGER) { + i=ASN1_R_EXPECTING_AN_INTEGER; + goto err; + } + + /* We must Malloc stuff, even for 0 bytes otherwise it + * signifies a missing NULL parameter. */ + s=(unsigned char *)Malloc((int)len+1); + if (s == NULL) + { + i=ERR_R_MALLOC_FAILURE; + goto err; + } + to=s; ret->type=V_ASN1_INTEGER; if ((*p == 0) && (len != 1)) { @@ -179,7 +297,6 @@ long length; } memcpy(s,p,(int)len); p+=len; - } if (ret->data != NULL) Free((char *)ret->data); ret->data=s; @@ -188,15 +305,13 @@ long length; *pp=p; return(ret); err: - ASN1err(ASN1_F_D2I_ASN1_INTEGER,i); + ASN1err(ASN1_F_D2I_ASN1_UINTEGER,i); if ((ret != NULL) && ((a == NULL) || (*a != ret))) ASN1_INTEGER_free(ret); return(NULL); } -int ASN1_INTEGER_set(a,v) -ASN1_INTEGER *a; -long v; +int ASN1_INTEGER_set(ASN1_INTEGER *a, long v) { int i,j,k; unsigned char buf[sizeof(long)+1]; @@ -229,15 +344,13 @@ long v; d>>=8; } j=0; - if (v < 0) a->data[j++]=0; for (k=i-1; k >=0; k--) a->data[j++]=buf[k]; a->length=j; return(1); } -long ASN1_INTEGER_get(a) -ASN1_INTEGER *a; +long ASN1_INTEGER_get(ASN1_INTEGER *a) { int neg=0,i; long r=0; @@ -266,9 +379,7 @@ ASN1_INTEGER *a; return(r); } -ASN1_INTEGER *BN_to_ASN1_INTEGER(bn,ai) -BIGNUM *bn; -ASN1_INTEGER *ai; +ASN1_INTEGER *BN_to_ASN1_INTEGER(BIGNUM *bn, ASN1_INTEGER *ai) { ASN1_INTEGER *ret; int len,j; @@ -279,10 +390,11 @@ ASN1_INTEGER *ai; ret=ai; if (ret == NULL) { - ASN1err(ASN1_F_BN_TO_ASN1_INTEGER,ASN1_R_ERROR_STACK); + ASN1err(ASN1_F_BN_TO_ASN1_INTEGER,ERR_R_NESTED_ASN1_ERROR); goto err; } - ret->type=V_ASN1_INTEGER; + if(bn->neg) ret->type = V_ASN1_NEG_INTEGER; + else ret->type=V_ASN1_INTEGER; j=BN_num_bits(bn); len=((j == 0)?0:((j/8)+1)); ret->data=(unsigned char *)Malloc(len+4); @@ -293,13 +405,12 @@ err: return(NULL); } -BIGNUM *ASN1_INTEGER_to_BN(ai,bn) -ASN1_INTEGER *ai; -BIGNUM *bn; +BIGNUM *ASN1_INTEGER_to_BN(ASN1_INTEGER *ai, BIGNUM *bn) { BIGNUM *ret; if ((ret=BN_bin2bn(ai->data,ai->length,bn)) == NULL) ASN1err(ASN1_F_ASN1_INTEGER_TO_BN,ASN1_R_BN_LIB); + if(ai->type == V_ASN1_NEG_INTEGER) bn->neg = 1; return(ret); } 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 @@ #include #include "cryptlib.h" -#include "buffer.h" -#include "x509.h" +#include +#include static ASN1_METHOD ia5string_meth={ (int (*)()) i2d_ASN1_IA5STRING, @@ -73,12 +73,12 @@ static ASN1_METHOD bit_string_meth={ (char *(*)()) ASN1_STRING_new, (void (*)()) ASN1_STRING_free}; -ASN1_METHOD *ASN1_IA5STRING_asn1_meth() +ASN1_METHOD *ASN1_IA5STRING_asn1_meth(void) { return(&ia5string_meth); } -ASN1_METHOD *ASN1_BIT_STRING_asn1_meth() +ASN1_METHOD *ASN1_BIT_STRING_asn1_meth(void) { return(&bit_string_meth); } 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 @@ #include #include "cryptlib.h" -#include "buffer.h" -#include "asn1.h" -#include "objects.h" +#include +#include +#include -/* ASN1err(ASN1_F_ASN1_OBJECT_NEW,ASN1_R_EXPECTING_AN_OBJECT); - * ASN1err(ASN1_F_D2I_ASN1_OBJECT,ASN1_R_BAD_OBJECT_HEADER); - * ASN1err(ASN1_F_I2T_ASN1_OBJECT,ASN1_R_BAD_OBJECT_HEADER); - */ - -int i2d_ASN1_OBJECT(a, pp) -ASN1_OBJECT *a; -unsigned char **pp; +int i2d_ASN1_OBJECT(ASN1_OBJECT *a, unsigned char **pp) { unsigned char *p; @@ -87,14 +80,11 @@ unsigned char **pp; return(a->length); } -int a2d_ASN1_OBJECT(out,olen,buf,num) -unsigned char *out; -int olen; -char *buf; -int num; +int a2d_ASN1_OBJECT(unsigned char *out, int olen, const char *buf, int num) { int i,first,len=0,c; - char tmp[24],*p; + char tmp[24]; + const char *p; unsigned long l; if (num == 0) @@ -180,85 +170,12 @@ err: return(0); } -int i2t_ASN1_OBJECT(buf,buf_len,a) -char *buf; -int buf_len; -ASN1_OBJECT *a; - { - int i,idx=0,n=0,len,nid; - unsigned long l; - unsigned char *p; - char *s; - char tbuf[32]; - - if (buf_len <= 0) return(0); - - if ((a == NULL) || (a->data == NULL)) - { - buf[0]='\0'; - return(0); - } - - nid=OBJ_obj2nid(a); - if (nid == NID_undef) - { - len=a->length; - p=a->data; - - idx=0; - l=0; - while (idx < a->length) - { - l|=(p[idx]&0x7f); - if (!(p[idx] & 0x80)) break; - l<<=7L; - idx++; - } - idx++; - i=(int)(l/40); - if (i > 2) i=2; - l-=(long)(i*40); - - sprintf(tbuf,"%d.%ld",i,l); - i=strlen(tbuf); - strncpy(buf,tbuf,buf_len); - buf_len-=i; - buf+=i; - n+=i; - - l=0; - for (; idx 0) - strncpy(buf,tbuf,buf_len); - buf_len-=i; - buf+=i; - n+=i; - l=0; - } - l<<=7L; - } - } - else - { - s=(char *)OBJ_nid2ln(nid); - if (s == NULL) - s=(char *)OBJ_nid2sn(nid); - strncpy(buf,s,buf_len); - n=strlen(s); - } - buf[buf_len-1]='\0'; - return(n); - } +int i2t_ASN1_OBJECT(char *buf, int buf_len, ASN1_OBJECT *a) +{ + return OBJ_obj2txt(buf, buf_len, a, 0); +} -int i2a_ASN1_OBJECT(bp,a) -BIO *bp; -ASN1_OBJECT *a; +int i2a_ASN1_OBJECT(BIO *bp, ASN1_OBJECT *a) { char buf[80]; int i; @@ -271,10 +188,8 @@ ASN1_OBJECT *a; return(i); } -ASN1_OBJECT *d2i_ASN1_OBJECT(a, pp, length) -ASN1_OBJECT **a; -unsigned char **pp; -long length; +ASN1_OBJECT *d2i_ASN1_OBJECT(ASN1_OBJECT **a, unsigned char **pp, + long length) { ASN1_OBJECT *ret=NULL; unsigned char *p; @@ -330,7 +245,7 @@ err: return(NULL); } -ASN1_OBJECT *ASN1_OBJECT_new() +ASN1_OBJECT *ASN1_OBJECT_new(void) { ASN1_OBJECT *ret; @@ -349,14 +264,15 @@ ASN1_OBJECT *ASN1_OBJECT_new() return(ret); } -void ASN1_OBJECT_free(a) -ASN1_OBJECT *a; +void ASN1_OBJECT_free(ASN1_OBJECT *a) { if (a == NULL) return; if (a->flags & ASN1_OBJECT_FLAG_DYNAMIC_STRINGS) { - if (a->sn != NULL) Free(a->sn); - if (a->ln != NULL) Free(a->ln); +#ifndef CONST_STRICT /* disable purely for compile-time strict const checking. Doing this on a "real" compile will cause mempory leaks */ + if (a->sn != NULL) Free((void *)a->sn); + if (a->ln != NULL) Free((void *)a->ln); +#endif a->sn=a->ln=NULL; } if (a->flags & ASN1_OBJECT_FLAG_DYNAMIC_DATA) @@ -366,14 +282,11 @@ ASN1_OBJECT *a; a->length=0; } if (a->flags & ASN1_OBJECT_FLAG_DYNAMIC) - Free((char *)a); + Free(a); } -ASN1_OBJECT *ASN1_OBJECT_create(nid,data,len,sn,ln) -int nid; -unsigned char *data; -int len; -char *sn,*ln; +ASN1_OBJECT *ASN1_OBJECT_create(int nid, unsigned char *data, int len, + char *sn, char *ln) { ASN1_OBJECT o; @@ -382,8 +295,10 @@ char *sn,*ln; o.data=data; o.nid=nid; o.length=len; - o.flags=ASN1_OBJECT_FLAG_DYNAMIC| - ASN1_OBJECT_FLAG_DYNAMIC_STRINGS|ASN1_OBJECT_FLAG_DYNAMIC_DATA; + o.flags=ASN1_OBJECT_FLAG_DYNAMIC|ASN1_OBJECT_FLAG_DYNAMIC_STRINGS| + ASN1_OBJECT_FLAG_DYNAMIC_DATA; return(OBJ_dup(&o)); } +IMPLEMENT_STACK_OF(ASN1_OBJECT) +IMPLEMENT_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 @@ #include #include "cryptlib.h" -#include "asn1.h" +#include -/* ASN1err(ASN1_F_D2I_ASN1_OCTET_STRING,ASN1_R_EXPECTING_AN_OCTET_STRING); - */ - -int i2d_ASN1_OCTET_STRING(a, pp) -ASN1_OCTET_STRING *a; -unsigned char **pp; +int i2d_ASN1_OCTET_STRING(ASN1_OCTET_STRING *a, unsigned char **pp) { return(i2d_ASN1_bytes((ASN1_STRING *)a,pp, V_ASN1_OCTET_STRING,V_ASN1_UNIVERSAL)); } -ASN1_OCTET_STRING *d2i_ASN1_OCTET_STRING(a, pp, length) -ASN1_OCTET_STRING **a; -unsigned char **pp; -long length; +ASN1_OCTET_STRING *d2i_ASN1_OCTET_STRING(ASN1_OCTET_STRING **a, + unsigned char **pp, long length) { ASN1_OCTET_STRING *ret=NULL; @@ -82,7 +75,7 @@ long length; pp,length,V_ASN1_OCTET_STRING,V_ASN1_UNIVERSAL); if (ret == NULL) { - ASN1err(ASN1_F_D2I_ASN1_OCTET_STRING,ASN1_R_ERROR_STACK); + ASN1err(ASN1_F_D2I_ASN1_OCTET_STRING,ERR_R_NESTED_ASN1_ERROR); return(NULL); } 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 @@ #include #include "cryptlib.h" -#include "asn1.h" +#include -/* ASN1err(ASN1_F_D2I_ASN1_PRINT_TYPE,ASN1_R_WRONG_PRINTABLE_TYPE); - * ASN1err(ASN1_F_D2I_ASN1_PRINT_TYPE,ASN1_R_TAG_VALUE_TOO_HIGH); - */ - -int i2d_ASN1_IA5STRING(a,pp) -ASN1_IA5STRING *a; -unsigned char **pp; +int i2d_ASN1_IA5STRING(ASN1_IA5STRING *a, unsigned char **pp) { return(M_i2d_ASN1_IA5STRING(a,pp)); } -ASN1_IA5STRING *d2i_ASN1_IA5STRING(a,pp,l) -ASN1_IA5STRING **a; -unsigned char **pp; -long l; +ASN1_IA5STRING *d2i_ASN1_IA5STRING(ASN1_IA5STRING **a, unsigned char **pp, + long l) { return(M_d2i_ASN1_IA5STRING(a,pp,l)); } -ASN1_T61STRING *d2i_ASN1_T61STRING(a,pp,l) -ASN1_T61STRING **a; -unsigned char **pp; -long l; +ASN1_T61STRING *d2i_ASN1_T61STRING(ASN1_T61STRING **a, unsigned char **pp, + long l) { return(M_d2i_ASN1_T61STRING(a,pp,l)); } -ASN1_PRINTABLESTRING *d2i_ASN1_PRINTABLESTRING(a,pp,l) -ASN1_PRINTABLESTRING **a; -unsigned char **pp; -long l; - { return(M_d2i_ASN1_PRINTABLESTRING(a,pp,l)); } +ASN1_PRINTABLESTRING *d2i_ASN1_PRINTABLESTRING(ASN1_PRINTABLESTRING **a, + unsigned char **pp, long l) + { return(M_d2i_ASN1_PRINTABLESTRING(a,pp, + l)); } -int i2d_ASN1_PRINTABLE(a,pp) -ASN1_STRING *a; -unsigned char **pp; +int i2d_ASN1_PRINTABLE(ASN1_STRING *a, unsigned char **pp) { return(M_i2d_ASN1_PRINTABLE(a,pp)); } -ASN1_STRING *d2i_ASN1_PRINTABLE(a,pp,l) -ASN1_STRING **a; -unsigned char **pp; -long l; +ASN1_STRING *d2i_ASN1_PRINTABLE(ASN1_STRING **a, unsigned char **pp, + long l) { return(M_d2i_ASN1_PRINTABLE(a,pp,l)); } -int ASN1_PRINTABLE_type(s,len) -unsigned char *s; -int len; +int ASN1_PRINTABLE_type(unsigned char *s, int len) { int c; int ia5=0; @@ -112,6 +95,7 @@ int len; while ((*s) && (len-- != 0)) { c= *(s++); +#ifndef CHARSET_EBCDIC if (!( ((c >= 'a') && (c <= 'z')) || ((c >= 'A') && (c <= 'Z')) || (c == ' ') || @@ -125,14 +109,20 @@ int len; ia5=1; if (c&0x80) t61=1; +#else + if (!isalnum(c) && (c != ' ') && + strchr("'()+,-./:=?", c) == NULL) + ia5=1; + if (os_toascii[c] & 0x80) + t61=1; +#endif } if (t61) return(V_ASN1_T61STRING); if (ia5) return(V_ASN1_IA5STRING); return(V_ASN1_PRINTABLESTRING); } -int ASN1_UNIVERSALSTRING_to_string(s) -ASN1_UNIVERSALSTRING *s; +int ASN1_UNIVERSALSTRING_to_string(ASN1_UNIVERSALSTRING *s) { int i; unsigned char *p; @@ -159,3 +149,17 @@ ASN1_UNIVERSALSTRING *s; return(1); } + +int i2d_DIRECTORYSTRING(ASN1_STRING *a, unsigned char **pp) + { return(M_i2d_DIRECTORYSTRING(a,pp)); } + +ASN1_STRING *d2i_DIRECTORYSTRING(ASN1_STRING **a, unsigned char **pp, + long l) + { return(M_d2i_DIRECTORYSTRING(a,pp,l)); } + +int i2d_DISPLAYTEXT(ASN1_STRING *a, unsigned char **pp) + { return(M_i2d_DISPLAYTEXT(a,pp)); } + +ASN1_STRING *d2i_DISPLAYTEXT(ASN1_STRING **a, unsigned char **pp, + long l) + { 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 @@ #include #include "cryptlib.h" -#include "asn1_mac.h" +#include -/* ASN1err(ASN1_F_ASN1_TYPE_NEW,ERR_R_MALLOC_FAILURE); +typedef struct + { + unsigned char *pbData; + int cbData; + } MYBLOB; + +/* SetBlobCmp + * This function compares two elements of SET_OF block */ +static int SetBlobCmp(const void *elem1, const void *elem2 ) + { + const MYBLOB *b1 = (const MYBLOB *)elem1; + const MYBLOB *b2 = (const MYBLOB *)elem2; + int r; + + r = memcmp(b1->pbData, b2->pbData, + b1->cbData < b2->cbData ? b1->cbData : b2->cbData); + if(r != 0) + return r; + return b1->cbData-b2->cbData; + } -int i2d_ASN1_SET(a,pp,func,ex_tag,ex_class) -STACK *a; -unsigned char **pp; -int (*func)(); -int ex_tag; -int ex_class; +/* int is_set: if TRUE, then sort the contents (i.e. it isn't a SEQUENCE) */ +int i2d_ASN1_SET(STACK *a, unsigned char **pp, int (*func)(), int ex_tag, + int ex_class, int is_set) { int ret=0,r; int i; unsigned char *p; + unsigned char *pStart, *pTempMem; + MYBLOB *rgSetBlob; + int totSize; if (a == NULL) return(0); for (i=sk_num(a)-1; i>=0; i--) @@ -82,20 +101,58 @@ int ex_class; p= *pp; ASN1_put_object(&p,1,ret,ex_tag,ex_class); - for (i=0; i #include "cryptlib.h" -#include "bn.h" -#include "evp.h" -#include "x509.h" -#include "objects.h" -#include "buffer.h" -#include "pem.h" +#include +#include +#include +#include +#include -int ASN1_sign(i2d,algor1,algor2,signature,data,pkey,type) -int (*i2d)(); -X509_ALGOR *algor1; -X509_ALGOR *algor2; -ASN1_BIT_STRING *signature; -char *data; -EVP_PKEY *pkey; -EVP_MD *type; +int ASN1_sign(int (*i2d)(), X509_ALGOR *algor1, X509_ALGOR *algor2, + ASN1_BIT_STRING *signature, char *data, EVP_PKEY *pkey, + const EVP_MD *type) { EVP_MD_CTX ctx; unsigned char *p,*buf_in=NULL,*buf_out=NULL; @@ -136,7 +130,11 @@ EVP_MD *type; signature->data=buf_out; buf_out=NULL; signature->length=outl; - + /* In the interests of compatability, I'll make sure that + * the bit string has a 'not-used bits' value of 0 + */ + signature->flags&= ~(ASN1_STRING_FLAG_BITS_LEFT|0x07); + signature->flags|=ASN1_STRING_FLAG_BITS_LEFT; err: memset(&ctx,0,sizeof(ctx)); 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 @@ +/* crypto/asn1/a_time.c */ +/* ==================================================================== + * Copyright (c) 1999 The OpenSSL Project. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * 3. All advertising materials mentioning features or use of this + * software must display the following acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" + * + * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to + * endorse or promote products derived from this software without + * prior written permission. For written permission, please contact + * licensing@OpenSSL.org. + * + * 5. Products derived from this software may not be called "OpenSSL" + * nor may "OpenSSL" appear in their names without prior written + * permission of the OpenSSL Project. + * + * 6. Redistributions of any form whatsoever must retain the following + * acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" + * + * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY + * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR + * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + * ==================================================================== + * + * This product includes cryptographic software written by Eric Young + * (eay@cryptsoft.com). This product includes software written by Tim + * Hudson (tjh@cryptsoft.com). + * + */ + + +/* This is an implementation of the ASN1 Time structure which is: + * Time ::= CHOICE { + * utcTime UTCTime, + * generalTime GeneralizedTime } + * written by Steve Henson. + */ + +#include +#include +#include "cryptlib.h" +#include + +int i2d_ASN1_TIME(ASN1_TIME *a, unsigned char **pp) + { +#ifdef CHARSET_EBCDIC + /* KLUDGE! We convert to ascii before writing DER */ + char tmp[24]; + ASN1_STRING tmpstr; + + if(a->type == V_ASN1_UTCTIME || a->type == V_ASN1_GENERALIZEDTIME) { + int len; + + tmpstr = *(ASN1_STRING *)a; + len = tmpstr.length; + ebcdic2ascii(tmp, tmpstr.data, (len >= sizeof tmp) ? sizeof tmp : len); + tmpstr.data = tmp; + a = (ASN1_GENERALIZEDTIME *) &tmpstr; + } +#endif + if(a->type == V_ASN1_UTCTIME || a->type == V_ASN1_GENERALIZEDTIME) + return(i2d_ASN1_bytes((ASN1_STRING *)a,pp, + a->type ,V_ASN1_UNIVERSAL)); + ASN1err(ASN1_F_I2D_ASN1_TIME,ASN1_R_EXPECTING_A_TIME); + return -1; + } + + +ASN1_TIME *d2i_ASN1_TIME(ASN1_TIME **a, unsigned char **pp, long length) + { + unsigned char tag; + tag = **pp & ~V_ASN1_CONSTRUCTED; + if(tag == (V_ASN1_UTCTIME|V_ASN1_UNIVERSAL)) + return d2i_ASN1_UTCTIME(a, pp, length); + if(tag == (V_ASN1_GENERALIZEDTIME|V_ASN1_UNIVERSAL)) + return d2i_ASN1_GENERALIZEDTIME(a, pp, length); + ASN1err(ASN1_F_D2I_ASN1_TIME,ASN1_R_EXPECTING_A_TIME); + return(NULL); + } + + +ASN1_TIME *ASN1_TIME_set(ASN1_TIME *s, time_t t) + { + struct tm *ts; +#if defined(THREADS) && !defined(WIN32) + struct tm data; +#endif + +#if defined(THREADS) && !defined(WIN32) + gmtime_r(&t,&data); + ts=&data; /* should return &data, but doesn't on some systems, so we don't even look at the return value */ +#else + ts=gmtime(&t); +#endif + if((ts->tm_year >= 50) && (ts->tm_year < 150)) + return ASN1_UTCTIME_set(s, t); + return ASN1_GENERALIZEDTIME_set(s,t); + } 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 @@ #include #include "cryptlib.h" -#include "asn1_mac.h" +#include -/* ASN1err(ASN1_F_ASN1_TYPE_NEW,ASN1_R_ERROR_STACK); - * ASN1err(ASN1_F_D2I_ASN1_BYTES,ASN1_R_ERROR_STACK); - * ASN1err(ASN1_F_D2I_ASN1_BYTES,ASN1_R_WRONG_TAG); - * ASN1err(ASN1_F_ASN1_COLLATE_PRIMATIVE,ASN1_R_WRONG_TAG); - */ - -#ifndef NOPROTO static void ASN1_TYPE_component_free(ASN1_TYPE *a); -#else -static void ASN1_TYPE_component_free(); -#endif - -int i2d_ASN1_TYPE(a,pp) -ASN1_TYPE *a; -unsigned char **pp; +int i2d_ASN1_TYPE(ASN1_TYPE *a, unsigned char **pp) { int r=0; @@ -91,6 +78,10 @@ unsigned char **pp; case V_ASN1_NEG_INTEGER: r=i2d_ASN1_INTEGER(a->value.integer,pp); break; + case V_ASN1_ENUMERATED: + case V_ASN1_NEG_ENUMERATED: + r=i2d_ASN1_ENUMERATED(a->value.enumerated,pp); + break; case V_ASN1_BIT_STRING: r=i2d_ASN1_BIT_STRING(a->value.bit_string,pp); break; @@ -115,12 +106,21 @@ unsigned char **pp; case V_ASN1_UNIVERSALSTRING: r=M_i2d_ASN1_UNIVERSALSTRING(a->value.universalstring,pp); break; + case V_ASN1_UTF8STRING: + r=M_i2d_ASN1_UTF8STRING(a->value.utf8string,pp); + break; + case V_ASN1_VISIBLESTRING: + r=M_i2d_ASN1_VISIBLESTRING(a->value.visiblestring,pp); + break; case V_ASN1_BMPSTRING: r=M_i2d_ASN1_BMPSTRING(a->value.bmpstring,pp); break; case V_ASN1_UTCTIME: r=i2d_ASN1_UTCTIME(a->value.utctime,pp); break; + case V_ASN1_GENERALIZEDTIME: + r=i2d_ASN1_GENERALIZEDTIME(a->value.generalizedtime,pp); + break; case V_ASN1_SET: case V_ASN1_SEQUENCE: if (a->value.set == NULL) @@ -139,10 +139,7 @@ unsigned char **pp; return(r); } -ASN1_TYPE *d2i_ASN1_TYPE(a,pp,length) -ASN1_TYPE **a; -unsigned char **pp; -long length; +ASN1_TYPE *d2i_ASN1_TYPE(ASN1_TYPE **a, unsigned char **pp, long length) { ASN1_TYPE *ret=NULL; unsigned char *q,*p,*max; @@ -176,6 +173,11 @@ long length; d2i_ASN1_INTEGER(NULL,&p,max-p)) == NULL) goto err; break; + case V_ASN1_ENUMERATED: + if ((ret->value.enumerated= + d2i_ASN1_ENUMERATED(NULL,&p,max-p)) == NULL) + goto err; + break; case V_ASN1_BIT_STRING: if ((ret->value.bit_string= d2i_ASN1_BIT_STRING(NULL,&p,max-p)) == NULL) @@ -186,6 +188,16 @@ long length; d2i_ASN1_OCTET_STRING(NULL,&p,max-p)) == NULL) goto err; break; + case V_ASN1_VISIBLESTRING: + if ((ret->value.visiblestring= + d2i_ASN1_VISIBLESTRING(NULL,&p,max-p)) == NULL) + goto err; + break; + case V_ASN1_UTF8STRING: + if ((ret->value.utf8string= + d2i_ASN1_UTF8STRING(NULL,&p,max-p)) == NULL) + goto err; + break; case V_ASN1_OBJECT: if ((ret->value.object= d2i_ASN1_OBJECT(NULL,&p,max-p)) == NULL) @@ -226,6 +238,11 @@ long length; d2i_ASN1_UTCTIME(NULL,&p,max-p)) == NULL) goto err; break; + case V_ASN1_GENERALIZEDTIME: + if ((ret->value.generalizedtime= + d2i_ASN1_GENERALIZEDTIME(NULL,&p,max-p)) == NULL) + goto err; + break; case V_ASN1_SET: case V_ASN1_SEQUENCE: /* Sets and sequences are left complete */ @@ -249,9 +266,10 @@ err: return(NULL); } -ASN1_TYPE *ASN1_TYPE_new() +ASN1_TYPE *ASN1_TYPE_new(void) { ASN1_TYPE *ret=NULL; + ASN1_CTX c; M_ASN1_New_Malloc(ret,ASN1_TYPE); ret->type= -1; @@ -260,16 +278,14 @@ ASN1_TYPE *ASN1_TYPE_new() M_ASN1_New_Error(ASN1_F_ASN1_TYPE_NEW); } -void ASN1_TYPE_free(a) -ASN1_TYPE *a; +void ASN1_TYPE_free(ASN1_TYPE *a) { if (a == NULL) return; ASN1_TYPE_component_free(a); Free((char *)(char *)a); } -int ASN1_TYPE_get(a) -ASN1_TYPE *a; +int ASN1_TYPE_get(ASN1_TYPE *a) { if (a->value.ptr != NULL) return(a->type); @@ -277,10 +293,7 @@ ASN1_TYPE *a; return(0); } -void ASN1_TYPE_set(a,type,value) -ASN1_TYPE *a; -int type; -char *value; +void ASN1_TYPE_set(ASN1_TYPE *a, int type, void *value) { if (a->value.ptr != NULL) ASN1_TYPE_component_free(a); @@ -288,8 +301,7 @@ char *value; a->value.ptr=value; } -static void ASN1_TYPE_component_free(a) -ASN1_TYPE *a; +static void ASN1_TYPE_component_free(ASN1_TYPE *a) { if (a == NULL) return; @@ -302,16 +314,25 @@ ASN1_TYPE *a; break; case V_ASN1_INTEGER: case V_ASN1_NEG_INTEGER: + case V_ASN1_ENUMERATED: + case V_ASN1_NEG_ENUMERATED: case V_ASN1_BIT_STRING: case V_ASN1_OCTET_STRING: + case V_ASN1_SEQUENCE: + case V_ASN1_SET: + case V_ASN1_NUMERICSTRING: case V_ASN1_PRINTABLESTRING: case V_ASN1_T61STRING: + case V_ASN1_VIDEOTEXSTRING: case V_ASN1_IA5STRING: - case V_ASN1_UNIVERSALSTRING: - case V_ASN1_GENERALSTRING: case V_ASN1_UTCTIME: - case V_ASN1_SET: - case V_ASN1_SEQUENCE: + case V_ASN1_GENERALIZEDTIME: + case V_ASN1_GRAPHICSTRING: + case V_ASN1_VISIBLESTRING: + case V_ASN1_GENERALSTRING: + case V_ASN1_UNIVERSALSTRING: + case V_ASN1_BMPSTRING: + case V_ASN1_UTF8STRING: ASN1_STRING_free((ASN1_STRING *)a->value.ptr); break; default: @@ -323,3 +344,5 @@ ASN1_TYPE *a; } } +IMPLEMENT_STACK_OF(ASN1_TYPE) +IMPLEMENT_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 @@ #include #include +#ifdef VMS +#include +#include +#include +#endif #include "cryptlib.h" -#include "asn1.h" - -/* ASN1err(ASN1_F_ASN1_UTCTIME_NEW,ASN1_R_UTCTIME_TOO_LONG); - * ASN1err(ASN1_F_D2I_ASN1_UTCTIME,ASN1_R_EXPECTING_A_UTCTIME); - */ +#include -int i2d_ASN1_UTCTIME(a,pp) -ASN1_UTCTIME *a; -unsigned char **pp; +int i2d_ASN1_UTCTIME(ASN1_UTCTIME *a, unsigned char **pp) { +#ifndef CHARSET_EBCDIC return(i2d_ASN1_bytes((ASN1_STRING *)a,pp, V_ASN1_UTCTIME,V_ASN1_UNIVERSAL)); +#else + /* KLUDGE! We convert to ascii before writing DER */ + int len; + char tmp[24]; + ASN1_STRING x = *(ASN1_STRING *)a; + + len = x.length; + ebcdic2ascii(tmp, x.data, (len >= sizeof tmp) ? sizeof tmp : len); + x.data = tmp; + return i2d_ASN1_bytes(&x, pp, V_ASN1_UTCTIME,V_ASN1_UNIVERSAL); +#endif } -ASN1_UTCTIME *d2i_ASN1_UTCTIME(a, pp, length) -ASN1_UTCTIME **a; -unsigned char **pp; -long length; +ASN1_UTCTIME *d2i_ASN1_UTCTIME(ASN1_UTCTIME **a, unsigned char **pp, + long length) { ASN1_UTCTIME *ret=NULL; @@ -85,9 +94,12 @@ long length; V_ASN1_UTCTIME,V_ASN1_UNIVERSAL); if (ret == NULL) { - ASN1err(ASN1_F_D2I_ASN1_UTCTIME,ASN1_R_ERROR_STACK); + ASN1err(ASN1_F_D2I_ASN1_UTCTIME,ERR_R_NESTED_ASN1_ERROR); return(NULL); } +#ifdef CHARSET_EBCDIC + ascii2ebcdic(ret->data, ret->data, ret->length); +#endif if (!ASN1_UTCTIME_check(ret)) { ASN1err(ASN1_F_D2I_ASN1_UTCTIME,ASN1_R_INVALID_TIME_FORMAT); @@ -101,8 +113,7 @@ err: return(NULL); } -int ASN1_UTCTIME_check(d) -ASN1_UTCTIME *d; +int ASN1_UTCTIME_check(ASN1_UTCTIME *d) { static int min[8]={ 0, 1, 1, 0, 0, 0, 0, 0}; static int max[8]={99,12,31,23,59,59,12,59}; @@ -152,9 +163,7 @@ err: return(0); } -int ASN1_UTCTIME_set_string(s,str) -ASN1_UTCTIME *s; -char *str; +int ASN1_UTCTIME_set_string(ASN1_UTCTIME *s, char *str) { ASN1_UTCTIME t; @@ -174,13 +183,11 @@ char *str; return(0); } -ASN1_UTCTIME *ASN1_UTCTIME_set(s, t) -ASN1_UTCTIME *s; -time_t t; +ASN1_UTCTIME *ASN1_UTCTIME_set(ASN1_UTCTIME *s, time_t t) { char *p; struct tm *ts; -#if defined(THREADS) +#if defined(THREADS) && !defined(WIN32) struct tm data; #endif @@ -189,10 +196,48 @@ time_t t; if (s == NULL) return(NULL); -#if defined(THREADS) - ts=(struct tm *)gmtime_r(&t,&data); +#if defined(THREADS) && !defined(WIN32) + gmtime_r(&t,&data); /* should return &data, but doesn't on some systems, so we don't even look at the return value */ + ts=&data; #else - ts=(struct tm *)gmtime(&t); + ts=gmtime(&t); +#endif +#ifdef VMS + if (ts == NULL) + { + static $DESCRIPTOR(tabnam,"LNM$DCL_LOGICAL"); + static $DESCRIPTOR(lognam,"SYS$TIMEZONE_DIFFERENTIAL"); + char result[256]; + unsigned int reslen = 0; + struct { + short buflen; + short code; + void *bufaddr; + unsigned int *reslen; + } itemlist[] = { + { 0, LNM$_STRING, 0, 0 }, + { 0, 0, 0, 0 }, + }; + int status; + + /* Get the value for SYS$TIMEZONE_DIFFERENTIAL */ + itemlist[0].buflen = sizeof(result); + itemlist[0].bufaddr = result; + itemlist[0].reslen = &reslen; + status = sys$trnlnm(0, &tabnam, &lognam, 0, itemlist); + if (!(status & 1)) + return NULL; + result[reslen] = '\0'; + + /* Get the numerical value of the equivalence string */ + status = atoi(result); + + /* and use it to move time to GMT */ + t -= status; + + /* then convert the result to the time structure */ + ts=(struct tm *)localtime(&t); + } #endif p=(char *)s->data; if ((p == NULL) || (s->length < 14)) @@ -208,5 +253,8 @@ time_t t; ts->tm_mon+1,ts->tm_mday,ts->tm_hour,ts->tm_min,ts->tm_sec); s->length=strlen(p); s->type=V_ASN1_UTCTIME; +#ifdef CHARSET_EBCDIC_not + ebcdic2ascii(s->data, s->data, s->length); +#endif return(s); } 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 @@ +/* crypto/asn1/a_utf8.c */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#include +#include "cryptlib.h" +#include + +int i2d_ASN1_UTF8STRING(ASN1_UTF8STRING *a, unsigned char **pp) + { + return(i2d_ASN1_bytes((ASN1_STRING *)a,pp, + V_ASN1_UTF8STRING,V_ASN1_UNIVERSAL)); + } + +ASN1_UTF8STRING *d2i_ASN1_UTF8STRING(ASN1_UTF8STRING **a, unsigned char **pp, + long length) + { + ASN1_UTF8STRING *ret=NULL; + + ret=(ASN1_UTF8STRING *)d2i_ASN1_bytes((ASN1_STRING **)a, + pp,length,V_ASN1_UTF8STRING,V_ASN1_UNIVERSAL); + if (ret == NULL) + { + ASN1err(ASN1_F_D2I_ASN1_UTF8STRING,ERR_R_NESTED_ASN1_ERROR); + return(NULL); + } + return(ret); + } + 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 @@ #include #include "cryptlib.h" -#include "bn.h" -#include "x509.h" -#include "objects.h" -#include "buffer.h" -#include "evp.h" -#include "pem.h" +#include +#include +#include +#include +#include -int ASN1_verify(i2d,a,signature,data,pkey) -int (*i2d)(); -X509_ALGOR *a; -ASN1_BIT_STRING *signature; -char *data; -EVP_PKEY *pkey; +int ASN1_verify(int (*i2d)(), X509_ALGOR *a, ASN1_BIT_STRING *signature, + char *data, EVP_PKEY *pkey) { EVP_MD_CTX ctx; - EVP_MD *type; + const EVP_MD *type; unsigned char *p,*buf_in=NULL; int ret= -1,i,inl; @@ -90,7 +85,7 @@ EVP_PKEY *pkey; } inl=i2d(data,NULL); - buf_in=(unsigned char *)Malloc((unsigned int)inl); + buf_in=Malloc((unsigned int)inl); if (buf_in == NULL) { 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 @@ +/* crypto/asn1/a_vis.c */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#include +#include "cryptlib.h" +#include + +int i2d_ASN1_VISIBLESTRING(ASN1_VISIBLESTRING *a, unsigned char **pp) + { + return(i2d_ASN1_bytes((ASN1_STRING *)a,pp, + V_ASN1_VISIBLESTRING,V_ASN1_UNIVERSAL)); + } + +ASN1_VISIBLESTRING *d2i_ASN1_VISIBLESTRING(ASN1_VISIBLESTRING **a, + unsigned char **pp, long length) + { + ASN1_VISIBLESTRING *ret=NULL; + + ret=(ASN1_VISIBLESTRING *)d2i_ASN1_bytes((ASN1_STRING **)a, + pp,length,V_ASN1_VISIBLESTRING,V_ASN1_UNIVERSAL); + if (ret == NULL) + { + ASN1err(ASN1_F_D2I_ASN1_VISIBLESTRING,ERR_R_NESTED_ASN1_ERROR); + return(NULL); + } + return(ret); + } + 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 @@ -/* Error codes for the ASN1 functions. */ - -/* Function codes. */ -#define ASN1_F_A2D_ASN1_OBJECT 100 -#define ASN1_F_A2I_ASN1_INTEGER 101 -#define ASN1_F_A2I_ASN1_STRING 102 -#define ASN1_F_ASN1_COLLATE_PRIMATIVE 103 -#define ASN1_F_ASN1_D2I_BIO 104 -#define ASN1_F_ASN1_D2I_FP 105 -#define ASN1_F_ASN1_DUP 106 -#define ASN1_F_ASN1_GET_OBJECT 107 -#define ASN1_F_ASN1_HEADER_NEW 108 -#define ASN1_F_ASN1_I2D_BIO 109 -#define ASN1_F_ASN1_I2D_FP 110 -#define ASN1_F_ASN1_INTEGER_SET 111 -#define ASN1_F_ASN1_INTEGER_TO_BN 112 -#define ASN1_F_ASN1_OBJECT_NEW 113 -#define ASN1_F_ASN1_SIGN 114 -#define ASN1_F_ASN1_STRING_NEW 115 -#define ASN1_F_ASN1_STRING_TYPE_NEW 116 -#define ASN1_F_ASN1_TYPE_GET_INT_OCTETSTRING 117 -#define ASN1_F_ASN1_TYPE_GET_OCTETSTRING 118 -#define ASN1_F_ASN1_TYPE_NEW 119 -#define ASN1_F_ASN1_UTCTIME_NEW 120 -#define ASN1_F_ASN1_VERIFY 121 -#define ASN1_F_BN_TO_ASN1_INTEGER 122 -#define ASN1_F_D2I_ASN1_BIT_STRING 123 -#define ASN1_F_D2I_ASN1_BMPSTRING 124 -#define ASN1_F_D2I_ASN1_BOOLEAN 125 -#define ASN1_F_D2I_ASN1_BYTES 126 -#define ASN1_F_D2I_ASN1_HEADER 127 -#define ASN1_F_D2I_ASN1_INTEGER 128 -#define ASN1_F_D2I_ASN1_OBJECT 129 -#define ASN1_F_D2I_ASN1_OCTET_STRING 130 -#define ASN1_F_D2I_ASN1_PRINT_TYPE 131 -#define ASN1_F_D2I_ASN1_SET 132 -#define ASN1_F_D2I_ASN1_TYPE 133 -#define ASN1_F_D2I_ASN1_TYPE_BYTES 134 -#define ASN1_F_D2I_ASN1_UTCTIME 135 -#define ASN1_F_D2I_DHPARAMS 136 -#define ASN1_F_D2I_DSAPARAMS 137 -#define ASN1_F_D2I_DSAPRIVATEKEY 138 -#define ASN1_F_D2I_DSAPUBLICKEY 139 -#define ASN1_F_D2I_NETSCAPE_PKEY 140 -#define ASN1_F_D2I_NETSCAPE_RSA 141 -#define ASN1_F_D2I_NETSCAPE_RSA_2 142 -#define ASN1_F_D2I_NETSCAPE_SPKAC 143 -#define ASN1_F_D2I_NETSCAPE_SPKI 144 -#define ASN1_F_D2I_PKCS7 145 -#define ASN1_F_D2I_PKCS7_DIGEST 146 -#define ASN1_F_D2I_PKCS7_ENCRYPT 147 -#define ASN1_F_D2I_PKCS7_ENC_CONTENT 148 -#define ASN1_F_D2I_PKCS7_ENVELOPE 149 -#define ASN1_F_D2I_PKCS7_ISSUER_AND_SERIAL 150 -#define ASN1_F_D2I_PKCS7_RECIP_INFO 151 -#define ASN1_F_D2I_PKCS7_SIGNED 152 -#define ASN1_F_D2I_PKCS7_SIGNER_INFO 153 -#define ASN1_F_D2I_PKCS7_SIGN_ENVELOPE 154 -#define ASN1_F_D2I_PRIVATEKEY 155 -#define ASN1_F_D2I_PUBLICKEY 156 -#define ASN1_F_D2I_RSAPRIVATEKEY 157 -#define ASN1_F_D2I_RSAPUBLICKEY 158 -#define ASN1_F_D2I_X509 159 -#define ASN1_F_D2I_X509_ALGOR 160 -#define ASN1_F_D2I_X509_ATTRIBUTE 161 -#define ASN1_F_D2I_X509_CINF 162 -#define ASN1_F_D2I_X509_CRL 163 -#define ASN1_F_D2I_X509_CRL_INFO 164 -#define ASN1_F_D2I_X509_EXTENSION 165 -#define ASN1_F_D2I_X509_KEY 166 -#define ASN1_F_D2I_X509_NAME 167 -#define ASN1_F_D2I_X509_NAME_ENTRY 168 -#define ASN1_F_D2I_X509_PKEY 169 -#define ASN1_F_D2I_X509_PUBKEY 170 -#define ASN1_F_D2I_X509_REQ 171 -#define ASN1_F_D2I_X509_REQ_INFO 172 -#define ASN1_F_D2I_X509_REVOKED 173 -#define ASN1_F_D2I_X509_SIG 174 -#define ASN1_F_D2I_X509_VAL 175 -#define ASN1_F_I2D_ASN1_HEADER 176 -#define ASN1_F_I2D_DHPARAMS 177 -#define ASN1_F_I2D_DSAPARAMS 178 -#define ASN1_F_I2D_DSAPRIVATEKEY 179 -#define ASN1_F_I2D_DSAPUBLICKEY 180 -#define ASN1_F_I2D_NETSCAPE_RSA 181 -#define ASN1_F_I2D_PKCS7 182 -#define ASN1_F_I2D_PRIVATEKEY 183 -#define ASN1_F_I2D_PUBLICKEY 184 -#define ASN1_F_I2D_RSAPRIVATEKEY 185 -#define ASN1_F_I2D_RSAPUBLICKEY 186 -#define ASN1_F_I2D_X509_ATTRIBUTE 187 -#define ASN1_F_I2T_ASN1_OBJECT 188 -#define ASN1_F_NETSCAPE_PKEY_NEW 189 -#define ASN1_F_NETSCAPE_SPKAC_NEW 190 -#define ASN1_F_NETSCAPE_SPKI_NEW 191 -#define ASN1_F_PKCS7_DIGEST_NEW 192 -#define ASN1_F_PKCS7_ENCRYPT_NEW 193 -#define ASN1_F_PKCS7_ENC_CONTENT_NEW 194 -#define ASN1_F_PKCS7_ENVELOPE_NEW 195 -#define ASN1_F_PKCS7_ISSUER_AND_SERIAL_NEW 196 -#define ASN1_F_PKCS7_NEW 197 -#define ASN1_F_PKCS7_RECIP_INFO_NEW 198 -#define ASN1_F_PKCS7_SIGNED_NEW 199 -#define ASN1_F_PKCS7_SIGNER_INFO_NEW 200 -#define ASN1_F_PKCS7_SIGN_ENVELOPE_NEW 201 -#define ASN1_F_X509_ALGOR_NEW 202 -#define ASN1_F_X509_ATTRIBUTE_NEW 203 -#define ASN1_F_X509_CINF_NEW 204 -#define ASN1_F_X509_CRL_INFO_NEW 205 -#define ASN1_F_X509_CRL_NEW 206 -#define ASN1_F_X509_DHPARAMS_NEW 207 -#define ASN1_F_X509_EXTENSION_NEW 208 -#define ASN1_F_X509_INFO_NEW 209 -#define ASN1_F_X509_KEY_NEW 210 -#define ASN1_F_X509_NAME_ENTRY_NEW 211 -#define ASN1_F_X509_NAME_NEW 212 -#define ASN1_F_X509_NEW 213 -#define ASN1_F_X509_PKEY_NEW 214 -#define ASN1_F_X509_PUBKEY_NEW 215 -#define ASN1_F_X509_REQ_INFO_NEW 216 -#define ASN1_F_X509_REQ_NEW 217 -#define ASN1_F_X509_REVOKED_NEW 218 -#define ASN1_F_X509_SIG_NEW 219 -#define ASN1_F_X509_VAL_FREE 220 -#define ASN1_F_X509_VAL_NEW 221 - -/* Reason codes. */ -#define ASN1_R_BAD_CLASS 100 -#define ASN1_R_BAD_GET_OBJECT 101 -#define ASN1_R_BAD_OBJECT_HEADER 102 -#define ASN1_R_BAD_PASSWORD_READ 103 -#define ASN1_R_BAD_PKCS7_CONTENT 104 -#define ASN1_R_BAD_PKCS7_TYPE 105 -#define ASN1_R_BAD_TAG 106 -#define ASN1_R_BAD_TYPE 107 -#define ASN1_R_BN_LIB 108 -#define ASN1_R_BOOLEAN_IS_WRONG_LENGTH 109 -#define ASN1_R_BUFFER_TOO_SMALL 110 -#define ASN1_R_DATA_IS_WRONG 111 -#define ASN1_R_DECODING_ERROR 112 -#define ASN1_R_ERROR_STACK 113 -#define ASN1_R_EXPECTING_AN_INTEGER 114 -#define ASN1_R_EXPECTING_AN_OBJECT 115 -#define ASN1_R_EXPECTING_AN_OCTET_STRING 116 -#define ASN1_R_EXPECTING_A_BIT_STRING 117 -#define ASN1_R_EXPECTING_A_BOOLEAN 118 -#define ASN1_R_EXPECTING_A_SEQUENCE 119 -#define ASN1_R_EXPECTING_A_UTCTIME 120 -#define ASN1_R_FIRST_NUM_TOO_LARGE 121 -#define ASN1_R_HEADER_TOO_LONG 122 -#define ASN1_R_INVALID_DIGIT 123 -#define ASN1_R_INVALID_SEPARATOR 124 -#define ASN1_R_INVALID_TIME_FORMAT 125 -#define ASN1_R_IV_TOO_LARGE 126 -#define ASN1_R_LENGTH_ERROR 127 -#define ASN1_R_LENGTH_MISMATCH 128 -#define ASN1_R_MISSING_EOS 129 -#define ASN1_R_MISSING_SECOND_NUMBER 130 -#define ASN1_R_NON_HEX_CHARACTERS 131 -#define ASN1_R_NOT_ENOUGH_DATA 132 -#define ASN1_R_ODD_NUMBER_OF_CHARS 133 -#define ASN1_R_PARSING 134 -#define ASN1_R_PRIVATE_KEY_HEADER_MISSING 135 -#define ASN1_R_SECOND_NUMBER_TOO_LARGE 136 -#define ASN1_R_SHORT_LINE 137 -#define ASN1_R_STRING_TOO_SHORT 138 -#define ASN1_R_TAG_VALUE_TOO_HIGH 139 -#define ASN1_R_THE_ASN1_OBJECT_IDENTIFIER_IS_NOT_KNOWN_FOR_THIS_MD 140 -#define ASN1_R_TOO_LONG 141 -#define ASN1_R_UNABLE_TO_DECODE_RSA_KEY 142 -#define ASN1_R_UNABLE_TO_DECODE_RSA_PRIVATE_KEY 143 -#define ASN1_R_UNKNOWN_ATTRIBUTE_TYPE 144 -#define ASN1_R_UNKNOWN_MESSAGE_DIGEST_ALGORITHM 145 -#define ASN1_R_UNKNOWN_OBJECT_TYPE 146 -#define ASN1_R_UNKNOWN_PUBLIC_KEY_TYPE 147 -#define ASN1_R_UNSUPPORTED_CIPHER 148 -#define ASN1_R_UNSUPPORTED_ENCRYPTION_ALGORITHM 149 -#define ASN1_R_UNSUPPORTED_PUBLIC_KEY_TYPE 150 -#define ASN1_R_UTCTIME_TOO_LONG 151 -#define ASN1_R_WRONG_PRINTABLE_TYPE 152 -#define ASN1_R_WRONG_TAG 153 -#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" { #endif #include -#include "bn.h" -#include "stack.h" +#include +#include +#include #define V_ASN1_UNIVERSAL 0x00 #define V_ASN1_APPLICATION 0x40 @@ -73,6 +74,7 @@ extern "C" { #define V_ASN1_PRIVATE 0xc0 #define V_ASN1_CONSTRUCTED 0x20 +#define V_ASN1_PRIMITIVE_TAG 0x1f #define V_ASN1_PRIMATIVE_TAG 0x1f #define V_ASN1_APP_CHOOSE -2 /* let the recipent choose */ @@ -89,7 +91,9 @@ extern "C" { #define V_ASN1_OBJECT_DESCRIPTOR 7 #define V_ASN1_EXTERNAL 8 #define V_ASN1_REAL 9 -#define V_ASN1_ENUMERATED 10 /* microsoft weirdness */ +#define V_ASN1_ENUMERATED 10 +#define V_ASN1_NEG_ENUMERATED (10+0x100) +#define V_ASN1_UTF8STRING 12 #define V_ASN1_SEQUENCE 16 #define V_ASN1_SET 17 #define V_ASN1_NUMERICSTRING 18 /**/ @@ -111,111 +115,46 @@ extern "C" { #define B_ASN1_NUMERICSTRING 0x0001 #define B_ASN1_PRINTABLESTRING 0x0002 #define B_ASN1_T61STRING 0x0004 +#define B_ASN1_TELETEXSTRING 0x0008 #define B_ASN1_VIDEOTEXSTRING 0x0008 #define B_ASN1_IA5STRING 0x0010 #define B_ASN1_GRAPHICSTRING 0x0020 #define B_ASN1_ISO64STRING 0x0040 +#define B_ASN1_VISIBLESTRING 0x0040 #define B_ASN1_GENERALSTRING 0x0080 #define B_ASN1_UNIVERSALSTRING 0x0100 #define B_ASN1_OCTET_STRING 0x0200 #define B_ASN1_BIT_STRING 0x0400 #define B_ASN1_BMPSTRING 0x0800 #define B_ASN1_UNKNOWN 0x1000 - -#ifndef DEBUG - -#define ASN1_INTEGER ASN1_STRING -#define ASN1_BIT_STRING ASN1_STRING -#define ASN1_OCTET_STRING ASN1_STRING -#define ASN1_PRINTABLESTRING ASN1_STRING -#define ASN1_T61STRING ASN1_STRING -#define ASN1_IA5STRING ASN1_STRING -#define ASN1_UTCTIME ASN1_STRING -#define ASN1_GENERALIZEDTIME ASN1_STRING -#define ASN1_GENERALSTRING ASN1_STRING -#define ASN1_UNIVERSALSTRING ASN1_STRING -#define ASN1_BMPSTRING ASN1_STRING - -#else - -typedef struct asn1_integer_st - { - int length; - int type; - unsigned char *data; - } ASN1_INTEGER; - -typedef struct asn1_bit_string_st - { - int length; - int type; - unsigned char *data; - } ASN1_BIT_STRING; - -typedef struct asn1_octet_string_st - { - int length; - int type; - unsigned char *data; - } ASN1_OCTET_STRING; - -typedef struct asn1_printablestring_st - { - int length; - int type; - unsigned char *data; - } ASN1_PRINTABLESTRING; - -typedef struct asn1_t61string_st - { - int length; - int type; - unsigned char *data; - } ASN1_T61STRING; - -typedef struct asn1_ia5string_st - { - int length; - int type; - unsigned char *data; - } ASN1_IA5STRING; - -typedef struct asn1_generalstring_st - { - int length; - int type; - unsigned char *data; - } ASN1_GENERALSTRING; - -typedef struct asn1_universalstring_st - { - int length; - int type; - unsigned char *data; - } ASN1_UNIVERSALSTRING; - -typedef struct asn1_bmpstring_st - { - int length; - int type; - unsigned char *data; - } ASN1_BMPSTRING; - -typedef struct asn1_utctime_st - { - int length; - int type; - unsigned char *data; - } ASN1_UTCTIME; - -typedef struct asn1_generalizedtime_st - { - int length; - int type; - unsigned char *data; - } ASN1_GENERALIZEDTIME; - -#endif +#define B_ASN1_UTF8STRING 0x2000 + +#define DECLARE_ASN1_SET_OF(type) \ +int i2d_ASN1_SET_OF_##type(STACK_OF(type) *a,unsigned char **pp, \ + int (*func)(type *,unsigned char **), int ex_tag, \ + int ex_class, int is_set); \ +STACK_OF(type) *d2i_ASN1_SET_OF_##type(STACK_OF(type) **a,unsigned char **pp, \ + long length, \ + type *(*func)(type **, \ + unsigned char **,long), \ + void (*free_func)(type *), \ + int ex_tag,int ex_class); + +#define IMPLEMENT_ASN1_SET_OF(type) \ +int i2d_ASN1_SET_OF_##type(STACK_OF(type) *a,unsigned char **pp, \ + int (*func)(type *,unsigned char **), int ex_tag, \ + int ex_class, int is_set) \ + { return i2d_ASN1_SET((STACK *)a,pp,func,ex_tag,ex_class,is_set); } \ +STACK_OF(type) *d2i_ASN1_SET_OF_##type(STACK_OF(type) **a,unsigned char **pp, \ + long length, \ + type *(*func)(type **, \ + unsigned char **,long), \ + void (*free_func)(type *), \ + int ex_tag,int ex_class) \ + { return (STACK_OF(type) *)d2i_ASN1_SET((STACK **)a,pp,length, \ + (char *(*)())func, \ + (void (*)())free_func, \ + ex_tag,ex_class); } typedef struct asn1_ctx_st { @@ -229,6 +168,7 @@ typedef struct asn1_ctx_st unsigned char *max; /* largest value of p alowed */ unsigned char *q;/* temporary variable */ unsigned char **pp;/* variable */ + int line; /* used in error processing */ } ASN1_CTX; /* These are used internally in the ASN1_OBJECT to keep track of @@ -239,21 +179,61 @@ typedef struct asn1_ctx_st #define ASN1_OBJECT_FLAG_DYNAMIC_DATA 0x08 /* internal use */ typedef struct asn1_object_st { - char *sn,*ln; + const char *sn,*ln; int nid; int length; unsigned char *data; int flags; /* Should we free this one */ } ASN1_OBJECT; +#define ASN1_STRING_FLAG_BITS_LEFT 0x08 /* Set if 0x07 has bits left value */ /* This is the base type that holds just about everything :-) */ typedef struct asn1_string_st { int length; int type; unsigned char *data; + /* The value of the following field depends on the type being + * held. It is mostly being used for BIT_STRING so if the + * input data has a non-zero 'unused bits' value, it will be + * handled correctly */ + long flags; } ASN1_STRING; +#ifndef DEBUG +#define ASN1_INTEGER ASN1_STRING +#define ASN1_ENUMERATED ASN1_STRING +#define ASN1_BIT_STRING ASN1_STRING +#define ASN1_OCTET_STRING ASN1_STRING +#define ASN1_PRINTABLESTRING ASN1_STRING +#define ASN1_T61STRING ASN1_STRING +#define ASN1_IA5STRING ASN1_STRING +#define ASN1_UTCTIME ASN1_STRING +#define ASN1_GENERALIZEDTIME ASN1_STRING +#define ASN1_TIME ASN1_STRING +#define ASN1_GENERALSTRING ASN1_STRING +#define ASN1_UNIVERSALSTRING ASN1_STRING +#define ASN1_BMPSTRING ASN1_STRING +#define ASN1_VISIBLESTRING ASN1_STRING +#define ASN1_UTF8STRING ASN1_STRING +#else +typedef struct asn1_string_st ASN1_INTEGER; +typedef struct asn1_string_st ASN1_ENUMERATED; +typedef struct asn1_string_st ASN1_BIT_STRING; +typedef struct asn1_string_st ASN1_OCTET_STRING; +typedef struct asn1_string_st ASN1_PRINTABLESTRING; +typedef struct asn1_string_st ASN1_T61STRING; +typedef struct asn1_string_st ASN1_IA5STRING; +typedef struct asn1_string_st ASN1_GENERALSTRING; +typedef struct asn1_string_st ASN1_UNIVERSALSTRING; +typedef struct asn1_string_st ASN1_BMPSTRING; +typedef struct asn1_string_st ASN1_UTCTIME; +typedef struct asn1_string_st ASN1_TIME; +typedef struct asn1_string_st ASN1_GENERALIZEDTIME; +typedef struct asn1_string_st ASN1_VISIBLESTRING; +typedef struct asn1_string_st ASN1_UTF8STRING; +#endif + typedef struct asn1_type_st { int type; @@ -262,6 +242,7 @@ typedef struct asn1_type_st ASN1_STRING * asn1_string; ASN1_OBJECT * object; ASN1_INTEGER * integer; + ASN1_ENUMERATED * enumerated; ASN1_BIT_STRING * bit_string; ASN1_OCTET_STRING * octet_string; ASN1_PRINTABLESTRING * printablestring; @@ -272,6 +253,8 @@ typedef struct asn1_type_st ASN1_UNIVERSALSTRING * universalstring; ASN1_UTCTIME * utctime; ASN1_GENERALIZEDTIME * generalizedtime; + ASN1_VISIBLESTRING * visiblestring; + ASN1_UTF8STRING * utf8string; /* set and sequence are left complete and still * contain the set or sequence bytes */ ASN1_STRING * set; @@ -279,6 +262,9 @@ typedef struct asn1_type_st } value; } ASN1_TYPE; +DECLARE_STACK_OF(ASN1_TYPE) +DECLARE_ASN1_SET_OF(ASN1_TYPE) + typedef struct asn1_method_st { int (*i2d)(); @@ -322,6 +308,17 @@ typedef struct asn1_header_st /* i2d_ASN1_INTEGER() is a function */ /* d2i_ASN1_INTEGER() is a function */ +#define ASN1_ENUMERATED_new() (ASN1_ENUMERATED *)\ + ASN1_STRING_type_new(V_ASN1_ENUMERATED) +#define ASN1_ENUMERATED_free(a) ASN1_STRING_free((ASN1_STRING *)a) +#define ASN1_ENUMERATED_dup(a) (ASN1_ENUMERATED *)ASN1_STRING_dup((ASN1_STRING *)a) +#define ASN1_ENUMERATED_cmp(a,b) ASN1_STRING_cmp(\ + (ASN1_STRING *)a,(ASN1_STRING *)b) +/* ASN1_ENUMERATED_set() is a function, also see BN_to_ASN1_ENUMERATED() */ +/* ASN1_ENUMERATED_get() is a function, also see ASN1_ENUMERATED_to_BN() */ +/* i2d_ASN1_ENUMERATED() is a function */ +/* d2i_ASN1_ENUMERATED() is a function */ + #define ASN1_OCTET_STRING_new() (ASN1_OCTET_STRING *)\ ASN1_STRING_type_new(V_ASN1_OCTET_STRING) #define ASN1_OCTET_STRING_free(a) ASN1_STRING_free((ASN1_STRING *)a) @@ -350,7 +347,29 @@ typedef struct asn1_header_st B_ASN1_BMPSTRING|\ B_ASN1_UNKNOWN) -#define ASN1_PRINTABLESTRING_new() (ASN1_PRINTABLESTRING_STRING *)\ +#define DIRECTORYSTRING_new() ASN1_STRING_type_new(V_ASN1_PRINTABLESTRING) +#define DIRECTORYSTRING_free(a) ASN1_STRING_free((ASN1_STRING *)a) +#define M_i2d_DIRECTORYSTRING(a,pp) i2d_ASN1_bytes((ASN1_STRING *)a,\ + pp,a->type,V_ASN1_UNIVERSAL) +#define M_d2i_DIRECTORYSTRING(a,pp,l) \ + d2i_ASN1_type_bytes((ASN1_STRING **)a,pp,l, \ + B_ASN1_PRINTABLESTRING| \ + B_ASN1_TELETEXSTRING|\ + B_ASN1_BMPSTRING|\ + B_ASN1_UNIVERSALSTRING|\ + B_ASN1_UTF8STRING) + +#define DISPLAYTEXT_new() ASN1_STRING_type_new(V_ASN1_VISIBLESTRING) +#define DISPLAYTEXT_free(a) ASN1_STRING_free((ASN1_STRING *)a) +#define M_i2d_DISPLAYTEXT(a,pp) i2d_ASN1_bytes((ASN1_STRING *)a,\ + pp,a->type,V_ASN1_UNIVERSAL) +#define M_d2i_DISPLAYTEXT(a,pp,l) \ + d2i_ASN1_type_bytes((ASN1_STRING **)a,pp,l, \ + B_ASN1_VISIBLESTRING| \ + B_ASN1_BMPSTRING|\ + B_ASN1_UTF8STRING) + +#define ASN1_PRINTABLESTRING_new() (ASN1_PRINTABLESTRING *)\ ASN1_STRING_type_new(V_ASN1_PRINTABLESTRING) #define ASN1_PRINTABLESTRING_free(a) ASN1_STRING_free((ASN1_STRING *)a) #define M_i2d_ASN1_PRINTABLESTRING(a,pp) \ @@ -373,6 +392,8 @@ typedef struct asn1_header_st #define ASN1_IA5STRING_new() (ASN1_IA5STRING *)\ ASN1_STRING_type_new(V_ASN1_IA5STRING) #define ASN1_IA5STRING_free(a) ASN1_STRING_free((ASN1_STRING *)a) +#define ASN1_IA5STRING_dup(a) \ + (ASN1_IA5STRING *)ASN1_STRING_dup((ASN1_STRING *)a) #define M_i2d_ASN1_IA5STRING(a,pp) \ i2d_ASN1_bytes((ASN1_STRING *)a,pp,V_ASN1_IA5STRING,\ V_ASN1_UNIVERSAL) @@ -392,12 +413,22 @@ typedef struct asn1_header_st #define ASN1_GENERALIZEDTIME_new() (ASN1_GENERALIZEDTIME *)\ ASN1_STRING_type_new(V_ASN1_GENERALIZEDTIME) #define ASN1_GENERALIZEDTIME_free(a) ASN1_STRING_free((ASN1_STRING *)a) -#define ASN1_GENERALIZEDTIME_dup(a) (ASN1_UTCTIME *)ASN1_STRING_dup(\ +#define ASN1_GENERALIZEDTIME_dup(a) (ASN1_GENERALIZEDTIME *)ASN1_STRING_dup(\ (ASN1_STRING *)a) -/* DOES NOT EXIST YET i2d_ASN1_GENERALIZEDTIME() is a function */ -/* DOES NOT EXIST YET d2i_ASN1_GENERALIZEDTIME() is a function */ -/* DOES NOT EXIST YET ASN1_GENERALIZEDTIME_set() is a function */ -/* DOES NOT EXIST YET ASN1_GENERALIZEDTIME_check() is a function */ +/* i2d_ASN1_GENERALIZEDTIME() is a function */ +/* d2i_ASN1_GENERALIZEDTIME() is a function */ +/* ASN1_GENERALIZEDTIME_set() is a function */ +/* ASN1_GENERALIZEDTIME_check() is a function */ + +#define ASN1_TIME_new() (ASN1_TIME *)\ + ASN1_STRING_type_new(V_ASN1_UTCTIME) +#define ASN1_TIME_free(a) ASN1_STRING_free((ASN1_STRING *)a) +#define ASN1_TIME_dup(a) (ASN1_TIME *)ASN1_STRING_dup((ASN1_STRING *)a) + +/* i2d_ASN1_TIME() is a function */ +/* d2i_ASN1_TIME() is a function */ +/* ASN1_TIME_set() is a function */ +/* ASN1_TIME_check() is a function */ #define ASN1_GENERALSTRING_new() (ASN1_GENERALSTRING *)\ ASN1_STRING_type_new(V_ASN1_GENERALSTRING) @@ -429,13 +460,36 @@ typedef struct asn1_header_st (ASN1_BMPSTRING *)d2i_ASN1_type_bytes\ ((ASN1_STRING **)a,pp,l,B_ASN1_BMPSTRING) -#ifndef NOPROTO +#define ASN1_VISIBLESTRING_new() (ASN1_VISIBLESTRING *)\ + ASN1_STRING_type_new(V_ASN1_VISIBLESTRING) +#define ASN1_VISIBLESTRING_free(a) ASN1_STRING_free((ASN1_STRING *)a) +#define M_i2d_ASN1_VISIBLESTRING(a,pp) \ + i2d_ASN1_bytes((ASN1_STRING *)a,pp,V_ASN1_VISIBLESTRING,\ + V_ASN1_UNIVERSAL) +#define M_d2i_ASN1_VISIBLESTRING(a,pp,l) \ + (ASN1_VISIBLESTRING *)d2i_ASN1_type_bytes\ + ((ASN1_STRING **)a,pp,l,B_ASN1_VISIBLESTRING) + +#define ASN1_UTF8STRING_new() (ASN1_UTF8STRING *)\ + ASN1_STRING_type_new(V_ASN1_UTF8STRING) +#define ASN1_UTF8STRING_free(a) ASN1_STRING_free((ASN1_STRING *)a) +#define M_i2d_ASN1_UTF8STRING(a,pp) \ + i2d_ASN1_bytes((ASN1_STRING *)a,pp,V_ASN1_UTF8STRING,\ + V_ASN1_UNIVERSAL) +#define M_d2i_ASN1_UTF8STRING(a,pp,l) \ + (ASN1_UTF8STRING *)d2i_ASN1_type_bytes\ + ((ASN1_STRING **)a,pp,l,B_ASN1_UTF8STRING) + + /* for the is_set parameter to i2d_ASN1_SET */ +#define IS_SEQUENCE 0 +#define IS_SET 1 + ASN1_TYPE * ASN1_TYPE_new(void ); void ASN1_TYPE_free(ASN1_TYPE *a); int i2d_ASN1_TYPE(ASN1_TYPE *a,unsigned char **pp); ASN1_TYPE * d2i_ASN1_TYPE(ASN1_TYPE **a,unsigned char **pp,long length); int ASN1_TYPE_get(ASN1_TYPE *a); -void ASN1_TYPE_set(ASN1_TYPE *a, int type, char *value); +void ASN1_TYPE_set(ASN1_TYPE *a, int type, void *value); ASN1_OBJECT * ASN1_OBJECT_new(void ); void ASN1_OBJECT_free(ASN1_OBJECT *a); @@ -443,12 +497,17 @@ int i2d_ASN1_OBJECT(ASN1_OBJECT *a,unsigned char **pp); ASN1_OBJECT * d2i_ASN1_OBJECT(ASN1_OBJECT **a,unsigned char **pp, long length); +DECLARE_STACK_OF(ASN1_OBJECT) +DECLARE_ASN1_SET_OF(ASN1_OBJECT) + ASN1_STRING * ASN1_STRING_new(void ); void ASN1_STRING_free(ASN1_STRING *a); ASN1_STRING * ASN1_STRING_dup(ASN1_STRING *a); ASN1_STRING * ASN1_STRING_type_new(int type ); int ASN1_STRING_cmp(ASN1_STRING *a, ASN1_STRING *b); -int ASN1_STRING_set(ASN1_STRING *str,unsigned char *data, int len); + /* Since this is used to store all sorts of things, via macros, for now, make + its data void * */ +int ASN1_STRING_set(ASN1_STRING *str, const void *data, int len); int i2d_ASN1_BIT_STRING(ASN1_BIT_STRING *a,unsigned char **pp); ASN1_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); int i2d_ASN1_INTEGER(ASN1_INTEGER *a,unsigned char **pp); ASN1_INTEGER *d2i_ASN1_INTEGER(ASN1_INTEGER **a,unsigned char **pp, long length); +ASN1_INTEGER *d2i_ASN1_UINTEGER(ASN1_INTEGER **a,unsigned char **pp, + long length); + +int i2d_ASN1_ENUMERATED(ASN1_ENUMERATED *a,unsigned char **pp); +ASN1_ENUMERATED *d2i_ASN1_ENUMERATED(ASN1_ENUMERATED **a,unsigned char **pp, + long length); int ASN1_UTCTIME_check(ASN1_UTCTIME *a); ASN1_UTCTIME *ASN1_UTCTIME_set(ASN1_UTCTIME *s,time_t t); int ASN1_UTCTIME_set_string(ASN1_UTCTIME *s, char *str); +int ASN1_GENERALIZEDTIME_check(ASN1_GENERALIZEDTIME *a); +ASN1_GENERALIZEDTIME *ASN1_GENERALIZEDTIME_set(ASN1_GENERALIZEDTIME *s,time_t t); +int ASN1_GENERALIZEDTIME_set_string(ASN1_GENERALIZEDTIME *s, char *str); + int i2d_ASN1_OCTET_STRING(ASN1_OCTET_STRING *a,unsigned char **pp); ASN1_OCTET_STRING *d2i_ASN1_OCTET_STRING(ASN1_OCTET_STRING **a, unsigned char **pp,long length); +int i2d_ASN1_VISIBLESTRING(ASN1_VISIBLESTRING *a,unsigned char **pp); +ASN1_VISIBLESTRING *d2i_ASN1_VISIBLESTRING(ASN1_VISIBLESTRING **a, + unsigned char **pp,long length); + +int i2d_ASN1_UTF8STRING(ASN1_UTF8STRING *a,unsigned char **pp); +ASN1_UTF8STRING *d2i_ASN1_UTF8STRING(ASN1_UTF8STRING **a, + unsigned char **pp,long length); + +int i2d_ASN1_BMPSTRING(ASN1_BMPSTRING *a, unsigned char **pp); +ASN1_BMPSTRING *d2i_ASN1_BMPSTRING(ASN1_BMPSTRING **a, unsigned char **pp, + long length); + int i2d_ASN1_PRINTABLE(ASN1_STRING *a,unsigned char **pp); ASN1_STRING *d2i_ASN1_PRINTABLE(ASN1_STRING **a, unsigned char **pp, long l); ASN1_PRINTABLESTRING *d2i_ASN1_PRINTABLESTRING(ASN1_PRINTABLESTRING **a, unsigned char **pp, long l); +int i2d_DIRECTORYSTRING(ASN1_STRING *a,unsigned char **pp); +ASN1_STRING *d2i_DIRECTORYSTRING(ASN1_STRING **a, unsigned char **pp, + long length); + +int i2d_DISPLAYTEXT(ASN1_STRING *a,unsigned char **pp); +ASN1_STRING *d2i_DISPLAYTEXT(ASN1_STRING **a, unsigned char **pp, long length); + ASN1_T61STRING *d2i_ASN1_T61STRING(ASN1_T61STRING **a, unsigned char **pp, long l); int i2d_ASN1_IA5STRING(ASN1_IA5STRING *a,unsigned char **pp); @@ -488,21 +576,32 @@ int i2d_ASN1_UTCTIME(ASN1_UTCTIME *a,unsigned char **pp); ASN1_UTCTIME * d2i_ASN1_UTCTIME(ASN1_UTCTIME **a,unsigned char **pp, long length); +int i2d_ASN1_GENERALIZEDTIME(ASN1_GENERALIZEDTIME *a,unsigned char **pp); +ASN1_GENERALIZEDTIME * d2i_ASN1_GENERALIZEDTIME(ASN1_GENERALIZEDTIME **a,unsigned char **pp, + long length); + +int i2d_ASN1_TIME(ASN1_TIME *a,unsigned char **pp); +ASN1_TIME * d2i_ASN1_TIME(ASN1_TIME **a,unsigned char **pp, long length); +ASN1_TIME *ASN1_TIME_set(ASN1_TIME *s,time_t t); + int i2d_ASN1_SET(STACK *a, unsigned char **pp, - int (*func)(), int ex_tag, int ex_class); + int (*func)(), int ex_tag, int ex_class, int is_set); STACK * d2i_ASN1_SET(STACK **a, unsigned char **pp, long length, - char *(*func)(), int ex_tag, int ex_class); + char *(*func)(), void (*free_func)(), + int ex_tag, int ex_class); #ifdef HEADER_BIO_H int i2a_ASN1_INTEGER(BIO *bp, ASN1_INTEGER *a); int a2i_ASN1_INTEGER(BIO *bp,ASN1_INTEGER *bs,char *buf,int size); +int i2a_ASN1_ENUMERATED(BIO *bp, ASN1_ENUMERATED *a); +int a2i_ASN1_ENUMERATED(BIO *bp,ASN1_ENUMERATED *bs,char *buf,int size); int i2a_ASN1_OBJECT(BIO *bp,ASN1_OBJECT *a); int a2i_ASN1_STRING(BIO *bp,ASN1_STRING *bs,char *buf,int size); int i2a_ASN1_STRING(BIO *bp, ASN1_STRING *a, int type); #endif int i2t_ASN1_OBJECT(char *buf,int buf_len,ASN1_OBJECT *a); -int a2d_ASN1_OBJECT(unsigned char *out,int olen, char *buf, int num); +int a2d_ASN1_OBJECT(unsigned char *out,int olen, const char *buf, int num); ASN1_OBJECT *ASN1_OBJECT_create(int nid, unsigned char *data,int len, char *sn, char *ln); @@ -511,6 +610,11 @@ long ASN1_INTEGER_get(ASN1_INTEGER *a); ASN1_INTEGER *BN_to_ASN1_INTEGER(BIGNUM *bn, ASN1_INTEGER *ai); BIGNUM *ASN1_INTEGER_to_BN(ASN1_INTEGER *ai,BIGNUM *bn); +int ASN1_ENUMERATED_set(ASN1_ENUMERATED *a, long v); +long ASN1_ENUMERATED_get(ASN1_ENUMERATED *a); +ASN1_ENUMERATED *BN_to_ASN1_ENUMERATED(BIGNUM *bn, ASN1_ENUMERATED *ai); +BIGNUM *ASN1_ENUMERATED_to_BN(ASN1_ENUMERATED *ai,BIGNUM *bn); + /* General */ /* given a string, return the correct type, max is the maximum length */ int ASN1_PRINTABLE_type(unsigned char *s, int max); @@ -545,6 +649,8 @@ int ASN1_i2d_fp(int (*i2d)(),FILE *out,unsigned char *x); char *ASN1_d2i_bio(char *(*xnew)(),char *(*d2i)(),BIO *bp,unsigned char **x); int ASN1_i2d_bio(int (*i2d)(),BIO *out,unsigned char *x); int ASN1_UTCTIME_print(BIO *fp,ASN1_UTCTIME *a); +int ASN1_GENERALIZEDTIME_print(BIO *fp,ASN1_GENERALIZEDTIME *a); +int ASN1_TIME_print(BIO *fp,ASN1_TIME *a); int ASN1_STRING_print(BIO *bp,ASN1_STRING *v); int ASN1_parse(BIO *bp,unsigned char *pp,long len,int indent); #endif @@ -574,111 +680,32 @@ int ASN1_TYPE_set_int_octetstring(ASN1_TYPE *a, long num, int ASN1_TYPE_get_int_octetstring(ASN1_TYPE *a,long *num, unsigned char *data, int max_len); -#else - -ASN1_TYPE * ASN1_TYPE_new(); -void ASN1_TYPE_free(); -int i2d_ASN1_TYPE(); -ASN1_TYPE * d2i_ASN1_TYPE(); -int ASN1_TYPE_get(); -void ASN1_TYPE_set(); - -ASN1_OBJECT * ASN1_OBJECT_new(); -void ASN1_OBJECT_free(); -int i2d_ASN1_OBJECT(); -ASN1_OBJECT * d2i_ASN1_OBJECT(); -ASN1_STRING * ASN1_STRING_new(); -void ASN1_STRING_free(); -ASN1_STRING * ASN1_STRING_dup(); -ASN1_STRING * ASN1_STRING_type_new(); -int ASN1_STRING_cmp(); -int ASN1_STRING_set(); -int i2d_ASN1_BIT_STRING(); -ASN1_BIT_STRING *d2i_ASN1_BIT_STRING(); -int ASN1_BIT_STRING_set_bit(); -int ASN1_BIT_STRING_get_bit(); -int i2d_ASN1_BOOLEAN(); -int d2i_ASN1_BOOLEAN(); -int i2d_ASN1_INTEGER(); -ASN1_INTEGER *d2i_ASN1_INTEGER(); -int ASN1_UTCTIME_check(); -ASN1_UTCTIME *ASN1_UTCTIME_set(); -int ASN1_UTCTIME_set_string(); -int i2d_ASN1_OCTET_STRING(); -ASN1_OCTET_STRING *d2i_ASN1_OCTET_STRING(); -int i2d_ASN1_PRINTABLE(); -ASN1_STRING *d2i_ASN1_PRINTABLE(); -ASN1_PRINTABLESTRING *d2i_ASN1_PRINTABLESTRING(); -ASN1_T61STRING *d2i_ASN1_T61STRING(); -int i2d_ASN1_IA5STRING(); -ASN1_IA5STRING *d2i_ASN1_IA5STRING(); -int i2d_ASN1_UTCTIME(); -ASN1_UTCTIME * d2i_ASN1_UTCTIME(); -int i2d_ASN1_SET(); -STACK * d2i_ASN1_SET(); -int a2d_ASN1_OBJECT(); -ASN1_OBJECT *ASN1_OBJECT_create(); -int ASN1_INTEGER_set(); -long ASN1_INTEGER_get(); -ASN1_INTEGER *BN_to_ASN1_INTEGER(); -BIGNUM *ASN1_INTEGER_to_BN(); -int ASN1_PRINTABLE_type(); -int i2d_ASN1_bytes(); -ASN1_STRING *d2i_ASN1_bytes(); -ASN1_STRING *d2i_ASN1_type_bytes(); -int asn1_Finish(); -int ASN1_get_object(); -int ASN1_check_infinite_end(); -void ASN1_put_object(); -int ASN1_object_size(); -char *ASN1_dup(); -#ifndef NO_FP_API -char *ASN1_d2i_fp(); -int ASN1_i2d_fp(); -#endif - -char *ASN1_d2i_bio(); -int ASN1_i2d_bio(); -int ASN1_UTCTIME_print(); -int ASN1_STRING_print(); -int ASN1_parse(); -int i2a_ASN1_INTEGER(); -int a2i_ASN1_INTEGER(); -int i2a_ASN1_OBJECT(); -int i2t_ASN1_OBJECT(); -int a2i_ASN1_STRING(); -int i2a_ASN1_STRING(); - -int i2d_ASN1_HEADER(); -ASN1_HEADER *d2i_ASN1_HEADER(); -ASN1_HEADER *ASN1_HEADER_new(); -void ASN1_HEADER_free(); -void ERR_load_ASN1_strings(); -ASN1_METHOD *X509_asn1_meth(); -ASN1_METHOD *RSAPrivateKey_asn1_meth(); -ASN1_METHOD *ASN1_IA5STRING_asn1_meth(); -ASN1_METHOD *ASN1_BIT_STRING_asn1_meth(); - -int ASN1_UNIVERSALSTRING_to_string(); - -int ASN1_TYPE_set_octetstring(); -int ASN1_TYPE_get_octetstring(); -int ASN1_TYPE_set_int_octetstring(); -int ASN1_TYPE_get_int_octetstring(); - -#endif +STACK *ASN1_seq_unpack(unsigned char *buf, int len, char *(*d2i)(), + void (*free_func)() ); +unsigned char *ASN1_seq_pack(STACK *safes, int (*i2d)(), unsigned char **buf, + int *len ); +void *ASN1_unpack_string(ASN1_STRING *oct, char *(*d2i)()); +ASN1_STRING *ASN1_pack_string(void *obj, int (*i2d)(), ASN1_OCTET_STRING **oct); /* BEGIN ERROR CODES */ +/* The following lines are auto generated by the script mkerr.pl. Any changes + * made after this point may be overwritten when the script is next run. + */ + /* Error codes for the ASN1 functions. */ /* Function codes. */ #define ASN1_F_A2D_ASN1_OBJECT 100 +#define ASN1_F_A2I_ASN1_ENUMERATED 236 #define ASN1_F_A2I_ASN1_INTEGER 101 #define ASN1_F_A2I_ASN1_STRING 102 -#define ASN1_F_ASN1_COLLATE_PRIMATIVE 103 +#define ASN1_F_ASN1_COLLATE_PRIMITIVE 103 #define ASN1_F_ASN1_D2I_BIO 104 #define ASN1_F_ASN1_D2I_FP 105 #define ASN1_F_ASN1_DUP 106 +#define ASN1_F_ASN1_ENUMERATED_SET 232 +#define ASN1_F_ASN1_ENUMERATED_TO_BN 233 +#define ASN1_F_ASN1_GENERALIZEDTIME_NEW 222 #define ASN1_F_ASN1_GET_OBJECT 107 #define ASN1_F_ASN1_HEADER_NEW 108 #define ASN1_F_ASN1_I2D_BIO 109 @@ -686,37 +713,65 @@ int ASN1_TYPE_get_int_octetstring(); #define ASN1_F_ASN1_INTEGER_SET 111 #define ASN1_F_ASN1_INTEGER_TO_BN 112 #define ASN1_F_ASN1_OBJECT_NEW 113 +#define ASN1_F_ASN1_PACK_STRING 245 +#define ASN1_F_ASN1_PBE_SET 253 +#define ASN1_F_ASN1_SEQ_PACK 246 +#define ASN1_F_ASN1_SEQ_UNPACK 247 #define ASN1_F_ASN1_SIGN 114 #define ASN1_F_ASN1_STRING_NEW 115 #define ASN1_F_ASN1_STRING_TYPE_NEW 116 #define ASN1_F_ASN1_TYPE_GET_INT_OCTETSTRING 117 #define ASN1_F_ASN1_TYPE_GET_OCTETSTRING 118 #define ASN1_F_ASN1_TYPE_NEW 119 +#define ASN1_F_ASN1_UNPACK_STRING 248 #define ASN1_F_ASN1_UTCTIME_NEW 120 #define ASN1_F_ASN1_VERIFY 121 +#define ASN1_F_AUTHORITY_KEYID_NEW 237 +#define ASN1_F_BASIC_CONSTRAINTS_NEW 226 +#define ASN1_F_BN_TO_ASN1_ENUMERATED 234 #define ASN1_F_BN_TO_ASN1_INTEGER 122 #define ASN1_F_D2I_ASN1_BIT_STRING 123 #define ASN1_F_D2I_ASN1_BMPSTRING 124 #define ASN1_F_D2I_ASN1_BOOLEAN 125 #define ASN1_F_D2I_ASN1_BYTES 126 +#define ASN1_F_D2I_ASN1_ENUMERATED 235 +#define ASN1_F_D2I_ASN1_GENERALIZEDTIME 223 #define ASN1_F_D2I_ASN1_HEADER 127 #define ASN1_F_D2I_ASN1_INTEGER 128 #define ASN1_F_D2I_ASN1_OBJECT 129 #define ASN1_F_D2I_ASN1_OCTET_STRING 130 #define ASN1_F_D2I_ASN1_PRINT_TYPE 131 #define ASN1_F_D2I_ASN1_SET 132 +#define ASN1_F_D2I_ASN1_TIME 224 #define ASN1_F_D2I_ASN1_TYPE 133 #define ASN1_F_D2I_ASN1_TYPE_BYTES 134 +#define ASN1_F_D2I_ASN1_UINTEGER 280 #define ASN1_F_D2I_ASN1_UTCTIME 135 +#define ASN1_F_D2I_ASN1_UTF8STRING 266 +#define ASN1_F_D2I_ASN1_VISIBLESTRING 267 +#define ASN1_F_D2I_AUTHORITY_KEYID 238 +#define ASN1_F_D2I_BASIC_CONSTRAINTS 227 #define ASN1_F_D2I_DHPARAMS 136 +#define ASN1_F_D2I_DIST_POINT 276 +#define ASN1_F_D2I_DIST_POINT_NAME 277 #define ASN1_F_D2I_DSAPARAMS 137 #define ASN1_F_D2I_DSAPRIVATEKEY 138 #define ASN1_F_D2I_DSAPUBLICKEY 139 +#define ASN1_F_D2I_GENERAL_NAME 230 +#define ASN1_F_D2I_NETSCAPE_CERT_SEQUENCE 228 #define ASN1_F_D2I_NETSCAPE_PKEY 140 #define ASN1_F_D2I_NETSCAPE_RSA 141 #define ASN1_F_D2I_NETSCAPE_RSA_2 142 #define ASN1_F_D2I_NETSCAPE_SPKAC 143 #define ASN1_F_D2I_NETSCAPE_SPKI 144 +#define ASN1_F_D2I_NOTICEREF 268 +#define ASN1_F_D2I_PBE2PARAM 262 +#define ASN1_F_D2I_PBEPARAM 249 +#define ASN1_F_D2I_PBKDF2PARAM 263 +#define ASN1_F_D2I_PKCS12 254 +#define ASN1_F_D2I_PKCS12_BAGS 255 +#define ASN1_F_D2I_PKCS12_MAC_DATA 256 +#define ASN1_F_D2I_PKCS12_SAFEBAG 257 #define ASN1_F_D2I_PKCS7 145 #define ASN1_F_D2I_PKCS7_DIGEST 146 #define ASN1_F_D2I_PKCS7_ENCRYPT 147 @@ -727,10 +782,17 @@ int ASN1_TYPE_get_int_octetstring(); #define ASN1_F_D2I_PKCS7_SIGNED 152 #define ASN1_F_D2I_PKCS7_SIGNER_INFO 153 #define ASN1_F_D2I_PKCS7_SIGN_ENVELOPE 154 +#define ASN1_F_D2I_PKCS8_PRIV_KEY_INFO 250 +#define ASN1_F_D2I_PKEY_USAGE_PERIOD 239 +#define ASN1_F_D2I_POLICYINFO 269 +#define ASN1_F_D2I_POLICYQUALINFO 270 #define ASN1_F_D2I_PRIVATEKEY 155 #define ASN1_F_D2I_PUBLICKEY 156 #define ASN1_F_D2I_RSAPRIVATEKEY 157 #define ASN1_F_D2I_RSAPUBLICKEY 158 +#define ASN1_F_D2I_SXNET 241 +#define ASN1_F_D2I_SXNETID 243 +#define ASN1_F_D2I_USERNOTICE 271 #define ASN1_F_D2I_X509 159 #define ASN1_F_D2I_X509_ALGOR 160 #define ASN1_F_D2I_X509_ATTRIBUTE 161 @@ -748,7 +810,11 @@ int ASN1_TYPE_get_int_octetstring(); #define ASN1_F_D2I_X509_REVOKED 173 #define ASN1_F_D2I_X509_SIG 174 #define ASN1_F_D2I_X509_VAL 175 +#define ASN1_F_DIST_POINT_NAME_NEW 278 +#define ASN1_F_DIST_POINT_NEW 279 +#define ASN1_F_GENERAL_NAME_NEW 231 #define ASN1_F_I2D_ASN1_HEADER 176 +#define ASN1_F_I2D_ASN1_TIME 225 #define ASN1_F_I2D_DHPARAMS 177 #define ASN1_F_I2D_DSAPARAMS 178 #define ASN1_F_I2D_DSAPRIVATEKEY 179 @@ -761,9 +827,19 @@ int ASN1_TYPE_get_int_octetstring(); #define ASN1_F_I2D_RSAPUBLICKEY 186 #define ASN1_F_I2D_X509_ATTRIBUTE 187 #define ASN1_F_I2T_ASN1_OBJECT 188 +#define ASN1_F_NETSCAPE_CERT_SEQUENCE_NEW 229 #define ASN1_F_NETSCAPE_PKEY_NEW 189 #define ASN1_F_NETSCAPE_SPKAC_NEW 190 #define ASN1_F_NETSCAPE_SPKI_NEW 191 +#define ASN1_F_NOTICEREF_NEW 272 +#define ASN1_F_PBE2PARAM_NEW 264 +#define ASN1_F_PBEPARAM_NEW 251 +#define ASN1_F_PBKDF2PARAM_NEW 265 +#define ASN1_F_PKCS12_BAGS_NEW 258 +#define ASN1_F_PKCS12_MAC_DATA_NEW 259 +#define ASN1_F_PKCS12_NEW 260 +#define ASN1_F_PKCS12_SAFEBAG_NEW 261 +#define ASN1_F_PKCS5_PBE2_SET 281 #define ASN1_F_PKCS7_DIGEST_NEW 192 #define ASN1_F_PKCS7_ENCRYPT_NEW 193 #define ASN1_F_PKCS7_ENC_CONTENT_NEW 194 @@ -774,6 +850,13 @@ int ASN1_TYPE_get_int_octetstring(); #define ASN1_F_PKCS7_SIGNED_NEW 199 #define ASN1_F_PKCS7_SIGNER_INFO_NEW 200 #define ASN1_F_PKCS7_SIGN_ENVELOPE_NEW 201 +#define ASN1_F_PKCS8_PRIV_KEY_INFO_NEW 252 +#define ASN1_F_PKEY_USAGE_PERIOD_NEW 240 +#define ASN1_F_POLICYINFO_NEW 273 +#define ASN1_F_POLICYQUALINFO_NEW 274 +#define ASN1_F_SXNETID_NEW 244 +#define ASN1_F_SXNET_NEW 242 +#define ASN1_F_USERNOTICE_NEW 275 #define ASN1_F_X509_ALGOR_NEW 202 #define ASN1_F_X509_ATTRIBUTE_NEW 203 #define ASN1_F_X509_CINF_NEW 204 @@ -797,61 +880,64 @@ int ASN1_TYPE_get_int_octetstring(); /* Reason codes. */ #define ASN1_R_BAD_CLASS 100 -#define ASN1_R_BAD_GET_OBJECT 101 -#define ASN1_R_BAD_OBJECT_HEADER 102 -#define ASN1_R_BAD_PASSWORD_READ 103 -#define ASN1_R_BAD_PKCS7_CONTENT 104 -#define ASN1_R_BAD_PKCS7_TYPE 105 -#define ASN1_R_BAD_TAG 106 -#define ASN1_R_BAD_TYPE 107 -#define ASN1_R_BN_LIB 108 -#define ASN1_R_BOOLEAN_IS_WRONG_LENGTH 109 -#define ASN1_R_BUFFER_TOO_SMALL 110 -#define ASN1_R_DATA_IS_WRONG 111 -#define ASN1_R_DECODING_ERROR 112 -#define ASN1_R_ERROR_STACK 113 -#define ASN1_R_EXPECTING_AN_INTEGER 114 -#define ASN1_R_EXPECTING_AN_OBJECT 115 -#define ASN1_R_EXPECTING_AN_OCTET_STRING 116 -#define ASN1_R_EXPECTING_A_BIT_STRING 117 -#define ASN1_R_EXPECTING_A_BOOLEAN 118 -#define ASN1_R_EXPECTING_A_SEQUENCE 119 -#define ASN1_R_EXPECTING_A_UTCTIME 120 -#define ASN1_R_FIRST_NUM_TOO_LARGE 121 -#define ASN1_R_HEADER_TOO_LONG 122 -#define ASN1_R_INVALID_DIGIT 123 -#define ASN1_R_INVALID_SEPARATOR 124 -#define ASN1_R_INVALID_TIME_FORMAT 125 -#define ASN1_R_IV_TOO_LARGE 126 -#define ASN1_R_LENGTH_ERROR 127 -#define ASN1_R_LENGTH_MISMATCH 128 -#define ASN1_R_MISSING_EOS 129 -#define ASN1_R_MISSING_SECOND_NUMBER 130 -#define ASN1_R_NON_HEX_CHARACTERS 131 -#define ASN1_R_NOT_ENOUGH_DATA 132 -#define ASN1_R_ODD_NUMBER_OF_CHARS 133 -#define ASN1_R_PARSING 134 -#define ASN1_R_PRIVATE_KEY_HEADER_MISSING 135 -#define ASN1_R_SECOND_NUMBER_TOO_LARGE 136 -#define ASN1_R_SHORT_LINE 137 -#define ASN1_R_STRING_TOO_SHORT 138 -#define ASN1_R_TAG_VALUE_TOO_HIGH 139 -#define ASN1_R_THE_ASN1_OBJECT_IDENTIFIER_IS_NOT_KNOWN_FOR_THIS_MD 140 -#define ASN1_R_TOO_LONG 141 -#define ASN1_R_UNABLE_TO_DECODE_RSA_KEY 142 -#define ASN1_R_UNABLE_TO_DECODE_RSA_PRIVATE_KEY 143 -#define ASN1_R_UNKNOWN_ATTRIBUTE_TYPE 144 -#define ASN1_R_UNKNOWN_MESSAGE_DIGEST_ALGORITHM 145 -#define ASN1_R_UNKNOWN_OBJECT_TYPE 146 -#define ASN1_R_UNKNOWN_PUBLIC_KEY_TYPE 147 -#define ASN1_R_UNSUPPORTED_CIPHER 148 -#define ASN1_R_UNSUPPORTED_ENCRYPTION_ALGORITHM 149 -#define ASN1_R_UNSUPPORTED_PUBLIC_KEY_TYPE 150 -#define ASN1_R_UTCTIME_TOO_LONG 151 -#define ASN1_R_WRONG_PRINTABLE_TYPE 152 -#define ASN1_R_WRONG_TAG 153 -#define ASN1_R_WRONG_TYPE 154 - +#define ASN1_R_BAD_OBJECT_HEADER 101 +#define ASN1_R_BAD_PASSWORD_READ 102 +#define ASN1_R_BAD_PKCS7_CONTENT 103 +#define ASN1_R_BAD_PKCS7_TYPE 104 +#define ASN1_R_BAD_TAG 105 +#define ASN1_R_BAD_TYPE 106 +#define ASN1_R_BN_LIB 107 +#define ASN1_R_BOOLEAN_IS_WRONG_LENGTH 108 +#define ASN1_R_BUFFER_TOO_SMALL 109 +#define ASN1_R_DATA_IS_WRONG 110 +#define ASN1_R_DECODE_ERROR 155 +#define ASN1_R_DECODING_ERROR 111 +#define ASN1_R_ENCODE_ERROR 156 +#define ASN1_R_ERROR_PARSING_SET_ELEMENT 112 +#define ASN1_R_ERROR_SETTING_CIPHER_PARAMS 157 +#define ASN1_R_EXPECTING_AN_ENUMERATED 154 +#define ASN1_R_EXPECTING_AN_INTEGER 113 +#define ASN1_R_EXPECTING_AN_OBJECT 114 +#define ASN1_R_EXPECTING_AN_OCTET_STRING 115 +#define ASN1_R_EXPECTING_A_BIT_STRING 116 +#define ASN1_R_EXPECTING_A_BOOLEAN 117 +#define ASN1_R_EXPECTING_A_GENERALIZEDTIME 151 +#define ASN1_R_EXPECTING_A_TIME 152 +#define ASN1_R_EXPECTING_A_UTCTIME 118 +#define ASN1_R_FIRST_NUM_TOO_LARGE 119 +#define ASN1_R_GENERALIZEDTIME_TOO_LONG 153 +#define ASN1_R_HEADER_TOO_LONG 120 +#define ASN1_R_INVALID_DIGIT 121 +#define ASN1_R_INVALID_SEPARATOR 122 +#define ASN1_R_INVALID_TIME_FORMAT 123 +#define ASN1_R_IV_TOO_LARGE 124 +#define ASN1_R_LENGTH_ERROR 125 +#define ASN1_R_MISSING_SECOND_NUMBER 126 +#define ASN1_R_NON_HEX_CHARACTERS 127 +#define ASN1_R_NOT_ENOUGH_DATA 128 +#define ASN1_R_ODD_NUMBER_OF_CHARS 129 +#define ASN1_R_PARSING 130 +#define ASN1_R_PRIVATE_KEY_HEADER_MISSING 131 +#define ASN1_R_SECOND_NUMBER_TOO_LARGE 132 +#define ASN1_R_SHORT_LINE 133 +#define ASN1_R_STRING_TOO_SHORT 134 +#define ASN1_R_TAG_VALUE_TOO_HIGH 135 +#define ASN1_R_THE_ASN1_OBJECT_IDENTIFIER_IS_NOT_KNOWN_FOR_THIS_MD 136 +#define ASN1_R_TOO_LONG 137 +#define ASN1_R_UNABLE_TO_DECODE_RSA_KEY 138 +#define ASN1_R_UNABLE_TO_DECODE_RSA_PRIVATE_KEY 139 +#define ASN1_R_UNKNOWN_ATTRIBUTE_TYPE 140 +#define ASN1_R_UNKNOWN_MESSAGE_DIGEST_ALGORITHM 141 +#define ASN1_R_UNKNOWN_OBJECT_TYPE 142 +#define ASN1_R_UNKNOWN_PUBLIC_KEY_TYPE 143 +#define ASN1_R_UNSUPPORTED_CIPHER 144 +#define ASN1_R_UNSUPPORTED_ENCRYPTION_ALGORITHM 145 +#define ASN1_R_UNSUPPORTED_PUBLIC_KEY_TYPE 146 +#define ASN1_R_UTCTIME_TOO_LONG 147 +#define ASN1_R_WRONG_PRINTABLE_TYPE 148 +#define ASN1_R_WRONG_TAG 149 +#define ASN1_R_WRONG_TYPE 150 + #ifdef __cplusplus } #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 @@ -/* lib/asn1/asn1_err.c */ -/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) - * All rights reserved. +/* crypto/asn1/asn1_err.c */ +/* ==================================================================== + * Copyright (c) 1999 The OpenSSL Project. All rights reserved. * - * This package is an SSL implementation written - * by Eric Young (eay@cryptsoft.com). - * The implementation was written so as to conform with Netscapes SSL. - * - * This library is free for commercial and non-commercial use as long as - * the following conditions are aheared to. The following conditions - * apply to all code found in this distribution, be it the RC4, RSA, - * lhash, DES, etc., code; not just the SSL code. The SSL documentation - * included with this distribution is covered by the same copyright terms - * except that the holder is Tim Hudson (tjh@cryptsoft.com). - * - * Copyright remains Eric Young's, and as such any Copyright notices in - * the code are not to be removed. - * If this package is used in a product, Eric Young should be given attribution - * as the author of the parts of the library used. - * This can be in the form of a textual message at program startup or - * in documentation (online or textual) provided with the package. - * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: - * 1. Redistributions of source code must retain the copyright - * notice, this list of conditions and the following disclaimer. + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * "This product includes cryptographic software written by - * Eric Young (eay@cryptsoft.com)" - * The word 'cryptographic' can be left out if the rouines from the library - * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from - * the apps directory (application code) you must include an acknowledgement: - * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - * - * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * The licence and distribution terms for any publically available version or - * derivative of this code cannot be changed. i.e. this code cannot simply be - * copied and put under another distribution licence - * [including the GNU Public Licence.] + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * 3. All advertising materials mentioning features or use of this + * software must display the following acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" + * + * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to + * endorse or promote products derived from this software without + * prior written permission. For written permission, please contact + * openssl-core@OpenSSL.org. + * + * 5. Products derived from this software may not be called "OpenSSL" + * nor may "OpenSSL" appear in their names without prior written + * permission of the OpenSSL Project. + * + * 6. Redistributions of any form whatsoever must retain the following + * acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" + * + * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY + * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR + * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + * ==================================================================== + * + * This product includes cryptographic software written by Eric Young + * (eay@cryptsoft.com). This product includes software written by Tim + * Hudson (tjh@cryptsoft.com). + * */ + +/* NOTE: this file was auto generated by the mkerr.pl script: any changes + * made to it will be overwritten when the script next updates this file. + */ + #include -#include "err.h" -#include "asn1.h" +#include +#include /* BEGIN ERROR CODES */ #ifndef NO_ERR static ERR_STRING_DATA ASN1_str_functs[]= { {ERR_PACK(0,ASN1_F_A2D_ASN1_OBJECT,0), "a2d_ASN1_OBJECT"}, +{ERR_PACK(0,ASN1_F_A2I_ASN1_ENUMERATED,0), "a2i_ASN1_ENUMERATED"}, {ERR_PACK(0,ASN1_F_A2I_ASN1_INTEGER,0), "a2i_ASN1_INTEGER"}, {ERR_PACK(0,ASN1_F_A2I_ASN1_STRING,0), "a2i_ASN1_STRING"}, -{ERR_PACK(0,ASN1_F_ASN1_COLLATE_PRIMATIVE,0), "ASN1_COLLATE_PRIMATIVE"}, +{ERR_PACK(0,ASN1_F_ASN1_COLLATE_PRIMITIVE,0), "ASN1_COLLATE_PRIMITIVE"}, {ERR_PACK(0,ASN1_F_ASN1_D2I_BIO,0), "ASN1_d2i_bio"}, {ERR_PACK(0,ASN1_F_ASN1_D2I_FP,0), "ASN1_d2i_fp"}, {ERR_PACK(0,ASN1_F_ASN1_DUP,0), "ASN1_dup"}, +{ERR_PACK(0,ASN1_F_ASN1_ENUMERATED_SET,0), "ASN1_ENUMERATED_set"}, +{ERR_PACK(0,ASN1_F_ASN1_ENUMERATED_TO_BN,0), "ASN1_ENUMERATED_to_BN"}, +{ERR_PACK(0,ASN1_F_ASN1_GENERALIZEDTIME_NEW,0), "ASN1_GENERALIZEDTIME_NEW"}, {ERR_PACK(0,ASN1_F_ASN1_GET_OBJECT,0), "ASN1_get_object"}, {ERR_PACK(0,ASN1_F_ASN1_HEADER_NEW,0), "ASN1_HEADER_new"}, {ERR_PACK(0,ASN1_F_ASN1_I2D_BIO,0), "ASN1_i2d_bio"}, @@ -77,121 +83,176 @@ static ERR_STRING_DATA ASN1_str_functs[]= {ERR_PACK(0,ASN1_F_ASN1_INTEGER_SET,0), "ASN1_INTEGER_set"}, {ERR_PACK(0,ASN1_F_ASN1_INTEGER_TO_BN,0), "ASN1_INTEGER_to_BN"}, {ERR_PACK(0,ASN1_F_ASN1_OBJECT_NEW,0), "ASN1_OBJECT_new"}, -{ERR_PACK(0,ASN1_F_ASN1_SIGN,0), "ASN1_SIGN"}, +{ERR_PACK(0,ASN1_F_ASN1_PACK_STRING,0), "ASN1_pack_string"}, +{ERR_PACK(0,ASN1_F_ASN1_PBE_SET,0), "ASN1_PBE_SET"}, +{ERR_PACK(0,ASN1_F_ASN1_SEQ_PACK,0), "ASN1_seq_pack"}, +{ERR_PACK(0,ASN1_F_ASN1_SEQ_UNPACK,0), "ASN1_seq_unpack"}, +{ERR_PACK(0,ASN1_F_ASN1_SIGN,0), "ASN1_sign"}, {ERR_PACK(0,ASN1_F_ASN1_STRING_NEW,0), "ASN1_STRING_new"}, {ERR_PACK(0,ASN1_F_ASN1_STRING_TYPE_NEW,0), "ASN1_STRING_type_new"}, {ERR_PACK(0,ASN1_F_ASN1_TYPE_GET_INT_OCTETSTRING,0), "ASN1_TYPE_get_int_octetstring"}, {ERR_PACK(0,ASN1_F_ASN1_TYPE_GET_OCTETSTRING,0), "ASN1_TYPE_get_octetstring"}, {ERR_PACK(0,ASN1_F_ASN1_TYPE_NEW,0), "ASN1_TYPE_new"}, +{ERR_PACK(0,ASN1_F_ASN1_UNPACK_STRING,0), "ASN1_unpack_string"}, {ERR_PACK(0,ASN1_F_ASN1_UTCTIME_NEW,0), "ASN1_UTCTIME_NEW"}, -{ERR_PACK(0,ASN1_F_ASN1_VERIFY,0), "ASN1_VERIFY"}, +{ERR_PACK(0,ASN1_F_ASN1_VERIFY,0), "ASN1_verify"}, +{ERR_PACK(0,ASN1_F_AUTHORITY_KEYID_NEW,0), "AUTHORITY_KEYID_new"}, +{ERR_PACK(0,ASN1_F_BASIC_CONSTRAINTS_NEW,0), "BASIC_CONSTRAINTS_new"}, +{ERR_PACK(0,ASN1_F_BN_TO_ASN1_ENUMERATED,0), "BN_to_ASN1_ENUMERATED"}, {ERR_PACK(0,ASN1_F_BN_TO_ASN1_INTEGER,0), "BN_to_ASN1_INTEGER"}, {ERR_PACK(0,ASN1_F_D2I_ASN1_BIT_STRING,0), "d2i_ASN1_BIT_STRING"}, -{ERR_PACK(0,ASN1_F_D2I_ASN1_BMPSTRING,0), "D2I_ASN1_BMPSTRING"}, +{ERR_PACK(0,ASN1_F_D2I_ASN1_BMPSTRING,0), "d2i_ASN1_BMPSTRING"}, {ERR_PACK(0,ASN1_F_D2I_ASN1_BOOLEAN,0), "d2i_ASN1_BOOLEAN"}, {ERR_PACK(0,ASN1_F_D2I_ASN1_BYTES,0), "d2i_ASN1_bytes"}, +{ERR_PACK(0,ASN1_F_D2I_ASN1_ENUMERATED,0), "d2i_ASN1_ENUMERATED"}, +{ERR_PACK(0,ASN1_F_D2I_ASN1_GENERALIZEDTIME,0), "d2i_ASN1_GENERALIZEDTIME"}, {ERR_PACK(0,ASN1_F_D2I_ASN1_HEADER,0), "d2i_ASN1_HEADER"}, {ERR_PACK(0,ASN1_F_D2I_ASN1_INTEGER,0), "d2i_ASN1_INTEGER"}, {ERR_PACK(0,ASN1_F_D2I_ASN1_OBJECT,0), "d2i_ASN1_OBJECT"}, {ERR_PACK(0,ASN1_F_D2I_ASN1_OCTET_STRING,0), "d2i_ASN1_OCTET_STRING"}, {ERR_PACK(0,ASN1_F_D2I_ASN1_PRINT_TYPE,0), "D2I_ASN1_PRINT_TYPE"}, {ERR_PACK(0,ASN1_F_D2I_ASN1_SET,0), "d2i_ASN1_SET"}, +{ERR_PACK(0,ASN1_F_D2I_ASN1_TIME,0), "d2i_ASN1_TIME"}, {ERR_PACK(0,ASN1_F_D2I_ASN1_TYPE,0), "d2i_ASN1_TYPE"}, {ERR_PACK(0,ASN1_F_D2I_ASN1_TYPE_BYTES,0), "d2i_ASN1_type_bytes"}, +{ERR_PACK(0,ASN1_F_D2I_ASN1_UINTEGER,0), "d2i_ASN1_UINTEGER"}, {ERR_PACK(0,ASN1_F_D2I_ASN1_UTCTIME,0), "d2i_ASN1_UTCTIME"}, -{ERR_PACK(0,ASN1_F_D2I_DHPARAMS,0), "D2I_DHPARAMS"}, -{ERR_PACK(0,ASN1_F_D2I_DSAPARAMS,0), "D2I_DSAPARAMS"}, -{ERR_PACK(0,ASN1_F_D2I_DSAPRIVATEKEY,0), "D2I_DSAPRIVATEKEY"}, -{ERR_PACK(0,ASN1_F_D2I_DSAPUBLICKEY,0), "D2I_DSAPUBLICKEY"}, +{ERR_PACK(0,ASN1_F_D2I_ASN1_UTF8STRING,0), "d2i_ASN1_UTF8STRING"}, +{ERR_PACK(0,ASN1_F_D2I_ASN1_VISIBLESTRING,0), "d2i_ASN1_VISIBLESTRING"}, +{ERR_PACK(0,ASN1_F_D2I_AUTHORITY_KEYID,0), "d2i_AUTHORITY_KEYID"}, +{ERR_PACK(0,ASN1_F_D2I_BASIC_CONSTRAINTS,0), "d2i_BASIC_CONSTRAINTS"}, +{ERR_PACK(0,ASN1_F_D2I_DHPARAMS,0), "d2i_DHparams"}, +{ERR_PACK(0,ASN1_F_D2I_DIST_POINT,0), "d2i_DIST_POINT"}, +{ERR_PACK(0,ASN1_F_D2I_DIST_POINT_NAME,0), "d2i_DIST_POINT_NAME"}, +{ERR_PACK(0,ASN1_F_D2I_DSAPARAMS,0), "d2i_DSAparams"}, +{ERR_PACK(0,ASN1_F_D2I_DSAPRIVATEKEY,0), "d2i_DSAPrivateKey"}, +{ERR_PACK(0,ASN1_F_D2I_DSAPUBLICKEY,0), "d2i_DSAPublicKey"}, +{ERR_PACK(0,ASN1_F_D2I_GENERAL_NAME,0), "d2i_GENERAL_NAME"}, +{ERR_PACK(0,ASN1_F_D2I_NETSCAPE_CERT_SEQUENCE,0), "d2i_NETSCAPE_CERT_SEQUENCE"}, {ERR_PACK(0,ASN1_F_D2I_NETSCAPE_PKEY,0), "D2I_NETSCAPE_PKEY"}, -{ERR_PACK(0,ASN1_F_D2I_NETSCAPE_RSA,0), "D2I_NETSCAPE_RSA"}, -{ERR_PACK(0,ASN1_F_D2I_NETSCAPE_RSA_2,0), "D2I_NETSCAPE_RSA_2"}, -{ERR_PACK(0,ASN1_F_D2I_NETSCAPE_SPKAC,0), "D2I_NETSCAPE_SPKAC"}, -{ERR_PACK(0,ASN1_F_D2I_NETSCAPE_SPKI,0), "D2I_NETSCAPE_SPKI"}, -{ERR_PACK(0,ASN1_F_D2I_PKCS7,0), "D2I_PKCS7"}, -{ERR_PACK(0,ASN1_F_D2I_PKCS7_DIGEST,0), "D2I_PKCS7_DIGEST"}, -{ERR_PACK(0,ASN1_F_D2I_PKCS7_ENCRYPT,0), "D2I_PKCS7_ENCRYPT"}, -{ERR_PACK(0,ASN1_F_D2I_PKCS7_ENC_CONTENT,0), "D2I_PKCS7_ENC_CONTENT"}, -{ERR_PACK(0,ASN1_F_D2I_PKCS7_ENVELOPE,0), "D2I_PKCS7_ENVELOPE"}, -{ERR_PACK(0,ASN1_F_D2I_PKCS7_ISSUER_AND_SERIAL,0), "D2I_PKCS7_ISSUER_AND_SERIAL"}, -{ERR_PACK(0,ASN1_F_D2I_PKCS7_RECIP_INFO,0), "D2I_PKCS7_RECIP_INFO"}, -{ERR_PACK(0,ASN1_F_D2I_PKCS7_SIGNED,0), "D2I_PKCS7_SIGNED"}, -{ERR_PACK(0,ASN1_F_D2I_PKCS7_SIGNER_INFO,0), "D2I_PKCS7_SIGNER_INFO"}, -{ERR_PACK(0,ASN1_F_D2I_PKCS7_SIGN_ENVELOPE,0), "D2I_PKCS7_SIGN_ENVELOPE"}, -{ERR_PACK(0,ASN1_F_D2I_PRIVATEKEY,0), "D2I_PRIVATEKEY"}, -{ERR_PACK(0,ASN1_F_D2I_PUBLICKEY,0), "D2I_PUBLICKEY"}, -{ERR_PACK(0,ASN1_F_D2I_RSAPRIVATEKEY,0), "D2I_RSAPRIVATEKEY"}, -{ERR_PACK(0,ASN1_F_D2I_RSAPUBLICKEY,0), "D2I_RSAPUBLICKEY"}, -{ERR_PACK(0,ASN1_F_D2I_X509,0), "D2I_X509"}, -{ERR_PACK(0,ASN1_F_D2I_X509_ALGOR,0), "D2I_X509_ALGOR"}, -{ERR_PACK(0,ASN1_F_D2I_X509_ATTRIBUTE,0), "D2I_X509_ATTRIBUTE"}, -{ERR_PACK(0,ASN1_F_D2I_X509_CINF,0), "D2I_X509_CINF"}, -{ERR_PACK(0,ASN1_F_D2I_X509_CRL,0), "D2I_X509_CRL"}, -{ERR_PACK(0,ASN1_F_D2I_X509_CRL_INFO,0), "D2I_X509_CRL_INFO"}, -{ERR_PACK(0,ASN1_F_D2I_X509_EXTENSION,0), "D2I_X509_EXTENSION"}, +{ERR_PACK(0,ASN1_F_D2I_NETSCAPE_RSA,0), "d2i_Netscape_RSA"}, +{ERR_PACK(0,ASN1_F_D2I_NETSCAPE_RSA_2,0), "d2i_Netscape_RSA_2"}, +{ERR_PACK(0,ASN1_F_D2I_NETSCAPE_SPKAC,0), "d2i_NETSCAPE_SPKAC"}, +{ERR_PACK(0,ASN1_F_D2I_NETSCAPE_SPKI,0), "d2i_NETSCAPE_SPKI"}, +{ERR_PACK(0,ASN1_F_D2I_NOTICEREF,0), "d2i_NOTICEREF"}, +{ERR_PACK(0,ASN1_F_D2I_PBE2PARAM,0), "d2i_PBE2PARAM"}, +{ERR_PACK(0,ASN1_F_D2I_PBEPARAM,0), "d2i_PBEPARAM"}, +{ERR_PACK(0,ASN1_F_D2I_PBKDF2PARAM,0), "d2i_PBKDF2PARAM"}, +{ERR_PACK(0,ASN1_F_D2I_PKCS12,0), "d2i_PKCS12"}, +{ERR_PACK(0,ASN1_F_D2I_PKCS12_BAGS,0), "d2i_PKCS12_BAGS"}, +{ERR_PACK(0,ASN1_F_D2I_PKCS12_MAC_DATA,0), "d2i_PKCS12_MAC_DATA"}, +{ERR_PACK(0,ASN1_F_D2I_PKCS12_SAFEBAG,0), "d2i_PKCS12_SAFEBAG"}, +{ERR_PACK(0,ASN1_F_D2I_PKCS7,0), "d2i_PKCS7"}, +{ERR_PACK(0,ASN1_F_D2I_PKCS7_DIGEST,0), "d2i_PKCS7_DIGEST"}, +{ERR_PACK(0,ASN1_F_D2I_PKCS7_ENCRYPT,0), "d2i_PKCS7_ENCRYPT"}, +{ERR_PACK(0,ASN1_F_D2I_PKCS7_ENC_CONTENT,0), "d2i_PKCS7_ENC_CONTENT"}, +{ERR_PACK(0,ASN1_F_D2I_PKCS7_ENVELOPE,0), "d2i_PKCS7_ENVELOPE"}, +{ERR_PACK(0,ASN1_F_D2I_PKCS7_ISSUER_AND_SERIAL,0), "d2i_PKCS7_ISSUER_AND_SERIAL"}, +{ERR_PACK(0,ASN1_F_D2I_PKCS7_RECIP_INFO,0), "d2i_PKCS7_RECIP_INFO"}, +{ERR_PACK(0,ASN1_F_D2I_PKCS7_SIGNED,0), "d2i_PKCS7_SIGNED"}, +{ERR_PACK(0,ASN1_F_D2I_PKCS7_SIGNER_INFO,0), "d2i_PKCS7_SIGNER_INFO"}, +{ERR_PACK(0,ASN1_F_D2I_PKCS7_SIGN_ENVELOPE,0), "d2i_PKCS7_SIGN_ENVELOPE"}, +{ERR_PACK(0,ASN1_F_D2I_PKCS8_PRIV_KEY_INFO,0), "d2i_PKCS8_PRIV_KEY_INFO"}, +{ERR_PACK(0,ASN1_F_D2I_PKEY_USAGE_PERIOD,0), "d2i_PKEY_USAGE_PERIOD"}, +{ERR_PACK(0,ASN1_F_D2I_POLICYINFO,0), "d2i_POLICYINFO"}, +{ERR_PACK(0,ASN1_F_D2I_POLICYQUALINFO,0), "d2i_POLICYQUALINFO"}, +{ERR_PACK(0,ASN1_F_D2I_PRIVATEKEY,0), "d2i_PrivateKey"}, +{ERR_PACK(0,ASN1_F_D2I_PUBLICKEY,0), "d2i_PublicKey"}, +{ERR_PACK(0,ASN1_F_D2I_RSAPRIVATEKEY,0), "d2i_RSAPrivateKey"}, +{ERR_PACK(0,ASN1_F_D2I_RSAPUBLICKEY,0), "d2i_RSAPublicKey"}, +{ERR_PACK(0,ASN1_F_D2I_SXNET,0), "d2i_SXNET"}, +{ERR_PACK(0,ASN1_F_D2I_SXNETID,0), "d2i_SXNETID"}, +{ERR_PACK(0,ASN1_F_D2I_USERNOTICE,0), "d2i_USERNOTICE"}, +{ERR_PACK(0,ASN1_F_D2I_X509,0), "d2i_X509"}, +{ERR_PACK(0,ASN1_F_D2I_X509_ALGOR,0), "d2i_X509_ALGOR"}, +{ERR_PACK(0,ASN1_F_D2I_X509_ATTRIBUTE,0), "d2i_X509_ATTRIBUTE"}, +{ERR_PACK(0,ASN1_F_D2I_X509_CINF,0), "d2i_X509_CINF"}, +{ERR_PACK(0,ASN1_F_D2I_X509_CRL,0), "d2i_X509_CRL"}, +{ERR_PACK(0,ASN1_F_D2I_X509_CRL_INFO,0), "d2i_X509_CRL_INFO"}, +{ERR_PACK(0,ASN1_F_D2I_X509_EXTENSION,0), "d2i_X509_EXTENSION"}, {ERR_PACK(0,ASN1_F_D2I_X509_KEY,0), "D2I_X509_KEY"}, -{ERR_PACK(0,ASN1_F_D2I_X509_NAME,0), "D2I_X509_NAME"}, -{ERR_PACK(0,ASN1_F_D2I_X509_NAME_ENTRY,0), "D2I_X509_NAME_ENTRY"}, -{ERR_PACK(0,ASN1_F_D2I_X509_PKEY,0), "D2I_X509_PKEY"}, -{ERR_PACK(0,ASN1_F_D2I_X509_PUBKEY,0), "D2I_X509_PUBKEY"}, -{ERR_PACK(0,ASN1_F_D2I_X509_REQ,0), "D2I_X509_REQ"}, -{ERR_PACK(0,ASN1_F_D2I_X509_REQ_INFO,0), "D2I_X509_REQ_INFO"}, -{ERR_PACK(0,ASN1_F_D2I_X509_REVOKED,0), "D2I_X509_REVOKED"}, -{ERR_PACK(0,ASN1_F_D2I_X509_SIG,0), "D2I_X509_SIG"}, -{ERR_PACK(0,ASN1_F_D2I_X509_VAL,0), "D2I_X509_VAL"}, +{ERR_PACK(0,ASN1_F_D2I_X509_NAME,0), "d2i_X509_NAME"}, +{ERR_PACK(0,ASN1_F_D2I_X509_NAME_ENTRY,0), "d2i_X509_NAME_ENTRY"}, +{ERR_PACK(0,ASN1_F_D2I_X509_PKEY,0), "d2i_X509_PKEY"}, +{ERR_PACK(0,ASN1_F_D2I_X509_PUBKEY,0), "d2i_X509_PUBKEY"}, +{ERR_PACK(0,ASN1_F_D2I_X509_REQ,0), "d2i_X509_REQ"}, +{ERR_PACK(0,ASN1_F_D2I_X509_REQ_INFO,0), "d2i_X509_REQ_INFO"}, +{ERR_PACK(0,ASN1_F_D2I_X509_REVOKED,0), "d2i_X509_REVOKED"}, +{ERR_PACK(0,ASN1_F_D2I_X509_SIG,0), "d2i_X509_SIG"}, +{ERR_PACK(0,ASN1_F_D2I_X509_VAL,0), "d2i_X509_VAL"}, +{ERR_PACK(0,ASN1_F_DIST_POINT_NAME_NEW,0), "DIST_POINT_NAME_new"}, +{ERR_PACK(0,ASN1_F_DIST_POINT_NEW,0), "DIST_POINT_new"}, +{ERR_PACK(0,ASN1_F_GENERAL_NAME_NEW,0), "GENERAL_NAME_new"}, {ERR_PACK(0,ASN1_F_I2D_ASN1_HEADER,0), "i2d_ASN1_HEADER"}, -{ERR_PACK(0,ASN1_F_I2D_DHPARAMS,0), "I2D_DHPARAMS"}, -{ERR_PACK(0,ASN1_F_I2D_DSAPARAMS,0), "I2D_DSAPARAMS"}, -{ERR_PACK(0,ASN1_F_I2D_DSAPRIVATEKEY,0), "I2D_DSAPRIVATEKEY"}, -{ERR_PACK(0,ASN1_F_I2D_DSAPUBLICKEY,0), "I2D_DSAPUBLICKEY"}, -{ERR_PACK(0,ASN1_F_I2D_NETSCAPE_RSA,0), "I2D_NETSCAPE_RSA"}, -{ERR_PACK(0,ASN1_F_I2D_PKCS7,0), "I2D_PKCS7"}, -{ERR_PACK(0,ASN1_F_I2D_PRIVATEKEY,0), "I2D_PRIVATEKEY"}, -{ERR_PACK(0,ASN1_F_I2D_PUBLICKEY,0), "I2D_PUBLICKEY"}, -{ERR_PACK(0,ASN1_F_I2D_RSAPRIVATEKEY,0), "I2D_RSAPRIVATEKEY"}, -{ERR_PACK(0,ASN1_F_I2D_RSAPUBLICKEY,0), "I2D_RSAPUBLICKEY"}, -{ERR_PACK(0,ASN1_F_I2D_X509_ATTRIBUTE,0), "I2D_X509_ATTRIBUTE"}, +{ERR_PACK(0,ASN1_F_I2D_ASN1_TIME,0), "i2d_ASN1_TIME"}, +{ERR_PACK(0,ASN1_F_I2D_DHPARAMS,0), "i2d_DHparams"}, +{ERR_PACK(0,ASN1_F_I2D_DSAPARAMS,0), "i2d_DSAparams"}, +{ERR_PACK(0,ASN1_F_I2D_DSAPRIVATEKEY,0), "i2d_DSAPrivateKey"}, +{ERR_PACK(0,ASN1_F_I2D_DSAPUBLICKEY,0), "i2d_DSAPublicKey"}, +{ERR_PACK(0,ASN1_F_I2D_NETSCAPE_RSA,0), "i2d_Netscape_RSA"}, +{ERR_PACK(0,ASN1_F_I2D_PKCS7,0), "i2d_PKCS7"}, +{ERR_PACK(0,ASN1_F_I2D_PRIVATEKEY,0), "i2d_PrivateKey"}, +{ERR_PACK(0,ASN1_F_I2D_PUBLICKEY,0), "i2d_PublicKey"}, +{ERR_PACK(0,ASN1_F_I2D_RSAPRIVATEKEY,0), "i2d_RSAPrivateKey"}, +{ERR_PACK(0,ASN1_F_I2D_RSAPUBLICKEY,0), "i2d_RSAPublicKey"}, +{ERR_PACK(0,ASN1_F_I2D_X509_ATTRIBUTE,0), "i2d_X509_ATTRIBUTE"}, {ERR_PACK(0,ASN1_F_I2T_ASN1_OBJECT,0), "i2t_ASN1_OBJECT"}, +{ERR_PACK(0,ASN1_F_NETSCAPE_CERT_SEQUENCE_NEW,0), "NETSCAPE_CERT_SEQUENCE_new"}, {ERR_PACK(0,ASN1_F_NETSCAPE_PKEY_NEW,0), "NETSCAPE_PKEY_NEW"}, -{ERR_PACK(0,ASN1_F_NETSCAPE_SPKAC_NEW,0), "NETSCAPE_SPKAC_NEW"}, -{ERR_PACK(0,ASN1_F_NETSCAPE_SPKI_NEW,0), "NETSCAPE_SPKI_NEW"}, -{ERR_PACK(0,ASN1_F_PKCS7_DIGEST_NEW,0), "PKCS7_DIGEST_NEW"}, -{ERR_PACK(0,ASN1_F_PKCS7_ENCRYPT_NEW,0), "PKCS7_ENCRYPT_NEW"}, -{ERR_PACK(0,ASN1_F_PKCS7_ENC_CONTENT_NEW,0), "PKCS7_ENC_CONTENT_NEW"}, -{ERR_PACK(0,ASN1_F_PKCS7_ENVELOPE_NEW,0), "PKCS7_ENVELOPE_NEW"}, -{ERR_PACK(0,ASN1_F_PKCS7_ISSUER_AND_SERIAL_NEW,0), "PKCS7_ISSUER_AND_SERIAL_NEW"}, -{ERR_PACK(0,ASN1_F_PKCS7_NEW,0), "PKCS7_NEW"}, -{ERR_PACK(0,ASN1_F_PKCS7_RECIP_INFO_NEW,0), "PKCS7_RECIP_INFO_NEW"}, -{ERR_PACK(0,ASN1_F_PKCS7_SIGNED_NEW,0), "PKCS7_SIGNED_NEW"}, -{ERR_PACK(0,ASN1_F_PKCS7_SIGNER_INFO_NEW,0), "PKCS7_SIGNER_INFO_NEW"}, -{ERR_PACK(0,ASN1_F_PKCS7_SIGN_ENVELOPE_NEW,0), "PKCS7_SIGN_ENVELOPE_NEW"}, -{ERR_PACK(0,ASN1_F_X509_ALGOR_NEW,0), "X509_ALGOR_NEW"}, -{ERR_PACK(0,ASN1_F_X509_ATTRIBUTE_NEW,0), "X509_ATTRIBUTE_NEW"}, -{ERR_PACK(0,ASN1_F_X509_CINF_NEW,0), "X509_CINF_NEW"}, -{ERR_PACK(0,ASN1_F_X509_CRL_INFO_NEW,0), "X509_CRL_INFO_NEW"}, -{ERR_PACK(0,ASN1_F_X509_CRL_NEW,0), "X509_CRL_NEW"}, +{ERR_PACK(0,ASN1_F_NETSCAPE_SPKAC_NEW,0), "NETSCAPE_SPKAC_new"}, +{ERR_PACK(0,ASN1_F_NETSCAPE_SPKI_NEW,0), "NETSCAPE_SPKI_new"}, +{ERR_PACK(0,ASN1_F_NOTICEREF_NEW,0), "NOTICEREF_new"}, +{ERR_PACK(0,ASN1_F_PBE2PARAM_NEW,0), "PBE2PARAM_new"}, +{ERR_PACK(0,ASN1_F_PBEPARAM_NEW,0), "PBEPARAM_new"}, +{ERR_PACK(0,ASN1_F_PBKDF2PARAM_NEW,0), "PBKDF2PARAM_new"}, +{ERR_PACK(0,ASN1_F_PKCS12_BAGS_NEW,0), "PKCS12_BAGS_new"}, +{ERR_PACK(0,ASN1_F_PKCS12_MAC_DATA_NEW,0), "PKCS12_MAC_DATA_new"}, +{ERR_PACK(0,ASN1_F_PKCS12_NEW,0), "PKCS12_new"}, +{ERR_PACK(0,ASN1_F_PKCS12_SAFEBAG_NEW,0), "PKCS12_SAFEBAG_new"}, +{ERR_PACK(0,ASN1_F_PKCS5_PBE2_SET,0), "PKCS5_pbe2_set"}, +{ERR_PACK(0,ASN1_F_PKCS7_DIGEST_NEW,0), "PKCS7_DIGEST_new"}, +{ERR_PACK(0,ASN1_F_PKCS7_ENCRYPT_NEW,0), "PKCS7_ENCRYPT_new"}, +{ERR_PACK(0,ASN1_F_PKCS7_ENC_CONTENT_NEW,0), "PKCS7_ENC_CONTENT_new"}, +{ERR_PACK(0,ASN1_F_PKCS7_ENVELOPE_NEW,0), "PKCS7_ENVELOPE_new"}, +{ERR_PACK(0,ASN1_F_PKCS7_ISSUER_AND_SERIAL_NEW,0), "PKCS7_ISSUER_AND_SERIAL_new"}, +{ERR_PACK(0,ASN1_F_PKCS7_NEW,0), "PKCS7_new"}, +{ERR_PACK(0,ASN1_F_PKCS7_RECIP_INFO_NEW,0), "PKCS7_RECIP_INFO_new"}, +{ERR_PACK(0,ASN1_F_PKCS7_SIGNED_NEW,0), "PKCS7_SIGNED_new"}, +{ERR_PACK(0,ASN1_F_PKCS7_SIGNER_INFO_NEW,0), "PKCS7_SIGNER_INFO_new"}, +{ERR_PACK(0,ASN1_F_PKCS7_SIGN_ENVELOPE_NEW,0), "PKCS7_SIGN_ENVELOPE_new"}, +{ERR_PACK(0,ASN1_F_PKCS8_PRIV_KEY_INFO_NEW,0), "PKCS8_PRIV_KEY_INFO_new"}, +{ERR_PACK(0,ASN1_F_PKEY_USAGE_PERIOD_NEW,0), "PKEY_USAGE_PERIOD_new"}, +{ERR_PACK(0,ASN1_F_POLICYINFO_NEW,0), "POLICYINFO_new"}, +{ERR_PACK(0,ASN1_F_POLICYQUALINFO_NEW,0), "POLICYQUALINFO_new"}, +{ERR_PACK(0,ASN1_F_SXNETID_NEW,0), "SXNETID_new"}, +{ERR_PACK(0,ASN1_F_SXNET_NEW,0), "SXNET_new"}, +{ERR_PACK(0,ASN1_F_USERNOTICE_NEW,0), "USERNOTICE_new"}, +{ERR_PACK(0,ASN1_F_X509_ALGOR_NEW,0), "X509_ALGOR_new"}, +{ERR_PACK(0,ASN1_F_X509_ATTRIBUTE_NEW,0), "X509_ATTRIBUTE_new"}, +{ERR_PACK(0,ASN1_F_X509_CINF_NEW,0), "X509_CINF_new"}, +{ERR_PACK(0,ASN1_F_X509_CRL_INFO_NEW,0), "X509_CRL_INFO_new"}, +{ERR_PACK(0,ASN1_F_X509_CRL_NEW,0), "X509_CRL_new"}, {ERR_PACK(0,ASN1_F_X509_DHPARAMS_NEW,0), "X509_DHPARAMS_NEW"}, -{ERR_PACK(0,ASN1_F_X509_EXTENSION_NEW,0), "X509_EXTENSION_NEW"}, -{ERR_PACK(0,ASN1_F_X509_INFO_NEW,0), "X509_INFO_NEW"}, +{ERR_PACK(0,ASN1_F_X509_EXTENSION_NEW,0), "X509_EXTENSION_new"}, +{ERR_PACK(0,ASN1_F_X509_INFO_NEW,0), "X509_INFO_new"}, {ERR_PACK(0,ASN1_F_X509_KEY_NEW,0), "X509_KEY_NEW"}, -{ERR_PACK(0,ASN1_F_X509_NAME_ENTRY_NEW,0), "X509_NAME_ENTRY_NEW"}, -{ERR_PACK(0,ASN1_F_X509_NAME_NEW,0), "X509_NAME_NEW"}, -{ERR_PACK(0,ASN1_F_X509_NEW,0), "X509_NEW"}, -{ERR_PACK(0,ASN1_F_X509_PKEY_NEW,0), "X509_PKEY_NEW"}, -{ERR_PACK(0,ASN1_F_X509_PUBKEY_NEW,0), "X509_PUBKEY_NEW"}, -{ERR_PACK(0,ASN1_F_X509_REQ_INFO_NEW,0), "X509_REQ_INFO_NEW"}, -{ERR_PACK(0,ASN1_F_X509_REQ_NEW,0), "X509_REQ_NEW"}, -{ERR_PACK(0,ASN1_F_X509_REVOKED_NEW,0), "X509_REVOKED_NEW"}, -{ERR_PACK(0,ASN1_F_X509_SIG_NEW,0), "X509_SIG_NEW"}, -{ERR_PACK(0,ASN1_F_X509_VAL_FREE,0), "X509_VAL_FREE"}, -{ERR_PACK(0,ASN1_F_X509_VAL_NEW,0), "X509_VAL_NEW"}, -{0,NULL}, +{ERR_PACK(0,ASN1_F_X509_NAME_ENTRY_NEW,0), "X509_NAME_ENTRY_new"}, +{ERR_PACK(0,ASN1_F_X509_NAME_NEW,0), "X509_NAME_new"}, +{ERR_PACK(0,ASN1_F_X509_NEW,0), "X509_new"}, +{ERR_PACK(0,ASN1_F_X509_PKEY_NEW,0), "X509_PKEY_new"}, +{ERR_PACK(0,ASN1_F_X509_PUBKEY_NEW,0), "X509_PUBKEY_new"}, +{ERR_PACK(0,ASN1_F_X509_REQ_INFO_NEW,0), "X509_REQ_INFO_new"}, +{ERR_PACK(0,ASN1_F_X509_REQ_NEW,0), "X509_REQ_new"}, +{ERR_PACK(0,ASN1_F_X509_REVOKED_NEW,0), "X509_REVOKED_new"}, +{ERR_PACK(0,ASN1_F_X509_SIG_NEW,0), "X509_SIG_new"}, +{ERR_PACK(0,ASN1_F_X509_VAL_FREE,0), "X509_VAL_free"}, +{ERR_PACK(0,ASN1_F_X509_VAL_NEW,0), "X509_VAL_new"}, +{0,NULL} }; static ERR_STRING_DATA ASN1_str_reasons[]= { {ASN1_R_BAD_CLASS ,"bad class"}, -{ASN1_R_BAD_GET_OBJECT ,"bad get object"}, {ASN1_R_BAD_OBJECT_HEADER ,"bad object header"}, {ASN1_R_BAD_PASSWORD_READ ,"bad password read"}, {ASN1_R_BAD_PKCS7_CONTENT ,"bad pkcs7 content"}, @@ -202,24 +263,28 @@ static ERR_STRING_DATA ASN1_str_reasons[]= {ASN1_R_BOOLEAN_IS_WRONG_LENGTH ,"boolean is wrong length"}, {ASN1_R_BUFFER_TOO_SMALL ,"buffer too small"}, {ASN1_R_DATA_IS_WRONG ,"data is wrong"}, +{ASN1_R_DECODE_ERROR ,"decode error"}, {ASN1_R_DECODING_ERROR ,"decoding error"}, -{ASN1_R_ERROR_STACK ,"error stack"}, +{ASN1_R_ENCODE_ERROR ,"encode error"}, +{ASN1_R_ERROR_PARSING_SET_ELEMENT ,"error parsing set element"}, +{ASN1_R_ERROR_SETTING_CIPHER_PARAMS ,"error setting cipher params"}, +{ASN1_R_EXPECTING_AN_ENUMERATED ,"expecting an enumerated"}, {ASN1_R_EXPECTING_AN_INTEGER ,"expecting an integer"}, {ASN1_R_EXPECTING_AN_OBJECT ,"expecting an object"}, {ASN1_R_EXPECTING_AN_OCTET_STRING ,"expecting an octet string"}, {ASN1_R_EXPECTING_A_BIT_STRING ,"expecting a bit string"}, {ASN1_R_EXPECTING_A_BOOLEAN ,"expecting a boolean"}, -{ASN1_R_EXPECTING_A_SEQUENCE ,"expecting a sequence"}, +{ASN1_R_EXPECTING_A_GENERALIZEDTIME ,"expecting a generalizedtime"}, +{ASN1_R_EXPECTING_A_TIME ,"expecting a time"}, {ASN1_R_EXPECTING_A_UTCTIME ,"expecting a utctime"}, {ASN1_R_FIRST_NUM_TOO_LARGE ,"first num too large"}, +{ASN1_R_GENERALIZEDTIME_TOO_LONG ,"generalizedtime too long"}, {ASN1_R_HEADER_TOO_LONG ,"header too long"}, {ASN1_R_INVALID_DIGIT ,"invalid digit"}, {ASN1_R_INVALID_SEPARATOR ,"invalid separator"}, {ASN1_R_INVALID_TIME_FORMAT ,"invalid time format"}, {ASN1_R_IV_TOO_LARGE ,"iv too large"}, {ASN1_R_LENGTH_ERROR ,"length error"}, -{ASN1_R_LENGTH_MISMATCH ,"length mismatch"}, -{ASN1_R_MISSING_EOS ,"missing eos"}, {ASN1_R_MISSING_SECOND_NUMBER ,"missing second number"}, {ASN1_R_NON_HEX_CHARACTERS ,"non hex characters"}, {ASN1_R_NOT_ENOUGH_DATA ,"not enough data"}, @@ -245,17 +310,17 @@ static ERR_STRING_DATA ASN1_str_reasons[]= {ASN1_R_WRONG_PRINTABLE_TYPE ,"wrong printable type"}, {ASN1_R_WRONG_TAG ,"wrong tag"}, {ASN1_R_WRONG_TYPE ,"wrong type"}, -{0,NULL}, +{0,NULL} }; #endif -void ERR_load_ASN1_strings() +void ERR_load_ASN1_strings(void) { static int init=1; - if (init); - {; + if (init) + { init=0; #ifndef NO_ERR 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 @@ #include #include "cryptlib.h" -#include "asn1.h" -#include "asn1_mac.h" +#include +#include -#ifndef NOPROTO static int asn1_get_length(unsigned char **pp,int *inf,long *rl,int max); static void asn1_put_length(unsigned char **pp, int length); -#else -static int asn1_get_length(); -static void asn1_put_length(); -#endif - -char *ASN1_version="ASN1 part of SSLeay 0.9.0b 29-Jun-1998"; +const char *ASN1_version="ASN.1" OPENSSL_VERSION_PTEXT; -int ASN1_check_infinite_end(p,len) -unsigned char **p; -long len; +int ASN1_check_infinite_end(unsigned char **p, long len) { /* If there is 0 or 1 byte left, the length check should pick * things up */ @@ -88,12 +80,8 @@ long len; } -int ASN1_get_object(pp, plength, ptag, pclass, omax) -unsigned char **pp; -long *plength; -int *ptag; -int *pclass; -long omax; +int ASN1_get_object(unsigned char **pp, long *plength, int *ptag, int *pclass, + long omax) { int i,ret; long l; @@ -104,8 +92,8 @@ long omax; if (!max) goto err; ret=(*p&V_ASN1_CONSTRUCTED); xclass=(*p&V_ASN1_PRIVATE); - i= *p&V_ASN1_PRIMATIVE_TAG; - if (i == V_ASN1_PRIMATIVE_TAG) + i= *p&V_ASN1_PRIMITIVE_TAG; + if (i == V_ASN1_PRIMITIVE_TAG) { /* high-tag */ p++; if (--max == 0) goto err; @@ -130,11 +118,13 @@ long omax; *pclass=xclass; if (!asn1_get_length(&p,&inf,plength,(int)max)) goto err; -#ifdef undef - fprintf(stderr,"p=%d + *plength=%d > omax=%d + *pp=%d (%d > %d)\n", - p,*plength,omax,*pp,(p+ *plength),omax+ *pp); +#if 0 + fprintf(stderr,"p=%d + *plength=%ld > omax=%ld + *pp=%d (%d > %d)\n", + (int)p,*plength,omax,(int)*pp,(int)(p+ *plength), + (int)(omax+ *pp)); #endif +#if 0 if ((p+ *plength) > (omax+ *pp)) { ASN1err(ASN1_F_ASN1_GET_OBJECT,ASN1_R_TOO_LONG); @@ -142,18 +132,15 @@ long omax; * the values are set correctly */ ret|=0x80; } +#endif *pp=p; - return(ret+inf); + return(ret|inf); err: ASN1err(ASN1_F_ASN1_GET_OBJECT,ASN1_R_HEADER_TOO_LONG); return(0x80); } -static int asn1_get_length(pp,inf,rl,max) -unsigned char **pp; -int *inf; -long *rl; -int max; +static int asn1_get_length(unsigned char **pp, int *inf, long *rl, int max) { unsigned char *p= *pp; long ret=0; @@ -190,12 +177,8 @@ int max; /* class 0 is constructed * constructed == 2 for indefinitle length constructed */ -void ASN1_put_object(pp,constructed,length,tag,xclass) -unsigned char **pp; -int constructed; -int length; -int tag; -int xclass; +void ASN1_put_object(unsigned char **pp, int constructed, int length, int tag, + int xclass) { unsigned char *p= *pp; int i; @@ -203,10 +186,10 @@ int xclass; i=(constructed)?V_ASN1_CONSTRUCTED:0; i|=(xclass&V_ASN1_PRIVATE); if (tag < 31) - *(p++)=i|(tag&V_ASN1_PRIMATIVE_TAG); + *(p++)=i|(tag&V_ASN1_PRIMITIVE_TAG); else { - *(p++)=i|V_ASN1_PRIMATIVE_TAG; + *(p++)=i|V_ASN1_PRIMITIVE_TAG; while (tag > 0x7f) { *(p++)=(tag&0x7f)|0x80; @@ -221,9 +204,7 @@ int xclass; *pp=p; } -static void asn1_put_length(pp, length) -unsigned char **pp; -int length; +static void asn1_put_length(unsigned char **pp, int length) { unsigned char *p= *pp; int i,l; @@ -246,10 +227,7 @@ int length; *pp=p; } -int ASN1_object_size(constructed, length, tag) -int constructed; -int length; -int tag; +int ASN1_object_size(int constructed, int length, int tag) { int ret; @@ -277,29 +255,26 @@ int tag; return(ret); } -int asn1_Finish(c) -ASN1_CTX *c; +int asn1_Finish(ASN1_CTX *c) { if ((c->inf == (1|V_ASN1_CONSTRUCTED)) && (!c->eos)) { if (!ASN1_check_infinite_end(&c->p,c->slen)) { - c->error=ASN1_R_MISSING_EOS; + c->error=ERR_R_MISSING_ASN1_EOS; return(0); } } if ( ((c->slen != 0) && !(c->inf & 1)) || ((c->slen < 0) && (c->inf & 1))) { - c->error=ASN1_R_LENGTH_MISMATCH; + c->error=ERR_R_ASN1_LENGTH_MISMATCH; return(0); } return(1); } -int asn1_GetSequence(c,length) -ASN1_CTX *c; -long *length; +int asn1_GetSequence(ASN1_CTX *c, long *length) { unsigned char *q; @@ -308,18 +283,18 @@ long *length; *length); if (c->inf & 0x80) { - c->error=ASN1_R_BAD_GET_OBJECT; + c->error=ERR_R_BAD_GET_ASN1_OBJECT_CALL; return(0); } if (c->tag != V_ASN1_SEQUENCE) { - c->error=ASN1_R_EXPECTING_A_SEQUENCE; + c->error=ERR_R_EXPECTING_AN_ASN1_SEQUENCE; return(0); } (*length)-=(c->p-q); if (c->max && (*length < 0)) { - c->error=ASN1_R_LENGTH_MISMATCH; + c->error=ERR_R_ASN1_LENGTH_MISMATCH; return(0); } if (c->inf == (1|V_ASN1_CONSTRUCTED)) @@ -328,8 +303,7 @@ long *length; return(1); } -ASN1_STRING *ASN1_STRING_dup(str) -ASN1_STRING *str; +ASN1_STRING *ASN1_STRING_dup(ASN1_STRING *str) { ASN1_STRING *ret; @@ -341,34 +315,33 @@ ASN1_STRING *str; ASN1_STRING_free(ret); return(NULL); } + ret->flags = str->flags; return(ret); } -int ASN1_STRING_set(str,data,len) -ASN1_STRING *str; -unsigned char *data; -int len; +int ASN1_STRING_set(ASN1_STRING *str, const void *_data, int len) { - char *c; + unsigned char *c; + const char *data=_data; if (len < 0) { if (data == NULL) return(0); else - len=strlen((char *)data); + len=strlen(data); } if ((str->length < len) || (str->data == NULL)) { - c=(char *)str->data; + c=str->data; if (c == NULL) - str->data=(unsigned char *)Malloc(len+1); + str->data=Malloc(len+1); else - str->data=(unsigned char *)Realloc(c,len+1); + str->data=Realloc(c,len+1); if (str->data == NULL) { - str->data=(unsigned char *)c; + str->data=c; return(0); } } @@ -382,14 +355,13 @@ int len; return(1); } -ASN1_STRING *ASN1_STRING_new() +ASN1_STRING *ASN1_STRING_new(void) { return(ASN1_STRING_type_new(V_ASN1_OCTET_STRING)); } -ASN1_STRING *ASN1_STRING_type_new(type) -int type; +ASN1_STRING *ASN1_STRING_type_new(int type) { ASN1_STRING *ret; @@ -402,19 +374,18 @@ int type; ret->length=0; ret->type=type; ret->data=NULL; + ret->flags=0; return(ret); } -void ASN1_STRING_free(a) -ASN1_STRING *a; +void ASN1_STRING_free(ASN1_STRING *a) { if (a == NULL) return; if (a->data != NULL) Free((char *)a->data); Free((char *)a); } -int ASN1_STRING_cmp(a,b) -ASN1_STRING *a,*b; +int ASN1_STRING_cmp(ASN1_STRING *a, ASN1_STRING *b) { int i; @@ -431,9 +402,7 @@ ASN1_STRING *a,*b; return(i); } -void asn1_add_error(address,offset) -unsigned char *address; -int offset; +void asn1_add_error(unsigned char *address, int offset) { char buf1[16],buf2[16]; 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 @@ extern "C" { #endif -#include "asn1.h" -#include "x509.h" -#include "pkcs7.h" +#include + +#ifndef ASN1_MAC_ERR_LIB +#define ASN1_MAC_ERR_LIB ERR_LIB_ASN1 +#endif + +#define ASN1_MAC_H_err(f,r,line) \ + ERR_PUT_error(ASN1_MAC_ERR_LIB,(f),(r),ERR_file_name,(line)) #define M_ASN1_D2I_vars(a,type,func) \ ASN1_CTX c; \ type ret=NULL; \ \ c.pp=pp; \ - c.error=ASN1_R_ERROR_STACK; \ + c.q= *pp; \ + c.error=ERR_R_NESTED_ASN1_ERROR; \ if ((a == NULL) || ((*a) == NULL)) \ - { if ((ret=(type)func()) == NULL) goto err; } \ + { if ((ret=(type)func()) == NULL) \ + { c.line=__LINE__; goto err; } } \ else ret=(*a); #define M_ASN1_D2I_Init() \ @@ -82,7 +89,8 @@ extern "C" { c.max=(length == 0)?0:(c.p+length); #define M_ASN1_D2I_Finish_2(a) \ - if (!asn1_Finish(&c)) goto err; \ + if (!asn1_Finish(&c)) \ + { c.line=__LINE__; goto err; } \ *pp=c.p; \ if (a != NULL) (*a)=ret; \ return(ret); @@ -90,21 +98,31 @@ extern "C" { #define M_ASN1_D2I_Finish(a,func,e) \ M_ASN1_D2I_Finish_2(a); \ err:\ - ASN1err((e),c.error); \ + ASN1_MAC_H_err((e),c.error,c.line); \ asn1_add_error(*pp,(int)(c.q- *pp)); \ if ((ret != NULL) && ((a == NULL) || (*a != ret))) func(ret); \ return(NULL) #define M_ASN1_D2I_start_sequence() \ - if (!asn1_GetSequence(&c,&length)) goto err; + if (!asn1_GetSequence(&c,&length)) \ + { c.line=__LINE__; goto err; } #define M_ASN1_D2I_end_sequence() \ (((c.inf&1) == 0)?(c.slen <= 0): \ (c.eos=ASN1_check_infinite_end(&c.p,c.slen))) +/* Don't use this with d2i_ASN1_BOOLEAN() */ #define M_ASN1_D2I_get(b,func) \ c.q=c.p; \ - if (func(&(b),&c.p,c.slen) == NULL) goto err; \ + if (func(&(b),&c.p,c.slen) == NULL) \ + {c.line=__LINE__; goto err; } \ + c.slen-=(c.p-c.q); + +/* use this instead () */ +#define M_ASN1_D2I_get_int(b,func) \ + c.q=c.p; \ + if (func(&(b),&c.p,c.slen) < 0) \ + {c.line=__LINE__; goto err; } \ c.slen-=(c.p-c.q); #define M_ASN1_D2I_get_opt(b,func,type) \ @@ -114,49 +132,118 @@ err:\ M_ASN1_D2I_get(b,func); \ } +#define M_ASN1_D2I_get_imp(b,func, type) \ + M_ASN1_next=(_tmp& V_ASN1_CONSTRUCTED)|type; \ + c.q=c.p; \ + if (func(&(b),&c.p,c.slen) == NULL) \ + {c.line=__LINE__; M_ASN1_next_prev = _tmp; goto err; } \ + c.slen-=(c.p-c.q);\ + M_ASN1_next_prev=_tmp; + #define M_ASN1_D2I_get_IMP_opt(b,func,tag,type) \ if ((c.slen != 0) && ((M_ASN1_next & (~V_ASN1_CONSTRUCTED)) == \ (V_ASN1_CONTEXT_SPECIFIC|(tag)))) \ { \ - unsigned char tmp; \ - tmp=M_ASN1_next; \ - M_ASN1_next=(tmp& ~V_ASN1_PRIMATIVE_TAG)|type; \ - M_ASN1_D2I_get(b,func); \ - M_ASN1_next_prev=tmp; \ + unsigned char _tmp = M_ASN1_next; \ + M_ASN1_D2I_get_imp(b,func, type);\ } -#define M_ASN1_D2I_get_set(r,func) \ - M_ASN1_D2I_get_imp_set(r,func,V_ASN1_SET,V_ASN1_UNIVERSAL); +#define M_ASN1_D2I_get_set(r,func,free_func) \ + M_ASN1_D2I_get_imp_set(r,func,free_func, \ + V_ASN1_SET,V_ASN1_UNIVERSAL); + +#define M_ASN1_D2I_get_set_type(type,r,func,free_func) \ + M_ASN1_D2I_get_imp_set_type(type,r,func,free_func, \ + V_ASN1_SET,V_ASN1_UNIVERSAL); + +#define M_ASN1_D2I_get_set_opt(r,func,free_func) \ + if ((c.slen != 0) && (M_ASN1_next == (V_ASN1_UNIVERSAL| \ + V_ASN1_CONSTRUCTED|V_ASN1_SET)))\ + { M_ASN1_D2I_get_set(r,func,free_func); } + +#define M_ASN1_D2I_get_set_opt_type(type,r,func,free_func) \ + if ((c.slen != 0) && (M_ASN1_next == (V_ASN1_UNIVERSAL| \ + V_ASN1_CONSTRUCTED|V_ASN1_SET)))\ + { M_ASN1_D2I_get_set_type(type,r,func,free_func); } + +#define M_ASN1_I2D_len_SET_opt(a,f) \ + if ((a != NULL) && (sk_num(a) != 0)) \ + M_ASN1_I2D_len_SET(a,f); + +#define M_ASN1_I2D_put_SET_opt(a,f) \ + if ((a != NULL) && (sk_num(a) != 0)) \ + M_ASN1_I2D_put_SET(a,f); + +#define M_ASN1_I2D_put_SEQUENCE_opt(a,f) \ + if ((a != NULL) && (sk_num(a) != 0)) \ + M_ASN1_I2D_put_SEQUENCE(a,f); + +#define M_ASN1_I2D_put_SEQUENCE_opt_type(type,a,f) \ + if ((a != NULL) && (sk_##type##_num(a) != 0)) \ + M_ASN1_I2D_put_SEQUENCE_type(type,a,f); + +#define M_ASN1_D2I_get_IMP_set_opt(b,func,free_func,tag) \ + if ((c.slen != 0) && \ + (M_ASN1_next == \ + (V_ASN1_CONTEXT_SPECIFIC|V_ASN1_CONSTRUCTED|(tag))))\ + { \ + M_ASN1_D2I_get_imp_set(b,func,free_func,\ + tag,V_ASN1_CONTEXT_SPECIFIC); \ + } -#define M_ASN1_D2I_get_IMP_set_opt(b,func,tag) \ +#define M_ASN1_D2I_get_IMP_set_opt_type(type,b,func,free_func,tag) \ if ((c.slen != 0) && \ (M_ASN1_next == \ (V_ASN1_CONTEXT_SPECIFIC|V_ASN1_CONSTRUCTED|(tag))))\ { \ - M_ASN1_D2I_get_imp_set(b,func,tag,V_ASN1_CONTEXT_SPECIFIC); \ + M_ASN1_D2I_get_imp_set_type(type,b,func,free_func,\ + tag,V_ASN1_CONTEXT_SPECIFIC); \ } -#define M_ASN1_D2I_get_seq(r,func) \ - M_ASN1_D2I_get_imp_set(r,func,V_ASN1_SEQUENCE,V_ASN1_UNIVERSAL); +#define M_ASN1_D2I_get_seq(r,func,free_func) \ + M_ASN1_D2I_get_imp_set(r,func,free_func,\ + V_ASN1_SEQUENCE,V_ASN1_UNIVERSAL); + +#define M_ASN1_D2I_get_seq_type(type,r,func,free_func) \ + M_ASN1_D2I_get_imp_set_type(type,r,func,free_func,\ + V_ASN1_SEQUENCE,V_ASN1_UNIVERSAL) -#define M_ASN1_D2I_get_seq_opt(r,func) \ +#define M_ASN1_D2I_get_seq_opt(r,func,free_func) \ if ((c.slen != 0) && (M_ASN1_next == (V_ASN1_UNIVERSAL| \ V_ASN1_CONSTRUCTED|V_ASN1_SEQUENCE)))\ - { M_ASN1_D2I_get_seq(r,func); } + { M_ASN1_D2I_get_seq(r,func,free_func); } -#define M_ASN1_D2I_get_IMP_set(r,func,x) \ - M_ASN1_D2I_get_imp_set(r,func,x,V_ASN1_CONTEXT_SPECIFIC); +#define M_ASN1_D2I_get_seq_opt_type(type,r,func,free_func) \ + if ((c.slen != 0) && (M_ASN1_next == (V_ASN1_UNIVERSAL| \ + V_ASN1_CONSTRUCTED|V_ASN1_SEQUENCE)))\ + { M_ASN1_D2I_get_seq_type(type,r,func,free_func); } + +#define M_ASN1_D2I_get_IMP_set(r,func,free_func,x) \ + M_ASN1_D2I_get_imp_set(r,func,free_func,\ + x,V_ASN1_CONTEXT_SPECIFIC); -#define M_ASN1_D2I_get_imp_set(r,func,a,b) \ +#define M_ASN1_D2I_get_IMP_set_type(type,r,func,free_func,x) \ + M_ASN1_D2I_get_imp_set_type(type,r,func,free_func,\ + x,V_ASN1_CONTEXT_SPECIFIC); + +#define M_ASN1_D2I_get_imp_set(r,func,free_func,a,b) \ c.q=c.p; \ - if (d2i_ASN1_SET(&(r),&c.p,c.slen,(char *(*)())func,a,b) == NULL) \ - goto err; \ + if (d2i_ASN1_SET(&(r),&c.p,c.slen,(char *(*)())func,\ + (void (*)())free_func,a,b) == NULL) \ + { c.line=__LINE__; goto err; } \ + c.slen-=(c.p-c.q); + +#define M_ASN1_D2I_get_imp_set_type(type,r,func,free_func,a,b) \ + c.q=c.p; \ + if (d2i_ASN1_SET_OF_##type(&(r),&c.p,c.slen,func,\ + free_func,a,b) == NULL) \ + { c.line=__LINE__; goto err; } \ c.slen-=(c.p-c.q); #define M_ASN1_D2I_get_set_strings(r,func,a,b) \ c.q=c.p; \ if (d2i_ASN1_STRING_SET(&(r),&c.p,c.slen,a,b) == NULL) \ - goto err; \ + { c.line=__LINE__; goto err; } \ c.slen-=(c.p-c.q); #define M_ASN1_D2I_get_EXP_opt(r,func,tag) \ @@ -169,13 +256,22 @@ err:\ c.q=c.p; \ Tinf=ASN1_get_object(&c.p,&Tlen,&Ttag,&Tclass,c.slen); \ if (Tinf & 0x80) \ - { c.error=ASN1_R_BAD_OBJECT_HEADER; goto err; } \ + { c.error=ERR_R_BAD_ASN1_OBJECT_HEADER; \ + c.line=__LINE__; goto err; } \ + if (Tinf == (V_ASN1_CONSTRUCTED+1)) \ + Tlen = c.slen - (c.p - c.q) - 2; \ if (func(&(r),&c.p,Tlen) == NULL) \ - goto err; \ + { c.line=__LINE__; goto err; } \ + if (Tinf == (V_ASN1_CONSTRUCTED+1)) { \ + Tlen = c.slen - (c.p - c.q); \ + if(!ASN1_check_infinite_end(&c.p, Tlen)) \ + { c.error=ERR_R_MISSING_ASN1_EOS; \ + c.line=__LINE__; goto err; } \ + }\ c.slen-=(c.p-c.q); \ } -#define M_ASN1_D2I_get_EXP_set_opt(r,func,tag,b) \ +#define M_ASN1_D2I_get_EXP_set_opt(r,func,free_func,tag,b) \ if ((c.slen != 0) && (M_ASN1_next == \ (V_ASN1_CONSTRUCTED|V_ASN1_CONTEXT_SPECIFIC|tag))) \ { \ @@ -185,24 +281,61 @@ err:\ c.q=c.p; \ Tinf=ASN1_get_object(&c.p,&Tlen,&Ttag,&Tclass,c.slen); \ if (Tinf & 0x80) \ - { c.error=ASN1_R_BAD_OBJECT_HEADER; goto err; } \ + { c.error=ERR_R_BAD_ASN1_OBJECT_HEADER; \ + c.line=__LINE__; goto err; } \ + if (Tinf == (V_ASN1_CONSTRUCTED+1)) \ + Tlen = c.slen - (c.p - c.q) - 2; \ if (d2i_ASN1_SET(&(r),&c.p,Tlen,(char *(*)())func, \ + (void (*)())free_func, \ b,V_ASN1_UNIVERSAL) == NULL) \ - goto err; \ + { c.line=__LINE__; goto err; } \ + if (Tinf == (V_ASN1_CONSTRUCTED+1)) { \ + Tlen = c.slen - (c.p - c.q); \ + if(!ASN1_check_infinite_end(&c.p, Tlen)) \ + { c.error=ERR_R_MISSING_ASN1_EOS; \ + c.line=__LINE__; goto err; } \ + }\ + c.slen-=(c.p-c.q); \ + } + +#define M_ASN1_D2I_get_EXP_set_opt_type(type,r,func,free_func,tag,b) \ + if ((c.slen != 0) && (M_ASN1_next == \ + (V_ASN1_CONSTRUCTED|V_ASN1_CONTEXT_SPECIFIC|tag))) \ + { \ + int Tinf,Ttag,Tclass; \ + long Tlen; \ + \ + c.q=c.p; \ + Tinf=ASN1_get_object(&c.p,&Tlen,&Ttag,&Tclass,c.slen); \ + if (Tinf & 0x80) \ + { c.error=ERR_R_BAD_ASN1_OBJECT_HEADER; \ + c.line=__LINE__; goto err; } \ + if (Tinf == (V_ASN1_CONSTRUCTED+1)) \ + Tlen = c.slen - (c.p - c.q) - 2; \ + if (d2i_ASN1_SET_OF_##type(&(r),&c.p,Tlen,func, \ + free_func,b,V_ASN1_UNIVERSAL) == NULL) \ + { c.line=__LINE__; goto err; } \ + if (Tinf == (V_ASN1_CONSTRUCTED+1)) { \ + Tlen = c.slen - (c.p - c.q); \ + if(!ASN1_check_infinite_end(&c.p, Tlen)) \ + { c.error=ERR_R_MISSING_ASN1_EOS; \ + c.line=__LINE__; goto err; } \ + }\ c.slen-=(c.p-c.q); \ } /* New macros */ #define M_ASN1_New_Malloc(ret,type) \ - if ((ret=(type *)Malloc(sizeof(type))) == NULL) goto err2; + if ((ret=(type *)Malloc(sizeof(type))) == NULL) \ + { c.line=__LINE__; goto err2; } #define M_ASN1_New(arg,func) \ if (((arg)=func()) == NULL) return(NULL) #define M_ASN1_New_Error(a) \ -/* err: ASN1err((a),ASN1_R_ERROR_STACK); \ +/* err: ASN1_MAC_H_err((a),ERR_R_NESTED_ASN1_ERROR,c.line); \ return(NULL);*/ \ - err2: ASN1err((a),ERR_R_MALLOC_FAILURE); \ + err2: ASN1_MAC_H_err((a),ERR_R_MALLOC_FAILURE,c.line); \ return(NULL) @@ -220,21 +353,59 @@ err:\ #define M_ASN1_I2D_len_IMP_opt(a,f) if (a != NULL) M_ASN1_I2D_len(a,f) #define M_ASN1_I2D_len_SET(a,f) \ - ret+=i2d_ASN1_SET(a,NULL,f,V_ASN1_SET,V_ASN1_UNIVERSAL); + ret+=i2d_ASN1_SET(a,NULL,f,V_ASN1_SET,V_ASN1_UNIVERSAL,IS_SET); -#define M_ASN1_I2D_len_SEQ(a,f) \ - ret+=i2d_ASN1_SET(a,NULL,f,V_ASN1_SEQUENCE,V_ASN1_UNIVERSAL); +#define M_ASN1_I2D_len_SET_type(type,a,f) \ + ret+=i2d_ASN1_SET_OF_##type(a,NULL,f,V_ASN1_SET, \ + V_ASN1_UNIVERSAL,IS_SET); -#define M_ASN1_I2D_len_SEQ_opt(a,f) \ +#define M_ASN1_I2D_len_SEQUENCE(a,f) \ + ret+=i2d_ASN1_SET(a,NULL,f,V_ASN1_SEQUENCE,V_ASN1_UNIVERSAL, \ + IS_SEQUENCE); + +#define M_ASN1_I2D_len_SEQUENCE_type(type,a,f) \ + ret+=i2d_ASN1_SET_OF_##type(a,NULL,f,V_ASN1_SEQUENCE, \ + V_ASN1_UNIVERSAL,IS_SEQUENCE) + +#define M_ASN1_I2D_len_SEQUENCE_opt(a,f) \ if ((a != NULL) && (sk_num(a) != 0)) \ - M_ASN1_I2D_len_SEQ(a,f); + M_ASN1_I2D_len_SEQUENCE(a,f); + +#define M_ASN1_I2D_len_SEQUENCE_opt_type(type,a,f) \ + if ((a != NULL) && (sk_##type##_num(a) != 0)) \ + M_ASN1_I2D_len_SEQUENCE_type(type,a,f); -#define M_ASN1_I2D_len_IMP_set(a,f,x) \ - ret+=i2d_ASN1_SET(a,NULL,f,x,V_ASN1_CONTEXT_SPECIFIC); +#define M_ASN1_I2D_len_IMP_SET(a,f,x) \ + ret+=i2d_ASN1_SET(a,NULL,f,x,V_ASN1_CONTEXT_SPECIFIC,IS_SET); -#define M_ASN1_I2D_len_IMP_set_opt(a,f,x) \ +#define M_ASN1_I2D_len_IMP_SET_type(type,a,f,x) \ + ret+=i2d_ASN1_SET_OF_##type(a,NULL,f,x, \ + V_ASN1_CONTEXT_SPECIFIC,IS_SET); + +#define M_ASN1_I2D_len_IMP_SET_opt(a,f,x) \ if ((a != NULL) && (sk_num(a) != 0)) \ - ret+=i2d_ASN1_SET(a,NULL,f,x,V_ASN1_CONTEXT_SPECIFIC); + ret+=i2d_ASN1_SET(a,NULL,f,x,V_ASN1_CONTEXT_SPECIFIC, \ + IS_SET); + +#define M_ASN1_I2D_len_IMP_SET_opt_type(type,a,f,x) \ + if ((a != NULL) && (sk_##type##_num(a) != 0)) \ + ret+=i2d_ASN1_SET_OF_##type(a,NULL,f,x, \ + V_ASN1_CONTEXT_SPECIFIC,IS_SET); + +#define M_ASN1_I2D_len_IMP_SEQUENCE(a,f,x) \ + ret+=i2d_ASN1_SET(a,NULL,f,x,V_ASN1_CONTEXT_SPECIFIC, \ + IS_SEQUENCE); + +#define M_ASN1_I2D_len_IMP_SEQUENCE_opt(a,f,x) \ + if ((a != NULL) && (sk_num(a) != 0)) \ + ret+=i2d_ASN1_SET(a,NULL,f,x,V_ASN1_CONTEXT_SPECIFIC, \ + IS_SEQUENCE); + +#define M_ASN1_I2D_len_IMP_SEQUENCE_opt_type(type,a,f,x) \ + if ((a != NULL) && (sk_##type##_num(a) != 0)) \ + ret+=i2d_ASN1_SET_OF_##type(a,NULL,f,x, \ + V_ASN1_CONTEXT_SPECIFIC, \ + IS_SEQUENCE); #define M_ASN1_I2D_len_EXP_opt(a,f,mtag,v) \ if (a != NULL)\ @@ -243,10 +414,27 @@ err:\ ret+=ASN1_object_size(1,v,mtag); \ } -#define M_ASN1_I2D_len_EXP_set_opt(a,f,mtag,tag,v) \ +#define M_ASN1_I2D_len_EXP_SET_opt(a,f,mtag,tag,v) \ + if ((a != NULL) && (sk_num(a) != 0))\ + { \ + v=i2d_ASN1_SET(a,NULL,f,tag,V_ASN1_UNIVERSAL,IS_SET); \ + ret+=ASN1_object_size(1,v,mtag); \ + } + +#define M_ASN1_I2D_len_EXP_SEQUENCE_opt(a,f,mtag,tag,v) \ if ((a != NULL) && (sk_num(a) != 0))\ { \ - v=i2d_ASN1_SET(a,NULL,f,tag,V_ASN1_UNIVERSAL); \ + v=i2d_ASN1_SET(a,NULL,f,tag,V_ASN1_UNIVERSAL, \ + IS_SEQUENCE); \ + ret+=ASN1_object_size(1,v,mtag); \ + } + +#define M_ASN1_I2D_len_EXP_SEQUENCE_opt_type(type,a,f,mtag,tag,v) \ + if ((a != NULL) && (sk_##type##_num(a) != 0))\ + { \ + v=i2d_ASN1_SET_OF_##type(a,NULL,f,tag, \ + V_ASN1_UNIVERSAL, \ + IS_SEQUENCE); \ ret+=ASN1_object_size(1,v,mtag); \ } @@ -262,20 +450,48 @@ err:\ } #define M_ASN1_I2D_put_SET(a,f) i2d_ASN1_SET(a,&p,f,V_ASN1_SET,\ - V_ASN1_UNIVERSAL) -#define M_ASN1_I2D_put_IMP_set(a,f,x) i2d_ASN1_SET(a,&p,f,x,\ - V_ASN1_CONTEXT_SPECIFIC) - -#define M_ASN1_I2D_put_SEQ(a,f) i2d_ASN1_SET(a,&p,f,V_ASN1_SEQUENCE,\ - V_ASN1_UNIVERSAL) + V_ASN1_UNIVERSAL,IS_SET) +#define M_ASN1_I2D_put_SET_type(type,a,f) \ + i2d_ASN1_SET_OF_##type(a,&p,f,V_ASN1_SET,V_ASN1_UNIVERSAL,IS_SET) +#define M_ASN1_I2D_put_IMP_SET(a,f,x) i2d_ASN1_SET(a,&p,f,x,\ + V_ASN1_CONTEXT_SPECIFIC,IS_SET) +#define M_ASN1_I2D_put_IMP_SET_type(type,a,f,x) \ + i2d_ASN1_SET_OF_##type(a,&p,f,x,V_ASN1_CONTEXT_SPECIFIC,IS_SET) +#define M_ASN1_I2D_put_IMP_SEQUENCE(a,f,x) i2d_ASN1_SET(a,&p,f,x,\ + V_ASN1_CONTEXT_SPECIFIC,IS_SEQUENCE) + +#define M_ASN1_I2D_put_SEQUENCE(a,f) i2d_ASN1_SET(a,&p,f,V_ASN1_SEQUENCE,\ + V_ASN1_UNIVERSAL,IS_SEQUENCE) + +#define M_ASN1_I2D_put_SEQUENCE_type(type,a,f) \ + i2d_ASN1_SET_OF_##type(a,&p,f,V_ASN1_SEQUENCE,V_ASN1_UNIVERSAL, \ + IS_SEQUENCE) + +#define M_ASN1_I2D_put_SEQUENCE_opt(a,f) \ + if ((a != NULL) && (sk_num(a) != 0)) \ + M_ASN1_I2D_put_SEQUENCE(a,f); -#define M_ASN1_I2D_put_SEQ_opt(a,f) \ +#define M_ASN1_I2D_put_IMP_SET_opt(a,f,x) \ if ((a != NULL) && (sk_num(a) != 0)) \ - M_ASN1_I2D_put_SEQ(a,f); + { i2d_ASN1_SET(a,&p,f,x,V_ASN1_CONTEXT_SPECIFIC, \ + IS_SET); } + +#define M_ASN1_I2D_put_IMP_SET_opt_type(type,a,f,x) \ + if ((a != NULL) && (sk_##type##_num(a) != 0)) \ + { i2d_ASN1_SET_OF_##type(a,&p,f,x, \ + V_ASN1_CONTEXT_SPECIFIC, \ + IS_SET); } -#define M_ASN1_I2D_put_IMP_set_opt(a,f,x) \ +#define M_ASN1_I2D_put_IMP_SEQUENCE_opt(a,f,x) \ if ((a != NULL) && (sk_num(a) != 0)) \ - { i2d_ASN1_SET(a,&p,f,x,V_ASN1_CONTEXT_SPECIFIC); } + { i2d_ASN1_SET(a,&p,f,x,V_ASN1_CONTEXT_SPECIFIC, \ + IS_SEQUENCE); } + +#define M_ASN1_I2D_put_IMP_SEQUENCE_opt_type(type,a,f,x) \ + if ((a != NULL) && (sk_##type##_num(a) != 0)) \ + { i2d_ASN1_SET_OF_##type(a,&p,f,x, \ + V_ASN1_CONTEXT_SPECIFIC, \ + IS_SEQUENCE); } #define M_ASN1_I2D_put_EXP_opt(a,f,tag,v) \ if (a != NULL) \ @@ -284,11 +500,26 @@ err:\ f(a,&p); \ } -#define M_ASN1_I2D_put_EXP_set_opt(a,f,mtag,tag,v) \ +#define M_ASN1_I2D_put_EXP_SET_opt(a,f,mtag,tag,v) \ if ((a != NULL) && (sk_num(a) != 0)) \ { \ ASN1_put_object(&p,1,v,mtag,V_ASN1_CONTEXT_SPECIFIC); \ - i2d_ASN1_SET(a,&p,f,tag,V_ASN1_UNIVERSAL); \ + i2d_ASN1_SET(a,&p,f,tag,V_ASN1_UNIVERSAL,IS_SET); \ + } + +#define M_ASN1_I2D_put_EXP_SEQUENCE_opt(a,f,mtag,tag,v) \ + if ((a != NULL) && (sk_num(a) != 0)) \ + { \ + ASN1_put_object(&p,1,v,mtag,V_ASN1_CONTEXT_SPECIFIC); \ + i2d_ASN1_SET(a,&p,f,tag,V_ASN1_UNIVERSAL,IS_SEQUENCE); \ + } + +#define M_ASN1_I2D_put_EXP_SEQUENCE_opt_type(type,a,f,mtag,tag,v) \ + if ((a != NULL) && (sk_##type##_num(a) != 0)) \ + { \ + ASN1_put_object(&p,1,v,mtag,V_ASN1_CONTEXT_SPECIFIC); \ + i2d_ASN1_SET_OF_##type(a,&p,f,tag,V_ASN1_UNIVERSAL, \ + IS_SEQUENCE); \ } #define M_ASN1_I2D_seq_total() \ @@ -306,14 +537,8 @@ err:\ #define M_ASN1_I2D_finish() *pp=p; \ return(r); -#ifndef NOPROTO int asn1_GetSequence(ASN1_CTX *c, long *length); void asn1_add_error(unsigned char *address,int offset); -#else -int asn1_GetSequence(); -void asn1_add_error(); -#endif - #ifdef __cplusplus } #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 @@ #include #include "cryptlib.h" -#include "buffer.h" -#include "objects.h" -#include "x509.h" +#include +#include +#include -#ifndef NOPROTO static int asn1_print_info(BIO *bp, int tag, int xclass,int constructed, int indent); static int asn1_parse2(BIO *bp, unsigned char **pp, long length, int offset, int depth, int indent); -#else -static int asn1_print_info(); -static int asn1_parse2(); -#endif - -static int asn1_print_info(bp, tag, xclass, constructed,indent) -BIO *bp; -int tag; -int xclass; -int constructed; -int indent; +static int asn1_print_info(BIO *bp, int tag, int xclass, int constructed, + int indent) { - static char *fmt="%-18s"; - static char *fmt2="%2d %-15s"; - char *p,str[128],*p2=NULL; + static const char fmt[]="%-18s"; + static const char fmt2[]="%2d %-15s"; + char str[128]; + const char *p,*p2=NULL; if (constructed & V_ASN1_CONSTRUCTED) p="cons: "; @@ -108,6 +99,8 @@ int indent; p="BOOLEAN"; else if (tag == V_ASN1_INTEGER) p="INTEGER"; + else if (tag == V_ASN1_ENUMERATED) + p="ENUMERATED"; else if (tag == V_ASN1_BIT_STRING) p="BIT STRING"; else if (tag == V_ASN1_OCTET_STRING) @@ -138,8 +131,8 @@ int indent; p="GENERALIZEDTIME"; else if (tag == V_ASN1_GRAPHICSTRING) p="GRAPHICSTRING"; - else if (tag == V_ASN1_ISO64STRING) - p="ISO64STRING"; + else if (tag == V_ASN1_VISIBLESTRING) + p="VISIBLESTRING"; else if (tag == V_ASN1_GENERALSTRING) p="GENERALSTRING"; else if (tag == V_ASN1_UNIVERSALSTRING) @@ -162,22 +155,13 @@ err: return(0); } -int ASN1_parse(bp, pp, len, indent) -BIO *bp; -unsigned char *pp; -long len; -int indent; +int ASN1_parse(BIO *bp, unsigned char *pp, long len, int indent) { return(asn1_parse2(bp,&pp,len,0,0,indent)); } -static int asn1_parse2(bp, pp, length, offset, depth, indent) -BIO *bp; -unsigned char **pp; -long length; -int offset; -int depth; -int indent; +static int asn1_parse2(BIO *bp, unsigned char **pp, long length, int offset, + int depth, int indent) { unsigned char *p,*ep,*tot,*op,*opp; long len; @@ -266,7 +250,9 @@ int indent; if ( (tag == V_ASN1_PRINTABLESTRING) || (tag == V_ASN1_T61STRING) || (tag == V_ASN1_IA5STRING) || - (tag == V_ASN1_UTCTIME)) + (tag == V_ASN1_VISIBLESTRING) || + (tag == V_ASN1_UTCTIME) || + (tag == V_ASN1_GENERALIZEDTIME)) { if (BIO_write(bp,":",1) <= 0) goto end; if ((len > 0) && @@ -370,6 +356,38 @@ int indent; } ASN1_INTEGER_free(bs); } + else if (tag == V_ASN1_ENUMERATED) + { + ASN1_ENUMERATED *bs; + int i; + + opp=op; + bs=d2i_ASN1_ENUMERATED(NULL,&opp,len+hl); + if (bs != NULL) + { + if (BIO_write(bp,":",1) <= 0) goto end; + if (bs->type == V_ASN1_NEG_ENUMERATED) + if (BIO_write(bp,"-",1) <= 0) + goto end; + for (i=0; ilength; i++) + { + if (BIO_printf(bp,"%02X", + bs->data[i]) <= 0) + goto end; + } + if (bs->length == 0) + { + if (BIO_write(bp,"00",2) <= 0) + goto end; + } + } + else + { + if (BIO_write(bp,"BAD ENUMERATED",11) <= 0) + goto end; + } + ASN1_ENUMERATED_free(bs); + } if (!nl) { 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 @@ +/* asn_pack.c */ +/* Written by Dr Stephen N Henson (shenson@bigfoot.com) for the OpenSSL + * project 1999. + */ +/* ==================================================================== + * Copyright (c) 1999 The OpenSSL Project. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * 3. All advertising materials mentioning features or use of this + * software must display the following acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" + * + * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to + * endorse or promote products derived from this software without + * prior written permission. For written permission, please contact + * licensing@OpenSSL.org. + * + * 5. Products derived from this software may not be called "OpenSSL" + * nor may "OpenSSL" appear in their names without prior written + * permission of the OpenSSL Project. + * + * 6. Redistributions of any form whatsoever must retain the following + * acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" + * + * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY + * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR + * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + * ==================================================================== + * + * This product includes cryptographic software written by Eric Young + * (eay@cryptsoft.com). This product includes software written by Tim + * Hudson (tjh@cryptsoft.com). + * + */ + +#include +#include "cryptlib.h" +#include + +/* ASN1 packing and unpacking functions */ + +/* Turn an ASN1 encoded SEQUENCE OF into a STACK of structures */ + +STACK *ASN1_seq_unpack(unsigned char *buf, int len, char *(*d2i)(), + void (*free_func)()) +{ + STACK *sk; + unsigned char *pbuf; + pbuf = buf; + if (!(sk = d2i_ASN1_SET(NULL, &pbuf, len, d2i, free_func, + V_ASN1_SEQUENCE, V_ASN1_UNIVERSAL))) + ASN1err(ASN1_F_ASN1_SEQ_UNPACK,ASN1_R_DECODE_ERROR); + return sk; +} + +/* Turn a STACK structures into an ASN1 encoded SEQUENCE OF structure in a + * Malloc'ed buffer + */ + +unsigned char *ASN1_seq_pack(STACK *safes, int (*i2d)(), unsigned char **buf, + int *len) +{ + int safelen; + unsigned char *safe, *p; + if (!(safelen = i2d_ASN1_SET(safes, NULL, i2d, V_ASN1_SEQUENCE, + V_ASN1_UNIVERSAL, IS_SEQUENCE))) { + ASN1err(ASN1_F_ASN1_SEQ_PACK,ASN1_R_ENCODE_ERROR); + return NULL; + } + if (!(safe = Malloc (safelen))) { + ASN1err(ASN1_F_ASN1_SEQ_PACK,ERR_R_MALLOC_FAILURE); + return NULL; + } + p = safe; + i2d_ASN1_SET(safes, &p, i2d, V_ASN1_SEQUENCE, V_ASN1_UNIVERSAL, + IS_SEQUENCE); + if (len) *len = safelen; + if (buf) *buf = safe; + return safe; +} + +/* Extract an ASN1 object from an ASN1_STRING */ + +void *ASN1_unpack_string (ASN1_STRING *oct, char *(*d2i)()) +{ + unsigned char *p; + char *ret; + + p = oct->data; + if(!(ret = d2i(NULL, &p, oct->length))) + ASN1err(ASN1_F_ASN1_UNPACK_STRING,ASN1_R_DECODE_ERROR); + return ret; +} + +/* Pack an ASN1 object into an ASN1_STRING */ + +ASN1_STRING *ASN1_pack_string (void *obj, int (*i2d)(), ASN1_STRING **oct) +{ + unsigned char *p; + ASN1_STRING *octmp; + + if (!oct || !*oct) { + if (!(octmp = ASN1_STRING_new ())) { + ASN1err(ASN1_F_ASN1_PACK_STRING,ERR_R_MALLOC_FAILURE); + return NULL; + } + if (oct) *oct = octmp; + } else octmp = *oct; + + if (!(octmp->length = i2d(obj, NULL))) { + ASN1err(ASN1_F_ASN1_PACK_STRING,ASN1_R_ENCODE_ERROR); + return NULL; + } + if (!(p = Malloc (octmp->length))) { + ASN1err(ASN1_F_ASN1_PACK_STRING,ERR_R_MALLOC_FAILURE); + return NULL; + } + octmp->data = p; + i2d (obj, &p); + return octmp; +} + 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 @@ * [including the GNU Public Licence.] */ +#ifndef NO_DH #include #include "cryptlib.h" -#include "bn.h" -#include "dh.h" -#include "objects.h" -#include "asn1_mac.h" +#include +#include +#include +#include -/* - * ASN1err(ASN1_F_D2I_DHPARAMS,ASN1_R_LENGTH_MISMATCH); - * ASN1err(ASN1_F_I2D_DHPARAMS,ASN1_R_UNKNOWN_ATTRIBUTE_TYPE); - */ - -DH *d2i_DHparams(a,pp,length) -DH **a; -unsigned char **pp; -long length; +DH *d2i_DHparams(DH **a, unsigned char **pp, long length) { - int i=ASN1_R_ERROR_STACK; + int i=ERR_R_NESTED_ASN1_ERROR; ASN1_INTEGER *bs=NULL; long v=0; M_ASN1_D2I_vars(a,DH *,DH_new); @@ -105,4 +98,4 @@ err: if (bs != NULL) ASN1_BIT_STRING_free(bs); return(NULL); } - +#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 @@ * [including the GNU Public Licence.] */ +#ifndef NO_DSA #include #include "cryptlib.h" -#include "bn.h" -#include "dsa.h" -#include "objects.h" -#include "asn1_mac.h" +#include +#include +#include +#include -/* - * ASN1err(ASN1_F_D2I_DSAPARAMS,ASN1_R_LENGTH_MISMATCH); - * ASN1err(ASN1_F_I2D_DSAPARAMS,ASN1_R_UNKNOWN_ATTRIBUTE_TYPE); - */ +#ifdef NEG_PUBKEY_BUG +#define d2i_ASN1_INTEGER d2i_ASN1_UINTEGER +#endif -DSA *d2i_DSAparams(a,pp,length) -DSA **a; -unsigned char **pp; -long length; +DSA *d2i_DSAparams(DSA **a, unsigned char **pp, long length) { - int i=ASN1_R_ERROR_STACK; + int i=ERR_R_NESTED_ASN1_ERROR; ASN1_INTEGER *bs=NULL; M_ASN1_D2I_vars(a,DSA *,DSA_new); @@ -98,4 +95,4 @@ err: if (bs != NULL) ASN1_BIT_STRING_free(bs); return(NULL); } - +#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 @@ #include #include "cryptlib.h" -#include "bn.h" -#include "evp.h" -#include "objects.h" -#include "x509.h" +#include +#include +#include +#include -EVP_PKEY *d2i_PrivateKey(type,a,pp,length) -int type; -EVP_PKEY **a; -unsigned char **pp; -long length; +EVP_PKEY *d2i_PrivateKey(int type, EVP_PKEY **a, unsigned char **pp, + long length) { EVP_PKEY *ret; @@ -106,7 +103,7 @@ long length; default: ASN1err(ASN1_F_D2I_PRIVATEKEY,ASN1_R_UNKNOWN_PUBLIC_KEY_TYPE); goto err; - break; + /* break; */ } if (a != NULL) (*a)=ret; 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 @@ #include #include "cryptlib.h" -#include "bn.h" -#include "evp.h" -#include "objects.h" -#include "x509.h" +#include +#include +#include +#include -EVP_PKEY *d2i_PublicKey(type,a,pp,length) -int type; -EVP_PKEY **a; -unsigned char **pp; -long length; +EVP_PKEY *d2i_PublicKey(int type, EVP_PKEY **a, unsigned char **pp, + long length) { EVP_PKEY *ret; @@ -106,7 +103,7 @@ long length; default: ASN1err(ASN1_F_D2I_PUBLICKEY,ASN1_R_UNKNOWN_PUBLIC_KEY_TYPE); goto err; - break; + /* break; */ } if (a != NULL) (*a)=ret; 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 @@ * [including the GNU Public Licence.] */ +#ifndef NO_RSA #include #include "cryptlib.h" -#include "bn.h" -#include "rsa.h" -#include "objects.h" -#include "asn1_mac.h" - -/* - * ASN1err(ASN1_F_D2I_RSAPRIVATEKEY,ASN1_R_LENGTH_MISMATCH); - * ASN1err(ASN1_F_I2D_RSAPRIVATEKEY,ASN1_R_UNKNOWN_ATTRIBUTE_TYPE); - * ASN1err(ASN1_F_I2D_RSAPRIVATEKEY,ASN1_R_PARSING); - */ +#include +#include +#include +#include static ASN1_METHOD method={ (int (*)()) i2d_RSAPrivateKey, @@ -75,15 +70,12 @@ static ASN1_METHOD method={ (char *(*)())RSA_new, (void (*)()) RSA_free}; -ASN1_METHOD *RSAPrivateKey_asn1_meth() +ASN1_METHOD *RSAPrivateKey_asn1_meth(void) { return(&method); } -RSA *d2i_RSAPrivateKey(a,pp,length) -RSA **a; -unsigned char **pp; -long length; +RSA *d2i_RSAPrivateKey(RSA **a, unsigned char **pp, long length) { int i=ASN1_R_PARSING; ASN1_INTEGER *bs=NULL; @@ -126,4 +118,4 @@ err: if (bs != NULL) ASN1_INTEGER_free(bs); return(NULL); } - +#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 @@ * [including the GNU Public Licence.] */ +#ifndef NO_RSA #include #include "cryptlib.h" -#include "bn.h" -#include "rsa.h" -#include "objects.h" -#include "asn1_mac.h" +#include +#include +#include +#include -/* - * ASN1err(ASN1_F_D2I_RSAPUBLICKEY,ASN1_R_LENGTH_MISMATCH); - * ASN1err(ASN1_F_I2D_RSAPUBLICKEY,ASN1_R_UNKNOWN_ATTRIBUTE_TYPE); - */ +#ifdef NEG_PUBKEY_BUG +#define d2i_ASN1_INTEGER d2i_ASN1_UINTEGER +#endif -RSA *d2i_RSAPublicKey(a,pp,length) -RSA **a; -unsigned char **pp; -long length; +RSA *d2i_RSAPublicKey(RSA **a, unsigned char **pp, long length) { int i=ASN1_R_PARSING; ASN1_INTEGER *bs=NULL; @@ -97,4 +94,4 @@ err: if (bs != NULL) ASN1_INTEGER_free(bs); return(NULL); } - +#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 @@ * [including the GNU Public Licence.] */ -/* Origional version from Steven Schoch */ +/* Original version from Steven Schoch */ +#ifndef NO_DSA #include #include "cryptlib.h" -#include "bn.h" -#include "dsa.h" -#include "objects.h" -#include "asn1_mac.h" +#include +#include +#include +#include -/* - * ASN1err(ASN1_F_D2I_DSAPRIVATEKEY,ASN1_R_LENGTH_MISMATCH); - * ASN1err(ASN1_F_I2D_DSAPRIVATEKEY,ASN1_R_UNKNOWN_ATTRIBUTE_TYPE); - * ASN1err(ASN1_F_I2D_DSAPRIVATEKEY,ASN1_R_PARSING); - */ - -DSA *d2i_DSAPrivateKey(a,pp,length) -DSA **a; -unsigned char **pp; -long length; +DSA *d2i_DSAPrivateKey(DSA **a, unsigned char **pp, long length) { int i=ASN1_R_PARSING; ASN1_INTEGER *bs=NULL; @@ -110,4 +102,4 @@ err: if (bs != NULL) ASN1_INTEGER_free(bs); return(NULL); } - +#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 @@ * [including the GNU Public Licence.] */ -/* Origional version from Steven Schoch */ +/* Original version from Steven Schoch */ +#ifndef NO_DSA #include #include "cryptlib.h" -#include "bn.h" -#include "dsa.h" -#include "objects.h" -#include "asn1_mac.h" +#include +#include +#include +#include -/* - * ASN1err(ASN1_F_D2I_DSAPUBLICKEY,ASN1_R_LENGTH_MISMATCH); - * ASN1err(ASN1_F_I2D_DSAPUBLICKEY,ASN1_R_UNKNOWN_ATTRIBUTE_TYPE); - */ +#ifdef NEG_PUBKEY_BUG +#define d2i_ASN1_INTEGER d2i_ASN1_UINTEGER +#endif -DSA *d2i_DSAPublicKey(a,pp,length) -DSA **a; -unsigned char **pp; -long length; +DSA *d2i_DSAPublicKey(DSA **a, unsigned char **pp, long length) { int i=ASN1_R_PARSING; ASN1_INTEGER *bs=NULL; @@ -121,4 +118,4 @@ err: if (bs != NULL) ASN1_INTEGER_free(bs); return(NULL); } - +#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 @@ #include #include "cryptlib.h" -#include "asn1.h" -#include "asn1_mac.h" +#include +#include -int ASN1_TYPE_set_octetstring(a,data,len) -ASN1_TYPE *a; -unsigned char *data; -int len; +int ASN1_TYPE_set_octetstring(ASN1_TYPE *a, unsigned char *data, int len) { ASN1_STRING *os; if ((os=ASN1_OCTET_STRING_new()) == NULL) return(0); if (!ASN1_OCTET_STRING_set(os,data,len)) return(0); - ASN1_TYPE_set(a,V_ASN1_OCTET_STRING,(char *)os); + ASN1_TYPE_set(a,V_ASN1_OCTET_STRING,os); return(1); } -int ASN1_TYPE_get_octetstring(a,data,max_len) -ASN1_TYPE *a; -unsigned char *data; -int max_len; /* for returned value */ +/* int max_len: for returned value */ +int ASN1_TYPE_get_octetstring(ASN1_TYPE *a, unsigned char *data, + int max_len) { int ret,num; unsigned char *p; @@ -97,11 +93,8 @@ int max_len; /* for returned value */ return(ret); } -int ASN1_TYPE_set_int_octetstring(a,num,data,len) -ASN1_TYPE *a; -long num; -unsigned char *data; -int len; +int ASN1_TYPE_set_int_octetstring(ASN1_TYPE *a, long num, unsigned char *data, + int len) { int n,size; ASN1_OCTET_STRING os,*osp; @@ -131,16 +124,15 @@ int len; i2d_ASN1_INTEGER(&in,&p); M_i2d_ASN1_OCTET_STRING(&os,&p); - ASN1_TYPE_set(a,V_ASN1_SEQUENCE,(char *)osp); + ASN1_TYPE_set(a,V_ASN1_SEQUENCE,osp); return(1); } -/* we return the actual length... */ -int ASN1_TYPE_get_int_octetstring(a,num,data,max_len) -ASN1_TYPE *a; -long *num; -unsigned char *data; -int max_len; /* for returned value */ +/* we return the actual length..., num may be missing, in which + * case, set it to zero */ +/* int max_len: for returned value */ +int ASN1_TYPE_get_int_octetstring(ASN1_TYPE *a, long *num, unsigned char *data, + int max_len) { int ret= -1,n; 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 @@ * [including the GNU Public Licence.] */ #include -#include "asn1.h" -#include "err.h" +#include +#include main() { 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 @@ +/* crypto/asn1/f_enum.c */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#include +#include "cryptlib.h" +#include +#include + +/* Based on a_int.c: equivalent ENUMERATED functions */ + +int i2a_ASN1_ENUMERATED(BIO *bp, ASN1_ENUMERATED *a) + { + int i,n=0; + static const char *h="0123456789ABCDEF"; + char buf[2]; + + if (a == NULL) return(0); + + if (a->length == 0) + { + if (BIO_write(bp,"00",2) != 2) goto err; + n=2; + } + else + { + for (i=0; ilength; i++) + { + if ((i != 0) && (i%35 == 0)) + { + if (BIO_write(bp,"\\\n",2) != 2) goto err; + n+=2; + } + buf[0]=h[((unsigned char)a->data[i]>>4)&0x0f]; + buf[1]=h[((unsigned char)a->data[i] )&0x0f]; + if (BIO_write(bp,buf,2) != 2) goto err; + n+=2; + } + } + return(n); +err: + return(-1); + } + +int a2i_ASN1_ENUMERATED(BIO *bp, ASN1_ENUMERATED *bs, char *buf, int size) + { + int ret=0; + int i,j,k,m,n,again,bufsize; + unsigned char *s=NULL,*sp; + unsigned char *bufp; + int num=0,slen=0,first=1; + + bs->type=V_ASN1_ENUMERATED; + + bufsize=BIO_gets(bp,buf,size); + for (;;) + { + if (bufsize < 1) goto err_sl; + i=bufsize; + if (buf[i-1] == '\n') buf[--i]='\0'; + if (i == 0) goto err_sl; + if (buf[i-1] == '\r') buf[--i]='\0'; + if (i == 0) goto err_sl; + again=(buf[i-1] == '\\'); + + for (j=0; j= '0') && (buf[j] <= '9')) || + ((buf[j] >= 'a') && (buf[j] <= 'f')) || + ((buf[j] >= 'A') && (buf[j] <= 'F')))) + { + i=j; + break; + } + } + buf[i]='\0'; + /* We have now cleared all the crap off the end of the + * line */ + if (i < 2) goto err_sl; + + bufp=(unsigned char *)buf; + if (first) + { + first=0; + if ((bufp[0] == '0') && (buf[1] == '0')) + { + bufp+=2; + i-=2; + } + } + k=0; + i-=again; + if (i%2 != 0) + { + ASN1err(ASN1_F_A2I_ASN1_ENUMERATED,ASN1_R_ODD_NUMBER_OF_CHARS); + goto err; + } + i/=2; + if (num+i > slen) + { + if (s == NULL) + sp=(unsigned char *)Malloc( + (unsigned int)num+i*2); + else + sp=(unsigned char *)Realloc(s, + (unsigned int)num+i*2); + if (sp == NULL) + { + ASN1err(ASN1_F_A2I_ASN1_ENUMERATED,ERR_R_MALLOC_FAILURE); + if (s != NULL) Free((char *)s); + goto err; + } + s=sp; + slen=num+i*2; + } + for (j=0; j= '0') && (m <= '9')) + m-='0'; + else if ((m >= 'a') && (m <= 'f')) + m=m-'a'+10; + else if ((m >= 'A') && (m <= 'F')) + m=m-'A'+10; + else + { + ASN1err(ASN1_F_A2I_ASN1_ENUMERATED,ASN1_R_NON_HEX_CHARACTERS); + goto err; + } + s[num+j]<<=4; + s[num+j]|=m; + } + } + num+=i; + if (again) + bufsize=BIO_gets(bp,buf,size); + else + break; + } + bs->length=num; + bs->data=s; + ret=1; +err: + if (0) + { +err_sl: + ASN1err(ASN1_F_A2I_ASN1_ENUMERATED,ASN1_R_SHORT_LINE); + } + return(ret); + } + 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 @@ #include #include "cryptlib.h" -#include "buffer.h" -#include "x509.h" +#include +#include -int i2a_ASN1_INTEGER(bp, a) -BIO *bp; -ASN1_INTEGER *a; +int i2a_ASN1_INTEGER(BIO *bp, ASN1_INTEGER *a) { int i,n=0; - static char *h="0123456789ABCDEF"; + static const char *h="0123456789ABCDEF"; char buf[2]; if (a == NULL) return(0); @@ -96,11 +94,7 @@ err: return(-1); } -int a2i_ASN1_INTEGER(bp,bs,buf,size) -BIO *bp; -ASN1_INTEGER *bs; -char *buf; -int size; +int a2i_ASN1_INTEGER(BIO *bp, ASN1_INTEGER *bs, char *buf, int size) { int ret=0; int i,j,k,m,n,again,bufsize; @@ -123,9 +117,18 @@ int size; for (j=0; j= '0') && (buf[j] <= '9')) || ((buf[j] >= 'a') && (buf[j] <= 'f')) || ((buf[j] >= 'A') && (buf[j] <= 'F')))) +#else + /* This #ifdef is not strictly necessary, since + * the characters A...F a...f 0...9 are contiguous + * (yes, even in EBCDIC - but not the whole alphabet). + * Nevertheless, isxdigit() is faster. + */ + if (!isxdigit(buf[j])) +#endif { i=j; 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 @@ #include #include "cryptlib.h" -#include "buffer.h" -#include "x509.h" +#include +#include -int i2a_ASN1_STRING(bp, a, type) -BIO *bp; -ASN1_STRING *a; -int type; +int i2a_ASN1_STRING(BIO *bp, ASN1_STRING *a, int type) { int i,n=0; - static char *h="0123456789ABCDEF"; + static const char *h="0123456789ABCDEF"; char buf[2]; if (a == NULL) return(0); @@ -97,11 +94,7 @@ err: return(-1); } -int a2i_ASN1_STRING(bp,bs,buf,size) -BIO *bp; -ASN1_STRING *bs; -char *buf; -int size; +int a2i_ASN1_STRING(BIO *bp, ASN1_STRING *bs, char *buf, int size) { int ret=0; int i,j,k,m,n,again,bufsize; @@ -130,9 +123,18 @@ int size; for (j=i-1; j>0; j--) { +#ifndef CHARSET_EBCDIC if (!( ((buf[j] >= '0') && (buf[j] <= '9')) || ((buf[j] >= 'a') && (buf[j] <= 'f')) || ((buf[j] >= 'A') && (buf[j] <= 'F')))) +#else + /* This #ifdef is not strictly necessary, since + * the characters A...F a...f 0...9 are contiguous + * (yes, even in EBCDIC - but not the whole alphabet). + * Nevertheless, isxdigit() is faster. + */ + if (!isxdigit(buf[j])) +#endif { i=j; 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 @@ * [including the GNU Public Licence.] */ +#ifndef NO_DH #include #include "cryptlib.h" -#include "bn.h" -#include "asn1_mac.h" -#include "dh.h" +#include +#include +#include -/* - * ASN1err(ASN1_F_D2I_DHPARAMS,ASN1_R_LENGTH_MISMATCH); - * ASN1err(ASN1_F_X509_DHPARAMS_NEW,ASN1_R_LENGTH_MISMATCH); - */ - -int i2d_DHparams(a,pp) -DH *a; -unsigned char **pp; +int i2d_DHparams(DH *a, unsigned char **pp) { BIGNUM *num[3]; ASN1_INTEGER bs; @@ -100,7 +94,12 @@ unsigned char **pp; } t=ASN1_object_size(1,tot,V_ASN1_SEQUENCE); - if (pp == NULL) return(t); + if (pp == NULL) + { + if (num[2] != NULL) + BN_free(num[2]); + return(t); + } p= *pp; ASN1_put_object(&p,1,tot,V_ASN1_SEQUENCE,V_ASN1_UNIVERSAL); @@ -126,3 +125,4 @@ err: *pp=p; return(ret); } +#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 @@ * [including the GNU Public Licence.] */ +#ifndef NO_DSA #include #include "cryptlib.h" -#include "bn.h" -#include "asn1_mac.h" -#include "dsa.h" +#include +#include +#include -/* - * ASN1err(ASN1_F_D2I_DSAPARAMS,ASN1_R_LENGTH_MISMATCH); - */ - -int i2d_DSAparams(a,pp) -DSA *a; -unsigned char **pp; +int i2d_DSAparams(DSA *a, unsigned char **pp) { BIGNUM *num[3]; ASN1_INTEGER bs; @@ -118,4 +113,5 @@ err: *pp=p; return(ret); } +#endif 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 @@ #include #include "cryptlib.h" -#include "bn.h" -#include "evp.h" -#include "objects.h" +#include +#include +#include -int i2d_PrivateKey(a,pp) -EVP_PKEY *a; -unsigned char **pp; +int i2d_PrivateKey(EVP_PKEY *a, unsigned char **pp) { #ifndef NO_RSA 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 @@ #include #include "cryptlib.h" -#include "bn.h" -#include "evp.h" -#include "objects.h" +#include +#include +#include -int i2d_PublicKey(a,pp) -EVP_PKEY *a; -unsigned char **pp; +int i2d_PublicKey(EVP_PKEY *a, unsigned char **pp) { switch (a->type) { 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 @@ * [including the GNU Public Licence.] */ +#ifndef NO_RSA #include #include "cryptlib.h" -#include "bn.h" -#include "rsa.h" -#include "objects.h" -#include "asn1_mac.h" +#include +#include +#include +#include -/* - * ASN1err(ASN1_F_D2I_RSAPRIVATEKEY,ASN1_R_LENGTH_MISMATCH); - * ASN1err(ASN1_F_I2D_RSAPRIVATEKEY,ASN1_R_UNKNOWN_ATTRIBUTE_TYPE); - */ - -int i2d_RSAPrivateKey(a,pp) -RSA *a; -unsigned char **pp; +int i2d_RSAPrivateKey(RSA *a, unsigned char **pp) { BIGNUM *num[9]; unsigned char data[1]; @@ -129,4 +123,5 @@ unsigned char **pp; *pp=p; return(t); } +#endif 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 @@ * [including the GNU Public Licence.] */ +#ifndef NO_RSA #include #include "cryptlib.h" -#include "bn.h" -#include "rsa.h" -#include "objects.h" -#include "asn1_mac.h" +#include +#include +#include +#include -/* - * ASN1err(ASN1_F_D2I_RSAPUBLICKEY,ASN1_R_LENGTH_MISMATCH); - * ASN1err(ASN1_F_I2D_RSAPUBLICKEY,ASN1_R_UNKNOWN_ATTRIBUTE_TYPE); - */ - -int i2d_RSAPublicKey(a,pp) -RSA *a; -unsigned char **pp; +int i2d_RSAPublicKey(RSA *a, unsigned char **pp) { BIGNUM *num[2]; ASN1_INTEGER bs; @@ -115,4 +109,4 @@ unsigned char **pp; *pp=p; return(t); } - +#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 @@ * [including the GNU Public Licence.] */ +#ifndef NO_DSA #include #include "cryptlib.h" -#include "bn.h" -#include "dsa.h" -#include "objects.h" -#include "asn1_mac.h" +#include +#include +#include +#include -/* - * ASN1err(ASN1_F_I2D_DSAPRIVATEKEY,ASN1_R_UNKNOWN_ATTRIBUTE_TYPE); - */ - -int i2d_DSAPrivateKey(a,pp) -DSA *a; -unsigned char **pp; +int i2d_DSAPrivateKey(DSA *a, unsigned char **pp) { BIGNUM *num[6]; unsigned char data[1]; @@ -125,4 +120,4 @@ unsigned char **pp; *pp=p; return(t); } - +#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 @@ * [including the GNU Public Licence.] */ +#ifndef NO_DSA #include #include "cryptlib.h" -#include "bn.h" -#include "dsa.h" -#include "objects.h" -#include "asn1_mac.h" +#include +#include +#include +#include -/* - * ASN1err(ASN1_F_I2D_DSAPUBLICKEY,ASN1_R_UNKNOWN_ATTRIBUTE_TYPE); - */ - -int i2d_DSAPublicKey(a,pp) -DSA *a; -unsigned char **pp; +int i2d_DSAPublicKey(DSA *a, unsigned char **pp) { BIGNUM *num[4]; ASN1_INTEGER bs; @@ -128,6 +123,7 @@ unsigned char **pp; } Free((char *)bs.data); *pp=p; - return(t); + if(all) return(t); + else return(tot); } - +#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 @@ * [including the GNU Public Licence.] */ +#ifndef NO_RSA #include #include "cryptlib.h" -#include "rsa.h" -#include "objects.h" -#include "asn1_mac.h" -#include "evp.h" -#include "x509.h" +#include +#include +#include +#include +#include #ifndef NO_RC4 @@ -74,28 +75,12 @@ typedef struct netscape_pkey_st ASN1_OCTET_STRING *private_key; } NETSCAPE_PKEY; -/* - * ASN1err(ASN1_F_D2I_NETSCAPE_RSA,ASN1_R_LENGTH_MISMATCH); - * ASN1err(ASN1_F_D2I_NETSCAPE_RSA,ASN1_R_DECODING_ERROR); - * ASN1err(ASN1_F_D2I_NETSCAPE_PKEY,ASN1_R_DECODING_ERROR); - * ASN1err(ASN1_F_NETSCAPE_PKEY_NEW,ASN1_R_DECODING_ERROR); - */ -#ifndef NOPROTO static int i2d_NETSCAPE_PKEY(NETSCAPE_PKEY *a, unsigned char **pp); static NETSCAPE_PKEY *d2i_NETSCAPE_PKEY(NETSCAPE_PKEY **a,unsigned char **pp, long length); static NETSCAPE_PKEY *NETSCAPE_PKEY_new(void); static void NETSCAPE_PKEY_free(NETSCAPE_PKEY *); -#else -static int i2d_NETSCAPE_PKEY(); -static NETSCAPE_PKEY *d2i_NETSCAPE_PKEY(); -static NETSCAPE_PKEY *NETSCAPE_PKEY_new(); -static void NETSCAPE_PKEY_free(); -#endif -int i2d_Netscape_RSA(a,pp,cb) -RSA *a; -unsigned char **pp; -int (*cb)(); +int i2d_Netscape_RSA(RSA *a, unsigned char **pp, int (*cb)()) { int i,j,l[6]; NETSCAPE_PKEY *pkey; @@ -138,7 +123,9 @@ int (*cb)(); l[2]=i2d_X509_ALGOR(alg,NULL); l[3]=ASN1_object_size(1,l[2]+l[1],V_ASN1_SEQUENCE); +#ifndef CONST_STRICT os.data=(unsigned char *)"private-key"; +#endif os.length=11; l[4]=i2d_ASN1_OCTET_STRING(&os,NULL); @@ -195,18 +182,14 @@ int (*cb)(); i2d_ASN1_OCTET_STRING(&os2,&p); ret=l[5]; err: - if (os2.data != NULL) Free((char *)os2.data); + if (os2.data != NULL) Free(os2.data); if (alg != NULL) X509_ALGOR_free(alg); if (pkey != NULL) NETSCAPE_PKEY_free(pkey); r=r; return(ret); } -RSA *d2i_Netscape_RSA(a,pp,length,cb) -RSA **a; -unsigned char **pp; -long length; -int (*cb)(); +RSA *d2i_Netscape_RSA(RSA **a, unsigned char **pp, long length, int (*cb)()) { RSA *ret=NULL; ASN1_OCTET_STRING *os=NULL; @@ -233,11 +216,8 @@ int (*cb)(); M_ASN1_D2I_Finish(a,RSA_free,ASN1_F_D2I_NETSCAPE_RSA); } -RSA *d2i_Netscape_RSA_2(a,pp,length,cb) -RSA **a; -unsigned char **pp; -long length; -int (*cb)(); +RSA *d2i_Netscape_RSA_2(RSA **a, unsigned char **pp, long length, + int (*cb)()) { NETSCAPE_PKEY *pkey=NULL; RSA *ret=NULL; @@ -249,7 +229,7 @@ int (*cb)(); ASN1_OCTET_STRING *os=NULL; ASN1_CTX c; - c.error=ASN1_R_ERROR_STACK; + c.error=ERR_R_NESTED_ASN1_ERROR; c.pp=pp; M_ASN1_D2I_Init(); @@ -304,9 +284,7 @@ err: return(ret); } -static int i2d_NETSCAPE_PKEY(a,pp) -NETSCAPE_PKEY *a; -unsigned char **pp; +static int i2d_NETSCAPE_PKEY(NETSCAPE_PKEY *a, unsigned char **pp) { M_ASN1_I2D_vars(a); @@ -324,10 +302,8 @@ unsigned char **pp; M_ASN1_I2D_finish(); } -static NETSCAPE_PKEY *d2i_NETSCAPE_PKEY(a,pp,length) -NETSCAPE_PKEY **a; -unsigned char **pp; -long length; +static NETSCAPE_PKEY *d2i_NETSCAPE_PKEY(NETSCAPE_PKEY **a, unsigned char **pp, + long length) { M_ASN1_D2I_vars(a,NETSCAPE_PKEY *,NETSCAPE_PKEY_new); @@ -339,9 +315,10 @@ long length; M_ASN1_D2I_Finish(a,NETSCAPE_PKEY_free,ASN1_F_D2I_NETSCAPE_PKEY); } -static NETSCAPE_PKEY *NETSCAPE_PKEY_new() +static NETSCAPE_PKEY *NETSCAPE_PKEY_new(void) { NETSCAPE_PKEY *ret=NULL; + ASN1_CTX c; M_ASN1_New_Malloc(ret,NETSCAPE_PKEY); M_ASN1_New(ret->version,ASN1_INTEGER_new); @@ -351,8 +328,7 @@ static NETSCAPE_PKEY *NETSCAPE_PKEY_new() M_ASN1_New_Error(ASN1_F_NETSCAPE_PKEY_NEW); } -static void NETSCAPE_PKEY_free(a) -NETSCAPE_PKEY *a; +static void NETSCAPE_PKEY_free(NETSCAPE_PKEY *a) { if (a == NULL) return; ASN1_INTEGER_free(a->version); @@ -362,4 +338,4 @@ NETSCAPE_PKEY *a; } #endif /* NO_RC4 */ - +#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 @@ +/* nsseq.c */ +/* Written by Dr Stephen N Henson (shenson@bigfoot.com) for the OpenSSL + * project 1999. + */ +/* ==================================================================== + * Copyright (c) 1999 The OpenSSL Project. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * 3. All advertising materials mentioning features or use of this + * software must display the following acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" + * + * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to + * endorse or promote products derived from this software without + * prior written permission. For written permission, please contact + * licensing@OpenSSL.org. + * + * 5. Products derived from this software may not be called "OpenSSL" + * nor may "OpenSSL" appear in their names without prior written + * permission of the OpenSSL Project. + * + * 6. Redistributions of any form whatsoever must retain the following + * acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" + * + * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY + * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR + * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + * ==================================================================== + * + * This product includes cryptographic software written by Eric Young + * (eay@cryptsoft.com). This product includes software written by Tim + * Hudson (tjh@cryptsoft.com). + * + */ + +#include +#include +#include +#include +#include +#include + +/* Netscape certificate sequence structure */ + +int i2d_NETSCAPE_CERT_SEQUENCE(NETSCAPE_CERT_SEQUENCE *a, unsigned char **pp) +{ + int v = 0; + M_ASN1_I2D_vars(a); + M_ASN1_I2D_len (a->type, i2d_ASN1_OBJECT); + M_ASN1_I2D_len_EXP_SEQUENCE_opt_type(X509,a->certs,i2d_X509,0, + V_ASN1_SEQUENCE,v); + + M_ASN1_I2D_seq_total(); + + M_ASN1_I2D_put (a->type, i2d_ASN1_OBJECT); + M_ASN1_I2D_put_EXP_SEQUENCE_opt_type(X509,a->certs,i2d_X509,0, + V_ASN1_SEQUENCE,v); + + M_ASN1_I2D_finish(); +} + +NETSCAPE_CERT_SEQUENCE *NETSCAPE_CERT_SEQUENCE_new(void) +{ + NETSCAPE_CERT_SEQUENCE *ret=NULL; + ASN1_CTX c; + M_ASN1_New_Malloc(ret, NETSCAPE_CERT_SEQUENCE); + /* Note hardcoded object type */ + ret->type = OBJ_nid2obj(NID_netscape_cert_sequence); + ret->certs = NULL; + return (ret); + M_ASN1_New_Error(ASN1_F_NETSCAPE_CERT_SEQUENCE_NEW); +} + +NETSCAPE_CERT_SEQUENCE *d2i_NETSCAPE_CERT_SEQUENCE(NETSCAPE_CERT_SEQUENCE **a, + unsigned char **pp, long length) +{ + M_ASN1_D2I_vars(a,NETSCAPE_CERT_SEQUENCE *, + NETSCAPE_CERT_SEQUENCE_new); + M_ASN1_D2I_Init(); + M_ASN1_D2I_start_sequence(); + M_ASN1_D2I_get (ret->type, d2i_ASN1_OBJECT); + M_ASN1_D2I_get_EXP_set_opt_type(X509,ret->certs,d2i_X509,X509_free,0, + V_ASN1_SEQUENCE); + M_ASN1_D2I_Finish(a, NETSCAPE_CERT_SEQUENCE_free, + ASN1_F_D2I_NETSCAPE_CERT_SEQUENCE); +} + +void NETSCAPE_CERT_SEQUENCE_free (NETSCAPE_CERT_SEQUENCE *a) +{ + if (a == NULL) return; + ASN1_OBJECT_free(a->type); + if(a->certs) + sk_X509_pop_free(a->certs, X509_free); + Free (a); +} 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 @@ +/* p5_pbe.c */ +/* Written by Dr Stephen N Henson (shenson@bigfoot.com) for the OpenSSL + * project 1999. + */ +/* ==================================================================== + * Copyright (c) 1999 The OpenSSL Project. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * 3. All advertising materials mentioning features or use of this + * software must display the following acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" + * + * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to + * endorse or promote products derived from this software without + * prior written permission. For written permission, please contact + * licensing@OpenSSL.org. + * + * 5. Products derived from this software may not be called "OpenSSL" + * nor may "OpenSSL" appear in their names without prior written + * permission of the OpenSSL Project. + * + * 6. Redistributions of any form whatsoever must retain the following + * acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" + * + * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY + * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR + * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + * ==================================================================== + * + * This product includes cryptographic software written by Eric Young + * (eay@cryptsoft.com). This product includes software written by Tim + * Hudson (tjh@cryptsoft.com). + * + */ + +#include +#include "cryptlib.h" +#include +#include +#include + +/* PKCS#5 password based encryption structure */ + +int i2d_PBEPARAM(PBEPARAM *a, unsigned char **pp) +{ + M_ASN1_I2D_vars(a); + M_ASN1_I2D_len (a->salt, i2d_ASN1_OCTET_STRING); + M_ASN1_I2D_len (a->iter, i2d_ASN1_INTEGER); + + M_ASN1_I2D_seq_total (); + + M_ASN1_I2D_put (a->salt, i2d_ASN1_OCTET_STRING); + M_ASN1_I2D_put (a->iter, i2d_ASN1_INTEGER); + M_ASN1_I2D_finish(); +} + +PBEPARAM *PBEPARAM_new(void) +{ + PBEPARAM *ret=NULL; + ASN1_CTX c; + M_ASN1_New_Malloc(ret, PBEPARAM); + M_ASN1_New(ret->iter,ASN1_INTEGER_new); + M_ASN1_New(ret->salt,ASN1_OCTET_STRING_new); + return (ret); + M_ASN1_New_Error(ASN1_F_PBEPARAM_NEW); +} + +PBEPARAM *d2i_PBEPARAM(PBEPARAM **a, unsigned char **pp, long length) +{ + M_ASN1_D2I_vars(a,PBEPARAM *,PBEPARAM_new); + M_ASN1_D2I_Init(); + M_ASN1_D2I_start_sequence(); + M_ASN1_D2I_get (ret->salt, d2i_ASN1_OCTET_STRING); + M_ASN1_D2I_get (ret->iter, d2i_ASN1_INTEGER); + M_ASN1_D2I_Finish(a, PBEPARAM_free, ASN1_F_D2I_PBEPARAM); +} + +void PBEPARAM_free (PBEPARAM *a) +{ + if(a==NULL) return; + ASN1_OCTET_STRING_free(a->salt); + ASN1_INTEGER_free (a->iter); + Free ((char *)a); +} + +/* Return an algorithm identifier for a PKCS#5 PBE algorithm */ + +X509_ALGOR *PKCS5_pbe_set(int alg, int iter, unsigned char *salt, + int saltlen) +{ + PBEPARAM *pbe; + ASN1_OBJECT *al; + X509_ALGOR *algor; + ASN1_TYPE *astype; + + if (!(pbe = PBEPARAM_new ())) { + ASN1err(ASN1_F_ASN1_PBE_SET,ERR_R_MALLOC_FAILURE); + return NULL; + } + if(iter <= 0) iter = PKCS5_DEFAULT_ITER; + ASN1_INTEGER_set (pbe->iter, iter); + if (!saltlen) saltlen = PKCS5_SALT_LEN; + if (!(pbe->salt->data = Malloc (saltlen))) { + ASN1err(ASN1_F_ASN1_PBE_SET,ERR_R_MALLOC_FAILURE); + return NULL; + } + pbe->salt->length = saltlen; + if (salt) memcpy (pbe->salt->data, salt, saltlen); + else RAND_bytes (pbe->salt->data, saltlen); + + if (!(astype = ASN1_TYPE_new())) { + ASN1err(ASN1_F_ASN1_PBE_SET,ERR_R_MALLOC_FAILURE); + return NULL; + } + + astype->type = V_ASN1_SEQUENCE; + if(!ASN1_pack_string(pbe, i2d_PBEPARAM, &astype->value.sequence)) { + ASN1err(ASN1_F_ASN1_PBE_SET,ERR_R_MALLOC_FAILURE); + return NULL; + } + PBEPARAM_free (pbe); + + al = OBJ_nid2obj(alg); /* never need to free al */ + if (!(algor = X509_ALGOR_new())) { + ASN1err(ASN1_F_ASN1_PBE_SET,ERR_R_MALLOC_FAILURE); + return NULL; + } + ASN1_OBJECT_free(algor->algorithm); + algor->algorithm = al; + algor->parameter = astype; + + return (algor); +} 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 @@ +/* p5_pbev2.c */ +/* Written by Dr Stephen N Henson (shenson@bigfoot.com) for the OpenSSL + * project 1999. + */ +/* ==================================================================== + * Copyright (c) 1999 The OpenSSL Project. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * 3. All advertising materials mentioning features or use of this + * software must display the following acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" + * + * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to + * endorse or promote products derived from this software without + * prior written permission. For written permission, please contact + * licensing@OpenSSL.org. + * + * 5. Products derived from this software may not be called "OpenSSL" + * nor may "OpenSSL" appear in their names without prior written + * permission of the OpenSSL Project. + * + * 6. Redistributions of any form whatsoever must retain the following + * acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" + * + * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY + * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR + * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + * ==================================================================== + * + * This product includes cryptographic software written by Eric Young + * (eay@cryptsoft.com). This product includes software written by Tim + * Hudson (tjh@cryptsoft.com). + * + */ + +#include +#include "cryptlib.h" +#include +#include +#include + +/* PKCS#5 v2.0 password based encryption structures */ + +int i2d_PBE2PARAM(PBE2PARAM *a, unsigned char **pp) +{ + M_ASN1_I2D_vars(a); + M_ASN1_I2D_len (a->keyfunc, i2d_X509_ALGOR); + M_ASN1_I2D_len (a->encryption, i2d_X509_ALGOR); + + M_ASN1_I2D_seq_total (); + + M_ASN1_I2D_put (a->keyfunc, i2d_X509_ALGOR); + M_ASN1_I2D_put (a->encryption, i2d_X509_ALGOR); + + M_ASN1_I2D_finish(); +} + +PBE2PARAM *PBE2PARAM_new(void) +{ + PBE2PARAM *ret=NULL; + ASN1_CTX c; + M_ASN1_New_Malloc(ret, PBE2PARAM); + M_ASN1_New(ret->keyfunc,X509_ALGOR_new); + M_ASN1_New(ret->encryption,X509_ALGOR_new); + return (ret); + M_ASN1_New_Error(ASN1_F_PBE2PARAM_NEW); +} + +PBE2PARAM *d2i_PBE2PARAM(PBE2PARAM **a, unsigned char **pp, long length) +{ + M_ASN1_D2I_vars(a,PBE2PARAM *,PBE2PARAM_new); + M_ASN1_D2I_Init(); + M_ASN1_D2I_start_sequence(); + M_ASN1_D2I_get (ret->keyfunc, d2i_X509_ALGOR); + M_ASN1_D2I_get (ret->encryption, d2i_X509_ALGOR); + M_ASN1_D2I_Finish(a, PBE2PARAM_free, ASN1_F_D2I_PBE2PARAM); +} + +void PBE2PARAM_free (PBE2PARAM *a) +{ + if(a==NULL) return; + X509_ALGOR_free(a->keyfunc); + X509_ALGOR_free(a->encryption); + Free ((char *)a); +} + +int i2d_PBKDF2PARAM(PBKDF2PARAM *a, unsigned char **pp) +{ + M_ASN1_I2D_vars(a); + M_ASN1_I2D_len (a->salt, i2d_ASN1_TYPE); + M_ASN1_I2D_len (a->iter, i2d_ASN1_INTEGER); + M_ASN1_I2D_len (a->keylength, i2d_ASN1_INTEGER); + M_ASN1_I2D_len (a->prf, i2d_X509_ALGOR); + + M_ASN1_I2D_seq_total (); + + M_ASN1_I2D_put (a->salt, i2d_ASN1_TYPE); + M_ASN1_I2D_put (a->iter, i2d_ASN1_INTEGER); + M_ASN1_I2D_put (a->keylength, i2d_ASN1_INTEGER); + M_ASN1_I2D_put (a->prf, i2d_X509_ALGOR); + + M_ASN1_I2D_finish(); +} + +PBKDF2PARAM *PBKDF2PARAM_new(void) +{ + PBKDF2PARAM *ret=NULL; + ASN1_CTX c; + M_ASN1_New_Malloc(ret, PBKDF2PARAM); + M_ASN1_New(ret->salt, ASN1_TYPE_new); + M_ASN1_New(ret->iter, ASN1_INTEGER_new); + ret->keylength = NULL; + ret->prf = NULL; + return (ret); + M_ASN1_New_Error(ASN1_F_PBKDF2PARAM_NEW); +} + +PBKDF2PARAM *d2i_PBKDF2PARAM(PBKDF2PARAM **a, unsigned char **pp, + long length) +{ + M_ASN1_D2I_vars(a,PBKDF2PARAM *,PBKDF2PARAM_new); + M_ASN1_D2I_Init(); + M_ASN1_D2I_start_sequence(); + M_ASN1_D2I_get (ret->salt, d2i_ASN1_TYPE); + M_ASN1_D2I_get (ret->iter, d2i_ASN1_INTEGER); + M_ASN1_D2I_get_opt (ret->keylength, d2i_ASN1_INTEGER, V_ASN1_INTEGER); + M_ASN1_D2I_get_opt (ret->prf, d2i_X509_ALGOR, V_ASN1_SEQUENCE); + M_ASN1_D2I_Finish(a, PBKDF2PARAM_free, ASN1_F_D2I_PBKDF2PARAM); +} + +void PBKDF2PARAM_free (PBKDF2PARAM *a) +{ + if(a==NULL) return; + ASN1_TYPE_free(a->salt); + ASN1_INTEGER_free(a->iter); + ASN1_INTEGER_free(a->keylength); + X509_ALGOR_free(a->prf); + Free ((char *)a); +} + +/* Return an algorithm identifier for a PKCS#5 v2.0 PBE algorithm: + * yes I know this is horrible! + */ + +X509_ALGOR *PKCS5_pbe2_set(const EVP_CIPHER *cipher, int iter, + unsigned char *salt, int saltlen) +{ + X509_ALGOR *scheme = NULL, *kalg = NULL, *ret = NULL; + int alg_nid; + EVP_CIPHER_CTX ctx; + unsigned char iv[EVP_MAX_IV_LENGTH]; + PBKDF2PARAM *kdf = NULL; + PBE2PARAM *pbe2 = NULL; + ASN1_OCTET_STRING *osalt = NULL; + + if(!(pbe2 = PBE2PARAM_new())) goto merr; + + /* Setup the AlgorithmIdentifier for the encryption scheme */ + scheme = pbe2->encryption; + + alg_nid = EVP_CIPHER_type(cipher); + + scheme->algorithm = OBJ_nid2obj(alg_nid); + if(!(scheme->parameter = ASN1_TYPE_new())) goto merr; + + /* Create random IV */ + RAND_bytes(iv, EVP_CIPHER_iv_length(cipher)); + + /* Dummy cipherinit to just setup the IV */ + EVP_CipherInit(&ctx, cipher, NULL, iv, 0); + if(EVP_CIPHER_param_to_asn1(&ctx, scheme->parameter) < 0) { + ASN1err(ASN1_F_PKCS5_PBE2_SET, + ASN1_R_ERROR_SETTING_CIPHER_PARAMS); + goto err; + } + EVP_CIPHER_CTX_cleanup(&ctx); + + if(!(kdf = PBKDF2PARAM_new())) goto merr; + if(!(osalt = ASN1_OCTET_STRING_new())) goto merr; + + if (!saltlen) saltlen = PKCS5_SALT_LEN; + if (!(osalt->data = Malloc (saltlen))) goto merr; + osalt->length = saltlen; + if (salt) memcpy (osalt->data, salt, saltlen); + else RAND_bytes (osalt->data, saltlen); + + if(iter <= 0) iter = PKCS5_DEFAULT_ITER; + if(!ASN1_INTEGER_set(kdf->iter, iter)) goto merr; + + /* Now include salt in kdf structure */ + kdf->salt->value.octet_string = osalt; + kdf->salt->type = V_ASN1_OCTET_STRING; + osalt = NULL; + + /* If its RC2 then we'd better setup the key length */ + + if(alg_nid == NID_rc2_cbc) { + if(!(kdf->keylength = ASN1_INTEGER_new())) goto merr; + if(!ASN1_INTEGER_set (kdf->keylength, + EVP_CIPHER_key_length(cipher))) goto merr; + } + + /* prf can stay NULL because we are using hmacWithSHA1 */ + + /* Now setup the PBE2PARAM keyfunc structure */ + + pbe2->keyfunc->algorithm = OBJ_nid2obj(NID_id_pbkdf2); + + /* Encode PBKDF2PARAM into parameter of pbe2 */ + + if(!(pbe2->keyfunc->parameter = ASN1_TYPE_new())) goto merr; + + if(!ASN1_pack_string(kdf, i2d_PBKDF2PARAM, + &pbe2->keyfunc->parameter->value.sequence)) goto merr; + pbe2->keyfunc->parameter->type = V_ASN1_SEQUENCE; + + PBKDF2PARAM_free(kdf); + kdf = NULL; + + /* Now set up top level AlgorithmIdentifier */ + + if(!(ret = X509_ALGOR_new())) goto merr; + if(!(ret->parameter = ASN1_TYPE_new())) goto merr; + + ret->algorithm = OBJ_nid2obj(NID_pbes2); + + /* Encode PBE2PARAM into parameter */ + + if(!ASN1_pack_string(pbe2, i2d_PBE2PARAM, + &ret->parameter->value.sequence)) goto merr; + ret->parameter->type = V_ASN1_SEQUENCE; + + PBE2PARAM_free(pbe2); + pbe2 = NULL; + + return ret; + + merr: + ASN1err(ASN1_F_PKCS5_PBE2_SET,ERR_R_MALLOC_FAILURE); + + err: + PBE2PARAM_free(pbe2); + /* Note 'scheme' is freed as part of pbe2 */ + ASN1_OCTET_STRING_free(osalt); + PBKDF2PARAM_free(kdf); + X509_ALGOR_free(kalg); + X509_ALGOR_free(ret); + + return NULL; + +} 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 @@ #include #include "cryptlib.h" -#include "asn1_mac.h" -#include "x509.h" +#include +#include -/* - * ASN1err(ASN1_F_PKCS7_DIGEST_NEW,ASN1_R_MISSING_EOS); - * ASN1err(ASN1_F_D2I_PKCS7_DIGEST,ASN1_R_LENGTH_MISMATCH); - */ - -int i2d_PKCS7_DIGEST(a,pp) -PKCS7_DIGEST *a; -unsigned char **pp; +int i2d_PKCS7_DIGEST(PKCS7_DIGEST *a, unsigned char **pp) { M_ASN1_I2D_vars(a); @@ -87,10 +80,8 @@ unsigned char **pp; M_ASN1_I2D_finish(); } -PKCS7_DIGEST *d2i_PKCS7_DIGEST(a,pp,length) -PKCS7_DIGEST **a; -unsigned char **pp; -long length; +PKCS7_DIGEST *d2i_PKCS7_DIGEST(PKCS7_DIGEST **a, unsigned char **pp, + long length) { M_ASN1_D2I_vars(a,PKCS7_DIGEST *,PKCS7_DIGEST_new); @@ -104,9 +95,10 @@ long length; M_ASN1_D2I_Finish(a,PKCS7_DIGEST_free,ASN1_F_D2I_PKCS7_DIGEST); } -PKCS7_DIGEST *PKCS7_DIGEST_new() +PKCS7_DIGEST *PKCS7_DIGEST_new(void) { PKCS7_DIGEST *ret=NULL; + ASN1_CTX c; M_ASN1_New_Malloc(ret,PKCS7_DIGEST); M_ASN1_New(ret->version,ASN1_INTEGER_new); @@ -117,8 +109,7 @@ PKCS7_DIGEST *PKCS7_DIGEST_new() M_ASN1_New_Error(ASN1_F_PKCS7_DIGEST_NEW); } -void PKCS7_DIGEST_free(a) -PKCS7_DIGEST *a; +void PKCS7_DIGEST_free(PKCS7_DIGEST *a) { if (a == NULL) return; 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 @@ #include #include "cryptlib.h" -#include "asn1_mac.h" -#include "x509.h" +#include +#include -/* - * ASN1err(ASN1_F_PKCS7_ENCRYPT_NEW,ASN1_R_LENGTH_MISMATCH); - * ASN1err(ASN1_F_D2I_PKCS7_ENCRYPT,ASN1_R_LENGTH_MISMATCH); - */ - -int i2d_PKCS7_ENCRYPT(a,pp) -PKCS7_ENCRYPT *a; -unsigned char **pp; +int i2d_PKCS7_ENCRYPT(PKCS7_ENCRYPT *a, unsigned char **pp) { M_ASN1_I2D_vars(a); @@ -83,10 +76,8 @@ unsigned char **pp; M_ASN1_I2D_finish(); } -PKCS7_ENCRYPT *d2i_PKCS7_ENCRYPT(a,pp,length) -PKCS7_ENCRYPT **a; -unsigned char **pp; -long length; +PKCS7_ENCRYPT *d2i_PKCS7_ENCRYPT(PKCS7_ENCRYPT **a, unsigned char **pp, + long length) { M_ASN1_D2I_vars(a,PKCS7_ENCRYPT *,PKCS7_ENCRYPT_new); @@ -98,9 +89,10 @@ long length; M_ASN1_D2I_Finish(a,PKCS7_ENCRYPT_free,ASN1_F_D2I_PKCS7_ENCRYPT); } -PKCS7_ENCRYPT *PKCS7_ENCRYPT_new() +PKCS7_ENCRYPT *PKCS7_ENCRYPT_new(void) { PKCS7_ENCRYPT *ret=NULL; + ASN1_CTX c; M_ASN1_New_Malloc(ret,PKCS7_ENCRYPT); M_ASN1_New(ret->version,ASN1_INTEGER_new); @@ -109,8 +101,7 @@ PKCS7_ENCRYPT *PKCS7_ENCRYPT_new() M_ASN1_New_Error(ASN1_F_PKCS7_ENCRYPT_NEW); } -void PKCS7_ENCRYPT_free(a) -PKCS7_ENCRYPT *a; +void PKCS7_ENCRYPT_free(PKCS7_ENCRYPT *a) { if (a == NULL) return; 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 @@ #include #include "cryptlib.h" -#include "asn1_mac.h" -#include "x509.h" +#include +#include -/* - * ASN1err(ASN1_F_PKCS7_ENC_CONTENT_NEW,ASN1_R_LENGTH_MISMATCH); - * ASN1err(ASN1_F_D2I_PKCS7_ENC_CONTENT,ASN1_R_LENGTH_MISMATCH); - */ - -int i2d_PKCS7_ENC_CONTENT(a,pp) -PKCS7_ENC_CONTENT *a; -unsigned char **pp; +int i2d_PKCS7_ENC_CONTENT(PKCS7_ENC_CONTENT *a, unsigned char **pp) { M_ASN1_I2D_vars(a); @@ -85,10 +78,8 @@ unsigned char **pp; M_ASN1_I2D_finish(); } -PKCS7_ENC_CONTENT *d2i_PKCS7_ENC_CONTENT(a,pp,length) -PKCS7_ENC_CONTENT **a; -unsigned char **pp; -long length; +PKCS7_ENC_CONTENT *d2i_PKCS7_ENC_CONTENT(PKCS7_ENC_CONTENT **a, + unsigned char **pp, long length) { M_ASN1_D2I_vars(a,PKCS7_ENC_CONTENT *,PKCS7_ENC_CONTENT_new); @@ -103,20 +94,21 @@ long length; ASN1_F_D2I_PKCS7_ENC_CONTENT); } -PKCS7_ENC_CONTENT *PKCS7_ENC_CONTENT_new() +PKCS7_ENC_CONTENT *PKCS7_ENC_CONTENT_new(void) { PKCS7_ENC_CONTENT *ret=NULL; + ASN1_CTX c; M_ASN1_New_Malloc(ret,PKCS7_ENC_CONTENT); - M_ASN1_New(ret->content_type,ASN1_OBJECT_new); + /* M_ASN1_New(ret->content_type,ASN1_OBJECT_new); */ + ret->content_type=OBJ_nid2obj(NID_pkcs7_encrypted); M_ASN1_New(ret->algorithm,X509_ALGOR_new); ret->enc_data=NULL; return(ret); M_ASN1_New_Error(ASN1_F_PKCS7_ENC_CONTENT_NEW); } -void PKCS7_ENC_CONTENT_free(a) -PKCS7_ENC_CONTENT *a; +void PKCS7_ENC_CONTENT_free(PKCS7_ENC_CONTENT *a) { if (a == NULL) return; 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 @@ #include #include "cryptlib.h" -#include "asn1_mac.h" -#include "x509.h" +#include +#include -/* - * ASN1err(ASN1_F_PKCS7_ENVELOPE_NEW,ASN1_R_LENGTH_MISMATCH); - * ASN1err(ASN1_F_D2I_PKCS7_ENVELOPE,ASN1_R_LENGTH_MISMATCH); - */ - -int i2d_PKCS7_ENVELOPE(a,pp) -PKCS7_ENVELOPE *a; -unsigned char **pp; +int i2d_PKCS7_ENVELOPE(PKCS7_ENVELOPE *a, unsigned char **pp) { M_ASN1_I2D_vars(a); M_ASN1_I2D_len(a->version,i2d_ASN1_INTEGER); - M_ASN1_I2D_len_SET(a->recipientinfo,i2d_PKCS7_RECIP_INFO); + M_ASN1_I2D_len_SET_type(PKCS7_RECIP_INFO,a->recipientinfo, + i2d_PKCS7_RECIP_INFO); M_ASN1_I2D_len(a->enc_data,i2d_PKCS7_ENC_CONTENT); M_ASN1_I2D_seq_total(); M_ASN1_I2D_put(a->version,i2d_ASN1_INTEGER); - M_ASN1_I2D_put_SET(a->recipientinfo,i2d_PKCS7_RECIP_INFO); + M_ASN1_I2D_put_SET_type(PKCS7_RECIP_INFO,a->recipientinfo, + i2d_PKCS7_RECIP_INFO); M_ASN1_I2D_put(a->enc_data,i2d_PKCS7_ENC_CONTENT); M_ASN1_I2D_finish(); } -PKCS7_ENVELOPE *d2i_PKCS7_ENVELOPE(a,pp,length) -PKCS7_ENVELOPE **a; -unsigned char **pp; -long length; +PKCS7_ENVELOPE *d2i_PKCS7_ENVELOPE(PKCS7_ENVELOPE **a, unsigned char **pp, + long length) { M_ASN1_D2I_vars(a,PKCS7_ENVELOPE *,PKCS7_ENVELOPE_new); M_ASN1_D2I_Init(); M_ASN1_D2I_start_sequence(); M_ASN1_D2I_get(ret->version,d2i_ASN1_INTEGER); - M_ASN1_D2I_get_set(ret->recipientinfo,d2i_PKCS7_RECIP_INFO); + M_ASN1_D2I_get_set_type(PKCS7_RECIP_INFO,ret->recipientinfo, + d2i_PKCS7_RECIP_INFO,PKCS7_RECIP_INFO_free); M_ASN1_D2I_get(ret->enc_data,d2i_PKCS7_ENC_CONTENT); M_ASN1_D2I_Finish(a,PKCS7_ENVELOPE_free,ASN1_F_D2I_PKCS7_ENVELOPE); } -PKCS7_ENVELOPE *PKCS7_ENVELOPE_new() +PKCS7_ENVELOPE *PKCS7_ENVELOPE_new(void) { PKCS7_ENVELOPE *ret=NULL; + ASN1_CTX c; M_ASN1_New_Malloc(ret,PKCS7_ENVELOPE); M_ASN1_New(ret->version,ASN1_INTEGER_new); - M_ASN1_New(ret->recipientinfo,sk_new_null); + M_ASN1_New(ret->recipientinfo,sk_PKCS7_RECIP_INFO_new_null); M_ASN1_New(ret->enc_data,PKCS7_ENC_CONTENT_new); return(ret); M_ASN1_New_Error(ASN1_F_PKCS7_ENVELOPE_NEW); } -void PKCS7_ENVELOPE_free(a) -PKCS7_ENVELOPE *a; +void PKCS7_ENVELOPE_free(PKCS7_ENVELOPE *a) { if (a == NULL) return; ASN1_INTEGER_free(a->version); - sk_pop_free(a->recipientinfo,PKCS7_RECIP_INFO_free); + sk_PKCS7_RECIP_INFO_pop_free(a->recipientinfo,PKCS7_RECIP_INFO_free); PKCS7_ENC_CONTENT_free(a->enc_data); Free((char *)a); } 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 @@ #include #include "cryptlib.h" -#include "asn1_mac.h" -#include "x509.h" +#include +#include -/* - * ASN1err(ASN1_F_PKCS7_ISSUER_AND_SERIAL_NEW,ASN1_R_LENGTH_MISMATCH); - * ASN1err(ASN1_F_D2I_PKCS7_ISSUER_AND_SERIAL,ASN1_R_LENGTH_MISMATCH); - */ - -int i2d_PKCS7_ISSUER_AND_SERIAL(a,pp) -PKCS7_ISSUER_AND_SERIAL *a; -unsigned char **pp; +int i2d_PKCS7_ISSUER_AND_SERIAL(PKCS7_ISSUER_AND_SERIAL *a, + unsigned char **pp) { M_ASN1_I2D_vars(a); @@ -83,10 +77,7 @@ unsigned char **pp; M_ASN1_I2D_finish(); } -PKCS7_ISSUER_AND_SERIAL *d2i_PKCS7_ISSUER_AND_SERIAL(a,pp,length) -PKCS7_ISSUER_AND_SERIAL **a; -unsigned char **pp; -long length; +PKCS7_ISSUER_AND_SERIAL *d2i_PKCS7_ISSUER_AND_SERIAL(PKCS7_ISSUER_AND_SERIAL **a, unsigned char **pp, long length) { M_ASN1_D2I_vars(a,PKCS7_ISSUER_AND_SERIAL *,PKCS7_ISSUER_AND_SERIAL_new); @@ -98,9 +89,10 @@ long length; ASN1_F_D2I_PKCS7_ISSUER_AND_SERIAL); } -PKCS7_ISSUER_AND_SERIAL *PKCS7_ISSUER_AND_SERIAL_new() +PKCS7_ISSUER_AND_SERIAL *PKCS7_ISSUER_AND_SERIAL_new(void) { PKCS7_ISSUER_AND_SERIAL *ret=NULL; + ASN1_CTX c; M_ASN1_New_Malloc(ret,PKCS7_ISSUER_AND_SERIAL); M_ASN1_New(ret->issuer,X509_NAME_new); @@ -109,8 +101,7 @@ PKCS7_ISSUER_AND_SERIAL *PKCS7_ISSUER_AND_SERIAL_new() M_ASN1_New_Error(ASN1_F_PKCS7_ISSUER_AND_SERIAL_NEW); } -void PKCS7_ISSUER_AND_SERIAL_free(a) -PKCS7_ISSUER_AND_SERIAL *a; +void PKCS7_ISSUER_AND_SERIAL_free(PKCS7_ISSUER_AND_SERIAL *a) { if (a == NULL) return; 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 @@ #include #include "cryptlib.h" -#include "asn1_mac.h" -#include "objects.h" +#include +#include +#include -/* ASN1err(ASN1_F_D2I_PKCS7,ASN1_R_BAD_PKCS7_CONTENT); - * ASN1err(ASN1_F_I2D_PKCS7,ASN1_R_BAD_PKCS7_TYPE); - * ASN1err(ASN1_F_PKCS7_NEW,ASN1_R_BAD_PKCS7_TYPE); - */ - -int i2d_PKCS7(a,pp) -PKCS7 *a; -unsigned char **pp; +int i2d_PKCS7(PKCS7 *a, unsigned char **pp) { M_ASN1_I2D_vars(a); @@ -150,10 +144,7 @@ unsigned char **pp; M_ASN1_I2D_finish(); } -PKCS7 *d2i_PKCS7(a,pp,length) -PKCS7 **a; -unsigned char **pp; -long length; +PKCS7 *d2i_PKCS7(PKCS7 **a, unsigned char **pp, long length) { M_ASN1_D2I_vars(a,PKCS7 *,PKCS7_new); @@ -179,6 +170,7 @@ long length; V_ASN1_CONTEXT_SPECIFIC|0)) { c.error=ASN1_R_BAD_PKCS7_CONTENT; + c.line=__LINE__; goto err; } @@ -187,7 +179,7 @@ long length; c.q=c.p; Tinf=ASN1_get_object(&c.p,&Tlen,&Ttag,&Tclass, (c.inf & 1)?(length+ *pp-c.q):c.slen); - if (Tinf & 0x80) goto err; + if (Tinf & 0x80) { c.line=__LINE__; goto err; } c.slen-=(c.p-c.q); switch (OBJ_obj2nid(ret->type)) @@ -215,14 +207,16 @@ long length; break; default: c.error=ASN1_R_BAD_PKCS7_TYPE; + c.line=__LINE__; goto err; - break; + /* break; */ } if (Tinf == (1|V_ASN1_CONSTRUCTED)) { if (!ASN1_check_infinite_end(&c.p,c.slen)) { - c.error=ASN1_R_MISSING_EOS; + c.error=ERR_R_MISSING_ASN1_EOS; + c.line=__LINE__; goto err; } } @@ -233,12 +227,13 @@ long length; M_ASN1_D2I_Finish(a,PKCS7_free,ASN1_F_D2I_PKCS7); } -PKCS7 *PKCS7_new() +PKCS7 *PKCS7_new(void) { PKCS7 *ret=NULL; + ASN1_CTX c; M_ASN1_New_Malloc(ret,PKCS7); - ret->type=ASN1_OBJECT_new(); + ret->type=OBJ_nid2obj(NID_undef); ret->asn1=NULL; ret->length=0; ret->detached=0; @@ -247,8 +242,7 @@ PKCS7 *PKCS7_new() M_ASN1_New_Error(ASN1_F_PKCS7_NEW); } -void PKCS7_free(a) -PKCS7 *a; +void PKCS7_free(PKCS7 *a) { if (a == NULL) return; @@ -260,9 +254,11 @@ PKCS7 *a; Free((char *)(char *)a); } -void PKCS7_content_free(a) -PKCS7 *a; +void PKCS7_content_free(PKCS7 *a) { + if(a == NULL) + return; + if (a->asn1 != NULL) Free((char *)a->asn1); 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 @@ #include #include "cryptlib.h" -#include "asn1_mac.h" -#include "x509.h" +#include +#include -/* - * ASN1err(ASN1_F_PKCS7_RECIP_INFO_NEW,ASN1_R_LENGTH_MISMATCH); - * ASN1err(ASN1_F_D2I_PKCS7_RECIP_INFO,ASN1_R_LENGTH_MISMATCH); - */ - -int i2d_PKCS7_RECIP_INFO(a,pp) -PKCS7_RECIP_INFO *a; -unsigned char **pp; +int i2d_PKCS7_RECIP_INFO(PKCS7_RECIP_INFO *a, unsigned char **pp) { M_ASN1_I2D_vars(a); @@ -87,10 +80,8 @@ unsigned char **pp; M_ASN1_I2D_finish(); } -PKCS7_RECIP_INFO *d2i_PKCS7_RECIP_INFO(a,pp,length) -PKCS7_RECIP_INFO **a; -unsigned char **pp; -long length; +PKCS7_RECIP_INFO *d2i_PKCS7_RECIP_INFO(PKCS7_RECIP_INFO **a, + unsigned char **pp, long length) { M_ASN1_D2I_vars(a,PKCS7_RECIP_INFO *,PKCS7_RECIP_INFO_new); @@ -104,9 +95,10 @@ long length; M_ASN1_D2I_Finish(a,PKCS7_RECIP_INFO_free,ASN1_F_D2I_PKCS7_RECIP_INFO); } -PKCS7_RECIP_INFO *PKCS7_RECIP_INFO_new() +PKCS7_RECIP_INFO *PKCS7_RECIP_INFO_new(void) { PKCS7_RECIP_INFO *ret=NULL; + ASN1_CTX c; M_ASN1_New_Malloc(ret,PKCS7_RECIP_INFO); M_ASN1_New(ret->version,ASN1_INTEGER_new); @@ -118,8 +110,7 @@ PKCS7_RECIP_INFO *PKCS7_RECIP_INFO_new() M_ASN1_New_Error(ASN1_F_PKCS7_RECIP_INFO_NEW); } -void PKCS7_RECIP_INFO_free(a) -PKCS7_RECIP_INFO *a; +void PKCS7_RECIP_INFO_free(PKCS7_RECIP_INFO *a) { if (a == NULL) return; ASN1_INTEGER_free(a->version); @@ -127,6 +118,8 @@ PKCS7_RECIP_INFO *a; X509_ALGOR_free(a->key_enc_algor); ASN1_OCTET_STRING_free(a->enc_key); if (a->cert != NULL) X509_free(a->cert); - Free((char *)a); + Free(a); } +IMPLEMENT_STACK_OF(PKCS7_RECIP_INFO) +IMPLEMENT_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 @@ #include #include "cryptlib.h" -#include "asn1_mac.h" -#include "x509.h" +#include +#include -/* - * ASN1err(ASN1_F_PKCS7_SIGN_ENVELOPE_NEW,ASN1_R_LENGTH_MISMATCH); - * ASN1err(ASN1_F_D2I_PKCS7_SIGN_ENVELOPE,ASN1_R_LENGTH_MISMATCH); - */ - -int i2d_PKCS7_SIGN_ENVELOPE(a,pp) -PKCS7_SIGN_ENVELOPE *a; -unsigned char **pp; +int i2d_PKCS7_SIGN_ENVELOPE(PKCS7_SIGN_ENVELOPE *a, unsigned char **pp) { M_ASN1_I2D_vars(a); M_ASN1_I2D_len(a->version,i2d_ASN1_INTEGER); - M_ASN1_I2D_len_SET(a->recipientinfo,i2d_PKCS7_RECIP_INFO); - M_ASN1_I2D_len_SET(a->md_algs,i2d_X509_ALGOR); + M_ASN1_I2D_len_SET_type(PKCS7_RECIP_INFO,a->recipientinfo, + i2d_PKCS7_RECIP_INFO); + M_ASN1_I2D_len_SET_type(X509_ALGOR,a->md_algs,i2d_X509_ALGOR); M_ASN1_I2D_len(a->enc_data,i2d_PKCS7_ENC_CONTENT); - M_ASN1_I2D_len_IMP_set_opt(a->cert,i2d_X509,0); - M_ASN1_I2D_len_IMP_set_opt(a->crl,i2d_X509_CRL,1); - M_ASN1_I2D_len_SET(a->signer_info,i2d_PKCS7_SIGNER_INFO); + M_ASN1_I2D_len_IMP_SEQUENCE_opt_type(X509,a->cert,i2d_X509,0); + M_ASN1_I2D_len_IMP_SET_opt_type(X509_CRL,a->crl,i2d_X509_CRL,1); + M_ASN1_I2D_len_SET_type(PKCS7_SIGNER_INFO,a->signer_info, + i2d_PKCS7_SIGNER_INFO); M_ASN1_I2D_seq_total(); M_ASN1_I2D_put(a->version,i2d_ASN1_INTEGER); - M_ASN1_I2D_put_SET(a->recipientinfo,i2d_PKCS7_RECIP_INFO); - M_ASN1_I2D_put_SET(a->md_algs,i2d_X509_ALGOR); + M_ASN1_I2D_put_SET_type(PKCS7_RECIP_INFO,a->recipientinfo, + i2d_PKCS7_RECIP_INFO); + M_ASN1_I2D_put_SET_type(X509_ALGOR,a->md_algs,i2d_X509_ALGOR); M_ASN1_I2D_put(a->enc_data,i2d_PKCS7_ENC_CONTENT); - M_ASN1_I2D_put_IMP_set_opt(a->cert,i2d_X509,0); - M_ASN1_I2D_put_IMP_set_opt(a->crl,i2d_X509_CRL,1); - M_ASN1_I2D_put_SET(a->signer_info,i2d_PKCS7_SIGNER_INFO); + M_ASN1_I2D_put_IMP_SEQUENCE_opt_type(X509,a->cert,i2d_X509,0); + M_ASN1_I2D_put_IMP_SET_opt_type(X509_CRL,a->crl,i2d_X509_CRL,1); + M_ASN1_I2D_put_SET_type(PKCS7_SIGNER_INFO,a->signer_info, + i2d_PKCS7_SIGNER_INFO); M_ASN1_I2D_finish(); } -PKCS7_SIGN_ENVELOPE *d2i_PKCS7_SIGN_ENVELOPE(a,pp,length) -PKCS7_SIGN_ENVELOPE **a; -unsigned char **pp; -long length; +PKCS7_SIGN_ENVELOPE *d2i_PKCS7_SIGN_ENVELOPE(PKCS7_SIGN_ENVELOPE **a, + unsigned char **pp, long length) { M_ASN1_D2I_vars(a,PKCS7_SIGN_ENVELOPE *,PKCS7_SIGN_ENVELOPE_new); M_ASN1_D2I_Init(); M_ASN1_D2I_start_sequence(); M_ASN1_D2I_get(ret->version,d2i_ASN1_INTEGER); - M_ASN1_D2I_get_set(ret->recipientinfo,d2i_PKCS7_RECIP_INFO); - M_ASN1_D2I_get_set(ret->md_algs,d2i_X509_ALGOR); + M_ASN1_D2I_get_set_type(PKCS7_RECIP_INFO,ret->recipientinfo, + d2i_PKCS7_RECIP_INFO,PKCS7_RECIP_INFO_free); + M_ASN1_D2I_get_set_type(X509_ALGOR,ret->md_algs,d2i_X509_ALGOR, + X509_ALGOR_free); M_ASN1_D2I_get(ret->enc_data,d2i_PKCS7_ENC_CONTENT); - M_ASN1_D2I_get_IMP_set_opt(ret->cert,d2i_X509,0); - M_ASN1_D2I_get_IMP_set_opt(ret->crl,d2i_X509_CRL,1); - M_ASN1_D2I_get_set(ret->signer_info,d2i_PKCS7_SIGNER_INFO); + M_ASN1_D2I_get_IMP_set_opt_type(X509,ret->cert,d2i_X509,X509_free,0); + M_ASN1_D2I_get_IMP_set_opt_type(X509_CRL,ret->crl,d2i_X509_CRL, + X509_CRL_free,1); + M_ASN1_D2I_get_set_type(PKCS7_SIGNER_INFO,ret->signer_info, + d2i_PKCS7_SIGNER_INFO,PKCS7_SIGNER_INFO_free); M_ASN1_D2I_Finish(a,PKCS7_SIGN_ENVELOPE_free, ASN1_F_D2I_PKCS7_SIGN_ENVELOPE); } -PKCS7_SIGN_ENVELOPE *PKCS7_SIGN_ENVELOPE_new() +PKCS7_SIGN_ENVELOPE *PKCS7_SIGN_ENVELOPE_new(void) { PKCS7_SIGN_ENVELOPE *ret=NULL; + ASN1_CTX c; M_ASN1_New_Malloc(ret,PKCS7_SIGN_ENVELOPE); M_ASN1_New(ret->version,ASN1_INTEGER_new); - M_ASN1_New(ret->recipientinfo,sk_new_null); - M_ASN1_New(ret->md_algs,sk_new_null); + M_ASN1_New(ret->recipientinfo,sk_PKCS7_RECIP_INFO_new_null); + M_ASN1_New(ret->md_algs,sk_X509_ALGOR_new_null); M_ASN1_New(ret->enc_data,PKCS7_ENC_CONTENT_new); ret->cert=NULL; ret->crl=NULL; - M_ASN1_New(ret->signer_info,sk_new_null); + M_ASN1_New(ret->signer_info,sk_PKCS7_SIGNER_INFO_new_null); return(ret); M_ASN1_New_Error(ASN1_F_PKCS7_SIGN_ENVELOPE_NEW); } -void PKCS7_SIGN_ENVELOPE_free(a) -PKCS7_SIGN_ENVELOPE *a; +void PKCS7_SIGN_ENVELOPE_free(PKCS7_SIGN_ENVELOPE *a) { if (a == NULL) return; ASN1_INTEGER_free(a->version); - sk_pop_free(a->recipientinfo,PKCS7_RECIP_INFO_free); - sk_pop_free(a->md_algs,X509_ALGOR_free); + sk_PKCS7_RECIP_INFO_pop_free(a->recipientinfo,PKCS7_RECIP_INFO_free); + sk_X509_ALGOR_pop_free(a->md_algs,X509_ALGOR_free); PKCS7_ENC_CONTENT_free(a->enc_data); - sk_pop_free(a->cert,X509_free); - sk_pop_free(a->crl,X509_CRL_free); - sk_pop_free(a->signer_info,PKCS7_SIGNER_INFO_free); - Free((char *)a); + sk_X509_pop_free(a->cert,X509_free); + sk_X509_CRL_pop_free(a->crl,X509_CRL_free); + sk_PKCS7_SIGNER_INFO_pop_free(a->signer_info,PKCS7_SIGNER_INFO_free); + Free(a); } 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 @@ #include #include "cryptlib.h" -#include "asn1_mac.h" -#include "x509.h" +#include +#include -/* - * ASN1err(ASN1_F_PKCS7_SIGNED_NEW,ASN1_R_LENGTH_MISMATCH); - * ASN1err(ASN1_F_D2I_PKCS7_SIGNED,ASN1_R_LENGTH_MISMATCH); - */ - -int i2d_PKCS7_SIGNED(a,pp) -PKCS7_SIGNED *a; -unsigned char **pp; +int i2d_PKCS7_SIGNED(PKCS7_SIGNED *a, unsigned char **pp) { M_ASN1_I2D_vars(a); M_ASN1_I2D_len(a->version,i2d_ASN1_INTEGER); - M_ASN1_I2D_len_SET(a->md_algs,i2d_X509_ALGOR); + M_ASN1_I2D_len_SET_type(X509_ALGOR,a->md_algs,i2d_X509_ALGOR); M_ASN1_I2D_len(a->contents,i2d_PKCS7); - M_ASN1_I2D_len_IMP_set_opt(a->cert,i2d_X509,0); - M_ASN1_I2D_len_IMP_set_opt(a->crl,i2d_X509_CRL,1); - M_ASN1_I2D_len_SET(a->signer_info,i2d_PKCS7_SIGNER_INFO); + M_ASN1_I2D_len_IMP_SEQUENCE_opt_type(X509,a->cert,i2d_X509,0); + M_ASN1_I2D_len_IMP_SET_opt_type(X509_CRL,a->crl,i2d_X509_CRL,1); + M_ASN1_I2D_len_SET_type(PKCS7_SIGNER_INFO,a->signer_info, + i2d_PKCS7_SIGNER_INFO); M_ASN1_I2D_seq_total(); M_ASN1_I2D_put(a->version,i2d_ASN1_INTEGER); - M_ASN1_I2D_put_SET(a->md_algs,i2d_X509_ALGOR); + M_ASN1_I2D_put_SET_type(X509_ALGOR,a->md_algs,i2d_X509_ALGOR); M_ASN1_I2D_put(a->contents,i2d_PKCS7); - M_ASN1_I2D_put_IMP_set_opt(a->cert,i2d_X509,0); - M_ASN1_I2D_put_IMP_set_opt(a->crl,i2d_X509_CRL,1); - M_ASN1_I2D_put_SET(a->signer_info,i2d_PKCS7_SIGNER_INFO); + M_ASN1_I2D_put_IMP_SEQUENCE_opt_type(X509,a->cert,i2d_X509,0); + M_ASN1_I2D_put_IMP_SET_opt_type(X509_CRL,a->crl,i2d_X509_CRL,1); + M_ASN1_I2D_put_SET_type(PKCS7_SIGNER_INFO,a->signer_info, + i2d_PKCS7_SIGNER_INFO); M_ASN1_I2D_finish(); } -PKCS7_SIGNED *d2i_PKCS7_SIGNED(a,pp,length) -PKCS7_SIGNED **a; -unsigned char **pp; -long length; +PKCS7_SIGNED *d2i_PKCS7_SIGNED(PKCS7_SIGNED **a, unsigned char **pp, + long length) { M_ASN1_D2I_vars(a,PKCS7_SIGNED *,PKCS7_SIGNED_new); M_ASN1_D2I_Init(); M_ASN1_D2I_start_sequence(); M_ASN1_D2I_get(ret->version,d2i_ASN1_INTEGER); - M_ASN1_D2I_get_set(ret->md_algs,d2i_X509_ALGOR); + M_ASN1_D2I_get_set_type(X509_ALGOR,ret->md_algs,d2i_X509_ALGOR, + X509_ALGOR_free); M_ASN1_D2I_get(ret->contents,d2i_PKCS7); - M_ASN1_D2I_get_IMP_set_opt(ret->cert,d2i_X509,0); - M_ASN1_D2I_get_IMP_set_opt(ret->crl,d2i_X509_CRL,1); - M_ASN1_D2I_get_set(ret->signer_info,d2i_PKCS7_SIGNER_INFO); + M_ASN1_D2I_get_IMP_set_opt_type(X509,ret->cert,d2i_X509,X509_free,0); + M_ASN1_D2I_get_IMP_set_opt_type(X509_CRL,ret->crl,d2i_X509_CRL, + X509_CRL_free,1); + M_ASN1_D2I_get_set_type(PKCS7_SIGNER_INFO,ret->signer_info, + d2i_PKCS7_SIGNER_INFO,PKCS7_SIGNER_INFO_free); M_ASN1_D2I_Finish(a,PKCS7_SIGNED_free,ASN1_F_D2I_PKCS7_SIGNED); } -PKCS7_SIGNED *PKCS7_SIGNED_new() +PKCS7_SIGNED *PKCS7_SIGNED_new(void) { PKCS7_SIGNED *ret=NULL; + ASN1_CTX c; M_ASN1_New_Malloc(ret,PKCS7_SIGNED); M_ASN1_New(ret->version,ASN1_INTEGER_new); - M_ASN1_New(ret->md_algs,sk_new_null); + M_ASN1_New(ret->md_algs,sk_X509_ALGOR_new_null); M_ASN1_New(ret->contents,PKCS7_new); ret->cert=NULL; ret->crl=NULL; - M_ASN1_New(ret->signer_info,sk_new_null); + M_ASN1_New(ret->signer_info,sk_PKCS7_SIGNER_INFO_new_null); return(ret); M_ASN1_New_Error(ASN1_F_PKCS7_SIGNED_NEW); } -void PKCS7_SIGNED_free(a) -PKCS7_SIGNED *a; +void PKCS7_SIGNED_free(PKCS7_SIGNED *a) { if (a == NULL) return; ASN1_INTEGER_free(a->version); - sk_pop_free(a->md_algs,X509_ALGOR_free); + sk_X509_ALGOR_pop_free(a->md_algs,X509_ALGOR_free); PKCS7_free(a->contents); - sk_pop_free(a->cert,X509_free); - sk_pop_free(a->crl,X509_CRL_free); - sk_pop_free(a->signer_info,PKCS7_SIGNER_INFO_free); - Free((char *)a); + sk_X509_pop_free(a->cert,X509_free); + sk_X509_CRL_pop_free(a->crl,X509_CRL_free); + sk_PKCS7_SIGNER_INFO_pop_free(a->signer_info,PKCS7_SIGNER_INFO_free); + Free(a); } - 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 @@ #include #include "cryptlib.h" -#include "asn1_mac.h" -#include "x509.h" +#include +#include -/* - * ASN1err(ASN1_F_PKCS7_SIGNER_INFO_NEW,ASN1_R_LENGTH_MISMATCH); - * ASN1err(ASN1_F_D2I_PKCS7_SIGNER_INFO,ASN1_R_LENGTH_MISMATCH); - */ - -int i2d_PKCS7_SIGNER_INFO(a,pp) -PKCS7_SIGNER_INFO *a; -unsigned char **pp; +int i2d_PKCS7_SIGNER_INFO(PKCS7_SIGNER_INFO *a, unsigned char **pp) { M_ASN1_I2D_vars(a); M_ASN1_I2D_len(a->version,i2d_ASN1_INTEGER); M_ASN1_I2D_len(a->issuer_and_serial,i2d_PKCS7_ISSUER_AND_SERIAL); M_ASN1_I2D_len(a->digest_alg,i2d_X509_ALGOR); - M_ASN1_I2D_len_IMP_set_opt(a->auth_attr,i2d_X509_ATTRIBUTE,0); + M_ASN1_I2D_len_IMP_SET_opt_type(X509_ATTRIBUTE,a->auth_attr, + i2d_X509_ATTRIBUTE,0); M_ASN1_I2D_len(a->digest_enc_alg,i2d_X509_ALGOR); M_ASN1_I2D_len(a->enc_digest,i2d_ASN1_OCTET_STRING); - M_ASN1_I2D_len_IMP_set_opt(a->unauth_attr,i2d_X509_ATTRIBUTE,1); + M_ASN1_I2D_len_IMP_SET_opt_type(X509_ATTRIBUTE,a->unauth_attr, + i2d_X509_ATTRIBUTE,1); M_ASN1_I2D_seq_total(); M_ASN1_I2D_put(a->version,i2d_ASN1_INTEGER); M_ASN1_I2D_put(a->issuer_and_serial,i2d_PKCS7_ISSUER_AND_SERIAL); M_ASN1_I2D_put(a->digest_alg,i2d_X509_ALGOR); - M_ASN1_I2D_put_IMP_set_opt(a->auth_attr,i2d_X509_ATTRIBUTE,0); + M_ASN1_I2D_put_IMP_SET_opt_type(X509_ATTRIBUTE,a->auth_attr, + i2d_X509_ATTRIBUTE,0); M_ASN1_I2D_put(a->digest_enc_alg,i2d_X509_ALGOR); M_ASN1_I2D_put(a->enc_digest,i2d_ASN1_OCTET_STRING); - M_ASN1_I2D_put_IMP_set_opt(a->unauth_attr,i2d_X509_ATTRIBUTE,1); + M_ASN1_I2D_put_IMP_SET_opt_type(X509_ATTRIBUTE,a->unauth_attr, + i2d_X509_ATTRIBUTE,1); M_ASN1_I2D_finish(); } -PKCS7_SIGNER_INFO *d2i_PKCS7_SIGNER_INFO(a,pp,length) -PKCS7_SIGNER_INFO **a; -unsigned char **pp; -long length; +PKCS7_SIGNER_INFO *d2i_PKCS7_SIGNER_INFO(PKCS7_SIGNER_INFO **a, + unsigned char **pp, long length) { M_ASN1_D2I_vars(a,PKCS7_SIGNER_INFO *,PKCS7_SIGNER_INFO_new); @@ -105,18 +100,23 @@ long length; M_ASN1_D2I_get(ret->version,d2i_ASN1_INTEGER); M_ASN1_D2I_get(ret->issuer_and_serial,d2i_PKCS7_ISSUER_AND_SERIAL); M_ASN1_D2I_get(ret->digest_alg,d2i_X509_ALGOR); - M_ASN1_D2I_get_IMP_set_opt(ret->auth_attr,d2i_X509_ATTRIBUTE,0); + M_ASN1_D2I_get_IMP_set_opt_type(X509_ATTRIBUTE,ret->auth_attr, + d2i_X509_ATTRIBUTE,X509_ATTRIBUTE_free, + 0); M_ASN1_D2I_get(ret->digest_enc_alg,d2i_X509_ALGOR); M_ASN1_D2I_get(ret->enc_digest,d2i_ASN1_OCTET_STRING); - M_ASN1_D2I_get_IMP_set_opt(ret->unauth_attr,d2i_X509_ATTRIBUTE,1); + M_ASN1_D2I_get_IMP_set_opt_type(X509_ATTRIBUTE,ret->unauth_attr, + d2i_X509_ATTRIBUTE, + X509_ATTRIBUTE_free,1); M_ASN1_D2I_Finish(a,PKCS7_SIGNER_INFO_free, ASN1_F_D2I_PKCS7_SIGNER_INFO); } -PKCS7_SIGNER_INFO *PKCS7_SIGNER_INFO_new() +PKCS7_SIGNER_INFO *PKCS7_SIGNER_INFO_new(void) { PKCS7_SIGNER_INFO *ret=NULL; + ASN1_CTX c; M_ASN1_New_Malloc(ret,PKCS7_SIGNER_INFO); M_ASN1_New(ret->version,ASN1_INTEGER_new); @@ -131,19 +131,20 @@ PKCS7_SIGNER_INFO *PKCS7_SIGNER_INFO_new() M_ASN1_New_Error(ASN1_F_PKCS7_SIGNER_INFO_NEW); } -void PKCS7_SIGNER_INFO_free(a) -PKCS7_SIGNER_INFO *a; +void PKCS7_SIGNER_INFO_free(PKCS7_SIGNER_INFO *a) { if (a == NULL) return; ASN1_INTEGER_free(a->version); PKCS7_ISSUER_AND_SERIAL_free(a->issuer_and_serial); X509_ALGOR_free(a->digest_alg); - sk_pop_free(a->auth_attr,X509_ATTRIBUTE_free); + sk_X509_ATTRIBUTE_pop_free(a->auth_attr,X509_ATTRIBUTE_free); X509_ALGOR_free(a->digest_enc_alg); ASN1_OCTET_STRING_free(a->enc_digest); - sk_pop_free(a->unauth_attr,X509_ATTRIBUTE_free); + sk_X509_ATTRIBUTE_pop_free(a->unauth_attr,X509_ATTRIBUTE_free); if (a->pkey != NULL) EVP_PKEY_free(a->pkey); Free((char *)a); } +IMPLEMENT_STACK_OF(PKCS7_SIGNER_INFO) +IMPLEMENT_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 @@ +/* p8_pkey.c */ +/* Written by Dr Stephen N Henson (shenson@bigfoot.com) for the OpenSSL + * project 1999. + */ +/* ==================================================================== + * Copyright (c) 1999 The OpenSSL Project. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * 3. All advertising materials mentioning features or use of this + * software must display the following acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" + * + * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to + * endorse or promote products derived from this software without + * prior written permission. For written permission, please contact + * licensing@OpenSSL.org. + * + * 5. Products derived from this software may not be called "OpenSSL" + * nor may "OpenSSL" appear in their names without prior written + * permission of the OpenSSL Project. + * + * 6. Redistributions of any form whatsoever must retain the following + * acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" + * + * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY + * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR + * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + * ==================================================================== + * + * This product includes cryptographic software written by Eric Young + * (eay@cryptsoft.com). This product includes software written by Tim + * Hudson (tjh@cryptsoft.com). + * + */ + +#include +#include "cryptlib.h" +#include +#include + +int i2d_PKCS8_PRIV_KEY_INFO (PKCS8_PRIV_KEY_INFO *a, unsigned char **pp) +{ + + M_ASN1_I2D_vars(a); + + M_ASN1_I2D_len (a->version, i2d_ASN1_INTEGER); + M_ASN1_I2D_len (a->pkeyalg, i2d_X509_ALGOR); + M_ASN1_I2D_len (a->pkey, i2d_ASN1_TYPE); + M_ASN1_I2D_len_IMP_SET_opt_type (X509_ATTRIBUTE, a->attributes, + i2d_X509_ATTRIBUTE, 0); + + M_ASN1_I2D_seq_total (); + + M_ASN1_I2D_put (a->version, i2d_ASN1_INTEGER); + M_ASN1_I2D_put (a->pkeyalg, i2d_X509_ALGOR); + M_ASN1_I2D_put (a->pkey, i2d_ASN1_TYPE); + M_ASN1_I2D_put_IMP_SET_opt_type (X509_ATTRIBUTE, a->attributes, + i2d_X509_ATTRIBUTE, 0); + + M_ASN1_I2D_finish(); +} + +PKCS8_PRIV_KEY_INFO *PKCS8_PRIV_KEY_INFO_new(void) +{ + PKCS8_PRIV_KEY_INFO *ret=NULL; + ASN1_CTX c; + M_ASN1_New_Malloc(ret, PKCS8_PRIV_KEY_INFO); + M_ASN1_New (ret->version, ASN1_INTEGER_new); + M_ASN1_New (ret->pkeyalg, X509_ALGOR_new); + M_ASN1_New (ret->pkey, ASN1_TYPE_new); + ret->attributes = NULL; + ret->broken = PKCS8_OK; + return (ret); + M_ASN1_New_Error(ASN1_F_PKCS8_PRIV_KEY_INFO_NEW); +} + +PKCS8_PRIV_KEY_INFO *d2i_PKCS8_PRIV_KEY_INFO(PKCS8_PRIV_KEY_INFO **a, + unsigned char **pp, long length) +{ + M_ASN1_D2I_vars(a,PKCS8_PRIV_KEY_INFO *,PKCS8_PRIV_KEY_INFO_new); + M_ASN1_D2I_Init(); + M_ASN1_D2I_start_sequence(); + M_ASN1_D2I_get (ret->version, d2i_ASN1_INTEGER); + M_ASN1_D2I_get (ret->pkeyalg, d2i_X509_ALGOR); + M_ASN1_D2I_get (ret->pkey, d2i_ASN1_TYPE); + M_ASN1_D2I_get_IMP_set_opt_type(X509_ATTRIBUTE, ret->attributes, + d2i_X509_ATTRIBUTE, + X509_ATTRIBUTE_free, 0); + if (ASN1_TYPE_get(ret->pkey) == V_ASN1_SEQUENCE) + ret->broken = PKCS8_NO_OCTET; + M_ASN1_D2I_Finish(a, PKCS8_PRIV_KEY_INFO_free, ASN1_F_D2I_PKCS8_PRIV_KEY_INFO); +} + +void PKCS8_PRIV_KEY_INFO_free (PKCS8_PRIV_KEY_INFO *a) +{ + if (a == NULL) return; + ASN1_INTEGER_free (a->version); + X509_ALGOR_free(a->pkeyalg); + /* Clear sensitive data */ + if (a->pkey->value.octet_string) + memset (a->pkey->value.octet_string->data, + 0, a->pkey->value.octet_string->length); + ASN1_TYPE_free (a->pkey); + sk_X509_ATTRIBUTE_pop_free (a->attributes, X509_ATTRIBUTE_free); + Free (a); +} 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 @@ #include #include "cryptlib.h" -#include "asn1_mac.h" -#include "objects.h" +#include +#include -/* - * ASN1err(ASN1_F_D2I_X509_KEY,ASN1_R_LENGTH_MISMATCH); - * ASN1err(ASN1_F_X509_KEY_NEW,ASN1_R_BAD_GET_OBJECT); - */ - -int i2d_X509_KEY(a,pp) -X509 *a; -unsigned char **pp; +int i2d_X509_KEY(X509 *a, unsigned char **pp) { M_ASN1_I2D_vars(a); @@ -85,10 +78,7 @@ unsigned char **pp; M_ASN1_I2D_finish(); } -X509 *d2i_X509_KEY(a,pp,length) -X509 **a; -unsigned char **pp; -long length; +X509 *d2i_X509_KEY(X509 **a, unsigned char **pp, long length) { M_ASN1_D2I_vars(a,X509 *,X509_new); @@ -100,7 +90,7 @@ long length; M_ASN1_D2I_Finish(a,X509_free,ASN1_F_D2I_X509); } -X509 *X509_KEY_new() +X509 *X509_KEY_new(void) { X509_KEY *ret=NULL; @@ -114,8 +104,7 @@ X509 *X509_KEY_new() M_ASN1_New_Error(ASN1_F_X509_NEW); } -void X509_KEY_free(a) -X509 *a; +void X509_KEY_free(X509 *a) { int i; 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 @@ +/* t_crl.c */ +/* Written by Dr Stephen N Henson (shenson@bigfoot.com) for the OpenSSL + * project 1999. + */ +/* ==================================================================== + * Copyright (c) 1999 The OpenSSL Project. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * 3. All advertising materials mentioning features or use of this + * software must display the following acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" + * + * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to + * endorse or promote products derived from this software without + * prior written permission. For written permission, please contact + * licensing@OpenSSL.org. + * + * 5. Products derived from this software may not be called "OpenSSL" + * nor may "OpenSSL" appear in their names without prior written + * permission of the OpenSSL Project. + * + * 6. Redistributions of any form whatsoever must retain the following + * acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" + * + * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY + * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR + * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + * ==================================================================== + * + * This product includes cryptographic software written by Eric Young + * (eay@cryptsoft.com). This product includes software written by Tim + * Hudson (tjh@cryptsoft.com). + * + */ + +#include +#include "cryptlib.h" +#include +#include +#include +#include +#include + +static void ext_print(BIO *out, X509_EXTENSION *ex); +#ifndef NO_FP_API +int X509_CRL_print_fp(FILE *fp, X509_CRL *x) + { + BIO *b; + int ret; + + if ((b=BIO_new(BIO_s_file())) == NULL) + { + X509err(X509_F_X509_PRINT_FP,ERR_R_BUF_LIB); + return(0); + } + BIO_set_fp(b,fp,BIO_NOCLOSE); + ret=X509_CRL_print(b, x); + BIO_free(b); + return(ret); + } +#endif + +int X509_CRL_print(BIO *out, X509_CRL *x) +{ + char buf[256]; + unsigned char *s; + STACK_OF(X509_REVOKED) *rev; + X509_REVOKED *r; + long l; + int i, j, n; + + BIO_printf(out, "Certificate Revocation List (CRL):\n"); + l = X509_CRL_get_version(x); + BIO_printf(out, "%8sVersion %lu (0x%lx)\n", "", l+1, l); + i = OBJ_obj2nid(x->sig_alg->algorithm); + BIO_printf(out, "%8sSignature Algorithm: %s\n", "", + (i == NID_undef) ? "NONE" : OBJ_nid2ln(i)); + X509_NAME_oneline(X509_CRL_get_issuer(x),buf,256); + BIO_printf(out,"%8sIssuer: %s\n","",buf); + BIO_printf(out,"%8sLast Update: ",""); + ASN1_TIME_print(out,X509_CRL_get_lastUpdate(x)); + BIO_printf(out,"\n%8sNext Update: ",""); + if (X509_CRL_get_nextUpdate(x)) + ASN1_TIME_print(out,X509_CRL_get_nextUpdate(x)); + else BIO_printf(out,"NONE"); + BIO_printf(out,"\n"); + + n=X509_CRL_get_ext_count(x); + if (n > 0) { + BIO_printf(out,"%8sCRL extensions:\n",""); + for (i=0; iserialNumber); + BIO_printf(out,"\n Revocation Date: ",""); + ASN1_TIME_print(out,r->revocationDate); + BIO_printf(out,"\n"); + for(j = 0; j < X509_REVOKED_get_ext_count(r); j++) + ext_print(out, X509_REVOKED_get_ext(r, j)); + } + + i=OBJ_obj2nid(x->sig_alg->algorithm); + BIO_printf(out," Signature Algorithm: %s", + (i == NID_undef)?"UNKNOWN":OBJ_nid2ln(i)); + + s = x->signature->data; + n = x->signature->length; + for (i=0; ivalue); + } + BIO_write(out,"\n",1); +} 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 @@ #include #include "cryptlib.h" -#include "buffer.h" -#include "bn.h" +#include +#include #ifndef NO_RSA -#include "rsa.h" +#include #endif #ifndef NO_DH -#include "dh.h" +#include #endif #ifndef NO_DSA -#include "dsa.h" +#include #endif -/* DHerr(DH_F_DHPARAMS_PRINT,ERR_R_MALLOC_FAILURE); - * DSAerr(DSA_F_DSAPARAMS_PRINT,ERR_R_MALLOC_FAILURE); - */ - -#ifndef NOPROTO -static int print(BIO *fp,char *str,BIGNUM *num, +static int print(BIO *fp,const char *str,BIGNUM *num, unsigned char *buf,int off); -#else -static int print(); -#endif - #ifndef NO_RSA #ifndef NO_FP_API -int RSA_print_fp(fp,x,off) -FILE *fp; -RSA *x; -int off; +int RSA_print_fp(FILE *fp, RSA *x, int off) { BIO *b; int ret; @@ -103,12 +91,10 @@ int off; } #endif -int RSA_print(bp,x,off) -BIO *bp; -RSA *x; -int off; +int RSA_print(BIO *bp, RSA *x, int off) { - char str[128],*s; + char str[128]; + const char *s; unsigned char *m=NULL; int i,ret=0; @@ -154,10 +140,7 @@ err: #ifndef NO_DSA #ifndef NO_FP_API -int DSA_print_fp(fp,x,off) -FILE *fp; -DSA *x; -int off; +int DSA_print_fp(FILE *fp, DSA *x, int off) { BIO *b; int ret; @@ -174,10 +157,7 @@ int off; } #endif -int DSA_print(bp,x,off) -BIO *bp; -DSA *x; -int off; +int DSA_print(BIO *bp, DSA *x, int off) { char str[128]; unsigned char *m=NULL; @@ -229,15 +209,12 @@ err: } #endif /* !NO_DSA */ -static int print(bp,number,num,buf,off) -BIO *bp; -char *number; -BIGNUM *num; -unsigned char *buf; -int off; +static int print(BIO *bp, const char *number, BIGNUM *num, unsigned char *buf, + int off) { int n,i; - char str[128],*neg; + char str[128]; + const char *neg; if (num == NULL) return(1); neg=(num->neg)?"-":""; @@ -284,9 +261,7 @@ int off; #ifndef NO_DH #ifndef NO_FP_API -int DHparams_print_fp(fp,x) -FILE *fp; -DH *x; +int DHparams_print_fp(FILE *fp, DH *x) { BIO *b; int ret; @@ -303,9 +278,7 @@ DH *x; } #endif -int DHparams_print(bp,x) -BIO *bp; -DH *x; +int DHparams_print(BIO *bp, DH *x) { unsigned char *m=NULL; int reason=ERR_R_BUF_LIB,i,ret=0; @@ -341,9 +314,7 @@ err: #ifndef NO_DSA #ifndef NO_FP_API -int DSAparams_print_fp(fp,x) -FILE *fp; -DSA *x; +int DSAparams_print_fp(FILE *fp, DSA *x) { BIO *b; int ret; @@ -360,9 +331,7 @@ DSA *x; } #endif -int DSAparams_print(bp,x) -BIO *bp; -DSA *x; +int DSAparams_print(BIO *bp, DSA *x) { unsigned char *m=NULL; 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 @@ #include #include "cryptlib.h" -#include "buffer.h" -#include "bn.h" -#include "objects.h" -#include "x509.h" +#include +#include +#include +#include #ifndef NO_FP_API -int X509_REQ_print_fp(fp,x) -FILE *fp; -X509_REQ *x; +int X509_REQ_print_fp(FILE *fp, X509_REQ *x) { BIO *b; int ret; @@ -83,16 +81,15 @@ X509_REQ *x; } #endif -int X509_REQ_print(bp,x) -BIO *bp; -X509_REQ *x; +int X509_REQ_print(BIO *bp, X509_REQ *x) { unsigned long l; int i,n; - char *s,*neg; + char *s; + const char *neg; X509_REQ_INFO *ri; EVP_PKEY *pkey; - STACK *sk; + STACK_OF(X509_ATTRIBUTE) *sk; char str[128]; ri=x->req_info; @@ -138,12 +135,14 @@ X509_REQ *x; #endif BIO_printf(bp,"%12sUnknown Public Key:\n",""); + EVP_PKEY_free(pkey); + /* may not be */ sprintf(str,"%8sAttributes:\n",""); if (BIO_puts(bp,str) <= 0) goto err; sk=x->req_info->attributes; - if ((sk == NULL) || (sk_num(sk) == 0)) + if ((sk == NULL) || (sk_X509_ATTRIBUTE_num(sk) == 0)) { if (!x->req_info->req_kludge) { @@ -153,7 +152,7 @@ X509_REQ *x; } else { - for (i=0; iobject)) > 0) - + { if (a->set) { ii=0; - count=sk_num(a->value.set); + count=sk_ASN1_TYPE_num(a->value.set); get_next: - at=(ASN1_TYPE *)sk_value(a->value.set,ii); + at=sk_ASN1_TYPE_value(a->value.set,ii); type=at->type; bs=at->value.asn1_string; } @@ -181,6 +180,7 @@ get_next: type=t->type; bs=t->value.bit_string; } + } for (j=25-j; j>0; j--) if (BIO_write(bp," ",1) != 1) goto err; 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 @@ #include #include "cryptlib.h" -#include "buffer.h" -#include "bn.h" +#include +#include #ifndef NO_RSA -#include "rsa.h" +#include #endif #ifndef NO_DSA -#include "dsa.h" +#include #endif -#include "objects.h" -#include "x509.h" +#include +#include +#include #ifndef NO_FP_API -int X509_print_fp(fp,x) -FILE *fp; -X509 *x; +int X509_print_fp(FILE *fp, X509 *x) { BIO *b; int ret; @@ -89,9 +88,7 @@ X509 *x; } #endif -int X509_print(bp,x) -BIO *bp; -X509 *x; +int X509_print(BIO *bp, X509 *x) { long l; int ret=0,i,j,n; @@ -99,7 +96,7 @@ X509 *x; X509_CINF *ci; ASN1_INTEGER *bs; EVP_PKEY *pkey=NULL; - char *neg; + const char *neg; X509_EXTENSION *ex; ASN1_STRING *str=NULL; @@ -146,9 +143,9 @@ X509 *x; if (!X509_NAME_print(bp,X509_get_issuer_name(x),16)) goto err; if (BIO_write(bp,"\n Validity\n",18) <= 0) goto err; if (BIO_write(bp," Not Before: ",24) <= 0) goto err; - if (!ASN1_UTCTIME_print(bp,X509_get_notBefore(x))) goto err; + if (!ASN1_TIME_print(bp,X509_get_notBefore(x))) goto err; if (BIO_write(bp,"\n Not After : ",25) <= 0) goto err; - if (!ASN1_UTCTIME_print(bp,X509_get_notAfter(x))) goto err; + if (!ASN1_TIME_print(bp,X509_get_notAfter(x))) goto err; if (BIO_write(bp,"\n Subject: ",18) <= 0) goto err; if (!X509_NAME_print(bp,X509_get_subject_name(x),16)) goto err; if (BIO_write(bp,"\n Subject Public Key Info:\n",34) <= 0) @@ -158,6 +155,12 @@ X509 *x; (i == NID_undef)?"UNKNOWN":OBJ_nid2ln(i)) <= 0) goto err; pkey=X509_get_pubkey(x); + if (pkey == NULL) + { + BIO_printf(bp,"%12sUnable to load Public Key\n",""); + ERR_print_errors(bp); + } + else #ifndef NO_RSA if (pkey->type == EVP_PKEY_RSA) { @@ -175,7 +178,9 @@ X509 *x; } else #endif - BIO_printf(bp,"%12sDSA Public Key:\n",""); + BIO_printf(bp,"%12sUnknown Public Key:\n",""); + + EVP_PKEY_free(pkey); n=X509_get_ext_count(x); if (n > 0) @@ -183,7 +188,9 @@ X509 *x; BIO_printf(bp,"%8sX509v3 extensions:\n",""); for (i=0; idata, - str->length) <= 0) - goto err; - } - else if (data_type == V_ASN1_BIT_STRING) - { - BIO_printf(bp,"0x"); - for (j=0; jlength; j++) - { - BIO_printf(bp,"%02X", - str->data[j]); - } - } - } - else + if(!X509V3_EXT_print(bp, ex, 0, 16)) { + BIO_printf(bp, "%16s", ""); ASN1_OCTET_STRING_print(bp,ex->value); } if (BIO_write(bp,"\n",1) <= 0) goto err; @@ -253,9 +230,7 @@ err: return(ret); } -int ASN1_STRING_print(bp,v) -BIO *bp; -ASN1_STRING *v; +int ASN1_STRING_print(BIO *bp, ASN1_STRING *v) { int i,n; char buf[80],*p;; @@ -284,15 +259,59 @@ ASN1_STRING *v; return(1); } -int ASN1_UTCTIME_print(bp,tm) -BIO *bp; -ASN1_UTCTIME *tm; +int ASN1_TIME_print(BIO *bp, ASN1_TIME *tm) +{ + if(tm->type == V_ASN1_UTCTIME) return ASN1_UTCTIME_print(bp, tm); + if(tm->type == V_ASN1_GENERALIZEDTIME) + return ASN1_GENERALIZEDTIME_print(bp, tm); + BIO_write(bp,"Bad time value",14); + return(0); +} + +static const char *mon[12]= + { + "Jan","Feb","Mar","Apr","May","Jun", + "Jul","Aug","Sep","Oct","Nov","Dec" + }; + +int ASN1_GENERALIZEDTIME_print(BIO *bp, ASN1_GENERALIZEDTIME *tm) + { + char *v; + int gmt=0; + int i; + int y=0,M=0,d=0,h=0,m=0,s=0; + + i=tm->length; + v=(char *)tm->data; + + if (i < 12) goto err; + if (v[i-1] == 'Z') gmt=1; + for (i=0; i<12; i++) + if ((v[i] > '9') || (v[i] < '0')) goto err; + y= (v[0]-'0')*1000+(v[1]-'0')*100 + (v[2]-'0')*10+(v[3]-'0'); + M= (v[4]-'0')*10+(v[5]-'0'); + if ((M > 12) || (M < 1)) goto err; + d= (v[6]-'0')*10+(v[7]-'0'); + h= (v[8]-'0')*10+(v[9]-'0'); + m= (v[10]-'0')*10+(v[11]-'0'); + if ( (v[12] >= '0') && (v[12] <= '9') && + (v[13] >= '0') && (v[13] <= '9')) + s= (v[12]-'0')*10+(v[13]-'0'); + + if (BIO_printf(bp,"%s %2d %02d:%02d:%02d %d%s", + mon[M-1],d,h,m,s,y,(gmt)?" GMT":"") <= 0) + return(0); + else + return(1); +err: + BIO_write(bp,"Bad time value",14); + return(0); + } + +int ASN1_UTCTIME_print(BIO *bp, ASN1_UTCTIME *tm) { char *v; int gmt=0; - static char *mon[12]={ - "Jan","Feb","Mar","Apr","May","Jun", - "Jul","Aug","Sep","Oct","Nov","Dec"}; int i; int y=0,M=0,d=0,h=0,m=0,s=0; @@ -324,10 +343,7 @@ err: return(0); } -int X509_NAME_print(bp,name,obase) -BIO *bp; -X509_NAME *name; -int obase; +int X509_NAME_print(BIO *bp, X509_NAME *name, int obase) { char *s,*c; int ret=0,l,ll,i,first=1; @@ -342,6 +358,7 @@ int obase; c=s; for (;;) { +#ifndef CHARSET_EBCDIC if ( ((*s == '/') && ((s[1] >= 'A') && (s[1] <= 'Z') && ( (s[2] == '=') || @@ -349,6 +366,15 @@ int obase; (s[3] == '=')) ))) || (*s == '\0')) +#else + if ( ((*s == '/') && + (isupper(s[1]) && ( + (s[2] == '=') || + (isupper(s[2]) && + (s[3] == '=')) + ))) || + (*s == '\0')) +#endif { if ((l <= 0) && !first) { 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 @@ #include #include "cryptlib.h" -#include "asn1_mac.h" +#include +#include -/* - * ASN1err(ASN1_F_D2I_X509_ALGOR,ASN1_R_LENGTH_MISMATCH); - * ASN1err(ASN1_F_X509_ALGOR_NEW,ASN1_R_EXPECTING_A_SEQUENCE); - * ASN1err(ASN1_F_D2I_X509_ALGOR,ASN1_R_LENGTH_MISMATCH); - */ - -int i2d_X509_ALGOR(a,pp) -X509_ALGOR *a; -unsigned char **pp; +int i2d_X509_ALGOR(X509_ALGOR *a, unsigned char **pp) { M_ASN1_I2D_vars(a); @@ -84,10 +77,7 @@ unsigned char **pp; M_ASN1_I2D_finish(); } -X509_ALGOR *d2i_X509_ALGOR(a,pp,length) -X509_ALGOR **a; -unsigned char **pp; -long length; +X509_ALGOR *d2i_X509_ALGOR(X509_ALGOR **a, unsigned char **pp, long length) { M_ASN1_D2I_vars(a,X509_ALGOR *,X509_ALGOR_new); @@ -104,19 +94,19 @@ long length; M_ASN1_D2I_Finish(a,X509_ALGOR_free,ASN1_F_D2I_X509_ALGOR); } -X509_ALGOR *X509_ALGOR_new() +X509_ALGOR *X509_ALGOR_new(void) { X509_ALGOR *ret=NULL; + ASN1_CTX c; M_ASN1_New_Malloc(ret,X509_ALGOR); - M_ASN1_New(ret->algorithm,ASN1_OBJECT_new); + ret->algorithm=OBJ_nid2obj(NID_undef); ret->parameter=NULL; return(ret); M_ASN1_New_Error(ASN1_F_X509_ALGOR_NEW); } -void X509_ALGOR_free(a) -X509_ALGOR *a; +void X509_ALGOR_free(X509_ALGOR *a) { if (a == NULL) return; ASN1_OBJECT_free(a->algorithm); @@ -124,3 +114,5 @@ X509_ALGOR *a; Free((char *)a); } +IMPLEMENT_STACK_OF(X509_ALGOR) +IMPLEMENT_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 @@ #include #include "cryptlib.h" -#include "objects.h" -#include "asn1_mac.h" - -/* - * ASN1err(ASN1_F_D2I_X509_ATTRIBUTE,ASN1_R_LENGTH_MISMATCH); - * ASN1err(ASN1_F_X509_ATTRIBUTE_NEW,ASN1_R_UNKNOWN_ATTRIBUTE_TYPE); - * ASN1err(ASN1_F_I2D_X509_ATTRIBUTE,ASN1_R_UNKNOWN_ATTRIBUTE_TYPE); - */ +#include +#include +#include /* sequence */ -int i2d_X509_ATTRIBUTE(a,pp) -X509_ATTRIBUTE *a; -unsigned char **pp; +int i2d_X509_ATTRIBUTE(X509_ATTRIBUTE *a, unsigned char **pp) { int k=0; int r=0,ret=0; @@ -92,18 +85,16 @@ unsigned char **pp; ret+=i2d_ASN1_OBJECT(a->object,p); if (a->set) - ret+=i2d_ASN1_SET(a->value.set,p,i2d_ASN1_TYPE, - V_ASN1_SET,V_ASN1_UNIVERSAL); + ret+=i2d_ASN1_SET_OF_ASN1_TYPE(a->value.set,p,i2d_ASN1_TYPE, + V_ASN1_SET,V_ASN1_UNIVERSAL,IS_SET); else ret+=i2d_ASN1_TYPE(a->value.single,p); if (k++) return(r); } } -X509_ATTRIBUTE *d2i_X509_ATTRIBUTE(a,pp,length) -X509_ATTRIBUTE **a; -unsigned char **pp; -long length; +X509_ATTRIBUTE *d2i_X509_ATTRIBUTE(X509_ATTRIBUTE **a, unsigned char **pp, + long length) { M_ASN1_D2I_vars(a,X509_ATTRIBUTE *,X509_ATTRIBUTE_new); @@ -115,7 +106,8 @@ long length; (M_ASN1_next == (V_ASN1_CONSTRUCTED|V_ASN1_UNIVERSAL|V_ASN1_SET))) { ret->set=1; - M_ASN1_D2I_get_set(ret->value.set,d2i_ASN1_TYPE); + M_ASN1_D2I_get_set_type(ASN1_TYPE,ret->value.set,d2i_ASN1_TYPE, + ASN1_TYPE_free); } else { @@ -126,25 +118,46 @@ long length; M_ASN1_D2I_Finish(a,X509_ATTRIBUTE_free,ASN1_F_D2I_X509_ATTRIBUTE); } -X509_ATTRIBUTE *X509_ATTRIBUTE_new() +X509_ATTRIBUTE *X509_ATTRIBUTE_create(int nid, int atrtype, void *value) + { + X509_ATTRIBUTE *ret=NULL; + ASN1_TYPE *val=NULL; + + if ((ret=X509_ATTRIBUTE_new()) == NULL) + return(NULL); + ret->object=OBJ_nid2obj(nid); + ret->set=1; + if ((ret->value.set=sk_ASN1_TYPE_new_null()) == NULL) goto err; + if ((val=ASN1_TYPE_new()) == NULL) goto err; + if (!sk_ASN1_TYPE_push(ret->value.set,val)) goto err; + + ASN1_TYPE_set(val,atrtype,value); + return(ret); +err: + if (ret != NULL) X509_ATTRIBUTE_free(ret); + if (val != NULL) ASN1_TYPE_free(val); + return(NULL); + } + +X509_ATTRIBUTE *X509_ATTRIBUTE_new(void) { X509_ATTRIBUTE *ret=NULL; + ASN1_CTX c; M_ASN1_New_Malloc(ret,X509_ATTRIBUTE); - M_ASN1_New(ret->object,ASN1_OBJECT_new); + ret->object=OBJ_nid2obj(NID_undef); ret->set=0; ret->value.ptr=NULL; return(ret); M_ASN1_New_Error(ASN1_F_X509_ATTRIBUTE_NEW); } -void X509_ATTRIBUTE_free(a) -X509_ATTRIBUTE *a; +void X509_ATTRIBUTE_free(X509_ATTRIBUTE *a) { if (a == NULL) return; ASN1_OBJECT_free(a->object); if (a->set) - sk_pop_free(a->value.set,ASN1_TYPE_free); + sk_ASN1_TYPE_pop_free(a->value.set,ASN1_TYPE_free); else ASN1_TYPE_free(a->value.single); 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 @@ #include #include "cryptlib.h" -#include "asn1_mac.h" +#include +#include -/* - * ASN1err(ASN1_F_D2I_X509_CINF,ASN1_R_LENGTH_MISMATCH); - * ASN1err(ASN1_F_X509_CINF_NEW,ASN1_R_LENGTH_MISMATCH); - */ - -int i2d_X509_CINF(a,pp) -X509_CINF *a; -unsigned char **pp; +int i2d_X509_CINF(X509_CINF *a, unsigned char **pp) { int v1=0,v2=0; M_ASN1_I2D_vars(a); @@ -81,7 +75,9 @@ unsigned char **pp; M_ASN1_I2D_len(a->key, i2d_X509_PUBKEY); M_ASN1_I2D_len_IMP_opt(a->issuerUID, i2d_ASN1_BIT_STRING); M_ASN1_I2D_len_IMP_opt(a->subjectUID, i2d_ASN1_BIT_STRING); - M_ASN1_I2D_len_EXP_set_opt(a->extensions,i2d_X509_EXTENSION,3,V_ASN1_SEQUENCE,v2); + M_ASN1_I2D_len_EXP_SEQUENCE_opt_type(X509_EXTENSION,a->extensions, + i2d_X509_EXTENSION,3, + V_ASN1_SEQUENCE,v2); M_ASN1_I2D_seq_total(); @@ -94,15 +90,14 @@ unsigned char **pp; M_ASN1_I2D_put(a->key, i2d_X509_PUBKEY); M_ASN1_I2D_put_IMP_opt(a->issuerUID, i2d_ASN1_BIT_STRING,1); M_ASN1_I2D_put_IMP_opt(a->subjectUID, i2d_ASN1_BIT_STRING,2); - M_ASN1_I2D_put_EXP_set_opt(a->extensions,i2d_X509_EXTENSION,3,V_ASN1_SEQUENCE,v2); + M_ASN1_I2D_put_EXP_SEQUENCE_opt_type(X509_EXTENSION,a->extensions, + i2d_X509_EXTENSION,3, + V_ASN1_SEQUENCE,v2); M_ASN1_I2D_finish(); } -X509_CINF *d2i_X509_CINF(a,pp,length) -X509_CINF **a; -unsigned char **pp; -long length; +X509_CINF *d2i_X509_CINF(X509_CINF **a, unsigned char **pp, long length) { int ver=0; M_ASN1_D2I_vars(a,X509_CINF *,X509_CINF_new); @@ -140,28 +135,38 @@ long length; if (ret->subjectUID != NULL) { ASN1_BIT_STRING_free(ret->subjectUID); - ret->issuerUID=NULL; + ret->subjectUID=NULL; } M_ASN1_D2I_get_IMP_opt(ret->issuerUID,d2i_ASN1_BIT_STRING, 1, V_ASN1_BIT_STRING); M_ASN1_D2I_get_IMP_opt(ret->subjectUID,d2i_ASN1_BIT_STRING, 2, V_ASN1_BIT_STRING); } +/* Note: some broken certificates include extensions but don't set + * the version number properly. By bypassing this check they can + * be parsed. + */ + +#ifdef VERSION_EXT_CHECK if (ver >= 2) /* version 3 extensions */ +#endif { if (ret->extensions != NULL) - while (sk_num(ret->extensions)) - X509_EXTENSION_free((X509_EXTENSION *) - sk_pop(ret->extensions)); - M_ASN1_D2I_get_EXP_set_opt(ret->extensions,d2i_X509_EXTENSION,3, - V_ASN1_SEQUENCE); + while (sk_X509_EXTENSION_num(ret->extensions)) + X509_EXTENSION_free( + sk_X509_EXTENSION_pop(ret->extensions)); + M_ASN1_D2I_get_EXP_set_opt_type(X509_EXTENSION,ret->extensions, + d2i_X509_EXTENSION, + X509_EXTENSION_free,3, + V_ASN1_SEQUENCE); } M_ASN1_D2I_Finish(a,X509_CINF_free,ASN1_F_D2I_X509_CINF); } -X509_CINF *X509_CINF_new() +X509_CINF *X509_CINF_new(void) { X509_CINF *ret=NULL; + ASN1_CTX c; M_ASN1_New_Malloc(ret,X509_CINF); ret->version=NULL; @@ -178,8 +183,7 @@ X509_CINF *X509_CINF_new() M_ASN1_New_Error(ASN1_F_X509_CINF_NEW); } -void X509_CINF_free(a) -X509_CINF *a; +void X509_CINF_free(X509_CINF *a) { if (a == NULL) return; ASN1_INTEGER_free(a->version); @@ -191,7 +195,7 @@ X509_CINF *a; X509_PUBKEY_free(a->key); ASN1_BIT_STRING_free(a->issuerUID); ASN1_BIT_STRING_free(a->subjectUID); - sk_pop_free(a->extensions,X509_EXTENSION_free); - Free((char *)a); + sk_X509_EXTENSION_pop_free(a->extensions,X509_EXTENSION_free); + Free(a); } 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 @@ #include #include "cryptlib.h" -#include "asn1_mac.h" -#include "x509.h" - -/* - * ASN1err(ASN1_F_D2I_X509_CRL,ASN1_R_LENGTH_MISMATCH); - * ASN1err(ASN1_F_D2I_X509_CRL_INFO,ASN1_R_EXPECTING_A_SEQUENCE); - * ASN1err(ASN1_F_D2I_X509_REVOKED,ASN1_R_LENGTH_MISMATCH); - * ASN1err(ASN1_F_X509_CRL_NEW,ASN1_R_LENGTH_MISMATCH); - * ASN1err(ASN1_F_X509_CRL_INFO_NEW,ASN1_R_EXPECTING_A_SEQUENCE); - * ASN1err(ASN1_F_X509_REVOKED_NEW,ASN1_R_LENGTH_MISMATCH); - */ +#include +#include -#ifndef NOPROTO static int X509_REVOKED_cmp(X509_REVOKED **a,X509_REVOKED **b); static int X509_REVOKED_seq_cmp(X509_REVOKED **a,X509_REVOKED **b); -#else -static int X509_REVOKED_cmp(); -static int X509_REVOKED_seq_cmp(); -#endif - -int i2d_X509_REVOKED(a,pp) -X509_REVOKED *a; -unsigned char **pp; +int i2d_X509_REVOKED(X509_REVOKED *a, unsigned char **pp) { M_ASN1_I2D_vars(a); M_ASN1_I2D_len(a->serialNumber,i2d_ASN1_INTEGER); - M_ASN1_I2D_len(a->revocationDate,i2d_ASN1_UTCTIME); - M_ASN1_I2D_len_SEQ_opt(a->extensions,i2d_X509_EXTENSION); + M_ASN1_I2D_len(a->revocationDate,i2d_ASN1_TIME); + M_ASN1_I2D_len_SEQUENCE_opt_type(X509_EXTENSION,a->extensions, + i2d_X509_EXTENSION); M_ASN1_I2D_seq_total(); M_ASN1_I2D_put(a->serialNumber,i2d_ASN1_INTEGER); - M_ASN1_I2D_put(a->revocationDate,i2d_ASN1_UTCTIME); - M_ASN1_I2D_put_SEQ_opt(a->extensions,i2d_X509_EXTENSION); + M_ASN1_I2D_put(a->revocationDate,i2d_ASN1_TIME); + M_ASN1_I2D_put_SEQUENCE_opt_type(X509_EXTENSION,a->extensions, + i2d_X509_EXTENSION); M_ASN1_I2D_finish(); } -X509_REVOKED *d2i_X509_REVOKED(a,pp,length) -X509_REVOKED **a; -unsigned char **pp; -long length; +X509_REVOKED *d2i_X509_REVOKED(X509_REVOKED **a, unsigned char **pp, + long length) { M_ASN1_D2I_vars(a,X509_REVOKED *,X509_REVOKED_new); M_ASN1_D2I_Init(); M_ASN1_D2I_start_sequence(); M_ASN1_D2I_get(ret->serialNumber,d2i_ASN1_INTEGER); - M_ASN1_D2I_get(ret->revocationDate,d2i_ASN1_UTCTIME); - M_ASN1_D2I_get_seq_opt(ret->extensions,d2i_X509_EXTENSION); + M_ASN1_D2I_get(ret->revocationDate,d2i_ASN1_TIME); + M_ASN1_D2I_get_seq_opt_type(X509_EXTENSION,ret->extensions, + d2i_X509_EXTENSION,X509_EXTENSION_free); M_ASN1_D2I_Finish(a,X509_REVOKED_free,ASN1_F_D2I_X509_REVOKED); } -int i2d_X509_CRL_INFO(a,pp) -X509_CRL_INFO *a; -unsigned char **pp; +int i2d_X509_CRL_INFO(X509_CRL_INFO *a, unsigned char **pp) { int v1=0; long l=0; + int (*old_cmp)(X509_REVOKED **,X509_REVOKED **); M_ASN1_I2D_vars(a); + + old_cmp=sk_X509_REVOKED_set_cmp_func(a->revoked,X509_REVOKED_seq_cmp); + sk_X509_REVOKED_sort(a->revoked); + sk_X509_REVOKED_set_cmp_func(a->revoked,old_cmp); - if (sk_num(a->revoked) != 0) - qsort((char *)a->revoked->data,sk_num(a->revoked), - sizeof(X509_REVOKED *),(int (*)(P_CC_CC))X509_REVOKED_seq_cmp); if ((a->version != NULL) && ((l=ASN1_INTEGER_get(a->version)) != 0)) { M_ASN1_I2D_len(a->version,i2d_ASN1_INTEGER); } M_ASN1_I2D_len(a->sig_alg,i2d_X509_ALGOR); M_ASN1_I2D_len(a->issuer,i2d_X509_NAME); - M_ASN1_I2D_len(a->lastUpdate,i2d_ASN1_UTCTIME); + M_ASN1_I2D_len(a->lastUpdate,i2d_ASN1_TIME); if (a->nextUpdate != NULL) - { M_ASN1_I2D_len(a->nextUpdate,i2d_ASN1_UTCTIME); } - M_ASN1_I2D_len_SEQ_opt(a->revoked,i2d_X509_REVOKED); - M_ASN1_I2D_len_EXP_set_opt(a->extensions,i2d_X509_EXTENSION,0, - V_ASN1_SEQUENCE,v1); + { M_ASN1_I2D_len(a->nextUpdate,i2d_ASN1_TIME); } + M_ASN1_I2D_len_SEQUENCE_opt_type(X509_REVOKED,a->revoked, + i2d_X509_REVOKED); + M_ASN1_I2D_len_EXP_SEQUENCE_opt_type(X509_EXTENSION,a->extensions, + i2d_X509_EXTENSION,0, + V_ASN1_SEQUENCE,v1); M_ASN1_I2D_seq_total(); @@ -147,17 +133,17 @@ unsigned char **pp; M_ASN1_I2D_put(a->lastUpdate,i2d_ASN1_UTCTIME); if (a->nextUpdate != NULL) { M_ASN1_I2D_put(a->nextUpdate,i2d_ASN1_UTCTIME); } - M_ASN1_I2D_put_SEQ_opt(a->revoked,i2d_X509_REVOKED); - M_ASN1_I2D_put_EXP_set_opt(a->extensions,i2d_X509_EXTENSION,0, - V_ASN1_SEQUENCE,v1); + M_ASN1_I2D_put_SEQUENCE_opt_type(X509_REVOKED,a->revoked, + i2d_X509_REVOKED); + M_ASN1_I2D_put_EXP_SEQUENCE_opt_type(X509_EXTENSION,a->extensions, + i2d_X509_EXTENSION,0, + V_ASN1_SEQUENCE,v1); M_ASN1_I2D_finish(); } -X509_CRL_INFO *d2i_X509_CRL_INFO(a,pp,length) -X509_CRL_INFO **a; -unsigned char **pp; -long length; +X509_CRL_INFO *d2i_X509_CRL_INFO(X509_CRL_INFO **a, unsigned char **pp, + long length) { int i,ver=0; M_ASN1_D2I_vars(a,X509_CRL_INFO *,X509_CRL_INFO_new); @@ -176,20 +162,31 @@ long length; } M_ASN1_D2I_get(ret->sig_alg,d2i_X509_ALGOR); M_ASN1_D2I_get(ret->issuer,d2i_X509_NAME); - M_ASN1_D2I_get(ret->lastUpdate,d2i_ASN1_UTCTIME); - M_ASN1_D2I_get_opt(ret->nextUpdate,d2i_ASN1_UTCTIME,V_ASN1_UTCTIME); + M_ASN1_D2I_get(ret->lastUpdate,d2i_ASN1_TIME); + /* Manually handle the OPTIONAL ASN1_TIME stuff */ + if(c.slen != 0 + && ( (M_ASN1_next & ~V_ASN1_CONSTRUCTED) == + (V_ASN1_UNIVERSAL|V_ASN1_UTCTIME) + || (M_ASN1_next & ~V_ASN1_CONSTRUCTED) == + (V_ASN1_UNIVERSAL|V_ASN1_GENERALIZEDTIME) ) ) { + M_ASN1_D2I_get(ret->nextUpdate,d2i_ASN1_TIME); + } + if(!ret->nextUpdate) + M_ASN1_D2I_get_opt(ret->nextUpdate,d2i_ASN1_GENERALIZEDTIME, + V_ASN1_GENERALIZEDTIME); if (ret->revoked != NULL) { - while (sk_num(ret->revoked)) - X509_REVOKED_free((X509_REVOKED *)sk_pop(ret->revoked)); + while (sk_X509_REVOKED_num(ret->revoked)) + X509_REVOKED_free(sk_X509_REVOKED_pop(ret->revoked)); } - M_ASN1_D2I_get_seq_opt(ret->revoked,d2i_X509_REVOKED); + M_ASN1_D2I_get_seq_opt_type(X509_REVOKED,ret->revoked,d2i_X509_REVOKED, + X509_REVOKED_free); if (ret->revoked != NULL) { - for (i=0; irevoked); i++) + for (i=0; irevoked); i++) { - ((X509_REVOKED *)sk_value(ret->revoked,i))->sequence=i; + sk_X509_REVOKED_value(ret->revoked,i)->sequence=i; } } @@ -197,21 +194,21 @@ long length; { if (ret->extensions != NULL) { - while (sk_num(ret->extensions)) - X509_EXTENSION_free((X509_EXTENSION *) - sk_pop(ret->extensions)); + while (sk_X509_EXTENSION_num(ret->extensions)) + X509_EXTENSION_free( + sk_X509_EXTENSION_pop(ret->extensions)); } - M_ASN1_D2I_get_EXP_set_opt(ret->extensions,d2i_X509_EXTENSION, - 0,V_ASN1_SEQUENCE); + M_ASN1_D2I_get_EXP_set_opt_type(X509_EXTENSION,ret->extensions, + d2i_X509_EXTENSION, + X509_EXTENSION_free,0, + V_ASN1_SEQUENCE); } M_ASN1_D2I_Finish(a,X509_CRL_INFO_free,ASN1_F_D2I_X509_CRL_INFO); } -int i2d_X509_CRL(a,pp) -X509_CRL *a; -unsigned char **pp; +int i2d_X509_CRL(X509_CRL *a, unsigned char **pp) { M_ASN1_I2D_vars(a); @@ -228,10 +225,7 @@ unsigned char **pp; M_ASN1_I2D_finish(); } -X509_CRL *d2i_X509_CRL(a,pp,length) -X509_CRL **a; -unsigned char **pp; -long length; +X509_CRL *d2i_X509_CRL(X509_CRL **a, unsigned char **pp, long length) { M_ASN1_D2I_vars(a,X509_CRL *,X509_CRL_new); @@ -245,9 +239,10 @@ long length; } -X509_REVOKED *X509_REVOKED_new() +X509_REVOKED *X509_REVOKED_new(void) { X509_REVOKED *ret=NULL; + ASN1_CTX c; M_ASN1_New_Malloc(ret,X509_REVOKED); M_ASN1_New(ret->serialNumber,ASN1_INTEGER_new); @@ -257,9 +252,10 @@ X509_REVOKED *X509_REVOKED_new() M_ASN1_New_Error(ASN1_F_X509_REVOKED_NEW); } -X509_CRL_INFO *X509_CRL_INFO_new() +X509_CRL_INFO *X509_CRL_INFO_new(void) { X509_CRL_INFO *ret=NULL; + ASN1_CTX c; M_ASN1_New_Malloc(ret,X509_CRL_INFO); ret->version=NULL; @@ -267,16 +263,17 @@ X509_CRL_INFO *X509_CRL_INFO_new() M_ASN1_New(ret->issuer,X509_NAME_new); M_ASN1_New(ret->lastUpdate,ASN1_UTCTIME_new); ret->nextUpdate=NULL; - M_ASN1_New(ret->revoked,sk_new_null); - M_ASN1_New(ret->extensions,sk_new_null); - ret->revoked->comp=(int (*)())X509_REVOKED_cmp; + M_ASN1_New(ret->revoked,sk_X509_REVOKED_new_null); + M_ASN1_New(ret->extensions,sk_X509_EXTENSION_new_null); + sk_X509_REVOKED_set_cmp_func(ret->revoked,X509_REVOKED_cmp); return(ret); M_ASN1_New_Error(ASN1_F_X509_CRL_INFO_NEW); } -X509_CRL *X509_CRL_new() +X509_CRL *X509_CRL_new(void) { X509_CRL *ret=NULL; + ASN1_CTX c; M_ASN1_New_Malloc(ret,X509_CRL); ret->references=1; @@ -287,18 +284,16 @@ X509_CRL *X509_CRL_new() M_ASN1_New_Error(ASN1_F_X509_CRL_NEW); } -void X509_REVOKED_free(a) -X509_REVOKED *a; +void X509_REVOKED_free(X509_REVOKED *a) { if (a == NULL) return; ASN1_INTEGER_free(a->serialNumber); ASN1_UTCTIME_free(a->revocationDate); - sk_pop_free(a->extensions,X509_EXTENSION_free); - Free((char *)a); + sk_X509_EXTENSION_pop_free(a->extensions,X509_EXTENSION_free); + Free(a); } -void X509_CRL_INFO_free(a) -X509_CRL_INFO *a; +void X509_CRL_INFO_free(X509_CRL_INFO *a) { if (a == NULL) return; ASN1_INTEGER_free(a->version); @@ -307,13 +302,12 @@ X509_CRL_INFO *a; ASN1_UTCTIME_free(a->lastUpdate); if (a->nextUpdate) ASN1_UTCTIME_free(a->nextUpdate); - sk_pop_free(a->revoked,X509_REVOKED_free); - sk_pop_free(a->extensions,X509_EXTENSION_free); - Free((char *)a); + sk_X509_REVOKED_pop_free(a->revoked,X509_REVOKED_free); + sk_X509_EXTENSION_pop_free(a->extensions,X509_EXTENSION_free); + Free(a); } -void X509_CRL_free(a) -X509_CRL *a; +void X509_CRL_free(X509_CRL *a) { int i; @@ -335,19 +329,22 @@ X509_CRL *a; X509_CRL_INFO_free(a->crl); X509_ALGOR_free(a->sig_alg); ASN1_BIT_STRING_free(a->signature); - Free((char *)a); + Free(a); } -static int X509_REVOKED_cmp(a,b) -X509_REVOKED **a,**b; +static int X509_REVOKED_cmp(X509_REVOKED **a, X509_REVOKED **b) { return(ASN1_STRING_cmp( (ASN1_STRING *)(*a)->serialNumber, (ASN1_STRING *)(*b)->serialNumber)); } -static int X509_REVOKED_seq_cmp(a,b) -X509_REVOKED **a,**b; +static int X509_REVOKED_seq_cmp(X509_REVOKED **a, X509_REVOKED **b) { return((*a)->sequence-(*b)->sequence); } + +IMPLEMENT_STACK_OF(X509_REVOKED) +IMPLEMENT_ASN1_SET_OF(X509_REVOKED) +IMPLEMENT_STACK_OF(X509_CRL) +IMPLEMENT_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 @@ #include #include "cryptlib.h" -#include "objects.h" -#include "asn1_mac.h" +#include +#include +#include -/* - * ASN1err(ASN1_F_D2I_X509_EXTENSION,ASN1_R_LENGTH_MISMATCH); - * ASN1err(ASN1_F_X509_EXTENSION_NEW,ASN1_R_LENGTH_MISMATCH); - */ - -int i2d_X509_EXTENSION(a,pp) -X509_EXTENSION *a; -unsigned char **pp; +int i2d_X509_EXTENSION(X509_EXTENSION *a, unsigned char **pp) { int k=0; int r=0,ret=0; @@ -96,10 +90,8 @@ unsigned char **pp; } } -X509_EXTENSION *d2i_X509_EXTENSION(a,pp,length) -X509_EXTENSION **a; -unsigned char **pp; -long length; +X509_EXTENSION *d2i_X509_EXTENSION(X509_EXTENSION **a, unsigned char **pp, + long length) { int i; M_ASN1_D2I_vars(a,X509_EXTENSION *,X509_EXTENSION_new); @@ -127,12 +119,13 @@ long length; M_ASN1_D2I_Finish(a,X509_EXTENSION_free,ASN1_F_D2I_X509_EXTENSION); } -X509_EXTENSION *X509_EXTENSION_new() +X509_EXTENSION *X509_EXTENSION_new(void) { X509_EXTENSION *ret=NULL; + ASN1_CTX c; M_ASN1_New_Malloc(ret,X509_EXTENSION); - M_ASN1_New(ret->object,ASN1_OBJECT_new); + ret->object=OBJ_nid2obj(NID_undef); M_ASN1_New(ret->value,ASN1_OCTET_STRING_new); ret->critical=0; ret->netscape_hack=0; @@ -143,8 +136,7 @@ X509_EXTENSION *X509_EXTENSION_new() M_ASN1_New_Error(ASN1_F_X509_EXTENSION_NEW); } -void X509_EXTENSION_free(a) -X509_EXTENSION *a; +void X509_EXTENSION_free(X509_EXTENSION *a) { if (a == NULL) return; 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 @@ #include #include "cryptlib.h" -#include "evp.h" -#include "asn1_mac.h" -#include "x509.h" +#include +#include +#include -X509_INFO *X509_INFO_new() +X509_INFO *X509_INFO_new(void) { X509_INFO *ret=NULL; @@ -84,8 +84,7 @@ X509_INFO *X509_INFO_new() return(ret); } -void X509_INFO_free(x) -X509_INFO *x; +void X509_INFO_free(X509_INFO *x) { int i; @@ -109,3 +108,6 @@ X509_INFO *x; if (x->x_pkey != NULL) X509_PKEY_free(x->x_pkey); Free((char *)x); } + +IMPLEMENT_STACK_OF(X509_INFO) + 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 @@ #include #include "cryptlib.h" -#include "objects.h" -#include "asn1_mac.h" - -/* - * ASN1err(ASN1_F_D2I_X509_NAME,ASN1_R_LENGTH_MISMATCH); - * ASN1err(ASN1_F_X509_NAME_NEW,ASN1_R_UNKNOWN_ATTRIBUTE_TYPE); - * ASN1err(ASN1_F_D2I_X509_NAME_ENTRY,ASN1_R_LENGTH_MISMATCH); - * ASN1err(ASN1_F_X509_NAME_ENTRY_NEW,ASN1_R_UNKNOWN_ATTRIBUTE_TYPE); - */ +#include +#include +#include -#ifndef NOPROTO static int i2d_X509_NAME_entries(X509_NAME *a); -#else -static int i2d_X509_NAME_entries(); -#endif - -int i2d_X509_NAME_ENTRY(a,pp) -X509_NAME_ENTRY *a; -unsigned char **pp; +int i2d_X509_NAME_ENTRY(X509_NAME_ENTRY *a, unsigned char **pp) { M_ASN1_I2D_vars(a); @@ -91,10 +78,8 @@ unsigned char **pp; M_ASN1_I2D_finish(); } -X509_NAME_ENTRY *d2i_X509_NAME_ENTRY(a,pp,length) -X509_NAME_ENTRY **a; -unsigned char **pp; -long length; +X509_NAME_ENTRY *d2i_X509_NAME_ENTRY(X509_NAME_ENTRY **a, unsigned char **pp, + long length) { M_ASN1_D2I_vars(a,X509_NAME_ENTRY *,X509_NAME_ENTRY_new); @@ -106,9 +91,7 @@ long length; M_ASN1_D2I_Finish(a,X509_NAME_ENTRY_free,ASN1_F_D2I_X509_NAME_ENTRY); } -int i2d_X509_NAME(a,pp) -X509_NAME *a; -unsigned char **pp; +int i2d_X509_NAME(X509_NAME *a, unsigned char **pp) { int ret; @@ -128,11 +111,10 @@ unsigned char **pp; return(ret); } -static int i2d_X509_NAME_entries(a) -X509_NAME *a; +static int i2d_X509_NAME_entries(X509_NAME *a) { X509_NAME_ENTRY *ne,*fe=NULL; - STACK *sk; + STACK_OF(X509_NAME_ENTRY) *sk; BUF_MEM *buf=NULL; int set=0,r,ret=0; int i; @@ -140,9 +122,9 @@ X509_NAME *a; int size=0; sk=a->entries; - for (i=0; iset) { set=ne->set; @@ -190,10 +172,7 @@ err: return(-1); } -X509_NAME *d2i_X509_NAME(a,pp,length) -X509_NAME **a; -unsigned char **pp; -long length; +X509_NAME *d2i_X509_NAME(X509_NAME **a, unsigned char **pp, long length) { int set=0,i; int idx=0; @@ -201,11 +180,11 @@ long length; M_ASN1_D2I_vars(a,X509_NAME *,X509_NAME_new); orig= *pp; - if (sk_num(ret->entries) > 0) + if (sk_X509_NAME_ENTRY_num(ret->entries) > 0) { - while (sk_num(ret->entries) > 0) - X509_NAME_ENTRY_free((X509_NAME_ENTRY *) - sk_pop(ret->entries)); + while (sk_X509_NAME_ENTRY_num(ret->entries) > 0) + X509_NAME_ENTRY_free( + sk_X509_NAME_ENTRY_pop(ret->entries)); } M_ASN1_D2I_Init(); @@ -213,11 +192,12 @@ long length; for (;;) { if (M_ASN1_D2I_end_sequence()) break; - M_ASN1_D2I_get_set(ret->entries,d2i_X509_NAME_ENTRY); - for (; idx < sk_num(ret->entries); idx++) + M_ASN1_D2I_get_set_type(X509_NAME_ENTRY,ret->entries, + d2i_X509_NAME_ENTRY, + X509_NAME_ENTRY_free); + for (; idx < sk_X509_NAME_ENTRY_num(ret->entries); idx++) { - ((X509_NAME_ENTRY *)sk_value(ret->entries,idx))->set= - set; + sk_X509_NAME_ENTRY_value(ret->entries,idx)->set=set; } set++; } @@ -231,21 +211,24 @@ long length; M_ASN1_D2I_Finish(a,X509_NAME_free,ASN1_F_D2I_X509_NAME); } -X509_NAME *X509_NAME_new() +X509_NAME *X509_NAME_new(void) { X509_NAME *ret=NULL; + ASN1_CTX c; M_ASN1_New_Malloc(ret,X509_NAME); - if ((ret->entries=sk_new(NULL)) == NULL) goto err2; + if ((ret->entries=sk_X509_NAME_ENTRY_new(NULL)) == NULL) + { c.line=__LINE__; goto err2; } M_ASN1_New(ret->bytes,BUF_MEM_new); ret->modified=1; return(ret); M_ASN1_New_Error(ASN1_F_X509_NAME_NEW); } -X509_NAME_ENTRY *X509_NAME_ENTRY_new() +X509_NAME_ENTRY *X509_NAME_ENTRY_new(void) { X509_NAME_ENTRY *ret=NULL; + ASN1_CTX c; M_ASN1_New_Malloc(ret,X509_NAME_ENTRY); /* M_ASN1_New(ret->object,ASN1_OBJECT_new);*/ @@ -256,26 +239,25 @@ X509_NAME_ENTRY *X509_NAME_ENTRY_new() M_ASN1_New_Error(ASN1_F_X509_NAME_ENTRY_NEW); } -void X509_NAME_free(a) -X509_NAME *a; +void X509_NAME_free(X509_NAME *a) { + if(a == NULL) + return; + BUF_MEM_free(a->bytes); - sk_pop_free(a->entries,X509_NAME_ENTRY_free); - Free((char *)a); + sk_X509_NAME_ENTRY_pop_free(a->entries,X509_NAME_ENTRY_free); + Free(a); } -void X509_NAME_ENTRY_free(a) -X509_NAME_ENTRY *a; +void X509_NAME_ENTRY_free(X509_NAME_ENTRY *a) { if (a == NULL) return; ASN1_OBJECT_free(a->object); ASN1_BIT_STRING_free(a->value); - Free((char *)a); + Free(a); } -int X509_NAME_set(xn,name) -X509_NAME **xn; -X509_NAME *name; +int X509_NAME_set(X509_NAME **xn, X509_NAME *name) { X509_NAME *in; @@ -293,3 +275,5 @@ X509_NAME *name; return(*xn != NULL); } +IMPLEMENT_STACK_OF(X509_NAME_ENTRY) +IMPLEMENT_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 @@ #include #include "cryptlib.h" -#include "evp.h" -#include "objects.h" -#include "asn1_mac.h" - -/* ASN1err(ASN1_F_D2I_X509_PKEY,ASN1_R_UNSUPPORTED_CIPHER); */ -/* ASN1err(ASN1_F_X509_PKEY_NEW,ASN1_R_IV_TOO_LARGE); */ +#include +#include +#include +#include /* need to implement */ -int i2d_X509_PKEY(a,pp) -X509_PKEY *a; -unsigned char **pp; +int i2d_X509_PKEY(X509_PKEY *a, unsigned char **pp) { return(0); } -X509_PKEY *d2i_X509_PKEY(a,pp,length) -X509_PKEY **a; -unsigned char **pp; -long length; +X509_PKEY *d2i_X509_PKEY(X509_PKEY **a, unsigned char **pp, long length) { int i; M_ASN1_D2I_vars(a,X509_PKEY *,X509_PKEY_new); @@ -91,6 +84,7 @@ long length; if (ret->cipher.cipher == NULL) { c.error=ASN1_R_UNSUPPORTED_CIPHER; + c.line=__LINE__; goto err; } if (ret->enc_algor->parameter->type == V_ASN1_OCTET_STRING) @@ -99,6 +93,7 @@ long length; if (i > EVP_MAX_IV_LENGTH) { c.error=ASN1_R_IV_TOO_LARGE; + c.line=__LINE__; goto err; } memcpy(ret->cipher.iv, @@ -109,9 +104,10 @@ long length; M_ASN1_D2I_Finish(a,X509_PKEY_free,ASN1_F_D2I_X509_PKEY); } -X509_PKEY *X509_PKEY_new() +X509_PKEY *X509_PKEY_new(void) { X509_PKEY *ret=NULL; + ASN1_CTX c; M_ASN1_New_Malloc(ret,X509_PKEY); ret->version=0; @@ -128,8 +124,7 @@ X509_PKEY *X509_PKEY_new() M_ASN1_New_Error(ASN1_F_X509_PKEY_NEW); } -void X509_PKEY_free(x) -X509_PKEY *x; +void X509_PKEY_free(X509_PKEY *x) { int i; 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 @@ #include #include "cryptlib.h" -#include "asn1_mac.h" +#include +#include -/* - * ASN1err(ASN1_F_D2I_X509_PUBKEY,ASN1_R_LENGTH_MISMATCH); - * ASN1err(ASN1_F_X509_PUBKEY_NEW,ASN1_R_LENGTH_MISMATCH); - */ - -int i2d_X509_PUBKEY(a,pp) -X509_PUBKEY *a; -unsigned char **pp; +int i2d_X509_PUBKEY(X509_PUBKEY *a, unsigned char **pp) { M_ASN1_I2D_vars(a); @@ -82,10 +76,8 @@ unsigned char **pp; M_ASN1_I2D_finish(); } -X509_PUBKEY *d2i_X509_PUBKEY(a,pp,length) -X509_PUBKEY **a; -unsigned char **pp; -long length; +X509_PUBKEY *d2i_X509_PUBKEY(X509_PUBKEY **a, unsigned char **pp, + long length) { M_ASN1_D2I_vars(a,X509_PUBKEY *,X509_PUBKEY_new); @@ -101,9 +93,10 @@ long length; M_ASN1_D2I_Finish(a,X509_PUBKEY_free,ASN1_F_D2I_X509_PUBKEY); } -X509_PUBKEY *X509_PUBKEY_new() +X509_PUBKEY *X509_PUBKEY_new(void) { X509_PUBKEY *ret=NULL; + ASN1_CTX c; M_ASN1_New_Malloc(ret,X509_PUBKEY); M_ASN1_New(ret->algor,X509_ALGOR_new); @@ -113,8 +106,7 @@ X509_PUBKEY *X509_PUBKEY_new() M_ASN1_New_Error(ASN1_F_X509_PUBKEY_NEW); } -void X509_PUBKEY_free(a) -X509_PUBKEY *a; +void X509_PUBKEY_free(X509_PUBKEY *a) { if (a == NULL) return; X509_ALGOR_free(a->algor); @@ -123,9 +115,7 @@ X509_PUBKEY *a; Free((char *)a); } -int X509_PUBKEY_set(x,pkey) -X509_PUBKEY **x; -EVP_PKEY *pkey; +int X509_PUBKEY_set(X509_PUBKEY **x, EVP_PKEY *pkey) { int ok=0; X509_PUBKEY *pk; @@ -182,11 +172,15 @@ EVP_PKEY *pkey; goto err; } - i=i2d_PublicKey(pkey,NULL); + if ((i=i2d_PublicKey(pkey,NULL)) <= 0) goto err; if ((s=(unsigned char *)Malloc(i+1)) == NULL) goto err; p=s; i2d_PublicKey(pkey,&p); if (!ASN1_BIT_STRING_set(pk->public_key,s,i)) goto err; + /* Set number of unused bits to zero */ + pk->public_key->flags&= ~(ASN1_STRING_FLAG_BITS_LEFT|0x07); + pk->public_key->flags|=ASN1_STRING_FLAG_BITS_LEFT; + Free(s); CRYPTO_add(&pkey->references,1,CRYPTO_LOCK_EVP_PKEY); @@ -204,8 +198,7 @@ err: return(ok); } -EVP_PKEY *X509_PUBKEY_get(key) -X509_PUBKEY *key; +EVP_PKEY *X509_PUBKEY_get(X509_PUBKEY *key) { EVP_PKEY *ret=NULL; long j; @@ -217,7 +210,11 @@ X509_PUBKEY *key; if (key == NULL) goto err; - if (key->pkey != NULL) return(key->pkey); + if (key->pkey != NULL) + { + CRYPTO_add(&key->pkey->references,1,CRYPTO_LOCK_EVP_PKEY); + return(key->pkey); + } if (key->public_key == NULL) goto err; @@ -247,6 +244,7 @@ X509_PUBKEY *key; } #endif key->pkey=ret; + CRYPTO_add(&ret->references,1,CRYPTO_LOCK_EVP_PKEY); return(ret); err: 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 @@ #include #include "cryptlib.h" -#include "asn1_mac.h" -#include "x509.h" - -/* - * ASN1err(ASN1_F_D2I_X509_REQ,ASN1_R_LENGTH_MISMATCH); - * ASN1err(ASN1_F_D2I_X509_REQ_INFO,ASN1_R_LENGTH_MISMATCH); - * ASN1err(ASN1_F_X509_REQ_NEW,ASN1_R_LENGTH_MISMATCH); - * ASN1err(ASN1_F_X509_REQ_INFO_NEW,ASN1_R_LENGTH_MISMATCH); - */ +#include +#include -int i2d_X509_REQ_INFO(a,pp) -X509_REQ_INFO *a; -unsigned char **pp; +int i2d_X509_REQ_INFO(X509_REQ_INFO *a, unsigned char **pp) { M_ASN1_I2D_vars(a); @@ -87,11 +78,12 @@ unsigned char **pp; */ if (a->req_kludge) { - M_ASN1_I2D_len_IMP_set_opt(a->attributes,i2d_X509_ATTRIBUTE,0); + M_ASN1_I2D_len_IMP_SET_opt_type(X509_ATTRIBUTE,a->attributes,i2d_X509_ATTRIBUTE,0); } else { - M_ASN1_I2D_len_IMP_set(a->attributes, i2d_X509_ATTRIBUTE,0); + M_ASN1_I2D_len_IMP_SET_type(X509_ATTRIBUTE,a->attributes, + i2d_X509_ATTRIBUTE,0); } M_ASN1_I2D_seq_total(); @@ -107,20 +99,20 @@ unsigned char **pp; */ if (a->req_kludge) { - M_ASN1_I2D_put_IMP_set_opt(a->attributes,i2d_X509_ATTRIBUTE,0); + M_ASN1_I2D_put_IMP_SET_opt_type(X509_ATTRIBUTE,a->attributes, + i2d_X509_ATTRIBUTE,0); } else { - M_ASN1_I2D_put_IMP_set(a->attributes,i2d_X509_ATTRIBUTE,0); + M_ASN1_I2D_put_IMP_SET_type(X509_ATTRIBUTE,a->attributes, + i2d_X509_ATTRIBUTE,0); } M_ASN1_I2D_finish(); } -X509_REQ_INFO *d2i_X509_REQ_INFO(a,pp,length) -X509_REQ_INFO **a; -unsigned char **pp; -long length; +X509_REQ_INFO *d2i_X509_REQ_INFO(X509_REQ_INFO **a, unsigned char **pp, + long length) { M_ASN1_D2I_vars(a,X509_REQ_INFO *,X509_REQ_INFO_new); @@ -141,40 +133,40 @@ long length; ret->req_kludge=1; else { - M_ASN1_D2I_get_IMP_set(ret->attributes,d2i_X509_ATTRIBUTE,0); + M_ASN1_D2I_get_IMP_set_type(X509_ATTRIBUTE,ret->attributes, + d2i_X509_ATTRIBUTE, + X509_ATTRIBUTE_free,0); } M_ASN1_D2I_Finish(a,X509_REQ_INFO_free,ASN1_F_D2I_X509_REQ_INFO); } -X509_REQ_INFO *X509_REQ_INFO_new() +X509_REQ_INFO *X509_REQ_INFO_new(void) { X509_REQ_INFO *ret=NULL; + ASN1_CTX c; M_ASN1_New_Malloc(ret,X509_REQ_INFO); M_ASN1_New(ret->version,ASN1_INTEGER_new); M_ASN1_New(ret->subject,X509_NAME_new); M_ASN1_New(ret->pubkey,X509_PUBKEY_new); - M_ASN1_New(ret->attributes,sk_new_null); + M_ASN1_New(ret->attributes,sk_X509_ATTRIBUTE_new_null); ret->req_kludge=0; return(ret); M_ASN1_New_Error(ASN1_F_X509_REQ_INFO_NEW); } -void X509_REQ_INFO_free(a) -X509_REQ_INFO *a; +void X509_REQ_INFO_free(X509_REQ_INFO *a) { if (a == NULL) return; ASN1_INTEGER_free(a->version); X509_NAME_free(a->subject); X509_PUBKEY_free(a->pubkey); - sk_pop_free(a->attributes,X509_ATTRIBUTE_free); + sk_X509_ATTRIBUTE_pop_free(a->attributes,X509_ATTRIBUTE_free); Free((char *)a); } -int i2d_X509_REQ(a,pp) -X509_REQ *a; -unsigned char **pp; +int i2d_X509_REQ(X509_REQ *a, unsigned char **pp) { M_ASN1_I2D_vars(a); M_ASN1_I2D_len(a->req_info, i2d_X509_REQ_INFO); @@ -190,10 +182,7 @@ unsigned char **pp; M_ASN1_I2D_finish(); } -X509_REQ *d2i_X509_REQ(a,pp,length) -X509_REQ **a; -unsigned char **pp; -long length; +X509_REQ *d2i_X509_REQ(X509_REQ **a, unsigned char **pp, long length) { M_ASN1_D2I_vars(a,X509_REQ *,X509_REQ_new); @@ -205,9 +194,10 @@ long length; M_ASN1_D2I_Finish(a,X509_REQ_free,ASN1_F_D2I_X509_REQ); } -X509_REQ *X509_REQ_new() +X509_REQ *X509_REQ_new(void) { X509_REQ *ret=NULL; + ASN1_CTX c; M_ASN1_New_Malloc(ret,X509_REQ); ret->references=1; @@ -218,8 +208,7 @@ X509_REQ *X509_REQ_new() M_ASN1_New_Error(ASN1_F_X509_REQ_NEW); } -void X509_REQ_free(a) -X509_REQ *a; +void X509_REQ_free(X509_REQ *a) { int i; 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 @@ #include #include "cryptlib.h" -#include "asn1_mac.h" +#include +#include -/* - * ASN1err(ASN1_F_D2I_X509_SIG,ASN1_R_LENGTH_MISMATCH); - * ASN1err(ASN1_F_X509_SIG_NEW,ASN1_R_LENGTH_MISMATCH); - */ - -int i2d_X509_SIG(a,pp) -X509_SIG *a; -unsigned char **pp; +int i2d_X509_SIG(X509_SIG *a, unsigned char **pp) { M_ASN1_I2D_vars(a); @@ -82,10 +76,7 @@ unsigned char **pp; M_ASN1_I2D_finish(); } -X509_SIG *d2i_X509_SIG(a,pp,length) -X509_SIG **a; -unsigned char **pp; -long length; +X509_SIG *d2i_X509_SIG(X509_SIG **a, unsigned char **pp, long length) { M_ASN1_D2I_vars(a,X509_SIG *,X509_SIG_new); @@ -96,9 +87,10 @@ long length; M_ASN1_D2I_Finish(a,X509_SIG_free,ASN1_F_D2I_X509_SIG); } -X509_SIG *X509_SIG_new() +X509_SIG *X509_SIG_new(void) { X509_SIG *ret=NULL; + ASN1_CTX c; M_ASN1_New_Malloc(ret,X509_SIG); M_ASN1_New(ret->algor,X509_ALGOR_new); @@ -107,8 +99,7 @@ X509_SIG *X509_SIG_new() M_ASN1_New_Error(ASN1_F_X509_SIG_NEW); } -void X509_SIG_free(a) -X509_SIG *a; +void X509_SIG_free(X509_SIG *a) { if (a == NULL) return; 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 @@ #include #include "cryptlib.h" -#include "x509.h" -#include "asn1_mac.h" - -/* - * ASN1err(ASN1_F_D2I_NETSCAPE_SPKAC,ASN1_R_LENGTH_MISMATCH); - * ASN1err(ASN1_F_NETSCAPE_SPKAC_NEW,ASN1_R_LENGTH_MISMATCH); - * ASN1err(ASN1_F_D2I_NETSCAPE_SPKI,ASN1_R_LENGTH_MISMATCH); - * ASN1err(ASN1_F_NETSCAPE_SPKI_NEW,ASN1_R_LENGTH_MISMATCH); - */ +#include +#include -int i2d_NETSCAPE_SPKAC(a,pp) -NETSCAPE_SPKAC *a; -unsigned char **pp; +int i2d_NETSCAPE_SPKAC(NETSCAPE_SPKAC *a, unsigned char **pp) { M_ASN1_I2D_vars(a); @@ -89,10 +80,8 @@ unsigned char **pp; M_ASN1_I2D_finish(); } -NETSCAPE_SPKAC *d2i_NETSCAPE_SPKAC(a,pp,length) -NETSCAPE_SPKAC **a; -unsigned char **pp; -long length; +NETSCAPE_SPKAC *d2i_NETSCAPE_SPKAC(NETSCAPE_SPKAC **a, unsigned char **pp, + long length) { M_ASN1_D2I_vars(a,NETSCAPE_SPKAC *,NETSCAPE_SPKAC_new); @@ -103,9 +92,10 @@ long length; M_ASN1_D2I_Finish(a,NETSCAPE_SPKAC_free,ASN1_F_D2I_NETSCAPE_SPKAC); } -NETSCAPE_SPKAC *NETSCAPE_SPKAC_new() +NETSCAPE_SPKAC *NETSCAPE_SPKAC_new(void) { NETSCAPE_SPKAC *ret=NULL; + ASN1_CTX c; M_ASN1_New_Malloc(ret,NETSCAPE_SPKAC); M_ASN1_New(ret->pubkey,X509_PUBKEY_new); @@ -114,8 +104,7 @@ NETSCAPE_SPKAC *NETSCAPE_SPKAC_new() M_ASN1_New_Error(ASN1_F_NETSCAPE_SPKAC_NEW); } -void NETSCAPE_SPKAC_free(a) -NETSCAPE_SPKAC *a; +void NETSCAPE_SPKAC_free(NETSCAPE_SPKAC *a) { if (a == NULL) return; X509_PUBKEY_free(a->pubkey); @@ -123,9 +112,7 @@ NETSCAPE_SPKAC *a; Free((char *)a); } -int i2d_NETSCAPE_SPKI(a,pp) -NETSCAPE_SPKI *a; -unsigned char **pp; +int i2d_NETSCAPE_SPKI(NETSCAPE_SPKI *a, unsigned char **pp) { M_ASN1_I2D_vars(a); @@ -142,10 +129,8 @@ unsigned char **pp; M_ASN1_I2D_finish(); } -NETSCAPE_SPKI *d2i_NETSCAPE_SPKI(a,pp,length) -NETSCAPE_SPKI **a; -unsigned char **pp; -long length; +NETSCAPE_SPKI *d2i_NETSCAPE_SPKI(NETSCAPE_SPKI **a, unsigned char **pp, + long length) { M_ASN1_D2I_vars(a,NETSCAPE_SPKI *,NETSCAPE_SPKI_new); @@ -157,9 +142,10 @@ long length; M_ASN1_D2I_Finish(a,NETSCAPE_SPKI_free,ASN1_F_D2I_NETSCAPE_SPKI); } -NETSCAPE_SPKI *NETSCAPE_SPKI_new() +NETSCAPE_SPKI *NETSCAPE_SPKI_new(void) { NETSCAPE_SPKI *ret=NULL; + ASN1_CTX c; M_ASN1_New_Malloc(ret,NETSCAPE_SPKI); M_ASN1_New(ret->spkac,NETSCAPE_SPKAC_new); @@ -169,8 +155,7 @@ NETSCAPE_SPKI *NETSCAPE_SPKI_new() M_ASN1_New_Error(ASN1_F_NETSCAPE_SPKI_NEW); } -void NETSCAPE_SPKI_free(a) -NETSCAPE_SPKI *a; +void NETSCAPE_SPKI_free(NETSCAPE_SPKI *a) { if (a == NULL) return; 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 @@ #include #include "cryptlib.h" -#include "asn1_mac.h" +#include +#include -/* ASN1err(ASN1_F_X509_VAL_NEW,ERR_R_MALLOC_FAILURE); - * ASN1err(ASN1_F_X509_VAL_FREE,ERR_R_MALLOC_FAILURE); - * ASN1err(ASN1_F_D2I_X509_VAL,ERR_R_MALLOC_FAILURE); - */ - -int i2d_X509_VAL(a,pp) -X509_VAL *a; -unsigned char **pp; +int i2d_X509_VAL(X509_VAL *a, unsigned char **pp) { M_ASN1_I2D_vars(a); - M_ASN1_I2D_len(a->notBefore,i2d_ASN1_UTCTIME); - M_ASN1_I2D_len(a->notAfter,i2d_ASN1_UTCTIME); + M_ASN1_I2D_len(a->notBefore,i2d_ASN1_TIME); + M_ASN1_I2D_len(a->notAfter,i2d_ASN1_TIME); M_ASN1_I2D_seq_total(); - M_ASN1_I2D_put(a->notBefore,i2d_ASN1_UTCTIME); - M_ASN1_I2D_put(a->notAfter,i2d_ASN1_UTCTIME); + M_ASN1_I2D_put(a->notBefore,i2d_ASN1_TIME); + M_ASN1_I2D_put(a->notAfter,i2d_ASN1_TIME); M_ASN1_I2D_finish(); } -X509_VAL *d2i_X509_VAL(a,pp,length) -X509_VAL **a; -unsigned char **pp; -long length; +X509_VAL *d2i_X509_VAL(X509_VAL **a, unsigned char **pp, long length) { M_ASN1_D2I_vars(a,X509_VAL *,X509_VAL_new); M_ASN1_D2I_Init(); M_ASN1_D2I_start_sequence(); - M_ASN1_D2I_get(ret->notBefore,d2i_ASN1_UTCTIME); - M_ASN1_D2I_get(ret->notAfter,d2i_ASN1_UTCTIME); + M_ASN1_D2I_get(ret->notBefore,d2i_ASN1_TIME); + M_ASN1_D2I_get(ret->notAfter,d2i_ASN1_TIME); M_ASN1_D2I_Finish(a,X509_VAL_free,ASN1_F_D2I_X509_VAL); } -X509_VAL *X509_VAL_new() +X509_VAL *X509_VAL_new(void) { X509_VAL *ret=NULL; + ASN1_CTX c; M_ASN1_New_Malloc(ret,X509_VAL); - M_ASN1_New(ret->notBefore,ASN1_UTCTIME_new); - M_ASN1_New(ret->notAfter,ASN1_UTCTIME_new); + M_ASN1_New(ret->notBefore,ASN1_TIME_new); + M_ASN1_New(ret->notAfter,ASN1_TIME_new); return(ret); M_ASN1_New_Error(ASN1_F_X509_VAL_NEW); } -void X509_VAL_free(a) -X509_VAL *a; +void X509_VAL_free(X509_VAL *a) { if (a == NULL) return; - ASN1_UTCTIME_free(a->notBefore); - ASN1_UTCTIME_free(a->notAfter); + ASN1_TIME_free(a->notBefore); + ASN1_TIME_free(a->notAfter); Free((char *)a); } 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 @@ #include #include "cryptlib.h" -#include "evp.h" -#include "asn1_mac.h" - -/* - * ASN1err(ASN1_F_D2I_X509,ASN1_R_LENGTH_MISMATCH); - * ASN1err(ASN1_F_X509_NEW,ASN1_R_BAD_GET_OBJECT); - */ +#include +#include +#include static ASN1_METHOD meth={ (int (*)()) i2d_X509, @@ -72,14 +68,12 @@ static ASN1_METHOD meth={ (char *(*)())X509_new, (void (*)()) X509_free}; -ASN1_METHOD *X509_asn1_meth() +ASN1_METHOD *X509_asn1_meth(void) { return(&meth); } -int i2d_X509(a,pp) -X509 *a; -unsigned char **pp; +int i2d_X509(X509 *a, unsigned char **pp) { M_ASN1_I2D_vars(a); @@ -96,10 +90,7 @@ unsigned char **pp; M_ASN1_I2D_finish(); } -X509 *d2i_X509(a,pp,length) -X509 **a; -unsigned char **pp; -long length; +X509 *d2i_X509(X509 **a, unsigned char **pp, long length) { M_ASN1_D2I_vars(a,X509 *,X509_new); @@ -108,15 +99,16 @@ long length; M_ASN1_D2I_get(ret->cert_info,d2i_X509_CINF); M_ASN1_D2I_get(ret->sig_alg,d2i_X509_ALGOR); M_ASN1_D2I_get(ret->signature,d2i_ASN1_BIT_STRING); -if (ret->name != NULL) Free(ret->name); -ret->name=X509_NAME_oneline(ret->cert_info->subject,NULL,0); + if (ret->name != NULL) Free(ret->name); + ret->name=X509_NAME_oneline(ret->cert_info->subject,NULL,0); M_ASN1_D2I_Finish(a,X509_free,ASN1_F_D2I_X509); } -X509 *X509_new() +X509 *X509_new(void) { X509 *ret=NULL; + ASN1_CTX c; M_ASN1_New_Malloc(ret,X509); ret->references=1; @@ -129,8 +121,7 @@ X509 *X509_new() M_ASN1_New_Error(ASN1_F_X509_NEW); } -void X509_free(a) -X509 *a; +void X509_free(X509 *a) { int i; @@ -149,9 +140,11 @@ X509 *a; } #endif + /* CRYPTO_free_ex_data(bio_meth,(char *)a,&a->ex_data); */ X509_CINF_free(a->cert_info); X509_ALGOR_free(a->sig_alg); ASN1_BIT_STRING_free(a->signature); + if (a->name != NULL) Free(a->name); Free((char *)a); } -- cgit v1.2.3-55-g6feb