diff options
author | lloyd <[email protected]> | 2009-03-30 18:27:18 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2009-03-30 18:27:18 +0000 |
commit | 96d6eb6f29c55e16a37cf11899547886f735b065 (patch) | |
tree | 9f13901e9b44c98d58b2589c9b09c6a7443eb7cd /src/pubkey/dh | |
parent | 3cc3dd72c5f87b76852a55c1f2d1821dba967d8c (diff) |
Thomas Moschny passed along a request from the Fedora packagers which came
up during the Fedora submission review, that each source file include some
text about the license. One handy Perl script later and each file now has
the line
Distributed under the terms of the Botan license
after the copyright notices.
While I was in there modifying every file anyway, I also stripped out the
remainder of the block comments (lots of astericks before and after the
text); this is stylistic thing I picked up when I was first learning C++
but in retrospect it is not a good style as the structure makes it harder
to modify comments (with the result that comments become fewer, shorter and
are less likely to be updated, which are not good things).
Diffstat (limited to 'src/pubkey/dh')
-rw-r--r-- | src/pubkey/dh/dh.cpp | 70 | ||||
-rw-r--r-- | src/pubkey/dh/dh.h | 10 | ||||
-rw-r--r-- | src/pubkey/dh/dh_core.cpp | 34 | ||||
-rw-r--r-- | src/pubkey/dh/dh_core.h | 16 | ||||
-rw-r--r-- | src/pubkey/dh/dh_op.h | 22 |
5 files changed, 81 insertions, 71 deletions
diff --git a/src/pubkey/dh/dh.cpp b/src/pubkey/dh/dh.cpp index 8d2059936..0c9d02f0e 100644 --- a/src/pubkey/dh/dh.cpp +++ b/src/pubkey/dh/dh.cpp @@ -1,7 +1,9 @@ -/************************************************* -* Diffie-Hellman Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* Diffie-Hellman +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/dh.h> #include <botan/numthry.h> @@ -9,9 +11,9 @@ namespace Botan { -/************************************************* -* DH_PublicKey Constructor * -*************************************************/ +/* +* DH_PublicKey Constructor +*/ DH_PublicKey::DH_PublicKey(const DL_Group& grp, const BigInt& y1) { group = grp; @@ -19,32 +21,32 @@ DH_PublicKey::DH_PublicKey(const DL_Group& grp, const BigInt& y1) X509_load_hook(); } -/************************************************* -* Algorithm Specific X.509 Initialization Code * -*************************************************/ +/* +* Algorithm Specific X.509 Initialization Code +*/ void DH_PublicKey::X509_load_hook() { } -/************************************************* -* Return the maximum input size in bits * -*************************************************/ +/* +* Return the maximum input size in bits +*/ u32bit DH_PublicKey::max_input_bits() const { return group_p().bits(); } -/************************************************* -* Return the public value for key agreement * -*************************************************/ +/* +* Return the public value for key agreement +*/ MemoryVector<byte> DH_PublicKey::public_value() const { return BigInt::encode_1363(y, group_p().bytes()); } -/************************************************* -* Create a DH private key * -*************************************************/ +/* +* Create a DH private key +*/ DH_PrivateKey::DH_PrivateKey(RandomNumberGenerator& rng, const DL_Group& grp, const BigInt& x_arg) @@ -62,9 +64,9 @@ DH_PrivateKey::DH_PrivateKey(RandomNumberGenerator& rng, PKCS8_load_hook(rng, false); } -/************************************************* -* Algorithm Specific PKCS #8 Initialization Code * -*************************************************/ +/* +* Algorithm Specific PKCS #8 Initialization Code +*/ void DH_PrivateKey::PKCS8_load_hook(RandomNumberGenerator& rng, bool generated) { @@ -78,34 +80,34 @@ void DH_PrivateKey::PKCS8_load_hook(RandomNumberGenerator& rng, load_check(rng); } -/************************************************* -* Return the public value for key agreement * -*************************************************/ +/* +* Return the public value for key agreement +*/ MemoryVector<byte> DH_PrivateKey::public_value() const { return DH_PublicKey::public_value(); } -/************************************************* -* Derive a key * -*************************************************/ +/* +* Derive a key +*/ SecureVector<byte> DH_PrivateKey::derive_key(const byte w[], u32bit w_len) const { return derive_key(BigInt::decode(w, w_len)); } -/************************************************* -* Derive a key * -*************************************************/ +/* +* Derive a key +*/ SecureVector<byte> DH_PrivateKey::derive_key(const DH_PublicKey& key) const { return derive_key(key.get_y()); } -/************************************************* -* Derive a key * -*************************************************/ +/* +* Derive a key +*/ SecureVector<byte> DH_PrivateKey::derive_key(const BigInt& w) const { const BigInt& p = group_p(); diff --git a/src/pubkey/dh/dh.h b/src/pubkey/dh/dh.h index 5f4cb5fa1..fa558bce2 100644 --- a/src/pubkey/dh/dh.h +++ b/src/pubkey/dh/dh.h @@ -1,7 +1,9 @@ -/************************************************* -* Diffie-Hellman Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* Diffie-Hellman +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_DIFFIE_HELLMAN_H__ #define BOTAN_DIFFIE_HELLMAN_H__ diff --git a/src/pubkey/dh/dh_core.cpp b/src/pubkey/dh/dh_core.cpp index a0586c444..bd744a3e1 100644 --- a/src/pubkey/dh/dh_core.cpp +++ b/src/pubkey/dh/dh_core.cpp @@ -1,7 +1,9 @@ -/************************************************* -* PK Algorithm Core Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* PK Algorithm Core +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/dh_core.h> #include <botan/numthry.h> @@ -17,9 +19,9 @@ const u32bit BLINDING_BITS = BOTAN_PRIVATE_KEY_OP_BLINDING_BITS; } -/************************************************* -* DH_Core Constructor * -*************************************************/ +/* +* DH_Core Constructor +*/ DH_Core::DH_Core(RandomNumberGenerator& rng, const DL_Group& group, const BigInt& x) { @@ -33,9 +35,9 @@ DH_Core::DH_Core(RandomNumberGenerator& rng, blinder = Blinder(k, power_mod(inverse_mod(k, p), x, p), p); } -/************************************************* -* DH_Core Copy Constructor * -*************************************************/ +/* +* DH_Core Copy Constructor +*/ DH_Core::DH_Core(const DH_Core& core) { op = 0; @@ -44,9 +46,9 @@ DH_Core::DH_Core(const DH_Core& core) blinder = core.blinder; } -/************************************************* -* DH_Core Assignment Operator * -*************************************************/ +/* +* DH_Core Assignment Operator +*/ DH_Core& DH_Core::operator=(const DH_Core& core) { delete op; @@ -56,9 +58,9 @@ DH_Core& DH_Core::operator=(const DH_Core& core) return (*this); } -/************************************************* -* DH Operation * -*************************************************/ +/* +* DH Operation +*/ BigInt DH_Core::agree(const BigInt& i) const { return blinder.unblind(op->agree(blinder.blind(i))); diff --git a/src/pubkey/dh/dh_core.h b/src/pubkey/dh/dh_core.h index 666e615fc..91b50a27a 100644 --- a/src/pubkey/dh/dh_core.h +++ b/src/pubkey/dh/dh_core.h @@ -1,7 +1,9 @@ -/************************************************* -* DH Core Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* DH Core +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_DH_CORE_H__ #define BOTAN_DH_CORE_H__ @@ -11,9 +13,9 @@ namespace Botan { -/************************************************* -* DH Core * -*************************************************/ +/* +* DH Core +*/ class BOTAN_DLL DH_Core { public: diff --git a/src/pubkey/dh/dh_op.h b/src/pubkey/dh/dh_op.h index b19961452..50f3d7825 100644 --- a/src/pubkey/dh/dh_op.h +++ b/src/pubkey/dh/dh_op.h @@ -1,7 +1,9 @@ -/************************************************* -* DH Operations Header File * -* (C) 1999-2008 Jack Lloyd * -*************************************************/ +/* +* DH Operations +* (C) 1999-2008 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_DH_OPS_H__ #define BOTAN_DH_OPS_H__ @@ -12,9 +14,9 @@ namespace Botan { -/************************************************* -* DH Operation Interface * -*************************************************/ +/* +* DH Operation Interface +*/ class BOTAN_DLL DH_Operation { public: @@ -23,9 +25,9 @@ class BOTAN_DLL DH_Operation virtual ~DH_Operation() {} }; -/************************************************* -* Botan's Default DH Operation * -*************************************************/ +/* +* Botan's Default DH Operation +*/ class BOTAN_DLL Default_DH_Op : public DH_Operation { public: |