mirror of
https://github.com/henrydcase/nobs.git
synced 2024-11-26 00:51:22 +00:00
sike: move common (#33)
* makes common reusable * exports some more symbols from common * remove kem for a moment
This commit is contained in:
parent
55957bbf5e
commit
a152c09fd5
@ -10,7 +10,7 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
"testing/quick"
|
"testing/quick"
|
||||||
|
|
||||||
"github.com/henrydcase/nobs/dh/sidh/internal/common"
|
"github.com/henrydcase/nobs/dh/sidh/common"
|
||||||
"golang.org/x/sys/cpu"
|
"golang.org/x/sys/cpu"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
package p434
|
package p434
|
||||||
|
|
||||||
import (
|
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.
|
// If choice = 0, leave x,y unchanged. If choice = 1, set x,y = y,x.
|
||||||
|
@ -8,7 +8,7 @@ package p434
|
|||||||
import (
|
import (
|
||||||
"math/bits"
|
"math/bits"
|
||||||
|
|
||||||
"github.com/henrydcase/nobs/dh/sidh/internal/common"
|
"github.com/henrydcase/nobs/dh/sidh/common"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Compute z = x + y (mod p).
|
// Compute z = x + y (mod p).
|
||||||
|
@ -6,7 +6,7 @@ package p434
|
|||||||
import (
|
import (
|
||||||
"testing"
|
"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
|
// Package-level storage for this field element is intended to deter
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
package p434
|
package p434
|
||||||
|
|
||||||
import (
|
import (
|
||||||
. "github.com/henrydcase/nobs/dh/sidh/internal/common"
|
. "github.com/henrydcase/nobs/dh/sidh/common"
|
||||||
)
|
)
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
package p434
|
package p434
|
||||||
|
|
||||||
import (
|
import (
|
||||||
. "github.com/henrydcase/nobs/dh/sidh/internal/common"
|
. "github.com/henrydcase/nobs/dh/sidh/common"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Stores isogeny 3 curve constants
|
// Stores isogeny 3 curve constants
|
||||||
|
@ -7,7 +7,7 @@ import (
|
|||||||
"bytes"
|
"bytes"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
. "github.com/henrydcase/nobs/dh/sidh/internal/common"
|
. "github.com/henrydcase/nobs/dh/sidh/common"
|
||||||
)
|
)
|
||||||
|
|
||||||
func vartimeEqProjFp2(lhs, rhs *ProjectivePoint) bool {
|
func vartimeEqProjFp2(lhs, rhs *ProjectivePoint) bool {
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
package p434
|
package p434
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/henrydcase/nobs/dh/sidh/internal/common"
|
"github.com/henrydcase/nobs/dh/sidh/common"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Montgomery multiplication. Input values must be already
|
// Montgomery multiplication. Input values must be already
|
||||||
|
@ -9,7 +9,7 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
"testing/quick"
|
"testing/quick"
|
||||||
|
|
||||||
"github.com/henrydcase/nobs/dh/sidh/internal/common"
|
"github.com/henrydcase/nobs/dh/sidh/common"
|
||||||
)
|
)
|
||||||
|
|
||||||
type testParams struct {
|
type testParams struct {
|
||||||
|
@ -3,7 +3,7 @@ package p434
|
|||||||
//go:generate go run ../templates/gen.go P434
|
//go:generate go run ../templates/gen.go P434
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/henrydcase/nobs/dh/sidh/internal/common"
|
"github.com/henrydcase/nobs/dh/sidh/common"
|
||||||
"golang.org/x/sys/cpu"
|
"golang.org/x/sys/cpu"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@ package p434
|
|||||||
import (
|
import (
|
||||||
"testing/quick"
|
"testing/quick"
|
||||||
|
|
||||||
. "github.com/henrydcase/nobs/dh/sidh/internal/common"
|
. "github.com/henrydcase/nobs/dh/sidh/common"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Values omputed using Sage
|
// Values omputed using Sage
|
||||||
|
@ -10,7 +10,7 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
"testing/quick"
|
"testing/quick"
|
||||||
|
|
||||||
"github.com/henrydcase/nobs/dh/sidh/internal/common"
|
"github.com/henrydcase/nobs/dh/sidh/common"
|
||||||
"golang.org/x/sys/cpu"
|
"golang.org/x/sys/cpu"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
package p503
|
package p503
|
||||||
|
|
||||||
import (
|
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.
|
// If choice = 0, leave x,y unchanged. If choice = 1, set x,y = y,x.
|
||||||
|
@ -8,7 +8,7 @@ package p503
|
|||||||
import (
|
import (
|
||||||
"math/bits"
|
"math/bits"
|
||||||
|
|
||||||
"github.com/henrydcase/nobs/dh/sidh/internal/common"
|
"github.com/henrydcase/nobs/dh/sidh/common"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Compute z = x + y (mod p).
|
// Compute z = x + y (mod p).
|
||||||
|
@ -6,7 +6,7 @@ package p503
|
|||||||
import (
|
import (
|
||||||
"testing"
|
"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
|
// Package-level storage for this field element is intended to deter
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
package p503
|
package p503
|
||||||
|
|
||||||
import (
|
import (
|
||||||
. "github.com/henrydcase/nobs/dh/sidh/internal/common"
|
. "github.com/henrydcase/nobs/dh/sidh/common"
|
||||||
)
|
)
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
package p503
|
package p503
|
||||||
|
|
||||||
import (
|
import (
|
||||||
. "github.com/henrydcase/nobs/dh/sidh/internal/common"
|
. "github.com/henrydcase/nobs/dh/sidh/common"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Stores isogeny 3 curve constants
|
// Stores isogeny 3 curve constants
|
||||||
|
@ -7,7 +7,7 @@ import (
|
|||||||
"bytes"
|
"bytes"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
. "github.com/henrydcase/nobs/dh/sidh/internal/common"
|
. "github.com/henrydcase/nobs/dh/sidh/common"
|
||||||
)
|
)
|
||||||
|
|
||||||
func vartimeEqProjFp2(lhs, rhs *ProjectivePoint) bool {
|
func vartimeEqProjFp2(lhs, rhs *ProjectivePoint) bool {
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
package p503
|
package p503
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/henrydcase/nobs/dh/sidh/internal/common"
|
"github.com/henrydcase/nobs/dh/sidh/common"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Montgomery multiplication. Input values must be already
|
// Montgomery multiplication. Input values must be already
|
||||||
|
@ -9,7 +9,7 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
"testing/quick"
|
"testing/quick"
|
||||||
|
|
||||||
"github.com/henrydcase/nobs/dh/sidh/internal/common"
|
"github.com/henrydcase/nobs/dh/sidh/common"
|
||||||
)
|
)
|
||||||
|
|
||||||
type testParams struct {
|
type testParams struct {
|
||||||
|
@ -3,7 +3,7 @@ package p503
|
|||||||
//go:generate go run ../templates/gen.go P503
|
//go:generate go run ../templates/gen.go P503
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/henrydcase/nobs/dh/sidh/internal/common"
|
"github.com/henrydcase/nobs/dh/sidh/common"
|
||||||
"golang.org/x/sys/cpu"
|
"golang.org/x/sys/cpu"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@ package p503
|
|||||||
import (
|
import (
|
||||||
"testing/quick"
|
"testing/quick"
|
||||||
|
|
||||||
. "github.com/henrydcase/nobs/dh/sidh/internal/common"
|
. "github.com/henrydcase/nobs/dh/sidh/common"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Values omputed using Sage
|
// Values omputed using Sage
|
||||||
|
@ -10,7 +10,7 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
"testing/quick"
|
"testing/quick"
|
||||||
|
|
||||||
"github.com/henrydcase/nobs/dh/sidh/internal/common"
|
"github.com/henrydcase/nobs/dh/sidh/common"
|
||||||
"golang.org/x/sys/cpu"
|
"golang.org/x/sys/cpu"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
package p751
|
package p751
|
||||||
|
|
||||||
import (
|
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.
|
// If choice = 0, leave x,y unchanged. If choice = 1, set x,y = y,x.
|
||||||
|
@ -8,7 +8,7 @@ package p751
|
|||||||
import (
|
import (
|
||||||
"math/bits"
|
"math/bits"
|
||||||
|
|
||||||
"github.com/henrydcase/nobs/dh/sidh/internal/common"
|
"github.com/henrydcase/nobs/dh/sidh/common"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Compute z = x + y (mod p).
|
// Compute z = x + y (mod p).
|
||||||
|
@ -6,7 +6,7 @@ package p751
|
|||||||
import (
|
import (
|
||||||
"testing"
|
"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
|
// Package-level storage for this field element is intended to deter
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
package p751
|
package p751
|
||||||
|
|
||||||
import (
|
import (
|
||||||
. "github.com/henrydcase/nobs/dh/sidh/internal/common"
|
. "github.com/henrydcase/nobs/dh/sidh/common"
|
||||||
)
|
)
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
package p751
|
package p751
|
||||||
|
|
||||||
import (
|
import (
|
||||||
. "github.com/henrydcase/nobs/dh/sidh/internal/common"
|
. "github.com/henrydcase/nobs/dh/sidh/common"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Stores isogeny 3 curve constants
|
// Stores isogeny 3 curve constants
|
||||||
|
@ -7,7 +7,7 @@ import (
|
|||||||
"bytes"
|
"bytes"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
. "github.com/henrydcase/nobs/dh/sidh/internal/common"
|
. "github.com/henrydcase/nobs/dh/sidh/common"
|
||||||
)
|
)
|
||||||
|
|
||||||
func vartimeEqProjFp2(lhs, rhs *ProjectivePoint) bool {
|
func vartimeEqProjFp2(lhs, rhs *ProjectivePoint) bool {
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
package p751
|
package p751
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/henrydcase/nobs/dh/sidh/internal/common"
|
"github.com/henrydcase/nobs/dh/sidh/common"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Montgomery multiplication. Input values must be already
|
// Montgomery multiplication. Input values must be already
|
||||||
|
@ -9,7 +9,7 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
"testing/quick"
|
"testing/quick"
|
||||||
|
|
||||||
"github.com/henrydcase/nobs/dh/sidh/internal/common"
|
"github.com/henrydcase/nobs/dh/sidh/common"
|
||||||
)
|
)
|
||||||
|
|
||||||
type testParams struct {
|
type testParams struct {
|
||||||
|
@ -3,7 +3,7 @@ package p751
|
|||||||
//go:generate go run ../templates/gen.go P751
|
//go:generate go run ../templates/gen.go P751
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/henrydcase/nobs/dh/sidh/internal/common"
|
"github.com/henrydcase/nobs/dh/sidh/common"
|
||||||
"golang.org/x/sys/cpu"
|
"golang.org/x/sys/cpu"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@ package p751
|
|||||||
import (
|
import (
|
||||||
"testing/quick"
|
"testing/quick"
|
||||||
|
|
||||||
. "github.com/henrydcase/nobs/dh/sidh/internal/common"
|
. "github.com/henrydcase/nobs/dh/sidh/common"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
package {{ .PACKAGE}}
|
package {{ .PACKAGE}}
|
||||||
|
|
||||||
import (
|
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.
|
// If choice = 0, leave x,y unchanged. If choice = 1, set x,y = y,x.
|
||||||
|
@ -8,7 +8,7 @@ package {{ .PACKAGE}}
|
|||||||
import (
|
import (
|
||||||
"math/bits"
|
"math/bits"
|
||||||
|
|
||||||
"github.com/henrydcase/nobs/dh/sidh/internal/common"
|
"github.com/henrydcase/nobs/dh/sidh/common"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Compute z = x + y (mod p).
|
// Compute z = x + y (mod p).
|
||||||
|
@ -6,7 +6,7 @@ package {{ .PACKAGE}}
|
|||||||
import (
|
import (
|
||||||
"testing"
|
"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
|
// Package-level storage for this field element is intended to deter
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
package {{ .PACKAGE}}
|
package {{ .PACKAGE}}
|
||||||
|
|
||||||
import (
|
import (
|
||||||
. "github.com/henrydcase/nobs/dh/sidh/internal/common"
|
. "github.com/henrydcase/nobs/dh/sidh/common"
|
||||||
)
|
)
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
package {{ .PACKAGE}}
|
package {{ .PACKAGE}}
|
||||||
|
|
||||||
import (
|
import (
|
||||||
. "github.com/henrydcase/nobs/dh/sidh/internal/common"
|
. "github.com/henrydcase/nobs/dh/sidh/common"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Stores isogeny 3 curve constants
|
// Stores isogeny 3 curve constants
|
||||||
|
@ -7,7 +7,7 @@ import (
|
|||||||
"bytes"
|
"bytes"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
. "github.com/henrydcase/nobs/dh/sidh/internal/common"
|
. "github.com/henrydcase/nobs/dh/sidh/common"
|
||||||
)
|
)
|
||||||
|
|
||||||
func vartimeEqProjFp2(lhs, rhs *ProjectivePoint) bool {
|
func vartimeEqProjFp2(lhs, rhs *ProjectivePoint) bool {
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
package {{ .PACKAGE}}
|
package {{ .PACKAGE}}
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/henrydcase/nobs/dh/sidh/internal/common"
|
"github.com/henrydcase/nobs/dh/sidh/common"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Montgomery multiplication. Input values must be already
|
// Montgomery multiplication. Input values must be already
|
||||||
|
@ -9,7 +9,7 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
"testing/quick"
|
"testing/quick"
|
||||||
|
|
||||||
"github.com/henrydcase/nobs/dh/sidh/internal/common"
|
"github.com/henrydcase/nobs/dh/sidh/common"
|
||||||
)
|
)
|
||||||
|
|
||||||
type testParams struct {
|
type testParams struct {
|
||||||
|
@ -4,7 +4,7 @@ import (
|
|||||||
"errors"
|
"errors"
|
||||||
"io"
|
"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/p434"
|
||||||
"github.com/henrydcase/nobs/dh/sidh/internal/p503"
|
"github.com/henrydcase/nobs/dh/sidh/internal/p503"
|
||||||
"github.com/henrydcase/nobs/dh/sidh/internal/p751"
|
"github.com/henrydcase/nobs/dh/sidh/internal/p751"
|
||||||
|
@ -8,7 +8,7 @@ import (
|
|||||||
"math/big"
|
"math/big"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/henrydcase/nobs/dh/sidh/internal/common"
|
"github.com/henrydcase/nobs/dh/sidh/common"
|
||||||
)
|
)
|
||||||
|
|
||||||
/* -------------------------------------------------------------------------
|
/* -------------------------------------------------------------------------
|
||||||
|
@ -5,7 +5,7 @@ import (
|
|||||||
"errors"
|
"errors"
|
||||||
"io"
|
"io"
|
||||||
|
|
||||||
"github.com/henrydcase/nobs/dh/sidh/internal/common"
|
"github.com/henrydcase/nobs/dh/sidh/common"
|
||||||
"github.com/henrydcase/nobs/hash/sha3"
|
"github.com/henrydcase/nobs/hash/sha3"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -12,7 +12,7 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/henrydcase/nobs/dh/sidh/internal/common"
|
"github.com/henrydcase/nobs/dh/sidh/common"
|
||||||
)
|
)
|
||||||
|
|
||||||
type sikeVec struct {
|
type sikeVec struct {
|
||||||
|
@ -1,13 +0,0 @@
|
|||||||
package mkem
|
|
||||||
|
|
||||||
func PK_enc() {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
func PK_dec() {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
func KEM_mEnc() {
|
|
||||||
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user