summaryrefslogtreecommitdiff
path: root/tests/basic.c
diff options
context:
space:
mode:
authorWerner Koch <wk@gnupg.org>2016-04-14 14:39:31 +0200
committerWerner Koch <wk@gnupg.org>2016-04-14 14:39:31 +0200
commit47c6a1f88eb763e9baa394e34d873b761abcebbe (patch)
tree56d9c5ca4753225bf1e82dec51df0773317e1121 /tests/basic.c
parent88c6b98350193abbdcfb227754979b0c097ee09c (diff)
downloadlibgcrypt-47c6a1f88eb763e9baa394e34d873b761abcebbe.tar.gz
cipher: Add constant for 8 bit CFB mode.
* src/gcrypt.h.in (GCRY_CIPHER_MODE_CFB8): New. * tests/basic.c (check_cfb_cipher): Prepare for CFB-8 tests. -- Note that there is no implementation for the 8 bit CFB mode yet. We will add that as a bug fix after the release of 1.7.0. Signed-off-by: Werner Koch <wk@gnupg.org>
Diffstat (limited to 'tests/basic.c')
-rw-r--r--tests/basic.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/tests/basic.c b/tests/basic.c
index 4940f6a2..96fb4cbd 100644
--- a/tests/basic.c
+++ b/tests/basic.c
@@ -873,6 +873,7 @@ check_cfb_cipher (void)
static const struct tv
{
int algo;
+ int cfb8;
char key[MAX_DATA_LEN];
char iv[MAX_DATA_LEN];
struct data
@@ -885,7 +886,7 @@ check_cfb_cipher (void)
} tv[] =
{
/* http://csrc.nist.gov/publications/nistpubs/800-38a/sp800-38a.pdf */
- { GCRY_CIPHER_AES,
+ { GCRY_CIPHER_AES, 0,
"\x2b\x7e\x15\x16\x28\xae\xd2\xa6\xab\xf7\x15\x88\x09\xcf\x4f\x3c",
"\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f",
{ { "\x6b\xc1\xbe\xe2\x2e\x40\x9f\x96\xe9\x3d\x7e\x11\x73\x93\x17\x2a",
@@ -902,7 +903,7 @@ check_cfb_cipher (void)
"\xc0\x4b\x05\x35\x7c\x5d\x1c\x0e\xea\xc4\xc6\x6f\x9f\xf7\xf2\xe6" },
}
},
- { GCRY_CIPHER_AES192,
+ { GCRY_CIPHER_AES192, 0,
"\x8e\x73\xb0\xf7\xda\x0e\x64\x52\xc8\x10\xf3\x2b"
"\x80\x90\x79\xe5\x62\xf8\xea\xd2\x52\x2c\x6b\x7b",
"\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f",
@@ -920,7 +921,7 @@ check_cfb_cipher (void)
"\xc0\x5f\x9f\x9c\xa9\x83\x4f\xa0\x42\xae\x8f\xba\x58\x4b\x09\xff" },
}
},
- { GCRY_CIPHER_AES256,
+ { GCRY_CIPHER_AES256, 0,
"\x60\x3d\xeb\x10\x15\xca\x71\xbe\x2b\x73\xae\xf0\x85\x7d\x77\x81"
"\x1f\x35\x2c\x07\x3b\x61\x08\xd7\x2d\x98\x10\xa3\x09\x14\xdf\xf4",
"\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f",
@@ -941,7 +942,7 @@ check_cfb_cipher (void)
};
gcry_cipher_hd_t hde, hdd;
unsigned char out[MAX_DATA_LEN];
- int i, j, keylen, blklen;
+ int i, j, keylen, blklen, mode;
gcry_error_t err = 0;
if (verbose)
@@ -957,13 +958,15 @@ check_cfb_cipher (void)
continue;
}
+ mode = tv[i].cfb8? GCRY_CIPHER_MODE_CFB8 : GCRY_CIPHER_MODE_CFB;
+
if (verbose)
fprintf (stderr, " checking CFB mode for %s [%i]\n",
gcry_cipher_algo_name (tv[i].algo),
tv[i].algo);
- err = gcry_cipher_open (&hde, tv[i].algo, GCRY_CIPHER_MODE_CFB, 0);
+ err = gcry_cipher_open (&hde, tv[i].algo, mode, 0);
if (!err)
- err = gcry_cipher_open (&hdd, tv[i].algo, GCRY_CIPHER_MODE_CFB, 0);
+ err = gcry_cipher_open (&hdd, tv[i].algo, mode, 0);
if (err)
{
fail ("aes-cfb, gcry_cipher_open failed: %s\n", gpg_strerror (err));