API changes for cSIDH

This commit is contained in:
Henry Case 2019-11-22 18:05:18 +00:00
parent 3369703ace
commit 555ec1300d

View File

@ -16,19 +16,19 @@ func TestSS() {
var r wrapper.Ref var r wrapper.Ref
var ssRef [csidh.SharedSecretSize]byte var ssRef [csidh.SharedSecretSize]byte
var ss [csidh.SharedSecretSize]byte var ss [csidh.SharedSecretSize]byte
var prB csidh.PrivateKey
var pkB csidh.PublicKey
// Go types // Go types
prA := r.KeygenPrv() prA := r.KeygenPrv()
pkA := r.KeygenPub(&prA) pkA := r.KeygenPub(&prA)
prB := csidh.NewPrivateKey()
pkB := csidh.NewPublicKey()
prB.Generate(rng) csidh.GeneratePrivateKey(&prB, rng)
pkB.Generate(&prB) csidh.GeneratePublicKey(&pkB, &prB, rng)
s1 := time.Now() s1 := time.Now()
// Generate with Go // Generate with Go
pkB.DeriveSecret(ss[:], &pkA, &prB) csidh.DeriveSecret(ss[:], &pkA, &prB, rng)
s2 := time.Since(s1) s2 := time.Since(s1)
// Generate with C // Generate with C
@ -48,15 +48,15 @@ func TestKeyGeneration() {
var ss [csidh.SharedSecretSize]byte var ss [csidh.SharedSecretSize]byte
// Go types // Go types
prA := csidh.NewPrivateKey() var prA csidh.PrivateKey
pkA := csidh.NewPublicKey() var pkA csidh.PublicKey
prB := csidh.NewPrivateKey() var prB csidh.PrivateKey
pkB := csidh.NewPublicKey() var pkB csidh.PublicKey
prA.Generate(rng) csidh.GeneratePrivateKey(&prA, rng)
pkA.Generate(&prA) csidh.GeneratePublicKey(&pkA, &prA, rng)
prB.Generate(rng) csidh.GeneratePrivateKey(&prB, rng)
pkB.Generate(&prB) csidh.GeneratePublicKey(&pkB, &prB, rng)
s1 := time.Now() s1 := time.Now()
// Generate with Go // Generate with Go