crypto: add support for testing quad loops in crypto algos
This patch adds support for test cases with arbitrary long plaintext. Type: feature Change-Id: I48cd3642e30cc49eabc196c45d7f73c484e93057 Signed-off-by: Filip Tehlar <ftehlar@cisco.com>
This commit is contained in:

committed by
Damjan Marion

parent
dd398c6c5c
commit
a9075dcf65
@ -137,6 +137,20 @@ UNITTEST_REGISTER_CRYPTO_TEST (nist_aes256_cbc_chained) = {
|
||||
TEST_DATA_CHUNK (ciphertext256, 32, 32),
|
||||
},
|
||||
};
|
||||
|
||||
UNITTEST_REGISTER_CRYPTO_TEST (nist_aes256_incr) = {
|
||||
.name = "NIST SP 800-38A incr (1024 B)",
|
||||
.alg = VNET_CRYPTO_ALG_AES_256_CBC,
|
||||
.key.length = 32,
|
||||
.plaintext_incremental = 1024,
|
||||
};
|
||||
|
||||
UNITTEST_REGISTER_CRYPTO_TEST (nist_aes256_incr2) = {
|
||||
.name = "NIST SP 800-38A incr (1056 B)",
|
||||
.alg = VNET_CRYPTO_ALG_AES_256_CBC,
|
||||
.key.length = 32,
|
||||
.plaintext_incremental = 1056,
|
||||
};
|
||||
/* *INDENT-ON* */
|
||||
|
||||
/*
|
||||
|
@ -264,6 +264,60 @@ UNITTEST_REGISTER_CRYPTO_TEST (aes_gcm256_tc4_chain) = {
|
||||
TEST_DATA_CHUNK (tc4_ciphertext256, 40, 20),
|
||||
},
|
||||
};
|
||||
|
||||
UNITTEST_REGISTER_CRYPTO_TEST (aes_gcm256_inc_1024) = {
|
||||
.name = "256-GCM (incr 1024 B)",
|
||||
.alg = VNET_CRYPTO_ALG_AES_256_GCM,
|
||||
.plaintext_incremental = 1024,
|
||||
.key.length = 32,
|
||||
.aad.length = 20,
|
||||
.tag.length = 16,
|
||||
};
|
||||
|
||||
UNITTEST_REGISTER_CRYPTO_TEST (aes_gcm256_inc1) = {
|
||||
.name = "256-GCM (incr 1056 B)",
|
||||
.alg = VNET_CRYPTO_ALG_AES_256_GCM,
|
||||
.plaintext_incremental = 1024 + 32,
|
||||
.key.length = 32,
|
||||
.aad.length = 20,
|
||||
.tag.length = 16,
|
||||
};
|
||||
|
||||
UNITTEST_REGISTER_CRYPTO_TEST (aes_gcm256_inc2) = {
|
||||
.name = "256-GCM (incr 1042 B)",
|
||||
.alg = VNET_CRYPTO_ALG_AES_256_GCM,
|
||||
.plaintext_incremental = 1024 + 8,
|
||||
.key.length = 32,
|
||||
.aad.length = 20,
|
||||
.tag.length = 16,
|
||||
};
|
||||
|
||||
UNITTEST_REGISTER_CRYPTO_TEST (aes_gcm256_inc3) = {
|
||||
.name = "256-GCM (incr 1025 B)",
|
||||
.alg = VNET_CRYPTO_ALG_AES_256_GCM,
|
||||
.plaintext_incremental = 1024 + 1,
|
||||
.key.length = 32,
|
||||
.aad.length = 20,
|
||||
.tag.length = 16,
|
||||
};
|
||||
|
||||
UNITTEST_REGISTER_CRYPTO_TEST (aes_gcm256_inc4) = {
|
||||
.name = "256-GCM (incr 1009 B)",
|
||||
.alg = VNET_CRYPTO_ALG_AES_256_GCM,
|
||||
.plaintext_incremental = 1024 - 15,
|
||||
.key.length = 32,
|
||||
.aad.length = 20,
|
||||
.tag.length = 16,
|
||||
};
|
||||
|
||||
UNITTEST_REGISTER_CRYPTO_TEST (aes_gcm256_inc5) = {
|
||||
.name = "256-GCM (incr 1008)",
|
||||
.alg = VNET_CRYPTO_ALG_AES_256_GCM,
|
||||
.plaintext_incremental = 1024 - 16,
|
||||
.key.length = 32,
|
||||
.aad.length = 20,
|
||||
.tag.length = 16,
|
||||
};
|
||||
/* *INDENT-ON* */
|
||||
|
||||
/*
|
||||
|
@ -31,6 +31,7 @@ typedef struct unittest_crypto_test_registration
|
||||
vnet_crypto_alg_t alg;
|
||||
unittest_crypto_test_data_t iv, key, digest, plaintext, ciphertext, aad,
|
||||
tag;
|
||||
u32 plaintext_incremental;
|
||||
u8 is_chained;
|
||||
|
||||
/* plaintext and cipher text data used for testing chained buffers */
|
||||
@ -45,6 +46,7 @@ typedef struct unittest_crypto_test_registration
|
||||
typedef struct
|
||||
{
|
||||
int verbose;
|
||||
u8 *inc_data;
|
||||
|
||||
/* perf */
|
||||
vnet_crypto_alg_t alg;
|
||||
|
@ -216,9 +216,7 @@ UNITTEST_REGISTER_CRYPTO_TEST (rfc_2202_sha1_tc7) = {
|
||||
.plaintext = TEST_DATA (sha1_tc7_data),
|
||||
.digest = TEST_DATA (sha1_tc7_digest),
|
||||
};
|
||||
/* *INDENT-ON* */
|
||||
|
||||
/* *INDENT-OFF* */
|
||||
UNITTEST_REGISTER_CRYPTO_TEST (rfc_2202_sha1_tc7_chained) = {
|
||||
.name = "RFC2202 HMAC-SHA-1 TC7 [chained]",
|
||||
.alg = VNET_CRYPTO_ALG_HMAC_SHA1,
|
||||
@ -231,6 +229,14 @@ UNITTEST_REGISTER_CRYPTO_TEST (rfc_2202_sha1_tc7_chained) = {
|
||||
TEST_DATA_CHUNK (sha1_tc7_data, 40, 33)
|
||||
},
|
||||
};
|
||||
|
||||
UNITTEST_REGISTER_CRYPTO_TEST (rfc_2202_sha1_tc7_inc) = {
|
||||
.name = "HMAC-SHA-1 incremental (1024 B)",
|
||||
.alg = VNET_CRYPTO_ALG_HMAC_SHA1,
|
||||
.plaintext_incremental = 1024,
|
||||
.key.length = 80,
|
||||
.digest.length = 12,
|
||||
};
|
||||
/* *INDENT-ON* */
|
||||
|
||||
/*
|
||||
|
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user