diff options
author | Filip Tehlar <ftehlar@cisco.com> | 2019-03-20 02:43:20 -0700 |
---|---|---|
committer | Damjan Marion <dmarion@me.com> | 2019-03-22 17:32:25 +0000 |
commit | 063dfa1587a58319fac139eab5e655ad1c555e33 (patch) | |
tree | 53c704e5e382842dcc037025b6814ba084c0c831 /src/plugins/unittest/crypto/rfc2202_hmac_sha1.c | |
parent | 831d23866ab1010a7d7343aa1df024c8b65790b9 (diff) |
crypto: implement rfc4231 test cases
Change-Id: I540241672a20f687d20bb70adbf2b33200f34167
Signed-off-by: Filip Tehlar <ftehlar@cisco.com>
Diffstat (limited to 'src/plugins/unittest/crypto/rfc2202_hmac_sha1.c')
-rw-r--r-- | src/plugins/unittest/crypto/rfc2202_hmac_sha1.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/plugins/unittest/crypto/rfc2202_hmac_sha1.c b/src/plugins/unittest/crypto/rfc2202_hmac_sha1.c index 94ab03ca657..13505218891 100644 --- a/src/plugins/unittest/crypto/rfc2202_hmac_sha1.c +++ b/src/plugins/unittest/crypto/rfc2202_hmac_sha1.c @@ -152,6 +152,22 @@ UNITTEST_REGISTER_CRYPTO_TEST (rfc_2202_sha1_tc5) = { }; /* *INDENT-ON* */ +static u8 sha1_tc5_digest_96[12] = { + 0x4c, 0x1a, 0x03, 0x42, 0x4b, 0x55, 0xe0, 0x7f, + 0xe7, 0xf2, 0x7b, 0xe1 +}; + +/* *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, + .key = TEST_DATA (sha1_tc5_key), + .data = TEST_DATA (sha1_tc5_data), + .expected = TEST_DATA (sha1_tc5_digest_96), + .hmac_trunc_len = 12, +}; +/* *INDENT-ON* */ + static u8 sha1_tc6_key[80] = { 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, |