refactor: use X25519 instead of ScalarBaseMult (#533)
As suggested in https://pkg.go.dev/golang.org/x/crypto/curve25519#ScalarBaseMult, use X25519 instead of ScalarBaseMult. When using Basepoint, it may employ some precomputed values, enhancing performance. Co-authored-by: Wade Simmons <wade@wades.im> Co-authored-by: Wade Simmons <wadey@slack-corp.com>
This commit is contained in:
@ -226,12 +226,17 @@ func signCert(args []string, out io.Writer, errOut io.Writer) error {
|
||||
}
|
||||
|
||||
func x25519Keypair() ([]byte, []byte) {
|
||||
var pubkey, privkey [32]byte
|
||||
if _, err := io.ReadFull(rand.Reader, privkey[:]); err != nil {
|
||||
privkey := make([]byte, 32)
|
||||
if _, err := io.ReadFull(rand.Reader, privkey); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
curve25519.ScalarBaseMult(&pubkey, &privkey)
|
||||
return pubkey[:], privkey[:]
|
||||
|
||||
pubkey, err := curve25519.X25519(privkey, curve25519.Basepoint)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
return pubkey, privkey
|
||||
}
|
||||
|
||||
func signSummary() string {
|
||||
|
Reference in New Issue
Block a user