diff options
Diffstat (limited to 'src/pubkey/dsa')
-rw-r--r-- | src/pubkey/dsa/dsa.cpp | 64 | ||||
-rw-r--r-- | src/pubkey/dsa/dsa.h | 22 | ||||
-rw-r--r-- | src/pubkey/dsa/dsa_core.cpp | 40 | ||||
-rw-r--r-- | src/pubkey/dsa/dsa_core.h | 16 | ||||
-rw-r--r-- | src/pubkey/dsa/dsa_op.cpp | 28 | ||||
-rw-r--r-- | src/pubkey/dsa/dsa_op.h | 22 |
6 files changed, 102 insertions, 90 deletions
diff --git a/src/pubkey/dsa/dsa.cpp b/src/pubkey/dsa/dsa.cpp index c998c35b2..b0688ae0d 100644 --- a/src/pubkey/dsa/dsa.cpp +++ b/src/pubkey/dsa/dsa.cpp @@ -1,7 +1,9 @@ -/************************************************* -* DSA Source File * -* (C) 1999-2008 Jack Lloyd * -*************************************************/ +/* +* DSA +* (C) 1999-2008 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/dsa.h> #include <botan/numthry.h> @@ -10,9 +12,9 @@ namespace Botan { -/************************************************* -* DSA_PublicKey Constructor * -*************************************************/ +/* +* DSA_PublicKey Constructor +*/ DSA_PublicKey::DSA_PublicKey(const DL_Group& grp, const BigInt& y1) { group = grp; @@ -20,42 +22,42 @@ DSA_PublicKey::DSA_PublicKey(const DL_Group& grp, const BigInt& y1) X509_load_hook(); } -/************************************************* -* Algorithm Specific X.509 Initialization Code * -*************************************************/ +/* +* Algorithm Specific X.509 Initialization Code +*/ void DSA_PublicKey::X509_load_hook() { core = DSA_Core(group, y); } -/************************************************* -* DSA Verification Function * -*************************************************/ +/* +* DSA Verification Function +*/ bool DSA_PublicKey::verify(const byte msg[], u32bit msg_len, const byte sig[], u32bit sig_len) const { return core.verify(msg, msg_len, sig, sig_len); } -/************************************************* -* Return the maximum input size in bits * -*************************************************/ +/* +* Return the maximum input size in bits +*/ u32bit DSA_PublicKey::max_input_bits() const { return group_q().bits(); } -/************************************************* -* Return the size of each portion of the sig * -*************************************************/ +/* +* Return the size of each portion of the sig +*/ u32bit DSA_PublicKey::message_part_size() const { return group_q().bytes(); } -/************************************************* -* Create a DSA private key * -*************************************************/ +/* +* Create a DSA private key +*/ DSA_PrivateKey::DSA_PrivateKey(RandomNumberGenerator& rng, const DL_Group& grp, const BigInt& x_arg) @@ -72,9 +74,9 @@ DSA_PrivateKey::DSA_PrivateKey(RandomNumberGenerator& rng, PKCS8_load_hook(rng, false); } -/************************************************* -* Algorithm Specific PKCS #8 Initialization Code * -*************************************************/ +/* +* Algorithm Specific PKCS #8 Initialization Code +*/ void DSA_PrivateKey::PKCS8_load_hook(RandomNumberGenerator& rng, bool generated) { @@ -87,9 +89,9 @@ void DSA_PrivateKey::PKCS8_load_hook(RandomNumberGenerator& rng, load_check(rng); } -/************************************************* -* DSA Signature Operation * -*************************************************/ +/* +* DSA Signature Operation +*/ SecureVector<byte> DSA_PrivateKey::sign(const byte in[], u32bit length, RandomNumberGenerator& rng) const { @@ -103,9 +105,9 @@ SecureVector<byte> DSA_PrivateKey::sign(const byte in[], u32bit length, return core.sign(in, length, k); } -/************************************************* -* Check Private DSA Parameters * -*************************************************/ +/* +* Check Private DSA Parameters +*/ bool DSA_PrivateKey::check_key(RandomNumberGenerator& rng, bool strong) const { if(!DL_Scheme_PrivateKey::check_key(rng, strong) || x >= group_q()) diff --git a/src/pubkey/dsa/dsa.h b/src/pubkey/dsa/dsa.h index 4175c19ad..4c9b708f4 100644 --- a/src/pubkey/dsa/dsa.h +++ b/src/pubkey/dsa/dsa.h @@ -1,7 +1,9 @@ -/************************************************* -* DSA Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* DSA +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_DSA_H__ #define BOTAN_DSA_H__ @@ -11,9 +13,9 @@ namespace Botan { -/************************************************* -* DSA Public Key * -*************************************************/ +/* +* DSA Public Key +*/ class BOTAN_DLL DSA_PublicKey : public PK_Verifying_wo_MR_Key, public virtual DL_Scheme_PublicKey { @@ -35,9 +37,9 @@ class BOTAN_DLL DSA_PublicKey : public PK_Verifying_wo_MR_Key, void X509_load_hook(); }; -/************************************************* -* DSA Private Key * -*************************************************/ +/* +* DSA Private Key +*/ class BOTAN_DLL DSA_PrivateKey : public DSA_PublicKey, public PK_Signing_Key, public virtual DL_Scheme_PrivateKey diff --git a/src/pubkey/dsa/dsa_core.cpp b/src/pubkey/dsa/dsa_core.cpp index aba1e61fb..2d958a316 100644 --- a/src/pubkey/dsa/dsa_core.cpp +++ b/src/pubkey/dsa/dsa_core.cpp @@ -1,7 +1,9 @@ -/************************************************* -* DSA Core Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* DSA Core +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/dsa_core.h> #include <botan/numthry.h> @@ -17,17 +19,17 @@ const u32bit BLINDING_BITS = BOTAN_PRIVATE_KEY_OP_BLINDING_BITS; } -/************************************************* -* DSA_Core Constructor * -*************************************************/ +/* +* DSA_Core Constructor +*/ DSA_Core::DSA_Core(const DL_Group& group, const BigInt& y, const BigInt& x) { op = Engine_Core::dsa_op(group, y, x); } -/************************************************* -* DSA_Core Copy Constructor * -*************************************************/ +/* +* DSA_Core Copy Constructor +*/ DSA_Core::DSA_Core(const DSA_Core& core) { op = 0; @@ -35,9 +37,9 @@ DSA_Core::DSA_Core(const DSA_Core& core) op = core.op->clone(); } -/************************************************* -* DSA_Core Assignment Operator * -*************************************************/ +/* +* DSA_Core Assignment Operator +*/ DSA_Core& DSA_Core::operator=(const DSA_Core& core) { delete op; @@ -46,18 +48,18 @@ DSA_Core& DSA_Core::operator=(const DSA_Core& core) return (*this); } -/************************************************* -* DSA Verification Operation * -*************************************************/ +/* +* DSA Verification Operation +*/ bool DSA_Core::verify(const byte msg[], u32bit msg_length, const byte sig[], u32bit sig_length) const { return op->verify(msg, msg_length, sig, sig_length); } -/************************************************* -* DSA Signature Operation * -*************************************************/ +/* +* DSA Signature Operation +*/ SecureVector<byte> DSA_Core::sign(const byte in[], u32bit length, const BigInt& k) const { diff --git a/src/pubkey/dsa/dsa_core.h b/src/pubkey/dsa/dsa_core.h index d1aa413e5..8bb16211f 100644 --- a/src/pubkey/dsa/dsa_core.h +++ b/src/pubkey/dsa/dsa_core.h @@ -1,7 +1,9 @@ -/************************************************* -* DSA Core Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* DSA Core +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_DSA_CORE_H__ #define BOTAN_DSA_CORE_H__ @@ -11,9 +13,9 @@ namespace Botan { -/************************************************* -* DSA Core * -*************************************************/ +/* +* DSA Core +*/ class BOTAN_DLL DSA_Core { public: diff --git a/src/pubkey/dsa/dsa_op.cpp b/src/pubkey/dsa/dsa_op.cpp index 20dbbea4a..5b921441d 100644 --- a/src/pubkey/dsa/dsa_op.cpp +++ b/src/pubkey/dsa/dsa_op.cpp @@ -1,15 +1,17 @@ -/************************************************* -* DSA Operations Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* DSA Operations +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/dsa_op.h> namespace Botan { -/************************************************* -* Default_DSA_Op Constructor * -*************************************************/ +/* +* Default_DSA_Op Constructor +*/ Default_DSA_Op::Default_DSA_Op(const DL_Group& grp, const BigInt& y1, const BigInt& x1) : x(x1), y(y1), group(grp) { @@ -19,9 +21,9 @@ Default_DSA_Op::Default_DSA_Op(const DL_Group& grp, const BigInt& y1, mod_q = Modular_Reducer(group.get_q()); } -/************************************************* -* Default DSA Verify Operation * -*************************************************/ +/* +* Default DSA Verify Operation +*/ bool Default_DSA_Op::verify(const byte msg[], u32bit msg_len, const byte sig[], u32bit sig_len) const { @@ -44,9 +46,9 @@ bool Default_DSA_Op::verify(const byte msg[], u32bit msg_len, return (mod_q.reduce(s) == r); } -/************************************************* -* Default DSA Sign Operation * -*************************************************/ +/* +* Default DSA Sign Operation +*/ SecureVector<byte> Default_DSA_Op::sign(const byte in[], u32bit length, const BigInt& k) const { diff --git a/src/pubkey/dsa/dsa_op.h b/src/pubkey/dsa/dsa_op.h index 98e671bf0..0b112c6a1 100644 --- a/src/pubkey/dsa/dsa_op.h +++ b/src/pubkey/dsa/dsa_op.h @@ -1,7 +1,9 @@ -/************************************************* -* DSA Operations Header File * -* (C) 1999-2008 Jack Lloyd * -*************************************************/ +/* +* DSA Operations +* (C) 1999-2008 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_DSA_OPS_H__ #define BOTAN_DSA_OPS_H__ @@ -13,9 +15,9 @@ namespace Botan { -/************************************************* -* DSA Operation * -*************************************************/ +/* +* DSA Operation +*/ class BOTAN_DLL DSA_Operation { public: @@ -27,9 +29,9 @@ class BOTAN_DLL DSA_Operation virtual ~DSA_Operation() {} }; -/************************************************* -* Botan's Default DSA Operation * -*************************************************/ +/* +* Botan's Default DSA Operation +*/ class BOTAN_DLL Default_DSA_Op : public DSA_Operation { public: |