Alter the check
authorJiasheng Jiang <jiasheng@purdue.edu>
Fri, 22 Mar 2024 18:09:18 +0000 (18:09 +0000)
committerNeil Horman <nhorman@openssl.org>
Tue, 2 Apr 2024 14:31:10 +0000 (10:31 -0400)
Alter the check since 0 md size is an error.

Signed-off-by: Jiasheng Jiang <jiasheng@purdue.edu>
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com>
(Merged from https://github.com/openssl/openssl/pull/23940)

ssl/ssl_lib.c

index af8b637531c517d4f564326b4c6e9b66aecb48cc..fa78906376eb57cc6dca6b9cd7e4ae413129baa5 100644 (file)
@@ -297,7 +297,7 @@ static int dane_tlsa_add(SSL_DANE *dane,
 
     if (md != NULL) {
         mdsize = EVP_MD_get_size(md);
-        if (mdsize < 0 || dlen != (size_t)mdsize) {
+        if (mdsize <= 0 || dlen != (size_t)mdsize) {
             ERR_raise(ERR_LIB_SSL, SSL_R_DANE_TLSA_BAD_DIGEST_LENGTH);
             return 0;
         }