From 432da102a14fe9ff22e37344e3c5dd483ea49e16 Mon Sep 17 00:00:00 2001 From: David Stainton Date: Thu, 18 Apr 2024 21:41:23 -0700 Subject: [PATCH] Cleanup the x448 wrapper --- nike/x448/x448.go | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/nike/x448/x448.go b/nike/x448/x448.go index 2275d14..6a1cf71 100644 --- a/nike/x448/x448.go +++ b/nike/x448/x448.go @@ -155,12 +155,8 @@ func NewKeypair(rng io.Reader) (nike.PrivateKey, error) { if count != x448.Size { return nil, errors.New("read wrong number of bytes from rng") } - keybytes := [x448.Size]byte{} - key := x448.Key(keybytes) - pubkey := &key - + pubkey := new(x448.Key) x448.KeyGen(pubkey, privkey) - mypubkey := &PublicKey{ pubBytes: pubkey, } @@ -189,14 +185,11 @@ func (p *PrivateKey) FromBytes(data []byte) error { return errInvalidKey } - keybytes := [x448.Size]byte{} - key := x448.Key(keybytes) - p.privBytes = &key + p.privBytes = new(x448.Key) copy(p.privBytes[:], data) - pubkey := x448.Key([x448.Size]byte{}) p.pubKey = &PublicKey{ - pubBytes: &pubkey, + pubBytes: new(x448.Key), } expG(p.pubKey.pubBytes, p.privBytes) p.pubKey.rebuildB64String() @@ -257,9 +250,7 @@ func (p *PublicKey) FromBytes(data []byte) error { return errInvalidKey } - keybytes := [x448.Size]byte{} - key := x448.Key(keybytes) - p.pubBytes = &key + p.pubBytes = new(x448.Key) copy(p.pubBytes[:], data) p.rebuildB64String()