diff options
author | Pauli <ppzgs1@gmail.com> | 2021-03-22 12:09:19 +1000 |
---|---|---|
committer | Pauli <ppzgs1@gmail.com> | 2021-03-24 09:12:43 +1000 |
commit | 1634b2df9f12d3976129ba49e38638e3ab368e3d (patch) | |
tree | 946791596a0e09bb9b04f0f8065b1fb9831e36b5 /crypto/evp | |
parent | fe10fa75216cb0e81eeee9bced2b4d26e05bf9e7 (diff) |
enc: fix coverity 1451499, 1451501, 1451506, 1451507, 1351511, 1451514, 1451517, 1451523, 1451526m 1451528, 1451539, 1451441, 1451549, 1451568 & 1451572: improper use of negative value
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/14638)
Diffstat (limited to 'crypto/evp')
-rw-r--r-- | crypto/evp/e_aria.c | 2 | ||||
-rw-r--r-- | crypto/evp/e_camellia.c | 6 |
2 files changed, 6 insertions, 2 deletions
diff --git a/crypto/evp/e_aria.c b/crypto/evp/e_aria.c index f3a68eb09d..3e64e45f89 100644 --- a/crypto/evp/e_aria.c +++ b/crypto/evp/e_aria.c @@ -171,7 +171,7 @@ static int aria_ctr_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, const unsigned char *in, size_t len) { unsigned int num = EVP_CIPHER_CTX_num(ctx); - EVP_ARIA_KEY *dat = EVP_C_DATA(EVP_ARIA_KEY,ctx); + EVP_ARIA_KEY *dat = EVP_C_DATA(EVP_ARIA_KEY, ctx); CRYPTO_ctr128_encrypt(in, out, len, &dat->ks, ctx->iv, EVP_CIPHER_CTX_buf_noconst(ctx), &num, diff --git a/crypto/evp/e_camellia.c b/crypto/evp/e_camellia.c index 0d338b8b2f..3e7cd76934 100644 --- a/crypto/evp/e_camellia.c +++ b/crypto/evp/e_camellia.c @@ -316,9 +316,13 @@ static int camellia_cfb1_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, static int camellia_ctr_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, const unsigned char *in, size_t len) { - unsigned int num = EVP_CIPHER_CTX_num(ctx); + int snum = EVP_CIPHER_CTX_num(ctx); + unsigned int num; EVP_CAMELLIA_KEY *dat = EVP_C_DATA(EVP_CAMELLIA_KEY,ctx); + if (snum < 0) + return 0; + num = snum; if (dat->stream.ctr) CRYPTO_ctr128_encrypt_ctr32(in, out, len, &dat->ks, ctx->iv, EVP_CIPHER_CTX_buf_noconst(ctx), &num, |