diff options
| author | beck <> | 2002-05-15 02:29:21 +0000 |
|---|---|---|
| committer | beck <> | 2002-05-15 02:29:21 +0000 |
| commit | b64270d1e45fe7f3241e4c9b6ce60d5ac89bc2e9 (patch) | |
| tree | fa27cf82a1250b64ed3bf5f4a18c7354d470bbcc /src/lib/libcrypto/pkcs7 | |
| parent | e471e1ea98d673597b182ea85f29e30c97cd08b5 (diff) | |
| download | openbsd-b64270d1e45fe7f3241e4c9b6ce60d5ac89bc2e9.tar.gz openbsd-b64270d1e45fe7f3241e4c9b6ce60d5ac89bc2e9.tar.bz2 openbsd-b64270d1e45fe7f3241e4c9b6ce60d5ac89bc2e9.zip | |
OpenSSL 0.9.7 stable 2002 05 08 merge
Diffstat (limited to 'src/lib/libcrypto/pkcs7')
| -rw-r--r-- | src/lib/libcrypto/pkcs7/Makefile.ssl | 199 | ||||
| -rw-r--r-- | src/lib/libcrypto/pkcs7/bio_ber.c | 6 | ||||
| -rw-r--r-- | src/lib/libcrypto/pkcs7/enc.c | 2 | ||||
| -rw-r--r-- | src/lib/libcrypto/pkcs7/example.c | 1 | ||||
| -rw-r--r-- | src/lib/libcrypto/pkcs7/pk7_asn1.c | 213 | ||||
| -rw-r--r-- | src/lib/libcrypto/pkcs7/pk7_attr.c | 60 | ||||
| -rw-r--r-- | src/lib/libcrypto/pkcs7/pk7_doit.c | 161 | ||||
| -rw-r--r-- | src/lib/libcrypto/pkcs7/pk7_lib.c | 22 | ||||
| -rw-r--r-- | src/lib/libcrypto/pkcs7/pk7_smime.c | 25 | ||||
| -rw-r--r-- | src/lib/libcrypto/pkcs7/pkcs7.h | 104 | ||||
| -rw-r--r-- | src/lib/libcrypto/pkcs7/pkcs7err.c | 5 | ||||
| -rw-r--r-- | src/lib/libcrypto/pkcs7/sign.c | 8 | ||||
| -rw-r--r-- | src/lib/libcrypto/pkcs7/verify.c | 8 |
13 files changed, 524 insertions, 290 deletions
diff --git a/src/lib/libcrypto/pkcs7/Makefile.ssl b/src/lib/libcrypto/pkcs7/Makefile.ssl index 37b72f0890..3f0c3452e5 100644 --- a/src/lib/libcrypto/pkcs7/Makefile.ssl +++ b/src/lib/libcrypto/pkcs7/Makefile.ssl | |||
| @@ -5,13 +5,14 @@ | |||
| 5 | DIR= pkcs7 | 5 | DIR= pkcs7 |
| 6 | TOP= ../.. | 6 | TOP= ../.. |
| 7 | CC= cc | 7 | CC= cc |
| 8 | INCLUDES= -I.. -I../../include | 8 | INCLUDES= -I.. -I$(TOP) -I../../include |
| 9 | CFLAG=-g | 9 | CFLAG=-g |
| 10 | INSTALL_PREFIX= | 10 | INSTALL_PREFIX= |
| 11 | OPENSSLDIR= /usr/local/ssl | 11 | OPENSSLDIR= /usr/local/ssl |
| 12 | INSTALLTOP=/usr/local/ssl | 12 | INSTALLTOP=/usr/local/ssl |
| 13 | MAKE= make -f Makefile.ssl | 13 | MAKE= make -f Makefile.ssl |
| 14 | MAKEDEPEND= $(TOP)/util/domd $(TOP) | 14 | MAKEDEPPROG= makedepend |
| 15 | MAKEDEPEND= $(TOP)/util/domd $(TOP) -MD $(MAKEDEPPROG) | ||
| 15 | MAKEFILE= Makefile.ssl | 16 | MAKEFILE= Makefile.ssl |
| 16 | AR= ar r | 17 | AR= ar r |
| 17 | 18 | ||
| @@ -25,8 +26,10 @@ TEST= | |||
| 25 | APPS= | 26 | APPS= |
| 26 | 27 | ||
| 27 | LIB=$(TOP)/libcrypto.a | 28 | LIB=$(TOP)/libcrypto.a |
| 28 | LIBSRC= pk7_lib.c pkcs7err.c pk7_doit.c pk7_smime.c pk7_attr.c pk7_mime.c | 29 | LIBSRC= pk7_asn1.c pk7_lib.c pkcs7err.c pk7_doit.c pk7_smime.c pk7_attr.c \ |
| 29 | LIBOBJ= pk7_lib.o pkcs7err.o pk7_doit.o pk7_smime.o pk7_attr.o pk7_mime.o | 30 | pk7_mime.c |
| 31 | LIBOBJ= pk7_asn1.o pk7_lib.o pkcs7err.o pk7_doit.o pk7_smime.o pk7_attr.o \ | ||
| 32 | pk7_mime.o | ||
| 30 | 33 | ||
| 31 | SRC= $(LIBSRC) | 34 | SRC= $(LIBSRC) |
| 32 | 35 | ||
| @@ -58,8 +61,7 @@ verify: verify.o example.o lib | |||
| 58 | 61 | ||
| 59 | lib: $(LIBOBJ) | 62 | lib: $(LIBOBJ) |
| 60 | $(AR) $(LIB) $(LIBOBJ) | 63 | $(AR) $(LIB) $(LIBOBJ) |
| 61 | @echo You may get an error following this line. Please ignore. | 64 | $(RANLIB) $(LIB) || echo Never mind. |
| 62 | - $(RANLIB) $(LIB) | ||
| 63 | @touch lib | 65 | @touch lib |
| 64 | 66 | ||
| 65 | files: | 67 | files: |
| @@ -98,121 +100,96 @@ clean: | |||
| 98 | 100 | ||
| 99 | # DO NOT DELETE THIS LINE -- make depend depends on it. | 101 | # DO NOT DELETE THIS LINE -- make depend depends on it. |
| 100 | 102 | ||
| 103 | pk7_asn1.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 104 | pk7_asn1.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h | ||
| 105 | pk7_asn1.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h | ||
| 106 | pk7_asn1.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h | ||
| 107 | pk7_asn1.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h | ||
| 108 | pk7_asn1.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 109 | pk7_asn1.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | ||
| 110 | pk7_asn1.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 111 | pk7_asn1.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 112 | pk7_asn1.o: ../../include/openssl/pkcs7.h ../../include/openssl/rsa.h | ||
| 113 | pk7_asn1.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 114 | pk7_asn1.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 115 | pk7_asn1.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 116 | pk7_asn1.o: ../cryptlib.h pk7_asn1.c | ||
| 101 | pk7_attr.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | 117 | pk7_attr.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h |
| 102 | pk7_attr.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h | 118 | pk7_attr.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h |
| 103 | pk7_attr.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h | 119 | pk7_attr.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h |
| 104 | pk7_attr.o: ../../include/openssl/crypto.h ../../include/openssl/des.h | 120 | pk7_attr.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h |
| 105 | pk7_attr.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h | 121 | pk7_attr.o: ../../include/openssl/err.h ../../include/openssl/evp.h |
| 106 | pk7_attr.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | 122 | pk7_attr.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h |
| 107 | pk7_attr.o: ../../include/openssl/evp.h ../../include/openssl/idea.h | ||
| 108 | pk7_attr.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h | ||
| 109 | pk7_attr.o: ../../include/openssl/md4.h ../../include/openssl/md5.h | ||
| 110 | pk7_attr.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h | ||
| 111 | pk7_attr.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | 123 | pk7_attr.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h |
| 112 | pk7_attr.o: ../../include/openssl/opensslv.h ../../include/openssl/pem.h | 124 | pk7_attr.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h |
| 113 | pk7_attr.o: ../../include/openssl/pem2.h ../../include/openssl/pkcs7.h | 125 | pk7_attr.o: ../../include/openssl/pem.h ../../include/openssl/pem2.h |
| 114 | pk7_attr.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h | 126 | pk7_attr.o: ../../include/openssl/pkcs7.h ../../include/openssl/rsa.h |
| 115 | pk7_attr.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h | 127 | pk7_attr.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h |
| 116 | pk7_attr.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h | 128 | pk7_attr.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h |
| 117 | pk7_attr.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | 129 | pk7_attr.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h |
| 118 | pk7_attr.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | 130 | pk7_attr.o: pk7_attr.c |
| 119 | pk7_attr.o: ../../include/openssl/x509_vfy.h | 131 | pk7_doit.o: ../../e_os.h ../../include/openssl/asn1.h |
| 120 | pk7_doit.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | 132 | pk7_doit.o: ../../include/openssl/bio.h ../../include/openssl/bn.h |
| 121 | pk7_doit.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h | 133 | pk7_doit.o: ../../include/openssl/buffer.h ../../include/openssl/conf.h |
| 122 | pk7_doit.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h | 134 | pk7_doit.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h |
| 123 | pk7_doit.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h | 135 | pk7_doit.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h |
| 124 | pk7_doit.o: ../../include/openssl/des.h ../../include/openssl/dh.h | ||
| 125 | pk7_doit.o: ../../include/openssl/dsa.h ../../include/openssl/e_os.h | ||
| 126 | pk7_doit.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h | ||
| 127 | pk7_doit.o: ../../include/openssl/err.h ../../include/openssl/evp.h | 136 | pk7_doit.o: ../../include/openssl/err.h ../../include/openssl/evp.h |
| 128 | pk7_doit.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h | 137 | pk7_doit.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h |
| 129 | pk7_doit.o: ../../include/openssl/md2.h ../../include/openssl/md4.h | 138 | pk7_doit.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h |
| 130 | pk7_doit.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h | 139 | pk7_doit.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h |
| 131 | pk7_doit.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | 140 | pk7_doit.o: ../../include/openssl/pkcs7.h ../../include/openssl/rand.h |
| 132 | pk7_doit.o: ../../include/openssl/opensslconf.h | 141 | pk7_doit.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h |
| 133 | pk7_doit.o: ../../include/openssl/opensslv.h ../../include/openssl/pkcs7.h | 142 | pk7_doit.o: ../../include/openssl/sha.h ../../include/openssl/stack.h |
| 134 | pk7_doit.o: ../../include/openssl/rand.h ../../include/openssl/rc2.h | 143 | pk7_doit.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h |
| 135 | pk7_doit.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h | 144 | pk7_doit.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h |
| 136 | pk7_doit.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h | 145 | pk7_doit.o: ../cryptlib.h pk7_doit.c |
| 137 | pk7_doit.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | 146 | pk7_lib.o: ../../e_os.h ../../include/openssl/asn1.h |
| 138 | pk7_doit.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | 147 | pk7_lib.o: ../../include/openssl/bio.h ../../include/openssl/bn.h |
| 139 | pk7_doit.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | 148 | pk7_lib.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h |
| 140 | pk7_doit.o: ../../include/openssl/x509v3.h ../cryptlib.h | ||
| 141 | pk7_lib.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 142 | pk7_lib.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h | ||
| 143 | pk7_lib.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h | ||
| 144 | pk7_lib.o: ../../include/openssl/crypto.h ../../include/openssl/des.h | ||
| 145 | pk7_lib.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h | 149 | pk7_lib.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h |
| 146 | pk7_lib.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h | 150 | pk7_lib.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h |
| 147 | pk7_lib.o: ../../include/openssl/err.h ../../include/openssl/evp.h | 151 | pk7_lib.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h |
| 148 | pk7_lib.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h | ||
| 149 | pk7_lib.o: ../../include/openssl/md2.h ../../include/openssl/md4.h | ||
| 150 | pk7_lib.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h | ||
| 151 | pk7_lib.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | 152 | pk7_lib.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h |
| 152 | pk7_lib.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | 153 | pk7_lib.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h |
| 153 | pk7_lib.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h | 154 | pk7_lib.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h |
| 154 | pk7_lib.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h | 155 | pk7_lib.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h |
| 155 | pk7_lib.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h | 156 | pk7_lib.o: ../../include/openssl/sha.h ../../include/openssl/stack.h |
| 156 | pk7_lib.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | 157 | pk7_lib.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h |
| 157 | pk7_lib.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | 158 | pk7_lib.o: ../../include/openssl/x509_vfy.h ../cryptlib.h pk7_lib.c |
| 158 | pk7_lib.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | 159 | pk7_mime.o: ../../e_os.h ../../include/openssl/asn1.h |
| 159 | pk7_lib.o: ../cryptlib.h | 160 | pk7_mime.o: ../../include/openssl/bio.h ../../include/openssl/bn.h |
| 160 | pk7_mime.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | 161 | pk7_mime.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h |
| 161 | pk7_mime.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h | ||
| 162 | pk7_mime.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h | ||
| 163 | pk7_mime.o: ../../include/openssl/crypto.h ../../include/openssl/des.h | ||
| 164 | pk7_mime.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h | 162 | pk7_mime.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h |
| 165 | pk7_mime.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h | 163 | pk7_mime.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h |
| 166 | pk7_mime.o: ../../include/openssl/err.h ../../include/openssl/evp.h | 164 | pk7_mime.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h |
| 167 | pk7_mime.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h | ||
| 168 | pk7_mime.o: ../../include/openssl/md2.h ../../include/openssl/md4.h | ||
| 169 | pk7_mime.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h | ||
| 170 | pk7_mime.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | 165 | pk7_mime.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h |
| 171 | pk7_mime.o: ../../include/openssl/opensslconf.h | 166 | pk7_mime.o: ../../include/openssl/opensslconf.h |
| 172 | pk7_mime.o: ../../include/openssl/opensslv.h ../../include/openssl/pkcs7.h | 167 | pk7_mime.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h |
| 173 | pk7_mime.o: ../../include/openssl/rand.h ../../include/openssl/rc2.h | 168 | pk7_mime.o: ../../include/openssl/pkcs7.h ../../include/openssl/rand.h |
| 174 | pk7_mime.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h | 169 | pk7_mime.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h |
| 175 | pk7_mime.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h | 170 | pk7_mime.o: ../../include/openssl/sha.h ../../include/openssl/stack.h |
| 176 | pk7_mime.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | 171 | pk7_mime.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h |
| 177 | pk7_mime.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | 172 | pk7_mime.o: ../../include/openssl/x509_vfy.h ../cryptlib.h pk7_mime.c |
| 178 | pk7_mime.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | 173 | pk7_smime.o: ../../e_os.h ../../include/openssl/asn1.h |
| 179 | pk7_mime.o: ../cryptlib.h | 174 | pk7_smime.o: ../../include/openssl/bio.h ../../include/openssl/bn.h |
| 180 | pk7_smime.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | 175 | pk7_smime.o: ../../include/openssl/buffer.h ../../include/openssl/conf.h |
| 181 | pk7_smime.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h | 176 | pk7_smime.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h |
| 182 | pk7_smime.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h | 177 | pk7_smime.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h |
| 183 | pk7_smime.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h | ||
| 184 | pk7_smime.o: ../../include/openssl/des.h ../../include/openssl/dh.h | ||
| 185 | pk7_smime.o: ../../include/openssl/dsa.h ../../include/openssl/e_os.h | ||
| 186 | pk7_smime.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h | ||
| 187 | pk7_smime.o: ../../include/openssl/err.h ../../include/openssl/evp.h | 178 | pk7_smime.o: ../../include/openssl/err.h ../../include/openssl/evp.h |
| 188 | pk7_smime.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h | 179 | pk7_smime.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h |
| 189 | pk7_smime.o: ../../include/openssl/md2.h ../../include/openssl/md4.h | 180 | pk7_smime.o: ../../include/openssl/objects.h |
| 190 | pk7_smime.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h | ||
| 191 | pk7_smime.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 192 | pk7_smime.o: ../../include/openssl/opensslconf.h | 181 | pk7_smime.o: ../../include/openssl/opensslconf.h |
| 193 | pk7_smime.o: ../../include/openssl/opensslv.h ../../include/openssl/pkcs7.h | 182 | pk7_smime.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h |
| 194 | pk7_smime.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h | 183 | pk7_smime.o: ../../include/openssl/pkcs7.h ../../include/openssl/rsa.h |
| 195 | pk7_smime.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h | 184 | pk7_smime.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h |
| 196 | pk7_smime.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h | 185 | pk7_smime.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h |
| 197 | pk7_smime.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | 186 | pk7_smime.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h |
| 198 | pk7_smime.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | 187 | pk7_smime.o: ../../include/openssl/x509v3.h ../cryptlib.h pk7_smime.c |
| 199 | pk7_smime.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h | ||
| 200 | pk7_smime.o: ../cryptlib.h | ||
| 201 | pkcs7err.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | 188 | pkcs7err.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h |
| 202 | pkcs7err.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h | 189 | pkcs7err.o: ../../include/openssl/bn.h ../../include/openssl/crypto.h |
| 203 | pkcs7err.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h | ||
| 204 | pkcs7err.o: ../../include/openssl/crypto.h ../../include/openssl/des.h | ||
| 205 | pkcs7err.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h | ||
| 206 | pkcs7err.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | 190 | pkcs7err.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h |
| 207 | pkcs7err.o: ../../include/openssl/evp.h ../../include/openssl/idea.h | 191 | pkcs7err.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h |
| 208 | pkcs7err.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h | 192 | pkcs7err.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h |
| 209 | pkcs7err.o: ../../include/openssl/md4.h ../../include/openssl/md5.h | 193 | pkcs7err.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h |
| 210 | pkcs7err.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h | 194 | pkcs7err.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h |
| 211 | pkcs7err.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | 195 | pkcs7err.o: pkcs7err.c |
| 212 | pkcs7err.o: ../../include/openssl/opensslv.h ../../include/openssl/pkcs7.h | ||
| 213 | pkcs7err.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h | ||
| 214 | pkcs7err.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h | ||
| 215 | pkcs7err.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h | ||
| 216 | pkcs7err.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 217 | pkcs7err.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | ||
| 218 | pkcs7err.o: ../../include/openssl/x509_vfy.h | ||
diff --git a/src/lib/libcrypto/pkcs7/bio_ber.c b/src/lib/libcrypto/pkcs7/bio_ber.c index 5447e69818..42331f7ab0 100644 --- a/src/lib/libcrypto/pkcs7/bio_ber.c +++ b/src/lib/libcrypto/pkcs7/bio_ber.c | |||
| @@ -339,7 +339,7 @@ static long ber_ctrl(BIO *b, int cmd, long num, char *ptr) | |||
| 339 | case BIO_CTRL_RESET: | 339 | case BIO_CTRL_RESET: |
| 340 | ctx->ok=1; | 340 | ctx->ok=1; |
| 341 | ctx->finished=0; | 341 | ctx->finished=0; |
| 342 | EVP_CipherInit(&(ctx->cipher),NULL,NULL,NULL, | 342 | EVP_CipherInit_ex(&(ctx->cipher),NULL,NULL,NULL,NULL, |
| 343 | ctx->cipher.berrypt); | 343 | ctx->cipher.berrypt); |
| 344 | ret=BIO_ctrl(b->next_bio,cmd,num,ptr); | 344 | ret=BIO_ctrl(b->next_bio,cmd,num,ptr); |
| 345 | break; | 345 | break; |
| @@ -376,7 +376,7 @@ again: | |||
| 376 | { | 376 | { |
| 377 | ctx->finished=1; | 377 | ctx->finished=1; |
| 378 | ctx->buf_off=0; | 378 | ctx->buf_off=0; |
| 379 | ret=EVP_CipherFinal(&(ctx->cipher), | 379 | ret=EVP_CipherFinal_ex(&(ctx->cipher), |
| 380 | (unsigned char *)ctx->buf, | 380 | (unsigned char *)ctx->buf, |
| 381 | &(ctx->buf_len)); | 381 | &(ctx->buf_len)); |
| 382 | ctx->ok=(int)ret; | 382 | ctx->ok=(int)ret; |
| @@ -458,7 +458,7 @@ void BIO_set_cipher(BIO *b, EVP_CIPHER *c, unsigned char *k, unsigned char *i, | |||
| 458 | 458 | ||
| 459 | b->init=1; | 459 | b->init=1; |
| 460 | ctx=(BIO_ENC_CTX *)b->ptr; | 460 | ctx=(BIO_ENC_CTX *)b->ptr; |
| 461 | EVP_CipherInit(&(ctx->cipher),c,k,i,e); | 461 | EVP_CipherInit_ex(&(ctx->cipher),c,NULL,k,i,e); |
| 462 | 462 | ||
| 463 | if (b->callback != NULL) | 463 | if (b->callback != NULL) |
| 464 | b->callback(b,BIO_CB_CTRL,(char *)c,BIO_CTRL_SET,e,1L); | 464 | b->callback(b,BIO_CB_CTRL,(char *)c,BIO_CTRL_SET,e,1L); |
diff --git a/src/lib/libcrypto/pkcs7/enc.c b/src/lib/libcrypto/pkcs7/enc.c index 2b56c2eff3..7417f8a4e0 100644 --- a/src/lib/libcrypto/pkcs7/enc.c +++ b/src/lib/libcrypto/pkcs7/enc.c | |||
| @@ -128,7 +128,7 @@ char *argv[]; | |||
| 128 | PKCS7_set_type(p7,NID_pkcs7_enveloped); | 128 | PKCS7_set_type(p7,NID_pkcs7_enveloped); |
| 129 | #endif | 129 | #endif |
| 130 | if(!cipher) { | 130 | if(!cipher) { |
| 131 | #ifndef NO_DES | 131 | #ifndef OPENSSL_NO_DES |
| 132 | cipher = EVP_des_ede3_cbc(); | 132 | cipher = EVP_des_ede3_cbc(); |
| 133 | #else | 133 | #else |
| 134 | fprintf(stderr, "No cipher selected\n"); | 134 | fprintf(stderr, "No cipher selected\n"); |
diff --git a/src/lib/libcrypto/pkcs7/example.c b/src/lib/libcrypto/pkcs7/example.c index f6656be28e..c993947cc3 100644 --- a/src/lib/libcrypto/pkcs7/example.c +++ b/src/lib/libcrypto/pkcs7/example.c | |||
| @@ -3,6 +3,7 @@ | |||
| 3 | #include <string.h> | 3 | #include <string.h> |
| 4 | #include <openssl/pkcs7.h> | 4 | #include <openssl/pkcs7.h> |
| 5 | #include <openssl/asn1_mac.h> | 5 | #include <openssl/asn1_mac.h> |
| 6 | #include <openssl/x509.h> | ||
| 6 | 7 | ||
| 7 | int add_signed_time(PKCS7_SIGNER_INFO *si) | 8 | int add_signed_time(PKCS7_SIGNER_INFO *si) |
| 8 | { | 9 | { |
diff --git a/src/lib/libcrypto/pkcs7/pk7_asn1.c b/src/lib/libcrypto/pkcs7/pk7_asn1.c new file mode 100644 index 0000000000..46f0fc9375 --- /dev/null +++ b/src/lib/libcrypto/pkcs7/pk7_asn1.c | |||
| @@ -0,0 +1,213 @@ | |||
| 1 | /* pk7_asn.c */ | ||
| 2 | /* Written by Dr Stephen N Henson (shenson@bigfoot.com) for the OpenSSL | ||
| 3 | * project 2000. | ||
| 4 | */ | ||
| 5 | /* ==================================================================== | ||
| 6 | * Copyright (c) 2000 The OpenSSL Project. All rights reserved. | ||
| 7 | * | ||
| 8 | * Redistribution and use in source and binary forms, with or without | ||
| 9 | * modification, are permitted provided that the following conditions | ||
| 10 | * are met: | ||
| 11 | * | ||
| 12 | * 1. Redistributions of source code must retain the above copyright | ||
| 13 | * notice, this list of conditions and the following disclaimer. | ||
| 14 | * | ||
| 15 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 16 | * notice, this list of conditions and the following disclaimer in | ||
| 17 | * the documentation and/or other materials provided with the | ||
| 18 | * distribution. | ||
| 19 | * | ||
| 20 | * 3. All advertising materials mentioning features or use of this | ||
| 21 | * software must display the following acknowledgment: | ||
| 22 | * "This product includes software developed by the OpenSSL Project | ||
| 23 | * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" | ||
| 24 | * | ||
| 25 | * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to | ||
| 26 | * endorse or promote products derived from this software without | ||
| 27 | * prior written permission. For written permission, please contact | ||
| 28 | * licensing@OpenSSL.org. | ||
| 29 | * | ||
| 30 | * 5. Products derived from this software may not be called "OpenSSL" | ||
| 31 | * nor may "OpenSSL" appear in their names without prior written | ||
| 32 | * permission of the OpenSSL Project. | ||
| 33 | * | ||
| 34 | * 6. Redistributions of any form whatsoever must retain the following | ||
| 35 | * acknowledgment: | ||
| 36 | * "This product includes software developed by the OpenSSL Project | ||
| 37 | * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" | ||
| 38 | * | ||
| 39 | * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY | ||
| 40 | * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 41 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
| 42 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR | ||
| 43 | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
| 44 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
| 45 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
| 46 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 47 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
| 48 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
| 49 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | ||
| 50 | * OF THE POSSIBILITY OF SUCH DAMAGE. | ||
| 51 | * ==================================================================== | ||
| 52 | * | ||
| 53 | * This product includes cryptographic software written by Eric Young | ||
| 54 | * (eay@cryptsoft.com). This product includes software written by Tim | ||
| 55 | * Hudson (tjh@cryptsoft.com). | ||
| 56 | * | ||
| 57 | */ | ||
| 58 | |||
| 59 | #include <stdio.h> | ||
| 60 | #include "cryptlib.h" | ||
| 61 | #include <openssl/asn1t.h> | ||
| 62 | #include <openssl/pkcs7.h> | ||
| 63 | #include <openssl/x509.h> | ||
| 64 | |||
| 65 | /* PKCS#7 ASN1 module */ | ||
| 66 | |||
| 67 | /* This is the ANY DEFINED BY table for the top level PKCS#7 structure */ | ||
| 68 | |||
| 69 | ASN1_ADB_TEMPLATE(p7default) = ASN1_EXP_OPT(PKCS7, d.other, ASN1_ANY, 0); | ||
| 70 | |||
| 71 | ASN1_ADB(PKCS7) = { | ||
| 72 | ADB_ENTRY(NID_pkcs7_data, ASN1_EXP_OPT(PKCS7, d.data, ASN1_OCTET_STRING, 0)), | ||
| 73 | ADB_ENTRY(NID_pkcs7_signed, ASN1_EXP_OPT(PKCS7, d.sign, PKCS7_SIGNED, 0)), | ||
| 74 | ADB_ENTRY(NID_pkcs7_enveloped, ASN1_EXP_OPT(PKCS7, d.enveloped, PKCS7_ENVELOPE, 0)), | ||
| 75 | ADB_ENTRY(NID_pkcs7_signedAndEnveloped, ASN1_EXP_OPT(PKCS7, d.signed_and_enveloped, PKCS7_SIGN_ENVELOPE, 0)), | ||
| 76 | ADB_ENTRY(NID_pkcs7_digest, ASN1_EXP_OPT(PKCS7, d.digest, PKCS7_DIGEST, 0)), | ||
| 77 | ADB_ENTRY(NID_pkcs7_encrypted, ASN1_EXP_OPT(PKCS7, d.encrypted, PKCS7_ENCRYPT, 0)) | ||
| 78 | } ASN1_ADB_END(PKCS7, 0, type, 0, &p7default_tt, NULL); | ||
| 79 | |||
| 80 | ASN1_SEQUENCE(PKCS7) = { | ||
| 81 | ASN1_SIMPLE(PKCS7, type, ASN1_OBJECT), | ||
| 82 | ASN1_ADB_OBJECT(PKCS7) | ||
| 83 | }ASN1_SEQUENCE_END(PKCS7) | ||
| 84 | |||
| 85 | IMPLEMENT_ASN1_FUNCTIONS(PKCS7) | ||
| 86 | IMPLEMENT_ASN1_DUP_FUNCTION(PKCS7) | ||
| 87 | |||
| 88 | ASN1_SEQUENCE(PKCS7_SIGNED) = { | ||
| 89 | ASN1_SIMPLE(PKCS7_SIGNED, version, ASN1_INTEGER), | ||
| 90 | ASN1_SET_OF(PKCS7_SIGNED, md_algs, X509_ALGOR), | ||
| 91 | ASN1_SIMPLE(PKCS7_SIGNED, contents, PKCS7), | ||
| 92 | ASN1_IMP_SEQUENCE_OF_OPT(PKCS7_SIGNED, cert, X509, 0), | ||
| 93 | ASN1_IMP_SET_OF_OPT(PKCS7_SIGNED, crl, X509_CRL, 1), | ||
| 94 | ASN1_SET_OF(PKCS7_SIGNED, signer_info, PKCS7_SIGNER_INFO) | ||
| 95 | } ASN1_SEQUENCE_END(PKCS7_SIGNED) | ||
| 96 | |||
| 97 | IMPLEMENT_ASN1_FUNCTIONS(PKCS7_SIGNED) | ||
| 98 | |||
| 99 | /* Minor tweak to operation: free up EVP_PKEY */ | ||
| 100 | static int si_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it) | ||
| 101 | { | ||
| 102 | if(operation == ASN1_OP_FREE_POST) { | ||
| 103 | PKCS7_SIGNER_INFO *si = (PKCS7_SIGNER_INFO *)*pval; | ||
| 104 | EVP_PKEY_free(si->pkey); | ||
| 105 | } | ||
| 106 | return 1; | ||
| 107 | } | ||
| 108 | |||
| 109 | ASN1_SEQUENCE_cb(PKCS7_SIGNER_INFO, si_cb) = { | ||
| 110 | ASN1_SIMPLE(PKCS7_SIGNER_INFO, version, ASN1_INTEGER), | ||
| 111 | ASN1_SIMPLE(PKCS7_SIGNER_INFO, issuer_and_serial, PKCS7_ISSUER_AND_SERIAL), | ||
| 112 | ASN1_SIMPLE(PKCS7_SIGNER_INFO, digest_alg, X509_ALGOR), | ||
| 113 | /* NB this should be a SET OF but we use a SEQUENCE OF so the | ||
| 114 | * original order * is retained when the structure is reencoded. | ||
| 115 | * Since the attributes are implicitly tagged this will not affect | ||
| 116 | * the encoding. | ||
| 117 | */ | ||
| 118 | ASN1_IMP_SEQUENCE_OF_OPT(PKCS7_SIGNER_INFO, auth_attr, X509_ATTRIBUTE, 0), | ||
| 119 | ASN1_SIMPLE(PKCS7_SIGNER_INFO, digest_enc_alg, X509_ALGOR), | ||
| 120 | ASN1_SIMPLE(PKCS7_SIGNER_INFO, enc_digest, ASN1_OCTET_STRING), | ||
| 121 | ASN1_IMP_SET_OF_OPT(PKCS7_SIGNER_INFO, unauth_attr, X509_ATTRIBUTE, 1) | ||
| 122 | } ASN1_SEQUENCE_END_cb(PKCS7_SIGNER_INFO, PKCS7_SIGNER_INFO) | ||
| 123 | |||
| 124 | IMPLEMENT_ASN1_FUNCTIONS(PKCS7_SIGNER_INFO) | ||
| 125 | |||
| 126 | ASN1_SEQUENCE(PKCS7_ISSUER_AND_SERIAL) = { | ||
| 127 | ASN1_SIMPLE(PKCS7_ISSUER_AND_SERIAL, issuer, X509_NAME), | ||
| 128 | ASN1_SIMPLE(PKCS7_ISSUER_AND_SERIAL, serial, ASN1_INTEGER) | ||
| 129 | } ASN1_SEQUENCE_END(PKCS7_ISSUER_AND_SERIAL) | ||
| 130 | |||
| 131 | IMPLEMENT_ASN1_FUNCTIONS(PKCS7_ISSUER_AND_SERIAL) | ||
| 132 | |||
| 133 | ASN1_SEQUENCE(PKCS7_ENVELOPE) = { | ||
| 134 | ASN1_SIMPLE(PKCS7_ENVELOPE, version, ASN1_INTEGER), | ||
| 135 | ASN1_SET_OF(PKCS7_ENVELOPE, recipientinfo, PKCS7_RECIP_INFO), | ||
| 136 | ASN1_SIMPLE(PKCS7_ENVELOPE, enc_data, PKCS7_ENC_CONTENT) | ||
| 137 | } ASN1_SEQUENCE_END(PKCS7_ENVELOPE) | ||
| 138 | |||
| 139 | IMPLEMENT_ASN1_FUNCTIONS(PKCS7_ENVELOPE) | ||
| 140 | |||
| 141 | /* Minor tweak to operation: free up X509 */ | ||
| 142 | static int ri_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it) | ||
| 143 | { | ||
| 144 | if(operation == ASN1_OP_FREE_POST) { | ||
| 145 | PKCS7_RECIP_INFO *ri = (PKCS7_RECIP_INFO *)*pval; | ||
| 146 | X509_free(ri->cert); | ||
| 147 | } | ||
| 148 | return 1; | ||
| 149 | } | ||
| 150 | |||
| 151 | ASN1_SEQUENCE_cb(PKCS7_RECIP_INFO, ri_cb) = { | ||
| 152 | ASN1_SIMPLE(PKCS7_RECIP_INFO, version, ASN1_INTEGER), | ||
| 153 | ASN1_SIMPLE(PKCS7_RECIP_INFO, issuer_and_serial, PKCS7_ISSUER_AND_SERIAL), | ||
| 154 | ASN1_SIMPLE(PKCS7_RECIP_INFO, key_enc_algor, X509_ALGOR), | ||
| 155 | ASN1_SIMPLE(PKCS7_RECIP_INFO, enc_key, ASN1_OCTET_STRING) | ||
| 156 | } ASN1_SEQUENCE_END_cb(PKCS7_RECIP_INFO, PKCS7_RECIP_INFO) | ||
| 157 | |||
| 158 | IMPLEMENT_ASN1_FUNCTIONS(PKCS7_RECIP_INFO) | ||
| 159 | |||
| 160 | ASN1_SEQUENCE(PKCS7_ENC_CONTENT) = { | ||
| 161 | ASN1_SIMPLE(PKCS7_ENC_CONTENT, content_type, ASN1_OBJECT), | ||
| 162 | ASN1_SIMPLE(PKCS7_ENC_CONTENT, algorithm, X509_ALGOR), | ||
| 163 | ASN1_IMP_OPT(PKCS7_ENC_CONTENT, enc_data, ASN1_OCTET_STRING, 0) | ||
| 164 | } ASN1_SEQUENCE_END(PKCS7_ENC_CONTENT) | ||
| 165 | |||
| 166 | IMPLEMENT_ASN1_FUNCTIONS(PKCS7_ENC_CONTENT) | ||
| 167 | |||
| 168 | ASN1_SEQUENCE(PKCS7_SIGN_ENVELOPE) = { | ||
| 169 | ASN1_SIMPLE(PKCS7_SIGN_ENVELOPE, version, ASN1_INTEGER), | ||
| 170 | ASN1_SET_OF(PKCS7_SIGN_ENVELOPE, recipientinfo, PKCS7_RECIP_INFO), | ||
| 171 | ASN1_SET_OF(PKCS7_SIGN_ENVELOPE, md_algs, X509_ALGOR), | ||
| 172 | ASN1_SIMPLE(PKCS7_SIGN_ENVELOPE, enc_data, PKCS7_ENC_CONTENT), | ||
| 173 | ASN1_IMP_SET_OF_OPT(PKCS7_SIGN_ENVELOPE, cert, X509, 0), | ||
| 174 | ASN1_IMP_SET_OF_OPT(PKCS7_SIGN_ENVELOPE, crl, X509_CRL, 1), | ||
| 175 | ASN1_SET_OF(PKCS7_SIGN_ENVELOPE, signer_info, PKCS7_SIGNER_INFO) | ||
| 176 | } ASN1_SEQUENCE_END(PKCS7_SIGN_ENVELOPE) | ||
| 177 | |||
| 178 | IMPLEMENT_ASN1_FUNCTIONS(PKCS7_SIGN_ENVELOPE) | ||
| 179 | |||
| 180 | ASN1_SEQUENCE(PKCS7_ENCRYPT) = { | ||
| 181 | ASN1_SIMPLE(PKCS7_ENCRYPT, version, ASN1_INTEGER), | ||
| 182 | ASN1_SIMPLE(PKCS7_ENCRYPT, enc_data, PKCS7_ENC_CONTENT) | ||
| 183 | } ASN1_SEQUENCE_END(PKCS7_ENCRYPT) | ||
| 184 | |||
| 185 | IMPLEMENT_ASN1_FUNCTIONS(PKCS7_ENCRYPT) | ||
| 186 | |||
| 187 | ASN1_SEQUENCE(PKCS7_DIGEST) = { | ||
| 188 | ASN1_SIMPLE(PKCS7_DIGEST, version, ASN1_INTEGER), | ||
| 189 | ASN1_SIMPLE(PKCS7_DIGEST, md, X509_ALGOR), | ||
| 190 | ASN1_SIMPLE(PKCS7_DIGEST, contents, PKCS7), | ||
| 191 | ASN1_SIMPLE(PKCS7_DIGEST, digest, ASN1_OCTET_STRING) | ||
| 192 | } ASN1_SEQUENCE_END(PKCS7_DIGEST) | ||
| 193 | |||
| 194 | IMPLEMENT_ASN1_FUNCTIONS(PKCS7_DIGEST) | ||
| 195 | |||
| 196 | /* Specials for authenticated attributes */ | ||
| 197 | |||
| 198 | /* When signing attributes we want to reorder them to match the sorted | ||
| 199 | * encoding. | ||
| 200 | */ | ||
| 201 | |||
| 202 | ASN1_ITEM_TEMPLATE(PKCS7_ATTR_SIGN) = | ||
| 203 | ASN1_EX_TEMPLATE_TYPE(ASN1_TFLG_SET_ORDER, 0, PKCS7_ATTRIBUTES, X509_ATTRIBUTE) | ||
| 204 | ASN1_ITEM_TEMPLATE_END(PKCS7_ATTR_SIGN) | ||
| 205 | |||
| 206 | /* When verifying attributes we need to use the received order. So | ||
| 207 | * we use SEQUENCE OF and tag it to SET OF | ||
| 208 | */ | ||
| 209 | |||
| 210 | ASN1_ITEM_TEMPLATE(PKCS7_ATTR_VERIFY) = | ||
| 211 | ASN1_EX_TEMPLATE_TYPE(ASN1_TFLG_SEQUENCE_OF | ASN1_TFLG_IMPTAG | ASN1_TFLG_UNIVERSAL, | ||
| 212 | V_ASN1_SET, PKCS7_ATTRIBUTES, X509_ATTRIBUTE) | ||
| 213 | ASN1_ITEM_TEMPLATE_END(PKCS7_ATTR_VERIFY) | ||
diff --git a/src/lib/libcrypto/pkcs7/pk7_attr.c b/src/lib/libcrypto/pkcs7/pk7_attr.c index 6ae264cbf9..5ff5a88b5c 100644 --- a/src/lib/libcrypto/pkcs7/pk7_attr.c +++ b/src/lib/libcrypto/pkcs7/pk7_attr.c | |||
| @@ -1,9 +1,59 @@ | |||
| 1 | /* pk7_attr.c */ | 1 | /* pk7_attr.c */ |
| 2 | /* S/MIME code. | 2 | /* Written by Dr Stephen N Henson (shenson@bigfoot.com) for the OpenSSL |
| 3 | * Copyright (C) 1997-8 Dr S N Henson (shenson@bigfoot.com) | 3 | * project 2001. |
| 4 | * All Rights Reserved. | 4 | */ |
| 5 | * Redistribution of this code without the authors permission is expressly | 5 | /* ==================================================================== |
| 6 | * prohibited. | 6 | * Copyright (c) 2001 The OpenSSL Project. All rights reserved. |
| 7 | * | ||
| 8 | * Redistribution and use in source and binary forms, with or without | ||
| 9 | * modification, are permitted provided that the following conditions | ||
| 10 | * are met: | ||
| 11 | * | ||
| 12 | * 1. Redistributions of source code must retain the above copyright | ||
| 13 | * notice, this list of conditions and the following disclaimer. | ||
| 14 | * | ||
| 15 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 16 | * notice, this list of conditions and the following disclaimer in | ||
| 17 | * the documentation and/or other materials provided with the | ||
| 18 | * distribution. | ||
| 19 | * | ||
| 20 | * 3. All advertising materials mentioning features or use of this | ||
| 21 | * software must display the following acknowledgment: | ||
| 22 | * "This product includes software developed by the OpenSSL Project | ||
| 23 | * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" | ||
| 24 | * | ||
| 25 | * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to | ||
| 26 | * endorse or promote products derived from this software without | ||
| 27 | * prior written permission. For written permission, please contact | ||
| 28 | * licensing@OpenSSL.org. | ||
| 29 | * | ||
| 30 | * 5. Products derived from this software may not be called "OpenSSL" | ||
| 31 | * nor may "OpenSSL" appear in their names without prior written | ||
| 32 | * permission of the OpenSSL Project. | ||
| 33 | * | ||
| 34 | * 6. Redistributions of any form whatsoever must retain the following | ||
| 35 | * acknowledgment: | ||
| 36 | * "This product includes software developed by the OpenSSL Project | ||
| 37 | * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" | ||
| 38 | * | ||
| 39 | * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY | ||
| 40 | * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 41 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
| 42 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR | ||
| 43 | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
| 44 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
| 45 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
| 46 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 47 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
| 48 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
| 49 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | ||
| 50 | * OF THE POSSIBILITY OF SUCH DAMAGE. | ||
| 51 | * ==================================================================== | ||
| 52 | * | ||
| 53 | * This product includes cryptographic software written by Eric Young | ||
| 54 | * (eay@cryptsoft.com). This product includes software written by Tim | ||
| 55 | * Hudson (tjh@cryptsoft.com). | ||
| 56 | * | ||
| 7 | */ | 57 | */ |
| 8 | 58 | ||
| 9 | #include <stdio.h> | 59 | #include <stdio.h> |
diff --git a/src/lib/libcrypto/pkcs7/pk7_doit.c b/src/lib/libcrypto/pkcs7/pk7_doit.c index bf43d030ad..4a4ff340ce 100644 --- a/src/lib/libcrypto/pkcs7/pk7_doit.c +++ b/src/lib/libcrypto/pkcs7/pk7_doit.c | |||
| @@ -67,6 +67,38 @@ static int add_attribute(STACK_OF(X509_ATTRIBUTE) **sk, int nid, int atrtype, | |||
| 67 | void *value); | 67 | void *value); |
| 68 | static ASN1_TYPE *get_attribute(STACK_OF(X509_ATTRIBUTE) *sk, int nid); | 68 | static ASN1_TYPE *get_attribute(STACK_OF(X509_ATTRIBUTE) *sk, int nid); |
| 69 | 69 | ||
| 70 | static int PKCS7_type_is_other(PKCS7* p7) | ||
| 71 | { | ||
| 72 | int isOther=1; | ||
| 73 | |||
| 74 | int nid=OBJ_obj2nid(p7->type); | ||
| 75 | |||
| 76 | switch( nid ) | ||
| 77 | { | ||
| 78 | case NID_pkcs7_data: | ||
| 79 | case NID_pkcs7_signed: | ||
| 80 | case NID_pkcs7_enveloped: | ||
| 81 | case NID_pkcs7_signedAndEnveloped: | ||
| 82 | case NID_pkcs7_digest: | ||
| 83 | case NID_pkcs7_encrypted: | ||
| 84 | isOther=0; | ||
| 85 | break; | ||
| 86 | default: | ||
| 87 | isOther=1; | ||
| 88 | } | ||
| 89 | |||
| 90 | return isOther; | ||
| 91 | |||
| 92 | } | ||
| 93 | |||
| 94 | static int PKCS7_type_is_octet_string(PKCS7* p7) | ||
| 95 | { | ||
| 96 | if ( 0==PKCS7_type_is_other(p7) ) | ||
| 97 | return 0; | ||
| 98 | |||
| 99 | return (V_ASN1_OCTET_STRING==p7->d.other->type) ? 1 : 0; | ||
| 100 | } | ||
| 101 | |||
| 70 | BIO *PKCS7_dataInit(PKCS7 *p7, BIO *bio) | 102 | BIO *PKCS7_dataInit(PKCS7 *p7, BIO *bio) |
| 71 | { | 103 | { |
| 72 | int i,j; | 104 | int i,j; |
| @@ -165,7 +197,7 @@ BIO *PKCS7_dataInit(PKCS7 *p7, BIO *bio) | |||
| 165 | goto err; | 197 | goto err; |
| 166 | xalg->algorithm = OBJ_nid2obj(EVP_CIPHER_type(evp_cipher)); | 198 | xalg->algorithm = OBJ_nid2obj(EVP_CIPHER_type(evp_cipher)); |
| 167 | if (ivlen > 0) RAND_pseudo_bytes(iv,ivlen); | 199 | if (ivlen > 0) RAND_pseudo_bytes(iv,ivlen); |
| 168 | EVP_CipherInit(ctx, evp_cipher, key, iv, 1); | 200 | EVP_CipherInit_ex(ctx, evp_cipher, NULL, key, iv, 1); |
| 169 | 201 | ||
| 170 | if (ivlen > 0) { | 202 | if (ivlen > 0) { |
| 171 | if (xalg->parameter == NULL) | 203 | if (xalg->parameter == NULL) |
| @@ -219,16 +251,23 @@ BIO *PKCS7_dataInit(PKCS7 *p7, BIO *bio) | |||
| 219 | } | 251 | } |
| 220 | 252 | ||
| 221 | if (bio == NULL) { | 253 | if (bio == NULL) { |
| 222 | if (p7->detached) | 254 | if (PKCS7_is_detached(p7)) |
| 223 | bio=BIO_new(BIO_s_null()); | 255 | bio=BIO_new(BIO_s_null()); |
| 224 | else { | 256 | else { |
| 225 | if (PKCS7_type_is_signed(p7) && | 257 | if (PKCS7_type_is_signed(p7) ) { |
| 226 | PKCS7_type_is_data(p7->d.sign->contents)) { | 258 | if ( PKCS7_type_is_data(p7->d.sign->contents)) { |
| 227 | ASN1_OCTET_STRING *os; | 259 | ASN1_OCTET_STRING *os; |
| 228 | os=p7->d.sign->contents->d.data; | 260 | os=p7->d.sign->contents->d.data; |
| 229 | if (os->length > 0) bio = | 261 | if (os->length > 0) |
| 230 | BIO_new_mem_buf(os->data, os->length); | 262 | bio = BIO_new_mem_buf(os->data, os->length); |
| 231 | } | 263 | } |
| 264 | else if ( PKCS7_type_is_octet_string(p7->d.sign->contents) ) { | ||
| 265 | ASN1_OCTET_STRING *os; | ||
| 266 | os=p7->d.sign->contents->d.other->value.octet_string; | ||
| 267 | if (os->length > 0) | ||
| 268 | bio = BIO_new_mem_buf(os->data, os->length); | ||
| 269 | } | ||
| 270 | } | ||
| 232 | if(bio == NULL) { | 271 | if(bio == NULL) { |
| 233 | bio=BIO_new(BIO_s_mem()); | 272 | bio=BIO_new(BIO_s_mem()); |
| 234 | BIO_set_mem_eof_return(bio,0); | 273 | BIO_set_mem_eof_return(bio,0); |
| @@ -391,7 +430,7 @@ BIO *PKCS7_dataDecode(PKCS7 *p7, EVP_PKEY *pkey, BIO *in_bio, X509 *pcert) | |||
| 391 | 430 | ||
| 392 | evp_ctx=NULL; | 431 | evp_ctx=NULL; |
| 393 | BIO_get_cipher_ctx(etmp,&evp_ctx); | 432 | BIO_get_cipher_ctx(etmp,&evp_ctx); |
| 394 | EVP_CipherInit(evp_ctx,evp_cipher,NULL,NULL,0); | 433 | EVP_CipherInit_ex(evp_ctx,evp_cipher,NULL,NULL,NULL,0); |
| 395 | if (EVP_CIPHER_asn1_to_param(evp_ctx,enc_alg->parameter) < 0) | 434 | if (EVP_CIPHER_asn1_to_param(evp_ctx,enc_alg->parameter) < 0) |
| 396 | goto err; | 435 | goto err; |
| 397 | 436 | ||
| @@ -407,7 +446,7 @@ BIO *PKCS7_dataDecode(PKCS7 *p7, EVP_PKEY *pkey, BIO *in_bio, X509 *pcert) | |||
| 407 | goto err; | 446 | goto err; |
| 408 | } | 447 | } |
| 409 | } | 448 | } |
| 410 | EVP_CipherInit(evp_ctx,NULL,tmp,NULL,0); | 449 | EVP_CipherInit_ex(evp_ctx,NULL,NULL,tmp,NULL,0); |
| 411 | 450 | ||
| 412 | memset(tmp,0,jj); | 451 | memset(tmp,0,jj); |
| 413 | 452 | ||
| @@ -419,7 +458,7 @@ BIO *PKCS7_dataDecode(PKCS7 *p7, EVP_PKEY *pkey, BIO *in_bio, X509 *pcert) | |||
| 419 | } | 458 | } |
| 420 | 459 | ||
| 421 | #if 1 | 460 | #if 1 |
| 422 | if (p7->detached || (in_bio != NULL)) | 461 | if (PKCS7_is_detached(p7) || (in_bio != NULL)) |
| 423 | { | 462 | { |
| 424 | bio=in_bio; | 463 | bio=in_bio; |
| 425 | } | 464 | } |
| @@ -471,10 +510,9 @@ int PKCS7_dataFinal(PKCS7 *p7, BIO *bio) | |||
| 471 | EVP_MD_CTX *mdc,ctx_tmp; | 510 | EVP_MD_CTX *mdc,ctx_tmp; |
| 472 | STACK_OF(X509_ATTRIBUTE) *sk; | 511 | STACK_OF(X509_ATTRIBUTE) *sk; |
| 473 | STACK_OF(PKCS7_SIGNER_INFO) *si_sk=NULL; | 512 | STACK_OF(PKCS7_SIGNER_INFO) *si_sk=NULL; |
| 474 | unsigned char *p,*pp=NULL; | ||
| 475 | int x; | ||
| 476 | ASN1_OCTET_STRING *os=NULL; | 513 | ASN1_OCTET_STRING *os=NULL; |
| 477 | 514 | ||
| 515 | EVP_MD_CTX_init(&ctx_tmp); | ||
| 478 | i=OBJ_obj2nid(p7->type); | 516 | i=OBJ_obj2nid(p7->type); |
| 479 | p7->state=PKCS7_S_HEADER; | 517 | p7->state=PKCS7_S_HEADER; |
| 480 | 518 | ||
| @@ -528,7 +566,7 @@ int PKCS7_dataFinal(PKCS7 *p7, BIO *bio) | |||
| 528 | BIO_get_md_ctx(btmp,&mdc); | 566 | BIO_get_md_ctx(btmp,&mdc); |
| 529 | if (mdc == NULL) | 567 | if (mdc == NULL) |
| 530 | { | 568 | { |
| 531 | PKCS7err(PKCS7_F_PKCS7_DATASIGN,PKCS7_R_INTERNAL_ERROR); | 569 | PKCS7err(PKCS7_F_PKCS7_DATASIGN,ERR_R_INTERNAL_ERROR); |
| 532 | goto err; | 570 | goto err; |
| 533 | } | 571 | } |
| 534 | if (EVP_MD_CTX_type(mdc) == j) | 572 | if (EVP_MD_CTX_type(mdc) == j) |
| @@ -539,7 +577,7 @@ int PKCS7_dataFinal(PKCS7 *p7, BIO *bio) | |||
| 539 | 577 | ||
| 540 | /* We now have the EVP_MD_CTX, lets do the | 578 | /* We now have the EVP_MD_CTX, lets do the |
| 541 | * signing. */ | 579 | * signing. */ |
| 542 | memcpy(&ctx_tmp,mdc,sizeof(ctx_tmp)); | 580 | EVP_MD_CTX_copy_ex(&ctx_tmp,mdc); |
| 543 | if (!BUF_MEM_grow(buf,EVP_PKEY_size(si->pkey))) | 581 | if (!BUF_MEM_grow(buf,EVP_PKEY_size(si->pkey))) |
| 544 | { | 582 | { |
| 545 | PKCS7err(PKCS7_F_PKCS7_DATASIGN,ERR_R_BIO_LIB); | 583 | PKCS7err(PKCS7_F_PKCS7_DATASIGN,ERR_R_BIO_LIB); |
| @@ -552,43 +590,41 @@ int PKCS7_dataFinal(PKCS7 *p7, BIO *bio) | |||
| 552 | * attribute and only sign the attributes */ | 590 | * attribute and only sign the attributes */ |
| 553 | if ((sk != NULL) && (sk_X509_ATTRIBUTE_num(sk) != 0)) | 591 | if ((sk != NULL) && (sk_X509_ATTRIBUTE_num(sk) != 0)) |
| 554 | { | 592 | { |
| 555 | unsigned char md_data[EVP_MAX_MD_SIZE]; | 593 | unsigned char md_data[EVP_MAX_MD_SIZE], *abuf=NULL; |
| 556 | unsigned int md_len; | 594 | unsigned int md_len, alen; |
| 557 | ASN1_OCTET_STRING *digest; | 595 | ASN1_OCTET_STRING *digest; |
| 558 | ASN1_UTCTIME *sign_time; | 596 | ASN1_UTCTIME *sign_time; |
| 559 | const EVP_MD *md_tmp; | 597 | const EVP_MD *md_tmp; |
| 560 | 598 | ||
| 561 | /* Add signing time */ | 599 | /* Add signing time if not already present */ |
| 562 | sign_time=X509_gmtime_adj(NULL,0); | 600 | if (!PKCS7_get_signed_attribute(si, |
| 563 | PKCS7_add_signed_attribute(si, | 601 | NID_pkcs9_signingTime)) |
| 564 | NID_pkcs9_signingTime, | 602 | { |
| 565 | V_ASN1_UTCTIME,sign_time); | 603 | sign_time=X509_gmtime_adj(NULL,0); |
| 604 | PKCS7_add_signed_attribute(si, | ||
| 605 | NID_pkcs9_signingTime, | ||
| 606 | V_ASN1_UTCTIME,sign_time); | ||
| 607 | } | ||
| 566 | 608 | ||
| 567 | /* Add digest */ | 609 | /* Add digest */ |
| 568 | md_tmp=EVP_MD_CTX_md(&ctx_tmp); | 610 | md_tmp=EVP_MD_CTX_md(&ctx_tmp); |
| 569 | EVP_DigestFinal(&ctx_tmp,md_data,&md_len); | 611 | EVP_DigestFinal_ex(&ctx_tmp,md_data,&md_len); |
| 570 | digest=M_ASN1_OCTET_STRING_new(); | 612 | digest=M_ASN1_OCTET_STRING_new(); |
| 571 | M_ASN1_OCTET_STRING_set(digest,md_data,md_len); | 613 | M_ASN1_OCTET_STRING_set(digest,md_data,md_len); |
| 572 | PKCS7_add_signed_attribute(si, | 614 | PKCS7_add_signed_attribute(si, |
| 573 | NID_pkcs9_messageDigest, | 615 | NID_pkcs9_messageDigest, |
| 574 | V_ASN1_OCTET_STRING,digest); | 616 | V_ASN1_OCTET_STRING,digest); |
| 575 | 617 | ||
| 576 | /* Now sign the mess */ | 618 | /* Now sign the attributes */ |
| 577 | EVP_SignInit(&ctx_tmp,md_tmp); | 619 | EVP_SignInit_ex(&ctx_tmp,md_tmp,NULL); |
| 578 | x=i2d_ASN1_SET_OF_X509_ATTRIBUTE(sk,NULL, | 620 | alen = ASN1_item_i2d((ASN1_VALUE *)sk,&abuf, |
| 579 | i2d_X509_ATTRIBUTE, | 621 | ASN1_ITEM_rptr(PKCS7_ATTR_SIGN)); |
| 580 | V_ASN1_SET,V_ASN1_UNIVERSAL,IS_SET); | 622 | if(!abuf) goto err; |
| 581 | pp=(unsigned char *)OPENSSL_malloc(x); | 623 | EVP_SignUpdate(&ctx_tmp,abuf,alen); |
| 582 | p=pp; | 624 | OPENSSL_free(abuf); |
| 583 | i2d_ASN1_SET_OF_X509_ATTRIBUTE(sk,&p, | ||
| 584 | i2d_X509_ATTRIBUTE, | ||
| 585 | V_ASN1_SET,V_ASN1_UNIVERSAL,IS_SET); | ||
| 586 | EVP_SignUpdate(&ctx_tmp,pp,x); | ||
| 587 | OPENSSL_free(pp); | ||
| 588 | pp=NULL; | ||
| 589 | } | 625 | } |
| 590 | 626 | ||
| 591 | #ifndef NO_DSA | 627 | #ifndef OPENSSL_NO_DSA |
| 592 | if (si->pkey->type == EVP_PKEY_DSA) | 628 | if (si->pkey->type == EVP_PKEY_DSA) |
| 593 | ctx_tmp.digest=EVP_dss1(); | 629 | ctx_tmp.digest=EVP_dss1(); |
| 594 | #endif | 630 | #endif |
| @@ -608,7 +644,7 @@ int PKCS7_dataFinal(PKCS7 *p7, BIO *bio) | |||
| 608 | } | 644 | } |
| 609 | } | 645 | } |
| 610 | 646 | ||
| 611 | if (!p7->detached) | 647 | if (!PKCS7_is_detached(p7)) |
| 612 | { | 648 | { |
| 613 | btmp=BIO_find_type(bio,BIO_TYPE_MEM); | 649 | btmp=BIO_find_type(bio,BIO_TYPE_MEM); |
| 614 | if (btmp == NULL) | 650 | if (btmp == NULL) |
| @@ -629,11 +665,9 @@ int PKCS7_dataFinal(PKCS7 *p7, BIO *bio) | |||
| 629 | (unsigned char *)buf_mem->data,buf_mem->length); | 665 | (unsigned char *)buf_mem->data,buf_mem->length); |
| 630 | #endif | 666 | #endif |
| 631 | } | 667 | } |
| 632 | if (pp != NULL) OPENSSL_free(pp); | ||
| 633 | pp=NULL; | ||
| 634 | |||
| 635 | ret=1; | 668 | ret=1; |
| 636 | err: | 669 | err: |
| 670 | EVP_MD_CTX_cleanup(&ctx_tmp); | ||
| 637 | if (buf != NULL) BUF_MEM_free(buf); | 671 | if (buf != NULL) BUF_MEM_free(buf); |
| 638 | return(ret); | 672 | return(ret); |
| 639 | } | 673 | } |
| @@ -672,7 +706,11 @@ int PKCS7_dataVerify(X509_STORE *cert_store, X509_STORE_CTX *ctx, BIO *bio, | |||
| 672 | } | 706 | } |
| 673 | 707 | ||
| 674 | /* Lets verify */ | 708 | /* Lets verify */ |
| 675 | X509_STORE_CTX_init(ctx,cert_store,x509,cert); | 709 | if(!X509_STORE_CTX_init(ctx,cert_store,x509,cert)) |
| 710 | { | ||
| 711 | PKCS7err(PKCS7_F_PKCS7_DATAVERIFY,ERR_R_X509_LIB); | ||
| 712 | goto err; | ||
| 713 | } | ||
| 676 | X509_STORE_CTX_set_purpose(ctx, X509_PURPOSE_SMIME_SIGN); | 714 | X509_STORE_CTX_set_purpose(ctx, X509_PURPOSE_SMIME_SIGN); |
| 677 | i=X509_verify_cert(ctx); | 715 | i=X509_verify_cert(ctx); |
| 678 | if (i <= 0) | 716 | if (i <= 0) |
| @@ -693,13 +731,14 @@ int PKCS7_signatureVerify(BIO *bio, PKCS7 *p7, PKCS7_SIGNER_INFO *si, | |||
| 693 | { | 731 | { |
| 694 | ASN1_OCTET_STRING *os; | 732 | ASN1_OCTET_STRING *os; |
| 695 | EVP_MD_CTX mdc_tmp,*mdc; | 733 | EVP_MD_CTX mdc_tmp,*mdc; |
| 696 | unsigned char *pp,*p; | ||
| 697 | int ret=0,i; | 734 | int ret=0,i; |
| 698 | int md_type; | 735 | int md_type; |
| 699 | STACK_OF(X509_ATTRIBUTE) *sk; | 736 | STACK_OF(X509_ATTRIBUTE) *sk; |
| 700 | BIO *btmp; | 737 | BIO *btmp; |
| 701 | EVP_PKEY *pkey; | 738 | EVP_PKEY *pkey; |
| 702 | 739 | ||
| 740 | EVP_MD_CTX_init(&mdc_tmp); | ||
| 741 | |||
| 703 | if (!PKCS7_type_is_signed(p7) && | 742 | if (!PKCS7_type_is_signed(p7) && |
| 704 | !PKCS7_type_is_signedAndEnveloped(p7)) { | 743 | !PKCS7_type_is_signedAndEnveloped(p7)) { |
| 705 | PKCS7err(PKCS7_F_PKCS7_SIGNATUREVERIFY, | 744 | PKCS7err(PKCS7_F_PKCS7_SIGNATUREVERIFY, |
| @@ -723,7 +762,7 @@ int PKCS7_signatureVerify(BIO *bio, PKCS7 *p7, PKCS7_SIGNER_INFO *si, | |||
| 723 | if (mdc == NULL) | 762 | if (mdc == NULL) |
| 724 | { | 763 | { |
| 725 | PKCS7err(PKCS7_F_PKCS7_SIGNATUREVERIFY, | 764 | PKCS7err(PKCS7_F_PKCS7_SIGNATUREVERIFY, |
| 726 | PKCS7_R_INTERNAL_ERROR); | 765 | ERR_R_INTERNAL_ERROR); |
| 727 | goto err; | 766 | goto err; |
| 728 | } | 767 | } |
| 729 | if (EVP_MD_CTX_type(mdc) == md_type) | 768 | if (EVP_MD_CTX_type(mdc) == md_type) |
| @@ -733,16 +772,16 @@ int PKCS7_signatureVerify(BIO *bio, PKCS7 *p7, PKCS7_SIGNER_INFO *si, | |||
| 733 | 772 | ||
| 734 | /* mdc is the digest ctx that we want, unless there are attributes, | 773 | /* mdc is the digest ctx that we want, unless there are attributes, |
| 735 | * in which case the digest is the signed attributes */ | 774 | * in which case the digest is the signed attributes */ |
| 736 | memcpy(&mdc_tmp,mdc,sizeof(mdc_tmp)); | 775 | EVP_MD_CTX_copy_ex(&mdc_tmp,mdc); |
| 737 | 776 | ||
| 738 | sk=si->auth_attr; | 777 | sk=si->auth_attr; |
| 739 | if ((sk != NULL) && (sk_X509_ATTRIBUTE_num(sk) != 0)) | 778 | if ((sk != NULL) && (sk_X509_ATTRIBUTE_num(sk) != 0)) |
| 740 | { | 779 | { |
| 741 | unsigned char md_dat[EVP_MAX_MD_SIZE]; | 780 | unsigned char md_dat[EVP_MAX_MD_SIZE], *abuf = NULL; |
| 742 | unsigned int md_len; | 781 | unsigned int md_len, alen; |
| 743 | ASN1_OCTET_STRING *message_digest; | 782 | ASN1_OCTET_STRING *message_digest; |
| 744 | 783 | ||
| 745 | EVP_DigestFinal(&mdc_tmp,md_dat,&md_len); | 784 | EVP_DigestFinal_ex(&mdc_tmp,md_dat,&md_len); |
| 746 | message_digest=PKCS7_digest_from_attributes(sk); | 785 | message_digest=PKCS7_digest_from_attributes(sk); |
| 747 | if (!message_digest) | 786 | if (!message_digest) |
| 748 | { | 787 | { |
| @@ -767,20 +806,13 @@ for (ii=0; ii<md_len; ii++) printf("%02X",md_dat[ii]); printf(" calc\n"); | |||
| 767 | goto err; | 806 | goto err; |
| 768 | } | 807 | } |
| 769 | 808 | ||
| 770 | EVP_VerifyInit(&mdc_tmp,EVP_get_digestbynid(md_type)); | 809 | EVP_VerifyInit_ex(&mdc_tmp,EVP_get_digestbynid(md_type), NULL); |
| 771 | /* Note: when forming the encoding of the attributes we | 810 | |
| 772 | * shouldn't reorder them or this will break the signature. | 811 | alen = ASN1_item_i2d((ASN1_VALUE *)sk, &abuf, |
| 773 | * This is done by using the IS_SEQUENCE flag. | 812 | ASN1_ITEM_rptr(PKCS7_ATTR_VERIFY)); |
| 774 | */ | 813 | EVP_VerifyUpdate(&mdc_tmp, abuf, alen); |
| 775 | i=i2d_ASN1_SET_OF_X509_ATTRIBUTE(sk,NULL,i2d_X509_ATTRIBUTE, | ||
| 776 | V_ASN1_SET,V_ASN1_UNIVERSAL, IS_SEQUENCE); | ||
| 777 | pp=OPENSSL_malloc(i); | ||
| 778 | p=pp; | ||
| 779 | i2d_ASN1_SET_OF_X509_ATTRIBUTE(sk,&p,i2d_X509_ATTRIBUTE, | ||
| 780 | V_ASN1_SET,V_ASN1_UNIVERSAL, IS_SEQUENCE); | ||
| 781 | EVP_VerifyUpdate(&mdc_tmp,pp,i); | ||
| 782 | 814 | ||
| 783 | OPENSSL_free(pp); | 815 | OPENSSL_free(abuf); |
| 784 | } | 816 | } |
| 785 | 817 | ||
| 786 | os=si->enc_digest; | 818 | os=si->enc_digest; |
| @@ -790,7 +822,7 @@ for (ii=0; ii<md_len; ii++) printf("%02X",md_dat[ii]); printf(" calc\n"); | |||
| 790 | ret = -1; | 822 | ret = -1; |
| 791 | goto err; | 823 | goto err; |
| 792 | } | 824 | } |
| 793 | #ifndef NO_DSA | 825 | #ifndef OPENSSL_NO_DSA |
| 794 | if(pkey->type == EVP_PKEY_DSA) mdc_tmp.digest=EVP_dss1(); | 826 | if(pkey->type == EVP_PKEY_DSA) mdc_tmp.digest=EVP_dss1(); |
| 795 | #endif | 827 | #endif |
| 796 | 828 | ||
| @@ -806,6 +838,7 @@ for (ii=0; ii<md_len; ii++) printf("%02X",md_dat[ii]); printf(" calc\n"); | |||
| 806 | else | 838 | else |
| 807 | ret=1; | 839 | ret=1; |
| 808 | err: | 840 | err: |
| 841 | EVP_MD_CTX_cleanup(&mdc_tmp); | ||
| 809 | return(ret); | 842 | return(ret); |
| 810 | } | 843 | } |
| 811 | 844 | ||
| @@ -847,7 +880,7 @@ static ASN1_TYPE *get_attribute(STACK_OF(X509_ATTRIBUTE) *sk, int nid) | |||
| 847 | xa=sk_X509_ATTRIBUTE_value(sk,i); | 880 | xa=sk_X509_ATTRIBUTE_value(sk,i); |
| 848 | if (OBJ_cmp(xa->object,o) == 0) | 881 | if (OBJ_cmp(xa->object,o) == 0) |
| 849 | { | 882 | { |
| 850 | if (xa->set && sk_ASN1_TYPE_num(xa->value.set)) | 883 | if (!xa->single && sk_ASN1_TYPE_num(xa->value.set)) |
| 851 | return(sk_ASN1_TYPE_value(xa->value.set,0)); | 884 | return(sk_ASN1_TYPE_value(xa->value.set,0)); |
| 852 | else | 885 | else |
| 853 | return(NULL); | 886 | return(NULL); |
diff --git a/src/lib/libcrypto/pkcs7/pk7_lib.c b/src/lib/libcrypto/pkcs7/pk7_lib.c index 45973fe850..c00ed6833a 100644 --- a/src/lib/libcrypto/pkcs7/pk7_lib.c +++ b/src/lib/libcrypto/pkcs7/pk7_lib.c | |||
| @@ -84,7 +84,11 @@ long PKCS7_ctrl(PKCS7 *p7, int cmd, long larg, char *parg) | |||
| 84 | case PKCS7_OP_GET_DETACHED_SIGNATURE: | 84 | case PKCS7_OP_GET_DETACHED_SIGNATURE: |
| 85 | if (nid == NID_pkcs7_signed) | 85 | if (nid == NID_pkcs7_signed) |
| 86 | { | 86 | { |
| 87 | ret=p7->detached; | 87 | if(!p7->d.sign || !p7->d.sign->contents->d.ptr) |
| 88 | ret = 1; | ||
| 89 | else ret = 0; | ||
| 90 | |||
| 91 | p7->detached = ret; | ||
| 88 | } | 92 | } |
| 89 | else | 93 | else |
| 90 | { | 94 | { |
| @@ -144,7 +148,7 @@ int PKCS7_set_type(PKCS7 *p7, int type) | |||
| 144 | { | 148 | { |
| 145 | ASN1_OBJECT *obj; | 149 | ASN1_OBJECT *obj; |
| 146 | 150 | ||
| 147 | PKCS7_content_free(p7); | 151 | /*PKCS7_content_free(p7);*/ |
| 148 | obj=OBJ_nid2obj(type); /* will not fail */ | 152 | obj=OBJ_nid2obj(type); /* will not fail */ |
| 149 | 153 | ||
| 150 | switch (type) | 154 | switch (type) |
| @@ -165,18 +169,24 @@ int PKCS7_set_type(PKCS7 *p7, int type) | |||
| 165 | if ((p7->d.signed_and_enveloped=PKCS7_SIGN_ENVELOPE_new()) | 169 | if ((p7->d.signed_and_enveloped=PKCS7_SIGN_ENVELOPE_new()) |
| 166 | == NULL) goto err; | 170 | == NULL) goto err; |
| 167 | ASN1_INTEGER_set(p7->d.signed_and_enveloped->version,1); | 171 | ASN1_INTEGER_set(p7->d.signed_and_enveloped->version,1); |
| 172 | p7->d.signed_and_enveloped->enc_data->content_type | ||
| 173 | = OBJ_nid2obj(NID_pkcs7_data); | ||
| 168 | break; | 174 | break; |
| 169 | case NID_pkcs7_enveloped: | 175 | case NID_pkcs7_enveloped: |
| 170 | p7->type=obj; | 176 | p7->type=obj; |
| 171 | if ((p7->d.enveloped=PKCS7_ENVELOPE_new()) | 177 | if ((p7->d.enveloped=PKCS7_ENVELOPE_new()) |
| 172 | == NULL) goto err; | 178 | == NULL) goto err; |
| 173 | ASN1_INTEGER_set(p7->d.enveloped->version,0); | 179 | ASN1_INTEGER_set(p7->d.enveloped->version,0); |
| 180 | p7->d.enveloped->enc_data->content_type | ||
| 181 | = OBJ_nid2obj(NID_pkcs7_data); | ||
| 174 | break; | 182 | break; |
| 175 | case NID_pkcs7_encrypted: | 183 | case NID_pkcs7_encrypted: |
| 176 | p7->type=obj; | 184 | p7->type=obj; |
| 177 | if ((p7->d.encrypted=PKCS7_ENCRYPT_new()) | 185 | if ((p7->d.encrypted=PKCS7_ENCRYPT_new()) |
| 178 | == NULL) goto err; | 186 | == NULL) goto err; |
| 179 | ASN1_INTEGER_set(p7->d.encrypted->version,0); | 187 | ASN1_INTEGER_set(p7->d.encrypted->version,0); |
| 188 | p7->d.encrypted->enc_data->content_type | ||
| 189 | = OBJ_nid2obj(NID_pkcs7_data); | ||
| 180 | break; | 190 | break; |
| 181 | 191 | ||
| 182 | case NID_pkcs7_digest: | 192 | case NID_pkcs7_digest: |
| @@ -295,7 +305,7 @@ int PKCS7_add_crl(PKCS7 *p7, X509_CRL *crl) | |||
| 295 | } | 305 | } |
| 296 | 306 | ||
| 297 | int PKCS7_SIGNER_INFO_set(PKCS7_SIGNER_INFO *p7i, X509 *x509, EVP_PKEY *pkey, | 307 | int PKCS7_SIGNER_INFO_set(PKCS7_SIGNER_INFO *p7i, X509 *x509, EVP_PKEY *pkey, |
| 298 | EVP_MD *dgst) | 308 | const EVP_MD *dgst) |
| 299 | { | 309 | { |
| 300 | char is_dsa; | 310 | char is_dsa; |
| 301 | if (pkey->type == EVP_PKEY_DSA) is_dsa = 1; | 311 | if (pkey->type == EVP_PKEY_DSA) is_dsa = 1; |
| @@ -343,7 +353,7 @@ err: | |||
| 343 | } | 353 | } |
| 344 | 354 | ||
| 345 | PKCS7_SIGNER_INFO *PKCS7_add_signature(PKCS7 *p7, X509 *x509, EVP_PKEY *pkey, | 355 | PKCS7_SIGNER_INFO *PKCS7_add_signature(PKCS7 *p7, X509 *x509, EVP_PKEY *pkey, |
| 346 | EVP_MD *dgst) | 356 | const EVP_MD *dgst) |
| 347 | { | 357 | { |
| 348 | PKCS7_SIGNER_INFO *si; | 358 | PKCS7_SIGNER_INFO *si; |
| 349 | 359 | ||
| @@ -415,9 +425,7 @@ int PKCS7_RECIP_INFO_set(PKCS7_RECIP_INFO *p7i, X509 *x509) | |||
| 415 | M_ASN1_INTEGER_dup(X509_get_serialNumber(x509)); | 425 | M_ASN1_INTEGER_dup(X509_get_serialNumber(x509)); |
| 416 | 426 | ||
| 417 | X509_ALGOR_free(p7i->key_enc_algor); | 427 | X509_ALGOR_free(p7i->key_enc_algor); |
| 418 | p7i->key_enc_algor=(X509_ALGOR *)ASN1_dup(i2d_X509_ALGOR, | 428 | p7i->key_enc_algor= X509_ALGOR_dup(x509->cert_info->key->algor); |
| 419 | (char *(*)())d2i_X509_ALGOR, | ||
| 420 | (char *)x509->cert_info->key->algor); | ||
| 421 | 429 | ||
| 422 | CRYPTO_add(&x509->references,1,CRYPTO_LOCK_X509); | 430 | CRYPTO_add(&x509->references,1,CRYPTO_LOCK_X509); |
| 423 | p7i->cert=x509; | 431 | p7i->cert=x509; |
diff --git a/src/lib/libcrypto/pkcs7/pk7_smime.c b/src/lib/libcrypto/pkcs7/pk7_smime.c index 3d3214f5ee..f0d071e282 100644 --- a/src/lib/libcrypto/pkcs7/pk7_smime.c +++ b/src/lib/libcrypto/pkcs7/pk7_smime.c | |||
| @@ -115,17 +115,17 @@ PKCS7 *PKCS7_sign(X509 *signcert, EVP_PKEY *pkey, STACK_OF(X509) *certs, | |||
| 115 | PKCS7err(PKCS7_F_PKCS7_SIGN,ERR_R_MALLOC_FAILURE); | 115 | PKCS7err(PKCS7_F_PKCS7_SIGN,ERR_R_MALLOC_FAILURE); |
| 116 | return NULL; | 116 | return NULL; |
| 117 | } | 117 | } |
| 118 | #ifndef NO_DES | 118 | #ifndef OPENSSL_NO_DES |
| 119 | PKCS7_simple_smimecap (smcap, NID_des_ede3_cbc, -1); | 119 | PKCS7_simple_smimecap (smcap, NID_des_ede3_cbc, -1); |
| 120 | #endif | 120 | #endif |
| 121 | #ifndef NO_RC2 | 121 | #ifndef OPENSSL_NO_RC2 |
| 122 | PKCS7_simple_smimecap (smcap, NID_rc2_cbc, 128); | 122 | PKCS7_simple_smimecap (smcap, NID_rc2_cbc, 128); |
| 123 | PKCS7_simple_smimecap (smcap, NID_rc2_cbc, 64); | 123 | PKCS7_simple_smimecap (smcap, NID_rc2_cbc, 64); |
| 124 | #endif | 124 | #endif |
| 125 | #ifndef NO_DES | 125 | #ifndef OPENSSL_NO_DES |
| 126 | PKCS7_simple_smimecap (smcap, NID_des_cbc, -1); | 126 | PKCS7_simple_smimecap (smcap, NID_des_cbc, -1); |
| 127 | #endif | 127 | #endif |
| 128 | #ifndef NO_RC2 | 128 | #ifndef OPENSSL_NO_RC2 |
| 129 | PKCS7_simple_smimecap (smcap, NID_rc2_cbc, 40); | 129 | PKCS7_simple_smimecap (smcap, NID_rc2_cbc, 40); |
| 130 | #endif | 130 | #endif |
| 131 | PKCS7_add_attrib_smimecap (si, smcap); | 131 | PKCS7_add_attrib_smimecap (si, smcap); |
| @@ -201,11 +201,20 @@ int PKCS7_verify(PKCS7 *p7, STACK_OF(X509) *certs, X509_STORE *store, | |||
| 201 | if (!(flags & PKCS7_NOVERIFY)) for (k = 0; k < sk_X509_num(signers); k++) { | 201 | if (!(flags & PKCS7_NOVERIFY)) for (k = 0; k < sk_X509_num(signers); k++) { |
| 202 | signer = sk_X509_value (signers, k); | 202 | signer = sk_X509_value (signers, k); |
| 203 | if (!(flags & PKCS7_NOCHAIN)) { | 203 | if (!(flags & PKCS7_NOCHAIN)) { |
| 204 | X509_STORE_CTX_init(&cert_ctx, store, signer, | 204 | if(!X509_STORE_CTX_init(&cert_ctx, store, signer, |
| 205 | p7->d.sign->cert); | 205 | p7->d.sign->cert)) |
| 206 | { | ||
| 207 | PKCS7err(PKCS7_F_PKCS7_VERIFY,ERR_R_X509_LIB); | ||
| 208 | sk_X509_free(signers); | ||
| 209 | return 0; | ||
| 210 | } | ||
| 206 | X509_STORE_CTX_set_purpose(&cert_ctx, | 211 | X509_STORE_CTX_set_purpose(&cert_ctx, |
| 207 | X509_PURPOSE_SMIME_SIGN); | 212 | X509_PURPOSE_SMIME_SIGN); |
| 208 | } else X509_STORE_CTX_init (&cert_ctx, store, signer, NULL); | 213 | } else if(!X509_STORE_CTX_init (&cert_ctx, store, signer, NULL)) { |
| 214 | PKCS7err(PKCS7_F_PKCS7_VERIFY,ERR_R_X509_LIB); | ||
| 215 | sk_X509_free(signers); | ||
| 216 | return 0; | ||
| 217 | } | ||
| 209 | i = X509_verify_cert(&cert_ctx); | 218 | i = X509_verify_cert(&cert_ctx); |
| 210 | if (i <= 0) j = X509_STORE_CTX_get_error(&cert_ctx); | 219 | if (i <= 0) j = X509_STORE_CTX_get_error(&cert_ctx); |
| 211 | X509_STORE_CTX_cleanup(&cert_ctx); | 220 | X509_STORE_CTX_cleanup(&cert_ctx); |
| @@ -327,7 +336,7 @@ STACK_OF(X509) *PKCS7_get0_signers(PKCS7 *p7, STACK_OF(X509) *certs, int flags) | |||
| 327 | 336 | ||
| 328 | /* Build a complete PKCS#7 enveloped data */ | 337 | /* Build a complete PKCS#7 enveloped data */ |
| 329 | 338 | ||
| 330 | PKCS7 *PKCS7_encrypt(STACK_OF(X509) *certs, BIO *in, EVP_CIPHER *cipher, | 339 | PKCS7 *PKCS7_encrypt(STACK_OF(X509) *certs, BIO *in, const EVP_CIPHER *cipher, |
| 331 | int flags) | 340 | int flags) |
| 332 | { | 341 | { |
| 333 | PKCS7 *p7; | 342 | PKCS7 *p7; |
diff --git a/src/lib/libcrypto/pkcs7/pkcs7.h b/src/lib/libcrypto/pkcs7/pkcs7.h index 1b817e605d..5819700a85 100644 --- a/src/lib/libcrypto/pkcs7/pkcs7.h +++ b/src/lib/libcrypto/pkcs7/pkcs7.h | |||
| @@ -59,16 +59,18 @@ | |||
| 59 | #ifndef HEADER_PKCS7_H | 59 | #ifndef HEADER_PKCS7_H |
| 60 | #define HEADER_PKCS7_H | 60 | #define HEADER_PKCS7_H |
| 61 | 61 | ||
| 62 | #include <openssl/asn1.h> | ||
| 62 | #include <openssl/bio.h> | 63 | #include <openssl/bio.h> |
| 63 | #include <openssl/x509.h> | 64 | #include <openssl/e_os2.h> |
| 64 | 65 | ||
| 65 | #include <openssl/symhacks.h> | 66 | #include <openssl/symhacks.h> |
| 67 | #include <openssl/ossl_typ.h> | ||
| 66 | 68 | ||
| 67 | #ifdef __cplusplus | 69 | #ifdef __cplusplus |
| 68 | extern "C" { | 70 | extern "C" { |
| 69 | #endif | 71 | #endif |
| 70 | 72 | ||
| 71 | #ifdef WIN32 | 73 | #ifdef OPENSSL_SYS_WIN32 |
| 72 | /* Under Win32 thes are defined in wincrypt.h */ | 74 | /* Under Win32 thes are defined in wincrypt.h */ |
| 73 | #undef PKCS7_ISSUER_AND_SERIAL | 75 | #undef PKCS7_ISSUER_AND_SERIAL |
| 74 | #undef PKCS7_SIGNER_INFO | 76 | #undef PKCS7_SIGNER_INFO |
| @@ -225,6 +227,7 @@ DECLARE_PKCS12_STACK_OF(PKCS7) | |||
| 225 | #define PKCS7_get_attributes(si) ((si)->unauth_attr) | 227 | #define PKCS7_get_attributes(si) ((si)->unauth_attr) |
| 226 | 228 | ||
| 227 | #define PKCS7_type_is_signed(a) (OBJ_obj2nid((a)->type) == NID_pkcs7_signed) | 229 | #define PKCS7_type_is_signed(a) (OBJ_obj2nid((a)->type) == NID_pkcs7_signed) |
| 230 | #define PKCS7_type_is_encrypted(a) (OBJ_obj2nid((a)->type) == NID_pkcs7_encrypted) | ||
| 228 | #define PKCS7_type_is_enveloped(a) (OBJ_obj2nid((a)->type) == NID_pkcs7_enveloped) | 231 | #define PKCS7_type_is_enveloped(a) (OBJ_obj2nid((a)->type) == NID_pkcs7_enveloped) |
| 229 | #define PKCS7_type_is_signedAndEnveloped(a) \ | 232 | #define PKCS7_type_is_signedAndEnveloped(a) \ |
| 230 | (OBJ_obj2nid((a)->type) == NID_pkcs7_signedAndEnveloped) | 233 | (OBJ_obj2nid((a)->type) == NID_pkcs7_signedAndEnveloped) |
| @@ -235,6 +238,8 @@ DECLARE_PKCS12_STACK_OF(PKCS7) | |||
| 235 | #define PKCS7_get_detached(p) \ | 238 | #define PKCS7_get_detached(p) \ |
| 236 | PKCS7_ctrl(p,PKCS7_OP_GET_DETACHED_SIGNATURE,0,NULL) | 239 | PKCS7_ctrl(p,PKCS7_OP_GET_DETACHED_SIGNATURE,0,NULL) |
| 237 | 240 | ||
| 241 | #define PKCS7_is_detached(p7) (PKCS7_type_is_signed(p7) && PKCS7_get_detached(p7)) | ||
| 242 | |||
| 238 | #ifdef SSLEAY_MACROS | 243 | #ifdef SSLEAY_MACROS |
| 239 | #ifndef PKCS7_ISSUER_AND_SERIAL_digest | 244 | #ifndef PKCS7_ISSUER_AND_SERIAL_digest |
| 240 | #define PKCS7_ISSUER_AND_SERIAL_digest(data,type,md,len) \ | 245 | #define PKCS7_ISSUER_AND_SERIAL_digest(data,type,md,len) \ |
| @@ -268,19 +273,12 @@ DECLARE_PKCS12_STACK_OF(PKCS7) | |||
| 268 | #define SMIME_BINARY PKCS7_BINARY | 273 | #define SMIME_BINARY PKCS7_BINARY |
| 269 | #define SMIME_NOATTR PKCS7_NOATTR | 274 | #define SMIME_NOATTR PKCS7_NOATTR |
| 270 | 275 | ||
| 271 | PKCS7_ISSUER_AND_SERIAL *PKCS7_ISSUER_AND_SERIAL_new(void ); | 276 | DECLARE_ASN1_FUNCTIONS(PKCS7_ISSUER_AND_SERIAL) |
| 272 | void PKCS7_ISSUER_AND_SERIAL_free( | ||
| 273 | PKCS7_ISSUER_AND_SERIAL *a); | ||
| 274 | int i2d_PKCS7_ISSUER_AND_SERIAL( | ||
| 275 | PKCS7_ISSUER_AND_SERIAL *a,unsigned char **pp); | ||
| 276 | PKCS7_ISSUER_AND_SERIAL *d2i_PKCS7_ISSUER_AND_SERIAL( | ||
| 277 | PKCS7_ISSUER_AND_SERIAL **a, | ||
| 278 | unsigned char **pp, long length); | ||
| 279 | 277 | ||
| 280 | #ifndef SSLEAY_MACROS | 278 | #ifndef SSLEAY_MACROS |
| 281 | int PKCS7_ISSUER_AND_SERIAL_digest(PKCS7_ISSUER_AND_SERIAL *data,const EVP_MD *type, | 279 | int PKCS7_ISSUER_AND_SERIAL_digest(PKCS7_ISSUER_AND_SERIAL *data,const EVP_MD *type, |
| 282 | unsigned char *md,unsigned int *len); | 280 | unsigned char *md,unsigned int *len); |
| 283 | #ifndef NO_FP_API | 281 | #ifndef OPENSSL_NO_FP_API |
| 284 | PKCS7 *d2i_PKCS7_fp(FILE *fp,PKCS7 **p7); | 282 | PKCS7 *d2i_PKCS7_fp(FILE *fp,PKCS7 **p7); |
| 285 | int i2d_PKCS7_fp(FILE *fp,PKCS7 *p7); | 283 | int i2d_PKCS7_fp(FILE *fp,PKCS7 *p7); |
| 286 | #endif | 284 | #endif |
| @@ -289,71 +287,18 @@ PKCS7 *d2i_PKCS7_bio(BIO *bp,PKCS7 **p7); | |||
| 289 | int i2d_PKCS7_bio(BIO *bp,PKCS7 *p7); | 287 | int i2d_PKCS7_bio(BIO *bp,PKCS7 *p7); |
| 290 | #endif | 288 | #endif |
| 291 | 289 | ||
| 292 | PKCS7_SIGNER_INFO *PKCS7_SIGNER_INFO_new(void); | 290 | DECLARE_ASN1_FUNCTIONS(PKCS7_SIGNER_INFO) |
| 293 | void PKCS7_SIGNER_INFO_free(PKCS7_SIGNER_INFO *a); | 291 | DECLARE_ASN1_FUNCTIONS(PKCS7_RECIP_INFO) |
| 294 | int i2d_PKCS7_SIGNER_INFO(PKCS7_SIGNER_INFO *a, | 292 | DECLARE_ASN1_FUNCTIONS(PKCS7_SIGNED) |
| 295 | unsigned char **pp); | 293 | DECLARE_ASN1_FUNCTIONS(PKCS7_ENC_CONTENT) |
| 296 | PKCS7_SIGNER_INFO *d2i_PKCS7_SIGNER_INFO(PKCS7_SIGNER_INFO **a, | 294 | DECLARE_ASN1_FUNCTIONS(PKCS7_ENVELOPE) |
| 297 | unsigned char **pp,long length); | 295 | DECLARE_ASN1_FUNCTIONS(PKCS7_SIGN_ENVELOPE) |
| 298 | 296 | DECLARE_ASN1_FUNCTIONS(PKCS7_DIGEST) | |
| 299 | PKCS7_RECIP_INFO *PKCS7_RECIP_INFO_new(void); | 297 | DECLARE_ASN1_FUNCTIONS(PKCS7_ENCRYPT) |
| 300 | void PKCS7_RECIP_INFO_free(PKCS7_RECIP_INFO *a); | 298 | DECLARE_ASN1_FUNCTIONS(PKCS7) |
| 301 | int i2d_PKCS7_RECIP_INFO(PKCS7_RECIP_INFO *a, | ||
| 302 | unsigned char **pp); | ||
| 303 | PKCS7_RECIP_INFO *d2i_PKCS7_RECIP_INFO(PKCS7_RECIP_INFO **a, | ||
| 304 | unsigned char **pp,long length); | ||
| 305 | |||
| 306 | PKCS7_SIGNED *PKCS7_SIGNED_new(void); | ||
| 307 | void PKCS7_SIGNED_free(PKCS7_SIGNED *a); | ||
| 308 | int i2d_PKCS7_SIGNED(PKCS7_SIGNED *a, | ||
| 309 | unsigned char **pp); | ||
| 310 | PKCS7_SIGNED *d2i_PKCS7_SIGNED(PKCS7_SIGNED **a, | ||
| 311 | unsigned char **pp,long length); | ||
| 312 | |||
| 313 | PKCS7_ENC_CONTENT *PKCS7_ENC_CONTENT_new(void); | ||
| 314 | void PKCS7_ENC_CONTENT_free(PKCS7_ENC_CONTENT *a); | ||
| 315 | int i2d_PKCS7_ENC_CONTENT(PKCS7_ENC_CONTENT *a, | ||
| 316 | unsigned char **pp); | ||
| 317 | PKCS7_ENC_CONTENT *d2i_PKCS7_ENC_CONTENT(PKCS7_ENC_CONTENT **a, | ||
| 318 | unsigned char **pp,long length); | ||
| 319 | |||
| 320 | PKCS7_ENVELOPE *PKCS7_ENVELOPE_new(void); | ||
| 321 | void PKCS7_ENVELOPE_free(PKCS7_ENVELOPE *a); | ||
| 322 | int i2d_PKCS7_ENVELOPE(PKCS7_ENVELOPE *a, | ||
| 323 | unsigned char **pp); | ||
| 324 | PKCS7_ENVELOPE *d2i_PKCS7_ENVELOPE(PKCS7_ENVELOPE **a, | ||
| 325 | unsigned char **pp,long length); | ||
| 326 | |||
| 327 | PKCS7_SIGN_ENVELOPE *PKCS7_SIGN_ENVELOPE_new(void); | ||
| 328 | void PKCS7_SIGN_ENVELOPE_free(PKCS7_SIGN_ENVELOPE *a); | ||
| 329 | int i2d_PKCS7_SIGN_ENVELOPE(PKCS7_SIGN_ENVELOPE *a, | ||
| 330 | unsigned char **pp); | ||
| 331 | PKCS7_SIGN_ENVELOPE *d2i_PKCS7_SIGN_ENVELOPE(PKCS7_SIGN_ENVELOPE **a, | ||
| 332 | unsigned char **pp,long length); | ||
| 333 | |||
| 334 | PKCS7_DIGEST *PKCS7_DIGEST_new(void); | ||
| 335 | void PKCS7_DIGEST_free(PKCS7_DIGEST *a); | ||
| 336 | int i2d_PKCS7_DIGEST(PKCS7_DIGEST *a, | ||
| 337 | unsigned char **pp); | ||
| 338 | PKCS7_DIGEST *d2i_PKCS7_DIGEST(PKCS7_DIGEST **a, | ||
| 339 | unsigned char **pp,long length); | ||
| 340 | |||
| 341 | PKCS7_ENCRYPT *PKCS7_ENCRYPT_new(void); | ||
| 342 | void PKCS7_ENCRYPT_free(PKCS7_ENCRYPT *a); | ||
| 343 | int i2d_PKCS7_ENCRYPT(PKCS7_ENCRYPT *a, | ||
| 344 | unsigned char **pp); | ||
| 345 | PKCS7_ENCRYPT *d2i_PKCS7_ENCRYPT(PKCS7_ENCRYPT **a, | ||
| 346 | unsigned char **pp,long length); | ||
| 347 | |||
| 348 | PKCS7 *PKCS7_new(void); | ||
| 349 | void PKCS7_free(PKCS7 *a); | ||
| 350 | void PKCS7_content_free(PKCS7 *a); | ||
| 351 | int i2d_PKCS7(PKCS7 *a, | ||
| 352 | unsigned char **pp); | ||
| 353 | PKCS7 *d2i_PKCS7(PKCS7 **a, | ||
| 354 | unsigned char **pp,long length); | ||
| 355 | 299 | ||
| 356 | void ERR_load_PKCS7_strings(void); | 300 | DECLARE_ASN1_ITEM(PKCS7_ATTR_SIGN) |
| 301 | DECLARE_ASN1_ITEM(PKCS7_ATTR_VERIFY) | ||
| 357 | 302 | ||
| 358 | 303 | ||
| 359 | long PKCS7_ctrl(PKCS7 *p7, int cmd, long larg, char *parg); | 304 | long PKCS7_ctrl(PKCS7 *p7, int cmd, long larg, char *parg); |
| @@ -361,7 +306,7 @@ long PKCS7_ctrl(PKCS7 *p7, int cmd, long larg, char *parg); | |||
| 361 | int PKCS7_set_type(PKCS7 *p7, int type); | 306 | int PKCS7_set_type(PKCS7 *p7, int type); |
| 362 | int PKCS7_set_content(PKCS7 *p7, PKCS7 *p7_data); | 307 | int PKCS7_set_content(PKCS7 *p7, PKCS7 *p7_data); |
| 363 | int PKCS7_SIGNER_INFO_set(PKCS7_SIGNER_INFO *p7i, X509 *x509, EVP_PKEY *pkey, | 308 | int PKCS7_SIGNER_INFO_set(PKCS7_SIGNER_INFO *p7i, X509 *x509, EVP_PKEY *pkey, |
| 364 | EVP_MD *dgst); | 309 | const EVP_MD *dgst); |
| 365 | int PKCS7_add_signer(PKCS7 *p7, PKCS7_SIGNER_INFO *p7i); | 310 | int PKCS7_add_signer(PKCS7 *p7, PKCS7_SIGNER_INFO *p7i); |
| 366 | int PKCS7_add_certificate(PKCS7 *p7, X509 *x509); | 311 | int PKCS7_add_certificate(PKCS7 *p7, X509 *x509); |
| 367 | int PKCS7_add_crl(PKCS7 *p7, X509_CRL *x509); | 312 | int PKCS7_add_crl(PKCS7 *p7, X509_CRL *x509); |
| @@ -377,7 +322,7 @@ BIO *PKCS7_dataDecode(PKCS7 *p7, EVP_PKEY *pkey, BIO *in_bio, X509 *pcert); | |||
| 377 | 322 | ||
| 378 | 323 | ||
| 379 | PKCS7_SIGNER_INFO *PKCS7_add_signature(PKCS7 *p7, X509 *x509, | 324 | PKCS7_SIGNER_INFO *PKCS7_add_signature(PKCS7 *p7, X509 *x509, |
| 380 | EVP_PKEY *pkey, EVP_MD *dgst); | 325 | EVP_PKEY *pkey, const EVP_MD *dgst); |
| 381 | X509 *PKCS7_cert_from_signer_info(PKCS7 *p7, PKCS7_SIGNER_INFO *si); | 326 | X509 *PKCS7_cert_from_signer_info(PKCS7 *p7, PKCS7_SIGNER_INFO *si); |
| 382 | STACK_OF(PKCS7_SIGNER_INFO) *PKCS7_get_signer_info(PKCS7 *p7); | 327 | STACK_OF(PKCS7_SIGNER_INFO) *PKCS7_get_signer_info(PKCS7 *p7); |
| 383 | 328 | ||
| @@ -404,7 +349,7 @@ PKCS7 *PKCS7_sign(X509 *signcert, EVP_PKEY *pkey, STACK_OF(X509) *certs, | |||
| 404 | int PKCS7_verify(PKCS7 *p7, STACK_OF(X509) *certs, X509_STORE *store, | 349 | int PKCS7_verify(PKCS7 *p7, STACK_OF(X509) *certs, X509_STORE *store, |
| 405 | BIO *indata, BIO *out, int flags); | 350 | BIO *indata, BIO *out, int flags); |
| 406 | STACK_OF(X509) *PKCS7_get0_signers(PKCS7 *p7, STACK_OF(X509) *certs, int flags); | 351 | STACK_OF(X509) *PKCS7_get0_signers(PKCS7 *p7, STACK_OF(X509) *certs, int flags); |
| 407 | PKCS7 *PKCS7_encrypt(STACK_OF(X509) *certs, BIO *in, EVP_CIPHER *cipher, | 352 | PKCS7 *PKCS7_encrypt(STACK_OF(X509) *certs, BIO *in, const EVP_CIPHER *cipher, |
| 408 | int flags); | 353 | int flags); |
| 409 | int PKCS7_decrypt(PKCS7 *p7, EVP_PKEY *pkey, X509 *cert, BIO *data, int flags); | 354 | int PKCS7_decrypt(PKCS7 *p7, EVP_PKEY *pkey, X509 *cert, BIO *data, int flags); |
| 410 | 355 | ||
| @@ -422,6 +367,7 @@ int SMIME_text(BIO *in, BIO *out); | |||
| 422 | /* The following lines are auto generated by the script mkerr.pl. Any changes | 367 | /* The following lines are auto generated by the script mkerr.pl. Any changes |
| 423 | * made after this point may be overwritten when the script is next run. | 368 | * made after this point may be overwritten when the script is next run. |
| 424 | */ | 369 | */ |
| 370 | void ERR_load_PKCS7_strings(void); | ||
| 425 | 371 | ||
| 426 | /* Error codes for the PKCS7 functions. */ | 372 | /* Error codes for the PKCS7 functions. */ |
| 427 | 373 | ||
| @@ -462,7 +408,6 @@ int SMIME_text(BIO *in, BIO *out); | |||
| 462 | #define PKCS7_R_DIGEST_FAILURE 101 | 408 | #define PKCS7_R_DIGEST_FAILURE 101 |
| 463 | #define PKCS7_R_ERROR_ADDING_RECIPIENT 120 | 409 | #define PKCS7_R_ERROR_ADDING_RECIPIENT 120 |
| 464 | #define PKCS7_R_ERROR_SETTING_CIPHER 121 | 410 | #define PKCS7_R_ERROR_SETTING_CIPHER 121 |
| 465 | #define PKCS7_R_INTERNAL_ERROR 102 | ||
| 466 | #define PKCS7_R_INVALID_MIME_TYPE 131 | 411 | #define PKCS7_R_INVALID_MIME_TYPE 131 |
| 467 | #define PKCS7_R_INVALID_NULL_POINTER 143 | 412 | #define PKCS7_R_INVALID_NULL_POINTER 143 |
| 468 | #define PKCS7_R_MIME_NO_CONTENT_TYPE 132 | 413 | #define PKCS7_R_MIME_NO_CONTENT_TYPE 132 |
| @@ -502,4 +447,3 @@ int SMIME_text(BIO *in, BIO *out); | |||
| 502 | } | 447 | } |
| 503 | #endif | 448 | #endif |
| 504 | #endif | 449 | #endif |
| 505 | |||
diff --git a/src/lib/libcrypto/pkcs7/pkcs7err.c b/src/lib/libcrypto/pkcs7/pkcs7err.c index 8ded8913db..5e51527a40 100644 --- a/src/lib/libcrypto/pkcs7/pkcs7err.c +++ b/src/lib/libcrypto/pkcs7/pkcs7err.c | |||
| @@ -63,7 +63,7 @@ | |||
| 63 | #include <openssl/pkcs7.h> | 63 | #include <openssl/pkcs7.h> |
| 64 | 64 | ||
| 65 | /* BEGIN ERROR CODES */ | 65 | /* BEGIN ERROR CODES */ |
| 66 | #ifndef NO_ERR | 66 | #ifndef OPENSSL_NO_ERR |
| 67 | static ERR_STRING_DATA PKCS7_str_functs[]= | 67 | static ERR_STRING_DATA PKCS7_str_functs[]= |
| 68 | { | 68 | { |
| 69 | {ERR_PACK(0,PKCS7_F_B64_READ_PKCS7,0), "B64_READ_PKCS7"}, | 69 | {ERR_PACK(0,PKCS7_F_B64_READ_PKCS7,0), "B64_READ_PKCS7"}, |
| @@ -105,7 +105,6 @@ static ERR_STRING_DATA PKCS7_str_reasons[]= | |||
| 105 | {PKCS7_R_DIGEST_FAILURE ,"digest failure"}, | 105 | {PKCS7_R_DIGEST_FAILURE ,"digest failure"}, |
| 106 | {PKCS7_R_ERROR_ADDING_RECIPIENT ,"error adding recipient"}, | 106 | {PKCS7_R_ERROR_ADDING_RECIPIENT ,"error adding recipient"}, |
| 107 | {PKCS7_R_ERROR_SETTING_CIPHER ,"error setting cipher"}, | 107 | {PKCS7_R_ERROR_SETTING_CIPHER ,"error setting cipher"}, |
| 108 | {PKCS7_R_INTERNAL_ERROR ,"internal error"}, | ||
| 109 | {PKCS7_R_INVALID_MIME_TYPE ,"invalid mime type"}, | 108 | {PKCS7_R_INVALID_MIME_TYPE ,"invalid mime type"}, |
| 110 | {PKCS7_R_INVALID_NULL_POINTER ,"invalid null pointer"}, | 109 | {PKCS7_R_INVALID_NULL_POINTER ,"invalid null pointer"}, |
| 111 | {PKCS7_R_MIME_NO_CONTENT_TYPE ,"mime no content type"}, | 110 | {PKCS7_R_MIME_NO_CONTENT_TYPE ,"mime no content type"}, |
| @@ -152,7 +151,7 @@ void ERR_load_PKCS7_strings(void) | |||
| 152 | if (init) | 151 | if (init) |
| 153 | { | 152 | { |
| 154 | init=0; | 153 | init=0; |
| 155 | #ifndef NO_ERR | 154 | #ifndef OPENSSL_NO_ERR |
| 156 | ERR_load_strings(ERR_LIB_PKCS7,PKCS7_str_functs); | 155 | ERR_load_strings(ERR_LIB_PKCS7,PKCS7_str_functs); |
| 157 | ERR_load_strings(ERR_LIB_PKCS7,PKCS7_str_reasons); | 156 | ERR_load_strings(ERR_LIB_PKCS7,PKCS7_str_reasons); |
| 158 | #endif | 157 | #endif |
diff --git a/src/lib/libcrypto/pkcs7/sign.c b/src/lib/libcrypto/pkcs7/sign.c index 22290e192c..8b59885f7e 100644 --- a/src/lib/libcrypto/pkcs7/sign.c +++ b/src/lib/libcrypto/pkcs7/sign.c | |||
| @@ -76,16 +76,16 @@ char *argv[]; | |||
| 76 | int i; | 76 | int i; |
| 77 | int nodetach=0; | 77 | int nodetach=0; |
| 78 | 78 | ||
| 79 | #ifndef NO_MD2 | 79 | #ifndef OPENSSL_NO_MD2 |
| 80 | EVP_add_digest(EVP_md2()); | 80 | EVP_add_digest(EVP_md2()); |
| 81 | #endif | 81 | #endif |
| 82 | #ifndef NO_MD5 | 82 | #ifndef OPENSSL_NO_MD5 |
| 83 | EVP_add_digest(EVP_md5()); | 83 | EVP_add_digest(EVP_md5()); |
| 84 | #endif | 84 | #endif |
| 85 | #ifndef NO_SHA1 | 85 | #ifndef OPENSSL_NO_SHA1 |
| 86 | EVP_add_digest(EVP_sha1()); | 86 | EVP_add_digest(EVP_sha1()); |
| 87 | #endif | 87 | #endif |
| 88 | #ifndef NO_MDC2 | 88 | #ifndef OPENSSL_NO_MDC2 |
| 89 | EVP_add_digest(EVP_mdc2()); | 89 | EVP_add_digest(EVP_mdc2()); |
| 90 | #endif | 90 | #endif |
| 91 | 91 | ||
diff --git a/src/lib/libcrypto/pkcs7/verify.c b/src/lib/libcrypto/pkcs7/verify.c index 49fc8d8bed..5f7afe8933 100644 --- a/src/lib/libcrypto/pkcs7/verify.c +++ b/src/lib/libcrypto/pkcs7/verify.c | |||
| @@ -85,16 +85,16 @@ char *argv[]; | |||
| 85 | 85 | ||
| 86 | bio_err=BIO_new_fp(stderr,BIO_NOCLOSE); | 86 | bio_err=BIO_new_fp(stderr,BIO_NOCLOSE); |
| 87 | bio_out=BIO_new_fp(stdout,BIO_NOCLOSE); | 87 | bio_out=BIO_new_fp(stdout,BIO_NOCLOSE); |
| 88 | #ifndef NO_MD2 | 88 | #ifndef OPENSSL_NO_MD2 |
| 89 | EVP_add_digest(EVP_md2()); | 89 | EVP_add_digest(EVP_md2()); |
| 90 | #endif | 90 | #endif |
| 91 | #ifndef NO_MD5 | 91 | #ifndef OPENSSL_NO_MD5 |
| 92 | EVP_add_digest(EVP_md5()); | 92 | EVP_add_digest(EVP_md5()); |
| 93 | #endif | 93 | #endif |
| 94 | #ifndef NO_SHA1 | 94 | #ifndef OPENSSL_NO_SHA1 |
| 95 | EVP_add_digest(EVP_sha1()); | 95 | EVP_add_digest(EVP_sha1()); |
| 96 | #endif | 96 | #endif |
| 97 | #ifndef NO_MDC2 | 97 | #ifndef OPENSSL_NO_MDC2 |
| 98 | EVP_add_digest(EVP_mdc2()); | 98 | EVP_add_digest(EVP_mdc2()); |
| 99 | #endif | 99 | #endif |
| 100 | 100 | ||
