diff options
Diffstat (limited to 'src/engine')
37 files changed, 538 insertions, 464 deletions
diff --git a/src/engine/amd64_eng/eng_amd64.cpp b/src/engine/amd64_eng/eng_amd64.cpp index bdc73fdd6..eed2cf303 100644 --- a/src/engine/amd64_eng/eng_amd64.cpp +++ b/src/engine/amd64_eng/eng_amd64.cpp @@ -1,6 +1,8 @@ /** * AMD64 Assembly Implementation Engine * (C) 1999-2008 Jack Lloyd +* +* Distributed under the terms of the Botan license */ #include <botan/eng_amd64.h> diff --git a/src/engine/amd64_eng/eng_amd64.h b/src/engine/amd64_eng/eng_amd64.h index efd8c2b76..528291fed 100644 --- a/src/engine/amd64_eng/eng_amd64.h +++ b/src/engine/amd64_eng/eng_amd64.h @@ -1,6 +1,8 @@ /** * x86-64 Assembly Implementation Engines * (C) 1999-2008 Jack Lloyd +* +* Distributed under the terms of the Botan license */ #ifndef BOTAN_AMD64_ASM_ENGINE_H__ diff --git a/src/engine/def_engine/def_eng.h b/src/engine/def_engine/def_eng.h index 0cdf7ffb4..2d7145480 100644 --- a/src/engine/def_engine/def_eng.h +++ b/src/engine/def_engine/def_eng.h @@ -1,7 +1,9 @@ -/************************************************* -* Default Engine Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* Default Engine +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_DEFAULT_ENGINE_H__ #define BOTAN_DEFAULT_ENGINE_H__ @@ -10,9 +12,9 @@ namespace Botan { -/************************************************* -* Default Engine * -*************************************************/ +/* +* Default Engine +*/ class BOTAN_DLL Default_Engine : public Engine { public: diff --git a/src/engine/def_engine/def_mode.cpp b/src/engine/def_engine/def_mode.cpp index a2594c13f..a61683f93 100644 --- a/src/engine/def_engine/def_mode.cpp +++ b/src/engine/def_engine/def_mode.cpp @@ -1,7 +1,9 @@ -/************************************************* -* Default Engine Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* Default Engine +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/def_eng.h> #include <botan/parsing.h> @@ -68,9 +70,9 @@ BlockCipherModePaddingMethod* get_bc_pad(const std::string& algo_spec) } -/************************************************* -* Get a cipher object * -*************************************************/ +/* +* Get a cipher object +*/ Keyed_Filter* Default_Engine::get_cipher(const std::string& algo_spec, Cipher_Dir direction, Algorithm_Factory& af) diff --git a/src/engine/def_engine/def_pk_ops.cpp b/src/engine/def_engine/def_pk_ops.cpp index 5e29e110f..31dce7a74 100644 --- a/src/engine/def_engine/def_pk_ops.cpp +++ b/src/engine/def_engine/def_pk_ops.cpp @@ -1,7 +1,9 @@ -/************************************************* -* PK Operations Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* PK Operations +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/def_eng.h> @@ -36,9 +38,9 @@ namespace Botan { #if defined(BOTAN_HAS_IF_PUBLIC_KEY_FAMILY) -/************************************************* -* Acquire an IF op * -*************************************************/ +/* +* Acquire an IF op +*/ IF_Operation* Default_Engine::if_op(const BigInt& e, const BigInt& n, const BigInt& d, const BigInt& p, const BigInt& q, const BigInt& d1, @@ -49,9 +51,9 @@ IF_Operation* Default_Engine::if_op(const BigInt& e, const BigInt& n, #endif #if defined(BOTAN_HAS_DSA) -/************************************************* -* Acquire a DSA op * -*************************************************/ +/* +* Acquire a DSA op +*/ DSA_Operation* Default_Engine::dsa_op(const DL_Group& group, const BigInt& y, const BigInt& x) const { @@ -60,9 +62,9 @@ DSA_Operation* Default_Engine::dsa_op(const DL_Group& group, const BigInt& y, #endif #if defined(BOTAN_HAS_NYBERG_RUEPPEL) -/************************************************* -* Acquire a NR op * -*************************************************/ +/* +* Acquire a NR op +*/ NR_Operation* Default_Engine::nr_op(const DL_Group& group, const BigInt& y, const BigInt& x) const { @@ -71,9 +73,9 @@ NR_Operation* Default_Engine::nr_op(const DL_Group& group, const BigInt& y, #endif #if defined(BOTAN_HAS_ELGAMAL) -/************************************************* -* Acquire an ElGamal op * -*************************************************/ +/* +* Acquire an ElGamal op +*/ ELG_Operation* Default_Engine::elg_op(const DL_Group& group, const BigInt& y, const BigInt& x) const { @@ -82,9 +84,9 @@ ELG_Operation* Default_Engine::elg_op(const DL_Group& group, const BigInt& y, #endif #if defined(BOTAN_HAS_DIFFIE_HELLMAN) -/************************************************* -* Acquire a DH op * -*************************************************/ +/* +* Acquire a DH op +*/ DH_Operation* Default_Engine::dh_op(const DL_Group& group, const BigInt& x) const { @@ -93,9 +95,9 @@ DH_Operation* Default_Engine::dh_op(const DL_Group& group, #endif #if defined(BOTAN_HAS_ECDSA) -/************************************************* -* Acquire a ECDSA op * -*************************************************/ +/* +* Acquire a ECDSA op +*/ ECDSA_Operation* Default_Engine::ecdsa_op(const EC_Domain_Params& dom_pars, const BigInt& priv_key, const PointGFp& pub_key) const @@ -105,9 +107,9 @@ ECDSA_Operation* Default_Engine::ecdsa_op(const EC_Domain_Params& dom_pars, #endif #if defined(BOTAN_HAS_ECKAEG) -/************************************************* -* Acquire a ECKAEG op * -*************************************************/ +/* +* Acquire a ECKAEG op +*/ ECKAEG_Operation* Default_Engine::eckaeg_op(const EC_Domain_Params& dom_pars, const BigInt& priv_key, const PointGFp& pub_key) const diff --git a/src/engine/def_engine/def_powm.cpp b/src/engine/def_engine/def_powm.cpp index 38aca901c..9e7a88a1a 100644 --- a/src/engine/def_engine/def_powm.cpp +++ b/src/engine/def_engine/def_powm.cpp @@ -1,16 +1,18 @@ -/************************************************* -* Modular Exponentiation Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* Modular Exponentiation +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/def_eng.h> #include <botan/def_powm.h> namespace Botan { -/************************************************* -* Choose a modular exponentation algorithm * -*************************************************/ +/* +* Choose a modular exponentation algorithm +*/ Modular_Exponentiator* Default_Engine::mod_exp(const BigInt& n, Power_Mod::Usage_Hints hints) const { diff --git a/src/engine/def_engine/lookup_block.cpp b/src/engine/def_engine/lookup_block.cpp index 06383357b..14c8da8a7 100644 --- a/src/engine/def_engine/lookup_block.cpp +++ b/src/engine/def_engine/lookup_block.cpp @@ -1,7 +1,9 @@ -/************************************************* -* Block Cipher Lookup * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* Block Cipher Lookup +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/def_eng.h> #include <botan/scan_name.h> @@ -103,9 +105,9 @@ namespace Botan { -/************************************************* -* Look for an algorithm with this name * -*************************************************/ +/* +* Look for an algorithm with this name +*/ BlockCipher* Default_Engine::find_block_cipher(const SCAN_Name& request, Algorithm_Factory& af) const diff --git a/src/engine/def_engine/lookup_hash.cpp b/src/engine/def_engine/lookup_hash.cpp index 48ed8bc04..6a0d42dee 100644 --- a/src/engine/def_engine/lookup_hash.cpp +++ b/src/engine/def_engine/lookup_hash.cpp @@ -1,7 +1,9 @@ -/************************************************* -* Hash Algorithms Lookup * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* Hash Algorithms Lookup +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/def_eng.h> #include <botan/scan_name.h> @@ -71,9 +73,9 @@ namespace Botan { -/************************************************* -* Look for an algorithm with this name * -*************************************************/ +/* +* Look for an algorithm with this name +*/ HashFunction* Default_Engine::find_hash(const SCAN_Name& request, Algorithm_Factory& af) const diff --git a/src/engine/def_engine/lookup_mac.cpp b/src/engine/def_engine/lookup_mac.cpp index 35f17e134..3fef12b59 100644 --- a/src/engine/def_engine/lookup_mac.cpp +++ b/src/engine/def_engine/lookup_mac.cpp @@ -1,7 +1,9 @@ -/************************************************* -* MAC Lookup * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* MAC Lookup +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/def_eng.h> #include <botan/scan_name.h> @@ -29,9 +31,9 @@ namespace Botan { -/************************************************* -* Look for an algorithm with this name * -*************************************************/ +/* +* Look for an algorithm with this name +*/ MessageAuthenticationCode* Default_Engine::find_mac(const SCAN_Name& request, Algorithm_Factory& af) const diff --git a/src/engine/def_engine/lookup_stream.cpp b/src/engine/def_engine/lookup_stream.cpp index e7f1ff41d..e2f1b32b8 100644 --- a/src/engine/def_engine/lookup_stream.cpp +++ b/src/engine/def_engine/lookup_stream.cpp @@ -1,7 +1,9 @@ -/************************************************* -* Stream Cipher Lookup * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* Stream Cipher Lookup +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/def_eng.h> #include <botan/scan_name.h> @@ -24,9 +26,9 @@ namespace Botan { -/************************************************* -* Look for an algorithm with this name * -*************************************************/ +/* +* Look for an algorithm with this name +*/ StreamCipher* Default_Engine::find_stream_cipher(const SCAN_Name& request, Algorithm_Factory&) const diff --git a/src/engine/engine.h b/src/engine/engine.h index b0861d134..d23fc4dca 100644 --- a/src/engine/engine.h +++ b/src/engine/engine.h @@ -1,7 +1,9 @@ -/************************************************* -* Engine Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* Engine +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_ENGINE_H__ #define BOTAN_ENGINE_H__ @@ -52,9 +54,9 @@ namespace Botan { class Algorithm_Factory; class Keyed_Filter; -/************************************************* -* Engine Base Class * -*************************************************/ +/* +* Engine Base Class +*/ class BOTAN_DLL Engine { public: @@ -135,9 +137,9 @@ class BOTAN_DLL Engine namespace Engine_Core { -/************************************************* -* Get an operation from an Engine * -*************************************************/ +/* +* Get an operation from an Engine +*/ Modular_Exponentiator* mod_exp(const BigInt&, Power_Mod::Usage_Hints); #if defined(BOTAN_HAS_IF_PUBLIC_KEY_FAMILY) diff --git a/src/engine/gnump/eng_gmp.h b/src/engine/gnump/eng_gmp.h index 8edaae374..6a52b7e51 100644 --- a/src/engine/gnump/eng_gmp.h +++ b/src/engine/gnump/eng_gmp.h @@ -1,7 +1,9 @@ -/************************************************* -* GMP Engine Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* GMP Engine +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_ENGINE_GMP_H__ #define BOTAN_ENGINE_GMP_H__ @@ -10,9 +12,9 @@ namespace Botan { -/************************************************* -* GMP Engine * -*************************************************/ +/* +* GMP Engine +*/ class BOTAN_DLL GMP_Engine : public Engine { public: diff --git a/src/engine/gnump/gmp_dh.cpp b/src/engine/gnump/gmp_dh.cpp index ef2732626..b33240268 100644 --- a/src/engine/gnump/gmp_dh.cpp +++ b/src/engine/gnump/gmp_dh.cpp @@ -1,7 +1,9 @@ -/************************************************* -* GMP Engine Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* GMP Engine +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/eng_gmp.h> #include <botan/gmp_wrap.h> @@ -12,9 +14,9 @@ namespace Botan { #if defined(BOTAN_HAS_DIFFIE_HELLMAN) namespace { -/************************************************* -* GMP DH Operation * -*************************************************/ +/* +* GMP DH Operation +*/ class GMP_DH_Op : public DH_Operation { public: @@ -27,9 +29,9 @@ class GMP_DH_Op : public DH_Operation GMP_MPZ x, p; }; -/************************************************* -* GMP DH Key Agreement Operation * -*************************************************/ +/* +* GMP DH Key Agreement Operation +*/ BigInt GMP_DH_Op::agree(const BigInt& i_bn) const { GMP_MPZ i(i_bn); @@ -39,9 +41,9 @@ BigInt GMP_DH_Op::agree(const BigInt& i_bn) const } -/************************************************* -* Acquire a DH op * -*************************************************/ +/* +* Acquire a DH op +*/ DH_Operation* GMP_Engine::dh_op(const DL_Group& group, const BigInt& x) const { return new GMP_DH_Op(group, x); diff --git a/src/engine/gnump/gmp_dsa.cpp b/src/engine/gnump/gmp_dsa.cpp index 209c6e0a6..69a9c3e9c 100644 --- a/src/engine/gnump/gmp_dsa.cpp +++ b/src/engine/gnump/gmp_dsa.cpp @@ -1,7 +1,9 @@ -/************************************************* -* GMP DSA Engine Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* GMP DSA Engine +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/eng_gmp.h> #include <botan/gmp_wrap.h> @@ -13,9 +15,9 @@ namespace Botan { namespace { -/************************************************* -* GMP DSA Operation * -*************************************************/ +/* +* GMP DSA Operation +*/ class GMP_DSA_Op : public DSA_Operation { public: @@ -30,9 +32,9 @@ class GMP_DSA_Op : public DSA_Operation const GMP_MPZ x, y, p, q, g; }; -/************************************************* -* GMP DSA Verify Operation * -*************************************************/ +/* +* GMP DSA Verify Operation +*/ bool GMP_DSA_Op::verify(const byte msg[], u32bit msg_len, const byte sig[], u32bit sig_len) const { @@ -72,9 +74,9 @@ bool GMP_DSA_Op::verify(const byte msg[], u32bit msg_len, return false; } -/************************************************* -* GMP DSA Sign Operation * -*************************************************/ +/* +* GMP DSA Sign Operation +*/ SecureVector<byte> GMP_DSA_Op::sign(const byte in[], u32bit length, const BigInt& k_bn) const { @@ -109,9 +111,9 @@ SecureVector<byte> GMP_DSA_Op::sign(const byte in[], u32bit length, } -/************************************************* -* Acquire a DSA op * -*************************************************/ +/* +* Acquire a DSA op +*/ DSA_Operation* GMP_Engine::dsa_op(const DL_Group& group, const BigInt& y, const BigInt& x) const { diff --git a/src/engine/gnump/gmp_elg.cpp b/src/engine/gnump/gmp_elg.cpp index 63e9440ff..ee109f1d6 100644 --- a/src/engine/gnump/gmp_elg.cpp +++ b/src/engine/gnump/gmp_elg.cpp @@ -1,7 +1,9 @@ -/************************************************* -* GMP ElGamal Engine Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* GMP ElGamal Engine +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/eng_gmp.h> #include <botan/gmp_wrap.h> @@ -13,9 +15,9 @@ namespace Botan { namespace { -/************************************************* -* GMP ElGamal Operation * -*************************************************/ +/* +* GMP ElGamal Operation +*/ class GMP_ELG_Op : public ELG_Operation { public: @@ -30,9 +32,9 @@ class GMP_ELG_Op : public ELG_Operation GMP_MPZ x, y, g, p; }; -/************************************************* -* GMP ElGamal Encrypt Operation * -*************************************************/ +/* +* GMP ElGamal Encrypt Operation +*/ SecureVector<byte> GMP_ELG_Op::encrypt(const byte in[], u32bit length, const BigInt& k_bn) const { @@ -55,9 +57,9 @@ SecureVector<byte> GMP_ELG_Op::encrypt(const byte in[], u32bit length, return output; } -/************************************************* -* GMP ElGamal Decrypt Operation * -*************************************************/ +/* +* GMP ElGamal Decrypt Operation +*/ BigInt GMP_ELG_Op::decrypt(const BigInt& a_bn, const BigInt& b_bn) const { if(mpz_cmp_ui(x.value, 0) == 0) @@ -77,9 +79,9 @@ BigInt GMP_ELG_Op::decrypt(const BigInt& a_bn, const BigInt& b_bn) const } -/************************************************* -* Acquire an ElGamal op * -*************************************************/ +/* +* Acquire an ElGamal op +*/ ELG_Operation* GMP_Engine::elg_op(const DL_Group& group, const BigInt& y, const BigInt& x) const { diff --git a/src/engine/gnump/gmp_if.cpp b/src/engine/gnump/gmp_if.cpp index a4a4d0476..b96f2ddac 100644 --- a/src/engine/gnump/gmp_if.cpp +++ b/src/engine/gnump/gmp_if.cpp @@ -1,7 +1,9 @@ -/************************************************* -* GMP IF Engine Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* GMP IF Engine +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/eng_gmp.h> #include <botan/gmp_wrap.h> @@ -13,9 +15,9 @@ namespace Botan { namespace { -/************************************************* -* GMP IF Operation * -*************************************************/ +/* +* GMP IF Operation +*/ class GMP_IF_Op : public IF_Operation { public: @@ -32,9 +34,9 @@ class GMP_IF_Op : public IF_Operation const GMP_MPZ e, n, p, q, d1, d2, c; }; -/************************************************* -* GMP IF Public Operation * -*************************************************/ +/* +* GMP IF Public Operation +*/ BigInt GMP_IF_Op::public_op(const BigInt& i_bn) const { GMP_MPZ i(i_bn); @@ -42,9 +44,9 @@ BigInt GMP_IF_Op::public_op(const BigInt& i_bn) const return i.to_bigint(); } -/************************************************* -* GMP IF Private Operation * -*************************************************/ +/* +* GMP IF Private Operation +*/ BigInt GMP_IF_Op::private_op(const BigInt& i_bn) const { if(mpz_cmp_ui(p.value, 0) == 0) @@ -64,9 +66,9 @@ BigInt GMP_IF_Op::private_op(const BigInt& i_bn) const } -/************************************************* -* Acquire an IF op * -*************************************************/ +/* +* Acquire an IF op +*/ IF_Operation* GMP_Engine::if_op(const BigInt& e, const BigInt& n, const BigInt& d, const BigInt& p, const BigInt& q, const BigInt& d1, diff --git a/src/engine/gnump/gmp_mem.cpp b/src/engine/gnump/gmp_mem.cpp index 91ba94dd7..89a1ed2d4 100644 --- a/src/engine/gnump/gmp_mem.cpp +++ b/src/engine/gnump/gmp_mem.cpp @@ -1,7 +1,9 @@ -/************************************************* -* GNU MP Memory Handlers Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* GNU MP Memory Handlers +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/eng_gmp.h> #include <cstring> @@ -11,22 +13,22 @@ namespace Botan { namespace { -/************************************************* -* Allocator used by GNU MP * -*************************************************/ +/* +* Allocator used by GNU MP +*/ Allocator* gmp_alloc = 0; -/************************************************* -* Allocation Function for GNU MP * -*************************************************/ +/* +* Allocation Function for GNU MP +*/ void* gmp_malloc(size_t n) { return gmp_alloc->allocate(n); } -/************************************************* -* Reallocation Function for GNU MP * -*************************************************/ +/* +* Reallocation Function for GNU MP +*/ void* gmp_realloc(void* ptr, size_t old_n, size_t new_n) { void* new_buf = gmp_alloc->allocate(new_n); @@ -35,9 +37,9 @@ void* gmp_realloc(void* ptr, size_t old_n, size_t new_n) return new_buf; } -/************************************************* -* Deallocation Function for GNU MP * -*************************************************/ +/* +* Deallocation Function for GNU MP +*/ void gmp_free(void* ptr, size_t n) { gmp_alloc->deallocate(ptr, n); @@ -45,9 +47,9 @@ void gmp_free(void* ptr, size_t n) } -/************************************************* -* Set the GNU MP memory functions * -*************************************************/ +/* +* Set the GNU MP memory functions +*/ void GMP_Engine::set_memory_hooks() { if(gmp_alloc == 0) @@ -57,9 +59,9 @@ void GMP_Engine::set_memory_hooks() } } -/************************************************* -* GMP_Engine Constructor * -*************************************************/ +/* +* GMP_Engine Constructor +*/ GMP_Engine::GMP_Engine() { set_memory_hooks(); diff --git a/src/engine/gnump/gmp_nr.cpp b/src/engine/gnump/gmp_nr.cpp index 97b7e5554..4aeb09fe2 100644 --- a/src/engine/gnump/gmp_nr.cpp +++ b/src/engine/gnump/gmp_nr.cpp @@ -1,7 +1,9 @@ -/************************************************* -* GMP NR Engine Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* GMP NR Engine +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/eng_gmp.h> #include <botan/gmp_wrap.h> @@ -13,9 +15,9 @@ namespace Botan { namespace { -/************************************************* -* GMP NR Operation * -*************************************************/ +/* +* GMP NR Operation +*/ class GMP_NR_Op : public NR_Operation { public: @@ -30,9 +32,9 @@ class GMP_NR_Op : public NR_Operation const GMP_MPZ x, y, p, q, g; }; -/************************************************* -* GMP NR Verify Operation * -*************************************************/ +/* +* GMP NR Verify Operation +*/ SecureVector<byte> GMP_NR_Op::verify(const byte sig[], u32bit sig_len) const { const u32bit q_bytes = q.bytes(); @@ -57,9 +59,9 @@ SecureVector<byte> GMP_NR_Op::verify(const byte sig[], u32bit sig_len) const return BigInt::encode(i1.to_bigint()); } -/************************************************* -* GMP NR Sign Operation * -*************************************************/ +/* +* GMP NR Sign Operation +*/ SecureVector<byte> GMP_NR_Op::sign(const byte in[], u32bit length, const BigInt& k_bn) const { @@ -92,9 +94,9 @@ SecureVector<byte> GMP_NR_Op::sign(const byte in[], u32bit length, } -/************************************************* -* Acquire a NR op * -*************************************************/ +/* +* Acquire a NR op +*/ NR_Operation* GMP_Engine::nr_op(const DL_Group& group, const BigInt& y, const BigInt& x) const { diff --git a/src/engine/gnump/gmp_powm.cpp b/src/engine/gnump/gmp_powm.cpp index a5e3d1c0d..687aed88a 100644 --- a/src/engine/gnump/gmp_powm.cpp +++ b/src/engine/gnump/gmp_powm.cpp @@ -1,7 +1,9 @@ -/************************************************* -* GMP Modular Exponentiation Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* GMP Modular Exponentiation +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/eng_gmp.h> #include <botan/gmp_wrap.h> @@ -10,9 +12,9 @@ namespace Botan { namespace { -/************************************************* -* GMP Modular Exponentiator * -*************************************************/ +/* +* GMP Modular Exponentiator +*/ class GMP_Modular_Exponentiator : public Modular_Exponentiator { public: @@ -27,9 +29,9 @@ class GMP_Modular_Exponentiator : public Modular_Exponentiator GMP_MPZ base, exp, mod; }; -/************************************************* -* Compute the result * -*************************************************/ +/* +* Compute the result +*/ BigInt GMP_Modular_Exponentiator::execute() const { GMP_MPZ r; @@ -39,9 +41,9 @@ BigInt GMP_Modular_Exponentiator::execute() const } -/************************************************* -* Return the GMP-based modular exponentiator * -*************************************************/ +/* +* Return the GMP-based modular exponentiator +*/ Modular_Exponentiator* GMP_Engine::mod_exp(const BigInt& n, Power_Mod::Usage_Hints) const { diff --git a/src/engine/gnump/gmp_wrap.cpp b/src/engine/gnump/gmp_wrap.cpp index 4c73c2562..735fc7070 100644 --- a/src/engine/gnump/gmp_wrap.cpp +++ b/src/engine/gnump/gmp_wrap.cpp @@ -1,7 +1,9 @@ -/************************************************* -* GMP Wrapper Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* GMP Wrapper +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/gmp_wrap.h> @@ -17,9 +19,9 @@ namespace Botan { -/************************************************* -* GMP_MPZ Constructor * -*************************************************/ +/* +* GMP_MPZ Constructor +*/ GMP_MPZ::GMP_MPZ(const BigInt& in) { mpz_init(value); @@ -27,60 +29,60 @@ GMP_MPZ::GMP_MPZ(const BigInt& in) mpz_import(value, in.sig_words(), -1, sizeof(word), 0, 0, in.data()); } -/************************************************* -* GMP_MPZ Constructor * -*************************************************/ +/* +* GMP_MPZ Constructor +*/ GMP_MPZ::GMP_MPZ(const byte in[], u32bit length) { mpz_init(value); mpz_import(value, length, 1, 1, 0, 0, in); } -/************************************************* -* GMP_MPZ Copy Constructor * -*************************************************/ +/* +* GMP_MPZ Copy Constructor +*/ GMP_MPZ::GMP_MPZ(const GMP_MPZ& other) { mpz_init_set(value, other.value); } -/************************************************* -* GMP_MPZ Destructor * -*************************************************/ +/* +* GMP_MPZ Destructor +*/ GMP_MPZ::~GMP_MPZ() { mpz_clear(value); } -/************************************************* -* GMP_MPZ Assignment Operator * -*************************************************/ +/* +* GMP_MPZ Assignment Operator +*/ GMP_MPZ& GMP_MPZ::operator=(const GMP_MPZ& other) { mpz_set(value, other.value); return (*this); } -/************************************************* -* Export the mpz_t as a bytestring * -*************************************************/ +/* +* Export the mpz_t as a bytestring +*/ void GMP_MPZ::encode(byte out[], u32bit length) const { size_t dummy = 0; mpz_export(out + (length - bytes()), &dummy, 1, 1, 0, 0, value); } -/************************************************* -* Return the number of significant bytes * -*************************************************/ +/* +* Return the number of significant bytes +*/ u32bit GMP_MPZ::bytes() const { return ((mpz_sizeinbase(value, 2) + 7) / 8); } -/************************************************* -* GMP to BigInt Conversions * -*************************************************/ +/* +* GMP to BigInt Conversions +*/ BigInt GMP_MPZ::to_bigint() const { BigInt out(BigInt::Positive, (bytes() + sizeof(word) - 1) / sizeof(word)); diff --git a/src/engine/gnump/gmp_wrap.h b/src/engine/gnump/gmp_wrap.h index e2a420e6b..11a51c87d 100644 --- a/src/engine/gnump/gmp_wrap.h +++ b/src/engine/gnump/gmp_wrap.h @@ -1,7 +1,9 @@ -/************************************************* -* GMP MPZ Wrapper Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* GMP MPZ Wrapper +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_GMP_MPZ_WRAP_H__ #define BOTAN_GMP_MPZ_WRAP_H__ @@ -11,9 +13,9 @@ namespace Botan { -/************************************************* -* Lightweight GMP mpz_t Wrapper * -*************************************************/ +/* +* Lightweight GMP mpz_t Wrapper +*/ class BOTAN_DLL GMP_MPZ { public: diff --git a/src/engine/ia32_eng/eng_ia32.cpp b/src/engine/ia32_eng/eng_ia32.cpp index 0378c094e..6ff2a4be4 100644 --- a/src/engine/ia32_eng/eng_ia32.cpp +++ b/src/engine/ia32_eng/eng_ia32.cpp @@ -1,7 +1,9 @@ -/************************************************* -* Assembly Implementation Engine Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* Assembly Implementation Engine +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/eng_ia32.h> diff --git a/src/engine/ia32_eng/eng_ia32.h b/src/engine/ia32_eng/eng_ia32.h index 587728f2f..b7cb4824a 100644 --- a/src/engine/ia32_eng/eng_ia32.h +++ b/src/engine/ia32_eng/eng_ia32.h @@ -1,6 +1,8 @@ /** * IA-32 Assembly Implementation Engines * (C) 1999-2008 Jack Lloyd +* +* Distributed under the terms of the Botan license */ #ifndef BOTAN_IA32_ASM_ENGINE_H__ diff --git a/src/engine/openssl/arc4_openssl.cpp b/src/engine/openssl/arc4_openssl.cpp index 09fb52919..08ed3eb10 100644 --- a/src/engine/openssl/arc4_openssl.cpp +++ b/src/engine/openssl/arc4_openssl.cpp @@ -1,7 +1,9 @@ -/************************************************* -* OpenSSL ARC4 Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* OpenSSL ARC4 +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/eng_ossl.h> #include <botan/parsing.h> @@ -31,9 +33,9 @@ class ARC4_OpenSSL : public StreamCipher RC4_KEY state; }; -/************************************************* -* Return the name of this type * -*************************************************/ +/* +* Return the name of this type +*/ std::string ARC4_OpenSSL::name() const { if(SKIP == 0) return "ARC4"; @@ -41,9 +43,9 @@ std::string ARC4_OpenSSL::name() const else return "RC4_skip(" + to_string(SKIP) + ")"; } -/************************************************* -* ARC4 Key Schedule * -*************************************************/ +/* +* ARC4 Key Schedule +*/ void ARC4_OpenSSL::key_schedule(const byte key[], u32bit length) { RC4_set_key(&state, length, key); @@ -52,9 +54,9 @@ void ARC4_OpenSSL::key_schedule(const byte key[], u32bit length) RC4(&state, 1, &dummy, &dummy); } -/************************************************* -* ARC4 Encryption * -*************************************************/ +/* +* ARC4 Encryption +*/ void ARC4_OpenSSL::cipher(const byte in[], byte out[], u32bit length) { RC4(&state, length, in, out); diff --git a/src/engine/openssl/bn_powm.cpp b/src/engine/openssl/bn_powm.cpp index f54411240..7b836d170 100644 --- a/src/engine/openssl/bn_powm.cpp +++ b/src/engine/openssl/bn_powm.cpp @@ -1,7 +1,9 @@ -/************************************************* -* OpenSSL Modular Exponentiation Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* OpenSSL Modular Exponentiation +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/eng_ossl.h> #include <botan/bn_wrap.h> @@ -10,9 +12,9 @@ namespace Botan { namespace { -/************************************************* -* OpenSSL Modular Exponentiator * -*************************************************/ +/* +* OpenSSL Modular Exponentiator +*/ class OpenSSL_Modular_Exponentiator : public Modular_Exponentiator { public: @@ -28,9 +30,9 @@ class OpenSSL_Modular_Exponentiator : public Modular_Exponentiator OSSL_BN_CTX ctx; }; -/************************************************* -* Compute the result * -*************************************************/ +/* +* Compute the result +*/ BigInt OpenSSL_Modular_Exponentiator::execute() const { OSSL_BN r; @@ -40,9 +42,9 @@ BigInt OpenSSL_Modular_Exponentiator::execute() const } -/************************************************* -* Return the OpenSSL-based modular exponentiator * -*************************************************/ +/* +* Return the OpenSSL-based modular exponentiator +*/ Modular_Exponentiator* OpenSSL_Engine::mod_exp(const BigInt& n, Power_Mod::Usage_Hints) const { diff --git a/src/engine/openssl/bn_wrap.cpp b/src/engine/openssl/bn_wrap.cpp index 4f7ea0078..e1cfe3f95 100644 --- a/src/engine/openssl/bn_wrap.cpp +++ b/src/engine/openssl/bn_wrap.cpp @@ -1,15 +1,17 @@ -/************************************************* -* OpenSSL BN Wrapper Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* OpenSSL BN Wrapper +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/bn_wrap.h> namespace Botan { -/************************************************* -* OSSL_BN Constructor * -*************************************************/ +/* +* OSSL_BN Constructor +*/ OSSL_BN::OSSL_BN(const BigInt& in) { value = BN_new(); @@ -18,59 +20,59 @@ OSSL_BN::OSSL_BN(const BigInt& in) BN_bin2bn(encoding, encoding.size(), value); } -/************************************************* -* OSSL_BN Constructor * -*************************************************/ +/* +* OSSL_BN Constructor +*/ OSSL_BN::OSSL_BN(const byte in[], u32bit length) { value = BN_new(); BN_bin2bn(in, length, value); } -/************************************************* -* OSSL_BN Copy Constructor * -*************************************************/ +/* +* OSSL_BN Copy Constructor +*/ OSSL_BN::OSSL_BN(const OSSL_BN& other) { value = BN_dup(other.value); } -/************************************************* -* OSSL_BN Destructor * -*************************************************/ +/* +* OSSL_BN Destructor +*/ OSSL_BN::~OSSL_BN() { BN_clear_free(value); } -/************************************************* -* OSSL_BN Assignment Operator * -*************************************************/ +/* +* OSSL_BN Assignment Operator +*/ OSSL_BN& OSSL_BN::operator=(const OSSL_BN& other) { BN_copy(value, other.value); return (*this); } -/************************************************* -* Export the BIGNUM as a bytestring * -*************************************************/ +/* +* Export the BIGNUM as a bytestring +*/ void OSSL_BN::encode(byte out[], u32bit length) const { BN_bn2bin(value, out + (length - bytes())); } -/************************************************* -* Return the number of significant bytes * -*************************************************/ +/* +* Return the number of significant bytes +*/ u32bit OSSL_BN::bytes() const { return BN_num_bytes(value); } -/************************************************* -* OpenSSL to BigInt Conversions * -*************************************************/ +/* +* OpenSSL to BigInt Conversions +*/ BigInt OSSL_BN::to_bigint() const { SecureVector<byte> out(bytes()); @@ -78,33 +80,33 @@ BigInt OSSL_BN::to_bigint() const return BigInt::decode(out); } -/************************************************* -* OSSL_BN_CTX Constructor * -*************************************************/ +/* +* OSSL_BN_CTX Constructor +*/ OSSL_BN_CTX::OSSL_BN_CTX() { value = BN_CTX_new(); } -/************************************************* -* OSSL_BN_CTX Copy Constructor * -*************************************************/ +/* +* OSSL_BN_CTX Copy Constructor +*/ OSSL_BN_CTX::OSSL_BN_CTX(const OSSL_BN_CTX&) { value = BN_CTX_new(); } -/************************************************* -* OSSL_BN_CTX Destructor * -*************************************************/ +/* +* OSSL_BN_CTX Destructor +*/ OSSL_BN_CTX::~OSSL_BN_CTX() { BN_CTX_free(value); } -/************************************************* -* OSSL_BN_CTX Assignment Operator * -*************************************************/ +/* +* OSSL_BN_CTX Assignment Operator +*/ OSSL_BN_CTX& OSSL_BN_CTX::operator=(const OSSL_BN_CTX&) { value = BN_CTX_new(); diff --git a/src/engine/openssl/bn_wrap.h b/src/engine/openssl/bn_wrap.h index e8464e74e..4d18be1b5 100644 --- a/src/engine/openssl/bn_wrap.h +++ b/src/engine/openssl/bn_wrap.h @@ -1,7 +1,9 @@ -/************************************************* -* OpenSSL BN Wrapper Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* OpenSSL BN Wrapper +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_OPENSSL_BN_WRAP_H__ #define BOTAN_OPENSSL_BN_WRAP_H__ @@ -11,9 +13,9 @@ namespace Botan { -/************************************************* -* Lightweight OpenSSL BN Wrapper * -*************************************************/ +/* +* Lightweight OpenSSL BN Wrapper +*/ class BOTAN_DLL OSSL_BN { public: @@ -31,9 +33,9 @@ class BOTAN_DLL OSSL_BN ~OSSL_BN(); }; -/************************************************* -* Lightweight OpenSSL BN_CTX Wrapper * -*************************************************/ +/* +* Lightweight OpenSSL BN_CTX Wrapper +*/ class BOTAN_DLL OSSL_BN_CTX { public: diff --git a/src/engine/openssl/eng_ossl.h b/src/engine/openssl/eng_ossl.h index 7f345f0ff..7105546dd 100644 --- a/src/engine/openssl/eng_ossl.h +++ b/src/engine/openssl/eng_ossl.h @@ -1,7 +1,9 @@ -/************************************************* -* OpenSSL Engine Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* OpenSSL Engine +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_ENGINE_OPENSSL_H__ #define BOTAN_ENGINE_OPENSSL_H__ @@ -10,9 +12,9 @@ namespace Botan { -/************************************************* -* OpenSSL Engine * -*************************************************/ +/* +* OpenSSL Engine +*/ class BOTAN_DLL OpenSSL_Engine : public Engine { public: diff --git a/src/engine/openssl/ossl_bc.cpp b/src/engine/openssl/ossl_bc.cpp index 9b9a3c8a7..4d3761adb 100644 --- a/src/engine/openssl/ossl_bc.cpp +++ b/src/engine/openssl/ossl_bc.cpp @@ -1,7 +1,9 @@ -/************************************************* -* OpenSSL Block Cipher Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* OpenSSL Block Cipher +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/eng_ossl.h> #include <openssl/evp.h> @@ -10,9 +12,9 @@ namespace Botan { namespace { -/************************************************* -* EVP Block Cipher * -*************************************************/ +/* +* EVP Block Cipher +*/ class EVP_BlockCipher : public BlockCipher { public: @@ -32,9 +34,9 @@ class EVP_BlockCipher : public BlockCipher mutable EVP_CIPHER_CTX encrypt, decrypt; }; -/************************************************* -* EVP Block Cipher Constructor * -*************************************************/ +/* +* EVP Block Cipher Constructor +*/ EVP_BlockCipher::EVP_BlockCipher(const EVP_CIPHER* algo, const std::string& algo_name) : BlockCipher(EVP_CIPHER_block_size(algo), EVP_CIPHER_key_length(algo)), @@ -53,9 +55,9 @@ EVP_BlockCipher::EVP_BlockCipher(const EVP_CIPHER* algo, EVP_CIPHER_CTX_set_padding(&decrypt, 0); } -/************************************************* -* EVP Block Cipher Constructor * -*************************************************/ +/* +* EVP Block Cipher Constructor +*/ EVP_BlockCipher::EVP_BlockCipher(const EVP_CIPHER* algo, const std::string& algo_name, u32bit key_min, u32bit key_max, @@ -76,36 +78,36 @@ EVP_BlockCipher::EVP_BlockCipher(const EVP_CIPHER* algo, EVP_CIPHER_CTX_set_padding(&decrypt, 0); } -/************************************************* -* EVP Block Cipher Destructor * -*************************************************/ +/* +* EVP Block Cipher Destructor +*/ EVP_BlockCipher::~EVP_BlockCipher() { EVP_CIPHER_CTX_cleanup(&encrypt); EVP_CIPHER_CTX_cleanup(&decrypt); } -/************************************************* -* Encrypt a block * -*************************************************/ +/* +* Encrypt a block +*/ void EVP_BlockCipher::enc(const byte in[], byte out[]) const { int out_len = 0; EVP_EncryptUpdate(&encrypt, out, &out_len, in, BLOCK_SIZE); } -/************************************************* -* Decrypt a block * -*************************************************/ +/* +* Decrypt a block +*/ void EVP_BlockCipher::dec(const byte in[], byte out[]) const { int out_len = 0; EVP_DecryptUpdate(&decrypt, out, &out_len, in, BLOCK_SIZE); } -/************************************************* -* Set the key * -*************************************************/ +/* +* Set the key +*/ void EVP_BlockCipher::key_schedule(const byte key[], u32bit length) { SecureVector<byte> full_key(key, length); @@ -128,9 +130,9 @@ void EVP_BlockCipher::key_schedule(const byte key[], u32bit length) EVP_DecryptInit_ex(&decrypt, 0, 0, full_key.begin(), 0); } -/************************************************* -* Return a clone of this object * -*************************************************/ +/* +* Return a clone of this object +*/ BlockCipher* EVP_BlockCipher::clone() const { return new EVP_BlockCipher(EVP_CIPHER_CTX_cipher(&encrypt), @@ -138,9 +140,9 @@ BlockCipher* EVP_BlockCipher::clone() const MAXIMUM_KEYLENGTH, KEYLENGTH_MULTIPLE); } -/************************************************* -* Clear memory of sensitive data * -*************************************************/ +/* +* Clear memory of sensitive data +*/ void EVP_BlockCipher::clear() throw() { const EVP_CIPHER* algo = EVP_CIPHER_CTX_cipher(&encrypt); @@ -157,9 +159,9 @@ void EVP_BlockCipher::clear() throw() } -/************************************************* -* Look for an algorithm with this name * -*************************************************/ +/* +* Look for an algorithm with this name +*/ BlockCipher* OpenSSL_Engine::find_block_cipher(const SCAN_Name& request, Algorithm_Factory&) const diff --git a/src/engine/openssl/ossl_dh.cpp b/src/engine/openssl/ossl_dh.cpp index 290b95622..72eab8a48 100644 --- a/src/engine/openssl/ossl_dh.cpp +++ b/src/engine/openssl/ossl_dh.cpp @@ -1,7 +1,9 @@ -/************************************************* -* OpenSSL Engine Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* OpenSSL Engine +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/eng_ossl.h> #include <botan/bn_wrap.h> @@ -17,9 +19,9 @@ namespace Botan { namespace { -/************************************************* -* OpenSSL DH Operation * -*************************************************/ +/* +* OpenSSL DH Operation +*/ class OpenSSL_DH_Op : public DH_Operation { public: @@ -33,9 +35,9 @@ class OpenSSL_DH_Op : public DH_Operation OSSL_BN_CTX ctx; }; -/************************************************* -* OpenSSL DH Key Agreement Operation * -*************************************************/ +/* +* OpenSSL DH Key Agreement Operation +*/ BigInt OpenSSL_DH_Op::agree(const BigInt& i_bn) const { OSSL_BN i(i_bn), r; @@ -45,9 +47,9 @@ BigInt OpenSSL_DH_Op::agree(const BigInt& i_bn) const } -/************************************************* -* Acquire a DH op * -*************************************************/ +/* +* Acquire a DH op +*/ DH_Operation* OpenSSL_Engine::dh_op(const DL_Group& group, const BigInt& x) const { diff --git a/src/engine/openssl/ossl_dsa.cpp b/src/engine/openssl/ossl_dsa.cpp index 2757234e2..bfffb8796 100644 --- a/src/engine/openssl/ossl_dsa.cpp +++ b/src/engine/openssl/ossl_dsa.cpp @@ -1,7 +1,9 @@ -/************************************************* -* OpenSSL DSA Engine Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* OpenSSL DSA Engine +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/eng_ossl.h> #include <botan/bn_wrap.h> @@ -17,9 +19,9 @@ namespace Botan { namespace { -/************************************************* -* OpenSSL DSA Operation * -*************************************************/ +/* +* OpenSSL DSA Operation +*/ class OpenSSL_DSA_Op : public DSA_Operation { public: @@ -36,9 +38,9 @@ class OpenSSL_DSA_Op : public DSA_Operation OSSL_BN_CTX ctx; }; -/************************************************* -* OpenSSL DSA Verify Operation * -*************************************************/ +/* +* OpenSSL DSA Verify Operation +*/ bool OpenSSL_DSA_Op::verify(const byte msg[], u32bit msg_len, const byte sig[], u32bit sig_len) const { @@ -75,9 +77,9 @@ bool OpenSSL_DSA_Op::verify(const byte msg[], u32bit msg_len, return false; } -/************************************************* -* OpenSSL DSA Sign Operation * -*************************************************/ +/* +* OpenSSL DSA Sign Operation +*/ SecureVector<byte> OpenSSL_DSA_Op::sign(const byte in[], u32bit length, const BigInt& k_bn) const { @@ -111,9 +113,9 @@ SecureVector<byte> OpenSSL_DSA_Op::sign(const byte in[], u32bit length, } -/************************************************* -* Acquire a DSA op * -*************************************************/ +/* +* Acquire a DSA op +*/ DSA_Operation* OpenSSL_Engine::dsa_op(const DL_Group& group, const BigInt& y, const BigInt& x) const { diff --git a/src/engine/openssl/ossl_elg.cpp b/src/engine/openssl/ossl_elg.cpp index 25d628ba8..aefda9a1e 100644 --- a/src/engine/openssl/ossl_elg.cpp +++ b/src/engine/openssl/ossl_elg.cpp @@ -1,7 +1,9 @@ -/************************************************* -* OpenSSL Engine Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* OpenSSL Engine +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/eng_ossl.h> #include <botan/bn_wrap.h> @@ -17,9 +19,9 @@ namespace Botan { namespace { -/************************************************* -* OpenSSL ElGamal Operation * -*************************************************/ +/* +* OpenSSL ElGamal Operation +*/ class OpenSSL_ELG_Op : public ELG_Operation { public: @@ -35,9 +37,9 @@ class OpenSSL_ELG_Op : public ELG_Operation OSSL_BN_CTX ctx; }; -/************************************************* -* OpenSSL ElGamal Encrypt Operation * -*************************************************/ +/* +* OpenSSL ElGamal Encrypt Operation +*/ SecureVector<byte> OpenSSL_ELG_Op::encrypt(const byte in[], u32bit length, const BigInt& k_bn) const { @@ -59,9 +61,9 @@ SecureVector<byte> OpenSSL_ELG_Op::encrypt(const byte in[], u32bit length, return output; } -/************************************************* -* OpenSSL ElGamal Decrypt Operation * -*************************************************/ +/* +* OpenSSL ElGamal Decrypt Operation +*/ BigInt OpenSSL_ELG_Op::decrypt(const BigInt& a_bn, const BigInt& b_bn) const { if(BN_is_zero(x.value)) @@ -80,9 +82,9 @@ BigInt OpenSSL_ELG_Op::decrypt(const BigInt& a_bn, const BigInt& b_bn) const } -/************************************************* -* Acquire an ElGamal op * -*************************************************/ +/* +* Acquire an ElGamal op +*/ ELG_Operation* OpenSSL_Engine::elg_op(const DL_Group& group, const BigInt& y, const BigInt& x) const { diff --git a/src/engine/openssl/ossl_if.cpp b/src/engine/openssl/ossl_if.cpp index 08a43e63e..bbc10d549 100644 --- a/src/engine/openssl/ossl_if.cpp +++ b/src/engine/openssl/ossl_if.cpp @@ -1,7 +1,9 @@ -/************************************************* -* OpenSSL IF Engine Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* OpenSSL IF Engine +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/eng_ossl.h> #include <botan/bn_wrap.h> @@ -17,9 +19,9 @@ namespace Botan { namespace { -/************************************************* -* OpenSSL IF Operation * -*************************************************/ +/* +* OpenSSL IF Operation +*/ class OpenSSL_IF_Op : public IF_Operation { public: @@ -37,9 +39,9 @@ class OpenSSL_IF_Op : public IF_Operation OSSL_BN_CTX ctx; }; -/************************************************* -* OpenSSL IF Public Operation * -*************************************************/ +/* +* OpenSSL IF Public Operation +*/ BigInt OpenSSL_IF_Op::public_op(const BigInt& i_bn) const { OSSL_BN i(i_bn), r; @@ -47,9 +49,9 @@ BigInt OpenSSL_IF_Op::public_op(const BigInt& i_bn) const return r.to_bigint(); } -/************************************************* -* OpenSSL IF Private Operation * -*************************************************/ +/* +* OpenSSL IF Private Operation +*/ BigInt OpenSSL_IF_Op::private_op(const BigInt& i_bn) const { if(BN_is_zero(p.value)) @@ -68,9 +70,9 @@ BigInt OpenSSL_IF_Op::private_op(const BigInt& i_bn) const } -/************************************************* -* Acquire an IF op * -*************************************************/ +/* +* Acquire an IF op +*/ IF_Operation* OpenSSL_Engine::if_op(const BigInt& e, const BigInt& n, const BigInt& d, const BigInt& p, const BigInt& q, const BigInt& d1, diff --git a/src/engine/openssl/ossl_md.cpp b/src/engine/openssl/ossl_md.cpp index 4e28c515e..08672cfc8 100644 --- a/src/engine/openssl/ossl_md.cpp +++ b/src/engine/openssl/ossl_md.cpp @@ -1,7 +1,9 @@ -/************************************************* -* OpenSSL Hash Functions Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* OpenSSL Hash Functions +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/eng_ossl.h> #include <openssl/evp.h> @@ -10,9 +12,9 @@ namespace Botan { namespace { -/************************************************* -* EVP Hash Function * -*************************************************/ +/* +* EVP Hash Function +*/ class EVP_HashFunction : public HashFunction { public: @@ -29,17 +31,17 @@ class EVP_HashFunction : public HashFunction EVP_MD_CTX md; }; -/************************************************* -* Update an EVP Hash Calculation * -*************************************************/ +/* +* Update an EVP Hash Calculation +*/ void EVP_HashFunction::add_data(const byte input[], u32bit length) { EVP_DigestUpdate(&md, input, length); } -/************************************************* -* Finalize an EVP Hash Calculation * -*************************************************/ +/* +* Finalize an EVP Hash Calculation +*/ void EVP_HashFunction::final_result(byte output[]) { EVP_DigestFinal_ex(&md, output, 0); @@ -47,27 +49,27 @@ void EVP_HashFunction::final_result(byte output[]) EVP_DigestInit_ex(&md, algo, 0); } -/************************************************* -* Clear memory of sensitive data * -*************************************************/ +/* +* Clear memory of sensitive data +*/ void EVP_HashFunction::clear() throw() { const EVP_MD* algo = EVP_MD_CTX_md(&md); EVP_DigestInit_ex(&md, algo, 0); } -/************************************************* -* Return a clone of this object * -*************************************************/ +/* +* Return a clone of this object +*/ HashFunction* EVP_HashFunction::clone() const { const EVP_MD* algo = EVP_MD_CTX_md(&md); return new EVP_HashFunction(algo, name()); } -/************************************************* -* Create an EVP hash function * -*************************************************/ +/* +* Create an EVP hash function +*/ EVP_HashFunction::EVP_HashFunction(const EVP_MD* algo, const std::string& name) : HashFunction(EVP_MD_size(algo), EVP_MD_block_size(algo)), @@ -77,9 +79,9 @@ EVP_HashFunction::EVP_HashFunction(const EVP_MD* algo, EVP_DigestInit_ex(&md, algo, 0); } -/************************************************* -* Destroy an EVP hash function * -*************************************************/ +/* +* Destroy an EVP hash function +*/ EVP_HashFunction::~EVP_HashFunction() { EVP_MD_CTX_cleanup(&md); @@ -87,9 +89,9 @@ EVP_HashFunction::~EVP_HashFunction() } -/************************************************* -* Look for an algorithm with this name * -*************************************************/ +/* +* Look for an algorithm with this name +*/ HashFunction* OpenSSL_Engine::find_hash(const SCAN_Name& request, Algorithm_Factory&) const { diff --git a/src/engine/openssl/ossl_nr.cpp b/src/engine/openssl/ossl_nr.cpp index 210e2fec2..532e4b8be 100644 --- a/src/engine/openssl/ossl_nr.cpp +++ b/src/engine/openssl/ossl_nr.cpp @@ -1,7 +1,9 @@ -/************************************************* -* OpenSSL NR Engine Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* OpenSSL NR Engine +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/eng_ossl.h> #include <botan/bn_wrap.h> @@ -17,9 +19,9 @@ namespace Botan { namespace { -/************************************************* -* OpenSSL NR Operation * -*************************************************/ +/* +* OpenSSL NR Operation +*/ class OpenSSL_NR_Op : public NR_Operation { public: @@ -36,9 +38,9 @@ class OpenSSL_NR_Op : public NR_Operation OSSL_BN_CTX ctx; }; -/************************************************* -* OpenSSL NR Verify Operation * -*************************************************/ +/* +* OpenSSL NR Verify Operation +*/ SecureVector<byte> OpenSSL_NR_Op::verify(const byte sig[], u32bit sig_len) const { @@ -63,9 +65,9 @@ SecureVector<byte> OpenSSL_NR_Op::verify(const byte sig[], return BigInt::encode(i1.to_bigint()); } -/************************************************* -* OpenSSL NR Sign Operation * -*************************************************/ +/* +* OpenSSL NR Sign Operation +*/ SecureVector<byte> OpenSSL_NR_Op::sign(const byte in[], u32bit length, const BigInt& k_bn) const { @@ -98,9 +100,9 @@ SecureVector<byte> OpenSSL_NR_Op::sign(const byte in[], u32bit length, } -/************************************************* -* Acquire a NR op * -*************************************************/ +/* +* Acquire a NR op +*/ NR_Operation* OpenSSL_Engine::nr_op(const DL_Group& group, const BigInt& y, const BigInt& x) const { diff --git a/src/engine/sse2_eng/eng_sse2.cpp b/src/engine/sse2_eng/eng_sse2.cpp index cf5a65114..c738b3d96 100644 --- a/src/engine/sse2_eng/eng_sse2.cpp +++ b/src/engine/sse2_eng/eng_sse2.cpp @@ -1,6 +1,8 @@ /** * SSE2 Assembly Engine * (C) 1999-2008 Jack Lloyd +* +* Distributed under the terms of the Botan license */ #include <botan/eng_sse2.h> diff --git a/src/engine/sse2_eng/eng_sse2.h b/src/engine/sse2_eng/eng_sse2.h index affbaff2e..129697e8f 100644 --- a/src/engine/sse2_eng/eng_sse2.h +++ b/src/engine/sse2_eng/eng_sse2.h @@ -1,6 +1,8 @@ /** * SSE2 Assembly Engine * (C) 1999-2008 Jack Lloyd +* +* Distributed under the terms of the Botan license */ #ifndef BOTAN_SSE2_ASM_ENGINE_H__ |