summaryrefslogtreecommitdiff
path: root/cipher/cipher-selftest.c
diff options
context:
space:
mode:
Diffstat (limited to 'cipher/cipher-selftest.c')
-rw-r--r--cipher/cipher-selftest.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/cipher/cipher-selftest.c b/cipher/cipher-selftest.c
index 5e958146..852368a0 100644
--- a/cipher/cipher-selftest.c
+++ b/cipher/cipher-selftest.c
@@ -82,7 +82,11 @@ _gcry_selftest_helper_cbc (const char *cipher, gcry_cipher_setkey_t setkey_func,
ciphertext = plaintext2 + nblocks * blocksize;
/* Initialize ctx */
- setkey_func (ctx, key, sizeof(key));
+ if (setkey_func (ctx, key, sizeof(key)) != GPG_ERR_NO_ERROR)
+ {
+ xfree(mem);
+ return "setkey failed";
+ }
/* Test single block code path */
memset (iv, 0x4e, blocksize);
@@ -199,7 +203,11 @@ _gcry_selftest_helper_cfb (const char *cipher, gcry_cipher_setkey_t setkey_func,
ciphertext = plaintext2 + nblocks * blocksize;
/* Initialize ctx */
- setkey_func (ctx, key, sizeof(key));
+ if (setkey_func (ctx, key, sizeof(key)) != GPG_ERR_NO_ERROR)
+ {
+ xfree(mem);
+ return "setkey failed";
+ }
/* Test single block code path */
memset(iv, 0xd3, blocksize);
@@ -316,7 +324,11 @@ _gcry_selftest_helper_ctr (const char *cipher, gcry_cipher_setkey_t setkey_func,
ciphertext2 = ciphertext + nblocks * blocksize;
/* Initialize ctx */
- setkey_func (ctx, key, sizeof(key));
+ if (setkey_func (ctx, key, sizeof(key)) != GPG_ERR_NO_ERROR)
+ {
+ xfree(mem);
+ return "setkey failed";
+ }
/* Test single block code path */
memset (iv, 0xff, blocksize);