cc2538: aes: Add support for 192- and 256-bit keys
Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau.dev@gmail.com>
This commit is contained in:
parent
801315e819
commit
e8a268cd15
|
@ -48,18 +48,35 @@
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
uint8_t
|
uint8_t
|
||||||
aes_load_keys(const void *keys, uint8_t count, uint8_t start_area)
|
aes_load_keys(const void *keys, uint8_t key_size, uint8_t count,
|
||||||
|
uint8_t start_area)
|
||||||
{
|
{
|
||||||
uint32_t aes_key_store_size;
|
uint32_t aes_key_store_size;
|
||||||
uint32_t areas;
|
uint32_t areas;
|
||||||
uint32_t aligned_keys[32];
|
uint64_t aligned_keys[16];
|
||||||
|
int i;
|
||||||
|
|
||||||
if(REG(AES_CTRL_ALG_SEL) != 0x00000000) {
|
if(REG(AES_CTRL_ALG_SEL) != 0x00000000) {
|
||||||
return CRYPTO_RESOURCE_IN_USE;
|
return CRYPTO_RESOURCE_IN_USE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* 192-bit keys must be padded to 256 bits */
|
||||||
|
if(key_size == AES_KEY_STORE_SIZE_KEY_SIZE_192) {
|
||||||
|
for(i = 0; i < count; i++) {
|
||||||
|
rom_util_memcpy(&aligned_keys[i << 2], &((uint64_t *)keys)[i * 3], 24);
|
||||||
|
aligned_keys[(i << 2) + 3] = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Change count to the number of 128-bit key areas */
|
||||||
|
if(key_size != AES_KEY_STORE_SIZE_KEY_SIZE_128) {
|
||||||
|
count <<= 1;
|
||||||
|
}
|
||||||
|
|
||||||
/* The keys base address needs to be 4-byte aligned */
|
/* The keys base address needs to be 4-byte aligned */
|
||||||
rom_util_memcpy(aligned_keys, keys, count << 4);
|
if(key_size != AES_KEY_STORE_SIZE_KEY_SIZE_192) {
|
||||||
|
rom_util_memcpy(aligned_keys, keys, count << 4);
|
||||||
|
}
|
||||||
|
|
||||||
/* Workaround for AES registers not retained after PM2 */
|
/* Workaround for AES registers not retained after PM2 */
|
||||||
REG(AES_CTRL_INT_CFG) = AES_CTRL_INT_CFG_LEVEL;
|
REG(AES_CTRL_INT_CFG) = AES_CTRL_INT_CFG_LEVEL;
|
||||||
|
@ -73,14 +90,12 @@ aes_load_keys(const void *keys, uint8_t count, uint8_t start_area)
|
||||||
REG(AES_CTRL_INT_CLR) = AES_CTRL_INT_CLR_DMA_IN_DONE |
|
REG(AES_CTRL_INT_CLR) = AES_CTRL_INT_CLR_DMA_IN_DONE |
|
||||||
AES_CTRL_INT_CLR_RESULT_AV;
|
AES_CTRL_INT_CLR_RESULT_AV;
|
||||||
|
|
||||||
/* Configure key store module (areas, size): 128-bit key size
|
/* Configure key store module (areas, size)
|
||||||
* Note that writing AES_KEY_STORE_SIZE deletes all stored keys */
|
* Note that writing AES_KEY_STORE_SIZE deletes all stored keys */
|
||||||
aes_key_store_size = REG(AES_KEY_STORE_SIZE);
|
aes_key_store_size = REG(AES_KEY_STORE_SIZE);
|
||||||
if((aes_key_store_size & AES_KEY_STORE_SIZE_KEY_SIZE_M) !=
|
if((aes_key_store_size & AES_KEY_STORE_SIZE_KEY_SIZE_M) != key_size) {
|
||||||
AES_KEY_STORE_SIZE_KEY_SIZE_128) {
|
|
||||||
REG(AES_KEY_STORE_SIZE) = (aes_key_store_size &
|
REG(AES_KEY_STORE_SIZE) = (aes_key_store_size &
|
||||||
~AES_KEY_STORE_SIZE_KEY_SIZE_M) |
|
~AES_KEY_STORE_SIZE_KEY_SIZE_M) | key_size;
|
||||||
AES_KEY_STORE_SIZE_KEY_SIZE_128;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Free possibly already occupied key areas */
|
/* Free possibly already occupied key areas */
|
||||||
|
|
|
@ -472,11 +472,18 @@
|
||||||
|
|
||||||
/** \brief Writes keys into the Key RAM
|
/** \brief Writes keys into the Key RAM
|
||||||
* \param keys Pointer to AES Keys
|
* \param keys Pointer to AES Keys
|
||||||
* \param count Number of keys (1 to 8 - \p start_area)
|
* \param key_size Key size: \c AES_KEY_STORE_SIZE_KEY_SIZE_x
|
||||||
* \param start_area Start area in Key RAM where to store the key (0 to 7)
|
* \param count Number of keys (1 to 8 - \p start_area for 128-bit keys, 1 to
|
||||||
|
* (8 - \p start_area) / 2 for 192- and 256-bit keys)
|
||||||
|
* \param start_area Start area in Key RAM where to store the key (0 to 7, must
|
||||||
|
* be even for 192- and 256-bit keys)
|
||||||
* \return \c CRYPTO_SUCCESS if successful, or CRYPTO/AES error code
|
* \return \c CRYPTO_SUCCESS if successful, or CRYPTO/AES error code
|
||||||
|
* \note Calling this function with a value of \p key_size different from the
|
||||||
|
* one passed for the previous calls causes the deletion of all previously
|
||||||
|
* stored keys.
|
||||||
*/
|
*/
|
||||||
uint8_t aes_load_keys(const void *keys, uint8_t count, uint8_t start_area);
|
uint8_t aes_load_keys(const void *keys, uint8_t key_size, uint8_t count,
|
||||||
|
uint8_t start_area);
|
||||||
|
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|
||||||
|
|
|
@ -99,14 +99,13 @@ ccm_auth_encrypt_start(uint8_t len_len, uint8_t key_area, const void *nonce,
|
||||||
REG(AES_AES_IV_2) = iv[2];
|
REG(AES_AES_IV_2) = iv[2];
|
||||||
REG(AES_AES_IV_3) = iv[3];
|
REG(AES_AES_IV_3) = iv[3];
|
||||||
|
|
||||||
/* Program AES-CCM-128 encryption */
|
/* Program AES-CCM encryption */
|
||||||
REG(AES_AES_CTRL) = AES_AES_CTRL_SAVE_CONTEXT | /* Save context */
|
REG(AES_AES_CTRL) = AES_AES_CTRL_SAVE_CONTEXT | /* Save context */
|
||||||
(((MAX(mic_len, 2) - 2) >> 1) << AES_AES_CTRL_CCM_M_S) | /* M */
|
(((MAX(mic_len, 2) - 2) >> 1) << AES_AES_CTRL_CCM_M_S) | /* M */
|
||||||
((len_len - 1) << AES_AES_CTRL_CCM_L_S) | /* L */
|
((len_len - 1) << AES_AES_CTRL_CCM_L_S) | /* L */
|
||||||
AES_AES_CTRL_CCM | /* CCM */
|
AES_AES_CTRL_CCM | /* CCM */
|
||||||
AES_AES_CTRL_CTR_WIDTH_128 | /* CTR width 128 */
|
AES_AES_CTRL_CTR_WIDTH_128 | /* CTR width 128 */
|
||||||
AES_AES_CTRL_CTR | /* CTR */
|
AES_AES_CTRL_CTR | /* CTR */
|
||||||
AES_AES_CTRL_KEY_SIZE_128 | /* Key = 128 */
|
|
||||||
AES_AES_CTRL_DIRECTION_ENCRYPT; /* Encryption */
|
AES_AES_CTRL_DIRECTION_ENCRYPT; /* Encryption */
|
||||||
|
|
||||||
/* Write the length of the crypto block (lo) */
|
/* Write the length of the crypto block (lo) */
|
||||||
|
@ -278,14 +277,13 @@ ccm_auth_decrypt_start(uint8_t len_len, uint8_t key_area, const void *nonce,
|
||||||
REG(AES_AES_IV_2) = iv[2];
|
REG(AES_AES_IV_2) = iv[2];
|
||||||
REG(AES_AES_IV_3) = iv[3];
|
REG(AES_AES_IV_3) = iv[3];
|
||||||
|
|
||||||
/* Program AES-CCM-128 decryption */
|
/* Program AES-CCM decryption */
|
||||||
REG(AES_AES_CTRL) = AES_AES_CTRL_SAVE_CONTEXT | /* Save context */
|
REG(AES_AES_CTRL) = AES_AES_CTRL_SAVE_CONTEXT | /* Save context */
|
||||||
(((MAX(mic_len, 2) - 2) >> 1) << AES_AES_CTRL_CCM_M_S) | /* M */
|
(((MAX(mic_len, 2) - 2) >> 1) << AES_AES_CTRL_CCM_M_S) | /* M */
|
||||||
((len_len - 1) << AES_AES_CTRL_CCM_L_S) | /* L */
|
((len_len - 1) << AES_AES_CTRL_CCM_L_S) | /* L */
|
||||||
AES_AES_CTRL_CCM | /* CCM */
|
AES_AES_CTRL_CCM | /* CCM */
|
||||||
AES_AES_CTRL_CTR_WIDTH_128 | /* CTR width 128 */
|
AES_AES_CTRL_CTR_WIDTH_128 | /* CTR width 128 */
|
||||||
AES_AES_CTRL_CTR | /* CTR */
|
AES_AES_CTRL_CTR; /* CTR */
|
||||||
AES_AES_CTRL_KEY_SIZE_128; /* Key = 128 */
|
|
||||||
|
|
||||||
/* Write the length of the crypto block (lo) */
|
/* Write the length of the crypto block (lo) */
|
||||||
REG(AES_AES_C_LENGTH_0) = pdata_len;
|
REG(AES_AES_C_LENGTH_0) = pdata_len;
|
||||||
|
|
|
@ -73,28 +73,74 @@ PROCESS_THREAD(ccm_test_process, ev, data)
|
||||||
"keystore write error",
|
"keystore write error",
|
||||||
"authentication failed"
|
"authentication failed"
|
||||||
};
|
};
|
||||||
static const uint8_t keys[][16] = {
|
static const uint8_t keys128[][16] = {
|
||||||
{ 0x12, 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0,
|
{ 0x12, 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0,
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
|
||||||
{ 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7,
|
{ 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7,
|
||||||
0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf }
|
0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf }
|
||||||
};
|
};
|
||||||
|
static const uint8_t keys192[][24] = {
|
||||||
|
{ 0x26, 0x51, 0x1f, 0xb5, 0x1f, 0xcf, 0xa7, 0x5c,
|
||||||
|
0xb4, 0xb4, 0x4d, 0xa7, 0x5a, 0x6e, 0x5a, 0x0e,
|
||||||
|
0xb8, 0xd9, 0xc8, 0xf3, 0xb9, 0x06, 0xf8, 0x86 },
|
||||||
|
{ 0x08, 0x6e, 0x29, 0x67, 0xcd, 0xe9, 0x9e, 0x90,
|
||||||
|
0xfa, 0xae, 0xa8, 0xa9, 0x4e, 0x16, 0x8b, 0xf0,
|
||||||
|
0xe0, 0x66, 0xc5, 0x03, 0xa8, 0x49, 0xa9, 0xf3 },
|
||||||
|
{ 0xce, 0xb0, 0x09, 0xae, 0xa4, 0x45, 0x44, 0x51,
|
||||||
|
0xfe, 0xad, 0xf0, 0xe6, 0xb3, 0x6f, 0x45, 0x55,
|
||||||
|
0x5d, 0xd0, 0x47, 0x23, 0xba, 0xa4, 0x48, 0xe8 },
|
||||||
|
{ 0x11, 0xfd, 0x45, 0x74, 0x3d, 0x94, 0x6e, 0x6d,
|
||||||
|
0x37, 0x34, 0x1f, 0xec, 0x49, 0x94, 0x7e, 0x8c,
|
||||||
|
0x70, 0x48, 0x24, 0x94, 0xa8, 0xf0, 0x7f, 0xcc }
|
||||||
|
};
|
||||||
|
static const uint8_t keys256[][32] = {
|
||||||
|
{ 0x26, 0x51, 0x1f, 0xb5, 0x1f, 0xcf, 0xa7, 0x5c,
|
||||||
|
0xb4, 0xb4, 0x4d, 0xa7, 0x5a, 0x6e, 0x5a, 0x0e,
|
||||||
|
0xb8, 0xd9, 0xc8, 0xf3, 0xb9, 0x06, 0xf8, 0x86,
|
||||||
|
0xdf, 0x3b, 0xa3, 0xe6, 0xda, 0x3a, 0x13, 0x89 },
|
||||||
|
{ 0xc6, 0xc1, 0x4c, 0x65, 0x5e, 0x52, 0xc8, 0xa4,
|
||||||
|
0xc7, 0xe8, 0xd5, 0x4e, 0x97, 0x4d, 0x69, 0x8e,
|
||||||
|
0x1f, 0x21, 0xee, 0x3b, 0xa7, 0x17, 0xa0, 0xad,
|
||||||
|
0xfa, 0x61, 0x36, 0xd0, 0x26, 0x68, 0xc4, 0x76 },
|
||||||
|
{ 0x55, 0x35, 0x21, 0xa7, 0x65, 0xab, 0x0c, 0x3f,
|
||||||
|
0xd2, 0x03, 0x65, 0x4e, 0x99, 0x16, 0x33, 0x0e,
|
||||||
|
0x18, 0x9b, 0xdf, 0x95, 0x1f, 0xee, 0xe9, 0xb4,
|
||||||
|
0x4b, 0x10, 0xda, 0x20, 0x8f, 0xee, 0x7a, 0xcf },
|
||||||
|
{ 0x90, 0x74, 0xb1, 0xae, 0x4c, 0xa3, 0x34, 0x2f,
|
||||||
|
0xe5, 0xbf, 0x6f, 0x14, 0xbc, 0xf2, 0xf2, 0x79,
|
||||||
|
0x04, 0xf0, 0xb1, 0x51, 0x79, 0xd9, 0x5a, 0x65,
|
||||||
|
0x4f, 0x61, 0xe6, 0x99, 0x69, 0x2e, 0x6f, 0x71 }
|
||||||
|
};
|
||||||
|
static const struct {
|
||||||
|
const void *keys;
|
||||||
|
uint8_t key_size;
|
||||||
|
uint8_t count;
|
||||||
|
} keys[] = {
|
||||||
|
{ keys128, AES_KEY_STORE_SIZE_KEY_SIZE_128,
|
||||||
|
sizeof(keys128) / sizeof(keys128[0]) },
|
||||||
|
{ keys192, AES_KEY_STORE_SIZE_KEY_SIZE_192,
|
||||||
|
sizeof(keys192) / sizeof(keys192[0]) },
|
||||||
|
{ keys256, AES_KEY_STORE_SIZE_KEY_SIZE_256,
|
||||||
|
sizeof(keys256) / sizeof(keys256[0]) }
|
||||||
|
};
|
||||||
static struct {
|
static struct {
|
||||||
bool encrypt;
|
bool encrypt;
|
||||||
uint8_t len_len;
|
uint8_t len_len;
|
||||||
|
uint8_t key_size_index;
|
||||||
uint8_t key_area;
|
uint8_t key_area;
|
||||||
uint8_t nonce[13];
|
uint8_t nonce[13];
|
||||||
uint8_t adata[26];
|
uint8_t adata[32];
|
||||||
uint16_t adata_len;
|
uint16_t adata_len;
|
||||||
uint8_t mdata[24];
|
uint8_t mdata[40];
|
||||||
uint16_t mdata_len;
|
uint16_t mdata_len;
|
||||||
uint8_t mic[8];
|
uint8_t mic[16];
|
||||||
uint8_t mic_len;
|
uint8_t mic_len;
|
||||||
uint8_t expected[24];
|
uint8_t expected[40];
|
||||||
} vectors[] = {
|
} vectors[] = {
|
||||||
{
|
{
|
||||||
true, /* encrypt */
|
true, /* encrypt */
|
||||||
2, /* len_len */
|
2, /* len_len */
|
||||||
|
0, /* key_size_index */
|
||||||
0, /* key_area */
|
0, /* key_area */
|
||||||
{ 0x00, 0x00, 0xf0, 0xe0, 0xd0, 0xc0, 0xb0, 0xa0,
|
{ 0x00, 0x00, 0xf0, 0xe0, 0xd0, 0xc0, 0xb0, 0xa0,
|
||||||
0x00, 0x00, 0x00, 0x00, 0x05 }, /* nonce */
|
0x00, 0x00, 0x00, 0x00, 0x05 }, /* nonce */
|
||||||
|
@ -112,6 +158,7 @@ PROCESS_THREAD(ccm_test_process, ev, data)
|
||||||
}, {
|
}, {
|
||||||
true, /* encrypt */
|
true, /* encrypt */
|
||||||
2, /* len_len */
|
2, /* len_len */
|
||||||
|
0, /* key_size_index */
|
||||||
1, /* key_area */
|
1, /* key_area */
|
||||||
{ 0xac, 0xde, 0x48, 0x00, 0x00, 0x00, 0x00, 0x01,
|
{ 0xac, 0xde, 0x48, 0x00, 0x00, 0x00, 0x00, 0x01,
|
||||||
0x00, 0x00, 0x00, 0x05, 0x02 }, /* nonce */
|
0x00, 0x00, 0x00, 0x05, 0x02 }, /* nonce */
|
||||||
|
@ -128,6 +175,7 @@ PROCESS_THREAD(ccm_test_process, ev, data)
|
||||||
}, {
|
}, {
|
||||||
true, /* encrypt */
|
true, /* encrypt */
|
||||||
2, /* len_len */
|
2, /* len_len */
|
||||||
|
0, /* key_size_index */
|
||||||
0, /* key_area */
|
0, /* key_area */
|
||||||
{ 0x00, 0x00, 0xf0, 0xe0, 0xd0, 0xc0, 0xb0, 0xa0,
|
{ 0x00, 0x00, 0xf0, 0xe0, 0xd0, 0xc0, 0xb0, 0xa0,
|
||||||
0x00, 0x00, 0x00, 0x00, 0x05 }, /* nonce */
|
0x00, 0x00, 0x00, 0x00, 0x05 }, /* nonce */
|
||||||
|
@ -146,6 +194,7 @@ PROCESS_THREAD(ccm_test_process, ev, data)
|
||||||
}, {
|
}, {
|
||||||
false, /* decrypt */
|
false, /* decrypt */
|
||||||
2, /* len_len */
|
2, /* len_len */
|
||||||
|
0, /* key_size_index */
|
||||||
0, /* key_area */
|
0, /* key_area */
|
||||||
{ 0x00, 0x00, 0xf0, 0xe0, 0xd0, 0xc0, 0xb0, 0xa0,
|
{ 0x00, 0x00, 0xf0, 0xe0, 0xd0, 0xc0, 0xb0, 0xa0,
|
||||||
0x00, 0x00, 0x00, 0x00, 0x05 }, /* nonce */
|
0x00, 0x00, 0x00, 0x00, 0x05 }, /* nonce */
|
||||||
|
@ -163,6 +212,7 @@ PROCESS_THREAD(ccm_test_process, ev, data)
|
||||||
}, {
|
}, {
|
||||||
false, /* decrypt */
|
false, /* decrypt */
|
||||||
2, /* len_len */
|
2, /* len_len */
|
||||||
|
0, /* key_size_index */
|
||||||
1, /* key_area */
|
1, /* key_area */
|
||||||
{ 0xac, 0xde, 0x48, 0x00, 0x00, 0x00, 0x00, 0x01,
|
{ 0xac, 0xde, 0x48, 0x00, 0x00, 0x00, 0x00, 0x01,
|
||||||
0x00, 0x00, 0x00, 0x05, 0x02 }, /* nonce */
|
0x00, 0x00, 0x00, 0x05, 0x02 }, /* nonce */
|
||||||
|
@ -179,6 +229,7 @@ PROCESS_THREAD(ccm_test_process, ev, data)
|
||||||
}, {
|
}, {
|
||||||
false, /* decrypt */
|
false, /* decrypt */
|
||||||
2, /* len_len */
|
2, /* len_len */
|
||||||
|
0, /* key_size_index */
|
||||||
0, /* key_area */
|
0, /* key_area */
|
||||||
{ 0x00, 0x00, 0xf0, 0xe0, 0xd0, 0xc0, 0xb0, 0xa0,
|
{ 0x00, 0x00, 0xf0, 0xe0, 0xd0, 0xc0, 0xb0, 0xa0,
|
||||||
0x00, 0x00, 0x00, 0x00, 0x05 }, /* nonce */
|
0x00, 0x00, 0x00, 0x00, 0x05 }, /* nonce */
|
||||||
|
@ -194,10 +245,350 @@ PROCESS_THREAD(ccm_test_process, ev, data)
|
||||||
{ 0x14, 0xaa, 0xbb, 0x00, 0x00, 0x01, 0x02, 0x03,
|
{ 0x14, 0xaa, 0xbb, 0x00, 0x00, 0x01, 0x02, 0x03,
|
||||||
0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b,
|
0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b,
|
||||||
0x0c, 0x0d, 0x0e, 0x0f } /* expected */
|
0x0c, 0x0d, 0x0e, 0x0f } /* expected */
|
||||||
|
}, {
|
||||||
|
true, /* encrypt */
|
||||||
|
2, /* len_len */
|
||||||
|
1, /* key_size_index */
|
||||||
|
0, /* key_area */
|
||||||
|
{ 0x15, 0xb3, 0x69, 0x88, 0x96, 0x99, 0xb6, 0xde,
|
||||||
|
0x1f, 0xa3, 0xee, 0x73, 0xe5 }, /* nonce */
|
||||||
|
{}, /* adata */
|
||||||
|
0, /* adata_len */
|
||||||
|
{ 0x39, 0xf0, 0x8a, 0x2a, 0xf1, 0xd8, 0xda, 0x62,
|
||||||
|
0x12, 0x55, 0x06, 0x39, 0xb9, 0x1f, 0xb2, 0x57,
|
||||||
|
0x3e, 0x39, 0xa8, 0xeb, 0x5d, 0x80, 0x1d, 0xe8 }, /* mdata */
|
||||||
|
24, /* mdata_len */
|
||||||
|
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, /* mic */
|
||||||
|
16, /* mic_len */
|
||||||
|
{ 0x63, 0x42, 0xb8, 0x70, 0x0e, 0xde, 0xc9, 0x7a,
|
||||||
|
0x96, 0x0e, 0xb1, 0x6e, 0x7c, 0xb1, 0xeb, 0x44,
|
||||||
|
0x12, 0xfb, 0x4e, 0x26, 0x3d, 0xdd, 0x22, 0x06,
|
||||||
|
0xb0, 0x90, 0x15, 0x5d, 0x34, 0xa7, 0x6c, 0x83,
|
||||||
|
0x24, 0xe5, 0x55, 0x0c, 0x3e, 0xf4, 0x26, 0xed } /* expected */
|
||||||
|
}, {
|
||||||
|
true, /* encrypt */
|
||||||
|
2, /* len_len */
|
||||||
|
1, /* key_size_index */
|
||||||
|
2, /* key_area */
|
||||||
|
{ 0x92, 0x95, 0x42, 0xcd, 0x69, 0x0f, 0x1b, 0xab,
|
||||||
|
0xcf, 0x16, 0x96, 0xcb, 0x03 }, /* nonce */
|
||||||
|
{ 0x58, 0xf7, 0x0b, 0xab, 0x24, 0xe0, 0xa6, 0x13,
|
||||||
|
0x7e, 0x5c, 0xd3, 0xeb, 0x18, 0x65, 0x6f, 0x2b,
|
||||||
|
0x5c, 0xcd, 0xdc, 0x3f, 0x53, 0x8a, 0x00, 0x00,
|
||||||
|
0xc6, 0x51, 0x90, 0xe4, 0xa3, 0x66, 0x8e, 0x71 }, /* adata */
|
||||||
|
32, /* adata_len */
|
||||||
|
{}, /* mdata */
|
||||||
|
0, /* mdata_len */
|
||||||
|
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, /* mic */
|
||||||
|
16, /* mic_len */
|
||||||
|
{ 0x3b, 0xf9, 0xd9, 0x3a, 0xf6, 0xff, 0xac, 0x9a,
|
||||||
|
0xc8, 0x4c, 0xd3, 0x20, 0x2d, 0x4e, 0x0c, 0xc8 } /* expected */
|
||||||
|
}, {
|
||||||
|
true, /* encrypt */
|
||||||
|
8, /* len_len */
|
||||||
|
1, /* key_size_index */
|
||||||
|
4, /* key_area */
|
||||||
|
{ 0x76, 0x40, 0x43, 0xc4, 0x94, 0x60, 0xb7 }, /* nonce */
|
||||||
|
{ 0x6e, 0x80, 0xdd, 0x7f, 0x1b, 0xad, 0xf3, 0xa1,
|
||||||
|
0xc9, 0xab, 0x25, 0xc7, 0x5f, 0x10, 0xbd, 0xe7,
|
||||||
|
0x8c, 0x23, 0xfa, 0x0e, 0xb8, 0xf9, 0xaa, 0xa5,
|
||||||
|
0x3a, 0xde, 0xfb, 0xf4, 0xcb, 0xf7, 0x8f, 0xe4 }, /* adata */
|
||||||
|
32, /* adata_len */
|
||||||
|
{ 0xc8, 0xd2, 0x75, 0xf9, 0x19, 0xe1, 0x7d, 0x7f,
|
||||||
|
0xe6, 0x9c, 0x2a, 0x1f, 0x58, 0x93, 0x9d, 0xfe,
|
||||||
|
0x4d, 0x40, 0x37, 0x91, 0xb5, 0xdf, 0x13, 0x10 }, /* mdata */
|
||||||
|
24, /* mdata_len */
|
||||||
|
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, /* mic */
|
||||||
|
16, /* mic_len */
|
||||||
|
{ 0x8a, 0x0f, 0x3d, 0x82, 0x29, 0xe4, 0x8e, 0x74,
|
||||||
|
0x87, 0xfd, 0x95, 0xa2, 0x8a, 0xd3, 0x92, 0xc8,
|
||||||
|
0x0b, 0x36, 0x81, 0xd4, 0xfb, 0xc7, 0xbb, 0xfd,
|
||||||
|
0x2d, 0xd6, 0xef, 0x1c, 0x45, 0xd4, 0xcc, 0xb7,
|
||||||
|
0x23, 0xdc, 0x07, 0x44, 0x14, 0xdb, 0x50, 0x6d } /* expected */
|
||||||
|
}, {
|
||||||
|
true, /* encrypt */
|
||||||
|
2, /* len_len */
|
||||||
|
1, /* key_size_index */
|
||||||
|
6, /* key_area */
|
||||||
|
{ 0xc6, 0xae, 0xeb, 0xcb, 0x14, 0x6c, 0xfa, 0xfa,
|
||||||
|
0xae, 0x66, 0xf7, 0x8a, 0xab }, /* nonce */
|
||||||
|
{ 0x7d, 0xc8, 0xc5, 0x21, 0x44, 0xa7, 0xcb, 0x65,
|
||||||
|
0xb3, 0xe5, 0xa8, 0x46, 0xe8, 0xfd, 0x7e, 0xae,
|
||||||
|
0x37, 0xbf, 0x69, 0x96, 0xc2, 0x99, 0xb5, 0x6e,
|
||||||
|
0x49, 0x14, 0x4e, 0xbf, 0x43, 0xa1, 0x77, 0x0f }, /* adata */
|
||||||
|
32, /* adata_len */
|
||||||
|
{ 0xee, 0x7e, 0x60, 0x75, 0xba, 0x52, 0x84, 0x6d,
|
||||||
|
0xe5, 0xd6, 0x25, 0x49, 0x59, 0xa1, 0x8a, 0xff,
|
||||||
|
0xc4, 0xfa, 0xf5, 0x9c, 0x8e, 0xf6, 0x34, 0x89 }, /* mdata */
|
||||||
|
24, /* mdata_len */
|
||||||
|
{ 0x00, 0x00, 0x00, 0x00 }, /* mic */
|
||||||
|
4, /* mic_len */
|
||||||
|
{ 0x13, 0x7d, 0x9d, 0xa5, 0x9b, 0xaf, 0x5c, 0xbf,
|
||||||
|
0xd4, 0x66, 0x20, 0xc5, 0xf2, 0x98, 0xfc, 0x76,
|
||||||
|
0x6d, 0xe1, 0x0a, 0xc6, 0x8e, 0x77, 0x4e, 0xdf,
|
||||||
|
0x1f, 0x2c, 0x5b, 0xad } /* expected */
|
||||||
|
}, {
|
||||||
|
false, /* decrypt */
|
||||||
|
2, /* len_len */
|
||||||
|
1, /* key_size_index */
|
||||||
|
0, /* key_area */
|
||||||
|
{ 0x15, 0xb3, 0x69, 0x88, 0x96, 0x99, 0xb6, 0xde,
|
||||||
|
0x1f, 0xa3, 0xee, 0x73, 0xe5 }, /* nonce */
|
||||||
|
{}, /* adata */
|
||||||
|
0, /* adata_len */
|
||||||
|
{ 0x63, 0x42, 0xb8, 0x70, 0x0e, 0xde, 0xc9, 0x7a,
|
||||||
|
0x96, 0x0e, 0xb1, 0x6e, 0x7c, 0xb1, 0xeb, 0x44,
|
||||||
|
0x12, 0xfb, 0x4e, 0x26, 0x3d, 0xdd, 0x22, 0x06,
|
||||||
|
0xb0, 0x90, 0x15, 0x5d, 0x34, 0xa7, 0x6c, 0x83,
|
||||||
|
0x24, 0xe5, 0x55, 0x0c, 0x3e, 0xf4, 0x26, 0xed }, /* mdata */
|
||||||
|
40, /* mdata_len */
|
||||||
|
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, /* mic */
|
||||||
|
16, /* mic_len */
|
||||||
|
{ 0x39, 0xf0, 0x8a, 0x2a, 0xf1, 0xd8, 0xda, 0x62,
|
||||||
|
0x12, 0x55, 0x06, 0x39, 0xb9, 0x1f, 0xb2, 0x57,
|
||||||
|
0x3e, 0x39, 0xa8, 0xeb, 0x5d, 0x80, 0x1d, 0xe8 } /* expected */
|
||||||
|
}, {
|
||||||
|
false, /* decrypt */
|
||||||
|
2, /* len_len */
|
||||||
|
1, /* key_size_index */
|
||||||
|
2, /* key_area */
|
||||||
|
{ 0x92, 0x95, 0x42, 0xcd, 0x69, 0x0f, 0x1b, 0xab,
|
||||||
|
0xcf, 0x16, 0x96, 0xcb, 0x03 }, /* nonce */
|
||||||
|
{ 0x58, 0xf7, 0x0b, 0xab, 0x24, 0xe0, 0xa6, 0x13,
|
||||||
|
0x7e, 0x5c, 0xd3, 0xeb, 0x18, 0x65, 0x6f, 0x2b,
|
||||||
|
0x5c, 0xcd, 0xdc, 0x3f, 0x53, 0x8a, 0x00, 0x00,
|
||||||
|
0xc6, 0x51, 0x90, 0xe4, 0xa3, 0x66, 0x8e, 0x71 }, /* adata */
|
||||||
|
32, /* adata_len */
|
||||||
|
{ 0x3b, 0xf9, 0xd9, 0x3a, 0xf6, 0xff, 0xac, 0x9a,
|
||||||
|
0xc8, 0x4c, 0xd3, 0x20, 0x2d, 0x4e, 0x0c, 0xc8 }, /* mdata */
|
||||||
|
16, /* mdata_len */
|
||||||
|
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, /* mic */
|
||||||
|
16, /* mic_len */
|
||||||
|
{} /* expected */
|
||||||
|
}, {
|
||||||
|
false, /* decrypt */
|
||||||
|
8, /* len_len */
|
||||||
|
1, /* key_size_index */
|
||||||
|
4, /* key_area */
|
||||||
|
{ 0x76, 0x40, 0x43, 0xc4, 0x94, 0x60, 0xb7 }, /* nonce */
|
||||||
|
{ 0x6e, 0x80, 0xdd, 0x7f, 0x1b, 0xad, 0xf3, 0xa1,
|
||||||
|
0xc9, 0xab, 0x25, 0xc7, 0x5f, 0x10, 0xbd, 0xe7,
|
||||||
|
0x8c, 0x23, 0xfa, 0x0e, 0xb8, 0xf9, 0xaa, 0xa5,
|
||||||
|
0x3a, 0xde, 0xfb, 0xf4, 0xcb, 0xf7, 0x8f, 0xe4 }, /* adata */
|
||||||
|
32, /* adata_len */
|
||||||
|
{ 0x8a, 0x0f, 0x3d, 0x82, 0x29, 0xe4, 0x8e, 0x74,
|
||||||
|
0x87, 0xfd, 0x95, 0xa2, 0x8a, 0xd3, 0x92, 0xc8,
|
||||||
|
0x0b, 0x36, 0x81, 0xd4, 0xfb, 0xc7, 0xbb, 0xfd,
|
||||||
|
0x2d, 0xd6, 0xef, 0x1c, 0x45, 0xd4, 0xcc, 0xb7,
|
||||||
|
0x23, 0xdc, 0x07, 0x44, 0x14, 0xdb, 0x50, 0x6d }, /* mdata */
|
||||||
|
40, /* mdata_len */
|
||||||
|
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, /* mic */
|
||||||
|
16, /* mic_len */
|
||||||
|
{ 0xc8, 0xd2, 0x75, 0xf9, 0x19, 0xe1, 0x7d, 0x7f,
|
||||||
|
0xe6, 0x9c, 0x2a, 0x1f, 0x58, 0x93, 0x9d, 0xfe,
|
||||||
|
0x4d, 0x40, 0x37, 0x91, 0xb5, 0xdf, 0x13, 0x10 } /* expected */
|
||||||
|
}, {
|
||||||
|
false, /* decrypt */
|
||||||
|
2, /* len_len */
|
||||||
|
1, /* key_size_index */
|
||||||
|
6, /* key_area */
|
||||||
|
{ 0xc6, 0xae, 0xeb, 0xcb, 0x14, 0x6c, 0xfa, 0xfa,
|
||||||
|
0xae, 0x66, 0xf7, 0x8a, 0xab }, /* nonce */
|
||||||
|
{ 0x7d, 0xc8, 0xc5, 0x21, 0x44, 0xa7, 0xcb, 0x65,
|
||||||
|
0xb3, 0xe5, 0xa8, 0x46, 0xe8, 0xfd, 0x7e, 0xae,
|
||||||
|
0x37, 0xbf, 0x69, 0x96, 0xc2, 0x99, 0xb5, 0x6e,
|
||||||
|
0x49, 0x14, 0x4e, 0xbf, 0x43, 0xa1, 0x77, 0x0f }, /* adata */
|
||||||
|
32, /* adata_len */
|
||||||
|
{ 0x13, 0x7d, 0x9d, 0xa5, 0x9b, 0xaf, 0x5c, 0xbf,
|
||||||
|
0xd4, 0x66, 0x20, 0xc5, 0xf2, 0x98, 0xfc, 0x76,
|
||||||
|
0x6d, 0xe1, 0x0a, 0xc6, 0x8e, 0x77, 0x4e, 0xdf,
|
||||||
|
0x1f, 0x2c, 0x5b, 0xad }, /* mdata */
|
||||||
|
28, /* mdata_len */
|
||||||
|
{ 0x00, 0x00, 0x00, 0x00 }, /* mic */
|
||||||
|
4, /* mic_len */
|
||||||
|
{ 0xee, 0x7e, 0x60, 0x75, 0xba, 0x52, 0x84, 0x6d,
|
||||||
|
0xe5, 0xd6, 0x25, 0x49, 0x59, 0xa1, 0x8a, 0xff,
|
||||||
|
0xc4, 0xfa, 0xf5, 0x9c, 0x8e, 0xf6, 0x34, 0x89 } /* expected */
|
||||||
|
}, {
|
||||||
|
true, /* encrypt */
|
||||||
|
2, /* len_len */
|
||||||
|
2, /* key_size_index */
|
||||||
|
0, /* key_area */
|
||||||
|
{ 0x72, 0xa6, 0x0f, 0x34, 0x5a, 0x19, 0x78, 0xfb,
|
||||||
|
0x40, 0xf2, 0x8a, 0x2f, 0xa4 }, /* nonce */
|
||||||
|
{}, /* adata */
|
||||||
|
0, /* adata_len */
|
||||||
|
{ 0x30, 0xd5, 0x6f, 0xf2, 0xa2, 0x5b, 0x83, 0xfe,
|
||||||
|
0xe7, 0x91, 0x11, 0x0f, 0xca, 0xea, 0x48, 0xe4,
|
||||||
|
0x1d, 0xb7, 0xc7, 0xf0, 0x98, 0xa8, 0x10, 0x00 }, /* mdata */
|
||||||
|
24, /* mdata_len */
|
||||||
|
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, /* mic */
|
||||||
|
16, /* mic_len */
|
||||||
|
{ 0x55, 0xf0, 0x68, 0xc0, 0xbb, 0xba, 0x8b, 0x59,
|
||||||
|
0x80, 0x13, 0xdd, 0x18, 0x41, 0xfd, 0x74, 0x0f,
|
||||||
|
0xda, 0x29, 0x02, 0x32, 0x21, 0x48, 0xab, 0x5e,
|
||||||
|
0x93, 0x57, 0x53, 0xe6, 0x01, 0xb7, 0x9d, 0xb4,
|
||||||
|
0xae, 0x73, 0x0b, 0x6a, 0xe3, 0x50, 0x07, 0x31 } /* expected */
|
||||||
|
}, {
|
||||||
|
true, /* encrypt */
|
||||||
|
2, /* len_len */
|
||||||
|
2, /* key_size_index */
|
||||||
|
2, /* key_area */
|
||||||
|
{ 0x29, 0x1e, 0x91, 0xb1, 0x9d, 0xe5, 0x18, 0xcd,
|
||||||
|
0x78, 0x06, 0xde, 0x44, 0xf6 }, /* nonce */
|
||||||
|
{ 0xb4, 0xf8, 0x32, 0x69, 0x44, 0xa4, 0x5d, 0x95,
|
||||||
|
0xf9, 0x18, 0x87, 0xc2, 0xa6, 0xac, 0x36, 0xb6,
|
||||||
|
0x0e, 0xea, 0x5e, 0xde, 0xf8, 0x4c, 0x1c, 0x35,
|
||||||
|
0x81, 0x46, 0xa6, 0x66, 0xb6, 0x87, 0x83, 0x35 }, /* adata */
|
||||||
|
32, /* adata_len */
|
||||||
|
{}, /* mdata */
|
||||||
|
0, /* mdata_len */
|
||||||
|
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, /* mic */
|
||||||
|
16, /* mic_len */
|
||||||
|
{ 0xca, 0x48, 0x2c, 0x67, 0x4b, 0x59, 0x90, 0x46,
|
||||||
|
0xcc, 0x7d, 0x7e, 0xe0, 0xd0, 0x0e, 0xec, 0x1e } /* expected */
|
||||||
|
}, {
|
||||||
|
true, /* encrypt */
|
||||||
|
8, /* len_len */
|
||||||
|
2, /* key_size_index */
|
||||||
|
4, /* key_area */
|
||||||
|
{ 0xaa, 0xa2, 0x3f, 0x10, 0x16, 0x47, 0xd8 }, /* nonce */
|
||||||
|
{ 0xa3, 0x55, 0xd4, 0xc6, 0x11, 0x81, 0x2e, 0x5f,
|
||||||
|
0x92, 0x58, 0xd7, 0x18, 0x8b, 0x3d, 0xf8, 0x85,
|
||||||
|
0x14, 0x77, 0x09, 0x4f, 0xfc, 0x2a, 0xf2, 0xcf,
|
||||||
|
0x0c, 0x86, 0x70, 0xdb, 0x90, 0x3f, 0xbb, 0xe0 }, /* adata */
|
||||||
|
32, /* adata_len */
|
||||||
|
{ 0x64, 0x4e, 0xb3, 0x4b, 0x9a, 0x12, 0x6e, 0x43,
|
||||||
|
0x7b, 0x5e, 0x01, 0x5e, 0xea, 0x14, 0x1c, 0xa1,
|
||||||
|
0xa8, 0x80, 0x20, 0xf2, 0xd5, 0xd6, 0xcc, 0x2c }, /* mdata */
|
||||||
|
24, /* mdata_len */
|
||||||
|
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, /* mic */
|
||||||
|
16, /* mic_len */
|
||||||
|
{ 0x27, 0xed, 0x90, 0x66, 0x81, 0x74, 0xeb, 0xf8,
|
||||||
|
0x24, 0x1a, 0x3c, 0x74, 0xb3, 0x5e, 0x12, 0x46,
|
||||||
|
0xb6, 0x61, 0x7e, 0x41, 0x23, 0x57, 0x8f, 0x15,
|
||||||
|
0x3b, 0xdb, 0x67, 0x06, 0x2a, 0x13, 0xef, 0x4e,
|
||||||
|
0x98, 0x6f, 0x5b, 0xb3, 0xd0, 0xbb, 0x43, 0x07 } /* expected */
|
||||||
|
}, {
|
||||||
|
true, /* encrypt */
|
||||||
|
2, /* len_len */
|
||||||
|
2, /* key_size_index */
|
||||||
|
6, /* key_area */
|
||||||
|
{ 0x2e, 0x1e, 0x01, 0x32, 0x46, 0x85, 0x00, 0xd4,
|
||||||
|
0xbd, 0x47, 0x86, 0x25, 0x63 }, /* nonce */
|
||||||
|
{ 0x3c, 0x5f, 0x54, 0x04, 0x37, 0x0a, 0xbd, 0xcb,
|
||||||
|
0x1e, 0xdd, 0xe9, 0x9d, 0xe6, 0x0d, 0x06, 0x82,
|
||||||
|
0xc6, 0x00, 0xb0, 0x34, 0xe0, 0x63, 0xb7, 0xd3,
|
||||||
|
0x23, 0x77, 0x23, 0xda, 0x70, 0xab, 0x75, 0x52 }, /* adata */
|
||||||
|
32, /* adata_len */
|
||||||
|
{ 0x23, 0x90, 0x29, 0xf1, 0x50, 0xbc, 0xcb, 0xd6,
|
||||||
|
0x7e, 0xdb, 0xb6, 0x7f, 0x8a, 0xe4, 0x56, 0xb4,
|
||||||
|
0xea, 0x06, 0x6a, 0x4b, 0xee, 0xe0, 0x65, 0xf9 }, /* mdata */
|
||||||
|
24, /* mdata_len */
|
||||||
|
{ 0x00, 0x00, 0x00, 0x00 }, /* mic */
|
||||||
|
4, /* mic_len */
|
||||||
|
{ 0x9c, 0x8d, 0x5d, 0xd2, 0x27, 0xfd, 0x9f, 0x81,
|
||||||
|
0x23, 0x76, 0x01, 0x83, 0x0a, 0xfe, 0xe4, 0xf0,
|
||||||
|
0x11, 0x56, 0x36, 0xc8, 0xe5, 0xd5, 0xfd, 0x74,
|
||||||
|
0x3c, 0xb9, 0xaf, 0xed } /* expected */
|
||||||
|
}, {
|
||||||
|
false, /* decrypt */
|
||||||
|
2, /* len_len */
|
||||||
|
2, /* key_size_index */
|
||||||
|
0, /* key_area */
|
||||||
|
{ 0x72, 0xa6, 0x0f, 0x34, 0x5a, 0x19, 0x78, 0xfb,
|
||||||
|
0x40, 0xf2, 0x8a, 0x2f, 0xa4 }, /* nonce */
|
||||||
|
{}, /* adata */
|
||||||
|
0, /* adata_len */
|
||||||
|
{ 0x55, 0xf0, 0x68, 0xc0, 0xbb, 0xba, 0x8b, 0x59,
|
||||||
|
0x80, 0x13, 0xdd, 0x18, 0x41, 0xfd, 0x74, 0x0f,
|
||||||
|
0xda, 0x29, 0x02, 0x32, 0x21, 0x48, 0xab, 0x5e,
|
||||||
|
0x93, 0x57, 0x53, 0xe6, 0x01, 0xb7, 0x9d, 0xb4,
|
||||||
|
0xae, 0x73, 0x0b, 0x6a, 0xe3, 0x50, 0x07, 0x31 }, /* mdata */
|
||||||
|
40, /* mdata_len */
|
||||||
|
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, /* mic */
|
||||||
|
16, /* mic_len */
|
||||||
|
{ 0x30, 0xd5, 0x6f, 0xf2, 0xa2, 0x5b, 0x83, 0xfe,
|
||||||
|
0xe7, 0x91, 0x11, 0x0f, 0xca, 0xea, 0x48, 0xe4,
|
||||||
|
0x1d, 0xb7, 0xc7, 0xf0, 0x98, 0xa8, 0x10, 0x00 } /* expected */
|
||||||
|
}, {
|
||||||
|
false, /* decrypt */
|
||||||
|
2, /* len_len */
|
||||||
|
2, /* key_size_index */
|
||||||
|
2, /* key_area */
|
||||||
|
{ 0x29, 0x1e, 0x91, 0xb1, 0x9d, 0xe5, 0x18, 0xcd,
|
||||||
|
0x78, 0x06, 0xde, 0x44, 0xf6 }, /* nonce */
|
||||||
|
{ 0xb4, 0xf8, 0x32, 0x69, 0x44, 0xa4, 0x5d, 0x95,
|
||||||
|
0xf9, 0x18, 0x87, 0xc2, 0xa6, 0xac, 0x36, 0xb6,
|
||||||
|
0x0e, 0xea, 0x5e, 0xde, 0xf8, 0x4c, 0x1c, 0x35,
|
||||||
|
0x81, 0x46, 0xa6, 0x66, 0xb6, 0x87, 0x83, 0x35 }, /* adata */
|
||||||
|
32, /* adata_len */
|
||||||
|
{ 0xca, 0x48, 0x2c, 0x67, 0x4b, 0x59, 0x90, 0x46,
|
||||||
|
0xcc, 0x7d, 0x7e, 0xe0, 0xd0, 0x0e, 0xec, 0x1e }, /* mdata */
|
||||||
|
16, /* mdata_len */
|
||||||
|
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, /* mic */
|
||||||
|
16, /* mic_len */
|
||||||
|
{} /* expected */
|
||||||
|
}, {
|
||||||
|
false, /* decrypt */
|
||||||
|
8, /* len_len */
|
||||||
|
2, /* key_size_index */
|
||||||
|
4, /* key_area */
|
||||||
|
{ 0xaa, 0xa2, 0x3f, 0x10, 0x16, 0x47, 0xd8 }, /* nonce */
|
||||||
|
{ 0xa3, 0x55, 0xd4, 0xc6, 0x11, 0x81, 0x2e, 0x5f,
|
||||||
|
0x92, 0x58, 0xd7, 0x18, 0x8b, 0x3d, 0xf8, 0x85,
|
||||||
|
0x14, 0x77, 0x09, 0x4f, 0xfc, 0x2a, 0xf2, 0xcf,
|
||||||
|
0x0c, 0x86, 0x70, 0xdb, 0x90, 0x3f, 0xbb, 0xe0 }, /* adata */
|
||||||
|
32, /* adata_len */
|
||||||
|
{ 0x27, 0xed, 0x90, 0x66, 0x81, 0x74, 0xeb, 0xf8,
|
||||||
|
0x24, 0x1a, 0x3c, 0x74, 0xb3, 0x5e, 0x12, 0x46,
|
||||||
|
0xb6, 0x61, 0x7e, 0x41, 0x23, 0x57, 0x8f, 0x15,
|
||||||
|
0x3b, 0xdb, 0x67, 0x06, 0x2a, 0x13, 0xef, 0x4e,
|
||||||
|
0x98, 0x6f, 0x5b, 0xb3, 0xd0, 0xbb, 0x43, 0x07 }, /* mdata */
|
||||||
|
40, /* mdata_len */
|
||||||
|
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, /* mic */
|
||||||
|
16, /* mic_len */
|
||||||
|
{ 0x64, 0x4e, 0xb3, 0x4b, 0x9a, 0x12, 0x6e, 0x43,
|
||||||
|
0x7b, 0x5e, 0x01, 0x5e, 0xea, 0x14, 0x1c, 0xa1,
|
||||||
|
0xa8, 0x80, 0x20, 0xf2, 0xd5, 0xd6, 0xcc, 0x2c } /* expected */
|
||||||
|
}, {
|
||||||
|
false, /* decrypt */
|
||||||
|
2, /* len_len */
|
||||||
|
2, /* key_size_index */
|
||||||
|
6, /* key_area */
|
||||||
|
{ 0x2e, 0x1e, 0x01, 0x32, 0x46, 0x85, 0x00, 0xd4,
|
||||||
|
0xbd, 0x47, 0x86, 0x25, 0x63 }, /* nonce */
|
||||||
|
{ 0x3c, 0x5f, 0x54, 0x04, 0x37, 0x0a, 0xbd, 0xcb,
|
||||||
|
0x1e, 0xdd, 0xe9, 0x9d, 0xe6, 0x0d, 0x06, 0x82,
|
||||||
|
0xc6, 0x00, 0xb0, 0x34, 0xe0, 0x63, 0xb7, 0xd3,
|
||||||
|
0x23, 0x77, 0x23, 0xda, 0x70, 0xab, 0x75, 0x52 }, /* adata */
|
||||||
|
32, /* adata_len */
|
||||||
|
{ 0x9c, 0x8d, 0x5d, 0xd2, 0x27, 0xfd, 0x9f, 0x81,
|
||||||
|
0x23, 0x76, 0x01, 0x83, 0x0a, 0xfe, 0xe4, 0xf0,
|
||||||
|
0x11, 0x56, 0x36, 0xc8, 0xe5, 0xd5, 0xfd, 0x74,
|
||||||
|
0x3c, 0xb9, 0xaf, 0xed }, /* mdata */
|
||||||
|
28, /* mdata_len */
|
||||||
|
{ 0x00, 0x00, 0x00, 0x00 }, /* mic */
|
||||||
|
4, /* mic_len */
|
||||||
|
{ 0x23, 0x90, 0x29, 0xf1, 0x50, 0xbc, 0xcb, 0xd6,
|
||||||
|
0x7e, 0xdb, 0xb6, 0x7f, 0x8a, 0xe4, 0x56, 0xb4,
|
||||||
|
0xea, 0x06, 0x6a, 0x4b, 0xee, 0xe0, 0x65, 0xf9 } /* expected */
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
static int i;
|
static int i;
|
||||||
static uint8_t ret;
|
static uint8_t key_size_index = -1, ret;
|
||||||
static rtimer_clock_t time, time2, total_time;
|
static rtimer_clock_t time, time2, total_time;
|
||||||
|
|
||||||
PROCESS_BEGIN();
|
PROCESS_BEGIN();
|
||||||
|
@ -206,19 +597,23 @@ PROCESS_THREAD(ccm_test_process, ev, data)
|
||||||
"Initializing cryptoprocessor...");
|
"Initializing cryptoprocessor...");
|
||||||
crypto_init();
|
crypto_init();
|
||||||
|
|
||||||
puts("-----------------------------------------\n"
|
|
||||||
"Filling key store...");
|
|
||||||
time = RTIMER_NOW();
|
|
||||||
ret = aes_load_keys(keys, sizeof(keys) / sizeof(keys[0]), 0);
|
|
||||||
time = RTIMER_NOW() - time;
|
|
||||||
printf("aes_load_keys(): %s, %lu us\n", str_res[ret],
|
|
||||||
(uint32_t)((uint64_t)time * 1000000 / RTIMER_SECOND));
|
|
||||||
PROCESS_PAUSE();
|
|
||||||
if(ret != CRYPTO_SUCCESS) {
|
|
||||||
goto fatal;
|
|
||||||
}
|
|
||||||
|
|
||||||
for(i = 0; i < sizeof(vectors) / sizeof(vectors[0]); i++) {
|
for(i = 0; i < sizeof(vectors) / sizeof(vectors[0]); i++) {
|
||||||
|
if(key_size_index != vectors[i].key_size_index) {
|
||||||
|
key_size_index = vectors[i].key_size_index;
|
||||||
|
printf("-----------------------------------------\n"
|
||||||
|
"Filling %d-bit key store...\n", 128 + (key_size_index << 6));
|
||||||
|
time = RTIMER_NOW();
|
||||||
|
ret = aes_load_keys(keys[key_size_index].keys,
|
||||||
|
keys[key_size_index].key_size, keys[key_size_index].count, 0);
|
||||||
|
time = RTIMER_NOW() - time;
|
||||||
|
printf("aes_load_keys(): %s, %lu us\n", str_res[ret],
|
||||||
|
(uint32_t)((uint64_t)time * 1000000 / RTIMER_SECOND));
|
||||||
|
PROCESS_PAUSE();
|
||||||
|
if(ret != CRYPTO_SUCCESS) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
printf("-----------------------------------------\n"
|
printf("-----------------------------------------\n"
|
||||||
"Test vector #%d: %s\n"
|
"Test vector #%d: %s\n"
|
||||||
"len_len=%d key_area=%d\n"
|
"len_len=%d key_area=%d\n"
|
||||||
|
@ -323,7 +718,6 @@ PROCESS_THREAD(ccm_test_process, ev, data)
|
||||||
(uint32_t)((uint64_t)total_time * 1000000 / RTIMER_SECOND));
|
(uint32_t)((uint64_t)total_time * 1000000 / RTIMER_SECOND));
|
||||||
}
|
}
|
||||||
|
|
||||||
fatal:
|
|
||||||
puts("-----------------------------------------\n"
|
puts("-----------------------------------------\n"
|
||||||
"Disabling cryptoprocessor...");
|
"Disabling cryptoprocessor...");
|
||||||
crypto_disable();
|
crypto_disable();
|
||||||
|
|
|
@ -29,7 +29,7 @@ In terms of hardware support, the following drivers have been implemented:
|
||||||
* Low Power Modes
|
* Low Power Modes
|
||||||
* General-Purpose Timers. NB: GPT0 is in use by the platform code, the remaining GPTs are available for application development.
|
* General-Purpose Timers. NB: GPT0 is in use by the platform code, the remaining GPTs are available for application development.
|
||||||
* ADC
|
* ADC
|
||||||
* Cryptoprocessor (AES-CCM-128, SHA-256)
|
* Cryptoprocessor (AES-CCM-256, SHA-256)
|
||||||
* SmartRF06 EB and BB peripherals
|
* SmartRF06 EB and BB peripherals
|
||||||
* LEDs
|
* LEDs
|
||||||
* Buttons
|
* Buttons
|
||||||
|
|
|
@ -44,7 +44,7 @@ In terms of hardware support, the following drivers have been implemented:
|
||||||
* Low Power Modes
|
* Low Power Modes
|
||||||
* General-Purpose Timers. NB: GPT0 is in use by the platform code, the remaining GPTs are available for application development.
|
* General-Purpose Timers. NB: GPT0 is in use by the platform code, the remaining GPTs are available for application development.
|
||||||
* ADC
|
* ADC
|
||||||
* Cryptoprocessor (AES-CCM-128, SHA-256)
|
* Cryptoprocessor (AES-CCM-256, SHA-256)
|
||||||
* LEDs
|
* LEDs
|
||||||
* Buttons
|
* Buttons
|
||||||
* Internal/external 2.4GHz antenna switch controllable by SW.
|
* Internal/external 2.4GHz antenna switch controllable by SW.
|
||||||
|
|
Loading…
Reference in a new issue