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 | |
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')
70 files changed, 1128 insertions, 988 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: diff --git a/src/pubkey/dl_algo/dl_algo.cpp b/src/pubkey/dl_algo/dl_algo.cpp index 2b59a334e..8ce34465a 100644 --- a/src/pubkey/dl_algo/dl_algo.cpp +++ b/src/pubkey/dl_algo/dl_algo.cpp @@ -1,7 +1,9 @@ -/************************************************* -* DL Scheme Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* DL Scheme +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/dl_algo.h> #include <botan/numthry.h> @@ -10,9 +12,9 @@ namespace Botan { -/************************************************* -* Return the X.509 public key encoder * -*************************************************/ +/* +* Return the X.509 public key encoder +*/ X509_Encoder* DL_Scheme_PublicKey::x509_encoder() const { class DL_Scheme_Encoder : public X509_Encoder @@ -39,9 +41,9 @@ X509_Encoder* DL_Scheme_PublicKey::x509_encoder() const return new DL_Scheme_Encoder(this); } -/************************************************* -* Return the X.509 public key decoder * -*************************************************/ +/* +* Return the X.509 public key decoder +*/ X509_Decoder* DL_Scheme_PublicKey::x509_decoder() { class DL_Scheme_Decoder : public X509_Decoder @@ -67,9 +69,9 @@ X509_Decoder* DL_Scheme_PublicKey::x509_decoder() return new DL_Scheme_Decoder(this); } -/************************************************* -* Return the PKCS #8 private key encoder * -*************************************************/ +/* +* Return the PKCS #8 private key encoder +*/ PKCS8_Encoder* DL_Scheme_PrivateKey::pkcs8_encoder() const { class DL_Scheme_Encoder : public PKCS8_Encoder @@ -96,9 +98,9 @@ PKCS8_Encoder* DL_Scheme_PrivateKey::pkcs8_encoder() const return new DL_Scheme_Encoder(this); } -/************************************************* -* Return the PKCS #8 private key decoder * -*************************************************/ +/* +* Return the PKCS #8 private key decoder +*/ PKCS8_Decoder* DL_Scheme_PrivateKey::pkcs8_decoder(RandomNumberGenerator& rng) { class DL_Scheme_Decoder : public PKCS8_Decoder @@ -126,9 +128,9 @@ PKCS8_Decoder* DL_Scheme_PrivateKey::pkcs8_decoder(RandomNumberGenerator& rng) return new DL_Scheme_Decoder(this, rng); } -/************************************************* -* Check Public DL Parameters * -*************************************************/ +/* +* Check Public DL Parameters +*/ bool DL_Scheme_PublicKey::check_key(RandomNumberGenerator& rng, bool strong) const { @@ -139,9 +141,9 @@ bool DL_Scheme_PublicKey::check_key(RandomNumberGenerator& rng, return true; } -/************************************************* -* Check DL Scheme Private Parameters * -*************************************************/ +/* +* Check DL Scheme Private Parameters +*/ bool DL_Scheme_PrivateKey::check_key(RandomNumberGenerator& rng, bool strong) const { diff --git a/src/pubkey/dl_algo/dl_algo.h b/src/pubkey/dl_algo/dl_algo.h index ff543d0b4..256ce96ee 100644 --- a/src/pubkey/dl_algo/dl_algo.h +++ b/src/pubkey/dl_algo/dl_algo.h @@ -1,7 +1,9 @@ -/************************************************* -* DL Scheme Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* DL Scheme +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_DL_ALGO_H__ #define BOTAN_DL_ALGO_H__ diff --git a/src/pubkey/dl_group/dl_group.cpp b/src/pubkey/dl_group/dl_group.cpp index d97c86e38..81c5d5e1d 100644 --- a/src/pubkey/dl_group/dl_group.cpp +++ b/src/pubkey/dl_group/dl_group.cpp @@ -1,7 +1,9 @@ -/************************************************* -* Discrete Logarithm Parameters Source File * -* (C) 1999-2008 Jack Lloyd * -*************************************************/ +/* +* Discrete Logarithm Parameters +* (C) 1999-2008 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/dl_group.h> #include <botan/libstate.h> @@ -15,17 +17,17 @@ namespace Botan { -/************************************************* -* DL_Group Constructor * -*************************************************/ +/* +* DL_Group Constructor +*/ DL_Group::DL_Group() { initialized = false; } -/************************************************* -* DL_Group Constructor * -*************************************************/ +/* +* DL_Group Constructor +*/ DL_Group::DL_Group(const std::string& type) { std::string grp_contents = global_state().get("dl", type); @@ -37,9 +39,9 @@ DL_Group::DL_Group(const std::string& type) PEM_decode(pem); } -/************************************************* -* DL_Group Constructor * -*************************************************/ +/* +* DL_Group Constructor +*/ DL_Group::DL_Group(RandomNumberGenerator& rng, PrimeType type, u32bit pbits, u32bit qbits) { @@ -82,9 +84,9 @@ DL_Group::DL_Group(RandomNumberGenerator& rng, initialized = true; } -/************************************************* -* DL_Group Constructor * -*************************************************/ +/* +* DL_Group Constructor +*/ DL_Group::DL_Group(RandomNumberGenerator& rng, const MemoryRegion<byte>& seed, u32bit pbits, u32bit qbits) { @@ -99,25 +101,25 @@ DL_Group::DL_Group(RandomNumberGenerator& rng, initialized = true; } -/************************************************* -* DL_Group Constructor * -*************************************************/ +/* +* DL_Group Constructor +*/ DL_Group::DL_Group(const BigInt& p1, const BigInt& g1) { initialize(p1, 0, g1); } -/************************************************* -* DL_Group Constructor * -*************************************************/ +/* +* DL_Group Constructor +*/ DL_Group::DL_Group(const BigInt& p1, const BigInt& q1, const BigInt& g1) { initialize(p1, q1, g1); } -/************************************************* -* DL_Group Initializer * -*************************************************/ +/* +* DL_Group Initializer +*/ void DL_Group::initialize(const BigInt& p1, const BigInt& q1, const BigInt& g1) { if(p1 < 3) @@ -134,18 +136,18 @@ void DL_Group::initialize(const BigInt& p1, const BigInt& q1, const BigInt& g1) initialized = true; } -/************************************************* -* Verify that the group has been set * -*************************************************/ +/* +* Verify that the group has been set +*/ void DL_Group::init_check() const { if(!initialized) throw Invalid_State("DLP group cannot be used uninitialized"); } -/************************************************* -* Verify the parameters * -*************************************************/ +/* +* Verify the parameters +*/ bool DL_Group::verify_group(RandomNumberGenerator& rng, bool strong) const { @@ -166,27 +168,27 @@ bool DL_Group::verify_group(RandomNumberGenerator& rng, return true; } -/************************************************* -* Return the prime * -*************************************************/ +/* +* Return the prime +*/ const BigInt& DL_Group::get_p() const { init_check(); return p; } -/************************************************* -* Return the generator * -*************************************************/ +/* +* Return the generator +*/ const BigInt& DL_Group::get_g() const { init_check(); return g; } -/************************************************* -* Return the subgroup * -*************************************************/ +/* +* Return the subgroup +*/ const BigInt& DL_Group::get_q() const { init_check(); @@ -195,9 +197,9 @@ const BigInt& DL_Group::get_q() const return q; } -/************************************************* -* DER encode the parameters * -*************************************************/ +/* +* DER encode the parameters +*/ SecureVector<byte> DL_Group::DER_encode(Format format) const { init_check(); @@ -238,9 +240,9 @@ SecureVector<byte> DL_Group::DER_encode(Format format) const throw Invalid_Argument("Unknown DL_Group encoding " + to_string(format)); } -/************************************************* -* PEM encode the parameters * -*************************************************/ +/* +* PEM encode the parameters +*/ std::string DL_Group::PEM_encode(Format format) const { SecureVector<byte> encoding = DER_encode(format); @@ -254,9 +256,9 @@ std::string DL_Group::PEM_encode(Format format) const throw Invalid_Argument("Unknown DL_Group encoding " + to_string(format)); } -/************************************************* -* Decode BER encoded parameters * -*************************************************/ +/* +* Decode BER encoded parameters +*/ void DL_Group::BER_decode(DataSource& source, Format format) { BigInt new_p, new_q, new_g; @@ -290,9 +292,9 @@ void DL_Group::BER_decode(DataSource& source, Format format) initialize(new_p, new_q, new_g); } -/************************************************* -* Decode PEM encoded parameters * -*************************************************/ +/* +* Decode PEM encoded parameters +*/ void DL_Group::PEM_decode(DataSource& source) { std::string label; @@ -308,9 +310,9 @@ void DL_Group::PEM_decode(DataSource& source) throw Decoding_Error("DL_Group: Invalid PEM label " + label); } -/************************************************* -* Create a random DSA-style generator * -*************************************************/ +/* +* Create a random DSA-style generator +*/ BigInt DL_Group::make_dsa_generator(const BigInt& p, const BigInt& q) { BigInt g, e = (p - 1) / q; diff --git a/src/pubkey/dl_group/dl_group.h b/src/pubkey/dl_group/dl_group.h index 2f59f86d9..a84a85f87 100644 --- a/src/pubkey/dl_group/dl_group.h +++ b/src/pubkey/dl_group/dl_group.h @@ -1,7 +1,9 @@ -/************************************************* -* Discrete Logarithm Group Header File * -* (C) 1999-2008 Jack Lloyd * -*************************************************/ +/* +* Discrete Logarithm Group +* (C) 1999-2008 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_DL_PARAM_H__ #define BOTAN_DL_PARAM_H__ diff --git a/src/pubkey/dlies/dlies.cpp b/src/pubkey/dlies/dlies.cpp index 62d74b9ee..c441ed17c 100644 --- a/src/pubkey/dlies/dlies.cpp +++ b/src/pubkey/dlies/dlies.cpp @@ -1,7 +1,9 @@ -/************************************************* -* DLIES Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* DLIES +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/dlies.h> #include <botan/look_pk.h> @@ -9,9 +11,9 @@ namespace Botan { -/************************************************* -* DLIES_Encryptor Constructor * -*************************************************/ +/* +* DLIES_Encryptor Constructor +*/ DLIES_Encryptor::DLIES_Encryptor(const PK_Key_Agreement_Key& k, KDF* kdf_obj, MessageAuthenticationCode* mac_obj, @@ -26,9 +28,9 @@ DLIES_Encryptor::~DLIES_Encryptor() delete mac; } -/************************************************* -* DLIES Encryption * -*************************************************/ +/* +* DLIES Encryption +*/ SecureVector<byte> DLIES_Encryptor::enc(const byte in[], u32bit length, RandomNumberGenerator&) const { @@ -63,25 +65,25 @@ SecureVector<byte> DLIES_Encryptor::enc(const byte in[], u32bit length, return out; } -/************************************************* -* Set the other parties public key * -*************************************************/ +/* +* Set the other parties public key +*/ void DLIES_Encryptor::set_other_key(const MemoryRegion<byte>& ok) { other_key = ok; } -/************************************************* -* Return the max size, in bytes, of a message * -*************************************************/ +/* +* Return the max size, in bytes, of a message +*/ u32bit DLIES_Encryptor::maximum_input_size() const { return 32; } -/************************************************* -* DLIES_Decryptor Constructor * -*************************************************/ +/* +* DLIES_Decryptor Constructor +*/ DLIES_Decryptor::DLIES_Decryptor(const PK_Key_Agreement_Key& k, KDF* kdf_obj, MessageAuthenticationCode* mac_obj, @@ -96,9 +98,9 @@ DLIES_Decryptor::~DLIES_Decryptor() delete mac; } -/************************************************* -* DLIES Decryption * -*************************************************/ +/* +* DLIES Decryption +*/ SecureVector<byte> DLIES_Decryptor::dec(const byte msg[], u32bit length) const { const u32bit public_len = key.public_value().size(); diff --git a/src/pubkey/dlies/dlies.h b/src/pubkey/dlies/dlies.h index d452f1a4f..88a22b9de 100644 --- a/src/pubkey/dlies/dlies.h +++ b/src/pubkey/dlies/dlies.h @@ -1,7 +1,9 @@ -/************************************************* -* DLIES Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* DLIES +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_DLIES_H__ #define BOTAN_DLIES_H__ @@ -12,9 +14,9 @@ namespace Botan { -/************************************************* -* DLIES Encryption * -*************************************************/ +/* +* DLIES Encryption +*/ class BOTAN_DLL DLIES_Encryptor : public PK_Encryptor { public: @@ -39,9 +41,9 @@ class BOTAN_DLL DLIES_Encryptor : public PK_Encryptor u32bit mac_keylen; }; -/************************************************* -* DLIES Decryption * -*************************************************/ +/* +* DLIES Decryption +*/ class BOTAN_DLL DLIES_Decryptor : public PK_Decryptor { public: 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: diff --git a/src/pubkey/ec_dompar/ec_dompar.h b/src/pubkey/ec_dompar/ec_dompar.h index a567fd88c..47971d802 100644 --- a/src/pubkey/ec_dompar/ec_dompar.h +++ b/src/pubkey/ec_dompar/ec_dompar.h @@ -1,8 +1,10 @@ -/************************************************* -* ECDSA Domain Parameters Header File * -* (C) 2007 Falko Strenzke, FlexSecure GmbH * -* 2008 Jack Lloyd * -*************************************************/ +/* +* ECDSA Domain Parameters +* (C) 2007 Falko Strenzke, FlexSecure GmbH +* 2008 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_ECC_DOMAIN_PARAMETERS_H__ #define BOTAN_ECC_DOMAIN_PARAMETERS_H__ diff --git a/src/pubkey/ecc_key/ecc_key.cpp b/src/pubkey/ecc_key/ecc_key.cpp index 39466054e..9af63bdcd 100644 --- a/src/pubkey/ecc_key/ecc_key.cpp +++ b/src/pubkey/ecc_key/ecc_key.cpp @@ -1,9 +1,11 @@ -/************************************************* -* ECC Key implemenation * -* (C) 2007 Manuel Hartl, FlexSecure GmbH * -* Falko Strenzke, FlexSecure GmbH * -* 2008 Jack Lloyd * -*************************************************/ +/* +* ECC Key implemenation +* (C) 2007 Manuel Hartl, FlexSecure GmbH +* Falko Strenzke, FlexSecure GmbH +* 2008 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/ecc_key.h> #include <botan/x509_key.h> @@ -16,9 +18,9 @@ namespace Botan { -/************************************************* -* EC_PublicKey * -*************************************************/ +/* +* EC_PublicKey +*/ void EC_PublicKey::affirm_init() const // virtual { if((mp_dom_pars.get() == 0) || (mp_public_point.get() == 0)) @@ -134,7 +136,7 @@ void EC_PublicKey::set_parameter_encoding(EC_dompar_enc type) } /******************************** -* EC_PrivateKey * +* EC_PrivateKey ********************************/ void EC_PrivateKey::affirm_init() const // virtual { diff --git a/src/pubkey/ecc_key/ecc_key.h b/src/pubkey/ecc_key/ecc_key.h index cb8f391b9..0ca9a0e75 100644 --- a/src/pubkey/ecc_key/ecc_key.h +++ b/src/pubkey/ecc_key/ecc_key.h @@ -1,9 +1,11 @@ -/************************************************* -* ECDSA Header File * -* (C) 2007 Falko Strenzke, FlexSecure GmbH * -* Manuel Hartl, FlexSecure GmbH * -* (C) 2008 Jack Lloyd * -*************************************************/ +/* +* ECDSA +* (C) 2007 Falko Strenzke, FlexSecure GmbH +* Manuel Hartl, FlexSecure GmbH +* (C) 2008 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_ECC_PUBLIC_KEY_BASE_H__ #define BOTAN_ECC_PUBLIC_KEY_BASE_H__ diff --git a/src/pubkey/ecdsa/ecdsa.cpp b/src/pubkey/ecdsa/ecdsa.cpp index 28146b518..9640c6397 100644 --- a/src/pubkey/ecdsa/ecdsa.cpp +++ b/src/pubkey/ecdsa/ecdsa.cpp @@ -1,9 +1,11 @@ -/************************************************* -* ECDSA implemenation * -* (C) 2007 Manuel Hartl, FlexSecure GmbH * -* 2007 Falko Strenzke, FlexSecure GmbH * -* 2008 Jack Lloyd * -*************************************************/ +/* +* ECDSA implemenation +* (C) 2007 Manuel Hartl, FlexSecure GmbH +* 2007 Falko Strenzke, FlexSecure GmbH +* 2008 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/ecdsa.h> #include <botan/numthry.h> @@ -33,9 +35,9 @@ ECDSA_PrivateKey::ECDSA_PrivateKey(RandomNumberGenerator& rng, m_ecdsa_core = ECDSA_Core(*mp_dom_pars, m_private_value, *mp_public_point); } -/************************************************* -* ECDSA_PublicKey * -*************************************************/ +/* +* ECDSA_PublicKey +*/ void ECDSA_PublicKey::affirm_init() const // virtual { EC_PublicKey::affirm_init(); @@ -152,7 +154,7 @@ u32bit ECDSA_PublicKey::max_input_bits() const } /************************* -* ECDSA_PrivateKey * +* ECDSA_PrivateKey *************************/ void ECDSA_PrivateKey::affirm_init() const // virtual { diff --git a/src/pubkey/ecdsa/ecdsa.h b/src/pubkey/ecdsa/ecdsa.h index 8176f4447..379445777 100644 --- a/src/pubkey/ecdsa/ecdsa.h +++ b/src/pubkey/ecdsa/ecdsa.h @@ -1,9 +1,11 @@ -/************************************************* -* ECDSA Header File * -* (C) 2007 Falko Strenzke, FlexSecure GmbH * -* Manuel Hartl, FlexSecure GmbH * -* (C) 2008 Jack Lloyd * -*************************************************/ +/* +* ECDSA +* (C) 2007 Falko Strenzke, FlexSecure GmbH +* Manuel Hartl, FlexSecure GmbH +* (C) 2008 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_ECDSA_KEY_H__ #define BOTAN_ECDSA_KEY_H__ @@ -30,7 +32,7 @@ class BOTAN_DLL ECDSA_PublicKey : public virtual EC_PublicKey, /** * Get the maximum number of bits allowed to be fed to this key. * This is the bitlength of the order of the base point. - * + * @result the maximum number of input bits */ u32bit max_input_bits() const; diff --git a/src/pubkey/ecdsa/ecdsa_core.cpp b/src/pubkey/ecdsa/ecdsa_core.cpp index 2a5ea29cb..e1104e52f 100644 --- a/src/pubkey/ecdsa/ecdsa_core.cpp +++ b/src/pubkey/ecdsa/ecdsa_core.cpp @@ -1,8 +1,10 @@ -/************************************************* -* ECDSA Core Source File * -* (C) 1999-2007 Jack Lloyd * -* (C) 2007 FlexSecure GmbH * -*************************************************/ +/* +* ECDSA Core +* (C) 1999-2007 Jack Lloyd +* (C) 2007 FlexSecure GmbH +* +* Distributed under the terms of the Botan license +*/ #include <botan/ecdsa_core.h> #include <botan/numthry.h> @@ -12,9 +14,9 @@ namespace Botan { -/************************************************* -* ECDSA Operation * -*************************************************/ +/* +* ECDSA Operation +*/ bool ECDSA_Core::verify(const byte signature[], u32bit sig_len, const byte message[], u32bit mess_len) const { diff --git a/src/pubkey/ecdsa/ecdsa_core.h b/src/pubkey/ecdsa/ecdsa_core.h index 30668d858..ceccc940e 100644 --- a/src/pubkey/ecdsa/ecdsa_core.h +++ b/src/pubkey/ecdsa/ecdsa_core.h @@ -1,8 +1,10 @@ -/************************************************* -* ECDSA Core Header File * -* (C) 1999-2007 Jack Lloyd * -* (C) 2007 FlexSecure GmbH * -*************************************************/ +/* +* ECDSA Core +* (C) 1999-2007 Jack Lloyd +* (C) 2007 FlexSecure GmbH +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_ECDSA_CORE_H__ #define BOTAN_ECDSA_CORE_H__ @@ -13,9 +15,9 @@ namespace Botan { -/************************************************* -* ECDSA Core * -*************************************************/ +/* +* ECDSA Core +*/ class BOTAN_DLL ECDSA_Core { public: diff --git a/src/pubkey/ecdsa/ecdsa_op.cpp b/src/pubkey/ecdsa/ecdsa_op.cpp index a7db3f237..986043ed6 100644 --- a/src/pubkey/ecdsa/ecdsa_op.cpp +++ b/src/pubkey/ecdsa/ecdsa_op.cpp @@ -1,8 +1,10 @@ -/************************************************* -* ECDSA Operation * -* (C) 2007 FlexSecure GmbH * -* 2008 Jack Lloyd * -*************************************************/ +/* +* ECDSA Operation +* (C) 2007 FlexSecure GmbH +* 2008 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/ecdsa_op.h> #include <botan/numthry.h> diff --git a/src/pubkey/ecdsa/ecdsa_op.h b/src/pubkey/ecdsa/ecdsa_op.h index 8f5f01902..25831a9d4 100644 --- a/src/pubkey/ecdsa/ecdsa_op.h +++ b/src/pubkey/ecdsa/ecdsa_op.h @@ -1,8 +1,10 @@ -/************************************************* -* ECDSA Operations Header File * -* (C) 1999-2008 Jack Lloyd * -* (C) 2007 FlexSecure GmbH * -*************************************************/ +/* +* ECDSA Operations +* (C) 1999-2008 Jack Lloyd +* (C) 2007 FlexSecure GmbH +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_ECDSA_OPERATIONS_H__ #define BOTAN_ECDSA_OPERATIONS_H__ @@ -12,9 +14,9 @@ namespace Botan { -/************************************************* -* ECDSA Operation * -*************************************************/ +/* +* ECDSA Operation +*/ class BOTAN_DLL ECDSA_Operation { public: @@ -31,9 +33,9 @@ class BOTAN_DLL ECDSA_Operation }; -/************************************************* -* Default ECDSA operation * -*************************************************/ +/* +* Default ECDSA operation +*/ class BOTAN_DLL Default_ECDSA_Op : public ECDSA_Operation { public: diff --git a/src/pubkey/eckaeg/eckaeg.cpp b/src/pubkey/eckaeg/eckaeg.cpp index a8a32d812..0d094e2e1 100644 --- a/src/pubkey/eckaeg/eckaeg.cpp +++ b/src/pubkey/eckaeg/eckaeg.cpp @@ -1,9 +1,11 @@ -/************************************************* -* ECKAEG implemenation * -* (C) 2007 Manuel Hartl, FlexSecure GmbH * -* 2007 Falko Strenzke, FlexSecure GmbH * -* 2008 Jack Lloyd * -*************************************************/ +/* +* ECKAEG implemenation +* (C) 2007 Manuel Hartl, FlexSecure GmbH +* 2007 Falko Strenzke, FlexSecure GmbH +* 2008 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/eckaeg.h> #include <botan/numthry.h> @@ -16,7 +18,7 @@ namespace Botan { /********************************* -* ECKAEG_PublicKey * +* ECKAEG_PublicKey *********************************/ void ECKAEG_PublicKey::affirm_init() const // virtual @@ -72,7 +74,7 @@ ECKAEG_PublicKey::ECKAEG_PublicKey(EC_Domain_Params const& dom_par, PointGFp con } /********************************* -* ECKAEG_PrivateKey * +* ECKAEG_PrivateKey *********************************/ void ECKAEG_PrivateKey::affirm_init() const // virtual { diff --git a/src/pubkey/eckaeg/eckaeg.h b/src/pubkey/eckaeg/eckaeg.h index 9b0cd492c..31b65740c 100644 --- a/src/pubkey/eckaeg/eckaeg.h +++ b/src/pubkey/eckaeg/eckaeg.h @@ -1,9 +1,11 @@ -/************************************************* -* ECKAEG Header File * -* (C) 2007 Falko Strenzke, FlexSecure GmbH * -* Manuel Hartl, FlexSecure GmbH * -* (C) 2008 Jack Lloyd * -*************************************************/ +/* +* ECKAEG +* (C) 2007 Falko Strenzke, FlexSecure GmbH +* Manuel Hartl, FlexSecure GmbH +* (C) 2008 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_ECKAEG_KEY_H__ #define BOTAN_ECKAEG_KEY_H__ @@ -43,7 +45,7 @@ class BOTAN_DLL ECKAEG_PublicKey : public virtual EC_PublicKey /** * Get the maximum number of bits allowed to be fed to this key. * This is the bitlength of the order of the base point. - * + * @result the maximum number of input bits */ u32bit max_input_bits() const diff --git a/src/pubkey/eckaeg/eckaeg_core.cpp b/src/pubkey/eckaeg/eckaeg_core.cpp index 9d59af118..6dcc1d1fa 100644 --- a/src/pubkey/eckaeg/eckaeg_core.cpp +++ b/src/pubkey/eckaeg/eckaeg_core.cpp @@ -1,8 +1,10 @@ -/************************************************* -* ECKAEG Core Source File * -* (C) 1999-2007 Jack Lloyd * -* (C) 2007 FlexSecure GmbH * -*************************************************/ +/* +* ECKAEG Core +* (C) 1999-2007 Jack Lloyd +* (C) 2007 FlexSecure GmbH +* +* Distributed under the terms of the Botan license +*/ #include <botan/eckaeg_core.h> #include <botan/numthry.h> @@ -12,9 +14,9 @@ namespace Botan { -/************************************************* -* ECKAEG_Core Constructor * -*************************************************/ +/* +* ECKAEG_Core Constructor +*/ ECKAEG_Core::ECKAEG_Core(const EC_Domain_Params& dom_pars, const BigInt& priv_key, const PointGFp& pub_key) @@ -22,9 +24,9 @@ ECKAEG_Core::ECKAEG_Core(const EC_Domain_Params& dom_pars, op = Engine_Core::eckaeg_op(dom_pars, priv_key, pub_key); } -/************************************************* -* ECKAEG_Core Copy Constructor * -*************************************************/ +/* +* ECKAEG_Core Copy Constructor +*/ ECKAEG_Core::ECKAEG_Core(const ECKAEG_Core& core) { op = 0; @@ -33,9 +35,9 @@ ECKAEG_Core::ECKAEG_Core(const ECKAEG_Core& core) blinder = core.blinder; } -/************************************************* -* ECKAEG_Core Assignment Operator * -*************************************************/ +/* +* ECKAEG_Core Assignment Operator +*/ ECKAEG_Core& ECKAEG_Core::operator=(const ECKAEG_Core& core) { delete op; @@ -45,9 +47,9 @@ ECKAEG_Core& ECKAEG_Core::operator=(const ECKAEG_Core& core) return (*this); } -/************************************************* -* ECKAEG Operation * -*************************************************/ +/* +* ECKAEG Operation +*/ SecureVector<byte> ECKAEG_Core::agree(const PointGFp& otherKey) const { //assert(op.get()); diff --git a/src/pubkey/eckaeg/eckaeg_core.h b/src/pubkey/eckaeg/eckaeg_core.h index d1989bb70..d632c9451 100644 --- a/src/pubkey/eckaeg/eckaeg_core.h +++ b/src/pubkey/eckaeg/eckaeg_core.h @@ -1,8 +1,10 @@ -/************************************************* -* ECKAEG Core Header File * -* (C) 1999-2007 Jack Lloyd * -* (C) 2007 FlexSecure GmbH * -*************************************************/ +/* +* ECKAEG Core +* (C) 1999-2007 Jack Lloyd +* (C) 2007 FlexSecure GmbH +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_ECKAEG_CORE_H__ #define BOTAN_ECKAEG_CORE_H__ @@ -13,9 +15,9 @@ namespace Botan { -/************************************************* -* ECKAEG Core * -*************************************************/ +/* +* ECKAEG Core +*/ class BOTAN_DLL ECKAEG_Core { public: diff --git a/src/pubkey/eckaeg/eckaeg_op.cpp b/src/pubkey/eckaeg/eckaeg_op.cpp index d5c64ba87..0cb5c3d55 100644 --- a/src/pubkey/eckaeg/eckaeg_op.cpp +++ b/src/pubkey/eckaeg/eckaeg_op.cpp @@ -1,8 +1,10 @@ -/************************************************* -* ECKAEG Operation * -* (C) 2007 FlexSecure GmbH * -* 2008 Jack Lloyd * -*************************************************/ +/* +* ECKAEG Operation +* (C) 2007 FlexSecure GmbH +* 2008 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/eckaeg_op.h> #include <botan/numthry.h> diff --git a/src/pubkey/eckaeg/eckaeg_op.h b/src/pubkey/eckaeg/eckaeg_op.h index 94355d46b..27cf4f367 100644 --- a/src/pubkey/eckaeg/eckaeg_op.h +++ b/src/pubkey/eckaeg/eckaeg_op.h @@ -1,8 +1,10 @@ -/************************************************* -* ECKAEG Operations Header File * -* (C) 1999-2008 Jack Lloyd * -* 2007 FlexSecure GmbH * -*************************************************/ +/* +* ECKAEG Operations +* (C) 1999-2008 Jack Lloyd +* 2007 FlexSecure GmbH +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_ECKAEG_OPERATIONS_H__ #define BOTAN_ECKAEG_OPERATIONS_H__ @@ -11,9 +13,9 @@ namespace Botan { -/************************************************* -* ECKAEG Operation * -*************************************************/ +/* +* ECKAEG Operation +*/ class BOTAN_DLL ECKAEG_Operation { public: @@ -22,9 +24,9 @@ class BOTAN_DLL ECKAEG_Operation virtual ~ECKAEG_Operation() {} }; -/************************************************* -* Default ECKAEG operation * -*************************************************/ +/* +* Default ECKAEG operation +*/ class BOTAN_DLL Default_ECKAEG_Op : public ECKAEG_Operation { public: diff --git a/src/pubkey/elgamal/elg_core.cpp b/src/pubkey/elgamal/elg_core.cpp index 1181e7534..2abd6a639 100644 --- a/src/pubkey/elgamal/elg_core.cpp +++ b/src/pubkey/elgamal/elg_core.cpp @@ -1,7 +1,9 @@ -/************************************************* -* ElGamal Core Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* ElGamal Core +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/elg_core.h> #include <botan/numthry.h> @@ -17,18 +19,18 @@ const u32bit BLINDING_BITS = BOTAN_PRIVATE_KEY_OP_BLINDING_BITS; } -/************************************************* -* ELG_Core Constructor * -*************************************************/ +/* +* ELG_Core Constructor +*/ ELG_Core::ELG_Core(const DL_Group& group, const BigInt& y) { op = Engine_Core::elg_op(group, y, 0); p_bytes = 0; } -/************************************************* -* ELG_Core Constructor * -*************************************************/ +/* +* ELG_Core Constructor +*/ ELG_Core::ELG_Core(RandomNumberGenerator& rng, const DL_Group& group, const BigInt& y, const BigInt& x) { @@ -44,9 +46,9 @@ ELG_Core::ELG_Core(RandomNumberGenerator& rng, } } -/************************************************* -* ELG_Core Copy Constructor * -*************************************************/ +/* +* ELG_Core Copy Constructor +*/ ELG_Core::ELG_Core(const ELG_Core& core) { op = 0; @@ -56,9 +58,9 @@ ELG_Core::ELG_Core(const ELG_Core& core) p_bytes = core.p_bytes; } -/************************************************* -* ELG_Core Assignment Operator * -*************************************************/ +/* +* ELG_Core Assignment Operator +*/ ELG_Core& ELG_Core::operator=(const ELG_Core& core) { delete op; @@ -69,18 +71,18 @@ ELG_Core& ELG_Core::operator=(const ELG_Core& core) return (*this); } -/************************************************* -* ElGamal Encrypt Operation * -*************************************************/ +/* +* ElGamal Encrypt Operation +*/ SecureVector<byte> ELG_Core::encrypt(const byte in[], u32bit length, const BigInt& k) const { return op->encrypt(in, length, k); } -/************************************************* -* ElGamal Decrypt Operation * -*************************************************/ +/* +* ElGamal Decrypt Operation +*/ SecureVector<byte> ELG_Core::decrypt(const byte in[], u32bit length) const { if(length != 2*p_bytes) diff --git a/src/pubkey/elgamal/elg_core.h b/src/pubkey/elgamal/elg_core.h index 5b7c36947..a7768a6ae 100644 --- a/src/pubkey/elgamal/elg_core.h +++ b/src/pubkey/elgamal/elg_core.h @@ -1,7 +1,9 @@ -/************************************************* -* ElGamal Core Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* ElGamal Core +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_ELGAMAL_CORE_H__ #define BOTAN_ELGAMAL_CORE_H__ @@ -12,9 +14,9 @@ namespace Botan { -/************************************************* -* ElGamal Core * -*************************************************/ +/* +* ElGamal Core +*/ class BOTAN_DLL ELG_Core { public: diff --git a/src/pubkey/elgamal/elg_op.cpp b/src/pubkey/elgamal/elg_op.cpp index 6c1686f22..1e476ab7a 100644 --- a/src/pubkey/elgamal/elg_op.cpp +++ b/src/pubkey/elgamal/elg_op.cpp @@ -1,15 +1,17 @@ -/************************************************* -* ElGamal Operations Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* ElGamal Operations +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/elg_op.h> namespace Botan { -/************************************************* -* Default_ELG_Op Constructor * -*************************************************/ +/* +* Default_ELG_Op Constructor +*/ Default_ELG_Op::Default_ELG_Op(const DL_Group& group, const BigInt& y, const BigInt& x) : p(group.get_p()) { @@ -21,9 +23,9 @@ Default_ELG_Op::Default_ELG_Op(const DL_Group& group, const BigInt& y, powermod_x_p = Fixed_Exponent_Power_Mod(x, p); } -/************************************************* -* Default ElGamal Encrypt Operation * -*************************************************/ +/* +* Default ElGamal Encrypt Operation +*/ SecureVector<byte> Default_ELG_Op::encrypt(const byte in[], u32bit length, const BigInt& k) const { @@ -40,9 +42,9 @@ SecureVector<byte> Default_ELG_Op::encrypt(const byte in[], u32bit length, return output; } -/************************************************* -* Default ElGamal Decrypt Operation * -*************************************************/ +/* +* Default ElGamal Decrypt Operation +*/ BigInt Default_ELG_Op::decrypt(const BigInt& a, const BigInt& b) const { if(a >= p || b >= p) diff --git a/src/pubkey/elgamal/elg_op.h b/src/pubkey/elgamal/elg_op.h index c75ff7d45..39ed897f4 100644 --- a/src/pubkey/elgamal/elg_op.h +++ b/src/pubkey/elgamal/elg_op.h @@ -1,7 +1,9 @@ -/************************************************* -* ElGamal Operations Header File * -* (C) 1999-2008 Jack Lloyd * -*************************************************/ +/* +* ElGamal Operations +* (C) 1999-2008 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_ELGAMAL_OPS_H__ #define BOTAN_ELGAMAL_OPS_H__ @@ -13,9 +15,9 @@ namespace Botan { -/************************************************* -* ElGamal Operation * -*************************************************/ +/* +* ElGamal Operation +*/ class BOTAN_DLL ELG_Operation { public: @@ -26,9 +28,9 @@ class BOTAN_DLL ELG_Operation virtual ~ELG_Operation() {} }; -/************************************************* -* Botan's Default ElGamal Operation * -*************************************************/ +/* +* Botan's Default ElGamal Operation +*/ class BOTAN_DLL Default_ELG_Op : public ELG_Operation { public: diff --git a/src/pubkey/elgamal/elgamal.cpp b/src/pubkey/elgamal/elgamal.cpp index 01b322d63..1f79df57a 100644 --- a/src/pubkey/elgamal/elgamal.cpp +++ b/src/pubkey/elgamal/elgamal.cpp @@ -1,7 +1,9 @@ -/************************************************* -* ElGamal Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* ElGamal +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/elgamal.h> #include <botan/numthry.h> @@ -11,9 +13,9 @@ namespace Botan { -/************************************************* -* ElGamal_PublicKey Constructor * -*************************************************/ +/* +* ElGamal_PublicKey Constructor +*/ ElGamal_PublicKey::ElGamal_PublicKey(const DL_Group& grp, const BigInt& y1) { group = grp; @@ -21,17 +23,17 @@ ElGamal_PublicKey::ElGamal_PublicKey(const DL_Group& grp, const BigInt& y1) X509_load_hook(); } -/************************************************* -* Algorithm Specific X.509 Initialization Code * -*************************************************/ +/* +* Algorithm Specific X.509 Initialization Code +*/ void ElGamal_PublicKey::X509_load_hook() { core = ELG_Core(group, y); } -/************************************************* -* ElGamal Encryption Function * -*************************************************/ +/* +* ElGamal Encryption Function +*/ SecureVector<byte> ElGamal_PublicKey::encrypt(const byte in[], u32bit length, RandomNumberGenerator& rng) const @@ -40,17 +42,17 @@ ElGamal_PublicKey::encrypt(const byte in[], u32bit length, return core.encrypt(in, length, k); } -/************************************************* -* Return the maximum input size in bits * -*************************************************/ +/* +* Return the maximum input size in bits +*/ u32bit ElGamal_PublicKey::max_input_bits() const { return (group_p().bits() - 1); } -/************************************************* -* ElGamal_PrivateKey Constructor * -*************************************************/ +/* +* ElGamal_PrivateKey Constructor +*/ ElGamal_PrivateKey::ElGamal_PrivateKey(RandomNumberGenerator& rng, const DL_Group& grp, const BigInt& x_arg) @@ -67,9 +69,9 @@ ElGamal_PrivateKey::ElGamal_PrivateKey(RandomNumberGenerator& rng, PKCS8_load_hook(rng, false); } -/************************************************* -* Algorithm Specific PKCS #8 Initialization Code * -*************************************************/ +/* +* Algorithm Specific PKCS #8 Initialization Code +*/ void ElGamal_PrivateKey::PKCS8_load_hook(RandomNumberGenerator& rng, bool generated) { @@ -83,18 +85,18 @@ void ElGamal_PrivateKey::PKCS8_load_hook(RandomNumberGenerator& rng, load_check(rng); } -/************************************************* -* ElGamal Decryption Function * -*************************************************/ +/* +* ElGamal Decryption Function +*/ SecureVector<byte> ElGamal_PrivateKey::decrypt(const byte in[], u32bit length) const { return core.decrypt(in, length); } -/************************************************* -* Check Private ElGamal Parameters * -*************************************************/ +/* +* Check Private ElGamal Parameters +*/ bool ElGamal_PrivateKey::check_key(RandomNumberGenerator& rng, bool strong) const { diff --git a/src/pubkey/elgamal/elgamal.h b/src/pubkey/elgamal/elgamal.h index 064bdd504..93e640f09 100644 --- a/src/pubkey/elgamal/elgamal.h +++ b/src/pubkey/elgamal/elgamal.h @@ -1,7 +1,9 @@ -/************************************************* -* ElGamal Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* ElGamal +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_ELGAMAL_H__ #define BOTAN_ELGAMAL_H__ @@ -11,9 +13,9 @@ namespace Botan { -/************************************************* -* ElGamal Public Key * -*************************************************/ +/* +* ElGamal Public Key +*/ class BOTAN_DLL ElGamal_PublicKey : public PK_Encrypting_Key, public virtual DL_Scheme_PublicKey { @@ -33,9 +35,9 @@ class BOTAN_DLL ElGamal_PublicKey : public PK_Encrypting_Key, void X509_load_hook(); }; -/************************************************* -* ElGamal Private Key * -*************************************************/ +/* +* ElGamal Private Key +*/ class BOTAN_DLL ElGamal_PrivateKey : public ElGamal_PublicKey, public PK_Decrypting_Key, public virtual DL_Scheme_PrivateKey diff --git a/src/pubkey/if_algo/if_algo.cpp b/src/pubkey/if_algo/if_algo.cpp index 929f488fd..556c86f6f 100644 --- a/src/pubkey/if_algo/if_algo.cpp +++ b/src/pubkey/if_algo/if_algo.cpp @@ -1,7 +1,9 @@ -/************************************************* -* IF Scheme Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* IF Scheme +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/if_algo.h> #include <botan/numthry.h> @@ -10,9 +12,9 @@ namespace Botan { -/************************************************* -* Return the X.509 public key encoder * -*************************************************/ +/* +* Return the X.509 public key encoder +*/ X509_Encoder* IF_Scheme_PublicKey::x509_encoder() const { class IF_Scheme_Encoder : public X509_Encoder @@ -42,9 +44,9 @@ X509_Encoder* IF_Scheme_PublicKey::x509_encoder() const return new IF_Scheme_Encoder(this); } -/************************************************* -* Return the X.509 public key decoder * -*************************************************/ +/* +* Return the X.509 public key decoder +*/ X509_Decoder* IF_Scheme_PublicKey::x509_decoder() { class IF_Scheme_Decoder : public X509_Decoder @@ -72,9 +74,9 @@ X509_Decoder* IF_Scheme_PublicKey::x509_decoder() return new IF_Scheme_Decoder(this); } -/************************************************* -* Return the PKCS #8 public key encoder * -*************************************************/ +/* +* Return the PKCS #8 public key encoder +*/ PKCS8_Encoder* IF_Scheme_PrivateKey::pkcs8_encoder() const { class IF_Scheme_Encoder : public PKCS8_Encoder @@ -111,9 +113,9 @@ PKCS8_Encoder* IF_Scheme_PrivateKey::pkcs8_encoder() const return new IF_Scheme_Encoder(this); } -/************************************************* -* Return the PKCS #8 public key decoder * -*************************************************/ +/* +* Return the PKCS #8 public key decoder +*/ PKCS8_Decoder* IF_Scheme_PrivateKey::pkcs8_decoder(RandomNumberGenerator& rng) { class IF_Scheme_Decoder : public PKCS8_Decoder @@ -154,17 +156,17 @@ PKCS8_Decoder* IF_Scheme_PrivateKey::pkcs8_decoder(RandomNumberGenerator& rng) return new IF_Scheme_Decoder(this, rng); } -/************************************************* -* Algorithm Specific X.509 Initialization Code * -*************************************************/ +/* +* Algorithm Specific X.509 Initialization Code +*/ void IF_Scheme_PublicKey::X509_load_hook() { core = IF_Core(e, n); } -/************************************************* -* Algorithm Specific PKCS #8 Initialization Code * -*************************************************/ +/* +* Algorithm Specific PKCS #8 Initialization Code +*/ void IF_Scheme_PrivateKey::PKCS8_load_hook(RandomNumberGenerator& rng, bool generated) { @@ -181,9 +183,9 @@ void IF_Scheme_PrivateKey::PKCS8_load_hook(RandomNumberGenerator& rng, load_check(rng); } -/************************************************* -* Check IF Scheme Public Parameters * -*************************************************/ +/* +* Check IF Scheme Public Parameters +*/ bool IF_Scheme_PublicKey::check_key(RandomNumberGenerator&, bool) const { if(n < 35 || n.is_even() || e < 2) @@ -191,9 +193,9 @@ bool IF_Scheme_PublicKey::check_key(RandomNumberGenerator&, bool) const return true; } -/************************************************* -* Check IF Scheme Private Parameters * -*************************************************/ +/* +* Check IF Scheme Private Parameters +*/ bool IF_Scheme_PrivateKey::check_key(RandomNumberGenerator& rng, bool strong) const { diff --git a/src/pubkey/if_algo/if_algo.h b/src/pubkey/if_algo/if_algo.h index 7afd7fed5..32a29be49 100644 --- a/src/pubkey/if_algo/if_algo.h +++ b/src/pubkey/if_algo/if_algo.h @@ -1,7 +1,9 @@ -/************************************************* -* IF Scheme Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* IF Scheme +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_IF_ALGO_H__ #define BOTAN_IF_ALGO_H__ diff --git a/src/pubkey/if_algo/if_core.cpp b/src/pubkey/if_algo/if_core.cpp index 97cacf9d8..d112e8a77 100644 --- a/src/pubkey/if_algo/if_core.cpp +++ b/src/pubkey/if_algo/if_core.cpp @@ -1,7 +1,9 @@ -/************************************************* -* IF Algorithm Core Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* IF Algorithm Core +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/if_core.h> #include <botan/numthry.h> @@ -17,18 +19,18 @@ const u32bit BLINDING_BITS = BOTAN_PRIVATE_KEY_OP_BLINDING_BITS; } -/************************************************* -* IF_Core Constructor * -*************************************************/ +/* +* IF_Core Constructor +*/ IF_Core::IF_Core(const BigInt& e, const BigInt& n) { op = Engine_Core::if_op(e, n, 0, 0, 0, 0, 0, 0); } -/************************************************* -* IF_Core Constructor * -*************************************************/ +/* +* IF_Core Constructor +*/ IF_Core::IF_Core(RandomNumberGenerator& rng, const BigInt& e, const BigInt& n, const BigInt& d, const BigInt& p, const BigInt& q, @@ -43,9 +45,9 @@ IF_Core::IF_Core(RandomNumberGenerator& rng, } } -/************************************************* -* IF_Core Copy Constructor * -*************************************************/ +/* +* IF_Core Copy Constructor +*/ IF_Core::IF_Core(const IF_Core& core) { op = 0; @@ -54,9 +56,9 @@ IF_Core::IF_Core(const IF_Core& core) blinder = core.blinder; } -/************************************************* -* IF_Core Assignment Operator * -*************************************************/ +/* +* IF_Core Assignment Operator +*/ IF_Core& IF_Core::operator=(const IF_Core& core) { delete op; @@ -66,17 +68,17 @@ IF_Core& IF_Core::operator=(const IF_Core& core) return (*this); } -/************************************************* -* IF Public Operation * -*************************************************/ +/* +* IF Public Operation +*/ BigInt IF_Core::public_op(const BigInt& i) const { return op->public_op(i); } -/************************************************* -* IF Private Operation * -*************************************************/ +/* +* IF Private Operation +*/ BigInt IF_Core::private_op(const BigInt& i) const { return blinder.unblind(op->private_op(blinder.blind(i))); diff --git a/src/pubkey/if_algo/if_core.h b/src/pubkey/if_algo/if_core.h index ae9fb3d09..b7f487706 100644 --- a/src/pubkey/if_algo/if_core.h +++ b/src/pubkey/if_algo/if_core.h @@ -1,7 +1,9 @@ -/************************************************* -* IF Algorithm Core Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* IF Algorithm Core +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_IF_CORE_H__ #define BOTAN_IF_CORE_H__ @@ -11,9 +13,9 @@ namespace Botan { -/************************************************* -* IF Core * -*************************************************/ +/* +* IF Core +*/ class BOTAN_DLL IF_Core { public: diff --git a/src/pubkey/if_algo/if_op.cpp b/src/pubkey/if_algo/if_op.cpp index 242911a2e..27aef453e 100644 --- a/src/pubkey/if_algo/if_op.cpp +++ b/src/pubkey/if_algo/if_op.cpp @@ -1,16 +1,18 @@ -/************************************************* -* IF (RSA/RW) Operation Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* IF (RSA/RW) Operation +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/if_op.h> #include <botan/numthry.h> namespace Botan { -/************************************************* -* Default_IF_Op Constructor * -*************************************************/ +/* +* Default_IF_Op Constructor +*/ Default_IF_Op::Default_IF_Op(const BigInt& e, const BigInt& n, const BigInt&, const BigInt& p, const BigInt& q, const BigInt& d1, const BigInt& d2, @@ -28,9 +30,9 @@ Default_IF_Op::Default_IF_Op(const BigInt& e, const BigInt& n, const BigInt&, } } -/************************************************* -* Default IF Private Operation * -*************************************************/ +/* +* Default IF Private Operation +*/ BigInt Default_IF_Op::private_op(const BigInt& i) const { if(q == 0) diff --git a/src/pubkey/if_algo/if_op.h b/src/pubkey/if_algo/if_op.h index 73f5390cf..516902fd9 100644 --- a/src/pubkey/if_algo/if_op.h +++ b/src/pubkey/if_algo/if_op.h @@ -1,7 +1,9 @@ -/************************************************* -* IF Operations Header File * -* (C) 1999-2008 Jack Lloyd * -*************************************************/ +/* +* IF Operations +* (C) 1999-2008 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_IF_OP_H__ #define BOTAN_IF_OP_H__ @@ -12,9 +14,9 @@ namespace Botan { -/************************************************* -* IF Operation * -*************************************************/ +/* +* IF Operation +*/ class BOTAN_DLL IF_Operation { public: @@ -24,9 +26,9 @@ class BOTAN_DLL IF_Operation virtual ~IF_Operation() {} }; -/************************************************* -* Default IF Operation * -*************************************************/ +/* +* Default IF Operation +*/ class BOTAN_DLL Default_IF_Op : public IF_Operation { public: diff --git a/src/pubkey/keypair/keypair.cpp b/src/pubkey/keypair/keypair.cpp index 940f0c028..486577fc5 100644 --- a/src/pubkey/keypair/keypair.cpp +++ b/src/pubkey/keypair/keypair.cpp @@ -1,7 +1,9 @@ -/************************************************* -* Keypair Checks Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* Keypair Checks +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/keypair.h> #include <botan/look_pk.h> @@ -11,9 +13,9 @@ namespace Botan { namespace KeyPair { -/************************************************* -* Check an encryption key pair for consistency * -*************************************************/ +/* +* Check an encryption key pair for consistency +*/ void check_key(RandomNumberGenerator& rng, PK_Encryptor* encryptor, PK_Decryptor* decryptor) { @@ -35,9 +37,9 @@ void check_key(RandomNumberGenerator& rng, throw Self_Test_Failure("Encryption key pair consistency failure"); } -/************************************************* -* Check a signature key pair for consistency * -*************************************************/ +/* +* Check a signature key pair for consistency +*/ void check_key(RandomNumberGenerator& rng, PK_Signer* signer, PK_Verifier* verifier) { diff --git a/src/pubkey/keypair/keypair.h b/src/pubkey/keypair/keypair.h index 8c42876e8..b1d5c2da0 100644 --- a/src/pubkey/keypair/keypair.h +++ b/src/pubkey/keypair/keypair.h @@ -1,7 +1,9 @@ -/************************************************* -* Keypair Checks Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* Keypair Checks +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_KEYPAIR_H__ #define BOTAN_KEYPAIR_H__ diff --git a/src/pubkey/nr/nr.cpp b/src/pubkey/nr/nr.cpp index 063eedbcc..ad4ae78d3 100644 --- a/src/pubkey/nr/nr.cpp +++ b/src/pubkey/nr/nr.cpp @@ -1,7 +1,9 @@ -/************************************************* -* Nyberg-Rueppel Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* Nyberg-Rueppel +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/nr.h> #include <botan/numthry.h> @@ -10,9 +12,9 @@ namespace Botan { -/************************************************* -* NR_PublicKey Constructor * -*************************************************/ +/* +* NR_PublicKey Constructor +*/ NR_PublicKey::NR_PublicKey(const DL_Group& grp, const BigInt& y1) { group = grp; @@ -20,41 +22,41 @@ NR_PublicKey::NR_PublicKey(const DL_Group& grp, const BigInt& y1) X509_load_hook(); } -/************************************************* -* Algorithm Specific X.509 Initialization Code * -*************************************************/ +/* +* Algorithm Specific X.509 Initialization Code +*/ void NR_PublicKey::X509_load_hook() { core = NR_Core(group, y); } -/************************************************* -* Nyberg-Rueppel Verification Function * -*************************************************/ +/* +* Nyberg-Rueppel Verification Function +*/ SecureVector<byte> NR_PublicKey::verify(const byte sig[], u32bit sig_len) const { return core.verify(sig, sig_len); } -/************************************************* -* Return the maximum input size in bits * -*************************************************/ +/* +* Return the maximum input size in bits +*/ u32bit NR_PublicKey::max_input_bits() const { return (group_q().bits() - 1); } -/************************************************* -* Return the size of each portion of the sig * -*************************************************/ +/* +* Return the size of each portion of the sig +*/ u32bit NR_PublicKey::message_part_size() const { return group_q().bytes(); } -/************************************************* -* Create a NR private key * -*************************************************/ +/* +* Create a NR private key +*/ NR_PrivateKey::NR_PrivateKey(RandomNumberGenerator& rng, const DL_Group& grp, const BigInt& x_arg) @@ -71,9 +73,9 @@ NR_PrivateKey::NR_PrivateKey(RandomNumberGenerator& rng, PKCS8_load_hook(rng, false); } -/************************************************* -* Algorithm Specific PKCS #8 Initialization Code * -*************************************************/ +/* +* Algorithm Specific PKCS #8 Initialization Code +*/ void NR_PrivateKey::PKCS8_load_hook(RandomNumberGenerator& rng, bool generated) { @@ -87,9 +89,9 @@ void NR_PrivateKey::PKCS8_load_hook(RandomNumberGenerator& rng, load_check(rng); } -/************************************************* -* Nyberg-Rueppel Signature Operation * -*************************************************/ +/* +* Nyberg-Rueppel Signature Operation +*/ SecureVector<byte> NR_PrivateKey::sign(const byte in[], u32bit length, RandomNumberGenerator& rng) const { @@ -103,9 +105,9 @@ SecureVector<byte> NR_PrivateKey::sign(const byte in[], u32bit length, return core.sign(in, length, k); } -/************************************************* -* Check Private Nyberg-Rueppel Parameters * -*************************************************/ +/* +* Check Private Nyberg-Rueppel Parameters +*/ bool NR_PrivateKey::check_key(RandomNumberGenerator& rng, bool strong) const { if(!DL_Scheme_PrivateKey::check_key(rng, strong) || x >= group_q()) diff --git a/src/pubkey/nr/nr.h b/src/pubkey/nr/nr.h index 21415bc25..144c5ec2a 100644 --- a/src/pubkey/nr/nr.h +++ b/src/pubkey/nr/nr.h @@ -1,7 +1,9 @@ -/************************************************* -* Nyberg-Rueppel Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* Nyberg-Rueppel +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_NYBERG_RUEPPEL_H__ #define BOTAN_NYBERG_RUEPPEL_H__ @@ -11,9 +13,9 @@ namespace Botan { -/************************************************* -* Nyberg-Rueppel Public Key * -*************************************************/ +/* +* Nyberg-Rueppel Public Key +*/ class BOTAN_DLL NR_PublicKey : public PK_Verifying_with_MR_Key, public virtual DL_Scheme_PublicKey { @@ -35,9 +37,9 @@ class BOTAN_DLL NR_PublicKey : public PK_Verifying_with_MR_Key, void X509_load_hook(); }; -/************************************************* -* Nyberg-Rueppel Private Key * -*************************************************/ +/* +* Nyberg-Rueppel Private Key +*/ class BOTAN_DLL NR_PrivateKey : public NR_PublicKey, public PK_Signing_Key, public virtual DL_Scheme_PrivateKey diff --git a/src/pubkey/nr/nr_core.cpp b/src/pubkey/nr/nr_core.cpp index f9dfa4024..50be8fbb3 100644 --- a/src/pubkey/nr/nr_core.cpp +++ b/src/pubkey/nr/nr_core.cpp @@ -1,7 +1,9 @@ -/************************************************* -* NR Core Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* NR Core +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/nr_core.h> #include <botan/numthry.h> @@ -11,17 +13,17 @@ namespace Botan { -/************************************************* -* NR_Core Constructor * -*************************************************/ +/* +* NR_Core Constructor +*/ NR_Core::NR_Core(const DL_Group& group, const BigInt& y, const BigInt& x) { op = Engine_Core::nr_op(group, y, x); } -/************************************************* -* NR_Core Copy Constructor * -*************************************************/ +/* +* NR_Core Copy Constructor +*/ NR_Core::NR_Core(const NR_Core& core) { op = 0; @@ -29,9 +31,9 @@ NR_Core::NR_Core(const NR_Core& core) op = core.op->clone(); } -/************************************************* -* NR_Core Assignment Operator * -*************************************************/ +/* +* NR_Core Assignment Operator +*/ NR_Core& NR_Core::operator=(const NR_Core& core) { delete op; @@ -40,17 +42,17 @@ NR_Core& NR_Core::operator=(const NR_Core& core) return (*this); } -/************************************************* -* NR Verification Operation * -*************************************************/ +/* +* NR Verification Operation +*/ SecureVector<byte> NR_Core::verify(const byte in[], u32bit length) const { return op->verify(in, length); } -/************************************************* -* NR Signature Operation * -*************************************************/ +/* +* NR Signature Operation +*/ SecureVector<byte> NR_Core::sign(const byte in[], u32bit length, const BigInt& k) const { diff --git a/src/pubkey/nr/nr_core.h b/src/pubkey/nr/nr_core.h index 69a605c8d..483773622 100644 --- a/src/pubkey/nr/nr_core.h +++ b/src/pubkey/nr/nr_core.h @@ -1,7 +1,9 @@ -/************************************************* -* NR Core Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* NR Core +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_NR_CORE_H__ #define BOTAN_NR_CORE_H__ @@ -11,9 +13,9 @@ namespace Botan { -/************************************************* -* NR Core * -*************************************************/ +/* +* NR Core +*/ class BOTAN_DLL NR_Core { public: diff --git a/src/pubkey/nr/nr_op.cpp b/src/pubkey/nr/nr_op.cpp index 0c42a7eac..b5efa3d37 100644 --- a/src/pubkey/nr/nr_op.cpp +++ b/src/pubkey/nr/nr_op.cpp @@ -1,15 +1,17 @@ -/************************************************* -* NR Operations Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* NR Operations +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/nr_op.h> namespace Botan { -/************************************************* -* Default_NR_Op Constructor * -*************************************************/ +/* +* Default_NR_Op Constructor +*/ Default_NR_Op::Default_NR_Op(const DL_Group& grp, const BigInt& y1, const BigInt& x1) : x(x1), y(y1), group(grp) { @@ -19,9 +21,9 @@ Default_NR_Op::Default_NR_Op(const DL_Group& grp, const BigInt& y1, mod_q = Modular_Reducer(group.get_q()); } -/************************************************* -* Default NR Verify Operation * -*************************************************/ +/* +* Default NR Verify Operation +*/ SecureVector<byte> Default_NR_Op::verify(const byte in[], u32bit length) const { const BigInt& q = group.get_q(); @@ -39,9 +41,9 @@ SecureVector<byte> Default_NR_Op::verify(const byte in[], u32bit length) const return BigInt::encode(mod_q.reduce(c - i)); } -/************************************************* -* Default NR Sign Operation * -*************************************************/ +/* +* Default NR Sign Operation +*/ SecureVector<byte> Default_NR_Op::sign(const byte in[], u32bit length, const BigInt& k) const { diff --git a/src/pubkey/nr/nr_op.h b/src/pubkey/nr/nr_op.h index 11c2cd26a..cba1465f2 100644 --- a/src/pubkey/nr/nr_op.h +++ b/src/pubkey/nr/nr_op.h @@ -1,7 +1,9 @@ -/************************************************* -* NR Operations Header File * -* (C) 1999-2008 Jack Lloyd * -*************************************************/ +/* +* NR Operations +* (C) 1999-2008 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_NR_OPS_H__ #define BOTAN_NR_OPS_H__ @@ -13,9 +15,9 @@ namespace Botan { -/************************************************* -* NR Operation * -*************************************************/ +/* +* NR Operation +*/ class BOTAN_DLL NR_Operation { public: @@ -26,9 +28,9 @@ class BOTAN_DLL NR_Operation virtual ~NR_Operation() {} }; -/************************************************* -* Botan's Default NR Operation * -*************************************************/ +/* +* Botan's Default NR Operation +*/ class BOTAN_DLL Default_NR_Op : public NR_Operation { public: diff --git a/src/pubkey/pubkey/pk_algs.cpp b/src/pubkey/pubkey/pk_algs.cpp index 3d33d8f35..99d7294f0 100644 --- a/src/pubkey/pubkey/pk_algs.cpp +++ b/src/pubkey/pubkey/pk_algs.cpp @@ -1,7 +1,9 @@ -/************************************************* -* PK Key Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* PK Key +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/pk_algs.h> @@ -35,9 +37,9 @@ namespace Botan { -/************************************************* -* Get an PK public key object * -*************************************************/ +/* +* Get an PK public key object +*/ Public_Key* get_public_key(const std::string& alg_name) { #if defined(BOTAN_HAS_RSA) @@ -71,9 +73,9 @@ Public_Key* get_public_key(const std::string& alg_name) return 0; } -/************************************************* -* Get an PK private key object * -*************************************************/ +/* +* Get an PK private key object +*/ Private_Key* get_private_key(const std::string& alg_name) { #if defined(BOTAN_HAS_RSA) diff --git a/src/pubkey/pubkey/pk_algs.h b/src/pubkey/pubkey/pk_algs.h index 2bb9a546e..d32c9365b 100644 --- a/src/pubkey/pubkey/pk_algs.h +++ b/src/pubkey/pubkey/pk_algs.h @@ -1,7 +1,9 @@ -/************************************************* -* PK Key Factory Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* PK Key Factory +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_PK_KEY_FACTORY_H__ #define BOTAN_PK_KEY_FACTORY_H__ diff --git a/src/pubkey/pubkey/pk_filts.cpp b/src/pubkey/pubkey/pk_filts.cpp index 7fcb003e7..18da9c10b 100644 --- a/src/pubkey/pubkey/pk_filts.cpp +++ b/src/pubkey/pubkey/pk_filts.cpp @@ -1,6 +1,8 @@ /* -* PK Filters Source File +* PK Filters * (C) 1999-2009 Jack Lloyd +* +* Distributed under the terms of the Botan license */ #include <botan/pk_filts.h> diff --git a/src/pubkey/pubkey/pk_filts.h b/src/pubkey/pubkey/pk_filts.h index c127e709f..8bf3fc238 100644 --- a/src/pubkey/pubkey/pk_filts.h +++ b/src/pubkey/pubkey/pk_filts.h @@ -1,6 +1,8 @@ /* -* PK Filters Header File +* PK Filters * (C) 1999-2009 Jack Lloyd +* +* Distributed under the terms of the Botan license */ #ifndef BOTAN_PK_FILTERS_H__ diff --git a/src/pubkey/pubkey/pk_keys.cpp b/src/pubkey/pubkey/pk_keys.cpp index 758d34dee..b93158558 100644 --- a/src/pubkey/pubkey/pk_keys.cpp +++ b/src/pubkey/pubkey/pk_keys.cpp @@ -1,16 +1,18 @@ -/************************************************* -* PK Key Types Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* PK Key Types +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/pk_keys.h> #include <botan/oids.h> namespace Botan { -/************************************************* -* Default OID access * -*************************************************/ +/* +* Default OID access +*/ OID Public_Key::get_oid() const { try { @@ -22,27 +24,27 @@ OID Public_Key::get_oid() const } } -/************************************************* -* Run checks on a loaded public key * -*************************************************/ +/* +* Run checks on a loaded public key +*/ void Public_Key::load_check(RandomNumberGenerator& rng) const { if(!check_key(rng, BOTAN_PUBLIC_KEY_STRONG_CHECKS_ON_LOAD)) throw Invalid_Argument(algo_name() + ": Invalid public key"); } -/************************************************* -* Run checks on a loaded private key * -*************************************************/ +/* +* Run checks on a loaded private key +*/ void Private_Key::load_check(RandomNumberGenerator& rng) const { if(!check_key(rng, BOTAN_PRIVATE_KEY_STRONG_CHECKS_ON_LOAD)) throw Invalid_Argument(algo_name() + ": Invalid private key"); } -/************************************************* -* Run checks on a generated private key * -*************************************************/ +/* +* Run checks on a generated private key +*/ void Private_Key::gen_check(RandomNumberGenerator& rng) const { if(!check_key(rng, BOTAN_PRIVATE_KEY_STRONG_CHECKS_ON_GENERATE)) diff --git a/src/pubkey/pubkey/pk_keys.h b/src/pubkey/pubkey/pk_keys.h index 0b5994508..5b612577d 100644 --- a/src/pubkey/pubkey/pk_keys.h +++ b/src/pubkey/pubkey/pk_keys.h @@ -1,7 +1,9 @@ -/************************************************* -* PK Key Types Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* PK Key Types +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_PK_KEYS_H__ #define BOTAN_PK_KEYS_H__ @@ -166,9 +168,9 @@ class BOTAN_DLL PK_Key_Agreement_Key : public virtual Private_Key virtual ~PK_Key_Agreement_Key() {} }; -/************************************************* -* Typedefs * -*************************************************/ +/* +* Typedefs +*/ typedef PK_Key_Agreement_Key PK_KA_Key; typedef Public_Key X509_PublicKey; typedef Private_Key PKCS8_PrivateKey; diff --git a/src/pubkey/pubkey/pkcs8.cpp b/src/pubkey/pubkey/pkcs8.cpp index 179be57fe..8a464ecfe 100644 --- a/src/pubkey/pubkey/pkcs8.cpp +++ b/src/pubkey/pubkey/pkcs8.cpp @@ -1,7 +1,9 @@ -/************************************************* -* PKCS #8 Source File * -* (C) 1999-2008 Jack Lloyd * -*************************************************/ +/* +* PKCS #8 +* (C) 1999-2008 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/pkcs8.h> #include <botan/get_pbe.h> @@ -19,9 +21,9 @@ namespace PKCS8 { namespace { -/************************************************* -* Get info from an EncryptedPrivateKeyInfo * -*************************************************/ +/* +* Get info from an EncryptedPrivateKeyInfo +*/ SecureVector<byte> PKCS8_extract(DataSource& source, AlgorithmIdentifier& pbe_alg_id) { @@ -36,9 +38,9 @@ SecureVector<byte> PKCS8_extract(DataSource& source, return key_data; } -/************************************************* -* PEM decode and/or decrypt a private key * -*************************************************/ +/* +* PEM decode and/or decrypt a private key +*/ SecureVector<byte> PKCS8_decode(DataSource& source, const User_Interface& ui, AlgorithmIdentifier& pk_alg_id) { @@ -131,9 +133,9 @@ SecureVector<byte> PKCS8_decode(DataSource& source, const User_Interface& ui, } -/************************************************* -* DER or PEM encode a PKCS #8 private key * -*************************************************/ +/* +* DER or PEM encode a PKCS #8 private key +*/ void encode(const Private_Key& key, Pipe& pipe, X509_Encoding encoding) { std::auto_ptr<PKCS8_Encoder> encoder(key.pkcs8_encoder()); @@ -157,9 +159,9 @@ void encode(const Private_Key& key, Pipe& pipe, X509_Encoding encoding) pipe.write(contents); } -/************************************************* -* Encode and encrypt a PKCS #8 private key * -*************************************************/ +/* +* Encode and encrypt a PKCS #8 private key +*/ void encrypt_key(const Private_Key& key, Pipe& pipe, RandomNumberGenerator& rng, @@ -197,9 +199,9 @@ void encrypt_key(const Private_Key& key, pipe.write(enc_key); } -/************************************************* -* PEM encode a PKCS #8 private key * -*************************************************/ +/* +* PEM encode a PKCS #8 private key +*/ std::string PEM_encode(const Private_Key& key) { Pipe pem; @@ -209,9 +211,9 @@ std::string PEM_encode(const Private_Key& key) return pem.read_all_as_string(); } -/************************************************* -* Encrypt and PEM encode a PKCS #8 private key * -*************************************************/ +/* +* Encrypt and PEM encode a PKCS #8 private key +*/ std::string PEM_encode(const Private_Key& key, RandomNumberGenerator& rng, const std::string& pass, @@ -227,9 +229,9 @@ std::string PEM_encode(const Private_Key& key, return pem.read_all_as_string(); } -/************************************************* -* Extract a private key and return it * -*************************************************/ +/* +* Extract a private key and return it +*/ Private_Key* load_key(DataSource& source, RandomNumberGenerator& rng, const User_Interface& ui) @@ -259,9 +261,9 @@ Private_Key* load_key(DataSource& source, return key.release(); } -/************************************************* -* Extract a private key and return it * -*************************************************/ +/* +* Extract a private key and return it +*/ Private_Key* load_key(const std::string& fsname, RandomNumberGenerator& rng, const User_Interface& ui) @@ -270,9 +272,9 @@ Private_Key* load_key(const std::string& fsname, return PKCS8::load_key(source, rng, ui); } -/************************************************* -* Extract a private key and return it * -*************************************************/ +/* +* Extract a private key and return it +*/ Private_Key* load_key(DataSource& source, RandomNumberGenerator& rng, const std::string& pass) @@ -280,9 +282,9 @@ Private_Key* load_key(DataSource& source, return PKCS8::load_key(source, rng, User_Interface(pass)); } -/************************************************* -* Extract a private key and return it * -*************************************************/ +/* +* Extract a private key and return it +*/ Private_Key* load_key(const std::string& fsname, RandomNumberGenerator& rng, const std::string& pass) @@ -290,9 +292,9 @@ Private_Key* load_key(const std::string& fsname, return PKCS8::load_key(fsname, rng, User_Interface(pass)); } -/************************************************* -* Make a copy of this private key * -*************************************************/ +/* +* Make a copy of this private key +*/ Private_Key* copy_key(const Private_Key& key, RandomNumberGenerator& rng) { diff --git a/src/pubkey/pubkey/pkcs8.h b/src/pubkey/pubkey/pkcs8.h index 863a80b86..87f8ba326 100644 --- a/src/pubkey/pubkey/pkcs8.h +++ b/src/pubkey/pubkey/pkcs8.h @@ -1,7 +1,9 @@ -/************************************************* -* PKCS #8 Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* PKCS #8 +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_PKCS8_H__ #define BOTAN_PKCS8_H__ @@ -33,9 +35,9 @@ class BOTAN_DLL PKCS8_Encoder virtual ~PKCS8_Encoder() {} }; -/************************************************* -* PKCS #8 Private Key Decoder * -*************************************************/ +/* +* PKCS #8 Private Key Decoder +*/ class BOTAN_DLL PKCS8_Decoder { public: diff --git a/src/pubkey/pubkey/pubkey.cpp b/src/pubkey/pubkey/pubkey.cpp index 0e7890c5d..4ddaa6fb6 100644 --- a/src/pubkey/pubkey/pubkey.cpp +++ b/src/pubkey/pubkey/pubkey.cpp @@ -1,7 +1,9 @@ -/************************************************* -* Public Key Base Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* Public Key Base +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/pubkey.h> #include <botan/der_enc.h> @@ -13,52 +15,52 @@ namespace Botan { -/************************************************* -* Encrypt a message * -*************************************************/ +/* +* Encrypt a message +*/ SecureVector<byte> PK_Encryptor::encrypt(const byte in[], u32bit len, RandomNumberGenerator& rng) const { return enc(in, len, rng); } -/************************************************* -* Encrypt a message * -*************************************************/ +/* +* Encrypt a message +*/ SecureVector<byte> PK_Encryptor::encrypt(const MemoryRegion<byte>& in, RandomNumberGenerator& rng) const { return enc(in.begin(), in.size(), rng); } -/************************************************* -* Decrypt a message * -*************************************************/ +/* +* Decrypt a message +*/ SecureVector<byte> PK_Decryptor::decrypt(const byte in[], u32bit len) const { return dec(in, len); } -/************************************************* -* Decrypt a message * -*************************************************/ +/* +* Decrypt a message +*/ SecureVector<byte> PK_Decryptor::decrypt(const MemoryRegion<byte>& in) const { return dec(in.begin(), in.size()); } -/************************************************* -* PK_Encryptor_MR_with_EME Constructor * -*************************************************/ +/* +* PK_Encryptor_MR_with_EME Constructor +*/ PK_Encryptor_MR_with_EME::PK_Encryptor_MR_with_EME(const PK_Encrypting_Key& k, EME* eme_obj) : key(k), encoder(eme_obj) { } -/************************************************* -* Encrypt a message * -*************************************************/ +/* +* Encrypt a message +*/ SecureVector<byte> PK_Encryptor_MR_with_EME::enc(const byte msg[], u32bit length, @@ -76,9 +78,9 @@ PK_Encryptor_MR_with_EME::enc(const byte msg[], return key.encrypt(message, message.size(), rng); } -/************************************************* -* Return the max size, in bytes, of a message * -*************************************************/ +/* +* Return the max size, in bytes, of a message +*/ u32bit PK_Encryptor_MR_with_EME::maximum_input_size() const { if(!encoder) @@ -87,18 +89,18 @@ u32bit PK_Encryptor_MR_with_EME::maximum_input_size() const return encoder->maximum_input_size(key.max_input_bits()); } -/************************************************* -* PK_Decryptor_MR_with_EME Constructor * -*************************************************/ +/* +* PK_Decryptor_MR_with_EME Constructor +*/ PK_Decryptor_MR_with_EME::PK_Decryptor_MR_with_EME(const PK_Decrypting_Key& k, EME* eme_obj) : key(k), encoder(eme_obj) { } -/************************************************* -* Decrypt a message * -*************************************************/ +/* +* Decrypt a message +*/ SecureVector<byte> PK_Decryptor_MR_with_EME::dec(const byte msg[], u32bit length) const { @@ -119,18 +121,18 @@ SecureVector<byte> PK_Decryptor_MR_with_EME::dec(const byte msg[], } } -/************************************************* -* PK_Signer Constructor * -*************************************************/ +/* +* PK_Signer Constructor +*/ PK_Signer::PK_Signer(const PK_Signing_Key& k, EMSA* emsa_obj) : key(k), emsa(emsa_obj) { sig_format = IEEE_1363; } -/************************************************* -* Set the signature format * -*************************************************/ +/* +* Set the signature format +*/ void PK_Signer::set_output_format(Signature_Format format) { if(key.message_parts() == 1 && format != IEEE_1363) @@ -139,9 +141,9 @@ void PK_Signer::set_output_format(Signature_Format format) sig_format = format; } -/************************************************* -* Sign a message * -*************************************************/ +/* +* Sign a message +*/ SecureVector<byte> PK_Signer::sign_message(const byte msg[], u32bit length, RandomNumberGenerator& rng) { @@ -149,42 +151,42 @@ SecureVector<byte> PK_Signer::sign_message(const byte msg[], u32bit length, return signature(rng); } -/************************************************* -* Sign a message * -*************************************************/ +/* +* Sign a message +*/ SecureVector<byte> PK_Signer::sign_message(const MemoryRegion<byte>& msg, RandomNumberGenerator& rng) { return sign_message(msg, msg.size(), rng); } -/************************************************* -* Add more to the message to be signed * -*************************************************/ +/* +* Add more to the message to be signed +*/ void PK_Signer::update(const byte in[], u32bit length) { emsa->update(in, length); } -/************************************************* -* Add more to the message to be signed * -*************************************************/ +/* +* Add more to the message to be signed +*/ void PK_Signer::update(byte in) { update(&in, 1); } -/************************************************* -* Add more to the message to be signed * -*************************************************/ +/* +* Add more to the message to be signed +*/ void PK_Signer::update(const MemoryRegion<byte>& in) { update(in, in.size()); } -/************************************************* -* Create a signature * -*************************************************/ +/* +* Create a signature +*/ SecureVector<byte> PK_Signer::signature(RandomNumberGenerator& rng) { SecureVector<byte> encoded = emsa->encoding_of(emsa->raw_data(), @@ -217,26 +219,26 @@ SecureVector<byte> PK_Signer::signature(RandomNumberGenerator& rng) to_string(sig_format)); } -/************************************************* -* PK_Verifier Constructor * -*************************************************/ +/* +* PK_Verifier Constructor +*/ PK_Verifier::PK_Verifier(EMSA* emsa_obj) { emsa = emsa_obj; sig_format = IEEE_1363; } -/************************************************* -* PK_Verifier Destructor * -*************************************************/ +/* +* PK_Verifier Destructor +*/ PK_Verifier::~PK_Verifier() { delete emsa; } -/************************************************* -* Set the signature format * -*************************************************/ +/* +* Set the signature format +*/ void PK_Verifier::set_input_format(Signature_Format format) { if(key_message_parts() == 1 && format != IEEE_1363) @@ -244,18 +246,18 @@ void PK_Verifier::set_input_format(Signature_Format format) sig_format = format; } -/************************************************* -* Verify a message * -*************************************************/ +/* +* Verify a message +*/ bool PK_Verifier::verify_message(const MemoryRegion<byte>& msg, const MemoryRegion<byte>& sig) { return verify_message(msg, msg.size(), sig, sig.size()); } -/************************************************* -* Verify a message * -*************************************************/ +/* +* Verify a message +*/ bool PK_Verifier::verify_message(const byte msg[], u32bit msg_length, const byte sig[], u32bit sig_length) { @@ -263,41 +265,41 @@ bool PK_Verifier::verify_message(const byte msg[], u32bit msg_length, return check_signature(sig, sig_length); } -/************************************************* -* Append to the message * -*************************************************/ +/* +* Append to the message +*/ void PK_Verifier::update(const byte in[], u32bit length) { emsa->update(in, length); } -/************************************************* -* Append to the message * -*************************************************/ +/* +* Append to the message +*/ void PK_Verifier::update(byte in) { update(&in, 1); } -/************************************************* -* Append to the message * -*************************************************/ +/* +* Append to the message +*/ void PK_Verifier::update(const MemoryRegion<byte>& in) { update(in, in.size()); } -/************************************************* -* Check a signature * -*************************************************/ +/* +* Check a signature +*/ bool PK_Verifier::check_signature(const MemoryRegion<byte>& sig) { return check_signature(sig, sig.size()); } -/************************************************* -* Check a signature * -*************************************************/ +/* +* Check a signature +*/ bool PK_Verifier::check_signature(const byte sig[], u32bit length) { try { @@ -332,9 +334,9 @@ bool PK_Verifier::check_signature(const byte sig[], u32bit length) catch(Decoding_Error) { return false; } } -/************************************************* -* Verify a signature * -*************************************************/ +/* +* Verify a signature +*/ bool PK_Verifier_with_MR::validate_signature(const MemoryRegion<byte>& msg, const byte sig[], u32bit sig_len) { @@ -342,9 +344,9 @@ bool PK_Verifier_with_MR::validate_signature(const MemoryRegion<byte>& msg, return emsa->verify(output_of_key, msg, key.max_input_bits()); } -/************************************************* -* Verify a signature * -*************************************************/ +/* +* Verify a signature +*/ bool PK_Verifier_wo_MR::validate_signature(const MemoryRegion<byte>& msg, const byte sig[], u32bit sig_len) { @@ -356,18 +358,18 @@ bool PK_Verifier_wo_MR::validate_signature(const MemoryRegion<byte>& msg, return key.verify(encoded, encoded.size(), sig, sig_len); } -/************************************************* -* PK_Key_Agreement Constructor * -*************************************************/ +/* +* PK_Key_Agreement Constructor +*/ PK_Key_Agreement::PK_Key_Agreement(const PK_Key_Agreement_Key& k, KDF* kdf_obj) : key(k), kdf(kdf_obj) { } -/************************************************* -* Perform Key Agreement Operation * -*************************************************/ +/* +* Perform Key Agreement Operation +*/ SymmetricKey PK_Key_Agreement::derive_key(u32bit key_len, const byte in[], u32bit in_len, const std::string& params) const @@ -377,9 +379,9 @@ SymmetricKey PK_Key_Agreement::derive_key(u32bit key_len, params.length()); } -/************************************************* -* Perform Key Agreement Operation * -*************************************************/ +/* +* Perform Key Agreement Operation +*/ SymmetricKey PK_Key_Agreement::derive_key(u32bit key_len, const byte in[], u32bit in_len, const byte params[], u32bit params_len) const diff --git a/src/pubkey/pubkey/pubkey.h b/src/pubkey/pubkey/pubkey.h index 6073fef21..815550edd 100644 --- a/src/pubkey/pubkey/pubkey.h +++ b/src/pubkey/pubkey/pubkey.h @@ -1,7 +1,9 @@ -/************************************************* -* Public Key Interface Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* Public Key Interface +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_PUBKEY_H__ #define BOTAN_PUBKEY_H__ @@ -255,9 +257,9 @@ class BOTAN_DLL PK_Verifier PK_Verifier& operator=(const PK_Verifier&); }; -/************************************************* -* Key Agreement * -*************************************************/ +/* +* Key Agreement +*/ class BOTAN_DLL PK_Key_Agreement { public: diff --git a/src/pubkey/pubkey/pubkey_enums.cpp b/src/pubkey/pubkey/pubkey_enums.cpp index fd230d6f4..327107dd1 100644 --- a/src/pubkey/pubkey/pubkey_enums.cpp +++ b/src/pubkey/pubkey/pubkey_enums.cpp @@ -1,7 +1,9 @@ -/************************************************* -* KeyUsage Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* KeyUsage +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/pubkey_enums.h> #include <botan/ber_dec.h> @@ -10,9 +12,9 @@ namespace Botan { namespace BER { -/************************************************* -* Decode a BER encoded KeyUsage * -*************************************************/ +/* +* Decode a BER encoded KeyUsage +*/ void decode(BER_Decoder& source, Key_Constraints& key_usage) { BER_Object obj = source.get_next_object(); diff --git a/src/pubkey/pubkey/pubkey_enums.h b/src/pubkey/pubkey/pubkey_enums.h index eaed24921..53e319f38 100644 --- a/src/pubkey/pubkey/pubkey_enums.h +++ b/src/pubkey/pubkey/pubkey_enums.h @@ -1,7 +1,9 @@ -/************************************************* -* Enumerations Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* Enumerations +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_ENUMS_H__ #define BOTAN_ENUMS_H__ @@ -55,9 +57,9 @@ enum CRL_Code { OCSP_UNKNOWN = 0xFF02 }; -/************************************************* -* Various Other Enumerations * -*************************************************/ +/* +* Various Other Enumerations +*/ /** * The two types of X509 encoding supported by Botan. diff --git a/src/pubkey/pubkey/x509_key.cpp b/src/pubkey/pubkey/x509_key.cpp index 26ce16a72..455e627f3 100644 --- a/src/pubkey/pubkey/x509_key.cpp +++ b/src/pubkey/pubkey/x509_key.cpp @@ -1,7 +1,9 @@ -/************************************************* -* X.509 Public Key Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* X.509 Public Key +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/x509_key.h> #include <botan/filters.h> @@ -17,9 +19,9 @@ namespace Botan { namespace X509 { -/************************************************* -* DER or PEM encode a X.509 public key * -*************************************************/ +/* +* DER or PEM encode a X.509 public key +*/ void encode(const Public_Key& key, Pipe& pipe, X509_Encoding encoding) { std::auto_ptr<X509_Encoder> encoder(key.x509_encoder()); @@ -40,9 +42,9 @@ void encode(const Public_Key& key, Pipe& pipe, X509_Encoding encoding) pipe.write(der); } -/************************************************* -* PEM encode a X.509 public key * -*************************************************/ +/* +* PEM encode a X.509 public key +*/ std::string PEM_encode(const Public_Key& key) { Pipe pem; @@ -52,9 +54,9 @@ std::string PEM_encode(const Public_Key& key) return pem.read_all_as_string(); } -/************************************************* -* Extract a public key and return it * -*************************************************/ +/* +* Extract a public key and return it +*/ Public_Key* load_key(DataSource& source) { try { @@ -113,27 +115,27 @@ Public_Key* load_key(DataSource& source) } } -/************************************************* -* Extract a public key and return it * -*************************************************/ +/* +* Extract a public key and return it +*/ Public_Key* load_key(const std::string& fsname) { DataSource_Stream source(fsname, true); return X509::load_key(source); } -/************************************************* -* Extract a public key and return it * -*************************************************/ +/* +* Extract a public key and return it +*/ Public_Key* load_key(const MemoryRegion<byte>& mem) { DataSource_Memory source(mem); return X509::load_key(source); } -/************************************************* -* Make a copy of this public key * -*************************************************/ +/* +* Make a copy of this public key +*/ Public_Key* copy_key(const Public_Key& key) { Pipe bits; @@ -144,9 +146,9 @@ Public_Key* copy_key(const Public_Key& key) return X509::load_key(source); } -/************************************************* -* Find the allowable key constraints * -*************************************************/ +/* +* Find the allowable key constraints +*/ Key_Constraints find_constraints(const Public_Key& pub_key, Key_Constraints limits) { diff --git a/src/pubkey/pubkey/x509_key.h b/src/pubkey/pubkey/x509_key.h index b60a3af05..9404b7ecc 100644 --- a/src/pubkey/pubkey/x509_key.h +++ b/src/pubkey/pubkey/x509_key.h @@ -1,7 +1,9 @@ -/************************************************* -* X.509 Public Key Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* X.509 Public Key +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_X509_PUBLIC_KEY_H__ #define BOTAN_X509_PUBLIC_KEY_H__ @@ -40,9 +42,9 @@ class BOTAN_DLL X509_Decoder */ namespace X509 { -/************************************************* -* X.509 Public Key Encoding/Decoding * -*************************************************/ +/* +* X.509 Public Key Encoding/Decoding +*/ /** * Encode a key into a pipe. diff --git a/src/pubkey/rsa/rsa.cpp b/src/pubkey/rsa/rsa.cpp index 7b74f3c57..83e6e1b17 100644 --- a/src/pubkey/rsa/rsa.cpp +++ b/src/pubkey/rsa/rsa.cpp @@ -1,7 +1,9 @@ -/************************************************* -* RSA Source File * -* (C) 1999-2008 Jack Lloyd * -*************************************************/ +/* +* RSA +* (C) 1999-2008 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/rsa.h> #include <botan/parsing.h> @@ -11,9 +13,9 @@ namespace Botan { -/************************************************* -* RSA_PublicKey Constructor * -*************************************************/ +/* +* RSA_PublicKey Constructor +*/ RSA_PublicKey::RSA_PublicKey(const BigInt& mod, const BigInt& exp) { n = mod; @@ -21,9 +23,9 @@ RSA_PublicKey::RSA_PublicKey(const BigInt& mod, const BigInt& exp) X509_load_hook(); } -/************************************************* -* RSA Public Operation * -*************************************************/ +/* +* RSA Public Operation +*/ BigInt RSA_PublicKey::public_op(const BigInt& i) const { if(i >= n) @@ -31,9 +33,9 @@ BigInt RSA_PublicKey::public_op(const BigInt& i) const return core.public_op(i); } -/************************************************* -* RSA Encryption Function * -*************************************************/ +/* +* RSA Encryption Function +*/ SecureVector<byte> RSA_PublicKey::encrypt(const byte in[], u32bit len, RandomNumberGenerator&) const { @@ -41,18 +43,18 @@ SecureVector<byte> RSA_PublicKey::encrypt(const byte in[], u32bit len, return BigInt::encode_1363(public_op(i), n.bytes()); } -/************************************************* -* RSA Verification Function * -*************************************************/ +/* +* RSA Verification Function +*/ SecureVector<byte> RSA_PublicKey::verify(const byte in[], u32bit len) const { BigInt i(in, len); return BigInt::encode(public_op(i)); } -/************************************************* -* Create a RSA private key * -*************************************************/ +/* +* Create a RSA private key +*/ RSA_PrivateKey::RSA_PrivateKey(RandomNumberGenerator& rng, u32bit bits, u32bit exp) { @@ -73,9 +75,9 @@ RSA_PrivateKey::RSA_PrivateKey(RandomNumberGenerator& rng, throw Self_Test_Failure(algo_name() + " private key generation failed"); } -/************************************************* -* RSA_PrivateKey Constructor * -*************************************************/ +/* +* RSA_PrivateKey Constructor +*/ RSA_PrivateKey::RSA_PrivateKey(RandomNumberGenerator& rng, const BigInt& prime1, const BigInt& prime2, const BigInt& exp, const BigInt& d_exp, @@ -93,9 +95,9 @@ RSA_PrivateKey::RSA_PrivateKey(RandomNumberGenerator& rng, PKCS8_load_hook(rng); } -/************************************************* -* RSA Private Operation * -*************************************************/ +/* +* RSA Private Operation +*/ BigInt RSA_PrivateKey::private_op(const byte in[], u32bit length) const { BigInt i(in, length); @@ -108,26 +110,26 @@ BigInt RSA_PrivateKey::private_op(const byte in[], u32bit length) const return r; } -/************************************************* -* RSA Decryption Operation * -*************************************************/ +/* +* RSA Decryption Operation +*/ SecureVector<byte> RSA_PrivateKey::decrypt(const byte in[], u32bit len) const { return BigInt::encode(private_op(in, len)); } -/************************************************* -* RSA Signature Operation * -*************************************************/ +/* +* RSA Signature Operation +*/ SecureVector<byte> RSA_PrivateKey::sign(const byte in[], u32bit len, RandomNumberGenerator&) const { return BigInt::encode_1363(private_op(in, len), n.bytes()); } -/************************************************* -* Check Private RSA Parameters * -*************************************************/ +/* +* Check Private RSA Parameters +*/ bool RSA_PrivateKey::check_key(RandomNumberGenerator& rng, bool strong) const { if(!IF_Scheme_PrivateKey::check_key(rng, strong)) diff --git a/src/pubkey/rsa/rsa.h b/src/pubkey/rsa/rsa.h index b8404b77c..f07533a4f 100644 --- a/src/pubkey/rsa/rsa.h +++ b/src/pubkey/rsa/rsa.h @@ -1,7 +1,9 @@ -/************************************************* -* RSA Header File * -* (C) 1999-2008 Jack Lloyd * -*************************************************/ +/* +* RSA +* (C) 1999-2008 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_RSA_H__ #define BOTAN_RSA_H__ diff --git a/src/pubkey/rw/rw.cpp b/src/pubkey/rw/rw.cpp index a2888a87d..def0ae689 100644 --- a/src/pubkey/rw/rw.cpp +++ b/src/pubkey/rw/rw.cpp @@ -1,7 +1,9 @@ -/************************************************* -* Rabin-Williams Source File * -* (C) 1999-2008 Jack Lloyd * -*************************************************/ +/* +* Rabin-Williams +* (C) 1999-2008 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/rw.h> #include <botan/numthry.h> @@ -12,9 +14,9 @@ namespace Botan { -/************************************************* -* RW_PublicKey Constructor * -*************************************************/ +/* +* RW_PublicKey Constructor +*/ RW_PublicKey::RW_PublicKey(const BigInt& mod, const BigInt& exp) { n = mod; @@ -22,9 +24,9 @@ RW_PublicKey::RW_PublicKey(const BigInt& mod, const BigInt& exp) X509_load_hook(); } -/************************************************* -* Rabin-Williams Public Operation * -*************************************************/ +/* +* Rabin-Williams Public Operation +*/ BigInt RW_PublicKey::public_op(const BigInt& i) const { if((i > (n >> 1)) || i.is_negative()) @@ -41,18 +43,18 @@ BigInt RW_PublicKey::public_op(const BigInt& i) const throw Invalid_Argument(algo_name() + "::public_op: Invalid input"); } -/************************************************* -* Rabin-Williams Verification Function * -*************************************************/ +/* +* Rabin-Williams Verification Function +*/ SecureVector<byte> RW_PublicKey::verify(const byte in[], u32bit len) const { BigInt i(in, len); return BigInt::encode(public_op(i)); } -/************************************************* -* Create a Rabin-Williams private key * -*************************************************/ +/* +* Create a Rabin-Williams private key +*/ RW_PrivateKey::RW_PrivateKey(RandomNumberGenerator& rng, u32bit bits, u32bit exp) { @@ -73,9 +75,9 @@ RW_PrivateKey::RW_PrivateKey(RandomNumberGenerator& rng, throw Self_Test_Failure(algo_name() + " private key generation failed"); } -/************************************************* -* RW_PrivateKey Constructor * -*************************************************/ +/* +* RW_PrivateKey Constructor +*/ RW_PrivateKey::RW_PrivateKey(RandomNumberGenerator& rng, const BigInt& prime1, const BigInt& prime2, const BigInt& exp, const BigInt& d_exp, @@ -93,9 +95,9 @@ RW_PrivateKey::RW_PrivateKey(RandomNumberGenerator& rng, PKCS8_load_hook(rng); } -/************************************************* -* Rabin-Williams Signature Operation * -*************************************************/ +/* +* Rabin-Williams Signature Operation +*/ SecureVector<byte> RW_PrivateKey::sign(const byte in[], u32bit len, RandomNumberGenerator&) const { @@ -114,9 +116,9 @@ SecureVector<byte> RW_PrivateKey::sign(const byte in[], u32bit len, return BigInt::encode_1363(r, n.bytes()); } -/************************************************* -* Check Private Rabin-Williams Parameters * -*************************************************/ +/* +* Check Private Rabin-Williams Parameters +*/ bool RW_PrivateKey::check_key(RandomNumberGenerator& rng, bool strong) const { if(!IF_Scheme_PrivateKey::check_key(rng, strong)) diff --git a/src/pubkey/rw/rw.h b/src/pubkey/rw/rw.h index d9f95eaa9..900e5ebda 100644 --- a/src/pubkey/rw/rw.h +++ b/src/pubkey/rw/rw.h @@ -1,7 +1,9 @@ -/************************************************* -* Rabin-Williams Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* Rabin-Williams +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_RW_H__ #define BOTAN_RW_H__ @@ -10,9 +12,9 @@ namespace Botan { -/************************************************* -* Rabin-Williams Public Key * -*************************************************/ +/* +* Rabin-Williams Public Key +*/ class BOTAN_DLL RW_PublicKey : public PK_Verifying_with_MR_Key, public virtual IF_Scheme_PublicKey { @@ -27,9 +29,9 @@ class BOTAN_DLL RW_PublicKey : public PK_Verifying_with_MR_Key, BigInt public_op(const BigInt&) const; }; -/************************************************* -* Rabin-Williams Private Key * -*************************************************/ +/* +* Rabin-Williams Private Key +*/ class BOTAN_DLL RW_PrivateKey : public RW_PublicKey, public PK_Signing_Key, public IF_Scheme_PrivateKey |