diff options
author | beck <> | 2015-02-11 04:05:14 +0000 |
---|---|---|
committer | beck <> | 2015-02-11 04:05:14 +0000 |
commit | 74b6aedb7d6d115e1fa81e96806190a780392341 (patch) | |
tree | aa9f1278214f1d7d996d30cf1959f3878cb48be1 /src/lib | |
parent | 16aad183ce9bacab429bd62937373a0da02849ec (diff) | |
download | openbsd-74b6aedb7d6d115e1fa81e96806190a780392341.tar.gz openbsd-74b6aedb7d6d115e1fa81e96806190a780392341.tar.bz2 openbsd-74b6aedb7d6d115e1fa81e96806190a780392341.zip |
Guenther has plans for OPENSSL_NO_CMS, so revert this for the moment.
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/libcrypto/cms/cms.h | 4 | ||||
-rw-r--r-- | src/lib/libcrypto/dsa/dsa_ameth.c | 25 | ||||
-rw-r--r-- | src/lib/libcrypto/ec/ec_ameth.c | 23 | ||||
-rw-r--r-- | src/lib/libcrypto/err/err_all.c | 8 | ||||
-rw-r--r-- | src/lib/libcrypto/gost/gostr341001_ameth.c | 16 | ||||
-rw-r--r-- | src/lib/libcrypto/gost/gostr341001_pmeth.c | 7 | ||||
-rw-r--r-- | src/lib/libcrypto/pem/pem_lib.c | 11 | ||||
-rw-r--r-- | src/lib/libcrypto/rsa/rsa_ameth.c | 16 | ||||
-rw-r--r-- | src/lib/libcrypto/rsa/rsa_pmeth.c | 25 | ||||
-rw-r--r-- | src/lib/libssl/src/crypto/cms/cms.h | 4 | ||||
-rw-r--r-- | src/lib/libssl/src/crypto/dsa/dsa_ameth.c | 25 | ||||
-rw-r--r-- | src/lib/libssl/src/crypto/ec/ec_ameth.c | 23 | ||||
-rw-r--r-- | src/lib/libssl/src/crypto/err/err_all.c | 8 | ||||
-rw-r--r-- | src/lib/libssl/src/crypto/gost/gostr341001_ameth.c | 16 | ||||
-rw-r--r-- | src/lib/libssl/src/crypto/gost/gostr341001_pmeth.c | 7 | ||||
-rw-r--r-- | src/lib/libssl/src/crypto/pem/pem_lib.c | 11 | ||||
-rw-r--r-- | src/lib/libssl/src/crypto/rsa/rsa_ameth.c | 16 | ||||
-rw-r--r-- | src/lib/libssl/src/crypto/rsa/rsa_pmeth.c | 25 |
18 files changed, 246 insertions, 24 deletions
diff --git a/src/lib/libcrypto/cms/cms.h b/src/lib/libcrypto/cms/cms.h index f08e2f8457..9a5aae5299 100644 --- a/src/lib/libcrypto/cms/cms.h +++ b/src/lib/libcrypto/cms/cms.h | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: cms.h,v 1.6 2015/02/11 03:55:42 beck Exp $ */ | 1 | /* $OpenBSD: cms.h,v 1.7 2015/02/11 04:05:14 beck Exp $ */ |
2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
3 | * project. | 3 | * project. |
4 | */ | 4 | */ |
@@ -58,7 +58,9 @@ | |||
58 | 58 | ||
59 | #include <openssl/x509.h> | 59 | #include <openssl/x509.h> |
60 | 60 | ||
61 | #ifdef OPENSSL_NO_CMS | ||
61 | #error CMS is disabled. | 62 | #error CMS is disabled. |
63 | #endif | ||
62 | 64 | ||
63 | #ifdef __cplusplus | 65 | #ifdef __cplusplus |
64 | extern "C" { | 66 | extern "C" { |
diff --git a/src/lib/libcrypto/dsa/dsa_ameth.c b/src/lib/libcrypto/dsa/dsa_ameth.c index 8f7a73a481..d4c8b111a8 100644 --- a/src/lib/libcrypto/dsa/dsa_ameth.c +++ b/src/lib/libcrypto/dsa/dsa_ameth.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: dsa_ameth.c,v 1.15 2015/02/11 03:55:42 beck Exp $ */ | 1 | /* $OpenBSD: dsa_ameth.c,v 1.16 2015/02/11 04:05:14 beck Exp $ */ |
2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
3 | * project 2006. | 3 | * project 2006. |
4 | */ | 4 | */ |
@@ -66,6 +66,9 @@ | |||
66 | #include <openssl/err.h> | 66 | #include <openssl/err.h> |
67 | #include <openssl/x509.h> | 67 | #include <openssl/x509.h> |
68 | 68 | ||
69 | #ifndef OPENSSL_NO_CMS | ||
70 | #include <openssl/cms.h> | ||
71 | #endif | ||
69 | 72 | ||
70 | #include "asn1_locl.h" | 73 | #include "asn1_locl.h" |
71 | 74 | ||
@@ -592,6 +595,26 @@ dsa_pkey_ctrl(EVP_PKEY *pkey, int op, long arg1, void *arg2) | |||
592 | 0); | 595 | 0); |
593 | } | 596 | } |
594 | return 1; | 597 | return 1; |
598 | #ifndef OPENSSL_NO_CMS | ||
599 | case ASN1_PKEY_CTRL_CMS_SIGN: | ||
600 | if (arg1 == 0) { | ||
601 | int snid, hnid; | ||
602 | X509_ALGOR *alg1, *alg2; | ||
603 | |||
604 | CMS_SignerInfo_get0_algs(arg2, NULL, NULL, &alg1, &alg2); | ||
605 | if (alg1 == NULL || alg1->algorithm == NULL) | ||
606 | return -1; | ||
607 | hnid = OBJ_obj2nid(alg1->algorithm); | ||
608 | if (hnid == NID_undef) | ||
609 | return -1; | ||
610 | if (!OBJ_find_sigid_by_algs(&snid, hnid, | ||
611 | EVP_PKEY_id(pkey))) | ||
612 | return -1; | ||
613 | X509_ALGOR_set0(alg2, OBJ_nid2obj(snid), V_ASN1_UNDEF, | ||
614 | 0); | ||
615 | } | ||
616 | return 1; | ||
617 | #endif | ||
595 | 618 | ||
596 | case ASN1_PKEY_CTRL_DEFAULT_MD_NID: | 619 | case ASN1_PKEY_CTRL_DEFAULT_MD_NID: |
597 | *(int *)arg2 = NID_sha1; | 620 | *(int *)arg2 = NID_sha1; |
diff --git a/src/lib/libcrypto/ec/ec_ameth.c b/src/lib/libcrypto/ec/ec_ameth.c index 567d16e307..dd1c31883e 100644 --- a/src/lib/libcrypto/ec/ec_ameth.c +++ b/src/lib/libcrypto/ec/ec_ameth.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: ec_ameth.c,v 1.15 2015/02/11 03:55:42 beck Exp $ */ | 1 | /* $OpenBSD: ec_ameth.c,v 1.16 2015/02/11 04:05:14 beck Exp $ */ |
2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
3 | * project 2006. | 3 | * project 2006. |
4 | */ | 4 | */ |
@@ -65,6 +65,9 @@ | |||
65 | #include <openssl/err.h> | 65 | #include <openssl/err.h> |
66 | #include <openssl/x509.h> | 66 | #include <openssl/x509.h> |
67 | 67 | ||
68 | #ifndef OPENSSL_NO_CMS | ||
69 | #include <openssl/cms.h> | ||
70 | #endif | ||
68 | 71 | ||
69 | #include "asn1_locl.h" | 72 | #include "asn1_locl.h" |
70 | 73 | ||
@@ -570,6 +573,24 @@ ec_pkey_ctrl(EVP_PKEY * pkey, int op, long arg1, void *arg2) | |||
570 | X509_ALGOR_set0(alg2, OBJ_nid2obj(snid), V_ASN1_UNDEF, 0); | 573 | X509_ALGOR_set0(alg2, OBJ_nid2obj(snid), V_ASN1_UNDEF, 0); |
571 | } | 574 | } |
572 | return 1; | 575 | return 1; |
576 | #ifndef OPENSSL_NO_CMS | ||
577 | case ASN1_PKEY_CTRL_CMS_SIGN: | ||
578 | if (arg1 == 0) { | ||
579 | int snid, hnid; | ||
580 | X509_ALGOR *alg1, *alg2; | ||
581 | CMS_SignerInfo_get0_algs(arg2, NULL, NULL, | ||
582 | &alg1, &alg2); | ||
583 | if (alg1 == NULL || alg1->algorithm == NULL) | ||
584 | return -1; | ||
585 | hnid = OBJ_obj2nid(alg1->algorithm); | ||
586 | if (hnid == NID_undef) | ||
587 | return -1; | ||
588 | if (!OBJ_find_sigid_by_algs(&snid, hnid, EVP_PKEY_id(pkey))) | ||
589 | return -1; | ||
590 | X509_ALGOR_set0(alg2, OBJ_nid2obj(snid), V_ASN1_UNDEF, 0); | ||
591 | } | ||
592 | return 1; | ||
593 | #endif | ||
573 | 594 | ||
574 | case ASN1_PKEY_CTRL_DEFAULT_MD_NID: | 595 | case ASN1_PKEY_CTRL_DEFAULT_MD_NID: |
575 | *(int *) arg2 = NID_sha1; | 596 | *(int *) arg2 = NID_sha1; |
diff --git a/src/lib/libcrypto/err/err_all.c b/src/lib/libcrypto/err/err_all.c index 296c1a5ba3..58adce64e7 100644 --- a/src/lib/libcrypto/err/err_all.c +++ b/src/lib/libcrypto/err/err_all.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: err_all.c,v 1.21 2015/02/11 03:55:42 beck Exp $ */ | 1 | /* $OpenBSD: err_all.c,v 1.22 2015/02/11 04:05:14 beck Exp $ */ |
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
3 | * All rights reserved. | 3 | * All rights reserved. |
4 | * | 4 | * |
@@ -115,9 +115,6 @@ ERR_load_crypto_strings(void) | |||
115 | #ifndef OPENSSL_NO_RSA | 115 | #ifndef OPENSSL_NO_RSA |
116 | ERR_load_RSA_strings(); | 116 | ERR_load_RSA_strings(); |
117 | #endif | 117 | #endif |
118 | #ifndef OPENSSL_NO_COMP | ||
119 | #include <openssl/comp.h> | ||
120 | #endif | ||
121 | #ifndef OPENSSL_NO_DH | 118 | #ifndef OPENSSL_NO_DH |
122 | ERR_load_DH_strings(); | 119 | ERR_load_DH_strings(); |
123 | #endif | 120 | #endif |
@@ -154,6 +151,9 @@ ERR_load_crypto_strings(void) | |||
154 | #endif | 151 | #endif |
155 | ERR_load_OCSP_strings(); | 152 | ERR_load_OCSP_strings(); |
156 | ERR_load_UI_strings(); | 153 | ERR_load_UI_strings(); |
154 | #ifndef OPENSSL_NO_CMS | ||
155 | ERR_load_CMS_strings(); | ||
156 | #endif | ||
157 | #ifndef OPENSSL_NO_GOST | 157 | #ifndef OPENSSL_NO_GOST |
158 | ERR_load_GOST_strings(); | 158 | ERR_load_GOST_strings(); |
159 | #endif | 159 | #endif |
diff --git a/src/lib/libcrypto/gost/gostr341001_ameth.c b/src/lib/libcrypto/gost/gostr341001_ameth.c index fb1d57ad6d..45ddd44e42 100644 --- a/src/lib/libcrypto/gost/gostr341001_ameth.c +++ b/src/lib/libcrypto/gost/gostr341001_ameth.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: gostr341001_ameth.c,v 1.7 2015/02/11 03:55:42 beck Exp $ */ | 1 | /* $OpenBSD: gostr341001_ameth.c,v 1.8 2015/02/11 04:05:14 beck Exp $ */ |
2 | /* | 2 | /* |
3 | * Copyright (c) 2014 Dmitry Eremin-Solenikov <dbaryshkov@gmail.com> | 3 | * Copyright (c) 2014 Dmitry Eremin-Solenikov <dbaryshkov@gmail.com> |
4 | * Copyright (c) 2005-2006 Cryptocom LTD | 4 | * Copyright (c) 2005-2006 Cryptocom LTD |
@@ -61,6 +61,9 @@ | |||
61 | #include <openssl/x509.h> | 61 | #include <openssl/x509.h> |
62 | #include <openssl/gost.h> | 62 | #include <openssl/gost.h> |
63 | 63 | ||
64 | #ifndef OPENSSL_NO_CMS | ||
65 | #include <openssl/cms.h> | ||
66 | #endif | ||
64 | 67 | ||
65 | #include "asn1_locl.h" | 68 | #include "asn1_locl.h" |
66 | #include "gost_locl.h" | 69 | #include "gost_locl.h" |
@@ -653,6 +656,17 @@ pkey_ctrl_gost01(EVP_PKEY *pkey, int op, long arg1, void *arg2) | |||
653 | if (arg1 == 0) | 656 | if (arg1 == 0) |
654 | PKCS7_RECIP_INFO_get0_alg(arg2, &alg3); | 657 | PKCS7_RECIP_INFO_get0_alg(arg2, &alg3); |
655 | break; | 658 | break; |
659 | #ifndef OPENSSL_NO_CMS | ||
660 | case ASN1_PKEY_CTRL_CMS_SIGN: | ||
661 | if (arg1 == 0) | ||
662 | CMS_SignerInfo_get0_algs(arg2, NULL, NULL, &alg1, &alg2); | ||
663 | break; | ||
664 | |||
665 | case ASN1_PKEY_CTRL_CMS_ENVELOPE: | ||
666 | if (arg1 == 0) | ||
667 | CMS_RecipientInfo_ktri_get0_algs(arg2, NULL, NULL, &alg3); | ||
668 | break; | ||
669 | #endif | ||
656 | case ASN1_PKEY_CTRL_DEFAULT_MD_NID: | 670 | case ASN1_PKEY_CTRL_DEFAULT_MD_NID: |
657 | *(int *)arg2 = GostR3410_get_md_digest(digest); | 671 | *(int *)arg2 = GostR3410_get_md_digest(digest); |
658 | return 2; | 672 | return 2; |
diff --git a/src/lib/libcrypto/gost/gostr341001_pmeth.c b/src/lib/libcrypto/gost/gostr341001_pmeth.c index 89e1ae62cd..0157996a40 100644 --- a/src/lib/libcrypto/gost/gostr341001_pmeth.c +++ b/src/lib/libcrypto/gost/gostr341001_pmeth.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: gostr341001_pmeth.c,v 1.9 2015/02/11 03:55:42 beck Exp $ */ | 1 | /* $OpenBSD: gostr341001_pmeth.c,v 1.10 2015/02/11 04:05:14 beck Exp $ */ |
2 | /* | 2 | /* |
3 | * Copyright (c) 2014 Dmitry Eremin-Solenikov <dbaryshkov@gmail.com> | 3 | * Copyright (c) 2014 Dmitry Eremin-Solenikov <dbaryshkov@gmail.com> |
4 | * Copyright (c) 2005-2006 Cryptocom LTD | 4 | * Copyright (c) 2005-2006 Cryptocom LTD |
@@ -597,6 +597,11 @@ pkey_gost01_ctrl(EVP_PKEY_CTX *ctx, int type, int p1, void *p2) | |||
597 | case EVP_PKEY_CTRL_PKCS7_DECRYPT: | 597 | case EVP_PKEY_CTRL_PKCS7_DECRYPT: |
598 | case EVP_PKEY_CTRL_PKCS7_SIGN: | 598 | case EVP_PKEY_CTRL_PKCS7_SIGN: |
599 | case EVP_PKEY_CTRL_DIGESTINIT: | 599 | case EVP_PKEY_CTRL_DIGESTINIT: |
600 | #ifndef OPENSSL_NO_CMS | ||
601 | case EVP_PKEY_CTRL_CMS_ENCRYPT: | ||
602 | case EVP_PKEY_CTRL_CMS_DECRYPT: | ||
603 | case EVP_PKEY_CTRL_CMS_SIGN: | ||
604 | #endif | ||
600 | return 1; | 605 | return 1; |
601 | 606 | ||
602 | case EVP_PKEY_CTRL_GOST_PARAMSET: | 607 | case EVP_PKEY_CTRL_GOST_PARAMSET: |
diff --git a/src/lib/libcrypto/pem/pem_lib.c b/src/lib/libcrypto/pem/pem_lib.c index 9107e9c225..48768a4467 100644 --- a/src/lib/libcrypto/pem/pem_lib.c +++ b/src/lib/libcrypto/pem/pem_lib.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: pem_lib.c,v 1.38 2015/02/11 03:55:42 beck Exp $ */ | 1 | /* $OpenBSD: pem_lib.c,v 1.39 2015/02/11 04:05:14 beck Exp $ */ |
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
3 | * All rights reserved. | 3 | * All rights reserved. |
4 | * | 4 | * |
@@ -264,6 +264,15 @@ check_pem(const char *nm, const char *name) | |||
264 | !strcmp(name, PEM_STRING_PKCS7)) | 264 | !strcmp(name, PEM_STRING_PKCS7)) |
265 | return 1; | 265 | return 1; |
266 | 266 | ||
267 | #ifndef OPENSSL_NO_CMS | ||
268 | if (!strcmp(nm, PEM_STRING_X509) && | ||
269 | !strcmp(name, PEM_STRING_CMS)) | ||
270 | return 1; | ||
271 | /* Allow CMS to be read from PKCS#7 headers */ | ||
272 | if (!strcmp(nm, PEM_STRING_PKCS7) && | ||
273 | !strcmp(name, PEM_STRING_CMS)) | ||
274 | return 1; | ||
275 | #endif | ||
267 | 276 | ||
268 | return 0; | 277 | return 0; |
269 | } | 278 | } |
diff --git a/src/lib/libcrypto/rsa/rsa_ameth.c b/src/lib/libcrypto/rsa/rsa_ameth.c index a68fcbeb11..528b72b4b9 100644 --- a/src/lib/libcrypto/rsa/rsa_ameth.c +++ b/src/lib/libcrypto/rsa/rsa_ameth.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: rsa_ameth.c,v 1.13 2015/02/11 03:55:42 beck Exp $ */ | 1 | /* $OpenBSD: rsa_ameth.c,v 1.14 2015/02/11 04:05:14 beck Exp $ */ |
2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
3 | * project 2006. | 3 | * project 2006. |
4 | */ | 4 | */ |
@@ -66,6 +66,9 @@ | |||
66 | #include <openssl/rsa.h> | 66 | #include <openssl/rsa.h> |
67 | #include <openssl/x509.h> | 67 | #include <openssl/x509.h> |
68 | 68 | ||
69 | #ifndef OPENSSL_NO_CMS | ||
70 | #include <openssl/cms.h> | ||
71 | #endif | ||
69 | 72 | ||
70 | #include "asn1_locl.h" | 73 | #include "asn1_locl.h" |
71 | 74 | ||
@@ -417,6 +420,17 @@ rsa_pkey_ctrl(EVP_PKEY *pkey, int op, long arg1, void *arg2) | |||
417 | if (arg1 == 0) | 420 | if (arg1 == 0) |
418 | PKCS7_RECIP_INFO_get0_alg(arg2, &alg); | 421 | PKCS7_RECIP_INFO_get0_alg(arg2, &alg); |
419 | break; | 422 | break; |
423 | #ifndef OPENSSL_NO_CMS | ||
424 | case ASN1_PKEY_CTRL_CMS_SIGN: | ||
425 | if (arg1 == 0) | ||
426 | CMS_SignerInfo_get0_algs(arg2, NULL, NULL, NULL, &alg); | ||
427 | break; | ||
428 | |||
429 | case ASN1_PKEY_CTRL_CMS_ENVELOPE: | ||
430 | if (arg1 == 0) | ||
431 | CMS_RecipientInfo_ktri_get0_algs(arg2, NULL, NULL, &alg); | ||
432 | break; | ||
433 | #endif | ||
420 | 434 | ||
421 | case ASN1_PKEY_CTRL_DEFAULT_MD_NID: | 435 | case ASN1_PKEY_CTRL_DEFAULT_MD_NID: |
422 | *(int *)arg2 = NID_sha1; | 436 | *(int *)arg2 = NID_sha1; |
diff --git a/src/lib/libcrypto/rsa/rsa_pmeth.c b/src/lib/libcrypto/rsa/rsa_pmeth.c index 6d38a7c923..09166e105b 100644 --- a/src/lib/libcrypto/rsa/rsa_pmeth.c +++ b/src/lib/libcrypto/rsa/rsa_pmeth.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: rsa_pmeth.c,v 1.15 2015/02/11 03:55:42 beck Exp $ */ | 1 | /* $OpenBSD: rsa_pmeth.c,v 1.16 2015/02/11 04:05:14 beck Exp $ */ |
2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
3 | * project 2006. | 3 | * project 2006. |
4 | */ | 4 | */ |
@@ -69,6 +69,9 @@ | |||
69 | #include <openssl/rsa.h> | 69 | #include <openssl/rsa.h> |
70 | #include <openssl/x509.h> | 70 | #include <openssl/x509.h> |
71 | 71 | ||
72 | #ifndef OPENSSL_NO_CMS | ||
73 | #include <openssl/cms.h> | ||
74 | #endif | ||
72 | 75 | ||
73 | #include "evp_locl.h" | 76 | #include "evp_locl.h" |
74 | #include "rsa_locl.h" | 77 | #include "rsa_locl.h" |
@@ -459,6 +462,26 @@ bad_pad: | |||
459 | case EVP_PKEY_CTRL_PKCS7_DECRYPT: | 462 | case EVP_PKEY_CTRL_PKCS7_DECRYPT: |
460 | case EVP_PKEY_CTRL_PKCS7_SIGN: | 463 | case EVP_PKEY_CTRL_PKCS7_SIGN: |
461 | return 1; | 464 | return 1; |
465 | #ifndef OPENSSL_NO_CMS | ||
466 | case EVP_PKEY_CTRL_CMS_DECRYPT: | ||
467 | { | ||
468 | X509_ALGOR *alg = NULL; | ||
469 | ASN1_OBJECT *encalg = NULL; | ||
470 | |||
471 | if (p2) | ||
472 | CMS_RecipientInfo_ktri_get0_algs(p2, NULL, | ||
473 | NULL, &alg); | ||
474 | if (alg) | ||
475 | X509_ALGOR_get0(&encalg, NULL, NULL, alg); | ||
476 | if (encalg && OBJ_obj2nid(encalg) == NID_rsaesOaep) | ||
477 | rctx->pad_mode = RSA_PKCS1_OAEP_PADDING; | ||
478 | } | ||
479 | /* FALLTHROUGH */ | ||
480 | |||
481 | case EVP_PKEY_CTRL_CMS_ENCRYPT: | ||
482 | case EVP_PKEY_CTRL_CMS_SIGN: | ||
483 | return 1; | ||
484 | #endif | ||
462 | case EVP_PKEY_CTRL_PEER_KEY: | 485 | case EVP_PKEY_CTRL_PEER_KEY: |
463 | RSAerr(RSA_F_PKEY_RSA_CTRL, | 486 | RSAerr(RSA_F_PKEY_RSA_CTRL, |
464 | RSA_R_OPERATION_NOT_SUPPORTED_FOR_THIS_KEYTYPE); | 487 | RSA_R_OPERATION_NOT_SUPPORTED_FOR_THIS_KEYTYPE); |
diff --git a/src/lib/libssl/src/crypto/cms/cms.h b/src/lib/libssl/src/crypto/cms/cms.h index f08e2f8457..9a5aae5299 100644 --- a/src/lib/libssl/src/crypto/cms/cms.h +++ b/src/lib/libssl/src/crypto/cms/cms.h | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: cms.h,v 1.6 2015/02/11 03:55:42 beck Exp $ */ | 1 | /* $OpenBSD: cms.h,v 1.7 2015/02/11 04:05:14 beck Exp $ */ |
2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
3 | * project. | 3 | * project. |
4 | */ | 4 | */ |
@@ -58,7 +58,9 @@ | |||
58 | 58 | ||
59 | #include <openssl/x509.h> | 59 | #include <openssl/x509.h> |
60 | 60 | ||
61 | #ifdef OPENSSL_NO_CMS | ||
61 | #error CMS is disabled. | 62 | #error CMS is disabled. |
63 | #endif | ||
62 | 64 | ||
63 | #ifdef __cplusplus | 65 | #ifdef __cplusplus |
64 | extern "C" { | 66 | extern "C" { |
diff --git a/src/lib/libssl/src/crypto/dsa/dsa_ameth.c b/src/lib/libssl/src/crypto/dsa/dsa_ameth.c index 8f7a73a481..d4c8b111a8 100644 --- a/src/lib/libssl/src/crypto/dsa/dsa_ameth.c +++ b/src/lib/libssl/src/crypto/dsa/dsa_ameth.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: dsa_ameth.c,v 1.15 2015/02/11 03:55:42 beck Exp $ */ | 1 | /* $OpenBSD: dsa_ameth.c,v 1.16 2015/02/11 04:05:14 beck Exp $ */ |
2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
3 | * project 2006. | 3 | * project 2006. |
4 | */ | 4 | */ |
@@ -66,6 +66,9 @@ | |||
66 | #include <openssl/err.h> | 66 | #include <openssl/err.h> |
67 | #include <openssl/x509.h> | 67 | #include <openssl/x509.h> |
68 | 68 | ||
69 | #ifndef OPENSSL_NO_CMS | ||
70 | #include <openssl/cms.h> | ||
71 | #endif | ||
69 | 72 | ||
70 | #include "asn1_locl.h" | 73 | #include "asn1_locl.h" |
71 | 74 | ||
@@ -592,6 +595,26 @@ dsa_pkey_ctrl(EVP_PKEY *pkey, int op, long arg1, void *arg2) | |||
592 | 0); | 595 | 0); |
593 | } | 596 | } |
594 | return 1; | 597 | return 1; |
598 | #ifndef OPENSSL_NO_CMS | ||
599 | case ASN1_PKEY_CTRL_CMS_SIGN: | ||
600 | if (arg1 == 0) { | ||
601 | int snid, hnid; | ||
602 | X509_ALGOR *alg1, *alg2; | ||
603 | |||
604 | CMS_SignerInfo_get0_algs(arg2, NULL, NULL, &alg1, &alg2); | ||
605 | if (alg1 == NULL || alg1->algorithm == NULL) | ||
606 | return -1; | ||
607 | hnid = OBJ_obj2nid(alg1->algorithm); | ||
608 | if (hnid == NID_undef) | ||
609 | return -1; | ||
610 | if (!OBJ_find_sigid_by_algs(&snid, hnid, | ||
611 | EVP_PKEY_id(pkey))) | ||
612 | return -1; | ||
613 | X509_ALGOR_set0(alg2, OBJ_nid2obj(snid), V_ASN1_UNDEF, | ||
614 | 0); | ||
615 | } | ||
616 | return 1; | ||
617 | #endif | ||
595 | 618 | ||
596 | case ASN1_PKEY_CTRL_DEFAULT_MD_NID: | 619 | case ASN1_PKEY_CTRL_DEFAULT_MD_NID: |
597 | *(int *)arg2 = NID_sha1; | 620 | *(int *)arg2 = NID_sha1; |
diff --git a/src/lib/libssl/src/crypto/ec/ec_ameth.c b/src/lib/libssl/src/crypto/ec/ec_ameth.c index 567d16e307..dd1c31883e 100644 --- a/src/lib/libssl/src/crypto/ec/ec_ameth.c +++ b/src/lib/libssl/src/crypto/ec/ec_ameth.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: ec_ameth.c,v 1.15 2015/02/11 03:55:42 beck Exp $ */ | 1 | /* $OpenBSD: ec_ameth.c,v 1.16 2015/02/11 04:05:14 beck Exp $ */ |
2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
3 | * project 2006. | 3 | * project 2006. |
4 | */ | 4 | */ |
@@ -65,6 +65,9 @@ | |||
65 | #include <openssl/err.h> | 65 | #include <openssl/err.h> |
66 | #include <openssl/x509.h> | 66 | #include <openssl/x509.h> |
67 | 67 | ||
68 | #ifndef OPENSSL_NO_CMS | ||
69 | #include <openssl/cms.h> | ||
70 | #endif | ||
68 | 71 | ||
69 | #include "asn1_locl.h" | 72 | #include "asn1_locl.h" |
70 | 73 | ||
@@ -570,6 +573,24 @@ ec_pkey_ctrl(EVP_PKEY * pkey, int op, long arg1, void *arg2) | |||
570 | X509_ALGOR_set0(alg2, OBJ_nid2obj(snid), V_ASN1_UNDEF, 0); | 573 | X509_ALGOR_set0(alg2, OBJ_nid2obj(snid), V_ASN1_UNDEF, 0); |
571 | } | 574 | } |
572 | return 1; | 575 | return 1; |
576 | #ifndef OPENSSL_NO_CMS | ||
577 | case ASN1_PKEY_CTRL_CMS_SIGN: | ||
578 | if (arg1 == 0) { | ||
579 | int snid, hnid; | ||
580 | X509_ALGOR *alg1, *alg2; | ||
581 | CMS_SignerInfo_get0_algs(arg2, NULL, NULL, | ||
582 | &alg1, &alg2); | ||
583 | if (alg1 == NULL || alg1->algorithm == NULL) | ||
584 | return -1; | ||
585 | hnid = OBJ_obj2nid(alg1->algorithm); | ||
586 | if (hnid == NID_undef) | ||
587 | return -1; | ||
588 | if (!OBJ_find_sigid_by_algs(&snid, hnid, EVP_PKEY_id(pkey))) | ||
589 | return -1; | ||
590 | X509_ALGOR_set0(alg2, OBJ_nid2obj(snid), V_ASN1_UNDEF, 0); | ||
591 | } | ||
592 | return 1; | ||
593 | #endif | ||
573 | 594 | ||
574 | case ASN1_PKEY_CTRL_DEFAULT_MD_NID: | 595 | case ASN1_PKEY_CTRL_DEFAULT_MD_NID: |
575 | *(int *) arg2 = NID_sha1; | 596 | *(int *) arg2 = NID_sha1; |
diff --git a/src/lib/libssl/src/crypto/err/err_all.c b/src/lib/libssl/src/crypto/err/err_all.c index 296c1a5ba3..58adce64e7 100644 --- a/src/lib/libssl/src/crypto/err/err_all.c +++ b/src/lib/libssl/src/crypto/err/err_all.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: err_all.c,v 1.21 2015/02/11 03:55:42 beck Exp $ */ | 1 | /* $OpenBSD: err_all.c,v 1.22 2015/02/11 04:05:14 beck Exp $ */ |
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
3 | * All rights reserved. | 3 | * All rights reserved. |
4 | * | 4 | * |
@@ -115,9 +115,6 @@ ERR_load_crypto_strings(void) | |||
115 | #ifndef OPENSSL_NO_RSA | 115 | #ifndef OPENSSL_NO_RSA |
116 | ERR_load_RSA_strings(); | 116 | ERR_load_RSA_strings(); |
117 | #endif | 117 | #endif |
118 | #ifndef OPENSSL_NO_COMP | ||
119 | #include <openssl/comp.h> | ||
120 | #endif | ||
121 | #ifndef OPENSSL_NO_DH | 118 | #ifndef OPENSSL_NO_DH |
122 | ERR_load_DH_strings(); | 119 | ERR_load_DH_strings(); |
123 | #endif | 120 | #endif |
@@ -154,6 +151,9 @@ ERR_load_crypto_strings(void) | |||
154 | #endif | 151 | #endif |
155 | ERR_load_OCSP_strings(); | 152 | ERR_load_OCSP_strings(); |
156 | ERR_load_UI_strings(); | 153 | ERR_load_UI_strings(); |
154 | #ifndef OPENSSL_NO_CMS | ||
155 | ERR_load_CMS_strings(); | ||
156 | #endif | ||
157 | #ifndef OPENSSL_NO_GOST | 157 | #ifndef OPENSSL_NO_GOST |
158 | ERR_load_GOST_strings(); | 158 | ERR_load_GOST_strings(); |
159 | #endif | 159 | #endif |
diff --git a/src/lib/libssl/src/crypto/gost/gostr341001_ameth.c b/src/lib/libssl/src/crypto/gost/gostr341001_ameth.c index fb1d57ad6d..45ddd44e42 100644 --- a/src/lib/libssl/src/crypto/gost/gostr341001_ameth.c +++ b/src/lib/libssl/src/crypto/gost/gostr341001_ameth.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: gostr341001_ameth.c,v 1.7 2015/02/11 03:55:42 beck Exp $ */ | 1 | /* $OpenBSD: gostr341001_ameth.c,v 1.8 2015/02/11 04:05:14 beck Exp $ */ |
2 | /* | 2 | /* |
3 | * Copyright (c) 2014 Dmitry Eremin-Solenikov <dbaryshkov@gmail.com> | 3 | * Copyright (c) 2014 Dmitry Eremin-Solenikov <dbaryshkov@gmail.com> |
4 | * Copyright (c) 2005-2006 Cryptocom LTD | 4 | * Copyright (c) 2005-2006 Cryptocom LTD |
@@ -61,6 +61,9 @@ | |||
61 | #include <openssl/x509.h> | 61 | #include <openssl/x509.h> |
62 | #include <openssl/gost.h> | 62 | #include <openssl/gost.h> |
63 | 63 | ||
64 | #ifndef OPENSSL_NO_CMS | ||
65 | #include <openssl/cms.h> | ||
66 | #endif | ||
64 | 67 | ||
65 | #include "asn1_locl.h" | 68 | #include "asn1_locl.h" |
66 | #include "gost_locl.h" | 69 | #include "gost_locl.h" |
@@ -653,6 +656,17 @@ pkey_ctrl_gost01(EVP_PKEY *pkey, int op, long arg1, void *arg2) | |||
653 | if (arg1 == 0) | 656 | if (arg1 == 0) |
654 | PKCS7_RECIP_INFO_get0_alg(arg2, &alg3); | 657 | PKCS7_RECIP_INFO_get0_alg(arg2, &alg3); |
655 | break; | 658 | break; |
659 | #ifndef OPENSSL_NO_CMS | ||
660 | case ASN1_PKEY_CTRL_CMS_SIGN: | ||
661 | if (arg1 == 0) | ||
662 | CMS_SignerInfo_get0_algs(arg2, NULL, NULL, &alg1, &alg2); | ||
663 | break; | ||
664 | |||
665 | case ASN1_PKEY_CTRL_CMS_ENVELOPE: | ||
666 | if (arg1 == 0) | ||
667 | CMS_RecipientInfo_ktri_get0_algs(arg2, NULL, NULL, &alg3); | ||
668 | break; | ||
669 | #endif | ||
656 | case ASN1_PKEY_CTRL_DEFAULT_MD_NID: | 670 | case ASN1_PKEY_CTRL_DEFAULT_MD_NID: |
657 | *(int *)arg2 = GostR3410_get_md_digest(digest); | 671 | *(int *)arg2 = GostR3410_get_md_digest(digest); |
658 | return 2; | 672 | return 2; |
diff --git a/src/lib/libssl/src/crypto/gost/gostr341001_pmeth.c b/src/lib/libssl/src/crypto/gost/gostr341001_pmeth.c index 89e1ae62cd..0157996a40 100644 --- a/src/lib/libssl/src/crypto/gost/gostr341001_pmeth.c +++ b/src/lib/libssl/src/crypto/gost/gostr341001_pmeth.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: gostr341001_pmeth.c,v 1.9 2015/02/11 03:55:42 beck Exp $ */ | 1 | /* $OpenBSD: gostr341001_pmeth.c,v 1.10 2015/02/11 04:05:14 beck Exp $ */ |
2 | /* | 2 | /* |
3 | * Copyright (c) 2014 Dmitry Eremin-Solenikov <dbaryshkov@gmail.com> | 3 | * Copyright (c) 2014 Dmitry Eremin-Solenikov <dbaryshkov@gmail.com> |
4 | * Copyright (c) 2005-2006 Cryptocom LTD | 4 | * Copyright (c) 2005-2006 Cryptocom LTD |
@@ -597,6 +597,11 @@ pkey_gost01_ctrl(EVP_PKEY_CTX *ctx, int type, int p1, void *p2) | |||
597 | case EVP_PKEY_CTRL_PKCS7_DECRYPT: | 597 | case EVP_PKEY_CTRL_PKCS7_DECRYPT: |
598 | case EVP_PKEY_CTRL_PKCS7_SIGN: | 598 | case EVP_PKEY_CTRL_PKCS7_SIGN: |
599 | case EVP_PKEY_CTRL_DIGESTINIT: | 599 | case EVP_PKEY_CTRL_DIGESTINIT: |
600 | #ifndef OPENSSL_NO_CMS | ||
601 | case EVP_PKEY_CTRL_CMS_ENCRYPT: | ||
602 | case EVP_PKEY_CTRL_CMS_DECRYPT: | ||
603 | case EVP_PKEY_CTRL_CMS_SIGN: | ||
604 | #endif | ||
600 | return 1; | 605 | return 1; |
601 | 606 | ||
602 | case EVP_PKEY_CTRL_GOST_PARAMSET: | 607 | case EVP_PKEY_CTRL_GOST_PARAMSET: |
diff --git a/src/lib/libssl/src/crypto/pem/pem_lib.c b/src/lib/libssl/src/crypto/pem/pem_lib.c index 9107e9c225..48768a4467 100644 --- a/src/lib/libssl/src/crypto/pem/pem_lib.c +++ b/src/lib/libssl/src/crypto/pem/pem_lib.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: pem_lib.c,v 1.38 2015/02/11 03:55:42 beck Exp $ */ | 1 | /* $OpenBSD: pem_lib.c,v 1.39 2015/02/11 04:05:14 beck Exp $ */ |
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
3 | * All rights reserved. | 3 | * All rights reserved. |
4 | * | 4 | * |
@@ -264,6 +264,15 @@ check_pem(const char *nm, const char *name) | |||
264 | !strcmp(name, PEM_STRING_PKCS7)) | 264 | !strcmp(name, PEM_STRING_PKCS7)) |
265 | return 1; | 265 | return 1; |
266 | 266 | ||
267 | #ifndef OPENSSL_NO_CMS | ||
268 | if (!strcmp(nm, PEM_STRING_X509) && | ||
269 | !strcmp(name, PEM_STRING_CMS)) | ||
270 | return 1; | ||
271 | /* Allow CMS to be read from PKCS#7 headers */ | ||
272 | if (!strcmp(nm, PEM_STRING_PKCS7) && | ||
273 | !strcmp(name, PEM_STRING_CMS)) | ||
274 | return 1; | ||
275 | #endif | ||
267 | 276 | ||
268 | return 0; | 277 | return 0; |
269 | } | 278 | } |
diff --git a/src/lib/libssl/src/crypto/rsa/rsa_ameth.c b/src/lib/libssl/src/crypto/rsa/rsa_ameth.c index a68fcbeb11..528b72b4b9 100644 --- a/src/lib/libssl/src/crypto/rsa/rsa_ameth.c +++ b/src/lib/libssl/src/crypto/rsa/rsa_ameth.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: rsa_ameth.c,v 1.13 2015/02/11 03:55:42 beck Exp $ */ | 1 | /* $OpenBSD: rsa_ameth.c,v 1.14 2015/02/11 04:05:14 beck Exp $ */ |
2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
3 | * project 2006. | 3 | * project 2006. |
4 | */ | 4 | */ |
@@ -66,6 +66,9 @@ | |||
66 | #include <openssl/rsa.h> | 66 | #include <openssl/rsa.h> |
67 | #include <openssl/x509.h> | 67 | #include <openssl/x509.h> |
68 | 68 | ||
69 | #ifndef OPENSSL_NO_CMS | ||
70 | #include <openssl/cms.h> | ||
71 | #endif | ||
69 | 72 | ||
70 | #include "asn1_locl.h" | 73 | #include "asn1_locl.h" |
71 | 74 | ||
@@ -417,6 +420,17 @@ rsa_pkey_ctrl(EVP_PKEY *pkey, int op, long arg1, void *arg2) | |||
417 | if (arg1 == 0) | 420 | if (arg1 == 0) |
418 | PKCS7_RECIP_INFO_get0_alg(arg2, &alg); | 421 | PKCS7_RECIP_INFO_get0_alg(arg2, &alg); |
419 | break; | 422 | break; |
423 | #ifndef OPENSSL_NO_CMS | ||
424 | case ASN1_PKEY_CTRL_CMS_SIGN: | ||
425 | if (arg1 == 0) | ||
426 | CMS_SignerInfo_get0_algs(arg2, NULL, NULL, NULL, &alg); | ||
427 | break; | ||
428 | |||
429 | case ASN1_PKEY_CTRL_CMS_ENVELOPE: | ||
430 | if (arg1 == 0) | ||
431 | CMS_RecipientInfo_ktri_get0_algs(arg2, NULL, NULL, &alg); | ||
432 | break; | ||
433 | #endif | ||
420 | 434 | ||
421 | case ASN1_PKEY_CTRL_DEFAULT_MD_NID: | 435 | case ASN1_PKEY_CTRL_DEFAULT_MD_NID: |
422 | *(int *)arg2 = NID_sha1; | 436 | *(int *)arg2 = NID_sha1; |
diff --git a/src/lib/libssl/src/crypto/rsa/rsa_pmeth.c b/src/lib/libssl/src/crypto/rsa/rsa_pmeth.c index 6d38a7c923..09166e105b 100644 --- a/src/lib/libssl/src/crypto/rsa/rsa_pmeth.c +++ b/src/lib/libssl/src/crypto/rsa/rsa_pmeth.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: rsa_pmeth.c,v 1.15 2015/02/11 03:55:42 beck Exp $ */ | 1 | /* $OpenBSD: rsa_pmeth.c,v 1.16 2015/02/11 04:05:14 beck Exp $ */ |
2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
3 | * project 2006. | 3 | * project 2006. |
4 | */ | 4 | */ |
@@ -69,6 +69,9 @@ | |||
69 | #include <openssl/rsa.h> | 69 | #include <openssl/rsa.h> |
70 | #include <openssl/x509.h> | 70 | #include <openssl/x509.h> |
71 | 71 | ||
72 | #ifndef OPENSSL_NO_CMS | ||
73 | #include <openssl/cms.h> | ||
74 | #endif | ||
72 | 75 | ||
73 | #include "evp_locl.h" | 76 | #include "evp_locl.h" |
74 | #include "rsa_locl.h" | 77 | #include "rsa_locl.h" |
@@ -459,6 +462,26 @@ bad_pad: | |||
459 | case EVP_PKEY_CTRL_PKCS7_DECRYPT: | 462 | case EVP_PKEY_CTRL_PKCS7_DECRYPT: |
460 | case EVP_PKEY_CTRL_PKCS7_SIGN: | 463 | case EVP_PKEY_CTRL_PKCS7_SIGN: |
461 | return 1; | 464 | return 1; |
465 | #ifndef OPENSSL_NO_CMS | ||
466 | case EVP_PKEY_CTRL_CMS_DECRYPT: | ||
467 | { | ||
468 | X509_ALGOR *alg = NULL; | ||
469 | ASN1_OBJECT *encalg = NULL; | ||
470 | |||
471 | if (p2) | ||
472 | CMS_RecipientInfo_ktri_get0_algs(p2, NULL, | ||
473 | NULL, &alg); | ||
474 | if (alg) | ||
475 | X509_ALGOR_get0(&encalg, NULL, NULL, alg); | ||
476 | if (encalg && OBJ_obj2nid(encalg) == NID_rsaesOaep) | ||
477 | rctx->pad_mode = RSA_PKCS1_OAEP_PADDING; | ||
478 | } | ||
479 | /* FALLTHROUGH */ | ||
480 | |||
481 | case EVP_PKEY_CTRL_CMS_ENCRYPT: | ||
482 | case EVP_PKEY_CTRL_CMS_SIGN: | ||
483 | return 1; | ||
484 | #endif | ||
462 | case EVP_PKEY_CTRL_PEER_KEY: | 485 | case EVP_PKEY_CTRL_PEER_KEY: |
463 | RSAerr(RSA_F_PKEY_RSA_CTRL, | 486 | RSAerr(RSA_F_PKEY_RSA_CTRL, |
464 | RSA_R_OPERATION_NOT_SUPPORTED_FOR_THIS_KEYTYPE); | 487 | RSA_R_OPERATION_NOT_SUPPORTED_FOR_THIS_KEYTYPE); |