diff options
| author | tb <> | 2022-01-10 11:52:43 +0000 |
|---|---|---|
| committer | tb <> | 2022-01-10 11:52:43 +0000 |
| commit | c4f6925dc73274ba5f411d30fbd78b6be1580782 (patch) | |
| tree | 1fec6a88d05f741604c6f6549798d45c11a3aef3 /src/lib/libcrypto/evp/evp.h | |
| parent | b1042d763c8d1442a3bbd1098fe10bbb13206ca4 (diff) | |
| download | openbsd-c4f6925dc73274ba5f411d30fbd78b6be1580782.tar.gz openbsd-c4f6925dc73274ba5f411d30fbd78b6be1580782.tar.bz2 openbsd-c4f6925dc73274ba5f411d30fbd78b6be1580782.zip | |
Prepare to provide EVP_PKEY_check()
This allows checking the validity of an EVP_PKEY. Only RSA and EC keys
are supported. If a check function is set the EVP_PKEY_METHOD, it will
be used, otherwise the check function on the EVP_PKEY_ASN1_METHOD is
used. The default ASN.1 methods wrap RSA_check_key() and
EC_KEY_check_key(), respectively.
The corresponding setters are EVP_PKEY_{asn1,meth}_set_check().
It is unclear why the PKEY method has no const while the ASN.1 method
has const.
Requested by tobhe and used by PHP 8.1.
Based on OpenSSL commit 2aee35d3
ok inoguchi jsing
Diffstat (limited to 'src/lib/libcrypto/evp/evp.h')
| -rw-r--r-- | src/lib/libcrypto/evp/evp.h | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/src/lib/libcrypto/evp/evp.h b/src/lib/libcrypto/evp/evp.h index aa5b35f67c..e122a6b329 100644 --- a/src/lib/libcrypto/evp/evp.h +++ b/src/lib/libcrypto/evp/evp.h | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: evp.h,v 1.92 2022/01/09 15:15:25 tb Exp $ */ | 1 | /* $OpenBSD: evp.h,v 1.93 2022/01/10 11:52:43 tb Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -1087,6 +1087,11 @@ void EVP_PKEY_asn1_set_free(EVP_PKEY_ASN1_METHOD *ameth, | |||
| 1087 | void EVP_PKEY_asn1_set_ctrl(EVP_PKEY_ASN1_METHOD *ameth, | 1087 | void EVP_PKEY_asn1_set_ctrl(EVP_PKEY_ASN1_METHOD *ameth, |
| 1088 | int (*pkey_ctrl)(EVP_PKEY *pkey, int op, long arg1, void *arg2)); | 1088 | int (*pkey_ctrl)(EVP_PKEY *pkey, int op, long arg1, void *arg2)); |
| 1089 | 1089 | ||
| 1090 | #if defined(LIBRESSL_CRYPTO_INTERNAL) || defined(LIBRESSL_NEXT_API) | ||
| 1091 | void EVP_PKEY_asn1_set_check(EVP_PKEY_ASN1_METHOD *ameth, | ||
| 1092 | int (*pkey_check)(const EVP_PKEY *pk)); | ||
| 1093 | #endif | ||
| 1094 | |||
| 1090 | #define EVP_PKEY_OP_UNDEFINED 0 | 1095 | #define EVP_PKEY_OP_UNDEFINED 0 |
| 1091 | #define EVP_PKEY_OP_PARAMGEN (1<<1) | 1096 | #define EVP_PKEY_OP_PARAMGEN (1<<1) |
| 1092 | #define EVP_PKEY_OP_KEYGEN (1<<2) | 1097 | #define EVP_PKEY_OP_KEYGEN (1<<2) |
| @@ -1213,6 +1218,9 @@ int EVP_PKEY_paramgen_init(EVP_PKEY_CTX *ctx); | |||
| 1213 | int EVP_PKEY_paramgen(EVP_PKEY_CTX *ctx, EVP_PKEY **ppkey); | 1218 | int EVP_PKEY_paramgen(EVP_PKEY_CTX *ctx, EVP_PKEY **ppkey); |
| 1214 | int EVP_PKEY_keygen_init(EVP_PKEY_CTX *ctx); | 1219 | int EVP_PKEY_keygen_init(EVP_PKEY_CTX *ctx); |
| 1215 | int EVP_PKEY_keygen(EVP_PKEY_CTX *ctx, EVP_PKEY **ppkey); | 1220 | int EVP_PKEY_keygen(EVP_PKEY_CTX *ctx, EVP_PKEY **ppkey); |
| 1221 | #if defined(LIBRESSL_CRYPTO_INTERNAL) || defined(LIBRESSL_NEXT_API) | ||
| 1222 | int EVP_PKEY_check(EVP_PKEY_CTX *ctx); | ||
| 1223 | #endif | ||
| 1216 | 1224 | ||
| 1217 | void EVP_PKEY_CTX_set_cb(EVP_PKEY_CTX *ctx, EVP_PKEY_gen_cb *cb); | 1225 | void EVP_PKEY_CTX_set_cb(EVP_PKEY_CTX *ctx, EVP_PKEY_gen_cb *cb); |
| 1218 | EVP_PKEY_gen_cb *EVP_PKEY_CTX_get_cb(EVP_PKEY_CTX *ctx); | 1226 | EVP_PKEY_gen_cb *EVP_PKEY_CTX_get_cb(EVP_PKEY_CTX *ctx); |
| @@ -1279,6 +1287,11 @@ void EVP_PKEY_meth_set_ctrl(EVP_PKEY_METHOD *pmeth, | |||
| 1279 | int (*ctrl)(EVP_PKEY_CTX *ctx, int type, int p1, void *p2), | 1287 | int (*ctrl)(EVP_PKEY_CTX *ctx, int type, int p1, void *p2), |
| 1280 | int (*ctrl_str)(EVP_PKEY_CTX *ctx, const char *type, const char *value)); | 1288 | int (*ctrl_str)(EVP_PKEY_CTX *ctx, const char *type, const char *value)); |
| 1281 | 1289 | ||
| 1290 | #if defined(LIBRESSL_CRYPTO_INTERNAL) || defined(LIBRESSL_NEXT_API) | ||
| 1291 | void EVP_PKEY_meth_set_check(EVP_PKEY_METHOD *pmeth, | ||
| 1292 | int (*check)(EVP_PKEY *pkey)); | ||
| 1293 | #endif | ||
| 1294 | |||
| 1282 | /* Authenticated Encryption with Additional Data. | 1295 | /* Authenticated Encryption with Additional Data. |
| 1283 | * | 1296 | * |
| 1284 | * AEAD couples confidentiality and integrity in a single primtive. AEAD | 1297 | * AEAD couples confidentiality and integrity in a single primtive. AEAD |
