summaryrefslogtreecommitdiff
path: root/crypto/testmgr.h
diff options
context:
space:
mode:
Diffstat (limited to 'crypto/testmgr.h')
-rw-r--r--crypto/testmgr.h215
1 files changed, 213 insertions, 2 deletions
diff --git a/crypto/testmgr.h b/crypto/testmgr.h
index 27adc92842ba..82ae18099863 100644
--- a/crypto/testmgr.h
+++ b/crypto/testmgr.h
@@ -656,6 +656,59 @@ static struct hash_testvec sha512_tv_template[] = {
},
};
+#define CMAC_AES_TEST_VECTORS 4
+
+static struct hash_testvec cmac_aes_tv_template[] = {
+ {
+ .key = "\x2b\x7e\x15\x16\x28\xae\xd2\xa6"
+ "\xab\xf7\x15\x88\x09\xcf\x4f\x3c",
+ .ksize = 16,
+ .plaintext = "",
+ .psize = 0,
+ .digest = "\xbb\x1d\x69\x29\xe9\x59\x37\x28"
+ "\x7f\xa3\x7d\x12\x9b\x75\x67\x46",
+ },
+ {
+ .key = "\x2b\x7e\x15\x16\x28\xae\xd2\xa6"
+ "\xab\xf7\x15\x88\x09\xcf\x4f\x3c",
+ .ksize = 16,
+ .plaintext = "\x6b\xc1\xbe\xe2\x2e\x40\x9f\x96"
+ "\xe9\x3d\x7e\x11\x73\x93\x17\x2a",
+ .psize = 16,
+ .digest = "\x07\x0a\x16\xb4\x6b\x4d\x41\x44"
+ "\xf7\x9b\xdd\x9d\xd0\x4a\x28\x7c",
+ },
+ {
+ .key = "\x2b\x7e\x15\x16\x28\xae\xd2\xa6"
+ "\xab\xf7\x15\x88\x09\xcf\x4f\x3c",
+ .ksize = 16,
+ .plaintext = "\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",
+ .psize = 40,
+ .digest = "\xdf\xa6\x67\x47\xde\x9a\xe6\x30"
+ "\x30\xca\x32\x61\x14\x97\xc8\x27",
+ },
+ {
+ .key = "\x2b\x7e\x15\x16\x28\xae\xd2\xa6"
+ "\xab\xf7\x15\x88\x09\xcf\x4f\x3c",
+ .ksize = 16,
+ .plaintext = "\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",
+ .psize = 64,
+ .digest = "\x51\xf0\xbe\xbf\x7e\x3b\x9d\x92"
+ "\xfc\x49\x74\x17\x79\x36\x3c\xfe",
+ },
+
+};
/*
* WHIRLPOOL test vectors from Whirlpool package
@@ -2980,8 +3033,8 @@ static struct cipher_testvec cast6_dec_tv_template[] = {
#define AES_XTS_DEC_TEST_VECTORS 5
#define AES_CTR_ENC_TEST_VECTORS 3
#define AES_CTR_DEC_TEST_VECTORS 3
-#define AES_OFB_ENC_TEST_VECTORS 1
-#define AES_OFB_DEC_TEST_VECTORS 1
+#define AES_OFB_ENC_TEST_VECTORS 3
+#define AES_OFB_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
@@ -4574,6 +4627,164 @@ static struct cipher_testvec aes_ctr_dec_tv_template[] = {
}
};
+static struct cipher_testvec aes_ofb_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 = "\x00\x01\x02\x03\x04\x05\x06\x07"
+ "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f",
+ .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 = "\x3B\x3F\xD9\x2E\xB7\x2D\xAD\x20"
+ "\x33\x34\x49\xF8\xE8\x3C\xFB\x4A"
+ "\x77\x89\x50\x8D\x16\x91\x8F\x03"
+ "\xF5\x3C\x52\xDA\xC5\x4E\xD8\x25"
+ "\x97\x40\x05\x1E\x9C\x5F\xEC\xF6"
+ "\x43\x44\xF7\xA8\x22\x60\xED\xCC"
+ "\x30\x4C\x65\x28\xF6\x59\xC7\x78"
+ "\x66\xA5\x10\xD9\xC1\xD6\xAE\x5E",
+ .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 = "\x00\x01\x02\x03\x04\x05\x06\x07"
+ "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f",
+ .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 = "\xCD\xC8\x0D\x6F\xDD\xF1\x8C\xAB"
+ "\x34\xC2\x59\x09\xC9\x9A\x41\x74"
+ "\xFC\xC2\x8B\x8D\x4C\x63\x83\x7C"
+ "\x09\xE8\x17\x00\xC1\x10\x04\x01"
+ "\x8D\x9A\x9A\xEA\xC0\xF6\x59\x6F"
+ "\x55\x9C\x6D\x4D\xAF\x59\xA5\xF2"
+ "\x6D\x9F\x20\x08\x57\xCA\x6C\x3E"
+ "\x9C\xAC\x52\x4B\xD9\xAC\xC9\x2A",
+ .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 = "\x00\x01\x02\x03\x04\x05\x06\x07"
+ "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f",
+ .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 = "\xDC\x7E\x84\xBF\xDA\x79\x16\x4B"
+ "\x7E\xCD\x84\x86\x98\x5D\x38\x60"
+ "\x4F\xEB\xDC\x67\x40\xD2\x0B\x3A"
+ "\xC8\x8F\x6A\xD8\x2A\x4F\xB0\x8D"
+ "\x71\xAB\x47\xA0\x86\xE8\x6E\xED"
+ "\xF3\x9D\x1C\x5B\xBA\x97\xC4\x08"
+ "\x01\x26\x14\x1D\x67\xF3\x7B\xE8"
+ "\x53\x8F\x5A\x8B\xE7\x40\xE4\x84",
+ .rlen = 64,
+ }
+};
+
+static struct cipher_testvec aes_ofb_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 = "\x00\x01\x02\x03\x04\x05\x06\x07"
+ "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f",
+ .input = "\x3B\x3F\xD9\x2E\xB7\x2D\xAD\x20"
+ "\x33\x34\x49\xF8\xE8\x3C\xFB\x4A"
+ "\x77\x89\x50\x8D\x16\x91\x8F\x03"
+ "\xF5\x3C\x52\xDA\xC5\x4E\xD8\x25"
+ "\x97\x40\x05\x1E\x9C\x5F\xEC\xF6"
+ "\x43\x44\xF7\xA8\x22\x60\xED\xCC"
+ "\x30\x4C\x65\x28\xF6\x59\xC7\x78"
+ "\x66\xA5\x10\xD9\xC1\xD6\xAE\x5E",
+ .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 = "\x00\x01\x02\x03\x04\x05\x06\x07"
+ "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f",
+ .input = "\xCD\xC8\x0D\x6F\xDD\xF1\x8C\xAB"
+ "\x34\xC2\x59\x09\xC9\x9A\x41\x74"
+ "\xFC\xC2\x8B\x8D\x4C\x63\x83\x7C"
+ "\x09\xE8\x17\x00\xC1\x10\x04\x01"
+ "\x8D\x9A\x9A\xEA\xC0\xF6\x59\x6F"
+ "\x55\x9C\x6D\x4D\xAF\x59\xA5\xF2"
+ "\x6D\x9F\x20\x08\x57\xCA\x6C\x3E"
+ "\x9C\xAC\x52\x4B\xD9\xAC\xC9\x2A",
+ .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 = "\x00\x01\x02\x03\x04\x05\x06\x07"
+ "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f",
+ .input = "\xDC\x7E\x84\xBF\xDA\x79\x16\x4B"
+ "\x7E\xCD\x84\x86\x98\x5D\x38\x60"
+ "\x4F\xEB\xDC\x67\x40\xD2\x0B\x3A"
+ "\xC8\x8F\x6A\xD8\x2A\x4F\xB0\x8D"
+ "\x71\xAB\x47\xA0\x86\xE8\x6E\xED"
+ "\xF3\x9D\x1C\x5B\xBA\x97\xC4\x08"
+ "\x01\x26\x14\x1D\x67\xF3\x7B\xE8"
+ "\x53\x8F\x5A\x8B\xE7\x40\xE4\x84",
+ .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"