diff options
Diffstat (limited to 'src/lib/libcrypto/evp/pmeth_gn.c')
-rw-r--r-- | src/lib/libcrypto/evp/pmeth_gn.c | 28 |
1 files changed, 9 insertions, 19 deletions
diff --git a/src/lib/libcrypto/evp/pmeth_gn.c b/src/lib/libcrypto/evp/pmeth_gn.c index b86ecc6811..b8b51ced3d 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.17 2024/04/12 02:56:15 tb Exp $ */ | 1 | /* $OpenBSD: pmeth_gn.c,v 1.18 2024/04/12 09:41:39 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 | */ |
@@ -71,19 +71,14 @@ | |||
71 | int | 71 | int |
72 | EVP_PKEY_paramgen_init(EVP_PKEY_CTX *ctx) | 72 | EVP_PKEY_paramgen_init(EVP_PKEY_CTX *ctx) |
73 | { | 73 | { |
74 | int ret; | 74 | if (ctx == NULL || ctx->pmeth == NULL || ctx->pmeth->paramgen == NULL) { |
75 | |||
76 | if (!ctx || !ctx->pmeth || !ctx->pmeth->paramgen) { | ||
77 | EVPerror(EVP_R_OPERATION_NOT_SUPPORTED_FOR_THIS_KEYTYPE); | 75 | EVPerror(EVP_R_OPERATION_NOT_SUPPORTED_FOR_THIS_KEYTYPE); |
78 | return -2; | 76 | return -2; |
79 | } | 77 | } |
78 | |||
80 | ctx->operation = EVP_PKEY_OP_PARAMGEN; | 79 | ctx->operation = EVP_PKEY_OP_PARAMGEN; |
81 | if (!ctx->pmeth->paramgen_init) | 80 | |
82 | return 1; | 81 | return 1; |
83 | ret = ctx->pmeth->paramgen_init(ctx); | ||
84 | if (ret <= 0) | ||
85 | ctx->operation = EVP_PKEY_OP_UNDEFINED; | ||
86 | return ret; | ||
87 | } | 82 | } |
88 | LCRYPTO_ALIAS(EVP_PKEY_paramgen_init); | 83 | LCRYPTO_ALIAS(EVP_PKEY_paramgen_init); |
89 | 84 | ||
@@ -120,19 +115,14 @@ LCRYPTO_ALIAS(EVP_PKEY_paramgen); | |||
120 | int | 115 | int |
121 | EVP_PKEY_keygen_init(EVP_PKEY_CTX *ctx) | 116 | EVP_PKEY_keygen_init(EVP_PKEY_CTX *ctx) |
122 | { | 117 | { |
123 | int ret; | 118 | if (ctx == NULL || ctx->pmeth == NULL || ctx->pmeth->keygen == NULL) { |
124 | |||
125 | if (!ctx || !ctx->pmeth || !ctx->pmeth->keygen) { | ||
126 | EVPerror(EVP_R_OPERATION_NOT_SUPPORTED_FOR_THIS_KEYTYPE); | 119 | EVPerror(EVP_R_OPERATION_NOT_SUPPORTED_FOR_THIS_KEYTYPE); |
127 | return -2; | 120 | return -2; |
128 | } | 121 | } |
122 | |||
129 | ctx->operation = EVP_PKEY_OP_KEYGEN; | 123 | ctx->operation = EVP_PKEY_OP_KEYGEN; |
130 | if (!ctx->pmeth->keygen_init) | 124 | |
131 | return 1; | 125 | return 1; |
132 | ret = ctx->pmeth->keygen_init(ctx); | ||
133 | if (ret <= 0) | ||
134 | ctx->operation = EVP_PKEY_OP_UNDEFINED; | ||
135 | return ret; | ||
136 | } | 126 | } |
137 | LCRYPTO_ALIAS(EVP_PKEY_keygen_init); | 127 | LCRYPTO_ALIAS(EVP_PKEY_keygen_init); |
138 | 128 | ||