summaryrefslogtreecommitdiffstats
path: root/crypto/modes
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/modes
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/modes')
-rw-r--r--crypto/modes/cfb128.c5
-rw-r--r--crypto/modes/ctr128.c2
-rw-r--r--crypto/modes/ofb128.c5
3 files changed, 11 insertions, 1 deletions
diff --git a/crypto/modes/cfb128.c b/crypto/modes/cfb128.c
index fa94f047b5..f9c3c60536 100644
--- a/crypto/modes/cfb128.c
+++ b/crypto/modes/cfb128.c
@@ -30,6 +30,11 @@ void CRYPTO_cfb128_encrypt(const unsigned char *in, unsigned char *out,
unsigned int n;
size_t l = 0;
+ if (*num < 0) {
+ /* There is no good way to signal an error return from here */
+ *num = -1;
+ return;
+ }
n = *num;
if (enc) {
diff --git a/crypto/modes/ctr128.c b/crypto/modes/ctr128.c
index b902ee9b0b..2147751c58 100644
--- a/crypto/modes/ctr128.c
+++ b/crypto/modes/ctr128.c
@@ -155,7 +155,7 @@ void CRYPTO_ctr128_encrypt_ctr32(const unsigned char *in, unsigned char *out,
{
unsigned int n, ctr32;
- n = *num;
+ n = *num;
while (n && len) {
*(out++) = *(in++) ^ ecount_buf[n];
diff --git a/crypto/modes/ofb128.c b/crypto/modes/ofb128.c
index 829d724e2a..0b21380208 100644
--- a/crypto/modes/ofb128.c
+++ b/crypto/modes/ofb128.c
@@ -29,6 +29,11 @@ void CRYPTO_ofb128_encrypt(const unsigned char *in, unsigned char *out,
unsigned int n;
size_t l = 0;
+ if (*num < 0) {
+ /* There is no good way to signal an error return from here */
+ *num = -1;
+ return;
+ }
n = *num;
#if !defined(OPENSSL_SMALL_FOOTPRINT)