aboutsummaryrefslogtreecommitdiff
path: root/src/crypto.cpp
diff options
context:
space:
mode:
authorMark Haines <mjark@negativecurvature.net>2015-02-26 16:30:19 +0000
committerMark Haines <mjark@negativecurvature.net>2015-02-26 16:30:19 +0000
commit09d8e84c7cbbf21195f3fd2eabbcff44042d5a4e (patch)
tree73a1f072bf86175c266579089fecb21e83d1d22c /src/crypto.cpp
parent186df91246cc61febb398383e4e742973fc9aaf0 (diff)
Implement the axlotl ratchet
Diffstat (limited to 'src/crypto.cpp')
-rw-r--r--src/crypto.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/crypto.cpp b/src/crypto.cpp
index e93a1e9..2397d7c 100644
--- a/src/crypto.cpp
+++ b/src/crypto.cpp
@@ -23,6 +23,7 @@ static const std::size_t SHA256_HASH_LENGTH = 32;
static const std::size_t SHA256_BLOCK_LENGTH = 64;
static const std::uint8_t HKDF_DEFAULT_SALT[32] = {};
+
template<std::size_t block_size>
inline static void xor_block(
std::uint8_t * block,
@@ -86,15 +87,14 @@ inline void hmac_sha256_final(
} // namespace
-axolotl::Curve25519KeyPair axolotl::generate_key(
- std::uint8_t const * random_32_bytes
+void axolotl::generate_key(
+ std::uint8_t const * random_32_bytes,
+ axolotl::Curve25519KeyPair & key_pair
) {
- axolotl::Curve25519KeyPair key_pair;
std::memcpy(key_pair.private_key, random_32_bytes, 32);
::curve25519_donna(
key_pair.public_key, key_pair.private_key, CURVE25519_BASEPOINT
);
- return key_pair;
}