diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/lib/libcrypto/ec/ec_ameth.c | 21 |
1 files changed, 6 insertions, 15 deletions
diff --git a/src/lib/libcrypto/ec/ec_ameth.c b/src/lib/libcrypto/ec/ec_ameth.c index 1c2b6be87c..78580024e0 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.56 2024/04/17 13:50:01 tb Exp $ */ | 1 | /* $OpenBSD: ec_ameth.c,v 1.57 2024/04/17 13:51:41 tb 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 | */ |
| @@ -912,7 +912,6 @@ static int | |||
| 912 | ecdh_cms_encrypt(CMS_RecipientInfo *ri) | 912 | ecdh_cms_encrypt(CMS_RecipientInfo *ri) |
| 913 | { | 913 | { |
| 914 | EVP_PKEY_CTX *pctx; | 914 | EVP_PKEY_CTX *pctx; |
| 915 | EVP_PKEY *pkey; | ||
| 916 | EVP_CIPHER_CTX *ctx; | 915 | EVP_CIPHER_CTX *ctx; |
| 917 | int keylen; | 916 | int keylen; |
| 918 | X509_ALGOR *talg, *wrap_alg = NULL; | 917 | X509_ALGOR *talg, *wrap_alg = NULL; |
| @@ -928,8 +927,6 @@ ecdh_cms_encrypt(CMS_RecipientInfo *ri) | |||
| 928 | 927 | ||
| 929 | if ((pctx = CMS_RecipientInfo_get0_pkey_ctx(ri)) == NULL) | 928 | if ((pctx = CMS_RecipientInfo_get0_pkey_ctx(ri)) == NULL) |
| 930 | goto err; | 929 | goto err; |
| 931 | /* Get ephemeral key */ | ||
| 932 | pkey = EVP_PKEY_CTX_get0_pkey(pctx); | ||
| 933 | if (!CMS_RecipientInfo_kari_get0_orig_id(ri, &talg, &pubkey, | 930 | if (!CMS_RecipientInfo_kari_get0_orig_id(ri, &talg, &pubkey, |
| 934 | NULL, NULL, NULL)) | 931 | NULL, NULL, NULL)) |
| 935 | goto err; | 932 | goto err; |
| @@ -937,19 +934,13 @@ ecdh_cms_encrypt(CMS_RecipientInfo *ri) | |||
| 937 | 934 | ||
| 938 | /* Is everything uninitialised? */ | 935 | /* Is everything uninitialised? */ |
| 939 | if (aoid == OBJ_nid2obj(NID_undef)) { | 936 | if (aoid == OBJ_nid2obj(NID_undef)) { |
| 940 | EC_KEY *eckey = pkey->pkey.ec; | 937 | EVP_PKEY *pkey; |
| 941 | unsigned char *p; | ||
| 942 | 938 | ||
| 943 | /* Set the key */ | 939 | if ((pkey = EVP_PKEY_CTX_get0_pkey(pctx)) == NULL) |
| 944 | penclen = i2o_ECPublicKey(eckey, NULL); | ||
| 945 | if (penclen <= 0) | ||
| 946 | goto err; | 940 | goto err; |
| 947 | penc = malloc(penclen); | 941 | |
| 948 | if (penc == NULL) | 942 | penc = NULL; |
| 949 | goto err; | 943 | if ((penclen = i2o_ECPublicKey(pkey->pkey.ec, &penc)) <= 0) |
| 950 | p = penc; | ||
| 951 | penclen = i2o_ECPublicKey(eckey, &p); | ||
| 952 | if (penclen <= 0) | ||
| 953 | goto err; | 944 | goto err; |
| 954 | 945 | ||
| 955 | ASN1_STRING_set0(pubkey, penc, penclen); | 946 | ASN1_STRING_set0(pubkey, penc, penclen); |
