From 6fb412e2af4a3317faaa42af3a64d503280c5489 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Olivier=20Ch=C3=A9ron?= Date: Sat, 6 May 2017 08:44:55 +0200 Subject: [PATCH] Use decaf_x448_derive_public_key --- Crypto/PubKey/Curve448.hs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Crypto/PubKey/Curve448.hs b/Crypto/PubKey/Curve448.hs index 1101a0f..68e1256 100644 --- a/Crypto/PubKey/Curve448.hs +++ b/Crypto/PubKey/Curve448.hs @@ -93,9 +93,7 @@ toPublic :: SecretKey -> PublicKey toPublic (SecretKey sec) = PublicKey <$> B.allocAndFreeze x448_bytes $ \result -> withByteArray sec $ \psec -> - decaf_x448 result basePoint psec - where - basePoint = Ptr "\x05\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"# + decaf_x448_derive_public_key result psec {-# NOINLINE toPublic #-} -- | Generate a secret key. @@ -110,3 +108,8 @@ foreign import ccall "cryptonite_decaf_x448" -> Ptr Word8 -- ^ basepoint -> Ptr Word8 -- ^ secret -> IO () + +foreign import ccall "cryptonite_decaf_x448_derive_public_key" + decaf_x448_derive_public_key :: Ptr Word8 -- ^ public + -> Ptr Word8 -- ^ secret + -> IO ()