diff options
Diffstat (limited to 'lib/crypto')
-rw-r--r-- | lib/crypto/test/crypto_SUITE.erl | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/lib/crypto/test/crypto_SUITE.erl b/lib/crypto/test/crypto_SUITE.erl index a3d3bb1ede..027881957c 100644 --- a/lib/crypto/test/crypto_SUITE.erl +++ b/lib/crypto/test/crypto_SUITE.erl @@ -793,6 +793,50 @@ hmac_rfc4231_do() -> ?line m(Case4Exp512, Case4Mac512_2), ?line m(Case4Exp512, Case4Mac512_3), + %% Test Case 5 + Case5Key = binary:copy(<<16#0c>>, 20), + Case5Data = <<"Test With Truncation">>, + Case5Exp224 = hexstr2bin("0e2aea68a90c8d37c988bcdb9fca6fa8"), + Case5Exp256 = hexstr2bin("a3b6167473100ee06e0c796c2955552b"), + Case5Exp384 = hexstr2bin("3abf34c3503b2a23a46efc619baef897"), + Case5Exp512 = hexstr2bin("415fad6271580a531d4179bc891d87a6"), + + ?line Case5Ctx224 = crypto:hmac_init(sha224, Case5Key), + ?line Case5Ctx224_2 = crypto:hmac_update(Case5Ctx224, Case5Data), + ?line Case5Mac224_1 = crypto:hmac_final_n(Case5Ctx224_2, 16), + ?line Case5Mac224_2 = crypto:sha224_mac(Case5Key, Case5Data, 16), + ?line Case5Mac224_3 = crypto:hmac(sha224, Case5Key, Case5Data, 16), + ?line m(Case5Exp224, Case5Mac224_1), + ?line m(Case5Exp224, Case5Mac224_2), + ?line m(Case5Exp224, Case5Mac224_3), + + ?line Case5Ctx256 = crypto:hmac_init(sha256, Case5Key), + ?line Case5Ctx256_2 = crypto:hmac_update(Case5Ctx256, Case5Data), + ?line Case5Mac256_1 = crypto:hmac_final_n(Case5Ctx256_2, 16), + ?line Case5Mac256_2 = crypto:sha256_mac(Case5Key, Case5Data, 16), + ?line Case5Mac256_3 = crypto:hmac(sha256, Case5Key, Case5Data, 16), + ?line m(Case5Exp256, Case5Mac256_1), + ?line m(Case5Exp256, Case5Mac256_2), + ?line m(Case5Exp256, Case5Mac256_3), + + ?line Case5Ctx384 = crypto:hmac_init(sha384, Case5Key), + ?line Case5Ctx384_2 = crypto:hmac_update(Case5Ctx384, Case5Data), + ?line Case5Mac384_1 = crypto:hmac_final_n(Case5Ctx384_2, 16), + ?line Case5Mac384_2 = crypto:sha384_mac(Case5Key, Case5Data, 16), + ?line Case5Mac384_3 = crypto:hmac(sha384, Case5Key, Case5Data, 16), + ?line m(Case5Exp384, Case5Mac384_1), + ?line m(Case5Exp384, Case5Mac384_2), + ?line m(Case5Exp384, Case5Mac384_3), + + ?line Case5Ctx512 = crypto:hmac_init(sha512, Case5Key), + ?line Case5Ctx512_2 = crypto:hmac_update(Case5Ctx512, Case5Data), + ?line Case5Mac512_1 = crypto:hmac_final_n(Case5Ctx512_2, 16), + ?line Case5Mac512_2 = crypto:sha512_mac(Case5Key, Case5Data, 16), + ?line Case5Mac512_3 = crypto:hmac(sha512, Case5Key, Case5Data, 16), + ?line m(Case5Exp512, Case5Mac512_1), + ?line m(Case5Exp512, Case5Mac512_2), + ?line m(Case5Exp512, Case5Mac512_3), + %% Test Case 6 Case6Key = binary:copy(<<16#aa>>, 131), Case6Data = <<"Test Using Larger Than Block-Size Key - Hash Key First">>, |