From 193f645f65ad4ffdec3186e4176b23af10861199 Mon Sep 17 00:00:00 2001 From: Gluzskiy Alexandr Date: Mon, 13 Feb 2017 07:56:33 +0300 Subject: libs: libaxolotl: updated libaxolotl (libsignal-c) from (https://github.com/WhisperSystems/libsignal-protocol-c) --- .../src/curve25519/ed25519/additions/keygen.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 libs/libaxolotl/src/curve25519/ed25519/additions/keygen.c (limited to 'libs/libaxolotl/src/curve25519/ed25519/additions/keygen.c') diff --git a/libs/libaxolotl/src/curve25519/ed25519/additions/keygen.c b/libs/libaxolotl/src/curve25519/ed25519/additions/keygen.c new file mode 100644 index 0000000000..de7cdcd598 --- /dev/null +++ b/libs/libaxolotl/src/curve25519/ed25519/additions/keygen.c @@ -0,0 +1,21 @@ +#include "ge.h" +#include "keygen.h" +#include "crypto_additions.h" + +void curve25519_keygen(unsigned char* curve25519_pubkey_out, + const unsigned char* curve25519_privkey_in) +{ + /* Perform a fixed-base multiplication of the Edwards base point, + (which is efficient due to precalculated tables), then convert + to the Curve25519 montgomery-format public key. + + NOTE: y=1 is converted to u=0 since fe_invert is mod-exp + */ + + ge_p3 ed; /* Ed25519 pubkey point */ + fe u; + + ge_scalarmult_base(&ed, curve25519_privkey_in); + ge_p3_to_montx(u, &ed); + fe_tobytes(curve25519_pubkey_out, u); +} -- cgit v1.2.3