hkparker / go-i2p

A pure Go implementation of the I2P router
MIT License
111 stars 18 forks source link

Flaky test in crypto package: TestDSA #12

Closed hkparker closed 8 years ago

hkparker commented 8 years ago

Every so often the TestDSA test fails

?   github.com/hkparker/go-i2p  [no test files]
ok      github.com/hkparker/go-i2p/lib/common   0.007s  coverage: 77.8% of statements
?       github.com/hkparker/go-i2p/lib/common/base32    [no test files]
?       github.com/hkparker/go-i2p/lib/common/base64    [no test files]
?       github.com/hkparker/go-i2p/lib/config   [no test files]
--- FAIL: TestDSA (0.00s)
        dsa_test.go:32: sig="R\x06D\x97\x0fu#\xd1Ҧ\xf3\x11G\x0e\x0e^\xde\ue445\x91\xaf+7\u007f\xbf\xaeC\x1eͩ\x9ctsS\x90\x9b\x0fY\x00"
        dsa_test.go:43: failed: invalid signature
FAIL
coverage: 55.0% of statements
FAIL    github.com/hkparker/go-i2p/lib/crypto   0.065s
?       github.com/hkparker/go-i2p/lib/i2np     [no test files]
?       github.com/hkparker/go-i2p/lib/netdb    [no test files]
?       github.com/hkparker/go-i2p/lib/router   [no test files]
?       github.com/hkparker/go-i2p/lib/transport        [no test files]
?       github.com/hkparker/go-i2p/lib/transport/ssu    [no test files]
?       github.com/hkparker/go-i2p/lib/tunnel   [no test files]
hkparker commented 8 years ago

@majestrate Have you ever seen this happen?

majestrate commented 8 years ago

I forget if the DSA code checks for q < p (or whatever that constraint for dsa is), that is possibly it.

majestrate commented 8 years ago

found it, the problem was that big.Int is encoded as bytes differently than i thought, sometimes r or s is < 20 bytes long so they'd have to be encoded differently.

majestrate commented 8 years ago

I think i see a similar problem in elg too

hkparker commented 8 years ago

merged #13, thanks for taking a look