# Auto generated from "SM4-CBC.txt"
lappend auto_path [file dirname [file dirname [file dirname [file dirname [file join [pwd] [info script]]]]]]
package require tls
package require tcltest

catch {tls::provider legacy}
tcltest::testConstraint SM4_CBC [expr {[lsearch -nocase [tls::ciphers] SM4-CBC] > -1}]

tcltest::test Symetric_Block_SM4-CBC-1.1 {Encrypt SM4-CBC} \
	-constraints SM4_CBC \
	-body {binary encode hex [tls::encrypt -cipher SM4-CBC -padding 0 \
		 -key [binary decode hex 0123456789ABCDEFFEDCBA9876543210] \
		 -iv [binary decode hex 000102030405060708090A0B0C0D0E0F] \
		 -data [binary decode hex AAAAAAAABBBBBBBBCCCCCCCCDDDDDDDDEEEEEEEEFFFFFFFFAAAAAAAABBBBBBBB]]} \
	-match exact -result 78ebb11cc40b0a48312aaeb2040244cb4cb7016951909226979b0d15dc6a8f6d

tcltest::test Symetric_Block_SM4-CBC-1.2 {Decrypt SM4-CBC} \
	-constraints SM4_CBC \
	-body {binary encode hex [tls::decrypt -cipher SM4-CBC -padding 0 \
		 -key [binary decode hex 0123456789ABCDEFFEDCBA9876543210] \
		 -iv [binary decode hex 000102030405060708090A0B0C0D0E0F] \
		 -data [binary decode hex 78EBB11CC40B0A48312AAEB2040244CB4CB7016951909226979B0D15DC6A8F6D]]} \
	-match exact -result aaaaaaaabbbbbbbbccccccccddddddddeeeeeeeeffffffffaaaaaaaabbbbbbbb

tcltest::test Symetric_Block_SM4-CBC-1.3 {Encrypt SM4-CBC} \
	-constraints SM4_CBC \
	-body {binary encode hex [tls::encrypt -cipher SM4-CBC -padding 0 \
		 -key [binary decode hex FEDCBA98765432100123456789ABCDEF] \
		 -iv [binary decode hex 000102030405060708090A0B0C0D0E0F] \
		 -data [binary decode hex AAAAAAAABBBBBBBBCCCCCCCCDDDDDDDDEEEEEEEEFFFFFFFFAAAAAAAABBBBBBBB]]} \
	-match exact -result 0d3a6ddc2d21c698857215587b7bb59a91f2c147911a4144665e1fa1d40bae38

tcltest::test Symetric_Block_SM4-CBC-1.4 {Decrypt SM4-CBC} \
	-constraints SM4_CBC \
	-body {binary encode hex [tls::decrypt -cipher SM4-CBC -padding 0 \
		 -key [binary decode hex FEDCBA98765432100123456789ABCDEF] \
		 -iv [binary decode hex 000102030405060708090A0B0C0D0E0F] \
		 -data [binary decode hex 0D3A6DDC2D21C698857215587B7BB59A91F2C147911A4144665E1FA1D40BAE38]]} \
	-match exact -result aaaaaaaabbbbbbbbccccccccddddddddeeeeeeeeffffffffaaaaaaaabbbbbbbb

# Cleanup
::tcltest::cleanupTests
return
