diff options
author | Wangchong Zhou <fffonion@gmail.com> | 2022-10-28 11:47:50 +0800 |
---|---|---|
committer | Tomas Mraz <tomas@openssl.org> | 2022-11-04 13:31:44 +0100 |
commit | f5a10d5cc19215ab22be55b4a2ee1e41bd38fb14 (patch) | |
tree | 7cd009264f10bf4ba8727e75b3644d26cc77db70 /providers | |
parent | 119b7b5f2ad7efcf273f395e7633747f56ff3f95 (diff) | |
download | openssl-new-f5a10d5cc19215ab22be55b4a2ee1e41bd38fb14.tar.gz |
Check for private key existence before calling eddsa sign functions
Fixes #19524
Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/19525)
Diffstat (limited to 'providers')
-rw-r--r-- | providers/implementations/signature/eddsa_sig.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/providers/implementations/signature/eddsa_sig.c b/providers/implementations/signature/eddsa_sig.c index 0229dd74d6..f678e64cf8 100644 --- a/providers/implementations/signature/eddsa_sig.c +++ b/providers/implementations/signature/eddsa_sig.c @@ -161,6 +161,10 @@ int ed25519_digest_sign(void *vpeddsactx, unsigned char *sigret, ERR_raise(ERR_LIB_PROV, PROV_R_OUTPUT_BUFFER_TOO_SMALL); return 0; } + if (edkey->privkey == NULL) { + ERR_raise(ERR_LIB_PROV, PROV_R_NOT_A_PRIVATE_KEY); + return 0; + } #ifdef S390X_EC_ASM if (S390X_CAN_SIGN(ED25519)) { if (s390x_ed25519_digestsign(edkey, sigret, tbs, tbslen) == 0) { @@ -198,6 +202,10 @@ int ed448_digest_sign(void *vpeddsactx, unsigned char *sigret, ERR_raise(ERR_LIB_PROV, PROV_R_OUTPUT_BUFFER_TOO_SMALL); return 0; } + if (edkey->privkey == NULL) { + ERR_raise(ERR_LIB_PROV, PROV_R_NOT_A_PRIVATE_KEY); + return 0; + } #ifdef S390X_EC_ASM if (S390X_CAN_SIGN(ED448)) { if (s390x_ed448_digestsign(edkey, sigret, tbs, tbslen) == 0) { |