Remove TestKeyImport as that's not needed

This commit is contained in:
Henry Case 2019-04-10 00:26:12 +01:00
parent f143e36c59
commit 2761895f46

View File

@ -2,12 +2,12 @@ package main
import ( import (
"bytes" "bytes"
"crypto/rand"
"fmt" "fmt"
"time" "time"
"crypto/rand"
"github.com/henrydcase/sidh_torture/csidh/ref/go-wrapper"
"github.com/henrydcase/nobs/dh/csidh" "github.com/henrydcase/nobs/dh/csidh"
"github.com/henrydcase/sidh_torture/csidh/ref/go-wrapper"
) )
func TestSS() { func TestSS() {
@ -40,33 +40,6 @@ func TestSS() {
} }
} }
func TestKeyImport() {
var r wrapper.Ref
var ssRef [csidh.SharedSecretSize]byte
var ss [csidh.SharedSecretSize]byte
// Go types
prA := r.KeygenPrv()
pkA := r.KeygenPub(&prA)
prB := r.KeygenPrv()
pkB := r.KeygenPub(&prB)
s1 := time.Now()
// Generate with Go
pkB.DeriveSecret(ss[:], &pkA, &prB)
s2 := time.Since(s1)
// Generate with C
s1 = time.Now()
r.Derive(ssRef[:], &pkB, &prA)
s3 := time.Since(s1)
fmt.Printf("|TestKeyImport | %.8s | %.8s |\n", s2, s3)
if !bytes.Equal(ss[:], ssRef[:]) {
panic("TestKeyImport")
}
}
func TestKeyGeneration() { func TestKeyGeneration() {
var r wrapper.Ref var r wrapper.Ref
var ssRef [csidh.SharedSecretSize]byte var ssRef [csidh.SharedSecretSize]byte
@ -78,7 +51,6 @@ func TestKeyGeneration() {
prB := csidh.NewPrivateKey() prB := csidh.NewPrivateKey()
pkB := csidh.NewPublicKey() pkB := csidh.NewPublicKey()
prA.Generate(rand.Reader) prA.Generate(rand.Reader)
pkA.Generate(&prA) pkA.Generate(&prA)
prB.Generate(rand.Reader) prB.Generate(rand.Reader)
@ -108,7 +80,6 @@ func main() {
// for i:=0; i<100; i++ { // for i:=0; i<100; i++ {
for { for {
TestSS() TestSS()
TestKeyImport()
TestKeyGeneration() TestKeyGeneration()
} }
} }