summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/ec/ec_ameth.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/lib/libcrypto/ec/ec_ameth.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/src/lib/libcrypto/ec/ec_ameth.c b/src/lib/libcrypto/ec/ec_ameth.c
index c96c46dd53..8316683f8f 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.29 2021/12/12 21:30:13 tb Exp $ */ 1/* $OpenBSD: ec_ameth.c,v 1.30 2022/01/10 11:52:43 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 */
@@ -67,6 +67,7 @@
67#include <openssl/x509.h> 67#include <openssl/x509.h>
68 68
69#include "asn1_locl.h" 69#include "asn1_locl.h"
70#include "ec_lcl.h"
70#include "evp_locl.h" 71#include "evp_locl.h"
71 72
72#ifndef OPENSSL_NO_CMS 73#ifndef OPENSSL_NO_CMS
@@ -620,6 +621,19 @@ ec_pkey_ctrl(EVP_PKEY * pkey, int op, long arg1, void *arg2)
620 621
621} 622}
622 623
624static int
625ec_pkey_check(const EVP_PKEY *pkey)
626{
627 EC_KEY *eckey = pkey->pkey.ec;
628
629 if (eckey->priv_key == NULL) {
630 ECerror(EC_R_MISSING_PRIVATE_KEY);
631 return 0;
632 }
633
634 return EC_KEY_check_key(eckey);
635}
636
623#ifndef OPENSSL_NO_CMS 637#ifndef OPENSSL_NO_CMS
624 638
625static int 639static int
@@ -981,5 +995,7 @@ const EVP_PKEY_ASN1_METHOD eckey_asn1_meth = {
981 .pkey_free = int_ec_free, 995 .pkey_free = int_ec_free,
982 .pkey_ctrl = ec_pkey_ctrl, 996 .pkey_ctrl = ec_pkey_ctrl,
983 .old_priv_decode = old_ec_priv_decode, 997 .old_priv_decode = old_ec_priv_decode,
984 .old_priv_encode = old_ec_priv_encode 998 .old_priv_encode = old_ec_priv_encode,
999
1000 .pkey_check = ec_pkey_check,
985}; 1001};