Add the X448() and X448_public_from_private() functions
authorMatt Caswell <matt@openssl.org>
Thu, 16 Nov 2017 11:13:53 +0000 (11:13 +0000)
committerMatt Caswell <matt@openssl.org>
Tue, 20 Feb 2018 12:59:29 +0000 (12:59 +0000)
Reviewed-by: Bernd Edlinger <bernd.edlinger@hotmail.de>
(Merged from https://github.com/openssl/openssl/pull/5105)

crypto/ec/curve448/curve448_lcl.h [new file with mode: 0644]
crypto/ec/curve448/decaf.c

diff --git a/crypto/ec/curve448/curve448_lcl.h b/crypto/ec/curve448/curve448_lcl.h
new file mode 100644 (file)
index 0000000..1761659
--- /dev/null
@@ -0,0 +1,7 @@
+#include "curve448utils.h"
+
+int X448(uint8_t out_shared_key[56], const uint8_t private_key[56],
+         const uint8_t peer_public_value[56]) DECAF_API_VIS;
+
+void X448_public_from_private(uint8_t out_public_value[56],
+                              const uint8_t private_key[56]) DECAF_API_VIS;
index b7bf156089976d73480ae2c637b82a3e7595bd9b..d4a093a25b4c1b7444228fb3eb5037a7174b14e3 100644 (file)
@@ -18,6 +18,7 @@
 
 #include "point_448.h"
 #include "ed448.h"
+#include "curve448_lcl.h"
 
 /* Template stuff */
 #define API_NS(_id) decaf_448_##_id
@@ -1590,3 +1591,16 @@ void API_NS(precomputed_destroy) (
 ) {
     OPENSSL_cleanse(pre, API_NS(sizeof_precomputed_s));
 }
+
+int X448(uint8_t out_shared_key[56], const uint8_t private_key[56],
+         const uint8_t peer_public_value[56])
+{
+  return decaf_x448(out_shared_key, peer_public_value, private_key)
+         == DECAF_SUCCESS;
+}
+
+void X448_public_from_private(uint8_t out_public_value[56],
+                              const uint8_t private_key[56])
+{
+    decaf_x448_derive_public_key(out_public_value, private_key);
+}