aboutsummaryrefslogtreecommitdiff
path: root/crypto/dsa/dsa_ameth.c
diff options
context:
space:
mode:
Diffstat (limited to 'crypto/dsa/dsa_ameth.c')
-rw-r--r--crypto/dsa/dsa_ameth.c32
1 files changed, 15 insertions, 17 deletions
diff --git a/crypto/dsa/dsa_ameth.c b/crypto/dsa/dsa_ameth.c
index 482b9e1e0aa7..169c1bb677a5 100644
--- a/crypto/dsa/dsa_ameth.c
+++ b/crypto/dsa/dsa_ameth.c
@@ -1,5 +1,5 @@
/*
- * Copyright 2006-2022 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 2006-2024 The OpenSSL Project Authors. All Rights Reserved.
*
* Licensed under the Apache License 2.0 (the "License"). You may not use
* this file except in compliance with the License. You can obtain a copy
@@ -54,7 +54,7 @@ static int dsa_pub_decode(EVP_PKEY *pkey, const X509_PUBKEY *pubkey)
} else if ((ptype == V_ASN1_NULL) || (ptype == V_ASN1_UNDEF)) {
if ((dsa = DSA_new()) == NULL) {
- ERR_raise(ERR_LIB_DSA, ERR_R_MALLOC_FAILURE);
+ ERR_raise(ERR_LIB_DSA, ERR_R_DSA_LIB);
goto err;
}
} else {
@@ -101,12 +101,12 @@ static int dsa_pub_encode(X509_PUBKEY *pk, const EVP_PKEY *pkey)
&& dsa->params.g != NULL) {
str = ASN1_STRING_new();
if (str == NULL) {
- ERR_raise(ERR_LIB_DSA, ERR_R_MALLOC_FAILURE);
+ ERR_raise(ERR_LIB_DSA, ERR_R_ASN1_LIB);
goto err;
}
str->length = i2d_DSAparams(dsa, &str->data);
if (str->length <= 0) {
- ERR_raise(ERR_LIB_DSA, ERR_R_MALLOC_FAILURE);
+ ERR_raise(ERR_LIB_DSA, ERR_R_ASN1_LIB);
goto err;
}
ptype = V_ASN1_SEQUENCE;
@@ -116,7 +116,7 @@ static int dsa_pub_encode(X509_PUBKEY *pk, const EVP_PKEY *pkey)
pubint = BN_to_ASN1_INTEGER(dsa->pub_key, NULL);
if (pubint == NULL) {
- ERR_raise(ERR_LIB_DSA, ERR_R_MALLOC_FAILURE);
+ ERR_raise(ERR_LIB_DSA, ERR_R_ASN1_LIB);
goto err;
}
@@ -124,7 +124,7 @@ static int dsa_pub_encode(X509_PUBKEY *pk, const EVP_PKEY *pkey)
ASN1_INTEGER_free(pubint);
if (penclen <= 0) {
- ERR_raise(ERR_LIB_DSA, ERR_R_MALLOC_FAILURE);
+ ERR_raise(ERR_LIB_DSA, ERR_R_ASN1_LIB);
goto err;
}
@@ -175,13 +175,13 @@ static int dsa_priv_encode(PKCS8_PRIV_KEY_INFO *p8, const EVP_PKEY *pkey)
params = ASN1_STRING_new();
if (params == NULL) {
- ERR_raise(ERR_LIB_DSA, ERR_R_MALLOC_FAILURE);
+ ERR_raise(ERR_LIB_DSA, ERR_R_ASN1_LIB);
goto err;
}
params->length = i2d_DSAparams(pkey->pkey.dsa, &params->data);
if (params->length <= 0) {
- ERR_raise(ERR_LIB_DSA, ERR_R_MALLOC_FAILURE);
+ ERR_raise(ERR_LIB_DSA, ERR_R_ASN1_LIB);
goto err;
}
params->type = V_ASN1_SEQUENCE;
@@ -483,7 +483,7 @@ static int dsa_pkey_import_from(const OSSL_PARAM params[], void *vpctx)
DSA *dsa = ossl_dsa_new(pctx->libctx);
if (dsa == NULL) {
- ERR_raise(ERR_LIB_DSA, ERR_R_MALLOC_FAILURE);
+ ERR_raise(ERR_LIB_DSA, ERR_R_DSA_LIB);
return 0;
}
@@ -516,26 +516,24 @@ static int dsa_pkey_copy(EVP_PKEY *to, EVP_PKEY *from)
/* NB these are sorted in pkey_id order, lowest first */
-const EVP_PKEY_ASN1_METHOD ossl_dsa_asn1_meths[5] = {
-
- {
- EVP_PKEY_DSA2,
- EVP_PKEY_DSA,
- ASN1_PKEY_ALIAS},
+const EVP_PKEY_ASN1_METHOD ossl_dsa_asn1_meths[4] = {
+ /* This aliases NID_dsa with NID_dsa_2 */
{
EVP_PKEY_DSA1,
EVP_PKEY_DSA,
ASN1_PKEY_ALIAS},
+ /* This aliases NID_dsaWithSHA with NID_dsaWithSHA_2 */
{
EVP_PKEY_DSA4,
- EVP_PKEY_DSA,
+ EVP_PKEY_DSA2,
ASN1_PKEY_ALIAS},
+ /* This aliases NID_dsaWithSHA with NID_dsaWithSHA1 */
{
EVP_PKEY_DSA3,
- EVP_PKEY_DSA,
+ EVP_PKEY_DSA2,
ASN1_PKEY_ALIAS},
{