aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/pubkey/curve25519/curve25519.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/pubkey/curve25519/curve25519.cpp')
-rw-r--r--src/lib/pubkey/curve25519/curve25519.cpp14
1 files changed, 6 insertions, 8 deletions
diff --git a/src/lib/pubkey/curve25519/curve25519.cpp b/src/lib/pubkey/curve25519/curve25519.cpp
index 6cd5b0cb8..7776c6550 100644
--- a/src/lib/pubkey/curve25519/curve25519.cpp
+++ b/src/lib/pubkey/curve25519/curve25519.cpp
@@ -64,16 +64,14 @@ std::vector<uint8_t> Curve25519_PublicKey::public_key_bits() const
Curve25519_PrivateKey::Curve25519_PrivateKey(const secure_vector<uint8_t>& secret_key)
{
- if(secret_key.size() == 32)
- {
- m_public.resize(32);
- m_private = secret_key;
- curve25519_basepoint(m_public.data(), m_private.data());
- }
- else
+ if(secret_key.size() != 32)
throw Decoding_Error("Invalid size for Curve25519 private key");
+
+ m_public.resize(32);
+ m_private = secret_key;
+ curve25519_basepoint(m_public.data(), m_private.data());
}
-
+
Curve25519_PrivateKey::Curve25519_PrivateKey(RandomNumberGenerator& rng)
{
m_private = rng.random_vec(32);