You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Building your project with Flow crypto and enabling all the supported algorithms requires using cgo to compile the C code underneath.
31
31
If cgo isn't enabled by default, the `CGO_ENABLED` environment variable should be set to `1`.
32
-
It is also possible to build without cgo (`CGO_ENABLED=0`) but this would disable some primitives (the ones related to BLS).
33
-
34
-
### Build with cgo
35
-
36
-
Building with cgo is required to support all the algorithms of the module, including the algorithms based on the BLS12-381 curve.
37
32
38
33
If the test or target application crashes with a "Caught SIGILL" exception, rebuild with `CGO_CFLAGS` set to `"-O2 -D__BLST_PORTABLE__"` to disable non-portable code.
39
34
The runtime error can happen if the CPU doesn't support certain instructions.
@@ -53,19 +48,6 @@ GOOS=linux GOARCH=arm64 CC=aarch64-linux-gnu-gcc CGO_ENABLED=1 go build
53
48
54
49
When using the `go mod vendor` command in your project, [a known issue](https://github.com/golang/go/issues/26366) with the Go vendoring tool prevents cgo dependencies from being copied into your vendor directory. This results in build errors related to the Flow crypto package. External vendoring tools that do copy the entire package files can be used instead of the Go command to resolve the issue.
55
50
56
-
57
-
### Build without cgo
58
-
59
-
It is possible to build without cgo but this requires disabling all primitives based on the BLS12-381 curve (BLS signature, BLS threshold signature, BLS-based DKG, BLS-based SPoCK).
60
-
Refer to [algorithms](#algorithms) and [protocols](#protocols) to check the supported features.
61
-
Calling any of the non-supported primitives would panic.
62
-
In order to avoid accidental builds that result in unwanted crashes, disabling cgo must be confirmed with the `no_cgo` build tag.
63
-
64
-
```
65
-
CGO_ENABLED=0 go build -tags=no_cgo
66
-
```
67
-
68
-
69
51
## Algorithms
70
52
71
53
### Hashing and MAC:
@@ -83,10 +65,10 @@ All signature schemes use the generic interfaces of `PrivateKey` and `PublicKey`
83
65
84
66
* ECDSA
85
67
* public keys are compressed or uncompressed.
86
-
* ephemeral key is derived from the private key, hash and the system entropy (based on https://golang.org/pkg/crypto/ecdsa/).
87
68
* supports NIST P-256 (secp256r1) and secp256k1 curves.
69
+
* For NIST P-256, ephemeral key is derived from the private key, hash and the system entropy (based on https://golang.org/pkg/crypto/ecdsa/). For secp256k1, ephemeral key is deterministically formed following RFC 6979 (based on github.com/ethereum/go-ethereum/crypto/secp256k1)
* supports only BLS 12-381 curve with the same features above.
120
102
* (t+1) signatures are required to reconstruct the threshold signature.
@@ -126,16 +108,16 @@ All signature schemes use the generic interfaces of `PrivateKey` and `PublicKey`
126
108
127
109
All supported Distributed Key Generation protocols are [discrete log based](http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.50.2737&rep=rep1&type=pdf) and are implemented for the same BLS setup on the BLS 12-381 curve. The protocols generate key sets for the BLS-based threshold signature.
128
110
129
-
* Feldman VSS (requires cgo)
111
+
* Feldman VSS
130
112
* simple verifiable secret sharing with a single dealer.
131
113
* the library does not implement the communication channels between participants. The caller should implement the methods `PrivateSend` (1-to-1 messaging) and `Broadcast` (1-to-n messaging)
132
114
* 1-to-1 messaging must be a private channel, the caller must make sure the channel preserves confidentialiy and authenticates the sender.
133
115
* 1-to-n broadcasting is a reliable broadcast, where honest senders are able to reach all honest receivers, and where all honest receivers end up with the same received messages. The channel should also authenticate the broadcaster.
134
116
* It is recommended that both communication channels are unique per protocol instance. This could be achieved by prepending the messages to send/broadcast by a unique protocol instance ID.
135
-
* Feldman VSS Qual (requires cgo)
117
+
* Feldman VSS Qual
136
118
* an extension of the simple Feldman VSS.
137
119
* implements a complaint mechanism to qualify/disqualify the dealer.
138
-
* Joint Feldman (Pedersen) (requires cgo)
120
+
* Joint Feldman (Pedersen)
139
121
* distributed generation.
140
122
* based on parallel instances of Feldman VSS Qual, each with a different dealer.
141
123
* same assumptions about the communication channels as in Feldman VSS.
0 commit comments