使用单证书 -tags single_cert 编译报错
xuyang2 opened this issue · 2 comments
xuyang2 commented
~/code/github.com/tjfoc/gmsm (master) $ git rev-parse --verify HEAD
96b99bd6b0605768d25563d3daf47fda334a3143
~/code/github.com/tjfoc/gmsm (master) $ go build -tags single_cert ./...
# github.com/tjfoc/gmsm/gmtls
gmtls/gm_handshake_client_double.go:23:6: clientHandshakeStateGM redeclared in this block
previous declaration at gmtls/gm_handshake_client.go:25:6
gmtls/gm_handshake_client_double.go:33:6: makeClientHelloGM redeclared in this block
previous declaration at gmtls/gm_handshake_client.go:35:58
gmtls/gm_handshake_client_double.go:68:35: (*clientHandshakeStateGM).handshake redeclared in this block
previous declaration at gmtls/gm_handshake_client.go:69:6
gmtls/gm_handshake_client_double.go:161:35: (*clientHandshakeStateGM).pickCipherSuite redeclared in this block
previous declaration at gmtls/gm_handshake_client.go:162:6
gmtls/gm_handshake_client_double.go:171:35: (*clientHandshakeStateGM).doFullHandshake redeclared in this block
previous declaration at gmtls/gm_handshake_client.go:172:6
gmtls/gm_handshake_client_double.go:395:35: (*clientHandshakeStateGM).establishKeys redeclared in this block
previous declaration at gmtls/gm_handshake_client.go:401:6
gmtls/gm_handshake_client_double.go:417:35: (*clientHandshakeStateGM).serverResumedSession redeclared in this block
previous declaration at gmtls/gm_handshake_client.go:423:6
gmtls/gm_handshake_client_double.go:424:35: (*clientHandshakeStateGM).processServerHello redeclared in this block
previous declaration at gmtls/gm_handshake_client.go:430:6
gmtls/gm_handshake_client_double.go:497:35: (*clientHandshakeStateGM).readFinished redeclared in this block
previous declaration at gmtls/gm_handshake_client.go:503:6
gmtls/gm_handshake_client_double.go:526:35: (*clientHandshakeStateGM).readSessionTicket redeclared in this block
previous declaration at gmtls/gm_handshake_client.go:532:6
gmtls/gm_handshake_client_double.go:526:35: too many errors
~/code/github.com/tjfoc/gmsm (master) $ go version
go version go1.15.15 linux/amd64
xuyang2 commented
给 gmtls/gm_handshake_client_double.go
加上 // +build !single_cert
之后,
编译仍然报错:
~/code/github.com/tjfoc/gmsm (master) $ go build -tags single_cert ./...
# github.com/tjfoc/gmsm/gmtls
gmtls/auto_handshake_server.go:172:10: cannot use []Certificate literal (type []Certificate) as type *Certificate in assignment
gmtls/auto_handshake_server.go:175:26: invalid operation: hs.cert[0] (type *Certificate does not support indexing)
gmtls/gm_handshake_server.go 和
gmtls/gm_handshake_server_double.go 中
的 type serverHandshakeStateGM struct
的 cert
字段定义不一样。
一个是 cert *Certificate
一个是 cert []Certificate
见:
gmsm/gmtls/gm_handshake_server.go
Lines 25 to 36 in 96b99bd
gmsm/gmtls/gm_handshake_server_double.go
Lines 25 to 36 in 96b99bd
Nu1i commented
你这个国密tls调试通过了吗