diff options
Diffstat (limited to 'src/lib/libcrypto/dsa')
-rw-r--r-- | src/lib/libcrypto/dsa/dsa_ameth.c | 25 |
1 files changed, 24 insertions, 1 deletions
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; |