Index: tests/digest.csv ================================================================== --- tests/digest.csv +++ tests/digest.csv @@ -176,7 +176,35 @@ RFC4231 TC7,sha224,,,::tls::hmac -digest sha224 -key $key -data $data,,,3a854166ac5d9f023f54d517d0b39dbd946770db9c2b95c9f6f565d1,,, RFC4231 TC7,sha256,,,::tls::hmac -digest sha256 -key $key -data $data,,,9b09ffa71b942fcb27635fbcd5b0e944bfdc63644f0713938a7f51535c3a35e2,,, RFC4231 TC7,sha384,,,::tls::hmac -digest sha384 -key $key -data $data,,,6617178e941f020d351e2f254e8fd32c602420feb0b8fb9adccebb82461e99c5a678cc31e799176d3860e6110c46523e,,, RFC4231 TC7,sha512,,,::tls::hmac -digest sha512 -key $key -data $data,,,e37b6a775dc87dbaa4dfa9f96e5e3ffddebd71f8867289865df5a32d20cdc944b6022cac3c4982b10d5eeb55c3e4de15134676fb6de0446065c97440fa8c6a58,,, ,,,,,,,,,, +command,# NIST 800-38b Recommendation for Block Cipher Modes of Operation: The CMAC Mode for Authentication,,,,,,,,, +command,# AES-128,,,,,,,,, +command,"set key [binary decode hex ""2b7e151628aed2a6abf7158809cf4f3c""]",,,,,,,,, +command,"set data [binary decode hex ""6bc1bee22e409f96e93d7e117393172a""]",,,,,,,,, +NIST800-38b-AES128,len=128,,,::tls::cmac -cipher aes-128-cbc -key $key -data $data,,,070a16b46b4d4144f79bdd9dd04a287c,,, +command,"set data [binary decode hex ""6bc1bee22e409f96e93d7e117393172aae2d8a571e03ac9c9eb76fac45af8e5130c81c46a35ce411""]",,,,,,,,, +NIST800-38b-AES128,len=320,,,::tls::cmac -cipher aes-128-cbc -key $key -data $data,,,dfa66747de9ae63030ca32611497c827,,, +command,"set data [binary decode hex ""6bc1bee22e409f96e93d7e117393172aae2d8a571e03ac9c9eb76fac45af8e5130c81c46a35ce411e5fbc1191a0a52eff69f2445df4f9b17ad2b417be66c3710""]",,,,,,,,, +NIST800-38b-AES128,len=512,,,::tls::cmac -cipher aes-128-cbc -key $key -data $data,,,51f0bebf7e3b9d92fc49741779363cfe,,, +,,,,,,,,,, +command,# AES-192,,,,,,,,, +command,"set key [binary decode hex ""8e73b0f7da0e6452c810f32b809079e562f8ead2522c6b7b""]",,,,,,,,, +command,"set data [binary decode hex ""6bc1bee22e409f96e93d7e117393172a""]",,,,,,,,, +NIST800-38b-AES-192,len=128,,,::tls::cmac -cipher aes-192-cbc -key $key -data $data,,,9e99a7bf31e710900662f65e617c5184,,, +command,"set data [binary decode hex ""6bc1bee22e409f96e93d7e117393172aae2d8a571e03ac9c9eb76fac45af8e5130c81c46a35ce411""]",,,,,,,,, +NIST800-38b-AES-192,len=320,,,::tls::cmac -cipher aes-192-cbc -key $key -data $data,,,8a1de5be2eb31aad089a82e6ee908b0e,,, +command,"set data [binary decode hex ""6bc1bee22e409f96e93d7e117393172aae2d8a571e03ac9c9eb76fac45af8e5130c81c46a35ce411e5fbc1191a0a52eff69f2445df4f9b17ad2b417be66c3710""]",,,,,,,,, +NIST800-38b-AES-192,len=512,,,::tls::cmac -cipher aes-192-cbc -key $key -data $data,,,a1d5df0eed790f794d77589659f39a11,,, +,,,,,,,,,, +command,# AES-256,,,,,,,,, +command,"set key [binary decode hex ""603deb1015ca71be2b73aef0857d77811f352c073b6108d72d9810a30914dff4""]",,,,,,,,, +command,"set data [binary decode hex ""6bc1bee22e409f96e93d7e117393172a""]",,,,,,,,, +NIST800-38b-AES-256,len=128,,,::tls::cmac -cipher aes-256-cbc -key $key -data $data,,,28a7023f452e8f82bd4bf28d8c37c35c,,, +command,"set data [binary decode hex ""6bc1bee22e409f96e93d7e117393172aae2d8a571e03ac9c9eb76fac45af8e5130c81c46a35ce411""]",,,,,,,,, +NIST800-38b-AES-256,len=320,,,::tls::cmac -cipher aes-256-cbc -key $key -data $data,,,aaf3d8f1de5640c232f5b169b9c911e6,,, +command,"set data [binary decode hex ""6bc1bee22e409f96e93d7e117393172aae2d8a571e03ac9c9eb76fac45af8e5130c81c46a35ce411e5fbc1191a0a52eff69f2445df4f9b17ad2b417be66c3710""]",,,,,,,,, +NIST800-38b-AES-256,len=512,,,::tls::cmac -cipher aes-256-cbc -key $key -data $data,,,e1992190549f6ed5696a2c056c315410,,, +,,,,,,,,,, command,# Cleanup,,,,,,,,, command,::tcltest::removeFile $test_file,,,,,,,,, Index: tests/digest.test ================================================================== --- tests/digest.test +++ tests/digest.test @@ -520,10 +520,68 @@ } -result {6617178e941f020d351e2f254e8fd32c602420feb0b8fb9adccebb82461e99c5a678cc31e799176d3860e6110c46523e} test RFC4231_TC7-21.4 {sha512} -body { ::tls::hmac -digest sha512 -key $key -data $data } -result {e37b6a775dc87dbaa4dfa9f96e5e3ffddebd71f8867289865df5a32d20cdc944b6022cac3c4982b10d5eeb55c3e4de15134676fb6de0446065c97440fa8c6a58} + +# NIST 800-38b Recommendation for Block Cipher Modes of Operation: The CMAC Mode for Authentication +# AES-128 +set key [binary decode hex "2b7e151628aed2a6abf7158809cf4f3c"] +set data [binary decode hex "6bc1bee22e409f96e93d7e117393172a"] + + +test NIST800-38b-AES128-22.1 {len=128} -body { + ::tls::cmac -cipher aes-128-cbc -key $key -data $data + } -result {070a16b46b4d4144f79bdd9dd04a287c} +set data [binary decode hex "6bc1bee22e409f96e93d7e117393172aae2d8a571e03ac9c9eb76fac45af8e5130c81c46a35ce411"] + +test NIST800-38b-AES128-22.2 {len=320} -body { + ::tls::cmac -cipher aes-128-cbc -key $key -data $data + } -result {dfa66747de9ae63030ca32611497c827} +set data [binary decode hex "6bc1bee22e409f96e93d7e117393172aae2d8a571e03ac9c9eb76fac45af8e5130c81c46a35ce411e5fbc1191a0a52eff69f2445df4f9b17ad2b417be66c3710"] + +test NIST800-38b-AES128-22.3 {len=512} -body { + ::tls::cmac -cipher aes-128-cbc -key $key -data $data + } -result {51f0bebf7e3b9d92fc49741779363cfe} + +# AES-192 +set key [binary decode hex "8e73b0f7da0e6452c810f32b809079e562f8ead2522c6b7b"] +set data [binary decode hex "6bc1bee22e409f96e93d7e117393172a"] + + +test NIST800-38b-AES-192-23.1 {len=128} -body { + ::tls::cmac -cipher aes-192-cbc -key $key -data $data + } -result {9e99a7bf31e710900662f65e617c5184} +set data [binary decode hex "6bc1bee22e409f96e93d7e117393172aae2d8a571e03ac9c9eb76fac45af8e5130c81c46a35ce411"] + +test NIST800-38b-AES-192-23.2 {len=320} -body { + ::tls::cmac -cipher aes-192-cbc -key $key -data $data + } -result {8a1de5be2eb31aad089a82e6ee908b0e} +set data [binary decode hex "6bc1bee22e409f96e93d7e117393172aae2d8a571e03ac9c9eb76fac45af8e5130c81c46a35ce411e5fbc1191a0a52eff69f2445df4f9b17ad2b417be66c3710"] + +test NIST800-38b-AES-192-23.3 {len=512} -body { + ::tls::cmac -cipher aes-192-cbc -key $key -data $data + } -result {a1d5df0eed790f794d77589659f39a11} + +# AES-256 +set key [binary decode hex "603deb1015ca71be2b73aef0857d77811f352c073b6108d72d9810a30914dff4"] +set data [binary decode hex "6bc1bee22e409f96e93d7e117393172a"] + + +test NIST800-38b-AES-256-24.1 {len=128} -body { + ::tls::cmac -cipher aes-256-cbc -key $key -data $data + } -result {28a7023f452e8f82bd4bf28d8c37c35c} +set data [binary decode hex "6bc1bee22e409f96e93d7e117393172aae2d8a571e03ac9c9eb76fac45af8e5130c81c46a35ce411"] + +test NIST800-38b-AES-256-24.2 {len=320} -body { + ::tls::cmac -cipher aes-256-cbc -key $key -data $data + } -result {aaf3d8f1de5640c232f5b169b9c911e6} +set data [binary decode hex "6bc1bee22e409f96e93d7e117393172aae2d8a571e03ac9c9eb76fac45af8e5130c81c46a35ce411e5fbc1191a0a52eff69f2445df4f9b17ad2b417be66c3710"] + +test NIST800-38b-AES-256-24.3 {len=512} -body { + ::tls::cmac -cipher aes-256-cbc -key $key -data $data + } -result {e1992190549f6ed5696a2c056c315410} # Cleanup ::tcltest::removeFile $test_file # Cleanup