summaryrefslogtreecommitdiffstats
path: root/crypto/dh
diff options
context:
space:
mode:
authorRichard Levitte <levitte@openssl.org>2020-11-04 12:23:19 +0100
committerRichard Levitte <levitte@openssl.org>2020-11-13 09:35:02 +0100
commit9311d0c471ca2eaa259e8c1bbbeb7c46394c7ba2 (patch)
treee82c26569e5a952980e65a746af920beed602aab /crypto/dh
parent31a6b52f6db009c639c67387a707dd235f29a430 (diff)
Convert all {NAME}err() in crypto/ to their corresponding ERR_raise() call
This includes error reporting for libcrypto sub-libraries in surprising places. This was done using util/err-to-raise Reviewed-by: Paul Dale <paul.dale@oracle.com> (Merged from https://github.com/openssl/openssl/pull/13318)
Diffstat (limited to 'crypto/dh')
-rw-r--r--crypto/dh/dh_ameth.c28
-rw-r--r--crypto/dh/dh_check.c32
-rw-r--r--crypto/dh/dh_gen.c8
-rw-r--r--crypto/dh/dh_group_params.c2
-rw-r--r--crypto/dh/dh_key.c24
-rw-r--r--crypto/dh/dh_lib.c10
-rw-r--r--crypto/dh/dh_meth.c6
-rw-r--r--crypto/dh/dh_pmeth.c8
-rw-r--r--crypto/dh/dh_prn.c2
9 files changed, 60 insertions, 60 deletions
diff --git a/crypto/dh/dh_ameth.c b/crypto/dh/dh_ameth.c
index 1efbb403cb..1cf692ee13 100644
--- a/crypto/dh/dh_ameth.c
+++ b/crypto/dh/dh_ameth.c
@@ -74,7 +74,7 @@ static int dh_pub_decode(EVP_PKEY *pkey, const X509_PUBKEY *pubkey)
X509_ALGOR_get0(NULL, &ptype, &pval, palg);
if (ptype != V_ASN1_SEQUENCE) {
- DHerr(DH_F_DH_PUB_DECODE, DH_R_PARAMETER_ENCODING_ERROR);
+ ERR_raise(ERR_LIB_DH, DH_R_PARAMETER_ENCODING_ERROR);
goto err;
}
@@ -83,18 +83,18 @@ static int dh_pub_decode(EVP_PKEY *pkey, const X509_PUBKEY *pubkey)
pmlen = pstr->length;
if ((dh = d2i_dhp(pkey, &pm, pmlen)) == NULL) {
- DHerr(DH_F_DH_PUB_DECODE, DH_R_DECODE_ERROR);
+ ERR_raise(ERR_LIB_DH, DH_R_DECODE_ERROR);
goto err;
}
if ((public_key = d2i_ASN1_INTEGER(NULL, &p, pklen)) == NULL) {
- DHerr(DH_F_DH_PUB_DECODE, DH_R_DECODE_ERROR);
+ ERR_raise(ERR_LIB_DH, DH_R_DECODE_ERROR);
goto err;
}
/* We have parameters now set public key */
if ((dh->pub_key = ASN1_INTEGER_to_BN(public_key, NULL)) == NULL) {
- DHerr(DH_F_DH_PUB_DECODE, DH_R_BN_DECODE_ERROR);
+ ERR_raise(ERR_LIB_DH, DH_R_BN_DECODE_ERROR);
goto err;
}
@@ -121,12 +121,12 @@ static int dh_pub_encode(X509_PUBKEY *pk, const EVP_PKEY *pkey)
str = ASN1_STRING_new();
if (str == NULL) {
- DHerr(DH_F_DH_PUB_ENCODE, ERR_R_MALLOC_FAILURE);
+ ERR_raise(ERR_LIB_DH, ERR_R_MALLOC_FAILURE);
goto err;
}
str->length = i2d_dhp(pkey, dh, &str->data);
if (str->length <= 0) {
- DHerr(DH_F_DH_PUB_ENCODE, ERR_R_MALLOC_FAILURE);
+ ERR_raise(ERR_LIB_DH, ERR_R_MALLOC_FAILURE);
goto err;
}
ptype = V_ASN1_SEQUENCE;
@@ -140,7 +140,7 @@ static int dh_pub_encode(X509_PUBKEY *pk, const EVP_PKEY *pkey)
ASN1_INTEGER_free(pub_key);
if (penclen <= 0) {
- DHerr(DH_F_DH_PUB_ENCODE, ERR_R_MALLOC_FAILURE);
+ ERR_raise(ERR_LIB_DH, ERR_R_MALLOC_FAILURE);
goto err;
}
@@ -191,7 +191,7 @@ static int dh_priv_decode(EVP_PKEY *pkey, const PKCS8_PRIV_KEY_INFO *p8)
/* We have parameters now set private key */
if ((dh->priv_key = BN_secure_new()) == NULL
|| !ASN1_INTEGER_to_BN(privkey, dh->priv_key)) {
- DHerr(DH_F_DH_PRIV_DECODE, DH_R_BN_ERROR);
+ ERR_raise(ERR_LIB_DH, DH_R_BN_ERROR);
goto dherr;
}
/* Calculate public key, increments dirty_cnt */
@@ -205,7 +205,7 @@ static int dh_priv_decode(EVP_PKEY *pkey, const PKCS8_PRIV_KEY_INFO *p8)
return 1;
decerr:
- DHerr(DH_F_DH_PRIV_DECODE, EVP_R_DECODE_ERROR);
+ ERR_raise(ERR_LIB_DH, EVP_R_DECODE_ERROR);
dherr:
DH_free(dh);
ASN1_STRING_clear_free(privkey);
@@ -222,13 +222,13 @@ static int dh_priv_encode(PKCS8_PRIV_KEY_INFO *p8, const EVP_PKEY *pkey)
params = ASN1_STRING_new();
if (params == NULL) {
- DHerr(DH_F_DH_PRIV_ENCODE, ERR_R_MALLOC_FAILURE);
+ ERR_raise(ERR_LIB_DH, ERR_R_MALLOC_FAILURE);
goto err;
}
params->length = i2d_dhp(pkey, pkey->pkey.dh, &params->data);
if (params->length <= 0) {
- DHerr(DH_F_DH_PRIV_ENCODE, ERR_R_MALLOC_FAILURE);
+ ERR_raise(ERR_LIB_DH, ERR_R_MALLOC_FAILURE);
goto err;
}
params->type = V_ASN1_SEQUENCE;
@@ -237,7 +237,7 @@ static int dh_priv_encode(PKCS8_PRIV_KEY_INFO *p8, const EVP_PKEY *pkey)
prkey = BN_to_ASN1_INTEGER(pkey->pkey.dh->priv_key, NULL);
if (prkey == NULL) {
- DHerr(DH_F_DH_PRIV_ENCODE, DH_R_BN_ERROR);
+ ERR_raise(ERR_LIB_DH, DH_R_BN_ERROR);
goto err;
}
@@ -328,7 +328,7 @@ static int do_dh_print(BIO *bp, const DH *x, int indent, int ptype)
return 1;
err:
- DHerr(DH_F_DO_DH_PRINT, reason);
+ ERR_raise(ERR_LIB_DH, reason);
return 0;
}
@@ -455,7 +455,7 @@ static int dh_pkey_public_check(const EVP_PKEY *pkey)
DH *dh = pkey->pkey.dh;
if (dh->pub_key == NULL) {
- DHerr(DH_F_DH_PKEY_PUBLIC_CHECK, DH_R_MISSING_PUBKEY);
+ ERR_raise(ERR_LIB_DH, DH_R_MISSING_PUBKEY);
return 0;
}
diff --git a/crypto/dh/dh_check.c b/crypto/dh/dh_check.c
index 8fa9a43637..5cbbdbf8c5 100644
--- a/crypto/dh/dh_check.c
+++ b/crypto/dh/dh_check.c
@@ -33,13 +33,13 @@ int DH_check_params_ex(const DH *dh)
return 0;
if ((errflags & DH_CHECK_P_NOT_PRIME) != 0)
- DHerr(DH_F_DH_CHECK_PARAMS_EX, DH_R_CHECK_P_NOT_PRIME);
+ ERR_raise(ERR_LIB_DH, DH_R_CHECK_P_NOT_PRIME);
if ((errflags & DH_NOT_SUITABLE_GENERATOR) != 0)
- DHerr(DH_F_DH_CHECK_PARAMS_EX, DH_R_NOT_SUITABLE_GENERATOR);
+ ERR_raise(ERR_LIB_DH, DH_R_NOT_SUITABLE_GENERATOR);
if ((errflags & DH_MODULUS_TOO_SMALL) != 0)
- DHerr(DH_F_DH_CHECK_PARAMS_EX, DH_R_MODULUS_TOO_SMALL);
+ ERR_raise(ERR_LIB_DH, DH_R_MODULUS_TOO_SMALL);
if ((errflags & DH_MODULUS_TOO_LARGE) != 0)
- DHerr(DH_F_DH_CHECK_PARAMS_EX, DH_R_MODULUS_TOO_LARGE);
+ ERR_raise(ERR_LIB_DH, DH_R_MODULUS_TOO_LARGE);
return errflags == 0;
}
@@ -116,23 +116,23 @@ int DH_check_ex(const DH *dh)
return 0;
if ((errflags & DH_NOT_SUITABLE_GENERATOR) != 0)
- DHerr(DH_F_DH_CHECK_EX, DH_R_NOT_SUITABLE_GENERATOR);
+ ERR_raise(ERR_LIB_DH, DH_R_NOT_SUITABLE_GENERATOR);
if ((errflags & DH_CHECK_Q_NOT_PRIME) != 0)
- DHerr(DH_F_DH_CHECK_EX, DH_R_CHECK_Q_NOT_PRIME);
+ ERR_raise(ERR_LIB_DH, DH_R_CHECK_Q_NOT_PRIME);
if ((errflags & DH_CHECK_INVALID_Q_VALUE) != 0)
- DHerr(DH_F_DH_CHECK_EX, DH_R_CHECK_INVALID_Q_VALUE);
+ ERR_raise(ERR_LIB_DH, DH_R_CHECK_INVALID_Q_VALUE);
if ((errflags & DH_CHECK_INVALID_J_VALUE) != 0)
- DHerr(DH_F_DH_CHECK_EX, DH_R_CHECK_INVALID_J_VALUE);
+ ERR_raise(ERR_LIB_DH, DH_R_CHECK_INVALID_J_VALUE);
if ((errflags & DH_UNABLE_TO_CHECK_GENERATOR) != 0)
- DHerr(DH_F_DH_CHECK_EX, DH_R_UNABLE_TO_CHECK_GENERATOR);
+ ERR_raise(ERR_LIB_DH, DH_R_UNABLE_TO_CHECK_GENERATOR);
if ((errflags & DH_CHECK_P_NOT_PRIME) != 0)
- DHerr(DH_F_DH_CHECK_EX, DH_R_CHECK_P_NOT_PRIME);
+ ERR_raise(ERR_LIB_DH, DH_R_CHECK_P_NOT_PRIME);
if ((errflags & DH_CHECK_P_NOT_SAFE_PRIME) != 0)
- DHerr(DH_F_DH_CHECK_EX, DH_R_CHECK_P_NOT_SAFE_PRIME);
+ ERR_raise(ERR_LIB_DH, DH_R_CHECK_P_NOT_SAFE_PRIME);
if ((errflags & DH_MODULUS_TOO_SMALL) != 0)
- DHerr(DH_F_DH_CHECK_EX, DH_R_MODULUS_TOO_SMALL);
+ ERR_raise(ERR_LIB_DH, DH_R_MODULUS_TOO_SMALL);
if ((errflags & DH_MODULUS_TOO_LARGE) != 0)
- DHerr(DH_F_DH_CHECK_EX, DH_R_MODULUS_TOO_LARGE);
+ ERR_raise(ERR_LIB_DH, DH_R_MODULUS_TOO_LARGE);
return errflags == 0;
}
@@ -221,11 +221,11 @@ int DH_check_pub_key_ex(const DH *dh, const BIGNUM *pub_key)
return 0;
if ((errflags & DH_CHECK_PUBKEY_TOO_SMALL) != 0)
- DHerr(DH_F_DH_CHECK_PUB_KEY_EX, DH_R_CHECK_PUBKEY_TOO_SMALL);
+ ERR_raise(ERR_LIB_DH, DH_R_CHECK_PUBKEY_TOO_SMALL);
if ((errflags & DH_CHECK_PUBKEY_TOO_LARGE) != 0)
- DHerr(DH_F_DH_CHECK_PUB_KEY_EX, DH_R_CHECK_PUBKEY_TOO_LARGE);
+ ERR_raise(ERR_LIB_DH, DH_R_CHECK_PUBKEY_TOO_LARGE);
if ((errflags & DH_CHECK_PUBKEY_INVALID) != 0)
- DHerr(DH_F_DH_CHECK_PUB_KEY_EX, DH_R_CHECK_PUBKEY_INVALID);
+ ERR_raise(ERR_LIB_DH, DH_R_CHECK_PUBKEY_INVALID);
return errflags == 0;
}
diff --git a/crypto/dh/dh_gen.c b/crypto/dh/dh_gen.c
index 8ed7120653..bdc0dc79b8 100644
--- a/crypto/dh/dh_gen.c
+++ b/crypto/dh/dh_gen.c
@@ -160,12 +160,12 @@ static int dh_builtin_genparams(DH *ret, int prime_len, int generator,
BN_CTX *ctx = NULL;
if (prime_len > OPENSSL_DH_MAX_MODULUS_BITS) {
- DHerr(DH_F_DH_BUILTIN_GENPARAMS, DH_R_MODULUS_TOO_LARGE);
+ ERR_raise(ERR_LIB_DH, DH_R_MODULUS_TOO_LARGE);
return 0;
}
if (prime_len < DH_MIN_MODULUS_BITS) {
- DHerr(DH_F_DH_BUILTIN_GENPARAMS, DH_R_MODULUS_TOO_SMALL);
+ ERR_raise(ERR_LIB_DH, DH_R_MODULUS_TOO_SMALL);
return 0;
}
@@ -185,7 +185,7 @@ static int dh_builtin_genparams(DH *ret, int prime_len, int generator,
goto err;
if (generator <= 1) {
- DHerr(DH_F_DH_BUILTIN_GENPARAMS, DH_R_BAD_GENERATOR);
+ ERR_raise(ERR_LIB_DH, DH_R_BAD_GENERATOR);
goto err;
}
if (generator == DH_GENERATOR_2) {
@@ -223,7 +223,7 @@ static int dh_builtin_genparams(DH *ret, int prime_len, int generator,
ok = 1;
err:
if (ok == -1) {
- DHerr(DH_F_DH_BUILTIN_GENPARAMS, ERR_R_BN_LIB);
+ ERR_raise(ERR_LIB_DH, ERR_R_BN_LIB);
ok = 0;
}
diff --git a/crypto/dh/dh_group_params.c b/crypto/dh/dh_group_params.c
index d0b53a2f8b..e03693f687 100644
--- a/crypto/dh/dh_group_params.c
+++ b/crypto/dh/dh_group_params.c
@@ -132,7 +132,7 @@ static DH *dh_new_by_group_name(OSSL_LIB_CTX *libctx, const char *name)
dh_named_groups[i].g);
}
}
- DHerr(0, DH_R_INVALID_PARAMETER_NID);
+ ERR_raise(ERR_LIB_DH, DH_R_INVALID_PARAMETER_NID);
return NULL;
}
diff --git a/crypto/dh/dh_key.c b/crypto/dh/dh_key.c
index 930b33a33b..2e61ccbaa2 100644
--- a/crypto/dh/dh_key.c
+++ b/crypto/dh/dh_key.c
@@ -44,12 +44,12 @@ static int compute_key(unsigned char *key, const BIGNUM *pub_key, DH *dh)
#endif
if (BN_num_bits(dh->params.p) > OPENSSL_DH_MAX_MODULUS_BITS) {
- DHerr(0, DH_R_MODULUS_TOO_LARGE);
+ ERR_raise(ERR_LIB_DH, DH_R_MODULUS_TOO_LARGE);
goto err;
}
if (BN_num_bits(dh->params.p) < DH_MIN_MODULUS_BITS) {
- DHerr(0, DH_R_MODULUS_TOO_SMALL);
+ ERR_raise(ERR_LIB_DH, DH_R_MODULUS_TOO_SMALL);
return 0;
}
@@ -62,7 +62,7 @@ static int compute_key(unsigned char *key, const BIGNUM *pub_key, DH *dh)
goto err;
if (dh->priv_key == NULL) {
- DHerr(0, DH_R_NO_PRIVATE_VALUE);
+ ERR_raise(ERR_LIB_DH, DH_R_NO_PRIVATE_VALUE);
goto err;
}
@@ -76,13 +76,13 @@ static int compute_key(unsigned char *key, const BIGNUM *pub_key, DH *dh)
/* TODO(3.0) : Solve in a PR related to Key validation for DH */
#ifndef FIPS_MODULE
if (!DH_check_pub_key(dh, pub_key, &check_result) || check_result) {
- DHerr(0, DH_R_INVALID_PUBKEY);
+ ERR_raise(ERR_LIB_DH, DH_R_INVALID_PUBKEY);
goto err;
}
#endif
if (!dh->meth->bn_mod_exp(dh, tmp, pub_key, dh->priv_key, dh->params.p, ctx,
mont)) {
- DHerr(0, ERR_R_BN_LIB);
+ ERR_raise(ERR_LIB_DH, ERR_R_BN_LIB);
goto err;
}
@@ -229,12 +229,12 @@ static int generate_key(DH *dh)
BIGNUM *pub_key = NULL, *priv_key = NULL;
if (BN_num_bits(dh->params.p) > OPENSSL_DH_MAX_MODULUS_BITS) {
- DHerr(0, DH_R_MODULUS_TOO_LARGE);
+ ERR_raise(ERR_LIB_DH, DH_R_MODULUS_TOO_LARGE);
return 0;
}
if (BN_num_bits(dh->params.p) < DH_MIN_MODULUS_BITS) {
- DHerr(0, DH_R_MODULUS_TOO_SMALL);
+ ERR_raise(ERR_LIB_DH, DH_R_MODULUS_TOO_SMALL);
return 0;
}
@@ -325,7 +325,7 @@ static int generate_key(DH *dh)
ok = 1;
err:
if (ok != 1)
- DHerr(0, ERR_R_BN_LIB);
+ ERR_raise(ERR_LIB_DH, ERR_R_BN_LIB);
if (pub_key != dh->pub_key)
BN_free(pub_key);
@@ -361,7 +361,7 @@ int dh_buf2key(DH *dh, const unsigned char *buf, size_t len)
goto err;
return 1;
err:
- DHerr(DH_F_DH_BUF2KEY, err_reason);
+ ERR_raise(ERR_LIB_DH, err_reason);
BN_free(pubkey);
return 0;
}
@@ -378,7 +378,7 @@ size_t dh_key2buf(const DH *dh, unsigned char **pbuf_out, size_t size, int alloc
if (p == NULL || pubkey == NULL
|| (p_size = BN_num_bytes(p)) == 0
|| BN_num_bytes(pubkey) == 0) {
- DHerr(DH_F_DH_KEY2BUF, DH_R_INVALID_PUBKEY);
+ ERR_raise(ERR_LIB_DH, DH_R_INVALID_PUBKEY);
return 0;
}
if (pbuf_out != NULL && (alloc || *pbuf_out != NULL)) {
@@ -390,7 +390,7 @@ size_t dh_key2buf(const DH *dh, unsigned char **pbuf_out, size_t size, int alloc
}
if (pbuf == NULL) {
- DHerr(DH_F_DH_KEY2BUF, ERR_R_MALLOC_FAILURE);
+ ERR_raise(ERR_LIB_DH, ERR_R_MALLOC_FAILURE);
return 0;
}
/*
@@ -400,7 +400,7 @@ size_t dh_key2buf(const DH *dh, unsigned char **pbuf_out, size_t size, int alloc
if (BN_bn2binpad(pubkey, pbuf, p_size) < 0) {
if (alloc)
OPENSSL_free(pbuf);
- DHerr(DH_F_DH_KEY2BUF, DH_R_BN_ERROR);
+ ERR_raise(ERR_LIB_DH, DH_R_BN_ERROR);
return 0;
}
*pbuf_out = pbuf;
diff --git a/crypto/dh/dh_lib.c b/crypto/dh/dh_lib.c
index 207e7b06c6..e3bbe95ff4 100644
--- a/crypto/dh/dh_lib.c
+++ b/crypto/dh/dh_lib.c
@@ -73,14 +73,14 @@ static DH *dh_new_intern(ENGINE *engine, OSSL_LIB_CTX *libctx)
DH *ret = OPENSSL_zalloc(sizeof(*ret));
if (ret == NULL) {
- DHerr(0, ERR_R_MALLOC_FAILURE);
+ ERR_raise(ERR_LIB_DH, ERR_R_MALLOC_FAILURE);
return NULL;
}
ret->references = 1;
ret->lock = CRYPTO_THREAD_lock_new();
if (ret->lock == NULL) {
- DHerr(0, ERR_R_MALLOC_FAILURE);
+ ERR_raise(ERR_LIB_DH, ERR_R_MALLOC_FAILURE);
OPENSSL_free(ret);
return NULL;
}
@@ -91,7 +91,7 @@ static DH *dh_new_intern(ENGINE *engine, OSSL_LIB_CTX *libctx)
ret->flags = ret->meth->flags; /* early default init */
if (engine) {
if (!ENGINE_init(engine)) {
- DHerr(0, ERR_R_ENGINE_LIB);
+ ERR_raise(ERR_LIB_DH, ERR_R_ENGINE_LIB);
goto err;
}
ret->engine = engine;
@@ -100,7 +100,7 @@ static DH *dh_new_intern(ENGINE *engine, OSSL_LIB_CTX *libctx)
if (ret->engine) {
ret->meth = ENGINE_get_DH(ret->engine);
if (ret->meth == NULL) {
- DHerr(0, ERR_R_ENGINE_LIB);
+ ERR_raise(ERR_LIB_DH, ERR_R_ENGINE_LIB);
goto err;
}
}
@@ -114,7 +114,7 @@ static DH *dh_new_intern(ENGINE *engine, OSSL_LIB_CTX *libctx)
#endif /* FIPS_MODULE */
if ((ret->meth->init != NULL) && !ret->meth->init(ret)) {
- DHerr(0, ERR_R_INIT_FAIL);
+ ERR_raise(ERR_LIB_DH, ERR_R_INIT_FAIL);
goto err;
}
diff --git a/crypto/dh/dh_meth.c b/crypto/dh/dh_meth.c
index 753af11834..5c15cd2b8c 100644
--- a/crypto/dh/dh_meth.c
+++ b/crypto/dh/dh_meth.c
@@ -31,7 +31,7 @@ DH_METHOD *DH_meth_new(const char *name, int flags)
OPENSSL_free(dhm);
}
- DHerr(DH_F_DH_METH_NEW, ERR_R_MALLOC_FAILURE);
+ ERR_raise(ERR_LIB_DH, ERR_R_MALLOC_FAILURE);
return NULL;
}
@@ -57,7 +57,7 @@ DH_METHOD *DH_meth_dup(const DH_METHOD *dhm)
OPENSSL_free(ret);
}
- DHerr(DH_F_DH_METH_DUP, ERR_R_MALLOC_FAILURE);
+ ERR_raise(ERR_LIB_DH, ERR_R_MALLOC_FAILURE);
return NULL;
}
@@ -71,7 +71,7 @@ int DH_meth_set1_name(DH_METHOD *dhm, const char *name)
char *tmpname = OPENSSL_strdup(name);
if (tmpname == NULL) {
- DHerr(DH_F_DH_METH_SET1_NAME, ERR_R_MALLOC_FAILURE);
+ ERR_raise(ERR_LIB_DH, ERR_R_MALLOC_FAILURE);
return 0;
}
diff --git a/crypto/dh/dh_pmeth.c b/crypto/dh/dh_pmeth.c
index d0e1c55002..11f30ce702 100644
--- a/crypto/dh/dh_pmeth.c
+++ b/crypto/dh/dh_pmeth.c
@@ -57,7 +57,7 @@ static int pkey_dh_init(EVP_PKEY_CTX *ctx)
DH_PKEY_CTX *dctx;
if ((dctx = OPENSSL_zalloc(sizeof(*dctx))) == NULL) {
- DHerr(DH_F_PKEY_DH_INIT, ERR_R_MALLOC_FAILURE);
+ ERR_raise(ERR_LIB_DH, ERR_R_MALLOC_FAILURE);
return 0;
}
dctx->prime_len = 2048;
@@ -245,7 +245,7 @@ static int pkey_dh_ctrl_str(EVP_PKEY_CTX *ctx,
int nid = OBJ_sn2nid(value);
if (nid == NID_undef) {
- DHerr(DH_F_PKEY_DH_CTRL_STR, DH_R_INVALID_PARAMETER_NAME);
+ ERR_raise(ERR_LIB_DH, DH_R_INVALID_PARAMETER_NAME);
return -2;
}
dctx->param_nid = nid;
@@ -400,7 +400,7 @@ static int pkey_dh_keygen(EVP_PKEY_CTX *ctx, EVP_PKEY *pkey)
DH *dh = NULL;
if (ctx->pkey == NULL && dctx->param_nid == NID_undef) {
- DHerr(DH_F_PKEY_DH_KEYGEN, DH_R_NO_PARAMETERS_SET);
+ ERR_raise(ERR_LIB_DH, DH_R_NO_PARAMETERS_SET);
return 0;
}
if (dctx->param_nid != NID_undef)
@@ -424,7 +424,7 @@ static int pkey_dh_derive(EVP_PKEY_CTX *ctx, unsigned char *key,
DH_PKEY_CTX *dctx = ctx->data;
BIGNUM *dhpub;
if (!ctx->pkey || !ctx->peerkey) {
- DHerr(DH_F_PKEY_DH_DERIVE, DH_R_KEYS_NOT_SET);
+ ERR_raise(ERR_LIB_DH, DH_R_KEYS_NOT_SET);
return 0;
}
dh = ctx->pkey->pkey.dh;
diff --git a/crypto/dh/dh_prn.c b/crypto/dh/dh_prn.c
index 35cd1e9231..5d31254dcb 100644
--- a/crypto/dh/dh_prn.c
+++ b/crypto/dh/dh_prn.c
@@ -25,7 +25,7 @@ int DHparams_print_fp(FILE *fp, const DH *x)
int ret;
if ((b = BIO_new(BIO_s_file())) == NULL) {
- DHerr(DH_F_DHPARAMS_PRINT_FP, ERR_R_BUF_LIB);
+ ERR_raise(ERR_LIB_DH, ERR_R_BUF_LIB);
return 0;
}
BIO_set_fp(b, fp, BIO_NOCLOSE);