summaryrefslogtreecommitdiffstats
path: root/src/plugins/unittest/crypto
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/unittest/crypto')
-rw-r--r--src/plugins/unittest/crypto/aes_cbc.c14
-rw-r--r--src/plugins/unittest/crypto/aes_gcm.c54
-rw-r--r--src/plugins/unittest/crypto/crypto.h2
-rw-r--r--src/plugins/unittest/crypto/rfc2202_hmac_sha1.c10
4 files changed, 78 insertions, 2 deletions
diff --git a/src/plugins/unittest/crypto/aes_cbc.c b/src/plugins/unittest/crypto/aes_cbc.c
index b3e95e4c093..05a16c29a5c 100644
--- a/src/plugins/unittest/crypto/aes_cbc.c
+++ b/src/plugins/unittest/crypto/aes_cbc.c
@@ -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* */
/*
diff --git a/src/plugins/unittest/crypto/aes_gcm.c b/src/plugins/unittest/crypto/aes_gcm.c
index 764ca9e97c5..3d1b221bf32 100644
--- a/src/plugins/unittest/crypto/aes_gcm.c
+++ b/src/plugins/unittest/crypto/aes_gcm.c
@@ -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* */
/*
diff --git a/src/plugins/unittest/crypto/crypto.h b/src/plugins/unittest/crypto/crypto.h
index d95c994dfd2..5e09a3ab0ec 100644
--- a/src/plugins/unittest/crypto/crypto.h
+++ b/src/plugins/unittest/crypto/crypto.h
@@ -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;
diff --git a/src/plugins/unittest/crypto/rfc2202_hmac_sha1.c b/src/plugins/unittest/crypto/rfc2202_hmac_sha1.c
index d009afe6af7..2513c5ebad2 100644
--- a/src/plugins/unittest/crypto/rfc2202_hmac_sha1.c
+++ b/src/plugins/unittest/crypto/rfc2202_hmac_sha1.c
@@ -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* */
/*