aboutsummaryrefslogtreecommitdiffstats
path: root/src/pubkey
diff options
context:
space:
mode:
authorlloyd <[email protected]>2010-03-04 18:34:55 +0000
committerlloyd <[email protected]>2010-03-04 18:34:55 +0000
commitddd6e2b4aef2558cdc9228b7ecd2348168f16c5a (patch)
treeea284de3361a44e69943562fcf3c8448a930b7f1 /src/pubkey
parent996a01840a7cc920c430a32ffb2a59498055187e (diff)
Remove DSA load hooks functions
Diffstat (limited to 'src/pubkey')
-rw-r--r--src/pubkey/dsa/dsa.cpp34
-rw-r--r--src/pubkey/dsa/dsa.h15
2 files changed, 17 insertions, 32 deletions
diff --git a/src/pubkey/dsa/dsa.cpp b/src/pubkey/dsa/dsa.cpp
index 5be3e1d48..983348baa 100644
--- a/src/pubkey/dsa/dsa.cpp
+++ b/src/pubkey/dsa/dsa.cpp
@@ -19,14 +19,6 @@ DSA_PublicKey::DSA_PublicKey(const DL_Group& grp, const BigInt& y1)
{
group = grp;
y = y1;
- X509_load_hook();
- }
-
-/*
-* Algorithm Specific X.509 Initialization Code
-*/
-void DSA_PublicKey::X509_load_hook()
- {
core = DSA_Core(group, y);
}
@@ -66,29 +58,29 @@ DSA_PrivateKey::DSA_PrivateKey(RandomNumberGenerator& rng,
x = x_arg;
if(x == 0)
- {
x = BigInt::random_integer(rng, 2, group_q() - 1);
- PKCS8_load_hook(rng, true);
- }
- else
- PKCS8_load_hook(rng, false);
- }
-/*
-* Algorithm Specific PKCS #8 Initialization Code
-*/
-void DSA_PrivateKey::PKCS8_load_hook(RandomNumberGenerator& rng,
- bool generated)
- {
y = power_mod(group_g(), x, group_p());
+
core = DSA_Core(group, y, x);
- if(generated)
+ if(x_arg == 0)
gen_check(rng);
else
load_check(rng);
}
+DSA_PrivateKey::DSA_PrivateKey(const AlgorithmIdentifier& alg_id,
+ const MemoryRegion<byte>& key_bits,
+ RandomNumberGenerator& rng) :
+ DL_Scheme_PrivateKey(alg_id, key_bits, DL_Group::ANSI_X9_57)
+ {
+ y = power_mod(group_g(), x, group_p());
+ core = DSA_Core(group, y, x);
+
+ load_check(rng);
+ }
+
/*
* DSA Signature Operation
*/
diff --git a/src/pubkey/dsa/dsa.h b/src/pubkey/dsa/dsa.h
index c263d4ec8..18c99f545 100644
--- a/src/pubkey/dsa/dsa.h
+++ b/src/pubkey/dsa/dsa.h
@@ -32,14 +32,14 @@ class BOTAN_DLL DSA_PublicKey : public PK_Verifying_wo_MR_Key,
DSA_PublicKey(const AlgorithmIdentifier& alg_id,
const MemoryRegion<byte>& key_bits) :
DL_Scheme_PublicKey(alg_id, key_bits, DL_Group::ANSI_X9_57)
- { X509_load_hook(); }
+ {
+ core = DSA_Core(group, y);
+ }
DSA_PublicKey(const DL_Group& group, const BigInt& y);
protected:
DSA_PublicKey() {}
DSA_Core core;
- private:
- void X509_load_hook();
};
/*
@@ -57,18 +57,11 @@ class BOTAN_DLL DSA_PrivateKey : public DSA_PublicKey,
DSA_PrivateKey(const AlgorithmIdentifier& alg_id,
const MemoryRegion<byte>& key_bits,
- RandomNumberGenerator& rng) :
- DL_Scheme_PrivateKey(alg_id, key_bits, DL_Group::ANSI_X9_57)
- {
- PKCS8_load_hook(rng);
- }
+ RandomNumberGenerator& rng);
DSA_PrivateKey(RandomNumberGenerator& rng,
const DL_Group& group,
const BigInt& private_key = 0);
-
- private:
- void PKCS8_load_hook(RandomNumberGenerator& rng, bool = false);
};
}