summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/evp/pmeth_gn.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/lib/libcrypto/evp/pmeth_gn.c24
1 files changed, 23 insertions, 1 deletions
diff --git a/src/lib/libcrypto/evp/pmeth_gn.c b/src/lib/libcrypto/evp/pmeth_gn.c
index 066291b800..a8a4cc97db 100644
--- a/src/lib/libcrypto/evp/pmeth_gn.c
+++ b/src/lib/libcrypto/evp/pmeth_gn.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: pmeth_gn.c,v 1.8 2021/12/04 16:08:32 tb Exp $ */ 1/* $OpenBSD: pmeth_gn.c,v 1.9 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 */
@@ -64,6 +64,7 @@
64#include <openssl/evp.h> 64#include <openssl/evp.h>
65#include <openssl/objects.h> 65#include <openssl/objects.h>
66 66
67#include "asn1_locl.h"
67#include "bn_lcl.h" 68#include "bn_lcl.h"
68#include "evp_locl.h" 69#include "evp_locl.h"
69 70
@@ -222,3 +223,24 @@ merr:
222 EVP_PKEY_CTX_free(mac_ctx); 223 EVP_PKEY_CTX_free(mac_ctx);
223 return mac_key; 224 return mac_key;
224} 225}
226
227int
228EVP_PKEY_check(EVP_PKEY_CTX *ctx)
229{
230 EVP_PKEY *pkey;
231
232 if ((pkey = ctx->pkey) == NULL) {
233 EVPerror(EVP_R_NO_KEY_SET);
234 return 0;
235 }
236
237 if (ctx->pmeth->check != NULL)
238 return ctx->pmeth->check(pkey);
239
240 if (pkey->ameth == NULL || pkey->ameth->pkey_check == NULL) {
241 EVPerror(EVP_R_OPERATION_NOT_SUPPORTED_FOR_THIS_KEYTYPE);
242 return -2;
243 }
244
245 return pkey->ameth->pkey_check(pkey);
246}