aboutsummaryrefslogtreecommitdiffstats
path: root/checks/pk.cpp
diff options
context:
space:
mode:
authorlloyd <[email protected]>2011-04-08 18:13:41 +0000
committerlloyd <[email protected]>2011-04-08 18:13:41 +0000
commit8b543e804375a788ae71d461c0f8cf5d4193fc25 (patch)
tree6177931cd84a9be204cdab6e62729954e69e0421 /checks/pk.cpp
parent3b66bfd4da97189ec275e5f85b9f85009d3f8370 (diff)
ECC private keys had two different constructors, one taking a group
and a random number generator, and the other taking a group and a preset private key value. The DL private keys instead have on constructor for this; if the x value is zero, then a new random key is created. For consistency, do this with ECC as well. ECDH actually didn't have one of these constructors, forcing you to either load from PKCS #8 or else use a random key. Rename EC_Domain_Params to EC_Group, with a typedef for compatability. More doc updates. Update mtn ignores for Sphinx output
Diffstat (limited to 'checks/pk.cpp')
-rw-r--r--checks/pk.cpp13
1 files changed, 7 insertions, 6 deletions
diff --git a/checks/pk.cpp b/checks/pk.cpp
index f38cf97a6..6291b1566 100644
--- a/checks/pk.cpp
+++ b/checks/pk.cpp
@@ -498,15 +498,16 @@ u32bit validate_dsa_sig(const std::string& algo,
}
u32bit validate_ecdsa_sig(const std::string& algo,
- const std::vector<std::string>& str)
+ const std::vector<std::string>& str,
+ RandomNumberGenerator& rng)
{
if(str.size() != 5)
throw std::runtime_error("Invalid input from pk_valid.dat");
#if defined(BOTAN_HAS_ECDSA)
- EC_Domain_Params group(OIDS::lookup(str[0]));
- ECDSA_PrivateKey ecdsa(group, to_bigint(str[1]));
+ EC_Group group(OIDS::lookup(str[0]));
+ ECDSA_PrivateKey ecdsa(rng, group, to_bigint(str[1]));
std::string emsa = algo.substr(6, std::string::npos);
@@ -529,7 +530,7 @@ u32bit validate_gost_ver(const std::string& algo,
#if defined(BOTAN_HAS_GOST_34_10_2001)
- EC_Domain_Params group(OIDS::lookup(str[0]));
+ EC_Group group(OIDS::lookup(str[0]));
PointGFp public_point = OS2ECP(hex_decode(str[1]), group.get_curve());
@@ -696,7 +697,7 @@ void do_pk_keygen_tests(RandomNumberGenerator& rng)
#define EC_KEY(TYPE, GROUP) \
{ \
- TYPE key(rng, EC_Domain_Params(OIDS::lookup(GROUP))); \
+ TYPE key(rng, EC_Group(OIDS::lookup(GROUP))); \
key.check_key(rng, true); \
validate_save_and_load(&key, rng); \
std::cout << '.' << std::flush; \
@@ -855,7 +856,7 @@ u32bit do_pk_validation_tests(const std::string& filename,
new_errors = validate_dsa_ver(algorithm, substr);
else if(algorithm.find("ECDSA/") == 0)
- new_errors = validate_ecdsa_sig(algorithm, substr);
+ new_errors = validate_ecdsa_sig(algorithm, substr, rng);
else if(algorithm.find("GOST_3410_VA/") == 0)
new_errors = validate_gost_ver(algorithm, substr);