-
Notifications
You must be signed in to change notification settings - Fork 60
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
sm4: cbc解密出错 #143
Comments
go test -timeout 30s -run ^TestWithoutGFMUL$ github.com/emmansun/gmsm/sm4 -count=1 -v === RUN TestWithoutGFMUL goroutine 6 [running]: goroutine 1 [chan receive]: goroutine 2 [force gc (idle)]: goroutine 3 [GC sweep wait]: goroutine 4 [GC scavenge wait]: goroutine 5 [finalizer wait]: rax 0xc00011a180 |
1.第一步:把cipher_asm.go中的supportAVX改为false测试一下。 |
1.第一步:设置useAVX = false,测试成功 |
明天我确认一下哪个指令AVX不支持 |
@zhangyongding ,请帮忙clone最新代码测试一下! |
都测试通过了,谢谢 |
Fixed in v0.19.1,由于没有测试机器,自己手写支持AVX,但不支持AVX2代码还是容易误用指令的,还是有必要使用avo辅助。 |
使用最新版本的单元测试,报如下错误
go test -timeout 30s -run ^TestCBCDecrypterSM4$ github.com/emmansun/gmsm/cipher -count=1 -v
=== RUN TestCBCDecrypterSM4
SIGILL: illegal instruction
PC=0x510135 m=0 sigcode=2
instruction bytes: 0xc4 0x62 0x79 0x58 0x4 0x8 0xc5 0x39 0xef 0xc5 0xc5 0x39 0xef 0xc6 0xc5 0x39
goroutine 6 [running]:
github.com/emmansun/gmsm/sm4.decryptBlocksChain(0xc00011a280, {0xc00001c140, 0x40, 0x40}, {0xc00001e0b0, 0x40, 0x40}, 0xc00001e0a0)
/home/godev/go/src/gmsm/sm4/cbc_cipher_asm_amd64.s:220 +0x535 fp=0xc000054580 sp=0xc000054578 pc=0x510135
github.com/emmansun/gmsm/sm4.(*cbc).CryptBlocks(0xc00010a8c0, {0xc000018320, 0x10, 0x10}, {0xc000018320, 0x10, 0x10})
/home/godev/go/src/gmsm/sm4/cbc_cipher_asm.go:91 +0x46c fp=0xc000054610 sp=0xc000054580 pc=0x508eac
github.com/emmansun/gmsm/cipher_test.TestCBCDecrypterSM4(0xc000007a00)
/home/godev/go/src/gmsm/cipher/cbc_sm4_test.go:178 +0x259 fp=0xc000054770 sp=0xc000054610 pc=0x543c39
testing.tRunner(0xc000007a00, 0x591338)
/usr/local/go/src/testing/testing.go:1576 +0x10b fp=0xc0000547c0 sp=0xc000054770 pc=0x4bc3ab
testing.(*T).Run.func1()
/usr/local/go/src/testing/testing.go:1629 +0x2a fp=0xc0000547e0 sp=0xc0000547c0 pc=0x4bd3ea
runtime.goexit()
/usr/local/go/src/runtime/asm_amd64.s:1598 +0x1 fp=0xc0000547e8 sp=0xc0000547e0 pc=0x4678e1
created by testing.(*T).Run
/usr/local/go/src/testing/testing.go:1629 +0x3ea
goroutine 1 [chan receive]:
runtime.gopark(0x68cda0?, 0xc000012058?, 0xf0?, 0x88?, 0xc000063a28?)
/usr/local/go/src/runtime/proc.go:381 +0xd6 fp=0xc0000639a8 sp=0xc000063988 pc=0x438576
runtime.chanrecv(0xc000028150, 0xc000063aa7, 0x1)
/usr/local/go/src/runtime/chan.go:583 +0x49d fp=0xc000063a38 sp=0xc0000639a8 pc=0x40695d
runtime.chanrecv1(0x68c4a0?, 0x5592a0?)
/usr/local/go/src/runtime/chan.go:442 +0x18 fp=0xc000063a60 sp=0xc000063a38 pc=0x406498
testing.(*T).Run(0xc000007860, {0x582326?, 0x4bc0c5?}, 0x591338)
/usr/local/go/src/testing/testing.go:1630 +0x405 fp=0xc000063b20 sp=0xc000063a60 pc=0x4bd265
testing.runTests.func1(0x68cda0?)
/usr/local/go/src/testing/testing.go:2036 +0x45 fp=0xc000063b70 sp=0xc000063b20 pc=0x4bf3c5
testing.tRunner(0xc000007860, 0xc000063c88)
/usr/local/go/src/testing/testing.go:1576 +0x10b fp=0xc000063bc0 sp=0xc000063b70 pc=0x4bc3ab
testing.runTests(0xc0001180a0?, {0x686800, 0x15, 0x15}, {0x20?, 0x100c0001149d8?, 0x68c5c0?})
/usr/local/go/src/testing/testing.go:2034 +0x489 fp=0xc000063cb8 sp=0xc000063bc0 pc=0x4bf2a9
testing.(*M).Run(0xc0001180a0)
/usr/local/go/src/testing/testing.go:1906 +0x63a fp=0xc000063f00 sp=0xc000063cb8 pc=0x4bdc1a
main.main()
_testmain.go:191 +0x1aa fp=0xc000063f80 sp=0xc000063f00 pc=0x54a2ca
runtime.main()
/usr/local/go/src/runtime/proc.go:250 +0x207 fp=0xc000063fe0 sp=0xc000063f80 pc=0x438147
runtime.goexit()
/usr/local/go/src/runtime/asm_amd64.s:1598 +0x1 fp=0xc000063fe8 sp=0xc000063fe0 pc=0x4678e1
goroutine 2 [force gc (idle)]:
runtime.gopark(0x0?, 0x0?, 0x0?, 0x0?, 0x0?)
/usr/local/go/src/runtime/proc.go:381 +0xd6 fp=0xc000052fb0 sp=0xc000052f90 pc=0x438576
runtime.goparkunlock(...)
/usr/local/go/src/runtime/proc.go:387
runtime.forcegchelper()
/usr/local/go/src/runtime/proc.go:305 +0xb0 fp=0xc000052fe0 sp=0xc000052fb0 pc=0x4383b0
runtime.goexit()
/usr/local/go/src/runtime/asm_amd64.s:1598 +0x1 fp=0xc000052fe8 sp=0xc000052fe0 pc=0x4678e1
created by runtime.init.6
/usr/local/go/src/runtime/proc.go:293 +0x25
goroutine 3 [GC sweep wait]:
runtime.gopark(0x0?, 0x0?, 0x0?, 0x0?, 0x0?)
/usr/local/go/src/runtime/proc.go:381 +0xd6 fp=0xc000053780 sp=0xc000053760 pc=0x438576
runtime.goparkunlock(...)
/usr/local/go/src/runtime/proc.go:387
runtime.bgsweep(0x0?)
/usr/local/go/src/runtime/mgcsweep.go:278 +0x8e fp=0xc0000537c8 sp=0xc000053780 pc=0x4230ee
runtime.gcenable.func1()
/usr/local/go/src/runtime/mgc.go:178 +0x26 fp=0xc0000537e0 sp=0xc0000537c8 pc=0x4183a6
runtime.goexit()
/usr/local/go/src/runtime/asm_amd64.s:1598 +0x1 fp=0xc0000537e8 sp=0xc0000537e0 pc=0x4678e1
created by runtime.gcenable
/usr/local/go/src/runtime/mgc.go:178 +0x6b
goroutine 4 [GC scavenge wait]:
runtime.gopark(0xc000028070?, 0x5b2f98?, 0x1?, 0x0?, 0x0?)
/usr/local/go/src/runtime/proc.go:381 +0xd6 fp=0xc000053f70 sp=0xc000053f50 pc=0x438576
runtime.goparkunlock(...)
/usr/local/go/src/runtime/proc.go:387
runtime.(*scavengerState).park(0x68c640)
/usr/local/go/src/runtime/mgcscavenge.go:400 +0x53 fp=0xc000053fa0 sp=0xc000053f70 pc=0x421013
runtime.bgscavenge(0x0?)
/usr/local/go/src/runtime/mgcscavenge.go:628 +0x45 fp=0xc000053fc8 sp=0xc000053fa0 pc=0x4215e5
runtime.gcenable.func2()
/usr/local/go/src/runtime/mgc.go:179 +0x26 fp=0xc000053fe0 sp=0xc000053fc8 pc=0x418346
runtime.goexit()
/usr/local/go/src/runtime/asm_amd64.s:1598 +0x1 fp=0xc000053fe8 sp=0xc000053fe0 pc=0x4678e1
created by runtime.gcenable
/usr/local/go/src/runtime/mgc.go:179 +0xaa
goroutine 5 [finalizer wait]:
runtime.gopark(0x4388f2?, 0x4382e5?, 0x0?, 0x0?, 0xc000052770?)
/usr/local/go/src/runtime/proc.go:381 +0xd6 fp=0xc000052628 sp=0xc000052608 pc=0x438576
runtime.runfinq()
/usr/local/go/src/runtime/mfinal.go:193 +0x107 fp=0xc0000527e0 sp=0xc000052628 pc=0x4173e7
runtime.goexit()
/usr/local/go/src/runtime/asm_amd64.s:1598 +0x1 fp=0xc0000527e8 sp=0xc0000527e0 pc=0x4678e1
created by runtime.createfing
/usr/local/go/src/runtime/mfinal.go:163 +0x45
rax 0xc00011a280
rbx 0xc00001c140
rcx 0x0
rdx 0xc00001e0b0
rdi 0xc00011a280
rsi 0xc00001e0a0
rbp 0xc000054600
rsp 0xc000054578
r8 0x10
r9 0xc000018320
r10 0x10
r11 0xc00001e0b0
r12 0x1
r13 0x3
r14 0xc000007ba0
r15 0x68cda0
rip 0x510135
rflags 0x10246
cs 0x33
fs 0x0
gs 0x0
FAIL github.com/emmansun/gmsm/cipher 0.007s
The text was updated successfully, but these errors were encountered: