diff --git a/sm4/sm4_gcm_test.go b/sm4/sm4_gcm_test.go index 2cec902..e1baf42 100644 --- a/sm4/sm4_gcm_test.go +++ b/sm4/sm4_gcm_test.go @@ -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() +}