condition to panic() was backwards. sync w/kame

From: Rafal Boni <rafal@attbi.com>
This commit is contained in:
itojun 2002-10-18 23:44:58 +00:00
parent 3e9f96217e
commit 8201174690

View File

@ -224,7 +224,7 @@ int rijndael_padEncrypt(cipherInstance *cipher, keyInstance *key,
outBuffer += 16;
}
padLen = 16 - (inputOctets - 16*numBlocks);
if (padLen > 0 && padLen <= 16)
if (padLen < 0 || padLen > 16)
panic("rijndael_padEncrypt(ECB)");
bcopy(input, block, 16 - padLen);
for (cp = block + 16 - padLen; cp < block + 16; cp++)
@ -251,7 +251,7 @@ int rijndael_padEncrypt(cipherInstance *cipher, keyInstance *key,
if (padLen == 16)
padLen = 0;
#endif
if (padLen > 0 && padLen <= 16)
if (padLen < 0 || padLen > 16)
panic("rijndael_padEncrypt(CBC)");
for (i = 0; i < 16 - padLen; i++) {
block[i] = input[i] ^ iv[i];