aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/pubkey
diff options
context:
space:
mode:
authorJack Lloyd <[email protected]>2017-08-29 18:16:44 -0400
committerJack Lloyd <[email protected]>2017-08-29 18:16:44 -0400
commit17ef09021892afc4c0e9fe7ba97423bf832e6dc5 (patch)
treeb364838fde2dc1efedb91feb309a0a77fd4428d1 /src/lib/pubkey
parent6deac88ea6ef221474bcb63722bd7a8bd283ca67 (diff)
Slight cleanup in Curve25519_PrivateKey constructor
Diffstat (limited to 'src/lib/pubkey')
-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);