micromdm / scep

Go SCEP server
MIT License
310 stars 121 forks source link

TestGenerateSubjectKeyID fails #206

Open pymnh opened 1 year ago

pymnh commented 1 year ago

with go 1.19 on linux, TestGenerateSubjectKeyID fails:

% go test github.com/micromdm/scep/v2/cryptoutil
--- FAIL: TestGenerateSubjectKeyID (0.00s)
    --- FAIL: TestGenerateSubjectKeyID/ECDSA (0.00s)
panic: crypto/elliptic: attempted operation on invalid point [recovered]
    panic: crypto/elliptic: attempted operation on invalid point

goroutine 20 [running]:
testing.tRunner.func1.2({0x547d20, 0x5b80d0})
    /usr/lib/go-1.19/src/testing/testing.go:1396 +0x24e
testing.tRunner.func1()
    /usr/lib/go-1.19/src/testing/testing.go:1399 +0x39f
panic({0x547d20, 0x5b80d0})
    /usr/lib/go-1.19/src/runtime/panic.go:884 +0x212
crypto/elliptic.panicIfNotOnCurve({0x5b9768?, 0x681280?}, 0xc000103268?, 0xc00012a2f0?)
    /usr/lib/go-1.19/src/crypto/elliptic/elliptic.go:182 +0xa5
crypto/elliptic.Marshal({0x5b9768, 0x681280}, 0xc000128028?, 0x68a740?)
    /usr/lib/go-1.19/src/crypto/elliptic/elliptic.go:75 +0x31
github.com/micromdm/scep/v2/cryptoutil.GenerateSubjectKeyID({0x55dfa0?, 0xc000162660?})
    /home/schmu/projekte/code/scep/cryptoutil/cryptoutil.go:26 +0xb0
github.com/micromdm/scep/v2/cryptoutil.TestGenerateSubjectKeyID.func1(0xc000103040)
    /home/schmu/projekte/code/scep/cryptoutil/cryptoutil_test.go:23 +0x46
testing.tRunner(0xc000103040, 0xc0001243f0)
    /usr/lib/go-1.19/src/testing/testing.go:1446 +0x10b
created by testing.(*T).Run
    /usr/lib/go-1.19/src/testing/testing.go:1493 +0x35f
FAIL    github.com/micromdm/scep/v2/cryptoutil  0.005s
FAIL

I don't know much about the go crypto library, but might to have to do with go1.19? see https://github.com/nspcc-dev/neofs-crypto/issues/15

klubi commented 1 year ago

I solved it by slightly changing the test -> https://github.com/jamf/scep/commit/ddc506455560e07c70a5cd4e92ba124c7364b052