From 427d2bd06e81fe7f2985eb454113a603ce5fa1db Mon Sep 17 00:00:00 2001 From: Ollrogge Date: Wed, 14 Apr 2021 22:18:59 +0200 Subject: [PATCH 1/5] sys/crypto: Enable support for AES-192, AES-256 --- makefiles/pseudomodules.inc.mk | 3 + pkg/openwsn/contrib/cryptoengine.c | 6 +- pkg/semtech-loramac/Makefile.dep | 2 +- sys/Makefile.dep | 16 +- sys/crypto/Kconfig | 14 +- sys/crypto/aes.c | 45 ++++- sys/crypto/doc.txt | 9 +- sys/hashes/cmac.c | 2 +- sys/include/crypto/aes.h | 24 ++- sys/include/crypto/ciphers.h | 35 +++- sys/net/gnrc/Makefile.dep | 2 +- .../link_layer/lorawan/gnrc_lorawan_crypto.c | 6 +- sys/net/link_layer/ieee802154/security.c | 2 +- tests/sys_crypto/Makefile | 3 + tests/sys_crypto/main.c | 3 + tests/sys_crypto/tests-crypto-aes.c | 19 +-- tests/sys_crypto/tests-crypto-cipher.c | 29 +--- tests/sys_crypto/tests-crypto-modes-cbc.c | 154 +++++++++++++++-- tests/sys_crypto/tests-crypto-modes-ccm.c | 6 +- tests/sys_crypto/tests-crypto-modes-ctr.c | 156 ++++++++++++++++-- tests/sys_crypto/tests-crypto-modes-ecb.c | 156 ++++++++++++++++-- tests/sys_crypto/tests-crypto-modes-ocb.c | 6 +- tests/sys_crypto/tests-crypto.h | 3 + tests/unittests/tests-hashes/Makefile.include | 2 +- 24 files changed, 576 insertions(+), 127 deletions(-) diff --git a/makefiles/pseudomodules.inc.mk b/makefiles/pseudomodules.inc.mk index 0f8b37cf5d..6fb6e46843 100644 --- a/makefiles/pseudomodules.inc.mk +++ b/makefiles/pseudomodules.inc.mk @@ -306,6 +306,9 @@ PSEUDOMODULES += skald_eddystone # define optimized read function of DS18 driver as a pseudo module PSEUDOMODULES += ds18_optimized +PSEUDOMODULES += crypto_aes_128 +PSEUDOMODULES += crypto_aes_192 +PSEUDOMODULES += crypto_aes_256 # By using this pseudomodule, T tables will be precalculated. PSEUDOMODULES += crypto_aes_precalculated # This pseudomodule causes a loop in AES to be unrolled (more flash, less CPU) diff --git a/pkg/openwsn/contrib/cryptoengine.c b/pkg/openwsn/contrib/cryptoengine.c index 1ef8ffc6bf..996f6a2e21 100644 --- a/pkg/openwsn/contrib/cryptoengine.c +++ b/pkg/openwsn/contrib/cryptoengine.c @@ -38,7 +38,7 @@ owerror_t cryptoengine_aes_ccms_enc(uint8_t *a, uint8_t len_a, uint8_t *m, int ret, len; uint8_t tmp_buff[MAX_MESSAGE_LEN + CCM_MAC_MAX_LEN]; - ret = cipher_init(&cipher, CIPHER_AES_128, key, CCM_BLOCK_SIZE); + ret = cipher_init(&cipher, CIPHER_AES, key, CCM_BLOCK_SIZE); if (ret != 1) { return E_FAIL; @@ -64,7 +64,7 @@ owerror_t cryptoengine_aes_ccms_dec(uint8_t *a, uint8_t len_a, uint8_t *m, int ret, len; uint8_t tmp_buff[MAX_MESSAGE_LEN]; - ret = cipher_init(&cipher, CIPHER_AES_128, key, CCM_BLOCK_SIZE); + ret = cipher_init(&cipher, CIPHER_AES, key, CCM_BLOCK_SIZE); if (ret != 1) { return E_FAIL; @@ -88,7 +88,7 @@ owerror_t cryptoengine_aes_ecb_enc(uint8_t *buffer, uint8_t *key) cipher_t cipher; int ret, len; - ret = cipher_init(&cipher, CIPHER_AES_128, key, CCM_BLOCK_SIZE); + ret = cipher_init(&cipher, CIPHER_AES, key, CCM_BLOCK_SIZE); if (ret != 1) { return E_FAIL; diff --git a/pkg/semtech-loramac/Makefile.dep b/pkg/semtech-loramac/Makefile.dep index 16eb716643..bce0c7875d 100644 --- a/pkg/semtech-loramac/Makefile.dep +++ b/pkg/semtech-loramac/Makefile.dep @@ -1,6 +1,6 @@ USEMODULE += random USEMODULE += hashes -USEMODULE += crypto_aes +USEMODULE += crypto_aes_128 USEMODULE += semtech_loramac_contrib USEMODULE += semtech_loramac_mac diff --git a/sys/Makefile.dep b/sys/Makefile.dep index c812b7739f..73b0fa818b 100644 --- a/sys/Makefile.dep +++ b/sys/Makefile.dep @@ -42,17 +42,21 @@ ifneq (,$(filter i2c_scan,$(USEMODULE))) endif ifneq (,$(filter prng_fortuna,$(USEMODULE))) - USEMODULE += crypto_aes -endif - -ifneq (,$(filter crypto_aes_%,$(USEMODULE))) - USEMODULE += crypto_aes + USEMODULE += crypto_aes_128 endif ifneq (,$(filter crypto_%,$(USEMODULE))) USEMODULE += crypto endif +ifneq (,$(filter cipher_modes,$(USEMODULE))) + USEMODULE += crypto +endif + +ifneq (,$(filter crypto,$(USEMODULE))) + DEFAULT_MODULE += crypto_aes_128 +endif + ifneq (,$(filter sys_bus_%,$(USEMODULE))) USEMODULE += sys_bus USEMODULE += core_msg_bus @@ -60,7 +64,7 @@ endif ifneq (,$(filter ieee802154_security,$(USEMODULE))) USEMODULE += crypto - USEMODULE += crypto_aes + USEMODULE += crypto_aes_128 USEMODULE += cipher_modes endif diff --git a/sys/crypto/Kconfig b/sys/crypto/Kconfig index fa070b10c1..24cf354ed0 100644 --- a/sys/crypto/Kconfig +++ b/sys/crypto/Kconfig @@ -19,7 +19,7 @@ choice The common Crypto block ciphers API has multiple implementations. Choose one of the following. -config MODULE_CRYPTO_AES +config CRYPTO_AES bool "AES" select MODULE_CRYPTO @@ -30,7 +30,17 @@ config MODULE_CRYPTO_3DES endchoice menu "Crypto AES options" -depends on MODULE_CRYPTO_AES +depends on CRYPTO_AES + +config MODULE_CRYPTO_AES_128 + bool "AES-128" + default y + +config MODULE_CRYPTO_AES_192 + bool "AES-192" + +config MODULE_CRYPTO_AES_256 + bool "AES-256" config MODULE_CRYPTO_AES_PRECALCULATED bool "Pre-calculate T tables" diff --git a/sys/crypto/aes.c b/sys/crypto/aes.c index a6a229df83..776b6cc192 100644 --- a/sys/crypto/aes.c +++ b/sys/crypto/aes.c @@ -39,6 +39,28 @@ #include #include "crypto/aes.h" #include "crypto/ciphers.h" +#include "kernel_defines.h" + +#if !IS_USED(MODULE_CRYPTO_AES_128) && !IS_USED(MODULE_CRYPTO_AES_192) && \ + !IS_USED(MODULE_CRYPTO_AES_256) + #error "sys/crypto/aes: No aes module used." +#endif + +/** + * @brief AES key size used + */ +#if IS_USED(MODULE_CRYPTO_AES_128) && !IS_USED(MODULE_CRYPTO_AES_192) && \ + !IS_USED(MODULE_CRYPTO_AES_256) +# define AES_KEY_SIZE(ctx) AES_KEY_SIZE_128 +#elif !IS_USED(MODULE_CRYPTO_AES_128) && IS_USED(MODULE_CRYPTO_AES_192) && \ + !IS_USED(MODULE_CRYPTO_AES_256) +# define AES_KEY_SIZE(ctx) AES_KEY_SIZE_192 +#elif !IS_USED(MODULE_CRYPTO_AES_128) && !IS_USED(MODULE_CRYPTO_AES_192) && \ + IS_USED(MODULE_CRYPTO_AES_256) +# define AES_KEY_SIZE(ctx) AES_KEY_SIZE_256 +#else +# define AES_KEY_SIZE(ctx) ctx->key_size +#endif /** * Interface to the aes cipher @@ -49,7 +71,9 @@ static const cipher_interface_t aes_interface = { aes_encrypt, aes_decrypt }; + const cipher_id_t CIPHER_AES_128 = &aes_interface; +const cipher_id_t CIPHER_AES = &aes_interface; static const u32 Te0[256] = { 0xc66363a5U, 0xf87c7c84U, 0xee777799U, 0xf67b7b8dU, @@ -794,19 +818,26 @@ static const u32 rcon[] = { 0x1B000000, 0x36000000, }; - int aes_init(cipher_context_t *context, const uint8_t *key, uint8_t keySize) { uint8_t i; - /* This implementation only supports a single key size (defined in AES_KEY_SIZE) */ - if (keySize != AES_KEY_SIZE) { + if (keySize != AES_KEY_SIZE_128 && keySize != AES_KEY_SIZE_192 && + keySize != AES_KEY_SIZE_256) { return CIPHER_ERR_INVALID_KEY_SIZE; } + if ((keySize == AES_KEY_SIZE_128 && !IS_USED(MODULE_CRYPTO_AES_128)) || + (keySize == AES_KEY_SIZE_192 && !IS_USED(MODULE_CRYPTO_AES_192)) || + (keySize == AES_KEY_SIZE_256 && !IS_USED(MODULE_CRYPTO_AES_256))) { + return CIPHER_ERR_INVALID_KEY_SIZE; + } + + context->key_size = keySize; + /* Make sure that context is large enough. If this is not the case, you should build with -DAES */ - if (CIPHER_MAX_CONTEXT_SIZE < AES_KEY_SIZE) { + if (CIPHER_MAX_CONTEXT_SIZE < keySize) { return CIPHER_ERR_BAD_CONTEXT_SIZE; } @@ -1036,13 +1067,14 @@ int aes_encrypt(const cipher_context_t *context, const uint8_t *plainBlock, const AES_KEY *key = &aeskey; res = aes_set_encrypt_key((unsigned char *)context->context, - AES_KEY_SIZE * 8, &aeskey); + AES_KEY_SIZE(context) * 8, &aeskey); if (res < 0) { return res; } const u32 *rk; u32 s0, s1, s2, s3, t0, t1, t2, t3; + #ifndef MODULE_CRYPTO_AES_UNROLL int r; #endif /* ?MODULE_CRYPTO_AES_UNROLL */ @@ -1304,7 +1336,7 @@ int aes_decrypt(const cipher_context_t *context, const uint8_t *cipherBlock, const AES_KEY *key = &aeskey; res = aes_set_decrypt_key((unsigned char *)context->context, - AES_KEY_SIZE * 8, &aeskey); + AES_KEY_SIZE(context) * 8, &aeskey); if (res < 0) { return res; @@ -1312,6 +1344,7 @@ int aes_decrypt(const cipher_context_t *context, const uint8_t *cipherBlock, const u32 *rk; u32 s0, s1, s2, s3, t0, t1, t2, t3; + #ifndef MODULE_CRYPTO_AES_UNROLL int r; #endif /* ?MODULE_CRYPTO_AES_UNROLL */ diff --git a/sys/crypto/doc.txt b/sys/crypto/doc.txt index 959de84633..e6e861ce80 100644 --- a/sys/crypto/doc.txt +++ b/sys/crypto/doc.txt @@ -16,12 +16,11 @@ * @section ciphers Ciphers * * RIOT supports the following block ciphers: - * * AES-128 - * * 3DES (deprecated) + * * AES-128, AES-192, AES-256 * * NULL * - * You can use them directly by adding `crypto_aes` or `crypto_3des` to your - * USEMODULE-List. + * You can use them directly by adding `crypto_aes_128`, `crypto_aes_192` or + * `crypto_aes_256` to your USEMODULE-List. * While you can use the ciphers functions directly, you should resort to * the generic API for block ciphers whenever possible. * @@ -37,7 +36,7 @@ * plain_text[AES_BLOCK_SIZE] = {0}, * cipher_text[AES_BLOCK_SIZE] = {0}; * - * if (cipher_init(&cipher, CIPHER_AES_128, key, AES_KEY_SIZE) < 0) + * if (cipher_init(&cipher, CIPHER_AES, key, AES_KEY_SIZE) < 0) * printf("Cipher init failed!\n"); * * if (cipher_encrypt(&cipher, plain_text, cipher_text) < 0) diff --git a/sys/hashes/cmac.c b/sys/hashes/cmac.c index 698d0925d7..27cc57975c 100644 --- a/sys/hashes/cmac.c +++ b/sys/hashes/cmac.c @@ -49,7 +49,7 @@ int cmac_init(cmac_context_t *ctx, const uint8_t *key, uint8_t key_size) } memset(ctx, 0, sizeof(cmac_context_t)); - return cipher_init(&(ctx->aes_ctx), CIPHER_AES_128, key, key_size); + return cipher_init(&(ctx->aes_ctx), CIPHER_AES, key, key_size); } void cmac_update(cmac_context_t *ctx, const void *data, size_t len) diff --git a/sys/include/crypto/aes.h b/sys/include/crypto/aes.h index 5a57d33f75..2055dbb76a 100644 --- a/sys/include/crypto/aes.h +++ b/sys/include/crypto/aes.h @@ -13,6 +13,14 @@ * @file * @brief Headers for the implementation of the AES cipher-algorithm * + * The default key size is 128 bits. To use a different key size add + * USEMODULE += crypto_aes_192 and/or USEMODULE += crypto_aes_256 to + * your Makefile. + * + * If only one key size is needed and that key size is not 128 bits, the 128 bit + * key size can be disabled with DISABLE_MODULE += crypto_aes_128 as an + * optimization. + * * @author Freie Universitaet Berlin, Computer Systems & Telematics * @author Nicolai Schmittberger * @author Fabrice Bellard @@ -46,20 +54,26 @@ typedef uint8_t u8; #define AES_MAXNR 14 #define AES_BLOCK_SIZE 16 -#define AES_KEY_SIZE 16 + +/** + * @name AES key sizes + * @{ + */ +#define AES_KEY_SIZE_128 16 +#define AES_KEY_SIZE_192 24 +#define AES_KEY_SIZE_256 32 +/** @} */ /** * @brief AES key * @see cipher_context_t */ -struct aes_key_st { +typedef struct aes_key_st { /** @cond INTERNAL */ uint32_t rd_key[4 * (AES_MAXNR + 1)]; int rounds; /** @endcond */ -}; - -typedef struct aes_key_st AES_KEY; +} AES_KEY; /** * @brief the cipher_context_t-struct adapted for AES diff --git a/sys/include/crypto/ciphers.h b/sys/include/crypto/ciphers.h index d66e7a54e4..b34e529672 100644 --- a/sys/include/crypto/ciphers.h +++ b/sys/include/crypto/ciphers.h @@ -23,6 +23,7 @@ #define CRYPTO_CIPHERS_H #include +#include "kernel_defines.h" #ifdef __cplusplus extern "C" { @@ -30,8 +31,19 @@ extern "C" { /* Shared header file for all cipher algorithms */ -/** @brief the length of keys in bytes */ -#define CIPHERS_MAX_KEY_SIZE 20 +/** @brief the length of keys in bytes + * + * As of now AES is the only cipher which supports different key sizes. + * Here we optimize the CIPHERS_MAX_KEY_SIZE to always have the smallest possible + * value based on which AES key sizes are used. + */ +#if IS_USED(MODULE_CRYPTO_AES_256) + #define CIPHERS_MAX_KEY_SIZE 32 +#elif IS_USED(MODULE_CRYPTO_AES_192) + #define CIPHERS_MAX_KEY_SIZE 24 +#else + #define CIPHERS_MAX_KEY_SIZE 16 +#endif #define CIPHER_MAX_BLOCK_SIZE 16 /** @@ -43,7 +55,8 @@ extern "C" { */ #if defined(MODULE_CRYPTO_3DES) #define CIPHER_MAX_CONTEXT_SIZE 24 -#elif defined(MODULE_CRYPTO_AES) +#elif IS_USED(MODULE_CRYPTO_AES_256) || IS_USED(MODULE_CRYPTO_AES_192) || \ + IS_USED(MODULE_CRYPTO_AES_128) #define CIPHER_MAX_CONTEXT_SIZE CIPHERS_MAX_KEY_SIZE #else /* 0 is not a possibility because 0-sized arrays are not allowed in ISO C */ @@ -56,7 +69,8 @@ extern "C" { #define CIPHER_ERR_INVALID_LENGTH -4 #define CIPHER_ERR_ENC_FAILED -5 #define CIPHER_ERR_DEC_FAILED -6 -/** Is returned by the cipher_init functions, if the corresponding alogirithm has not been included in the build */ +/** Is returned by the cipher_init functions, if the corresponding algorithm + * has not been included in the build */ #define CIPHER_ERR_BAD_CONTEXT_SIZE 0 /** Returned by cipher_init upon successful initialization of a cipher. */ #define CIPHER_INIT_SUCCESS 1 @@ -65,7 +79,8 @@ extern "C" { * @brief the context for cipher-operations */ typedef struct { - uint8_t context[CIPHER_MAX_CONTEXT_SIZE]; /**< buffer for cipher operations */ + uint8_t key_size; /**< key size used */ + uint8_t context[CIPHER_MAX_CONTEXT_SIZE]; /**< buffer for cipher operations */ } cipher_context_t; @@ -96,8 +111,18 @@ typedef struct cipher_interface_st { typedef const cipher_interface_t *cipher_id_t; +/** + * @brief AES_128 cipher id + * + * @deprecated Use @ref CIPHER_AES instead. Will be removed after 2021.07 + * release. + */ extern const cipher_id_t CIPHER_AES_128; +/** + * @brief AES cipher id + */ +extern const cipher_id_t CIPHER_AES; /** * @brief basic struct for using block ciphers diff --git a/sys/net/gnrc/Makefile.dep b/sys/net/gnrc/Makefile.dep index 52d2cbecf5..8d76b02003 100644 --- a/sys/net/gnrc/Makefile.dep +++ b/sys/net/gnrc/Makefile.dep @@ -28,7 +28,7 @@ ifneq (,$(filter gnrc_lorawan,$(USEMODULE))) USEMODULE += xtimer USEMODULE += random USEMODULE += hashes - USEMODULE += crypto_aes + USEMODULE += crypto_aes_128 USEMODULE += netdev_layer USEMODULE += gnrc_nettype_lorawan endif diff --git a/sys/net/gnrc/link_layer/lorawan/gnrc_lorawan_crypto.c b/sys/net/gnrc/link_layer/lorawan/gnrc_lorawan_crypto.c index 4eb439f4eb..7cc67af245 100644 --- a/sys/net/gnrc/link_layer/lorawan/gnrc_lorawan_crypto.c +++ b/sys/net/gnrc/link_layer/lorawan/gnrc_lorawan_crypto.c @@ -95,7 +95,7 @@ void gnrc_lorawan_encrypt_payload(iolist_t *iolist, const le_uint32_t *dev_addr, lorawan_block_t *block = (lorawan_block_t *)a_block; - cipher_init(&AesContext, CIPHER_AES_128, appskey, LORAMAC_APPKEY_LEN); + cipher_init(&AesContext, CIPHER_AES, appskey, LORAMAC_APPKEY_LEN); block->fb = CRYPT_B0_START; @@ -127,7 +127,7 @@ void gnrc_lorawan_encrypt_payload(iolist_t *iolist, const le_uint32_t *dev_addr, void gnrc_lorawan_decrypt_join_accept(const uint8_t *key, uint8_t *pkt, int has_clist, uint8_t *out) { - cipher_init(&AesContext, CIPHER_AES_128, key, LORAMAC_APPKEY_LEN); + cipher_init(&AesContext, CIPHER_AES, key, LORAMAC_APPKEY_LEN); cipher_encrypt(&AesContext, pkt, out); if (has_clist) { @@ -145,7 +145,7 @@ void gnrc_lorawan_generate_session_keys(const uint8_t *app_nonce, memset(buf, 0, sizeof(buf)); - cipher_init(&AesContext, CIPHER_AES_128, appkey, LORAMAC_APPSKEY_LEN); + cipher_init(&AesContext, CIPHER_AES, appkey, LORAMAC_APPSKEY_LEN); /* net_id comes right after app_nonce */ memcpy(buf + 1, app_nonce, diff --git a/sys/net/link_layer/ieee802154/security.c b/sys/net/link_layer/ieee802154/security.c index 63eedd9fc6..56cacd1177 100644 --- a/sys/net/link_layer/ieee802154/security.c +++ b/sys/net/link_layer/ieee802154/security.c @@ -390,7 +390,7 @@ void ieee802154_sec_init(ieee802154_sec_context_t *ctx) uint8_t key[] = IEEE802154_DEFAULT_KEY; assert(CIPHER_MAX_CONTEXT_SIZE >= IEEE802154_SEC_KEY_LENGTH); - cipher_init(&ctx->cipher, CIPHER_AES_128, key, IEEE802154_SEC_KEY_LENGTH); + cipher_init(&ctx->cipher, CIPHER_AES, key, IEEE802154_SEC_KEY_LENGTH); } int ieee802154_sec_encrypt_frame(ieee802154_sec_context_t *ctx, diff --git a/tests/sys_crypto/Makefile b/tests/sys_crypto/Makefile index 0389e162a0..fc2892f7f9 100644 --- a/tests/sys_crypto/Makefile +++ b/tests/sys_crypto/Makefile @@ -4,5 +4,8 @@ USEMODULE += embunit USEMODULE += crypto_3des USEMODULE += cipher_modes +USEMODULE += crypto_aes_128 +USEMODULE += crypto_aes_192 +USEMODULE += crypto_aes_256 include $(RIOTBASE)/Makefile.include diff --git a/tests/sys_crypto/main.c b/tests/sys_crypto/main.c index 9cf320889e..1ab7debf17 100644 --- a/tests/sys_crypto/main.c +++ b/tests/sys_crypto/main.c @@ -19,6 +19,9 @@ int main(void) TESTS_RUN(tests_crypto_aes_tests()); TESTS_RUN(tests_crypto_cipher_tests()); TESTS_RUN(tests_crypto_modes_ccm_tests()); + TESTS_RUN(tests_crypto_modes_ccm_tests_128()); + TESTS_RUN(tests_crypto_modes_ccm_tests_192()); + TESTS_RUN(tests_crypto_modes_ccm_tests_256()); TESTS_RUN(tests_crypto_modes_ocb_tests()); TESTS_RUN(tests_crypto_modes_ecb_tests()); TESTS_RUN(tests_crypto_modes_cbc_tests()); diff --git a/tests/sys_crypto/tests-crypto-aes.c b/tests/sys_crypto/tests-crypto-aes.c index f7b3e23d6d..fb67fed73c 100644 --- a/tests/sys_crypto/tests-crypto-aes.c +++ b/tests/sys_crypto/tests-crypto-aes.c @@ -91,27 +91,12 @@ static void test_crypto_aes_init_key_length(void) cipher_context_t ctx; int err; - /* A keylength of 192 bit is not supported by the current implementation */ - uint8_t unsupported_key_1[24]; - + /* A keylength of 64 bit is not supported by AES */ + uint8_t unsupported_key_1[8]; memset(unsupported_key_1, 0, sizeof(unsupported_key_1)); - /* A keylength of 256 bit is not supported by the current implementation */ - uint8_t unsupported_key_2[32]; - memset(unsupported_key_2, 0, sizeof(unsupported_key_2)); - - /* A keylength of 64 bit is not supported by AES */ - uint8_t unsupported_key_3[8]; - memset(unsupported_key_3, 0, sizeof(unsupported_key_3)); - err = aes_init(&ctx, unsupported_key_1, sizeof(unsupported_key_1)); TEST_ASSERT_EQUAL_INT(CIPHER_ERR_INVALID_KEY_SIZE, err); - - err = aes_init(&ctx, unsupported_key_2, sizeof(unsupported_key_2)); - TEST_ASSERT_EQUAL_INT(CIPHER_ERR_INVALID_KEY_SIZE, err); - - err = aes_init(&ctx, unsupported_key_3, sizeof(unsupported_key_3)); - TEST_ASSERT_EQUAL_INT(CIPHER_ERR_INVALID_KEY_SIZE, err); } Test *tests_crypto_aes_tests(void) diff --git a/tests/sys_crypto/tests-crypto-cipher.c b/tests/sys_crypto/tests-crypto-cipher.c index 7337bc364a..0eeeecf01c 100644 --- a/tests/sys_crypto/tests-crypto-cipher.c +++ b/tests/sys_crypto/tests-crypto-cipher.c @@ -34,7 +34,7 @@ static void test_crypto_cipher_aes_encrypt(void) int err, cmp; uint8_t data[16] = { 0 }; - err = cipher_init(&cipher, CIPHER_AES_128, TEST_KEY, 16); + err = cipher_init(&cipher, CIPHER_AES, TEST_KEY, 16); TEST_ASSERT_EQUAL_INT(1, err); err = cipher_encrypt(&cipher, TEST_INP, data); @@ -50,7 +50,7 @@ static void test_crypto_cipher_aes_decrypt(void) int err, cmp; uint8_t data[16]; - err = cipher_init(&cipher, CIPHER_AES_128, TEST_KEY, 16); + err = cipher_init(&cipher, CIPHER_AES, TEST_KEY, 16); TEST_ASSERT_EQUAL_INT(1, err); err = cipher_decrypt(&cipher, TEST_ENC_AES, data); @@ -65,33 +65,14 @@ static void test_crypto_cipher_init_aes_key_length(void) cipher_t cipher; int err; - /* A keylength of 192 bit is not supported by the current implementation */ - uint8_t unsupported_key_1[24]; - + /* A keylength of 64 bit is not supported by AES */ + uint8_t unsupported_key_1[8]; memset(unsupported_key_1, 0, sizeof(unsupported_key_1)); - /* A keylength of 256 bit is not supported by the current implementation */ - uint8_t unsupported_key_2[32]; - memset(unsupported_key_2, 0, sizeof(unsupported_key_2)); - - /* A keylength of 64 bit is not supported by AES */ - uint8_t unsupported_key_3[8]; - memset(unsupported_key_3, 0, sizeof(unsupported_key_3)); - err = - cipher_init(&cipher, CIPHER_AES_128, unsupported_key_1, + cipher_init(&cipher, CIPHER_AES, unsupported_key_1, sizeof(unsupported_key_1)); TEST_ASSERT_EQUAL_INT(CIPHER_ERR_INVALID_KEY_SIZE, err); - - err = - cipher_init(&cipher, CIPHER_AES_128, unsupported_key_2, - sizeof(unsupported_key_2)); - TEST_ASSERT_EQUAL_INT(CIPHER_ERR_INVALID_KEY_SIZE, err); - - err = - cipher_init(&cipher, CIPHER_AES_128, unsupported_key_3, - sizeof(unsupported_key_3)); - TEST_ASSERT_EQUAL_INT(CIPHER_ERR_INVALID_KEY_SIZE, err); } Test *tests_crypto_cipher_tests(void) diff --git a/tests/sys_crypto/tests-crypto-modes-cbc.c b/tests/sys_crypto/tests-crypto-modes-cbc.c index c4c0ef618f..bd3f1e0bd3 100644 --- a/tests/sys_crypto/tests-crypto-modes-cbc.c +++ b/tests/sys_crypto/tests-crypto-modes-cbc.c @@ -32,12 +32,27 @@ static uint8_t TEST_1_KEY[] = { }; static uint8_t TEST_1_KEY_LEN = 16; -static uint8_t TEST_1_IV[16] = { +static uint8_t TEST_2_KEY[] = { + 0x8e, 0x73, 0xb0, 0xf7, 0xda, 0x0e, 0x64, 0x52, + 0xc8, 0x10, 0xf3, 0x2b, 0x80, 0x90, 0x79, 0xe5, + 0x62, 0xf8, 0xea, 0xd2, 0x52, 0x2c, 0x6b, 0x7b +}; +static uint8_t TEST_2_KEY_LEN = 24; + +static uint8_t TEST_3_KEY[] = { + 0x60, 0x3d, 0xeb, 0x10, 0x15, 0xca, 0x71, 0xbe, + 0x2b, 0x73, 0xae, 0xf0, 0x85, 0x7d, 0x77, 0x81, + 0x1f, 0x35, 0x2c, 0x07, 0x3b, 0x61, 0x08, 0xd7, + 0x2d, 0x98, 0x10, 0xa3, 0x09, 0x14, 0xdf, 0xf4 +}; +static uint8_t TEST_3_KEY_LEN = 32; + +static uint8_t TEST_IV[16] = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f }; -static uint8_t TEST_1_PLAIN[] = { +static uint8_t TEST_PLAIN[] = { 0x6b, 0xc1, 0xbe, 0xe2, 0x2e, 0x40, 0x9f, 0x96, 0xe9, 0x3d, 0x7e, 0x11, 0x73, 0x93, 0x17, 0x2a, 0xae, 0x2d, 0x8a, 0x57, 0x1e, 0x03, 0xac, 0x9c, @@ -47,7 +62,7 @@ static uint8_t TEST_1_PLAIN[] = { 0xf6, 0x9f, 0x24, 0x45, 0xdf, 0x4f, 0x9b, 0x17, 0xad, 0x2b, 0x41, 0x7b, 0xe6, 0x6c, 0x37, 0x10 }; -static uint8_t TEST_1_PLAIN_LEN = 64; +static uint8_t TEST_PLAIN_LEN = 64; static uint8_t TEST_1_CIPHER[] = { 0x76, 0x49, 0xab, 0xac, 0x81, 0x19, 0xb2, 0x46, @@ -59,9 +74,31 @@ static uint8_t TEST_1_CIPHER[] = { 0x3f, 0xf1, 0xca, 0xa1, 0x68, 0x1f, 0xac, 0x09, 0x12, 0x0e, 0xca, 0x30, 0x75, 0x86, 0xe1, 0xa7 }; -static uint8_t TEST_1_CIPHER_LEN = 64; -static void test_encrypt_op(uint8_t *key, uint8_t key_len, uint8_t iv[16], +static uint8_t TEST_2_CIPHER[] = { + 0x4f, 0x02, 0x1d, 0xb2, 0x43, 0xbc, 0x63, 0x3d, + 0x71, 0x78, 0x18, 0x3a, 0x9f, 0xa0, 0x71, 0xe8, + 0xb4, 0xd9, 0xad, 0xa9, 0xad, 0x7d, 0xed, 0xf4, + 0xe5, 0xe7, 0x38, 0x76, 0x3f, 0x69, 0x14, 0x5a, + 0x57, 0x1b, 0x24, 0x20, 0x12, 0xfb, 0x7a, 0xe0, + 0x7f, 0xa9, 0xba, 0xac, 0x3d, 0xf1, 0x02, 0xe0, + 0x08, 0xb0, 0xe2, 0x79, 0x88, 0x59, 0x88, 0x81, + 0xd9, 0x20, 0xa9, 0xe6, 0x4f, 0x56, 0x15, 0xcd +}; + +static uint8_t TEST_3_CIPHER[] = { + 0xf5, 0x8c, 0x4c, 0x04, 0xd6, 0xe5, 0xf1, 0xba, + 0x77, 0x9e, 0xab, 0xfb, 0x5f, 0x7b, 0xfb, 0xd6, + 0x9c, 0xfc, 0x4e, 0x96, 0x7e, 0xdb, 0x80, 0x8d, + 0x67, 0x9f, 0x77, 0x7b, 0xc6, 0x70, 0x2c, 0x7d, + 0x39, 0xf2, 0x33, 0x69, 0xa9, 0xd9, 0xba, 0xcf, + 0xa5, 0x30, 0xe2, 0x63, 0x04, 0x23, 0x14, 0x61, + 0xb2, 0xeb, 0x05, 0xe2, 0xc3, 0x9b, 0xe9, 0xfc, + 0xda, 0x6c, 0x19, 0x07, 0x8c, 0x6a, 0x9d, 0x1b +}; +static uint8_t TEST_CIPHER_LEN = 64; + +static void test_encrypt_op_128(uint8_t *key, uint8_t key_len, uint8_t iv[16], uint8_t *input, uint8_t input_len, uint8_t *output, uint8_t output_len) { @@ -69,7 +106,7 @@ static void test_encrypt_op(uint8_t *key, uint8_t key_len, uint8_t iv[16], int len, err, cmp; uint8_t data[64]; - err = cipher_init(&cipher, CIPHER_AES_128, key, key_len); + err = cipher_init(&cipher, CIPHER_AES, key, key_len); TEST_ASSERT_EQUAL_INT(1, err); len = cipher_encrypt_cbc(&cipher, iv, input, input_len, data); @@ -81,7 +118,7 @@ static void test_encrypt_op(uint8_t *key, uint8_t key_len, uint8_t iv[16], } -static void test_decrypt_op(uint8_t *key, uint8_t key_len, uint8_t iv[16], +static void test_encrypt_op_192(uint8_t *key, uint8_t key_len, uint8_t iv[16], uint8_t *input, uint8_t input_len, uint8_t *output, uint8_t output_len) { @@ -89,10 +126,29 @@ static void test_decrypt_op(uint8_t *key, uint8_t key_len, uint8_t iv[16], int len, err, cmp; uint8_t data[64]; - err = cipher_init(&cipher, CIPHER_AES_128, key, key_len); + err = cipher_init(&cipher, CIPHER_AES, key, key_len); TEST_ASSERT_EQUAL_INT(1, err); - len = cipher_decrypt_cbc(&cipher, iv, input, input_len, data); + len = cipher_encrypt_cbc(&cipher, iv, input, input_len, data); + TEST_ASSERT_MESSAGE(len > 0, "Encryption failed"); + + TEST_ASSERT_EQUAL_INT(output_len, len); + cmp = compare(output, data, len); + TEST_ASSERT_MESSAGE(1 == cmp, "wrong ciphertext"); +} + +static void test_encrypt_op_256(uint8_t *key, uint8_t key_len, uint8_t iv[16], + uint8_t *input, uint8_t input_len, uint8_t *output, + uint8_t output_len) +{ + cipher_t cipher; + int len, err, cmp; + uint8_t data[64]; + + err = cipher_init(&cipher, CIPHER_AES, key, key_len); + TEST_ASSERT_EQUAL_INT(1, err); + + len = cipher_encrypt_cbc(&cipher, iv, input, input_len, data); TEST_ASSERT_MESSAGE(len > 0, "Encryption failed"); TEST_ASSERT_EQUAL_INT(output_len, len); @@ -101,16 +157,88 @@ static void test_decrypt_op(uint8_t *key, uint8_t key_len, uint8_t iv[16], } +static void test_decrypt_op_128(uint8_t *key, uint8_t key_len, uint8_t iv[16], + uint8_t *input, uint8_t input_len, uint8_t *output, + uint8_t output_len) +{ + cipher_t cipher; + int len, err, cmp; + uint8_t data[64]; + + err = cipher_init(&cipher, CIPHER_AES, key, key_len); + TEST_ASSERT_EQUAL_INT(1, err); + + len = cipher_decrypt_cbc(&cipher, iv, input, input_len, data); + TEST_ASSERT_MESSAGE(len > 0, "Decryption failed"); + + TEST_ASSERT_EQUAL_INT(output_len, len); + cmp = compare(output, data, len); + TEST_ASSERT_MESSAGE(1 == cmp, "wrong plaintext"); + +} + +static void test_decrypt_op_192(uint8_t *key, uint8_t key_len, uint8_t iv[16], + uint8_t *input, uint8_t input_len, uint8_t *output, + uint8_t output_len) +{ + cipher_t cipher; + int len, err, cmp; + uint8_t data[64]; + + err = cipher_init(&cipher, CIPHER_AES, key, key_len); + TEST_ASSERT_EQUAL_INT(1, err); + + len = cipher_decrypt_cbc(&cipher, iv, input, input_len, data); + TEST_ASSERT_MESSAGE(len > 0, "Decryption failed"); + + TEST_ASSERT_EQUAL_INT(output_len, len); + cmp = compare(output, data, len); + TEST_ASSERT_MESSAGE(1 == cmp, "wrong plaintext"); + +} + +static void test_decrypt_op_256(uint8_t *key, uint8_t key_len, uint8_t iv[16], + uint8_t *input, uint8_t input_len, uint8_t *output, + uint8_t output_len) +{ + cipher_t cipher; + int len, err, cmp; + uint8_t data[64]; + + err = cipher_init(&cipher, CIPHER_AES, key, key_len); + TEST_ASSERT_EQUAL_INT(1, err); + + len = cipher_decrypt_cbc(&cipher, iv, input, input_len, data); + TEST_ASSERT_MESSAGE(len > 0, "Decryption failed"); + + TEST_ASSERT_EQUAL_INT(output_len, len); + cmp = compare(output, data, len); + TEST_ASSERT_MESSAGE(1 == cmp, "wrong plaintext"); + +} + static void test_crypto_modes_cbc_encrypt(void) { - test_encrypt_op(TEST_1_KEY, TEST_1_KEY_LEN, TEST_1_IV, TEST_1_PLAIN, - TEST_1_PLAIN_LEN, TEST_1_CIPHER, TEST_1_CIPHER_LEN); + test_encrypt_op_128(TEST_1_KEY, TEST_1_KEY_LEN, TEST_IV, TEST_PLAIN, + TEST_PLAIN_LEN, TEST_1_CIPHER, TEST_CIPHER_LEN); + + test_encrypt_op_192(TEST_2_KEY, TEST_2_KEY_LEN, TEST_IV, TEST_PLAIN, + TEST_PLAIN_LEN, TEST_2_CIPHER, TEST_CIPHER_LEN); + + test_encrypt_op_256(TEST_3_KEY, TEST_3_KEY_LEN, TEST_IV, TEST_PLAIN, + TEST_PLAIN_LEN, TEST_3_CIPHER, TEST_CIPHER_LEN); } static void test_crypto_modes_cbc_decrypt(void) { - test_decrypt_op(TEST_1_KEY, TEST_1_KEY_LEN, TEST_1_IV, TEST_1_CIPHER, - TEST_1_CIPHER_LEN, TEST_1_PLAIN, TEST_1_PLAIN_LEN); + test_decrypt_op_128(TEST_1_KEY, TEST_1_KEY_LEN, TEST_IV, TEST_1_CIPHER, + TEST_CIPHER_LEN, TEST_PLAIN, TEST_PLAIN_LEN); + + test_decrypt_op_192(TEST_2_KEY, TEST_2_KEY_LEN, TEST_IV, TEST_2_CIPHER, + TEST_CIPHER_LEN, TEST_PLAIN, TEST_PLAIN_LEN); + + test_decrypt_op_256(TEST_3_KEY, TEST_3_KEY_LEN, TEST_IV, TEST_3_CIPHER, + TEST_CIPHER_LEN, TEST_PLAIN, TEST_PLAIN_LEN); } diff --git a/tests/sys_crypto/tests-crypto-modes-ccm.c b/tests/sys_crypto/tests-crypto-modes-ccm.c index ea6be9724b..d623e9fde5 100644 --- a/tests/sys_crypto/tests-crypto-modes-ccm.c +++ b/tests/sys_crypto/tests-crypto-modes-ccm.c @@ -1105,7 +1105,7 @@ static void test_encrypt_op(const uint8_t *key, uint8_t key_len, TEST_ASSERT_MESSAGE(sizeof(data) >= output_expected_len, "Output buffer too small"); - err = cipher_init(&cipher, CIPHER_AES_128, key, key_len); + err = cipher_init(&cipher, CIPHER_AES, key, key_len); TEST_ASSERT_EQUAL_INT(1, err); len = cipher_encrypt_ccm(&cipher, adata, adata_len, @@ -1133,7 +1133,7 @@ static void test_decrypt_op(const uint8_t *key, uint8_t key_len, TEST_ASSERT_MESSAGE(sizeof(data) >= output_expected_len, "Output buffer too small"); - err = cipher_init(&cipher, CIPHER_AES_128, key, key_len); + err = cipher_init(&cipher, CIPHER_AES, key, key_len); TEST_ASSERT_EQUAL_INT(1, err); len = cipher_decrypt_ccm(&cipher, adata, adata_len, @@ -1271,7 +1271,7 @@ static int _test_ccm_len(func_ccm_t func, uint8_t len_encoding, uint8_t nonce_len = nonce_and_len_encoding_size - len_encoding; - cipher_init(&cipher, CIPHER_AES_128, key, 16); + cipher_init(&cipher, CIPHER_AES, key, 16); ret = func(&cipher, NULL, adata_len, mac_length, len_encoding, nonce, nonce_len, input, input_len, data); diff --git a/tests/sys_crypto/tests-crypto-modes-ctr.c b/tests/sys_crypto/tests-crypto-modes-ctr.c index ee506ae8a6..d6c0257326 100644 --- a/tests/sys_crypto/tests-crypto-modes-ctr.c +++ b/tests/sys_crypto/tests-crypto-modes-ctr.c @@ -32,12 +32,27 @@ static uint8_t TEST_1_KEY[] = { }; static uint8_t TEST_1_KEY_LEN = 16; -static uint8_t TEST_1_COUNTER[16] = { +static uint8_t TEST_2_KEY[] = { + 0x8e, 0x73, 0xb0, 0xf7, 0xda, 0x0e, 0x64, 0x52, + 0xc8, 0x10, 0xf3, 0x2b, 0x80, 0x90, 0x79, 0xe5, + 0x62, 0xf8, 0xea, 0xd2, 0x52, 0x2c, 0x6b, 0x7b +}; +static uint8_t TEST_2_KEY_LEN = 24; + +static uint8_t TEST_3_KEY[] = { + 0x60, 0x3d, 0xeb, 0x10, 0x15, 0xca, 0x71, 0xbe, + 0x2b, 0x73, 0xae, 0xf0, 0x85, 0x7d, 0x77, 0x81, + 0x1f, 0x35, 0x2c, 0x07, 0x3b, 0x61, 0x08, 0xd7, + 0x2d, 0x98, 0x10, 0xa3, 0x09, 0x14, 0xdf, 0xf4 +}; +static uint8_t TEST_3_KEY_LEN = 32; + +static uint8_t TEST_COUNTER[16] = { 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff }; -static uint8_t TEST_1_PLAIN[] = { +static uint8_t TEST_PLAIN[] = { 0x6b, 0xc1, 0xbe, 0xe2, 0x2e, 0x40, 0x9f, 0x96, 0xe9, 0x3d, 0x7e, 0x11, 0x73, 0x93, 0x17, 0x2a, 0xae, 0x2d, 0x8a, 0x57, 0x1e, 0x03, 0xac, 0x9c, @@ -47,7 +62,7 @@ static uint8_t TEST_1_PLAIN[] = { 0xf6, 0x9f, 0x24, 0x45, 0xdf, 0x4f, 0x9b, 0x17, 0xad, 0x2b, 0x41, 0x7b, 0xe6, 0x6c, 0x37, 0x10 }; -static uint8_t TEST_1_PLAIN_LEN = 64; +static uint8_t TEST_PLAIN_LEN = 64; static uint8_t TEST_1_CIPHER[] = { 0x87, 0x4d, 0x61, 0x91, 0xb6, 0x20, 0xe3, 0x26, @@ -59,9 +74,31 @@ static uint8_t TEST_1_CIPHER[] = { 0x1e, 0x03, 0x1d, 0xda, 0x2f, 0xbe, 0x03, 0xd1, 0x79, 0x21, 0x70, 0xa0, 0xf3, 0x00, 0x9c, 0xee }; -static uint8_t TEST_1_CIPHER_LEN = 64; -static void test_encrypt_op(uint8_t *key, uint8_t key_len, uint8_t ctr[16], +static uint8_t TEST_2_CIPHER[] = { + 0x1a, 0xbc, 0x93, 0x24, 0x17, 0x52, 0x1c, 0xa2, + 0x4f, 0x2b, 0x04, 0x59, 0xfe, 0x7e, 0x6e, 0x0b, + 0x09, 0x03, 0x39, 0xec, 0x0a, 0xa6, 0xfa, 0xef, + 0xd5, 0xcc, 0xc2, 0xc6, 0xf4, 0xce, 0x8e, 0x94, + 0x1e, 0x36, 0xb2, 0x6b, 0xd1, 0xeb, 0xc6, 0x70, + 0xd1, 0xbd, 0x1d, 0x66, 0x56, 0x20, 0xab, 0xf7, + 0x4f, 0x78, 0xa7, 0xf6, 0xd2, 0x98, 0x09, 0x58, + 0x5a, 0x97, 0xda, 0xec, 0x58, 0xc6, 0xb0, 0x50 +}; + +static uint8_t TEST_3_CIPHER[] = { + 0x60, 0x1e, 0xc3, 0x13, 0x77, 0x57, 0x89, 0xa5, + 0xb7, 0xa7, 0xf5, 0x04, 0xbb, 0xf3, 0xd2, 0x28, + 0xf4, 0x43, 0xe3, 0xca, 0x4d, 0x62, 0xb5, 0x9a, + 0xca, 0x84, 0xe9, 0x90, 0xca, 0xca, 0xf5, 0xc5, + 0x2b, 0x09, 0x30, 0xda, 0xa2, 0x3d, 0xe9, 0x4c, + 0xe8, 0x70, 0x17, 0xba, 0x2d, 0x84, 0x98, 0x8d, + 0xdf, 0xc9, 0xc5, 0x8d, 0xb6, 0x7a, 0xad, 0xa6, + 0x13, 0xc2, 0xdd, 0x08, 0x45, 0x79, 0x41, 0xa6 +}; +static uint8_t TEST_CIPHER_LEN = 64; + +static void test_encrypt_op_128(uint8_t *key, uint8_t key_len, uint8_t ctr[16], uint8_t *input, uint8_t input_len, uint8_t *output, uint8_t output_len) { @@ -69,7 +106,7 @@ static void test_encrypt_op(uint8_t *key, uint8_t key_len, uint8_t ctr[16], int len, err, cmp; uint8_t data[64]; - err = cipher_init(&cipher, CIPHER_AES_128, key, key_len); + err = cipher_init(&cipher, CIPHER_AES, key, key_len); TEST_ASSERT_EQUAL_INT(1, err); len = cipher_encrypt_ctr(&cipher, ctr, 0, input, input_len, data); @@ -81,7 +118,7 @@ static void test_encrypt_op(uint8_t *key, uint8_t key_len, uint8_t ctr[16], } -static void test_decrypt_op(uint8_t *key, uint8_t key_len, uint8_t ctr[16], +static void test_encrypt_op_192(uint8_t *key, uint8_t key_len, uint8_t ctr[16], uint8_t *input, uint8_t input_len, uint8_t *output, uint8_t output_len) { @@ -89,7 +126,45 @@ static void test_decrypt_op(uint8_t *key, uint8_t key_len, uint8_t ctr[16], int len, err, cmp; uint8_t data[64]; - err = cipher_init(&cipher, CIPHER_AES_128, key, key_len); + err = cipher_init(&cipher, CIPHER_AES, key, key_len); + TEST_ASSERT_EQUAL_INT(1, err); + + len = cipher_encrypt_ctr(&cipher, ctr, 0, input, input_len, data); + TEST_ASSERT_MESSAGE(len > 0, "Encryption failed"); + + TEST_ASSERT_EQUAL_INT(output_len, len); + cmp = compare(output, data, len); + TEST_ASSERT_MESSAGE(1 == cmp, "wrong ciphertext"); +} + +static void test_encrypt_op_256(uint8_t *key, uint8_t key_len, uint8_t ctr[16], + uint8_t *input, uint8_t input_len, uint8_t *output, + uint8_t output_len) +{ + cipher_t cipher; + int len, err, cmp; + uint8_t data[64]; + + err = cipher_init(&cipher, CIPHER_AES, key, key_len); + TEST_ASSERT_EQUAL_INT(1, err); + + len = cipher_encrypt_ctr(&cipher, ctr, 0, input, input_len, data); + TEST_ASSERT_MESSAGE(len > 0, "Encryption failed"); + + TEST_ASSERT_EQUAL_INT(output_len, len); + cmp = compare(output, data, len); + TEST_ASSERT_MESSAGE(1 == cmp, "wrong ciphertext"); +} + +static void test_decrypt_op_128(uint8_t *key, uint8_t key_len, uint8_t ctr[16], + uint8_t *input, uint8_t input_len, uint8_t *output, + uint8_t output_len) +{ + cipher_t cipher; + int len, err, cmp; + uint8_t data[64]; + + err = cipher_init(&cipher, CIPHER_AES, key, key_len); TEST_ASSERT_EQUAL_INT(1, err); len = cipher_decrypt_ctr(&cipher, ctr, 0, input, input_len, data); @@ -98,25 +173,78 @@ static void test_decrypt_op(uint8_t *key, uint8_t key_len, uint8_t ctr[16], TEST_ASSERT_EQUAL_INT(output_len, len); cmp = compare(output, data, len); TEST_ASSERT_MESSAGE(1 == cmp, "wrong ciphertext"); +} +static void test_decrypt_op_192(uint8_t *key, uint8_t key_len, uint8_t ctr[16], + uint8_t *input, uint8_t input_len, uint8_t *output, + uint8_t output_len) +{ + cipher_t cipher; + int len, err, cmp; + uint8_t data[64]; + + err = cipher_init(&cipher, CIPHER_AES, key, key_len); + TEST_ASSERT_EQUAL_INT(1, err); + + len = cipher_decrypt_ctr(&cipher, ctr, 0, input, input_len, data); + TEST_ASSERT_MESSAGE(len > 0, "Encryption failed"); + + TEST_ASSERT_EQUAL_INT(output_len, len); + cmp = compare(output, data, len); + TEST_ASSERT_MESSAGE(1 == cmp, "wrong ciphertext"); +} + +static void test_decrypt_op_256(uint8_t *key, uint8_t key_len, uint8_t ctr[16], + uint8_t *input, uint8_t input_len, uint8_t *output, + uint8_t output_len) +{ + cipher_t cipher; + int len, err, cmp; + uint8_t data[64]; + + err = cipher_init(&cipher, CIPHER_AES, key, key_len); + TEST_ASSERT_EQUAL_INT(1, err); + + len = cipher_decrypt_ctr(&cipher, ctr, 0, input, input_len, data); + TEST_ASSERT_MESSAGE(len > 0, "Encryption failed"); + + TEST_ASSERT_EQUAL_INT(output_len, len); + cmp = compare(output, data, len); + TEST_ASSERT_MESSAGE(1 == cmp, "wrong ciphertext"); } static void test_crypto_modes_ctr_encrypt(void) { uint8_t ctr[16]; - memcpy(ctr, TEST_1_COUNTER, 16); - test_encrypt_op(TEST_1_KEY, TEST_1_KEY_LEN, ctr, TEST_1_PLAIN, - TEST_1_PLAIN_LEN, TEST_1_CIPHER, TEST_1_CIPHER_LEN); + memcpy(ctr, TEST_COUNTER, 16); + test_encrypt_op_128(TEST_1_KEY, TEST_1_KEY_LEN, ctr, TEST_PLAIN, + TEST_PLAIN_LEN, TEST_1_CIPHER, TEST_CIPHER_LEN); + + memcpy(ctr, TEST_COUNTER, 16); + test_encrypt_op_192(TEST_2_KEY, TEST_2_KEY_LEN, ctr, TEST_PLAIN, + TEST_PLAIN_LEN, TEST_2_CIPHER, TEST_CIPHER_LEN); + + memcpy(ctr, TEST_COUNTER, 16); + test_encrypt_op_256(TEST_3_KEY, TEST_3_KEY_LEN, ctr, TEST_PLAIN, + TEST_PLAIN_LEN, TEST_3_CIPHER, TEST_CIPHER_LEN); } static void test_crypto_modes_ctr_decrypt(void) { uint8_t ctr[16]; - memcpy(ctr, TEST_1_COUNTER, 16); - test_decrypt_op(TEST_1_KEY, TEST_1_KEY_LEN, ctr, TEST_1_CIPHER, - TEST_1_CIPHER_LEN, TEST_1_PLAIN, TEST_1_PLAIN_LEN); + memcpy(ctr, TEST_COUNTER, 16); + test_decrypt_op_128(TEST_1_KEY, TEST_1_KEY_LEN, ctr, TEST_1_CIPHER, + TEST_CIPHER_LEN, TEST_PLAIN, TEST_PLAIN_LEN); + + memcpy(ctr, TEST_COUNTER, 16); + test_decrypt_op_192(TEST_2_KEY, TEST_2_KEY_LEN, ctr, TEST_2_CIPHER, + TEST_CIPHER_LEN, TEST_PLAIN, TEST_PLAIN_LEN); + + memcpy(ctr, TEST_COUNTER, 16); + test_decrypt_op_256(TEST_3_KEY, TEST_3_KEY_LEN, ctr, TEST_3_CIPHER, + TEST_CIPHER_LEN, TEST_PLAIN, TEST_PLAIN_LEN); } diff --git a/tests/sys_crypto/tests-crypto-modes-ecb.c b/tests/sys_crypto/tests-crypto-modes-ecb.c index c7091bddcd..151d11dcd4 100644 --- a/tests/sys_crypto/tests-crypto-modes-ecb.c +++ b/tests/sys_crypto/tests-crypto-modes-ecb.c @@ -32,7 +32,22 @@ static uint8_t TEST_1_KEY[] = { }; static uint8_t TEST_1_KEY_LEN = 16; -static uint8_t TEST_1_PLAIN[] = { +static uint8_t TEST_2_KEY[] = { + 0x8e, 0x73, 0xb0, 0xf7, 0xda, 0x0e, 0x64, 0x52, + 0xc8, 0x10, 0xf3, 0x2b, 0x80, 0x90, 0x79, 0xe5, + 0x62, 0xf8, 0xea, 0xd2, 0x52, 0x2c, 0x6b, 0x7b +}; +static uint8_t TEST_2_KEY_LEN = 24; + +static uint8_t TEST_3_KEY[] = { + 0x60, 0x3d, 0xeb, 0x10, 0x15, 0xca, 0x71, 0xbe, + 0x2b, 0x73, 0xae, 0xf0, 0x85, 0x7d, 0x77, 0x81, + 0x1f, 0x35, 0x2c, 0x07, 0x3b, 0x61, 0x08, 0xd7, + 0x2d, 0x98, 0x10, 0xa3, 0x09, 0x14, 0xdf, 0xf4 +}; +static uint8_t TEST_3_KEY_LEN = 32; + +static uint8_t TEST_PLAIN[] = { 0x6b, 0xc1, 0xbe, 0xe2, 0x2e, 0x40, 0x9f, 0x96, 0xe9, 0x3d, 0x7e, 0x11, 0x73, 0x93, 0x17, 0x2a, 0xae, 0x2d, 0x8a, 0x57, 0x1e, 0x03, 0xac, 0x9c, @@ -42,7 +57,7 @@ static uint8_t TEST_1_PLAIN[] = { 0xf6, 0x9f, 0x24, 0x45, 0xdf, 0x4f, 0x9b, 0x17, 0xad, 0x2b, 0x41, 0x7b, 0xe6, 0x6c, 0x37, 0x10 }; -static uint8_t TEST_1_PLAIN_LEN = 64; +static uint8_t TEST_PLAIN_LEN = 64; static uint8_t TEST_1_CIPHER[] = { 0x3a, 0xd7, 0x7b, 0xb4, 0x0d, 0x7a, 0x36, 0x60, @@ -54,9 +69,31 @@ static uint8_t TEST_1_CIPHER[] = { 0x7b, 0x0c, 0x78, 0x5e, 0x27, 0xe8, 0xad, 0x3f, 0x82, 0x23, 0x20, 0x71, 0x04, 0x72, 0x5d, 0xd4 }; -static uint8_t TEST_1_CIPHER_LEN = 64; -static void test_encrypt_op(uint8_t *key, uint8_t key_len, uint8_t *input, +static uint8_t TEST_2_CIPHER[] = { + 0xbd, 0x33, 0x4f, 0x1d, 0x6e, 0x45, 0xf2, 0x5f, + 0xf7, 0x12, 0xa2, 0x14, 0x57, 0x1f, 0xa5, 0xcc, + 0x97, 0x41, 0x04, 0x84, 0x6d, 0x0a, 0xd3, 0xad, + 0x77, 0x34, 0xec, 0xb3, 0xec, 0xee, 0x4e, 0xef, + 0xef, 0x7a, 0xfd, 0x22, 0x70, 0xe2, 0xe6, 0x0a, + 0xdc, 0xe0, 0xba, 0x2f, 0xac, 0xe6, 0x44, 0x4e, + 0x9a, 0x4b, 0x41, 0xba, 0x73, 0x8d, 0x6c, 0x72, + 0xfb, 0x16, 0x69, 0x16, 0x03, 0xc1, 0x8e, 0x0e +}; + +static uint8_t TEST_3_CIPHER[] = { + 0xf3, 0xee, 0xd1, 0xbd, 0xb5, 0xd2, 0xa0, 0x3c, + 0x06, 0x4b, 0x5a, 0x7e, 0x3d, 0xb1, 0x81, 0xf8, + 0x59, 0x1c, 0xcb, 0x10, 0xd4, 0x10, 0xed, 0x26, + 0xdc, 0x5b, 0xa7, 0x4a, 0x31, 0x36, 0x28, 0x70, + 0xb6, 0xed, 0x21, 0xb9, 0x9c, 0xa6, 0xf4, 0xf9, + 0xf1, 0x53, 0xe7, 0xb1, 0xbe, 0xaf, 0xed, 0x1d, + 0x23, 0x30, 0x4b, 0x7a, 0x39, 0xf9, 0xf3, 0xff, + 0x06, 0x7d, 0x8d, 0x8f, 0x9e, 0x24, 0xec, 0xc7 +}; +static uint8_t TEST_CIPHER_LEN = 64; + +static void test_encrypt_op_128(uint8_t *key, uint8_t key_len, uint8_t *input, uint8_t input_len, uint8_t *output, uint8_t output_len) { @@ -64,7 +101,7 @@ static void test_encrypt_op(uint8_t *key, uint8_t key_len, uint8_t *input, int len, err, cmp; uint8_t data[64]; - err = cipher_init(&cipher, CIPHER_AES_128, key, key_len); + err = cipher_init(&cipher, CIPHER_AES, key, key_len); TEST_ASSERT_EQUAL_INT(1, err); len = cipher_encrypt_ecb(&cipher, input, input_len, data); @@ -76,7 +113,7 @@ static void test_encrypt_op(uint8_t *key, uint8_t key_len, uint8_t *input, } -static void test_decrypt_op(uint8_t *key, uint8_t key_len, uint8_t *input, +static void test_encrypt_op_192(uint8_t *key, uint8_t key_len, uint8_t *input, uint8_t input_len, uint8_t *output, uint8_t output_len) { @@ -84,7 +121,87 @@ static void test_decrypt_op(uint8_t *key, uint8_t key_len, uint8_t *input, int len, err, cmp; uint8_t data[64]; - err = cipher_init(&cipher, CIPHER_AES_128, key, key_len); + err = cipher_init(&cipher, CIPHER_AES, key, key_len); + TEST_ASSERT_EQUAL_INT(1, err); + + len = cipher_encrypt_ecb(&cipher, input, input_len, data); + TEST_ASSERT_MESSAGE(len > 0, "Encryption failed"); + + TEST_ASSERT_EQUAL_INT(output_len, len); + cmp = compare(output, data, len); + TEST_ASSERT_MESSAGE(1 == cmp, "wrong ciphertext"); + +} + +static void test_encrypt_op_256(uint8_t *key, uint8_t key_len, uint8_t *input, + uint8_t input_len, uint8_t *output, + uint8_t output_len) +{ + cipher_t cipher; + int len, err, cmp; + uint8_t data[64]; + + err = cipher_init(&cipher, CIPHER_AES, key, key_len); + TEST_ASSERT_EQUAL_INT(1, err); + + len = cipher_encrypt_ecb(&cipher, input, input_len, data); + TEST_ASSERT_MESSAGE(len > 0, "Encryption failed"); + + TEST_ASSERT_EQUAL_INT(output_len, len); + cmp = compare(output, data, len); + TEST_ASSERT_MESSAGE(1 == cmp, "wrong ciphertext"); + +} + +static void test_decrypt_op_128(uint8_t *key, uint8_t key_len, uint8_t *input, + uint8_t input_len, uint8_t *output, + uint8_t output_len) +{ + cipher_t cipher; + int len, err, cmp; + uint8_t data[64]; + + err = cipher_init(&cipher, CIPHER_AES, key, key_len); + TEST_ASSERT_EQUAL_INT(1, err); + + len = cipher_decrypt_ecb(&cipher, input, input_len, data); + TEST_ASSERT_MESSAGE(len > 0, "Encryption failed"); + + TEST_ASSERT_EQUAL_INT(output_len, len); + cmp = compare(output, data, len); + TEST_ASSERT_MESSAGE(1 == cmp, "wrong ciphertext"); + +} + +static void test_decrypt_op_192(uint8_t *key, uint8_t key_len, uint8_t *input, + uint8_t input_len, uint8_t *output, + uint8_t output_len) +{ + cipher_t cipher; + int len, err, cmp; + uint8_t data[64]; + + err = cipher_init(&cipher, CIPHER_AES, key, key_len); + TEST_ASSERT_EQUAL_INT(1, err); + + len = cipher_decrypt_ecb(&cipher, input, input_len, data); + TEST_ASSERT_MESSAGE(len > 0, "Encryption failed"); + + TEST_ASSERT_EQUAL_INT(output_len, len); + cmp = compare(output, data, len); + TEST_ASSERT_MESSAGE(1 == cmp, "wrong ciphertext"); + +} + +static void test_decrypt_op_256(uint8_t *key, uint8_t key_len, uint8_t *input, + uint8_t input_len, uint8_t *output, + uint8_t output_len) +{ + cipher_t cipher; + int len, err, cmp; + uint8_t data[64]; + + err = cipher_init(&cipher, CIPHER_AES, key, key_len); TEST_ASSERT_EQUAL_INT(1, err); len = cipher_decrypt_ecb(&cipher, input, input_len, data); @@ -98,17 +215,30 @@ static void test_decrypt_op(uint8_t *key, uint8_t key_len, uint8_t *input, static void test_crypto_modes_ecb_encrypt(void) { - test_encrypt_op(TEST_1_KEY, TEST_1_KEY_LEN, TEST_1_PLAIN, TEST_1_PLAIN_LEN, - TEST_1_CIPHER, TEST_1_CIPHER_LEN); + test_encrypt_op_128(TEST_1_KEY, TEST_1_KEY_LEN, TEST_PLAIN, TEST_PLAIN_LEN, + TEST_1_CIPHER, TEST_CIPHER_LEN); + + test_encrypt_op_192(TEST_2_KEY, TEST_2_KEY_LEN, TEST_PLAIN, TEST_PLAIN_LEN, + TEST_2_CIPHER, TEST_CIPHER_LEN); + + test_encrypt_op_256(TEST_3_KEY, TEST_3_KEY_LEN, TEST_PLAIN, TEST_PLAIN_LEN, + TEST_3_CIPHER, TEST_CIPHER_LEN); } static void test_crypto_modes_ecb_decrypt(void) { - test_decrypt_op(TEST_1_KEY, TEST_1_KEY_LEN, TEST_1_CIPHER, - TEST_1_CIPHER_LEN, - TEST_1_PLAIN, TEST_1_PLAIN_LEN); -} + test_decrypt_op_128(TEST_1_KEY, TEST_1_KEY_LEN, TEST_1_CIPHER, + TEST_CIPHER_LEN, + TEST_PLAIN, TEST_PLAIN_LEN); + test_decrypt_op_192(TEST_2_KEY, TEST_2_KEY_LEN, TEST_2_CIPHER, + TEST_CIPHER_LEN, + TEST_PLAIN, TEST_PLAIN_LEN); + + test_decrypt_op_256(TEST_2_KEY, TEST_2_KEY_LEN, TEST_2_CIPHER, + TEST_CIPHER_LEN, + TEST_PLAIN, TEST_PLAIN_LEN); +} Test *tests_crypto_modes_ecb_tests(void) { diff --git a/tests/sys_crypto/tests-crypto-modes-ocb.c b/tests/sys_crypto/tests-crypto-modes-ocb.c index ac9403d0ca..70209155bc 100644 --- a/tests/sys_crypto/tests-crypto-modes-ocb.c +++ b/tests/sys_crypto/tests-crypto-modes-ocb.c @@ -277,7 +277,7 @@ static void test_encrypt_op(uint8_t *key, uint8_t key_len, TEST_ASSERT_MESSAGE(sizeof(data) >= output_expected_len, "Output buffer too small"); - err = cipher_init(&cipher, CIPHER_AES_128, key, key_len); + err = cipher_init(&cipher, CIPHER_AES, key, key_len); TEST_ASSERT_EQUAL_INT(1, err); len = cipher_encrypt_ocb(&cipher, adata, adata_len, @@ -327,7 +327,7 @@ static void test_decrypt_op(uint8_t *key, uint8_t key_len, TEST_ASSERT_MESSAGE(sizeof(data) >= output_expected_len, "Output buffer too small"); - err = cipher_init(&cipher, CIPHER_AES_128, key, key_len); + err = cipher_init(&cipher, CIPHER_AES, key, key_len); TEST_ASSERT_EQUAL_INT(1, err); len = cipher_decrypt_ocb(&cipher, adata, adata_len, @@ -412,7 +412,7 @@ static void test_crypto_modes_ocb_bad_parameter_values(void) uint8_t key[16], auth_data[1], nonce[16], input[16], output[32]; cipher_t cipher; - cipher_init(&cipher, CIPHER_AES_128, key, 16); + cipher_init(&cipher, CIPHER_AES, key, 16); /* tag length must be positive */ int rv = cipher_encrypt_ocb(&cipher, auth_data, sizeof(auth_data), 0, nonce, 15, input, sizeof(input), output); diff --git a/tests/sys_crypto/tests-crypto.h b/tests/sys_crypto/tests-crypto.h index eddf2d73ba..b316b50d06 100644 --- a/tests/sys_crypto/tests-crypto.h +++ b/tests/sys_crypto/tests-crypto.h @@ -59,6 +59,9 @@ static inline int compare(const uint8_t *a, const uint8_t *b, uint8_t len) Test* tests_crypto_aes_tests(void); Test* tests_crypto_cipher_tests(void); Test* tests_crypto_modes_ccm_tests(void); +Test* tests_crypto_modes_ccm_tests_128(void); +Test* tests_crypto_modes_ccm_tests_192(void); +Test* tests_crypto_modes_ccm_tests_256(void); Test* tests_crypto_modes_ocb_tests(void); Test* tests_crypto_modes_ecb_tests(void); Test* tests_crypto_modes_cbc_tests(void); diff --git a/tests/unittests/tests-hashes/Makefile.include b/tests/unittests/tests-hashes/Makefile.include index d25437ed3f..9c5493cf91 100644 --- a/tests/unittests/tests-hashes/Makefile.include +++ b/tests/unittests/tests-hashes/Makefile.include @@ -1,2 +1,2 @@ USEMODULE += hashes -USEMODULE += crypto_aes +USEMODULE += crypto_aes_128 From b1a2d4787df5a0a0982d9b87b768d3a039638046 Mon Sep 17 00:00:00 2001 From: Ollrogge Date: Wed, 14 Apr 2021 22:26:20 +0200 Subject: [PATCH 2/5] sys/crypto: Remove leftover code related to deprecated 3DES block cipher --- makefiles/pseudomodules.inc.mk | 1 - pkg/openwsn/Makefile.dep | 1 - sys/crypto/Kconfig | 4 ---- sys/include/crypto/ciphers.h | 7 ++----- tests/sys_crypto/Makefile | 1 - 5 files changed, 2 insertions(+), 12 deletions(-) diff --git a/makefiles/pseudomodules.inc.mk b/makefiles/pseudomodules.inc.mk index 6fb6e46843..9e17653459 100644 --- a/makefiles/pseudomodules.inc.mk +++ b/makefiles/pseudomodules.inc.mk @@ -20,7 +20,6 @@ PSEUDOMODULES += core_% PSEUDOMODULES += cortexm_fpu PSEUDOMODULES += cortexm_svc PSEUDOMODULES += cpu_check_address -PSEUDOMODULES += crypto_% # crypto_aes or crypto_3des PSEUDOMODULES += dbgpin PSEUDOMODULES += devfs_% PSEUDOMODULES += dhcpv6_% diff --git a/pkg/openwsn/Makefile.dep b/pkg/openwsn/Makefile.dep index 12f55e540e..4af60d9d4c 100644 --- a/pkg/openwsn/Makefile.dep +++ b/pkg/openwsn/Makefile.dep @@ -44,7 +44,6 @@ ifneq (,$(filter openwsn_coap,$(USEMODULE))) endif ifneq (,$(filter openwsn_crypto,$(USEMODULE))) - USEMODULE += crypto_3des USEMODULE += cipher_modes endif diff --git a/sys/crypto/Kconfig b/sys/crypto/Kconfig index 24cf354ed0..ce99ad759a 100644 --- a/sys/crypto/Kconfig +++ b/sys/crypto/Kconfig @@ -23,10 +23,6 @@ config CRYPTO_AES bool "AES" select MODULE_CRYPTO -config MODULE_CRYPTO_3DES - bool "3DES (deprecated)" - select MODULE_CRYPTO - endchoice menu "Crypto AES options" diff --git a/sys/include/crypto/ciphers.h b/sys/include/crypto/ciphers.h index b34e529672..152dc2b662 100644 --- a/sys/include/crypto/ciphers.h +++ b/sys/include/crypto/ciphers.h @@ -50,13 +50,10 @@ extern "C" { * Context sizes needed for the different ciphers. * Always order by number of bytes descending!!!

* - * threedes needs 24 bytes
* aes needs CIPHERS_MAX_KEY_SIZE bytes
*/ -#if defined(MODULE_CRYPTO_3DES) - #define CIPHER_MAX_CONTEXT_SIZE 24 -#elif IS_USED(MODULE_CRYPTO_AES_256) || IS_USED(MODULE_CRYPTO_AES_192) || \ - IS_USED(MODULE_CRYPTO_AES_128) +#if IS_USED(MODULE_CRYPTO_AES_256) || IS_USED(MODULE_CRYPTO_AES_192) || \ + IS_USED(MODULE_CRYPTO_AES_128) #define CIPHER_MAX_CONTEXT_SIZE CIPHERS_MAX_KEY_SIZE #else /* 0 is not a possibility because 0-sized arrays are not allowed in ISO C */ diff --git a/tests/sys_crypto/Makefile b/tests/sys_crypto/Makefile index fc2892f7f9..f9438f3de8 100644 --- a/tests/sys_crypto/Makefile +++ b/tests/sys_crypto/Makefile @@ -2,7 +2,6 @@ include ../Makefile.tests_common USEMODULE += embunit -USEMODULE += crypto_3des USEMODULE += cipher_modes USEMODULE += crypto_aes_128 USEMODULE += crypto_aes_192 From 3f529904b703c15201dcfb1d6f1fc7d0cc7cc325 Mon Sep 17 00:00:00 2001 From: Ollrogge Date: Wed, 14 Apr 2021 22:27:28 +0200 Subject: [PATCH 3/5] sys/crypto: Add AES-CCM NIST SP 800-38C testvectors --- tests/sys_crypto/tests-crypto-modes-ccm-128.c | 2438 ++++++++++++++++ tests/sys_crypto/tests-crypto-modes-ccm-192.c | 2454 ++++++++++++++++ tests/sys_crypto/tests-crypto-modes-ccm-256.c | 2470 +++++++++++++++++ 3 files changed, 7362 insertions(+) create mode 100644 tests/sys_crypto/tests-crypto-modes-ccm-128.c create mode 100644 tests/sys_crypto/tests-crypto-modes-ccm-192.c create mode 100644 tests/sys_crypto/tests-crypto-modes-ccm-256.c diff --git a/tests/sys_crypto/tests-crypto-modes-ccm-128.c b/tests/sys_crypto/tests-crypto-modes-ccm-128.c new file mode 100644 index 0000000000..5c06226c5b --- /dev/null +++ b/tests/sys_crypto/tests-crypto-modes-ccm-128.c @@ -0,0 +1,2438 @@ +/* + * Copyright (C) 2021 Freie Universität Berlin + * + * This file is subject to the terms and conditions of the GNU Lesser + * General Public License v2.1. See the file LICENSE in the top level + * directory for more details. + */ + +#include + +#include +#include +#include + +#include "embUnit.h" +#include "crypto/ciphers.h" +#include "crypto/modes/ccm.h" +#include "tests-crypto.h" + +/** + * AES CCM DVTP test vectors (SP 800-38C) for 128 bit keys. + * https://csrc.nist.gov/projects/cryptographic-algorithm-validation-program/cavp-testing-block-cipher-modes + */ + +static const size_t nonce_and_len_encoding_size = 15; + +/* Alen = 0, Plen = 0, Nlen = 7, Tlen = 4 */ +static const uint8_t TEST_DVPT128_GROUP_0_MAC_LEN = 4; + +static const uint8_t TEST_DVPT128_GROUP_0_KEY[] = { + 0x4a, 0xe7, 0x01, 0x10, 0x3c, 0x63, 0xde, 0xca, + 0x5b, 0x5a, 0x39, 0x39, 0xd7, 0xd0, 0x59, 0x92, +}; +static const size_t TEST_DVPT128_GROUP_0_KEY_LEN = 16; + +static const uint8_t TEST_DVPT128_0_NONCE[] = { + 0x5a, 0x8a, 0xa4, 0x85, 0xc3, 0x16, 0xe9, +}; +static const size_t TEST_DVPT128_0_NONCE_LEN = 7; + +static const uint8_t TEST_DVPT128_0_ADATA[] = { + 0x00, +}; +static const size_t TEST_DVPT128_0_ADATA_LEN = 0; + +static const uint8_t TEST_DVPT128_0_EXPECTED[] = { + 0x02, 0x20, 0x9f, 0x55, +}; +static const size_t TEST_DVPT128_0_EXPECTED_LEN = 4; + +static const uint8_t TEST_DVPT128_0_INPUT[] = { + 0x00, +}; +static const size_t TEST_DVPT128_0_INPUT_LEN = 0; + +static const uint8_t TEST_DVPT128_4_NONCE[] = { + 0x05, 0xe1, 0x6f, 0x0f, 0x42, 0xa6, 0xf4, +}; +static const size_t TEST_DVPT128_4_NONCE_LEN = 7; + +static const uint8_t TEST_DVPT128_4_ADATA[] = { + 0x00, +}; +static const size_t TEST_DVPT128_4_ADATA_LEN = 0; + +static const uint8_t TEST_DVPT128_4_EXPECTED[] = { + 0xf0, 0x9c, 0x29, 0x86, +}; +static const size_t TEST_DVPT128_4_EXPECTED_LEN = 4; + +static const uint8_t TEST_DVPT128_4_INPUT[] = { + 0x00, +}; +static const size_t TEST_DVPT128_4_INPUT_LEN = 0; + +static const uint8_t TEST_DVPT128_11_NONCE[] = { + 0xa9, 0xdf, 0x4f, 0x37, 0x84, 0x7e, 0x1f, +}; +static const size_t TEST_DVPT128_11_NONCE_LEN = 7; + +static const uint8_t TEST_DVPT128_11_ADATA[] = { + 0x00, +}; +static const size_t TEST_DVPT128_11_ADATA_LEN = 0; + +static const uint8_t TEST_DVPT128_11_EXPECTED[] = { + 0x19, 0x86, 0x7a, 0xa5, +}; +static const size_t TEST_DVPT128_11_EXPECTED_LEN = 4; + +static const uint8_t TEST_DVPT128_11_INPUT[] = { + 0x00, +}; +static const size_t TEST_DVPT128_11_INPUT_LEN = 0; + +static const uint8_t TEST_DVPT128_12_NONCE[] = { + 0x11, 0xdf, 0x57, 0xfc, 0xd1, 0x31, 0xe9, +}; +static const size_t TEST_DVPT128_12_NONCE_LEN = 7; + +static const uint8_t TEST_DVPT128_12_ADATA[] = { + 0x00, +}; +static const size_t TEST_DVPT128_12_ADATA_LEN = 0; + +static const uint8_t TEST_DVPT128_12_EXPECTED[] = { + 0x3b, 0x39, 0x2a, 0x52, +}; +static const size_t TEST_DVPT128_12_EXPECTED_LEN = 4; + +static const uint8_t TEST_DVPT128_12_INPUT[] = { + 0x00, +}; +static const size_t TEST_DVPT128_12_INPUT_LEN = 0; + +static const uint8_t TEST_DVPT128_13_NONCE[] = { + 0x89, 0x0f, 0xff, 0x56, 0xd1, 0x0d, 0xc0, +}; +static const size_t TEST_DVPT128_13_NONCE_LEN = 7; + +static const uint8_t TEST_DVPT128_13_ADATA[] = { + 0x00, +}; +static const size_t TEST_DVPT128_13_ADATA_LEN = 0; + +static const uint8_t TEST_DVPT128_13_EXPECTED[] = { + 0x1c, 0x5e, 0x47, 0xe0, +}; +static const size_t TEST_DVPT128_13_EXPECTED_LEN = 4; + +static const uint8_t TEST_DVPT128_13_INPUT[] = { + 0x00, +}; +static const size_t TEST_DVPT128_13_INPUT_LEN = 0; + +/* Alen = 0, Plen = 0, Nlen = 7, Tlen = 16 */ +static const uint8_t TEST_DVPT128_GROUP_1_MAC_LEN = 16; + +static const uint8_t TEST_DVPT128_GROUP_1_KEY[] = { + 0x4b, 0xb3, 0xc4, 0xa4, 0xf8, 0x93, 0xad, 0x8c, + 0x9b, 0xdc, 0x83, 0x3c, 0x32, 0x5d, 0x62, 0xb3, +}; +static const size_t TEST_DVPT128_GROUP_1_KEY_LEN = 16; + +static const uint8_t TEST_DVPT128_15_NONCE[] = { + 0x5a, 0x8a, 0xa4, 0x85, 0xc3, 0x16, 0xe9, +}; +static const size_t TEST_DVPT128_15_NONCE_LEN = 7; + +static const uint8_t TEST_DVPT128_15_ADATA[] = { + 0x00, +}; +static const size_t TEST_DVPT128_15_ADATA_LEN = 0; + +static const uint8_t TEST_DVPT128_15_EXPECTED[] = { + 0x75, 0xd5, 0x82, 0xdb, 0x43, 0xce, 0x9b, 0x13, + 0xab, 0x4b, 0x6f, 0x7f, 0x14, 0x34, 0x13, 0x30, +}; +static const size_t TEST_DVPT128_15_EXPECTED_LEN = 16; + +static const uint8_t TEST_DVPT128_15_INPUT[] = { + 0x00, +}; +static const size_t TEST_DVPT128_15_INPUT_LEN = 0; + +static const uint8_t TEST_DVPT128_19_NONCE[] = { + 0x05, 0xe1, 0x6f, 0x0f, 0x42, 0xa6, 0xf4, +}; +static const size_t TEST_DVPT128_19_NONCE_LEN = 7; + +static const uint8_t TEST_DVPT128_19_ADATA[] = { + 0x00, +}; +static const size_t TEST_DVPT128_19_ADATA_LEN = 0; + +static const uint8_t TEST_DVPT128_19_EXPECTED[] = { + 0xe2, 0xe8, 0x7c, 0xa8, 0x25, 0x23, 0xcc, 0xfe, + 0xb4, 0x16, 0xb4, 0x2a, 0xf9, 0xd9, 0xaa, 0xdc, +}; +static const size_t TEST_DVPT128_19_EXPECTED_LEN = 16; + +static const uint8_t TEST_DVPT128_19_INPUT[] = { + 0x00, +}; +static const size_t TEST_DVPT128_19_INPUT_LEN = 0; + +static const uint8_t TEST_DVPT128_26_NONCE[] = { + 0xa9, 0xdf, 0x4f, 0x37, 0x84, 0x7e, 0x1f, +}; +static const size_t TEST_DVPT128_26_NONCE_LEN = 7; + +static const uint8_t TEST_DVPT128_26_ADATA[] = { + 0x00, +}; +static const size_t TEST_DVPT128_26_ADATA_LEN = 0; + +static const uint8_t TEST_DVPT128_26_EXPECTED[] = { + 0x0e, 0x15, 0x0a, 0xf4, 0x22, 0xf6, 0xda, 0x23, + 0x8b, 0xb4, 0x76, 0x81, 0x0b, 0x2d, 0x5b, 0xc2, +}; +static const size_t TEST_DVPT128_26_EXPECTED_LEN = 16; + +static const uint8_t TEST_DVPT128_26_INPUT[] = { + 0x00, +}; +static const size_t TEST_DVPT128_26_INPUT_LEN = 0; + +static const uint8_t TEST_DVPT128_27_NONCE[] = { + 0x11, 0xdf, 0x57, 0xfc, 0xd1, 0x31, 0xe9, +}; +static const size_t TEST_DVPT128_27_NONCE_LEN = 7; + +static const uint8_t TEST_DVPT128_27_ADATA[] = { + 0x00, +}; +static const size_t TEST_DVPT128_27_ADATA_LEN = 0; + +static const uint8_t TEST_DVPT128_27_EXPECTED[] = { + 0x8e, 0x11, 0x50, 0x75, 0x6f, 0xf3, 0xa7, 0x33, + 0xa1, 0x27, 0x44, 0x70, 0xf0, 0x72, 0xb7, 0x4c, +}; +static const size_t TEST_DVPT128_27_EXPECTED_LEN = 16; + +static const uint8_t TEST_DVPT128_27_INPUT[] = { + 0x00, +}; +static const size_t TEST_DVPT128_27_INPUT_LEN = 0; + +static const uint8_t TEST_DVPT128_28_NONCE[] = { + 0x89, 0x0f, 0xff, 0x56, 0xd1, 0x0d, 0xc0, +}; +static const size_t TEST_DVPT128_28_NONCE_LEN = 7; + +static const uint8_t TEST_DVPT128_28_ADATA[] = { + 0x00, +}; +static const size_t TEST_DVPT128_28_ADATA_LEN = 0; + +static const uint8_t TEST_DVPT128_28_EXPECTED[] = { + 0xa1, 0xf7, 0x0d, 0xf3, 0xfa, 0x9c, 0xfe, 0xb9, + 0x5f, 0x86, 0x9b, 0x3f, 0xe0, 0x84, 0x66, 0xe0, +}; +static const size_t TEST_DVPT128_28_EXPECTED_LEN = 16; + +static const uint8_t TEST_DVPT128_28_INPUT[] = { + 0x00, +}; +static const size_t TEST_DVPT128_28_INPUT_LEN = 0; + +/* Alen = 0, Plen = 0, Nlen = 13, Tlen = 4 */ +static const uint8_t TEST_DVPT128_GROUP_2_MAC_LEN = 4; + +static const uint8_t TEST_DVPT128_GROUP_2_KEY[] = { + 0x4b, 0xb3, 0xc4, 0xa4, 0xf8, 0x93, 0xad, 0x8c, + 0x9b, 0xdc, 0x83, 0x3c, 0x32, 0x5d, 0x62, 0xb3, +}; +static const size_t TEST_DVPT128_GROUP_2_KEY_LEN = 16; + +static const uint8_t TEST_DVPT128_30_NONCE[] = { + 0x5a, 0x8a, 0xa4, 0x85, 0xc3, 0x16, 0xe9, 0x40, + 0x3a, 0xff, 0x85, 0x9f, 0xbb, +}; +static const size_t TEST_DVPT128_30_NONCE_LEN = 13; + +static const uint8_t TEST_DVPT128_30_ADATA[] = { + 0x00, +}; +static const size_t TEST_DVPT128_30_ADATA_LEN = 0; + +static const uint8_t TEST_DVPT128_30_EXPECTED[] = { + 0x90, 0x15, 0x6f, 0x3f, +}; +static const size_t TEST_DVPT128_30_EXPECTED_LEN = 4; + +static const uint8_t TEST_DVPT128_30_INPUT[] = { + 0x00, +}; +static const size_t TEST_DVPT128_30_INPUT_LEN = 0; + +static const uint8_t TEST_DVPT128_34_NONCE[] = { + 0x93, 0x5c, 0x1e, 0xf3, 0xd4, 0x03, 0x2f, 0xf0, + 0x90, 0xf9, 0x11, 0x41, 0xf3, +}; +static const size_t TEST_DVPT128_34_NONCE_LEN = 13; + +static const uint8_t TEST_DVPT128_34_ADATA[] = { + 0x00, +}; +static const size_t TEST_DVPT128_34_ADATA_LEN = 0; + +static const uint8_t TEST_DVPT128_34_EXPECTED[] = { + 0x1b, 0xc8, 0x2b, 0x3d, +}; +static const size_t TEST_DVPT128_34_EXPECTED_LEN = 4; + +static const uint8_t TEST_DVPT128_34_INPUT[] = { + 0x00, +}; +static const size_t TEST_DVPT128_34_INPUT_LEN = 0; + +static const uint8_t TEST_DVPT128_41_NONCE[] = { + 0xd0, 0xa1, 0x50, 0x8f, 0xde, 0xfc, 0xf5, 0xbe, + 0x30, 0xa4, 0x59, 0xb8, 0x13, +}; +static const size_t TEST_DVPT128_41_NONCE_LEN = 13; + +static const uint8_t TEST_DVPT128_41_ADATA[] = { + 0x00, +}; +static const size_t TEST_DVPT128_41_ADATA_LEN = 0; + +static const uint8_t TEST_DVPT128_41_EXPECTED[] = { + 0x36, 0xa3, 0x7a, 0x59, +}; +static const size_t TEST_DVPT128_41_EXPECTED_LEN = 4; + +static const uint8_t TEST_DVPT128_41_INPUT[] = { + 0x00, +}; +static const size_t TEST_DVPT128_41_INPUT_LEN = 0; + +static const uint8_t TEST_DVPT128_42_NONCE[] = { + 0x53, 0x81, 0xa6, 0x1b, 0x44, 0x9d, 0xc6, 0xa4, + 0x2a, 0xa4, 0xc7, 0x9b, 0x95, +}; +static const size_t TEST_DVPT128_42_NONCE_LEN = 13; + +static const uint8_t TEST_DVPT128_42_ADATA[] = { + 0x00, +}; +static const size_t TEST_DVPT128_42_ADATA_LEN = 0; + +static const uint8_t TEST_DVPT128_42_EXPECTED[] = { + 0xdb, 0xa0, 0x2a, 0x36, +}; +static const size_t TEST_DVPT128_42_EXPECTED_LEN = 4; + +static const uint8_t TEST_DVPT128_42_INPUT[] = { + 0x00, +}; +static const size_t TEST_DVPT128_42_INPUT_LEN = 0; + +static const uint8_t TEST_DVPT128_43_NONCE[] = { + 0xc5, 0x54, 0x30, 0xf2, 0xda, 0x06, 0x87, 0xea, + 0x40, 0x31, 0x38, 0x84, 0xab, +}; +static const size_t TEST_DVPT128_43_NONCE_LEN = 13; + +static const uint8_t TEST_DVPT128_43_ADATA[] = { + 0x00, +}; +static const size_t TEST_DVPT128_43_ADATA_LEN = 0; + +static const uint8_t TEST_DVPT128_43_EXPECTED[] = { + 0x25, 0xdc, 0xb3, 0xc5, +}; +static const size_t TEST_DVPT128_43_EXPECTED_LEN = 4; + +static const uint8_t TEST_DVPT128_43_INPUT[] = { + 0x00, +}; +static const size_t TEST_DVPT128_43_INPUT_LEN = 0; + +/* Alen = 0, Plen = 0, Nlen = 13, Tlen = 16 */ +static const uint8_t TEST_DVPT128_GROUP_3_MAC_LEN = 16; + +static const uint8_t TEST_DVPT128_GROUP_3_KEY[] = { + 0x19, 0xeb, 0xfd, 0xe2, 0xd5, 0x46, 0x8b, 0xa0, + 0xa3, 0x03, 0x1b, 0xde, 0x62, 0x9b, 0x11, 0xfd, +}; +static const size_t TEST_DVPT128_GROUP_3_KEY_LEN = 16; + +static const uint8_t TEST_DVPT128_45_NONCE[] = { + 0x5a, 0x8a, 0xa4, 0x85, 0xc3, 0x16, 0xe9, 0x40, + 0x3a, 0xff, 0x85, 0x9f, 0xbb, +}; +static const size_t TEST_DVPT128_45_NONCE_LEN = 13; + +static const uint8_t TEST_DVPT128_45_ADATA[] = { + 0x00, +}; +static const size_t TEST_DVPT128_45_ADATA_LEN = 0; + +static const uint8_t TEST_DVPT128_45_EXPECTED[] = { + 0xfb, 0x04, 0xdc, 0x5a, 0x44, 0xc6, 0xbb, 0x00, + 0x0f, 0x24, 0x40, 0xf5, 0x15, 0x43, 0x64, 0xb4, +}; +static const size_t TEST_DVPT128_45_EXPECTED_LEN = 16; + +static const uint8_t TEST_DVPT128_45_INPUT[] = { + 0x00, +}; +static const size_t TEST_DVPT128_45_INPUT_LEN = 0; + +static const uint8_t TEST_DVPT128_49_NONCE[] = { + 0x93, 0x5c, 0x1e, 0xf3, 0xd4, 0x03, 0x2f, 0xf0, + 0x90, 0xf9, 0x11, 0x41, 0xf3, +}; +static const size_t TEST_DVPT128_49_NONCE_LEN = 13; + +static const uint8_t TEST_DVPT128_49_ADATA[] = { + 0x00, +}; +static const size_t TEST_DVPT128_49_ADATA_LEN = 0; + +static const uint8_t TEST_DVPT128_49_EXPECTED[] = { + 0x3d, 0xac, 0xc7, 0x11, 0x69, 0xf6, 0xda, 0x77, + 0xec, 0x91, 0xff, 0x1d, 0x2f, 0x64, 0x9e, 0xd1, +}; +static const size_t TEST_DVPT128_49_EXPECTED_LEN = 16; + +static const uint8_t TEST_DVPT128_49_INPUT[] = { + 0x00, +}; +static const size_t TEST_DVPT128_49_INPUT_LEN = 0; + +static const uint8_t TEST_DVPT128_56_NONCE[] = { + 0xd0, 0xa1, 0x50, 0x8f, 0xde, 0xfc, 0xf5, 0xbe, + 0x30, 0xa4, 0x59, 0xb8, 0x13, +}; +static const size_t TEST_DVPT128_56_NONCE_LEN = 13; + +static const uint8_t TEST_DVPT128_56_ADATA[] = { + 0x00, +}; +static const size_t TEST_DVPT128_56_ADATA_LEN = 0; + +static const uint8_t TEST_DVPT128_56_EXPECTED[] = { + 0x1a, 0xe3, 0x42, 0x07, 0xe7, 0x4c, 0x8c, 0x78, + 0x89, 0x0a, 0xe1, 0x7e, 0x32, 0x0e, 0x84, 0xbd, +}; +static const size_t TEST_DVPT128_56_EXPECTED_LEN = 16; + +static const uint8_t TEST_DVPT128_56_INPUT[] = { + 0x00, +}; +static const size_t TEST_DVPT128_56_INPUT_LEN = 0; + +static const uint8_t TEST_DVPT128_57_NONCE[] = { + 0x53, 0x81, 0xa6, 0x1b, 0x44, 0x9d, 0xc6, 0xa4, + 0x2a, 0xa4, 0xc7, 0x9b, 0x95, +}; +static const size_t TEST_DVPT128_57_NONCE_LEN = 13; + +static const uint8_t TEST_DVPT128_57_ADATA[] = { + 0x00, +}; +static const size_t TEST_DVPT128_57_ADATA_LEN = 0; + +static const uint8_t TEST_DVPT128_57_EXPECTED[] = { + 0x5c, 0x5f, 0xa2, 0x54, 0xc0, 0xbe, 0x50, 0x3b, + 0x02, 0xca, 0xff, 0xad, 0xe6, 0xb8, 0x52, 0x59, +}; +static const size_t TEST_DVPT128_57_EXPECTED_LEN = 16; + +static const uint8_t TEST_DVPT128_57_INPUT[] = { + 0x00, +}; +static const size_t TEST_DVPT128_57_INPUT_LEN = 0; + +static const uint8_t TEST_DVPT128_58_NONCE[] = { + 0xc5, 0x54, 0x30, 0xf2, 0xda, 0x06, 0x87, 0xea, + 0x40, 0x31, 0x38, 0x84, 0xab, +}; +static const size_t TEST_DVPT128_58_NONCE_LEN = 13; + +static const uint8_t TEST_DVPT128_58_ADATA[] = { + 0x00, +}; +static const size_t TEST_DVPT128_58_ADATA_LEN = 0; + +static const uint8_t TEST_DVPT128_58_EXPECTED[] = { + 0x93, 0x40, 0x26, 0x67, 0x30, 0xea, 0x36, 0x20, + 0x7b, 0xb7, 0x34, 0x81, 0x9d, 0x35, 0x53, 0xe9, +}; +static const size_t TEST_DVPT128_58_EXPECTED_LEN = 16; + +static const uint8_t TEST_DVPT128_58_INPUT[] = { + 0x00, +}; +static const size_t TEST_DVPT128_58_INPUT_LEN = 0; + +/* Alen = 0, Plen = 24, Nlen = 7, Tlen = 4 */ +static const uint8_t TEST_DVPT128_GROUP_4_MAC_LEN = 4; + +static const uint8_t TEST_DVPT128_GROUP_4_KEY[] = { + 0x19, 0xeb, 0xfd, 0xe2, 0xd5, 0x46, 0x8b, 0xa0, + 0xa3, 0x03, 0x1b, 0xde, 0x62, 0x9b, 0x11, 0xfd, +}; +static const size_t TEST_DVPT128_GROUP_4_KEY_LEN = 16; + +static const uint8_t TEST_DVPT128_60_NONCE[] = { + 0x5a, 0x8a, 0xa4, 0x85, 0xc3, 0x16, 0xe9, +}; +static const size_t TEST_DVPT128_60_NONCE_LEN = 7; + +static const uint8_t TEST_DVPT128_60_ADATA[] = { + 0x00, +}; +static const size_t TEST_DVPT128_60_ADATA_LEN = 0; + +static const uint8_t TEST_DVPT128_60_EXPECTED[] = { + 0xa9, 0x0e, 0x8e, 0xa4, 0x40, 0x85, 0xce, 0xd7, + 0x91, 0xb2, 0xfd, 0xb7, 0xfd, 0x44, 0xb5, 0xcf, + 0x0b, 0xd7, 0xd2, 0x77, 0x18, 0x02, 0x9b, 0xb7, + 0x03, 0xe1, 0xfa, 0x6b, +}; +static const size_t TEST_DVPT128_60_EXPECTED_LEN = 28; + +static const uint8_t TEST_DVPT128_60_INPUT[] = { + 0x37, 0x96, 0xcf, 0x51, 0xb8, 0x72, 0x66, 0x52, + 0xa4, 0x20, 0x47, 0x33, 0xb8, 0xfb, 0xb0, 0x47, + 0xcf, 0x00, 0xfb, 0x91, 0xa9, 0x83, 0x7e, 0x22, +}; +static const size_t TEST_DVPT128_60_INPUT_LEN = 24; + +static const uint8_t TEST_DVPT128_64_NONCE[] = { + 0x12, 0x3a, 0x0b, 0xea, 0xce, 0x4e, 0x39, +}; +static const size_t TEST_DVPT128_64_NONCE_LEN = 7; + +static const uint8_t TEST_DVPT128_64_ADATA[] = { + 0x00, +}; +static const size_t TEST_DVPT128_64_ADATA_LEN = 0; + +static const uint8_t TEST_DVPT128_64_EXPECTED[] = { + 0x47, 0xd7, 0x14, 0x09, 0xa0, 0x3c, 0x33, 0x0b, + 0xe9, 0x45, 0x1b, 0x3f, 0x92, 0xc9, 0xd2, 0x1c, + 0x58, 0x43, 0x91, 0xad, 0x10, 0x10, 0xe9, 0xd6, + 0x09, 0xb8, 0x98, 0x01, +}; +static const size_t TEST_DVPT128_64_EXPECTED_LEN = 28; + +static const uint8_t TEST_DVPT128_64_INPUT[] = { + 0x9d, 0x03, 0x3e, 0x3b, 0x66, 0xef, 0xed, 0x14, + 0x67, 0x86, 0x8f, 0x38, 0x24, 0x17, 0xc8, 0x05, + 0x94, 0x87, 0x7a, 0x28, 0xbc, 0x97, 0xf4, 0x06, +}; +static const size_t TEST_DVPT128_64_INPUT_LEN = 24; + +static const uint8_t TEST_DVPT128_71_NONCE[] = { + 0xf6, 0x7b, 0x98, 0xef, 0xd3, 0x9b, 0x55, +}; +static const size_t TEST_DVPT128_71_NONCE_LEN = 7; + +static const uint8_t TEST_DVPT128_71_ADATA[] = { + 0x00, +}; +static const size_t TEST_DVPT128_71_ADATA_LEN = 0; + +static const uint8_t TEST_DVPT128_71_EXPECTED[] = { + 0xdd, 0x17, 0x59, 0x05, 0xa7, 0xea, 0x3a, 0xef, + 0x9f, 0xce, 0x06, 0x8e, 0x6c, 0xb7, 0x8e, 0x9c, + 0xc6, 0x05, 0x19, 0x75, 0x5a, 0x17, 0x8c, 0x77, + 0xb7, 0x53, 0x18, 0x1c, +}; +static const size_t TEST_DVPT128_71_EXPECTED_LEN = 28; + +static const uint8_t TEST_DVPT128_71_INPUT[] = { + 0xf2, 0xe9, 0x44, 0xe1, 0xae, 0x47, 0xad, 0x58, + 0x73, 0xbf, 0x39, 0x1f, 0x1b, 0x0c, 0xc0, 0x7f, + 0x61, 0x51, 0xeb, 0x4c, 0x50, 0xbb, 0x45, 0xb2, +}; +static const size_t TEST_DVPT128_71_INPUT_LEN = 24; + +static const uint8_t TEST_DVPT128_72_NONCE[] = { + 0xe6, 0x0e, 0x2c, 0x00, 0x2d, 0x1c, 0x99, +}; +static const size_t TEST_DVPT128_72_NONCE_LEN = 7; + +static const uint8_t TEST_DVPT128_72_ADATA[] = { + 0x00, +}; +static const size_t TEST_DVPT128_72_ADATA_LEN = 0; + +static const uint8_t TEST_DVPT128_72_EXPECTED[] = { + 0x8a, 0xd6, 0xb7, 0x6f, 0x54, 0x39, 0x2e, 0xe0, + 0xf2, 0x83, 0x4f, 0x09, 0x14, 0x25, 0x45, 0xbc, + 0xde, 0x9b, 0xf0, 0x3d, 0x04, 0xd6, 0x4a, 0xa1, + 0x08, 0x76, 0xf2, 0xda, +}; +static const size_t TEST_DVPT128_72_EXPECTED_LEN = 28; + +static const uint8_t TEST_DVPT128_72_INPUT[] = { + 0x70, 0xf4, 0x8d, 0xc1, 0xd7, 0x6e, 0x50, 0x28, + 0xda, 0x07, 0xe2, 0x98, 0x52, 0x80, 0x13, 0x75, + 0xa9, 0xed, 0xb2, 0x21, 0x4a, 0x5e, 0xa4, 0xc0, +}; +static const size_t TEST_DVPT128_72_INPUT_LEN = 24; + +static const uint8_t TEST_DVPT128_73_NONCE[] = { + 0x09, 0x8e, 0x05, 0x3f, 0xa0, 0x80, 0x43, +}; +static const size_t TEST_DVPT128_73_NONCE_LEN = 7; + +static const uint8_t TEST_DVPT128_73_ADATA[] = { + 0x00, +}; +static const size_t TEST_DVPT128_73_ADATA_LEN = 0; + +static const uint8_t TEST_DVPT128_73_EXPECTED[] = { + 0x80, 0x8e, 0xb3, 0xe0, 0x4c, 0x39, 0xab, 0xde, + 0x64, 0x67, 0x4f, 0x0f, 0x77, 0x16, 0xdd, 0xe1, + 0x16, 0x99, 0xcf, 0xf8, 0xdd, 0x36, 0x7c, 0x4c, + 0xd4, 0xf7, 0xfc, 0x07, +}; +static const size_t TEST_DVPT128_73_EXPECTED_LEN = 28; + +static const uint8_t TEST_DVPT128_73_INPUT[] = { + 0xbd, 0x81, 0x68, 0x0e, 0x3d, 0xc0, 0xb3, 0x54, + 0x31, 0xc9, 0x25, 0x98, 0xdc, 0xaa, 0x26, 0xef, + 0x09, 0xca, 0x0d, 0xa5, 0xe7, 0x71, 0x93, 0xde, +}; +static const size_t TEST_DVPT128_73_INPUT_LEN = 24; + +/* Alen = 0, Plen = 24, Nlen = 7, Tlen = 16 */ +static const uint8_t TEST_DVPT128_GROUP_5_MAC_LEN = 16; + +static const uint8_t TEST_DVPT128_GROUP_5_KEY[] = { + 0x19, 0x7a, 0xfb, 0x02, 0xff, 0xbd, 0x8f, 0x69, + 0x9d, 0xac, 0xae, 0x87, 0x09, 0x4d, 0x52, 0x43, +}; +static const size_t TEST_DVPT128_GROUP_5_KEY_LEN = 16; + +static const uint8_t TEST_DVPT128_75_NONCE[] = { + 0x5a, 0x8a, 0xa4, 0x85, 0xc3, 0x16, 0xe9, +}; +static const size_t TEST_DVPT128_75_NONCE_LEN = 7; + +static const uint8_t TEST_DVPT128_75_ADATA[] = { + 0x00, +}; +static const size_t TEST_DVPT128_75_ADATA_LEN = 0; + +static const uint8_t TEST_DVPT128_75_EXPECTED[] = { + 0x24, 0xab, 0x9e, 0xeb, 0x0e, 0x55, 0x08, 0xca, + 0xe8, 0x00, 0x74, 0xf1, 0x07, 0x0e, 0xe1, 0x88, + 0xa6, 0x37, 0x17, 0x18, 0x60, 0x88, 0x1f, 0x1f, + 0x2d, 0x9a, 0x3f, 0xbc, 0x21, 0x05, 0x95, 0xb7, + 0xb8, 0xb1, 0xb4, 0x15, 0x23, 0x11, 0x1a, 0x8e, +}; +static const size_t TEST_DVPT128_75_EXPECTED_LEN = 40; + +static const uint8_t TEST_DVPT128_75_INPUT[] = { + 0x37, 0x96, 0xcf, 0x51, 0xb8, 0x72, 0x66, 0x52, + 0xa4, 0x20, 0x47, 0x33, 0xb8, 0xfb, 0xb0, 0x47, + 0xcf, 0x00, 0xfb, 0x91, 0xa9, 0x83, 0x7e, 0x22, +}; +static const size_t TEST_DVPT128_75_INPUT_LEN = 24; + +static const uint8_t TEST_DVPT128_79_NONCE[] = { + 0x12, 0x3a, 0x0b, 0xea, 0xce, 0x4e, 0x39, +}; +static const size_t TEST_DVPT128_79_NONCE_LEN = 7; + +static const uint8_t TEST_DVPT128_79_ADATA[] = { + 0x00, +}; +static const size_t TEST_DVPT128_79_ADATA_LEN = 0; + +static const uint8_t TEST_DVPT128_79_EXPECTED[] = { + 0xd4, 0x30, 0x35, 0xcd, 0xb5, 0xa1, 0x86, 0x8a, + 0xa4, 0x30, 0xe8, 0xb4, 0x1a, 0x1d, 0xc5, 0x7a, + 0x63, 0x90, 0x87, 0x23, 0x8e, 0x38, 0xbd, 0x62, + 0x8f, 0xee, 0xda, 0x2e, 0x8f, 0x24, 0x9d, 0xd9, + 0x3a, 0x83, 0x58, 0xde, 0xf7, 0x63, 0x98, 0x75, +}; +static const size_t TEST_DVPT128_79_EXPECTED_LEN = 40; + +static const uint8_t TEST_DVPT128_79_INPUT[] = { + 0x9d, 0x03, 0x3e, 0x3b, 0x66, 0xef, 0xed, 0x14, + 0x67, 0x86, 0x8f, 0x38, 0x24, 0x17, 0xc8, 0x05, + 0x94, 0x87, 0x7a, 0x28, 0xbc, 0x97, 0xf4, 0x06, +}; +static const size_t TEST_DVPT128_79_INPUT_LEN = 24; + +static const uint8_t TEST_DVPT128_86_NONCE[] = { + 0xf6, 0x7b, 0x98, 0xef, 0xd3, 0x9b, 0x55, +}; +static const size_t TEST_DVPT128_86_NONCE_LEN = 7; + +static const uint8_t TEST_DVPT128_86_ADATA[] = { + 0x00, +}; +static const size_t TEST_DVPT128_86_ADATA_LEN = 0; + +static const uint8_t TEST_DVPT128_86_EXPECTED[] = { + 0x37, 0xd6, 0x3c, 0x2b, 0xbf, 0x44, 0xd2, 0xeb, + 0x15, 0x5e, 0xcc, 0x1a, 0x84, 0x48, 0x41, 0xd5, + 0xc3, 0x3f, 0x1a, 0x6d, 0x44, 0x34, 0x19, 0x33, + 0x02, 0x17, 0xa4, 0xf1, 0xf4, 0xfb, 0x30, 0x22, + 0x57, 0xb0, 0xde, 0x7c, 0x9d, 0xa2, 0xe7, 0x50, +}; +static const size_t TEST_DVPT128_86_EXPECTED_LEN = 40; + +static const uint8_t TEST_DVPT128_86_INPUT[] = { + 0xf2, 0xe9, 0x44, 0xe1, 0xae, 0x47, 0xad, 0x58, + 0x73, 0xbf, 0x39, 0x1f, 0x1b, 0x0c, 0xc0, 0x7f, + 0x61, 0x51, 0xeb, 0x4c, 0x50, 0xbb, 0x45, 0xb2, +}; +static const size_t TEST_DVPT128_86_INPUT_LEN = 24; + +static const uint8_t TEST_DVPT128_87_NONCE[] = { + 0xe6, 0x0e, 0x2c, 0x00, 0x2d, 0x1c, 0x99, +}; +static const size_t TEST_DVPT128_87_NONCE_LEN = 7; + +static const uint8_t TEST_DVPT128_87_ADATA[] = { + 0x00, +}; +static const size_t TEST_DVPT128_87_ADATA_LEN = 0; + +static const uint8_t TEST_DVPT128_87_EXPECTED[] = { + 0x33, 0xe0, 0xdc, 0xe4, 0x41, 0x0e, 0x51, 0xbe, + 0xd5, 0x32, 0x3e, 0xa4, 0x94, 0x90, 0x20, 0x70, + 0x84, 0xac, 0x91, 0x73, 0x2b, 0xae, 0x42, 0x92, + 0x36, 0xa3, 0x05, 0xd5, 0x20, 0xa1, 0xa2, 0x49, + 0x30, 0xa7, 0x0a, 0x31, 0x1a, 0xa3, 0x69, 0x5d, +}; +static const size_t TEST_DVPT128_87_EXPECTED_LEN = 40; + +static const uint8_t TEST_DVPT128_87_INPUT[] = { + 0x70, 0xf4, 0x8d, 0xc1, 0xd7, 0x6e, 0x50, 0x28, + 0xda, 0x07, 0xe2, 0x98, 0x52, 0x80, 0x13, 0x75, + 0xa9, 0xed, 0xb2, 0x21, 0x4a, 0x5e, 0xa4, 0xc0, +}; +static const size_t TEST_DVPT128_87_INPUT_LEN = 24; + +static const uint8_t TEST_DVPT128_88_NONCE[] = { + 0x09, 0x8e, 0x05, 0x3f, 0xa0, 0x80, 0x43, +}; +static const size_t TEST_DVPT128_88_NONCE_LEN = 7; + +static const uint8_t TEST_DVPT128_88_ADATA[] = { + 0x00, +}; +static const size_t TEST_DVPT128_88_ADATA_LEN = 0; + +static const uint8_t TEST_DVPT128_88_EXPECTED[] = { + 0x1d, 0x73, 0x2c, 0x33, 0x43, 0x19, 0xbd, 0x77, + 0x5e, 0x7c, 0xf9, 0x3d, 0xbd, 0xc4, 0x20, 0x4b, + 0xbd, 0xb5, 0x81, 0x92, 0xbe, 0x08, 0x28, 0x04, + 0x81, 0xe3, 0xd6, 0x4e, 0xd5, 0x46, 0xb6, 0xb7, + 0x0e, 0xe0, 0x88, 0xa6, 0x93, 0xf5, 0x5f, 0xbb, +}; +static const size_t TEST_DVPT128_88_EXPECTED_LEN = 40; + +static const uint8_t TEST_DVPT128_88_INPUT[] = { + 0xbd, 0x81, 0x68, 0x0e, 0x3d, 0xc0, 0xb3, 0x54, + 0x31, 0xc9, 0x25, 0x98, 0xdc, 0xaa, 0x26, 0xef, + 0x09, 0xca, 0x0d, 0xa5, 0xe7, 0x71, 0x93, 0xde, +}; +static const size_t TEST_DVPT128_88_INPUT_LEN = 24; + +/* Alen = 0, Plen = 24, Nlen = 13, Tlen = 4 */ +static const uint8_t TEST_DVPT128_GROUP_6_MAC_LEN = 4; + +static const uint8_t TEST_DVPT128_GROUP_6_KEY[] = { + 0x19, 0x7a, 0xfb, 0x02, 0xff, 0xbd, 0x8f, 0x69, + 0x9d, 0xac, 0xae, 0x87, 0x09, 0x4d, 0x52, 0x43, +}; +static const size_t TEST_DVPT128_GROUP_6_KEY_LEN = 16; + +static const uint8_t TEST_DVPT128_90_NONCE[] = { + 0x5a, 0x8a, 0xa4, 0x85, 0xc3, 0x16, 0xe9, 0x40, + 0x3a, 0xff, 0x85, 0x9f, 0xbb, +}; +static const size_t TEST_DVPT128_90_NONCE_LEN = 13; + +static const uint8_t TEST_DVPT128_90_ADATA[] = { + 0x00, +}; +static const size_t TEST_DVPT128_90_ADATA_LEN = 0; + +static const uint8_t TEST_DVPT128_90_EXPECTED[] = { + 0x4a, 0x55, 0x01, 0x34, 0xf9, 0x44, 0x55, 0x97, + 0x9e, 0xc4, 0xbf, 0x89, 0xad, 0x2b, 0xd8, 0x0d, + 0x25, 0xa7, 0x7a, 0xe9, 0x4e, 0x45, 0x61, 0x34, + 0xa3, 0xe1, 0x38, 0xb9, +}; +static const size_t TEST_DVPT128_90_EXPECTED_LEN = 28; + +static const uint8_t TEST_DVPT128_90_INPUT[] = { + 0xa1, 0x6a, 0x2e, 0x74, 0x1f, 0x1c, 0xd9, 0x71, + 0x72, 0x85, 0xb6, 0xd8, 0x82, 0xc1, 0xfc, 0x53, + 0x65, 0x5e, 0x97, 0x73, 0x76, 0x1a, 0xd6, 0x97, +}; +static const size_t TEST_DVPT128_90_INPUT_LEN = 24; + +static const uint8_t TEST_DVPT128_94_NONCE[] = { + 0x24, 0xb7, 0xa6, 0x53, 0x91, 0xf8, 0x8b, 0xea, + 0x38, 0xfc, 0xd5, 0x4a, 0x9a, +}; +static const size_t TEST_DVPT128_94_NONCE_LEN = 13; + +static const uint8_t TEST_DVPT128_94_ADATA[] = { + 0x00, +}; +static const size_t TEST_DVPT128_94_ADATA_LEN = 0; + +static const uint8_t TEST_DVPT128_94_EXPECTED[] = { + 0x05, 0xf2, 0x0b, 0x2a, 0xe7, 0x0f, 0xcb, 0x0e, + 0xa7, 0x9a, 0xa1, 0x84, 0x5c, 0x15, 0xb8, 0x99, + 0xa7, 0x99, 0xca, 0x60, 0xf5, 0x1e, 0x6c, 0x29, + 0x64, 0x13, 0x02, 0x0a, +}; +static const size_t TEST_DVPT128_94_EXPECTED_LEN = 28; + +static const uint8_t TEST_DVPT128_94_INPUT[] = { + 0x43, 0x41, 0x97, 0x15, 0xce, 0xf9, 0xa4, 0x8d, + 0xc7, 0x28, 0x0b, 0xc0, 0x35, 0x08, 0x2a, 0x65, + 0x81, 0xaf, 0xd1, 0xd8, 0x2b, 0xee, 0x9d, 0x1a, +}; +static const size_t TEST_DVPT128_94_INPUT_LEN = 24; + +static const uint8_t TEST_DVPT128_101_NONCE[] = { + 0xc4, 0x7a, 0xf8, 0x0c, 0xd2, 0x6d, 0x04, 0x76, + 0x30, 0xc1, 0xfd, 0xf0, 0xd1, +}; +static const size_t TEST_DVPT128_101_NONCE_LEN = 13; + +static const uint8_t TEST_DVPT128_101_ADATA[] = { + 0x00, +}; +static const size_t TEST_DVPT128_101_ADATA_LEN = 0; + +static const uint8_t TEST_DVPT128_101_EXPECTED[] = { + 0xa2, 0xa5, 0x90, 0x41, 0xc3, 0xf7, 0x8f, 0x6e, + 0x10, 0xc3, 0x04, 0x51, 0x18, 0xe8, 0xa4, 0x75, + 0x94, 0x5e, 0x24, 0xc8, 0x5b, 0x02, 0xab, 0xc4, + 0x0f, 0x8f, 0xb9, 0x49, +}; +static const size_t TEST_DVPT128_101_EXPECTED_LEN = 28; + +static const uint8_t TEST_DVPT128_101_INPUT[] = { + 0xd8, 0x30, 0x6c, 0x9c, 0x4e, 0xa6, 0xc6, 0x9c, + 0x6e, 0x2a, 0xd0, 0xfc, 0x0e, 0x49, 0xb1, 0xe0, + 0x12, 0x6b, 0x01, 0x07, 0x8d, 0x64, 0x19, 0xff, +}; +static const size_t TEST_DVPT128_101_INPUT_LEN = 24; + +static const uint8_t TEST_DVPT128_102_NONCE[] = { + 0x70, 0xe1, 0x32, 0x02, 0x3a, 0xca, 0xe1, 0xf8, + 0x8c, 0x7a, 0x23, 0x7b, 0x68, +}; +static const size_t TEST_DVPT128_102_NONCE_LEN = 13; + +static const uint8_t TEST_DVPT128_102_ADATA[] = { + 0x00, +}; +static const size_t TEST_DVPT128_102_ADATA_LEN = 0; + +static const uint8_t TEST_DVPT128_102_EXPECTED[] = { + 0x19, 0xb4, 0xad, 0x22, 0x27, 0x95, 0x32, 0x6c, + 0xb0, 0x31, 0xcf, 0xdb, 0x07, 0xb6, 0x52, 0xdb, + 0xf6, 0x4c, 0xa5, 0xdb, 0x5f, 0xf5, 0xd6, 0xd5, + 0x69, 0xd8, 0xab, 0x41, +}; +static const size_t TEST_DVPT128_102_EXPECTED_LEN = 28; + +static const uint8_t TEST_DVPT128_102_INPUT[] = { + 0xd0, 0xb2, 0xbe, 0xf5, 0xed, 0x1a, 0x87, 0xd9, + 0xc7, 0x3d, 0x4a, 0x45, 0x9c, 0xb0, 0x5c, 0x11, + 0x79, 0x9c, 0x4f, 0x51, 0xad, 0x64, 0x0b, 0x1e, +}; +static const size_t TEST_DVPT128_102_INPUT_LEN = 24; + +static const uint8_t TEST_DVPT128_103_NONCE[] = { + 0x80, 0x10, 0xd3, 0xa2, 0xa1, 0x4f, 0x72, 0xf5, + 0x58, 0x5d, 0xef, 0xc9, 0x40, +}; +static const size_t TEST_DVPT128_103_NONCE_LEN = 13; + +static const uint8_t TEST_DVPT128_103_ADATA[] = { + 0x00, +}; +static const size_t TEST_DVPT128_103_ADATA_LEN = 0; + +static const uint8_t TEST_DVPT128_103_EXPECTED[] = { + 0x76, 0xb6, 0x6b, 0x90, 0x86, 0x57, 0xf4, 0xdf, + 0x8a, 0x32, 0x9c, 0x34, 0xcc, 0xdd, 0xe5, 0x0a, + 0xe7, 0xfc, 0x71, 0xc4, 0xa7, 0x18, 0xb7, 0x12, + 0xf0, 0x0f, 0xe7, 0x64, +}; +static const size_t TEST_DVPT128_103_EXPECTED_LEN = 28; + +static const uint8_t TEST_DVPT128_103_INPUT[] = { + 0x4f, 0xab, 0xa0, 0x55, 0x69, 0xbf, 0x7a, 0xc6, + 0x56, 0x78, 0x0c, 0x16, 0x99, 0x5e, 0x91, 0x22, + 0xe5, 0x65, 0xfe, 0x99, 0x84, 0xbe, 0x8a, 0x68, +}; +static const size_t TEST_DVPT128_103_INPUT_LEN = 24; + +/* Alen = 0, Plen = 24, Nlen = 13, Tlen = 16 */ +static const uint8_t TEST_DVPT128_GROUP_7_MAC_LEN = 16; + +static const uint8_t TEST_DVPT128_GROUP_7_KEY[] = { + 0x90, 0x92, 0x9a, 0x4b, 0x0a, 0xc6, 0x5b, 0x35, + 0x0a, 0xd1, 0x59, 0x16, 0x11, 0xfe, 0x48, 0x29, +}; +static const size_t TEST_DVPT128_GROUP_7_KEY_LEN = 16; + +static const uint8_t TEST_DVPT128_105_NONCE[] = { + 0x5a, 0x8a, 0xa4, 0x85, 0xc3, 0x16, 0xe9, 0x40, + 0x3a, 0xff, 0x85, 0x9f, 0xbb, +}; +static const size_t TEST_DVPT128_105_NONCE_LEN = 13; + +static const uint8_t TEST_DVPT128_105_ADATA[] = { + 0x00, +}; +static const size_t TEST_DVPT128_105_ADATA_LEN = 0; + +static const uint8_t TEST_DVPT128_105_EXPECTED[] = { + 0x4b, 0xfe, 0x4e, 0x35, 0x78, 0x4f, 0x0a, 0x65, + 0xb5, 0x45, 0x47, 0x7e, 0x5e, 0x2f, 0x4b, 0xae, + 0x0e, 0x1e, 0x6f, 0xa7, 0x17, 0xea, 0xf2, 0xcb, + 0x6a, 0x9a, 0x97, 0x0b, 0x9b, 0xeb, 0x2a, 0xc1, + 0xbd, 0x4f, 0xd6, 0x21, 0x68, 0xf8, 0x37, 0x8a, +}; +static const size_t TEST_DVPT128_105_EXPECTED_LEN = 40; + +static const uint8_t TEST_DVPT128_105_INPUT[] = { + 0xa1, 0x6a, 0x2e, 0x74, 0x1f, 0x1c, 0xd9, 0x71, + 0x72, 0x85, 0xb6, 0xd8, 0x82, 0xc1, 0xfc, 0x53, + 0x65, 0x5e, 0x97, 0x73, 0x76, 0x1a, 0xd6, 0x97, +}; +static const size_t TEST_DVPT128_105_INPUT_LEN = 24; + +static const uint8_t TEST_DVPT128_109_NONCE[] = { + 0x24, 0xb7, 0xa6, 0x53, 0x91, 0xf8, 0x8b, 0xea, + 0x38, 0xfc, 0xd5, 0x4a, 0x9a, +}; +static const size_t TEST_DVPT128_109_NONCE_LEN = 13; + +static const uint8_t TEST_DVPT128_109_ADATA[] = { + 0x00, +}; +static const size_t TEST_DVPT128_109_ADATA_LEN = 0; + +static const uint8_t TEST_DVPT128_109_EXPECTED[] = { + 0x9f, 0xa8, 0x46, 0xef, 0x8d, 0x19, 0x8c, 0x53, + 0x8f, 0x84, 0xf8, 0x56, 0xba, 0xb8, 0xf7, 0xf9, + 0xc3, 0xbe, 0xd9, 0x0b, 0x53, 0xac, 0xb6, 0xa3, + 0x26, 0x58, 0xe0, 0x77, 0x68, 0x73, 0x15, 0xea, + 0xf1, 0x14, 0x58, 0xbd, 0xf6, 0xe3, 0xc3, 0x6a, +}; +static const size_t TEST_DVPT128_109_EXPECTED_LEN = 40; + +static const uint8_t TEST_DVPT128_109_INPUT[] = { + 0x43, 0x41, 0x97, 0x15, 0xce, 0xf9, 0xa4, 0x8d, + 0xc7, 0x28, 0x0b, 0xc0, 0x35, 0x08, 0x2a, 0x65, + 0x81, 0xaf, 0xd1, 0xd8, 0x2b, 0xee, 0x9d, 0x1a, +}; +static const size_t TEST_DVPT128_109_INPUT_LEN = 24; + +static const uint8_t TEST_DVPT128_116_NONCE[] = { + 0xc4, 0x7a, 0xf8, 0x0c, 0xd2, 0x6d, 0x04, 0x76, + 0x30, 0xc1, 0xfd, 0xf0, 0xd1, +}; +static const size_t TEST_DVPT128_116_NONCE_LEN = 13; + +static const uint8_t TEST_DVPT128_116_ADATA[] = { + 0x00, +}; +static const size_t TEST_DVPT128_116_ADATA_LEN = 0; + +static const uint8_t TEST_DVPT128_116_EXPECTED[] = { + 0x99, 0xe4, 0x0b, 0x3c, 0x67, 0xac, 0xa9, 0x5d, + 0xd4, 0x46, 0x2c, 0x20, 0xcb, 0xd6, 0xb2, 0x74, + 0x1e, 0x70, 0x33, 0xfc, 0x4f, 0x41, 0xa9, 0x75, + 0xc9, 0x39, 0x0f, 0xbd, 0xb9, 0xec, 0x41, 0x62, + 0x67, 0x09, 0x6c, 0xcb, 0xf2, 0xc1, 0x48, 0xe5, +}; +static const size_t TEST_DVPT128_116_EXPECTED_LEN = 40; + +static const uint8_t TEST_DVPT128_116_INPUT[] = { + 0xd8, 0x30, 0x6c, 0x9c, 0x4e, 0xa6, 0xc6, 0x9c, + 0x6e, 0x2a, 0xd0, 0xfc, 0x0e, 0x49, 0xb1, 0xe0, + 0x12, 0x6b, 0x01, 0x07, 0x8d, 0x64, 0x19, 0xff, +}; +static const size_t TEST_DVPT128_116_INPUT_LEN = 24; + +static const uint8_t TEST_DVPT128_117_NONCE[] = { + 0x70, 0xe1, 0x32, 0x02, 0x3a, 0xca, 0xe1, 0xf8, + 0x8c, 0x7a, 0x23, 0x7b, 0x68, +}; +static const size_t TEST_DVPT128_117_NONCE_LEN = 13; + +static const uint8_t TEST_DVPT128_117_ADATA[] = { + 0x00, +}; +static const size_t TEST_DVPT128_117_ADATA_LEN = 0; + +static const uint8_t TEST_DVPT128_117_EXPECTED[] = { + 0xde, 0x07, 0x94, 0x18, 0xc2, 0x5b, 0xa6, 0x7e, + 0x5f, 0xda, 0x00, 0x99, 0x98, 0xe3, 0xfc, 0xe6, + 0x1b, 0xfd, 0xc3, 0xb7, 0x78, 0x7c, 0xf0, 0x66, + 0x55, 0xc1, 0x8a, 0xe3, 0x8b, 0x7e, 0xe7, 0xf0, + 0x0f, 0x96, 0xcf, 0xca, 0x4f, 0xe9, 0xa2, 0xef, +}; +static const size_t TEST_DVPT128_117_EXPECTED_LEN = 40; + +static const uint8_t TEST_DVPT128_117_INPUT[] = { + 0xd0, 0xb2, 0xbe, 0xf5, 0xed, 0x1a, 0x87, 0xd9, + 0xc7, 0x3d, 0x4a, 0x45, 0x9c, 0xb0, 0x5c, 0x11, + 0x79, 0x9c, 0x4f, 0x51, 0xad, 0x64, 0x0b, 0x1e, +}; +static const size_t TEST_DVPT128_117_INPUT_LEN = 24; + +static const uint8_t TEST_DVPT128_118_NONCE[] = { + 0x80, 0x10, 0xd3, 0xa2, 0xa1, 0x4f, 0x72, 0xf5, + 0x58, 0x5d, 0xef, 0xc9, 0x40, +}; +static const size_t TEST_DVPT128_118_NONCE_LEN = 13; + +static const uint8_t TEST_DVPT128_118_ADATA[] = { + 0x00, +}; +static const size_t TEST_DVPT128_118_ADATA_LEN = 0; + +static const uint8_t TEST_DVPT128_118_EXPECTED[] = { + 0xfb, 0xab, 0x64, 0xd8, 0xdd, 0x8b, 0x6e, 0x33, + 0xc7, 0xcc, 0x61, 0x24, 0xcd, 0x65, 0xf0, 0x04, + 0xd7, 0x24, 0x72, 0x77, 0xfe, 0x98, 0xd5, 0xd3, + 0xb3, 0x53, 0x57, 0xa3, 0x5f, 0xf9, 0xe5, 0x8e, + 0x18, 0xd6, 0xd8, 0x0d, 0xf9, 0xfc, 0x33, 0x5d, +}; +static const size_t TEST_DVPT128_118_EXPECTED_LEN = 40; + +static const uint8_t TEST_DVPT128_118_INPUT[] = { + 0x4f, 0xab, 0xa0, 0x55, 0x69, 0xbf, 0x7a, 0xc6, + 0x56, 0x78, 0x0c, 0x16, 0x99, 0x5e, 0x91, 0x22, + 0xe5, 0x65, 0xfe, 0x99, 0x84, 0xbe, 0x8a, 0x68, +}; +static const size_t TEST_DVPT128_118_INPUT_LEN = 24; + +/* Alen = 32, Plen = 0, Nlen = 7, Tlen = 4 */ +static const uint8_t TEST_DVPT128_GROUP_8_MAC_LEN = 4; + +static const uint8_t TEST_DVPT128_GROUP_8_KEY[] = { + 0x90, 0x92, 0x9a, 0x4b, 0x0a, 0xc6, 0x5b, 0x35, + 0x0a, 0xd1, 0x59, 0x16, 0x11, 0xfe, 0x48, 0x29, +}; +static const size_t TEST_DVPT128_GROUP_8_KEY_LEN = 16; + +static const uint8_t TEST_DVPT128_120_NONCE[] = { + 0x5a, 0x8a, 0xa4, 0x85, 0xc3, 0x16, 0xe9, +}; +static const size_t TEST_DVPT128_120_NONCE_LEN = 7; + +static const uint8_t TEST_DVPT128_120_ADATA[] = { + 0x37, 0x96, 0xcf, 0x51, 0xb8, 0x72, 0x66, 0x52, + 0xa4, 0x20, 0x47, 0x33, 0xb8, 0xfb, 0xb0, 0x47, + 0xcf, 0x00, 0xfb, 0x91, 0xa9, 0x83, 0x7e, 0x22, + 0xec, 0x22, 0xb1, 0xa2, 0x68, 0xf8, 0x8e, 0x2c, +}; +static const size_t TEST_DVPT128_120_ADATA_LEN = 32; + +static const uint8_t TEST_DVPT128_120_EXPECTED[] = { + 0x78, 0x2e, 0x43, 0x18, +}; +static const size_t TEST_DVPT128_120_EXPECTED_LEN = 4; + +static const uint8_t TEST_DVPT128_120_INPUT[] = { + 0x00, +}; +static const size_t TEST_DVPT128_120_INPUT_LEN = 0; + +static const uint8_t TEST_DVPT128_124_NONCE[] = { + 0x8c, 0x68, 0x7b, 0x43, 0x18, 0x81, 0x3a, +}; +static const size_t TEST_DVPT128_124_NONCE_LEN = 7; + +static const uint8_t TEST_DVPT128_124_ADATA[] = { + 0xfc, 0xad, 0x52, 0xa8, 0x85, 0x44, 0x32, 0x5b, + 0xb3, 0x1e, 0xb5, 0xde, 0x4a, 0x41, 0xdb, 0xff, + 0x6a, 0x96, 0xf6, 0x9d, 0x09, 0x93, 0xb9, 0x69, + 0xa0, 0x17, 0x92, 0xee, 0x23, 0x95, 0x3a, 0xcf, +}; +static const size_t TEST_DVPT128_124_ADATA_LEN = 32; + +static const uint8_t TEST_DVPT128_124_EXPECTED[] = { + 0x1b, 0xe5, 0x35, 0xa0, +}; +static const size_t TEST_DVPT128_124_EXPECTED_LEN = 4; + +static const uint8_t TEST_DVPT128_124_INPUT[] = { + 0x00, +}; +static const size_t TEST_DVPT128_124_INPUT_LEN = 0; + +static const uint8_t TEST_DVPT128_131_NONCE[] = { + 0xa1, 0xae, 0xda, 0x4b, 0x4c, 0xb8, 0xdd, +}; +static const size_t TEST_DVPT128_131_NONCE_LEN = 7; + +static const uint8_t TEST_DVPT128_131_ADATA[] = { + 0xdb, 0x30, 0x22, 0xef, 0x4c, 0xd6, 0x8a, 0xe2, + 0x2b, 0x50, 0x15, 0x99, 0x44, 0x8f, 0xfe, 0x2d, + 0xda, 0x15, 0xcf, 0xd2, 0xe2, 0x59, 0x31, 0x5c, + 0x6f, 0x6d, 0x03, 0x03, 0x6e, 0xde, 0xa9, 0x63, +}; +static const size_t TEST_DVPT128_131_ADATA_LEN = 32; + +static const uint8_t TEST_DVPT128_131_EXPECTED[] = { + 0xe6, 0x17, 0xe0, 0x06, +}; +static const size_t TEST_DVPT128_131_EXPECTED_LEN = 4; + +static const uint8_t TEST_DVPT128_131_INPUT[] = { + 0x00, +}; +static const size_t TEST_DVPT128_131_INPUT_LEN = 0; + +static const uint8_t TEST_DVPT128_132_NONCE[] = { + 0xf2, 0x48, 0xe5, 0x22, 0x5e, 0x3d, 0x9a, +}; +static const size_t TEST_DVPT128_132_NONCE_LEN = 7; + +static const uint8_t TEST_DVPT128_132_ADATA[] = { + 0xfd, 0xc6, 0x4e, 0xf7, 0x6a, 0x3b, 0xfd, 0x0a, + 0x15, 0xd0, 0xbc, 0x8e, 0x8b, 0xac, 0xaf, 0x64, + 0x34, 0x67, 0x96, 0xa3, 0xe3, 0x5a, 0xfc, 0xf2, + 0xac, 0x1a, 0xb1, 0x36, 0xf6, 0x3f, 0x7b, 0x6e, +}; +static const size_t TEST_DVPT128_132_ADATA_LEN = 32; + +static const uint8_t TEST_DVPT128_132_EXPECTED[] = { + 0xb7, 0x90, 0x93, 0x95, +}; +static const size_t TEST_DVPT128_132_EXPECTED_LEN = 4; + +static const uint8_t TEST_DVPT128_132_INPUT[] = { + 0x00, +}; +static const size_t TEST_DVPT128_132_INPUT_LEN = 0; + +static const uint8_t TEST_DVPT128_133_NONCE[] = { + 0xe6, 0x82, 0x28, 0xf5, 0xc6, 0x5b, 0x73, +}; +static const size_t TEST_DVPT128_133_NONCE_LEN = 7; + +static const uint8_t TEST_DVPT128_133_ADATA[] = { + 0x61, 0x4e, 0xfd, 0xf8, 0x9c, 0xe2, 0xa9, 0xfc, + 0xbd, 0x38, 0xbd, 0xc0, 0xb4, 0xce, 0xce, 0x54, + 0xdf, 0xd7, 0x53, 0x28, 0x80, 0xe0, 0xb4, 0xce, + 0x6e, 0xb3, 0xa4, 0x01, 0x0b, 0x7c, 0xb1, 0xe7, +}; +static const size_t TEST_DVPT128_133_ADATA_LEN = 32; + +static const uint8_t TEST_DVPT128_133_EXPECTED[] = { + 0x8a, 0x05, 0xd2, 0xea, +}; +static const size_t TEST_DVPT128_133_EXPECTED_LEN = 4; + +static const uint8_t TEST_DVPT128_133_INPUT[] = { + 0x00, +}; +static const size_t TEST_DVPT128_133_INPUT_LEN = 0; + +/* Alen = 32, Plen = 0, Nlen = 7, Tlen = 16 */ +static const uint8_t TEST_DVPT128_GROUP_9_MAC_LEN = 16; + +static const uint8_t TEST_DVPT128_GROUP_9_KEY[] = { + 0x6a, 0x79, 0x8d, 0x7c, 0x5e, 0x1a, 0x72, 0xb4, + 0x3e, 0x20, 0xad, 0x5c, 0x7b, 0x08, 0x56, 0x7b, +}; +static const size_t TEST_DVPT128_GROUP_9_KEY_LEN = 16; + +static const uint8_t TEST_DVPT128_135_NONCE[] = { + 0x5a, 0x8a, 0xa4, 0x85, 0xc3, 0x16, 0xe9, +}; +static const size_t TEST_DVPT128_135_NONCE_LEN = 7; + +static const uint8_t TEST_DVPT128_135_ADATA[] = { + 0x37, 0x96, 0xcf, 0x51, 0xb8, 0x72, 0x66, 0x52, + 0xa4, 0x20, 0x47, 0x33, 0xb8, 0xfb, 0xb0, 0x47, + 0xcf, 0x00, 0xfb, 0x91, 0xa9, 0x83, 0x7e, 0x22, + 0xec, 0x22, 0xb1, 0xa2, 0x68, 0xf8, 0x8e, 0x2c, +}; +static const size_t TEST_DVPT128_135_ADATA_LEN = 32; + +static const uint8_t TEST_DVPT128_135_EXPECTED[] = { + 0x41, 0xb4, 0x76, 0x01, 0x3f, 0x45, 0xe4, 0xa7, + 0x81, 0xf2, 0x53, 0xa6, 0xf3, 0xb1, 0xe5, 0x30, +}; +static const size_t TEST_DVPT128_135_EXPECTED_LEN = 16; + +static const uint8_t TEST_DVPT128_135_INPUT[] = { + 0x00, +}; +static const size_t TEST_DVPT128_135_INPUT_LEN = 0; + +static const uint8_t TEST_DVPT128_139_NONCE[] = { + 0x8c, 0x68, 0x7b, 0x43, 0x18, 0x81, 0x3a, +}; +static const size_t TEST_DVPT128_139_NONCE_LEN = 7; + +static const uint8_t TEST_DVPT128_139_ADATA[] = { + 0xfc, 0xad, 0x52, 0xa8, 0x85, 0x44, 0x32, 0x5b, + 0xb3, 0x1e, 0xb5, 0xde, 0x4a, 0x41, 0xdb, 0xff, + 0x6a, 0x96, 0xf6, 0x9d, 0x09, 0x93, 0xb9, 0x69, + 0xa0, 0x17, 0x92, 0xee, 0x23, 0x95, 0x3a, 0xcf, +}; +static const size_t TEST_DVPT128_139_ADATA_LEN = 32; + +static const uint8_t TEST_DVPT128_139_EXPECTED[] = { + 0xec, 0x77, 0x4d, 0x90, 0x00, 0x76, 0x3b, 0xba, + 0x3a, 0x5a, 0xc3, 0x07, 0x41, 0x88, 0x27, 0xb2, +}; +static const size_t TEST_DVPT128_139_EXPECTED_LEN = 16; + +static const uint8_t TEST_DVPT128_139_INPUT[] = { + 0x00, +}; +static const size_t TEST_DVPT128_139_INPUT_LEN = 0; + +static const uint8_t TEST_DVPT128_146_NONCE[] = { + 0xa1, 0xae, 0xda, 0x4b, 0x4c, 0xb8, 0xdd, +}; +static const size_t TEST_DVPT128_146_NONCE_LEN = 7; + +static const uint8_t TEST_DVPT128_146_ADATA[] = { + 0xdb, 0x30, 0x22, 0xef, 0x4c, 0xd6, 0x8a, 0xe2, + 0x2b, 0x50, 0x15, 0x99, 0x44, 0x8f, 0xfe, 0x2d, + 0xda, 0x15, 0xcf, 0xd2, 0xe2, 0x59, 0x31, 0x5c, + 0x6f, 0x6d, 0x03, 0x03, 0x6e, 0xde, 0xa9, 0x63, +}; +static const size_t TEST_DVPT128_146_ADATA_LEN = 32; + +static const uint8_t TEST_DVPT128_146_EXPECTED[] = { + 0x0b, 0x9d, 0x79, 0xe8, 0xe3, 0x3e, 0xc4, 0x55, + 0x32, 0xaf, 0x55, 0x15, 0xa9, 0x9f, 0x05, 0xdf, +}; +static const size_t TEST_DVPT128_146_EXPECTED_LEN = 16; + +static const uint8_t TEST_DVPT128_146_INPUT[] = { + 0x00, +}; +static const size_t TEST_DVPT128_146_INPUT_LEN = 0; + +static const uint8_t TEST_DVPT128_147_NONCE[] = { + 0xf2, 0x48, 0xe5, 0x22, 0x5e, 0x3d, 0x9a, +}; +static const size_t TEST_DVPT128_147_NONCE_LEN = 7; + +static const uint8_t TEST_DVPT128_147_ADATA[] = { + 0xfd, 0xc6, 0x4e, 0xf7, 0x6a, 0x3b, 0xfd, 0x0a, + 0x15, 0xd0, 0xbc, 0x8e, 0x8b, 0xac, 0xaf, 0x64, + 0x34, 0x67, 0x96, 0xa3, 0xe3, 0x5a, 0xfc, 0xf2, + 0xac, 0x1a, 0xb1, 0x36, 0xf6, 0x3f, 0x7b, 0x6e, +}; +static const size_t TEST_DVPT128_147_ADATA_LEN = 32; + +static const uint8_t TEST_DVPT128_147_EXPECTED[] = { + 0x15, 0x83, 0xe1, 0xe5, 0xa8, 0x60, 0x01, 0xbb, + 0xce, 0xc6, 0x22, 0x92, 0xcc, 0xfd, 0x4d, 0x48, +}; +static const size_t TEST_DVPT128_147_EXPECTED_LEN = 16; + +static const uint8_t TEST_DVPT128_147_INPUT[] = { + 0x00, +}; +static const size_t TEST_DVPT128_147_INPUT_LEN = 0; + +static const uint8_t TEST_DVPT128_148_NONCE[] = { + 0xe6, 0x82, 0x28, 0xf5, 0xc6, 0x5b, 0x73, +}; +static const size_t TEST_DVPT128_148_NONCE_LEN = 7; + +static const uint8_t TEST_DVPT128_148_ADATA[] = { + 0x61, 0x4e, 0xfd, 0xf8, 0x9c, 0xe2, 0xa9, 0xfc, + 0xbd, 0x38, 0xbd, 0xc0, 0xb4, 0xce, 0xce, 0x54, + 0xdf, 0xd7, 0x53, 0x28, 0x80, 0xe0, 0xb4, 0xce, + 0x6e, 0xb3, 0xa4, 0x01, 0x0b, 0x7c, 0xb1, 0xe7, +}; +static const size_t TEST_DVPT128_148_ADATA_LEN = 32; + +static const uint8_t TEST_DVPT128_148_EXPECTED[] = { + 0xb7, 0x2c, 0xaa, 0xc6, 0x36, 0x2e, 0x68, 0xe4, + 0x45, 0xf6, 0x9f, 0x60, 0x5f, 0x21, 0xe0, 0xa2, +}; +static const size_t TEST_DVPT128_148_EXPECTED_LEN = 16; + +static const uint8_t TEST_DVPT128_148_INPUT[] = { + 0x00, +}; +static const size_t TEST_DVPT128_148_INPUT_LEN = 0; + +/* Alen = 32, Plen = 0, Nlen = 13, Tlen = 4 */ +static const uint8_t TEST_DVPT128_GROUP_10_MAC_LEN = 4; + +static const uint8_t TEST_DVPT128_GROUP_10_KEY[] = { + 0x6a, 0x79, 0x8d, 0x7c, 0x5e, 0x1a, 0x72, 0xb4, + 0x3e, 0x20, 0xad, 0x5c, 0x7b, 0x08, 0x56, 0x7b, +}; +static const size_t TEST_DVPT128_GROUP_10_KEY_LEN = 16; + +static const uint8_t TEST_DVPT128_150_NONCE[] = { + 0x5a, 0x8a, 0xa4, 0x85, 0xc3, 0x16, 0xe9, 0x40, + 0x3a, 0xff, 0x85, 0x9f, 0xbb, +}; +static const size_t TEST_DVPT128_150_NONCE_LEN = 13; + +static const uint8_t TEST_DVPT128_150_ADATA[] = { + 0xa1, 0x6a, 0x2e, 0x74, 0x1f, 0x1c, 0xd9, 0x71, + 0x72, 0x85, 0xb6, 0xd8, 0x82, 0xc1, 0xfc, 0x53, + 0x65, 0x5e, 0x97, 0x73, 0x76, 0x1a, 0xd6, 0x97, + 0xa7, 0xee, 0x64, 0x10, 0x18, 0x4c, 0x79, 0x82, +}; +static const size_t TEST_DVPT128_150_ADATA_LEN = 32; + +static const uint8_t TEST_DVPT128_150_EXPECTED[] = { + 0x9f, 0x69, 0xf2, 0x4f, +}; +static const size_t TEST_DVPT128_150_EXPECTED_LEN = 4; + +static const uint8_t TEST_DVPT128_150_INPUT[] = { + 0x00, +}; +static const size_t TEST_DVPT128_150_INPUT_LEN = 0; + +static const uint8_t TEST_DVPT128_154_NONCE[] = { + 0x1e, 0x7e, 0x51, 0xf0, 0xfa, 0x9a, 0x33, 0xed, + 0x61, 0x8c, 0x26, 0xf5, 0xe3, +}; +static const size_t TEST_DVPT128_154_NONCE_LEN = 13; + +static const uint8_t TEST_DVPT128_154_ADATA[] = { + 0xda, 0x9b, 0x8f, 0xfb, 0x0f, 0x3c, 0x2a, 0xee, + 0x2e, 0x38, 0x6c, 0xc9, 0xf0, 0x35, 0xec, 0x1e, + 0xb3, 0xe6, 0x29, 0xbd, 0x15, 0x44, 0xc1, 0x1d, + 0xc2, 0x1b, 0xe4, 0xfd, 0x8a, 0xc9, 0x07, 0x4a, +}; +static const size_t TEST_DVPT128_154_ADATA_LEN = 32; + +static const uint8_t TEST_DVPT128_154_EXPECTED[] = { + 0xc2, 0x83, 0x46, 0x6f, +}; +static const size_t TEST_DVPT128_154_EXPECTED_LEN = 4; + +static const uint8_t TEST_DVPT128_154_INPUT[] = { + 0x00, +}; +static const size_t TEST_DVPT128_154_INPUT_LEN = 0; + +static const uint8_t TEST_DVPT128_161_NONCE[] = { + 0x78, 0x64, 0xc7, 0x17, 0xec, 0x93, 0xdb, 0x38, + 0xb1, 0x06, 0x79, 0xbe, 0x47, +}; +static const size_t TEST_DVPT128_161_NONCE_LEN = 13; + +static const uint8_t TEST_DVPT128_161_ADATA[] = { + 0x67, 0x9a, 0xad, 0x1a, 0xd1, 0xe5, 0x70, 0x29, + 0xe3, 0x36, 0x2b, 0x32, 0x55, 0x72, 0xfc, 0x71, + 0xca, 0xc5, 0x31, 0x84, 0xb0, 0xf1, 0x54, 0x68, + 0x67, 0xe6, 0x65, 0xa4, 0xa5, 0x94, 0x66, 0xc4, +}; +static const size_t TEST_DVPT128_161_ADATA_LEN = 32; + +static const uint8_t TEST_DVPT128_161_EXPECTED[] = { + 0x48, 0xf3, 0xa1, 0xec, +}; +static const size_t TEST_DVPT128_161_EXPECTED_LEN = 4; + +static const uint8_t TEST_DVPT128_161_INPUT[] = { + 0x00, +}; +static const size_t TEST_DVPT128_161_INPUT_LEN = 0; + +static const uint8_t TEST_DVPT128_162_NONCE[] = { + 0xc3, 0xbf, 0x9d, 0xfe, 0x9d, 0x6c, 0x26, 0xf5, + 0x43, 0x18, 0x8f, 0xb4, 0x57, +}; +static const size_t TEST_DVPT128_162_NONCE_LEN = 13; + +static const uint8_t TEST_DVPT128_162_ADATA[] = { + 0xe3, 0x01, 0xf6, 0x9a, 0xd3, 0xa7, 0xe0, 0x8a, + 0x3d, 0x02, 0x46, 0x2f, 0x0a, 0xa5, 0x84, 0x44, + 0x9e, 0xb0, 0x44, 0x9b, 0x0e, 0x3c, 0x50, 0xaa, + 0x8d, 0xfa, 0xa4, 0x47, 0x28, 0x16, 0xc8, 0xb0, +}; +static const size_t TEST_DVPT128_162_ADATA_LEN = 32; + +static const uint8_t TEST_DVPT128_162_EXPECTED[] = { + 0x24, 0x76, 0x3d, 0xef, +}; +static const size_t TEST_DVPT128_162_EXPECTED_LEN = 4; + +static const uint8_t TEST_DVPT128_162_INPUT[] = { + 0x00, +}; +static const size_t TEST_DVPT128_162_INPUT_LEN = 0; + +static const uint8_t TEST_DVPT128_163_NONCE[] = { + 0x15, 0x27, 0x65, 0x7d, 0x2f, 0xd9, 0x8f, 0x7d, + 0xec, 0xa5, 0x5c, 0xc6, 0x49, +}; +static const size_t TEST_DVPT128_163_NONCE_LEN = 13; + +static const uint8_t TEST_DVPT128_163_ADATA[] = { + 0xf4, 0xc7, 0x23, 0x43, 0x3b, 0x7c, 0xaf, 0xe3, + 0xcd, 0xa9, 0xbb, 0x49, 0x40, 0xa2, 0x1a, 0x89, + 0xa8, 0x38, 0x2d, 0x13, 0x01, 0x8b, 0x62, 0x2c, + 0xcd, 0x1f, 0xfb, 0x9f, 0xfd, 0x32, 0x11, 0xaf, +}; +static const size_t TEST_DVPT128_163_ADATA_LEN = 32; + +static const uint8_t TEST_DVPT128_163_EXPECTED[] = { + 0x63, 0x39, 0x4b, 0xee, +}; +static const size_t TEST_DVPT128_163_EXPECTED_LEN = 4; + +static const uint8_t TEST_DVPT128_163_INPUT[] = { + 0x00, +}; +static const size_t TEST_DVPT128_163_INPUT_LEN = 0; + +/* Alen = 32, Plen = 0, Nlen = 13, Tlen = 16 */ +static const uint8_t TEST_DVPT128_GROUP_11_MAC_LEN = 16; + +static const uint8_t TEST_DVPT128_GROUP_11_KEY[] = { + 0xf9, 0xfd, 0xca, 0x4a, 0xc6, 0x4f, 0xe7, 0xf0, + 0x14, 0xde, 0x0f, 0x43, 0x03, 0x9c, 0x75, 0x71, +}; +static const size_t TEST_DVPT128_GROUP_11_KEY_LEN = 16; + +static const uint8_t TEST_DVPT128_165_NONCE[] = { + 0x5a, 0x8a, 0xa4, 0x85, 0xc3, 0x16, 0xe9, 0x40, + 0x3a, 0xff, 0x85, 0x9f, 0xbb, +}; +static const size_t TEST_DVPT128_165_NONCE_LEN = 13; + +static const uint8_t TEST_DVPT128_165_ADATA[] = { + 0xa1, 0x6a, 0x2e, 0x74, 0x1f, 0x1c, 0xd9, 0x71, + 0x72, 0x85, 0xb6, 0xd8, 0x82, 0xc1, 0xfc, 0x53, + 0x65, 0x5e, 0x97, 0x73, 0x76, 0x1a, 0xd6, 0x97, + 0xa7, 0xee, 0x64, 0x10, 0x18, 0x4c, 0x79, 0x82, +}; +static const size_t TEST_DVPT128_165_ADATA_LEN = 32; + +static const uint8_t TEST_DVPT128_165_EXPECTED[] = { + 0x18, 0x59, 0xac, 0x36, 0xa4, 0x0a, 0x6b, 0x28, + 0xb3, 0x42, 0x66, 0x25, 0x36, 0x27, 0x79, 0x7a, +}; +static const size_t TEST_DVPT128_165_EXPECTED_LEN = 16; + +static const uint8_t TEST_DVPT128_165_INPUT[] = { + 0x00, +}; +static const size_t TEST_DVPT128_165_INPUT_LEN = 0; + +static const uint8_t TEST_DVPT128_169_NONCE[] = { + 0x1e, 0x7e, 0x51, 0xf0, 0xfa, 0x9a, 0x33, 0xed, + 0x61, 0x8c, 0x26, 0xf5, 0xe3, +}; +static const size_t TEST_DVPT128_169_NONCE_LEN = 13; + +static const uint8_t TEST_DVPT128_169_ADATA[] = { + 0xda, 0x9b, 0x8f, 0xfb, 0x0f, 0x3c, 0x2a, 0xee, + 0x2e, 0x38, 0x6c, 0xc9, 0xf0, 0x35, 0xec, 0x1e, + 0xb3, 0xe6, 0x29, 0xbd, 0x15, 0x44, 0xc1, 0x1d, + 0xc2, 0x1b, 0xe4, 0xfd, 0x8a, 0xc9, 0x07, 0x4a, +}; +static const size_t TEST_DVPT128_169_ADATA_LEN = 32; + +static const uint8_t TEST_DVPT128_169_EXPECTED[] = { + 0x8b, 0x5b, 0xfe, 0x6b, 0x5b, 0x55, 0x52, 0x00, + 0x73, 0x00, 0xba, 0xe7, 0x11, 0x72, 0x61, 0x2f, +}; +static const size_t TEST_DVPT128_169_EXPECTED_LEN = 16; + +static const uint8_t TEST_DVPT128_169_INPUT[] = { + 0x00, +}; +static const size_t TEST_DVPT128_169_INPUT_LEN = 0; + +static const uint8_t TEST_DVPT128_176_NONCE[] = { + 0x78, 0x64, 0xc7, 0x17, 0xec, 0x93, 0xdb, 0x38, + 0xb1, 0x06, 0x79, 0xbe, 0x47, +}; +static const size_t TEST_DVPT128_176_NONCE_LEN = 13; + +static const uint8_t TEST_DVPT128_176_ADATA[] = { + 0x67, 0x9a, 0xad, 0x1a, 0xd1, 0xe5, 0x70, 0x29, + 0xe3, 0x36, 0x2b, 0x32, 0x55, 0x72, 0xfc, 0x71, + 0xca, 0xc5, 0x31, 0x84, 0xb0, 0xf1, 0x54, 0x68, + 0x67, 0xe6, 0x65, 0xa4, 0xa5, 0x94, 0x66, 0xc4, +}; +static const size_t TEST_DVPT128_176_ADATA_LEN = 32; + +static const uint8_t TEST_DVPT128_176_EXPECTED[] = { + 0xe9, 0xcf, 0xb1, 0x06, 0x93, 0x80, 0x43, 0x4f, + 0x22, 0x1d, 0xb4, 0x22, 0x9a, 0x08, 0x3a, 0x76, +}; +static const size_t TEST_DVPT128_176_EXPECTED_LEN = 16; + +static const uint8_t TEST_DVPT128_176_INPUT[] = { + 0x00, +}; +static const size_t TEST_DVPT128_176_INPUT_LEN = 0; + +static const uint8_t TEST_DVPT128_177_NONCE[] = { + 0xc3, 0xbf, 0x9d, 0xfe, 0x9d, 0x6c, 0x26, 0xf5, + 0x43, 0x18, 0x8f, 0xb4, 0x57, +}; +static const size_t TEST_DVPT128_177_NONCE_LEN = 13; + +static const uint8_t TEST_DVPT128_177_ADATA[] = { + 0xe3, 0x01, 0xf6, 0x9a, 0xd3, 0xa7, 0xe0, 0x8a, + 0x3d, 0x02, 0x46, 0x2f, 0x0a, 0xa5, 0x84, 0x44, + 0x9e, 0xb0, 0x44, 0x9b, 0x0e, 0x3c, 0x50, 0xaa, + 0x8d, 0xfa, 0xa4, 0x47, 0x28, 0x16, 0xc8, 0xb0, +}; +static const size_t TEST_DVPT128_177_ADATA_LEN = 32; + +static const uint8_t TEST_DVPT128_177_EXPECTED[] = { + 0x38, 0x0c, 0xb5, 0x7f, 0xd5, 0x31, 0xbb, 0x1d, + 0xcf, 0x22, 0x35, 0x05, 0x18, 0xbb, 0xf8, 0xaf, +}; +static const size_t TEST_DVPT128_177_EXPECTED_LEN = 16; + +static const uint8_t TEST_DVPT128_177_INPUT[] = { + 0x00, +}; +static const size_t TEST_DVPT128_177_INPUT_LEN = 0; + +static const uint8_t TEST_DVPT128_178_NONCE[] = { + 0x15, 0x27, 0x65, 0x7d, 0x2f, 0xd9, 0x8f, 0x7d, + 0xec, 0xa5, 0x5c, 0xc6, 0x49, +}; +static const size_t TEST_DVPT128_178_NONCE_LEN = 13; + +static const uint8_t TEST_DVPT128_178_ADATA[] = { + 0xf4, 0xc7, 0x23, 0x43, 0x3b, 0x7c, 0xaf, 0xe3, + 0xcd, 0xa9, 0xbb, 0x49, 0x40, 0xa2, 0x1a, 0x89, + 0xa8, 0x38, 0x2d, 0x13, 0x01, 0x8b, 0x62, 0x2c, + 0xcd, 0x1f, 0xfb, 0x9f, 0xfd, 0x32, 0x11, 0xaf, +}; +static const size_t TEST_DVPT128_178_ADATA_LEN = 32; + +static const uint8_t TEST_DVPT128_178_EXPECTED[] = { + 0xfb, 0xf2, 0xbe, 0xcc, 0x35, 0xb5, 0x02, 0x40, + 0x78, 0xbf, 0xcf, 0xc1, 0xf8, 0x31, 0xb6, 0x69, +}; +static const size_t TEST_DVPT128_178_EXPECTED_LEN = 16; + +static const uint8_t TEST_DVPT128_178_INPUT[] = { + 0x00, +}; +static const size_t TEST_DVPT128_178_INPUT_LEN = 0; + +/* Alen = 32, Plen = 24, Nlen = 7, Tlen = 4 */ +static const uint8_t TEST_DVPT128_GROUP_12_MAC_LEN = 4; + +static const uint8_t TEST_DVPT128_GROUP_12_KEY[] = { + 0xf9, 0xfd, 0xca, 0x4a, 0xc6, 0x4f, 0xe7, 0xf0, + 0x14, 0xde, 0x0f, 0x43, 0x03, 0x9c, 0x75, 0x71, +}; +static const size_t TEST_DVPT128_GROUP_12_KEY_LEN = 16; + +static const uint8_t TEST_DVPT128_180_NONCE[] = { + 0x5a, 0x8a, 0xa4, 0x85, 0xc3, 0x16, 0xe9, +}; +static const size_t TEST_DVPT128_180_NONCE_LEN = 7; + +static const uint8_t TEST_DVPT128_180_ADATA[] = { + 0x37, 0x96, 0xcf, 0x51, 0xb8, 0x72, 0x66, 0x52, + 0xa4, 0x20, 0x47, 0x33, 0xb8, 0xfb, 0xb0, 0x47, + 0xcf, 0x00, 0xfb, 0x91, 0xa9, 0x83, 0x7e, 0x22, + 0xec, 0x22, 0xb1, 0xa2, 0x68, 0xf8, 0x8e, 0x2c, +}; +static const size_t TEST_DVPT128_180_ADATA_LEN = 32; + +static const uint8_t TEST_DVPT128_180_EXPECTED[] = { + 0x6b, 0xe3, 0x18, 0x60, 0xca, 0x27, 0x1e, 0xf4, + 0x48, 0xde, 0x8f, 0x8d, 0x8b, 0x39, 0x34, 0x6d, + 0xaf, 0x4b, 0x81, 0xd7, 0xe9, 0x2d, 0x65, 0xb3, + 0x38, 0xf1, 0x25, 0xfa, +}; +static const size_t TEST_DVPT128_180_EXPECTED_LEN = 28; + +static const uint8_t TEST_DVPT128_180_INPUT[] = { + 0xa2, 0x65, 0x48, 0x0c, 0xa8, 0x8d, 0x5f, 0x53, + 0x6d, 0xb0, 0xdc, 0x6a, 0xbc, 0x40, 0xfa, 0xf0, + 0xd0, 0x5b, 0xe7, 0xa9, 0x66, 0x97, 0x77, 0x68, +}; +static const size_t TEST_DVPT128_180_INPUT_LEN = 24; + +static const uint8_t TEST_DVPT128_184_NONCE[] = { + 0xcc, 0xee, 0x19, 0xd0, 0x37, 0xcf, 0x4a, +}; +static const size_t TEST_DVPT128_184_NONCE_LEN = 7; + +static const uint8_t TEST_DVPT128_184_ADATA[] = { + 0xc0, 0x26, 0x69, 0x6e, 0x64, 0x25, 0xe6, 0xc3, + 0x3f, 0x45, 0xb4, 0x14, 0x5f, 0xeb, 0xf1, 0x13, + 0x7e, 0x7a, 0xc2, 0x63, 0x83, 0xc9, 0xf5, 0xaa, + 0x4c, 0xd4, 0xe5, 0xe8, 0xab, 0xb1, 0x9e, 0x07, +}; +static const size_t TEST_DVPT128_184_ADATA_LEN = 32; + +static const uint8_t TEST_DVPT128_184_EXPECTED[] = { + 0x9b, 0x61, 0x33, 0x5f, 0x96, 0xfc, 0x5b, 0x31, + 0x27, 0x4c, 0xc1, 0xfb, 0x27, 0x5f, 0x29, 0xc1, + 0x10, 0x5d, 0x68, 0xc6, 0x7b, 0x70, 0x65, 0x4f, + 0x94, 0x05, 0xed, 0xb1, +}; +static const size_t TEST_DVPT128_184_EXPECTED_LEN = 28; + +static const uint8_t TEST_DVPT128_184_INPUT[] = { + 0x0d, 0xf2, 0x02, 0x43, 0x1e, 0xe7, 0xf2, 0x51, + 0xa3, 0x8a, 0xaf, 0x6a, 0xa8, 0xcd, 0x31, 0x37, + 0x82, 0xbd, 0x29, 0x3a, 0xf9, 0x11, 0x40, 0x05, +}; +static const size_t TEST_DVPT128_184_INPUT_LEN = 24; + +static const uint8_t TEST_DVPT128_191_NONCE[] = { + 0xa8, 0x40, 0xe9, 0x8d, 0xf7, 0x2a, 0xe9, +}; +static const size_t TEST_DVPT128_191_NONCE_LEN = 7; + +static const uint8_t TEST_DVPT128_191_ADATA[] = { + 0x22, 0xc6, 0x60, 0x77, 0x32, 0xef, 0x1b, 0xdc, + 0x7f, 0xcf, 0x61, 0x97, 0xe0, 0x37, 0xcd, 0xad, + 0xd7, 0xee, 0x17, 0xc0, 0x08, 0x55, 0x2d, 0xd9, + 0xf0, 0x4b, 0x85, 0x64, 0xd3, 0x4f, 0xb1, 0x7c, +}; +static const size_t TEST_DVPT128_191_ADATA_LEN = 32; + +static const uint8_t TEST_DVPT128_191_EXPECTED[] = { + 0xf7, 0x12, 0x2c, 0xbc, 0xec, 0x93, 0xd5, 0x3f, + 0xc7, 0xe3, 0xfc, 0x62, 0x9e, 0xa1, 0x5d, 0x28, + 0x36, 0x3c, 0xad, 0x1c, 0x83, 0xa2, 0x3b, 0xb3, + 0xcc, 0x5e, 0x0c, 0x4a, +}; +static const size_t TEST_DVPT128_191_EXPECTED_LEN = 28; + +static const uint8_t TEST_DVPT128_191_INPUT[] = { + 0xa2, 0xf5, 0x33, 0x85, 0x61, 0x8b, 0x41, 0x30, + 0x1f, 0x4e, 0x3e, 0xa4, 0xc5, 0x97, 0xf4, 0x11, + 0x10, 0x3d, 0xac, 0x2b, 0x37, 0xab, 0xf5, 0xda, +}; +static const size_t TEST_DVPT128_191_INPUT_LEN = 24; + +static const uint8_t TEST_DVPT128_192_NONCE[] = { + 0x39, 0xd9, 0x3c, 0x3c, 0xf3, 0x1a, 0x6f, +}; +static const size_t TEST_DVPT128_192_NONCE_LEN = 7; + +static const uint8_t TEST_DVPT128_192_ADATA[] = { + 0x93, 0x7d, 0xfa, 0xc5, 0xcd, 0xed, 0x93, 0x84, + 0x38, 0xf4, 0xe9, 0x7a, 0xab, 0xd9, 0xbe, 0xb5, + 0x0d, 0xba, 0x40, 0xf8, 0x24, 0x19, 0x82, 0x60, + 0xa8, 0x97, 0x29, 0x47, 0x9c, 0xfe, 0x68, 0x69, +}; +static const size_t TEST_DVPT128_192_ADATA_LEN = 32; + +static const uint8_t TEST_DVPT128_192_EXPECTED[] = { + 0xe1, 0xca, 0xd7, 0xf9, 0x46, 0xb2, 0x0c, 0x37, + 0x33, 0x23, 0x21, 0x8c, 0x8a, 0x89, 0xe5, 0x6e, + 0xdf, 0x30, 0x30, 0x66, 0x2e, 0x50, 0xd4, 0x59, + 0xfc, 0x12, 0xa5, 0x12, +}; +static const size_t TEST_DVPT128_192_EXPECTED_LEN = 28; + +static const uint8_t TEST_DVPT128_192_INPUT[] = { + 0xc1, 0xbd, 0xef, 0x96, 0xdc, 0x86, 0x84, 0x46, + 0xbe, 0x48, 0x49, 0x1b, 0x16, 0x05, 0x04, 0x54, + 0x6f, 0x2a, 0x40, 0xdd, 0x58, 0x1f, 0x95, 0x82, +}; +static const size_t TEST_DVPT128_192_INPUT_LEN = 24; + +static const uint8_t TEST_DVPT128_193_NONCE[] = { + 0x0b, 0xbc, 0x17, 0x70, 0x19, 0x32, 0x1e, +}; +static const size_t TEST_DVPT128_193_NONCE_LEN = 7; + +static const uint8_t TEST_DVPT128_193_ADATA[] = { + 0xf6, 0xe0, 0x26, 0x78, 0x82, 0x0f, 0x5c, 0xcb, + 0xed, 0xe6, 0xcb, 0xde, 0xd0, 0x2d, 0x6d, 0xd5, + 0x8d, 0x48, 0x61, 0x66, 0xd7, 0xb1, 0x8e, 0xe9, + 0x75, 0xa6, 0x88, 0xaf, 0x42, 0x1f, 0xb7, 0x95, +}; +static const size_t TEST_DVPT128_193_ADATA_LEN = 32; + +static const uint8_t TEST_DVPT128_193_EXPECTED[] = { + 0xd4, 0x74, 0x18, 0x14, 0x46, 0x6a, 0x23, 0xe2, + 0x61, 0x07, 0xd7, 0x73, 0xf1, 0x03, 0xa4, 0xc8, + 0x3d, 0xb9, 0xd7, 0x72, 0xdb, 0xd5, 0xfd, 0xc1, + 0xc2, 0xea, 0xf8, 0x95, +}; +static const size_t TEST_DVPT128_193_EXPECTED_LEN = 28; + +static const uint8_t TEST_DVPT128_193_INPUT[] = { + 0x72, 0xa7, 0x09, 0x54, 0xd2, 0x2a, 0xd7, 0x22, + 0xfc, 0x32, 0x75, 0x6a, 0xfc, 0xe6, 0x7b, 0x34, + 0x4b, 0x2f, 0x3c, 0x55, 0xfe, 0x1d, 0x9e, 0xed, +}; +static const size_t TEST_DVPT128_193_INPUT_LEN = 24; + +/* Alen = 32, Plen = 24, Nlen = 7, Tlen = 16 */ +static const uint8_t TEST_DVPT128_GROUP_13_MAC_LEN = 16; + +static const uint8_t TEST_DVPT128_GROUP_13_KEY[] = { + 0xa7, 0xaa, 0x63, 0x5e, 0xa5, 0x1b, 0x0b, 0xb2, + 0x0a, 0x09, 0x2b, 0xd5, 0x57, 0x3e, 0x72, 0x8c, +}; +static const size_t TEST_DVPT128_GROUP_13_KEY_LEN = 16; + +static const uint8_t TEST_DVPT128_195_NONCE[] = { + 0x5a, 0x8a, 0xa4, 0x85, 0xc3, 0x16, 0xe9, +}; +static const size_t TEST_DVPT128_195_NONCE_LEN = 7; + +static const uint8_t TEST_DVPT128_195_ADATA[] = { + 0x37, 0x96, 0xcf, 0x51, 0xb8, 0x72, 0x66, 0x52, + 0xa4, 0x20, 0x47, 0x33, 0xb8, 0xfb, 0xb0, 0x47, + 0xcf, 0x00, 0xfb, 0x91, 0xa9, 0x83, 0x7e, 0x22, + 0xec, 0x22, 0xb1, 0xa2, 0x68, 0xf8, 0x8e, 0x2c, +}; +static const size_t TEST_DVPT128_195_ADATA_LEN = 32; + +static const uint8_t TEST_DVPT128_195_EXPECTED[] = { + 0xb3, 0x51, 0xab, 0x96, 0xb2, 0xe4, 0x55, 0x15, + 0x25, 0x45, 0x58, 0xd5, 0x21, 0x26, 0x73, 0xee, + 0x6c, 0x77, 0x6d, 0x42, 0xdb, 0xca, 0x3b, 0x51, + 0x2c, 0xf3, 0xa2, 0x0b, 0x7f, 0xd7, 0xc4, 0x9e, + 0x6e, 0x79, 0xbe, 0xf4, 0x75, 0xc2, 0x90, 0x6f, +}; +static const size_t TEST_DVPT128_195_EXPECTED_LEN = 40; + +static const uint8_t TEST_DVPT128_195_INPUT[] = { + 0xa2, 0x65, 0x48, 0x0c, 0xa8, 0x8d, 0x5f, 0x53, + 0x6d, 0xb0, 0xdc, 0x6a, 0xbc, 0x40, 0xfa, 0xf0, + 0xd0, 0x5b, 0xe7, 0xa9, 0x66, 0x97, 0x77, 0x68, +}; +static const size_t TEST_DVPT128_195_INPUT_LEN = 24; + +static const uint8_t TEST_DVPT128_199_NONCE[] = { + 0xcc, 0xee, 0x19, 0xd0, 0x37, 0xcf, 0x4a, +}; +static const size_t TEST_DVPT128_199_NONCE_LEN = 7; + +static const uint8_t TEST_DVPT128_199_ADATA[] = { + 0xc0, 0x26, 0x69, 0x6e, 0x64, 0x25, 0xe6, 0xc3, + 0x3f, 0x45, 0xb4, 0x14, 0x5f, 0xeb, 0xf1, 0x13, + 0x7e, 0x7a, 0xc2, 0x63, 0x83, 0xc9, 0xf5, 0xaa, + 0x4c, 0xd4, 0xe5, 0xe8, 0xab, 0xb1, 0x9e, 0x07, +}; +static const size_t TEST_DVPT128_199_ADATA_LEN = 32; + +static const uint8_t TEST_DVPT128_199_EXPECTED[] = { + 0xe6, 0x76, 0xf5, 0xdf, 0xde, 0x8a, 0xd8, 0x10, + 0xd9, 0xe7, 0x29, 0xd1, 0x42, 0x67, 0x0e, 0xef, + 0x77, 0xf2, 0x87, 0x83, 0x69, 0xa2, 0x87, 0x97, + 0xd5, 0x76, 0x03, 0xd5, 0xc4, 0x56, 0x06, 0xc6, + 0x8b, 0xe5, 0x53, 0x5c, 0x67, 0x1d, 0x54, 0x32, +}; +static const size_t TEST_DVPT128_199_EXPECTED_LEN = 40; + +static const uint8_t TEST_DVPT128_199_INPUT[] = { + 0x0d, 0xf2, 0x02, 0x43, 0x1e, 0xe7, 0xf2, 0x51, + 0xa3, 0x8a, 0xaf, 0x6a, 0xa8, 0xcd, 0x31, 0x37, + 0x82, 0xbd, 0x29, 0x3a, 0xf9, 0x11, 0x40, 0x05, +}; +static const size_t TEST_DVPT128_199_INPUT_LEN = 24; + +static const uint8_t TEST_DVPT128_206_NONCE[] = { + 0xa8, 0x40, 0xe9, 0x8d, 0xf7, 0x2a, 0xe9, +}; +static const size_t TEST_DVPT128_206_NONCE_LEN = 7; + +static const uint8_t TEST_DVPT128_206_ADATA[] = { + 0x22, 0xc6, 0x60, 0x77, 0x32, 0xef, 0x1b, 0xdc, + 0x7f, 0xcf, 0x61, 0x97, 0xe0, 0x37, 0xcd, 0xad, + 0xd7, 0xee, 0x17, 0xc0, 0x08, 0x55, 0x2d, 0xd9, + 0xf0, 0x4b, 0x85, 0x64, 0xd3, 0x4f, 0xb1, 0x7c, +}; +static const size_t TEST_DVPT128_206_ADATA_LEN = 32; + +static const uint8_t TEST_DVPT128_206_EXPECTED[] = { + 0x1b, 0xcf, 0xf9, 0x40, 0xa2, 0xd9, 0xd4, 0x8e, + 0x93, 0xbb, 0xfd, 0x13, 0xae, 0xd5, 0x94, 0x72, + 0x37, 0x48, 0x59, 0x83, 0xe6, 0xae, 0x04, 0xb8, + 0xb9, 0x44, 0xbb, 0x46, 0x30, 0x6a, 0x9b, 0x1e, + 0x78, 0x3f, 0x3e, 0x54, 0xc9, 0x2d, 0x5f, 0x5e, +}; +static const size_t TEST_DVPT128_206_EXPECTED_LEN = 40; + +static const uint8_t TEST_DVPT128_206_INPUT[] = { + 0xa2, 0xf5, 0x33, 0x85, 0x61, 0x8b, 0x41, 0x30, + 0x1f, 0x4e, 0x3e, 0xa4, 0xc5, 0x97, 0xf4, 0x11, + 0x10, 0x3d, 0xac, 0x2b, 0x37, 0xab, 0xf5, 0xda, +}; +static const size_t TEST_DVPT128_206_INPUT_LEN = 24; + +static const uint8_t TEST_DVPT128_207_NONCE[] = { + 0x39, 0xd9, 0x3c, 0x3c, 0xf3, 0x1a, 0x6f, +}; +static const size_t TEST_DVPT128_207_NONCE_LEN = 7; + +static const uint8_t TEST_DVPT128_207_ADATA[] = { + 0x93, 0x7d, 0xfa, 0xc5, 0xcd, 0xed, 0x93, 0x84, + 0x38, 0xf4, 0xe9, 0x7a, 0xab, 0xd9, 0xbe, 0xb5, + 0x0d, 0xba, 0x40, 0xf8, 0x24, 0x19, 0x82, 0x60, + 0xa8, 0x97, 0x29, 0x47, 0x9c, 0xfe, 0x68, 0x69, +}; +static const size_t TEST_DVPT128_207_ADATA_LEN = 32; + +static const uint8_t TEST_DVPT128_207_EXPECTED[] = { + 0x3b, 0x6c, 0x15, 0x70, 0xc8, 0x5f, 0x29, 0x70, + 0x79, 0xbe, 0x14, 0xcd, 0x66, 0xd3, 0x35, 0x25, + 0x1c, 0x7b, 0x52, 0xe1, 0x31, 0xa6, 0x36, 0xf1, + 0x48, 0x60, 0x89, 0x63, 0xf3, 0x03, 0x77, 0x63, + 0x84, 0x3b, 0x70, 0xc3, 0x5d, 0x70, 0x11, 0xf8, +}; +static const size_t TEST_DVPT128_207_EXPECTED_LEN = 40; + +static const uint8_t TEST_DVPT128_207_INPUT[] = { + 0xc1, 0xbd, 0xef, 0x96, 0xdc, 0x86, 0x84, 0x46, + 0xbe, 0x48, 0x49, 0x1b, 0x16, 0x05, 0x04, 0x54, + 0x6f, 0x2a, 0x40, 0xdd, 0x58, 0x1f, 0x95, 0x82, +}; +static const size_t TEST_DVPT128_207_INPUT_LEN = 24; + +static const uint8_t TEST_DVPT128_208_NONCE[] = { + 0x0b, 0xbc, 0x17, 0x70, 0x19, 0x32, 0x1e, +}; +static const size_t TEST_DVPT128_208_NONCE_LEN = 7; + +static const uint8_t TEST_DVPT128_208_ADATA[] = { + 0xf6, 0xe0, 0x26, 0x78, 0x82, 0x0f, 0x5c, 0xcb, + 0xed, 0xe6, 0xcb, 0xde, 0xd0, 0x2d, 0x6d, 0xd5, + 0x8d, 0x48, 0x61, 0x66, 0xd7, 0xb1, 0x8e, 0xe9, + 0x75, 0xa6, 0x88, 0xaf, 0x42, 0x1f, 0xb7, 0x95, +}; +static const size_t TEST_DVPT128_208_ADATA_LEN = 32; + +static const uint8_t TEST_DVPT128_208_EXPECTED[] = { + 0xb5, 0x40, 0xcd, 0x8c, 0xbe, 0x73, 0x3e, 0x0c, + 0xa2, 0xba, 0x21, 0x12, 0xea, 0x78, 0x55, 0x96, + 0xd2, 0xc1, 0xd7, 0x07, 0xf4, 0x16, 0x08, 0x51, + 0x4b, 0xa2, 0xd0, 0x94, 0x4c, 0x68, 0xcc, 0x36, + 0xd4, 0x12, 0x5b, 0x3e, 0xf9, 0x07, 0x1d, 0x69, +}; +static const size_t TEST_DVPT128_208_EXPECTED_LEN = 40; + +static const uint8_t TEST_DVPT128_208_INPUT[] = { + 0x72, 0xa7, 0x09, 0x54, 0xd2, 0x2a, 0xd7, 0x22, + 0xfc, 0x32, 0x75, 0x6a, 0xfc, 0xe6, 0x7b, 0x34, + 0x4b, 0x2f, 0x3c, 0x55, 0xfe, 0x1d, 0x9e, 0xed, +}; +static const size_t TEST_DVPT128_208_INPUT_LEN = 24; + +/* Alen = 32, Plen = 24, Nlen = 13, Tlen = 4 */ +static const uint8_t TEST_DVPT128_GROUP_14_MAC_LEN = 4; + +static const uint8_t TEST_DVPT128_GROUP_14_KEY[] = { + 0xa7, 0xaa, 0x63, 0x5e, 0xa5, 0x1b, 0x0b, 0xb2, + 0x0a, 0x09, 0x2b, 0xd5, 0x57, 0x3e, 0x72, 0x8c, +}; +static const size_t TEST_DVPT128_GROUP_14_KEY_LEN = 16; + +static const uint8_t TEST_DVPT128_210_NONCE[] = { + 0x5a, 0x8a, 0xa4, 0x85, 0xc3, 0x16, 0xe9, 0x40, + 0x3a, 0xff, 0x85, 0x9f, 0xbb, +}; +static const size_t TEST_DVPT128_210_NONCE_LEN = 13; + +static const uint8_t TEST_DVPT128_210_ADATA[] = { + 0xa1, 0x6a, 0x2e, 0x74, 0x1f, 0x1c, 0xd9, 0x71, + 0x72, 0x85, 0xb6, 0xd8, 0x82, 0xc1, 0xfc, 0x53, + 0x65, 0x5e, 0x97, 0x73, 0x76, 0x1a, 0xd6, 0x97, + 0xa7, 0xee, 0x64, 0x10, 0x18, 0x4c, 0x79, 0x82, +}; +static const size_t TEST_DVPT128_210_ADATA_LEN = 32; + +static const uint8_t TEST_DVPT128_210_EXPECTED[] = { + 0x93, 0x4f, 0x89, 0x38, 0x24, 0xe8, 0x80, 0xf7, + 0x43, 0xd1, 0x96, 0xb2, 0x2d, 0x1f, 0x34, 0x0a, + 0x52, 0x60, 0x81, 0x55, 0x08, 0x7b, 0xd2, 0x8a, + 0xc2, 0x5e, 0x53, 0x29, +}; +static const size_t TEST_DVPT128_210_EXPECTED_LEN = 28; + +static const uint8_t TEST_DVPT128_210_INPUT[] = { + 0x87, 0x39, 0xb4, 0xbe, 0xa1, 0xa0, 0x99, 0xfe, + 0x54, 0x74, 0x99, 0xcb, 0xc6, 0xd1, 0xb1, 0x3d, + 0x84, 0x9b, 0x80, 0x84, 0xc9, 0xb6, 0xac, 0xc5, +}; +static const size_t TEST_DVPT128_210_INPUT_LEN = 24; + +static const uint8_t TEST_DVPT128_214_NONCE[] = { + 0xe3, 0xc0, 0x3e, 0xf7, 0xe1, 0xd3, 0x19, 0x61, + 0xee, 0x0b, 0x97, 0xbd, 0x99, +}; +static const size_t TEST_DVPT128_214_NONCE_LEN = 13; + +static const uint8_t TEST_DVPT128_214_ADATA[] = { + 0x8a, 0x36, 0x76, 0xdd, 0x64, 0x08, 0x21, 0xb5, + 0x8f, 0xb0, 0xf0, 0x32, 0x98, 0x55, 0xfd, 0x58, + 0x82, 0xc3, 0x76, 0xea, 0x16, 0x6b, 0x95, 0x8b, + 0x7a, 0xaa, 0xd2, 0x23, 0x05, 0x4e, 0x57, 0x84, +}; +static const size_t TEST_DVPT128_214_ADATA_LEN = 32; + +static const uint8_t TEST_DVPT128_214_EXPECTED[] = { + 0xec, 0xde, 0x42, 0x09, 0x1b, 0xaa, 0x1f, 0x5c, + 0x17, 0xb7, 0x97, 0x46, 0xe2, 0x1c, 0x3d, 0xe5, + 0xc7, 0x89, 0x84, 0x57, 0x07, 0x48, 0x02, 0x1c, + 0xcd, 0x39, 0x95, 0x07, +}; +static const size_t TEST_DVPT128_214_EXPECTED_LEN = 28; + +static const uint8_t TEST_DVPT128_214_INPUT[] = { + 0x92, 0x97, 0x3c, 0xe7, 0x07, 0x73, 0x3a, 0x73, + 0x11, 0x8c, 0x8c, 0xe6, 0xb5, 0xe3, 0xfc, 0x77, + 0xa1, 0x7f, 0x44, 0x83, 0x10, 0xc0, 0x19, 0x7f, +}; +static const size_t TEST_DVPT128_214_INPUT_LEN = 24; + +static const uint8_t TEST_DVPT128_221_NONCE[] = { + 0x93, 0xe0, 0x88, 0x54, 0x56, 0x0e, 0xdb, 0x09, + 0x6e, 0x5d, 0x65, 0x40, 0x86, +}; +static const size_t TEST_DVPT128_221_NONCE_LEN = 13; + +static const uint8_t TEST_DVPT128_221_ADATA[] = { + 0xbd, 0xc6, 0x0d, 0xff, 0x08, 0xbf, 0xd5, 0xd4, + 0x43, 0x20, 0xb7, 0x5c, 0x61, 0xe4, 0x56, 0xfd, + 0x43, 0x33, 0xc9, 0xc3, 0xd0, 0x29, 0x4d, 0x4a, + 0x48, 0xd9, 0x36, 0xdf, 0xd5, 0x92, 0x2c, 0xe2, +}; +static const size_t TEST_DVPT128_221_ADATA_LEN = 32; + +static const uint8_t TEST_DVPT128_221_EXPECTED[] = { + 0x1f, 0x80, 0x86, 0xa4, 0x3c, 0x1b, 0x2d, 0xea, + 0x55, 0x79, 0x52, 0xdb, 0x88, 0xe0, 0xdb, 0xbd, + 0xb9, 0x6a, 0xaf, 0xdb, 0x34, 0x5e, 0xdd, 0xae, + 0x6c, 0x0b, 0x01, 0x04, +}; +static const size_t TEST_DVPT128_221_EXPECTED_LEN = 28; + +static const uint8_t TEST_DVPT128_221_INPUT[] = { + 0x56, 0x9e, 0x4a, 0xec, 0x88, 0xdd, 0x51, 0xca, + 0x51, 0x9c, 0x0a, 0x00, 0xc9, 0x22, 0xee, 0x33, + 0xd3, 0x55, 0x9b, 0x98, 0xa3, 0x2d, 0x79, 0x06, +}; +static const size_t TEST_DVPT128_221_INPUT_LEN = 24; + +static const uint8_t TEST_DVPT128_222_NONCE[] = { + 0xe3, 0xf3, 0x7b, 0x68, 0xff, 0x50, 0x8c, 0xfe, + 0x29, 0x54, 0x41, 0xd9, 0xe3, +}; +static const size_t TEST_DVPT128_222_NONCE_LEN = 13; + +static const uint8_t TEST_DVPT128_222_ADATA[] = { + 0xb2, 0xb6, 0xc5, 0x78, 0x2e, 0x4f, 0x12, 0x84, + 0x67, 0xc5, 0x89, 0xd2, 0xa6, 0xcf, 0x55, 0xef, + 0x12, 0x87, 0x7a, 0xdb, 0x77, 0x1b, 0xbb, 0x62, + 0x45, 0xc5, 0xbb, 0xa9, 0xdc, 0xfd, 0x62, 0x08, +}; +static const size_t TEST_DVPT128_222_ADATA_LEN = 32; + +static const uint8_t TEST_DVPT128_222_EXPECTED[] = { + 0xc0, 0xc5, 0xf9, 0x22, 0x85, 0xb1, 0x14, 0xe0, + 0xa0, 0x77, 0x7e, 0x1b, 0xc2, 0x2b, 0x81, 0x0e, + 0x7c, 0xc4, 0xf6, 0x8c, 0x28, 0xcd, 0x5c, 0xe0, + 0x47, 0xa2, 0x8d, 0xd8, +}; +static const size_t TEST_DVPT128_222_EXPECTED_LEN = 28; + +static const uint8_t TEST_DVPT128_222_INPUT[] = { + 0x02, 0xb5, 0x51, 0x12, 0x04, 0xbd, 0x55, 0xf7, + 0xc3, 0x79, 0x73, 0xe2, 0x6f, 0x6d, 0xf5, 0x88, + 0x3c, 0x0a, 0x53, 0x0f, 0x07, 0xc7, 0xf8, 0xc2, +}; +static const size_t TEST_DVPT128_222_INPUT_LEN = 24; + +static const uint8_t TEST_DVPT128_223_NONCE[] = { + 0xea, 0x98, 0xec, 0x44, 0xf5, 0xa8, 0x67, 0x15, + 0x01, 0x47, 0x83, 0x17, 0x2e, +}; +static const size_t TEST_DVPT128_223_NONCE_LEN = 13; + +static const uint8_t TEST_DVPT128_223_ADATA[] = { + 0xe4, 0x69, 0x2b, 0x9f, 0x06, 0xb6, 0x66, 0xc7, + 0x45, 0x1b, 0x14, 0x6c, 0x8a, 0xeb, 0x07, 0xa6, + 0xe3, 0x0c, 0x62, 0x9d, 0x28, 0x06, 0x5c, 0x3d, + 0xde, 0x59, 0x40, 0x32, 0x5b, 0x14, 0xb8, 0x10, +}; +static const size_t TEST_DVPT128_223_ADATA_LEN = 32; + +static const uint8_t TEST_DVPT128_223_EXPECTED[] = { + 0x56, 0x32, 0x7f, 0x4d, 0xb9, 0xc1, 0x8f, 0x72, + 0xbb, 0xef, 0xc3, 0xf3, 0x16, 0xd3, 0x1f, 0x97, + 0x95, 0xdd, 0x77, 0xf4, 0x93, 0x38, 0x5a, 0xb7, + 0xb7, 0x54, 0x35, 0x52, +}; +static const size_t TEST_DVPT128_223_EXPECTED_LEN = 28; + +static const uint8_t TEST_DVPT128_223_INPUT[] = { + 0x4d, 0xa4, 0x0b, 0x80, 0x57, 0x9c, 0x1d, 0x9a, + 0x53, 0x09, 0xf7, 0xef, 0xec, 0xb7, 0xc0, 0x59, + 0xa2, 0xf9, 0x14, 0x51, 0x1c, 0xa5, 0xfc, 0x10, +}; +static const size_t TEST_DVPT128_223_INPUT_LEN = 24; + +/* Alen = 32, Plen = 24, Nlen = 13, Tlen = 16 */ +static const uint8_t TEST_DVPT128_GROUP_15_MAC_LEN = 16; + +static const uint8_t TEST_DVPT128_GROUP_15_KEY[] = { + 0x26, 0x51, 0x1f, 0xb5, 0x1f, 0xcf, 0xa7, 0x5c, + 0xb4, 0xb4, 0x4d, 0xa7, 0x5a, 0x6e, 0x5a, 0x0e, +}; +static const size_t TEST_DVPT128_GROUP_15_KEY_LEN = 16; + +static const uint8_t TEST_DVPT128_225_NONCE[] = { + 0x5a, 0x8a, 0xa4, 0x85, 0xc3, 0x16, 0xe9, 0x40, + 0x3a, 0xff, 0x85, 0x9f, 0xbb, +}; +static const size_t TEST_DVPT128_225_NONCE_LEN = 13; + +static const uint8_t TEST_DVPT128_225_ADATA[] = { + 0xa1, 0x6a, 0x2e, 0x74, 0x1f, 0x1c, 0xd9, 0x71, + 0x72, 0x85, 0xb6, 0xd8, 0x82, 0xc1, 0xfc, 0x53, + 0x65, 0x5e, 0x97, 0x73, 0x76, 0x1a, 0xd6, 0x97, + 0xa7, 0xee, 0x64, 0x10, 0x18, 0x4c, 0x79, 0x82, +}; +static const size_t TEST_DVPT128_225_ADATA_LEN = 32; + +static const uint8_t TEST_DVPT128_225_EXPECTED[] = { + 0x50, 0x03, 0x8b, 0x5f, 0xdd, 0x36, 0x4e, 0xe7, + 0x47, 0xb7, 0x0d, 0x00, 0xbd, 0x36, 0x84, 0x0e, + 0xce, 0x4e, 0xa1, 0x99, 0x98, 0x12, 0x33, 0x75, + 0xc0, 0xa4, 0x58, 0xbf, 0xca, 0xfa, 0x3b, 0x26, + 0x09, 0xaf, 0xe0, 0xf8, 0x25, 0xcb, 0xf5, 0x03, +}; +static const size_t TEST_DVPT128_225_EXPECTED_LEN = 40; + +static const uint8_t TEST_DVPT128_225_INPUT[] = { + 0x87, 0x39, 0xb4, 0xbe, 0xa1, 0xa0, 0x99, 0xfe, + 0x54, 0x74, 0x99, 0xcb, 0xc6, 0xd1, 0xb1, 0x3d, + 0x84, 0x9b, 0x80, 0x84, 0xc9, 0xb6, 0xac, 0xc5, +}; +static const size_t TEST_DVPT128_225_INPUT_LEN = 24; + +static const uint8_t TEST_DVPT128_229_NONCE[] = { + 0xe3, 0xc0, 0x3e, 0xf7, 0xe1, 0xd3, 0x19, 0x61, + 0xee, 0x0b, 0x97, 0xbd, 0x99, +}; +static const size_t TEST_DVPT128_229_NONCE_LEN = 13; + +static const uint8_t TEST_DVPT128_229_ADATA[] = { + 0x8a, 0x36, 0x76, 0xdd, 0x64, 0x08, 0x21, 0xb5, + 0x8f, 0xb0, 0xf0, 0x32, 0x98, 0x55, 0xfd, 0x58, + 0x82, 0xc3, 0x76, 0xea, 0x16, 0x6b, 0x95, 0x8b, + 0x7a, 0xaa, 0xd2, 0x23, 0x05, 0x4e, 0x57, 0x84, +}; +static const size_t TEST_DVPT128_229_ADATA_LEN = 32; + +static const uint8_t TEST_DVPT128_229_EXPECTED[] = { + 0xc6, 0xb7, 0x68, 0x0f, 0x32, 0x11, 0x32, 0xa8, + 0xbd, 0x00, 0xe8, 0xe9, 0x2f, 0x78, 0x5d, 0x0b, + 0x82, 0x8b, 0x10, 0x0a, 0xf6, 0x39, 0x2a, 0x04, + 0xd1, 0x29, 0x23, 0x73, 0xa7, 0x69, 0x70, 0xed, + 0xa7, 0x7a, 0x81, 0x94, 0xf6, 0x27, 0x62, 0x62, +}; +static const size_t TEST_DVPT128_229_EXPECTED_LEN = 40; + +static const uint8_t TEST_DVPT128_229_INPUT[] = { + 0x92, 0x97, 0x3c, 0xe7, 0x07, 0x73, 0x3a, 0x73, + 0x11, 0x8c, 0x8c, 0xe6, 0xb5, 0xe3, 0xfc, 0x77, + 0xa1, 0x7f, 0x44, 0x83, 0x10, 0xc0, 0x19, 0x7f, +}; +static const size_t TEST_DVPT128_229_INPUT_LEN = 24; + +static const uint8_t TEST_DVPT128_236_NONCE[] = { + 0x93, 0xe0, 0x88, 0x54, 0x56, 0x0e, 0xdb, 0x09, + 0x6e, 0x5d, 0x65, 0x40, 0x86, +}; +static const size_t TEST_DVPT128_236_NONCE_LEN = 13; + +static const uint8_t TEST_DVPT128_236_ADATA[] = { + 0xbd, 0xc6, 0x0d, 0xff, 0x08, 0xbf, 0xd5, 0xd4, + 0x43, 0x20, 0xb7, 0x5c, 0x61, 0xe4, 0x56, 0xfd, + 0x43, 0x33, 0xc9, 0xc3, 0xd0, 0x29, 0x4d, 0x4a, + 0x48, 0xd9, 0x36, 0xdf, 0xd5, 0x92, 0x2c, 0xe2, +}; +static const size_t TEST_DVPT128_236_ADATA_LEN = 32; + +static const uint8_t TEST_DVPT128_236_EXPECTED[] = { + 0x7f, 0xcd, 0xce, 0x0b, 0xa5, 0x67, 0xb9, 0xa7, + 0x08, 0xd5, 0x4f, 0xdb, 0x16, 0x12, 0x5d, 0xe7, + 0x1d, 0xce, 0x95, 0x2f, 0x47, 0x41, 0x68, 0x4f, + 0x4f, 0x9d, 0x30, 0x2e, 0x4f, 0x1d, 0x2a, 0x2a, + 0xed, 0xf2, 0x76, 0x8d, 0x7b, 0x29, 0x16, 0x3f, +}; +static const size_t TEST_DVPT128_236_EXPECTED_LEN = 40; + +static const uint8_t TEST_DVPT128_236_INPUT[] = { + 0x56, 0x9e, 0x4a, 0xec, 0x88, 0xdd, 0x51, 0xca, + 0x51, 0x9c, 0x0a, 0x00, 0xc9, 0x22, 0xee, 0x33, + 0xd3, 0x55, 0x9b, 0x98, 0xa3, 0x2d, 0x79, 0x06, +}; +static const size_t TEST_DVPT128_236_INPUT_LEN = 24; + +static const uint8_t TEST_DVPT128_237_NONCE[] = { + 0xe3, 0xf3, 0x7b, 0x68, 0xff, 0x50, 0x8c, 0xfe, + 0x29, 0x54, 0x41, 0xd9, 0xe3, +}; +static const size_t TEST_DVPT128_237_NONCE_LEN = 13; + +static const uint8_t TEST_DVPT128_237_ADATA[] = { + 0xb2, 0xb6, 0xc5, 0x78, 0x2e, 0x4f, 0x12, 0x84, + 0x67, 0xc5, 0x89, 0xd2, 0xa6, 0xcf, 0x55, 0xef, + 0x12, 0x87, 0x7a, 0xdb, 0x77, 0x1b, 0xbb, 0x62, + 0x45, 0xc5, 0xbb, 0xa9, 0xdc, 0xfd, 0x62, 0x08, +}; +static const size_t TEST_DVPT128_237_ADATA_LEN = 32; + +static const uint8_t TEST_DVPT128_237_EXPECTED[] = { + 0xd4, 0x21, 0x11, 0xba, 0x22, 0x98, 0x7e, 0xac, + 0x1e, 0xad, 0x5c, 0xc6, 0xcb, 0x85, 0x48, 0xbc, + 0xda, 0x19, 0x0d, 0x11, 0x8d, 0xcd, 0x54, 0x61, + 0xa5, 0x00, 0x36, 0xaf, 0x67, 0xfa, 0xda, 0xb1, + 0x63, 0xe9, 0xda, 0xa8, 0xbd, 0x8e, 0x90, 0x30, +}; +static const size_t TEST_DVPT128_237_EXPECTED_LEN = 40; + +static const uint8_t TEST_DVPT128_237_INPUT[] = { + 0x02, 0xb5, 0x51, 0x12, 0x04, 0xbd, 0x55, 0xf7, + 0xc3, 0x79, 0x73, 0xe2, 0x6f, 0x6d, 0xf5, 0x88, + 0x3c, 0x0a, 0x53, 0x0f, 0x07, 0xc7, 0xf8, 0xc2, +}; +static const size_t TEST_DVPT128_237_INPUT_LEN = 24; + +static const uint8_t TEST_DVPT128_238_NONCE[] = { + 0xea, 0x98, 0xec, 0x44, 0xf5, 0xa8, 0x67, 0x15, + 0x01, 0x47, 0x83, 0x17, 0x2e, +}; +static const size_t TEST_DVPT128_238_NONCE_LEN = 13; + +static const uint8_t TEST_DVPT128_238_ADATA[] = { + 0xe4, 0x69, 0x2b, 0x9f, 0x06, 0xb6, 0x66, 0xc7, + 0x45, 0x1b, 0x14, 0x6c, 0x8a, 0xeb, 0x07, 0xa6, + 0xe3, 0x0c, 0x62, 0x9d, 0x28, 0x06, 0x5c, 0x3d, + 0xde, 0x59, 0x40, 0x32, 0x5b, 0x14, 0xb8, 0x10, +}; +static const size_t TEST_DVPT128_238_ADATA_LEN = 32; + +static const uint8_t TEST_DVPT128_238_EXPECTED[] = { + 0x1b, 0xf0, 0xba, 0x0e, 0xbb, 0x20, 0xd8, 0xed, + 0xba, 0x59, 0xf2, 0x9a, 0x93, 0x71, 0x75, 0x0c, + 0x9c, 0x71, 0x40, 0x78, 0xf7, 0x3c, 0x33, 0x5d, + 0x2f, 0x13, 0x22, 0xac, 0x69, 0xb8, 0x48, 0xb0, + 0x01, 0x47, 0x63, 0x23, 0xae, 0xd8, 0x4c, 0x47, +}; +static const size_t TEST_DVPT128_238_EXPECTED_LEN = 40; + +static const uint8_t TEST_DVPT128_238_INPUT[] = { + 0x4d, 0xa4, 0x0b, 0x80, 0x57, 0x9c, 0x1d, 0x9a, + 0x53, 0x09, 0xf7, 0xef, 0xec, 0xb7, 0xc0, 0x59, + 0xa2, 0xf9, 0x14, 0x51, 0x1c, 0xa5, 0xfc, 0x10, +}; +static const size_t TEST_DVPT128_238_INPUT_LEN = 24; + +/* Share test buffer output */ +static uint8_t data[512]; + +static void test_encrypt_op(const uint8_t *key, uint8_t key_len, + const uint8_t *adata, size_t adata_len, + const uint8_t *nonce, uint8_t nonce_len, + const uint8_t *plain, size_t plain_len, + const uint8_t *output_expected, + size_t output_expected_len, + uint8_t mac_length) +{ + cipher_t cipher; + int len, err, cmp; + size_t len_encoding = nonce_and_len_encoding_size - nonce_len; + + TEST_ASSERT_MESSAGE(sizeof(data) >= output_expected_len, + "Output buffer too small"); + + err = cipher_init(&cipher, CIPHER_AES_128, key, key_len); + TEST_ASSERT_EQUAL_INT(1, err); + + len = cipher_encrypt_ccm(&cipher, adata, adata_len, + mac_length, len_encoding, + nonce, nonce_len, plain, plain_len, data); + TEST_ASSERT_MESSAGE(len > 0, "Encryption failed"); + + TEST_ASSERT_EQUAL_INT(output_expected_len, len); + cmp = compare(output_expected, data, len); + TEST_ASSERT_MESSAGE(1 == cmp, "wrong ciphertext"); +} + +static void test_decrypt_op(const uint8_t *key, uint8_t key_len, + const uint8_t *adata, size_t adata_len, + const uint8_t *nonce, uint8_t nonce_len, + const uint8_t *encrypted, size_t encrypted_len, + const uint8_t *output_expected, + size_t output_expected_len, + uint8_t mac_length) +{ + cipher_t cipher; + int len, err, cmp; + size_t len_encoding = nonce_and_len_encoding_size - nonce_len; + + TEST_ASSERT_MESSAGE(sizeof(data) >= output_expected_len, + "Output buffer too small"); + + err = cipher_init(&cipher, CIPHER_AES_128, key, key_len); + TEST_ASSERT_EQUAL_INT(1, err); + + len = cipher_decrypt_ccm(&cipher, adata, adata_len, + mac_length, len_encoding, + nonce, nonce_len, encrypted, encrypted_len, data); + TEST_ASSERT_MESSAGE(len >= 0, "Decryption failed"); + + TEST_ASSERT_EQUAL_INT(output_expected_len, len); + cmp = compare(output_expected, data, len); + TEST_ASSERT_MESSAGE(1 == cmp, "wrong ciphertext"); + +} + +#define do_test_encrypt_op(prefix, test_num, group_num) do { \ + test_encrypt_op(TEST_ ## prefix ## _GROUP_ ## group_num ## _KEY, \ + TEST_ ## prefix ## _GROUP_ ## group_num ## _KEY_LEN, \ + TEST_ ## prefix ## _ ## test_num ## _ADATA, \ + TEST_ ## prefix ## _ ## test_num ## _ADATA_LEN, \ + TEST_ ## prefix ## _ ## test_num ## _NONCE, \ + TEST_ ## prefix ## _ ## test_num ## _NONCE_LEN, \ + TEST_ ## prefix ## _ ## test_num ## _INPUT, \ + TEST_ ## prefix ## _ ## test_num ## _INPUT_LEN, \ + TEST_ ## prefix ## _ ## test_num ## _EXPECTED, \ + TEST_ ## prefix ## _ ## test_num ## _EXPECTED_LEN, \ + TEST_ ## prefix ## _GROUP_ ## group_num ## _MAC_LEN \ + ); \ +} while (0) + +#define do_test_decrypt_op(prefix, test_num, group_num) do { \ + test_decrypt_op(TEST_ ## prefix ## _GROUP_ ## group_num ## _KEY, \ + TEST_ ## prefix ## _GROUP_ ## group_num ## _KEY_LEN, \ + TEST_ ## prefix ## _ ## test_num ## _ADATA, \ + TEST_ ## prefix ## _ ## test_num ## _ADATA_LEN, \ + TEST_ ## prefix ## _ ## test_num ## _NONCE, \ + TEST_ ## prefix ## _ ## test_num ## _NONCE_LEN, \ + TEST_ ## prefix ## _ ## test_num ## _EXPECTED, \ + TEST_ ## prefix ## _ ## test_num ## _EXPECTED_LEN, \ + TEST_ ## prefix ## _ ## test_num ## _INPUT, \ + TEST_ ## prefix ## _ ## test_num ## _INPUT_LEN, \ + TEST_ ## prefix ## _GROUP_ ## group_num ## _MAC_LEN \ + ); \ +} while (0) + +static void test_crypto_modes_ccm_decrypt(void) +{ + do_test_decrypt_op(DVPT128, 0, 0); + do_test_decrypt_op(DVPT128, 4, 0); + do_test_decrypt_op(DVPT128, 11, 0); + do_test_decrypt_op(DVPT128, 12, 0); + do_test_decrypt_op(DVPT128, 13, 0); + do_test_decrypt_op(DVPT128, 15, 1); + do_test_decrypt_op(DVPT128, 19, 1); + do_test_decrypt_op(DVPT128, 26, 1); + do_test_decrypt_op(DVPT128, 27, 1); + do_test_decrypt_op(DVPT128, 28, 1); + do_test_decrypt_op(DVPT128, 30, 2); + do_test_decrypt_op(DVPT128, 34, 2); + do_test_decrypt_op(DVPT128, 41, 2); + do_test_decrypt_op(DVPT128, 42, 2); + do_test_decrypt_op(DVPT128, 43, 2); + do_test_decrypt_op(DVPT128, 45, 3); + do_test_decrypt_op(DVPT128, 49, 3); + do_test_decrypt_op(DVPT128, 56, 3); + do_test_decrypt_op(DVPT128, 57, 3); + do_test_decrypt_op(DVPT128, 58, 3); + do_test_decrypt_op(DVPT128, 60, 4); + do_test_decrypt_op(DVPT128, 64, 4); + do_test_decrypt_op(DVPT128, 71, 4); + do_test_decrypt_op(DVPT128, 72, 4); + do_test_decrypt_op(DVPT128, 73, 4); + do_test_decrypt_op(DVPT128, 75, 5); + do_test_decrypt_op(DVPT128, 79, 5); + do_test_decrypt_op(DVPT128, 86, 5); + do_test_decrypt_op(DVPT128, 87, 5); + do_test_decrypt_op(DVPT128, 88, 5); + do_test_decrypt_op(DVPT128, 90, 6); + do_test_decrypt_op(DVPT128, 94, 6); + do_test_decrypt_op(DVPT128, 101, 6); + do_test_decrypt_op(DVPT128, 102, 6); + do_test_decrypt_op(DVPT128, 103, 6); + do_test_decrypt_op(DVPT128, 105, 7); + do_test_decrypt_op(DVPT128, 109, 7); + do_test_decrypt_op(DVPT128, 116, 7); + do_test_decrypt_op(DVPT128, 117, 7); + do_test_decrypt_op(DVPT128, 118, 7); + do_test_decrypt_op(DVPT128, 120, 8); + do_test_decrypt_op(DVPT128, 124, 8); + do_test_decrypt_op(DVPT128, 131, 8); + do_test_decrypt_op(DVPT128, 132, 8); + do_test_decrypt_op(DVPT128, 133, 8); + do_test_decrypt_op(DVPT128, 135, 9); + do_test_decrypt_op(DVPT128, 139, 9); + do_test_decrypt_op(DVPT128, 146, 9); + do_test_decrypt_op(DVPT128, 147, 9); + do_test_decrypt_op(DVPT128, 148, 9); + do_test_decrypt_op(DVPT128, 150, 10); + do_test_decrypt_op(DVPT128, 154, 10); + do_test_decrypt_op(DVPT128, 161, 10); + do_test_decrypt_op(DVPT128, 162, 10); + do_test_decrypt_op(DVPT128, 163, 10); + do_test_decrypt_op(DVPT128, 165, 11); + do_test_decrypt_op(DVPT128, 169, 11); + do_test_decrypt_op(DVPT128, 176, 11); + do_test_decrypt_op(DVPT128, 177, 11); + do_test_decrypt_op(DVPT128, 178, 11); + do_test_decrypt_op(DVPT128, 180, 12); + do_test_decrypt_op(DVPT128, 184, 12); + do_test_decrypt_op(DVPT128, 191, 12); + do_test_decrypt_op(DVPT128, 192, 12); + do_test_decrypt_op(DVPT128, 193, 12); + do_test_decrypt_op(DVPT128, 195, 13); + do_test_decrypt_op(DVPT128, 199, 13); + do_test_decrypt_op(DVPT128, 206, 13); + do_test_decrypt_op(DVPT128, 207, 13); + do_test_decrypt_op(DVPT128, 208, 13); + do_test_decrypt_op(DVPT128, 210, 14); + do_test_decrypt_op(DVPT128, 214, 14); + do_test_decrypt_op(DVPT128, 221, 14); + do_test_decrypt_op(DVPT128, 222, 14); + do_test_decrypt_op(DVPT128, 223, 14); + do_test_decrypt_op(DVPT128, 225, 15); + do_test_decrypt_op(DVPT128, 229, 15); + do_test_decrypt_op(DVPT128, 236, 15); + do_test_decrypt_op(DVPT128, 237, 15); + do_test_decrypt_op(DVPT128, 238, 15); +} +static void test_crypto_modes_ccm_encrypt(void) +{ + do_test_encrypt_op(DVPT128, 0, 0); + do_test_encrypt_op(DVPT128, 4, 0); + do_test_encrypt_op(DVPT128, 11, 0); + do_test_encrypt_op(DVPT128, 12, 0); + do_test_encrypt_op(DVPT128, 13, 0); + do_test_encrypt_op(DVPT128, 15, 1); + do_test_encrypt_op(DVPT128, 19, 1); + do_test_encrypt_op(DVPT128, 26, 1); + do_test_encrypt_op(DVPT128, 27, 1); + do_test_encrypt_op(DVPT128, 28, 1); + do_test_encrypt_op(DVPT128, 30, 2); + do_test_encrypt_op(DVPT128, 34, 2); + do_test_encrypt_op(DVPT128, 41, 2); + do_test_encrypt_op(DVPT128, 42, 2); + do_test_encrypt_op(DVPT128, 43, 2); + do_test_encrypt_op(DVPT128, 45, 3); + do_test_encrypt_op(DVPT128, 49, 3); + do_test_encrypt_op(DVPT128, 56, 3); + do_test_encrypt_op(DVPT128, 57, 3); + do_test_encrypt_op(DVPT128, 58, 3); + do_test_encrypt_op(DVPT128, 60, 4); + do_test_encrypt_op(DVPT128, 64, 4); + do_test_encrypt_op(DVPT128, 71, 4); + do_test_encrypt_op(DVPT128, 72, 4); + do_test_encrypt_op(DVPT128, 73, 4); + do_test_encrypt_op(DVPT128, 75, 5); + do_test_encrypt_op(DVPT128, 79, 5); + do_test_encrypt_op(DVPT128, 86, 5); + do_test_encrypt_op(DVPT128, 87, 5); + do_test_encrypt_op(DVPT128, 88, 5); + do_test_encrypt_op(DVPT128, 90, 6); + do_test_encrypt_op(DVPT128, 94, 6); + do_test_encrypt_op(DVPT128, 101, 6); + do_test_encrypt_op(DVPT128, 102, 6); + do_test_encrypt_op(DVPT128, 103, 6); + do_test_encrypt_op(DVPT128, 105, 7); + do_test_encrypt_op(DVPT128, 109, 7); + do_test_encrypt_op(DVPT128, 116, 7); + do_test_encrypt_op(DVPT128, 117, 7); + do_test_encrypt_op(DVPT128, 118, 7); + do_test_encrypt_op(DVPT128, 120, 8); + do_test_encrypt_op(DVPT128, 124, 8); + do_test_encrypt_op(DVPT128, 131, 8); + do_test_encrypt_op(DVPT128, 132, 8); + do_test_encrypt_op(DVPT128, 133, 8); + do_test_encrypt_op(DVPT128, 135, 9); + do_test_encrypt_op(DVPT128, 139, 9); + do_test_encrypt_op(DVPT128, 146, 9); + do_test_encrypt_op(DVPT128, 147, 9); + do_test_encrypt_op(DVPT128, 148, 9); + do_test_encrypt_op(DVPT128, 150, 10); + do_test_encrypt_op(DVPT128, 154, 10); + do_test_encrypt_op(DVPT128, 161, 10); + do_test_encrypt_op(DVPT128, 162, 10); + do_test_encrypt_op(DVPT128, 163, 10); + do_test_encrypt_op(DVPT128, 165, 11); + do_test_encrypt_op(DVPT128, 169, 11); + do_test_encrypt_op(DVPT128, 176, 11); + do_test_encrypt_op(DVPT128, 177, 11); + do_test_encrypt_op(DVPT128, 178, 11); + do_test_encrypt_op(DVPT128, 180, 12); + do_test_encrypt_op(DVPT128, 184, 12); + do_test_encrypt_op(DVPT128, 191, 12); + do_test_encrypt_op(DVPT128, 192, 12); + do_test_encrypt_op(DVPT128, 193, 12); + do_test_encrypt_op(DVPT128, 195, 13); + do_test_encrypt_op(DVPT128, 199, 13); + do_test_encrypt_op(DVPT128, 206, 13); + do_test_encrypt_op(DVPT128, 207, 13); + do_test_encrypt_op(DVPT128, 208, 13); + do_test_encrypt_op(DVPT128, 210, 14); + do_test_encrypt_op(DVPT128, 214, 14); + do_test_encrypt_op(DVPT128, 221, 14); + do_test_encrypt_op(DVPT128, 222, 14); + do_test_encrypt_op(DVPT128, 223, 14); + do_test_encrypt_op(DVPT128, 225, 15); + do_test_encrypt_op(DVPT128, 229, 15); + do_test_encrypt_op(DVPT128, 236, 15); + do_test_encrypt_op(DVPT128, 237, 15); + do_test_encrypt_op(DVPT128, 238, 15); +} + +Test *tests_crypto_modes_ccm_tests_128(void) +{ + EMB_UNIT_TESTFIXTURES(fixtures) { + new_TestFixture(test_crypto_modes_ccm_encrypt), + new_TestFixture(test_crypto_modes_ccm_decrypt), + }; + + EMB_UNIT_TESTCALLER(crypto_modes_ccm_tests_128, NULL, NULL, fixtures); + + return (Test *)&crypto_modes_ccm_tests_128; +} diff --git a/tests/sys_crypto/tests-crypto-modes-ccm-192.c b/tests/sys_crypto/tests-crypto-modes-ccm-192.c new file mode 100644 index 0000000000..20e1e44607 --- /dev/null +++ b/tests/sys_crypto/tests-crypto-modes-ccm-192.c @@ -0,0 +1,2454 @@ +/* + * Copyright (C) 2021 Freie Universität Berlin + * + * This file is subject to the terms and conditions of the GNU Lesser + * General Public License v2.1. See the file LICENSE in the top level + * directory for more details. + */ + +#include + +#include +#include +#include + +#include "embUnit.h" +#include "crypto/ciphers.h" +#include "crypto/modes/ccm.h" +#include "tests-crypto.h" + +/** + * AES CCM DVTP test vectors (SP 800-38C) for 192 bit keys. + * https://csrc.nist.gov/projects/cryptographic-algorithm-validation-program/cavp-testing-block-cipher-modes + */ + +static const size_t nonce_and_len_encoding_size = 15; + +/* Alen = 0, Plen = 0, Nlen = 7, Tlen = 4 */ +static const uint8_t TEST_DVPT192_GROUP_0_MAC_LEN = 4; + +static const uint8_t TEST_DVPT192_GROUP_0_KEY[] = { + 0xc9, 0x8a, 0xd7, 0xf3, 0x8b, 0x2c, 0x7e, 0x97, + 0x0c, 0x9b, 0x96, 0x5e, 0xc8, 0x7a, 0x08, 0x20, + 0x83, 0x84, 0x71, 0x8f, 0x78, 0x20, 0x6c, 0x6c, +}; +static const size_t TEST_DVPT192_GROUP_0_KEY_LEN = 24; + +static const uint8_t TEST_DVPT192_0_NONCE[] = { + 0x5a, 0x8a, 0xa4, 0x85, 0xc3, 0x16, 0xe9, +}; +static const size_t TEST_DVPT192_0_NONCE_LEN = 7; + +static const uint8_t TEST_DVPT192_0_ADATA[] = { + 0x00, +}; +static const size_t TEST_DVPT192_0_ADATA_LEN = 0; + +static const uint8_t TEST_DVPT192_0_EXPECTED[] = { + 0x9d, 0x4b, 0x7f, 0x3b, +}; +static const size_t TEST_DVPT192_0_EXPECTED_LEN = 4; + +static const uint8_t TEST_DVPT192_0_INPUT[] = { + 0x00, +}; +static const size_t TEST_DVPT192_0_INPUT_LEN = 0; + +static const uint8_t TEST_DVPT192_4_NONCE[] = { + 0x05, 0xe1, 0x6f, 0x0f, 0x42, 0xa6, 0xf4, +}; +static const size_t TEST_DVPT192_4_NONCE_LEN = 7; + +static const uint8_t TEST_DVPT192_4_ADATA[] = { + 0x00, +}; +static const size_t TEST_DVPT192_4_ADATA_LEN = 0; + +static const uint8_t TEST_DVPT192_4_EXPECTED[] = { + 0xc7, 0x9d, 0x55, 0x57, +}; +static const size_t TEST_DVPT192_4_EXPECTED_LEN = 4; + +static const uint8_t TEST_DVPT192_4_INPUT[] = { + 0x00, +}; +static const size_t TEST_DVPT192_4_INPUT_LEN = 0; + +static const uint8_t TEST_DVPT192_11_NONCE[] = { + 0xa9, 0xdf, 0x4f, 0x37, 0x84, 0x7e, 0x1f, +}; +static const size_t TEST_DVPT192_11_NONCE_LEN = 7; + +static const uint8_t TEST_DVPT192_11_ADATA[] = { + 0x00, +}; +static const size_t TEST_DVPT192_11_ADATA_LEN = 0; + +static const uint8_t TEST_DVPT192_11_EXPECTED[] = { + 0x22, 0x97, 0x6e, 0x42, +}; +static const size_t TEST_DVPT192_11_EXPECTED_LEN = 4; + +static const uint8_t TEST_DVPT192_11_INPUT[] = { + 0x00, +}; +static const size_t TEST_DVPT192_11_INPUT_LEN = 0; + +static const uint8_t TEST_DVPT192_12_NONCE[] = { + 0x11, 0xdf, 0x57, 0xfc, 0xd1, 0x31, 0xe9, +}; +static const size_t TEST_DVPT192_12_NONCE_LEN = 7; + +static const uint8_t TEST_DVPT192_12_ADATA[] = { + 0x00, +}; +static const size_t TEST_DVPT192_12_ADATA_LEN = 0; + +static const uint8_t TEST_DVPT192_12_EXPECTED[] = { + 0xf4, 0x40, 0xea, 0x1d, +}; +static const size_t TEST_DVPT192_12_EXPECTED_LEN = 4; + +static const uint8_t TEST_DVPT192_12_INPUT[] = { + 0x00, +}; +static const size_t TEST_DVPT192_12_INPUT_LEN = 0; + +static const uint8_t TEST_DVPT192_13_NONCE[] = { + 0x89, 0x0f, 0xff, 0x56, 0xd1, 0x0d, 0xc0, +}; +static const size_t TEST_DVPT192_13_NONCE_LEN = 7; + +static const uint8_t TEST_DVPT192_13_ADATA[] = { + 0x00, +}; +static const size_t TEST_DVPT192_13_ADATA_LEN = 0; + +static const uint8_t TEST_DVPT192_13_EXPECTED[] = { + 0x88, 0x90, 0x3f, 0xb9, +}; +static const size_t TEST_DVPT192_13_EXPECTED_LEN = 4; + +static const uint8_t TEST_DVPT192_13_INPUT[] = { + 0x00, +}; +static const size_t TEST_DVPT192_13_INPUT_LEN = 0; + +/* Alen = 0, Plen = 0, Nlen = 7, Tlen = 16 */ +static const uint8_t TEST_DVPT192_GROUP_1_MAC_LEN = 16; + +static const uint8_t TEST_DVPT192_GROUP_1_KEY[] = { + 0x4b, 0xb3, 0xc4, 0xa4, 0xf8, 0x93, 0xad, 0x8c, + 0x9b, 0xdc, 0x83, 0x3c, 0x32, 0x5d, 0x62, 0xb3, + 0xd3, 0xad, 0x1b, 0xcc, 0xf9, 0x28, 0x2a, 0x65, +}; +static const size_t TEST_DVPT192_GROUP_1_KEY_LEN = 24; + +static const uint8_t TEST_DVPT192_15_NONCE[] = { + 0x5a, 0x8a, 0xa4, 0x85, 0xc3, 0x16, 0xe9, +}; +static const size_t TEST_DVPT192_15_NONCE_LEN = 7; + +static const uint8_t TEST_DVPT192_15_ADATA[] = { + 0x00, +}; +static const size_t TEST_DVPT192_15_ADATA_LEN = 0; + +static const uint8_t TEST_DVPT192_15_EXPECTED[] = { + 0x17, 0x22, 0x30, 0x38, 0xfa, 0x99, 0xd5, 0x36, + 0x81, 0xca, 0x1b, 0xea, 0xbe, 0x78, 0xd1, 0xb4, +}; +static const size_t TEST_DVPT192_15_EXPECTED_LEN = 16; + +static const uint8_t TEST_DVPT192_15_INPUT[] = { + 0x00, +}; +static const size_t TEST_DVPT192_15_INPUT_LEN = 0; + +static const uint8_t TEST_DVPT192_19_NONCE[] = { + 0x05, 0xe1, 0x6f, 0x0f, 0x42, 0xa6, 0xf4, +}; +static const size_t TEST_DVPT192_19_NONCE_LEN = 7; + +static const uint8_t TEST_DVPT192_19_ADATA[] = { + 0x00, +}; +static const size_t TEST_DVPT192_19_ADATA_LEN = 0; + +static const uint8_t TEST_DVPT192_19_EXPECTED[] = { + 0xfd, 0xfd, 0xbb, 0x38, 0xbf, 0x16, 0x17, 0x85, + 0x11, 0x4f, 0x9e, 0xe2, 0x01, 0x8e, 0x89, 0x2f, +}; +static const size_t TEST_DVPT192_19_EXPECTED_LEN = 16; + +static const uint8_t TEST_DVPT192_19_INPUT[] = { + 0x00, +}; +static const size_t TEST_DVPT192_19_INPUT_LEN = 0; + +static const uint8_t TEST_DVPT192_26_NONCE[] = { + 0xa9, 0xdf, 0x4f, 0x37, 0x84, 0x7e, 0x1f, +}; +static const size_t TEST_DVPT192_26_NONCE_LEN = 7; + +static const uint8_t TEST_DVPT192_26_ADATA[] = { + 0x00, +}; +static const size_t TEST_DVPT192_26_ADATA_LEN = 0; + +static const uint8_t TEST_DVPT192_26_EXPECTED[] = { + 0x7e, 0x3b, 0xbe, 0x0e, 0xb1, 0x39, 0x88, 0xa9, + 0x39, 0x72, 0xf2, 0xfb, 0xcd, 0x35, 0x65, 0x9e, +}; +static const size_t TEST_DVPT192_26_EXPECTED_LEN = 16; + +static const uint8_t TEST_DVPT192_26_INPUT[] = { + 0x00, +}; +static const size_t TEST_DVPT192_26_INPUT_LEN = 0; + +static const uint8_t TEST_DVPT192_27_NONCE[] = { + 0x11, 0xdf, 0x57, 0xfc, 0xd1, 0x31, 0xe9, +}; +static const size_t TEST_DVPT192_27_NONCE_LEN = 7; + +static const uint8_t TEST_DVPT192_27_ADATA[] = { + 0x00, +}; +static const size_t TEST_DVPT192_27_ADATA_LEN = 0; + +static const uint8_t TEST_DVPT192_27_EXPECTED[] = { + 0x48, 0xd7, 0xa1, 0x5c, 0xf4, 0xf5, 0x80, 0x8e, + 0xb4, 0x5d, 0x1a, 0xd8, 0x17, 0x47, 0x05, 0x54, +}; +static const size_t TEST_DVPT192_27_EXPECTED_LEN = 16; + +static const uint8_t TEST_DVPT192_27_INPUT[] = { + 0x00, +}; +static const size_t TEST_DVPT192_27_INPUT_LEN = 0; + +static const uint8_t TEST_DVPT192_28_NONCE[] = { + 0x89, 0x0f, 0xff, 0x56, 0xd1, 0x0d, 0xc0, +}; +static const size_t TEST_DVPT192_28_NONCE_LEN = 7; + +static const uint8_t TEST_DVPT192_28_ADATA[] = { + 0x00, +}; +static const size_t TEST_DVPT192_28_ADATA_LEN = 0; + +static const uint8_t TEST_DVPT192_28_EXPECTED[] = { + 0x97, 0x18, 0x5c, 0xe6, 0x8a, 0xf1, 0xe6, 0xab, + 0x71, 0x8c, 0x8c, 0x4b, 0x83, 0xec, 0x04, 0xcd, +}; +static const size_t TEST_DVPT192_28_EXPECTED_LEN = 16; + +static const uint8_t TEST_DVPT192_28_INPUT[] = { + 0x00, +}; +static const size_t TEST_DVPT192_28_INPUT_LEN = 0; + +/* Alen = 0, Plen = 0, Nlen = 13, Tlen = 4 */ +static const uint8_t TEST_DVPT192_GROUP_2_MAC_LEN = 4; + +static const uint8_t TEST_DVPT192_GROUP_2_KEY[] = { + 0x4b, 0xb3, 0xc4, 0xa4, 0xf8, 0x93, 0xad, 0x8c, + 0x9b, 0xdc, 0x83, 0x3c, 0x32, 0x5d, 0x62, 0xb3, + 0xd3, 0xad, 0x1b, 0xcc, 0xf9, 0x28, 0x2a, 0x65, +}; +static const size_t TEST_DVPT192_GROUP_2_KEY_LEN = 24; + +static const uint8_t TEST_DVPT192_30_NONCE[] = { + 0x5a, 0x8a, 0xa4, 0x85, 0xc3, 0x16, 0xe9, 0x40, + 0x3a, 0xff, 0x85, 0x9f, 0xbb, +}; +static const size_t TEST_DVPT192_30_NONCE_LEN = 13; + +static const uint8_t TEST_DVPT192_30_ADATA[] = { + 0x00, +}; +static const size_t TEST_DVPT192_30_ADATA_LEN = 0; + +static const uint8_t TEST_DVPT192_30_EXPECTED[] = { + 0xfe, 0x69, 0xed, 0x84, +}; +static const size_t TEST_DVPT192_30_EXPECTED_LEN = 4; + +static const uint8_t TEST_DVPT192_30_INPUT[] = { + 0x00, +}; +static const size_t TEST_DVPT192_30_INPUT_LEN = 0; + +static const uint8_t TEST_DVPT192_34_NONCE[] = { + 0x93, 0x5c, 0x1e, 0xf3, 0xd4, 0x03, 0x2f, 0xf0, + 0x90, 0xf9, 0x11, 0x41, 0xf3, +}; +static const size_t TEST_DVPT192_34_NONCE_LEN = 13; + +static const uint8_t TEST_DVPT192_34_ADATA[] = { + 0x00, +}; +static const size_t TEST_DVPT192_34_ADATA_LEN = 0; + +static const uint8_t TEST_DVPT192_34_EXPECTED[] = { + 0x21, 0x5e, 0x0b, 0xf2, +}; +static const size_t TEST_DVPT192_34_EXPECTED_LEN = 4; + +static const uint8_t TEST_DVPT192_34_INPUT[] = { + 0x00, +}; +static const size_t TEST_DVPT192_34_INPUT_LEN = 0; + +static const uint8_t TEST_DVPT192_41_NONCE[] = { + 0xd0, 0xa1, 0x50, 0x8f, 0xde, 0xfc, 0xf5, 0xbe, + 0x30, 0xa4, 0x59, 0xb8, 0x13, +}; +static const size_t TEST_DVPT192_41_NONCE_LEN = 13; + +static const uint8_t TEST_DVPT192_41_ADATA[] = { + 0x00, +}; +static const size_t TEST_DVPT192_41_ADATA_LEN = 0; + +static const uint8_t TEST_DVPT192_41_EXPECTED[] = { + 0x79, 0x0b, 0x26, 0x24, +}; +static const size_t TEST_DVPT192_41_EXPECTED_LEN = 4; + +static const uint8_t TEST_DVPT192_41_INPUT[] = { + 0x00, +}; +static const size_t TEST_DVPT192_41_INPUT_LEN = 0; + +static const uint8_t TEST_DVPT192_42_NONCE[] = { + 0x53, 0x81, 0xa6, 0x1b, 0x44, 0x9d, 0xc6, 0xa4, + 0x2a, 0xa4, 0xc7, 0x9b, 0x95, +}; +static const size_t TEST_DVPT192_42_NONCE_LEN = 13; + +static const uint8_t TEST_DVPT192_42_ADATA[] = { + 0x00, +}; +static const size_t TEST_DVPT192_42_ADATA_LEN = 0; + +static const uint8_t TEST_DVPT192_42_EXPECTED[] = { + 0x9e, 0x46, 0x63, 0x2d, +}; +static const size_t TEST_DVPT192_42_EXPECTED_LEN = 4; + +static const uint8_t TEST_DVPT192_42_INPUT[] = { + 0x00, +}; +static const size_t TEST_DVPT192_42_INPUT_LEN = 0; + +static const uint8_t TEST_DVPT192_43_NONCE[] = { + 0xc5, 0x54, 0x30, 0xf2, 0xda, 0x06, 0x87, 0xea, + 0x40, 0x31, 0x38, 0x84, 0xab, +}; +static const size_t TEST_DVPT192_43_NONCE_LEN = 13; + +static const uint8_t TEST_DVPT192_43_ADATA[] = { + 0x00, +}; +static const size_t TEST_DVPT192_43_ADATA_LEN = 0; + +static const uint8_t TEST_DVPT192_43_EXPECTED[] = { + 0x39, 0xb8, 0x29, 0x01, +}; +static const size_t TEST_DVPT192_43_EXPECTED_LEN = 4; + +static const uint8_t TEST_DVPT192_43_INPUT[] = { + 0x00, +}; +static const size_t TEST_DVPT192_43_INPUT_LEN = 0; + +/* Alen = 0, Plen = 0, Nlen = 13, Tlen = 16 */ +static const uint8_t TEST_DVPT192_GROUP_3_MAC_LEN = 16; + +static const uint8_t TEST_DVPT192_GROUP_3_KEY[] = { + 0x19, 0xeb, 0xfd, 0xe2, 0xd5, 0x46, 0x8b, 0xa0, + 0xa3, 0x03, 0x1b, 0xde, 0x62, 0x9b, 0x11, 0xfd, + 0x40, 0x94, 0xaf, 0xcb, 0x20, 0x53, 0x93, 0xfa, +}; +static const size_t TEST_DVPT192_GROUP_3_KEY_LEN = 24; + +static const uint8_t TEST_DVPT192_45_NONCE[] = { + 0x5a, 0x8a, 0xa4, 0x85, 0xc3, 0x16, 0xe9, 0x40, + 0x3a, 0xff, 0x85, 0x9f, 0xbb, +}; +static const size_t TEST_DVPT192_45_NONCE_LEN = 13; + +static const uint8_t TEST_DVPT192_45_ADATA[] = { + 0x00, +}; +static const size_t TEST_DVPT192_45_ADATA_LEN = 0; + +static const uint8_t TEST_DVPT192_45_EXPECTED[] = { + 0x0c, 0x66, 0xa8, 0xe5, 0x47, 0xed, 0x4f, 0x8c, + 0x2c, 0x9a, 0x9a, 0x1e, 0xb5, 0xd4, 0x55, 0xb9, +}; +static const size_t TEST_DVPT192_45_EXPECTED_LEN = 16; + +static const uint8_t TEST_DVPT192_45_INPUT[] = { + 0x00, +}; +static const size_t TEST_DVPT192_45_INPUT_LEN = 0; + +static const uint8_t TEST_DVPT192_49_NONCE[] = { + 0x93, 0x5c, 0x1e, 0xf3, 0xd4, 0x03, 0x2f, 0xf0, + 0x90, 0xf9, 0x11, 0x41, 0xf3, +}; +static const size_t TEST_DVPT192_49_NONCE_LEN = 13; + +static const uint8_t TEST_DVPT192_49_ADATA[] = { + 0x00, +}; +static const size_t TEST_DVPT192_49_ADATA_LEN = 0; + +static const uint8_t TEST_DVPT192_49_EXPECTED[] = { + 0x87, 0xda, 0x5d, 0xbc, 0x04, 0xe3, 0x9f, 0xc4, + 0x68, 0xf4, 0x36, 0x75, 0xd4, 0xe7, 0xdf, 0x33, +}; +static const size_t TEST_DVPT192_49_EXPECTED_LEN = 16; + +static const uint8_t TEST_DVPT192_49_INPUT[] = { + 0x00, +}; +static const size_t TEST_DVPT192_49_INPUT_LEN = 0; + +static const uint8_t TEST_DVPT192_56_NONCE[] = { + 0xd0, 0xa1, 0x50, 0x8f, 0xde, 0xfc, 0xf5, 0xbe, + 0x30, 0xa4, 0x59, 0xb8, 0x13, +}; +static const size_t TEST_DVPT192_56_NONCE_LEN = 13; + +static const uint8_t TEST_DVPT192_56_ADATA[] = { + 0x00, +}; +static const size_t TEST_DVPT192_56_ADATA_LEN = 0; + +static const uint8_t TEST_DVPT192_56_EXPECTED[] = { + 0xa0, 0xd0, 0x47, 0xa1, 0xf9, 0x94, 0x0d, 0x32, + 0x5e, 0x47, 0x4d, 0xa5, 0x4a, 0xa1, 0x38, 0x97, +}; +static const size_t TEST_DVPT192_56_EXPECTED_LEN = 16; + +static const uint8_t TEST_DVPT192_56_INPUT[] = { + 0x00, +}; +static const size_t TEST_DVPT192_56_INPUT_LEN = 0; + +static const uint8_t TEST_DVPT192_57_NONCE[] = { + 0x53, 0x81, 0xa6, 0x1b, 0x44, 0x9d, 0xc6, 0xa4, + 0x2a, 0xa4, 0xc7, 0x9b, 0x95, +}; +static const size_t TEST_DVPT192_57_NONCE_LEN = 13; + +static const uint8_t TEST_DVPT192_57_ADATA[] = { + 0x00, +}; +static const size_t TEST_DVPT192_57_ADATA_LEN = 0; + +static const uint8_t TEST_DVPT192_57_EXPECTED[] = { + 0x8a, 0x47, 0x68, 0xa2, 0x09, 0x36, 0x94, 0xb6, + 0xbc, 0xb7, 0x08, 0x3c, 0x0b, 0xb6, 0x33, 0x1c, +}; +static const size_t TEST_DVPT192_57_EXPECTED_LEN = 16; + +static const uint8_t TEST_DVPT192_57_INPUT[] = { + 0x00, +}; +static const size_t TEST_DVPT192_57_INPUT_LEN = 0; + +static const uint8_t TEST_DVPT192_58_NONCE[] = { + 0xc5, 0x54, 0x30, 0xf2, 0xda, 0x06, 0x87, 0xea, + 0x40, 0x31, 0x38, 0x84, 0xab, +}; +static const size_t TEST_DVPT192_58_NONCE_LEN = 13; + +static const uint8_t TEST_DVPT192_58_ADATA[] = { + 0x00, +}; +static const size_t TEST_DVPT192_58_ADATA_LEN = 0; + +static const uint8_t TEST_DVPT192_58_EXPECTED[] = { + 0xa7, 0xca, 0xfd, 0x6f, 0x68, 0xdc, 0x1f, 0x15, + 0xa3, 0x60, 0x3d, 0xa6, 0x54, 0xce, 0x27, 0xbc, +}; +static const size_t TEST_DVPT192_58_EXPECTED_LEN = 16; + +static const uint8_t TEST_DVPT192_58_INPUT[] = { + 0x00, +}; +static const size_t TEST_DVPT192_58_INPUT_LEN = 0; + +/* Alen = 0, Plen = 24, Nlen = 7, Tlen = 4 */ +static const uint8_t TEST_DVPT192_GROUP_4_MAC_LEN = 4; + +static const uint8_t TEST_DVPT192_GROUP_4_KEY[] = { + 0x19, 0xeb, 0xfd, 0xe2, 0xd5, 0x46, 0x8b, 0xa0, + 0xa3, 0x03, 0x1b, 0xde, 0x62, 0x9b, 0x11, 0xfd, + 0x40, 0x94, 0xaf, 0xcb, 0x20, 0x53, 0x93, 0xfa, +}; +static const size_t TEST_DVPT192_GROUP_4_KEY_LEN = 24; + +static const uint8_t TEST_DVPT192_60_NONCE[] = { + 0x5a, 0x8a, 0xa4, 0x85, 0xc3, 0x16, 0xe9, +}; +static const size_t TEST_DVPT192_60_NONCE_LEN = 7; + +static const uint8_t TEST_DVPT192_60_ADATA[] = { + 0x00, +}; +static const size_t TEST_DVPT192_60_ADATA_LEN = 0; + +static const uint8_t TEST_DVPT192_60_EXPECTED[] = { + 0x41, 0x19, 0x86, 0xd0, 0x4d, 0x64, 0x63, 0x10, + 0x0b, 0xff, 0x03, 0xf7, 0xd0, 0xbd, 0xe7, 0xea, + 0x2c, 0x34, 0x88, 0x78, 0x43, 0x78, 0x13, 0x8c, + 0xdd, 0xc9, 0x3a, 0x54, +}; +static const size_t TEST_DVPT192_60_EXPECTED_LEN = 28; + +static const uint8_t TEST_DVPT192_60_INPUT[] = { + 0x37, 0x96, 0xcf, 0x51, 0xb8, 0x72, 0x66, 0x52, + 0xa4, 0x20, 0x47, 0x33, 0xb8, 0xfb, 0xb0, 0x47, + 0xcf, 0x00, 0xfb, 0x91, 0xa9, 0x83, 0x7e, 0x22, +}; +static const size_t TEST_DVPT192_60_INPUT_LEN = 24; + +static const uint8_t TEST_DVPT192_64_NONCE[] = { + 0x12, 0x3a, 0x0b, 0xea, 0xce, 0x4e, 0x39, +}; +static const size_t TEST_DVPT192_64_NONCE_LEN = 7; + +static const uint8_t TEST_DVPT192_64_ADATA[] = { + 0x00, +}; +static const size_t TEST_DVPT192_64_ADATA_LEN = 0; + +static const uint8_t TEST_DVPT192_64_EXPECTED[] = { + 0xb4, 0x1b, 0xfb, 0xa9, 0x4e, 0xdc, 0xaf, 0xc4, + 0x1b, 0x4c, 0x14, 0x42, 0x69, 0xb9, 0x12, 0x6a, + 0x6d, 0x47, 0xb1, 0x9e, 0x83, 0xb1, 0x57, 0x72, + 0xb2, 0x8c, 0x8e, 0x38, +}; +static const size_t TEST_DVPT192_64_EXPECTED_LEN = 28; + +static const uint8_t TEST_DVPT192_64_INPUT[] = { + 0x9d, 0x03, 0x3e, 0x3b, 0x66, 0xef, 0xed, 0x14, + 0x67, 0x86, 0x8f, 0x38, 0x24, 0x17, 0xc8, 0x05, + 0x94, 0x87, 0x7a, 0x28, 0xbc, 0x97, 0xf4, 0x06, +}; +static const size_t TEST_DVPT192_64_INPUT_LEN = 24; + +static const uint8_t TEST_DVPT192_71_NONCE[] = { + 0xf6, 0x7b, 0x98, 0xef, 0xd3, 0x9b, 0x55, +}; +static const size_t TEST_DVPT192_71_NONCE_LEN = 7; + +static const uint8_t TEST_DVPT192_71_ADATA[] = { + 0x00, +}; +static const size_t TEST_DVPT192_71_ADATA_LEN = 0; + +static const uint8_t TEST_DVPT192_71_EXPECTED[] = { + 0x0a, 0x7f, 0xe6, 0x30, 0x46, 0xda, 0xf8, 0xa9, + 0x79, 0x93, 0x5b, 0x89, 0x70, 0x88, 0xc6, 0x4a, + 0xcc, 0x1b, 0x47, 0xa5, 0xa9, 0xb8, 0x6f, 0xdd, + 0x6d, 0xef, 0x28, 0xab, +}; +static const size_t TEST_DVPT192_71_EXPECTED_LEN = 28; + +static const uint8_t TEST_DVPT192_71_INPUT[] = { + 0xf2, 0xe9, 0x44, 0xe1, 0xae, 0x47, 0xad, 0x58, + 0x73, 0xbf, 0x39, 0x1f, 0x1b, 0x0c, 0xc0, 0x7f, + 0x61, 0x51, 0xeb, 0x4c, 0x50, 0xbb, 0x45, 0xb2, +}; +static const size_t TEST_DVPT192_71_INPUT_LEN = 24; + +static const uint8_t TEST_DVPT192_72_NONCE[] = { + 0xe6, 0x0e, 0x2c, 0x00, 0x2d, 0x1c, 0x99, +}; +static const size_t TEST_DVPT192_72_NONCE_LEN = 7; + +static const uint8_t TEST_DVPT192_72_ADATA[] = { + 0x00, +}; +static const size_t TEST_DVPT192_72_ADATA_LEN = 0; + +static const uint8_t TEST_DVPT192_72_EXPECTED[] = { + 0xda, 0xf7, 0xd7, 0xdf, 0xa5, 0x12, 0xce, 0xb1, + 0xd7, 0xd3, 0x43, 0x56, 0x34, 0xd9, 0xa7, 0x0b, + 0x3e, 0xf6, 0xc6, 0xdc, 0x38, 0xf4, 0x09, 0xe0, + 0x68, 0x94, 0x1f, 0xce, +}; +static const size_t TEST_DVPT192_72_EXPECTED_LEN = 28; + +static const uint8_t TEST_DVPT192_72_INPUT[] = { + 0x70, 0xf4, 0x8d, 0xc1, 0xd7, 0x6e, 0x50, 0x28, + 0xda, 0x07, 0xe2, 0x98, 0x52, 0x80, 0x13, 0x75, + 0xa9, 0xed, 0xb2, 0x21, 0x4a, 0x5e, 0xa4, 0xc0, +}; +static const size_t TEST_DVPT192_72_INPUT_LEN = 24; + +static const uint8_t TEST_DVPT192_73_NONCE[] = { + 0x09, 0x8e, 0x05, 0x3f, 0xa0, 0x80, 0x43, +}; +static const size_t TEST_DVPT192_73_NONCE_LEN = 7; + +static const uint8_t TEST_DVPT192_73_ADATA[] = { + 0x00, +}; +static const size_t TEST_DVPT192_73_ADATA_LEN = 0; + +static const uint8_t TEST_DVPT192_73_EXPECTED[] = { + 0xcd, 0xb4, 0x17, 0xdf, 0xf6, 0x50, 0x22, 0x08, + 0x77, 0x5f, 0x21, 0xe3, 0x5c, 0xdb, 0x8e, 0x3e, + 0x11, 0x99, 0x30, 0x8d, 0x1a, 0x94, 0x22, 0x90, + 0x51, 0xa1, 0xec, 0x4a, +}; +static const size_t TEST_DVPT192_73_EXPECTED_LEN = 28; + +static const uint8_t TEST_DVPT192_73_INPUT[] = { + 0xbd, 0x81, 0x68, 0x0e, 0x3d, 0xc0, 0xb3, 0x54, + 0x31, 0xc9, 0x25, 0x98, 0xdc, 0xaa, 0x26, 0xef, + 0x09, 0xca, 0x0d, 0xa5, 0xe7, 0x71, 0x93, 0xde, +}; +static const size_t TEST_DVPT192_73_INPUT_LEN = 24; + +/* Alen = 0, Plen = 24, Nlen = 7, Tlen = 16 */ +static const uint8_t TEST_DVPT192_GROUP_5_MAC_LEN = 16; + +static const uint8_t TEST_DVPT192_GROUP_5_KEY[] = { + 0x19, 0x7a, 0xfb, 0x02, 0xff, 0xbd, 0x8f, 0x69, + 0x9d, 0xac, 0xae, 0x87, 0x09, 0x4d, 0x52, 0x43, + 0x24, 0x57, 0x6b, 0x99, 0x84, 0x4f, 0x75, 0xe1, +}; +static const size_t TEST_DVPT192_GROUP_5_KEY_LEN = 24; + +static const uint8_t TEST_DVPT192_75_NONCE[] = { + 0x5a, 0x8a, 0xa4, 0x85, 0xc3, 0x16, 0xe9, +}; +static const size_t TEST_DVPT192_75_NONCE_LEN = 7; + +static const uint8_t TEST_DVPT192_75_ADATA[] = { + 0x00, +}; +static const size_t TEST_DVPT192_75_ADATA_LEN = 0; + +static const uint8_t TEST_DVPT192_75_EXPECTED[] = { + 0xcb, 0xa4, 0xb4, 0xae, 0xb8, 0x5f, 0x04, 0x92, + 0xfd, 0x8d, 0x90, 0x5c, 0x4a, 0x6d, 0x82, 0x33, + 0x13, 0x98, 0x33, 0x37, 0x3e, 0xf1, 0x88, 0xa8, + 0xc5, 0xa5, 0xeb, 0xec, 0xf7, 0xac, 0x86, 0x07, + 0xfe, 0x41, 0x21, 0x89, 0xe8, 0x3d, 0x9d, 0x20, +}; +static const size_t TEST_DVPT192_75_EXPECTED_LEN = 40; + +static const uint8_t TEST_DVPT192_75_INPUT[] = { + 0x37, 0x96, 0xcf, 0x51, 0xb8, 0x72, 0x66, 0x52, + 0xa4, 0x20, 0x47, 0x33, 0xb8, 0xfb, 0xb0, 0x47, + 0xcf, 0x00, 0xfb, 0x91, 0xa9, 0x83, 0x7e, 0x22, +}; +static const size_t TEST_DVPT192_75_INPUT_LEN = 24; + +static const uint8_t TEST_DVPT192_79_NONCE[] = { + 0x12, 0x3a, 0x0b, 0xea, 0xce, 0x4e, 0x39, +}; +static const size_t TEST_DVPT192_79_NONCE_LEN = 7; + +static const uint8_t TEST_DVPT192_79_ADATA[] = { + 0x00, +}; +static const size_t TEST_DVPT192_79_ADATA_LEN = 0; + +static const uint8_t TEST_DVPT192_79_EXPECTED[] = { + 0x71, 0xf1, 0x7c, 0xf2, 0x1c, 0x44, 0x26, 0x7c, + 0x67, 0x66, 0x57, 0xdb, 0x9e, 0x55, 0xbe, 0xe3, + 0x32, 0x73, 0x78, 0x74, 0x74, 0xe7, 0x7b, 0x17, + 0xb5, 0xea, 0xb4, 0x5d, 0x7d, 0x09, 0x65, 0x77, + 0x64, 0x38, 0x15, 0xe6, 0xd4, 0x67, 0x31, 0x2d, +}; +static const size_t TEST_DVPT192_79_EXPECTED_LEN = 40; + +static const uint8_t TEST_DVPT192_79_INPUT[] = { + 0x9d, 0x03, 0x3e, 0x3b, 0x66, 0xef, 0xed, 0x14, + 0x67, 0x86, 0x8f, 0x38, 0x24, 0x17, 0xc8, 0x05, + 0x94, 0x87, 0x7a, 0x28, 0xbc, 0x97, 0xf4, 0x06, +}; +static const size_t TEST_DVPT192_79_INPUT_LEN = 24; + +static const uint8_t TEST_DVPT192_86_NONCE[] = { + 0xf6, 0x7b, 0x98, 0xef, 0xd3, 0x9b, 0x55, +}; +static const size_t TEST_DVPT192_86_NONCE_LEN = 7; + +static const uint8_t TEST_DVPT192_86_ADATA[] = { + 0x00, +}; +static const size_t TEST_DVPT192_86_ADATA_LEN = 0; + +static const uint8_t TEST_DVPT192_86_EXPECTED[] = { + 0x44, 0xa6, 0xaa, 0x95, 0x4c, 0x35, 0x08, 0xb3, + 0xc9, 0x26, 0x4c, 0x20, 0xc2, 0x72, 0xe8, 0x0c, + 0x0e, 0x95, 0xd5, 0x0d, 0xde, 0xc2, 0x84, 0x90, + 0x84, 0xb4, 0x75, 0x04, 0xdc, 0xed, 0x5b, 0x70, + 0xc3, 0x02, 0xcc, 0x93, 0x50, 0x2c, 0xc3, 0x7e, +}; +static const size_t TEST_DVPT192_86_EXPECTED_LEN = 40; + +static const uint8_t TEST_DVPT192_86_INPUT[] = { + 0xf2, 0xe9, 0x44, 0xe1, 0xae, 0x47, 0xad, 0x58, + 0x73, 0xbf, 0x39, 0x1f, 0x1b, 0x0c, 0xc0, 0x7f, + 0x61, 0x51, 0xeb, 0x4c, 0x50, 0xbb, 0x45, 0xb2, +}; +static const size_t TEST_DVPT192_86_INPUT_LEN = 24; + +static const uint8_t TEST_DVPT192_87_NONCE[] = { + 0xe6, 0x0e, 0x2c, 0x00, 0x2d, 0x1c, 0x99, +}; +static const size_t TEST_DVPT192_87_NONCE_LEN = 7; + +static const uint8_t TEST_DVPT192_87_ADATA[] = { + 0x00, +}; +static const size_t TEST_DVPT192_87_ADATA_LEN = 0; + +static const uint8_t TEST_DVPT192_87_EXPECTED[] = { + 0x9d, 0x4f, 0xf7, 0xa4, 0x4c, 0xdb, 0x9b, 0x14, + 0xf5, 0x86, 0xef, 0xc3, 0xd6, 0xbe, 0x02, 0xd0, + 0x69, 0xb4, 0x25, 0xc0, 0x6b, 0xec, 0x4e, 0xed, + 0x37, 0x10, 0x97, 0x39, 0xa3, 0x67, 0x6f, 0x03, + 0xad, 0xfd, 0x74, 0x0d, 0xba, 0xa4, 0x94, 0x0d, +}; +static const size_t TEST_DVPT192_87_EXPECTED_LEN = 40; + +static const uint8_t TEST_DVPT192_87_INPUT[] = { + 0x70, 0xf4, 0x8d, 0xc1, 0xd7, 0x6e, 0x50, 0x28, + 0xda, 0x07, 0xe2, 0x98, 0x52, 0x80, 0x13, 0x75, + 0xa9, 0xed, 0xb2, 0x21, 0x4a, 0x5e, 0xa4, 0xc0, +}; +static const size_t TEST_DVPT192_87_INPUT_LEN = 24; + +static const uint8_t TEST_DVPT192_88_NONCE[] = { + 0x09, 0x8e, 0x05, 0x3f, 0xa0, 0x80, 0x43, +}; +static const size_t TEST_DVPT192_88_NONCE_LEN = 7; + +static const uint8_t TEST_DVPT192_88_ADATA[] = { + 0x00, +}; +static const size_t TEST_DVPT192_88_ADATA_LEN = 0; + +static const uint8_t TEST_DVPT192_88_EXPECTED[] = { + 0x23, 0xda, 0x95, 0xe1, 0x02, 0xc7, 0x92, 0x1a, + 0x51, 0xb1, 0x9b, 0x57, 0x33, 0xea, 0x57, 0x76, + 0xab, 0x6c, 0x28, 0x7f, 0x60, 0x57, 0xc0, 0x0e, + 0xc4, 0xbf, 0xac, 0xbb, 0x2f, 0x24, 0x6b, 0x57, + 0x0e, 0xfd, 0x93, 0xd9, 0x8e, 0x99, 0xbe, 0x49, +}; +static const size_t TEST_DVPT192_88_EXPECTED_LEN = 40; + +static const uint8_t TEST_DVPT192_88_INPUT[] = { + 0xbd, 0x81, 0x68, 0x0e, 0x3d, 0xc0, 0xb3, 0x54, + 0x31, 0xc9, 0x25, 0x98, 0xdc, 0xaa, 0x26, 0xef, + 0x09, 0xca, 0x0d, 0xa5, 0xe7, 0x71, 0x93, 0xde, +}; +static const size_t TEST_DVPT192_88_INPUT_LEN = 24; + +/* Alen = 0, Plen = 24, Nlen = 13, Tlen = 4 */ +static const uint8_t TEST_DVPT192_GROUP_6_MAC_LEN = 4; + +static const uint8_t TEST_DVPT192_GROUP_6_KEY[] = { + 0x19, 0x7a, 0xfb, 0x02, 0xff, 0xbd, 0x8f, 0x69, + 0x9d, 0xac, 0xae, 0x87, 0x09, 0x4d, 0x52, 0x43, + 0x24, 0x57, 0x6b, 0x99, 0x84, 0x4f, 0x75, 0xe1, +}; +static const size_t TEST_DVPT192_GROUP_6_KEY_LEN = 24; + +static const uint8_t TEST_DVPT192_90_NONCE[] = { + 0x5a, 0x8a, 0xa4, 0x85, 0xc3, 0x16, 0xe9, 0x40, + 0x3a, 0xff, 0x85, 0x9f, 0xbb, +}; +static const size_t TEST_DVPT192_90_NONCE_LEN = 13; + +static const uint8_t TEST_DVPT192_90_ADATA[] = { + 0x00, +}; +static const size_t TEST_DVPT192_90_ADATA_LEN = 0; + +static const uint8_t TEST_DVPT192_90_EXPECTED[] = { + 0x04, 0x26, 0x53, 0xc6, 0x74, 0xef, 0x2a, 0x90, + 0xf7, 0xfb, 0x11, 0xd3, 0x08, 0x48, 0xe5, 0x30, + 0xae, 0x59, 0x47, 0x8f, 0x10, 0x51, 0x63, 0x3a, + 0x34, 0xfa, 0xd2, 0x77, +}; +static const size_t TEST_DVPT192_90_EXPECTED_LEN = 28; + +static const uint8_t TEST_DVPT192_90_INPUT[] = { + 0xa1, 0x6a, 0x2e, 0x74, 0x1f, 0x1c, 0xd9, 0x71, + 0x72, 0x85, 0xb6, 0xd8, 0x82, 0xc1, 0xfc, 0x53, + 0x65, 0x5e, 0x97, 0x73, 0x76, 0x1a, 0xd6, 0x97, +}; +static const size_t TEST_DVPT192_90_INPUT_LEN = 24; + +static const uint8_t TEST_DVPT192_94_NONCE[] = { + 0x24, 0xb7, 0xa6, 0x53, 0x91, 0xf8, 0x8b, 0xea, + 0x38, 0xfc, 0xd5, 0x4a, 0x9a, +}; +static const size_t TEST_DVPT192_94_NONCE_LEN = 13; + +static const uint8_t TEST_DVPT192_94_ADATA[] = { + 0x00, +}; +static const size_t TEST_DVPT192_94_ADATA_LEN = 0; + +static const uint8_t TEST_DVPT192_94_EXPECTED[] = { + 0x3c, 0x18, 0x36, 0xe5, 0xd0, 0xf0, 0x47, 0x3d, + 0xab, 0x7b, 0xfd, 0x7a, 0x95, 0xba, 0x69, 0x57, + 0x5f, 0x7f, 0x84, 0x19, 0x70, 0xac, 0x6c, 0x67, + 0x69, 0xac, 0x96, 0x6a, +}; +static const size_t TEST_DVPT192_94_EXPECTED_LEN = 28; + +static const uint8_t TEST_DVPT192_94_INPUT[] = { + 0x43, 0x41, 0x97, 0x15, 0xce, 0xf9, 0xa4, 0x8d, + 0xc7, 0x28, 0x0b, 0xc0, 0x35, 0x08, 0x2a, 0x65, + 0x81, 0xaf, 0xd1, 0xd8, 0x2b, 0xee, 0x9d, 0x1a, +}; +static const size_t TEST_DVPT192_94_INPUT_LEN = 24; + +static const uint8_t TEST_DVPT192_101_NONCE[] = { + 0xc4, 0x7a, 0xf8, 0x0c, 0xd2, 0x6d, 0x04, 0x76, + 0x30, 0xc1, 0xfd, 0xf0, 0xd1, +}; +static const size_t TEST_DVPT192_101_NONCE_LEN = 13; + +static const uint8_t TEST_DVPT192_101_ADATA[] = { + 0x00, +}; +static const size_t TEST_DVPT192_101_ADATA_LEN = 0; + +static const uint8_t TEST_DVPT192_101_EXPECTED[] = { + 0x34, 0x1d, 0xf3, 0xa2, 0x73, 0xe8, 0x5c, 0xf3, + 0x87, 0xab, 0x82, 0x3b, 0xdf, 0x9c, 0x34, 0xa1, + 0xae, 0x2c, 0x86, 0x94, 0x0c, 0xb4, 0xbf, 0xcd, + 0xe2, 0xe9, 0x3f, 0x29, +}; +static const size_t TEST_DVPT192_101_EXPECTED_LEN = 28; + +static const uint8_t TEST_DVPT192_101_INPUT[] = { + 0xd8, 0x30, 0x6c, 0x9c, 0x4e, 0xa6, 0xc6, 0x9c, + 0x6e, 0x2a, 0xd0, 0xfc, 0x0e, 0x49, 0xb1, 0xe0, + 0x12, 0x6b, 0x01, 0x07, 0x8d, 0x64, 0x19, 0xff, +}; +static const size_t TEST_DVPT192_101_INPUT_LEN = 24; + +static const uint8_t TEST_DVPT192_102_NONCE[] = { + 0x70, 0xe1, 0x32, 0x02, 0x3a, 0xca, 0xe1, 0xf8, + 0x8c, 0x7a, 0x23, 0x7b, 0x68, +}; +static const size_t TEST_DVPT192_102_NONCE_LEN = 13; + +static const uint8_t TEST_DVPT192_102_ADATA[] = { + 0x00, +}; +static const size_t TEST_DVPT192_102_ADATA_LEN = 0; + +static const uint8_t TEST_DVPT192_102_EXPECTED[] = { + 0xa0, 0xe7, 0x99, 0x7f, 0xd6, 0x7e, 0xa6, 0x6b, + 0x62, 0x74, 0xd7, 0x19, 0xb8, 0x4d, 0xa9, 0x24, + 0x33, 0xfd, 0xf7, 0xd5, 0x12, 0xb1, 0x60, 0xda, + 0x35, 0xc7, 0x08, 0x1d, +}; +static const size_t TEST_DVPT192_102_EXPECTED_LEN = 28; + +static const uint8_t TEST_DVPT192_102_INPUT[] = { + 0xd0, 0xb2, 0xbe, 0xf5, 0xed, 0x1a, 0x87, 0xd9, + 0xc7, 0x3d, 0x4a, 0x45, 0x9c, 0xb0, 0x5c, 0x11, + 0x79, 0x9c, 0x4f, 0x51, 0xad, 0x64, 0x0b, 0x1e, +}; +static const size_t TEST_DVPT192_102_INPUT_LEN = 24; + +static const uint8_t TEST_DVPT192_103_NONCE[] = { + 0x80, 0x10, 0xd3, 0xa2, 0xa1, 0x4f, 0x72, 0xf5, + 0x58, 0x5d, 0xef, 0xc9, 0x40, +}; +static const size_t TEST_DVPT192_103_NONCE_LEN = 13; + +static const uint8_t TEST_DVPT192_103_ADATA[] = { + 0x00, +}; +static const size_t TEST_DVPT192_103_ADATA_LEN = 0; + +static const uint8_t TEST_DVPT192_103_EXPECTED[] = { + 0xdd, 0x8f, 0xd1, 0x1e, 0x1c, 0x07, 0x46, 0xe7, + 0x27, 0x3f, 0xdd, 0x2e, 0x7d, 0xfa, 0x1e, 0xe4, + 0xfc, 0x8a, 0xd8, 0x35, 0xca, 0x31, 0x41, 0xc0, + 0xf8, 0x3a, 0x9a, 0xd7, +}; +static const size_t TEST_DVPT192_103_EXPECTED_LEN = 28; + +static const uint8_t TEST_DVPT192_103_INPUT[] = { + 0x4f, 0xab, 0xa0, 0x55, 0x69, 0xbf, 0x7a, 0xc6, + 0x56, 0x78, 0x0c, 0x16, 0x99, 0x5e, 0x91, 0x22, + 0xe5, 0x65, 0xfe, 0x99, 0x84, 0xbe, 0x8a, 0x68, +}; +static const size_t TEST_DVPT192_103_INPUT_LEN = 24; + +/* Alen = 0, Plen = 24, Nlen = 13, Tlen = 16 */ +static const uint8_t TEST_DVPT192_GROUP_7_MAC_LEN = 16; + +static const uint8_t TEST_DVPT192_GROUP_7_KEY[] = { + 0x90, 0x92, 0x9a, 0x4b, 0x0a, 0xc6, 0x5b, 0x35, + 0x0a, 0xd1, 0x59, 0x16, 0x11, 0xfe, 0x48, 0x29, + 0x7e, 0x03, 0x95, 0x6f, 0x60, 0x83, 0xe4, 0x51, +}; +static const size_t TEST_DVPT192_GROUP_7_KEY_LEN = 24; + +static const uint8_t TEST_DVPT192_105_NONCE[] = { + 0x5a, 0x8a, 0xa4, 0x85, 0xc3, 0x16, 0xe9, 0x40, + 0x3a, 0xff, 0x85, 0x9f, 0xbb, +}; +static const size_t TEST_DVPT192_105_NONCE_LEN = 13; + +static const uint8_t TEST_DVPT192_105_ADATA[] = { + 0x00, +}; +static const size_t TEST_DVPT192_105_ADATA_LEN = 0; + +static const uint8_t TEST_DVPT192_105_EXPECTED[] = { + 0xa5, 0xb7, 0xd8, 0xcc, 0xa2, 0x06, 0x99, 0x08, + 0xd1, 0xed, 0x88, 0xe6, 0xa9, 0xfe, 0x2c, 0x9b, + 0xed, 0xe3, 0x13, 0x1d, 0xad, 0x54, 0x67, 0x1e, + 0xa7, 0xad, 0xe3, 0x0a, 0x07, 0xd1, 0x85, 0x69, + 0x2a, 0xb0, 0xeb, 0xdf, 0x4c, 0x78, 0xcf, 0x7a, +}; +static const size_t TEST_DVPT192_105_EXPECTED_LEN = 40; + +static const uint8_t TEST_DVPT192_105_INPUT[] = { + 0xa1, 0x6a, 0x2e, 0x74, 0x1f, 0x1c, 0xd9, 0x71, + 0x72, 0x85, 0xb6, 0xd8, 0x82, 0xc1, 0xfc, 0x53, + 0x65, 0x5e, 0x97, 0x73, 0x76, 0x1a, 0xd6, 0x97, +}; +static const size_t TEST_DVPT192_105_INPUT_LEN = 24; + +static const uint8_t TEST_DVPT192_109_NONCE[] = { + 0x24, 0xb7, 0xa6, 0x53, 0x91, 0xf8, 0x8b, 0xea, + 0x38, 0xfc, 0xd5, 0x4a, 0x9a, +}; +static const size_t TEST_DVPT192_109_NONCE_LEN = 13; + +static const uint8_t TEST_DVPT192_109_ADATA[] = { + 0x00, +}; +static const size_t TEST_DVPT192_109_ADATA_LEN = 0; + +static const uint8_t TEST_DVPT192_109_EXPECTED[] = { + 0x71, 0xf6, 0x84, 0x80, 0xa8, 0x80, 0x1d, 0x49, + 0x66, 0xc8, 0x48, 0x07, 0xc5, 0xff, 0x61, 0x39, + 0xd8, 0x3b, 0xa0, 0xa5, 0xb9, 0x02, 0xbe, 0xe3, + 0x32, 0x7f, 0x5f, 0x91, 0x76, 0x3c, 0x0a, 0x0b, + 0xec, 0x43, 0x26, 0x4c, 0x27, 0xcd, 0x23, 0x7f, +}; +static const size_t TEST_DVPT192_109_EXPECTED_LEN = 40; + +static const uint8_t TEST_DVPT192_109_INPUT[] = { + 0x43, 0x41, 0x97, 0x15, 0xce, 0xf9, 0xa4, 0x8d, + 0xc7, 0x28, 0x0b, 0xc0, 0x35, 0x08, 0x2a, 0x65, + 0x81, 0xaf, 0xd1, 0xd8, 0x2b, 0xee, 0x9d, 0x1a, +}; +static const size_t TEST_DVPT192_109_INPUT_LEN = 24; + +static const uint8_t TEST_DVPT192_116_NONCE[] = { + 0xc4, 0x7a, 0xf8, 0x0c, 0xd2, 0x6d, 0x04, 0x76, + 0x30, 0xc1, 0xfd, 0xf0, 0xd1, +}; +static const size_t TEST_DVPT192_116_NONCE_LEN = 13; + +static const uint8_t TEST_DVPT192_116_ADATA[] = { + 0x00, +}; +static const size_t TEST_DVPT192_116_ADATA_LEN = 0; + +static const uint8_t TEST_DVPT192_116_EXPECTED[] = { + 0x5b, 0x0b, 0x5e, 0x66, 0x90, 0xd6, 0x48, 0xe1, + 0xb9, 0x2c, 0x12, 0xcf, 0xdd, 0xb4, 0x31, 0xd6, + 0xd3, 0xdf, 0xe6, 0x89, 0xd0, 0x1d, 0xb8, 0x19, + 0x92, 0x56, 0xac, 0xe4, 0x90, 0xc2, 0xf0, 0xaf, + 0xb9, 0x3b, 0xa3, 0x2b, 0xe5, 0x8f, 0xd1, 0xde, +}; +static const size_t TEST_DVPT192_116_EXPECTED_LEN = 40; + +static const uint8_t TEST_DVPT192_116_INPUT[] = { + 0xd8, 0x30, 0x6c, 0x9c, 0x4e, 0xa6, 0xc6, 0x9c, + 0x6e, 0x2a, 0xd0, 0xfc, 0x0e, 0x49, 0xb1, 0xe0, + 0x12, 0x6b, 0x01, 0x07, 0x8d, 0x64, 0x19, 0xff, +}; +static const size_t TEST_DVPT192_116_INPUT_LEN = 24; + +static const uint8_t TEST_DVPT192_117_NONCE[] = { + 0x70, 0xe1, 0x32, 0x02, 0x3a, 0xca, 0xe1, 0xf8, + 0x8c, 0x7a, 0x23, 0x7b, 0x68, +}; +static const size_t TEST_DVPT192_117_NONCE_LEN = 13; + +static const uint8_t TEST_DVPT192_117_ADATA[] = { + 0x00, +}; +static const size_t TEST_DVPT192_117_ADATA_LEN = 0; + +static const uint8_t TEST_DVPT192_117_EXPECTED[] = { + 0x87, 0x22, 0xfc, 0xa7, 0x1f, 0xdf, 0x75, 0x0e, + 0xc5, 0xd6, 0x2f, 0xc6, 0xd7, 0xba, 0x07, 0x9a, + 0xef, 0x19, 0x21, 0x0d, 0xa7, 0x64, 0x06, 0x7a, + 0xef, 0xd8, 0x53, 0x5d, 0xd6, 0xb7, 0xfa, 0x70, + 0x1c, 0x9c, 0xa8, 0xc8, 0xb6, 0x35, 0xc3, 0x0b, +}; +static const size_t TEST_DVPT192_117_EXPECTED_LEN = 40; + +static const uint8_t TEST_DVPT192_117_INPUT[] = { + 0xd0, 0xb2, 0xbe, 0xf5, 0xed, 0x1a, 0x87, 0xd9, + 0xc7, 0x3d, 0x4a, 0x45, 0x9c, 0xb0, 0x5c, 0x11, + 0x79, 0x9c, 0x4f, 0x51, 0xad, 0x64, 0x0b, 0x1e, +}; +static const size_t TEST_DVPT192_117_INPUT_LEN = 24; + +static const uint8_t TEST_DVPT192_118_NONCE[] = { + 0x80, 0x10, 0xd3, 0xa2, 0xa1, 0x4f, 0x72, 0xf5, + 0x58, 0x5d, 0xef, 0xc9, 0x40, +}; +static const size_t TEST_DVPT192_118_NONCE_LEN = 13; + +static const uint8_t TEST_DVPT192_118_ADATA[] = { + 0x00, +}; +static const size_t TEST_DVPT192_118_ADATA_LEN = 0; + +static const uint8_t TEST_DVPT192_118_EXPECTED[] = { + 0x91, 0xac, 0x45, 0x7f, 0x5e, 0x53, 0x49, 0x23, + 0x01, 0xe7, 0x2d, 0x9d, 0x49, 0x52, 0x77, 0xed, + 0x17, 0xed, 0xb3, 0x0e, 0x8c, 0x7a, 0x48, 0xd2, + 0x1b, 0x5d, 0x2c, 0xd4, 0xd5, 0xb6, 0xd2, 0xef, + 0x48, 0x41, 0x32, 0x45, 0xa6, 0xb2, 0x7b, 0x67, +}; +static const size_t TEST_DVPT192_118_EXPECTED_LEN = 40; + +static const uint8_t TEST_DVPT192_118_INPUT[] = { + 0x4f, 0xab, 0xa0, 0x55, 0x69, 0xbf, 0x7a, 0xc6, + 0x56, 0x78, 0x0c, 0x16, 0x99, 0x5e, 0x91, 0x22, + 0xe5, 0x65, 0xfe, 0x99, 0x84, 0xbe, 0x8a, 0x68, +}; +static const size_t TEST_DVPT192_118_INPUT_LEN = 24; + +/* Alen = 32, Plen = 0, Nlen = 7, Tlen = 4 */ +static const uint8_t TEST_DVPT192_GROUP_8_MAC_LEN = 4; + +static const uint8_t TEST_DVPT192_GROUP_8_KEY[] = { + 0x90, 0x92, 0x9a, 0x4b, 0x0a, 0xc6, 0x5b, 0x35, + 0x0a, 0xd1, 0x59, 0x16, 0x11, 0xfe, 0x48, 0x29, + 0x7e, 0x03, 0x95, 0x6f, 0x60, 0x83, 0xe4, 0x51, +}; +static const size_t TEST_DVPT192_GROUP_8_KEY_LEN = 24; + +static const uint8_t TEST_DVPT192_120_NONCE[] = { + 0x5a, 0x8a, 0xa4, 0x85, 0xc3, 0x16, 0xe9, +}; +static const size_t TEST_DVPT192_120_NONCE_LEN = 7; + +static const uint8_t TEST_DVPT192_120_ADATA[] = { + 0x37, 0x96, 0xcf, 0x51, 0xb8, 0x72, 0x66, 0x52, + 0xa4, 0x20, 0x47, 0x33, 0xb8, 0xfb, 0xb0, 0x47, + 0xcf, 0x00, 0xfb, 0x91, 0xa9, 0x83, 0x7e, 0x22, + 0xec, 0x22, 0xb1, 0xa2, 0x68, 0xf8, 0x8e, 0x2c, +}; +static const size_t TEST_DVPT192_120_ADATA_LEN = 32; + +static const uint8_t TEST_DVPT192_120_EXPECTED[] = { + 0x1d, 0x08, 0x9a, 0x5f, +}; +static const size_t TEST_DVPT192_120_EXPECTED_LEN = 4; + +static const uint8_t TEST_DVPT192_120_INPUT[] = { + 0x00, +}; +static const size_t TEST_DVPT192_120_INPUT_LEN = 0; + +static const uint8_t TEST_DVPT192_124_NONCE[] = { + 0x8c, 0x68, 0x7b, 0x43, 0x18, 0x81, 0x3a, +}; +static const size_t TEST_DVPT192_124_NONCE_LEN = 7; + +static const uint8_t TEST_DVPT192_124_ADATA[] = { + 0xfc, 0xad, 0x52, 0xa8, 0x85, 0x44, 0x32, 0x5b, + 0xb3, 0x1e, 0xb5, 0xde, 0x4a, 0x41, 0xdb, 0xff, + 0x6a, 0x96, 0xf6, 0x9d, 0x09, 0x93, 0xb9, 0x69, + 0xa0, 0x17, 0x92, 0xee, 0x23, 0x95, 0x3a, 0xcf, +}; +static const size_t TEST_DVPT192_124_ADATA_LEN = 32; + +static const uint8_t TEST_DVPT192_124_EXPECTED[] = { + 0x5c, 0x6a, 0x4d, 0xe2, +}; +static const size_t TEST_DVPT192_124_EXPECTED_LEN = 4; + +static const uint8_t TEST_DVPT192_124_INPUT[] = { + 0x00, +}; +static const size_t TEST_DVPT192_124_INPUT_LEN = 0; + +static const uint8_t TEST_DVPT192_131_NONCE[] = { + 0xa1, 0xae, 0xda, 0x4b, 0x4c, 0xb8, 0xdd, +}; +static const size_t TEST_DVPT192_131_NONCE_LEN = 7; + +static const uint8_t TEST_DVPT192_131_ADATA[] = { + 0xdb, 0x30, 0x22, 0xef, 0x4c, 0xd6, 0x8a, 0xe2, + 0x2b, 0x50, 0x15, 0x99, 0x44, 0x8f, 0xfe, 0x2d, + 0xda, 0x15, 0xcf, 0xd2, 0xe2, 0x59, 0x31, 0x5c, + 0x6f, 0x6d, 0x03, 0x03, 0x6e, 0xde, 0xa9, 0x63, +}; +static const size_t TEST_DVPT192_131_ADATA_LEN = 32; + +static const uint8_t TEST_DVPT192_131_EXPECTED[] = { + 0x58, 0x14, 0x10, 0x3a, +}; +static const size_t TEST_DVPT192_131_EXPECTED_LEN = 4; + +static const uint8_t TEST_DVPT192_131_INPUT[] = { + 0x00, +}; +static const size_t TEST_DVPT192_131_INPUT_LEN = 0; + +static const uint8_t TEST_DVPT192_132_NONCE[] = { + 0xf2, 0x48, 0xe5, 0x22, 0x5e, 0x3d, 0x9a, +}; +static const size_t TEST_DVPT192_132_NONCE_LEN = 7; + +static const uint8_t TEST_DVPT192_132_ADATA[] = { + 0xfd, 0xc6, 0x4e, 0xf7, 0x6a, 0x3b, 0xfd, 0x0a, + 0x15, 0xd0, 0xbc, 0x8e, 0x8b, 0xac, 0xaf, 0x64, + 0x34, 0x67, 0x96, 0xa3, 0xe3, 0x5a, 0xfc, 0xf2, + 0xac, 0x1a, 0xb1, 0x36, 0xf6, 0x3f, 0x7b, 0x6e, +}; +static const size_t TEST_DVPT192_132_ADATA_LEN = 32; + +static const uint8_t TEST_DVPT192_132_EXPECTED[] = { + 0x74, 0xc7, 0x5c, 0x4a, +}; +static const size_t TEST_DVPT192_132_EXPECTED_LEN = 4; + +static const uint8_t TEST_DVPT192_132_INPUT[] = { + 0x00, +}; +static const size_t TEST_DVPT192_132_INPUT_LEN = 0; + +static const uint8_t TEST_DVPT192_133_NONCE[] = { + 0xe6, 0x82, 0x28, 0xf5, 0xc6, 0x5b, 0x73, +}; +static const size_t TEST_DVPT192_133_NONCE_LEN = 7; + +static const uint8_t TEST_DVPT192_133_ADATA[] = { + 0x61, 0x4e, 0xfd, 0xf8, 0x9c, 0xe2, 0xa9, 0xfc, + 0xbd, 0x38, 0xbd, 0xc0, 0xb4, 0xce, 0xce, 0x54, + 0xdf, 0xd7, 0x53, 0x28, 0x80, 0xe0, 0xb4, 0xce, + 0x6e, 0xb3, 0xa4, 0x01, 0x0b, 0x7c, 0xb1, 0xe7, +}; +static const size_t TEST_DVPT192_133_ADATA_LEN = 32; + +static const uint8_t TEST_DVPT192_133_EXPECTED[] = { + 0x98, 0x84, 0x89, 0x8b, +}; +static const size_t TEST_DVPT192_133_EXPECTED_LEN = 4; + +static const uint8_t TEST_DVPT192_133_INPUT[] = { + 0x00, +}; +static const size_t TEST_DVPT192_133_INPUT_LEN = 0; + +/* Alen = 32, Plen = 0, Nlen = 7, Tlen = 16 */ +static const uint8_t TEST_DVPT192_GROUP_9_MAC_LEN = 16; + +static const uint8_t TEST_DVPT192_GROUP_9_KEY[] = { + 0x6a, 0x79, 0x8d, 0x7c, 0x5e, 0x1a, 0x72, 0xb4, + 0x3e, 0x20, 0xad, 0x5c, 0x7b, 0x08, 0x56, 0x7b, + 0x12, 0xab, 0x74, 0x4b, 0x61, 0xc0, 0x70, 0xe2, +}; +static const size_t TEST_DVPT192_GROUP_9_KEY_LEN = 24; + +static const uint8_t TEST_DVPT192_135_NONCE[] = { + 0x5a, 0x8a, 0xa4, 0x85, 0xc3, 0x16, 0xe9, +}; +static const size_t TEST_DVPT192_135_NONCE_LEN = 7; + +static const uint8_t TEST_DVPT192_135_ADATA[] = { + 0x37, 0x96, 0xcf, 0x51, 0xb8, 0x72, 0x66, 0x52, + 0xa4, 0x20, 0x47, 0x33, 0xb8, 0xfb, 0xb0, 0x47, + 0xcf, 0x00, 0xfb, 0x91, 0xa9, 0x83, 0x7e, 0x22, + 0xec, 0x22, 0xb1, 0xa2, 0x68, 0xf8, 0x8e, 0x2c, +}; +static const size_t TEST_DVPT192_135_ADATA_LEN = 32; + +static const uint8_t TEST_DVPT192_135_EXPECTED[] = { + 0x52, 0x80, 0xa2, 0x13, 0x7f, 0xee, 0x3d, 0xee, + 0xfc, 0xfe, 0x9b, 0x63, 0xa1, 0x19, 0x9f, 0xb3, +}; +static const size_t TEST_DVPT192_135_EXPECTED_LEN = 16; + +static const uint8_t TEST_DVPT192_135_INPUT[] = { + 0x00, +}; +static const size_t TEST_DVPT192_135_INPUT_LEN = 0; + +static const uint8_t TEST_DVPT192_139_NONCE[] = { + 0x8c, 0x68, 0x7b, 0x43, 0x18, 0x81, 0x3a, +}; +static const size_t TEST_DVPT192_139_NONCE_LEN = 7; + +static const uint8_t TEST_DVPT192_139_ADATA[] = { + 0xfc, 0xad, 0x52, 0xa8, 0x85, 0x44, 0x32, 0x5b, + 0xb3, 0x1e, 0xb5, 0xde, 0x4a, 0x41, 0xdb, 0xff, + 0x6a, 0x96, 0xf6, 0x9d, 0x09, 0x93, 0xb9, 0x69, + 0xa0, 0x17, 0x92, 0xee, 0x23, 0x95, 0x3a, 0xcf, +}; +static const size_t TEST_DVPT192_139_ADATA_LEN = 32; + +static const uint8_t TEST_DVPT192_139_EXPECTED[] = { + 0x29, 0xe9, 0x67, 0xa0, 0x24, 0x56, 0x07, 0xc3, + 0x6c, 0xf3, 0xea, 0xf0, 0x0f, 0xda, 0xe5, 0x66, +}; +static const size_t TEST_DVPT192_139_EXPECTED_LEN = 16; + +static const uint8_t TEST_DVPT192_139_INPUT[] = { + 0x00, +}; +static const size_t TEST_DVPT192_139_INPUT_LEN = 0; + +static const uint8_t TEST_DVPT192_146_NONCE[] = { + 0xa1, 0xae, 0xda, 0x4b, 0x4c, 0xb8, 0xdd, +}; +static const size_t TEST_DVPT192_146_NONCE_LEN = 7; + +static const uint8_t TEST_DVPT192_146_ADATA[] = { + 0xdb, 0x30, 0x22, 0xef, 0x4c, 0xd6, 0x8a, 0xe2, + 0x2b, 0x50, 0x15, 0x99, 0x44, 0x8f, 0xfe, 0x2d, + 0xda, 0x15, 0xcf, 0xd2, 0xe2, 0x59, 0x31, 0x5c, + 0x6f, 0x6d, 0x03, 0x03, 0x6e, 0xde, 0xa9, 0x63, +}; +static const size_t TEST_DVPT192_146_ADATA_LEN = 32; + +static const uint8_t TEST_DVPT192_146_EXPECTED[] = { + 0x70, 0xa0, 0x9a, 0xaf, 0x22, 0xac, 0x31, 0x61, + 0x24, 0xa1, 0x69, 0xf6, 0xb0, 0xa8, 0x3f, 0xfe, +}; +static const size_t TEST_DVPT192_146_EXPECTED_LEN = 16; + +static const uint8_t TEST_DVPT192_146_INPUT[] = { + 0x00, +}; +static const size_t TEST_DVPT192_146_INPUT_LEN = 0; + +static const uint8_t TEST_DVPT192_147_NONCE[] = { + 0xf2, 0x48, 0xe5, 0x22, 0x5e, 0x3d, 0x9a, +}; +static const size_t TEST_DVPT192_147_NONCE_LEN = 7; + +static const uint8_t TEST_DVPT192_147_ADATA[] = { + 0xfd, 0xc6, 0x4e, 0xf7, 0x6a, 0x3b, 0xfd, 0x0a, + 0x15, 0xd0, 0xbc, 0x8e, 0x8b, 0xac, 0xaf, 0x64, + 0x34, 0x67, 0x96, 0xa3, 0xe3, 0x5a, 0xfc, 0xf2, + 0xac, 0x1a, 0xb1, 0x36, 0xf6, 0x3f, 0x7b, 0x6e, +}; +static const size_t TEST_DVPT192_147_ADATA_LEN = 32; + +static const uint8_t TEST_DVPT192_147_EXPECTED[] = { + 0x5b, 0xc8, 0x5e, 0xd5, 0x52, 0x1a, 0x91, 0xb9, + 0xeb, 0x42, 0xb4, 0x37, 0x95, 0x0f, 0x0e, 0x06, +}; +static const size_t TEST_DVPT192_147_EXPECTED_LEN = 16; + +static const uint8_t TEST_DVPT192_147_INPUT[] = { + 0x00, +}; +static const size_t TEST_DVPT192_147_INPUT_LEN = 0; + +static const uint8_t TEST_DVPT192_148_NONCE[] = { + 0xe6, 0x82, 0x28, 0xf5, 0xc6, 0x5b, 0x73, +}; +static const size_t TEST_DVPT192_148_NONCE_LEN = 7; + +static const uint8_t TEST_DVPT192_148_ADATA[] = { + 0x61, 0x4e, 0xfd, 0xf8, 0x9c, 0xe2, 0xa9, 0xfc, + 0xbd, 0x38, 0xbd, 0xc0, 0xb4, 0xce, 0xce, 0x54, + 0xdf, 0xd7, 0x53, 0x28, 0x80, 0xe0, 0xb4, 0xce, + 0x6e, 0xb3, 0xa4, 0x01, 0x0b, 0x7c, 0xb1, 0xe7, +}; +static const size_t TEST_DVPT192_148_ADATA_LEN = 32; + +static const uint8_t TEST_DVPT192_148_EXPECTED[] = { + 0x98, 0x9e, 0xc0, 0xe7, 0xb1, 0x92, 0xea, 0x01, + 0x0d, 0xd6, 0x1d, 0x3f, 0xb6, 0x4e, 0x8d, 0xe0, +}; +static const size_t TEST_DVPT192_148_EXPECTED_LEN = 16; + +static const uint8_t TEST_DVPT192_148_INPUT[] = { + 0x00, +}; +static const size_t TEST_DVPT192_148_INPUT_LEN = 0; + +/* Alen = 32, Plen = 0, Nlen = 13, Tlen = 4 */ +static const uint8_t TEST_DVPT192_GROUP_10_MAC_LEN = 4; + +static const uint8_t TEST_DVPT192_GROUP_10_KEY[] = { + 0x6a, 0x79, 0x8d, 0x7c, 0x5e, 0x1a, 0x72, 0xb4, + 0x3e, 0x20, 0xad, 0x5c, 0x7b, 0x08, 0x56, 0x7b, + 0x12, 0xab, 0x74, 0x4b, 0x61, 0xc0, 0x70, 0xe2, +}; +static const size_t TEST_DVPT192_GROUP_10_KEY_LEN = 24; + +static const uint8_t TEST_DVPT192_150_NONCE[] = { + 0x5a, 0x8a, 0xa4, 0x85, 0xc3, 0x16, 0xe9, 0x40, + 0x3a, 0xff, 0x85, 0x9f, 0xbb, +}; +static const size_t TEST_DVPT192_150_NONCE_LEN = 13; + +static const uint8_t TEST_DVPT192_150_ADATA[] = { + 0xa1, 0x6a, 0x2e, 0x74, 0x1f, 0x1c, 0xd9, 0x71, + 0x72, 0x85, 0xb6, 0xd8, 0x82, 0xc1, 0xfc, 0x53, + 0x65, 0x5e, 0x97, 0x73, 0x76, 0x1a, 0xd6, 0x97, + 0xa7, 0xee, 0x64, 0x10, 0x18, 0x4c, 0x79, 0x82, +}; +static const size_t TEST_DVPT192_150_ADATA_LEN = 32; + +static const uint8_t TEST_DVPT192_150_EXPECTED[] = { + 0x5e, 0x0e, 0xae, 0xbd, +}; +static const size_t TEST_DVPT192_150_EXPECTED_LEN = 4; + +static const uint8_t TEST_DVPT192_150_INPUT[] = { + 0x00, +}; +static const size_t TEST_DVPT192_150_INPUT_LEN = 0; + +static const uint8_t TEST_DVPT192_154_NONCE[] = { + 0x1e, 0x7e, 0x51, 0xf0, 0xfa, 0x9a, 0x33, 0xed, + 0x61, 0x8c, 0x26, 0xf5, 0xe3, +}; +static const size_t TEST_DVPT192_154_NONCE_LEN = 13; + +static const uint8_t TEST_DVPT192_154_ADATA[] = { + 0xda, 0x9b, 0x8f, 0xfb, 0x0f, 0x3c, 0x2a, 0xee, + 0x2e, 0x38, 0x6c, 0xc9, 0xf0, 0x35, 0xec, 0x1e, + 0xb3, 0xe6, 0x29, 0xbd, 0x15, 0x44, 0xc1, 0x1d, + 0xc2, 0x1b, 0xe4, 0xfd, 0x8a, 0xc9, 0x07, 0x4a, +}; +static const size_t TEST_DVPT192_154_ADATA_LEN = 32; + +static const uint8_t TEST_DVPT192_154_EXPECTED[] = { + 0xbf, 0x7a, 0x8e, 0x0c, +}; +static const size_t TEST_DVPT192_154_EXPECTED_LEN = 4; + +static const uint8_t TEST_DVPT192_154_INPUT[] = { + 0x00, +}; +static const size_t TEST_DVPT192_154_INPUT_LEN = 0; + +static const uint8_t TEST_DVPT192_161_NONCE[] = { + 0x78, 0x64, 0xc7, 0x17, 0xec, 0x93, 0xdb, 0x38, + 0xb1, 0x06, 0x79, 0xbe, 0x47, +}; +static const size_t TEST_DVPT192_161_NONCE_LEN = 13; + +static const uint8_t TEST_DVPT192_161_ADATA[] = { + 0x67, 0x9a, 0xad, 0x1a, 0xd1, 0xe5, 0x70, 0x29, + 0xe3, 0x36, 0x2b, 0x32, 0x55, 0x72, 0xfc, 0x71, + 0xca, 0xc5, 0x31, 0x84, 0xb0, 0xf1, 0x54, 0x68, + 0x67, 0xe6, 0x65, 0xa4, 0xa5, 0x94, 0x66, 0xc4, +}; +static const size_t TEST_DVPT192_161_ADATA_LEN = 32; + +static const uint8_t TEST_DVPT192_161_EXPECTED[] = { + 0xdf, 0x7f, 0x63, 0xca, +}; +static const size_t TEST_DVPT192_161_EXPECTED_LEN = 4; + +static const uint8_t TEST_DVPT192_161_INPUT[] = { + 0x00, +}; +static const size_t TEST_DVPT192_161_INPUT_LEN = 0; + +static const uint8_t TEST_DVPT192_162_NONCE[] = { + 0xc3, 0xbf, 0x9d, 0xfe, 0x9d, 0x6c, 0x26, 0xf5, + 0x43, 0x18, 0x8f, 0xb4, 0x57, +}; +static const size_t TEST_DVPT192_162_NONCE_LEN = 13; + +static const uint8_t TEST_DVPT192_162_ADATA[] = { + 0xe3, 0x01, 0xf6, 0x9a, 0xd3, 0xa7, 0xe0, 0x8a, + 0x3d, 0x02, 0x46, 0x2f, 0x0a, 0xa5, 0x84, 0x44, + 0x9e, 0xb0, 0x44, 0x9b, 0x0e, 0x3c, 0x50, 0xaa, + 0x8d, 0xfa, 0xa4, 0x47, 0x28, 0x16, 0xc8, 0xb0, +}; +static const size_t TEST_DVPT192_162_ADATA_LEN = 32; + +static const uint8_t TEST_DVPT192_162_EXPECTED[] = { + 0xbf, 0x0b, 0x14, 0x45, +}; +static const size_t TEST_DVPT192_162_EXPECTED_LEN = 4; + +static const uint8_t TEST_DVPT192_162_INPUT[] = { + 0x00, +}; +static const size_t TEST_DVPT192_162_INPUT_LEN = 0; + +static const uint8_t TEST_DVPT192_163_NONCE[] = { + 0x15, 0x27, 0x65, 0x7d, 0x2f, 0xd9, 0x8f, 0x7d, + 0xec, 0xa5, 0x5c, 0xc6, 0x49, +}; +static const size_t TEST_DVPT192_163_NONCE_LEN = 13; + +static const uint8_t TEST_DVPT192_163_ADATA[] = { + 0xf4, 0xc7, 0x23, 0x43, 0x3b, 0x7c, 0xaf, 0xe3, + 0xcd, 0xa9, 0xbb, 0x49, 0x40, 0xa2, 0x1a, 0x89, + 0xa8, 0x38, 0x2d, 0x13, 0x01, 0x8b, 0x62, 0x2c, + 0xcd, 0x1f, 0xfb, 0x9f, 0xfd, 0x32, 0x11, 0xaf, +}; +static const size_t TEST_DVPT192_163_ADATA_LEN = 32; + +static const uint8_t TEST_DVPT192_163_EXPECTED[] = { + 0xae, 0x85, 0x33, 0xf5, +}; +static const size_t TEST_DVPT192_163_EXPECTED_LEN = 4; + +static const uint8_t TEST_DVPT192_163_INPUT[] = { + 0x00, +}; +static const size_t TEST_DVPT192_163_INPUT_LEN = 0; + +/* Alen = 32, Plen = 0, Nlen = 13, Tlen = 16 */ +static const uint8_t TEST_DVPT192_GROUP_11_MAC_LEN = 16; + +static const uint8_t TEST_DVPT192_GROUP_11_KEY[] = { + 0xf9, 0xfd, 0xca, 0x4a, 0xc6, 0x4f, 0xe7, 0xf0, + 0x14, 0xde, 0x0f, 0x43, 0x03, 0x9c, 0x75, 0x71, + 0x94, 0xd5, 0x44, 0xce, 0x5d, 0x15, 0xee, 0xd4, +}; +static const size_t TEST_DVPT192_GROUP_11_KEY_LEN = 24; + +static const uint8_t TEST_DVPT192_165_NONCE[] = { + 0x5a, 0x8a, 0xa4, 0x85, 0xc3, 0x16, 0xe9, 0x40, + 0x3a, 0xff, 0x85, 0x9f, 0xbb, +}; +static const size_t TEST_DVPT192_165_NONCE_LEN = 13; + +static const uint8_t TEST_DVPT192_165_ADATA[] = { + 0xa1, 0x6a, 0x2e, 0x74, 0x1f, 0x1c, 0xd9, 0x71, + 0x72, 0x85, 0xb6, 0xd8, 0x82, 0xc1, 0xfc, 0x53, + 0x65, 0x5e, 0x97, 0x73, 0x76, 0x1a, 0xd6, 0x97, + 0xa7, 0xee, 0x64, 0x10, 0x18, 0x4c, 0x79, 0x82, +}; +static const size_t TEST_DVPT192_165_ADATA_LEN = 32; + +static const uint8_t TEST_DVPT192_165_EXPECTED[] = { + 0xd0, 0x7c, 0xcf, 0x9f, 0xdc, 0x3d, 0x33, 0xaa, + 0x94, 0xcd, 0xa3, 0xd2, 0x30, 0xda, 0x70, 0x7c, +}; +static const size_t TEST_DVPT192_165_EXPECTED_LEN = 16; + +static const uint8_t TEST_DVPT192_165_INPUT[] = { + 0x00, +}; +static const size_t TEST_DVPT192_165_INPUT_LEN = 0; + +static const uint8_t TEST_DVPT192_169_NONCE[] = { + 0x1e, 0x7e, 0x51, 0xf0, 0xfa, 0x9a, 0x33, 0xed, + 0x61, 0x8c, 0x26, 0xf5, 0xe3, +}; +static const size_t TEST_DVPT192_169_NONCE_LEN = 13; + +static const uint8_t TEST_DVPT192_169_ADATA[] = { + 0xda, 0x9b, 0x8f, 0xfb, 0x0f, 0x3c, 0x2a, 0xee, + 0x2e, 0x38, 0x6c, 0xc9, 0xf0, 0x35, 0xec, 0x1e, + 0xb3, 0xe6, 0x29, 0xbd, 0x15, 0x44, 0xc1, 0x1d, + 0xc2, 0x1b, 0xe4, 0xfd, 0x8a, 0xc9, 0x07, 0x4a, +}; +static const size_t TEST_DVPT192_169_ADATA_LEN = 32; + +static const uint8_t TEST_DVPT192_169_EXPECTED[] = { + 0xa9, 0xe8, 0x1a, 0xfd, 0x10, 0x30, 0xd1, 0x95, + 0xc6, 0x79, 0xe2, 0xc8, 0x37, 0xae, 0xb7, 0x36, +}; +static const size_t TEST_DVPT192_169_EXPECTED_LEN = 16; + +static const uint8_t TEST_DVPT192_169_INPUT[] = { + 0x00, +}; +static const size_t TEST_DVPT192_169_INPUT_LEN = 0; + +static const uint8_t TEST_DVPT192_176_NONCE[] = { + 0x78, 0x64, 0xc7, 0x17, 0xec, 0x93, 0xdb, 0x38, + 0xb1, 0x06, 0x79, 0xbe, 0x47, +}; +static const size_t TEST_DVPT192_176_NONCE_LEN = 13; + +static const uint8_t TEST_DVPT192_176_ADATA[] = { + 0x67, 0x9a, 0xad, 0x1a, 0xd1, 0xe5, 0x70, 0x29, + 0xe3, 0x36, 0x2b, 0x32, 0x55, 0x72, 0xfc, 0x71, + 0xca, 0xc5, 0x31, 0x84, 0xb0, 0xf1, 0x54, 0x68, + 0x67, 0xe6, 0x65, 0xa4, 0xa5, 0x94, 0x66, 0xc4, +}; +static const size_t TEST_DVPT192_176_ADATA_LEN = 32; + +static const uint8_t TEST_DVPT192_176_EXPECTED[] = { + 0xaa, 0xc0, 0x9c, 0xef, 0x96, 0x97, 0x92, 0x73, + 0x31, 0x25, 0x1f, 0x02, 0x8d, 0x24, 0xc3, 0x1f, +}; +static const size_t TEST_DVPT192_176_EXPECTED_LEN = 16; + +static const uint8_t TEST_DVPT192_176_INPUT[] = { + 0x00, +}; +static const size_t TEST_DVPT192_176_INPUT_LEN = 0; + +static const uint8_t TEST_DVPT192_177_NONCE[] = { + 0xc3, 0xbf, 0x9d, 0xfe, 0x9d, 0x6c, 0x26, 0xf5, + 0x43, 0x18, 0x8f, 0xb4, 0x57, +}; +static const size_t TEST_DVPT192_177_NONCE_LEN = 13; + +static const uint8_t TEST_DVPT192_177_ADATA[] = { + 0xe3, 0x01, 0xf6, 0x9a, 0xd3, 0xa7, 0xe0, 0x8a, + 0x3d, 0x02, 0x46, 0x2f, 0x0a, 0xa5, 0x84, 0x44, + 0x9e, 0xb0, 0x44, 0x9b, 0x0e, 0x3c, 0x50, 0xaa, + 0x8d, 0xfa, 0xa4, 0x47, 0x28, 0x16, 0xc8, 0xb0, +}; +static const size_t TEST_DVPT192_177_ADATA_LEN = 32; + +static const uint8_t TEST_DVPT192_177_EXPECTED[] = { + 0x56, 0xc0, 0x00, 0x70, 0xea, 0xe0, 0xdb, 0x32, + 0x98, 0x94, 0xa0, 0x45, 0xd8, 0x66, 0xbb, 0xaf, +}; +static const size_t TEST_DVPT192_177_EXPECTED_LEN = 16; + +static const uint8_t TEST_DVPT192_177_INPUT[] = { + 0x00, +}; +static const size_t TEST_DVPT192_177_INPUT_LEN = 0; + +static const uint8_t TEST_DVPT192_178_NONCE[] = { + 0x15, 0x27, 0x65, 0x7d, 0x2f, 0xd9, 0x8f, 0x7d, + 0xec, 0xa5, 0x5c, 0xc6, 0x49, +}; +static const size_t TEST_DVPT192_178_NONCE_LEN = 13; + +static const uint8_t TEST_DVPT192_178_ADATA[] = { + 0xf4, 0xc7, 0x23, 0x43, 0x3b, 0x7c, 0xaf, 0xe3, + 0xcd, 0xa9, 0xbb, 0x49, 0x40, 0xa2, 0x1a, 0x89, + 0xa8, 0x38, 0x2d, 0x13, 0x01, 0x8b, 0x62, 0x2c, + 0xcd, 0x1f, 0xfb, 0x9f, 0xfd, 0x32, 0x11, 0xaf, +}; +static const size_t TEST_DVPT192_178_ADATA_LEN = 32; + +static const uint8_t TEST_DVPT192_178_EXPECTED[] = { + 0x09, 0x00, 0x16, 0xbb, 0x96, 0xae, 0xaa, 0xbb, + 0xf6, 0x6f, 0xd3, 0x4f, 0xc9, 0x75, 0x91, 0xa4, +}; +static const size_t TEST_DVPT192_178_EXPECTED_LEN = 16; + +static const uint8_t TEST_DVPT192_178_INPUT[] = { + 0x00, +}; +static const size_t TEST_DVPT192_178_INPUT_LEN = 0; + +/* Alen = 32, Plen = 24, Nlen = 7, Tlen = 4 */ +static const uint8_t TEST_DVPT192_GROUP_12_MAC_LEN = 4; + +static const uint8_t TEST_DVPT192_GROUP_12_KEY[] = { + 0xf9, 0xfd, 0xca, 0x4a, 0xc6, 0x4f, 0xe7, 0xf0, + 0x14, 0xde, 0x0f, 0x43, 0x03, 0x9c, 0x75, 0x71, + 0x94, 0xd5, 0x44, 0xce, 0x5d, 0x15, 0xee, 0xd4, +}; +static const size_t TEST_DVPT192_GROUP_12_KEY_LEN = 24; + +static const uint8_t TEST_DVPT192_180_NONCE[] = { + 0x5a, 0x8a, 0xa4, 0x85, 0xc3, 0x16, 0xe9, +}; +static const size_t TEST_DVPT192_180_NONCE_LEN = 7; + +static const uint8_t TEST_DVPT192_180_ADATA[] = { + 0x37, 0x96, 0xcf, 0x51, 0xb8, 0x72, 0x66, 0x52, + 0xa4, 0x20, 0x47, 0x33, 0xb8, 0xfb, 0xb0, 0x47, + 0xcf, 0x00, 0xfb, 0x91, 0xa9, 0x83, 0x7e, 0x22, + 0xec, 0x22, 0xb1, 0xa2, 0x68, 0xf8, 0x8e, 0x2c, +}; +static const size_t TEST_DVPT192_180_ADATA_LEN = 32; + +static const uint8_t TEST_DVPT192_180_EXPECTED[] = { + 0x9f, 0x6c, 0xa4, 0xaf, 0x9b, 0x15, 0x91, 0x48, + 0xc8, 0x89, 0xa6, 0x58, 0x4d, 0x11, 0x83, 0xea, + 0x26, 0xe2, 0x61, 0x48, 0x74, 0xb0, 0x50, 0x45, + 0x75, 0xde, 0xa8, 0xd1, +}; +static const size_t TEST_DVPT192_180_EXPECTED_LEN = 28; + +static const uint8_t TEST_DVPT192_180_INPUT[] = { + 0xa2, 0x65, 0x48, 0x0c, 0xa8, 0x8d, 0x5f, 0x53, + 0x6d, 0xb0, 0xdc, 0x6a, 0xbc, 0x40, 0xfa, 0xf0, + 0xd0, 0x5b, 0xe7, 0xa9, 0x66, 0x97, 0x77, 0x68, +}; +static const size_t TEST_DVPT192_180_INPUT_LEN = 24; + +static const uint8_t TEST_DVPT192_184_NONCE[] = { + 0xcc, 0xee, 0x19, 0xd0, 0x37, 0xcf, 0x4a, +}; +static const size_t TEST_DVPT192_184_NONCE_LEN = 7; + +static const uint8_t TEST_DVPT192_184_ADATA[] = { + 0xc0, 0x26, 0x69, 0x6e, 0x64, 0x25, 0xe6, 0xc3, + 0x3f, 0x45, 0xb4, 0x14, 0x5f, 0xeb, 0xf1, 0x13, + 0x7e, 0x7a, 0xc2, 0x63, 0x83, 0xc9, 0xf5, 0xaa, + 0x4c, 0xd4, 0xe5, 0xe8, 0xab, 0xb1, 0x9e, 0x07, +}; +static const size_t TEST_DVPT192_184_ADATA_LEN = 32; + +static const uint8_t TEST_DVPT192_184_EXPECTED[] = { + 0xc3, 0x11, 0x6d, 0x90, 0x40, 0xe1, 0xed, 0x4f, + 0x7c, 0x94, 0x64, 0xd2, 0x70, 0xfb, 0x30, 0x2b, + 0xd3, 0xf1, 0x56, 0x1c, 0x25, 0xc5, 0xb9, 0x5b, + 0x8b, 0x4b, 0x53, 0xf6, +}; +static const size_t TEST_DVPT192_184_EXPECTED_LEN = 28; + +static const uint8_t TEST_DVPT192_184_INPUT[] = { + 0x0d, 0xf2, 0x02, 0x43, 0x1e, 0xe7, 0xf2, 0x51, + 0xa3, 0x8a, 0xaf, 0x6a, 0xa8, 0xcd, 0x31, 0x37, + 0x82, 0xbd, 0x29, 0x3a, 0xf9, 0x11, 0x40, 0x05, +}; +static const size_t TEST_DVPT192_184_INPUT_LEN = 24; + +static const uint8_t TEST_DVPT192_191_NONCE[] = { + 0xa8, 0x40, 0xe9, 0x8d, 0xf7, 0x2a, 0xe9, +}; +static const size_t TEST_DVPT192_191_NONCE_LEN = 7; + +static const uint8_t TEST_DVPT192_191_ADATA[] = { + 0x22, 0xc6, 0x60, 0x77, 0x32, 0xef, 0x1b, 0xdc, + 0x7f, 0xcf, 0x61, 0x97, 0xe0, 0x37, 0xcd, 0xad, + 0xd7, 0xee, 0x17, 0xc0, 0x08, 0x55, 0x2d, 0xd9, + 0xf0, 0x4b, 0x85, 0x64, 0xd3, 0x4f, 0xb1, 0x7c, +}; +static const size_t TEST_DVPT192_191_ADATA_LEN = 32; + +static const uint8_t TEST_DVPT192_191_EXPECTED[] = { + 0x51, 0xb6, 0xb9, 0x28, 0xbd, 0xd1, 0xcc, 0x0b, + 0xd0, 0xa0, 0xae, 0xd2, 0xcd, 0xa3, 0x02, 0x47, + 0x2d, 0x61, 0x8f, 0xfa, 0xa6, 0x0e, 0x17, 0x90, + 0x29, 0xc8, 0x78, 0x55, +}; +static const size_t TEST_DVPT192_191_EXPECTED_LEN = 28; + +static const uint8_t TEST_DVPT192_191_INPUT[] = { + 0xa2, 0xf5, 0x33, 0x85, 0x61, 0x8b, 0x41, 0x30, + 0x1f, 0x4e, 0x3e, 0xa4, 0xc5, 0x97, 0xf4, 0x11, + 0x10, 0x3d, 0xac, 0x2b, 0x37, 0xab, 0xf5, 0xda, +}; +static const size_t TEST_DVPT192_191_INPUT_LEN = 24; + +static const uint8_t TEST_DVPT192_192_NONCE[] = { + 0x39, 0xd9, 0x3c, 0x3c, 0xf3, 0x1a, 0x6f, +}; +static const size_t TEST_DVPT192_192_NONCE_LEN = 7; + +static const uint8_t TEST_DVPT192_192_ADATA[] = { + 0x93, 0x7d, 0xfa, 0xc5, 0xcd, 0xed, 0x93, 0x84, + 0x38, 0xf4, 0xe9, 0x7a, 0xab, 0xd9, 0xbe, 0xb5, + 0x0d, 0xba, 0x40, 0xf8, 0x24, 0x19, 0x82, 0x60, + 0xa8, 0x97, 0x29, 0x47, 0x9c, 0xfe, 0x68, 0x69, +}; +static const size_t TEST_DVPT192_192_ADATA_LEN = 32; + +static const uint8_t TEST_DVPT192_192_EXPECTED[] = { + 0xd0, 0xab, 0xab, 0x9b, 0x8e, 0x9d, 0x6c, 0x11, + 0xbb, 0x9c, 0x15, 0xbe, 0xa8, 0xa4, 0x86, 0x70, + 0x4b, 0xed, 0x32, 0xc5, 0x72, 0x97, 0x05, 0x5b, + 0x4d, 0xe8, 0xed, 0x8d, +}; +static const size_t TEST_DVPT192_192_EXPECTED_LEN = 28; + +static const uint8_t TEST_DVPT192_192_INPUT[] = { + 0xc1, 0xbd, 0xef, 0x96, 0xdc, 0x86, 0x84, 0x46, + 0xbe, 0x48, 0x49, 0x1b, 0x16, 0x05, 0x04, 0x54, + 0x6f, 0x2a, 0x40, 0xdd, 0x58, 0x1f, 0x95, 0x82, +}; +static const size_t TEST_DVPT192_192_INPUT_LEN = 24; + +static const uint8_t TEST_DVPT192_193_NONCE[] = { + 0x0b, 0xbc, 0x17, 0x70, 0x19, 0x32, 0x1e, +}; +static const size_t TEST_DVPT192_193_NONCE_LEN = 7; + +static const uint8_t TEST_DVPT192_193_ADATA[] = { + 0xf6, 0xe0, 0x26, 0x78, 0x82, 0x0f, 0x5c, 0xcb, + 0xed, 0xe6, 0xcb, 0xde, 0xd0, 0x2d, 0x6d, 0xd5, + 0x8d, 0x48, 0x61, 0x66, 0xd7, 0xb1, 0x8e, 0xe9, + 0x75, 0xa6, 0x88, 0xaf, 0x42, 0x1f, 0xb7, 0x95, +}; +static const size_t TEST_DVPT192_193_ADATA_LEN = 32; + +static const uint8_t TEST_DVPT192_193_EXPECTED[] = { + 0x92, 0xfd, 0x51, 0x9a, 0x96, 0x6c, 0x0f, 0xbd, + 0xd7, 0x08, 0x7f, 0xf5, 0xa1, 0xbd, 0x94, 0x6c, + 0xd6, 0x63, 0x50, 0x2d, 0xb3, 0x78, 0x38, 0x35, + 0x31, 0xd6, 0x99, 0x47, +}; +static const size_t TEST_DVPT192_193_EXPECTED_LEN = 28; + +static const uint8_t TEST_DVPT192_193_INPUT[] = { + 0x72, 0xa7, 0x09, 0x54, 0xd2, 0x2a, 0xd7, 0x22, + 0xfc, 0x32, 0x75, 0x6a, 0xfc, 0xe6, 0x7b, 0x34, + 0x4b, 0x2f, 0x3c, 0x55, 0xfe, 0x1d, 0x9e, 0xed, +}; +static const size_t TEST_DVPT192_193_INPUT_LEN = 24; + +/* Alen = 32, Plen = 24, Nlen = 7, Tlen = 16 */ +static const uint8_t TEST_DVPT192_GROUP_13_MAC_LEN = 16; + +static const uint8_t TEST_DVPT192_GROUP_13_KEY[] = { + 0xa7, 0xaa, 0x63, 0x5e, 0xa5, 0x1b, 0x0b, 0xb2, + 0x0a, 0x09, 0x2b, 0xd5, 0x57, 0x3e, 0x72, 0x8c, + 0xcd, 0x4b, 0x3e, 0x8c, 0xdd, 0x2a, 0xb3, 0x3d, +}; +static const size_t TEST_DVPT192_GROUP_13_KEY_LEN = 24; + +static const uint8_t TEST_DVPT192_195_NONCE[] = { + 0x5a, 0x8a, 0xa4, 0x85, 0xc3, 0x16, 0xe9, +}; +static const size_t TEST_DVPT192_195_NONCE_LEN = 7; + +static const uint8_t TEST_DVPT192_195_ADATA[] = { + 0x37, 0x96, 0xcf, 0x51, 0xb8, 0x72, 0x66, 0x52, + 0xa4, 0x20, 0x47, 0x33, 0xb8, 0xfb, 0xb0, 0x47, + 0xcf, 0x00, 0xfb, 0x91, 0xa9, 0x83, 0x7e, 0x22, + 0xec, 0x22, 0xb1, 0xa2, 0x68, 0xf8, 0x8e, 0x2c, +}; +static const size_t TEST_DVPT192_195_ADATA_LEN = 32; + +static const uint8_t TEST_DVPT192_195_EXPECTED[] = { + 0x6a, 0xab, 0x64, 0xc4, 0x78, 0x75, 0x99, 0xd8, + 0xf2, 0x13, 0x44, 0x6b, 0xea, 0xdb, 0x16, 0xe0, + 0x8d, 0xba, 0x60, 0xe9, 0x7f, 0x56, 0xdb, 0xd1, + 0x4d, 0x1d, 0x98, 0x0d, 0x6f, 0xe0, 0xfb, 0x44, + 0xb4, 0x21, 0x99, 0x26, 0x62, 0xb9, 0x79, 0x75, +}; +static const size_t TEST_DVPT192_195_EXPECTED_LEN = 40; + +static const uint8_t TEST_DVPT192_195_INPUT[] = { + 0xa2, 0x65, 0x48, 0x0c, 0xa8, 0x8d, 0x5f, 0x53, + 0x6d, 0xb0, 0xdc, 0x6a, 0xbc, 0x40, 0xfa, 0xf0, + 0xd0, 0x5b, 0xe7, 0xa9, 0x66, 0x97, 0x77, 0x68, +}; +static const size_t TEST_DVPT192_195_INPUT_LEN = 24; + +static const uint8_t TEST_DVPT192_199_NONCE[] = { + 0xcc, 0xee, 0x19, 0xd0, 0x37, 0xcf, 0x4a, +}; +static const size_t TEST_DVPT192_199_NONCE_LEN = 7; + +static const uint8_t TEST_DVPT192_199_ADATA[] = { + 0xc0, 0x26, 0x69, 0x6e, 0x64, 0x25, 0xe6, 0xc3, + 0x3f, 0x45, 0xb4, 0x14, 0x5f, 0xeb, 0xf1, 0x13, + 0x7e, 0x7a, 0xc2, 0x63, 0x83, 0xc9, 0xf5, 0xaa, + 0x4c, 0xd4, 0xe5, 0xe8, 0xab, 0xb1, 0x9e, 0x07, +}; +static const size_t TEST_DVPT192_199_ADATA_LEN = 32; + +static const uint8_t TEST_DVPT192_199_EXPECTED[] = { + 0x67, 0xd9, 0x89, 0xea, 0x93, 0x5b, 0x9c, 0xe1, + 0x90, 0xe3, 0xa7, 0xf3, 0xb6, 0x45, 0x30, 0x5e, + 0x1e, 0x30, 0x8a, 0x7f, 0xe6, 0x17, 0xf8, 0x0f, + 0x17, 0x0a, 0x2b, 0x9c, 0x30, 0x9d, 0xe6, 0xc2, + 0x32, 0x61, 0x15, 0xa7, 0x6e, 0xfb, 0xdf, 0x98, +}; +static const size_t TEST_DVPT192_199_EXPECTED_LEN = 40; + +static const uint8_t TEST_DVPT192_199_INPUT[] = { + 0x0d, 0xf2, 0x02, 0x43, 0x1e, 0xe7, 0xf2, 0x51, + 0xa3, 0x8a, 0xaf, 0x6a, 0xa8, 0xcd, 0x31, 0x37, + 0x82, 0xbd, 0x29, 0x3a, 0xf9, 0x11, 0x40, 0x05, +}; +static const size_t TEST_DVPT192_199_INPUT_LEN = 24; + +static const uint8_t TEST_DVPT192_206_NONCE[] = { + 0xa8, 0x40, 0xe9, 0x8d, 0xf7, 0x2a, 0xe9, +}; +static const size_t TEST_DVPT192_206_NONCE_LEN = 7; + +static const uint8_t TEST_DVPT192_206_ADATA[] = { + 0x22, 0xc6, 0x60, 0x77, 0x32, 0xef, 0x1b, 0xdc, + 0x7f, 0xcf, 0x61, 0x97, 0xe0, 0x37, 0xcd, 0xad, + 0xd7, 0xee, 0x17, 0xc0, 0x08, 0x55, 0x2d, 0xd9, + 0xf0, 0x4b, 0x85, 0x64, 0xd3, 0x4f, 0xb1, 0x7c, +}; +static const size_t TEST_DVPT192_206_ADATA_LEN = 32; + +static const uint8_t TEST_DVPT192_206_EXPECTED[] = { + 0x53, 0xbb, 0x60, 0x8f, 0x62, 0x36, 0x79, 0x88, + 0x39, 0xaf, 0x35, 0x88, 0x8c, 0xb0, 0xfa, 0x47, + 0x97, 0xb5, 0x99, 0x27, 0x10, 0x84, 0xcc, 0x13, + 0x84, 0x7b, 0x02, 0x27, 0x33, 0xca, 0x5a, 0x5e, + 0x3c, 0x4d, 0x47, 0x23, 0x32, 0x48, 0x4b, 0x7f, +}; +static const size_t TEST_DVPT192_206_EXPECTED_LEN = 40; + +static const uint8_t TEST_DVPT192_206_INPUT[] = { + 0xa2, 0xf5, 0x33, 0x85, 0x61, 0x8b, 0x41, 0x30, + 0x1f, 0x4e, 0x3e, 0xa4, 0xc5, 0x97, 0xf4, 0x11, + 0x10, 0x3d, 0xac, 0x2b, 0x37, 0xab, 0xf5, 0xda, +}; +static const size_t TEST_DVPT192_206_INPUT_LEN = 24; + +static const uint8_t TEST_DVPT192_207_NONCE[] = { + 0x39, 0xd9, 0x3c, 0x3c, 0xf3, 0x1a, 0x6f, +}; +static const size_t TEST_DVPT192_207_NONCE_LEN = 7; + +static const uint8_t TEST_DVPT192_207_ADATA[] = { + 0x93, 0x7d, 0xfa, 0xc5, 0xcd, 0xed, 0x93, 0x84, + 0x38, 0xf4, 0xe9, 0x7a, 0xab, 0xd9, 0xbe, 0xb5, + 0x0d, 0xba, 0x40, 0xf8, 0x24, 0x19, 0x82, 0x60, + 0xa8, 0x97, 0x29, 0x47, 0x9c, 0xfe, 0x68, 0x69, +}; +static const size_t TEST_DVPT192_207_ADATA_LEN = 32; + +static const uint8_t TEST_DVPT192_207_EXPECTED[] = { + 0xbe, 0x54, 0x55, 0x1d, 0x1d, 0x2f, 0x1b, 0x3e, + 0xb6, 0x0f, 0xfe, 0x3b, 0x16, 0x55, 0x24, 0xff, + 0x90, 0xca, 0x09, 0xfb, 0x25, 0x2b, 0xf2, 0x1c, + 0x1c, 0x79, 0xed, 0xbf, 0x38, 0xc5, 0x0e, 0x0f, + 0x24, 0x0a, 0x2d, 0x70, 0xf6, 0x5a, 0xa7, 0x9f, +}; +static const size_t TEST_DVPT192_207_EXPECTED_LEN = 40; + +static const uint8_t TEST_DVPT192_207_INPUT[] = { + 0xc1, 0xbd, 0xef, 0x96, 0xdc, 0x86, 0x84, 0x46, + 0xbe, 0x48, 0x49, 0x1b, 0x16, 0x05, 0x04, 0x54, + 0x6f, 0x2a, 0x40, 0xdd, 0x58, 0x1f, 0x95, 0x82, +}; +static const size_t TEST_DVPT192_207_INPUT_LEN = 24; + +static const uint8_t TEST_DVPT192_208_NONCE[] = { + 0x0b, 0xbc, 0x17, 0x70, 0x19, 0x32, 0x1e, +}; +static const size_t TEST_DVPT192_208_NONCE_LEN = 7; + +static const uint8_t TEST_DVPT192_208_ADATA[] = { + 0xf6, 0xe0, 0x26, 0x78, 0x82, 0x0f, 0x5c, 0xcb, + 0xed, 0xe6, 0xcb, 0xde, 0xd0, 0x2d, 0x6d, 0xd5, + 0x8d, 0x48, 0x61, 0x66, 0xd7, 0xb1, 0x8e, 0xe9, + 0x75, 0xa6, 0x88, 0xaf, 0x42, 0x1f, 0xb7, 0x95, +}; +static const size_t TEST_DVPT192_208_ADATA_LEN = 32; + +static const uint8_t TEST_DVPT192_208_EXPECTED[] = { + 0xf0, 0x7c, 0x10, 0x72, 0xd8, 0xf8, 0xe0, 0x77, + 0xdf, 0xbb, 0x3a, 0xd8, 0x6d, 0xd9, 0x2d, 0x32, + 0xb4, 0x1f, 0x29, 0xe6, 0x47, 0xdc, 0xd7, 0xe3, + 0xa8, 0x2c, 0xd3, 0xeb, 0xaf, 0x6c, 0x2d, 0x3e, + 0x21, 0x74, 0x9b, 0xdf, 0x57, 0x0a, 0xd2, 0x8d, +}; +static const size_t TEST_DVPT192_208_EXPECTED_LEN = 40; + +static const uint8_t TEST_DVPT192_208_INPUT[] = { + 0x72, 0xa7, 0x09, 0x54, 0xd2, 0x2a, 0xd7, 0x22, + 0xfc, 0x32, 0x75, 0x6a, 0xfc, 0xe6, 0x7b, 0x34, + 0x4b, 0x2f, 0x3c, 0x55, 0xfe, 0x1d, 0x9e, 0xed, +}; +static const size_t TEST_DVPT192_208_INPUT_LEN = 24; + +/* Alen = 32, Plen = 24, Nlen = 13, Tlen = 4 */ +static const uint8_t TEST_DVPT192_GROUP_14_MAC_LEN = 4; + +static const uint8_t TEST_DVPT192_GROUP_14_KEY[] = { + 0xa7, 0xaa, 0x63, 0x5e, 0xa5, 0x1b, 0x0b, 0xb2, + 0x0a, 0x09, 0x2b, 0xd5, 0x57, 0x3e, 0x72, 0x8c, + 0xcd, 0x4b, 0x3e, 0x8c, 0xdd, 0x2a, 0xb3, 0x3d, +}; +static const size_t TEST_DVPT192_GROUP_14_KEY_LEN = 24; + +static const uint8_t TEST_DVPT192_210_NONCE[] = { + 0x5a, 0x8a, 0xa4, 0x85, 0xc3, 0x16, 0xe9, 0x40, + 0x3a, 0xff, 0x85, 0x9f, 0xbb, +}; +static const size_t TEST_DVPT192_210_NONCE_LEN = 13; + +static const uint8_t TEST_DVPT192_210_ADATA[] = { + 0xa1, 0x6a, 0x2e, 0x74, 0x1f, 0x1c, 0xd9, 0x71, + 0x72, 0x85, 0xb6, 0xd8, 0x82, 0xc1, 0xfc, 0x53, + 0x65, 0x5e, 0x97, 0x73, 0x76, 0x1a, 0xd6, 0x97, + 0xa7, 0xee, 0x64, 0x10, 0x18, 0x4c, 0x79, 0x82, +}; +static const size_t TEST_DVPT192_210_ADATA_LEN = 32; + +static const uint8_t TEST_DVPT192_210_EXPECTED[] = { + 0x16, 0xe5, 0x43, 0xd0, 0xe2, 0x06, 0x15, 0xff, + 0x0d, 0xf1, 0x5a, 0xcd, 0x99, 0x27, 0xdd, 0xfe, + 0x40, 0x66, 0x8a, 0x54, 0xbb, 0x85, 0x4c, 0xcc, + 0xc2, 0x5e, 0x9f, 0xce, +}; +static const size_t TEST_DVPT192_210_EXPECTED_LEN = 28; + +static const uint8_t TEST_DVPT192_210_INPUT[] = { + 0x87, 0x39, 0xb4, 0xbe, 0xa1, 0xa0, 0x99, 0xfe, + 0x54, 0x74, 0x99, 0xcb, 0xc6, 0xd1, 0xb1, 0x3d, + 0x84, 0x9b, 0x80, 0x84, 0xc9, 0xb6, 0xac, 0xc5, +}; +static const size_t TEST_DVPT192_210_INPUT_LEN = 24; + +static const uint8_t TEST_DVPT192_214_NONCE[] = { + 0xe3, 0xc0, 0x3e, 0xf7, 0xe1, 0xd3, 0x19, 0x61, + 0xee, 0x0b, 0x97, 0xbd, 0x99, +}; +static const size_t TEST_DVPT192_214_NONCE_LEN = 13; + +static const uint8_t TEST_DVPT192_214_ADATA[] = { + 0x8a, 0x36, 0x76, 0xdd, 0x64, 0x08, 0x21, 0xb5, + 0x8f, 0xb0, 0xf0, 0x32, 0x98, 0x55, 0xfd, 0x58, + 0x82, 0xc3, 0x76, 0xea, 0x16, 0x6b, 0x95, 0x8b, + 0x7a, 0xaa, 0xd2, 0x23, 0x05, 0x4e, 0x57, 0x84, +}; +static const size_t TEST_DVPT192_214_ADATA_LEN = 32; + +static const uint8_t TEST_DVPT192_214_EXPECTED[] = { + 0x24, 0xe1, 0xd3, 0x82, 0x01, 0x01, 0x41, 0x2d, + 0x8f, 0x4d, 0x57, 0x11, 0x8c, 0xab, 0x8f, 0x7e, + 0x48, 0x9d, 0x5c, 0xac, 0x78, 0x80, 0x2d, 0xd5, + 0xcc, 0xf8, 0xec, 0xf0, +}; +static const size_t TEST_DVPT192_214_EXPECTED_LEN = 28; + +static const uint8_t TEST_DVPT192_214_INPUT[] = { + 0x92, 0x97, 0x3c, 0xe7, 0x07, 0x73, 0x3a, 0x73, + 0x11, 0x8c, 0x8c, 0xe6, 0xb5, 0xe3, 0xfc, 0x77, + 0xa1, 0x7f, 0x44, 0x83, 0x10, 0xc0, 0x19, 0x7f, +}; +static const size_t TEST_DVPT192_214_INPUT_LEN = 24; + +static const uint8_t TEST_DVPT192_221_NONCE[] = { + 0x93, 0xe0, 0x88, 0x54, 0x56, 0x0e, 0xdb, 0x09, + 0x6e, 0x5d, 0x65, 0x40, 0x86, +}; +static const size_t TEST_DVPT192_221_NONCE_LEN = 13; + +static const uint8_t TEST_DVPT192_221_ADATA[] = { + 0xbd, 0xc6, 0x0d, 0xff, 0x08, 0xbf, 0xd5, 0xd4, + 0x43, 0x20, 0xb7, 0x5c, 0x61, 0xe4, 0x56, 0xfd, + 0x43, 0x33, 0xc9, 0xc3, 0xd0, 0x29, 0x4d, 0x4a, + 0x48, 0xd9, 0x36, 0xdf, 0xd5, 0x92, 0x2c, 0xe2, +}; +static const size_t TEST_DVPT192_221_ADATA_LEN = 32; + +static const uint8_t TEST_DVPT192_221_EXPECTED[] = { + 0x0e, 0xf8, 0x98, 0x1d, 0xd3, 0x7c, 0x05, 0x5a, + 0x3c, 0x3e, 0x14, 0x78, 0x6f, 0xc6, 0x62, 0xb2, + 0xa1, 0x10, 0x65, 0x96, 0x49, 0x11, 0xd3, 0x5e, + 0xbc, 0xc8, 0x70, 0x96, +}; +static const size_t TEST_DVPT192_221_EXPECTED_LEN = 28; + +static const uint8_t TEST_DVPT192_221_INPUT[] = { + 0x56, 0x9e, 0x4a, 0xec, 0x88, 0xdd, 0x51, 0xca, + 0x51, 0x9c, 0x0a, 0x00, 0xc9, 0x22, 0xee, 0x33, + 0xd3, 0x55, 0x9b, 0x98, 0xa3, 0x2d, 0x79, 0x06, +}; +static const size_t TEST_DVPT192_221_INPUT_LEN = 24; + +static const uint8_t TEST_DVPT192_222_NONCE[] = { + 0xe3, 0xf3, 0x7b, 0x68, 0xff, 0x50, 0x8c, 0xfe, + 0x29, 0x54, 0x41, 0xd9, 0xe3, +}; +static const size_t TEST_DVPT192_222_NONCE_LEN = 13; + +static const uint8_t TEST_DVPT192_222_ADATA[] = { + 0xb2, 0xb6, 0xc5, 0x78, 0x2e, 0x4f, 0x12, 0x84, + 0x67, 0xc5, 0x89, 0xd2, 0xa6, 0xcf, 0x55, 0xef, + 0x12, 0x87, 0x7a, 0xdb, 0x77, 0x1b, 0xbb, 0x62, + 0x45, 0xc5, 0xbb, 0xa9, 0xdc, 0xfd, 0x62, 0x08, +}; +static const size_t TEST_DVPT192_222_ADATA_LEN = 32; + +static const uint8_t TEST_DVPT192_222_EXPECTED[] = { + 0xfc, 0x18, 0x70, 0xcf, 0xc4, 0x40, 0xf7, 0x4f, + 0x73, 0xf4, 0x0e, 0x68, 0x2c, 0xf4, 0x71, 0x3d, + 0x02, 0x7c, 0x29, 0x7b, 0x94, 0x26, 0xc3, 0xef, + 0xe9, 0x81, 0xe9, 0x35, +}; +static const size_t TEST_DVPT192_222_EXPECTED_LEN = 28; + +static const uint8_t TEST_DVPT192_222_INPUT[] = { + 0x02, 0xb5, 0x51, 0x12, 0x04, 0xbd, 0x55, 0xf7, + 0xc3, 0x79, 0x73, 0xe2, 0x6f, 0x6d, 0xf5, 0x88, + 0x3c, 0x0a, 0x53, 0x0f, 0x07, 0xc7, 0xf8, 0xc2, +}; +static const size_t TEST_DVPT192_222_INPUT_LEN = 24; + +static const uint8_t TEST_DVPT192_223_NONCE[] = { + 0xea, 0x98, 0xec, 0x44, 0xf5, 0xa8, 0x67, 0x15, + 0x01, 0x47, 0x83, 0x17, 0x2e, +}; +static const size_t TEST_DVPT192_223_NONCE_LEN = 13; + +static const uint8_t TEST_DVPT192_223_ADATA[] = { + 0xe4, 0x69, 0x2b, 0x9f, 0x06, 0xb6, 0x66, 0xc7, + 0x45, 0x1b, 0x14, 0x6c, 0x8a, 0xeb, 0x07, 0xa6, + 0xe3, 0x0c, 0x62, 0x9d, 0x28, 0x06, 0x5c, 0x3d, + 0xde, 0x59, 0x40, 0x32, 0x5b, 0x14, 0xb8, 0x10, +}; +static const size_t TEST_DVPT192_223_ADATA_LEN = 32; + +static const uint8_t TEST_DVPT192_223_EXPECTED[] = { + 0x9f, 0xc2, 0xc4, 0x62, 0xdf, 0xf1, 0xba, 0x97, + 0x56, 0x77, 0x2d, 0x73, 0xde, 0x5c, 0x4e, 0x82, + 0x2b, 0x5e, 0xa0, 0xbc, 0x88, 0x84, 0x5a, 0x32, + 0x3b, 0x98, 0xde, 0x4f, +}; +static const size_t TEST_DVPT192_223_EXPECTED_LEN = 28; + +static const uint8_t TEST_DVPT192_223_INPUT[] = { + 0x4d, 0xa4, 0x0b, 0x80, 0x57, 0x9c, 0x1d, 0x9a, + 0x53, 0x09, 0xf7, 0xef, 0xec, 0xb7, 0xc0, 0x59, + 0xa2, 0xf9, 0x14, 0x51, 0x1c, 0xa5, 0xfc, 0x10, +}; +static const size_t TEST_DVPT192_223_INPUT_LEN = 24; + +/* Alen = 32, Plen = 24, Nlen = 13, Tlen = 16 */ +static const uint8_t TEST_DVPT192_GROUP_15_MAC_LEN = 16; + +static const uint8_t TEST_DVPT192_GROUP_15_KEY[] = { + 0x26, 0x51, 0x1f, 0xb5, 0x1f, 0xcf, 0xa7, 0x5c, + 0xb4, 0xb4, 0x4d, 0xa7, 0x5a, 0x6e, 0x5a, 0x0e, + 0xb8, 0xd9, 0xc8, 0xf3, 0xb9, 0x06, 0xf8, 0x86, +}; +static const size_t TEST_DVPT192_GROUP_15_KEY_LEN = 24; + +static const uint8_t TEST_DVPT192_225_NONCE[] = { + 0x5a, 0x8a, 0xa4, 0x85, 0xc3, 0x16, 0xe9, 0x40, + 0x3a, 0xff, 0x85, 0x9f, 0xbb, +}; +static const size_t TEST_DVPT192_225_NONCE_LEN = 13; + +static const uint8_t TEST_DVPT192_225_ADATA[] = { + 0xa1, 0x6a, 0x2e, 0x74, 0x1f, 0x1c, 0xd9, 0x71, + 0x72, 0x85, 0xb6, 0xd8, 0x82, 0xc1, 0xfc, 0x53, + 0x65, 0x5e, 0x97, 0x73, 0x76, 0x1a, 0xd6, 0x97, + 0xa7, 0xee, 0x64, 0x10, 0x18, 0x4c, 0x79, 0x82, +}; +static const size_t TEST_DVPT192_225_ADATA_LEN = 32; + +static const uint8_t TEST_DVPT192_225_EXPECTED[] = { + 0xc5, 0xb0, 0xb2, 0xef, 0x17, 0x49, 0x8c, 0x55, + 0x70, 0xeb, 0x33, 0x5d, 0xf4, 0x58, 0x80, 0x32, + 0x95, 0x8b, 0xa3, 0xd6, 0x9b, 0xf6, 0xf3, 0x17, + 0x84, 0x64, 0xa6, 0xf7, 0xfa, 0x2b, 0x76, 0x74, + 0x4e, 0x8e, 0x8d, 0x95, 0x69, 0x1c, 0xec, 0xb8, +}; +static const size_t TEST_DVPT192_225_EXPECTED_LEN = 40; + +static const uint8_t TEST_DVPT192_225_INPUT[] = { + 0x87, 0x39, 0xb4, 0xbe, 0xa1, 0xa0, 0x99, 0xfe, + 0x54, 0x74, 0x99, 0xcb, 0xc6, 0xd1, 0xb1, 0x3d, + 0x84, 0x9b, 0x80, 0x84, 0xc9, 0xb6, 0xac, 0xc5, +}; +static const size_t TEST_DVPT192_225_INPUT_LEN = 24; + +static const uint8_t TEST_DVPT192_229_NONCE[] = { + 0xe3, 0xc0, 0x3e, 0xf7, 0xe1, 0xd3, 0x19, 0x61, + 0xee, 0x0b, 0x97, 0xbd, 0x99, +}; +static const size_t TEST_DVPT192_229_NONCE_LEN = 13; + +static const uint8_t TEST_DVPT192_229_ADATA[] = { + 0x8a, 0x36, 0x76, 0xdd, 0x64, 0x08, 0x21, 0xb5, + 0x8f, 0xb0, 0xf0, 0x32, 0x98, 0x55, 0xfd, 0x58, + 0x82, 0xc3, 0x76, 0xea, 0x16, 0x6b, 0x95, 0x8b, + 0x7a, 0xaa, 0xd2, 0x23, 0x05, 0x4e, 0x57, 0x84, +}; +static const size_t TEST_DVPT192_229_ADATA_LEN = 32; + +static const uint8_t TEST_DVPT192_229_EXPECTED[] = { + 0xea, 0xa9, 0x95, 0x94, 0x6e, 0xd9, 0x1d, 0x6a, + 0x08, 0xad, 0xe1, 0x4b, 0x26, 0x0a, 0xc7, 0x52, + 0xcb, 0xd1, 0x08, 0x1d, 0x5a, 0x7c, 0xad, 0x90, + 0x78, 0x36, 0x18, 0x37, 0x4f, 0x6d, 0x03, 0xdf, + 0x28, 0xee, 0x57, 0xa1, 0xa5, 0xaa, 0x38, 0xd8, +}; +static const size_t TEST_DVPT192_229_EXPECTED_LEN = 40; + +static const uint8_t TEST_DVPT192_229_INPUT[] = { + 0x92, 0x97, 0x3c, 0xe7, 0x07, 0x73, 0x3a, 0x73, + 0x11, 0x8c, 0x8c, 0xe6, 0xb5, 0xe3, 0xfc, 0x77, + 0xa1, 0x7f, 0x44, 0x83, 0x10, 0xc0, 0x19, 0x7f, +}; +static const size_t TEST_DVPT192_229_INPUT_LEN = 24; + +static const uint8_t TEST_DVPT192_236_NONCE[] = { + 0x93, 0xe0, 0x88, 0x54, 0x56, 0x0e, 0xdb, 0x09, + 0x6e, 0x5d, 0x65, 0x40, 0x86, +}; +static const size_t TEST_DVPT192_236_NONCE_LEN = 13; + +static const uint8_t TEST_DVPT192_236_ADATA[] = { + 0xbd, 0xc6, 0x0d, 0xff, 0x08, 0xbf, 0xd5, 0xd4, + 0x43, 0x20, 0xb7, 0x5c, 0x61, 0xe4, 0x56, 0xfd, + 0x43, 0x33, 0xc9, 0xc3, 0xd0, 0x29, 0x4d, 0x4a, + 0x48, 0xd9, 0x36, 0xdf, 0xd5, 0x92, 0x2c, 0xe2, +}; +static const size_t TEST_DVPT192_236_ADATA_LEN = 32; + +static const uint8_t TEST_DVPT192_236_EXPECTED[] = { + 0xaf, 0x63, 0xf2, 0x7e, 0x2a, 0x9e, 0x70, 0xf1, + 0x06, 0x47, 0x74, 0x93, 0xdc, 0x14, 0x1d, 0x16, + 0xa1, 0xd0, 0x59, 0xdd, 0x7a, 0x8a, 0x78, 0x10, + 0xd9, 0x90, 0xb6, 0x42, 0x03, 0x9f, 0x24, 0x75, + 0x57, 0x90, 0x33, 0x2b, 0x3c, 0xc4, 0x7c, 0x49, +}; +static const size_t TEST_DVPT192_236_EXPECTED_LEN = 40; + +static const uint8_t TEST_DVPT192_236_INPUT[] = { + 0x56, 0x9e, 0x4a, 0xec, 0x88, 0xdd, 0x51, 0xca, + 0x51, 0x9c, 0x0a, 0x00, 0xc9, 0x22, 0xee, 0x33, + 0xd3, 0x55, 0x9b, 0x98, 0xa3, 0x2d, 0x79, 0x06, +}; +static const size_t TEST_DVPT192_236_INPUT_LEN = 24; + +static const uint8_t TEST_DVPT192_237_NONCE[] = { + 0xe3, 0xf3, 0x7b, 0x68, 0xff, 0x50, 0x8c, 0xfe, + 0x29, 0x54, 0x41, 0xd9, 0xe3, +}; +static const size_t TEST_DVPT192_237_NONCE_LEN = 13; + +static const uint8_t TEST_DVPT192_237_ADATA[] = { + 0xb2, 0xb6, 0xc5, 0x78, 0x2e, 0x4f, 0x12, 0x84, + 0x67, 0xc5, 0x89, 0xd2, 0xa6, 0xcf, 0x55, 0xef, + 0x12, 0x87, 0x7a, 0xdb, 0x77, 0x1b, 0xbb, 0x62, + 0x45, 0xc5, 0xbb, 0xa9, 0xdc, 0xfd, 0x62, 0x08, +}; +static const size_t TEST_DVPT192_237_ADATA_LEN = 32; + +static const uint8_t TEST_DVPT192_237_EXPECTED[] = { + 0x1d, 0x2a, 0xe8, 0x8c, 0x87, 0x86, 0x84, 0xa0, + 0xb4, 0x04, 0x98, 0x62, 0x52, 0xb3, 0xa7, 0x58, + 0x3e, 0x1a, 0x5a, 0x51, 0x16, 0x3d, 0xdc, 0x60, + 0x6d, 0x39, 0x68, 0xfd, 0xce, 0xaa, 0xe5, 0x13, + 0x8c, 0x41, 0x1a, 0x29, 0xd0, 0xd3, 0x33, 0xee, +}; +static const size_t TEST_DVPT192_237_EXPECTED_LEN = 40; + +static const uint8_t TEST_DVPT192_237_INPUT[] = { + 0x02, 0xb5, 0x51, 0x12, 0x04, 0xbd, 0x55, 0xf7, + 0xc3, 0x79, 0x73, 0xe2, 0x6f, 0x6d, 0xf5, 0x88, + 0x3c, 0x0a, 0x53, 0x0f, 0x07, 0xc7, 0xf8, 0xc2, +}; +static const size_t TEST_DVPT192_237_INPUT_LEN = 24; + +static const uint8_t TEST_DVPT192_238_NONCE[] = { + 0xea, 0x98, 0xec, 0x44, 0xf5, 0xa8, 0x67, 0x15, + 0x01, 0x47, 0x83, 0x17, 0x2e, +}; +static const size_t TEST_DVPT192_238_NONCE_LEN = 13; + +static const uint8_t TEST_DVPT192_238_ADATA[] = { + 0xe4, 0x69, 0x2b, 0x9f, 0x06, 0xb6, 0x66, 0xc7, + 0x45, 0x1b, 0x14, 0x6c, 0x8a, 0xeb, 0x07, 0xa6, + 0xe3, 0x0c, 0x62, 0x9d, 0x28, 0x06, 0x5c, 0x3d, + 0xde, 0x59, 0x40, 0x32, 0x5b, 0x14, 0xb8, 0x10, +}; +static const size_t TEST_DVPT192_238_ADATA_LEN = 32; + +static const uint8_t TEST_DVPT192_238_EXPECTED[] = { + 0x30, 0xc1, 0x54, 0xc6, 0x16, 0x94, 0x6e, 0xcc, + 0xc2, 0xe2, 0x41, 0xd3, 0x36, 0xad, 0x33, 0x72, + 0x09, 0x53, 0xe4, 0x49, 0xa0, 0xe6, 0xb0, 0xf0, + 0xdb, 0xf8, 0xe9, 0x46, 0x49, 0x09, 0xbd, 0xf3, + 0x37, 0xe4, 0x80, 0x93, 0xc0, 0x82, 0xa1, 0x0b, +}; +static const size_t TEST_DVPT192_238_EXPECTED_LEN = 40; + +static const uint8_t TEST_DVPT192_238_INPUT[] = { + 0x4d, 0xa4, 0x0b, 0x80, 0x57, 0x9c, 0x1d, 0x9a, + 0x53, 0x09, 0xf7, 0xef, 0xec, 0xb7, 0xc0, 0x59, + 0xa2, 0xf9, 0x14, 0x51, 0x1c, 0xa5, 0xfc, 0x10, +}; +static const size_t TEST_DVPT192_238_INPUT_LEN = 24; + +/* Share test buffer output */ +static uint8_t data[512]; + +static void test_encrypt_op(const uint8_t *key, uint8_t key_len, + const uint8_t *adata, size_t adata_len, + const uint8_t *nonce, uint8_t nonce_len, + const uint8_t *plain, size_t plain_len, + const uint8_t *output_expected, + size_t output_expected_len, + uint8_t mac_length) +{ + cipher_t cipher; + int len, err, cmp; + size_t len_encoding = nonce_and_len_encoding_size - nonce_len; + + TEST_ASSERT_MESSAGE(sizeof(data) >= output_expected_len, + "Output buffer too small"); + + err = cipher_init(&cipher, CIPHER_AES, key, key_len); + TEST_ASSERT_EQUAL_INT(1, err); + + len = cipher_encrypt_ccm(&cipher, adata, adata_len, + mac_length, len_encoding, + nonce, nonce_len, plain, plain_len, data); + TEST_ASSERT_MESSAGE(len > 0, "Encryption failed"); + + TEST_ASSERT_EQUAL_INT(output_expected_len, len); + cmp = compare(output_expected, data, len); + TEST_ASSERT_MESSAGE(1 == cmp, "wrong ciphertext"); +} + +static void test_decrypt_op(const uint8_t *key, uint8_t key_len, + const uint8_t *adata, size_t adata_len, + const uint8_t *nonce, uint8_t nonce_len, + const uint8_t *encrypted, size_t encrypted_len, + const uint8_t *output_expected, + size_t output_expected_len, + uint8_t mac_length) +{ + cipher_t cipher; + int len, err, cmp; + size_t len_encoding = nonce_and_len_encoding_size - nonce_len; + + TEST_ASSERT_MESSAGE(sizeof(data) >= output_expected_len, + "Output buffer too small"); + + err = cipher_init(&cipher, CIPHER_AES, key, key_len); + TEST_ASSERT_EQUAL_INT(1, err); + + len = cipher_decrypt_ccm(&cipher, adata, adata_len, + mac_length, len_encoding, + nonce, nonce_len, encrypted, encrypted_len, data); + TEST_ASSERT_MESSAGE(len >= 0, "Decryption failed"); + + TEST_ASSERT_EQUAL_INT(output_expected_len, len); + cmp = compare(output_expected, data, len); + TEST_ASSERT_MESSAGE(1 == cmp, "wrong ciphertext"); + +} + +#define do_test_encrypt_op(prefix, test_num, group_num) do { \ + test_encrypt_op(TEST_ ## prefix ## _GROUP_ ## group_num ## _KEY, \ + TEST_ ## prefix ## _GROUP_ ## group_num ## _KEY_LEN, \ + TEST_ ## prefix ## _ ## test_num ## _ADATA, \ + TEST_ ## prefix ## _ ## test_num ## _ADATA_LEN, \ + TEST_ ## prefix ## _ ## test_num ## _NONCE, \ + TEST_ ## prefix ## _ ## test_num ## _NONCE_LEN, \ + TEST_ ## prefix ## _ ## test_num ## _INPUT, \ + TEST_ ## prefix ## _ ## test_num ## _INPUT_LEN, \ + TEST_ ## prefix ## _ ## test_num ## _EXPECTED, \ + TEST_ ## prefix ## _ ## test_num ## _EXPECTED_LEN, \ + TEST_ ## prefix ## _GROUP_ ## group_num ## _MAC_LEN \ + ); \ +} while (0) + +#define do_test_decrypt_op(prefix, test_num, group_num) do { \ + test_decrypt_op(TEST_ ## prefix ## _GROUP_ ## group_num ## _KEY, \ + TEST_ ## prefix ## _GROUP_ ## group_num ## _KEY_LEN, \ + TEST_ ## prefix ## _ ## test_num ## _ADATA, \ + TEST_ ## prefix ## _ ## test_num ## _ADATA_LEN, \ + TEST_ ## prefix ## _ ## test_num ## _NONCE, \ + TEST_ ## prefix ## _ ## test_num ## _NONCE_LEN, \ + TEST_ ## prefix ## _ ## test_num ## _EXPECTED, \ + TEST_ ## prefix ## _ ## test_num ## _EXPECTED_LEN, \ + TEST_ ## prefix ## _ ## test_num ## _INPUT, \ + TEST_ ## prefix ## _ ## test_num ## _INPUT_LEN, \ + TEST_ ## prefix ## _GROUP_ ## group_num ## _MAC_LEN \ + ); \ +} while (0) + +static void test_crypto_modes_ccm_decrypt(void) +{ + do_test_decrypt_op(DVPT192, 0, 0); + do_test_decrypt_op(DVPT192, 4, 0); + do_test_decrypt_op(DVPT192, 11, 0); + do_test_decrypt_op(DVPT192, 12, 0); + do_test_decrypt_op(DVPT192, 13, 0); + do_test_decrypt_op(DVPT192, 15, 1); + do_test_decrypt_op(DVPT192, 19, 1); + do_test_decrypt_op(DVPT192, 26, 1); + do_test_decrypt_op(DVPT192, 27, 1); + do_test_decrypt_op(DVPT192, 28, 1); + do_test_decrypt_op(DVPT192, 30, 2); + do_test_decrypt_op(DVPT192, 34, 2); + do_test_decrypt_op(DVPT192, 41, 2); + do_test_decrypt_op(DVPT192, 42, 2); + do_test_decrypt_op(DVPT192, 43, 2); + do_test_decrypt_op(DVPT192, 45, 3); + do_test_decrypt_op(DVPT192, 49, 3); + do_test_decrypt_op(DVPT192, 56, 3); + do_test_decrypt_op(DVPT192, 57, 3); + do_test_decrypt_op(DVPT192, 58, 3); + do_test_decrypt_op(DVPT192, 60, 4); + do_test_decrypt_op(DVPT192, 64, 4); + do_test_decrypt_op(DVPT192, 71, 4); + do_test_decrypt_op(DVPT192, 72, 4); + do_test_decrypt_op(DVPT192, 73, 4); + do_test_decrypt_op(DVPT192, 75, 5); + do_test_decrypt_op(DVPT192, 79, 5); + do_test_decrypt_op(DVPT192, 86, 5); + do_test_decrypt_op(DVPT192, 87, 5); + do_test_decrypt_op(DVPT192, 88, 5); + do_test_decrypt_op(DVPT192, 90, 6); + do_test_decrypt_op(DVPT192, 94, 6); + do_test_decrypt_op(DVPT192, 101, 6); + do_test_decrypt_op(DVPT192, 102, 6); + do_test_decrypt_op(DVPT192, 103, 6); + do_test_decrypt_op(DVPT192, 105, 7); + do_test_decrypt_op(DVPT192, 109, 7); + do_test_decrypt_op(DVPT192, 116, 7); + do_test_decrypt_op(DVPT192, 117, 7); + do_test_decrypt_op(DVPT192, 118, 7); + do_test_decrypt_op(DVPT192, 120, 8); + do_test_decrypt_op(DVPT192, 124, 8); + do_test_decrypt_op(DVPT192, 131, 8); + do_test_decrypt_op(DVPT192, 132, 8); + do_test_decrypt_op(DVPT192, 133, 8); + do_test_decrypt_op(DVPT192, 135, 9); + do_test_decrypt_op(DVPT192, 139, 9); + do_test_decrypt_op(DVPT192, 146, 9); + do_test_decrypt_op(DVPT192, 147, 9); + do_test_decrypt_op(DVPT192, 148, 9); + do_test_decrypt_op(DVPT192, 150, 10); + do_test_decrypt_op(DVPT192, 154, 10); + do_test_decrypt_op(DVPT192, 161, 10); + do_test_decrypt_op(DVPT192, 162, 10); + do_test_decrypt_op(DVPT192, 163, 10); + do_test_decrypt_op(DVPT192, 165, 11); + do_test_decrypt_op(DVPT192, 169, 11); + do_test_decrypt_op(DVPT192, 176, 11); + do_test_decrypt_op(DVPT192, 177, 11); + do_test_decrypt_op(DVPT192, 178, 11); + do_test_decrypt_op(DVPT192, 180, 12); + do_test_decrypt_op(DVPT192, 184, 12); + do_test_decrypt_op(DVPT192, 191, 12); + do_test_decrypt_op(DVPT192, 192, 12); + do_test_decrypt_op(DVPT192, 193, 12); + do_test_decrypt_op(DVPT192, 195, 13); + do_test_decrypt_op(DVPT192, 199, 13); + do_test_decrypt_op(DVPT192, 206, 13); + do_test_decrypt_op(DVPT192, 207, 13); + do_test_decrypt_op(DVPT192, 208, 13); + do_test_decrypt_op(DVPT192, 210, 14); + do_test_decrypt_op(DVPT192, 214, 14); + do_test_decrypt_op(DVPT192, 221, 14); + do_test_decrypt_op(DVPT192, 222, 14); + do_test_decrypt_op(DVPT192, 223, 14); + do_test_decrypt_op(DVPT192, 225, 15); + do_test_decrypt_op(DVPT192, 229, 15); + do_test_decrypt_op(DVPT192, 236, 15); + do_test_decrypt_op(DVPT192, 237, 15); + do_test_decrypt_op(DVPT192, 238, 15); +} +static void test_crypto_modes_ccm_encrypt(void) +{ + do_test_encrypt_op(DVPT192, 0, 0); + do_test_encrypt_op(DVPT192, 4, 0); + do_test_encrypt_op(DVPT192, 11, 0); + do_test_encrypt_op(DVPT192, 12, 0); + do_test_encrypt_op(DVPT192, 13, 0); + do_test_encrypt_op(DVPT192, 15, 1); + do_test_encrypt_op(DVPT192, 19, 1); + do_test_encrypt_op(DVPT192, 26, 1); + do_test_encrypt_op(DVPT192, 27, 1); + do_test_encrypt_op(DVPT192, 28, 1); + do_test_encrypt_op(DVPT192, 30, 2); + do_test_encrypt_op(DVPT192, 34, 2); + do_test_encrypt_op(DVPT192, 41, 2); + do_test_encrypt_op(DVPT192, 42, 2); + do_test_encrypt_op(DVPT192, 43, 2); + do_test_encrypt_op(DVPT192, 45, 3); + do_test_encrypt_op(DVPT192, 49, 3); + do_test_encrypt_op(DVPT192, 56, 3); + do_test_encrypt_op(DVPT192, 57, 3); + do_test_encrypt_op(DVPT192, 58, 3); + do_test_encrypt_op(DVPT192, 60, 4); + do_test_encrypt_op(DVPT192, 64, 4); + do_test_encrypt_op(DVPT192, 71, 4); + do_test_encrypt_op(DVPT192, 72, 4); + do_test_encrypt_op(DVPT192, 73, 4); + do_test_encrypt_op(DVPT192, 75, 5); + do_test_encrypt_op(DVPT192, 79, 5); + do_test_encrypt_op(DVPT192, 86, 5); + do_test_encrypt_op(DVPT192, 87, 5); + do_test_encrypt_op(DVPT192, 88, 5); + do_test_encrypt_op(DVPT192, 90, 6); + do_test_encrypt_op(DVPT192, 94, 6); + do_test_encrypt_op(DVPT192, 101, 6); + do_test_encrypt_op(DVPT192, 102, 6); + do_test_encrypt_op(DVPT192, 103, 6); + do_test_encrypt_op(DVPT192, 105, 7); + do_test_encrypt_op(DVPT192, 109, 7); + do_test_encrypt_op(DVPT192, 116, 7); + do_test_encrypt_op(DVPT192, 117, 7); + do_test_encrypt_op(DVPT192, 118, 7); + do_test_encrypt_op(DVPT192, 120, 8); + do_test_encrypt_op(DVPT192, 124, 8); + do_test_encrypt_op(DVPT192, 131, 8); + do_test_encrypt_op(DVPT192, 132, 8); + do_test_encrypt_op(DVPT192, 133, 8); + do_test_encrypt_op(DVPT192, 135, 9); + do_test_encrypt_op(DVPT192, 139, 9); + do_test_encrypt_op(DVPT192, 146, 9); + do_test_encrypt_op(DVPT192, 147, 9); + do_test_encrypt_op(DVPT192, 148, 9); + do_test_encrypt_op(DVPT192, 150, 10); + do_test_encrypt_op(DVPT192, 154, 10); + do_test_encrypt_op(DVPT192, 161, 10); + do_test_encrypt_op(DVPT192, 162, 10); + do_test_encrypt_op(DVPT192, 163, 10); + do_test_encrypt_op(DVPT192, 165, 11); + do_test_encrypt_op(DVPT192, 169, 11); + do_test_encrypt_op(DVPT192, 176, 11); + do_test_encrypt_op(DVPT192, 177, 11); + do_test_encrypt_op(DVPT192, 178, 11); + do_test_encrypt_op(DVPT192, 180, 12); + do_test_encrypt_op(DVPT192, 184, 12); + do_test_encrypt_op(DVPT192, 191, 12); + do_test_encrypt_op(DVPT192, 192, 12); + do_test_encrypt_op(DVPT192, 193, 12); + do_test_encrypt_op(DVPT192, 195, 13); + do_test_encrypt_op(DVPT192, 199, 13); + do_test_encrypt_op(DVPT192, 206, 13); + do_test_encrypt_op(DVPT192, 207, 13); + do_test_encrypt_op(DVPT192, 208, 13); + do_test_encrypt_op(DVPT192, 210, 14); + do_test_encrypt_op(DVPT192, 214, 14); + do_test_encrypt_op(DVPT192, 221, 14); + do_test_encrypt_op(DVPT192, 222, 14); + do_test_encrypt_op(DVPT192, 223, 14); + do_test_encrypt_op(DVPT192, 225, 15); + do_test_encrypt_op(DVPT192, 229, 15); + do_test_encrypt_op(DVPT192, 236, 15); + do_test_encrypt_op(DVPT192, 237, 15); + do_test_encrypt_op(DVPT192, 238, 15); +} + +Test *tests_crypto_modes_ccm_tests_192(void) +{ + EMB_UNIT_TESTFIXTURES(fixtures) { + new_TestFixture(test_crypto_modes_ccm_encrypt), + new_TestFixture(test_crypto_modes_ccm_decrypt), + }; + + EMB_UNIT_TESTCALLER(crypto_modes_ccm_tests_192, NULL, NULL, fixtures); + + return (Test *)&crypto_modes_ccm_tests_192; +} diff --git a/tests/sys_crypto/tests-crypto-modes-ccm-256.c b/tests/sys_crypto/tests-crypto-modes-ccm-256.c new file mode 100644 index 0000000000..da509e1409 --- /dev/null +++ b/tests/sys_crypto/tests-crypto-modes-ccm-256.c @@ -0,0 +1,2470 @@ +/* + * Copyright (C) 2021 Freie Universität Berlin + * + * This file is subject to the terms and conditions of the GNU Lesser + * General Public License v2.1. See the file LICENSE in the top level + * directory for more details. + */ + +#include + +#include +#include +#include + +#include "embUnit.h" +#include "crypto/ciphers.h" +#include "crypto/modes/ccm.h" +#include "tests-crypto.h" + +/** + * AES CCM DVTP test vectors (SP 800-38C) for 256 bit keys. + * https://csrc.nist.gov/projects/cryptographic-algorithm-validation-program/cavp-testing-block-cipher-modes +*/ + +static const size_t nonce_and_len_encoding_size = 15; + +/* Alen = 0, Plen = 0, Nlen = 7, Tlen = 4 */ +static const uint8_t TEST_DVPT256_GROUP_0_MAC_LEN = 4; + +static const uint8_t TEST_DVPT256_GROUP_0_KEY[] = { + 0xed, 0xa3, 0x2f, 0x75, 0x14, 0x56, 0xe3, 0x31, + 0x95, 0xf1, 0xf4, 0x99, 0xcf, 0x2d, 0xc7, 0xc9, + 0x7e, 0xa1, 0x27, 0xb6, 0xd4, 0x88, 0xf2, 0x11, + 0xcc, 0xc5, 0x12, 0x6f, 0xbb, 0x24, 0xaf, 0xa6, +}; +static const size_t TEST_DVPT256_GROUP_0_KEY_LEN = 32; + +static const uint8_t TEST_DVPT256_0_NONCE[] = { + 0xa5, 0x44, 0x21, 0x8d, 0xad, 0xd3, 0xc1, +}; +static const size_t TEST_DVPT256_0_NONCE_LEN = 7; + +static const uint8_t TEST_DVPT256_0_ADATA[] = { + 0x00, +}; +static const size_t TEST_DVPT256_0_ADATA_LEN = 0; + +static const uint8_t TEST_DVPT256_0_EXPECTED[] = { + 0x46, 0x9c, 0x90, 0xbb, +}; +static const size_t TEST_DVPT256_0_EXPECTED_LEN = 4; + +static const uint8_t TEST_DVPT256_0_INPUT[] = { + 0x00, +}; +static const size_t TEST_DVPT256_0_INPUT_LEN = 0; + +static const uint8_t TEST_DVPT256_4_NONCE[] = { + 0xdb, 0xb3, 0x92, 0x31, 0x56, 0xcf, 0xd6, +}; +static const size_t TEST_DVPT256_4_NONCE_LEN = 7; + +static const uint8_t TEST_DVPT256_4_ADATA[] = { + 0x00, +}; +static const size_t TEST_DVPT256_4_ADATA_LEN = 0; + +static const uint8_t TEST_DVPT256_4_EXPECTED[] = { + 0x13, 0x02, 0xd5, 0x15, +}; +static const size_t TEST_DVPT256_4_EXPECTED_LEN = 4; + +static const uint8_t TEST_DVPT256_4_INPUT[] = { + 0x00, +}; +static const size_t TEST_DVPT256_4_INPUT_LEN = 0; + +static const uint8_t TEST_DVPT256_6_NONCE[] = { + 0xa2, 0x59, 0xc1, 0x14, 0xea, 0xac, 0x89, +}; +static const size_t TEST_DVPT256_6_NONCE_LEN = 7; + +static const uint8_t TEST_DVPT256_6_ADATA[] = { + 0x00, +}; +static const size_t TEST_DVPT256_6_ADATA_LEN = 0; + +static const uint8_t TEST_DVPT256_6_EXPECTED[] = { + 0x4f, 0xe0, 0x6e, 0x92, +}; +static const size_t TEST_DVPT256_6_EXPECTED_LEN = 4; + +static const uint8_t TEST_DVPT256_6_INPUT[] = { + 0x00, +}; +static const size_t TEST_DVPT256_6_INPUT_LEN = 0; + +static const uint8_t TEST_DVPT256_11_NONCE[] = { + 0xe1, 0xbe, 0x89, 0xaf, 0x98, 0xff, 0xd7, +}; +static const size_t TEST_DVPT256_11_NONCE_LEN = 7; + +static const uint8_t TEST_DVPT256_11_ADATA[] = { + 0x00, +}; +static const size_t TEST_DVPT256_11_ADATA_LEN = 0; + +static const uint8_t TEST_DVPT256_11_EXPECTED[] = { + 0xe5, 0x41, 0x7f, 0x6b, +}; +static const size_t TEST_DVPT256_11_EXPECTED_LEN = 4; + +static const uint8_t TEST_DVPT256_11_INPUT[] = { + 0x00, +}; +static const size_t TEST_DVPT256_11_INPUT_LEN = 0; + +static const uint8_t TEST_DVPT256_13_NONCE[] = { + 0x1a, 0xa7, 0x58, 0xeb, 0x2f, 0x9a, 0x28, +}; +static const size_t TEST_DVPT256_13_NONCE_LEN = 7; + +static const uint8_t TEST_DVPT256_13_ADATA[] = { + 0x00, +}; +static const size_t TEST_DVPT256_13_ADATA_LEN = 0; + +static const uint8_t TEST_DVPT256_13_EXPECTED[] = { + 0xf8, 0xfa, 0x8e, 0x71, +}; +static const size_t TEST_DVPT256_13_EXPECTED_LEN = 4; + +static const uint8_t TEST_DVPT256_13_INPUT[] = { + 0x00, +}; +static const size_t TEST_DVPT256_13_INPUT_LEN = 0; + +/* Alen = 0, Plen = 0, Nlen = 7, Tlen = 16 */ +static const uint8_t TEST_DVPT256_GROUP_1_MAC_LEN = 16; + +static const uint8_t TEST_DVPT256_GROUP_1_KEY[] = { + 0xe1, 0xb8, 0xa9, 0x27, 0xa9, 0x5e, 0xfe, 0x94, + 0x65, 0x66, 0x77, 0xb6, 0x92, 0x66, 0x20, 0x00, + 0x27, 0x8b, 0x44, 0x1c, 0x79, 0xe8, 0x79, 0xdd, + 0x5c, 0x0d, 0xdc, 0x75, 0x8b, 0xdc, 0x9e, 0xe8, +}; +static const size_t TEST_DVPT256_GROUP_1_KEY_LEN = 32; + +static const uint8_t TEST_DVPT256_15_NONCE[] = { + 0xa5, 0x44, 0x21, 0x8d, 0xad, 0xd3, 0xc1, +}; +static const size_t TEST_DVPT256_15_NONCE_LEN = 7; + +static const uint8_t TEST_DVPT256_15_ADATA[] = { + 0x00, +}; +static const size_t TEST_DVPT256_15_ADATA_LEN = 0; + +static const uint8_t TEST_DVPT256_15_EXPECTED[] = { + 0x82, 0x07, 0xeb, 0x14, 0xd3, 0x38, 0x55, 0xa5, + 0x2a, 0xcc, 0xee, 0xd1, 0x7d, 0xbc, 0xbf, 0x6e, +}; +static const size_t TEST_DVPT256_15_EXPECTED_LEN = 16; + +static const uint8_t TEST_DVPT256_15_INPUT[] = { + 0x00, +}; +static const size_t TEST_DVPT256_15_INPUT_LEN = 0; + +static const uint8_t TEST_DVPT256_19_NONCE[] = { + 0xdb, 0xb3, 0x92, 0x31, 0x56, 0xcf, 0xd6, +}; +static const size_t TEST_DVPT256_19_NONCE_LEN = 7; + +static const uint8_t TEST_DVPT256_19_ADATA[] = { + 0x00, +}; +static const size_t TEST_DVPT256_19_ADATA_LEN = 0; + +static const uint8_t TEST_DVPT256_19_EXPECTED[] = { + 0xe4, 0xdc, 0x5e, 0x03, 0xaa, 0xce, 0xa6, 0x91, + 0x26, 0x2e, 0xe6, 0x9c, 0xee, 0x8f, 0xfb, 0xbe, +}; +static const size_t TEST_DVPT256_19_EXPECTED_LEN = 16; + +static const uint8_t TEST_DVPT256_19_INPUT[] = { + 0x00, +}; +static const size_t TEST_DVPT256_19_INPUT_LEN = 0; + +static const uint8_t TEST_DVPT256_21_NONCE[] = { + 0xa2, 0x59, 0xc1, 0x14, 0xea, 0xac, 0x89, +}; +static const size_t TEST_DVPT256_21_NONCE_LEN = 7; + +static const uint8_t TEST_DVPT256_21_ADATA[] = { + 0x00, +}; +static const size_t TEST_DVPT256_21_ADATA_LEN = 0; + +static const uint8_t TEST_DVPT256_21_EXPECTED[] = { + 0xf7, 0x9c, 0x53, 0xfd, 0x5e, 0x69, 0x83, 0x5b, + 0x7e, 0x70, 0x49, 0x6e, 0xa9, 0x99, 0x71, 0x8b, +}; +static const size_t TEST_DVPT256_21_EXPECTED_LEN = 16; + +static const uint8_t TEST_DVPT256_21_INPUT[] = { + 0x00, +}; +static const size_t TEST_DVPT256_21_INPUT_LEN = 0; + +static const uint8_t TEST_DVPT256_26_NONCE[] = { + 0xe1, 0xbe, 0x89, 0xaf, 0x98, 0xff, 0xd7, +}; +static const size_t TEST_DVPT256_26_NONCE_LEN = 7; + +static const uint8_t TEST_DVPT256_26_ADATA[] = { + 0x00, +}; +static const size_t TEST_DVPT256_26_ADATA_LEN = 0; + +static const uint8_t TEST_DVPT256_26_EXPECTED[] = { + 0x10, 0xd3, 0xf6, 0xfe, 0x08, 0x28, 0x0d, 0x45, + 0xe6, 0x7e, 0x58, 0xfe, 0x41, 0xa7, 0xf0, 0x36, +}; +static const size_t TEST_DVPT256_26_EXPECTED_LEN = 16; + +static const uint8_t TEST_DVPT256_26_INPUT[] = { + 0x00, +}; +static const size_t TEST_DVPT256_26_INPUT_LEN = 0; + +static const uint8_t TEST_DVPT256_28_NONCE[] = { + 0x1a, 0xa7, 0x58, 0xeb, 0x2f, 0x9a, 0x28, +}; +static const size_t TEST_DVPT256_28_NONCE_LEN = 7; + +static const uint8_t TEST_DVPT256_28_ADATA[] = { + 0x00, +}; +static const size_t TEST_DVPT256_28_ADATA_LEN = 0; + +static const uint8_t TEST_DVPT256_28_EXPECTED[] = { + 0x25, 0x90, 0xdf, 0x24, 0x53, 0xcb, 0x94, 0xc3, + 0x04, 0xba, 0x0a, 0x2b, 0xff, 0x3f, 0x3c, 0x71, +}; +static const size_t TEST_DVPT256_28_EXPECTED_LEN = 16; + +static const uint8_t TEST_DVPT256_28_INPUT[] = { + 0x00, +}; +static const size_t TEST_DVPT256_28_INPUT_LEN = 0; + +/* Alen = 0, Plen = 0, Nlen = 13, Tlen = 4 */ +static const uint8_t TEST_DVPT256_GROUP_2_MAC_LEN = 4; + +static const uint8_t TEST_DVPT256_GROUP_2_KEY[] = { + 0xe1, 0xb8, 0xa9, 0x27, 0xa9, 0x5e, 0xfe, 0x94, + 0x65, 0x66, 0x77, 0xb6, 0x92, 0x66, 0x20, 0x00, + 0x27, 0x8b, 0x44, 0x1c, 0x79, 0xe8, 0x79, 0xdd, + 0x5c, 0x0d, 0xdc, 0x75, 0x8b, 0xdc, 0x9e, 0xe8, +}; +static const size_t TEST_DVPT256_GROUP_2_KEY_LEN = 32; + +static const uint8_t TEST_DVPT256_30_NONCE[] = { + 0xa5, 0x44, 0x21, 0x8d, 0xad, 0xd3, 0xc1, 0x05, + 0x83, 0xdb, 0x49, 0xcf, 0x39, +}; +static const size_t TEST_DVPT256_30_NONCE_LEN = 13; + +static const uint8_t TEST_DVPT256_30_ADATA[] = { + 0x00, +}; +static const size_t TEST_DVPT256_30_ADATA_LEN = 0; + +static const uint8_t TEST_DVPT256_30_EXPECTED[] = { + 0x8a, 0x19, 0xa1, 0x33, +}; +static const size_t TEST_DVPT256_30_EXPECTED_LEN = 4; + +static const uint8_t TEST_DVPT256_30_INPUT[] = { + 0x00, +}; +static const size_t TEST_DVPT256_30_INPUT_LEN = 0; + +static const uint8_t TEST_DVPT256_34_NONCE[] = { + 0x79, 0xac, 0x20, 0x4a, 0x26, 0xb9, 0xfe, 0xe1, + 0x13, 0x23, 0x70, 0xc2, 0x0f, +}; +static const size_t TEST_DVPT256_34_NONCE_LEN = 13; + +static const uint8_t TEST_DVPT256_34_ADATA[] = { + 0x00, +}; +static const size_t TEST_DVPT256_34_ADATA_LEN = 0; + +static const uint8_t TEST_DVPT256_34_EXPECTED[] = { + 0x15, 0x40, 0x24, 0xb2, +}; +static const size_t TEST_DVPT256_34_EXPECTED_LEN = 4; + +static const uint8_t TEST_DVPT256_34_INPUT[] = { + 0x00, +}; +static const size_t TEST_DVPT256_34_INPUT_LEN = 0; + +static const uint8_t TEST_DVPT256_36_NONCE[] = { + 0x05, 0x45, 0xfd, 0x9e, 0xcb, 0xc7, 0x3c, 0xcd, + 0xbb, 0xbd, 0x42, 0x44, 0xfd, +}; +static const size_t TEST_DVPT256_36_NONCE_LEN = 13; + +static const uint8_t TEST_DVPT256_36_ADATA[] = { + 0x00, +}; +static const size_t TEST_DVPT256_36_ADATA_LEN = 0; + +static const uint8_t TEST_DVPT256_36_EXPECTED[] = { + 0x5c, 0x34, 0x9f, 0xb2, +}; +static const size_t TEST_DVPT256_36_EXPECTED_LEN = 4; + +static const uint8_t TEST_DVPT256_36_INPUT[] = { + 0x00, +}; +static const size_t TEST_DVPT256_36_INPUT_LEN = 0; + +static const uint8_t TEST_DVPT256_41_NONCE[] = { + 0x0a, 0x37, 0xf2, 0xe7, 0xc6, 0x64, 0x90, 0xe9, + 0x72, 0x85, 0xf1, 0xb0, 0x9e, +}; +static const size_t TEST_DVPT256_41_NONCE_LEN = 13; + +static const uint8_t TEST_DVPT256_41_ADATA[] = { + 0x00, +}; +static const size_t TEST_DVPT256_41_ADATA_LEN = 0; + +static const uint8_t TEST_DVPT256_41_EXPECTED[] = { + 0xc5, 0x9b, 0xf1, 0x4c, +}; +static const size_t TEST_DVPT256_41_EXPECTED_LEN = 4; + +static const uint8_t TEST_DVPT256_41_INPUT[] = { + 0x00, +}; +static const size_t TEST_DVPT256_41_INPUT_LEN = 0; + +static const uint8_t TEST_DVPT256_43_NONCE[] = { + 0xc1, 0xad, 0x81, 0x2b, 0xf2, 0xbb, 0xb2, 0xcd, + 0xae, 0xe4, 0x63, 0x6e, 0xe7, +}; +static const size_t TEST_DVPT256_43_NONCE_LEN = 13; + +static const uint8_t TEST_DVPT256_43_ADATA[] = { + 0x00, +}; +static const size_t TEST_DVPT256_43_ADATA_LEN = 0; + +static const uint8_t TEST_DVPT256_43_EXPECTED[] = { + 0x5b, 0x96, 0xf4, 0x1d, +}; +static const size_t TEST_DVPT256_43_EXPECTED_LEN = 4; + +static const uint8_t TEST_DVPT256_43_INPUT[] = { + 0x00, +}; +static const size_t TEST_DVPT256_43_INPUT_LEN = 0; + +/* Alen = 0, Plen = 0, Nlen = 13, Tlen = 16 */ +static const uint8_t TEST_DVPT256_GROUP_3_MAC_LEN = 16; + +static const uint8_t TEST_DVPT256_GROUP_3_KEY[] = { + 0xaf, 0x06, 0x36, 0x39, 0xe6, 0x6c, 0x28, 0x40, + 0x83, 0xc5, 0xcf, 0x72, 0xb7, 0x0d, 0x8b, 0xc2, + 0x77, 0xf5, 0x97, 0x8e, 0x80, 0xd9, 0x32, 0x2d, + 0x99, 0xf2, 0xfd, 0xc7, 0x18, 0xcd, 0xa5, 0x69, +}; +static const size_t TEST_DVPT256_GROUP_3_KEY_LEN = 32; + +static const uint8_t TEST_DVPT256_45_NONCE[] = { + 0xa5, 0x44, 0x21, 0x8d, 0xad, 0xd3, 0xc1, 0x05, + 0x83, 0xdb, 0x49, 0xcf, 0x39, +}; +static const size_t TEST_DVPT256_45_NONCE_LEN = 13; + +static const uint8_t TEST_DVPT256_45_ADATA[] = { + 0x00, +}; +static const size_t TEST_DVPT256_45_ADATA_LEN = 0; + +static const uint8_t TEST_DVPT256_45_EXPECTED[] = { + 0x97, 0xe1, 0xa8, 0xdd, 0x42, 0x59, 0xcc, 0xd2, + 0xe4, 0x31, 0xe0, 0x57, 0xb0, 0x39, 0x7f, 0xcf, +}; +static const size_t TEST_DVPT256_45_EXPECTED_LEN = 16; + +static const uint8_t TEST_DVPT256_45_INPUT[] = { + 0x00, +}; +static const size_t TEST_DVPT256_45_INPUT_LEN = 0; + +static const uint8_t TEST_DVPT256_49_NONCE[] = { + 0x79, 0xac, 0x20, 0x4a, 0x26, 0xb9, 0xfe, 0xe1, + 0x13, 0x23, 0x70, 0xc2, 0x0f, +}; +static const size_t TEST_DVPT256_49_NONCE_LEN = 13; + +static const uint8_t TEST_DVPT256_49_ADATA[] = { + 0x00, +}; +static const size_t TEST_DVPT256_49_ADATA_LEN = 0; + +static const uint8_t TEST_DVPT256_49_EXPECTED[] = { + 0x5c, 0x8c, 0x9a, 0x5b, 0x97, 0xbe, 0x8c, 0x7b, + 0xc0, 0x1c, 0xa8, 0xd6, 0x93, 0xb8, 0x09, 0xf9, +}; +static const size_t TEST_DVPT256_49_EXPECTED_LEN = 16; + +static const uint8_t TEST_DVPT256_49_INPUT[] = { + 0x00, +}; +static const size_t TEST_DVPT256_49_INPUT_LEN = 0; + +static const uint8_t TEST_DVPT256_51_NONCE[] = { + 0x05, 0x45, 0xfd, 0x9e, 0xcb, 0xc7, 0x3c, 0xcd, + 0xbb, 0xbd, 0x42, 0x44, 0xfd, +}; +static const size_t TEST_DVPT256_51_NONCE_LEN = 13; + +static const uint8_t TEST_DVPT256_51_ADATA[] = { + 0x00, +}; +static const size_t TEST_DVPT256_51_ADATA_LEN = 0; + +static const uint8_t TEST_DVPT256_51_EXPECTED[] = { + 0x84, 0x20, 0x16, 0x62, 0xb2, 0x13, 0xc7, 0xa1, + 0xff, 0x0c, 0x1b, 0x3c, 0x25, 0xe4, 0xec, 0x45, +}; +static const size_t TEST_DVPT256_51_EXPECTED_LEN = 16; + +static const uint8_t TEST_DVPT256_51_INPUT[] = { + 0x00, +}; +static const size_t TEST_DVPT256_51_INPUT_LEN = 0; + +static const uint8_t TEST_DVPT256_56_NONCE[] = { + 0x0a, 0x37, 0xf2, 0xe7, 0xc6, 0x64, 0x90, 0xe9, + 0x72, 0x85, 0xf1, 0xb0, 0x9e, +}; +static const size_t TEST_DVPT256_56_NONCE_LEN = 13; + +static const uint8_t TEST_DVPT256_56_ADATA[] = { + 0x00, +}; +static const size_t TEST_DVPT256_56_ADATA_LEN = 0; + +static const uint8_t TEST_DVPT256_56_EXPECTED[] = { + 0x58, 0x6e, 0x72, 0x81, 0x93, 0xce, 0x6d, 0xb9, + 0xa9, 0x26, 0xb0, 0x3b, 0x2d, 0x77, 0xdd, 0x6e, +}; +static const size_t TEST_DVPT256_56_EXPECTED_LEN = 16; + +static const uint8_t TEST_DVPT256_56_INPUT[] = { + 0x00, +}; +static const size_t TEST_DVPT256_56_INPUT_LEN = 0; + +static const uint8_t TEST_DVPT256_58_NONCE[] = { + 0xc1, 0xad, 0x81, 0x2b, 0xf2, 0xbb, 0xb2, 0xcd, + 0xae, 0xe4, 0x63, 0x6e, 0xe7, +}; +static const size_t TEST_DVPT256_58_NONCE_LEN = 13; + +static const uint8_t TEST_DVPT256_58_ADATA[] = { + 0x00, +}; +static const size_t TEST_DVPT256_58_ADATA_LEN = 0; + +static const uint8_t TEST_DVPT256_58_EXPECTED[] = { + 0x64, 0x86, 0x4d, 0x21, 0xb6, 0xee, 0x3f, 0xca, + 0x13, 0xf0, 0x7f, 0xc0, 0x48, 0x6e, 0x23, 0x2d, +}; +static const size_t TEST_DVPT256_58_EXPECTED_LEN = 16; + +static const uint8_t TEST_DVPT256_58_INPUT[] = { + 0x00, +}; +static const size_t TEST_DVPT256_58_INPUT_LEN = 0; + +/* Alen = 0, Plen = 24, Nlen = 7, Tlen = 4 */ +static const uint8_t TEST_DVPT256_GROUP_4_MAC_LEN = 4; + +static const uint8_t TEST_DVPT256_GROUP_4_KEY[] = { + 0xaf, 0x06, 0x36, 0x39, 0xe6, 0x6c, 0x28, 0x40, + 0x83, 0xc5, 0xcf, 0x72, 0xb7, 0x0d, 0x8b, 0xc2, + 0x77, 0xf5, 0x97, 0x8e, 0x80, 0xd9, 0x32, 0x2d, + 0x99, 0xf2, 0xfd, 0xc7, 0x18, 0xcd, 0xa5, 0x69, +}; +static const size_t TEST_DVPT256_GROUP_4_KEY_LEN = 32; + +static const uint8_t TEST_DVPT256_60_NONCE[] = { + 0xa5, 0x44, 0x21, 0x8d, 0xad, 0xd3, 0xc1, +}; +static const size_t TEST_DVPT256_60_NONCE_LEN = 7; + +static const uint8_t TEST_DVPT256_60_ADATA[] = { + 0x00, +}; +static const size_t TEST_DVPT256_60_ADATA_LEN = 0; + +static const uint8_t TEST_DVPT256_60_EXPECTED[] = { + 0x64, 0xa1, 0x34, 0x16, 0x79, 0x97, 0x2d, 0xc5, + 0x86, 0x9f, 0xcf, 0x69, 0xb1, 0x9d, 0x5c, 0x5e, + 0xa5, 0x0a, 0xa0, 0xb5, 0xe9, 0x85, 0xf5, 0xb7, + 0x22, 0xaa, 0x8d, 0x59, +}; +static const size_t TEST_DVPT256_60_EXPECTED_LEN = 28; + +static const uint8_t TEST_DVPT256_60_INPUT[] = { + 0xd3, 0xd5, 0x42, 0x4e, 0x20, 0xfb, 0xec, 0x43, + 0xae, 0x49, 0x53, 0x53, 0xed, 0x83, 0x02, 0x71, + 0x51, 0x5a, 0xb1, 0x04, 0xf8, 0x86, 0x0c, 0x98, +}; +static const size_t TEST_DVPT256_60_INPUT_LEN = 24; + +static const uint8_t TEST_DVPT256_64_NONCE[] = { + 0x9d, 0x77, 0x3a, 0x31, 0xfe, 0x2e, 0xc7, +}; +static const size_t TEST_DVPT256_64_NONCE_LEN = 7; + +static const uint8_t TEST_DVPT256_64_ADATA[] = { + 0x00, +}; +static const size_t TEST_DVPT256_64_ADATA_LEN = 0; + +static const uint8_t TEST_DVPT256_64_EXPECTED[] = { + 0x5a, 0xcf, 0xbe, 0x5e, 0x48, 0x89, 0x76, 0xd8, + 0xb9, 0xb7, 0x7e, 0x69, 0xa7, 0x36, 0xe8, 0xc9, + 0x19, 0x05, 0x3f, 0x94, 0x15, 0x55, 0x12, 0x09, + 0xdc, 0xe2, 0xd2, 0x5e, +}; +static const size_t TEST_DVPT256_64_EXPECTED_LEN = 28; + +static const uint8_t TEST_DVPT256_64_INPUT[] = { + 0x83, 0x9d, 0x8c, 0xfa, 0x2c, 0x92, 0x1c, 0x3c, + 0xce, 0xb7, 0xd1, 0xf4, 0x6b, 0xd2, 0xea, 0xad, + 0x70, 0x6e, 0x53, 0xf6, 0x45, 0x23, 0xd8, 0xc0, +}; +static const size_t TEST_DVPT256_64_INPUT_LEN = 24; + +static const uint8_t TEST_DVPT256_66_NONCE[] = { + 0x24, 0xb7, 0xa6, 0x53, 0x91, 0xf8, 0x8b, +}; +static const size_t TEST_DVPT256_66_NONCE_LEN = 7; + +static const uint8_t TEST_DVPT256_66_ADATA[] = { + 0x00, +}; +static const size_t TEST_DVPT256_66_ADATA_LEN = 0; + +static const uint8_t TEST_DVPT256_66_EXPECTED[] = { + 0xf0, 0x06, 0x28, 0xe1, 0x0e, 0x8e, 0x01, 0x15, + 0xb4, 0xa4, 0x53, 0x2a, 0x12, 0x12, 0xa2, 0x3a, + 0xad, 0xe4, 0x09, 0x08, 0x32, 0xc1, 0x97, 0x2d, + 0x75, 0x01, 0x25, 0xf3, +}; +static const size_t TEST_DVPT256_66_EXPECTED_LEN = 28; + +static const uint8_t TEST_DVPT256_66_INPUT[] = { + 0x3b, 0xed, 0x52, 0x23, 0x61, 0x82, 0xc1, 0x94, + 0x18, 0x86, 0x7d, 0x46, 0x8d, 0xbf, 0x47, 0xc8, + 0xaa, 0xc4, 0x6c, 0x02, 0x44, 0x5f, 0x99, 0xbb, +}; +static const size_t TEST_DVPT256_66_INPUT_LEN = 24; + +static const uint8_t TEST_DVPT256_71_NONCE[] = { + 0xb6, 0x72, 0xc9, 0x13, 0x76, 0xf5, 0x33, +}; +static const size_t TEST_DVPT256_71_NONCE_LEN = 7; + +static const uint8_t TEST_DVPT256_71_ADATA[] = { + 0x00, +}; +static const size_t TEST_DVPT256_71_ADATA_LEN = 0; + +static const uint8_t TEST_DVPT256_71_EXPECTED[] = { + 0x75, 0x8a, 0xa0, 0x3d, 0xc7, 0x2c, 0x36, 0x2c, + 0x43, 0xb5, 0xf8, 0x5b, 0xfa, 0xa3, 0xdb, 0x4a, + 0x74, 0x86, 0x08, 0x87, 0xa8, 0xc2, 0x9e, 0x47, + 0xd5, 0x64, 0x28, 0x30, +}; +static const size_t TEST_DVPT256_71_EXPECTED_LEN = 28; + +static const uint8_t TEST_DVPT256_71_INPUT[] = { + 0x4f, 0x7a, 0x56, 0x1e, 0x61, 0xb7, 0x86, 0x17, + 0x19, 0xe4, 0x44, 0x50, 0x57, 0xac, 0x9b, 0x74, + 0xa9, 0xbe, 0x95, 0x3b, 0x77, 0x2b, 0x09, 0xec, +}; +static const size_t TEST_DVPT256_71_INPUT_LEN = 24; + +static const uint8_t TEST_DVPT256_73_NONCE[] = { + 0xa6, 0xd0, 0x1f, 0xb8, 0x8c, 0xa5, 0x47, +}; +static const size_t TEST_DVPT256_73_NONCE_LEN = 7; + +static const uint8_t TEST_DVPT256_73_ADATA[] = { + 0x00, +}; +static const size_t TEST_DVPT256_73_ADATA_LEN = 0; + +static const uint8_t TEST_DVPT256_73_EXPECTED[] = { + 0x61, 0x5c, 0xbe, 0xab, 0xbe, 0x16, 0x3b, 0xa8, + 0xbc, 0x9c, 0x07, 0x3d, 0xf9, 0xad, 0x40, 0x83, + 0x3f, 0xcf, 0x3f, 0x42, 0x46, 0x44, 0xcc, 0xc3, + 0x7a, 0xa9, 0x99, 0xd7, +}; +static const size_t TEST_DVPT256_73_EXPECTED_LEN = 28; + +static const uint8_t TEST_DVPT256_73_INPUT[] = { + 0xa3, 0x61, 0x55, 0xde, 0x47, 0x73, 0x64, 0x23, + 0x65, 0x91, 0xe4, 0x53, 0x00, 0x81, 0x14, 0x07, + 0x5b, 0x48, 0x72, 0x12, 0x0e, 0xf1, 0x72, 0x64, +}; +static const size_t TEST_DVPT256_73_INPUT_LEN = 24; + +/* Alen = 0, Plen = 24, Nlen = 7, Tlen = 16 */ +static const uint8_t TEST_DVPT256_GROUP_5_MAC_LEN = 16; + +static const uint8_t TEST_DVPT256_GROUP_5_KEY[] = { + 0xf7, 0x07, 0x9d, 0xfa, 0x3b, 0x5c, 0x7b, 0x05, + 0x63, 0x47, 0xd7, 0xe4, 0x37, 0xbc, 0xde, 0xd6, + 0x83, 0xab, 0xd6, 0xe2, 0xc9, 0xe0, 0x69, 0xd3, + 0x33, 0x28, 0x40, 0x82, 0xcb, 0xb5, 0xd4, 0x53, +}; +static const size_t TEST_DVPT256_GROUP_5_KEY_LEN = 32; + +static const uint8_t TEST_DVPT256_75_NONCE[] = { + 0xa5, 0x44, 0x21, 0x8d, 0xad, 0xd3, 0xc1, +}; +static const size_t TEST_DVPT256_75_NONCE_LEN = 7; + +static const uint8_t TEST_DVPT256_75_ADATA[] = { + 0x00, +}; +static const size_t TEST_DVPT256_75_ADATA_LEN = 0; + +static const uint8_t TEST_DVPT256_75_EXPECTED[] = { + 0xbc, 0x51, 0xc3, 0x92, 0x5a, 0x96, 0x0e, 0x77, + 0x32, 0x53, 0x3e, 0x4e, 0xf3, 0xa4, 0xf6, 0x9e, + 0xe6, 0x82, 0x6d, 0xe9, 0x52, 0xbc, 0xb0, 0xfd, + 0x37, 0x4f, 0x3b, 0xb6, 0xdb, 0x83, 0x77, 0xeb, + 0xfc, 0x79, 0x67, 0x48, 0x58, 0xc4, 0xf3, 0x05, +}; +static const size_t TEST_DVPT256_75_EXPECTED_LEN = 40; + +static const uint8_t TEST_DVPT256_75_INPUT[] = { + 0xd3, 0xd5, 0x42, 0x4e, 0x20, 0xfb, 0xec, 0x43, + 0xae, 0x49, 0x53, 0x53, 0xed, 0x83, 0x02, 0x71, + 0x51, 0x5a, 0xb1, 0x04, 0xf8, 0x86, 0x0c, 0x98, +}; +static const size_t TEST_DVPT256_75_INPUT_LEN = 24; + +static const uint8_t TEST_DVPT256_79_NONCE[] = { + 0x9d, 0x77, 0x3a, 0x31, 0xfe, 0x2e, 0xc7, +}; +static const size_t TEST_DVPT256_79_NONCE_LEN = 7; + +static const uint8_t TEST_DVPT256_79_ADATA[] = { + 0x00, +}; +static const size_t TEST_DVPT256_79_ADATA_LEN = 0; + +static const uint8_t TEST_DVPT256_79_EXPECTED[] = { + 0x45, 0x39, 0xbb, 0x13, 0x38, 0x2b, 0x03, 0x4d, + 0xdb, 0x16, 0xa3, 0x32, 0x91, 0x48, 0xf9, 0x24, + 0x3a, 0x4e, 0xee, 0x99, 0x8f, 0xe4, 0x44, 0xaf, + 0xf2, 0x87, 0x0c, 0xe1, 0x98, 0xaf, 0x11, 0xf4, + 0xfb, 0x69, 0x8a, 0x67, 0xaf, 0x6c, 0x89, 0xad, +}; +static const size_t TEST_DVPT256_79_EXPECTED_LEN = 40; + +static const uint8_t TEST_DVPT256_79_INPUT[] = { + 0x83, 0x9d, 0x8c, 0xfa, 0x2c, 0x92, 0x1c, 0x3c, + 0xce, 0xb7, 0xd1, 0xf4, 0x6b, 0xd2, 0xea, 0xad, + 0x70, 0x6e, 0x53, 0xf6, 0x45, 0x23, 0xd8, 0xc0, +}; +static const size_t TEST_DVPT256_79_INPUT_LEN = 24; + +static const uint8_t TEST_DVPT256_81_NONCE[] = { + 0x24, 0xb7, 0xa6, 0x53, 0x91, 0xf8, 0x8b, +}; +static const size_t TEST_DVPT256_81_NONCE_LEN = 7; + +static const uint8_t TEST_DVPT256_81_ADATA[] = { + 0x00, +}; +static const size_t TEST_DVPT256_81_ADATA_LEN = 0; + +static const uint8_t TEST_DVPT256_81_EXPECTED[] = { + 0x6d, 0x0f, 0x92, 0x83, 0x52, 0xa1, 0x7d, 0x63, + 0xac, 0xa1, 0x89, 0x9c, 0xbd, 0x30, 0x5e, 0x1f, + 0x83, 0x1f, 0x16, 0x38, 0xd2, 0x7c, 0x1e, 0x24, + 0x43, 0x27, 0x04, 0xef, 0xf9, 0xb6, 0x83, 0x04, + 0x76, 0xdb, 0x3d, 0x30, 0xd4, 0xc1, 0x03, 0xe4, +}; +static const size_t TEST_DVPT256_81_EXPECTED_LEN = 40; + +static const uint8_t TEST_DVPT256_81_INPUT[] = { + 0x3b, 0xed, 0x52, 0x23, 0x61, 0x82, 0xc1, 0x94, + 0x18, 0x86, 0x7d, 0x46, 0x8d, 0xbf, 0x47, 0xc8, + 0xaa, 0xc4, 0x6c, 0x02, 0x44, 0x5f, 0x99, 0xbb, +}; +static const size_t TEST_DVPT256_81_INPUT_LEN = 24; + +static const uint8_t TEST_DVPT256_86_NONCE[] = { + 0xb6, 0x72, 0xc9, 0x13, 0x76, 0xf5, 0x33, +}; +static const size_t TEST_DVPT256_86_NONCE_LEN = 7; + +static const uint8_t TEST_DVPT256_86_ADATA[] = { + 0x00, +}; +static const size_t TEST_DVPT256_86_ADATA_LEN = 0; + +static const uint8_t TEST_DVPT256_86_EXPECTED[] = { + 0xf2, 0x3a, 0xc1, 0x42, 0x6c, 0xb1, 0x13, 0x0c, + 0x9a, 0x09, 0x13, 0xb3, 0x47, 0xd8, 0xef, 0xaf, + 0xb6, 0xed, 0x12, 0x59, 0x13, 0xaa, 0x67, 0x8a, + 0x9d, 0xc4, 0x2d, 0x22, 0xa5, 0x43, 0x6b, 0xc1, + 0x2e, 0xff, 0x55, 0x05, 0xed, 0xb2, 0x5e, 0x19, +}; +static const size_t TEST_DVPT256_86_EXPECTED_LEN = 40; + +static const uint8_t TEST_DVPT256_86_INPUT[] = { + 0x4f, 0x7a, 0x56, 0x1e, 0x61, 0xb7, 0x86, 0x17, + 0x19, 0xe4, 0x44, 0x50, 0x57, 0xac, 0x9b, 0x74, + 0xa9, 0xbe, 0x95, 0x3b, 0x77, 0x2b, 0x09, 0xec, +}; +static const size_t TEST_DVPT256_86_INPUT_LEN = 24; + +static const uint8_t TEST_DVPT256_88_NONCE[] = { + 0xa6, 0xd0, 0x1f, 0xb8, 0x8c, 0xa5, 0x47, +}; +static const size_t TEST_DVPT256_88_NONCE_LEN = 7; + +static const uint8_t TEST_DVPT256_88_ADATA[] = { + 0x00, +}; +static const size_t TEST_DVPT256_88_ADATA_LEN = 0; + +static const uint8_t TEST_DVPT256_88_EXPECTED[] = { + 0x77, 0x3b, 0x8e, 0xea, 0x2e, 0x98, 0x30, 0x29, + 0x7a, 0xc1, 0x1d, 0x3c, 0x1f, 0x6e, 0xa4, 0x00, + 0x8c, 0x96, 0x04, 0x0e, 0x83, 0xd7, 0x6d, 0x55, + 0x78, 0x9d, 0x20, 0x43, 0x17, 0x9f, 0xdd, 0x8f, + 0xdc, 0xbd, 0x52, 0x31, 0x3b, 0x7b, 0x15, 0xcb, +}; +static const size_t TEST_DVPT256_88_EXPECTED_LEN = 40; + +static const uint8_t TEST_DVPT256_88_INPUT[] = { + 0xa3, 0x61, 0x55, 0xde, 0x47, 0x73, 0x64, 0x23, + 0x65, 0x91, 0xe4, 0x53, 0x00, 0x81, 0x14, 0x07, + 0x5b, 0x48, 0x72, 0x12, 0x0e, 0xf1, 0x72, 0x64, +}; +static const size_t TEST_DVPT256_88_INPUT_LEN = 24; + +/* Alen = 0, Plen = 24, Nlen = 13, Tlen = 4 */ +static const uint8_t TEST_DVPT256_GROUP_6_MAC_LEN = 4; + +static const uint8_t TEST_DVPT256_GROUP_6_KEY[] = { + 0xf7, 0x07, 0x9d, 0xfa, 0x3b, 0x5c, 0x7b, 0x05, + 0x63, 0x47, 0xd7, 0xe4, 0x37, 0xbc, 0xde, 0xd6, + 0x83, 0xab, 0xd6, 0xe2, 0xc9, 0xe0, 0x69, 0xd3, + 0x33, 0x28, 0x40, 0x82, 0xcb, 0xb5, 0xd4, 0x53, +}; +static const size_t TEST_DVPT256_GROUP_6_KEY_LEN = 32; + +static const uint8_t TEST_DVPT256_90_NONCE[] = { + 0xa5, 0x44, 0x21, 0x8d, 0xad, 0xd3, 0xc1, 0x05, + 0x83, 0xdb, 0x49, 0xcf, 0x39, +}; +static const size_t TEST_DVPT256_90_NONCE_LEN = 13; + +static const uint8_t TEST_DVPT256_90_ADATA[] = { + 0x00, +}; +static const size_t TEST_DVPT256_90_ADATA_LEN = 0; + +static const uint8_t TEST_DVPT256_90_EXPECTED[] = { + 0x63, 0xe0, 0x0d, 0x30, 0xe4, 0xb0, 0x8f, 0xd2, + 0xa1, 0xcc, 0x8d, 0x70, 0xfa, 0xb3, 0x27, 0xb2, + 0x36, 0x8e, 0x77, 0xa9, 0x3b, 0xe4, 0xf4, 0x12, + 0x3d, 0x14, 0xfb, 0x3f, +}; +static const size_t TEST_DVPT256_90_EXPECTED_LEN = 28; + +static const uint8_t TEST_DVPT256_90_INPUT[] = { + 0x3c, 0x0e, 0x28, 0x15, 0xd3, 0x7d, 0x84, 0x4f, + 0x7a, 0xc2, 0x40, 0xba, 0x9d, 0x6e, 0x3a, 0x0b, + 0x2a, 0x86, 0xf7, 0x06, 0xe8, 0x85, 0x95, 0x9e, +}; +static const size_t TEST_DVPT256_90_INPUT_LEN = 24; + +static const uint8_t TEST_DVPT256_94_NONCE[] = { + 0x15, 0x01, 0xa2, 0x43, 0xbf, 0x60, 0xb2, 0xcb, + 0x40, 0xd5, 0xaa, 0x20, 0xca, +}; +static const size_t TEST_DVPT256_94_NONCE_LEN = 13; + +static const uint8_t TEST_DVPT256_94_ADATA[] = { + 0x00, +}; +static const size_t TEST_DVPT256_94_ADATA_LEN = 0; + +static const uint8_t TEST_DVPT256_94_EXPECTED[] = { + 0x37, 0x7b, 0x2f, 0x1e, 0x7b, 0xd9, 0xe3, 0xd1, + 0x07, 0x70, 0x38, 0xe0, 0x84, 0xf6, 0x19, 0x50, + 0x76, 0x13, 0x61, 0x09, 0x5f, 0x7e, 0xee, 0xbb, + 0xf1, 0xa7, 0x2a, 0xfc, +}; +static const size_t TEST_DVPT256_94_EXPECTED_LEN = 28; + +static const uint8_t TEST_DVPT256_94_INPUT[] = { + 0xf5, 0x73, 0x0a, 0x05, 0xfe, 0xc3, 0x1a, 0x11, + 0x66, 0x2e, 0x2e, 0x14, 0xe3, 0x62, 0xcc, 0xc7, + 0x5c, 0x7c, 0x30, 0xcd, 0xfc, 0xcb, 0xf9, 0x94, +}; +static const size_t TEST_DVPT256_94_INPUT_LEN = 24; + +static const uint8_t TEST_DVPT256_96_NONCE[] = { + 0xd6, 0x5e, 0x0e, 0x53, 0xf7, 0x65, 0xf9, 0xd5, + 0xe6, 0x79, 0x5c, 0x0c, 0x5e, +}; +static const size_t TEST_DVPT256_96_NONCE_LEN = 13; + +static const uint8_t TEST_DVPT256_96_ADATA[] = { + 0x00, +}; +static const size_t TEST_DVPT256_96_ADATA_LEN = 0; + +static const uint8_t TEST_DVPT256_96_EXPECTED[] = { + 0x6c, 0xab, 0x30, 0x60, 0xbf, 0x3b, 0x33, 0xb1, + 0x63, 0xb9, 0x33, 0xc2, 0xed, 0x0b, 0xa5, 0x14, + 0x06, 0x81, 0x0b, 0x54, 0xd0, 0xed, 0xcf, 0x5c, + 0x9d, 0x0e, 0xf4, 0xf7, +}; +static const size_t TEST_DVPT256_96_EXPECTED_LEN = 28; + +static const uint8_t TEST_DVPT256_96_INPUT[] = { + 0x20, 0xe3, 0x94, 0xc7, 0xcc, 0x90, 0xbd, 0xfa, + 0x61, 0x86, 0xfc, 0x1b, 0xa6, 0xff, 0xf1, 0x58, + 0xdf, 0xc6, 0x90, 0xe2, 0x4b, 0xa4, 0xc9, 0xfb, +}; +static const size_t TEST_DVPT256_96_INPUT_LEN = 24; + +static const uint8_t TEST_DVPT256_101_NONCE[] = { + 0xa6, 0xb2, 0x37, 0x1a, 0xcf, 0x83, 0x21, 0x86, + 0x4c, 0x08, 0xdd, 0xb4, 0xd8, +}; +static const size_t TEST_DVPT256_101_NONCE_LEN = 13; + +static const uint8_t TEST_DVPT256_101_ADATA[] = { + 0x00, +}; +static const size_t TEST_DVPT256_101_ADATA_LEN = 0; + +static const uint8_t TEST_DVPT256_101_EXPECTED[] = { + 0xc5, 0xaa, 0x50, 0x0d, 0x1f, 0x7c, 0x09, 0xa5, + 0x90, 0xe9, 0xd1, 0x5d, 0x68, 0x60, 0xc4, 0x43, + 0x36, 0x84, 0xe0, 0x4d, 0xd6, 0xbc, 0x5c, 0x8f, + 0x94, 0xf2, 0x23, 0xf0, +}; +static const size_t TEST_DVPT256_101_EXPECTED_LEN = 28; + +static const uint8_t TEST_DVPT256_101_INPUT[] = { + 0x1a, 0x43, 0xca, 0x62, 0x80, 0x26, 0x21, 0x9c, + 0x5a, 0x43, 0x0c, 0x54, 0x02, 0x1a, 0x5a, 0x31, + 0x52, 0xae, 0x51, 0x71, 0x67, 0x39, 0x96, 0x35, +}; +static const size_t TEST_DVPT256_101_INPUT_LEN = 24; + +static const uint8_t TEST_DVPT256_103_NONCE[] = { + 0xc2, 0xb6, 0x0f, 0x14, 0xc8, 0x94, 0xec, 0x61, + 0x78, 0xfe, 0x79, 0x91, 0x9f, +}; +static const size_t TEST_DVPT256_103_NONCE_LEN = 13; + +static const uint8_t TEST_DVPT256_103_ADATA[] = { + 0x00, +}; +static const size_t TEST_DVPT256_103_ADATA_LEN = 0; + +static const uint8_t TEST_DVPT256_103_EXPECTED[] = { + 0x85, 0x2c, 0xca, 0x90, 0x3d, 0x7f, 0xdf, 0x89, + 0x98, 0x07, 0xbd, 0x14, 0x64, 0x20, 0x57, 0x53, + 0x4c, 0x8a, 0x0c, 0xca, 0xcb, 0x8c, 0x7b, 0x8f, + 0xb4, 0xd3, 0x5d, 0x44, +}; +static const size_t TEST_DVPT256_103_EXPECTED_LEN = 28; + +static const uint8_t TEST_DVPT256_103_INPUT[] = { + 0x3e, 0x70, 0x7d, 0x98, 0xf1, 0x99, 0x72, 0xa6, + 0x3d, 0x91, 0x3e, 0x6e, 0xa7, 0x53, 0x3a, 0xf2, + 0xf4, 0x1f, 0xf9, 0x8a, 0xee, 0x2b, 0x2a, 0x36, +}; +static const size_t TEST_DVPT256_103_INPUT_LEN = 24; + +/* Alen = 0, Plen = 24, Nlen = 13, Tlen = 16 */ +static const uint8_t TEST_DVPT256_GROUP_7_MAC_LEN = 16; + +static const uint8_t TEST_DVPT256_GROUP_7_KEY[] = { + 0x1b, 0x0e, 0x8d, 0xf6, 0x3c, 0x57, 0xf0, 0x5d, + 0x9a, 0xc4, 0x57, 0x57, 0x5e, 0xa7, 0x64, 0x52, + 0x4b, 0x86, 0x10, 0xae, 0x51, 0x64, 0xe6, 0x21, + 0x5f, 0x42, 0x6f, 0x5a, 0x7a, 0xe6, 0xed, 0xe4, +}; +static const size_t TEST_DVPT256_GROUP_7_KEY_LEN = 32; + +static const uint8_t TEST_DVPT256_105_NONCE[] = { + 0xa5, 0x44, 0x21, 0x8d, 0xad, 0xd3, 0xc1, 0x05, + 0x83, 0xdb, 0x49, 0xcf, 0x39, +}; +static const size_t TEST_DVPT256_105_NONCE_LEN = 13; + +static const uint8_t TEST_DVPT256_105_ADATA[] = { + 0x00, +}; +static const size_t TEST_DVPT256_105_ADATA_LEN = 0; + +static const uint8_t TEST_DVPT256_105_EXPECTED[] = { + 0xf0, 0x05, 0x0a, 0xd1, 0x63, 0x92, 0x02, 0x1a, + 0x3f, 0x40, 0x20, 0x7b, 0xed, 0x35, 0x21, 0xfb, + 0x1e, 0x9f, 0x80, 0x8f, 0x49, 0x83, 0x0c, 0x42, + 0x3a, 0x57, 0x8d, 0x17, 0x99, 0x02, 0xf9, 0x12, + 0xf9, 0xea, 0x1a, 0xfb, 0xce, 0x11, 0x20, 0xb3, +}; +static const size_t TEST_DVPT256_105_EXPECTED_LEN = 40; + +static const uint8_t TEST_DVPT256_105_INPUT[] = { + 0x3c, 0x0e, 0x28, 0x15, 0xd3, 0x7d, 0x84, 0x4f, + 0x7a, 0xc2, 0x40, 0xba, 0x9d, 0x6e, 0x3a, 0x0b, + 0x2a, 0x86, 0xf7, 0x06, 0xe8, 0x85, 0x95, 0x9e, +}; +static const size_t TEST_DVPT256_105_INPUT_LEN = 24; + +static const uint8_t TEST_DVPT256_109_NONCE[] = { + 0x15, 0x01, 0xa2, 0x43, 0xbf, 0x60, 0xb2, 0xcb, + 0x40, 0xd5, 0xaa, 0x20, 0xca, +}; +static const size_t TEST_DVPT256_109_NONCE_LEN = 13; + +static const uint8_t TEST_DVPT256_109_ADATA[] = { + 0x00, +}; +static const size_t TEST_DVPT256_109_ADATA_LEN = 0; + +static const uint8_t TEST_DVPT256_109_EXPECTED[] = { + 0x25, 0x4b, 0x84, 0x7d, 0x41, 0x75, 0xbb, 0xb4, + 0x4a, 0x82, 0xb4, 0xe8, 0x05, 0x51, 0x4f, 0xa4, + 0x44, 0xc2, 0x24, 0x71, 0x09, 0x33, 0xf3, 0xec, + 0x8a, 0xaa, 0x3f, 0x01, 0x33, 0x23, 0x4c, 0x0c, + 0xd9, 0x16, 0x09, 0x98, 0x2a, 0xdc, 0x03, 0x4b, +}; +static const size_t TEST_DVPT256_109_EXPECTED_LEN = 40; + +static const uint8_t TEST_DVPT256_109_INPUT[] = { + 0xf5, 0x73, 0x0a, 0x05, 0xfe, 0xc3, 0x1a, 0x11, + 0x66, 0x2e, 0x2e, 0x14, 0xe3, 0x62, 0xcc, 0xc7, + 0x5c, 0x7c, 0x30, 0xcd, 0xfc, 0xcb, 0xf9, 0x94, +}; +static const size_t TEST_DVPT256_109_INPUT_LEN = 24; + +static const uint8_t TEST_DVPT256_111_NONCE[] = { + 0xd6, 0x5e, 0x0e, 0x53, 0xf7, 0x65, 0xf9, 0xd5, + 0xe6, 0x79, 0x5c, 0x0c, 0x5e, +}; +static const size_t TEST_DVPT256_111_NONCE_LEN = 13; + +static const uint8_t TEST_DVPT256_111_ADATA[] = { + 0x00, +}; +static const size_t TEST_DVPT256_111_ADATA_LEN = 0; + +static const uint8_t TEST_DVPT256_111_EXPECTED[] = { + 0xc3, 0x61, 0x8c, 0x99, 0x1b, 0x15, 0xde, 0x64, + 0x1d, 0x29, 0x14, 0x19, 0xff, 0x69, 0x57, 0xe8, + 0xb9, 0xae, 0x50, 0x46, 0xdd, 0x8c, 0x6f, 0x08, + 0xfa, 0xfb, 0x76, 0xad, 0xf1, 0x2f, 0x36, 0x74, + 0x03, 0x47, 0xe3, 0xed, 0xae, 0x62, 0xbc, 0xa4, +}; +static const size_t TEST_DVPT256_111_EXPECTED_LEN = 40; + +static const uint8_t TEST_DVPT256_111_INPUT[] = { + 0x20, 0xe3, 0x94, 0xc7, 0xcc, 0x90, 0xbd, 0xfa, + 0x61, 0x86, 0xfc, 0x1b, 0xa6, 0xff, 0xf1, 0x58, + 0xdf, 0xc6, 0x90, 0xe2, 0x4b, 0xa4, 0xc9, 0xfb, +}; +static const size_t TEST_DVPT256_111_INPUT_LEN = 24; + +static const uint8_t TEST_DVPT256_116_NONCE[] = { + 0xa6, 0xb2, 0x37, 0x1a, 0xcf, 0x83, 0x21, 0x86, + 0x4c, 0x08, 0xdd, 0xb4, 0xd8, +}; +static const size_t TEST_DVPT256_116_NONCE_LEN = 13; + +static const uint8_t TEST_DVPT256_116_ADATA[] = { + 0x00, +}; +static const size_t TEST_DVPT256_116_ADATA_LEN = 0; + +static const uint8_t TEST_DVPT256_116_EXPECTED[] = { + 0xbd, 0x37, 0x32, 0x6d, 0xa1, 0x8e, 0x5a, 0xc7, + 0x9a, 0x1a, 0x95, 0x12, 0xf7, 0x24, 0xbb, 0x53, + 0x95, 0x30, 0x86, 0x85, 0x76, 0xb7, 0x9c, 0x67, + 0xac, 0xb5, 0xa5, 0x1d, 0x10, 0xa5, 0x8d, 0x65, + 0x84, 0xfb, 0xe7, 0x3f, 0x10, 0x63, 0xc3, 0x1b, +}; +static const size_t TEST_DVPT256_116_EXPECTED_LEN = 40; + +static const uint8_t TEST_DVPT256_116_INPUT[] = { + 0x1a, 0x43, 0xca, 0x62, 0x80, 0x26, 0x21, 0x9c, + 0x5a, 0x43, 0x0c, 0x54, 0x02, 0x1a, 0x5a, 0x31, + 0x52, 0xae, 0x51, 0x71, 0x67, 0x39, 0x96, 0x35, +}; +static const size_t TEST_DVPT256_116_INPUT_LEN = 24; + +static const uint8_t TEST_DVPT256_118_NONCE[] = { + 0xc2, 0xb6, 0x0f, 0x14, 0xc8, 0x94, 0xec, 0x61, + 0x78, 0xfe, 0x79, 0x91, 0x9f, +}; +static const size_t TEST_DVPT256_118_NONCE_LEN = 13; + +static const uint8_t TEST_DVPT256_118_ADATA[] = { + 0x00, +}; +static const size_t TEST_DVPT256_118_ADATA_LEN = 0; + +static const uint8_t TEST_DVPT256_118_EXPECTED[] = { + 0xec, 0xd3, 0x37, 0x64, 0x00, 0x22, 0x63, 0x5c, + 0xe1, 0xed, 0x27, 0x37, 0x56, 0xd0, 0x2b, 0x7f, + 0xee, 0xb2, 0x51, 0x56, 0x14, 0xc1, 0xfa, 0xdc, + 0x95, 0xc6, 0x6d, 0x3f, 0x41, 0x1b, 0x47, 0x88, + 0x53, 0x88, 0x6a, 0xfd, 0x17, 0x7d, 0x88, 0xc3, +}; +static const size_t TEST_DVPT256_118_EXPECTED_LEN = 40; + +static const uint8_t TEST_DVPT256_118_INPUT[] = { + 0x3e, 0x70, 0x7d, 0x98, 0xf1, 0x99, 0x72, 0xa6, + 0x3d, 0x91, 0x3e, 0x6e, 0xa7, 0x53, 0x3a, 0xf2, + 0xf4, 0x1f, 0xf9, 0x8a, 0xee, 0x2b, 0x2a, 0x36, +}; +static const size_t TEST_DVPT256_118_INPUT_LEN = 24; + +/* Alen = 32, Plen = 0, Nlen = 7, Tlen = 4 */ +static const uint8_t TEST_DVPT256_GROUP_8_MAC_LEN = 4; + +static const uint8_t TEST_DVPT256_GROUP_8_KEY[] = { + 0x1b, 0x0e, 0x8d, 0xf6, 0x3c, 0x57, 0xf0, 0x5d, + 0x9a, 0xc4, 0x57, 0x57, 0x5e, 0xa7, 0x64, 0x52, + 0x4b, 0x86, 0x10, 0xae, 0x51, 0x64, 0xe6, 0x21, + 0x5f, 0x42, 0x6f, 0x5a, 0x7a, 0xe6, 0xed, 0xe4, +}; +static const size_t TEST_DVPT256_GROUP_8_KEY_LEN = 32; + +static const uint8_t TEST_DVPT256_120_NONCE[] = { + 0xa5, 0x44, 0x21, 0x8d, 0xad, 0xd3, 0xc1, +}; +static const size_t TEST_DVPT256_120_NONCE_LEN = 7; + +static const uint8_t TEST_DVPT256_120_ADATA[] = { + 0xd3, 0xd5, 0x42, 0x4e, 0x20, 0xfb, 0xec, 0x43, + 0xae, 0x49, 0x53, 0x53, 0xed, 0x83, 0x02, 0x71, + 0x51, 0x5a, 0xb1, 0x04, 0xf8, 0x86, 0x0c, 0x98, + 0x8d, 0x15, 0xb6, 0xd3, 0x6c, 0x03, 0x8e, 0xab, +}; +static const size_t TEST_DVPT256_120_ADATA_LEN = 32; + +static const uint8_t TEST_DVPT256_120_EXPECTED[] = { + 0x92, 0xd0, 0x0f, 0xbe, +}; +static const size_t TEST_DVPT256_120_EXPECTED_LEN = 4; + +static const uint8_t TEST_DVPT256_120_INPUT[] = { + 0x00, +}; +static const size_t TEST_DVPT256_120_INPUT_LEN = 0; + +static const uint8_t TEST_DVPT256_124_NONCE[] = { + 0x3f, 0xcb, 0x32, 0x8b, 0xc9, 0x64, 0x04, +}; +static const size_t TEST_DVPT256_124_NONCE_LEN = 7; + +static const uint8_t TEST_DVPT256_124_ADATA[] = { + 0x10, 0xb2, 0xff, 0xed, 0x4f, 0x95, 0xaf, 0x0f, + 0x98, 0xed, 0x4f, 0x77, 0xc6, 0x77, 0xb5, 0x78, + 0x6a, 0xd0, 0x1b, 0x31, 0xc0, 0x95, 0xbb, 0xc6, + 0xe1, 0xc9, 0x9c, 0xf1, 0x39, 0x77, 0xab, 0xba, +}; +static const size_t TEST_DVPT256_124_ADATA_LEN = 32; + +static const uint8_t TEST_DVPT256_124_EXPECTED[] = { + 0x11, 0x25, 0x00, 0x56, +}; +static const size_t TEST_DVPT256_124_EXPECTED_LEN = 4; + +static const uint8_t TEST_DVPT256_124_INPUT[] = { + 0x00, +}; +static const size_t TEST_DVPT256_124_INPUT_LEN = 0; + +static const uint8_t TEST_DVPT256_126_NONCE[] = { + 0xc4, 0x2a, 0xc6, 0x3d, 0xe6, 0xf1, 0x2a, +}; +static const size_t TEST_DVPT256_126_NONCE_LEN = 7; + +static const uint8_t TEST_DVPT256_126_ADATA[] = { + 0x7f, 0xf8, 0xd0, 0x6c, 0x5a, 0xbc, 0xc5, 0x0d, + 0x38, 0x20, 0xde, 0x34, 0xb0, 0x30, 0x89, 0xe6, + 0xc5, 0xb2, 0x02, 0xbc, 0xba, 0xab, 0xca, 0x89, + 0x28, 0x25, 0x55, 0x3d, 0x4d, 0x30, 0x02, 0x0a, +}; +static const size_t TEST_DVPT256_126_ADATA_LEN = 32; + +static const uint8_t TEST_DVPT256_126_EXPECTED[] = { + 0x4e, 0xed, 0x80, 0xfd, +}; +static const size_t TEST_DVPT256_126_EXPECTED_LEN = 4; + +static const uint8_t TEST_DVPT256_126_INPUT[] = { + 0x00, +}; +static const size_t TEST_DVPT256_126_INPUT_LEN = 0; + +static const uint8_t TEST_DVPT256_131_NONCE[] = { + 0x3a, 0x17, 0x01, 0xb1, 0x85, 0xd3, 0x3a, +}; +static const size_t TEST_DVPT256_131_NONCE_LEN = 7; + +static const uint8_t TEST_DVPT256_131_ADATA[] = { + 0xe5, 0xd5, 0x4d, 0xf8, 0xed, 0x9f, 0x89, 0xb9, + 0x8c, 0x5e, 0xbb, 0x1b, 0xc5, 0xd5, 0x27, 0x9c, + 0x2e, 0x18, 0x27, 0x84, 0xff, 0x4c, 0xd9, 0xc8, + 0x69, 0xae, 0x15, 0x2e, 0x29, 0xd7, 0xa2, 0xb2, +}; +static const size_t TEST_DVPT256_131_ADATA_LEN = 32; + +static const uint8_t TEST_DVPT256_131_EXPECTED[] = { + 0x9a, 0x53, 0x82, 0xc3, +}; +static const size_t TEST_DVPT256_131_EXPECTED_LEN = 4; + +static const uint8_t TEST_DVPT256_131_INPUT[] = { + 0x00, +}; +static const size_t TEST_DVPT256_131_INPUT_LEN = 0; + +static const uint8_t TEST_DVPT256_133_NONCE[] = { + 0x4f, 0x49, 0x0c, 0xe0, 0x7e, 0x01, 0x50, +}; +static const size_t TEST_DVPT256_133_NONCE_LEN = 7; + +static const uint8_t TEST_DVPT256_133_ADATA[] = { + 0x3e, 0x12, 0xd0, 0x96, 0x32, 0xc6, 0x44, 0xc5, + 0x40, 0x07, 0x7c, 0x6f, 0x90, 0x72, 0x6d, 0x41, + 0x67, 0x42, 0x3a, 0x67, 0x93, 0x22, 0xb2, 0x00, + 0x0a, 0x3f, 0x19, 0xcf, 0xce, 0xa0, 0x2b, 0x33, +}; +static const size_t TEST_DVPT256_133_ADATA_LEN = 32; + +static const uint8_t TEST_DVPT256_133_EXPECTED[] = { + 0xe1, 0x84, 0x2c, 0x46, +}; +static const size_t TEST_DVPT256_133_EXPECTED_LEN = 4; + +static const uint8_t TEST_DVPT256_133_INPUT[] = { + 0x00, +}; +static const size_t TEST_DVPT256_133_INPUT_LEN = 0; + +/* Alen = 32, Plen = 0, Nlen = 7, Tlen = 16 */ +static const uint8_t TEST_DVPT256_GROUP_9_MAC_LEN = 16; + +static const uint8_t TEST_DVPT256_GROUP_9_KEY[] = { + 0xa4, 0xbc, 0x10, 0xb1, 0xa6, 0x2c, 0x96, 0xd4, + 0x59, 0xfb, 0xaf, 0x3a, 0x5a, 0xa3, 0xfa, 0xce, + 0x73, 0x13, 0xbb, 0x9e, 0x12, 0x53, 0xe6, 0x96, + 0xf9, 0x6a, 0x7a, 0x8e, 0x36, 0x80, 0x10, 0x88, +}; +static const size_t TEST_DVPT256_GROUP_9_KEY_LEN = 32; + +static const uint8_t TEST_DVPT256_135_NONCE[] = { + 0xa5, 0x44, 0x21, 0x8d, 0xad, 0xd3, 0xc1, +}; +static const size_t TEST_DVPT256_135_NONCE_LEN = 7; + +static const uint8_t TEST_DVPT256_135_ADATA[] = { + 0xd3, 0xd5, 0x42, 0x4e, 0x20, 0xfb, 0xec, 0x43, + 0xae, 0x49, 0x53, 0x53, 0xed, 0x83, 0x02, 0x71, + 0x51, 0x5a, 0xb1, 0x04, 0xf8, 0x86, 0x0c, 0x98, + 0x8d, 0x15, 0xb6, 0xd3, 0x6c, 0x03, 0x8e, 0xab, +}; +static const size_t TEST_DVPT256_135_ADATA_LEN = 32; + +static const uint8_t TEST_DVPT256_135_EXPECTED[] = { + 0x93, 0xaf, 0x11, 0xa0, 0x83, 0x79, 0xeb, 0x37, + 0xa1, 0x6a, 0xa2, 0x83, 0x7f, 0x09, 0xd6, 0x9d, +}; +static const size_t TEST_DVPT256_135_EXPECTED_LEN = 16; + +static const uint8_t TEST_DVPT256_135_INPUT[] = { + 0x00, +}; +static const size_t TEST_DVPT256_135_INPUT_LEN = 0; + +static const uint8_t TEST_DVPT256_139_NONCE[] = { + 0x3f, 0xcb, 0x32, 0x8b, 0xc9, 0x64, 0x04, +}; +static const size_t TEST_DVPT256_139_NONCE_LEN = 7; + +static const uint8_t TEST_DVPT256_139_ADATA[] = { + 0x10, 0xb2, 0xff, 0xed, 0x4f, 0x95, 0xaf, 0x0f, + 0x98, 0xed, 0x4f, 0x77, 0xc6, 0x77, 0xb5, 0x78, + 0x6a, 0xd0, 0x1b, 0x31, 0xc0, 0x95, 0xbb, 0xc6, + 0xe1, 0xc9, 0x9c, 0xf1, 0x39, 0x77, 0xab, 0xba, +}; +static const size_t TEST_DVPT256_139_ADATA_LEN = 32; + +static const uint8_t TEST_DVPT256_139_EXPECTED[] = { + 0xb3, 0x88, 0x4b, 0x69, 0xd1, 0x17, 0x14, 0x6c, + 0xfa, 0x55, 0x29, 0x90, 0x17, 0x53, 0xdd, 0xc0, +}; +static const size_t TEST_DVPT256_139_EXPECTED_LEN = 16; + +static const uint8_t TEST_DVPT256_139_INPUT[] = { + 0x00, +}; +static const size_t TEST_DVPT256_139_INPUT_LEN = 0; + +static const uint8_t TEST_DVPT256_141_NONCE[] = { + 0xc4, 0x2a, 0xc6, 0x3d, 0xe6, 0xf1, 0x2a, +}; +static const size_t TEST_DVPT256_141_NONCE_LEN = 7; + +static const uint8_t TEST_DVPT256_141_ADATA[] = { + 0x7f, 0xf8, 0xd0, 0x6c, 0x5a, 0xbc, 0xc5, 0x0d, + 0x38, 0x20, 0xde, 0x34, 0xb0, 0x30, 0x89, 0xe6, + 0xc5, 0xb2, 0x02, 0xbc, 0xba, 0xab, 0xca, 0x89, + 0x28, 0x25, 0x55, 0x3d, 0x4d, 0x30, 0x02, 0x0a, +}; +static const size_t TEST_DVPT256_141_ADATA_LEN = 32; + +static const uint8_t TEST_DVPT256_141_EXPECTED[] = { + 0xb5, 0x3d, 0x93, 0xcb, 0xfd, 0x3d, 0x5c, 0xf3, + 0x72, 0x0c, 0xef, 0x50, 0x80, 0xbc, 0x72, 0x24, +}; +static const size_t TEST_DVPT256_141_EXPECTED_LEN = 16; + +static const uint8_t TEST_DVPT256_141_INPUT[] = { + 0x00, +}; +static const size_t TEST_DVPT256_141_INPUT_LEN = 0; + +static const uint8_t TEST_DVPT256_146_NONCE[] = { + 0x3a, 0x17, 0x01, 0xb1, 0x85, 0xd3, 0x3a, +}; +static const size_t TEST_DVPT256_146_NONCE_LEN = 7; + +static const uint8_t TEST_DVPT256_146_ADATA[] = { + 0xe5, 0xd5, 0x4d, 0xf8, 0xed, 0x9f, 0x89, 0xb9, + 0x8c, 0x5e, 0xbb, 0x1b, 0xc5, 0xd5, 0x27, 0x9c, + 0x2e, 0x18, 0x27, 0x84, 0xff, 0x4c, 0xd9, 0xc8, + 0x69, 0xae, 0x15, 0x2e, 0x29, 0xd7, 0xa2, 0xb2, +}; +static const size_t TEST_DVPT256_146_ADATA_LEN = 32; + +static const uint8_t TEST_DVPT256_146_EXPECTED[] = { + 0x0a, 0x5d, 0x1b, 0xc0, 0x2c, 0x5f, 0xe0, 0x96, + 0xa8, 0xb9, 0xd9, 0x4d, 0x12, 0x67, 0xc4, 0x9a, +}; +static const size_t TEST_DVPT256_146_EXPECTED_LEN = 16; + +static const uint8_t TEST_DVPT256_146_INPUT[] = { + 0x00, +}; +static const size_t TEST_DVPT256_146_INPUT_LEN = 0; + +static const uint8_t TEST_DVPT256_148_NONCE[] = { + 0x4f, 0x49, 0x0c, 0xe0, 0x7e, 0x01, 0x50, +}; +static const size_t TEST_DVPT256_148_NONCE_LEN = 7; + +static const uint8_t TEST_DVPT256_148_ADATA[] = { + 0x3e, 0x12, 0xd0, 0x96, 0x32, 0xc6, 0x44, 0xc5, + 0x40, 0x07, 0x7c, 0x6f, 0x90, 0x72, 0x6d, 0x41, + 0x67, 0x42, 0x3a, 0x67, 0x93, 0x22, 0xb2, 0x00, + 0x0a, 0x3f, 0x19, 0xcf, 0xce, 0xa0, 0x2b, 0x33, +}; +static const size_t TEST_DVPT256_148_ADATA_LEN = 32; + +static const uint8_t TEST_DVPT256_148_EXPECTED[] = { + 0x1e, 0xda, 0x43, 0xbf, 0x07, 0xf2, 0xbf, 0x00, + 0x31, 0x07, 0xf3, 0xa0, 0xba, 0x3a, 0x4c, 0x18, +}; +static const size_t TEST_DVPT256_148_EXPECTED_LEN = 16; + +static const uint8_t TEST_DVPT256_148_INPUT[] = { + 0x00, +}; +static const size_t TEST_DVPT256_148_INPUT_LEN = 0; + +/* Alen = 32, Plen = 0, Nlen = 13, Tlen = 4 */ +static const uint8_t TEST_DVPT256_GROUP_10_MAC_LEN = 4; + +static const uint8_t TEST_DVPT256_GROUP_10_KEY[] = { + 0xa4, 0xbc, 0x10, 0xb1, 0xa6, 0x2c, 0x96, 0xd4, + 0x59, 0xfb, 0xaf, 0x3a, 0x5a, 0xa3, 0xfa, 0xce, + 0x73, 0x13, 0xbb, 0x9e, 0x12, 0x53, 0xe6, 0x96, + 0xf9, 0x6a, 0x7a, 0x8e, 0x36, 0x80, 0x10, 0x88, +}; +static const size_t TEST_DVPT256_GROUP_10_KEY_LEN = 32; + +static const uint8_t TEST_DVPT256_150_NONCE[] = { + 0xa5, 0x44, 0x21, 0x8d, 0xad, 0xd3, 0xc1, 0x05, + 0x83, 0xdb, 0x49, 0xcf, 0x39, +}; +static const size_t TEST_DVPT256_150_NONCE_LEN = 13; + +static const uint8_t TEST_DVPT256_150_ADATA[] = { + 0x3c, 0x0e, 0x28, 0x15, 0xd3, 0x7d, 0x84, 0x4f, + 0x7a, 0xc2, 0x40, 0xba, 0x9d, 0x6e, 0x3a, 0x0b, + 0x2a, 0x86, 0xf7, 0x06, 0xe8, 0x85, 0x95, 0x9e, + 0x09, 0xa1, 0x00, 0x5e, 0x02, 0x4f, 0x69, 0x07, +}; +static const size_t TEST_DVPT256_150_ADATA_LEN = 32; + +static const uint8_t TEST_DVPT256_150_EXPECTED[] = { + 0x86, 0x6d, 0x42, 0x27, +}; +static const size_t TEST_DVPT256_150_EXPECTED_LEN = 4; + +static const uint8_t TEST_DVPT256_150_INPUT[] = { + 0x00, +}; +static const size_t TEST_DVPT256_150_INPUT_LEN = 0; + +static const uint8_t TEST_DVPT256_154_NONCE[] = { + 0xdf, 0xdc, 0xbd, 0xff, 0x32, 0x9f, 0x7a, 0xf7, + 0x07, 0x31, 0xd8, 0xe2, 0x76, +}; +static const size_t TEST_DVPT256_154_NONCE_LEN = 13; + +static const uint8_t TEST_DVPT256_154_ADATA[] = { + 0x2a, 0xe5, 0x6d, 0xdd, 0xe2, 0x87, 0x6d, 0x70, + 0xb3, 0xb3, 0x4e, 0xda, 0x8c, 0x2b, 0x1d, 0x09, + 0x6c, 0x83, 0x6d, 0x52, 0x25, 0xd5, 0x3e, 0xc4, + 0x60, 0xb7, 0x24, 0xb6, 0xe1, 0x6a, 0xa5, 0xa3, +}; +static const size_t TEST_DVPT256_154_ADATA_LEN = 32; + +static const uint8_t TEST_DVPT256_154_EXPECTED[] = { + 0xc4, 0xac, 0x09, 0x52, +}; +static const size_t TEST_DVPT256_154_EXPECTED_LEN = 4; + +static const uint8_t TEST_DVPT256_154_INPUT[] = { + 0x00, +}; +static const size_t TEST_DVPT256_154_INPUT_LEN = 0; + +static const uint8_t TEST_DVPT256_156_NONCE[] = { + 0x60, 0xf2, 0x49, 0x0b, 0xa0, 0xc6, 0x58, 0x84, + 0x88, 0x59, 0xfc, 0xbe, 0xa8, +}; +static const size_t TEST_DVPT256_156_NONCE_LEN = 13; + +static const uint8_t TEST_DVPT256_156_ADATA[] = { + 0x3a, 0xd7, 0x43, 0x28, 0x30, 0x64, 0x92, 0x9b, + 0xf4, 0xfe, 0x4e, 0x08, 0x07, 0xf7, 0x10, 0xf5, + 0xe6, 0xa2, 0x73, 0xe2, 0x26, 0x14, 0xc7, 0x28, + 0xc3, 0x28, 0x0a, 0x27, 0xb6, 0xc6, 0x14, 0xa0, +}; +static const size_t TEST_DVPT256_156_ADATA_LEN = 32; + +static const uint8_t TEST_DVPT256_156_EXPECTED[] = { + 0x27, 0xc3, 0x95, 0x3d, +}; +static const size_t TEST_DVPT256_156_EXPECTED_LEN = 4; + +static const uint8_t TEST_DVPT256_156_INPUT[] = { + 0x00, +}; +static const size_t TEST_DVPT256_156_INPUT_LEN = 0; + +static const uint8_t TEST_DVPT256_161_NONCE[] = { + 0xdb, 0x11, 0x3f, 0x38, 0xf0, 0x50, 0x46, 0x15, + 0xc5, 0xc9, 0x34, 0x7c, 0x3d, +}; +static const size_t TEST_DVPT256_161_NONCE_LEN = 13; + +static const uint8_t TEST_DVPT256_161_ADATA[] = { + 0x3b, 0x71, 0xbc, 0x84, 0xe4, 0x8c, 0x6d, 0xad, + 0xf6, 0xea, 0xd1, 0x46, 0x21, 0xd2, 0x24, 0x68, + 0xa3, 0xd4, 0xc9, 0xc1, 0x03, 0xac, 0x96, 0x97, + 0x02, 0x69, 0x73, 0x0b, 0xcf, 0xce, 0x23, 0x9b, +}; +static const size_t TEST_DVPT256_161_ADATA_LEN = 32; + +static const uint8_t TEST_DVPT256_161_EXPECTED[] = { + 0xc3, 0x8f, 0xbd, 0xff, +}; +static const size_t TEST_DVPT256_161_EXPECTED_LEN = 4; + +static const uint8_t TEST_DVPT256_161_INPUT[] = { + 0x00, +}; +static const size_t TEST_DVPT256_161_INPUT_LEN = 0; + +static const uint8_t TEST_DVPT256_163_NONCE[] = { + 0xd3, 0x5f, 0x53, 0x1f, 0x71, 0x46, 0x94, 0xb5, + 0xe4, 0x93, 0x03, 0xa9, 0x80, +}; +static const size_t TEST_DVPT256_163_NONCE_LEN = 13; + +static const uint8_t TEST_DVPT256_163_ADATA[] = { + 0x55, 0xb7, 0x91, 0xee, 0x49, 0x52, 0x99, 0x91, + 0x6f, 0xf3, 0xc2, 0x32, 0x7b, 0x49, 0x90, 0x95, + 0x2b, 0xeb, 0xd0, 0xa2, 0xda, 0x9a, 0xcf, 0xc5, + 0x53, 0xc6, 0xc9, 0x96, 0xe3, 0x54, 0xa4, 0xb5, +}; +static const size_t TEST_DVPT256_163_ADATA_LEN = 32; + +static const uint8_t TEST_DVPT256_163_EXPECTED[] = { + 0xd3, 0x4e, 0x90, 0xbb, +}; +static const size_t TEST_DVPT256_163_EXPECTED_LEN = 4; + +static const uint8_t TEST_DVPT256_163_INPUT[] = { + 0x00, +}; +static const size_t TEST_DVPT256_163_INPUT_LEN = 0; + +/* Alen = 32, Plen = 0, Nlen = 13, Tlen = 16 */ +static const uint8_t TEST_DVPT256_GROUP_11_MAC_LEN = 16; + +static const uint8_t TEST_DVPT256_GROUP_11_KEY[] = { + 0x8c, 0x5c, 0xf3, 0x45, 0x7f, 0xf2, 0x22, 0x28, + 0xc3, 0x9c, 0x05, 0x1c, 0x4e, 0x05, 0xed, 0x40, + 0x93, 0x65, 0x7e, 0xb3, 0x03, 0xf8, 0x59, 0xa9, + 0xd4, 0xb0, 0xf8, 0xbe, 0x01, 0x27, 0xd8, 0x8a, +}; +static const size_t TEST_DVPT256_GROUP_11_KEY_LEN = 32; + +static const uint8_t TEST_DVPT256_165_NONCE[] = { + 0xa5, 0x44, 0x21, 0x8d, 0xad, 0xd3, 0xc1, 0x05, + 0x83, 0xdb, 0x49, 0xcf, 0x39, +}; +static const size_t TEST_DVPT256_165_NONCE_LEN = 13; + +static const uint8_t TEST_DVPT256_165_ADATA[] = { + 0x3c, 0x0e, 0x28, 0x15, 0xd3, 0x7d, 0x84, 0x4f, + 0x7a, 0xc2, 0x40, 0xba, 0x9d, 0x6e, 0x3a, 0x0b, + 0x2a, 0x86, 0xf7, 0x06, 0xe8, 0x85, 0x95, 0x9e, + 0x09, 0xa1, 0x00, 0x5e, 0x02, 0x4f, 0x69, 0x07, +}; +static const size_t TEST_DVPT256_165_ADATA_LEN = 32; + +static const uint8_t TEST_DVPT256_165_EXPECTED[] = { + 0x86, 0x7b, 0x0d, 0x87, 0xcf, 0x6e, 0x0f, 0x71, + 0x82, 0x00, 0xa9, 0x7b, 0x4f, 0x6d, 0x5a, 0xd5, +}; +static const size_t TEST_DVPT256_165_EXPECTED_LEN = 16; + +static const uint8_t TEST_DVPT256_165_INPUT[] = { + 0x00, +}; +static const size_t TEST_DVPT256_165_INPUT_LEN = 0; + +static const uint8_t TEST_DVPT256_169_NONCE[] = { + 0xdf, 0xdc, 0xbd, 0xff, 0x32, 0x9f, 0x7a, 0xf7, + 0x07, 0x31, 0xd8, 0xe2, 0x76, +}; +static const size_t TEST_DVPT256_169_NONCE_LEN = 13; + +static const uint8_t TEST_DVPT256_169_ADATA[] = { + 0x2a, 0xe5, 0x6d, 0xdd, 0xe2, 0x87, 0x6d, 0x70, + 0xb3, 0xb3, 0x4e, 0xda, 0x8c, 0x2b, 0x1d, 0x09, + 0x6c, 0x83, 0x6d, 0x52, 0x25, 0xd5, 0x3e, 0xc4, + 0x60, 0xb7, 0x24, 0xb6, 0xe1, 0x6a, 0xa5, 0xa3, +}; +static const size_t TEST_DVPT256_169_ADATA_LEN = 32; + +static const uint8_t TEST_DVPT256_169_EXPECTED[] = { + 0xad, 0x87, 0x9c, 0x64, 0x42, 0x5e, 0x6c, 0x1e, + 0xc4, 0x84, 0x1b, 0xbb, 0x0f, 0x99, 0xaa, 0x8b, +}; +static const size_t TEST_DVPT256_169_EXPECTED_LEN = 16; + +static const uint8_t TEST_DVPT256_169_INPUT[] = { + 0x00, +}; +static const size_t TEST_DVPT256_169_INPUT_LEN = 0; + +static const uint8_t TEST_DVPT256_171_NONCE[] = { + 0x60, 0xf2, 0x49, 0x0b, 0xa0, 0xc6, 0x58, 0x84, + 0x88, 0x59, 0xfc, 0xbe, 0xa8, +}; +static const size_t TEST_DVPT256_171_NONCE_LEN = 13; + +static const uint8_t TEST_DVPT256_171_ADATA[] = { + 0x3a, 0xd7, 0x43, 0x28, 0x30, 0x64, 0x92, 0x9b, + 0xf4, 0xfe, 0x4e, 0x08, 0x07, 0xf7, 0x10, 0xf5, + 0xe6, 0xa2, 0x73, 0xe2, 0x26, 0x14, 0xc7, 0x28, + 0xc3, 0x28, 0x0a, 0x27, 0xb6, 0xc6, 0x14, 0xa0, +}; +static const size_t TEST_DVPT256_171_ADATA_LEN = 32; + +static const uint8_t TEST_DVPT256_171_EXPECTED[] = { + 0xe2, 0x75, 0x1f, 0x15, 0x3f, 0xc7, 0x6c, 0x0d, + 0xec, 0x5e, 0x0c, 0xf2, 0xd3, 0x0c, 0x1a, 0x28, +}; +static const size_t TEST_DVPT256_171_EXPECTED_LEN = 16; + +static const uint8_t TEST_DVPT256_171_INPUT[] = { + 0x00, +}; +static const size_t TEST_DVPT256_171_INPUT_LEN = 0; + +static const uint8_t TEST_DVPT256_176_NONCE[] = { + 0xdb, 0x11, 0x3f, 0x38, 0xf0, 0x50, 0x46, 0x15, + 0xc5, 0xc9, 0x34, 0x7c, 0x3d, +}; +static const size_t TEST_DVPT256_176_NONCE_LEN = 13; + +static const uint8_t TEST_DVPT256_176_ADATA[] = { + 0x3b, 0x71, 0xbc, 0x84, 0xe4, 0x8c, 0x6d, 0xad, + 0xf6, 0xea, 0xd1, 0x46, 0x21, 0xd2, 0x24, 0x68, + 0xa3, 0xd4, 0xc9, 0xc1, 0x03, 0xac, 0x96, 0x97, + 0x02, 0x69, 0x73, 0x0b, 0xcf, 0xce, 0x23, 0x9b, +}; +static const size_t TEST_DVPT256_176_ADATA_LEN = 32; + +static const uint8_t TEST_DVPT256_176_EXPECTED[] = { + 0xfc, 0x85, 0x46, 0x4a, 0x81, 0xfe, 0x37, 0x2c, + 0x12, 0xc9, 0xe4, 0xf0, 0xf3, 0xbf, 0x9c, 0x37, +}; +static const size_t TEST_DVPT256_176_EXPECTED_LEN = 16; + +static const uint8_t TEST_DVPT256_176_INPUT[] = { + 0x00, +}; +static const size_t TEST_DVPT256_176_INPUT_LEN = 0; + +static const uint8_t TEST_DVPT256_178_NONCE[] = { + 0xd3, 0x5f, 0x53, 0x1f, 0x71, 0x46, 0x94, 0xb5, + 0xe4, 0x93, 0x03, 0xa9, 0x80, +}; +static const size_t TEST_DVPT256_178_NONCE_LEN = 13; + +static const uint8_t TEST_DVPT256_178_ADATA[] = { + 0x55, 0xb7, 0x91, 0xee, 0x49, 0x52, 0x99, 0x91, + 0x6f, 0xf3, 0xc2, 0x32, 0x7b, 0x49, 0x90, 0x95, + 0x2b, 0xeb, 0xd0, 0xa2, 0xda, 0x9a, 0xcf, 0xc5, + 0x53, 0xc6, 0xc9, 0x96, 0xe3, 0x54, 0xa4, 0xb5, +}; +static const size_t TEST_DVPT256_178_ADATA_LEN = 32; + +static const uint8_t TEST_DVPT256_178_EXPECTED[] = { + 0xb1, 0xc0, 0x9b, 0x09, 0x37, 0x88, 0xda, 0x19, + 0xe3, 0x3c, 0x5a, 0x6e, 0x82, 0xed, 0x96, 0x27, +}; +static const size_t TEST_DVPT256_178_EXPECTED_LEN = 16; + +static const uint8_t TEST_DVPT256_178_INPUT[] = { + 0x00, +}; +static const size_t TEST_DVPT256_178_INPUT_LEN = 0; + +/* Alen = 32, Plen = 24, Nlen = 7, Tlen = 4 */ +static const uint8_t TEST_DVPT256_GROUP_12_MAC_LEN = 4; + +static const uint8_t TEST_DVPT256_GROUP_12_KEY[] = { + 0x8c, 0x5c, 0xf3, 0x45, 0x7f, 0xf2, 0x22, 0x28, + 0xc3, 0x9c, 0x05, 0x1c, 0x4e, 0x05, 0xed, 0x40, + 0x93, 0x65, 0x7e, 0xb3, 0x03, 0xf8, 0x59, 0xa9, + 0xd4, 0xb0, 0xf8, 0xbe, 0x01, 0x27, 0xd8, 0x8a, +}; +static const size_t TEST_DVPT256_GROUP_12_KEY_LEN = 32; + +static const uint8_t TEST_DVPT256_180_NONCE[] = { + 0xa5, 0x44, 0x21, 0x8d, 0xad, 0xd3, 0xc1, +}; +static const size_t TEST_DVPT256_180_NONCE_LEN = 7; + +static const uint8_t TEST_DVPT256_180_ADATA[] = { + 0xd3, 0xd5, 0x42, 0x4e, 0x20, 0xfb, 0xec, 0x43, + 0xae, 0x49, 0x53, 0x53, 0xed, 0x83, 0x02, 0x71, + 0x51, 0x5a, 0xb1, 0x04, 0xf8, 0x86, 0x0c, 0x98, + 0x8d, 0x15, 0xb6, 0xd3, 0x6c, 0x03, 0x8e, 0xab, +}; +static const size_t TEST_DVPT256_180_ADATA_LEN = 32; + +static const uint8_t TEST_DVPT256_180_EXPECTED[] = { + 0xc2, 0xfe, 0x12, 0x65, 0x81, 0x39, 0xf5, 0xd0, + 0xdd, 0x22, 0xca, 0xdf, 0x2e, 0x90, 0x16, 0x95, + 0xb5, 0x79, 0x30, 0x2a, 0x72, 0xfc, 0x56, 0x08, + 0x3e, 0xbc, 0x77, 0x20, +}; +static const size_t TEST_DVPT256_180_EXPECTED_LEN = 28; + +static const uint8_t TEST_DVPT256_180_INPUT[] = { + 0x78, 0xc4, 0x6e, 0x32, 0x49, 0xca, 0x28, 0xe1, + 0xef, 0x05, 0x31, 0xd8, 0x0f, 0xd3, 0x7c, 0x12, + 0x4d, 0x9a, 0xec, 0xb7, 0xbe, 0x66, 0x68, 0xe3, +}; +static const size_t TEST_DVPT256_180_INPUT_LEN = 24; + +static const uint8_t TEST_DVPT256_184_NONCE[] = { + 0x57, 0xb9, 0x40, 0x55, 0x0a, 0x38, 0x3b, +}; +static const size_t TEST_DVPT256_184_NONCE_LEN = 7; + +static const uint8_t TEST_DVPT256_184_ADATA[] = { + 0x33, 0xc2, 0xc3, 0xa5, 0x7b, 0xf8, 0x39, 0x3b, + 0x12, 0x69, 0x82, 0xc9, 0x6d, 0x87, 0xda, 0xea, + 0xcd, 0x5e, 0xad, 0xad, 0x15, 0x19, 0x07, 0x3a, + 0xd8, 0xc8, 0x4c, 0xb9, 0xb7, 0x60, 0x29, 0x6f, +}; +static const size_t TEST_DVPT256_184_ADATA_LEN = 32; + +static const uint8_t TEST_DVPT256_184_EXPECTED[] = { + 0xe1, 0xb4, 0xec, 0x42, 0x79, 0xbb, 0x62, 0x90, + 0x2c, 0x12, 0x52, 0x1e, 0x6b, 0x87, 0x41, 0x71, + 0x69, 0x5c, 0x5d, 0xa4, 0x6c, 0x64, 0x7c, 0xc0, + 0x3b, 0x91, 0xff, 0x03, +}; +static const size_t TEST_DVPT256_184_EXPECTED_LEN = 28; + +static const uint8_t TEST_DVPT256_184_INPUT[] = { + 0x6f, 0xb5, 0xce, 0x32, 0xa8, 0x51, 0x67, 0x67, + 0x53, 0xba, 0x35, 0x23, 0xed, 0xc5, 0xca, 0x82, + 0xaf, 0x18, 0x43, 0xff, 0xc0, 0x8f, 0x1e, 0xf0, +}; +static const size_t TEST_DVPT256_184_INPUT_LEN = 24; + +static const uint8_t TEST_DVPT256_186_NONCE[] = { + 0xf3, 0x22, 0x22, 0xe9, 0xee, 0xc4, 0xbd, +}; +static const size_t TEST_DVPT256_186_NONCE_LEN = 7; + +static const uint8_t TEST_DVPT256_186_ADATA[] = { + 0x68, 0x45, 0x95, 0xe3, 0x6e, 0xda, 0x1d, 0xb5, + 0xf5, 0x86, 0x94, 0x1c, 0x9f, 0x34, 0xc9, 0xf8, + 0xd4, 0x77, 0x97, 0x0d, 0x5c, 0xcc, 0x14, 0x63, + 0x2d, 0x1f, 0x0c, 0xec, 0x81, 0x90, 0xae, 0x68, +}; +static const size_t TEST_DVPT256_186_ADATA_LEN = 32; + +static const uint8_t TEST_DVPT256_186_EXPECTED[] = { + 0x22, 0x4d, 0xb2, 0x1b, 0xeb, 0x8c, 0xd0, 0x06, + 0x90, 0x07, 0x66, 0x0e, 0x78, 0x3c, 0x3f, 0x85, + 0x70, 0x6b, 0x01, 0x41, 0x28, 0x36, 0x8a, 0xab, + 0x2a, 0x4e, 0x56, 0xa7, +}; +static const size_t TEST_DVPT256_186_EXPECTED_LEN = 28; + +static const uint8_t TEST_DVPT256_186_INPUT[] = { + 0x2c, 0x29, 0xd4, 0xe2, 0xbb, 0x92, 0x94, 0xe9, + 0x0c, 0xb0, 0x4e, 0xc6, 0x97, 0xe6, 0x63, 0xa1, + 0xf7, 0x38, 0x5a, 0x39, 0xf9, 0x0c, 0x8c, 0xcf, +}; +static const size_t TEST_DVPT256_186_INPUT_LEN = 24; + +static const uint8_t TEST_DVPT256_191_NONCE[] = { + 0x14, 0xc9, 0xbd, 0x56, 0x1c, 0x47, 0xc1, +}; +static const size_t TEST_DVPT256_191_NONCE_LEN = 7; + +static const uint8_t TEST_DVPT256_191_ADATA[] = { + 0x14, 0x1a, 0xe3, 0x65, 0xf8, 0xe6, 0x5a, 0xb9, + 0x19, 0x6c, 0x4e, 0x8c, 0xd4, 0xe6, 0x21, 0x89, + 0xb3, 0x04, 0xd6, 0x7d, 0xe3, 0x8f, 0x21, 0x17, + 0xe8, 0x4e, 0xc0, 0xec, 0x8f, 0x26, 0x0e, 0xbd, +}; +static const size_t TEST_DVPT256_191_ADATA_LEN = 32; + +static const uint8_t TEST_DVPT256_191_EXPECTED[] = { + 0x61, 0xb4, 0x6c, 0x90, 0x24, 0xee, 0xd3, 0x98, + 0x90, 0x64, 0xa5, 0x2d, 0xf9, 0x03, 0x49, 0xc1, + 0x8e, 0x14, 0xe4, 0xb5, 0x52, 0x77, 0x9d, 0x3f, + 0x8f, 0x9d, 0x68, 0x14, +}; +static const size_t TEST_DVPT256_191_EXPECTED_LEN = 28; + +static const uint8_t TEST_DVPT256_191_INPUT[] = { + 0xc2, 0x25, 0x24, 0xa1, 0xea, 0x44, 0x4b, 0xe3, + 0x41, 0x2b, 0x0d, 0x77, 0x3d, 0x4e, 0xa2, 0xff, + 0x0a, 0xf4, 0xc1, 0xad, 0x23, 0x83, 0xcb, 0xa8, +}; +static const size_t TEST_DVPT256_191_INPUT_LEN = 24; + +static const uint8_t TEST_DVPT256_193_NONCE[] = { + 0x1c, 0xce, 0xc9, 0x92, 0x3a, 0xa6, 0xe8, +}; +static const size_t TEST_DVPT256_193_NONCE_LEN = 7; + +static const uint8_t TEST_DVPT256_193_ADATA[] = { + 0x88, 0xa6, 0xd0, 0x37, 0x00, 0x9a, 0x1c, 0x17, + 0x56, 0xf7, 0x2b, 0xb4, 0x58, 0x9d, 0x6d, 0x94, + 0x0b, 0xd5, 0x14, 0xed, 0x55, 0x38, 0x6b, 0xae, + 0xfa, 0xcc, 0x6a, 0xc3, 0xca, 0x6f, 0x87, 0x95, +}; +static const size_t TEST_DVPT256_193_ADATA_LEN = 32; + +static const uint8_t TEST_DVPT256_193_EXPECTED[] = { + 0x52, 0xf8, 0x20, 0x55, 0x34, 0x44, 0x7d, 0x72, + 0x2b, 0xe2, 0xb9, 0x37, 0x7f, 0x73, 0x95, 0x93, + 0x8c, 0xc8, 0x8a, 0xf0, 0x81, 0xa1, 0x1c, 0xcb, + 0x0d, 0x83, 0xfa, 0x19, +}; +static const size_t TEST_DVPT256_193_EXPECTED_LEN = 28; + +static const uint8_t TEST_DVPT256_193_INPUT[] = { + 0x51, 0x8a, 0x7f, 0xb1, 0x1c, 0x46, 0x3b, 0xf2, + 0x37, 0x98, 0x98, 0x21, 0x18, 0xf3, 0xcf, 0xe4, + 0xd7, 0xdd, 0xde, 0x91, 0x84, 0xf3, 0x7d, 0x4f, +}; +static const size_t TEST_DVPT256_193_INPUT_LEN = 24; + +/* Alen = 32, Plen = 24, Nlen = 7, Tlen = 16 */ +static const uint8_t TEST_DVPT256_GROUP_13_MAC_LEN = 16; + +static const uint8_t TEST_DVPT256_GROUP_13_KEY[] = { + 0x70, 0x53, 0x34, 0xe3, 0x0f, 0x53, 0xdd, 0x2f, + 0x92, 0xd1, 0x90, 0xd2, 0xc1, 0x43, 0x7c, 0x87, + 0x72, 0xf9, 0x40, 0xc5, 0x5a, 0xa3, 0x5e, 0x56, + 0x22, 0x14, 0xed, 0x45, 0xbd, 0x45, 0x8f, 0xfe, +}; +static const size_t TEST_DVPT256_GROUP_13_KEY_LEN = 32; + +static const uint8_t TEST_DVPT256_195_NONCE[] = { + 0xa5, 0x44, 0x21, 0x8d, 0xad, 0xd3, 0xc1, +}; +static const size_t TEST_DVPT256_195_NONCE_LEN = 7; + +static const uint8_t TEST_DVPT256_195_ADATA[] = { + 0xd3, 0xd5, 0x42, 0x4e, 0x20, 0xfb, 0xec, 0x43, + 0xae, 0x49, 0x53, 0x53, 0xed, 0x83, 0x02, 0x71, + 0x51, 0x5a, 0xb1, 0x04, 0xf8, 0x86, 0x0c, 0x98, + 0x8d, 0x15, 0xb6, 0xd3, 0x6c, 0x03, 0x8e, 0xab, +}; +static const size_t TEST_DVPT256_195_ADATA_LEN = 32; + +static const uint8_t TEST_DVPT256_195_EXPECTED[] = { + 0x33, 0x41, 0x16, 0x8e, 0xb8, 0xc4, 0x84, 0x68, + 0xc4, 0x14, 0x34, 0x7f, 0xb0, 0x8f, 0x71, 0xd2, + 0x08, 0x6f, 0x7c, 0x2d, 0x1b, 0xd5, 0x81, 0xce, + 0x1a, 0xc6, 0x8b, 0xd4, 0x2f, 0x5e, 0xc7, 0xfa, + 0x7e, 0x06, 0x8c, 0xc0, 0xec, 0xd7, 0x9c, 0x2a, +}; +static const size_t TEST_DVPT256_195_EXPECTED_LEN = 40; + +static const uint8_t TEST_DVPT256_195_INPUT[] = { + 0x78, 0xc4, 0x6e, 0x32, 0x49, 0xca, 0x28, 0xe1, + 0xef, 0x05, 0x31, 0xd8, 0x0f, 0xd3, 0x7c, 0x12, + 0x4d, 0x9a, 0xec, 0xb7, 0xbe, 0x66, 0x68, 0xe3, +}; +static const size_t TEST_DVPT256_195_INPUT_LEN = 24; + +static const uint8_t TEST_DVPT256_199_NONCE[] = { + 0x57, 0xb9, 0x40, 0x55, 0x0a, 0x38, 0x3b, +}; +static const size_t TEST_DVPT256_199_NONCE_LEN = 7; + +static const uint8_t TEST_DVPT256_199_ADATA[] = { + 0x33, 0xc2, 0xc3, 0xa5, 0x7b, 0xf8, 0x39, 0x3b, + 0x12, 0x69, 0x82, 0xc9, 0x6d, 0x87, 0xda, 0xea, + 0xcd, 0x5e, 0xad, 0xad, 0x15, 0x19, 0x07, 0x3a, + 0xd8, 0xc8, 0x4c, 0xb9, 0xb7, 0x60, 0x29, 0x6f, +}; +static const size_t TEST_DVPT256_199_ADATA_LEN = 32; + +static const uint8_t TEST_DVPT256_199_EXPECTED[] = { + 0xfb, 0xfe, 0xd2, 0xc9, 0x4f, 0x50, 0xca, 0x10, + 0x46, 0x6d, 0xa9, 0x90, 0x3e, 0xf8, 0x58, 0x33, + 0xad, 0x48, 0xca, 0x00, 0x55, 0x6e, 0x66, 0xd1, + 0x4d, 0x8b, 0x30, 0xdf, 0x94, 0x1f, 0x35, 0x36, + 0xff, 0xb4, 0x20, 0x83, 0xef, 0x0e, 0x1c, 0x30, +}; +static const size_t TEST_DVPT256_199_EXPECTED_LEN = 40; + +static const uint8_t TEST_DVPT256_199_INPUT[] = { + 0x6f, 0xb5, 0xce, 0x32, 0xa8, 0x51, 0x67, 0x67, + 0x53, 0xba, 0x35, 0x23, 0xed, 0xc5, 0xca, 0x82, + 0xaf, 0x18, 0x43, 0xff, 0xc0, 0x8f, 0x1e, 0xf0, +}; +static const size_t TEST_DVPT256_199_INPUT_LEN = 24; + +static const uint8_t TEST_DVPT256_201_NONCE[] = { + 0xf3, 0x22, 0x22, 0xe9, 0xee, 0xc4, 0xbd, +}; +static const size_t TEST_DVPT256_201_NONCE_LEN = 7; + +static const uint8_t TEST_DVPT256_201_ADATA[] = { + 0x68, 0x45, 0x95, 0xe3, 0x6e, 0xda, 0x1d, 0xb5, + 0xf5, 0x86, 0x94, 0x1c, 0x9f, 0x34, 0xc9, 0xf8, + 0xd4, 0x77, 0x97, 0x0d, 0x5c, 0xcc, 0x14, 0x63, + 0x2d, 0x1f, 0x0c, 0xec, 0x81, 0x90, 0xae, 0x68, +}; +static const size_t TEST_DVPT256_201_ADATA_LEN = 32; + +static const uint8_t TEST_DVPT256_201_EXPECTED[] = { + 0xda, 0xe1, 0x3e, 0x69, 0x67, 0xc8, 0xb1, 0xee, + 0x0d, 0xd2, 0xd5, 0xba, 0x1d, 0xd1, 0xde, 0x69, + 0xf2, 0x2c, 0x95, 0xda, 0x39, 0x52, 0x8f, 0x9e, + 0xf7, 0x8e, 0x9e, 0x5e, 0x9f, 0xaa, 0x05, 0x81, + 0x12, 0xaf, 0x57, 0xf4, 0xac, 0x78, 0xdb, 0x2c, +}; +static const size_t TEST_DVPT256_201_EXPECTED_LEN = 40; + +static const uint8_t TEST_DVPT256_201_INPUT[] = { + 0x2c, 0x29, 0xd4, 0xe2, 0xbb, 0x92, 0x94, 0xe9, + 0x0c, 0xb0, 0x4e, 0xc6, 0x97, 0xe6, 0x63, 0xa1, + 0xf7, 0x38, 0x5a, 0x39, 0xf9, 0x0c, 0x8c, 0xcf, +}; +static const size_t TEST_DVPT256_201_INPUT_LEN = 24; + +static const uint8_t TEST_DVPT256_206_NONCE[] = { + 0x14, 0xc9, 0xbd, 0x56, 0x1c, 0x47, 0xc1, +}; +static const size_t TEST_DVPT256_206_NONCE_LEN = 7; + +static const uint8_t TEST_DVPT256_206_ADATA[] = { + 0x14, 0x1a, 0xe3, 0x65, 0xf8, 0xe6, 0x5a, 0xb9, + 0x19, 0x6c, 0x4e, 0x8c, 0xd4, 0xe6, 0x21, 0x89, + 0xb3, 0x04, 0xd6, 0x7d, 0xe3, 0x8f, 0x21, 0x17, + 0xe8, 0x4e, 0xc0, 0xec, 0x8f, 0x26, 0x0e, 0xbd, +}; +static const size_t TEST_DVPT256_206_ADATA_LEN = 32; + +static const uint8_t TEST_DVPT256_206_EXPECTED[] = { + 0xa6, 0x54, 0x23, 0x8f, 0xb8, 0xb0, 0x5e, 0x29, + 0x3d, 0xba, 0x07, 0xf9, 0xd6, 0x8d, 0x75, 0xa7, + 0xf0, 0xfb, 0xf4, 0x0f, 0xe2, 0x0e, 0xda, 0xeb, + 0xa1, 0x58, 0x6b, 0xf9, 0x22, 0x41, 0x2e, 0x73, + 0xce, 0x33, 0x8e, 0x37, 0x26, 0x15, 0xc3, 0xbc, +}; +static const size_t TEST_DVPT256_206_EXPECTED_LEN = 40; + +static const uint8_t TEST_DVPT256_206_INPUT[] = { + 0xc2, 0x25, 0x24, 0xa1, 0xea, 0x44, 0x4b, 0xe3, + 0x41, 0x2b, 0x0d, 0x77, 0x3d, 0x4e, 0xa2, 0xff, + 0x0a, 0xf4, 0xc1, 0xad, 0x23, 0x83, 0xcb, 0xa8, +}; +static const size_t TEST_DVPT256_206_INPUT_LEN = 24; + +static const uint8_t TEST_DVPT256_208_NONCE[] = { + 0x1c, 0xce, 0xc9, 0x92, 0x3a, 0xa6, 0xe8, +}; +static const size_t TEST_DVPT256_208_NONCE_LEN = 7; + +static const uint8_t TEST_DVPT256_208_ADATA[] = { + 0x88, 0xa6, 0xd0, 0x37, 0x00, 0x9a, 0x1c, 0x17, + 0x56, 0xf7, 0x2b, 0xb4, 0x58, 0x9d, 0x6d, 0x94, + 0x0b, 0xd5, 0x14, 0xed, 0x55, 0x38, 0x6b, 0xae, + 0xfa, 0xcc, 0x6a, 0xc3, 0xca, 0x6f, 0x87, 0x95, +}; +static const size_t TEST_DVPT256_208_ADATA_LEN = 32; + +static const uint8_t TEST_DVPT256_208_EXPECTED[] = { + 0x76, 0x50, 0x67, 0xef, 0x76, 0x89, 0x08, 0xd9, + 0x1e, 0xe4, 0xc3, 0x92, 0x39, 0x43, 0xe0, 0xc7, + 0xbe, 0x70, 0xe2, 0xe0, 0x6d, 0xb9, 0x9a, 0x4b, + 0x3e, 0x3f, 0x51, 0xee, 0x37, 0xfd, 0xcc, 0x5d, + 0x81, 0xdd, 0x85, 0xd9, 0xe9, 0xd4, 0xf4, 0x4e, +}; +static const size_t TEST_DVPT256_208_EXPECTED_LEN = 40; + +static const uint8_t TEST_DVPT256_208_INPUT[] = { + 0x51, 0x8a, 0x7f, 0xb1, 0x1c, 0x46, 0x3b, 0xf2, + 0x37, 0x98, 0x98, 0x21, 0x18, 0xf3, 0xcf, 0xe4, + 0xd7, 0xdd, 0xde, 0x91, 0x84, 0xf3, 0x7d, 0x4f, +}; +static const size_t TEST_DVPT256_208_INPUT_LEN = 24; + +/* Alen = 32, Plen = 24, Nlen = 13, Tlen = 4 */ +static const uint8_t TEST_DVPT256_GROUP_14_MAC_LEN = 4; + +static const uint8_t TEST_DVPT256_GROUP_14_KEY[] = { + 0x70, 0x53, 0x34, 0xe3, 0x0f, 0x53, 0xdd, 0x2f, + 0x92, 0xd1, 0x90, 0xd2, 0xc1, 0x43, 0x7c, 0x87, + 0x72, 0xf9, 0x40, 0xc5, 0x5a, 0xa3, 0x5e, 0x56, + 0x22, 0x14, 0xed, 0x45, 0xbd, 0x45, 0x8f, 0xfe, +}; +static const size_t TEST_DVPT256_GROUP_14_KEY_LEN = 32; + +static const uint8_t TEST_DVPT256_210_NONCE[] = { + 0xa5, 0x44, 0x21, 0x8d, 0xad, 0xd3, 0xc1, 0x05, + 0x83, 0xdb, 0x49, 0xcf, 0x39, +}; +static const size_t TEST_DVPT256_210_NONCE_LEN = 13; + +static const uint8_t TEST_DVPT256_210_ADATA[] = { + 0x3c, 0x0e, 0x28, 0x15, 0xd3, 0x7d, 0x84, 0x4f, + 0x7a, 0xc2, 0x40, 0xba, 0x9d, 0x6e, 0x3a, 0x0b, + 0x2a, 0x86, 0xf7, 0x06, 0xe8, 0x85, 0x95, 0x9e, + 0x09, 0xa1, 0x00, 0x5e, 0x02, 0x4f, 0x69, 0x07, +}; +static const size_t TEST_DVPT256_210_ADATA_LEN = 32; + +static const uint8_t TEST_DVPT256_210_EXPECTED[] = { + 0xc0, 0xea, 0x40, 0x0b, 0x59, 0x95, 0x61, 0xe7, + 0x90, 0x5b, 0x99, 0x26, 0x2b, 0x45, 0x65, 0xd5, + 0xc3, 0xdc, 0x49, 0xfa, 0xd8, 0x4d, 0x7c, 0x69, + 0xef, 0x89, 0x13, 0x39, +}; +static const size_t TEST_DVPT256_210_EXPECTED_LEN = 28; + +static const uint8_t TEST_DVPT256_210_INPUT[] = { + 0xe8, 0xde, 0x97, 0x0f, 0x6e, 0xe8, 0xe8, 0x0e, + 0xde, 0x93, 0x35, 0x81, 0xb5, 0xbc, 0xf4, 0xd8, + 0x37, 0xe2, 0xb7, 0x2b, 0xaa, 0x8b, 0x00, 0xc3, +}; +static const size_t TEST_DVPT256_210_INPUT_LEN = 24; + +static const uint8_t TEST_DVPT256_214_NONCE[] = { + 0x0d, 0xd6, 0x13, 0xc0, 0xfe, 0x28, 0xe9, 0x13, + 0xc0, 0xed, 0xbb, 0x84, 0x04, +}; +static const size_t TEST_DVPT256_214_NONCE_LEN = 13; + +static const uint8_t TEST_DVPT256_214_ADATA[] = { + 0x2a, 0xd3, 0x06, 0x57, 0x5b, 0x57, 0x7c, 0x2f, + 0x61, 0xda, 0x72, 0x12, 0xab, 0x63, 0xe3, 0xdb, + 0x39, 0x41, 0xf1, 0xf7, 0x51, 0xf2, 0x35, 0x6c, + 0x74, 0x43, 0x53, 0x1a, 0x90, 0xb9, 0xd1, 0x41, +}; +static const size_t TEST_DVPT256_214_ADATA_LEN = 32; + +static const uint8_t TEST_DVPT256_214_EXPECTED[] = { + 0xfa, 0xbe, 0x11, 0xc9, 0x62, 0x9e, 0x59, 0x82, + 0x28, 0xf5, 0x20, 0x9f, 0x3d, 0xbc, 0xc6, 0x41, + 0xfe, 0x4b, 0x1a, 0x22, 0xca, 0xdb, 0x08, 0x21, + 0xd2, 0x89, 0x8c, 0x3b, +}; +static const size_t TEST_DVPT256_214_EXPECTED_LEN = 28; + +static const uint8_t TEST_DVPT256_214_INPUT[] = { + 0x95, 0x22, 0xfb, 0x1f, 0x1a, 0xa5, 0x84, 0x93, + 0xcb, 0xa6, 0x82, 0xd7, 0x88, 0x18, 0x6d, 0x90, + 0x2c, 0xfc, 0x93, 0xe8, 0x0f, 0xd6, 0xb9, 0x98, +}; +static const size_t TEST_DVPT256_214_INPUT_LEN = 24; + +static const uint8_t TEST_DVPT256_216_NONCE[] = { + 0x3e, 0x0f, 0xe3, 0x42, 0x7e, 0xed, 0xa8, 0x0f, + 0x02, 0xdd, 0xa4, 0xfe, 0xd5, +}; +static const size_t TEST_DVPT256_216_NONCE_LEN = 13; + +static const uint8_t TEST_DVPT256_216_ADATA[] = { + 0xae, 0x0d, 0x1c, 0x9c, 0x83, 0x4d, 0x60, 0xff, + 0x0e, 0xcf, 0xb3, 0xc0, 0xd7, 0x8c, 0x72, 0xdd, + 0xb7, 0x89, 0xe5, 0x8a, 0xdf, 0xc1, 0x66, 0xc8, + 0x1d, 0x5f, 0xc6, 0x39, 0x5b, 0x31, 0xec, 0x33, +}; +static const size_t TEST_DVPT256_216_ADATA_LEN = 32; + +static const uint8_t TEST_DVPT256_216_EXPECTED[] = { + 0xd8, 0x8f, 0x8f, 0xcd, 0x77, 0x21, 0x25, 0x21, + 0x2c, 0xe0, 0x9c, 0x2a, 0x6e, 0x5b, 0x56, 0x93, + 0xdd, 0x35, 0x07, 0x3f, 0x99, 0x20, 0x04, 0xf0, + 0xd1, 0x8f, 0xc8, 0x89, +}; +static const size_t TEST_DVPT256_216_EXPECTED_LEN = 28; + +static const uint8_t TEST_DVPT256_216_INPUT[] = { + 0x38, 0x33, 0x3c, 0xe7, 0x81, 0x10, 0xbf, 0x53, + 0xa2, 0xc2, 0xab, 0xc7, 0xdb, 0x99, 0xe1, 0x33, + 0xad, 0x21, 0x8c, 0xa4, 0x3f, 0xf7, 0xa7, 0xbc, +}; +static const size_t TEST_DVPT256_216_INPUT_LEN = 24; + +static const uint8_t TEST_DVPT256_221_NONCE[] = { + 0x60, 0x12, 0x2c, 0xbd, 0x21, 0x9e, 0x5c, 0xf1, + 0x74, 0x15, 0xe8, 0xbc, 0x09, +}; +static const size_t TEST_DVPT256_221_NONCE_LEN = 13; + +static const uint8_t TEST_DVPT256_221_ADATA[] = { + 0x89, 0x5a, 0x45, 0xdd, 0xbe, 0x0c, 0x80, 0x79, + 0x3e, 0xcc, 0xbf, 0x82, 0x0d, 0xe1, 0x3a, 0x23, + 0x3b, 0x6a, 0xa7, 0x04, 0x5c, 0xfd, 0x53, 0x13, + 0x38, 0x8e, 0x71, 0x84, 0xc3, 0x92, 0xb2, 0x16, +}; +static const size_t TEST_DVPT256_221_ADATA_LEN = 32; + +static const uint8_t TEST_DVPT256_221_EXPECTED[] = { + 0x76, 0xbd, 0xd9, 0xa7, 0xb3, 0x4b, 0xf1, 0x4a, + 0xe1, 0x21, 0xa8, 0x7f, 0xdf, 0xa1, 0x44, 0xf7, + 0x1b, 0x84, 0x87, 0x44, 0xaf, 0x6a, 0x2f, 0x0b, + 0x1c, 0x0d, 0x06, 0x7c, +}; +static const size_t TEST_DVPT256_221_EXPECTED_LEN = 28; + +static const uint8_t TEST_DVPT256_221_INPUT[] = { + 0x79, 0x4e, 0x73, 0x49, 0x66, 0xe6, 0xd0, 0x00, + 0x16, 0x99, 0xae, 0xc3, 0xf8, 0xab, 0x8f, 0x19, + 0x4d, 0xe7, 0x65, 0x3d, 0x30, 0x91, 0xb1, 0xb9, +}; +static const size_t TEST_DVPT256_221_INPUT_LEN = 24; + +static const uint8_t TEST_DVPT256_223_NONCE[] = { + 0x35, 0x42, 0xfb, 0xe0, 0xf5, 0x9a, 0x6d, 0x5f, + 0x3a, 0xbf, 0x61, 0x9b, 0x7d, +}; +static const size_t TEST_DVPT256_223_NONCE_LEN = 13; + +static const uint8_t TEST_DVPT256_223_ADATA[] = { + 0xdd, 0x45, 0x31, 0xf1, 0x58, 0xa2, 0xfa, 0x3b, + 0xc8, 0xa3, 0x39, 0xf7, 0x70, 0x59, 0x50, 0x48, + 0xf4, 0xa4, 0x2b, 0xc1, 0xb0, 0x3f, 0x2e, 0x82, + 0x4e, 0xfc, 0x6b, 0xa4, 0x98, 0x51, 0x19, 0xd8, +}; +static const size_t TEST_DVPT256_223_ADATA_LEN = 32; + +static const uint8_t TEST_DVPT256_223_EXPECTED[] = { + 0x61, 0x7d, 0x80, 0x36, 0xe2, 0x03, 0x9d, 0x51, + 0x67, 0x09, 0x06, 0x23, 0x79, 0xe0, 0x55, 0x0c, + 0xbd, 0x71, 0xeb, 0xb9, 0x0f, 0xea, 0x96, 0x7c, + 0x79, 0x01, 0x8a, 0xd5, +}; +static const size_t TEST_DVPT256_223_EXPECTED_LEN = 28; + +static const uint8_t TEST_DVPT256_223_INPUT[] = { + 0xc5, 0xb3, 0xd7, 0x13, 0x12, 0xea, 0x14, 0xf2, + 0xf8, 0xfa, 0xe5, 0xbd, 0x1a, 0x45, 0x31, 0x92, + 0xb6, 0x60, 0x4a, 0x45, 0xdb, 0x75, 0xc5, 0xed, +}; +static const size_t TEST_DVPT256_223_INPUT_LEN = 24; + +/* Alen = 32, Plen = 24, Nlen = 13, Tlen = 16 */ +static const uint8_t TEST_DVPT256_GROUP_15_MAC_LEN = 16; + +static const uint8_t TEST_DVPT256_GROUP_15_KEY[] = { + 0x31, 0x4a, 0x20, 0x2f, 0x83, 0x6f, 0x9f, 0x25, + 0x7e, 0x22, 0xd8, 0xc1, 0x17, 0x57, 0x83, 0x2a, + 0xe5, 0x13, 0x1d, 0x35, 0x7a, 0x72, 0xdf, 0x88, + 0xf3, 0xef, 0xf0, 0xff, 0xce, 0xe0, 0xda, 0x4e, +}; +static const size_t TEST_DVPT256_GROUP_15_KEY_LEN = 32; + +static const uint8_t TEST_DVPT256_225_NONCE[] = { + 0xa5, 0x44, 0x21, 0x8d, 0xad, 0xd3, 0xc1, 0x05, + 0x83, 0xdb, 0x49, 0xcf, 0x39, +}; +static const size_t TEST_DVPT256_225_NONCE_LEN = 13; + +static const uint8_t TEST_DVPT256_225_ADATA[] = { + 0x3c, 0x0e, 0x28, 0x15, 0xd3, 0x7d, 0x84, 0x4f, + 0x7a, 0xc2, 0x40, 0xba, 0x9d, 0x6e, 0x3a, 0x0b, + 0x2a, 0x86, 0xf7, 0x06, 0xe8, 0x85, 0x95, 0x9e, + 0x09, 0xa1, 0x00, 0x5e, 0x02, 0x4f, 0x69, 0x07, +}; +static const size_t TEST_DVPT256_225_ADATA_LEN = 32; + +static const uint8_t TEST_DVPT256_225_EXPECTED[] = { + 0x8d, 0x34, 0xcd, 0xca, 0x37, 0xce, 0x77, 0xbe, + 0x68, 0xf6, 0x5b, 0xaf, 0x33, 0x82, 0xe3, 0x1e, + 0xfa, 0x69, 0x3e, 0x63, 0xf9, 0x14, 0xa7, 0x81, + 0x36, 0x7f, 0x30, 0xf2, 0xea, 0xad, 0x8c, 0x06, + 0x3c, 0xa5, 0x07, 0x95, 0xac, 0xd9, 0x02, 0x03, +}; +static const size_t TEST_DVPT256_225_EXPECTED_LEN = 40; + +static const uint8_t TEST_DVPT256_225_INPUT[] = { + 0xe8, 0xde, 0x97, 0x0f, 0x6e, 0xe8, 0xe8, 0x0e, + 0xde, 0x93, 0x35, 0x81, 0xb5, 0xbc, 0xf4, 0xd8, + 0x37, 0xe2, 0xb7, 0x2b, 0xaa, 0x8b, 0x00, 0xc3, +}; +static const size_t TEST_DVPT256_225_INPUT_LEN = 24; + +static const uint8_t TEST_DVPT256_229_NONCE[] = { + 0x0d, 0xd6, 0x13, 0xc0, 0xfe, 0x28, 0xe9, 0x13, + 0xc0, 0xed, 0xbb, 0x84, 0x04, +}; +static const size_t TEST_DVPT256_229_NONCE_LEN = 13; + +static const uint8_t TEST_DVPT256_229_ADATA[] = { + 0x2a, 0xd3, 0x06, 0x57, 0x5b, 0x57, 0x7c, 0x2f, + 0x61, 0xda, 0x72, 0x12, 0xab, 0x63, 0xe3, 0xdb, + 0x39, 0x41, 0xf1, 0xf7, 0x51, 0xf2, 0x35, 0x6c, + 0x74, 0x43, 0x53, 0x1a, 0x90, 0xb9, 0xd1, 0x41, +}; +static const size_t TEST_DVPT256_229_ADATA_LEN = 32; + +static const uint8_t TEST_DVPT256_229_EXPECTED[] = { + 0x6d, 0xf0, 0x96, 0x13, 0xea, 0x98, 0x6c, 0x2d, + 0x91, 0xa5, 0x7a, 0x45, 0xa0, 0x94, 0x2c, 0xbf, + 0x20, 0xe0, 0xdf, 0xca, 0x12, 0xfb, 0xda, 0x8c, + 0x94, 0x5e, 0xe6, 0xdb, 0x24, 0xae, 0xa5, 0xf5, + 0x09, 0x89, 0x52, 0xf1, 0x20, 0x33, 0x39, 0xce, +}; +static const size_t TEST_DVPT256_229_EXPECTED_LEN = 40; + +static const uint8_t TEST_DVPT256_229_INPUT[] = { + 0x95, 0x22, 0xfb, 0x1f, 0x1a, 0xa5, 0x84, 0x93, + 0xcb, 0xa6, 0x82, 0xd7, 0x88, 0x18, 0x6d, 0x90, + 0x2c, 0xfc, 0x93, 0xe8, 0x0f, 0xd6, 0xb9, 0x98, +}; +static const size_t TEST_DVPT256_229_INPUT_LEN = 24; + +static const uint8_t TEST_DVPT256_231_NONCE[] = { + 0x3e, 0x0f, 0xe3, 0x42, 0x7e, 0xed, 0xa8, 0x0f, + 0x02, 0xdd, 0xa4, 0xfe, 0xd5, +}; +static const size_t TEST_DVPT256_231_NONCE_LEN = 13; + +static const uint8_t TEST_DVPT256_231_ADATA[] = { + 0xae, 0x0d, 0x1c, 0x9c, 0x83, 0x4d, 0x60, 0xff, + 0x0e, 0xcf, 0xb3, 0xc0, 0xd7, 0x8c, 0x72, 0xdd, + 0xb7, 0x89, 0xe5, 0x8a, 0xdf, 0xc1, 0x66, 0xc8, + 0x1d, 0x5f, 0xc6, 0x39, 0x5b, 0x31, 0xec, 0x33, +}; +static const size_t TEST_DVPT256_231_ADATA_LEN = 32; + +static const uint8_t TEST_DVPT256_231_EXPECTED[] = { + 0x2b, 0xfe, 0x51, 0xf1, 0xf4, 0x3b, 0x98, 0x2d, + 0x47, 0xf7, 0x6e, 0xa8, 0x20, 0x6d, 0xdb, 0xf5, + 0x85, 0xd6, 0xf3, 0x0c, 0xec, 0x0d, 0x4e, 0xf1, + 0x6b, 0x15, 0x56, 0x63, 0x1d, 0x3b, 0x52, 0xbf, + 0x24, 0x15, 0x4a, 0xfe, 0xc1, 0x44, 0x8e, 0xf6, +}; +static const size_t TEST_DVPT256_231_EXPECTED_LEN = 40; + +static const uint8_t TEST_DVPT256_231_INPUT[] = { + 0x38, 0x33, 0x3c, 0xe7, 0x81, 0x10, 0xbf, 0x53, + 0xa2, 0xc2, 0xab, 0xc7, 0xdb, 0x99, 0xe1, 0x33, + 0xad, 0x21, 0x8c, 0xa4, 0x3f, 0xf7, 0xa7, 0xbc, +}; +static const size_t TEST_DVPT256_231_INPUT_LEN = 24; + +static const uint8_t TEST_DVPT256_236_NONCE[] = { + 0x60, 0x12, 0x2c, 0xbd, 0x21, 0x9e, 0x5c, 0xf1, + 0x74, 0x15, 0xe8, 0xbc, 0x09, +}; +static const size_t TEST_DVPT256_236_NONCE_LEN = 13; + +static const uint8_t TEST_DVPT256_236_ADATA[] = { + 0x89, 0x5a, 0x45, 0xdd, 0xbe, 0x0c, 0x80, 0x79, + 0x3e, 0xcc, 0xbf, 0x82, 0x0d, 0xe1, 0x3a, 0x23, + 0x3b, 0x6a, 0xa7, 0x04, 0x5c, 0xfd, 0x53, 0x13, + 0x38, 0x8e, 0x71, 0x84, 0xc3, 0x92, 0xb2, 0x16, +}; +static const size_t TEST_DVPT256_236_ADATA_LEN = 32; + +static const uint8_t TEST_DVPT256_236_EXPECTED[] = { + 0xbf, 0x0d, 0x21, 0x9b, 0xb5, 0x0f, 0xcc, 0x1d, + 0x51, 0xf6, 0x54, 0xbb, 0x0f, 0xd8, 0xb4, 0x4e, + 0xfa, 0x25, 0xae, 0xf3, 0x9e, 0x2f, 0x11, 0xaf, + 0xe4, 0x7d, 0x00, 0xf2, 0xee, 0xbb, 0x54, 0x4e, + 0x6b, 0xa7, 0x55, 0x9a, 0xc2, 0xf3, 0x4e, 0xdb, +}; +static const size_t TEST_DVPT256_236_EXPECTED_LEN = 40; + +static const uint8_t TEST_DVPT256_236_INPUT[] = { + 0x79, 0x4e, 0x73, 0x49, 0x66, 0xe6, 0xd0, 0x00, + 0x16, 0x99, 0xae, 0xc3, 0xf8, 0xab, 0x8f, 0x19, + 0x4d, 0xe7, 0x65, 0x3d, 0x30, 0x91, 0xb1, 0xb9, +}; +static const size_t TEST_DVPT256_236_INPUT_LEN = 24; + +static const uint8_t TEST_DVPT256_238_NONCE[] = { + 0x35, 0x42, 0xfb, 0xe0, 0xf5, 0x9a, 0x6d, 0x5f, + 0x3a, 0xbf, 0x61, 0x9b, 0x7d, +}; +static const size_t TEST_DVPT256_238_NONCE_LEN = 13; + +static const uint8_t TEST_DVPT256_238_ADATA[] = { + 0xdd, 0x45, 0x31, 0xf1, 0x58, 0xa2, 0xfa, 0x3b, + 0xc8, 0xa3, 0x39, 0xf7, 0x70, 0x59, 0x50, 0x48, + 0xf4, 0xa4, 0x2b, 0xc1, 0xb0, 0x3f, 0x2e, 0x82, + 0x4e, 0xfc, 0x6b, 0xa4, 0x98, 0x51, 0x19, 0xd8, +}; +static const size_t TEST_DVPT256_238_ADATA_LEN = 32; + +static const uint8_t TEST_DVPT256_238_EXPECTED[] = { + 0x39, 0xc2, 0xe8, 0xf6, 0xed, 0xfe, 0x66, 0x3b, + 0x90, 0x96, 0x3b, 0x98, 0xeb, 0x79, 0xe2, 0xd4, + 0xf7, 0xf2, 0x8a, 0x50, 0x53, 0xae, 0x88, 0x81, + 0x56, 0x7a, 0x6b, 0x44, 0x26, 0xf1, 0x66, 0x71, + 0x36, 0xbe, 0xd4, 0xa5, 0xe3, 0x2a, 0x2b, 0xc1, +}; +static const size_t TEST_DVPT256_238_EXPECTED_LEN = 40; + +static const uint8_t TEST_DVPT256_238_INPUT[] = { + 0xc5, 0xb3, 0xd7, 0x13, 0x12, 0xea, 0x14, 0xf2, + 0xf8, 0xfa, 0xe5, 0xbd, 0x1a, 0x45, 0x31, 0x92, + 0xb6, 0x60, 0x4a, 0x45, 0xdb, 0x75, 0xc5, 0xed, +}; +static const size_t TEST_DVPT256_238_INPUT_LEN = 24; + +/* Share test buffer output */ +static uint8_t data[512]; + +static void test_encrypt_op(const uint8_t *key, uint8_t key_len, + const uint8_t *adata, size_t adata_len, + const uint8_t *nonce, uint8_t nonce_len, + const uint8_t *plain, size_t plain_len, + const uint8_t *output_expected, + size_t output_expected_len, + uint8_t mac_length) +{ + cipher_t cipher; + int len, err, cmp; + size_t len_encoding = nonce_and_len_encoding_size - nonce_len; + + TEST_ASSERT_MESSAGE(sizeof(data) >= output_expected_len, + "Output buffer too small"); + + err = cipher_init(&cipher, CIPHER_AES, key, key_len); + TEST_ASSERT_EQUAL_INT(1, err); + + len = cipher_encrypt_ccm(&cipher, adata, adata_len, + mac_length, len_encoding, + nonce, nonce_len, plain, plain_len, data); + TEST_ASSERT_MESSAGE(len > 0, "Encryption failed"); + + TEST_ASSERT_EQUAL_INT(output_expected_len, len); + cmp = compare(output_expected, data, len); + TEST_ASSERT_MESSAGE(1 == cmp, "wrong ciphertext"); +} + +static void test_decrypt_op(const uint8_t *key, uint8_t key_len, + const uint8_t *adata, size_t adata_len, + const uint8_t *nonce, uint8_t nonce_len, + const uint8_t *encrypted, size_t encrypted_len, + const uint8_t *output_expected, + size_t output_expected_len, + uint8_t mac_length) +{ + cipher_t cipher; + int len, err, cmp; + size_t len_encoding = nonce_and_len_encoding_size - nonce_len; + + TEST_ASSERT_MESSAGE(sizeof(data) >= output_expected_len, + "Output buffer too small"); + + err = cipher_init(&cipher, CIPHER_AES, key, key_len); + TEST_ASSERT_EQUAL_INT(1, err); + + len = cipher_decrypt_ccm(&cipher, adata, adata_len, + mac_length, len_encoding, + nonce, nonce_len, encrypted, encrypted_len, data); + TEST_ASSERT_MESSAGE(len >= 0, "Decryption failed"); + + TEST_ASSERT_EQUAL_INT(output_expected_len, len); + cmp = compare(output_expected, data, len); + TEST_ASSERT_MESSAGE(1 == cmp, "wrong ciphertext"); + +} + +#define do_test_encrypt_op(prefix, test_num, group_num) do { \ + test_encrypt_op(TEST_ ## prefix ## _GROUP_ ## group_num ## _KEY, \ + TEST_ ## prefix ## _GROUP_ ## group_num ## _KEY_LEN, \ + TEST_ ## prefix ## _ ## test_num ## _ADATA, \ + TEST_ ## prefix ## _ ## test_num ## _ADATA_LEN, \ + TEST_ ## prefix ## _ ## test_num ## _NONCE, \ + TEST_ ## prefix ## _ ## test_num ## _NONCE_LEN, \ + TEST_ ## prefix ## _ ## test_num ## _INPUT, \ + TEST_ ## prefix ## _ ## test_num ## _INPUT_LEN, \ + TEST_ ## prefix ## _ ## test_num ## _EXPECTED, \ + TEST_ ## prefix ## _ ## test_num ## _EXPECTED_LEN, \ + TEST_ ## prefix ## _GROUP_ ## group_num ## _MAC_LEN \ + ); \ +} while (0) + +#define do_test_decrypt_op(prefix, test_num, group_num) do { \ + test_decrypt_op(TEST_ ## prefix ## _GROUP_ ## group_num ## _KEY, \ + TEST_ ## prefix ## _GROUP_ ## group_num ## _KEY_LEN, \ + TEST_ ## prefix ## _ ## test_num ## _ADATA, \ + TEST_ ## prefix ## _ ## test_num ## _ADATA_LEN, \ + TEST_ ## prefix ## _ ## test_num ## _NONCE, \ + TEST_ ## prefix ## _ ## test_num ## _NONCE_LEN, \ + TEST_ ## prefix ## _ ## test_num ## _EXPECTED, \ + TEST_ ## prefix ## _ ## test_num ## _EXPECTED_LEN, \ + TEST_ ## prefix ## _ ## test_num ## _INPUT, \ + TEST_ ## prefix ## _ ## test_num ## _INPUT_LEN, \ + TEST_ ## prefix ## _GROUP_ ## group_num ## _MAC_LEN \ + ); \ +} while (0) + +static void test_crypto_modes_ccm_decrypt(void) +{ + do_test_decrypt_op(DVPT256, 0, 0); + do_test_decrypt_op(DVPT256, 4, 0); + do_test_decrypt_op(DVPT256, 6, 0); + do_test_decrypt_op(DVPT256, 11, 0); + do_test_decrypt_op(DVPT256, 13, 0); + do_test_decrypt_op(DVPT256, 15, 1); + do_test_decrypt_op(DVPT256, 19, 1); + do_test_decrypt_op(DVPT256, 21, 1); + do_test_decrypt_op(DVPT256, 26, 1); + do_test_decrypt_op(DVPT256, 28, 1); + do_test_decrypt_op(DVPT256, 30, 2); + do_test_decrypt_op(DVPT256, 34, 2); + do_test_decrypt_op(DVPT256, 36, 2); + do_test_decrypt_op(DVPT256, 41, 2); + do_test_decrypt_op(DVPT256, 43, 2); + do_test_decrypt_op(DVPT256, 45, 3); + do_test_decrypt_op(DVPT256, 49, 3); + do_test_decrypt_op(DVPT256, 51, 3); + do_test_decrypt_op(DVPT256, 56, 3); + do_test_decrypt_op(DVPT256, 58, 3); + do_test_decrypt_op(DVPT256, 60, 4); + do_test_decrypt_op(DVPT256, 64, 4); + do_test_decrypt_op(DVPT256, 66, 4); + do_test_decrypt_op(DVPT256, 71, 4); + do_test_decrypt_op(DVPT256, 73, 4); + do_test_decrypt_op(DVPT256, 75, 5); + do_test_decrypt_op(DVPT256, 79, 5); + do_test_decrypt_op(DVPT256, 81, 5); + do_test_decrypt_op(DVPT256, 86, 5); + do_test_decrypt_op(DVPT256, 88, 5); + do_test_decrypt_op(DVPT256, 90, 6); + do_test_decrypt_op(DVPT256, 94, 6); + do_test_decrypt_op(DVPT256, 96, 6); + do_test_decrypt_op(DVPT256, 101, 6); + do_test_decrypt_op(DVPT256, 103, 6); + do_test_decrypt_op(DVPT256, 105, 7); + do_test_decrypt_op(DVPT256, 109, 7); + do_test_decrypt_op(DVPT256, 111, 7); + do_test_decrypt_op(DVPT256, 116, 7); + do_test_decrypt_op(DVPT256, 118, 7); + do_test_decrypt_op(DVPT256, 120, 8); + do_test_decrypt_op(DVPT256, 124, 8); + do_test_decrypt_op(DVPT256, 126, 8); + do_test_decrypt_op(DVPT256, 131, 8); + do_test_decrypt_op(DVPT256, 133, 8); + do_test_decrypt_op(DVPT256, 135, 9); + do_test_decrypt_op(DVPT256, 139, 9); + do_test_decrypt_op(DVPT256, 141, 9); + do_test_decrypt_op(DVPT256, 146, 9); + do_test_decrypt_op(DVPT256, 148, 9); + do_test_decrypt_op(DVPT256, 150, 10); + do_test_decrypt_op(DVPT256, 154, 10); + do_test_decrypt_op(DVPT256, 156, 10); + do_test_decrypt_op(DVPT256, 161, 10); + do_test_decrypt_op(DVPT256, 163, 10); + do_test_decrypt_op(DVPT256, 165, 11); + do_test_decrypt_op(DVPT256, 169, 11); + do_test_decrypt_op(DVPT256, 171, 11); + do_test_decrypt_op(DVPT256, 176, 11); + do_test_decrypt_op(DVPT256, 178, 11); + do_test_decrypt_op(DVPT256, 180, 12); + do_test_decrypt_op(DVPT256, 184, 12); + do_test_decrypt_op(DVPT256, 186, 12); + do_test_decrypt_op(DVPT256, 191, 12); + do_test_decrypt_op(DVPT256, 193, 12); + do_test_decrypt_op(DVPT256, 195, 13); + do_test_decrypt_op(DVPT256, 199, 13); + do_test_decrypt_op(DVPT256, 201, 13); + do_test_decrypt_op(DVPT256, 206, 13); + do_test_decrypt_op(DVPT256, 208, 13); + do_test_decrypt_op(DVPT256, 210, 14); + do_test_decrypt_op(DVPT256, 214, 14); + do_test_decrypt_op(DVPT256, 216, 14); + do_test_decrypt_op(DVPT256, 221, 14); + do_test_decrypt_op(DVPT256, 223, 14); + do_test_decrypt_op(DVPT256, 225, 15); + do_test_decrypt_op(DVPT256, 229, 15); + do_test_decrypt_op(DVPT256, 231, 15); + do_test_decrypt_op(DVPT256, 236, 15); + do_test_decrypt_op(DVPT256, 238, 15); +} +static void test_crypto_modes_ccm_encrypt(void) +{ + do_test_encrypt_op(DVPT256, 0, 0); + do_test_encrypt_op(DVPT256, 4, 0); + do_test_encrypt_op(DVPT256, 6, 0); + do_test_encrypt_op(DVPT256, 11, 0); + do_test_encrypt_op(DVPT256, 13, 0); + do_test_encrypt_op(DVPT256, 15, 1); + do_test_encrypt_op(DVPT256, 19, 1); + do_test_encrypt_op(DVPT256, 21, 1); + do_test_encrypt_op(DVPT256, 26, 1); + do_test_encrypt_op(DVPT256, 28, 1); + do_test_encrypt_op(DVPT256, 30, 2); + do_test_encrypt_op(DVPT256, 34, 2); + do_test_encrypt_op(DVPT256, 36, 2); + do_test_encrypt_op(DVPT256, 41, 2); + do_test_encrypt_op(DVPT256, 43, 2); + do_test_encrypt_op(DVPT256, 45, 3); + do_test_encrypt_op(DVPT256, 49, 3); + do_test_encrypt_op(DVPT256, 51, 3); + do_test_encrypt_op(DVPT256, 56, 3); + do_test_encrypt_op(DVPT256, 58, 3); + do_test_encrypt_op(DVPT256, 60, 4); + do_test_encrypt_op(DVPT256, 64, 4); + do_test_encrypt_op(DVPT256, 66, 4); + do_test_encrypt_op(DVPT256, 71, 4); + do_test_encrypt_op(DVPT256, 73, 4); + do_test_encrypt_op(DVPT256, 75, 5); + do_test_encrypt_op(DVPT256, 79, 5); + do_test_encrypt_op(DVPT256, 81, 5); + do_test_encrypt_op(DVPT256, 86, 5); + do_test_encrypt_op(DVPT256, 88, 5); + do_test_encrypt_op(DVPT256, 90, 6); + do_test_encrypt_op(DVPT256, 94, 6); + do_test_encrypt_op(DVPT256, 96, 6); + do_test_encrypt_op(DVPT256, 101, 6); + do_test_encrypt_op(DVPT256, 103, 6); + do_test_encrypt_op(DVPT256, 105, 7); + do_test_encrypt_op(DVPT256, 109, 7); + do_test_encrypt_op(DVPT256, 111, 7); + do_test_encrypt_op(DVPT256, 116, 7); + do_test_encrypt_op(DVPT256, 118, 7); + do_test_encrypt_op(DVPT256, 120, 8); + do_test_encrypt_op(DVPT256, 124, 8); + do_test_encrypt_op(DVPT256, 126, 8); + do_test_encrypt_op(DVPT256, 131, 8); + do_test_encrypt_op(DVPT256, 133, 8); + do_test_encrypt_op(DVPT256, 135, 9); + do_test_encrypt_op(DVPT256, 139, 9); + do_test_encrypt_op(DVPT256, 141, 9); + do_test_encrypt_op(DVPT256, 146, 9); + do_test_encrypt_op(DVPT256, 148, 9); + do_test_encrypt_op(DVPT256, 150, 10); + do_test_encrypt_op(DVPT256, 154, 10); + do_test_encrypt_op(DVPT256, 156, 10); + do_test_encrypt_op(DVPT256, 161, 10); + do_test_encrypt_op(DVPT256, 163, 10); + do_test_encrypt_op(DVPT256, 165, 11); + do_test_encrypt_op(DVPT256, 169, 11); + do_test_encrypt_op(DVPT256, 171, 11); + do_test_encrypt_op(DVPT256, 176, 11); + do_test_encrypt_op(DVPT256, 178, 11); + do_test_encrypt_op(DVPT256, 180, 12); + do_test_encrypt_op(DVPT256, 184, 12); + do_test_encrypt_op(DVPT256, 186, 12); + do_test_encrypt_op(DVPT256, 191, 12); + do_test_encrypt_op(DVPT256, 193, 12); + do_test_encrypt_op(DVPT256, 195, 13); + do_test_encrypt_op(DVPT256, 199, 13); + do_test_encrypt_op(DVPT256, 201, 13); + do_test_encrypt_op(DVPT256, 206, 13); + do_test_encrypt_op(DVPT256, 208, 13); + do_test_encrypt_op(DVPT256, 210, 14); + do_test_encrypt_op(DVPT256, 214, 14); + do_test_encrypt_op(DVPT256, 216, 14); + do_test_encrypt_op(DVPT256, 221, 14); + do_test_encrypt_op(DVPT256, 223, 14); + do_test_encrypt_op(DVPT256, 225, 15); + do_test_encrypt_op(DVPT256, 229, 15); + do_test_encrypt_op(DVPT256, 231, 15); + do_test_encrypt_op(DVPT256, 236, 15); + do_test_encrypt_op(DVPT256, 238, 15); +} + +Test *tests_crypto_modes_ccm_tests_256(void) +{ + EMB_UNIT_TESTFIXTURES(fixtures) { + new_TestFixture(test_crypto_modes_ccm_encrypt), + new_TestFixture(test_crypto_modes_ccm_decrypt), + }; + + EMB_UNIT_TESTCALLER(crypto_modes_ccm_tests_256, NULL, NULL, fixtures); + + return (Test *)&crypto_modes_ccm_tests_256; +} From f5ca90b007be2e5845a7cadac2c97aa5fb390b64 Mon Sep 17 00:00:00 2001 From: Ollrogge Date: Thu, 22 Apr 2021 09:55:03 +0200 Subject: [PATCH 4/5] sys/crypto, sys/random: Fix Kconfig files in response to AES changes --- sys/crypto/Kconfig | 23 ++++------------------- sys/random/Kconfig | 2 +- 2 files changed, 5 insertions(+), 20 deletions(-) diff --git a/sys/crypto/Kconfig b/sys/crypto/Kconfig index ce99ad759a..9311436a8a 100644 --- a/sys/crypto/Kconfig +++ b/sys/crypto/Kconfig @@ -5,28 +5,13 @@ # directory for more details. # -menu "Crypto" - -config MODULE_CRYPTO - bool "Common cryptographic functionalities" +menuconfig MODULE_CRYPTO + bool "Crypto" depends on TEST_KCONFIG -choice - bool "Crypto block ciphers API implementation" - optional - depends on TEST_KCONFIG - help - The common Crypto block ciphers API has multiple implementations. Choose - one of the following. - -config CRYPTO_AES - bool "AES" - select MODULE_CRYPTO - -endchoice +if MODULE_CRYPTO menu "Crypto AES options" -depends on CRYPTO_AES config MODULE_CRYPTO_AES_128 bool "AES-128" @@ -50,4 +35,4 @@ endmenu # Crypto AES options rsource "modes/Kconfig" -endmenu # Crypto +endif # Crypto diff --git a/sys/random/Kconfig b/sys/random/Kconfig index f771737ee7..21aaaabc67 100644 --- a/sys/random/Kconfig +++ b/sys/random/Kconfig @@ -25,7 +25,7 @@ config MODULE_PRNG_FORTUNA select MODULE_XTIMER select MODULE_FORTUNA select MODULE_CRYPTO - depends on MODULE_CRYPTO_AES + select MODULE_CRYPTO_AES_128 config MODULE_PRNG_HWRNG bool "Hardware RNG" From 46a0ef07b131d15e68dc0d947d817903a238d106 Mon Sep 17 00:00:00 2001 From: Ollrogge Date: Thu, 22 Apr 2021 10:17:20 +0200 Subject: [PATCH 5/5] tests/sys/crypto: Split test application to reduce size --- tests/sys_crypto/Makefile.ci | 6 +++ tests/sys_crypto/README.md | 33 ++++++++++++ tests/sys_crypto/app.config.test | 5 +- tests/sys_crypto/main.c | 3 -- tests/sys_crypto/tests-crypto-chacha.c | 7 +++ .../tests-crypto-chacha20poly1305.c | 6 +++ tests/sys_crypto/tests-crypto-poly1305.c | 6 +++ tests/sys_crypto/tests-crypto.h | 3 -- tests/sys_crypto_aes_ccm/Makefile | 10 ++++ tests/sys_crypto_aes_ccm/Makefile.ci | 28 +++++++++++ tests/sys_crypto_aes_ccm/README.md | 18 +++++++ tests/sys_crypto_aes_ccm/app.config.test | 11 ++++ tests/sys_crypto_aes_ccm/main.c | 19 +++++++ .../tests-crypto-modes-ccm-128.c | 0 .../tests-crypto-modes-ccm-192.c | 0 .../tests-crypto-modes-ccm-256.c | 2 +- tests/sys_crypto_aes_ccm/tests-crypto.h | 50 +++++++++++++++++++ tests/sys_crypto_aes_ccm/tests/01-run.py | 14 ++++++ 18 files changed, 213 insertions(+), 8 deletions(-) create mode 100644 tests/sys_crypto/README.md create mode 100644 tests/sys_crypto_aes_ccm/Makefile create mode 100644 tests/sys_crypto_aes_ccm/Makefile.ci create mode 100644 tests/sys_crypto_aes_ccm/README.md create mode 100644 tests/sys_crypto_aes_ccm/app.config.test create mode 100644 tests/sys_crypto_aes_ccm/main.c rename tests/{sys_crypto => sys_crypto_aes_ccm}/tests-crypto-modes-ccm-128.c (100%) rename tests/{sys_crypto => sys_crypto_aes_ccm}/tests-crypto-modes-ccm-192.c (100%) rename tests/{sys_crypto => sys_crypto_aes_ccm}/tests-crypto-modes-ccm-256.c (99%) create mode 100644 tests/sys_crypto_aes_ccm/tests-crypto.h create mode 100755 tests/sys_crypto_aes_ccm/tests/01-run.py diff --git a/tests/sys_crypto/Makefile.ci b/tests/sys_crypto/Makefile.ci index 6f722e32bd..aa7a5ddab2 100644 --- a/tests/sys_crypto/Makefile.ci +++ b/tests/sys_crypto/Makefile.ci @@ -4,9 +4,14 @@ BOARD_INSUFFICIENT_MEMORY := \ arduino-mega2560 \ arduino-nano \ arduino-uno \ + atmega1284p \ atmega328p \ atmega328p-xplained-mini \ atxmega-a1u-xpro \ + atxmega-a3bu-xplained \ + derfmega128 \ + mega-xplained \ + microduino-corerf \ msb-430 \ msb-430h \ nucleo-f031k6 \ @@ -19,4 +24,5 @@ BOARD_INSUFFICIENT_MEMORY := \ telosb \ waspmote-pro \ z1 \ + zigduino \ # diff --git a/tests/sys_crypto/README.md b/tests/sys_crypto/README.md new file mode 100644 index 0000000000..97f16ef3c9 --- /dev/null +++ b/tests/sys_crypto/README.md @@ -0,0 +1,33 @@ +# Overview + +This test application tests all the components of the crypto module in RIOT. +Specifically these are: + +* ChaCha. Test vectors from [draft-strombergson-chacha-test-vectors-00]. +* Poly1305. Test vectors from [draft-nir-cfrg-chacha20-poly1305-06]. +* ChaCha20-Poly1305. Test vectors from [rfc7539]. +* AES-CBC. Test vectors from [SP 800-38C]. +* AES-CCM. Test vectors from [RFC3610], [SP 800-38C], [Wycheproof]. +* AES-CTR. Test vectors from [SP 800-38C]. +* AES-ECB. Test vectors from [SP 800-38C]. +* AES-OCB. Test vectors from [RFC7253]. + +To build the test application run + +``` +make +``` + +To execute the test run + +``` +make term +``` + +[draft-nir-cfrg-chacha20-poly1305-06]: https://tools.ietf.org/html/draft-nir-cfrg-chacha20-poly1305-06#appendix-A.3 +[draft-strombergson-chacha-test-vectors-00]: https://tools.ietf.org/html/draft-strombergson-chacha-test-vectors-00 +[rfc7539]: https://tools.ietf.org/html/rfc7539#appendix-A +[SP 800-38C]: http://csrc.nist.gov/publications/nistpubs/800-38a/sp800-38a.pdf +[RFC3610]: https://tools.ietf.org/html/rfc3610 +[Wycheproof]: https://github.com/google/wycheproof/blob/master/testvectors/aes_ccm_test.json +[RFC7253]: https://tools.ietf.org/html/rfc7253#appendix-A \ No newline at end of file diff --git a/tests/sys_crypto/app.config.test b/tests/sys_crypto/app.config.test index de98095fab..8420f852d5 100644 --- a/tests/sys_crypto/app.config.test +++ b/tests/sys_crypto/app.config.test @@ -1,7 +1,10 @@ # this file enables modules defined in Kconfig. Do not use this file for # application configuration. This is only needed during migration. -CONFIG_MODULE_CRYPTO_3DES=y +CONFIG_MODULE_CRYPTO=y +CONFIG_MODULE_CRYPTO_AES_128=y +CONFIG_MODULE_CRYPTO_AES_192=y +CONFIG_MODULE_CRYPTO_AES_256=y CONFIG_MODULE_CIPHER_MODES=y CONFIG_MODULE_EMBUNIT=y diff --git a/tests/sys_crypto/main.c b/tests/sys_crypto/main.c index 1ab7debf17..9cf320889e 100644 --- a/tests/sys_crypto/main.c +++ b/tests/sys_crypto/main.c @@ -19,9 +19,6 @@ int main(void) TESTS_RUN(tests_crypto_aes_tests()); TESTS_RUN(tests_crypto_cipher_tests()); TESTS_RUN(tests_crypto_modes_ccm_tests()); - TESTS_RUN(tests_crypto_modes_ccm_tests_128()); - TESTS_RUN(tests_crypto_modes_ccm_tests_192()); - TESTS_RUN(tests_crypto_modes_ccm_tests_256()); TESTS_RUN(tests_crypto_modes_ocb_tests()); TESTS_RUN(tests_crypto_modes_ecb_tests()); TESTS_RUN(tests_crypto_modes_cbc_tests()); diff --git a/tests/sys_crypto/tests-crypto-chacha.c b/tests/sys_crypto/tests-crypto-chacha.c index 0097239613..71de747a71 100644 --- a/tests/sys_crypto/tests-crypto-chacha.c +++ b/tests/sys_crypto/tests-crypto-chacha.c @@ -13,6 +13,13 @@ #include +/* + * Test Vectors for the Stream Cipher ChaCha + * draft-strombergson-chacha-test-vectors-00 + * + * https://tools.ietf.org/html/draft-strombergson-chacha-test-vectors-00 + */ + static const uint8_t TC8_KEY[32] = { 0xc4, 0x6e, 0xc1, 0xb1, 0x8c, 0xe8, 0xa8, 0x78, 0x72, 0x5a, 0x37, 0xe7, 0x80, 0xdf, 0xb7, 0x35, diff --git a/tests/sys_crypto/tests-crypto-chacha20poly1305.c b/tests/sys_crypto/tests-crypto-chacha20poly1305.c index a22cd67d00..c5979c4c00 100644 --- a/tests/sys_crypto/tests-crypto-chacha20poly1305.c +++ b/tests/sys_crypto/tests-crypto-chacha20poly1305.c @@ -15,6 +15,12 @@ #include "crypto/chacha20poly1305.h" +/* + * Example and Test Vector for AEAD_CHACHA20_POLY1305 + * + * https://tools.ietf.org/html/rfc7539#appendix-A + */ + /* ciphertext buffer */ uint8_t ebuf[1024]; /* Plaintext buffer */ diff --git a/tests/sys_crypto/tests-crypto-poly1305.c b/tests/sys_crypto/tests-crypto-poly1305.c index 2ca5a29a45..38351e85a9 100644 --- a/tests/sys_crypto/tests-crypto-poly1305.c +++ b/tests/sys_crypto/tests-crypto-poly1305.c @@ -14,6 +14,12 @@ #include +/* + * Poly1305 Message Authentication Code + * + * https://tools.ietf.org/html/draft-nir-cfrg-chacha20-poly1305-06#appendix-A.3 + */ + static const uint8_t key_1[32] = { 0 }; static const uint8_t msg_1[64] = { 0 }; static const uint8_t tag_1[16] = { 0 }; diff --git a/tests/sys_crypto/tests-crypto.h b/tests/sys_crypto/tests-crypto.h index b316b50d06..eddf2d73ba 100644 --- a/tests/sys_crypto/tests-crypto.h +++ b/tests/sys_crypto/tests-crypto.h @@ -59,9 +59,6 @@ static inline int compare(const uint8_t *a, const uint8_t *b, uint8_t len) Test* tests_crypto_aes_tests(void); Test* tests_crypto_cipher_tests(void); Test* tests_crypto_modes_ccm_tests(void); -Test* tests_crypto_modes_ccm_tests_128(void); -Test* tests_crypto_modes_ccm_tests_192(void); -Test* tests_crypto_modes_ccm_tests_256(void); Test* tests_crypto_modes_ocb_tests(void); Test* tests_crypto_modes_ecb_tests(void); Test* tests_crypto_modes_cbc_tests(void); diff --git a/tests/sys_crypto_aes_ccm/Makefile b/tests/sys_crypto_aes_ccm/Makefile new file mode 100644 index 0000000000..f9438f3de8 --- /dev/null +++ b/tests/sys_crypto_aes_ccm/Makefile @@ -0,0 +1,10 @@ +include ../Makefile.tests_common + +USEMODULE += embunit + +USEMODULE += cipher_modes +USEMODULE += crypto_aes_128 +USEMODULE += crypto_aes_192 +USEMODULE += crypto_aes_256 + +include $(RIOTBASE)/Makefile.include diff --git a/tests/sys_crypto_aes_ccm/Makefile.ci b/tests/sys_crypto_aes_ccm/Makefile.ci new file mode 100644 index 0000000000..aa7a5ddab2 --- /dev/null +++ b/tests/sys_crypto_aes_ccm/Makefile.ci @@ -0,0 +1,28 @@ +BOARD_INSUFFICIENT_MEMORY := \ + arduino-duemilanove \ + arduino-leonardo \ + arduino-mega2560 \ + arduino-nano \ + arduino-uno \ + atmega1284p \ + atmega328p \ + atmega328p-xplained-mini \ + atxmega-a1u-xpro \ + atxmega-a3bu-xplained \ + derfmega128 \ + mega-xplained \ + microduino-corerf \ + msb-430 \ + msb-430h \ + nucleo-f031k6 \ + nucleo-f042k6 \ + nucleo-l011k4 \ + nucleo-l031k6 \ + samd10-xmini \ + stk3200 \ + stm32f030f4-demo \ + telosb \ + waspmote-pro \ + z1 \ + zigduino \ + # diff --git a/tests/sys_crypto_aes_ccm/README.md b/tests/sys_crypto_aes_ccm/README.md new file mode 100644 index 0000000000..c580d81731 --- /dev/null +++ b/tests/sys_crypto_aes_ccm/README.md @@ -0,0 +1,18 @@ +# Overview + +This test application specifically tests the AES CCM implementation for 128, 192 and 256 +bit keys. The test utilizes the [CAVP AES CCM DVTP] test vectors. + +To build the test application run + +``` +make +``` + +To execute the test run + +``` +make term +``` + +[CAVP AES CCM DVTP]: https://csrc.nist.gov/projects/cryptographic-algorithm-validation-program/cavp-testing-block-cipher-modes \ No newline at end of file diff --git a/tests/sys_crypto_aes_ccm/app.config.test b/tests/sys_crypto_aes_ccm/app.config.test new file mode 100644 index 0000000000..8420f852d5 --- /dev/null +++ b/tests/sys_crypto_aes_ccm/app.config.test @@ -0,0 +1,11 @@ +# this file enables modules defined in Kconfig. Do not use this file for +# application configuration. This is only needed during migration. + +CONFIG_MODULE_CRYPTO=y +CONFIG_MODULE_CRYPTO_AES_128=y +CONFIG_MODULE_CRYPTO_AES_192=y +CONFIG_MODULE_CRYPTO_AES_256=y +CONFIG_MODULE_CIPHER_MODES=y + +CONFIG_MODULE_EMBUNIT=y +CONFIG_MODULE_TEST_UTILS_INTERACTIVE_SYNC=y diff --git a/tests/sys_crypto_aes_ccm/main.c b/tests/sys_crypto_aes_ccm/main.c new file mode 100644 index 0000000000..0cb83c9dd3 --- /dev/null +++ b/tests/sys_crypto_aes_ccm/main.c @@ -0,0 +1,19 @@ +/* + * Copyright (C) 2021 Nils Ollrogge + * + * This file is subject to the terms and conditions of the GNU Lesser + * General Public License v2.1. See the file LICENSE in the top level + * directory for more details. + */ + +#include "tests-crypto.h" + +int main(void) +{ + TESTS_START(); + TESTS_RUN(tests_crypto_modes_ccm_tests_128()); + TESTS_RUN(tests_crypto_modes_ccm_tests_192()); + TESTS_RUN(tests_crypto_modes_ccm_tests_256()); + TESTS_END(); + return 0; +} diff --git a/tests/sys_crypto/tests-crypto-modes-ccm-128.c b/tests/sys_crypto_aes_ccm/tests-crypto-modes-ccm-128.c similarity index 100% rename from tests/sys_crypto/tests-crypto-modes-ccm-128.c rename to tests/sys_crypto_aes_ccm/tests-crypto-modes-ccm-128.c diff --git a/tests/sys_crypto/tests-crypto-modes-ccm-192.c b/tests/sys_crypto_aes_ccm/tests-crypto-modes-ccm-192.c similarity index 100% rename from tests/sys_crypto/tests-crypto-modes-ccm-192.c rename to tests/sys_crypto_aes_ccm/tests-crypto-modes-ccm-192.c diff --git a/tests/sys_crypto/tests-crypto-modes-ccm-256.c b/tests/sys_crypto_aes_ccm/tests-crypto-modes-ccm-256.c similarity index 99% rename from tests/sys_crypto/tests-crypto-modes-ccm-256.c rename to tests/sys_crypto_aes_ccm/tests-crypto-modes-ccm-256.c index da509e1409..9174442a35 100644 --- a/tests/sys_crypto/tests-crypto-modes-ccm-256.c +++ b/tests/sys_crypto_aes_ccm/tests-crypto-modes-ccm-256.c @@ -20,7 +20,7 @@ /** * AES CCM DVTP test vectors (SP 800-38C) for 256 bit keys. * https://csrc.nist.gov/projects/cryptographic-algorithm-validation-program/cavp-testing-block-cipher-modes -*/ + */ static const size_t nonce_and_len_encoding_size = 15; diff --git a/tests/sys_crypto_aes_ccm/tests-crypto.h b/tests/sys_crypto_aes_ccm/tests-crypto.h new file mode 100644 index 0000000000..ef65c1ca3e --- /dev/null +++ b/tests/sys_crypto_aes_ccm/tests-crypto.h @@ -0,0 +1,50 @@ +/* + * Copyright (C) 2021 Freie Universität Berlin + * + * This file is subject to the terms and conditions of the GNU Lesser + * General Public License v2.1. See the file LICENSE in the top level + * directory for more details. + */ + +/** + * @addtogroup unittests + * @{ + * + * @file + * @brief Unittests for the ``crypto`` module + * + * @author Nils Ollrogge + */ +#ifndef TESTS_CRYPTO_H +#define TESTS_CRYPTO_H + +#include +#include + +#include "embUnit.h" + +#ifdef __cplusplus +extern "C" { +#endif + +static inline int compare(const uint8_t *a, const uint8_t *b, uint8_t len) +{ + int result = 1; + + for (uint8_t i = 0; i < len; ++i) { + result &= a[i] == b[i]; + } + + return result; +} + +Test *tests_crypto_modes_ccm_tests_128(void); +Test *tests_crypto_modes_ccm_tests_192(void); +Test *tests_crypto_modes_ccm_tests_256(void); + +#ifdef __cplusplus +} +#endif + +#endif /* TESTS_CRYPTO_H */ +/** @} */ diff --git a/tests/sys_crypto_aes_ccm/tests/01-run.py b/tests/sys_crypto_aes_ccm/tests/01-run.py new file mode 100755 index 0000000000..aec47345a2 --- /dev/null +++ b/tests/sys_crypto_aes_ccm/tests/01-run.py @@ -0,0 +1,14 @@ +#!/usr/bin/env python3 + +# Copyright (C) 2019 Freie Universität Berlin +# +# This file is subject to the terms and conditions of the GNU Lesser +# General Public License v2.1. See the file LICENSE in the top level +# directory for more details. + +import sys +from testrunner import run_check_unittests + + +if __name__ == "__main__": + sys.exit(run_check_unittests())