crypto: testmgr - add new larger DES testvectors
Jussi Kivilinna [Sat, 20 Oct 2012 11:53:07 +0000 (14:53 +0300)]
Most DES testvectors are short and do not test parallelised codepaths
well. Add larger testvectors to test large crypto operations and to test
multi-page crypto with DES.

Signed-off-by: Jussi Kivilinna <jussi.kivilinna@mbnet.fi>
Acked-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

crypto/tcrypt.c
crypto/testmgr.c
crypto/testmgr.h

index 7a3c450..631b912 100644 (file)
@@ -971,6 +971,7 @@ static int do_test(int m)
        case 3:
                ret += tcrypt_test("ecb(des)");
                ret += tcrypt_test("cbc(des)");
+               ret += tcrypt_test("ctr(des)");
                break;
 
        case 4:
index 941d75c..8655309 100644 (file)
@@ -2336,6 +2336,21 @@ static const struct alg_test_desc alg_test_descs[] = {
                        }
                }
        }, {
+               .alg = "ctr(des)",
+               .test = alg_test_skcipher,
+               .suite = {
+                       .cipher = {
+                               .enc = {
+                                       .vecs = des_ctr_enc_tv_template,
+                                       .count = DES_CTR_ENC_TEST_VECTORS
+                               },
+                               .dec = {
+                                       .vecs = des_ctr_dec_tv_template,
+                                       .count = DES_CTR_DEC_TEST_VECTORS
+                               }
+                       }
+               }
+       }, {
                .alg = "ctr(serpent)",
                .test = alg_test_skcipher,
                .suite = {
index b0258f3..3e1a27b 100644 (file)
@@ -2024,10 +2024,12 @@ static struct hash_testvec hmac_sha512_tv_template[] = {
 /*
  * DES test vectors.
  */
-#define DES_ENC_TEST_VECTORS           10
-#define DES_DEC_TEST_VECTORS           4
-#define DES_CBC_ENC_TEST_VECTORS       5
-#define DES_CBC_DEC_TEST_VECTORS       4
+#define DES_ENC_TEST_VECTORS           11
+#define DES_DEC_TEST_VECTORS           5
+#define DES_CBC_ENC_TEST_VECTORS       6
+#define DES_CBC_DEC_TEST_VECTORS       5
+#define DES_CTR_ENC_TEST_VECTORS       2
+#define DES_CTR_DEC_TEST_VECTORS       2
 #define DES3_EDE_ENC_TEST_VECTORS      3
 #define DES3_EDE_DEC_TEST_VECTORS      3
 #define DES3_EDE_CBC_ENC_TEST_VECTORS  1
@@ -2134,6 +2136,76 @@ static struct cipher_testvec des_enc_tv_template[] = {
                .rlen   = 8,
                .np     = 8,
                .tap    = { 1, 1, 1, 1, 1, 1, 1, 1 }
+       }, { /* Generated with Crypto++ */
+               .key    = "\xC9\x83\xA6\xC9\xEC\x0F\x32\x55",
+               .klen   = 8,
+               .input  = "\x50\xB9\x22\xAE\x17\x80\x0C\x75"
+                         "\xDE\x47\xD3\x3C\xA5\x0E\x9A\x03"
+                         "\x6C\xF8\x61\xCA\x33\xBF\x28\x91"
+                         "\x1D\x86\xEF\x58\xE4\x4D\xB6\x1F"
+                         "\xAB\x14\x7D\x09\x72\xDB\x44\xD0"
+                         "\x39\xA2\x0B\x97\x00\x69\xF5\x5E"
+                         "\xC7\x30\xBC\x25\x8E\x1A\x83\xEC"
+                         "\x55\xE1\x4A\xB3\x1C\xA8\x11\x7A"
+                         "\x06\x6F\xD8\x41\xCD\x36\x9F\x08"
+                         "\x94\xFD\x66\xF2\x5B\xC4\x2D\xB9"
+                         "\x22\x8B\x17\x80\xE9\x52\xDE\x47"
+                         "\xB0\x19\xA5\x0E\x77\x03\x6C\xD5"
+                         "\x3E\xCA\x33\x9C\x05\x91\xFA\x63"
+                         "\xEF\x58\xC1\x2A\xB6\x1F\x88\x14"
+                         "\x7D\xE6\x4F\xDB\x44\xAD\x16\xA2"
+                         "\x0B\x74\x00\x69\xD2\x3B\xC7\x30"
+                         "\x99\x02\x8E\xF7\x60\xEC\x55\xBE"
+                         "\x27\xB3\x1C\x85\x11\x7A\xE3\x4C"
+                         "\xD8\x41\xAA\x13\x9F\x08\x71\xFD"
+                         "\x66\xCF\x38\xC4\x2D\x96\x22\x8B"
+                         "\xF4\x5D\xE9\x52\xBB\x24\xB0\x19"
+                         "\x82\x0E\x77\xE0\x49\xD5\x3E\xA7"
+                         "\x10\x9C\x05\x6E\xFA\x63\xCC\x35"
+                         "\xC1\x2A\x93\x1F\x88\xF1\x5A\xE6"
+                         "\x4F\xB8\x21\xAD\x16\x7F\x0B\x74"
+                         "\xDD\x46\xD2\x3B\xA4\x0D\x99\x02"
+                         "\x6B\xF7\x60\xC9\x32\xBE\x27\x90"
+                         "\x1C\x85\xEE\x57\xE3\x4C\xB5\x1E"
+                         "\xAA\x13\x7C\x08\x71\xDA\x43\xCF"
+                         "\x38\xA1\x0A\x96\xFF\x68\xF4\x5D"
+                         "\xC6\x2F\xBB\x24\x8D\x19\x82\xEB",
+               .ilen   = 248,
+               .result = "\x88\xCB\x1F\xAB\x2F\x2A\x49\x57"
+                         "\x92\xB9\x77\xFF\x2F\x47\x58\xDD"
+                         "\xD7\x8A\x91\x95\x26\x33\x78\xB2"
+                         "\x33\xBA\xB2\x3E\x02\xF5\x1F\xEF"
+                         "\x98\xC5\xA6\xD2\x7D\x79\xEC\xB3"
+                         "\x45\xF3\x4C\x61\xAC\x6C\xC2\x55"
+                         "\xE5\xD3\x06\x58\x8A\x42\x3E\xDD"
+                         "\x3D\x20\x45\xE9\x6F\x0D\x25\xA8"
+                         "\xA5\xC7\x69\xCE\xD5\x3B\x7B\xC9"
+                         "\x9E\x65\xE7\xA3\xF2\xE4\x18\x94"
+                         "\xD2\x81\xE9\x33\x2B\x2D\x49\xC4"
+                         "\xFE\xDA\x7F\xE2\xF2\x8C\x9C\xDC"
+                         "\x73\x58\x11\x1F\x81\xD7\x21\x1A"
+                         "\x80\xD0\x0D\xE8\x45\xD6\xD8\xD5"
+                         "\x2E\x51\x16\xCA\x09\x89\x54\x62"
+                         "\xF7\x04\x3D\x75\xB9\xA3\x84\xF4"
+                         "\x62\xF0\x02\x58\x83\xAF\x30\x87"
+                         "\x85\x3F\x01\xCD\x8E\x58\x42\xC4"
+                         "\x41\x73\xE0\x15\x0A\xE6\x2E\x80"
+                         "\x94\xF8\x5B\x3A\x4E\xDF\x51\xB2"
+                         "\x9D\xE4\xC4\x9D\xF7\x3F\xF8\x8E"
+                         "\x37\x22\x4D\x00\x2A\xEF\xC1\x0F"
+                         "\x14\xA0\x66\xAB\x79\x39\xD0\x8E"
+                         "\xE9\x95\x61\x74\x12\xED\x07\xD7"
+                         "\xDD\x95\xDC\x7B\x57\x25\x27\x9C"
+                         "\x51\x96\x16\xF7\x94\x61\xB8\x87"
+                         "\xF0\x21\x1B\x32\xFB\x07\x0F\x29"
+                         "\x56\xBD\x9D\x22\xA2\x9F\xA2\xB9"
+                         "\x46\x31\x4C\x5E\x2E\x95\x61\xEF"
+                         "\xE1\x58\x39\x09\xB4\x8B\x40\xAC"
+                         "\x5F\x62\xC7\x72\xD9\xFC\xCB\x9A",
+               .rlen   = 248,
+               .also_non_np = 1,
+               .np     = 2,
+               .tap    = { 248 - 8, 8 },
        },
 };
 
@@ -2174,6 +2246,76 @@ static struct cipher_testvec des_dec_tv_template[] = {
                .rlen   = 16,
                .np     = 3,
                .tap    = { 3, 12, 1 }
+       }, { /* Generated with Crypto++ */
+               .key    = "\xC9\x83\xA6\xC9\xEC\x0F\x32\x55",
+               .klen   = 8,
+               .input  = "\x88\xCB\x1F\xAB\x2F\x2A\x49\x57"
+                         "\x92\xB9\x77\xFF\x2F\x47\x58\xDD"
+                         "\xD7\x8A\x91\x95\x26\x33\x78\xB2"
+                         "\x33\xBA\xB2\x3E\x02\xF5\x1F\xEF"
+                         "\x98\xC5\xA6\xD2\x7D\x79\xEC\xB3"
+                         "\x45\xF3\x4C\x61\xAC\x6C\xC2\x55"
+                         "\xE5\xD3\x06\x58\x8A\x42\x3E\xDD"
+                         "\x3D\x20\x45\xE9\x6F\x0D\x25\xA8"
+                         "\xA5\xC7\x69\xCE\xD5\x3B\x7B\xC9"
+                         "\x9E\x65\xE7\xA3\xF2\xE4\x18\x94"
+                         "\xD2\x81\xE9\x33\x2B\x2D\x49\xC4"
+                         "\xFE\xDA\x7F\xE2\xF2\x8C\x9C\xDC"
+                         "\x73\x58\x11\x1F\x81\xD7\x21\x1A"
+                         "\x80\xD0\x0D\xE8\x45\xD6\xD8\xD5"
+                         "\x2E\x51\x16\xCA\x09\x89\x54\x62"
+                         "\xF7\x04\x3D\x75\xB9\xA3\x84\xF4"
+                         "\x62\xF0\x02\x58\x83\xAF\x30\x87"
+                         "\x85\x3F\x01\xCD\x8E\x58\x42\xC4"
+                         "\x41\x73\xE0\x15\x0A\xE6\x2E\x80"
+                         "\x94\xF8\x5B\x3A\x4E\xDF\x51\xB2"
+                         "\x9D\xE4\xC4\x9D\xF7\x3F\xF8\x8E"
+                         "\x37\x22\x4D\x00\x2A\xEF\xC1\x0F"
+                         "\x14\xA0\x66\xAB\x79\x39\xD0\x8E"
+                         "\xE9\x95\x61\x74\x12\xED\x07\xD7"
+                         "\xDD\x95\xDC\x7B\x57\x25\x27\x9C"
+                         "\x51\x96\x16\xF7\x94\x61\xB8\x87"
+                         "\xF0\x21\x1B\x32\xFB\x07\x0F\x29"
+                         "\x56\xBD\x9D\x22\xA2\x9F\xA2\xB9"
+                         "\x46\x31\x4C\x5E\x2E\x95\x61\xEF"
+                         "\xE1\x58\x39\x09\xB4\x8B\x40\xAC"
+                         "\x5F\x62\xC7\x72\xD9\xFC\xCB\x9A",
+               .ilen   = 248,
+               .result = "\x50\xB9\x22\xAE\x17\x80\x0C\x75"
+                         "\xDE\x47\xD3\x3C\xA5\x0E\x9A\x03"
+                         "\x6C\xF8\x61\xCA\x33\xBF\x28\x91"
+                         "\x1D\x86\xEF\x58\xE4\x4D\xB6\x1F"
+                         "\xAB\x14\x7D\x09\x72\xDB\x44\xD0"
+                         "\x39\xA2\x0B\x97\x00\x69\xF5\x5E"
+                         "\xC7\x30\xBC\x25\x8E\x1A\x83\xEC"
+                         "\x55\xE1\x4A\xB3\x1C\xA8\x11\x7A"
+                         "\x06\x6F\xD8\x41\xCD\x36\x9F\x08"
+                         "\x94\xFD\x66\xF2\x5B\xC4\x2D\xB9"
+                         "\x22\x8B\x17\x80\xE9\x52\xDE\x47"
+                         "\xB0\x19\xA5\x0E\x77\x03\x6C\xD5"
+                         "\x3E\xCA\x33\x9C\x05\x91\xFA\x63"
+                         "\xEF\x58\xC1\x2A\xB6\x1F\x88\x14"
+                         "\x7D\xE6\x4F\xDB\x44\xAD\x16\xA2"
+                         "\x0B\x74\x00\x69\xD2\x3B\xC7\x30"
+                         "\x99\x02\x8E\xF7\x60\xEC\x55\xBE"
+                         "\x27\xB3\x1C\x85\x11\x7A\xE3\x4C"
+                         "\xD8\x41\xAA\x13\x9F\x08\x71\xFD"
+                         "\x66\xCF\x38\xC4\x2D\x96\x22\x8B"
+                         "\xF4\x5D\xE9\x52\xBB\x24\xB0\x19"
+                         "\x82\x0E\x77\xE0\x49\xD5\x3E\xA7"
+                         "\x10\x9C\x05\x6E\xFA\x63\xCC\x35"
+                         "\xC1\x2A\x93\x1F\x88\xF1\x5A\xE6"
+                         "\x4F\xB8\x21\xAD\x16\x7F\x0B\x74"
+                         "\xDD\x46\xD2\x3B\xA4\x0D\x99\x02"
+                         "\x6B\xF7\x60\xC9\x32\xBE\x27\x90"
+                         "\x1C\x85\xEE\x57\xE3\x4C\xB5\x1E"
+                         "\xAA\x13\x7C\x08\x71\xDA\x43\xCF"
+                         "\x38\xA1\x0A\x96\xFF\x68\xF4\x5D"
+                         "\xC6\x2F\xBB\x24\x8D\x19\x82\xEB",
+               .rlen   = 248,
+               .also_non_np = 1,
+               .np     = 2,
+               .tap    = { 248 - 8, 8 },
        },
 };
 
@@ -2229,6 +2371,77 @@ static struct cipher_testvec des_cbc_enc_tv_template[] = {
                .rlen   = 24,
                .np     = 2,
                .tap    = { 13, 11 }
+       }, { /* Generated with Crypto++ */
+               .key    = "\xC9\x83\xA6\xC9\xEC\x0F\x32\x55",
+               .klen   = 8,
+               .iv     = "\xE7\x82\x1D\xB8\x53\x11\xAC\x47",
+               .input  = "\x50\xB9\x22\xAE\x17\x80\x0C\x75"
+                         "\xDE\x47\xD3\x3C\xA5\x0E\x9A\x03"
+                         "\x6C\xF8\x61\xCA\x33\xBF\x28\x91"
+                         "\x1D\x86\xEF\x58\xE4\x4D\xB6\x1F"
+                         "\xAB\x14\x7D\x09\x72\xDB\x44\xD0"
+                         "\x39\xA2\x0B\x97\x00\x69\xF5\x5E"
+                         "\xC7\x30\xBC\x25\x8E\x1A\x83\xEC"
+                         "\x55\xE1\x4A\xB3\x1C\xA8\x11\x7A"
+                         "\x06\x6F\xD8\x41\xCD\x36\x9F\x08"
+                         "\x94\xFD\x66\xF2\x5B\xC4\x2D\xB9"
+                         "\x22\x8B\x17\x80\xE9\x52\xDE\x47"
+                         "\xB0\x19\xA5\x0E\x77\x03\x6C\xD5"
+                         "\x3E\xCA\x33\x9C\x05\x91\xFA\x63"
+                         "\xEF\x58\xC1\x2A\xB6\x1F\x88\x14"
+                         "\x7D\xE6\x4F\xDB\x44\xAD\x16\xA2"
+                         "\x0B\x74\x00\x69\xD2\x3B\xC7\x30"
+                         "\x99\x02\x8E\xF7\x60\xEC\x55\xBE"
+                         "\x27\xB3\x1C\x85\x11\x7A\xE3\x4C"
+                         "\xD8\x41\xAA\x13\x9F\x08\x71\xFD"
+                         "\x66\xCF\x38\xC4\x2D\x96\x22\x8B"
+                         "\xF4\x5D\xE9\x52\xBB\x24\xB0\x19"
+                         "\x82\x0E\x77\xE0\x49\xD5\x3E\xA7"
+                         "\x10\x9C\x05\x6E\xFA\x63\xCC\x35"
+                         "\xC1\x2A\x93\x1F\x88\xF1\x5A\xE6"
+                         "\x4F\xB8\x21\xAD\x16\x7F\x0B\x74"
+                         "\xDD\x46\xD2\x3B\xA4\x0D\x99\x02"
+                         "\x6B\xF7\x60\xC9\x32\xBE\x27\x90"
+                         "\x1C\x85\xEE\x57\xE3\x4C\xB5\x1E"
+                         "\xAA\x13\x7C\x08\x71\xDA\x43\xCF"
+                         "\x38\xA1\x0A\x96\xFF\x68\xF4\x5D"
+                         "\xC6\x2F\xBB\x24\x8D\x19\x82\xEB",
+               .ilen   = 248,
+               .result = "\x71\xCC\x56\x1C\x87\x2C\x43\x20"
+                         "\x1C\x20\x13\x09\xF9\x2B\x40\x47"
+                         "\x99\x10\xD1\x1B\x65\x33\x33\xBA"
+                         "\x88\x0D\xA2\xD1\x86\xFF\x4D\xF4"
+                         "\x5A\x0C\x12\x96\x32\x57\xAA\x26"
+                         "\xA7\xF4\x32\x8D\xBC\x10\x31\x9E"
+                         "\x81\x72\x74\xDE\x30\x19\x69\x49"
+                         "\x54\x9C\xC3\xEB\x0B\x97\xDD\xD1"
+                         "\xE8\x6D\x0D\x05\x83\xA5\x12\x08"
+                         "\x47\xF8\x88\x03\x86\x51\x3C\xEF"
+                         "\xE7\x11\x73\x4D\x44\x2B\xE2\x16"
+                         "\xE8\xA5\x06\x50\x66\x70\x0E\x14"
+                         "\xBA\x21\x3B\xD5\x23\x5B\xA7\x8F"
+                         "\x56\xB6\xA7\x44\xDB\x86\xAB\x69"
+                         "\x33\x3C\xBE\x64\xC4\x22\xD3\xFE"
+                         "\x49\x90\x88\x6A\x09\x8F\x76\x59"
+                         "\xCB\xB7\xA0\x2D\x79\x75\x92\x8A"
+                         "\x82\x1D\xC2\xFE\x09\x1F\x78\x6B"
+                         "\x2F\xD6\xA4\x87\x1E\xC4\x53\x63"
+                         "\x80\x02\x61\x2F\xE3\x46\xB6\xB5"
+                         "\xAA\x95\xF4\xEE\xA7\x64\x2B\x4F"
+                         "\x20\xCF\xD2\x47\x4E\x39\x65\xB3"
+                         "\x11\x87\xA2\x6C\x49\x7E\x36\xC7"
+                         "\x62\x8B\x48\x0D\x6A\x64\x00\xBD"
+                         "\x71\x91\x8C\xE9\x70\x19\x01\x4F"
+                         "\x4E\x68\x23\xBA\xDA\x24\x2E\x45"
+                         "\x02\x14\x33\x21\xAE\x58\x4B\xCF"
+                         "\x3B\x4B\xE8\xF8\xF6\x4F\x34\x93"
+                         "\xD7\x07\x8A\xD7\x18\x92\x36\x8C"
+                         "\x82\xA9\xBD\x6A\x31\x91\x39\x11"
+                         "\xC6\x4A\xF3\x55\xC7\x29\x2E\x63",
+               .rlen   = 248,
+               .also_non_np = 1,
+               .np     = 2,
+               .tap    = { 248 - 8, 8 },
        },
 };
 
@@ -2267,6 +2480,369 @@ static struct cipher_testvec des_cbc_dec_tv_template[] = {
                .rlen   = 8,
                .np     = 2,
                .tap    = { 4, 4 }
+       }, { /* Generated with Crypto++ */
+               .key    = "\xC9\x83\xA6\xC9\xEC\x0F\x32\x55",
+               .klen   = 8,
+               .iv     = "\xE7\x82\x1D\xB8\x53\x11\xAC\x47",
+               .input  = "\x71\xCC\x56\x1C\x87\x2C\x43\x20"
+                         "\x1C\x20\x13\x09\xF9\x2B\x40\x47"
+                         "\x99\x10\xD1\x1B\x65\x33\x33\xBA"
+                         "\x88\x0D\xA2\xD1\x86\xFF\x4D\xF4"
+                         "\x5A\x0C\x12\x96\x32\x57\xAA\x26"
+                         "\xA7\xF4\x32\x8D\xBC\x10\x31\x9E"
+                         "\x81\x72\x74\xDE\x30\x19\x69\x49"
+                         "\x54\x9C\xC3\xEB\x0B\x97\xDD\xD1"
+                         "\xE8\x6D\x0D\x05\x83\xA5\x12\x08"
+                         "\x47\xF8\x88\x03\x86\x51\x3C\xEF"
+                         "\xE7\x11\x73\x4D\x44\x2B\xE2\x16"
+                         "\xE8\xA5\x06\x50\x66\x70\x0E\x14"
+                         "\xBA\x21\x3B\xD5\x23\x5B\xA7\x8F"
+                         "\x56\xB6\xA7\x44\xDB\x86\xAB\x69"
+                         "\x33\x3C\xBE\x64\xC4\x22\xD3\xFE"
+                         "\x49\x90\x88\x6A\x09\x8F\x76\x59"
+                         "\xCB\xB7\xA0\x2D\x79\x75\x92\x8A"
+                         "\x82\x1D\xC2\xFE\x09\x1F\x78\x6B"
+                         "\x2F\xD6\xA4\x87\x1E\xC4\x53\x63"
+                         "\x80\x02\x61\x2F\xE3\x46\xB6\xB5"
+                         "\xAA\x95\xF4\xEE\xA7\x64\x2B\x4F"
+                         "\x20\xCF\xD2\x47\x4E\x39\x65\xB3"
+                         "\x11\x87\xA2\x6C\x49\x7E\x36\xC7"
+                         "\x62\x8B\x48\x0D\x6A\x64\x00\xBD"
+                         "\x71\x91\x8C\xE9\x70\x19\x01\x4F"
+                         "\x4E\x68\x23\xBA\xDA\x24\x2E\x45"
+                         "\x02\x14\x33\x21\xAE\x58\x4B\xCF"
+                         "\x3B\x4B\xE8\xF8\xF6\x4F\x34\x93"
+                         "\xD7\x07\x8A\xD7\x18\x92\x36\x8C"
+                         "\x82\xA9\xBD\x6A\x31\x91\x39\x11"
+                         "\xC6\x4A\xF3\x55\xC7\x29\x2E\x63",
+               .ilen   = 248,
+               .result = "\x50\xB9\x22\xAE\x17\x80\x0C\x75"
+                         "\xDE\x47\xD3\x3C\xA5\x0E\x9A\x03"
+                         "\x6C\xF8\x61\xCA\x33\xBF\x28\x91"
+                         "\x1D\x86\xEF\x58\xE4\x4D\xB6\x1F"
+                         "\xAB\x14\x7D\x09\x72\xDB\x44\xD0"
+                         "\x39\xA2\x0B\x97\x00\x69\xF5\x5E"
+                         "\xC7\x30\xBC\x25\x8E\x1A\x83\xEC"
+                         "\x55\xE1\x4A\xB3\x1C\xA8\x11\x7A"
+                         "\x06\x6F\xD8\x41\xCD\x36\x9F\x08"
+                         "\x94\xFD\x66\xF2\x5B\xC4\x2D\xB9"
+                         "\x22\x8B\x17\x80\xE9\x52\xDE\x47"
+                         "\xB0\x19\xA5\x0E\x77\x03\x6C\xD5"
+                         "\x3E\xCA\x33\x9C\x05\x91\xFA\x63"
+                         "\xEF\x58\xC1\x2A\xB6\x1F\x88\x14"
+                         "\x7D\xE6\x4F\xDB\x44\xAD\x16\xA2"
+                         "\x0B\x74\x00\x69\xD2\x3B\xC7\x30"
+                         "\x99\x02\x8E\xF7\x60\xEC\x55\xBE"
+                         "\x27\xB3\x1C\x85\x11\x7A\xE3\x4C"
+                         "\xD8\x41\xAA\x13\x9F\x08\x71\xFD"
+                         "\x66\xCF\x38\xC4\x2D\x96\x22\x8B"
+                         "\xF4\x5D\xE9\x52\xBB\x24\xB0\x19"
+                         "\x82\x0E\x77\xE0\x49\xD5\x3E\xA7"
+                         "\x10\x9C\x05\x6E\xFA\x63\xCC\x35"
+                         "\xC1\x2A\x93\x1F\x88\xF1\x5A\xE6"
+                         "\x4F\xB8\x21\xAD\x16\x7F\x0B\x74"
+                         "\xDD\x46\xD2\x3B\xA4\x0D\x99\x02"
+                         "\x6B\xF7\x60\xC9\x32\xBE\x27\x90"
+                         "\x1C\x85\xEE\x57\xE3\x4C\xB5\x1E"
+                         "\xAA\x13\x7C\x08\x71\xDA\x43\xCF"
+                         "\x38\xA1\x0A\x96\xFF\x68\xF4\x5D"
+                         "\xC6\x2F\xBB\x24\x8D\x19\x82\xEB",
+               .rlen   = 248,
+               .also_non_np = 1,
+               .np     = 2,
+               .tap    = { 248 - 8, 8 },
+       },
+};
+
+static struct cipher_testvec des_ctr_enc_tv_template[] = {
+       { /* Generated with Crypto++ */
+               .key    = "\xC9\x83\xA6\xC9\xEC\x0F\x32\x55",
+               .klen   = 8,
+               .iv     = "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFD",
+               .input  = "\x50\xB9\x22\xAE\x17\x80\x0C\x75"
+                         "\xDE\x47\xD3\x3C\xA5\x0E\x9A\x03"
+                         "\x6C\xF8\x61\xCA\x33\xBF\x28\x91"
+                         "\x1D\x86\xEF\x58\xE4\x4D\xB6\x1F"
+                         "\xAB\x14\x7D\x09\x72\xDB\x44\xD0"
+                         "\x39\xA2\x0B\x97\x00\x69\xF5\x5E"
+                         "\xC7\x30\xBC\x25\x8E\x1A\x83\xEC"
+                         "\x55\xE1\x4A\xB3\x1C\xA8\x11\x7A"
+                         "\x06\x6F\xD8\x41\xCD\x36\x9F\x08"
+                         "\x94\xFD\x66\xF2\x5B\xC4\x2D\xB9"
+                         "\x22\x8B\x17\x80\xE9\x52\xDE\x47"
+                         "\xB0\x19\xA5\x0E\x77\x03\x6C\xD5"
+                         "\x3E\xCA\x33\x9C\x05\x91\xFA\x63"
+                         "\xEF\x58\xC1\x2A\xB6\x1F\x88\x14"
+                         "\x7D\xE6\x4F\xDB\x44\xAD\x16\xA2"
+                         "\x0B\x74\x00\x69\xD2\x3B\xC7\x30"
+                         "\x99\x02\x8E\xF7\x60\xEC\x55\xBE"
+                         "\x27\xB3\x1C\x85\x11\x7A\xE3\x4C"
+                         "\xD8\x41\xAA\x13\x9F\x08\x71\xFD"
+                         "\x66\xCF\x38\xC4\x2D\x96\x22\x8B"
+                         "\xF4\x5D\xE9\x52\xBB\x24\xB0\x19"
+                         "\x82\x0E\x77\xE0\x49\xD5\x3E\xA7"
+                         "\x10\x9C\x05\x6E\xFA\x63\xCC\x35"
+                         "\xC1\x2A\x93\x1F\x88\xF1\x5A\xE6"
+                         "\x4F\xB8\x21\xAD\x16\x7F\x0B\x74"
+                         "\xDD\x46\xD2\x3B\xA4\x0D\x99\x02"
+                         "\x6B\xF7\x60\xC9\x32\xBE\x27\x90"
+                         "\x1C\x85\xEE\x57\xE3\x4C\xB5\x1E"
+                         "\xAA\x13\x7C\x08\x71\xDA\x43\xCF"
+                         "\x38\xA1\x0A\x96\xFF\x68\xF4\x5D"
+                         "\xC6\x2F\xBB\x24\x8D\x19\x82\xEB",
+               .ilen   = 248,
+               .result = "\x2F\x96\x06\x0F\x50\xC9\x68\x03"
+                         "\x0F\x31\xD4\x64\xA5\x29\x77\x35"
+                         "\xBC\x7A\x9F\x19\xE7\x0D\x33\x3E"
+                         "\x12\x0B\x8C\xAE\x48\xAE\xD9\x02"
+                         "\x0A\xD4\xB0\xD6\x37\xB2\x65\x1C"
+                         "\x4B\x65\xEB\x24\xB5\x8E\xAD\x47"
+                         "\x0D\xDA\x79\x77\xA0\x29\xA0\x2B"
+                         "\xC8\x0F\x85\xDC\x03\x13\xA9\x04"
+                         "\x19\x40\xBE\xBE\x5C\x49\x4A\x69"
+                         "\xED\xE8\xE1\x9E\x14\x43\x74\xDE"
+                         "\xEC\x6E\x11\x3F\x36\xEF\x7B\xFB"
+                         "\xBE\x4C\x91\x43\x22\x65\x72\x48"
+                         "\xE2\x12\xED\x88\xAC\xA7\xC9\x91"
+                         "\x14\xA2\x36\x1C\x29\xFF\xC8\x4F"
+                         "\x72\x5C\x4B\xB0\x1E\x93\xC2\xFA"
+                         "\x9D\x53\x86\xA0\xAE\xC6\xB7\x3C"
+                         "\x59\x0C\xD0\x8F\xA6\xD8\xA4\x31"
+                         "\xB7\x30\x1C\x21\x38\xFB\x68\x8C"
+                         "\x2E\xF5\x6E\x73\xC3\x16\x5F\x12"
+                         "\x0C\x33\xB9\x1E\x7B\x70\xDE\x86"
+                         "\x32\xB3\xC1\x16\xAB\xD9\x49\x0B"
+                         "\x96\x28\x72\x6B\xF3\x30\xA9\xEB"
+                         "\x69\xE2\x1E\x58\x46\xA2\x8E\xC7"
+                         "\xC0\xEF\x07\xB7\x77\x2C\x00\x05"
+                         "\x46\xBD\xFE\x53\x81\x8B\xA4\x03"
+                         "\x20\x0F\xDB\x78\x0B\x1F\x53\x04"
+                         "\x4C\x60\x4C\xC3\x2A\x86\x86\x7E"
+                         "\x13\xD2\x26\xED\x5D\x3E\x9C\xF2"
+                         "\x5C\xC4\x15\xC9\x9A\x21\xC5\xCD"
+                         "\x19\x7F\x99\x19\x53\xCE\x1D\x14"
+                         "\x69\x74\xA1\x06\x46\x0F\x4E\x75",
+               .rlen   = 248,
+               .also_non_np = 1,
+               .np     = 2,
+               .tap    = { 248 - 8, 8 },
+       }, { /* Generated with Crypto++ */
+               .key    = "\xC9\x83\xA6\xC9\xEC\x0F\x32\x55",
+               .klen   = 8,
+               .iv     = "\xE7\x82\x1D\xB8\x53\x11\xAC\x47",
+               .input  = "\x50\xB9\x22\xAE\x17\x80\x0C\x75"
+                         "\xDE\x47\xD3\x3C\xA5\x0E\x9A\x03"
+                         "\x6C\xF8\x61\xCA\x33\xBF\x28\x91"
+                         "\x1D\x86\xEF\x58\xE4\x4D\xB6\x1F"
+                         "\xAB\x14\x7D\x09\x72\xDB\x44\xD0"
+                         "\x39\xA2\x0B\x97\x00\x69\xF5\x5E"
+                         "\xC7\x30\xBC\x25\x8E\x1A\x83\xEC"
+                         "\x55\xE1\x4A\xB3\x1C\xA8\x11\x7A"
+                         "\x06\x6F\xD8\x41\xCD\x36\x9F\x08"
+                         "\x94\xFD\x66\xF2\x5B\xC4\x2D\xB9"
+                         "\x22\x8B\x17\x80\xE9\x52\xDE\x47"
+                         "\xB0\x19\xA5\x0E\x77\x03\x6C\xD5"
+                         "\x3E\xCA\x33\x9C\x05\x91\xFA\x63"
+                         "\xEF\x58\xC1\x2A\xB6\x1F\x88\x14"
+                         "\x7D\xE6\x4F\xDB\x44\xAD\x16\xA2"
+                         "\x0B\x74\x00\x69\xD2\x3B\xC7\x30"
+                         "\x99\x02\x8E\xF7\x60\xEC\x55\xBE"
+                         "\x27\xB3\x1C\x85\x11\x7A\xE3\x4C"
+                         "\xD8\x41\xAA\x13\x9F\x08\x71\xFD"
+                         "\x66\xCF\x38\xC4\x2D\x96\x22\x8B"
+                         "\xF4\x5D\xE9\x52\xBB\x24\xB0\x19"
+                         "\x82\x0E\x77\xE0\x49\xD5\x3E\xA7"
+                         "\x10\x9C\x05\x6E\xFA\x63\xCC\x35"
+                         "\xC1\x2A\x93\x1F\x88\xF1\x5A\xE6"
+                         "\x4F\xB8\x21\xAD\x16\x7F\x0B\x74"
+                         "\xDD\x46\xD2\x3B\xA4\x0D\x99\x02"
+                         "\x6B\xF7\x60\xC9\x32\xBE\x27\x90"
+                         "\x1C\x85\xEE\x57\xE3\x4C\xB5\x1E"
+                         "\xAA\x13\x7C\x08\x71\xDA\x43\xCF"
+                         "\x38\xA1\x0A\x96\xFF\x68\xF4\x5D"
+                         "\xC6\x2F\xBB\x24\x8D\x19\x82",
+               .ilen   = 247,
+               .result = "\x62\xE5\xF4\xDC\x99\xE7\x89\xE3"
+                         "\xF4\x10\xCC\x21\x99\xEB\xDC\x15"
+                         "\x19\x13\x93\x27\x9D\xB6\x6F\x45"
+                         "\x17\x55\x61\x72\xC8\xD3\x7F\xA5"
+                         "\x32\xD0\xD3\x02\x15\xA4\x05\x23"
+                         "\x9C\x23\x61\x60\x77\x7B\x6C\x95"
+                         "\x26\x49\x42\x2E\xF3\xC1\x8C\x6D"
+                         "\xC8\x47\xD5\x94\xE7\x53\xC8\x23"
+                         "\x1B\xA5\x0B\xCB\x12\xD3\x7A\x12"
+                         "\xA4\x42\x15\x34\xF7\x5F\xDC\x58"
+                         "\x5B\x58\x4C\xAD\xD1\x33\x8E\xE6"
+                         "\xE5\xA0\xDA\x4D\x94\x3D\x63\xA8"
+                         "\x02\x82\xBB\x16\xB8\xDC\xB5\x58"
+                         "\xC3\x2D\x79\xE4\x25\x79\x43\xF9"
+                         "\x6D\xD3\xCA\xC0\xE8\x12\xD4\x7E"
+                         "\x04\x25\x79\xFD\x27\xFB\xC4\xEA"
+                         "\x32\x94\x48\x92\xF3\x68\x1A\x7F"
+                         "\x36\x33\x43\x79\xF7\xCA\xC2\x38"
+                         "\xC0\x68\xD4\x53\xA9\xCC\x43\x0C"
+                         "\x40\x57\x3E\xED\x00\x9F\x22\x6E"
+                         "\x80\x99\x0B\xCC\x40\x63\x46\x8A"
+                         "\xE8\xC4\x9B\x6D\x7A\x08\x6E\xA9"
+                         "\x6F\x84\xBC\xB3\xF4\x95\x0B\x2D"
+                         "\x6A\xBA\x37\x50\xC3\xCF\x9F\x7C"
+                         "\x59\x5E\xDE\x0B\x30\xFA\x34\x8A"
+                         "\xF8\xD1\xA2\xF8\x4E\xBD\x5D\x5E"
+                         "\x7D\x71\x99\xE0\xF6\xE5\x7C\xE0"
+                         "\x6D\xEE\x82\x89\x92\xD4\xF5\xD7"
+                         "\xDF\x85\x2D\xE1\xB2\xD6\xAB\x94"
+                         "\xA5\xA6\xE7\xB0\x51\x36\x52\x37"
+                         "\x91\x45\x05\x3E\x58\xBF\x32",
+               .rlen   = 247,
+               .also_non_np = 1,
+               .np     = 2,
+               .tap    = { 247 - 8, 8 },
+       },
+};
+
+static struct cipher_testvec des_ctr_dec_tv_template[] = {
+       { /* Generated with Crypto++ */
+               .key    = "\xC9\x83\xA6\xC9\xEC\x0F\x32\x55",
+               .klen   = 8,
+               .iv     = "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFD",
+               .input  = "\x2F\x96\x06\x0F\x50\xC9\x68\x03"
+                         "\x0F\x31\xD4\x64\xA5\x29\x77\x35"
+                         "\xBC\x7A\x9F\x19\xE7\x0D\x33\x3E"
+                         "\x12\x0B\x8C\xAE\x48\xAE\xD9\x02"
+                         "\x0A\xD4\xB0\xD6\x37\xB2\x65\x1C"
+                         "\x4B\x65\xEB\x24\xB5\x8E\xAD\x47"
+                         "\x0D\xDA\x79\x77\xA0\x29\xA0\x2B"
+                         "\xC8\x0F\x85\xDC\x03\x13\xA9\x04"
+                         "\x19\x40\xBE\xBE\x5C\x49\x4A\x69"
+                         "\xED\xE8\xE1\x9E\x14\x43\x74\xDE"
+                         "\xEC\x6E\x11\x3F\x36\xEF\x7B\xFB"
+                         "\xBE\x4C\x91\x43\x22\x65\x72\x48"
+                         "\xE2\x12\xED\x88\xAC\xA7\xC9\x91"
+                         "\x14\xA2\x36\x1C\x29\xFF\xC8\x4F"
+                         "\x72\x5C\x4B\xB0\x1E\x93\xC2\xFA"
+                         "\x9D\x53\x86\xA0\xAE\xC6\xB7\x3C"
+                         "\x59\x0C\xD0\x8F\xA6\xD8\xA4\x31"
+                         "\xB7\x30\x1C\x21\x38\xFB\x68\x8C"
+                         "\x2E\xF5\x6E\x73\xC3\x16\x5F\x12"
+                         "\x0C\x33\xB9\x1E\x7B\x70\xDE\x86"
+                         "\x32\xB3\xC1\x16\xAB\xD9\x49\x0B"
+                         "\x96\x28\x72\x6B\xF3\x30\xA9\xEB"
+                         "\x69\xE2\x1E\x58\x46\xA2\x8E\xC7"
+                         "\xC0\xEF\x07\xB7\x77\x2C\x00\x05"
+                         "\x46\xBD\xFE\x53\x81\x8B\xA4\x03"
+                         "\x20\x0F\xDB\x78\x0B\x1F\x53\x04"
+                         "\x4C\x60\x4C\xC3\x2A\x86\x86\x7E"
+                         "\x13\xD2\x26\xED\x5D\x3E\x9C\xF2"
+                         "\x5C\xC4\x15\xC9\x9A\x21\xC5\xCD"
+                         "\x19\x7F\x99\x19\x53\xCE\x1D\x14"
+                         "\x69\x74\xA1\x06\x46\x0F\x4E\x75",
+               .ilen   = 248,
+               .result = "\x50\xB9\x22\xAE\x17\x80\x0C\x75"
+                         "\xDE\x47\xD3\x3C\xA5\x0E\x9A\x03"
+                         "\x6C\xF8\x61\xCA\x33\xBF\x28\x91"
+                         "\x1D\x86\xEF\x58\xE4\x4D\xB6\x1F"
+                         "\xAB\x14\x7D\x09\x72\xDB\x44\xD0"
+                         "\x39\xA2\x0B\x97\x00\x69\xF5\x5E"
+                         "\xC7\x30\xBC\x25\x8E\x1A\x83\xEC"
+                         "\x55\xE1\x4A\xB3\x1C\xA8\x11\x7A"
+                         "\x06\x6F\xD8\x41\xCD\x36\x9F\x08"
+                         "\x94\xFD\x66\xF2\x5B\xC4\x2D\xB9"
+                         "\x22\x8B\x17\x80\xE9\x52\xDE\x47"
+                         "\xB0\x19\xA5\x0E\x77\x03\x6C\xD5"
+                         "\x3E\xCA\x33\x9C\x05\x91\xFA\x63"
+                         "\xEF\x58\xC1\x2A\xB6\x1F\x88\x14"
+                         "\x7D\xE6\x4F\xDB\x44\xAD\x16\xA2"
+                         "\x0B\x74\x00\x69\xD2\x3B\xC7\x30"
+                         "\x99\x02\x8E\xF7\x60\xEC\x55\xBE"
+                         "\x27\xB3\x1C\x85\x11\x7A\xE3\x4C"
+                         "\xD8\x41\xAA\x13\x9F\x08\x71\xFD"
+                         "\x66\xCF\x38\xC4\x2D\x96\x22\x8B"
+                         "\xF4\x5D\xE9\x52\xBB\x24\xB0\x19"
+                         "\x82\x0E\x77\xE0\x49\xD5\x3E\xA7"
+                         "\x10\x9C\x05\x6E\xFA\x63\xCC\x35"
+                         "\xC1\x2A\x93\x1F\x88\xF1\x5A\xE6"
+                         "\x4F\xB8\x21\xAD\x16\x7F\x0B\x74"
+                         "\xDD\x46\xD2\x3B\xA4\x0D\x99\x02"
+                         "\x6B\xF7\x60\xC9\x32\xBE\x27\x90"
+                         "\x1C\x85\xEE\x57\xE3\x4C\xB5\x1E"
+                         "\xAA\x13\x7C\x08\x71\xDA\x43\xCF"
+                         "\x38\xA1\x0A\x96\xFF\x68\xF4\x5D"
+                         "\xC6\x2F\xBB\x24\x8D\x19\x82\xEB",
+               .rlen   = 248,
+               .also_non_np = 1,
+               .np     = 2,
+               .tap    = { 248 - 8, 8 },
+       }, { /* Generated with Crypto++ */
+               .key    = "\xC9\x83\xA6\xC9\xEC\x0F\x32\x55",
+               .klen   = 8,
+               .iv     = "\xE7\x82\x1D\xB8\x53\x11\xAC\x47",
+               .input  = "\x62\xE5\xF4\xDC\x99\xE7\x89\xE3"
+                         "\xF4\x10\xCC\x21\x99\xEB\xDC\x15"
+                         "\x19\x13\x93\x27\x9D\xB6\x6F\x45"
+                         "\x17\x55\x61\x72\xC8\xD3\x7F\xA5"
+                         "\x32\xD0\xD3\x02\x15\xA4\x05\x23"
+                         "\x9C\x23\x61\x60\x77\x7B\x6C\x95"
+                         "\x26\x49\x42\x2E\xF3\xC1\x8C\x6D"
+                         "\xC8\x47\xD5\x94\xE7\x53\xC8\x23"
+                         "\x1B\xA5\x0B\xCB\x12\xD3\x7A\x12"
+                         "\xA4\x42\x15\x34\xF7\x5F\xDC\x58"
+                         "\x5B\x58\x4C\xAD\xD1\x33\x8E\xE6"
+                         "\xE5\xA0\xDA\x4D\x94\x3D\x63\xA8"
+                         "\x02\x82\xBB\x16\xB8\xDC\xB5\x58"
+                         "\xC3\x2D\x79\xE4\x25\x79\x43\xF9"
+                         "\x6D\xD3\xCA\xC0\xE8\x12\xD4\x7E"
+                         "\x04\x25\x79\xFD\x27\xFB\xC4\xEA"
+                         "\x32\x94\x48\x92\xF3\x68\x1A\x7F"
+                         "\x36\x33\x43\x79\xF7\xCA\xC2\x38"
+                         "\xC0\x68\xD4\x53\xA9\xCC\x43\x0C"
+                         "\x40\x57\x3E\xED\x00\x9F\x22\x6E"
+                         "\x80\x99\x0B\xCC\x40\x63\x46\x8A"
+                         "\xE8\xC4\x9B\x6D\x7A\x08\x6E\xA9"
+                         "\x6F\x84\xBC\xB3\xF4\x95\x0B\x2D"
+                         "\x6A\xBA\x37\x50\xC3\xCF\x9F\x7C"
+                         "\x59\x5E\xDE\x0B\x30\xFA\x34\x8A"
+                         "\xF8\xD1\xA2\xF8\x4E\xBD\x5D\x5E"
+                         "\x7D\x71\x99\xE0\xF6\xE5\x7C\xE0"
+                         "\x6D\xEE\x82\x89\x92\xD4\xF5\xD7"
+                         "\xDF\x85\x2D\xE1\xB2\xD6\xAB\x94"
+                         "\xA5\xA6\xE7\xB0\x51\x36\x52\x37"
+                         "\x91\x45\x05\x3E\x58\xBF\x32",
+               .ilen   = 247,
+               .result = "\x50\xB9\x22\xAE\x17\x80\x0C\x75"
+                         "\xDE\x47\xD3\x3C\xA5\x0E\x9A\x03"
+                         "\x6C\xF8\x61\xCA\x33\xBF\x28\x91"
+                         "\x1D\x86\xEF\x58\xE4\x4D\xB6\x1F"
+                         "\xAB\x14\x7D\x09\x72\xDB\x44\xD0"
+                         "\x39\xA2\x0B\x97\x00\x69\xF5\x5E"
+                         "\xC7\x30\xBC\x25\x8E\x1A\x83\xEC"
+                         "\x55\xE1\x4A\xB3\x1C\xA8\x11\x7A"
+                         "\x06\x6F\xD8\x41\xCD\x36\x9F\x08"
+                         "\x94\xFD\x66\xF2\x5B\xC4\x2D\xB9"
+                         "\x22\x8B\x17\x80\xE9\x52\xDE\x47"
+                         "\xB0\x19\xA5\x0E\x77\x03\x6C\xD5"
+                         "\x3E\xCA\x33\x9C\x05\x91\xFA\x63"
+                         "\xEF\x58\xC1\x2A\xB6\x1F\x88\x14"
+                         "\x7D\xE6\x4F\xDB\x44\xAD\x16\xA2"
+                         "\x0B\x74\x00\x69\xD2\x3B\xC7\x30"
+                         "\x99\x02\x8E\xF7\x60\xEC\x55\xBE"
+                         "\x27\xB3\x1C\x85\x11\x7A\xE3\x4C"
+                         "\xD8\x41\xAA\x13\x9F\x08\x71\xFD"
+                         "\x66\xCF\x38\xC4\x2D\x96\x22\x8B"
+                         "\xF4\x5D\xE9\x52\xBB\x24\xB0\x19"
+                         "\x82\x0E\x77\xE0\x49\xD5\x3E\xA7"
+                         "\x10\x9C\x05\x6E\xFA\x63\xCC\x35"
+                         "\xC1\x2A\x93\x1F\x88\xF1\x5A\xE6"
+                         "\x4F\xB8\x21\xAD\x16\x7F\x0B\x74"
+                         "\xDD\x46\xD2\x3B\xA4\x0D\x99\x02"
+                         "\x6B\xF7\x60\xC9\x32\xBE\x27\x90"
+                         "\x1C\x85\xEE\x57\xE3\x4C\xB5\x1E"
+                         "\xAA\x13\x7C\x08\x71\xDA\x43\xCF"
+                         "\x38\xA1\x0A\x96\xFF\x68\xF4\x5D"
+                         "\xC6\x2F\xBB\x24\x8D\x19\x82",
+               .rlen   = 247,
+               .also_non_np = 1,
+               .np     = 2,
+               .tap    = { 247 - 8, 8 },
        },
 };