mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
tests/sys_crypto: add remaining tests from RFC 3610
Taken from pycrypto tests input
This commit is contained in:
parent
1e7242ac82
commit
d61f3c23ca
@ -19,6 +19,7 @@ BOARD_BLACKLIST += z1
|
||||
|
||||
BOARD_INSUFFICIENT_MEMORY += nucleo-f031k6
|
||||
BOARD_INSUFFICIENT_MEMORY += nucleo-f042k6
|
||||
BOARD_INSUFFICIENT_MEMORY += nucleo-l031k6
|
||||
|
||||
USEMODULE += embunit
|
||||
|
||||
|
@ -77,6 +77,668 @@ static const uint8_t TEST_RFC_2_EXPECTED[] = {
|
||||
};
|
||||
static const size_t TEST_RFC_2_EXPECTED_LEN = 40;
|
||||
|
||||
/* RFC3610 Packet Vector #3 */
|
||||
static const uint8_t TEST_RFC_3_KEY[] = {
|
||||
0xC0, 0xC1, 0xC2, 0xC3, 0xC4, 0xC5, 0xC6, 0xC7,
|
||||
0xC8, 0xC9, 0xCA, 0xCB, 0xCC, 0xCD, 0xCE, 0xCF,
|
||||
};
|
||||
static const size_t TEST_RFC_3_KEY_LEN = 16;
|
||||
static const uint8_t TEST_RFC_3_NONCE[] = {
|
||||
0x00, 0x00, 0x00, 0x05, 0x04, 0x03, 0x02, 0xA0,
|
||||
0xA1, 0xA2, 0xA3, 0xA4, 0xA5,
|
||||
};
|
||||
static const size_t TEST_RFC_3_NONCE_LEN = 13;
|
||||
static const size_t TEST_RFC_3_MAC_LEN = 8;
|
||||
static const uint8_t TEST_RFC_3_INPUT[] = {
|
||||
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
|
||||
0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F,
|
||||
0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
|
||||
0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F,
|
||||
0x20,
|
||||
};
|
||||
static const size_t TEST_RFC_3_INPUT_LEN = 25;
|
||||
static const size_t TEST_RFC_3_ADATA_LEN = 8;
|
||||
static const uint8_t TEST_RFC_3_EXPECTED[] = {
|
||||
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
|
||||
0x51, 0xB1, 0xE5, 0xF4, 0x4A, 0x19, 0x7D, 0x1D,
|
||||
0xA4, 0x6B, 0x0F, 0x8E, 0x2D, 0x28, 0x2A, 0xE8,
|
||||
0x71, 0xE8, 0x38, 0xBB, 0x64, 0xDA, 0x85, 0x96,
|
||||
0x57, 0x4A, 0xDA, 0xA7, 0x6F, 0xBD, 0x9F, 0xB0,
|
||||
0xC5,
|
||||
};
|
||||
static const size_t TEST_RFC_3_EXPECTED_LEN = 41;
|
||||
|
||||
/* RFC3610 Packet Vector #4 */
|
||||
static const uint8_t TEST_RFC_4_KEY[] = {
|
||||
0xC0, 0xC1, 0xC2, 0xC3, 0xC4, 0xC5, 0xC6, 0xC7,
|
||||
0xC8, 0xC9, 0xCA, 0xCB, 0xCC, 0xCD, 0xCE, 0xCF,
|
||||
};
|
||||
static const uint8_t TEST_RFC_4_KEY_LEN = 16;
|
||||
static const uint8_t TEST_RFC_4_NONCE[] = {
|
||||
0x00, 0x00, 0x00, 0x06, 0x05, 0x04, 0x03, 0xA0,
|
||||
0xA1, 0xA2, 0xA3, 0xA4, 0xA5,
|
||||
};
|
||||
static const uint8_t TEST_RFC_4_NONCE_LEN = 13;
|
||||
static const uint8_t TEST_RFC_4_MAC_LEN = 8;
|
||||
static const uint8_t TEST_RFC_4_INPUT[] = {
|
||||
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
|
||||
0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F,
|
||||
0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
|
||||
0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E,
|
||||
};
|
||||
static const size_t TEST_RFC_4_INPUT_LEN = 19;
|
||||
static const size_t TEST_RFC_4_ADATA_LEN = 12;
|
||||
static const uint8_t TEST_RFC_4_EXPECTED[] = {
|
||||
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
|
||||
0x08, 0x09, 0x0A, 0x0B, 0xA2, 0x8C, 0x68, 0x65,
|
||||
0x93, 0x9A, 0x9A, 0x79, 0xFA, 0xAA, 0x5C, 0x4C,
|
||||
0x2A, 0x9D, 0x4A, 0x91, 0xCD, 0xAC, 0x8C, 0x96,
|
||||
0xC8, 0x61, 0xB9, 0xC9, 0xE6, 0x1E, 0xF1,
|
||||
};
|
||||
static const size_t TEST_RFC_4_EXPECTED_LEN = 39;
|
||||
|
||||
/* RFC3610 Packet Vector #5 */
|
||||
static const uint8_t TEST_RFC_5_KEY[] = {
|
||||
0xC0, 0xC1, 0xC2, 0xC3, 0xC4, 0xC5, 0xC6, 0xC7,
|
||||
0xC8, 0xC9, 0xCA, 0xCB, 0xCC, 0xCD, 0xCE, 0xCF,
|
||||
};
|
||||
static const uint8_t TEST_RFC_5_KEY_LEN = 16;
|
||||
static const uint8_t TEST_RFC_5_NONCE[] = {
|
||||
0x00, 0x00, 0x00, 0x07, 0x06, 0x05, 0x04, 0xA0,
|
||||
0xA1, 0xA2, 0xA3, 0xA4, 0xA5,
|
||||
};
|
||||
static const uint8_t TEST_RFC_5_NONCE_LEN = 13;
|
||||
static const uint8_t TEST_RFC_5_MAC_LEN = 8;
|
||||
static const uint8_t TEST_RFC_5_INPUT[] = {
|
||||
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
|
||||
0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F,
|
||||
0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
|
||||
0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F,
|
||||
};
|
||||
static const size_t TEST_RFC_5_INPUT_LEN = 20;
|
||||
static const size_t TEST_RFC_5_ADATA_LEN = 12;
|
||||
static const uint8_t TEST_RFC_5_EXPECTED[] = {
|
||||
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
|
||||
0x08, 0x09, 0x0A, 0x0B, 0xDC, 0xF1, 0xFB, 0x7B,
|
||||
0x5D, 0x9E, 0x23, 0xFB, 0x9D, 0x4E, 0x13, 0x12,
|
||||
0x53, 0x65, 0x8A, 0xD8, 0x6E, 0xBD, 0xCA, 0x3E,
|
||||
0x51, 0xE8, 0x3F, 0x07, 0x7D, 0x9C, 0x2D, 0x93,
|
||||
};
|
||||
static const size_t TEST_RFC_5_EXPECTED_LEN = 40;
|
||||
|
||||
/* RFC3610 Packet Vector #6 */
|
||||
static const uint8_t TEST_RFC_6_KEY[] = {
|
||||
0xC0, 0xC1, 0xC2, 0xC3, 0xC4, 0xC5, 0xC6, 0xC7,
|
||||
0xC8, 0xC9, 0xCA, 0xCB, 0xCC, 0xCD, 0xCE, 0xCF,
|
||||
};
|
||||
static const uint8_t TEST_RFC_6_KEY_LEN = 16;
|
||||
static const uint8_t TEST_RFC_6_NONCE[] = {
|
||||
0x00, 0x00, 0x00, 0x08, 0x07, 0x06, 0x05, 0xA0,
|
||||
0xA1, 0xA2, 0xA3, 0xA4, 0xA5,
|
||||
};
|
||||
static const uint8_t TEST_RFC_6_NONCE_LEN = 13;
|
||||
static const uint8_t TEST_RFC_6_MAC_LEN = 8;
|
||||
static const uint8_t TEST_RFC_6_INPUT[] = {
|
||||
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
|
||||
0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F,
|
||||
0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
|
||||
0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F,
|
||||
0x20,
|
||||
};
|
||||
static const size_t TEST_RFC_6_INPUT_LEN = 21;
|
||||
static const size_t TEST_RFC_6_ADATA_LEN = 12;
|
||||
static const uint8_t TEST_RFC_6_EXPECTED[] = {
|
||||
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
|
||||
0x08, 0x09, 0x0A, 0x0B, 0x6F, 0xC1, 0xB0, 0x11,
|
||||
0xF0, 0x06, 0x56, 0x8B, 0x51, 0x71, 0xA4, 0x2D,
|
||||
0x95, 0x3D, 0x46, 0x9B, 0x25, 0x70, 0xA4, 0xBD,
|
||||
0x87, 0x40, 0x5A, 0x04, 0x43, 0xAC, 0x91, 0xCB,
|
||||
0x94,
|
||||
};
|
||||
static const size_t TEST_RFC_6_EXPECTED_LEN = 41;
|
||||
|
||||
/* RFC3610 Packet Vector #7 */
|
||||
static const uint8_t TEST_RFC_7_KEY[] = {
|
||||
0xC0, 0xC1, 0xC2, 0xC3, 0xC4, 0xC5, 0xC6, 0xC7,
|
||||
0xC8, 0xC9, 0xCA, 0xCB, 0xCC, 0xCD, 0xCE, 0xCF,
|
||||
};
|
||||
static const uint8_t TEST_RFC_7_KEY_LEN = 16;
|
||||
static const uint8_t TEST_RFC_7_NONCE[] = {
|
||||
0x00, 0x00, 0x00, 0x09, 0x08, 0x07, 0x06, 0xA0,
|
||||
0xA1, 0xA2, 0xA3, 0xA4, 0xA5,
|
||||
};
|
||||
static const uint8_t TEST_RFC_7_NONCE_LEN = 13;
|
||||
static const uint8_t TEST_RFC_7_MAC_LEN = 10;
|
||||
static const uint8_t TEST_RFC_7_INPUT[] = {
|
||||
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
|
||||
0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F,
|
||||
0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
|
||||
0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E,
|
||||
};
|
||||
static const size_t TEST_RFC_7_INPUT_LEN = 23;
|
||||
static const size_t TEST_RFC_7_ADATA_LEN = 8;
|
||||
static const uint8_t TEST_RFC_7_EXPECTED[] = {
|
||||
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
|
||||
0x01, 0x35, 0xD1, 0xB2, 0xC9, 0x5F, 0x41, 0xD5,
|
||||
0xD1, 0xD4, 0xFE, 0xC1, 0x85, 0xD1, 0x66, 0xB8,
|
||||
0x09, 0x4E, 0x99, 0x9D, 0xFE, 0xD9, 0x6C, 0x04,
|
||||
0x8C, 0x56, 0x60, 0x2C, 0x97, 0xAC, 0xBB, 0x74,
|
||||
0x90,
|
||||
};
|
||||
static const size_t TEST_RFC_7_EXPECTED_LEN = 41;
|
||||
|
||||
/* RFC3610 Packet Vector #8 */
|
||||
static const uint8_t TEST_RFC_8_KEY[] = {
|
||||
0xC0, 0xC1, 0xC2, 0xC3, 0xC4, 0xC5, 0xC6, 0xC7,
|
||||
0xC8, 0xC9, 0xCA, 0xCB, 0xCC, 0xCD, 0xCE, 0xCF,
|
||||
};
|
||||
static const uint8_t TEST_RFC_8_KEY_LEN = 16;
|
||||
static const uint8_t TEST_RFC_8_NONCE[] = {
|
||||
0x00, 0x00, 0x00, 0x0A, 0x09, 0x08, 0x07, 0xA0,
|
||||
0xA1, 0xA2, 0xA3, 0xA4, 0xA5,
|
||||
};
|
||||
static const uint8_t TEST_RFC_8_NONCE_LEN = 13;
|
||||
static const uint8_t TEST_RFC_8_MAC_LEN = 10;
|
||||
static const uint8_t TEST_RFC_8_INPUT[] = {
|
||||
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
|
||||
0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F,
|
||||
0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
|
||||
0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F,
|
||||
};
|
||||
static const size_t TEST_RFC_8_INPUT_LEN = 24;
|
||||
static const size_t TEST_RFC_8_ADATA_LEN = 8;
|
||||
static const uint8_t TEST_RFC_8_EXPECTED[] = {
|
||||
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
|
||||
0x7B, 0x75, 0x39, 0x9A, 0xC0, 0x83, 0x1D, 0xD2,
|
||||
0xF0, 0xBB, 0xD7, 0x58, 0x79, 0xA2, 0xFD, 0x8F,
|
||||
0x6C, 0xAE, 0x6B, 0x6C, 0xD9, 0xB7, 0xDB, 0x24,
|
||||
0xC1, 0x7B, 0x44, 0x33, 0xF4, 0x34, 0x96, 0x3F,
|
||||
0x34, 0xB4,
|
||||
};
|
||||
static const size_t TEST_RFC_8_EXPECTED_LEN = 42;
|
||||
|
||||
/* RFC3610 Packet Vector #9 */
|
||||
static const uint8_t TEST_RFC_9_KEY[] = {
|
||||
0xC0, 0xC1, 0xC2, 0xC3, 0xC4, 0xC5, 0xC6, 0xC7,
|
||||
0xC8, 0xC9, 0xCA, 0xCB, 0xCC, 0xCD, 0xCE, 0xCF,
|
||||
};
|
||||
static const uint8_t TEST_RFC_9_KEY_LEN = 16;
|
||||
static const uint8_t TEST_RFC_9_NONCE[] = {
|
||||
0x00, 0x00, 0x00, 0x0B, 0x0A, 0x09, 0x08, 0xA0,
|
||||
0xA1, 0xA2, 0xA3, 0xA4, 0xA5,
|
||||
};
|
||||
static const uint8_t TEST_RFC_9_NONCE_LEN = 13;
|
||||
static const uint8_t TEST_RFC_9_MAC_LEN = 10;
|
||||
static const uint8_t TEST_RFC_9_INPUT[] = {
|
||||
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
|
||||
0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F,
|
||||
0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
|
||||
0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F,
|
||||
0x20,
|
||||
};
|
||||
static const size_t TEST_RFC_9_INPUT_LEN = 25;
|
||||
static const size_t TEST_RFC_9_ADATA_LEN = 8;
|
||||
static const uint8_t TEST_RFC_9_EXPECTED[] = {
|
||||
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
|
||||
0x82, 0x53, 0x1A, 0x60, 0xCC, 0x24, 0x94, 0x5A,
|
||||
0x4B, 0x82, 0x79, 0x18, 0x1A, 0xB5, 0xC8, 0x4D,
|
||||
0xF2, 0x1C, 0xE7, 0xF9, 0xB7, 0x3F, 0x42, 0xE1,
|
||||
0x97, 0xEA, 0x9C, 0x07, 0xE5, 0x6B, 0x5E, 0xB1,
|
||||
0x7E, 0x5F, 0x4E,
|
||||
};
|
||||
static const size_t TEST_RFC_9_EXPECTED_LEN = 43;
|
||||
|
||||
/* RFC3610 Packet Vector #10 */
|
||||
static const uint8_t TEST_RFC_10_KEY[] = {
|
||||
0xC0, 0xC1, 0xC2, 0xC3, 0xC4, 0xC5, 0xC6, 0xC7,
|
||||
0xC8, 0xC9, 0xCA, 0xCB, 0xCC, 0xCD, 0xCE, 0xCF,
|
||||
};
|
||||
static const uint8_t TEST_RFC_10_KEY_LEN = 16;
|
||||
static const uint8_t TEST_RFC_10_NONCE[] = {
|
||||
0x00, 0x00, 0x00, 0x0C, 0x0B, 0x0A, 0x09, 0xA0,
|
||||
0xA1, 0xA2, 0xA3, 0xA4, 0xA5,
|
||||
};
|
||||
static const uint8_t TEST_RFC_10_NONCE_LEN = 13;
|
||||
static const uint8_t TEST_RFC_10_MAC_LEN = 10;
|
||||
static const uint8_t TEST_RFC_10_INPUT[] = {
|
||||
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
|
||||
0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F,
|
||||
0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
|
||||
0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E,
|
||||
};
|
||||
static const size_t TEST_RFC_10_INPUT_LEN = 19;
|
||||
static const size_t TEST_RFC_10_ADATA_LEN = 12;
|
||||
static const uint8_t TEST_RFC_10_EXPECTED[] = {
|
||||
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
|
||||
0x08, 0x09, 0x0A, 0x0B, 0x07, 0x34, 0x25, 0x94,
|
||||
0x15, 0x77, 0x85, 0x15, 0x2B, 0x07, 0x40, 0x98,
|
||||
0x33, 0x0A, 0xBB, 0x14, 0x1B, 0x94, 0x7B, 0x56,
|
||||
0x6A, 0xA9, 0x40, 0x6B, 0x4D, 0x99, 0x99, 0x88,
|
||||
0xDD,
|
||||
};
|
||||
static const size_t TEST_RFC_10_EXPECTED_LEN = 41;
|
||||
|
||||
/* RFC3610 Packet Vector #11 */
|
||||
static const uint8_t TEST_RFC_11_KEY[] = {
|
||||
0xC0, 0xC1, 0xC2, 0xC3, 0xC4, 0xC5, 0xC6, 0xC7,
|
||||
0xC8, 0xC9, 0xCA, 0xCB, 0xCC, 0xCD, 0xCE, 0xCF,
|
||||
};
|
||||
static const uint8_t TEST_RFC_11_KEY_LEN = 16;
|
||||
static const uint8_t TEST_RFC_11_NONCE[] = {
|
||||
0x00, 0x00, 0x00, 0x0D, 0x0C, 0x0B, 0x0A, 0xA0,
|
||||
0xA1, 0xA2, 0xA3, 0xA4, 0xA5,
|
||||
};
|
||||
static const uint8_t TEST_RFC_11_NONCE_LEN = 13;
|
||||
static const uint8_t TEST_RFC_11_MAC_LEN = 10;
|
||||
static const uint8_t TEST_RFC_11_INPUT[] = {
|
||||
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
|
||||
0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F,
|
||||
0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
|
||||
0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F,
|
||||
};
|
||||
static const size_t TEST_RFC_11_INPUT_LEN = 20;
|
||||
static const size_t TEST_RFC_11_ADATA_LEN = 12;
|
||||
static const uint8_t TEST_RFC_11_EXPECTED[] = {
|
||||
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
|
||||
0x08, 0x09, 0x0A, 0x0B, 0x67, 0x6B, 0xB2, 0x03,
|
||||
0x80, 0xB0, 0xE3, 0x01, 0xE8, 0xAB, 0x79, 0x59,
|
||||
0x0A, 0x39, 0x6D, 0xA7, 0x8B, 0x83, 0x49, 0x34,
|
||||
0xF5, 0x3A, 0xA2, 0xE9, 0x10, 0x7A, 0x8B, 0x6C,
|
||||
0x02, 0x2C,
|
||||
};
|
||||
static const size_t TEST_RFC_11_EXPECTED_LEN = 42;
|
||||
|
||||
/* RFC3610 Packet Vector #12 */
|
||||
static const uint8_t TEST_RFC_12_KEY[] = {
|
||||
0xC0, 0xC1, 0xC2, 0xC3, 0xC4, 0xC5, 0xC6, 0xC7,
|
||||
0xC8, 0xC9, 0xCA, 0xCB, 0xCC, 0xCD, 0xCE, 0xCF,
|
||||
};
|
||||
static const uint8_t TEST_RFC_12_KEY_LEN = 16;
|
||||
static const uint8_t TEST_RFC_12_NONCE[] = {
|
||||
0x00, 0x00, 0x00, 0x0E, 0x0D, 0x0C, 0x0B, 0xA0,
|
||||
0xA1, 0xA2, 0xA3, 0xA4, 0xA5,
|
||||
};
|
||||
static const uint8_t TEST_RFC_12_NONCE_LEN = 13;
|
||||
static const uint8_t TEST_RFC_12_MAC_LEN = 10;
|
||||
static const uint8_t TEST_RFC_12_INPUT[] = {
|
||||
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
|
||||
0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F,
|
||||
0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
|
||||
0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F,
|
||||
0x20,
|
||||
};
|
||||
static const size_t TEST_RFC_12_INPUT_LEN = 21;
|
||||
static const size_t TEST_RFC_12_ADATA_LEN = 12;
|
||||
static const uint8_t TEST_RFC_12_EXPECTED[] = {
|
||||
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
|
||||
0x08, 0x09, 0x0A, 0x0B, 0xC0, 0xFF, 0xA0, 0xD6,
|
||||
0xF0, 0x5B, 0xDB, 0x67, 0xF2, 0x4D, 0x43, 0xA4,
|
||||
0x33, 0x8D, 0x2A, 0xA4, 0xBE, 0xD7, 0xB2, 0x0E,
|
||||
0x43, 0xCD, 0x1A, 0xA3, 0x16, 0x62, 0xE7, 0xAD,
|
||||
0x65, 0xD6, 0xDB,
|
||||
};
|
||||
static const size_t TEST_RFC_12_EXPECTED_LEN = 43;
|
||||
|
||||
/* RFC3610 Packet Vector #13 */
|
||||
static const uint8_t TEST_RFC_13_KEY[] = {
|
||||
0xD7, 0x82, 0x8D, 0x13, 0xB2, 0xB0, 0xBD, 0xC3,
|
||||
0x25, 0xA7, 0x62, 0x36, 0xDF, 0x93, 0xCC, 0x6B,
|
||||
};
|
||||
static const uint8_t TEST_RFC_13_KEY_LEN = 16;
|
||||
static const uint8_t TEST_RFC_13_NONCE[] = {
|
||||
0x00, 0x41, 0x2B, 0x4E, 0xA9, 0xCD, 0xBE, 0x3C,
|
||||
0x96, 0x96, 0x76, 0x6C, 0xFA,
|
||||
};
|
||||
static const uint8_t TEST_RFC_13_NONCE_LEN = 13;
|
||||
static const uint8_t TEST_RFC_13_MAC_LEN = 8;
|
||||
static const uint8_t TEST_RFC_13_INPUT[] = {
|
||||
0x0B, 0xE1, 0xA8, 0x8B, 0xAC, 0xE0, 0x18, 0xB1,
|
||||
0x08, 0xE8, 0xCF, 0x97, 0xD8, 0x20, 0xEA, 0x25,
|
||||
0x84, 0x60, 0xE9, 0x6A, 0xD9, 0xCF, 0x52, 0x89,
|
||||
0x05, 0x4D, 0x89, 0x5C, 0xEA, 0xC4, 0x7C,
|
||||
};
|
||||
static const size_t TEST_RFC_13_INPUT_LEN = 23;
|
||||
static const size_t TEST_RFC_13_ADATA_LEN = 8;
|
||||
static const uint8_t TEST_RFC_13_EXPECTED[] = {
|
||||
0x0B, 0xE1, 0xA8, 0x8B, 0xAC, 0xE0, 0x18, 0xB1,
|
||||
0x4C, 0xB9, 0x7F, 0x86, 0xA2, 0xA4, 0x68, 0x9A,
|
||||
0x87, 0x79, 0x47, 0xAB, 0x80, 0x91, 0xEF, 0x53,
|
||||
0x86, 0xA6, 0xFF, 0xBD, 0xD0, 0x80, 0xF8, 0xE7,
|
||||
0x8C, 0xF7, 0xCB, 0x0C, 0xDD, 0xD7, 0xB3,
|
||||
};
|
||||
static const size_t TEST_RFC_13_EXPECTED_LEN = 39;
|
||||
|
||||
/* RFC3610 Packet Vector #14 */
|
||||
static const uint8_t TEST_RFC_14_KEY[] = {
|
||||
0xD7, 0x82, 0x8D, 0x13, 0xB2, 0xB0, 0xBD, 0xC3,
|
||||
0x25, 0xA7, 0x62, 0x36, 0xDF, 0x93, 0xCC, 0x6B,
|
||||
};
|
||||
static const uint8_t TEST_RFC_14_KEY_LEN = 16;
|
||||
static const uint8_t TEST_RFC_14_NONCE[] = {
|
||||
0x00, 0x33, 0x56, 0x8E, 0xF7, 0xB2, 0x63, 0x3C,
|
||||
0x96, 0x96, 0x76, 0x6C, 0xFA,
|
||||
};
|
||||
static const uint8_t TEST_RFC_14_NONCE_LEN = 13;
|
||||
static const uint8_t TEST_RFC_14_MAC_LEN = 8;
|
||||
static const uint8_t TEST_RFC_14_INPUT[] = {
|
||||
0x63, 0x01, 0x8F, 0x76, 0xDC, 0x8A, 0x1B, 0xCB,
|
||||
0x90, 0x20, 0xEA, 0x6F, 0x91, 0xBD, 0xD8, 0x5A,
|
||||
0xFA, 0x00, 0x39, 0xBA, 0x4B, 0xAF, 0xF9, 0xBF,
|
||||
0xB7, 0x9C, 0x70, 0x28, 0x94, 0x9C, 0xD0, 0xEC,
|
||||
};
|
||||
static const size_t TEST_RFC_14_INPUT_LEN = 24;
|
||||
static const size_t TEST_RFC_14_ADATA_LEN = 8;
|
||||
static const uint8_t TEST_RFC_14_EXPECTED[] = {
|
||||
0x63, 0x01, 0x8F, 0x76, 0xDC, 0x8A, 0x1B, 0xCB,
|
||||
0x4C, 0xCB, 0x1E, 0x7C, 0xA9, 0x81, 0xBE, 0xFA,
|
||||
0xA0, 0x72, 0x6C, 0x55, 0xD3, 0x78, 0x06, 0x12,
|
||||
0x98, 0xC8, 0x5C, 0x92, 0x81, 0x4A, 0xBC, 0x33,
|
||||
0xC5, 0x2E, 0xE8, 0x1D, 0x7D, 0x77, 0xC0, 0x8A,
|
||||
};
|
||||
static const size_t TEST_RFC_14_EXPECTED_LEN = 40;
|
||||
|
||||
/* RFC3610 Packet Vector #15 */
|
||||
static const uint8_t TEST_RFC_15_KEY[] = {
|
||||
0xD7, 0x82, 0x8D, 0x13, 0xB2, 0xB0, 0xBD, 0xC3,
|
||||
0x25, 0xA7, 0x62, 0x36, 0xDF, 0x93, 0xCC, 0x6B,
|
||||
};
|
||||
static const uint8_t TEST_RFC_15_KEY_LEN = 16;
|
||||
static const uint8_t TEST_RFC_15_NONCE[] = {
|
||||
0x00, 0x10, 0x3F, 0xE4, 0x13, 0x36, 0x71, 0x3C,
|
||||
0x96, 0x96, 0x76, 0x6C, 0xFA,
|
||||
};
|
||||
static const uint8_t TEST_RFC_15_NONCE_LEN = 13;
|
||||
static const uint8_t TEST_RFC_15_MAC_LEN = 8;
|
||||
static const uint8_t TEST_RFC_15_INPUT[] = {
|
||||
0xAA, 0x6C, 0xFA, 0x36, 0xCA, 0xE8, 0x6B, 0x40,
|
||||
0xB9, 0x16, 0xE0, 0xEA, 0xCC, 0x1C, 0x00, 0xD7,
|
||||
0xDC, 0xEC, 0x68, 0xEC, 0x0B, 0x3B, 0xBB, 0x1A,
|
||||
0x02, 0xDE, 0x8A, 0x2D, 0x1A, 0xA3, 0x46, 0x13,
|
||||
0x2E,
|
||||
};
|
||||
static const size_t TEST_RFC_15_INPUT_LEN = 25;
|
||||
static const size_t TEST_RFC_15_ADATA_LEN = 8;
|
||||
static const uint8_t TEST_RFC_15_EXPECTED[] = {
|
||||
0xAA, 0x6C, 0xFA, 0x36, 0xCA, 0xE8, 0x6B, 0x40,
|
||||
0xB1, 0xD2, 0x3A, 0x22, 0x20, 0xDD, 0xC0, 0xAC,
|
||||
0x90, 0x0D, 0x9A, 0xA0, 0x3C, 0x61, 0xFC, 0xF4,
|
||||
0xA5, 0x59, 0xA4, 0x41, 0x77, 0x67, 0x08, 0x97,
|
||||
0x08, 0xA7, 0x76, 0x79, 0x6E, 0xDB, 0x72, 0x35,
|
||||
0x06,
|
||||
};
|
||||
static const size_t TEST_RFC_15_EXPECTED_LEN = 41;
|
||||
|
||||
/* RFC3610 Packet Vector #16 */
|
||||
static const uint8_t TEST_RFC_16_KEY[] = {
|
||||
0xD7, 0x82, 0x8D, 0x13, 0xB2, 0xB0, 0xBD, 0xC3,
|
||||
0x25, 0xA7, 0x62, 0x36, 0xDF, 0x93, 0xCC, 0x6B,
|
||||
};
|
||||
static const uint8_t TEST_RFC_16_KEY_LEN = 16;
|
||||
static const uint8_t TEST_RFC_16_NONCE[] = {
|
||||
0x00, 0x76, 0x4C, 0x63, 0xB8, 0x05, 0x8E, 0x3C,
|
||||
0x96, 0x96, 0x76, 0x6C, 0xFA,
|
||||
};
|
||||
static const uint8_t TEST_RFC_16_NONCE_LEN = 13;
|
||||
static const uint8_t TEST_RFC_16_MAC_LEN = 8;
|
||||
static const uint8_t TEST_RFC_16_INPUT[] = {
|
||||
0xD0, 0xD0, 0x73, 0x5C, 0x53, 0x1E, 0x1B, 0xEC,
|
||||
0xF0, 0x49, 0xC2, 0x44, 0x12, 0xDA, 0xAC, 0x56,
|
||||
0x30, 0xEF, 0xA5, 0x39, 0x6F, 0x77, 0x0C, 0xE1,
|
||||
0xA6, 0x6B, 0x21, 0xF7, 0xB2, 0x10, 0x1C,
|
||||
};
|
||||
static const size_t TEST_RFC_16_INPUT_LEN = 19;
|
||||
static const size_t TEST_RFC_16_ADATA_LEN = 12;
|
||||
static const uint8_t TEST_RFC_16_EXPECTED[] = {
|
||||
0xD0, 0xD0, 0x73, 0x5C, 0x53, 0x1E, 0x1B, 0xEC,
|
||||
0xF0, 0x49, 0xC2, 0x44, 0x14, 0xD2, 0x53, 0xC3,
|
||||
0x96, 0x7B, 0x70, 0x60, 0x9B, 0x7C, 0xBB, 0x7C,
|
||||
0x49, 0x91, 0x60, 0x28, 0x32, 0x45, 0x26, 0x9A,
|
||||
0x6F, 0x49, 0x97, 0x5B, 0xCA, 0xDE, 0xAF,
|
||||
};
|
||||
static const size_t TEST_RFC_16_EXPECTED_LEN = 39;
|
||||
|
||||
/* RFC3610 Packet Vector #17 */
|
||||
static const uint8_t TEST_RFC_17_KEY[] = {
|
||||
0xD7, 0x82, 0x8D, 0x13, 0xB2, 0xB0, 0xBD, 0xC3,
|
||||
0x25, 0xA7, 0x62, 0x36, 0xDF, 0x93, 0xCC, 0x6B,
|
||||
};
|
||||
static const uint8_t TEST_RFC_17_KEY_LEN = 16;
|
||||
static const uint8_t TEST_RFC_17_NONCE[] = {
|
||||
0x00, 0xF8, 0xB6, 0x78, 0x09, 0x4E, 0x3B, 0x3C,
|
||||
0x96, 0x96, 0x76, 0x6C, 0xFA,
|
||||
};
|
||||
static const uint8_t TEST_RFC_17_NONCE_LEN = 13;
|
||||
static const uint8_t TEST_RFC_17_MAC_LEN = 8;
|
||||
static const uint8_t TEST_RFC_17_INPUT[] = {
|
||||
0x77, 0xB6, 0x0F, 0x01, 0x1C, 0x03, 0xE1, 0x52,
|
||||
0x58, 0x99, 0xBC, 0xAE, 0xE8, 0x8B, 0x6A, 0x46,
|
||||
0xC7, 0x8D, 0x63, 0xE5, 0x2E, 0xB8, 0xC5, 0x46,
|
||||
0xEF, 0xB5, 0xDE, 0x6F, 0x75, 0xE9, 0xCC, 0x0D,
|
||||
};
|
||||
static const size_t TEST_RFC_17_INPUT_LEN = 20;
|
||||
static const size_t TEST_RFC_17_ADATA_LEN = 12;
|
||||
static const uint8_t TEST_RFC_17_EXPECTED[] = {
|
||||
0x77, 0xB6, 0x0F, 0x01, 0x1C, 0x03, 0xE1, 0x52,
|
||||
0x58, 0x99, 0xBC, 0xAE, 0x55, 0x45, 0xFF, 0x1A,
|
||||
0x08, 0x5E, 0xE2, 0xEF, 0xBF, 0x52, 0xB2, 0xE0,
|
||||
0x4B, 0xEE, 0x1E, 0x23, 0x36, 0xC7, 0x3E, 0x3F,
|
||||
0x76, 0x2C, 0x0C, 0x77, 0x44, 0xFE, 0x7E, 0x3C,
|
||||
};
|
||||
static const size_t TEST_RFC_17_EXPECTED_LEN = 40;
|
||||
|
||||
/* RFC3610 Packet Vector #18 */
|
||||
static const uint8_t TEST_RFC_18_KEY[] = {
|
||||
0xD7, 0x82, 0x8D, 0x13, 0xB2, 0xB0, 0xBD, 0xC3,
|
||||
0x25, 0xA7, 0x62, 0x36, 0xDF, 0x93, 0xCC, 0x6B,
|
||||
};
|
||||
static const uint8_t TEST_RFC_18_KEY_LEN = 16;
|
||||
static const uint8_t TEST_RFC_18_NONCE[] = {
|
||||
0x00, 0xD5, 0x60, 0x91, 0x2D, 0x3F, 0x70, 0x3C,
|
||||
0x96, 0x96, 0x76, 0x6C, 0xFA,
|
||||
};
|
||||
static const uint8_t TEST_RFC_18_NONCE_LEN = 13;
|
||||
static const uint8_t TEST_RFC_18_MAC_LEN = 8;
|
||||
static const uint8_t TEST_RFC_18_INPUT[] = {
|
||||
0xCD, 0x90, 0x44, 0xD2, 0xB7, 0x1F, 0xDB, 0x81,
|
||||
0x20, 0xEA, 0x60, 0xC0, 0x64, 0x35, 0xAC, 0xBA,
|
||||
0xFB, 0x11, 0xA8, 0x2E, 0x2F, 0x07, 0x1D, 0x7C,
|
||||
0xA4, 0xA5, 0xEB, 0xD9, 0x3A, 0x80, 0x3B, 0xA8,
|
||||
0x7F,
|
||||
};
|
||||
static const size_t TEST_RFC_18_INPUT_LEN = 21;
|
||||
static const size_t TEST_RFC_18_ADATA_LEN = 12;
|
||||
static const uint8_t TEST_RFC_18_EXPECTED[] = {
|
||||
0xCD, 0x90, 0x44, 0xD2, 0xB7, 0x1F, 0xDB, 0x81,
|
||||
0x20, 0xEA, 0x60, 0xC0, 0x00, 0x97, 0x69, 0xEC,
|
||||
0xAB, 0xDF, 0x48, 0x62, 0x55, 0x94, 0xC5, 0x92,
|
||||
0x51, 0xE6, 0x03, 0x57, 0x22, 0x67, 0x5E, 0x04,
|
||||
0xC8, 0x47, 0x09, 0x9E, 0x5A, 0xE0, 0x70, 0x45,
|
||||
0x51,
|
||||
};
|
||||
static const size_t TEST_RFC_18_EXPECTED_LEN = 41;
|
||||
|
||||
/* RFC3610 Packet Vector #19 */
|
||||
static const uint8_t TEST_RFC_19_KEY[] = {
|
||||
0xD7, 0x82, 0x8D, 0x13, 0xB2, 0xB0, 0xBD, 0xC3,
|
||||
0x25, 0xA7, 0x62, 0x36, 0xDF, 0x93, 0xCC, 0x6B,
|
||||
};
|
||||
static const uint8_t TEST_RFC_19_KEY_LEN = 16;
|
||||
static const uint8_t TEST_RFC_19_NONCE[] = {
|
||||
0x00, 0x42, 0xFF, 0xF8, 0xF1, 0x95, 0x1C, 0x3C,
|
||||
0x96, 0x96, 0x76, 0x6C, 0xFA,
|
||||
};
|
||||
static const uint8_t TEST_RFC_19_NONCE_LEN = 13;
|
||||
static const uint8_t TEST_RFC_19_MAC_LEN = 10;
|
||||
static const uint8_t TEST_RFC_19_INPUT[] = {
|
||||
0xD8, 0x5B, 0xC7, 0xE6, 0x9F, 0x94, 0x4F, 0xB8,
|
||||
0x8A, 0x19, 0xB9, 0x50, 0xBC, 0xF7, 0x1A, 0x01,
|
||||
0x8E, 0x5E, 0x67, 0x01, 0xC9, 0x17, 0x87, 0x65,
|
||||
0x98, 0x09, 0xD6, 0x7D, 0xBE, 0xDD, 0x18,
|
||||
};
|
||||
static const size_t TEST_RFC_19_INPUT_LEN = 23;
|
||||
static const size_t TEST_RFC_19_ADATA_LEN = 8;
|
||||
static const uint8_t TEST_RFC_19_EXPECTED[] = {
|
||||
0xD8, 0x5B, 0xC7, 0xE6, 0x9F, 0x94, 0x4F, 0xB8,
|
||||
0xBC, 0x21, 0x8D, 0xAA, 0x94, 0x74, 0x27, 0xB6,
|
||||
0xDB, 0x38, 0x6A, 0x99, 0xAC, 0x1A, 0xEF, 0x23,
|
||||
0xAD, 0xE0, 0xB5, 0x29, 0x39, 0xCB, 0x6A, 0x63,
|
||||
0x7C, 0xF9, 0xBE, 0xC2, 0x40, 0x88, 0x97, 0xC6,
|
||||
0xBA,
|
||||
};
|
||||
static const size_t TEST_RFC_19_EXPECTED_LEN = 41;
|
||||
|
||||
/* RFC3610 Packet Vector #20 */
|
||||
static const uint8_t TEST_RFC_20_KEY[] = {
|
||||
0xD7, 0x82, 0x8D, 0x13, 0xB2, 0xB0, 0xBD, 0xC3,
|
||||
0x25, 0xA7, 0x62, 0x36, 0xDF, 0x93, 0xCC, 0x6B,
|
||||
};
|
||||
static const uint8_t TEST_RFC_20_KEY_LEN = 16;
|
||||
static const uint8_t TEST_RFC_20_NONCE[] = {
|
||||
0x00, 0x92, 0x0F, 0x40, 0xE5, 0x6C, 0xDC, 0x3C,
|
||||
0x96, 0x96, 0x76, 0x6C, 0xFA,
|
||||
};
|
||||
static const uint8_t TEST_RFC_20_NONCE_LEN = 13;
|
||||
static const uint8_t TEST_RFC_20_MAC_LEN = 10;
|
||||
static const uint8_t TEST_RFC_20_INPUT[] = {
|
||||
0x74, 0xA0, 0xEB, 0xC9, 0x06, 0x9F, 0x5B, 0x37,
|
||||
0x17, 0x61, 0x43, 0x3C, 0x37, 0xC5, 0xA3, 0x5F,
|
||||
0xC1, 0xF3, 0x9F, 0x40, 0x63, 0x02, 0xEB, 0x90,
|
||||
0x7C, 0x61, 0x63, 0xBE, 0x38, 0xC9, 0x84, 0x37,
|
||||
};
|
||||
static const size_t TEST_RFC_20_INPUT_LEN = 24;
|
||||
static const size_t TEST_RFC_20_ADATA_LEN = 8;
|
||||
static const uint8_t TEST_RFC_20_EXPECTED[] = {
|
||||
0x74, 0xA0, 0xEB, 0xC9, 0x06, 0x9F, 0x5B, 0x37,
|
||||
0x58, 0x10, 0xE6, 0xFD, 0x25, 0x87, 0x40, 0x22,
|
||||
0xE8, 0x03, 0x61, 0xA4, 0x78, 0xE3, 0xE9, 0xCF,
|
||||
0x48, 0x4A, 0xB0, 0x4F, 0x44, 0x7E, 0xFF, 0xF6,
|
||||
0xF0, 0xA4, 0x77, 0xCC, 0x2F, 0xC9, 0xBF, 0x54,
|
||||
0x89, 0x44,
|
||||
};
|
||||
static const size_t TEST_RFC_20_EXPECTED_LEN = 42;
|
||||
|
||||
/* RFC3610 Packet Vector #21 */
|
||||
static const uint8_t TEST_RFC_21_KEY[] = {
|
||||
0xD7, 0x82, 0x8D, 0x13, 0xB2, 0xB0, 0xBD, 0xC3,
|
||||
0x25, 0xA7, 0x62, 0x36, 0xDF, 0x93, 0xCC, 0x6B,
|
||||
};
|
||||
static const uint8_t TEST_RFC_21_KEY_LEN = 16;
|
||||
static const uint8_t TEST_RFC_21_NONCE[] = {
|
||||
0x00, 0x27, 0xCA, 0x0C, 0x71, 0x20, 0xBC, 0x3C,
|
||||
0x96, 0x96, 0x76, 0x6C, 0xFA,
|
||||
};
|
||||
static const uint8_t TEST_RFC_21_NONCE_LEN = 13;
|
||||
static const uint8_t TEST_RFC_21_MAC_LEN = 10;
|
||||
static const uint8_t TEST_RFC_21_INPUT[] = {
|
||||
0x44, 0xA3, 0xAA, 0x3A, 0xAE, 0x64, 0x75, 0xCA,
|
||||
0xA4, 0x34, 0xA8, 0xE5, 0x85, 0x00, 0xC6, 0xE4,
|
||||
0x15, 0x30, 0x53, 0x88, 0x62, 0xD6, 0x86, 0xEA,
|
||||
0x9E, 0x81, 0x30, 0x1B, 0x5A, 0xE4, 0x22, 0x6B,
|
||||
0xFA,
|
||||
};
|
||||
static const size_t TEST_RFC_21_INPUT_LEN = 25;
|
||||
static const size_t TEST_RFC_21_ADATA_LEN = 8;
|
||||
static const uint8_t TEST_RFC_21_EXPECTED[] = {
|
||||
0x44, 0xA3, 0xAA, 0x3A, 0xAE, 0x64, 0x75, 0xCA,
|
||||
0xF2, 0xBE, 0xED, 0x7B, 0xC5, 0x09, 0x8E, 0x83,
|
||||
0xFE, 0xB5, 0xB3, 0x16, 0x08, 0xF8, 0xE2, 0x9C,
|
||||
0x38, 0x81, 0x9A, 0x89, 0xC8, 0xE7, 0x76, 0xF1,
|
||||
0x54, 0x4D, 0x41, 0x51, 0xA4, 0xED, 0x3A, 0x8B,
|
||||
0x87, 0xB9, 0xCE,
|
||||
};
|
||||
static const size_t TEST_RFC_21_EXPECTED_LEN = 43;
|
||||
|
||||
/* RFC3610 Packet Vector #22 */
|
||||
static const uint8_t TEST_RFC_22_KEY[] = {
|
||||
0xD7, 0x82, 0x8D, 0x13, 0xB2, 0xB0, 0xBD, 0xC3,
|
||||
0x25, 0xA7, 0x62, 0x36, 0xDF, 0x93, 0xCC, 0x6B,
|
||||
};
|
||||
static const uint8_t TEST_RFC_22_KEY_LEN = 16;
|
||||
static const uint8_t TEST_RFC_22_NONCE[] = {
|
||||
0x00, 0x5B, 0x8C, 0xCB, 0xCD, 0x9A, 0xF8, 0x3C,
|
||||
0x96, 0x96, 0x76, 0x6C, 0xFA,
|
||||
};
|
||||
static const uint8_t TEST_RFC_22_NONCE_LEN = 13;
|
||||
static const uint8_t TEST_RFC_22_MAC_LEN = 10;
|
||||
static const uint8_t TEST_RFC_22_INPUT[] = {
|
||||
0xEC, 0x46, 0xBB, 0x63, 0xB0, 0x25, 0x20, 0xC3,
|
||||
0x3C, 0x49, 0xFD, 0x70, 0xB9, 0x6B, 0x49, 0xE2,
|
||||
0x1D, 0x62, 0x17, 0x41, 0x63, 0x28, 0x75, 0xDB,
|
||||
0x7F, 0x6C, 0x92, 0x43, 0xD2, 0xD7, 0xC2,
|
||||
};
|
||||
static const size_t TEST_RFC_22_INPUT_LEN = 19;
|
||||
static const size_t TEST_RFC_22_ADATA_LEN = 12;
|
||||
static const uint8_t TEST_RFC_22_EXPECTED[] = {
|
||||
0xEC, 0x46, 0xBB, 0x63, 0xB0, 0x25, 0x20, 0xC3,
|
||||
0x3C, 0x49, 0xFD, 0x70, 0x31, 0xD7, 0x50, 0xA0,
|
||||
0x9D, 0xA3, 0xED, 0x7F, 0xDD, 0xD4, 0x9A, 0x20,
|
||||
0x32, 0xAA, 0xBF, 0x17, 0xEC, 0x8E, 0xBF, 0x7D,
|
||||
0x22, 0xC8, 0x08, 0x8C, 0x66, 0x6B, 0xE5, 0xC1,
|
||||
0x97,
|
||||
};
|
||||
static const size_t TEST_RFC_22_EXPECTED_LEN = 41;
|
||||
|
||||
/* RFC3610 Packet Vector #23 */
|
||||
static const uint8_t TEST_RFC_23_KEY[] = {
|
||||
0xD7, 0x82, 0x8D, 0x13, 0xB2, 0xB0, 0xBD, 0xC3,
|
||||
0x25, 0xA7, 0x62, 0x36, 0xDF, 0x93, 0xCC, 0x6B,
|
||||
};
|
||||
static const uint8_t TEST_RFC_23_KEY_LEN = 16;
|
||||
static const uint8_t TEST_RFC_23_NONCE[] = {
|
||||
0x00, 0x3E, 0xBE, 0x94, 0x04, 0x4B, 0x9A, 0x3C,
|
||||
0x96, 0x96, 0x76, 0x6C, 0xFA,
|
||||
};
|
||||
static const uint8_t TEST_RFC_23_NONCE_LEN = 13;
|
||||
static const uint8_t TEST_RFC_23_MAC_LEN = 10;
|
||||
static const uint8_t TEST_RFC_23_INPUT[] = {
|
||||
0x47, 0xA6, 0x5A, 0xC7, 0x8B, 0x3D, 0x59, 0x42,
|
||||
0x27, 0xE8, 0x5E, 0x71, 0xE2, 0xFC, 0xFB, 0xB8,
|
||||
0x80, 0x44, 0x2C, 0x73, 0x1B, 0xF9, 0x51, 0x67,
|
||||
0xC8, 0xFF, 0xD7, 0x89, 0x5E, 0x33, 0x70, 0x76,
|
||||
};
|
||||
static const size_t TEST_RFC_23_INPUT_LEN = 20;
|
||||
static const size_t TEST_RFC_23_ADATA_LEN = 12;
|
||||
static const uint8_t TEST_RFC_23_EXPECTED[] = {
|
||||
0x47, 0xA6, 0x5A, 0xC7, 0x8B, 0x3D, 0x59, 0x42,
|
||||
0x27, 0xE8, 0x5E, 0x71, 0xE8, 0x82, 0xF1, 0xDB,
|
||||
0xD3, 0x8C, 0xE3, 0xED, 0xA7, 0xC2, 0x3F, 0x04,
|
||||
0xDD, 0x65, 0x07, 0x1E, 0xB4, 0x13, 0x42, 0xAC,
|
||||
0xDF, 0x7E, 0x00, 0xDC, 0xCE, 0xC7, 0xAE, 0x52,
|
||||
0x98, 0x7D,
|
||||
};
|
||||
static const size_t TEST_RFC_23_EXPECTED_LEN = 42;
|
||||
|
||||
/* RFC3610 Packet Vector #24 */
|
||||
static const uint8_t TEST_RFC_24_KEY[] = {
|
||||
0xD7, 0x82, 0x8D, 0x13, 0xB2, 0xB0, 0xBD, 0xC3,
|
||||
0x25, 0xA7, 0x62, 0x36, 0xDF, 0x93, 0xCC, 0x6B,
|
||||
};
|
||||
static const uint8_t TEST_RFC_24_KEY_LEN = 16;
|
||||
static const uint8_t TEST_RFC_24_NONCE[] = {
|
||||
0x00, 0x8D, 0x49, 0x3B, 0x30, 0xAE, 0x8B, 0x3C,
|
||||
0x96, 0x96, 0x76, 0x6C, 0xFA,
|
||||
};
|
||||
static const uint8_t TEST_RFC_24_NONCE_LEN = 13;
|
||||
static const uint8_t TEST_RFC_24_MAC_LEN = 10;
|
||||
static const uint8_t TEST_RFC_24_INPUT[] = {
|
||||
0x6E, 0x37, 0xA6, 0xEF, 0x54, 0x6D, 0x95, 0x5D,
|
||||
0x34, 0xAB, 0x60, 0x59, 0xAB, 0xF2, 0x1C, 0x0B,
|
||||
0x02, 0xFE, 0xB8, 0x8F, 0x85, 0x6D, 0xF4, 0xA3,
|
||||
0x73, 0x81, 0xBC, 0xE3, 0xCC, 0x12, 0x85, 0x17,
|
||||
0xD4,
|
||||
};
|
||||
static const size_t TEST_RFC_24_INPUT_LEN = 21;
|
||||
static const size_t TEST_RFC_24_ADATA_LEN = 12;
|
||||
static const uint8_t TEST_RFC_24_EXPECTED[] = {
|
||||
0x6E, 0x37, 0xA6, 0xEF, 0x54, 0x6D, 0x95, 0x5D,
|
||||
0x34, 0xAB, 0x60, 0x59, 0xF3, 0x29, 0x05, 0xB8,
|
||||
0x8A, 0x64, 0x1B, 0x04, 0xB9, 0xC9, 0xFF, 0xB5,
|
||||
0x8C, 0xC3, 0x90, 0x90, 0x0F, 0x3D, 0xA1, 0x2A,
|
||||
0xB1, 0x6D, 0xCE, 0x9E, 0x82, 0xEF, 0xA1, 0x6D,
|
||||
0xA6, 0x20, 0x59,
|
||||
};
|
||||
static const size_t TEST_RFC_24_EXPECTED_LEN = 43;
|
||||
|
||||
/* Share test buffer output */
|
||||
static uint8_t data[60];
|
||||
|
||||
@ -158,6 +820,28 @@ static void test_crypto_modes_ccm_encrypt(void)
|
||||
{
|
||||
do_test_encrypt_op(RFC_1);
|
||||
do_test_encrypt_op(RFC_2);
|
||||
do_test_encrypt_op(RFC_3);
|
||||
do_test_encrypt_op(RFC_4);
|
||||
do_test_encrypt_op(RFC_5);
|
||||
do_test_encrypt_op(RFC_6);
|
||||
do_test_encrypt_op(RFC_7);
|
||||
do_test_encrypt_op(RFC_8);
|
||||
do_test_encrypt_op(RFC_9);
|
||||
do_test_encrypt_op(RFC_10);
|
||||
do_test_encrypt_op(RFC_11);
|
||||
do_test_encrypt_op(RFC_12);
|
||||
do_test_encrypt_op(RFC_13);
|
||||
do_test_encrypt_op(RFC_14);
|
||||
do_test_encrypt_op(RFC_15);
|
||||
do_test_encrypt_op(RFC_16);
|
||||
do_test_encrypt_op(RFC_17);
|
||||
do_test_encrypt_op(RFC_18);
|
||||
do_test_encrypt_op(RFC_19);
|
||||
do_test_encrypt_op(RFC_20);
|
||||
do_test_encrypt_op(RFC_21);
|
||||
do_test_encrypt_op(RFC_22);
|
||||
do_test_encrypt_op(RFC_23);
|
||||
do_test_encrypt_op(RFC_24);
|
||||
}
|
||||
|
||||
#define do_test_decrypt_op(name) do { \
|
||||
@ -179,6 +863,28 @@ static void test_crypto_modes_ccm_decrypt(void)
|
||||
{
|
||||
do_test_decrypt_op(RFC_1);
|
||||
do_test_decrypt_op(RFC_2);
|
||||
do_test_decrypt_op(RFC_3);
|
||||
do_test_decrypt_op(RFC_4);
|
||||
do_test_decrypt_op(RFC_5);
|
||||
do_test_decrypt_op(RFC_6);
|
||||
do_test_decrypt_op(RFC_7);
|
||||
do_test_decrypt_op(RFC_8);
|
||||
do_test_decrypt_op(RFC_9);
|
||||
do_test_decrypt_op(RFC_10);
|
||||
do_test_decrypt_op(RFC_11);
|
||||
do_test_decrypt_op(RFC_12);
|
||||
do_test_decrypt_op(RFC_13);
|
||||
do_test_decrypt_op(RFC_14);
|
||||
do_test_decrypt_op(RFC_15);
|
||||
do_test_decrypt_op(RFC_16);
|
||||
do_test_decrypt_op(RFC_17);
|
||||
do_test_decrypt_op(RFC_18);
|
||||
do_test_decrypt_op(RFC_19);
|
||||
do_test_decrypt_op(RFC_20);
|
||||
do_test_decrypt_op(RFC_21);
|
||||
do_test_decrypt_op(RFC_22);
|
||||
do_test_decrypt_op(RFC_23);
|
||||
do_test_decrypt_op(RFC_24);
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user