linux/crypto/testmgr.h
<<
>>
Prefs
   1/*
   2 * Algorithm testing framework and tests.
   3 *
   4 * Copyright (c) 2002 James Morris <jmorris@intercode.com.au>
   5 * Copyright (c) 2002 Jean-Francois Dive <jef@linuxbe.org>
   6 * Copyright (c) 2007 Nokia Siemens Networks
   7 * Copyright (c) 2008 Herbert Xu <herbert@gondor.apana.org.au>
   8 *
   9 * Updated RFC4106 AES-GCM testing. Some test vectors were taken from
  10 * http://csrc.nist.gov/groups/ST/toolkit/BCM/documents/proposedmodes/
  11 * gcm/gcm-test-vectors.tar.gz
  12 *     Authors: Aidan O'Mahony (aidan.o.mahony@intel.com)
  13 *              Adrian Hoban <adrian.hoban@intel.com>
  14 *              Gabriele Paoloni <gabriele.paoloni@intel.com>
  15 *              Tadeusz Struk (tadeusz.struk@intel.com)
  16 *     Copyright (c) 2010, Intel Corporation.
  17 *
  18 * This program is free software; you can redistribute it and/or modify it
  19 * under the terms of the GNU General Public License as published by the Free
  20 * Software Foundation; either version 2 of the License, or (at your option)
  21 * any later version.
  22 *
  23 */
  24#ifndef _CRYPTO_TESTMGR_H
  25#define _CRYPTO_TESTMGR_H
  26
  27#include <linux/netlink.h>
  28#include <linux/zlib.h>
  29
  30#include <crypto/compress.h>
  31
  32#define MAX_DIGEST_SIZE         64
  33#define MAX_TAP                 8
  34
  35#define MAX_KEYLEN              56
  36#define MAX_IVLEN               32
  37
  38struct hash_testvec {
  39        /* only used with keyed hash algorithms */
  40        char *key;
  41        char *plaintext;
  42        char *digest;
  43        unsigned char tap[MAX_TAP];
  44        unsigned char psize;
  45        unsigned char np;
  46        unsigned char ksize;
  47};
  48
  49struct cipher_testvec {
  50        char *key;
  51        char *iv;
  52        char *input;
  53        char *result;
  54        unsigned short tap[MAX_TAP];
  55        int np;
  56        unsigned char also_non_np;
  57        unsigned char fail;
  58        unsigned char wk; /* weak key flag */
  59        unsigned char klen;
  60        unsigned short ilen;
  61        unsigned short rlen;
  62};
  63
  64struct aead_testvec {
  65        char *key;
  66        char *iv;
  67        char *input;
  68        char *assoc;
  69        char *result;
  70        unsigned char tap[MAX_TAP];
  71        unsigned char atap[MAX_TAP];
  72        int np;
  73        int anp;
  74        unsigned char fail;
  75        unsigned char novrfy;   /* ccm dec verification failure expected */
  76        unsigned char wk; /* weak key flag */
  77        unsigned char klen;
  78        unsigned short ilen;
  79        unsigned short alen;
  80        unsigned short rlen;
  81};
  82
  83struct cprng_testvec {
  84        char *key;
  85        char *dt;
  86        char *v;
  87        char *result;
  88        unsigned char klen;
  89        unsigned short dtlen;
  90        unsigned short vlen;
  91        unsigned short rlen;
  92        unsigned short loops;
  93};
  94
  95static char zeroed_string[48];
  96
  97/*
  98 * MD4 test vectors from RFC1320
  99 */
 100#define MD4_TEST_VECTORS        7
 101
 102static struct hash_testvec md4_tv_template [] = {
 103        {
 104                .plaintext = "",
 105                .digest = "\x31\xd6\xcf\xe0\xd1\x6a\xe9\x31"
 106                          "\xb7\x3c\x59\xd7\xe0\xc0\x89\xc0",
 107        }, {
 108                .plaintext = "a",
 109                .psize  = 1,
 110                .digest = "\xbd\xe5\x2c\xb3\x1d\xe3\x3e\x46"
 111                          "\x24\x5e\x05\xfb\xdb\xd6\xfb\x24",
 112        }, {
 113                .plaintext = "abc",
 114                .psize  = 3,
 115                .digest = "\xa4\x48\x01\x7a\xaf\x21\xd8\x52"
 116                          "\x5f\xc1\x0a\xe8\x7a\xa6\x72\x9d",
 117        }, {
 118                .plaintext = "message digest",
 119                .psize  = 14,
 120                .digest = "\xd9\x13\x0a\x81\x64\x54\x9f\xe8"
 121                        "\x18\x87\x48\x06\xe1\xc7\x01\x4b",
 122        }, {
 123                .plaintext = "abcdefghijklmnopqrstuvwxyz",
 124                .psize  = 26,
 125                .digest = "\xd7\x9e\x1c\x30\x8a\xa5\xbb\xcd"
 126                          "\xee\xa8\xed\x63\xdf\x41\x2d\xa9",
 127                .np     = 2,
 128                .tap    = { 13, 13 },
 129        }, {
 130                .plaintext = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",
 131                .psize  = 62,
 132                .digest = "\x04\x3f\x85\x82\xf2\x41\xdb\x35"
 133                          "\x1c\xe6\x27\xe1\x53\xe7\xf0\xe4",
 134        }, {
 135                .plaintext = "123456789012345678901234567890123456789012345678901234567890123"
 136                           "45678901234567890",
 137                .psize  = 80,
 138                .digest = "\xe3\x3b\x4d\xdc\x9c\x38\xf2\x19"
 139                          "\x9c\x3e\x7b\x16\x4f\xcc\x05\x36",
 140        },
 141};
 142
 143/*
 144 * MD5 test vectors from RFC1321
 145 */
 146#define MD5_TEST_VECTORS        7
 147
 148static struct hash_testvec md5_tv_template[] = {
 149        {
 150                .digest = "\xd4\x1d\x8c\xd9\x8f\x00\xb2\x04"
 151                          "\xe9\x80\x09\x98\xec\xf8\x42\x7e",
 152        }, {
 153                .plaintext = "a",
 154                .psize  = 1,
 155                .digest = "\x0c\xc1\x75\xb9\xc0\xf1\xb6\xa8"
 156                          "\x31\xc3\x99\xe2\x69\x77\x26\x61",
 157        }, {
 158                .plaintext = "abc",
 159                .psize  = 3,
 160                .digest = "\x90\x01\x50\x98\x3c\xd2\x4f\xb0"
 161                          "\xd6\x96\x3f\x7d\x28\xe1\x7f\x72",
 162        }, {
 163                .plaintext = "message digest",
 164                .psize  = 14,
 165                .digest = "\xf9\x6b\x69\x7d\x7c\xb7\x93\x8d"
 166                          "\x52\x5a\x2f\x31\xaa\xf1\x61\xd0",
 167        }, {
 168                .plaintext = "abcdefghijklmnopqrstuvwxyz",
 169                .psize  = 26,
 170                .digest = "\xc3\xfc\xd3\xd7\x61\x92\xe4\x00"
 171                          "\x7d\xfb\x49\x6c\xca\x67\xe1\x3b",
 172                .np     = 2,
 173                .tap    = {13, 13}
 174        }, {
 175                .plaintext = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",
 176                .psize  = 62,
 177                .digest = "\xd1\x74\xab\x98\xd2\x77\xd9\xf5"
 178                          "\xa5\x61\x1c\x2c\x9f\x41\x9d\x9f",
 179        }, {
 180                .plaintext = "12345678901234567890123456789012345678901234567890123456789012"
 181                           "345678901234567890",
 182                .psize  = 80,
 183                .digest = "\x57\xed\xf4\xa2\x2b\xe3\xc9\x55"
 184                          "\xac\x49\xda\x2e\x21\x07\xb6\x7a",
 185        }
 186
 187};
 188
 189/*
 190 * RIPEMD-128 test vectors from ISO/IEC 10118-3:2004(E)
 191 */
 192#define RMD128_TEST_VECTORS     10
 193
 194static struct hash_testvec rmd128_tv_template[] = {
 195        {
 196                .digest = "\xcd\xf2\x62\x13\xa1\x50\xdc\x3e"
 197                          "\xcb\x61\x0f\x18\xf6\xb3\x8b\x46",
 198        }, {
 199                .plaintext = "a",
 200                .psize  = 1,
 201                .digest = "\x86\xbe\x7a\xfa\x33\x9d\x0f\xc7"
 202                          "\xcf\xc7\x85\xe7\x2f\x57\x8d\x33",
 203        }, {
 204                .plaintext = "abc",
 205                .psize  = 3,
 206                .digest = "\xc1\x4a\x12\x19\x9c\x66\xe4\xba"
 207                          "\x84\x63\x6b\x0f\x69\x14\x4c\x77",
 208        }, {
 209                .plaintext = "message digest",
 210                .psize  = 14,
 211                .digest = "\x9e\x32\x7b\x3d\x6e\x52\x30\x62"
 212                          "\xaf\xc1\x13\x2d\x7d\xf9\xd1\xb8",
 213        }, {
 214                .plaintext = "abcdefghijklmnopqrstuvwxyz",
 215                .psize  = 26,
 216                .digest = "\xfd\x2a\xa6\x07\xf7\x1d\xc8\xf5"
 217                          "\x10\x71\x49\x22\xb3\x71\x83\x4e",
 218        }, {
 219                .plaintext = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcde"
 220                             "fghijklmnopqrstuvwxyz0123456789",
 221                .psize  = 62,
 222                .digest = "\xd1\xe9\x59\xeb\x17\x9c\x91\x1f"
 223                          "\xae\xa4\x62\x4c\x60\xc5\xc7\x02",
 224        }, {
 225                .plaintext = "1234567890123456789012345678901234567890"
 226                             "1234567890123456789012345678901234567890",
 227                .psize  = 80,
 228                .digest = "\x3f\x45\xef\x19\x47\x32\xc2\xdb"
 229                          "\xb2\xc4\xa2\xc7\x69\x79\x5f\xa3",
 230        }, {
 231                .plaintext = "abcdbcdecdefdefgefghfghighij"
 232                             "hijkijkljklmklmnlmnomnopnopq",
 233                .psize  = 56,
 234                .digest = "\xa1\xaa\x06\x89\xd0\xfa\xfa\x2d"
 235                          "\xdc\x22\xe8\x8b\x49\x13\x3a\x06",
 236                .np     = 2,
 237                .tap    = { 28, 28 },
 238        }, {
 239                .plaintext = "abcdefghbcdefghicdefghijdefghijkefghijklfghi"
 240                             "jklmghijklmnhijklmnoijklmnopjklmnopqklmnopqr"
 241                             "lmnopqrsmnopqrstnopqrstu",
 242                .psize  = 112,
 243                .digest = "\xd4\xec\xc9\x13\xe1\xdf\x77\x6b"
 244                          "\xf4\x8d\xe9\xd5\x5b\x1f\x25\x46",
 245        }, {
 246                .plaintext = "abcdbcdecdefdefgefghfghighijhijk",
 247                .psize  = 32,
 248                .digest = "\x13\xfc\x13\xe8\xef\xff\x34\x7d"
 249                          "\xe1\x93\xff\x46\xdb\xac\xcf\xd4",
 250        }
 251};
 252
 253/*
 254 * RIPEMD-160 test vectors from ISO/IEC 10118-3:2004(E)
 255 */
 256#define RMD160_TEST_VECTORS     10
 257
 258static struct hash_testvec rmd160_tv_template[] = {
 259        {
 260                .digest = "\x9c\x11\x85\xa5\xc5\xe9\xfc\x54\x61\x28"
 261                          "\x08\x97\x7e\xe8\xf5\x48\xb2\x25\x8d\x31",
 262        }, {
 263                .plaintext = "a",
 264                .psize  = 1,
 265                .digest = "\x0b\xdc\x9d\x2d\x25\x6b\x3e\xe9\xda\xae"
 266                          "\x34\x7b\xe6\xf4\xdc\x83\x5a\x46\x7f\xfe",
 267        }, {
 268                .plaintext = "abc",
 269                .psize  = 3,
 270                .digest = "\x8e\xb2\x08\xf7\xe0\x5d\x98\x7a\x9b\x04"
 271                          "\x4a\x8e\x98\xc6\xb0\x87\xf1\x5a\x0b\xfc",
 272        }, {
 273                .plaintext = "message digest",
 274                .psize  = 14,
 275                .digest = "\x5d\x06\x89\xef\x49\xd2\xfa\xe5\x72\xb8"
 276                          "\x81\xb1\x23\xa8\x5f\xfa\x21\x59\x5f\x36",
 277        }, {
 278                .plaintext = "abcdefghijklmnopqrstuvwxyz",
 279                .psize  = 26,
 280                .digest = "\xf7\x1c\x27\x10\x9c\x69\x2c\x1b\x56\xbb"
 281                          "\xdc\xeb\x5b\x9d\x28\x65\xb3\x70\x8d\xbc",
 282        }, {
 283                .plaintext = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcde"
 284                             "fghijklmnopqrstuvwxyz0123456789",
 285                .psize  = 62,
 286                .digest = "\xb0\xe2\x0b\x6e\x31\x16\x64\x02\x86\xed"
 287                          "\x3a\x87\xa5\x71\x30\x79\xb2\x1f\x51\x89",
 288        }, {
 289                .plaintext = "1234567890123456789012345678901234567890"
 290                             "1234567890123456789012345678901234567890",
 291                .psize  = 80,
 292                .digest = "\x9b\x75\x2e\x45\x57\x3d\x4b\x39\xf4\xdb"
 293                          "\xd3\x32\x3c\xab\x82\xbf\x63\x32\x6b\xfb",
 294        }, {
 295                .plaintext = "abcdbcdecdefdefgefghfghighij"
 296                             "hijkijkljklmklmnlmnomnopnopq",
 297                .psize  = 56,
 298                .digest = "\x12\xa0\x53\x38\x4a\x9c\x0c\x88\xe4\x05"
 299                          "\xa0\x6c\x27\xdc\xf4\x9a\xda\x62\xeb\x2b",
 300                .np     = 2,
 301                .tap    = { 28, 28 },
 302        }, {
 303                .plaintext = "abcdefghbcdefghicdefghijdefghijkefghijklfghi"
 304                             "jklmghijklmnhijklmnoijklmnopjklmnopqklmnopqr"
 305                             "lmnopqrsmnopqrstnopqrstu",
 306                .psize  = 112,
 307                .digest = "\x6f\x3f\xa3\x9b\x6b\x50\x3c\x38\x4f\x91"
 308                          "\x9a\x49\xa7\xaa\x5c\x2c\x08\xbd\xfb\x45",
 309        }, {
 310                .plaintext = "abcdbcdecdefdefgefghfghighijhijk",
 311                .psize  = 32,
 312                .digest = "\x94\xc2\x64\x11\x54\x04\xe6\x33\x79\x0d"
 313                          "\xfc\xc8\x7b\x58\x7d\x36\x77\x06\x7d\x9f",
 314        }
 315};
 316
 317/*
 318 * RIPEMD-256 test vectors
 319 */
 320#define RMD256_TEST_VECTORS     8
 321
 322static struct hash_testvec rmd256_tv_template[] = {
 323        {
 324                .digest = "\x02\xba\x4c\x4e\x5f\x8e\xcd\x18"
 325                          "\x77\xfc\x52\xd6\x4d\x30\xe3\x7a"
 326                          "\x2d\x97\x74\xfb\x1e\x5d\x02\x63"
 327                          "\x80\xae\x01\x68\xe3\xc5\x52\x2d",
 328        }, {
 329                .plaintext = "a",
 330                .psize  = 1,
 331                .digest = "\xf9\x33\x3e\x45\xd8\x57\xf5\xd9"
 332                          "\x0a\x91\xba\xb7\x0a\x1e\xba\x0c"
 333                          "\xfb\x1b\xe4\xb0\x78\x3c\x9a\xcf"
 334                          "\xcd\x88\x3a\x91\x34\x69\x29\x25",
 335        }, {
 336                .plaintext = "abc",
 337                .psize  = 3,
 338                .digest = "\xaf\xbd\x6e\x22\x8b\x9d\x8c\xbb"
 339                          "\xce\xf5\xca\x2d\x03\xe6\xdb\xa1"
 340                          "\x0a\xc0\xbc\x7d\xcb\xe4\x68\x0e"
 341                          "\x1e\x42\xd2\xe9\x75\x45\x9b\x65",
 342        }, {
 343                .plaintext = "message digest",
 344                .psize  = 14,
 345                .digest = "\x87\xe9\x71\x75\x9a\x1c\xe4\x7a"
 346                          "\x51\x4d\x5c\x91\x4c\x39\x2c\x90"
 347                          "\x18\xc7\xc4\x6b\xc1\x44\x65\x55"
 348                          "\x4a\xfc\xdf\x54\xa5\x07\x0c\x0e",
 349        }, {
 350                .plaintext = "abcdefghijklmnopqrstuvwxyz",
 351                .psize  = 26,
 352                .digest = "\x64\x9d\x30\x34\x75\x1e\xa2\x16"
 353                          "\x77\x6b\xf9\xa1\x8a\xcc\x81\xbc"
 354                          "\x78\x96\x11\x8a\x51\x97\x96\x87"
 355                          "\x82\xdd\x1f\xd9\x7d\x8d\x51\x33",
 356        }, {
 357                .plaintext = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcde"
 358                             "fghijklmnopqrstuvwxyz0123456789",
 359                .psize  = 62,
 360                .digest = "\x57\x40\xa4\x08\xac\x16\xb7\x20"
 361                          "\xb8\x44\x24\xae\x93\x1c\xbb\x1f"
 362                          "\xe3\x63\xd1\xd0\xbf\x40\x17\xf1"
 363                          "\xa8\x9f\x7e\xa6\xde\x77\xa0\xb8",
 364        }, {
 365                .plaintext = "1234567890123456789012345678901234567890"
 366                             "1234567890123456789012345678901234567890",
 367                .psize  = 80,
 368                .digest = "\x06\xfd\xcc\x7a\x40\x95\x48\xaa"
 369                          "\xf9\x13\x68\xc0\x6a\x62\x75\xb5"
 370                          "\x53\xe3\xf0\x99\xbf\x0e\xa4\xed"
 371                          "\xfd\x67\x78\xdf\x89\xa8\x90\xdd",
 372        }, {
 373                .plaintext = "abcdbcdecdefdefgefghfghighij"
 374                             "hijkijkljklmklmnlmnomnopnopq",
 375                .psize  = 56,
 376                .digest = "\x38\x43\x04\x55\x83\xaa\xc6\xc8"
 377                          "\xc8\xd9\x12\x85\x73\xe7\xa9\x80"
 378                          "\x9a\xfb\x2a\x0f\x34\xcc\xc3\x6e"
 379                          "\xa9\xe7\x2f\x16\xf6\x36\x8e\x3f",
 380                .np     = 2,
 381                .tap    = { 28, 28 },
 382        }
 383};
 384
 385/*
 386 * RIPEMD-320 test vectors
 387 */
 388#define RMD320_TEST_VECTORS     8
 389
 390static struct hash_testvec rmd320_tv_template[] = {
 391        {
 392                .digest = "\x22\xd6\x5d\x56\x61\x53\x6c\xdc\x75\xc1"
 393                          "\xfd\xf5\xc6\xde\x7b\x41\xb9\xf2\x73\x25"
 394                          "\xeb\xc6\x1e\x85\x57\x17\x7d\x70\x5a\x0e"
 395                          "\xc8\x80\x15\x1c\x3a\x32\xa0\x08\x99\xb8",
 396        }, {
 397                .plaintext = "a",
 398                .psize  = 1,
 399                .digest = "\xce\x78\x85\x06\x38\xf9\x26\x58\xa5\xa5"
 400                          "\x85\x09\x75\x79\x92\x6d\xda\x66\x7a\x57"
 401                          "\x16\x56\x2c\xfc\xf6\xfb\xe7\x7f\x63\x54"
 402                          "\x2f\x99\xb0\x47\x05\xd6\x97\x0d\xff\x5d",
 403        }, {
 404                .plaintext = "abc",
 405                .psize  = 3,
 406                .digest = "\xde\x4c\x01\xb3\x05\x4f\x89\x30\xa7\x9d"
 407                          "\x09\xae\x73\x8e\x92\x30\x1e\x5a\x17\x08"
 408                          "\x5b\xef\xfd\xc1\xb8\xd1\x16\x71\x3e\x74"
 409                          "\xf8\x2f\xa9\x42\xd6\x4c\xdb\xc4\x68\x2d",
 410        }, {
 411                .plaintext = "message digest",
 412                .psize  = 14,
 413                .digest = "\x3a\x8e\x28\x50\x2e\xd4\x5d\x42\x2f\x68"
 414                          "\x84\x4f\x9d\xd3\x16\xe7\xb9\x85\x33\xfa"
 415                          "\x3f\x2a\x91\xd2\x9f\x84\xd4\x25\xc8\x8d"
 416                          "\x6b\x4e\xff\x72\x7d\xf6\x6a\x7c\x01\x97",
 417        }, {
 418                .plaintext = "abcdefghijklmnopqrstuvwxyz",
 419                .psize  = 26,
 420                .digest = "\xca\xbd\xb1\x81\x0b\x92\x47\x0a\x20\x93"
 421                          "\xaa\x6b\xce\x05\x95\x2c\x28\x34\x8c\xf4"
 422                          "\x3f\xf6\x08\x41\x97\x51\x66\xbb\x40\xed"
 423                          "\x23\x40\x04\xb8\x82\x44\x63\xe6\xb0\x09",
 424        }, {
 425                .plaintext = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcde"
 426                             "fghijklmnopqrstuvwxyz0123456789",
 427                .psize  = 62,
 428                .digest = "\xed\x54\x49\x40\xc8\x6d\x67\xf2\x50\xd2"
 429                          "\x32\xc3\x0b\x7b\x3e\x57\x70\xe0\xc6\x0c"
 430                          "\x8c\xb9\xa4\xca\xfe\x3b\x11\x38\x8a\xf9"
 431                          "\x92\x0e\x1b\x99\x23\x0b\x84\x3c\x86\xa4",
 432        }, {
 433                .plaintext = "1234567890123456789012345678901234567890"
 434                             "1234567890123456789012345678901234567890",
 435                .psize  = 80,
 436                .digest = "\x55\x78\x88\xaf\x5f\x6d\x8e\xd6\x2a\xb6"
 437                          "\x69\x45\xc6\xd2\xa0\xa4\x7e\xcd\x53\x41"
 438                          "\xe9\x15\xeb\x8f\xea\x1d\x05\x24\x95\x5f"
 439                          "\x82\x5d\xc7\x17\xe4\xa0\x08\xab\x2d\x42",
 440        }, {
 441                .plaintext = "abcdbcdecdefdefgefghfghighij"
 442                             "hijkijkljklmklmnlmnomnopnopq",
 443                .psize  = 56,
 444                .digest = "\xd0\x34\xa7\x95\x0c\xf7\x22\x02\x1b\xa4"
 445                          "\xb8\x4d\xf7\x69\xa5\xde\x20\x60\xe2\x59"
 446                          "\xdf\x4c\x9b\xb4\xa4\x26\x8c\x0e\x93\x5b"
 447                          "\xbc\x74\x70\xa9\x69\xc9\xd0\x72\xa1\xac",
 448                .np     = 2,
 449                .tap    = { 28, 28 },
 450        }
 451};
 452
 453/*
 454 * SHA1 test vectors  from from FIPS PUB 180-1
 455 * Long vector from CAVS 5.0
 456 */
 457#define SHA1_TEST_VECTORS       3
 458
 459static struct hash_testvec sha1_tv_template[] = {
 460        {
 461                .plaintext = "abc",
 462                .psize  = 3,
 463                .digest = "\xa9\x99\x3e\x36\x47\x06\x81\x6a\xba\x3e"
 464                          "\x25\x71\x78\x50\xc2\x6c\x9c\xd0\xd8\x9d",
 465        }, {
 466                .plaintext = "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq",
 467                .psize  = 56,
 468                .digest = "\x84\x98\x3e\x44\x1c\x3b\xd2\x6e\xba\xae"
 469                          "\x4a\xa1\xf9\x51\x29\xe5\xe5\x46\x70\xf1",
 470                .np     = 2,
 471                .tap    = { 28, 28 }
 472        }, {
 473                .plaintext = "\xec\x29\x56\x12\x44\xed\xe7\x06"
 474                             "\xb6\xeb\x30\xa1\xc3\x71\xd7\x44"
 475                             "\x50\xa1\x05\xc3\xf9\x73\x5f\x7f"
 476                             "\xa9\xfe\x38\xcf\x67\xf3\x04\xa5"
 477                             "\x73\x6a\x10\x6e\x92\xe1\x71\x39"
 478                             "\xa6\x81\x3b\x1c\x81\xa4\xf3\xd3"
 479                             "\xfb\x95\x46\xab\x42\x96\xfa\x9f"
 480                             "\x72\x28\x26\xc0\x66\x86\x9e\xda"
 481                             "\xcd\x73\xb2\x54\x80\x35\x18\x58"
 482                             "\x13\xe2\x26\x34\xa9\xda\x44\x00"
 483                             "\x0d\x95\xa2\x81\xff\x9f\x26\x4e"
 484                             "\xcc\xe0\xa9\x31\x22\x21\x62\xd0"
 485                             "\x21\xcc\xa2\x8d\xb5\xf3\xc2\xaa"
 486                             "\x24\x94\x5a\xb1\xe3\x1c\xb4\x13"
 487                             "\xae\x29\x81\x0f\xd7\x94\xca\xd5"
 488                             "\xdf\xaf\x29\xec\x43\xcb\x38\xd1"
 489                             "\x98\xfe\x4a\xe1\xda\x23\x59\x78"
 490                             "\x02\x21\x40\x5b\xd6\x71\x2a\x53"
 491                             "\x05\xda\x4b\x1b\x73\x7f\xce\x7c"
 492                             "\xd2\x1c\x0e\xb7\x72\x8d\x08\x23"
 493                             "\x5a\x90\x11",
 494                .psize  = 163,
 495                .digest = "\x97\x01\x11\xc4\xe7\x7b\xcc\x88\xcc\x20"
 496                          "\x45\x9c\x02\xb6\x9b\x4a\xa8\xf5\x82\x17",
 497                .np     = 4,
 498                .tap    = { 63, 64, 31, 5 }
 499        }
 500};
 501
 502
 503/*
 504 * SHA224 test vectors from from FIPS PUB 180-2
 505 */
 506#define SHA224_TEST_VECTORS     2
 507
 508static struct hash_testvec sha224_tv_template[] = {
 509        {
 510                .plaintext = "abc",
 511                .psize  = 3,
 512                .digest = "\x23\x09\x7D\x22\x34\x05\xD8\x22"
 513                          "\x86\x42\xA4\x77\xBD\xA2\x55\xB3"
 514                          "\x2A\xAD\xBC\xE4\xBD\xA0\xB3\xF7"
 515                          "\xE3\x6C\x9D\xA7",
 516        }, {
 517                .plaintext =
 518                "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq",
 519                .psize  = 56,
 520                .digest = "\x75\x38\x8B\x16\x51\x27\x76\xCC"
 521                          "\x5D\xBA\x5D\xA1\xFD\x89\x01\x50"
 522                          "\xB0\xC6\x45\x5C\xB4\xF5\x8B\x19"
 523                          "\x52\x52\x25\x25",
 524                .np     = 2,
 525                .tap    = { 28, 28 }
 526        }
 527};
 528
 529/*
 530 * SHA256 test vectors from from NIST
 531 */
 532#define SHA256_TEST_VECTORS     2
 533
 534static struct hash_testvec sha256_tv_template[] = {
 535        {
 536                .plaintext = "abc",
 537                .psize  = 3,
 538                .digest = "\xba\x78\x16\xbf\x8f\x01\xcf\xea"
 539                          "\x41\x41\x40\xde\x5d\xae\x22\x23"
 540                          "\xb0\x03\x61\xa3\x96\x17\x7a\x9c"
 541                          "\xb4\x10\xff\x61\xf2\x00\x15\xad",
 542        }, {
 543                .plaintext = "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq",
 544                .psize  = 56,
 545                .digest = "\x24\x8d\x6a\x61\xd2\x06\x38\xb8"
 546                          "\xe5\xc0\x26\x93\x0c\x3e\x60\x39"
 547                          "\xa3\x3c\xe4\x59\x64\xff\x21\x67"
 548                          "\xf6\xec\xed\xd4\x19\xdb\x06\xc1",
 549                .np     = 2,
 550                .tap    = { 28, 28 }
 551        },
 552};
 553
 554/*
 555 * SHA384 test vectors from from NIST and kerneli
 556 */
 557#define SHA384_TEST_VECTORS     4
 558
 559static struct hash_testvec sha384_tv_template[] = {
 560        {
 561                .plaintext= "abc",
 562                .psize  = 3,
 563                .digest = "\xcb\x00\x75\x3f\x45\xa3\x5e\x8b"
 564                          "\xb5\xa0\x3d\x69\x9a\xc6\x50\x07"
 565                          "\x27\x2c\x32\xab\x0e\xde\xd1\x63"
 566                          "\x1a\x8b\x60\x5a\x43\xff\x5b\xed"
 567                          "\x80\x86\x07\x2b\xa1\xe7\xcc\x23"
 568                          "\x58\xba\xec\xa1\x34\xc8\x25\xa7",
 569        }, {
 570                .plaintext = "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq",
 571                .psize  = 56,
 572                .digest = "\x33\x91\xfd\xdd\xfc\x8d\xc7\x39"
 573                          "\x37\x07\xa6\x5b\x1b\x47\x09\x39"
 574                          "\x7c\xf8\xb1\xd1\x62\xaf\x05\xab"
 575                          "\xfe\x8f\x45\x0d\xe5\xf3\x6b\xc6"
 576                          "\xb0\x45\x5a\x85\x20\xbc\x4e\x6f"
 577                          "\x5f\xe9\x5b\x1f\xe3\xc8\x45\x2b",
 578        }, {
 579                .plaintext = "abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmn"
 580                           "hijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu",
 581                .psize  = 112,
 582                .digest = "\x09\x33\x0c\x33\xf7\x11\x47\xe8"
 583                          "\x3d\x19\x2f\xc7\x82\xcd\x1b\x47"
 584                          "\x53\x11\x1b\x17\x3b\x3b\x05\xd2"
 585                          "\x2f\xa0\x80\x86\xe3\xb0\xf7\x12"
 586                          "\xfc\xc7\xc7\x1a\x55\x7e\x2d\xb9"
 587                          "\x66\xc3\xe9\xfa\x91\x74\x60\x39",
 588        }, {
 589                .plaintext = "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcd"
 590                           "efghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz",
 591                .psize  = 104,
 592                .digest = "\x3d\x20\x89\x73\xab\x35\x08\xdb"
 593                          "\xbd\x7e\x2c\x28\x62\xba\x29\x0a"
 594                          "\xd3\x01\x0e\x49\x78\xc1\x98\xdc"
 595                          "\x4d\x8f\xd0\x14\xe5\x82\x82\x3a"
 596                          "\x89\xe1\x6f\x9b\x2a\x7b\xbc\x1a"
 597                          "\xc9\x38\xe2\xd1\x99\xe8\xbe\xa4",
 598                .np     = 4,
 599                .tap    = { 26, 26, 26, 26 }
 600        },
 601};
 602
 603/*
 604 * SHA512 test vectors from from NIST and kerneli
 605 */
 606#define SHA512_TEST_VECTORS     4
 607
 608static struct hash_testvec sha512_tv_template[] = {
 609        {
 610                .plaintext = "abc",
 611                .psize  = 3,
 612                .digest = "\xdd\xaf\x35\xa1\x93\x61\x7a\xba"
 613                          "\xcc\x41\x73\x49\xae\x20\x41\x31"
 614                          "\x12\xe6\xfa\x4e\x89\xa9\x7e\xa2"
 615                          "\x0a\x9e\xee\xe6\x4b\x55\xd3\x9a"
 616                          "\x21\x92\x99\x2a\x27\x4f\xc1\xa8"
 617                          "\x36\xba\x3c\x23\xa3\xfe\xeb\xbd"
 618                          "\x45\x4d\x44\x23\x64\x3c\xe8\x0e"
 619                          "\x2a\x9a\xc9\x4f\xa5\x4c\xa4\x9f",
 620        }, {
 621                .plaintext = "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq",
 622                .psize  = 56,
 623                .digest = "\x20\x4a\x8f\xc6\xdd\xa8\x2f\x0a"
 624                          "\x0c\xed\x7b\xeb\x8e\x08\xa4\x16"
 625                          "\x57\xc1\x6e\xf4\x68\xb2\x28\xa8"
 626                          "\x27\x9b\xe3\x31\xa7\x03\xc3\x35"
 627                          "\x96\xfd\x15\xc1\x3b\x1b\x07\xf9"
 628                          "\xaa\x1d\x3b\xea\x57\x78\x9c\xa0"
 629                          "\x31\xad\x85\xc7\xa7\x1d\xd7\x03"
 630                          "\x54\xec\x63\x12\x38\xca\x34\x45",
 631        }, {
 632                .plaintext = "abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmn"
 633                           "hijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu",
 634                .psize  = 112,
 635                .digest = "\x8e\x95\x9b\x75\xda\xe3\x13\xda"
 636                          "\x8c\xf4\xf7\x28\x14\xfc\x14\x3f"
 637                          "\x8f\x77\x79\xc6\xeb\x9f\x7f\xa1"
 638                          "\x72\x99\xae\xad\xb6\x88\x90\x18"
 639                          "\x50\x1d\x28\x9e\x49\x00\xf7\xe4"
 640                          "\x33\x1b\x99\xde\xc4\xb5\x43\x3a"
 641                          "\xc7\xd3\x29\xee\xb6\xdd\x26\x54"
 642                          "\x5e\x96\xe5\x5b\x87\x4b\xe9\x09",
 643        }, {
 644                .plaintext = "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcd"
 645                           "efghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz",
 646                .psize  = 104,
 647                .digest = "\x93\x0d\x0c\xef\xcb\x30\xff\x11"
 648                          "\x33\xb6\x89\x81\x21\xf1\xcf\x3d"
 649                          "\x27\x57\x8a\xfc\xaf\xe8\x67\x7c"
 650                          "\x52\x57\xcf\x06\x99\x11\xf7\x5d"
 651                          "\x8f\x58\x31\xb5\x6e\xbf\xda\x67"
 652                          "\xb2\x78\xe6\x6d\xff\x8b\x84\xfe"
 653                          "\x2b\x28\x70\xf7\x42\xa5\x80\xd8"
 654                          "\xed\xb4\x19\x87\x23\x28\x50\xc9",
 655                .np     = 4,
 656                .tap    = { 26, 26, 26, 26 }
 657        },
 658};
 659
 660
 661/*
 662 * WHIRLPOOL test vectors from Whirlpool package
 663 * by Vincent Rijmen and Paulo S. L. M. Barreto as part of the NESSIE
 664 * submission
 665 */
 666#define WP512_TEST_VECTORS      8
 667
 668static struct hash_testvec wp512_tv_template[] = {
 669        {
 670                .plaintext = "",
 671                .psize  = 0,
 672                .digest = "\x19\xFA\x61\xD7\x55\x22\xA4\x66"
 673                          "\x9B\x44\xE3\x9C\x1D\x2E\x17\x26"
 674                          "\xC5\x30\x23\x21\x30\xD4\x07\xF8"
 675                          "\x9A\xFE\xE0\x96\x49\x97\xF7\xA7"
 676                          "\x3E\x83\xBE\x69\x8B\x28\x8F\xEB"
 677                          "\xCF\x88\xE3\xE0\x3C\x4F\x07\x57"
 678                          "\xEA\x89\x64\xE5\x9B\x63\xD9\x37"
 679                          "\x08\xB1\x38\xCC\x42\xA6\x6E\xB3",
 680
 681
 682        }, {
 683                .plaintext = "a",
 684                .psize  = 1,
 685                .digest = "\x8A\xCA\x26\x02\x79\x2A\xEC\x6F"
 686                          "\x11\xA6\x72\x06\x53\x1F\xB7\xD7"
 687                          "\xF0\xDF\xF5\x94\x13\x14\x5E\x69"
 688                          "\x73\xC4\x50\x01\xD0\x08\x7B\x42"
 689                          "\xD1\x1B\xC6\x45\x41\x3A\xEF\xF6"
 690                          "\x3A\x42\x39\x1A\x39\x14\x5A\x59"
 691                          "\x1A\x92\x20\x0D\x56\x01\x95\xE5"
 692                          "\x3B\x47\x85\x84\xFD\xAE\x23\x1A",
 693        }, {
 694                .plaintext = "abc",
 695                .psize  = 3,
 696                .digest = "\x4E\x24\x48\xA4\xC6\xF4\x86\xBB"
 697                          "\x16\xB6\x56\x2C\x73\xB4\x02\x0B"
 698                          "\xF3\x04\x3E\x3A\x73\x1B\xCE\x72"
 699                          "\x1A\xE1\xB3\x03\xD9\x7E\x6D\x4C"
 700                          "\x71\x81\xEE\xBD\xB6\xC5\x7E\x27"
 701                          "\x7D\x0E\x34\x95\x71\x14\xCB\xD6"
 702                          "\xC7\x97\xFC\x9D\x95\xD8\xB5\x82"
 703                          "\xD2\x25\x29\x20\x76\xD4\xEE\xF5",
 704        }, {
 705                .plaintext = "message digest",
 706                .psize  = 14,
 707                .digest = "\x37\x8C\x84\xA4\x12\x6E\x2D\xC6"
 708                          "\xE5\x6D\xCC\x74\x58\x37\x7A\xAC"
 709                          "\x83\x8D\x00\x03\x22\x30\xF5\x3C"
 710                          "\xE1\xF5\x70\x0C\x0F\xFB\x4D\x3B"
 711                          "\x84\x21\x55\x76\x59\xEF\x55\xC1"
 712                          "\x06\xB4\xB5\x2A\xC5\xA4\xAA\xA6"
 713                          "\x92\xED\x92\x00\x52\x83\x8F\x33"
 714                          "\x62\xE8\x6D\xBD\x37\xA8\x90\x3E",
 715        }, {
 716                .plaintext = "abcdefghijklmnopqrstuvwxyz",
 717                .psize  = 26,
 718                .digest = "\xF1\xD7\x54\x66\x26\x36\xFF\xE9"
 719                          "\x2C\x82\xEB\xB9\x21\x2A\x48\x4A"
 720                          "\x8D\x38\x63\x1E\xAD\x42\x38\xF5"
 721                          "\x44\x2E\xE1\x3B\x80\x54\xE4\x1B"
 722                          "\x08\xBF\x2A\x92\x51\xC3\x0B\x6A"
 723                          "\x0B\x8A\xAE\x86\x17\x7A\xB4\xA6"
 724                          "\xF6\x8F\x67\x3E\x72\x07\x86\x5D"
 725                          "\x5D\x98\x19\xA3\xDB\xA4\xEB\x3B",
 726        }, {
 727                .plaintext = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
 728                           "abcdefghijklmnopqrstuvwxyz0123456789",
 729                .psize  = 62,
 730                .digest = "\xDC\x37\xE0\x08\xCF\x9E\xE6\x9B"
 731                          "\xF1\x1F\x00\xED\x9A\xBA\x26\x90"
 732                          "\x1D\xD7\xC2\x8C\xDE\xC0\x66\xCC"
 733                          "\x6A\xF4\x2E\x40\xF8\x2F\x3A\x1E"
 734                          "\x08\xEB\xA2\x66\x29\x12\x9D\x8F"
 735                          "\xB7\xCB\x57\x21\x1B\x92\x81\xA6"
 736                          "\x55\x17\xCC\x87\x9D\x7B\x96\x21"
 737                          "\x42\xC6\x5F\x5A\x7A\xF0\x14\x67",
 738        }, {
 739                .plaintext = "1234567890123456789012345678901234567890"
 740                           "1234567890123456789012345678901234567890",
 741                .psize  = 80,
 742                .digest = "\x46\x6E\xF1\x8B\xAB\xB0\x15\x4D"
 743                          "\x25\xB9\xD3\x8A\x64\x14\xF5\xC0"
 744                          "\x87\x84\x37\x2B\xCC\xB2\x04\xD6"
 745                          "\x54\x9C\x4A\xFA\xDB\x60\x14\x29"
 746                          "\x4D\x5B\xD8\xDF\x2A\x6C\x44\xE5"
 747                          "\x38\xCD\x04\x7B\x26\x81\xA5\x1A"
 748                          "\x2C\x60\x48\x1E\x88\xC5\xA2\x0B"
 749                          "\x2C\x2A\x80\xCF\x3A\x9A\x08\x3B",
 750        }, {
 751                .plaintext = "abcdbcdecdefdefgefghfghighijhijk",
 752                .psize  = 32,
 753                .digest = "\x2A\x98\x7E\xA4\x0F\x91\x70\x61"
 754                          "\xF5\xD6\xF0\xA0\xE4\x64\x4F\x48"
 755                          "\x8A\x7A\x5A\x52\xDE\xEE\x65\x62"
 756                          "\x07\xC5\x62\xF9\x88\xE9\x5C\x69"
 757                          "\x16\xBD\xC8\x03\x1B\xC5\xBE\x1B"
 758                          "\x7B\x94\x76\x39\xFE\x05\x0B\x56"
 759                          "\x93\x9B\xAA\xA0\xAD\xFF\x9A\xE6"
 760                          "\x74\x5B\x7B\x18\x1C\x3B\xE3\xFD",
 761        },
 762};
 763
 764#define WP384_TEST_VECTORS      8
 765
 766static struct hash_testvec wp384_tv_template[] = {
 767        {
 768                .plaintext = "",
 769                .psize  = 0,
 770                .digest = "\x19\xFA\x61\xD7\x55\x22\xA4\x66"
 771                          "\x9B\x44\xE3\x9C\x1D\x2E\x17\x26"
 772                          "\xC5\x30\x23\x21\x30\xD4\x07\xF8"
 773                          "\x9A\xFE\xE0\x96\x49\x97\xF7\xA7"
 774                          "\x3E\x83\xBE\x69\x8B\x28\x8F\xEB"
 775                          "\xCF\x88\xE3\xE0\x3C\x4F\x07\x57",
 776
 777
 778        }, {
 779                .plaintext = "a",
 780                .psize  = 1,
 781                .digest = "\x8A\xCA\x26\x02\x79\x2A\xEC\x6F"
 782                          "\x11\xA6\x72\x06\x53\x1F\xB7\xD7"
 783                          "\xF0\xDF\xF5\x94\x13\x14\x5E\x69"
 784                          "\x73\xC4\x50\x01\xD0\x08\x7B\x42"
 785                          "\xD1\x1B\xC6\x45\x41\x3A\xEF\xF6"
 786                          "\x3A\x42\x39\x1A\x39\x14\x5A\x59",
 787        }, {
 788                .plaintext = "abc",
 789                .psize  = 3,
 790                .digest = "\x4E\x24\x48\xA4\xC6\xF4\x86\xBB"
 791                          "\x16\xB6\x56\x2C\x73\xB4\x02\x0B"
 792                          "\xF3\x04\x3E\x3A\x73\x1B\xCE\x72"
 793                          "\x1A\xE1\xB3\x03\xD9\x7E\x6D\x4C"
 794                          "\x71\x81\xEE\xBD\xB6\xC5\x7E\x27"
 795                          "\x7D\x0E\x34\x95\x71\x14\xCB\xD6",
 796        }, {
 797                .plaintext = "message digest",
 798                .psize  = 14,
 799                .digest = "\x37\x8C\x84\xA4\x12\x6E\x2D\xC6"
 800                          "\xE5\x6D\xCC\x74\x58\x37\x7A\xAC"
 801                          "\x83\x8D\x00\x03\x22\x30\xF5\x3C"
 802                          "\xE1\xF5\x70\x0C\x0F\xFB\x4D\x3B"
 803                          "\x84\x21\x55\x76\x59\xEF\x55\xC1"
 804                          "\x06\xB4\xB5\x2A\xC5\xA4\xAA\xA6",
 805        }, {
 806                .plaintext = "abcdefghijklmnopqrstuvwxyz",
 807                .psize  = 26,
 808                .digest = "\xF1\xD7\x54\x66\x26\x36\xFF\xE9"
 809                          "\x2C\x82\xEB\xB9\x21\x2A\x48\x4A"
 810                          "\x8D\x38\x63\x1E\xAD\x42\x38\xF5"
 811                          "\x44\x2E\xE1\x3B\x80\x54\xE4\x1B"
 812                          "\x08\xBF\x2A\x92\x51\xC3\x0B\x6A"
 813                          "\x0B\x8A\xAE\x86\x17\x7A\xB4\xA6",
 814        }, {
 815                .plaintext = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
 816                           "abcdefghijklmnopqrstuvwxyz0123456789",
 817                .psize  = 62,
 818                .digest = "\xDC\x37\xE0\x08\xCF\x9E\xE6\x9B"
 819                          "\xF1\x1F\x00\xED\x9A\xBA\x26\x90"
 820                          "\x1D\xD7\xC2\x8C\xDE\xC0\x66\xCC"
 821                          "\x6A\xF4\x2E\x40\xF8\x2F\x3A\x1E"
 822                          "\x08\xEB\xA2\x66\x29\x12\x9D\x8F"
 823                          "\xB7\xCB\x57\x21\x1B\x92\x81\xA6",
 824        }, {
 825                .plaintext = "1234567890123456789012345678901234567890"
 826                           "1234567890123456789012345678901234567890",
 827                .psize  = 80,
 828                .digest = "\x46\x6E\xF1\x8B\xAB\xB0\x15\x4D"
 829                          "\x25\xB9\xD3\x8A\x64\x14\xF5\xC0"
 830                          "\x87\x84\x37\x2B\xCC\xB2\x04\xD6"
 831                          "\x54\x9C\x4A\xFA\xDB\x60\x14\x29"
 832                          "\x4D\x5B\xD8\xDF\x2A\x6C\x44\xE5"
 833                          "\x38\xCD\x04\x7B\x26\x81\xA5\x1A",
 834        }, {
 835                .plaintext = "abcdbcdecdefdefgefghfghighijhijk",
 836                .psize  = 32,
 837                .digest = "\x2A\x98\x7E\xA4\x0F\x91\x70\x61"
 838                          "\xF5\xD6\xF0\xA0\xE4\x64\x4F\x48"
 839                          "\x8A\x7A\x5A\x52\xDE\xEE\x65\x62"
 840                          "\x07\xC5\x62\xF9\x88\xE9\x5C\x69"
 841                          "\x16\xBD\xC8\x03\x1B\xC5\xBE\x1B"
 842                          "\x7B\x94\x76\x39\xFE\x05\x0B\x56",
 843        },
 844};
 845
 846#define WP256_TEST_VECTORS      8
 847
 848static struct hash_testvec wp256_tv_template[] = {
 849        {
 850                .plaintext = "",
 851                .psize  = 0,
 852                .digest = "\x19\xFA\x61\xD7\x55\x22\xA4\x66"
 853                          "\x9B\x44\xE3\x9C\x1D\x2E\x17\x26"
 854                          "\xC5\x30\x23\x21\x30\xD4\x07\xF8"
 855                          "\x9A\xFE\xE0\x96\x49\x97\xF7\xA7",
 856
 857
 858        }, {
 859                .plaintext = "a",
 860                .psize  = 1,
 861                .digest = "\x8A\xCA\x26\x02\x79\x2A\xEC\x6F"
 862                          "\x11\xA6\x72\x06\x53\x1F\xB7\xD7"
 863                          "\xF0\xDF\xF5\x94\x13\x14\x5E\x69"
 864                          "\x73\xC4\x50\x01\xD0\x08\x7B\x42",
 865        }, {
 866                .plaintext = "abc",
 867                .psize  = 3,
 868                .digest = "\x4E\x24\x48\xA4\xC6\xF4\x86\xBB"
 869                          "\x16\xB6\x56\x2C\x73\xB4\x02\x0B"
 870                          "\xF3\x04\x3E\x3A\x73\x1B\xCE\x72"
 871                          "\x1A\xE1\xB3\x03\xD9\x7E\x6D\x4C",
 872        }, {
 873                .plaintext = "message digest",
 874                .psize  = 14,
 875                .digest = "\x37\x8C\x84\xA4\x12\x6E\x2D\xC6"
 876                          "\xE5\x6D\xCC\x74\x58\x37\x7A\xAC"
 877                          "\x83\x8D\x00\x03\x22\x30\xF5\x3C"
 878                          "\xE1\xF5\x70\x0C\x0F\xFB\x4D\x3B",
 879        }, {
 880                .plaintext = "abcdefghijklmnopqrstuvwxyz",
 881                .psize  = 26,
 882                .digest = "\xF1\xD7\x54\x66\x26\x36\xFF\xE9"
 883                          "\x2C\x82\xEB\xB9\x21\x2A\x48\x4A"
 884                          "\x8D\x38\x63\x1E\xAD\x42\x38\xF5"
 885                          "\x44\x2E\xE1\x3B\x80\x54\xE4\x1B",
 886        }, {
 887                .plaintext = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
 888                           "abcdefghijklmnopqrstuvwxyz0123456789",
 889                .psize  = 62,
 890                .digest = "\xDC\x37\xE0\x08\xCF\x9E\xE6\x9B"
 891                          "\xF1\x1F\x00\xED\x9A\xBA\x26\x90"
 892                          "\x1D\xD7\xC2\x8C\xDE\xC0\x66\xCC"
 893                          "\x6A\xF4\x2E\x40\xF8\x2F\x3A\x1E",
 894        }, {
 895                .plaintext = "1234567890123456789012345678901234567890"
 896                           "1234567890123456789012345678901234567890",
 897                .psize  = 80,
 898                .digest = "\x46\x6E\xF1\x8B\xAB\xB0\x15\x4D"
 899                          "\x25\xB9\xD3\x8A\x64\x14\xF5\xC0"
 900                          "\x87\x84\x37\x2B\xCC\xB2\x04\xD6"
 901                          "\x54\x9C\x4A\xFA\xDB\x60\x14\x29",
 902        }, {
 903                .plaintext = "abcdbcdecdefdefgefghfghighijhijk",
 904                .psize  = 32,
 905                .digest = "\x2A\x98\x7E\xA4\x0F\x91\x70\x61"
 906                          "\xF5\xD6\xF0\xA0\xE4\x64\x4F\x48"
 907                          "\x8A\x7A\x5A\x52\xDE\xEE\x65\x62"
 908                          "\x07\xC5\x62\xF9\x88\xE9\x5C\x69",
 909        },
 910};
 911
 912/*
 913 * TIGER test vectors from Tiger website
 914 */
 915#define TGR192_TEST_VECTORS     6
 916
 917static struct hash_testvec tgr192_tv_template[] = {
 918        {
 919                .plaintext = "",
 920                .psize  = 0,
 921                .digest = "\x24\xf0\x13\x0c\x63\xac\x93\x32"
 922                          "\x16\x16\x6e\x76\xb1\xbb\x92\x5f"
 923                          "\xf3\x73\xde\x2d\x49\x58\x4e\x7a",
 924        }, {
 925                .plaintext = "abc",
 926                .psize  = 3,
 927                .digest = "\xf2\x58\xc1\xe8\x84\x14\xab\x2a"
 928                          "\x52\x7a\xb5\x41\xff\xc5\xb8\xbf"
 929                          "\x93\x5f\x7b\x95\x1c\x13\x29\x51",
 930        }, {
 931                .plaintext = "Tiger",
 932                .psize  = 5,
 933                .digest = "\x9f\x00\xf5\x99\x07\x23\x00\xdd"
 934                          "\x27\x6a\xbb\x38\xc8\xeb\x6d\xec"
 935                          "\x37\x79\x0c\x11\x6f\x9d\x2b\xdf",
 936        }, {
 937                .plaintext = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-",
 938                .psize  = 64,
 939                .digest = "\x87\xfb\x2a\x90\x83\x85\x1c\xf7"
 940                          "\x47\x0d\x2c\xf8\x10\xe6\xdf\x9e"
 941                          "\xb5\x86\x44\x50\x34\xa5\xa3\x86",
 942        }, {
 943                .plaintext = "ABCDEFGHIJKLMNOPQRSTUVWXYZ=abcdefghijklmnopqrstuvwxyz+0123456789",
 944                .psize  = 64,
 945                .digest = "\x46\x7d\xb8\x08\x63\xeb\xce\x48"
 946                          "\x8d\xf1\xcd\x12\x61\x65\x5d\xe9"
 947                          "\x57\x89\x65\x65\x97\x5f\x91\x97",
 948        }, {
 949                .plaintext = "Tiger - A Fast New Hash Function, "
 950                           "by Ross Anderson and Eli Biham, "
 951                           "proceedings of Fast Software Encryption 3, "
 952                           "Cambridge, 1996.",
 953                .psize  = 125,
 954                .digest = "\x3d\x9a\xeb\x03\xd1\xbd\x1a\x63"
 955                          "\x57\xb2\x77\x4d\xfd\x6d\x5b\x24"
 956                          "\xdd\x68\x15\x1d\x50\x39\x74\xfc",
 957        },
 958};
 959
 960#define TGR160_TEST_VECTORS     6
 961
 962static struct hash_testvec tgr160_tv_template[] = {
 963        {
 964                .plaintext = "",
 965                .psize  = 0,
 966                .digest = "\x24\xf0\x13\x0c\x63\xac\x93\x32"
 967                          "\x16\x16\x6e\x76\xb1\xbb\x92\x5f"
 968                          "\xf3\x73\xde\x2d",
 969        }, {
 970                .plaintext = "abc",
 971                .psize  = 3,
 972                .digest = "\xf2\x58\xc1\xe8\x84\x14\xab\x2a"
 973                          "\x52\x7a\xb5\x41\xff\xc5\xb8\xbf"
 974                          "\x93\x5f\x7b\x95",
 975        }, {
 976                .plaintext = "Tiger",
 977                .psize  = 5,
 978                .digest = "\x9f\x00\xf5\x99\x07\x23\x00\xdd"
 979                          "\x27\x6a\xbb\x38\xc8\xeb\x6d\xec"
 980                          "\x37\x79\x0c\x11",
 981        }, {
 982                .plaintext = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-",
 983                .psize  = 64,
 984                .digest = "\x87\xfb\x2a\x90\x83\x85\x1c\xf7"
 985                          "\x47\x0d\x2c\xf8\x10\xe6\xdf\x9e"
 986                          "\xb5\x86\x44\x50",
 987        }, {
 988                .plaintext = "ABCDEFGHIJKLMNOPQRSTUVWXYZ=abcdefghijklmnopqrstuvwxyz+0123456789",
 989                .psize  = 64,
 990                .digest = "\x46\x7d\xb8\x08\x63\xeb\xce\x48"
 991                          "\x8d\xf1\xcd\x12\x61\x65\x5d\xe9"
 992                          "\x57\x89\x65\x65",
 993        }, {
 994                .plaintext = "Tiger - A Fast New Hash Function, "
 995                           "by Ross Anderson and Eli Biham, "
 996                           "proceedings of Fast Software Encryption 3, "
 997                           "Cambridge, 1996.",
 998                .psize  = 125,
 999                .digest = "\x3d\x9a\xeb\x03\xd1\xbd\x1a\x63"
1000                          "\x57\xb2\x77\x4d\xfd\x6d\x5b\x24"
1001                          "\xdd\x68\x15\x1d",
1002        },
1003};
1004
1005#define TGR128_TEST_VECTORS     6
1006
1007static struct hash_testvec tgr128_tv_template[] = {
1008        {
1009                .plaintext = "",
1010                .psize  = 0,
1011                .digest = "\x24\xf0\x13\x0c\x63\xac\x93\x32"
1012                          "\x16\x16\x6e\x76\xb1\xbb\x92\x5f",
1013        }, {
1014                .plaintext = "abc",
1015                .psize  = 3,
1016                .digest = "\xf2\x58\xc1\xe8\x84\x14\xab\x2a"
1017                          "\x52\x7a\xb5\x41\xff\xc5\xb8\xbf",
1018        }, {
1019                .plaintext = "Tiger",
1020                .psize  = 5,
1021                .digest = "\x9f\x00\xf5\x99\x07\x23\x00\xdd"
1022                          "\x27\x6a\xbb\x38\xc8\xeb\x6d\xec",
1023        }, {
1024                .plaintext = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-",
1025                .psize  = 64,
1026                .digest = "\x87\xfb\x2a\x90\x83\x85\x1c\xf7"
1027                          "\x47\x0d\x2c\xf8\x10\xe6\xdf\x9e",
1028        }, {
1029                .plaintext = "ABCDEFGHIJKLMNOPQRSTUVWXYZ=abcdefghijklmnopqrstuvwxyz+0123456789",
1030                .psize  = 64,
1031                .digest = "\x46\x7d\xb8\x08\x63\xeb\xce\x48"
1032                          "\x8d\xf1\xcd\x12\x61\x65\x5d\xe9",
1033        }, {
1034                .plaintext = "Tiger - A Fast New Hash Function, "
1035                           "by Ross Anderson and Eli Biham, "
1036                           "proceedings of Fast Software Encryption 3, "
1037                           "Cambridge, 1996.",
1038                .psize  = 125,
1039                .digest = "\x3d\x9a\xeb\x03\xd1\xbd\x1a\x63"
1040                          "\x57\xb2\x77\x4d\xfd\x6d\x5b\x24",
1041        },
1042};
1043
1044#define GHASH_TEST_VECTORS 1
1045
1046static struct hash_testvec ghash_tv_template[] =
1047{
1048        {
1049
1050                .key    = "\xdf\xa6\xbf\x4d\xed\x81\xdb\x03\xff\xca\xff\x95\xf8\x30\xf0\x61",
1051                .ksize  = 16,
1052                .plaintext = "\x95\x2b\x2a\x56\xa5\x60\x04a\xc0\xb3\x2b\x66\x56\xa0\x5b\x40\xb6",
1053                .psize  = 16,
1054                .digest = "\xda\x53\xeb\x0a\xd2\xc5\x5b\xb6"
1055                          "\x4f\xc4\x80\x2c\xc3\xfe\xda\x60",
1056        },
1057};
1058
1059/*
1060 * HMAC-MD5 test vectors from RFC2202
1061 * (These need to be fixed to not use strlen).
1062 */
1063#define HMAC_MD5_TEST_VECTORS   7
1064
1065static struct hash_testvec hmac_md5_tv_template[] =
1066{
1067        {
1068                .key    = "\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b",
1069                .ksize  = 16,
1070                .plaintext = "Hi There",
1071                .psize  = 8,
1072                .digest = "\x92\x94\x72\x7a\x36\x38\xbb\x1c"
1073                          "\x13\xf4\x8e\xf8\x15\x8b\xfc\x9d",
1074        }, {
1075                .key    = "Jefe",
1076                .ksize  = 4,
1077                .plaintext = "what do ya want for nothing?",
1078                .psize  = 28,
1079                .digest = "\x75\x0c\x78\x3e\x6a\xb0\xb5\x03"
1080                          "\xea\xa8\x6e\x31\x0a\x5d\xb7\x38",
1081                .np     = 2,
1082                .tap    = {14, 14}
1083        }, {
1084                .key    = "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa",
1085                .ksize  = 16,
1086                .plaintext = "\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd"
1087                        "\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd"
1088                        "\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd"
1089                        "\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd",
1090                .psize  = 50,
1091                .digest = "\x56\xbe\x34\x52\x1d\x14\x4c\x88"
1092                          "\xdb\xb8\xc7\x33\xf0\xe8\xb3\xf6",
1093        }, {
1094                .key    = "\x01\x02\x03\x04\x05\x06\x07\x08"
1095                          "\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10"
1096                          "\x11\x12\x13\x14\x15\x16\x17\x18\x19",
1097                .ksize  = 25,
1098                .plaintext = "\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd"
1099                        "\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd"
1100                        "\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd"
1101                        "\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd",
1102                .psize  = 50,
1103                .digest = "\x69\x7e\xaf\x0a\xca\x3a\x3a\xea"
1104                          "\x3a\x75\x16\x47\x46\xff\xaa\x79",
1105        }, {
1106                .key    = "\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c",
1107                .ksize  = 16,
1108                .plaintext = "Test With Truncation",
1109                .psize  = 20,
1110                .digest = "\x56\x46\x1e\xf2\x34\x2e\xdc\x00"
1111                          "\xf9\xba\xb9\x95\x69\x0e\xfd\x4c",
1112        }, {
1113                .key    = "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1114                        "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1115                        "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1116                        "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1117                        "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1118                        "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1119                        "\xaa\xaa",
1120                .ksize  = 80,
1121                .plaintext = "Test Using Larger Than Block-Size Key - Hash Key First",
1122                .psize  = 54,
1123                .digest = "\x6b\x1a\xb7\xfe\x4b\xd7\xbf\x8f"
1124                          "\x0b\x62\xe6\xce\x61\xb9\xd0\xcd",
1125        }, {
1126                .key    = "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1127                        "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1128                        "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1129                        "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1130                        "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1131                        "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1132                        "\xaa\xaa",
1133                .ksize  = 80,
1134                .plaintext = "Test Using Larger Than Block-Size Key and Larger Than One "
1135                           "Block-Size Data",
1136                .psize  = 73,
1137                .digest = "\x6f\x63\x0f\xad\x67\xcd\xa0\xee"
1138                          "\x1f\xb1\xf5\x62\xdb\x3a\xa5\x3e",
1139        },
1140};
1141
1142/*
1143 * HMAC-RIPEMD128 test vectors from RFC2286
1144 */
1145#define HMAC_RMD128_TEST_VECTORS        7
1146
1147static struct hash_testvec hmac_rmd128_tv_template[] = {
1148        {
1149                .key    = "\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b",
1150                .ksize  = 16,
1151                .plaintext = "Hi There",
1152                .psize  = 8,
1153                .digest = "\xfb\xf6\x1f\x94\x92\xaa\x4b\xbf"
1154                          "\x81\xc1\x72\xe8\x4e\x07\x34\xdb",
1155        }, {
1156                .key    = "Jefe",
1157                .ksize  = 4,
1158                .plaintext = "what do ya want for nothing?",
1159                .psize  = 28,
1160                .digest = "\x87\x5f\x82\x88\x62\xb6\xb3\x34"
1161                          "\xb4\x27\xc5\x5f\x9f\x7f\xf0\x9b",
1162                .np     = 2,
1163                .tap    = { 14, 14 },
1164        }, {
1165                .key    = "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa",
1166                .ksize  = 16,
1167                .plaintext = "\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd"
1168                        "\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd"
1169                        "\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd"
1170                        "\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd",
1171                .psize  = 50,
1172                .digest = "\x09\xf0\xb2\x84\x6d\x2f\x54\x3d"
1173                          "\xa3\x63\xcb\xec\x8d\x62\xa3\x8d",
1174        }, {
1175                .key    = "\x01\x02\x03\x04\x05\x06\x07\x08"
1176                          "\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10"
1177                          "\x11\x12\x13\x14\x15\x16\x17\x18\x19",
1178                .ksize  = 25,
1179                .plaintext = "\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd"
1180                        "\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd"
1181                        "\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd"
1182                        "\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd",
1183                .psize  = 50,
1184                .digest = "\xbd\xbb\xd7\xcf\x03\xe4\x4b\x5a"
1185                          "\xa6\x0a\xf8\x15\xbe\x4d\x22\x94",
1186        }, {
1187                .key    = "\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c",
1188                .ksize  = 16,
1189                .plaintext = "Test With Truncation",
1190                .psize  = 20,
1191                .digest = "\xe7\x98\x08\xf2\x4b\x25\xfd\x03"
1192                          "\x1c\x15\x5f\x0d\x55\x1d\x9a\x3a",
1193        }, {
1194                .key    = "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1195                        "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1196                        "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1197                        "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1198                        "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1199                        "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1200                        "\xaa\xaa",
1201                .ksize  = 80,
1202                .plaintext = "Test Using Larger Than Block-Size Key - Hash Key First",
1203                .psize  = 54,
1204                .digest = "\xdc\x73\x29\x28\xde\x98\x10\x4a"
1205                          "\x1f\x59\xd3\x73\xc1\x50\xac\xbb",
1206        }, {
1207                .key    = "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1208                        "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1209                        "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1210                        "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1211                        "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1212                        "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1213                        "\xaa\xaa",
1214                .ksize  = 80,
1215                .plaintext = "Test Using Larger Than Block-Size Key and Larger Than One "
1216                           "Block-Size Data",
1217                .psize  = 73,
1218                .digest = "\x5c\x6b\xec\x96\x79\x3e\x16\xd4"
1219                          "\x06\x90\xc2\x37\x63\x5f\x30\xc5",
1220        },
1221};
1222
1223/*
1224 * HMAC-RIPEMD160 test vectors from RFC2286
1225 */
1226#define HMAC_RMD160_TEST_VECTORS        7
1227
1228static struct hash_testvec hmac_rmd160_tv_template[] = {
1229        {
1230                .key    = "\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b",
1231                .ksize  = 20,
1232                .plaintext = "Hi There",
1233                .psize  = 8,
1234                .digest = "\x24\xcb\x4b\xd6\x7d\x20\xfc\x1a\x5d\x2e"
1235                          "\xd7\x73\x2d\xcc\x39\x37\x7f\x0a\x56\x68",
1236        }, {
1237                .key    = "Jefe",
1238                .ksize  = 4,
1239                .plaintext = "what do ya want for nothing?",
1240                .psize  = 28,
1241                .digest = "\xdd\xa6\xc0\x21\x3a\x48\x5a\x9e\x24\xf4"
1242                          "\x74\x20\x64\xa7\xf0\x33\xb4\x3c\x40\x69",
1243                .np     = 2,
1244                .tap    = { 14, 14 },
1245        }, {
1246                .key    = "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa",
1247                .ksize  = 20,
1248                .plaintext = "\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd"
1249                        "\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd"
1250                        "\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd"
1251                        "\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd",
1252                .psize  = 50,
1253                .digest = "\xb0\xb1\x05\x36\x0d\xe7\x59\x96\x0a\xb4"
1254                          "\xf3\x52\x98\xe1\x16\xe2\x95\xd8\xe7\xc1",
1255        }, {
1256                .key    = "\x01\x02\x03\x04\x05\x06\x07\x08"
1257                          "\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10"
1258                          "\x11\x12\x13\x14\x15\x16\x17\x18\x19",
1259                .ksize  = 25,
1260                .plaintext = "\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd"
1261                        "\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd"
1262                        "\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd"
1263                        "\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd",
1264                .psize  = 50,
1265                .digest = "\xd5\xca\x86\x2f\x4d\x21\xd5\xe6\x10\xe1"
1266                          "\x8b\x4c\xf1\xbe\xb9\x7a\x43\x65\xec\xf4",
1267        }, {
1268                .key    = "\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c",
1269                .ksize  = 20,
1270                .plaintext = "Test With Truncation",
1271                .psize  = 20,
1272                .digest = "\x76\x19\x69\x39\x78\xf9\x1d\x90\x53\x9a"
1273                          "\xe7\x86\x50\x0f\xf3\xd8\xe0\x51\x8e\x39",
1274        }, {
1275                .key    = "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1276                        "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1277                        "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1278                        "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1279                        "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1280                        "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1281                        "\xaa\xaa",
1282                .ksize  = 80,
1283                .plaintext = "Test Using Larger Than Block-Size Key - Hash Key First",
1284                .psize  = 54,
1285                .digest = "\x64\x66\xca\x07\xac\x5e\xac\x29\xe1\xbd"
1286                          "\x52\x3e\x5a\xda\x76\x05\xb7\x91\xfd\x8b",
1287        }, {
1288                .key    = "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1289                        "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1290                        "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1291                        "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1292                        "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1293                        "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1294                        "\xaa\xaa",
1295                .ksize  = 80,
1296                .plaintext = "Test Using Larger Than Block-Size Key and Larger Than One "
1297                           "Block-Size Data",
1298                .psize  = 73,
1299                .digest = "\x69\xea\x60\x79\x8d\x71\x61\x6c\xce\x5f"
1300                          "\xd0\x87\x1e\x23\x75\x4c\xd7\x5d\x5a\x0a",
1301        },
1302};
1303
1304/*
1305 * HMAC-SHA1 test vectors from RFC2202
1306 */
1307#define HMAC_SHA1_TEST_VECTORS  7
1308
1309static struct hash_testvec hmac_sha1_tv_template[] = {
1310        {
1311                .key    = "\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b",
1312                .ksize  = 20,
1313                .plaintext = "Hi There",
1314                .psize  = 8,
1315                .digest = "\xb6\x17\x31\x86\x55\x05\x72\x64"
1316                          "\xe2\x8b\xc0\xb6\xfb\x37\x8c\x8e\xf1"
1317                          "\x46\xbe",
1318        }, {
1319                .key    = "Jefe",
1320                .ksize  = 4,
1321                .plaintext = "what do ya want for nothing?",
1322                .psize  = 28,
1323                .digest = "\xef\xfc\xdf\x6a\xe5\xeb\x2f\xa2\xd2\x74"
1324                          "\x16\xd5\xf1\x84\xdf\x9c\x25\x9a\x7c\x79",
1325                .np     = 2,
1326                .tap    = { 14, 14 }
1327        }, {
1328                .key    = "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa",
1329                .ksize  = 20,
1330                .plaintext = "\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd"
1331                        "\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd"
1332                        "\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd"
1333                        "\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd",
1334                .psize  = 50,
1335                .digest = "\x12\x5d\x73\x42\xb9\xac\x11\xcd\x91\xa3"
1336                          "\x9a\xf4\x8a\xa1\x7b\x4f\x63\xf1\x75\xd3",
1337        }, {
1338                .key    = "\x01\x02\x03\x04\x05\x06\x07\x08"
1339                          "\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10"
1340                          "\x11\x12\x13\x14\x15\x16\x17\x18\x19",
1341                .ksize  = 25,
1342                .plaintext = "\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd"
1343                        "\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd"
1344                        "\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd"
1345                        "\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd",
1346                .psize  = 50,
1347                .digest = "\x4c\x90\x07\xf4\x02\x62\x50\xc6\xbc\x84"
1348                          "\x14\xf9\xbf\x50\xc8\x6c\x2d\x72\x35\xda",
1349        }, {
1350                .key    = "\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c",
1351                .ksize  = 20,
1352                .plaintext = "Test With Truncation",
1353                .psize  = 20,
1354                .digest = "\x4c\x1a\x03\x42\x4b\x55\xe0\x7f\xe7\xf2"
1355                          "\x7b\xe1\xd5\x8b\xb9\x32\x4a\x9a\x5a\x04",
1356        }, {
1357                .key    = "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1358                        "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1359                        "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1360                        "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1361                        "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1362                        "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1363                        "\xaa\xaa",
1364                .ksize  = 80,
1365                .plaintext = "Test Using Larger Than Block-Size Key - Hash Key First",
1366                .psize  = 54,
1367                .digest = "\xaa\x4a\xe5\xe1\x52\x72\xd0\x0e\x95\x70"
1368                          "\x56\x37\xce\x8a\x3b\x55\xed\x40\x21\x12",
1369        }, {
1370                .key    = "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1371                        "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1372                        "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1373                        "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1374                        "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1375                        "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1376                        "\xaa\xaa",
1377                .ksize  = 80,
1378                .plaintext = "Test Using Larger Than Block-Size Key and Larger Than One "
1379                           "Block-Size Data",
1380                .psize  = 73,
1381                .digest = "\xe8\xe9\x9d\x0f\x45\x23\x7d\x78\x6d\x6b"
1382                          "\xba\xa7\x96\x5c\x78\x08\xbb\xff\x1a\x91",
1383        },
1384};
1385
1386
1387/*
1388 * SHA224 HMAC test vectors from RFC4231
1389 */
1390#define HMAC_SHA224_TEST_VECTORS    4
1391
1392static struct hash_testvec hmac_sha224_tv_template[] = {
1393        {
1394                .key    = "\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b"
1395                        "\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b"
1396                        "\x0b\x0b\x0b\x0b",
1397                .ksize  = 20,
1398                /*  ("Hi There") */
1399                .plaintext = "\x48\x69\x20\x54\x68\x65\x72\x65",
1400                .psize  = 8,
1401                .digest = "\x89\x6f\xb1\x12\x8a\xbb\xdf\x19"
1402                        "\x68\x32\x10\x7c\xd4\x9d\xf3\x3f"
1403                        "\x47\xb4\xb1\x16\x99\x12\xba\x4f"
1404                        "\x53\x68\x4b\x22",
1405        }, {
1406                .key    = "Jefe",
1407                .ksize  = 4,
1408                /* ("what do ya want for nothing?") */
1409                .plaintext = "\x77\x68\x61\x74\x20\x64\x6f\x20"
1410                        "\x79\x61\x20\x77\x61\x6e\x74\x20"
1411                        "\x66\x6f\x72\x20\x6e\x6f\x74\x68"
1412                        "\x69\x6e\x67\x3f",
1413                .psize  = 28,
1414                .digest = "\xa3\x0e\x01\x09\x8b\xc6\xdb\xbf"
1415                        "\x45\x69\x0f\x3a\x7e\x9e\x6d\x0f"
1416                        "\x8b\xbe\xa2\xa3\x9e\x61\x48\x00"
1417                        "\x8f\xd0\x5e\x44",
1418                .np = 4,
1419                .tap    = { 7, 7, 7, 7 }
1420        }, {
1421                .key    = "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1422                        "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1423                        "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1424                        "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1425                        "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1426                        "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1427                        "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1428                        "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1429                        "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1430                        "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1431                        "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1432                        "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1433                        "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1434                        "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1435                        "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1436                        "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1437                        "\xaa\xaa\xaa",
1438                .ksize  = 131,
1439                /* ("Test Using Larger Than Block-Size Key - Hash Key First") */
1440                .plaintext = "\x54\x65\x73\x74\x20\x55\x73\x69"
1441                        "\x6e\x67\x20\x4c\x61\x72\x67\x65"
1442                        "\x72\x20\x54\x68\x61\x6e\x20\x42"
1443                        "\x6c\x6f\x63\x6b\x2d\x53\x69\x7a"
1444                        "\x65\x20\x4b\x65\x79\x20\x2d\x20"
1445                        "\x48\x61\x73\x68\x20\x4b\x65\x79"
1446                        "\x20\x46\x69\x72\x73\x74",
1447                .psize  = 54,
1448                .digest = "\x95\xe9\xa0\xdb\x96\x20\x95\xad"
1449                        "\xae\xbe\x9b\x2d\x6f\x0d\xbc\xe2"
1450                        "\xd4\x99\xf1\x12\xf2\xd2\xb7\x27"
1451                        "\x3f\xa6\x87\x0e",
1452        }, {
1453                .key    = "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1454                        "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1455                        "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1456                        "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1457                        "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1458                        "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1459                        "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1460                        "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1461                        "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1462                        "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1463                        "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1464                        "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1465                        "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1466                        "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1467                        "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1468                        "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1469                        "\xaa\xaa\xaa",
1470                .ksize  = 131,
1471                /* ("This is a test using a larger than block-size key and a")
1472                (" larger than block-size data. The key needs to be")
1473                        (" hashed before being used by the HMAC algorithm.") */
1474                .plaintext = "\x54\x68\x69\x73\x20\x69\x73\x20"
1475                        "\x61\x20\x74\x65\x73\x74\x20\x75"
1476                        "\x73\x69\x6e\x67\x20\x61\x20\x6c"
1477                        "\x61\x72\x67\x65\x72\x20\x74\x68"
1478                        "\x61\x6e\x20\x62\x6c\x6f\x63\x6b"
1479                        "\x2d\x73\x69\x7a\x65\x20\x6b\x65"
1480                        "\x79\x20\x61\x6e\x64\x20\x61\x20"
1481                        "\x6c\x61\x72\x67\x65\x72\x20\x74"
1482                        "\x68\x61\x6e\x20\x62\x6c\x6f\x63"
1483                        "\x6b\x2d\x73\x69\x7a\x65\x20\x64"
1484                        "\x61\x74\x61\x2e\x20\x54\x68\x65"
1485                        "\x20\x6b\x65\x79\x20\x6e\x65\x65"
1486                        "\x64\x73\x20\x74\x6f\x20\x62\x65"
1487                        "\x20\x68\x61\x73\x68\x65\x64\x20"
1488                        "\x62\x65\x66\x6f\x72\x65\x20\x62"
1489                        "\x65\x69\x6e\x67\x20\x75\x73\x65"
1490                        "\x64\x20\x62\x79\x20\x74\x68\x65"
1491                        "\x20\x48\x4d\x41\x43\x20\x61\x6c"
1492                        "\x67\x6f\x72\x69\x74\x68\x6d\x2e",
1493                .psize  = 152,
1494                .digest = "\x3a\x85\x41\x66\xac\x5d\x9f\x02"
1495                        "\x3f\x54\xd5\x17\xd0\xb3\x9d\xbd"
1496                        "\x94\x67\x70\xdb\x9c\x2b\x95\xc9"
1497                        "\xf6\xf5\x65\xd1",
1498        },
1499};
1500
1501/*
1502 * HMAC-SHA256 test vectors from
1503 * draft-ietf-ipsec-ciph-sha-256-01.txt
1504 */
1505#define HMAC_SHA256_TEST_VECTORS        10
1506
1507static struct hash_testvec hmac_sha256_tv_template[] = {
1508        {
1509                .key    = "\x01\x02\x03\x04\x05\x06\x07\x08"
1510                          "\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10"
1511                          "\x11\x12\x13\x14\x15\x16\x17\x18"
1512                          "\x19\x1a\x1b\x1c\x1d\x1e\x1f\x20",
1513                .ksize  = 32,
1514                .plaintext = "abc",
1515                .psize  = 3,
1516                .digest = "\xa2\x1b\x1f\x5d\x4c\xf4\xf7\x3a"
1517                          "\x4d\xd9\x39\x75\x0f\x7a\x06\x6a"
1518                          "\x7f\x98\xcc\x13\x1c\xb1\x6a\x66"
1519                          "\x92\x75\x90\x21\xcf\xab\x81\x81",
1520        }, {
1521                .key    = "\x01\x02\x03\x04\x05\x06\x07\x08"
1522                          "\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10"
1523                          "\x11\x12\x13\x14\x15\x16\x17\x18"
1524                          "\x19\x1a\x1b\x1c\x1d\x1e\x1f\x20",
1525                .ksize  = 32,
1526                .plaintext = "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq",
1527                .psize  = 56,
1528                .digest = "\x10\x4f\xdc\x12\x57\x32\x8f\x08"
1529                          "\x18\x4b\xa7\x31\x31\xc5\x3c\xae"
1530                          "\xe6\x98\xe3\x61\x19\x42\x11\x49"
1531                          "\xea\x8c\x71\x24\x56\x69\x7d\x30",
1532        }, {
1533                .key    = "\x01\x02\x03\x04\x05\x06\x07\x08"
1534                          "\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10"
1535                          "\x11\x12\x13\x14\x15\x16\x17\x18"
1536                          "\x19\x1a\x1b\x1c\x1d\x1e\x1f\x20",
1537                .ksize  = 32,
1538                .plaintext = "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq"
1539                           "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq",
1540                .psize  = 112,
1541                .digest = "\x47\x03\x05\xfc\x7e\x40\xfe\x34"
1542                          "\xd3\xee\xb3\xe7\x73\xd9\x5a\xab"
1543                          "\x73\xac\xf0\xfd\x06\x04\x47\xa5"
1544                          "\xeb\x45\x95\xbf\x33\xa9\xd1\xa3",
1545        }, {
1546                .key    = "\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b"
1547                        "\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b"
1548                        "\x0b\x0b\x0b\x0b\x0b\x0b",
1549                .ksize  = 32,
1550                .plaintext = "Hi There",
1551                .psize  = 8,
1552                .digest = "\x19\x8a\x60\x7e\xb4\x4b\xfb\xc6"
1553                          "\x99\x03\xa0\xf1\xcf\x2b\xbd\xc5"
1554                          "\xba\x0a\xa3\xf3\xd9\xae\x3c\x1c"
1555                          "\x7a\x3b\x16\x96\xa0\xb6\x8c\xf7",
1556        }, {
1557                .key    = "Jefe",
1558                .ksize  = 4,
1559                .plaintext = "what do ya want for nothing?",
1560                .psize  = 28,
1561                .digest = "\x5b\xdc\xc1\x46\xbf\x60\x75\x4e"
1562                          "\x6a\x04\x24\x26\x08\x95\x75\xc7"
1563                          "\x5a\x00\x3f\x08\x9d\x27\x39\x83"
1564                          "\x9d\xec\x58\xb9\x64\xec\x38\x43",
1565                .np     = 2,
1566                .tap    = { 14, 14 }
1567        }, {
1568                .key    = "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1569                        "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1570                        "\xaa\xaa\xaa\xaa\xaa\xaa\xaa",
1571                .ksize  = 32,
1572                .plaintext = "\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd"
1573                        "\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd"
1574                        "\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd"
1575                        "\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd",
1576                .psize  = 50,
1577                .digest = "\xcd\xcb\x12\x20\xd1\xec\xcc\xea"
1578                          "\x91\xe5\x3a\xba\x30\x92\xf9\x62"
1579                          "\xe5\x49\xfe\x6c\xe9\xed\x7f\xdc"
1580                          "\x43\x19\x1f\xbd\xe4\x5c\x30\xb0",
1581        }, {
1582                .key    = "\x01\x02\x03\x04\x05\x06\x07\x08"
1583                          "\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10"
1584                          "\x11\x12\x13\x14\x15\x16\x17\x18"
1585                          "\x19\x1a\x1b\x1c\x1d\x1e\x1f\x20"
1586                          "\x21\x22\x23\x24\x25",
1587                .ksize  = 37,
1588                .plaintext = "\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd"
1589                        "\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd"
1590                        "\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd"
1591                        "\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd",
1592                .psize  = 50,
1593                .digest = "\xd4\x63\x3c\x17\xf6\xfb\x8d\x74"
1594                          "\x4c\x66\xde\xe0\xf8\xf0\x74\x55"
1595                          "\x6e\xc4\xaf\x55\xef\x07\x99\x85"
1596                          "\x41\x46\x8e\xb4\x9b\xd2\xe9\x17",
1597        }, {
1598                .key    = "\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c"
1599                        "\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c"
1600                        "\x0c\x0c\x0c\x0c\x0c\x0c",
1601                .ksize  = 32,
1602                .plaintext = "Test With Truncation",
1603                .psize  = 20,
1604                .digest = "\x75\x46\xaf\x01\x84\x1f\xc0\x9b"
1605                          "\x1a\xb9\xc3\x74\x9a\x5f\x1c\x17"
1606                          "\xd4\xf5\x89\x66\x8a\x58\x7b\x27"
1607                          "\x00\xa9\xc9\x7c\x11\x93\xcf\x42",
1608        }, {
1609                .key    = "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1610                        "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1611                        "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1612                        "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1613                        "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1614                        "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1615                        "\xaa\xaa",
1616                .ksize  = 80,
1617                .plaintext = "Test Using Larger Than Block-Size Key - Hash Key First",
1618                .psize  = 54,
1619                .digest = "\x69\x53\x02\x5e\xd9\x6f\x0c\x09"
1620                          "\xf8\x0a\x96\xf7\x8e\x65\x38\xdb"
1621                          "\xe2\xe7\xb8\x20\xe3\xdd\x97\x0e"
1622                          "\x7d\xdd\x39\x09\x1b\x32\x35\x2f",
1623        }, {
1624                .key    = "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1625                        "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1626                        "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1627                        "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1628                        "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1629                        "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1630                        "\xaa\xaa",
1631                .ksize  = 80,
1632                .plaintext = "Test Using Larger Than Block-Size Key and Larger Than "
1633                           "One Block-Size Data",
1634                .psize  = 73,
1635                .digest = "\x63\x55\xac\x22\xe8\x90\xd0\xa3"
1636                          "\xc8\x48\x1a\x5c\xa4\x82\x5b\xc8"
1637                          "\x84\xd3\xe7\xa1\xff\x98\xa2\xfc"
1638                          "\x2a\xc7\xd8\xe0\x64\xc3\xb2\xe6",
1639        },
1640};
1641
1642#define XCBC_AES_TEST_VECTORS 6
1643
1644static struct hash_testvec aes_xcbc128_tv_template[] = {
1645        {
1646                .key    = "\x00\x01\x02\x03\x04\x05\x06\x07"
1647                          "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f",
1648                .plaintext = zeroed_string,
1649                .digest = "\x75\xf0\x25\x1d\x52\x8a\xc0\x1c"
1650                          "\x45\x73\xdf\xd5\x84\xd7\x9f\x29",
1651                .psize  = 0,
1652                .ksize  = 16,
1653        }, {
1654                .key    = "\x00\x01\x02\x03\x04\x05\x06\x07"
1655                          "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f",
1656                .plaintext = "\x00\x01\x02",
1657                .digest = "\x5b\x37\x65\x80\xae\x2f\x19\xaf"
1658                          "\xe7\x21\x9c\xee\xf1\x72\x75\x6f",
1659                .psize  = 3,
1660                .ksize  = 16,
1661        } , {
1662                .key    = "\x00\x01\x02\x03\x04\x05\x06\x07"
1663                          "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f",
1664                .plaintext = "\x00\x01\x02\x03\x04\x05\x06\x07"
1665                             "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f",
1666                .digest = "\xd2\xa2\x46\xfa\x34\x9b\x68\xa7"
1667                          "\x99\x98\xa4\x39\x4f\xf7\xa2\x63",
1668                .psize  = 16,
1669                .ksize  = 16,
1670        }, {
1671                .key    = "\x00\x01\x02\x03\x04\x05\x06\x07"
1672                          "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f",
1673                .plaintext = "\x00\x01\x02\x03\x04\x05\x06\x07"
1674                             "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f"
1675                             "\x10\x11\x12\x13",
1676                .digest = "\x47\xf5\x1b\x45\x64\x96\x62\x15"
1677                          "\xb8\x98\x5c\x63\x05\x5e\xd3\x08",
1678                .tap    = { 10, 10 },
1679                .psize  = 20,
1680                .np     = 2,
1681                .ksize  = 16,
1682        }, {
1683                .key    = "\x00\x01\x02\x03\x04\x05\x06\x07"
1684                          "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f",
1685                .plaintext = "\x00\x01\x02\x03\x04\x05\x06\x07"
1686                             "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f"
1687                             "\x10\x11\x12\x13\x14\x15\x16\x17"
1688                             "\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f",
1689                .digest = "\xf5\x4f\x0e\xc8\xd2\xb9\xf3\xd3"
1690                          "\x68\x07\x73\x4b\xd5\x28\x3f\xd4",
1691                .psize  = 32,
1692                .ksize  = 16,
1693        }, {
1694                .key    = "\x00\x01\x02\x03\x04\x05\x06\x07"
1695                          "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f",
1696                .plaintext = "\x00\x01\x02\x03\x04\x05\x06\x07"
1697                             "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f"
1698                             "\x10\x11\x12\x13\x14\x15\x16\x17"
1699                             "\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f"
1700                             "\x20\x21",
1701                .digest = "\xbe\xcb\xb3\xbc\xcd\xb5\x18\xa3"
1702                          "\x06\x77\xd5\x48\x1f\xb6\xb4\xd8",
1703                .tap    = { 17, 17 },
1704                .psize  = 34,
1705                .np     = 2,
1706                .ksize  = 16,
1707        }
1708};
1709
1710#define VMAC_AES_TEST_VECTORS   8
1711static char vmac_string1[128] = {'\x01', '\x01', '\x01', '\x01',
1712                                '\x02', '\x03', '\x02', '\x02',
1713                                '\x02', '\x04', '\x01', '\x07',
1714                                '\x04', '\x01', '\x04', '\x03',};
1715static char vmac_string2[128] = {'a', 'b', 'c',};
1716static char vmac_string3[128] = {'a', 'b', 'c', 'a', 'b', 'c',
1717                                'a', 'b', 'c', 'a', 'b', 'c',
1718                                'a', 'b', 'c', 'a', 'b', 'c',
1719                                'a', 'b', 'c', 'a', 'b', 'c',
1720                                'a', 'b', 'c', 'a', 'b', 'c',
1721                                'a', 'b', 'c', 'a', 'b', 'c',
1722                                'a', 'b', 'c', 'a', 'b', 'c',
1723                                'a', 'b', 'c', 'a', 'b', 'c',
1724                                };
1725
1726static struct hash_testvec aes_vmac128_tv_template[] = {
1727        {
1728                .key    = "\x00\x01\x02\x03\x04\x05\x06\x07"
1729                          "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f",
1730                .plaintext = NULL,
1731                .digest = "\x07\x58\x80\x35\x77\xa4\x7b\x54",
1732                .psize  = 0,
1733                .ksize  = 16,
1734        }, {
1735                .key    = "\x00\x01\x02\x03\x04\x05\x06\x07"
1736                          "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f",
1737                .plaintext = vmac_string1,
1738                .digest = "\xce\xf5\x3c\xd3\xae\x68\x8c\xa1",
1739                .psize  = 128,
1740                .ksize  = 16,
1741        }, {
1742                .key    = "\x00\x01\x02\x03\x04\x05\x06\x07"
1743                          "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f",
1744                .plaintext = vmac_string2,
1745                .digest = "\xc9\x27\xb0\x73\x81\xbd\x14\x2d",
1746                .psize  = 128,
1747                .ksize  = 16,
1748        }, {
1749                .key    = "\x00\x01\x02\x03\x04\x05\x06\x07"
1750                          "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f",
1751                .plaintext = vmac_string3,
1752                .digest = "\x8d\x1a\x95\x8c\x98\x47\x0b\x19",
1753                .psize  = 128,
1754                .ksize  = 16,
1755        }, {
1756                .key    = "abcdefghijklmnop",
1757                .plaintext = NULL,
1758                .digest = "\x3b\x89\xa1\x26\x9e\x55\x8f\x84",
1759                .psize  = 0,
1760                .ksize  = 16,
1761        }, {
1762                .key    = "abcdefghijklmnop",
1763                .plaintext = vmac_string1,
1764                .digest = "\xab\x5e\xab\xb0\xf6\x8d\x74\xc2",
1765                .psize  = 128,
1766                .ksize  = 16,
1767        }, {
1768                .key    = "abcdefghijklmnop",
1769                .plaintext = vmac_string2,
1770                .digest = "\x11\x15\x68\x42\x3d\x7b\x09\xdf",
1771                .psize  = 128,
1772                .ksize  = 16,
1773        }, {
1774                .key    = "abcdefghijklmnop",
1775                .plaintext = vmac_string3,
1776                .digest = "\x8b\x32\x8f\xe1\xed\x8f\xfa\xd4",
1777                .psize  = 128,
1778                .ksize  = 16,
1779        },
1780};
1781
1782/*
1783 * SHA384 HMAC test vectors from RFC4231
1784 */
1785
1786#define HMAC_SHA384_TEST_VECTORS        4
1787
1788static struct hash_testvec hmac_sha384_tv_template[] = {
1789        {
1790                .key    = "\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b"
1791                          "\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b"
1792                          "\x0b\x0b\x0b\x0b",
1793                .ksize  = 20,
1794                .plaintext = "Hi There",
1795                .psize  = 8,
1796                .digest = "\xaf\xd0\x39\x44\xd8\x48\x95\x62"
1797                          "\x6b\x08\x25\xf4\xab\x46\x90\x7f"
1798                          "\x15\xf9\xda\xdb\xe4\x10\x1e\xc6"
1799                          "\x82\xaa\x03\x4c\x7c\xeb\xc5\x9c"
1800                          "\xfa\xea\x9e\xa9\x07\x6e\xde\x7f"
1801                          "\x4a\xf1\x52\xe8\xb2\xfa\x9c\xb6",
1802        }, {
1803                .key    = "Jefe",
1804                .ksize  = 4,
1805                .plaintext = "what do ya want for nothing?",
1806                .psize  = 28,
1807                .digest = "\xaf\x45\xd2\xe3\x76\x48\x40\x31"
1808                          "\x61\x7f\x78\xd2\xb5\x8a\x6b\x1b"
1809                          "\x9c\x7e\xf4\x64\xf5\xa0\x1b\x47"
1810                          "\xe4\x2e\xc3\x73\x63\x22\x44\x5e"
1811                          "\x8e\x22\x40\xca\x5e\x69\xe2\xc7"
1812                          "\x8b\x32\x39\xec\xfa\xb2\x16\x49",
1813                .np     = 4,
1814                .tap    = { 7, 7, 7, 7 }
1815        }, {
1816                .key    = "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1817                          "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1818                          "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1819                          "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1820                          "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1821                          "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1822                          "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1823                          "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1824                          "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1825                          "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1826                          "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1827                          "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1828                          "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1829                          "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1830                          "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1831                          "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1832                          "\xaa\xaa\xaa",
1833                .ksize  = 131,
1834                .plaintext = "Test Using Larger Than Block-Siz"
1835                           "e Key - Hash Key First",
1836                .psize  = 54,
1837                .digest = "\x4e\xce\x08\x44\x85\x81\x3e\x90"
1838                          "\x88\xd2\xc6\x3a\x04\x1b\xc5\xb4"
1839                          "\x4f\x9e\xf1\x01\x2a\x2b\x58\x8f"
1840                          "\x3c\xd1\x1f\x05\x03\x3a\xc4\xc6"
1841                          "\x0c\x2e\xf6\xab\x40\x30\xfe\x82"
1842                          "\x96\x24\x8d\xf1\x63\xf4\x49\x52",
1843        }, {
1844                .key    = "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1845                          "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1846                          "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1847                          "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1848                          "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1849                          "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1850                          "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1851                          "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1852                          "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1853                          "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1854                          "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1855                          "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1856                          "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1857                          "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1858                          "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1859                          "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1860                          "\xaa\xaa\xaa",
1861                .ksize  = 131,
1862                .plaintext = "This is a test u"
1863                           "sing a larger th"
1864                           "an block-size ke"
1865                           "y and a larger t"
1866                           "han block-size d"
1867                           "ata. The key nee"
1868                           "ds to be hashed "
1869                           "before being use"
1870                           "d by the HMAC al"
1871                           "gorithm.",
1872                .psize  = 152,
1873                .digest = "\x66\x17\x17\x8e\x94\x1f\x02\x0d"
1874                          "\x35\x1e\x2f\x25\x4e\x8f\xd3\x2c"
1875                          "\x60\x24\x20\xfe\xb0\xb8\xfb\x9a"
1876                          "\xdc\xce\xbb\x82\x46\x1e\x99\xc5"
1877                          "\xa6\x78\xcc\x31\xe7\x99\x17\x6d"
1878                          "\x38\x60\xe6\x11\x0c\x46\x52\x3e",
1879        },
1880};
1881
1882/*
1883 * SHA512 HMAC test vectors from RFC4231
1884 */
1885
1886#define HMAC_SHA512_TEST_VECTORS        4
1887
1888static struct hash_testvec hmac_sha512_tv_template[] = {
1889        {
1890                .key    = "\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b"
1891                          "\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b"
1892                          "\x0b\x0b\x0b\x0b",
1893                .ksize  = 20,
1894                .plaintext = "Hi There",
1895                .psize  = 8,
1896                .digest = "\x87\xaa\x7c\xde\xa5\xef\x61\x9d"
1897                          "\x4f\xf0\xb4\x24\x1a\x1d\x6c\xb0"
1898                          "\x23\x79\xf4\xe2\xce\x4e\xc2\x78"
1899                          "\x7a\xd0\xb3\x05\x45\xe1\x7c\xde"
1900                          "\xda\xa8\x33\xb7\xd6\xb8\xa7\x02"
1901                          "\x03\x8b\x27\x4e\xae\xa3\xf4\xe4"
1902                          "\xbe\x9d\x91\x4e\xeb\x61\xf1\x70"
1903                          "\x2e\x69\x6c\x20\x3a\x12\x68\x54",
1904        }, {
1905                .key    = "Jefe",
1906                .ksize  = 4,
1907                .plaintext = "what do ya want for nothing?",
1908                .psize  = 28,
1909                .digest = "\x16\x4b\x7a\x7b\xfc\xf8\x19\xe2"
1910                          "\xe3\x95\xfb\xe7\x3b\x56\xe0\xa3"
1911                          "\x87\xbd\x64\x22\x2e\x83\x1f\xd6"
1912                          "\x10\x27\x0c\xd7\xea\x25\x05\x54"
1913                          "\x97\x58\xbf\x75\xc0\x5a\x99\x4a"
1914                          "\x6d\x03\x4f\x65\xf8\xf0\xe6\xfd"
1915                          "\xca\xea\xb1\xa3\x4d\x4a\x6b\x4b"
1916                          "\x63\x6e\x07\x0a\x38\xbc\xe7\x37",
1917                .np     = 4,
1918                .tap    = { 7, 7, 7, 7 }
1919        }, {
1920                .key    = "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1921                          "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1922                          "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1923                          "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1924                          "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1925                          "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1926                          "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1927                          "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1928                          "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1929                          "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1930                          "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1931                          "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1932                          "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1933                          "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1934                          "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1935                          "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1936                          "\xaa\xaa\xaa",
1937                .ksize  = 131,
1938                .plaintext = "Test Using Large"
1939                           "r Than Block-Siz"
1940                           "e Key - Hash Key"
1941                           " First",
1942                .psize  = 54,
1943                .digest = "\x80\xb2\x42\x63\xc7\xc1\xa3\xeb"
1944                        "\xb7\x14\x93\xc1\xdd\x7b\xe8\xb4"
1945                        "\x9b\x46\xd1\xf4\x1b\x4a\xee\xc1"
1946                        "\x12\x1b\x01\x37\x83\xf8\xf3\x52"
1947                        "\x6b\x56\xd0\x37\xe0\x5f\x25\x98"
1948                        "\xbd\x0f\xd2\x21\x5d\x6a\x1e\x52"
1949                        "\x95\xe6\x4f\x73\xf6\x3f\x0a\xec"
1950                        "\x8b\x91\x5a\x98\x5d\x78\x65\x98",
1951        }, {
1952                .key    = "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1953                        "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1954                        "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1955                        "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1956                        "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1957                        "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1958                        "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1959                        "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1960                        "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1961                        "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1962                        "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1963                        "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1964                        "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1965                        "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1966                        "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1967                        "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1968                        "\xaa\xaa\xaa",
1969                .ksize  = 131,
1970                .plaintext =
1971                          "This is a test u"
1972                          "sing a larger th"
1973                          "an block-size ke"
1974                          "y and a larger t"
1975                          "han block-size d"
1976                          "ata. The key nee"
1977                          "ds to be hashed "
1978                          "before being use"
1979                          "d by the HMAC al"
1980                          "gorithm.",
1981                .psize  = 152,
1982                .digest = "\xe3\x7b\x6a\x77\x5d\xc8\x7d\xba"
1983                        "\xa4\xdf\xa9\xf9\x6e\x5e\x3f\xfd"
1984                        "\xde\xbd\x71\xf8\x86\x72\x89\x86"
1985                        "\x5d\xf5\xa3\x2d\x20\xcd\xc9\x44"
1986                        "\xb6\x02\x2c\xac\x3c\x49\x82\xb1"
1987                        "\x0d\x5e\xeb\x55\xc3\xe4\xde\x15"
1988                        "\x13\x46\x76\xfb\x6d\xe0\x44\x60"
1989                        "\x65\xc9\x74\x40\xfa\x8c\x6a\x58",
1990        },
1991};
1992
1993/*
1994 * DES test vectors.
1995 */
1996#define DES_ENC_TEST_VECTORS            10
1997#define DES_DEC_TEST_VECTORS            4
1998#define DES_CBC_ENC_TEST_VECTORS        5
1999#define DES_CBC_DEC_TEST_VECTORS        4
2000#define DES3_EDE_ENC_TEST_VECTORS       3
2001#define DES3_EDE_DEC_TEST_VECTORS       3
2002#define DES3_EDE_CBC_ENC_TEST_VECTORS   1
2003#define DES3_EDE_CBC_DEC_TEST_VECTORS   1
2004
2005static struct cipher_testvec des_enc_tv_template[] = {
2006        { /* From Applied Cryptography */
2007                .key    = "\x01\x23\x45\x67\x89\xab\xcd\xef",
2008                .klen   = 8,
2009                .input  = "\x01\x23\x45\x67\x89\xab\xcd\xe7",
2010                .ilen   = 8,
2011                .result = "\xc9\x57\x44\x25\x6a\x5e\xd3\x1d",
2012                .rlen   = 8,
2013        }, { /* Same key, different plaintext block */
2014                .key    = "\x01\x23\x45\x67\x89\xab\xcd\xef",
2015                .klen   = 8,
2016                .input  = "\x22\x33\x44\x55\x66\x77\x88\x99",
2017                .ilen   = 8,
2018                .result = "\xf7\x9c\x89\x2a\x33\x8f\x4a\x8b",
2019                .rlen   = 8,
2020        }, { /* Sbox test from NBS */
2021                .key    = "\x7c\xa1\x10\x45\x4a\x1a\x6e\x57",
2022                .klen   = 8,
2023                .input  = "\x01\xa1\xd6\xd0\x39\x77\x67\x42",
2024                .ilen   = 8,
2025                .result = "\x69\x0f\x5b\x0d\x9a\x26\x93\x9b",
2026                .rlen   = 8,
2027        }, { /* Three blocks */
2028                .key    = "\x01\x23\x45\x67\x89\xab\xcd\xef",
2029                .klen   = 8,
2030                .input  = "\x01\x23\x45\x67\x89\xab\xcd\xe7"
2031                          "\x22\x33\x44\x55\x66\x77\x88\x99"
2032                          "\xca\xfe\xba\xbe\xfe\xed\xbe\xef",
2033                .ilen   = 24,
2034                .result = "\xc9\x57\x44\x25\x6a\x5e\xd3\x1d"
2035                          "\xf7\x9c\x89\x2a\x33\x8f\x4a\x8b"
2036                          "\xb4\x99\x26\xf7\x1f\xe1\xd4\x90",
2037                .rlen   = 24,
2038        }, { /* Weak key */
2039                .fail   = 1,
2040                .wk     = 1,
2041                .key    = "\x01\x01\x01\x01\x01\x01\x01\x01",
2042                .klen   = 8,
2043                .input  = "\x01\x23\x45\x67\x89\xab\xcd\xe7",
2044                .ilen   = 8,
2045                .result = "\xc9\x57\x44\x25\x6a\x5e\xd3\x1d",
2046                .rlen   = 8,
2047        }, { /* Two blocks -- for testing encryption across pages */
2048                .key    = "\x01\x23\x45\x67\x89\xab\xcd\xef",
2049                .klen   = 8,
2050                .input  = "\x01\x23\x45\x67\x89\xab\xcd\xe7"
2051                          "\x22\x33\x44\x55\x66\x77\x88\x99",
2052                .ilen   = 16,
2053                .result = "\xc9\x57\x44\x25\x6a\x5e\xd3\x1d"
2054                          "\xf7\x9c\x89\x2a\x33\x8f\x4a\x8b",
2055                .rlen   = 16,
2056                .np     = 2,
2057                .tap    = { 8, 8 }
2058        }, { /* Four blocks -- for testing encryption with chunking */
2059                .key    = "\x01\x23\x45\x67\x89\xab\xcd\xef",
2060                .klen   = 8,
2061                .input  = "\x01\x23\x45\x67\x89\xab\xcd\xe7"
2062                          "\x22\x33\x44\x55\x66\x77\x88\x99"
2063                          "\xca\xfe\xba\xbe\xfe\xed\xbe\xef"
2064                          "\x22\x33\x44\x55\x66\x77\x88\x99",
2065                .ilen   = 32,
2066                .result = "\xc9\x57\x44\x25\x6a\x5e\xd3\x1d"
2067                          "\xf7\x9c\x89\x2a\x33\x8f\x4a\x8b"
2068                          "\xb4\x99\x26\xf7\x1f\xe1\xd4\x90"
2069                          "\xf7\x9c\x89\x2a\x33\x8f\x4a\x8b",
2070                .rlen   = 32,
2071                .np     = 3,
2072                .tap    = { 14, 10, 8 }
2073        }, {
2074                .key    = "\x01\x23\x45\x67\x89\xab\xcd\xef",
2075                .klen   = 8,
2076                .input  = "\x01\x23\x45\x67\x89\xab\xcd\xe7"
2077                          "\x22\x33\x44\x55\x66\x77\x88\x99"
2078                          "\xca\xfe\xba\xbe\xfe\xed\xbe\xef",
2079                .ilen   = 24,
2080                .result = "\xc9\x57\x44\x25\x6a\x5e\xd3\x1d"
2081                          "\xf7\x9c\x89\x2a\x33\x8f\x4a\x8b"
2082                          "\xb4\x99\x26\xf7\x1f\xe1\xd4\x90",
2083                .rlen   = 24,
2084                .np     = 4,
2085                .tap    = { 2, 1, 3, 18 }
2086        }, {
2087                .key    = "\x01\x23\x45\x67\x89\xab\xcd\xef",
2088                .klen   = 8,
2089                .input  = "\x01\x23\x45\x67\x89\xab\xcd\xe7"
2090                          "\x22\x33\x44\x55\x66\x77\x88\x99",
2091                .ilen   = 16,
2092                .result = "\xc9\x57\x44\x25\x6a\x5e\xd3\x1d"
2093                          "\xf7\x9c\x89\x2a\x33\x8f\x4a\x8b",
2094                .rlen   = 16,
2095                .np     = 5,
2096                .tap    = { 2, 2, 2, 2, 8 }
2097        }, {
2098                .key    = "\x01\x23\x45\x67\x89\xab\xcd\xef",
2099                .klen   = 8,
2100                .input  = "\x01\x23\x45\x67\x89\xab\xcd\xe7",
2101                .ilen   = 8,
2102                .result = "\xc9\x57\x44\x25\x6a\x5e\xd3\x1d",
2103                .rlen   = 8,
2104                .np     = 8,
2105                .tap    = { 1, 1, 1, 1, 1, 1, 1, 1 }
2106        },
2107};
2108
2109static struct cipher_testvec des_dec_tv_template[] = {
2110        { /* From Applied Cryptography */
2111                .key    = "\x01\x23\x45\x67\x89\xab\xcd\xef",
2112                .klen   = 8,
2113                .input  = "\xc9\x57\x44\x25\x6a\x5e\xd3\x1d",
2114                .ilen   = 8,
2115                .result = "\x01\x23\x45\x67\x89\xab\xcd\xe7",
2116                .rlen   = 8,
2117        }, { /* Sbox test from NBS */
2118                .key    = "\x7c\xa1\x10\x45\x4a\x1a\x6e\x57",
2119                .klen   = 8,
2120                .input  = "\x69\x0f\x5b\x0d\x9a\x26\x93\x9b",
2121                .ilen   = 8,
2122                .result = "\x01\xa1\xd6\xd0\x39\x77\x67\x42",
2123                .rlen   = 8,
2124        }, { /* Two blocks, for chunking test */
2125                .key    = "\x01\x23\x45\x67\x89\xab\xcd\xef",
2126                .klen   = 8,
2127                .input  = "\xc9\x57\x44\x25\x6a\x5e\xd3\x1d"
2128                          "\x69\x0f\x5b\x0d\x9a\x26\x93\x9b",
2129                .ilen   = 16,
2130                .result = "\x01\x23\x45\x67\x89\xab\xcd\xe7"
2131                          "\xa3\x99\x7b\xca\xaf\x69\xa0\xf5",
2132                .rlen   = 16,
2133                .np     = 2,
2134                .tap    = { 8, 8 }
2135        }, {
2136                .key    = "\x01\x23\x45\x67\x89\xab\xcd\xef",
2137                .klen   = 8,
2138                .input  = "\xc9\x57\x44\x25\x6a\x5e\xd3\x1d"
2139                          "\x69\x0f\x5b\x0d\x9a\x26\x93\x9b",
2140                .ilen   = 16,
2141                .result = "\x01\x23\x45\x67\x89\xab\xcd\xe7"
2142                          "\xa3\x99\x7b\xca\xaf\x69\xa0\xf5",
2143                .rlen   = 16,
2144                .np     = 3,
2145                .tap    = { 3, 12, 1 }
2146        },
2147};
2148
2149static struct cipher_testvec des_cbc_enc_tv_template[] = {
2150        { /* From OpenSSL */
2151                .key    = "\x01\x23\x45\x67\x89\xab\xcd\xef",
2152                .klen   = 8,
2153                .iv     = "\xfe\xdc\xba\x98\x76\x54\x32\x10",
2154                .input  = "\x37\x36\x35\x34\x33\x32\x31\x20"
2155                          "\x4e\x6f\x77\x20\x69\x73\x20\x74"
2156                          "\x68\x65\x20\x74\x69\x6d\x65\x20",
2157                .ilen   = 24,
2158                .result = "\xcc\xd1\x73\xff\xab\x20\x39\xf4"
2159                          "\xac\xd8\xae\xfd\xdf\xd8\xa1\xeb"
2160                          "\x46\x8e\x91\x15\x78\x88\xba\x68",
2161                .rlen   = 24,
2162        }, { /* FIPS Pub 81 */
2163                .key    = "\x01\x23\x45\x67\x89\xab\xcd\xef",
2164                .klen   = 8,
2165                .iv     = "\x12\x34\x56\x78\x90\xab\xcd\xef",
2166                .input  = "\x4e\x6f\x77\x20\x69\x73\x20\x74",
2167                .ilen   = 8,
2168                .result = "\xe5\xc7\xcd\xde\x87\x2b\xf2\x7c",
2169                .rlen   = 8,
2170        }, {
2171                .key    = "\x01\x23\x45\x67\x89\xab\xcd\xef",
2172                .klen   = 8,
2173                .iv     = "\xe5\xc7\xcd\xde\x87\x2b\xf2\x7c",
2174                .input  = "\x68\x65\x20\x74\x69\x6d\x65\x20",
2175                .ilen   = 8,
2176                .result = "\x43\xe9\x34\x00\x8c\x38\x9c\x0f",
2177                .rlen   = 8,
2178        }, {
2179                .key    = "\x01\x23\x45\x67\x89\xab\xcd\xef",
2180                .klen   = 8,
2181                .iv     = "\x43\xe9\x34\x00\x8c\x38\x9c\x0f",
2182                .input  = "\x66\x6f\x72\x20\x61\x6c\x6c\x20",
2183                .ilen   = 8,
2184                .result = "\x68\x37\x88\x49\x9a\x7c\x05\xf6",
2185                .rlen   = 8,
2186        }, { /* Copy of openssl vector for chunk testing */
2187             /* From OpenSSL */
2188                .key    = "\x01\x23\x45\x67\x89\xab\xcd\xef",
2189                .klen   = 8,
2190                .iv     = "\xfe\xdc\xba\x98\x76\x54\x32\x10",
2191                .input  = "\x37\x36\x35\x34\x33\x32\x31\x20"
2192                          "\x4e\x6f\x77\x20\x69\x73\x20\x74"
2193                          "\x68\x65\x20\x74\x69\x6d\x65\x20",
2194                .ilen   = 24,
2195                .result = "\xcc\xd1\x73\xff\xab\x20\x39\xf4"
2196                          "\xac\xd8\xae\xfd\xdf\xd8\xa1\xeb"
2197                          "\x46\x8e\x91\x15\x78\x88\xba\x68",
2198                .rlen   = 24,
2199                .np     = 2,
2200                .tap    = { 13, 11 }
2201        },
2202};
2203
2204static struct cipher_testvec des_cbc_dec_tv_template[] = {
2205        { /* FIPS Pub 81 */
2206                .key    = "\x01\x23\x45\x67\x89\xab\xcd\xef",
2207                .klen   = 8,
2208                .iv     = "\x12\x34\x56\x78\x90\xab\xcd\xef",
2209                .input  = "\xe5\xc7\xcd\xde\x87\x2b\xf2\x7c",
2210                .ilen   = 8,
2211                .result = "\x4e\x6f\x77\x20\x69\x73\x20\x74",
2212                .rlen   = 8,
2213        }, {
2214                .key    = "\x01\x23\x45\x67\x89\xab\xcd\xef",
2215                .klen   = 8,
2216                .iv     = "\xe5\xc7\xcd\xde\x87\x2b\xf2\x7c",
2217                .input  = "\x43\xe9\x34\x00\x8c\x38\x9c\x0f",
2218                .ilen   = 8,
2219                .result = "\x68\x65\x20\x74\x69\x6d\x65\x20",
2220                .rlen   = 8,
2221        }, {
2222                .key    = "\x01\x23\x45\x67\x89\xab\xcd\xef",
2223                .klen   = 8,
2224                .iv     = "\x43\xe9\x34\x00\x8c\x38\x9c\x0f",
2225                .input  = "\x68\x37\x88\x49\x9a\x7c\x05\xf6",
2226                .ilen   = 8,
2227                .result = "\x66\x6f\x72\x20\x61\x6c\x6c\x20",
2228                .rlen   = 8,
2229        }, { /* Copy of above, for chunk testing */
2230                .key    = "\x01\x23\x45\x67\x89\xab\xcd\xef",
2231                .klen   = 8,
2232                .iv     = "\x43\xe9\x34\x00\x8c\x38\x9c\x0f",
2233                .input  = "\x68\x37\x88\x49\x9a\x7c\x05\xf6",
2234                .ilen   = 8,
2235                .result = "\x66\x6f\x72\x20\x61\x6c\x6c\x20",
2236                .rlen   = 8,
2237                .np     = 2,
2238                .tap    = { 4, 4 }
2239        },
2240};
2241
2242static struct cipher_testvec des3_ede_enc_tv_template[] = {
2243        { /* These are from openssl */
2244                .key    = "\x01\x23\x45\x67\x89\xab\xcd\xef"
2245                          "\x55\x55\x55\x55\x55\x55\x55\x55"
2246                          "\xfe\xdc\xba\x98\x76\x54\x32\x10",
2247                .klen   = 24,
2248                .input  = "\x73\x6f\x6d\x65\x64\x61\x74\x61",
2249                .ilen   = 8,
2250                .result = "\x18\xd7\x48\xe5\x63\x62\x05\x72",
2251                .rlen   = 8,
2252        }, {
2253                .key    = "\x03\x52\x02\x07\x67\x20\x82\x17"
2254                          "\x86\x02\x87\x66\x59\x08\x21\x98"
2255                          "\x64\x05\x6a\xbd\xfe\xa9\x34\x57",
2256                .klen   = 24,
2257                .input  = "\x73\x71\x75\x69\x67\x67\x6c\x65",
2258                .ilen   = 8,
2259                .result = "\xc0\x7d\x2a\x0f\xa5\x66\xfa\x30",
2260                .rlen   = 8,
2261        }, {
2262                .key    = "\x10\x46\x10\x34\x89\x98\x80\x20"
2263                          "\x91\x07\xd0\x15\x89\x19\x01\x01"
2264                          "\x19\x07\x92\x10\x98\x1a\x01\x01",
2265                .klen   = 24,
2266                .input  = "\x00\x00\x00\x00\x00\x00\x00\x00",
2267                .ilen   = 8,
2268                .result = "\xe1\xef\x62\xc3\x32\xfe\x82\x5b",
2269                .rlen   = 8,
2270        },
2271};
2272
2273static struct cipher_testvec des3_ede_dec_tv_template[] = {
2274        { /* These are from openssl */
2275                .key    = "\x01\x23\x45\x67\x89\xab\xcd\xef"
2276                          "\x55\x55\x55\x55\x55\x55\x55\x55"
2277                          "\xfe\xdc\xba\x98\x76\x54\x32\x10",
2278                .klen   = 24,
2279                .input  = "\x18\xd7\x48\xe5\x63\x62\x05\x72",
2280                .ilen   = 8,
2281                .result = "\x73\x6f\x6d\x65\x64\x61\x74\x61",
2282                .rlen   = 8,
2283        }, {
2284                .key    = "\x03\x52\x02\x07\x67\x20\x82\x17"
2285                          "\x86\x02\x87\x66\x59\x08\x21\x98"
2286                          "\x64\x05\x6a\xbd\xfe\xa9\x34\x57",
2287                .klen   = 24,
2288                .input  = "\xc0\x7d\x2a\x0f\xa5\x66\xfa\x30",
2289                .ilen   = 8,
2290                .result = "\x73\x71\x75\x69\x67\x67\x6c\x65",
2291                .rlen   = 8,
2292        }, {
2293                .key    = "\x10\x46\x10\x34\x89\x98\x80\x20"
2294                          "\x91\x07\xd0\x15\x89\x19\x01\x01"
2295                          "\x19\x07\x92\x10\x98\x1a\x01\x01",
2296                .klen   = 24,
2297                .input  = "\xe1\xef\x62\xc3\x32\xfe\x82\x5b",
2298                .ilen   = 8,
2299                .result = "\x00\x00\x00\x00\x00\x00\x00\x00",
2300                .rlen   = 8,
2301        },
2302};
2303
2304static struct cipher_testvec des3_ede_cbc_enc_tv_template[] = {
2305        { /* Generated from openssl */
2306                .key    = "\xE9\xC0\xFF\x2E\x76\x0B\x64\x24"
2307                          "\x44\x4D\x99\x5A\x12\xD6\x40\xC0"
2308                          "\xEA\xC2\x84\xE8\x14\x95\xDB\xE8",
2309                .klen   = 24,
2310                .iv     = "\x7D\x33\x88\x93\x0F\x93\xB2\x42",
2311                .input  = "\x6f\x54\x20\x6f\x61\x4d\x79\x6e"
2312                          "\x53\x20\x63\x65\x65\x72\x73\x74"
2313                          "\x54\x20\x6f\x6f\x4d\x20\x6e\x61"
2314                          "\x20\x79\x65\x53\x72\x63\x74\x65"
2315                          "\x20\x73\x6f\x54\x20\x6f\x61\x4d"
2316                          "\x79\x6e\x53\x20\x63\x65\x65\x72"
2317                          "\x73\x74\x54\x20\x6f\x6f\x4d\x20"
2318                          "\x6e\x61\x20\x79\x65\x53\x72\x63"
2319                          "\x74\x65\x20\x73\x6f\x54\x20\x6f"
2320                          "\x61\x4d\x79\x6e\x53\x20\x63\x65"
2321                          "\x65\x72\x73\x74\x54\x20\x6f\x6f"
2322                          "\x4d\x20\x6e\x61\x20\x79\x65\x53"
2323                          "\x72\x63\x74\x65\x20\x73\x6f\x54"
2324                          "\x20\x6f\x61\x4d\x79\x6e\x53\x20"
2325                          "\x63\x65\x65\x72\x73\x74\x54\x20"
2326                          "\x6f\x6f\x4d\x20\x6e\x61\x0a\x79",
2327                .ilen   = 128,
2328                .result = "\x0e\x2d\xb6\x97\x3c\x56\x33\xf4"
2329                          "\x67\x17\x21\xc7\x6e\x8a\xd5\x49"
2330                          "\x74\xb3\x49\x05\xc5\x1c\xd0\xed"
2331                          "\x12\x56\x5c\x53\x96\xb6\x00\x7d"
2332                          "\x90\x48\xfc\xf5\x8d\x29\x39\xcc"
2333                          "\x8a\xd5\x35\x18\x36\x23\x4e\xd7"
2334                          "\x76\xd1\xda\x0c\x94\x67\xbb\x04"
2335                          "\x8b\xf2\x03\x6c\xa8\xcf\xb6\xea"
2336                          "\x22\x64\x47\xaa\x8f\x75\x13\xbf"
2337                          "\x9f\xc2\xc3\xf0\xc9\x56\xc5\x7a"
2338                          "\x71\x63\x2e\x89\x7b\x1e\x12\xca"
2339                          "\xe2\x5f\xaf\xd8\xa4\xf8\xc9\x7a"
2340                          "\xd6\xf9\x21\x31\x62\x44\x45\xa6"
2341                          "\xd6\xbc\x5a\xd3\x2d\x54\x43\xcc"
2342                          "\x9d\xde\xa5\x70\xe9\x42\x45\x8a"
2343                          "\x6b\xfa\xb1\x91\x13\xb0\xd9\x19",
2344                .rlen   = 128,
2345        },
2346};
2347
2348static struct cipher_testvec des3_ede_cbc_dec_tv_template[] = {
2349        { /* Generated from openssl */
2350                .key    = "\xE9\xC0\xFF\x2E\x76\x0B\x64\x24"
2351                          "\x44\x4D\x99\x5A\x12\xD6\x40\xC0"
2352                          "\xEA\xC2\x84\xE8\x14\x95\xDB\xE8",
2353                .klen   = 24,
2354                .iv     = "\x7D\x33\x88\x93\x0F\x93\xB2\x42",
2355                .input  = "\x0e\x2d\xb6\x97\x3c\x56\x33\xf4"
2356                          "\x67\x17\x21\xc7\x6e\x8a\xd5\x49"
2357                          "\x74\xb3\x49\x05\xc5\x1c\xd0\xed"
2358                          "\x12\x56\x5c\x53\x96\xb6\x00\x7d"
2359                          "\x90\x48\xfc\xf5\x8d\x29\x39\xcc"
2360                          "\x8a\xd5\x35\x18\x36\x23\x4e\xd7"
2361                          "\x76\xd1\xda\x0c\x94\x67\xbb\x04"
2362                          "\x8b\xf2\x03\x6c\xa8\xcf\xb6\xea"
2363                          "\x22\x64\x47\xaa\x8f\x75\x13\xbf"
2364                          "\x9f\xc2\xc3\xf0\xc9\x56\xc5\x7a"
2365                          "\x71\x63\x2e\x89\x7b\x1e\x12\xca"
2366                          "\xe2\x5f\xaf\xd8\xa4\xf8\xc9\x7a"
2367                          "\xd6\xf9\x21\x31\x62\x44\x45\xa6"
2368                          "\xd6\xbc\x5a\xd3\x2d\x54\x43\xcc"
2369                          "\x9d\xde\xa5\x70\xe9\x42\x45\x8a"
2370                          "\x6b\xfa\xb1\x91\x13\xb0\xd9\x19",
2371                .ilen   = 128,
2372                .result = "\x6f\x54\x20\x6f\x61\x4d\x79\x6e"
2373                          "\x53\x20\x63\x65\x65\x72\x73\x74"
2374                          "\x54\x20\x6f\x6f\x4d\x20\x6e\x61"
2375                          "\x20\x79\x65\x53\x72\x63\x74\x65"
2376                          "\x20\x73\x6f\x54\x20\x6f\x61\x4d"
2377                          "\x79\x6e\x53\x20\x63\x65\x65\x72"
2378                          "\x73\x74\x54\x20\x6f\x6f\x4d\x20"
2379                          "\x6e\x61\x20\x79\x65\x53\x72\x63"
2380                          "\x74\x65\x20\x73\x6f\x54\x20\x6f"
2381                          "\x61\x4d\x79\x6e\x53\x20\x63\x65"
2382                          "\x65\x72\x73\x74\x54\x20\x6f\x6f"
2383                          "\x4d\x20\x6e\x61\x20\x79\x65\x53"
2384                          "\x72\x63\x74\x65\x20\x73\x6f\x54"
2385                          "\x20\x6f\x61\x4d\x79\x6e\x53\x20"
2386                          "\x63\x65\x65\x72\x73\x74\x54\x20"
2387                          "\x6f\x6f\x4d\x20\x6e\x61\x0a\x79",
2388                .rlen   = 128,
2389        },
2390};
2391
2392/*
2393 * Blowfish test vectors.
2394 */
2395#define BF_ENC_TEST_VECTORS     7
2396#define BF_DEC_TEST_VECTORS     7
2397#define BF_CBC_ENC_TEST_VECTORS 2
2398#define BF_CBC_DEC_TEST_VECTORS 2
2399#define BF_CTR_ENC_TEST_VECTORS 2
2400#define BF_CTR_DEC_TEST_VECTORS 2
2401
2402static struct cipher_testvec bf_enc_tv_template[] = {
2403        { /* DES test vectors from OpenSSL */
2404                .key    = "\x00\x00\x00\x00\x00\x00\x00\x00",
2405                .klen   = 8,
2406                .input  = "\x00\x00\x00\x00\x00\x00\x00\x00",
2407                .ilen   = 8,
2408                .result = "\x4e\xf9\x97\x45\x61\x98\xdd\x78",
2409                .rlen   = 8,
2410        }, {
2411                .key    = "\x1f\x1f\x1f\x1f\x0e\x0e\x0e\x0e",
2412                .klen   = 8,
2413                .input  = "\x01\x23\x45\x67\x89\xab\xcd\xef",
2414                .ilen   = 8,
2415                .result = "\xa7\x90\x79\x51\x08\xea\x3c\xae",
2416                .rlen   = 8,
2417        }, {
2418                .key    = "\xf0\xe1\xd2\xc3\xb4\xa5\x96\x87",
2419                .klen   = 8,
2420                .input  = "\xfe\xdc\xba\x98\x76\x54\x32\x10",
2421                .ilen   = 8,
2422                .result = "\xe8\x7a\x24\x4e\x2c\xc8\x5e\x82",
2423                .rlen   = 8,
2424        }, { /* Vary the keylength... */
2425                .key    = "\xf0\xe1\xd2\xc3\xb4\xa5\x96\x87"
2426                          "\x78\x69\x5a\x4b\x3c\x2d\x1e\x0f",
2427                .klen   = 16,
2428                .input  = "\xfe\xdc\xba\x98\x76\x54\x32\x10",
2429                .ilen   = 8,
2430                .result = "\x93\x14\x28\x87\xee\x3b\xe1\x5c",
2431                .rlen   = 8,
2432        }, {
2433                .key    = "\xf0\xe1\xd2\xc3\xb4\xa5\x96\x87"
2434                          "\x78\x69\x5a\x4b\x3c\x2d\x1e\x0f"
2435                          "\x00\x11\x22\x33\x44",
2436                .klen   = 21,
2437                .input  = "\xfe\xdc\xba\x98\x76\x54\x32\x10",
2438                .ilen   = 8,
2439                .result = "\xe6\xf5\x1e\xd7\x9b\x9d\xb2\x1f",
2440                .rlen   = 8,
2441        }, { /* Generated with bf488 */
2442                .key    = "\xf0\xe1\xd2\xc3\xb4\xa5\x96\x87"
2443                          "\x78\x69\x5a\x4b\x3c\x2d\x1e\x0f"
2444                          "\x00\x11\x22\x33\x44\x55\x66\x77"
2445                          "\x04\x68\x91\x04\xc2\xfd\x3b\x2f"
2446                          "\x58\x40\x23\x64\x1a\xba\x61\x76"
2447                          "\x1f\x1f\x1f\x1f\x0e\x0e\x0e\x0e"
2448                          "\xff\xff\xff\xff\xff\xff\xff\xff",
2449                .klen   = 56,
2450                .input  = "\xfe\xdc\xba\x98\x76\x54\x32\x10",
2451                .ilen   = 8,
2452                .result = "\xc0\x45\x04\x01\x2e\x4e\x1f\x53",
2453                .rlen   = 8,
2454        }, { /* Generated with Crypto++ */
2455                .key    = "\x85\x62\x3F\x1C\xF9\xD6\x1C\xF9"
2456                          "\xD6\xB3\x90\x6D\x4A\x90\x6D\x4A"
2457                          "\x27\x04\xE1\x27\x04\xE1\xBE\x9B"
2458                          "\x78\xBE\x9B\x78\x55\x32\x0F\x55",
2459                .klen   = 32,
2460                .input  = "\x56\xED\x84\x1B\x8F\x26\xBD\x31"
2461                          "\xC8\x5F\xF6\x6A\x01\x98\x0C\xA3"
2462                          "\x3A\xD1\x45\xDC\x73\x0A\x7E\x15"
2463                          "\xAC\x20\xB7\x4E\xE5\x59\xF0\x87"
2464                          "\x1E\x92\x29\xC0\x34\xCB\x62\xF9",
2465                .ilen   = 40,
2466                .result = "\x96\x87\x3D\x0C\x7B\xFB\xBD\x1F"
2467                          "\xE3\xC1\x99\x6D\x39\xD4\xC2\x7D"
2468                          "\xD7\x87\xA1\xF2\xDF\x51\x71\x26"
2469                          "\xC2\xF4\x6D\xFF\xF6\xCD\x6B\x40"
2470                          "\xE1\xB3\xBF\xD4\x38\x2B\xC8\x3B",
2471                .rlen   = 40,
2472                .also_non_np = 1,
2473                .np     = 2,
2474                .tap    = { 40 - 8, 8 },
2475        },
2476};
2477
2478static struct cipher_testvec bf_dec_tv_template[] = {
2479        { /* DES test vectors from OpenSSL */
2480                .key    = "\x00\x00\x00\x00\x00\x00\x00\x00",
2481                .klen   = 8,
2482                .input  = "\x4e\xf9\x97\x45\x61\x98\xdd\x78",
2483                .ilen   = 8,
2484                .result = "\x00\x00\x00\x00\x00\x00\x00\x00",
2485                .rlen   = 8,
2486        }, {
2487                .key    = "\x1f\x1f\x1f\x1f\x0e\x0e\x0e\x0e",
2488                .klen   = 8,
2489                .input  = "\xa7\x90\x79\x51\x08\xea\x3c\xae",
2490                .ilen   = 8,
2491                .result = "\x01\x23\x45\x67\x89\xab\xcd\xef",
2492                .rlen   = 8,
2493        }, {
2494                .key    = "\xf0\xe1\xd2\xc3\xb4\xa5\x96\x87",
2495                .klen   = 8,
2496                .input  = "\xe8\x7a\x24\x4e\x2c\xc8\x5e\x82",
2497                .ilen   = 8,
2498                .result = "\xfe\xdc\xba\x98\x76\x54\x32\x10",
2499                .rlen   = 8,
2500        }, { /* Vary the keylength... */
2501                .key    = "\xf0\xe1\xd2\xc3\xb4\xa5\x96\x87"
2502                          "\x78\x69\x5a\x4b\x3c\x2d\x1e\x0f",
2503                .klen   = 16,
2504                .input  = "\x93\x14\x28\x87\xee\x3b\xe1\x5c",
2505                .ilen   = 8,
2506                .result = "\xfe\xdc\xba\x98\x76\x54\x32\x10",
2507                .rlen   = 8,
2508        }, {
2509                .key    = "\xf0\xe1\xd2\xc3\xb4\xa5\x96\x87"
2510                          "\x78\x69\x5a\x4b\x3c\x2d\x1e\x0f"
2511                          "\x00\x11\x22\x33\x44",
2512                .klen   = 21,
2513                .input  = "\xe6\xf5\x1e\xd7\x9b\x9d\xb2\x1f",
2514                .ilen   = 8,
2515                .result = "\xfe\xdc\xba\x98\x76\x54\x32\x10",
2516                .rlen   = 8,
2517        }, { /* Generated with bf488, using OpenSSL, Libgcrypt and Nettle */
2518                .key    = "\xf0\xe1\xd2\xc3\xb4\xa5\x96\x87"
2519                          "\x78\x69\x5a\x4b\x3c\x2d\x1e\x0f"
2520                          "\x00\x11\x22\x33\x44\x55\x66\x77"
2521                          "\x04\x68\x91\x04\xc2\xfd\x3b\x2f"
2522                          "\x58\x40\x23\x64\x1a\xba\x61\x76"
2523                          "\x1f\x1f\x1f\x1f\x0e\x0e\x0e\x0e"
2524                          "\xff\xff\xff\xff\xff\xff\xff\xff",
2525                .klen   = 56,
2526                .input  = "\xc0\x45\x04\x01\x2e\x4e\x1f\x53",
2527                .ilen   = 8,
2528                .result = "\xfe\xdc\xba\x98\x76\x54\x32\x10",
2529                .rlen   = 8,
2530        }, { /* Generated with Crypto++ */
2531                .key    = "\x85\x62\x3F\x1C\xF9\xD6\x1C\xF9"
2532                          "\xD6\xB3\x90\x6D\x4A\x90\x6D\x4A"
2533                          "\x27\x04\xE1\x27\x04\xE1\xBE\x9B"
2534                          "\x78\xBE\x9B\x78\x55\x32\x0F\x55",
2535                .klen   = 32,
2536                .input  = "\x96\x87\x3D\x0C\x7B\xFB\xBD\x1F"
2537                          "\xE3\xC1\x99\x6D\x39\xD4\xC2\x7D"
2538                          "\xD7\x87\xA1\xF2\xDF\x51\x71\x26"
2539                          "\xC2\xF4\x6D\xFF\xF6\xCD\x6B\x40"
2540                          "\xE1\xB3\xBF\xD4\x38\x2B\xC8\x3B",
2541                .ilen   = 40,
2542                .result = "\x56\xED\x84\x1B\x8F\x26\xBD\x31"
2543                          "\xC8\x5F\xF6\x6A\x01\x98\x0C\xA3"
2544                          "\x3A\xD1\x45\xDC\x73\x0A\x7E\x15"
2545                          "\xAC\x20\xB7\x4E\xE5\x59\xF0\x87"
2546                          "\x1E\x92\x29\xC0\x34\xCB\x62\xF9",
2547                .rlen   = 40,
2548                .also_non_np = 1,
2549                .np     = 2,
2550                .tap    = { 40 - 8, 8 },
2551        },
2552};
2553
2554static struct cipher_testvec bf_cbc_enc_tv_template[] = {
2555        { /* From OpenSSL */
2556                .key    = "\x01\x23\x45\x67\x89\xab\xcd\xef"
2557                          "\xf0\xe1\xd2\xc3\xb4\xa5\x96\x87",
2558                .klen   = 16,
2559                .iv     = "\xfe\xdc\xba\x98\x76\x54\x32\x10",
2560                .input  = "\x37\x36\x35\x34\x33\x32\x31\x20"
2561                          "\x4e\x6f\x77\x20\x69\x73\x20\x74"
2562                          "\x68\x65\x20\x74\x69\x6d\x65\x20"
2563                          "\x66\x6f\x72\x20\x00\x00\x00\x00",
2564                .ilen   = 32,
2565                .result = "\x6b\x77\xb4\xd6\x30\x06\xde\xe6"
2566                          "\x05\xb1\x56\xe2\x74\x03\x97\x93"
2567                          "\x58\xde\xb9\xe7\x15\x46\x16\xd9"
2568                          "\x59\xf1\x65\x2b\xd5\xff\x92\xcc",
2569                .rlen   = 32,
2570        }, { /* Generated with Crypto++ */
2571                .key    = "\x85\x62\x3F\x1C\xF9\xD6\x1C\xF9"
2572                          "\xD6\xB3\x90\x6D\x4A\x90\x6D\x4A"
2573                          "\x27\x04\xE1\x27\x04\xE1\xBE\x9B"
2574                          "\x78\xBE\x9B\x78\x55\x32\x0F\x55",
2575                .klen   = 32,
2576                .iv     = "\xE2\x24\x89\xEE\x53\xB8\x1D\x5F",
2577                .input  = "\x56\xED\x84\x1B\x8F\x26\xBD\x31"
2578                          "\xC8\x5F\xF6\x6A\x01\x98\x0C\xA3"
2579                          "\x3A\xD1\x45\xDC\x73\x0A\x7E\x15"
2580                          "\xAC\x20\xB7\x4E\xE5\x59\xF0\x87"
2581                          "\x1E\x92\x29\xC0\x34\xCB\x62\xF9",
2582                .ilen   = 40,
2583                .result = "\xB4\xFE\xA5\xBB\x3D\x2C\x27\x06"
2584                          "\x06\x2B\x3A\x92\xB2\xF5\x5E\x62"
2585                          "\x84\xCD\xF7\x66\x7E\x41\x6C\x8E"
2586                          "\x1B\xD9\x02\xB6\x48\xB0\x87\x25"
2587                          "\x01\x9C\x93\x63\x51\x60\x82\xD2",
2588                .rlen   = 40,
2589                .also_non_np = 1,
2590                .np     = 2,
2591                .tap    = { 40 - 8, 8 },
2592        },
2593};
2594
2595static struct cipher_testvec bf_cbc_dec_tv_template[] = {
2596        { /* From OpenSSL */
2597                .key    = "\x01\x23\x45\x67\x89\xab\xcd\xef"
2598                          "\xf0\xe1\xd2\xc3\xb4\xa5\x96\x87",
2599                .klen   = 16,
2600                .iv     = "\xfe\xdc\xba\x98\x76\x54\x32\x10",
2601                .input  = "\x6b\x77\xb4\xd6\x30\x06\xde\xe6"
2602                          "\x05\xb1\x56\xe2\x74\x03\x97\x93"
2603                          "\x58\xde\xb9\xe7\x15\x46\x16\xd9"
2604                          "\x59\xf1\x65\x2b\xd5\xff\x92\xcc",
2605                .ilen   = 32,
2606                .result = "\x37\x36\x35\x34\x33\x32\x31\x20"
2607                          "\x4e\x6f\x77\x20\x69\x73\x20\x74"
2608                          "\x68\x65\x20\x74\x69\x6d\x65\x20"
2609                          "\x66\x6f\x72\x20\x00\x00\x00\x00",
2610                .rlen   = 32,
2611        }, { /* Generated with Crypto++ */
2612                .key    = "\x85\x62\x3F\x1C\xF9\xD6\x1C\xF9"
2613                          "\xD6\xB3\x90\x6D\x4A\x90\x6D\x4A"
2614                          "\x27\x04\xE1\x27\x04\xE1\xBE\x9B"
2615                          "\x78\xBE\x9B\x78\x55\x32\x0F\x55",
2616                .klen   = 32,
2617                .iv     = "\xE2\x24\x89\xEE\x53\xB8\x1D\x5F",
2618                .input  = "\xB4\xFE\xA5\xBB\x3D\x2C\x27\x06"
2619                          "\x06\x2B\x3A\x92\xB2\xF5\x5E\x62"
2620                          "\x84\xCD\xF7\x66\x7E\x41\x6C\x8E"
2621                          "\x1B\xD9\x02\xB6\x48\xB0\x87\x25"
2622                          "\x01\x9C\x93\x63\x51\x60\x82\xD2",
2623                .ilen   = 40,
2624                .result = "\x56\xED\x84\x1B\x8F\x26\xBD\x31"
2625                          "\xC8\x5F\xF6\x6A\x01\x98\x0C\xA3"
2626                          "\x3A\xD1\x45\xDC\x73\x0A\x7E\x15"
2627                          "\xAC\x20\xB7\x4E\xE5\x59\xF0\x87"
2628                          "\x1E\x92\x29\xC0\x34\xCB\x62\xF9",
2629                .rlen   = 40,
2630                .also_non_np = 1,
2631                .np     = 2,
2632                .tap    = { 40 - 8, 8 },
2633        },
2634};
2635
2636static struct cipher_testvec bf_ctr_enc_tv_template[] = {
2637        { /* Generated with Crypto++ */
2638                .key    = "\x85\x62\x3F\x1C\xF9\xD6\x1C\xF9"
2639                          "\xD6\xB3\x90\x6D\x4A\x90\x6D\x4A"
2640                          "\x27\x04\xE1\x27\x04\xE1\xBE\x9B"
2641                          "\x78\xBE\x9B\x78\x55\x32\x0F\x55",
2642                .klen   = 32,
2643                .iv     = "\xE2\x24\x89\xEE\x53\xB8\x1D\x5F",
2644                .input  = "\x56\xED\x84\x1B\x8F\x26\xBD\x31"
2645                          "\xC8\x5F\xF6\x6A\x01\x98\x0C\xA3"
2646                          "\x3A\xD1\x45\xDC\x73\x0A\x7E\x15"
2647                          "\xAC\x20\xB7\x4E\xE5\x59\xF0\x87"
2648                          "\x1E\x92\x29\xC0\x34\xCB\x62\xF9",
2649                .ilen   = 40,
2650                .result = "\xC7\xA3\xDF\xB9\x05\xF4\x9E\x8D"
2651                          "\x9E\xDF\x38\x18\x83\x07\xEF\xC1"
2652                          "\x93\x3C\xAA\xAA\xFE\x06\x42\xCC"
2653                          "\x0D\x70\x86\x5A\x44\xAD\x85\x17"
2654                          "\xE4\x1F\x5E\xA5\x89\xAC\x32\xBC",
2655                .rlen   = 40,
2656        }, { /* Generated with Crypto++ */
2657                .key    = "\x85\x62\x3F\x1C\xF9\xD6\x1C\xF9"
2658                          "\xD6\xB3\x90\x6D\x4A\x90\x6D\x4A"
2659                          "\x27\x04\xE1\x27\x04\xE1\xBE\x9B"
2660                          "\x78\xBE\x9B\x78\x55\x32\x0F\x55",
2661                .klen   = 32,
2662                .iv     = "\xE2\x24\x89\xEE\x53\xB8\x1D\x5F",
2663                .input  = "\x56\xED\x84\x1B\x8F\x26\xBD\x31"
2664                          "\xC8\x5F\xF6\x6A\x01\x98\x0C\xA3"
2665                          "\x3A\xD1\x45\xDC\x73\x0A\x7E\x15"
2666                          "\xAC\x20\xB7\x4E\xE5\x59\xF0\x87"
2667                          "\x1E\x92\x29\xC0\x34\xCB\x62\xF9"
2668                          "\x6D\x04\x9B",
2669                .ilen   = 43,
2670                .result = "\xC7\xA3\xDF\xB9\x05\xF4\x9E\x8D"
2671                          "\x9E\xDF\x38\x18\x83\x07\xEF\xC1"
2672                          "\x93\x3C\xAA\xAA\xFE\x06\x42\xCC"
2673                          "\x0D\x70\x86\x5A\x44\xAD\x85\x17"
2674                          "\xE4\x1F\x5E\xA5\x89\xAC\x32\xBC"
2675                          "\x3D\xA7\xE9",
2676                .rlen   = 43,
2677                .also_non_np = 1,
2678                .np     = 2,
2679                .tap    = { 43 - 8, 8 },
2680        }, { /* Generated with Crypto++ */
2681                .key    = "\x85\x62\x3F\x1C\xF9\xD6\x1C\xF9"
2682                          "\xD6\xB3\x90\x6D\x4A\x90\x6D\x4A"
2683                          "\x27\x04\xE1\x27\x04\xE1\xBE\x9B"
2684                          "\x78\xBE\x9B\x78\x55\x32\x0F\x55",
2685                .klen   = 32,
2686                .iv     = "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFD",
2687                .input  = "\x56\xED\x84\x1B\x8F\x26\xBD\x31"
2688                          "\xC8\x5F\xF6\x6A\x01\x98\x0C\xA3"
2689                          "\x3A\xD1\x45\xDC\x73\x0A\x7E\x15"
2690                          "\xAC\x20\xB7\x4E\xE5\x59\xF0\x87"
2691                          "\x1E\x92\x29\xC0\x34\xCB\x62\xF9"
2692                          "\x6D\x04\x9B\x0F\xA6\x3D\xD4\x48"
2693                          "\xDF\x76\x0D\x81\x18\xAF\x23\xBA"
2694                          "\x51\xE8\x5C\xF3\x8A\x21\x95\x2C"
2695                          "\xC3\x37\xCE\x65\xFC\x70\x07\x9E"
2696                          "\x12\xA9\x40\xD7\x4B\xE2\x79\x10"
2697                          "\x84\x1B\xB2\x26\xBD\x54\xEB\x5F"
2698                          "\xF6\x8D\x01\x98\x2F\xC6\x3A\xD1"
2699                          "\x68\xFF\x73\x0A\xA1\x15\xAC\x43"
2700                          "\xDA\x4E\xE5\x7C\x13\x87\x1E\xB5"
2701                          "\x29\xC0\x57\xEE\x62\xF9\x90\x04"
2702                          "\x9B\x32\xC9\x3D\xD4\x6B\x02\x76"
2703                          "\x0D\xA4\x18\xAF\x46\xDD\x51\xE8"
2704                          "\x7F\x16\x8A\x21\xB8\x2C\xC3\x5A"
2705                          "\xF1\x65\xFC\x93\x07\x9E\x35\xCC"
2706                          "\x40\xD7\x6E\x05\x79\x10\xA7\x1B"
2707                          "\xB2\x49\xE0\x54\xEB\x82\x19\x8D"
2708                          "\x24\xBB\x2F\xC6\x5D\xF4\x68\xFF"
2709                          "\x96\x0A\xA1\x38\xCF\x43\xDA\x71"
2710                          "\x08\x7C\x13\xAA\x1E\xB5\x4C\xE3"
2711                          "\x57\xEE\x85\x1C\x90\x27\xBE\x32"
2712                          "\xC9\x60\xF7\x6B\x02\x99\x0D\xA4"
2713                          "\x3B\xD2\x46\xDD\x74\x0B\x7F\x16"
2714                          "\xAD\x21\xB8\x4F\xE6\x5A\xF1\x88"
2715                          "\x1F\x93\x2A\xC1\x35\xCC\x63\xFA"
2716                          "\x6E\x05\x9C\x10\xA7\x3E\xD5\x49"
2717                          "\xE0\x77\x0E\x82\x19\xB0\x24\xBB"
2718                          "\x52\xE9\x5D\xF4\x8B\x22\x96\x2D"
2719                          "\xC4\x38\xCF\x66\xFD\x71\x08\x9F"
2720                          "\x13\xAA\x41\xD8\x4C\xE3\x7A\x11"
2721                          "\x85\x1C\xB3\x27\xBE\x55\xEC\x60"
2722                          "\xF7\x8E\x02\x99\x30\xC7\x3B\xD2"
2723                          "\x69\x00\x74\x0B\xA2\x16\xAD\x44"
2724                          "\xDB\x4F\xE6\x7D\x14\x88\x1F\xB6"
2725                          "\x2A\xC1\x58\xEF\x63\xFA\x91\x05"
2726                          "\x9C\x33\xCA\x3E\xD5\x6C\x03\x77"
2727                          "\x0E\xA5\x19\xB0\x47\xDE\x52\xE9"
2728                          "\x80\x17\x8B\x22\xB9\x2D\xC4\x5B"
2729                          "\xF2\x66\xFD\x94\x08\x9F\x36\xCD"
2730                          "\x41\xD8\x6F\x06\x7A\x11\xA8\x1C"
2731                          "\xB3\x4A\xE1\x55\xEC\x83\x1A\x8E"
2732                          "\x25\xBC\x30\xC7\x5E\xF5\x69\x00"
2733                          "\x97\x0B\xA2\x39\xD0\x44\xDB\x72"
2734                          "\x09\x7D\x14\xAB\x1F\xB6\x4D\xE4"
2735                          "\x58\xEF\x86\x1D\x91\x28\xBF\x33"
2736                          "\xCA\x61\xF8\x6C\x03\x9A\x0E\xA5"
2737                          "\x3C\xD3\x47\xDE\x75\x0C\x80\x17"
2738                          "\xAE\x22\xB9\x50\xE7\x5B\xF2\x89"
2739                          "\x20\x94\x2B\xC2\x36\xCD\x64\xFB"
2740                          "\x6F\x06\x9D\x11\xA8\x3F\xD6\x4A"
2741                          "\xE1\x78\x0F\x83\x1A\xB1\x25\xBC"
2742                          "\x53\xEA\x5E\xF5\x8C\x00\x97\x2E"
2743                          "\xC5\x39\xD0\x67\xFE\x72\x09\xA0"
2744                          "\x14\xAB\x42\xD9\x4D\xE4\x7B\x12"
2745                          "\x86\x1D\xB4\x28\xBF\x56\xED\x61"
2746                          "\xF8\x8F\x03\x9A\x31\xC8\x3C\xD3"
2747                          "\x6A\x01\x75\x0C\xA3\x17\xAE\x45"
2748                          "\xDC\x50\xE7\x7E\x15\x89\x20\xB7"
2749                          "\x2B\xC2\x59\xF0\x64\xFB\x92\x06",
2750                .ilen   = 504,
2751                .result = "\x5F\x58\x6E\x60\x51\x6E\xDC\x3D"
2752                          "\xD1\xBB\xF7\xB7\xFD\x04\x44\x82"
2753                          "\xDC\x9F\x4B\x02\xF1\xD2\x5A\x6F"
2754                          "\x25\xF9\x27\x21\xF2\xD2\x9A\x01"
2755                          "\xBD\xAD\x3D\x93\x87\xCA\x0D\xFE"
2756                          "\xB7\x2C\x17\x1F\x42\x8C\x13\xB2"
2757                          "\x62\x44\x72\xB9\x5D\xC0\xF8\x37"
2758                          "\xDF\xEA\x78\x81\x8F\xA6\x34\xB2"
2759                          "\x07\x09\x7C\xB9\x3A\xA0\x2B\x18"
2760                          "\x34\x6A\x9D\x3D\xA5\xEB\xF4\x60"
2761                          "\xF8\x98\xA2\x39\x81\x23\x6C\xA9"
2762                          "\x70\xCA\xCC\x45\xD8\x1F\xDF\x44"
2763                          "\x2A\x67\x7A\x88\x28\xDC\x36\x83"
2764                          "\x18\xD7\x48\x43\x17\x2B\x1B\xE6"
2765                          "\x0B\x82\x59\x14\x26\x67\x08\x09"
2766                          "\x5B\x5D\x38\xD0\x81\xCE\x54\x2A"
2767                          "\xCD\x22\x94\x42\xF5\xBA\x74\x7E"
2768                          "\xD9\x00\x40\xA9\x0D\x0B\xBD\x8E"
2769                          "\xC4\x8E\x5E\x17\x8F\x48\xE2\xB8"
2770                          "\xF4\xCC\x19\x76\xAB\x48\x29\xAA"
2771                          "\x81\xD5\xCE\xD5\x8A\x3B\xC9\x21"
2772                          "\xEF\x50\x4F\x04\x02\xBF\xE1\x1F"
2773                          "\x59\x28\x1A\xE4\x18\x16\xA0\x29"
2774                          "\xBF\x34\xA9\x2D\x28\x83\xC0\x5E"
2775                          "\xEA\x44\xC4\x6E\xAB\x24\x79\x9D"
2776                          "\x2D\xA1\xE8\x55\xCA\x74\xFC\xBD"
2777                          "\xFE\xDD\xDA\xA5\xFB\x34\x90\x31"
2778                          "\x0E\x62\x28\x9B\xDC\xD7\xA1\xBB"
2779                          "\xF0\x1A\xB3\xE2\xD0\xFA\xBD\xE8"
2780                          "\x5C\x5A\x10\x67\xF6\x6A\x17\x3F"
2781                          "\xC5\xE9\x09\x08\xDD\x22\x77\x42"
2782                          "\x26\x6A\x6A\x7A\x3F\x87\x80\x0C"
2783                          "\xF0\xFF\x15\x8E\x84\x86\xC0\x10"
2784                          "\x0F\x8D\x33\x06\xB8\x72\xA4\x47"
2785                          "\x6B\xED\x2E\x05\x94\x6C\x5C\x5B"
2786                          "\x13\xF6\x77\xEE\x3B\x16\xDF\xC2"
2787                          "\x63\x66\x07\x6D\x3F\x6C\x51\x7C"
2788                          "\x1C\xAC\x80\xB6\x58\x48\xB7\x9D"
2789                          "\xB4\x19\xD8\x19\x45\x66\x27\x02"
2790                          "\xA1\xA9\x99\xF3\x1F\xE5\xA7\x1D"
2791                          "\x31\xE7\x1B\x0D\xFF\xBB\xB5\xA1"
2792                          "\xF5\x9C\x45\x1E\x18\x19\xA1\xE7"
2793                          "\xC2\xF1\xBF\x68\xC3\xEC\xCF\x53"
2794                          "\x67\xA6\x2B\x7D\x3C\x6D\x24\xC3"
2795                          "\xE8\xE6\x07\x5A\x09\xE0\x32\xA8"
2796                          "\x52\xF6\xE9\xED\x0E\xC6\x0A\x6A"
2797                          "\xFC\x60\x2A\xE0\x93\xCE\xB8\x2E"
2798                          "\xA2\xA8\x0E\x79\x9E\x34\x5D\x37"
2799                          "\x6F\x12\xFE\x48\x7B\xE7\xB9\x22"
2800                          "\x29\xE8\xD7\xBE\x5D\xD1\x8B\xD9"
2801                          "\x91\x51\x4E\x71\xF2\x98\x85\x16"
2802                          "\x25\x7A\x76\x8A\x51\x0E\x65\x14"
2803                          "\x81\xB5\x3A\x37\xFD\xEC\xB5\x8A"
2804                          "\xE1\xCF\x41\x72\x14\x29\x4C\xF0"
2805                          "\x20\xD9\x9A\xC5\x66\xA4\x03\x76"
2806                          "\x5B\xA4\x15\x4F\x0E\x64\x39\x40"
2807                          "\x25\xF9\x20\x22\xF5\x88\xF5\xBA"
2808                          "\xE4\xDF\x45\x61\xBF\x8D\x7A\x24"
2809                          "\x4B\x92\x71\xD9\x2F\x77\xA7\x95"
2810                          "\xA8\x7F\x61\xD5\xA4\x57\xB0\xFB"
2811                          "\xB5\x77\xBA\x1C\xEE\x71\xFA\xB0"
2812                          "\x16\x4C\x18\x6B\xF2\x69\xA0\x07"
2813                          "\xEF\xBE\xEC\x69\xAC\xA8\x63\x9E",
2814                .rlen   = 504,
2815        },
2816};
2817
2818static struct cipher_testvec bf_ctr_dec_tv_template[] = {
2819        { /* Generated with Crypto++ */
2820                .key    = "\x85\x62\x3F\x1C\xF9\xD6\x1C\xF9"
2821                          "\xD6\xB3\x90\x6D\x4A\x90\x6D\x4A"
2822                          "\x27\x04\xE1\x27\x04\xE1\xBE\x9B"
2823                          "\x78\xBE\x9B\x78\x55\x32\x0F\x55",
2824                .klen   = 32,
2825                .iv     = "\xE2\x24\x89\xEE\x53\xB8\x1D\x5F",
2826                .input  = "\xC7\xA3\xDF\xB9\x05\xF4\x9E\x8D"
2827                          "\x9E\xDF\x38\x18\x83\x07\xEF\xC1"
2828                          "\x93\x3C\xAA\xAA\xFE\x06\x42\xCC"
2829                          "\x0D\x70\x86\x5A\x44\xAD\x85\x17"
2830                          "\xE4\x1F\x5E\xA5\x89\xAC\x32\xBC",
2831                .ilen   = 40,
2832                .result = "\x56\xED\x84\x1B\x8F\x26\xBD\x31"
2833                          "\xC8\x5F\xF6\x6A\x01\x98\x0C\xA3"
2834                          "\x3A\xD1\x45\xDC\x73\x0A\x7E\x15"
2835                          "\xAC\x20\xB7\x4E\xE5\x59\xF0\x87"
2836                          "\x1E\x92\x29\xC0\x34\xCB\x62\xF9",
2837                .rlen   = 40,
2838        }, { /* Generated with Crypto++ */
2839                .key    = "\x85\x62\x3F\x1C\xF9\xD6\x1C\xF9"
2840                          "\xD6\xB3\x90\x6D\x4A\x90\x6D\x4A"
2841                          "\x27\x04\xE1\x27\x04\xE1\xBE\x9B"
2842                          "\x78\xBE\x9B\x78\x55\x32\x0F\x55",
2843                .klen   = 32,
2844                .iv     = "\xE2\x24\x89\xEE\x53\xB8\x1D\x5F",
2845                .input  = "\xC7\xA3\xDF\xB9\x05\xF4\x9E\x8D"
2846                          "\x9E\xDF\x38\x18\x83\x07\xEF\xC1"
2847                          "\x93\x3C\xAA\xAA\xFE\x06\x42\xCC"
2848                          "\x0D\x70\x86\x5A\x44\xAD\x85\x17"
2849                          "\xE4\x1F\x5E\xA5\x89\xAC\x32\xBC"
2850                          "\x3D\xA7\xE9",
2851                .ilen   = 43,
2852                .result = "\x56\xED\x84\x1B\x8F\x26\xBD\x31"
2853                          "\xC8\x5F\xF6\x6A\x01\x98\x0C\xA3"
2854                          "\x3A\xD1\x45\xDC\x73\x0A\x7E\x15"
2855                          "\xAC\x20\xB7\x4E\xE5\x59\xF0\x87"
2856                          "\x1E\x92\x29\xC0\x34\xCB\x62\xF9"
2857                          "\x6D\x04\x9B",
2858                .rlen   = 43,
2859                .also_non_np = 1,
2860                .np     = 2,
2861                .tap    = { 43 - 8, 8 },
2862        }, { /* Generated with Crypto++ */
2863                .key    = "\x85\x62\x3F\x1C\xF9\xD6\x1C\xF9"
2864                          "\xD6\xB3\x90\x6D\x4A\x90\x6D\x4A"
2865                          "\x27\x04\xE1\x27\x04\xE1\xBE\x9B"
2866                          "\x78\xBE\x9B\x78\x55\x32\x0F\x55",
2867                .klen   = 32,
2868                .iv     = "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFD",
2869                .input  = "\x5F\x58\x6E\x60\x51\x6E\xDC\x3D"
2870                          "\xD1\xBB\xF7\xB7\xFD\x04\x44\x82"
2871                          "\xDC\x9F\x4B\x02\xF1\xD2\x5A\x6F"
2872                          "\x25\xF9\x27\x21\xF2\xD2\x9A\x01"
2873                          "\xBD\xAD\x3D\x93\x87\xCA\x0D\xFE"
2874                          "\xB7\x2C\x17\x1F\x42\x8C\x13\xB2"
2875                          "\x62\x44\x72\xB9\x5D\xC0\xF8\x37"
2876                          "\xDF\xEA\x78\x81\x8F\xA6\x34\xB2"
2877                          "\x07\x09\x7C\xB9\x3A\xA0\x2B\x18"
2878                          "\x34\x6A\x9D\x3D\xA5\xEB\xF4\x60"
2879                          "\xF8\x98\xA2\x39\x81\x23\x6C\xA9"
2880                          "\x70\xCA\xCC\x45\xD8\x1F\xDF\x44"
2881                          "\x2A\x67\x7A\x88\x28\xDC\x36\x83"
2882                          "\x18\xD7\x48\x43\x17\x2B\x1B\xE6"
2883                          "\x0B\x82\x59\x14\x26\x67\x08\x09"
2884                          "\x5B\x5D\x38\xD0\x81\xCE\x54\x2A"
2885                          "\xCD\x22\x94\x42\xF5\xBA\x74\x7E"
2886                          "\xD9\x00\x40\xA9\x0D\x0B\xBD\x8E"
2887                          "\xC4\x8E\x5E\x17\x8F\x48\xE2\xB8"
2888                          "\xF4\xCC\x19\x76\xAB\x48\x29\xAA"
2889                          "\x81\xD5\xCE\xD5\x8A\x3B\xC9\x21"
2890                          "\xEF\x50\x4F\x04\x02\xBF\xE1\x1F"
2891                          "\x59\x28\x1A\xE4\x18\x16\xA0\x29"
2892                          "\xBF\x34\xA9\x2D\x28\x83\xC0\x5E"
2893                          "\xEA\x44\xC4\x6E\xAB\x24\x79\x9D"
2894                          "\x2D\xA1\xE8\x55\xCA\x74\xFC\xBD"
2895                          "\xFE\xDD\xDA\xA5\xFB\x34\x90\x31"
2896                          "\x0E\x62\x28\x9B\xDC\xD7\xA1\xBB"
2897                          "\xF0\x1A\xB3\xE2\xD0\xFA\xBD\xE8"
2898                          "\x5C\x5A\x10\x67\xF6\x6A\x17\x3F"
2899                          "\xC5\xE9\x09\x08\xDD\x22\x77\x42"
2900                          "\x26\x6A\x6A\x7A\x3F\x87\x80\x0C"
2901                          "\xF0\xFF\x15\x8E\x84\x86\xC0\x10"
2902                          "\x0F\x8D\x33\x06\xB8\x72\xA4\x47"
2903                          "\x6B\xED\x2E\x05\x94\x6C\x5C\x5B"
2904                          "\x13\xF6\x77\xEE\x3B\x16\xDF\xC2"
2905                          "\x63\x66\x07\x6D\x3F\x6C\x51\x7C"
2906                          "\x1C\xAC\x80\xB6\x58\x48\xB7\x9D"
2907                          "\xB4\x19\xD8\x19\x45\x66\x27\x02"
2908                          "\xA1\xA9\x99\xF3\x1F\xE5\xA7\x1D"
2909                          "\x31\xE7\x1B\x0D\xFF\xBB\xB5\xA1"
2910                          "\xF5\x9C\x45\x1E\x18\x19\xA1\xE7"
2911                          "\xC2\xF1\xBF\x68\xC3\xEC\xCF\x53"
2912                          "\x67\xA6\x2B\x7D\x3C\x6D\x24\xC3"
2913                          "\xE8\xE6\x07\x5A\x09\xE0\x32\xA8"
2914                          "\x52\xF6\xE9\xED\x0E\xC6\x0A\x6A"
2915                          "\xFC\x60\x2A\xE0\x93\xCE\xB8\x2E"
2916                          "\xA2\xA8\x0E\x79\x9E\x34\x5D\x37"
2917                          "\x6F\x12\xFE\x48\x7B\xE7\xB9\x22"
2918                          "\x29\xE8\xD7\xBE\x5D\xD1\x8B\xD9"
2919                          "\x91\x51\x4E\x71\xF2\x98\x85\x16"
2920                          "\x25\x7A\x76\x8A\x51\x0E\x65\x14"
2921                          "\x81\xB5\x3A\x37\xFD\xEC\xB5\x8A"
2922                          "\xE1\xCF\x41\x72\x14\x29\x4C\xF0"
2923                          "\x20\xD9\x9A\xC5\x66\xA4\x03\x76"
2924                          "\x5B\xA4\x15\x4F\x0E\x64\x39\x40"
2925                          "\x25\xF9\x20\x22\xF5\x88\xF5\xBA"
2926                          "\xE4\xDF\x45\x61\xBF\x8D\x7A\x24"
2927                          "\x4B\x92\x71\xD9\x2F\x77\xA7\x95"
2928                          "\xA8\x7F\x61\xD5\xA4\x57\xB0\xFB"
2929                          "\xB5\x77\xBA\x1C\xEE\x71\xFA\xB0"
2930                          "\x16\x4C\x18\x6B\xF2\x69\xA0\x07"
2931                          "\xEF\xBE\xEC\x69\xAC\xA8\x63\x9E",
2932                .ilen   = 504,
2933                .result = "\x56\xED\x84\x1B\x8F\x26\xBD\x31"
2934                          "\xC8\x5F\xF6\x6A\x01\x98\x0C\xA3"
2935                          "\x3A\xD1\x45\xDC\x73\x0A\x7E\x15"
2936                          "\xAC\x20\xB7\x4E\xE5\x59\xF0\x87"
2937                          "\x1E\x92\x29\xC0\x34\xCB\x62\xF9"
2938                          "\x6D\x04\x9B\x0F\xA6\x3D\xD4\x48"
2939                          "\xDF\x76\x0D\x81\x18\xAF\x23\xBA"
2940                          "\x51\xE8\x5C\xF3\x8A\x21\x95\x2C"
2941                          "\xC3\x37\xCE\x65\xFC\x70\x07\x9E"
2942                          "\x12\xA9\x40\xD7\x4B\xE2\x79\x10"
2943                          "\x84\x1B\xB2\x26\xBD\x54\xEB\x5F"
2944                          "\xF6\x8D\x01\x98\x2F\xC6\x3A\xD1"
2945                          "\x68\xFF\x73\x0A\xA1\x15\xAC\x43"
2946                          "\xDA\x4E\xE5\x7C\x13\x87\x1E\xB5"
2947                          "\x29\xC0\x57\xEE\x62\xF9\x90\x04"
2948                          "\x9B\x32\xC9\x3D\xD4\x6B\x02\x76"
2949                          "\x0D\xA4\x18\xAF\x46\xDD\x51\xE8"
2950                          "\x7F\x16\x8A\x21\xB8\x2C\xC3\x5A"
2951                          "\xF1\x65\xFC\x93\x07\x9E\x35\xCC"
2952                          "\x40\xD7\x6E\x05\x79\x10\xA7\x1B"
2953                          "\xB2\x49\xE0\x54\xEB\x82\x19\x8D"
2954                          "\x24\xBB\x2F\xC6\x5D\xF4\x68\xFF"
2955                          "\x96\x0A\xA1\x38\xCF\x43\xDA\x71"
2956                          "\x08\x7C\x13\xAA\x1E\xB5\x4C\xE3"
2957                          "\x57\xEE\x85\x1C\x90\x27\xBE\x32"
2958                          "\xC9\x60\xF7\x6B\x02\x99\x0D\xA4"
2959                          "\x3B\xD2\x46\xDD\x74\x0B\x7F\x16"
2960                          "\xAD\x21\xB8\x4F\xE6\x5A\xF1\x88"
2961                          "\x1F\x93\x2A\xC1\x35\xCC\x63\xFA"
2962                          "\x6E\x05\x9C\x10\xA7\x3E\xD5\x49"
2963                          "\xE0\x77\x0E\x82\x19\xB0\x24\xBB"
2964                          "\x52\xE9\x5D\xF4\x8B\x22\x96\x2D"
2965                          "\xC4\x38\xCF\x66\xFD\x71\x08\x9F"
2966                          "\x13\xAA\x41\xD8\x4C\xE3\x7A\x11"
2967                          "\x85\x1C\xB3\x27\xBE\x55\xEC\x60"
2968                          "\xF7\x8E\x02\x99\x30\xC7\x3B\xD2"
2969                          "\x69\x00\x74\x0B\xA2\x16\xAD\x44"
2970                          "\xDB\x4F\xE6\x7D\x14\x88\x1F\xB6"
2971                          "\x2A\xC1\x58\xEF\x63\xFA\x91\x05"
2972                          "\x9C\x33\xCA\x3E\xD5\x6C\x03\x77"
2973                          "\x0E\xA5\x19\xB0\x47\xDE\x52\xE9"
2974                          "\x80\x17\x8B\x22\xB9\x2D\xC4\x5B"
2975                          "\xF2\x66\xFD\x94\x08\x9F\x36\xCD"
2976                          "\x41\xD8\x6F\x06\x7A\x11\xA8\x1C"
2977                          "\xB3\x4A\xE1\x55\xEC\x83\x1A\x8E"
2978                          "\x25\xBC\x30\xC7\x5E\xF5\x69\x00"
2979                          "\x97\x0B\xA2\x39\xD0\x44\xDB\x72"
2980                          "\x09\x7D\x14\xAB\x1F\xB6\x4D\xE4"
2981                          "\x58\xEF\x86\x1D\x91\x28\xBF\x33"
2982                          "\xCA\x61\xF8\x6C\x03\x9A\x0E\xA5"
2983                          "\x3C\xD3\x47\xDE\x75\x0C\x80\x17"
2984                          "\xAE\x22\xB9\x50\xE7\x5B\xF2\x89"
2985                          "\x20\x94\x2B\xC2\x36\xCD\x64\xFB"
2986                          "\x6F\x06\x9D\x11\xA8\x3F\xD6\x4A"
2987                          "\xE1\x78\x0F\x83\x1A\xB1\x25\xBC"
2988                          "\x53\xEA\x5E\xF5\x8C\x00\x97\x2E"
2989                          "\xC5\x39\xD0\x67\xFE\x72\x09\xA0"
2990                          "\x14\xAB\x42\xD9\x4D\xE4\x7B\x12"
2991                          "\x86\x1D\xB4\x28\xBF\x56\xED\x61"
2992                          "\xF8\x8F\x03\x9A\x31\xC8\x3C\xD3"
2993                          "\x6A\x01\x75\x0C\xA3\x17\xAE\x45"
2994                          "\xDC\x50\xE7\x7E\x15\x89\x20\xB7"
2995                          "\x2B\xC2\x59\xF0\x64\xFB\x92\x06",
2996                .rlen   = 504,
2997        },
2998};
2999
3000/*
3001 * Twofish test vectors.
3002 */
3003#define TF_ENC_TEST_VECTORS             4
3004#define TF_DEC_TEST_VECTORS             4
3005#define TF_CBC_ENC_TEST_VECTORS         5
3006#define TF_CBC_DEC_TEST_VECTORS         5
3007#define TF_CTR_ENC_TEST_VECTORS         2
3008#define TF_CTR_DEC_TEST_VECTORS         2
3009#define TF_LRW_ENC_TEST_VECTORS         8
3010#define TF_LRW_DEC_TEST_VECTORS         8
3011#define TF_XTS_ENC_TEST_VECTORS         5
3012#define TF_XTS_DEC_TEST_VECTORS         5
3013
3014static struct cipher_testvec tf_enc_tv_template[] = {
3015        {
3016                .key    = zeroed_string,
3017                .klen   = 16,
3018                .input  = zeroed_string,
3019                .ilen   = 16,
3020                .result = "\x9f\x58\x9f\x5c\xf6\x12\x2c\x32"
3021                          "\xb6\xbf\xec\x2f\x2a\xe8\xc3\x5a",
3022                .rlen   = 16,
3023        }, {
3024                .key    = "\x01\x23\x45\x67\x89\xab\xcd\xef"
3025                          "\xfe\xdc\xba\x98\x76\x54\x32\x10"
3026                          "\x00\x11\x22\x33\x44\x55\x66\x77",
3027                .klen   = 24,
3028                .input  = zeroed_string,
3029                .ilen   = 16,
3030                .result = "\xcf\xd1\xd2\xe5\xa9\xbe\x9c\xdf"
3031                          "\x50\x1f\x13\xb8\x92\xbd\x22\x48",
3032                .rlen   = 16,
3033        }, {
3034                .key    = "\x01\x23\x45\x67\x89\xab\xcd\xef"
3035                          "\xfe\xdc\xba\x98\x76\x54\x32\x10"
3036                          "\x00\x11\x22\x33\x44\x55\x66\x77"
3037                          "\x88\x99\xaa\xbb\xcc\xdd\xee\xff",
3038                .klen   = 32,
3039                .input  = zeroed_string,
3040                .ilen   = 16,
3041                .result = "\x37\x52\x7b\xe0\x05\x23\x34\xb8"
3042                          "\x9f\x0c\xfc\xca\xe8\x7c\xfa\x20",
3043                .rlen   = 16,
3044        }, { /* Generated with Crypto++ */
3045                .key    = "\x3F\x85\x62\x3F\x1C\xF9\xD6\x1C"
3046                          "\xF9\xD6\xB3\x90\x6D\x4A\x90\x6D"
3047                          "\x4A\x27\x04\xE1\x27\x04\xE1\xBE"
3048                          "\x9B\x78\xBE\x9B\x78\x55\x32\x0F",
3049                .klen   = 32,
3050                .input  = "\x56\xED\x84\x1B\x8F\x26\xBD\x31"
3051                          "\xC8\x5F\xF6\x6A\x01\x98\x0C\xA3"
3052                          "\x3A\xD1\x45\xDC\x73\x0A\x7E\x15"
3053                          "\xAC\x20\xB7\x4E\xE5\x59\xF0\x87"
3054                          "\x1E\x92\x29\xC0\x34\xCB\x62\xF9"
3055                          "\x6D\x04\x9B\x0F\xA6\x3D\xD4\x48"
3056                          "\xDF\x76\x0D\x81\x18\xAF\x23\xBA"
3057                          "\x51\xE8\x5C\xF3\x8A\x21\x95\x2C"
3058                          "\xC3\x37\xCE\x65\xFC\x70\x07\x9E"
3059                          "\x12\xA9\x40\xD7\x4B\xE2\x79\x10"
3060                          "\x84\x1B\xB2\x26\xBD\x54\xEB\x5F"
3061                          "\xF6\x8D\x01\x98\x2F\xC6\x3A\xD1"
3062                          "\x68\xFF\x73\x0A\xA1\x15\xAC\x43"
3063                          "\xDA\x4E\xE5\x7C\x13\x87\x1E\xB5"
3064                          "\x29\xC0\x57\xEE\x62\xF9\x90\x04"
3065                          "\x9B\x32\xC9\x3D\xD4\x6B\x02\x76"
3066                          "\x0D\xA4\x18\xAF\x46\xDD\x51\xE8"
3067                          "\x7F\x16\x8A\x21\xB8\x2C\xC3\x5A"
3068                          "\xF1\x65\xFC\x93\x07\x9E\x35\xCC"
3069                          "\x40\xD7\x6E\x05\x79\x10\xA7\x1B"
3070                          "\xB2\x49\xE0\x54\xEB\x82\x19\x8D"
3071                          "\x24\xBB\x2F\xC6\x5D\xF4\x68\xFF"
3072                          "\x96\x0A\xA1\x38\xCF\x43\xDA\x71"
3073                          "\x08\x7C\x13\xAA\x1E\xB5\x4C\xE3"
3074                          "\x57\xEE\x85\x1C\x90\x27\xBE\x32"
3075                          "\xC9\x60\xF7\x6B\x02\x99\x0D\xA4"
3076                          "\x3B\xD2\x46\xDD\x74\x0B\x7F\x16"
3077                          "\xAD\x21\xB8\x4F\xE6\x5A\xF1\x88"
3078                          "\x1F\x93\x2A\xC1\x35\xCC\x63\xFA"
3079                          "\x6E\x05\x9C\x10\xA7\x3E\xD5\x49"
3080                          "\xE0\x77\x0E\x82\x19\xB0\x24\xBB"
3081                          "\x52\xE9\x5D\xF4\x8B\x22\x96\x2D"
3082                          "\xC4\x38\xCF\x66\xFD\x71\x08\x9F"
3083                          "\x13\xAA\x41\xD8\x4C\xE3\x7A\x11"
3084                          "\x85\x1C\xB3\x27\xBE\x55\xEC\x60"
3085                          "\xF7\x8E\x02\x99\x30\xC7\x3B\xD2"
3086                          "\x69\x00\x74\x0B\xA2\x16\xAD\x44"
3087                          "\xDB\x4F\xE6\x7D\x14\x88\x1F\xB6"
3088                          "\x2A\xC1\x58\xEF\x63\xFA\x91\x05"
3089                          "\x9C\x33\xCA\x3E\xD5\x6C\x03\x77"
3090                          "\x0E\xA5\x19\xB0\x47\xDE\x52\xE9"
3091                          "\x80\x17\x8B\x22\xB9\x2D\xC4\x5B"
3092                          "\xF2\x66\xFD\x94\x08\x9F\x36\xCD"
3093                          "\x41\xD8\x6F\x06\x7A\x11\xA8\x1C"
3094                          "\xB3\x4A\xE1\x55\xEC\x83\x1A\x8E"
3095                          "\x25\xBC\x30\xC7\x5E\xF5\x69\x00"
3096                          "\x97\x0B\xA2\x39\xD0\x44\xDB\x72"
3097                          "\x09\x7D\x14\xAB\x1F\xB6\x4D\xE4"
3098                          "\x58\xEF\x86\x1D\x91\x28\xBF\x33"
3099                          "\xCA\x61\xF8\x6C\x03\x9A\x0E\xA5"
3100                          "\x3C\xD3\x47\xDE\x75\x0C\x80\x17"
3101                          "\xAE\x22\xB9\x50\xE7\x5B\xF2\x89"
3102                          "\x20\x94\x2B\xC2\x36\xCD\x64\xFB"
3103                          "\x6F\x06\x9D\x11\xA8\x3F\xD6\x4A"
3104                          "\xE1\x78\x0F\x83\x1A\xB1\x25\xBC"
3105                          "\x53\xEA\x5E\xF5\x8C\x00\x97\x2E"
3106                          "\xC5\x39\xD0\x67\xFE\x72\x09\xA0"
3107                          "\x14\xAB\x42\xD9\x4D\xE4\x7B\x12"
3108                          "\x86\x1D\xB4\x28\xBF\x56\xED\x61"
3109                          "\xF8\x8F\x03\x9A\x31\xC8\x3C\xD3"
3110                          "\x6A\x01\x75\x0C\xA3\x17\xAE\x45"
3111                          "\xDC\x50\xE7\x7E\x15\x89\x20\xB7",
3112                .ilen   = 496,
3113                .result = "\x88\xCB\x1E\xC2\xAF\x8A\x97\xFF"
3114                          "\xF6\x90\x46\x9C\x4A\x0F\x08\xDC"
3115                          "\xDE\xAB\xAD\xFA\xFC\xA8\xC2\x3D"
3116                          "\xE0\xE4\x8B\x3F\xD5\xA3\xF7\x14"
3117                          "\x34\x9E\xB6\x08\xB2\xDD\xA8\xF5"
3118                          "\xDF\xFA\xC7\xE8\x09\x50\x76\x08"
3119                          "\xA2\xB6\x6A\x59\xC0\x2B\x6D\x05"
3120                          "\x89\xF6\x82\xF0\xD3\xDB\x06\x02"
3121                          "\xB5\x11\x5C\x5E\x79\x1A\xAC\x43"
3122                          "\x5C\xC0\x30\x4B\x6B\x16\xA1\x40"
3123                          "\x80\x27\x88\xBA\x2C\x74\x42\xE0"
3124                          "\x1B\xA5\x85\x08\xB9\xE6\x22\x7A"
3125                          "\x36\x3B\x0D\x9F\xA0\x22\x6C\x2A"
3126                          "\x91\x75\x47\xBC\x67\x21\x4E\xF9"
3127                          "\xEA\xFF\xD9\xD5\xC0\xFC\x9E\x2C"
3128                          "\x3E\xAD\xC6\x61\x0E\x93\x7A\x22"
3129                          "\x09\xC8\x8D\xC1\x8E\xB4\x8B\x5C"
3130                          "\xC6\x24\x42\xB8\x23\x66\x80\xA9"
3131                          "\x32\x0B\x7A\x29\xBF\xB3\x0B\x63"
3132                          "\x43\x27\x13\xA9\xBE\xEB\xBD\xF3"
3133                          "\x33\x62\x70\xE2\x1B\x86\x7A\xA1"
3134                          "\x51\x4A\x16\xFE\x29\x63\x7E\xD0"
3135                          "\x7A\xA4\x6E\x2C\xF8\xC1\xDB\xE8"
3136                          "\xCB\x4D\xD2\x8C\x04\x14\xB4\x66"
3137                          "\x41\xB7\x3A\x96\x16\x7C\x1D\x5B"
3138                          "\xB6\x41\x42\x64\x43\xEE\x6E\x7C"
3139                          "\x8B\xAF\x01\x9C\xA4\x6E\x75\x8F"
3140                          "\xDE\x10\x9F\xA6\xE7\xD6\x44\x97"
3141                          "\x66\xA3\x96\x0F\x1C\x25\x60\xF5"
3142                          "\x3C\x2E\x32\x69\x0E\x82\xFF\x27"
3143                          "\x0F\xB5\x06\xDA\xD8\x31\x15\x6C"
3144                          "\xDF\x18\x6C\x87\xF5\x3B\x11\x9A"
3145                          "\x1B\x42\x1F\x5B\x29\x19\x96\x13"
3146                          "\x68\x2E\x5E\x08\x1C\x8F\x32\x4B"
3147                          "\x81\x77\x6D\xF4\xA0\x01\x42\xEC"
3148                          "\xDD\x5B\xFD\x3A\x8E\x6A\x14\xFB"
3149                          "\x83\x54\xDF\x0F\x86\xB7\xEA\x40"
3150                          "\x46\x39\xF7\x2A\x89\x8D\x4E\x96"
3151                          "\x5F\x5F\x6D\x76\xC6\x13\x9D\x3D"
3152                          "\x1D\x5F\x0C\x7D\xE2\xBC\xC2\x16"
3153                          "\x16\xBE\x89\x3E\xB0\x61\xA2\x5D"
3154                          "\xAF\xD1\x40\x5F\x1A\xB8\x26\x41"
3155                          "\xC6\xBD\x36\xEF\xED\x29\x50\x6D"
3156                          "\x10\xEF\x26\xE8\xA8\x93\x11\x3F"
3157                          "\x2D\x1F\x88\x20\x77\x45\xF5\x66"
3158                          "\x08\xB9\xF1\xEF\xB1\x93\xA8\x81"
3159                          "\x65\xC5\xCD\x3E\x8C\x06\x60\x2C"
3160                          "\xB2\x10\x7A\xCA\x05\x25\x59\xDB"
3161                          "\xC7\x28\xF5\x20\x35\x52\x9E\x62"
3162                          "\xF8\x88\x24\x1C\x4D\x84\x12\x39"
3163                          "\x39\xE4\x2E\xF4\xD4\x9D\x2B\xBC"
3164                          "\x87\x66\xE6\xC0\x6B\x31\x9A\x66"
3165                          "\x03\xDC\x95\xD8\x6B\xD0\x30\x8F"
3166                          "\xDF\x8F\x8D\xFA\xEC\x1F\x08\xBD"
3167                          "\xA3\x63\xE2\x71\x4F\x03\x94\x87"
3168                          "\x50\xDF\x15\x1F\xED\x3A\xA3\x7F"
3169                          "\x1F\x2A\xB5\xA1\x69\xAC\x4B\x0D"
3170                          "\x84\x9B\x2A\xE9\x55\xDD\x46\x91"
3171                          "\x15\x33\xF3\x2B\x9B\x46\x97\x00"
3172                          "\xF0\x29\xD8\x59\x5D\x33\x37\xF9"
3173                          "\x58\x33\x9B\x78\xC7\x58\x48\x6B"
3174                          "\x2C\x75\x64\xC4\xCA\xC1\x7E\xD5",
3175                .rlen   = 496,
3176                .also_non_np = 1,
3177                .np     = 2,
3178                .tap    = { 496 - 16, 16 },
3179        },
3180};
3181
3182static struct cipher_testvec tf_dec_tv_template[] = {
3183        {
3184                .key    = zeroed_string,
3185                .klen   = 16,
3186                .input  = "\x9f\x58\x9f\x5c\xf6\x12\x2c\x32"
3187                          "\xb6\xbf\xec\x2f\x2a\xe8\xc3\x5a",
3188                .ilen   = 16,
3189                .result = zeroed_string,
3190                .rlen   = 16,
3191        }, {
3192                .key    = "\x01\x23\x45\x67\x89\xab\xcd\xef"
3193                          "\xfe\xdc\xba\x98\x76\x54\x32\x10"
3194                          "\x00\x11\x22\x33\x44\x55\x66\x77",
3195                .klen   = 24,
3196                .input  = "\xcf\xd1\xd2\xe5\xa9\xbe\x9c\xdf"
3197                          "\x50\x1f\x13\xb8\x92\xbd\x22\x48",
3198                .ilen   = 16,
3199                .result = zeroed_string,
3200                .rlen   = 16,
3201        }, {
3202                .key    = "\x01\x23\x45\x67\x89\xab\xcd\xef"
3203                          "\xfe\xdc\xba\x98\x76\x54\x32\x10"
3204                          "\x00\x11\x22\x33\x44\x55\x66\x77"
3205                          "\x88\x99\xaa\xbb\xcc\xdd\xee\xff",
3206                .klen   = 32,
3207                .input  = "\x37\x52\x7b\xe0\x05\x23\x34\xb8"
3208                          "\x9f\x0c\xfc\xca\xe8\x7c\xfa\x20",
3209                .ilen   = 16,
3210                .result = zeroed_string,
3211                .rlen   = 16,
3212        }, { /* Generated with Crypto++ */
3213                .key    = "\x3F\x85\x62\x3F\x1C\xF9\xD6\x1C"
3214                          "\xF9\xD6\xB3\x90\x6D\x4A\x90\x6D"
3215                          "\x4A\x27\x04\xE1\x27\x04\xE1\xBE"
3216                          "\x9B\x78\xBE\x9B\x78\x55\x32\x0F",
3217                .klen   = 32,
3218                .input  = "\x88\xCB\x1E\xC2\xAF\x8A\x97\xFF"
3219                          "\xF6\x90\x46\x9C\x4A\x0F\x08\xDC"
3220                          "\xDE\xAB\xAD\xFA\xFC\xA8\xC2\x3D"
3221                          "\xE0\xE4\x8B\x3F\xD5\xA3\xF7\x14"
3222                          "\x34\x9E\xB6\x08\xB2\xDD\xA8\xF5"
3223                          "\xDF\xFA\xC7\xE8\x09\x50\x76\x08"
3224                          "\xA2\xB6\x6A\x59\xC0\x2B\x6D\x05"
3225                          "\x89\xF6\x82\xF0\xD3\xDB\x06\x02"
3226                          "\xB5\x11\x5C\x5E\x79\x1A\xAC\x43"
3227                          "\x5C\xC0\x30\x4B\x6B\x16\xA1\x40"
3228                          "\x80\x27\x88\xBA\x2C\x74\x42\xE0"
3229                          "\x1B\xA5\x85\x08\xB9\xE6\x22\x7A"
3230                          "\x36\x3B\x0D\x9F\xA0\x22\x6C\x2A"
3231                          "\x91\x75\x47\xBC\x67\x21\x4E\xF9"
3232                          "\xEA\xFF\xD9\xD5\xC0\xFC\x9E\x2C"
3233                          "\x3E\xAD\xC6\x61\x0E\x93\x7A\x22"
3234                          "\x09\xC8\x8D\xC1\x8E\xB4\x8B\x5C"
3235                          "\xC6\x24\x42\xB8\x23\x66\x80\xA9"
3236                          "\x32\x0B\x7A\x29\xBF\xB3\x0B\x63"
3237                          "\x43\x27\x13\xA9\xBE\xEB\xBD\xF3"
3238                          "\x33\x62\x70\xE2\x1B\x86\x7A\xA1"
3239                          "\x51\x4A\x16\xFE\x29\x63\x7E\xD0"
3240                          "\x7A\xA4\x6E\x2C\xF8\xC1\xDB\xE8"
3241                          "\xCB\x4D\xD2\x8C\x04\x14\xB4\x66"
3242                          "\x41\xB7\x3A\x96\x16\x7C\x1D\x5B"
3243                          "\xB6\x41\x42\x64\x43\xEE\x6E\x7C"
3244                          "\x8B\xAF\x01\x9C\xA4\x6E\x75\x8F"
3245                          "\xDE\x10\x9F\xA6\xE7\xD6\x44\x97"
3246                          "\x66\xA3\x96\x0F\x1C\x25\x60\xF5"
3247                          "\x3C\x2E\x32\x69\x0E\x82\xFF\x27"
3248                          "\x0F\xB5\x06\xDA\xD8\x31\x15\x6C"
3249                          "\xDF\x18\x6C\x87\xF5\x3B\x11\x9A"
3250                          "\x1B\x42\x1F\x5B\x29\x19\x96\x13"
3251                          "\x68\x2E\x5E\x08\x1C\x8F\x32\x4B"
3252                          "\x81\x77\x6D\xF4\xA0\x01\x42\xEC"
3253                          "\xDD\x5B\xFD\x3A\x8E\x6A\x14\xFB"
3254                          "\x83\x54\xDF\x0F\x86\xB7\xEA\x40"
3255                          "\x46\x39\xF7\x2A\x89\x8D\x4E\x96"
3256                          "\x5F\x5F\x6D\x76\xC6\x13\x9D\x3D"
3257                          "\x1D\x5F\x0C\x7D\xE2\xBC\xC2\x16"
3258                          "\x16\xBE\x89\x3E\xB0\x61\xA2\x5D"
3259                          "\xAF\xD1\x40\x5F\x1A\xB8\x26\x41"
3260                          "\xC6\xBD\x36\xEF\xED\x29\x50\x6D"
3261                          "\x10\xEF\x26\xE8\xA8\x93\x11\x3F"
3262                          "\x2D\x1F\x88\x20\x77\x45\xF5\x66"
3263                          "\x08\xB9\xF1\xEF\xB1\x93\xA8\x81"
3264                          "\x65\xC5\xCD\x3E\x8C\x06\x60\x2C"
3265                          "\xB2\x10\x7A\xCA\x05\x25\x59\xDB"
3266                          "\xC7\x28\xF5\x20\x35\x52\x9E\x62"
3267                          "\xF8\x88\x24\x1C\x4D\x84\x12\x39"
3268                          "\x39\xE4\x2E\xF4\xD4\x9D\x2B\xBC"
3269                          "\x87\x66\xE6\xC0\x6B\x31\x9A\x66"
3270                          "\x03\xDC\x95\xD8\x6B\xD0\x30\x8F"
3271                          "\xDF\x8F\x8D\xFA\xEC\x1F\x08\xBD"
3272                          "\xA3\x63\xE2\x71\x4F\x03\x94\x87"
3273                          "\x50\xDF\x15\x1F\xED\x3A\xA3\x7F"
3274                          "\x1F\x2A\xB5\xA1\x69\xAC\x4B\x0D"
3275                          "\x84\x9B\x2A\xE9\x55\xDD\x46\x91"
3276                          "\x15\x33\xF3\x2B\x9B\x46\x97\x00"
3277                          "\xF0\x29\xD8\x59\x5D\x33\x37\xF9"
3278                          "\x58\x33\x9B\x78\xC7\x58\x48\x6B"
3279                          "\x2C\x75\x64\xC4\xCA\xC1\x7E\xD5",
3280                .ilen   = 496,
3281                .result = "\x56\xED\x84\x1B\x8F\x26\xBD\x31"
3282                          "\xC8\x5F\xF6\x6A\x01\x98\x0C\xA3"
3283                          "\x3A\xD1\x45\xDC\x73\x0A\x7E\x15"
3284                          "\xAC\x20\xB7\x4E\xE5\x59\xF0\x87"
3285                          "\x1E\x92\x29\xC0\x34\xCB\x62\xF9"
3286                          "\x6D\x04\x9B\x0F\xA6\x3D\xD4\x48"
3287                          "\xDF\x76\x0D\x81\x18\xAF\x23\xBA"
3288                          "\x51\xE8\x5C\xF3\x8A\x21\x95\x2C"
3289                          "\xC3\x37\xCE\x65\xFC\x70\x07\x9E"
3290                          "\x12\xA9\x40\xD7\x4B\xE2\x79\x10"
3291                          "\x84\x1B\xB2\x26\xBD\x54\xEB\x5F"
3292                          "\xF6\x8D\x01\x98\x2F\xC6\x3A\xD1"
3293                          "\x68\xFF\x73\x0A\xA1\x15\xAC\x43"
3294                          "\xDA\x4E\xE5\x7C\x13\x87\x1E\xB5"
3295                          "\x29\xC0\x57\xEE\x62\xF9\x90\x04"
3296                          "\x9B\x32\xC9\x3D\xD4\x6B\x02\x76"
3297                          "\x0D\xA4\x18\xAF\x46\xDD\x51\xE8"
3298                          "\x7F\x16\x8A\x21\xB8\x2C\xC3\x5A"
3299                          "\xF1\x65\xFC\x93\x07\x9E\x35\xCC"
3300                          "\x40\xD7\x6E\x05\x79\x10\xA7\x1B"
3301                          "\xB2\x49\xE0\x54\xEB\x82\x19\x8D"
3302                          "\x24\xBB\x2F\xC6\x5D\xF4\x68\xFF"
3303                          "\x96\x0A\xA1\x38\xCF\x43\xDA\x71"
3304                          "\x08\x7C\x13\xAA\x1E\xB5\x4C\xE3"
3305                          "\x57\xEE\x85\x1C\x90\x27\xBE\x32"
3306                          "\xC9\x60\xF7\x6B\x02\x99\x0D\xA4"
3307                          "\x3B\xD2\x46\xDD\x74\x0B\x7F\x16"
3308                          "\xAD\x21\xB8\x4F\xE6\x5A\xF1\x88"
3309                          "\x1F\x93\x2A\xC1\x35\xCC\x63\xFA"
3310                          "\x6E\x05\x9C\x10\xA7\x3E\xD5\x49"
3311                          "\xE0\x77\x0E\x82\x19\xB0\x24\xBB"
3312                          "\x52\xE9\x5D\xF4\x8B\x22\x96\x2D"
3313                          "\xC4\x38\xCF\x66\xFD\x71\x08\x9F"
3314                          "\x13\xAA\x41\xD8\x4C\xE3\x7A\x11"
3315                          "\x85\x1C\xB3\x27\xBE\x55\xEC\x60"
3316                          "\xF7\x8E\x02\x99\x30\xC7\x3B\xD2"
3317                          "\x69\x00\x74\x0B\xA2\x16\xAD\x44"
3318                          "\xDB\x4F\xE6\x7D\x14\x88\x1F\xB6"
3319                          "\x2A\xC1\x58\xEF\x63\xFA\x91\x05"
3320                          "\x9C\x33\xCA\x3E\xD5\x6C\x03\x77"
3321                          "\x0E\xA5\x19\xB0\x47\xDE\x52\xE9"
3322                          "\x80\x17\x8B\x22\xB9\x2D\xC4\x5B"
3323                          "\xF2\x66\xFD\x94\x08\x9F\x36\xCD"
3324                          "\x41\xD8\x6F\x06\x7A\x11\xA8\x1C"
3325                          "\xB3\x4A\xE1\x55\xEC\x83\x1A\x8E"
3326                          "\x25\xBC\x30\xC7\x5E\xF5\x69\x00"
3327                          "\x97\x0B\xA2\x39\xD0\x44\xDB\x72"
3328                          "\x09\x7D\x14\xAB\x1F\xB6\x4D\xE4"
3329                          "\x58\xEF\x86\x1D\x91\x28\xBF\x33"
3330                          "\xCA\x61\xF8\x6C\x03\x9A\x0E\xA5"
3331                          "\x3C\xD3\x47\xDE\x75\x0C\x80\x17"
3332                          "\xAE\x22\xB9\x50\xE7\x5B\xF2\x89"
3333                          "\x20\x94\x2B\xC2\x36\xCD\x64\xFB"
3334                          "\x6F\x06\x9D\x11\xA8\x3F\xD6\x4A"
3335                          "\xE1\x78\x0F\x83\x1A\xB1\x25\xBC"
3336                          "\x53\xEA\x5E\xF5\x8C\x00\x97\x2E"
3337                          "\xC5\x39\xD0\x67\xFE\x72\x09\xA0"
3338                          "\x14\xAB\x42\xD9\x4D\xE4\x7B\x12"
3339                          "\x86\x1D\xB4\x28\xBF\x56\xED\x61"
3340                          "\xF8\x8F\x03\x9A\x31\xC8\x3C\xD3"
3341                          "\x6A\x01\x75\x0C\xA3\x17\xAE\x45"
3342                          "\xDC\x50\xE7\x7E\x15\x89\x20\xB7",
3343                .rlen   = 496,
3344                .also_non_np = 1,
3345                .np     = 2,
3346                .tap    = { 496 - 16, 16 },
3347        },
3348};
3349
3350static struct cipher_testvec tf_cbc_enc_tv_template[] = {
3351        { /* Generated with Nettle */
3352                .key    = zeroed_string,
3353                .klen   = 16,
3354                .iv     = zeroed_string,
3355                .input  = zeroed_string,
3356                .ilen   = 16,
3357                .result = "\x9f\x58\x9f\x5c\xf6\x12\x2c\x32"
3358                          "\xb6\xbf\xec\x2f\x2a\xe8\xc3\x5a",
3359                .rlen   = 16,
3360        }, {
3361                .key    = zeroed_string,
3362                .klen   = 16,
3363                .iv     = "\x9f\x58\x9f\x5c\xf6\x12\x2c\x32"
3364                          "\xb6\xbf\xec\x2f\x2a\xe8\xc3\x5a",
3365                .input  = zeroed_string,
3366                .ilen   = 16,
3367                .result = "\xd4\x91\xdb\x16\xe7\xb1\xc3\x9e"
3368                          "\x86\xcb\x08\x6b\x78\x9f\x54\x19",
3369                .rlen   = 16,
3370        }, {
3371                .key    = zeroed_string,
3372                .klen   = 16,
3373                .iv     = "\xd4\x91\xdb\x16\xe7\xb1\xc3\x9e"
3374                          "\x86\xcb\x08\x6b\x78\x9f\x54\x19",
3375                .input  = zeroed_string,
3376                .ilen   = 16,
3377                .result = "\x05\xef\x8c\x61\xa8\x11\x58\x26"
3378                          "\x34\xba\x5c\xb7\x10\x6a\xa6\x41",
3379                .rlen   = 16,
3380        }, {
3381                .key    = zeroed_string,
3382                .klen   = 16,
3383                .iv     = zeroed_string,
3384                .input  = zeroed_string,
3385                .ilen   = 48,
3386                .result = "\x9f\x58\x9f\x5c\xf6\x12\x2c\x32"
3387                          "\xb6\xbf\xec\x2f\x2a\xe8\xc3\x5a"
3388                          "\xd4\x91\xdb\x16\xe7\xb1\xc3\x9e"
3389                          "\x86\xcb\x08\x6b\x78\x9f\x54\x19"
3390                          "\x05\xef\x8c\x61\xa8\x11\x58\x26"
3391                          "\x34\xba\x5c\xb7\x10\x6a\xa6\x41",
3392                .rlen   = 48,
3393        }, { /* Generated with Crypto++ */
3394                .key    = "\x85\x62\x3F\x1C\xF9\xD6\x1C\xF9"
3395                          "\xD6\xB3\x90\x6D\x4A\x90\x6D\x4A"
3396                          "\x27\x04\xE1\x27\x04\xE1\xBE\x9B"
3397                          "\x78\xBE\x9B\x78\x55\x32\x0F\x55",
3398                .klen   = 32,
3399                .iv     = "\xE2\x24\x89\xEE\x53\xB8\x1D\x5F"
3400                          "\xC4\x29\x8E\xF3\x35\x9A\xFF\x64",
3401                .input  = "\x56\xED\x84\x1B\x8F\x26\xBD\x31"
3402                          "\xC8\x5F\xF6\x6A\x01\x98\x0C\xA3"
3403                          "\x3A\xD1\x45\xDC\x73\x0A\x7E\x15"
3404                          "\xAC\x20\xB7\x4E\xE5\x59\xF0\x87"
3405                          "\x1E\x92\x29\xC0\x34\xCB\x62\xF9"
3406                          "\x6D\x04\x9B\x0F\xA6\x3D\xD4\x48"
3407                          "\xDF\x76\x0D\x81\x18\xAF\x23\xBA"
3408                          "\x51\xE8\x5C\xF3\x8A\x21\x95\x2C"
3409                          "\xC3\x37\xCE\x65\xFC\x70\x07\x9E"
3410                          "\x12\xA9\x40\xD7\x4B\xE2\x79\x10"
3411                          "\x84\x1B\xB2\x26\xBD\x54\xEB\x5F"
3412                          "\xF6\x8D\x01\x98\x2F\xC6\x3A\xD1"
3413                          "\x68\xFF\x73\x0A\xA1\x15\xAC\x43"
3414                          "\xDA\x4E\xE5\x7C\x13\x87\x1E\xB5"
3415                          "\x29\xC0\x57\xEE\x62\xF9\x90\x04"
3416                          "\x9B\x32\xC9\x3D\xD4\x6B\x02\x76"
3417                          "\x0D\xA4\x18\xAF\x46\xDD\x51\xE8"
3418                          "\x7F\x16\x8A\x21\xB8\x2C\xC3\x5A"
3419                          "\xF1\x65\xFC\x93\x07\x9E\x35\xCC"
3420                          "\x40\xD7\x6E\x05\x79\x10\xA7\x1B"
3421                          "\xB2\x49\xE0\x54\xEB\x82\x19\x8D"
3422                          "\x24\xBB\x2F\xC6\x5D\xF4\x68\xFF"
3423                          "\x96\x0A\xA1\x38\xCF\x43\xDA\x71"
3424                          "\x08\x7C\x13\xAA\x1E\xB5\x4C\xE3"
3425                          "\x57\xEE\x85\x1C\x90\x27\xBE\x32"
3426                          "\xC9\x60\xF7\x6B\x02\x99\x0D\xA4"
3427                          "\x3B\xD2\x46\xDD\x74\x0B\x7F\x16"
3428                          "\xAD\x21\xB8\x4F\xE6\x5A\xF1\x88"
3429                          "\x1F\x93\x2A\xC1\x35\xCC\x63\xFA"
3430                          "\x6E\x05\x9C\x10\xA7\x3E\xD5\x49"
3431                          "\xE0\x77\x0E\x82\x19\xB0\x24\xBB"
3432                          "\x52\xE9\x5D\xF4\x8B\x22\x96\x2D"
3433                          "\xC4\x38\xCF\x66\xFD\x71\x08\x9F"
3434                          "\x13\xAA\x41\xD8\x4C\xE3\x7A\x11"
3435                          "\x85\x1C\xB3\x27\xBE\x55\xEC\x60"
3436                          "\xF7\x8E\x02\x99\x30\xC7\x3B\xD2"
3437                          "\x69\x00\x74\x0B\xA2\x16\xAD\x44"
3438                          "\xDB\x4F\xE6\x7D\x14\x88\x1F\xB6"
3439                          "\x2A\xC1\x58\xEF\x63\xFA\x91\x05"
3440                          "\x9C\x33\xCA\x3E\xD5\x6C\x03\x77"
3441                          "\x0E\xA5\x19\xB0\x47\xDE\x52\xE9"
3442                          "\x80\x17\x8B\x22\xB9\x2D\xC4\x5B"
3443                          "\xF2\x66\xFD\x94\x08\x9F\x36\xCD"
3444                          "\x41\xD8\x6F\x06\x7A\x11\xA8\x1C"
3445                          "\xB3\x4A\xE1\x55\xEC\x83\x1A\x8E"
3446                          "\x25\xBC\x30\xC7\x5E\xF5\x69\x00"
3447                          "\x97\x0B\xA2\x39\xD0\x44\xDB\x72"
3448                          "\x09\x7D\x14\xAB\x1F\xB6\x4D\xE4"
3449                          "\x58\xEF\x86\x1D\x91\x28\xBF\x33"
3450                          "\xCA\x61\xF8\x6C\x03\x9A\x0E\xA5"
3451                          "\x3C\xD3\x47\xDE\x75\x0C\x80\x17"
3452                          "\xAE\x22\xB9\x50\xE7\x5B\xF2\x89"
3453                          "\x20\x94\x2B\xC2\x36\xCD\x64\xFB"
3454                          "\x6F\x06\x9D\x11\xA8\x3F\xD6\x4A"
3455                          "\xE1\x78\x0F\x83\x1A\xB1\x25\xBC"
3456                          "\x53\xEA\x5E\xF5\x8C\x00\x97\x2E"
3457                          "\xC5\x39\xD0\x67\xFE\x72\x09\xA0"
3458                          "\x14\xAB\x42\xD9\x4D\xE4\x7B\x12"
3459                          "\x86\x1D\xB4\x28\xBF\x56\xED\x61"
3460                          "\xF8\x8F\x03\x9A\x31\xC8\x3C\xD3"
3461                          "\x6A\x01\x75\x0C\xA3\x17\xAE\x45"
3462                          "\xDC\x50\xE7\x7E\x15\x89\x20\xB7",
3463                .ilen   = 496,
3464                .result = "\xC8\xFF\xF2\x53\xA6\x27\x09\xD1"
3465                          "\x33\x38\xC2\xC0\x0C\x14\x7E\xB5"
3466                          "\x26\x1B\x05\x0C\x05\x12\x3F\xC0"
3467                          "\xF9\x1C\x02\x28\x40\x96\x6F\xD0"
3468                          "\x3D\x32\xDF\xDA\x56\x00\x6E\xEE"
3469                          "\x5B\x2A\x72\x9D\xC2\x4D\x19\xBC"
3470                          "\x8C\x53\xFA\x87\x6F\xDD\x81\xA3"
3471                          "\xB1\xD3\x44\x65\xDF\xE7\x63\x38"
3472                          "\x4A\xFC\xDC\xEC\x3F\x26\x8E\xB8"
3473                          "\x43\xFC\xFE\x18\xB5\x11\x6D\x31"
3474                          "\x81\x8B\x0D\x75\xF6\x80\xEC\x84"
3475                          "\x04\xB9\xE6\x09\x63\xED\x39\xDB"
3476                          "\xC3\xF6\x14\xD6\x6E\x5E\x8B\xBD"
3477                          "\x3E\xFA\xD7\x98\x50\x6F\xD9\x63"
3478                          "\x02\xCD\x0D\x39\x4B\x0D\xEC\x80"
3479                          "\xE3\x6A\x17\xF4\xCC\xAD\xFF\x68"
3480                          "\x45\xDD\xC8\x83\x1D\x41\x96\x0D"
3481                          "\x91\x2E\x05\xD3\x59\x82\xE0\x43"
3482                          "\x90\x4F\xB9\xF7\xAD\x6B\x2E\xAF"
3483                          "\xA7\x84\x00\x53\xCD\x6F\xD1\x0C"
3484                          "\x4E\xF9\x5A\x23\xFB\xCA\xC7\xD3"
3485                          "\xA9\xAA\x9D\xB2\x3F\x66\xF1\xAC"
3486                          "\x25\x21\x8F\xF7\xEF\xF2\x6A\xDF"
3487                          "\xE8\xDA\x75\x1A\x8A\xF1\xDD\x38"
3488                          "\x1F\xF9\x3D\x68\x4A\xBB\x9E\x34"
3489                          "\x1F\x66\x1F\x9C\x2B\x54\xFF\x60"
3490                          "\x7F\x29\x4B\x55\x80\x8F\x4E\xA7"
3491                          "\xA6\x9A\x0A\xD9\x0D\x19\x00\xF8"
3492                          "\x1F\xBC\x0C\x40\x6B\xEC\x99\x25"
3493                          "\x94\x70\x74\x0E\x1D\xC5\xBC\x12"
3494                          "\xF3\x42\xBE\x95\xBF\xFB\x4E\x55"
3495                          "\x9A\xB9\xCE\x14\x16\x5B\xDC\xD3"
3496                          "\x75\x42\x62\x04\x31\x1F\x95\x7C"
3497                          "\x66\x1A\x97\xDC\x2F\x40\x5C\x39"
3498                          "\x78\xE6\x02\xDB\x49\xE1\xC6\x47"
3499                          "\xC2\x78\x9A\xBB\xF3\xBE\xCB\x93"
3500                          "\xD8\xB8\xE8\xBB\x8C\xB3\x9B\xA7"
3501                          "\xC2\x89\xF3\x91\x88\x83\x3D\xF0"
3502                          "\x29\xA2\xCD\xB5\x79\x16\xC2\x40"
3503                          "\x11\x03\x8E\x9C\xFD\xC9\x43\xC4"
3504                          "\xC2\x19\xF0\x4A\x32\xEF\x0C\x2B"
3505                          "\xD3\x2B\xE9\xD4\x4C\xDE\x95\xCF"
3506                          "\x04\x03\xD3\x2C\x7F\x82\xC8\xFA"
3507                          "\x0F\xD8\x7A\x39\x7B\x01\x41\x9C"
3508                          "\x78\xB6\xC9\xBF\xF9\x78\x57\x88"
3509                          "\xB1\xA5\xE1\xE0\xD9\x16\xD4\xC8"
3510                          "\xEE\xC4\xBE\x7B\x55\x59\x00\x48"
3511                          "\x1B\xBC\x14\xFA\x2A\x9D\xC9\x1C"
3512                          "\xFB\x28\x3F\x95\xDD\xB7\xD6\xCE"
3513                          "\x3A\x7F\x09\x0C\x0E\x69\x30\x7D"
3514                          "\xBC\x68\x9C\x91\x2A\x59\x57\x04"
3515                          "\xED\x1A\x1E\x00\xB1\x85\x92\x04"
3516                          "\x28\x8C\x0C\x3C\xC1\xD5\x12\xF7"
3517                          "\x4C\x3E\xB0\xE7\x86\x62\x68\x91"
3518                          "\xFC\xC4\xE2\xCE\xA6\xDC\x5E\x93"
3519                          "\x5D\x8D\x8C\x68\xB3\xB2\xB9\x64"
3520                          "\x16\xB8\xC8\x6F\xD8\xEE\x21\xBD"
3521                          "\xAC\x18\x0C\x7D\x0D\x05\xAB\xF1"
3522                          "\xFA\xDD\xE2\x48\xDF\x4C\x02\x39"
3523                          "\x69\xA1\x62\xBD\x49\x3A\x9D\x91"
3524                          "\x30\x70\x56\xA4\x37\xDD\x7C\xC0"
3525                          "\x0A\xA3\x30\x10\x26\x25\x41\x2C",
3526                .rlen   = 496,
3527                .also_non_np = 1,
3528                .np     = 2,
3529                .tap    = { 496 - 16, 16 },
3530        },
3531};
3532
3533static struct cipher_testvec tf_cbc_dec_tv_template[] = {
3534        { /* Reverse of the first four above */
3535                .key    = zeroed_string,
3536                .klen   = 16,
3537                .iv     = zeroed_string,
3538                .input  = "\x9f\x58\x9f\x5c\xf6\x12\x2c\x32"
3539                          "\xb6\xbf\xec\x2f\x2a\xe8\xc3\x5a",
3540                .ilen   = 16,
3541                .result = zeroed_string,
3542                .rlen   = 16,
3543        }, {
3544                .key    = zeroed_string,
3545                .klen   = 16,
3546                .iv     = "\x9f\x58\x9f\x5c\xf6\x12\x2c\x32"
3547                          "\xb6\xbf\xec\x2f\x2a\xe8\xc3\x5a",
3548                .input  = "\xd4\x91\xdb\x16\xe7\xb1\xc3\x9e"
3549                          "\x86\xcb\x08\x6b\x78\x9f\x54\x19",
3550                .ilen   = 16,
3551                .result = zeroed_string,
3552                .rlen   = 16,
3553        }, {
3554                .key    = zeroed_string,
3555                .klen   = 16,
3556                .iv     = "\xd4\x91\xdb\x16\xe7\xb1\xc3\x9e"
3557                          "\x86\xcb\x08\x6b\x78\x9f\x54\x19",
3558                .input  = "\x05\xef\x8c\x61\xa8\x11\x58\x26"
3559                          "\x34\xba\x5c\xb7\x10\x6a\xa6\x41",
3560                .ilen   = 16,
3561                .result = zeroed_string,
3562                .rlen   = 16,
3563        }, {
3564                .key    = zeroed_string,
3565                .klen   = 16,
3566                .iv     = zeroed_string,
3567                .input  = "\x9f\x58\x9f\x5c\xf6\x12\x2c\x32"
3568                          "\xb6\xbf\xec\x2f\x2a\xe8\xc3\x5a"
3569                          "\xd4\x91\xdb\x16\xe7\xb1\xc3\x9e"
3570                          "\x86\xcb\x08\x6b\x78\x9f\x54\x19"
3571                          "\x05\xef\x8c\x61\xa8\x11\x58\x26"
3572                          "\x34\xba\x5c\xb7\x10\x6a\xa6\x41",
3573                .ilen   = 48,
3574                .result = zeroed_string,
3575                .rlen   = 48,
3576        }, { /* Generated with Crypto++ */
3577                .key    = "\x85\x62\x3F\x1C\xF9\xD6\x1C\xF9"
3578                          "\xD6\xB3\x90\x6D\x4A\x90\x6D\x4A"
3579                          "\x27\x04\xE1\x27\x04\xE1\xBE\x9B"
3580                          "\x78\xBE\x9B\x78\x55\x32\x0F\x55",
3581                .klen   = 32,
3582                .iv     = "\xE2\x24\x89\xEE\x53\xB8\x1D\x5F"
3583                          "\xC4\x29\x8E\xF3\x35\x9A\xFF\x64",
3584                .input  = "\xC8\xFF\xF2\x53\xA6\x27\x09\xD1"
3585                          "\x33\x38\xC2\xC0\x0C\x14\x7E\xB5"
3586                          "\x26\x1B\x05\x0C\x05\x12\x3F\xC0"
3587                          "\xF9\x1C\x02\x28\x40\x96\x6F\xD0"
3588                          "\x3D\x32\xDF\xDA\x56\x00\x6E\xEE"
3589                          "\x5B\x2A\x72\x9D\xC2\x4D\x19\xBC"
3590                          "\x8C\x53\xFA\x87\x6F\xDD\x81\xA3"
3591                          "\xB1\xD3\x44\x65\xDF\xE7\x63\x38"
3592                          "\x4A\xFC\xDC\xEC\x3F\x26\x8E\xB8"
3593                          "\x43\xFC\xFE\x18\xB5\x11\x6D\x31"
3594                          "\x81\x8B\x0D\x75\xF6\x80\xEC\x84"
3595                          "\x04\xB9\xE6\x09\x63\xED\x39\xDB"
3596                          "\xC3\xF6\x14\xD6\x6E\x5E\x8B\xBD"
3597                          "\x3E\xFA\xD7\x98\x50\x6F\xD9\x63"
3598                          "\x02\xCD\x0D\x39\x4B\x0D\xEC\x80"
3599                          "\xE3\x6A\x17\xF4\xCC\xAD\xFF\x68"
3600                          "\x45\xDD\xC8\x83\x1D\x41\x96\x0D"
3601                          "\x91\x2E\x05\xD3\x59\x82\xE0\x43"
3602                          "\x90\x4F\xB9\xF7\xAD\x6B\x2E\xAF"
3603                          "\xA7\x84\x00\x53\xCD\x6F\xD1\x0C"
3604                          "\x4E\xF9\x5A\x23\xFB\xCA\xC7\xD3"
3605                          "\xA9\xAA\x9D\xB2\x3F\x66\xF1\xAC"
3606                          "\x25\x21\x8F\xF7\xEF\xF2\x6A\xDF"
3607                          "\xE8\xDA\x75\x1A\x8A\xF1\xDD\x38"
3608                          "\x1F\xF9\x3D\x68\x4A\xBB\x9E\x34"
3609                          "\x1F\x66\x1F\x9C\x2B\x54\xFF\x60"
3610                          "\x7F\x29\x4B\x55\x80\x8F\x4E\xA7"
3611                          "\xA6\x9A\x0A\xD9\x0D\x19\x00\xF8"
3612                          "\x1F\xBC\x0C\x40\x6B\xEC\x99\x25"
3613                          "\x94\x70\x74\x0E\x1D\xC5\xBC\x12"
3614                          "\xF3\x42\xBE\x95\xBF\xFB\x4E\x55"
3615                          "\x9A\xB9\xCE\x14\x16\x5B\xDC\xD3"
3616                          "\x75\x42\x62\x04\x31\x1F\x95\x7C"
3617                          "\x66\x1A\x97\xDC\x2F\x40\x5C\x39"
3618                          "\x78\xE6\x02\xDB\x49\xE1\xC6\x47"
3619                          "\xC2\x78\x9A\xBB\xF3\xBE\xCB\x93"
3620                          "\xD8\xB8\xE8\xBB\x8C\xB3\x9B\xA7"
3621                          "\xC2\x89\xF3\x91\x88\x83\x3D\xF0"
3622                          "\x29\xA2\xCD\xB5\x79\x16\xC2\x40"
3623                          "\x11\x03\x8E\x9C\xFD\xC9\x43\xC4"
3624                          "\xC2\x19\xF0\x4A\x32\xEF\x0C\x2B"
3625                          "\xD3\x2B\xE9\xD4\x4C\xDE\x95\xCF"
3626                          "\x04\x03\xD3\x2C\x7F\x82\xC8\xFA"
3627                          "\x0F\xD8\x7A\x39\x7B\x01\x41\x9C"
3628                          "\x78\xB6\xC9\xBF\xF9\x78\x57\x88"
3629                          "\xB1\xA5\xE1\xE0\xD9\x16\xD4\xC8"
3630                          "\xEE\xC4\xBE\x7B\x55\x59\x00\x48"
3631                          "\x1B\xBC\x14\xFA\x2A\x9D\xC9\x1C"
3632                          "\xFB\x28\x3F\x95\xDD\xB7\xD6\xCE"
3633                          "\x3A\x7F\x09\x0C\x0E\x69\x30\x7D"
3634                          "\xBC\x68\x9C\x91\x2A\x59\x57\x04"
3635                          "\xED\x1A\x1E\x00\xB1\x85\x92\x04"
3636                          "\x28\x8C\x0C\x3C\xC1\xD5\x12\xF7"
3637                          "\x4C\x3E\xB0\xE7\x86\x62\x68\x91"
3638                          "\xFC\xC4\xE2\xCE\xA6\xDC\x5E\x93"
3639                          "\x5D\x8D\x8C\x68\xB3\xB2\xB9\x64"
3640                          "\x16\xB8\xC8\x6F\xD8\xEE\x21\xBD"
3641                          "\xAC\x18\x0C\x7D\x0D\x05\xAB\xF1"
3642                          "\xFA\xDD\xE2\x48\xDF\x4C\x02\x39"
3643                          "\x69\xA1\x62\xBD\x49\x3A\x9D\x91"
3644                          "\x30\x70\x56\xA4\x37\xDD\x7C\xC0"
3645                          "\x0A\xA3\x30\x10\x26\x25\x41\x2C",
3646                .ilen   = 496,
3647                .result = "\x56\xED\x84\x1B\x8F\x26\xBD\x31"
3648                          "\xC8\x5F\xF6\x6A\x01\x98\x0C\xA3"
3649                          "\x3A\xD1\x45\xDC\x73\x0A\x7E\x15"
3650                          "\xAC\x20\xB7\x4E\xE5\x59\xF0\x87"
3651                          "\x1E\x92\x29\xC0\x34\xCB\x62\xF9"
3652                          "\x6D\x04\x9B\x0F\xA6\x3D\xD4\x48"
3653                          "\xDF\x76\x0D\x81\x18\xAF\x23\xBA"
3654                          "\x51\xE8\x5C\xF3\x8A\x21\x95\x2C"
3655                          "\xC3\x37\xCE\x65\xFC\x70\x07\x9E"
3656                          "\x12\xA9\x40\xD7\x4B\xE2\x79\x10"
3657                          "\x84\x1B\xB2\x26\xBD\x54\xEB\x5F"
3658                          "\xF6\x8D\x01\x98\x2F\xC6\x3A\xD1"
3659                          "\x68\xFF\x73\x0A\xA1\x15\xAC\x43"
3660                          "\xDA\x4E\xE5\x7C\x13\x87\x1E\xB5"
3661                          "\x29\xC0\x57\xEE\x62\xF9\x90\x04"
3662                          "\x9B\x32\xC9\x3D\xD4\x6B\x02\x76"
3663                          "\x0D\xA4\x18\xAF\x46\xDD\x51\xE8"
3664                          "\x7F\x16\x8A\x21\xB8\x2C\xC3\x5A"
3665                          "\xF1\x65\xFC\x93\x07\x9E\x35\xCC"
3666                          "\x40\xD7\x6E\x05\x79\x10\xA7\x1B"
3667                          "\xB2\x49\xE0\x54\xEB\x82\x19\x8D"
3668                          "\x24\xBB\x2F\xC6\x5D\xF4\x68\xFF"
3669                          "\x96\x0A\xA1\x38\xCF\x43\xDA\x71"
3670                          "\x08\x7C\x13\xAA\x1E\xB5\x4C\xE3"
3671                          "\x57\xEE\x85\x1C\x90\x27\xBE\x32"
3672                          "\xC9\x60\xF7\x6B\x02\x99\x0D\xA4"
3673                          "\x3B\xD2\x46\xDD\x74\x0B\x7F\x16"
3674                          "\xAD\x21\xB8\x4F\xE6\x5A\xF1\x88"
3675                          "\x1F\x93\x2A\xC1\x35\xCC\x63\xFA"
3676                          "\x6E\x05\x9C\x10\xA7\x3E\xD5\x49"
3677                          "\xE0\x77\x0E\x82\x19\xB0\x24\xBB"
3678                          "\x52\xE9\x5D\xF4\x8B\x22\x96\x2D"
3679                          "\xC4\x38\xCF\x66\xFD\x71\x08\x9F"
3680                          "\x13\xAA\x41\xD8\x4C\xE3\x7A\x11"
3681                          "\x85\x1C\xB3\x27\xBE\x55\xEC\x60"
3682                          "\xF7\x8E\x02\x99\x30\xC7\x3B\xD2"
3683                          "\x69\x00\x74\x0B\xA2\x16\xAD\x44"
3684                          "\xDB\x4F\xE6\x7D\x14\x88\x1F\xB6"
3685                          "\x2A\xC1\x58\xEF\x63\xFA\x91\x05"
3686                          "\x9C\x33\xCA\x3E\xD5\x6C\x03\x77"
3687                          "\x0E\xA5\x19\xB0\x47\xDE\x52\xE9"
3688                          "\x80\x17\x8B\x22\xB9\x2D\xC4\x5B"
3689                          "\xF2\x66\xFD\x94\x08\x9F\x36\xCD"
3690                          "\x41\xD8\x6F\x06\x7A\x11\xA8\x1C"
3691                          "\xB3\x4A\xE1\x55\xEC\x83\x1A\x8E"
3692                          "\x25\xBC\x30\xC7\x5E\xF5\x69\x00"
3693                          "\x97\x0B\xA2\x39\xD0\x44\xDB\x72"
3694                          "\x09\x7D\x14\xAB\x1F\xB6\x4D\xE4"
3695                          "\x58\xEF\x86\x1D\x91\x28\xBF\x33"
3696                          "\xCA\x61\xF8\x6C\x03\x9A\x0E\xA5"
3697                          "\x3C\xD3\x47\xDE\x75\x0C\x80\x17"
3698                          "\xAE\x22\xB9\x50\xE7\x5B\xF2\x89"
3699                          "\x20\x94\x2B\xC2\x36\xCD\x64\xFB"
3700                          "\x6F\x06\x9D\x11\xA8\x3F\xD6\x4A"
3701                          "\xE1\x78\x0F\x83\x1A\xB1\x25\xBC"
3702                          "\x53\xEA\x5E\xF5\x8C\x00\x97\x2E"
3703                          "\xC5\x39\xD0\x67\xFE\x72\x09\xA0"
3704                          "\x14\xAB\x42\xD9\x4D\xE4\x7B\x12"
3705                          "\x86\x1D\xB4\x28\xBF\x56\xED\x61"
3706                          "\xF8\x8F\x03\x9A\x31\xC8\x3C\xD3"
3707                          "\x6A\x01\x75\x0C\xA3\x17\xAE\x45"
3708                          "\xDC\x50\xE7\x7E\x15\x89\x20\xB7",
3709                .rlen   = 496,
3710                .also_non_np = 1,
3711                .np     = 2,
3712                .tap    = { 496 - 16, 16 },
3713        },
3714};
3715
3716static struct cipher_testvec tf_ctr_enc_tv_template[] = {
3717        { /* Generated with Crypto++ */
3718                .key    = "\x85\x62\x3F\x1C\xF9\xD6\x1C\xF9"
3719                          "\xD6\xB3\x90\x6D\x4A\x90\x6D\x4A"
3720                          "\x27\x04\xE1\x27\x04\xE1\xBE\x9B"
3721                          "\x78\xBE\x9B\x78\x55\x32\x0F\x55",
3722                .klen   = 32,
3723                .iv     = "\xE2\x24\x89\xEE\x53\xB8\x1D\x5F"
3724                          "\xC4\x29\x8E\xF3\x35\x9A\xFF\x64",
3725                .input  = "\x56\xED\x84\x1B\x8F\x26\xBD\x31"
3726                          "\xC8\x5F\xF6\x6A\x01\x98\x0C\xA3"
3727                          "\x3A\xD1\x45\xDC\x73\x0A\x7E\x15"
3728                          "\xAC\x20\xB7\x4E\xE5\x59\xF0\x87"
3729                          "\x1E\x92\x29\xC0\x34\xCB\x62\xF9"
3730                          "\x6D\x04\x9B\x0F\xA6\x3D\xD4\x48"
3731                          "\xDF\x76\x0D\x81\x18\xAF\x23\xBA"
3732                          "\x51\xE8\x5C\xF3\x8A\x21\x95\x2C"
3733                          "\xC3\x37\xCE\x65\xFC\x70\x07\x9E"
3734                          "\x12\xA9\x40\xD7\x4B\xE2\x79\x10"
3735                          "\x84\x1B\xB2\x26\xBD\x54\xEB\x5F"
3736                          "\xF6\x8D\x01\x98\x2F\xC6\x3A\xD1"
3737                          "\x68\xFF\x73\x0A\xA1\x15\xAC\x43"
3738                          "\xDA\x4E\xE5\x7C\x13\x87\x1E\xB5"
3739                          "\x29\xC0\x57\xEE\x62\xF9\x90\x04"
3740                          "\x9B\x32\xC9\x3D\xD4\x6B\x02\x76"
3741                          "\x0D\xA4\x18\xAF\x46\xDD\x51\xE8"
3742                          "\x7F\x16\x8A\x21\xB8\x2C\xC3\x5A"
3743                          "\xF1\x65\xFC\x93\x07\x9E\x35\xCC"
3744                          "\x40\xD7\x6E\x05\x79\x10\xA7\x1B"
3745                          "\xB2\x49\xE0\x54\xEB\x82\x19\x8D"
3746                          "\x24\xBB\x2F\xC6\x5D\xF4\x68\xFF"
3747                          "\x96\x0A\xA1\x38\xCF\x43\xDA\x71"
3748                          "\x08\x7C\x13\xAA\x1E\xB5\x4C\xE3"
3749                          "\x57\xEE\x85\x1C\x90\x27\xBE\x32"
3750                          "\xC9\x60\xF7\x6B\x02\x99\x0D\xA4"
3751                          "\x3B\xD2\x46\xDD\x74\x0B\x7F\x16"
3752                          "\xAD\x21\xB8\x4F\xE6\x5A\xF1\x88"
3753                          "\x1F\x93\x2A\xC1\x35\xCC\x63\xFA"
3754                          "\x6E\x05\x9C\x10\xA7\x3E\xD5\x49"
3755                          "\xE0\x77\x0E\x82\x19\xB0\x24\xBB"
3756                          "\x52\xE9\x5D\xF4\x8B\x22\x96\x2D"
3757                          "\xC4\x38\xCF\x66\xFD\x71\x08\x9F"
3758                          "\x13\xAA\x41\xD8\x4C\xE3\x7A\x11"
3759                          "\x85\x1C\xB3\x27\xBE\x55\xEC\x60"
3760                          "\xF7\x8E\x02\x99\x30\xC7\x3B\xD2"
3761                          "\x69\x00\x74\x0B\xA2\x16\xAD\x44"
3762                          "\xDB\x4F\xE6\x7D\x14\x88\x1F\xB6"
3763                          "\x2A\xC1\x58\xEF\x63\xFA\x91\x05"
3764                          "\x9C\x33\xCA\x3E\xD5\x6C\x03\x77"
3765                          "\x0E\xA5\x19\xB0\x47\xDE\x52\xE9"
3766                          "\x80\x17\x8B\x22\xB9\x2D\xC4\x5B"
3767                          "\xF2\x66\xFD\x94\x08\x9F\x36\xCD"
3768                          "\x41\xD8\x6F\x06\x7A\x11\xA8\x1C"
3769                          "\xB3\x4A\xE1\x55\xEC\x83\x1A\x8E"
3770                          "\x25\xBC\x30\xC7\x5E\xF5\x69\x00"
3771                          "\x97\x0B\xA2\x39\xD0\x44\xDB\x72"
3772                          "\x09\x7D\x14\xAB\x1F\xB6\x4D\xE4"
3773                          "\x58\xEF\x86\x1D\x91\x28\xBF\x33"
3774                          "\xCA\x61\xF8\x6C\x03\x9A\x0E\xA5"
3775                          "\x3C\xD3\x47\xDE\x75\x0C\x80\x17"
3776                          "\xAE\x22\xB9\x50\xE7\x5B\xF2\x89"
3777                          "\x20\x94\x2B\xC2\x36\xCD\x64\xFB"
3778                          "\x6F\x06\x9D\x11\xA8\x3F\xD6\x4A"
3779                          "\xE1\x78\x0F\x83\x1A\xB1\x25\xBC"
3780                          "\x53\xEA\x5E\xF5\x8C\x00\x97\x2E"
3781                          "\xC5\x39\xD0\x67\xFE\x72\x09\xA0"
3782                          "\x14\xAB\x42\xD9\x4D\xE4\x7B\x12"
3783                          "\x86\x1D\xB4\x28\xBF\x56\xED\x61"
3784                          "\xF8\x8F\x03\x9A\x31\xC8\x3C\xD3"
3785                          "\x6A\x01\x75\x0C\xA3\x17\xAE\x45"
3786                          "\xDC\x50\xE7\x7E\x15\x89\x20\xB7",
3787                .ilen   = 496,
3788                .result = "\xDF\xDD\x69\xFA\xB0\x2E\xFD\xFE"
3789                          "\x70\x9E\xC5\x4B\xC9\xD4\xA1\x30"
3790                          "\x26\x9B\x89\xA1\xEE\x43\xE0\x52"
3791                          "\x55\x17\x4E\xC7\x0E\x33\x1F\xF1"
3792                          "\x9F\x8D\x40\x9F\x24\xFD\x92\xA0"
3793                          "\xBC\x8F\x35\xDD\x67\x38\xD8\xAA"
3794                          "\xCF\xF8\x48\xCA\xFB\xE4\x5C\x60"
3795                          "\x01\x41\x21\x12\x38\xAB\x52\x4F"
3796                          "\xA8\x57\x20\xE0\x21\x6A\x17\x0D"
3797                          "\x0E\xF9\x8E\x49\x42\x00\x3C\x94"
3798                          "\x14\xC0\xD0\x8D\x8A\x98\xEB\x29"
3799                          "\xEC\xAE\x96\x44\xC0\x3C\x48\xDC"
3800                          "\x29\x35\x25\x2F\xE7\x11\x6C\x68"
3801                          "\xC8\x67\x0A\x2F\xF4\x07\xBE\xF9"
3802                          "\x2C\x31\x87\x40\xAB\xB2\xB6\xFA"
3803                          "\xD2\xC9\x6D\x5C\x50\xE9\xE6\x7E"
3804                          "\xE3\x0A\xD2\xD5\x6D\x8D\x64\x9E"
3805                          "\x70\xCE\x03\x76\xDD\xE0\xF0\x8C"
3806                          "\x84\x86\x8B\x6A\xFE\xC7\xF9\x69"
3807                          "\x2E\xFE\xFC\xC2\xC4\x1A\x55\x58"
3808                          "\xB3\xBE\xE2\x7E\xED\x39\x42\x6C"
3809                          "\xB4\x42\x97\x9A\xEC\xE1\x0A\x06"
3810                          "\x02\xC5\x03\x9D\xC4\x48\x15\x66"
3811                          "\x35\x6A\xC2\xC9\xA2\x26\x30\xBB"
3812                          "\xDB\x2D\xC8\x08\x2B\xA0\x29\x1A"
3813                          "\x23\x61\x48\xEA\x80\x04\x27\xAA"
3814                          "\x69\x49\xE8\xE8\x4A\x83\x6B\x5A"
3815                          "\xCA\x7C\xD3\xB1\xB5\x0B\xCC\x23"
3816                          "\x74\x1F\xA9\x87\xCD\xED\xC0\x2D"
3817                          "\xBF\xEB\xCF\x16\x2D\x2A\x2E\x1D"
3818                          "\x96\xBA\x36\x11\x45\x41\xDA\xCE"
3819                          "\xA4\x48\x80\x8B\x06\xF4\x98\x89"
3820                          "\x8B\x23\x08\x53\xF4\xD4\x5A\x24"
3821                          "\x8B\xF8\x43\x73\xD1\xEE\xC4\xB0"
3822                          "\xF8\xFE\x09\x0C\x75\x05\x38\x0B"
3823                          "\x7C\x81\xDE\x9D\xE4\x61\x37\x63"
3824                          "\x63\xAD\x12\xD2\x04\xB9\xCE\x45"
3825                          "\x5A\x1A\x6E\xB3\x78\x2A\xA4\x74"
3826                          "\x86\xD0\xE3\xFF\xDA\x38\x9C\xB5"
3827                          "\xB8\xB1\xDB\x38\x2F\xC5\x6A\xB4"
3828                          "\xEB\x6E\x96\xE8\x43\x80\xB5\x51"
3829                          "\x61\x2D\x48\xAA\x07\x65\x11\x8C"
3830                          "\x48\xE3\x90\x7E\x78\x3A\xEC\x97"
3831                          "\x05\x3D\x84\xE7\x90\x2B\xAA\xBD"
3832                          "\x83\x29\x0E\x1A\x81\x73\x7B\xE0"
3833                          "\x7A\x01\x4A\x37\x3B\x77\x7F\x8D"
3834                          "\x49\xA4\x2F\x6E\xBE\x68\x99\x08"
3835                          "\x99\xAA\x4C\x12\x04\xAE\x1F\x77"
3836                          "\x35\x88\xF1\x65\x06\x0A\x0B\x4D"
3837                          "\x47\xF9\x50\x38\x5D\x71\xF9\x6E"
3838                          "\xDE\xEC\x61\x35\x2C\x4C\x96\x50"
3839                          "\xE8\x28\x93\x9C\x7E\x01\xC6\x04"
3840                          "\xB2\xD6\xBC\x6C\x17\xEB\xC1\x7D"
3841                          "\x11\xE9\x43\x83\x76\xAA\x53\x37"
3842                          "\x0C\x1D\x39\x89\x53\x72\x09\x7E"
3843                          "\xD9\x85\x16\x04\xA5\x2C\x05\x6F"
3844                          "\x17\x0C\x6E\x66\xAA\x84\xA7\xD9"
3845                          "\xE2\xD9\xC4\xEB\x43\x3E\xB1\x8D"
3846                          "\x7C\x36\xC7\x71\x70\x9C\x10\xD8"
3847                          "\xE8\x47\x2A\x4D\xFD\xA1\xBC\xE3"
3848                          "\xB9\x32\xE2\xC1\x82\xAC\xFE\xCC"
3849                          "\xC5\xC9\x7F\x9E\xCF\x33\x7A\xDF",
3850                .rlen   = 496,
3851        }, { /* Generated with Crypto++ */
3852                .key    = "\x85\x62\x3F\x1C\xF9\xD6\x1C\xF9"
3853                          "\xD6\xB3\x90\x6D\x4A\x90\x6D\x4A"
3854                          "\x27\x04\xE1\x27\x04\xE1\xBE\x9B"
3855                          "\x78\xBE\x9B\x78\x55\x32\x0F\x55",
3856                .klen   = 32,
3857                .iv     = "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF"
3858                          "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFD",
3859                .input  = "\x56\xED\x84\x1B\x8F\x26\xBD\x31"
3860                          "\xC8\x5F\xF6\x6A\x01\x98\x0C\xA3"
3861                          "\x3A\xD1\x45\xDC\x73\x0A\x7E\x15"
3862                          "\xAC\x20\xB7\x4E\xE5\x59\xF0\x87"
3863                          "\x1E\x92\x29\xC0\x34\xCB\x62\xF9"
3864                          "\x6D\x04\x9B\x0F\xA6\x3D\xD4\x48"
3865                          "\xDF\x76\x0D\x81\x18\xAF\x23\xBA"
3866                          "\x51\xE8\x5C\xF3\x8A\x21\x95\x2C"
3867                          "\xC3\x37\xCE\x65\xFC\x70\x07\x9E"
3868                          "\x12\xA9\x40\xD7\x4B\xE2\x79\x10"
3869                          "\x84\x1B\xB2\x26\xBD\x54\xEB\x5F"
3870                          "\xF6\x8D\x01\x98\x2F\xC6\x3A\xD1"
3871                          "\x68\xFF\x73\x0A\xA1\x15\xAC\x43"
3872                          "\xDA\x4E\xE5\x7C\x13\x87\x1E\xB5"
3873                          "\x29\xC0\x57\xEE\x62\xF9\x90\x04"
3874                          "\x9B\x32\xC9\x3D\xD4\x6B\x02\x76"
3875                          "\x0D\xA4\x18\xAF\x46\xDD\x51\xE8"
3876                          "\x7F\x16\x8A\x21\xB8\x2C\xC3\x5A"
3877                          "\xF1\x65\xFC\x93\x07\x9E\x35\xCC"
3878                          "\x40\xD7\x6E\x05\x79\x10\xA7\x1B"
3879                          "\xB2\x49\xE0\x54\xEB\x82\x19\x8D"
3880                          "\x24\xBB\x2F\xC6\x5D\xF4\x68\xFF"
3881                          "\x96\x0A\xA1\x38\xCF\x43\xDA\x71"
3882                          "\x08\x7C\x13\xAA\x1E\xB5\x4C\xE3"
3883                          "\x57\xEE\x85\x1C\x90\x27\xBE\x32"
3884                          "\xC9\x60\xF7\x6B\x02\x99\x0D\xA4"
3885                          "\x3B\xD2\x46\xDD\x74\x0B\x7F\x16"
3886                          "\xAD\x21\xB8\x4F\xE6\x5A\xF1\x88"
3887                          "\x1F\x93\x2A\xC1\x35\xCC\x63\xFA"
3888                          "\x6E\x05\x9C\x10\xA7\x3E\xD5\x49"
3889                          "\xE0\x77\x0E\x82\x19\xB0\x24\xBB"
3890                          "\x52\xE9\x5D\xF4\x8B\x22\x96\x2D"
3891                          "\xC4\x38\xCF\x66\xFD\x71\x08\x9F"
3892                          "\x13\xAA\x41\xD8\x4C\xE3\x7A\x11"
3893                          "\x85\x1C\xB3\x27\xBE\x55\xEC\x60"
3894                          "\xF7\x8E\x02\x99\x30\xC7\x3B\xD2"
3895                          "\x69\x00\x74\x0B\xA2\x16\xAD\x44"
3896                          "\xDB\x4F\xE6\x7D\x14\x88\x1F\xB6"
3897                          "\x2A\xC1\x58\xEF\x63\xFA\x91\x05"
3898                          "\x9C\x33\xCA\x3E\xD5\x6C\x03\x77"
3899                          "\x0E\xA5\x19\xB0\x47\xDE\x52\xE9"
3900                          "\x80\x17\x8B\x22\xB9\x2D\xC4\x5B"
3901                          "\xF2\x66\xFD\x94\x08\x9F\x36\xCD"
3902                          "\x41\xD8\x6F\x06\x7A\x11\xA8\x1C"
3903                          "\xB3\x4A\xE1\x55\xEC\x83\x1A\x8E"
3904                          "\x25\xBC\x30\xC7\x5E\xF5\x69\x00"
3905                          "\x97\x0B\xA2\x39\xD0\x44\xDB\x72"
3906                          "\x09\x7D\x14\xAB\x1F\xB6\x4D\xE4"
3907                          "\x58\xEF\x86\x1D\x91\x28\xBF\x33"
3908                          "\xCA\x61\xF8\x6C\x03\x9A\x0E\xA5"
3909                          "\x3C\xD3\x47\xDE\x75\x0C\x80\x17"
3910                          "\xAE\x22\xB9\x50\xE7\x5B\xF2\x89"
3911                          "\x20\x94\x2B\xC2\x36\xCD\x64\xFB"
3912                          "\x6F\x06\x9D\x11\xA8\x3F\xD6\x4A"
3913                          "\xE1\x78\x0F\x83\x1A\xB1\x25\xBC"
3914                          "\x53\xEA\x5E\xF5\x8C\x00\x97\x2E"
3915                          "\xC5\x39\xD0\x67\xFE\x72\x09\xA0"
3916                          "\x14\xAB\x42\xD9\x4D\xE4\x7B\x12"
3917                          "\x86\x1D\xB4\x28\xBF\x56\xED\x61"
3918                          "\xF8\x8F\x03\x9A\x31\xC8\x3C\xD3"
3919                          "\x6A\x01\x75\x0C\xA3\x17\xAE\x45"
3920                          "\xDC\x50\xE7\x7E\x15\x89\x20\xB7",
3921                .ilen   = 496,
3922                .result = "\xEB\x44\xAF\x49\x27\xB8\xFB\x44"
3923                          "\x4C\xA6\xC3\x0C\x8B\xD0\x01\x0C"
3924                          "\x53\xC8\x16\x38\xDE\x40\x4F\x91"
3925                          "\x25\x6D\x4C\xA0\x9A\x87\x1E\xDA"
3926                          "\x88\x7E\x89\xE9\x67\x2B\x83\xA2"
3927                          "\x5F\x2E\x23\x3E\x45\xB9\x77\x7B"
3928                          "\xA6\x7E\x47\x36\x81\x9F\x9B\xF3"
3929                          "\xE0\xF0\xD7\x47\xA9\xC8\xEF\x33"
3930                          "\x0C\x43\xFE\x67\x50\x0A\x2C\x3E"
3931                          "\xA0\xE1\x25\x8E\x80\x07\x4A\xC0"
3932                          "\x64\x89\x9F\x6A\x27\x96\x07\xA6"
3933                          "\x9B\xC8\x1B\x21\x60\xAE\x5D\x01"
3934                          "\xE2\xCD\xC8\xAA\x6C\x9D\x1C\x34"
3935                          "\x39\x18\x09\xA4\x82\x59\x78\xE7"
3936                          "\xFC\x59\x65\xF2\x94\xFF\xFB\xE2"
3937                          "\x3C\xDA\xB1\x90\x95\xBF\x91\xE3"
3938                          "\xE6\x87\x31\x9E\x16\x85\xAD\xB1"
3939                          "\x4C\xAE\x43\x4D\x19\x58\xB5\x5E"
3940                          "\x2E\xF5\x09\xAA\x39\xF4\xC0\xB3"
3941                          "\xD4\x4D\xDB\x73\x7A\xD4\xF1\xBF"
3942                          "\x89\x16\x4D\x2D\xA2\x26\x33\x72"
3943                          "\x18\x33\x7E\xD6\xD2\x16\xA4\x54"
3944                          "\xF4\x8C\xB3\x52\xDF\x21\x9C\xEB"
3945                          "\xBF\x49\xD3\xF9\x05\x06\xCB\xD2"
3946                          "\xA9\xD2\x3B\x6E\x19\x8C\xBC\x19"
3947                          "\xAB\x89\xD6\xD8\xCD\x56\x89\x5E"
3948                          "\xAC\x00\xE3\x50\x63\x4A\x80\x9A"
3949                          "\x05\xBC\x50\x39\xD3\x32\xD9\x0D"
3950                          "\xE3\x20\x0D\x75\x54\xEC\xE6\x31"
3951                          "\x14\xB9\x3A\x59\x00\x43\x37\x8E"
3952                          "\x8C\x5A\x79\x62\x14\x76\x8A\xAE"
3953                          "\x8F\xCC\xA1\x6C\x38\x78\xDD\x2D"
3954                          "\x8B\x6D\xEA\xBD\x7B\x25\xFF\x60"
3955                          "\xC9\x87\xB1\x79\x1E\xA5\x86\x68"
3956                          "\x81\xB4\xE2\xC1\x05\x7D\x3A\x73"
3957                          "\xD0\xDA\x75\x77\x9E\x05\x27\xF1"
3958                          "\x08\xA9\x66\x64\x6C\xBC\x82\x17"
3959                          "\x2C\x23\x5F\x62\x4D\x02\x1A\x58"
3960                          "\xE7\xB7\x23\x6D\xE2\x20\xDA\xEF"
3961                          "\xB4\xB3\x3F\xB2\x2B\x69\x98\x83"
3962                          "\x95\x87\x13\x57\x60\xD7\xB5\xB1"
3963                          "\xEE\x0A\x2F\x95\x36\x4C\x76\x5D"
3964                          "\x5F\xD9\x19\xED\xB9\xA5\x48\xBF"
3965                          "\xC8\xAB\x0F\x71\xCC\x61\x8E\x0A"
3966                          "\xD0\x29\x44\xA8\xB9\xC1\xE8\xC8"
3967                          "\xC9\xA8\x28\x81\xFB\x50\xF2\xF0"
3968                          "\x26\xAE\x39\xB8\x91\xCD\xA8\xAC"
3969                          "\xDE\x55\x1B\x50\x14\x53\x44\x17"
3970                          "\x54\x46\xFC\xB1\xE4\x07\x6B\x9A"
3971                          "\x01\x14\xF0\x2E\x2E\xDB\x46\x1B"
3972                          "\x1A\x09\x97\xA9\xB6\x97\x79\x06"
3973                          "\xFB\xCB\x85\xCF\xDD\xA1\x41\xB1"
3974                          "\x00\xAA\xF7\xE0\x89\x73\xFB\xE5"
3975                          "\xBF\x84\xDB\xC9\xCD\xC4\xA2\x0D"
3976                          "\x3B\xAC\xF9\xDF\x96\xBF\x88\x23"
3977                          "\x41\x67\xA1\x24\x99\x7E\xCC\x9B"
3978                          "\x02\x8F\x6A\x49\xF6\x25\xBA\x7A"
3979                          "\xF4\x78\xFD\x79\x62\x63\x4F\x14"
3980                          "\xD6\x11\x11\x04\x05\x5F\x7E\xEA"
3981                          "\x4C\xB6\xF8\xF4\x5F\x48\x52\x54"
3982                          "\x94\x63\xA8\x4E\xCF\xD2\x1B\x1B"
3983                          "\x22\x18\x6A\xAF\x6E\x3E\xE1\x0D",
3984                .rlen   = 496,
3985        }, { /* Generated with Crypto++ */
3986                .key    = "\x85\x62\x3F\x1C\xF9\xD6\x1C\xF9"
3987                          "\xD6\xB3\x90\x6D\x4A\x90\x6D\x4A"
3988                          "\x27\x04\xE1\x27\x04\xE1\xBE\x9B"
3989                          "\x78\xBE\x9B\x78\x55\x32\x0F\x55",
3990                .klen   = 32,
3991                .iv     = "\xE2\x24\x89\xEE\x53\xB8\x1D\x5F"
3992                          "\xC4\x29\x8E\xF3\x35\x9A\xFF\x64",
3993                .input  = "\x56\xED\x84\x1B\x8F\x26\xBD\x31"
3994                          "\xC8\x5F\xF6\x6A\x01\x98\x0C\xA3"
3995                          "\x3A\xD1\x45\xDC\x73\x0A\x7E\x15"
3996                          "\xAC\x20\xB7\x4E\xE5\x59\xF0\x87"
3997                          "\x1E\x92\x29\xC0\x34\xCB\x62\xF9"
3998                          "\x6D\x04\x9B\x0F\xA6\x3D\xD4\x48"
3999                          "\xDF\x76\x0D\x81\x18\xAF\x23\xBA"
4000                          "\x51\xE8\x5C\xF3\x8A\x21\x95\x2C"
4001                          "\xC3\x37\xCE\x65\xFC\x70\x07\x9E"
4002                          "\x12\xA9\x40\xD7\x4B\xE2\x79\x10"
4003                          "\x84\x1B\xB2\x26\xBD\x54\xEB\x5F"
4004                          "\xF6\x8D\x01\x98\x2F\xC6\x3A\xD1"
4005                          "\x68\xFF\x73\x0A\xA1\x15\xAC\x43"
4006                          "\xDA\x4E\xE5\x7C\x13\x87\x1E\xB5"
4007                          "\x29\xC0\x57\xEE\x62\xF9\x90\x04"
4008                          "\x9B\x32\xC9\x3D\xD4\x6B\x02\x76"
4009                          "\x0D\xA4\x18\xAF\x46\xDD\x51\xE8"
4010                          "\x7F\x16\x8A\x21\xB8\x2C\xC3\x5A"
4011                          "\xF1\x65\xFC\x93\x07\x9E\x35\xCC"
4012                          "\x40\xD7\x6E\x05\x79\x10\xA7\x1B"
4013                          "\xB2\x49\xE0\x54\xEB\x82\x19\x8D"
4014                          "\x24\xBB\x2F\xC6\x5D\xF4\x68\xFF"
4015                          "\x96\x0A\xA1\x38\xCF\x43\xDA\x71"
4016                          "\x08\x7C\x13\xAA\x1E\xB5\x4C\xE3"
4017                          "\x57\xEE\x85\x1C\x90\x27\xBE\x32"
4018                          "\xC9\x60\xF7\x6B\x02\x99\x0D\xA4"
4019                          "\x3B\xD2\x46\xDD\x74\x0B\x7F\x16"
4020                          "\xAD\x21\xB8\x4F\xE6\x5A\xF1\x88"
4021                          "\x1F\x93\x2A\xC1\x35\xCC\x63\xFA"
4022                          "\x6E\x05\x9C\x10\xA7\x3E\xD5\x49"
4023                          "\xE0\x77\x0E\x82\x19\xB0\x24\xBB"
4024                          "\x52\xE9\x5D\xF4\x8B\x22\x96\x2D"
4025                          "\xC4\x38\xCF\x66\xFD\x71\x08\x9F"
4026                          "\x13\xAA\x41\xD8\x4C\xE3\x7A\x11"
4027                          "\x85\x1C\xB3\x27\xBE\x55\xEC\x60"
4028                          "\xF7\x8E\x02\x99\x30\xC7\x3B\xD2"
4029                          "\x69\x00\x74\x0B\xA2\x16\xAD\x44"
4030                          "\xDB\x4F\xE6\x7D\x14\x88\x1F\xB6"
4031                          "\x2A\xC1\x58\xEF\x63\xFA\x91\x05"
4032                          "\x9C\x33\xCA\x3E\xD5\x6C\x03\x77"
4033                          "\x0E\xA5\x19\xB0\x47\xDE\x52\xE9"
4034                          "\x80\x17\x8B\x22\xB9\x2D\xC4\x5B"
4035                          "\xF2\x66\xFD\x94\x08\x9F\x36\xCD"
4036                          "\x41\xD8\x6F\x06\x7A\x11\xA8\x1C"
4037                          "\xB3\x4A\xE1\x55\xEC\x83\x1A\x8E"
4038                          "\x25\xBC\x30\xC7\x5E\xF5\x69\x00"
4039                          "\x97\x0B\xA2\x39\xD0\x44\xDB\x72"
4040                          "\x09\x7D\x14\xAB\x1F\xB6\x4D\xE4"
4041                          "\x58\xEF\x86\x1D\x91\x28\xBF\x33"
4042                          "\xCA\x61\xF8\x6C\x03\x9A\x0E\xA5"
4043                          "\x3C\xD3\x47\xDE\x75\x0C\x80\x17"
4044                          "\xAE\x22\xB9\x50\xE7\x5B\xF2\x89"
4045                          "\x20\x94\x2B\xC2\x36\xCD\x64\xFB"
4046                          "\x6F\x06\x9D\x11\xA8\x3F\xD6\x4A"
4047                          "\xE1\x78\x0F\x83\x1A\xB1\x25\xBC"
4048                          "\x53\xEA\x5E\xF5\x8C\x00\x97\x2E"
4049                          "\xC5\x39\xD0\x67\xFE\x72\x09\xA0"
4050                          "\x14\xAB\x42\xD9\x4D\xE4\x7B\x12"
4051                          "\x86\x1D\xB4\x28\xBF\x56\xED\x61"
4052                          "\xF8\x8F\x03\x9A\x31\xC8\x3C\xD3"
4053                          "\x6A\x01\x75\x0C\xA3\x17\xAE\x45"
4054                          "\xDC\x50\xE7\x7E\x15\x89\x20\xB7"
4055                          "\x2B\xC2\x59",
4056                .ilen   = 499,
4057                .result = "\xDF\xDD\x69\xFA\xB0\x2E\xFD\xFE"
4058                          "\x70\x9E\xC5\x4B\xC9\xD4\xA1\x30"
4059                          "\x26\x9B\x89\xA1\xEE\x43\xE0\x52"
4060                          "\x55\x17\x4E\xC7\x0E\x33\x1F\xF1"
4061                          "\x9F\x8D\x40\x9F\x24\xFD\x92\xA0"
4062                          "\xBC\x8F\x35\xDD\x67\x38\xD8\xAA"
4063                          "\xCF\xF8\x48\xCA\xFB\xE4\x5C\x60"
4064                          "\x01\x41\x21\x12\x38\xAB\x52\x4F"
4065                          "\xA8\x57\x20\xE0\x21\x6A\x17\x0D"
4066                          "\x0E\xF9\x8E\x49\x42\x00\x3C\x94"
4067                          "\x14\xC0\xD0\x8D\x8A\x98\xEB\x29"
4068                          "\xEC\xAE\x96\x44\xC0\x3C\x48\xDC"
4069                          "\x29\x35\x25\x2F\xE7\x11\x6C\x68"
4070                          "\xC8\x67\x0A\x2F\xF4\x07\xBE\xF9"
4071                          "\x2C\x31\x87\x40\xAB\xB2\xB6\xFA"
4072                          "\xD2\xC9\x6D\x5C\x50\xE9\xE6\x7E"
4073                          "\xE3\x0A\xD2\xD5\x6D\x8D\x64\x9E"
4074                          "\x70\xCE\x03\x76\xDD\xE0\xF0\x8C"
4075                          "\x84\x86\x8B\x6A\xFE\xC7\xF9\x69"
4076                          "\x2E\xFE\xFC\xC2\xC4\x1A\x55\x58"
4077                          "\xB3\xBE\xE2\x7E\xED\x39\x42\x6C"
4078                          "\xB4\x42\x97\x9A\xEC\xE1\x0A\x06"
4079                          "\x02\xC5\x03\x9D\xC4\x48\x15\x66"
4080                          "\x35\x6A\xC2\xC9\xA2\x26\x30\xBB"
4081                          "\xDB\x2D\xC8\x08\x2B\xA0\x29\x1A"
4082                          "\x23\x61\x48\xEA\x80\x04\x27\xAA"
4083                          "\x69\x49\xE8\xE8\x4A\x83\x6B\x5A"
4084                          "\xCA\x7C\xD3\xB1\xB5\x0B\xCC\x23"
4085                          "\x74\x1F\xA9\x87\xCD\xED\xC0\x2D"
4086                          "\xBF\xEB\xCF\x16\x2D\x2A\x2E\x1D"
4087                          "\x96\xBA\x36\x11\x45\x41\xDA\xCE"
4088                          "\xA4\x48\x80\x8B\x06\xF4\x98\x89"
4089                          "\x8B\x23\x08\x53\xF4\xD4\x5A\x24"
4090                          "\x8B\xF8\x43\x73\xD1\xEE\xC4\xB0"
4091                          "\xF8\xFE\x09\x0C\x75\x05\x38\x0B"
4092                          "\x7C\x81\xDE\x9D\xE4\x61\x37\x63"
4093                          "\x63\xAD\x12\xD2\x04\xB9\xCE\x45"
4094                          "\x5A\x1A\x6E\xB3\x78\x2A\xA4\x74"
4095                          "\x86\xD0\xE3\xFF\xDA\x38\x9C\xB5"
4096                          "\xB8\xB1\xDB\x38\x2F\xC5\x6A\xB4"
4097                          "\xEB\x6E\x96\xE8\x43\x80\xB5\x51"
4098                          "\x61\x2D\x48\xAA\x07\x65\x11\x8C"
4099                          "\x48\xE3\x90\x7E\x78\x3A\xEC\x97"
4100                          "\x05\x3D\x84\xE7\x90\x2B\xAA\xBD"
4101                          "\x83\x29\x0E\x1A\x81\x73\x7B\xE0"
4102                          "\x7A\x01\x4A\x37\x3B\x77\x7F\x8D"
4103                          "\x49\xA4\x2F\x6E\xBE\x68\x99\x08"
4104                          "\x99\xAA\x4C\x12\x04\xAE\x1F\x77"
4105                          "\x35\x88\xF1\x65\x06\x0A\x0B\x4D"
4106                          "\x47\xF9\x50\x38\x5D\x71\xF9\x6E"
4107                          "\xDE\xEC\x61\x35\x2C\x4C\x96\x50"
4108                          "\xE8\x28\x93\x9C\x7E\x01\xC6\x04"
4109                          "\xB2\xD6\xBC\x6C\x17\xEB\xC1\x7D"
4110                          "\x11\xE9\x43\x83\x76\xAA\x53\x37"
4111                          "\x0C\x1D\x39\x89\x53\x72\x09\x7E"
4112                          "\xD9\x85\x16\x04\xA5\x2C\x05\x6F"
4113                          "\x17\x0C\x6E\x66\xAA\x84\xA7\xD9"
4114                          "\xE2\xD9\xC4\xEB\x43\x3E\xB1\x8D"
4115                          "\x7C\x36\xC7\x71\x70\x9C\x10\xD8"
4116                          "\xE8\x47\x2A\x4D\xFD\xA1\xBC\xE3"
4117                          "\xB9\x32\xE2\xC1\x82\xAC\xFE\xCC"
4118                          "\xC5\xC9\x7F\x9E\xCF\x33\x7A\xDF"
4119                          "\x6C\x82\x9D",
4120                .rlen   = 499,
4121                .also_non_np = 1,
4122                .np     = 2,
4123                .tap    = { 499 - 16, 16 },
4124        },
4125};
4126
4127static struct cipher_testvec tf_ctr_dec_tv_template[] = {
4128        { /* Generated with Crypto++ */
4129                .key    = "\x85\x62\x3F\x1C\xF9\xD6\x1C\xF9"
4130                          "\xD6\xB3\x90\x6D\x4A\x90\x6D\x4A"
4131                          "\x27\x04\xE1\x27\x04\xE1\xBE\x9B"
4132                          "\x78\xBE\x9B\x78\x55\x32\x0F\x55",
4133                .klen   = 32,
4134                .iv     = "\xE2\x24\x89\xEE\x53\xB8\x1D\x5F"
4135                          "\xC4\x29\x8E\xF3\x35\x9A\xFF\x64",
4136                .input  = "\xDF\xDD\x69\xFA\xB0\x2E\xFD\xFE"
4137                          "\x70\x9E\xC5\x4B\xC9\xD4\xA1\x30"
4138                          "\x26\x9B\x89\xA1\xEE\x43\xE0\x52"
4139                          "\x55\x17\x4E\xC7\x0E\x33\x1F\xF1"
4140                          "\x9F\x8D\x40\x9F\x24\xFD\x92\xA0"
4141                          "\xBC\x8F\x35\xDD\x67\x38\xD8\xAA"
4142                          "\xCF\xF8\x48\xCA\xFB\xE4\x5C\x60"
4143                          "\x01\x41\x21\x12\x38\xAB\x52\x4F"
4144                          "\xA8\x57\x20\xE0\x21\x6A\x17\x0D"
4145                          "\x0E\xF9\x8E\x49\x42\x00\x3C\x94"
4146                          "\x14\xC0\xD0\x8D\x8A\x98\xEB\x29"
4147                          "\xEC\xAE\x96\x44\xC0\x3C\x48\xDC"
4148                          "\x29\x35\x25\x2F\xE7\x11\x6C\x68"
4149                          "\xC8\x67\x0A\x2F\xF4\x07\xBE\xF9"
4150                          "\x2C\x31\x87\x40\xAB\xB2\xB6\xFA"
4151                          "\xD2\xC9\x6D\x5C\x50\xE9\xE6\x7E"
4152                          "\xE3\x0A\xD2\xD5\x6D\x8D\x64\x9E"
4153                          "\x70\xCE\x03\x76\xDD\xE0\xF0\x8C"
4154                          "\x84\x86\x8B\x6A\xFE\xC7\xF9\x69"
4155                          "\x2E\xFE\xFC\xC2\xC4\x1A\x55\x58"
4156                          "\xB3\xBE\xE2\x7E\xED\x39\x42\x6C"
4157                          "\xB4\x42\x97\x9A\xEC\xE1\x0A\x06"
4158                          "\x02\xC5\x03\x9D\xC4\x48\x15\x66"
4159                          "\x35\x6A\xC2\xC9\xA2\x26\x30\xBB"
4160                          "\xDB\x2D\xC8\x08\x2B\xA0\x29\x1A"
4161                          "\x23\x61\x48\xEA\x80\x04\x27\xAA"
4162                          "\x69\x49\xE8\xE8\x4A\x83\x6B\x5A"
4163                          "\xCA\x7C\xD3\xB1\xB5\x0B\xCC\x23"
4164                          "\x74\x1F\xA9\x87\xCD\xED\xC0\x2D"
4165                          "\xBF\xEB\xCF\x16\x2D\x2A\x2E\x1D"
4166                          "\x96\xBA\x36\x11\x45\x41\xDA\xCE"
4167                          "\xA4\x48\x80\x8B\x06\xF4\x98\x89"
4168                          "\x8B\x23\x08\x53\xF4\xD4\x5A\x24"
4169                          "\x8B\xF8\x43\x73\xD1\xEE\xC4\xB0"
4170                          "\xF8\xFE\x09\x0C\x75\x05\x38\x0B"
4171                          "\x7C\x81\xDE\x9D\xE4\x61\x37\x63"
4172                          "\x63\xAD\x12\xD2\x04\xB9\xCE\x45"
4173                          "\x5A\x1A\x6E\xB3\x78\x2A\xA4\x74"
4174                          "\x86\xD0\xE3\xFF\xDA\x38\x9C\xB5"
4175                          "\xB8\xB1\xDB\x38\x2F\xC5\x6A\xB4"
4176                          "\xEB\x6E\x96\xE8\x43\x80\xB5\x51"
4177                          "\x61\x2D\x48\xAA\x07\x65\x11\x8C"
4178                          "\x48\xE3\x90\x7E\x78\x3A\xEC\x97"
4179                          "\x05\x3D\x84\xE7\x90\x2B\xAA\xBD"
4180                          "\x83\x29\x0E\x1A\x81\x73\x7B\xE0"
4181                          "\x7A\x01\x4A\x37\x3B\x77\x7F\x8D"
4182                          "\x49\xA4\x2F\x6E\xBE\x68\x99\x08"
4183                          "\x99\xAA\x4C\x12\x04\xAE\x1F\x77"
4184                          "\x35\x88\xF1\x65\x06\x0A\x0B\x4D"
4185                          "\x47\xF9\x50\x38\x5D\x71\xF9\x6E"
4186                          "\xDE\xEC\x61\x35\x2C\x4C\x96\x50"
4187                          "\xE8\x28\x93\x9C\x7E\x01\xC6\x04"
4188                          "\xB2\xD6\xBC\x6C\x17\xEB\xC1\x7D"
4189                          "\x11\xE9\x43\x83\x76\xAA\x53\x37"
4190                          "\x0C\x1D\x39\x89\x53\x72\x09\x7E"
4191                          "\xD9\x85\x16\x04\xA5\x2C\x05\x6F"
4192                          "\x17\x0C\x6E\x66\xAA\x84\xA7\xD9"
4193                          "\xE2\xD9\xC4\xEB\x43\x3E\xB1\x8D"
4194                          "\x7C\x36\xC7\x71\x70\x9C\x10\xD8"
4195                          "\xE8\x47\x2A\x4D\xFD\xA1\xBC\xE3"
4196                          "\xB9\x32\xE2\xC1\x82\xAC\xFE\xCC"
4197                          "\xC5\xC9\x7F\x9E\xCF\x33\x7A\xDF",
4198                .ilen   = 496,
4199                .result = "\x56\xED\x84\x1B\x8F\x26\xBD\x31"
4200                          "\xC8\x5F\xF6\x6A\x01\x98\x0C\xA3"
4201                          "\x3A\xD1\x45\xDC\x73\x0A\x7E\x15"
4202                          "\xAC\x20\xB7\x4E\xE5\x59\xF0\x87"
4203                          "\x1E\x92\x29\xC0\x34\xCB\x62\xF9"
4204                          "\x6D\x04\x9B\x0F\xA6\x3D\xD4\x48"
4205                          "\xDF\x76\x0D\x81\x18\xAF\x23\xBA"
4206                          "\x51\xE8\x5C\xF3\x8A\x21\x95\x2C"
4207                          "\xC3\x37\xCE\x65\xFC\x70\x07\x9E"
4208                          "\x12\xA9\x40\xD7\x4B\xE2\x79\x10"
4209                          "\x84\x1B\xB2\x26\xBD\x54\xEB\x5F"
4210                          "\xF6\x8D\x01\x98\x2F\xC6\x3A\xD1"
4211                          "\x68\xFF\x73\x0A\xA1\x15\xAC\x43"
4212                          "\xDA\x4E\xE5\x7C\x13\x87\x1E\xB5"
4213                          "\x29\xC0\x57\xEE\x62\xF9\x90\x04"
4214                          "\x9B\x32\xC9\x3D\xD4\x6B\x02\x76"
4215                          "\x0D\xA4\x18\xAF\x46\xDD\x51\xE8"
4216                          "\x7F\x16\x8A\x21\xB8\x2C\xC3\x5A"
4217                          "\xF1\x65\xFC\x93\x07\x9E\x35\xCC"
4218                          "\x40\xD7\x6E\x05\x79\x10\xA7\x1B"
4219                          "\xB2\x49\xE0\x54\xEB\x82\x19\x8D"
4220                          "\x24\xBB\x2F\xC6\x5D\xF4\x68\xFF"
4221                          "\x96\x0A\xA1\x38\xCF\x43\xDA\x71"
4222                          "\x08\x7C\x13\xAA\x1E\xB5\x4C\xE3"
4223                          "\x57\xEE\x85\x1C\x90\x27\xBE\x32"
4224                          "\xC9\x60\xF7\x6B\x02\x99\x0D\xA4"
4225                          "\x3B\xD2\x46\xDD\x74\x0B\x7F\x16"
4226                          "\xAD\x21\xB8\x4F\xE6\x5A\xF1\x88"
4227                          "\x1F\x93\x2A\xC1\x35\xCC\x63\xFA"
4228                          "\x6E\x05\x9C\x10\xA7\x3E\xD5\x49"
4229                          "\xE0\x77\x0E\x82\x19\xB0\x24\xBB"
4230                          "\x52\xE9\x5D\xF4\x8B\x22\x96\x2D"
4231                          "\xC4\x38\xCF\x66\xFD\x71\x08\x9F"
4232                          "\x13\xAA\x41\xD8\x4C\xE3\x7A\x11"
4233                          "\x85\x1C\xB3\x27\xBE\x55\xEC\x60"
4234                          "\xF7\x8E\x02\x99\x30\xC7\x3B\xD2"
4235                          "\x69\x00\x74\x0B\xA2\x16\xAD\x44"
4236                          "\xDB\x4F\xE6\x7D\x14\x88\x1F\xB6"
4237                          "\x2A\xC1\x58\xEF\x63\xFA\x91\x05"
4238                          "\x9C\x33\xCA\x3E\xD5\x6C\x03\x77"
4239                          "\x0E\xA5\x19\xB0\x47\xDE\x52\xE9"
4240                          "\x80\x17\x8B\x22\xB9\x2D\xC4\x5B"
4241                          "\xF2\x66\xFD\x94\x08\x9F\x36\xCD"
4242                          "\x41\xD8\x6F\x06\x7A\x11\xA8\x1C"
4243                          "\xB3\x4A\xE1\x55\xEC\x83\x1A\x8E"
4244                          "\x25\xBC\x30\xC7\x5E\xF5\x69\x00"
4245                          "\x97\x0B\xA2\x39\xD0\x44\xDB\x72"
4246                          "\x09\x7D\x14\xAB\x1F\xB6\x4D\xE4"
4247                          "\x58\xEF\x86\x1D\x91\x28\xBF\x33"
4248                          "\xCA\x61\xF8\x6C\x03\x9A\x0E\xA5"
4249                          "\x3C\xD3\x47\xDE\x75\x0C\x80\x17"
4250                          "\xAE\x22\xB9\x50\xE7\x5B\xF2\x89"
4251                          "\x20\x94\x2B\xC2\x36\xCD\x64\xFB"
4252                          "\x6F\x06\x9D\x11\xA8\x3F\xD6\x4A"
4253                          "\xE1\x78\x0F\x83\x1A\xB1\x25\xBC"
4254                          "\x53\xEA\x5E\xF5\x8C\x00\x97\x2E"
4255                          "\xC5\x39\xD0\x67\xFE\x72\x09\xA0"
4256                          "\x14\xAB\x42\xD9\x4D\xE4\x7B\x12"
4257                          "\x86\x1D\xB4\x28\xBF\x56\xED\x61"
4258                          "\xF8\x8F\x03\x9A\x31\xC8\x3C\xD3"
4259                          "\x6A\x01\x75\x0C\xA3\x17\xAE\x45"
4260                          "\xDC\x50\xE7\x7E\x15\x89\x20\xB7",
4261                .rlen   = 496,
4262        }, { /* Generated with Crypto++ */
4263                .key    = "\x85\x62\x3F\x1C\xF9\xD6\x1C\xF9"
4264                          "\xD6\xB3\x90\x6D\x4A\x90\x6D\x4A"
4265                          "\x27\x04\xE1\x27\x04\xE1\xBE\x9B"
4266                          "\x78\xBE\x9B\x78\x55\x32\x0F\x55",
4267                .klen   = 32,
4268                .iv     = "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF"
4269                          "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFD",
4270                .input  = "\xEB\x44\xAF\x49\x27\xB8\xFB\x44"
4271                          "\x4C\xA6\xC3\x0C\x8B\xD0\x01\x0C"
4272                          "\x53\xC8\x16\x38\xDE\x40\x4F\x91"
4273                          "\x25\x6D\x4C\xA0\x9A\x87\x1E\xDA"
4274                          "\x88\x7E\x89\xE9\x67\x2B\x83\xA2"
4275                          "\x5F\x2E\x23\x3E\x45\xB9\x77\x7B"
4276                          "\xA6\x7E\x47\x36\x81\x9F\x9B\xF3"
4277                          "\xE0\xF0\xD7\x47\xA9\xC8\xEF\x33"
4278                          "\x0C\x43\xFE\x67\x50\x0A\x2C\x3E"
4279                          "\xA0\xE1\x25\x8E\x80\x07\x4A\xC0"
4280                          "\x64\x89\x9F\x6A\x27\x96\x07\xA6"
4281                          "\x9B\xC8\x1B\x21\x60\xAE\x5D\x01"
4282                          "\xE2\xCD\xC8\xAA\x6C\x9D\x1C\x34"
4283                          "\x39\x18\x09\xA4\x82\x59\x78\xE7"
4284                          "\xFC\x59\x65\xF2\x94\xFF\xFB\xE2"
4285                          "\x3C\xDA\xB1\x90\x95\xBF\x91\xE3"
4286                          "\xE6\x87\x31\x9E\x16\x85\xAD\xB1"
4287                          "\x4C\xAE\x43\x4D\x19\x58\xB5\x5E"
4288                          "\x2E\xF5\x09\xAA\x39\xF4\xC0\xB3"
4289                          "\xD4\x4D\xDB\x73\x7A\xD4\xF1\xBF"
4290                          "\x89\x16\x4D\x2D\xA2\x26\x33\x72"
4291                          "\x18\x33\x7E\xD6\xD2\x16\xA4\x54"
4292                          "\xF4\x8C\xB3\x52\xDF\x21\x9C\xEB"
4293                          "\xBF\x49\xD3\xF9\x05\x06\xCB\xD2"
4294                          "\xA9\xD2\x3B\x6E\x19\x8C\xBC\x19"
4295                          "\xAB\x89\xD6\xD8\xCD\x56\x89\x5E"
4296                          "\xAC\x00\xE3\x50\x63\x4A\x80\x9A"
4297                          "\x05\xBC\x50\x39\xD3\x32\xD9\x0D"
4298                          "\xE3\x20\x0D\x75\x54\xEC\xE6\x31"
4299                          "\x14\xB9\x3A\x59\x00\x43\x37\x8E"
4300                          "\x8C\x5A\x79\x62\x14\x76\x8A\xAE"
4301                          "\x8F\xCC\xA1\x6C\x38\x78\xDD\x2D"
4302                          "\x8B\x6D\xEA\xBD\x7B\x25\xFF\x60"
4303                          "\xC9\x87\xB1\x79\x1E\xA5\x86\x68"
4304                          "\x81\xB4\xE2\xC1\x05\x7D\x3A\x73"
4305                          "\xD0\xDA\x75\x77\x9E\x05\x27\xF1"
4306                          "\x08\xA9\x66\x64\x6C\xBC\x82\x17"
4307                          "\x2C\x23\x5F\x62\x4D\x02\x1A\x58"
4308                          "\xE7\xB7\x23\x6D\xE2\x20\xDA\xEF"
4309                          "\xB4\xB3\x3F\xB2\x2B\x69\x98\x83"
4310                          "\x95\x87\x13\x57\x60\xD7\xB5\xB1"
4311                          "\xEE\x0A\x2F\x95\x36\x4C\x76\x5D"
4312                          "\x5F\xD9\x19\xED\xB9\xA5\x48\xBF"
4313                          "\xC8\xAB\x0F\x71\xCC\x61\x8E\x0A"
4314                          "\xD0\x29\x44\xA8\xB9\xC1\xE8\xC8"
4315                          "\xC9\xA8\x28\x81\xFB\x50\xF2\xF0"
4316                          "\x26\xAE\x39\xB8\x91\xCD\xA8\xAC"
4317                          "\xDE\x55\x1B\x50\x14\x53\x44\x17"
4318                          "\x54\x46\xFC\xB1\xE4\x07\x6B\x9A"
4319                          "\x01\x14\xF0\x2E\x2E\xDB\x46\x1B"
4320                          "\x1A\x09\x97\xA9\xB6\x97\x79\x06"
4321                          "\xFB\xCB\x85\xCF\xDD\xA1\x41\xB1"
4322                          "\x00\xAA\xF7\xE0\x89\x73\xFB\xE5"
4323                          "\xBF\x84\xDB\xC9\xCD\xC4\xA2\x0D"
4324                          "\x3B\xAC\xF9\xDF\x96\xBF\x88\x23"
4325                          "\x41\x67\xA1\x24\x99\x7E\xCC\x9B"
4326                          "\x02\x8F\x6A\x49\xF6\x25\xBA\x7A"
4327                          "\xF4\x78\xFD\x79\x62\x63\x4F\x14"
4328                          "\xD6\x11\x11\x04\x05\x5F\x7E\xEA"
4329                          "\x4C\xB6\xF8\xF4\x5F\x48\x52\x54"
4330                          "\x94\x63\xA8\x4E\xCF\xD2\x1B\x1B"
4331                          "\x22\x18\x6A\xAF\x6E\x3E\xE1\x0D",
4332                .ilen   = 496,
4333                .result = "\x56\xED\x84\x1B\x8F\x26\xBD\x31"
4334                          "\xC8\x5F\xF6\x6A\x01\x98\x0C\xA3"
4335                          "\x3A\xD1\x45\xDC\x73\x0A\x7E\x15"
4336                          "\xAC\x20\xB7\x4E\xE5\x59\xF0\x87"
4337                          "\x1E\x92\x29\xC0\x34\xCB\x62\xF9"
4338                          "\x6D\x04\x9B\x0F\xA6\x3D\xD4\x48"
4339                          "\xDF\x76\x0D\x81\x18\xAF\x23\xBA"
4340                          "\x51\xE8\x5C\xF3\x8A\x21\x95\x2C"
4341                          "\xC3\x37\xCE\x65\xFC\x70\x07\x9E"
4342                          "\x12\xA9\x40\xD7\x4B\xE2\x79\x10"
4343                          "\x84\x1B\xB2\x26\xBD\x54\xEB\x5F"
4344                          "\xF6\x8D\x01\x98\x2F\xC6\x3A\xD1"
4345                          "\x68\xFF\x73\x0A\xA1\x15\xAC\x43"
4346                          "\xDA\x4E\xE5\x7C\x13\x87\x1E\xB5"
4347                          "\x29\xC0\x57\xEE\x62\xF9\x90\x04"
4348                          "\x9B\x32\xC9\x3D\xD4\x6B\x02\x76"
4349                          "\x0D\xA4\x18\xAF\x46\xDD\x51\xE8"
4350                          "\x7F\x16\x8A\x21\xB8\x2C\xC3\x5A"
4351                          "\xF1\x65\xFC\x93\x07\x9E\x35\xCC"
4352                          "\x40\xD7\x6E\x05\x79\x10\xA7\x1B"
4353                          "\xB2\x49\xE0\x54\xEB\x82\x19\x8D"
4354                          "\x24\xBB\x2F\xC6\x5D\xF4\x68\xFF"
4355                          "\x96\x0A\xA1\x38\xCF\x43\xDA\x71"
4356                          "\x08\x7C\x13\xAA\x1E\xB5\x4C\xE3"
4357                          "\x57\xEE\x85\x1C\x90\x27\xBE\x32"
4358                          "\xC9\x60\xF7\x6B\x02\x99\x0D\xA4"
4359                          "\x3B\xD2\x46\xDD\x74\x0B\x7F\x16"
4360                          "\xAD\x21\xB8\x4F\xE6\x5A\xF1\x88"
4361                          "\x1F\x93\x2A\xC1\x35\xCC\x63\xFA"
4362                          "\x6E\x05\x9C\x10\xA7\x3E\xD5\x49"
4363                          "\xE0\x77\x0E\x82\x19\xB0\x24\xBB"
4364                          "\x52\xE9\x5D\xF4\x8B\x22\x96\x2D"
4365                          "\xC4\x38\xCF\x66\xFD\x71\x08\x9F"
4366                          "\x13\xAA\x41\xD8\x4C\xE3\x7A\x11"
4367                          "\x85\x1C\xB3\x27\xBE\x55\xEC\x60"
4368                          "\xF7\x8E\x02\x99\x30\xC7\x3B\xD2"
4369                          "\x69\x00\x74\x0B\xA2\x16\xAD\x44"
4370                          "\xDB\x4F\xE6\x7D\x14\x88\x1F\xB6"
4371                          "\x2A\xC1\x58\xEF\x63\xFA\x91\x05"
4372                          "\x9C\x33\xCA\x3E\xD5\x6C\x03\x77"
4373                          "\x0E\xA5\x19\xB0\x47\xDE\x52\xE9"
4374                          "\x80\x17\x8B\x22\xB9\x2D\xC4\x5B"
4375                          "\xF2\x66\xFD\x94\x08\x9F\x36\xCD"
4376                          "\x41\xD8\x6F\x06\x7A\x11\xA8\x1C"
4377                          "\xB3\x4A\xE1\x55\xEC\x83\x1A\x8E"
4378                          "\x25\xBC\x30\xC7\x5E\xF5\x69\x00"
4379                          "\x97\x0B\xA2\x39\xD0\x44\xDB\x72"
4380                          "\x09\x7D\x14\xAB\x1F\xB6\x4D\xE4"
4381                          "\x58\xEF\x86\x1D\x91\x28\xBF\x33"
4382                          "\xCA\x61\xF8\x6C\x03\x9A\x0E\xA5"
4383                          "\x3C\xD3\x47\xDE\x75\x0C\x80\x17"
4384                          "\xAE\x22\xB9\x50\xE7\x5B\xF2\x89"
4385                          "\x20\x94\x2B\xC2\x36\xCD\x64\xFB"
4386                          "\x6F\x06\x9D\x11\xA8\x3F\xD6\x4A"
4387                          "\xE1\x78\x0F\x83\x1A\xB1\x25\xBC"
4388                          "\x53\xEA\x5E\xF5\x8C\x00\x97\x2E"
4389                          "\xC5\x39\xD0\x67\xFE\x72\x09\xA0"
4390                          "\x14\xAB\x42\xD9\x4D\xE4\x7B\x12"
4391                          "\x86\x1D\xB4\x28\xBF\x56\xED\x61"
4392                          "\xF8\x8F\x03\x9A\x31\xC8\x3C\xD3"
4393                          "\x6A\x01\x75\x0C\xA3\x17\xAE\x45"
4394                          "\xDC\x50\xE7\x7E\x15\x89\x20\xB7",
4395                .rlen   = 496,
4396        }, { /* Generated with Crypto++ */
4397                .key    = "\x85\x62\x3F\x1C\xF9\xD6\x1C\xF9"
4398                          "\xD6\xB3\x90\x6D\x4A\x90\x6D\x4A"
4399                          "\x27\x04\xE1\x27\x04\xE1\xBE\x9B"
4400                          "\x78\xBE\x9B\x78\x55\x32\x0F\x55",
4401                .klen   = 32,
4402                .iv     = "\xE2\x24\x89\xEE\x53\xB8\x1D\x5F"
4403                          "\xC4\x29\x8E\xF3\x35\x9A\xFF\x64",
4404                .input  = "\xDF\xDD\x69\xFA\xB0\x2E\xFD\xFE"
4405                          "\x70\x9E\xC5\x4B\xC9\xD4\xA1\x30"
4406                          "\x26\x9B\x89\xA1\xEE\x43\xE0\x52"
4407                          "\x55\x17\x4E\xC7\x0E\x33\x1F\xF1"
4408                          "\x9F\x8D\x40\x9F\x24\xFD\x92\xA0"
4409                          "\xBC\x8F\x35\xDD\x67\x38\xD8\xAA"
4410                          "\xCF\xF8\x48\xCA\xFB\xE4\x5C\x60"
4411                          "\x01\x41\x21\x12\x38\xAB\x52\x4F"
4412                          "\xA8\x57\x20\xE0\x21\x6A\x17\x0D"
4413                          "\x0E\xF9\x8E\x49\x42\x00\x3C\x94"
4414                          "\x14\xC0\xD0\x8D\x8A\x98\xEB\x29"
4415                          "\xEC\xAE\x96\x44\xC0\x3C\x48\xDC"
4416                          "\x29\x35\x25\x2F\xE7\x11\x6C\x68"
4417                          "\xC8\x67\x0A\x2F\xF4\x07\xBE\xF9"
4418                          "\x2C\x31\x87\x40\xAB\xB2\xB6\xFA"
4419                          "\xD2\xC9\x6D\x5C\x50\xE9\xE6\x7E"
4420                          "\xE3\x0A\xD2\xD5\x6D\x8D\x64\x9E"
4421                          "\x70\xCE\x03\x76\xDD\xE0\xF0\x8C"
4422                          "\x84\x86\x8B\x6A\xFE\xC7\xF9\x69"
4423                          "\x2E\xFE\xFC\xC2\xC4\x1A\x55\x58"
4424                          "\xB3\xBE\xE2\x7E\xED\x39\x42\x6C"
4425                          "\xB4\x42\x97\x9A\xEC\xE1\x0A\x06"
4426                          "\x02\xC5\x03\x9D\xC4\x48\x15\x66"
4427                          "\x35\x6A\xC2\xC9\xA2\x26\x30\xBB"
4428                          "\xDB\x2D\xC8\x08\x2B\xA0\x29\x1A"
4429                          "\x23\x61\x48\xEA\x80\x04\x27\xAA"
4430                          "\x69\x49\xE8\xE8\x4A\x83\x6B\x5A"
4431                          "\xCA\x7C\xD3\xB1\xB5\x0B\xCC\x23"
4432                          "\x74\x1F\xA9\x87\xCD\xED\xC0\x2D"
4433                          "\xBF\xEB\xCF\x16\x2D\x2A\x2E\x1D"
4434                          "\x96\xBA\x36\x11\x45\x41\xDA\xCE"
4435                          "\xA4\x48\x80\x8B\x06\xF4\x98\x89"
4436                          "\x8B\x23\x08\x53\xF4\xD4\x5A\x24"
4437                          "\x8B\xF8\x43\x73\xD1\xEE\xC4\xB0"
4438                          "\xF8\xFE\x09\x0C\x75\x05\x38\x0B"
4439                          "\x7C\x81\xDE\x9D\xE4\x61\x37\x63"
4440                          "\x63\xAD\x12\xD2\x04\xB9\xCE\x45"
4441                          "\x5A\x1A\x6E\xB3\x78\x2A\xA4\x74"
4442                          "\x86\xD0\xE3\xFF\xDA\x38\x9C\xB5"
4443                          "\xB8\xB1\xDB\x38\x2F\xC5\x6A\xB4"
4444                          "\xEB\x6E\x96\xE8\x43\x80\xB5\x51"
4445                          "\x61\x2D\x48\xAA\x07\x65\x11\x8C"
4446                          "\x48\xE3\x90\x7E\x78\x3A\xEC\x97"
4447                          "\x05\x3D\x84\xE7\x90\x2B\xAA\xBD"
4448                          "\x83\x29\x0E\x1A\x81\x73\x7B\xE0"
4449                          "\x7A\x01\x4A\x37\x3B\x77\x7F\x8D"
4450                          "\x49\xA4\x2F\x6E\xBE\x68\x99\x08"
4451                          "\x99\xAA\x4C\x12\x04\xAE\x1F\x77"
4452                          "\x35\x88\xF1\x65\x06\x0A\x0B\x4D"
4453                          "\x47\xF9\x50\x38\x5D\x71\xF9\x6E"
4454                          "\xDE\xEC\x61\x35\x2C\x4C\x96\x50"
4455                          "\xE8\x28\x93\x9C\x7E\x01\xC6\x04"
4456                          "\xB2\xD6\xBC\x6C\x17\xEB\xC1\x7D"
4457                          "\x11\xE9\x43\x83\x76\xAA\x53\x37"
4458                          "\x0C\x1D\x39\x89\x53\x72\x09\x7E"
4459                          "\xD9\x85\x16\x04\xA5\x2C\x05\x6F"
4460                          "\x17\x0C\x6E\x66\xAA\x84\xA7\xD9"
4461                          "\xE2\xD9\xC4\xEB\x43\x3E\xB1\x8D"
4462                          "\x7C\x36\xC7\x71\x70\x9C\x10\xD8"
4463                          "\xE8\x47\x2A\x4D\xFD\xA1\xBC\xE3"
4464                          "\xB9\x32\xE2\xC1\x82\xAC\xFE\xCC"
4465                          "\xC5\xC9\x7F\x9E\xCF\x33\x7A\xDF"
4466                          "\x6C\x82\x9D",
4467                .ilen   = 499,
4468                .result = "\x56\xED\x84\x1B\x8F\x26\xBD\x31"
4469                          "\xC8\x5F\xF6\x6A\x01\x98\x0C\xA3"
4470                          "\x3A\xD1\x45\xDC\x73\x0A\x7E\x15"
4471                          "\xAC\x20\xB7\x4E\xE5\x59\xF0\x87"
4472                          "\x1E\x92\x29\xC0\x34\xCB\x62\xF9"
4473                          "\x6D\x04\x9B\x0F\xA6\x3D\xD4\x48"
4474                          "\xDF\x76\x0D\x81\x18\xAF\x23\xBA"
4475                          "\x51\xE8\x5C\xF3\x8A\x21\x95\x2C"
4476                          "\xC3\x37\xCE\x65\xFC\x70\x07\x9E"
4477                          "\x12\xA9\x40\xD7\x4B\xE2\x79\x10"
4478                          "\x84\x1B\xB2\x26\xBD\x54\xEB\x5F"
4479                          "\xF6\x8D\x01\x98\x2F\xC6\x3A\xD1"
4480                          "\x68\xFF\x73\x0A\xA1\x15\xAC\x43"
4481                          "\xDA\x4E\xE5\x7C\x13\x87\x1E\xB5"
4482                          "\x29\xC0\x57\xEE\x62\xF9\x90\x04"
4483                          "\x9B\x32\xC9\x3D\xD4\x6B\x02\x76"
4484                          "\x0D\xA4\x18\xAF\x46\xDD\x51\xE8"
4485                          "\x7F\x16\x8A\x21\xB8\x2C\xC3\x5A"
4486                          "\xF1\x65\xFC\x93\x07\x9E\x35\xCC"
4487                          "\x40\xD7\x6E\x05\x79\x10\xA7\x1B"
4488                          "\xB2\x49\xE0\x54\xEB\x82\x19\x8D"
4489                          "\x24\xBB\x2F\xC6\x5D\xF4\x68\xFF"
4490                          "\x96\x0A\xA1\x38\xCF\x43\xDA\x71"
4491                          "\x08\x7C\x13\xAA\x1E\xB5\x4C\xE3"
4492                          "\x57\xEE\x85\x1C\x90\x27\xBE\x32"
4493                          "\xC9\x60\xF7\x6B\x02\x99\x0D\xA4"
4494                          "\x3B\xD2\x46\xDD\x74\x0B\x7F\x16"
4495                          "\xAD\x21\xB8\x4F\xE6\x5A\xF1\x88"
4496                          "\x1F\x93\x2A\xC1\x35\xCC\x63\xFA"
4497                          "\x6E\x05\x9C\x10\xA7\x3E\xD5\x49"
4498                          "\xE0\x77\x0E\x82\x19\xB0\x24\xBB"
4499                          "\x52\xE9\x5D\xF4\x8B\x22\x96\x2D"
4500                          "\xC4\x38\xCF\x66\xFD\x71\x08\x9F"
4501                          "\x13\xAA\x41\xD8\x4C\xE3\x7A\x11"
4502                          "\x85\x1C\xB3\x27\xBE\x55\xEC\x60"
4503                          "\xF7\x8E\x02\x99\x30\xC7\x3B\xD2"
4504                          "\x69\x00\x74\x0B\xA2\x16\xAD\x44"
4505                          "\xDB\x4F\xE6\x7D\x14\x88\x1F\xB6"
4506                          "\x2A\xC1\x58\xEF\x63\xFA\x91\x05"
4507                          "\x9C\x33\xCA\x3E\xD5\x6C\x03\x77"
4508                          "\x0E\xA5\x19\xB0\x47\xDE\x52\xE9"
4509                          "\x80\x17\x8B\x22\xB9\x2D\xC4\x5B"
4510                          "\xF2\x66\xFD\x94\x08\x9F\x36\xCD"
4511                          "\x41\xD8\x6F\x06\x7A\x11\xA8\x1C"
4512                          "\xB3\x4A\xE1\x55\xEC\x83\x1A\x8E"
4513                          "\x25\xBC\x30\xC7\x5E\xF5\x69\x00"
4514                          "\x97\x0B\xA2\x39\xD0\x44\xDB\x72"
4515                          "\x09\x7D\x14\xAB\x1F\xB6\x4D\xE4"
4516                          "\x58\xEF\x86\x1D\x91\x28\xBF\x33"
4517                          "\xCA\x61\xF8\x6C\x03\x9A\x0E\xA5"
4518                          "\x3C\xD3\x47\xDE\x75\x0C\x80\x17"
4519                          "\xAE\x22\xB9\x50\xE7\x5B\xF2\x89"
4520                          "\x20\x94\x2B\xC2\x36\xCD\x64\xFB"
4521                          "\x6F\x06\x9D\x11\xA8\x3F\xD6\x4A"
4522                          "\xE1\x78\x0F\x83\x1A\xB1\x25\xBC"
4523                          "\x53\xEA\x5E\xF5\x8C\x00\x97\x2E"
4524                          "\xC5\x39\xD0\x67\xFE\x72\x09\xA0"
4525                          "\x14\xAB\x42\xD9\x4D\xE4\x7B\x12"
4526                          "\x86\x1D\xB4\x28\xBF\x56\xED\x61"
4527                          "\xF8\x8F\x03\x9A\x31\xC8\x3C\xD3"
4528                          "\x6A\x01\x75\x0C\xA3\x17\xAE\x45"
4529                          "\xDC\x50\xE7\x7E\x15\x89\x20\xB7"
4530                          "\x2B\xC2\x59",
4531                .rlen   = 499,
4532                .also_non_np = 1,
4533                .np     = 2,
4534                .tap    = { 499 - 16, 16 },
4535        },
4536};
4537
4538static struct cipher_testvec tf_lrw_enc_tv_template[] = {
4539        /* Generated from AES-LRW test vectors */
4540        {
4541                .key    = "\x45\x62\xac\x25\xf8\x28\x17\x6d"
4542                          "\x4c\x26\x84\x14\xb5\x68\x01\x85"
4543                          "\x25\x8e\x2a\x05\xe7\x3e\x9d\x03"
4544                          "\xee\x5a\x83\x0c\xcc\x09\x4c\x87",
4545                .klen   = 32,
4546                .iv     = "\x00\x00\x00\x00\x00\x00\x00\x00"
4547                          "\x00\x00\x00\x00\x00\x00\x00\x01",
4548                .input  = "\x30\x31\x32\x33\x34\x35\x36\x37"
4549                          "\x38\x39\x41\x42\x43\x44\x45\x46",
4550                .ilen   = 16,
4551                .result = "\xa1\x6c\x50\x69\x26\xa4\xef\x7b"
4552                          "\x7c\xc6\x91\xeb\x72\xdd\x9b\xee",
4553                .rlen   = 16,
4554        }, {
4555                .key    = "\x59\x70\x47\x14\xf5\x57\x47\x8c"
4556                          "\xd7\x79\xe8\x0f\x54\x88\x79\x44"
4557                          "\x0d\x48\xf0\xb7\xb1\x5a\x53\xea"
4558                          "\x1c\xaa\x6b\x29\xc2\xca\xfb\xaf",
4559                .klen   = 32,
4560                .iv     = "\x00\x00\x00\x00\x00\x00\x00\x00"
4561                          "\x00\x00\x00\x00\x00\x00\x00\x02",
4562                .input  = "\x30\x31\x32\x33\x34\x35\x36\x37"
4563                          "\x38\x39\x41\x42\x43\x44\x45\x46",
4564                .ilen   = 16,
4565                .result = "\xab\x72\x0a\xad\x3b\x0c\xf0\xc9"
4566                          "\x42\x2f\xf1\xae\xf1\x3c\xb1\xbd",
4567                .rlen   = 16,
4568        }, {
4569                .key    = "\xd8\x2a\x91\x34\xb2\x6a\x56\x50"
4570                          "\x30\xfe\x69\xe2\x37\x7f\x98\x47"
4571                          "\xcd\xf9\x0b\x16\x0c\x64\x8f\xb6"
4572                          "\xb0\x0d\x0d\x1b\xae\x85\x87\x1f",
4573                .klen   = 32,
4574                .iv     = "\x00\x00\x00\x00\x00\x00\x00\x00"
4575                          "\x00\x00\x00\x02\x00\x00\x00\x00",
4576                .input  = "\x30\x31\x32\x33\x34\x35\x36\x37"
4577                          "\x38\x39\x41\x42\x43\x44\x45\x46",
4578                .ilen   = 16,
4579                .result = "\x85\xa7\x56\x67\x08\xfa\x42\xe1"
4580                          "\x22\xe6\x82\xfc\xd9\xb4\xd7\xd4",
4581                .rlen   = 16,
4582        }, {
4583                .key    = "\x0f\x6a\xef\xf8\xd3\xd2\xbb\x15"
4584                          "\x25\x83\xf7\x3c\x1f\x01\x28\x74"
4585                          "\xca\xc6\xbc\x35\x4d\x4a\x65\x54"
4586                          "\x90\xae\x61\xcf\x7b\xae\xbd\xcc"
4587                          "\xad\xe4\x94\xc5\x4a\x29\xae\x70",
4588                .klen   = 40,
4589                .iv     = "\x00\x00\x00\x00\x00\x00\x00\x00"
4590                          "\x00\x00\x00\x00\x00\x00\x00\x01",
4591                .input  = "\x30\x31\x32\x33\x34\x35\x36\x37"
4592                          "\x38\x39\x41\x42\x43\x44\x45\x46",
4593                .ilen   = 16,
4594                .result = "\xd2\xaf\x69\x35\x24\x1d\x0e\x1c"
4595                          "\x84\x8b\x05\xe4\xa2\x2f\x16\xf5",
4596                .rlen   = 16,
4597        }, {
4598                .key    = "\x8a\xd4\xee\x10\x2f\xbd\x81\xff"
4599                          "\xf8\x86\xce\xac\x93\xc5\xad\xc6"
4600                          "\xa0\x19\x07\xc0\x9d\xf7\xbb\xdd"
4601                          "\x52\x13\xb2\xb7\xf0\xff\x11\xd8"
4602                          "\xd6\x08\xd0\xcd\x2e\xb1\x17\x6f",
4603                .klen   = 40,
4604                .iv     = "\x00\x00\x00\x00\x00\x00\x00\x00"
4605                          "\x00\x00\x00\x02\x00\x00\x00\x00",
4606                .input  = "\x30\x31\x32\x33\x34\x35\x36\x37"
4607                          "\x38\x39\x41\x42\x43\x44\x45\x46",
4608                .ilen   = 16,
4609                .result = "\x4a\x23\x56\xd7\xff\x90\xd0\x9a"
4610                          "\x0d\x7c\x26\xfc\xf0\xf0\xf6\xe4",
4611                .rlen   = 16,
4612        }, {
4613                .key    = "\xf8\xd4\x76\xff\xd6\x46\xee\x6c"
4614                          "\x23\x84\xcb\x1c\x77\xd6\x19\x5d"
4615                          "\xfe\xf1\xa9\xf3\x7b\xbc\x8d\x21"
4616                          "\xa7\x9c\x21\xf8\xcb\x90\x02\x89"
4617                          "\xa8\x45\x34\x8e\xc8\xc5\xb5\xf1"
4618                          "\x26\xf5\x0e\x76\xfe\xfd\x1b\x1e",
4619                .klen   = 48,
4620                .iv     = "\x00\x00\x00\x00\x00\x00\x00\x00"
4621                          "\x00\x00\x00\x00\x00\x00\x00\x01",
4622                .input  = "\x30\x31\x32\x33\x34\x35\x36\x37"
4623                          "\x38\x39\x41\x42\x43\x44\x45\x46",
4624                .ilen   = 16,
4625                .result = "\x30\xaf\x26\x05\x9d\x5d\x0a\x58"
4626                          "\xe2\xe7\xce\x8a\xb2\x56\x6d\x76",
4627                .rlen   = 16,
4628        }, {
4629                .key    = "\xfb\x76\x15\xb2\x3d\x80\x89\x1d"
4630                          "\xd4\x70\x98\x0b\xc7\x95\x84\xc8"
4631                          "\xb2\xfb\x64\xce\x60\x97\x87\x8d"
4632                          "\x17\xfc\xe4\x5a\x49\xe8\x30\xb7"
4633                          "\x6e\x78\x17\xe7\x2d\x5e\x12\xd4"
4634                          "\x60\x64\x04\x7a\xf1\x2f\x9e\x0c",
4635                .klen   = 48,
4636                .iv     = "\x00\x00\x00\x00\x00\x00\x00\x00"
4637                          "\x00\x00\x00\x02\x00\x00\x00\x00",
4638                .input  = "\x30\x31\x32\x33\x34\x35\x36\x37"
4639                          "\x38\x39\x41\x42\x43\x44\x45\x46",
4640                .ilen   = 16,
4641                .result = "\xdf\xcf\xdc\xd2\xe1\xcf\x86\x75"
4642                          "\x17\x66\x5e\x0c\x14\xa1\x3d\x40",
4643                .rlen   = 16,
4644        }, {
4645                .key    = "\xf8\xd4\x76\xff\xd6\x46\xee\x6c"
4646                          "\x23\x84\xcb\x1c\x77\xd6\x19\x5d"
4647                          "\xfe\xf1\xa9\xf3\x7b\xbc\x8d\x21"
4648                          "\xa7\x9c\x21\xf8\xcb\x90\x02\x89"
4649                          "\xa8\x45\x34\x8e\xc8\xc5\xb5\xf1"
4650                          "\x26\xf5\x0e\x76\xfe\xfd\x1b\x1e",
4651                .klen   = 48,
4652                .iv     = "\x00\x00\x00\x00\x00\x00\x00\x00"
4653                          "\x00\x00\x00\x00\x00\x00\x00\x01",
4654                .input  = "\x05\x11\xb7\x18\xab\xc6\x2d\xac"
4655                          "\x70\x5d\xf6\x22\x94\xcd\xe5\x6c"
4656                          "\x17\x6b\xf6\x1c\xf0\xf3\x6e\xf8"
4657                          "\x50\x38\x1f\x71\x49\xb6\x57\xd6"
4658                          "\x8f\xcb\x8d\x6b\xe3\xa6\x29\x90"
4659                          "\xfe\x2a\x62\x82\xae\x6d\x8b\xf6"
4660                          "\xad\x1e\x9e\x20\x5f\x38\xbe\x04"
4661                          "\xda\x10\x8e\xed\xa2\xa4\x87\xab"
4662                          "\xda\x6b\xb4\x0c\x75\xba\xd3\x7c"
4663                          "\xc9\xac\x42\x31\x95\x7c\xc9\x04"
4664                          "\xeb\xd5\x6e\x32\x69\x8a\xdb\xa6"
4665                          "\x15\xd7\x3f\x4f\x2f\x66\x69\x03"
4666                          "\x9c\x1f\x54\x0f\xde\x1f\xf3\x65"
4667                          "\x4c\x96\x12\xed\x7c\x92\x03\x01"
4668                          "\x6f\xbc\x35\x93\xac\xf1\x27\xf1"
4669                          "\xb4\x96\x82\x5a\x5f\xb0\xa0\x50"
4670                          "\x89\xa4\x8e\x66\x44\x85\xcc\xfd"
4671                          "\x33\x14\x70\xe3\x96\xb2\xc3\xd3"
4672                          "\xbb\x54\x5a\x1a\xf9\x74\xa2\xc5"
4673                          "\x2d\x64\x75\xdd\xb4\x54\xe6\x74"
4674                          "\x8c\xd3\x9d\x9e\x86\xab\x51\x53"
4675                          "\xb7\x93\x3e\x6f\xd0\x4e\x2c\x40"
4676                          "\xf6\xa8\x2e\x3e\x9d\xf4\x66\xa5"
4677                          "\x76\x12\x73\x44\x1a\x56\xd7\x72"
4678                          "\x88\xcd\x21\x8c\x4c\x0f\xfe\xda"
4679                          "\x95\xe0\x3a\xa6\xa5\x84\x46\xcd"
4680                          "\xd5\x3e\x9d\x3a\xe2\x67\xe6\x60"
4681                          "\x1a\xe2\x70\x85\x58\xc2\x1b\x09"
4682                          "\xe1\xd7\x2c\xca\xad\xa8\x8f\xf9"
4683                          "\xac\xb3\x0e\xdb\xca\x2e\xe2\xb8"
4684                          "\x51\x71\xd9\x3c\x6c\xf1\x56\xf8"
4685                          "\xea\x9c\xf1\xfb\x0c\xe6\xb7\x10"
4686                          "\x1c\xf8\xa9\x7c\xe8\x53\x35\xc1"
4687                          "\x90\x3e\x76\x4a\x74\xa4\x21\x2c"
4688                          "\xf6\x2c\x4e\x0f\x94\x3a\x88\x2e"
4689                          "\x41\x09\x6a\x33\x7d\xf6\xdd\x3f"
4690                          "\x8d\x23\x31\x74\x84\xeb\x88\x6e"
4691                          "\xcc\xb9\xbc\x22\x83\x19\x07\x22"
4692                          "\xa5\x2d\xdf\xa5\xf3\x80\x85\x78"
4693                          "\x84\x39\x6a\x6d\x6a\x99\x4f\xa5"
4694                          "\x15\xfe\x46\xb0\xe4\x6c\xa5\x41"
4695                          "\x3c\xce\x8f\x42\x60\x71\xa7\x75"
4696                          "\x08\x40\x65\x8a\x82\xbf\xf5\x43"
4697                          "\x71\x96\xa9\x4d\x44\x8a\x20\xbe"
4698                          "\xfa\x4d\xbb\xc0\x7d\x31\x96\x65"
4699                          "\xe7\x75\xe5\x3e\xfd\x92\x3b\xc9"
4700                          "\x55\xbb\x16\x7e\xf7\xc2\x8c\xa4"
4701                          "\x40\x1d\xe5\xef\x0e\xdf\xe4\x9a"
4702                          "\x62\x73\x65\xfd\x46\x63\x25\x3d"
4703                          "\x2b\xaf\xe5\x64\xfe\xa5\x5c\xcf"
4704                          "\x24\xf3\xb4\xac\x64\xba\xdf\x4b"
4705                          "\xc6\x96\x7d\x81\x2d\x8d\x97\xf7"
4706                          "\xc5\x68\x77\x84\x32\x2b\xcc\x85"
4707                          "\x74\x96\xf0\x12\x77\x61\xb9\xeb"
4708                          "\x71\xaa\x82\xcb\x1c\xdb\x89\xc8"
4709                          "\xc6\xb5\xe3\x5c\x7d\x39\x07\x24"
4710                          "\xda\x39\x87\x45\xc0\x2b\xbb\x01"
4711                          "\xac\xbc\x2a\x5c\x7f\xfc\xe8\xce"
4712                          "\x6d\x9c\x6f\xed\xd3\xc1\xa1\xd6"
4713                          "\xc5\x55\xa9\x66\x2f\xe1\xc8\x32"
4714                          "\xa6\x5d\xa4\x3a\x98\x73\xe8\x45"
4715                          "\xa4\xc7\xa8\xb4\xf6\x13\x03\xf6"
4716                          "\xe9\x2e\xc4\x29\x0f\x84\xdb\xc4"
4717                          "\x21\xc4\xc2\x75\x67\x89\x37\x0a",
4718                .ilen   = 512,
4719                .result = "\x30\x38\xeb\xaf\x12\x43\x1a\x89"
4720                          "\x62\xa2\x36\xe5\xcf\x77\x1e\xd9"
4721                          "\x08\xc3\x0d\xdd\x95\xab\x19\x96"
4722                          "\x27\x52\x41\xc3\xca\xfb\xf6\xee"
4723                          "\x40\x2d\xdf\xdd\x00\x0c\xb9\x0a"
4724                          "\x3a\xf0\xc0\xd1\xda\x63\x9e\x45"
4725                          "\x42\xe9\x29\xc0\xb4\x07\xb4\x31"
4726                          "\x66\x77\x72\xb5\xb6\xb3\x57\x46"
4727                          "\x34\x9a\xfe\x03\xaf\x6b\x36\x07"
4728                          "\x63\x8e\xc2\x5d\xa6\x0f\xb6\x7d"
4729                          "\xfb\x6d\x82\x51\xb6\x98\xd0\x71"
4730                          "\xe7\x10\x7a\xdf\xb2\xbd\xf1\x1d"
4731                          "\x72\x2b\x54\x13\xe3\x6d\x79\x37"
4732                          "\xa9\x39\x2c\xdf\x21\xab\x87\xd5"
4733                          "\xee\xef\x9a\x12\x50\x39\x2e\x1b"
4734                          "\x7d\xe6\x6a\x27\x48\xb9\xe7\xac"
4735                          "\xaa\xcd\x79\x5f\xf2\xf3\xa0\x08"
4736                          "\x6f\x2c\xf4\x0e\xd1\xb8\x89\x25"
4737                          "\x31\x9d\xef\xb1\x1d\x27\x55\x04"
4738                          "\xc9\x8c\xb7\x68\xdc\xb6\x67\x8a"
4739                          "\xdb\xcf\x22\xf2\x3b\x6f\xce\xbb"
4740                          "\x26\xbe\x4f\x27\x04\x42\xd1\x44"
4741                          "\x4c\x08\xa3\x95\x4c\x7f\x1a\xaf"
4742                          "\x1d\x28\x14\xfd\xb1\x1a\x34\x18"
4743                          "\xf5\x1e\x28\x69\x95\x6a\x5a\xba"
4744                          "\x8e\xb2\x58\x1d\x28\x17\x13\x3d"
4745                          "\x38\x7d\x14\x8d\xab\x5d\xf9\xe8"
4746                          "\x3c\x0f\x2b\x0d\x2b\x08\xb4\x4b"
4747                          "\x6b\x0d\xc8\xa7\x84\xc2\x3a\x1a"
4748                          "\xb7\xbd\xda\x92\x29\xb8\x5b\x5a"
4749                          "\x63\xa5\x99\x82\x09\x72\x8f\xc6"
4750                          "\xa4\x62\x24\x69\x8c\x2d\x26\x00"
4751                          "\x99\x83\x91\xd6\xc6\xcf\x57\x67"
4752                          "\x38\xea\xf2\xfc\x29\xe0\x73\x39"
4753                          "\xf9\x13\x94\x6d\xe2\x58\x28\x75"
4754                          "\x3e\xae\x71\x90\x07\x70\x1c\x38"
4755                          "\x5b\x4c\x1e\xb5\xa5\x3b\x20\xef"
4756                          "\xb1\x4c\x3e\x1a\x72\x62\xbb\x22"
4757                          "\x82\x09\xe3\x18\x3f\x4f\x48\xfc"
4758                          "\xdd\xac\xfc\xb6\x09\xdb\xd2\x7b"
4759                          "\xd6\xb7\x7e\x41\x2f\x14\xf5\x0e"
4760                          "\xc3\xac\x4a\xed\xe7\x82\xef\x31"
4761                          "\x1f\x1a\x51\x1e\x29\x60\xc8\x98"
4762                          "\x93\x51\x1d\x3d\x62\x59\x83\x82"
4763                          "\x0c\xf1\xd7\x8d\xac\x33\x44\x81"
4764                          "\x3c\x59\xb7\xd4\x5b\x65\x82\xc4"
4765                          "\xec\xdc\x24\xfd\x0e\x1a\x79\x94"
4766                          "\x34\xb0\x62\xfa\x98\x49\x26\x1f"
4767                          "\xf4\x9e\x40\x44\x5b\x1f\xf8\xbe"
4768                          "\x36\xff\xc6\xc6\x9d\xf2\xd6\xcc"
4769                          "\x63\x93\x29\xb9\x0b\x6d\xd7\x6c"
4770                          "\xdb\xf6\x21\x80\xf7\x5a\x37\x15"
4771                          "\x0c\xe3\x36\xc8\x74\x75\x20\x91"
4772                          "\xdf\x52\x2d\x0c\xe7\x45\xff\x46"
4773                          "\xb3\xf4\xec\xc2\xbd\xd3\x37\xb6"
4774                          "\x26\xa2\x5d\x7d\x61\xbf\x10\x46"
4775                          "\x57\x8d\x05\x96\x70\x0b\xd6\x41"
4776                          "\x5c\xe9\xd3\x54\x81\x39\x3a\xdd"
4777                          "\x5f\x92\x81\x6e\x35\x03\xd4\x72"
4778                          "\x3d\x5a\xe7\xb9\x3b\x0c\x84\x23"
4779                          "\x45\x5d\xec\x72\xc1\x52\xef\x2e"
4780                          "\x81\x00\xd3\xfe\x4c\x3c\x05\x61"
4781                          "\x80\x18\xc4\x6c\x03\xd3\xb7\xba"
4782                          "\x11\xd7\xb8\x6e\xea\xe1\x80\x30",
4783                .rlen   = 512,
4784                .also_non_np = 1,
4785                .np     = 2,
4786                .tap    = { 512 - 16, 16 },
4787        },
4788};
4789
4790static struct cipher_testvec tf_lrw_dec_tv_template[] = {
4791        /* Generated from AES-LRW test vectors */
4792        /* same as enc vectors with input and result reversed */
4793        {
4794                .key    = "\x45\x62\xac\x25\xf8\x28\x17\x6d"
4795                          "\x4c\x26\x84\x14\xb5\x68\x01\x85"
4796                          "\x25\x8e\x2a\x05\xe7\x3e\x9d\x03"
4797                          "\xee\x5a\x83\x0c\xcc\x09\x4c\x87",
4798                .klen   = 32,
4799                .iv     = "\x00\x00\x00\x00\x00\x00\x00\x00"
4800                          "\x00\x00\x00\x00\x00\x00\x00\x01",
4801                .input  = "\xa1\x6c\x50\x69\x26\xa4\xef\x7b"
4802                          "\x7c\xc6\x91\xeb\x72\xdd\x9b\xee",
4803                .ilen   = 16,
4804                .result = "\x30\x31\x32\x33\x34\x35\x36\x37"
4805                          "\x38\x39\x41\x42\x43\x44\x45\x46",
4806                .rlen   = 16,
4807        }, {
4808                .key    = "\x59\x70\x47\x14\xf5\x57\x47\x8c"
4809                          "\xd7\x79\xe8\x0f\x54\x88\x79\x44"
4810                          "\x0d\x48\xf0\xb7\xb1\x5a\x53\xea"
4811                          "\x1c\xaa\x6b\x29\xc2\xca\xfb\xaf",
4812                .klen   = 32,
4813                .iv     = "\x00\x00\x00\x00\x00\x00\x00\x00"
4814                          "\x00\x00\x00\x00\x00\x00\x00\x02",
4815                .input  = "\xab\x72\x0a\xad\x3b\x0c\xf0\xc9"
4816                          "\x42\x2f\xf1\xae\xf1\x3c\xb1\xbd",
4817                .ilen   = 16,
4818                .result = "\x30\x31\x32\x33\x34\x35\x36\x37"
4819                          "\x38\x39\x41\x42\x43\x44\x45\x46",
4820                .rlen   = 16,
4821        }, {
4822                .key    = "\xd8\x2a\x91\x34\xb2\x6a\x56\x50"
4823                          "\x30\xfe\x69\xe2\x37\x7f\x98\x47"
4824                          "\xcd\xf9\x0b\x16\x0c\x64\x8f\xb6"
4825                          "\xb0\x0d\x0d\x1b\xae\x85\x87\x1f",
4826                .klen   = 32,
4827                .iv     = "\x00\x00\x00\x00\x00\x00\x00\x00"
4828                          "\x00\x00\x00\x02\x00\x00\x00\x00",
4829                .input  = "\x85\xa7\x56\x67\x08\xfa\x42\xe1"
4830                          "\x22\xe6\x82\xfc\xd9\xb4\xd7\xd4",
4831                .ilen   = 16,
4832                .result = "\x30\x31\x32\x33\x34\x35\x36\x37"
4833                          "\x38\x39\x41\x42\x43\x44\x45\x46",
4834                .rlen   = 16,
4835        }, {
4836                .key    = "\x0f\x6a\xef\xf8\xd3\xd2\xbb\x15"
4837                          "\x25\x83\xf7\x3c\x1f\x01\x28\x74"
4838                          "\xca\xc6\xbc\x35\x4d\x4a\x65\x54"
4839                          "\x90\xae\x61\xcf\x7b\xae\xbd\xcc"
4840                          "\xad\xe4\x94\xc5\x4a\x29\xae\x70",
4841                .klen   = 40,
4842                .iv     = "\x00\x00\x00\x00\x00\x00\x00\x00"
4843                          "\x00\x00\x00\x00\x00\x00\x00\x01",
4844                .input  = "\xd2\xaf\x69\x35\x24\x1d\x0e\x1c"
4845                          "\x84\x8b\x05\xe4\xa2\x2f\x16\xf5",
4846                .ilen   = 16,
4847                .result = "\x30\x31\x32\x33\x34\x35\x36\x37"
4848                          "\x38\x39\x41\x42\x43\x44\x45\x46",
4849                .rlen   = 16,
4850        }, {
4851                .key    = "\x8a\xd4\xee\x10\x2f\xbd\x81\xff"
4852                          "\xf8\x86\xce\xac\x93\xc5\xad\xc6"
4853                          "\xa0\x19\x07\xc0\x9d\xf7\xbb\xdd"
4854                          "\x52\x13\xb2\xb7\xf0\xff\x11\xd8"
4855                          "\xd6\x08\xd0\xcd\x2e\xb1\x17\x6f",
4856                .klen   = 40,
4857                .iv     = "\x00\x00\x00\x00\x00\x00\x00\x00"
4858                          "\x00\x00\x00\x02\x00\x00\x00\x00",
4859                .input  = "\x4a\x23\x56\xd7\xff\x90\xd0\x9a"
4860                          "\x0d\x7c\x26\xfc\xf0\xf0\xf6\xe4",
4861                .ilen   = 16,
4862                .result = "\x30\x31\x32\x33\x34\x35\x36\x37"
4863                          "\x38\x39\x41\x42\x43\x44\x45\x46",
4864                .rlen   = 16,
4865        }, {
4866                .key    = "\xf8\xd4\x76\xff\xd6\x46\xee\x6c"
4867                          "\x23\x84\xcb\x1c\x77\xd6\x19\x5d"
4868                          "\xfe\xf1\xa9\xf3\x7b\xbc\x8d\x21"
4869                          "\xa7\x9c\x21\xf8\xcb\x90\x02\x89"
4870                          "\xa8\x45\x34\x8e\xc8\xc5\xb5\xf1"
4871                          "\x26\xf5\x0e\x76\xfe\xfd\x1b\x1e",
4872                .klen   = 48,
4873                .iv     = "\x00\x00\x00\x00\x00\x00\x00\x00"
4874                          "\x00\x00\x00\x00\x00\x00\x00\x01",
4875                .input  = "\x30\xaf\x26\x05\x9d\x5d\x0a\x58"
4876                          "\xe2\xe7\xce\x8a\xb2\x56\x6d\x76",
4877                .ilen   = 16,
4878                .result = "\x30\x31\x32\x33\x34\x35\x36\x37"
4879                          "\x38\x39\x41\x42\x43\x44\x45\x46",
4880                .rlen   = 16,
4881        }, {
4882                .key    = "\xfb\x76\x15\xb2\x3d\x80\x89\x1d"
4883                          "\xd4\x70\x98\x0b\xc7\x95\x84\xc8"
4884                          "\xb2\xfb\x64\xce\x60\x97\x87\x8d"
4885                          "\x17\xfc\xe4\x5a\x49\xe8\x30\xb7"
4886                          "\x6e\x78\x17\xe7\x2d\x5e\x12\xd4"
4887                          "\x60\x64\x04\x7a\xf1\x2f\x9e\x0c",
4888                .klen   = 48,
4889                .iv     = "\x00\x00\x00\x00\x00\x00\x00\x00"
4890                          "\x00\x00\x00\x02\x00\x00\x00\x00",
4891                .input  = "\xdf\xcf\xdc\xd2\xe1\xcf\x86\x75"
4892                          "\x17\x66\x5e\x0c\x14\xa1\x3d\x40",
4893                .ilen   = 16,
4894                .result = "\x30\x31\x32\x33\x34\x35\x36\x37"
4895                          "\x38\x39\x41\x42\x43\x44\x45\x46",
4896                .rlen   = 16,
4897        }, {
4898                .key    = "\xf8\xd4\x76\xff\xd6\x46\xee\x6c"
4899                          "\x23\x84\xcb\x1c\x77\xd6\x19\x5d"
4900                          "\xfe\xf1\xa9\xf3\x7b\xbc\x8d\x21"
4901                          "\xa7\x9c\x21\xf8\xcb\x90\x02\x89"
4902                          "\xa8\x45\x34\x8e\xc8\xc5\xb5\xf1"
4903                          "\x26\xf5\x0e\x76\xfe\xfd\x1b\x1e",
4904                .klen   = 48,
4905                .iv     = "\x00\x00\x00\x00\x00\x00\x00\x00"
4906                          "\x00\x00\x00\x00\x00\x00\x00\x01",
4907                .input  = "\x30\x38\xeb\xaf\x12\x43\x1a\x89"
4908                          "\x62\xa2\x36\xe5\xcf\x77\x1e\xd9"
4909                          "\x08\xc3\x0d\xdd\x95\xab\x19\x96"
4910                          "\x27\x52\x41\xc3\xca\xfb\xf6\xee"
4911                          "\x40\x2d\xdf\xdd\x00\x0c\xb9\x0a"
4912                          "\x3a\xf0\xc0\xd1\xda\x63\x9e\x45"
4913                          "\x42\xe9\x29\xc0\xb4\x07\xb4\x31"
4914                          "\x66\x77\x72\xb5\xb6\xb3\x57\x46"
4915                          "\x34\x9a\xfe\x03\xaf\x6b\x36\x07"
4916                          "\x63\x8e\xc2\x5d\xa6\x0f\xb6\x7d"
4917                          "\xfb\x6d\x82\x51\xb6\x98\xd0\x71"
4918                          "\xe7\x10\x7a\xdf\xb2\xbd\xf1\x1d"
4919                          "\x72\x2b\x54\x13\xe3\x6d\x79\x37"
4920                          "\xa9\x39\x2c\xdf\x21\xab\x87\xd5"
4921                          "\xee\xef\x9a\x12\x50\x39\x2e\x1b"
4922                          "\x7d\xe6\x6a\x27\x48\xb9\xe7\xac"
4923                          "\xaa\xcd\x79\x5f\xf2\xf3\xa0\x08"
4924                          "\x6f\x2c\xf4\x0e\xd1\xb8\x89\x25"
4925                          "\x31\x9d\xef\xb1\x1d\x27\x55\x04"
4926                          "\xc9\x8c\xb7\x68\xdc\xb6\x67\x8a"
4927                          "\xdb\xcf\x22\xf2\x3b\x6f\xce\xbb"
4928                          "\x26\xbe\x4f\x27\x04\x42\xd1\x44"
4929                          "\x4c\x08\xa3\x95\x4c\x7f\x1a\xaf"
4930                          "\x1d\x28\x14\xfd\xb1\x1a\x34\x18"
4931                          "\xf5\x1e\x28\x69\x95\x6a\x5a\xba"
4932                          "\x8e\xb2\x58\x1d\x28\x17\x13\x3d"
4933                          "\x38\x7d\x14\x8d\xab\x5d\xf9\xe8"
4934                          "\x3c\x0f\x2b\x0d\x2b\x08\xb4\x4b"
4935                          "\x6b\x0d\xc8\xa7\x84\xc2\x3a\x1a"
4936                          "\xb7\xbd\xda\x92\x29\xb8\x5b\x5a"
4937                          "\x63\xa5\x99\x82\x09\x72\x8f\xc6"
4938                          "\xa4\x62\x24\x69\x8c\x2d\x26\x00"
4939                          "\x99\x83\x91\xd6\xc6\xcf\x57\x67"
4940                          "\x38\xea\xf2\xfc\x29\xe0\x73\x39"
4941                          "\xf9\x13\x94\x6d\xe2\x58\x28\x75"
4942                          "\x3e\xae\x71\x90\x07\x70\x1c\x38"
4943                          "\x5b\x4c\x1e\xb5\xa5\x3b\x20\xef"
4944                          "\xb1\x4c\x3e\x1a\x72\x62\xbb\x22"
4945                          "\x82\x09\xe3\x18\x3f\x4f\x48\xfc"
4946                          "\xdd\xac\xfc\xb6\x09\xdb\xd2\x7b"
4947                          "\xd6\xb7\x7e\x41\x2f\x14\xf5\x0e"
4948                          "\xc3\xac\x4a\xed\xe7\x82\xef\x31"
4949                          "\x1f\x1a\x51\x1e\x29\x60\xc8\x98"
4950                          "\x93\x51\x1d\x3d\x62\x59\x83\x82"
4951                          "\x0c\xf1\xd7\x8d\xac\x33\x44\x81"
4952                          "\x3c\x59\xb7\xd4\x5b\x65\x82\xc4"
4953                          "\xec\xdc\x24\xfd\x0e\x1a\x79\x94"
4954                          "\x34\xb0\x62\xfa\x98\x49\x26\x1f"
4955                          "\xf4\x9e\x40\x44\x5b\x1f\xf8\xbe"
4956                          "\x36\xff\xc6\xc6\x9d\xf2\xd6\xcc"
4957                          "\x63\x93\x29\xb9\x0b\x6d\xd7\x6c"
4958                          "\xdb\xf6\x21\x80\xf7\x5a\x37\x15"
4959                          "\x0c\xe3\x36\xc8\x74\x75\x20\x91"
4960                          "\xdf\x52\x2d\x0c\xe7\x45\xff\x46"
4961                          "\xb3\xf4\xec\xc2\xbd\xd3\x37\xb6"
4962                          "\x26\xa2\x5d\x7d\x61\xbf\x10\x46"
4963                          "\x57\x8d\x05\x96\x70\x0b\xd6\x41"
4964                          "\x5c\xe9\xd3\x54\x81\x39\x3a\xdd"
4965                          "\x5f\x92\x81\x6e\x35\x03\xd4\x72"
4966                          "\x3d\x5a\xe7\xb9\x3b\x0c\x84\x23"
4967                          "\x45\x5d\xec\x72\xc1\x52\xef\x2e"
4968                          "\x81\x00\xd3\xfe\x4c\x3c\x05\x61"
4969                          "\x80\x18\xc4\x6c\x03\xd3\xb7\xba"
4970                          "\x11\xd7\xb8\x6e\xea\xe1\x80\x30",
4971                .ilen   = 512,
4972                .result = "\x05\x11\xb7\x18\xab\xc6\x2d\xac"
4973                          "\x70\x5d\xf6\x22\x94\xcd\xe5\x6c"
4974                          "\x17\x6b\xf6\x1c\xf0\xf3\x6e\xf8"
4975                          "\x50\x38\x1f\x71\x49\xb6\x57\xd6"
4976                          "\x8f\xcb\x8d\x6b\xe3\xa6\x29\x90"
4977                          "\xfe\x2a\x62\x82\xae\x6d\x8b\xf6"
4978                          "\xad\x1e\x9e\x20\x5f\x38\xbe\x04"
4979                          "\xda\x10\x8e\xed\xa2\xa4\x87\xab"
4980                          "\xda\x6b\xb4\x0c\x75\xba\xd3\x7c"
4981                          "\xc9\xac\x42\x31\x95\x7c\xc9\x04"
4982                          "\xeb\xd5\x6e\x32\x69\x8a\xdb\xa6"
4983                          "\x15\xd7\x3f\x4f\x2f\x66\x69\x03"
4984                          "\x9c\x1f\x54\x0f\xde\x1f\xf3\x65"
4985                          "\x4c\x96\x12\xed\x7c\x92\x03\x01"
4986                          "\x6f\xbc\x35\x93\xac\xf1\x27\xf1"
4987                          "\xb4\x96\x82\x5a\x5f\xb0\xa0\x50"
4988                          "\x89\xa4\x8e\x66\x44\x85\xcc\xfd"
4989                          "\x33\x14\x70\xe3\x96\xb2\xc3\xd3"
4990                          "\xbb\x54\x5a\x1a\xf9\x74\xa2\xc5"
4991                          "\x2d\x64\x75\xdd\xb4\x54\xe6\x74"
4992                          "\x8c\xd3\x9d\x9e\x86\xab\x51\x53"
4993                          "\xb7\x93\x3e\x6f\xd0\x4e\x2c\x40"
4994                          "\xf6\xa8\x2e\x3e\x9d\xf4\x66\xa5"
4995                          "\x76\x12\x73\x44\x1a\x56\xd7\x72"
4996                          "\x88\xcd\x21\x8c\x4c\x0f\xfe\xda"
4997                          "\x95\xe0\x3a\xa6\xa5\x84\x46\xcd"
4998                          "\xd5\x3e\x9d\x3a\xe2\x67\xe6\x60"
4999                          "\x1a\xe2\x70\x85\x58\xc2\x1b\x09"
5000                          "\xe1\xd7\x2c\xca\xad\xa8\x8f\xf9"
5001                          "\xac\xb3\x0e\xdb\xca\x2e\xe2\xb8"
5002                          "\x51\x71\xd9\x3c\x6c\xf1\x56\xf8"
5003                          "\xea\x9c\xf1\xfb\x0c\xe6\xb7\x10"
5004                          "\x1c\xf8\xa9\x7c\xe8\x53\x35\xc1"
5005                          "\x90\x3e\x76\x4a\x74\xa4\x21\x2c"
5006                          "\xf6\x2c\x4e\x0f\x94\x3a\x88\x2e"
5007                          "\x41\x09\x6a\x33\x7d\xf6\xdd\x3f"
5008                          "\x8d\x23\x31\x74\x84\xeb\x88\x6e"
5009                          "\xcc\xb9\xbc\x22\x83\x19\x07\x22"
5010                          "\xa5\x2d\xdf\xa5\xf3\x80\x85\x78"
5011                          "\x84\x39\x6a\x6d\x6a\x99\x4f\xa5"
5012                          "\x15\xfe\x46\xb0\xe4\x6c\xa5\x41"
5013                          "\x3c\xce\x8f\x42\x60\x71\xa7\x75"
5014                          "\x08\x40\x65\x8a\x82\xbf\xf5\x43"
5015                          "\x71\x96\xa9\x4d\x44\x8a\x20\xbe"
5016                          "\xfa\x4d\xbb\xc0\x7d\x31\x96\x65"
5017                          "\xe7\x75\xe5\x3e\xfd\x92\x3b\xc9"
5018                          "\x55\xbb\x16\x7e\xf7\xc2\x8c\xa4"
5019                          "\x40\x1d\xe5\xef\x0e\xdf\xe4\x9a"
5020                          "\x62\x73\x65\xfd\x46\x63\x25\x3d"
5021                          "\x2b\xaf\xe5\x64\xfe\xa5\x5c\xcf"
5022                          "\x24\xf3\xb4\xac\x64\xba\xdf\x4b"
5023                          "\xc6\x96\x7d\x81\x2d\x8d\x97\xf7"
5024                          "\xc5\x68\x77\x84\x32\x2b\xcc\x85"
5025                          "\x74\x96\xf0\x12\x77\x61\xb9\xeb"
5026                          "\x71\xaa\x82\xcb\x1c\xdb\x89\xc8"
5027                          "\xc6\xb5\xe3\x5c\x7d\x39\x07\x24"
5028                          "\xda\x39\x87\x45\xc0\x2b\xbb\x01"
5029                          "\xac\xbc\x2a\x5c\x7f\xfc\xe8\xce"
5030                          "\x6d\x9c\x6f\xed\xd3\xc1\xa1\xd6"
5031                          "\xc5\x55\xa9\x66\x2f\xe1\xc8\x32"
5032                          "\xa6\x5d\xa4\x3a\x98\x73\xe8\x45"
5033                          "\xa4\xc7\xa8\xb4\xf6\x13\x03\xf6"
5034                          "\xe9\x2e\xc4\x29\x0f\x84\xdb\xc4"
5035                          "\x21\xc4\xc2\x75\x67\x89\x37\x0a",
5036                .rlen   = 512,
5037                .also_non_np = 1,
5038                .np     = 2,
5039                .tap    = { 512 - 16, 16 },
5040        },
5041};
5042
5043static struct cipher_testvec tf_xts_enc_tv_template[] = {
5044        /* Generated from AES-XTS test vectors */
5045{
5046                .key    = "\x00\x00\x00\x00\x00\x00\x00\x00"
5047                          "\x00\x00\x00\x00\x00\x00\x00\x00"
5048                          "\x00\x00\x00\x00\x00\x00\x00\x00"
5049                          "\x00\x00\x00\x00\x00\x00\x00\x00",
5050                .klen   = 32,
5051                .iv     = "\x00\x00\x00\x00\x00\x00\x00\x00"
5052                          "\x00\x00\x00\x00\x00\x00\x00\x00",
5053                .input  = "\x00\x00\x00\x00\x00\x00\x00\x00"
5054                          "\x00\x00\x00\x00\x00\x00\x00\x00"
5055                          "\x00\x00\x00\x00\x00\x00\x00\x00"
5056                          "\x00\x00\x00\x00\x00\x00\x00\x00",
5057                .ilen   = 32,
5058                .result = "\x4b\xc9\x44\x4a\x11\xa3\xef\xac"
5059                          "\x30\x74\xe4\x44\x52\x77\x97\x43"
5060                          "\xa7\x60\xb2\x45\x2e\xf9\x00\x90"
5061                          "\x9f\xaa\xfd\x89\x6e\x9d\x4a\xe0",
5062                .rlen   = 32,
5063        }, {
5064                .key    = "\x11\x11\x11\x11\x11\x11\x11\x11"
5065                          "\x11\x11\x11\x11\x11\x11\x11\x11"
5066                          "\x22\x22\x22\x22\x22\x22\x22\x22"
5067                          "\x22\x22\x22\x22\x22\x22\x22\x22",
5068                .klen   = 32,
5069                .iv     = "\x33\x33\x33\x33\x33\x00\x00\x00"
5070                          "\x00\x00\x00\x00\x00\x00\x00\x00",
5071                .input  = "\x44\x44\x44\x44\x44\x44\x44\x44"
5072                          "\x44\x44\x44\x44\x44\x44\x44\x44"
5073                          "\x44\x44\x44\x44\x44\x44\x44\x44"
5074                          "\x44\x44\x44\x44\x44\x44\x44\x44",
5075                .ilen   = 32,
5076                .result = "\x57\x0e\x8f\xe5\x2a\x35\x61\x4f"
5077                          "\x32\xd3\xbd\x36\x05\x15\x44\x2c"
5078                          "\x58\x06\xf7\xf8\x00\xa8\xb6\xd5"
5079                          "\xc6\x28\x92\xdb\xd8\x34\xa2\xe9",
5080                .rlen   = 32,
5081        }, {
5082                .key    = "\xff\xfe\xfd\xfc\xfb\xfa\xf9\xf8"
5083                          "\xf7\xf6\xf5\xf4\xf3\xf2\xf1\xf0"
5084                          "\x22\x22\x22\x22\x22\x22\x22\x22"
5085                          "\x22\x22\x22\x22\x22\x22\x22\x22",
5086                .klen   = 32,
5087                .iv     = "\x33\x33\x33\x33\x33\x00\x00\x00"
5088                          "\x00\x00\x00\x00\x00\x00\x00\x00",
5089                .input  = "\x44\x44\x44\x44\x44\x44\x44\x44"
5090                          "\x44\x44\x44\x44\x44\x44\x44\x44"
5091                          "\x44\x44\x44\x44\x44\x44\x44\x44"
5092                          "\x44\x44\x44\x44\x44\x44\x44\x44",
5093                .ilen   = 32,
5094                .result = "\x96\x45\x8f\x8d\x7a\x75\xb1\xde"
5095                          "\x40\x0c\x89\x56\xf6\x4d\xa7\x07"
5096                          "\x38\xbb\x5b\xe9\xcd\x84\xae\xb2"
5097                          "\x7b\x6a\x62\xf4\x8c\xb5\x37\xea",
5098                .rlen   = 32,
5099        }, {
5100                .key    = "\x27\x18\x28\x18\x28\x45\x90\x45"
5101                          "\x23\x53\x60\x28\x74\x71\x35\x26"
5102                          "\x31\x41\x59\x26\x53\x58\x97\x93"
5103                          "\x23\x84\x62\x64\x33\x83\x27\x95",
5104                .klen   = 32,
5105                .iv     = "\x00\x00\x00\x00\x00\x00\x00\x00"
5106                          "\x00\x00\x00\x00\x00\x00\x00\x00",
5107                .input  = "\x00\x01\x02\x03\x04\x05\x06\x07"
5108                          "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f"
5109                          "\x10\x11\x12\x13\x14\x15\x16\x17"
5110                          "\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f"
5111                          "\x20\x21\x22\x23\x24\x25\x26\x27"
5112                          "\x28\x29\x2a\x2b\x2c\x2d\x2e\x2f"
5113                          "\x30\x31\x32\x33\x34\x35\x36\x37"
5114                          "\x38\x39\x3a\x3b\x3c\x3d\x3e\x3f"
5115                          "\x40\x41\x42\x43\x44\x45\x46\x47"
5116                          "\x48\x49\x4a\x4b\x4c\x4d\x4e\x4f"
5117                          "\x50\x51\x52\x53\x54\x55\x56\x57"
5118                          "\x58\x59\x5a\x5b\x5c\x5d\x5e\x5f"
5119                          "\x60\x61\x62\x63\x64\x65\x66\x67"
5120                          "\x68\x69\x6a\x6b\x6c\x6d\x6e\x6f"
5121                          "\x70\x71\x72\x73\x74\x75\x76\x77"
5122                          "\x78\x79\x7a\x7b\x7c\x7d\x7e\x7f"
5123                          "\x80\x81\x82\x83\x84\x85\x86\x87"
5124                          "\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f"
5125                          "\x90\x91\x92\x93\x94\x95\x96\x97"
5126                          "\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f"
5127                          "\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7"
5128                          "\xa8\xa9\xaa\xab\xac\xad\xae\xaf"
5129                          "\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7"
5130                          "\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf"
5131                          "\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7"
5132                          "\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf"
5133                          "\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7"
5134                          "\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf"
5135                          "\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7"
5136                          "\xe8\xe9\xea\xeb\xec\xed\xee\xef"
5137                          "\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7"
5138                          "\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff"
5139                          "\x00\x01\x02\x03\x04\x05\x06\x07"
5140                          "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f"
5141                          "\x10\x11\x12\x13\x14\x15\x16\x17"
5142                          "\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f"
5143                          "\x20\x21\x22\x23\x24\x25\x26\x27"
5144                          "\x28\x29\x2a\x2b\x2c\x2d\x2e\x2f"
5145                          "\x30\x31\x32\x33\x34\x35\x36\x37"
5146                          "\x38\x39\x3a\x3b\x3c\x3d\x3e\x3f"
5147                          "\x40\x41\x42\x43\x44\x45\x46\x47"
5148                          "\x48\x49\x4a\x4b\x4c\x4d\x4e\x4f"
5149                          "\x50\x51\x52\x53\x54\x55\x56\x57"
5150                          "\x58\x59\x5a\x5b\x5c\x5d\x5e\x5f"
5151                          "\x60\x61\x62\x63\x64\x65\x66\x67"
5152                          "\x68\x69\x6a\x6b\x6c\x6d\x6e\x6f"
5153                          "\x70\x71\x72\x73\x74\x75\x76\x77"
5154                          "\x78\x79\x7a\x7b\x7c\x7d\x7e\x7f"
5155                          "\x80\x81\x82\x83\x84\x85\x86\x87"
5156                          "\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f"
5157                          "\x90\x91\x92\x93\x94\x95\x96\x97"
5158                          "\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f"
5159                          "\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7"
5160                          "\xa8\xa9\xaa\xab\xac\xad\xae\xaf"
5161                          "\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7"
5162                          "\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf"
5163                          "\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7"
5164                          "\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf"
5165                          "\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7"
5166                          "\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf"
5167                          "\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7"
5168                          "\xe8\xe9\xea\xeb\xec\xed\xee\xef"
5169                          "\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7"
5170                          "\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff",
5171                .ilen   = 512,
5172                .result = "\xa9\x78\xae\x1e\xea\xa2\x44\x4c"
5173                          "\xa2\x7a\x64\x1f\xaf\x46\xc1\xe0"
5174                          "\x6c\xb2\xf3\x92\x9a\xd6\x7d\x58"
5175                          "\xb8\x2d\xb9\x5d\x58\x07\x66\x50"
5176                          "\xea\x35\x35\x8c\xb2\x46\x61\x06"
5177                          "\x5d\x65\xfc\x57\x8f\x69\x74\xab"
5178                          "\x8a\x06\x69\xb5\x6c\xda\x66\xc7"
5179                          "\x52\x90\xbb\x8e\x6d\x8b\xb5\xa2"
5180                          "\x78\x1d\xc2\xa9\xc2\x73\x00\xc3"
5181                          "\x32\x36\x7c\x97\x6b\x4e\x8a\x50"
5182                          "\xe4\x91\x83\x96\x8f\xf4\x94\x1a"
5183                          "\xa6\x27\xe1\x33\xcb\x91\xc6\x5f"
5184                          "\x94\x75\xbc\xd7\x3e\x3e\x6f\x9e"
5185                          "\xa9\x31\x80\x5e\xe5\xdb\xc8\x53"
5186                          "\x01\x73\x68\x32\x25\x19\xfa\xfb"
5187                          "\xe4\xcf\xb9\x3e\xa2\xa0\x8f\x31"
5188                          "\xbf\x54\x06\x93\xa8\xb1\x0f\xb6"
5189                          "\x7c\x3c\xde\x6f\x0f\xfb\x0c\x11"
5190                          "\x39\x80\x39\x09\x97\x65\xf2\x83"
5191                          "\xae\xe6\xa1\x6f\x47\xb8\x49\xde"
5192                          "\x99\x36\x20\x7d\x97\x3b\xec\xfa"
5193                          "\xb4\x33\x6e\x7a\xc7\x46\x84\x49"
5194                          "\x91\xcd\xe1\x57\x0d\xed\x40\x08"
5195                          "\x13\xf1\x4e\x3e\xa4\xa4\x5c\xe6"
5196                          "\xd2\x0c\x20\x8f\x3e\xdf\x3f\x47"
5197                          "\x9a\x2f\xde\x6d\x66\xc9\x99\x4a"
5198                          "\x2d\x9e\x9d\x4b\x1a\x27\xa2\x12"
5199                          "\x99\xf0\xf8\xb1\xb6\xf6\x57\xc3"
5200                          "\xca\x1c\xa3\x8e\xed\x39\x28\xb5"
5201                          "\x10\x1b\x4b\x08\x42\x00\x4a\xd3"
5202                          "\xad\x5a\xc6\x8e\xc8\xbb\x95\xc4"
5203                          "\x4b\xaa\xfe\xd5\x42\xa8\xa3\x6d"
5204                          "\x3c\xf3\x34\x91\x2d\xb4\xdd\x20"
5205                          "\x0c\x90\x6d\xa3\x9b\x66\x9d\x24"
5206                          "\x02\xa6\xa9\x3f\x3f\x58\x5d\x47"
5207                          "\x24\x65\x63\x7e\xbd\x8c\xe6\x52"
5208                          "\x7d\xef\x33\x53\x63\xec\xaa\x0b"
5209                          "\x64\x15\xa9\xa6\x1f\x10\x00\x38"
5210                          "\x35\xa8\xe7\xbe\x23\x70\x22\xe0"
5211                          "\xd3\xb9\xe6\xfd\xe6\xaa\x03\x50"
5212                          "\xf3\x3c\x27\x36\x8b\xcc\xfe\x9c"
5213                          "\x9c\xa3\xb3\xe7\x68\x9b\xa2\x71"
5214                          "\xe0\x07\xd9\x1f\x68\x1f\xac\x5e"
5215                          "\x7a\x74\x85\xa9\x6a\x90\xab\x2c"
5216                          "\x38\x51\xbc\x1f\x43\x4a\x56\x1c"
5217                          "\xf8\x47\x03\x4e\x67\xa8\x1f\x99"
5218                          "\x04\x39\x73\x32\xb2\x86\x79\xe7"
5219                          "\x14\x28\x70\xb8\xe2\x7d\x69\x85"
5220                          "\xb6\x0f\xc5\xd0\xd0\x01\x5c\xe6"
5221                          "\x09\x0f\x75\xf7\xb6\x81\xd2\x11"
5222                          "\x20\x9c\xa1\xee\x11\x44\x79\xd0"
5223                          "\xb2\x34\x77\xda\x10\x9a\x6f\x6f"
5224                          "\xef\x7c\xd9\xdc\x35\xb7\x61\xdd"
5225                          "\xf1\xa4\xc6\x1c\xbf\x05\x22\xac"
5226                          "\xfe\x2f\x85\x00\x44\xdf\x33\x16"
5227                          "\x35\xb6\xa3\xd3\x70\xdf\x69\x35"
5228                          "\x6a\xc7\xb4\x99\x45\x27\xc8\x8e"
5229                          "\x5a\x14\x30\xd0\x55\x3e\x4f\x64"
5230                          "\x0d\x38\xe3\xdf\x8b\xa8\x93\x26"
5231                          "\x75\xae\xf6\xb5\x23\x0b\x17\x31"
5232                          "\xbf\x27\xb8\xb5\x94\x31\xa7\x8f"
5233                          "\x43\xc4\x46\x24\x22\x4f\x8f\x7e"
5234                          "\xe5\xf4\x6d\x1e\x0e\x18\x7a\xbb"
5235                          "\xa6\x8f\xfb\x49\x49\xd8\x7e\x5a",
5236                .rlen   = 512,
5237        }, {
5238                .key    = "\x27\x18\x28\x18\x28\x45\x90\x45"
5239                          "\x23\x53\x60\x28\x74\x71\x35\x26"
5240                          "\x62\x49\x77\x57\x24\x70\x93\x69"
5241                          "\x99\x59\x57\x49\x66\x96\x76\x27"
5242                          "\x31\x41\x59\x26\x53\x58\x97\x93"
5243                          "\x23\x84\x62\x64\x33\x83\x27\x95"
5244                          "\x02\x88\x41\x97\x16\x93\x99\x37"
5245                          "\x51\x05\x82\x09\x74\x94\x45\x92",
5246                .klen   = 64,
5247                .iv     = "\xff\x00\x00\x00\x00\x00\x00\x00"
5248                          "\x00\x00\x00\x00\x00\x00\x00\x00",
5249                .input  = "\x00\x01\x02\x03\x04\x05\x06\x07"
5250                          "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f"
5251                          "\x10\x11\x12\x13\x14\x15\x16\x17"
5252                          "\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f"
5253                          "\x20\x21\x22\x23\x24\x25\x26\x27"
5254                          "\x28\x29\x2a\x2b\x2c\x2d\x2e\x2f"
5255                          "\x30\x31\x32\x33\x34\x35\x36\x37"
5256                          "\x38\x39\x3a\x3b\x3c\x3d\x3e\x3f"
5257                          "\x40\x41\x42\x43\x44\x45\x46\x47"
5258                          "\x48\x49\x4a\x4b\x4c\x4d\x4e\x4f"
5259                          "\x50\x51\x52\x53\x54\x55\x56\x57"
5260                          "\x58\x59\x5a\x5b\x5c\x5d\x5e\x5f"
5261                          "\x60\x61\x62\x63\x64\x65\x66\x67"
5262                          "\x68\x69\x6a\x6b\x6c\x6d\x6e\x6f"
5263                          "\x70\x71\x72\x73\x74\x75\x76\x77"
5264                          "\x78\x79\x7a\x7b\x7c\x7d\x7e\x7f"
5265                          "\x80\x81\x82\x83\x84\x85\x86\x87"
5266                          "\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f"
5267                          "\x90\x91\x92\x93\x94\x95\x96\x97"
5268                          "\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f"
5269                          "\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7"
5270                          "\xa8\xa9\xaa\xab\xac\xad\xae\xaf"
5271                          "\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7"
5272                          "\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf"
5273                          "\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7"
5274                          "\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf"
5275                          "\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7"
5276                          "\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf"
5277                          "\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7"
5278                          "\xe8\xe9\xea\xeb\xec\xed\xee\xef"
5279                          "\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7"
5280                          "\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff"
5281                          "\x00\x01\x02\x03\x04\x05\x06\x07"
5282                          "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f"
5283                          "\x10\x11\x12\x13\x14\x15\x16\x17"
5284                          "\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f"
5285                          "\x20\x21\x22\x23\x24\x25\x26\x27"
5286                          "\x28\x29\x2a\x2b\x2c\x2d\x2e\x2f"
5287                          "\x30\x31\x32\x33\x34\x35\x36\x37"
5288                          "\x38\x39\x3a\x3b\x3c\x3d\x3e\x3f"
5289                          "\x40\x41\x42\x43\x44\x45\x46\x47"
5290                          "\x48\x49\x4a\x4b\x4c\x4d\x4e\x4f"
5291                          "\x50\x51\x52\x53\x54\x55\x56\x57"
5292                          "\x58\x59\x5a\x5b\x5c\x5d\x5e\x5f"
5293                          "\x60\x61\x62\x63\x64\x65\x66\x67"
5294                          "\x68\x69\x6a\x6b\x6c\x6d\x6e\x6f"
5295                          "\x70\x71\x72\x73\x74\x75\x76\x77"
5296                          "\x78\x79\x7a\x7b\x7c\x7d\x7e\x7f"
5297                          "\x80\x81\x82\x83\x84\x85\x86\x87"
5298                          "\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f"
5299                          "\x90\x91\x92\x93\x94\x95\x96\x97"
5300                          "\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f"
5301                          "\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7"
5302                          "\xa8\xa9\xaa\xab\xac\xad\xae\xaf"
5303                          "\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7"
5304                          "\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf"
5305                          "\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7"
5306                          "\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf"
5307                          "\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7"
5308                          "\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf"
5309                          "\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7"
5310                          "\xe8\xe9\xea\xeb\xec\xed\xee\xef"
5311                          "\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7"
5312                          "\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff",
5313                .ilen   = 512,
5314                .result = "\xd7\x4b\x93\x7d\x13\xa2\xa2\xe1"
5315                          "\x35\x39\x71\x88\x76\x1e\xc9\xea"
5316                          "\x86\xad\xf3\x14\x48\x3d\x5e\xe9"
5317                          "\xe9\x2d\xb2\x56\x59\x35\x9d\xec"
5318                          "\x84\xfa\x7e\x9d\x6d\x33\x36\x8f"
5319                          "\xce\xf4\xa9\x21\x0b\x5f\x96\xec"
5320                          "\xcb\xf9\x57\x68\x33\x88\x39\xbf"
5321                          "\x2f\xbb\x59\x03\xbd\x66\x8b\x11"
5322                          "\x11\x65\x51\x2e\xb8\x67\x05\xd1"
5323                          "\x27\x11\x5c\xd4\xcc\x97\xc2\xb3"
5324                          "\xa9\x55\xaf\x07\x56\xd1\xdc\xf5"
5325                          "\x85\xdc\x46\xe6\xf0\x24\xeb\x93"
5326                          "\x4d\xf0\x9b\xf5\x73\x1c\xda\x03"
5327                          "\x22\xc8\x3a\x4f\xb4\x19\x91\x09"
5328                          "\x54\x0b\xf6\xfe\x17\x3d\x1a\x53"
5329                          "\x72\x60\x79\xcb\x0e\x32\x8a\x77"
5330                          "\xd5\xed\xdb\x33\xd7\x62\x16\x69"
5331                          "\x63\xe0\xab\xb5\xf6\x9c\x5f\x3d"
5332                          "\x69\x35\x61\x86\xf8\x86\xb9\x89"
5333                          "\x6e\x59\x35\xac\xf6\x6b\x33\xa0"
5334                          "\xea\xef\x96\x62\xd8\xa9\xcf\x56"
5335                          "\xbf\xdb\x8a\xfd\xa1\x82\x77\x73"
5336                          "\x3d\x94\x4a\x49\x42\x6d\x08\x60"
5337                          "\xa1\xea\xab\xb6\x88\x13\x94\xb8"
5338                          "\x51\x98\xdb\x35\x85\xdf\xf6\xb9"
5339                          "\x8f\xcd\xdf\x80\xd3\x40\x2d\x72"
5340                          "\xb8\xb2\x6c\x02\x43\x35\x22\x2a"
5341                          "\x31\xed\xcd\x16\x19\xdf\x62\x0f"
5342                          "\x29\xcf\x87\x04\xec\x02\x4f\xe4"
5343                          "\xa2\xed\x73\xc6\x69\xd3\x7e\x89"
5344                          "\x0b\x76\x10\x7c\xd6\xf9\x6a\x25"
5345                          "\xed\xcc\x60\x5d\x61\x20\xc1\x97"
5346                          "\x56\x91\x57\x28\xbe\x71\x0d\xcd"
5347                          "\xde\xc4\x9e\x55\x91\xbe\xd1\x28"
5348                          "\x9b\x90\xeb\x73\xf3\x68\x51\xc6"
5349                          "\xdf\x82\xcc\xd8\x1f\xce\x5b\x27"
5350                          "\xc0\x60\x5e\x33\xd6\xa7\x20\xea"
5351                          "\xb2\x54\xc7\x5d\x6a\x3b\x67\x47"
5352                          "\xcf\xa0\xe3\xab\x86\xaf\xc1\x42"
5353                          "\xe6\xb0\x23\x4a\xaf\x53\xdf\xa0"
5354                          "\xad\x12\x32\x31\x03\xf7\x21\xbe"
5355                          "\x2d\xd5\x82\x42\xb6\x4a\x3d\xcd"
5356                          "\xd8\x81\x77\xa9\x49\x98\x6c\x09"
5357                          "\xc5\xa3\x61\x12\x62\x85\x6b\xcd"
5358                          "\xb3\xf4\x20\x0c\x41\xc4\x05\x37"
5359                          "\x46\x5f\xeb\x71\x8b\xf1\xaf\x6e"
5360                          "\xba\xf3\x50\x2e\xfe\xa8\x37\xeb"
5361                          "\xe8\x8c\x4f\xa4\x0c\xf1\x31\xc8"
5362                          "\x6e\x71\x4f\xa5\xd7\x97\x73\xe0"
5363                          "\x93\x4a\x2f\xda\x7b\xe0\x20\x54"
5364                          "\x1f\x8d\x85\x79\x0b\x7b\x5e\x75"
5365                          "\xb9\x07\x67\xcc\xc8\xe7\x21\x15"
5366                          "\xa7\xc8\x98\xff\x4b\x80\x1c\x12"
5367                          "\xa8\x54\xe1\x38\x52\xe6\x74\x81"
5368                          "\x97\x47\xa1\x41\x0e\xc0\x50\xe3"
5369                          "\x55\x0e\xc3\xa7\x70\x77\xce\x07"
5370                          "\xed\x8c\x88\xe6\xa1\x5b\x14\xec"
5371                          "\xe6\xde\x06\x6d\x74\xc5\xd9\xfa"
5372                          "\xe5\x2f\x5a\xff\xc8\x05\xee\x27"
5373                          "\x35\x61\xbf\x0b\x19\x78\x9b\xd2"
5374                          "\x04\xc7\x05\xb1\x79\xb4\xff\x5f"
5375                          "\xf3\xea\x67\x52\x78\xc2\xce\x70"
5376                          "\xa4\x05\x0b\xb2\xb3\xa8\x30\x97"
5377                          "\x37\x30\xe1\x91\x8d\xb3\x2a\xff",
5378                .rlen   = 512,
5379                .also_non_np = 1,
5380                .np     = 2,
5381                .tap    = { 512 - 16, 16 },
5382        },
5383};
5384
5385static struct cipher_testvec tf_xts_dec_tv_template[] = {
5386        /* Generated from AES-XTS test vectors */
5387        /* same as enc vectors with input and result reversed */
5388        {
5389                .key    = "\x00\x00\x00\x00\x00\x00\x00\x00"
5390                          "\x00\x00\x00\x00\x00\x00\x00\x00"
5391                          "\x00\x00\x00\x00\x00\x00\x00\x00"
5392                          "\x00\x00\x00\x00\x00\x00\x00\x00",
5393                .klen   = 32,
5394                .iv     = "\x00\x00\x00\x00\x00\x00\x00\x00"
5395                          "\x00\x00\x00\x00\x00\x00\x00\x00",
5396                .input  = "\x4b\xc9\x44\x4a\x11\xa3\xef\xac"
5397                          "\x30\x74\xe4\x44\x52\x77\x97\x43"
5398                          "\xa7\x60\xb2\x45\x2e\xf9\x00\x90"
5399                          "\x9f\xaa\xfd\x89\x6e\x9d\x4a\xe0",
5400                .ilen   = 32,
5401                .result = "\x00\x00\x00\x00\x00\x00\x00\x00"
5402                          "\x00\x00\x00\x00\x00\x00\x00\x00"
5403                          "\x00\x00\x00\x00\x00\x00\x00\x00"
5404                          "\x00\x00\x00\x00\x00\x00\x00\x00",
5405                .rlen   = 32,
5406        }, {
5407                .key    = "\x11\x11\x11\x11\x11\x11\x11\x11"
5408                          "\x11\x11\x11\x11\x11\x11\x11\x11"
5409                          "\x22\x22\x22\x22\x22\x22\x22\x22"
5410                          "\x22\x22\x22\x22\x22\x22\x22\x22",
5411                .klen   = 32,
5412                .iv     = "\x33\x33\x33\x33\x33\x00\x00\x00"
5413                          "\x00\x00\x00\x00\x00\x00\x00\x00",
5414                .input  = "\x57\x0e\x8f\xe5\x2a\x35\x61\x4f"
5415                          "\x32\xd3\xbd\x36\x05\x15\x44\x2c"
5416                          "\x58\x06\xf7\xf8\x00\xa8\xb6\xd5"
5417                          "\xc6\x28\x92\xdb\xd8\x34\xa2\xe9",
5418                .ilen   = 32,
5419                .result = "\x44\x44\x44\x44\x44\x44\x44\x44"
5420                          "\x44\x44\x44\x44\x44\x44\x44\x44"
5421                          "\x44\x44\x44\x44\x44\x44\x44\x44"
5422                          "\x44\x44\x44\x44\x44\x44\x44\x44",
5423                .rlen   = 32,
5424        }, {
5425                .key    = "\xff\xfe\xfd\xfc\xfb\xfa\xf9\xf8"
5426                          "\xf7\xf6\xf5\xf4\xf3\xf2\xf1\xf0"
5427                          "\x22\x22\x22\x22\x22\x22\x22\x22"
5428                          "\x22\x22\x22\x22\x22\x22\x22\x22",
5429                .klen   = 32,
5430                .iv     = "\x33\x33\x33\x33\x33\x00\x00\x00"
5431                          "\x00\x00\x00\x00\x00\x00\x00\x00",
5432                .input  = "\x96\x45\x8f\x8d\x7a\x75\xb1\xde"
5433                          "\x40\x0c\x89\x56\xf6\x4d\xa7\x07"
5434                          "\x38\xbb\x5b\xe9\xcd\x84\xae\xb2"
5435                          "\x7b\x6a\x62\xf4\x8c\xb5\x37\xea",
5436                .ilen   = 32,
5437                .result = "\x44\x44\x44\x44\x44\x44\x44\x44"
5438                          "\x44\x44\x44\x44\x44\x44\x44\x44"
5439                          "\x44\x44\x44\x44\x44\x44\x44\x44"
5440                          "\x44\x44\x44\x44\x44\x44\x44\x44",
5441                .rlen   = 32,
5442        }, {
5443                .key    = "\x27\x18\x28\x18\x28\x45\x90\x45"
5444                          "\x23\x53\x60\x28\x74\x71\x35\x26"
5445                          "\x31\x41\x59\x26\x53\x58\x97\x93"
5446                          "\x23\x84\x62\x64\x33\x83\x27\x95",
5447                .klen   = 32,
5448                .iv     = "\x00\x00\x00\x00\x00\x00\x00\x00"
5449                          "\x00\x00\x00\x00\x00\x00\x00\x00",
5450                .input  = "\xa9\x78\xae\x1e\xea\xa2\x44\x4c"
5451                          "\xa2\x7a\x64\x1f\xaf\x46\xc1\xe0"
5452                          "\x6c\xb2\xf3\x92\x9a\xd6\x7d\x58"
5453                          "\xb8\x2d\xb9\x5d\x58\x07\x66\x50"
5454                          "\xea\x35\x35\x8c\xb2\x46\x61\x06"
5455                          "\x5d\x65\xfc\x57\x8f\x69\x74\xab"
5456                          "\x8a\x06\x69\xb5\x6c\xda\x66\xc7"
5457                          "\x52\x90\xbb\x8e\x6d\x8b\xb5\xa2"
5458                          "\x78\x1d\xc2\xa9\xc2\x73\x00\xc3"
5459                          "\x32\x36\x7c\x97\x6b\x4e\x8a\x50"
5460                          "\xe4\x91\x83\x96\x8f\xf4\x94\x1a"
5461                          "\xa6\x27\xe1\x33\xcb\x91\xc6\x5f"
5462                          "\x94\x75\xbc\xd7\x3e\x3e\x6f\x9e"
5463                          "\xa9\x31\x80\x5e\xe5\xdb\xc8\x53"
5464                          "\x01\x73\x68\x32\x25\x19\xfa\xfb"
5465                          "\xe4\xcf\xb9\x3e\xa2\xa0\x8f\x31"
5466                          "\xbf\x54\x06\x93\xa8\xb1\x0f\xb6"
5467                          "\x7c\x3c\xde\x6f\x0f\xfb\x0c\x11"
5468                          "\x39\x80\x39\x09\x97\x65\xf2\x83"
5469                          "\xae\xe6\xa1\x6f\x47\xb8\x49\xde"
5470                          "\x99\x36\x20\x7d\x97\x3b\xec\xfa"
5471                          "\xb4\x33\x6e\x7a\xc7\x46\x84\x49"
5472                          "\x91\xcd\xe1\x57\x0d\xed\x40\x08"
5473                          "\x13\xf1\x4e\x3e\xa4\xa4\x5c\xe6"
5474                          "\xd2\x0c\x20\x8f\x3e\xdf\x3f\x47"
5475                          "\x9a\x2f\xde\x6d\x66\xc9\x99\x4a"
5476                          "\x2d\x9e\x9d\x4b\x1a\x27\xa2\x12"
5477                          "\x99\xf0\xf8\xb1\xb6\xf6\x57\xc3"
5478                          "\xca\x1c\xa3\x8e\xed\x39\x28\xb5"
5479                          "\x10\x1b\x4b\x08\x42\x00\x4a\xd3"
5480                          "\xad\x5a\xc6\x8e\xc8\xbb\x95\xc4"
5481                          "\x4b\xaa\xfe\xd5\x42\xa8\xa3\x6d"
5482                          "\x3c\xf3\x34\x91\x2d\xb4\xdd\x20"
5483                          "\x0c\x90\x6d\xa3\x9b\x66\x9d\x24"
5484                          "\x02\xa6\xa9\x3f\x3f\x58\x5d\x47"
5485                          "\x24\x65\x63\x7e\xbd\x8c\xe6\x52"
5486                          "\x7d\xef\x33\x53\x63\xec\xaa\x0b"
5487                          "\x64\x15\xa9\xa6\x1f\x10\x00\x38"
5488                          "\x35\xa8\xe7\xbe\x23\x70\x22\xe0"
5489                          "\xd3\xb9\xe6\xfd\xe6\xaa\x03\x50"
5490                          "\xf3\x3c\x27\x36\x8b\xcc\xfe\x9c"
5491                          "\x9c\xa3\xb3\xe7\x68\x9b\xa2\x71"
5492                          "\xe0\x07\xd9\x1f\x68\x1f\xac\x5e"
5493                          "\x7a\x74\x85\xa9\x6a\x90\xab\x2c"
5494                          "\x38\x51\xbc\x1f\x43\x4a\x56\x1c"
5495                          "\xf8\x47\x03\x4e\x67\xa8\x1f\x99"
5496                          "\x04\x39\x73\x32\xb2\x86\x79\xe7"
5497                          "\x14\x28\x70\xb8\xe2\x7d\x69\x85"
5498                          "\xb6\x0f\xc5\xd0\xd0\x01\x5c\xe6"
5499                          "\x09\x0f\x75\xf7\xb6\x81\xd2\x11"
5500                          "\x20\x9c\xa1\xee\x11\x44\x79\xd0"
5501                          "\xb2\x34\x77\xda\x10\x9a\x6f\x6f"
5502                          "\xef\x7c\xd9\xdc\x35\xb7\x61\xdd"
5503                          "\xf1\xa4\xc6\x1c\xbf\x05\x22\xac"
5504                          "\xfe\x2f\x85\x00\x44\xdf\x33\x16"
5505                          "\x35\xb6\xa3\xd3\x70\xdf\x69\x35"
5506                          "\x6a\xc7\xb4\x99\x45\x27\xc8\x8e"
5507                          "\x5a\x14\x30\xd0\x55\x3e\x4f\x64"
5508                          "\x0d\x38\xe3\xdf\x8b\xa8\x93\x26"
5509                          "\x75\xae\xf6\xb5\x23\x0b\x17\x31"
5510                          "\xbf\x27\xb8\xb5\x94\x31\xa7\x8f"
5511                          "\x43\xc4\x46\x24\x22\x4f\x8f\x7e"
5512                          "\xe5\xf4\x6d\x1e\x0e\x18\x7a\xbb"
5513                          "\xa6\x8f\xfb\x49\x49\xd8\x7e\x5a",
5514                .ilen   = 512,
5515                .result = "\x00\x01\x02\x03\x04\x05\x06\x07"
5516                          "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f"
5517                          "\x10\x11\x12\x13\x14\x15\x16\x17"
5518                          "\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f"
5519                          "\x20\x21\x22\x23\x24\x25\x26\x27"
5520                          "\x28\x29\x2a\x2b\x2c\x2d\x2e\x2f"
5521                          "\x30\x31\x32\x33\x34\x35\x36\x37"
5522                          "\x38\x39\x3a\x3b\x3c\x3d\x3e\x3f"
5523                          "\x40\x41\x42\x43\x44\x45\x46\x47"
5524                          "\x48\x49\x4a\x4b\x4c\x4d\x4e\x4f"
5525                          "\x50\x51\x52\x53\x54\x55\x56\x57"
5526                          "\x58\x59\x5a\x5b\x5c\x5d\x5e\x5f"
5527                          "\x60\x61\x62\x63\x64\x65\x66\x67"
5528                          "\x68\x69\x6a\x6b\x6c\x6d\x6e\x6f"
5529                          "\x70\x71\x72\x73\x74\x75\x76\x77"
5530                          "\x78\x79\x7a\x7b\x7c\x7d\x7e\x7f"
5531                          "\x80\x81\x82\x83\x84\x85\x86\x87"
5532                          "\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f"
5533                          "\x90\x91\x92\x93\x94\x95\x96\x97"
5534                          "\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f"
5535                          "\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7"
5536                          "\xa8\xa9\xaa\xab\xac\xad\xae\xaf"
5537                          "\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7"
5538                          "\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf"
5539                          "\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7"
5540                          "\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf"
5541                          "\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7"
5542                          "\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf"
5543                          "\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7"
5544                          "\xe8\xe9\xea\xeb\xec\xed\xee\xef"
5545                          "\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7"
5546                          "\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff"
5547                          "\x00\x01\x02\x03\x04\x05\x06\x07"
5548                          "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f"
5549                          "\x10\x11\x12\x13\x14\x15\x16\x17"
5550                          "\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f"
5551                          "\x20\x21\x22\x23\x24\x25\x26\x27"
5552                          "\x28\x29\x2a\x2b\x2c\x2d\x2e\x2f"
5553                          "\x30\x31\x32\x33\x34\x35\x36\x37"
5554                          "\x38\x39\x3a\x3b\x3c\x3d\x3e\x3f"
5555                          "\x40\x41\x42\x43\x44\x45\x46\x47"
5556                          "\x48\x49\x4a\x4b\x4c\x4d\x4e\x4f"
5557                          "\x50\x51\x52\x53\x54\x55\x56\x57"
5558                          "\x58\x59\x5a\x5b\x5c\x5d\x5e\x5f"
5559                          "\x60\x61\x62\x63\x64\x65\x66\x67"
5560                          "\x68\x69\x6a\x6b\x6c\x6d\x6e\x6f"
5561                          "\x70\x71\x72\x73\x74\x75\x76\x77"
5562                          "\x78\x79\x7a\x7b\x7c\x7d\x7e\x7f"
5563                          "\x80\x81\x82\x83\x84\x85\x86\x87"
5564                          "\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f"
5565                          "\x90\x91\x92\x93\x94\x95\x96\x97"
5566                          "\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f"
5567                          "\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7"
5568                          "\xa8\xa9\xaa\xab\xac\xad\xae\xaf"
5569                          "\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7"
5570                          "\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf"
5571                          "\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7"
5572                          "\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf"
5573                          "\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7"
5574                          "\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf"
5575                          "\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7"
5576                          "\xe8\xe9\xea\xeb\xec\xed\xee\xef"
5577                          "\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7"
5578                          "\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff",
5579                .rlen   = 512,
5580        }, {
5581                .key    = "\x27\x18\x28\x18\x28\x45\x90\x45"
5582                          "\x23\x53\x60\x28\x74\x71\x35\x26"
5583                          "\x62\x49\x77\x57\x24\x70\x93\x69"
5584                          "\x99\x59\x57\x49\x66\x96\x76\x27"
5585                          "\x31\x41\x59\x26\x53\x58\x97\x93"
5586                          "\x23\x84\x62\x64\x33\x83\x27\x95"
5587                          "\x02\x88\x41\x97\x16\x93\x99\x37"
5588                          "\x51\x05\x82\x09\x74\x94\x45\x92",
5589                .klen   = 64,
5590                .iv     = "\xff\x00\x00\x00\x00\x00\x00\x00"
5591                          "\x00\x00\x00\x00\x00\x00\x00\x00",
5592                .input  = "\xd7\x4b\x93\x7d\x13\xa2\xa2\xe1"
5593                          "\x35\x39\x71\x88\x76\x1e\xc9\xea"
5594                          "\x86\xad\xf3\x14\x48\x3d\x5e\xe9"
5595                          "\xe9\x2d\xb2\x56\x59\x35\x9d\xec"
5596                          "\x84\xfa\x7e\x9d\x6d\x33\x36\x8f"
5597                          "\xce\xf4\xa9\x21\x0b\x5f\x96\xec"
5598                          "\xcb\xf9\x57\x68\x33\x88\x39\xbf"
5599                          "\x2f\xbb\x59\x03\xbd\x66\x8b\x11"
5600                          "\x11\x65\x51\x2e\xb8\x67\x05\xd1"
5601                          "\x27\x11\x5c\xd4\xcc\x97\xc2\xb3"
5602                          "\xa9\x55\xaf\x07\x56\xd1\xdc\xf5"
5603                          "\x85\xdc\x46\xe6\xf0\x24\xeb\x93"
5604                          "\x4d\xf0\x9b\xf5\x73\x1c\xda\x03"
5605                          "\x22\xc8\x3a\x4f\xb4\x19\x91\x09"
5606                          "\x54\x0b\xf6\xfe\x17\x3d\x1a\x53"
5607                          "\x72\x60\x79\xcb\x0e\x32\x8a\x77"
5608                          "\xd5\xed\xdb\x33\xd7\x62\x16\x69"
5609                          "\x63\xe0\xab\xb5\xf6\x9c\x5f\x3d"
5610                          "\x69\x35\x61\x86\xf8\x86\xb9\x89"
5611                          "\x6e\x59\x35\xac\xf6\x6b\x33\xa0"
5612                          "\xea\xef\x96\x62\xd8\xa9\xcf\x56"
5613                          "\xbf\xdb\x8a\xfd\xa1\x82\x77\x73"
5614                          "\x3d\x94\x4a\x49\x42\x6d\x08\x60"
5615                          "\xa1\xea\xab\xb6\x88\x13\x94\xb8"
5616                          "\x51\x98\xdb\x35\x85\xdf\xf6\xb9"
5617                          "\x8f\xcd\xdf\x80\xd3\x40\x2d\x72"
5618                          "\xb8\xb2\x6c\x02\x43\x35\x22\x2a"
5619                          "\x31\xed\xcd\x16\x19\xdf\x62\x0f"
5620                          "\x29\xcf\x87\x04\xec\x02\x4f\xe4"
5621                          "\xa2\xed\x73\xc6\x69\xd3\x7e\x89"
5622                          "\x0b\x76\x10\x7c\xd6\xf9\x6a\x25"
5623                          "\xed\xcc\x60\x5d\x61\x20\xc1\x97"
5624                          "\x56\x91\x57\x28\xbe\x71\x0d\xcd"
5625                          "\xde\xc4\x9e\x55\x91\xbe\xd1\x28"
5626                          "\x9b\x90\xeb\x73\xf3\x68\x51\xc6"
5627                          "\xdf\x82\xcc\xd8\x1f\xce\x5b\x27"
5628                          "\xc0\x60\x5e\x33\xd6\xa7\x20\xea"
5629                          "\xb2\x54\xc7\x5d\x6a\x3b\x67\x47"
5630                          "\xcf\xa0\xe3\xab\x86\xaf\xc1\x42"
5631                          "\xe6\xb0\x23\x4a\xaf\x53\xdf\xa0"
5632                          "\xad\x12\x32\x31\x03\xf7\x21\xbe"
5633                          "\x2d\xd5\x82\x42\xb6\x4a\x3d\xcd"
5634                          "\xd8\x81\x77\xa9\x49\x98\x6c\x09"
5635                          "\xc5\xa3\x61\x12\x62\x85\x6b\xcd"
5636                          "\xb3\xf4\x20\x0c\x41\xc4\x05\x37"
5637                          "\x46\x5f\xeb\x71\x8b\xf1\xaf\x6e"
5638                          "\xba\xf3\x50\x2e\xfe\xa8\x37\xeb"
5639                          "\xe8\x8c\x4f\xa4\x0c\xf1\x31\xc8"
5640                          "\x6e\x71\x4f\xa5\xd7\x97\x73\xe0"
5641                          "\x93\x4a\x2f\xda\x7b\xe0\x20\x54"
5642                          "\x1f\x8d\x85\x79\x0b\x7b\x5e\x75"
5643                          "\xb9\x07\x67\xcc\xc8\xe7\x21\x15"
5644                          "\xa7\xc8\x98\xff\x4b\x80\x1c\x12"
5645                          "\xa8\x54\xe1\x38\x52\xe6\x74\x81"
5646                          "\x97\x47\xa1\x41\x0e\xc0\x50\xe3"
5647                          "\x55\x0e\xc3\xa7\x70\x77\xce\x07"
5648                          "\xed\x8c\x88\xe6\xa1\x5b\x14\xec"
5649                          "\xe6\xde\x06\x6d\x74\xc5\xd9\xfa"
5650                          "\xe5\x2f\x5a\xff\xc8\x05\xee\x27"
5651                          "\x35\x61\xbf\x0b\x19\x78\x9b\xd2"
5652                          "\x04\xc7\x05\xb1\x79\xb4\xff\x5f"
5653                          "\xf3\xea\x67\x52\x78\xc2\xce\x70"
5654                          "\xa4\x05\x0b\xb2\xb3\xa8\x30\x97"
5655                          "\x37\x30\xe1\x91\x8d\xb3\x2a\xff",
5656                .ilen   = 512,
5657                .result = "\x00\x01\x02\x03\x04\x05\x06\x07"
5658                          "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f"
5659                          "\x10\x11\x12\x13\x14\x15\x16\x17"
5660                          "\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f"
5661                          "\x20\x21\x22\x23\x24\x25\x26\x27"
5662                          "\x28\x29\x2a\x2b\x2c\x2d\x2e\x2f"
5663                          "\x30\x31\x32\x33\x34\x35\x36\x37"
5664                          "\x38\x39\x3a\x3b\x3c\x3d\x3e\x3f"
5665                          "\x40\x41\x42\x43\x44\x45\x46\x47"
5666                          "\x48\x49\x4a\x4b\x4c\x4d\x4e\x4f"
5667                          "\x50\x51\x52\x53\x54\x55\x56\x57"
5668                          "\x58\x59\x5a\x5b\x5c\x5d\x5e\x5f"
5669                          "\x60\x61\x62\x63\x64\x65\x66\x67"
5670                          "\x68\x69\x6a\x6b\x6c\x6d\x6e\x6f"
5671                          "\x70\x71\x72\x73\x74\x75\x76\x77"
5672                          "\x78\x79\x7a\x7b\x7c\x7d\x7e\x7f"
5673                          "\x80\x81\x82\x83\x84\x85\x86\x87"
5674                          "\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f"
5675                          "\x90\x91\x92\x93\x94\x95\x96\x97"
5676                          "\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f"
5677                          "\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7"
5678                          "\xa8\xa9\xaa\xab\xac\xad\xae\xaf"
5679                          "\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7"
5680                          "\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf"
5681                          "\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7"
5682                          "\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf"
5683                          "\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7"
5684                          "\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf"
5685                          "\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7"
5686                          "\xe8\xe9\xea\xeb\xec\xed\xee\xef"
5687                          "\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7"
5688                          "\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff"
5689                          "\x00\x01\x02\x03\x04\x05\x06\x07"
5690                          "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f"
5691                          "\x10\x11\x12\x13\x14\x15\x16\x17"
5692                          "\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f"
5693                          "\x20\x21\x22\x23\x24\x25\x26\x27"
5694                          "\x28\x29\x2a\x2b\x2c\x2d\x2e\x2f"
5695                          "\x30\x31\x32\x33\x34\x35\x36\x37"
5696                          "\x38\x39\x3a\x3b\x3c\x3d\x3e\x3f"
5697                          "\x40\x41\x42\x43\x44\x45\x46\x47"
5698                          "\x48\x49\x4a\x4b\x4c\x4d\x4e\x4f"
5699                          "\x50\x51\x52\x53\x54\x55\x56\x57"
5700                          "\x58\x59\x5a\x5b\x5c\x5d\x5e\x5f"
5701                          "\x60\x61\x62\x63\x64\x65\x66\x67"
5702                          "\x68\x69\x6a\x6b\x6c\x6d\x6e\x6f"
5703                          "\x70\x71\x72\x73\x74\x75\x76\x77"
5704                          "\x78\x79\x7a\x7b\x7c\x7d\x7e\x7f"
5705                          "\x80\x81\x82\x83\x84\x85\x86\x87"
5706                          "\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f"
5707                          "\x90\x91\x92\x93\x94\x95\x96\x97"
5708                          "\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f"
5709                          "\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7"
5710                          "\xa8\xa9\xaa\xab\xac\xad\xae\xaf"
5711                          "\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7"
5712                          "\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf"
5713                          "\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7"
5714                          "\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf"
5715                          "\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7"
5716                          "\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf"
5717                          "\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7"
5718                          "\xe8\xe9\xea\xeb\xec\xed\xee\xef"
5719                          "\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7"
5720                          "\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff",
5721                .rlen   = 512,
5722                .also_non_np = 1,
5723                .np     = 2,
5724                .tap    = { 512 - 16, 16 },
5725        },
5726};
5727
5728/*
5729 * Serpent test vectors.  These are backwards because Serpent writes
5730 * octet sequences in right-to-left mode.
5731 */
5732#define SERPENT_ENC_TEST_VECTORS        5
5733#define SERPENT_DEC_TEST_VECTORS        5
5734
5735#define TNEPRES_ENC_TEST_VECTORS        4
5736#define TNEPRES_DEC_TEST_VECTORS        4
5737
5738#define SERPENT_CBC_ENC_TEST_VECTORS    1
5739#define SERPENT_CBC_DEC_TEST_VECTORS    1
5740
5741#define SERPENT_CTR_ENC_TEST_VECTORS    2
5742#define SERPENT_CTR_DEC_TEST_VECTORS    2
5743
5744#define SERPENT_LRW_ENC_TEST_VECTORS    8
5745#define SERPENT_LRW_DEC_TEST_VECTORS    8
5746
5747#define SERPENT_XTS_ENC_TEST_VECTORS    5
5748#define SERPENT_XTS_DEC_TEST_VECTORS    5
5749
5750static struct cipher_testvec serpent_enc_tv_template[] = {
5751        {
5752                .input  = "\x00\x01\x02\x03\x04\x05\x06\x07"
5753                          "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f",
5754                .ilen   = 16,
5755                .result = "\x12\x07\xfc\xce\x9b\xd0\xd6\x47"
5756                          "\x6a\xe9\x8f\xbe\xd1\x43\xa0\xe2",
5757                .rlen   = 16,
5758        }, {
5759                .key    = "\x00\x01\x02\x03\x04\x05\x06\x07"
5760                          "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f",
5761                .klen   = 16,
5762                .input  = "\x00\x01\x02\x03\x04\x05\x06\x07"