square / go-jose

An implementation of JOSE standards (JWE, JWS, JWT) in Go
1.98k stars 278 forks source link

TestRoundtripsJWECorrupted crashes on armhf #84

Closed petercolberg closed 8 years ago

petercolberg commented 8 years ago

The test suite of commit 7465d2b fails on armhf (hard-float ABI armv7) with the following error: https://tests.reproducible-builds.org/rb-pkg/unstable/armhf/golang-github-square-go-jose.html

    go test -v github.com/square/go-jose github.com/square/go-jose/cipher
=== RUN   TestVectorsRSA
--- PASS: TestVectorsRSA (0.27s)
=== RUN   TestInvalidAlgorithmsRSA
--- PASS: TestInvalidAlgorithmsRSA (0.00s)
=== RUN   TestPKCSKeyGeneratorFailure
--- PASS: TestPKCSKeyGeneratorFailure (0.00s)
=== RUN   TestInvalidAlgorithmsEC
--- PASS: TestInvalidAlgorithmsEC (0.00s)
=== RUN   TestInvalidECKeyGen
--- PASS: TestInvalidECKeyGen (0.09s)
=== RUN   TestInvalidECDecrypt
--- PASS: TestInvalidECDecrypt (0.00s)
=== RUN   TestDecryptWithIncorrectSize
--- PASS: TestDecryptWithIncorrectSize (51.80s)
=== RUN   TestPKCSDecryptNeverFails
--- PASS: TestPKCSDecryptNeverFails (19.83s)
=== RUN   TestInvalidEllipticCurve
--- PASS: TestInvalidEllipticCurve (0.00s)
=== RUN   TestRoundtripsJWE
--- PASS: TestRoundtripsJWE (199.33s)
=== RUN   TestRoundtripsJWECorrupted
SIGQUIT: quit
PC=0x6ce28 m=0

goroutine 0 [idle]:
runtime.futex(0x38a0cc, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1dee4, 0x0, 0x0, 0x0, ...)
    /usr/lib/go/src/runtime/sys_linux_arm.s:246 +0x1c
runtime.futexsleep(0x38a0cc, 0x0, 0xffffffff, 0xffffffff)
    /usr/lib/go/src/runtime/os1_linux.go:40 +0x68
runtime.notesleep(0x38a0cc)
    /usr/lib/go/src/runtime/lock_futex.go:145 +0xa4
runtime.stopm()
    /usr/lib/go/src/runtime/proc.go:1535 +0x100
runtime.findrunnable(0x1051c000, 0x0)
    /usr/lib/go/src/runtime/proc.go:1973 +0x7c8
runtime.schedule()
    /usr/lib/go/src/runtime/proc.go:2072 +0x26c
runtime.goschedImpl(0x160911e0)
    /usr/lib/go/src/runtime/proc.go:2152 +0x140
runtime.gopreempt_m(0x160911e0)
    /usr/lib/go/src/runtime/proc.go:2167 +0x30
runtime.newstack()
    /usr/lib/go/src/runtime/stack.go:932 +0xa38
runtime.morestack()
    /usr/lib/go/src/runtime/asm_arm.s:309 +0x4c

goroutine 1 [chan receive, 4 minutes]:
testing.RunTests(0x2c37bc, 0x3885a8, 0x4d, 0x4d, 0xb4c54001)
    /usr/lib/go/src/testing/testing.go:583 +0x62c
testing.(*M).Run(0x10539f7c, 0x1088ab70)
    /usr/lib/go/src/testing/testing.go:515 +0x8c
main.main()
    github.com/square/go-jose/_test/_testmain.go:526 +0x118

goroutine 17 [syscall, 9 minutes, locked to thread]:
runtime.goexit()
    /usr/lib/go/src/runtime/asm_arm.s:990 +0x4

goroutine 15 [runnable]:
math/big.(*Int).Mod(0x160db508, 0x160db508, 0x1088e240, 0x160db508)
    /usr/lib/go/src/math/big/int.go:252
crypto/elliptic.(*CurveParams).addJacobian(0x1088d2e0, 0x1096bb50, 0x1096bb60, 0x160db5b8, 0x1739d4d0, 0x1739d4c0, 0x1739d4e0, 0x1739d460, 0x1739d470, 0x1739d480)
    /usr/lib/go/src/crypto/elliptic/elliptic.go:132 +0x244
crypto/elliptic.(*CurveParams).ScalarMult(0x1088d2e0, 0x1096bb50, 0x1096bb60, 0x1739a690, 0x30, 0x30, 0x4, 0x4)
    /usr/lib/go/src/crypto/elliptic/elliptic.go:259 +0x170
github.com/square/go-jose/cipher.DeriveECDHES(0x27bf80, 0xe, 0x160db78c, 0x0, 0x0, 0x160db78c, 0x0, 0x0, 0x15a83ee0, 0x1088d6a0, ...)
    /build/golang-github-square-go-jose-0.0~git20160304.0.7465d2b/obj-arm-linux-gnueabihf/src/github.com/square/go-jose/cipher/ecdh_es.go:36 +0x7a0
github.com/square/go-jose.ecKeyGenerator.genKey(0x10, 0x27bf80, 0xe, 0x1088d6a0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
    /build/golang-github-square-go-jose-0.0~git20160304.0.7465d2b/obj-arm-linux-gnueabihf/src/github.com/square/go-jose/asymmetric.go:351 +0x15c
github.com/square/go-jose.ecEncrypterVerifier.encryptKey(0x1088d6a0, 0x15a83ea0, 0x18, 0x18, 0x27bf80, 0xe, 0x0, 0x0, 0x0, 0x0, ...)
    /build/golang-github-square-go-jose-0.0~git20160304.0.7465d2b/obj-arm-linux-gnueabihf/src/github.com/square/go-jose/asymmetric.go:318 +0x218
github.com/square/go-jose.(*ecEncrypterVerifier).encryptKey(0x10526a40, 0x15a83ea0, 0x18, 0x18, 0x27bf80, 0xe, 0x0, 0x0, 0x0, 0x0, ...)
    <autogenerated>:16 +0xd8
github.com/square/go-jose.(*genericEncrypter).EncryptWithAuthData(0x15aad740, 0x15a83e80, 0x1a, 0x20, 0x0, 0x0, 0x0, 0x15aad740, 0x0, 0x0)
    /build/golang-github-square-go-jose-0.0~git20160304.0.7465d2b/obj-arm-linux-gnueabihf/src/github.com/square/go-jose/crypter.go:254 +0x340
github.com/square/go-jose.RoundtripJWE(0x27bf80, 0xe, 0x264748, 0x7, 0x263ca0, 0x3, 0x2c36dc, 0x160dbd98, 0x0, 0x0, ...)
    /build/golang-github-square-go-jose-0.0~git20160304.0.7465d2b/obj-arm-linux-gnueabihf/src/github.com/square/go-jose/crypter_test.go:46 +0x1c4
github.com/square/go-jose.TestRoundtripsJWECorrupted(0x16f85e60)
    /build/golang-github-square-go-jose-0.0~git20160304.0.7465d2b/obj-arm-linux-gnueabihf/src/github.com/square/go-jose/crypter_test.go:176 +0x6b0
testing.tRunner(0x16f85e60, 0x388620)
    /usr/lib/go/src/testing/testing.go:473 +0xa8
created by testing.RunTests
    /usr/lib/go/src/testing/testing.go:582 +0x600

trap    0x6
error   0x0
oldmask 0x0
r0      0x38a0cc
r1      0x0
r2      0x0
r3      0x0
r4      0x0
r5      0x0
r6      0x7f27b
r7      0xf0
r8      0x1051aa00
r9      0x0
r10     0x389e58
fp      0x389dcc
ip      0x1051b6f4
sp      0xbefab184
lr      0x3a790
pc      0x6ce28
cpsr    0xa0070010
fault   0x0
*** Test killed with quit: ran too long (10m0s).
FAIL    github.com/square/go-jose   600.153s
csstaub commented 8 years ago

It looks to me like it just timed out. Other than that I don't see anything particularly interesting about those stack traces. You may want to try this again with e.g. go test -v -timeout 1h. Based on the fact that TestRoundtripsJWE alone took almost 200s to complete, I'd wager a guess that the default timeout of 600s likely isn't enough for running all the tests.

csstaub commented 8 years ago

Closing this, as it doesn't look an it's an issue with the library itself, just a timeout. Please re-open if you disagree.