diff options
Diffstat (limited to 'src/plugins/unittest/crypto')
-rw-r--r-- | src/plugins/unittest/crypto/aes_cbc.c | 48 | ||||
-rw-r--r-- | src/plugins/unittest/crypto/aes_gcm.c | 91 | ||||
-rw-r--r-- | src/plugins/unittest/crypto/crypto.h | 7 | ||||
-rw-r--r-- | src/plugins/unittest/crypto/rfc2202_hmac_md5.c | 42 | ||||
-rw-r--r-- | src/plugins/unittest/crypto/rfc2202_hmac_sha1.c | 49 | ||||
-rw-r--r-- | src/plugins/unittest/crypto/rfc4231.c | 172 |
6 files changed, 235 insertions, 174 deletions
diff --git a/src/plugins/unittest/crypto/aes_cbc.c b/src/plugins/unittest/crypto/aes_cbc.c index 465f91e675f..b52f728a1cb 100644 --- a/src/plugins/unittest/crypto/aes_cbc.c +++ b/src/plugins/unittest/crypto/aes_cbc.c @@ -54,23 +54,15 @@ static u8 ciphertext128[] = { }; /* *INDENT-OFF* */ -UNITTEST_REGISTER_CRYPTO_TEST (nist_aes128_cbc_enc) = { +UNITTEST_REGISTER_CRYPTO_TEST (nist_aes128_cbc) = { .name = "NIST SP 800-38A", - .op = VNET_CRYPTO_OP_AES_128_CBC_ENC, + .alg = VNET_CRYPTO_ALG_AES_128_CBC, .iv = TEST_DATA (iv), .key = TEST_DATA (key128), - .data = TEST_DATA (plaintext), - .expected = TEST_DATA (ciphertext128), + .plaintext = TEST_DATA (plaintext), + .ciphertext = TEST_DATA (ciphertext128), }; -UNITTEST_REGISTER_CRYPTO_TEST (nist_aes128_cbc_dec) = { - .name = "NIST SP 800-38A", - .op = VNET_CRYPTO_OP_AES_128_CBC_DEC, - .iv = TEST_DATA (iv), - .key = TEST_DATA (key128), - .data = TEST_DATA (ciphertext128), - .expected = TEST_DATA (plaintext), -}; /* *INDENT-ON* */ static u8 key192[24] = { @@ -91,23 +83,15 @@ static u8 ciphertext192[64] = { }; /* *INDENT-OFF* */ -UNITTEST_REGISTER_CRYPTO_TEST (nist_aes192_cbc_enc) = { +UNITTEST_REGISTER_CRYPTO_TEST (nist_aes192_cbc) = { .name = "NIST SP 800-38A", - .op = VNET_CRYPTO_OP_AES_192_CBC_ENC, + .alg = VNET_CRYPTO_ALG_AES_192_CBC, .iv = TEST_DATA (iv), .key = TEST_DATA (key192), - .data = TEST_DATA (plaintext), - .expected = TEST_DATA (ciphertext192), + .plaintext = TEST_DATA (plaintext), + .ciphertext = TEST_DATA (ciphertext192), }; -UNITTEST_REGISTER_CRYPTO_TEST (nist_aes192_cbc_dec) = { - .name = "NIST SP 800-38A", - .op = VNET_CRYPTO_OP_AES_192_CBC_DEC, - .iv = TEST_DATA (iv), - .key = TEST_DATA (key192), - .data = TEST_DATA (ciphertext192), - .expected = TEST_DATA (plaintext), -}; /* *INDENT-ON* */ static u8 key256[32] = { @@ -129,23 +113,15 @@ static u8 ciphertext256[64] = { }; /* *INDENT-OFF* */ -UNITTEST_REGISTER_CRYPTO_TEST (nist_aes256_cbc_enc) = { +UNITTEST_REGISTER_CRYPTO_TEST (nist_aes256_cbc) = { .name = "NIST SP 800-38A", - .op = VNET_CRYPTO_OP_AES_256_CBC_ENC, + .alg = VNET_CRYPTO_ALG_AES_256_CBC, .iv = TEST_DATA (iv), .key = TEST_DATA (key256), - .data = TEST_DATA (plaintext), - .expected = TEST_DATA (ciphertext256), + .plaintext = TEST_DATA (plaintext), + .ciphertext = TEST_DATA (ciphertext256), }; -UNITTEST_REGISTER_CRYPTO_TEST (nist_aes256_cbc_dec) = { - .name = "NIST SP 800-38A", - .op = VNET_CRYPTO_OP_AES_256_CBC_DEC, - .iv = TEST_DATA (iv), - .key = TEST_DATA (key256), - .data = TEST_DATA (ciphertext256), - .expected = TEST_DATA (plaintext), -}; /* *INDENT-ON* */ /* diff --git a/src/plugins/unittest/crypto/aes_gcm.c b/src/plugins/unittest/crypto/aes_gcm.c new file mode 100644 index 00000000000..826979e74e7 --- /dev/null +++ b/src/plugins/unittest/crypto/aes_gcm.c @@ -0,0 +1,91 @@ +/* + * Copyright (c) 2019 Cisco and/or its affiliates. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at: + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/* Test vectors published in GCM Specification */ + +#include <vppinfra/clib.h> +#include <vnet/crypto/crypto.h> +#include <unittest/crypto/crypto.h> + +static u8 tc6_iv[] = { + 0x93, 0x13, 0x22, 0x5d, 0xf8, 0x84, 0x06, 0xe5, + 0x55, 0x90, 0x9c, 0x5a, 0xff, 0x52, 0x69, 0xaa, + 0x6a, 0x7a, 0x95, 0x38, 0x53, 0x4f, 0x7d, 0xa1, + 0xe4, 0xc3, 0x03, 0xd2, 0xa3, 0x18, 0xa7, 0x28, + 0xc3, 0xc0, 0xc9, 0x51, 0x56, 0x80, 0x95, 0x39, + 0xfc, 0xf0, 0xe2, 0x42, 0x9a, 0x6b, 0x52, 0x54, + 0x16, 0xae, 0xdb, 0xf5, 0xa0, 0xde, 0x6a, 0x57, + 0xa6, 0x37, 0xb3, 0x9b +}; + +static u8 tc6_plaintext[] = { + 0xd9, 0x31, 0x32, 0x25, 0xf8, 0x84, 0x06, 0xe5, + 0xa5, 0x59, 0x09, 0xc5, 0xaf, 0xf5, 0x26, 0x9a, + 0x86, 0xa7, 0xa9, 0x53, 0x15, 0x34, 0xf7, 0xda, + 0x2e, 0x4c, 0x30, 0x3d, 0x8a, 0x31, 0x8a, 0x72, + 0x1c, 0x3c, 0x0c, 0x95, 0x95, 0x68, 0x09, 0x53, + 0x2f, 0xcf, 0x0e, 0x24, 0x49, 0xa6, 0xb5, 0x25, + 0xb1, 0x6a, 0xed, 0xf5, 0xaa, 0x0d, 0xe6, 0x57, + 0xba, 0x63, 0x7b, 0x39, +}; + +static u8 tc6_key[] = { + 0xfe, 0xff, 0xe9, 0x92, 0x86, 0x65, 0x73, 0x1c, + 0x6d, 0x6a, 0x8f, 0x94, 0x67, 0x30, 0x83, 0x08 +}; + +static u8 tc6_aad[] = { + 0xfe, 0xed, 0xfa, 0xce, 0xde, 0xad, 0xbe, 0xef, + 0xfe, 0xed, 0xfa, 0xce, 0xde, 0xad, 0xbe, 0xef, + 0xab, 0xad, 0xda, 0xd2 +}; + +static u8 tc6_ciphertext[] = { + 0x8c, 0xe2, 0x49, 0x98, 0x62, 0x56, 0x15, 0xb6, + 0x03, 0xa0, 0x33, 0xac, 0xa1, 0x3f, 0xb8, 0x94, + 0xbe, 0x91, 0x12, 0xa5, 0xc3, 0xa2, 0x11, 0xa8, + 0xba, 0x26, 0x2a, 0x3c, 0xca, 0x7e, 0x2c, 0xa7, + 0x01, 0xe4, 0xa9, 0xa4, 0xfb, 0xa4, 0x3c, 0x90, + 0xcc, 0xdc, 0xb2, 0x81, 0xd4, 0x8c, 0x7c, 0x6f, + 0xd6, 0x28, 0x75, 0xd2, 0xac, 0xa4, 0x17, 0x03, + 0x4c, 0x34, 0xae, 0xe5 +}; + +static u8 tc6_tag[] = { + 0x61, 0x9c, 0xc5, 0xae, 0xff, 0xfe, 0x0b, 0xfa, + 0x46, 0x2a, 0xf4, 0x3c, 0x16, 0x99, 0xd0, 0x50, +}; + +/* *INDENT-OFF* */ +UNITTEST_REGISTER_CRYPTO_TEST (aes_gcm_tc6) = { + .name = "GCM Spec. TC6", + .alg = VNET_CRYPTO_ALG_AES_128_GCM, + .iv = TEST_DATA (tc6_iv), + .key = TEST_DATA (tc6_key), + .plaintext = TEST_DATA (tc6_plaintext), + .ciphertext = TEST_DATA (tc6_ciphertext), + .tag = TEST_DATA (tc6_tag), + .aad = TEST_DATA (tc6_aad), +}; + +/* *INDENT-ON* */ + +/* + * fd.io coding-style-patch-verification: ON + * + * Local Variables: + * eval: (c-set-style "gnu") + * End: + */ diff --git a/src/plugins/unittest/crypto/crypto.h b/src/plugins/unittest/crypto/crypto.h index 1945c69fd4c..587d7b76a2f 100644 --- a/src/plugins/unittest/crypto/crypto.h +++ b/src/plugins/unittest/crypto/crypto.h @@ -26,10 +26,9 @@ typedef struct typedef struct unittest_crypto_test_registration { char *name; - vnet_crypto_alg_t alg:8; - vnet_crypto_op_type_t op:8; - unittest_crypto_test_data_t iv, key, data, expected; - u8 hmac_trunc_len; + vnet_crypto_alg_t alg; + unittest_crypto_test_data_t iv, key, digest, plaintext, ciphertext, aad, + tag; /* next */ struct unittest_crypto_test_registration *next; diff --git a/src/plugins/unittest/crypto/rfc2202_hmac_md5.c b/src/plugins/unittest/crypto/rfc2202_hmac_md5.c index da6da7e47f4..76bd8a5f443 100644 --- a/src/plugins/unittest/crypto/rfc2202_hmac_md5.c +++ b/src/plugins/unittest/crypto/rfc2202_hmac_md5.c @@ -34,10 +34,10 @@ static u8 md5_tc1_digest[] = { /* *INDENT-OFF* */ UNITTEST_REGISTER_CRYPTO_TEST (rfc_2202_md5_tc1) = { .name = "RFC2202 HMAC-MD5 TC1", - .op = VNET_CRYPTO_OP_MD5_HMAC, + .alg = VNET_CRYPTO_ALG_HMAC_MD5, .key = TEST_DATA (md5_tc1_key), - .data = TEST_DATA (md5_tc1_data), - .expected = TEST_DATA (md5_tc1_digest), + .plaintext = TEST_DATA (md5_tc1_data), + .digest = TEST_DATA (md5_tc1_digest), }; /* *INDENT-ON* */ @@ -53,10 +53,10 @@ static u8 md5_tc2_digest[] = { /* *INDENT-OFF* */ UNITTEST_REGISTER_CRYPTO_TEST (rfc_2202_md5_tc2) = { .name = "RFC2202 HMAC-MD5 TC2", - .op = VNET_CRYPTO_OP_MD5_HMAC, + .alg = VNET_CRYPTO_ALG_HMAC_MD5, .key = TEST_DATA (md5_tc2_key), - .data = TEST_DATA (md5_tc2_data), - .expected = TEST_DATA (md5_tc2_digest), + .plaintext = TEST_DATA (md5_tc2_data), + .digest = TEST_DATA (md5_tc2_digest), }; /* *INDENT-ON* */ @@ -83,10 +83,10 @@ static u8 md5_tc3_digest[] = { /* *INDENT-OFF* */ UNITTEST_REGISTER_CRYPTO_TEST (rfc_2202_md5_tc3) = { .name = "RFC2202 HMAC-MD5 TC3", - .op = VNET_CRYPTO_OP_MD5_HMAC, + .alg = VNET_CRYPTO_ALG_HMAC_MD5, .key = TEST_DATA (md5_tc3_key), - .data = TEST_DATA (md5_tc3_data), - .expected = TEST_DATA (md5_tc3_digest), + .plaintext = TEST_DATA (md5_tc3_data), + .digest = TEST_DATA (md5_tc3_digest), }; /* *INDENT-ON* */ @@ -115,10 +115,10 @@ static u8 md5_tc4_digest[] = { /* *INDENT-OFF* */ UNITTEST_REGISTER_CRYPTO_TEST (rfc_2202_md5_tc4) = { .name = "RFC2202 HMAC-MD5 TC4", - .op = VNET_CRYPTO_OP_MD5_HMAC, + .alg = VNET_CRYPTO_ALG_HMAC_MD5, .key = TEST_DATA (md5_tc4_key), - .data = TEST_DATA (md5_tc4_data), - .expected = TEST_DATA (md5_tc4_digest), + .plaintext = TEST_DATA (md5_tc4_data), + .digest = TEST_DATA (md5_tc4_digest), }; /* *INDENT-ON* */ @@ -137,10 +137,10 @@ static u8 md5_tc5_digest[] = { /* *INDENT-OFF* */ UNITTEST_REGISTER_CRYPTO_TEST (rfc_2202_md5_tc5) = { .name = "RFC2202 HMAC-MD5 TC5", - .op = VNET_CRYPTO_OP_MD5_HMAC, + .alg = VNET_CRYPTO_ALG_HMAC_MD5, .key = TEST_DATA (md5_tc5_key), - .data = TEST_DATA (md5_tc5_data), - .expected = TEST_DATA (md5_tc5_digest), + .plaintext = TEST_DATA (md5_tc5_data), + .digest = TEST_DATA (md5_tc5_digest), }; /* *INDENT-ON* */ @@ -168,10 +168,10 @@ static u8 md5_tc6_digest[] = { /* *INDENT-OFF* */ UNITTEST_REGISTER_CRYPTO_TEST (rfc_2202_md5_tc6) = { .name = "RFC2202 HMAC-MD5 TC6", - .op = VNET_CRYPTO_OP_MD5_HMAC, + .alg = VNET_CRYPTO_ALG_HMAC_MD5, .key = TEST_DATA (md5_tc6_key), - .data = TEST_DATA (md5_tc6_data), - .expected = TEST_DATA (md5_tc6_digest), + .plaintext = TEST_DATA (md5_tc6_data), + .digest = TEST_DATA (md5_tc6_digest), }; /* *INDENT-ON* */ @@ -186,10 +186,10 @@ static u8 md5_tc7_digest[] = { /* *INDENT-OFF* */ UNITTEST_REGISTER_CRYPTO_TEST (rfc_2202_md5_tc7) = { .name = "RFC2202 HMAC-MD5 TC7", - .op = VNET_CRYPTO_OP_MD5_HMAC, + .alg = VNET_CRYPTO_ALG_HMAC_MD5, .key = TEST_DATA (md5_tc6_key), - .data = TEST_DATA (md5_tc7_data), - .expected = TEST_DATA (md5_tc7_digest), + .plaintext = TEST_DATA (md5_tc7_data), + .digest = TEST_DATA (md5_tc7_digest), }; /* *INDENT-ON* */ diff --git a/src/plugins/unittest/crypto/rfc2202_hmac_sha1.c b/src/plugins/unittest/crypto/rfc2202_hmac_sha1.c index 13505218891..b3942aafa59 100644 --- a/src/plugins/unittest/crypto/rfc2202_hmac_sha1.c +++ b/src/plugins/unittest/crypto/rfc2202_hmac_sha1.c @@ -36,10 +36,10 @@ static u8 sha1_tc1_digest[] = { /* *INDENT-OFF* */ UNITTEST_REGISTER_CRYPTO_TEST (rfc_2202_sha1_tc1) = { .name = "RFC2202 HMAC-SHA-1 TC1", - .op = VNET_CRYPTO_OP_SHA1_HMAC, + .alg = VNET_CRYPTO_ALG_HMAC_SHA1, .key = TEST_DATA (sha1_tc1_key), - .data = TEST_DATA (sha1_tc1_data), - .expected = TEST_DATA (sha1_tc1_digest), + .plaintext = TEST_DATA (sha1_tc1_data), + .digest = TEST_DATA (sha1_tc1_digest), }; /* *INDENT-ON* */ @@ -56,10 +56,10 @@ static u8 sha1_tc2_digest[] = { /* *INDENT-OFF* */ UNITTEST_REGISTER_CRYPTO_TEST (rfc_2202_sha1_tc2) = { .name = "RFC2202 HMAC-SHA-1 TC2", - .op = VNET_CRYPTO_OP_SHA1_HMAC, + .alg = VNET_CRYPTO_ALG_HMAC_SHA1, .key = TEST_DATA (sha1_tc2_key), - .data = TEST_DATA (sha1_tc2_data), - .expected = TEST_DATA (sha1_tc2_digest), + .plaintext = TEST_DATA (sha1_tc2_data), + .digest = TEST_DATA (sha1_tc2_digest), }; /* *INDENT-ON* */ @@ -88,10 +88,10 @@ static u8 sha1_tc3_digest[] = { /* *INDENT-OFF* */ UNITTEST_REGISTER_CRYPTO_TEST (rfc_2202_sha1_tc3) = { .name = "RFC2202 HMAC-SHA-1 TC3", - .op = VNET_CRYPTO_OP_SHA1_HMAC, + .alg = VNET_CRYPTO_ALG_HMAC_SHA1, .key = TEST_DATA (sha1_tc3_key), - .data = TEST_DATA (sha1_tc3_data), - .expected = TEST_DATA (sha1_tc3_digest), + .plaintext = TEST_DATA (sha1_tc3_data), + .digest = TEST_DATA (sha1_tc3_digest), }; /* *INDENT-ON* */ @@ -121,10 +121,10 @@ static u8 sha1_tc4_digest[] = { /* *INDENT-OFF* */ UNITTEST_REGISTER_CRYPTO_TEST (rfc_2202_sha1_tc4) = { .name = "RFC2202 HMAC-SHA-1 TC4", - .op = VNET_CRYPTO_OP_SHA1_HMAC, + .alg = VNET_CRYPTO_ALG_HMAC_SHA1, .key = TEST_DATA (sha1_tc4_key), - .data = TEST_DATA (sha1_tc4_data), - .expected = TEST_DATA (sha1_tc4_digest), + .plaintext = TEST_DATA (sha1_tc4_data), + .digest = TEST_DATA (sha1_tc4_digest), }; /* *INDENT-ON* */ @@ -145,10 +145,10 @@ static u8 sha1_tc5_digest[] = { /* *INDENT-OFF* */ UNITTEST_REGISTER_CRYPTO_TEST (rfc_2202_sha1_tc5) = { .name = "RFC2202 HMAC-SHA-1 TC5", - .op = VNET_CRYPTO_OP_SHA1_HMAC, + .alg = VNET_CRYPTO_ALG_HMAC_SHA1, .key = TEST_DATA (sha1_tc5_key), - .data = TEST_DATA (sha1_tc5_data), - .expected = TEST_DATA (sha1_tc5_digest), + .plaintext = TEST_DATA (sha1_tc5_data), + .digest = TEST_DATA (sha1_tc5_digest), }; /* *INDENT-ON* */ @@ -160,11 +160,10 @@ static u8 sha1_tc5_digest_96[12] = { /* *INDENT-OFF* */ UNITTEST_REGISTER_CRYPTO_TEST (rfc_2202_sha1_tc5_trunc) = { .name = "RFC2202 HMAC-SHA-1-96 TC5-trunc", - .op = VNET_CRYPTO_OP_SHA1_HMAC, + .alg = VNET_CRYPTO_ALG_HMAC_SHA1, .key = TEST_DATA (sha1_tc5_key), - .data = TEST_DATA (sha1_tc5_data), - .expected = TEST_DATA (sha1_tc5_digest_96), - .hmac_trunc_len = 12, + .plaintext = TEST_DATA (sha1_tc5_data), + .digest = TEST_DATA (sha1_tc5_digest_96), }; /* *INDENT-ON* */ @@ -193,10 +192,10 @@ static u8 sha1_tc6_digest[] = { /* *INDENT-OFF* */ UNITTEST_REGISTER_CRYPTO_TEST (rfc_2202_sha1_tc6) = { .name = "RFC2202 HMAC-SHA-1 TC6", - .op = VNET_CRYPTO_OP_SHA1_HMAC, + .alg = VNET_CRYPTO_ALG_HMAC_SHA1, .key = TEST_DATA (sha1_tc6_key), - .data = TEST_DATA (sha1_tc6_data), - .expected = TEST_DATA (sha1_tc6_digest), + .plaintext = TEST_DATA (sha1_tc6_data), + .digest = TEST_DATA (sha1_tc6_digest), }; /* *INDENT-ON* */ @@ -212,10 +211,10 @@ static u8 sha1_tc7_digest[20] = { /* *INDENT-OFF* */ UNITTEST_REGISTER_CRYPTO_TEST (rfc_2202_sha1_tc7) = { .name = "RFC2202 HMAC-SHA-1 TC7", - .op = VNET_CRYPTO_OP_SHA1_HMAC, + .alg = VNET_CRYPTO_ALG_HMAC_SHA1, .key = TEST_DATA (sha1_tc6_key), - .data = TEST_DATA (sha1_tc7_data), - .expected = TEST_DATA (sha1_tc7_digest), + .plaintext = TEST_DATA (sha1_tc7_data), + .digest = TEST_DATA (sha1_tc7_digest), }; /* *INDENT-ON* */ diff --git a/src/plugins/unittest/crypto/rfc4231.c b/src/plugins/unittest/crypto/rfc4231.c index 4943e7d647d..b247d62f2a9 100644 --- a/src/plugins/unittest/crypto/rfc4231.c +++ b/src/plugins/unittest/crypto/rfc4231.c @@ -64,34 +64,34 @@ static u8 tc1_digest_sha512[] = { /* *INDENT-OFF* */ UNITTEST_REGISTER_CRYPTO_TEST (rfc4231_tc1_sha224) = { .name = "RFC4231 TC1", - .op = VNET_CRYPTO_OP_SHA224_HMAC, + .alg = VNET_CRYPTO_ALG_HMAC_SHA224, .key = TEST_DATA (tc1_key), - .data = TEST_DATA (tc1_data), - .expected = TEST_DATA (tc1_digest_sha224), + .plaintext = TEST_DATA (tc1_data), + .digest = TEST_DATA (tc1_digest_sha224), }; UNITTEST_REGISTER_CRYPTO_TEST (rfc4231_tc1_sha256) = { .name = "RFC4231 TC1", - .op = VNET_CRYPTO_OP_SHA256_HMAC, + .alg = VNET_CRYPTO_ALG_HMAC_SHA256, .key = TEST_DATA (tc1_key), - .data = TEST_DATA (tc1_data), - .expected = TEST_DATA (tc1_digest_sha256), + .plaintext = TEST_DATA (tc1_data), + .digest = TEST_DATA (tc1_digest_sha256), }; UNITTEST_REGISTER_CRYPTO_TEST (rfc4231_tc1_sha384) = { .name = "RFC4231 TC1", - .op = VNET_CRYPTO_OP_SHA384_HMAC, + .alg = VNET_CRYPTO_ALG_HMAC_SHA384, .key = TEST_DATA (tc1_key), - .data = TEST_DATA (tc1_data), - .expected = TEST_DATA (tc1_digest_sha384), + .plaintext = TEST_DATA (tc1_data), + .digest = TEST_DATA (tc1_digest_sha384), }; UNITTEST_REGISTER_CRYPTO_TEST (rfc4231_tc1_sha512) = { .name = "RFC4231 TC1", - .op = VNET_CRYPTO_OP_SHA512_HMAC, + .alg = VNET_CRYPTO_ALG_HMAC_SHA512, .key = TEST_DATA (tc1_key), - .data = TEST_DATA (tc1_data), - .expected = TEST_DATA (tc1_digest_sha512), + .plaintext = TEST_DATA (tc1_data), + .digest = TEST_DATA (tc1_digest_sha512), }; /* *INDENT-ON* */ @@ -136,34 +136,34 @@ static u8 tc2_digest_sha512[] = { /* *INDENT-OFF* */ UNITTEST_REGISTER_CRYPTO_TEST (rfc4231_tc2_sha224) = { .name = "RFC4231 TC2", - .op = VNET_CRYPTO_OP_SHA224_HMAC, + .alg = VNET_CRYPTO_ALG_HMAC_SHA224, .key = TEST_DATA (tc2_key), - .data = TEST_DATA (tc2_data), - .expected = TEST_DATA (tc2_digest_sha224), + .plaintext = TEST_DATA (tc2_data), + .digest = TEST_DATA (tc2_digest_sha224), }; UNITTEST_REGISTER_CRYPTO_TEST (rfc4231_tc2_sha256) = { .name = "RFC4231 TC2", - .op = VNET_CRYPTO_OP_SHA256_HMAC, + .alg = VNET_CRYPTO_ALG_HMAC_SHA256, .key = TEST_DATA (tc2_key), - .data = TEST_DATA (tc2_data), - .expected = TEST_DATA (tc2_digest_sha256), + .plaintext = TEST_DATA (tc2_data), + .digest = TEST_DATA (tc2_digest_sha256), }; UNITTEST_REGISTER_CRYPTO_TEST (rfc4231_tc2_sha384) = { .name = "RFC4231 TC2", - .op = VNET_CRYPTO_OP_SHA384_HMAC, + .alg = VNET_CRYPTO_ALG_HMAC_SHA384, .key = TEST_DATA (tc2_key), - .data = TEST_DATA (tc2_data), - .expected = TEST_DATA (tc2_digest_sha384), + .plaintext = TEST_DATA (tc2_data), + .digest = TEST_DATA (tc2_digest_sha384), }; UNITTEST_REGISTER_CRYPTO_TEST (rfc4231_tc2_sha512) = { .name = "RFC4231 TC2", - .op = VNET_CRYPTO_OP_SHA512_HMAC, + .alg = VNET_CRYPTO_ALG_HMAC_SHA512, .key = TEST_DATA (tc2_key), - .data = TEST_DATA (tc2_data), - .expected = TEST_DATA (tc2_digest_sha512), + .plaintext = TEST_DATA (tc2_data), + .digest = TEST_DATA (tc2_digest_sha512), }; /* *INDENT-ON* */ @@ -220,34 +220,34 @@ static u8 tc3_digest_sha512[] = { /* *INDENT-OFF* */ UNITTEST_REGISTER_CRYPTO_TEST (rfc4231_tc3_sha224) = { .name = "RFC4231 TC3", - .op = VNET_CRYPTO_OP_SHA224_HMAC, + .alg = VNET_CRYPTO_ALG_HMAC_SHA224, .key = TEST_DATA (tc3_key), - .data = TEST_DATA (tc3_data), - .expected = TEST_DATA (tc3_digest_sha224), + .plaintext = TEST_DATA (tc3_data), + .digest = TEST_DATA (tc3_digest_sha224), }; UNITTEST_REGISTER_CRYPTO_TEST (rfc4231_tc3_sha256) = { .name = "RFC4231 TC3", - .op = VNET_CRYPTO_OP_SHA256_HMAC, + .alg = VNET_CRYPTO_ALG_HMAC_SHA256, .key = TEST_DATA (tc3_key), - .data = TEST_DATA (tc3_data), - .expected = TEST_DATA (tc3_digest_sha256), + .plaintext = TEST_DATA (tc3_data), + .digest = TEST_DATA (tc3_digest_sha256), }; UNITTEST_REGISTER_CRYPTO_TEST (rfc4231_tc3_sha384) = { .name = "RFC4231 TC3", - .op = VNET_CRYPTO_OP_SHA384_HMAC, + .alg = VNET_CRYPTO_ALG_HMAC_SHA384, .key = TEST_DATA (tc3_key), - .data = TEST_DATA (tc3_data), - .expected = TEST_DATA (tc3_digest_sha384), + .plaintext = TEST_DATA (tc3_data), + .digest = TEST_DATA (tc3_digest_sha384), }; UNITTEST_REGISTER_CRYPTO_TEST (rfc4231_tc3_sha512) = { .name = "RFC4231 TC3", - .op = VNET_CRYPTO_OP_SHA512_HMAC, + .alg = VNET_CRYPTO_ALG_HMAC_SHA512, .key = TEST_DATA (tc3_key), - .data = TEST_DATA (tc3_data), - .expected = TEST_DATA (tc3_digest_sha512), + .plaintext = TEST_DATA (tc3_data), + .digest = TEST_DATA (tc3_digest_sha512), }; /* *INDENT-ON* */ @@ -305,34 +305,34 @@ static u8 tc4_digest_sha512[] = { /* *INDENT-OFF* */ UNITTEST_REGISTER_CRYPTO_TEST (rfc4231_tc4_sha224) = { .name = "RFC4231 TC4", - .op = VNET_CRYPTO_OP_SHA224_HMAC, + .alg = VNET_CRYPTO_ALG_HMAC_SHA224, .key = TEST_DATA (tc4_key), - .data = TEST_DATA (tc4_data), - .expected = TEST_DATA (tc4_digest_sha224), + .plaintext = TEST_DATA (tc4_data), + .digest = TEST_DATA (tc4_digest_sha224), }; UNITTEST_REGISTER_CRYPTO_TEST (rfc4231_tc4_sha256) = { .name = "RFC4231 TC4", - .op = VNET_CRYPTO_OP_SHA256_HMAC, + .alg = VNET_CRYPTO_ALG_HMAC_SHA256, .key = TEST_DATA (tc4_key), - .data = TEST_DATA (tc4_data), - .expected = TEST_DATA (tc4_digest_sha256), + .plaintext = TEST_DATA (tc4_data), + .digest = TEST_DATA (tc4_digest_sha256), }; UNITTEST_REGISTER_CRYPTO_TEST (rfc4231_tc4_sha384) = { .name = "RFC4231 TC4", - .op = VNET_CRYPTO_OP_SHA384_HMAC, + .alg = VNET_CRYPTO_ALG_HMAC_SHA384, .key = TEST_DATA (tc4_key), - .data = TEST_DATA (tc4_data), - .expected = TEST_DATA (tc4_digest_sha384), + .plaintext = TEST_DATA (tc4_data), + .digest = TEST_DATA (tc4_digest_sha384), }; UNITTEST_REGISTER_CRYPTO_TEST (rfc4231_tc4_sha512) = { .name = "RFC4231 TC4", - .op = VNET_CRYPTO_OP_SHA512_HMAC, + .alg = VNET_CRYPTO_ALG_HMAC_SHA512, .key = TEST_DATA (tc4_key), - .data = TEST_DATA (tc4_data), - .expected = TEST_DATA (tc4_digest_sha512), + .plaintext = TEST_DATA (tc4_data), + .digest = TEST_DATA (tc4_digest_sha512), }; /* *INDENT-ON* */ @@ -371,38 +371,34 @@ static u8 tc5_digest_sha512[16] = { /* *INDENT-OFF* */ UNITTEST_REGISTER_CRYPTO_TEST (rfc4231_tc5_sha224) = { .name = "RFC4231 TC5", - .op = VNET_CRYPTO_OP_SHA224_HMAC, + .alg = VNET_CRYPTO_ALG_HMAC_SHA224, .key = TEST_DATA (tc5_key), - .data = TEST_DATA (tc5_data), - .expected = TEST_DATA (tc5_digest_sha224), - .hmac_trunc_len = 16, + .plaintext = TEST_DATA (tc5_data), + .digest = TEST_DATA (tc5_digest_sha224), }; UNITTEST_REGISTER_CRYPTO_TEST (rfc4231_tc5_sha256) = { .name = "RFC4231 TC5", - .op = VNET_CRYPTO_OP_SHA256_HMAC, + .alg = VNET_CRYPTO_ALG_HMAC_SHA256, .key = TEST_DATA (tc5_key), - .data = TEST_DATA (tc5_data), - .expected = TEST_DATA (tc5_digest_sha256), - .hmac_trunc_len = 16, + .plaintext = TEST_DATA (tc5_data), + .digest = TEST_DATA (tc5_digest_sha256), }; UNITTEST_REGISTER_CRYPTO_TEST (rfc4231_tc5_sha384) = { .name = "RFC4231 TC5", - .op = VNET_CRYPTO_OP_SHA384_HMAC, + .alg = VNET_CRYPTO_ALG_HMAC_SHA384, .key = TEST_DATA (tc5_key), - .data = TEST_DATA (tc5_data), - .expected = TEST_DATA (tc5_digest_sha384), - .hmac_trunc_len = 16, + .plaintext = TEST_DATA (tc5_data), + .digest = TEST_DATA (tc5_digest_sha384), }; UNITTEST_REGISTER_CRYPTO_TEST (rfc4231_tc5_sha512) = { .name = "RFC4231 TC5", - .op = VNET_CRYPTO_OP_SHA512_HMAC, + .alg = VNET_CRYPTO_ALG_HMAC_SHA512, .key = TEST_DATA (tc5_key), - .data = TEST_DATA (tc5_data), - .expected = TEST_DATA (tc5_digest_sha512), - .hmac_trunc_len = 16, + .plaintext = TEST_DATA (tc5_data), + .digest = TEST_DATA (tc5_digest_sha512), }; /* *INDENT-ON* */ @@ -466,34 +462,34 @@ static u8 tc6_digest_sha512[] = { /* *INDENT-OFF* */ UNITTEST_REGISTER_CRYPTO_TEST (rfc4231_tc6_sha224) = { .name = "RFC4231 TC6", - .op = VNET_CRYPTO_OP_SHA224_HMAC, + .alg = VNET_CRYPTO_ALG_HMAC_SHA224, .key = TEST_DATA (tc6_key), - .data = TEST_DATA (tc6_data), - .expected = TEST_DATA (tc6_digest_sha224), + .plaintext = TEST_DATA (tc6_data), + .digest = TEST_DATA (tc6_digest_sha224), }; UNITTEST_REGISTER_CRYPTO_TEST (rfc4231_tc6_sha256) = { .name = "RFC4231 TC6", - .op = VNET_CRYPTO_OP_SHA256_HMAC, + .alg = VNET_CRYPTO_ALG_HMAC_SHA256, .key = TEST_DATA (tc6_key), - .data = TEST_DATA (tc6_data), - .expected = TEST_DATA (tc6_digest_sha256), + .plaintext = TEST_DATA (tc6_data), + .digest = TEST_DATA (tc6_digest_sha256), }; UNITTEST_REGISTER_CRYPTO_TEST (rfc4231_tc6_sha384) = { .name = "RFC4231 TC6", - .op = VNET_CRYPTO_OP_SHA384_HMAC, + .alg = VNET_CRYPTO_ALG_HMAC_SHA384, .key = TEST_DATA (tc6_key), - .data = TEST_DATA (tc6_data), - .expected = TEST_DATA (tc6_digest_sha384), + .plaintext = TEST_DATA (tc6_data), + .digest = TEST_DATA (tc6_digest_sha384), }; UNITTEST_REGISTER_CRYPTO_TEST (rfc4231_tc6_sha512) = { .name = "RFC4231 TC6", - .op = VNET_CRYPTO_OP_SHA512_HMAC, + .alg = VNET_CRYPTO_ALG_HMAC_SHA512, .key = TEST_DATA (tc6_key), - .data = TEST_DATA (tc6_data), - .expected = TEST_DATA (tc6_digest_sha512), + .plaintext = TEST_DATA (tc6_data), + .digest = TEST_DATA (tc6_digest_sha512), }; /* *INDENT-ON* */ @@ -559,34 +555,34 @@ static u8 tc7_digest_sha512[] = { /* *INDENT-OFF* */ UNITTEST_REGISTER_CRYPTO_TEST (rfc4231_tc7_sha224) = { .name = "RFC4231 TC7", - .op = VNET_CRYPTO_OP_SHA224_HMAC, + .alg = VNET_CRYPTO_ALG_HMAC_SHA224, .key = TEST_DATA (tc7_key), - .data = TEST_DATA (tc7_data), - .expected = TEST_DATA (tc7_digest_sha224), + .plaintext = TEST_DATA (tc7_data), + .digest = TEST_DATA (tc7_digest_sha224), }; UNITTEST_REGISTER_CRYPTO_TEST (rfc4231_tc7_sha256) = { .name = "RFC4231 TC7", - .op = VNET_CRYPTO_OP_SHA256_HMAC, + .alg = VNET_CRYPTO_ALG_HMAC_SHA256, .key = TEST_DATA (tc7_key), - .data = TEST_DATA (tc7_data), - .expected = TEST_DATA (tc7_digest_sha256), + .plaintext = TEST_DATA (tc7_data), + .digest = TEST_DATA (tc7_digest_sha256), }; UNITTEST_REGISTER_CRYPTO_TEST (rfc4231_tc7_sha384) = { .name = "RFC4231 TC7", - .op = VNET_CRYPTO_OP_SHA384_HMAC, + .alg = VNET_CRYPTO_ALG_HMAC_SHA384, .key = TEST_DATA (tc7_key), - .data = TEST_DATA (tc7_data), - .expected = TEST_DATA (tc7_digest_sha384), + .plaintext = TEST_DATA (tc7_data), + .digest = TEST_DATA (tc7_digest_sha384), }; UNITTEST_REGISTER_CRYPTO_TEST (rfc4231_tc7_sha512) = { .name = "RFC4231 TC7", - .op = VNET_CRYPTO_OP_SHA512_HMAC, + .alg = VNET_CRYPTO_ALG_HMAC_SHA512, .key = TEST_DATA (tc7_key), - .data = TEST_DATA (tc7_data), - .expected = TEST_DATA (tc7_digest_sha512), + .plaintext = TEST_DATA (tc7_data), + .digest = TEST_DATA (tc7_digest_sha512), }; /* *INDENT-ON* */ |