Skip to content

Commit

Permalink
Removing deprecated use of elliptic in P384.
Browse files Browse the repository at this point in the history
  • Loading branch information
armfazh committed Jan 22, 2025
1 parent 342ad81 commit 0a61b66
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions ecc/p384/point_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,30 @@
package p384

import (
"crypto/ecdh"
"crypto/elliptic"
"crypto/rand"
"encoding/binary"
"slices"
"testing"

"github.com/cloudflare/circl/internal/test"
)

func randomAffine() *affinePoint {
params := elliptic.P384().Params()
k, _ := rand.Int(rand.Reader, params.N)
return newAffinePoint(params.ScalarBaseMult(k.Bytes()))
sk, err := ecdh.P384().GenerateKey(rand.Reader)
if err != nil {
panic(err)
}

b := sk.PublicKey().Bytes()
x, y := b[1:1+sizeFp], b[1+sizeFp:1+2*sizeFp]
slices.Reverse(x)
slices.Reverse(y)
p := new(affinePoint)
montEncode(&p.x, (*fp384)(x))
montEncode(&p.y, (*fp384)(y))
return p
}

func randomJacobian() *jacobianPoint {
Expand Down

0 comments on commit 0a61b66

Please sign in to comment.