summaryrefslogtreecommitdiffstats
path: root/providers/common
diff options
context:
space:
mode:
authorRichard Levitte <levitte@openssl.org>2020-07-30 10:14:27 +0200
committerRichard Levitte <levitte@openssl.org>2020-08-20 12:33:53 +0200
commit6cc1dfca88c565ddacd9ea9aa8261ef9c0c37335 (patch)
tree8558fcaaa2e2cde3e372d5c65606d674af37f02d /providers/common
parent22b814443eea4ef4ea86d5d5677601d6645606d9 (diff)
PROV: Fix DSA and DH private key serializers
If those private key serializer were given a key structure with just the public key material, they crashed, because they tried to de-reference NULL. This adds better checking. Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org> (Merged from https://github.com/openssl/openssl/pull/12679)
Diffstat (limited to 'providers/common')
-rw-r--r--providers/common/include/prov/providercommonerr.h2
-rw-r--r--providers/common/provider_err.c2
2 files changed, 4 insertions, 0 deletions
diff --git a/providers/common/include/prov/providercommonerr.h b/providers/common/include/prov/providercommonerr.h
index 3f3c39ba52..4c356fc5c6 100644
--- a/providers/common/include/prov/providercommonerr.h
+++ b/providers/common/include/prov/providercommonerr.h
@@ -128,6 +128,8 @@ int ERR_load_PROV_strings(void);
# define PROV_R_MISSING_TYPE 134
# define PROV_R_MISSING_XCGHASH 135
# define PROV_R_MODULE_INTEGRITY_FAILURE 214
+# define PROV_R_NOT_A_PRIVATE_KEY 221
+# define PROV_R_NOT_A_PUBLIC_KEY 220
# define PROV_R_NOT_INSTANTIATED 193
# define PROV_R_NOT_SUPPORTED 136
# define PROV_R_NOT_XOF_OR_INVALID_LENGTH 113
diff --git a/providers/common/provider_err.c b/providers/common/provider_err.c
index ad7ae57157..3ea41f3c25 100644
--- a/providers/common/provider_err.c
+++ b/providers/common/provider_err.c
@@ -133,6 +133,8 @@ static const ERR_STRING_DATA PROV_str_reasons[] = {
{ERR_PACK(ERR_LIB_PROV, 0, PROV_R_MISSING_XCGHASH), "missing xcghash"},
{ERR_PACK(ERR_LIB_PROV, 0, PROV_R_MODULE_INTEGRITY_FAILURE),
"module integrity failure"},
+ {ERR_PACK(ERR_LIB_PROV, 0, PROV_R_NOT_A_PRIVATE_KEY), "not a private key"},
+ {ERR_PACK(ERR_LIB_PROV, 0, PROV_R_NOT_A_PUBLIC_KEY), "not a public key"},
{ERR_PACK(ERR_LIB_PROV, 0, PROV_R_NOT_INSTANTIATED), "not instantiated"},
{ERR_PACK(ERR_LIB_PROV, 0, PROV_R_NOT_SUPPORTED), "not supported"},
{ERR_PACK(ERR_LIB_PROV, 0, PROV_R_NOT_XOF_OR_INVALID_LENGTH),