aboutsummaryrefslogtreecommitdiffstats
path: root/checks
diff options
context:
space:
mode:
authorlloyd <[email protected]>2010-03-02 03:34:51 +0000
committerlloyd <[email protected]>2010-03-02 03:34:51 +0000
commit70d72cc1a843bb5e60c5f6ab27f2f3226f1333a3 (patch)
treeba565fbf454b9d6855de2c2f991087161cab5ffe /checks
parent19e77947ee00b4db6b732ef3dabfdbb9ee2adfd6 (diff)
Rename ECKAEG to ECDH. As far as I can tell they are the same algorithm,
I'm not sure where the old name came from though as literally the only hits for it on Google are botan-related.
Diffstat (limited to 'checks')
-rw-r--r--checks/eckaeg.cpp84
-rw-r--r--checks/pk_bench.cpp22
2 files changed, 52 insertions, 54 deletions
diff --git a/checks/eckaeg.cpp b/checks/eckaeg.cpp
index d8a3f61d8..748663eb6 100644
--- a/checks/eckaeg.cpp
+++ b/checks/eckaeg.cpp
@@ -1,30 +1,28 @@
-/******************************************************
-* ECKAEG tests *
-* *
-* (C) 2007 Manuel Hartl *
-* 2008 Jack Lloyd *
-******************************************************/
+/*
+* ECDH tests
+*
+* (C) 2007 Manuel Hartl ([email protected])
+* 2008 Jack Lloyd
+*
+* Distributed under the terms of the Botan license
+*/
#include <botan/build.h>
#include "validate.h"
#include "common.h"
-#if defined(BOTAN_HAS_ECKAEG)
+#if defined(BOTAN_HAS_ECDH)
#include <iostream>
#include <fstream>
#include <botan/symkey.h>
#include <botan/dh.h>
-#include <botan/eckaeg.h>
+#include <botan/ecdh.h>
#include <botan/x509self.h>
#include <botan/der_enc.h>
-#include <botan/point_gfp.h>
-#include <botan/curve_gfp.h>
-
using namespace Botan;
#define CHECK_MESSAGE(expr, print) try { if(!(expr)) std::cout << print << "\n"; } catch(std::exception& e) { std::cout << __FUNCTION__ << ": " << e.what() << "\n"; }
@@ -64,17 +62,17 @@ void test_eckaeg_normal_derivation(RandomNumberGenerator& rng)
Botan::EC_Domain_Params dom_pars = Botan::EC_Domain_Params(curve, p_G, order, cofactor);
/**
- * begin ECKAEG
+ * begin ECDH
*/
// alices key (a key constructed by domain parameters IS an ephimeral key!)
- Botan::ECKAEG_PrivateKey private_a(rng, dom_pars);
- Botan::ECKAEG_PublicKey public_a = private_a; // Bob gets this
+ Botan::ECDH_PrivateKey private_a(rng, dom_pars);
+ Botan::ECDH_PublicKey public_a = private_a; // Bob gets this
// Bob creates a key with a matching group
- Botan::ECKAEG_PrivateKey private_b(rng, dom_pars); //public_a.getCurve()
+ Botan::ECDH_PrivateKey private_b(rng, dom_pars); //public_a.getCurve()
// Bob sends the key back to Alice
- Botan::ECKAEG_PublicKey public_b = private_b; // Alice gets this
+ Botan::ECDH_PublicKey public_b = private_b; // Alice gets this
// Both of them create a key using their private key and the other's
// public key
@@ -102,8 +100,8 @@ void test_eckaeg_some_dp(RandomNumberGenerator& rng)
Botan::OID oid(oids[i]);
Botan::EC_Domain_Params dom_pars(oid);
- Botan::ECKAEG_PrivateKey private_a(rng, dom_pars);
- Botan::ECKAEG_PublicKey public_a = private_a;
+ Botan::ECDH_PrivateKey private_a(rng, dom_pars);
+ Botan::ECDH_PublicKey public_a = private_a;
/*auto_ptr<Botan::X509_Encoder> x509_key_enc = public_a.x509_encoder();
Botan::MemoryVector<Botan::byte> enc_key_a = Botan::DER_Encoder()
.start_cons(Botan::SEQUENCE)
@@ -112,8 +110,8 @@ void test_eckaeg_some_dp(RandomNumberGenerator& rng)
.end_cons()
.get_contents();*/
- Botan::ECKAEG_PrivateKey private_b(rng, dom_pars);
- Botan::ECKAEG_PublicKey public_b = private_b;
+ Botan::ECDH_PrivateKey private_b(rng, dom_pars);
+ Botan::ECDH_PublicKey public_b = private_b;
// to test the equivalence, we
// use the direct derivation method here
@@ -140,11 +138,11 @@ void test_eckaeg_der_derivation(RandomNumberGenerator& rng)
Botan::OID oid(oids[i]);
Botan::EC_Domain_Params dom_pars(oid);
- Botan::ECKAEG_PrivateKey private_a(rng, dom_pars);
- Botan::ECKAEG_PublicKey public_a = private_a;
+ Botan::ECDH_PrivateKey private_a(rng, dom_pars);
+ Botan::ECDH_PublicKey public_a = private_a;
- Botan::ECKAEG_PrivateKey private_b(rng, dom_pars);
- Botan::ECKAEG_PublicKey public_b = private_b;
+ Botan::ECDH_PrivateKey private_b(rng, dom_pars);
+ Botan::ECDH_PublicKey public_b = private_b;
Botan::MemoryVector<Botan::byte> key_der_a = private_a.public_value();
Botan::MemoryVector<Botan::byte> key_der_b = private_b.public_value();
@@ -174,26 +172,26 @@ void test_eckaeg_cp_ctor_as_op(RandomNumberGenerator& rng)
Botan::EC_Domain_Params dom_pars = Botan::EC_Domain_Params(curve, p_G, order, cofactor);
/**
- * begin ECKAEG
+ * begin ECDH
*/
// alices key (a key constructed by domain parameters IS an ephimeral key!)
- Botan::ECKAEG_PrivateKey private_a(rng, dom_pars);
- Botan::ECKAEG_PrivateKey private_a2(private_a);
- Botan::ECKAEG_PrivateKey private_a3;
+ Botan::ECDH_PrivateKey private_a(rng, dom_pars);
+ Botan::ECDH_PrivateKey private_a2(private_a);
+ Botan::ECDH_PrivateKey private_a3;
private_a3 = private_a2;
Botan::DH_PrivateKey dh_pr_empty;
Botan::DH_PublicKey dh_pub_empty;
- Botan::ECKAEG_PublicKey public_a = private_a; // Bob gets this
- Botan::ECKAEG_PublicKey public_a2(public_a);
- Botan::ECKAEG_PublicKey public_a3;
+ Botan::ECDH_PublicKey public_a = private_a; // Bob gets this
+ Botan::ECDH_PublicKey public_a2(public_a);
+ Botan::ECDH_PublicKey public_a3;
public_a3 = public_a;
// Bob creates a key with a matching group
- Botan::ECKAEG_PrivateKey private_b(rng, dom_pars); //public_a.getCurve()
+ Botan::ECDH_PrivateKey private_b(rng, dom_pars); //public_a.getCurve()
// Bob sends the key back to Alice
- Botan::ECKAEG_PublicKey public_b = private_b; // Alice gets this
+ Botan::ECDH_PublicKey public_b = private_b; // Alice gets this
// Both of them create a key using their private key and the other's
// public key
@@ -213,7 +211,7 @@ void test_eckaeg_cp_ctor_as_op(RandomNumberGenerator& rng)
}
/**
-* The following test tests whether ECKAEG keys exhibit correct behaviour when it is
+* The following test tests whether ECDH keys exhibit correct behaviour when it is
* attempted to use them in an uninitialized state
*/
void test_non_init_eckaeg_keys(RandomNumberGenerator& rng)
@@ -233,13 +231,13 @@ void test_non_init_eckaeg_keys(RandomNumberGenerator& rng)
Botan::EC_Domain_Params dom_pars = Botan::EC_Domain_Params(curve, p_G, order, cofactor);
// alices key (a key constructed by domain parameters IS an emphemeral key!)
- Botan::ECKAEG_PrivateKey private_a(rng, dom_pars);
- Botan::ECKAEG_PrivateKey private_b(rng, dom_pars);
+ Botan::ECDH_PrivateKey private_a(rng, dom_pars);
+ Botan::ECDH_PrivateKey private_b(rng, dom_pars);
- Botan::ECKAEG_PublicKey public_b;
+ Botan::ECDH_PublicKey public_b;
- Botan::ECKAEG_PrivateKey private_empty;
- Botan::ECKAEG_PublicKey public_empty;
+ Botan::ECDH_PrivateKey private_empty;
+ Botan::ECDH_PublicKey public_empty;
bool exc1 = false;
try
@@ -251,7 +249,7 @@ void test_non_init_eckaeg_keys(RandomNumberGenerator& rng)
exc1 = true;
}
- CHECK_MESSAGE(exc1, "there was no exception thrown when attempting to use an uninitialized ECKAEG key");
+ CHECK_MESSAGE(exc1, "there was no exception thrown when attempting to use an uninitialized ECDH key");
bool exc2 = false;
try
@@ -263,14 +261,14 @@ void test_non_init_eckaeg_keys(RandomNumberGenerator& rng)
exc2 = true;
}
- CHECK_MESSAGE(exc2, "there was no exception thrown when attempting to use an uninitialized ECKAEG key");
+ CHECK_MESSAGE(exc2, "there was no exception thrown when attempting to use an uninitialized ECDH key");
}
}
u32bit do_eckaeg_tests(Botan::RandomNumberGenerator& rng)
{
- std::cout << "Testing ECKAEG (InSiTo unit tests): ";
+ std::cout << "Testing ECDH (InSiTo unit tests): ";
test_eckaeg_normal_derivation(rng);
test_eckaeg_some_dp(rng);
diff --git a/checks/pk_bench.cpp b/checks/pk_bench.cpp
index 124872866..e0970ebfb 100644
--- a/checks/pk_bench.cpp
+++ b/checks/pk_bench.cpp
@@ -45,8 +45,8 @@
#include <botan/ecdsa.h>
#endif
-#if defined(BOTAN_HAS_ECKAEG)
- #include <botan/eckaeg.h>
+#if defined(BOTAN_HAS_ECDH)
+ #include <botan/ecdh.h>
#endif
using namespace Botan;
@@ -338,7 +338,7 @@ void benchmark_ecdsa(RandomNumberGenerator& rng,
#endif
-#if defined(BOTAN_HAS_ECKAEG)
+#if defined(BOTAN_HAS_ECDH)
void benchmark_eckaeg(RandomNumberGenerator& rng,
double seconds,
@@ -365,15 +365,15 @@ void benchmark_eckaeg(RandomNumberGenerator& rng,
while(kex_timer.seconds() < seconds)
{
keygen_timer.start();
- ECKAEG_PrivateKey eckaeg1(rng, params);
+ ECDH_PrivateKey eckaeg1(rng, params);
keygen_timer.stop();
keygen_timer.start();
- ECKAEG_PrivateKey eckaeg2(rng, params);
+ ECDH_PrivateKey eckaeg2(rng, params);
keygen_timer.stop();
- ECKAEG_PublicKey pub1(eckaeg1);
- ECKAEG_PublicKey pub2(eckaeg2);
+ ECDH_PublicKey pub1(eckaeg1);
+ ECDH_PublicKey pub2(eckaeg2);
SecureVector<byte> secret1, secret2;
@@ -391,11 +391,11 @@ void benchmark_eckaeg(RandomNumberGenerator& rng,
kex_timer.stop();
if(secret1 != secret2)
- std::cerr << "ECKAEG secrets did not match, bug in the library!?!\n";
+ std::cerr << "ECDH secrets did not match, bug in the library!?!\n";
}
}
- const std::string nm = "ECKAEG-" + to_string(pbits);
+ const std::string nm = "ECDH-" + to_string(pbits);
report.report(nm, keygen_timer);
report.report(nm, kex_timer);
}
@@ -672,8 +672,8 @@ void bench_pk(RandomNumberGenerator& rng,
benchmark_ecdsa(rng, seconds, report);
#endif
-#if defined(BOTAN_HAS_ECKAEG)
- if(algo == "All" || algo == "ECKAEG")
+#if defined(BOTAN_HAS_ECDH)
+ if(algo == "All" || algo == "ECDH")
benchmark_eckaeg(rng, seconds, report);
#endif