mirror of
https://github.com/emmansun/gmsm.git
synced 2025-04-26 12:16:20 +08:00
add complete test case
This commit is contained in:
parent
ebc3bf5da6
commit
09414993cc
@ -94,7 +94,7 @@ amd64 result = {
|
||||
8F F3 05 10 EA 99 A8 D7 41 D9 E3 BA 67 D6 18 EE
|
||||
}
|
||||
arm64 result = {
|
||||
|
||||
8F F3 05 10 EA 99 A8 D7 41 D9 E3 BA 67 D6 18 EE
|
||||
}
|
||||
*/
|
||||
func TestGcmSm4Finish(t *testing.T) {
|
||||
@ -108,3 +108,27 @@ func TestGcmSm4Finish(t *testing.T) {
|
||||
}
|
||||
fmt.Println()
|
||||
}
|
||||
|
||||
func TestBothDataPlaintext(t *testing.T) {
|
||||
g := genPrecomputeTable()
|
||||
var tagOut, tagMask [gcmBlockSize]byte
|
||||
data := []byte("emmansun")
|
||||
gcmSm4Data(&g.bytesProductTable, data, &tagOut)
|
||||
for j := 0; j < 16; j++ {
|
||||
tagMask[j] = byte(j)
|
||||
}
|
||||
for j := 0; j < 16; j++ {
|
||||
fmt.Printf("%02X ", tagOut[j])
|
||||
}
|
||||
fmt.Println()
|
||||
gcmSm4Data(&g.bytesProductTable, []byte("emmansunemmansunemmansunemmansun"), &tagOut)
|
||||
for j := 0; j < 16; j++ {
|
||||
fmt.Printf("%02X ", tagOut[j])
|
||||
}
|
||||
fmt.Println()
|
||||
gcmSm4Finish(&g.bytesProductTable, &tagMask, &tagOut, uint64(32), uint64(8))
|
||||
for j := 0; j < 16; j++ {
|
||||
fmt.Printf("%02X ", tagOut[j])
|
||||
}
|
||||
fmt.Println()
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user