mirror of
https://github.com/isc-projects/bind9.git
synced 2026-05-28 04:34:54 -04:00
Clear OpenSSL errors on EVP_MD_CTX_create failures
(cherry picked from commit 8529be30bb)
This commit is contained in:
parent
290896921d
commit
fb503aa275
3 changed files with 8 additions and 2 deletions
|
|
@ -175,7 +175,7 @@ opensslecdsa_createctx(dst_key_t *key, dst_context_t *dctx) {
|
|||
|
||||
evp_md_ctx = EVP_MD_CTX_create();
|
||||
if (evp_md_ctx == NULL) {
|
||||
DST_RET(ISC_R_NOMEMORY);
|
||||
DST_RET(dst__openssl_toresult(ISC_R_NOMEMORY));
|
||||
}
|
||||
if (dctx->key->key_alg == DST_ALG_ECDSA256) {
|
||||
type = EVP_sha256();
|
||||
|
|
|
|||
|
|
@ -88,7 +88,7 @@ opensslrsa_createctx(dst_key_t *key, dst_context_t *dctx) {
|
|||
|
||||
evp_md_ctx = EVP_MD_CTX_create();
|
||||
if (evp_md_ctx == NULL) {
|
||||
return (ISC_R_NOMEMORY);
|
||||
return (dst__openssl_toresult(ISC_R_NOMEMORY));
|
||||
}
|
||||
|
||||
switch (dctx->key->key_alg) {
|
||||
|
|
|
|||
|
|
@ -51,6 +51,7 @@ main() {
|
|||
unsigned int siglen = sizeof(buf);
|
||||
|
||||
if (e == NULL || n == NULL || ctx == NULL || evp_md_ctx == NULL) {
|
||||
ERR_clear_error();
|
||||
return (1);
|
||||
}
|
||||
|
||||
|
|
@ -62,11 +63,13 @@ main() {
|
|||
EVP_PKEY_CTX_set1_rsa_keygen_pubexp(ctx, e) != 1 ||
|
||||
EVP_PKEY_keygen(ctx, &pkey) != 1 || pkey == NULL)
|
||||
{
|
||||
ERR_clear_error();
|
||||
return (1);
|
||||
}
|
||||
|
||||
EVP_PKEY_get_bn_param(pkey, OSSL_PKEY_PARAM_RSA_N, &n);
|
||||
if (n == NULL) {
|
||||
ERR_clear_error();
|
||||
return (1);
|
||||
}
|
||||
|
||||
|
|
@ -90,6 +93,7 @@ main() {
|
|||
EVP_DigestUpdate(evp_md_ctx, "test", 4) != 1 ||
|
||||
EVP_SignFinal(evp_md_ctx, buf, &siglen, pkey) != 1)
|
||||
{
|
||||
ERR_clear_error();
|
||||
return (1);
|
||||
}
|
||||
bytes = siglen;
|
||||
|
|
@ -103,6 +107,7 @@ main() {
|
|||
EVP_DigestUpdate(evp_md_ctx, "test", 4) != 1 ||
|
||||
EVP_SignFinal(evp_md_ctx, buf, &siglen, pkey) != 1)
|
||||
{
|
||||
ERR_clear_error();
|
||||
return (1);
|
||||
}
|
||||
bytes = siglen;
|
||||
|
|
@ -116,6 +121,7 @@ main() {
|
|||
EVP_DigestUpdate(evp_md_ctx, "test", 4) != 1 ||
|
||||
EVP_SignFinal(evp_md_ctx, buf, &siglen, pkey) != 1)
|
||||
{
|
||||
ERR_clear_error();
|
||||
return (1);
|
||||
}
|
||||
bytes = siglen;
|
||||
|
|
|
|||
Loading…
Reference in a new issue