diff --git a/crypto.go b/crypto.go index 2cb886f..c33bbca 100644 --- a/crypto.go +++ b/crypto.go @@ -18,8 +18,8 @@ import ( _ "crypto/sha256" _ "crypto/sha512" - "git.schwanenlied.me/yawning/x448.git" "github.com/cloudflare/circl/dh/sidh" + "github.com/cloudflare/circl/dh/x448" "golang.org/x/crypto/chacha20poly1305" "golang.org/x/crypto/curve25519" ) @@ -464,17 +464,17 @@ func (s x25519Scheme) PrivateKeySize() int { // ECDH with X448 type x448PrivateKey struct { - val [56]byte + val x448.Key } func (priv x448PrivateKey) PublicKey() KEMPublicKey { pub := &x448PublicKey{} - x448.ScalarBaseMult(&pub.val, &priv.val) + x448.KeyGen(&pub.val, &priv.val) return pub } type x448PublicKey struct { - val [56]byte + val x448.Key } type x448Scheme struct { @@ -552,8 +552,8 @@ func (s x448Scheme) DH(priv KEMPrivateKey, pub KEMPublicKey) ([]byte, error) { return nil, fmt.Errorf("Public key not suitable for X448: %+v", pub) } - var sharedSecret, zero [56]byte - x448.ScalarMult(&sharedSecret, &xPriv.val, &xPub.val) + var sharedSecret, zero x448.Key + x448.Shared(&sharedSecret, &xPriv.val, &xPub.val) if subtle.ConstantTimeCompare(sharedSecret[:], zero[:]) == 1 { return nil, fmt.Errorf("bad input point: low order point") } diff --git a/go.mod b/go.mod index 6879bd5..77315f9 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,6 @@ module github.com/cisco/go-hpke go 1.14 require ( - git.schwanenlied.me/yawning/x448.git v0.0.0-20170617130356-01b048fb03d6 github.com/cisco/go-tls-syntax v0.0.0-20200617162716-46b0cfb76b9b github.com/cloudflare/circl v1.0.0 github.com/stretchr/testify v1.6.1 diff --git a/go.sum b/go.sum index 6a1b6e4..5ed3863 100644 --- a/go.sum +++ b/go.sum @@ -1,5 +1,3 @@ -git.schwanenlied.me/yawning/x448.git v0.0.0-20170617130356-01b048fb03d6 h1:w8IZgCntCe0RuBJp+dENSMwEBl/k8saTgJ5hPca5IWw= -git.schwanenlied.me/yawning/x448.git v0.0.0-20170617130356-01b048fb03d6/go.mod h1:wQaGCqEu44ykB17jZHCevrgSVl3KJnwQBObUtrKU4uU= github.com/cisco/go-tls-syntax v0.0.0-20200617162716-46b0cfb76b9b h1:Ves2turKTX7zruivAcUOQg155xggcbv3suVdbKCBQNM= github.com/cisco/go-tls-syntax v0.0.0-20200617162716-46b0cfb76b9b/go.mod h1:0AZAV7lYvynZQ5ErHlGMKH+4QYMyNCFd+AiL9MlrCYA= github.com/cloudflare/circl v1.0.0 h1:64b6pyfCFbYm623ncIkYGNZaOcmIbyd+CjyMi2L9vdI=