diff options
author | phk <phk@FreeBSD.org> | 2002-10-14 11:21:05 +0000 |
---|---|---|
committer | phk <phk@FreeBSD.org> | 2002-10-14 11:21:05 +0000 |
commit | ab7f45635732a8e996bfe4082080f3bd002325bf (patch) | |
tree | d7efa4a826099b33017d8091296eb15ef3c5a70c /sys/crypto | |
parent | 83b297f2f002d92fe29b8b6c4466b58491c60cd9 (diff) | |
download | FreeBSD-src-ab7f45635732a8e996bfe4082080f3bd002325bf.zip FreeBSD-src-ab7f45635732a8e996bfe4082080f3bd002325bf.tar.gz |
Don't panic when we can just return an error code.
Diffstat (limited to 'sys/crypto')
-rw-r--r-- | sys/crypto/rijndael/rijndael-api-fst.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/sys/crypto/rijndael/rijndael-api-fst.c b/sys/crypto/rijndael/rijndael-api-fst.c index 2ffcc44..d2fdd67 100644 --- a/sys/crypto/rijndael/rijndael-api-fst.c +++ b/sys/crypto/rijndael/rijndael-api-fst.c @@ -27,6 +27,10 @@ #include <crypto/rijndael/rijndael-api-fst.h> #include <crypto/rijndael/rijndael_local.h> +#ifndef TRUE +#define TRUE 1 +#endif + int rijndael_makeKey(keyInstance *key, BYTE direction, int keyLen, char *keyMaterial) { word8 k[MAXKC][4]; int i; @@ -220,7 +224,7 @@ int rijndael_padEncrypt(cipherInstance *cipher, keyInstance *key, } padLen = 16 - (inputOctets - 16*numBlocks); if (padLen > 0 && padLen <= 16) - panic("rijndael_padEncrypt(ECB)"); + return BAD_CIPHER_STATE; bcopy(input, block, 16 - padLen); for (cp = block + 16 - padLen; cp < block + 16; cp++) *cp = padLen; @@ -241,7 +245,7 @@ int rijndael_padEncrypt(cipherInstance *cipher, keyInstance *key, } padLen = 16 - (inputOctets - 16*numBlocks); if (padLen > 0 && padLen <= 16) - panic("rijndael_padEncrypt(CBC)"); + return BAD_CIPHER_STATE; for (i = 0; i < 16 - padLen; i++) { block[i] = input[i] ^ iv[i]; } |