Browse Source
sike: move common (#33)
* makes common reusable
* exports some more symbols from common
* remove kem for a moment
multikem
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
46 changed files with
45 additions and
58 deletions
-
dh/sidh/internal/p434/arith_amd64_test.go
-
dh/sidh/internal/p434/arith_decl.go
-
dh/sidh/internal/p434/arith_generic.go
-
dh/sidh/internal/p434/arith_test.go
-
dh/sidh/internal/p434/core.go
-
dh/sidh/internal/p434/curve.go
-
dh/sidh/internal/p434/curve_test.go
-
dh/sidh/internal/p434/fp2.go
-
dh/sidh/internal/p434/fp2_test.go
-
dh/sidh/internal/p434/params.go
-
dh/sidh/internal/p434/params_test.go
-
dh/sidh/internal/p503/arith_amd64_test.go
-
dh/sidh/internal/p503/arith_decl.go
-
dh/sidh/internal/p503/arith_generic.go
-
dh/sidh/internal/p503/arith_test.go
-
dh/sidh/internal/p503/core.go
-
dh/sidh/internal/p503/curve.go
-
dh/sidh/internal/p503/curve_test.go
-
dh/sidh/internal/p503/fp2.go
-
dh/sidh/internal/p503/fp2_test.go
-
dh/sidh/internal/p503/params.go
-
dh/sidh/internal/p503/params_test.go
-
dh/sidh/internal/p751/arith_amd64_test.go
-
dh/sidh/internal/p751/arith_decl.go
-
dh/sidh/internal/p751/arith_generic.go
-
dh/sidh/internal/p751/arith_test.go
-
dh/sidh/internal/p751/core.go
-
dh/sidh/internal/p751/curve.go
-
dh/sidh/internal/p751/curve_test.go
-
dh/sidh/internal/p751/fp2.go
-
dh/sidh/internal/p751/fp2_test.go
-
dh/sidh/internal/p751/params.go
-
dh/sidh/internal/p751/params_test.go
-
dh/sidh/internal/templates/arith_decl.gotemp
-
dh/sidh/internal/templates/arith_generic.gotemp
-
dh/sidh/internal/templates/arith_test.gotemp
-
dh/sidh/internal/templates/core.gotemp
-
dh/sidh/internal/templates/curve.gotemp
-
dh/sidh/internal/templates/curve_test.gotemp
-
dh/sidh/internal/templates/fp2.gotemp
-
dh/sidh/internal/templates/fp2_test.gotemp
-
dh/sidh/sidh.go
-
dh/sidh/sidh_test.go
-
dh/sidh/sike.go
-
dh/sidh/sike_test.go
-
kem/mkem/csidh.go
|
|
@@ -10,7 +10,7 @@ import ( |
|
|
|
"testing" |
|
|
|
"testing/quick" |
|
|
|
|
|
|
|
"github.com/henrydcase/nobs/dh/sidh/internal/common" |
|
|
|
"github.com/henrydcase/nobs/dh/sidh/common" |
|
|
|
"golang.org/x/sys/cpu" |
|
|
|
) |
|
|
|
|
|
|
|
|
|
@@ -6,7 +6,7 @@ |
|
|
|
package p434 |
|
|
|
|
|
|
|
import ( |
|
|
|
. "github.com/henrydcase/nobs/dh/sidh/internal/common" |
|
|
|
. "github.com/henrydcase/nobs/dh/sidh/common" |
|
|
|
) |
|
|
|
|
|
|
|
// If choice = 0, leave x,y unchanged. If choice = 1, set x,y = y,x. |
|
|
|
|
|
@@ -8,7 +8,7 @@ package p434 |
|
|
|
import ( |
|
|
|
"math/bits" |
|
|
|
|
|
|
|
"github.com/henrydcase/nobs/dh/sidh/internal/common" |
|
|
|
"github.com/henrydcase/nobs/dh/sidh/common" |
|
|
|
) |
|
|
|
|
|
|
|
// Compute z = x + y (mod p). |
|
|
|
|
|
@@ -6,7 +6,7 @@ package p434 |
|
|
|
import ( |
|
|
|
"testing" |
|
|
|
|
|
|
|
"github.com/henrydcase/nobs/dh/sidh/internal/common" |
|
|
|
"github.com/henrydcase/nobs/dh/sidh/common" |
|
|
|
) |
|
|
|
|
|
|
|
// Package-level storage for this field element is intended to deter |
|
|
|
|
|
@@ -4,7 +4,7 @@ |
|
|
|
package p434 |
|
|
|
|
|
|
|
import ( |
|
|
|
. "github.com/henrydcase/nobs/dh/sidh/internal/common" |
|
|
|
. "github.com/henrydcase/nobs/dh/sidh/common" |
|
|
|
) |
|
|
|
|
|
|
|
// ----------------------------------------------------------------------------- |
|
|
|
|
|
@@ -4,7 +4,7 @@ |
|
|
|
package p434 |
|
|
|
|
|
|
|
import ( |
|
|
|
. "github.com/henrydcase/nobs/dh/sidh/internal/common" |
|
|
|
. "github.com/henrydcase/nobs/dh/sidh/common" |
|
|
|
) |
|
|
|
|
|
|
|
// Stores isogeny 3 curve constants |
|
|
|
|
|
@@ -7,7 +7,7 @@ import ( |
|
|
|
"bytes" |
|
|
|
"testing" |
|
|
|
|
|
|
|
. "github.com/henrydcase/nobs/dh/sidh/internal/common" |
|
|
|
. "github.com/henrydcase/nobs/dh/sidh/common" |
|
|
|
) |
|
|
|
|
|
|
|
func vartimeEqProjFp2(lhs, rhs *ProjectivePoint) bool { |
|
|
|
|
|
@@ -4,7 +4,7 @@ |
|
|
|
package p434 |
|
|
|
|
|
|
|
import ( |
|
|
|
"github.com/henrydcase/nobs/dh/sidh/internal/common" |
|
|
|
"github.com/henrydcase/nobs/dh/sidh/common" |
|
|
|
) |
|
|
|
|
|
|
|
// Montgomery multiplication. Input values must be already |
|
|
|
|
|
@@ -9,7 +9,7 @@ import ( |
|
|
|
"testing" |
|
|
|
"testing/quick" |
|
|
|
|
|
|
|
"github.com/henrydcase/nobs/dh/sidh/internal/common" |
|
|
|
"github.com/henrydcase/nobs/dh/sidh/common" |
|
|
|
) |
|
|
|
|
|
|
|
type testParams struct { |
|
|
|
|
|
@@ -3,7 +3,7 @@ package p434 |
|
|
|
//go:generate go run ../templates/gen.go P434 |
|
|
|
|
|
|
|
import ( |
|
|
|
"github.com/henrydcase/nobs/dh/sidh/internal/common" |
|
|
|
"github.com/henrydcase/nobs/dh/sidh/common" |
|
|
|
"golang.org/x/sys/cpu" |
|
|
|
) |
|
|
|
|
|
|
|
|
|
@@ -4,7 +4,7 @@ package p434 |
|
|
|
import ( |
|
|
|
"testing/quick" |
|
|
|
|
|
|
|
. "github.com/henrydcase/nobs/dh/sidh/internal/common" |
|
|
|
. "github.com/henrydcase/nobs/dh/sidh/common" |
|
|
|
) |
|
|
|
|
|
|
|
// Values omputed using Sage |
|
|
|
|
|
@@ -10,7 +10,7 @@ import ( |
|
|
|
"testing" |
|
|
|
"testing/quick" |
|
|
|
|
|
|
|
"github.com/henrydcase/nobs/dh/sidh/internal/common" |
|
|
|
"github.com/henrydcase/nobs/dh/sidh/common" |
|
|
|
"golang.org/x/sys/cpu" |
|
|
|
) |
|
|
|
|
|
|
|
|
|
@@ -6,7 +6,7 @@ |
|
|
|
package p503 |
|
|
|
|
|
|
|
import ( |
|
|
|
. "github.com/henrydcase/nobs/dh/sidh/internal/common" |
|
|
|
. "github.com/henrydcase/nobs/dh/sidh/common" |
|
|
|
) |
|
|
|
|
|
|
|
// If choice = 0, leave x,y unchanged. If choice = 1, set x,y = y,x. |
|
|
|
|
|
@@ -8,7 +8,7 @@ package p503 |
|
|
|
import ( |
|
|
|
"math/bits" |
|
|
|
|
|
|
|
"github.com/henrydcase/nobs/dh/sidh/internal/common" |
|
|
|
"github.com/henrydcase/nobs/dh/sidh/common" |
|
|
|
) |
|
|
|
|
|
|
|
// Compute z = x + y (mod p). |
|
|
|
|
|
@@ -6,7 +6,7 @@ package p503 |
|
|
|
import ( |
|
|
|
"testing" |
|
|
|
|
|
|
|
"github.com/henrydcase/nobs/dh/sidh/internal/common" |
|
|
|
"github.com/henrydcase/nobs/dh/sidh/common" |
|
|
|
) |
|
|
|
|
|
|
|
// Package-level storage for this field element is intended to deter |
|
|
|
|
|
@@ -4,7 +4,7 @@ |
|
|
|
package p503 |
|
|
|
|
|
|
|
import ( |
|
|
|
. "github.com/henrydcase/nobs/dh/sidh/internal/common" |
|
|
|
. "github.com/henrydcase/nobs/dh/sidh/common" |
|
|
|
) |
|
|
|
|
|
|
|
// ----------------------------------------------------------------------------- |
|
|
|
|
|
@@ -4,7 +4,7 @@ |
|
|
|
package p503 |
|
|
|
|
|
|
|
import ( |
|
|
|
. "github.com/henrydcase/nobs/dh/sidh/internal/common" |
|
|
|
. "github.com/henrydcase/nobs/dh/sidh/common" |
|
|
|
) |
|
|
|
|
|
|
|
// Stores isogeny 3 curve constants |
|
|
|
|
|
@@ -7,7 +7,7 @@ import ( |
|
|
|
"bytes" |
|
|
|
"testing" |
|
|
|
|
|
|
|
. "github.com/henrydcase/nobs/dh/sidh/internal/common" |
|
|
|
. "github.com/henrydcase/nobs/dh/sidh/common" |
|
|
|
) |
|
|
|
|
|
|
|
func vartimeEqProjFp2(lhs, rhs *ProjectivePoint) bool { |
|
|
|
|
|
@@ -4,7 +4,7 @@ |
|
|
|
package p503 |
|
|
|
|
|
|
|
import ( |
|
|
|
"github.com/henrydcase/nobs/dh/sidh/internal/common" |
|
|
|
"github.com/henrydcase/nobs/dh/sidh/common" |
|
|
|
) |
|
|
|
|
|
|
|
// Montgomery multiplication. Input values must be already |
|
|
|
|
|
@@ -9,7 +9,7 @@ import ( |
|
|
|
"testing" |
|
|
|
"testing/quick" |
|
|
|
|
|
|
|
"github.com/henrydcase/nobs/dh/sidh/internal/common" |
|
|
|
"github.com/henrydcase/nobs/dh/sidh/common" |
|
|
|
) |
|
|
|
|
|
|
|
type testParams struct { |
|
|
|
|
|
@@ -3,7 +3,7 @@ package p503 |
|
|
|
//go:generate go run ../templates/gen.go P503 |
|
|
|
|
|
|
|
import ( |
|
|
|
"github.com/henrydcase/nobs/dh/sidh/internal/common" |
|
|
|
"github.com/henrydcase/nobs/dh/sidh/common" |
|
|
|
"golang.org/x/sys/cpu" |
|
|
|
) |
|
|
|
|
|
|
|
|
|
@@ -4,7 +4,7 @@ package p503 |
|
|
|
import ( |
|
|
|
"testing/quick" |
|
|
|
|
|
|
|
. "github.com/henrydcase/nobs/dh/sidh/internal/common" |
|
|
|
. "github.com/henrydcase/nobs/dh/sidh/common" |
|
|
|
) |
|
|
|
|
|
|
|
// Values omputed using Sage |
|
|
|
|
|
@@ -10,7 +10,7 @@ import ( |
|
|
|
"testing" |
|
|
|
"testing/quick" |
|
|
|
|
|
|
|
"github.com/henrydcase/nobs/dh/sidh/internal/common" |
|
|
|
"github.com/henrydcase/nobs/dh/sidh/common" |
|
|
|
"golang.org/x/sys/cpu" |
|
|
|
) |
|
|
|
|
|
|
|
|
|
@@ -6,7 +6,7 @@ |
|
|
|
package p751 |
|
|
|
|
|
|
|
import ( |
|
|
|
. "github.com/henrydcase/nobs/dh/sidh/internal/common" |
|
|
|
. "github.com/henrydcase/nobs/dh/sidh/common" |
|
|
|
) |
|
|
|
|
|
|
|
// If choice = 0, leave x,y unchanged. If choice = 1, set x,y = y,x. |
|
|
|
|
|
@@ -8,7 +8,7 @@ package p751 |
|
|
|
import ( |
|
|
|
"math/bits" |
|
|
|
|
|
|
|
"github.com/henrydcase/nobs/dh/sidh/internal/common" |
|
|
|
"github.com/henrydcase/nobs/dh/sidh/common" |
|
|
|
) |
|
|
|
|
|
|
|
// Compute z = x + y (mod p). |
|
|
|
|
|
@@ -6,7 +6,7 @@ package p751 |
|
|
|
import ( |
|
|
|
"testing" |
|
|
|
|
|
|
|
"github.com/henrydcase/nobs/dh/sidh/internal/common" |
|
|
|
"github.com/henrydcase/nobs/dh/sidh/common" |
|
|
|
) |
|
|
|
|
|
|
|
// Package-level storage for this field element is intended to deter |
|
|
|
|
|
@@ -4,7 +4,7 @@ |
|
|
|
package p751 |
|
|
|
|
|
|
|
import ( |
|
|
|
. "github.com/henrydcase/nobs/dh/sidh/internal/common" |
|
|
|
. "github.com/henrydcase/nobs/dh/sidh/common" |
|
|
|
) |
|
|
|
|
|
|
|
// ----------------------------------------------------------------------------- |
|
|
|
|
|
@@ -4,7 +4,7 @@ |
|
|
|
package p751 |
|
|
|
|
|
|
|
import ( |
|
|
|
. "github.com/henrydcase/nobs/dh/sidh/internal/common" |
|
|
|
. "github.com/henrydcase/nobs/dh/sidh/common" |
|
|
|
) |
|
|
|
|
|
|
|
// Stores isogeny 3 curve constants |
|
|
|
|
|
@@ -7,7 +7,7 @@ import ( |
|
|
|
"bytes" |
|
|
|
"testing" |
|
|
|
|
|
|
|
. "github.com/henrydcase/nobs/dh/sidh/internal/common" |
|
|
|
. "github.com/henrydcase/nobs/dh/sidh/common" |
|
|
|
) |
|
|
|
|
|
|
|
func vartimeEqProjFp2(lhs, rhs *ProjectivePoint) bool { |
|
|
|
|
|
@@ -4,7 +4,7 @@ |
|
|
|
package p751 |
|
|
|
|
|
|
|
import ( |
|
|
|
"github.com/henrydcase/nobs/dh/sidh/internal/common" |
|
|
|
"github.com/henrydcase/nobs/dh/sidh/common" |
|
|
|
) |
|
|
|
|
|
|
|
// Montgomery multiplication. Input values must be already |
|
|
|
|
|
@@ -9,7 +9,7 @@ import ( |
|
|
|
"testing" |
|
|
|
"testing/quick" |
|
|
|
|
|
|
|
"github.com/henrydcase/nobs/dh/sidh/internal/common" |
|
|
|
"github.com/henrydcase/nobs/dh/sidh/common" |
|
|
|
) |
|
|
|
|
|
|
|
type testParams struct { |
|
|
|
|
|
@@ -3,7 +3,7 @@ package p751 |
|
|
|
//go:generate go run ../templates/gen.go P751 |
|
|
|
|
|
|
|
import ( |
|
|
|
"github.com/henrydcase/nobs/dh/sidh/internal/common" |
|
|
|
"github.com/henrydcase/nobs/dh/sidh/common" |
|
|
|
"golang.org/x/sys/cpu" |
|
|
|
) |
|
|
|
|
|
|
|
|
|
@@ -4,7 +4,7 @@ package p751 |
|
|
|
import ( |
|
|
|
"testing/quick" |
|
|
|
|
|
|
|
. "github.com/henrydcase/nobs/dh/sidh/internal/common" |
|
|
|
. "github.com/henrydcase/nobs/dh/sidh/common" |
|
|
|
) |
|
|
|
|
|
|
|
var ( |
|
|
|
|
|
@@ -6,7 +6,7 @@ |
|
|
|
package {{ .PACKAGE}} |
|
|
|
|
|
|
|
import ( |
|
|
|
. "github.com/henrydcase/nobs/dh/sidh/internal/common" |
|
|
|
. "github.com/henrydcase/nobs/dh/sidh/common" |
|
|
|
) |
|
|
|
|
|
|
|
// If choice = 0, leave x,y unchanged. If choice = 1, set x,y = y,x. |
|
|
|
|
|
@@ -8,7 +8,7 @@ package {{ .PACKAGE}} |
|
|
|
import ( |
|
|
|
"math/bits" |
|
|
|
|
|
|
|
"github.com/henrydcase/nobs/dh/sidh/internal/common" |
|
|
|
"github.com/henrydcase/nobs/dh/sidh/common" |
|
|
|
) |
|
|
|
|
|
|
|
// Compute z = x + y (mod p). |
|
|
|
|
|
@@ -6,7 +6,7 @@ package {{ .PACKAGE}} |
|
|
|
import ( |
|
|
|
"testing" |
|
|
|
|
|
|
|
"github.com/henrydcase/nobs/dh/sidh/internal/common" |
|
|
|
"github.com/henrydcase/nobs/dh/sidh/common" |
|
|
|
) |
|
|
|
|
|
|
|
// Package-level storage for this field element is intended to deter |
|
|
|
|
|
@@ -4,7 +4,7 @@ |
|
|
|
package {{ .PACKAGE}} |
|
|
|
|
|
|
|
import ( |
|
|
|
. "github.com/henrydcase/nobs/dh/sidh/internal/common" |
|
|
|
. "github.com/henrydcase/nobs/dh/sidh/common" |
|
|
|
) |
|
|
|
|
|
|
|
// ----------------------------------------------------------------------------- |
|
|
|
|
|
@@ -4,7 +4,7 @@ |
|
|
|
package {{ .PACKAGE}} |
|
|
|
|
|
|
|
import ( |
|
|
|
. "github.com/henrydcase/nobs/dh/sidh/internal/common" |
|
|
|
. "github.com/henrydcase/nobs/dh/sidh/common" |
|
|
|
) |
|
|
|
|
|
|
|
// Stores isogeny 3 curve constants |
|
|
|
|
|
@@ -7,7 +7,7 @@ import ( |
|
|
|
"bytes" |
|
|
|
"testing" |
|
|
|
|
|
|
|
. "github.com/henrydcase/nobs/dh/sidh/internal/common" |
|
|
|
. "github.com/henrydcase/nobs/dh/sidh/common" |
|
|
|
) |
|
|
|
|
|
|
|
func vartimeEqProjFp2(lhs, rhs *ProjectivePoint) bool { |
|
|
|
|
|
@@ -4,7 +4,7 @@ |
|
|
|
package {{ .PACKAGE}} |
|
|
|
|
|
|
|
import ( |
|
|
|
"github.com/henrydcase/nobs/dh/sidh/internal/common" |
|
|
|
"github.com/henrydcase/nobs/dh/sidh/common" |
|
|
|
) |
|
|
|
|
|
|
|
// Montgomery multiplication. Input values must be already |
|
|
|
|
|
@@ -9,7 +9,7 @@ import ( |
|
|
|
"testing" |
|
|
|
"testing/quick" |
|
|
|
|
|
|
|
"github.com/henrydcase/nobs/dh/sidh/internal/common" |
|
|
|
"github.com/henrydcase/nobs/dh/sidh/common" |
|
|
|
) |
|
|
|
|
|
|
|
type testParams struct { |
|
|
|
|
|
@@ -4,7 +4,7 @@ import ( |
|
|
|
"errors" |
|
|
|
"io" |
|
|
|
|
|
|
|
"github.com/henrydcase/nobs/dh/sidh/internal/common" |
|
|
|
"github.com/henrydcase/nobs/dh/sidh/common" |
|
|
|
"github.com/henrydcase/nobs/dh/sidh/internal/p434" |
|
|
|
"github.com/henrydcase/nobs/dh/sidh/internal/p503" |
|
|
|
"github.com/henrydcase/nobs/dh/sidh/internal/p751" |
|
|
|
|
|
@@ -8,7 +8,7 @@ import ( |
|
|
|
"math/big" |
|
|
|
"testing" |
|
|
|
|
|
|
|
"github.com/henrydcase/nobs/dh/sidh/internal/common" |
|
|
|
"github.com/henrydcase/nobs/dh/sidh/common" |
|
|
|
) |
|
|
|
|
|
|
|
/* ------------------------------------------------------------------------- |
|
|
|
|
|
@@ -5,7 +5,7 @@ import ( |
|
|
|
"errors" |
|
|
|
"io" |
|
|
|
|
|
|
|
"github.com/henrydcase/nobs/dh/sidh/internal/common" |
|
|
|
"github.com/henrydcase/nobs/dh/sidh/common" |
|
|
|
"github.com/henrydcase/nobs/hash/sha3" |
|
|
|
) |
|
|
|
|
|
|
|
|
|
@@ -12,7 +12,7 @@ import ( |
|
|
|
"strings" |
|
|
|
"testing" |
|
|
|
|
|
|
|
"github.com/henrydcase/nobs/dh/sidh/internal/common" |
|
|
|
"github.com/henrydcase/nobs/dh/sidh/common" |
|
|
|
) |
|
|
|
|
|
|
|
type sikeVec struct { |
|
|
|
|
|
@@ -1,13 +0,0 @@ |
|
|
|
package mkem |
|
|
|
|
|
|
|
func PK_enc() { |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
func PK_dec() { |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
func KEM_mEnc() { |
|
|
|
|
|
|
|
} |