Skip to content

Commit

Permalink
Cleanup the x448 wrapper
Browse files Browse the repository at this point in the history
  • Loading branch information
david415 committed Apr 19, 2024
1 parent 453cec7 commit 432da10
Showing 1 changed file with 4 additions and 13 deletions.
17 changes: 4 additions & 13 deletions nike/x448/x448.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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()

Expand Down

0 comments on commit 432da10

Please sign in to comment.