-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathno_cgo_test.go
47 lines (43 loc) · 2.67 KB
/
no_cgo_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
//go:build !cgo && no_cgo
// +build !cgo,no_cgo
package crypto_test
import (
"testing"
"github.com/onflow/crypto"
"github.com/stretchr/testify/assert"
)
// Test all public functions requiring cgo.
// These functions must panic if built without cgo.
func TestNoRelicPanic(t *testing.T) {
assert.Panics(t, func() { _, _ = crypto.GeneratePrivateKey(crypto.BLSBLS12381, nil) })
assert.Panics(t, func() { _, _ = crypto.DecodePrivateKey(crypto.BLSBLS12381, nil) })
assert.Panics(t, func() { _, _ = crypto.DecodePublicKey(crypto.BLSBLS12381, nil) })
assert.Panics(t, func() { _, _ = crypto.DecodePublicKeyCompressed(crypto.BLSBLS12381, nil) })
assert.Panics(t, func() { _ = crypto.NewExpandMsgXOFKMAC128("") })
assert.Panics(t, func() { _ = crypto.BLSInvalidSignature() })
assert.Panics(t, func() { _, _ = crypto.BLSGeneratePOP(nil) })
assert.Panics(t, func() { _, _ = crypto.BLSVerifyPOP(nil, nil) })
assert.Panics(t, func() { _, _ = crypto.AggregateBLSSignatures(nil) })
assert.Panics(t, func() { _, _ = crypto.AggregateBLSPrivateKeys(nil) })
assert.Panics(t, func() { _, _ = crypto.AggregateBLSPublicKeys(nil) })
assert.Panics(t, func() { _ = crypto.IdentityBLSPublicKey() })
assert.Panics(t, func() { _ = crypto.IsBLSAggregateEmptyListError(nil) })
assert.Panics(t, func() { _ = crypto.IsInvalidSignatureError(nil) })
assert.Panics(t, func() { _ = crypto.IsNotBLSKeyError(nil) })
assert.Panics(t, func() { _ = crypto.IsBLSSignatureIdentity(nil) })
assert.Panics(t, func() { _, _ = crypto.RemoveBLSPublicKeys(nil, nil) })
assert.Panics(t, func() { _, _ = crypto.VerifyBLSSignatureOneMessage(nil, nil, nil, nil) })
assert.Panics(t, func() { _, _ = crypto.VerifyBLSSignatureManyMessages(nil, nil, nil, nil) })
assert.Panics(t, func() { _, _ = crypto.BatchVerifyBLSSignaturesOneMessage(nil, nil, nil, nil) })
assert.Panics(t, func() { _, _ = crypto.SPOCKProve(nil, nil, nil) })
assert.Panics(t, func() { _, _ = crypto.SPOCKVerify(nil, nil, nil, nil) })
assert.Panics(t, func() { _, _ = crypto.SPOCKVerifyAgainstData(nil, nil, nil, nil) })
assert.Panics(t, func() { _, _ = crypto.NewBLSThresholdSignatureParticipant(nil, nil, 0, 0, nil, nil, "") })
assert.Panics(t, func() { _, _ = crypto.NewBLSThresholdSignatureInspector(nil, nil, 0, nil, "") })
assert.Panics(t, func() { _, _ = crypto.BLSReconstructThresholdSignature(0, 0, nil, nil) })
assert.Panics(t, func() { _, _ = crypto.EnoughShares(0, 0) })
assert.Panics(t, func() { _, _, _, _ = crypto.BLSThresholdKeyGen(0, 0, nil) })
assert.Panics(t, func() { _, _ = crypto.NewFeldmanVSS(0, 0, 0, nil, 0) })
assert.Panics(t, func() { _, _ = crypto.NewFeldmanVSSQual(0, 0, 0, nil, 0) })
assert.Panics(t, func() { _, _ = crypto.NewJointFeldman(0, 0, 0, nil) })
}