crypto/idea/i_cfb64.c: condition 'n < 0' can never be met after doing 'n = n & 0x07'

Resolves: https://scan5.scan.coverity.com/#/project-view/62622/10222?selectedIssue=1689816
Fixes: 5ba9029bc7 "Mask *num on entry in deprecated low-level OFB/CFB implementations"

Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
MergeDate: Sat Mar 21 23:50:41 2026
(Merged from https://github.com/openssl/openssl/pull/30500)
This commit is contained in:
Alexandr Nedvedicky 2026-03-19 08:21:24 +01:00 committed by Eugene Syromiatnikov
parent bbeade53dd
commit b73a574325

View file

@ -28,7 +28,7 @@ void IDEA_cfb64_encrypt(const unsigned char *in, unsigned char *out,
unsigned char *ivec, int *num, int encrypt)
{
register unsigned long v0, v1, t;
register int n = *num & 0x07;
register int n = *num;
register long l = length;
unsigned long ti[2];
unsigned char *iv, c, cc;
@ -37,6 +37,7 @@ void IDEA_cfb64_encrypt(const unsigned char *in, unsigned char *out,
*num = -1;
return;
}
n = n & 0x07;
iv = (unsigned char *)ivec;
if (encrypt) {