]> asedeno.scripts.mit.edu Git - linux.git/blobdiff - crypto/testmgr.h
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
[linux.git] / crypto / testmgr.h
index 6044f6906bd676b6e734d6e50a534cf88988e890..004c0a0f80040444172062ceb0a288b657e11953 100644 (file)
@@ -548,7 +548,7 @@ static const struct akcipher_testvec rsa_tv_template[] = {
 static const struct akcipher_testvec pkcs1pad_rsa_tv_template[] = {
        {
        .key =
-       "\x30\x82\x03\x1f\x02\x01\x10\x02\x82\x01\x01\x00\xd7\x1e\x77\x82"
+       "\x30\x82\x03\x1f\x02\x01\x00\x02\x82\x01\x01\x00\xd7\x1e\x77\x82"
        "\x8c\x92\x31\xe7\x69\x02\xa2\xd5\x5c\x78\xde\xa2\x0c\x8f\xfe\x28"
        "\x59\x31\xdf\x40\x9c\x60\x61\x06\xb9\x2f\x62\x40\x80\x76\xcb\x67"
        "\x4a\xb5\x59\x56\x69\x17\x07\xfa\xf9\x4c\xbd\x6c\x37\x7a\x46\x7d"
@@ -597,8 +597,8 @@ static const struct akcipher_testvec pkcs1pad_rsa_tv_template[] = {
        "\xfe\xf8\x27\x1b\xd6\x55\x60\x5e\x48\xb7\x6d\x9a\xa8\x37\xf9\x7a"
        "\xde\x1b\xcd\x5d\x1a\x30\xd4\xe9\x9e\x5b\x3c\x15\xf8\x9c\x1f\xda"
        "\xd1\x86\x48\x55\xce\x83\xee\x8e\x51\xc7\xde\x32\x12\x47\x7d\x46"
-       "\xb8\x35\xdf\x41\x02\x01\x30\x02\x01\x30\x02\x01\x30\x02\x01\x30"
-       "\x02\x01\x30",
+       "\xb8\x35\xdf\x41\x02\x01\x00\x02\x01\x00\x02\x01\x00\x02\x01\x00"
+       "\x02\x01\x00",
        .key_len = 804,
        /*
         * m is SHA256 hash of following message:
@@ -2044,263 +2044,522 @@ static const struct hash_testvec crct10dif_tv_template[] = {
                .digest         = (u8 *)(u16 []){ 0x44c6 },
                .np             = 4,
                .tap            = { 1, 255, 57, 6 },
-       }
-};
-
-/* Example vectors below taken from
- * http://www.oscca.gov.cn/UpFile/20101222141857786.pdf
- *
- * The rest taken from
- * https://github.com/adamws/oscca-sm3
- */
-static const struct hash_testvec sm3_tv_template[] = {
-       {
-               .plaintext = "",
-               .psize = 0,
-               .digest = (u8 *)(u8 []) {
-                       0x1A, 0xB2, 0x1D, 0x83, 0x55, 0xCF, 0xA1, 0x7F,
-                       0x8e, 0x61, 0x19, 0x48, 0x31, 0xE8, 0x1A, 0x8F,
-                       0x22, 0xBE, 0xC8, 0xC7, 0x28, 0xFE, 0xFB, 0x74,
-                       0x7E, 0xD0, 0x35, 0xEB, 0x50, 0x82, 0xAA, 0x2B }
-       }, {
-               .plaintext = "a",
-               .psize = 1,
-               .digest = (u8 *)(u8 []) {
-                       0x62, 0x34, 0x76, 0xAC, 0x18, 0xF6, 0x5A, 0x29,
-                       0x09, 0xE4, 0x3C, 0x7F, 0xEC, 0x61, 0xB4, 0x9C,
-                       0x7E, 0x76, 0x4A, 0x91, 0xA1, 0x8C, 0xCB, 0x82,
-                       0xF1, 0x91, 0x7A, 0x29, 0xC8, 0x6C, 0x5E, 0x88 }
-       }, {
-               /* A.1. Example 1 */
-               .plaintext = "abc",
-               .psize = 3,
-               .digest = (u8 *)(u8 []) {
-                       0x66, 0xC7, 0xF0, 0xF4, 0x62, 0xEE, 0xED, 0xD9,
-                       0xD1, 0xF2, 0xD4, 0x6B, 0xDC, 0x10, 0xE4, 0xE2,
-                       0x41, 0x67, 0xC4, 0x87, 0x5C, 0xF2, 0xF7, 0xA2,
-                       0x29, 0x7D, 0xA0, 0x2B, 0x8F, 0x4B, 0xA8, 0xE0 }
-       }, {
-               .plaintext = "abcdefghijklmnopqrstuvwxyz",
-               .psize = 26,
-               .digest = (u8 *)(u8 []) {
-                       0xB8, 0x0F, 0xE9, 0x7A, 0x4D, 0xA2, 0x4A, 0xFC,
-                       0x27, 0x75, 0x64, 0xF6, 0x6A, 0x35, 0x9E, 0xF4,
-                       0x40, 0x46, 0x2A, 0xD2, 0x8D, 0xCC, 0x6D, 0x63,
-                       0xAD, 0xB2, 0x4D, 0x5C, 0x20, 0xA6, 0x15, 0x95 }
-       }, {
-               /* A.1. Example 2 */
-               .plaintext = "abcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdab"
-                            "cdabcdabcdabcdabcd",
-               .psize = 64,
-               .digest = (u8 *)(u8 []) {
-                       0xDE, 0xBE, 0x9F, 0xF9, 0x22, 0x75, 0xB8, 0xA1,
-                       0x38, 0x60, 0x48, 0x89, 0xC1, 0x8E, 0x5A, 0x4D,
-                       0x6F, 0xDB, 0x70, 0xE5, 0x38, 0x7E, 0x57, 0x65,
-                       0x29, 0x3D, 0xCB, 0xA3, 0x9C, 0x0C, 0x57, 0x32 }
-       }, {
-               .plaintext = "abcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcd"
-                            "abcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcd"
-                            "abcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcd"
-                            "abcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcd"
-                            "abcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcd"
-                            "abcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcd"
-                            "abcdabcdabcdabcdabcdabcdabcdabcd",
-               .psize = 256,
-               .digest = (u8 *)(u8 []) {
-                       0xB9, 0x65, 0x76, 0x4C, 0x8B, 0xEB, 0xB0, 0x91,
-                       0xC7, 0x60, 0x2B, 0x74, 0xAF, 0xD3, 0x4E, 0xEF,
-                       0xB5, 0x31, 0xDC, 0xCB, 0x4E, 0x00, 0x76, 0xD9,
-                       0xB7, 0xCD, 0x81, 0x31, 0x99, 0xB4, 0x59, 0x71 }
-       }
-};
-
-/*
- * SHA1 test vectors  from from FIPS PUB 180-1
- * Long vector from CAVS 5.0
- */
-static const struct hash_testvec sha1_tv_template[] = {
-       {
-               .plaintext = "",
-               .psize  = 0,
-               .digest = "\xda\x39\xa3\xee\x5e\x6b\x4b\x0d\x32\x55"
-                         "\xbf\xef\x95\x60\x18\x90\xaf\xd8\x07\x09",
-       }, {
-               .plaintext = "abc",
-               .psize  = 3,
-               .digest = "\xa9\x99\x3e\x36\x47\x06\x81\x6a\xba\x3e"
-                         "\x25\x71\x78\x50\xc2\x6c\x9c\xd0\xd8\x9d",
-       }, {
-               .plaintext = "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq",
-               .psize  = 56,
-               .digest = "\x84\x98\x3e\x44\x1c\x3b\xd2\x6e\xba\xae"
-                         "\x4a\xa1\xf9\x51\x29\xe5\xe5\x46\x70\xf1",
-               .np     = 2,
-               .tap    = { 28, 28 }
-       }, {
-               .plaintext = "\xec\x29\x56\x12\x44\xed\xe7\x06"
-                            "\xb6\xeb\x30\xa1\xc3\x71\xd7\x44"
-                            "\x50\xa1\x05\xc3\xf9\x73\x5f\x7f"
-                            "\xa9\xfe\x38\xcf\x67\xf3\x04\xa5"
-                            "\x73\x6a\x10\x6e\x92\xe1\x71\x39"
-                            "\xa6\x81\x3b\x1c\x81\xa4\xf3\xd3"
-                            "\xfb\x95\x46\xab\x42\x96\xfa\x9f"
-                            "\x72\x28\x26\xc0\x66\x86\x9e\xda"
-                            "\xcd\x73\xb2\x54\x80\x35\x18\x58"
-                            "\x13\xe2\x26\x34\xa9\xda\x44\x00"
-                            "\x0d\x95\xa2\x81\xff\x9f\x26\x4e"
-                            "\xcc\xe0\xa9\x31\x22\x21\x62\xd0"
-                            "\x21\xcc\xa2\x8d\xb5\xf3\xc2\xaa"
-                            "\x24\x94\x5a\xb1\xe3\x1c\xb4\x13"
-                            "\xae\x29\x81\x0f\xd7\x94\xca\xd5"
-                            "\xdf\xaf\x29\xec\x43\xcb\x38\xd1"
-                            "\x98\xfe\x4a\xe1\xda\x23\x59\x78"
-                            "\x02\x21\x40\x5b\xd6\x71\x2a\x53"
-                            "\x05\xda\x4b\x1b\x73\x7f\xce\x7c"
-                            "\xd2\x1c\x0e\xb7\x72\x8d\x08\x23"
-                            "\x5a\x90\x11",
-               .psize  = 163,
-               .digest = "\x97\x01\x11\xc4\xe7\x7b\xcc\x88\xcc\x20"
-                         "\x45\x9c\x02\xb6\x9b\x4a\xa8\xf5\x82\x17",
-               .np     = 4,
-               .tap    = { 63, 64, 31, 5 }
-       }, {
-               .plaintext = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-",
-               .psize  = 64,
-               .digest = "\xc8\x71\xf6\x9a\x63\xcc\xa9\x84\x84\x82"
-                         "\x64\xe7\x79\x95\x5d\xd7\x19\x41\x7c\x91",
        }, {
-               .plaintext = "\x08\x9f\x13\xaa\x41\xd8\x4c\xe3"
-                            "\x7a\x11\x85\x1c\xb3\x27\xbe\x55"
-                            "\xec\x60\xf7\x8e\x02\x99\x30\xc7"
-                            "\x3b\xd2\x69\x00\x74\x0b\xa2\x16"
-                            "\xad\x44\xdb\x4f\xe6\x7d\x14\x88"
-                            "\x1f\xb6\x2a\xc1\x58\xef\x63\xfa"
-                            "\x91\x05\x9c\x33\xca\x3e\xd5\x6c"
-                            "\x03\x77\x0e\xa5\x19\xb0\x47\xde"
-                            "\x52\xe9\x80\x17\x8b\x22\xb9\x2d"
-                            "\xc4\x5b\xf2\x66\xfd\x94\x08\x9f"
-                            "\x36\xcd\x41\xd8\x6f\x06\x7a\x11"
-                            "\xa8\x1c\xb3\x4a\xe1\x55\xec\x83"
-                            "\x1a\x8e\x25\xbc\x30\xc7\x5e\xf5"
-                            "\x69\x00\x97\x0b\xa2\x39\xd0\x44"
-                            "\xdb\x72\x09\x7d\x14\xab\x1f\xb6"
-                            "\x4d\xe4\x58\xef\x86\x1d\x91\x28"
-                            "\xbf\x33\xca\x61\xf8\x6c\x03\x9a"
-                            "\x0e\xa5\x3c\xd3\x47\xde\x75\x0c"
-                            "\x80\x17\xae\x22\xb9\x50\xe7\x5b"
-                            "\xf2\x89\x20\x94\x2b\xc2\x36\xcd"
-                            "\x64\xfb\x6f\x06\x9d\x11\xa8\x3f"
-                            "\xd6\x4a\xe1\x78\x0f\x83\x1a\xb1"
-                            "\x25\xbc\x53\xea\x5e\xf5\x8c\x00"
-                            "\x97\x2e\xc5\x39\xd0\x67\xfe\x72"
-                            "\x09\xa0\x14\xab\x42\xd9\x4d\xe4"
-                            "\x7b\x12\x86\x1d\xb4\x28\xbf\x56"
-                            "\xed\x61\xf8\x8f\x03\x9a\x31\xc8"
-                            "\x3c\xd3\x6a\x01\x75\x0c\xa3\x17"
-                            "\xae\x45\xdc\x50\xe7\x7e\x15\x89"
-                            "\x20\xb7\x2b\xc2\x59\xf0\x64\xfb"
-                            "\x92\x06\x9d\x34\xcb\x3f\xd6\x6d"
-                            "\x04\x78\x0f\xa6\x1a\xb1\x48\xdf"
-                            "\x53\xea\x81\x18\x8c\x23\xba\x2e"
-                            "\xc5\x5c\xf3\x67\xfe\x95\x09\xa0"
-                            "\x37\xce\x42\xd9\x70\x07\x7b\x12"
-                            "\xa9\x1d\xb4\x4b\xe2\x56\xed\x84"
-                            "\x1b\x8f\x26\xbd\x31\xc8\x5f\xf6"
-                            "\x6a\x01\x98\x0c\xa3\x3a\xd1\x45"
-                            "\xdc\x73\x0a\x7e\x15\xac\x20\xb7"
-                            "\x4e\xe5\x59\xf0\x87\x1e\x92\x29"
-                            "\xc0\x34\xcb\x62\xf9\x6d\x04\x9b"
-                            "\x0f\xa6\x3d\xd4\x48\xdf\x76\x0d"
-                            "\x81\x18\xaf\x23\xba\x51\xe8\x5c"
-                            "\xf3\x8a\x21\x95\x2c\xc3\x37\xce"
-                            "\x65\xfc\x70\x07\x9e\x12\xa9\x40"
-                            "\xd7\x4b\xe2\x79\x10\x84\x1b\xb2"
-                            "\x26\xbd\x54\xeb\x5f\xf6\x8d\x01"
-                            "\x98\x2f\xc6\x3a\xd1\x68\xff\x73"
-                            "\x0a\xa1\x15\xac\x43\xda\x4e\xe5"
-                            "\x7c\x13\x87\x1e\xb5\x29\xc0\x57"
-                            "\xee\x62\xf9\x90\x04\x9b\x32\xc9"
-                            "\x3d\xd4\x6b\x02\x76\x0d\xa4\x18"
-                            "\xaf\x46\xdd\x51\xe8\x7f\x16\x8a"
-                            "\x21\xb8\x2c\xc3\x5a\xf1\x65\xfc"
-                            "\x93\x07\x9e\x35\xcc\x40\xd7\x6e"
-                            "\x05\x79\x10\xa7\x1b\xb2\x49\xe0"
-                            "\x54\xeb\x82\x19\x8d\x24\xbb\x2f"
-                            "\xc6\x5d\xf4\x68\xff\x96\x0a\xa1"
-                            "\x38\xcf\x43\xda\x71\x08\x7c\x13"
-                            "\xaa\x1e\xb5\x4c\xe3\x57\xee\x85"
-                            "\x1c\x90\x27\xbe\x32\xc9\x60\xf7"
-                            "\x6b\x02\x99\x0d\xa4\x3b\xd2\x46"
-                            "\xdd\x74\x0b\x7f\x16\xad\x21\xb8"
-                            "\x4f\xe6\x5a\xf1\x88\x1f\x93\x2a"
-                            "\xc1\x35\xcc\x63\xfa\x6e\x05\x9c"
-                            "\x10\xa7\x3e\xd5\x49\xe0\x77\x0e"
-                            "\x82\x19\xb0\x24\xbb\x52\xe9\x5d"
-                            "\xf4\x8b\x22\x96\x2d\xc4\x38\xcf"
-                            "\x66\xfd\x71\x08\x9f\x13\xaa\x41"
-                            "\xd8\x4c\xe3\x7a\x11\x85\x1c\xb3"
-                            "\x27\xbe\x55\xec\x60\xf7\x8e\x02"
-                            "\x99\x30\xc7\x3b\xd2\x69\x00\x74"
-                            "\x0b\xa2\x16\xad\x44\xdb\x4f\xe6"
-                            "\x7d\x14\x88\x1f\xb6\x2a\xc1\x58"
-                            "\xef\x63\xfa\x91\x05\x9c\x33\xca"
-                            "\x3e\xd5\x6c\x03\x77\x0e\xa5\x19"
-                            "\xb0\x47\xde\x52\xe9\x80\x17\x8b"
-                            "\x22\xb9\x2d\xc4\x5b\xf2\x66\xfd"
-                            "\x94\x08\x9f\x36\xcd\x41\xd8\x6f"
-                            "\x06\x7a\x11\xa8\x1c\xb3\x4a\xe1"
-                            "\x55\xec\x83\x1a\x8e\x25\xbc\x30"
-                            "\xc7\x5e\xf5\x69\x00\x97\x0b\xa2"
-                            "\x39\xd0\x44\xdb\x72\x09\x7d\x14"
-                            "\xab\x1f\xb6\x4d\xe4\x58\xef\x86"
-                            "\x1d\x91\x28\xbf\x33\xca\x61\xf8"
-                            "\x6c\x03\x9a\x0e\xa5\x3c\xd3\x47"
-                            "\xde\x75\x0c\x80\x17\xae\x22\xb9"
-                            "\x50\xe7\x5b\xf2\x89\x20\x94\x2b"
-                            "\xc2\x36\xcd\x64\xfb\x6f\x06\x9d"
-                            "\x11\xa8\x3f\xd6\x4a\xe1\x78\x0f"
-                            "\x83\x1a\xb1\x25\xbc\x53\xea\x5e"
-                            "\xf5\x8c\x00\x97\x2e\xc5\x39\xd0"
-                            "\x67\xfe\x72\x09\xa0\x14\xab\x42"
-                            "\xd9\x4d\xe4\x7b\x12\x86\x1d\xb4"
-                            "\x28\xbf\x56\xed\x61\xf8\x8f\x03"
-                            "\x9a\x31\xc8\x3c\xd3\x6a\x01\x75"
-                            "\x0c\xa3\x17\xae\x45\xdc\x50\xe7"
-                            "\x7e\x15\x89\x20\xb7\x2b\xc2\x59"
-                            "\xf0\x64\xfb\x92\x06\x9d\x34\xcb"
-                            "\x3f\xd6\x6d\x04\x78\x0f\xa6\x1a"
-                            "\xb1\x48\xdf\x53\xea\x81\x18\x8c"
-                            "\x23\xba\x2e\xc5\x5c\xf3\x67\xfe"
-                            "\x95\x09\xa0\x37\xce\x42\xd9\x70"
-                            "\x07\x7b\x12\xa9\x1d\xb4\x4b\xe2"
-                            "\x56\xed\x84\x1b\x8f\x26\xbd\x31"
-                            "\xc8\x5f\xf6\x6a\x01\x98\x0c\xa3"
-                            "\x3a\xd1\x45\xdc\x73\x0a\x7e\x15"
-                            "\xac\x20\xb7\x4e\xe5\x59\xf0\x87"
-                            "\x1e\x92\x29\xc0\x34\xcb\x62\xf9"
-                            "\x6d\x04\x9b\x0f\xa6\x3d\xd4\x48"
-                            "\xdf\x76\x0d\x81\x18\xaf\x23\xba"
-                            "\x51\xe8\x5c\xf3\x8a\x21\x95\x2c"
-                            "\xc3\x37\xce\x65\xfc\x70\x07\x9e"
-                            "\x12\xa9\x40\xd7\x4b\xe2\x79\x10"
-                            "\x84\x1b\xb2\x26\xbd\x54\xeb\x5f"
-                            "\xf6\x8d\x01\x98\x2f\xc6\x3a\xd1"
-                            "\x68\xff\x73\x0a\xa1\x15\xac\x43"
-                            "\xda\x4e\xe5\x7c\x13\x87\x1e\xb5"
-                            "\x29\xc0\x57\xee\x62\xf9\x90\x04"
-                            "\x9b\x32\xc9\x3d\xd4\x6b\x02\x76"
-                            "\x0d\xa4\x18\xaf\x46\xdd\x51\xe8"
-                            "\x7f\x16\x8a\x21\xb8\x2c\xc3\x5a"
-                            "\xf1\x65\xfc\x93\x07\x9e\x35\xcc"
-                            "\x40\xd7\x6e\x05\x79\x10\xa7\x1b"
-                            "\xb2\x49\xe0\x54\xeb\x82\x19\x8d"
-                            "\x24\xbb\x2f\xc6\x5d\xf4\x68\xff"
-                            "\x96\x0a\xa1\x38\xcf\x43\xda\x71"
-                            "\x08\x7c\x13\xaa\x1e\xb5\x4c",
-               .psize     = 1023,
-               .digest    = "\xb8\xe3\x54\xed\xc5\xfc\xef\xa4"
-                            "\x55\x73\x4a\x81\x99\xe4\x47\x2a"
-                            "\x30\xd6\xc9\x85",
+               .plaintext =    "\x6e\x05\x79\x10\xa7\x1b\xb2\x49"
+                               "\xe0\x54\xeb\x82\x19\x8d\x24\xbb"
+                               "\x2f\xc6\x5d\xf4\x68\xff\x96\x0a"
+                               "\xa1\x38\xcf\x43\xda\x71\x08\x7c"
+                               "\x13\xaa\x1e\xb5\x4c\xe3\x57\xee"
+                               "\x85\x1c\x90\x27\xbe\x32\xc9\x60"
+                               "\xf7\x6b\x02\x99\x0d\xa4\x3b\xd2"
+                               "\x46\xdd\x74\x0b\x7f\x16\xad\x21"
+                               "\xb8\x4f\xe6\x5a\xf1\x88\x1f\x93"
+                               "\x2a\xc1\x35\xcc\x63\xfa\x6e\x05"
+                               "\x9c\x10\xa7\x3e\xd5\x49\xe0\x77"
+                               "\x0e\x82\x19\xb0\x24\xbb\x52\xe9"
+                               "\x5d\xf4\x8b\x22\x96\x2d\xc4\x38"
+                               "\xcf\x66\xfd\x71\x08\x9f\x13\xaa"
+                               "\x41\xd8\x4c\xe3\x7a\x11\x85\x1c"
+                               "\xb3\x27\xbe\x55\xec\x60\xf7\x8e"
+                               "\x02\x99\x30\xc7\x3b\xd2\x69\x00"
+                               "\x74\x0b\xa2\x16\xad\x44\xdb\x4f"
+                               "\xe6\x7d\x14\x88\x1f\xb6\x2a\xc1"
+                               "\x58\xef\x63\xfa\x91\x05\x9c\x33"
+                               "\xca\x3e\xd5\x6c\x03\x77\x0e\xa5"
+                               "\x19\xb0\x47\xde\x52\xe9\x80\x17"
+                               "\x8b\x22\xb9\x2d\xc4\x5b\xf2\x66"
+                               "\xfd\x94\x08\x9f\x36\xcd\x41\xd8"
+                               "\x6f\x06\x7a\x11\xa8\x1c\xb3\x4a"
+                               "\xe1\x55\xec\x83\x1a\x8e\x25\xbc"
+                               "\x30\xc7\x5e\xf5\x69\x00\x97\x0b"
+                               "\xa2\x39\xd0\x44\xdb\x72\x09\x7d"
+                               "\x14\xab\x1f\xb6\x4d\xe4\x58\xef"
+                               "\x86\x1d\x91\x28\xbf\x33\xca\x61"
+                               "\xf8\x6c\x03\x9a\x0e\xa5\x3c\xd3"
+                               "\x47\xde\x75\x0c\x80\x17\xae\x22"
+                               "\xb9\x50\xe7\x5b\xf2\x89\x20\x94"
+                               "\x2b\xc2\x36\xcd\x64\xfb\x6f\x06"
+                               "\x9d\x11\xa8\x3f\xd6\x4a\xe1\x78"
+                               "\x0f\x83\x1a\xb1\x25\xbc\x53\xea"
+                               "\x5e\xf5\x8c\x00\x97\x2e\xc5\x39"
+                               "\xd0\x67\xfe\x72\x09\xa0\x14\xab"
+                               "\x42\xd9\x4d\xe4\x7b\x12\x86\x1d"
+                               "\xb4\x28\xbf\x56\xed\x61\xf8\x8f"
+                               "\x03\x9a\x31\xc8\x3c\xd3\x6a\x01"
+                               "\x75\x0c\xa3\x17\xae\x45\xdc\x50"
+                               "\xe7\x7e\x15\x89\x20\xb7\x2b\xc2"
+                               "\x59\xf0\x64\xfb\x92\x06\x9d\x34"
+                               "\xcb\x3f\xd6\x6d\x04\x78\x0f\xa6"
+                               "\x1a\xb1\x48\xdf\x53\xea\x81\x18"
+                               "\x8c\x23\xba\x2e\xc5\x5c\xf3\x67"
+                               "\xfe\x95\x09\xa0\x37\xce\x42\xd9"
+                               "\x70\x07\x7b\x12\xa9\x1d\xb4\x4b"
+                               "\xe2\x56\xed\x84\x1b\x8f\x26\xbd"
+                               "\x31\xc8\x5f\xf6\x6a\x01\x98\x0c"
+                               "\xa3\x3a\xd1\x45\xdc\x73\x0a\x7e"
+                               "\x15\xac\x20\xb7\x4e\xe5\x59\xf0"
+                               "\x87\x1e\x92\x29\xc0\x34\xcb\x62"
+                               "\xf9\x6d\x04\x9b\x0f\xa6\x3d\xd4"
+                               "\x48\xdf\x76\x0d\x81\x18\xaf\x23"
+                               "\xba\x51\xe8\x5c\xf3\x8a\x21\x95"
+                               "\x2c\xc3\x37\xce\x65\xfc\x70\x07"
+                               "\x9e\x12\xa9\x40\xd7\x4b\xe2\x79"
+                               "\x10\x84\x1b\xb2\x26\xbd\x54\xeb"
+                               "\x5f\xf6\x8d\x01\x98\x2f\xc6\x3a"
+                               "\xd1\x68\xff\x73\x0a\xa1\x15\xac"
+                               "\x43\xda\x4e\xe5\x7c\x13\x87\x1e"
+                               "\xb5\x29\xc0\x57\xee\x62\xf9\x90"
+                               "\x04\x9b\x32\xc9\x3d\xd4\x6b\x02"
+                               "\x76\x0d\xa4\x18\xaf\x46\xdd\x51"
+                               "\xe8\x7f\x16\x8a\x21\xb8\x2c\xc3"
+                               "\x5a\xf1\x65\xfc\x93\x07\x9e\x35"
+                               "\xcc\x40\xd7\x6e\x05\x79\x10\xa7"
+                               "\x1b\xb2\x49\xe0\x54\xeb\x82\x19"
+                               "\x8d\x24\xbb\x2f\xc6\x5d\xf4\x68"
+                               "\xff\x96\x0a\xa1\x38\xcf\x43\xda"
+                               "\x71\x08\x7c\x13\xaa\x1e\xb5\x4c"
+                               "\xe3\x57\xee\x85\x1c\x90\x27\xbe"
+                               "\x32\xc9\x60\xf7\x6b\x02\x99\x0d"
+                               "\xa4\x3b\xd2\x46\xdd\x74\x0b\x7f"
+                               "\x16\xad\x21\xb8\x4f\xe6\x5a\xf1"
+                               "\x88\x1f\x93\x2a\xc1\x35\xcc\x63"
+                               "\xfa\x6e\x05\x9c\x10\xa7\x3e\xd5"
+                               "\x49\xe0\x77\x0e\x82\x19\xb0\x24"
+                               "\xbb\x52\xe9\x5d\xf4\x8b\x22\x96"
+                               "\x2d\xc4\x38\xcf\x66\xfd\x71\x08"
+                               "\x9f\x13\xaa\x41\xd8\x4c\xe3\x7a"
+                               "\x11\x85\x1c\xb3\x27\xbe\x55\xec"
+                               "\x60\xf7\x8e\x02\x99\x30\xc7\x3b"
+                               "\xd2\x69\x00\x74\x0b\xa2\x16\xad"
+                               "\x44\xdb\x4f\xe6\x7d\x14\x88\x1f"
+                               "\xb6\x2a\xc1\x58\xef\x63\xfa\x91"
+                               "\x05\x9c\x33\xca\x3e\xd5\x6c\x03"
+                               "\x77\x0e\xa5\x19\xb0\x47\xde\x52"
+                               "\xe9\x80\x17\x8b\x22\xb9\x2d\xc4"
+                               "\x5b\xf2\x66\xfd\x94\x08\x9f\x36"
+                               "\xcd\x41\xd8\x6f\x06\x7a\x11\xa8"
+                               "\x1c\xb3\x4a\xe1\x55\xec\x83\x1a"
+                               "\x8e\x25\xbc\x30\xc7\x5e\xf5\x69"
+                               "\x00\x97\x0b\xa2\x39\xd0\x44\xdb"
+                               "\x72\x09\x7d\x14\xab\x1f\xb6\x4d"
+                               "\xe4\x58\xef\x86\x1d\x91\x28\xbf"
+                               "\x33\xca\x61\xf8\x6c\x03\x9a\x0e"
+                               "\xa5\x3c\xd3\x47\xde\x75\x0c\x80"
+                               "\x17\xae\x22\xb9\x50\xe7\x5b\xf2"
+                               "\x89\x20\x94\x2b\xc2\x36\xcd\x64"
+                               "\xfb\x6f\x06\x9d\x11\xa8\x3f\xd6"
+                               "\x4a\xe1\x78\x0f\x83\x1a\xb1\x25"
+                               "\xbc\x53\xea\x5e\xf5\x8c\x00\x97"
+                               "\x2e\xc5\x39\xd0\x67\xfe\x72\x09"
+                               "\xa0\x14\xab\x42\xd9\x4d\xe4\x7b"
+                               "\x12\x86\x1d\xb4\x28\xbf\x56\xed"
+                               "\x61\xf8\x8f\x03\x9a\x31\xc8\x3c"
+                               "\xd3\x6a\x01\x75\x0c\xa3\x17\xae"
+                               "\x45\xdc\x50\xe7\x7e\x15\x89\x20"
+                               "\xb7\x2b\xc2\x59\xf0\x64\xfb\x92"
+                               "\x06\x9d\x34\xcb\x3f\xd6\x6d\x04"
+                               "\x78\x0f\xa6\x1a\xb1\x48\xdf\x53"
+                               "\xea\x81\x18\x8c\x23\xba\x2e\xc5"
+                               "\x5c\xf3\x67\xfe\x95\x09\xa0\x37"
+                               "\xce\x42\xd9\x70\x07\x7b\x12\xa9"
+                               "\x1d\xb4\x4b\xe2\x56\xed\x84\x1b"
+                               "\x8f\x26\xbd\x31\xc8\x5f\xf6\x6a"
+                               "\x01\x98\x0c\xa3\x3a\xd1\x45\xdc"
+                               "\x73\x0a\x7e\x15\xac\x20\xb7\x4e"
+                               "\xe5\x59\xf0\x87\x1e\x92\x29\xc0"
+                               "\x34\xcb\x62\xf9\x6d\x04\x9b\x0f"
+                               "\xa6\x3d\xd4\x48\xdf\x76\x0d\x81"
+                               "\x18\xaf\x23\xba\x51\xe8\x5c\xf3"
+                               "\x8a\x21\x95\x2c\xc3\x37\xce\x65"
+                               "\xfc\x70\x07\x9e\x12\xa9\x40\xd7"
+                               "\x4b\xe2\x79\x10\x84\x1b\xb2\x26"
+                               "\xbd\x54\xeb\x5f\xf6\x8d\x01\x98"
+                               "\x2f\xc6\x3a\xd1\x68\xff\x73\x0a"
+                               "\xa1\x15\xac\x43\xda\x4e\xe5\x7c"
+                               "\x13\x87\x1e\xb5\x29\xc0\x57\xee"
+                               "\x62\xf9\x90\x04\x9b\x32\xc9\x3d"
+                               "\xd4\x6b\x02\x76\x0d\xa4\x18\xaf"
+                               "\x46\xdd\x51\xe8\x7f\x16\x8a\x21"
+                               "\xb8\x2c\xc3\x5a\xf1\x65\xfc\x93"
+                               "\x07\x9e\x35\xcc\x40\xd7\x6e\x05"
+                               "\x79\x10\xa7\x1b\xb2\x49\xe0\x54"
+                               "\xeb\x82\x19\x8d\x24\xbb\x2f\xc6"
+                               "\x5d\xf4\x68\xff\x96\x0a\xa1\x38"
+                               "\xcf\x43\xda\x71\x08\x7c\x13\xaa"
+                               "\x1e\xb5\x4c\xe3\x57\xee\x85\x1c"
+                               "\x90\x27\xbe\x32\xc9\x60\xf7\x6b"
+                               "\x02\x99\x0d\xa4\x3b\xd2\x46\xdd"
+                               "\x74\x0b\x7f\x16\xad\x21\xb8\x4f"
+                               "\xe6\x5a\xf1\x88\x1f\x93\x2a\xc1"
+                               "\x35\xcc\x63\xfa\x6e\x05\x9c\x10"
+                               "\xa7\x3e\xd5\x49\xe0\x77\x0e\x82"
+                               "\x19\xb0\x24\xbb\x52\xe9\x5d\xf4"
+                               "\x8b\x22\x96\x2d\xc4\x38\xcf\x66"
+                               "\xfd\x71\x08\x9f\x13\xaa\x41\xd8"
+                               "\x4c\xe3\x7a\x11\x85\x1c\xb3\x27"
+                               "\xbe\x55\xec\x60\xf7\x8e\x02\x99"
+                               "\x30\xc7\x3b\xd2\x69\x00\x74\x0b"
+                               "\xa2\x16\xad\x44\xdb\x4f\xe6\x7d"
+                               "\x14\x88\x1f\xb6\x2a\xc1\x58\xef"
+                               "\x63\xfa\x91\x05\x9c\x33\xca\x3e"
+                               "\xd5\x6c\x03\x77\x0e\xa5\x19\xb0"
+                               "\x47\xde\x52\xe9\x80\x17\x8b\x22"
+                               "\xb9\x2d\xc4\x5b\xf2\x66\xfd\x94"
+                               "\x08\x9f\x36\xcd\x41\xd8\x6f\x06"
+                               "\x7a\x11\xa8\x1c\xb3\x4a\xe1\x55"
+                               "\xec\x83\x1a\x8e\x25\xbc\x30\xc7"
+                               "\x5e\xf5\x69\x00\x97\x0b\xa2\x39"
+                               "\xd0\x44\xdb\x72\x09\x7d\x14\xab"
+                               "\x1f\xb6\x4d\xe4\x58\xef\x86\x1d"
+                               "\x91\x28\xbf\x33\xca\x61\xf8\x6c"
+                               "\x03\x9a\x0e\xa5\x3c\xd3\x47\xde"
+                               "\x75\x0c\x80\x17\xae\x22\xb9\x50"
+                               "\xe7\x5b\xf2\x89\x20\x94\x2b\xc2"
+                               "\x36\xcd\x64\xfb\x6f\x06\x9d\x11"
+                               "\xa8\x3f\xd6\x4a\xe1\x78\x0f\x83"
+                               "\x1a\xb1\x25\xbc\x53\xea\x5e\xf5"
+                               "\x8c\x00\x97\x2e\xc5\x39\xd0\x67"
+                               "\xfe\x72\x09\xa0\x14\xab\x42\xd9"
+                               "\x4d\xe4\x7b\x12\x86\x1d\xb4\x28"
+                               "\xbf\x56\xed\x61\xf8\x8f\x03\x9a"
+                               "\x31\xc8\x3c\xd3\x6a\x01\x75\x0c"
+                               "\xa3\x17\xae\x45\xdc\x50\xe7\x7e"
+                               "\x15\x89\x20\xb7\x2b\xc2\x59\xf0"
+                               "\x64\xfb\x92\x06\x9d\x34\xcb\x3f"
+                               "\xd6\x6d\x04\x78\x0f\xa6\x1a\xb1"
+                               "\x48\xdf\x53\xea\x81\x18\x8c\x23"
+                               "\xba\x2e\xc5\x5c\xf3\x67\xfe\x95"
+                               "\x09\xa0\x37\xce\x42\xd9\x70\x07"
+                               "\x7b\x12\xa9\x1d\xb4\x4b\xe2\x56"
+                               "\xed\x84\x1b\x8f\x26\xbd\x31\xc8"
+                               "\x5f\xf6\x6a\x01\x98\x0c\xa3\x3a"
+                               "\xd1\x45\xdc\x73\x0a\x7e\x15\xac"
+                               "\x20\xb7\x4e\xe5\x59\xf0\x87\x1e"
+                               "\x92\x29\xc0\x34\xcb\x62\xf9\x6d"
+                               "\x04\x9b\x0f\xa6\x3d\xd4\x48\xdf"
+                               "\x76\x0d\x81\x18\xaf\x23\xba\x51"
+                               "\xe8\x5c\xf3\x8a\x21\x95\x2c\xc3"
+                               "\x37\xce\x65\xfc\x70\x07\x9e\x12"
+                               "\xa9\x40\xd7\x4b\xe2\x79\x10\x84"
+                               "\x1b\xb2\x26\xbd\x54\xeb\x5f\xf6"
+                               "\x8d\x01\x98\x2f\xc6\x3a\xd1\x68"
+                               "\xff\x73\x0a\xa1\x15\xac\x43\xda"
+                               "\x4e\xe5\x7c\x13\x87\x1e\xb5\x29"
+                               "\xc0\x57\xee\x62\xf9\x90\x04\x9b"
+                               "\x32\xc9\x3d\xd4\x6b\x02\x76\x0d"
+                               "\xa4\x18\xaf\x46\xdd\x51\xe8\x7f"
+                               "\x16\x8a\x21\xb8\x2c\xc3\x5a\xf1"
+                               "\x65\xfc\x93\x07\x9e\x35\xcc\x40"
+                               "\xd7\x6e\x05\x79\x10\xa7\x1b\xb2"
+                               "\x49\xe0\x54\xeb\x82\x19\x8d\x24"
+                               "\xbb\x2f\xc6\x5d\xf4\x68\xff\x96"
+                               "\x0a\xa1\x38\xcf\x43\xda\x71\x08"
+                               "\x7c\x13\xaa\x1e\xb5\x4c\xe3\x57"
+                               "\xee\x85\x1c\x90\x27\xbe\x32\xc9"
+                               "\x60\xf7\x6b\x02\x99\x0d\xa4\x3b"
+                               "\xd2\x46\xdd\x74\x0b\x7f\x16\xad"
+                               "\x21\xb8\x4f\xe6\x5a\xf1\x88\x1f"
+                               "\x93\x2a\xc1\x35\xcc\x63\xfa\x6e"
+                               "\x05\x9c\x10\xa7\x3e\xd5\x49\xe0"
+                               "\x77\x0e\x82\x19\xb0\x24\xbb\x52"
+                               "\xe9\x5d\xf4\x8b\x22\x96\x2d\xc4"
+                               "\x38\xcf\x66\xfd\x71\x08\x9f\x13"
+                               "\xaa\x41\xd8\x4c\xe3\x7a\x11\x85"
+                               "\x1c\xb3\x27\xbe\x55\xec\x60\xf7"
+                               "\x8e\x02\x99\x30\xc7\x3b\xd2\x69"
+                               "\x00\x74\x0b\xa2\x16\xad\x44\xdb"
+                               "\x4f\xe6\x7d\x14\x88\x1f\xb6\x2a"
+                               "\xc1\x58\xef\x63\xfa\x91\x05\x9c"
+                               "\x33\xca\x3e\xd5\x6c\x03\x77\x0e"
+                               "\xa5\x19\xb0\x47\xde\x52\xe9\x80"
+                               "\x17\x8b\x22\xb9\x2d\xc4\x5b\xf2"
+                               "\x66\xfd\x94\x08\x9f\x36\xcd\x41"
+                               "\xd8\x6f\x06\x7a\x11\xa8\x1c\xb3"
+                               "\x4a\xe1\x55\xec\x83\x1a\x8e\x25"
+                               "\xbc\x30\xc7\x5e\xf5\x69\x00\x97"
+                               "\x0b\xa2\x39\xd0\x44\xdb\x72\x09"
+                               "\x7d\x14\xab\x1f\xb6\x4d\xe4\x58"
+                               "\xef\x86\x1d\x91\x28\xbf\x33\xca"
+                               "\x61\xf8\x6c\x03\x9a\x0e\xa5\x3c"
+                               "\xd3\x47\xde\x75\x0c\x80\x17\xae"
+                               "\x22\xb9\x50\xe7\x5b\xf2\x89\x20"
+                               "\x94\x2b\xc2\x36\xcd\x64\xfb\x6f"
+                               "\x06\x9d\x11\xa8\x3f\xd6\x4a\xe1"
+                               "\x78\x0f\x83\x1a\xb1\x25\xbc\x53"
+                               "\xea\x5e\xf5\x8c\x00\x97\x2e\xc5"
+                               "\x39\xd0\x67\xfe\x72\x09\xa0\x14"
+                               "\xab\x42\xd9\x4d\xe4\x7b\x12\x86"
+                               "\x1d\xb4\x28\xbf\x56\xed\x61\xf8"
+                               "\x8f\x03\x9a\x31\xc8\x3c\xd3\x6a"
+                               "\x01\x75\x0c\xa3\x17\xae\x45\xdc"
+                               "\x50\xe7\x7e\x15\x89\x20\xb7\x2b"
+                               "\xc2\x59\xf0\x64\xfb\x92\x06\x9d"
+                               "\x34\xcb\x3f\xd6\x6d\x04\x78\x0f"
+                               "\xa6\x1a\xb1\x48\xdf\x53\xea\x81"
+                               "\x18\x8c\x23\xba\x2e\xc5\x5c\xf3"
+                               "\x67\xfe\x95\x09\xa0\x37\xce\x42"
+                               "\xd9\x70\x07\x7b\x12\xa9\x1d\xb4"
+                               "\x4b\xe2\x56\xed\x84\x1b\x8f\x26"
+                               "\xbd\x31\xc8\x5f\xf6\x6a\x01\x98",
+               .psize = 2048,
+               .digest         = (u8 *)(u16 []){ 0x23ca },
+       }
+};
+
+/* Example vectors below taken from
+ * http://www.oscca.gov.cn/UpFile/20101222141857786.pdf
+ *
+ * The rest taken from
+ * https://github.com/adamws/oscca-sm3
+ */
+static const struct hash_testvec sm3_tv_template[] = {
+       {
+               .plaintext = "",
+               .psize = 0,
+               .digest = (u8 *)(u8 []) {
+                       0x1A, 0xB2, 0x1D, 0x83, 0x55, 0xCF, 0xA1, 0x7F,
+                       0x8e, 0x61, 0x19, 0x48, 0x31, 0xE8, 0x1A, 0x8F,
+                       0x22, 0xBE, 0xC8, 0xC7, 0x28, 0xFE, 0xFB, 0x74,
+                       0x7E, 0xD0, 0x35, 0xEB, 0x50, 0x82, 0xAA, 0x2B }
+       }, {
+               .plaintext = "a",
+               .psize = 1,
+               .digest = (u8 *)(u8 []) {
+                       0x62, 0x34, 0x76, 0xAC, 0x18, 0xF6, 0x5A, 0x29,
+                       0x09, 0xE4, 0x3C, 0x7F, 0xEC, 0x61, 0xB4, 0x9C,
+                       0x7E, 0x76, 0x4A, 0x91, 0xA1, 0x8C, 0xCB, 0x82,
+                       0xF1, 0x91, 0x7A, 0x29, 0xC8, 0x6C, 0x5E, 0x88 }
+       }, {
+               /* A.1. Example 1 */
+               .plaintext = "abc",
+               .psize = 3,
+               .digest = (u8 *)(u8 []) {
+                       0x66, 0xC7, 0xF0, 0xF4, 0x62, 0xEE, 0xED, 0xD9,
+                       0xD1, 0xF2, 0xD4, 0x6B, 0xDC, 0x10, 0xE4, 0xE2,
+                       0x41, 0x67, 0xC4, 0x87, 0x5C, 0xF2, 0xF7, 0xA2,
+                       0x29, 0x7D, 0xA0, 0x2B, 0x8F, 0x4B, 0xA8, 0xE0 }
+       }, {
+               .plaintext = "abcdefghijklmnopqrstuvwxyz",
+               .psize = 26,
+               .digest = (u8 *)(u8 []) {
+                       0xB8, 0x0F, 0xE9, 0x7A, 0x4D, 0xA2, 0x4A, 0xFC,
+                       0x27, 0x75, 0x64, 0xF6, 0x6A, 0x35, 0x9E, 0xF4,
+                       0x40, 0x46, 0x2A, 0xD2, 0x8D, 0xCC, 0x6D, 0x63,
+                       0xAD, 0xB2, 0x4D, 0x5C, 0x20, 0xA6, 0x15, 0x95 }
+       }, {
+               /* A.1. Example 2 */
+               .plaintext = "abcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdab"
+                            "cdabcdabcdabcdabcd",
+               .psize = 64,
+               .digest = (u8 *)(u8 []) {
+                       0xDE, 0xBE, 0x9F, 0xF9, 0x22, 0x75, 0xB8, 0xA1,
+                       0x38, 0x60, 0x48, 0x89, 0xC1, 0x8E, 0x5A, 0x4D,
+                       0x6F, 0xDB, 0x70, 0xE5, 0x38, 0x7E, 0x57, 0x65,
+                       0x29, 0x3D, 0xCB, 0xA3, 0x9C, 0x0C, 0x57, 0x32 }
+       }, {
+               .plaintext = "abcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcd"
+                            "abcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcd"
+                            "abcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcd"
+                            "abcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcd"
+                            "abcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcd"
+                            "abcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcd"
+                            "abcdabcdabcdabcdabcdabcdabcdabcd",
+               .psize = 256,
+               .digest = (u8 *)(u8 []) {
+                       0xB9, 0x65, 0x76, 0x4C, 0x8B, 0xEB, 0xB0, 0x91,
+                       0xC7, 0x60, 0x2B, 0x74, 0xAF, 0xD3, 0x4E, 0xEF,
+                       0xB5, 0x31, 0xDC, 0xCB, 0x4E, 0x00, 0x76, 0xD9,
+                       0xB7, 0xCD, 0x81, 0x31, 0x99, 0xB4, 0x59, 0x71 }
+       }
+};
+
+/*
+ * SHA1 test vectors  from from FIPS PUB 180-1
+ * Long vector from CAVS 5.0
+ */
+static const struct hash_testvec sha1_tv_template[] = {
+       {
+               .plaintext = "",
+               .psize  = 0,
+               .digest = "\xda\x39\xa3\xee\x5e\x6b\x4b\x0d\x32\x55"
+                         "\xbf\xef\x95\x60\x18\x90\xaf\xd8\x07\x09",
+       }, {
+               .plaintext = "abc",
+               .psize  = 3,
+               .digest = "\xa9\x99\x3e\x36\x47\x06\x81\x6a\xba\x3e"
+                         "\x25\x71\x78\x50\xc2\x6c\x9c\xd0\xd8\x9d",
+       }, {
+               .plaintext = "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq",
+               .psize  = 56,
+               .digest = "\x84\x98\x3e\x44\x1c\x3b\xd2\x6e\xba\xae"
+                         "\x4a\xa1\xf9\x51\x29\xe5\xe5\x46\x70\xf1",
+               .np     = 2,
+               .tap    = { 28, 28 }
+       }, {
+               .plaintext = "\xec\x29\x56\x12\x44\xed\xe7\x06"
+                            "\xb6\xeb\x30\xa1\xc3\x71\xd7\x44"
+                            "\x50\xa1\x05\xc3\xf9\x73\x5f\x7f"
+                            "\xa9\xfe\x38\xcf\x67\xf3\x04\xa5"
+                            "\x73\x6a\x10\x6e\x92\xe1\x71\x39"
+                            "\xa6\x81\x3b\x1c\x81\xa4\xf3\xd3"
+                            "\xfb\x95\x46\xab\x42\x96\xfa\x9f"
+                            "\x72\x28\x26\xc0\x66\x86\x9e\xda"
+                            "\xcd\x73\xb2\x54\x80\x35\x18\x58"
+                            "\x13\xe2\x26\x34\xa9\xda\x44\x00"
+                            "\x0d\x95\xa2\x81\xff\x9f\x26\x4e"
+                            "\xcc\xe0\xa9\x31\x22\x21\x62\xd0"
+                            "\x21\xcc\xa2\x8d\xb5\xf3\xc2\xaa"
+                            "\x24\x94\x5a\xb1\xe3\x1c\xb4\x13"
+                            "\xae\x29\x81\x0f\xd7\x94\xca\xd5"
+                            "\xdf\xaf\x29\xec\x43\xcb\x38\xd1"
+                            "\x98\xfe\x4a\xe1\xda\x23\x59\x78"
+                            "\x02\x21\x40\x5b\xd6\x71\x2a\x53"
+                            "\x05\xda\x4b\x1b\x73\x7f\xce\x7c"
+                            "\xd2\x1c\x0e\xb7\x72\x8d\x08\x23"
+                            "\x5a\x90\x11",
+               .psize  = 163,
+               .digest = "\x97\x01\x11\xc4\xe7\x7b\xcc\x88\xcc\x20"
+                         "\x45\x9c\x02\xb6\x9b\x4a\xa8\xf5\x82\x17",
+               .np     = 4,
+               .tap    = { 63, 64, 31, 5 }
+       }, {
+               .plaintext = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-",
+               .psize  = 64,
+               .digest = "\xc8\x71\xf6\x9a\x63\xcc\xa9\x84\x84\x82"
+                         "\x64\xe7\x79\x95\x5d\xd7\x19\x41\x7c\x91",
+       }, {
+               .plaintext = "\x08\x9f\x13\xaa\x41\xd8\x4c\xe3"
+                            "\x7a\x11\x85\x1c\xb3\x27\xbe\x55"
+                            "\xec\x60\xf7\x8e\x02\x99\x30\xc7"
+                            "\x3b\xd2\x69\x00\x74\x0b\xa2\x16"
+                            "\xad\x44\xdb\x4f\xe6\x7d\x14\x88"
+                            "\x1f\xb6\x2a\xc1\x58\xef\x63\xfa"
+                            "\x91\x05\x9c\x33\xca\x3e\xd5\x6c"
+                            "\x03\x77\x0e\xa5\x19\xb0\x47\xde"
+                            "\x52\xe9\x80\x17\x8b\x22\xb9\x2d"
+                            "\xc4\x5b\xf2\x66\xfd\x94\x08\x9f"
+                            "\x36\xcd\x41\xd8\x6f\x06\x7a\x11"
+                            "\xa8\x1c\xb3\x4a\xe1\x55\xec\x83"
+                            "\x1a\x8e\x25\xbc\x30\xc7\x5e\xf5"
+                            "\x69\x00\x97\x0b\xa2\x39\xd0\x44"
+                            "\xdb\x72\x09\x7d\x14\xab\x1f\xb6"
+                            "\x4d\xe4\x58\xef\x86\x1d\x91\x28"
+                            "\xbf\x33\xca\x61\xf8\x6c\x03\x9a"
+                            "\x0e\xa5\x3c\xd3\x47\xde\x75\x0c"
+                            "\x80\x17\xae\x22\xb9\x50\xe7\x5b"
+                            "\xf2\x89\x20\x94\x2b\xc2\x36\xcd"
+                            "\x64\xfb\x6f\x06\x9d\x11\xa8\x3f"
+                            "\xd6\x4a\xe1\x78\x0f\x83\x1a\xb1"
+                            "\x25\xbc\x53\xea\x5e\xf5\x8c\x00"
+                            "\x97\x2e\xc5\x39\xd0\x67\xfe\x72"
+                            "\x09\xa0\x14\xab\x42\xd9\x4d\xe4"
+                            "\x7b\x12\x86\x1d\xb4\x28\xbf\x56"
+                            "\xed\x61\xf8\x8f\x03\x9a\x31\xc8"
+                            "\x3c\xd3\x6a\x01\x75\x0c\xa3\x17"
+                            "\xae\x45\xdc\x50\xe7\x7e\x15\x89"
+                            "\x20\xb7\x2b\xc2\x59\xf0\x64\xfb"
+                            "\x92\x06\x9d\x34\xcb\x3f\xd6\x6d"
+                            "\x04\x78\x0f\xa6\x1a\xb1\x48\xdf"
+                            "\x53\xea\x81\x18\x8c\x23\xba\x2e"
+                            "\xc5\x5c\xf3\x67\xfe\x95\x09\xa0"
+                            "\x37\xce\x42\xd9\x70\x07\x7b\x12"
+                            "\xa9\x1d\xb4\x4b\xe2\x56\xed\x84"
+                            "\x1b\x8f\x26\xbd\x31\xc8\x5f\xf6"
+                            "\x6a\x01\x98\x0c\xa3\x3a\xd1\x45"
+                            "\xdc\x73\x0a\x7e\x15\xac\x20\xb7"
+                            "\x4e\xe5\x59\xf0\x87\x1e\x92\x29"
+                            "\xc0\x34\xcb\x62\xf9\x6d\x04\x9b"
+                            "\x0f\xa6\x3d\xd4\x48\xdf\x76\x0d"
+                            "\x81\x18\xaf\x23\xba\x51\xe8\x5c"
+                            "\xf3\x8a\x21\x95\x2c\xc3\x37\xce"
+                            "\x65\xfc\x70\x07\x9e\x12\xa9\x40"
+                            "\xd7\x4b\xe2\x79\x10\x84\x1b\xb2"
+                            "\x26\xbd\x54\xeb\x5f\xf6\x8d\x01"
+                            "\x98\x2f\xc6\x3a\xd1\x68\xff\x73"
+                            "\x0a\xa1\x15\xac\x43\xda\x4e\xe5"
+                            "\x7c\x13\x87\x1e\xb5\x29\xc0\x57"
+                            "\xee\x62\xf9\x90\x04\x9b\x32\xc9"
+                            "\x3d\xd4\x6b\x02\x76\x0d\xa4\x18"
+                            "\xaf\x46\xdd\x51\xe8\x7f\x16\x8a"
+                            "\x21\xb8\x2c\xc3\x5a\xf1\x65\xfc"
+                            "\x93\x07\x9e\x35\xcc\x40\xd7\x6e"
+                            "\x05\x79\x10\xa7\x1b\xb2\x49\xe0"
+                            "\x54\xeb\x82\x19\x8d\x24\xbb\x2f"
+                            "\xc6\x5d\xf4\x68\xff\x96\x0a\xa1"
+                            "\x38\xcf\x43\xda\x71\x08\x7c\x13"
+                            "\xaa\x1e\xb5\x4c\xe3\x57\xee\x85"
+                            "\x1c\x90\x27\xbe\x32\xc9\x60\xf7"
+                            "\x6b\x02\x99\x0d\xa4\x3b\xd2\x46"
+                            "\xdd\x74\x0b\x7f\x16\xad\x21\xb8"
+                            "\x4f\xe6\x5a\xf1\x88\x1f\x93\x2a"
+                            "\xc1\x35\xcc\x63\xfa\x6e\x05\x9c"
+                            "\x10\xa7\x3e\xd5\x49\xe0\x77\x0e"
+                            "\x82\x19\xb0\x24\xbb\x52\xe9\x5d"
+                            "\xf4\x8b\x22\x96\x2d\xc4\x38\xcf"
+                            "\x66\xfd\x71\x08\x9f\x13\xaa\x41"
+                            "\xd8\x4c\xe3\x7a\x11\x85\x1c\xb3"
+                            "\x27\xbe\x55\xec\x60\xf7\x8e\x02"
+                            "\x99\x30\xc7\x3b\xd2\x69\x00\x74"
+                            "\x0b\xa2\x16\xad\x44\xdb\x4f\xe6"
+                            "\x7d\x14\x88\x1f\xb6\x2a\xc1\x58"
+                            "\xef\x63\xfa\x91\x05\x9c\x33\xca"
+                            "\x3e\xd5\x6c\x03\x77\x0e\xa5\x19"
+                            "\xb0\x47\xde\x52\xe9\x80\x17\x8b"
+                            "\x22\xb9\x2d\xc4\x5b\xf2\x66\xfd"
+                            "\x94\x08\x9f\x36\xcd\x41\xd8\x6f"
+                            "\x06\x7a\x11\xa8\x1c\xb3\x4a\xe1"
+                            "\x55\xec\x83\x1a\x8e\x25\xbc\x30"
+                            "\xc7\x5e\xf5\x69\x00\x97\x0b\xa2"
+                            "\x39\xd0\x44\xdb\x72\x09\x7d\x14"
+                            "\xab\x1f\xb6\x4d\xe4\x58\xef\x86"
+                            "\x1d\x91\x28\xbf\x33\xca\x61\xf8"
+                            "\x6c\x03\x9a\x0e\xa5\x3c\xd3\x47"
+                            "\xde\x75\x0c\x80\x17\xae\x22\xb9"
+                            "\x50\xe7\x5b\xf2\x89\x20\x94\x2b"
+                            "\xc2\x36\xcd\x64\xfb\x6f\x06\x9d"
+                            "\x11\xa8\x3f\xd6\x4a\xe1\x78\x0f"
+                            "\x83\x1a\xb1\x25\xbc\x53\xea\x5e"
+                            "\xf5\x8c\x00\x97\x2e\xc5\x39\xd0"
+                            "\x67\xfe\x72\x09\xa0\x14\xab\x42"
+                            "\xd9\x4d\xe4\x7b\x12\x86\x1d\xb4"
+                            "\x28\xbf\x56\xed\x61\xf8\x8f\x03"
+                            "\x9a\x31\xc8\x3c\xd3\x6a\x01\x75"
+                            "\x0c\xa3\x17\xae\x45\xdc\x50\xe7"
+                            "\x7e\x15\x89\x20\xb7\x2b\xc2\x59"
+                            "\xf0\x64\xfb\x92\x06\x9d\x34\xcb"
+                            "\x3f\xd6\x6d\x04\x78\x0f\xa6\x1a"
+                            "\xb1\x48\xdf\x53\xea\x81\x18\x8c"
+                            "\x23\xba\x2e\xc5\x5c\xf3\x67\xfe"
+                            "\x95\x09\xa0\x37\xce\x42\xd9\x70"
+                            "\x07\x7b\x12\xa9\x1d\xb4\x4b\xe2"
+                            "\x56\xed\x84\x1b\x8f\x26\xbd\x31"
+                            "\xc8\x5f\xf6\x6a\x01\x98\x0c\xa3"
+                            "\x3a\xd1\x45\xdc\x73\x0a\x7e\x15"
+                            "\xac\x20\xb7\x4e\xe5\x59\xf0\x87"
+                            "\x1e\x92\x29\xc0\x34\xcb\x62\xf9"
+                            "\x6d\x04\x9b\x0f\xa6\x3d\xd4\x48"
+                            "\xdf\x76\x0d\x81\x18\xaf\x23\xba"
+                            "\x51\xe8\x5c\xf3\x8a\x21\x95\x2c"
+                            "\xc3\x37\xce\x65\xfc\x70\x07\x9e"
+                            "\x12\xa9\x40\xd7\x4b\xe2\x79\x10"
+                            "\x84\x1b\xb2\x26\xbd\x54\xeb\x5f"
+                            "\xf6\x8d\x01\x98\x2f\xc6\x3a\xd1"
+                            "\x68\xff\x73\x0a\xa1\x15\xac\x43"
+                            "\xda\x4e\xe5\x7c\x13\x87\x1e\xb5"
+                            "\x29\xc0\x57\xee\x62\xf9\x90\x04"
+                            "\x9b\x32\xc9\x3d\xd4\x6b\x02\x76"
+                            "\x0d\xa4\x18\xaf\x46\xdd\x51\xe8"
+                            "\x7f\x16\x8a\x21\xb8\x2c\xc3\x5a"
+                            "\xf1\x65\xfc\x93\x07\x9e\x35\xcc"
+                            "\x40\xd7\x6e\x05\x79\x10\xa7\x1b"
+                            "\xb2\x49\xe0\x54\xeb\x82\x19\x8d"
+                            "\x24\xbb\x2f\xc6\x5d\xf4\x68\xff"
+                            "\x96\x0a\xa1\x38\xcf\x43\xda\x71"
+                            "\x08\x7c\x13\xaa\x1e\xb5\x4c",
+               .psize     = 1023,
+               .digest    = "\xb8\xe3\x54\xed\xc5\xfc\xef\xa4"
+                            "\x55\x73\x4a\x81\x99\xe4\x47\x2a"
+                            "\x30\xd6\xc9\x85",
        }
 };
 
@@ -12303,23 +12562,296 @@ static const struct cipher_testvec serpent_cbc_dec_tv_template[] = {
                          "\x86\x1D\xB4\x28\xBF\x56\xED\x61"
                          "\xF8\x8F\x03\x9A\x31\xC8\x3C\xD3"
                          "\x6A\x01\x75\x0C\xA3\x17\xAE\x45"
-                         "\xDC\x50\xE7\x7E\x15\x89\x20\xB7",
-               .rlen   = 496,
+                         "\xDC\x50\xE7\x7E\x15\x89\x20\xB7",
+               .rlen   = 496,
+               .also_non_np = 1,
+               .np     = 3,
+               .tap    = { 496 - 20, 4, 16 },
+       },
+};
+
+static const struct cipher_testvec serpent_ctr_enc_tv_template[] = {
+       { /* Generated with Crypto++ */
+               .key    = "\x85\x62\x3F\x1C\xF9\xD6\x1C\xF9"
+                         "\xD6\xB3\x90\x6D\x4A\x90\x6D\x4A"
+                         "\x27\x04\xE1\x27\x04\xE1\xBE\x9B"
+                         "\x78\xBE\x9B\x78\x55\x32\x0F\x55",
+               .klen   = 32,
+               .iv     = "\xE2\x24\x89\xEE\x53\xB8\x1D\x5F"
+                         "\xC4\x29\x8E\xF3\x35\x9A\xFF\x64",
+               .input  = "\x56\xED\x84\x1B\x8F\x26\xBD\x31"
+                         "\xC8\x5F\xF6\x6A\x01\x98\x0C\xA3"
+                         "\x3A\xD1\x45\xDC\x73\x0A\x7E\x15"
+                         "\xAC\x20\xB7\x4E\xE5\x59\xF0\x87"
+                         "\x1E\x92\x29\xC0\x34\xCB\x62\xF9"
+                         "\x6D\x04\x9B\x0F\xA6\x3D\xD4\x48"
+                         "\xDF\x76\x0D\x81\x18\xAF\x23\xBA"
+                         "\x51\xE8\x5C\xF3\x8A\x21\x95\x2C"
+                         "\xC3\x37\xCE\x65\xFC\x70\x07\x9E"
+                         "\x12\xA9\x40\xD7\x4B\xE2\x79\x10"
+                         "\x84\x1B\xB2\x26\xBD\x54\xEB\x5F"
+                         "\xF6\x8D\x01\x98\x2F\xC6\x3A\xD1"
+                         "\x68\xFF\x73\x0A\xA1\x15\xAC\x43"
+                         "\xDA\x4E\xE5\x7C\x13\x87\x1E\xB5"
+                         "\x29\xC0\x57\xEE\x62\xF9\x90\x04"
+                         "\x9B\x32\xC9\x3D\xD4\x6B\x02\x76"
+                         "\x0D\xA4\x18\xAF\x46\xDD\x51\xE8"
+                         "\x7F\x16\x8A\x21\xB8\x2C\xC3\x5A"
+                         "\xF1\x65\xFC\x93\x07\x9E\x35\xCC"
+                         "\x40\xD7\x6E\x05\x79\x10\xA7\x1B"
+                         "\xB2\x49\xE0\x54\xEB\x82\x19\x8D"
+                         "\x24\xBB\x2F\xC6\x5D\xF4\x68\xFF"
+                         "\x96\x0A\xA1\x38\xCF\x43\xDA\x71"
+                         "\x08\x7C\x13\xAA\x1E\xB5\x4C\xE3"
+                         "\x57\xEE\x85\x1C\x90\x27\xBE\x32"
+                         "\xC9\x60\xF7\x6B\x02\x99\x0D\xA4"
+                         "\x3B\xD2\x46\xDD\x74\x0B\x7F\x16"
+                         "\xAD\x21\xB8\x4F\xE6\x5A\xF1\x88"
+                         "\x1F\x93\x2A\xC1\x35\xCC\x63\xFA"
+                         "\x6E\x05\x9C\x10\xA7\x3E\xD5\x49"
+                         "\xE0\x77\x0E\x82\x19\xB0\x24\xBB"
+                         "\x52\xE9\x5D\xF4\x8B\x22\x96\x2D"
+                         "\xC4\x38\xCF\x66\xFD\x71\x08\x9F"
+                         "\x13\xAA\x41\xD8\x4C\xE3\x7A\x11"
+                         "\x85\x1C\xB3\x27\xBE\x55\xEC\x60"
+                         "\xF7\x8E\x02\x99\x30\xC7\x3B\xD2"
+                         "\x69\x00\x74\x0B\xA2\x16\xAD\x44"
+                         "\xDB\x4F\xE6\x7D\x14\x88\x1F\xB6"
+                         "\x2A\xC1\x58\xEF\x63\xFA\x91\x05"
+                         "\x9C\x33\xCA\x3E\xD5\x6C\x03\x77"
+                         "\x0E\xA5\x19\xB0\x47\xDE\x52\xE9"
+                         "\x80\x17\x8B\x22\xB9\x2D\xC4\x5B"
+                         "\xF2\x66\xFD\x94\x08\x9F\x36\xCD"
+                         "\x41\xD8\x6F\x06\x7A\x11\xA8\x1C"
+                         "\xB3\x4A\xE1\x55\xEC\x83\x1A\x8E"
+                         "\x25\xBC\x30\xC7\x5E\xF5\x69\x00"
+                         "\x97\x0B\xA2\x39\xD0\x44\xDB\x72"
+                         "\x09\x7D\x14\xAB\x1F\xB6\x4D\xE4"
+                         "\x58\xEF\x86\x1D\x91\x28\xBF\x33"
+                         "\xCA\x61\xF8\x6C\x03\x9A\x0E\xA5"
+                         "\x3C\xD3\x47\xDE\x75\x0C\x80\x17"
+                         "\xAE\x22\xB9\x50\xE7\x5B\xF2\x89"
+                         "\x20\x94\x2B\xC2\x36\xCD\x64\xFB"
+                         "\x6F\x06\x9D\x11\xA8\x3F\xD6\x4A"
+                         "\xE1\x78\x0F\x83\x1A\xB1\x25\xBC"
+                         "\x53\xEA\x5E\xF5\x8C\x00\x97\x2E"
+                         "\xC5\x39\xD0\x67\xFE\x72\x09\xA0"
+                         "\x14\xAB\x42\xD9\x4D\xE4\x7B\x12"
+                         "\x86\x1D\xB4\x28\xBF\x56\xED\x61"
+                         "\xF8\x8F\x03\x9A\x31\xC8\x3C\xD3"
+                         "\x6A\x01\x75\x0C\xA3\x17\xAE\x45"
+                         "\xDC\x50\xE7\x7E\x15\x89\x20\xB7",
+               .ilen   = 496,
+               .result = "\x84\x68\xEC\xF2\x1C\x88\x20\xCA"
+                         "\x37\x69\xE3\x3A\x22\x85\x48\x46"
+                         "\x70\xAA\x25\xB4\xCD\x8B\x04\x4E"
+                         "\x8D\x15\x2B\x98\xDF\x7B\x6D\xB9"
+                         "\xE0\x4A\x73\x00\x65\xB6\x1A\x0D"
+                         "\x5C\x60\xDF\x34\xDC\x60\x4C\xDF"
+                         "\xB5\x1F\x26\x8C\xDA\xC1\x11\xA8"
+                         "\x80\xFA\x37\x7A\x89\xAA\xAE\x7B"
+                         "\x92\x6E\xB9\xDC\xC9\x62\x4F\x88"
+                         "\x0A\x5D\x97\x2F\x6B\xAC\x03\x7C"
+                         "\x22\xF6\x55\x5A\xFA\x35\xA5\x17"
+                         "\xA1\x5C\x5E\x2B\x63\x2D\xB9\x91"
+                         "\x3E\x83\x26\x00\x4E\xD5\xBE\xCE"
+                         "\x79\xC4\x3D\xFC\x70\xA0\xAD\x96"
+                         "\xBA\x58\x2A\x1C\xDF\xC2\x3A\xA5"
+                         "\x7C\xB5\x12\x89\xED\xBF\xB6\x09"
+                         "\x13\x4F\x7D\x61\x3C\x5C\x27\xFC"
+                         "\x5D\xE1\x4F\xA1\xEA\xB3\xCA\xB9"
+                         "\xE6\xD0\x97\x81\xDE\xD1\xFB\x8A"
+                         "\x30\xDB\xA3\x5D\xEC\x25\x0B\x86"
+                         "\x71\xC8\xA7\x67\xE8\xBC\x7D\x4C"
+                         "\xAE\x82\xD3\x73\x31\x09\xCB\xB3"
+                         "\x4D\xD4\xC0\x8A\x2B\xFA\xA6\x55"
+                         "\x39\x0A\xBC\x6E\x75\xAB\xC2\xE2"
+                         "\x8A\xF2\x26\xCD\x63\x38\x35\xF7"
+                         "\xAE\x12\x83\xCD\x8A\x9E\x7E\x4C"
+                         "\xFE\x4D\xD7\xCE\x5C\x6E\x4C\xAF"
+                         "\xE3\xCD\x76\xA7\x87\xA1\x54\x7C"
+                         "\xEC\x32\xC7\x83\x2A\xFF\xF8\xEA"
+                         "\x87\xB2\x47\xA3\x9D\xC2\x9C\xA2"
+                         "\xB7\x2C\x7C\x1A\x24\xCB\x88\x61"
+                         "\xFF\xA7\x1A\x16\x01\xDD\x4B\xFC"
+                         "\x2E\xE0\x48\x67\x09\x42\xCC\x91"
+                         "\xBE\x20\x38\xC0\x5E\x3B\x95\x00"
+                         "\xA1\x96\x66\x0B\x8A\xE9\x9E\xF7"
+                         "\x6B\x34\x0A\x51\xC0\x3B\xEB\x71"
+                         "\x07\x97\x38\x4B\x5C\x56\x98\x67"
+                         "\x78\x9C\xD0\x0E\x2B\xB5\x67\x90"
+                         "\x75\xF8\xFE\x6D\x4E\x85\xCC\x0D"
+                         "\x18\x06\x15\x9D\x5A\x10\x13\x37"
+                         "\xA3\xD6\x68\xA2\xDF\x7E\xC7\x12"
+                         "\xC9\x0D\x4D\x91\xB0\x2A\x55\xFF"
+                         "\x6F\x73\x13\xDF\x28\xB5\x2A\x2C"
+                         "\xE4\xFC\x20\xD9\xF1\x7A\x82\xB1"
+                         "\xCB\x57\xB6\x3D\x8C\xF4\x8E\x27"
+                         "\x37\xDC\x35\xF3\x79\x01\x53\xA4"
+                         "\x7B\x37\xDE\x7C\x04\xAE\x50\xDB"
+                         "\x9B\x1E\x8C\x07\xA7\x52\x49\x50"
+                         "\x34\x25\x65\xDD\xA9\x8F\x7E\xBD"
+                         "\x7A\xC9\x36\xAE\xDE\x21\x48\x64"
+                         "\xC2\x02\xBA\xBE\x11\x1E\x3D\x9C"
+                         "\x98\x52\xCC\x04\xBD\x5E\x61\x26"
+                         "\x10\xD3\x21\xD9\x6E\x25\x98\x77"
+                         "\x8E\x98\x63\xF6\xF6\x52\xFB\x13"
+                         "\xAA\x30\xF2\xB9\xA4\x43\x53\x39"
+                         "\x1C\x97\x07\x7E\x6B\xFF\x3D\x43"
+                         "\xA6\x71\x6B\x66\x8F\x58\x3F\x71"
+                         "\x90\x47\x40\x92\xE6\x69\xD1\x96"
+                         "\x34\xB3\x3B\xE5\x43\xE4\xD5\x56"
+                         "\xB2\xE6\x7E\x86\x7A\x12\x17\x5B"
+                         "\x30\xF3\x9B\x0D\xFA\x57\xE4\x50"
+                         "\x40\x53\x77\x8C\x15\xF8\x8D\x13",
+               .rlen   = 496,
+       }, { /* Generated with Crypto++ */
+               .key    = "\x85\x62\x3F\x1C\xF9\xD6\x1C\xF9"
+                         "\xD6\xB3\x90\x6D\x4A\x90\x6D\x4A"
+                         "\x27\x04\xE1\x27\x04\xE1\xBE\x9B"
+                         "\x78\xBE\x9B\x78\x55\x32\x0F\x55",
+               .klen   = 32,
+               .iv     = "\xE2\x24\x89\xEE\x53\xB8\x1D\x5F"
+                         "\xC4\x29\x8E\xF3\x35\x9A\xFF\x64",
+               .input  = "\x56\xED\x84\x1B\x8F\x26\xBD\x31"
+                         "\xC8\x5F\xF6\x6A\x01\x98\x0C\xA3"
+                         "\x3A\xD1\x45\xDC\x73\x0A\x7E\x15"
+                         "\xAC\x20\xB7\x4E\xE5\x59\xF0\x87"
+                         "\x1E\x92\x29\xC0\x34\xCB\x62\xF9"
+                         "\x6D\x04\x9B\x0F\xA6\x3D\xD4\x48"
+                         "\xDF\x76\x0D\x81\x18\xAF\x23\xBA"
+                         "\x51\xE8\x5C\xF3\x8A\x21\x95\x2C"
+                         "\xC3\x37\xCE\x65\xFC\x70\x07\x9E"
+                         "\x12\xA9\x40\xD7\x4B\xE2\x79\x10"
+                         "\x84\x1B\xB2\x26\xBD\x54\xEB\x5F"
+                         "\xF6\x8D\x01\x98\x2F\xC6\x3A\xD1"
+                         "\x68\xFF\x73\x0A\xA1\x15\xAC\x43"
+                         "\xDA\x4E\xE5\x7C\x13\x87\x1E\xB5"
+                         "\x29\xC0\x57\xEE\x62\xF9\x90\x04"
+                         "\x9B\x32\xC9\x3D\xD4\x6B\x02\x76"
+                         "\x0D\xA4\x18\xAF\x46\xDD\x51\xE8"
+                         "\x7F\x16\x8A\x21\xB8\x2C\xC3\x5A"
+                         "\xF1\x65\xFC\x93\x07\x9E\x35\xCC"
+                         "\x40\xD7\x6E\x05\x79\x10\xA7\x1B"
+                         "\xB2\x49\xE0\x54\xEB\x82\x19\x8D"
+                         "\x24\xBB\x2F\xC6\x5D\xF4\x68\xFF"
+                         "\x96\x0A\xA1\x38\xCF\x43\xDA\x71"
+                         "\x08\x7C\x13\xAA\x1E\xB5\x4C\xE3"
+                         "\x57\xEE\x85\x1C\x90\x27\xBE\x32"
+                         "\xC9\x60\xF7\x6B\x02\x99\x0D\xA4"
+                         "\x3B\xD2\x46\xDD\x74\x0B\x7F\x16"
+                         "\xAD\x21\xB8\x4F\xE6\x5A\xF1\x88"
+                         "\x1F\x93\x2A\xC1\x35\xCC\x63\xFA"
+                         "\x6E\x05\x9C\x10\xA7\x3E\xD5\x49"
+                         "\xE0\x77\x0E\x82\x19\xB0\x24\xBB"
+                         "\x52\xE9\x5D\xF4\x8B\x22\x96\x2D"
+                         "\xC4\x38\xCF\x66\xFD\x71\x08\x9F"
+                         "\x13\xAA\x41\xD8\x4C\xE3\x7A\x11"
+                         "\x85\x1C\xB3\x27\xBE\x55\xEC\x60"
+                         "\xF7\x8E\x02\x99\x30\xC7\x3B\xD2"
+                         "\x69\x00\x74\x0B\xA2\x16\xAD\x44"
+                         "\xDB\x4F\xE6\x7D\x14\x88\x1F\xB6"
+                         "\x2A\xC1\x58\xEF\x63\xFA\x91\x05"
+                         "\x9C\x33\xCA\x3E\xD5\x6C\x03\x77"
+                         "\x0E\xA5\x19\xB0\x47\xDE\x52\xE9"
+                         "\x80\x17\x8B\x22\xB9\x2D\xC4\x5B"
+                         "\xF2\x66\xFD\x94\x08\x9F\x36\xCD"
+                         "\x41\xD8\x6F\x06\x7A\x11\xA8\x1C"
+                         "\xB3\x4A\xE1\x55\xEC\x83\x1A\x8E"
+                         "\x25\xBC\x30\xC7\x5E\xF5\x69\x00"
+                         "\x97\x0B\xA2\x39\xD0\x44\xDB\x72"
+                         "\x09\x7D\x14\xAB\x1F\xB6\x4D\xE4"
+                         "\x58\xEF\x86\x1D\x91\x28\xBF\x33"
+                         "\xCA\x61\xF8\x6C\x03\x9A\x0E\xA5"
+                         "\x3C\xD3\x47\xDE\x75\x0C\x80\x17"
+                         "\xAE\x22\xB9\x50\xE7\x5B\xF2\x89"
+                         "\x20\x94\x2B\xC2\x36\xCD\x64\xFB"
+                         "\x6F\x06\x9D\x11\xA8\x3F\xD6\x4A"
+                         "\xE1\x78\x0F\x83\x1A\xB1\x25\xBC"
+                         "\x53\xEA\x5E\xF5\x8C\x00\x97\x2E"
+                         "\xC5\x39\xD0\x67\xFE\x72\x09\xA0"
+                         "\x14\xAB\x42\xD9\x4D\xE4\x7B\x12"
+                         "\x86\x1D\xB4\x28\xBF\x56\xED\x61"
+                         "\xF8\x8F\x03\x9A\x31\xC8\x3C\xD3"
+                         "\x6A\x01\x75\x0C\xA3\x17\xAE\x45"
+                         "\xDC\x50\xE7\x7E\x15\x89\x20\xB7"
+                         "\x2B\xC2\x59",
+               .ilen   = 499,
+               .result = "\x84\x68\xEC\xF2\x1C\x88\x20\xCA"
+                         "\x37\x69\xE3\x3A\x22\x85\x48\x46"
+                         "\x70\xAA\x25\xB4\xCD\x8B\x04\x4E"
+                         "\x8D\x15\x2B\x98\xDF\x7B\x6D\xB9"
+                         "\xE0\x4A\x73\x00\x65\xB6\x1A\x0D"
+                         "\x5C\x60\xDF\x34\xDC\x60\x4C\xDF"
+                         "\xB5\x1F\x26\x8C\xDA\xC1\x11\xA8"
+                         "\x80\xFA\x37\x7A\x89\xAA\xAE\x7B"
+                         "\x92\x6E\xB9\xDC\xC9\x62\x4F\x88"
+                         "\x0A\x5D\x97\x2F\x6B\xAC\x03\x7C"
+                         "\x22\xF6\x55\x5A\xFA\x35\xA5\x17"
+                         "\xA1\x5C\x5E\x2B\x63\x2D\xB9\x91"
+                         "\x3E\x83\x26\x00\x4E\xD5\xBE\xCE"
+                         "\x79\xC4\x3D\xFC\x70\xA0\xAD\x96"
+                         "\xBA\x58\x2A\x1C\xDF\xC2\x3A\xA5"
+                         "\x7C\xB5\x12\x89\xED\xBF\xB6\x09"
+                         "\x13\x4F\x7D\x61\x3C\x5C\x27\xFC"
+                         "\x5D\xE1\x4F\xA1\xEA\xB3\xCA\xB9"
+                         "\xE6\xD0\x97\x81\xDE\xD1\xFB\x8A"
+                         "\x30\xDB\xA3\x5D\xEC\x25\x0B\x86"
+                         "\x71\xC8\xA7\x67\xE8\xBC\x7D\x4C"
+                         "\xAE\x82\xD3\x73\x31\x09\xCB\xB3"
+                         "\x4D\xD4\xC0\x8A\x2B\xFA\xA6\x55"
+                         "\x39\x0A\xBC\x6E\x75\xAB\xC2\xE2"
+                         "\x8A\xF2\x26\xCD\x63\x38\x35\xF7"
+                         "\xAE\x12\x83\xCD\x8A\x9E\x7E\x4C"
+                         "\xFE\x4D\xD7\xCE\x5C\x6E\x4C\xAF"
+                         "\xE3\xCD\x76\xA7\x87\xA1\x54\x7C"
+                         "\xEC\x32\xC7\x83\x2A\xFF\xF8\xEA"
+                         "\x87\xB2\x47\xA3\x9D\xC2\x9C\xA2"
+                         "\xB7\x2C\x7C\x1A\x24\xCB\x88\x61"
+                         "\xFF\xA7\x1A\x16\x01\xDD\x4B\xFC"
+                         "\x2E\xE0\x48\x67\x09\x42\xCC\x91"
+                         "\xBE\x20\x38\xC0\x5E\x3B\x95\x00"
+                         "\xA1\x96\x66\x0B\x8A\xE9\x9E\xF7"
+                         "\x6B\x34\x0A\x51\xC0\x3B\xEB\x71"
+                         "\x07\x97\x38\x4B\x5C\x56\x98\x67"
+                         "\x78\x9C\xD0\x0E\x2B\xB5\x67\x90"
+                         "\x75\xF8\xFE\x6D\x4E\x85\xCC\x0D"
+                         "\x18\x06\x15\x9D\x5A\x10\x13\x37"
+                         "\xA3\xD6\x68\xA2\xDF\x7E\xC7\x12"
+                         "\xC9\x0D\x4D\x91\xB0\x2A\x55\xFF"
+                         "\x6F\x73\x13\xDF\x28\xB5\x2A\x2C"
+                         "\xE4\xFC\x20\xD9\xF1\x7A\x82\xB1"
+                         "\xCB\x57\xB6\x3D\x8C\xF4\x8E\x27"
+                         "\x37\xDC\x35\xF3\x79\x01\x53\xA4"
+                         "\x7B\x37\xDE\x7C\x04\xAE\x50\xDB"
+                         "\x9B\x1E\x8C\x07\xA7\x52\x49\x50"
+                         "\x34\x25\x65\xDD\xA9\x8F\x7E\xBD"
+                         "\x7A\xC9\x36\xAE\xDE\x21\x48\x64"
+                         "\xC2\x02\xBA\xBE\x11\x1E\x3D\x9C"
+                         "\x98\x52\xCC\x04\xBD\x5E\x61\x26"
+                         "\x10\xD3\x21\xD9\x6E\x25\x98\x77"
+                         "\x8E\x98\x63\xF6\xF6\x52\xFB\x13"
+                         "\xAA\x30\xF2\xB9\xA4\x43\x53\x39"
+                         "\x1C\x97\x07\x7E\x6B\xFF\x3D\x43"
+                         "\xA6\x71\x6B\x66\x8F\x58\x3F\x71"
+                         "\x90\x47\x40\x92\xE6\x69\xD1\x96"
+                         "\x34\xB3\x3B\xE5\x43\xE4\xD5\x56"
+                         "\xB2\xE6\x7E\x86\x7A\x12\x17\x5B"
+                         "\x30\xF3\x9B\x0D\xFA\x57\xE4\x50"
+                         "\x40\x53\x77\x8C\x15\xF8\x8D\x13"
+                         "\x38\xE2\xE5",
+               .rlen   = 499,
                .also_non_np = 1,
-               .np     = 3,
-               .tap    = { 496 - 20, 4, 16 },
-       },
-};
-
-static const struct cipher_testvec serpent_ctr_enc_tv_template[] = {
-       { /* Generated with Crypto++ */
+               .np     = 2,
+               .tap    = { 499 - 16, 16 },
+       }, { /* Generated with Crypto++ */
                .key    = "\x85\x62\x3F\x1C\xF9\xD6\x1C\xF9"
                          "\xD6\xB3\x90\x6D\x4A\x90\x6D\x4A"
                          "\x27\x04\xE1\x27\x04\xE1\xBE\x9B"
                          "\x78\xBE\x9B\x78\x55\x32\x0F\x55",
                .klen   = 32,
-               .iv     = "\xE2\x24\x89\xEE\x53\xB8\x1D\x5F"
-                         "\xC4\x29\x8E\xF3\x35\x9A\xFF\x64",
+               .iv     = "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF"
+                         "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFD",
                .input  = "\x56\xED\x84\x1B\x8F\x26\xBD\x31"
                          "\xC8\x5F\xF6\x6A\x01\x98\x0C\xA3"
                          "\x3A\xD1\x45\xDC\x73\x0A\x7E\x15"
@@ -12383,7 +12915,82 @@ static const struct cipher_testvec serpent_ctr_enc_tv_template[] = {
                          "\x6A\x01\x75\x0C\xA3\x17\xAE\x45"
                          "\xDC\x50\xE7\x7E\x15\x89\x20\xB7",
                .ilen   = 496,
-               .result = "\x84\x68\xEC\xF2\x1C\x88\x20\xCA"
+               .result = "\x06\x9A\xF8\xB4\x53\x88\x62\xFC"
+                         "\x68\xB8\x2E\xDF\xC1\x05\x0F\x3D"
+                         "\xAF\x4D\x95\xAE\xC4\xE9\x1C\xDC"
+                         "\xF6\x2B\x8F\x90\x89\xF6\x7E\x1A"
+                         "\xA6\xB9\xE4\xF4\xFA\xCA\xE5\x7E"
+                         "\x71\x28\x06\x4F\xE8\x08\x39\xDA"
+                         "\xA5\x0E\xC8\xC0\xB8\x16\xE5\x69"
+                         "\xE5\xCA\xEC\x4F\x63\x2C\xC0\x9B"
+                         "\x9F\x3E\x39\x79\xF0\xCD\x64\x35"
+                         "\x4A\xD3\xC8\xA9\x31\xCD\x48\x5B"
+                         "\x92\x3D\x8F\x3F\x96\xBD\xB3\x18"
+                         "\x74\x2A\x5D\x29\x3F\x57\x8F\xE2"
+                         "\x67\x9A\xE0\xE5\xD4\x4A\xE2\x47"
+                         "\xBC\xF6\xEB\x14\xF3\x8C\x20\xC2"
+                         "\x7D\xE2\x43\x81\x86\x72\x2E\xB1"
+                         "\x39\xF6\x95\xE1\x1F\xCB\x76\x33"
+                         "\x5B\x7D\x23\x0F\x3A\x67\x2A\x2F"
+                         "\xB9\x37\x9D\xDD\x1F\x16\xA1\x3C"
+                         "\x70\xFE\x52\xAA\x93\x3C\xC4\x46"
+                         "\xB1\xE5\xFF\xDA\xAF\xE2\x84\xFE"
+                         "\x25\x92\xB2\x63\xBD\x49\x77\xB4"
+                         "\x22\xA4\x6A\xD5\x04\xE0\x45\x58"
+                         "\x1C\x34\x96\x7C\x03\x0C\x13\xA2"
+                         "\x05\x22\xE2\xCB\x5A\x35\x03\x09"
+                         "\x40\xD2\x82\x05\xCA\x58\x73\xF2"
+                         "\x29\x5E\x01\x47\x13\x32\x78\xBE"
+                         "\x06\xB0\x51\xDB\x6C\x31\xA0\x1C"
+                         "\x74\xBC\x8D\x25\xDF\xF8\x65\xD1"
+                         "\x38\x35\x11\x26\x4A\xB4\x06\x32"
+                         "\xFA\xD2\x07\x77\xB3\x74\x98\x80"
+                         "\x61\x59\xA8\x9F\xF3\x6F\x2A\xBF"
+                         "\xE6\xA5\x9A\xC4\x6B\xA6\x49\x6F"
+                         "\xBC\x47\xD9\xFB\xC6\xEF\x25\x65"
+                         "\x96\xAC\x9F\xE4\x81\x4B\xD8\xBA"
+                         "\xD6\x9B\xC9\x6D\x58\x40\x81\x02"
+                         "\x73\x44\x4E\x43\x6E\x37\xBB\x11"
+                         "\xE3\xF9\xB8\x2F\xEC\x76\x34\xEA"
+                         "\x90\xCD\xB7\x2E\x0E\x32\x71\xE8"
+                         "\xBB\x4E\x0B\x98\xA4\x17\x17\x5B"
+                         "\x07\xB5\x82\x3A\xC4\xE8\x42\x51"
+                         "\x5A\x4C\x4E\x7D\xBF\xC4\xC0\x4F"
+                         "\x68\xB8\xC6\x4A\x32\x6F\x0B\xD7"
+                         "\x85\xED\x6B\xFB\x72\xD2\xA5\x8F"
+                         "\xBF\xF9\xAC\x59\x50\xA8\x08\x70"
+                         "\xEC\xBD\x0A\xBF\xE5\x87\xA1\xC2"
+                         "\x92\x14\x78\xAF\xE8\xEA\x2E\xDD"
+                         "\xC1\x03\x9A\xAA\x89\x8B\x32\x46"
+                         "\x5B\x18\x27\xBA\x46\xAA\x64\xDE"
+                         "\xE3\xD5\xA3\xFC\x7B\x5B\x61\xDB"
+                         "\x7E\xDA\xEC\x30\x17\x19\xF8\x80"
+                         "\xB5\x5E\x27\xB5\x37\x3A\x1F\x28"
+                         "\x07\x73\xC3\x63\xCE\xFF\x8C\xFE"
+                         "\x81\x4E\xF8\x24\xF3\xB8\xC7\xE8"
+                         "\x16\x9A\xCC\x58\x2F\x88\x1C\x4B"
+                         "\xBB\x33\xA2\x73\xF0\x1C\x89\x0E"
+                         "\xDC\x34\x27\x89\x98\xCE\x1C\xA2"
+                         "\xD8\xB8\x90\xBE\xEC\x72\x28\x13"
+                         "\xAC\x7B\xF1\xD0\x7F\x7A\x28\x50"
+                         "\xB7\x99\x65\x8A\xC9\xC6\x21\x34"
+                         "\x7F\x67\x9D\xB7\x2C\xCC\xF5\x17"
+                         "\x2B\x89\xAC\xB0\xD7\x1E\x47\xB0"
+                         "\x61\xAF\xD4\x63\x6D\xB8\x2D\x20",
+               .rlen   = 496,
+       },
+};
+
+static const struct cipher_testvec serpent_ctr_dec_tv_template[] = {
+       { /* Generated with Crypto++ */
+               .key    = "\x85\x62\x3F\x1C\xF9\xD6\x1C\xF9"
+                         "\xD6\xB3\x90\x6D\x4A\x90\x6D\x4A"
+                         "\x27\x04\xE1\x27\x04\xE1\xBE\x9B"
+                         "\x78\xBE\x9B\x78\x55\x32\x0F\x55",
+               .klen   = 32,
+               .iv     = "\xE2\x24\x89\xEE\x53\xB8\x1D\x5F"
+                         "\xC4\x29\x8E\xF3\x35\x9A\xFF\x64",
+               .input  = "\x84\x68\xEC\xF2\x1C\x88\x20\xCA"
                          "\x37\x69\xE3\x3A\x22\x85\x48\x46"
                          "\x70\xAA\x25\xB4\xCD\x8B\x04\x4E"
                          "\x8D\x15\x2B\x98\xDF\x7B\x6D\xB9"
@@ -12445,16 +13052,8 @@ static const struct cipher_testvec serpent_ctr_enc_tv_template[] = {
                          "\xB2\xE6\x7E\x86\x7A\x12\x17\x5B"
                          "\x30\xF3\x9B\x0D\xFA\x57\xE4\x50"
                          "\x40\x53\x77\x8C\x15\xF8\x8D\x13",
-               .rlen   = 496,
-       }, { /* Generated with Crypto++ */
-               .key    = "\x85\x62\x3F\x1C\xF9\xD6\x1C\xF9"
-                         "\xD6\xB3\x90\x6D\x4A\x90\x6D\x4A"
-                         "\x27\x04\xE1\x27\x04\xE1\xBE\x9B"
-                         "\x78\xBE\x9B\x78\x55\x32\x0F\x55",
-               .klen   = 32,
-               .iv     = "\xE2\x24\x89\xEE\x53\xB8\x1D\x5F"
-                         "\xC4\x29\x8E\xF3\x35\x9A\xFF\x64",
-               .input  = "\x56\xED\x84\x1B\x8F\x26\xBD\x31"
+               .ilen   = 496,
+               .result = "\x56\xED\x84\x1B\x8F\x26\xBD\x31"
                          "\xC8\x5F\xF6\x6A\x01\x98\x0C\xA3"
                          "\x3A\xD1\x45\xDC\x73\x0A\x7E\x15"
                          "\xAC\x20\xB7\x4E\xE5\x59\xF0\x87"
@@ -12515,10 +13114,17 @@ static const struct cipher_testvec serpent_ctr_enc_tv_template[] = {
                          "\x86\x1D\xB4\x28\xBF\x56\xED\x61"
                          "\xF8\x8F\x03\x9A\x31\xC8\x3C\xD3"
                          "\x6A\x01\x75\x0C\xA3\x17\xAE\x45"
-                         "\xDC\x50\xE7\x7E\x15\x89\x20\xB7"
-                         "\x2B\xC2\x59",
-               .ilen   = 499,
-               .result = "\x84\x68\xEC\xF2\x1C\x88\x20\xCA"
+                         "\xDC\x50\xE7\x7E\x15\x89\x20\xB7",
+               .rlen   = 496,
+       }, { /* Generated with Crypto++ */
+               .key    = "\x85\x62\x3F\x1C\xF9\xD6\x1C\xF9"
+                         "\xD6\xB3\x90\x6D\x4A\x90\x6D\x4A"
+                         "\x27\x04\xE1\x27\x04\xE1\xBE\x9B"
+                         "\x78\xBE\x9B\x78\x55\x32\x0F\x55",
+               .klen   = 32,
+               .iv     = "\xE2\x24\x89\xEE\x53\xB8\x1D\x5F"
+                         "\xC4\x29\x8E\xF3\x35\x9A\xFF\x64",
+               .input  = "\x84\x68\xEC\xF2\x1C\x88\x20\xCA"
                          "\x37\x69\xE3\x3A\x22\x85\x48\x46"
                          "\x70\xAA\x25\xB4\xCD\x8B\x04\x4E"
                          "\x8D\x15\x2B\x98\xDF\x7B\x6D\xB9"
@@ -12581,19 +13187,8 @@ static const struct cipher_testvec serpent_ctr_enc_tv_template[] = {
                          "\x30\xF3\x9B\x0D\xFA\x57\xE4\x50"
                          "\x40\x53\x77\x8C\x15\xF8\x8D\x13"
                          "\x38\xE2\xE5",
-               .rlen   = 499,
-               .also_non_np = 1,
-               .np     = 2,
-               .tap    = { 499 - 16, 16 },
-       }, { /* Generated with Crypto++ */
-               .key    = "\x85\x62\x3F\x1C\xF9\xD6\x1C\xF9"
-                         "\xD6\xB3\x90\x6D\x4A\x90\x6D\x4A"
-                         "\x27\x04\xE1\x27\x04\xE1\xBE\x9B"
-                         "\x78\xBE\x9B\x78\x55\x32\x0F\x55",
-               .klen   = 32,
-               .iv     = "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF"
-                         "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFD",
-               .input  = "\x56\xED\x84\x1B\x8F\x26\xBD\x31"
+               .ilen   = 499,
+               .result = "\x56\xED\x84\x1B\x8F\x26\xBD\x31"
                          "\xC8\x5F\xF6\x6A\x01\x98\x0C\xA3"
                          "\x3A\xD1\x45\xDC\x73\x0A\x7E\x15"
                          "\xAC\x20\xB7\x4E\xE5\x59\xF0\x87"
@@ -12654,9 +13249,21 @@ static const struct cipher_testvec serpent_ctr_enc_tv_template[] = {
                          "\x86\x1D\xB4\x28\xBF\x56\xED\x61"
                          "\xF8\x8F\x03\x9A\x31\xC8\x3C\xD3"
                          "\x6A\x01\x75\x0C\xA3\x17\xAE\x45"
-                         "\xDC\x50\xE7\x7E\x15\x89\x20\xB7",
-               .ilen   = 496,
-               .result = "\x06\x9A\xF8\xB4\x53\x88\x62\xFC"
+                         "\xDC\x50\xE7\x7E\x15\x89\x20\xB7"
+                         "\x2B\xC2\x59",
+               .rlen   = 499,
+               .also_non_np = 1,
+               .np     = 2,
+               .tap    = { 499 - 16, 16 },
+       }, { /* Generated with Crypto++ */
+               .key    = "\x85\x62\x3F\x1C\xF9\xD6\x1C\xF9"
+                         "\xD6\xB3\x90\x6D\x4A\x90\x6D\x4A"
+                         "\x27\x04\xE1\x27\x04\xE1\xBE\x9B"
+                         "\x78\xBE\x9B\x78\x55\x32\x0F\x55",
+               .klen   = 32,
+               .iv     = "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF"
+                         "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFD",
+               .input  = "\x06\x9A\xF8\xB4\x53\x88\x62\xFC"
                          "\x68\xB8\x2E\xDF\xC1\x05\x0F\x3D"
                          "\xAF\x4D\x95\xAE\xC4\xE9\x1C\xDC"
                          "\xF6\x2B\x8F\x90\x89\xF6\x7E\x1A"
@@ -12718,81 +13325,6 @@ static const struct cipher_testvec serpent_ctr_enc_tv_template[] = {
                          "\x7F\x67\x9D\xB7\x2C\xCC\xF5\x17"
                          "\x2B\x89\xAC\xB0\xD7\x1E\x47\xB0"
                          "\x61\xAF\xD4\x63\x6D\xB8\x2D\x20",
-               .rlen   = 496,
-       },
-};
-
-static const struct cipher_testvec serpent_ctr_dec_tv_template[] = {
-       { /* Generated with Crypto++ */
-               .key    = "\x85\x62\x3F\x1C\xF9\xD6\x1C\xF9"
-                         "\xD6\xB3\x90\x6D\x4A\x90\x6D\x4A"
-                         "\x27\x04\xE1\x27\x04\xE1\xBE\x9B"
-                         "\x78\xBE\x9B\x78\x55\x32\x0F\x55",
-               .klen   = 32,
-               .iv     = "\xE2\x24\x89\xEE\x53\xB8\x1D\x5F"
-                         "\xC4\x29\x8E\xF3\x35\x9A\xFF\x64",
-               .input  = "\x84\x68\xEC\xF2\x1C\x88\x20\xCA"
-                         "\x37\x69\xE3\x3A\x22\x85\x48\x46"
-                         "\x70\xAA\x25\xB4\xCD\x8B\x04\x4E"
-                         "\x8D\x15\x2B\x98\xDF\x7B\x6D\xB9"
-                         "\xE0\x4A\x73\x00\x65\xB6\x1A\x0D"
-                         "\x5C\x60\xDF\x34\xDC\x60\x4C\xDF"
-                         "\xB5\x1F\x26\x8C\xDA\xC1\x11\xA8"
-                         "\x80\xFA\x37\x7A\x89\xAA\xAE\x7B"
-                         "\x92\x6E\xB9\xDC\xC9\x62\x4F\x88"
-                         "\x0A\x5D\x97\x2F\x6B\xAC\x03\x7C"
-                         "\x22\xF6\x55\x5A\xFA\x35\xA5\x17"
-                         "\xA1\x5C\x5E\x2B\x63\x2D\xB9\x91"
-                         "\x3E\x83\x26\x00\x4E\xD5\xBE\xCE"
-                         "\x79\xC4\x3D\xFC\x70\xA0\xAD\x96"
-                         "\xBA\x58\x2A\x1C\xDF\xC2\x3A\xA5"
-                         "\x7C\xB5\x12\x89\xED\xBF\xB6\x09"
-                         "\x13\x4F\x7D\x61\x3C\x5C\x27\xFC"
-                         "\x5D\xE1\x4F\xA1\xEA\xB3\xCA\xB9"
-                         "\xE6\xD0\x97\x81\xDE\xD1\xFB\x8A"
-                         "\x30\xDB\xA3\x5D\xEC\x25\x0B\x86"
-                         "\x71\xC8\xA7\x67\xE8\xBC\x7D\x4C"
-                         "\xAE\x82\xD3\x73\x31\x09\xCB\xB3"
-                         "\x4D\xD4\xC0\x8A\x2B\xFA\xA6\x55"
-                         "\x39\x0A\xBC\x6E\x75\xAB\xC2\xE2"
-                         "\x8A\xF2\x26\xCD\x63\x38\x35\xF7"
-                         "\xAE\x12\x83\xCD\x8A\x9E\x7E\x4C"
-                         "\xFE\x4D\xD7\xCE\x5C\x6E\x4C\xAF"
-                         "\xE3\xCD\x76\xA7\x87\xA1\x54\x7C"
-                         "\xEC\x32\xC7\x83\x2A\xFF\xF8\xEA"
-                         "\x87\xB2\x47\xA3\x9D\xC2\x9C\xA2"
-                         "\xB7\x2C\x7C\x1A\x24\xCB\x88\x61"
-                         "\xFF\xA7\x1A\x16\x01\xDD\x4B\xFC"
-                         "\x2E\xE0\x48\x67\x09\x42\xCC\x91"
-                         "\xBE\x20\x38\xC0\x5E\x3B\x95\x00"
-                         "\xA1\x96\x66\x0B\x8A\xE9\x9E\xF7"
-                         "\x6B\x34\x0A\x51\xC0\x3B\xEB\x71"
-                         "\x07\x97\x38\x4B\x5C\x56\x98\x67"
-                         "\x78\x9C\xD0\x0E\x2B\xB5\x67\x90"
-                         "\x75\xF8\xFE\x6D\x4E\x85\xCC\x0D"
-                         "\x18\x06\x15\x9D\x5A\x10\x13\x37"
-                         "\xA3\xD6\x68\xA2\xDF\x7E\xC7\x12"
-                         "\xC9\x0D\x4D\x91\xB0\x2A\x55\xFF"
-                         "\x6F\x73\x13\xDF\x28\xB5\x2A\x2C"
-                         "\xE4\xFC\x20\xD9\xF1\x7A\x82\xB1"
-                         "\xCB\x57\xB6\x3D\x8C\xF4\x8E\x27"
-                         "\x37\xDC\x35\xF3\x79\x01\x53\xA4"
-                         "\x7B\x37\xDE\x7C\x04\xAE\x50\xDB"
-                         "\x9B\x1E\x8C\x07\xA7\x52\x49\x50"
-                         "\x34\x25\x65\xDD\xA9\x8F\x7E\xBD"
-                         "\x7A\xC9\x36\xAE\xDE\x21\x48\x64"
-                         "\xC2\x02\xBA\xBE\x11\x1E\x3D\x9C"
-                         "\x98\x52\xCC\x04\xBD\x5E\x61\x26"
-                         "\x10\xD3\x21\xD9\x6E\x25\x98\x77"
-                         "\x8E\x98\x63\xF6\xF6\x52\xFB\x13"
-                         "\xAA\x30\xF2\xB9\xA4\x43\x53\x39"
-                         "\x1C\x97\x07\x7E\x6B\xFF\x3D\x43"
-                         "\xA6\x71\x6B\x66\x8F\x58\x3F\x71"
-                         "\x90\x47\x40\x92\xE6\x69\xD1\x96"
-                         "\x34\xB3\x3B\xE5\x43\xE4\xD5\x56"
-                         "\xB2\xE6\x7E\x86\x7A\x12\x17\x5B"
-                         "\x30\xF3\x9B\x0D\xFA\x57\xE4\x50"
-                         "\x40\x53\x77\x8C\x15\xF8\x8D\x13",
                .ilen   = 496,
                .result = "\x56\xED\x84\x1B\x8F\x26\xBD\x31"
                          "\xC8\x5F\xF6\x6A\x01\x98\x0C\xA3"
@@ -12857,795 +13389,2156 @@ static const struct cipher_testvec serpent_ctr_dec_tv_template[] = {
                          "\x6A\x01\x75\x0C\xA3\x17\xAE\x45"
                          "\xDC\x50\xE7\x7E\x15\x89\x20\xB7",
                .rlen   = 496,
-       }, { /* Generated with Crypto++ */
-               .key    = "\x85\x62\x3F\x1C\xF9\xD6\x1C\xF9"
-                         "\xD6\xB3\x90\x6D\x4A\x90\x6D\x4A"
-                         "\x27\x04\xE1\x27\x04\xE1\xBE\x9B"
-                         "\x78\xBE\x9B\x78\x55\x32\x0F\x55",
+       },
+};
+
+static const struct cipher_testvec serpent_lrw_enc_tv_template[] = {
+       /* Generated from AES-LRW test vectors */
+       {
+               .key    = "\x45\x62\xac\x25\xf8\x28\x17\x6d"
+                         "\x4c\x26\x84\x14\xb5\x68\x01\x85"
+                         "\x25\x8e\x2a\x05\xe7\x3e\x9d\x03"
+                         "\xee\x5a\x83\x0c\xcc\x09\x4c\x87",
+               .klen   = 32,
+               .iv     = "\x00\x00\x00\x00\x00\x00\x00\x00"
+                         "\x00\x00\x00\x00\x00\x00\x00\x01",
+               .input  = "\x30\x31\x32\x33\x34\x35\x36\x37"
+                         "\x38\x39\x41\x42\x43\x44\x45\x46",
+               .ilen   = 16,
+               .result = "\x6f\xbf\xd4\xa4\x5d\x71\x16\x79"
+                         "\x63\x9c\xa6\x8e\x40\xbe\x0d\x8a",
+               .rlen   = 16,
+       }, {
+               .key    = "\x59\x70\x47\x14\xf5\x57\x47\x8c"
+                         "\xd7\x79\xe8\x0f\x54\x88\x79\x44"
+                         "\x0d\x48\xf0\xb7\xb1\x5a\x53\xea"
+                         "\x1c\xaa\x6b\x29\xc2\xca\xfb\xaf",
+               .klen   = 32,
+               .iv     = "\x00\x00\x00\x00\x00\x00\x00\x00"
+                         "\x00\x00\x00\x00\x00\x00\x00\x02",
+               .input  = "\x30\x31\x32\x33\x34\x35\x36\x37"
+                         "\x38\x39\x41\x42\x43\x44\x45\x46",
+               .ilen   = 16,
+               .result = "\xfd\xb2\x66\x98\x80\x96\x55\xad"
+                         "\x08\x94\x54\x9c\x21\x7c\x69\xe3",
+               .rlen   = 16,
+       }, {
+               .key    = "\xd8\x2a\x91\x34\xb2\x6a\x56\x50"
+                         "\x30\xfe\x69\xe2\x37\x7f\x98\x47"
+                         "\xcd\xf9\x0b\x16\x0c\x64\x8f\xb6"
+                         "\xb0\x0d\x0d\x1b\xae\x85\x87\x1f",
+               .klen   = 32,
+               .iv     = "\x00\x00\x00\x00\x00\x00\x00\x00"
+                         "\x00\x00\x00\x02\x00\x00\x00\x00",
+               .input  = "\x30\x31\x32\x33\x34\x35\x36\x37"
+                         "\x38\x39\x41\x42\x43\x44\x45\x46",
+               .ilen   = 16,
+               .result = "\x14\x5e\x3d\x70\xc0\x6e\x9c\x34"
+                         "\x5b\x5e\xcf\x0f\xe4\x8c\x21\x5c",
+               .rlen   = 16,
+       }, {
+               .key    = "\x0f\x6a\xef\xf8\xd3\xd2\xbb\x15"
+                         "\x25\x83\xf7\x3c\x1f\x01\x28\x74"
+                         "\xca\xc6\xbc\x35\x4d\x4a\x65\x54"
+                         "\x90\xae\x61\xcf\x7b\xae\xbd\xcc"
+                         "\xad\xe4\x94\xc5\x4a\x29\xae\x70",
+               .klen   = 40,
+               .iv     = "\x00\x00\x00\x00\x00\x00\x00\x00"
+                         "\x00\x00\x00\x00\x00\x00\x00\x01",
+               .input  = "\x30\x31\x32\x33\x34\x35\x36\x37"
+                         "\x38\x39\x41\x42\x43\x44\x45\x46",
+               .ilen   = 16,
+               .result = "\x25\x39\xaa\xa5\xf0\x65\xc8\xdc"
+                         "\x5d\x45\x95\x30\x8f\xff\x2f\x1b",
+               .rlen   = 16,
+       }, {
+               .key    = "\x8a\xd4\xee\x10\x2f\xbd\x81\xff"
+                         "\xf8\x86\xce\xac\x93\xc5\xad\xc6"
+                         "\xa0\x19\x07\xc0\x9d\xf7\xbb\xdd"
+                         "\x52\x13\xb2\xb7\xf0\xff\x11\xd8"
+                         "\xd6\x08\xd0\xcd\x2e\xb1\x17\x6f",
+               .klen   = 40,
+               .iv     = "\x00\x00\x00\x00\x00\x00\x00\x00"
+                         "\x00\x00\x00\x02\x00\x00\x00\x00",
+               .input  = "\x30\x31\x32\x33\x34\x35\x36\x37"
+                         "\x38\x39\x41\x42\x43\x44\x45\x46",
+               .ilen   = 16,
+               .result = "\x0c\x20\x20\x63\xd6\x8b\xfc\x8f"
+                         "\xc0\xe2\x17\xbb\xd2\x59\x6f\x26",
+               .rlen   = 16,
+       }, {
+               .key    = "\xf8\xd4\x76\xff\xd6\x46\xee\x6c"
+                         "\x23\x84\xcb\x1c\x77\xd6\x19\x5d"
+                         "\xfe\xf1\xa9\xf3\x7b\xbc\x8d\x21"
+                         "\xa7\x9c\x21\xf8\xcb\x90\x02\x89"
+                         "\xa8\x45\x34\x8e\xc8\xc5\xb5\xf1"
+                         "\x26\xf5\x0e\x76\xfe\xfd\x1b\x1e",
+               .klen   = 48,
+               .iv     = "\x00\x00\x00\x00\x00\x00\x00\x00"
+                         "\x00\x00\x00\x00\x00\x00\x00\x01",
+               .input  = "\x30\x31\x32\x33\x34\x35\x36\x37"
+                         "\x38\x39\x41\x42\x43\x44\x45\x46",
+               .ilen   = 16,
+               .result = "\xc1\x35\x2e\x53\xf0\x96\x4d\x9c"
+                         "\x2e\x18\xe6\x99\xcd\xd3\x15\x68",
+               .rlen   = 16,
+       }, {
+               .key    = "\xfb\x76\x15\xb2\x3d\x80\x89\x1d"
+                         "\xd4\x70\x98\x0b\xc7\x95\x84\xc8"
+                         "\xb2\xfb\x64\xce\x60\x97\x87\x8d"
+                         "\x17\xfc\xe4\x5a\x49\xe8\x30\xb7"
+                         "\x6e\x78\x17\xe7\x2d\x5e\x12\xd4"
+                         "\x60\x64\x04\x7a\xf1\x2f\x9e\x0c",
+               .klen   = 48,
+               .iv     = "\x00\x00\x00\x00\x00\x00\x00\x00"
+                         "\x00\x00\x00\x02\x00\x00\x00\x00",
+               .input  = "\x30\x31\x32\x33\x34\x35\x36\x37"
+                         "\x38\x39\x41\x42\x43\x44\x45\x46",
+               .ilen   = 16,
+               .result = "\x86\x0a\xc6\xa9\x1a\x9f\xe7\xe6"
+                         "\x64\x3b\x33\xd6\xd5\x84\xd6\xdf",
+               .rlen   = 16,
+       }, {
+               .key    = "\xf8\xd4\x76\xff\xd6\x46\xee\x6c"
+                         "\x23\x84\xcb\x1c\x77\xd6\x19\x5d"
+                         "\xfe\xf1\xa9\xf3\x7b\xbc\x8d\x21"
+                         "\xa7\x9c\x21\xf8\xcb\x90\x02\x89"
+                         "\xa8\x45\x34\x8e\xc8\xc5\xb5\xf1"
+                         "\x26\xf5\x0e\x76\xfe\xfd\x1b\x1e",
+               .klen   = 48,
+               .iv     = "\x00\x00\x00\x00\x00\x00\x00\x00"
+                         "\x00\x00\x00\x00\x00\x00\x00\x01",
+               .input  = "\x05\x11\xb7\x18\xab\xc6\x2d\xac"
+                         "\x70\x5d\xf6\x22\x94\xcd\xe5\x6c"
+                         "\x17\x6b\xf6\x1c\xf0\xf3\x6e\xf8"
+                         "\x50\x38\x1f\x71\x49\xb6\x57\xd6"
+                         "\x8f\xcb\x8d\x6b\xe3\xa6\x29\x90"
+                         "\xfe\x2a\x62\x82\xae\x6d\x8b\xf6"
+                         "\xad\x1e\x9e\x20\x5f\x38\xbe\x04"
+                         "\xda\x10\x8e\xed\xa2\xa4\x87\xab"
+                         "\xda\x6b\xb4\x0c\x75\xba\xd3\x7c"
+                         "\xc9\xac\x42\x31\x95\x7c\xc9\x04"
+                         "\xeb\xd5\x6e\x32\x69\x8a\xdb\xa6"
+                         "\x15\xd7\x3f\x4f\x2f\x66\x69\x03"
+                         "\x9c\x1f\x54\x0f\xde\x1f\xf3\x65"
+                         "\x4c\x96\x12\xed\x7c\x92\x03\x01"
+                         "\x6f\xbc\x35\x93\xac\xf1\x27\xf1"
+                         "\xb4\x96\x82\x5a\x5f\xb0\xa0\x50"
+                         "\x89\xa4\x8e\x66\x44\x85\xcc\xfd"
+                         "\x33\x14\x70\xe3\x96\xb2\xc3\xd3"
+                         "\xbb\x54\x5a\x1a\xf9\x74\xa2\xc5"
+                         "\x2d\x64\x75\xdd\xb4\x54\xe6\x74"
+                         "\x8c\xd3\x9d\x9e\x86\xab\x51\x53"
+                         "\xb7\x93\x3e\x6f\xd0\x4e\x2c\x40"
+                         "\xf6\xa8\x2e\x3e\x9d\xf4\x66\xa5"
+                         "\x76\x12\x73\x44\x1a\x56\xd7\x72"
+                         "\x88\xcd\x21\x8c\x4c\x0f\xfe\xda"
+                         "\x95\xe0\x3a\xa6\xa5\x84\x46\xcd"
+                         "\xd5\x3e\x9d\x3a\xe2\x67\xe6\x60"
+                         "\x1a\xe2\x70\x85\x58\xc2\x1b\x09"
+                         "\xe1\xd7\x2c\xca\xad\xa8\x8f\xf9"
+                         "\xac\xb3\x0e\xdb\xca\x2e\xe2\xb8"
+                         "\x51\x71\xd9\x3c\x6c\xf1\x56\xf8"
+                         "\xea\x9c\xf1\xfb\x0c\xe6\xb7\x10"
+                         "\x1c\xf8\xa9\x7c\xe8\x53\x35\xc1"
+                         "\x90\x3e\x76\x4a\x74\xa4\x21\x2c"
+                         "\xf6\x2c\x4e\x0f\x94\x3a\x88\x2e"
+                         "\x41\x09\x6a\x33\x7d\xf6\xdd\x3f"
+                         "\x8d\x23\x31\x74\x84\xeb\x88\x6e"
+                         "\xcc\xb9\xbc\x22\x83\x19\x07\x22"
+                         "\xa5\x2d\xdf\xa5\xf3\x80\x85\x78"
+                         "\x84\x39\x6a\x6d\x6a\x99\x4f\xa5"
+                         "\x15\xfe\x46\xb0\xe4\x6c\xa5\x41"
+                         "\x3c\xce\x8f\x42\x60\x71\xa7\x75"
+                         "\x08\x40\x65\x8a\x82\xbf\xf5\x43"
+                         "\x71\x96\xa9\x4d\x44\x8a\x20\xbe"
+                         "\xfa\x4d\xbb\xc0\x7d\x31\x96\x65"
+                         "\xe7\x75\xe5\x3e\xfd\x92\x3b\xc9"
+                         "\x55\xbb\x16\x7e\xf7\xc2\x8c\xa4"
+                         "\x40\x1d\xe5\xef\x0e\xdf\xe4\x9a"
+                         "\x62\x73\x65\xfd\x46\x63\x25\x3d"
+                         "\x2b\xaf\xe5\x64\xfe\xa5\x5c\xcf"
+                         "\x24\xf3\xb4\xac\x64\xba\xdf\x4b"
+                         "\xc6\x96\x7d\x81\x2d\x8d\x97\xf7"
+                         "\xc5\x68\x77\x84\x32\x2b\xcc\x85"
+                         "\x74\x96\xf0\x12\x77\x61\xb9\xeb"
+                         "\x71\xaa\x82\xcb\x1c\xdb\x89\xc8"
+                         "\xc6\xb5\xe3\x5c\x7d\x39\x07\x24"
+                         "\xda\x39\x87\x45\xc0\x2b\xbb\x01"
+                         "\xac\xbc\x2a\x5c\x7f\xfc\xe8\xce"
+                         "\x6d\x9c\x6f\xed\xd3\xc1\xa1\xd6"
+                         "\xc5\x55\xa9\x66\x2f\xe1\xc8\x32"
+                         "\xa6\x5d\xa4\x3a\x98\x73\xe8\x45"
+                         "\xa4\xc7\xa8\xb4\xf6\x13\x03\xf6"
+                         "\xe9\x2e\xc4\x29\x0f\x84\xdb\xc4"
+                         "\x21\xc4\xc2\x75\x67\x89\x37\x0a",
+               .ilen   = 512,
+               .result = "\xe3\x5a\x38\x0f\x4d\x92\x3a\x74"
+                         "\x15\xb1\x50\x8c\x9a\xd8\x99\x1d"
+                         "\x82\xec\xf1\x5f\x03\x6d\x02\x58"
+                         "\x90\x67\xfc\xdd\x8d\xe1\x38\x08"
+                         "\x7b\xc9\x9b\x4b\x04\x09\x50\x15"
+                         "\xce\xab\xda\x33\x30\x20\x12\xfa"
+                         "\x83\xc4\xa6\x9a\x2e\x7d\x90\xd9"
+                         "\xa6\xa6\x67\x43\xb4\xa7\xa8\x5c"
+                         "\xbb\x6a\x49\x2b\x8b\xf8\xd0\x22"
+                         "\xe5\x9e\xba\xe8\x8c\x67\xb8\x5b"
+                         "\x60\xbc\xf5\xa4\x95\x4e\x66\xe5"
+                         "\x6d\x8e\xa9\xf6\x65\x2e\x04\xf5"
+                         "\xba\xb5\xdb\x88\xc2\xf6\x7a\x4b"
+                         "\x89\x58\x7c\x9a\xae\x26\xe8\xb7"
+                         "\xb7\x28\xcc\xd6\xcc\xa5\x98\x4d"
+                         "\xb9\x91\xcb\xb4\xe4\x8b\x96\x47"
+                         "\x5f\x03\x8b\xdd\x94\xd1\xee\x12"
+                         "\xa7\x83\x80\xf2\xc1\x15\x74\x4f"
+                         "\x49\xf9\xb0\x7e\x6f\xdc\x73\x2f"
+                         "\xe2\xcf\xe0\x1b\x34\xa5\xa0\x52"
+                         "\xfb\x3c\x5d\x85\x91\xe6\x6d\x98"
+                         "\x04\xd6\xdd\x4c\x00\x64\xd9\x54"
+                         "\x5c\x3c\x08\x1d\x4c\x06\x9f\xb8"
+                         "\x1c\x4d\x8d\xdc\xa4\x3c\xb9\x3b"
+                         "\x9e\x85\xce\xc3\xa8\x4a\x0c\xd9"
+                         "\x04\xc3\x6f\x17\x66\xa9\x1f\x59"
+                         "\xd9\xe2\x19\x36\xa3\x88\xb8\x0b"
+                         "\x0f\x4a\x4d\xf8\xc8\x6f\xd5\x43"
+                         "\xeb\xa0\xab\x1f\x61\xc0\x06\xeb"
+                         "\x93\xb7\xb8\x6f\x0d\xbd\x07\x49"
+                         "\xb3\xac\x5d\xcf\x31\xa0\x27\x26"
+                         "\x21\xbe\x94\x2e\x19\xea\xf4\xee"
+                         "\xb5\x13\x89\xf7\x94\x0b\xef\x59"
+                         "\x44\xc5\x78\x8b\x3c\x3b\x71\x20"
+                         "\xf9\x35\x0c\x70\x74\xdc\x5b\xc2"
+                         "\xb4\x11\x0e\x2c\x61\xa1\x52\x46"
+                         "\x18\x11\x16\xc6\x86\x44\xa7\xaf"
+                         "\xd5\x0c\x7d\xa6\x9e\x25\x2d\x1b"
+                         "\x9a\x8f\x0f\xf8\x6a\x61\xa0\xea"
+                         "\x3f\x0e\x90\xd6\x8f\x83\x30\x64"
+                         "\xb5\x51\x2d\x08\x3c\xcd\x99\x36"
+                         "\x96\xd4\xb1\xb5\x48\x30\xca\x48"
+                         "\xf7\x11\xa8\xf5\x97\x8a\x6a\x6d"
+                         "\x12\x33\x2f\xc0\xe8\xda\xec\x8a"
+                         "\xe1\x88\x72\x63\xde\x20\xa3\xe1"
+                         "\x8e\xac\x84\x37\x35\xf5\xf7\x3f"
+                         "\x00\x02\x0e\xe4\xc1\x53\x68\x3f"
+                         "\xaa\xd5\xac\x52\x3d\x20\x2f\x4d"
+                         "\x7c\x83\xd0\xbd\xaa\x97\x35\x36"
+                         "\x98\x88\x59\x5d\xe7\x24\xe3\x90"
+                         "\x9d\x30\x47\xa7\xc3\x60\x35\xf4"
+                         "\xd5\xdb\x0e\x4d\x44\xc1\x81\x8b"
+                         "\xfd\xbd\xc3\x2b\xba\x68\xfe\x8d"
+                         "\x49\x5a\x3c\x8a\xa3\x01\xae\x25"
+                         "\x42\xab\xd2\x87\x1b\x35\xd6\xd2"
+                         "\xd7\x70\x1c\x1f\x72\xd1\xe1\x39"
+                         "\x1c\x58\xa2\xb4\xd0\x78\x55\x72"
+                         "\x76\x59\xea\xd9\xd7\x6e\x63\x8b"
+                         "\xcc\x9b\xa7\x74\x89\xfc\xa3\x68"
+                         "\x86\x28\xd1\xbb\x54\x8d\x66\xad"
+                         "\x2a\x92\xf9\x4e\x04\x3d\xae\xfd"
+                         "\x1b\x2b\x7f\xc3\x2f\x1a\x78\x0a"
+                         "\x5c\xc6\x84\xfe\x7c\xcb\x26\xfd"
+                         "\xd9\x51\x0f\xd7\x94\x2f\xc5\xa7",
+               .rlen   = 512,
+               .also_non_np = 1,
+               .np     = 3,
+               .tap    = { 512 - 20, 4, 16 },
+       },
+};
+
+static const struct cipher_testvec serpent_lrw_dec_tv_template[] = {
+       /* Generated from AES-LRW test vectors */
+       /* same as enc vectors with input and result reversed */
+       {
+               .key    = "\x45\x62\xac\x25\xf8\x28\x17\x6d"
+                         "\x4c\x26\x84\x14\xb5\x68\x01\x85"
+                         "\x25\x8e\x2a\x05\xe7\x3e\x9d\x03"
+                         "\xee\x5a\x83\x0c\xcc\x09\x4c\x87",
+               .klen   = 32,
+               .iv     = "\x00\x00\x00\x00\x00\x00\x00\x00"
+                         "\x00\x00\x00\x00\x00\x00\x00\x01",
+               .input  = "\x6f\xbf\xd4\xa4\x5d\x71\x16\x79"
+                         "\x63\x9c\xa6\x8e\x40\xbe\x0d\x8a",
+               .ilen   = 16,
+               .result = "\x30\x31\x32\x33\x34\x35\x36\x37"
+                         "\x38\x39\x41\x42\x43\x44\x45\x46",
+               .rlen   = 16,
+       }, {
+               .key    = "\x59\x70\x47\x14\xf5\x57\x47\x8c"
+                         "\xd7\x79\xe8\x0f\x54\x88\x79\x44"
+                         "\x0d\x48\xf0\xb7\xb1\x5a\x53\xea"
+                         "\x1c\xaa\x6b\x29\xc2\xca\xfb\xaf",
+               .klen   = 32,
+               .iv     = "\x00\x00\x00\x00\x00\x00\x00\x00"
+                         "\x00\x00\x00\x00\x00\x00\x00\x02",
+               .input  = "\xfd\xb2\x66\x98\x80\x96\x55\xad"
+                         "\x08\x94\x54\x9c\x21\x7c\x69\xe3",
+               .ilen   = 16,
+               .result = "\x30\x31\x32\x33\x34\x35\x36\x37"
+                         "\x38\x39\x41\x42\x43\x44\x45\x46",
+               .rlen   = 16,
+       }, {
+               .key    = "\xd8\x2a\x91\x34\xb2\x6a\x56\x50"
+                         "\x30\xfe\x69\xe2\x37\x7f\x98\x47"
+                         "\xcd\xf9\x0b\x16\x0c\x64\x8f\xb6"
+                         "\xb0\x0d\x0d\x1b\xae\x85\x87\x1f",
+               .klen   = 32,
+               .iv     = "\x00\x00\x00\x00\x00\x00\x00\x00"
+                         "\x00\x00\x00\x02\x00\x00\x00\x00",
+               .input  = "\x14\x5e\x3d\x70\xc0\x6e\x9c\x34"
+                         "\x5b\x5e\xcf\x0f\xe4\x8c\x21\x5c",
+               .ilen   = 16,
+               .result = "\x30\x31\x32\x33\x34\x35\x36\x37"
+                         "\x38\x39\x41\x42\x43\x44\x45\x46",
+               .rlen   = 16,
+       }, {
+               .key    = "\x0f\x6a\xef\xf8\xd3\xd2\xbb\x15"
+                         "\x25\x83\xf7\x3c\x1f\x01\x28\x74"
+                         "\xca\xc6\xbc\x35\x4d\x4a\x65\x54"
+                         "\x90\xae\x61\xcf\x7b\xae\xbd\xcc"
+                         "\xad\xe4\x94\xc5\x4a\x29\xae\x70",
+               .klen   = 40,
+               .iv     = "\x00\x00\x00\x00\x00\x00\x00\x00"
+                         "\x00\x00\x00\x00\x00\x00\x00\x01",
+               .input  = "\x25\x39\xaa\xa5\xf0\x65\xc8\xdc"
+                         "\x5d\x45\x95\x30\x8f\xff\x2f\x1b",
+               .ilen   = 16,
+               .result = "\x30\x31\x32\x33\x34\x35\x36\x37"
+                         "\x38\x39\x41\x42\x43\x44\x45\x46",
+               .rlen   = 16,
+       }, {
+               .key    = "\x8a\xd4\xee\x10\x2f\xbd\x81\xff"
+                         "\xf8\x86\xce\xac\x93\xc5\xad\xc6"
+                         "\xa0\x19\x07\xc0\x9d\xf7\xbb\xdd"
+                         "\x52\x13\xb2\xb7\xf0\xff\x11\xd8"
+                         "\xd6\x08\xd0\xcd\x2e\xb1\x17\x6f",
+               .klen   = 40,
+               .iv     = "\x00\x00\x00\x00\x00\x00\x00\x00"
+                         "\x00\x00\x00\x02\x00\x00\x00\x00",
+               .input  = "\x0c\x20\x20\x63\xd6\x8b\xfc\x8f"
+                         "\xc0\xe2\x17\xbb\xd2\x59\x6f\x26",
+               .ilen   = 16,
+               .result = "\x30\x31\x32\x33\x34\x35\x36\x37"
+                         "\x38\x39\x41\x42\x43\x44\x45\x46",
+               .rlen   = 16,
+       }, {
+               .key    = "\xf8\xd4\x76\xff\xd6\x46\xee\x6c"
+                         "\x23\x84\xcb\x1c\x77\xd6\x19\x5d"
+                         "\xfe\xf1\xa9\xf3\x7b\xbc\x8d\x21"
+                         "\xa7\x9c\x21\xf8\xcb\x90\x02\x89"
+                         "\xa8\x45\x34\x8e\xc8\xc5\xb5\xf1"
+                         "\x26\xf5\x0e\x76\xfe\xfd\x1b\x1e",
+               .klen   = 48,
+               .iv     = "\x00\x00\x00\x00\x00\x00\x00\x00"
+                         "\x00\x00\x00\x00\x00\x00\x00\x01",
+               .input  = "\xc1\x35\x2e\x53\xf0\x96\x4d\x9c"
+                         "\x2e\x18\xe6\x99\xcd\xd3\x15\x68",
+               .ilen   = 16,
+               .result = "\x30\x31\x32\x33\x34\x35\x36\x37"
+                         "\x38\x39\x41\x42\x43\x44\x45\x46",
+               .rlen   = 16,
+       }, {
+               .key    = "\xfb\x76\x15\xb2\x3d\x80\x89\x1d"
+                         "\xd4\x70\x98\x0b\xc7\x95\x84\xc8"
+                         "\xb2\xfb\x64\xce\x60\x97\x87\x8d"
+                         "\x17\xfc\xe4\x5a\x49\xe8\x30\xb7"
+                         "\x6e\x78\x17\xe7\x2d\x5e\x12\xd4"
+                         "\x60\x64\x04\x7a\xf1\x2f\x9e\x0c",
+               .klen   = 48,
+               .iv     = "\x00\x00\x00\x00\x00\x00\x00\x00"
+                         "\x00\x00\x00\x02\x00\x00\x00\x00",
+               .input  = "\x86\x0a\xc6\xa9\x1a\x9f\xe7\xe6"
+                         "\x64\x3b\x33\xd6\xd5\x84\xd6\xdf",
+               .ilen   = 16,
+               .result = "\x30\x31\x32\x33\x34\x35\x36\x37"
+                         "\x38\x39\x41\x42\x43\x44\x45\x46",
+               .rlen   = 16,
+       }, {
+               .key    = "\xf8\xd4\x76\xff\xd6\x46\xee\x6c"
+                         "\x23\x84\xcb\x1c\x77\xd6\x19\x5d"
+                         "\xfe\xf1\xa9\xf3\x7b\xbc\x8d\x21"
+                         "\xa7\x9c\x21\xf8\xcb\x90\x02\x89"
+                         "\xa8\x45\x34\x8e\xc8\xc5\xb5\xf1"
+                         "\x26\xf5\x0e\x76\xfe\xfd\x1b\x1e",
+               .klen   = 48,
+               .iv     = "\x00\x00\x00\x00\x00\x00\x00\x00"
+                         "\x00\x00\x00\x00\x00\x00\x00\x01",
+               .input  = "\xe3\x5a\x38\x0f\x4d\x92\x3a\x74"
+                         "\x15\xb1\x50\x8c\x9a\xd8\x99\x1d"
+                         "\x82\xec\xf1\x5f\x03\x6d\x02\x58"
+                         "\x90\x67\xfc\xdd\x8d\xe1\x38\x08"
+                         "\x7b\xc9\x9b\x4b\x04\x09\x50\x15"
+                         "\xce\xab\xda\x33\x30\x20\x12\xfa"
+                         "\x83\xc4\xa6\x9a\x2e\x7d\x90\xd9"
+                         "\xa6\xa6\x67\x43\xb4\xa7\xa8\x5c"
+                         "\xbb\x6a\x49\x2b\x8b\xf8\xd0\x22"
+                         "\xe5\x9e\xba\xe8\x8c\x67\xb8\x5b"
+                         "\x60\xbc\xf5\xa4\x95\x4e\x66\xe5"
+                         "\x6d\x8e\xa9\xf6\x65\x2e\x04\xf5"
+                         "\xba\xb5\xdb\x88\xc2\xf6\x7a\x4b"
+                         "\x89\x58\x7c\x9a\xae\x26\xe8\xb7"
+                         "\xb7\x28\xcc\xd6\xcc\xa5\x98\x4d"
+                         "\xb9\x91\xcb\xb4\xe4\x8b\x96\x47"
+                         "\x5f\x03\x8b\xdd\x94\xd1\xee\x12"
+                         "\xa7\x83\x80\xf2\xc1\x15\x74\x4f"
+                         "\x49\xf9\xb0\x7e\x6f\xdc\x73\x2f"
+                         "\xe2\xcf\xe0\x1b\x34\xa5\xa0\x52"
+                         "\xfb\x3c\x5d\x85\x91\xe6\x6d\x98"
+                         "\x04\xd6\xdd\x4c\x00\x64\xd9\x54"
+                         "\x5c\x3c\x08\x1d\x4c\x06\x9f\xb8"
+                         "\x1c\x4d\x8d\xdc\xa4\x3c\xb9\x3b"
+                         "\x9e\x85\xce\xc3\xa8\x4a\x0c\xd9"
+                         "\x04\xc3\x6f\x17\x66\xa9\x1f\x59"
+                         "\xd9\xe2\x19\x36\xa3\x88\xb8\x0b"
+                         "\x0f\x4a\x4d\xf8\xc8\x6f\xd5\x43"
+                         "\xeb\xa0\xab\x1f\x61\xc0\x06\xeb"
+                         "\x93\xb7\xb8\x6f\x0d\xbd\x07\x49"
+                         "\xb3\xac\x5d\xcf\x31\xa0\x27\x26"
+                         "\x21\xbe\x94\x2e\x19\xea\xf4\xee"
+                         "\xb5\x13\x89\xf7\x94\x0b\xef\x59"
+                         "\x44\xc5\x78\x8b\x3c\x3b\x71\x20"
+                         "\xf9\x35\x0c\x70\x74\xdc\x5b\xc2"
+                         "\xb4\x11\x0e\x2c\x61\xa1\x52\x46"
+                         "\x18\x11\x16\xc6\x86\x44\xa7\xaf"
+                         "\xd5\x0c\x7d\xa6\x9e\x25\x2d\x1b"
+                         "\x9a\x8f\x0f\xf8\x6a\x61\xa0\xea"
+                         "\x3f\x0e\x90\xd6\x8f\x83\x30\x64"
+                         "\xb5\x51\x2d\x08\x3c\xcd\x99\x36"
+                         "\x96\xd4\xb1\xb5\x48\x30\xca\x48"
+                         "\xf7\x11\xa8\xf5\x97\x8a\x6a\x6d"
+                         "\x12\x33\x2f\xc0\xe8\xda\xec\x8a"
+                         "\xe1\x88\x72\x63\xde\x20\xa3\xe1"
+                         "\x8e\xac\x84\x37\x35\xf5\xf7\x3f"
+                         "\x00\x02\x0e\xe4\xc1\x53\x68\x3f"
+                         "\xaa\xd5\xac\x52\x3d\x20\x2f\x4d"
+                         "\x7c\x83\xd0\xbd\xaa\x97\x35\x36"
+                         "\x98\x88\x59\x5d\xe7\x24\xe3\x90"
+                         "\x9d\x30\x47\xa7\xc3\x60\x35\xf4"
+                         "\xd5\xdb\x0e\x4d\x44\xc1\x81\x8b"
+                         "\xfd\xbd\xc3\x2b\xba\x68\xfe\x8d"
+                         "\x49\x5a\x3c\x8a\xa3\x01\xae\x25"
+                         "\x42\xab\xd2\x87\x1b\x35\xd6\xd2"
+                         "\xd7\x70\x1c\x1f\x72\xd1\xe1\x39"
+                         "\x1c\x58\xa2\xb4\xd0\x78\x55\x72"
+                         "\x76\x59\xea\xd9\xd7\x6e\x63\x8b"
+                         "\xcc\x9b\xa7\x74\x89\xfc\xa3\x68"
+                         "\x86\x28\xd1\xbb\x54\x8d\x66\xad"
+                         "\x2a\x92\xf9\x4e\x04\x3d\xae\xfd"
+                         "\x1b\x2b\x7f\xc3\x2f\x1a\x78\x0a"
+                         "\x5c\xc6\x84\xfe\x7c\xcb\x26\xfd"
+                         "\xd9\x51\x0f\xd7\x94\x2f\xc5\xa7",
+               .ilen   = 512,
+               .result = "\x05\x11\xb7\x18\xab\xc6\x2d\xac"
+                         "\x70\x5d\xf6\x22\x94\xcd\xe5\x6c"
+                         "\x17\x6b\xf6\x1c\xf0\xf3\x6e\xf8"
+                         "\x50\x38\x1f\x71\x49\xb6\x57\xd6"
+                         "\x8f\xcb\x8d\x6b\xe3\xa6\x29\x90"
+                         "\xfe\x2a\x62\x82\xae\x6d\x8b\xf6"
+                         "\xad\x1e\x9e\x20\x5f\x38\xbe\x04"
+                         "\xda\x10\x8e\xed\xa2\xa4\x87\xab"
+                         "\xda\x6b\xb4\x0c\x75\xba\xd3\x7c"
+                         "\xc9\xac\x42\x31\x95\x7c\xc9\x04"
+                         "\xeb\xd5\x6e\x32\x69\x8a\xdb\xa6"
+                         "\x15\xd7\x3f\x4f\x2f\x66\x69\x03"
+                         "\x9c\x1f\x54\x0f\xde\x1f\xf3\x65"
+                         "\x4c\x96\x12\xed\x7c\x92\x03\x01"
+                         "\x6f\xbc\x35\x93\xac\xf1\x27\xf1"
+                         "\xb4\x96\x82\x5a\x5f\xb0\xa0\x50"
+                         "\x89\xa4\x8e\x66\x44\x85\xcc\xfd"
+                         "\x33\x14\x70\xe3\x96\xb2\xc3\xd3"
+                         "\xbb\x54\x5a\x1a\xf9\x74\xa2\xc5"
+                         "\x2d\x64\x75\xdd\xb4\x54\xe6\x74"
+                         "\x8c\xd3\x9d\x9e\x86\xab\x51\x53"
+                         "\xb7\x93\x3e\x6f\xd0\x4e\x2c\x40"
+                         "\xf6\xa8\x2e\x3e\x9d\xf4\x66\xa5"
+                         "\x76\x12\x73\x44\x1a\x56\xd7\x72"
+                         "\x88\xcd\x21\x8c\x4c\x0f\xfe\xda"
+                         "\x95\xe0\x3a\xa6\xa5\x84\x46\xcd"
+                         "\xd5\x3e\x9d\x3a\xe2\x67\xe6\x60"
+                         "\x1a\xe2\x70\x85\x58\xc2\x1b\x09"
+                         "\xe1\xd7\x2c\xca\xad\xa8\x8f\xf9"
+                         "\xac\xb3\x0e\xdb\xca\x2e\xe2\xb8"
+                         "\x51\x71\xd9\x3c\x6c\xf1\x56\xf8"
+                         "\xea\x9c\xf1\xfb\x0c\xe6\xb7\x10"
+                         "\x1c\xf8\xa9\x7c\xe8\x53\x35\xc1"
+                         "\x90\x3e\x76\x4a\x74\xa4\x21\x2c"
+                         "\xf6\x2c\x4e\x0f\x94\x3a\x88\x2e"
+                         "\x41\x09\x6a\x33\x7d\xf6\xdd\x3f"
+                         "\x8d\x23\x31\x74\x84\xeb\x88\x6e"
+                         "\xcc\xb9\xbc\x22\x83\x19\x07\x22"
+                         "\xa5\x2d\xdf\xa5\xf3\x80\x85\x78"
+                         "\x84\x39\x6a\x6d\x6a\x99\x4f\xa5"
+                         "\x15\xfe\x46\xb0\xe4\x6c\xa5\x41"
+                         "\x3c\xce\x8f\x42\x60\x71\xa7\x75"
+                         "\x08\x40\x65\x8a\x82\xbf\xf5\x43"
+                         "\x71\x96\xa9\x4d\x44\x8a\x20\xbe"
+                         "\xfa\x4d\xbb\xc0\x7d\x31\x96\x65"
+                         "\xe7\x75\xe5\x3e\xfd\x92\x3b\xc9"
+                         "\x55\xbb\x16\x7e\xf7\xc2\x8c\xa4"
+                         "\x40\x1d\xe5\xef\x0e\xdf\xe4\x9a"
+                         "\x62\x73\x65\xfd\x46\x63\x25\x3d"
+                         "\x2b\xaf\xe5\x64\xfe\xa5\x5c\xcf"
+                         "\x24\xf3\xb4\xac\x64\xba\xdf\x4b"
+                         "\xc6\x96\x7d\x81\x2d\x8d\x97\xf7"
+                         "\xc5\x68\x77\x84\x32\x2b\xcc\x85"
+                         "\x74\x96\xf0\x12\x77\x61\xb9\xeb"
+                         "\x71\xaa\x82\xcb\x1c\xdb\x89\xc8"
+                         "\xc6\xb5\xe3\x5c\x7d\x39\x07\x24"
+                         "\xda\x39\x87\x45\xc0\x2b\xbb\x01"
+                         "\xac\xbc\x2a\x5c\x7f\xfc\xe8\xce"
+                         "\x6d\x9c\x6f\xed\xd3\xc1\xa1\xd6"
+                         "\xc5\x55\xa9\x66\x2f\xe1\xc8\x32"
+                         "\xa6\x5d\xa4\x3a\x98\x73\xe8\x45"
+                         "\xa4\xc7\xa8\xb4\xf6\x13\x03\xf6"
+                         "\xe9\x2e\xc4\x29\x0f\x84\xdb\xc4"
+                         "\x21\xc4\xc2\x75\x67\x89\x37\x0a",
+               .rlen   = 512,
+               .also_non_np = 1,
+               .np     = 3,
+               .tap    = { 512 - 20, 4, 16 },
+       },
+};
+
+static const struct cipher_testvec serpent_xts_enc_tv_template[] = {
+       /* Generated from AES-XTS test vectors */
+       {
+               .key    = "\x00\x00\x00\x00\x00\x00\x00\x00"
+                         "\x00\x00\x00\x00\x00\x00\x00\x00"
+                         "\x00\x00\x00\x00\x00\x00\x00\x00"
+                         "\x00\x00\x00\x00\x00\x00\x00\x00",
                .klen   = 32,
-               .iv     = "\xE2\x24\x89\xEE\x53\xB8\x1D\x5F"
-                         "\xC4\x29\x8E\xF3\x35\x9A\xFF\x64",
-               .input  = "\x84\x68\xEC\xF2\x1C\x88\x20\xCA"
-                         "\x37\x69\xE3\x3A\x22\x85\x48\x46"
-                         "\x70\xAA\x25\xB4\xCD\x8B\x04\x4E"
-                         "\x8D\x15\x2B\x98\xDF\x7B\x6D\xB9"
-                         "\xE0\x4A\x73\x00\x65\xB6\x1A\x0D"
-                         "\x5C\x60\xDF\x34\xDC\x60\x4C\xDF"
-                         "\xB5\x1F\x26\x8C\xDA\xC1\x11\xA8"
-                         "\x80\xFA\x37\x7A\x89\xAA\xAE\x7B"
-                         "\x92\x6E\xB9\xDC\xC9\x62\x4F\x88"
-                         "\x0A\x5D\x97\x2F\x6B\xAC\x03\x7C"
-                         "\x22\xF6\x55\x5A\xFA\x35\xA5\x17"
-                         "\xA1\x5C\x5E\x2B\x63\x2D\xB9\x91"
-                         "\x3E\x83\x26\x00\x4E\xD5\xBE\xCE"
-                         "\x79\xC4\x3D\xFC\x70\xA0\xAD\x96"
-                         "\xBA\x58\x2A\x1C\xDF\xC2\x3A\xA5"
-                         "\x7C\xB5\x12\x89\xED\xBF\xB6\x09"
-                         "\x13\x4F\x7D\x61\x3C\x5C\x27\xFC"
-                         "\x5D\xE1\x4F\xA1\xEA\xB3\xCA\xB9"
-                         "\xE6\xD0\x97\x81\xDE\xD1\xFB\x8A"
-                         "\x30\xDB\xA3\x5D\xEC\x25\x0B\x86"
-                         "\x71\xC8\xA7\x67\xE8\xBC\x7D\x4C"
-                         "\xAE\x82\xD3\x73\x31\x09\xCB\xB3"
-                         "\x4D\xD4\xC0\x8A\x2B\xFA\xA6\x55"
-                         "\x39\x0A\xBC\x6E\x75\xAB\xC2\xE2"
-                         "\x8A\xF2\x26\xCD\x63\x38\x35\xF7"
-                         "\xAE\x12\x83\xCD\x8A\x9E\x7E\x4C"
-                         "\xFE\x4D\xD7\xCE\x5C\x6E\x4C\xAF"
-                         "\xE3\xCD\x76\xA7\x87\xA1\x54\x7C"
-                         "\xEC\x32\xC7\x83\x2A\xFF\xF8\xEA"
-                         "\x87\xB2\x47\xA3\x9D\xC2\x9C\xA2"
-                         "\xB7\x2C\x7C\x1A\x24\xCB\x88\x61"
-                         "\xFF\xA7\x1A\x16\x01\xDD\x4B\xFC"
-                         "\x2E\xE0\x48\x67\x09\x42\xCC\x91"
-                         "\xBE\x20\x38\xC0\x5E\x3B\x95\x00"
-                         "\xA1\x96\x66\x0B\x8A\xE9\x9E\xF7"
-                         "\x6B\x34\x0A\x51\xC0\x3B\xEB\x71"
-                         "\x07\x97\x38\x4B\x5C\x56\x98\x67"
-                         "\x78\x9C\xD0\x0E\x2B\xB5\x67\x90"
-                         "\x75\xF8\xFE\x6D\x4E\x85\xCC\x0D"
-                         "\x18\x06\x15\x9D\x5A\x10\x13\x37"
-                         "\xA3\xD6\x68\xA2\xDF\x7E\xC7\x12"
-                         "\xC9\x0D\x4D\x91\xB0\x2A\x55\xFF"
-                         "\x6F\x73\x13\xDF\x28\xB5\x2A\x2C"
-                         "\xE4\xFC\x20\xD9\xF1\x7A\x82\xB1"
-                         "\xCB\x57\xB6\x3D\x8C\xF4\x8E\x27"
-                         "\x37\xDC\x35\xF3\x79\x01\x53\xA4"
-                         "\x7B\x37\xDE\x7C\x04\xAE\x50\xDB"
-                         "\x9B\x1E\x8C\x07\xA7\x52\x49\x50"
-                         "\x34\x25\x65\xDD\xA9\x8F\x7E\xBD"
-                         "\x7A\xC9\x36\xAE\xDE\x21\x48\x64"
-                         "\xC2\x02\xBA\xBE\x11\x1E\x3D\x9C"
-                         "\x98\x52\xCC\x04\xBD\x5E\x61\x26"
-                         "\x10\xD3\x21\xD9\x6E\x25\x98\x77"
-                         "\x8E\x98\x63\xF6\xF6\x52\xFB\x13"
-                         "\xAA\x30\xF2\xB9\xA4\x43\x53\x39"
-                         "\x1C\x97\x07\x7E\x6B\xFF\x3D\x43"
-                         "\xA6\x71\x6B\x66\x8F\x58\x3F\x71"
-                         "\x90\x47\x40\x92\xE6\x69\xD1\x96"
-                         "\x34\xB3\x3B\xE5\x43\xE4\xD5\x56"
-                         "\xB2\xE6\x7E\x86\x7A\x12\x17\x5B"
-                         "\x30\xF3\x9B\x0D\xFA\x57\xE4\x50"
-                         "\x40\x53\x77\x8C\x15\xF8\x8D\x13"
-                         "\x38\xE2\xE5",
-               .ilen   = 499,
-               .result = "\x56\xED\x84\x1B\x8F\x26\xBD\x31"
-                         "\xC8\x5F\xF6\x6A\x01\x98\x0C\xA3"
-                         "\x3A\xD1\x45\xDC\x73\x0A\x7E\x15"
-                         "\xAC\x20\xB7\x4E\xE5\x59\xF0\x87"
-                         "\x1E\x92\x29\xC0\x34\xCB\x62\xF9"
-                         "\x6D\x04\x9B\x0F\xA6\x3D\xD4\x48"
-                         "\xDF\x76\x0D\x81\x18\xAF\x23\xBA"
-                         "\x51\xE8\x5C\xF3\x8A\x21\x95\x2C"
-                         "\xC3\x37\xCE\x65\xFC\x70\x07\x9E"
-                         "\x12\xA9\x40\xD7\x4B\xE2\x79\x10"
-                         "\x84\x1B\xB2\x26\xBD\x54\xEB\x5F"
-                         "\xF6\x8D\x01\x98\x2F\xC6\x3A\xD1"
-                         "\x68\xFF\x73\x0A\xA1\x15\xAC\x43"
-                         "\xDA\x4E\xE5\x7C\x13\x87\x1E\xB5"
-                         "\x29\xC0\x57\xEE\x62\xF9\x90\x04"
-                         "\x9B\x32\xC9\x3D\xD4\x6B\x02\x76"
-                         "\x0D\xA4\x18\xAF\x46\xDD\x51\xE8"
-                         "\x7F\x16\x8A\x21\xB8\x2C\xC3\x5A"
-                         "\xF1\x65\xFC\x93\x07\x9E\x35\xCC"
-                         "\x40\xD7\x6E\x05\x79\x10\xA7\x1B"
-                         "\xB2\x49\xE0\x54\xEB\x82\x19\x8D"
-                         "\x24\xBB\x2F\xC6\x5D\xF4\x68\xFF"
-                         "\x96\x0A\xA1\x38\xCF\x43\xDA\x71"
-                         "\x08\x7C\x13\xAA\x1E\xB5\x4C\xE3"
-                         "\x57\xEE\x85\x1C\x90\x27\xBE\x32"
-                         "\xC9\x60\xF7\x6B\x02\x99\x0D\xA4"
-                         "\x3B\xD2\x46\xDD\x74\x0B\x7F\x16"
-                         "\xAD\x21\xB8\x4F\xE6\x5A\xF1\x88"
-                         "\x1F\x93\x2A\xC1\x35\xCC\x63\xFA"
-                         "\x6E\x05\x9C\x10\xA7\x3E\xD5\x49"
-                         "\xE0\x77\x0E\x82\x19\xB0\x24\xBB"
-                         "\x52\xE9\x5D\xF4\x8B\x22\x96\x2D"
-                         "\xC4\x38\xCF\x66\xFD\x71\x08\x9F"
-                         "\x13\xAA\x41\xD8\x4C\xE3\x7A\x11"
-                         "\x85\x1C\xB3\x27\xBE\x55\xEC\x60"
-                         "\xF7\x8E\x02\x99\x30\xC7\x3B\xD2"
-                         "\x69\x00\x74\x0B\xA2\x16\xAD\x44"
-                         "\xDB\x4F\xE6\x7D\x14\x88\x1F\xB6"
-                         "\x2A\xC1\x58\xEF\x63\xFA\x91\x05"
-                         "\x9C\x33\xCA\x3E\xD5\x6C\x03\x77"
-                         "\x0E\xA5\x19\xB0\x47\xDE\x52\xE9"
-                         "\x80\x17\x8B\x22\xB9\x2D\xC4\x5B"
-                         "\xF2\x66\xFD\x94\x08\x9F\x36\xCD"
-                         "\x41\xD8\x6F\x06\x7A\x11\xA8\x1C"
-                         "\xB3\x4A\xE1\x55\xEC\x83\x1A\x8E"
-                         "\x25\xBC\x30\xC7\x5E\xF5\x69\x00"
-                         "\x97\x0B\xA2\x39\xD0\x44\xDB\x72"
-                         "\x09\x7D\x14\xAB\x1F\xB6\x4D\xE4"
-                         "\x58\xEF\x86\x1D\x91\x28\xBF\x33"
-                         "\xCA\x61\xF8\x6C\x03\x9A\x0E\xA5"
-                         "\x3C\xD3\x47\xDE\x75\x0C\x80\x17"
-                         "\xAE\x22\xB9\x50\xE7\x5B\xF2\x89"
-                         "\x20\x94\x2B\xC2\x36\xCD\x64\xFB"
-                         "\x6F\x06\x9D\x11\xA8\x3F\xD6\x4A"
-                         "\xE1\x78\x0F\x83\x1A\xB1\x25\xBC"
-                         "\x53\xEA\x5E\xF5\x8C\x00\x97\x2E"
-                         "\xC5\x39\xD0\x67\xFE\x72\x09\xA0"
-                         "\x14\xAB\x42\xD9\x4D\xE4\x7B\x12"
-                         "\x86\x1D\xB4\x28\xBF\x56\xED\x61"
-                         "\xF8\x8F\x03\x9A\x31\xC8\x3C\xD3"
-                         "\x6A\x01\x75\x0C\xA3\x17\xAE\x45"
-                         "\xDC\x50\xE7\x7E\x15\x89\x20\xB7"
-                         "\x2B\xC2\x59",
-               .rlen   = 499,
+               .iv     = "\x00\x00\x00\x00\x00\x00\x00\x00"
+                         "\x00\x00\x00\x00\x00\x00\x00\x00",
+               .input  = "\x00\x00\x00\x00\x00\x00\x00\x00"
+                         "\x00\x00\x00\x00\x00\x00\x00\x00"
+                         "\x00\x00\x00\x00\x00\x00\x00\x00"
+                         "\x00\x00\x00\x00\x00\x00\x00\x00",
+               .ilen   = 32,
+               .result = "\xe1\x08\xb8\x1d\x2c\xf5\x33\x64"
+                         "\xc8\x12\x04\xc7\xb3\x70\xe8\xc4"
+                         "\x6a\x31\xc5\xf3\x00\xca\xb9\x16"
+                         "\xde\xe2\x77\x66\xf7\xfe\x62\x08",
+               .rlen   = 32,
+       }, {
+               .key    = "\x11\x11\x11\x11\x11\x11\x11\x11"
+                         "\x11\x11\x11\x11\x11\x11\x11\x11"
+                         "\x22\x22\x22\x22\x22\x22\x22\x22"
+                         "\x22\x22\x22\x22\x22\x22\x22\x22",
+               .klen   = 32,
+               .iv     = "\x33\x33\x33\x33\x33\x00\x00\x00"
+                         "\x00\x00\x00\x00\x00\x00\x00\x00",
+               .input  = "\x44\x44\x44\x44\x44\x44\x44\x44"
+                         "\x44\x44\x44\x44\x44\x44\x44\x44"
+                         "\x44\x44\x44\x44\x44\x44\x44\x44"
+                         "\x44\x44\x44\x44\x44\x44\x44\x44",
+               .ilen   = 32,
+               .result = "\x1a\x0a\x09\x5f\xcd\x07\x07\x98"
+                         "\x41\x86\x12\xaf\xb3\xd7\x68\x13"
+                         "\xed\x81\xcd\x06\x87\x43\x1a\xbb"
+                         "\x13\x3d\xd6\x1e\x2b\xe1\x77\xbe",
+               .rlen   = 32,
+       }, {
+               .key    = "\xff\xfe\xfd\xfc\xfb\xfa\xf9\xf8"
+                         "\xf7\xf6\xf5\xf4\xf3\xf2\xf1\xf0"
+                         "\x22\x22\x22\x22\x22\x22\x22\x22"
+                         "\x22\x22\x22\x22\x22\x22\x22\x22",
+               .klen   = 32,
+               .iv     = "\x33\x33\x33\x33\x33\x00\x00\x00"
+                         "\x00\x00\x00\x00\x00\x00\x00\x00",
+               .input  = "\x44\x44\x44\x44\x44\x44\x44\x44"
+                         "\x44\x44\x44\x44\x44\x44\x44\x44"
+                         "\x44\x44\x44\x44\x44\x44\x44\x44"
+                         "\x44\x44\x44\x44\x44\x44\x44\x44",
+               .ilen   = 32,
+               .result = "\xf9\x9b\x28\xb8\x5c\xaf\x8c\x61"
+                         "\xb6\x1c\x81\x8f\x2c\x87\x60\x89"
+                         "\x0d\x8d\x7a\xe8\x60\x48\xcc\x86"
+                         "\xc1\x68\x45\xaa\x00\xe9\x24\xc5",
+               .rlen   = 32,
+       }, {
+               .key    = "\x27\x18\x28\x18\x28\x45\x90\x45"
+                         "\x23\x53\x60\x28\x74\x71\x35\x26"
+                         "\x31\x41\x59\x26\x53\x58\x97\x93"
+                         "\x23\x84\x62\x64\x33\x83\x27\x95",
+               .klen   = 32,
+               .iv     = "\x00\x00\x00\x00\x00\x00\x00\x00"
+                         "\x00\x00\x00\x00\x00\x00\x00\x00",
+               .input  = "\x00\x01\x02\x03\x04\x05\x06\x07"
+                         "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f"
+                         "\x10\x11\x12\x13\x14\x15\x16\x17"
+                         "\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f"
+                         "\x20\x21\x22\x23\x24\x25\x26\x27"
+                         "\x28\x29\x2a\x2b\x2c\x2d\x2e\x2f"
+                         "\x30\x31\x32\x33\x34\x35\x36\x37"
+                         "\x38\x39\x3a\x3b\x3c\x3d\x3e\x3f"
+                         "\x40\x41\x42\x43\x44\x45\x46\x47"
+                         "\x48\x49\x4a\x4b\x4c\x4d\x4e\x4f"
+                         "\x50\x51\x52\x53\x54\x55\x56\x57"
+                         "\x58\x59\x5a\x5b\x5c\x5d\x5e\x5f"
+                         "\x60\x61\x62\x63\x64\x65\x66\x67"
+                         "\x68\x69\x6a\x6b\x6c\x6d\x6e\x6f"
+                         "\x70\x71\x72\x73\x74\x75\x76\x77"
+                         "\x78\x79\x7a\x7b\x7c\x7d\x7e\x7f"
+                         "\x80\x81\x82\x83\x84\x85\x86\x87"
+                         "\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f"
+                         "\x90\x91\x92\x93\x94\x95\x96\x97"
+                         "\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f"
+                         "\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7"
+                         "\xa8\xa9\xaa\xab\xac\xad\xae\xaf"
+                         "\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7"
+                         "\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf"
+                         "\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7"
+                         "\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf"
+                         "\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7"
+                         "\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf"
+                         "\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7"
+                         "\xe8\xe9\xea\xeb\xec\xed\xee\xef"
+                         "\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7"
+                         "\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff"
+                         "\x00\x01\x02\x03\x04\x05\x06\x07"
+                         "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f"
+                         "\x10\x11\x12\x13\x14\x15\x16\x17"
+                         "\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f"
+                         "\x20\x21\x22\x23\x24\x25\x26\x27"
+                         "\x28\x29\x2a\x2b\x2c\x2d\x2e\x2f"
+                         "\x30\x31\x32\x33\x34\x35\x36\x37"
+                         "\x38\x39\x3a\x3b\x3c\x3d\x3e\x3f"
+                         "\x40\x41\x42\x43\x44\x45\x46\x47"
+                         "\x48\x49\x4a\x4b\x4c\x4d\x4e\x4f"
+                         "\x50\x51\x52\x53\x54\x55\x56\x57"
+                         "\x58\x59\x5a\x5b\x5c\x5d\x5e\x5f"
+                         "\x60\x61\x62\x63\x64\x65\x66\x67"
+                         "\x68\x69\x6a\x6b\x6c\x6d\x6e\x6f"
+                         "\x70\x71\x72\x73\x74\x75\x76\x77"
+                         "\x78\x79\x7a\x7b\x7c\x7d\x7e\x7f"
+                         "\x80\x81\x82\x83\x84\x85\x86\x87"
+                         "\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f"
+                         "\x90\x91\x92\x93\x94\x95\x96\x97"
+                         "\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f"
+                         "\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7"
+                         "\xa8\xa9\xaa\xab\xac\xad\xae\xaf"
+                         "\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7"
+                         "\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf"
+                         "\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7"
+                         "\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf"
+                         "\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7"
+                         "\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf"
+                         "\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7"
+                         "\xe8\xe9\xea\xeb\xec\xed\xee\xef"
+                         "\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7"
+                         "\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff",
+               .ilen   = 512,
+               .result = "\xfe\x47\x4a\xc8\x60\x7e\xb4\x8b"
+                         "\x0d\x10\xf4\xb0\x0d\xba\xf8\x53"
+                         "\x65\x6e\x38\x4b\xdb\xaa\xb1\x9e"
+                         "\x28\xca\xb0\x22\xb3\x85\x75\xf4"
+                         "\x00\x5c\x75\x14\x06\xd6\x25\x82"
+                         "\xe6\xcb\x08\xf7\x29\x90\x23\x8e"
+                         "\xa4\x68\x57\xe4\xf0\xd8\x32\xf3"
+                         "\x80\x51\x67\xb5\x0b\x85\x69\xe8"
+                         "\x19\xfe\xc4\xc7\x3e\xea\x90\xd3"
+                         "\x8f\xa3\xf2\x0a\xac\x17\x4b\xa0"
+                         "\x63\x5a\x16\x0f\xf0\xce\x66\x1f"
+                         "\x2c\x21\x07\xf1\xa4\x03\xa3\x44"
+                         "\x41\x61\x87\x5d\x6b\xb3\xef\xd4"
+                         "\xfc\xaa\x32\x7e\x55\x58\x04\x41"
+                         "\xc9\x07\x33\xc6\xa2\x68\xd6\x5a"
+                         "\x55\x79\x4b\x6f\xcf\x89\xb9\x19"
+                         "\xe5\x54\x13\x15\xb2\x1a\xfa\x15"
+                         "\xc2\xf0\x06\x59\xfa\xa0\x25\x05"
+                         "\x58\xfa\x43\x91\x16\x85\x40\xbb"
+                         "\x0d\x34\x4d\xc5\x1e\x20\xd5\x08"
+                         "\xcd\x22\x22\x41\x11\x9f\x6c\x7c"
+                         "\x8d\x57\xc9\xba\x57\xe8\x2c\xf7"
+                         "\xa0\x42\xa8\xde\xfc\xa3\xca\x98"
+                         "\x4b\x43\xb1\xce\x4b\xbf\x01\x67"
+                         "\x6e\x29\x60\xbd\x10\x14\x84\x82"
+                         "\x83\x82\x0c\x63\x73\x92\x02\x7c"
+                         "\x55\x37\x20\x80\x17\x51\xc8\xbc"
+                         "\x46\x02\xcb\x38\x07\x6d\xe2\x85"
+                         "\xaa\x29\xaf\x24\x58\x0d\xf0\x75"
+                         "\x08\x0a\xa5\x34\x25\x16\xf3\x74"
+                         "\xa7\x0b\x97\xbe\xc1\xa9\xdc\x29"
+                         "\x1a\x0a\x56\xc1\x1a\x91\x97\x8c"
+                         "\x0b\xc7\x16\xed\x5a\x22\xa6\x2e"
+                         "\x8c\x2b\x4f\x54\x76\x47\x53\x8e"
+                         "\xe8\x00\xec\x92\xb9\x55\xe6\xa2"
+                         "\xf3\xe2\x4f\x6a\x66\x60\xd0\x87"
+                         "\xe6\xd1\xcc\xe3\x6a\xc5\x2d\x21"
+                         "\xcc\x9d\x6a\xb6\x75\xaa\xe2\x19"
+                         "\x21\x9f\xa1\x5e\x4c\xfd\x72\xf9"
+                         "\x94\x4e\x63\xc7\xae\xfc\xed\x47"
+                         "\xe2\xfe\x7a\x63\x77\xfe\x97\x82"
+                         "\xb1\x10\x6e\x36\x1d\xe1\xc4\x80"
+                         "\xec\x69\x41\xec\xa7\x8a\xe0\x2f"
+                         "\xe3\x49\x26\xa2\x41\xb2\x08\x0f"
+                         "\x28\xb4\xa7\x39\xa1\x99\x2d\x1e"
+                         "\x43\x42\x35\xd0\xcf\xec\x77\x67"
+                         "\xb2\x3b\x9e\x1c\x35\xde\x4f\x5e"
+                         "\x73\x3f\x5d\x6f\x07\x4b\x2e\x50"
+                         "\xab\x6c\x6b\xff\xea\x00\x67\xaa"
+                         "\x0e\x82\x32\xdd\x3d\xb5\xe5\x76"
+                         "\x2b\x77\x3f\xbe\x12\x75\xfb\x92"
+                         "\xc6\x89\x67\x4d\xca\xf7\xd4\x50"
+                         "\xc0\x74\x47\xcc\xd9\x0a\xd4\xc6"
+                         "\x3b\x17\x2e\xe3\x35\xbb\x53\xb5"
+                         "\x86\xad\x51\xcc\xd5\x96\xb8\xdc"
+                         "\x03\x57\xe6\x98\x52\x2f\x61\x62"
+                         "\xc4\x5c\x9c\x36\x71\x07\xfb\x94"
+                         "\xe3\x02\xc4\x2b\x08\x75\xc7\x35"
+                         "\xfb\x2e\x88\x7b\xbb\x67\x00\xe1"
+                         "\xc9\xdd\x99\xb2\x13\x53\x1a\x4e"
+                         "\x76\x87\x19\x04\x1a\x2f\x38\x3e"
+                         "\xef\x91\x64\x1d\x18\x07\x4e\x31"
+                         "\x88\x21\x7c\xb0\xa5\x12\x4c\x3c"
+                         "\xb0\x20\xbd\xda\xdf\xf9\x7c\xdd",
+               .rlen   = 512,
+       }, {
+               .key    = "\x27\x18\x28\x18\x28\x45\x90\x45"
+                         "\x23\x53\x60\x28\x74\x71\x35\x26"
+                         "\x62\x49\x77\x57\x24\x70\x93\x69"
+                         "\x99\x59\x57\x49\x66\x96\x76\x27"
+                         "\x31\x41\x59\x26\x53\x58\x97\x93"
+                         "\x23\x84\x62\x64\x33\x83\x27\x95"
+                         "\x02\x88\x41\x97\x16\x93\x99\x37"
+                         "\x51\x05\x82\x09\x74\x94\x45\x92",
+               .klen   = 64,
+               .iv     = "\xff\x00\x00\x00\x00\x00\x00\x00"
+                         "\x00\x00\x00\x00\x00\x00\x00\x00",
+               .input  = "\x00\x01\x02\x03\x04\x05\x06\x07"
+                         "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f"
+                         "\x10\x11\x12\x13\x14\x15\x16\x17"
+                         "\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f"
+                         "\x20\x21\x22\x23\x24\x25\x26\x27"
+                         "\x28\x29\x2a\x2b\x2c\x2d\x2e\x2f"
+                         "\x30\x31\x32\x33\x34\x35\x36\x37"
+                         "\x38\x39\x3a\x3b\x3c\x3d\x3e\x3f"
+                         "\x40\x41\x42\x43\x44\x45\x46\x47"
+                         "\x48\x49\x4a\x4b\x4c\x4d\x4e\x4f"
+                         "\x50\x51\x52\x53\x54\x55\x56\x57"
+                         "\x58\x59\x5a\x5b\x5c\x5d\x5e\x5f"
+                         "\x60\x61\x62\x63\x64\x65\x66\x67"
+                         "\x68\x69\x6a\x6b\x6c\x6d\x6e\x6f"
+                         "\x70\x71\x72\x73\x74\x75\x76\x77"
+                         "\x78\x79\x7a\x7b\x7c\x7d\x7e\x7f"
+                         "\x80\x81\x82\x83\x84\x85\x86\x87"
+                         "\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f"
+                         "\x90\x91\x92\x93\x94\x95\x96\x97"
+                         "\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f"
+                         "\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7"
+                         "\xa8\xa9\xaa\xab\xac\xad\xae\xaf"
+                         "\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7"
+                         "\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf"
+                         "\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7"
+                         "\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf"
+                         "\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7"
+                         "\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf"
+                         "\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7"
+                         "\xe8\xe9\xea\xeb\xec\xed\xee\xef"
+                         "\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7"
+                         "\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff"
+                         "\x00\x01\x02\x03\x04\x05\x06\x07"
+                         "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f"
+                         "\x10\x11\x12\x13\x14\x15\x16\x17"
+                         "\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f"
+                         "\x20\x21\x22\x23\x24\x25\x26\x27"
+                         "\x28\x29\x2a\x2b\x2c\x2d\x2e\x2f"
+                         "\x30\x31\x32\x33\x34\x35\x36\x37"
+                         "\x38\x39\x3a\x3b\x3c\x3d\x3e\x3f"
+                         "\x40\x41\x42\x43\x44\x45\x46\x47"
+                         "\x48\x49\x4a\x4b\x4c\x4d\x4e\x4f"
+                         "\x50\x51\x52\x53\x54\x55\x56\x57"
+                         "\x58\x59\x5a\x5b\x5c\x5d\x5e\x5f"
+                         "\x60\x61\x62\x63\x64\x65\x66\x67"
+                         "\x68\x69\x6a\x6b\x6c\x6d\x6e\x6f"
+                         "\x70\x71\x72\x73\x74\x75\x76\x77"
+                         "\x78\x79\x7a\x7b\x7c\x7d\x7e\x7f"
+                         "\x80\x81\x82\x83\x84\x85\x86\x87"
+                         "\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f"
+                         "\x90\x91\x92\x93\x94\x95\x96\x97"
+                         "\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f"
+                         "\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7"
+                         "\xa8\xa9\xaa\xab\xac\xad\xae\xaf"
+                         "\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7"
+                         "\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf"
+                         "\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7"
+                         "\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf"
+                         "\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7"
+                         "\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf"
+                         "\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7"
+                         "\xe8\xe9\xea\xeb\xec\xed\xee\xef"
+                         "\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7"
+                         "\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff",
+               .ilen   = 512,
+               .result = "\x2b\xc9\xb4\x6b\x10\x94\xa9\x32"
+                         "\xaa\xb0\x20\xc6\x44\x3d\x74\x1f"
+                         "\x75\x01\xa7\xf6\xf5\xf7\x62\x1b"
+                         "\x80\x1b\x82\xcb\x01\x59\x91\x7f"
+                         "\x80\x3a\x98\xf0\xd2\xca\xc4\xc3"
+                         "\x34\xfd\xe6\x11\xf9\x33\x45\x12"
+                         "\x48\xc5\x8c\x25\xf1\xc5\xc5\x23"
+                         "\xd3\x44\xb4\x73\xd5\x04\xc0\xb7"
+                         "\xca\x2f\xf5\xcd\xc5\xb4\xdd\xb0"
+                         "\xf4\x60\xe8\xfb\xc6\x9c\xc5\x78"
+                         "\xcd\xec\x7d\xdc\x19\x9c\x72\x64"
+                         "\x63\x0b\x38\x2e\x76\xdd\x2d\x36"
+                         "\x49\xb0\x1d\xea\x78\x9e\x00\xca"
+                         "\x20\xcc\x1b\x1e\x98\x74\xab\xed"
+                         "\x79\xf7\xd0\x6c\xd8\x93\x80\x29"
+                         "\xac\xa5\x5e\x34\xa9\xab\xa0\x55"
+                         "\x9a\xea\xaa\x95\x4d\x7b\xfe\x46"
+                         "\x26\x8a\xfd\x88\xa2\xa8\xa6\xae"
+                         "\x25\x42\x17\xbf\x76\x8f\x1c\x3d"
+                         "\xec\x9a\xda\x64\x96\xb5\x61\xff"
+                         "\x99\xeb\x12\x96\x85\x82\x9d\xd5"
+                         "\x81\x85\x14\xa8\x59\xac\x8c\x94"
+                         "\xbb\x3b\x85\x2b\xdf\xb3\x0c\xba"
+                         "\x82\xc6\x4d\xca\x86\xea\x53\x28"
+                         "\x4c\xe0\x4e\x31\xe3\x73\x2f\x79"
+                         "\x9d\x42\xe1\x03\xe3\x8b\xc4\xff"
+                         "\x05\xca\x81\x7b\xda\xa2\xde\x63"
+                         "\x3a\x10\xbe\xc2\xac\x32\xc4\x05"
+                         "\x47\x7e\xef\x67\xe2\x5f\x5b\xae"
+                         "\xed\xf1\x70\x34\x16\x9a\x07\x7b"
+                         "\xf2\x25\x2b\xb0\xf8\x3c\x15\x9a"
+                         "\xa6\x59\x55\x5f\xc1\xf4\x1e\xcd"
+                         "\x93\x1f\x06\xba\xd4\x9a\x22\x69"
+                         "\xfa\x8e\x95\x0d\xf3\x23\x59\x2c"
+                         "\xfe\x00\xba\xf0\x0e\xbc\x6d\xd6"
+                         "\x62\xf0\x7a\x0e\x83\x3e\xdb\x32"
+                         "\xfd\x43\x7d\xda\x42\x51\x87\x43"
+                         "\x9d\xf9\xef\xf4\x30\x97\xf8\x09"
+                         "\x88\xfc\x3f\x93\x70\xc1\x4a\xec"
+                         "\x27\x5f\x11\xac\x71\xc7\x48\x46"
+                         "\x2f\xf9\xdf\x8d\x9f\xf7\x2e\x56"
+                         "\x0d\x4e\xb0\x32\x76\xce\x86\x81"
+                         "\xcd\xdf\xe4\x00\xbf\xfd\x5f\x24"
+                         "\xaf\xf7\x9a\xde\xff\x18\xac\x14"
+                         "\x90\xc5\x01\x39\x34\x0f\x24\xf3"
+                         "\x13\x2f\x5e\x4f\x30\x9a\x36\x40"
+                         "\xec\xea\xbc\xcd\x9e\x0e\x5b\x23"
+                         "\x50\x88\x97\x40\x69\xb1\x37\xf5"
+                         "\xc3\x15\xf9\x3f\xb7\x79\x64\xe8"
+                         "\x7b\x10\x20\xb9\x2b\x46\x83\x5b"
+                         "\xd8\x39\xfc\xe4\xfa\x88\x52\xf2"
+                         "\x72\xb0\x97\x4e\x89\xb3\x48\x00"
+                         "\xc1\x16\x73\x50\x77\xba\xa6\x65"
+                         "\x20\x2d\xb0\x02\x27\x89\xda\x99"
+                         "\x45\xfb\xe9\xd3\x1d\x39\x2f\xd6"
+                         "\x2a\xda\x09\x12\x11\xaf\xe6\x57"
+                         "\x01\x04\x8a\xff\x86\x8b\xac\xf8"
+                         "\xee\xe4\x1c\x98\x5b\xcf\x6b\x76"
+                         "\xa3\x0e\x33\x74\x40\x18\x39\x72"
+                         "\x66\x50\x31\xfd\x70\xdf\xe8\x51"
+                         "\x96\x21\x36\xb2\x9b\xfa\x85\xd1"
+                         "\x30\x05\xc8\x92\x98\x80\xff\x7a"
+                         "\xaf\x43\x0b\xc5\x20\x41\x92\x20"
+                         "\xd4\xa0\x91\x98\x11\x5f\x4d\xb1",
+               .rlen   = 512,
                .also_non_np = 1,
-               .np     = 2,
-               .tap    = { 499 - 16, 16 },
-       }, { /* Generated with Crypto++ */
-               .key    = "\x85\x62\x3F\x1C\xF9\xD6\x1C\xF9"
-                         "\xD6\xB3\x90\x6D\x4A\x90\x6D\x4A"
-                         "\x27\x04\xE1\x27\x04\xE1\xBE\x9B"
-                         "\x78\xBE\x9B\x78\x55\x32\x0F\x55",
-               .klen   = 32,
-               .iv     = "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF"
-                         "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFD",
-               .input  = "\x06\x9A\xF8\xB4\x53\x88\x62\xFC"
-                         "\x68\xB8\x2E\xDF\xC1\x05\x0F\x3D"
-                         "\xAF\x4D\x95\xAE\xC4\xE9\x1C\xDC"
-                         "\xF6\x2B\x8F\x90\x89\xF6\x7E\x1A"
-                         "\xA6\xB9\xE4\xF4\xFA\xCA\xE5\x7E"
-                         "\x71\x28\x06\x4F\xE8\x08\x39\xDA"
-                         "\xA5\x0E\xC8\xC0\xB8\x16\xE5\x69"
-                         "\xE5\xCA\xEC\x4F\x63\x2C\xC0\x9B"
-                         "\x9F\x3E\x39\x79\xF0\xCD\x64\x35"
-                         "\x4A\xD3\xC8\xA9\x31\xCD\x48\x5B"
-                         "\x92\x3D\x8F\x3F\x96\xBD\xB3\x18"
-                         "\x74\x2A\x5D\x29\x3F\x57\x8F\xE2"
-                         "\x67\x9A\xE0\xE5\xD4\x4A\xE2\x47"
-                         "\xBC\xF6\xEB\x14\xF3\x8C\x20\xC2"
-                         "\x7D\xE2\x43\x81\x86\x72\x2E\xB1"
-                         "\x39\xF6\x95\xE1\x1F\xCB\x76\x33"
-                         "\x5B\x7D\x23\x0F\x3A\x67\x2A\x2F"
-                         "\xB9\x37\x9D\xDD\x1F\x16\xA1\x3C"
-                         "\x70\xFE\x52\xAA\x93\x3C\xC4\x46"
-                         "\xB1\xE5\xFF\xDA\xAF\xE2\x84\xFE"
-                         "\x25\x92\xB2\x63\xBD\x49\x77\xB4"
-                         "\x22\xA4\x6A\xD5\x04\xE0\x45\x58"
-                         "\x1C\x34\x96\x7C\x03\x0C\x13\xA2"
-                         "\x05\x22\xE2\xCB\x5A\x35\x03\x09"
-                         "\x40\xD2\x82\x05\xCA\x58\x73\xF2"
-                         "\x29\x5E\x01\x47\x13\x32\x78\xBE"
-                         "\x06\xB0\x51\xDB\x6C\x31\xA0\x1C"
-                         "\x74\xBC\x8D\x25\xDF\xF8\x65\xD1"
-                         "\x38\x35\x11\x26\x4A\xB4\x06\x32"
-                         "\xFA\xD2\x07\x77\xB3\x74\x98\x80"
-                         "\x61\x59\xA8\x9F\xF3\x6F\x2A\xBF"
-                         "\xE6\xA5\x9A\xC4\x6B\xA6\x49\x6F"
-                         "\xBC\x47\xD9\xFB\xC6\xEF\x25\x65"
-                         "\x96\xAC\x9F\xE4\x81\x4B\xD8\xBA"
-                         "\xD6\x9B\xC9\x6D\x58\x40\x81\x02"
-                         "\x73\x44\x4E\x43\x6E\x37\xBB\x11"
-                         "\xE3\xF9\xB8\x2F\xEC\x76\x34\xEA"
-                         "\x90\xCD\xB7\x2E\x0E\x32\x71\xE8"
-                         "\xBB\x4E\x0B\x98\xA4\x17\x17\x5B"
-                         "\x07\xB5\x82\x3A\xC4\xE8\x42\x51"
-                         "\x5A\x4C\x4E\x7D\xBF\xC4\xC0\x4F"
-                         "\x68\xB8\xC6\x4A\x32\x6F\x0B\xD7"
-                         "\x85\xED\x6B\xFB\x72\xD2\xA5\x8F"
-                         "\xBF\xF9\xAC\x59\x50\xA8\x08\x70"
-                         "\xEC\xBD\x0A\xBF\xE5\x87\xA1\xC2"
-                         "\x92\x14\x78\xAF\xE8\xEA\x2E\xDD"
-                         "\xC1\x03\x9A\xAA\x89\x8B\x32\x46"
-                         "\x5B\x18\x27\xBA\x46\xAA\x64\xDE"
-                         "\xE3\xD5\xA3\xFC\x7B\x5B\x61\xDB"
-                         "\x7E\xDA\xEC\x30\x17\x19\xF8\x80"
-                         "\xB5\x5E\x27\xB5\x37\x3A\x1F\x28"
-                         "\x07\x73\xC3\x63\xCE\xFF\x8C\xFE"
-                         "\x81\x4E\xF8\x24\xF3\xB8\xC7\xE8"
-                         "\x16\x9A\xCC\x58\x2F\x88\x1C\x4B"
-                         "\xBB\x33\xA2\x73\xF0\x1C\x89\x0E"
-                         "\xDC\x34\x27\x89\x98\xCE\x1C\xA2"
-                         "\xD8\xB8\x90\xBE\xEC\x72\x28\x13"
-                         "\xAC\x7B\xF1\xD0\x7F\x7A\x28\x50"
-                         "\xB7\x99\x65\x8A\xC9\xC6\x21\x34"
-                         "\x7F\x67\x9D\xB7\x2C\xCC\xF5\x17"
-                         "\x2B\x89\xAC\xB0\xD7\x1E\x47\xB0"
-                         "\x61\xAF\xD4\x63\x6D\xB8\x2D\x20",
-               .ilen   = 496,
-               .result = "\x56\xED\x84\x1B\x8F\x26\xBD\x31"
-                         "\xC8\x5F\xF6\x6A\x01\x98\x0C\xA3"
-                         "\x3A\xD1\x45\xDC\x73\x0A\x7E\x15"
-                         "\xAC\x20\xB7\x4E\xE5\x59\xF0\x87"
-                         "\x1E\x92\x29\xC0\x34\xCB\x62\xF9"
-                         "\x6D\x04\x9B\x0F\xA6\x3D\xD4\x48"
-                         "\xDF\x76\x0D\x81\x18\xAF\x23\xBA"
-                         "\x51\xE8\x5C\xF3\x8A\x21\x95\x2C"
-                         "\xC3\x37\xCE\x65\xFC\x70\x07\x9E"
-                         "\x12\xA9\x40\xD7\x4B\xE2\x79\x10"
-                         "\x84\x1B\xB2\x26\xBD\x54\xEB\x5F"
-                         "\xF6\x8D\x01\x98\x2F\xC6\x3A\xD1"
-                         "\x68\xFF\x73\x0A\xA1\x15\xAC\x43"
-                         "\xDA\x4E\xE5\x7C\x13\x87\x1E\xB5"
-                         "\x29\xC0\x57\xEE\x62\xF9\x90\x04"
-                         "\x9B\x32\xC9\x3D\xD4\x6B\x02\x76"
-                         "\x0D\xA4\x18\xAF\x46\xDD\x51\xE8"
-                         "\x7F\x16\x8A\x21\xB8\x2C\xC3\x5A"
-                         "\xF1\x65\xFC\x93\x07\x9E\x35\xCC"
-                         "\x40\xD7\x6E\x05\x79\x10\xA7\x1B"
-                         "\xB2\x49\xE0\x54\xEB\x82\x19\x8D"
-                         "\x24\xBB\x2F\xC6\x5D\xF4\x68\xFF"
-                         "\x96\x0A\xA1\x38\xCF\x43\xDA\x71"
-                         "\x08\x7C\x13\xAA\x1E\xB5\x4C\xE3"
-                         "\x57\xEE\x85\x1C\x90\x27\xBE\x32"
-                         "\xC9\x60\xF7\x6B\x02\x99\x0D\xA4"
-                         "\x3B\xD2\x46\xDD\x74\x0B\x7F\x16"
-                         "\xAD\x21\xB8\x4F\xE6\x5A\xF1\x88"
-                         "\x1F\x93\x2A\xC1\x35\xCC\x63\xFA"
-                         "\x6E\x05\x9C\x10\xA7\x3E\xD5\x49"
-                         "\xE0\x77\x0E\x82\x19\xB0\x24\xBB"
-                         "\x52\xE9\x5D\xF4\x8B\x22\x96\x2D"
-                         "\xC4\x38\xCF\x66\xFD\x71\x08\x9F"
-                         "\x13\xAA\x41\xD8\x4C\xE3\x7A\x11"
-                         "\x85\x1C\xB3\x27\xBE\x55\xEC\x60"
-                         "\xF7\x8E\x02\x99\x30\xC7\x3B\xD2"
-                         "\x69\x00\x74\x0B\xA2\x16\xAD\x44"
-                         "\xDB\x4F\xE6\x7D\x14\x88\x1F\xB6"
-                         "\x2A\xC1\x58\xEF\x63\xFA\x91\x05"
-                         "\x9C\x33\xCA\x3E\xD5\x6C\x03\x77"
-                         "\x0E\xA5\x19\xB0\x47\xDE\x52\xE9"
-                         "\x80\x17\x8B\x22\xB9\x2D\xC4\x5B"
-                         "\xF2\x66\xFD\x94\x08\x9F\x36\xCD"
-                         "\x41\xD8\x6F\x06\x7A\x11\xA8\x1C"
-                         "\xB3\x4A\xE1\x55\xEC\x83\x1A\x8E"
-                         "\x25\xBC\x30\xC7\x5E\xF5\x69\x00"
-                         "\x97\x0B\xA2\x39\xD0\x44\xDB\x72"
-                         "\x09\x7D\x14\xAB\x1F\xB6\x4D\xE4"
-                         "\x58\xEF\x86\x1D\x91\x28\xBF\x33"
-                         "\xCA\x61\xF8\x6C\x03\x9A\x0E\xA5"
-                         "\x3C\xD3\x47\xDE\x75\x0C\x80\x17"
-                         "\xAE\x22\xB9\x50\xE7\x5B\xF2\x89"
-                         "\x20\x94\x2B\xC2\x36\xCD\x64\xFB"
-                         "\x6F\x06\x9D\x11\xA8\x3F\xD6\x4A"
-                         "\xE1\x78\x0F\x83\x1A\xB1\x25\xBC"
-                         "\x53\xEA\x5E\xF5\x8C\x00\x97\x2E"
-                         "\xC5\x39\xD0\x67\xFE\x72\x09\xA0"
-                         "\x14\xAB\x42\xD9\x4D\xE4\x7B\x12"
-                         "\x86\x1D\xB4\x28\xBF\x56\xED\x61"
-                         "\xF8\x8F\x03\x9A\x31\xC8\x3C\xD3"
-                         "\x6A\x01\x75\x0C\xA3\x17\xAE\x45"
-                         "\xDC\x50\xE7\x7E\x15\x89\x20\xB7",
-               .rlen   = 496,
+               .np     = 3,
+               .tap    = { 512 - 20, 4, 16 },
        },
 };
 
-static const struct cipher_testvec serpent_lrw_enc_tv_template[] = {
-       /* Generated from AES-LRW test vectors */
+static const struct cipher_testvec serpent_xts_dec_tv_template[] = {
+       /* Generated from AES-XTS test vectors */
+       /* same as enc vectors with input and result reversed */
        {
-               .key    = "\x45\x62\xac\x25\xf8\x28\x17\x6d"
-                         "\x4c\x26\x84\x14\xb5\x68\x01\x85"
-                         "\x25\x8e\x2a\x05\xe7\x3e\x9d\x03"
-                         "\xee\x5a\x83\x0c\xcc\x09\x4c\x87",
+               .key    = "\x00\x00\x00\x00\x00\x00\x00\x00"
+                         "\x00\x00\x00\x00\x00\x00\x00\x00"
+                         "\x00\x00\x00\x00\x00\x00\x00\x00"
+                         "\x00\x00\x00\x00\x00\x00\x00\x00",
                .klen   = 32,
                .iv     = "\x00\x00\x00\x00\x00\x00\x00\x00"
-                         "\x00\x00\x00\x00\x00\x00\x00\x01",
-               .input  = "\x30\x31\x32\x33\x34\x35\x36\x37"
-                         "\x38\x39\x41\x42\x43\x44\x45\x46",
-               .ilen   = 16,
-               .result = "\x6f\xbf\xd4\xa4\x5d\x71\x16\x79"
-                         "\x63\x9c\xa6\x8e\x40\xbe\x0d\x8a",
-               .rlen   = 16,
+                         "\x00\x00\x00\x00\x00\x00\x00\x00",
+               .input  = "\xe1\x08\xb8\x1d\x2c\xf5\x33\x64"
+                         "\xc8\x12\x04\xc7\xb3\x70\xe8\xc4"
+                         "\x6a\x31\xc5\xf3\x00\xca\xb9\x16"
+                         "\xde\xe2\x77\x66\xf7\xfe\x62\x08",
+               .ilen   = 32,
+               .result = "\x00\x00\x00\x00\x00\x00\x00\x00"
+                         "\x00\x00\x00\x00\x00\x00\x00\x00"
+                         "\x00\x00\x00\x00\x00\x00\x00\x00"
+                         "\x00\x00\x00\x00\x00\x00\x00\x00",
+               .rlen   = 32,
        }, {
-               .key    = "\x59\x70\x47\x14\xf5\x57\x47\x8c"
-                         "\xd7\x79\xe8\x0f\x54\x88\x79\x44"
-                         "\x0d\x48\xf0\xb7\xb1\x5a\x53\xea"
-                         "\x1c\xaa\x6b\x29\xc2\xca\xfb\xaf",
+               .key    = "\x11\x11\x11\x11\x11\x11\x11\x11"
+                         "\x11\x11\x11\x11\x11\x11\x11\x11"
+                         "\x22\x22\x22\x22\x22\x22\x22\x22"
+                         "\x22\x22\x22\x22\x22\x22\x22\x22",
                .klen   = 32,
-               .iv     = "\x00\x00\x00\x00\x00\x00\x00\x00"
-                         "\x00\x00\x00\x00\x00\x00\x00\x02",
-               .input  = "\x30\x31\x32\x33\x34\x35\x36\x37"
-                         "\x38\x39\x41\x42\x43\x44\x45\x46",
-               .ilen   = 16,
-               .result = "\xfd\xb2\x66\x98\x80\x96\x55\xad"
-                         "\x08\x94\x54\x9c\x21\x7c\x69\xe3",
-               .rlen   = 16,
+               .iv     = "\x33\x33\x33\x33\x33\x00\x00\x00"
+                         "\x00\x00\x00\x00\x00\x00\x00\x00",
+               .input  = "\x1a\x0a\x09\x5f\xcd\x07\x07\x98"
+                         "\x41\x86\x12\xaf\xb3\xd7\x68\x13"
+                         "\xed\x81\xcd\x06\x87\x43\x1a\xbb"
+                         "\x13\x3d\xd6\x1e\x2b\xe1\x77\xbe",
+               .ilen   = 32,
+               .result = "\x44\x44\x44\x44\x44\x44\x44\x44"
+                         "\x44\x44\x44\x44\x44\x44\x44\x44"
+                         "\x44\x44\x44\x44\x44\x44\x44\x44"
+                         "\x44\x44\x44\x44\x44\x44\x44\x44",
+               .rlen   = 32,
        }, {
-               .key    = "\xd8\x2a\x91\x34\xb2\x6a\x56\x50"
-                         "\x30\xfe\x69\xe2\x37\x7f\x98\x47"
-                         "\xcd\xf9\x0b\x16\x0c\x64\x8f\xb6"
-                         "\xb0\x0d\x0d\x1b\xae\x85\x87\x1f",
+               .key    = "\xff\xfe\xfd\xfc\xfb\xfa\xf9\xf8"
+                         "\xf7\xf6\xf5\xf4\xf3\xf2\xf1\xf0"
+                         "\x22\x22\x22\x22\x22\x22\x22\x22"
+                         "\x22\x22\x22\x22\x22\x22\x22\x22",
+               .klen   = 32,
+               .iv     = "\x33\x33\x33\x33\x33\x00\x00\x00"
+                         "\x00\x00\x00\x00\x00\x00\x00\x00",
+               .input  = "\xf9\x9b\x28\xb8\x5c\xaf\x8c\x61"
+                         "\xb6\x1c\x81\x8f\x2c\x87\x60\x89"
+                         "\x0d\x8d\x7a\xe8\x60\x48\xcc\x86"
+                         "\xc1\x68\x45\xaa\x00\xe9\x24\xc5",
+               .ilen   = 32,
+               .result = "\x44\x44\x44\x44\x44\x44\x44\x44"
+                         "\x44\x44\x44\x44\x44\x44\x44\x44"
+                         "\x44\x44\x44\x44\x44\x44\x44\x44"
+                         "\x44\x44\x44\x44\x44\x44\x44\x44",
+               .rlen   = 32,
+       }, {
+               .key    = "\x27\x18\x28\x18\x28\x45\x90\x45"
+                         "\x23\x53\x60\x28\x74\x71\x35\x26"
+                         "\x31\x41\x59\x26\x53\x58\x97\x93"
+                         "\x23\x84\x62\x64\x33\x83\x27\x95",
                .klen   = 32,
                .iv     = "\x00\x00\x00\x00\x00\x00\x00\x00"
-                         "\x00\x00\x00\x02\x00\x00\x00\x00",
-               .input  = "\x30\x31\x32\x33\x34\x35\x36\x37"
-                         "\x38\x39\x41\x42\x43\x44\x45\x46",
-               .ilen   = 16,
-               .result = "\x14\x5e\x3d\x70\xc0\x6e\x9c\x34"
-                         "\x5b\x5e\xcf\x0f\xe4\x8c\x21\x5c",
-               .rlen   = 16,
+                         "\x00\x00\x00\x00\x00\x00\x00\x00",
+               .input  = "\xfe\x47\x4a\xc8\x60\x7e\xb4\x8b"
+                         "\x0d\x10\xf4\xb0\x0d\xba\xf8\x53"
+                         "\x65\x6e\x38\x4b\xdb\xaa\xb1\x9e"
+                         "\x28\xca\xb0\x22\xb3\x85\x75\xf4"
+                         "\x00\x5c\x75\x14\x06\xd6\x25\x82"
+                         "\xe6\xcb\x08\xf7\x29\x90\x23\x8e"
+                         "\xa4\x68\x57\xe4\xf0\xd8\x32\xf3"
+                         "\x80\x51\x67\xb5\x0b\x85\x69\xe8"
+                         "\x19\xfe\xc4\xc7\x3e\xea\x90\xd3"
+                         "\x8f\xa3\xf2\x0a\xac\x17\x4b\xa0"
+                         "\x63\x5a\x16\x0f\xf0\xce\x66\x1f"
+                         "\x2c\x21\x07\xf1\xa4\x03\xa3\x44"
+                         "\x41\x61\x87\x5d\x6b\xb3\xef\xd4"
+                         "\xfc\xaa\x32\x7e\x55\x58\x04\x41"
+                         "\xc9\x07\x33\xc6\xa2\x68\xd6\x5a"
+                         "\x55\x79\x4b\x6f\xcf\x89\xb9\x19"
+                         "\xe5\x54\x13\x15\xb2\x1a\xfa\x15"
+                         "\xc2\xf0\x06\x59\xfa\xa0\x25\x05"
+                         "\x58\xfa\x43\x91\x16\x85\x40\xbb"
+                         "\x0d\x34\x4d\xc5\x1e\x20\xd5\x08"
+                         "\xcd\x22\x22\x41\x11\x9f\x6c\x7c"
+                         "\x8d\x57\xc9\xba\x57\xe8\x2c\xf7"
+                         "\xa0\x42\xa8\xde\xfc\xa3\xca\x98"
+                         "\x4b\x43\xb1\xce\x4b\xbf\x01\x67"
+                         "\x6e\x29\x60\xbd\x10\x14\x84\x82"
+                         "\x83\x82\x0c\x63\x73\x92\x02\x7c"
+                         "\x55\x37\x20\x80\x17\x51\xc8\xbc"
+                         "\x46\x02\xcb\x38\x07\x6d\xe2\x85"
+                         "\xaa\x29\xaf\x24\x58\x0d\xf0\x75"
+                         "\x08\x0a\xa5\x34\x25\x16\xf3\x74"
+                         "\xa7\x0b\x97\xbe\xc1\xa9\xdc\x29"
+                         "\x1a\x0a\x56\xc1\x1a\x91\x97\x8c"
+                         "\x0b\xc7\x16\xed\x5a\x22\xa6\x2e"
+                         "\x8c\x2b\x4f\x54\x76\x47\x53\x8e"
+                         "\xe8\x00\xec\x92\xb9\x55\xe6\xa2"
+                         "\xf3\xe2\x4f\x6a\x66\x60\xd0\x87"
+                         "\xe6\xd1\xcc\xe3\x6a\xc5\x2d\x21"
+                         "\xcc\x9d\x6a\xb6\x75\xaa\xe2\x19"
+                         "\x21\x9f\xa1\x5e\x4c\xfd\x72\xf9"
+                         "\x94\x4e\x63\xc7\xae\xfc\xed\x47"
+                         "\xe2\xfe\x7a\x63\x77\xfe\x97\x82"
+                         "\xb1\x10\x6e\x36\x1d\xe1\xc4\x80"
+                         "\xec\x69\x41\xec\xa7\x8a\xe0\x2f"
+                         "\xe3\x49\x26\xa2\x41\xb2\x08\x0f"
+                         "\x28\xb4\xa7\x39\xa1\x99\x2d\x1e"
+                         "\x43\x42\x35\xd0\xcf\xec\x77\x67"
+                         "\xb2\x3b\x9e\x1c\x35\xde\x4f\x5e"
+                         "\x73\x3f\x5d\x6f\x07\x4b\x2e\x50"
+                         "\xab\x6c\x6b\xff\xea\x00\x67\xaa"
+                         "\x0e\x82\x32\xdd\x3d\xb5\xe5\x76"
+                         "\x2b\x77\x3f\xbe\x12\x75\xfb\x92"
+                         "\xc6\x89\x67\x4d\xca\xf7\xd4\x50"
+                         "\xc0\x74\x47\xcc\xd9\x0a\xd4\xc6"
+                         "\x3b\x17\x2e\xe3\x35\xbb\x53\xb5"
+                         "\x86\xad\x51\xcc\xd5\x96\xb8\xdc"
+                         "\x03\x57\xe6\x98\x52\x2f\x61\x62"
+                         "\xc4\x5c\x9c\x36\x71\x07\xfb\x94"
+                         "\xe3\x02\xc4\x2b\x08\x75\xc7\x35"
+                         "\xfb\x2e\x88\x7b\xbb\x67\x00\xe1"
+                         "\xc9\xdd\x99\xb2\x13\x53\x1a\x4e"
+                         "\x76\x87\x19\x04\x1a\x2f\x38\x3e"
+                         "\xef\x91\x64\x1d\x18\x07\x4e\x31"
+                         "\x88\x21\x7c\xb0\xa5\x12\x4c\x3c"
+                         "\xb0\x20\xbd\xda\xdf\xf9\x7c\xdd",
+               .ilen   = 512,
+               .result = "\x00\x01\x02\x03\x04\x05\x06\x07"
+                         "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f"
+                         "\x10\x11\x12\x13\x14\x15\x16\x17"
+                         "\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f"
+                         "\x20\x21\x22\x23\x24\x25\x26\x27"
+                         "\x28\x29\x2a\x2b\x2c\x2d\x2e\x2f"
+                         "\x30\x31\x32\x33\x34\x35\x36\x37"
+                         "\x38\x39\x3a\x3b\x3c\x3d\x3e\x3f"
+                         "\x40\x41\x42\x43\x44\x45\x46\x47"
+                         "\x48\x49\x4a\x4b\x4c\x4d\x4e\x4f"
+                         "\x50\x51\x52\x53\x54\x55\x56\x57"
+                         "\x58\x59\x5a\x5b\x5c\x5d\x5e\x5f"
+                         "\x60\x61\x62\x63\x64\x65\x66\x67"
+                         "\x68\x69\x6a\x6b\x6c\x6d\x6e\x6f"
+                         "\x70\x71\x72\x73\x74\x75\x76\x77"
+                         "\x78\x79\x7a\x7b\x7c\x7d\x7e\x7f"
+                         "\x80\x81\x82\x83\x84\x85\x86\x87"
+                         "\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f"
+                         "\x90\x91\x92\x93\x94\x95\x96\x97"
+                         "\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f"
+                         "\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7"
+                         "\xa8\xa9\xaa\xab\xac\xad\xae\xaf"
+                         "\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7"
+                         "\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf"
+                         "\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7"
+                         "\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf"
+                         "\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7"
+                         "\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf"
+                         "\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7"
+                         "\xe8\xe9\xea\xeb\xec\xed\xee\xef"
+                         "\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7"
+                         "\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff"
+                         "\x00\x01\x02\x03\x04\x05\x06\x07"
+                         "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f"
+                         "\x10\x11\x12\x13\x14\x15\x16\x17"
+                         "\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f"
+                         "\x20\x21\x22\x23\x24\x25\x26\x27"
+                         "\x28\x29\x2a\x2b\x2c\x2d\x2e\x2f"
+                         "\x30\x31\x32\x33\x34\x35\x36\x37"
+                         "\x38\x39\x3a\x3b\x3c\x3d\x3e\x3f"
+                         "\x40\x41\x42\x43\x44\x45\x46\x47"
+                         "\x48\x49\x4a\x4b\x4c\x4d\x4e\x4f"
+                         "\x50\x51\x52\x53\x54\x55\x56\x57"
+                         "\x58\x59\x5a\x5b\x5c\x5d\x5e\x5f"
+                         "\x60\x61\x62\x63\x64\x65\x66\x67"
+                         "\x68\x69\x6a\x6b\x6c\x6d\x6e\x6f"
+                         "\x70\x71\x72\x73\x74\x75\x76\x77"
+                         "\x78\x79\x7a\x7b\x7c\x7d\x7e\x7f"
+                         "\x80\x81\x82\x83\x84\x85\x86\x87"
+                         "\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f"
+                         "\x90\x91\x92\x93\x94\x95\x96\x97"
+                         "\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f"
+                         "\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7"
+                         "\xa8\xa9\xaa\xab\xac\xad\xae\xaf"
+                         "\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7"
+                         "\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf"
+                         "\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7"
+                         "\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf"
+                         "\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7"
+                         "\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf"
+                         "\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7"
+                         "\xe8\xe9\xea\xeb\xec\xed\xee\xef"
+                         "\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7"
+                         "\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff",
+               .rlen   = 512,
        }, {
-               .key    = "\x0f\x6a\xef\xf8\xd3\xd2\xbb\x15"
-                         "\x25\x83\xf7\x3c\x1f\x01\x28\x74"
-                         "\xca\xc6\xbc\x35\x4d\x4a\x65\x54"
-                         "\x90\xae\x61\xcf\x7b\xae\xbd\xcc"
-                         "\xad\xe4\x94\xc5\x4a\x29\xae\x70",
-               .klen   = 40,
-               .iv     = "\x00\x00\x00\x00\x00\x00\x00\x00"
-                         "\x00\x00\x00\x00\x00\x00\x00\x01",
-               .input  = "\x30\x31\x32\x33\x34\x35\x36\x37"
-                         "\x38\x39\x41\x42\x43\x44\x45\x46",
+               .key    = "\x27\x18\x28\x18\x28\x45\x90\x45"
+                         "\x23\x53\x60\x28\x74\x71\x35\x26"
+                         "\x62\x49\x77\x57\x24\x70\x93\x69"
+                         "\x99\x59\x57\x49\x66\x96\x76\x27"
+                         "\x31\x41\x59\x26\x53\x58\x97\x93"
+                         "\x23\x84\x62\x64\x33\x83\x27\x95"
+                         "\x02\x88\x41\x97\x16\x93\x99\x37"
+                         "\x51\x05\x82\x09\x74\x94\x45\x92",
+               .klen   = 64,
+               .iv     = "\xff\x00\x00\x00\x00\x00\x00\x00"
+                         "\x00\x00\x00\x00\x00\x00\x00\x00",
+               .input  = "\x2b\xc9\xb4\x6b\x10\x94\xa9\x32"
+                         "\xaa\xb0\x20\xc6\x44\x3d\x74\x1f"
+                         "\x75\x01\xa7\xf6\xf5\xf7\x62\x1b"
+                         "\x80\x1b\x82\xcb\x01\x59\x91\x7f"
+                         "\x80\x3a\x98\xf0\xd2\xca\xc4\xc3"
+                         "\x34\xfd\xe6\x11\xf9\x33\x45\x12"
+                         "\x48\xc5\x8c\x25\xf1\xc5\xc5\x23"
+                         "\xd3\x44\xb4\x73\xd5\x04\xc0\xb7"
+                         "\xca\x2f\xf5\xcd\xc5\xb4\xdd\xb0"
+                         "\xf4\x60\xe8\xfb\xc6\x9c\xc5\x78"
+                         "\xcd\xec\x7d\xdc\x19\x9c\x72\x64"
+                         "\x63\x0b\x38\x2e\x76\xdd\x2d\x36"
+                         "\x49\xb0\x1d\xea\x78\x9e\x00\xca"
+                         "\x20\xcc\x1b\x1e\x98\x74\xab\xed"
+                         "\x79\xf7\xd0\x6c\xd8\x93\x80\x29"
+                         "\xac\xa5\x5e\x34\xa9\xab\xa0\x55"
+                         "\x9a\xea\xaa\x95\x4d\x7b\xfe\x46"
+                         "\x26\x8a\xfd\x88\xa2\xa8\xa6\xae"
+                         "\x25\x42\x17\xbf\x76\x8f\x1c\x3d"
+                         "\xec\x9a\xda\x64\x96\xb5\x61\xff"
+                         "\x99\xeb\x12\x96\x85\x82\x9d\xd5"
+                         "\x81\x85\x14\xa8\x59\xac\x8c\x94"
+                         "\xbb\x3b\x85\x2b\xdf\xb3\x0c\xba"
+                         "\x82\xc6\x4d\xca\x86\xea\x53\x28"
+                         "\x4c\xe0\x4e\x31\xe3\x73\x2f\x79"
+                         "\x9d\x42\xe1\x03\xe3\x8b\xc4\xff"
+                         "\x05\xca\x81\x7b\xda\xa2\xde\x63"
+                         "\x3a\x10\xbe\xc2\xac\x32\xc4\x05"
+                         "\x47\x7e\xef\x67\xe2\x5f\x5b\xae"
+                         "\xed\xf1\x70\x34\x16\x9a\x07\x7b"
+                         "\xf2\x25\x2b\xb0\xf8\x3c\x15\x9a"
+                         "\xa6\x59\x55\x5f\xc1\xf4\x1e\xcd"
+                         "\x93\x1f\x06\xba\xd4\x9a\x22\x69"
+                         "\xfa\x8e\x95\x0d\xf3\x23\x59\x2c"
+                         "\xfe\x00\xba\xf0\x0e\xbc\x6d\xd6"
+                         "\x62\xf0\x7a\x0e\x83\x3e\xdb\x32"
+                         "\xfd\x43\x7d\xda\x42\x51\x87\x43"
+                         "\x9d\xf9\xef\xf4\x30\x97\xf8\x09"
+                         "\x88\xfc\x3f\x93\x70\xc1\x4a\xec"
+                         "\x27\x5f\x11\xac\x71\xc7\x48\x46"
+                         "\x2f\xf9\xdf\x8d\x9f\xf7\x2e\x56"
+                         "\x0d\x4e\xb0\x32\x76\xce\x86\x81"
+                         "\xcd\xdf\xe4\x00\xbf\xfd\x5f\x24"
+                         "\xaf\xf7\x9a\xde\xff\x18\xac\x14"
+                         "\x90\xc5\x01\x39\x34\x0f\x24\xf3"
+                         "\x13\x2f\x5e\x4f\x30\x9a\x36\x40"
+                         "\xec\xea\xbc\xcd\x9e\x0e\x5b\x23"
+                         "\x50\x88\x97\x40\x69\xb1\x37\xf5"
+                         "\xc3\x15\xf9\x3f\xb7\x79\x64\xe8"
+                         "\x7b\x10\x20\xb9\x2b\x46\x83\x5b"
+                         "\xd8\x39\xfc\xe4\xfa\x88\x52\xf2"
+                         "\x72\xb0\x97\x4e\x89\xb3\x48\x00"
+                         "\xc1\x16\x73\x50\x77\xba\xa6\x65"
+                         "\x20\x2d\xb0\x02\x27\x89\xda\x99"
+                         "\x45\xfb\xe9\xd3\x1d\x39\x2f\xd6"
+                         "\x2a\xda\x09\x12\x11\xaf\xe6\x57"
+                         "\x01\x04\x8a\xff\x86\x8b\xac\xf8"
+                         "\xee\xe4\x1c\x98\x5b\xcf\x6b\x76"
+                         "\xa3\x0e\x33\x74\x40\x18\x39\x72"
+                         "\x66\x50\x31\xfd\x70\xdf\xe8\x51"
+                         "\x96\x21\x36\xb2\x9b\xfa\x85\xd1"
+                         "\x30\x05\xc8\x92\x98\x80\xff\x7a"
+                         "\xaf\x43\x0b\xc5\x20\x41\x92\x20"
+                         "\xd4\xa0\x91\x98\x11\x5f\x4d\xb1",
+               .ilen   = 512,
+               .result = "\x00\x01\x02\x03\x04\x05\x06\x07"
+                         "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f"
+                         "\x10\x11\x12\x13\x14\x15\x16\x17"
+                         "\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f"
+                         "\x20\x21\x22\x23\x24\x25\x26\x27"
+                         "\x28\x29\x2a\x2b\x2c\x2d\x2e\x2f"
+                         "\x30\x31\x32\x33\x34\x35\x36\x37"
+                         "\x38\x39\x3a\x3b\x3c\x3d\x3e\x3f"
+                         "\x40\x41\x42\x43\x44\x45\x46\x47"
+                         "\x48\x49\x4a\x4b\x4c\x4d\x4e\x4f"
+                         "\x50\x51\x52\x53\x54\x55\x56\x57"
+                         "\x58\x59\x5a\x5b\x5c\x5d\x5e\x5f"
+                         "\x60\x61\x62\x63\x64\x65\x66\x67"
+                         "\x68\x69\x6a\x6b\x6c\x6d\x6e\x6f"
+                         "\x70\x71\x72\x73\x74\x75\x76\x77"
+                         "\x78\x79\x7a\x7b\x7c\x7d\x7e\x7f"
+                         "\x80\x81\x82\x83\x84\x85\x86\x87"
+                         "\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f"
+                         "\x90\x91\x92\x93\x94\x95\x96\x97"
+                         "\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f"
+                         "\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7"
+                         "\xa8\xa9\xaa\xab\xac\xad\xae\xaf"
+                         "\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7"
+                         "\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf"
+                         "\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7"
+                         "\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf"
+                         "\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7"
+                         "\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf"
+                         "\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7"
+                         "\xe8\xe9\xea\xeb\xec\xed\xee\xef"
+                         "\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7"
+                         "\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff"
+                         "\x00\x01\x02\x03\x04\x05\x06\x07"
+                         "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f"
+                         "\x10\x11\x12\x13\x14\x15\x16\x17"
+                         "\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f"
+                         "\x20\x21\x22\x23\x24\x25\x26\x27"
+                         "\x28\x29\x2a\x2b\x2c\x2d\x2e\x2f"
+                         "\x30\x31\x32\x33\x34\x35\x36\x37"
+                         "\x38\x39\x3a\x3b\x3c\x3d\x3e\x3f"
+                         "\x40\x41\x42\x43\x44\x45\x46\x47"
+                         "\x48\x49\x4a\x4b\x4c\x4d\x4e\x4f"
+                         "\x50\x51\x52\x53\x54\x55\x56\x57"
+                         "\x58\x59\x5a\x5b\x5c\x5d\x5e\x5f"
+                         "\x60\x61\x62\x63\x64\x65\x66\x67"
+                         "\x68\x69\x6a\x6b\x6c\x6d\x6e\x6f"
+                         "\x70\x71\x72\x73\x74\x75\x76\x77"
+                         "\x78\x79\x7a\x7b\x7c\x7d\x7e\x7f"
+                         "\x80\x81\x82\x83\x84\x85\x86\x87"
+                         "\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f"
+                         "\x90\x91\x92\x93\x94\x95\x96\x97"
+                         "\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f"
+                         "\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7"
+                         "\xa8\xa9\xaa\xab\xac\xad\xae\xaf"
+                         "\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7"
+                         "\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf"
+                         "\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7"
+                         "\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf"
+                         "\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7"
+                         "\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf"
+                         "\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7"
+                         "\xe8\xe9\xea\xeb\xec\xed\xee\xef"
+                         "\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7"
+                         "\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff",
+               .rlen   = 512,
+               .also_non_np = 1,
+               .np     = 3,
+               .tap    = { 512 - 20, 4, 16 },
+       },
+};
+
+/*
+ * SM4 test vector taken from the draft RFC
+ * https://tools.ietf.org/html/draft-crypto-sm4-00#ref-GBT.32907-2016
+ */
+
+static const struct cipher_testvec sm4_enc_tv_template[] = {
+       { /* SM4 Appendix A: Example Calculations. Example 1. */
+               .key    = "\x01\x23\x45\x67\x89\xAB\xCD\xEF"
+                         "\xFE\xDC\xBA\x98\x76\x54\x32\x10",
+               .klen   = 16,
+               .input  = "\x01\x23\x45\x67\x89\xAB\xCD\xEF"
+                         "\xFE\xDC\xBA\x98\x76\x54\x32\x10",
                .ilen   = 16,
-               .result = "\x25\x39\xaa\xa5\xf0\x65\xc8\xdc"
-                         "\x5d\x45\x95\x30\x8f\xff\x2f\x1b",
+               .result = "\x68\x1E\xDF\x34\xD2\x06\x96\x5E"
+                         "\x86\xB3\xE9\x4F\x53\x6E\x42\x46",
                .rlen   = 16,
-       }, {
-               .key    = "\x8a\xd4\xee\x10\x2f\xbd\x81\xff"
-                         "\xf8\x86\xce\xac\x93\xc5\xad\xc6"
-                         "\xa0\x19\x07\xc0\x9d\xf7\xbb\xdd"
-                         "\x52\x13\xb2\xb7\xf0\xff\x11\xd8"
-                         "\xd6\x08\xd0\xcd\x2e\xb1\x17\x6f",
-               .klen   = 40,
-               .iv     = "\x00\x00\x00\x00\x00\x00\x00\x00"
-                         "\x00\x00\x00\x02\x00\x00\x00\x00",
-               .input  = "\x30\x31\x32\x33\x34\x35\x36\x37"
-                         "\x38\x39\x41\x42\x43\x44\x45\x46",
+       }, { /*
+             *  SM4 Appendix A: Example Calculations.
+             *  Last 10 iterations of Example 2.
+             */
+               .key    = "\x01\x23\x45\x67\x89\xAB\xCD\xEF"
+                         "\xFE\xDC\xBA\x98\x76\x54\x32\x10",
+               .klen   = 16,
+               .input  = "\x99\x4a\xc3\xe7\xc3\x57\x89\x6a"
+                         "\x81\xfc\xa8\xe\x38\x3e\xef\x80"
+                         "\xb1\x98\xf2\xde\x3f\x4b\xae\xd1"
+                         "\xf0\xf1\x30\x4c\x1\x27\x5a\x8f"
+                         "\x45\xe1\x39\xb7\xae\xff\x1f\x27"
+                         "\xad\x57\x15\xab\x31\x5d\xc\xef"
+                         "\x8c\xc8\x80\xbd\x11\x98\xf3\x7b"
+                         "\xa2\xdd\x14\x20\xf9\xe8\xbb\x82"
+                         "\xf7\x32\xca\x4b\xa8\xf7\xb3\x4d"
+                         "\x27\xd1\xcd\xe6\xb6\x65\x5a\x23"
+                         "\xc2\xf3\x54\x84\x53\xe3\xb9\x20"
+                         "\xa5\x37\x0\xbe\xe7\x7b\x48\xfb"
+                         "\x21\x3d\x9e\x48\x1d\x9e\xf5\xbf"
+                         "\x77\xd5\xb4\x4a\x53\x71\x94\x7a"
+                         "\x88\xa6\x6e\x6\x93\xca\x43\xa5"
+                         "\xc4\xf6\xcd\x53\x4b\x7b\x8e\xfe"
+                         "\xb4\x28\x7c\x42\x29\x32\x5d\x88"
+                         "\xed\xce\x0\x19\xe\x16\x2\x6e"
+                         "\x87\xff\x2c\xac\xe8\xe7\xe9\xbf"
+                         "\x31\x51\xec\x47\xc3\x51\x83\xc1",
+               .ilen   = 160,
+               .result = "\xb1\x98\xf2\xde\x3f\x4b\xae\xd1"
+                         "\xf0\xf1\x30\x4c\x1\x27\x5a\x8f"
+                         "\x45\xe1\x39\xb7\xae\xff\x1f\x27"
+                         "\xad\x57\x15\xab\x31\x5d\xc\xef"
+                         "\x8c\xc8\x80\xbd\x11\x98\xf3\x7b"
+                         "\xa2\xdd\x14\x20\xf9\xe8\xbb\x82"
+                         "\xf7\x32\xca\x4b\xa8\xf7\xb3\x4d"
+                         "\x27\xd1\xcd\xe6\xb6\x65\x5a\x23"
+                         "\xc2\xf3\x54\x84\x53\xe3\xb9\x20"
+                         "\xa5\x37\x0\xbe\xe7\x7b\x48\xfb"
+                         "\x21\x3d\x9e\x48\x1d\x9e\xf5\xbf"
+                         "\x77\xd5\xb4\x4a\x53\x71\x94\x7a"
+                         "\x88\xa6\x6e\x6\x93\xca\x43\xa5"
+                         "\xc4\xf6\xcd\x53\x4b\x7b\x8e\xfe"
+                         "\xb4\x28\x7c\x42\x29\x32\x5d\x88"
+                         "\xed\xce\x0\x19\xe\x16\x2\x6e"
+                         "\x87\xff\x2c\xac\xe8\xe7\xe9\xbf"
+                         "\x31\x51\xec\x47\xc3\x51\x83\xc1"
+                         "\x59\x52\x98\xc7\xc6\xfd\x27\x1f"
+                         "\x4\x2\xf8\x4\xc3\x3d\x3f\x66",
+               .rlen   = 160
+       }
+};
+
+static const struct cipher_testvec sm4_dec_tv_template[] = {
+       { /* SM4 Appendix A: Example Calculations. Example 1. */
+               .key    = "\x01\x23\x45\x67\x89\xAB\xCD\xEF"
+                         "\xFE\xDC\xBA\x98\x76\x54\x32\x10",
+               .klen   = 16,
+               .input  = "\x68\x1E\xDF\x34\xD2\x06\x96\x5E"
+                         "\x86\xB3\xE9\x4F\x53\x6E\x42\x46",
                .ilen   = 16,
-               .result = "\x0c\x20\x20\x63\xd6\x8b\xfc\x8f"
-                         "\xc0\xe2\x17\xbb\xd2\x59\x6f\x26",
+               .result = "\x01\x23\x45\x67\x89\xAB\xCD\xEF"
+                         "\xFE\xDC\xBA\x98\x76\x54\x32\x10",
                .rlen   = 16,
-       }, {
-               .key    = "\xf8\xd4\x76\xff\xd6\x46\xee\x6c"
-                         "\x23\x84\xcb\x1c\x77\xd6\x19\x5d"
-                         "\xfe\xf1\xa9\xf3\x7b\xbc\x8d\x21"
-                         "\xa7\x9c\x21\xf8\xcb\x90\x02\x89"
-                         "\xa8\x45\x34\x8e\xc8\xc5\xb5\xf1"
-                         "\x26\xf5\x0e\x76\xfe\xfd\x1b\x1e",
-               .klen   = 48,
-               .iv     = "\x00\x00\x00\x00\x00\x00\x00\x00"
-                         "\x00\x00\x00\x00\x00\x00\x00\x01",
-               .input  = "\x30\x31\x32\x33\x34\x35\x36\x37"
-                         "\x38\x39\x41\x42\x43\x44\x45\x46",
+       }, { /*
+             *  SM4 Appendix A: Example Calculations.
+             *  Last 10 iterations of Example 2.
+             */
+               .key    = "\x01\x23\x45\x67\x89\xAB\xCD\xEF"
+                         "\xFE\xDC\xBA\x98\x76\x54\x32\x10",
+               .klen   = 16,
+               .input  = "\xb1\x98\xf2\xde\x3f\x4b\xae\xd1"
+                         "\xf0\xf1\x30\x4c\x1\x27\x5a\x8f"
+                         "\x45\xe1\x39\xb7\xae\xff\x1f\x27"
+                         "\xad\x57\x15\xab\x31\x5d\xc\xef"
+                         "\x8c\xc8\x80\xbd\x11\x98\xf3\x7b"
+                         "\xa2\xdd\x14\x20\xf9\xe8\xbb\x82"
+                         "\xf7\x32\xca\x4b\xa8\xf7\xb3\x4d"
+                         "\x27\xd1\xcd\xe6\xb6\x65\x5a\x23"
+                         "\xc2\xf3\x54\x84\x53\xe3\xb9\x20"
+                         "\xa5\x37\x0\xbe\xe7\x7b\x48\xfb"
+                         "\x21\x3d\x9e\x48\x1d\x9e\xf5\xbf"
+                         "\x77\xd5\xb4\x4a\x53\x71\x94\x7a"
+                         "\x88\xa6\x6e\x6\x93\xca\x43\xa5"
+                         "\xc4\xf6\xcd\x53\x4b\x7b\x8e\xfe"
+                         "\xb4\x28\x7c\x42\x29\x32\x5d\x88"
+                         "\xed\xce\x0\x19\xe\x16\x2\x6e"
+                         "\x87\xff\x2c\xac\xe8\xe7\xe9\xbf"
+                         "\x31\x51\xec\x47\xc3\x51\x83\xc1"
+                         "\x59\x52\x98\xc7\xc6\xfd\x27\x1f"
+                         "\x4\x2\xf8\x4\xc3\x3d\x3f\x66",
+               .ilen   = 160,
+               .result = "\x99\x4a\xc3\xe7\xc3\x57\x89\x6a"
+                         "\x81\xfc\xa8\xe\x38\x3e\xef\x80"
+                         "\xb1\x98\xf2\xde\x3f\x4b\xae\xd1"
+                         "\xf0\xf1\x30\x4c\x1\x27\x5a\x8f"
+                         "\x45\xe1\x39\xb7\xae\xff\x1f\x27"
+                         "\xad\x57\x15\xab\x31\x5d\xc\xef"
+                         "\x8c\xc8\x80\xbd\x11\x98\xf3\x7b"
+                         "\xa2\xdd\x14\x20\xf9\xe8\xbb\x82"
+                         "\xf7\x32\xca\x4b\xa8\xf7\xb3\x4d"
+                         "\x27\xd1\xcd\xe6\xb6\x65\x5a\x23"
+                         "\xc2\xf3\x54\x84\x53\xe3\xb9\x20"
+                         "\xa5\x37\x0\xbe\xe7\x7b\x48\xfb"
+                         "\x21\x3d\x9e\x48\x1d\x9e\xf5\xbf"
+                         "\x77\xd5\xb4\x4a\x53\x71\x94\x7a"
+                         "\x88\xa6\x6e\x6\x93\xca\x43\xa5"
+                         "\xc4\xf6\xcd\x53\x4b\x7b\x8e\xfe"
+                         "\xb4\x28\x7c\x42\x29\x32\x5d\x88"
+                         "\xed\xce\x0\x19\xe\x16\x2\x6e"
+                         "\x87\xff\x2c\xac\xe8\xe7\xe9\xbf"
+                         "\x31\x51\xec\x47\xc3\x51\x83\xc1",
+               .rlen   = 160
+       }
+};
+
+/*
+ * Speck test vectors taken from the original paper:
+ * "The Simon and Speck Families of Lightweight Block Ciphers"
+ * https://eprint.iacr.org/2013/404.pdf
+ *
+ * Note that the paper does not make byte and word order clear.  But it was
+ * confirmed with the authors that the intended orders are little endian byte
+ * order and (y, x) word order.  Equivalently, the printed test vectors, when
+ * looking at only the bytes (ignoring the whitespace that divides them into
+ * words), are backwards: the left-most byte is actually the one with the
+ * highest memory address, while the right-most byte is actually the one with
+ * the lowest memory address.
+ */
+
+static const struct cipher_testvec speck128_enc_tv_template[] = {
+       { /* Speck128/128 */
+               .key    = "\x00\x01\x02\x03\x04\x05\x06\x07"
+                         "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f",
+               .klen   = 16,
+               .input  = "\x20\x6d\x61\x64\x65\x20\x69\x74"
+                         "\x20\x65\x71\x75\x69\x76\x61\x6c",
                .ilen   = 16,
-               .result = "\xc1\x35\x2e\x53\xf0\x96\x4d\x9c"
-                         "\x2e\x18\xe6\x99\xcd\xd3\x15\x68",
+               .result = "\x18\x0d\x57\x5c\xdf\xfe\x60\x78"
+                         "\x65\x32\x78\x79\x51\x98\x5d\xa6",
                .rlen   = 16,
-       }, {
-               .key    = "\xfb\x76\x15\xb2\x3d\x80\x89\x1d"
-                         "\xd4\x70\x98\x0b\xc7\x95\x84\xc8"
-                         "\xb2\xfb\x64\xce\x60\x97\x87\x8d"
-                         "\x17\xfc\xe4\x5a\x49\xe8\x30\xb7"
-                         "\x6e\x78\x17\xe7\x2d\x5e\x12\xd4"
-                         "\x60\x64\x04\x7a\xf1\x2f\x9e\x0c",
-               .klen   = 48,
-               .iv     = "\x00\x00\x00\x00\x00\x00\x00\x00"
-                         "\x00\x00\x00\x02\x00\x00\x00\x00",
-               .input  = "\x30\x31\x32\x33\x34\x35\x36\x37"
-                         "\x38\x39\x41\x42\x43\x44\x45\x46",
+       }, { /* Speck128/192 */
+               .key    = "\x00\x01\x02\x03\x04\x05\x06\x07"
+                         "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f"
+                         "\x10\x11\x12\x13\x14\x15\x16\x17",
+               .klen   = 24,
+               .input  = "\x65\x6e\x74\x20\x74\x6f\x20\x43"
+                         "\x68\x69\x65\x66\x20\x48\x61\x72",
                .ilen   = 16,
-               .result = "\x86\x0a\xc6\xa9\x1a\x9f\xe7\xe6"
-                         "\x64\x3b\x33\xd6\xd5\x84\xd6\xdf",
+               .result = "\x86\x18\x3c\xe0\x5d\x18\xbc\xf9"
+                         "\x66\x55\x13\x13\x3a\xcf\xe4\x1b",
+               .rlen   = 16,
+       }, { /* Speck128/256 */
+               .key    = "\x00\x01\x02\x03\x04\x05\x06\x07"
+                         "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f"
+                         "\x10\x11\x12\x13\x14\x15\x16\x17"
+                         "\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f",
+               .klen   = 32,
+               .input  = "\x70\x6f\x6f\x6e\x65\x72\x2e\x20"
+                         "\x49\x6e\x20\x74\x68\x6f\x73\x65",
+               .ilen   = 16,
+               .result = "\x43\x8f\x18\x9c\x8d\xb4\xee\x4e"
+                         "\x3e\xf5\xc0\x05\x04\x01\x09\x41",
                .rlen   = 16,
-       }, {
-               .key    = "\xf8\xd4\x76\xff\xd6\x46\xee\x6c"
-                         "\x23\x84\xcb\x1c\x77\xd6\x19\x5d"
-                         "\xfe\xf1\xa9\xf3\x7b\xbc\x8d\x21"
-                         "\xa7\x9c\x21\xf8\xcb\x90\x02\x89"
-                         "\xa8\x45\x34\x8e\xc8\xc5\xb5\xf1"
-                         "\x26\xf5\x0e\x76\xfe\xfd\x1b\x1e",
-               .klen   = 48,
-               .iv     = "\x00\x00\x00\x00\x00\x00\x00\x00"
-                         "\x00\x00\x00\x00\x00\x00\x00\x01",
-               .input  = "\x05\x11\xb7\x18\xab\xc6\x2d\xac"
-                         "\x70\x5d\xf6\x22\x94\xcd\xe5\x6c"
-                         "\x17\x6b\xf6\x1c\xf0\xf3\x6e\xf8"
-                         "\x50\x38\x1f\x71\x49\xb6\x57\xd6"
-                         "\x8f\xcb\x8d\x6b\xe3\xa6\x29\x90"
-                         "\xfe\x2a\x62\x82\xae\x6d\x8b\xf6"
-                         "\xad\x1e\x9e\x20\x5f\x38\xbe\x04"
-                         "\xda\x10\x8e\xed\xa2\xa4\x87\xab"
-                         "\xda\x6b\xb4\x0c\x75\xba\xd3\x7c"
-                         "\xc9\xac\x42\x31\x95\x7c\xc9\x04"
-                         "\xeb\xd5\x6e\x32\x69\x8a\xdb\xa6"
-                         "\x15\xd7\x3f\x4f\x2f\x66\x69\x03"
-                         "\x9c\x1f\x54\x0f\xde\x1f\xf3\x65"
-                         "\x4c\x96\x12\xed\x7c\x92\x03\x01"
-                         "\x6f\xbc\x35\x93\xac\xf1\x27\xf1"
-                         "\xb4\x96\x82\x5a\x5f\xb0\xa0\x50"
-                         "\x89\xa4\x8e\x66\x44\x85\xcc\xfd"
-                         "\x33\x14\x70\xe3\x96\xb2\xc3\xd3"
-                         "\xbb\x54\x5a\x1a\xf9\x74\xa2\xc5"
-                         "\x2d\x64\x75\xdd\xb4\x54\xe6\x74"
-                         "\x8c\xd3\x9d\x9e\x86\xab\x51\x53"
-                         "\xb7\x93\x3e\x6f\xd0\x4e\x2c\x40"
-                         "\xf6\xa8\x2e\x3e\x9d\xf4\x66\xa5"
-                         "\x76\x12\x73\x44\x1a\x56\xd7\x72"
-                         "\x88\xcd\x21\x8c\x4c\x0f\xfe\xda"
-                         "\x95\xe0\x3a\xa6\xa5\x84\x46\xcd"
-                         "\xd5\x3e\x9d\x3a\xe2\x67\xe6\x60"
-                         "\x1a\xe2\x70\x85\x58\xc2\x1b\x09"
-                         "\xe1\xd7\x2c\xca\xad\xa8\x8f\xf9"
-                         "\xac\xb3\x0e\xdb\xca\x2e\xe2\xb8"
-                         "\x51\x71\xd9\x3c\x6c\xf1\x56\xf8"
-                         "\xea\x9c\xf1\xfb\x0c\xe6\xb7\x10"
-                         "\x1c\xf8\xa9\x7c\xe8\x53\x35\xc1"
-                         "\x90\x3e\x76\x4a\x74\xa4\x21\x2c"
-                         "\xf6\x2c\x4e\x0f\x94\x3a\x88\x2e"
-                         "\x41\x09\x6a\x33\x7d\xf6\xdd\x3f"
-                         "\x8d\x23\x31\x74\x84\xeb\x88\x6e"
-                         "\xcc\xb9\xbc\x22\x83\x19\x07\x22"
-                         "\xa5\x2d\xdf\xa5\xf3\x80\x85\x78"
-                         "\x84\x39\x6a\x6d\x6a\x99\x4f\xa5"
-                         "\x15\xfe\x46\xb0\xe4\x6c\xa5\x41"
-                         "\x3c\xce\x8f\x42\x60\x71\xa7\x75"
-                         "\x08\x40\x65\x8a\x82\xbf\xf5\x43"
-                         "\x71\x96\xa9\x4d\x44\x8a\x20\xbe"
-                         "\xfa\x4d\xbb\xc0\x7d\x31\x96\x65"
-                         "\xe7\x75\xe5\x3e\xfd\x92\x3b\xc9"
-                         "\x55\xbb\x16\x7e\xf7\xc2\x8c\xa4"
-                         "\x40\x1d\xe5\xef\x0e\xdf\xe4\x9a"
-                         "\x62\x73\x65\xfd\x46\x63\x25\x3d"
-                         "\x2b\xaf\xe5\x64\xfe\xa5\x5c\xcf"
-                         "\x24\xf3\xb4\xac\x64\xba\xdf\x4b"
-                         "\xc6\x96\x7d\x81\x2d\x8d\x97\xf7"
-                         "\xc5\x68\x77\x84\x32\x2b\xcc\x85"
-                         "\x74\x96\xf0\x12\x77\x61\xb9\xeb"
-                         "\x71\xaa\x82\xcb\x1c\xdb\x89\xc8"
-                         "\xc6\xb5\xe3\x5c\x7d\x39\x07\x24"
-                         "\xda\x39\x87\x45\xc0\x2b\xbb\x01"
-                         "\xac\xbc\x2a\x5c\x7f\xfc\xe8\xce"
-                         "\x6d\x9c\x6f\xed\xd3\xc1\xa1\xd6"
-                         "\xc5\x55\xa9\x66\x2f\xe1\xc8\x32"
-                         "\xa6\x5d\xa4\x3a\x98\x73\xe8\x45"
-                         "\xa4\xc7\xa8\xb4\xf6\x13\x03\xf6"
-                         "\xe9\x2e\xc4\x29\x0f\x84\xdb\xc4"
-                         "\x21\xc4\xc2\x75\x67\x89\x37\x0a",
-               .ilen   = 512,
-               .result = "\xe3\x5a\x38\x0f\x4d\x92\x3a\x74"
-                         "\x15\xb1\x50\x8c\x9a\xd8\x99\x1d"
-                         "\x82\xec\xf1\x5f\x03\x6d\x02\x58"
-                         "\x90\x67\xfc\xdd\x8d\xe1\x38\x08"
-                         "\x7b\xc9\x9b\x4b\x04\x09\x50\x15"
-                         "\xce\xab\xda\x33\x30\x20\x12\xfa"
-                         "\x83\xc4\xa6\x9a\x2e\x7d\x90\xd9"
-                         "\xa6\xa6\x67\x43\xb4\xa7\xa8\x5c"
-                         "\xbb\x6a\x49\x2b\x8b\xf8\xd0\x22"
-                         "\xe5\x9e\xba\xe8\x8c\x67\xb8\x5b"
-                         "\x60\xbc\xf5\xa4\x95\x4e\x66\xe5"
-                         "\x6d\x8e\xa9\xf6\x65\x2e\x04\xf5"
-                         "\xba\xb5\xdb\x88\xc2\xf6\x7a\x4b"
-                         "\x89\x58\x7c\x9a\xae\x26\xe8\xb7"
-                         "\xb7\x28\xcc\xd6\xcc\xa5\x98\x4d"
-                         "\xb9\x91\xcb\xb4\xe4\x8b\x96\x47"
-                         "\x5f\x03\x8b\xdd\x94\xd1\xee\x12"
-                         "\xa7\x83\x80\xf2\xc1\x15\x74\x4f"
-                         "\x49\xf9\xb0\x7e\x6f\xdc\x73\x2f"
-                         "\xe2\xcf\xe0\x1b\x34\xa5\xa0\x52"
-                         "\xfb\x3c\x5d\x85\x91\xe6\x6d\x98"
-                         "\x04\xd6\xdd\x4c\x00\x64\xd9\x54"
-                         "\x5c\x3c\x08\x1d\x4c\x06\x9f\xb8"
-                         "\x1c\x4d\x8d\xdc\xa4\x3c\xb9\x3b"
-                         "\x9e\x85\xce\xc3\xa8\x4a\x0c\xd9"
-                         "\x04\xc3\x6f\x17\x66\xa9\x1f\x59"
-                         "\xd9\xe2\x19\x36\xa3\x88\xb8\x0b"
-                         "\x0f\x4a\x4d\xf8\xc8\x6f\xd5\x43"
-                         "\xeb\xa0\xab\x1f\x61\xc0\x06\xeb"
-                         "\x93\xb7\xb8\x6f\x0d\xbd\x07\x49"
-                         "\xb3\xac\x5d\xcf\x31\xa0\x27\x26"
-                         "\x21\xbe\x94\x2e\x19\xea\xf4\xee"
-                         "\xb5\x13\x89\xf7\x94\x0b\xef\x59"
-                         "\x44\xc5\x78\x8b\x3c\x3b\x71\x20"
-                         "\xf9\x35\x0c\x70\x74\xdc\x5b\xc2"
-                         "\xb4\x11\x0e\x2c\x61\xa1\x52\x46"
-                         "\x18\x11\x16\xc6\x86\x44\xa7\xaf"
-                         "\xd5\x0c\x7d\xa6\x9e\x25\x2d\x1b"
-                         "\x9a\x8f\x0f\xf8\x6a\x61\xa0\xea"
-                         "\x3f\x0e\x90\xd6\x8f\x83\x30\x64"
-                         "\xb5\x51\x2d\x08\x3c\xcd\x99\x36"
-                         "\x96\xd4\xb1\xb5\x48\x30\xca\x48"
-                         "\xf7\x11\xa8\xf5\x97\x8a\x6a\x6d"
-                         "\x12\x33\x2f\xc0\xe8\xda\xec\x8a"
-                         "\xe1\x88\x72\x63\xde\x20\xa3\xe1"
-                         "\x8e\xac\x84\x37\x35\xf5\xf7\x3f"
-                         "\x00\x02\x0e\xe4\xc1\x53\x68\x3f"
-                         "\xaa\xd5\xac\x52\x3d\x20\x2f\x4d"
-                         "\x7c\x83\xd0\xbd\xaa\x97\x35\x36"
-                         "\x98\x88\x59\x5d\xe7\x24\xe3\x90"
-                         "\x9d\x30\x47\xa7\xc3\x60\x35\xf4"
-                         "\xd5\xdb\x0e\x4d\x44\xc1\x81\x8b"
-                         "\xfd\xbd\xc3\x2b\xba\x68\xfe\x8d"
-                         "\x49\x5a\x3c\x8a\xa3\x01\xae\x25"
-                         "\x42\xab\xd2\x87\x1b\x35\xd6\xd2"
-                         "\xd7\x70\x1c\x1f\x72\xd1\xe1\x39"
-                         "\x1c\x58\xa2\xb4\xd0\x78\x55\x72"
-                         "\x76\x59\xea\xd9\xd7\x6e\x63\x8b"
-                         "\xcc\x9b\xa7\x74\x89\xfc\xa3\x68"
-                         "\x86\x28\xd1\xbb\x54\x8d\x66\xad"
-                         "\x2a\x92\xf9\x4e\x04\x3d\xae\xfd"
-                         "\x1b\x2b\x7f\xc3\x2f\x1a\x78\x0a"
-                         "\x5c\xc6\x84\xfe\x7c\xcb\x26\xfd"
-                         "\xd9\x51\x0f\xd7\x94\x2f\xc5\xa7",
-               .rlen   = 512,
-               .also_non_np = 1,
-               .np     = 3,
-               .tap    = { 512 - 20, 4, 16 },
        },
 };
 
-static const struct cipher_testvec serpent_lrw_dec_tv_template[] = {
-       /* Generated from AES-LRW test vectors */
-       /* same as enc vectors with input and result reversed */
-       {
-               .key    = "\x45\x62\xac\x25\xf8\x28\x17\x6d"
-                         "\x4c\x26\x84\x14\xb5\x68\x01\x85"
-                         "\x25\x8e\x2a\x05\xe7\x3e\x9d\x03"
-                         "\xee\x5a\x83\x0c\xcc\x09\x4c\x87",
+static const struct cipher_testvec speck128_dec_tv_template[] = {
+       { /* Speck128/128 */
+               .key    = "\x00\x01\x02\x03\x04\x05\x06\x07"
+                         "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f",
+               .klen   = 16,
+               .input  = "\x18\x0d\x57\x5c\xdf\xfe\x60\x78"
+                         "\x65\x32\x78\x79\x51\x98\x5d\xa6",
+               .ilen   = 16,
+               .result = "\x20\x6d\x61\x64\x65\x20\x69\x74"
+                         "\x20\x65\x71\x75\x69\x76\x61\x6c",
+               .rlen   = 16,
+       }, { /* Speck128/192 */
+               .key    = "\x00\x01\x02\x03\x04\x05\x06\x07"
+                         "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f"
+                         "\x10\x11\x12\x13\x14\x15\x16\x17",
+               .klen   = 24,
+               .input  = "\x86\x18\x3c\xe0\x5d\x18\xbc\xf9"
+                         "\x66\x55\x13\x13\x3a\xcf\xe4\x1b",
+               .ilen   = 16,
+               .result = "\x65\x6e\x74\x20\x74\x6f\x20\x43"
+                         "\x68\x69\x65\x66\x20\x48\x61\x72",
+               .rlen   = 16,
+       }, { /* Speck128/256 */
+               .key    = "\x00\x01\x02\x03\x04\x05\x06\x07"
+                         "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f"
+                         "\x10\x11\x12\x13\x14\x15\x16\x17"
+                         "\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f",
                .klen   = 32,
-               .iv     = "\x00\x00\x00\x00\x00\x00\x00\x00"
-                         "\x00\x00\x00\x00\x00\x00\x00\x01",
-               .input  = "\x6f\xbf\xd4\xa4\x5d\x71\x16\x79"
-                         "\x63\x9c\xa6\x8e\x40\xbe\x0d\x8a",
+               .input  = "\x43\x8f\x18\x9c\x8d\xb4\xee\x4e"
+                         "\x3e\xf5\xc0\x05\x04\x01\x09\x41",
                .ilen   = 16,
-               .result = "\x30\x31\x32\x33\x34\x35\x36\x37"
-                         "\x38\x39\x41\x42\x43\x44\x45\x46",
+               .result = "\x70\x6f\x6f\x6e\x65\x72\x2e\x20"
+                         "\x49\x6e\x20\x74\x68\x6f\x73\x65",
                .rlen   = 16,
+       },
+};
+
+/*
+ * Speck128-XTS test vectors, taken from the AES-XTS test vectors with the
+ * result recomputed with Speck128 as the cipher
+ */
+
+static const struct cipher_testvec speck128_xts_enc_tv_template[] = {
+       {
+               .key    = "\x00\x00\x00\x00\x00\x00\x00\x00"
+                         "\x00\x00\x00\x00\x00\x00\x00\x00"
+                         "\x00\x00\x00\x00\x00\x00\x00\x00"
+                         "\x00\x00\x00\x00\x00\x00\x00\x00",
+               .klen   = 32,
+               .iv     = "\x00\x00\x00\x00\x00\x00\x00\x00"
+                         "\x00\x00\x00\x00\x00\x00\x00\x00",
+               .input  = "\x00\x00\x00\x00\x00\x00\x00\x00"
+                         "\x00\x00\x00\x00\x00\x00\x00\x00"
+                         "\x00\x00\x00\x00\x00\x00\x00\x00"
+                         "\x00\x00\x00\x00\x00\x00\x00\x00",
+               .ilen   = 32,
+               .result = "\xbe\xa0\xe7\x03\xd7\xfe\xab\x62"
+                         "\x3b\x99\x4a\x64\x74\x77\xac\xed"
+                         "\xd8\xf4\xa6\xcf\xae\xb9\x07\x42"
+                         "\x51\xd9\xb6\x1d\xe0\x5e\xbc\x54",
+               .rlen   = 32,
        }, {
-               .key    = "\x59\x70\x47\x14\xf5\x57\x47\x8c"
-                         "\xd7\x79\xe8\x0f\x54\x88\x79\x44"
-                         "\x0d\x48\xf0\xb7\xb1\x5a\x53\xea"
-                         "\x1c\xaa\x6b\x29\xc2\xca\xfb\xaf",
+               .key    = "\x11\x11\x11\x11\x11\x11\x11\x11"
+                         "\x11\x11\x11\x11\x11\x11\x11\x11"
+                         "\x22\x22\x22\x22\x22\x22\x22\x22"
+                         "\x22\x22\x22\x22\x22\x22\x22\x22",
+               .klen   = 32,
+               .iv     = "\x33\x33\x33\x33\x33\x00\x00\x00"
+                         "\x00\x00\x00\x00\x00\x00\x00\x00",
+               .input  = "\x44\x44\x44\x44\x44\x44\x44\x44"
+                         "\x44\x44\x44\x44\x44\x44\x44\x44"
+                         "\x44\x44\x44\x44\x44\x44\x44\x44"
+                         "\x44\x44\x44\x44\x44\x44\x44\x44",
+               .ilen   = 32,
+               .result = "\xfb\x53\x81\x75\x6f\x9f\x34\xad"
+                         "\x7e\x01\xed\x7b\xcc\xda\x4e\x4a"
+                         "\xd4\x84\xa4\x53\xd5\x88\x73\x1b"
+                         "\xfd\xcb\xae\x0d\xf3\x04\xee\xe6",
+               .rlen   = 32,
+       }, {
+               .key    = "\xff\xfe\xfd\xfc\xfb\xfa\xf9\xf8"
+                         "\xf7\xf6\xf5\xf4\xf3\xf2\xf1\xf0"
+                         "\x22\x22\x22\x22\x22\x22\x22\x22"
+                         "\x22\x22\x22\x22\x22\x22\x22\x22",
+               .klen   = 32,
+               .iv     = "\x33\x33\x33\x33\x33\x00\x00\x00"
+                         "\x00\x00\x00\x00\x00\x00\x00\x00",
+               .input  = "\x44\x44\x44\x44\x44\x44\x44\x44"
+                         "\x44\x44\x44\x44\x44\x44\x44\x44"
+                         "\x44\x44\x44\x44\x44\x44\x44\x44"
+                         "\x44\x44\x44\x44\x44\x44\x44\x44",
+               .ilen   = 32,
+               .result = "\x21\x52\x84\x15\xd1\xf7\x21\x55"
+                         "\xd9\x75\x4a\xd3\xc5\xdb\x9f\x7d"
+                         "\xda\x63\xb2\xf1\x82\xb0\x89\x59"
+                         "\x86\xd4\xaa\xaa\xdd\xff\x4f\x92",
+               .rlen   = 32,
+       }, {
+               .key    = "\x27\x18\x28\x18\x28\x45\x90\x45"
+                         "\x23\x53\x60\x28\x74\x71\x35\x26"
+                         "\x31\x41\x59\x26\x53\x58\x97\x93"
+                         "\x23\x84\x62\x64\x33\x83\x27\x95",
                .klen   = 32,
                .iv     = "\x00\x00\x00\x00\x00\x00\x00\x00"
-                         "\x00\x00\x00\x00\x00\x00\x00\x02",
-               .input  = "\xfd\xb2\x66\x98\x80\x96\x55\xad"
-                         "\x08\x94\x54\x9c\x21\x7c\x69\xe3",
-               .ilen   = 16,
-               .result = "\x30\x31\x32\x33\x34\x35\x36\x37"
-                         "\x38\x39\x41\x42\x43\x44\x45\x46",
-               .rlen   = 16,
+                         "\x00\x00\x00\x00\x00\x00\x00\x00",
+               .input  = "\x00\x01\x02\x03\x04\x05\x06\x07"
+                         "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f"
+                         "\x10\x11\x12\x13\x14\x15\x16\x17"
+                         "\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f"
+                         "\x20\x21\x22\x23\x24\x25\x26\x27"
+                         "\x28\x29\x2a\x2b\x2c\x2d\x2e\x2f"
+                         "\x30\x31\x32\x33\x34\x35\x36\x37"
+                         "\x38\x39\x3a\x3b\x3c\x3d\x3e\x3f"
+                         "\x40\x41\x42\x43\x44\x45\x46\x47"
+                         "\x48\x49\x4a\x4b\x4c\x4d\x4e\x4f"
+                         "\x50\x51\x52\x53\x54\x55\x56\x57"
+                         "\x58\x59\x5a\x5b\x5c\x5d\x5e\x5f"
+                         "\x60\x61\x62\x63\x64\x65\x66\x67"
+                         "\x68\x69\x6a\x6b\x6c\x6d\x6e\x6f"
+                         "\x70\x71\x72\x73\x74\x75\x76\x77"
+                         "\x78\x79\x7a\x7b\x7c\x7d\x7e\x7f"
+                         "\x80\x81\x82\x83\x84\x85\x86\x87"
+                         "\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f"
+                         "\x90\x91\x92\x93\x94\x95\x96\x97"
+                         "\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f"
+                         "\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7"
+                         "\xa8\xa9\xaa\xab\xac\xad\xae\xaf"
+                         "\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7"
+                         "\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf"
+                         "\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7"
+                         "\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf"
+                         "\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7"
+                         "\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf"
+                         "\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7"
+                         "\xe8\xe9\xea\xeb\xec\xed\xee\xef"
+                         "\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7"
+                         "\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff"
+                         "\x00\x01\x02\x03\x04\x05\x06\x07"
+                         "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f"
+                         "\x10\x11\x12\x13\x14\x15\x16\x17"
+                         "\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f"
+                         "\x20\x21\x22\x23\x24\x25\x26\x27"
+                         "\x28\x29\x2a\x2b\x2c\x2d\x2e\x2f"
+                         "\x30\x31\x32\x33\x34\x35\x36\x37"
+                         "\x38\x39\x3a\x3b\x3c\x3d\x3e\x3f"
+                         "\x40\x41\x42\x43\x44\x45\x46\x47"
+                         "\x48\x49\x4a\x4b\x4c\x4d\x4e\x4f"
+                         "\x50\x51\x52\x53\x54\x55\x56\x57"
+                         "\x58\x59\x5a\x5b\x5c\x5d\x5e\x5f"
+                         "\x60\x61\x62\x63\x64\x65\x66\x67"
+                         "\x68\x69\x6a\x6b\x6c\x6d\x6e\x6f"
+                         "\x70\x71\x72\x73\x74\x75\x76\x77"
+                         "\x78\x79\x7a\x7b\x7c\x7d\x7e\x7f"
+                         "\x80\x81\x82\x83\x84\x85\x86\x87"
+                         "\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f"
+                         "\x90\x91\x92\x93\x94\x95\x96\x97"
+                         "\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f"
+                         "\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7"
+                         "\xa8\xa9\xaa\xab\xac\xad\xae\xaf"
+                         "\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7"
+                         "\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf"
+                         "\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7"
+                         "\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf"
+                         "\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7"
+                         "\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf"
+                         "\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7"
+                         "\xe8\xe9\xea\xeb\xec\xed\xee\xef"
+                         "\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7"
+                         "\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff",
+               .ilen   = 512,
+               .result = "\x57\xb5\xf8\x71\x6e\x6d\xdd\x82"
+                         "\x53\xd0\xed\x2d\x30\xc1\x20\xef"
+                         "\x70\x67\x5e\xff\x09\x70\xbb\xc1"
+                         "\x3a\x7b\x48\x26\xd9\x0b\xf4\x48"
+                         "\xbe\xce\xb1\xc7\xb2\x67\xc4\xa7"
+                         "\x76\xf8\x36\x30\xb7\xb4\x9a\xd9"
+                         "\xf5\x9d\xd0\x7b\xc1\x06\x96\x44"
+                         "\x19\xc5\x58\x84\x63\xb9\x12\x68"
+                         "\x68\xc7\xaa\x18\x98\xf2\x1f\x5c"
+                         "\x39\xa6\xd8\x32\x2b\xc3\x51\xfd"
+                         "\x74\x79\x2e\xb4\x44\xd7\x69\xc4"
+                         "\xfc\x29\xe6\xed\x26\x1e\xa6\x9d"
+                         "\x1c\xbe\x00\x0e\x7f\x3a\xca\xfb"
+                         "\x6d\x13\x65\xa0\xf9\x31\x12\xe2"
+                         "\x26\xd1\xec\x2b\x0a\x8b\x59\x99"
+                         "\xa7\x49\xa0\x0e\x09\x33\x85\x50"
+                         "\xc3\x23\xca\x7a\xdd\x13\x45\x5f"
+                         "\xde\x4c\xa7\xcb\x00\x8a\x66\x6f"
+                         "\xa2\xb6\xb1\x2e\xe1\xa0\x18\xf6"
+                         "\xad\xf3\xbd\xeb\xc7\xef\x55\x4f"
+                         "\x79\x91\x8d\x36\x13\x7b\xd0\x4a"
+                         "\x6c\x39\xfb\x53\xb8\x6f\x02\x51"
+                         "\xa5\x20\xac\x24\x1c\x73\x59\x73"
+                         "\x58\x61\x3a\x87\x58\xb3\x20\x56"
+                         "\x39\x06\x2b\x4d\xd3\x20\x2b\x89"
+                         "\x3f\xa2\xf0\x96\xeb\x7f\xa4\xcd"
+                         "\x11\xae\xbd\xcb\x3a\xb4\xd9\x91"
+                         "\x09\x35\x71\x50\x65\xac\x92\xe3"
+                         "\x7b\x32\xc0\x7a\xdd\xd4\xc3\x92"
+                         "\x6f\xeb\x79\xde\x6f\xd3\x25\xc9"
+                         "\xcd\x63\xf5\x1e\x7a\x3b\x26\x9d"
+                         "\x77\x04\x80\xa9\xbf\x38\xb5\xbd"
+                         "\xb8\x05\x07\xbd\xfd\xab\x7b\xf8"
+                         "\x2a\x26\xcc\x49\x14\x6d\x55\x01"
+                         "\x06\x94\xd8\xb2\x2d\x53\x83\x1b"
+                         "\x8f\xd4\xdd\x57\x12\x7e\x18\xba"
+                         "\x8e\xe2\x4d\x80\xef\x7e\x6b\x9d"
+                         "\x24\xa9\x60\xa4\x97\x85\x86\x2a"
+                         "\x01\x00\x09\xf1\xcb\x4a\x24\x1c"
+                         "\xd8\xf6\xe6\x5b\xe7\x5d\xf2\xc4"
+                         "\x97\x1c\x10\xc6\x4d\x66\x4f\x98"
+                         "\x87\x30\xac\xd5\xea\x73\x49\x10"
+                         "\x80\xea\xe5\x5f\x4d\x5f\x03\x33"
+                         "\x66\x02\x35\x3d\x60\x06\x36\x4f"
+                         "\x14\x1c\xd8\x07\x1f\x78\xd0\xf8"
+                         "\x4f\x6c\x62\x7c\x15\xa5\x7c\x28"
+                         "\x7c\xcc\xeb\x1f\xd1\x07\x90\x93"
+                         "\x7e\xc2\xa8\x3a\x80\xc0\xf5\x30"
+                         "\xcc\x75\xcf\x16\x26\xa9\x26\x3b"
+                         "\xe7\x68\x2f\x15\x21\x5b\xe4\x00"
+                         "\xbd\x48\x50\xcd\x75\x70\xc4\x62"
+                         "\xbb\x41\xfb\x89\x4a\x88\x3b\x3b"
+                         "\x51\x66\x02\x69\x04\x97\x36\xd4"
+                         "\x75\xae\x0b\xa3\x42\xf8\xca\x79"
+                         "\x8f\x93\xe9\xcc\x38\xbd\xd6\xd2"
+                         "\xf9\x70\x4e\xc3\x6a\x8e\x25\xbd"
+                         "\xea\x15\x5a\xa0\x85\x7e\x81\x0d"
+                         "\x03\xe7\x05\x39\xf5\x05\x26\xee"
+                         "\xec\xaa\x1f\x3d\xc9\x98\x76\x01"
+                         "\x2c\xf4\xfc\xa3\x88\x77\x38\xc4"
+                         "\x50\x65\x50\x6d\x04\x1f\xdf\x5a"
+                         "\xaa\xf2\x01\xa9\xc1\x8d\xee\xca"
+                         "\x47\x26\xef\x39\xb8\xb4\xf2\xd1"
+                         "\xd6\xbb\x1b\x2a\xc1\x34\x14\xcf",
+               .rlen   = 512,
        }, {
-               .key    = "\xd8\x2a\x91\x34\xb2\x6a\x56\x50"
-                         "\x30\xfe\x69\xe2\x37\x7f\x98\x47"
-                         "\xcd\xf9\x0b\x16\x0c\x64\x8f\xb6"
-                         "\xb0\x0d\x0d\x1b\xae\x85\x87\x1f",
+               .key    = "\x27\x18\x28\x18\x28\x45\x90\x45"
+                         "\x23\x53\x60\x28\x74\x71\x35\x26"
+                         "\x62\x49\x77\x57\x24\x70\x93\x69"
+                         "\x99\x59\x57\x49\x66\x96\x76\x27"
+                         "\x31\x41\x59\x26\x53\x58\x97\x93"
+                         "\x23\x84\x62\x64\x33\x83\x27\x95"
+                         "\x02\x88\x41\x97\x16\x93\x99\x37"
+                         "\x51\x05\x82\x09\x74\x94\x45\x92",
+               .klen   = 64,
+               .iv     = "\xff\x00\x00\x00\x00\x00\x00\x00"
+                         "\x00\x00\x00\x00\x00\x00\x00\x00",
+               .input  = "\x00\x01\x02\x03\x04\x05\x06\x07"
+                         "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f"
+                         "\x10\x11\x12\x13\x14\x15\x16\x17"
+                         "\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f"
+                         "\x20\x21\x22\x23\x24\x25\x26\x27"
+                         "\x28\x29\x2a\x2b\x2c\x2d\x2e\x2f"
+                         "\x30\x31\x32\x33\x34\x35\x36\x37"
+                         "\x38\x39\x3a\x3b\x3c\x3d\x3e\x3f"
+                         "\x40\x41\x42\x43\x44\x45\x46\x47"
+                         "\x48\x49\x4a\x4b\x4c\x4d\x4e\x4f"
+                         "\x50\x51\x52\x53\x54\x55\x56\x57"
+                         "\x58\x59\x5a\x5b\x5c\x5d\x5e\x5f"
+                         "\x60\x61\x62\x63\x64\x65\x66\x67"
+                         "\x68\x69\x6a\x6b\x6c\x6d\x6e\x6f"
+                         "\x70\x71\x72\x73\x74\x75\x76\x77"
+                         "\x78\x79\x7a\x7b\x7c\x7d\x7e\x7f"
+                         "\x80\x81\x82\x83\x84\x85\x86\x87"
+                         "\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f"
+                         "\x90\x91\x92\x93\x94\x95\x96\x97"
+                         "\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f"
+                         "\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7"
+                         "\xa8\xa9\xaa\xab\xac\xad\xae\xaf"
+                         "\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7"
+                         "\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf"
+                         "\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7"
+                         "\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf"
+                         "\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7"
+                         "\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf"
+                         "\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7"
+                         "\xe8\xe9\xea\xeb\xec\xed\xee\xef"
+                         "\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7"
+                         "\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff"
+                         "\x00\x01\x02\x03\x04\x05\x06\x07"
+                         "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f"
+                         "\x10\x11\x12\x13\x14\x15\x16\x17"
+                         "\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f"
+                         "\x20\x21\x22\x23\x24\x25\x26\x27"
+                         "\x28\x29\x2a\x2b\x2c\x2d\x2e\x2f"
+                         "\x30\x31\x32\x33\x34\x35\x36\x37"
+                         "\x38\x39\x3a\x3b\x3c\x3d\x3e\x3f"
+                         "\x40\x41\x42\x43\x44\x45\x46\x47"
+                         "\x48\x49\x4a\x4b\x4c\x4d\x4e\x4f"
+                         "\x50\x51\x52\x53\x54\x55\x56\x57"
+                         "\x58\x59\x5a\x5b\x5c\x5d\x5e\x5f"
+                         "\x60\x61\x62\x63\x64\x65\x66\x67"
+                         "\x68\x69\x6a\x6b\x6c\x6d\x6e\x6f"
+                         "\x70\x71\x72\x73\x74\x75\x76\x77"
+                         "\x78\x79\x7a\x7b\x7c\x7d\x7e\x7f"
+                         "\x80\x81\x82\x83\x84\x85\x86\x87"
+                         "\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f"
+                         "\x90\x91\x92\x93\x94\x95\x96\x97"
+                         "\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f"
+                         "\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7"
+                         "\xa8\xa9\xaa\xab\xac\xad\xae\xaf"
+                         "\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7"
+                         "\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf"
+                         "\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7"
+                         "\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf"
+                         "\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7"
+                         "\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf"
+                         "\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7"
+                         "\xe8\xe9\xea\xeb\xec\xed\xee\xef"
+                         "\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7"
+                         "\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff",
+               .ilen   = 512,
+               .result = "\xc5\x85\x2a\x4b\x73\xe4\xf6\xf1"
+                         "\x7e\xf9\xf6\xe9\xa3\x73\x36\xcb"
+                         "\xaa\xb6\x22\xb0\x24\x6e\x3d\x73"
+                         "\x92\x99\xde\xd3\x76\xed\xcd\x63"
+                         "\x64\x3a\x22\x57\xc1\x43\x49\xd4"
+                         "\x79\x36\x31\x19\x62\xae\x10\x7e"
+                         "\x7d\xcf\x7a\xe2\x6b\xce\x27\xfa"
+                         "\xdc\x3d\xd9\x83\xd3\x42\x4c\xe0"
+                         "\x1b\xd6\x1d\x1a\x6f\xd2\x03\x00"
+                         "\xfc\x81\x99\x8a\x14\x62\xf5\x7e"
+                         "\x0d\xe7\x12\xe8\x17\x9d\x0b\xec"
+                         "\xe2\xf7\xc9\xa7\x63\xd1\x79\xb6"
+                         "\x62\x62\x37\xfe\x0a\x4c\x4a\x37"
+                         "\x70\xc7\x5e\x96\x5f\xbc\x8e\x9e"
+                         "\x85\x3c\x4f\x26\x64\x85\xbc\x68"
+                         "\xb0\xe0\x86\x5e\x26\x41\xce\x11"
+                         "\x50\xda\x97\x14\xe9\x9e\xc7\x6d"
+                         "\x3b\xdc\x43\xde\x2b\x27\x69\x7d"
+                         "\xfc\xb0\x28\xbd\x8f\xb1\xc6\x31"
+                         "\x14\x4d\xf0\x74\x37\xfd\x07\x25"
+                         "\x96\x55\xe5\xfc\x9e\x27\x2a\x74"
+                         "\x1b\x83\x4d\x15\x83\xac\x57\xa0"
+                         "\xac\xa5\xd0\x38\xef\x19\x56\x53"
+                         "\x25\x4b\xfc\xce\x04\x23\xe5\x6b"
+                         "\xf6\xc6\x6c\x32\x0b\xb3\x12\xc5"
+                         "\xed\x22\x34\x1c\x5d\xed\x17\x06"
+                         "\x36\xa3\xe6\x77\xb9\x97\x46\xb8"
+                         "\xe9\x3f\x7e\xc7\xbc\x13\x5c\xdc"
+                         "\x6e\x3f\x04\x5e\xd1\x59\xa5\x82"
+                         "\x35\x91\x3d\x1b\xe4\x97\x9f\x92"
+                         "\x1c\x5e\x5f\x6f\x41\xd4\x62\xa1"
+                         "\x8d\x39\xfc\x42\xfb\x38\x80\xb9"
+                         "\x0a\xe3\xcc\x6a\x93\xd9\x7a\xb1"
+                         "\xe9\x69\xaf\x0a\x6b\x75\x38\xa7"
+                         "\xa1\xbf\xf7\xda\x95\x93\x4b\x78"
+                         "\x19\xf5\x94\xf9\xd2\x00\x33\x37"
+                         "\xcf\xf5\x9e\x9c\xf3\xcc\xa6\xee"
+                         "\x42\xb2\x9e\x2c\x5f\x48\x23\x26"
+                         "\x15\x25\x17\x03\x3d\xfe\x2c\xfc"
+                         "\xeb\xba\xda\xe0\x00\x05\xb6\xa6"
+                         "\x07\xb3\xe8\x36\x5b\xec\x5b\xbf"
+                         "\xd6\x5b\x00\x74\xc6\x97\xf1\x6a"
+                         "\x49\xa1\xc3\xfa\x10\x52\xb9\x14"
+                         "\xad\xb7\x73\xf8\x78\x12\xc8\x59"
+                         "\x17\x80\x4c\x57\x39\xf1\x6d\x80"
+                         "\x25\x77\x0f\x5e\x7d\xf0\xaf\x21"
+                         "\xec\xce\xb7\xc8\x02\x8a\xed\x53"
+                         "\x2c\x25\x68\x2e\x1f\x85\x5e\x67"
+                         "\xd1\x07\x7a\x3a\x89\x08\xe0\x34"
+                         "\xdc\xdb\x26\xb4\x6b\x77\xfc\x40"
+                         "\x31\x15\x72\xa0\xf0\x73\xd9\x3b"
+                         "\xd5\xdb\xfe\xfc\x8f\xa9\x44\xa2"
+                         "\x09\x9f\xc6\x33\xe5\xe2\x88\xe8"
+                         "\xf3\xf0\x1a\xf4\xce\x12\x0f\xd6"
+                         "\xf7\x36\xe6\xa4\xf4\x7a\x10\x58"
+                         "\xcc\x1f\x48\x49\x65\x47\x75\xe9"
+                         "\x28\xe1\x65\x7b\xf2\xc4\xb5\x07"
+                         "\xf2\xec\x76\xd8\x8f\x09\xf3\x16"
+                         "\xa1\x51\x89\x3b\xeb\x96\x42\xac"
+                         "\x65\xe0\x67\x63\x29\xdc\xb4\x7d"
+                         "\xf2\x41\x51\x6a\xcb\xde\x3c\xfb"
+                         "\x66\x8d\x13\xca\xe0\x59\x2a\x00"
+                         "\xc9\x53\x4c\xe6\x9e\xe2\x73\xd5"
+                         "\x67\x19\xb2\xbd\x9a\x63\xd7\x5c",
+               .rlen   = 512,
+               .also_non_np = 1,
+               .np     = 3,
+               .tap    = { 512 - 20, 4, 16 },
+       }
+};
+
+static const struct cipher_testvec speck128_xts_dec_tv_template[] = {
+       {
+               .key    = "\x00\x00\x00\x00\x00\x00\x00\x00"
+                         "\x00\x00\x00\x00\x00\x00\x00\x00"
+                         "\x00\x00\x00\x00\x00\x00\x00\x00"
+                         "\x00\x00\x00\x00\x00\x00\x00\x00",
                .klen   = 32,
                .iv     = "\x00\x00\x00\x00\x00\x00\x00\x00"
-                         "\x00\x00\x00\x02\x00\x00\x00\x00",
-               .input  = "\x14\x5e\x3d\x70\xc0\x6e\x9c\x34"
-                         "\x5b\x5e\xcf\x0f\xe4\x8c\x21\x5c",
-               .ilen   = 16,
-               .result = "\x30\x31\x32\x33\x34\x35\x36\x37"
-                         "\x38\x39\x41\x42\x43\x44\x45\x46",
-               .rlen   = 16,
-       }, {
-               .key    = "\x0f\x6a\xef\xf8\xd3\xd2\xbb\x15"
-                         "\x25\x83\xf7\x3c\x1f\x01\x28\x74"
-                         "\xca\xc6\xbc\x35\x4d\x4a\x65\x54"
-                         "\x90\xae\x61\xcf\x7b\xae\xbd\xcc"
-                         "\xad\xe4\x94\xc5\x4a\x29\xae\x70",
-               .klen   = 40,
-               .iv     = "\x00\x00\x00\x00\x00\x00\x00\x00"
-                         "\x00\x00\x00\x00\x00\x00\x00\x01",
-               .input  = "\x25\x39\xaa\xa5\xf0\x65\xc8\xdc"
-                         "\x5d\x45\x95\x30\x8f\xff\x2f\x1b",
-               .ilen   = 16,
-               .result = "\x30\x31\x32\x33\x34\x35\x36\x37"
-                         "\x38\x39\x41\x42\x43\x44\x45\x46",
-               .rlen   = 16,
+                         "\x00\x00\x00\x00\x00\x00\x00\x00",
+               .input  = "\xbe\xa0\xe7\x03\xd7\xfe\xab\x62"
+                         "\x3b\x99\x4a\x64\x74\x77\xac\xed"
+                         "\xd8\xf4\xa6\xcf\xae\xb9\x07\x42"
+                         "\x51\xd9\xb6\x1d\xe0\x5e\xbc\x54",
+               .ilen   = 32,
+               .result = "\x00\x00\x00\x00\x00\x00\x00\x00"
+                         "\x00\x00\x00\x00\x00\x00\x00\x00"
+                         "\x00\x00\x00\x00\x00\x00\x00\x00"
+                         "\x00\x00\x00\x00\x00\x00\x00\x00",
+               .rlen   = 32,
        }, {
-               .key    = "\x8a\xd4\xee\x10\x2f\xbd\x81\xff"
-                         "\xf8\x86\xce\xac\x93\xc5\xad\xc6"
-                         "\xa0\x19\x07\xc0\x9d\xf7\xbb\xdd"
-                         "\x52\x13\xb2\xb7\xf0\xff\x11\xd8"
-                         "\xd6\x08\xd0\xcd\x2e\xb1\x17\x6f",
-               .klen   = 40,
-               .iv     = "\x00\x00\x00\x00\x00\x00\x00\x00"
-                         "\x00\x00\x00\x02\x00\x00\x00\x00",
-               .input  = "\x0c\x20\x20\x63\xd6\x8b\xfc\x8f"
-                         "\xc0\xe2\x17\xbb\xd2\x59\x6f\x26",
-               .ilen   = 16,
-               .result = "\x30\x31\x32\x33\x34\x35\x36\x37"
-                         "\x38\x39\x41\x42\x43\x44\x45\x46",
-               .rlen   = 16,
+               .key    = "\x11\x11\x11\x11\x11\x11\x11\x11"
+                         "\x11\x11\x11\x11\x11\x11\x11\x11"
+                         "\x22\x22\x22\x22\x22\x22\x22\x22"
+                         "\x22\x22\x22\x22\x22\x22\x22\x22",
+               .klen   = 32,
+               .iv     = "\x33\x33\x33\x33\x33\x00\x00\x00"
+                         "\x00\x00\x00\x00\x00\x00\x00\x00",
+               .input  = "\xfb\x53\x81\x75\x6f\x9f\x34\xad"
+                         "\x7e\x01\xed\x7b\xcc\xda\x4e\x4a"
+                         "\xd4\x84\xa4\x53\xd5\x88\x73\x1b"
+                         "\xfd\xcb\xae\x0d\xf3\x04\xee\xe6",
+               .ilen   = 32,
+               .result = "\x44\x44\x44\x44\x44\x44\x44\x44"
+                         "\x44\x44\x44\x44\x44\x44\x44\x44"
+                         "\x44\x44\x44\x44\x44\x44\x44\x44"
+                         "\x44\x44\x44\x44\x44\x44\x44\x44",
+               .rlen   = 32,
        }, {
-               .key    = "\xf8\xd4\x76\xff\xd6\x46\xee\x6c"
-                         "\x23\x84\xcb\x1c\x77\xd6\x19\x5d"
-                         "\xfe\xf1\xa9\xf3\x7b\xbc\x8d\x21"
-                         "\xa7\x9c\x21\xf8\xcb\x90\x02\x89"
-                         "\xa8\x45\x34\x8e\xc8\xc5\xb5\xf1"
-                         "\x26\xf5\x0e\x76\xfe\xfd\x1b\x1e",
-               .klen   = 48,
-               .iv     = "\x00\x00\x00\x00\x00\x00\x00\x00"
-                         "\x00\x00\x00\x00\x00\x00\x00\x01",
-               .input  = "\xc1\x35\x2e\x53\xf0\x96\x4d\x9c"
-                         "\x2e\x18\xe6\x99\xcd\xd3\x15\x68",
-               .ilen   = 16,
-               .result = "\x30\x31\x32\x33\x34\x35\x36\x37"
-                         "\x38\x39\x41\x42\x43\x44\x45\x46",
-               .rlen   = 16,
+               .key    = "\xff\xfe\xfd\xfc\xfb\xfa\xf9\xf8"
+                         "\xf7\xf6\xf5\xf4\xf3\xf2\xf1\xf0"
+                         "\x22\x22\x22\x22\x22\x22\x22\x22"
+                         "\x22\x22\x22\x22\x22\x22\x22\x22",
+               .klen   = 32,
+               .iv     = "\x33\x33\x33\x33\x33\x00\x00\x00"
+                         "\x00\x00\x00\x00\x00\x00\x00\x00",
+               .input  = "\x21\x52\x84\x15\xd1\xf7\x21\x55"
+                         "\xd9\x75\x4a\xd3\xc5\xdb\x9f\x7d"
+                         "\xda\x63\xb2\xf1\x82\xb0\x89\x59"
+                         "\x86\xd4\xaa\xaa\xdd\xff\x4f\x92",
+               .ilen   = 32,
+               .result = "\x44\x44\x44\x44\x44\x44\x44\x44"
+                         "\x44\x44\x44\x44\x44\x44\x44\x44"
+                         "\x44\x44\x44\x44\x44\x44\x44\x44"
+                         "\x44\x44\x44\x44\x44\x44\x44\x44",
+               .rlen   = 32,
        }, {
-               .key    = "\xfb\x76\x15\xb2\x3d\x80\x89\x1d"
-                         "\xd4\x70\x98\x0b\xc7\x95\x84\xc8"
-                         "\xb2\xfb\x64\xce\x60\x97\x87\x8d"
-                         "\x17\xfc\xe4\x5a\x49\xe8\x30\xb7"
-                         "\x6e\x78\x17\xe7\x2d\x5e\x12\xd4"
-                         "\x60\x64\x04\x7a\xf1\x2f\x9e\x0c",
-               .klen   = 48,
+               .key    = "\x27\x18\x28\x18\x28\x45\x90\x45"
+                         "\x23\x53\x60\x28\x74\x71\x35\x26"
+                         "\x31\x41\x59\x26\x53\x58\x97\x93"
+                         "\x23\x84\x62\x64\x33\x83\x27\x95",
+               .klen   = 32,
                .iv     = "\x00\x00\x00\x00\x00\x00\x00\x00"
-                         "\x00\x00\x00\x02\x00\x00\x00\x00",
-               .input  = "\x86\x0a\xc6\xa9\x1a\x9f\xe7\xe6"
-                         "\x64\x3b\x33\xd6\xd5\x84\xd6\xdf",
-               .ilen   = 16,
-               .result = "\x30\x31\x32\x33\x34\x35\x36\x37"
-                         "\x38\x39\x41\x42\x43\x44\x45\x46",
-               .rlen   = 16,
+                         "\x00\x00\x00\x00\x00\x00\x00\x00",
+               .input  = "\x57\xb5\xf8\x71\x6e\x6d\xdd\x82"
+                         "\x53\xd0\xed\x2d\x30\xc1\x20\xef"
+                         "\x70\x67\x5e\xff\x09\x70\xbb\xc1"
+                         "\x3a\x7b\x48\x26\xd9\x0b\xf4\x48"
+                         "\xbe\xce\xb1\xc7\xb2\x67\xc4\xa7"
+                         "\x76\xf8\x36\x30\xb7\xb4\x9a\xd9"
+                         "\xf5\x9d\xd0\x7b\xc1\x06\x96\x44"
+                         "\x19\xc5\x58\x84\x63\xb9\x12\x68"
+                         "\x68\xc7\xaa\x18\x98\xf2\x1f\x5c"
+                         "\x39\xa6\xd8\x32\x2b\xc3\x51\xfd"
+                         "\x74\x79\x2e\xb4\x44\xd7\x69\xc4"
+                         "\xfc\x29\xe6\xed\x26\x1e\xa6\x9d"
+                         "\x1c\xbe\x00\x0e\x7f\x3a\xca\xfb"
+                         "\x6d\x13\x65\xa0\xf9\x31\x12\xe2"
+                         "\x26\xd1\xec\x2b\x0a\x8b\x59\x99"
+                         "\xa7\x49\xa0\x0e\x09\x33\x85\x50"
+                         "\xc3\x23\xca\x7a\xdd\x13\x45\x5f"
+                         "\xde\x4c\xa7\xcb\x00\x8a\x66\x6f"
+                         "\xa2\xb6\xb1\x2e\xe1\xa0\x18\xf6"
+                         "\xad\xf3\xbd\xeb\xc7\xef\x55\x4f"
+                         "\x79\x91\x8d\x36\x13\x7b\xd0\x4a"
+                         "\x6c\x39\xfb\x53\xb8\x6f\x02\x51"
+                         "\xa5\x20\xac\x24\x1c\x73\x59\x73"
+                         "\x58\x61\x3a\x87\x58\xb3\x20\x56"
+                         "\x39\x06\x2b\x4d\xd3\x20\x2b\x89"
+                         "\x3f\xa2\xf0\x96\xeb\x7f\xa4\xcd"
+                         "\x11\xae\xbd\xcb\x3a\xb4\xd9\x91"
+                         "\x09\x35\x71\x50\x65\xac\x92\xe3"
+                         "\x7b\x32\xc0\x7a\xdd\xd4\xc3\x92"
+                         "\x6f\xeb\x79\xde\x6f\xd3\x25\xc9"
+                         "\xcd\x63\xf5\x1e\x7a\x3b\x26\x9d"
+                         "\x77\x04\x80\xa9\xbf\x38\xb5\xbd"
+                         "\xb8\x05\x07\xbd\xfd\xab\x7b\xf8"
+                         "\x2a\x26\xcc\x49\x14\x6d\x55\x01"
+                         "\x06\x94\xd8\xb2\x2d\x53\x83\x1b"
+                         "\x8f\xd4\xdd\x57\x12\x7e\x18\xba"
+                         "\x8e\xe2\x4d\x80\xef\x7e\x6b\x9d"
+                         "\x24\xa9\x60\xa4\x97\x85\x86\x2a"
+                         "\x01\x00\x09\xf1\xcb\x4a\x24\x1c"
+                         "\xd8\xf6\xe6\x5b\xe7\x5d\xf2\xc4"
+                         "\x97\x1c\x10\xc6\x4d\x66\x4f\x98"
+                         "\x87\x30\xac\xd5\xea\x73\x49\x10"
+                         "\x80\xea\xe5\x5f\x4d\x5f\x03\x33"
+                         "\x66\x02\x35\x3d\x60\x06\x36\x4f"
+                         "\x14\x1c\xd8\x07\x1f\x78\xd0\xf8"
+                         "\x4f\x6c\x62\x7c\x15\xa5\x7c\x28"
+                         "\x7c\xcc\xeb\x1f\xd1\x07\x90\x93"
+                         "\x7e\xc2\xa8\x3a\x80\xc0\xf5\x30"
+                         "\xcc\x75\xcf\x16\x26\xa9\x26\x3b"
+                         "\xe7\x68\x2f\x15\x21\x5b\xe4\x00"
+                         "\xbd\x48\x50\xcd\x75\x70\xc4\x62"
+                         "\xbb\x41\xfb\x89\x4a\x88\x3b\x3b"
+                         "\x51\x66\x02\x69\x04\x97\x36\xd4"
+                         "\x75\xae\x0b\xa3\x42\xf8\xca\x79"
+                         "\x8f\x93\xe9\xcc\x38\xbd\xd6\xd2"
+                         "\xf9\x70\x4e\xc3\x6a\x8e\x25\xbd"
+                         "\xea\x15\x5a\xa0\x85\x7e\x81\x0d"
+                         "\x03\xe7\x05\x39\xf5\x05\x26\xee"
+                         "\xec\xaa\x1f\x3d\xc9\x98\x76\x01"
+                         "\x2c\xf4\xfc\xa3\x88\x77\x38\xc4"
+                         "\x50\x65\x50\x6d\x04\x1f\xdf\x5a"
+                         "\xaa\xf2\x01\xa9\xc1\x8d\xee\xca"
+                         "\x47\x26\xef\x39\xb8\xb4\xf2\xd1"
+                         "\xd6\xbb\x1b\x2a\xc1\x34\x14\xcf",
+               .ilen   = 512,
+               .result = "\x00\x01\x02\x03\x04\x05\x06\x07"
+                         "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f"
+                         "\x10\x11\x12\x13\x14\x15\x16\x17"
+                         "\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f"
+                         "\x20\x21\x22\x23\x24\x25\x26\x27"
+                         "\x28\x29\x2a\x2b\x2c\x2d\x2e\x2f"
+                         "\x30\x31\x32\x33\x34\x35\x36\x37"
+                         "\x38\x39\x3a\x3b\x3c\x3d\x3e\x3f"
+                         "\x40\x41\x42\x43\x44\x45\x46\x47"
+                         "\x48\x49\x4a\x4b\x4c\x4d\x4e\x4f"
+                         "\x50\x51\x52\x53\x54\x55\x56\x57"
+                         "\x58\x59\x5a\x5b\x5c\x5d\x5e\x5f"
+                         "\x60\x61\x62\x63\x64\x65\x66\x67"
+                         "\x68\x69\x6a\x6b\x6c\x6d\x6e\x6f"
+                         "\x70\x71\x72\x73\x74\x75\x76\x77"
+                         "\x78\x79\x7a\x7b\x7c\x7d\x7e\x7f"
+                         "\x80\x81\x82\x83\x84\x85\x86\x87"
+                         "\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f"
+                         "\x90\x91\x92\x93\x94\x95\x96\x97"
+                         "\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f"
+                         "\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7"
+                         "\xa8\xa9\xaa\xab\xac\xad\xae\xaf"
+                         "\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7"
+                         "\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf"
+                         "\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7"
+                         "\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf"
+                         "\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7"
+                         "\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf"
+                         "\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7"
+                         "\xe8\xe9\xea\xeb\xec\xed\xee\xef"
+                         "\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7"
+                         "\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff"
+                         "\x00\x01\x02\x03\x04\x05\x06\x07"
+                         "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f"
+                         "\x10\x11\x12\x13\x14\x15\x16\x17"
+                         "\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f"
+                         "\x20\x21\x22\x23\x24\x25\x26\x27"
+                         "\x28\x29\x2a\x2b\x2c\x2d\x2e\x2f"
+                         "\x30\x31\x32\x33\x34\x35\x36\x37"
+                         "\x38\x39\x3a\x3b\x3c\x3d\x3e\x3f"
+                         "\x40\x41\x42\x43\x44\x45\x46\x47"
+                         "\x48\x49\x4a\x4b\x4c\x4d\x4e\x4f"
+                         "\x50\x51\x52\x53\x54\x55\x56\x57"
+                         "\x58\x59\x5a\x5b\x5c\x5d\x5e\x5f"
+                         "\x60\x61\x62\x63\x64\x65\x66\x67"
+                         "\x68\x69\x6a\x6b\x6c\x6d\x6e\x6f"
+                         "\x70\x71\x72\x73\x74\x75\x76\x77"
+                         "\x78\x79\x7a\x7b\x7c\x7d\x7e\x7f"
+                         "\x80\x81\x82\x83\x84\x85\x86\x87"
+                         "\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f"
+                         "\x90\x91\x92\x93\x94\x95\x96\x97"
+                         "\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f"
+                         "\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7"
+                         "\xa8\xa9\xaa\xab\xac\xad\xae\xaf"
+                         "\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7"
+                         "\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf"
+                         "\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7"
+                         "\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf"
+                         "\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7"
+                         "\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf"
+                         "\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7"
+                         "\xe8\xe9\xea\xeb\xec\xed\xee\xef"
+                         "\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7"
+                         "\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff",
+               .rlen   = 512,
        }, {
-               .key    = "\xf8\xd4\x76\xff\xd6\x46\xee\x6c"
-                         "\x23\x84\xcb\x1c\x77\xd6\x19\x5d"
-                         "\xfe\xf1\xa9\xf3\x7b\xbc\x8d\x21"
-                         "\xa7\x9c\x21\xf8\xcb\x90\x02\x89"
-                         "\xa8\x45\x34\x8e\xc8\xc5\xb5\xf1"
-                         "\x26\xf5\x0e\x76\xfe\xfd\x1b\x1e",
-               .klen   = 48,
-               .iv     = "\x00\x00\x00\x00\x00\x00\x00\x00"
-                         "\x00\x00\x00\x00\x00\x00\x00\x01",
-               .input  = "\xe3\x5a\x38\x0f\x4d\x92\x3a\x74"
-                         "\x15\xb1\x50\x8c\x9a\xd8\x99\x1d"
-                         "\x82\xec\xf1\x5f\x03\x6d\x02\x58"
-                         "\x90\x67\xfc\xdd\x8d\xe1\x38\x08"
-                         "\x7b\xc9\x9b\x4b\x04\x09\x50\x15"
-                         "\xce\xab\xda\x33\x30\x20\x12\xfa"
-                         "\x83\xc4\xa6\x9a\x2e\x7d\x90\xd9"
-                         "\xa6\xa6\x67\x43\xb4\xa7\xa8\x5c"
-                         "\xbb\x6a\x49\x2b\x8b\xf8\xd0\x22"
-                         "\xe5\x9e\xba\xe8\x8c\x67\xb8\x5b"
-                         "\x60\xbc\xf5\xa4\x95\x4e\x66\xe5"
-                         "\x6d\x8e\xa9\xf6\x65\x2e\x04\xf5"
-                         "\xba\xb5\xdb\x88\xc2\xf6\x7a\x4b"
-                         "\x89\x58\x7c\x9a\xae\x26\xe8\xb7"
-                         "\xb7\x28\xcc\xd6\xcc\xa5\x98\x4d"
-                         "\xb9\x91\xcb\xb4\xe4\x8b\x96\x47"
-                         "\x5f\x03\x8b\xdd\x94\xd1\xee\x12"
-                         "\xa7\x83\x80\xf2\xc1\x15\x74\x4f"
-                         "\x49\xf9\xb0\x7e\x6f\xdc\x73\x2f"
-                         "\xe2\xcf\xe0\x1b\x34\xa5\xa0\x52"
-                         "\xfb\x3c\x5d\x85\x91\xe6\x6d\x98"
-                         "\x04\xd6\xdd\x4c\x00\x64\xd9\x54"
-                         "\x5c\x3c\x08\x1d\x4c\x06\x9f\xb8"
-                         "\x1c\x4d\x8d\xdc\xa4\x3c\xb9\x3b"
-                         "\x9e\x85\xce\xc3\xa8\x4a\x0c\xd9"
-                         "\x04\xc3\x6f\x17\x66\xa9\x1f\x59"
-                         "\xd9\xe2\x19\x36\xa3\x88\xb8\x0b"
-                         "\x0f\x4a\x4d\xf8\xc8\x6f\xd5\x43"
-                         "\xeb\xa0\xab\x1f\x61\xc0\x06\xeb"
-                         "\x93\xb7\xb8\x6f\x0d\xbd\x07\x49"
-                         "\xb3\xac\x5d\xcf\x31\xa0\x27\x26"
-                         "\x21\xbe\x94\x2e\x19\xea\xf4\xee"
-                         "\xb5\x13\x89\xf7\x94\x0b\xef\x59"
-                         "\x44\xc5\x78\x8b\x3c\x3b\x71\x20"
-                         "\xf9\x35\x0c\x70\x74\xdc\x5b\xc2"
-                         "\xb4\x11\x0e\x2c\x61\xa1\x52\x46"
-                         "\x18\x11\x16\xc6\x86\x44\xa7\xaf"
-                         "\xd5\x0c\x7d\xa6\x9e\x25\x2d\x1b"
-                         "\x9a\x8f\x0f\xf8\x6a\x61\xa0\xea"
-                         "\x3f\x0e\x90\xd6\x8f\x83\x30\x64"
-                         "\xb5\x51\x2d\x08\x3c\xcd\x99\x36"
-                         "\x96\xd4\xb1\xb5\x48\x30\xca\x48"
-                         "\xf7\x11\xa8\xf5\x97\x8a\x6a\x6d"
-                         "\x12\x33\x2f\xc0\xe8\xda\xec\x8a"
-                         "\xe1\x88\x72\x63\xde\x20\xa3\xe1"
-                         "\x8e\xac\x84\x37\x35\xf5\xf7\x3f"
-                         "\x00\x02\x0e\xe4\xc1\x53\x68\x3f"
-                         "\xaa\xd5\xac\x52\x3d\x20\x2f\x4d"
-                         "\x7c\x83\xd0\xbd\xaa\x97\x35\x36"
-                         "\x98\x88\x59\x5d\xe7\x24\xe3\x90"
-                         "\x9d\x30\x47\xa7\xc3\x60\x35\xf4"
-                         "\xd5\xdb\x0e\x4d\x44\xc1\x81\x8b"
-                         "\xfd\xbd\xc3\x2b\xba\x68\xfe\x8d"
-                         "\x49\x5a\x3c\x8a\xa3\x01\xae\x25"
-                         "\x42\xab\xd2\x87\x1b\x35\xd6\xd2"
-                         "\xd7\x70\x1c\x1f\x72\xd1\xe1\x39"
-                         "\x1c\x58\xa2\xb4\xd0\x78\x55\x72"
-                         "\x76\x59\xea\xd9\xd7\x6e\x63\x8b"
-                         "\xcc\x9b\xa7\x74\x89\xfc\xa3\x68"
-                         "\x86\x28\xd1\xbb\x54\x8d\x66\xad"
-                         "\x2a\x92\xf9\x4e\x04\x3d\xae\xfd"
-                         "\x1b\x2b\x7f\xc3\x2f\x1a\x78\x0a"
-                         "\x5c\xc6\x84\xfe\x7c\xcb\x26\xfd"
-                         "\xd9\x51\x0f\xd7\x94\x2f\xc5\xa7",
+               .key    = "\x27\x18\x28\x18\x28\x45\x90\x45"
+                         "\x23\x53\x60\x28\x74\x71\x35\x26"
+                         "\x62\x49\x77\x57\x24\x70\x93\x69"
+                         "\x99\x59\x57\x49\x66\x96\x76\x27"
+                         "\x31\x41\x59\x26\x53\x58\x97\x93"
+                         "\x23\x84\x62\x64\x33\x83\x27\x95"
+                         "\x02\x88\x41\x97\x16\x93\x99\x37"
+                         "\x51\x05\x82\x09\x74\x94\x45\x92",
+               .klen   = 64,
+               .iv     = "\xff\x00\x00\x00\x00\x00\x00\x00"
+                         "\x00\x00\x00\x00\x00\x00\x00\x00",
+               .input  = "\xc5\x85\x2a\x4b\x73\xe4\xf6\xf1"
+                         "\x7e\xf9\xf6\xe9\xa3\x73\x36\xcb"
+                         "\xaa\xb6\x22\xb0\x24\x6e\x3d\x73"
+                         "\x92\x99\xde\xd3\x76\xed\xcd\x63"
+                         "\x64\x3a\x22\x57\xc1\x43\x49\xd4"
+                         "\x79\x36\x31\x19\x62\xae\x10\x7e"
+                         "\x7d\xcf\x7a\xe2\x6b\xce\x27\xfa"
+                         "\xdc\x3d\xd9\x83\xd3\x42\x4c\xe0"
+                         "\x1b\xd6\x1d\x1a\x6f\xd2\x03\x00"
+                         "\xfc\x81\x99\x8a\x14\x62\xf5\x7e"
+                         "\x0d\xe7\x12\xe8\x17\x9d\x0b\xec"
+                         "\xe2\xf7\xc9\xa7\x63\xd1\x79\xb6"
+                         "\x62\x62\x37\xfe\x0a\x4c\x4a\x37"
+                         "\x70\xc7\x5e\x96\x5f\xbc\x8e\x9e"
+                         "\x85\x3c\x4f\x26\x64\x85\xbc\x68"
+                         "\xb0\xe0\x86\x5e\x26\x41\xce\x11"
+                         "\x50\xda\x97\x14\xe9\x9e\xc7\x6d"
+                         "\x3b\xdc\x43\xde\x2b\x27\x69\x7d"
+                         "\xfc\xb0\x28\xbd\x8f\xb1\xc6\x31"
+                         "\x14\x4d\xf0\x74\x37\xfd\x07\x25"
+                         "\x96\x55\xe5\xfc\x9e\x27\x2a\x74"
+                         "\x1b\x83\x4d\x15\x83\xac\x57\xa0"
+                         "\xac\xa5\xd0\x38\xef\x19\x56\x53"
+                         "\x25\x4b\xfc\xce\x04\x23\xe5\x6b"
+                         "\xf6\xc6\x6c\x32\x0b\xb3\x12\xc5"
+                         "\xed\x22\x34\x1c\x5d\xed\x17\x06"
+                         "\x36\xa3\xe6\x77\xb9\x97\x46\xb8"
+                         "\xe9\x3f\x7e\xc7\xbc\x13\x5c\xdc"
+                         "\x6e\x3f\x04\x5e\xd1\x59\xa5\x82"
+                         "\x35\x91\x3d\x1b\xe4\x97\x9f\x92"
+                         "\x1c\x5e\x5f\x6f\x41\xd4\x62\xa1"
+                         "\x8d\x39\xfc\x42\xfb\x38\x80\xb9"
+                         "\x0a\xe3\xcc\x6a\x93\xd9\x7a\xb1"
+                         "\xe9\x69\xaf\x0a\x6b\x75\x38\xa7"
+                         "\xa1\xbf\xf7\xda\x95\x93\x4b\x78"
+                         "\x19\xf5\x94\xf9\xd2\x00\x33\x37"
+                         "\xcf\xf5\x9e\x9c\xf3\xcc\xa6\xee"
+                         "\x42\xb2\x9e\x2c\x5f\x48\x23\x26"
+                         "\x15\x25\x17\x03\x3d\xfe\x2c\xfc"
+                         "\xeb\xba\xda\xe0\x00\x05\xb6\xa6"
+                         "\x07\xb3\xe8\x36\x5b\xec\x5b\xbf"
+                         "\xd6\x5b\x00\x74\xc6\x97\xf1\x6a"
+                         "\x49\xa1\xc3\xfa\x10\x52\xb9\x14"
+                         "\xad\xb7\x73\xf8\x78\x12\xc8\x59"
+                         "\x17\x80\x4c\x57\x39\xf1\x6d\x80"
+                         "\x25\x77\x0f\x5e\x7d\xf0\xaf\x21"
+                         "\xec\xce\xb7\xc8\x02\x8a\xed\x53"
+                         "\x2c\x25\x68\x2e\x1f\x85\x5e\x67"
+                         "\xd1\x07\x7a\x3a\x89\x08\xe0\x34"
+                         "\xdc\xdb\x26\xb4\x6b\x77\xfc\x40"
+                         "\x31\x15\x72\xa0\xf0\x73\xd9\x3b"
+                         "\xd5\xdb\xfe\xfc\x8f\xa9\x44\xa2"
+                         "\x09\x9f\xc6\x33\xe5\xe2\x88\xe8"
+                         "\xf3\xf0\x1a\xf4\xce\x12\x0f\xd6"
+                         "\xf7\x36\xe6\xa4\xf4\x7a\x10\x58"
+                         "\xcc\x1f\x48\x49\x65\x47\x75\xe9"
+                         "\x28\xe1\x65\x7b\xf2\xc4\xb5\x07"
+                         "\xf2\xec\x76\xd8\x8f\x09\xf3\x16"
+                         "\xa1\x51\x89\x3b\xeb\x96\x42\xac"
+                         "\x65\xe0\x67\x63\x29\xdc\xb4\x7d"
+                         "\xf2\x41\x51\x6a\xcb\xde\x3c\xfb"
+                         "\x66\x8d\x13\xca\xe0\x59\x2a\x00"
+                         "\xc9\x53\x4c\xe6\x9e\xe2\x73\xd5"
+                         "\x67\x19\xb2\xbd\x9a\x63\xd7\x5c",
                .ilen   = 512,
-               .result = "\x05\x11\xb7\x18\xab\xc6\x2d\xac"
-                         "\x70\x5d\xf6\x22\x94\xcd\xe5\x6c"
-                         "\x17\x6b\xf6\x1c\xf0\xf3\x6e\xf8"
-                         "\x50\x38\x1f\x71\x49\xb6\x57\xd6"
-                         "\x8f\xcb\x8d\x6b\xe3\xa6\x29\x90"
-                         "\xfe\x2a\x62\x82\xae\x6d\x8b\xf6"
-                         "\xad\x1e\x9e\x20\x5f\x38\xbe\x04"
-                         "\xda\x10\x8e\xed\xa2\xa4\x87\xab"
-                         "\xda\x6b\xb4\x0c\x75\xba\xd3\x7c"
-                         "\xc9\xac\x42\x31\x95\x7c\xc9\x04"
-                         "\xeb\xd5\x6e\x32\x69\x8a\xdb\xa6"
-                         "\x15\xd7\x3f\x4f\x2f\x66\x69\x03"
-                         "\x9c\x1f\x54\x0f\xde\x1f\xf3\x65"
-                         "\x4c\x96\x12\xed\x7c\x92\x03\x01"
-                         "\x6f\xbc\x35\x93\xac\xf1\x27\xf1"
-                         "\xb4\x96\x82\x5a\x5f\xb0\xa0\x50"
-                         "\x89\xa4\x8e\x66\x44\x85\xcc\xfd"
-                         "\x33\x14\x70\xe3\x96\xb2\xc3\xd3"
-                         "\xbb\x54\x5a\x1a\xf9\x74\xa2\xc5"
-                         "\x2d\x64\x75\xdd\xb4\x54\xe6\x74"
-                         "\x8c\xd3\x9d\x9e\x86\xab\x51\x53"
-                         "\xb7\x93\x3e\x6f\xd0\x4e\x2c\x40"
-                         "\xf6\xa8\x2e\x3e\x9d\xf4\x66\xa5"
-                         "\x76\x12\x73\x44\x1a\x56\xd7\x72"
-                         "\x88\xcd\x21\x8c\x4c\x0f\xfe\xda"
-                         "\x95\xe0\x3a\xa6\xa5\x84\x46\xcd"
-                         "\xd5\x3e\x9d\x3a\xe2\x67\xe6\x60"
-                         "\x1a\xe2\x70\x85\x58\xc2\x1b\x09"
-                         "\xe1\xd7\x2c\xca\xad\xa8\x8f\xf9"
-                         "\xac\xb3\x0e\xdb\xca\x2e\xe2\xb8"
-                         "\x51\x71\xd9\x3c\x6c\xf1\x56\xf8"
-                         "\xea\x9c\xf1\xfb\x0c\xe6\xb7\x10"
-                         "\x1c\xf8\xa9\x7c\xe8\x53\x35\xc1"
-                         "\x90\x3e\x76\x4a\x74\xa4\x21\x2c"
-                         "\xf6\x2c\x4e\x0f\x94\x3a\x88\x2e"
-                         "\x41\x09\x6a\x33\x7d\xf6\xdd\x3f"
-                         "\x8d\x23\x31\x74\x84\xeb\x88\x6e"
-                         "\xcc\xb9\xbc\x22\x83\x19\x07\x22"
-                         "\xa5\x2d\xdf\xa5\xf3\x80\x85\x78"
-                         "\x84\x39\x6a\x6d\x6a\x99\x4f\xa5"
-                         "\x15\xfe\x46\xb0\xe4\x6c\xa5\x41"
-                         "\x3c\xce\x8f\x42\x60\x71\xa7\x75"
-                         "\x08\x40\x65\x8a\x82\xbf\xf5\x43"
-                         "\x71\x96\xa9\x4d\x44\x8a\x20\xbe"
-                         "\xfa\x4d\xbb\xc0\x7d\x31\x96\x65"
-                         "\xe7\x75\xe5\x3e\xfd\x92\x3b\xc9"
-                         "\x55\xbb\x16\x7e\xf7\xc2\x8c\xa4"
-                         "\x40\x1d\xe5\xef\x0e\xdf\xe4\x9a"
-                         "\x62\x73\x65\xfd\x46\x63\x25\x3d"
-                         "\x2b\xaf\xe5\x64\xfe\xa5\x5c\xcf"
-                         "\x24\xf3\xb4\xac\x64\xba\xdf\x4b"
-                         "\xc6\x96\x7d\x81\x2d\x8d\x97\xf7"
-                         "\xc5\x68\x77\x84\x32\x2b\xcc\x85"
-                         "\x74\x96\xf0\x12\x77\x61\xb9\xeb"
-                         "\x71\xaa\x82\xcb\x1c\xdb\x89\xc8"
-                         "\xc6\xb5\xe3\x5c\x7d\x39\x07\x24"
-                         "\xda\x39\x87\x45\xc0\x2b\xbb\x01"
-                         "\xac\xbc\x2a\x5c\x7f\xfc\xe8\xce"
-                         "\x6d\x9c\x6f\xed\xd3\xc1\xa1\xd6"
-                         "\xc5\x55\xa9\x66\x2f\xe1\xc8\x32"
-                         "\xa6\x5d\xa4\x3a\x98\x73\xe8\x45"
-                         "\xa4\xc7\xa8\xb4\xf6\x13\x03\xf6"
-                         "\xe9\x2e\xc4\x29\x0f\x84\xdb\xc4"
-                         "\x21\xc4\xc2\x75\x67\x89\x37\x0a",
+               .result = "\x00\x01\x02\x03\x04\x05\x06\x07"
+                         "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f"
+                         "\x10\x11\x12\x13\x14\x15\x16\x17"
+                         "\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f"
+                         "\x20\x21\x22\x23\x24\x25\x26\x27"
+                         "\x28\x29\x2a\x2b\x2c\x2d\x2e\x2f"
+                         "\x30\x31\x32\x33\x34\x35\x36\x37"
+                         "\x38\x39\x3a\x3b\x3c\x3d\x3e\x3f"
+                         "\x40\x41\x42\x43\x44\x45\x46\x47"
+                         "\x48\x49\x4a\x4b\x4c\x4d\x4e\x4f"
+                         "\x50\x51\x52\x53\x54\x55\x56\x57"
+                         "\x58\x59\x5a\x5b\x5c\x5d\x5e\x5f"
+                         "\x60\x61\x62\x63\x64\x65\x66\x67"
+                         "\x68\x69\x6a\x6b\x6c\x6d\x6e\x6f"
+                         "\x70\x71\x72\x73\x74\x75\x76\x77"
+                         "\x78\x79\x7a\x7b\x7c\x7d\x7e\x7f"
+                         "\x80\x81\x82\x83\x84\x85\x86\x87"
+                         "\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f"
+                         "\x90\x91\x92\x93\x94\x95\x96\x97"
+                         "\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f"
+                         "\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7"
+                         "\xa8\xa9\xaa\xab\xac\xad\xae\xaf"
+                         "\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7"
+                         "\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf"
+                         "\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7"
+                         "\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf"
+                         "\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7"
+                         "\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf"
+                         "\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7"
+                         "\xe8\xe9\xea\xeb\xec\xed\xee\xef"
+                         "\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7"
+                         "\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff"
+                         "\x00\x01\x02\x03\x04\x05\x06\x07"
+                         "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f"
+                         "\x10\x11\x12\x13\x14\x15\x16\x17"
+                         "\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f"
+                         "\x20\x21\x22\x23\x24\x25\x26\x27"
+                         "\x28\x29\x2a\x2b\x2c\x2d\x2e\x2f"
+                         "\x30\x31\x32\x33\x34\x35\x36\x37"
+                         "\x38\x39\x3a\x3b\x3c\x3d\x3e\x3f"
+                         "\x40\x41\x42\x43\x44\x45\x46\x47"
+                         "\x48\x49\x4a\x4b\x4c\x4d\x4e\x4f"
+                         "\x50\x51\x52\x53\x54\x55\x56\x57"
+                         "\x58\x59\x5a\x5b\x5c\x5d\x5e\x5f"
+                         "\x60\x61\x62\x63\x64\x65\x66\x67"
+                         "\x68\x69\x6a\x6b\x6c\x6d\x6e\x6f"
+                         "\x70\x71\x72\x73\x74\x75\x76\x77"
+                         "\x78\x79\x7a\x7b\x7c\x7d\x7e\x7f"
+                         "\x80\x81\x82\x83\x84\x85\x86\x87"
+                         "\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f"
+                         "\x90\x91\x92\x93\x94\x95\x96\x97"
+                         "\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f"
+                         "\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7"
+                         "\xa8\xa9\xaa\xab\xac\xad\xae\xaf"
+                         "\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7"
+                         "\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf"
+                         "\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7"
+                         "\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf"
+                         "\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7"
+                         "\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf"
+                         "\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7"
+                         "\xe8\xe9\xea\xeb\xec\xed\xee\xef"
+                         "\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7"
+                         "\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff",
                .rlen   = 512,
                .also_non_np = 1,
                .np     = 3,
                .tap    = { 512 - 20, 4, 16 },
+       }
+};
+
+static const struct cipher_testvec speck64_enc_tv_template[] = {
+       { /* Speck64/96 */
+               .key    = "\x00\x01\x02\x03\x08\x09\x0a\x0b"
+                         "\x10\x11\x12\x13",
+               .klen   = 12,
+               .input  = "\x65\x61\x6e\x73\x20\x46\x61\x74",
+               .ilen   = 8,
+               .result = "\x6c\x94\x75\x41\xec\x52\x79\x9f",
+               .rlen   = 8,
+       }, { /* Speck64/128 */
+               .key    = "\x00\x01\x02\x03\x08\x09\x0a\x0b"
+                         "\x10\x11\x12\x13\x18\x19\x1a\x1b",
+               .klen   = 16,
+               .input  = "\x2d\x43\x75\x74\x74\x65\x72\x3b",
+               .ilen   = 8,
+               .result = "\x8b\x02\x4e\x45\x48\xa5\x6f\x8c",
+               .rlen   = 8,
        },
 };
 
-static const struct cipher_testvec serpent_xts_enc_tv_template[] = {
-       /* Generated from AES-XTS test vectors */
+static const struct cipher_testvec speck64_dec_tv_template[] = {
+       { /* Speck64/96 */
+               .key    = "\x00\x01\x02\x03\x08\x09\x0a\x0b"
+                         "\x10\x11\x12\x13",
+               .klen   = 12,
+               .input  = "\x6c\x94\x75\x41\xec\x52\x79\x9f",
+               .ilen   = 8,
+               .result = "\x65\x61\x6e\x73\x20\x46\x61\x74",
+               .rlen   = 8,
+       }, { /* Speck64/128 */
+               .key    = "\x00\x01\x02\x03\x08\x09\x0a\x0b"
+                         "\x10\x11\x12\x13\x18\x19\x1a\x1b",
+               .klen   = 16,
+               .input  = "\x8b\x02\x4e\x45\x48\xa5\x6f\x8c",
+               .ilen   = 8,
+               .result = "\x2d\x43\x75\x74\x74\x65\x72\x3b",
+               .rlen   = 8,
+       },
+};
+
+/*
+ * Speck64-XTS test vectors, taken from the AES-XTS test vectors with the result
+ * recomputed with Speck64 as the cipher, and key lengths adjusted
+ */
+
+static const struct cipher_testvec speck64_xts_enc_tv_template[] = {
        {
                .key    = "\x00\x00\x00\x00\x00\x00\x00\x00"
-                         "\x00\x00\x00\x00\x00\x00\x00\x00"
                          "\x00\x00\x00\x00\x00\x00\x00\x00"
                          "\x00\x00\x00\x00\x00\x00\x00\x00",
-               .klen   = 32,
+               .klen   = 24,
                .iv     = "\x00\x00\x00\x00\x00\x00\x00\x00"
                          "\x00\x00\x00\x00\x00\x00\x00\x00",
                .input  = "\x00\x00\x00\x00\x00\x00\x00\x00"
@@ -13653,17 +15546,16 @@ static const struct cipher_testvec serpent_xts_enc_tv_template[] = {
                          "\x00\x00\x00\x00\x00\x00\x00\x00"
                          "\x00\x00\x00\x00\x00\x00\x00\x00",
                .ilen   = 32,
-               .result = "\xe1\x08\xb8\x1d\x2c\xf5\x33\x64"
-                         "\xc8\x12\x04\xc7\xb3\x70\xe8\xc4"
-                         "\x6a\x31\xc5\xf3\x00\xca\xb9\x16"
-                         "\xde\xe2\x77\x66\xf7\xfe\x62\x08",
+               .result = "\x84\xaf\x54\x07\x19\xd4\x7c\xa6"
+                         "\xe4\xfe\xdf\xc4\x1f\x34\xc3\xc2"
+                         "\x80\xf5\x72\xe7\xcd\xf0\x99\x22"
+                         "\x35\xa7\x2f\x06\xef\xdc\x51\xaa",
                .rlen   = 32,
        }, {
                .key    = "\x11\x11\x11\x11\x11\x11\x11\x11"
                          "\x11\x11\x11\x11\x11\x11\x11\x11"
-                         "\x22\x22\x22\x22\x22\x22\x22\x22"
                          "\x22\x22\x22\x22\x22\x22\x22\x22",
-               .klen   = 32,
+               .klen   = 24,
                .iv     = "\x33\x33\x33\x33\x33\x00\x00\x00"
                          "\x00\x00\x00\x00\x00\x00\x00\x00",
                .input  = "\x44\x44\x44\x44\x44\x44\x44\x44"
@@ -13671,17 +15563,16 @@ static const struct cipher_testvec serpent_xts_enc_tv_template[] = {
                          "\x44\x44\x44\x44\x44\x44\x44\x44"
                          "\x44\x44\x44\x44\x44\x44\x44\x44",
                .ilen   = 32,
-               .result = "\x1a\x0a\x09\x5f\xcd\x07\x07\x98"
-                         "\x41\x86\x12\xaf\xb3\xd7\x68\x13"
-                         "\xed\x81\xcd\x06\x87\x43\x1a\xbb"
-                         "\x13\x3d\xd6\x1e\x2b\xe1\x77\xbe",
+               .result = "\x12\x56\x73\xcd\x15\x87\xa8\x59"
+                         "\xcf\x84\xae\xd9\x1c\x66\xd6\x9f"
+                         "\xb3\x12\x69\x7e\x36\xeb\x52\xff"
+                         "\x62\xdd\xba\x90\xb3\xe1\xee\x99",
                .rlen   = 32,
        }, {
                .key    = "\xff\xfe\xfd\xfc\xfb\xfa\xf9\xf8"
                          "\xf7\xf6\xf5\xf4\xf3\xf2\xf1\xf0"
-                         "\x22\x22\x22\x22\x22\x22\x22\x22"
                          "\x22\x22\x22\x22\x22\x22\x22\x22",
-               .klen   = 32,
+               .klen   = 24,
                .iv     = "\x33\x33\x33\x33\x33\x00\x00\x00"
                          "\x00\x00\x00\x00\x00\x00\x00\x00",
                .input  = "\x44\x44\x44\x44\x44\x44\x44\x44"
@@ -13689,17 +15580,16 @@ static const struct cipher_testvec serpent_xts_enc_tv_template[] = {
                          "\x44\x44\x44\x44\x44\x44\x44\x44"
                          "\x44\x44\x44\x44\x44\x44\x44\x44",
                .ilen   = 32,
-               .result = "\xf9\x9b\x28\xb8\x5c\xaf\x8c\x61"
-                         "\xb6\x1c\x81\x8f\x2c\x87\x60\x89"
-                         "\x0d\x8d\x7a\xe8\x60\x48\xcc\x86"
-                         "\xc1\x68\x45\xaa\x00\xe9\x24\xc5",
+               .result = "\x15\x1b\xe4\x2c\xa2\x5a\x2d\x2c"
+                         "\x27\x36\xc0\xbf\x5d\xea\x36\x37"
+                         "\x2d\x1a\x88\xbc\x66\xb5\xd0\x0b"
+                         "\xa1\xbc\x19\xb2\x0f\x3b\x75\x34",
                .rlen   = 32,
        }, {
                .key    = "\x27\x18\x28\x18\x28\x45\x90\x45"
                          "\x23\x53\x60\x28\x74\x71\x35\x26"
-                         "\x31\x41\x59\x26\x53\x58\x97\x93"
-                         "\x23\x84\x62\x64\x33\x83\x27\x95",
-               .klen   = 32,
+                         "\x31\x41\x59\x26\x53\x58\x97\x93",
+               .klen   = 24,
                .iv     = "\x00\x00\x00\x00\x00\x00\x00\x00"
                          "\x00\x00\x00\x00\x00\x00\x00\x00",
                .input  = "\x00\x01\x02\x03\x04\x05\x06\x07"
@@ -13749,99 +15639,95 @@ static const struct cipher_testvec serpent_xts_enc_tv_template[] = {
                          "\x60\x61\x62\x63\x64\x65\x66\x67"
                          "\x68\x69\x6a\x6b\x6c\x6d\x6e\x6f"
                          "\x70\x71\x72\x73\x74\x75\x76\x77"
-                         "\x78\x79\x7a\x7b\x7c\x7d\x7e\x7f"
-                         "\x80\x81\x82\x83\x84\x85\x86\x87"
-                         "\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f"
-                         "\x90\x91\x92\x93\x94\x95\x96\x97"
-                         "\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f"
-                         "\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7"
-                         "\xa8\xa9\xaa\xab\xac\xad\xae\xaf"
-                         "\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7"
-                         "\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf"
-                         "\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7"
-                         "\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf"
-                         "\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7"
-                         "\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf"
-                         "\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7"
-                         "\xe8\xe9\xea\xeb\xec\xed\xee\xef"
-                         "\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7"
-                         "\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff",
-               .ilen   = 512,
-               .result = "\xfe\x47\x4a\xc8\x60\x7e\xb4\x8b"
-                         "\x0d\x10\xf4\xb0\x0d\xba\xf8\x53"
-                         "\x65\x6e\x38\x4b\xdb\xaa\xb1\x9e"
-                         "\x28\xca\xb0\x22\xb3\x85\x75\xf4"
-                         "\x00\x5c\x75\x14\x06\xd6\x25\x82"
-                         "\xe6\xcb\x08\xf7\x29\x90\x23\x8e"
-                         "\xa4\x68\x57\xe4\xf0\xd8\x32\xf3"
-                         "\x80\x51\x67\xb5\x0b\x85\x69\xe8"
-                         "\x19\xfe\xc4\xc7\x3e\xea\x90\xd3"
-                         "\x8f\xa3\xf2\x0a\xac\x17\x4b\xa0"
-                         "\x63\x5a\x16\x0f\xf0\xce\x66\x1f"
-                         "\x2c\x21\x07\xf1\xa4\x03\xa3\x44"
-                         "\x41\x61\x87\x5d\x6b\xb3\xef\xd4"
-                         "\xfc\xaa\x32\x7e\x55\x58\x04\x41"
-                         "\xc9\x07\x33\xc6\xa2\x68\xd6\x5a"
-                         "\x55\x79\x4b\x6f\xcf\x89\xb9\x19"
-                         "\xe5\x54\x13\x15\xb2\x1a\xfa\x15"
-                         "\xc2\xf0\x06\x59\xfa\xa0\x25\x05"
-                         "\x58\xfa\x43\x91\x16\x85\x40\xbb"
-                         "\x0d\x34\x4d\xc5\x1e\x20\xd5\x08"
-                         "\xcd\x22\x22\x41\x11\x9f\x6c\x7c"
-                         "\x8d\x57\xc9\xba\x57\xe8\x2c\xf7"
-                         "\xa0\x42\xa8\xde\xfc\xa3\xca\x98"
-                         "\x4b\x43\xb1\xce\x4b\xbf\x01\x67"
-                         "\x6e\x29\x60\xbd\x10\x14\x84\x82"
-                         "\x83\x82\x0c\x63\x73\x92\x02\x7c"
-                         "\x55\x37\x20\x80\x17\x51\xc8\xbc"
-                         "\x46\x02\xcb\x38\x07\x6d\xe2\x85"
-                         "\xaa\x29\xaf\x24\x58\x0d\xf0\x75"
-                         "\x08\x0a\xa5\x34\x25\x16\xf3\x74"
-                         "\xa7\x0b\x97\xbe\xc1\xa9\xdc\x29"
-                         "\x1a\x0a\x56\xc1\x1a\x91\x97\x8c"
-                         "\x0b\xc7\x16\xed\x5a\x22\xa6\x2e"
-                         "\x8c\x2b\x4f\x54\x76\x47\x53\x8e"
-                         "\xe8\x00\xec\x92\xb9\x55\xe6\xa2"
-                         "\xf3\xe2\x4f\x6a\x66\x60\xd0\x87"
-                         "\xe6\xd1\xcc\xe3\x6a\xc5\x2d\x21"
-                         "\xcc\x9d\x6a\xb6\x75\xaa\xe2\x19"
-                         "\x21\x9f\xa1\x5e\x4c\xfd\x72\xf9"
-                         "\x94\x4e\x63\xc7\xae\xfc\xed\x47"
-                         "\xe2\xfe\x7a\x63\x77\xfe\x97\x82"
-                         "\xb1\x10\x6e\x36\x1d\xe1\xc4\x80"
-                         "\xec\x69\x41\xec\xa7\x8a\xe0\x2f"
-                         "\xe3\x49\x26\xa2\x41\xb2\x08\x0f"
-                         "\x28\xb4\xa7\x39\xa1\x99\x2d\x1e"
-                         "\x43\x42\x35\xd0\xcf\xec\x77\x67"
-                         "\xb2\x3b\x9e\x1c\x35\xde\x4f\x5e"
-                         "\x73\x3f\x5d\x6f\x07\x4b\x2e\x50"
-                         "\xab\x6c\x6b\xff\xea\x00\x67\xaa"
-                         "\x0e\x82\x32\xdd\x3d\xb5\xe5\x76"
-                         "\x2b\x77\x3f\xbe\x12\x75\xfb\x92"
-                         "\xc6\x89\x67\x4d\xca\xf7\xd4\x50"
-                         "\xc0\x74\x47\xcc\xd9\x0a\xd4\xc6"
-                         "\x3b\x17\x2e\xe3\x35\xbb\x53\xb5"
-                         "\x86\xad\x51\xcc\xd5\x96\xb8\xdc"
-                         "\x03\x57\xe6\x98\x52\x2f\x61\x62"
-                         "\xc4\x5c\x9c\x36\x71\x07\xfb\x94"
-                         "\xe3\x02\xc4\x2b\x08\x75\xc7\x35"
-                         "\xfb\x2e\x88\x7b\xbb\x67\x00\xe1"
-                         "\xc9\xdd\x99\xb2\x13\x53\x1a\x4e"
-                         "\x76\x87\x19\x04\x1a\x2f\x38\x3e"
-                         "\xef\x91\x64\x1d\x18\x07\x4e\x31"
-                         "\x88\x21\x7c\xb0\xa5\x12\x4c\x3c"
-                         "\xb0\x20\xbd\xda\xdf\xf9\x7c\xdd",
+                         "\x78\x79\x7a\x7b\x7c\x7d\x7e\x7f"
+                         "\x80\x81\x82\x83\x84\x85\x86\x87"
+                         "\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f"
+                         "\x90\x91\x92\x93\x94\x95\x96\x97"
+                         "\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f"
+                         "\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7"
+                         "\xa8\xa9\xaa\xab\xac\xad\xae\xaf"
+                         "\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7"
+                         "\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf"
+                         "\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7"
+                         "\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf"
+                         "\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7"
+                         "\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf"
+                         "\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7"
+                         "\xe8\xe9\xea\xeb\xec\xed\xee\xef"
+                         "\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7"
+                         "\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff",
+               .ilen   = 512,
+               .result = "\xaf\xa1\x81\xa6\x32\xbb\x15\x8e"
+                         "\xf8\x95\x2e\xd3\xe6\xee\x7e\x09"
+                         "\x0c\x1a\xf5\x02\x97\x8b\xe3\xb3"
+                         "\x11\xc7\x39\x96\xd0\x95\xf4\x56"
+                         "\xf4\xdd\x03\x38\x01\x44\x2c\xcf"
+                         "\x88\xae\x8e\x3c\xcd\xe7\xaa\x66"
+                         "\xfe\x3d\xc6\xfb\x01\x23\x51\x43"
+                         "\xd5\xd2\x13\x86\x94\x34\xe9\x62"
+                         "\xf9\x89\xe3\xd1\x7b\xbe\xf8\xef"
+                         "\x76\x35\x04\x3f\xdb\x23\x9d\x0b"
+                         "\x85\x42\xb9\x02\xd6\xcc\xdb\x96"
+                         "\xa7\x6b\x27\xb6\xd4\x45\x8f\x7d"
+                         "\xae\xd2\x04\xd5\xda\xc1\x7e\x24"
+                         "\x8c\x73\xbe\x48\x7e\xcf\x65\x28"
+                         "\x29\xe5\xbe\x54\x30\xcb\x46\x95"
+                         "\x4f\x2e\x8a\x36\xc8\x27\xc5\xbe"
+                         "\xd0\x1a\xaf\xab\x26\xcd\x9e\x69"
+                         "\xa1\x09\x95\x71\x26\xe9\xc4\xdf"
+                         "\xe6\x31\xc3\x46\xda\xaf\x0b\x41"
+                         "\x1f\xab\xb1\x8e\xd6\xfc\x0b\xb3"
+                         "\x82\xc0\x37\x27\xfc\x91\xa7\x05"
+                         "\xfb\xc5\xdc\x2b\x74\x96\x48\x43"
+                         "\x5d\x9c\x19\x0f\x60\x63\x3a\x1f"
+                         "\x6f\xf0\x03\xbe\x4d\xfd\xc8\x4a"
+                         "\xc6\xa4\x81\x6d\xc3\x12\x2a\x5c"
+                         "\x07\xff\xf3\x72\x74\x48\xb5\x40"
+                         "\x50\xb5\xdd\x90\x43\x31\x18\x15"
+                         "\x7b\xf2\xa6\xdb\x83\xc8\x4b\x4a"
+                         "\x29\x93\x90\x8b\xda\x07\xf0\x35"
+                         "\x6d\x90\x88\x09\x4e\x83\xf5\x5b"
+                         "\x94\x12\xbb\x33\x27\x1d\x3f\x23"
+                         "\x51\xa8\x7c\x07\xa2\xae\x77\xa6"
+                         "\x50\xfd\xcc\xc0\x4f\x80\x7a\x9f"
+                         "\x66\xdd\xcd\x75\x24\x8b\x33\xf7"
+                         "\x20\xdb\x83\x9b\x4f\x11\x63\x6e"
+                         "\xcf\x37\xef\xc9\x11\x01\x5c\x45"
+                         "\x32\x99\x7c\x3c\x9e\x42\x89\xe3"
+                         "\x70\x6d\x15\x9f\xb1\xe6\xb6\x05"
+                         "\xfe\x0c\xb9\x49\x2d\x90\x6d\xcc"
+                         "\x5d\x3f\xc1\xfe\x89\x0a\x2e\x2d"
+                         "\xa0\xa8\x89\x3b\x73\x39\xa5\x94"
+                         "\x4c\xa4\xa6\xbb\xa7\x14\x46\x89"
+                         "\x10\xff\xaf\xef\xca\xdd\x4f\x80"
+                         "\xb3\xdf\x3b\xab\xd4\xe5\x5a\xc7"
+                         "\x33\xca\x00\x8b\x8b\x3f\xea\xec"
+                         "\x68\x8a\xc2\x6d\xfd\xd4\x67\x0f"
+                         "\x22\x31\xe1\x0e\xfe\x5a\x04\xd5"
+                         "\x64\xa3\xf1\x1a\x76\x28\xcc\x35"
+                         "\x36\xa7\x0a\x74\xf7\x1c\x44\x9b"
+                         "\xc7\x1b\x53\x17\x02\xea\xd1\xad"
+                         "\x13\x51\x73\xc0\xa0\xb2\x05\x32"
+                         "\xa8\xa2\x37\x2e\xe1\x7a\x3a\x19"
+                         "\x26\xb4\x6c\x62\x5d\xb3\x1a\x1d"
+                         "\x59\xda\xee\x1a\x22\x18\xda\x0d"
+                         "\x88\x0f\x55\x8b\x72\x62\xfd\xc1"
+                         "\x69\x13\xcd\x0d\x5f\xc1\x09\x52"
+                         "\xee\xd6\xe3\x84\x4d\xee\xf6\x88"
+                         "\xaf\x83\xdc\x76\xf4\xc0\x93\x3f"
+                         "\x4a\x75\x2f\xb0\x0b\x3e\xc4\x54"
+                         "\x7d\x69\x8d\x00\x62\x77\x0d\x14"
+                         "\xbe\x7c\xa6\x7d\xc5\x24\x4f\xf3"
+                         "\x50\xf7\x5f\xf4\xc2\xca\x41\x97"
+                         "\x37\xbe\x75\x74\xcd\xf0\x75\x6e"
+                         "\x25\x23\x94\xbd\xda\x8d\xb0\xd4",
                .rlen   = 512,
        }, {
                .key    = "\x27\x18\x28\x18\x28\x45\x90\x45"
                          "\x23\x53\x60\x28\x74\x71\x35\x26"
                          "\x62\x49\x77\x57\x24\x70\x93\x69"
-                         "\x99\x59\x57\x49\x66\x96\x76\x27"
-                         "\x31\x41\x59\x26\x53\x58\x97\x93"
-                         "\x23\x84\x62\x64\x33\x83\x27\x95"
-                         "\x02\x88\x41\x97\x16\x93\x99\x37"
-                         "\x51\x05\x82\x09\x74\x94\x45\x92",
-               .klen   = 64,
+                         "\x99\x59\x57\x49\x66\x96\x76\x27",
+               .klen   = 32,
                .iv     = "\xff\x00\x00\x00\x00\x00\x00\x00"
                          "\x00\x00\x00\x00\x00\x00\x00\x00",
                .input  = "\x00\x01\x02\x03\x04\x05\x06\x07"
@@ -13909,92 +15795,89 @@ static const struct cipher_testvec serpent_xts_enc_tv_template[] = {
                          "\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7"
                          "\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff",
                .ilen   = 512,
-               .result = "\x2b\xc9\xb4\x6b\x10\x94\xa9\x32"
-                         "\xaa\xb0\x20\xc6\x44\x3d\x74\x1f"
-                         "\x75\x01\xa7\xf6\xf5\xf7\x62\x1b"
-                         "\x80\x1b\x82\xcb\x01\x59\x91\x7f"
-                         "\x80\x3a\x98\xf0\xd2\xca\xc4\xc3"
-                         "\x34\xfd\xe6\x11\xf9\x33\x45\x12"
-                         "\x48\xc5\x8c\x25\xf1\xc5\xc5\x23"
-                         "\xd3\x44\xb4\x73\xd5\x04\xc0\xb7"
-                         "\xca\x2f\xf5\xcd\xc5\xb4\xdd\xb0"
-                         "\xf4\x60\xe8\xfb\xc6\x9c\xc5\x78"
-                         "\xcd\xec\x7d\xdc\x19\x9c\x72\x64"
-                         "\x63\x0b\x38\x2e\x76\xdd\x2d\x36"
-                         "\x49\xb0\x1d\xea\x78\x9e\x00\xca"
-                         "\x20\xcc\x1b\x1e\x98\x74\xab\xed"
-                         "\x79\xf7\xd0\x6c\xd8\x93\x80\x29"
-                         "\xac\xa5\x5e\x34\xa9\xab\xa0\x55"
-                         "\x9a\xea\xaa\x95\x4d\x7b\xfe\x46"
-                         "\x26\x8a\xfd\x88\xa2\xa8\xa6\xae"
-                         "\x25\x42\x17\xbf\x76\x8f\x1c\x3d"
-                         "\xec\x9a\xda\x64\x96\xb5\x61\xff"
-                         "\x99\xeb\x12\x96\x85\x82\x9d\xd5"
-                         "\x81\x85\x14\xa8\x59\xac\x8c\x94"
-                         "\xbb\x3b\x85\x2b\xdf\xb3\x0c\xba"
-                         "\x82\xc6\x4d\xca\x86\xea\x53\x28"
-                         "\x4c\xe0\x4e\x31\xe3\x73\x2f\x79"
-                         "\x9d\x42\xe1\x03\xe3\x8b\xc4\xff"
-                         "\x05\xca\x81\x7b\xda\xa2\xde\x63"
-                         "\x3a\x10\xbe\xc2\xac\x32\xc4\x05"
-                         "\x47\x7e\xef\x67\xe2\x5f\x5b\xae"
-                         "\xed\xf1\x70\x34\x16\x9a\x07\x7b"
-                         "\xf2\x25\x2b\xb0\xf8\x3c\x15\x9a"
-                         "\xa6\x59\x55\x5f\xc1\xf4\x1e\xcd"
-                         "\x93\x1f\x06\xba\xd4\x9a\x22\x69"
-                         "\xfa\x8e\x95\x0d\xf3\x23\x59\x2c"
-                         "\xfe\x00\xba\xf0\x0e\xbc\x6d\xd6"
-                         "\x62\xf0\x7a\x0e\x83\x3e\xdb\x32"
-                         "\xfd\x43\x7d\xda\x42\x51\x87\x43"
-                         "\x9d\xf9\xef\xf4\x30\x97\xf8\x09"
-                         "\x88\xfc\x3f\x93\x70\xc1\x4a\xec"
-                         "\x27\x5f\x11\xac\x71\xc7\x48\x46"
-                         "\x2f\xf9\xdf\x8d\x9f\xf7\x2e\x56"
-                         "\x0d\x4e\xb0\x32\x76\xce\x86\x81"
-                         "\xcd\xdf\xe4\x00\xbf\xfd\x5f\x24"
-                         "\xaf\xf7\x9a\xde\xff\x18\xac\x14"
-                         "\x90\xc5\x01\x39\x34\x0f\x24\xf3"
-                         "\x13\x2f\x5e\x4f\x30\x9a\x36\x40"
-                         "\xec\xea\xbc\xcd\x9e\x0e\x5b\x23"
-                         "\x50\x88\x97\x40\x69\xb1\x37\xf5"
-                         "\xc3\x15\xf9\x3f\xb7\x79\x64\xe8"
-                         "\x7b\x10\x20\xb9\x2b\x46\x83\x5b"
-                         "\xd8\x39\xfc\xe4\xfa\x88\x52\xf2"
-                         "\x72\xb0\x97\x4e\x89\xb3\x48\x00"
-                         "\xc1\x16\x73\x50\x77\xba\xa6\x65"
-                         "\x20\x2d\xb0\x02\x27\x89\xda\x99"
-                         "\x45\xfb\xe9\xd3\x1d\x39\x2f\xd6"
-                         "\x2a\xda\x09\x12\x11\xaf\xe6\x57"
-                         "\x01\x04\x8a\xff\x86\x8b\xac\xf8"
-                         "\xee\xe4\x1c\x98\x5b\xcf\x6b\x76"
-                         "\xa3\x0e\x33\x74\x40\x18\x39\x72"
-                         "\x66\x50\x31\xfd\x70\xdf\xe8\x51"
-                         "\x96\x21\x36\xb2\x9b\xfa\x85\xd1"
-                         "\x30\x05\xc8\x92\x98\x80\xff\x7a"
-                         "\xaf\x43\x0b\xc5\x20\x41\x92\x20"
-                         "\xd4\xa0\x91\x98\x11\x5f\x4d\xb1",
+               .result = "\x55\xed\x71\xd3\x02\x8e\x15\x3b"
+                         "\xc6\x71\x29\x2d\x3e\x89\x9f\x59"
+                         "\x68\x6a\xcc\x8a\x56\x97\xf3\x95"
+                         "\x4e\x51\x08\xda\x2a\xf8\x6f\x3c"
+                         "\x78\x16\xea\x80\xdb\x33\x75\x94"
+                         "\xf9\x29\xc4\x2b\x76\x75\x97\xc7"
+                         "\xf2\x98\x2c\xf9\xff\xc8\xd5\x2b"
+                         "\x18\xf1\xaf\xcf\x7c\xc5\x0b\xee"
+                         "\xad\x3c\x76\x7c\xe6\x27\xa2\x2a"
+                         "\xe4\x66\xe1\xab\xa2\x39\xfc\x7c"
+                         "\xf5\xec\x32\x74\xa3\xb8\x03\x88"
+                         "\x52\xfc\x2e\x56\x3f\xa1\xf0\x9f"
+                         "\x84\x5e\x46\xed\x20\x89\xb6\x44"
+                         "\x8d\xd0\xed\x54\x47\x16\xbe\x95"
+                         "\x8a\xb3\x6b\x72\xc4\x32\x52\x13"
+                         "\x1b\xb0\x82\xbe\xac\xf9\x70\xa6"
+                         "\x44\x18\xdd\x8c\x6e\xca\x6e\x45"
+                         "\x8f\x1e\x10\x07\x57\x25\x98\x7b"
+                         "\x17\x8c\x78\xdd\x80\xa7\xd9\xd8"
+                         "\x63\xaf\xb9\x67\x57\xfd\xbc\xdb"
+                         "\x44\xe9\xc5\x65\xd1\xc7\x3b\xff"
+                         "\x20\xa0\x80\x1a\xc3\x9a\xad\x5e"
+                         "\x5d\x3b\xd3\x07\xd9\xf5\xfd\x3d"
+                         "\x4a\x8b\xa8\xd2\x6e\x7a\x51\x65"
+                         "\x6c\x8e\x95\xe0\x45\xc9\x5f\x4a"
+                         "\x09\x3c\x3d\x71\x7f\x0c\x84\x2a"
+                         "\xc8\x48\x52\x1a\xc2\xd5\xd6\x78"
+                         "\x92\x1e\xa0\x90\x2e\xea\xf0\xf3"
+                         "\xdc\x0f\xb1\xaf\x0d\x9b\x06\x2e"
+                         "\x35\x10\x30\x82\x0d\xe7\xc5\x9b"
+                         "\xde\x44\x18\xbd\x9f\xd1\x45\xa9"
+                         "\x7b\x7a\x4a\xad\x35\x65\x27\xca"
+                         "\xb2\xc3\xd4\x9b\x71\x86\x70\xee"
+                         "\xf1\x89\x3b\x85\x4b\x5b\xaa\xaf"
+                         "\xfc\x42\xc8\x31\x59\xbe\x16\x60"
+                         "\x4f\xf9\xfa\x12\xea\xd0\xa7\x14"
+                         "\xf0\x7a\xf3\xd5\x8d\xbd\x81\xef"
+                         "\x52\x7f\x29\x51\x94\x20\x67\x3c"
+                         "\xd1\xaf\x77\x9f\x22\x5a\x4e\x63"
+                         "\xe7\xff\x73\x25\xd1\xdd\x96\x8a"
+                         "\x98\x52\x6d\xf3\xac\x3e\xf2\x18"
+                         "\x6d\xf6\x0a\x29\xa6\x34\x3d\xed"
+                         "\xe3\x27\x0d\x9d\x0a\x02\x44\x7e"
+                         "\x5a\x7e\x67\x0f\x0a\x9e\xd6\xad"
+                         "\x91\xe6\x4d\x81\x8c\x5c\x59\xaa"
+                         "\xfb\xeb\x56\x53\xd2\x7d\x4c\x81"
+                         "\x65\x53\x0f\x41\x11\xbd\x98\x99"
+                         "\xf9\xc6\xfa\x51\x2e\xa3\xdd\x8d"
+                         "\x84\x98\xf9\x34\xed\x33\x2a\x1f"
+                         "\x82\xed\xc1\x73\x98\xd3\x02\xdc"
+                         "\xe6\xc2\x33\x1d\xa2\xb4\xca\x76"
+                         "\x63\x51\x34\x9d\x96\x12\xae\xce"
+                         "\x83\xc9\x76\x5e\xa4\x1b\x53\x37"
+                         "\x17\xd5\xc0\x80\x1d\x62\xf8\x3d"
+                         "\x54\x27\x74\xbb\x10\x86\x57\x46"
+                         "\x68\xe1\xed\x14\xe7\x9d\xfc\x84"
+                         "\x47\xbc\xc2\xf8\x19\x4b\x99\xcf"
+                         "\x7a\xe9\xc4\xb8\x8c\x82\x72\x4d"
+                         "\x7b\x4f\x38\x55\x36\x71\x64\xc1"
+                         "\xfc\x5c\x75\x52\x33\x02\x18\xf8"
+                         "\x17\xe1\x2b\xc2\x43\x39\xbd\x76"
+                         "\x9b\x63\x76\x32\x2f\x19\x72\x10"
+                         "\x9f\x21\x0c\xf1\x66\x50\x7f\xa5"
+                         "\x0d\x1f\x46\xe0\xba\xd3\x2f\x3c",
                .rlen   = 512,
                .also_non_np = 1,
                .np     = 3,
                .tap    = { 512 - 20, 4, 16 },
-       },
+       }
 };
 
-static const struct cipher_testvec serpent_xts_dec_tv_template[] = {
-       /* Generated from AES-XTS test vectors */
-       /* same as enc vectors with input and result reversed */
+static const struct cipher_testvec speck64_xts_dec_tv_template[] = {
        {
                .key    = "\x00\x00\x00\x00\x00\x00\x00\x00"
-                         "\x00\x00\x00\x00\x00\x00\x00\x00"
                          "\x00\x00\x00\x00\x00\x00\x00\x00"
                          "\x00\x00\x00\x00\x00\x00\x00\x00",
-               .klen   = 32,
+               .klen   = 24,
                .iv     = "\x00\x00\x00\x00\x00\x00\x00\x00"
                          "\x00\x00\x00\x00\x00\x00\x00\x00",
-               .input  = "\xe1\x08\xb8\x1d\x2c\xf5\x33\x64"
-                         "\xc8\x12\x04\xc7\xb3\x70\xe8\xc4"
-                         "\x6a\x31\xc5\xf3\x00\xca\xb9\x16"
-                         "\xde\xe2\x77\x66\xf7\xfe\x62\x08",
+               .input  = "\x84\xaf\x54\x07\x19\xd4\x7c\xa6"
+                         "\xe4\xfe\xdf\xc4\x1f\x34\xc3\xc2"
+                         "\x80\xf5\x72\xe7\xcd\xf0\x99\x22"
+                         "\x35\xa7\x2f\x06\xef\xdc\x51\xaa",
                .ilen   = 32,
                .result = "\x00\x00\x00\x00\x00\x00\x00\x00"
                          "\x00\x00\x00\x00\x00\x00\x00\x00"
@@ -14004,15 +15887,14 @@ static const struct cipher_testvec serpent_xts_dec_tv_template[] = {
        }, {
                .key    = "\x11\x11\x11\x11\x11\x11\x11\x11"
                          "\x11\x11\x11\x11\x11\x11\x11\x11"
-                         "\x22\x22\x22\x22\x22\x22\x22\x22"
                          "\x22\x22\x22\x22\x22\x22\x22\x22",
-               .klen   = 32,
+               .klen   = 24,
                .iv     = "\x33\x33\x33\x33\x33\x00\x00\x00"
                          "\x00\x00\x00\x00\x00\x00\x00\x00",
-               .input  = "\x1a\x0a\x09\x5f\xcd\x07\x07\x98"
-                         "\x41\x86\x12\xaf\xb3\xd7\x68\x13"
-                         "\xed\x81\xcd\x06\x87\x43\x1a\xbb"
-                         "\x13\x3d\xd6\x1e\x2b\xe1\x77\xbe",
+               .input  = "\x12\x56\x73\xcd\x15\x87\xa8\x59"
+                         "\xcf\x84\xae\xd9\x1c\x66\xd6\x9f"
+                         "\xb3\x12\x69\x7e\x36\xeb\x52\xff"
+                         "\x62\xdd\xba\x90\xb3\xe1\xee\x99",
                .ilen   = 32,
                .result = "\x44\x44\x44\x44\x44\x44\x44\x44"
                          "\x44\x44\x44\x44\x44\x44\x44\x44"
@@ -14022,15 +15904,14 @@ static const struct cipher_testvec serpent_xts_dec_tv_template[] = {
        }, {
                .key    = "\xff\xfe\xfd\xfc\xfb\xfa\xf9\xf8"
                          "\xf7\xf6\xf5\xf4\xf3\xf2\xf1\xf0"
-                         "\x22\x22\x22\x22\x22\x22\x22\x22"
                          "\x22\x22\x22\x22\x22\x22\x22\x22",
-               .klen   = 32,
+               .klen   = 24,
                .iv     = "\x33\x33\x33\x33\x33\x00\x00\x00"
                          "\x00\x00\x00\x00\x00\x00\x00\x00",
-               .input  = "\xf9\x9b\x28\xb8\x5c\xaf\x8c\x61"
-                         "\xb6\x1c\x81\x8f\x2c\x87\x60\x89"
-                         "\x0d\x8d\x7a\xe8\x60\x48\xcc\x86"
-                         "\xc1\x68\x45\xaa\x00\xe9\x24\xc5",
+               .input  = "\x15\x1b\xe4\x2c\xa2\x5a\x2d\x2c"
+                         "\x27\x36\xc0\xbf\x5d\xea\x36\x37"
+                         "\x2d\x1a\x88\xbc\x66\xb5\xd0\x0b"
+                         "\xa1\xbc\x19\xb2\x0f\x3b\x75\x34",
                .ilen   = 32,
                .result = "\x44\x44\x44\x44\x44\x44\x44\x44"
                          "\x44\x44\x44\x44\x44\x44\x44\x44"
@@ -14040,75 +15921,74 @@ static const struct cipher_testvec serpent_xts_dec_tv_template[] = {
        }, {
                .key    = "\x27\x18\x28\x18\x28\x45\x90\x45"
                          "\x23\x53\x60\x28\x74\x71\x35\x26"
-                         "\x31\x41\x59\x26\x53\x58\x97\x93"
-                         "\x23\x84\x62\x64\x33\x83\x27\x95",
-               .klen   = 32,
+                         "\x31\x41\x59\x26\x53\x58\x97\x93",
+               .klen   = 24,
                .iv     = "\x00\x00\x00\x00\x00\x00\x00\x00"
                          "\x00\x00\x00\x00\x00\x00\x00\x00",
-               .input  = "\xfe\x47\x4a\xc8\x60\x7e\xb4\x8b"
-                         "\x0d\x10\xf4\xb0\x0d\xba\xf8\x53"
-                         "\x65\x6e\x38\x4b\xdb\xaa\xb1\x9e"
-                         "\x28\xca\xb0\x22\xb3\x85\x75\xf4"
-                         "\x00\x5c\x75\x14\x06\xd6\x25\x82"
-                         "\xe6\xcb\x08\xf7\x29\x90\x23\x8e"
-                         "\xa4\x68\x57\xe4\xf0\xd8\x32\xf3"
-                         "\x80\x51\x67\xb5\x0b\x85\x69\xe8"
-                         "\x19\xfe\xc4\xc7\x3e\xea\x90\xd3"
-                         "\x8f\xa3\xf2\x0a\xac\x17\x4b\xa0"
-                         "\x63\x5a\x16\x0f\xf0\xce\x66\x1f"
-                         "\x2c\x21\x07\xf1\xa4\x03\xa3\x44"
-                         "\x41\x61\x87\x5d\x6b\xb3\xef\xd4"
-                         "\xfc\xaa\x32\x7e\x55\x58\x04\x41"
-                         "\xc9\x07\x33\xc6\xa2\x68\xd6\x5a"
-                         "\x55\x79\x4b\x6f\xcf\x89\xb9\x19"
-                         "\xe5\x54\x13\x15\xb2\x1a\xfa\x15"
-                         "\xc2\xf0\x06\x59\xfa\xa0\x25\x05"
-                         "\x58\xfa\x43\x91\x16\x85\x40\xbb"
-                         "\x0d\x34\x4d\xc5\x1e\x20\xd5\x08"
-                         "\xcd\x22\x22\x41\x11\x9f\x6c\x7c"
-                         "\x8d\x57\xc9\xba\x57\xe8\x2c\xf7"
-                         "\xa0\x42\xa8\xde\xfc\xa3\xca\x98"
-                         "\x4b\x43\xb1\xce\x4b\xbf\x01\x67"
-                         "\x6e\x29\x60\xbd\x10\x14\x84\x82"
-                         "\x83\x82\x0c\x63\x73\x92\x02\x7c"
-                         "\x55\x37\x20\x80\x17\x51\xc8\xbc"
-                         "\x46\x02\xcb\x38\x07\x6d\xe2\x85"
-                         "\xaa\x29\xaf\x24\x58\x0d\xf0\x75"
-                         "\x08\x0a\xa5\x34\x25\x16\xf3\x74"
-                         "\xa7\x0b\x97\xbe\xc1\xa9\xdc\x29"
-                         "\x1a\x0a\x56\xc1\x1a\x91\x97\x8c"
-                         "\x0b\xc7\x16\xed\x5a\x22\xa6\x2e"
-                         "\x8c\x2b\x4f\x54\x76\x47\x53\x8e"
-                         "\xe8\x00\xec\x92\xb9\x55\xe6\xa2"
-                         "\xf3\xe2\x4f\x6a\x66\x60\xd0\x87"
-                         "\xe6\xd1\xcc\xe3\x6a\xc5\x2d\x21"
-                         "\xcc\x9d\x6a\xb6\x75\xaa\xe2\x19"
-                         "\x21\x9f\xa1\x5e\x4c\xfd\x72\xf9"
-                         "\x94\x4e\x63\xc7\xae\xfc\xed\x47"
-                         "\xe2\xfe\x7a\x63\x77\xfe\x97\x82"
-                         "\xb1\x10\x6e\x36\x1d\xe1\xc4\x80"
-                         "\xec\x69\x41\xec\xa7\x8a\xe0\x2f"
-                         "\xe3\x49\x26\xa2\x41\xb2\x08\x0f"
-                         "\x28\xb4\xa7\x39\xa1\x99\x2d\x1e"
-                         "\x43\x42\x35\xd0\xcf\xec\x77\x67"
-                         "\xb2\x3b\x9e\x1c\x35\xde\x4f\x5e"
-                         "\x73\x3f\x5d\x6f\x07\x4b\x2e\x50"
-                         "\xab\x6c\x6b\xff\xea\x00\x67\xaa"
-                         "\x0e\x82\x32\xdd\x3d\xb5\xe5\x76"
-                         "\x2b\x77\x3f\xbe\x12\x75\xfb\x92"
-                         "\xc6\x89\x67\x4d\xca\xf7\xd4\x50"
-                         "\xc0\x74\x47\xcc\xd9\x0a\xd4\xc6"
-                         "\x3b\x17\x2e\xe3\x35\xbb\x53\xb5"
-                         "\x86\xad\x51\xcc\xd5\x96\xb8\xdc"
-                         "\x03\x57\xe6\x98\x52\x2f\x61\x62"
-                         "\xc4\x5c\x9c\x36\x71\x07\xfb\x94"
-                         "\xe3\x02\xc4\x2b\x08\x75\xc7\x35"
-                         "\xfb\x2e\x88\x7b\xbb\x67\x00\xe1"
-                         "\xc9\xdd\x99\xb2\x13\x53\x1a\x4e"
-                         "\x76\x87\x19\x04\x1a\x2f\x38\x3e"
-                         "\xef\x91\x64\x1d\x18\x07\x4e\x31"
-                         "\x88\x21\x7c\xb0\xa5\x12\x4c\x3c"
-                         "\xb0\x20\xbd\xda\xdf\xf9\x7c\xdd",
+               .input  = "\xaf\xa1\x81\xa6\x32\xbb\x15\x8e"
+                         "\xf8\x95\x2e\xd3\xe6\xee\x7e\x09"
+                         "\x0c\x1a\xf5\x02\x97\x8b\xe3\xb3"
+                         "\x11\xc7\x39\x96\xd0\x95\xf4\x56"
+                         "\xf4\xdd\x03\x38\x01\x44\x2c\xcf"
+                         "\x88\xae\x8e\x3c\xcd\xe7\xaa\x66"
+                         "\xfe\x3d\xc6\xfb\x01\x23\x51\x43"
+                         "\xd5\xd2\x13\x86\x94\x34\xe9\x62"
+                         "\xf9\x89\xe3\xd1\x7b\xbe\xf8\xef"
+                         "\x76\x35\x04\x3f\xdb\x23\x9d\x0b"
+                         "\x85\x42\xb9\x02\xd6\xcc\xdb\x96"
+                         "\xa7\x6b\x27\xb6\xd4\x45\x8f\x7d"
+                         "\xae\xd2\x04\xd5\xda\xc1\x7e\x24"
+                         "\x8c\x73\xbe\x48\x7e\xcf\x65\x28"
+                         "\x29\xe5\xbe\x54\x30\xcb\x46\x95"
+                         "\x4f\x2e\x8a\x36\xc8\x27\xc5\xbe"
+                         "\xd0\x1a\xaf\xab\x26\xcd\x9e\x69"
+                         "\xa1\x09\x95\x71\x26\xe9\xc4\xdf"
+                         "\xe6\x31\xc3\x46\xda\xaf\x0b\x41"
+                         "\x1f\xab\xb1\x8e\xd6\xfc\x0b\xb3"
+                         "\x82\xc0\x37\x27\xfc\x91\xa7\x05"
+                         "\xfb\xc5\xdc\x2b\x74\x96\x48\x43"
+                         "\x5d\x9c\x19\x0f\x60\x63\x3a\x1f"
+                         "\x6f\xf0\x03\xbe\x4d\xfd\xc8\x4a"
+                         "\xc6\xa4\x81\x6d\xc3\x12\x2a\x5c"
+                         "\x07\xff\xf3\x72\x74\x48\xb5\x40"
+                         "\x50\xb5\xdd\x90\x43\x31\x18\x15"
+                         "\x7b\xf2\xa6\xdb\x83\xc8\x4b\x4a"
+                         "\x29\x93\x90\x8b\xda\x07\xf0\x35"
+                         "\x6d\x90\x88\x09\x4e\x83\xf5\x5b"
+                         "\x94\x12\xbb\x33\x27\x1d\x3f\x23"
+                         "\x51\xa8\x7c\x07\xa2\xae\x77\xa6"
+                         "\x50\xfd\xcc\xc0\x4f\x80\x7a\x9f"
+                         "\x66\xdd\xcd\x75\x24\x8b\x33\xf7"
+                         "\x20\xdb\x83\x9b\x4f\x11\x63\x6e"
+                         "\xcf\x37\xef\xc9\x11\x01\x5c\x45"
+                         "\x32\x99\x7c\x3c\x9e\x42\x89\xe3"
+                         "\x70\x6d\x15\x9f\xb1\xe6\xb6\x05"
+                         "\xfe\x0c\xb9\x49\x2d\x90\x6d\xcc"
+                         "\x5d\x3f\xc1\xfe\x89\x0a\x2e\x2d"
+                         "\xa0\xa8\x89\x3b\x73\x39\xa5\x94"
+                         "\x4c\xa4\xa6\xbb\xa7\x14\x46\x89"
+                         "\x10\xff\xaf\xef\xca\xdd\x4f\x80"
+                         "\xb3\xdf\x3b\xab\xd4\xe5\x5a\xc7"
+                         "\x33\xca\x00\x8b\x8b\x3f\xea\xec"
+                         "\x68\x8a\xc2\x6d\xfd\xd4\x67\x0f"
+                         "\x22\x31\xe1\x0e\xfe\x5a\x04\xd5"
+                         "\x64\xa3\xf1\x1a\x76\x28\xcc\x35"
+                         "\x36\xa7\x0a\x74\xf7\x1c\x44\x9b"
+                         "\xc7\x1b\x53\x17\x02\xea\xd1\xad"
+                         "\x13\x51\x73\xc0\xa0\xb2\x05\x32"
+                         "\xa8\xa2\x37\x2e\xe1\x7a\x3a\x19"
+                         "\x26\xb4\x6c\x62\x5d\xb3\x1a\x1d"
+                         "\x59\xda\xee\x1a\x22\x18\xda\x0d"
+                         "\x88\x0f\x55\x8b\x72\x62\xfd\xc1"
+                         "\x69\x13\xcd\x0d\x5f\xc1\x09\x52"
+                         "\xee\xd6\xe3\x84\x4d\xee\xf6\x88"
+                         "\xaf\x83\xdc\x76\xf4\xc0\x93\x3f"
+                         "\x4a\x75\x2f\xb0\x0b\x3e\xc4\x54"
+                         "\x7d\x69\x8d\x00\x62\x77\x0d\x14"
+                         "\xbe\x7c\xa6\x7d\xc5\x24\x4f\xf3"
+                         "\x50\xf7\x5f\xf4\xc2\xca\x41\x97"
+                         "\x37\xbe\x75\x74\xcd\xf0\x75\x6e"
+                         "\x25\x23\x94\xbd\xda\x8d\xb0\xd4",
                .ilen   = 512,
                .result = "\x00\x01\x02\x03\x04\x05\x06\x07"
                          "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f"
@@ -14179,78 +16059,74 @@ static const struct cipher_testvec serpent_xts_dec_tv_template[] = {
                .key    = "\x27\x18\x28\x18\x28\x45\x90\x45"
                          "\x23\x53\x60\x28\x74\x71\x35\x26"
                          "\x62\x49\x77\x57\x24\x70\x93\x69"
-                         "\x99\x59\x57\x49\x66\x96\x76\x27"
-                         "\x31\x41\x59\x26\x53\x58\x97\x93"
-                         "\x23\x84\x62\x64\x33\x83\x27\x95"
-                         "\x02\x88\x41\x97\x16\x93\x99\x37"
-                         "\x51\x05\x82\x09\x74\x94\x45\x92",
-               .klen   = 64,
+                         "\x99\x59\x57\x49\x66\x96\x76\x27",
+               .klen   = 32,
                .iv     = "\xff\x00\x00\x00\x00\x00\x00\x00"
                          "\x00\x00\x00\x00\x00\x00\x00\x00",
-               .input  = "\x2b\xc9\xb4\x6b\x10\x94\xa9\x32"
-                         "\xaa\xb0\x20\xc6\x44\x3d\x74\x1f"
-                         "\x75\x01\xa7\xf6\xf5\xf7\x62\x1b"
-                         "\x80\x1b\x82\xcb\x01\x59\x91\x7f"
-                         "\x80\x3a\x98\xf0\xd2\xca\xc4\xc3"
-                         "\x34\xfd\xe6\x11\xf9\x33\x45\x12"
-                         "\x48\xc5\x8c\x25\xf1\xc5\xc5\x23"
-                         "\xd3\x44\xb4\x73\xd5\x04\xc0\xb7"
-                         "\xca\x2f\xf5\xcd\xc5\xb4\xdd\xb0"
-                         "\xf4\x60\xe8\xfb\xc6\x9c\xc5\x78"
-                         "\xcd\xec\x7d\xdc\x19\x9c\x72\x64"
-                         "\x63\x0b\x38\x2e\x76\xdd\x2d\x36"
-                         "\x49\xb0\x1d\xea\x78\x9e\x00\xca"
-                         "\x20\xcc\x1b\x1e\x98\x74\xab\xed"
-                         "\x79\xf7\xd0\x6c\xd8\x93\x80\x29"
-                         "\xac\xa5\x5e\x34\xa9\xab\xa0\x55"
-                         "\x9a\xea\xaa\x95\x4d\x7b\xfe\x46"
-                         "\x26\x8a\xfd\x88\xa2\xa8\xa6\xae"
-                         "\x25\x42\x17\xbf\x76\x8f\x1c\x3d"
-                         "\xec\x9a\xda\x64\x96\xb5\x61\xff"
-                         "\x99\xeb\x12\x96\x85\x82\x9d\xd5"
-                         "\x81\x85\x14\xa8\x59\xac\x8c\x94"
-                         "\xbb\x3b\x85\x2b\xdf\xb3\x0c\xba"
-                         "\x82\xc6\x4d\xca\x86\xea\x53\x28"
-                         "\x4c\xe0\x4e\x31\xe3\x73\x2f\x79"
-                         "\x9d\x42\xe1\x03\xe3\x8b\xc4\xff"
-                         "\x05\xca\x81\x7b\xda\xa2\xde\x63"
-                         "\x3a\x10\xbe\xc2\xac\x32\xc4\x05"
-                         "\x47\x7e\xef\x67\xe2\x5f\x5b\xae"
-                         "\xed\xf1\x70\x34\x16\x9a\x07\x7b"
-                         "\xf2\x25\x2b\xb0\xf8\x3c\x15\x9a"
-                         "\xa6\x59\x55\x5f\xc1\xf4\x1e\xcd"
-                         "\x93\x1f\x06\xba\xd4\x9a\x22\x69"
-                         "\xfa\x8e\x95\x0d\xf3\x23\x59\x2c"
-                         "\xfe\x00\xba\xf0\x0e\xbc\x6d\xd6"
-                         "\x62\xf0\x7a\x0e\x83\x3e\xdb\x32"
-                         "\xfd\x43\x7d\xda\x42\x51\x87\x43"
-                         "\x9d\xf9\xef\xf4\x30\x97\xf8\x09"
-                         "\x88\xfc\x3f\x93\x70\xc1\x4a\xec"
-                         "\x27\x5f\x11\xac\x71\xc7\x48\x46"
-                         "\x2f\xf9\xdf\x8d\x9f\xf7\x2e\x56"
-                         "\x0d\x4e\xb0\x32\x76\xce\x86\x81"
-                         "\xcd\xdf\xe4\x00\xbf\xfd\x5f\x24"
-                         "\xaf\xf7\x9a\xde\xff\x18\xac\x14"
-                         "\x90\xc5\x01\x39\x34\x0f\x24\xf3"
-                         "\x13\x2f\x5e\x4f\x30\x9a\x36\x40"
-                         "\xec\xea\xbc\xcd\x9e\x0e\x5b\x23"
-                         "\x50\x88\x97\x40\x69\xb1\x37\xf5"
-                         "\xc3\x15\xf9\x3f\xb7\x79\x64\xe8"
-                         "\x7b\x10\x20\xb9\x2b\x46\x83\x5b"
-                         "\xd8\x39\xfc\xe4\xfa\x88\x52\xf2"
-                         "\x72\xb0\x97\x4e\x89\xb3\x48\x00"
-                         "\xc1\x16\x73\x50\x77\xba\xa6\x65"
-                         "\x20\x2d\xb0\x02\x27\x89\xda\x99"
-                         "\x45\xfb\xe9\xd3\x1d\x39\x2f\xd6"
-                         "\x2a\xda\x09\x12\x11\xaf\xe6\x57"
-                         "\x01\x04\x8a\xff\x86\x8b\xac\xf8"
-                         "\xee\xe4\x1c\x98\x5b\xcf\x6b\x76"
-                         "\xa3\x0e\x33\x74\x40\x18\x39\x72"
-                         "\x66\x50\x31\xfd\x70\xdf\xe8\x51"
-                         "\x96\x21\x36\xb2\x9b\xfa\x85\xd1"
-                         "\x30\x05\xc8\x92\x98\x80\xff\x7a"
-                         "\xaf\x43\x0b\xc5\x20\x41\x92\x20"
-                         "\xd4\xa0\x91\x98\x11\x5f\x4d\xb1",
+               .input  = "\x55\xed\x71\xd3\x02\x8e\x15\x3b"
+                         "\xc6\x71\x29\x2d\x3e\x89\x9f\x59"
+                         "\x68\x6a\xcc\x8a\x56\x97\xf3\x95"
+                         "\x4e\x51\x08\xda\x2a\xf8\x6f\x3c"
+                         "\x78\x16\xea\x80\xdb\x33\x75\x94"
+                         "\xf9\x29\xc4\x2b\x76\x75\x97\xc7"
+                         "\xf2\x98\x2c\xf9\xff\xc8\xd5\x2b"
+                         "\x18\xf1\xaf\xcf\x7c\xc5\x0b\xee"
+                         "\xad\x3c\x76\x7c\xe6\x27\xa2\x2a"
+                         "\xe4\x66\xe1\xab\xa2\x39\xfc\x7c"
+                         "\xf5\xec\x32\x74\xa3\xb8\x03\x88"
+                         "\x52\xfc\x2e\x56\x3f\xa1\xf0\x9f"
+                         "\x84\x5e\x46\xed\x20\x89\xb6\x44"
+                         "\x8d\xd0\xed\x54\x47\x16\xbe\x95"
+                         "\x8a\xb3\x6b\x72\xc4\x32\x52\x13"
+                         "\x1b\xb0\x82\xbe\xac\xf9\x70\xa6"
+                         "\x44\x18\xdd\x8c\x6e\xca\x6e\x45"
+                         "\x8f\x1e\x10\x07\x57\x25\x98\x7b"
+                         "\x17\x8c\x78\xdd\x80\xa7\xd9\xd8"
+                         "\x63\xaf\xb9\x67\x57\xfd\xbc\xdb"
+                         "\x44\xe9\xc5\x65\xd1\xc7\x3b\xff"
+                         "\x20\xa0\x80\x1a\xc3\x9a\xad\x5e"
+                         "\x5d\x3b\xd3\x07\xd9\xf5\xfd\x3d"
+                         "\x4a\x8b\xa8\xd2\x6e\x7a\x51\x65"
+                         "\x6c\x8e\x95\xe0\x45\xc9\x5f\x4a"
+                         "\x09\x3c\x3d\x71\x7f\x0c\x84\x2a"
+                         "\xc8\x48\x52\x1a\xc2\xd5\xd6\x78"
+                         "\x92\x1e\xa0\x90\x2e\xea\xf0\xf3"
+                         "\xdc\x0f\xb1\xaf\x0d\x9b\x06\x2e"
+                         "\x35\x10\x30\x82\x0d\xe7\xc5\x9b"
+                         "\xde\x44\x18\xbd\x9f\xd1\x45\xa9"
+                         "\x7b\x7a\x4a\xad\x35\x65\x27\xca"
+                         "\xb2\xc3\xd4\x9b\x71\x86\x70\xee"
+                         "\xf1\x89\x3b\x85\x4b\x5b\xaa\xaf"
+                         "\xfc\x42\xc8\x31\x59\xbe\x16\x60"
+                         "\x4f\xf9\xfa\x12\xea\xd0\xa7\x14"
+                         "\xf0\x7a\xf3\xd5\x8d\xbd\x81\xef"
+                         "\x52\x7f\x29\x51\x94\x20\x67\x3c"
+                         "\xd1\xaf\x77\x9f\x22\x5a\x4e\x63"
+                         "\xe7\xff\x73\x25\xd1\xdd\x96\x8a"
+                         "\x98\x52\x6d\xf3\xac\x3e\xf2\x18"
+                         "\x6d\xf6\x0a\x29\xa6\x34\x3d\xed"
+                         "\xe3\x27\x0d\x9d\x0a\x02\x44\x7e"
+                         "\x5a\x7e\x67\x0f\x0a\x9e\xd6\xad"
+                         "\x91\xe6\x4d\x81\x8c\x5c\x59\xaa"
+                         "\xfb\xeb\x56\x53\xd2\x7d\x4c\x81"
+                         "\x65\x53\x0f\x41\x11\xbd\x98\x99"
+                         "\xf9\xc6\xfa\x51\x2e\xa3\xdd\x8d"
+                         "\x84\x98\xf9\x34\xed\x33\x2a\x1f"
+                         "\x82\xed\xc1\x73\x98\xd3\x02\xdc"
+                         "\xe6\xc2\x33\x1d\xa2\xb4\xca\x76"
+                         "\x63\x51\x34\x9d\x96\x12\xae\xce"
+                         "\x83\xc9\x76\x5e\xa4\x1b\x53\x37"
+                         "\x17\xd5\xc0\x80\x1d\x62\xf8\x3d"
+                         "\x54\x27\x74\xbb\x10\x86\x57\x46"
+                         "\x68\xe1\xed\x14\xe7\x9d\xfc\x84"
+                         "\x47\xbc\xc2\xf8\x19\x4b\x99\xcf"
+                         "\x7a\xe9\xc4\xb8\x8c\x82\x72\x4d"
+                         "\x7b\x4f\x38\x55\x36\x71\x64\xc1"
+                         "\xfc\x5c\x75\x52\x33\x02\x18\xf8"
+                         "\x17\xe1\x2b\xc2\x43\x39\xbd\x76"
+                         "\x9b\x63\x76\x32\x2f\x19\x72\x10"
+                         "\x9f\x21\x0c\xf1\x66\x50\x7f\xa5"
+                         "\x0d\x1f\x46\xe0\xba\xd3\x2f\x3c",
                .ilen   = 512,
                .result = "\x00\x01\x02\x03\x04\x05\x06\x07"
                          "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f"
@@ -14320,7 +16196,7 @@ static const struct cipher_testvec serpent_xts_dec_tv_template[] = {
                .also_non_np = 1,
                .np     = 3,
                .tap    = { 512 - 20, 4, 16 },
-       },
+       }
 };
 
 /* Cast6 test vectors from RFC 2612 */