diff options
author | Pauli <pauli@openssl.org> | 2021-06-07 09:23:41 +1000 |
---|---|---|
committer | Pauli <pauli@openssl.org> | 2021-06-08 19:32:17 +1000 |
commit | 6c1d17c802678364a8a8d7d69ee2aba2ac76a854 (patch) | |
tree | ed3d4d548ebb12e3e1c6d2ee03ba3554f01eea29 /engines | |
parent | 37bbe449294b63f87b03e792cae465b0b095299a (diff) |
fix coverity 1485660 improper use of negative value
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/15635)
Diffstat (limited to 'engines')
-rw-r--r-- | engines/e_padlock.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/engines/e_padlock.c b/engines/e_padlock.c index a22fc476e6..5662bf5b50 100644 --- a/engines/e_padlock.c +++ b/engines/e_padlock.c @@ -457,7 +457,12 @@ padlock_ctr_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out_arg, const unsigned char *in_arg, size_t nbytes) { struct padlock_cipher_data *cdata = ALIGNED_CIPHER_DATA(ctx); - unsigned int num = EVP_CIPHER_CTX_get_num(ctx); + int n = EVP_CIPHER_CTX_get_num(ctx); + unsigned int num; + + if (n < 0) + return 0; + num = (unsigned int)n; CRYPTO_ctr128_encrypt_ctr32(in_arg, out_arg, nbytes, cdata, EVP_CIPHER_CTX_iv_noconst(ctx), |