-/* $OpenBSD: evp_local.h,v 1.21 2024/03/26 01:41:06 tb Exp $ */
+/* $OpenBSD: evp_local.h,v 1.22 2024/04/12 09:41:39 tb Exp $ */
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
* project 2000.
*/
int (*copy)(EVP_PKEY_CTX *dst, EVP_PKEY_CTX *src);
void (*cleanup)(EVP_PKEY_CTX *ctx);
- int (*paramgen_init)(EVP_PKEY_CTX *ctx);
int (*paramgen)(EVP_PKEY_CTX *ctx, EVP_PKEY *pkey);
- int (*keygen_init)(EVP_PKEY_CTX *ctx);
int (*keygen)(EVP_PKEY_CTX *ctx, EVP_PKEY *pkey);
int (*sign_init)(EVP_PKEY_CTX *ctx);
const unsigned char *sig, size_t siglen,
const unsigned char *tbs, size_t tbslen);
- int (*verify_recover_init)(EVP_PKEY_CTX *ctx);
int (*verify_recover)(EVP_PKEY_CTX *ctx,
unsigned char *rout, size_t *routlen,
const unsigned char *sig, size_t siglen);
int (*signctx)(EVP_PKEY_CTX *ctx, unsigned char *sig, size_t *siglen,
EVP_MD_CTX *mctx);
- int (*encrypt_init)(EVP_PKEY_CTX *ctx);
int (*encrypt)(EVP_PKEY_CTX *ctx, unsigned char *out, size_t *outlen,
const unsigned char *in, size_t inlen);
- int (*decrypt_init)(EVP_PKEY_CTX *ctx);
int (*decrypt)(EVP_PKEY_CTX *ctx, unsigned char *out, size_t *outlen,
const unsigned char *in, size_t inlen);
-/* $OpenBSD: pmeth_fn.c,v 1.10 2024/04/09 13:52:41 beck Exp $ */
+/* $OpenBSD: pmeth_fn.c,v 1.11 2024/04/12 09:41:39 tb Exp $ */
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
* project 2006.
*/
int
EVP_PKEY_verify_recover_init(EVP_PKEY_CTX *ctx)
{
- int ret;
-
- if (!ctx || !ctx->pmeth || !ctx->pmeth->verify_recover) {
+ if (ctx == NULL || ctx->pmeth == NULL ||
+ ctx->pmeth->verify_recover == NULL) {
EVPerror(EVP_R_OPERATION_NOT_SUPPORTED_FOR_THIS_KEYTYPE);
return -2;
}
+
ctx->operation = EVP_PKEY_OP_VERIFYRECOVER;
- if (!ctx->pmeth->verify_recover_init)
- return 1;
- ret = ctx->pmeth->verify_recover_init(ctx);
- if (ret <= 0)
- ctx->operation = EVP_PKEY_OP_UNDEFINED;
- return ret;
+
+ return 1;
}
LCRYPTO_ALIAS(EVP_PKEY_verify_recover_init);
int
EVP_PKEY_encrypt_init(EVP_PKEY_CTX *ctx)
{
- int ret;
-
- if (!ctx || !ctx->pmeth || !ctx->pmeth->encrypt) {
+ if (ctx == NULL || ctx->pmeth == NULL || ctx->pmeth->encrypt == NULL) {
EVPerror(EVP_R_OPERATION_NOT_SUPPORTED_FOR_THIS_KEYTYPE);
return -2;
}
+
ctx->operation = EVP_PKEY_OP_ENCRYPT;
- if (!ctx->pmeth->encrypt_init)
- return 1;
- ret = ctx->pmeth->encrypt_init(ctx);
- if (ret <= 0)
- ctx->operation = EVP_PKEY_OP_UNDEFINED;
- return ret;
+
+ return 1;
}
LCRYPTO_ALIAS(EVP_PKEY_encrypt_init);
int
EVP_PKEY_decrypt_init(EVP_PKEY_CTX *ctx)
{
- int ret;
-
- if (!ctx || !ctx->pmeth || !ctx->pmeth->decrypt) {
+ if (ctx == NULL || ctx->pmeth == NULL || ctx->pmeth->decrypt == NULL) {
EVPerror(EVP_R_OPERATION_NOT_SUPPORTED_FOR_THIS_KEYTYPE);
return -2;
}
+
ctx->operation = EVP_PKEY_OP_DECRYPT;
- if (!ctx->pmeth->decrypt_init)
- return 1;
- ret = ctx->pmeth->decrypt_init(ctx);
- if (ret <= 0)
- ctx->operation = EVP_PKEY_OP_UNDEFINED;
- return ret;
+
+ return 1;
}
LCRYPTO_ALIAS(EVP_PKEY_decrypt_init);
-/* $OpenBSD: pmeth_gn.c,v 1.17 2024/04/12 02:56:15 tb Exp $ */
+/* $OpenBSD: pmeth_gn.c,v 1.18 2024/04/12 09:41:39 tb Exp $ */
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
* project 2006.
*/
int
EVP_PKEY_paramgen_init(EVP_PKEY_CTX *ctx)
{
- int ret;
-
- if (!ctx || !ctx->pmeth || !ctx->pmeth->paramgen) {
+ if (ctx == NULL || ctx->pmeth == NULL || ctx->pmeth->paramgen == NULL) {
EVPerror(EVP_R_OPERATION_NOT_SUPPORTED_FOR_THIS_KEYTYPE);
return -2;
}
+
ctx->operation = EVP_PKEY_OP_PARAMGEN;
- if (!ctx->pmeth->paramgen_init)
- return 1;
- ret = ctx->pmeth->paramgen_init(ctx);
- if (ret <= 0)
- ctx->operation = EVP_PKEY_OP_UNDEFINED;
- return ret;
+
+ return 1;
}
LCRYPTO_ALIAS(EVP_PKEY_paramgen_init);
int
EVP_PKEY_keygen_init(EVP_PKEY_CTX *ctx)
{
- int ret;
-
- if (!ctx || !ctx->pmeth || !ctx->pmeth->keygen) {
+ if (ctx == NULL || ctx->pmeth == NULL || ctx->pmeth->keygen == NULL) {
EVPerror(EVP_R_OPERATION_NOT_SUPPORTED_FOR_THIS_KEYTYPE);
return -2;
}
+
ctx->operation = EVP_PKEY_OP_KEYGEN;
- if (!ctx->pmeth->keygen_init)
- return 1;
- ret = ctx->pmeth->keygen_init(ctx);
- if (ret <= 0)
- ctx->operation = EVP_PKEY_OP_UNDEFINED;
- return ret;
+
+ return 1;
}
LCRYPTO_ALIAS(EVP_PKEY_keygen_init);