KVM: MMU: invalidate and flush on spte small->large page size change
[safe/jmp/linux-2.6] / crypto / testmgr.h
index c1c709b..74e3537 100644 (file)
@@ -1003,6 +1003,21 @@ static struct hash_testvec tgr128_tv_template[] = {
        },
 };
 
+#define GHASH_TEST_VECTORS 1
+
+static struct hash_testvec ghash_tv_template[] =
+{
+       {
+
+               .key    = "\xdf\xa6\xbf\x4d\xed\x81\xdb\x03\xff\xca\xff\x95\xf8\x30\xf0\x61",
+               .ksize  = 16,
+               .plaintext = "\x95\x2b\x2a\x56\xa5\x60\x04a\xc0\xb3\x2b\x66\x56\xa0\x5b\x40\xb6",
+               .psize  = 16,
+               .digest = "\xda\x53\xeb\x0a\xd2\xc5\x5b\xb6"
+                         "\x4f\xc4\x80\x2c\xc3\xfe\xda\x60",
+       },
+};
+
 /*
  * HMAC-MD5 test vectors from RFC2202
  * (These need to be fixed to not use strlen).
@@ -1654,6 +1669,78 @@ static struct hash_testvec aes_xcbc128_tv_template[] = {
        }
 };
 
+#define VMAC_AES_TEST_VECTORS  8
+static char vmac_string1[128] = {'\x01', '\x01', '\x01', '\x01',
+                               '\x02', '\x03', '\x02', '\x02',
+                               '\x02', '\x04', '\x01', '\x07',
+                               '\x04', '\x01', '\x04', '\x03',};
+static char vmac_string2[128] = {'a', 'b', 'c',};
+static char vmac_string3[128] = {'a', 'b', 'c', 'a', 'b', 'c',
+                               'a', 'b', 'c', 'a', 'b', 'c',
+                               'a', 'b', 'c', 'a', 'b', 'c',
+                               'a', 'b', 'c', 'a', 'b', 'c',
+                               'a', 'b', 'c', 'a', 'b', 'c',
+                               'a', 'b', 'c', 'a', 'b', 'c',
+                               'a', 'b', 'c', 'a', 'b', 'c',
+                               'a', 'b', 'c', 'a', 'b', 'c',
+                               };
+
+static struct hash_testvec aes_vmac128_tv_template[] = {
+       {
+               .key    = "\x00\x01\x02\x03\x04\x05\x06\x07"
+                         "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f",
+               .plaintext = NULL,
+               .digest = "\x07\x58\x80\x35\x77\xa4\x7b\x54",
+               .psize  = 0,
+               .ksize  = 16,
+       }, {
+               .key    = "\x00\x01\x02\x03\x04\x05\x06\x07"
+                         "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f",
+               .plaintext = vmac_string1,
+               .digest = "\xce\xf5\x3c\xd3\xae\x68\x8c\xa1",
+               .psize  = 128,
+               .ksize  = 16,
+       }, {
+               .key    = "\x00\x01\x02\x03\x04\x05\x06\x07"
+                         "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f",
+               .plaintext = vmac_string2,
+               .digest = "\xc9\x27\xb0\x73\x81\xbd\x14\x2d",
+               .psize  = 128,
+               .ksize  = 16,
+       }, {
+               .key    = "\x00\x01\x02\x03\x04\x05\x06\x07"
+                         "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f",
+               .plaintext = vmac_string3,
+               .digest = "\x8d\x1a\x95\x8c\x98\x47\x0b\x19",
+               .psize  = 128,
+               .ksize  = 16,
+       }, {
+               .key    = "abcdefghijklmnop",
+               .plaintext = NULL,
+               .digest = "\x3b\x89\xa1\x26\x9e\x55\x8f\x84",
+               .psize  = 0,
+               .ksize  = 16,
+       }, {
+               .key    = "abcdefghijklmnop",
+               .plaintext = vmac_string1,
+               .digest = "\xab\x5e\xab\xb0\xf6\x8d\x74\xc2",
+               .psize  = 128,
+               .ksize  = 16,
+       }, {
+               .key    = "abcdefghijklmnop",
+               .plaintext = vmac_string2,
+               .digest = "\x11\x15\x68\x42\x3d\x7b\x09\xdf",
+               .psize  = 128,
+               .ksize  = 16,
+       }, {
+               .key    = "abcdefghijklmnop",
+               .plaintext = vmac_string3,
+               .digest = "\x8b\x32\x8f\xe1\xed\x8f\xfa\xd4",
+               .psize  = 128,
+               .ksize  = 16,
+       },
+};
+
 /*
  * SHA384 HMAC test vectors from RFC4231
  */
@@ -2854,8 +2941,10 @@ static struct cipher_testvec cast6_dec_tv_template[] = {
 #define AES_LRW_DEC_TEST_VECTORS 8
 #define AES_XTS_ENC_TEST_VECTORS 4
 #define AES_XTS_DEC_TEST_VECTORS 4
-#define AES_CTR_ENC_TEST_VECTORS 7
-#define AES_CTR_DEC_TEST_VECTORS 6
+#define AES_CTR_ENC_TEST_VECTORS 3
+#define AES_CTR_DEC_TEST_VECTORS 3
+#define AES_CTR_3686_ENC_TEST_VECTORS 7
+#define AES_CTR_3686_DEC_TEST_VECTORS 6
 #define AES_GCM_ENC_TEST_VECTORS 9
 #define AES_GCM_DEC_TEST_VECTORS 8
 #define AES_CCM_ENC_TEST_VECTORS 7
@@ -3998,6 +4087,164 @@ static struct cipher_testvec aes_xts_dec_tv_template[] = {
 
 
 static struct cipher_testvec aes_ctr_enc_tv_template[] = {
+       { /* From NIST Special Publication 800-38A, Appendix F.5 */
+               .key    = "\x2b\x7e\x15\x16\x28\xae\xd2\xa6"
+                         "\xab\xf7\x15\x88\x09\xcf\x4f\x3c",
+               .klen   = 16,
+               .iv     = "\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7"
+                         "\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff",
+               .input  = "\x6b\xc1\xbe\xe2\x2e\x40\x9f\x96"
+                         "\xe9\x3d\x7e\x11\x73\x93\x17\x2a"
+                         "\xae\x2d\x8a\x57\x1e\x03\xac\x9c"
+                         "\x9e\xb7\x6f\xac\x45\xaf\x8e\x51"
+                         "\x30\xc8\x1c\x46\xa3\x5c\xe4\x11"
+                         "\xe5\xfb\xc1\x19\x1a\x0a\x52\xef"
+                         "\xf6\x9f\x24\x45\xdf\x4f\x9b\x17"
+                         "\xad\x2b\x41\x7b\xe6\x6c\x37\x10",
+               .ilen   = 64,
+               .result = "\x87\x4d\x61\x91\xb6\x20\xe3\x26"
+                         "\x1b\xef\x68\x64\x99\x0d\xb6\xce"
+                         "\x98\x06\xf6\x6b\x79\x70\xfd\xff"
+                         "\x86\x17\x18\x7b\xb9\xff\xfd\xff"
+                         "\x5a\xe4\xdf\x3e\xdb\xd5\xd3\x5e"
+                         "\x5b\x4f\x09\x02\x0d\xb0\x3e\xab"
+                         "\x1e\x03\x1d\xda\x2f\xbe\x03\xd1"
+                         "\x79\x21\x70\xa0\xf3\x00\x9c\xee",
+               .rlen   = 64,
+       }, {
+               .key    = "\x8e\x73\xb0\xf7\xda\x0e\x64\x52"
+                         "\xc8\x10\xf3\x2b\x80\x90\x79\xe5"
+                         "\x62\xf8\xea\xd2\x52\x2c\x6b\x7b",
+               .klen   = 24,
+               .iv     = "\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7"
+                         "\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff",
+               .input  = "\x6b\xc1\xbe\xe2\x2e\x40\x9f\x96"
+                         "\xe9\x3d\x7e\x11\x73\x93\x17\x2a"
+                         "\xae\x2d\x8a\x57\x1e\x03\xac\x9c"
+                         "\x9e\xb7\x6f\xac\x45\xaf\x8e\x51"
+                         "\x30\xc8\x1c\x46\xa3\x5c\xe4\x11"
+                         "\xe5\xfb\xc1\x19\x1a\x0a\x52\xef"
+                         "\xf6\x9f\x24\x45\xdf\x4f\x9b\x17"
+                         "\xad\x2b\x41\x7b\xe6\x6c\x37\x10",
+               .ilen   = 64,
+               .result = "\x1a\xbc\x93\x24\x17\x52\x1c\xa2"
+                         "\x4f\x2b\x04\x59\xfe\x7e\x6e\x0b"
+                         "\x09\x03\x39\xec\x0a\xa6\xfa\xef"
+                         "\xd5\xcc\xc2\xc6\xf4\xce\x8e\x94"
+                         "\x1e\x36\xb2\x6b\xd1\xeb\xc6\x70"
+                         "\xd1\xbd\x1d\x66\x56\x20\xab\xf7"
+                         "\x4f\x78\xa7\xf6\xd2\x98\x09\x58"
+                         "\x5a\x97\xda\xec\x58\xc6\xb0\x50",
+               .rlen   = 64,
+       }, {
+               .key    = "\x60\x3d\xeb\x10\x15\xca\x71\xbe"
+                         "\x2b\x73\xae\xf0\x85\x7d\x77\x81"
+                         "\x1f\x35\x2c\x07\x3b\x61\x08\xd7"
+                         "\x2d\x98\x10\xa3\x09\x14\xdf\xf4",
+               .klen   = 32,
+               .iv     = "\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7"
+                         "\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff",
+               .input  = "\x6b\xc1\xbe\xe2\x2e\x40\x9f\x96"
+                         "\xe9\x3d\x7e\x11\x73\x93\x17\x2a"
+                         "\xae\x2d\x8a\x57\x1e\x03\xac\x9c"
+                         "\x9e\xb7\x6f\xac\x45\xaf\x8e\x51"
+                         "\x30\xc8\x1c\x46\xa3\x5c\xe4\x11"
+                         "\xe5\xfb\xc1\x19\x1a\x0a\x52\xef"
+                         "\xf6\x9f\x24\x45\xdf\x4f\x9b\x17"
+                         "\xad\x2b\x41\x7b\xe6\x6c\x37\x10",
+               .ilen   = 64,
+               .result = "\x60\x1e\xc3\x13\x77\x57\x89\xa5"
+                         "\xb7\xa7\xf5\x04\xbb\xf3\xd2\x28"
+                         "\xf4\x43\xe3\xca\x4d\x62\xb5\x9a"
+                         "\xca\x84\xe9\x90\xca\xca\xf5\xc5"
+                         "\x2b\x09\x30\xda\xa2\x3d\xe9\x4c"
+                         "\xe8\x70\x17\xba\x2d\x84\x98\x8d"
+                         "\xdf\xc9\xc5\x8d\xb6\x7a\xad\xa6"
+                         "\x13\xc2\xdd\x08\x45\x79\x41\xa6",
+               .rlen   = 64,
+       }
+};
+
+static struct cipher_testvec aes_ctr_dec_tv_template[] = {
+       { /* From NIST Special Publication 800-38A, Appendix F.5 */
+               .key    = "\x2b\x7e\x15\x16\x28\xae\xd2\xa6"
+                         "\xab\xf7\x15\x88\x09\xcf\x4f\x3c",
+               .klen   = 16,
+               .iv     = "\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7"
+                         "\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff",
+               .input  = "\x87\x4d\x61\x91\xb6\x20\xe3\x26"
+                         "\x1b\xef\x68\x64\x99\x0d\xb6\xce"
+                         "\x98\x06\xf6\x6b\x79\x70\xfd\xff"
+                         "\x86\x17\x18\x7b\xb9\xff\xfd\xff"
+                         "\x5a\xe4\xdf\x3e\xdb\xd5\xd3\x5e"
+                         "\x5b\x4f\x09\x02\x0d\xb0\x3e\xab"
+                         "\x1e\x03\x1d\xda\x2f\xbe\x03\xd1"
+                         "\x79\x21\x70\xa0\xf3\x00\x9c\xee",
+               .ilen   = 64,
+               .result = "\x6b\xc1\xbe\xe2\x2e\x40\x9f\x96"
+                         "\xe9\x3d\x7e\x11\x73\x93\x17\x2a"
+                         "\xae\x2d\x8a\x57\x1e\x03\xac\x9c"
+                         "\x9e\xb7\x6f\xac\x45\xaf\x8e\x51"
+                         "\x30\xc8\x1c\x46\xa3\x5c\xe4\x11"
+                         "\xe5\xfb\xc1\x19\x1a\x0a\x52\xef"
+                         "\xf6\x9f\x24\x45\xdf\x4f\x9b\x17"
+                         "\xad\x2b\x41\x7b\xe6\x6c\x37\x10",
+               .rlen   = 64,
+       }, {
+               .key    = "\x8e\x73\xb0\xf7\xda\x0e\x64\x52"
+                         "\xc8\x10\xf3\x2b\x80\x90\x79\xe5"
+                         "\x62\xf8\xea\xd2\x52\x2c\x6b\x7b",
+               .klen   = 24,
+               .iv     = "\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7"
+                         "\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff",
+               .input  = "\x1a\xbc\x93\x24\x17\x52\x1c\xa2"
+                         "\x4f\x2b\x04\x59\xfe\x7e\x6e\x0b"
+                         "\x09\x03\x39\xec\x0a\xa6\xfa\xef"
+                         "\xd5\xcc\xc2\xc6\xf4\xce\x8e\x94"
+                         "\x1e\x36\xb2\x6b\xd1\xeb\xc6\x70"
+                         "\xd1\xbd\x1d\x66\x56\x20\xab\xf7"
+                         "\x4f\x78\xa7\xf6\xd2\x98\x09\x58"
+                         "\x5a\x97\xda\xec\x58\xc6\xb0\x50",
+               .ilen   = 64,
+               .result = "\x6b\xc1\xbe\xe2\x2e\x40\x9f\x96"
+                         "\xe9\x3d\x7e\x11\x73\x93\x17\x2a"
+                         "\xae\x2d\x8a\x57\x1e\x03\xac\x9c"
+                         "\x9e\xb7\x6f\xac\x45\xaf\x8e\x51"
+                         "\x30\xc8\x1c\x46\xa3\x5c\xe4\x11"
+                         "\xe5\xfb\xc1\x19\x1a\x0a\x52\xef"
+                         "\xf6\x9f\x24\x45\xdf\x4f\x9b\x17"
+                         "\xad\x2b\x41\x7b\xe6\x6c\x37\x10",
+               .rlen   = 64,
+       }, {
+               .key    = "\x60\x3d\xeb\x10\x15\xca\x71\xbe"
+                         "\x2b\x73\xae\xf0\x85\x7d\x77\x81"
+                         "\x1f\x35\x2c\x07\x3b\x61\x08\xd7"
+                         "\x2d\x98\x10\xa3\x09\x14\xdf\xf4",
+               .klen   = 32,
+               .iv     = "\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7"
+                         "\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff",
+               .input  = "\x60\x1e\xc3\x13\x77\x57\x89\xa5"
+                         "\xb7\xa7\xf5\x04\xbb\xf3\xd2\x28"
+                         "\xf4\x43\xe3\xca\x4d\x62\xb5\x9a"
+                         "\xca\x84\xe9\x90\xca\xca\xf5\xc5"
+                         "\x2b\x09\x30\xda\xa2\x3d\xe9\x4c"
+                         "\xe8\x70\x17\xba\x2d\x84\x98\x8d"
+                         "\xdf\xc9\xc5\x8d\xb6\x7a\xad\xa6"
+                         "\x13\xc2\xdd\x08\x45\x79\x41\xa6",
+               .ilen   = 64,
+               .result = "\x6b\xc1\xbe\xe2\x2e\x40\x9f\x96"
+                         "\xe9\x3d\x7e\x11\x73\x93\x17\x2a"
+                         "\xae\x2d\x8a\x57\x1e\x03\xac\x9c"
+                         "\x9e\xb7\x6f\xac\x45\xaf\x8e\x51"
+                         "\x30\xc8\x1c\x46\xa3\x5c\xe4\x11"
+                         "\xe5\xfb\xc1\x19\x1a\x0a\x52\xef"
+                         "\xf6\x9f\x24\x45\xdf\x4f\x9b\x17"
+                         "\xad\x2b\x41\x7b\xe6\x6c\x37\x10",
+               .rlen   = 64,
+       }
+};
+
+static struct cipher_testvec aes_ctr_rfc3686_enc_tv_template[] = {
        { /* From RFC 3686 */
                .key    = "\xae\x68\x52\xf8\x12\x10\x67\xcc"
                          "\x4b\xf7\xa5\x76\x55\x77\xf3\x9e"
@@ -5129,7 +5376,7 @@ static struct cipher_testvec aes_ctr_enc_tv_template[] = {
        },
 };
 
-static struct cipher_testvec aes_ctr_dec_tv_template[] = {
+static struct cipher_testvec aes_ctr_rfc3686_dec_tv_template[] = {
        { /* From RFC 3686 */
                .key    = "\xae\x68\x52\xf8\x12\x10\x67\xcc"
                          "\x4b\xf7\xa5\x76\x55\x77\xf3\x9e"