summaryrefslogtreecommitdiffstats
path: root/crypto/evp/e_camellia.c
diff options
context:
space:
mode:
authorPauli <ppzgs1@gmail.com>2021-03-22 12:09:19 +1000
committerPauli <ppzgs1@gmail.com>2021-03-24 09:12:43 +1000
commit1634b2df9f12d3976129ba49e38638e3ab368e3d (patch)
tree946791596a0e09bb9b04f0f8065b1fb9831e36b5 /crypto/evp/e_camellia.c
parentfe10fa75216cb0e81eeee9bced2b4d26e05bf9e7 (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/e_camellia.c')
-rw-r--r--crypto/evp/e_camellia.c6
1 files changed, 5 insertions, 1 deletions
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,