diff options
author | Jiasheng Jiang <jiasheng@purdue.edu> | 2024-03-21 19:55:34 +0000 |
---|---|---|
committer | Tomas Mraz <tomas@openssl.org> | 2024-03-25 17:46:50 +0100 |
commit | 99a1c93efa751f8c9ee06aafe877a2d8bdbdf990 (patch) | |
tree | edf041e40f209dce3f140fbf603e7a2d67b271a4 | |
parent | 348832c396cecc24d25dd9de42d1c6ebe9869199 (diff) |
Replace unsigned with int
Replace the type of "digest_length" with int to avoid implicit conversion when it is assigned by EVP_MD_get_size().
Otherwise, it may pass the following check and cause the integer overflow error when EVP_MD_get_size() returns negative numbers.
Signed-off-by: Jiasheng Jiang <jiasheng@purdue.edu>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/23922)
(cherry picked from commit f13ddaab69def0b453b75a8f2deb80e1f1634f42)
-rw-r--r-- | demos/digest/EVP_MD_demo.c | 2 | ||||
-rw-r--r-- | demos/digest/EVP_MD_stdin.c | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/demos/digest/EVP_MD_demo.c b/demos/digest/EVP_MD_demo.c index 99589bd344..7cb7936b59 100644 --- a/demos/digest/EVP_MD_demo.c +++ b/demos/digest/EVP_MD_demo.c @@ -83,7 +83,7 @@ int demonstrate_digest(void) const char *option_properties = NULL; EVP_MD *message_digest = NULL; EVP_MD_CTX *digest_context = NULL; - unsigned int digest_length; + int digest_length; unsigned char *digest_value = NULL; int j; diff --git a/demos/digest/EVP_MD_stdin.c b/demos/digest/EVP_MD_stdin.c index 71a3d325a3..07813acdc9 100644 --- a/demos/digest/EVP_MD_stdin.c +++ b/demos/digest/EVP_MD_stdin.c @@ -38,7 +38,7 @@ int demonstrate_digest(BIO *input) const char * option_properties = NULL; EVP_MD *message_digest = NULL; EVP_MD_CTX *digest_context = NULL; - unsigned int digest_length; + int digest_length; unsigned char *digest_value = NULL; unsigned char buffer[512]; int ii; |