piotrnar / gocoin

Full bitcoin solution written in Go (golang)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

cgo/openssl fails

Jo3McCarthy opened this issue · comments

Hi, Piotr;

In the piotrnar/gocoin/master/lib/others/cgo/openssl subdirectory, "go build" emits no errors.

However, "go test" produces this:
--- FAIL: TestVerify (0.00s)
openssl_test.go:14: Verify failed
openssl_test.go:19: Verify not failed while it should
openssl_test.go:31: Zero expected -1
FAIL
exit status 1
FAIL github.com/piotrnar/gocoin/lib/others/cgo/openssl 0.002s

What did I do wrong?

Thanks,

Jo3

Hi,

Thanks for reporting.
It works fine with openssl 1.0.1e, but indeed fails on 1.0.1u and 1.0.2a
Must be something different inside these new versions of openssl lib.

I will have a look into this and will let you know.

Cheers

This should fix it: 5fe523b

Apparently the new openssl libs have some extra check of the (DER encoded) signature given to ECDSA_verify()

The signature from the test file had an extra byte (01).
This 01 is the bitcoin's hash-type, but openssl does not know what it is so the new libs were rejecting it.

I'll just check whether EC_Verify() called from the bitcoin scripts parser has this extra byte removed...