Skip to content
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

BenchmarkCBC returns CKR_DEVICE_ERROR on Luna HSM #67

Open
johnzhanghua opened this issue Mar 24, 2020 · 1 comment
Open

BenchmarkCBC returns CKR_DEVICE_ERROR on Luna HSM #67

johnzhanghua opened this issue Mar 24, 2020 · 1 comment

Comments

@johnzhanghua
Copy link

johnzhanghua commented Mar 24, 2020

Hi,

I am testing this library on Luna PCIe HSM s790. But I run into the following error when running the BenchmarkCBC test.

I don't have the same issue when running the PKCS#11 Java library or the C lib.

The Luna HSM S790 's token info as

Sessions (count/max) -> 3457 / 0 Read/Write Sessions (count/max) -> 3457 / 0 PIN Length (min - max) -> 7 - 255 Public Memory (free / total) -> 33524624 - 33544784 Private Memory (free / total) -> 33524624 - 33544784 Hardware Version -> 2.0 Firmware Version -> 7.0.3

go test -bench=BenchmarkCBC -run=^a
goos: linux
goarch: amd64
pkg: github.com/ThalesIgnite/crypto11
BenchmarkCBC/Native-16         	panic: pkcs11: 0x30: CKR_DEVICE_ERROR

goroutine 53 [running]:
github.com/ThalesIgnite/crypto11.(*SecretKey).Encrypt(0xc0002165c0, 0xc0002360c0, 0x10, 0xbf40, 0xc0002360c0, 0x10, 0xbf40)
	/tmp/crypto11/block.go:87 +0x120
crypto/cipher.(*cbcEncrypter).CryptBlocks(0xc00007c050, 0xc000232000, 0xbf40, 0x10000, 0xc0002260c0, 0xbf40, 0xbf40)
	/usr/local/go/src/crypto/cipher/cbc.go:73 +0x192
github.com/ThalesIgnite/crypto11.BenchmarkCBC.func2(0xc000164380)
	/tmp/crypto11/symmetric_test.go:284 +0xba
testing.(*B).runN(0xc000164380, 0x1)
	/usr/local/go/src/testing/benchmark.go:191 +0xe8
testing.(*B).run1.func1(0xc000164380)
	/usr/local/go/src/testing/benchmark.go:231 +0x57
created by testing.(*B).run1
	/usr/local/go/src/testing/benchmark.go:224 +0x7d
exit status 2
FAIL	github.com/ThalesIgnite/crypto11	2.500s
@johnzhanghua
Copy link
Author

It fails on the following test cases as well.

go test -bench=BenchmarkCBC -run=^a
goos: linux
goarch: amd64
pkg: github.com/ThalesIgnite/crypto11
BenchmarkCBC/IdiomaticClose-16         	       0	              NaN ns/op
panic: pkcs11: 0x30: CKR_DEVICE_ERROR

goroutine 15 [running]:
github.com/ThalesIgnite/crypto11.(*blockModeCloser).CryptBlocks(0xc00000f7a0, 0xc0002a0000, 0x10000, 0x10000, 0xc000290000, 0x10000, 0x10000)
   /tmp/crypto11/blockmode.go:167 +0x1a6
github.com/ThalesIgnite/crypto11.BenchmarkCBC.func2(0xc00015c380)
   /tmp/crypto11/symmetric_test.go:294 +0x85
testing.(*B).runN(0xc00015c380, 0x64)
   /usr/local/go/src/testing/benchmark.go:191 +0xe8
testing.(*B).launch(0xc00015c380)
   /usr/local/go/src/testing/benchmark.go:321 +0xea
created by testing.(*B).doBench
   /usr/local/go/src/testing/benchmark.go:276 +0x55
exit status 2
FAIL	github.com/ThalesIgnite/crypto11	0.309s

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant