diff options
| author | jsing <> | 2019-11-01 15:15:35 +0000 |
|---|---|---|
| committer | jsing <> | 2019-11-01 15:15:35 +0000 |
| commit | 57cc49536e4be1e0b109792c06bf5eccd0f5753b (patch) | |
| tree | 1c9a49013c127ca777a9405b52eb6c0275438053 /src | |
| parent | 17858cdeb078e907ebcaa79e63db7926fc9540db (diff) | |
| download | openbsd-57cc49536e4be1e0b109792c06bf5eccd0f5753b.tar.gz openbsd-57cc49536e4be1e0b109792c06bf5eccd0f5753b.tar.bz2 openbsd-57cc49536e4be1e0b109792c06bf5eccd0f5753b.zip | |
Add DSA CMS support.
From OpenSSL 1.1.1d.
ok tb@
Diffstat (limited to 'src')
| -rw-r--r-- | src/lib/libcrypto/dsa/dsa_ameth.c | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/src/lib/libcrypto/dsa/dsa_ameth.c b/src/lib/libcrypto/dsa/dsa_ameth.c index 85ef234bb9..cfb33237ec 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.27 2019/01/20 01:56:59 tb Exp $ */ | 1 | /* $OpenBSD: dsa_ameth.c,v 1.28 2019/11/01 15:15:35 jsing 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 | */ |
| @@ -62,6 +62,7 @@ | |||
| 62 | 62 | ||
| 63 | #include <openssl/asn1.h> | 63 | #include <openssl/asn1.h> |
| 64 | #include <openssl/bn.h> | 64 | #include <openssl/bn.h> |
| 65 | #include <openssl/cms.h> | ||
| 65 | #include <openssl/dsa.h> | 66 | #include <openssl/dsa.h> |
| 66 | #include <openssl/err.h> | 67 | #include <openssl/err.h> |
| 67 | #include <openssl/x509.h> | 68 | #include <openssl/x509.h> |
| @@ -604,6 +605,29 @@ dsa_pkey_ctrl(EVP_PKEY *pkey, int op, long arg1, void *arg2) | |||
| 604 | } | 605 | } |
| 605 | return 1; | 606 | return 1; |
| 606 | 607 | ||
| 608 | #ifndef OPENSSL_NO_CMS | ||
| 609 | case ASN1_PKEY_CTRL_CMS_SIGN: | ||
| 610 | if (arg1 == 0) { | ||
| 611 | int snid, hnid; | ||
| 612 | X509_ALGOR *alg1, *alg2; | ||
| 613 | |||
| 614 | CMS_SignerInfo_get0_algs(arg2, NULL, NULL, &alg1, &alg2); | ||
| 615 | if (alg1 == NULL || alg1->algorithm == NULL) | ||
| 616 | return -1; | ||
| 617 | hnid = OBJ_obj2nid(alg1->algorithm); | ||
| 618 | if (hnid == NID_undef) | ||
| 619 | return -1; | ||
| 620 | if (!OBJ_find_sigid_by_algs(&snid, hnid, EVP_PKEY_id(pkey))) | ||
| 621 | return -1; | ||
| 622 | X509_ALGOR_set0(alg2, OBJ_nid2obj(snid), V_ASN1_UNDEF, 0); | ||
| 623 | } | ||
| 624 | return 1; | ||
| 625 | |||
| 626 | case ASN1_PKEY_CTRL_CMS_RI_TYPE: | ||
| 627 | *(int *)arg2 = CMS_RECIPINFO_NONE; | ||
| 628 | return 1; | ||
| 629 | #endif | ||
| 630 | |||
| 607 | case ASN1_PKEY_CTRL_DEFAULT_MD_NID: | 631 | case ASN1_PKEY_CTRL_DEFAULT_MD_NID: |
| 608 | *(int *)arg2 = NID_sha1; | 632 | *(int *)arg2 = NID_sha1; |
| 609 | return 2; | 633 | return 2; |
