diff options
| author | djm <> | 2010-10-01 22:59:01 +0000 |
|---|---|---|
| committer | djm <> | 2010-10-01 22:59:01 +0000 |
| commit | 8922d4bc4a8b8893d72a48deb2cdf58215f98505 (patch) | |
| tree | 939b752540947d33507b3acc48d76a8bfb7c3dc3 /src/lib/libcrypto/pkcs12 | |
| parent | 76262f7bf9262f965142b1b2b2105cb279c5c696 (diff) | |
| download | openbsd-8922d4bc4a8b8893d72a48deb2cdf58215f98505.tar.gz openbsd-8922d4bc4a8b8893d72a48deb2cdf58215f98505.tar.bz2 openbsd-8922d4bc4a8b8893d72a48deb2cdf58215f98505.zip | |
resolve conflicts, fix local changes
Diffstat (limited to 'src/lib/libcrypto/pkcs12')
| -rw-r--r-- | src/lib/libcrypto/pkcs12/Makefile.ssl | 417 | ||||
| -rw-r--r-- | src/lib/libcrypto/pkcs12/p12_add.c | 20 | ||||
| -rw-r--r-- | src/lib/libcrypto/pkcs12/p12_attr.c | 2 | ||||
| -rw-r--r-- | src/lib/libcrypto/pkcs12/p12_crpt.c | 20 | ||||
| -rw-r--r-- | src/lib/libcrypto/pkcs12/p12_crt.c | 11 | ||||
| -rw-r--r-- | src/lib/libcrypto/pkcs12/p12_key.c | 7 | ||||
| -rw-r--r-- | src/lib/libcrypto/pkcs12/p12_kiss.c | 163 | ||||
| -rw-r--r-- | src/lib/libcrypto/pkcs12/p12_mutl.c | 8 | ||||
| -rw-r--r-- | src/lib/libcrypto/pkcs12/p12_npas.c | 17 | ||||
| -rw-r--r-- | src/lib/libcrypto/pkcs12/p12_utl.c | 4 | ||||
| -rw-r--r-- | src/lib/libcrypto/pkcs12/pk12err.c | 2 | ||||
| -rw-r--r-- | src/lib/libcrypto/pkcs12/pkcs12.h | 6 |
12 files changed, 134 insertions, 543 deletions
diff --git a/src/lib/libcrypto/pkcs12/Makefile.ssl b/src/lib/libcrypto/pkcs12/Makefile.ssl deleted file mode 100644 index a6e47b4085..0000000000 --- a/src/lib/libcrypto/pkcs12/Makefile.ssl +++ /dev/null | |||
| @@ -1,417 +0,0 @@ | |||
| 1 | # | ||
| 2 | # SSLeay/crypto/pkcs12/Makefile | ||
| 3 | # | ||
| 4 | |||
| 5 | DIR= pkcs12 | ||
| 6 | TOP= ../.. | ||
| 7 | CC= cc | ||
| 8 | INCLUDES= -I.. -I$(TOP) -I../../include | ||
| 9 | CFLAG=-g | ||
| 10 | INSTALL_PREFIX= | ||
| 11 | OPENSSLDIR= /usr/local/ssl | ||
| 12 | INSTALLTOP=/usr/local/ssl | ||
| 13 | MAKE= make -f Makefile.ssl | ||
| 14 | MAKEDEPPROG= makedepend | ||
| 15 | MAKEDEPEND= $(TOP)/util/domd $(TOP) -MD $(MAKEDEPPROG) | ||
| 16 | MAKEFILE= Makefile.ssl | ||
| 17 | AR= ar r | ||
| 18 | |||
| 19 | CFLAGS= $(INCLUDES) $(CFLAG) | ||
| 20 | |||
| 21 | GENERAL=Makefile | ||
| 22 | TEST= | ||
| 23 | APPS= | ||
| 24 | |||
| 25 | LIB=$(TOP)/libcrypto.a | ||
| 26 | LIBSRC= p12_add.c p12_asn.c p12_attr.c p12_crpt.c p12_crt.c p12_decr.c \ | ||
| 27 | p12_init.c p12_key.c p12_kiss.c p12_mutl.c\ | ||
| 28 | p12_utl.c p12_npas.c pk12err.c p12_p8d.c p12_p8e.c | ||
| 29 | LIBOBJ= p12_add.o p12_asn.o p12_attr.o p12_crpt.o p12_crt.o p12_decr.o \ | ||
| 30 | p12_init.o p12_key.o p12_kiss.o p12_mutl.o\ | ||
| 31 | p12_utl.o p12_npas.o pk12err.o p12_p8d.o p12_p8e.o | ||
| 32 | |||
| 33 | SRC= $(LIBSRC) | ||
| 34 | |||
| 35 | EXHEADER= pkcs12.h | ||
| 36 | HEADER= $(EXHEADER) | ||
| 37 | |||
| 38 | ALL= $(GENERAL) $(SRC) $(HEADER) | ||
| 39 | |||
| 40 | top: | ||
| 41 | (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all) | ||
| 42 | |||
| 43 | test: | ||
| 44 | |||
| 45 | all: lib | ||
| 46 | |||
| 47 | lib: $(LIBOBJ) | ||
| 48 | $(AR) $(LIB) $(LIBOBJ) | ||
| 49 | $(RANLIB) $(LIB) || echo Never mind. | ||
| 50 | @touch lib | ||
| 51 | |||
| 52 | files: | ||
| 53 | $(PERL) $(TOP)/util/files.pl Makefile.ssl >> $(TOP)/MINFO | ||
| 54 | |||
| 55 | links: | ||
| 56 | @sh $(TOP)/util/point.sh Makefile.ssl Makefile | ||
| 57 | @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER) | ||
| 58 | @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST) | ||
| 59 | @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS) | ||
| 60 | |||
| 61 | install: | ||
| 62 | @for i in $(EXHEADER) ; \ | ||
| 63 | do \ | ||
| 64 | (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \ | ||
| 65 | chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \ | ||
| 66 | done; | ||
| 67 | |||
| 68 | tags: | ||
| 69 | ctags $(SRC) | ||
| 70 | |||
| 71 | tests: | ||
| 72 | |||
| 73 | lint: | ||
| 74 | lint -DLINT $(INCLUDES) $(SRC)>fluff | ||
| 75 | |||
| 76 | depend: | ||
| 77 | $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC) | ||
| 78 | |||
| 79 | dclean: | ||
| 80 | $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new | ||
| 81 | mv -f Makefile.new $(MAKEFILE) | ||
| 82 | |||
| 83 | clean: | ||
| 84 | rm -f *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff | ||
| 85 | |||
| 86 | # DO NOT DELETE THIS LINE -- make depend depends on it. | ||
| 87 | |||
| 88 | p12_add.o: ../../e_os.h ../../include/openssl/aes.h | ||
| 89 | p12_add.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 90 | p12_add.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h | ||
| 91 | p12_add.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h | ||
| 92 | p12_add.o: ../../include/openssl/crypto.h ../../include/openssl/des.h | ||
| 93 | p12_add.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h | ||
| 94 | p12_add.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h | ||
| 95 | p12_add.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 96 | p12_add.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h | ||
| 97 | p12_add.o: ../../include/openssl/md2.h ../../include/openssl/md4.h | ||
| 98 | p12_add.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h | ||
| 99 | p12_add.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 100 | p12_add.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 101 | p12_add.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs12.h | ||
| 102 | p12_add.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h | ||
| 103 | p12_add.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h | ||
| 104 | p12_add.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h | ||
| 105 | p12_add.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 106 | p12_add.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 107 | p12_add.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h | ||
| 108 | p12_add.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 109 | p12_add.o: ../cryptlib.h p12_add.c | ||
| 110 | p12_asn.o: ../../e_os.h ../../include/openssl/aes.h | ||
| 111 | p12_asn.o: ../../include/openssl/asn1.h ../../include/openssl/asn1t.h | ||
| 112 | p12_asn.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h | ||
| 113 | p12_asn.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h | ||
| 114 | p12_asn.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h | ||
| 115 | p12_asn.o: ../../include/openssl/des.h ../../include/openssl/des_old.h | ||
| 116 | p12_asn.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h | ||
| 117 | p12_asn.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 118 | p12_asn.o: ../../include/openssl/evp.h ../../include/openssl/idea.h | ||
| 119 | p12_asn.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h | ||
| 120 | p12_asn.o: ../../include/openssl/md4.h ../../include/openssl/md5.h | ||
| 121 | p12_asn.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h | ||
| 122 | p12_asn.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 123 | p12_asn.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 124 | p12_asn.o: ../../include/openssl/pkcs12.h ../../include/openssl/pkcs7.h | ||
| 125 | p12_asn.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h | ||
| 126 | p12_asn.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h | ||
| 127 | p12_asn.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h | ||
| 128 | p12_asn.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 129 | p12_asn.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h | ||
| 130 | p12_asn.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h | ||
| 131 | p12_asn.o: ../../include/openssl/x509_vfy.h ../cryptlib.h p12_asn.c | ||
| 132 | p12_attr.o: ../../e_os.h ../../include/openssl/aes.h | ||
| 133 | p12_attr.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 134 | p12_attr.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h | ||
| 135 | p12_attr.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h | ||
| 136 | p12_attr.o: ../../include/openssl/crypto.h ../../include/openssl/des.h | ||
| 137 | p12_attr.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h | ||
| 138 | p12_attr.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h | ||
| 139 | p12_attr.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 140 | p12_attr.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h | ||
| 141 | p12_attr.o: ../../include/openssl/md2.h ../../include/openssl/md4.h | ||
| 142 | p12_attr.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h | ||
| 143 | p12_attr.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 144 | p12_attr.o: ../../include/openssl/opensslconf.h | ||
| 145 | p12_attr.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 146 | p12_attr.o: ../../include/openssl/pkcs12.h ../../include/openssl/pkcs7.h | ||
| 147 | p12_attr.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h | ||
| 148 | p12_attr.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h | ||
| 149 | p12_attr.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h | ||
| 150 | p12_attr.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 151 | p12_attr.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h | ||
| 152 | p12_attr.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h | ||
| 153 | p12_attr.o: ../../include/openssl/x509_vfy.h ../cryptlib.h p12_attr.c | ||
| 154 | p12_crpt.o: ../../e_os.h ../../include/openssl/aes.h | ||
| 155 | p12_crpt.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 156 | p12_crpt.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h | ||
| 157 | p12_crpt.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h | ||
| 158 | p12_crpt.o: ../../include/openssl/crypto.h ../../include/openssl/des.h | ||
| 159 | p12_crpt.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h | ||
| 160 | p12_crpt.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h | ||
| 161 | p12_crpt.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 162 | p12_crpt.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h | ||
| 163 | p12_crpt.o: ../../include/openssl/md2.h ../../include/openssl/md4.h | ||
| 164 | p12_crpt.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h | ||
| 165 | p12_crpt.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 166 | p12_crpt.o: ../../include/openssl/opensslconf.h | ||
| 167 | p12_crpt.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 168 | p12_crpt.o: ../../include/openssl/pkcs12.h ../../include/openssl/pkcs7.h | ||
| 169 | p12_crpt.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h | ||
| 170 | p12_crpt.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h | ||
| 171 | p12_crpt.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h | ||
| 172 | p12_crpt.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 173 | p12_crpt.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h | ||
| 174 | p12_crpt.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h | ||
| 175 | p12_crpt.o: ../../include/openssl/x509_vfy.h ../cryptlib.h p12_crpt.c | ||
| 176 | p12_crt.o: ../../e_os.h ../../include/openssl/aes.h | ||
| 177 | p12_crt.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 178 | p12_crt.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h | ||
| 179 | p12_crt.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h | ||
| 180 | p12_crt.o: ../../include/openssl/crypto.h ../../include/openssl/des.h | ||
| 181 | p12_crt.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h | ||
| 182 | p12_crt.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h | ||
| 183 | p12_crt.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 184 | p12_crt.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h | ||
| 185 | p12_crt.o: ../../include/openssl/md2.h ../../include/openssl/md4.h | ||
| 186 | p12_crt.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h | ||
| 187 | p12_crt.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 188 | p12_crt.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 189 | p12_crt.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs12.h | ||
| 190 | p12_crt.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h | ||
| 191 | p12_crt.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h | ||
| 192 | p12_crt.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h | ||
| 193 | p12_crt.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 194 | p12_crt.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 195 | p12_crt.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h | ||
| 196 | p12_crt.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 197 | p12_crt.o: ../cryptlib.h p12_crt.c | ||
| 198 | p12_decr.o: ../../e_os.h ../../include/openssl/aes.h | ||
| 199 | p12_decr.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 200 | p12_decr.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h | ||
| 201 | p12_decr.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h | ||
| 202 | p12_decr.o: ../../include/openssl/crypto.h ../../include/openssl/des.h | ||
| 203 | p12_decr.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h | ||
| 204 | p12_decr.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h | ||
| 205 | p12_decr.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 206 | p12_decr.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h | ||
| 207 | p12_decr.o: ../../include/openssl/md2.h ../../include/openssl/md4.h | ||
| 208 | p12_decr.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h | ||
| 209 | p12_decr.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 210 | p12_decr.o: ../../include/openssl/opensslconf.h | ||
| 211 | p12_decr.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 212 | p12_decr.o: ../../include/openssl/pkcs12.h ../../include/openssl/pkcs7.h | ||
| 213 | p12_decr.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h | ||
| 214 | p12_decr.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h | ||
| 215 | p12_decr.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h | ||
| 216 | p12_decr.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 217 | p12_decr.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h | ||
| 218 | p12_decr.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h | ||
| 219 | p12_decr.o: ../../include/openssl/x509_vfy.h ../cryptlib.h p12_decr.c | ||
| 220 | p12_init.o: ../../e_os.h ../../include/openssl/aes.h | ||
| 221 | p12_init.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 222 | p12_init.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h | ||
| 223 | p12_init.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h | ||
| 224 | p12_init.o: ../../include/openssl/crypto.h ../../include/openssl/des.h | ||
| 225 | p12_init.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h | ||
| 226 | p12_init.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h | ||
| 227 | p12_init.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 228 | p12_init.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h | ||
| 229 | p12_init.o: ../../include/openssl/md2.h ../../include/openssl/md4.h | ||
| 230 | p12_init.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h | ||
| 231 | p12_init.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 232 | p12_init.o: ../../include/openssl/opensslconf.h | ||
| 233 | p12_init.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 234 | p12_init.o: ../../include/openssl/pkcs12.h ../../include/openssl/pkcs7.h | ||
| 235 | p12_init.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h | ||
| 236 | p12_init.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h | ||
| 237 | p12_init.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h | ||
| 238 | p12_init.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 239 | p12_init.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h | ||
| 240 | p12_init.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h | ||
| 241 | p12_init.o: ../../include/openssl/x509_vfy.h ../cryptlib.h p12_init.c | ||
| 242 | p12_key.o: ../../e_os.h ../../include/openssl/aes.h | ||
| 243 | p12_key.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 244 | p12_key.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h | ||
| 245 | p12_key.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h | ||
| 246 | p12_key.o: ../../include/openssl/crypto.h ../../include/openssl/des.h | ||
| 247 | p12_key.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h | ||
| 248 | p12_key.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h | ||
| 249 | p12_key.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 250 | p12_key.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h | ||
| 251 | p12_key.o: ../../include/openssl/md2.h ../../include/openssl/md4.h | ||
| 252 | p12_key.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h | ||
| 253 | p12_key.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 254 | p12_key.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 255 | p12_key.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs12.h | ||
| 256 | p12_key.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h | ||
| 257 | p12_key.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h | ||
| 258 | p12_key.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h | ||
| 259 | p12_key.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 260 | p12_key.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 261 | p12_key.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h | ||
| 262 | p12_key.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 263 | p12_key.o: ../cryptlib.h p12_key.c | ||
| 264 | p12_kiss.o: ../../e_os.h ../../include/openssl/aes.h | ||
| 265 | p12_kiss.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 266 | p12_kiss.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h | ||
| 267 | p12_kiss.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h | ||
| 268 | p12_kiss.o: ../../include/openssl/crypto.h ../../include/openssl/des.h | ||
| 269 | p12_kiss.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h | ||
| 270 | p12_kiss.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h | ||
| 271 | p12_kiss.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 272 | p12_kiss.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h | ||
| 273 | p12_kiss.o: ../../include/openssl/md2.h ../../include/openssl/md4.h | ||
| 274 | p12_kiss.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h | ||
| 275 | p12_kiss.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 276 | p12_kiss.o: ../../include/openssl/opensslconf.h | ||
| 277 | p12_kiss.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 278 | p12_kiss.o: ../../include/openssl/pkcs12.h ../../include/openssl/pkcs7.h | ||
| 279 | p12_kiss.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h | ||
| 280 | p12_kiss.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h | ||
| 281 | p12_kiss.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h | ||
| 282 | p12_kiss.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 283 | p12_kiss.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h | ||
| 284 | p12_kiss.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h | ||
| 285 | p12_kiss.o: ../../include/openssl/x509_vfy.h ../cryptlib.h p12_kiss.c | ||
| 286 | p12_mutl.o: ../../e_os.h ../../include/openssl/aes.h | ||
| 287 | p12_mutl.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 288 | p12_mutl.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h | ||
| 289 | p12_mutl.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h | ||
| 290 | p12_mutl.o: ../../include/openssl/crypto.h ../../include/openssl/des.h | ||
| 291 | p12_mutl.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h | ||
| 292 | p12_mutl.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h | ||
| 293 | p12_mutl.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 294 | p12_mutl.o: ../../include/openssl/hmac.h ../../include/openssl/idea.h | ||
| 295 | p12_mutl.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h | ||
| 296 | p12_mutl.o: ../../include/openssl/md4.h ../../include/openssl/md5.h | ||
| 297 | p12_mutl.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h | ||
| 298 | p12_mutl.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 299 | p12_mutl.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 300 | p12_mutl.o: ../../include/openssl/pkcs12.h ../../include/openssl/pkcs7.h | ||
| 301 | p12_mutl.o: ../../include/openssl/rand.h ../../include/openssl/rc2.h | ||
| 302 | p12_mutl.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h | ||
| 303 | p12_mutl.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h | ||
| 304 | p12_mutl.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 305 | p12_mutl.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 306 | p12_mutl.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h | ||
| 307 | p12_mutl.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 308 | p12_mutl.o: ../cryptlib.h p12_mutl.c | ||
| 309 | p12_npas.o: ../../include/openssl/aes.h ../../include/openssl/asn1.h | ||
| 310 | p12_npas.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h | ||
| 311 | p12_npas.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h | ||
| 312 | p12_npas.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h | ||
| 313 | p12_npas.o: ../../include/openssl/des.h ../../include/openssl/des_old.h | ||
| 314 | p12_npas.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h | ||
| 315 | p12_npas.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 316 | p12_npas.o: ../../include/openssl/evp.h ../../include/openssl/idea.h | ||
| 317 | p12_npas.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h | ||
| 318 | p12_npas.o: ../../include/openssl/md4.h ../../include/openssl/md5.h | ||
| 319 | p12_npas.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h | ||
| 320 | p12_npas.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 321 | p12_npas.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 322 | p12_npas.o: ../../include/openssl/pem.h ../../include/openssl/pem2.h | ||
| 323 | p12_npas.o: ../../include/openssl/pkcs12.h ../../include/openssl/pkcs7.h | ||
| 324 | p12_npas.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h | ||
| 325 | p12_npas.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h | ||
| 326 | p12_npas.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h | ||
| 327 | p12_npas.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 328 | p12_npas.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h | ||
| 329 | p12_npas.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h | ||
| 330 | p12_npas.o: ../../include/openssl/x509_vfy.h p12_npas.c | ||
| 331 | p12_p8d.o: ../../e_os.h ../../include/openssl/aes.h | ||
| 332 | p12_p8d.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 333 | p12_p8d.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h | ||
| 334 | p12_p8d.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h | ||
| 335 | p12_p8d.o: ../../include/openssl/crypto.h ../../include/openssl/des.h | ||
| 336 | p12_p8d.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h | ||
| 337 | p12_p8d.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h | ||
| 338 | p12_p8d.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 339 | p12_p8d.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h | ||
| 340 | p12_p8d.o: ../../include/openssl/md2.h ../../include/openssl/md4.h | ||
| 341 | p12_p8d.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h | ||
| 342 | p12_p8d.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 343 | p12_p8d.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 344 | p12_p8d.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs12.h | ||
| 345 | p12_p8d.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h | ||
| 346 | p12_p8d.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h | ||
| 347 | p12_p8d.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h | ||
| 348 | p12_p8d.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 349 | p12_p8d.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 350 | p12_p8d.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h | ||
| 351 | p12_p8d.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 352 | p12_p8d.o: ../cryptlib.h p12_p8d.c | ||
| 353 | p12_p8e.o: ../../e_os.h ../../include/openssl/aes.h | ||
| 354 | p12_p8e.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 355 | p12_p8e.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h | ||
| 356 | p12_p8e.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h | ||
| 357 | p12_p8e.o: ../../include/openssl/crypto.h ../../include/openssl/des.h | ||
| 358 | p12_p8e.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h | ||
| 359 | p12_p8e.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h | ||
| 360 | p12_p8e.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 361 | p12_p8e.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h | ||
| 362 | p12_p8e.o: ../../include/openssl/md2.h ../../include/openssl/md4.h | ||
| 363 | p12_p8e.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h | ||
| 364 | p12_p8e.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 365 | p12_p8e.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 366 | p12_p8e.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs12.h | ||
| 367 | p12_p8e.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h | ||
| 368 | p12_p8e.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h | ||
| 369 | p12_p8e.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h | ||
| 370 | p12_p8e.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 371 | p12_p8e.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 372 | p12_p8e.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h | ||
| 373 | p12_p8e.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 374 | p12_p8e.o: ../cryptlib.h p12_p8e.c | ||
| 375 | p12_utl.o: ../../e_os.h ../../include/openssl/aes.h | ||
| 376 | p12_utl.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 377 | p12_utl.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h | ||
| 378 | p12_utl.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h | ||
| 379 | p12_utl.o: ../../include/openssl/crypto.h ../../include/openssl/des.h | ||
| 380 | p12_utl.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h | ||
| 381 | p12_utl.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h | ||
| 382 | p12_utl.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 383 | p12_utl.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h | ||
| 384 | p12_utl.o: ../../include/openssl/md2.h ../../include/openssl/md4.h | ||
| 385 | p12_utl.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h | ||
| 386 | p12_utl.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 387 | p12_utl.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 388 | p12_utl.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs12.h | ||
| 389 | p12_utl.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h | ||
| 390 | p12_utl.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h | ||
| 391 | p12_utl.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h | ||
| 392 | p12_utl.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 393 | p12_utl.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 394 | p12_utl.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h | ||
| 395 | p12_utl.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 396 | p12_utl.o: ../cryptlib.h p12_utl.c | ||
| 397 | pk12err.o: ../../include/openssl/aes.h ../../include/openssl/asn1.h | ||
| 398 | pk12err.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h | ||
| 399 | pk12err.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h | ||
| 400 | pk12err.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h | ||
| 401 | pk12err.o: ../../include/openssl/des.h ../../include/openssl/des_old.h | ||
| 402 | pk12err.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h | ||
| 403 | pk12err.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 404 | pk12err.o: ../../include/openssl/evp.h ../../include/openssl/idea.h | ||
| 405 | pk12err.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h | ||
| 406 | pk12err.o: ../../include/openssl/md4.h ../../include/openssl/md5.h | ||
| 407 | pk12err.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h | ||
| 408 | pk12err.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 409 | pk12err.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 410 | pk12err.o: ../../include/openssl/pkcs12.h ../../include/openssl/pkcs7.h | ||
| 411 | pk12err.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h | ||
| 412 | pk12err.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h | ||
| 413 | pk12err.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h | ||
| 414 | pk12err.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 415 | pk12err.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h | ||
| 416 | pk12err.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h | ||
| 417 | pk12err.o: ../../include/openssl/x509_vfy.h pk12err.c | ||
diff --git a/src/lib/libcrypto/pkcs12/p12_add.c b/src/lib/libcrypto/pkcs12/p12_add.c index 1f3e378f5c..27ac5facfa 100644 --- a/src/lib/libcrypto/pkcs12/p12_add.c +++ b/src/lib/libcrypto/pkcs12/p12_add.c | |||
| @@ -106,6 +106,7 @@ PKCS12_SAFEBAG *PKCS12_MAKE_SHKEYBAG(int pbe_nid, const char *pass, | |||
| 106 | PKCS8_PRIV_KEY_INFO *p8) | 106 | PKCS8_PRIV_KEY_INFO *p8) |
| 107 | { | 107 | { |
| 108 | PKCS12_SAFEBAG *bag; | 108 | PKCS12_SAFEBAG *bag; |
| 109 | const EVP_CIPHER *pbe_ciph; | ||
| 109 | 110 | ||
| 110 | /* Set up the safe bag */ | 111 | /* Set up the safe bag */ |
| 111 | if (!(bag = PKCS12_SAFEBAG_new())) { | 112 | if (!(bag = PKCS12_SAFEBAG_new())) { |
| @@ -114,8 +115,14 @@ PKCS12_SAFEBAG *PKCS12_MAKE_SHKEYBAG(int pbe_nid, const char *pass, | |||
| 114 | } | 115 | } |
| 115 | 116 | ||
| 116 | bag->type = OBJ_nid2obj(NID_pkcs8ShroudedKeyBag); | 117 | bag->type = OBJ_nid2obj(NID_pkcs8ShroudedKeyBag); |
| 118 | |||
| 119 | pbe_ciph = EVP_get_cipherbynid(pbe_nid); | ||
| 120 | |||
| 121 | if (pbe_ciph) | ||
| 122 | pbe_nid = -1; | ||
| 123 | |||
| 117 | if (!(bag->value.shkeybag = | 124 | if (!(bag->value.shkeybag = |
| 118 | PKCS8_encrypt(pbe_nid, NULL, pass, passlen, salt, saltlen, iter, | 125 | PKCS8_encrypt(pbe_nid, pbe_ciph, pass, passlen, salt, saltlen, iter, |
| 119 | p8))) { | 126 | p8))) { |
| 120 | PKCS12err(PKCS12_F_PKCS12_MAKE_SHKEYBAG, ERR_R_MALLOC_FAILURE); | 127 | PKCS12err(PKCS12_F_PKCS12_MAKE_SHKEYBAG, ERR_R_MALLOC_FAILURE); |
| 121 | return NULL; | 128 | return NULL; |
| @@ -164,6 +171,7 @@ PKCS7 *PKCS12_pack_p7encdata(int pbe_nid, const char *pass, int passlen, | |||
| 164 | { | 171 | { |
| 165 | PKCS7 *p7; | 172 | PKCS7 *p7; |
| 166 | X509_ALGOR *pbe; | 173 | X509_ALGOR *pbe; |
| 174 | const EVP_CIPHER *pbe_ciph; | ||
| 167 | if (!(p7 = PKCS7_new())) { | 175 | if (!(p7 = PKCS7_new())) { |
| 168 | PKCS12err(PKCS12_F_PKCS12_PACK_P7ENCDATA, ERR_R_MALLOC_FAILURE); | 176 | PKCS12err(PKCS12_F_PKCS12_PACK_P7ENCDATA, ERR_R_MALLOC_FAILURE); |
| 169 | return NULL; | 177 | return NULL; |
| @@ -173,7 +181,15 @@ PKCS7 *PKCS12_pack_p7encdata(int pbe_nid, const char *pass, int passlen, | |||
| 173 | PKCS12_R_ERROR_SETTING_ENCRYPTED_DATA_TYPE); | 181 | PKCS12_R_ERROR_SETTING_ENCRYPTED_DATA_TYPE); |
| 174 | return NULL; | 182 | return NULL; |
| 175 | } | 183 | } |
| 176 | if (!(pbe = PKCS5_pbe_set(pbe_nid, iter, salt, saltlen))) { | 184 | |
| 185 | pbe_ciph = EVP_get_cipherbynid(pbe_nid); | ||
| 186 | |||
| 187 | if (pbe_ciph) | ||
| 188 | pbe = PKCS5_pbe2_set(pbe_ciph, iter, salt, saltlen); | ||
| 189 | else | ||
| 190 | pbe = PKCS5_pbe_set(pbe_nid, iter, salt, saltlen); | ||
| 191 | |||
| 192 | if (!pbe) { | ||
| 177 | PKCS12err(PKCS12_F_PKCS12_PACK_P7ENCDATA, ERR_R_MALLOC_FAILURE); | 193 | PKCS12err(PKCS12_F_PKCS12_PACK_P7ENCDATA, ERR_R_MALLOC_FAILURE); |
| 178 | return NULL; | 194 | return NULL; |
| 179 | } | 195 | } |
diff --git a/src/lib/libcrypto/pkcs12/p12_attr.c b/src/lib/libcrypto/pkcs12/p12_attr.c index 68d6c5ad15..e4d9c25647 100644 --- a/src/lib/libcrypto/pkcs12/p12_attr.c +++ b/src/lib/libcrypto/pkcs12/p12_attr.c | |||
| @@ -139,7 +139,7 @@ char *PKCS12_get_friendlyname(PKCS12_SAFEBAG *bag) | |||
| 139 | ASN1_TYPE *atype; | 139 | ASN1_TYPE *atype; |
| 140 | if (!(atype = PKCS12_get_attr(bag, NID_friendlyName))) return NULL; | 140 | if (!(atype = PKCS12_get_attr(bag, NID_friendlyName))) return NULL; |
| 141 | if (atype->type != V_ASN1_BMPSTRING) return NULL; | 141 | if (atype->type != V_ASN1_BMPSTRING) return NULL; |
| 142 | return uni2asc(atype->value.bmpstring->data, | 142 | return OPENSSL_uni2asc(atype->value.bmpstring->data, |
| 143 | atype->value.bmpstring->length); | 143 | atype->value.bmpstring->length); |
| 144 | } | 144 | } |
| 145 | 145 | ||
diff --git a/src/lib/libcrypto/pkcs12/p12_crpt.c b/src/lib/libcrypto/pkcs12/p12_crpt.c index f8b952e27e..b71d07b4d0 100644 --- a/src/lib/libcrypto/pkcs12/p12_crpt.c +++ b/src/lib/libcrypto/pkcs12/p12_crpt.c | |||
| @@ -60,28 +60,10 @@ | |||
| 60 | #include "cryptlib.h" | 60 | #include "cryptlib.h" |
| 61 | #include <openssl/pkcs12.h> | 61 | #include <openssl/pkcs12.h> |
| 62 | 62 | ||
| 63 | /* PKCS#12 specific PBE functions */ | 63 | /* PKCS#12 PBE algorithms now in static table */ |
| 64 | 64 | ||
| 65 | void PKCS12_PBE_add(void) | 65 | void PKCS12_PBE_add(void) |
| 66 | { | 66 | { |
| 67 | #ifndef OPENSSL_NO_RC4 | ||
| 68 | EVP_PBE_alg_add(NID_pbe_WithSHA1And128BitRC4, EVP_rc4(), EVP_sha1(), | ||
| 69 | PKCS12_PBE_keyivgen); | ||
| 70 | EVP_PBE_alg_add(NID_pbe_WithSHA1And40BitRC4, EVP_rc4_40(), EVP_sha1(), | ||
| 71 | PKCS12_PBE_keyivgen); | ||
| 72 | #endif | ||
| 73 | #ifndef OPENSSL_NO_DES | ||
| 74 | EVP_PBE_alg_add(NID_pbe_WithSHA1And3_Key_TripleDES_CBC, | ||
| 75 | EVP_des_ede3_cbc(), EVP_sha1(), PKCS12_PBE_keyivgen); | ||
| 76 | EVP_PBE_alg_add(NID_pbe_WithSHA1And2_Key_TripleDES_CBC, | ||
| 77 | EVP_des_ede_cbc(), EVP_sha1(), PKCS12_PBE_keyivgen); | ||
| 78 | #endif | ||
| 79 | #ifndef OPENSSL_NO_RC2 | ||
| 80 | EVP_PBE_alg_add(NID_pbe_WithSHA1And128BitRC2_CBC, EVP_rc2_cbc(), | ||
| 81 | EVP_sha1(), PKCS12_PBE_keyivgen); | ||
| 82 | EVP_PBE_alg_add(NID_pbe_WithSHA1And40BitRC2_CBC, EVP_rc2_40_cbc(), | ||
| 83 | EVP_sha1(), PKCS12_PBE_keyivgen); | ||
| 84 | #endif | ||
| 85 | } | 67 | } |
| 86 | 68 | ||
| 87 | int PKCS12_PBE_keyivgen(EVP_CIPHER_CTX *ctx, const char *pass, int passlen, | 69 | int PKCS12_PBE_keyivgen(EVP_CIPHER_CTX *ctx, const char *pass, int passlen, |
diff --git a/src/lib/libcrypto/pkcs12/p12_crt.c b/src/lib/libcrypto/pkcs12/p12_crt.c index 9522342fa5..96b131defa 100644 --- a/src/lib/libcrypto/pkcs12/p12_crt.c +++ b/src/lib/libcrypto/pkcs12/p12_crt.c | |||
| @@ -59,10 +59,6 @@ | |||
| 59 | #include <stdio.h> | 59 | #include <stdio.h> |
| 60 | #include "cryptlib.h" | 60 | #include "cryptlib.h" |
| 61 | #include <openssl/pkcs12.h> | 61 | #include <openssl/pkcs12.h> |
| 62 | #ifdef OPENSSL_FIPS | ||
| 63 | #include <openssl/fips.h> | ||
| 64 | #endif | ||
| 65 | |||
| 66 | 62 | ||
| 67 | 63 | ||
| 68 | static int pkcs12_add_bag(STACK_OF(PKCS12_SAFEBAG) **pbags, PKCS12_SAFEBAG *bag); | 64 | static int pkcs12_add_bag(STACK_OF(PKCS12_SAFEBAG) **pbags, PKCS12_SAFEBAG *bag); |
| @@ -94,14 +90,7 @@ PKCS12 *PKCS12_create(char *pass, char *name, EVP_PKEY *pkey, X509 *cert, | |||
| 94 | 90 | ||
| 95 | /* Set defaults */ | 91 | /* Set defaults */ |
| 96 | if (!nid_cert) | 92 | if (!nid_cert) |
| 97 | { | ||
| 98 | #ifdef OPENSSL_FIPS | ||
| 99 | if (FIPS_mode()) | ||
| 100 | nid_cert = NID_pbe_WithSHA1And3_Key_TripleDES_CBC; | ||
| 101 | else | ||
| 102 | #endif | ||
| 103 | nid_cert = NID_pbe_WithSHA1And40BitRC2_CBC; | 93 | nid_cert = NID_pbe_WithSHA1And40BitRC2_CBC; |
| 104 | } | ||
| 105 | if (!nid_key) | 94 | if (!nid_key) |
| 106 | nid_key = NID_pbe_WithSHA1And3_Key_TripleDES_CBC; | 95 | nid_key = NID_pbe_WithSHA1And3_Key_TripleDES_CBC; |
| 107 | if (!iter) | 96 | if (!iter) |
diff --git a/src/lib/libcrypto/pkcs12/p12_key.c b/src/lib/libcrypto/pkcs12/p12_key.c index 9e57eee4a4..a29794bbbc 100644 --- a/src/lib/libcrypto/pkcs12/p12_key.c +++ b/src/lib/libcrypto/pkcs12/p12_key.c | |||
| @@ -81,15 +81,18 @@ int PKCS12_key_gen_asc(const char *pass, int passlen, unsigned char *salt, | |||
| 81 | int ret; | 81 | int ret; |
| 82 | unsigned char *unipass; | 82 | unsigned char *unipass; |
| 83 | int uniplen; | 83 | int uniplen; |
| 84 | |||
| 84 | if(!pass) { | 85 | if(!pass) { |
| 85 | unipass = NULL; | 86 | unipass = NULL; |
| 86 | uniplen = 0; | 87 | uniplen = 0; |
| 87 | } else if (!asc2uni(pass, passlen, &unipass, &uniplen)) { | 88 | } else if (!OPENSSL_asc2uni(pass, passlen, &unipass, &uniplen)) { |
| 88 | PKCS12err(PKCS12_F_PKCS12_KEY_GEN_ASC,ERR_R_MALLOC_FAILURE); | 89 | PKCS12err(PKCS12_F_PKCS12_KEY_GEN_ASC,ERR_R_MALLOC_FAILURE); |
| 89 | return 0; | 90 | return 0; |
| 90 | } | 91 | } |
| 91 | ret = PKCS12_key_gen_uni(unipass, uniplen, salt, saltlen, | 92 | ret = PKCS12_key_gen_uni(unipass, uniplen, salt, saltlen, |
| 92 | id, iter, n, out, md_type); | 93 | id, iter, n, out, md_type); |
| 94 | if (ret <= 0) | ||
| 95 | return 0; | ||
| 93 | if(unipass) { | 96 | if(unipass) { |
| 94 | OPENSSL_cleanse(unipass, uniplen); /* Clear password from memory */ | 97 | OPENSSL_cleanse(unipass, uniplen); /* Clear password from memory */ |
| 95 | OPENSSL_free(unipass); | 98 | OPENSSL_free(unipass); |
| @@ -129,6 +132,8 @@ int PKCS12_key_gen_uni(unsigned char *pass, int passlen, unsigned char *salt, | |||
| 129 | #endif | 132 | #endif |
| 130 | v = EVP_MD_block_size (md_type); | 133 | v = EVP_MD_block_size (md_type); |
| 131 | u = EVP_MD_size (md_type); | 134 | u = EVP_MD_size (md_type); |
| 135 | if (u < 0) | ||
| 136 | return 0; | ||
| 132 | D = OPENSSL_malloc (v); | 137 | D = OPENSSL_malloc (v); |
| 133 | Ai = OPENSSL_malloc (u); | 138 | Ai = OPENSSL_malloc (u); |
| 134 | B = OPENSSL_malloc (v + 1); | 139 | B = OPENSSL_malloc (v + 1); |
diff --git a/src/lib/libcrypto/pkcs12/p12_kiss.c b/src/lib/libcrypto/pkcs12/p12_kiss.c index 5c4c6ec988..292cc3ed4a 100644 --- a/src/lib/libcrypto/pkcs12/p12_kiss.c +++ b/src/lib/libcrypto/pkcs12/p12_kiss.c | |||
| @@ -63,16 +63,13 @@ | |||
| 63 | /* Simplified PKCS#12 routines */ | 63 | /* Simplified PKCS#12 routines */ |
| 64 | 64 | ||
| 65 | static int parse_pk12( PKCS12 *p12, const char *pass, int passlen, | 65 | static int parse_pk12( PKCS12 *p12, const char *pass, int passlen, |
| 66 | EVP_PKEY **pkey, X509 **cert, STACK_OF(X509) **ca); | 66 | EVP_PKEY **pkey, STACK_OF(X509) *ocerts); |
| 67 | 67 | ||
| 68 | static int parse_bags( STACK_OF(PKCS12_SAFEBAG) *bags, const char *pass, | 68 | static int parse_bags( STACK_OF(PKCS12_SAFEBAG) *bags, const char *pass, |
| 69 | int passlen, EVP_PKEY **pkey, X509 **cert, | 69 | int passlen, EVP_PKEY **pkey, STACK_OF(X509) *ocerts); |
| 70 | STACK_OF(X509) **ca, ASN1_OCTET_STRING **keyid, | ||
| 71 | char *keymatch); | ||
| 72 | 70 | ||
| 73 | static int parse_bag( PKCS12_SAFEBAG *bag, const char *pass, int passlen, | 71 | static int parse_bag( PKCS12_SAFEBAG *bag, const char *pass, int passlen, |
| 74 | EVP_PKEY **pkey, X509 **cert, STACK_OF(X509) **ca, | 72 | EVP_PKEY **pkey, STACK_OF(X509) *ocerts); |
| 75 | ASN1_OCTET_STRING **keyid, char *keymatch); | ||
| 76 | 73 | ||
| 77 | /* Parse and decrypt a PKCS#12 structure returning user key, user cert | 74 | /* Parse and decrypt a PKCS#12 structure returning user key, user cert |
| 78 | * and other (CA) certs. Note either ca should be NULL, *ca should be NULL, | 75 | * and other (CA) certs. Note either ca should be NULL, *ca should be NULL, |
| @@ -83,24 +80,20 @@ static int parse_bag( PKCS12_SAFEBAG *bag, const char *pass, int passlen, | |||
| 83 | int PKCS12_parse(PKCS12 *p12, const char *pass, EVP_PKEY **pkey, X509 **cert, | 80 | int PKCS12_parse(PKCS12 *p12, const char *pass, EVP_PKEY **pkey, X509 **cert, |
| 84 | STACK_OF(X509) **ca) | 81 | STACK_OF(X509) **ca) |
| 85 | { | 82 | { |
| 86 | 83 | STACK_OF(X509) *ocerts = NULL; | |
| 84 | X509 *x = NULL; | ||
| 87 | /* Check for NULL PKCS12 structure */ | 85 | /* Check for NULL PKCS12 structure */ |
| 88 | 86 | ||
| 89 | if(!p12) { | 87 | if(!p12) |
| 88 | { | ||
| 90 | PKCS12err(PKCS12_F_PKCS12_PARSE,PKCS12_R_INVALID_NULL_PKCS12_POINTER); | 89 | PKCS12err(PKCS12_F_PKCS12_PARSE,PKCS12_R_INVALID_NULL_PKCS12_POINTER); |
| 91 | return 0; | 90 | return 0; |
| 92 | } | ||
| 93 | |||
| 94 | /* Allocate stack for ca certificates if needed */ | ||
| 95 | if ((ca != NULL) && (*ca == NULL)) { | ||
| 96 | if (!(*ca = sk_X509_new_null())) { | ||
| 97 | PKCS12err(PKCS12_F_PKCS12_PARSE,ERR_R_MALLOC_FAILURE); | ||
| 98 | return 0; | ||
| 99 | } | 91 | } |
| 100 | } | ||
| 101 | 92 | ||
| 102 | if(pkey) *pkey = NULL; | 93 | if(pkey) |
| 103 | if(cert) *cert = NULL; | 94 | *pkey = NULL; |
| 95 | if(cert) | ||
| 96 | *cert = NULL; | ||
| 104 | 97 | ||
| 105 | /* Check the mac */ | 98 | /* Check the mac */ |
| 106 | 99 | ||
| @@ -122,19 +115,61 @@ int PKCS12_parse(PKCS12 *p12, const char *pass, EVP_PKEY **pkey, X509 **cert, | |||
| 122 | goto err; | 115 | goto err; |
| 123 | } | 116 | } |
| 124 | 117 | ||
| 125 | if (!parse_pk12 (p12, pass, -1, pkey, cert, ca)) | 118 | /* Allocate stack for other certificates */ |
| 119 | ocerts = sk_X509_new_null(); | ||
| 120 | |||
| 121 | if (!ocerts) | ||
| 122 | { | ||
| 123 | PKCS12err(PKCS12_F_PKCS12_PARSE,ERR_R_MALLOC_FAILURE); | ||
| 124 | return 0; | ||
| 125 | } | ||
| 126 | |||
| 127 | if (!parse_pk12 (p12, pass, -1, pkey, ocerts)) | ||
| 126 | { | 128 | { |
| 127 | PKCS12err(PKCS12_F_PKCS12_PARSE,PKCS12_R_PARSE_ERROR); | 129 | PKCS12err(PKCS12_F_PKCS12_PARSE,PKCS12_R_PARSE_ERROR); |
| 128 | goto err; | 130 | goto err; |
| 129 | } | 131 | } |
| 130 | 132 | ||
| 133 | while ((x = sk_X509_pop(ocerts))) | ||
| 134 | { | ||
| 135 | if (pkey && *pkey && cert && !*cert) | ||
| 136 | { | ||
| 137 | if (X509_check_private_key(x, *pkey)) | ||
| 138 | { | ||
| 139 | *cert = x; | ||
| 140 | x = NULL; | ||
| 141 | } | ||
| 142 | } | ||
| 143 | |||
| 144 | if (ca && x) | ||
| 145 | { | ||
| 146 | if (!*ca) | ||
| 147 | *ca = sk_X509_new_null(); | ||
| 148 | if (!*ca) | ||
| 149 | goto err; | ||
| 150 | if (!sk_X509_push(*ca, x)) | ||
| 151 | goto err; | ||
| 152 | x = NULL; | ||
| 153 | } | ||
| 154 | if (x) | ||
| 155 | X509_free(x); | ||
| 156 | } | ||
| 157 | |||
| 158 | if (ocerts) | ||
| 159 | sk_X509_pop_free(ocerts, X509_free); | ||
| 160 | |||
| 131 | return 1; | 161 | return 1; |
| 132 | 162 | ||
| 133 | err: | 163 | err: |
| 134 | 164 | ||
| 135 | if (pkey && *pkey) EVP_PKEY_free(*pkey); | 165 | if (pkey && *pkey) |
| 136 | if (cert && *cert) X509_free(*cert); | 166 | EVP_PKEY_free(*pkey); |
| 137 | if (ca) sk_X509_pop_free(*ca, X509_free); | 167 | if (cert && *cert) |
| 168 | X509_free(*cert); | ||
| 169 | if (x) | ||
| 170 | X509_free(*cert); | ||
| 171 | if (ocerts) | ||
| 172 | sk_X509_pop_free(ocerts, X509_free); | ||
| 138 | return 0; | 173 | return 0; |
| 139 | 174 | ||
| 140 | } | 175 | } |
| @@ -142,15 +177,13 @@ int PKCS12_parse(PKCS12 *p12, const char *pass, EVP_PKEY **pkey, X509 **cert, | |||
| 142 | /* Parse the outer PKCS#12 structure */ | 177 | /* Parse the outer PKCS#12 structure */ |
| 143 | 178 | ||
| 144 | static int parse_pk12(PKCS12 *p12, const char *pass, int passlen, | 179 | static int parse_pk12(PKCS12 *p12, const char *pass, int passlen, |
| 145 | EVP_PKEY **pkey, X509 **cert, STACK_OF(X509) **ca) | 180 | EVP_PKEY **pkey, STACK_OF(X509) *ocerts) |
| 146 | { | 181 | { |
| 147 | STACK_OF(PKCS7) *asafes; | 182 | STACK_OF(PKCS7) *asafes; |
| 148 | STACK_OF(PKCS12_SAFEBAG) *bags; | 183 | STACK_OF(PKCS12_SAFEBAG) *bags; |
| 149 | int i, bagnid; | 184 | int i, bagnid; |
| 150 | PKCS7 *p7; | 185 | PKCS7 *p7; |
| 151 | ASN1_OCTET_STRING *keyid = NULL; | ||
| 152 | 186 | ||
| 153 | char keymatch = 0; | ||
| 154 | if (!(asafes = PKCS12_unpack_authsafes (p12))) return 0; | 187 | if (!(asafes = PKCS12_unpack_authsafes (p12))) return 0; |
| 155 | for (i = 0; i < sk_PKCS7_num (asafes); i++) { | 188 | for (i = 0; i < sk_PKCS7_num (asafes); i++) { |
| 156 | p7 = sk_PKCS7_value (asafes, i); | 189 | p7 = sk_PKCS7_value (asafes, i); |
| @@ -164,8 +197,7 @@ static int parse_pk12(PKCS12 *p12, const char *pass, int passlen, | |||
| 164 | sk_PKCS7_pop_free(asafes, PKCS7_free); | 197 | sk_PKCS7_pop_free(asafes, PKCS7_free); |
| 165 | return 0; | 198 | return 0; |
| 166 | } | 199 | } |
| 167 | if (!parse_bags(bags, pass, passlen, pkey, cert, ca, | 200 | if (!parse_bags(bags, pass, passlen, pkey, ocerts)) { |
| 168 | &keyid, &keymatch)) { | ||
| 169 | sk_PKCS12_SAFEBAG_pop_free(bags, PKCS12_SAFEBAG_free); | 201 | sk_PKCS12_SAFEBAG_pop_free(bags, PKCS12_SAFEBAG_free); |
| 170 | sk_PKCS7_pop_free(asafes, PKCS7_free); | 202 | sk_PKCS7_pop_free(asafes, PKCS7_free); |
| 171 | return 0; | 203 | return 0; |
| @@ -173,89 +205,65 @@ static int parse_pk12(PKCS12 *p12, const char *pass, int passlen, | |||
| 173 | sk_PKCS12_SAFEBAG_pop_free(bags, PKCS12_SAFEBAG_free); | 205 | sk_PKCS12_SAFEBAG_pop_free(bags, PKCS12_SAFEBAG_free); |
| 174 | } | 206 | } |
| 175 | sk_PKCS7_pop_free(asafes, PKCS7_free); | 207 | sk_PKCS7_pop_free(asafes, PKCS7_free); |
| 176 | if (keyid) M_ASN1_OCTET_STRING_free(keyid); | ||
| 177 | return 1; | 208 | return 1; |
| 178 | } | 209 | } |
| 179 | 210 | ||
| 180 | 211 | ||
| 181 | static int parse_bags(STACK_OF(PKCS12_SAFEBAG) *bags, const char *pass, | 212 | static int parse_bags(STACK_OF(PKCS12_SAFEBAG) *bags, const char *pass, |
| 182 | int passlen, EVP_PKEY **pkey, X509 **cert, | 213 | int passlen, EVP_PKEY **pkey, STACK_OF(X509) *ocerts) |
| 183 | STACK_OF(X509) **ca, ASN1_OCTET_STRING **keyid, | ||
| 184 | char *keymatch) | ||
| 185 | { | 214 | { |
| 186 | int i; | 215 | int i; |
| 187 | for (i = 0; i < sk_PKCS12_SAFEBAG_num(bags); i++) { | 216 | for (i = 0; i < sk_PKCS12_SAFEBAG_num(bags); i++) { |
| 188 | if (!parse_bag(sk_PKCS12_SAFEBAG_value (bags, i), | 217 | if (!parse_bag(sk_PKCS12_SAFEBAG_value (bags, i), |
| 189 | pass, passlen, pkey, cert, ca, keyid, | 218 | pass, passlen, pkey, ocerts)) |
| 190 | keymatch)) return 0; | 219 | return 0; |
| 191 | } | 220 | } |
| 192 | return 1; | 221 | return 1; |
| 193 | } | 222 | } |
| 194 | 223 | ||
| 195 | #define MATCH_KEY 0x1 | ||
| 196 | #define MATCH_CERT 0x2 | ||
| 197 | #define MATCH_ALL 0x3 | ||
| 198 | |||
| 199 | static int parse_bag(PKCS12_SAFEBAG *bag, const char *pass, int passlen, | 224 | static int parse_bag(PKCS12_SAFEBAG *bag, const char *pass, int passlen, |
| 200 | EVP_PKEY **pkey, X509 **cert, STACK_OF(X509) **ca, | 225 | EVP_PKEY **pkey, STACK_OF(X509) *ocerts) |
| 201 | ASN1_OCTET_STRING **keyid, | ||
| 202 | char *keymatch) | ||
| 203 | { | 226 | { |
| 204 | PKCS8_PRIV_KEY_INFO *p8; | 227 | PKCS8_PRIV_KEY_INFO *p8; |
| 205 | X509 *x509; | 228 | X509 *x509; |
| 206 | ASN1_OCTET_STRING *lkey = NULL, *ckid = NULL; | ||
| 207 | ASN1_TYPE *attrib; | 229 | ASN1_TYPE *attrib; |
| 208 | ASN1_BMPSTRING *fname = NULL; | 230 | ASN1_BMPSTRING *fname = NULL; |
| 231 | ASN1_OCTET_STRING *lkid = NULL; | ||
| 209 | 232 | ||
| 210 | if ((attrib = PKCS12_get_attr (bag, NID_friendlyName))) | 233 | if ((attrib = PKCS12_get_attr (bag, NID_friendlyName))) |
| 211 | fname = attrib->value.bmpstring; | 234 | fname = attrib->value.bmpstring; |
| 212 | 235 | ||
| 213 | if ((attrib = PKCS12_get_attr (bag, NID_localKeyID))) { | 236 | if ((attrib = PKCS12_get_attr (bag, NID_localKeyID))) |
| 214 | lkey = attrib->value.octet_string; | 237 | lkid = attrib->value.octet_string; |
| 215 | ckid = lkey; | ||
| 216 | } | ||
| 217 | 238 | ||
| 218 | /* Check for any local key id matching (if needed) */ | ||
| 219 | if (lkey && ((*keymatch & MATCH_ALL) != MATCH_ALL)) { | ||
| 220 | if (*keyid) { | ||
| 221 | if (M_ASN1_OCTET_STRING_cmp(*keyid, lkey)) lkey = NULL; | ||
| 222 | } else { | ||
| 223 | if (!(*keyid = M_ASN1_OCTET_STRING_dup(lkey))) { | ||
| 224 | PKCS12err(PKCS12_F_PARSE_BAG,ERR_R_MALLOC_FAILURE); | ||
| 225 | return 0; | ||
| 226 | } | ||
| 227 | } | ||
| 228 | } | ||
| 229 | |||
| 230 | switch (M_PKCS12_bag_type(bag)) | 239 | switch (M_PKCS12_bag_type(bag)) |
| 231 | { | 240 | { |
| 232 | case NID_keyBag: | 241 | case NID_keyBag: |
| 233 | if (!lkey || !pkey) return 1; | 242 | if (!pkey || *pkey) |
| 234 | if (!(*pkey = EVP_PKCS82PKEY(bag->value.keybag))) return 0; | 243 | return 1; |
| 235 | *keymatch |= MATCH_KEY; | 244 | if (!(*pkey = EVP_PKCS82PKEY(bag->value.keybag))) |
| 245 | return 0; | ||
| 236 | break; | 246 | break; |
| 237 | 247 | ||
| 238 | case NID_pkcs8ShroudedKeyBag: | 248 | case NID_pkcs8ShroudedKeyBag: |
| 239 | if (!lkey || !pkey) return 1; | 249 | if (!pkey || *pkey) |
| 250 | return 1; | ||
| 240 | if (!(p8 = PKCS12_decrypt_skey(bag, pass, passlen))) | 251 | if (!(p8 = PKCS12_decrypt_skey(bag, pass, passlen))) |
| 241 | return 0; | 252 | return 0; |
| 242 | *pkey = EVP_PKCS82PKEY(p8); | 253 | *pkey = EVP_PKCS82PKEY(p8); |
| 243 | PKCS8_PRIV_KEY_INFO_free(p8); | 254 | PKCS8_PRIV_KEY_INFO_free(p8); |
| 244 | if (!(*pkey)) return 0; | 255 | if (!(*pkey)) return 0; |
| 245 | *keymatch |= MATCH_KEY; | ||
| 246 | break; | 256 | break; |
| 247 | 257 | ||
| 248 | case NID_certBag: | 258 | case NID_certBag: |
| 249 | if (M_PKCS12_cert_bag_type(bag) != NID_x509Certificate ) | 259 | if (M_PKCS12_cert_bag_type(bag) != NID_x509Certificate ) |
| 250 | return 1; | 260 | return 1; |
| 251 | if (!(x509 = PKCS12_certbag2x509(bag))) return 0; | 261 | if (!(x509 = PKCS12_certbag2x509(bag))) |
| 252 | if(ckid) | 262 | return 0; |
| 263 | if(lkid && !X509_keyid_set1(x509, lkid->data, lkid->length)) | ||
| 253 | { | 264 | { |
| 254 | if (!X509_keyid_set1(x509, ckid->data, ckid->length)) | 265 | X509_free(x509); |
| 255 | { | 266 | return 0; |
| 256 | X509_free(x509); | ||
| 257 | return 0; | ||
| 258 | } | ||
| 259 | } | 267 | } |
| 260 | if(fname) { | 268 | if(fname) { |
| 261 | int len, r; | 269 | int len, r; |
| @@ -272,20 +280,17 @@ static int parse_bag(PKCS12_SAFEBAG *bag, const char *pass, int passlen, | |||
| 272 | } | 280 | } |
| 273 | } | 281 | } |
| 274 | 282 | ||
| 283 | if(!sk_X509_push(ocerts, x509)) | ||
| 284 | { | ||
| 285 | X509_free(x509); | ||
| 286 | return 0; | ||
| 287 | } | ||
| 275 | 288 | ||
| 276 | if (lkey) { | ||
| 277 | *keymatch |= MATCH_CERT; | ||
| 278 | if (cert) *cert = x509; | ||
| 279 | else X509_free(x509); | ||
| 280 | } else { | ||
| 281 | if(ca) sk_X509_push (*ca, x509); | ||
| 282 | else X509_free(x509); | ||
| 283 | } | ||
| 284 | break; | 289 | break; |
| 285 | 290 | ||
| 286 | case NID_safeContentsBag: | 291 | case NID_safeContentsBag: |
| 287 | return parse_bags(bag->value.safes, pass, passlen, | 292 | return parse_bags(bag->value.safes, pass, passlen, |
| 288 | pkey, cert, ca, keyid, keymatch); | 293 | pkey, ocerts); |
| 289 | break; | 294 | break; |
| 290 | 295 | ||
| 291 | default: | 296 | default: |
diff --git a/src/lib/libcrypto/pkcs12/p12_mutl.c b/src/lib/libcrypto/pkcs12/p12_mutl.c index 70bfef6e5d..9ab740d51f 100644 --- a/src/lib/libcrypto/pkcs12/p12_mutl.c +++ b/src/lib/libcrypto/pkcs12/p12_mutl.c | |||
| @@ -71,6 +71,7 @@ int PKCS12_gen_mac(PKCS12 *p12, const char *pass, int passlen, | |||
| 71 | HMAC_CTX hmac; | 71 | HMAC_CTX hmac; |
| 72 | unsigned char key[EVP_MAX_MD_SIZE], *salt; | 72 | unsigned char key[EVP_MAX_MD_SIZE], *salt; |
| 73 | int saltlen, iter; | 73 | int saltlen, iter; |
| 74 | int md_size; | ||
| 74 | 75 | ||
| 75 | if (!PKCS7_type_is_data(p12->authsafes)) | 76 | if (!PKCS7_type_is_data(p12->authsafes)) |
| 76 | { | 77 | { |
| @@ -87,13 +88,16 @@ int PKCS12_gen_mac(PKCS12 *p12, const char *pass, int passlen, | |||
| 87 | PKCS12err(PKCS12_F_PKCS12_GEN_MAC,PKCS12_R_UNKNOWN_DIGEST_ALGORITHM); | 88 | PKCS12err(PKCS12_F_PKCS12_GEN_MAC,PKCS12_R_UNKNOWN_DIGEST_ALGORITHM); |
| 88 | return 0; | 89 | return 0; |
| 89 | } | 90 | } |
| 91 | md_size = EVP_MD_size(md_type); | ||
| 92 | if (md_size < 0) | ||
| 93 | return 0; | ||
| 90 | if(!PKCS12_key_gen (pass, passlen, salt, saltlen, PKCS12_MAC_ID, iter, | 94 | if(!PKCS12_key_gen (pass, passlen, salt, saltlen, PKCS12_MAC_ID, iter, |
| 91 | EVP_MD_size(md_type), key, md_type)) { | 95 | md_size, key, md_type)) { |
| 92 | PKCS12err(PKCS12_F_PKCS12_GEN_MAC,PKCS12_R_KEY_GEN_ERROR); | 96 | PKCS12err(PKCS12_F_PKCS12_GEN_MAC,PKCS12_R_KEY_GEN_ERROR); |
| 93 | return 0; | 97 | return 0; |
| 94 | } | 98 | } |
| 95 | HMAC_CTX_init(&hmac); | 99 | HMAC_CTX_init(&hmac); |
| 96 | HMAC_Init_ex(&hmac, key, EVP_MD_size(md_type), md_type, NULL); | 100 | HMAC_Init_ex(&hmac, key, md_size, md_type, NULL); |
| 97 | HMAC_Update(&hmac, p12->authsafes->d.data->data, | 101 | HMAC_Update(&hmac, p12->authsafes->d.data->data, |
| 98 | p12->authsafes->d.data->length); | 102 | p12->authsafes->d.data->length); |
| 99 | HMAC_Final(&hmac, mac, maclen); | 103 | HMAC_Final(&hmac, mac, maclen); |
diff --git a/src/lib/libcrypto/pkcs12/p12_npas.c b/src/lib/libcrypto/pkcs12/p12_npas.c index 47e5e9c377..2f71355150 100644 --- a/src/lib/libcrypto/pkcs12/p12_npas.c +++ b/src/lib/libcrypto/pkcs12/p12_npas.c | |||
| @@ -120,8 +120,13 @@ static int newpass_p12(PKCS12 *p12, char *oldpass, char *newpass) | |||
| 120 | bags = PKCS12_unpack_p7data(p7); | 120 | bags = PKCS12_unpack_p7data(p7); |
| 121 | } else if (bagnid == NID_pkcs7_encrypted) { | 121 | } else if (bagnid == NID_pkcs7_encrypted) { |
| 122 | bags = PKCS12_unpack_p7encdata(p7, oldpass, -1); | 122 | bags = PKCS12_unpack_p7encdata(p7, oldpass, -1); |
| 123 | alg_get(p7->d.encrypted->enc_data->algorithm, | 123 | if (!alg_get(p7->d.encrypted->enc_data->algorithm, |
| 124 | &pbe_nid, &pbe_iter, &pbe_saltlen); | 124 | &pbe_nid, &pbe_iter, &pbe_saltlen)) |
| 125 | { | ||
| 126 | sk_PKCS12_SAFEBAG_pop_free(bags, | ||
| 127 | PKCS12_SAFEBAG_free); | ||
| 128 | bags = NULL; | ||
| 129 | } | ||
| 125 | } else continue; | 130 | } else continue; |
| 126 | if (!bags) { | 131 | if (!bags) { |
| 127 | sk_PKCS7_pop_free(asafes, PKCS7_free); | 132 | sk_PKCS7_pop_free(asafes, PKCS7_free); |
| @@ -193,7 +198,9 @@ static int newpass_bag(PKCS12_SAFEBAG *bag, char *oldpass, char *newpass) | |||
| 193 | if(M_PKCS12_bag_type(bag) != NID_pkcs8ShroudedKeyBag) return 1; | 198 | if(M_PKCS12_bag_type(bag) != NID_pkcs8ShroudedKeyBag) return 1; |
| 194 | 199 | ||
| 195 | if (!(p8 = PKCS8_decrypt(bag->value.shkeybag, oldpass, -1))) return 0; | 200 | if (!(p8 = PKCS8_decrypt(bag->value.shkeybag, oldpass, -1))) return 0; |
| 196 | alg_get(bag->value.shkeybag->algor, &p8_nid, &p8_iter, &p8_saltlen); | 201 | if (!alg_get(bag->value.shkeybag->algor, &p8_nid, &p8_iter, |
| 202 | &p8_saltlen)) | ||
| 203 | return 0; | ||
| 197 | if(!(p8new = PKCS8_encrypt(p8_nid, NULL, newpass, -1, NULL, p8_saltlen, | 204 | if(!(p8new = PKCS8_encrypt(p8_nid, NULL, newpass, -1, NULL, p8_saltlen, |
| 198 | p8_iter, p8))) return 0; | 205 | p8_iter, p8))) return 0; |
| 199 | X509_SIG_free(bag->value.shkeybag); | 206 | X509_SIG_free(bag->value.shkeybag); |
| @@ -208,9 +215,11 @@ static int alg_get(X509_ALGOR *alg, int *pnid, int *piter, int *psaltlen) | |||
| 208 | 215 | ||
| 209 | p = alg->parameter->value.sequence->data; | 216 | p = alg->parameter->value.sequence->data; |
| 210 | pbe = d2i_PBEPARAM(NULL, &p, alg->parameter->value.sequence->length); | 217 | pbe = d2i_PBEPARAM(NULL, &p, alg->parameter->value.sequence->length); |
| 218 | if (!pbe) | ||
| 219 | return 0; | ||
| 211 | *pnid = OBJ_obj2nid(alg->algorithm); | 220 | *pnid = OBJ_obj2nid(alg->algorithm); |
| 212 | *piter = ASN1_INTEGER_get(pbe->iter); | 221 | *piter = ASN1_INTEGER_get(pbe->iter); |
| 213 | *psaltlen = pbe->salt->length; | 222 | *psaltlen = pbe->salt->length; |
| 214 | PBEPARAM_free(pbe); | 223 | PBEPARAM_free(pbe); |
| 215 | return 0; | 224 | return 1; |
| 216 | } | 225 | } |
diff --git a/src/lib/libcrypto/pkcs12/p12_utl.c b/src/lib/libcrypto/pkcs12/p12_utl.c index ca30ac4f6d..59c6f453f6 100644 --- a/src/lib/libcrypto/pkcs12/p12_utl.c +++ b/src/lib/libcrypto/pkcs12/p12_utl.c | |||
| @@ -62,7 +62,7 @@ | |||
| 62 | 62 | ||
| 63 | /* Cheap and nasty Unicode stuff */ | 63 | /* Cheap and nasty Unicode stuff */ |
| 64 | 64 | ||
| 65 | unsigned char *asc2uni(const char *asc, int asclen, unsigned char **uni, int *unilen) | 65 | unsigned char *OPENSSL_asc2uni(const char *asc, int asclen, unsigned char **uni, int *unilen) |
| 66 | { | 66 | { |
| 67 | int ulen, i; | 67 | int ulen, i; |
| 68 | unsigned char *unitmp; | 68 | unsigned char *unitmp; |
| @@ -81,7 +81,7 @@ unsigned char *asc2uni(const char *asc, int asclen, unsigned char **uni, int *un | |||
| 81 | return unitmp; | 81 | return unitmp; |
| 82 | } | 82 | } |
| 83 | 83 | ||
| 84 | char *uni2asc(unsigned char *uni, int unilen) | 84 | char *OPENSSL_uni2asc(unsigned char *uni, int unilen) |
| 85 | { | 85 | { |
| 86 | int asclen, i; | 86 | int asclen, i; |
| 87 | char *asctmp; | 87 | char *asctmp; |
diff --git a/src/lib/libcrypto/pkcs12/pk12err.c b/src/lib/libcrypto/pkcs12/pk12err.c index 07a1fb6907..f6ddf2df12 100644 --- a/src/lib/libcrypto/pkcs12/pk12err.c +++ b/src/lib/libcrypto/pkcs12/pk12err.c | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | /* crypto/pkcs12/pk12err.c */ | 1 | /* crypto/pkcs12/pk12err.c */ |
| 2 | /* ==================================================================== | 2 | /* ==================================================================== |
| 3 | * Copyright (c) 1999-2005 The OpenSSL Project. All rights reserved. | 3 | * Copyright (c) 1999-2006 The OpenSSL Project. All rights reserved. |
| 4 | * | 4 | * |
| 5 | * Redistribution and use in source and binary forms, with or without | 5 | * Redistribution and use in source and binary forms, with or without |
| 6 | * modification, are permitted provided that the following conditions | 6 | * modification, are permitted provided that the following conditions |
diff --git a/src/lib/libcrypto/pkcs12/pkcs12.h b/src/lib/libcrypto/pkcs12/pkcs12.h index 4bee605dc0..b17eb9f42b 100644 --- a/src/lib/libcrypto/pkcs12/pkcs12.h +++ b/src/lib/libcrypto/pkcs12/pkcs12.h | |||
| @@ -108,8 +108,6 @@ PKCS12_MAC_DATA *mac; | |||
| 108 | PKCS7 *authsafes; | 108 | PKCS7 *authsafes; |
| 109 | } PKCS12; | 109 | } PKCS12; |
| 110 | 110 | ||
| 111 | PREDECLARE_STACK_OF(PKCS12_SAFEBAG) | ||
| 112 | |||
| 113 | typedef struct { | 111 | typedef struct { |
| 114 | ASN1_OBJECT *type; | 112 | ASN1_OBJECT *type; |
| 115 | union { | 113 | union { |
| @@ -232,8 +230,8 @@ int PKCS12_set_mac(PKCS12 *p12, const char *pass, int passlen, | |||
| 232 | const EVP_MD *md_type); | 230 | const EVP_MD *md_type); |
| 233 | int PKCS12_setup_mac(PKCS12 *p12, int iter, unsigned char *salt, | 231 | int PKCS12_setup_mac(PKCS12 *p12, int iter, unsigned char *salt, |
| 234 | int saltlen, const EVP_MD *md_type); | 232 | int saltlen, const EVP_MD *md_type); |
| 235 | unsigned char *asc2uni(const char *asc, int asclen, unsigned char **uni, int *unilen); | 233 | unsigned char *OPENSSL_asc2uni(const char *asc, int asclen, unsigned char **uni, int *unilen); |
| 236 | char *uni2asc(unsigned char *uni, int unilen); | 234 | char *OPENSSL_uni2asc(unsigned char *uni, int unilen); |
| 237 | 235 | ||
| 238 | DECLARE_ASN1_FUNCTIONS(PKCS12) | 236 | DECLARE_ASN1_FUNCTIONS(PKCS12) |
| 239 | DECLARE_ASN1_FUNCTIONS(PKCS12_MAC_DATA) | 237 | DECLARE_ASN1_FUNCTIONS(PKCS12_MAC_DATA) |
