aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/pubkey/pk_algs.cpp
diff options
context:
space:
mode:
authorlloyd <[email protected]>2014-12-27 17:50:57 +0000
committerlloyd <[email protected]>2014-12-27 17:50:57 +0000
commitd0daf875978848c3edf65c7b3683a21605f72e64 (patch)
tree46690afadfb5e9acb766468f7f7481bb1244049d /src/lib/pubkey/pk_algs.cpp
parent675c2e324268ebce7e2c665389ebd57d38083200 (diff)
Add Curve25519 based on curve25519-donna by Adam Langley.
This uses only the c64 version from curve25519-donna; on systems that don't have a native uint128_t type, a donna128 type stands in for just enough 128-bit operations to satisfy donna.cpp
Diffstat (limited to 'src/lib/pubkey/pk_algs.cpp')
-rw-r--r--src/lib/pubkey/pk_algs.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/lib/pubkey/pk_algs.cpp b/src/lib/pubkey/pk_algs.cpp
index 9673199e0..e1784dd9f 100644
--- a/src/lib/pubkey/pk_algs.cpp
+++ b/src/lib/pubkey/pk_algs.cpp
@@ -44,6 +44,10 @@
#include <botan/ecdh.h>
#endif
+#if defined(BOTAN_HAS_CURVE_25519)
+ #include <botan/curve25519.h>
+#endif
+
namespace Botan {
Public_Key* make_public_key(const AlgorithmIdentifier& alg_id,
@@ -98,6 +102,11 @@ Public_Key* make_public_key(const AlgorithmIdentifier& alg_id,
return new ECDH_PublicKey(alg_id, key_bits);
#endif
+#if defined(BOTAN_HAS_CURVE_25519)
+ if(alg_name == "Curve25519")
+ return new Curve25519_PublicKey(alg_id, key_bits);
+#endif
+
return nullptr;
}
@@ -154,6 +163,11 @@ Private_Key* make_private_key(const AlgorithmIdentifier& alg_id,
return new ECDH_PrivateKey(alg_id, key_bits);
#endif
+#if defined(BOTAN_HAS_CURVE_25519)
+ if(alg_name == "Curve25519")
+ return new Curve25519_PrivateKey(alg_id, key_bits, rng);
+#endif
+
return nullptr;
}