Skip to content

Commit d3c549c

Browse files
author
zhdllwyc
committed
honest majority
1 parent c8971c0 commit d3c549c

File tree

115 files changed

+4356
-419
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

115 files changed

+4356
-419
lines changed

.github/workflows/ci-actions.yml

+9-6
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
runs-on: ubuntu-20.04
1313
strategy:
1414
matrix:
15-
GOVER: ['1.18', '1.17', '1.16']
15+
GOVER: ['1.19', '1.18', '1.17']
1616
steps:
1717
- name: Setup Go-${{ matrix.GOVER }}
1818
uses: actions/setup-go@v3
@@ -23,16 +23,19 @@ jobs:
2323
- name: Linting
2424
uses: golangci/golangci-lint-action@v3
2525
with:
26-
version: v1.46
26+
version: v1.48
2727
args: --config=./.etc/golangci.yml ./...
2828
- name: Check shadowing
2929
run: |
3030
go install golang.org/x/tools/go/analysis/passes/shadow/cmd/shadow@latest
3131
go vet -vettool=$(which shadow) ./... 2>&1 | awk -f .etc/action.awk
32+
shell: bash
3233
- name: Verifying Code
3334
run: |
34-
go generate -v ./... && test -z "$(git status --porcelain)"
35+
go generate -v ./...
36+
test -z "$(git status --porcelain)"
3537
go vet ./...
38+
shell: bash
3639
- name: Building
3740
run: go build -v ./...
3841
- name: Testing
@@ -43,7 +46,7 @@ jobs:
4346
runs-on: ubuntu-20.04
4447
strategy:
4548
matrix:
46-
CFG: [ [arm64,arm64v8,1.18] ]
49+
CFG: [ [arm64,arm64v8,1.19] ]
4750
steps:
4851
- uses: actions/checkout@v3
4952
- name: Enabling Docker Experimental
@@ -69,7 +72,7 @@ jobs:
6972
- name: Setup Go
7073
uses: actions/setup-go@v3
7174
with:
72-
go-version: '1.18'
75+
go-version: '1.19'
7376
- name: Produce Coverage
7477
run: go test -coverprofile=./coverage.txt ./...
7578
- name: Upload Codecov
@@ -89,7 +92,7 @@ jobs:
8992
- name: Setup Go
9093
uses: actions/setup-go@v3
9194
with:
92-
go-version: '1.18'
95+
go-version: '1.19'
9396
- name: Building
9497
run: go build -v ./...
9598
- name: Testing

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,10 @@ go get -u github.com/cloudflare/circl
4747
- [VOPRF](https://datatracker.ietf.org/doc/draft-irtf-cfrg-voprf/): Verifiable Oblivious Pseudorandom function.
4848

4949
#### Post-Quantum Key Encapsulation Methods
50-
- [SIDH/SIKE](https://sike.org/): Supersingular Key Encapsulation with primes p434, p503, p751
5150
- [CSIDH](https://csidh.isogeny.org/): Post-Quantum Commutative Group Action
5251
- [Kyber](https://pq-crystals.org/kyber/) KEM: modes 512, 768, 1024
5352
- [FrodoKEM](https://frodokem.org/) KEM: modes 640-SHAKE
53+
- (**insecure, deprecated**) [SIDH/SIKE](https://sike.org/): Supersingular Key Encapsulation with primes p434, p503, p751
5454

5555
#### Post-Quantum Public-Key Encryption
5656
- [Kyber](https://pq-crystals.org/kyber/) PKE: modes 512, 768, 1024

blindsign/blindrsa/blindrsa_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ import (
1212
"encoding/pem"
1313
"fmt"
1414
"io"
15-
"io/ioutil"
1615
"math/big"
16+
"os"
1717
"testing"
1818
)
1919

@@ -361,7 +361,7 @@ func verifyTestVector(t *testing.T, vector testVector) {
361361
}
362362

363363
func TestVectors(t *testing.T) {
364-
data, err := ioutil.ReadFile("testdata/test_vectors.json")
364+
data, err := os.ReadFile("testdata/test_vectors.json")
365365
if err != nil {
366366
t.Fatal("Failed reading test vectors:", err)
367367
}

dh/csidh/csidh.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,9 @@ func GeneratePublicKey(pub *PublicKey, prv *PrivateKey, rng io.Reader) {
283283
// Validate returns true if 'pub' is a valid cSIDH public key,
284284
// otherwise false.
285285
// More precisely, the function verifies that curve
286-
// y^2 = x^3 + pub.a * x^2 + x
286+
//
287+
// y^2 = x^3 + pub.a * x^2 + x
288+
//
287289
// is supersingular.
288290
func Validate(pub *PublicKey, rng io.Reader) bool {
289291
// Check if in range

dh/csidh/curve.go

+9-4
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@ package csidh
22

33
// xAdd implements differential arithmetic in P^1 for Montgomery
44
// curves E(x): x^3 + A*x^2 + x by using x-coordinate only arithmetic.
5-
// x(PaQ) = x(P) + x(Q) by using x(P-Q)
5+
//
6+
// x(PaQ) = x(P) + x(Q) by using x(P-Q)
7+
//
68
// This algorithms is correctly defined only for cases when
79
// P!=inf, Q!=inf, P!=Q and P!=-Q.
810
func xAdd(PaQ, P, Q, PdQ *point) {
@@ -23,7 +25,9 @@ func xAdd(PaQ, P, Q, PdQ *point) {
2325

2426
// xDbl implements point doubling on a Montgomery curve
2527
// E(x): x^3 + A*x^2 + x by using x-coordinate onlyh arithmetic.
26-
// x(Q) = [2]*x(P)
28+
//
29+
// x(Q) = [2]*x(P)
30+
//
2731
// It is correctly defined for all P != inf.
2832
func xDbl(Q, P, A *point) {
2933
var t0, t1, t2 fp
@@ -45,8 +49,9 @@ func xDbl(Q, P, A *point) {
4549
// xDblAdd implements combined doubling of point P
4650
// and addition of points P and Q on a Montgomery curve
4751
// E(x): x^3 + A*x^2 + x by using x-coordinate onlyh arithmetic.
48-
// x(PaP) = x(2*P)
49-
// x(PaQ) = x(P+Q)
52+
//
53+
// x(PaP) = x(2*P)
54+
// x(PaQ) = x(P+Q)
5055
func xDblAdd(PaP, PaQ, P, Q, PdQ *point, A24 *coeff) {
5156
var t0, t1, t2 fp
5257

dh/csidh/doc.go

+2-3
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
// for securing systems.
66
//
77
// References:
8-
// - cSIDH: ia.cr/2018/383
9-
// - Faster cSIDH: ia.cr/2018/782
10-
//
8+
// - cSIDH: ia.cr/2018/383
9+
// - Faster cSIDH: ia.cr/2018/782
1110
package csidh

dh/csidh/fp511.go

+4-2
Original file line numberDiff line numberDiff line change
@@ -178,8 +178,10 @@ func modExpRdc64(r, b *fp, e uint64) {
178178
// isNonQuadRes checks whether value v is quadratic residue.
179179
// Implementation uses Fermat's little theorem (or
180180
// Euler's criterion)
181-
// a^(p-1) == 1, hence
182-
// (a^2) ((p-1)/2) == 1
181+
//
182+
// a^(p-1) == 1, hence
183+
// (a^2) ((p-1)/2) == 1
184+
//
183185
// Which means v is a quadratic residue iff v^((p-1)/2) == 1.
184186
// Caller provided v must be in montgomery domain.
185187
// Returns 0 in case v is quadratic residue or 1 in case

dh/curve4q/doc.go

+2-3
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
// at the 128-bit security level.
33
//
44
// References:
5-
// - https://eprint.iacr.org/2015/565
6-
// - https://tools.ietf.org/html/draft-ladd-cfrg-4q-01
7-
//
5+
// - https://eprint.iacr.org/2015/565
6+
// - https://tools.ietf.org/html/draft-ladd-cfrg-4q-01
87
package curve4q

dh/sidh/doc.go

+24-11
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,43 @@
1-
// Package sidh provides implementation of experimental post-quantum
1+
// Package sidh is deprecated, it provides SIDH and SIKE key encapsulation
2+
// mechanisms.
3+
//
4+
// # DEPRECATION NOTICE
5+
//
6+
// SIDH and SIKE are deprecated as were shown vulnerable to a key recovery
7+
// attack by Castryck-Decru's paper (https://eprint.iacr.org/2022/975). New
8+
// systems should not rely on this package. This package is frozen.
9+
//
10+
// # SIDH and SIKE
11+
//
12+
// This package provides implementation of experimental post-quantum
213
// Supersingular Isogeny Diffie-Hellman (SIDH) as well as Supersingular
314
// Isogeny Key Encapsulation (SIKE).
415
//
5-
// It comes with implementations of 2 different field arithmetic
6-
// implementations sidh.Fp503 and sidh.Fp751.
16+
// It comes with implementations of three different field arithmetic
17+
// implementations sidh.Fp434, sidh.Fp503, and sidh.Fp751.
718
//
819
// | Algorithm | Public Key Size | Shared Secret Size | Ciphertext Size |
920
// |-----------|-----------------|--------------------|-----------------|
10-
// | SIDH/p503 | 376 | 126 | N/A |
11-
// | SIDH/p751 | 564 | 188 | N/A |
12-
// | SIKE/p503 | 376 | 16 | 402 |
13-
// | SIKE/p751 | 564 | 24 | 596 |
21+
// | SIDH/p434 | 330 | 110 | N/A |
22+
// | SIDH/p503 | 378 | 126 | N/A |
23+
// | SIDH/p751 | 564 | 188 | N/A |
24+
// | SIKE/p434 | 330 | 16 | 346 |
25+
// | SIKE/p503 | 378 | 24 | 402 |
26+
// | SIKE/p751 | 564 | 32 | 596 |
1427
//
1528
// In order to instantiate SIKE/p751 KEM one needs to create a KEM object
1629
// and allocate internal structures. This can be done with NewSike751 helper.
17-
// After that kem can be used multiple times.
30+
// After that, the kem variable can be used multiple times.
1831
//
1932
// var kem = sike.NewSike751(rand.Reader)
2033
// kem.Encapsulate(ciphertext, sharedSecret, publicBob)
21-
// kem.Decapsulate(sharedSecret, privateBob, PublicBob, ciphertext)
34+
// kem.Decapsulate(sharedSecret, privateBob, publicBob, ciphertext)
2235
//
2336
// Code is optimized for AMD64 and aarch64. Generic implementation
2437
// is provided for other architectures.
2538
//
2639
// References:
27-
// - [SIDH] https://eprint.iacr.org/2011/506
28-
// - [SIKE] http://www.sike.org/files/SIDH-spec.pdf
2940
//
41+
// - [SIDH] https://eprint.iacr.org/2011/506
42+
// - [SIKE] http://www.sike.org/files/SIDH-spec.pdf
3043
package sidh

dh/sidh/internal/p434/arith_decl.go

+9
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dh/sidh/internal/p434/curve.go

+6-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dh/sidh/internal/p434/fp2.go

+8-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dh/sidh/internal/p503/arith_decl.go

+9
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dh/sidh/internal/p503/curve.go

+6-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)