From bd49c6ecd821aa83d1618a9e66a71ea5d8844898 Mon Sep 17 00:00:00 2001 From: steve Date: Mon, 20 Nov 2000 00:38:38 +0000 Subject: Implement PKCS#12 ASN1 module, all the old stuff has been replaced by the single file p12_asn.c. Various related replacements. Fix for typo in PKCS7 module. --- crypto/asn1/Makefile.ssl | 287 ++++++++++----------------------------------- crypto/asn1/p7_asn.c | 2 +- crypto/asn1/p8_pkey.c | 80 +++---------- crypto/asn1/tasn_fre.c | 2 +- crypto/asn1/x_pubkey.c | 2 +- crypto/pkcs12/Makefile.ssl | 117 +++++------------- crypto/pkcs12/p12_asn.c | 114 ++++++++++++++++++ crypto/pkcs12/p12_bags.c | 192 ------------------------------ crypto/pkcs12/p12_lib.c | 111 ------------------ crypto/pkcs12/p12_mac.c | 110 ----------------- crypto/pkcs12/p12_sbag.c | 234 ------------------------------------ crypto/pkcs12/pkcs12.h | 25 +--- crypto/x509/x509.h | 24 +--- 13 files changed, 235 insertions(+), 1065 deletions(-) create mode 100644 crypto/pkcs12/p12_asn.c delete mode 100644 crypto/pkcs12/p12_bags.c delete mode 100644 crypto/pkcs12/p12_lib.c delete mode 100644 crypto/pkcs12/p12_mac.c delete mode 100644 crypto/pkcs12/p12_sbag.c diff --git a/crypto/asn1/Makefile.ssl b/crypto/asn1/Makefile.ssl index 7f10ec46c..a26293684 100644 --- a/crypto/asn1/Makefile.ssl +++ b/crypto/asn1/Makefile.ssl @@ -332,15 +332,15 @@ a_strnid.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h a_strnid.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h a_strnid.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h a_strnid.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/lhash.h ../../include/openssl/opensslconf.h -a_time.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h -a_time.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h -a_time.o: ../cryptlib.h -a_type.o: ../../include/openssl/asn1.h ../../include/openssl/asn1_mac.h +a_time.o: ../../include/openssl/asn1.h ../../include/openssl/asn1t.h +a_time.o: ../../include/openssl/bio.h ../../include/openssl/bn.h +a_time.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h +a_time.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h +a_time.o: ../../include/openssl/err.h ../../include/openssl/lhash.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: ../../include/openssl/symhacks.h ../cryptlib.h +a_type.o: ../../include/openssl/asn1.h ../../include/openssl/asn1t.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 @@ -686,7 +686,7 @@ nsseq.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h nsseq.o: ../../include/openssl/sha.h ../../include/openssl/stack.h nsseq.o: ../../include/openssl/symhacks.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/asn1.h ../../include/openssl/asn1t.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 @@ -707,7 +707,7 @@ 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/symhacks.h ../../include/openssl/x509.h p5_pbe.o: ../../include/openssl/x509_vfy.h ../cryptlib.h -p5_pbev2.o: ../../include/openssl/asn1.h ../../include/openssl/asn1_mac.h +p5_pbev2.o: ../../include/openssl/asn1.h ../../include/openssl/asn1t.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 @@ -728,190 +728,27 @@ p5_pbev2.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h p5_pbev2.o: ../../include/openssl/sha.h ../../include/openssl/stack.h p5_pbev2.o: ../../include/openssl/symhacks.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/lhash.h ../../include/openssl/md2.h -p7_dgst.o: ../../include/openssl/md4.h ../../include/openssl/md5.h -p7_dgst.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h -p7_dgst.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h -p7_dgst.o: ../../include/openssl/opensslv.h ../../include/openssl/pkcs7.h -p7_dgst.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h -p7_dgst.o: ../../include/openssl/rc5.h ../../include/openssl/rijndael-alg-fst.h -p7_dgst.o: ../../include/openssl/rijndael.h ../../include/openssl/ripemd.h -p7_dgst.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h -p7_dgst.o: ../../include/openssl/sha.h ../../include/openssl/stack.h -p7_dgst.o: ../../include/openssl/symhacks.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/lhash.h ../../include/openssl/md2.h -p7_enc.o: ../../include/openssl/md4.h ../../include/openssl/md5.h -p7_enc.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h -p7_enc.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h -p7_enc.o: ../../include/openssl/opensslv.h ../../include/openssl/pkcs7.h -p7_enc.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h -p7_enc.o: ../../include/openssl/rc5.h ../../include/openssl/rijndael-alg-fst.h -p7_enc.o: ../../include/openssl/rijndael.h ../../include/openssl/ripemd.h -p7_enc.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h -p7_enc.o: ../../include/openssl/sha.h ../../include/openssl/stack.h -p7_enc.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h -p7_enc.o: ../../include/openssl/x509_vfy.h ../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/lhash.h ../../include/openssl/md2.h -p7_evp.o: ../../include/openssl/md4.h ../../include/openssl/md5.h -p7_evp.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h -p7_evp.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h -p7_evp.o: ../../include/openssl/opensslv.h ../../include/openssl/pkcs7.h -p7_evp.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h -p7_evp.o: ../../include/openssl/rc5.h ../../include/openssl/rijndael-alg-fst.h -p7_evp.o: ../../include/openssl/rijndael.h ../../include/openssl/ripemd.h -p7_evp.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h -p7_evp.o: ../../include/openssl/sha.h ../../include/openssl/stack.h -p7_evp.o: ../../include/openssl/symhacks.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/lhash.h ../../include/openssl/md2.h -p7_i_s.o: ../../include/openssl/md4.h ../../include/openssl/md5.h -p7_i_s.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h -p7_i_s.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h -p7_i_s.o: ../../include/openssl/opensslv.h ../../include/openssl/pkcs7.h -p7_i_s.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h -p7_i_s.o: ../../include/openssl/rc5.h ../../include/openssl/rijndael-alg-fst.h -p7_i_s.o: ../../include/openssl/rijndael.h ../../include/openssl/ripemd.h -p7_i_s.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h -p7_i_s.o: ../../include/openssl/sha.h ../../include/openssl/stack.h -p7_i_s.o: ../../include/openssl/symhacks.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/lhash.h ../../include/openssl/md2.h -p7_lib.o: ../../include/openssl/md4.h ../../include/openssl/md5.h -p7_lib.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h -p7_lib.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h -p7_lib.o: ../../include/openssl/opensslv.h ../../include/openssl/pkcs7.h -p7_lib.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h -p7_lib.o: ../../include/openssl/rc5.h ../../include/openssl/rijndael-alg-fst.h -p7_lib.o: ../../include/openssl/rijndael.h ../../include/openssl/ripemd.h -p7_lib.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h -p7_lib.o: ../../include/openssl/sha.h ../../include/openssl/stack.h -p7_lib.o: ../../include/openssl/symhacks.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/lhash.h ../../include/openssl/md2.h -p7_recip.o: ../../include/openssl/md4.h ../../include/openssl/md5.h -p7_recip.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h -p7_recip.o: ../../include/openssl/objects.h ../../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 -p7_recip.o: ../../include/openssl/rijndael-alg-fst.h -p7_recip.o: ../../include/openssl/rijndael.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/symhacks.h ../../include/openssl/x509.h -p7_recip.o: ../../include/openssl/x509_vfy.h ../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/lhash.h ../../include/openssl/md2.h -p7_s_e.o: ../../include/openssl/md4.h ../../include/openssl/md5.h -p7_s_e.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h -p7_s_e.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h -p7_s_e.o: ../../include/openssl/opensslv.h ../../include/openssl/pkcs7.h -p7_s_e.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h -p7_s_e.o: ../../include/openssl/rc5.h ../../include/openssl/rijndael-alg-fst.h -p7_s_e.o: ../../include/openssl/rijndael.h ../../include/openssl/ripemd.h -p7_s_e.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h -p7_s_e.o: ../../include/openssl/sha.h ../../include/openssl/stack.h -p7_s_e.o: ../../include/openssl/symhacks.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/lhash.h ../../include/openssl/md2.h -p7_signd.o: ../../include/openssl/md4.h ../../include/openssl/md5.h -p7_signd.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h -p7_signd.o: ../../include/openssl/objects.h ../../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 -p7_signd.o: ../../include/openssl/rijndael-alg-fst.h -p7_signd.o: ../../include/openssl/rijndael.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/symhacks.h ../../include/openssl/x509.h -p7_signd.o: ../../include/openssl/x509_vfy.h ../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/lhash.h ../../include/openssl/md2.h -p7_signi.o: ../../include/openssl/md4.h ../../include/openssl/md5.h -p7_signi.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h -p7_signi.o: ../../include/openssl/objects.h ../../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 -p7_signi.o: ../../include/openssl/rijndael-alg-fst.h -p7_signi.o: ../../include/openssl/rijndael.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/symhacks.h ../../include/openssl/x509.h -p7_signi.o: ../../include/openssl/x509_vfy.h ../cryptlib.h -p8_pkey.o: ../../include/openssl/asn1.h ../../include/openssl/asn1_mac.h +p7_asn.o: ../../include/openssl/asn1.h ../../include/openssl/asn1t.h +p7_asn.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h +p7_asn.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h +p7_asn.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h +p7_asn.o: ../../include/openssl/des.h ../../include/openssl/dh.h +p7_asn.o: ../../include/openssl/dsa.h ../../include/openssl/e_os.h +p7_asn.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h +p7_asn.o: ../../include/openssl/evp.h ../../include/openssl/idea.h +p7_asn.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h +p7_asn.o: ../../include/openssl/md4.h ../../include/openssl/md5.h +p7_asn.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h +p7_asn.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h +p7_asn.o: ../../include/openssl/opensslv.h ../../include/openssl/pkcs7.h +p7_asn.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h +p7_asn.o: ../../include/openssl/rc5.h ../../include/openssl/rijndael-alg-fst.h +p7_asn.o: ../../include/openssl/rijndael.h ../../include/openssl/ripemd.h +p7_asn.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h +p7_asn.o: ../../include/openssl/sha.h ../../include/openssl/stack.h +p7_asn.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h +p7_asn.o: ../../include/openssl/x509_vfy.h ../cryptlib.h +p8_pkey.o: ../../include/openssl/asn1.h ../../include/openssl/asn1t.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 @@ -1102,17 +939,17 @@ tasn_typ.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h tasn_typ.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h tasn_utl.o: ../../include/openssl/asn1.h ../../include/openssl/asn1t.h tasn_utl.o: ../../include/openssl/bio.h ../../include/openssl/bn.h -tasn_utl.o: ../../include/openssl/crypto.h ../../include/openssl/obj_mac.h +tasn_utl.o: ../../include/openssl/crypto.h ../../include/openssl/err.h +tasn_utl.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h tasn_utl.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h tasn_utl.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h tasn_utl.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h -x_algor.o: ../../include/openssl/asn1.h ../../include/openssl/asn1_mac.h +x_algor.o: ../../include/openssl/asn1.h ../../include/openssl/asn1t.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/dsa.h ../../include/openssl/e_os2.h x_algor.o: ../../include/openssl/evp.h ../../include/openssl/idea.h x_algor.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h x_algor.o: ../../include/openssl/md4.h ../../include/openssl/md5.h @@ -1125,8 +962,8 @@ x_algor.o: ../../include/openssl/rijndael.h ../../include/openssl/ripemd.h x_algor.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h x_algor.o: ../../include/openssl/sha.h ../../include/openssl/stack.h x_algor.o: ../../include/openssl/symhacks.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_algor.o: ../../include/openssl/x509_vfy.h +x_attrib.o: ../../include/openssl/asn1.h ../../include/openssl/asn1t.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 @@ -1147,7 +984,7 @@ 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/symhacks.h ../../include/openssl/x509.h x_attrib.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/asn1.h ../../include/openssl/asn1t.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 @@ -1167,13 +1004,12 @@ x_crl.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h x_crl.o: ../../include/openssl/sha.h ../../include/openssl/stack.h x_crl.o: ../../include/openssl/symhacks.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/asn1.h ../../include/openssl/asn1t.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/dsa.h ../../include/openssl/e_os2.h x_exten.o: ../../include/openssl/evp.h ../../include/openssl/idea.h x_exten.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h x_exten.o: ../../include/openssl/md4.h ../../include/openssl/md5.h @@ -1186,7 +1022,7 @@ x_exten.o: ../../include/openssl/rijndael.h ../../include/openssl/ripemd.h x_exten.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h x_exten.o: ../../include/openssl/sha.h ../../include/openssl/stack.h x_exten.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h -x_exten.o: ../../include/openssl/x509_vfy.h ../cryptlib.h +x_exten.o: ../../include/openssl/x509_vfy.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 @@ -1208,20 +1044,21 @@ x_info.o: ../../include/openssl/sha.h ../../include/openssl/stack.h x_info.o: ../../include/openssl/symhacks.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/lhash.h ../../include/openssl/md2.h -x_name.o: ../../include/openssl/md4.h ../../include/openssl/md5.h -x_name.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h -x_name.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h -x_name.o: ../../include/openssl/opensslv.h ../../include/openssl/pkcs7.h -x_name.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h -x_name.o: ../../include/openssl/rc5.h ../../include/openssl/rijndael-alg-fst.h +x_name.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h +x_name.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h +x_name.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h +x_name.o: ../../include/openssl/crypto.h ../../include/openssl/des.h +x_name.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h +x_name.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h +x_name.o: ../../include/openssl/err.h ../../include/openssl/evp.h +x_name.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h +x_name.o: ../../include/openssl/md2.h ../../include/openssl/md4.h +x_name.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h +x_name.o: ../../include/openssl/obj_mac.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/rijndael-alg-fst.h x_name.o: ../../include/openssl/rijndael.h ../../include/openssl/ripemd.h x_name.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h x_name.o: ../../include/openssl/sha.h ../../include/openssl/stack.h @@ -1247,7 +1084,7 @@ x_pkey.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h x_pkey.o: ../../include/openssl/sha.h ../../include/openssl/stack.h x_pkey.o: ../../include/openssl/symhacks.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/asn1.h ../../include/openssl/asn1t.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 @@ -1288,7 +1125,7 @@ x_req.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h x_req.o: ../../include/openssl/sha.h ../../include/openssl/stack.h x_req.o: ../../include/openssl/symhacks.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/asn1.h ../../include/openssl/asn1t.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 @@ -1308,7 +1145,7 @@ x_sig.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h x_sig.o: ../../include/openssl/sha.h ../../include/openssl/stack.h x_sig.o: ../../include/openssl/symhacks.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/asn1.h ../../include/openssl/asn1t.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 @@ -1328,7 +1165,7 @@ x_spki.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h x_spki.o: ../../include/openssl/sha.h ../../include/openssl/stack.h x_spki.o: ../../include/openssl/symhacks.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/asn1.h ../../include/openssl/asn1t.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 @@ -1348,7 +1185,7 @@ x_val.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h x_val.o: ../../include/openssl/sha.h ../../include/openssl/stack.h x_val.o: ../../include/openssl/symhacks.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/asn1.h ../../include/openssl/asn1t.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/conf.h diff --git a/crypto/asn1/p7_asn.c b/crypto/asn1/p7_asn.c index 6de8b5e7a..45dbfeade 100644 --- a/crypto/asn1/p7_asn.c +++ b/crypto/asn1/p7_asn.c @@ -87,7 +87,7 @@ ASN1_SEQUENCE(PKCS7_SIGNED) = { ASN1_SIMPLE(PKCS7_SIGNED, version, ASN1_INTEGER), ASN1_SET_OF(PKCS7_SIGNED, md_algs, X509_ALGOR), ASN1_SIMPLE(PKCS7_SIGNED, contents, PKCS7), - ASN1_IMP_SET_OF_OPT(PKCS7_SIGNED, cert, X509, 0), + ASN1_IMP_SEQUENCE_OF_OPT(PKCS7_SIGNED, cert, X509, 0), ASN1_IMP_SET_OF_OPT(PKCS7_SIGNED, crl, X509_CRL, 1), ASN1_SET_OF(PKCS7_SIGNED, signer_info, PKCS7_SIGNER_INFO) } ASN1_SEQUENCE_END(PKCS7_SIGNED); diff --git a/crypto/asn1/p8_pkey.c b/crypto/asn1/p8_pkey.c index fa6cbfb6f..082dce78b 100644 --- a/crypto/asn1/p8_pkey.c +++ b/crypto/asn1/p8_pkey.c @@ -58,70 +58,26 @@ #include #include "cryptlib.h" -#include +#include #include -int i2d_PKCS8_PRIV_KEY_INFO (PKCS8_PRIV_KEY_INFO *a, unsigned char **pp) +/* Minor tweak to operation: zero private key data */ +static int pkey_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it) { - - 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, M_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); - M_ASN1_D2I_Finish(a, PKCS8_PRIV_KEY_INFO_free, ASN1_F_D2I_PKCS8_PRIV_KEY_INFO); + /* Since the structure must still be valid use ASN1_OP_FREE_PRE */ + if(operation == ASN1_OP_FREE_PRE) { + PKCS8_PRIV_KEY_INFO *key = (PKCS8_PRIV_KEY_INFO *)*pval; + if (key->pkey->value.octet_string) + memset(key->pkey->value.octet_string->data, + 0, key->pkey->value.octet_string->length); + } + return 1; } +ASN1_SEQUENCE_cb(PKCS8_PRIV_KEY_INFO, pkey_cb) = { + ASN1_SIMPLE(PKCS8_PRIV_KEY_INFO, version, ASN1_INTEGER), + ASN1_SIMPLE(PKCS8_PRIV_KEY_INFO, pkeyalg, X509_ALGOR), + ASN1_SIMPLE(PKCS8_PRIV_KEY_INFO, pkey, ASN1_ANY), + ASN1_IMP_SET_OF_OPT(PKCS8_PRIV_KEY_INFO, attributes, X509_ATTRIBUTE, 0) +} ASN1_SEQUENCE_END_cb(PKCS8_PRIV_KEY_INFO, PKCS8_PRIV_KEY_INFO); -void PKCS8_PRIV_KEY_INFO_free (PKCS8_PRIV_KEY_INFO *a) -{ - if (a == NULL) return; - M_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); - OPENSSL_free (a); -} +IMPLEMENT_ASN1_FUNCTIONS(PKCS8_PRIV_KEY_INFO) diff --git a/crypto/asn1/tasn_fre.c b/crypto/asn1/tasn_fre.c index 11624bd1f..4a815bfc5 100644 --- a/crypto/asn1/tasn_fre.c +++ b/crypto/asn1/tasn_fre.c @@ -119,7 +119,7 @@ static void asn1_item_combine_free(ASN1_VALUE *val, const ASN1_ITEM *it, int com case ASN1_ITYPE_SEQUENCE: if(asn1_do_lock(val, -1, it) > 0) return; if(asn1_cb) asn1_cb(ASN1_OP_FREE_PRE, &val, it); - /* If we free up as normal we will free and zero any + /* If we free up as normal we will invalidate any * ANY DEFINED BY field and we wont be able to * determine the type of the field it defines. So * free up in reverse order. diff --git a/crypto/asn1/x_pubkey.c b/crypto/asn1/x_pubkey.c index 76c9d7dd8..cd5144d3d 100644 --- a/crypto/asn1/x_pubkey.c +++ b/crypto/asn1/x_pubkey.c @@ -70,7 +70,7 @@ static int pubkey_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it) } return 1; } - + ASN1_SEQUENCE_cb(X509_PUBKEY, pubkey_cb) = { ASN1_SIMPLE(X509_PUBKEY, algor, X509_ALGOR), ASN1_SIMPLE(X509_PUBKEY, public_key, ASN1_BIT_STRING) diff --git a/crypto/pkcs12/Makefile.ssl b/crypto/pkcs12/Makefile.ssl index 99539ba31..b28e44128 100644 --- a/crypto/pkcs12/Makefile.ssl +++ b/crypto/pkcs12/Makefile.ssl @@ -22,12 +22,12 @@ TEST= APPS= LIB=$(TOP)/libcrypto.a -LIBSRC= p12_add.c p12_attr.c p12_bags.c p12_crpt.c p12_crt.c p12_decr.c \ - p12_init.c p12_key.c p12_kiss.c p12_lib.c p12_mac.c p12_mutl.c\ - p12_sbag.c p12_utl.c p12_npas.c pk12err.c -LIBOBJ= p12_add.o p12_attr.o p12_bags.o p12_crpt.o p12_crt.o p12_decr.o \ - p12_init.o p12_key.o p12_kiss.o p12_lib.o p12_mac.o p12_mutl.o\ - p12_sbag.o p12_utl.o p12_npas.o pk12err.o +LIBSRC= p12_add.c p12_asn.c p12_attr.c p12_crpt.c p12_crt.c p12_decr.c \ + p12_init.c p12_key.c p12_kiss.c p12_mutl.c\ + p12_utl.c p12_npas.c pk12err.c +LIBOBJ= p12_add.o p12_asn.o p12_attr.o p12_crpt.o p12_crt.o p12_decr.o \ + p12_init.o p12_key.o p12_kiss.o p12_mutl.o\ + p12_utl.o p12_npas.o pk12err.o SRC= $(LIBSRC) @@ -105,6 +105,27 @@ p12_add.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h p12_add.o: ../../include/openssl/sha.h ../../include/openssl/stack.h p12_add.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h p12_add.o: ../../include/openssl/x509_vfy.h ../cryptlib.h +p12_asn.o: ../../include/openssl/asn1.h ../../include/openssl/asn1t.h +p12_asn.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h +p12_asn.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h +p12_asn.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h +p12_asn.o: ../../include/openssl/des.h ../../include/openssl/dh.h +p12_asn.o: ../../include/openssl/dsa.h ../../include/openssl/e_os.h +p12_asn.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h +p12_asn.o: ../../include/openssl/evp.h ../../include/openssl/idea.h +p12_asn.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h +p12_asn.o: ../../include/openssl/md4.h ../../include/openssl/md5.h +p12_asn.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h +p12_asn.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h +p12_asn.o: ../../include/openssl/opensslv.h ../../include/openssl/pkcs12.h +p12_asn.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h +p12_asn.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h +p12_asn.o: ../../include/openssl/rijndael-alg-fst.h +p12_asn.o: ../../include/openssl/rijndael.h ../../include/openssl/ripemd.h +p12_asn.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h +p12_asn.o: ../../include/openssl/sha.h ../../include/openssl/stack.h +p12_asn.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h +p12_asn.o: ../../include/openssl/x509_vfy.h ../cryptlib.h p12_attr.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h p12_attr.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h p12_attr.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h @@ -126,27 +147,6 @@ p12_attr.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h p12_attr.o: ../../include/openssl/sha.h ../../include/openssl/stack.h p12_attr.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h p12_attr.o: ../../include/openssl/x509_vfy.h ../cryptlib.h -p12_bags.o: ../../include/openssl/asn1.h ../../include/openssl/asn1_mac.h -p12_bags.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h -p12_bags.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h -p12_bags.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h -p12_bags.o: ../../include/openssl/des.h ../../include/openssl/dh.h -p12_bags.o: ../../include/openssl/dsa.h ../../include/openssl/e_os.h -p12_bags.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h -p12_bags.o: ../../include/openssl/evp.h ../../include/openssl/idea.h -p12_bags.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h -p12_bags.o: ../../include/openssl/md4.h ../../include/openssl/md5.h -p12_bags.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h -p12_bags.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h -p12_bags.o: ../../include/openssl/opensslv.h ../../include/openssl/pkcs12.h -p12_bags.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h -p12_bags.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h -p12_bags.o: ../../include/openssl/rijndael-alg-fst.h -p12_bags.o: ../../include/openssl/rijndael.h ../../include/openssl/ripemd.h -p12_bags.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h -p12_bags.o: ../../include/openssl/sha.h ../../include/openssl/stack.h -p12_bags.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h -p12_bags.o: ../../include/openssl/x509_vfy.h ../cryptlib.h p12_crpt.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h p12_crpt.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h p12_crpt.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h @@ -271,48 +271,6 @@ p12_kiss.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h p12_kiss.o: ../../include/openssl/sha.h ../../include/openssl/stack.h p12_kiss.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h p12_kiss.o: ../../include/openssl/x509_vfy.h ../cryptlib.h -p12_lib.o: ../../include/openssl/asn1.h ../../include/openssl/asn1_mac.h -p12_lib.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h -p12_lib.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h -p12_lib.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h -p12_lib.o: ../../include/openssl/des.h ../../include/openssl/dh.h -p12_lib.o: ../../include/openssl/dsa.h ../../include/openssl/e_os.h -p12_lib.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h -p12_lib.o: ../../include/openssl/evp.h ../../include/openssl/idea.h -p12_lib.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h -p12_lib.o: ../../include/openssl/md4.h ../../include/openssl/md5.h -p12_lib.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h -p12_lib.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h -p12_lib.o: ../../include/openssl/opensslv.h ../../include/openssl/pkcs12.h -p12_lib.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h -p12_lib.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h -p12_lib.o: ../../include/openssl/rijndael-alg-fst.h -p12_lib.o: ../../include/openssl/rijndael.h ../../include/openssl/ripemd.h -p12_lib.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h -p12_lib.o: ../../include/openssl/sha.h ../../include/openssl/stack.h -p12_lib.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h -p12_lib.o: ../../include/openssl/x509_vfy.h ../cryptlib.h -p12_mac.o: ../../include/openssl/asn1.h ../../include/openssl/asn1_mac.h -p12_mac.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h -p12_mac.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h -p12_mac.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h -p12_mac.o: ../../include/openssl/des.h ../../include/openssl/dh.h -p12_mac.o: ../../include/openssl/dsa.h ../../include/openssl/e_os.h -p12_mac.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h -p12_mac.o: ../../include/openssl/evp.h ../../include/openssl/idea.h -p12_mac.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h -p12_mac.o: ../../include/openssl/md4.h ../../include/openssl/md5.h -p12_mac.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h -p12_mac.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h -p12_mac.o: ../../include/openssl/opensslv.h ../../include/openssl/pkcs12.h -p12_mac.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h -p12_mac.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h -p12_mac.o: ../../include/openssl/rijndael-alg-fst.h -p12_mac.o: ../../include/openssl/rijndael.h ../../include/openssl/ripemd.h -p12_mac.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h -p12_mac.o: ../../include/openssl/sha.h ../../include/openssl/stack.h -p12_mac.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h -p12_mac.o: ../../include/openssl/x509_vfy.h ../cryptlib.h p12_mutl.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h p12_mutl.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h p12_mutl.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h @@ -356,27 +314,6 @@ p12_npas.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h p12_npas.o: ../../include/openssl/sha.h ../../include/openssl/stack.h p12_npas.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h p12_npas.o: ../../include/openssl/x509_vfy.h -p12_sbag.o: ../../include/openssl/asn1.h ../../include/openssl/asn1_mac.h -p12_sbag.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h -p12_sbag.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h -p12_sbag.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h -p12_sbag.o: ../../include/openssl/des.h ../../include/openssl/dh.h -p12_sbag.o: ../../include/openssl/dsa.h ../../include/openssl/e_os.h -p12_sbag.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h -p12_sbag.o: ../../include/openssl/evp.h ../../include/openssl/idea.h -p12_sbag.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h -p12_sbag.o: ../../include/openssl/md4.h ../../include/openssl/md5.h -p12_sbag.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h -p12_sbag.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h -p12_sbag.o: ../../include/openssl/opensslv.h ../../include/openssl/pkcs12.h -p12_sbag.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h -p12_sbag.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h -p12_sbag.o: ../../include/openssl/rijndael-alg-fst.h -p12_sbag.o: ../../include/openssl/rijndael.h ../../include/openssl/ripemd.h -p12_sbag.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h -p12_sbag.o: ../../include/openssl/sha.h ../../include/openssl/stack.h -p12_sbag.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h -p12_sbag.o: ../../include/openssl/x509_vfy.h ../cryptlib.h p12_utl.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h p12_utl.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h p12_utl.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h diff --git a/crypto/pkcs12/p12_asn.c b/crypto/pkcs12/p12_asn.c new file mode 100644 index 000000000..fa4ca6006 --- /dev/null +++ b/crypto/pkcs12/p12_asn.c @@ -0,0 +1,114 @@ +/* p12_asn.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 + +/* PKCS#12 ASN1 module */ + +ASN1_SEQUENCE(PKCS12) = { + ASN1_SIMPLE(PKCS12, version, ASN1_INTEGER), + ASN1_SIMPLE(PKCS12, authsafes, PKCS7), + ASN1_OPT(PKCS12, mac, PKCS12_MAC_DATA) +} ASN1_SEQUENCE_END(PKCS12); + +IMPLEMENT_ASN1_FUNCTIONS(PKCS12) + +ASN1_SEQUENCE(PKCS12_MAC_DATA) = { + ASN1_SIMPLE(PKCS12_MAC_DATA, dinfo, X509_SIG), + ASN1_SIMPLE(PKCS12_MAC_DATA, salt, ASN1_OCTET_STRING), + ASN1_SIMPLE(PKCS12_MAC_DATA, iter, ASN1_INTEGER) +} ASN1_SEQUENCE_END(PKCS12_MAC_DATA); + +IMPLEMENT_ASN1_FUNCTIONS(PKCS12_MAC_DATA) + +ASN1_ADB_TEMPLATE(bag_default) = ASN1_EXP(PKCS12_BAGS, value.other, ASN1_ANY, 0); + +ASN1_ADB(PKCS12_BAGS) = { + ADB_ENTRY(NID_x509Certificate, ASN1_EXP(PKCS12_BAGS, value.x509cert, ASN1_OCTET_STRING, 0)), + ADB_ENTRY(NID_x509Certificate, ASN1_EXP(PKCS12_BAGS, value.x509crl, ASN1_OCTET_STRING, 0)), + ADB_ENTRY(NID_x509Certificate, ASN1_EXP(PKCS12_BAGS, value.sdsicert, ASN1_IA5STRING, 0)), +} ASN1_ADB_END(PKCS12_BAGS, 0, type, 0, &bag_default_tt, NULL); + +ASN1_SEQUENCE(PKCS12_BAGS) = { + ASN1_SIMPLE(PKCS12_BAGS, type, ASN1_OBJECT), + ASN1_ADB_OBJECT(PKCS12_BAGS), +} ASN1_SEQUENCE_END(PKCS12_BAGS); + +IMPLEMENT_ASN1_FUNCTIONS(PKCS12_BAGS) + +ASN1_ADB_TEMPLATE(safebag_default) = ASN1_EXP(PKCS12_SAFEBAG, value.other, ASN1_ANY, 0); + +ASN1_ADB(PKCS12_SAFEBAG) = { + ADB_ENTRY(NID_keyBag, ASN1_EXP(PKCS12_SAFEBAG, value.keybag, PKCS8_PRIV_KEY_INFO, 0)), + ADB_ENTRY(NID_pkcs8ShroudedKeyBag, ASN1_EXP(PKCS12_SAFEBAG, value.keybag, X509_SIG, 0)), + ADB_ENTRY(NID_safeContentsBag, ASN1_EXP_SET_OF(PKCS12_SAFEBAG, value.safes, PKCS12_SAFEBAG, 0)), + ADB_ENTRY(NID_certBag, ASN1_EXP(PKCS12_SAFEBAG, value.bag, PKCS12_BAGS, 0)), + ADB_ENTRY(NID_crlBag, ASN1_EXP(PKCS12_SAFEBAG, value.bag, PKCS12_BAGS, 0)), + ADB_ENTRY(NID_secretBag, ASN1_EXP(PKCS12_SAFEBAG, value.bag, PKCS12_BAGS, 0)) +} ASN1_ADB_END(PKCS12_SAFEBAG, 0, type, 0, &safebag_default_tt, NULL); + +ASN1_SEQUENCE(PKCS12_SAFEBAG) = { + ASN1_SIMPLE(PKCS12_SAFEBAG, type, ASN1_OBJECT), + ASN1_ADB_OBJECT(PKCS12_SAFEBAG), + ASN1_SET_OF_OPT(PKCS12_SAFEBAG, attrib, X509_ATTRIBUTE) +} ASN1_SEQUENCE_END(PKCS12_SAFEBAG); + +IMPLEMENT_ASN1_FUNCTIONS(PKCS12_SAFEBAG) diff --git a/crypto/pkcs12/p12_bags.c b/crypto/pkcs12/p12_bags.c deleted file mode 100644 index 56547ef93..000000000 --- a/crypto/pkcs12/p12_bags.c +++ /dev/null @@ -1,192 +0,0 @@ -/* p12_bags.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_PKCS12_BAGS(PKCS12_BAGS *a, unsigned char **pp) -{ - int bagnid, v = 0; - M_ASN1_I2D_vars(a); - bagnid = OBJ_obj2nid (a->type); - M_ASN1_I2D_len (a->type, i2d_ASN1_OBJECT); - - switch (bagnid) { - - case NID_x509Certificate: - M_ASN1_I2D_len_EXP_opt (a->value.x509cert, - i2d_ASN1_OCTET_STRING, 0, v); - break; - - case NID_x509Crl: - M_ASN1_I2D_len_EXP_opt (a->value.x509crl, - i2d_ASN1_OCTET_STRING, 0, v); - break; - - case NID_sdsiCertificate: - M_ASN1_I2D_len_EXP_opt (a->value.sdsicert, - i2d_ASN1_IA5STRING, 0, v); - break; - - default: - M_ASN1_I2D_len_EXP_opt (a->value.other, - i2d_ASN1_TYPE, 0, v); - break; - } - - M_ASN1_I2D_seq_total (); - - M_ASN1_I2D_put (a->type, i2d_ASN1_OBJECT); - - switch (bagnid) { - - case NID_x509Certificate: - M_ASN1_I2D_put_EXP_opt (a->value.x509cert, - i2d_ASN1_OCTET_STRING, 0, v); - break; - - case NID_x509Crl: - M_ASN1_I2D_put_EXP_opt (a->value.x509crl, - i2d_ASN1_OCTET_STRING, 0, v); - break; - - case NID_sdsiCertificate: - M_ASN1_I2D_put_EXP_opt (a->value.sdsicert, - i2d_ASN1_IA5STRING, 0, v); - break; - - default: - M_ASN1_I2D_put_EXP_opt (a->value.other, i2d_ASN1_TYPE, 0, v); - break; - } - M_ASN1_I2D_finish(); -} - -PKCS12_BAGS *PKCS12_BAGS_new(void) -{ - PKCS12_BAGS *ret=NULL; - ASN1_CTX c; - M_ASN1_New_Malloc(ret, PKCS12_BAGS); - ret->type=NULL; - ret->value.other=NULL; - return (ret); - M_ASN1_New_Error(ASN1_F_PKCS12_BAGS_NEW); -} - -PKCS12_BAGS *d2i_PKCS12_BAGS(PKCS12_BAGS **a, unsigned char **pp, - long length) -{ - int bagnid; - M_ASN1_D2I_vars(a,PKCS12_BAGS *,PKCS12_BAGS_new); - M_ASN1_D2I_Init(); - M_ASN1_D2I_start_sequence(); - M_ASN1_D2I_get (ret->type, d2i_ASN1_OBJECT); - bagnid = OBJ_obj2nid (ret->type); - switch (bagnid) { - - case NID_x509Certificate: - M_ASN1_D2I_get_EXP_opt (ret->value.x509cert, - d2i_ASN1_OCTET_STRING, 0); - break; - - case NID_x509Crl: - M_ASN1_D2I_get_EXP_opt (ret->value.x509crl, - d2i_ASN1_OCTET_STRING, 0); - break; - - case NID_sdsiCertificate: - M_ASN1_D2I_get_EXP_opt (ret->value.sdsicert, - d2i_ASN1_IA5STRING, 0); - break; - - default: - M_ASN1_D2I_get_EXP_opt (ret->value.other, - d2i_ASN1_TYPE, 0); - break; - } - - M_ASN1_D2I_Finish(a, PKCS12_BAGS_free, ASN1_F_D2I_PKCS12_BAGS); -} - -void PKCS12_BAGS_free (PKCS12_BAGS *a) -{ - if (a == NULL) return; - switch (OBJ_obj2nid(a->type)) { - - case NID_x509Certificate: - M_ASN1_OCTET_STRING_free (a->value.x509cert); - break; - - case NID_x509Crl: - M_ASN1_OCTET_STRING_free (a->value.x509crl); - break; - - case NID_sdsiCertificate: - M_ASN1_IA5STRING_free (a->value.sdsicert); - break; - - default: - ASN1_TYPE_free (a->value.other); - break; - } - - ASN1_OBJECT_free (a->type); - OPENSSL_free (a); -} diff --git a/crypto/pkcs12/p12_lib.c b/crypto/pkcs12/p12_lib.c deleted file mode 100644 index 7d464e3a3..000000000 --- a/crypto/pkcs12/p12_lib.c +++ /dev/null @@ -1,111 +0,0 @@ -/* p12_lib.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_PKCS12(PKCS12 *a, unsigned char **pp) -{ - M_ASN1_I2D_vars(a); - - M_ASN1_I2D_len (a->version, i2d_ASN1_INTEGER); - M_ASN1_I2D_len (a->authsafes, i2d_PKCS7); - M_ASN1_I2D_len (a->mac, i2d_PKCS12_MAC_DATA); - - M_ASN1_I2D_seq_total(); - - M_ASN1_I2D_put (a->version, i2d_ASN1_INTEGER); - M_ASN1_I2D_put (a->authsafes, i2d_PKCS7); - M_ASN1_I2D_put (a->mac, i2d_PKCS12_MAC_DATA); - - M_ASN1_I2D_finish(); -} - -PKCS12 *d2i_PKCS12(PKCS12 **a, unsigned char **pp, long length) -{ - M_ASN1_D2I_vars(a,PKCS12 *,PKCS12_new); - M_ASN1_D2I_Init(); - M_ASN1_D2I_start_sequence(); - M_ASN1_D2I_get (ret->version, d2i_ASN1_INTEGER); - M_ASN1_D2I_get (ret->authsafes, d2i_PKCS7); - M_ASN1_D2I_get_opt (ret->mac, d2i_PKCS12_MAC_DATA, V_ASN1_SEQUENCE); - M_ASN1_D2I_Finish(a, PKCS12_free, ASN1_F_D2I_PKCS12); -} - -PKCS12 *PKCS12_new(void) -{ - PKCS12 *ret=NULL; - ASN1_CTX c; - M_ASN1_New_Malloc(ret, PKCS12); - ret->version=NULL; - ret->mac=NULL; - ret->authsafes=NULL; - return (ret); - M_ASN1_New_Error(ASN1_F_PKCS12_NEW); -} - -void PKCS12_free (PKCS12 *a) -{ - if (a == NULL) return; - M_ASN1_INTEGER_free(a->version); - PKCS12_MAC_DATA_free (a->mac); - PKCS7_free (a->authsafes); - OPENSSL_free (a); -} diff --git a/crypto/pkcs12/p12_mac.c b/crypto/pkcs12/p12_mac.c deleted file mode 100644 index fbd1eca24..000000000 --- a/crypto/pkcs12/p12_mac.c +++ /dev/null @@ -1,110 +0,0 @@ -/* p12_mac.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_PKCS12_MAC_DATA(PKCS12_MAC_DATA *a, unsigned char **pp) -{ - M_ASN1_I2D_vars(a); - M_ASN1_I2D_len (a->dinfo, i2d_X509_SIG); - 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->dinfo, i2d_X509_SIG); - M_ASN1_I2D_put (a->salt, i2d_ASN1_OCTET_STRING); - M_ASN1_I2D_put (a->iter, i2d_ASN1_INTEGER); - M_ASN1_I2D_finish(); -} - -PKCS12_MAC_DATA *PKCS12_MAC_DATA_new(void) -{ - PKCS12_MAC_DATA *ret=NULL; - ASN1_CTX c; - M_ASN1_New_Malloc(ret, PKCS12_MAC_DATA); - ret->dinfo = X509_SIG_new(); - ret->salt = M_ASN1_OCTET_STRING_new(); - ret->iter = NULL; - return(ret); - M_ASN1_New_Error(ASN1_F_PKCS12_MAC_DATA_NEW); -} - -PKCS12_MAC_DATA *d2i_PKCS12_MAC_DATA(PKCS12_MAC_DATA **a, unsigned char **pp, - long length) -{ - M_ASN1_D2I_vars(a,PKCS12_MAC_DATA *,PKCS12_MAC_DATA_new); - M_ASN1_D2I_Init(); - M_ASN1_D2I_start_sequence(); - M_ASN1_D2I_get(ret->dinfo, d2i_X509_SIG); - M_ASN1_D2I_get(ret->salt, d2i_ASN1_OCTET_STRING); - M_ASN1_D2I_get_opt(ret->iter, d2i_ASN1_INTEGER, V_ASN1_INTEGER); - M_ASN1_D2I_Finish(a, PKCS12_MAC_DATA_free, ASN1_F_D2I_PKCS12_MAC_DATA); -} - -void PKCS12_MAC_DATA_free (PKCS12_MAC_DATA *a) -{ - if (a == NULL) return; - X509_SIG_free (a->dinfo); - M_ASN1_OCTET_STRING_free(a->salt); - M_ASN1_INTEGER_free(a->iter); - OPENSSL_free (a); -} diff --git a/crypto/pkcs12/p12_sbag.c b/crypto/pkcs12/p12_sbag.c deleted file mode 100644 index 64ac32ee6..000000000 --- a/crypto/pkcs12/p12_sbag.c +++ /dev/null @@ -1,234 +0,0 @@ -/* p12_sbag.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_PKCS12_SAFEBAG(PKCS12_SAFEBAG *a, unsigned char **pp) -{ - int bagnid, v = 0; - M_ASN1_I2D_vars(a); - bagnid = OBJ_obj2nid (a->type); - M_ASN1_I2D_len (a->type, i2d_ASN1_OBJECT); - - switch (bagnid) { - - case NID_keyBag: - M_ASN1_I2D_len_EXP_opt (a->value.keybag, - i2d_PKCS8_PRIV_KEY_INFO, 0, v); - break; - - case NID_pkcs8ShroudedKeyBag: - M_ASN1_I2D_len_EXP_opt (a->value.shkeybag, - i2d_X509_SIG, 0, v); - break; - - case NID_safeContentsBag: - M_ASN1_I2D_len_EXP_SEQUENCE_opt_type - (PKCS12_SAFEBAG, a->value.safes, i2d_PKCS12_SAFEBAG, - 0, V_ASN1_SEQUENCE, v); - break; - - case NID_certBag: - case NID_crlBag: - case NID_secretBag: - M_ASN1_I2D_len_EXP_opt (a->value.bag, - i2d_PKCS12_BAGS, 0, v); - break; - - default: - M_ASN1_I2D_len_EXP_opt (a->value.other, - i2d_ASN1_TYPE, 0, v); - break; - } - - M_ASN1_I2D_len_SET_type (X509_ATTRIBUTE,a->attrib, i2d_X509_ATTRIBUTE); - - M_ASN1_I2D_seq_total (); - - M_ASN1_I2D_put (a->type, i2d_ASN1_OBJECT); - - switch (bagnid) { - - case NID_keyBag: - M_ASN1_I2D_put_EXP_opt (a->value.keybag, - i2d_PKCS8_PRIV_KEY_INFO, 0, v); - break; - - case NID_pkcs8ShroudedKeyBag: - M_ASN1_I2D_put_EXP_opt (a->value.shkeybag, - i2d_X509_SIG, 0, v); - break; - - case NID_safeContentsBag: - M_ASN1_I2D_put_EXP_SEQUENCE_opt_type - (PKCS12_SAFEBAG, a->value.safes, i2d_PKCS12_SAFEBAG, - 0, V_ASN1_SEQUENCE, v); - break; - - case NID_certBag: - case NID_crlBag: - case NID_secretBag: - M_ASN1_I2D_put_EXP_opt (a->value.bag, - i2d_PKCS12_BAGS, 0, v); - break; - - default: - M_ASN1_I2D_put_EXP_opt (a->value.other, - i2d_ASN1_TYPE, 0, v); - break; - } - - M_ASN1_I2D_put_SET_type (X509_ATTRIBUTE, a->attrib, i2d_X509_ATTRIBUTE); - - M_ASN1_I2D_finish(); -} - -PKCS12_SAFEBAG *PKCS12_SAFEBAG_new(void) -{ - PKCS12_SAFEBAG *ret=NULL; - ASN1_CTX c; - M_ASN1_New_Malloc(ret, PKCS12_SAFEBAG); - ret->type=NULL; - ret->value.other=NULL; - M_ASN1_New(ret->attrib, sk_X509_ATTRIBUTE_new_null); - ret->rest=NULL; - return (ret); - M_ASN1_New_Error(ASN1_F_PKCS12_SAFEBAG_NEW); -} - -PKCS12_SAFEBAG *d2i_PKCS12_SAFEBAG(PKCS12_SAFEBAG **a, unsigned char **pp, - long length) -{ - int bagnid; - M_ASN1_D2I_vars(a,PKCS12_SAFEBAG *,PKCS12_SAFEBAG_new); - M_ASN1_D2I_Init(); - M_ASN1_D2I_start_sequence(); - M_ASN1_D2I_get (ret->type, d2i_ASN1_OBJECT); - bagnid = OBJ_obj2nid (ret->type); - - switch (bagnid) { - - case NID_keyBag: - M_ASN1_D2I_get_EXP_opt (ret->value.keybag, - d2i_PKCS8_PRIV_KEY_INFO, 0); - break; - - case NID_pkcs8ShroudedKeyBag: - M_ASN1_D2I_get_EXP_opt (ret->value.shkeybag, - d2i_X509_SIG, 0); - break; - - case NID_safeContentsBag: - M_ASN1_D2I_get_EXP_set_opt_type - (PKCS12_SAFEBAG, ret->value.safes, - d2i_PKCS12_SAFEBAG, PKCS12_SAFEBAG_free, 0, - V_ASN1_SEQUENCE); - break; - - case NID_certBag: - case NID_crlBag: - case NID_secretBag: - M_ASN1_D2I_get_EXP_opt (ret->value.bag, - d2i_PKCS12_BAGS, 0); - break; - - default: - M_ASN1_D2I_get_EXP_opt (ret->value.other, - d2i_ASN1_TYPE, 0); - break; - } - M_ASN1_D2I_get_set_opt_type(X509_ATTRIBUTE,ret->attrib, - d2i_X509_ATTRIBUTE,X509_ATTRIBUTE_free); - M_ASN1_D2I_Finish(a, PKCS12_SAFEBAG_free, ASN1_F_D2I_PKCS12_SAFEBAG); -} - -void PKCS12_SAFEBAG_free (PKCS12_SAFEBAG *a) -{ - if (a == NULL) return; - switch (OBJ_obj2nid(a->type)) { - - case NID_keyBag: - PKCS8_PRIV_KEY_INFO_free (a->value.keybag); - break; - - case NID_pkcs8ShroudedKeyBag: - X509_SIG_free (a->value.shkeybag); - break; - - case NID_certBag: - case NID_crlBag: - case NID_secretBag: - PKCS12_BAGS_free (a->value.bag); - break; - - default: - ASN1_TYPE_free (a->value.other); - break; - } - - ASN1_OBJECT_free (a->type); - sk_X509_ATTRIBUTE_pop_free (a->attrib, X509_ATTRIBUTE_free); - OPENSSL_free (a); -} - -IMPLEMENT_STACK_OF(PKCS12_SAFEBAG) -IMPLEMENT_ASN1_SET_OF(PKCS12_SAFEBAG) -IMPLEMENT_PKCS12_STACK_OF(PKCS12_SAFEBAG) diff --git a/crypto/pkcs12/pkcs12.h b/crypto/pkcs12/pkcs12.h index 502fceff9..d58a14001 100644 --- a/crypto/pkcs12/pkcs12.h +++ b/crypto/pkcs12/pkcs12.h @@ -120,7 +120,6 @@ union { ASN1_TYPE *other; }value; STACK_OF(X509_ATTRIBUTE) *attrib; -ASN1_TYPE *rest; } PKCS12_SAFEBAG; DECLARE_STACK_OF(PKCS12_SAFEBAG) @@ -249,24 +248,12 @@ int PKCS12_setup_mac(PKCS12 *p12, int iter, unsigned char *salt, int saltlen, EVP_MD *md_type); unsigned char *asc2uni(const char *asc, unsigned char **uni, int *unilen); char *uni2asc(unsigned char *uni, int unilen); -int i2d_PKCS12_BAGS(PKCS12_BAGS *a, unsigned char **pp); -PKCS12_BAGS *PKCS12_BAGS_new(void); -PKCS12_BAGS *d2i_PKCS12_BAGS(PKCS12_BAGS **a, unsigned char **pp, long length); -void PKCS12_BAGS_free(PKCS12_BAGS *a); -int i2d_PKCS12(PKCS12 *a, unsigned char **pp); -PKCS12 *d2i_PKCS12(PKCS12 **a, unsigned char **pp, long length); -PKCS12 *PKCS12_new(void); -void PKCS12_free(PKCS12 *a); -int i2d_PKCS12_MAC_DATA(PKCS12_MAC_DATA *a, unsigned char **pp); -PKCS12_MAC_DATA *PKCS12_MAC_DATA_new(void); -PKCS12_MAC_DATA *d2i_PKCS12_MAC_DATA(PKCS12_MAC_DATA **a, unsigned char **pp, - long length); -void PKCS12_MAC_DATA_free(PKCS12_MAC_DATA *a); -int i2d_PKCS12_SAFEBAG(PKCS12_SAFEBAG *a, unsigned char **pp); -PKCS12_SAFEBAG *PKCS12_SAFEBAG_new(void); -PKCS12_SAFEBAG *d2i_PKCS12_SAFEBAG(PKCS12_SAFEBAG **a, unsigned char **pp, - long length); -void PKCS12_SAFEBAG_free(PKCS12_SAFEBAG *a); + +DECLARE_ASN1_FUNCTIONS(PKCS12) +DECLARE_ASN1_FUNCTIONS(PKCS12_MAC_DATA) +DECLARE_ASN1_FUNCTIONS(PKCS12_SAFEBAG) +DECLARE_ASN1_FUNCTIONS(PKCS12_BAGS) + void ERR_load_PKCS12_strings(void); void PKCS12_PBE_add(void); int PKCS12_parse(PKCS12 *p12, const char *pass, EVP_PKEY **pkey, X509 **cert, diff --git a/crypto/x509/x509.h b/crypto/x509/x509.h index c3d0ad265..ef87b62a1 100644 --- a/crypto/x509/x509.h +++ b/crypto/x509/x509.h @@ -1128,31 +1128,17 @@ X509 *X509_find_by_issuer_and_serial(STACK_OF(X509) *sk,X509_NAME *name, ASN1_INTEGER *serial); X509 *X509_find_by_subject(STACK_OF(X509) *sk,X509_NAME *name); -int i2d_PBEPARAM(PBEPARAM *a, unsigned char **pp); -PBEPARAM *PBEPARAM_new(void); -PBEPARAM *d2i_PBEPARAM(PBEPARAM **a, unsigned char **pp, long length); -void PBEPARAM_free(PBEPARAM *a); +DECLARE_ASN1_FUNCTIONS(PBEPARAM) +DECLARE_ASN1_FUNCTIONS(PBE2PARAM) +DECLARE_ASN1_FUNCTIONS(PBKDF2PARAM) + X509_ALGOR *PKCS5_pbe_set(int alg, int iter, unsigned char *salt, int saltlen); X509_ALGOR *PKCS5_pbe2_set(const EVP_CIPHER *cipher, int iter, unsigned char *salt, int saltlen); -int i2d_PBKDF2PARAM(PBKDF2PARAM *a, unsigned char **pp); -PBKDF2PARAM *PBKDF2PARAM_new(void); -PBKDF2PARAM *d2i_PBKDF2PARAM(PBKDF2PARAM **a, unsigned char **pp, long length); -void PBKDF2PARAM_free(PBKDF2PARAM *a); - -int i2d_PBE2PARAM(PBE2PARAM *a, unsigned char **pp); -PBE2PARAM *PBE2PARAM_new(void); -PBE2PARAM *d2i_PBE2PARAM(PBE2PARAM **a, unsigned char **pp, long length); -void PBE2PARAM_free(PBE2PARAM *a); - /* PKCS#8 utilities */ -int i2d_PKCS8_PRIV_KEY_INFO(PKCS8_PRIV_KEY_INFO *a, unsigned char **pp); -PKCS8_PRIV_KEY_INFO *PKCS8_PRIV_KEY_INFO_new(void); -PKCS8_PRIV_KEY_INFO *d2i_PKCS8_PRIV_KEY_INFO(PKCS8_PRIV_KEY_INFO **a, - unsigned char **pp, long length); -void PKCS8_PRIV_KEY_INFO_free(PKCS8_PRIV_KEY_INFO *a); +DECLARE_ASN1_FUNCTIONS(PKCS8_PRIV_KEY_INFO) EVP_PKEY *EVP_PKCS82PKEY(PKCS8_PRIV_KEY_INFO *p8); PKCS8_PRIV_KEY_INFO *EVP_PKEY2PKCS8(EVP_PKEY *pkey); -- cgit v1.2.1