/* * Copyright (C) 2016 Samsung Electronics Co., Ltd. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. */ #ifndef _FMP_SELFTEST_H_ #define _FMP_SELFTEST_H_ #include "fmp_fips_info.h" int do_fmp_selftest(struct exynos_fmp *fmp); #if 0 /* * Indexes into the xbuf to simulate cross-page access. */ #define IDX1 32 #define IDX2 32400 #define IDX3 1 #define IDX4 8193 #define IDX5 22222 #define IDX6 17101 #define IDX7 27333 #define IDX8 3000 static unsigned int IDX[8] = { IDX1, IDX2, IDX3, IDX4, IDX5, IDX6, IDX7, IDX8 }; #endif #define AES_XTS_ENC_TEST_VECTORS 5 #define SHA256_TEST_VECTORS 2 #define HMAC_SHA256_TEST_VECTORS 10 #ifdef CONFIG_KEYS_IN_PRDT static const struct cipher_testvec aes_xts_enc_tv_template[] = { /* http://grouper.ieee.org/groups/1619/email/pdf00086.pdf */ { /* XTS-AES 1 */ .key = "\xa1\xb9\x0c\xba\x3f\x06\xac\x35" "\x3b\x2c\x34\x38\x76\x08\x17\x62" "\x09\x09\x23\x02\x6e\x91\x77\x18" "\x15\xf2\x9d\xab\x01\x93\x2f\x2f", .klen = 32, .iv = "\x4f\xae\xf7\x11\x7c\xda\x59\xc6" "\x6e\x4b\x92\x01\x3e\x76\x8a\xd5", .input = "\xeb\xab\xce\x95\xb1\x4d\x3c\x8d" "\x6f\xb3\x50\x39\x07\x90\x31\x1c", .ilen = 16, .result = "\x77\x8a\xe8\xb4\x3c\xb9\x8d\x5a" "\x82\x50\x81\xd5\xbe\x47\x1c\x63", .rlen = 16, }, { /* XTS-AES 2 */ .key = "\x11\x11\x11\x11\x11\x11\x11\x11" "\x11\x11\x11\x11\x11\x11\x11\x11" "\x22\x22\x22\x22\x22\x22\x22\x22" "\x22\x22\x22\x22\x22\x22\x22\x22", .klen = 32, .iv = "\x33\x33\x33\x33\x33\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00", .input = "\x44\x44\x44\x44\x44\x44\x44\x44" "\x44\x44\x44\x44\x44\x44\x44\x44" "\x44\x44\x44\x44\x44\x44\x44\x44" "\x44\x44\x44\x44\x44\x44\x44\x44", .ilen = 32, .result = "\xc4\x54\x18\x5e\x6a\x16\x93\x6e" "\x39\x33\x40\x38\xac\xef\x83\x8b" "\xfb\x18\x6f\xff\x74\x80\xad\xc4" "\x28\x93\x82\xec\xd6\xd3\x94\xf0", .rlen = 32, }, { /* XTS-AES 3 */ .key = "\xff\xfe\xfd\xfc\xfb\xfa\xf9\xf8" "\xf7\xf6\xf5\xf4\xf3\xf2\xf1\xf0" "\x22\x22\x22\x22\x22\x22\x22\x22" "\x22\x22\x22\x22\x22\x22\x22\x22", .klen = 32, .iv = "\x33\x33\x33\x33\x33\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00", .input = "\x44\x44\x44\x44\x44\x44\x44\x44" "\x44\x44\x44\x44\x44\x44\x44\x44" "\x44\x44\x44\x44\x44\x44\x44\x44" "\x44\x44\x44\x44\x44\x44\x44\x44", .ilen = 32, .result = "\xaf\x85\x33\x6b\x59\x7a\xfc\x1a" "\x90\x0b\x2e\xb2\x1e\xc9\x49\xd2" "\x92\xdf\x4c\x04\x7e\x0b\x21\x53" "\x21\x86\xa5\x97\x1a\x22\x7a\x89", .rlen = 32, }, { /* XTS-AES 4 */ .key = "\x27\x18\x28\x18\x28\x45\x90\x45" "\x23\x53\x60\x28\x74\x71\x35\x26" "\x31\x41\x59\x26\x53\x58\x97\x93" "\x23\x84\x62\x64\x33\x83\x27\x95", .klen = 32, .iv = "\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00", .input = "\x00\x01\x02\x03\x04\x05\x06\x07" "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f" "\x10\x11\x12\x13\x14\x15\x16\x17" "\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f" "\x20\x21\x22\x23\x24\x25\x26\x27" "\x28\x29\x2a\x2b\x2c\x2d\x2e\x2f" "\x30\x31\x32\x33\x34\x35\x36\x37" "\x38\x39\x3a\x3b\x3c\x3d\x3e\x3f" "\x40\x41\x42\x43\x44\x45\x46\x47" "\x48\x49\x4a\x4b\x4c\x4d\x4e\x4f" "\x50\x51\x52\x53\x54\x55\x56\x57" "\x58\x59\x5a\x5b\x5c\x5d\x5e\x5f" "\x60\x61\x62\x63\x64\x65\x66\x67" "\x68\x69\x6a\x6b\x6c\x6d\x6e\x6f" "\x70\x71\x72\x73\x74\x75\x76\x77" "\x78\x79\x7a\x7b\x7c\x7d\x7e\x7f" "\x80\x81\x82\x83\x84\x85\x86\x87" "\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f" "\x90\x91\x92\x93\x94\x95\x96\x97" "\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f" "\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7" "\xa8\xa9\xaa\xab\xac\xad\xae\xaf" "\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7" "\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf" "\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7" "\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf" "\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7" "\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf" "\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7" "\xe8\xe9\xea\xeb\xec\xed\xee\xef" "\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7" "\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff" "\x00\x01\x02\x03\x04\x05\x06\x07" "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f" "\x10\x11\x12\x13\x14\x15\x16\x17" "\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f" "\x20\x21\x22\x23\x24\x25\x26\x27" "\x28\x29\x2a\x2b\x2c\x2d\x2e\x2f" "\x30\x31\x32\x33\x34\x35\x36\x37" "\x38\x39\x3a\x3b\x3c\x3d\x3e\x3f" "\x40\x41\x42\x43\x44\x45\x46\x47" "\x48\x49\x4a\x4b\x4c\x4d\x4e\x4f" "\x50\x51\x52\x53\x54\x55\x56\x57" "\x58\x59\x5a\x5b\x5c\x5d\x5e\x5f" "\x60\x61\x62\x63\x64\x65\x66\x67" "\x68\x69\x6a\x6b\x6c\x6d\x6e\x6f" "\x70\x71\x72\x73\x74\x75\x76\x77" "\x78\x79\x7a\x7b\x7c\x7d\x7e\x7f" "\x80\x81\x82\x83\x84\x85\x86\x87" "\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f" "\x90\x91\x92\x93\x94\x95\x96\x97" "\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f" "\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7" "\xa8\xa9\xaa\xab\xac\xad\xae\xaf" "\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7" "\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf" "\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7" "\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf" "\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7" "\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf" "\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7" "\xe8\xe9\xea\xeb\xec\xed\xee\xef" "\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7" "\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff", .ilen = 512, .result = "\x27\xa7\x47\x9b\xef\xa1\xd4\x76" "\x48\x9f\x30\x8c\xd4\xcf\xa6\xe2" "\xa9\x6e\x4b\xbe\x32\x08\xff\x25" "\x28\x7d\xd3\x81\x96\x16\xe8\x9c" "\xc7\x8c\xf7\xf5\xe5\x43\x44\x5f" "\x83\x33\xd8\xfa\x7f\x56\x00\x00" "\x05\x27\x9f\xa5\xd8\xb5\xe4\xad" "\x40\xe7\x36\xdd\xb4\xd3\x54\x12" "\x32\x80\x63\xfd\x2a\xab\x53\xe5" "\xea\x1e\x0a\x9f\x33\x25\x00\xa5" "\xdf\x94\x87\xd0\x7a\x5c\x92\xcc" "\x51\x2c\x88\x66\xc7\xe8\x60\xce" "\x93\xfd\xf1\x66\xa2\x49\x12\xb4" "\x22\x97\x61\x46\xae\x20\xce\x84" "\x6b\xb7\xdc\x9b\xa9\x4a\x76\x7a" "\xae\xf2\x0c\x0d\x61\xad\x02\x65" "\x5e\xa9\x2d\xc4\xc4\xe4\x1a\x89" "\x52\xc6\x51\xd3\x31\x74\xbe\x51" "\xa1\x0c\x42\x11\x10\xe6\xd8\x15" "\x88\xed\xe8\x21\x03\xa2\x52\xd8" "\xa7\x50\xe8\x76\x8d\xef\xff\xed" "\x91\x22\x81\x0a\xae\xb9\x9f\x91" "\x72\xaf\x82\xb6\x04\xdc\x4b\x8e" "\x51\xbc\xb0\x82\x35\xa6\xf4\x34" "\x13\x32\xe4\xca\x60\x48\x2a\x4b" "\xa1\xa0\x3b\x3e\x65\x00\x8f\xc5" "\xda\x76\xb7\x0b\xf1\x69\x0d\xb4" "\xea\xe2\x9c\x5f\x1b\xad\xd0\x3c" "\x5c\xcf\x2a\x55\xd7\x05\xdd\xcd" "\x86\xd4\x49\x51\x1c\xeb\x7e\xc3" "\x0b\xf1\x2b\x1f\xa3\x5b\x91\x3f" "\x9f\x74\x7a\x8a\xfd\x1b\x13\x0e" "\x94\xbf\xf9\x4e\xff\xd0\x1a\x91" "\x73\x5c\xa1\x72\x6a\xcd\x0b\x19" "\x7c\x4e\x5b\x03\x39\x36\x97\xe1" "\x26\x82\x6f\xb6\xbb\xde\x8e\xcc" "\x1e\x08\x29\x85\x16\xe2\xc9\xed" "\x03\xff\x3c\x1b\x78\x60\xf6\xde" "\x76\xd4\xce\xcd\x94\xc8\x11\x98" "\x55\xef\x52\x97\xca\x67\xe9\xf3" "\xe7\xff\x72\xb1\xe9\x97\x85\xca" "\x0a\x7e\x77\x20\xc5\xb3\x6d\xc6" "\xd7\x2c\xac\x95\x74\xc8\xcb\xbc" "\x2f\x80\x1e\x23\xe5\x6f\xd3\x44" "\xb0\x7f\x22\x15\x4b\xeb\xa0\xf0" "\x8c\xe8\x89\x1e\x64\x3e\xd9\x95" "\xc9\x4d\x9a\x69\xc9\xf1\xb5\xf4" "\x99\x02\x7a\x78\x57\x2a\xee\xbd" "\x74\xd2\x0c\xc3\x98\x81\xc2\x13" "\xee\x77\x0b\x10\x10\xe4\xbe\xa7" "\x18\x84\x69\x77\xae\x11\x9f\x7a" "\x02\x3a\xb5\x8c\xca\x0a\xd7\x52" "\xaf\xe6\x56\xbb\x3c\x17\x25\x6a" "\x9f\x6e\x9b\xf1\x9f\xdd\x5a\x38" "\xfc\x82\xbb\xe8\x72\xc5\x53\x9e" "\xdb\x60\x9e\xf4\xf7\x9c\x20\x3e" "\xbb\x14\x0f\x2e\x58\x3c\xb2\xad" "\x15\xb4\xaa\x5b\x65\x50\x16\xa8" "\x44\x92\x77\xdb\xd4\x77\xef\x2c" "\x8d\x6c\x01\x7d\xb7\x38\xb1\x8d" "\xeb\x4a\x42\x7d\x19\x23\xce\x3f" "\xf2\x62\x73\x57\x79\xa4\x18\xf2" "\x0a\x28\x2d\xf9\x20\x14\x7b\xea" "\xbe\x42\x1e\xe5\x31\x9d\x05\x68", .rlen = 512, }, { /* XTS-AES 5, XTS-AES-256, data unit 512 bytes */ .key = "\x27\x18\x28\x18\x28\x45\x90\x45" "\x23\x53\x60\x28\x74\x71\x35\x26" "\x62\x49\x77\x57\x24\x70\x93\x69" "\x99\x59\x57\x49\x66\x96\x76\x27" "\x31\x41\x59\x26\x53\x58\x97\x93" "\x23\x84\x62\x64\x33\x83\x27\x95" "\x02\x88\x41\x97\x16\x93\x99\x37" "\x51\x05\x82\x09\x74\x94\x45\x92", .klen = 64, .iv = "\xff\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00", .input = "\x00\x01\x02\x03\x04\x05\x06\x07" "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f" "\x10\x11\x12\x13\x14\x15\x16\x17" "\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f" "\x20\x21\x22\x23\x24\x25\x26\x27" "\x28\x29\x2a\x2b\x2c\x2d\x2e\x2f" "\x30\x31\x32\x33\x34\x35\x36\x37" "\x38\x39\x3a\x3b\x3c\x3d\x3e\x3f" "\x40\x41\x42\x43\x44\x45\x46\x47" "\x48\x49\x4a\x4b\x4c\x4d\x4e\x4f" "\x50\x51\x52\x53\x54\x55\x56\x57" "\x58\x59\x5a\x5b\x5c\x5d\x5e\x5f" "\x60\x61\x62\x63\x64\x65\x66\x67" "\x68\x69\x6a\x6b\x6c\x6d\x6e\x6f" "\x70\x71\x72\x73\x74\x75\x76\x77" "\x78\x79\x7a\x7b\x7c\x7d\x7e\x7f" "\x80\x81\x82\x83\x84\x85\x86\x87" "\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f" "\x90\x91\x92\x93\x94\x95\x96\x97" "\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f" "\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7" "\xa8\xa9\xaa\xab\xac\xad\xae\xaf" "\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7" "\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf" "\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7" "\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf" "\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7" "\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf" "\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7" "\xe8\xe9\xea\xeb\xec\xed\xee\xef" "\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7" "\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff" "\x00\x01\x02\x03\x04\x05\x06\x07" "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f" "\x10\x11\x12\x13\x14\x15\x16\x17" "\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f" "\x20\x21\x22\x23\x24\x25\x26\x27" "\x28\x29\x2a\x2b\x2c\x2d\x2e\x2f" "\x30\x31\x32\x33\x34\x35\x36\x37" "\x38\x39\x3a\x3b\x3c\x3d\x3e\x3f" "\x40\x41\x42\x43\x44\x45\x46\x47" "\x48\x49\x4a\x4b\x4c\x4d\x4e\x4f" "\x50\x51\x52\x53\x54\x55\x56\x57" "\x58\x59\x5a\x5b\x5c\x5d\x5e\x5f" "\x60\x61\x62\x63\x64\x65\x66\x67" "\x68\x69\x6a\x6b\x6c\x6d\x6e\x6f" "\x70\x71\x72\x73\x74\x75\x76\x77" "\x78\x79\x7a\x7b\x7c\x7d\x7e\x7f" "\x80\x81\x82\x83\x84\x85\x86\x87" "\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f" "\x90\x91\x92\x93\x94\x95\x96\x97" "\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f" "\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7" "\xa8\xa9\xaa\xab\xac\xad\xae\xaf" "\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7" "\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf" "\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7" "\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf" "\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7" "\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf" "\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7" "\xe8\xe9\xea\xeb\xec\xed\xee\xef" "\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7" "\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff", .ilen = 512, .result = "\x1c\x3b\x3a\x10\x2f\x77\x03\x86" "\xe4\x83\x6c\x99\xe3\x70\xcf\x9b" "\xea\x00\x80\x3f\x5e\x48\x23\x57" "\xa4\xae\x12\xd4\x14\xa3\xe6\x3b" "\x5d\x31\xe2\x76\xf8\xfe\x4a\x8d" "\x66\xb3\x17\xf9\xac\x68\x3f\x44" "\x68\x0a\x86\xac\x35\xad\xfc\x33" "\x45\xbe\xfe\xcb\x4b\xb1\x88\xfd" "\x57\x76\x92\x6c\x49\xa3\x09\x5e" "\xb1\x08\xfd\x10\x98\xba\xec\x70" "\xaa\xa6\x69\x99\xa7\x2a\x82\xf2" "\x7d\x84\x8b\x21\xd4\xa7\x41\xb0" "\xc5\xcd\x4d\x5f\xff\x9d\xac\x89" "\xae\xba\x12\x29\x61\xd0\x3a\x75" "\x71\x23\xe9\x87\x0f\x8a\xcf\x10" "\x00\x02\x08\x87\x89\x14\x29\xca" "\x2a\x3e\x7a\x7d\x7d\xf7\xb1\x03" "\x55\x16\x5c\x8b\x9a\x6d\x0a\x7d" "\xe8\xb0\x62\xc4\x50\x0d\xc4\xcd" "\x12\x0c\x0f\x74\x18\xda\xe3\xd0" "\xb5\x78\x1c\x34\x80\x3f\xa7\x54" "\x21\xc7\x90\xdf\xe1\xde\x18\x34" "\xf2\x80\xd7\x66\x7b\x32\x7f\x6c" "\x8c\xd7\x55\x7e\x12\xac\x3a\x0f" "\x93\xec\x05\xc5\x2e\x04\x93\xef" "\x31\xa1\x2d\x3d\x92\x60\xf7\x9a" "\x28\x9d\x6a\x37\x9b\xc7\x0c\x50" "\x84\x14\x73\xd1\xa8\xcc\x81\xec" "\x58\x3e\x96\x45\xe0\x7b\x8d\x96" "\x70\x65\x5b\xa5\xbb\xcf\xec\xc6" "\xdc\x39\x66\x38\x0a\xd8\xfe\xcb" "\x17\xb6\xba\x02\x46\x9a\x02\x0a" "\x84\xe1\x8e\x8f\x84\x25\x20\x70" "\xc1\x3e\x9f\x1f\x28\x9b\xe5\x4f" "\xbc\x48\x14\x57\x77\x8f\x61\x60" "\x15\xe1\x32\x7a\x02\xb1\x40\xf1" "\x50\x5e\xb3\x09\x32\x6d\x68\x37" "\x8f\x83\x74\x59\x5c\x84\x9d\x84" "\xf4\xc3\x33\xec\x44\x23\x88\x51" "\x43\xcb\x47\xbd\x71\xc5\xed\xae" "\x9b\xe6\x9a\x2f\xfe\xce\xb1\xbe" "\xc9\xde\x24\x4f\xbe\x15\x99\x2b" "\x11\xb7\x7c\x04\x0f\x12\xbd\x8f" "\x6a\x97\x5a\x44\xa0\xf9\x0c\x29" "\xa9\xab\xc3\xd4\xd8\x93\x92\x72" "\x84\xc5\x87\x54\xcc\xe2\x94\x52" "\x9f\x86\x14\xdc\xd2\xab\xa9\x91" "\x92\x5f\xed\xc4\xae\x74\xff\xac" "\x6e\x33\x3b\x93\xeb\x4a\xff\x04" "\x79\xda\x9a\x41\x0e\x44\x50\xe0" "\xdd\x7a\xe4\xc6\xe2\x91\x09\x00" "\x57\x5d\xa4\x01\xfc\x07\x05\x9f" "\x64\x5e\x8b\x7e\x9b\xfd\xef\x33" "\x94\x30\x54\xff\x84\x01\x14\x93" "\xc2\x7b\x34\x29\xea\xed\xb4\xed" "\x53\x76\x44\x1a\x77\xed\x43\x85" "\x1a\xd7\x7f\x16\xf5\x41\xdf\xd2" "\x69\xd5\x0d\x6a\x5f\x14\xfb\x0a" "\xab\x1c\xbb\x4c\x15\x50\xbe\x97" "\xf7\xab\x40\x66\x19\x3c\x4c\xaa" "\x77\x3d\xad\x38\x01\x4b\xd2\x09" "\x2f\xa7\x55\xc8\x24\xbb\x5e\x54" "\xc4\xf3\x6f\xfd\xa9\xfc\xea\x70" "\xb9\xc6\xe6\x93\xe1\x48\xc1\x51", .rlen = 512, } }; #else static const struct cipher_testvec aes_xts_enc_tv_template[] = { { /* XTS-AES 1 */ .key = "\xef\x01\x0c\xa1\xa3\x66\x3e\x32" "\x53\x43\x49\xbc\x0b\xae\x62\x23" "\x2a\x15\x73\x34\x85\x68\xfb\x9e" "\xf4\x17\x68\xa7\x67\x4f\x50\x7a" "\x72\x7f\x98\x75\x53\x97\xd0\xe0" "\xaa\x32\xf8\x30\x33\x8c\xc7\xa9" "\x26\xc7\x73\xf0\x9e\x57\xb3\x57" "\xcd\x15\x6a\xfb\xca\x46\xe1\xa0", .klen = 64, .input = "\xed\x98\xe0\x17\x70\xa8\x53\xb4" "\x9d\xb9\xe6\xaa\xf8\x8f\x0a\x41" "\xb9\xb5\x6e\x91\xa5\xa2\xb1\x1d" "\x40\x52\x92\x54\xf5\x52\x3e\x75", .ilen = 32, .result = "\xca\x20\xc5\x5e\x8d\xc1\x49\x68" "\x7d\x25\x41\xde\x39\xc3\xdf\x63" "\x00\xbb\x5a\x16\x3c\x10\xce\xd3" "\x66\x6b\x13\x57\xdb\x8b\xd3\x9d", .rlen = 32, .DataUnitSeqNumber = 187, }, { /* XTS-AES 2 */ .key = "\xc4\xe6\xb3\x7e\x10\x75\x96\x9d" "\x41\xa7\x60\x1a\xa1\x05\xdd\x41" "\xb1\x82\x00\xa0\x28\xda\x1f\x79" "\xf5\x5c\x4d\x2d\xb4\x78\xc4\xe9" "\x8d\x9e\xd4\x91\xcf\xe5\x2f\x31" "\xec\xb7\xcb\xb4\x89\x1e\xb7\x79" "\xe0\x57\x39\x2b\x3b\x27\xc1\x9c" "\xbe\x9b\x48\x75\xc8\xc3\x1c\x22", .klen = 64, .input = "\x87\xed\xe4\x02\xd0\x56\x13\x59" "\x79\x9a\x41\xbe\x04\x2c\xed\x9a" "\x8e\x15\x63\x91\x65\xef\x1a\x4d" "\x2f\x67\x85\xc3\x94\xd6\x1e\x5f", .ilen = 32, .result = "\xa5\x10\x37\x19\x8f\x3f\x9f\xe5" "\xd0\x5b\xef\x52\x36\x3a\xce\xc4" "\x0e\x86\xe3\xab\xb8\x34\x18\x03" "\x48\xd2\xe0\x86\x27\x73\x3e\x65", .rlen = 32, .DataUnitSeqNumber = 223, }, { /* XTS-AES 3 */ .key = "\xf7\xf7\x94\x6f\x61\x88\xcd\xf6" "\x89\x67\x29\x36\x03\xb8\x2e\xbf" "\x64\x59\x18\x46\x2a\x67\x27\x86" "\x3a\x9f\xf9\xf6\x24\x00\xa7\xd4" "\x14\xdf\x18\xca\xdf\x5f\xbd\x95" "\x73\xf2\xd9\xc1\x81\xaa\xb7\x17" "\xa3\x27\x64\x32\x6f\x19\x2f\x77" "\xac\x36\x85\xb9\x5c\x28\xf8\xeb", .klen = 64, .input = "\x9b\x00\x1e\xff\x6b\xbc\x37\x93" "\xf3\xbe\x6f\x9e\x71\xdf\x42\x5a" "\x68\x28\xbc\x89\x2d\x4a\xac\x93" "\x45\x88\x9a\x4d\x14\x12\xb3\xba", .ilen = 32, .result = "\x94\xd2\x0b\xe2\x4a\x82\x46\x01" "\x02\x81\xc9\x15\x5e\xbf\x3f\xff" "\xd1\x83\x2c\x88\x55\x6d\x89\x01" "\xc5\x1a\x4e\x3c\x4f\xdb\xac\x47", .rlen = 32, .DataUnitSeqNumber = 229, }, { /* XTS-AES 4 */ .key = "\x1d\xd0\xd8\x6d\x63\xea\xfb\xd1" "\x01\x1e\x4a\x44\x93\xf5\x08\xb4" "\xe5\x15\xc4\x7a\xae\x63\xd4\xdb" "\xa1\xde\x1f\x07\xbd\xff\xe5\x59" "\x5f\x01\xf5\xa2\x7b\xff\x84\x41" "\x10\x4e\xc7\x3b\x15\x47\x3f\x72" "\x46\xdb\x7d\x48\x21\x8c\x11\xdc" "\x1c\x9b\xfc\x86\x5f\x3d\x76\x8f", .klen = 64, .input = "\x5d\x54\x0d\xd2\xcc\x12\xf7\xe1" "\xb4\x47\xf5\xc3\x60\x5e\x08\x16" "\xc4\xc9\x46\x16\x64\x85\xe9\xb1" "\x8d\xb3\xe0\x0e\x44\x6c\x49\x0e", .ilen = 32, .result = "\xdf\xe1\x94\x51\x25\xf8\xcc\x77" "\xdf\x69\x37\x9e\xb4\x71\x12\x73" "\x7a\x53\x2c\xe5\xc2\x49\x89\x8b" "\x83\x8a\xee\x68\x60\xb9\xbd\x03", .rlen = 32, .DataUnitSeqNumber = 10, }, { /* XTS-AES 5 */ .key = "\x7f\xdd\xb3\x04\x4f\x1a\x61\x05" "\x05\x2d\x47\x08\x1b\x4e\xca\x23" "\xea\x54\x12\x07\x88\x22\x12\x5e" "\x6f\x9f\x17\x8e\xc4\xa9\xcd\xe0" "\x4f\xe0\x46\xc9\x96\x1d\x83\x5d" "\xd5\x96\x7f\xfe\xb3\x9b\x71\x45" "\x54\x93\x8c\x2b\x93\x26\x05\x34" "\xcc\xd3\xae\xa6\x8d\xbb\x88\x2e", .klen = 64, .input = "\x20\x2e\x98\x47\x0a\x11\x38\x79" "\x81\x52\xe5\xde\x50\xd1\x8b\x13" "\xd1\x6d\xdf\x38\xb8\x38\x26\x06" "\x68\x56\x99\x57\xfd\x5f\x70\xdf", .ilen = 32, .result = "\xbd\x19\xfa\xc7\x60\x5a\xf8\xbe" "\xf6\x3f\x0f\x2e\x80\x95\xd5\x88" "\x3c\x04\xc8\x98\x1d\xe2\x13\x68" "\x49\x03\xa5\x9c\x22\xfc\x2f\xe6", .rlen = 32, .DataUnitSeqNumber = 151, } }; #endif /* * SHA256 test vectors from from NIST */ static const struct hash_testvec sha256_tv_template[] = { { .plaintext = "abc", .psize = 3, .digest = "\xba\x78\x16\xbf\x8f\x01\xcf\xea" "\x41\x41\x40\xde\x5d\xae\x22\x23" "\xb0\x03\x61\xa3\x96\x17\x7a\x9c" "\xb4\x10\xff\x61\xf2\x00\x15\xad", }, { .plaintext = "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq", .psize = 56, .digest = "\x24\x8d\x6a\x61\xd2\x06\x38\xb8" "\xe5\xc0\x26\x93\x0c\x3e\x60\x39" "\xa3\x3c\xe4\x59\x64\xff\x21\x67" "\xf6\xec\xed\xd4\x19\xdb\x06\xc1", .np = 2, .tap = { 28, 28 } }, }; /* * HMAC-SHA256 test vectors from * draft-ietf-ipsec-ciph-sha-256-01.txt */ static const struct hash_testvec hmac_sha256_tv_template[] = { { .key = "\x01\x02\x03\x04\x05\x06\x07\x08" "\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10" "\x11\x12\x13\x14\x15\x16\x17\x18" "\x19\x1a\x1b\x1c\x1d\x1e\x1f\x20", .ksize = 32, .plaintext = "abc", .psize = 3, .digest = "\xa2\x1b\x1f\x5d\x4c\xf4\xf7\x3a" "\x4d\xd9\x39\x75\x0f\x7a\x06\x6a" "\x7f\x98\xcc\x13\x1c\xb1\x6a\x66" "\x92\x75\x90\x21\xcf\xab\x81\x81", }, { .key = "\x01\x02\x03\x04\x05\x06\x07\x08" "\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10" "\x11\x12\x13\x14\x15\x16\x17\x18" "\x19\x1a\x1b\x1c\x1d\x1e\x1f\x20", .ksize = 32, .plaintext = "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq", .psize = 56, .digest = "\x10\x4f\xdc\x12\x57\x32\x8f\x08" "\x18\x4b\xa7\x31\x31\xc5\x3c\xae" "\xe6\x98\xe3\x61\x19\x42\x11\x49" "\xea\x8c\x71\x24\x56\x69\x7d\x30", }, { .key = "\x01\x02\x03\x04\x05\x06\x07\x08" "\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10" "\x11\x12\x13\x14\x15\x16\x17\x18" "\x19\x1a\x1b\x1c\x1d\x1e\x1f\x20", .ksize = 32, .plaintext = "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq" "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq", .psize = 112, .digest = "\x47\x03\x05\xfc\x7e\x40\xfe\x34" "\xd3\xee\xb3\xe7\x73\xd9\x5a\xab" "\x73\xac\xf0\xfd\x06\x04\x47\xa5" "\xeb\x45\x95\xbf\x33\xa9\xd1\xa3", }, { .key = "\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b" "\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b" "\x0b\x0b\x0b\x0b\x0b\x0b", .ksize = 32, .plaintext = "Hi There", .psize = 8, .digest = "\x19\x8a\x60\x7e\xb4\x4b\xfb\xc6" "\x99\x03\xa0\xf1\xcf\x2b\xbd\xc5" "\xba\x0a\xa3\xf3\xd9\xae\x3c\x1c" "\x7a\x3b\x16\x96\xa0\xb6\x8c\xf7", }, { .key = "Jefe", .ksize = 4, .plaintext = "what do ya want for nothing?", .psize = 28, .digest = "\x5b\xdc\xc1\x46\xbf\x60\x75\x4e" "\x6a\x04\x24\x26\x08\x95\x75\xc7" "\x5a\x00\x3f\x08\x9d\x27\x39\x83" "\x9d\xec\x58\xb9\x64\xec\x38\x43", .np = 2, .tap = { 14, 14 } }, { .key = "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa" "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa" "\xaa\xaa\xaa\xaa\xaa\xaa\xaa", .ksize = 32, .plaintext = "\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd" "\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd" "\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd" "\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd", .psize = 50, .digest = "\xcd\xcb\x12\x20\xd1\xec\xcc\xea" "\x91\xe5\x3a\xba\x30\x92\xf9\x62" "\xe5\x49\xfe\x6c\xe9\xed\x7f\xdc" "\x43\x19\x1f\xbd\xe4\x5c\x30\xb0", }, { .key = "\x01\x02\x03\x04\x05\x06\x07\x08" "\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10" "\x11\x12\x13\x14\x15\x16\x17\x18" "\x19\x1a\x1b\x1c\x1d\x1e\x1f\x20" "\x21\x22\x23\x24\x25", .ksize = 37, .plaintext = "\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd" "\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd" "\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd" "\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd", .psize = 50, .digest = "\xd4\x63\x3c\x17\xf6\xfb\x8d\x74" "\x4c\x66\xde\xe0\xf8\xf0\x74\x55" "\x6e\xc4\xaf\x55\xef\x07\x99\x85" "\x41\x46\x8e\xb4\x9b\xd2\xe9\x17", }, { .key = "\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c" "\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c" "\x0c\x0c\x0c\x0c\x0c\x0c", .ksize = 32, .plaintext = "Test With Truncation", .psize = 20, .digest = "\x75\x46\xaf\x01\x84\x1f\xc0\x9b" "\x1a\xb9\xc3\x74\x9a\x5f\x1c\x17" "\xd4\xf5\x89\x66\x8a\x58\x7b\x27" "\x00\xa9\xc9\x7c\x11\x93\xcf\x42", }, { .key = "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa" "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa" "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa" "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa" "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa" "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa" "\xaa\xaa", .ksize = 80, .plaintext = "Test Using Larger Than Block-Size Key - Hash Key First", .psize = 54, .digest = "\x69\x53\x02\x5e\xd9\x6f\x0c\x09" "\xf8\x0a\x96\xf7\x8e\x65\x38\xdb" "\xe2\xe7\xb8\x20\xe3\xdd\x97\x0e" "\x7d\xdd\x39\x09\x1b\x32\x35\x2f", }, { .key = "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa" "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa" "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa" "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa" "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa" "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa" "\xaa\xaa", .ksize = 80, .plaintext = "Test Using Larger Than Block-Size Key and Larger Than " "One Block-Size Data", .psize = 73, .digest = "\x63\x55\xac\x22\xe8\x90\xd0\xa3" "\xc8\x48\x1a\x5c\xa4\x82\x5b\xc8" "\x84\xd3\xe7\xa1\xff\x98\xa2\xfc" "\x2a\xc7\xd8\xe0\x64\xc3\xb2\xe6", }, }; #endif