diff options
570 files changed, 9153 insertions, 8019 deletions
diff --git a/src/algo_factory/algo_factory.cpp b/src/algo_factory/algo_factory.cpp index 9a1152181..269c58c3b 100644 --- a/src/algo_factory/algo_factory.cpp +++ b/src/algo_factory/algo_factory.cpp @@ -1,6 +1,8 @@ /* Algorithm Factory (C) 2008 Jack Lloyd +* +* Distributed under the terms of the Botan license */ #include <botan/algo_factory.h> diff --git a/src/algo_factory/algo_factory.h b/src/algo_factory/algo_factory.h index e7e8ac07b..73e592013 100644 --- a/src/algo_factory/algo_factory.h +++ b/src/algo_factory/algo_factory.h @@ -1,6 +1,8 @@ /** * Algorithm Factory * (C) 2008 Jack Lloyd +* +* Distributed under the terms of the Botan license */ #ifndef BOTAN_ALGORITHM_FACTORY_H__ diff --git a/src/algo_factory/prov_weight.cpp b/src/algo_factory/prov_weight.cpp index 7ee99b894..a55a8b1e6 100644 --- a/src/algo_factory/prov_weight.cpp +++ b/src/algo_factory/prov_weight.cpp @@ -1,6 +1,8 @@ /** * Default provider weights for Algorithm_Cache * (C) 2008 Jack Lloyd +* +* Distributed under the terms of the Botan license */ #include <botan/algo_cache.h> diff --git a/src/alloc/alloc_mmap/mmap_mem.cpp b/src/alloc/alloc_mmap/mmap_mem.cpp index 8ecb5f4fe..546da7a81 100644 --- a/src/alloc/alloc_mmap/mmap_mem.cpp +++ b/src/alloc/alloc_mmap/mmap_mem.cpp @@ -1,7 +1,9 @@ -/************************************************* -* Memory Mapping Allocator Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* Memory Mapping Allocator +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/mmap_mem.h> #include <cstring> @@ -21,9 +23,9 @@ namespace Botan { namespace { -/************************************************* -* MemoryMapping_Allocator Exception * -*************************************************/ +/* +* MemoryMapping_Allocator Exception +*/ class MemoryMapping_Failed : public Exception { public: @@ -33,9 +35,9 @@ class MemoryMapping_Failed : public Exception } -/************************************************* -* Memory Map a File into Memory * -*************************************************/ +/* +* Memory Map a File into Memory +*/ void* MemoryMapping_Allocator::alloc_block(u32bit n) { class TemporaryFile @@ -96,9 +98,9 @@ void* MemoryMapping_Allocator::alloc_block(u32bit n) return ptr; } -/************************************************* -* Remove a Memory Mapping * -*************************************************/ +/* +* Remove a Memory Mapping +*/ void MemoryMapping_Allocator::dealloc_block(void* ptr, u32bit n) { if(ptr == 0) diff --git a/src/alloc/alloc_mmap/mmap_mem.h b/src/alloc/alloc_mmap/mmap_mem.h index 3d3c1c48e..bef166a16 100644 --- a/src/alloc/alloc_mmap/mmap_mem.h +++ b/src/alloc/alloc_mmap/mmap_mem.h @@ -1,7 +1,9 @@ -/************************************************* -* Memory Mapping Allocator Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* Memory Mapping Allocator +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_MMAP_ALLOCATOR_H__ #define BOTAN_MMAP_ALLOCATOR_H__ @@ -10,9 +12,9 @@ namespace Botan { -/************************************************* -* Memory Mapping Allocator * -*************************************************/ +/* +* Memory Mapping Allocator +*/ class BOTAN_DLL MemoryMapping_Allocator : public Pooling_Allocator { public: diff --git a/src/alloc/allocate.h b/src/alloc/allocate.h index efbb77291..180f2c021 100644 --- a/src/alloc/allocate.h +++ b/src/alloc/allocate.h @@ -1,7 +1,9 @@ -/************************************************* -* Allocator Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* Allocator +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_ALLOCATOR_H__ #define BOTAN_ALLOCATOR_H__ @@ -11,9 +13,9 @@ namespace Botan { -/************************************************* -* Allocator Interface * -*************************************************/ +/* +* Allocator Interface +*/ class BOTAN_DLL Allocator { public: diff --git a/src/alloc/mem_pool/mem_pool.cpp b/src/alloc/mem_pool/mem_pool.cpp index cddfe0152..38e0c3285 100644 --- a/src/alloc/mem_pool/mem_pool.cpp +++ b/src/alloc/mem_pool/mem_pool.cpp @@ -1,9 +1,11 @@ -/************************************************* -* Pooling Allocator Source File * -* (C) 1999-2008 Jack Lloyd * -* 2005 Matthew Gregan * -* 2005-2006 Matt Johnston * -*************************************************/ +/* +* Pooling Allocator +* (C) 1999-2008 Jack Lloyd +* 2005 Matthew Gregan +* 2005-2006 Matt Johnston +* +* Distributed under the terms of the Botan license +*/ #include <botan/mem_pool.h> #include <botan/util.h> @@ -15,9 +17,9 @@ namespace Botan { namespace { -/************************************************* -* Memory Allocation Exception * -*************************************************/ +/* +* Memory Allocation Exception +*/ struct Memory_Exhaustion : public std::bad_alloc { const char* what() const throw() @@ -26,9 +28,9 @@ struct Memory_Exhaustion : public std::bad_alloc } -/************************************************* -* Memory_Block Constructor * -*************************************************/ +/* +* Memory_Block Constructor +*/ Pooling_Allocator::Memory_Block::Memory_Block(void* buf) { buffer = static_cast<byte*>(buf); @@ -36,9 +38,9 @@ Pooling_Allocator::Memory_Block::Memory_Block(void* buf) buffer_end = buffer + (BLOCK_SIZE * BITMAP_SIZE); } -/************************************************* -* See if ptr is contained by this block * -*************************************************/ +/* +* See if ptr is contained by this block +*/ bool Pooling_Allocator::Memory_Block::contains(void* ptr, u32bit length) const throw() { @@ -46,9 +48,9 @@ bool Pooling_Allocator::Memory_Block::contains(void* ptr, (buffer_end >= static_cast<byte*>(ptr) + length * BLOCK_SIZE)); } -/************************************************* -* Allocate some memory, if possible * -*************************************************/ +/* +* Allocate some memory, if possible +*/ byte* Pooling_Allocator::Memory_Block::alloc(u32bit n) throw() { if(n == 0 || n > BITMAP_SIZE) @@ -86,9 +88,9 @@ byte* Pooling_Allocator::Memory_Block::alloc(u32bit n) throw() return buffer + offset * BLOCK_SIZE; } -/************************************************* -* Mark this memory as free, if we own it * -*************************************************/ +/* +* Mark this memory as free, if we own it +*/ void Pooling_Allocator::Memory_Block::free(void* ptr, u32bit blocks) throw() { clear_mem(static_cast<byte*>(ptr), blocks * BLOCK_SIZE); @@ -104,17 +106,17 @@ void Pooling_Allocator::Memory_Block::free(void* ptr, u32bit blocks) throw() } } -/************************************************* -* Pooling_Allocator Constructor * -*************************************************/ +/* +* Pooling_Allocator Constructor +*/ Pooling_Allocator::Pooling_Allocator(Mutex* m) : mutex(m) { last_used = blocks.begin(); } -/************************************************* -* Pooling_Allocator Destructor * -*************************************************/ +/* +* Pooling_Allocator Destructor +*/ Pooling_Allocator::~Pooling_Allocator() { delete mutex; @@ -122,9 +124,9 @@ Pooling_Allocator::~Pooling_Allocator() throw Invalid_State("Pooling_Allocator: Never released memory"); } -/************************************************* -* Free all remaining memory * -*************************************************/ +/* +* Free all remaining memory +*/ void Pooling_Allocator::destroy() { Mutex_Holder lock(mutex); @@ -136,9 +138,9 @@ void Pooling_Allocator::destroy() allocated.clear(); } -/************************************************* -* Allocation * -*************************************************/ +/* +* Allocation +*/ void* Pooling_Allocator::allocate(u32bit n) { const u32bit BITMAP_SIZE = Memory_Block::bitmap_size(); @@ -170,9 +172,9 @@ void* Pooling_Allocator::allocate(u32bit n) throw Memory_Exhaustion(); } -/************************************************* -* Deallocation * -*************************************************/ +/* +* Deallocation +*/ void Pooling_Allocator::deallocate(void* ptr, u32bit n) { const u32bit BITMAP_SIZE = Memory_Block::bitmap_size(); @@ -199,9 +201,9 @@ void Pooling_Allocator::deallocate(void* ptr, u32bit n) } } -/************************************************* -* Try to get some memory from an existing block * -*************************************************/ +/* +* Try to get some memory from an existing block +*/ byte* Pooling_Allocator::allocate_blocks(u32bit n) { if(blocks.empty()) @@ -227,9 +229,9 @@ byte* Pooling_Allocator::allocate_blocks(u32bit n) return 0; } -/************************************************* -* Allocate more memory for the pool * -*************************************************/ +/* +* Allocate more memory for the pool +*/ void Pooling_Allocator::get_more_core(u32bit in_bytes) { const u32bit BITMAP_SIZE = Memory_Block::bitmap_size(); diff --git a/src/alloc/mem_pool/mem_pool.h b/src/alloc/mem_pool/mem_pool.h index 80ed2ddfd..a57800972 100644 --- a/src/alloc/mem_pool/mem_pool.h +++ b/src/alloc/mem_pool/mem_pool.h @@ -1,7 +1,9 @@ -/************************************************* -* Pooling Allocator Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* Pooling Allocator +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_POOLING_ALLOCATOR_H__ #define BOTAN_POOLING_ALLOCATOR_H__ @@ -14,9 +16,9 @@ namespace Botan { -/************************************************* -* Pooling Allocator * -*************************************************/ +/* +* Pooling Allocator +*/ class BOTAN_DLL Pooling_Allocator : public Allocator { public: diff --git a/src/alloc/system_alloc/defalloc.cpp b/src/alloc/system_alloc/defalloc.cpp index 5fb8e1447..8791c74e4 100644 --- a/src/alloc/system_alloc/defalloc.cpp +++ b/src/alloc/system_alloc/defalloc.cpp @@ -1,7 +1,9 @@ -/************************************************* -* Basic Allocators Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* Basic Allocators +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/defalloc.h> #include <botan/libstate.h> @@ -13,9 +15,9 @@ namespace Botan { namespace { -/************************************************* -* Perform Memory Allocation * -*************************************************/ +/* +* Perform Memory Allocation +*/ void* do_malloc(u32bit n, bool do_lock) { void* ptr = std::malloc(n); @@ -30,9 +32,9 @@ void* do_malloc(u32bit n, bool do_lock) return ptr; } -/************************************************* -* Perform Memory Deallocation * -*************************************************/ +/* +* Perform Memory Deallocation +*/ void do_free(void* ptr, u32bit n, bool do_lock) { if(!ptr) @@ -47,41 +49,41 @@ void do_free(void* ptr, u32bit n, bool do_lock) } -/************************************************* -* Malloc_Allocator's Allocation * -*************************************************/ +/* +* Malloc_Allocator's Allocation +*/ void* Malloc_Allocator::allocate(u32bit n) { return do_malloc(n, false); } -/************************************************* -* Malloc_Allocator's Deallocation * -*************************************************/ +/* +* Malloc_Allocator's Deallocation +*/ void Malloc_Allocator::deallocate(void* ptr, u32bit n) { do_free(ptr, n, false); } -/************************************************* -* Locking_Allocator's Allocation * -*************************************************/ +/* +* Locking_Allocator's Allocation +*/ void* Locking_Allocator::alloc_block(u32bit n) { return do_malloc(n, true); } -/************************************************* -* Locking_Allocator's Deallocation * -*************************************************/ +/* +* Locking_Allocator's Deallocation +*/ void Locking_Allocator::dealloc_block(void* ptr, u32bit n) { do_free(ptr, n, true); } -/************************************************* -* Get an allocator * -*************************************************/ +/* +* Get an allocator +*/ Allocator* Allocator::get(bool locking) { std::string type = ""; diff --git a/src/alloc/system_alloc/defalloc.h b/src/alloc/system_alloc/defalloc.h index dc01ee47f..627e8df70 100644 --- a/src/alloc/system_alloc/defalloc.h +++ b/src/alloc/system_alloc/defalloc.h @@ -1,7 +1,9 @@ -/************************************************* -* Basic Allocators Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* Basic Allocators +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_BASIC_ALLOC_H__ #define BOTAN_BASIC_ALLOC_H__ @@ -10,9 +12,9 @@ namespace Botan { -/************************************************* -* Malloc Allocator * -*************************************************/ +/* +* Malloc Allocator +*/ class BOTAN_DLL Malloc_Allocator : public Allocator { public: @@ -22,9 +24,9 @@ class BOTAN_DLL Malloc_Allocator : public Allocator std::string type() const { return "malloc"; } }; -/************************************************* -* Locking Allocator * -*************************************************/ +/* +* Locking Allocator +*/ class BOTAN_DLL Locking_Allocator : public Pooling_Allocator { public: diff --git a/src/asn1/alg_id.cpp b/src/asn1/alg_id.cpp index 5e5db73b3..94709ba16 100644 --- a/src/asn1/alg_id.cpp +++ b/src/asn1/alg_id.cpp @@ -1,7 +1,9 @@ -/************************************************* -* Algorithm Identifier Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* Algorithm Identifier +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/alg_id.h> #include <botan/der_enc.h> @@ -10,9 +12,9 @@ namespace Botan { -/************************************************* -* Create an AlgorithmIdentifier * -*************************************************/ +/* +* Create an AlgorithmIdentifier +*/ AlgorithmIdentifier::AlgorithmIdentifier(const OID& alg_id, const MemoryRegion<byte>& param) { @@ -20,9 +22,9 @@ AlgorithmIdentifier::AlgorithmIdentifier(const OID& alg_id, parameters = param; } -/************************************************* -* Create an AlgorithmIdentifier * -*************************************************/ +/* +* Create an AlgorithmIdentifier +*/ AlgorithmIdentifier::AlgorithmIdentifier(const std::string& alg_id, const MemoryRegion<byte>& param) { @@ -30,9 +32,9 @@ AlgorithmIdentifier::AlgorithmIdentifier(const std::string& alg_id, parameters = param; } -/************************************************* -* Create an AlgorithmIdentifier * -*************************************************/ +/* +* Create an AlgorithmIdentifier +*/ AlgorithmIdentifier::AlgorithmIdentifier(const OID& alg_id, Encoding_Option option) { @@ -43,9 +45,9 @@ AlgorithmIdentifier::AlgorithmIdentifier(const OID& alg_id, parameters.append(DER_NULL, sizeof(DER_NULL)); } -/************************************************* -* Create an AlgorithmIdentifier * -*************************************************/ +/* +* Create an AlgorithmIdentifier +*/ AlgorithmIdentifier::AlgorithmIdentifier(const std::string& alg_id, Encoding_Option option) { @@ -56,9 +58,9 @@ AlgorithmIdentifier::AlgorithmIdentifier(const std::string& alg_id, parameters.append(DER_NULL, sizeof(DER_NULL)); } -/************************************************* -* Compare two AlgorithmIdentifiers * -*************************************************/ +/* +* Compare two AlgorithmIdentifiers +*/ bool operator==(const AlgorithmIdentifier& a1, const AlgorithmIdentifier& a2) { if(a1.oid != a2.oid) @@ -68,17 +70,17 @@ bool operator==(const AlgorithmIdentifier& a1, const AlgorithmIdentifier& a2) return true; } -/************************************************* -* Compare two AlgorithmIdentifiers * -*************************************************/ +/* +* Compare two AlgorithmIdentifiers +*/ bool operator!=(const AlgorithmIdentifier& a1, const AlgorithmIdentifier& a2) { return !(a1 == a2); } -/************************************************* -* DER encode an AlgorithmIdentifier * -*************************************************/ +/* +* DER encode an AlgorithmIdentifier +*/ void AlgorithmIdentifier::encode_into(DER_Encoder& codec) const { codec.start_cons(SEQUENCE) @@ -87,9 +89,9 @@ void AlgorithmIdentifier::encode_into(DER_Encoder& codec) const .end_cons(); } -/************************************************* -* Decode a BER encoded AlgorithmIdentifier * -*************************************************/ +/* +* Decode a BER encoded AlgorithmIdentifier +*/ void AlgorithmIdentifier::decode_from(BER_Decoder& codec) { codec.start_cons(SEQUENCE) diff --git a/src/asn1/alg_id.h b/src/asn1/alg_id.h index 8187fc070..4a1ad2f30 100644 --- a/src/asn1/alg_id.h +++ b/src/asn1/alg_id.h @@ -1,7 +1,9 @@ -/************************************************* -* Algorithm Identifier Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* Algorithm Identifier +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_ALGORITHM_IDENTIFIER_H__ #define BOTAN_ALGORITHM_IDENTIFIER_H__ @@ -12,9 +14,9 @@ namespace Botan { -/************************************************* -* Algorithm Identifier * -*************************************************/ +/* +* Algorithm Identifier +*/ class BOTAN_DLL AlgorithmIdentifier : public ASN1_Object { public: @@ -34,9 +36,9 @@ class BOTAN_DLL AlgorithmIdentifier : public ASN1_Object SecureVector<byte> parameters; }; -/************************************************* -* Comparison Operations * -*************************************************/ +/* +* Comparison Operations +*/ bool BOTAN_DLL operator==(const AlgorithmIdentifier&, const AlgorithmIdentifier&); bool BOTAN_DLL operator!=(const AlgorithmIdentifier&, diff --git a/src/asn1/asn1_alt.cpp b/src/asn1/asn1_alt.cpp index 035f918cb..41974eef6 100644 --- a/src/asn1/asn1_alt.cpp +++ b/src/asn1/asn1_alt.cpp @@ -1,8 +1,10 @@ -/************************************************* -* AlternativeName Source File * -* (C) 1999-2007 Jack Lloyd * -* 2007 Yves Jerschow * -*************************************************/ +/* +* AlternativeName +* (C) 1999-2007 Jack Lloyd +* 2007 Yves Jerschow +* +* Distributed under the terms of the Botan license +*/ #include <botan/asn1_obj.h> #include <botan/der_enc.h> @@ -15,9 +17,9 @@ namespace Botan { -/************************************************* -* Create an AlternativeName * -*************************************************/ +/* +* Create an AlternativeName +*/ AlternativeName::AlternativeName(const std::string& email_addr, const std::string& uri, const std::string& dns, @@ -29,9 +31,9 @@ AlternativeName::AlternativeName(const std::string& email_addr, add_attribute("IP", ip); } -/************************************************* -* Add an attribute to an alternative name * -*************************************************/ +/* +* Add an attribute to an alternative name +*/ void AlternativeName::add_attribute(const std::string& type, const std::string& str) { @@ -47,9 +49,9 @@ void AlternativeName::add_attribute(const std::string& type, multimap_insert(alt_info, type, str); } -/************************************************* -* Add an OtherName field * -*************************************************/ +/* +* Add an OtherName field +*/ void AlternativeName::add_othername(const OID& oid, const std::string& value, ASN1_Tag type) { @@ -58,25 +60,25 @@ void AlternativeName::add_othername(const OID& oid, const std::string& value, multimap_insert(othernames, oid, ASN1_String(value, type)); } -/************************************************* -* Get the attributes of this alternative name * -*************************************************/ +/* +* Get the attributes of this alternative name +*/ std::multimap<std::string, std::string> AlternativeName::get_attributes() const { return alt_info; } -/************************************************* -* Get the otherNames * -*************************************************/ +/* +* Get the otherNames +*/ std::multimap<OID, ASN1_String> AlternativeName::get_othernames() const { return othernames; } -/************************************************* -* Return all of the alternative names * -*************************************************/ +/* +* Return all of the alternative names +*/ std::multimap<std::string, std::string> AlternativeName::contents() const { std::multimap<std::string, std::string> names; @@ -92,9 +94,9 @@ std::multimap<std::string, std::string> AlternativeName::contents() const return names; } -/************************************************* -* Return if this object has anything useful * -*************************************************/ +/* +* Return if this object has anything useful +*/ bool AlternativeName::has_items() const { return (alt_info.size() > 0 || othernames.size() > 0); @@ -102,9 +104,9 @@ bool AlternativeName::has_items() const namespace { -/************************************************* -* DER encode an AlternativeName entry * -*************************************************/ +/* +* DER encode an AlternativeName entry +*/ void encode_entries(DER_Encoder& encoder, const std::multimap<std::string, std::string>& attr, const std::string& type, ASN1_Tag tagging) @@ -131,9 +133,9 @@ void encode_entries(DER_Encoder& encoder, } -/************************************************* -* DER encode an AlternativeName extension * -*************************************************/ +/* +* DER encode an AlternativeName extension +*/ void AlternativeName::encode_into(DER_Encoder& der) const { der.start_cons(SEQUENCE); @@ -157,9 +159,9 @@ void AlternativeName::encode_into(DER_Encoder& der) const der.end_cons(); } -/************************************************* -* Decode a BER encoded AlternativeName * -*************************************************/ +/* +* Decode a BER encoded AlternativeName +*/ void AlternativeName::decode_from(BER_Decoder& source) { BER_Decoder names = source.start_cons(SEQUENCE); diff --git a/src/asn1/asn1_att.cpp b/src/asn1/asn1_att.cpp index 7c16ff3a5..c8d771e25 100644 --- a/src/asn1/asn1_att.cpp +++ b/src/asn1/asn1_att.cpp @@ -1,7 +1,9 @@ -/************************************************* -* Attribute Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* Attribute +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/asn1_obj.h> #include <botan/der_enc.h> @@ -10,18 +12,18 @@ namespace Botan { -/************************************************* -* Create an Attribute * -*************************************************/ +/* +* Create an Attribute +*/ Attribute::Attribute(const OID& attr_oid, const MemoryRegion<byte>& attr_value) { oid = attr_oid; parameters = attr_value; } -/************************************************* -* Create an Attribute * -*************************************************/ +/* +* Create an Attribute +*/ Attribute::Attribute(const std::string& attr_oid, const MemoryRegion<byte>& attr_value) { @@ -29,9 +31,9 @@ Attribute::Attribute(const std::string& attr_oid, parameters = attr_value; } -/************************************************* -* DER encode a Attribute * -*************************************************/ +/* +* DER encode a Attribute +*/ void Attribute::encode_into(DER_Encoder& codec) const { codec.start_cons(SEQUENCE) @@ -42,9 +44,9 @@ void Attribute::encode_into(DER_Encoder& codec) const .end_cons(); } -/************************************************* -* Decode a BER encoded Attribute * -*************************************************/ +/* +* Decode a BER encoded Attribute +*/ void Attribute::decode_from(BER_Decoder& codec) { codec.start_cons(SEQUENCE) diff --git a/src/asn1/asn1_dn.cpp b/src/asn1/asn1_dn.cpp index 3fd0c09b0..c5a132d85 100644 --- a/src/asn1/asn1_dn.cpp +++ b/src/asn1/asn1_dn.cpp @@ -1,7 +1,9 @@ -/************************************************* -* X509_DN Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* X509_DN +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/asn1_obj.h> #include <botan/der_enc.h> @@ -12,16 +14,16 @@ namespace Botan { -/************************************************* -* Create an empty X509_DN * -*************************************************/ +/* +* Create an empty X509_DN +*/ X509_DN::X509_DN() { } -/************************************************* -* Create an X509_DN * -*************************************************/ +/* +* Create an X509_DN +*/ X509_DN::X509_DN(const std::multimap<OID, std::string>& args) { std::multimap<OID, std::string>::const_iterator j; @@ -29,9 +31,9 @@ X509_DN::X509_DN(const std::multimap<OID, std::string>& args) add_attribute(j->first, j->second); } -/************************************************* -* Create an X509_DN * -*************************************************/ +/* +* Create an X509_DN +*/ X509_DN::X509_DN(const std::multimap<std::string, std::string>& args) { std::multimap<std::string, std::string>::const_iterator j; @@ -39,9 +41,9 @@ X509_DN::X509_DN(const std::multimap<std::string, std::string>& args) add_attribute(OIDS::lookup(j->first), j->second); } -/************************************************* -* Add an attribute to a X509_DN * -*************************************************/ +/* +* Add an attribute to a X509_DN +*/ void X509_DN::add_attribute(const std::string& type, const std::string& str) { @@ -49,9 +51,9 @@ void X509_DN::add_attribute(const std::string& type, add_attribute(oid, str); } -/************************************************* -* Add an attribute to a X509_DN * -*************************************************/ +/* +* Add an attribute to a X509_DN +*/ void X509_DN::add_attribute(const OID& oid, const std::string& str) { if(str == "") @@ -68,9 +70,9 @@ void X509_DN::add_attribute(const OID& oid, const std::string& str) dn_bits.destroy(); } -/************************************************* -* Get the attributes of this X509_DN * -*************************************************/ +/* +* Get the attributes of this X509_DN +*/ std::multimap<OID, std::string> X509_DN::get_attributes() const { typedef std::multimap<OID, ASN1_String>::const_iterator rdn_iter; @@ -81,9 +83,9 @@ std::multimap<OID, std::string> X509_DN::get_attributes() const return retval; } -/************************************************* -* Get the contents of this X.500 Name * -*************************************************/ +/* +* Get the contents of this X.500 Name +*/ std::multimap<std::string, std::string> X509_DN::contents() const { typedef std::multimap<OID, ASN1_String>::const_iterator rdn_iter; @@ -94,9 +96,9 @@ std::multimap<std::string, std::string> X509_DN::contents() const return retval; } -/************************************************* -* Get a single attribute type * -*************************************************/ +/* +* Get a single attribute type +*/ std::vector<std::string> X509_DN::get_attribute(const std::string& attr) const { typedef std::multimap<OID, ASN1_String>::const_iterator rdn_iter; @@ -110,9 +112,9 @@ std::vector<std::string> X509_DN::get_attribute(const std::string& attr) const return values; } -/************************************************* -* Handle the decoding operation of a DN * -*************************************************/ +/* +* Handle the decoding operation of a DN +*/ void X509_DN::do_decode(const MemoryRegion<byte>& bits) { BER_Decoder sequence(bits); @@ -139,17 +141,17 @@ void X509_DN::do_decode(const MemoryRegion<byte>& bits) dn_bits = bits; } -/************************************************* -* Return the BER encoded data, if any * -*************************************************/ +/* +* Return the BER encoded data, if any +*/ MemoryVector<byte> X509_DN::get_bits() const { return dn_bits; } -/************************************************* -* Deref aliases in a subject/issuer info request * -*************************************************/ +/* +* Deref aliases in a subject/issuer info request +*/ std::string X509_DN::deref_info_field(const std::string& info) { if(info == "Name" || info == "CommonName") return "X520.CommonName"; @@ -164,9 +166,9 @@ std::string X509_DN::deref_info_field(const std::string& info) return info; } -/************************************************* -* Compare two X509_DNs for equality * -*************************************************/ +/* +* Compare two X509_DNs for equality +*/ bool operator==(const X509_DN& dn1, const X509_DN& dn2) { typedef std::multimap<OID, std::string>::const_iterator rdn_iter; @@ -194,17 +196,17 @@ bool operator==(const X509_DN& dn1, const X509_DN& dn2) return true; } -/************************************************* -* Compare two X509_DNs for inequality * -*************************************************/ +/* +* Compare two X509_DNs for inequality +*/ bool operator!=(const X509_DN& dn1, const X509_DN& dn2) { return !(dn1 == dn2); } -/************************************************* -* Compare two X509_DNs * -*************************************************/ +/* +* Compare two X509_DNs +*/ bool operator<(const X509_DN& dn1, const X509_DN& dn2) { typedef std::multimap<OID, std::string>::const_iterator rdn_iter; @@ -228,9 +230,9 @@ bool operator<(const X509_DN& dn1, const X509_DN& dn2) namespace { -/************************************************* -* DER encode a RelativeDistinguishedName * -*************************************************/ +/* +* DER encode a RelativeDistinguishedName +*/ void do_ava(DER_Encoder& encoder, const std::multimap<OID, std::string>& dn_info, ASN1_Tag string_type, const std::string& oid_str, @@ -260,9 +262,9 @@ void do_ava(DER_Encoder& encoder, } -/************************************************* -* DER encode a DistinguishedName * -*************************************************/ +/* +* DER encode a DistinguishedName +*/ void X509_DN::encode_into(DER_Encoder& der) const { std::multimap<OID, std::string> dn_info = get_attributes(); @@ -285,9 +287,9 @@ void X509_DN::encode_into(DER_Encoder& der) const der.end_cons(); } -/************************************************* -* Decode a BER encoded DistinguishedName * -*************************************************/ +/* +* Decode a BER encoded DistinguishedName +*/ void X509_DN::decode_from(BER_Decoder& source) { dn_info.clear(); diff --git a/src/asn1/asn1_int.cpp b/src/asn1/asn1_int.cpp index e837dedf0..5e18f3961 100644 --- a/src/asn1/asn1_int.cpp +++ b/src/asn1/asn1_int.cpp @@ -1,7 +1,9 @@ -/************************************************* -* ASN.1 Internals Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* ASN.1 Internals +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/asn1_int.h> #include <botan/der_enc.h> @@ -11,9 +13,9 @@ namespace Botan { -/************************************************* -* BER Decoding Exceptions * -*************************************************/ +/* +* BER Decoding Exceptions +*/ BER_Decoding_Error::BER_Decoding_Error(const std::string& str) : Decoding_Error("BER: " + str) {} @@ -26,9 +28,9 @@ BER_Bad_Tag::BER_Bad_Tag(const std::string& str, namespace ASN1 { -/************************************************* -* Put some arbitrary bytes into a SEQUENCE * -*************************************************/ +/* +* Put some arbitrary bytes into a SEQUENCE +*/ SecureVector<byte> put_in_sequence(const MemoryRegion<byte>& contents) { return DER_Encoder() @@ -38,18 +40,18 @@ SecureVector<byte> put_in_sequence(const MemoryRegion<byte>& contents) .get_contents(); } -/************************************************* -* Convert a BER object into a string object * -*************************************************/ +/* +* Convert a BER object into a string object +*/ std::string to_string(const BER_Object& obj) { return std::string(reinterpret_cast<const char*>(obj.value.begin()), obj.value.size()); } -/************************************************* -* Do heuristic tests for BER data * -*************************************************/ +/* +* Do heuristic tests for BER data +*/ bool maybe_BER(DataSource& source) { byte first_byte; diff --git a/src/asn1/asn1_int.h b/src/asn1/asn1_int.h index 3e0562b9c..619f45b53 100644 --- a/src/asn1/asn1_int.h +++ b/src/asn1/asn1_int.h @@ -1,7 +1,9 @@ -/************************************************* -* ASN.1 Internals Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* ASN.1 Internals +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_ASN1_H__ #define BOTAN_ASN1_H__ @@ -11,9 +13,9 @@ namespace Botan { -/************************************************* -* ASN.1 Type and Class Tags * -*************************************************/ +/* +* ASN.1 Type and Class Tags +*/ enum ASN1_Tag { UNIVERSAL = 0x00, APPLICATION = 0x40, @@ -48,9 +50,9 @@ enum ASN1_Tag { DIRECTORY_STRING = 0xFF01 }; -/************************************************* -* Basic ASN.1 Object Interface * -*************************************************/ +/* +* Basic ASN.1 Object Interface +*/ class BOTAN_DLL ASN1_Object { public: @@ -59,9 +61,9 @@ class BOTAN_DLL ASN1_Object virtual ~ASN1_Object() {} }; -/************************************************* -* BER Encoded Object * -*************************************************/ +/* +* BER Encoded Object +*/ class BOTAN_DLL BER_Object { public: @@ -71,9 +73,9 @@ class BOTAN_DLL BER_Object SecureVector<byte> value; }; -/************************************************* -* ASN.1 Utility Functions * -*************************************************/ +/* +* ASN.1 Utility Functions +*/ class DataSource; namespace ASN1 { @@ -84,17 +86,17 @@ bool maybe_BER(DataSource&); } -/************************************************* -* General BER Decoding Error Exception * -*************************************************/ +/* +* General BER Decoding Error Exception +*/ struct BER_Decoding_Error : public Decoding_Error { BER_Decoding_Error(const std::string&); }; -/************************************************* -* Exception For Incorrect BER Taggings * -*************************************************/ +/* +* Exception For Incorrect BER Taggings +*/ struct BER_Bad_Tag : public BER_Decoding_Error { BER_Bad_Tag(const std::string&, ASN1_Tag); diff --git a/src/asn1/asn1_obj.h b/src/asn1/asn1_obj.h index 67645ca08..ea21c475f 100644 --- a/src/asn1/asn1_obj.h +++ b/src/asn1/asn1_obj.h @@ -1,8 +1,10 @@ -/************************************************* -* Common ASN.1 Objects Header File * -* (C) 1999-2007 Jack Lloyd * -* 2007 Yves Jerschow * -*************************************************/ +/* +* Common ASN.1 Objects +* (C) 1999-2007 Jack Lloyd +* 2007 Yves Jerschow +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_ASN1_OBJ_H__ #define BOTAN_ASN1_OBJ_H__ @@ -15,9 +17,9 @@ namespace Botan { -/************************************************* -* Attribute * -*************************************************/ +/* +* Attribute +*/ class BOTAN_DLL Attribute : public ASN1_Object { public: @@ -32,9 +34,9 @@ class BOTAN_DLL Attribute : public ASN1_Object Attribute(const std::string&, const MemoryRegion<byte>&); }; -/************************************************* -* X.509 Time * -*************************************************/ +/* +* X.509 Time +*/ class BOTAN_DLL X509_Time : public ASN1_Object { public: @@ -59,9 +61,9 @@ class BOTAN_DLL X509_Time : public ASN1_Object ASN1_Tag tag; }; -/************************************************* -* Simple String * -*************************************************/ +/* +* Simple String +*/ class BOTAN_DLL ASN1_String : public ASN1_Object { public: @@ -80,9 +82,9 @@ class BOTAN_DLL ASN1_String : public ASN1_Object ASN1_Tag tag; }; -/************************************************* -* Distinguished Name * -*************************************************/ +/* +* Distinguished Name +*/ class BOTAN_DLL X509_DN : public ASN1_Object { public: @@ -110,9 +112,9 @@ class BOTAN_DLL X509_DN : public ASN1_Object MemoryVector<byte> dn_bits; }; -/************************************************* -* Alternative Name * -*************************************************/ +/* +* Alternative Name +*/ class BOTAN_DLL AlternativeName : public ASN1_Object { public: @@ -136,9 +138,9 @@ class BOTAN_DLL AlternativeName : public ASN1_Object std::multimap<OID, ASN1_String> othernames; }; -/************************************************* -* Comparison Operations * -*************************************************/ +/* +* Comparison Operations +*/ bool BOTAN_DLL operator==(const X509_Time&, const X509_Time&); bool BOTAN_DLL operator!=(const X509_Time&, const X509_Time&); bool BOTAN_DLL operator<=(const X509_Time&, const X509_Time&); @@ -148,9 +150,9 @@ bool BOTAN_DLL operator==(const X509_DN&, const X509_DN&); bool BOTAN_DLL operator!=(const X509_DN&, const X509_DN&); bool BOTAN_DLL operator<(const X509_DN&, const X509_DN&); -/************************************************* -* Helper Functions * -*************************************************/ +/* +* Helper Functions +*/ bool BOTAN_DLL is_string_type(ASN1_Tag); } diff --git a/src/asn1/asn1_oid.cpp b/src/asn1/asn1_oid.cpp index 80968ed8f..531ceb9b2 100644 --- a/src/asn1/asn1_oid.cpp +++ b/src/asn1/asn1_oid.cpp @@ -1,7 +1,9 @@ -/************************************************* -* ASN.1 OID Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* ASN.1 OID +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/asn1_oid.h> #include <botan/der_enc.h> @@ -11,9 +13,9 @@ namespace Botan { -/************************************************* -* ASN.1 OID Constructor * -*************************************************/ +/* +* ASN.1 OID Constructor +*/ OID::OID(const std::string& oid_str) { if(oid_str != "") @@ -26,17 +28,17 @@ OID::OID(const std::string& oid_str) } } -/************************************************* -* Clear the current OID * -*************************************************/ +/* +* Clear the current OID +*/ void OID::clear() { id.clear(); } -/************************************************* -* Return this OID as a string * -*************************************************/ +/* +* Return this OID as a string +*/ std::string OID::as_string() const { std::string oid_str; @@ -49,9 +51,9 @@ std::string OID::as_string() const return oid_str; } -/************************************************* -* OID equality comparison * -*************************************************/ +/* +* OID equality comparison +*/ bool OID::operator==(const OID& oid) const { if(id.size() != oid.id.size()) @@ -62,18 +64,18 @@ bool OID::operator==(const OID& oid) const return true; } -/************************************************* -* Append another component to the OID * -*************************************************/ +/* +* Append another component to the OID +*/ OID& OID::operator+=(u32bit component) { id.push_back(component); return (*this); } -/************************************************* -* Append another component to the OID * -*************************************************/ +/* +* Append another component to the OID +*/ OID operator+(const OID& oid, u32bit component) { OID new_oid(oid); @@ -81,17 +83,17 @@ OID operator+(const OID& oid, u32bit component) return new_oid; } -/************************************************* -* OID inequality comparison * -*************************************************/ +/* +* OID inequality comparison +*/ bool operator!=(const OID& a, const OID& b) { return !(a == b); } -/************************************************* -* Compare two OIDs * -*************************************************/ +/* +* Compare two OIDs +*/ bool operator<(const OID& a, const OID& b) { std::vector<u32bit> oid1 = a.get_id(); @@ -111,9 +113,9 @@ bool operator<(const OID& a, const OID& b) return false; } -/************************************************* -* DER encode an OBJECT IDENTIFIER * -*************************************************/ +/* +* DER encode an OBJECT IDENTIFIER +*/ void OID::encode_into(DER_Encoder& der) const { if(id.size() < 2) @@ -139,9 +141,9 @@ void OID::encode_into(DER_Encoder& der) const der.add_object(OBJECT_ID, UNIVERSAL, encoding); } -/************************************************* -* Decode a BER encoded OBJECT IDENTIFIER * -*************************************************/ +/* +* Decode a BER encoded OBJECT IDENTIFIER +*/ void OID::decode_from(BER_Decoder& decoder) { BER_Object obj = decoder.get_next_object(); diff --git a/src/asn1/asn1_oid.h b/src/asn1/asn1_oid.h index 3802c69b6..e6d077bee 100644 --- a/src/asn1/asn1_oid.h +++ b/src/asn1/asn1_oid.h @@ -1,7 +1,9 @@ -/************************************************* -* ASN.1 OID Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* ASN.1 OID +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_ASN1_OID_H__ #define BOTAN_ASN1_OID_H__ diff --git a/src/asn1/asn1_str.cpp b/src/asn1/asn1_str.cpp index bca1bf3c3..25782e239 100644 --- a/src/asn1/asn1_str.cpp +++ b/src/asn1/asn1_str.cpp @@ -1,7 +1,9 @@ -/************************************************* -* Simple ASN.1 String Types Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* Simple ASN.1 String Types +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/asn1_obj.h> #include <botan/der_enc.h> @@ -13,9 +15,9 @@ namespace Botan { namespace { -/************************************************* -* Choose an encoding for the string * -*************************************************/ +/* +* Choose an encoding for the string +*/ ASN1_Tag choose_encoding(const std::string& str, const std::string& type) { @@ -57,9 +59,9 @@ ASN1_Tag choose_encoding(const std::string& str, } -/************************************************* -* Check if type is a known ASN.1 string type * -*************************************************/ +/* +* Check if type is a known ASN.1 string type +*/ bool is_string_type(ASN1_Tag tag) { if(tag == NUMERIC_STRING || tag == PRINTABLE_STRING || @@ -69,9 +71,9 @@ bool is_string_type(ASN1_Tag tag) return false; } -/************************************************* -* Create an ASN1_String * -*************************************************/ +/* +* Create an ASN1_String +*/ ASN1_String::ASN1_String(const std::string& str, ASN1_Tag t) : tag(t) { iso_8859_str = Charset::transcode(str, LOCAL_CHARSET, LATIN1_CHARSET); @@ -90,42 +92,42 @@ ASN1_String::ASN1_String(const std::string& str, ASN1_Tag t) : tag(t) to_string(tag)); } -/************************************************* -* Create an ASN1_String * -*************************************************/ +/* +* Create an ASN1_String +*/ ASN1_String::ASN1_String(const std::string& str) { iso_8859_str = Charset::transcode(str, LOCAL_CHARSET, LATIN1_CHARSET); tag = choose_encoding(iso_8859_str, "latin1"); } -/************************************************* -* Return this string in ISO 8859-1 encoding * -*************************************************/ +/* +* Return this string in ISO 8859-1 encoding +*/ std::string ASN1_String::iso_8859() const { return iso_8859_str; } -/************************************************* -* Return this string in local encoding * -*************************************************/ +/* +* Return this string in local encoding +*/ std::string ASN1_String::value() const { return Charset::transcode(iso_8859_str, LATIN1_CHARSET, LOCAL_CHARSET); } -/************************************************* -* Return the type of this string object * -*************************************************/ +/* +* Return the type of this string object +*/ ASN1_Tag ASN1_String::tagging() const { return tag; } -/************************************************* -* DER encode an ASN1_String * -*************************************************/ +/* +* DER encode an ASN1_String +*/ void ASN1_String::encode_into(DER_Encoder& encoder) const { std::string value = iso_8859(); @@ -134,9 +136,9 @@ void ASN1_String::encode_into(DER_Encoder& encoder) const encoder.add_object(tagging(), UNIVERSAL, value); } -/************************************************* -* Decode a BER encoded ASN1_String * -*************************************************/ +/* +* Decode a BER encoded ASN1_String +*/ void ASN1_String::decode_from(BER_Decoder& source) { BER_Object obj = source.get_next_object(); diff --git a/src/asn1/asn1_tm.cpp b/src/asn1/asn1_tm.cpp index 7cd051af7..f85ea128b 100644 --- a/src/asn1/asn1_tm.cpp +++ b/src/asn1/asn1_tm.cpp @@ -1,7 +1,9 @@ -/************************************************* -* X.509 Time Types Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* X.509 Time Types +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/asn1_obj.h> #include <botan/der_enc.h> @@ -14,9 +16,9 @@ namespace Botan { namespace { -/************************************************* -* Convert a time_t to a struct tm * -*************************************************/ +/* +* Convert a time_t to a struct tm +*/ std::tm get_tm(u64bit timer) { std::time_t time_val = static_cast<std::time_t>(timer); @@ -30,17 +32,17 @@ std::tm get_tm(u64bit timer) } -/************************************************* -* Create an X509_Time * -*************************************************/ +/* +* Create an X509_Time +*/ X509_Time::X509_Time(const std::string& time_str) { set_to(time_str); } -/************************************************* -* Create an X509_Time * -*************************************************/ +/* +* Create an X509_Time +*/ X509_Time::X509_Time(u64bit timer) { std::tm time_info = get_tm(timer); @@ -58,17 +60,17 @@ X509_Time::X509_Time(u64bit timer) tag = UTC_TIME; } -/************************************************* -* Create an X509_Time * -*************************************************/ +/* +* Create an X509_Time +*/ X509_Time::X509_Time(const std::string& t_spec, ASN1_Tag t) : tag(t) { set_to(t_spec, tag); } -/************************************************* -* Set the time with a human readable string * -*************************************************/ +/* +* Set the time with a human readable string +*/ void X509_Time::set_to(const std::string& time_str) { if(time_str == "") @@ -113,9 +115,9 @@ void X509_Time::set_to(const std::string& time_str) throw Invalid_Argument("Invalid time specification " + time_str); } -/************************************************* -* Set the time with an ISO time format string * -*************************************************/ +/* +* Set the time with an ISO time format string +*/ void X509_Time::set_to(const std::string& t_spec, ASN1_Tag tag) { if(tag != GENERALIZED_TIME && tag != UTC_TIME) @@ -164,9 +166,9 @@ void X509_Time::set_to(const std::string& t_spec, ASN1_Tag tag) throw Invalid_Argument("Invalid time specification " + t_spec); } -/************************************************* -* DER encode a X509_Time * -*************************************************/ +/* +* DER encode a X509_Time +*/ void X509_Time::encode_into(DER_Encoder& der) const { if(tag != GENERALIZED_TIME && tag != UTC_TIME) @@ -176,9 +178,9 @@ void X509_Time::encode_into(DER_Encoder& der) const LOCAL_CHARSET, LATIN1_CHARSET)); } -/************************************************* -* Decode a BER encoded X509_Time * -*************************************************/ +/* +* Decode a BER encoded X509_Time +*/ void X509_Time::decode_from(BER_Decoder& source) { BER_Object ber_time = source.get_next_object(); @@ -187,9 +189,9 @@ void X509_Time::decode_from(BER_Decoder& source) ber_time.type_tag); } -/************************************************* -* Return a string representation of the time * -*************************************************/ +/* +* Return a string representation of the time +*/ std::string X509_Time::as_string() const { if(time_is_set() == false) @@ -212,17 +214,17 @@ std::string X509_Time::as_string() const return asn1rep; } -/************************************************* -* Return if the time has been set somehow * -*************************************************/ +/* +* Return if the time has been set somehow +*/ bool X509_Time::time_is_set() const { return (year != 0); } -/************************************************* -* Return a human readable string representation * -*************************************************/ +/* +* Return a human readable string representation +*/ std::string X509_Time::readable_string() const { if(time_is_set() == false) @@ -238,9 +240,9 @@ std::string X509_Time::readable_string() const return readable; } -/************************************************* -* Do a general sanity check on the time * -*************************************************/ +/* +* Do a general sanity check on the time +*/ bool X509_Time::passes_sanity_check() const { if(year < 1950 || year > 2100) @@ -254,9 +256,9 @@ bool X509_Time::passes_sanity_check() const return true; } -/************************************************* -* Compare this time against another * -*************************************************/ +/* +* Compare this time against another +*/ s32bit X509_Time::cmp(const X509_Time& other) const { if(time_is_set() == false) @@ -280,9 +282,9 @@ s32bit X509_Time::cmp(const X509_Time& other) const return SAME_TIME; } -/************************************************* -* Compare two X509_Times for in various ways * -*************************************************/ +/* +* Compare two X509_Times for in various ways +*/ bool operator==(const X509_Time& t1, const X509_Time& t2) { return (t1.cmp(t2) == 0); } bool operator!=(const X509_Time& t1, const X509_Time& t2) diff --git a/src/asn1/ber_dec.cpp b/src/asn1/ber_dec.cpp index c725a5af9..ce6046652 100644 --- a/src/asn1/ber_dec.cpp +++ b/src/asn1/ber_dec.cpp @@ -1,7 +1,9 @@ -/************************************************* -* BER Decoder Source File * -* (C) 1999-2008 Jack Lloyd * -*************************************************/ +/* +* BER Decoder +* (C) 1999-2008 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/ber_dec.h> #include <botan/bigint.h> @@ -11,9 +13,9 @@ namespace Botan { namespace { -/************************************************* -* BER decode an ASN.1 type tag * -*************************************************/ +/* +* BER decode an ASN.1 type tag +*/ u32bit decode_tag(DataSource* ber, ASN1_Tag& type_tag, ASN1_Tag& class_tag) { byte b; @@ -48,14 +50,14 @@ u32bit decode_tag(DataSource* ber, ASN1_Tag& type_tag, ASN1_Tag& class_tag) return tag_bytes; } -/************************************************* -* Find the EOC marker * -*************************************************/ +/* +* Find the EOC marker +*/ u32bit find_eoc(DataSource*); -/************************************************* -* BER decode an ASN.1 length field * -*************************************************/ +/* +* BER decode an ASN.1 length field +*/ u32bit decode_length(DataSource* ber, u32bit& field_size) { byte b; @@ -83,18 +85,18 @@ u32bit decode_length(DataSource* ber, u32bit& field_size) return length; } -/************************************************* -* BER decode an ASN.1 length field * -*************************************************/ +/* +* BER decode an ASN.1 length field +*/ u32bit decode_length(DataSource* ber) { u32bit dummy; return decode_length(ber, dummy); } -/************************************************* -* Find the EOC marker * -*************************************************/ +/* +* Find the EOC marker +*/ u32bit find_eoc(DataSource* ber) { SecureVector<byte> buffer(DEFAULT_BUFFERSIZE), data; @@ -132,18 +134,18 @@ u32bit find_eoc(DataSource* ber) } -/************************************************* -* Check a type invariant on BER data * -*************************************************/ +/* +* Check a type invariant on BER data +*/ void BER_Object::assert_is_a(ASN1_Tag type_tag, ASN1_Tag class_tag) { if(this->type_tag != type_tag || this->class_tag != class_tag) throw BER_Decoding_Error("Tag mismatch when decoding"); } -/************************************************* -* Check if more objects are there * -*************************************************/ +/* +* Check if more objects are there +*/ bool BER_Decoder::more_items() const { if(source->end_of_data() && (pushed.type_tag == NO_OBJECT)) @@ -151,9 +153,9 @@ bool BER_Decoder::more_items() const return true; } -/************************************************* -* Verify that no bytes remain in the source * -*************************************************/ +/* +* Verify that no bytes remain in the source +*/ BER_Decoder& BER_Decoder::verify_end() { if(!source->end_of_data() || (pushed.type_tag != NO_OBJECT)) @@ -161,9 +163,9 @@ BER_Decoder& BER_Decoder::verify_end() return (*this); } -/************************************************* -* Save all the bytes remaining in the source * -*************************************************/ +/* +* Save all the bytes remaining in the source +*/ BER_Decoder& BER_Decoder::raw_bytes(MemoryRegion<byte>& out) { out.destroy(); @@ -173,9 +175,9 @@ BER_Decoder& BER_Decoder::raw_bytes(MemoryRegion<byte>& out) return (*this); } -/************************************************* -* Discard all the bytes remaining in the source * -*************************************************/ +/* +* Discard all the bytes remaining in the source +*/ BER_Decoder& BER_Decoder::discard_remaining() { byte buf; @@ -184,9 +186,9 @@ BER_Decoder& BER_Decoder::discard_remaining() return (*this); } -/************************************************* -* Return the BER encoding of the next object * -*************************************************/ +/* +* Return the BER encoding of the next object +*/ BER_Object BER_Decoder::get_next_object() { BER_Object next; @@ -213,9 +215,9 @@ BER_Object BER_Decoder::get_next_object() return next; } -/************************************************* -* Push a object back into the stream * -*************************************************/ +/* +* Push a object back into the stream +*/ void BER_Decoder::push_back(const BER_Object& obj) { if(pushed.type_tag != NO_OBJECT) @@ -223,9 +225,9 @@ void BER_Decoder::push_back(const BER_Object& obj) pushed = obj; } -/************************************************* -* Begin decoding a CONSTRUCTED type * -*************************************************/ +/* +* Begin decoding a CONSTRUCTED type +*/ BER_Decoder BER_Decoder::start_cons(ASN1_Tag type_tag, ASN1_Tag class_tag) { @@ -237,9 +239,9 @@ BER_Decoder BER_Decoder::start_cons(ASN1_Tag type_tag, return result; } -/************************************************* -* Finish decoding a CONSTRUCTED type * -*************************************************/ +/* +* Finish decoding a CONSTRUCTED type +*/ BER_Decoder& BER_Decoder::end_cons() { if(!parent) @@ -249,9 +251,9 @@ BER_Decoder& BER_Decoder::end_cons() return (*parent); } -/************************************************* -* BER_Decoder Constructor * -*************************************************/ +/* +* BER_Decoder Constructor +*/ BER_Decoder::BER_Decoder(DataSource& src) { source = &src; @@ -260,9 +262,9 @@ BER_Decoder::BER_Decoder(DataSource& src) parent = 0; } -/************************************************* -* BER_Decoder Constructor * - *************************************************/ +/* +* BER_Decoder Constructor + */ BER_Decoder::BER_Decoder(const byte data[], u32bit length) { source = new DataSource_Memory(data, length); @@ -271,9 +273,9 @@ BER_Decoder::BER_Decoder(const byte data[], u32bit length) parent = 0; } -/************************************************* -* BER_Decoder Constructor * -*************************************************/ +/* +* BER_Decoder Constructor +*/ BER_Decoder::BER_Decoder(const MemoryRegion<byte>& data) { source = new DataSource_Memory(data); @@ -282,9 +284,9 @@ BER_Decoder::BER_Decoder(const MemoryRegion<byte>& data) parent = 0; } -/************************************************* -* BER_Decoder Copy Constructor * -*************************************************/ +/* +* BER_Decoder Copy Constructor +*/ BER_Decoder::BER_Decoder(const BER_Decoder& other) { source = other.source; @@ -298,9 +300,9 @@ BER_Decoder::BER_Decoder(const BER_Decoder& other) parent = other.parent; } -/************************************************* -* BER_Decoder Destructor * -*************************************************/ +/* +* BER_Decoder Destructor +*/ BER_Decoder::~BER_Decoder() { if(owns) @@ -308,18 +310,18 @@ BER_Decoder::~BER_Decoder() source = 0; } -/************************************************* -* Request for an object to decode itself * -*************************************************/ +/* +* Request for an object to decode itself +*/ BER_Decoder& BER_Decoder::decode(ASN1_Object& obj) { obj.decode_from(*this); return (*this); } -/************************************************* -* Decode a BER encoded NULL * -*************************************************/ +/* +* Decode a BER encoded NULL +*/ BER_Decoder& BER_Decoder::decode_null() { BER_Object obj = get_next_object(); @@ -329,33 +331,33 @@ BER_Decoder& BER_Decoder::decode_null() return (*this); } -/************************************************* -* Decode a BER encoded BOOLEAN * -*************************************************/ +/* +* Decode a BER encoded BOOLEAN +*/ BER_Decoder& BER_Decoder::decode(bool& out) { return decode(out, BOOLEAN, UNIVERSAL); } -/************************************************* -* Decode a small BER encoded INTEGER * -*************************************************/ +/* +* Decode a small BER encoded INTEGER +*/ BER_Decoder& BER_Decoder::decode(u32bit& out) { return decode(out, INTEGER, UNIVERSAL); } -/************************************************* -* Decode a BER encoded INTEGER * -*************************************************/ +/* +* Decode a BER encoded INTEGER +*/ BER_Decoder& BER_Decoder::decode(BigInt& out) { return decode(out, INTEGER, UNIVERSAL); } -/************************************************* -* Decode a BER encoded BOOLEAN * -*************************************************/ +/* +* Decode a BER encoded BOOLEAN +*/ BER_Decoder& BER_Decoder::decode(bool& out, ASN1_Tag type_tag, ASN1_Tag class_tag) { @@ -369,9 +371,9 @@ BER_Decoder& BER_Decoder::decode(bool& out, return (*this); } -/************************************************* -* Decode a small BER encoded INTEGER * -*************************************************/ +/* +* Decode a small BER encoded INTEGER +*/ BER_Decoder& BER_Decoder::decode(u32bit& out, ASN1_Tag type_tag, ASN1_Tag class_tag) { @@ -381,9 +383,9 @@ BER_Decoder& BER_Decoder::decode(u32bit& out, return (*this); } -/************************************************* -* Decode a BER encoded INTEGER * -*************************************************/ +/* +* Decode a BER encoded INTEGER +*/ BER_Decoder& BER_Decoder::decode(BigInt& out, ASN1_Tag type_tag, ASN1_Tag class_tag) { @@ -414,17 +416,17 @@ BER_Decoder& BER_Decoder::decode(BigInt& out, return (*this); } -/************************************************* -* BER decode a BIT STRING or OCTET STRING * -*************************************************/ +/* +* BER decode a BIT STRING or OCTET STRING +*/ BER_Decoder& BER_Decoder::decode(MemoryRegion<byte>& out, ASN1_Tag real_type) { return decode(out, real_type, real_type, UNIVERSAL); } -/************************************************* -* BER decode a BIT STRING or OCTET STRING * -*************************************************/ +/* +* BER decode a BIT STRING or OCTET STRING +*/ BER_Decoder& BER_Decoder::decode(MemoryRegion<byte>& buffer, ASN1_Tag real_type, ASN1_Tag type_tag, ASN1_Tag class_tag) @@ -446,9 +448,9 @@ BER_Decoder& BER_Decoder::decode(MemoryRegion<byte>& buffer, return (*this); } -/************************************************* -* Decode an OPTIONAL string type * -*************************************************/ +/* +* Decode an OPTIONAL string type +*/ BER_Decoder& BER_Decoder::decode_optional_string(MemoryRegion<byte>& out, ASN1_Tag real_type, u16bit type_no) diff --git a/src/asn1/ber_dec.h b/src/asn1/ber_dec.h index 1888953d1..2e38af301 100644 --- a/src/asn1/ber_dec.h +++ b/src/asn1/ber_dec.h @@ -1,7 +1,9 @@ -/************************************************* -* BER Decoder Header File * -* (C) 1999-2008 Jack Lloyd * -*************************************************/ +/* +* BER Decoder +* (C) 1999-2008 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_BER_DECODER_H__ #define BOTAN_BER_DECODER_H__ @@ -11,9 +13,9 @@ namespace Botan { -/************************************************* -* BER Decoding Object * -*************************************************/ +/* +* BER Decoding Object +*/ class BOTAN_DLL BER_Decoder { public: @@ -67,9 +69,9 @@ class BOTAN_DLL BER_Decoder mutable bool owns; }; -/************************************************* -* Decode an OPTIONAL or DEFAULT element * -*************************************************/ +/* +* Decode an OPTIONAL or DEFAULT element +*/ template<typename T> BER_Decoder& BER_Decoder::decode_optional(T& out, ASN1_Tag type_tag, @@ -97,9 +99,9 @@ BER_Decoder& BER_Decoder::decode_optional(T& out, return (*this); } -/************************************************* -* Decode a list of homogenously typed values * -*************************************************/ +/* +* Decode a list of homogenously typed values +*/ template<typename T> BER_Decoder& BER_Decoder::decode_list(std::vector<T>& vec, bool clear_it) { diff --git a/src/asn1/der_enc.cpp b/src/asn1/der_enc.cpp index 1ab5ddd4e..bee269431 100644 --- a/src/asn1/der_enc.cpp +++ b/src/asn1/der_enc.cpp @@ -1,7 +1,9 @@ -/************************************************* -* DER Encoder Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* DER Encoder +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/der_enc.h> #include <botan/asn1_int.h> @@ -15,9 +17,9 @@ namespace Botan { namespace { -/************************************************* -* DER encode an ASN.1 type tag * -*************************************************/ +/* +* DER encode an ASN.1 type tag +*/ SecureVector<byte> encode_tag(ASN1_Tag type_tag, ASN1_Tag class_tag) { if((class_tag | 0xE0) != 0xE0) @@ -41,9 +43,9 @@ SecureVector<byte> encode_tag(ASN1_Tag type_tag, ASN1_Tag class_tag) return encoded_tag; } -/************************************************* -* DER encode an ASN.1 length field * -*************************************************/ +/* +* DER encode an ASN.1 length field +*/ SecureVector<byte> encode_length(u32bit length) { SecureVector<byte> encoded_length; @@ -61,9 +63,9 @@ SecureVector<byte> encode_length(u32bit length) } -/************************************************* -* Return the encoded SEQUENCE/SET * -*************************************************/ +/* +* Return the encoded SEQUENCE/SET +*/ SecureVector<byte> DER_Encoder::DER_Sequence::get_contents() { const ASN1_Tag real_class_tag = ASN1_Tag(class_tag | CONSTRUCTED); @@ -88,9 +90,9 @@ SecureVector<byte> DER_Encoder::DER_Sequence::get_contents() return retval; } -/************************************************* -* Add an encoded value to the SEQUENCE/SET * -*************************************************/ +/* +* Add an encoded value to the SEQUENCE/SET +*/ void DER_Encoder::DER_Sequence::add_bytes(const byte data[], u32bit length) { if(type_tag == SET) @@ -99,25 +101,25 @@ void DER_Encoder::DER_Sequence::add_bytes(const byte data[], u32bit length) contents.append(data, length); } -/************************************************* -* Return the type and class taggings * -*************************************************/ +/* +* Return the type and class taggings +*/ ASN1_Tag DER_Encoder::DER_Sequence::tag_of() const { return ASN1_Tag(type_tag | class_tag); } -/************************************************* -* DER_Sequence Constructor * -*************************************************/ +/* +* DER_Sequence Constructor +*/ DER_Encoder::DER_Sequence::DER_Sequence(ASN1_Tag t1, ASN1_Tag t2) : type_tag(t1), class_tag(t2) { } -/************************************************* -* Return the encoded contents * -*************************************************/ +/* +* Return the encoded contents +*/ SecureVector<byte> DER_Encoder::get_contents() { if(subsequences.size() != 0) @@ -129,9 +131,9 @@ SecureVector<byte> DER_Encoder::get_contents() return retval; } -/************************************************* -* Start a new ASN.1 SEQUENCE/SET/EXPLICIT * -*************************************************/ +/* +* Start a new ASN.1 SEQUENCE/SET/EXPLICIT +*/ DER_Encoder& DER_Encoder::start_cons(ASN1_Tag type_tag, ASN1_Tag class_tag) { @@ -139,9 +141,9 @@ DER_Encoder& DER_Encoder::start_cons(ASN1_Tag type_tag, return (*this); } -/************************************************* -* Finish the current ASN.1 SEQUENCE/SET/EXPLICIT * -*************************************************/ +/* +* Finish the current ASN.1 SEQUENCE/SET/EXPLICIT +*/ DER_Encoder& DER_Encoder::end_cons() { if(subsequences.empty()) @@ -153,9 +155,9 @@ DER_Encoder& DER_Encoder::end_cons() return (*this); } -/************************************************* -* Start a new ASN.1 EXPLICIT encoding * -*************************************************/ +/* +* Start a new ASN.1 EXPLICIT encoding +*/ DER_Encoder& DER_Encoder::start_explicit(u16bit type_no) { ASN1_Tag type_tag = static_cast<ASN1_Tag>(type_no); @@ -166,25 +168,25 @@ DER_Encoder& DER_Encoder::start_explicit(u16bit type_no) return start_cons(type_tag, CONTEXT_SPECIFIC); } -/************************************************* -* Finish the current ASN.1 EXPLICIT encoding * -*************************************************/ +/* +* Finish the current ASN.1 EXPLICIT encoding +*/ DER_Encoder& DER_Encoder::end_explicit() { return end_cons(); } -/************************************************* -* Write raw bytes into the stream * -*************************************************/ +/* +* Write raw bytes into the stream +*/ DER_Encoder& DER_Encoder::raw_bytes(const MemoryRegion<byte>& val) { return raw_bytes(val.begin(), val.size()); } -/************************************************* -* Write raw bytes into the stream * -*************************************************/ +/* +* Write raw bytes into the stream +*/ DER_Encoder& DER_Encoder::raw_bytes(const byte bytes[], u32bit length) { if(subsequences.size()) @@ -195,41 +197,41 @@ DER_Encoder& DER_Encoder::raw_bytes(const byte bytes[], u32bit length) return (*this); } -/************************************************* -* Encode a NULL object * -*************************************************/ +/* +* Encode a NULL object +*/ DER_Encoder& DER_Encoder::encode_null() { return add_object(NULL_TAG, UNIVERSAL, 0, 0); } -/************************************************* -* DER encode a BOOLEAN * -*************************************************/ +/* +* DER encode a BOOLEAN +*/ DER_Encoder& DER_Encoder::encode(bool is_true) { return encode(is_true, BOOLEAN, UNIVERSAL); } -/************************************************* -* DER encode a small INTEGER * -*************************************************/ +/* +* DER encode a small INTEGER +*/ DER_Encoder& DER_Encoder::encode(u32bit n) { return encode(BigInt(n), INTEGER, UNIVERSAL); } -/************************************************* -* DER encode a small INTEGER * -*************************************************/ +/* +* DER encode a small INTEGER +*/ DER_Encoder& DER_Encoder::encode(const BigInt& n) { return encode(n, INTEGER, UNIVERSAL); } -/************************************************* -* DER encode an OCTET STRING or BIT STRING * -*************************************************/ +/* +* DER encode an OCTET STRING or BIT STRING +*/ DER_Encoder& DER_Encoder::encode(const MemoryRegion<byte>& bytes, ASN1_Tag real_type) { @@ -237,18 +239,18 @@ DER_Encoder& DER_Encoder::encode(const MemoryRegion<byte>& bytes, real_type, real_type, UNIVERSAL); } -/************************************************* -* Encode this object * -*************************************************/ +/* +* Encode this object +*/ DER_Encoder& DER_Encoder::encode(const byte bytes[], u32bit length, ASN1_Tag real_type) { return encode(bytes, length, real_type, real_type, UNIVERSAL); } -/************************************************* -* DER encode a BOOLEAN * -*************************************************/ +/* +* DER encode a BOOLEAN +*/ DER_Encoder& DER_Encoder::encode(bool is_true, ASN1_Tag type_tag, ASN1_Tag class_tag) { @@ -256,18 +258,18 @@ DER_Encoder& DER_Encoder::encode(bool is_true, return add_object(type_tag, class_tag, &val, 1); } -/************************************************* -* DER encode a small INTEGER * -*************************************************/ +/* +* DER encode a small INTEGER +*/ DER_Encoder& DER_Encoder::encode(u32bit n, ASN1_Tag type_tag, ASN1_Tag class_tag) { return encode(BigInt(n), type_tag, class_tag); } -/************************************************* -* DER encode an INTEGER * -*************************************************/ +/* +* DER encode an INTEGER +*/ DER_Encoder& DER_Encoder::encode(const BigInt& n, ASN1_Tag type_tag, ASN1_Tag class_tag) { @@ -289,9 +291,9 @@ DER_Encoder& DER_Encoder::encode(const BigInt& n, return add_object(type_tag, class_tag, contents); } -/************************************************* -* DER encode an OCTET STRING or BIT STRING * -*************************************************/ +/* +* DER encode an OCTET STRING or BIT STRING +*/ DER_Encoder& DER_Encoder::encode(const MemoryRegion<byte>& bytes, ASN1_Tag real_type, ASN1_Tag type_tag, ASN1_Tag class_tag) @@ -300,9 +302,9 @@ DER_Encoder& DER_Encoder::encode(const MemoryRegion<byte>& bytes, real_type, type_tag, class_tag); } -/************************************************* -* DER encode an OCTET STRING or BIT STRING * -*************************************************/ +/* +* DER encode an OCTET STRING or BIT STRING +*/ DER_Encoder& DER_Encoder::encode(const byte bytes[], u32bit length, ASN1_Tag real_type, ASN1_Tag type_tag, ASN1_Tag class_tag) @@ -321,9 +323,9 @@ DER_Encoder& DER_Encoder::encode(const byte bytes[], u32bit length, return add_object(type_tag, class_tag, bytes, length); } -/************************************************* -* Conditionally write some values to the stream * -*************************************************/ +/* +* Conditionally write some values to the stream +*/ DER_Encoder& DER_Encoder::encode_if(bool cond, DER_Encoder& codec) { if(cond) @@ -331,18 +333,18 @@ DER_Encoder& DER_Encoder::encode_if(bool cond, DER_Encoder& codec) return (*this); } -/************************************************* -* Request for an object to encode itself * -*************************************************/ +/* +* Request for an object to encode itself +*/ DER_Encoder& DER_Encoder::encode(const ASN1_Object& obj) { obj.encode_into(*this); return (*this); } -/************************************************* -* Write the encoding of the byte(s) * -*************************************************/ +/* +* Write the encoding of the byte(s) +*/ DER_Encoder& DER_Encoder::add_object(ASN1_Tag type_tag, ASN1_Tag class_tag, const byte rep[], u32bit length) { @@ -357,9 +359,9 @@ DER_Encoder& DER_Encoder::add_object(ASN1_Tag type_tag, ASN1_Tag class_tag, return raw_bytes(buffer); } -/************************************************* -* Write the encoding of the byte(s) * -*************************************************/ +/* +* Write the encoding of the byte(s) +*/ DER_Encoder& DER_Encoder::add_object(ASN1_Tag type_tag, ASN1_Tag class_tag, const MemoryRegion<byte>& rep_buf) { @@ -368,9 +370,9 @@ DER_Encoder& DER_Encoder::add_object(ASN1_Tag type_tag, ASN1_Tag class_tag, return add_object(type_tag, class_tag, rep, rep_len); } -/************************************************* -* Write the encoding of the byte(s) * -*************************************************/ +/* +* Write the encoding of the byte(s) +*/ DER_Encoder& DER_Encoder::add_object(ASN1_Tag type_tag, ASN1_Tag class_tag, const std::string& rep_str) { @@ -379,9 +381,9 @@ DER_Encoder& DER_Encoder::add_object(ASN1_Tag type_tag, ASN1_Tag class_tag, return add_object(type_tag, class_tag, rep, rep_len); } -/************************************************* -* Write the encoding of the byte * -*************************************************/ +/* +* Write the encoding of the byte +*/ DER_Encoder& DER_Encoder::add_object(ASN1_Tag type_tag, ASN1_Tag class_tag, byte rep) { diff --git a/src/asn1/der_enc.h b/src/asn1/der_enc.h index 5b3c11489..23b5297e5 100644 --- a/src/asn1/der_enc.h +++ b/src/asn1/der_enc.h @@ -1,7 +1,9 @@ -/************************************************* -* DER Encoder Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* DER Encoder +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_DER_ENCODER_H__ #define BOTAN_DER_ENCODER_H__ @@ -11,9 +13,9 @@ namespace Botan { -/************************************************* -* General DER Encoding Object * -*************************************************/ +/* +* General DER Encoding Object +*/ class BOTAN_DLL DER_Encoder { public: diff --git a/src/benchmark/benchmark.cpp b/src/benchmark/benchmark.cpp index 3089f8e94..d30e831b9 100644 --- a/src/benchmark/benchmark.cpp +++ b/src/benchmark/benchmark.cpp @@ -1,6 +1,8 @@ /** * Runtime benchmarking * (C) 2008 Jack Lloyd +* +* Distributed under the terms of the Botan license */ #include <botan/benchmark.h> diff --git a/src/benchmark/benchmark.h b/src/benchmark/benchmark.h index 145eb5500..272cfdfa2 100644 --- a/src/benchmark/benchmark.h +++ b/src/benchmark/benchmark.h @@ -1,6 +1,8 @@ /** * Runtime benchmarking * (C) 2008 Jack Lloyd +* +* Distributed under the terms of the Botan license */ #ifndef BOTAN_RUNTIME_BENCHMARK_H__ diff --git a/src/block/aes/aes.cpp b/src/block/aes/aes.cpp index 1c3f12aa0..9072b507b 100644 --- a/src/block/aes/aes.cpp +++ b/src/block/aes/aes.cpp @@ -1,6 +1,8 @@ /** -* AES Source File +* AES * (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license */ #include <botan/aes.h> diff --git a/src/block/aes/aes.h b/src/block/aes/aes.h index c7361f6e8..05e2e3123 100644 --- a/src/block/aes/aes.h +++ b/src/block/aes/aes.h @@ -1,6 +1,8 @@ /** -* AES Header File +* AES * (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license */ #ifndef BOTAN_AES_H__ diff --git a/src/block/aes/aes_tab.cpp b/src/block/aes/aes_tab.cpp index 3665bb746..d42a2cd60 100644 --- a/src/block/aes/aes_tab.cpp +++ b/src/block/aes/aes_tab.cpp @@ -1,7 +1,9 @@ -/************************************************* -* S-Box and Diffusion Tables for AES * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* S-Box and Diffusion Tables for AES +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/aes.h> diff --git a/src/block/block_cipher.h b/src/block/block_cipher.h index 61d3c87d9..01c45af04 100644 --- a/src/block/block_cipher.h +++ b/src/block/block_cipher.h @@ -1,6 +1,8 @@ /** * Block Cipher Base Class * (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license */ #ifndef BOTAN_BLOCK_CIPHER_H__ diff --git a/src/block/blowfish/blfs_tab.cpp b/src/block/blowfish/blfs_tab.cpp index f8fa07ee5..070fa6c69 100644 --- a/src/block/blowfish/blfs_tab.cpp +++ b/src/block/blowfish/blfs_tab.cpp @@ -1,7 +1,9 @@ -/************************************************* -* S-Box and P-Box Tables for Blowfish * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* S-Box and P-Box Tables for Blowfish +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/blowfish.h> diff --git a/src/block/blowfish/blowfish.cpp b/src/block/blowfish/blowfish.cpp index f55cffb62..b0599d6c5 100644 --- a/src/block/blowfish/blowfish.cpp +++ b/src/block/blowfish/blowfish.cpp @@ -1,16 +1,18 @@ -/************************************************* -* Blowfish Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* Blowfish +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/blowfish.h> #include <botan/loadstor.h> namespace Botan { -/************************************************* -* Blowfish Encryption * -*************************************************/ +/* +* Blowfish Encryption +*/ void Blowfish::enc(const byte in[], byte out[]) const { const u32bit* S1 = S + 0; @@ -37,9 +39,9 @@ void Blowfish::enc(const byte in[], byte out[]) const store_be(out, R, L); } -/************************************************* -* Blowfish Decryption * -*************************************************/ +/* +* Blowfish Decryption +*/ void Blowfish::dec(const byte in[], byte out[]) const { const u32bit* S1 = S + 0; @@ -66,9 +68,9 @@ void Blowfish::dec(const byte in[], byte out[]) const store_be(out, R, L); } -/************************************************* -* Blowfish Key Schedule * -*************************************************/ +/* +* Blowfish Key Schedule +*/ void Blowfish::key_schedule(const byte key[], u32bit length) { clear(); @@ -82,9 +84,9 @@ void Blowfish::key_schedule(const byte key[], u32bit length) generate_sbox(S, 1024, L, R); } -/************************************************* -* Generate one of the Sboxes * -*************************************************/ +/* +* Generate one of the Sboxes +*/ void Blowfish::generate_sbox(u32bit Box[], u32bit size, u32bit& L, u32bit& R) const { @@ -111,9 +113,9 @@ void Blowfish::generate_sbox(u32bit Box[], u32bit size, } } -/************************************************* -* Clear memory of sensitive data * -*************************************************/ +/* +* Clear memory of sensitive data +*/ void Blowfish::clear() throw() { P.copy(P_INIT, 18); diff --git a/src/block/blowfish/blowfish.h b/src/block/blowfish/blowfish.h index c4ef16683..f0f26418d 100644 --- a/src/block/blowfish/blowfish.h +++ b/src/block/blowfish/blowfish.h @@ -1,7 +1,9 @@ -/************************************************* -* Blowfish Header File * -* (C) 1999-2008 Jack Lloyd * -*************************************************/ +/* +* Blowfish +* (C) 1999-2008 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_BLOWFISH_H__ #define BOTAN_BLOWFISH_H__ @@ -10,9 +12,9 @@ namespace Botan { -/************************************************* -* Blowfish * -*************************************************/ +/* +* Blowfish +*/ class BOTAN_DLL Blowfish : public BlockCipher { public: diff --git a/src/block/cast/cast128.cpp b/src/block/cast/cast128.cpp index 6a6b46efd..fdb9428a6 100644 --- a/src/block/cast/cast128.cpp +++ b/src/block/cast/cast128.cpp @@ -1,7 +1,9 @@ -/************************************************* -* CAST-128 Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* CAST-128 +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/cast128.h> #include <botan/loadstor.h> @@ -11,9 +13,9 @@ namespace Botan { namespace { -/************************************************* -* CAST-128 Round Type 1 * -*************************************************/ +/* +* CAST-128 Round Type 1 +*/ inline void R1(u32bit& L, u32bit R, u32bit MK, u32bit RK) { u32bit T = rotate_left(MK + R, RK); @@ -21,9 +23,9 @@ inline void R1(u32bit& L, u32bit R, u32bit MK, u32bit RK) CAST_SBOX3[get_byte(2, T)] + CAST_SBOX4[get_byte(3, T)]; } -/************************************************* -* CAST-128 Round Type 2 * -*************************************************/ +/* +* CAST-128 Round Type 2 +*/ inline void R2(u32bit& L, u32bit R, u32bit MK, u32bit RK) { u32bit T = rotate_left(MK ^ R, RK); @@ -31,9 +33,9 @@ inline void R2(u32bit& L, u32bit R, u32bit MK, u32bit RK) CAST_SBOX3[get_byte(2, T)]) ^ CAST_SBOX4[get_byte(3, T)]; } -/************************************************* -* CAST-128 Round Type 3 * -*************************************************/ +/* +* CAST-128 Round Type 3 +*/ inline void R3(u32bit& L, u32bit R, u32bit MK, u32bit RK) { u32bit T = rotate_left(MK - R, RK); @@ -43,9 +45,9 @@ inline void R3(u32bit& L, u32bit R, u32bit MK, u32bit RK) } -/************************************************* -* CAST-128 Encryption * -*************************************************/ +/* +* CAST-128 Encryption +*/ void CAST_128::enc(const byte in[], byte out[]) const { u32bit L = load_be<u32bit>(in, 0); @@ -71,9 +73,9 @@ void CAST_128::enc(const byte in[], byte out[]) const store_be(out, R, L); } -/************************************************* -* CAST-128 Decryption * -*************************************************/ +/* +* CAST-128 Decryption +*/ void CAST_128::dec(const byte in[], byte out[]) const { u32bit L = load_be<u32bit>(in, 0); @@ -99,9 +101,9 @@ void CAST_128::dec(const byte in[], byte out[]) const store_be(out, R, L); } -/************************************************* -* CAST-128 Key Schedule * -*************************************************/ +/* +* CAST-128 Key Schedule +*/ void CAST_128::key_schedule(const byte key[], u32bit length) { clear(); @@ -116,9 +118,9 @@ void CAST_128::key_schedule(const byte key[], u32bit length) RK[j] %= 32; } -/************************************************* -* S-Box Based Key Expansion * -*************************************************/ +/* +* S-Box Based Key Expansion +*/ void CAST_128::key_schedule(u32bit K[16], u32bit X[4]) { class ByteReader diff --git a/src/block/cast/cast128.h b/src/block/cast/cast128.h index 2004de51a..680481482 100644 --- a/src/block/cast/cast128.h +++ b/src/block/cast/cast128.h @@ -1,7 +1,9 @@ -/************************************************* -* CAST-128 Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* CAST-128 +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_CAST128_H__ #define BOTAN_CAST128_H__ @@ -10,9 +12,9 @@ namespace Botan { -/************************************************* -* CAST-128 * -*************************************************/ +/* +* CAST-128 +*/ class BOTAN_DLL CAST_128 : public BlockCipher { public: diff --git a/src/block/cast/cast256.cpp b/src/block/cast/cast256.cpp index b8004851b..993bab46c 100644 --- a/src/block/cast/cast256.cpp +++ b/src/block/cast/cast256.cpp @@ -1,7 +1,9 @@ -/************************************************* -* CAST-256 Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* CAST-256 +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/cast256.h> #include <botan/loadstor.h> @@ -11,9 +13,9 @@ namespace Botan { namespace { -/************************************************* -* CAST-256 Round Type 1 * -*************************************************/ +/* +* CAST-256 Round Type 1 +*/ void round1(u32bit& out, u32bit in, u32bit mask, u32bit rot) { u32bit temp = rotate_left(mask + in, rot); @@ -21,9 +23,9 @@ void round1(u32bit& out, u32bit in, u32bit mask, u32bit rot) CAST_SBOX3[get_byte(2, temp)] + CAST_SBOX4[get_byte(3, temp)]; } -/************************************************* -* CAST-256 Round Type 2 * -*************************************************/ +/* +* CAST-256 Round Type 2 +*/ void round2(u32bit& out, u32bit in, u32bit mask, u32bit rot) { u32bit temp = rotate_left(mask ^ in, rot); @@ -31,9 +33,9 @@ void round2(u32bit& out, u32bit in, u32bit mask, u32bit rot) CAST_SBOX3[get_byte(2, temp)]) ^ CAST_SBOX4[get_byte(3, temp)]; } -/************************************************* -* CAST-256 Round Type 3 * -*************************************************/ +/* +* CAST-256 Round Type 3 +*/ void round3(u32bit& out, u32bit in, u32bit mask, u32bit rot) { u32bit temp = rotate_left(mask - in, rot); @@ -43,9 +45,9 @@ void round3(u32bit& out, u32bit in, u32bit mask, u32bit rot) } -/************************************************* -* CAST-256 Encryption * -*************************************************/ +/* +* CAST-256 Encryption +*/ void CAST_256::enc(const byte in[], byte out[]) const { u32bit A = load_be<u32bit>(in, 0); @@ -81,9 +83,9 @@ void CAST_256::enc(const byte in[], byte out[]) const store_be(out, A, B, C, D); } -/************************************************* -* CAST-256 Decryption * -*************************************************/ +/* +* CAST-256 Decryption +*/ void CAST_256::dec(const byte in[], byte out[]) const { u32bit A = load_be<u32bit>(in, 0); @@ -119,9 +121,9 @@ void CAST_256::dec(const byte in[], byte out[]) const store_be(out, A, B, C, D); } -/************************************************* -* CAST-256 Key Schedule * -*************************************************/ +/* +* CAST-256 Key Schedule +*/ void CAST_256::key_schedule(const byte key[], u32bit length) { SecureBuffer<u32bit, 8> TMP; diff --git a/src/block/cast/cast256.h b/src/block/cast/cast256.h index e80208ad4..cd48edd5e 100644 --- a/src/block/cast/cast256.h +++ b/src/block/cast/cast256.h @@ -1,7 +1,9 @@ -/************************************************* -* CAST-256 Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* CAST-256 +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_CAST256_H__ #define BOTAN_CAST256_H__ @@ -10,9 +12,9 @@ namespace Botan { -/************************************************* -* CAST-256 * -*************************************************/ +/* +* CAST-256 +*/ class BOTAN_DLL CAST_256 : public BlockCipher { public: diff --git a/src/block/cast/cast_tab.cpp b/src/block/cast/cast_tab.cpp index 3edab713f..61c843713 100644 --- a/src/block/cast/cast_tab.cpp +++ b/src/block/cast/cast_tab.cpp @@ -1,7 +1,9 @@ -/************************************************* -* S-Box Tables for CAST-128 and CAST-256 * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* S-Box Tables for CAST-128 and CAST-256 +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/cast128.h> #include <botan/cast256.h> diff --git a/src/block/des/des.cpp b/src/block/des/des.cpp index f6453cff0..37520e0fc 100644 --- a/src/block/des/des.cpp +++ b/src/block/des/des.cpp @@ -1,7 +1,9 @@ -/************************************************* -* DES Source File * -* (C) 1999-2008 Jack Lloyd * -*************************************************/ +/* +* DES +* (C) 1999-2008 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/des.h> #include <botan/loadstor.h> @@ -10,9 +12,9 @@ namespace Botan { namespace { -/************************************************* -* DES Key Schedule * -*************************************************/ +/* +* DES Key Schedule +*/ void des_key_schedule(u32bit round_key[32], const byte key[8]) { static const byte ROT[16] = { 1, 1, 2, 2, 2, 2, 2, 2, @@ -76,9 +78,9 @@ void des_key_schedule(u32bit round_key[32], const byte key[8]) } } -/************************************************* -* DES Encryption * -*************************************************/ +/* +* DES Encryption +*/ void des_encrypt(u32bit& L, u32bit& R, const u32bit round_key[32]) { @@ -104,9 +106,9 @@ void des_encrypt(u32bit& L, u32bit& R, } } -/************************************************* -* DES Decryption * -*************************************************/ +/* +* DES Decryption +*/ void des_decrypt(u32bit& L, u32bit& R, const u32bit round_key[32]) { @@ -134,9 +136,9 @@ void des_decrypt(u32bit& L, u32bit& R, } -/************************************************* -* DES Encryption * -*************************************************/ +/* +* DES Encryption +*/ void DES::enc(const byte in[], byte out[]) const { u64bit T = (DES_IPTAB1[in[0]] ) | (DES_IPTAB1[in[1]] << 1) | @@ -159,9 +161,9 @@ void DES::enc(const byte in[], byte out[]) const store_be(T, out); } -/************************************************* -* DES Decryption * -*************************************************/ +/* +* DES Decryption +*/ void DES::dec(const byte in[], byte out[]) const { u64bit T = (DES_IPTAB1[in[0]] ) | (DES_IPTAB1[in[1]] << 1) | @@ -184,17 +186,17 @@ void DES::dec(const byte in[], byte out[]) const store_be(T, out); } -/************************************************* -* DES Key Schedule * -*************************************************/ +/* +* DES Key Schedule +*/ void DES::key_schedule(const byte key[], u32bit) { des_key_schedule(round_key.begin(), key); } -/************************************************* -* TripleDES Encryption * -*************************************************/ +/* +* TripleDES Encryption +*/ void TripleDES::enc(const byte in[], byte out[]) const { u64bit T = (DES_IPTAB1[in[0]] ) | (DES_IPTAB1[in[1]] << 1) | @@ -219,9 +221,9 @@ void TripleDES::enc(const byte in[], byte out[]) const store_be(T, out); } -/************************************************* -* TripleDES Decryption * -*************************************************/ +/* +* TripleDES Decryption +*/ void TripleDES::dec(const byte in[], byte out[]) const { u64bit T = (DES_IPTAB1[in[0]] ) | (DES_IPTAB1[in[1]] << 1) | @@ -246,9 +248,9 @@ void TripleDES::dec(const byte in[], byte out[]) const store_be(T, out); } -/************************************************* -* TripleDES Key Schedule * -*************************************************/ +/* +* TripleDES Key Schedule +*/ void TripleDES::key_schedule(const byte key[], u32bit length) { des_key_schedule(&round_key[0], key); diff --git a/src/block/des/des.h b/src/block/des/des.h index f3a0d56eb..6fa59de5e 100644 --- a/src/block/des/des.h +++ b/src/block/des/des.h @@ -1,7 +1,9 @@ -/************************************************* -* DES Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* DES +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_DES_H__ #define BOTAN_DES_H__ @@ -10,9 +12,9 @@ namespace Botan { -/************************************************* -* DES * -*************************************************/ +/* +* DES +*/ class BOTAN_DLL DES : public BlockCipher { public: @@ -28,9 +30,9 @@ class BOTAN_DLL DES : public BlockCipher SecureBuffer<u32bit, 32> round_key; }; -/************************************************* -* Triple DES * -*************************************************/ +/* +* Triple DES +*/ class BOTAN_DLL TripleDES : public BlockCipher { public: @@ -46,9 +48,9 @@ class BOTAN_DLL TripleDES : public BlockCipher SecureBuffer<u32bit, 96> round_key; }; -/************************************************* -* DES Tables * -*************************************************/ +/* +* DES Tables +*/ extern const u32bit DES_SPBOX1[256]; extern const u32bit DES_SPBOX2[256]; extern const u32bit DES_SPBOX3[256]; diff --git a/src/block/des/des_tab.cpp b/src/block/des/des_tab.cpp index aa3b7cd45..b46ca3063 100644 --- a/src/block/des/des_tab.cpp +++ b/src/block/des/des_tab.cpp @@ -1,7 +1,9 @@ -/************************************************* -* Substitution/Permutation Tables for DES * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* Substitution/Permutation Tables for DES +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/des.h> diff --git a/src/block/des/desx.cpp b/src/block/des/desx.cpp index 41c3bcd8d..e557901d3 100644 --- a/src/block/des/desx.cpp +++ b/src/block/des/desx.cpp @@ -1,16 +1,18 @@ -/************************************************* -* DES Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* DES +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/desx.h> #include <botan/xor_buf.h> namespace Botan { -/************************************************* -* DESX Encryption * -*************************************************/ +/* +* DESX Encryption +*/ void DESX::enc(const byte in[], byte out[]) const { xor_buf(out, in, K1.begin(), BLOCK_SIZE); @@ -18,9 +20,9 @@ void DESX::enc(const byte in[], byte out[]) const xor_buf(out, K2.begin(), BLOCK_SIZE); } -/************************************************* -* DESX Decryption * -*************************************************/ +/* +* DESX Decryption +*/ void DESX::dec(const byte in[], byte out[]) const { xor_buf(out, in, K2.begin(), BLOCK_SIZE); @@ -28,9 +30,9 @@ void DESX::dec(const byte in[], byte out[]) const xor_buf(out, K1.begin(), BLOCK_SIZE); } -/************************************************* -* DESX Key Schedule * -*************************************************/ +/* +* DESX Key Schedule +*/ void DESX::key_schedule(const byte key[], u32bit) { K1.copy(key, 8); diff --git a/src/block/des/desx.h b/src/block/des/desx.h index 1fa68fcde..49ecc2421 100644 --- a/src/block/des/desx.h +++ b/src/block/des/desx.h @@ -1,7 +1,9 @@ -/************************************************* -* DESX Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* DESX +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_DESX_H__ #define BOTAN_DESX_H__ @@ -10,9 +12,9 @@ namespace Botan { -/************************************************* -* DESX * -*************************************************/ +/* +* DESX +*/ class BOTAN_DLL DESX : public BlockCipher { public: diff --git a/src/block/gost_28147/gost_28147.cpp b/src/block/gost_28147/gost_28147.cpp index c8add16f6..0f29102de 100644 --- a/src/block/gost_28147/gost_28147.cpp +++ b/src/block/gost_28147/gost_28147.cpp @@ -1,6 +1,8 @@ /* * GOST 28147-89 * (C) 1999-2009 Jack Lloyd +* +* Distributed under the terms of the Botan license */ #include <botan/gost_28147.h> diff --git a/src/block/gost_28147/gost_28147.h b/src/block/gost_28147/gost_28147.h index d79bdb8d6..a58927e28 100644 --- a/src/block/gost_28147/gost_28147.h +++ b/src/block/gost_28147/gost_28147.h @@ -1,6 +1,8 @@ /* * GOST 28147-89 * (C) 1999-2009 Jack Lloyd +* +* Distributed under the terms of the Botan license */ #ifndef BOTAN_GOST_28147_89_H__ diff --git a/src/block/idea/idea.cpp b/src/block/idea/idea.cpp index 88dc04a3d..5bbe47087 100644 --- a/src/block/idea/idea.cpp +++ b/src/block/idea/idea.cpp @@ -1,7 +1,9 @@ -/************************************************* -* IDEA Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* IDEA +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/idea.h> #include <botan/loadstor.h> @@ -10,9 +12,9 @@ namespace Botan { namespace { -/************************************************* -* Multiplication modulo 65537 * -*************************************************/ +/* +* Multiplication modulo 65537 +*/ inline u16bit mul(u16bit x, u16bit y) { if(x && y) @@ -26,9 +28,9 @@ inline u16bit mul(u16bit x, u16bit y) return static_cast<u16bit>(1 - x - y); } -/************************************************* -* Find multiplicative inverses modulo 65537 * -*************************************************/ +/* +* Find multiplicative inverses modulo 65537 +*/ u16bit mul_inv(u16bit x) { if(x <= 1) @@ -55,9 +57,9 @@ u16bit mul_inv(u16bit x) } -/************************************************* -* IDEA Encryption * -*************************************************/ +/* +* IDEA Encryption +*/ void IDEA::enc(const byte in[], byte out[]) const { u16bit X1 = load_be<u16bit>(in, 0); @@ -93,9 +95,9 @@ void IDEA::enc(const byte in[], byte out[]) const store_be(out, X1, X3, X2, X4); } -/************************************************* -* IDEA Decryption * -*************************************************/ +/* +* IDEA Decryption +*/ void IDEA::dec(const byte in[], byte out[]) const { u16bit X1 = load_be<u16bit>(in, 0); @@ -131,9 +133,9 @@ void IDEA::dec(const byte in[], byte out[]) const store_be(out, X1, X3, X2, X4); } -/************************************************* -* IDEA Key Schedule * -*************************************************/ +/* +* IDEA Key Schedule +*/ void IDEA::key_schedule(const byte key[], u32bit) { for(u32bit j = 0; j != 8; ++j) diff --git a/src/block/idea/idea.h b/src/block/idea/idea.h index cd47111a6..2c53cd0e4 100644 --- a/src/block/idea/idea.h +++ b/src/block/idea/idea.h @@ -1,7 +1,9 @@ -/************************************************* -* IDEA Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* IDEA +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_IDEA_H__ #define BOTAN_IDEA_H__ @@ -10,9 +12,9 @@ namespace Botan { -/************************************************* -* IDEA * -*************************************************/ +/* +* IDEA +*/ class BOTAN_DLL IDEA : public BlockCipher { public: diff --git a/src/block/kasumi/kasumi.cpp b/src/block/kasumi/kasumi.cpp index 4be6c41a8..3887271a9 100644 --- a/src/block/kasumi/kasumi.cpp +++ b/src/block/kasumi/kasumi.cpp @@ -1,7 +1,9 @@ -/************************************************* -* KASUMI Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* KASUMI +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/kasumi.h> #include <botan/loadstor.h> @@ -11,9 +13,9 @@ namespace Botan { namespace { -/************************************************* -* KASUMI S-Boxes * -*************************************************/ +/* +* KASUMI S-Boxes +*/ const byte KASUMI_SBOX_S7[128] = { 0x36, 0x32, 0x3E, 0x38, 0x16, 0x22, 0x5E, 0x60, 0x26, 0x06, 0x3F, 0x5D, 0x02, 0x12, 0x7B, 0x21, 0x37, 0x71, 0x27, 0x72, 0x15, 0x43, 0x41, 0x0C, @@ -86,9 +88,9 @@ const u16bit KASUMI_SBOX_S9[512] = { 0x017C, 0x002B, 0x0042, 0x003C, 0x01C7, 0x0155, 0x01BD, 0x00CA, 0x01B0, 0x0008, 0x00ED, 0x000F, 0x0178, 0x01B4, 0x01D0, 0x003B, 0x01CD }; -/************************************************* -* KASUMI FI Function * -*************************************************/ +/* +* KASUMI FI Function +*/ u16bit FI(u16bit I, u16bit K) { u16bit D9 = (I >> 7); @@ -104,9 +106,9 @@ u16bit FI(u16bit I, u16bit K) } -/************************************************* -* KASUMI Encryption * -*************************************************/ +/* +* KASUMI Encryption +*/ void KASUMI::enc(const byte in[], byte out[]) const { u16bit B0 = load_be<u16bit>(in, 0); @@ -142,9 +144,9 @@ void KASUMI::enc(const byte in[], byte out[]) const store_be(out, B0, B1, B2, B3); } -/************************************************* -* KASUMI Decryption * -*************************************************/ +/* +* KASUMI Decryption +*/ void KASUMI::dec(const byte in[], byte out[]) const { u16bit B0 = load_be<u16bit>(in, 0); @@ -182,9 +184,9 @@ void KASUMI::dec(const byte in[], byte out[]) const store_be(out, B0, B1, B2, B3); } -/************************************************* -* KASUMI Key Schedule * -*************************************************/ +/* +* KASUMI Key Schedule +*/ void KASUMI::key_schedule(const byte key[], u32bit) { static const u16bit RC[] = { 0x0123, 0x4567, 0x89AB, 0xCDEF, diff --git a/src/block/kasumi/kasumi.h b/src/block/kasumi/kasumi.h index 27765e640..df49fa9eb 100644 --- a/src/block/kasumi/kasumi.h +++ b/src/block/kasumi/kasumi.h @@ -1,7 +1,9 @@ -/************************************************* -* KASUMI Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* KASUMI +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_KASUMI_H__ #define BOTAN_KASUMI_H__ @@ -10,9 +12,9 @@ namespace Botan { -/************************************************* -* KASUMI * -*************************************************/ +/* +* KASUMI +*/ class BOTAN_DLL KASUMI : public BlockCipher { public: diff --git a/src/block/lion/lion.cpp b/src/block/lion/lion.cpp index f35cbf424..c7cdf6d13 100644 --- a/src/block/lion/lion.cpp +++ b/src/block/lion/lion.cpp @@ -1,7 +1,9 @@ -/************************************************* -* Lion Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* Lion +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/lion.h> #include <botan/xor_buf.h> @@ -9,9 +11,9 @@ namespace Botan { -/************************************************* -* Lion Encryption * -*************************************************/ +/* +* Lion Encryption +*/ void Lion::enc(const byte in[], byte out[]) const { SecureVector<byte> buffer(LEFT_SIZE); @@ -29,9 +31,9 @@ void Lion::enc(const byte in[], byte out[]) const cipher->encrypt(out + LEFT_SIZE, RIGHT_SIZE); } -/************************************************* -* Lion Decryption * -*************************************************/ +/* +* Lion Decryption +*/ void Lion::dec(const byte in[], byte out[]) const { SecureVector<byte> buffer(LEFT_SIZE); @@ -49,9 +51,9 @@ void Lion::dec(const byte in[], byte out[]) const cipher->encrypt(out + LEFT_SIZE, RIGHT_SIZE); } -/************************************************* -* Lion Key Schedule * -*************************************************/ +/* +* Lion Key Schedule +*/ void Lion::key_schedule(const byte key[], u32bit length) { clear(); @@ -60,9 +62,9 @@ void Lion::key_schedule(const byte key[], u32bit length) key2.copy(key + length / 2, length / 2); } -/************************************************* -* Return the name of this type * -*************************************************/ +/* +* Return the name of this type +*/ std::string Lion::name() const { return "Lion(" + hash->name() + "," + @@ -70,17 +72,17 @@ std::string Lion::name() const to_string(BLOCK_SIZE) + ")"; } -/************************************************* -* Return a clone of this object * -*************************************************/ +/* +* Return a clone of this object +*/ BlockCipher* Lion::clone() const { return new Lion(hash->clone(), cipher->clone(), BLOCK_SIZE); } -/************************************************* -* Clear memory of sensitive data * -*************************************************/ +/* +* Clear memory of sensitive data +*/ void Lion::clear() throw() { hash->clear(); @@ -89,9 +91,9 @@ void Lion::clear() throw() key2.clear(); } -/************************************************* -* Lion Constructor * -*************************************************/ +/* +* Lion Constructor +*/ Lion::Lion(HashFunction* hash_in, StreamCipher* sc_in, u32bit block_len) : BlockCipher(std::max<u32bit>(2*hash_in->OUTPUT_LENGTH + 1, block_len), 2, 2*hash_in->OUTPUT_LENGTH, 2), diff --git a/src/block/lion/lion.h b/src/block/lion/lion.h index b16db966e..5bc4e72c0 100644 --- a/src/block/lion/lion.h +++ b/src/block/lion/lion.h @@ -1,7 +1,9 @@ -/************************************************* -* Lion Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* Lion +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_LION_H__ #define BOTAN_LION_H__ @@ -12,9 +14,9 @@ namespace Botan { -/************************************************* -* Lion * -*************************************************/ +/* +* Lion +*/ class BOTAN_DLL Lion : public BlockCipher { public: diff --git a/src/block/lubyrack/lubyrack.cpp b/src/block/lubyrack/lubyrack.cpp index 5304d14d6..a9d2b1db2 100644 --- a/src/block/lubyrack/lubyrack.cpp +++ b/src/block/lubyrack/lubyrack.cpp @@ -1,16 +1,18 @@ -/************************************************* -* Luby-Rackoff Source File * -* (C) 1999-2008 Jack Lloyd * -*************************************************/ +/* +* Luby-Rackoff +* (C) 1999-2008 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/lubyrack.h> #include <botan/xor_buf.h> namespace Botan { -/************************************************* -* Luby-Rackoff Encryption * -*************************************************/ +/* +* Luby-Rackoff Encryption +*/ void LubyRackoff::enc(const byte in[], byte out[]) const { const u32bit len = hash->OUTPUT_LENGTH; @@ -37,9 +39,9 @@ void LubyRackoff::enc(const byte in[], byte out[]) const xor_buf(out, buffer, len); } -/************************************************* -* Luby-Rackoff Decryption * -*************************************************/ +/* +* Luby-Rackoff Decryption +*/ void LubyRackoff::dec(const byte in[], byte out[]) const { const u32bit len = hash->OUTPUT_LENGTH; @@ -66,18 +68,18 @@ void LubyRackoff::dec(const byte in[], byte out[]) const xor_buf(out + len, buffer, len); } -/************************************************* -* Luby-Rackoff Key Schedule * -*************************************************/ +/* +* Luby-Rackoff Key Schedule +*/ void LubyRackoff::key_schedule(const byte key[], u32bit length) { K1.set(key, length / 2); K2.set(key + length / 2, length / 2); } -/************************************************* -* Clear memory of sensitive data * -*************************************************/ +/* +* Clear memory of sensitive data +*/ void LubyRackoff::clear() throw() { K1.clear(); @@ -85,25 +87,25 @@ void LubyRackoff::clear() throw() hash->clear(); } -/************************************************* -* Return a clone of this object * -*************************************************/ +/* +* Return a clone of this object +*/ BlockCipher* LubyRackoff::clone() const { return new LubyRackoff(hash->clone()); } -/************************************************* -* Return the name of this type * -*************************************************/ +/* +* Return the name of this type +*/ std::string LubyRackoff::name() const { return "Luby-Rackoff(" + hash->name() + ")"; } -/************************************************* -* Luby-Rackoff Constructor * -*************************************************/ +/* +* Luby-Rackoff Constructor +*/ LubyRackoff::LubyRackoff(HashFunction* h) : BlockCipher(2 * (h ? h->OUTPUT_LENGTH: 0), 2, 32, 2), diff --git a/src/block/lubyrack/lubyrack.h b/src/block/lubyrack/lubyrack.h index 6fedc38fe..ebde31304 100644 --- a/src/block/lubyrack/lubyrack.h +++ b/src/block/lubyrack/lubyrack.h @@ -1,7 +1,9 @@ -/************************************************* -* Luby-Rackoff Header File * -* (C) 1999-2008 Jack Lloyd * -*************************************************/ +/* +* Luby-Rackoff +* (C) 1999-2008 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_LUBY_RACKOFF_H__ #define BOTAN_LUBY_RACKOFF_H__ @@ -11,9 +13,9 @@ namespace Botan { -/************************************************* -* Luby-Rackoff * -*************************************************/ +/* +* Luby-Rackoff +*/ class BOTAN_DLL LubyRackoff : public BlockCipher { public: diff --git a/src/block/mars/mars.cpp b/src/block/mars/mars.cpp index 5f93f2df4..7c3906ecf 100644 --- a/src/block/mars/mars.cpp +++ b/src/block/mars/mars.cpp @@ -1,7 +1,9 @@ -/************************************************* -* MARS Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* MARS +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/mars.h> #include <botan/loadstor.h> @@ -11,9 +13,9 @@ namespace Botan { namespace { -/************************************************* -* Generate a mask for runs of bits * -*************************************************/ +/* +* Generate a mask for runs of bits +*/ u32bit gen_mask(u32bit input) { u32bit mask = 0; @@ -45,9 +47,9 @@ u32bit gen_mask(u32bit input) } -/************************************************* -* MARS Encryption * -*************************************************/ +/* +* MARS Encryption +*/ void MARS::enc(const byte in[], byte out[]) const { u32bit A = load_le<u32bit>(in, 0) + EK[0]; @@ -82,9 +84,9 @@ void MARS::enc(const byte in[], byte out[]) const store_le(out, A, B, C, D); } -/************************************************* -* MARS Decryption * -*************************************************/ +/* +* MARS Decryption +*/ void MARS::dec(const byte in[], byte out[]) const { u32bit A = load_le<u32bit>(in, 3) + EK[39]; @@ -119,9 +121,9 @@ void MARS::dec(const byte in[], byte out[]) const store_le(out, D, C, B, A); } -/************************************************* -* MARS Forward Mixing Operation * -*************************************************/ +/* +* MARS Forward Mixing Operation +*/ void MARS::forward_mix(u32bit& A, u32bit& B, u32bit& C, u32bit& D) { for(u32bit j = 0; j != 2; ++j) @@ -144,9 +146,9 @@ void MARS::forward_mix(u32bit& A, u32bit& B, u32bit& C, u32bit& D) } } -/************************************************* -* MARS Reverse Mixing Operation * -*************************************************/ +/* +* MARS Reverse Mixing Operation +*/ void MARS::reverse_mix(u32bit& A, u32bit& B, u32bit& C, u32bit& D) { for(u32bit j = 0; j != 2; ++j) @@ -170,9 +172,9 @@ void MARS::reverse_mix(u32bit& A, u32bit& B, u32bit& C, u32bit& D) } } -/************************************************* -* MARS Encryption Round * -*************************************************/ +/* +* MARS Encryption Round +*/ void MARS::encrypt_round(u32bit& A, u32bit& B, u32bit& C, u32bit& D, u32bit round) const { @@ -190,9 +192,9 @@ void MARS::encrypt_round(u32bit& A, u32bit& B, u32bit& C, u32bit& D, B += rotate_left(Z, Y % 32); } -/************************************************* -* MARS Decryption Round * -*************************************************/ +/* +* MARS Decryption Round +*/ void MARS::decrypt_round(u32bit& A, u32bit& B, u32bit& C, u32bit& D, u32bit round) const { @@ -210,9 +212,9 @@ void MARS::decrypt_round(u32bit& A, u32bit& B, u32bit& C, u32bit& D, B -= rotate_left(Z, Y % 32); } -/************************************************* -* MARS Key Schedule * -*************************************************/ +/* +* MARS Key Schedule +*/ void MARS::key_schedule(const byte key[], u32bit length) { SecureBuffer<u32bit, 15> T; diff --git a/src/block/mars/mars.h b/src/block/mars/mars.h index 44f581549..ca49695af 100644 --- a/src/block/mars/mars.h +++ b/src/block/mars/mars.h @@ -1,7 +1,9 @@ -/************************************************* -* MARS Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* MARS +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_MARS_H__ #define BOTAN_MARS_H__ diff --git a/src/block/mars/mars_tab.cpp b/src/block/mars/mars_tab.cpp index 07381e9cb..fb8f34542 100644 --- a/src/block/mars/mars_tab.cpp +++ b/src/block/mars/mars_tab.cpp @@ -1,7 +1,9 @@ -/************************************************* -* S-Box Table for MARS * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* S-Box Table for MARS +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/mars.h> diff --git a/src/block/misty1/misty1.cpp b/src/block/misty1/misty1.cpp index bac5e43eb..a35ff584d 100644 --- a/src/block/misty1/misty1.cpp +++ b/src/block/misty1/misty1.cpp @@ -1,7 +1,9 @@ -/************************************************* -* MISTY1 Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* MISTY1 +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/misty1.h> #include <botan/loadstor.h> @@ -83,9 +85,9 @@ static const u16bit MISTY1_SBOX_S9[512] = { 0x00BE, 0x0078, 0x0000, 0x00AC, 0x0110, 0x015E, 0x0124, 0x0002, 0x01BC, 0x00A2, 0x00EA, 0x0070, 0x01FC, 0x0116, 0x015C, 0x004C, 0x01C2 }; -/************************************************* -* MISTY1 FI Function * -*************************************************/ +/* +* MISTY1 FI Function +*/ u16bit FI(u16bit input, u16bit key7, u16bit key9) { u16bit D9 = input >> 7, D7 = input & 0x7F; @@ -97,9 +99,9 @@ u16bit FI(u16bit input, u16bit key7, u16bit key9) } -/************************************************* -* MISTY1 Encryption * -*************************************************/ +/* +* MISTY1 Encryption +*/ void MISTY1::enc(const byte in[], byte out[]) const { u16bit B0 = load_be<u16bit>(in, 0); @@ -141,9 +143,9 @@ void MISTY1::enc(const byte in[], byte out[]) const store_be(out, B2, B3, B0, B1); } -/************************************************* -* MISTY1 Decryption * -*************************************************/ +/* +* MISTY1 Decryption +*/ void MISTY1::dec(const byte in[], byte out[]) const { u16bit B0 = load_be<u16bit>(in, 2); @@ -185,9 +187,9 @@ void MISTY1::dec(const byte in[], byte out[]) const store_be(out, B0, B1, B2, B3); } -/************************************************* -* MISTY1 Key Schedule * -*************************************************/ +/* +* MISTY1 Key Schedule +*/ void MISTY1::key_schedule(const byte key[], u32bit length) { SecureBuffer<u16bit, 32> KS; @@ -234,9 +236,9 @@ void MISTY1::key_schedule(const byte key[], u32bit length) } } -/************************************************* -* MISTY1 Constructor * -*************************************************/ +/* +* MISTY1 Constructor +*/ MISTY1::MISTY1(u32bit rounds) : BlockCipher(8, 16) { if(rounds != 8) diff --git a/src/block/misty1/misty1.h b/src/block/misty1/misty1.h index 8da93184f..62d4f856f 100644 --- a/src/block/misty1/misty1.h +++ b/src/block/misty1/misty1.h @@ -1,6 +1,8 @@ /** -* MISTY1 Header File +* MISTY1 * (C) 1999-2008 Jack Lloyd +* +* Distributed under the terms of the Botan license */ #ifndef BOTAN_MISTY1_H__ diff --git a/src/block/noekeon/noekeon.cpp b/src/block/noekeon/noekeon.cpp index 1a783b432..256744b22 100644 --- a/src/block/noekeon/noekeon.cpp +++ b/src/block/noekeon/noekeon.cpp @@ -1,7 +1,9 @@ -/************************************************* -* Noekeon Source File * -* (C) 1999-2008 Jack Lloyd * -*************************************************/ +/* +* Noekeon +* (C) 1999-2008 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/noekeon.h> #include <botan/loadstor.h> @@ -11,9 +13,9 @@ namespace Botan { namespace { -/************************************************* -* Noekeon's Theta Operation * -*************************************************/ +/* +* Noekeon's Theta Operation +*/ inline void theta(u32bit& A0, u32bit& A1, u32bit& A2, u32bit& A3, const u32bit EK[4]) @@ -34,9 +36,9 @@ inline void theta(u32bit& A0, u32bit& A1, A2 ^= T; } -/************************************************* -* Theta With Null Key * -*************************************************/ +/* +* Theta With Null Key +*/ inline void theta(u32bit& A0, u32bit& A1, u32bit& A2, u32bit& A3) { @@ -51,9 +53,9 @@ inline void theta(u32bit& A0, u32bit& A1, A2 ^= T; } -/************************************************* -* Noekeon's Gamma S-Box Layer * -*************************************************/ +/* +* Noekeon's Gamma S-Box Layer +*/ inline void gamma(u32bit& A0, u32bit& A1, u32bit& A2, u32bit& A3) { A1 ^= ~A3 & ~A2; @@ -71,17 +73,17 @@ inline void gamma(u32bit& A0, u32bit& A1, u32bit& A2, u32bit& A3) } -/************************************************* -* Noekeon Round Constants * -*************************************************/ +/* +* Noekeon Round Constants +*/ const byte Noekeon::RC[] = { 0x80, 0x1B, 0x36, 0x6C, 0xD8, 0xAB, 0x4D, 0x9A, 0x2F, 0x5E, 0xBC, 0x63, 0xC6, 0x97, 0x35, 0x6A, 0xD4 }; -/************************************************* -* Noekeon Encryption * -*************************************************/ +/* +* Noekeon Encryption +*/ void Noekeon::enc(const byte in[], byte out[]) const { u32bit A0 = load_be<u32bit>(in, 0); @@ -111,9 +113,9 @@ void Noekeon::enc(const byte in[], byte out[]) const store_be(out, A0, A1, A2, A3); } -/************************************************* -* Noekeon Encryption * -*************************************************/ +/* +* Noekeon Encryption +*/ void Noekeon::dec(const byte in[], byte out[]) const { u32bit A0 = load_be<u32bit>(in, 0); @@ -143,9 +145,9 @@ void Noekeon::dec(const byte in[], byte out[]) const store_be(out, A0, A1, A2, A3); } -/************************************************* -* Noekeon Key Schedule * -*************************************************/ +/* +* Noekeon Key Schedule +*/ void Noekeon::key_schedule(const byte key[], u32bit) { u32bit A0 = load_be<u32bit>(key, 0); @@ -184,9 +186,9 @@ void Noekeon::key_schedule(const byte key[], u32bit) EK[3] = A3; } -/************************************************* -* Clear memory of sensitive data * -*************************************************/ +/* +* Clear memory of sensitive data +*/ void Noekeon::clear() throw() { EK.clear(); diff --git a/src/block/noekeon/noekeon.h b/src/block/noekeon/noekeon.h index 9d4e896b9..893892446 100644 --- a/src/block/noekeon/noekeon.h +++ b/src/block/noekeon/noekeon.h @@ -1,7 +1,9 @@ -/************************************************* -* Noekeon Header File * -* (C) 1999-2008 Jack Lloyd * -*************************************************/ +/* +* Noekeon +* (C) 1999-2008 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_NOEKEON_H__ #define BOTAN_NOEKEON_H__ @@ -10,9 +12,9 @@ namespace Botan { -/************************************************* -* Noekeon * -*************************************************/ +/* +* Noekeon +*/ class BOTAN_DLL Noekeon : public BlockCipher { public: diff --git a/src/block/rc2/rc2.cpp b/src/block/rc2/rc2.cpp index 56d0db78c..bf588bbf3 100644 --- a/src/block/rc2/rc2.cpp +++ b/src/block/rc2/rc2.cpp @@ -1,7 +1,9 @@ -/************************************************* -* RC2 Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* RC2 +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/rc2.h> #include <botan/loadstor.h> @@ -9,9 +11,9 @@ namespace Botan { -/************************************************* -* RC2 Encryption * -*************************************************/ +/* +* RC2 Encryption +*/ void RC2::enc(const byte in[], byte out[]) const { u16bit R0 = load_le<u16bit>(in, 0); @@ -45,9 +47,9 @@ void RC2::enc(const byte in[], byte out[]) const store_le(out, R0, R1, R2, R3); } -/************************************************* -* RC2 Decryption * -*************************************************/ +/* +* RC2 Decryption +*/ void RC2::dec(const byte in[], byte out[]) const { u16bit R0 = load_le<u16bit>(in, 0); @@ -81,9 +83,9 @@ void RC2::dec(const byte in[], byte out[]) const store_le(out, R0, R1, R2, R3); } -/************************************************* -* RC2 Key Schedule * -*************************************************/ +/* +* RC2 Key Schedule +*/ void RC2::key_schedule(const byte key[], u32bit length) { static const byte TABLE[256] = { @@ -123,9 +125,9 @@ void RC2::key_schedule(const byte key[], u32bit length) K[j] = load_le<u16bit>(L, j); } -/************************************************* -* Return the code of the effective key bits * -*************************************************/ +/* +* Return the code of the effective key bits +*/ byte RC2::EKB_code(u32bit ekb) { const byte EKB[256] = { diff --git a/src/block/rc2/rc2.h b/src/block/rc2/rc2.h index a1fe4ecfa..cb6f58f04 100644 --- a/src/block/rc2/rc2.h +++ b/src/block/rc2/rc2.h @@ -1,7 +1,9 @@ -/************************************************* -* RC2 Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* RC2 +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_RC2_H__ #define BOTAN_RC2_H__ @@ -10,9 +12,9 @@ namespace Botan { -/************************************************* -* RC2 * -*************************************************/ +/* +* RC2 +*/ class BOTAN_DLL RC2 : public BlockCipher { public: diff --git a/src/block/rc5/rc5.cpp b/src/block/rc5/rc5.cpp index c4e4bf9b0..57219f413 100644 --- a/src/block/rc5/rc5.cpp +++ b/src/block/rc5/rc5.cpp @@ -1,7 +1,9 @@ -/************************************************* -* RC5 Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* RC5 +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/rc5.h> #include <botan/loadstor.h> @@ -11,9 +13,9 @@ namespace Botan { -/************************************************* -* RC5 Encryption * -*************************************************/ +/* +* RC5 Encryption +*/ void RC5::enc(const byte in[], byte out[]) const { u32bit A = load_le<u32bit>(in, 0), B = load_le<u32bit>(in, 1); @@ -34,9 +36,9 @@ void RC5::enc(const byte in[], byte out[]) const store_le(out, A, B); } -/************************************************* -* RC5 Decryption * -*************************************************/ +/* +* RC5 Decryption +*/ void RC5::dec(const byte in[], byte out[]) const { u32bit A = load_le<u32bit>(in, 0), B = load_le<u32bit>(in, 1); @@ -57,9 +59,9 @@ void RC5::dec(const byte in[], byte out[]) const store_le(out, A, B); } -/************************************************* -* RC5 Key Schedule * -*************************************************/ +/* +* RC5 Key Schedule +*/ void RC5::key_schedule(const byte key[], u32bit length) { const u32bit WORD_KEYLENGTH = (((length - 1) / 4) + 1), @@ -80,17 +82,17 @@ void RC5::key_schedule(const byte key[], u32bit length) } } -/************************************************* -* Return the name of this type * -*************************************************/ +/* +* Return the name of this type +*/ std::string RC5::name() const { return "RC5(" + to_string(ROUNDS) + ")"; } -/************************************************* -* RC5 Constructor * -*************************************************/ +/* +* RC5 Constructor +*/ RC5::RC5(u32bit r) : BlockCipher(8, 1, 32), ROUNDS(r) { if(ROUNDS < 8 || ROUNDS > 32 || (ROUNDS % 4 != 0)) diff --git a/src/block/rc5/rc5.h b/src/block/rc5/rc5.h index 6fbeb7c51..083224720 100644 --- a/src/block/rc5/rc5.h +++ b/src/block/rc5/rc5.h @@ -1,7 +1,9 @@ -/************************************************* -* RC5 Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* RC5 +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_RC5_H__ #define BOTAN_RC5_H__ @@ -10,9 +12,9 @@ namespace Botan { -/************************************************* -* RC5 * -*************************************************/ +/* +* RC5 +*/ class BOTAN_DLL RC5 : public BlockCipher { public: diff --git a/src/block/rc6/rc6.cpp b/src/block/rc6/rc6.cpp index 1295592d8..f83819614 100644 --- a/src/block/rc6/rc6.cpp +++ b/src/block/rc6/rc6.cpp @@ -1,7 +1,9 @@ -/************************************************* -* RC6 Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* RC6 +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/rc6.h> #include <botan/loadstor.h> @@ -10,9 +12,9 @@ namespace Botan { -/************************************************* -* RC6 Encryption * -*************************************************/ +/* +* RC6 Encryption +*/ void RC6::enc(const byte in[], byte out[]) const { u32bit A = load_le<u32bit>(in, 0); @@ -52,9 +54,9 @@ void RC6::enc(const byte in[], byte out[]) const store_le(out, A, B, C, D); } -/************************************************* -* RC6 Decryption * -*************************************************/ +/* +* RC6 Decryption +*/ void RC6::dec(const byte in[], byte out[]) const { u32bit A = load_le<u32bit>(in, 0); @@ -94,9 +96,9 @@ void RC6::dec(const byte in[], byte out[]) const store_le(out, A, B, C, D); } -/************************************************* -* RC6 Key Schedule * -*************************************************/ +/* +* RC6 Key Schedule +*/ void RC6::key_schedule(const byte key[], u32bit length) { const u32bit WORD_KEYLENGTH = (((length - 1) / 4) + 1), diff --git a/src/block/rc6/rc6.h b/src/block/rc6/rc6.h index fd10070b8..cb2800be7 100644 --- a/src/block/rc6/rc6.h +++ b/src/block/rc6/rc6.h @@ -1,7 +1,9 @@ -/************************************************* -* RC6 Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* RC6 +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_RC6_H__ #define BOTAN_RC6_H__ @@ -10,9 +12,9 @@ namespace Botan { -/************************************************* -* RC6 * -*************************************************/ +/* +* RC6 +*/ class BOTAN_DLL RC6 : public BlockCipher { public: diff --git a/src/block/safer/safe_tab.cpp b/src/block/safer/safe_tab.cpp index 06de7fa49..e265a40eb 100644 --- a/src/block/safer/safe_tab.cpp +++ b/src/block/safer/safe_tab.cpp @@ -1,7 +1,9 @@ -/************************************************* -* S-Box Tables for SAFER-SK * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* S-Box Tables for SAFER-SK +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/safer_sk.h> diff --git a/src/block/safer/safer_sk.cpp b/src/block/safer/safer_sk.cpp index 00e57e2a4..b774c91b4 100644 --- a/src/block/safer/safer_sk.cpp +++ b/src/block/safer/safer_sk.cpp @@ -1,7 +1,9 @@ -/************************************************* -* SAFER-SK Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* SAFER-SK +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/safer_sk.h> #include <botan/bit_ops.h> @@ -10,9 +12,9 @@ namespace Botan { -/************************************************* -* SAFER-SK Encryption * -*************************************************/ +/* +* SAFER-SK Encryption +*/ void SAFER_SK::enc(const byte in[], byte out[]) const { byte A = in[0], B = in[1], C = in[2], D = in[3], @@ -36,9 +38,9 @@ void SAFER_SK::enc(const byte in[], byte out[]) const out[6] = G + EK[16*ROUNDS+6]; out[7] = H ^ EK[16*ROUNDS+7]; } -/************************************************* -* SAFER-SK Decryption * -*************************************************/ +/* +* SAFER-SK Decryption +*/ void SAFER_SK::dec(const byte in[], byte out[]) const { byte A = in[0], B = in[1], C = in[2], D = in[3], @@ -63,9 +65,9 @@ void SAFER_SK::dec(const byte in[], byte out[]) const out[4] = E; out[5] = F; out[6] = G; out[7] = H; } -/************************************************* -* SAFER-SK Key Schedule * -*************************************************/ +/* +* SAFER-SK Key Schedule +*/ void SAFER_SK::key_schedule(const byte key[], u32bit) { SecureBuffer<byte, 18> KB; @@ -84,25 +86,25 @@ void SAFER_SK::key_schedule(const byte key[], u32bit) } } -/************************************************* -* Return the name of this type * -*************************************************/ +/* +* Return the name of this type +*/ std::string SAFER_SK::name() const { return "SAFER-SK(" + to_string(ROUNDS) + ")"; } -/************************************************* -* Return a clone of this object * -*************************************************/ +/* +* Return a clone of this object +*/ BlockCipher* SAFER_SK::clone() const { return new SAFER_SK(ROUNDS); } -/************************************************* -* SAFER-SK Constructor * -*************************************************/ +/* +* SAFER-SK Constructor +*/ SAFER_SK::SAFER_SK(u32bit rounds) : BlockCipher(8, 16), EK(16 * rounds + 8), ROUNDS(rounds) { diff --git a/src/block/safer/safer_sk.h b/src/block/safer/safer_sk.h index 0db32e20f..e52c5837c 100644 --- a/src/block/safer/safer_sk.h +++ b/src/block/safer/safer_sk.h @@ -1,7 +1,9 @@ -/************************************************* -* SAFER-SK Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* SAFER-SK +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_SAFER_SK_H__ #define BOTAN_SAFER_SK_H__ @@ -10,9 +12,9 @@ namespace Botan { -/************************************************* -* SAFER-SK * -*************************************************/ +/* +* SAFER-SK +*/ class BOTAN_DLL SAFER_SK : public BlockCipher { public: diff --git a/src/block/seed/seed.cpp b/src/block/seed/seed.cpp index 0b63ff341..b06a7cd77 100644 --- a/src/block/seed/seed.cpp +++ b/src/block/seed/seed.cpp @@ -1,25 +1,27 @@ -/************************************************* -* SEED Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* SEED +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/seed.h> #include <botan/loadstor.h> namespace Botan { -/************************************************* -* SEED G Function * -*************************************************/ +/* +* SEED G Function +*/ u32bit SEED::G_FUNC::operator()(u32bit X) const { return (S0[get_byte(3, X)] ^ S1[get_byte(2, X)] ^ S2[get_byte(1, X)] ^ S3[get_byte(0, X)]); } -/************************************************* -* SEED Encryption * -*************************************************/ +/* +* SEED Encryption +*/ void SEED::enc(const byte in[], byte out[]) const { u32bit B0 = load_be<u32bit>(in, 0); @@ -51,9 +53,9 @@ void SEED::enc(const byte in[], byte out[]) const store_be(out, B2, B3, B0, B1); } -/************************************************* -* SEED Decryption * -*************************************************/ +/* +* SEED Decryption +*/ void SEED::dec(const byte in[], byte out[]) const { u32bit B0 = load_be<u32bit>(in, 0); @@ -85,9 +87,9 @@ void SEED::dec(const byte in[], byte out[]) const store_be(out, B2, B3, B0, B1); } -/************************************************* -* SEED Key Schedule * -*************************************************/ +/* +* SEED Key Schedule +*/ void SEED::key_schedule(const byte key[], u32bit) { const u32bit RC[16] = { diff --git a/src/block/seed/seed.h b/src/block/seed/seed.h index 9f7d1cd2b..54c25d580 100644 --- a/src/block/seed/seed.h +++ b/src/block/seed/seed.h @@ -1,7 +1,9 @@ -/************************************************* -* SEED Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* SEED +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_SEED_H__ #define BOTAN_SEED_H__ @@ -10,9 +12,9 @@ namespace Botan { -/************************************************* -* SEED * -*************************************************/ +/* +* SEED +*/ class BOTAN_DLL SEED : public BlockCipher { public: diff --git a/src/block/seed/seed_tab.cpp b/src/block/seed/seed_tab.cpp index 5880f0489..6ada36e52 100644 --- a/src/block/seed/seed_tab.cpp +++ b/src/block/seed/seed_tab.cpp @@ -1,7 +1,9 @@ -/************************************************* -* S-Box Tables for SEED * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* S-Box Tables for SEED +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/seed.h> diff --git a/src/block/serpent/serpent.cpp b/src/block/serpent/serpent.cpp index 07ff8b2cf..0c4589510 100644 --- a/src/block/serpent/serpent.cpp +++ b/src/block/serpent/serpent.cpp @@ -1,7 +1,9 @@ -/************************************************* -* Serpent Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* Serpent +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/serpent.h> #include <botan/loadstor.h> @@ -11,9 +13,9 @@ namespace Botan { namespace { -/************************************************* -* Serpent Encryption S-Box 1 * -*************************************************/ +/* +* Serpent Encryption S-Box 1 +*/ inline void SBoxE1(u32bit& B0, u32bit& B1, u32bit& B2, u32bit& B3) { u32bit T0 = B0, T1 = B1, T2 = B2, T3 = B3, T4; @@ -23,9 +25,9 @@ inline void SBoxE1(u32bit& B0, u32bit& B1, u32bit& B2, u32bit& B3) B0 = T1; B1 = T4; B2 = T2; B3 = T0; } -/************************************************* -* Serpent Encryption S-Box 2 * -*************************************************/ +/* +* Serpent Encryption S-Box 2 +*/ inline void SBoxE2(u32bit& B0, u32bit& B1, u32bit& B2, u32bit& B3) { u32bit T0 = B0, T1 = B1, T2 = B2, T3 = B3, T4; @@ -35,9 +37,9 @@ inline void SBoxE2(u32bit& B0, u32bit& B1, u32bit& B2, u32bit& B3) B0 = T2; B1 = T0; B2 = T3; B3 = T1; } -/************************************************* -* Serpent Encryption S-Box 3 * -*************************************************/ +/* +* Serpent Encryption S-Box 3 +*/ inline void SBoxE3(u32bit& B0, u32bit& B1, u32bit& B2, u32bit& B3) { u32bit T0 = B0, T1 = B1, T2 = B2, T3 = B3, T4; @@ -47,9 +49,9 @@ inline void SBoxE3(u32bit& B0, u32bit& B1, u32bit& B2, u32bit& B3) B0 = T2; B1 = T3; B2 = T1; B3 = T4; } -/************************************************* -* Serpent Encryption S-Box 4 * -*************************************************/ +/* +* Serpent Encryption S-Box 4 +*/ inline void SBoxE4(u32bit& B0, u32bit& B1, u32bit& B2, u32bit& B3) { u32bit T0 = B0, T1 = B1, T2 = B2, T3 = B3, T4; @@ -59,9 +61,9 @@ inline void SBoxE4(u32bit& B0, u32bit& B1, u32bit& B2, u32bit& B3) B0 = T1; B1 = T2; B2 = T3; B3 = T4; } -/************************************************* -* Serpent Encryption S-Box 5 * -*************************************************/ +/* +* Serpent Encryption S-Box 5 +*/ inline void SBoxE5(u32bit& B0, u32bit& B1, u32bit& B2, u32bit& B3) { u32bit T0 = B0, T1 = B1, T2 = B2, T3 = B3, T4; @@ -71,9 +73,9 @@ inline void SBoxE5(u32bit& B0, u32bit& B1, u32bit& B2, u32bit& B3) B0 = T1; B1 = T4; B2 = T0; B3 = T3; } -/************************************************* -* Serpent Encryption S-Box 6 * -*************************************************/ +/* +* Serpent Encryption S-Box 6 +*/ inline void SBoxE6(u32bit& B0, u32bit& B1, u32bit& B2, u32bit& B3) { u32bit T0 = B0, T1 = B1, T2 = B2, T3 = B3, T4; @@ -83,9 +85,9 @@ inline void SBoxE6(u32bit& B0, u32bit& B1, u32bit& B2, u32bit& B3) B0 = T1; B1 = T3; B2 = T0; B3 = T2; } -/************************************************* -* Serpent Encryption S-Box 7 * -*************************************************/ +/* +* Serpent Encryption S-Box 7 +*/ inline void SBoxE7(u32bit& B0, u32bit& B1, u32bit& B2, u32bit& B3) { u32bit T0 = B0, T1 = B1, T2 = B2, T3 = B3, T4; @@ -95,9 +97,9 @@ inline void SBoxE7(u32bit& B0, u32bit& B1, u32bit& B2, u32bit& B3) B0 = T0; B1 = T1; B2 = T4; B3 = T2; } -/************************************************* -* Serpent Encryption S-Box 8 * -*************************************************/ +/* +* Serpent Encryption S-Box 8 +*/ inline void SBoxE8(u32bit& B0, u32bit& B1, u32bit& B2, u32bit& B3) { u32bit T0 = B0, T1 = B1, T2 = B2, T3 = B3, T4; @@ -107,9 +109,9 @@ inline void SBoxE8(u32bit& B0, u32bit& B1, u32bit& B2, u32bit& B3) B0 = T4; B1 = T3; B2 = T1; B3 = T0; } -/************************************************* -* Serpent Decryption S-Box 1 * -*************************************************/ +/* +* Serpent Decryption S-Box 1 +*/ inline void SBoxD1(u32bit& B0, u32bit& B1, u32bit& B2, u32bit& B3) { u32bit T0 = B0, T1 = B1, T2 = B2, T3 = B3, T4; @@ -119,9 +121,9 @@ inline void SBoxD1(u32bit& B0, u32bit& B1, u32bit& B2, u32bit& B3) B0 = T0; B1 = T4; B2 = T1; B3 = T3; } -/************************************************* -* Serpent Decryption S-Box 2 * -*************************************************/ +/* +* Serpent Decryption S-Box 2 +*/ inline void SBoxD2(u32bit& B0, u32bit& B1, u32bit& B2, u32bit& B3) { u32bit T0 = B0, T1 = B1, T2 = B2, T3 = B3, T4; @@ -131,9 +133,9 @@ inline void SBoxD2(u32bit& B0, u32bit& B1, u32bit& B2, u32bit& B3) B0 = T4; B1 = T0; B2 = T3; B3 = T2; } -/************************************************* -* Serpent Decryption S-Box 3 * -*************************************************/ +/* +* Serpent Decryption S-Box 3 +*/ inline void SBoxD3(u32bit& B0, u32bit& B1, u32bit& B2, u32bit& B3) { u32bit T0 = B0, T1 = B1, T2 = B2, T3 = B3, T4; @@ -143,9 +145,9 @@ inline void SBoxD3(u32bit& B0, u32bit& B1, u32bit& B2, u32bit& B3) B0 = T1; B1 = T4; B2 = T2; B3 = T3; } -/************************************************* -* Serpent Decryption S-Box 4 * -*************************************************/ +/* +* Serpent Decryption S-Box 4 +*/ inline void SBoxD4(u32bit& B0, u32bit& B1, u32bit& B2, u32bit& B3) { u32bit T0 = B0, T1 = B1, T2 = B2, T3 = B3, T4; @@ -155,9 +157,9 @@ inline void SBoxD4(u32bit& B0, u32bit& B1, u32bit& B2, u32bit& B3) B0 = T2; B1 = T1; B2 = T3; B3 = T0; } -/************************************************* -* Serpent Decryption S-Box 5 * -*************************************************/ +/* +* Serpent Decryption S-Box 5 +*/ inline void SBoxD5(u32bit& B0, u32bit& B1, u32bit& B2, u32bit& B3) { u32bit T0 = B0, T1 = B1, T2 = B2, T3 = B3, T4; @@ -167,9 +169,9 @@ inline void SBoxD5(u32bit& B0, u32bit& B1, u32bit& B2, u32bit& B3) B0 = T0; B1 = T3; B2 = T2; B3 = T4; } -/************************************************* -* Serpent Decryption S-Box 6 * -*************************************************/ +/* +* Serpent Decryption S-Box 6 +*/ inline void SBoxD6(u32bit& B0, u32bit& B1, u32bit& B2, u32bit& B3) { u32bit T0 = B0, T1 = B1, T2 = B2, T3 = B3, T4; @@ -179,9 +181,9 @@ inline void SBoxD6(u32bit& B0, u32bit& B1, u32bit& B2, u32bit& B3) B0 = T1; B1 = T4; B2 = T3; B3 = T2; } -/************************************************* -* Serpent Decryption S-Box 7 * -*************************************************/ +/* +* Serpent Decryption S-Box 7 +*/ inline void SBoxD7(u32bit& B0, u32bit& B1, u32bit& B2, u32bit& B3) { u32bit T0 = B0, T1 = B1, T2 = B2, T3 = B3, T4; @@ -191,9 +193,9 @@ inline void SBoxD7(u32bit& B0, u32bit& B1, u32bit& B2, u32bit& B3) B0 = T1; B1 = T2; B2 = T4; B3 = T3; } -/************************************************* -* Serpent Decryption S-Box 8 * -*************************************************/ +/* +* Serpent Decryption S-Box 8 +*/ inline void SBoxD8(u32bit& B0, u32bit& B1, u32bit& B2, u32bit& B3) { u32bit T0 = B0, T1 = B1, T2 = B2, T3 = B3, T4; @@ -203,9 +205,9 @@ inline void SBoxD8(u32bit& B0, u32bit& B1, u32bit& B2, u32bit& B3) B0 = T3; B1 = T0; B2 = T1; B3 = T4; } -/************************************************* -* Serpent's Linear Transformation * -*************************************************/ +/* +* Serpent's Linear Transformation +*/ inline void transform(u32bit& B0, u32bit& B1, u32bit& B2, u32bit& B3) { B0 = rotate_left(B0, 13); B2 = rotate_left(B2, 3); @@ -215,9 +217,9 @@ inline void transform(u32bit& B0, u32bit& B1, u32bit& B2, u32bit& B3) B0 = rotate_left(B0, 5); B2 = rotate_left(B2, 22); } -/************************************************* -* Serpent's Inverse Linear Transformation * -*************************************************/ +/* +* Serpent's Inverse Linear Transformation +*/ inline void i_transform(u32bit& B0, u32bit& B1, u32bit& B2, u32bit& B3) { B2 = rotate_right(B2, 22); B0 = rotate_right(B0, 5); @@ -229,18 +231,18 @@ inline void i_transform(u32bit& B0, u32bit& B1, u32bit& B2, u32bit& B3) } -/************************************************* -* XOR a key block with a data block * -*************************************************/ +/* +* XOR a key block with a data block +*/ #define key_xor(round, B0, B1, B2, B3) \ B0 ^= round_key[4*round ]; \ B1 ^= round_key[4*round+1]; \ B2 ^= round_key[4*round+2]; \ B3 ^= round_key[4*round+3]; -/************************************************* -* Serpent Encryption * -*************************************************/ +/* +* Serpent Encryption +*/ void Serpent::enc(const byte in[], byte out[]) const { u32bit B0 = load_le<u32bit>(in, 0); @@ -284,9 +286,9 @@ void Serpent::enc(const byte in[], byte out[]) const store_le(out, B0, B1, B2, B3); } -/************************************************* -* Serpent Decryption * -*************************************************/ +/* +* Serpent Decryption +*/ void Serpent::dec(const byte in[], byte out[]) const { u32bit B0 = load_le<u32bit>(in, 0); @@ -330,9 +332,9 @@ void Serpent::dec(const byte in[], byte out[]) const store_le(out, B0, B1, B2, B3); } -/************************************************* -* Serpent Key Schedule * -*************************************************/ +/* +* Serpent Key Schedule +*/ void Serpent::key_schedule(const byte key[], u32bit length) { const u32bit PHI = 0x9E3779B9; diff --git a/src/block/serpent/serpent.h b/src/block/serpent/serpent.h index fd26d9f7f..5b9be257f 100644 --- a/src/block/serpent/serpent.h +++ b/src/block/serpent/serpent.h @@ -1,7 +1,9 @@ -/************************************************* -* Serpent Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* Serpent +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_SERPENT_H__ #define BOTAN_SERPENT_H__ @@ -10,9 +12,9 @@ namespace Botan { -/************************************************* -* Serpent * -*************************************************/ +/* +* Serpent +*/ class BOTAN_DLL Serpent : public BlockCipher { public: diff --git a/src/block/serpent_ia32/serp_ia32.cpp b/src/block/serpent_ia32/serp_ia32.cpp index ec7574799..37dd4e637 100644 --- a/src/block/serpent_ia32/serp_ia32.cpp +++ b/src/block/serpent_ia32/serp_ia32.cpp @@ -1,7 +1,9 @@ -/************************************************* -* IA-32 Serpent Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* IA-32 Serpent +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/serp_ia32.h> #include <botan/loadstor.h> @@ -16,25 +18,25 @@ void botan_serpent_ia32_key_schedule(u32bit[140]); } -/************************************************* -* Serpent Encryption * -*************************************************/ +/* +* Serpent Encryption +*/ void Serpent_IA32::enc(const byte in[], byte out[]) const { botan_serpent_ia32_encrypt(in, out, round_key); } -/************************************************* -* Serpent Decryption * -*************************************************/ +/* +* Serpent Decryption +*/ void Serpent_IA32::dec(const byte in[], byte out[]) const { botan_serpent_ia32_decrypt(in, out, round_key); } -/************************************************* -* Serpent Key Schedule * -*************************************************/ +/* +* Serpent Key Schedule +*/ void Serpent_IA32::key_schedule(const byte key[], u32bit length) { SecureBuffer<u32bit, 140> W; diff --git a/src/block/serpent_ia32/serp_ia32.h b/src/block/serpent_ia32/serp_ia32.h index 4afa6a305..565e9889d 100644 --- a/src/block/serpent_ia32/serp_ia32.h +++ b/src/block/serpent_ia32/serp_ia32.h @@ -1,7 +1,9 @@ -/************************************************* -* Serpent (IA-32) Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* Serpent (IA-32) +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_SERPENT_IA32_H__ #define BOTAN_SERPENT_IA32_H__ @@ -10,9 +12,9 @@ namespace Botan { -/************************************************* -* Serpent * -*************************************************/ +/* +* Serpent +*/ class BOTAN_DLL Serpent_IA32 : public Serpent { public: diff --git a/src/block/skipjack/skipjack.cpp b/src/block/skipjack/skipjack.cpp index 62918a3fd..f5ffc861e 100644 --- a/src/block/skipjack/skipjack.cpp +++ b/src/block/skipjack/skipjack.cpp @@ -1,16 +1,18 @@ -/************************************************* -* Skipjack Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* Skipjack +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/skipjack.h> #include <botan/loadstor.h> namespace Botan { -/************************************************* -* Skipjack Encryption * -*************************************************/ +/* +* Skipjack Encryption +*/ void Skipjack::enc(const byte in[], byte out[]) const { u16bit W1 = load_le<u16bit>(in, 3); @@ -33,9 +35,9 @@ void Skipjack::enc(const byte in[], byte out[]) const store_le(out, W4, W3, W2, W1); } -/************************************************* -* Skipjack Decryption * -*************************************************/ +/* +* Skipjack Decryption +*/ void Skipjack::dec(const byte in[], byte out[]) const { u16bit W1 = load_le<u16bit>(in, 3); @@ -58,9 +60,9 @@ void Skipjack::dec(const byte in[], byte out[]) const store_le(out, W4, W3, W2, W1); } -/************************************************* -* Skipjack Stepping Rule 'A' * -*************************************************/ +/* +* Skipjack Stepping Rule 'A' +*/ void Skipjack::step_A(u16bit& W1, u16bit& W4, u32bit round) const { byte G1 = get_byte(0, W1), G2 = get_byte(1, W1), G3; @@ -72,9 +74,9 @@ void Skipjack::step_A(u16bit& W1, u16bit& W4, u32bit round) const W4 ^= W1 ^ round; } -/************************************************* -* Skipjack Stepping Rule 'B' * -*************************************************/ +/* +* Skipjack Stepping Rule 'B' +*/ void Skipjack::step_B(u16bit& W1, u16bit& W2, u32bit round) const { W2 ^= W1 ^ round; @@ -86,9 +88,9 @@ void Skipjack::step_B(u16bit& W1, u16bit& W2, u32bit round) const W1 = make_u16bit(G2, G3); } -/************************************************* -* Skipjack Invserse Stepping Rule 'A' * -*************************************************/ +/* +* Skipjack Invserse Stepping Rule 'A' +*/ void Skipjack::step_Ai(u16bit& W1, u16bit& W2, u32bit round) const { W1 ^= W2 ^ round; @@ -100,9 +102,9 @@ void Skipjack::step_Ai(u16bit& W1, u16bit& W2, u32bit round) const W2 = make_u16bit(G3, G2); } -/************************************************* -* Skipjack Invserse Stepping Rule 'B' * -*************************************************/ +/* +* Skipjack Invserse Stepping Rule 'B' +*/ void Skipjack::step_Bi(u16bit& W2, u16bit& W3, u32bit round) const { byte G1 = get_byte(1, W2), G2 = get_byte(0, W2), G3; @@ -114,9 +116,9 @@ void Skipjack::step_Bi(u16bit& W2, u16bit& W3, u32bit round) const W3 ^= W2 ^ round; } -/************************************************* -* Skipjack Key Schedule * -*************************************************/ +/* +* Skipjack Key Schedule +*/ void Skipjack::key_schedule(const byte key[], u32bit) { static const byte F[256] = { @@ -148,9 +150,9 @@ void Skipjack::key_schedule(const byte key[], u32bit) FTABLE[j][k] = F[k ^ key[9-j]]; } -/************************************************* -* Clear memory of sensitive data * -*************************************************/ +/* +* Clear memory of sensitive data +*/ void Skipjack::clear() throw() { for(u32bit j = 0; j != 10; ++j) diff --git a/src/block/skipjack/skipjack.h b/src/block/skipjack/skipjack.h index 2d8956215..231cd9c87 100644 --- a/src/block/skipjack/skipjack.h +++ b/src/block/skipjack/skipjack.h @@ -1,7 +1,9 @@ -/************************************************* -* Skipjack Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* Skipjack +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_SKIPJACK_H__ #define BOTAN_SKIPJACK_H__ @@ -10,9 +12,9 @@ namespace Botan { -/************************************************* -* Skipjack * -*************************************************/ +/* +* Skipjack +*/ class BOTAN_DLL Skipjack : public BlockCipher { public: diff --git a/src/block/square/sqr_tab.cpp b/src/block/square/sqr_tab.cpp index 248ace4cd..331bf3ea1 100644 --- a/src/block/square/sqr_tab.cpp +++ b/src/block/square/sqr_tab.cpp @@ -1,7 +1,9 @@ -/************************************************* -* S-Box and Diffusion Tables for Square * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* S-Box and Diffusion Tables for Square +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/square.h> diff --git a/src/block/square/square.cpp b/src/block/square/square.cpp index 44fb26bfd..5aaef6ee4 100644 --- a/src/block/square/square.cpp +++ b/src/block/square/square.cpp @@ -1,7 +1,9 @@ -/************************************************* -* Square Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* Square +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/square.h> #include <botan/loadstor.h> @@ -9,9 +11,9 @@ namespace Botan { -/************************************************* -* Square Encryption * -*************************************************/ +/* +* Square Encryption +*/ void Square::enc(const byte in[], byte out[]) const { u32bit T0, T1, T2, T3, B0, B1, B2, B3; @@ -60,9 +62,9 @@ void Square::enc(const byte in[], byte out[]) const out[15] = SE[get_byte(3, B3)] ^ ME[31]; } -/************************************************* -* Square Decryption * -*************************************************/ +/* +* Square Decryption +*/ void Square::dec(const byte in[], byte out[]) const { u32bit T0, T1, T2, T3, B0, B1, B2, B3; @@ -111,9 +113,9 @@ void Square::dec(const byte in[], byte out[]) const out[15] = SD[get_byte(3, B3)] ^ MD[31]; } -/************************************************* -* Square Key Schedule * -*************************************************/ +/* +* Square Key Schedule +*/ void Square::key_schedule(const byte key[], u32bit) { SecureBuffer<u32bit, 36> XEK, XDK; @@ -140,9 +142,9 @@ void Square::key_schedule(const byte key[], u32bit) DK.copy(XDK + 4, 28); } -/************************************************* -* Square's Inverse Linear Transformation * -*************************************************/ +/* +* Square's Inverse Linear Transformation +*/ void Square::transform(u32bit round_key[4]) { static const byte G[4][4] = { @@ -171,9 +173,9 @@ void Square::transform(u32bit round_key[4]) } } -/************************************************* -* Clear memory of sensitive data * -*************************************************/ +/* +* Clear memory of sensitive data +*/ void Square::clear() throw() { EK.clear(); diff --git a/src/block/square/square.h b/src/block/square/square.h index 4c4d89100..94a1fc370 100644 --- a/src/block/square/square.h +++ b/src/block/square/square.h @@ -1,7 +1,9 @@ -/************************************************* -* Square Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* Square +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_SQUARE_H__ #define BOTAN_SQUARE_H__ @@ -10,9 +12,9 @@ namespace Botan { -/************************************************* -* Square * -*************************************************/ +/* +* Square +*/ class BOTAN_DLL Square : public BlockCipher { public: diff --git a/src/block/tea/tea.cpp b/src/block/tea/tea.cpp index 7b79d86d1..2b4212d9c 100644 --- a/src/block/tea/tea.cpp +++ b/src/block/tea/tea.cpp @@ -1,16 +1,18 @@ -/************************************************* -* TEA Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* TEA +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/tea.h> #include <botan/loadstor.h> namespace Botan { -/************************************************* -* TEA Encryption * -*************************************************/ +/* +* TEA Encryption +*/ void TEA::enc(const byte in[], byte out[]) const { u32bit L = load_be<u32bit>(in, 0), R = load_be<u32bit>(in, 1); @@ -26,9 +28,9 @@ void TEA::enc(const byte in[], byte out[]) const store_be(out, L, R); } -/************************************************* -* TEA Decryption * -*************************************************/ +/* +* TEA Decryption +*/ void TEA::dec(const byte in[], byte out[]) const { u32bit L = load_be<u32bit>(in, 0), R = load_be<u32bit>(in, 1); @@ -44,9 +46,9 @@ void TEA::dec(const byte in[], byte out[]) const store_be(out, L, R); } -/************************************************* -* TEA Key Schedule * -*************************************************/ +/* +* TEA Key Schedule +*/ void TEA::key_schedule(const byte key[], u32bit) { for(u32bit j = 0; j != 4; ++j) diff --git a/src/block/tea/tea.h b/src/block/tea/tea.h index b751eda4e..8ddf3e330 100644 --- a/src/block/tea/tea.h +++ b/src/block/tea/tea.h @@ -1,7 +1,9 @@ -/************************************************* -* TEA Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* TEA +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_TEA_H__ #define BOTAN_TEA_H__ @@ -10,9 +12,9 @@ namespace Botan { -/************************************************* -* TEA * -*************************************************/ +/* +* TEA +*/ class BOTAN_DLL TEA : public BlockCipher { public: diff --git a/src/block/twofish/two_tab.cpp b/src/block/twofish/two_tab.cpp index 7d349312b..19ba58de6 100644 --- a/src/block/twofish/two_tab.cpp +++ b/src/block/twofish/two_tab.cpp @@ -1,7 +1,9 @@ -/************************************************* -* S-Box and MDS Tables for Twofish * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* S-Box and MDS Tables for Twofish +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/twofish.h> diff --git a/src/block/twofish/twofish.cpp b/src/block/twofish/twofish.cpp index d6bab2fc5..edc476d15 100644 --- a/src/block/twofish/twofish.cpp +++ b/src/block/twofish/twofish.cpp @@ -1,7 +1,9 @@ -/************************************************* -* Twofish Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* Twofish +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/twofish.h> #include <botan/loadstor.h> @@ -9,9 +11,9 @@ namespace Botan { -/************************************************* -* Twofish Encryption * -*************************************************/ +/* +* Twofish Encryption +*/ void Twofish::enc(const byte in[], byte out[]) const { u32bit A = load_le<u32bit>(in, 0) ^ round_key[0]; @@ -54,9 +56,9 @@ void Twofish::enc(const byte in[], byte out[]) const store_le(out, C, D, A, B); } -/************************************************* -* Twofish Decryption * -*************************************************/ +/* +* Twofish Decryption +*/ void Twofish::dec(const byte in[], byte out[]) const { u32bit A = load_le<u32bit>(in, 0) ^ round_key[4]; @@ -99,9 +101,9 @@ void Twofish::dec(const byte in[], byte out[]) const store_le(out, C, D, A, B); } -/************************************************* -* Twofish Key Schedule * -*************************************************/ +/* +* Twofish Key Schedule +*/ void Twofish::key_schedule(const byte key[], u32bit length) { SecureBuffer<byte, 16> S; @@ -180,9 +182,9 @@ void Twofish::key_schedule(const byte key[], u32bit length) } } -/************************************************* -* Do one column of the RS matrix multiplcation * -*************************************************/ +/* +* Do one column of the RS matrix multiplcation +*/ void Twofish::rs_mul(byte S[4], byte key, u32bit offset) { if(key) @@ -201,9 +203,9 @@ void Twofish::rs_mul(byte S[4], byte key, u32bit offset) } } -/************************************************* -* Clear memory of sensitive data * -*************************************************/ +/* +* Clear memory of sensitive data +*/ void Twofish::clear() throw() { SBox0.clear(); diff --git a/src/block/twofish/twofish.h b/src/block/twofish/twofish.h index 39f0a6121..0640e32f8 100644 --- a/src/block/twofish/twofish.h +++ b/src/block/twofish/twofish.h @@ -1,7 +1,9 @@ -/************************************************* -* Twofish Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* Twofish +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_TWOFISH_H__ #define BOTAN_TWOFISH_H__ @@ -10,9 +12,9 @@ namespace Botan { -/************************************************* -* Twofish * -*************************************************/ +/* +* Twofish +*/ class BOTAN_DLL Twofish : public BlockCipher { public: diff --git a/src/block/xtea/xtea.cpp b/src/block/xtea/xtea.cpp index d13173f02..1b24dd159 100644 --- a/src/block/xtea/xtea.cpp +++ b/src/block/xtea/xtea.cpp @@ -1,7 +1,9 @@ -/************************************************* -* XTEA Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* XTEA +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/xtea.h> #include <botan/loadstor.h> @@ -9,9 +11,9 @@ namespace Botan { -/************************************************* -* XTEA Encryption * -*************************************************/ +/* +* XTEA Encryption +*/ void XTEA::enc(const byte in[], byte out[]) const { u32bit L = load_be<u32bit>(in, 0), R = load_be<u32bit>(in, 1); @@ -25,9 +27,9 @@ void XTEA::enc(const byte in[], byte out[]) const store_be(out, L, R); } -/************************************************* -* XTEA Decryption * -*************************************************/ +/* +* XTEA Decryption +*/ void XTEA::dec(const byte in[], byte out[]) const { u32bit L = load_be<u32bit>(in, 0), R = load_be<u32bit>(in, 1); @@ -41,9 +43,9 @@ void XTEA::dec(const byte in[], byte out[]) const store_be(out, L, R); } -/************************************************* -* XTEA Key Schedule * -*************************************************/ +/* +* XTEA Key Schedule +*/ void XTEA::key_schedule(const byte key[], u32bit) { static const u32bit DELTAS[64] = { diff --git a/src/block/xtea/xtea.h b/src/block/xtea/xtea.h index 630da4064..d9c6066cb 100644 --- a/src/block/xtea/xtea.h +++ b/src/block/xtea/xtea.h @@ -1,7 +1,9 @@ -/************************************************* -* XTEA Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* XTEA +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_XTEA_H__ #define BOTAN_XTEA_H__ @@ -10,9 +12,9 @@ namespace Botan { -/************************************************* -* XTEA * -*************************************************/ +/* +* XTEA +*/ class BOTAN_DLL XTEA : public BlockCipher { public: diff --git a/src/cert/cvc/asn1_eac_str.cpp b/src/cert/cvc/asn1_eac_str.cpp index b367df394..a306ffb01 100644 --- a/src/cert/cvc/asn1_eac_str.cpp +++ b/src/cert/cvc/asn1_eac_str.cpp @@ -1,8 +1,10 @@ -/************************************************* -* Simple ASN.1 String Types Source File * -* (C) 2007 FlexSecure GmbH * -* 2008 Jack Lloyd * -*************************************************/ +/* +* Simple ASN.1 String Types +* (C) 2007 FlexSecure GmbH +* 2008 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/eac_asn_obj.h> #include <botan/der_enc.h> @@ -13,9 +15,9 @@ namespace Botan { -/************************************************* -* Create an ASN1_EAC_String * -*************************************************/ +/* +* Create an ASN1_EAC_String +*/ ASN1_EAC_String::ASN1_EAC_String(const std::string& str, ASN1_Tag t) : tag(t) { iso_8859_str = Charset::transcode(str, LOCAL_CHARSET, LATIN1_CHARSET); @@ -25,42 +27,42 @@ ASN1_EAC_String::ASN1_EAC_String(const std::string& str, ASN1_Tag t) : tag(t) } } -/************************************************* -* Return this string in ISO 8859-1 encoding * -*************************************************/ +/* +* Return this string in ISO 8859-1 encoding +*/ std::string ASN1_EAC_String::iso_8859() const { return iso_8859_str; } -/************************************************* -* Return this string in local encoding * -*************************************************/ +/* +* Return this string in local encoding +*/ std::string ASN1_EAC_String::value() const { return Charset::transcode(iso_8859_str, LATIN1_CHARSET, LOCAL_CHARSET); } -/************************************************* -* Return the type of this string object * -*************************************************/ +/* +* Return the type of this string object +*/ ASN1_Tag ASN1_EAC_String::tagging() const { return tag; } -/************************************************* -* DER encode an ASN1_EAC_String * -*************************************************/ +/* +* DER encode an ASN1_EAC_String +*/ void ASN1_EAC_String::encode_into(DER_Encoder& encoder) const { std::string value = iso_8859(); encoder.add_object(tagging(), APPLICATION, value); } -/************************************************* -* Decode a BER encoded ASN1_EAC_String * -*************************************************/ +/* +* Decode a BER encoded ASN1_EAC_String +*/ void ASN1_EAC_String::decode_from(BER_Decoder& source) { BER_Object obj = source.get_next_object(); diff --git a/src/cert/cvc/asn1_eac_tm.cpp b/src/cert/cvc/asn1_eac_tm.cpp index 91688879c..05533b520 100644 --- a/src/cert/cvc/asn1_eac_tm.cpp +++ b/src/cert/cvc/asn1_eac_tm.cpp @@ -1,8 +1,10 @@ -/************************************************* -* EAC Time Types Source File * -* (C) 2007 FlexSecure GmbH * -* 2008 Jack Lloyd * -*************************************************/ +/* +* EAC Time Types +* (C) 2007 FlexSecure GmbH +* 2008 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/eac_asn_obj.h> #include <botan/der_enc.h> @@ -16,9 +18,9 @@ namespace Botan { namespace { -/************************************************* -* Convert a time_t to a struct tm * -*************************************************/ +/* +* Convert a time_t to a struct tm +*/ std::tm get_tm(u64bit timer) { std::time_t time_val = static_cast<std::time_t>(timer); @@ -59,9 +61,9 @@ u32bit dec_two_digit(byte b1, byte b2) } } -/************************************************* -* Create an EAC_Time * -*************************************************/ +/* +* Create an EAC_Time +*/ EAC_Time::EAC_Time(u64bit timer, ASN1_Tag t) :tag(t) { @@ -73,17 +75,17 @@ EAC_Time::EAC_Time(u64bit timer, ASN1_Tag t) } -/************************************************* -* Create an EAC_Time * -*************************************************/ +/* +* Create an EAC_Time +*/ EAC_Time::EAC_Time(const std::string& t_spec, ASN1_Tag t) :tag(t) { set_to(t_spec); } -/************************************************* -* Create an EAC_Time * -*************************************************/ +/* +* Create an EAC_Time +*/ EAC_Time::EAC_Time(u32bit y, u32bit m, u32bit d, ASN1_Tag t) : year(y), month(m), @@ -92,9 +94,9 @@ EAC_Time::EAC_Time(u32bit y, u32bit m, u32bit d, ASN1_Tag t) { } -/************************************************* -* Set the time with a human readable string * -*************************************************/ +/* +* Set the time with a human readable string +*/ void EAC_Time::set_to(const std::string& time_str) { if (time_str == "") @@ -132,18 +134,18 @@ void EAC_Time::set_to(const std::string& time_str) } -/************************************************* -* DER encode a EAC_Time * -*************************************************/ +/* +* DER encode a EAC_Time +*/ void EAC_Time::encode_into(DER_Encoder& der) const { der.add_object(tag, APPLICATION, encoded_eac_time()); } -/************************************************* -* Return a string representation of the time * -*************************************************/ +/* +* Return a string representation of the time +*/ std::string EAC_Time::as_string() const { if (time_is_set() == false) @@ -157,17 +159,17 @@ std::string EAC_Time::as_string() const return asn1rep; } -/************************************************* -* Return if the time has been set somehow * -*************************************************/ +/* +* Return if the time has been set somehow +*/ bool EAC_Time::time_is_set() const { return (year != 0); } -/************************************************* -* Return a human readable string representation * -*************************************************/ +/* +* Return a human readable string representation +*/ std::string EAC_Time::readable_string() const { if (time_is_set() == false) @@ -181,9 +183,9 @@ std::string EAC_Time::readable_string() const return readable; } -/************************************************* -* Do a general sanity check on the time * -*************************************************/ +/* +* Do a general sanity check on the time +*/ bool EAC_Time::passes_sanity_check() const { if (year < 2000 || year > 2099) @@ -197,7 +199,7 @@ bool EAC_Time::passes_sanity_check() const } /****************************************** -* modification functions * +* modification functions ******************************************/ void EAC_Time::add_years(u32bit years) @@ -216,9 +218,9 @@ void EAC_Time::add_months(u32bit months) } -/************************************************* -* Compare this time against another * -*************************************************/ +/* +* Compare this time against another +*/ s32bit EAC_Time::cmp(const EAC_Time& other) const { if (time_is_set() == false) @@ -236,9 +238,9 @@ s32bit EAC_Time::cmp(const EAC_Time& other) const return SAME_TIME; } -/************************************************* -* Compare two EAC_Times for in various ways * -*************************************************/ +/* +* Compare two EAC_Times for in various ways +*/ bool operator==(const EAC_Time& t1, const EAC_Time& t2) { return (t1.cmp(t2) == 0); @@ -264,9 +266,9 @@ bool operator<(const EAC_Time& t1, const EAC_Time& t2) return (t1.cmp(t2) < 0); } -/************************************************* -* Decode a BER encoded EAC_Time * -*************************************************/ +/* +* Decode a BER encoded EAC_Time +*/ void EAC_Time::decode_from(BER_Decoder& source) { BER_Object obj = source.get_next_object(); @@ -320,9 +322,9 @@ u32bit EAC_Time::get_day() const return day; } -/************************************************* -* make the value an octet string for encoding * -*************************************************/ +/* +* make the value an octet string for encoding +*/ SecureVector<byte> EAC_Time::encoded_eac_time() const { SecureVector<byte> result; diff --git a/src/cert/cvc/cvc_ado.cpp b/src/cert/cvc/cvc_ado.cpp index 6ea8d59c2..6e1484e90 100644 --- a/src/cert/cvc/cvc_ado.cpp +++ b/src/cert/cvc/cvc_ado.cpp @@ -1,8 +1,10 @@ -/************************************************* -* CVC Certificate Constructor * -* (C) 2007 FlexSecure GmbH * -* 2008 Jack Lloyd * -*************************************************/ +/* +* CVC Certificate Constructor +* (C) 2007 FlexSecure GmbH +* 2008 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/cvc_ado.h> #include <fstream> diff --git a/src/cert/cvc/cvc_ado.h b/src/cert/cvc/cvc_ado.h index 5b79cacd9..2c4f3ce70 100644 --- a/src/cert/cvc/cvc_ado.h +++ b/src/cert/cvc/cvc_ado.h @@ -1,8 +1,10 @@ -/************************************************* -* EAC1_1 CVC ADO Header File * -* (C) 2008 Falko Strenzke * -* [email protected] * -*************************************************/ +/* +* EAC1_1 CVC ADO +* (C) 2008 Falko Strenzke +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_EAC_CVC_ADO_H__ #define BOTAN_EAC_CVC_ADO_H__ diff --git a/src/cert/cvc/cvc_ca.h b/src/cert/cvc/cvc_ca.h index b1296cbfb..3ec307bb3 100644 --- a/src/cert/cvc/cvc_ca.h +++ b/src/cert/cvc/cvc_ca.h @@ -1,8 +1,10 @@ -/************************************************* -* EAC1.1 CVC Certificate Authority Header File * -* (C) 2007 FlexSecure GmbH * -* 2008 Jack Lloyd * -*************************************************/ +/* +* EAC1.1 CVC Certificate Authority +* (C) 2007 FlexSecure GmbH +* 2008 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_CVC_CA_H__ #define BOTAN_CVC_CA_H__ diff --git a/src/cert/cvc/cvc_cert.cpp b/src/cert/cvc/cvc_cert.cpp index 11539ef1e..71ca0cf16 100644 --- a/src/cert/cvc/cvc_cert.cpp +++ b/src/cert/cvc/cvc_cert.cpp @@ -1,6 +1,8 @@ /* (C) 2007 FlexSecure GmbH 2008 Jack Lloyd +* +* Distributed under the terms of the Botan license */ #include <botan/cvc_cert.h> @@ -27,9 +29,9 @@ u32bit EAC1_1_CVC::get_chat_value() const return m_chat_val; } -/************************************************* -* Decode the TBSCertificate data * -*************************************************/ +/* +* Decode the TBSCertificate data +*/ void EAC1_1_CVC::force_decode() { SecureVector<byte> enc_pk; @@ -73,9 +75,9 @@ void EAC1_1_CVC::force_decode() #endif } -/************************************************* -* CVC Certificate Constructor * -*************************************************/ +/* +* CVC Certificate Constructor +*/ EAC1_1_CVC::EAC1_1_CVC(std::tr1::shared_ptr<DataSource>& in) { init(in); diff --git a/src/cert/cvc/cvc_cert.h b/src/cert/cvc/cvc_cert.h index c007a42e8..17671d332 100644 --- a/src/cert/cvc/cvc_cert.h +++ b/src/cert/cvc/cvc_cert.h @@ -1,8 +1,10 @@ -/************************************************* -* EAC1_1 CVC Header File * -* (C) 2008 Falko Strenzke * -* 2008 Jack Lloyd * -*************************************************/ +/* +* EAC1_1 CVC +* (C) 2008 Falko Strenzke +* 2008 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_CVC_EAC_H__ #define BOTAN_CVC_EAC_H__ @@ -78,9 +80,9 @@ class BOTAN_DLL EAC1_1_CVC : public EAC1_1_gen_CVC<EAC1_1_CVC>//Signed_Object OID m_chat_oid; }; -/************************************************* -* Comparison * -*************************************************/ +/* +* Comparison +*/ inline bool operator!=(EAC1_1_CVC const& lhs, EAC1_1_CVC const& rhs) { return !(lhs == rhs); diff --git a/src/cert/cvc/cvc_gen_cert.h b/src/cert/cvc/cvc_gen_cert.h index ea53f7f0f..4a788026c 100644 --- a/src/cert/cvc/cvc_gen_cert.h +++ b/src/cert/cvc/cvc_gen_cert.h @@ -1,8 +1,10 @@ -/************************************************* -* EAC1_1 general CVC Header File * -* (C) 2008 Falko Strenzke * -* 2008 Jack Lloyd * -*************************************************/ +/* +* EAC1_1 general CVC +* (C) 2008 Falko Strenzke +* 2008 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_EAC_CVC_GEN_CERT_H__ #define BOTAN_EAC_CVC_GEN_CERT_H__ diff --git a/src/cert/cvc/cvc_key.h b/src/cert/cvc/cvc_key.h index e24c42e41..67b6cef17 100644 --- a/src/cert/cvc/cvc_key.h +++ b/src/cert/cvc/cvc_key.h @@ -1,9 +1,11 @@ -/************************************************* -* EAC CVC Public Key Header File * -* (C) 2008 FlexSecure Gmbh * -* Falko Strenzke * -* [email protected] * -*************************************************/ +/* +* EAC CVC Public Key +* (C) 2008 FlexSecure Gmbh +* Falko Strenzke +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_EAC1_1_CVC_PUBLIC_KEY_H__ #define BOTAN_EAC1_1_CVC_PUBLIC_KEY_H__ diff --git a/src/cert/cvc/cvc_req.cpp b/src/cert/cvc/cvc_req.cpp index 84ea3ba8a..a9a94827c 100644 --- a/src/cert/cvc/cvc_req.cpp +++ b/src/cert/cvc/cvc_req.cpp @@ -1,6 +1,8 @@ /* (C) 2007 FlexSecure GmbH 2008 Jack Lloyd +* +* Distributed under the terms of the Botan license */ #include <botan/cvc_cert.h> diff --git a/src/cert/cvc/cvc_req.h b/src/cert/cvc/cvc_req.h index 484d01f25..8599f539d 100644 --- a/src/cert/cvc/cvc_req.h +++ b/src/cert/cvc/cvc_req.h @@ -1,8 +1,10 @@ -/************************************************* -* EAC1_1 CVC Request Header File * -* (C) 2008 Falko Strenzke * -* [email protected] * -*************************************************/ +/* +* EAC1_1 CVC Request +* (C) 2008 Falko Strenzke +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_EAC_CVC_REQ_H__ #define BOTAN_EAC_CVC_REQ_H__ @@ -48,9 +50,9 @@ class BOTAN_DLL EAC1_1_Req : public EAC1_1_gen_CVC<EAC1_1_Req> EAC1_1_Req() {} }; -/************************************************* -* Comparison Operator * -*************************************************/ +/* +* Comparison Operator +*/ inline bool operator!=(EAC1_1_Req const& lhs, EAC1_1_Req const& rhs) { return !(lhs == rhs); diff --git a/src/cert/cvc/cvc_self.cpp b/src/cert/cvc/cvc_self.cpp index 8b49d3186..45a584cb3 100644 --- a/src/cert/cvc/cvc_self.cpp +++ b/src/cert/cvc/cvc_self.cpp @@ -1,6 +1,8 @@ /* (C) 2007 FlexSecure GmbH 2008 Jack Lloyd +* +* Distributed under the terms of the Botan license */ #include <botan/cvc_self.h> @@ -20,7 +22,7 @@ namespace Botan { namespace { /******************************* -* cvc CHAT values * +* cvc CHAT values *******************************/ enum CHAT_values{ CVCA = 0xC0, diff --git a/src/cert/cvc/cvc_self.h b/src/cert/cvc/cvc_self.h index 735301989..db23547b9 100644 --- a/src/cert/cvc/cvc_self.h +++ b/src/cert/cvc/cvc_self.h @@ -1,8 +1,10 @@ -/************************************************* -* CVC Self-Signed Certificate Header File * -* (C) 2007 FlexSecure GmbH * -* 2008 Jack Lloyd * -*************************************************/ +/* +* CVC Self-Signed Certificate +* (C) 2007 FlexSecure GmbH +* 2008 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_CVC_EAC_SELF_H__ #define BOTAN_CVC_EAC_SELF_H__ diff --git a/src/cert/cvc/eac_asn_obj.h b/src/cert/cvc/eac_asn_obj.h index 61a204eff..3e70f6b74 100644 --- a/src/cert/cvc/eac_asn_obj.h +++ b/src/cert/cvc/eac_asn_obj.h @@ -1,8 +1,10 @@ -/************************************************* -* EAC ASN.1 Objects Header File * -* (C) 2007-2008 FlexSecure GmbH * -* 2008 Jack Lloyd * -*************************************************/ +/* +* EAC ASN.1 Objects +* (C) 2007-2008 FlexSecure GmbH +* 2008 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_EAC_ASN1_OBJ_H__ #define BOTAN_EAC_ASN1_OBJ_H__ @@ -221,9 +223,9 @@ class BOTAN_DLL ASN1_Chr : public ASN1_EAC_String ASN1_Chr(std::string const& str = ""); }; -/************************************************* -* Comparison Operations * -*************************************************/ +/* +* Comparison Operations +*/ bool operator==(const EAC_Time&, const EAC_Time&); bool operator!=(const EAC_Time&, const EAC_Time&); bool operator<=(const EAC_Time&, const EAC_Time&); diff --git a/src/cert/cvc/eac_obj.h b/src/cert/cvc/eac_obj.h index 72d897700..04afd7e59 100644 --- a/src/cert/cvc/eac_obj.h +++ b/src/cert/cvc/eac_obj.h @@ -1,8 +1,10 @@ -/************************************************* -* EAC1_1 objects Header File * -* (C) 2008 Falko Strenzke * -* [email protected] * -*************************************************/ +/* +* EAC1_1 objects +* (C) 2008 Falko Strenzke +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_EAC_OBJ_H__ #define BOTAN_EAC_OBJ_H__ @@ -23,9 +25,9 @@ namespace Botan { const std::string eac_cvc_emsa("EMSA1_BSI"); -/************************************************* -* TR03110 v1.1 EAC CV Certificate * -*************************************************/ +/* +* TR03110 v1.1 EAC CV Certificate +*/ template<typename Derived> // CRTP is used enable the call sequence: class BOTAN_DLL EAC1_1_obj : public EAC_Signed_Object { diff --git a/src/cert/cvc/ecdsa_sig.h b/src/cert/cvc/ecdsa_sig.h index 720acaedc..15015c76d 100644 --- a/src/cert/cvc/ecdsa_sig.h +++ b/src/cert/cvc/ecdsa_sig.h @@ -1,8 +1,10 @@ -/************************************************* -* ECDSA Header File * -* (C) 2007 Falko Strenzke, FlexSecure GmbH * -* (C) 2008 Jack Lloyd * -*************************************************/ +/* +* ECDSA +* (C) 2007 Falko Strenzke, FlexSecure GmbH +* (C) 2008 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_ECDSA_SIGNATURE_H__ #define BOTAN_ECDSA_SIGNATURE_H__ diff --git a/src/cert/cvc/freestore.h b/src/cert/cvc/freestore.h index e33c0f094..f95afa802 100644 --- a/src/cert/cvc/freestore.h +++ b/src/cert/cvc/freestore.h @@ -1,7 +1,7 @@ -/************************************************** -* (C) 2007 Christoph Ludwig * -* [email protected] * -**************************************************/ +/** +* (C) 2007 Christoph Ludwig +**/ #ifndef BOTAN_FREESTORE_H__ #define BOTAN_FREESTORE_H__ @@ -23,6 +23,8 @@ namespace Botan { * enables convenient automatic conversions between plain and smart * pointer types. It internally stores a SharedPointer which can be * accessed. +* +* Distributed under the terms of the Botan license */ template<typename T> class BOTAN_DLL SharedPtrConverter diff --git a/src/cert/cvc/signed_obj.cpp b/src/cert/cvc/signed_obj.cpp index 73ae6b917..4a08ed0ac 100644 --- a/src/cert/cvc/signed_obj.cpp +++ b/src/cert/cvc/signed_obj.cpp @@ -1,16 +1,18 @@ -/************************************************* -* X.509 SIGNED Object Source File * -* (C) 1999-2007 Jack Lloyd * -* 2007 FlexSecure GmbH * -*************************************************/ +/* +* X.509 SIGNED Object +* (C) 1999-2007 Jack Lloyd +* 2007 FlexSecure GmbH +* +* Distributed under the terms of the Botan license +*/ #include <botan/signed_obj.h> namespace Botan { -/************************************************* -* Return a BER encoded X.509 object * -*************************************************/ +/* +* Return a BER encoded X.509 object +*/ SecureVector<byte> EAC_Signed_Object::BER_encode() const { Pipe ber; @@ -20,9 +22,9 @@ SecureVector<byte> EAC_Signed_Object::BER_encode() const return ber.read_all(); } -/************************************************* -* Return a PEM encoded X.509 object * -*************************************************/ +/* +* Return a PEM encoded X.509 object +*/ std::string EAC_Signed_Object::PEM_encode() const { Pipe pem; @@ -32,17 +34,17 @@ std::string EAC_Signed_Object::PEM_encode() const return pem.read_all_as_string(); } -/************************************************* -* Return the algorithm used to sign this object * -*************************************************/ +/* +* Return the algorithm used to sign this object +*/ AlgorithmIdentifier EAC_Signed_Object::signature_algorithm() const { return sig_algo; } -/************************************************* -* Try to decode the actual information * -*************************************************/ +/* +* Try to decode the actual information +*/ void EAC_Signed_Object::do_decode() { try { diff --git a/src/cert/cvc/signed_obj.h b/src/cert/cvc/signed_obj.h index 918a20db5..3c233d21b 100644 --- a/src/cert/cvc/signed_obj.h +++ b/src/cert/cvc/signed_obj.h @@ -1,8 +1,10 @@ -/************************************************* -* EAC SIGNED Object Header File * -* (C) 2007 FlexSecure GmbH * -* 2008 Jack Lloyd * -*************************************************/ +/* +* EAC SIGNED Object +* (C) 2007 FlexSecure GmbH +* 2008 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_EAC_SIGNED_OBJECT_H__ #define BOTAN_EAC_SIGNED_OBJECT_H__ diff --git a/src/cert/x509/certstor.cpp b/src/cert/x509/certstor.cpp index 2b51590ad..96f2699df 100644 --- a/src/cert/x509/certstor.cpp +++ b/src/cert/x509/certstor.cpp @@ -1,42 +1,44 @@ -/************************************************* -* Certificate Store Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* Certificate Store +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/certstor.h> namespace Botan { -/************************************************* -* Search by name * -*************************************************/ +/* +* Search by name +*/ std::vector<X509_Certificate> Certificate_Store::by_name(const std::string&) const { return std::vector<X509_Certificate>(); } -/************************************************* -* Search by email * -*************************************************/ +/* +* Search by email +*/ std::vector<X509_Certificate> Certificate_Store::by_email(const std::string&) const { return std::vector<X509_Certificate>(); } -/************************************************* -* Search by X.500 distinguished name * -*************************************************/ +/* +* Search by X.500 distinguished name +*/ std::vector<X509_Certificate> Certificate_Store::by_dn(const X509_DN&) const { return std::vector<X509_Certificate>(); } -/************************************************* -* Find any CRLs that might be useful * -*************************************************/ +/* +* Find any CRLs that might be useful +*/ std::vector<X509_CRL> Certificate_Store::get_crls_for(const X509_Certificate&) const { diff --git a/src/cert/x509/certstor.h b/src/cert/x509/certstor.h index ca0480496..d5004e366 100644 --- a/src/cert/x509/certstor.h +++ b/src/cert/x509/certstor.h @@ -1,7 +1,9 @@ -/************************************************* -* Certificate Store Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* Certificate Store +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_CERT_STORE_H__ #define BOTAN_CERT_STORE_H__ @@ -11,9 +13,9 @@ namespace Botan { -/************************************************* -* Certificate Store Interface * -*************************************************/ +/* +* Certificate Store Interface +*/ class BOTAN_DLL Certificate_Store { public: diff --git a/src/cert/x509/crl_ent.cpp b/src/cert/x509/crl_ent.cpp index dbf550f13..afea8cf6b 100644 --- a/src/cert/x509/crl_ent.cpp +++ b/src/cert/x509/crl_ent.cpp @@ -1,7 +1,9 @@ -/************************************************* -* CRL Entry Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* CRL Entry +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/crl_ent.h> #include <botan/x509_ext.h> @@ -13,18 +15,18 @@ namespace Botan { -/************************************************* -* Create a CRL_Entry * -*************************************************/ +/* +* Create a CRL_Entry +*/ CRL_Entry::CRL_Entry(bool t_on_unknown_crit) : throw_on_unknown_critical(t_on_unknown_crit) { reason = UNSPECIFIED; } -/************************************************* -* Create a CRL_Entry * -*************************************************/ +/* +* Create a CRL_Entry +*/ CRL_Entry::CRL_Entry(const X509_Certificate& cert, CRL_Code why) : throw_on_unknown_critical(false) { @@ -33,9 +35,9 @@ CRL_Entry::CRL_Entry(const X509_Certificate& cert, CRL_Code why) : reason = why; } -/************************************************* -* Compare two CRL_Entrys for equality * -*************************************************/ +/* +* Compare two CRL_Entrys for equality +*/ bool operator==(const CRL_Entry& a1, const CRL_Entry& a2) { if(a1.serial_number() != a2.serial_number()) @@ -47,25 +49,25 @@ bool operator==(const CRL_Entry& a1, const CRL_Entry& a2) return true; } -/************************************************* -* Compare two CRL_Entrys for inequality * -*************************************************/ +/* +* Compare two CRL_Entrys for inequality +*/ bool operator!=(const CRL_Entry& a1, const CRL_Entry& a2) { return !(a1 == a2); } -/************************************************* -* Compare two CRL_Entrys * -*************************************************/ +/* +* Compare two CRL_Entrys +*/ bool operator<(const CRL_Entry& a1, const CRL_Entry& a2) { return (a1.expire_time().cmp(a2.expire_time()) < 0); } -/************************************************* -* DER encode a CRL_Entry * -*************************************************/ +/* +* DER encode a CRL_Entry +*/ void CRL_Entry::encode_into(DER_Encoder& der) const { Extensions extensions; @@ -79,9 +81,9 @@ void CRL_Entry::encode_into(DER_Encoder& der) const .end_cons(); } -/************************************************* -* Decode a BER encoded CRL_Entry * -*************************************************/ +/* +* Decode a BER encoded CRL_Entry +*/ void CRL_Entry::decode_from(BER_Decoder& source) { BigInt serial_number_bn; diff --git a/src/cert/x509/crl_ent.h b/src/cert/x509/crl_ent.h index 40d82a8d7..050356c84 100644 --- a/src/cert/x509/crl_ent.h +++ b/src/cert/x509/crl_ent.h @@ -1,7 +1,9 @@ -/************************************************* -* CRL Entry Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* CRL Entry +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_CRL_ENTRY_H__ #define BOTAN_CRL_ENTRY_H__ diff --git a/src/cert/x509/pkcs10.cpp b/src/cert/x509/pkcs10.cpp index bd21cca7d..5617cece4 100644 --- a/src/cert/x509/pkcs10.cpp +++ b/src/cert/x509/pkcs10.cpp @@ -1,7 +1,9 @@ -/************************************************* -* PKCS #10 Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* PKCS #10 +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/pkcs10.h> #include <botan/der_enc.h> @@ -14,27 +16,27 @@ namespace Botan { -/************************************************* -* PKCS10_Request Constructor * -*************************************************/ +/* +* PKCS10_Request Constructor +*/ PKCS10_Request::PKCS10_Request(DataSource& in) : X509_Object(in, "CERTIFICATE REQUEST/NEW CERTIFICATE REQUEST") { do_decode(); } -/************************************************* -* PKCS10_Request Constructor * -*************************************************/ +/* +* PKCS10_Request Constructor +*/ PKCS10_Request::PKCS10_Request(const std::string& in) : X509_Object(in, "CERTIFICATE REQUEST/NEW CERTIFICATE REQUEST") { do_decode(); } -/************************************************* -* Deocde the CertificateRequestInfo * -*************************************************/ +/* +* Deocde the CertificateRequestInfo +*/ void PKCS10_Request::force_decode() { BER_Decoder cert_req_info(tbs_bits); @@ -87,9 +89,9 @@ void PKCS10_Request::force_decode() throw Decoding_Error("PKCS #10 request: Bad signature detected"); } -/************************************************* -* Handle attributes in a PKCS #10 request * -*************************************************/ +/* +* Handle attributes in a PKCS #10 request +*/ void PKCS10_Request::handle_attribute(const Attribute& attr) { BER_Decoder value(attr.parameters); @@ -116,59 +118,59 @@ void PKCS10_Request::handle_attribute(const Attribute& attr) } } -/************************************************* -* Return the challenge password (if any) * -*************************************************/ +/* +* Return the challenge password (if any) +*/ std::string PKCS10_Request::challenge_password() const { return info.get1("PKCS9.ChallengePassword"); } -/************************************************* -* Return the name of the requestor * -*************************************************/ +/* +* Return the name of the requestor +*/ X509_DN PKCS10_Request::subject_dn() const { return create_dn(info); } -/************************************************* -* Return the public key of the requestor * -*************************************************/ +/* +* Return the public key of the requestor +*/ MemoryVector<byte> PKCS10_Request::raw_public_key() const { DataSource_Memory source(info.get1("X509.Certificate.public_key")); return PEM_Code::decode_check_label(source, "PUBLIC KEY"); } -/************************************************* -* Return the public key of the requestor * -*************************************************/ +/* +* Return the public key of the requestor +*/ Public_Key* PKCS10_Request::subject_public_key() const { DataSource_Memory source(info.get1("X509.Certificate.public_key")); return X509::load_key(source); } -/************************************************* -* Return the alternative names of the requestor * -*************************************************/ +/* +* Return the alternative names of the requestor +*/ AlternativeName PKCS10_Request::subject_alt_name() const { return create_alt_name(info); } -/************************************************* -* Return the key constraints (if any) * -*************************************************/ +/* +* Return the key constraints (if any) +*/ Key_Constraints PKCS10_Request::constraints() const { return Key_Constraints(info.get1_u32bit("X509v3.KeyUsage", NO_CONSTRAINTS)); } -/************************************************* -* Return the extendend key constraints (if any) * -*************************************************/ +/* +* Return the extendend key constraints (if any) +*/ std::vector<OID> PKCS10_Request::ex_constraints() const { std::vector<std::string> oids = info.get("X509v3.ExtendedKeyUsage"); @@ -179,17 +181,17 @@ std::vector<OID> PKCS10_Request::ex_constraints() const return result; } -/************************************************* -* Return is a CA certificate is requested * -*************************************************/ +/* +* Return is a CA certificate is requested +*/ bool PKCS10_Request::is_CA() const { return info.get1_u32bit("X509v3.BasicConstraints.is_ca"); } -/************************************************* -* Return the desired path limit (if any) * -*************************************************/ +/* +* Return the desired path limit (if any) +*/ u32bit PKCS10_Request::path_limit() const { return info.get1_u32bit("X509v3.BasicConstraints.path_constraint", 0); diff --git a/src/cert/x509/pkcs10.h b/src/cert/x509/pkcs10.h index c755bdfad..9b435de52 100644 --- a/src/cert/x509/pkcs10.h +++ b/src/cert/x509/pkcs10.h @@ -1,7 +1,9 @@ -/************************************************* -* PKCS #10 Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* PKCS #10 +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_PKCS10_H__ #define BOTAN_PKCS10_H__ diff --git a/src/cert/x509/x509_ca.cpp b/src/cert/x509/x509_ca.cpp index 2f158e27f..41e314724 100644 --- a/src/cert/x509/x509_ca.cpp +++ b/src/cert/x509/x509_ca.cpp @@ -1,7 +1,9 @@ -/************************************************* -* X.509 Certificate Authority Source File * -* (C) 1999-2008 Jack Lloyd * -*************************************************/ +/* +* X.509 Certificate Authority +* (C) 1999-2008 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/x509_ca.h> #include <botan/x509stor.h> @@ -20,9 +22,9 @@ namespace Botan { -/************************************************* -* Load the certificate and private key * -*************************************************/ +/* +* Load the certificate and private key +*/ X509_CA::X509_CA(const X509_Certificate& c, const Private_Key& key) : cert(c) { @@ -36,9 +38,9 @@ X509_CA::X509_CA(const X509_Certificate& c, signer = choose_sig_format(key, ca_sig_algo); } -/************************************************* -* Sign a PKCS #10 certificate request * -*************************************************/ +/* +* Sign a PKCS #10 certificate request +*/ X509_Certificate X509_CA::sign_request(const PKCS10_Request& req, RandomNumberGenerator& rng, const X509_Time& not_before, @@ -74,9 +76,9 @@ X509_Certificate X509_CA::sign_request(const PKCS10_Request& req, extensions); } -/************************************************* -* Create a new certificate * -*************************************************/ +/* +* Create a new certificate +*/ X509_Certificate X509_CA::make_cert(PK_Signer* signer, RandomNumberGenerator& rng, const AlgorithmIdentifier& sig_algo, @@ -123,9 +125,9 @@ X509_Certificate X509_CA::make_cert(PK_Signer* signer, return X509_Certificate(source); } -/************************************************* -* Create a new, empty CRL * -*************************************************/ +/* +* Create a new, empty CRL +*/ X509_CRL X509_CA::new_crl(RandomNumberGenerator& rng, u32bit next_update) const { @@ -133,9 +135,9 @@ X509_CRL X509_CA::new_crl(RandomNumberGenerator& rng, return make_crl(empty, 1, next_update, rng); } -/************************************************* -* Update a CRL with new entries * -*************************************************/ +/* +* Update a CRL with new entries +*/ X509_CRL X509_CA::update_crl(const X509_CRL& crl, const std::vector<CRL_Entry>& new_revoked, RandomNumberGenerator& rng, @@ -175,9 +177,9 @@ X509_CRL X509_CA::update_crl(const X509_CRL& crl, return make_crl(cert_list, crl.crl_number() + 1, next_update, rng); } -/************************************************* -* Create a CRL * -*************************************************/ +/* +* Create a CRL +*/ X509_CRL X509_CA::make_crl(const std::vector<CRL_Entry>& revoked, u32bit crl_number, u32bit next_update, RandomNumberGenerator& rng) const @@ -220,25 +222,25 @@ X509_CRL X509_CA::make_crl(const std::vector<CRL_Entry>& revoked, return X509_CRL(source); } -/************************************************* -* Return the CA's certificate * -*************************************************/ +/* +* Return the CA's certificate +*/ X509_Certificate X509_CA::ca_certificate() const { return cert; } -/************************************************* -* X509_CA Destructor * -*************************************************/ +/* +* X509_CA Destructor +*/ X509_CA::~X509_CA() { delete signer; } -/************************************************* -* Choose a signing format for the key * -*************************************************/ +/* +* Choose a signing format for the key +*/ PK_Signer* choose_sig_format(const Private_Key& key, AlgorithmIdentifier& sig_algo) { diff --git a/src/cert/x509/x509_ca.h b/src/cert/x509/x509_ca.h index 8f78181b2..ef2a8d134 100644 --- a/src/cert/x509/x509_ca.h +++ b/src/cert/x509/x509_ca.h @@ -1,7 +1,9 @@ -/************************************************* -* X.509 Certificate Authority Header File * -* (C) 1999-2008 Jack Lloyd * -*************************************************/ +/* +* X.509 Certificate Authority +* (C) 1999-2008 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_X509_CA_H__ #define BOTAN_X509_CA_H__ diff --git a/src/cert/x509/x509_crl.cpp b/src/cert/x509/x509_crl.cpp index 6805abef6..f6a344dba 100644 --- a/src/cert/x509/x509_crl.cpp +++ b/src/cert/x509/x509_crl.cpp @@ -1,7 +1,9 @@ -/************************************************* -* X.509 CRL Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* X.509 CRL +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/x509_crl.h> #include <botan/x509_ext.h> @@ -12,27 +14,27 @@ namespace Botan { -/************************************************* -* Load a X.509 CRL * -*************************************************/ +/* +* Load a X.509 CRL +*/ X509_CRL::X509_CRL(DataSource& in, bool touc) : X509_Object(in, "X509 CRL/CRL"), throw_on_unknown_critical(touc) { do_decode(); } -/************************************************* -* Load a X.509 CRL * -*************************************************/ +/* +* Load a X.509 CRL +*/ X509_CRL::X509_CRL(const std::string& in, bool touc) : X509_Object(in, "CRL/X509 CRL"), throw_on_unknown_critical(touc) { do_decode(); } -/************************************************* -* Decode the TBSCertList data * -*************************************************/ +/* +* Decode the TBSCertList data +*/ void X509_CRL::force_decode() { BER_Decoder tbs_crl(tbs_bits); @@ -94,49 +96,49 @@ void X509_CRL::force_decode() tbs_crl.verify_end(); } -/************************************************* -* Return the list of revoked certificates * -*************************************************/ +/* +* Return the list of revoked certificates +*/ std::vector<CRL_Entry> X509_CRL::get_revoked() const { return revoked; } -/************************************************* -* Return the distinguished name of the issuer * -*************************************************/ +/* +* Return the distinguished name of the issuer +*/ X509_DN X509_CRL::issuer_dn() const { return create_dn(info); } -/************************************************* -* Return the key identifier of the issuer * -*************************************************/ +/* +* Return the key identifier of the issuer +*/ MemoryVector<byte> X509_CRL::authority_key_id() const { return info.get1_memvec("X509v3.AuthorityKeyIdentifier"); } -/************************************************* -* Return the CRL number of this CRL * -*************************************************/ +/* +* Return the CRL number of this CRL +*/ u32bit X509_CRL::crl_number() const { return info.get1_u32bit("X509v3.CRLNumber"); } -/************************************************* -* Return the issue data of the CRL * -*************************************************/ +/* +* Return the issue data of the CRL +*/ X509_Time X509_CRL::this_update() const { return info.get1("X509.CRL.start"); } -/************************************************* -* Return the date when a new CRL will be issued * -*************************************************/ +/* +* Return the date when a new CRL will be issued +*/ X509_Time X509_CRL::next_update() const { return info.get1("X509.CRL.end"); diff --git a/src/cert/x509/x509_crl.h b/src/cert/x509/x509_crl.h index dd1ea372e..6caef42cc 100644 --- a/src/cert/x509/x509_crl.h +++ b/src/cert/x509/x509_crl.h @@ -1,7 +1,9 @@ -/************************************************* -* X.509 CRL Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* X.509 CRL +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_X509_CRL_H__ #define BOTAN_X509_CRL_H__ diff --git a/src/cert/x509/x509_ext.cpp b/src/cert/x509/x509_ext.cpp index 54e8be8bd..5e07cbd27 100644 --- a/src/cert/x509/x509_ext.cpp +++ b/src/cert/x509/x509_ext.cpp @@ -1,7 +1,9 @@ -/************************************************* -* X.509 Certificate Extensions Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* X.509 Certificate Extensions +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/x509_ext.h> #include <botan/sha160.h> @@ -15,9 +17,9 @@ namespace Botan { -/************************************************* -* List of X.509 Certificate Extensions * -*************************************************/ +/* +* List of X.509 Certificate Extensions +*/ Certificate_Extension* Extensions::get_extension(const OID& oid) { #define X509_EXTENSION(NAME, TYPE) \ @@ -37,17 +39,17 @@ Certificate_Extension* Extensions::get_extension(const OID& oid) return 0; } -/************************************************* -* Extensions Copy Constructor * -*************************************************/ +/* +* Extensions Copy Constructor +*/ Extensions::Extensions(const Extensions& extensions) : ASN1_Object() { *this = extensions; } -/************************************************* -* Extensions Assignment Operator * -*************************************************/ +/* +* Extensions Assignment Operator +*/ Extensions& Extensions::operator=(const Extensions& other) { for(u32bit j = 0; j != extensions.size(); ++j) @@ -60,17 +62,17 @@ Extensions& Extensions::operator=(const Extensions& other) return (*this); } -/************************************************* -* Return the OID of this extension * -*************************************************/ +/* +* Return the OID of this extension +*/ OID Certificate_Extension::oid_of() const { return OIDS::lookup(oid_name()); } -/************************************************* -* Encode an Extensions list * -*************************************************/ +/* +* Encode an Extensions list +*/ void Extensions::encode_into(DER_Encoder& to_object) const { for(u32bit j = 0; j != extensions.size(); ++j) @@ -104,9 +106,9 @@ void Extensions::encode_into(DER_Encoder& to_object) const } } -/************************************************* -* Decode a list of Extensions * -*************************************************/ +/* +* Decode a list of Extensions +*/ void Extensions::decode_from(BER_Decoder& from_source) { for(u32bit j = 0; j != extensions.size(); ++j) @@ -145,9 +147,9 @@ void Extensions::decode_from(BER_Decoder& from_source) sequence.verify_end(); } -/************************************************* -* Write the extensions to an info store * -*************************************************/ +/* +* Write the extensions to an info store +*/ void Extensions::contents_to(Data_Store& subject_info, Data_Store& issuer_info) const { @@ -155,9 +157,9 @@ void Extensions::contents_to(Data_Store& subject_info, extensions[j]->contents_to(subject_info, issuer_info); } -/************************************************* -* Delete an Extensions list * -*************************************************/ +/* +* Delete an Extensions list +*/ Extensions::~Extensions() { for(u32bit j = 0; j != extensions.size(); ++j) @@ -166,9 +168,9 @@ Extensions::~Extensions() namespace Cert_Extension { -/************************************************* -* Checked accessor for the path_limit member * -*************************************************/ +/* +* Checked accessor for the path_limit member +*/ u32bit Basic_Constraints::get_path_limit() const { if(!is_ca) @@ -176,9 +178,9 @@ u32bit Basic_Constraints::get_path_limit() const return path_limit; } -/************************************************* -* Encode the extension * -*************************************************/ +/* +* Encode the extension +*/ MemoryVector<byte> Basic_Constraints::encode_inner() const { return DER_Encoder() @@ -192,9 +194,9 @@ MemoryVector<byte> Basic_Constraints::encode_inner() const .get_contents(); } -/************************************************* -* Decode the extension * -*************************************************/ +/* +* Decode the extension +*/ void Basic_Constraints::decode_inner(const MemoryRegion<byte>& in) { BER_Decoder(in) @@ -208,18 +210,18 @@ void Basic_Constraints::decode_inner(const MemoryRegion<byte>& in) path_limit = 0; } -/************************************************* -* Return a textual representation * -*************************************************/ +/* +* Return a textual representation +*/ void Basic_Constraints::contents_to(Data_Store& subject, Data_Store&) const { subject.add("X509v3.BasicConstraints.is_ca", (is_ca ? 1 : 0)); subject.add("X509v3.BasicConstraints.path_constraint", path_limit); } -/************************************************* -* Encode the extension * -*************************************************/ +/* +* Encode the extension +*/ MemoryVector<byte> Key_Usage::encode_inner() const { if(constraints == NO_CONSTRAINTS) @@ -238,9 +240,9 @@ MemoryVector<byte> Key_Usage::encode_inner() const return der; } -/************************************************* -* Decode the extension * -*************************************************/ +/* +* Decode the extension +*/ void Key_Usage::decode_inner(const MemoryRegion<byte>& in) { BER_Decoder ber(in); @@ -266,50 +268,50 @@ void Key_Usage::decode_inner(const MemoryRegion<byte>& in) constraints = Key_Constraints(usage); } -/************************************************* -* Return a textual representation * -*************************************************/ +/* +* Return a textual representation +*/ void Key_Usage::contents_to(Data_Store& subject, Data_Store&) const { subject.add("X509v3.KeyUsage", constraints); } -/************************************************* -* Encode the extension * -*************************************************/ +/* +* Encode the extension +*/ MemoryVector<byte> Subject_Key_ID::encode_inner() const { return DER_Encoder().encode(key_id, OCTET_STRING).get_contents(); } -/************************************************* -* Decode the extension * -*************************************************/ +/* +* Decode the extension +*/ void Subject_Key_ID::decode_inner(const MemoryRegion<byte>& in) { BER_Decoder(in).decode(key_id, OCTET_STRING).verify_end(); } -/************************************************* -* Return a textual representation * -*************************************************/ +/* +* Return a textual representation +*/ void Subject_Key_ID::contents_to(Data_Store& subject, Data_Store&) const { subject.add("X509v3.SubjectKeyIdentifier", key_id); } -/************************************************* -* Subject_Key_ID Constructor * -*************************************************/ +/* +* Subject_Key_ID Constructor +*/ Subject_Key_ID::Subject_Key_ID(const MemoryRegion<byte>& pub_key) { SHA_160 hash; key_id = hash.process(pub_key); } -/************************************************* -* Encode the extension * -*************************************************/ +/* +* Encode the extension +*/ MemoryVector<byte> Authority_Key_ID::encode_inner() const { return DER_Encoder() @@ -319,9 +321,9 @@ MemoryVector<byte> Authority_Key_ID::encode_inner() const .get_contents(); } -/************************************************* -* Decode the extension * -*************************************************/ +/* +* Decode the extension +*/ void Authority_Key_ID::decode_inner(const MemoryRegion<byte>& in) { BER_Decoder(in) @@ -329,34 +331,34 @@ void Authority_Key_ID::decode_inner(const MemoryRegion<byte>& in) .decode_optional_string(key_id, OCTET_STRING, 0); } -/************************************************* -* Return a textual representation * -*************************************************/ +/* +* Return a textual representation +*/ void Authority_Key_ID::contents_to(Data_Store&, Data_Store& issuer) const { if(key_id.size()) issuer.add("X509v3.AuthorityKeyIdentifier", key_id); } -/************************************************* -* Encode the extension * -*************************************************/ +/* +* Encode the extension +*/ MemoryVector<byte> Alternative_Name::encode_inner() const { return DER_Encoder().encode(alt_name).get_contents(); } -/************************************************* -* Decode the extension * -*************************************************/ +/* +* Decode the extension +*/ void Alternative_Name::decode_inner(const MemoryRegion<byte>& in) { BER_Decoder(in).decode(alt_name); } -/************************************************* -* Return a textual representation * -*************************************************/ +/* +* Return a textual representation +*/ void Alternative_Name::contents_to(Data_Store& subject_info, Data_Store& issuer_info) const { @@ -372,9 +374,9 @@ void Alternative_Name::contents_to(Data_Store& subject_info, oid_name_str); } -/************************************************* -* Alternative_Name Constructor * -*************************************************/ +/* +* Alternative_Name Constructor +*/ Alternative_Name::Alternative_Name(const AlternativeName& alt_name, const std::string& oid_name_str, const std::string& config_name_str) @@ -384,9 +386,9 @@ Alternative_Name::Alternative_Name(const AlternativeName& alt_name, this->config_name_str = config_name_str; } -/************************************************* -* Subject_Alternative_Name Constructor * -*************************************************/ +/* +* Subject_Alternative_Name Constructor +*/ Subject_Alternative_Name::Subject_Alternative_Name( const AlternativeName& name) : @@ -395,18 +397,18 @@ Subject_Alternative_Name::Subject_Alternative_Name( { } -/************************************************* -* Issuer_Alternative_Name Constructor * -*************************************************/ +/* +* Issuer_Alternative_Name Constructor +*/ Issuer_Alternative_Name::Issuer_Alternative_Name(const AlternativeName& name) : Alternative_Name(name, "X509v3.IssuerAlternativeName", "issuer_alternative_name") { } -/************************************************* -* Encode the extension * -*************************************************/ +/* +* Encode the extension +*/ MemoryVector<byte> Extended_Key_Usage::encode_inner() const { return DER_Encoder() @@ -416,9 +418,9 @@ MemoryVector<byte> Extended_Key_Usage::encode_inner() const .get_contents(); } -/************************************************* -* Decode the extension * -*************************************************/ +/* +* Decode the extension +*/ void Extended_Key_Usage::decode_inner(const MemoryRegion<byte>& in) { BER_Decoder(in) @@ -427,9 +429,9 @@ void Extended_Key_Usage::decode_inner(const MemoryRegion<byte>& in) .end_cons(); } -/************************************************* -* Return a textual representation * -*************************************************/ +/* +* Return a textual representation +*/ void Extended_Key_Usage::contents_to(Data_Store& subject, Data_Store&) const { for(u32bit j = 0; j != oids.size(); ++j) @@ -438,9 +440,9 @@ void Extended_Key_Usage::contents_to(Data_Store& subject, Data_Store&) const namespace { -/************************************************* -* A policy specifier * -*************************************************/ +/* +* A policy specifier +*/ class Policy_Information : public ASN1_Object { public: @@ -464,9 +466,9 @@ class Policy_Information : public ASN1_Object } -/************************************************* -* Encode the extension * -*************************************************/ +/* +* Encode the extension +*/ MemoryVector<byte> Certificate_Policies::encode_inner() const { throw Exception("Certificate_Policies::encode_inner: Bugged"); @@ -480,9 +482,9 @@ MemoryVector<byte> Certificate_Policies::encode_inner() const .get_contents(); } -/************************************************* -* Decode the extension * -*************************************************/ +/* +* Decode the extension +*/ void Certificate_Policies::decode_inner(const MemoryRegion<byte>& in) { std::vector<Policy_Information> policies; @@ -493,18 +495,18 @@ void Certificate_Policies::decode_inner(const MemoryRegion<byte>& in) .end_cons(); } -/************************************************* -* Return a textual representation * -*************************************************/ +/* +* Return a textual representation +*/ void Certificate_Policies::contents_to(Data_Store& info, Data_Store&) const { for(u32bit j = 0; j != oids.size(); ++j) info.add("X509v3.ExtendedKeyUsage", oids[j].as_string()); } -/************************************************* -* Checked accessor for the crl_number member * -*************************************************/ +/* +* Checked accessor for the crl_number member +*/ u32bit CRL_Number::get_crl_number() const { if(!has_value) @@ -512,9 +514,9 @@ u32bit CRL_Number::get_crl_number() const return crl_number; } -/************************************************* -* Copy a CRL_Number extension * -*************************************************/ +/* +* Copy a CRL_Number extension +*/ CRL_Number* CRL_Number::copy() const { if(!has_value) @@ -522,33 +524,33 @@ CRL_Number* CRL_Number::copy() const return new CRL_Number(crl_number); } -/************************************************* -* Encode the extension * -*************************************************/ +/* +* Encode the extension +*/ MemoryVector<byte> CRL_Number::encode_inner() const { return DER_Encoder().encode(crl_number).get_contents(); } -/************************************************* -* Decode the extension * -*************************************************/ +/* +* Decode the extension +*/ void CRL_Number::decode_inner(const MemoryRegion<byte>& in) { BER_Decoder(in).decode(crl_number); } -/************************************************* -* Return a textual representation * -*************************************************/ +/* +* Return a textual representation +*/ void CRL_Number::contents_to(Data_Store& info, Data_Store&) const { info.add("X509v3.CRLNumber", crl_number); } -/************************************************* -* Encode the extension * -*************************************************/ +/* +* Encode the extension +*/ MemoryVector<byte> CRL_ReasonCode::encode_inner() const { return DER_Encoder() @@ -556,9 +558,9 @@ MemoryVector<byte> CRL_ReasonCode::encode_inner() const .get_contents(); } -/************************************************* -* Decode the extension * -*************************************************/ +/* +* Decode the extension +*/ void CRL_ReasonCode::decode_inner(const MemoryRegion<byte>& in) { u32bit reason_code = 0; @@ -566,9 +568,9 @@ void CRL_ReasonCode::decode_inner(const MemoryRegion<byte>& in) reason = static_cast<CRL_Code>(reason_code); } -/************************************************* -* Return a textual representation * -*************************************************/ +/* +* Return a textual representation +*/ void CRL_ReasonCode::contents_to(Data_Store& info, Data_Store&) const { info.add("X509v3.CRLReasonCode", reason); diff --git a/src/cert/x509/x509_ext.h b/src/cert/x509/x509_ext.h index 6b055ea29..108215ee7 100644 --- a/src/cert/x509/x509_ext.h +++ b/src/cert/x509/x509_ext.h @@ -1,7 +1,9 @@ -/************************************************* -* X.509 Certificate Extensions Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* X.509 Certificate Extensions +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_X509_EXTENSIONS_H__ #define BOTAN_X509_EXTENSIONS_H__ @@ -14,9 +16,9 @@ namespace Botan { -/************************************************* -* X.509 Certificate Extension * -*************************************************/ +/* +* X.509 Certificate Extension +*/ class BOTAN_DLL Certificate_Extension { public: @@ -36,9 +38,9 @@ class BOTAN_DLL Certificate_Extension virtual void decode_inner(const MemoryRegion<byte>&) = 0; }; -/************************************************* -* X.509 Certificate Extension List * -*************************************************/ +/* +* X.509 Certificate Extension List +*/ class BOTAN_DLL Extensions : public ASN1_Object { public: @@ -64,9 +66,9 @@ class BOTAN_DLL Extensions : public ASN1_Object namespace Cert_Extension { -/************************************************* -* Basic Constraints Extension * -*************************************************/ +/* +* Basic Constraints Extension +*/ class BOTAN_DLL Basic_Constraints : public Certificate_Extension { public: @@ -90,9 +92,9 @@ class BOTAN_DLL Basic_Constraints : public Certificate_Extension u32bit path_limit; }; -/************************************************* -* Key Usage Constraints Extension * -*************************************************/ +/* +* Key Usage Constraints Extension +*/ class BOTAN_DLL Key_Usage : public Certificate_Extension { public: @@ -113,9 +115,9 @@ class BOTAN_DLL Key_Usage : public Certificate_Extension Key_Constraints constraints; }; -/************************************************* -* Subject Key Identifier Extension * -*************************************************/ +/* +* Subject Key Identifier Extension +*/ class BOTAN_DLL Subject_Key_ID : public Certificate_Extension { public: @@ -137,9 +139,9 @@ class BOTAN_DLL Subject_Key_ID : public Certificate_Extension MemoryVector<byte> key_id; }; -/************************************************* -* Authority Key Identifier Extension * -*************************************************/ +/* +* Authority Key Identifier Extension +*/ class BOTAN_DLL Authority_Key_ID : public Certificate_Extension { public: @@ -161,9 +163,9 @@ class BOTAN_DLL Authority_Key_ID : public Certificate_Extension MemoryVector<byte> key_id; }; -/************************************************* -* Alternative Name Extension Base Class * -*************************************************/ +/* +* Alternative Name Extension Base Class +*/ class BOTAN_DLL Alternative_Name : public Certificate_Extension { public: @@ -187,9 +189,9 @@ class BOTAN_DLL Alternative_Name : public Certificate_Extension AlternativeName alt_name; }; -/************************************************* -* Subject Alternative Name Extension * -*************************************************/ +/* +* Subject Alternative Name Extension +*/ class BOTAN_DLL Subject_Alternative_Name : public Alternative_Name { public: @@ -199,9 +201,9 @@ class BOTAN_DLL Subject_Alternative_Name : public Alternative_Name Subject_Alternative_Name(const AlternativeName& = AlternativeName()); }; -/************************************************* -* Issuer Alternative Name Extension * -*************************************************/ +/* +* Issuer Alternative Name Extension +*/ class BOTAN_DLL Issuer_Alternative_Name : public Alternative_Name { public: @@ -211,9 +213,9 @@ class BOTAN_DLL Issuer_Alternative_Name : public Alternative_Name Issuer_Alternative_Name(const AlternativeName& = AlternativeName()); }; -/************************************************* -* Extended Key Usage Extension * -*************************************************/ +/* +* Extended Key Usage Extension +*/ class BOTAN_DLL Extended_Key_Usage : public Certificate_Extension { public: @@ -235,9 +237,9 @@ class BOTAN_DLL Extended_Key_Usage : public Certificate_Extension std::vector<OID> oids; }; -/************************************************* -* Certificate Policies Extension * -*************************************************/ +/* +* Certificate Policies Extension +*/ class BOTAN_DLL Certificate_Policies : public Certificate_Extension { public: @@ -260,9 +262,9 @@ class BOTAN_DLL Certificate_Policies : public Certificate_Extension std::vector<OID> oids; }; -/************************************************* -* CRL Number Extension * -*************************************************/ +/* +* CRL Number Extension +*/ class BOTAN_DLL CRL_Number : public Certificate_Extension { public: @@ -285,9 +287,9 @@ class BOTAN_DLL CRL_Number : public Certificate_Extension u32bit crl_number; }; -/************************************************* -* CRL Entry Reason Code Extension * -*************************************************/ +/* +* CRL Entry Reason Code Extension +*/ class BOTAN_DLL CRL_ReasonCode : public Certificate_Extension { public: diff --git a/src/cert/x509/x509_obj.cpp b/src/cert/x509/x509_obj.cpp index e78790949..31b4a309f 100644 --- a/src/cert/x509/x509_obj.cpp +++ b/src/cert/x509/x509_obj.cpp @@ -1,7 +1,9 @@ -/************************************************* -* X.509 SIGNED Object Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* X.509 SIGNED Object +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/x509_obj.h> #include <botan/x509_key.h> @@ -16,26 +18,26 @@ namespace Botan { -/************************************************* -* Create a generic X.509 object * -*************************************************/ +/* +* Create a generic X.509 object +*/ X509_Object::X509_Object(DataSource& stream, const std::string& labels) { init(stream, labels); } -/************************************************* -* Createa a generic X.509 object * -*************************************************/ +/* +* Createa a generic X.509 object +*/ X509_Object::X509_Object(const std::string& file, const std::string& labels) { DataSource_Stream stream(file, true); init(stream, labels); } -/************************************************* -* Read a PEM or BER X.509 object * -*************************************************/ +/* +* Read a PEM or BER X.509 object +*/ void X509_Object::init(DataSource& in, const std::string& labels) { PEM_labels_allowed = split_on(labels, '/'); @@ -65,9 +67,9 @@ void X509_Object::init(DataSource& in, const std::string& labels) } } -/************************************************* -* Read a BER encoded X.509 object * -*************************************************/ +/* +* Read a BER encoded X.509 object +*/ void X509_Object::decode_info(DataSource& source) { BER_Decoder(source) @@ -81,9 +83,9 @@ void X509_Object::decode_info(DataSource& source) .end_cons(); } -/************************************************* -* Return a BER or PEM encoded X.509 object * -*************************************************/ +/* +* Return a BER or PEM encoded X.509 object +*/ void X509_Object::encode(Pipe& out, X509_Encoding encoding) const { SecureVector<byte> der = DER_Encoder() @@ -102,9 +104,9 @@ void X509_Object::encode(Pipe& out, X509_Encoding encoding) const out.write(der); } -/************************************************* -* Return a BER encoded X.509 object * -*************************************************/ +/* +* Return a BER encoded X.509 object +*/ SecureVector<byte> X509_Object::BER_encode() const { Pipe ber; @@ -114,9 +116,9 @@ SecureVector<byte> X509_Object::BER_encode() const return ber.read_all(); } -/************************************************* -* Return a PEM encoded X.509 object * -*************************************************/ +/* +* Return a PEM encoded X.509 object +*/ std::string X509_Object::PEM_encode() const { Pipe pem; @@ -126,33 +128,33 @@ std::string X509_Object::PEM_encode() const return pem.read_all_as_string(); } -/************************************************* -* Return the TBS data * -*************************************************/ +/* +* Return the TBS data +*/ SecureVector<byte> X509_Object::tbs_data() const { return ASN1::put_in_sequence(tbs_bits); } -/************************************************* -* Return the signature of this object * -*************************************************/ +/* +* Return the signature of this object +*/ SecureVector<byte> X509_Object::signature() const { return sig; } -/************************************************* -* Return the algorithm used to sign this object * -*************************************************/ +/* +* Return the algorithm used to sign this object +*/ AlgorithmIdentifier X509_Object::signature_algorithm() const { return sig_algo; } -/************************************************* -* Check the signature on an object * -*************************************************/ +/* +* Check the signature on an object +*/ bool X509_Object::check_signature(Public_Key& pub_key) const { try { @@ -191,9 +193,9 @@ bool X509_Object::check_signature(Public_Key& pub_key) const } } -/************************************************* -* Apply the X.509 SIGNED macro * -*************************************************/ +/* +* Apply the X.509 SIGNED macro +*/ MemoryVector<byte> X509_Object::make_signed(PK_Signer* signer, RandomNumberGenerator& rng, const AlgorithmIdentifier& algo, @@ -208,9 +210,9 @@ MemoryVector<byte> X509_Object::make_signed(PK_Signer* signer, .get_contents(); } -/************************************************* -* Try to decode the actual information * -*************************************************/ +/* +* Try to decode the actual information +*/ void X509_Object::do_decode() { try { diff --git a/src/cert/x509/x509_obj.h b/src/cert/x509/x509_obj.h index d80560eb2..c7f92fa9d 100644 --- a/src/cert/x509/x509_obj.h +++ b/src/cert/x509/x509_obj.h @@ -1,7 +1,9 @@ -/************************************************* -* X.509 SIGNED Object Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* X.509 SIGNED Object +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_X509_OBJECT_H__ #define BOTAN_X509_OBJECT_H__ diff --git a/src/cert/x509/x509cert.cpp b/src/cert/x509/x509cert.cpp index b24e6a036..ac5839fb6 100644 --- a/src/cert/x509/x509cert.cpp +++ b/src/cert/x509/x509cert.cpp @@ -1,7 +1,9 @@ -/************************************************* -* X.509 Certificates Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* X.509 Certificates +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/x509cert.h> #include <botan/x509_ext.h> @@ -18,9 +20,9 @@ namespace Botan { namespace { -/************************************************* -* Lookup each OID in the vector * -*************************************************/ +/* +* Lookup each OID in the vector +*/ std::vector<std::string> lookup_oids(const std::vector<std::string>& in) { std::vector<std::string> out; @@ -36,9 +38,9 @@ std::vector<std::string> lookup_oids(const std::vector<std::string>& in) } -/************************************************* -* X509_Certificate Constructor * -*************************************************/ +/* +* X509_Certificate Constructor +*/ X509_Certificate::X509_Certificate(DataSource& in) : X509_Object(in, "CERTIFICATE/X509 CERTIFICATE") { @@ -46,9 +48,9 @@ X509_Certificate::X509_Certificate(DataSource& in) : do_decode(); } -/************************************************* -* X509_Certificate Constructor * -*************************************************/ +/* +* X509_Certificate Constructor +*/ X509_Certificate::X509_Certificate(const std::string& in) : X509_Object(in, "CERTIFICATE/X509 CERTIFICATE") { @@ -56,9 +58,9 @@ X509_Certificate::X509_Certificate(const std::string& in) : do_decode(); } -/************************************************* -* Decode the TBSCertificate data * -*************************************************/ +/* +* Decode the TBSCertificate data +*/ void X509_Certificate::force_decode() { u32bit version; @@ -141,60 +143,60 @@ void X509_Certificate::force_decode() } } -/************************************************* -* Return the X.509 version in use * -*************************************************/ +/* +* Return the X.509 version in use +*/ u32bit X509_Certificate::x509_version() const { return (subject.get1_u32bit("X509.Certificate.version") + 1); } -/************************************************* -* Return the time this cert becomes valid * -*************************************************/ +/* +* Return the time this cert becomes valid +*/ std::string X509_Certificate::start_time() const { return subject.get1("X509.Certificate.start"); } -/************************************************* -* Return the time this cert becomes invalid * -*************************************************/ +/* +* Return the time this cert becomes invalid +*/ std::string X509_Certificate::end_time() const { return subject.get1("X509.Certificate.end"); } -/************************************************* -* Return information about the subject * -*************************************************/ +/* +* Return information about the subject +*/ std::vector<std::string> X509_Certificate::subject_info(const std::string& what) const { return subject.get(X509_DN::deref_info_field(what)); } -/************************************************* -* Return information about the issuer * -*************************************************/ +/* +* Return information about the issuer +*/ std::vector<std::string> X509_Certificate::issuer_info(const std::string& what) const { return issuer.get(X509_DN::deref_info_field(what)); } -/************************************************* -* Return the public key in this certificate * -*************************************************/ +/* +* Return the public key in this certificate +*/ Public_Key* X509_Certificate::subject_public_key() const { DataSource_Memory source(subject.get1("X509.Certificate.public_key")); return X509::load_key(source); } -/************************************************* -* Check if the certificate is for a CA * -*************************************************/ +/* +* Check if the certificate is for a CA +*/ bool X509_Certificate::is_CA_cert() const { if(!subject.get1_u32bit("X509v3.BasicConstraints.is_ca")) @@ -204,82 +206,82 @@ bool X509_Certificate::is_CA_cert() const return false; } -/************************************************* -* Return the path length constraint * -*************************************************/ +/* +* Return the path length constraint +*/ u32bit X509_Certificate::path_limit() const { return subject.get1_u32bit("X509v3.BasicConstraints.path_constraint", 0); } -/************************************************* -* Return the key usage constraints * -*************************************************/ +/* +* Return the key usage constraints +*/ Key_Constraints X509_Certificate::constraints() const { return Key_Constraints(subject.get1_u32bit("X509v3.KeyUsage", NO_CONSTRAINTS)); } -/************************************************* -* Return the list of extended key usage OIDs * -*************************************************/ +/* +* Return the list of extended key usage OIDs +*/ std::vector<std::string> X509_Certificate::ex_constraints() const { return lookup_oids(subject.get("X509v3.ExtendedKeyUsage")); } -/************************************************* -* Return the list of certificate policies * -*************************************************/ +/* +* Return the list of certificate policies +*/ std::vector<std::string> X509_Certificate::policies() const { return lookup_oids(subject.get("X509v3.CertificatePolicies")); } -/************************************************* -* Return the authority key id * -*************************************************/ +/* +* Return the authority key id +*/ MemoryVector<byte> X509_Certificate::authority_key_id() const { return issuer.get1_memvec("X509v3.AuthorityKeyIdentifier"); } -/************************************************* -* Return the subject key id * -*************************************************/ +/* +* Return the subject key id +*/ MemoryVector<byte> X509_Certificate::subject_key_id() const { return subject.get1_memvec("X509v3.SubjectKeyIdentifier"); } -/************************************************* -* Return the certificate serial number * -*************************************************/ +/* +* Return the certificate serial number +*/ MemoryVector<byte> X509_Certificate::serial_number() const { return subject.get1_memvec("X509.Certificate.serial"); } -/************************************************* -* Return the distinguished name of the issuer * -*************************************************/ +/* +* Return the distinguished name of the issuer +*/ X509_DN X509_Certificate::issuer_dn() const { return create_dn(issuer); } -/************************************************* -* Return the distinguished name of the subject * -*************************************************/ +/* +* Return the distinguished name of the subject +*/ X509_DN X509_Certificate::subject_dn() const { return create_dn(subject); } -/************************************************* -* Compare two certificates for equality * -*************************************************/ +/* +* Compare two certificates for equality +*/ bool X509_Certificate::operator==(const X509_Certificate& other) const { return (sig == other.sig && @@ -289,17 +291,17 @@ bool X509_Certificate::operator==(const X509_Certificate& other) const subject == other.subject); } -/************************************************* -* X.509 Certificate Comparison * -*************************************************/ +/* +* X.509 Certificate Comparison +*/ bool operator!=(const X509_Certificate& cert1, const X509_Certificate& cert2) { return !(cert1 == cert2); } -/************************************************* -* Create and populate a X509_DN * -*************************************************/ +/* +* Create and populate a X509_DN +*/ X509_DN create_dn(const Data_Store& info) { class DN_Matcher : public Data_Store::Matcher @@ -325,9 +327,9 @@ X509_DN create_dn(const Data_Store& info) return dn; } -/************************************************* -* Create and populate an AlternativeName * -*************************************************/ +/* +* Create and populate an AlternativeName +*/ AlternativeName create_alt_name(const Data_Store& info) { class AltName_Matcher : public Data_Store::Matcher diff --git a/src/cert/x509/x509cert.h b/src/cert/x509/x509cert.h index c02085dcb..4a9d11f7f 100644 --- a/src/cert/x509/x509cert.h +++ b/src/cert/x509/x509cert.h @@ -1,7 +1,9 @@ -/************************************************* -* X.509 Certificates Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* X.509 Certificates +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_X509_CERTS_H__ #define BOTAN_X509_CERTS_H__ @@ -172,9 +174,9 @@ class BOTAN_DLL X509_Certificate : public X509_Object */ BOTAN_DLL bool operator!=(const X509_Certificate&, const X509_Certificate&); -/************************************************* -* Data Store Extraction Operations * -*************************************************/ +/* +* Data Store Extraction Operations +*/ BOTAN_DLL X509_DN create_dn(const Data_Store&); BOTAN_DLL AlternativeName create_alt_name(const Data_Store&); diff --git a/src/cert/x509/x509find.cpp b/src/cert/x509/x509find.cpp index 83d02449d..257367da9 100644 --- a/src/cert/x509/x509find.cpp +++ b/src/cert/x509/x509find.cpp @@ -1,7 +1,9 @@ -/************************************************* -* X.509 Certificate Store Searching Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* X.509 Certificate Store Searching +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/x509find.h> #include <botan/charset.h> @@ -11,9 +13,9 @@ namespace Botan { namespace { -/************************************************* -* Compare based on case-insensive substrings * -*************************************************/ +/* +* Compare based on case-insensive substrings +*/ bool substring_match(const std::string& searching_for, const std::string& found) { @@ -23,9 +25,9 @@ bool substring_match(const std::string& searching_for, return false; } -/************************************************* -* Compare based on case-insensive match * -*************************************************/ +/* +* Compare based on case-insensive match +*/ bool ignore_case(const std::string& searching_for, const std::string& found) { if(searching_for.size() != found.size()) @@ -37,9 +39,9 @@ bool ignore_case(const std::string& searching_for, const std::string& found) } -/************************************************* -* Search based on the contents of a DN entry * -*************************************************/ +/* +* Search based on the contents of a DN entry +*/ bool DN_Check::match(const X509_Certificate& cert) const { std::vector<std::string> info = cert.subject_info(dn_entry); @@ -50,9 +52,9 @@ bool DN_Check::match(const X509_Certificate& cert) const return false; } -/************************************************* -* DN_Check Constructor * -*************************************************/ +/* +* DN_Check Constructor +*/ DN_Check::DN_Check(const std::string& dn_entry, const std::string& looking_for, compare_fn func) { @@ -61,9 +63,9 @@ DN_Check::DN_Check(const std::string& dn_entry, const std::string& looking_for, compare = func; } -/************************************************* -* DN_Check Constructor * -*************************************************/ +/* +* DN_Check Constructor +*/ DN_Check::DN_Check(const std::string& dn_entry, const std::string& looking_for, Search_Type method) { @@ -78,9 +80,9 @@ DN_Check::DN_Check(const std::string& dn_entry, const std::string& looking_for, throw Invalid_Argument("Unknown method argument to DN_Check()"); } -/************************************************* -* Match by issuer and serial number * -*************************************************/ +/* +* Match by issuer and serial number +*/ bool IandS_Match::match(const X509_Certificate& cert) const { if(cert.serial_number() != serial) @@ -88,9 +90,9 @@ bool IandS_Match::match(const X509_Certificate& cert) const return (cert.issuer_dn() == issuer); } -/************************************************* -* IandS_Match Constructor * -*************************************************/ +/* +* IandS_Match Constructor +*/ IandS_Match::IandS_Match(const X509_DN& issuer, const MemoryRegion<byte>& serial) { @@ -98,9 +100,9 @@ IandS_Match::IandS_Match(const X509_DN& issuer, this->serial = serial; } -/************************************************* -* Match by subject key identifier * -*************************************************/ +/* +* Match by subject key identifier +*/ bool SKID_Match::match(const X509_Certificate& cert) const { return (cert.subject_key_id() == skid); diff --git a/src/cert/x509/x509find.h b/src/cert/x509/x509find.h index 65781199f..a7a84c7a5 100644 --- a/src/cert/x509/x509find.h +++ b/src/cert/x509/x509find.h @@ -1,7 +1,9 @@ -/************************************************* -* X.509 Certificate Store Searching Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* X.509 Certificate Store Searching +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_X509_CERT_STORE_SEARCH_H__ #define BOTAN_X509_CERT_STORE_SEARCH_H__ @@ -10,9 +12,9 @@ namespace Botan { -/************************************************* -* Search based on the contents of a DN entry * -*************************************************/ +/* +* Search based on the contents of a DN entry +*/ class BOTAN_DLL DN_Check : public X509_Store::Search_Func { public: @@ -28,9 +30,9 @@ class BOTAN_DLL DN_Check : public X509_Store::Search_Func compare_fn compare; }; -/************************************************* -* Search for a certificate by issuer/serial * -*************************************************/ +/* +* Search for a certificate by issuer/serial +*/ class BOTAN_DLL IandS_Match : public X509_Store::Search_Func { public: @@ -41,9 +43,9 @@ class BOTAN_DLL IandS_Match : public X509_Store::Search_Func MemoryVector<byte> serial; }; -/************************************************* -* Search for a certificate by subject keyid * -*************************************************/ +/* +* Search for a certificate by subject keyid +*/ class BOTAN_DLL SKID_Match : public X509_Store::Search_Func { public: diff --git a/src/cert/x509/x509opt.cpp b/src/cert/x509/x509opt.cpp index 716884ed5..de9d589a3 100644 --- a/src/cert/x509/x509opt.cpp +++ b/src/cert/x509/x509opt.cpp @@ -1,7 +1,9 @@ -/************************************************* -* X.509 Certificate Options Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* X.509 Certificate Options +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/x509self.h> #include <botan/util.h> @@ -11,58 +13,58 @@ namespace Botan { -/************************************************* -* Set when the certificate should become valid * -*************************************************/ +/* +* Set when the certificate should become valid +*/ void X509_Cert_Options::not_before(const std::string& time_string) { start = X509_Time(time_string); } -/************************************************* -* Set when the certificate should expire * -*************************************************/ +/* +* Set when the certificate should expire +*/ void X509_Cert_Options::not_after(const std::string& time_string) { end = X509_Time(time_string); } -/************************************************* -* Set key constraint information * -*************************************************/ +/* +* Set key constraint information +*/ void X509_Cert_Options::add_constraints(Key_Constraints usage) { constraints = usage; } -/************************************************* -* Set key constraint information * -*************************************************/ +/* +* Set key constraint information +*/ void X509_Cert_Options::add_ex_constraint(const OID& oid) { ex_constraints.push_back(oid); } -/************************************************* -* Set key constraint information * -*************************************************/ +/* +* Set key constraint information +*/ void X509_Cert_Options::add_ex_constraint(const std::string& oid_str) { ex_constraints.push_back(OIDS::lookup(oid_str)); } -/************************************************* -* Mark this certificate for CA usage * -*************************************************/ +/* +* Mark this certificate for CA usage +*/ void X509_Cert_Options::CA_key(u32bit limit) { is_CA = true; path_limit = limit; } -/************************************************* -* Do basic sanity checks * -*************************************************/ +/* +* Do basic sanity checks +*/ void X509_Cert_Options::sanity_check() const { if(common_name == "" || country == "") @@ -73,9 +75,9 @@ void X509_Cert_Options::sanity_check() const throw Encoding_Error("X509_Cert_Options: invalid time constraints"); } -/************************************************* -* Initialize the certificate options * -*************************************************/ +/* +* Initialize the certificate options +*/ X509_Cert_Options::X509_Cert_Options(const std::string& initial_opts, u32bit expiration_time_in_seconds) { diff --git a/src/cert/x509/x509self.cpp b/src/cert/x509/x509self.cpp index 6c3baae9b..8afb22a7e 100644 --- a/src/cert/x509/x509self.cpp +++ b/src/cert/x509/x509self.cpp @@ -1,7 +1,9 @@ -/************************************************* -* PKCS #10/Self Signed Cert Creation Source File * -* (C) 1999-2008 Jack Lloyd * -*************************************************/ +/* +* PKCS #10/Self Signed Cert Creation +* (C) 1999-2008 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/x509self.h> #include <botan/x509_ext.h> @@ -16,9 +18,9 @@ namespace Botan { namespace { -/************************************************* -* Shared setup for self-signed items * -*************************************************/ +/* +* Shared setup for self-signed items +*/ MemoryVector<byte> shared_setup(const X509_Cert_Options& opts, const Private_Key& key) { @@ -36,9 +38,9 @@ MemoryVector<byte> shared_setup(const X509_Cert_Options& opts, return key_encoder.read_all(); } -/************************************************* -* Load information from the X509_Cert_Options * -*************************************************/ +/* +* Load information from the X509_Cert_Options +*/ void load_info(const X509_Cert_Options& opts, X509_DN& subject_dn, AlternativeName& subject_alt) { @@ -58,9 +60,9 @@ void load_info(const X509_Cert_Options& opts, X509_DN& subject_dn, namespace X509 { -/************************************************* -* Create a new self-signed X.509 certificate * -*************************************************/ +/* +* Create a new self-signed X.509 certificate +*/ X509_Certificate create_self_signed_cert(const X509_Cert_Options& opts, const Private_Key& key, RandomNumberGenerator& rng) @@ -96,9 +98,9 @@ X509_Certificate create_self_signed_cert(const X509_Cert_Options& opts, extensions); } -/************************************************* -* Create a PKCS #10 certificate request * -*************************************************/ +/* +* Create a PKCS #10 certificate request +*/ PKCS10_Request create_cert_req(const X509_Cert_Options& opts, const Private_Key& key, RandomNumberGenerator& rng) diff --git a/src/cert/x509/x509self.h b/src/cert/x509/x509self.h index 8e912ae83..bd3e29179 100644 --- a/src/cert/x509/x509self.h +++ b/src/cert/x509/x509self.h @@ -1,7 +1,9 @@ -/************************************************* -* X.509 Self-Signed Certificate Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* X.509 Self-Signed Certificate +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_X509_SELF_H__ #define BOTAN_X509_SELF_H__ diff --git a/src/cert/x509/x509stor.cpp b/src/cert/x509/x509stor.cpp index f050b33b1..cb61bc2d2 100644 --- a/src/cert/x509/x509stor.cpp +++ b/src/cert/x509/x509stor.cpp @@ -1,7 +1,9 @@ -/************************************************* -* X.509 Certificate Store Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* X.509 Certificate Store +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/x509stor.h> #include <botan/parsing.h> @@ -16,9 +18,9 @@ namespace Botan { namespace { -/************************************************* -* Do a validity check * -*************************************************/ +/* +* Do a validity check +*/ s32bit validity_check(const X509_Time& start, const X509_Time& end, u64bit current_time, u32bit slack) { @@ -31,9 +33,9 @@ s32bit validity_check(const X509_Time& start, const X509_Time& end, return VALID_TIME; } -/************************************************* -* Compare the value of unique ID fields * -*************************************************/ +/* +* Compare the value of unique ID fields +*/ bool compare_ids(const MemoryVector<byte>& id1, const MemoryVector<byte>& id2) { @@ -42,9 +44,9 @@ bool compare_ids(const MemoryVector<byte>& id1, return (id1 == id2); } -/************************************************* -* Check a particular usage restriction * -*************************************************/ +/* +* Check a particular usage restriction +*/ bool check_usage(const X509_Certificate& cert, X509_Store::Cert_Usage usage, X509_Store::Cert_Usage check_for, Key_Constraints constraints) { @@ -57,9 +59,9 @@ bool check_usage(const X509_Certificate& cert, X509_Store::Cert_Usage usage, return false; } -/************************************************* -* Check a particular usage restriction * -*************************************************/ +/* +* Check a particular usage restriction +*/ bool check_usage(const X509_Certificate& cert, X509_Store::Cert_Usage usage, X509_Store::Cert_Usage check_for, const std::string& usage_oid) @@ -76,9 +78,9 @@ bool check_usage(const X509_Certificate& cert, X509_Store::Cert_Usage usage, usage_oid); } -/************************************************* -* Check the usage restrictions * -*************************************************/ +/* +* Check the usage restrictions +*/ X509_Code usage_check(const X509_Certificate& cert, X509_Store::Cert_Usage usage) { @@ -106,9 +108,9 @@ X509_Code usage_check(const X509_Certificate& cert, } -/************************************************* -* Define equality for revocation data * -*************************************************/ +/* +* Define equality for revocation data +*/ bool X509_Store::CRL_Data::operator==(const CRL_Data& other) const { if(issuer != other.issuer) @@ -118,17 +120,17 @@ bool X509_Store::CRL_Data::operator==(const CRL_Data& other) const return compare_ids(auth_key_id, other.auth_key_id); } -/************************************************* -* Define inequality for revocation data * -*************************************************/ +/* +* Define inequality for revocation data +*/ bool X509_Store::CRL_Data::operator!=(const CRL_Data& other) const { return !((*this) == other); } -/************************************************* -* Define an ordering for revocation data * -*************************************************/ +/* +* Define an ordering for revocation data +*/ bool X509_Store::CRL_Data::operator<(const X509_Store::CRL_Data& other) const { if(*this == other) @@ -164,9 +166,9 @@ bool X509_Store::CRL_Data::operator<(const X509_Store::CRL_Data& other) const return (issuer < other.issuer); } -/************************************************* -* X509_Store Constructor * -*************************************************/ +/* +* X509_Store Constructor +*/ X509_Store::X509_Store(u32bit slack, u32bit cache_timeout) { revoked_info_valid = true; @@ -175,9 +177,9 @@ X509_Store::X509_Store(u32bit slack, u32bit cache_timeout) time_slack = slack; } -/************************************************* -* X509_Store Copy Constructor * -*************************************************/ +/* +* X509_Store Copy Constructor +*/ X509_Store::X509_Store(const X509_Store& other) { certs = other.certs; @@ -188,18 +190,18 @@ X509_Store::X509_Store(const X509_Store& other) time_slack = other.time_slack; } -/************************************************* -* X509_Store Destructor * -*************************************************/ +/* +* X509_Store Destructor +*/ X509_Store::~X509_Store() { for(u32bit j = 0; j != stores.size(); ++j) delete stores[j]; } -/************************************************* -* Verify a certificate's authenticity * -*************************************************/ +/* +* Verify a certificate's authenticity +*/ X509_Code X509_Store::validate_cert(const X509_Certificate& cert, Cert_Usage cert_usage) { @@ -244,9 +246,9 @@ X509_Code X509_Store::validate_cert(const X509_Certificate& cert, return usage_check(cert, cert_usage); } -/************************************************* -* Find this certificate * -*************************************************/ +/* +* Find this certificate +*/ u32bit X509_Store::find_cert(const X509_DN& subject_dn, const MemoryRegion<byte>& subject_key_id) const { @@ -260,9 +262,9 @@ u32bit X509_Store::find_cert(const X509_DN& subject_dn, return NO_CERT_FOUND; } -/************************************************* -* Find the parent of this certificate * -*************************************************/ +/* +* Find the parent of this certificate +*/ u32bit X509_Store::find_parent_of(const X509_Certificate& cert) { const X509_DN issuer_dn = cert.issuer_dn(); @@ -291,9 +293,9 @@ u32bit X509_Store::find_parent_of(const X509_Certificate& cert) return NO_CERT_FOUND; } -/************************************************* -* Construct a chain of certificate relationships * -*************************************************/ +/* +* Construct a chain of certificate relationships +*/ X509_Code X509_Store::construct_cert_chain(const X509_Certificate& end_cert, std::vector<u32bit>& indexes, bool need_full_chain) @@ -354,9 +356,9 @@ X509_Code X509_Store::construct_cert_chain(const X509_Certificate& end_cert, return VERIFIED; } -/************************************************* -* Check the CAs signature on a certificate * -*************************************************/ +/* +* Check the CAs signature on a certificate +*/ X509_Code X509_Store::check_sig(const Cert_Info& cert_info, const Cert_Info& ca_cert_info) const { @@ -373,9 +375,9 @@ X509_Code X509_Store::check_sig(const Cert_Info& cert_info, return verify_code; } -/************************************************* -* Check a CA's signature * -*************************************************/ +/* +* Check a CA's signature +*/ X509_Code X509_Store::check_sig(const X509_Object& object, Public_Key* key) { std::auto_ptr<Public_Key> pub_key(key); @@ -422,9 +424,9 @@ X509_Code X509_Store::check_sig(const X509_Object& object, Public_Key* key) return UNKNOWN_X509_ERROR; } -/************************************************* -* Recompute the revocation status of the certs * -*************************************************/ +/* +* Recompute the revocation status of the certs +*/ void X509_Store::recompute_revoked_info() const { if(revoked_info_valid) @@ -443,9 +445,9 @@ void X509_Store::recompute_revoked_info() const revoked_info_valid = true; } -/************************************************* -* Check if a certificate is revoked * -*************************************************/ +/* +* Check if a certificate is revoked +*/ bool X509_Store::is_revoked(const X509_Certificate& cert) const { CRL_Data revoked_info; @@ -458,9 +460,9 @@ bool X509_Store::is_revoked(const X509_Certificate& cert) const return false; } -/************************************************* -* Retrieve all the certificates in the store * -*************************************************/ +/* +* Retrieve all the certificates in the store +*/ std::vector<X509_Certificate> X509_Store::get_certs(const Search_Func& search) const { @@ -473,9 +475,9 @@ X509_Store::get_certs(const Search_Func& search) const return found_certs; } -/************************************************* -* Construct a path back to a root for this cert * -*************************************************/ +/* +* Construct a path back to a root for this cert +*/ std::vector<X509_Certificate> X509_Store::get_cert_chain(const X509_Certificate& cert) { @@ -491,17 +493,17 @@ X509_Store::get_cert_chain(const X509_Certificate& cert) return result; } -/************************************************* -* Add a certificate store to the list of stores * -*************************************************/ +/* +* Add a certificate store to the list of stores +*/ void X509_Store::add_new_certstore(Certificate_Store* certstore) { stores.push_back(certstore); } -/************************************************* -* Add a certificate to the store * -*************************************************/ +/* +* Add a certificate to the store +*/ void X509_Store::add_cert(const X509_Certificate& cert, bool trusted) { if(trusted && !cert.is_self_signed()) @@ -524,9 +526,9 @@ void X509_Store::add_cert(const X509_Certificate& cert, bool trusted) } } -/************************************************* -* Add one or more certificates to the store * -*************************************************/ +/* +* Add one or more certificates to the store +*/ void X509_Store::do_add_certs(DataSource& source, bool trusted) { while(!source.end_of_data()) @@ -540,25 +542,25 @@ void X509_Store::do_add_certs(DataSource& source, bool trusted) } } -/************************************************* -* Add one or more certificates to the store * -*************************************************/ +/* +* Add one or more certificates to the store +*/ void X509_Store::add_certs(DataSource& source) { do_add_certs(source, false); } -/************************************************* -* Add one or more certificates to the store * -*************************************************/ +/* +* Add one or more certificates to the store +*/ void X509_Store::add_trusted_certs(DataSource& source) { do_add_certs(source, true); } -/************************************************* -* Add one or more certificates to the store * -*************************************************/ +/* +* Add one or more certificates to the store +*/ X509_Code X509_Store::add_crl(const X509_CRL& crl) { s32bit time_check = validity_check(crl.this_update(), crl.next_update(), @@ -622,9 +624,9 @@ X509_Code X509_Store::add_crl(const X509_CRL& crl) return VERIFIED; } -/************************************************* -* PEM encode the set of certificates * -*************************************************/ +/* +* PEM encode the set of certificates +*/ std::string X509_Store::PEM_encode() const { std::string cert_store; @@ -633,9 +635,9 @@ std::string X509_Store::PEM_encode() const return cert_store; } -/************************************************* -* Create a Cert_Info structure * -*************************************************/ +/* +* Create a Cert_Info structure +*/ X509_Store::Cert_Info::Cert_Info(const X509_Certificate& c, bool t) : cert(c), trusted(t) { @@ -644,9 +646,9 @@ X509_Store::Cert_Info::Cert_Info(const X509_Certificate& c, last_checked = 0; } -/************************************************* -* Return the verification results * -*************************************************/ +/* +* Return the verification results +*/ X509_Code X509_Store::Cert_Info::verify_result() const { if(!checked) @@ -654,9 +656,9 @@ X509_Code X509_Store::Cert_Info::verify_result() const return result; } -/************************************************* -* Set the verification results * -*************************************************/ +/* +* Set the verification results +*/ void X509_Store::Cert_Info::set_result(X509_Code code) const { result = code; @@ -664,17 +666,17 @@ void X509_Store::Cert_Info::set_result(X509_Code code) const checked = true; } -/************************************************* -* Check if this certificate can be trusted * -*************************************************/ +/* +* Check if this certificate can be trusted +*/ bool X509_Store::Cert_Info::is_trusted() const { return trusted; } -/************************************************* -* Check if this certificate has been verified * -*************************************************/ +/* +* Check if this certificate has been verified +*/ bool X509_Store::Cert_Info::is_verified(u32bit timeout) const { if(!checked) diff --git a/src/cert/x509/x509stor.h b/src/cert/x509/x509stor.h index 2667187af..4e6037883 100644 --- a/src/cert/x509/x509stor.h +++ b/src/cert/x509/x509stor.h @@ -1,7 +1,9 @@ -/************************************************* -* X.509 Certificate Store Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* X.509 Certificate Store +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_X509_CERT_STORE_H__ #define BOTAN_X509_CERT_STORE_H__ @@ -12,9 +14,9 @@ namespace Botan { -/************************************************* -* X.509 Certificate Validation Result * -*************************************************/ +/* +* X.509 Certificate Validation Result +*/ enum X509_Code { VERIFIED, UNKNOWN_X509_ERROR, @@ -40,9 +42,9 @@ enum X509_Code { CA_CERT_NOT_FOR_CRL_ISSUER }; -/************************************************* -* X.509 Certificate Store * -*************************************************/ +/* +* X.509 Certificate Store +*/ class BOTAN_DLL X509_Store { public: diff --git a/src/checksum/adler32/adler32.cpp b/src/checksum/adler32/adler32.cpp index b808e3e67..c66943b88 100644 --- a/src/checksum/adler32/adler32.cpp +++ b/src/checksum/adler32/adler32.cpp @@ -1,16 +1,18 @@ -/************************************************* -* Adler32 Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* Adler32 +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/adler32.h> #include <botan/loadstor.h> namespace Botan { -/************************************************* -* Adler32 Checksum * -*************************************************/ +/* +* Adler32 Checksum +*/ void Adler32::hash(const byte input[], u32bit length) { u32bit S1x = S1, S2x = S2; @@ -45,9 +47,9 @@ void Adler32::hash(const byte input[], u32bit length) S2 = S2x; } -/************************************************* -* Update an Adler32 Checksum * -*************************************************/ +/* +* Update an Adler32 Checksum +*/ void Adler32::add_data(const byte input[], u32bit length) { const u32bit PROCESS_AMOUNT = 5552; @@ -60,9 +62,9 @@ void Adler32::add_data(const byte input[], u32bit length) hash(input, length); } -/************************************************* -* Finalize an Adler32 Checksum * -*************************************************/ +/* +* Finalize an Adler32 Checksum +*/ void Adler32::final_result(byte output[]) { store_be(output, S2, S1); diff --git a/src/checksum/adler32/adler32.h b/src/checksum/adler32/adler32.h index 2151daa33..98a28bc81 100644 --- a/src/checksum/adler32/adler32.h +++ b/src/checksum/adler32/adler32.h @@ -1,7 +1,9 @@ -/************************************************* -* Adler32 Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* Adler32 +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_ADLER32_H__ #define BOTAN_ADLER32_H__ @@ -10,9 +12,9 @@ namespace Botan { -/************************************************* -* Adler32 * -*************************************************/ +/* +* Adler32 +*/ class BOTAN_DLL Adler32 : public HashFunction { public: diff --git a/src/checksum/crc24/crc24.cpp b/src/checksum/crc24/crc24.cpp index eda2c19f2..e50b4d33e 100644 --- a/src/checksum/crc24/crc24.cpp +++ b/src/checksum/crc24/crc24.cpp @@ -1,16 +1,18 @@ -/************************************************* -* CRC24 Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* CRC24 +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/crc24.h> #include <botan/loadstor.h> namespace Botan { -/************************************************* -* Update a CRC24 Checksum * -*************************************************/ +/* +* Update a CRC24 Checksum +*/ void CRC24::add_data(const byte input[], u32bit length) { const u32bit TABLE[256] = { @@ -85,9 +87,9 @@ void CRC24::add_data(const byte input[], u32bit length) crc = tmp; } -/************************************************* -* Finalize a CRC24 Checksum * -*************************************************/ +/* +* Finalize a CRC24 Checksum +*/ void CRC24::final_result(byte output[]) { for(u32bit j = 0; j != 3; ++j) diff --git a/src/checksum/crc24/crc24.h b/src/checksum/crc24/crc24.h index 6c65a6e85..bca4d0e89 100644 --- a/src/checksum/crc24/crc24.h +++ b/src/checksum/crc24/crc24.h @@ -1,7 +1,9 @@ -/************************************************* -* CRC24 Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* CRC24 +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_CRC24_H__ #define BOTAN_CRC24_H__ @@ -10,9 +12,9 @@ namespace Botan { -/************************************************* -* CRC24 * -*************************************************/ +/* +* CRC24 +*/ class BOTAN_DLL CRC24 : public HashFunction { public: diff --git a/src/checksum/crc32/crc32.cpp b/src/checksum/crc32/crc32.cpp index 21af2f13b..42462096f 100644 --- a/src/checksum/crc32/crc32.cpp +++ b/src/checksum/crc32/crc32.cpp @@ -1,16 +1,18 @@ -/************************************************* -* CRC32 Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* CRC32 +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/crc32.h> #include <botan/loadstor.h> namespace Botan { -/************************************************* -* Update a CRC32 Checksum * -*************************************************/ +/* +* Update a CRC32 Checksum +*/ void CRC32::add_data(const byte input[], u32bit length) { const u32bit TABLE[256] = { @@ -87,9 +89,9 @@ void CRC32::add_data(const byte input[], u32bit length) crc = tmp; } -/************************************************* -* Finalize a CRC32 Checksum * -*************************************************/ +/* +* Finalize a CRC32 Checksum +*/ void CRC32::final_result(byte output[]) { crc ^= 0xFFFFFFFF; diff --git a/src/checksum/crc32/crc32.h b/src/checksum/crc32/crc32.h index bc97489be..390fb100e 100644 --- a/src/checksum/crc32/crc32.h +++ b/src/checksum/crc32/crc32.h @@ -1,7 +1,9 @@ -/************************************************* -* CRC32 Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* CRC32 +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_CRC32_H__ #define BOTAN_CRC32_H__ @@ -10,9 +12,9 @@ namespace Botan { -/************************************************* -* CRC32 * -*************************************************/ +/* +* CRC32 +*/ class BOTAN_DLL CRC32 : public HashFunction { public: diff --git a/src/cms/cms_algo.cpp b/src/cms/cms_algo.cpp index 8db27c65f..748aa73da 100644 --- a/src/cms/cms_algo.cpp +++ b/src/cms/cms_algo.cpp @@ -1,7 +1,9 @@ -/************************************************* -* CMS Algorithm Specific Code Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* CMS Algorithm Specific Code +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/cms_enc.h> #include <botan/der_enc.h> @@ -18,9 +20,9 @@ namespace Botan { namespace { -/************************************************* -* Wrap a key as specified in RFC 3217 * -*************************************************/ +/* +* Wrap a key as specified in RFC 3217 +*/ SecureVector<byte> do_rfc3217_wrap(RandomNumberGenerator& rng, const std::string& cipher_name, const SymmetricKey& kek, @@ -70,9 +72,9 @@ SecureVector<byte> do_rfc3217_wrap(RandomNumberGenerator& rng, } -/************************************************* -* Wrap a CEK with a KEK * -*************************************************/ +/* +* Wrap a CEK with a KEK +*/ SecureVector<byte> CMS_Encoder::wrap_key(RandomNumberGenerator& rng, const std::string& cipher, const SymmetricKey& cek, @@ -105,9 +107,9 @@ SecureVector<byte> CMS_Encoder::wrap_key(RandomNumberGenerator& rng, throw Invalid_Argument("CMS_Encoder::wrap: Unknown cipher " + cipher); } -/************************************************* -* Encode the parameters for an encryption algo * -*************************************************/ +/* +* Encode the parameters for an encryption algo +*/ SecureVector<byte> CMS_Encoder::encode_params(const std::string& cipher, const SymmetricKey& key, const InitializationVector& iv) @@ -138,9 +140,9 @@ SecureVector<byte> CMS_Encoder::encode_params(const std::string& cipher, return encoder.get_contents(); } -/************************************************* -* Generate a CEK or KEK for the cipher * -*************************************************/ +/* +* Generate a CEK or KEK for the cipher +*/ SymmetricKey CMS_Encoder::setup_key(RandomNumberGenerator& rng, const std::string& cipher) { diff --git a/src/cms/cms_comp.cpp b/src/cms/cms_comp.cpp index a0e777321..b11cf909b 100644 --- a/src/cms/cms_comp.cpp +++ b/src/cms/cms_comp.cpp @@ -1,7 +1,9 @@ -/************************************************* -* CMS Compression Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* CMS Compression +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/cms_enc.h> #include <botan/cms_dec.h> @@ -16,9 +18,9 @@ namespace Botan { -/************************************************* -* Compress a message * -*************************************************/ +/* +* Compress a message +*/ void CMS_Encoder::compress(const std::string& algo) { if(!CMS_Encoder::can_compress_with(algo)) @@ -48,9 +50,9 @@ void CMS_Encoder::compress(const std::string& algo) add_layer("CMS.CompressedData", encoder); } -/************************************************* -* See if the named compression algo is available * -*************************************************/ +/* +* See if the named compression algo is available +*/ bool CMS_Encoder::can_compress_with(const std::string& algo) { if(algo == "") @@ -64,9 +66,9 @@ bool CMS_Encoder::can_compress_with(const std::string& algo) return false; } -/************************************************* -* Decompress a message * -*************************************************/ +/* +* Decompress a message +*/ void CMS_Decoder::decompress(BER_Decoder& decoder) { u32bit version; diff --git a/src/cms/cms_dalg.cpp b/src/cms/cms_dalg.cpp index 501ea7873..7ed793f4f 100644 --- a/src/cms/cms_dalg.cpp +++ b/src/cms/cms_dalg.cpp @@ -1,7 +1,9 @@ -/************************************************* -* CMS Decoding Operations Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* CMS Decoding Operations +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/cms_dec.h> #include <botan/x509find.h> @@ -17,9 +19,9 @@ namespace Botan { namespace { -/************************************************* -* Compute the hash of some content * -*************************************************/ +/* +* Compute the hash of some content +*/ SecureVector<byte> hash_of(const SecureVector<byte>& content, const AlgorithmIdentifier& hash_algo, std::string& hash_name) @@ -32,9 +34,9 @@ SecureVector<byte> hash_of(const SecureVector<byte>& content, return hash_fn->process(content); } -/************************************************* -* Find a cert based on SignerIdentifier * -*************************************************/ +/* +* Find a cert based on SignerIdentifier +*/ std::vector<X509_Certificate> get_cert(BER_Decoder& signer_info, X509_Store& store) { @@ -64,9 +66,9 @@ std::vector<X509_Certificate> get_cert(BER_Decoder& signer_info, return found; } -/************************************************* -* Read OriginatorInfo * -*************************************************/ +/* +* Read OriginatorInfo +*/ void read_orig_info(BER_Decoder& info, X509_Store& store) { BER_Object next = info.get_next_object(); @@ -99,9 +101,9 @@ void read_orig_info(BER_Decoder& info, X509_Store& store) info.push_back(next); } -/************************************************* -* Decode any Attributes, and check type * -*************************************************/ +/* +* Decode any Attributes, and check type +*/ SecureVector<byte> decode_attributes(BER_Decoder& ber, const OID& type, bool& bad_attributes) { @@ -150,9 +152,9 @@ SecureVector<byte> decode_attributes(BER_Decoder& ber, const OID& type, } -/************************************************* -* Decode this layer of CMS encoding * -*************************************************/ +/* +* Decode this layer of CMS encoding +*/ void CMS_Decoder::decode_layer() { try { diff --git a/src/cms/cms_dec.cpp b/src/cms/cms_dec.cpp index 55c1c8cd5..222399f6c 100644 --- a/src/cms/cms_dec.cpp +++ b/src/cms/cms_dec.cpp @@ -1,7 +1,9 @@ -/************************************************* -* CMS Decoding Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* CMS Decoding +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/cms_dec.h> #include <botan/ber_dec.h> @@ -11,9 +13,9 @@ namespace Botan { -/************************************************* -* CMS_Decoder Constructor * -*************************************************/ +/* +* CMS_Decoder Constructor +*/ CMS_Decoder::CMS_Decoder(DataSource& in, const X509_Store& x509store, User_Interface& ui_ref, PKCS8_PrivateKey* key) : ui(ui_ref), store(x509store) @@ -31,9 +33,9 @@ CMS_Decoder::CMS_Decoder(DataSource& in, const X509_Store& x509store, } } -/************************************************* -* Read the outermost ContentInfo * -*************************************************/ +/* +* Read the outermost ContentInfo +*/ void CMS_Decoder::initial_read(DataSource&) { // FIXME... @@ -52,9 +54,9 @@ void CMS_Decoder::initial_read(DataSource&) decode_layer(); } -/************************************************* -* Add another private key to use * -*************************************************/ +/* +* Add another private key to use +*/ void CMS_Decoder::add_key(PKCS8_PrivateKey* key) { if(!key) @@ -69,17 +71,17 @@ void CMS_Decoder::add_key(PKCS8_PrivateKey* key) keys.push_back(key); } -/************************************************* -* Return the status information * -*************************************************/ +/* +* Return the status information +*/ CMS_Decoder::Status CMS_Decoder::layer_status() const { return status; } -/************************************************* -* Return the final data content * -*************************************************/ +/* +* Return the final data content +*/ std::string CMS_Decoder::get_data() const { if(layer_type() != DATA) @@ -87,9 +89,9 @@ std::string CMS_Decoder::get_data() const return std::string((const char*)data.begin(), data.size()); } -/************************************************* -* Return the content type of this layer * -*************************************************/ +/* +* Return the content type of this layer +*/ CMS_Decoder::Content_Type CMS_Decoder::layer_type() const { if(type == OIDS::lookup("CMS.DataContent")) return DATA; @@ -101,17 +103,17 @@ CMS_Decoder::Content_Type CMS_Decoder::layer_type() const return UNKNOWN; } -/************************************************* -* Return some information about this layer * -*************************************************/ +/* +* Return some information about this layer +*/ std::string CMS_Decoder::layer_info() const { return info; } -/************************************************* -* Return some information about this layer * -*************************************************/ +/* +* Return some information about this layer +*/ void CMS_Decoder::read_econtent(BER_Decoder& decoder) { BER_Decoder econtent_info = decoder.start_cons(SEQUENCE); diff --git a/src/cms/cms_dec.h b/src/cms/cms_dec.h index a338e4c0f..75b61c9cb 100644 --- a/src/cms/cms_dec.h +++ b/src/cms/cms_dec.h @@ -1,7 +1,9 @@ -/************************************************* -* CMS Decoding Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* CMS Decoding +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_CMS_DECODER_H__ #define BOTAN_CMS_DECODER_H__ @@ -14,9 +16,9 @@ namespace Botan { -/************************************************* -* CMS Decoding Operation * -*************************************************/ +/* +* CMS Decoding Operation +*/ class BOTAN_DLL CMS_Decoder { public: diff --git a/src/cms/cms_ealg.cpp b/src/cms/cms_ealg.cpp index 85b933197..2970e8e79 100644 --- a/src/cms/cms_ealg.cpp +++ b/src/cms/cms_ealg.cpp @@ -1,7 +1,9 @@ -/************************************************* -* CMS Encoding Operations Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* CMS Encoding Operations +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/cms_enc.h> #include <botan/der_enc.h> @@ -19,9 +21,9 @@ namespace Botan { namespace { -/************************************************* -* Choose an algorithm * -*************************************************/ +/* +* Choose an algorithm +*/ std::string choose_algo(const std::string& user_algo, const std::string& default_algo) { @@ -30,9 +32,9 @@ std::string choose_algo(const std::string& user_algo, return global_state().deref_alias(user_algo); } -/************************************************* -* Encode a SignerIdentifier/RecipientIdentifier * -*************************************************/ +/* +* Encode a SignerIdentifier/RecipientIdentifier +*/ DER_Encoder& encode_si(DER_Encoder& der, const X509_Certificate& cert, bool use_skid_encoding = false) { @@ -49,9 +51,9 @@ DER_Encoder& encode_si(DER_Encoder& der, const X509_Certificate& cert, return der; } -/************************************************* -* Compute the hash of some content * -*************************************************/ +/* +* Compute the hash of some content +*/ SecureVector<byte> hash_of(const SecureVector<byte>& content, const std::string& hash_name) { @@ -60,9 +62,9 @@ SecureVector<byte> hash_of(const SecureVector<byte>& content, return hash_fn->process(content); } -/************************************************* -* Encode Attributes containing info on content * -*************************************************/ +/* +* Encode Attributes containing info on content +*/ SecureVector<byte> encode_attr(const SecureVector<byte>& data, const std::string& type, const std::string& hash) @@ -86,9 +88,9 @@ SecureVector<byte> encode_attr(const SecureVector<byte>& data, } -/************************************************* -* Encrypt a message * -*************************************************/ +/* +* Encrypt a message +*/ void CMS_Encoder::encrypt(RandomNumberGenerator& rng, const X509_Certificate& to, const std::string user_cipher) @@ -123,9 +125,9 @@ void CMS_Encoder::encrypt(RandomNumberGenerator& rng, throw Invalid_Argument("Unknown CMS PK encryption algorithm " + algo); } -/************************************************* -* Encrypt a message with a key transport algo * -*************************************************/ +/* +* Encrypt a message with a key transport algo +*/ void CMS_Encoder::encrypt_ktri(RandomNumberGenerator& rng, const X509_Certificate& to, PK_Encrypting_Key* pub_key, @@ -158,9 +160,9 @@ void CMS_Encoder::encrypt_ktri(RandomNumberGenerator& rng, add_layer("CMS.EnvelopedData", encoder); } -/************************************************* -* Encrypt a message with a key agreement algo * -*************************************************/ +/* +* Encrypt a message with a key agreement algo +*/ void CMS_Encoder::encrypt_kari(RandomNumberGenerator&, const X509_Certificate&, X509_PublicKey*, @@ -189,9 +191,9 @@ void CMS_Encoder::encrypt_kari(RandomNumberGenerator&, #endif } -/************************************************* -* Encrypt a message with a shared key * -*************************************************/ +/* +* Encrypt a message with a shared key +*/ void CMS_Encoder::encrypt(RandomNumberGenerator& rng, const SymmetricKey& kek, const std::string& user_cipher) @@ -222,9 +224,9 @@ void CMS_Encoder::encrypt(RandomNumberGenerator& rng, add_layer("CMS.EnvelopedData", encoder); } -/************************************************* -* Encrypt a message with a passphrase * -*************************************************/ +/* +* Encrypt a message with a passphrase +*/ void CMS_Encoder::encrypt(RandomNumberGenerator&, const std::string&, const std::string& user_cipher) @@ -244,9 +246,9 @@ void CMS_Encoder::encrypt(RandomNumberGenerator&, */ } -/************************************************* -* Encrypt the content with the chosen key/cipher * -*************************************************/ +/* +* Encrypt the content with the chosen key/cipher +*/ SecureVector<byte> CMS_Encoder::do_encrypt(RandomNumberGenerator& rng, const SymmetricKey& key, const std::string& cipher_name) @@ -281,9 +283,9 @@ SecureVector<byte> CMS_Encoder::do_encrypt(RandomNumberGenerator& rng, return encoder.get_contents(); } -/************************************************* -* Sign a message * -*************************************************/ +/* +* Sign a message +*/ void CMS_Encoder::sign(const X509_Certificate& cert, const PKCS8_PrivateKey& key, RandomNumberGenerator& rng, @@ -343,9 +345,9 @@ void CMS_Encoder::sign(const X509_Certificate& cert, add_layer("CMS.SignedData", encoder); } -/************************************************* -* Digest a message * -*************************************************/ +/* +* Digest a message +*/ void CMS_Encoder::digest(const std::string& user_hash) { const std::string hash = choose_algo(user_hash, "SHA-1"); @@ -366,9 +368,9 @@ void CMS_Encoder::digest(const std::string& user_hash) add_layer("CMS.DigestedData", encoder); } -/************************************************* -* MAC a message with an encrypted key * -*************************************************/ +/* +* MAC a message with an encrypted key +*/ void CMS_Encoder::authenticate(const X509_Certificate&, const std::string& mac_algo) { @@ -376,9 +378,9 @@ void CMS_Encoder::authenticate(const X509_Certificate&, throw Exception("FIXME: unimplemented"); } -/************************************************* -* MAC a message with a shared key * -*************************************************/ +/* +* MAC a message with a shared key +*/ void CMS_Encoder::authenticate(const SymmetricKey&, const std::string& mac_algo) { @@ -386,9 +388,9 @@ void CMS_Encoder::authenticate(const SymmetricKey&, throw Exception("FIXME: unimplemented"); } -/************************************************* -* MAC a message with a passphrase * -*************************************************/ +/* +* MAC a message with a passphrase +*/ void CMS_Encoder::authenticate(const std::string&, const std::string& mac_algo) { diff --git a/src/cms/cms_enc.cpp b/src/cms/cms_enc.cpp index 601fbc9b6..2413676d7 100644 --- a/src/cms/cms_enc.cpp +++ b/src/cms/cms_enc.cpp @@ -1,7 +1,9 @@ -/************************************************* -* CMS Encoding Base Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* CMS Encoding Base +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/cms_enc.h> #include <botan/der_enc.h> @@ -10,9 +12,9 @@ namespace Botan { -/************************************************* -* Setup the intitial layer of CMS data * -*************************************************/ +/* +* Setup the intitial layer of CMS data +*/ void CMS_Encoder::set_data(const byte buf[], u32bit length) { if(data.has_items()) @@ -22,17 +24,17 @@ void CMS_Encoder::set_data(const byte buf[], u32bit length) type = "CMS.DataContent"; } -/************************************************* -* Setup the intitial layer of CMS data * -*************************************************/ +/* +* Setup the intitial layer of CMS data +*/ void CMS_Encoder::set_data(const std::string& str) { set_data((const byte*)str.c_str(), str.length()); } -/************************************************* -* Finalize and return the CMS encoded data * -*************************************************/ +/* +* Finalize and return the CMS encoded data +*/ SecureVector<byte> CMS_Encoder::get_contents() { DER_Encoder encoder; @@ -49,26 +51,26 @@ SecureVector<byte> CMS_Encoder::get_contents() return encoder.get_contents(); } -/************************************************* -* Add a new layer of encapsulation * -*************************************************/ +/* +* Add a new layer of encapsulation +*/ void CMS_Encoder::add_layer(const std::string& oid, DER_Encoder& new_layer) { data = new_layer.get_contents(); type = oid; } -/************************************************* -* Return the PEM-encoded data * -*************************************************/ +/* +* Return the PEM-encoded data +*/ std::string CMS_Encoder::PEM_contents() { return PEM_Code::encode(get_contents(), "PKCS7"); } -/************************************************* -* Make an EncapsulatedContentInfo * -*************************************************/ +/* +* Make an EncapsulatedContentInfo +*/ SecureVector<byte> CMS_Encoder::make_econtent(const SecureVector<byte>& data, const std::string& type) { diff --git a/src/cms/cms_enc.h b/src/cms/cms_enc.h index f62c56ffa..6fdd2b726 100644 --- a/src/cms/cms_enc.h +++ b/src/cms/cms_enc.h @@ -1,7 +1,9 @@ -/************************************************* -* CMS Encoding Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* CMS Encoding +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_CMS_ENCODER_H__ #define BOTAN_CMS_ENCODER_H__ @@ -13,9 +15,9 @@ namespace Botan { -/************************************************* -* CMS Encoding Operation * -*************************************************/ +/* +* CMS Encoding Operation +*/ class BOTAN_DLL CMS_Encoder { public: diff --git a/src/codec/base64/b64_char.cpp b/src/codec/base64/b64_char.cpp index 3019c4d36..e5722a0fd 100644 --- a/src/codec/base64/b64_char.cpp +++ b/src/codec/base64/b64_char.cpp @@ -1,15 +1,17 @@ -/************************************************* -* Base64 Codec Character Tables * -* (C) 1999-2008 Jack Lloyd * -*************************************************/ +/* +* Base64 Codec Character Tables +* (C) 1999-2008 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/base64.h> namespace Botan { -/************************************************* -* Base64 Encoder Lookup Table * -*************************************************/ +/* +* Base64 Encoder Lookup Table +*/ const byte Base64_Encoder::BIN_TO_BASE64[64] = { 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4A, 0x4B, 0x4C, 0x4D, 0x4E, 0x4F, 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5A, @@ -17,9 +19,9 @@ const byte Base64_Encoder::BIN_TO_BASE64[64] = { 0x6E, 0x6F, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7A, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x2B, 0x2F }; -/************************************************* -* Base64 Decoder Lookup Table * -*************************************************/ +/* +* Base64 Decoder Lookup Table +*/ const byte Base64_Decoder::BASE64_TO_BIN[256] = { 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, diff --git a/src/codec/base64/base64.cpp b/src/codec/base64/base64.cpp index b1a802376..dfcc1cae7 100644 --- a/src/codec/base64/base64.cpp +++ b/src/codec/base64/base64.cpp @@ -1,7 +1,9 @@ -/************************************************* -* Base64 Encoder/Decoder Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* Base64 Encoder/Decoder +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/base64.h> #include <botan/charset.h> @@ -10,9 +12,9 @@ namespace Botan { -/************************************************* -* Base64_Encoder Constructor * -*************************************************/ +/* +* Base64_Encoder Constructor +*/ Base64_Encoder::Base64_Encoder(bool breaks, u32bit length, bool t_n) : line_length(breaks ? length : 0), trailing_newline(t_n) { @@ -22,9 +24,9 @@ Base64_Encoder::Base64_Encoder(bool breaks, u32bit length, bool t_n) : counter = position = 0; } -/************************************************* -* Base64 Encoding Operation * -*************************************************/ +/* +* Base64 Encoding Operation +*/ void Base64_Encoder::encode(const byte in[3], byte out[4]) { out[0] = BIN_TO_BASE64[((in[0] & 0xFC) >> 2)]; @@ -33,9 +35,9 @@ void Base64_Encoder::encode(const byte in[3], byte out[4]) out[3] = BIN_TO_BASE64[((in[2] & 0x3F) )]; } -/************************************************* -* Encode and send a block * -*************************************************/ +/* +* Encode and send a block +*/ void Base64_Encoder::encode_and_send(const byte block[], u32bit length) { for(u32bit j = 0; j != length; j += 3) @@ -45,9 +47,9 @@ void Base64_Encoder::encode_and_send(const byte block[], u32bit length) } } -/************************************************* -* Handle the output * -*************************************************/ +/* +* Handle the output +*/ void Base64_Encoder::do_output(const byte input[], u32bit length) { if(line_length == 0) @@ -71,9 +73,9 @@ void Base64_Encoder::do_output(const byte input[], u32bit length) } } -/************************************************* -* Convert some data into Base64 * -*************************************************/ +/* +* Convert some data into Base64 +*/ void Base64_Encoder::write(const byte input[], u32bit length) { in.copy(position, input, length); @@ -94,9 +96,9 @@ void Base64_Encoder::write(const byte input[], u32bit length) position += length; } -/************************************************* -* Flush buffers * -*************************************************/ +/* +* Flush buffers +*/ void Base64_Encoder::end_msg() { u32bit start_of_last_block = 3 * (position / 3), @@ -125,9 +127,9 @@ void Base64_Encoder::end_msg() counter = position = 0; } -/************************************************* -* Base64_Decoder Constructor * -*************************************************/ +/* +* Base64_Decoder Constructor +*/ Base64_Decoder::Base64_Decoder(Decoder_Checking c) : checking(c) { in.create(48); @@ -135,17 +137,17 @@ Base64_Decoder::Base64_Decoder(Decoder_Checking c) : checking(c) position = 0; } -/************************************************* -* Check if a character is a valid Base64 char * -*************************************************/ +/* +* Check if a character is a valid Base64 char +*/ bool Base64_Decoder::is_valid(byte in) { return (BASE64_TO_BIN[in] != 0x80); } -/************************************************* -* Base64 Decoding Operation * -*************************************************/ +/* +* Base64 Decoding Operation +*/ void Base64_Decoder::decode(const byte in[4], byte out[3]) { out[0] = ((BASE64_TO_BIN[in[0]] << 2) | (BASE64_TO_BIN[in[1]] >> 4)); @@ -153,9 +155,9 @@ void Base64_Decoder::decode(const byte in[4], byte out[3]) out[2] = ((BASE64_TO_BIN[in[2]] << 6) | (BASE64_TO_BIN[in[3]])); } -/************************************************* -* Decode and send a block * -*************************************************/ +/* +* Decode and send a block +*/ void Base64_Decoder::decode_and_send(const byte block[], u32bit length) { for(u32bit j = 0; j != length; j += 4) @@ -165,9 +167,9 @@ void Base64_Decoder::decode_and_send(const byte block[], u32bit length) } } -/************************************************* -* Handle processing an invalid character * -*************************************************/ +/* +* Handle processing an invalid character +*/ void Base64_Decoder::handle_bad_char(byte c) { if(c == '=' || checking == NONE) @@ -182,9 +184,9 @@ void Base64_Decoder::handle_bad_char(byte c) ); } -/************************************************* -* Convert some data from Base64 * -*************************************************/ +/* +* Convert some data from Base64 +*/ void Base64_Decoder::write(const byte input[], u32bit length) { for(u32bit j = 0; j != length; ++j) @@ -202,9 +204,9 @@ void Base64_Decoder::write(const byte input[], u32bit length) } } -/************************************************* -* Flush buffers * -*************************************************/ +/* +* Flush buffers +*/ void Base64_Decoder::end_msg() { if(position != 0) diff --git a/src/codec/base64/base64.h b/src/codec/base64/base64.h index f59191ae0..aca02da14 100644 --- a/src/codec/base64/base64.h +++ b/src/codec/base64/base64.h @@ -1,7 +1,9 @@ -/************************************************* -* Base64 Encoder/Decoder Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* Base64 Encoder/Decoder +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_BASE64_H__ #define BOTAN_BASE64_H__ diff --git a/src/codec/bzip2/bzip2.cpp b/src/codec/bzip2/bzip2.cpp index 18b3c51f0..4cdca5355 100644 --- a/src/codec/bzip2/bzip2.cpp +++ b/src/codec/bzip2/bzip2.cpp @@ -1,9 +1,11 @@ -/************************************************* -* Bzip Compressor Source File * -* (C) 2001 Peter J Jones * -* 2001-2007 Jack Lloyd * -* 2006 Matt Johnston * -*************************************************/ +/* +* Bzip Compressor +* (C) 2001 Peter J Jones +* 2001-2007 Jack Lloyd +* 2006 Matt Johnston +* +* Distributed under the terms of the Botan license +*/ #include <botan/bzip2.h> #include <botan/exceptn.h> @@ -17,9 +19,9 @@ namespace Botan { namespace { -/************************************************* -* Allocation Information for Bzip * -*************************************************/ +/* +* Allocation Information for Bzip +*/ class Bzip_Alloc_Info { public: @@ -29,9 +31,9 @@ class Bzip_Alloc_Info Bzip_Alloc_Info() { alloc = Allocator::get(false); } }; -/************************************************* -* Allocation Function for Bzip * -*************************************************/ +/* +* Allocation Function for Bzip +*/ void* bzip_malloc(void* info_ptr, int n, int size) { Bzip_Alloc_Info* info = static_cast<Bzip_Alloc_Info*>(info_ptr); @@ -40,9 +42,9 @@ void* bzip_malloc(void* info_ptr, int n, int size) return ptr; } -/************************************************* -* Allocation Function for Bzip * -*************************************************/ +/* +* Allocation Function for Bzip +*/ void bzip_free(void* info_ptr, void* ptr) { Bzip_Alloc_Info* info = static_cast<Bzip_Alloc_Info*>(info_ptr); @@ -54,9 +56,9 @@ void bzip_free(void* info_ptr, void* ptr) } -/************************************************* -* Wrapper Type for Bzip2 Stream * -*************************************************/ +/* +* Wrapper Type for Bzip2 Stream +*/ class Bzip_Stream { public: @@ -77,18 +79,18 @@ class Bzip_Stream } }; -/************************************************* -* Bzip_Compression Constructor * -*************************************************/ +/* +* Bzip_Compression Constructor +*/ Bzip_Compression::Bzip_Compression(u32bit l) : level((l >= 9) ? 9 : l), buffer(DEFAULT_BUFFERSIZE) { bz = 0; } -/************************************************* -* Start Compressing with Bzip * -*************************************************/ +/* +* Start Compressing with Bzip +*/ void Bzip_Compression::start_msg() { clear(); @@ -97,9 +99,9 @@ void Bzip_Compression::start_msg() throw Exception("Bzip_Compression: Memory allocation error"); } -/************************************************* -* Compress Input with Bzip * -*************************************************/ +/* +* Compress Input with Bzip +*/ void Bzip_Compression::write(const byte input[], u32bit length) { bz->stream.next_in = reinterpret_cast<char*>(const_cast<byte*>(input)); @@ -114,9 +116,9 @@ void Bzip_Compression::write(const byte input[], u32bit length) } } -/************************************************* -* Finish Compressing with Bzip * -*************************************************/ +/* +* Finish Compressing with Bzip +*/ void Bzip_Compression::end_msg() { bz->stream.next_in = 0; @@ -133,9 +135,9 @@ void Bzip_Compression::end_msg() clear(); } -/************************************************* -* Flush the Bzip Compressor * -*************************************************/ +/* +* Flush the Bzip Compressor +*/ void Bzip_Compression::flush() { bz->stream.next_in = 0; @@ -151,9 +153,9 @@ void Bzip_Compression::flush() } } -/************************************************* -* Clean up Compression Context * -*************************************************/ +/* +* Clean up Compression Context +*/ void Bzip_Compression::clear() { if(!bz) return; @@ -162,9 +164,9 @@ void Bzip_Compression::clear() bz = 0; } -/************************************************* -* Bzip_Decompression Constructor * -*************************************************/ +/* +* Bzip_Decompression Constructor +*/ Bzip_Decompression::Bzip_Decompression(bool s) : small_mem(s), buffer(DEFAULT_BUFFERSIZE) { @@ -172,9 +174,9 @@ Bzip_Decompression::Bzip_Decompression(bool s) : bz = 0; } -/************************************************* -* Decompress Input with Bzip * -*************************************************/ +/* +* Decompress Input with Bzip +*/ void Bzip_Decompression::write(const byte input_arr[], u32bit length) { if(length) no_writes = false; @@ -217,9 +219,9 @@ void Bzip_Decompression::write(const byte input_arr[], u32bit length) } } -/************************************************* -* Start Decompressing with Bzip * -*************************************************/ +/* +* Start Decompressing with Bzip +*/ void Bzip_Decompression::start_msg() { clear(); @@ -231,9 +233,9 @@ void Bzip_Decompression::start_msg() no_writes = true; } -/************************************************* -* Finish Decompressing with Bzip * -*************************************************/ +/* +* Finish Decompressing with Bzip +*/ void Bzip_Decompression::end_msg() { if(no_writes) return; @@ -259,9 +261,9 @@ void Bzip_Decompression::end_msg() clear(); } -/************************************************* -* Clean up Decompression Context * -*************************************************/ +/* +* Clean up Decompression Context +*/ void Bzip_Decompression::clear() { if(!bz) return; diff --git a/src/codec/bzip2/bzip2.h b/src/codec/bzip2/bzip2.h index 0fa3ef6b4..f42263537 100644 --- a/src/codec/bzip2/bzip2.h +++ b/src/codec/bzip2/bzip2.h @@ -1,8 +1,10 @@ -/************************************************* -* Bzip Compressor Header File * -* (C) 2001 Peter J Jones * -* 2001-2007 Jack Lloyd * -*************************************************/ +/* +* Bzip Compressor +* (C) 2001 Peter J Jones +* 2001-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_BZIP2_H__ #define BOTAN_BZIP2_H__ @@ -11,9 +13,9 @@ namespace Botan { -/************************************************* -* Bzip Compression Filter * -*************************************************/ +/* +* Bzip Compression Filter +*/ class BOTAN_DLL Bzip_Compression : public Filter { public: @@ -33,9 +35,9 @@ class BOTAN_DLL Bzip_Compression : public Filter class Bzip_Stream* bz; }; -/************************************************* -* Bzip Decompression Filter * -*************************************************/ +/* +* Bzip Decompression Filter +*/ class BOTAN_DLL Bzip_Decompression : public Filter { public: diff --git a/src/codec/hex/hex.cpp b/src/codec/hex/hex.cpp index 4cbc1d37b..fbacc278b 100644 --- a/src/codec/hex/hex.cpp +++ b/src/codec/hex/hex.cpp @@ -1,7 +1,9 @@ -/************************************************* -* Hex Encoder/Decoder Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* Hex Encoder/Decoder +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/hex.h> #include <botan/parsing.h> @@ -11,9 +13,9 @@ namespace Botan { -/************************************************* -* Hex_Encoder Constructor * -*************************************************/ +/* +* Hex_Encoder Constructor +*/ Hex_Encoder::Hex_Encoder(bool breaks, u32bit length, Case c) : casing(c), line_length(breaks ? length : 0) { @@ -22,9 +24,9 @@ Hex_Encoder::Hex_Encoder(bool breaks, u32bit length, Case c) : counter = position = 0; } -/************************************************* -* Hex_Encoder Constructor * -*************************************************/ +/* +* Hex_Encoder Constructor +*/ Hex_Encoder::Hex_Encoder(Case c) : casing(c), line_length(0) { in.create(64); @@ -32,9 +34,9 @@ Hex_Encoder::Hex_Encoder(Case c) : casing(c), line_length(0) counter = position = 0; } -/************************************************* -* Hex Encoding Operation * -*************************************************/ +/* +* Hex Encoding Operation +*/ void Hex_Encoder::encode(byte in, byte out[2], Hex_Encoder::Case casing) { const byte* BIN_TO_HEX = ((casing == Uppercase) ? BIN_TO_HEX_UPPER : @@ -44,9 +46,9 @@ void Hex_Encoder::encode(byte in, byte out[2], Hex_Encoder::Case casing) out[1] = BIN_TO_HEX[((in ) & 0x0F)]; } -/************************************************* -* Encode and send a block * -*************************************************/ +/* +* Encode and send a block +*/ void Hex_Encoder::encode_and_send(const byte block[], u32bit length) { for(u32bit j = 0; j != length; ++j) @@ -73,9 +75,9 @@ void Hex_Encoder::encode_and_send(const byte block[], u32bit length) } } -/************************************************* -* Convert some data into hex format * -*************************************************/ +/* +* Convert some data into hex format +*/ void Hex_Encoder::write(const byte input[], u32bit length) { in.copy(position, input, length); @@ -96,9 +98,9 @@ void Hex_Encoder::write(const byte input[], u32bit length) position += length; } -/************************************************* -* Flush buffers * -*************************************************/ +/* +* Flush buffers +*/ void Hex_Encoder::end_msg() { encode_and_send(in, position); @@ -107,9 +109,9 @@ void Hex_Encoder::end_msg() counter = position = 0; } -/************************************************* -* Hex_Decoder Constructor * -*************************************************/ +/* +* Hex_Decoder Constructor +*/ Hex_Decoder::Hex_Decoder(Decoder_Checking c) : checking(c) { in.create(64); @@ -117,17 +119,17 @@ Hex_Decoder::Hex_Decoder(Decoder_Checking c) : checking(c) position = 0; } -/************************************************* -* Check if a character is a valid hex char * -*************************************************/ +/* +* Check if a character is a valid hex char +*/ bool Hex_Decoder::is_valid(byte in) { return (HEX_TO_BIN[in] != 0x80); } -/************************************************* -* Handle processing an invalid character * -*************************************************/ +/* +* Handle processing an invalid character +*/ void Hex_Decoder::handle_bad_char(byte c) { if(checking == NONE) @@ -140,17 +142,17 @@ void Hex_Decoder::handle_bad_char(byte c) to_string(c)); } -/************************************************* -* Hex Decoding Operation * -*************************************************/ +/* +* Hex Decoding Operation +*/ byte Hex_Decoder::decode(const byte hex[2]) { return ((HEX_TO_BIN[hex[0]] << 4) | HEX_TO_BIN[hex[1]]); } -/************************************************* -* Decode and send a block * -*************************************************/ +/* +* Decode and send a block +*/ void Hex_Decoder::decode_and_send(const byte block[], u32bit length) { for(u32bit j = 0; j != length / 2; ++j) @@ -158,9 +160,9 @@ void Hex_Decoder::decode_and_send(const byte block[], u32bit length) send(out, length / 2); } -/************************************************* -* Convert some data from hex format * -*************************************************/ +/* +* Convert some data from hex format +*/ void Hex_Decoder::write(const byte input[], u32bit length) { for(u32bit j = 0; j != length; ++j) @@ -177,9 +179,9 @@ void Hex_Decoder::write(const byte input[], u32bit length) } } -/************************************************* -* Flush buffers * -*************************************************/ +/* +* Flush buffers +*/ void Hex_Decoder::end_msg() { decode_and_send(in, position); diff --git a/src/codec/hex/hex.h b/src/codec/hex/hex.h index bb98c8770..035bf4ef9 100644 --- a/src/codec/hex/hex.h +++ b/src/codec/hex/hex.h @@ -1,7 +1,9 @@ -/************************************************* -* Hex Encoder/Decoder Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* Hex Encoder/Decoder +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_HEX_H__ #define BOTAN_HEX_H__ diff --git a/src/codec/hex/hex_char.cpp b/src/codec/hex/hex_char.cpp index d34614a10..c28efc5f7 100644 --- a/src/codec/hex/hex_char.cpp +++ b/src/codec/hex/hex_char.cpp @@ -1,15 +1,17 @@ -/************************************************* -* Hex Character Table * -* (C) 1999-2008 Jack Lloyd * -*************************************************/ +/* +* Hex Character Table +* (C) 1999-2008 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/hex.h> namespace Botan { -/************************************************* -* Hex Encoder Lookup Tables * -*************************************************/ +/* +* Hex Encoder Lookup Tables +*/ const byte Hex_Encoder::BIN_TO_HEX_UPPER[16] = { 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46 }; @@ -18,9 +20,9 @@ const byte Hex_Encoder::BIN_TO_HEX_LOWER[16] = { 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66 }; -/************************************************* -* Hex Decoder Lookup Table * -*************************************************/ +/* +* Hex Decoder Lookup Table +*/ const byte Hex_Decoder::HEX_TO_BIN[256] = { 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, diff --git a/src/codec/openpgp/openpgp.cpp b/src/codec/openpgp/openpgp.cpp index 25eb15ec5..7f9cf5f9c 100644 --- a/src/codec/openpgp/openpgp.cpp +++ b/src/codec/openpgp/openpgp.cpp @@ -1,7 +1,9 @@ -/************************************************* -* OpenPGP Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* OpenPGP +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/openpgp.h> #include <botan/filters.h> @@ -12,9 +14,9 @@ namespace Botan { namespace OpenPGP { -/************************************************* -* OpenPGP Base64 encoding * -*************************************************/ +/* +* OpenPGP Base64 encoding +*/ std::string encode(const byte input[], u32bit length, const std::string& label, const std::map<std::string, std::string>& headers) @@ -52,9 +54,9 @@ std::string encode(const byte input[], u32bit length, return pgp_encoded; } -/************************************************* -* OpenPGP Base64 encoding * -*************************************************/ +/* +* OpenPGP Base64 encoding +*/ std::string encode(const byte input[], u32bit length, const std::string& type) { @@ -62,9 +64,9 @@ std::string encode(const byte input[], u32bit length, return encode(input, length, type, empty); } -/************************************************* -* OpenPGP Base64 decoding * -*************************************************/ +/* +* OpenPGP Base64 decoding +*/ SecureVector<byte> decode(DataSource& source, std::string& label, std::map<std::string, std::string>& headers) { @@ -180,9 +182,9 @@ SecureVector<byte> decode(DataSource& source, std::string& label, return base64.read_all(); } -/************************************************* -* OpenPGP Base64 decoding * -*************************************************/ +/* +* OpenPGP Base64 decoding +*/ SecureVector<byte> decode(DataSource& source, std::string& label) { std::map<std::string, std::string> ignored; diff --git a/src/codec/openpgp/openpgp.h b/src/codec/openpgp/openpgp.h index 1a078a630..890fcf0e3 100644 --- a/src/codec/openpgp/openpgp.h +++ b/src/codec/openpgp/openpgp.h @@ -1,7 +1,9 @@ -/************************************************* -* OpenPGP Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* OpenPGP +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_OPENPGP_H__ #define BOTAN_OPENPGP_H__ @@ -14,9 +16,9 @@ namespace Botan { namespace OpenPGP { -/************************************************* -* OpenPGP Base64 encoding/decoding * -*************************************************/ +/* +* OpenPGP Base64 encoding/decoding +*/ BOTAN_DLL std::string encode(const byte[], u32bit, const std::string&, const std::map<std::string, std::string>&); BOTAN_DLL SecureVector<byte> decode(DataSource&, std::string&, diff --git a/src/codec/pem/pem.cpp b/src/codec/pem/pem.cpp index fb0be6fd5..5141bee21 100644 --- a/src/codec/pem/pem.cpp +++ b/src/codec/pem/pem.cpp @@ -1,7 +1,9 @@ -/************************************************* -* PEM Encoding/Decoding Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* PEM Encoding/Decoding +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/pem.h> #include <botan/filters.h> @@ -11,9 +13,9 @@ namespace Botan { namespace PEM_Code { -/************************************************* -* PEM encode BER/DER-encoded objects * -*************************************************/ +/* +* PEM encode BER/DER-encoded objects +*/ std::string encode(const byte der[], u32bit length, const std::string& label, u32bit width) { @@ -25,18 +27,18 @@ std::string encode(const byte der[], u32bit length, const std::string& label, return (PEM_HEADER + pipe.read_all_as_string() + PEM_TRAILER); } -/************************************************* -* PEM encode BER/DER-encoded objects * -*************************************************/ +/* +* PEM encode BER/DER-encoded objects +*/ std::string encode(const MemoryRegion<byte>& data, const std::string& label, u32bit width) { return encode(data, data.size(), label, width); } -/************************************************* -* Decode PEM down to raw BER/DER * -*************************************************/ +/* +* Decode PEM down to raw BER/DER +*/ SecureVector<byte> decode_check_label(DataSource& source, const std::string& label_want) { @@ -48,9 +50,9 @@ SecureVector<byte> decode_check_label(DataSource& source, return ber; } -/************************************************* -* Decode PEM down to raw BER/DER * -*************************************************/ +/* +* Decode PEM down to raw BER/DER +*/ SecureVector<byte> decode(DataSource& source, std::string& label) { const u32bit RANDOM_CHAR_LIMIT = 8; @@ -108,9 +110,9 @@ SecureVector<byte> decode(DataSource& source, std::string& label) return base64.read_all(); } -/************************************************* -* Search for a PEM signature * -*************************************************/ +/* +* Search for a PEM signature +*/ bool matches(DataSource& source, const std::string& extra, u32bit search_range) { diff --git a/src/codec/pem/pem.h b/src/codec/pem/pem.h index e9f14ddc2..9fe8acb87 100644 --- a/src/codec/pem/pem.h +++ b/src/codec/pem/pem.h @@ -1,7 +1,9 @@ -/************************************************* -* PEM Encoding/Decoding Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* PEM Encoding/Decoding +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_PEM_H__ #define BOTAN_PEM_H__ @@ -12,9 +14,9 @@ namespace Botan { namespace PEM_Code { -/************************************************* -* PEM Encoding/Decoding * -*************************************************/ +/* +* PEM Encoding/Decoding +*/ BOTAN_DLL std::string encode(const byte[], u32bit, const std::string&, u32bit = 64); BOTAN_DLL std::string encode(const MemoryRegion<byte>&, diff --git a/src/codec/zlib/zlib.cpp b/src/codec/zlib/zlib.cpp index 6f1e2b770..246e32924 100644 --- a/src/codec/zlib/zlib.cpp +++ b/src/codec/zlib/zlib.cpp @@ -1,9 +1,11 @@ -/************************************************* -* Zlib Compressor Source File * -* (C) 2001 Peter J Jones * -* 2001-2007 Jack Lloyd * -* 2006 Matt Johnston * -*************************************************/ +/* +* Zlib Compressor +* (C) 2001 Peter J Jones +* 2001-2007 Jack Lloyd +* 2006 Matt Johnston +* +* Distributed under the terms of the Botan license +*/ #include <botan/zlib.h> #include <botan/exceptn.h> @@ -16,9 +18,9 @@ namespace Botan { namespace { -/************************************************* -* Allocation Information for Zlib * -*************************************************/ +/* +* Allocation Information for Zlib +*/ class Zlib_Alloc_Info { public: @@ -28,9 +30,9 @@ class Zlib_Alloc_Info Zlib_Alloc_Info() { alloc = Allocator::get(false); } }; -/************************************************* -* Allocation Function for Zlib * -*************************************************/ +/* +* Allocation Function for Zlib +*/ void* zlib_malloc(void* info_ptr, unsigned int n, unsigned int size) { Zlib_Alloc_Info* info = static_cast<Zlib_Alloc_Info*>(info_ptr); @@ -39,9 +41,9 @@ void* zlib_malloc(void* info_ptr, unsigned int n, unsigned int size) return ptr; } -/************************************************* -* Allocation Function for Zlib * -*************************************************/ +/* +* Allocation Function for Zlib +*/ void zlib_free(void* info_ptr, void* ptr) { Zlib_Alloc_Info* info = static_cast<Zlib_Alloc_Info*>(info_ptr); @@ -53,9 +55,9 @@ void zlib_free(void* info_ptr, void* ptr) } -/************************************************* -* Wrapper Type for Zlib z_stream * -*************************************************/ +/* +* Wrapper Type for Zlib z_stream +*/ class Zlib_Stream { public: @@ -76,18 +78,18 @@ class Zlib_Stream } }; -/************************************************* -* Zlib_Compression Constructor * -*************************************************/ +/* +* Zlib_Compression Constructor +*/ Zlib_Compression::Zlib_Compression(u32bit l) : level((l >= 9) ? 9 : l), buffer(DEFAULT_BUFFERSIZE) { zlib = 0; } -/************************************************* -* Start Compressing with Zlib * -*************************************************/ +/* +* Start Compressing with Zlib +*/ void Zlib_Compression::start_msg() { clear(); @@ -96,9 +98,9 @@ void Zlib_Compression::start_msg() throw Exception("Zlib_Compression: Memory allocation error"); } -/************************************************* -* Compress Input with Zlib * -*************************************************/ +/* +* Compress Input with Zlib +*/ void Zlib_Compression::write(const byte input[], u32bit length) { zlib->stream.next_in = static_cast<Bytef*>(const_cast<byte*>(input)); @@ -113,9 +115,9 @@ void Zlib_Compression::write(const byte input[], u32bit length) } } -/************************************************* -* Finish Compressing with Zlib * -*************************************************/ +/* +* Finish Compressing with Zlib +*/ void Zlib_Compression::end_msg() { zlib->stream.next_in = 0; @@ -132,9 +134,9 @@ void Zlib_Compression::end_msg() clear(); } -/************************************************* -* Flush the Zlib Compressor * -*************************************************/ +/* +* Flush the Zlib Compressor +*/ void Zlib_Compression::flush() { zlib->stream.next_in = 0; @@ -153,9 +155,9 @@ void Zlib_Compression::flush() } } -/************************************************* -* Clean up Compression Context * -*************************************************/ +/* +* Clean up Compression Context +*/ void Zlib_Compression::clear() { if(zlib) @@ -168,18 +170,18 @@ void Zlib_Compression::clear() buffer.clear(); } -/************************************************* -* Zlib_Decompression Constructor * -*************************************************/ +/* +* Zlib_Decompression Constructor +*/ Zlib_Decompression::Zlib_Decompression() : buffer(DEFAULT_BUFFERSIZE) { zlib = 0; no_writes = true; } -/************************************************* -* Start Decompressing with Zlib * -*************************************************/ +/* +* Start Decompressing with Zlib +*/ void Zlib_Decompression::start_msg() { clear(); @@ -188,9 +190,9 @@ void Zlib_Decompression::start_msg() throw Exception("Zlib_Decompression: Memory allocation error"); } -/************************************************* -* Decompress Input with Zlib * -*************************************************/ +/* +* Decompress Input with Zlib +*/ void Zlib_Decompression::write(const byte input_arr[], u32bit length) { if(length) no_writes = false; @@ -236,9 +238,9 @@ void Zlib_Decompression::write(const byte input_arr[], u32bit length) } } -/************************************************* -* Finish Decompressing with Zlib * -*************************************************/ +/* +* Finish Decompressing with Zlib +*/ void Zlib_Decompression::end_msg() { if(no_writes) return; @@ -265,9 +267,9 @@ void Zlib_Decompression::end_msg() clear(); } -/************************************************* -* Clean up Decompression Context * -*************************************************/ +/* +* Clean up Decompression Context +*/ void Zlib_Decompression::clear() { no_writes = true; diff --git a/src/codec/zlib/zlib.h b/src/codec/zlib/zlib.h index 5ab115336..4a7f3bc80 100644 --- a/src/codec/zlib/zlib.h +++ b/src/codec/zlib/zlib.h @@ -1,8 +1,10 @@ -/************************************************* -* Zlib Compressor Header File * -* (C) 2001 Peter J Jones * -* 2001-2007 Jack Lloyd * -*************************************************/ +/* +* Zlib Compressor +* (C) 2001 Peter J Jones +* 2001-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_ZLIB_H__ #define BOTAN_ZLIB_H__ @@ -11,9 +13,9 @@ namespace Botan { -/************************************************* -* Zlib Compression Filter * -*************************************************/ +/* +* Zlib Compression Filter +*/ class BOTAN_DLL Zlib_Compression : public Filter { public: @@ -32,9 +34,9 @@ class BOTAN_DLL Zlib_Compression : public Filter class Zlib_Stream* zlib; }; -/************************************************* -* Zlib Decompression Filter * -*************************************************/ +/* +* Zlib Decompression Filter +*/ class BOTAN_DLL Zlib_Decompression : public Filter { public: 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__ diff --git a/src/entropy/beos_stats/es_beos.cpp b/src/entropy/beos_stats/es_beos.cpp index 02a751e6a..18eca5511 100644 --- a/src/entropy/beos_stats/es_beos.cpp +++ b/src/entropy/beos_stats/es_beos.cpp @@ -1,6 +1,8 @@ /** -* BeOS EntropySource Source File +* BeOS EntropySource * (C) 1999-2008 Jack Lloyd +* +* Distributed under the terms of the Botan license */ #include <botan/es_beos.h> diff --git a/src/entropy/beos_stats/es_beos.h b/src/entropy/beos_stats/es_beos.h index 0ae670e94..be80ad340 100644 --- a/src/entropy/beos_stats/es_beos.h +++ b/src/entropy/beos_stats/es_beos.h @@ -1,6 +1,8 @@ /** -* BeOS EntropySource Header File +* BeOS EntropySource * (C) 1999-2008 Jack Lloyd +* +* Distributed under the terms of the Botan license */ #ifndef BOTAN_ENTROPY_SRC_BEOS_H__ diff --git a/src/entropy/cryptoapi_rng/es_capi.cpp b/src/entropy/cryptoapi_rng/es_capi.cpp index 0cad79288..a70b52044 100644 --- a/src/entropy/cryptoapi_rng/es_capi.cpp +++ b/src/entropy/cryptoapi_rng/es_capi.cpp @@ -1,6 +1,8 @@ /* * Win32 CryptoAPI EntropySource * (C) 1999-2009 Jack Lloyd +* +* Distributed under the terms of the Botan license */ #include <botan/es_capi.h> diff --git a/src/entropy/cryptoapi_rng/es_capi.h b/src/entropy/cryptoapi_rng/es_capi.h index d727de5dd..55966d793 100644 --- a/src/entropy/cryptoapi_rng/es_capi.h +++ b/src/entropy/cryptoapi_rng/es_capi.h @@ -1,7 +1,9 @@ -/************************************************* -* Win32 CAPI EntropySource Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* Win32 CAPI EntropySource +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_ENTROPY_SRC_WIN32_CAPI_H__ #define BOTAN_ENTROPY_SRC_WIN32_CAPI_H__ diff --git a/src/entropy/dev_random/es_dev.cpp b/src/entropy/dev_random/es_dev.cpp index 89f981373..6fcdcbfea 100644 --- a/src/entropy/dev_random/es_dev.cpp +++ b/src/entropy/dev_random/es_dev.cpp @@ -1,6 +1,8 @@ /* * /dev/random EntropySource * (C) 1999-2009 Jack Lloyd +* +* Distributed under the terms of the Botan license */ #include <botan/es_dev.h> diff --git a/src/entropy/dev_random/es_dev.h b/src/entropy/dev_random/es_dev.h index 139f8ec52..df9dbe1c1 100644 --- a/src/entropy/dev_random/es_dev.h +++ b/src/entropy/dev_random/es_dev.h @@ -1,6 +1,8 @@ /* * /dev/random EntropySource * (C) 1999-2009 Jack Lloyd +* +* Distributed under the terms of the Botan license */ #ifndef BOTAN_ENTROPY_SRC_DEVICE_H__ diff --git a/src/entropy/egd/es_egd.cpp b/src/entropy/egd/es_egd.cpp index 17e366f2b..ced3f004d 100644 --- a/src/entropy/egd/es_egd.cpp +++ b/src/entropy/egd/es_egd.cpp @@ -1,6 +1,8 @@ /* -* EGD EntropySource Source File +* EGD EntropySource * (C) 1999-2009 Jack Lloyd +* +* Distributed under the terms of the Botan license */ #include <botan/es_egd.h> diff --git a/src/entropy/egd/es_egd.h b/src/entropy/egd/es_egd.h index 5fb09fc57..5db65659d 100644 --- a/src/entropy/egd/es_egd.h +++ b/src/entropy/egd/es_egd.h @@ -1,6 +1,8 @@ /** -* EGD EntropySource Header File +* EGD EntropySource * (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license */ #ifndef BOTAN_ENTROPY_SRC_EGD_H__ diff --git a/src/entropy/entropy_src.h b/src/entropy/entropy_src.h index eb3a841b4..78e07a7a5 100644 --- a/src/entropy/entropy_src.h +++ b/src/entropy/entropy_src.h @@ -1,6 +1,8 @@ /** -* EntropySource Header File +* EntropySource * (C) 2008-2009 Jack Lloyd +* +* Distributed under the terms of the Botan license */ #ifndef BOTAN_ENTROPY_SOURCE_BASE_H__ diff --git a/src/entropy/proc_walk/es_ftw.cpp b/src/entropy/proc_walk/es_ftw.cpp index 55f26fa73..fe9dfec38 100644 --- a/src/entropy/proc_walk/es_ftw.cpp +++ b/src/entropy/proc_walk/es_ftw.cpp @@ -1,7 +1,9 @@ -/************************************************* -* FTW EntropySource Source File * -* (C) 1999-2008 Jack Lloyd * -*************************************************/ +/* +* FTW EntropySource +* (C) 1999-2008 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/es_ftw.h> #include <botan/secmem.h> diff --git a/src/entropy/proc_walk/es_ftw.h b/src/entropy/proc_walk/es_ftw.h index a764462c6..928a7b16a 100644 --- a/src/entropy/proc_walk/es_ftw.h +++ b/src/entropy/proc_walk/es_ftw.h @@ -1,7 +1,9 @@ -/************************************************* -* File Tree Walking EntropySource Header File * -* (C) 1999-2008 Jack Lloyd * -*************************************************/ +/* +* File Tree Walking EntropySource +* (C) 1999-2008 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_ENTROPY_SRC_FTW_H__ #define BOTAN_ENTROPY_SRC_FTW_H__ diff --git a/src/entropy/unix_procs/es_unix.cpp b/src/entropy/unix_procs/es_unix.cpp index c8cf6daec..fc5b026a4 100644 --- a/src/entropy/unix_procs/es_unix.cpp +++ b/src/entropy/unix_procs/es_unix.cpp @@ -1,6 +1,8 @@ /* -* Unix EntropySource Source File +* Unix EntropySource * (C) 1999-2009 Jack Lloyd +* +* Distributed under the terms of the Botan license */ #include <botan/es_unix.h> diff --git a/src/entropy/unix_procs/es_unix.h b/src/entropy/unix_procs/es_unix.h index ba3fd51c2..1f8abb784 100644 --- a/src/entropy/unix_procs/es_unix.h +++ b/src/entropy/unix_procs/es_unix.h @@ -1,6 +1,8 @@ /* -* Unix EntropySource Header File +* Unix EntropySource * (C) 1999-2009 Jack Lloyd +* +* Distributed under the terms of the Botan license */ #ifndef BOTAN_ENTROPY_SRC_UNIX_H__ diff --git a/src/entropy/unix_procs/unix_cmd.cpp b/src/entropy/unix_procs/unix_cmd.cpp index b9558b35c..1cae07e26 100644 --- a/src/entropy/unix_procs/unix_cmd.cpp +++ b/src/entropy/unix_procs/unix_cmd.cpp @@ -1,6 +1,8 @@ /* -* Unix Command Execution Source File +* Unix Command Execution * (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license */ #include <botan/unix_cmd.h> diff --git a/src/entropy/unix_procs/unix_cmd.h b/src/entropy/unix_procs/unix_cmd.h index 66122ea49..aec189176 100644 --- a/src/entropy/unix_procs/unix_cmd.h +++ b/src/entropy/unix_procs/unix_cmd.h @@ -1,6 +1,8 @@ /** -* Unix Command Execution Header File +* Unix Command Execution * (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license */ #ifndef BOTAN_UNIX_CMD_H__ diff --git a/src/entropy/unix_procs/unix_src.cpp b/src/entropy/unix_procs/unix_src.cpp index 5e48ba41d..c843af6c2 100644 --- a/src/entropy/unix_procs/unix_src.cpp +++ b/src/entropy/unix_procs/unix_src.cpp @@ -1,6 +1,8 @@ /* * Program List for Unix_EntropySource * (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license */ #include <botan/es_unix.h> diff --git a/src/entropy/win32_stats/es_win32.cpp b/src/entropy/win32_stats/es_win32.cpp index 75513fa4c..a8e9e40f5 100644 --- a/src/entropy/win32_stats/es_win32.cpp +++ b/src/entropy/win32_stats/es_win32.cpp @@ -1,6 +1,8 @@ /** -* Win32 EntropySource Source File +* Win32 EntropySource * (C) 1999-2009 Jack Lloyd +* +* Distributed under the terms of the Botan license */ #include <botan/es_win32.h> diff --git a/src/entropy/win32_stats/es_win32.h b/src/entropy/win32_stats/es_win32.h index 06e3b88cc..0aa9054e3 100644 --- a/src/entropy/win32_stats/es_win32.h +++ b/src/entropy/win32_stats/es_win32.h @@ -1,6 +1,8 @@ /** -* Win32 EntropySource Header File +* Win32 EntropySource * (C) 1999-2009 Jack Lloyd +* +* Distributed under the terms of the Botan license */ #ifndef BOTAN_ENTROPY_SRC_WIN32_H__ diff --git a/src/filters/algo_filt.cpp b/src/filters/algo_filt.cpp index 08e65c601..23f7a20cf 100644 --- a/src/filters/algo_filt.cpp +++ b/src/filters/algo_filt.cpp @@ -1,7 +1,9 @@ -/************************************************* -* Filters Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* Filters +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/filters.h> #include <botan/libstate.h> @@ -9,9 +11,9 @@ namespace Botan { -/************************************************* -* StreamCipher_Filter Constructor * -*************************************************/ +/* +* StreamCipher_Filter Constructor +*/ StreamCipher_Filter::StreamCipher_Filter(const std::string& sc_name) : buffer(DEFAULT_BUFFERSIZE) { @@ -19,18 +21,18 @@ StreamCipher_Filter::StreamCipher_Filter(const std::string& sc_name) : base_ptr = cipher = af.make_stream_cipher(sc_name); } -/************************************************* -* StreamCipher_Filter Constructor * -*************************************************/ +/* +* StreamCipher_Filter Constructor +*/ StreamCipher_Filter::StreamCipher_Filter(StreamCipher* stream_cipher) : buffer(DEFAULT_BUFFERSIZE) { base_ptr = cipher = stream_cipher; } -/************************************************* -* StreamCipher_Filter Constructor * -*************************************************/ +/* +* StreamCipher_Filter Constructor +*/ StreamCipher_Filter::StreamCipher_Filter(const std::string& sc_name, const SymmetricKey& key) : buffer(DEFAULT_BUFFERSIZE) @@ -40,17 +42,17 @@ StreamCipher_Filter::StreamCipher_Filter(const std::string& sc_name, cipher->set_key(key); } -/************************************************* -* Set the IV of a stream cipher * -*************************************************/ +/* +* Set the IV of a stream cipher +*/ void StreamCipher_Filter::set_iv(const InitializationVector& iv) { cipher->resync(iv.begin(), iv.length()); } -/************************************************* -* Write data into a StreamCipher_Filter * -*************************************************/ +/* +* Write data into a StreamCipher_Filter +*/ void StreamCipher_Filter::write(const byte input[], u32bit length) { while(length) @@ -63,9 +65,9 @@ void StreamCipher_Filter::write(const byte input[], u32bit length) } } -/************************************************* -* Hash_Filter Constructor * -*************************************************/ +/* +* Hash_Filter Constructor +*/ Hash_Filter::Hash_Filter(const std::string& algo_spec, u32bit len) : OUTPUT_LENGTH(len) @@ -74,9 +76,9 @@ Hash_Filter::Hash_Filter(const std::string& algo_spec, hash = af.make_hash_function(algo_spec); } -/************************************************* -* Complete a calculation by a Hash_Filter * -*************************************************/ +/* +* Complete a calculation by a Hash_Filter +*/ void Hash_Filter::end_msg() { SecureVector<byte> output = hash->final(); @@ -86,9 +88,9 @@ void Hash_Filter::end_msg() send(output); } -/************************************************* -* MAC_Filter Constructor * -*************************************************/ +/* +* MAC_Filter Constructor +*/ MAC_Filter::MAC_Filter(const std::string& mac_name, u32bit len) : OUTPUT_LENGTH(len) { @@ -96,9 +98,9 @@ MAC_Filter::MAC_Filter(const std::string& mac_name, u32bit len) : base_ptr = mac = af.make_mac(mac_name); } -/************************************************* -* MAC_Filter Constructor * -*************************************************/ +/* +* MAC_Filter Constructor +*/ MAC_Filter::MAC_Filter(const std::string& mac_name, const SymmetricKey& key, u32bit len) : OUTPUT_LENGTH(len) { @@ -107,9 +109,9 @@ MAC_Filter::MAC_Filter(const std::string& mac_name, const SymmetricKey& key, mac->set_key(key); } -/************************************************* -* Complete a calculation by a MAC_Filter * -*************************************************/ +/* +* Complete a calculation by a MAC_Filter +*/ void MAC_Filter::end_msg() { SecureVector<byte> output = mac->final(); diff --git a/src/filters/basefilt.cpp b/src/filters/basefilt.cpp index f1f30c463..02dbd8a73 100644 --- a/src/filters/basefilt.cpp +++ b/src/filters/basefilt.cpp @@ -1,15 +1,17 @@ -/************************************************* -* Basic Filters Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* Basic Filters +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/basefilt.h> namespace Botan { -/************************************************* -* Chain Constructor * -*************************************************/ +/* +* Chain Constructor +*/ Chain::Chain(Filter* f1, Filter* f2, Filter* f3, Filter* f4) { if(f1) { attach(f1); incr_owns(); } @@ -18,9 +20,9 @@ Chain::Chain(Filter* f1, Filter* f2, Filter* f3, Filter* f4) if(f4) { attach(f4); incr_owns(); } } -/************************************************* -* Chain Constructor * -*************************************************/ +/* +* Chain Constructor +*/ Chain::Chain(Filter* filters[], u32bit count) { for(u32bit j = 0; j != count; ++j) @@ -31,26 +33,26 @@ Chain::Chain(Filter* filters[], u32bit count) } } -/************************************************* -* Fork Constructor * -*************************************************/ +/* +* Fork Constructor +*/ Fork::Fork(Filter* f1, Filter* f2, Filter* f3, Filter* f4) { Filter* filters[4] = { f1, f2, f3, f4 }; set_next(filters, 4); } -/************************************************* -* Fork Constructor * -*************************************************/ +/* +* Fork Constructor +*/ Fork::Fork(Filter* filters[], u32bit count) { set_next(filters, count); } -/************************************************* -* Set the algorithm key * -*************************************************/ +/* +* Set the algorithm key +*/ void Keyed_Filter::set_key(const SymmetricKey& key) { if(base_ptr) @@ -59,9 +61,9 @@ void Keyed_Filter::set_key(const SymmetricKey& key) throw Invalid_State("Keyed_Filter::set_key: No base algorithm set"); } -/************************************************* -* Check if a keylength is valid * -*************************************************/ +/* +* Check if a keylength is valid +*/ bool Keyed_Filter::valid_keylength(u32bit n) const { if(base_ptr) diff --git a/src/filters/basefilt.h b/src/filters/basefilt.h index 085a4bc60..75625abb0 100644 --- a/src/filters/basefilt.h +++ b/src/filters/basefilt.h @@ -1,7 +1,9 @@ -/************************************************* -* Basic Filters Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* Basic Filters +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_BASEFILT_H__ #define BOTAN_BASEFILT_H__ diff --git a/src/filters/buf_filt.cpp b/src/filters/buf_filt.cpp index 983f5184b..53352b54a 100644 --- a/src/filters/buf_filt.cpp +++ b/src/filters/buf_filt.cpp @@ -1,7 +1,9 @@ -/************************************************* -* Buffering Filter Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* Buffering Filter +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/buf_filt.h> #include <botan/exceptn.h> @@ -9,9 +11,9 @@ namespace Botan { -/************************************************* -* Buffering_Filter Constructor * -*************************************************/ +/* +* Buffering_Filter Constructor +*/ Buffering_Filter::Buffering_Filter(u32bit b, u32bit i) : INITIAL_BLOCK_SIZE(i), BLOCK_SIZE(b) { @@ -20,9 +22,9 @@ Buffering_Filter::Buffering_Filter(u32bit b, u32bit i) : INITIAL_BLOCK_SIZE(i), block.create(BLOCK_SIZE); } -/************************************************* -* Reset the Buffering Filter * -*************************************************/ +/* +* Reset the Buffering Filter +*/ void Buffering_Filter::end_msg() { if(initial_block_pos != INITIAL_BLOCK_SIZE) @@ -33,9 +35,9 @@ void Buffering_Filter::end_msg() block.clear(); } -/************************************************* -* Buffer input into blocks * -*************************************************/ +/* +* Buffer input into blocks +*/ void Buffering_Filter::write(const byte input[], u32bit length) { if(initial_block_pos != INITIAL_BLOCK_SIZE) diff --git a/src/filters/buf_filt.h b/src/filters/buf_filt.h index fdb504518..ce3dbc926 100644 --- a/src/filters/buf_filt.h +++ b/src/filters/buf_filt.h @@ -1,7 +1,9 @@ -/************************************************* -* Buffering Filter Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* Buffering Filter +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_BUFFERING_FILTER_H__ #define BOTAN_BUFFERING_FILTER_H__ diff --git a/src/filters/data_snk.cpp b/src/filters/data_snk.cpp index da677f47d..f8ee9f86e 100644 --- a/src/filters/data_snk.cpp +++ b/src/filters/data_snk.cpp @@ -1,8 +1,10 @@ -/************************************************* -* DataSink Source File * -* (C) 1999-2007 Jack Lloyd * -* 2005 Matthew Gregan * -*************************************************/ +/* +* DataSink +* (C) 1999-2007 Jack Lloyd +* 2005 Matthew Gregan +* +* Distributed under the terms of the Botan license +*/ #include <botan/data_snk.h> #include <botan/exceptn.h> @@ -10,9 +12,9 @@ namespace Botan { -/************************************************* -* Write to a stream * -*************************************************/ +/* +* Write to a stream +*/ void DataSink_Stream::write(const byte out[], u32bit length) { sink->write(reinterpret_cast<const char*>(out), length); @@ -21,9 +23,9 @@ void DataSink_Stream::write(const byte out[], u32bit length) identifier); } -/************************************************* -* DataSink_Stream Constructor * -*************************************************/ +/* +* DataSink_Stream Constructor +*/ DataSink_Stream::DataSink_Stream(std::ostream& out, const std::string& name) : identifier(name != "" ? name : "<std::ostream>"), owner(false) @@ -31,9 +33,9 @@ DataSink_Stream::DataSink_Stream(std::ostream& out, sink = &out; } -/************************************************* -* DataSink_Stream Constructor * -*************************************************/ +/* +* DataSink_Stream Constructor +*/ DataSink_Stream::DataSink_Stream(const std::string& path, bool use_binary) : identifier(path), owner(true) @@ -47,9 +49,9 @@ DataSink_Stream::DataSink_Stream(const std::string& path, throw Stream_IO_Error("DataSink_Stream: Failure opening " + path); } -/************************************************* -* DataSink_Stream Destructor * -*************************************************/ +/* +* DataSink_Stream Destructor +*/ DataSink_Stream::~DataSink_Stream() { if(owner) diff --git a/src/filters/data_snk.h b/src/filters/data_snk.h index 67700a8f5..61ddf6e0d 100644 --- a/src/filters/data_snk.h +++ b/src/filters/data_snk.h @@ -1,7 +1,9 @@ -/************************************************* -* DataSink Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* DataSink +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_DATA_SINK_H__ #define BOTAN_DATA_SINK_H__ diff --git a/src/filters/fd_unix/fd_unix.cpp b/src/filters/fd_unix/fd_unix.cpp index 6c96449bd..7f19b0aeb 100644 --- a/src/filters/fd_unix/fd_unix.cpp +++ b/src/filters/fd_unix/fd_unix.cpp @@ -1,7 +1,9 @@ -/************************************************* -* Pipe I/O for Unix Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* Pipe I/O for Unix +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/pipe.h> #include <botan/exceptn.h> @@ -9,9 +11,9 @@ namespace Botan { -/************************************************* -* Write data from a pipe into a Unix fd * -*************************************************/ +/* +* Write data from a pipe into a Unix fd +*/ int operator<<(int fd, Pipe& pipe) { SecureVector<byte> buffer(DEFAULT_BUFFERSIZE); @@ -31,9 +33,9 @@ int operator<<(int fd, Pipe& pipe) return fd; } -/************************************************* -* Read data from a Unix fd into a pipe * -*************************************************/ +/* +* Read data from a Unix fd into a pipe +*/ int operator>>(int fd, Pipe& pipe) { SecureVector<byte> buffer(DEFAULT_BUFFERSIZE); diff --git a/src/filters/fd_unix/fd_unix.h b/src/filters/fd_unix/fd_unix.h index cbe93dfe0..0aed0092c 100644 --- a/src/filters/fd_unix/fd_unix.h +++ b/src/filters/fd_unix/fd_unix.h @@ -1,7 +1,9 @@ -/************************************************* -* Pipe I/O for Unix Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* Pipe I/O for Unix +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_PIPE_UNIXFD_H__ #define BOTAN_PIPE_UNIXFD_H__ @@ -10,9 +12,9 @@ namespace Botan { -/************************************************* -* Unix I/O Operators for Pipe * -*************************************************/ +/* +* Unix I/O Operators for Pipe +*/ int operator<<(int, Pipe&); int operator>>(int, Pipe&); diff --git a/src/filters/filter.cpp b/src/filters/filter.cpp index 27170ed65..4bf0ef912 100644 --- a/src/filters/filter.cpp +++ b/src/filters/filter.cpp @@ -1,7 +1,9 @@ -/************************************************* -* Filter Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* Filter +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/filter.h> #include <botan/secqueue.h> @@ -9,9 +11,9 @@ namespace Botan { -/************************************************* -* Filter Constructor * -*************************************************/ +/* +* Filter Constructor +*/ Filter::Filter() { next.resize(1); @@ -20,9 +22,9 @@ Filter::Filter() owned = false; } -/************************************************* -* Send data to all ports * -*************************************************/ +/* +* Send data to all ports +*/ void Filter::send(const byte input[], u32bit length) { bool nothing_attached = true; @@ -40,9 +42,9 @@ void Filter::send(const byte input[], u32bit length) write_queue.destroy(); } -/************************************************* -* Start a new message * -*************************************************/ +/* +* Start a new message +*/ void Filter::new_msg() { start_msg(); @@ -51,9 +53,9 @@ void Filter::new_msg() next[j]->new_msg(); } -/************************************************* -* End the current message * -*************************************************/ +/* +* End the current message +*/ void Filter::finish_msg() { end_msg(); @@ -62,9 +64,9 @@ void Filter::finish_msg() next[j]->finish_msg(); } -/************************************************* -* Attach a filter to the current port * -*************************************************/ +/* +* Attach a filter to the current port +*/ void Filter::attach(Filter* new_filter) { if(new_filter) @@ -76,9 +78,9 @@ void Filter::attach(Filter* new_filter) } } -/************************************************* -* Set the active port on a filter * -*************************************************/ +/* +* Set the active port on a filter +*/ void Filter::set_port(u32bit new_port) { if(new_port >= total_ports()) @@ -86,9 +88,9 @@ void Filter::set_port(u32bit new_port) port_num = new_port; } -/************************************************* -* Return the next Filter in the logical chain * -*************************************************/ +/* +* Return the next Filter in the logical chain +*/ Filter* Filter::get_next() const { if(port_num < next.size()) @@ -96,9 +98,9 @@ Filter* Filter::get_next() const return 0; } -/************************************************* -* Set the next Filters * -*************************************************/ +/* +* Set the next Filters +*/ void Filter::set_next(Filter* filters[], u32bit size) { while(size && filters && filters[size-1] == 0) @@ -114,9 +116,9 @@ void Filter::set_next(Filter* filters[], u32bit size) next[j] = filters[j]; } -/************************************************* -* Return the total number of ports * -*************************************************/ +/* +* Return the total number of ports +*/ u32bit Filter::total_ports() const { return next.size(); diff --git a/src/filters/filter.h b/src/filters/filter.h index 0a235978d..b13a36650 100644 --- a/src/filters/filter.h +++ b/src/filters/filter.h @@ -1,7 +1,9 @@ -/************************************************* -* Filter Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* Filter +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_FILTER_H__ #define BOTAN_FILTER_H__ diff --git a/src/filters/filters.h b/src/filters/filters.h index a7e502d10..725651f7d 100644 --- a/src/filters/filters.h +++ b/src/filters/filters.h @@ -1,7 +1,9 @@ -/************************************************* -* Filters Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* Filters +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_FILTERS_H__ #define BOTAN_FILTERS_H__ diff --git a/src/filters/out_buf.cpp b/src/filters/out_buf.cpp index 392592705..6002f4fef 100644 --- a/src/filters/out_buf.cpp +++ b/src/filters/out_buf.cpp @@ -1,16 +1,18 @@ -/************************************************* -* Pipe Output Buffer Source file * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* Pipe Output Buffer Source file +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/out_buf.h> #include <botan/secqueue.h> namespace Botan { -/************************************************* -* Read data from a message * -*************************************************/ +/* +* Read data from a message +*/ u32bit Output_Buffers::read(byte output[], u32bit length, Pipe::message_id msg) { @@ -20,9 +22,9 @@ u32bit Output_Buffers::read(byte output[], u32bit length, return 0; } -/************************************************* -* Peek at data in a message * -*************************************************/ +/* +* Peek at data in a message +*/ u32bit Output_Buffers::peek(byte output[], u32bit length, u32bit stream_offset, Pipe::message_id msg) const @@ -33,9 +35,9 @@ u32bit Output_Buffers::peek(byte output[], u32bit length, return 0; } -/************************************************* -* Check available bytes in a message * -*************************************************/ +/* +* Check available bytes in a message +*/ u32bit Output_Buffers::remaining(Pipe::message_id msg) const { SecureQueue* q = get(msg); @@ -44,9 +46,9 @@ u32bit Output_Buffers::remaining(Pipe::message_id msg) const return 0; } -/************************************************* -* Add a new output queue * -*************************************************/ +/* +* Add a new output queue +*/ void Output_Buffers::add(SecureQueue* queue) { if(!queue) @@ -58,9 +60,9 @@ void Output_Buffers::add(SecureQueue* queue) buffers.push_back(queue); } -/************************************************* -* Retire old output queues * -*************************************************/ +/* +* Retire old output queues +*/ void Output_Buffers::retire() { while(buffers.size()) @@ -76,9 +78,9 @@ void Output_Buffers::retire() } } -/************************************************* -* Get a particular output queue * -*************************************************/ +/* +* Get a particular output queue +*/ SecureQueue* Output_Buffers::get(Pipe::message_id msg) const { if(msg < offset) @@ -89,25 +91,25 @@ SecureQueue* Output_Buffers::get(Pipe::message_id msg) const return buffers[msg-offset]; } -/************************************************* -* Return the total number of messages * -*************************************************/ +/* +* Return the total number of messages +*/ Pipe::message_id Output_Buffers::message_count() const { return (offset + buffers.size()); } -/************************************************* -* Output_Buffers Constructor * -*************************************************/ +/* +* Output_Buffers Constructor +*/ Output_Buffers::Output_Buffers() { offset = 0; } -/************************************************* -* Output_Buffers Destructor * -*************************************************/ +/* +* Output_Buffers Destructor +*/ Output_Buffers::~Output_Buffers() { for(u32bit j = 0; j != buffers.size(); ++j) diff --git a/src/filters/out_buf.h b/src/filters/out_buf.h index 103ea6cd7..0baacda20 100644 --- a/src/filters/out_buf.h +++ b/src/filters/out_buf.h @@ -1,7 +1,9 @@ -/************************************************* -* Output Buffer Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* Output Buffer +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_OUTPUT_BUFFER_H__ #define BOTAN_OUTPUT_BUFFER_H__ @@ -12,9 +14,9 @@ namespace Botan { -/************************************************* -* Container of output buffers for Pipe * -*************************************************/ +/* +* Container of output buffers for Pipe +*/ class BOTAN_DLL Output_Buffers { public: diff --git a/src/filters/pbe.h b/src/filters/pbe.h index 805acb342..f06d593d0 100644 --- a/src/filters/pbe.h +++ b/src/filters/pbe.h @@ -1,7 +1,9 @@ -/************************************************* -* PBE Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* PBE +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_PBE_BASE_H__ #define BOTAN_PBE_BASE_H__ diff --git a/src/filters/pipe.cpp b/src/filters/pipe.cpp index 228dc3a22..33824be24 100644 --- a/src/filters/pipe.cpp +++ b/src/filters/pipe.cpp @@ -1,7 +1,9 @@ -/************************************************* -* Pipe Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* Pipe +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/pipe.h> #include <botan/out_buf.h> @@ -10,9 +12,9 @@ namespace Botan { -/************************************************* -* Constructor for Invalid_Message_Number * -*************************************************/ +/* +* Constructor for Invalid_Message_Number +*/ Pipe::Invalid_Message_Number::Invalid_Message_Number(const std::string& where, message_id msg) { @@ -22,9 +24,9 @@ Pipe::Invalid_Message_Number::Invalid_Message_Number(const std::string& where, namespace { -/************************************************* -* A Filter that does nothing * -*************************************************/ +/* +* A Filter that does nothing +*/ class Null_Filter : public Filter { public: @@ -34,9 +36,9 @@ class Null_Filter : public Filter } -/************************************************* -* Pipe Constructor * -*************************************************/ +/* +* Pipe Constructor +*/ Pipe::Pipe(Filter* f1, Filter* f2, Filter* f3, Filter* f4) { init(); @@ -46,9 +48,9 @@ Pipe::Pipe(Filter* f1, Filter* f2, Filter* f3, Filter* f4) append(f4); } -/************************************************* -* Pipe Constructor * -*************************************************/ +/* +* Pipe Constructor +*/ Pipe::Pipe(Filter* filter_array[], u32bit count) { init(); @@ -56,18 +58,18 @@ Pipe::Pipe(Filter* filter_array[], u32bit count) append(filter_array[j]); } -/************************************************* -* Pipe Destructor * -*************************************************/ +/* +* Pipe Destructor +*/ Pipe::~Pipe() { destruct(pipe); delete outputs; } -/************************************************* -* Initialize the Pipe * -*************************************************/ +/* +* Initialize the Pipe +*/ void Pipe::init() { outputs = new Output_Buffers; @@ -76,9 +78,9 @@ void Pipe::init() inside_msg = false; } -/************************************************* -* Reset the Pipe * -*************************************************/ +/* +* Reset the Pipe +*/ void Pipe::reset() { if(inside_msg) @@ -88,9 +90,9 @@ void Pipe::reset() inside_msg = false; } -/************************************************* -* Destroy the Pipe * -*************************************************/ +/* +* Destroy the Pipe +*/ void Pipe::destruct(Filter* to_kill) { if(!to_kill || dynamic_cast<SecureQueue*>(to_kill)) @@ -100,17 +102,17 @@ void Pipe::destruct(Filter* to_kill) delete to_kill; } -/************************************************* -* Test if the Pipe has any data in it * -*************************************************/ +/* +* Test if the Pipe has any data in it +*/ bool Pipe::end_of_data() const { return (remaining() == 0); } -/************************************************* -* Set the default read message * -*************************************************/ +/* +* Set the default read message +*/ void Pipe::set_default_msg(message_id msg) { if(msg >= message_count()) @@ -118,9 +120,9 @@ void Pipe::set_default_msg(message_id msg) default_read = msg; } -/************************************************* -* Process a full message at once * -*************************************************/ +/* +* Process a full message at once +*/ void Pipe::process_msg(const byte input[], u32bit length) { start_msg(); @@ -128,25 +130,25 @@ void Pipe::process_msg(const byte input[], u32bit length) end_msg(); } -/************************************************* -* Process a full message at once * -*************************************************/ +/* +* Process a full message at once +*/ void Pipe::process_msg(const MemoryRegion<byte>& input) { process_msg(input.begin(), input.size()); } -/************************************************* -* Process a full message at once * -*************************************************/ +/* +* Process a full message at once +*/ void Pipe::process_msg(const std::string& input) { process_msg(reinterpret_cast<const byte*>(input.data()), input.length()); } -/************************************************* -* Process a full message at once * -*************************************************/ +/* +* Process a full message at once +*/ void Pipe::process_msg(DataSource& input) { start_msg(); @@ -154,9 +156,9 @@ void Pipe::process_msg(DataSource& input) end_msg(); } -/************************************************* -* Start a new message * -*************************************************/ +/* +* Start a new message +*/ void Pipe::start_msg() { if(inside_msg) @@ -168,9 +170,9 @@ void Pipe::start_msg() inside_msg = true; } -/************************************************* -* End the current message * -*************************************************/ +/* +* End the current message +*/ void Pipe::end_msg() { if(!inside_msg) @@ -187,9 +189,9 @@ void Pipe::end_msg() outputs->retire(); } -/************************************************* -* Find the endpoints of the Pipe * -*************************************************/ +/* +* Find the endpoints of the Pipe +*/ void Pipe::find_endpoints(Filter* f) { for(u32bit j = 0; j != f->total_ports(); ++j) @@ -203,9 +205,9 @@ void Pipe::find_endpoints(Filter* f) } } -/************************************************* -* Remove the SecureQueues attached to the Filter * -*************************************************/ +/* +* Remove the SecureQueues attached to the Filter +*/ void Pipe::clear_endpoints(Filter* f) { if(!f) return; @@ -217,9 +219,9 @@ void Pipe::clear_endpoints(Filter* f) } } -/************************************************* -* Append a Filter to the Pipe * -*************************************************/ +/* +* Append a Filter to the Pipe +*/ void Pipe::append(Filter* filter) { if(inside_msg) @@ -237,9 +239,9 @@ void Pipe::append(Filter* filter) else pipe->attach(filter); } -/************************************************* -* Prepend a Filter to the Pipe * -*************************************************/ +/* +* Prepend a Filter to the Pipe +*/ void Pipe::prepend(Filter* filter) { if(inside_msg) @@ -257,9 +259,9 @@ void Pipe::prepend(Filter* filter) pipe = filter; } -/************************************************* -* Pop a Filter off the Pipe * -*************************************************/ +/* +* Pop a Filter off the Pipe +*/ void Pipe::pop() { if(inside_msg) @@ -284,17 +286,17 @@ void Pipe::pop() } } -/************************************************* -* Return the number of messages in this Pipe * -*************************************************/ +/* +* Return the number of messages in this Pipe +*/ Pipe::message_id Pipe::message_count() const { return outputs->message_count(); } -/************************************************* -* Static Member Variables * -*************************************************/ +/* +* Static Member Variables +*/ const Pipe::message_id Pipe::LAST_MESSAGE = static_cast<Pipe::message_id>(-2); diff --git a/src/filters/pipe.h b/src/filters/pipe.h index a7ef13bc4..120f2fbdd 100644 --- a/src/filters/pipe.h +++ b/src/filters/pipe.h @@ -1,7 +1,9 @@ -/************************************************* -* Pipe Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* Pipe +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_PIPE_H__ #define BOTAN_PIPE_H__ @@ -258,9 +260,9 @@ class BOTAN_DLL Pipe : public DataSource bool inside_msg; }; -/************************************************* -* I/O Operators for Pipe * -*************************************************/ +/* +* I/O Operators for Pipe +*/ BOTAN_DLL std::ostream& operator<<(std::ostream&, Pipe&); BOTAN_DLL std::istream& operator>>(std::istream&, Pipe&); diff --git a/src/filters/pipe_io.cpp b/src/filters/pipe_io.cpp index 85b695e32..c57be6d53 100644 --- a/src/filters/pipe_io.cpp +++ b/src/filters/pipe_io.cpp @@ -1,16 +1,18 @@ -/************************************************* -* Pipe I/O Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* Pipe I/O +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/pipe.h> #include <iostream> namespace Botan { -/************************************************* -* Write data from a pipe into an ostream * -*************************************************/ +/* +* Write data from a pipe into an ostream +*/ std::ostream& operator<<(std::ostream& stream, Pipe& pipe) { SecureVector<byte> buffer(DEFAULT_BUFFERSIZE); @@ -24,9 +26,9 @@ std::ostream& operator<<(std::ostream& stream, Pipe& pipe) return stream; } -/************************************************* -* Read data from an istream into a pipe * -*************************************************/ +/* +* Read data from an istream into a pipe +*/ std::istream& operator>>(std::istream& stream, Pipe& pipe) { SecureVector<byte> buffer(DEFAULT_BUFFERSIZE); diff --git a/src/filters/pipe_rw.cpp b/src/filters/pipe_rw.cpp index 58d7dd1ad..41b57a716 100644 --- a/src/filters/pipe_rw.cpp +++ b/src/filters/pipe_rw.cpp @@ -1,7 +1,9 @@ -/************************************************* -* Pipe Reading/Writing Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* Pipe Reading/Writing +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/pipe.h> #include <botan/out_buf.h> @@ -9,9 +11,9 @@ namespace Botan { -/************************************************* -* Look up the canonical ID for a queue * -*************************************************/ +/* +* Look up the canonical ID for a queue +*/ Pipe::message_id Pipe::get_message_no(const std::string& func_name, message_id msg) const { @@ -26,9 +28,9 @@ Pipe::message_id Pipe::get_message_no(const std::string& func_name, return msg; } -/************************************************* -* Write into a Pipe * -*************************************************/ +/* +* Write into a Pipe +*/ void Pipe::write(const byte input[], u32bit length) { if(!inside_msg) @@ -36,33 +38,33 @@ void Pipe::write(const byte input[], u32bit length) pipe->write(input, length); } -/************************************************* -* Write into a Pipe * -*************************************************/ +/* +* Write into a Pipe +*/ void Pipe::write(const MemoryRegion<byte>& input) { write(input.begin(), input.size()); } -/************************************************* -* Write a string into a Pipe * -*************************************************/ +/* +* Write a string into a Pipe +*/ void Pipe::write(const std::string& str) { write(reinterpret_cast<const byte*>(str.data()), str.size()); } -/************************************************* -* Write a single byte into a Pipe * -*************************************************/ +/* +* Write a single byte into a Pipe +*/ void Pipe::write(byte input) { write(&input, 1); } -/************************************************* -* Write the contents of a DataSource into a Pipe * -*************************************************/ +/* +* Write the contents of a DataSource into a Pipe +*/ void Pipe::write(DataSource& source) { SecureVector<byte> buffer(DEFAULT_BUFFERSIZE); @@ -73,33 +75,33 @@ void Pipe::write(DataSource& source) } } -/************************************************* -* Read some data from the pipe * -*************************************************/ +/* +* Read some data from the pipe +*/ u32bit Pipe::read(byte output[], u32bit length, message_id msg) { return outputs->read(output, length, get_message_no("read", msg)); } -/************************************************* -* Read some data from the pipe * -*************************************************/ +/* +* Read some data from the pipe +*/ u32bit Pipe::read(byte output[], u32bit length) { return read(output, length, DEFAULT_MESSAGE); } -/************************************************* -* Read a single byte from the pipe * -*************************************************/ +/* +* Read a single byte from the pipe +*/ u32bit Pipe::read(byte& out, message_id msg) { return read(&out, 1, msg); } -/************************************************* -* Return all data in the pipe * -*************************************************/ +/* +* Return all data in the pipe +*/ SecureVector<byte> Pipe::read_all(message_id msg) { msg = ((msg != DEFAULT_MESSAGE) ? msg : default_msg()); @@ -108,9 +110,9 @@ SecureVector<byte> Pipe::read_all(message_id msg) return buffer; } -/************************************************* -* Return all data in the pipe as a string * -*************************************************/ +/* +* Return all data in the pipe as a string +*/ std::string Pipe::read_all_as_string(message_id msg) { msg = ((msg != DEFAULT_MESSAGE) ? msg : default_msg()); @@ -129,34 +131,34 @@ std::string Pipe::read_all_as_string(message_id msg) return str; } -/************************************************* -* Find out how many bytes are ready to read * -*************************************************/ +/* +* Find out how many bytes are ready to read +*/ u32bit Pipe::remaining(message_id msg) const { return outputs->remaining(get_message_no("remaining", msg)); } -/************************************************* -* Peek at some data in the pipe * -*************************************************/ +/* +* Peek at some data in the pipe +*/ u32bit Pipe::peek(byte output[], u32bit length, u32bit offset, message_id msg) const { return outputs->peek(output, length, offset, get_message_no("peek", msg)); } -/************************************************* -* Peek at some data in the pipe * -*************************************************/ +/* +* Peek at some data in the pipe +*/ u32bit Pipe::peek(byte output[], u32bit length, u32bit offset) const { return peek(output, length, offset, DEFAULT_MESSAGE); } -/************************************************* -* Peek at a byte in the pipe * -*************************************************/ +/* +* Peek at a byte in the pipe +*/ u32bit Pipe::peek(byte& out, u32bit offset, message_id msg) const { return peek(&out, 1, offset, msg); diff --git a/src/filters/secqueue.cpp b/src/filters/secqueue.cpp index d5b9a5f5f..f63ef898c 100644 --- a/src/filters/secqueue.cpp +++ b/src/filters/secqueue.cpp @@ -1,16 +1,18 @@ -/************************************************* -* SecureQueue Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* SecureQueue +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/secqueue.h> #include <algorithm> namespace Botan { -/************************************************* -* SecureQueueNode * -*************************************************/ +/* +* SecureQueueNode +*/ class SecureQueueNode { public: @@ -46,18 +48,18 @@ class SecureQueueNode u32bit start, end; }; -/************************************************* -* Create a SecureQueue * -*************************************************/ +/* +* Create a SecureQueue +*/ SecureQueue::SecureQueue() { set_next(0, 0); head = tail = new SecureQueueNode; } -/************************************************* -* Copy a SecureQueue * -*************************************************/ +/* +* Copy a SecureQueue +*/ SecureQueue::SecureQueue(const SecureQueue& input) : Fanout_Filter(), DataSource() { @@ -72,9 +74,9 @@ SecureQueue::SecureQueue(const SecureQueue& input) : } } -/************************************************* -* Destroy this SecureQueue * -*************************************************/ +/* +* Destroy this SecureQueue +*/ void SecureQueue::destroy() { SecureQueueNode* temp = head; @@ -87,9 +89,9 @@ void SecureQueue::destroy() head = tail = 0; } -/************************************************* -* Copy a SecureQueue * -*************************************************/ +/* +* Copy a SecureQueue +*/ SecureQueue& SecureQueue::operator=(const SecureQueue& input) { destroy(); @@ -103,9 +105,9 @@ SecureQueue& SecureQueue::operator=(const SecureQueue& input) return (*this); } -/************************************************* -* Add some bytes to the queue * -*************************************************/ +/* +* Add some bytes to the queue +*/ void SecureQueue::write(const byte input[], u32bit length) { if(!head) @@ -123,9 +125,9 @@ void SecureQueue::write(const byte input[], u32bit length) } } -/************************************************* -* Read some bytes from the queue * -*************************************************/ +/* +* Read some bytes from the queue +*/ u32bit SecureQueue::read(byte output[], u32bit length) { u32bit got = 0; @@ -145,9 +147,9 @@ u32bit SecureQueue::read(byte output[], u32bit length) return got; } -/************************************************* -* Read data, but do not remove it from queue * -*************************************************/ +/* +* Read data, but do not remove it from queue +*/ u32bit SecureQueue::peek(byte output[], u32bit length, u32bit offset) const { SecureQueueNode* current = head; @@ -176,9 +178,9 @@ u32bit SecureQueue::peek(byte output[], u32bit length, u32bit offset) const return got; } -/************************************************* -* Return how many bytes the queue holds * -*************************************************/ +/* +* Return how many bytes the queue holds +*/ u32bit SecureQueue::size() const { SecureQueueNode* current = head; @@ -192,9 +194,9 @@ u32bit SecureQueue::size() const return count; } -/************************************************* -* Test if the queue has any data in it * -*************************************************/ +/* +* Test if the queue has any data in it +*/ bool SecureQueue::end_of_data() const { return (size() == 0); diff --git a/src/filters/secqueue.h b/src/filters/secqueue.h index 71d902109..fc1fc213a 100644 --- a/src/filters/secqueue.h +++ b/src/filters/secqueue.h @@ -1,7 +1,9 @@ -/************************************************* -* SecureQueue Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* SecureQueue +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_SECURE_QUEUE_H__ #define BOTAN_SECURE_QUEUE_H__ @@ -11,9 +13,9 @@ namespace Botan { -/************************************************* -* SecureQueue * -*************************************************/ +/* +* SecureQueue +*/ class BOTAN_DLL SecureQueue : public Fanout_Filter, public DataSource { public: diff --git a/src/hash/fork256/fork256.cpp b/src/hash/fork256/fork256.cpp index dc023004d..070c7cf6c 100644 --- a/src/hash/fork256/fork256.cpp +++ b/src/hash/fork256/fork256.cpp @@ -1,7 +1,9 @@ -/************************************************* -* FORK-256 Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* FORK-256 +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/fork256.h> #include <botan/loadstor.h> @@ -11,9 +13,9 @@ namespace Botan { namespace { -/************************************************* -* FORK-256 Step Function * -*************************************************/ +/* +* FORK-256 Step Function +*/ inline void step(u32bit& A, u32bit& B, u32bit& C, u32bit& D, u32bit& E, u32bit& F, u32bit& G, u32bit& H, u32bit M1, u32bit M2, u32bit D1, u32bit D2) @@ -37,9 +39,9 @@ inline void step(u32bit& A, u32bit& B, u32bit& C, u32bit& D, } -/************************************************* -* FORK-256 Compression Function * -*************************************************/ +/* +* FORK-256 Compression Function +*/ void FORK_256::compress_n(const byte input[], u32bit blocks) { const u32bit DELTA[16] = { @@ -119,18 +121,18 @@ void FORK_256::compress_n(const byte input[], u32bit blocks) } } -/************************************************* -* Copy out the digest * -*************************************************/ +/* +* Copy out the digest +*/ void FORK_256::copy_out(byte output[]) { for(u32bit j = 0; j != OUTPUT_LENGTH; j += 4) store_be(digest[j/4], output + j); } -/************************************************* -* Clear memory of sensitive data * -*************************************************/ +/* +* Clear memory of sensitive data +*/ void FORK_256::clear() throw() { MDx_HashFunction::clear(); diff --git a/src/hash/fork256/fork256.h b/src/hash/fork256/fork256.h index d27e8693f..70d336cc9 100644 --- a/src/hash/fork256/fork256.h +++ b/src/hash/fork256/fork256.h @@ -1,7 +1,9 @@ -/************************************************* -* FORK-256 Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* FORK-256 +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_FORK_256_H__ #define BOTAN_FORK_256_H__ @@ -10,9 +12,9 @@ namespace Botan { -/************************************************* -* FORK-256 * -*************************************************/ +/* +* FORK-256 +*/ class BOTAN_DLL FORK_256 : public MDx_HashFunction { public: diff --git a/src/hash/has160/has160.cpp b/src/hash/has160/has160.cpp index f31016629..4441b0b43 100644 --- a/src/hash/has160/has160.cpp +++ b/src/hash/has160/has160.cpp @@ -1,7 +1,9 @@ -/************************************************* -* HAS-160 Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* HAS-160 +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/has160.h> #include <botan/loadstor.h> @@ -11,9 +13,9 @@ namespace Botan { namespace { -/************************************************* -* HAS-160 F1 Function * -*************************************************/ +/* +* HAS-160 F1 Function +*/ inline void F1(u32bit A, u32bit& B, u32bit C, u32bit D, u32bit& E, u32bit msg, u32bit rot) { @@ -21,9 +23,9 @@ inline void F1(u32bit A, u32bit& B, u32bit C, u32bit D, u32bit& E, B = rotate_left(B, 10); } -/************************************************* -* HAS-160 F2 Function * -*************************************************/ +/* +* HAS-160 F2 Function +*/ inline void F2(u32bit A, u32bit& B, u32bit C, u32bit D, u32bit& E, u32bit msg, u32bit rot) { @@ -31,9 +33,9 @@ inline void F2(u32bit A, u32bit& B, u32bit C, u32bit D, u32bit& E, B = rotate_left(B, 17); } -/************************************************* -* HAS-160 F3 Function * -*************************************************/ +/* +* HAS-160 F3 Function +*/ inline void F3(u32bit A, u32bit& B, u32bit C, u32bit D, u32bit& E, u32bit msg, u32bit rot) { @@ -41,9 +43,9 @@ inline void F3(u32bit A, u32bit& B, u32bit C, u32bit D, u32bit& E, B = rotate_left(B, 25); } -/************************************************* -* HAS-160 F4 Function * -*************************************************/ +/* +* HAS-160 F4 Function +*/ inline void F4(u32bit A, u32bit& B, u32bit C, u32bit D, u32bit& E, u32bit msg, u32bit rot) { @@ -53,9 +55,9 @@ inline void F4(u32bit A, u32bit& B, u32bit C, u32bit D, u32bit& E, } -/************************************************* -* HAS-160 Compression Function * -*************************************************/ +/* +* HAS-160 Compression Function +*/ void HAS_160::compress_n(const byte input[], u32bit blocks) { for(u32bit i = 0; i != blocks; ++i) @@ -131,18 +133,18 @@ void HAS_160::compress_n(const byte input[], u32bit blocks) } } -/************************************************* -* Copy out the digest * -*************************************************/ +/* +* Copy out the digest +*/ void HAS_160::copy_out(byte output[]) { for(u32bit j = 0; j != OUTPUT_LENGTH; j += 4) store_le(digest[j/4], output + j); } -/************************************************* -* Clear memory of sensitive data * -*************************************************/ +/* +* Clear memory of sensitive data +*/ void HAS_160::clear() throw() { MDx_HashFunction::clear(); diff --git a/src/hash/has160/has160.h b/src/hash/has160/has160.h index d3a422833..44bb63b9d 100644 --- a/src/hash/has160/has160.h +++ b/src/hash/has160/has160.h @@ -1,7 +1,9 @@ -/************************************************* -* HAS-160 Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* HAS-160 +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_HAS_160_H__ #define BOTAN_HAS_160_H__ @@ -10,9 +12,9 @@ namespace Botan { -/************************************************* -* HAS-160 * -*************************************************/ +/* +* HAS-160 +*/ class BOTAN_DLL HAS_160 : public MDx_HashFunction { public: diff --git a/src/hash/hash.h b/src/hash/hash.h index 08f1eb3dc..a30234be0 100644 --- a/src/hash/hash.h +++ b/src/hash/hash.h @@ -1,6 +1,8 @@ /** * Hash Function Base Class * (C) 1999-2008 Jack Lloyd +* +* Distributed under the terms of the Botan license */ #ifndef BOTAN_HASH_FUNCTION_BASE_CLASS_H__ diff --git a/src/hash/md2/md2.cpp b/src/hash/md2/md2.cpp index fbc40fa93..c67e72b5a 100644 --- a/src/hash/md2/md2.cpp +++ b/src/hash/md2/md2.cpp @@ -1,6 +1,8 @@ /* -* MD2 Source File +* MD2 * (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license */ #include <botan/md2.h> diff --git a/src/hash/md2/md2.h b/src/hash/md2/md2.h index 4d06c8872..9337c43f4 100644 --- a/src/hash/md2/md2.h +++ b/src/hash/md2/md2.h @@ -1,6 +1,8 @@ /* -* MD2 Header File +* MD2 * (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license */ #ifndef BOTAN_MD2_H__ diff --git a/src/hash/md4/md4.cpp b/src/hash/md4/md4.cpp index 83302f215..c0b52faa4 100644 --- a/src/hash/md4/md4.cpp +++ b/src/hash/md4/md4.cpp @@ -1,7 +1,9 @@ -/************************************************* -* MD4 Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* MD4 +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/md4.h> #include <botan/loadstor.h> @@ -11,27 +13,27 @@ namespace Botan { namespace { -/************************************************* -* MD4 FF Function * -*************************************************/ +/* +* MD4 FF Function +*/ inline void FF(u32bit& A, u32bit B, u32bit C, u32bit D, u32bit M, byte S) { A += (D ^ (B & (C ^ D))) + M; A = rotate_left(A, S); } -/************************************************* -* MD4 GG Function * -*************************************************/ +/* +* MD4 GG Function +*/ inline void GG(u32bit& A, u32bit B, u32bit C, u32bit D, u32bit M, byte S) { A += ((B & C) | (D & (B | C))) + M + 0x5A827999; A = rotate_left(A, S); } -/************************************************* -* MD4 HH Function * -*************************************************/ +/* +* MD4 HH Function +*/ inline void HH(u32bit& A, u32bit B, u32bit C, u32bit D, u32bit M, byte S) { A += (B ^ C ^ D) + M + 0x6ED9EBA1; @@ -40,9 +42,9 @@ inline void HH(u32bit& A, u32bit B, u32bit C, u32bit D, u32bit M, byte S) } -/************************************************* -* MD4 Compression Function * -*************************************************/ +/* +* MD4 Compression Function +*/ void MD4::compress_n(const byte input[], u32bit blocks) { u32bit A = digest[0], B = digest[1], C = digest[2], D = digest[3]; @@ -81,18 +83,18 @@ void MD4::compress_n(const byte input[], u32bit blocks) } } -/************************************************* -* Copy out the digest * -*************************************************/ +/* +* Copy out the digest +*/ void MD4::copy_out(byte output[]) { for(u32bit j = 0; j != OUTPUT_LENGTH; j += 4) store_le(digest[j/4], output + j); } -/************************************************* -* Clear memory of sensitive data * -*************************************************/ +/* +* Clear memory of sensitive data +*/ void MD4::clear() throw() { MDx_HashFunction::clear(); diff --git a/src/hash/md4/md4.h b/src/hash/md4/md4.h index 009bba640..df6f2292d 100644 --- a/src/hash/md4/md4.h +++ b/src/hash/md4/md4.h @@ -1,7 +1,9 @@ -/************************************************* -* MD4 Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* MD4 +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_MD4_H__ #define BOTAN_MD4_H__ @@ -10,9 +12,9 @@ namespace Botan { -/************************************************* -* MD4 * -*************************************************/ +/* +* MD4 +*/ class BOTAN_DLL MD4 : public MDx_HashFunction { public: diff --git a/src/hash/md4_ia32/md4_ia32.cpp b/src/hash/md4_ia32/md4_ia32.cpp index 6a4b47067..12fe71da4 100644 --- a/src/hash/md4_ia32/md4_ia32.cpp +++ b/src/hash/md4_ia32/md4_ia32.cpp @@ -1,7 +1,9 @@ -/************************************************* -* MD4 (IA-32) Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* MD4 (IA-32) +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/md4_ia32.h> #include <botan/loadstor.h> @@ -10,9 +12,9 @@ namespace Botan { extern "C" void botan_md4_ia32_compress(u32bit[4], const byte[64], u32bit[16]); -/************************************************* -* MD4 Compression Function * -*************************************************/ +/* +* MD4 Compression Function +*/ void MD4_IA32::compress_n(const byte input[], u32bit blocks) { for(u32bit i = 0; i != blocks; ++i) diff --git a/src/hash/md4_ia32/md4_ia32.h b/src/hash/md4_ia32/md4_ia32.h index e9798830d..f01d148f4 100644 --- a/src/hash/md4_ia32/md4_ia32.h +++ b/src/hash/md4_ia32/md4_ia32.h @@ -1,7 +1,9 @@ -/************************************************* -* MD4 (IA-32) Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* MD4 (IA-32) +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_MD4_IA32_H__ #define BOTAN_MD4_IA32_H__ @@ -10,9 +12,9 @@ namespace Botan { -/************************************************* -* MD4 * -*************************************************/ +/* +* MD4 +*/ class BOTAN_DLL MD4_IA32 : public MD4 { public: diff --git a/src/hash/md5/md5.cpp b/src/hash/md5/md5.cpp index 9a675850a..a5c614330 100644 --- a/src/hash/md5/md5.cpp +++ b/src/hash/md5/md5.cpp @@ -1,7 +1,9 @@ -/************************************************* -* MD5 Source File * -* (C) 1999-2008 Jack Lloyd * -*************************************************/ +/* +* MD5 +* (C) 1999-2008 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/md5.h> #include <botan/loadstor.h> @@ -11,9 +13,9 @@ namespace Botan { namespace { -/************************************************* -* MD5 FF Function * -*************************************************/ +/* +* MD5 FF Function +*/ inline void FF(u32bit& A, u32bit B, u32bit C, u32bit D, u32bit msg, byte S, u32bit magic) { @@ -21,9 +23,9 @@ inline void FF(u32bit& A, u32bit B, u32bit C, u32bit D, u32bit msg, A = rotate_left(A, S) + B; } -/************************************************* -* MD5 GG Function * -*************************************************/ +/* +* MD5 GG Function +*/ inline void GG(u32bit& A, u32bit B, u32bit C, u32bit D, u32bit msg, byte S, u32bit magic) { @@ -31,9 +33,9 @@ inline void GG(u32bit& A, u32bit B, u32bit C, u32bit D, u32bit msg, A = rotate_left(A, S) + B; } -/************************************************* -* MD5 HH Function * -*************************************************/ +/* +* MD5 HH Function +*/ inline void HH(u32bit& A, u32bit B, u32bit C, u32bit D, u32bit msg, byte S, u32bit magic) { @@ -41,9 +43,9 @@ inline void HH(u32bit& A, u32bit B, u32bit C, u32bit D, u32bit msg, A = rotate_left(A, S) + B; } -/************************************************* -* MD5 II Function * -*************************************************/ +/* +* MD5 II Function +*/ inline void II(u32bit& A, u32bit B, u32bit C, u32bit D, u32bit msg, byte S, u32bit magic) { @@ -53,9 +55,9 @@ inline void II(u32bit& A, u32bit B, u32bit C, u32bit D, u32bit msg, } -/************************************************* -* MD5 Compression Function * -*************************************************/ +/* +* MD5 Compression Function +*/ void MD5::compress_n(const byte input[], u32bit blocks) { u32bit A = digest[0], B = digest[1], C = digest[2], D = digest[3]; @@ -109,18 +111,18 @@ void MD5::compress_n(const byte input[], u32bit blocks) } } -/************************************************* -* Copy out the digest * -*************************************************/ +/* +* Copy out the digest +*/ void MD5::copy_out(byte output[]) { for(u32bit j = 0; j != OUTPUT_LENGTH; j += 4) store_le(digest[j/4], output + j); } -/************************************************* -* Clear memory of sensitive data * -*************************************************/ +/* +* Clear memory of sensitive data +*/ void MD5::clear() throw() { MDx_HashFunction::clear(); diff --git a/src/hash/md5/md5.h b/src/hash/md5/md5.h index 8ed72b044..85f684d8b 100644 --- a/src/hash/md5/md5.h +++ b/src/hash/md5/md5.h @@ -1,6 +1,8 @@ /** -* MD5 Header File +* MD5 * (C) 1999-2008 Jack Lloyd +* +* Distributed under the terms of the Botan license */ #ifndef BOTAN_MD5_H__ diff --git a/src/hash/md5_ia32/md5_ia32.cpp b/src/hash/md5_ia32/md5_ia32.cpp index 15fa7d3dc..443569b3b 100644 --- a/src/hash/md5_ia32/md5_ia32.cpp +++ b/src/hash/md5_ia32/md5_ia32.cpp @@ -1,7 +1,9 @@ -/************************************************* -* MD5 (IA-32) Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* MD5 (IA-32) +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/md5_ia32.h> #include <botan/loadstor.h> @@ -15,9 +17,9 @@ void botan_md5_ia32_compress(u32bit[4], const byte[64], u32bit[16]); } -/************************************************* -* MD5 Compression Function * -*************************************************/ +/* +* MD5 Compression Function +*/ void MD5_IA32::compress_n(const byte input[], u32bit blocks) { for(u32bit i = 0; i != blocks; ++i) diff --git a/src/hash/md5_ia32/md5_ia32.h b/src/hash/md5_ia32/md5_ia32.h index a5365aa58..723d724de 100644 --- a/src/hash/md5_ia32/md5_ia32.h +++ b/src/hash/md5_ia32/md5_ia32.h @@ -1,7 +1,9 @@ -/************************************************* -* MD5 (IA-32) Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* MD5 (IA-32) +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_MD5_IA32_H__ #define BOTAN_MD5_IA32_H__ @@ -10,9 +12,9 @@ namespace Botan { -/************************************************* -* MD5 * -*************************************************/ +/* +* MD5 +*/ class BOTAN_DLL MD5_IA32 : public MD5 { public: diff --git a/src/hash/mdx_hash/mdx_hash.cpp b/src/hash/mdx_hash/mdx_hash.cpp index 35a06d213..9d011b2d3 100644 --- a/src/hash/mdx_hash/mdx_hash.cpp +++ b/src/hash/mdx_hash/mdx_hash.cpp @@ -1,6 +1,8 @@ /** * Merkle-Damgard Hash Function * (C) 1999-2008 Jack Lloyd +* +* Distributed under the terms of the Botan license */ #include <botan/mdx_hash.h> diff --git a/src/hash/mdx_hash/mdx_hash.h b/src/hash/mdx_hash/mdx_hash.h index 484774aea..fc6b60f3f 100644 --- a/src/hash/mdx_hash/mdx_hash.h +++ b/src/hash/mdx_hash/mdx_hash.h @@ -1,6 +1,8 @@ /** -* MDx Hash Function Header File +* MDx Hash Function * (C) 1999-2008 Jack Lloyd +* +* Distributed under the terms of the Botan license */ #ifndef BOTAN_MDX_BASE_H__ diff --git a/src/hash/par_hash/par_hash.cpp b/src/hash/par_hash/par_hash.cpp index 67c4799ee..4b0c7c466 100644 --- a/src/hash/par_hash/par_hash.cpp +++ b/src/hash/par_hash/par_hash.cpp @@ -1,7 +1,9 @@ -/************************************************* -* Parallel Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* Parallel +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/par_hash.h> @@ -9,9 +11,9 @@ namespace Botan { namespace { -/************************************************* -* Return the sum of the hash sizes * -*************************************************/ +/* +* Return the sum of the hash sizes +*/ u32bit sum_of_hash_lengths(const std::vector<HashFunction*>& hashes) { u32bit sum = 0; @@ -24,18 +26,18 @@ u32bit sum_of_hash_lengths(const std::vector<HashFunction*>& hashes) } -/************************************************* -* Update the hash * -*************************************************/ +/* +* Update the hash +*/ void Parallel::add_data(const byte input[], u32bit length) { for(u32bit j = 0; j != hashes.size(); ++j) hashes[j]->update(input, length); } -/************************************************* -* Finalize the hash * -*************************************************/ +/* +* Finalize the hash +*/ void Parallel::final_result(byte hash[]) { u32bit offset = 0; @@ -46,9 +48,9 @@ void Parallel::final_result(byte hash[]) } } -/************************************************* -* Return the name of this type * -*************************************************/ +/* +* Return the name of this type +*/ std::string Parallel::name() const { std::string hash_names; @@ -61,9 +63,9 @@ std::string Parallel::name() const return "Parallel(" + hash_names + ")"; } -/************************************************* -* Return a clone of this object * -*************************************************/ +/* +* Return a clone of this object +*/ HashFunction* Parallel::clone() const { std::vector<HashFunction*> hash_copies; @@ -72,26 +74,26 @@ HashFunction* Parallel::clone() const return new Parallel(hash_copies); } -/************************************************* -* Clear memory of sensitive data * -*************************************************/ +/* +* Clear memory of sensitive data +*/ void Parallel::clear() throw() { for(u32bit j = 0; j != hashes.size(); ++j) hashes[j]->clear(); } -/************************************************* -* Parallel Constructor * -*************************************************/ +/* +* Parallel Constructor +*/ Parallel::Parallel(const std::vector<HashFunction*>& hash_in) : HashFunction(sum_of_hash_lengths(hash_in)), hashes(hash_in) { } -/************************************************* -* Parallel Destructor * -*************************************************/ +/* +* Parallel Destructor +*/ Parallel::~Parallel() { for(u32bit j = 0; j != hashes.size(); ++j) diff --git a/src/hash/par_hash/par_hash.h b/src/hash/par_hash/par_hash.h index 7d71dae11..7e75c27be 100644 --- a/src/hash/par_hash/par_hash.h +++ b/src/hash/par_hash/par_hash.h @@ -1,7 +1,9 @@ -/************************************************* -* Parallel Hash Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* Parallel Hash +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_PARALLEL_HASH_H__ #define BOTAN_PARALLEL_HASH_H__ @@ -11,9 +13,9 @@ namespace Botan { -/************************************************* -* Parallel * -*************************************************/ +/* +* Parallel +*/ class BOTAN_DLL Parallel : public HashFunction { public: diff --git a/src/hash/rmd128/rmd128.cpp b/src/hash/rmd128/rmd128.cpp index 52d0c5f56..b6d0a4590 100644 --- a/src/hash/rmd128/rmd128.cpp +++ b/src/hash/rmd128/rmd128.cpp @@ -1,7 +1,9 @@ -/************************************************* -* RIPEMD-128 Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* RIPEMD-128 +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/rmd128.h> #include <botan/loadstor.h> @@ -11,9 +13,9 @@ namespace Botan { namespace { -/************************************************* -* RIPEMD-128 F1 Function * -*************************************************/ +/* +* RIPEMD-128 F1 Function +*/ inline void F1(u32bit& A, u32bit B, u32bit C, u32bit D, u32bit msg, u32bit shift) { @@ -21,9 +23,9 @@ inline void F1(u32bit& A, u32bit B, u32bit C, u32bit D, A = rotate_left(A, shift); } -/************************************************* -* RIPEMD-128 F2 Function * -*************************************************/ +/* +* RIPEMD-128 F2 Function +*/ inline void F2(u32bit& A, u32bit B, u32bit C, u32bit D, u32bit msg, u32bit shift, u32bit magic) { @@ -31,9 +33,9 @@ inline void F2(u32bit& A, u32bit B, u32bit C, u32bit D, A = rotate_left(A, shift); } -/************************************************* -* RIPEMD-128 F3 Function * -*************************************************/ +/* +* RIPEMD-128 F3 Function +*/ inline void F3(u32bit& A, u32bit B, u32bit C, u32bit D, u32bit msg, u32bit shift, u32bit magic) { @@ -41,9 +43,9 @@ inline void F3(u32bit& A, u32bit B, u32bit C, u32bit D, A = rotate_left(A, shift); } -/************************************************* -* RIPEMD-128 F4 Function * -*************************************************/ +/* +* RIPEMD-128 F4 Function +*/ inline void F4(u32bit& A, u32bit B, u32bit C, u32bit D, u32bit msg, u32bit shift, u32bit magic) { @@ -53,9 +55,9 @@ inline void F4(u32bit& A, u32bit B, u32bit C, u32bit D, } -/************************************************* -* RIPEMD-128 Compression Function * -*************************************************/ +/* +* RIPEMD-128 Compression Function +*/ void RIPEMD_128::compress_n(const byte input[], u32bit blocks) { for(u32bit i = 0; i != blocks; ++i) @@ -145,18 +147,18 @@ void RIPEMD_128::compress_n(const byte input[], u32bit blocks) } } -/************************************************* -* Copy out the digest * -*************************************************/ +/* +* Copy out the digest +*/ void RIPEMD_128::copy_out(byte output[]) { for(u32bit j = 0; j != OUTPUT_LENGTH; j += 4) store_le(digest[j/4], output + j); } -/************************************************* -* Clear memory of sensitive data * -*************************************************/ +/* +* Clear memory of sensitive data +*/ void RIPEMD_128::clear() throw() { MDx_HashFunction::clear(); diff --git a/src/hash/rmd128/rmd128.h b/src/hash/rmd128/rmd128.h index 923b2bf80..031ae5746 100644 --- a/src/hash/rmd128/rmd128.h +++ b/src/hash/rmd128/rmd128.h @@ -1,7 +1,9 @@ -/************************************************* -* RIPEMD-128 Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* RIPEMD-128 +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_RIPEMD_128_H__ #define BOTAN_RIPEMD_128_H__ @@ -10,9 +12,9 @@ namespace Botan { -/************************************************* -* RIPEMD-128 * -*************************************************/ +/* +* RIPEMD-128 +*/ class BOTAN_DLL RIPEMD_128 : public MDx_HashFunction { public: diff --git a/src/hash/rmd160/rmd160.cpp b/src/hash/rmd160/rmd160.cpp index 249ce7fb1..3efbe674a 100644 --- a/src/hash/rmd160/rmd160.cpp +++ b/src/hash/rmd160/rmd160.cpp @@ -1,7 +1,9 @@ -/************************************************* -* RIPEMD-160 Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* RIPEMD-160 +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/rmd160.h> #include <botan/loadstor.h> @@ -11,9 +13,9 @@ namespace Botan { namespace { -/************************************************* -* RIPEMD-160 F1 Function * -*************************************************/ +/* +* RIPEMD-160 F1 Function +*/ inline void F1(u32bit& A, u32bit B, u32bit& C, u32bit D, u32bit E, u32bit msg, u32bit shift) { @@ -22,9 +24,9 @@ inline void F1(u32bit& A, u32bit B, u32bit& C, u32bit D, u32bit E, C = rotate_left(C, 10); } -/************************************************* -* RIPEMD-160 F2 Function * -*************************************************/ +/* +* RIPEMD-160 F2 Function +*/ inline void F2(u32bit& A, u32bit B, u32bit& C, u32bit D, u32bit E, u32bit msg, u32bit shift, u32bit magic) { @@ -33,9 +35,9 @@ inline void F2(u32bit& A, u32bit B, u32bit& C, u32bit D, u32bit E, C = rotate_left(C, 10); } -/************************************************* -* RIPEMD-160 F3 Function * -*************************************************/ +/* +* RIPEMD-160 F3 Function +*/ inline void F3(u32bit& A, u32bit B, u32bit& C, u32bit D, u32bit E, u32bit msg, u32bit shift, u32bit magic) { @@ -44,9 +46,9 @@ inline void F3(u32bit& A, u32bit B, u32bit& C, u32bit D, u32bit E, C = rotate_left(C, 10); } -/************************************************* -* RIPEMD-160 F4 Function * -*************************************************/ +/* +* RIPEMD-160 F4 Function +*/ inline void F4(u32bit& A, u32bit B, u32bit& C, u32bit D, u32bit E, u32bit msg, u32bit shift, u32bit magic) { @@ -55,9 +57,9 @@ inline void F4(u32bit& A, u32bit B, u32bit& C, u32bit D, u32bit E, C = rotate_left(C, 10); } -/************************************************* -* RIPEMD-160 F5 Function * -*************************************************/ +/* +* RIPEMD-160 F5 Function +*/ inline void F5(u32bit& A, u32bit B, u32bit& C, u32bit D, u32bit E, u32bit msg, u32bit shift, u32bit magic) { @@ -68,9 +70,9 @@ inline void F5(u32bit& A, u32bit B, u32bit& C, u32bit D, u32bit E, } -/************************************************* -* RIPEMD-160 Compression Function * -*************************************************/ +/* +* RIPEMD-160 Compression Function +*/ void RIPEMD_160::compress_n(const byte input[], u32bit blocks) { const u32bit MAGIC2 = 0x5A827999, MAGIC3 = 0x6ED9EBA1, @@ -182,18 +184,18 @@ void RIPEMD_160::compress_n(const byte input[], u32bit blocks) } } -/************************************************* -* Copy out the digest * -*************************************************/ +/* +* Copy out the digest +*/ void RIPEMD_160::copy_out(byte output[]) { for(u32bit j = 0; j != OUTPUT_LENGTH; j += 4) store_le(digest[j/4], output + j); } -/************************************************* -* Clear memory of sensitive data * -*************************************************/ +/* +* Clear memory of sensitive data +*/ void RIPEMD_160::clear() throw() { MDx_HashFunction::clear(); diff --git a/src/hash/rmd160/rmd160.h b/src/hash/rmd160/rmd160.h index 939fe5668..f2babc582 100644 --- a/src/hash/rmd160/rmd160.h +++ b/src/hash/rmd160/rmd160.h @@ -1,7 +1,9 @@ -/************************************************* -* RIPEMD-160 Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* RIPEMD-160 +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_RIPEMD_160_H__ #define BOTAN_RIPEMD_160_H__ @@ -10,9 +12,9 @@ namespace Botan { -/************************************************* -* RIPEMD-160 * -*************************************************/ +/* +* RIPEMD-160 +*/ class BOTAN_DLL RIPEMD_160 : public MDx_HashFunction { public: diff --git a/src/hash/sha1/sha160.cpp b/src/hash/sha1/sha160.cpp index 231dbeb12..58a800c9f 100644 --- a/src/hash/sha1/sha160.cpp +++ b/src/hash/sha1/sha160.cpp @@ -1,7 +1,9 @@ -/************************************************* -* SHA-160 Source File * -* (C) 1999-2008 Jack Lloyd * -*************************************************/ +/* +* SHA-160 +* (C) 1999-2008 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/sha160.h> #include <botan/loadstor.h> @@ -11,36 +13,36 @@ namespace Botan { namespace { -/************************************************* -* SHA-160 F1 Function * -*************************************************/ +/* +* SHA-160 F1 Function +*/ inline void F1(u32bit A, u32bit& B, u32bit C, u32bit D, u32bit& E, u32bit msg) { E += (D ^ (B & (C ^ D))) + msg + 0x5A827999 + rotate_left(A, 5); B = rotate_left(B, 30); } -/************************************************* -* SHA-160 F2 Function * -*************************************************/ +/* +* SHA-160 F2 Function +*/ inline void F2(u32bit A, u32bit& B, u32bit C, u32bit D, u32bit& E, u32bit msg) { E += (B ^ C ^ D) + msg + 0x6ED9EBA1 + rotate_left(A, 5); B = rotate_left(B, 30); } -/************************************************* -* SHA-160 F3 Function * -*************************************************/ +/* +* SHA-160 F3 Function +*/ inline void F3(u32bit A, u32bit& B, u32bit C, u32bit D, u32bit& E, u32bit msg) { E += ((B & C) | ((B | C) & D)) + msg + 0x8F1BBCDC + rotate_left(A, 5); B = rotate_left(B, 30); } -/************************************************* -* SHA-160 F4 Function * -*************************************************/ +/* +* SHA-160 F4 Function +*/ inline void F4(u32bit A, u32bit& B, u32bit C, u32bit D, u32bit& E, u32bit msg) { E += (B ^ C ^ D) + msg + 0xCA62C1D6 + rotate_left(A, 5); @@ -49,9 +51,9 @@ inline void F4(u32bit A, u32bit& B, u32bit C, u32bit D, u32bit& E, u32bit msg) } -/************************************************* -* SHA-160 Compression Function * -*************************************************/ +/* +* SHA-160 Compression Function +*/ void SHA_160::compress_n(const byte input[], u32bit blocks) { u32bit A = digest[0], B = digest[1], C = digest[2], @@ -116,18 +118,18 @@ void SHA_160::compress_n(const byte input[], u32bit blocks) } } -/************************************************* -* Copy out the digest * -*************************************************/ +/* +* Copy out the digest +*/ void SHA_160::copy_out(byte output[]) { for(u32bit j = 0; j != OUTPUT_LENGTH; j += 4) store_be(digest[j/4], output + j); } -/************************************************* -* Clear memory of sensitive data * -*************************************************/ +/* +* Clear memory of sensitive data +*/ void SHA_160::clear() throw() { MDx_HashFunction::clear(); @@ -139,18 +141,18 @@ void SHA_160::clear() throw() digest[4] = 0xC3D2E1F0; } -/************************************************* -* SHA_160 Constructor * -*************************************************/ +/* +* SHA_160 Constructor +*/ SHA_160::SHA_160() : MDx_HashFunction(20, 64, true, true), W(80) { clear(); } -/************************************************* -* SHA_160 Constructor * -*************************************************/ +/* +* SHA_160 Constructor +*/ SHA_160::SHA_160(u32bit W_size) : MDx_HashFunction(20, 64, true, true), W(W_size) { diff --git a/src/hash/sha1/sha160.h b/src/hash/sha1/sha160.h index 640a8a683..232cf0322 100644 --- a/src/hash/sha1/sha160.h +++ b/src/hash/sha1/sha160.h @@ -1,7 +1,9 @@ -/************************************************* -* SHA-160 Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* SHA-160 +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_SHA_160_H__ #define BOTAN_SHA_160_H__ @@ -10,9 +12,9 @@ namespace Botan { -/************************************************* -* SHA-160 * -*************************************************/ +/* +* SHA-160 +*/ class BOTAN_DLL SHA_160 : public MDx_HashFunction { public: diff --git a/src/hash/sha1_amd64/sha1_amd64.cpp b/src/hash/sha1_amd64/sha1_amd64.cpp index f69c1fdd0..0efbd8559 100644 --- a/src/hash/sha1_amd64/sha1_amd64.cpp +++ b/src/hash/sha1_amd64/sha1_amd64.cpp @@ -1,7 +1,9 @@ -/************************************************* -* SHA-160 Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* SHA-160 +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/sha1_amd64.h> @@ -14,9 +16,9 @@ void botan_sha160_amd64_compress(u32bit[5], const byte[64], u32bit[80]); } -/************************************************* -* SHA-160 Compression Function * -*************************************************/ +/* +* SHA-160 Compression Function +*/ void SHA_160_AMD64::compress_n(const byte input[], u32bit blocks) { for(u32bit i = 0; i != blocks; ++i) diff --git a/src/hash/sha1_amd64/sha1_amd64.h b/src/hash/sha1_amd64/sha1_amd64.h index 38a83e4de..f182627a8 100644 --- a/src/hash/sha1_amd64/sha1_amd64.h +++ b/src/hash/sha1_amd64/sha1_amd64.h @@ -1,7 +1,9 @@ -/************************************************* -* SHA-160 (x86-64) Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* SHA-160 (x86-64) +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_SHA_160_AMD64_H__ #define BOTAN_SHA_160_AMD64_H__ @@ -10,9 +12,9 @@ namespace Botan { -/************************************************* -* SHA-160 * -*************************************************/ +/* +* SHA-160 +*/ class BOTAN_DLL SHA_160_AMD64 : public SHA_160 { public: diff --git a/src/hash/sha1_ia32/sha1_ia32.cpp b/src/hash/sha1_ia32/sha1_ia32.cpp index 5c3e56a73..0fa0b6bf2 100644 --- a/src/hash/sha1_ia32/sha1_ia32.cpp +++ b/src/hash/sha1_ia32/sha1_ia32.cpp @@ -1,7 +1,9 @@ -/************************************************* -* SHA-160 (IA-32) Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* SHA-160 (IA-32) +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/sha1_ia32.h> #include <botan/loadstor.h> @@ -15,9 +17,9 @@ void botan_sha160_ia32_compress(u32bit[5], const byte[64], u32bit[81]); } -/************************************************* -* SHA-160 Compression Function * -*************************************************/ +/* +* SHA-160 Compression Function +*/ void SHA_160_IA32::compress_n(const byte input[], u32bit blocks) { for(u32bit i = 0; i != blocks; ++i) diff --git a/src/hash/sha1_ia32/sha1_ia32.h b/src/hash/sha1_ia32/sha1_ia32.h index 403095f11..fd34971cb 100644 --- a/src/hash/sha1_ia32/sha1_ia32.h +++ b/src/hash/sha1_ia32/sha1_ia32.h @@ -1,7 +1,9 @@ -/************************************************* -* SHA-160 (IA-32) Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* SHA-160 (IA-32) +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_SHA_160_IA32_H__ #define BOTAN_SHA_160_IA32_H__ @@ -10,9 +12,9 @@ namespace Botan { -/************************************************* -* SHA-160 * -*************************************************/ +/* +* SHA-160 +*/ class BOTAN_DLL SHA_160_IA32 : public SHA_160 { public: diff --git a/src/hash/sha1_sse2/sha1_sse2.cpp b/src/hash/sha1_sse2/sha1_sse2.cpp index e2e0352fe..dddc06b7b 100644 --- a/src/hash/sha1_sse2/sha1_sse2.cpp +++ b/src/hash/sha1_sse2/sha1_sse2.cpp @@ -1,15 +1,17 @@ -/************************************************* -* SHA-160 (SSE2) Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* SHA-160 (SSE2) +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/sha1_sse2.h> namespace Botan { -/************************************************* -* SHA-160 Compression Function * -*************************************************/ +/* +* SHA-160 Compression Function +*/ void SHA_160_SSE2::compress_n(const byte input[], u32bit blocks) { for(u32bit i = 0; i != blocks; ++i) diff --git a/src/hash/sha1_sse2/sha1_sse2.h b/src/hash/sha1_sse2/sha1_sse2.h index 57348e461..0f8eebee9 100644 --- a/src/hash/sha1_sse2/sha1_sse2.h +++ b/src/hash/sha1_sse2/sha1_sse2.h @@ -1,7 +1,9 @@ -/************************************************* -* SHA-160 Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* SHA-160 +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_SHA_160_SSE2_H__ #define BOTAN_SHA_160_SSE2_H__ @@ -10,9 +12,9 @@ namespace Botan { -/************************************************* -* SHA-160 * -*************************************************/ +/* +* SHA-160 +*/ class BOTAN_DLL SHA_160_SSE2 : public SHA_160 { public: diff --git a/src/hash/sha1_sse2/sha1_sse2_imp.cpp b/src/hash/sha1_sse2/sha1_sse2_imp.cpp index b736938c8..90a8dccd5 100644 --- a/src/hash/sha1_sse2/sha1_sse2_imp.cpp +++ b/src/hash/sha1_sse2/sha1_sse2_imp.cpp @@ -1,24 +1,24 @@ /* this code is public domain. - * + * dean gaudet <[email protected]> - * + * this code was inspired by this paper: - * + * SHA: A Design for Parallel Architectures? * Antoon Bosselaers, Ren�e Govaerts and Joos Vandewalle * <http://www.esat.kuleuven.ac.be/~cosicart/pdf/AB-9700.pdf> - * + * more information available on this implementation here: - * + * http://arctic.org/~dean/crypto/sha1.html - * + * version: 2 */ /* * Lightly modified for Botan, tested under GCC 4.1.1 and ICC 9.1 * on a Linux/Core2 system. - * + */ #include <botan/sha1_sse2.h> #include <xmmintrin.h> diff --git a/src/hash/sha2/sha2_32.cpp b/src/hash/sha2/sha2_32.cpp index 52528e6fd..7c3114daf 100644 --- a/src/hash/sha2/sha2_32.cpp +++ b/src/hash/sha2/sha2_32.cpp @@ -1,8 +1,10 @@ -/************************************************* -* SHA-{224,256} Source File * -* (C) 1999-2008 Jack Lloyd * -* 2007 FlexSecure GmbH * -*************************************************/ +/* +* SHA-{224,256} +* (C) 1999-2008 Jack Lloyd +* 2007 FlexSecure GmbH +* +* Distributed under the terms of the Botan license +*/ #include <botan/sha2_32.h> #include <botan/loadstor.h> @@ -12,26 +14,26 @@ namespace Botan { namespace { -/************************************************* -* SHA-256 Rho Function * -*************************************************/ +/* +* SHA-256 Rho Function +*/ inline u32bit rho(u32bit X, u32bit rot1, u32bit rot2, u32bit rot3) { return (rotate_right(X, rot1) ^ rotate_right(X, rot2) ^ rotate_right(X, rot3)); } -/************************************************* -* SHA-256 Sigma Function * -*************************************************/ +/* +* SHA-256 Sigma Function +*/ inline u32bit sigma(u32bit X, u32bit rot1, u32bit rot2, u32bit shift) { return (rotate_right(X, rot1) ^ rotate_right(X, rot2) ^ (X >> shift)); } -/************************************************* -* SHA-256 F1 Function * -*************************************************/ +/* +* SHA-256 F1 Function +*/ inline void F1(u32bit A, u32bit B, u32bit C, u32bit& D, u32bit E, u32bit F, u32bit G, u32bit& H, u32bit msg, u32bit magic) @@ -43,9 +45,9 @@ inline void F1(u32bit A, u32bit B, u32bit C, u32bit& D, } -/************************************************* -* SHA-256 Compression Function * -*************************************************/ +/* +* SHA-256 Compression Function +*/ void SHA_224_256_BASE::compress_n(const byte input[], u32bit blocks) { u32bit A = digest[0], B = digest[1], C = digest[2], @@ -138,27 +140,27 @@ void SHA_224_256_BASE::compress_n(const byte input[], u32bit blocks) } } -/************************************************* -* Copy out the digest * -*************************************************/ +/* +* Copy out the digest +*/ void SHA_224_256_BASE::copy_out(byte output[]) { for(u32bit j = 0; j != OUTPUT_LENGTH; j += 4) store_be(digest[j/4], output + j); } -/************************************************* -* Clear memory of sensitive data * -*************************************************/ +/* +* Clear memory of sensitive data +*/ void SHA_224_256_BASE::clear() throw() { MDx_HashFunction::clear(); W.clear(); } -/************************************************* -* Clear memory of sensitive data * -*************************************************/ +/* +* Clear memory of sensitive data +*/ void SHA_224::clear() throw() { SHA_224_256_BASE::clear(); @@ -172,9 +174,9 @@ void SHA_224::clear() throw() digest[7] = 0xbefa4fa4; } -/************************************************* -* Clear memory of sensitive data * -*************************************************/ +/* +* Clear memory of sensitive data +*/ void SHA_256::clear() throw() { SHA_224_256_BASE::clear(); diff --git a/src/hash/sha2/sha2_32.h b/src/hash/sha2/sha2_32.h index f4c8d978a..05083d19d 100644 --- a/src/hash/sha2/sha2_32.h +++ b/src/hash/sha2/sha2_32.h @@ -1,8 +1,10 @@ -/************************************************* -* SHA-{224,256} Header File * -* (C) 1999-2008 Jack Lloyd * -* 2007 FlexSecure GmbH * -*************************************************/ +/* +* SHA-{224,256} +* (C) 1999-2008 Jack Lloyd +* 2007 FlexSecure GmbH +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_SHA_256_H__ #define BOTAN_SHA_256_H__ @@ -11,9 +13,9 @@ namespace Botan { -/************************************************* -* SHA-{224,256} Base * -*************************************************/ +/* +* SHA-{224,256} Base +*/ class BOTAN_DLL SHA_224_256_BASE : public MDx_HashFunction { protected: @@ -28,9 +30,9 @@ class BOTAN_DLL SHA_224_256_BASE : public MDx_HashFunction void copy_out(byte[]); }; -/************************************************* -* SHA-224 * -*************************************************/ +/* +* SHA-224 +*/ class BOTAN_DLL SHA_224 : public SHA_224_256_BASE { public: @@ -40,9 +42,9 @@ class BOTAN_DLL SHA_224 : public SHA_224_256_BASE SHA_224() : SHA_224_256_BASE(28) { clear(); } }; -/************************************************* -* SHA-256 * -*************************************************/ +/* +* SHA-256 +*/ class BOTAN_DLL SHA_256 : public SHA_224_256_BASE { public: diff --git a/src/hash/sha2/sha2_64.cpp b/src/hash/sha2/sha2_64.cpp index cafa06e53..dbbfc5a96 100644 --- a/src/hash/sha2/sha2_64.cpp +++ b/src/hash/sha2/sha2_64.cpp @@ -1,7 +1,9 @@ -/************************************************* -* SHA-{384,512} Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* SHA-{384,512} +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/sha2_64.h> #include <botan/loadstor.h> @@ -11,18 +13,18 @@ namespace Botan { namespace { -/************************************************* -* SHA-{384,512} Rho Function * -*************************************************/ +/* +* SHA-{384,512} Rho Function +*/ inline u64bit rho(u64bit X, u32bit rot1, u32bit rot2, u32bit rot3) { return (rotate_right(X, rot1) ^ rotate_right(X, rot2) ^ rotate_right(X, rot3)); } -/************************************************* -* SHA-{384,512} F1 Function * -*************************************************/ +/* +* SHA-{384,512} F1 Function +*/ inline void F1(u64bit A, u64bit B, u64bit C, u64bit& D, u64bit E, u64bit F, u64bit G, u64bit& H, u64bit msg, u64bit magic) @@ -32,9 +34,9 @@ inline void F1(u64bit A, u64bit B, u64bit C, u64bit& D, H += magic + rho(A, 28, 34, 39) + ((A & B) ^ (A & C) ^ (B & C)); } -/************************************************* -* SHA-{384,512} Sigma Function * -*************************************************/ +/* +* SHA-{384,512} Sigma Function +*/ inline u64bit sigma(u64bit X, u32bit rot1, u32bit rot2, u32bit shift) { return (rotate_right(X, rot1) ^ rotate_right(X, rot2) ^ (X >> shift)); @@ -42,9 +44,9 @@ inline u64bit sigma(u64bit X, u32bit rot1, u32bit rot2, u32bit shift) } -/************************************************* -* SHA-{384,512} Compression Function * -*************************************************/ +/* +* SHA-{384,512} Compression Function +*/ void SHA_384_512_BASE::compress_n(const byte input[], u32bit blocks) { u64bit A = digest[0], B = digest[1], C = digest[2], @@ -153,27 +155,27 @@ void SHA_384_512_BASE::compress_n(const byte input[], u32bit blocks) } } -/************************************************* -* Copy out the digest * -*************************************************/ +/* +* Copy out the digest +*/ void SHA_384_512_BASE::copy_out(byte output[]) { for(u32bit j = 0; j != OUTPUT_LENGTH; j += 8) store_be(digest[j/8], output + j); } -/************************************************* -* Clear memory of sensitive data * -*************************************************/ +/* +* Clear memory of sensitive data +*/ void SHA_384_512_BASE::clear() throw() { MDx_HashFunction::clear(); W.clear(); } -/************************************************* -* Clear memory of sensitive data * -*************************************************/ +/* +* Clear memory of sensitive data +*/ void SHA_384::clear() throw() { SHA_384_512_BASE::clear(); @@ -187,9 +189,9 @@ void SHA_384::clear() throw() digest[7] = 0x47B5481DBEFA4FA4; } -/************************************************* -* Clear memory of sensitive data * -*************************************************/ +/* +* Clear memory of sensitive data +*/ void SHA_512::clear() throw() { SHA_384_512_BASE::clear(); diff --git a/src/hash/sha2/sha2_64.h b/src/hash/sha2/sha2_64.h index 51efb455b..dcc6dc83b 100644 --- a/src/hash/sha2/sha2_64.h +++ b/src/hash/sha2/sha2_64.h @@ -1,7 +1,9 @@ -/************************************************* -* SHA-{384,512} Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* SHA-{384,512} +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_SHA_64BIT_H__ #define BOTAN_SHA_64BIT_H__ @@ -10,9 +12,9 @@ namespace Botan { -/************************************************* -* SHA-{384,512} Base * -*************************************************/ +/* +* SHA-{384,512} Base +*/ class BOTAN_DLL SHA_384_512_BASE : public MDx_HashFunction { protected: @@ -29,9 +31,9 @@ class BOTAN_DLL SHA_384_512_BASE : public MDx_HashFunction SecureBuffer<u64bit, 80> W; }; -/************************************************* -* SHA-384 * -*************************************************/ +/* +* SHA-384 +*/ class BOTAN_DLL SHA_384 : public SHA_384_512_BASE { public: @@ -41,9 +43,9 @@ class BOTAN_DLL SHA_384 : public SHA_384_512_BASE SHA_384() : SHA_384_512_BASE(48) { clear(); } }; -/************************************************* -* SHA-512 * -*************************************************/ +/* +* SHA-512 +*/ class BOTAN_DLL SHA_512 : public SHA_384_512_BASE { public: diff --git a/src/hash/tiger/tig_tab.cpp b/src/hash/tiger/tig_tab.cpp index 6d476f4b3..b76501d74 100644 --- a/src/hash/tiger/tig_tab.cpp +++ b/src/hash/tiger/tig_tab.cpp @@ -1,7 +1,9 @@ -/************************************************* -* S-Box Tables for Tiger * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* S-Box Tables for Tiger +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/tiger.h> diff --git a/src/hash/tiger/tiger.cpp b/src/hash/tiger/tiger.cpp index f8042075b..e46f2cb77 100644 --- a/src/hash/tiger/tiger.cpp +++ b/src/hash/tiger/tiger.cpp @@ -1,7 +1,9 @@ -/************************************************* -* Tiger Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* Tiger +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/tiger.h> #include <botan/exceptn.h> @@ -10,9 +12,9 @@ namespace Botan { -/************************************************* -* Tiger Compression Function * -*************************************************/ +/* +* Tiger Compression Function +*/ void Tiger::compress_n(const byte input[], u32bit blocks) { u64bit A = digest[0], B = digest[1], C = digest[2]; @@ -40,18 +42,18 @@ void Tiger::compress_n(const byte input[], u32bit blocks) } } -/************************************************* -* Copy out the digest * -*************************************************/ +/* +* Copy out the digest +*/ void Tiger::copy_out(byte output[]) { for(u32bit j = 0; j != OUTPUT_LENGTH; ++j) output[j] = get_byte(7 - (j % 8), digest[j/8]); } -/************************************************* -* Tiger Pass * -*************************************************/ +/* +* Tiger Pass +*/ void Tiger::pass(u64bit& A, u64bit& B, u64bit& C, u64bit X[8], byte mul) { C ^= X[0]; @@ -111,9 +113,9 @@ void Tiger::pass(u64bit& A, u64bit& B, u64bit& C, u64bit X[8], byte mul) C *= mul; } -/************************************************* -* Tiger Mixing Function * -*************************************************/ +/* +* Tiger Mixing Function +*/ void Tiger::mix(u64bit X[8]) { X[0] -= X[7] ^ 0xA5A5A5A5A5A5A5A5; X[1] ^= X[0]; @@ -124,9 +126,9 @@ void Tiger::mix(u64bit X[8]) X[6] += X[5]; X[7] -= X[6] ^ 0x0123456789ABCDEF; } -/************************************************* -* Clear memory of sensitive data * -*************************************************/ +/* +* Clear memory of sensitive data +*/ void Tiger::clear() throw() { MDx_HashFunction::clear(); @@ -136,17 +138,17 @@ void Tiger::clear() throw() digest[2] = 0xF096A5B4C3B2E187; } -/************************************************* -* Return the name of this type * -*************************************************/ +/* +* Return the name of this type +*/ std::string Tiger::name() const { return "Tiger(" + to_string(OUTPUT_LENGTH) + "," + to_string(PASS) + ")"; } -/************************************************* -* Tiger Constructor * -*************************************************/ +/* +* Tiger Constructor +*/ Tiger::Tiger(u32bit hashlen, u32bit pass) : MDx_HashFunction(hashlen, 64, false, false), PASS(pass) { diff --git a/src/hash/tiger/tiger.h b/src/hash/tiger/tiger.h index 4cbe1c419..63184a938 100644 --- a/src/hash/tiger/tiger.h +++ b/src/hash/tiger/tiger.h @@ -1,7 +1,9 @@ -/************************************************* -* Tiger Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* Tiger +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_TIGER_H__ #define BOTAN_TIGER_H__ @@ -10,9 +12,9 @@ namespace Botan { -/************************************************* -* Tiger * -*************************************************/ +/* +* Tiger +*/ class BOTAN_DLL Tiger : public MDx_HashFunction { public: diff --git a/src/hash/whirlpool/whrl_tab.cpp b/src/hash/whirlpool/whrl_tab.cpp index bd616ca27..cf670f308 100644 --- a/src/hash/whirlpool/whrl_tab.cpp +++ b/src/hash/whirlpool/whrl_tab.cpp @@ -1,7 +1,9 @@ -/************************************************* -* Diffusion Tables for Whirlpool * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* Diffusion Tables for Whirlpool +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/whrlpool.h> diff --git a/src/hash/whirlpool/whrlpool.cpp b/src/hash/whirlpool/whrlpool.cpp index b604f9400..8548d6192 100644 --- a/src/hash/whirlpool/whrlpool.cpp +++ b/src/hash/whirlpool/whrlpool.cpp @@ -1,16 +1,18 @@ -/************************************************* -* Whirlpool Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* Whirlpool +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/whrlpool.h> #include <botan/loadstor.h> namespace Botan { -/************************************************* -* Whirlpool Compression Function * -*************************************************/ +/* +* Whirlpool Compression Function +*/ void Whirlpool::compress_n(const byte in[], u32bit blocks) { static const u64bit RC[10] = { @@ -122,18 +124,18 @@ void Whirlpool::compress_n(const byte in[], u32bit blocks) } } -/************************************************* -* Copy out the digest * -*************************************************/ +/* +* Copy out the digest +*/ void Whirlpool::copy_out(byte output[]) { for(u32bit j = 0; j != OUTPUT_LENGTH; j += 8) store_be(digest[j/8], output + j); } -/************************************************* -* Clear memory of sensitive data * -*************************************************/ +/* +* Clear memory of sensitive data +*/ void Whirlpool::clear() throw() { MDx_HashFunction::clear(); diff --git a/src/hash/whirlpool/whrlpool.h b/src/hash/whirlpool/whrlpool.h index 25a5bb34d..b72ff609f 100644 --- a/src/hash/whirlpool/whrlpool.h +++ b/src/hash/whirlpool/whrlpool.h @@ -1,7 +1,9 @@ -/************************************************* -* Whirlpool Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* Whirlpool +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_WHIRLPOOL_H__ #define BOTAN_WHIRLPOOL_H__ @@ -10,9 +12,9 @@ namespace Botan { -/************************************************* -* Whirlpool * -*************************************************/ +/* +* Whirlpool +*/ class BOTAN_DLL Whirlpool : public MDx_HashFunction { public: diff --git a/src/kdf/kdf.cpp b/src/kdf/kdf.cpp index a96f86e99..4be8475df 100644 --- a/src/kdf/kdf.cpp +++ b/src/kdf/kdf.cpp @@ -1,15 +1,17 @@ -/************************************************* -* KDF Base Class Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* KDF Base Class +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/kdf.h> namespace Botan { -/************************************************* -* Derive a key * -*************************************************/ +/* +* Derive a key +*/ SecureVector<byte> KDF::derive_key(u32bit key_len, const MemoryRegion<byte>& secret, const std::string& salt) const @@ -19,9 +21,9 @@ SecureVector<byte> KDF::derive_key(u32bit key_len, salt.length()); } -/************************************************* -* Derive a key * -*************************************************/ +/* +* Derive a key +*/ SecureVector<byte> KDF::derive_key(u32bit key_len, const MemoryRegion<byte>& secret, const byte salt[], u32bit salt_len) const @@ -30,9 +32,9 @@ SecureVector<byte> KDF::derive_key(u32bit key_len, salt, salt_len); } -/************************************************* -* Derive a key * -*************************************************/ +/* +* Derive a key +*/ SecureVector<byte> KDF::derive_key(u32bit key_len, const MemoryRegion<byte>& secret, const MemoryRegion<byte>& salt) const @@ -41,9 +43,9 @@ SecureVector<byte> KDF::derive_key(u32bit key_len, salt.begin(), salt.size()); } -/************************************************* -* Derive a key * -*************************************************/ +/* +* Derive a key +*/ SecureVector<byte> KDF::derive_key(u32bit key_len, const byte secret[], u32bit secret_len, const std::string& salt) const @@ -53,9 +55,9 @@ SecureVector<byte> KDF::derive_key(u32bit key_len, salt.length()); } -/************************************************* -* Derive a key * -*************************************************/ +/* +* Derive a key +*/ SecureVector<byte> KDF::derive_key(u32bit key_len, const byte secret[], u32bit secret_len, const byte salt[], u32bit salt_len) const diff --git a/src/kdf/kdf.h b/src/kdf/kdf.h index 7d0c1866b..aa6cd94cd 100644 --- a/src/kdf/kdf.h +++ b/src/kdf/kdf.h @@ -1,7 +1,9 @@ -/************************************************* -* KDF/MGF Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* KDF/MGF +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_KDF_BASE_H__ #define BOTAN_KDF_BASE_H__ @@ -11,9 +13,9 @@ namespace Botan { -/************************************************* -* Key Derivation Function * -*************************************************/ +/* +* Key Derivation Function +*/ class BOTAN_DLL KDF { public: @@ -35,9 +37,9 @@ class BOTAN_DLL KDF const byte[], u32bit) const = 0; }; -/************************************************* -* Mask Generation Function * -*************************************************/ +/* +* Mask Generation Function +*/ class BOTAN_DLL MGF { public: diff --git a/src/kdf/kdf1/kdf1.cpp b/src/kdf/kdf1/kdf1.cpp index 0ea375b30..539d9ed50 100644 --- a/src/kdf/kdf1/kdf1.cpp +++ b/src/kdf/kdf1/kdf1.cpp @@ -1,15 +1,17 @@ -/************************************************* -* KDF1 Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* KDF1 +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/kdf1.h> namespace Botan { -/************************************************* -* KDF1 Key Derivation Mechanism * -*************************************************/ +/* +* KDF1 Key Derivation Mechanism +*/ SecureVector<byte> KDF1::derive(u32bit, const byte secret[], u32bit secret_len, const byte P[], u32bit P_len) const diff --git a/src/kdf/kdf1/kdf1.h b/src/kdf/kdf1/kdf1.h index 6099bdd4b..d657cccc2 100644 --- a/src/kdf/kdf1/kdf1.h +++ b/src/kdf/kdf1/kdf1.h @@ -1,7 +1,9 @@ -/************************************************* -* KDF1 Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* KDF1 +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_KDF1_H__ #define BOTAN_KDF1_H__ @@ -11,9 +13,9 @@ namespace Botan { -/************************************************* -* KDF1 * -*************************************************/ +/* +* KDF1 +*/ class BOTAN_DLL KDF1 : public KDF { public: diff --git a/src/kdf/kdf2/kdf2.cpp b/src/kdf/kdf2/kdf2.cpp index fdeb09869..167f64436 100644 --- a/src/kdf/kdf2/kdf2.cpp +++ b/src/kdf/kdf2/kdf2.cpp @@ -1,16 +1,18 @@ -/************************************************* -* KDF2 Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* KDF2 +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/kdf2.h> #include <botan/loadstor.h> namespace Botan { -/************************************************* -* KDF2 Key Derivation Mechanism * -*************************************************/ +/* +* KDF2 Key Derivation Mechanism +*/ SecureVector<byte> KDF2::derive(u32bit out_len, const byte secret[], u32bit secret_len, const byte P[], u32bit P_len) const diff --git a/src/kdf/kdf2/kdf2.h b/src/kdf/kdf2/kdf2.h index 8aca285a6..f748bed0f 100644 --- a/src/kdf/kdf2/kdf2.h +++ b/src/kdf/kdf2/kdf2.h @@ -1,7 +1,9 @@ -/************************************************* -* KDF2 Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* KDF2 +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_KDF2_H__ #define BOTAN_KDF2_H__ @@ -11,9 +13,9 @@ namespace Botan { -/************************************************* -* KDF2 * -*************************************************/ +/* +* KDF2 +*/ class BOTAN_DLL KDF2 : public KDF { public: diff --git a/src/kdf/mgf1/mgf1.cpp b/src/kdf/mgf1/mgf1.cpp index c54675c1e..a26e33a9e 100644 --- a/src/kdf/mgf1/mgf1.cpp +++ b/src/kdf/mgf1/mgf1.cpp @@ -1,7 +1,9 @@ -/************************************************* -* MGF1 Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* MGF1 +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/mgf1.h> #include <botan/loadstor.h> @@ -12,9 +14,9 @@ namespace Botan { -/************************************************* -* MGF1 Mask Generation Function * -*************************************************/ +/* +* MGF1 Mask Generation Function +*/ void MGF1::mask(const byte in[], u32bit in_len, byte out[], u32bit out_len) const { @@ -36,18 +38,18 @@ void MGF1::mask(const byte in[], u32bit in_len, byte out[], } } -/************************************************* -* MGF1 Constructor * -*************************************************/ +/* +* MGF1 Constructor +*/ MGF1::MGF1(HashFunction* h) : hash(h) { if(!hash) throw Invalid_Argument("MGF1 given null hash object"); } -/************************************************* -* MGF1 Destructor * -*************************************************/ +/* +* MGF1 Destructor +*/ MGF1::~MGF1() { delete hash; diff --git a/src/kdf/mgf1/mgf1.h b/src/kdf/mgf1/mgf1.h index e5cbe1d0f..799ba7eed 100644 --- a/src/kdf/mgf1/mgf1.h +++ b/src/kdf/mgf1/mgf1.h @@ -1,7 +1,9 @@ -/************************************************* -* MGF1 Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* MGF1 +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_MGF1_H__ #define BOTAN_MGF1_H__ @@ -11,9 +13,9 @@ namespace Botan { -/************************************************* -* MGF1 (Mask Generation Function) * -*************************************************/ +/* +* MGF1 (Mask Generation Function) +*/ class BOTAN_DLL MGF1 : public MGF { public: diff --git a/src/kdf/ssl_prf/prf_ssl3.cpp b/src/kdf/ssl_prf/prf_ssl3.cpp index 3d4444613..2b67644d2 100644 --- a/src/kdf/ssl_prf/prf_ssl3.cpp +++ b/src/kdf/ssl_prf/prf_ssl3.cpp @@ -1,7 +1,9 @@ -/************************************************* -* SSLv3 PRF Source File * -* (C) 2004-2006 Jack Lloyd * -*************************************************/ +/* +* SSLv3 PRF +* (C) 2004-2006 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/prf_ssl3.h> #include <botan/symkey.h> @@ -14,9 +16,9 @@ namespace Botan { namespace { -/************************************************* -* Return the next inner hash * -*************************************************/ +/* +* Return the next inner hash +*/ OctetString next_hash(u32bit where, u32bit want, HashFunction& md5, HashFunction& sha1, const byte secret[], u32bit secret_len, @@ -42,9 +44,9 @@ OctetString next_hash(u32bit where, u32bit want, } -/************************************************* -* SSL3 PRF * -*************************************************/ +/* +* SSL3 PRF +*/ SecureVector<byte> SSL3_PRF::derive(u32bit key_len, const byte secret[], u32bit secret_len, const byte seed[], u32bit seed_len) const diff --git a/src/kdf/ssl_prf/prf_ssl3.h b/src/kdf/ssl_prf/prf_ssl3.h index b8f498832..165fc7c3c 100644 --- a/src/kdf/ssl_prf/prf_ssl3.h +++ b/src/kdf/ssl_prf/prf_ssl3.h @@ -1,7 +1,9 @@ -/************************************************* -* SSLv3 PRF Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* SSLv3 PRF +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_SSLV3_PRF_H__ #define BOTAN_SSLV3_PRF_H__ @@ -10,9 +12,9 @@ namespace Botan { -/************************************************* -* SSL3 PRF * -*************************************************/ +/* +* SSL3 PRF +*/ class BOTAN_DLL SSL3_PRF : public KDF { public: diff --git a/src/kdf/tls_prf/prf_tls.cpp b/src/kdf/tls_prf/prf_tls.cpp index 8f7063f9f..a04c9045d 100644 --- a/src/kdf/tls_prf/prf_tls.cpp +++ b/src/kdf/tls_prf/prf_tls.cpp @@ -1,7 +1,9 @@ -/************************************************* -* TLS PRF Source File * -* (C) 2004-2006 Jack Lloyd * -*************************************************/ +/* +* TLS PRF +* (C) 2004-2006 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/prf_tls.h> #include <botan/xor_buf.h> @@ -11,9 +13,9 @@ namespace Botan { -/************************************************* -* TLS PRF Constructor and Destructor * -*************************************************/ +/* +* TLS PRF Constructor and Destructor +*/ TLS_PRF::TLS_PRF() { hmac_md5 = new HMAC(new MD5); @@ -26,9 +28,9 @@ TLS_PRF::~TLS_PRF() delete hmac_sha1; } -/************************************************* -* TLS PRF * -*************************************************/ +/* +* TLS PRF +*/ SecureVector<byte> TLS_PRF::derive(u32bit key_len, const byte secret[], u32bit secret_len, const byte seed[], u32bit seed_len) const @@ -47,9 +49,9 @@ SecureVector<byte> TLS_PRF::derive(u32bit key_len, return key1; } -/************************************************* -* TLS PRF P_hash function * -*************************************************/ +/* +* TLS PRF P_hash function +*/ SecureVector<byte> TLS_PRF::P_hash(MessageAuthenticationCode* mac, u32bit len, const byte secret[], u32bit secret_len, diff --git a/src/kdf/tls_prf/prf_tls.h b/src/kdf/tls_prf/prf_tls.h index 7d29e883b..6b81c155f 100644 --- a/src/kdf/tls_prf/prf_tls.h +++ b/src/kdf/tls_prf/prf_tls.h @@ -1,7 +1,9 @@ -/************************************************* -* TLS v1.0 PRF Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* TLS v1.0 PRF +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_TLS_PRF_H__ #define BOTAN_TLS_PRF_H__ @@ -11,9 +13,9 @@ namespace Botan { -/************************************************* -* TLS PRF * -*************************************************/ +/* +* TLS PRF +*/ class BOTAN_DLL TLS_PRF : public KDF { public: diff --git a/src/kdf/x942_prf/prf_x942.cpp b/src/kdf/x942_prf/prf_x942.cpp index f0b578764..d9ee09d20 100644 --- a/src/kdf/x942_prf/prf_x942.cpp +++ b/src/kdf/x942_prf/prf_x942.cpp @@ -1,7 +1,9 @@ -/************************************************* -* X9.42 PRF Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* X9.42 PRF +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/prf_x942.h> #include <botan/der_enc.h> @@ -15,9 +17,9 @@ namespace Botan { namespace { -/************************************************* -* Encode an integer as an OCTET STRING * -*************************************************/ +/* +* Encode an integer as an OCTET STRING +*/ MemoryVector<byte> encode_x942_int(u32bit n) { byte n_buf[4] = { 0 }; @@ -27,9 +29,9 @@ MemoryVector<byte> encode_x942_int(u32bit n) } -/************************************************* -* X9.42 PRF * -*************************************************/ +/* +* X9.42 PRF +*/ SecureVector<byte> X942_PRF::derive(u32bit key_len, const byte secret[], u32bit secret_len, const byte salt[], u32bit salt_len) const @@ -75,9 +77,9 @@ SecureVector<byte> X942_PRF::derive(u32bit key_len, return key; } -/************************************************* -* X9.42 Constructor * -*************************************************/ +/* +* X9.42 Constructor +*/ X942_PRF::X942_PRF(const std::string& oid) { if(OIDS::have_oid(oid)) diff --git a/src/kdf/x942_prf/prf_x942.h b/src/kdf/x942_prf/prf_x942.h index 3b5bb93c0..f957566b0 100644 --- a/src/kdf/x942_prf/prf_x942.h +++ b/src/kdf/x942_prf/prf_x942.h @@ -1,7 +1,9 @@ -/************************************************* -* X9.42 PRF Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* X9.42 PRF +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_ANSI_X942_PRF_H__ #define BOTAN_ANSI_X942_PRF_H__ @@ -10,9 +12,9 @@ namespace Botan { -/************************************************* -* X9.42 PRF * -*************************************************/ +/* +* X9.42 PRF +*/ class BOTAN_DLL X942_PRF : public KDF { public: diff --git a/src/libstate/botan.h b/src/libstate/botan.h index db5e2217e..3fa131216 100644 --- a/src/libstate/botan.h +++ b/src/libstate/botan.h @@ -1,6 +1,8 @@ /** * A vague catch all include file for Botan * (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license */ #include <botan/init.h> diff --git a/src/libstate/get_enc.cpp b/src/libstate/get_enc.cpp index c34caf30b..ab4d15896 100644 --- a/src/libstate/get_enc.cpp +++ b/src/libstate/get_enc.cpp @@ -1,7 +1,9 @@ -/************************************************* -* PBKDF/EMSA/EME/KDF/MGF Retrieval Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* PBKDF/EMSA/EME/KDF/MGF Retrieval +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/lookup.h> #include <botan/libstate.h> @@ -78,9 +80,9 @@ namespace Botan { -/************************************************* -* Get a S2K algorithm by name * -*************************************************/ +/* +* Get a S2K algorithm by name +*/ S2K* get_s2k(const std::string& algo_spec) { SCAN_Name request(algo_spec); @@ -105,9 +107,9 @@ S2K* get_s2k(const std::string& algo_spec) throw Algorithm_Not_Found(algo_spec); } -/************************************************* -* Get an EMSA by name * -*************************************************/ +/* +* Get an EMSA by name +*/ EMSA* get_emsa(const std::string& algo_spec) { SCAN_Name request(algo_spec); @@ -162,9 +164,9 @@ EMSA* get_emsa(const std::string& algo_spec) throw Algorithm_Not_Found(algo_spec); } -/************************************************* -* Get an EME by name * -*************************************************/ +/* +* Get an EME by name +*/ EME* get_eme(const std::string& algo_spec) { SCAN_Name request(algo_spec); @@ -193,9 +195,9 @@ EME* get_eme(const std::string& algo_spec) throw Algorithm_Not_Found(algo_spec); } -/************************************************* -* Get an KDF by name * -*************************************************/ +/* +* Get an KDF by name +*/ KDF* get_kdf(const std::string& algo_spec) { SCAN_Name request(algo_spec); diff --git a/src/libstate/init.cpp b/src/libstate/init.cpp index 377055bd4..b908de6c7 100644 --- a/src/libstate/init.cpp +++ b/src/libstate/init.cpp @@ -1,6 +1,8 @@ /** -* Default Initialization Function Source File +* Default Initialization Function * (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license */ #include <botan/init.h> @@ -9,9 +11,9 @@ namespace Botan { -/************************************************* -* Library Initialization * -*************************************************/ +/* +* Library Initialization +*/ void LibraryInitializer::initialize(const std::string& arg_string) { bool thread_safe = false; @@ -62,9 +64,9 @@ void LibraryInitializer::initialize(const std::string& arg_string) } } -/************************************************* -* Library Shutdown * -*************************************************/ +/* +* Library Shutdown +*/ void LibraryInitializer::deinitialize() { set_global_state(0); diff --git a/src/libstate/init.h b/src/libstate/init.h index 1339d49a5..254f9458b 100644 --- a/src/libstate/init.h +++ b/src/libstate/init.h @@ -1,6 +1,8 @@ /** -* Library Initialization Header File +* Library Initialization * (C) 1999-2008 Jack Lloyd +* +* Distributed under the terms of the Botan license */ #ifndef BOTAN_LIBRARY_INITIALIZER_H__ diff --git a/src/libstate/libstate.cpp b/src/libstate/libstate.cpp index b75fbae88..3275c6493 100644 --- a/src/libstate/libstate.cpp +++ b/src/libstate/libstate.cpp @@ -1,7 +1,9 @@ -/************************************************* -* Library Internal/Global State Source File * -* (C) 1999-2008 Jack Lloyd * -*************************************************/ +/* +* Library Internal/Global State +* (C) 1999-2008 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/libstate.h> #include <botan/init.h> @@ -48,18 +50,18 @@ namespace Botan { -/************************************************* -* Botan's global state * -*************************************************/ +/* +* Botan's global state +*/ namespace { Library_State* global_lib_state = 0; } -/************************************************* -* Access the global state object * -*************************************************/ +/* +* Access the global state object +*/ Library_State& global_state() { /* Lazy initialization. Botan still needs to be deinitialized later @@ -71,17 +73,17 @@ Library_State& global_state() return (*global_lib_state); } -/************************************************* -* Set a new global state object * -*************************************************/ +/* +* Set a new global state object +*/ void set_global_state(Library_State* new_state) { delete swap_global_state(new_state); } -/************************************************* -* Swap two global state objects * -*************************************************/ +/* +* Swap two global state objects +*/ Library_State* swap_global_state(Library_State* new_state) { Library_State* old_state = global_lib_state; @@ -89,17 +91,17 @@ Library_State* swap_global_state(Library_State* new_state) return old_state; } -/************************************************* -* Get a new mutex object * -*************************************************/ +/* +* Get a new mutex object +*/ Mutex* Library_State::get_mutex() const { return mutex_factory->make(); } -/************************************************* -* Get an allocator by its name * -*************************************************/ +/* +* Get an allocator by its name +*/ Allocator* Library_State::get_allocator(const std::string& type) const { Mutex_Holder lock(allocator_lock); @@ -121,9 +123,9 @@ Allocator* Library_State::get_allocator(const std::string& type) const return cached_default_allocator; } -/************************************************* -* Create a new name to object mapping * -*************************************************/ +/* +* Create a new name to object mapping +*/ void Library_State::add_allocator(Allocator* allocator) { Mutex_Holder lock(allocator_lock); @@ -134,9 +136,9 @@ void Library_State::add_allocator(Allocator* allocator) alloc_factory[allocator->type()] = allocator; } -/************************************************* -* Set the default allocator type * -*************************************************/ +/* +* Set the default allocator type +*/ void Library_State::set_default_allocator(const std::string& type) { Mutex_Holder lock(allocator_lock); @@ -148,9 +150,9 @@ void Library_State::set_default_allocator(const std::string& type) cached_default_allocator = 0; } -/************************************************* -* Get a configuration value * -*************************************************/ +/* +* Get a configuration value +*/ std::string Library_State::get(const std::string& section, const std::string& key) const { @@ -160,9 +162,9 @@ std::string Library_State::get(const std::string& section, section + "/" + key, ""); } -/************************************************* -* See if a particular option has been set * -*************************************************/ +/* +* See if a particular option has been set +*/ bool Library_State::is_set(const std::string& section, const std::string& key) const { @@ -171,9 +173,9 @@ bool Library_State::is_set(const std::string& section, return search_map(config, section + "/" + key, false, true); } -/************************************************* -* Set a configuration value * -*************************************************/ +/* +* Set a configuration value +*/ void Library_State::set(const std::string& section, const std::string& key, const std::string& value, bool overwrite) { @@ -188,17 +190,17 @@ void Library_State::set(const std::string& section, const std::string& key, config[full_key] = value; } -/************************************************* -* Add an alias * -*************************************************/ +/* +* Add an alias +*/ void Library_State::add_alias(const std::string& key, const std::string& value) { set("alias", key, value); } -/************************************************* -* Dereference an alias to a fixed name * -*************************************************/ +/* +* Dereference an alias to a fixed name +*/ std::string Library_State::deref_alias(const std::string& key) const { std::string result = key; @@ -207,18 +209,18 @@ std::string Library_State::deref_alias(const std::string& key) const return result; } -/************************************************* -* Set/Add an option * -*************************************************/ +/* +* Set/Add an option +*/ void Library_State::set_option(const std::string key, const std::string& value) { set("conf", key, value); } -/************************************************* -* Get an option value * -*************************************************/ +/* +* Get an option value +*/ std::string Library_State::option(const std::string& key) const { return get("conf", key); @@ -234,9 +236,9 @@ Algorithm_Factory& Library_State::algorithm_factory() return *m_algorithm_factory; } -/************************************************* -* Load a set of modules * -*************************************************/ +/* +* Load a set of modules +*/ void Library_State::initialize(bool thread_safe) { if(mutex_factory) @@ -302,9 +304,9 @@ void Library_State::initialize(bool thread_safe) m_algorithm_factory = new Algorithm_Factory(engines, *mutex_factory); } -/************************************************* -* Library_State Constructor * -*************************************************/ +/* +* Library_State Constructor +*/ Library_State::Library_State() { mutex_factory = 0; @@ -313,9 +315,9 @@ Library_State::Library_State() m_algorithm_factory = 0; } -/************************************************* -* Library_State Destructor * -*************************************************/ +/* +* Library_State Destructor +*/ Library_State::~Library_State() { delete m_algorithm_factory; diff --git a/src/libstate/libstate.h b/src/libstate/libstate.h index e45d1a7f3..2493863a9 100644 --- a/src/libstate/libstate.h +++ b/src/libstate/libstate.h @@ -1,7 +1,9 @@ -/************************************************* -* Library Internal/Global State Header File * -* (C) 1999-2008 Jack Lloyd * -*************************************************/ +/* +* Library Internal/Global State +* (C) 1999-2008 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_LIB_STATE_H__ #define BOTAN_LIB_STATE_H__ @@ -16,9 +18,9 @@ namespace Botan { -/************************************************* -* Global State Container Base * -*************************************************/ +/* +* Global State Container Base +*/ class BOTAN_DLL Library_State { public: @@ -111,9 +113,9 @@ class BOTAN_DLL Library_State Algorithm_Factory* m_algorithm_factory; }; -/************************************************* -* Global State * -*************************************************/ +/* +* Global State +*/ BOTAN_DLL Library_State& global_state(); BOTAN_DLL void set_global_state(Library_State*); BOTAN_DLL Library_State* swap_global_state(Library_State*); diff --git a/src/libstate/look_pk.cpp b/src/libstate/look_pk.cpp index d72c1ce0f..8eb473858 100644 --- a/src/libstate/look_pk.cpp +++ b/src/libstate/look_pk.cpp @@ -1,34 +1,36 @@ -/************************************************* -* PK Algorithm Lookup Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* PK Algorithm Lookup +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/look_pk.h> #include <botan/lookup.h> namespace Botan { -/************************************************* -* Get a PK_Encryptor object * -*************************************************/ +/* +* Get a PK_Encryptor object +*/ PK_Encryptor* get_pk_encryptor(const PK_Encrypting_Key& key, const std::string& eme) { return new PK_Encryptor_MR_with_EME(key, get_eme(eme)); } -/************************************************* -* Get a PK_Decryptor object * -*************************************************/ +/* +* Get a PK_Decryptor object +*/ PK_Decryptor* get_pk_decryptor(const PK_Decrypting_Key& key, const std::string& eme) { return new PK_Decryptor_MR_with_EME(key, get_eme(eme)); } -/************************************************* -* Get a PK_Signer object * -*************************************************/ +/* +* Get a PK_Signer object +*/ PK_Signer* get_pk_signer(const PK_Signing_Key& key, const std::string& emsa, Signature_Format sig_format) @@ -38,9 +40,9 @@ PK_Signer* get_pk_signer(const PK_Signing_Key& key, return signer; } -/************************************************* -* Get a PK_Verifier object * -*************************************************/ +/* +* Get a PK_Verifier object +*/ PK_Verifier* get_pk_verifier(const PK_Verifying_with_MR_Key& key, const std::string& emsa, Signature_Format sig_format) @@ -50,9 +52,9 @@ PK_Verifier* get_pk_verifier(const PK_Verifying_with_MR_Key& key, return verifier; } -/************************************************* -* Get a PK_Verifier object * -*************************************************/ +/* +* Get a PK_Verifier object +*/ PK_Verifier* get_pk_verifier(const PK_Verifying_wo_MR_Key& key, const std::string& emsa, Signature_Format sig_format) @@ -62,9 +64,9 @@ PK_Verifier* get_pk_verifier(const PK_Verifying_wo_MR_Key& key, return verifier; } -/************************************************* -* Get a PK_Key_Agreement object * -*************************************************/ +/* +* Get a PK_Key_Agreement object +*/ PK_Key_Agreement* get_pk_kas(const PK_Key_Agreement_Key& key, const std::string& kdf) { diff --git a/src/libstate/look_pk.h b/src/libstate/look_pk.h index 926416a41..27b67dc5b 100644 --- a/src/libstate/look_pk.h +++ b/src/libstate/look_pk.h @@ -1,7 +1,9 @@ -/************************************************* -* PK Algorithm Lookup Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* PK Algorithm Lookup +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_PK_LOOKUP_H__ #define BOTAN_PK_LOOKUP_H__ diff --git a/src/libstate/lookup.cpp b/src/libstate/lookup.cpp index adf3d80ed..3b49116f6 100644 --- a/src/libstate/lookup.cpp +++ b/src/libstate/lookup.cpp @@ -1,7 +1,9 @@ -/************************************************* -* Algorithm Retrieval Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* Algorithm Retrieval +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/lookup.h> #include <botan/libstate.h> diff --git a/src/libstate/lookup.h b/src/libstate/lookup.h index a00cd3fb1..0f48dddfb 100644 --- a/src/libstate/lookup.h +++ b/src/libstate/lookup.h @@ -1,7 +1,9 @@ -/************************************************* -* Algorithm Lookup Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* Algorithm Lookup +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_LOOKUP_H__ #define BOTAN_LOOKUP_H__ @@ -20,9 +22,9 @@ namespace Botan { -/************************************************* -* Retrieve an object from the lookup table * -*************************************************/ +/* +* Retrieve an object from the lookup table +*/ // NOTE: these functions return internally stored objects, library // retains ownership @@ -38,9 +40,9 @@ retrieve_hash(const std::string&); BOTAN_DLL const MessageAuthenticationCode* retrieve_mac(const std::string&); -/************************************************* -* Get an algorithm object * -*************************************************/ +/* +* Get an algorithm object +*/ // NOTE: these functions create and return new objects, letting the // caller assume ownership of them @@ -80,9 +82,9 @@ BOTAN_DLL MessageAuthenticationCode* get_mac(const std::string& name); */ BOTAN_DLL S2K* get_s2k(const std::string& name); -/************************************************* -* Get an EMSA/EME/KDF/MGF function * -*************************************************/ +/* +* Get an EMSA/EME/KDF/MGF function +*/ // NOTE: these functions create and return new objects, letting the // caller assume ownership of them @@ -108,9 +110,9 @@ BOTAN_DLL EMSA* get_emsa(const std::string& name); */ BOTAN_DLL KDF* get_kdf(const std::string& name); -/************************************************* -* Get a cipher object * -*************************************************/ +/* +* Get a cipher object +*/ /** * Factory method for general symmetric cipher filters. @@ -184,9 +186,9 @@ BOTAN_DLL bool have_hash(const std::string& name); */ BOTAN_DLL bool have_mac(const std::string& name); -/************************************************* -* Query information about an algorithm * -*************************************************/ +/* +* Query information about an algorithm +*/ /** * Find out the block size of a certain symmetric algorithm. diff --git a/src/libstate/oid_lookup/oids.cpp b/src/libstate/oid_lookup/oids.cpp index 0823625ea..232c63360 100644 --- a/src/libstate/oid_lookup/oids.cpp +++ b/src/libstate/oid_lookup/oids.cpp @@ -1,7 +1,9 @@ -/************************************************* -* OID Registry Source File * -* (C) 1999-2008 Jack Lloyd * -*************************************************/ +/* +* OID Registry +* (C) 1999-2008 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/oids.h> #include <botan/libstate.h> @@ -10,9 +12,9 @@ namespace Botan { namespace OIDS { -/************************************************* -* Register an OID to string mapping * -*************************************************/ +/* +* Register an OID to string mapping +*/ void add_oid(const OID& oid, const std::string& name) { const std::string oid_str = oid.as_string(); @@ -23,9 +25,9 @@ void add_oid(const OID& oid, const std::string& name) global_state().set("str2oid", name, oid_str); } -/************************************************* -* Do an OID to string lookup * -*************************************************/ +/* +* Do an OID to string lookup +*/ std::string lookup(const OID& oid) { std::string name = global_state().get("oid2str", oid.as_string()); @@ -34,9 +36,9 @@ std::string lookup(const OID& oid) return name; } -/************************************************* -* Do a string to OID lookup * -*************************************************/ +/* +* Do a string to OID lookup +*/ OID lookup(const std::string& name) { std::string value = global_state().get("str2oid", name); @@ -53,17 +55,17 @@ OID lookup(const std::string& name) } } -/************************************************* -* Check to see if an OID exists in the table * -*************************************************/ +/* +* Check to see if an OID exists in the table +*/ bool have_oid(const std::string& name) { return global_state().is_set("str2oid", name); } -/************************************************* -* Check to see if an OID exists in the table * -*************************************************/ +/* +* Check to see if an OID exists in the table +*/ bool name_of(const OID& oid, const std::string& name) { return (oid == lookup(name)); diff --git a/src/libstate/oid_lookup/oids.h b/src/libstate/oid_lookup/oids.h index 0df95fb36..fdfe61f7c 100644 --- a/src/libstate/oid_lookup/oids.h +++ b/src/libstate/oid_lookup/oids.h @@ -1,7 +1,9 @@ -/************************************************* -* OID Registry Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* OID Registry +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_OIDS_H__ #define BOTAN_OIDS_H__ diff --git a/src/libstate/pk_engine.cpp b/src/libstate/pk_engine.cpp index 5904ce1f9..790ddcde4 100644 --- a/src/libstate/pk_engine.cpp +++ b/src/libstate/pk_engine.cpp @@ -1,7 +1,9 @@ -/************************************************* -* PK Engine Lookup Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* PK Engine Lookup +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/pk_engine.h> #include <botan/libstate.h> @@ -12,9 +14,9 @@ namespace Botan { namespace Engine_Core { #if defined(BOTAN_HAS_IF_PUBLIC_KEY_FAMILY) -/************************************************* -* Acquire an IF op * -*************************************************/ +/* +* Acquire an IF op +*/ IF_Operation* if_op(const BigInt& e, const BigInt& n, const BigInt& d, const BigInt& p, const BigInt& q, const BigInt& d1, const BigInt& d2, const BigInt& c) @@ -33,9 +35,9 @@ IF_Operation* if_op(const BigInt& e, const BigInt& n, const BigInt& d, #endif #if defined(BOTAN_HAS_DSA) -/************************************************* -* Acquire a DSA op * -*************************************************/ +/* +* Acquire a DSA op +*/ DSA_Operation* dsa_op(const DL_Group& group, const BigInt& y, const BigInt& x) { Algorithm_Factory::Engine_Iterator i(global_state().algorithm_factory()); @@ -52,9 +54,9 @@ DSA_Operation* dsa_op(const DL_Group& group, const BigInt& y, const BigInt& x) #endif #if defined(BOTAN_HAS_NYBERG_RUEPPEL) -/************************************************* -* Acquire a NR op * -*************************************************/ +/* +* Acquire a NR op +*/ NR_Operation* nr_op(const DL_Group& group, const BigInt& y, const BigInt& x) { Algorithm_Factory::Engine_Iterator i(global_state().algorithm_factory()); @@ -71,9 +73,9 @@ NR_Operation* nr_op(const DL_Group& group, const BigInt& y, const BigInt& x) #endif #if defined(BOTAN_HAS_ELGAMAL) -/************************************************* -* Acquire an ElGamal op * -*************************************************/ +/* +* Acquire an ElGamal op +*/ ELG_Operation* elg_op(const DL_Group& group, const BigInt& y, const BigInt& x) { Algorithm_Factory::Engine_Iterator i(global_state().algorithm_factory()); @@ -90,9 +92,9 @@ ELG_Operation* elg_op(const DL_Group& group, const BigInt& y, const BigInt& x) #endif #if defined(BOTAN_HAS_DIFFIE_HELLMAN) -/************************************************* -* Acquire a DH op * -*************************************************/ +/* +* Acquire a DH op +*/ DH_Operation* dh_op(const DL_Group& group, const BigInt& x) { Algorithm_Factory::Engine_Iterator i(global_state().algorithm_factory()); @@ -109,9 +111,9 @@ DH_Operation* dh_op(const DL_Group& group, const BigInt& x) #endif #if defined(BOTAN_HAS_ECDSA) -/************************************************* -* Acquire an ECDSA op * -*************************************************/ +/* +* Acquire an ECDSA op +*/ ECDSA_Operation* ecdsa_op(const EC_Domain_Params& dom_pars, const BigInt& priv_key, const PointGFp& pub_key) @@ -130,9 +132,9 @@ ECDSA_Operation* ecdsa_op(const EC_Domain_Params& dom_pars, #endif #if defined(BOTAN_HAS_ECKAEG) -/************************************************* -* Acquire a ECKAEG op * -*************************************************/ +/* +* Acquire a ECKAEG op +*/ ECKAEG_Operation* eckaeg_op(const EC_Domain_Params& dom_pars, const BigInt& priv_key, const PointGFp& pub_key) @@ -150,9 +152,9 @@ ECKAEG_Operation* eckaeg_op(const EC_Domain_Params& dom_pars, } #endif -/************************************************* -* Acquire a modular exponentiator * -*************************************************/ +/* +* Acquire a modular exponentiator +*/ Modular_Exponentiator* mod_exp(const BigInt& n, Power_Mod::Usage_Hints hints) { Algorithm_Factory::Engine_Iterator i(global_state().algorithm_factory()); diff --git a/src/libstate/pk_engine.h b/src/libstate/pk_engine.h index 4c54f46e1..3f8650a4e 100644 --- a/src/libstate/pk_engine.h +++ b/src/libstate/pk_engine.h @@ -1,6 +1,8 @@ /** * Engine for PK * (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license */ #ifndef BOTAN_ENGINE_PK_LOOKUP_H__ @@ -46,9 +48,9 @@ class Modular_Exponentiator; 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/libstate/policy.cpp b/src/libstate/policy.cpp index 0f6044790..dfc1dfc7a 100644 --- a/src/libstate/policy.cpp +++ b/src/libstate/policy.cpp @@ -1,7 +1,9 @@ -/************************************************* -* Default Policy Source File * -* (C) 1999-2008 Jack Lloyd * -*************************************************/ +/* +* Default Policy +* (C) 1999-2008 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/libstate.h> @@ -9,9 +11,9 @@ namespace Botan { namespace { -/************************************************* -* OID loading helper function * -*************************************************/ +/* +* OID loading helper function +*/ void add_oid(Library_State& config, const std::string& oid_str, const std::string& name) @@ -22,9 +24,9 @@ void add_oid(Library_State& config, config.set("str2oid", name, oid_str); } -/************************************************* -* Load all of the default OIDs * -*************************************************/ +/* +* Load all of the default OIDs +*/ void set_default_oids(Library_State& config) { /* Public key types */ @@ -185,9 +187,9 @@ void set_default_oids(Library_State& config) "CertificateHolderAuthorizationTemplate"); } -/************************************************* -* Set the default algorithm aliases * -*************************************************/ +/* +* Set the default algorithm aliases +*/ void set_default_aliases(Library_State& config) { config.add_alias("OpenPGP.Cipher.1", "IDEA"); @@ -228,9 +230,9 @@ void set_default_aliases(Library_State& config) config.add_alias("GOST", "GOST-28147-89"); } -/************************************************* -* Set the default configuration toggles * -*************************************************/ +/* +* Set the default configuration toggles +*/ void set_default_config(Library_State& config) { config.set_option("base/default_allocator", "malloc"); @@ -245,9 +247,9 @@ void set_default_config(Library_State& config) config.set_option("x509/exts/crl_number", "yes"); } -/************************************************* -* Set the built-in discrete log groups * -*************************************************/ +/* +* Set the built-in discrete log groups +*/ void set_default_dl_groups(Library_State& config) { config.set("dl", "modp/ietf/768", @@ -495,9 +497,9 @@ void set_default_dl_groups(Library_State& config) } } -/************************************************* -* Set the default policy * -*************************************************/ +/* +* Set the default policy +*/ void Library_State::load_default_config() { set_default_config(*this); diff --git a/src/mac/cbc_mac/cbc_mac.cpp b/src/mac/cbc_mac/cbc_mac.cpp index cbbf77991..f5d9e1567 100644 --- a/src/mac/cbc_mac/cbc_mac.cpp +++ b/src/mac/cbc_mac/cbc_mac.cpp @@ -1,7 +1,9 @@ -/************************************************* -* CBC-MAC Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* CBC-MAC +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/cbc_mac.h> #include <botan/xor_buf.h> @@ -9,9 +11,9 @@ namespace Botan { -/************************************************* -* Update an CBC-MAC Calculation * -*************************************************/ +/* +* Update an CBC-MAC Calculation +*/ void CBC_MAC::add_data(const byte input[], u32bit length) { u32bit xored = std::min(OUTPUT_LENGTH - position, length); @@ -36,9 +38,9 @@ void CBC_MAC::add_data(const byte input[], u32bit length) position = length; } -/************************************************* -* Finalize an CBC-MAC Calculation * -*************************************************/ +/* +* Finalize an CBC-MAC Calculation +*/ void CBC_MAC::final_result(byte mac[]) { if(position) @@ -49,17 +51,17 @@ void CBC_MAC::final_result(byte mac[]) position = 0; } -/************************************************* -* CBC-MAC Key Schedule * -*************************************************/ +/* +* CBC-MAC Key Schedule +*/ void CBC_MAC::key_schedule(const byte key[], u32bit length) { e->set_key(key, length); } -/************************************************* -* Clear memory of sensitive data * -*************************************************/ +/* +* Clear memory of sensitive data +*/ void CBC_MAC::clear() throw() { e->clear(); @@ -67,25 +69,25 @@ void CBC_MAC::clear() throw() position = 0; } -/************************************************* -* Return the name of this type * -*************************************************/ +/* +* Return the name of this type +*/ std::string CBC_MAC::name() const { return "CBC-MAC(" + e->name() + ")"; } -/************************************************* -* Return a clone of this object * -*************************************************/ +/* +* Return a clone of this object +*/ MessageAuthenticationCode* CBC_MAC::clone() const { return new CBC_MAC(e->clone()); } -/************************************************* -* CBC-MAC Constructor * -*************************************************/ +/* +* CBC-MAC Constructor +*/ CBC_MAC::CBC_MAC(BlockCipher* e_in) : MessageAuthenticationCode(e_in->BLOCK_SIZE, e_in->MINIMUM_KEYLENGTH, @@ -96,9 +98,9 @@ CBC_MAC::CBC_MAC(BlockCipher* e_in) : position = 0; } -/************************************************* -* CBC-MAC Destructor * -*************************************************/ +/* +* CBC-MAC Destructor +*/ CBC_MAC::~CBC_MAC() { delete e; diff --git a/src/mac/cbc_mac/cbc_mac.h b/src/mac/cbc_mac/cbc_mac.h index 1112970d6..d17d792d3 100644 --- a/src/mac/cbc_mac/cbc_mac.h +++ b/src/mac/cbc_mac/cbc_mac.h @@ -1,7 +1,9 @@ -/************************************************* -* CBC-MAC Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* CBC-MAC +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_CBC_MAC_H__ #define BOTAN_CBC_MAC_H__ @@ -11,9 +13,9 @@ namespace Botan { -/************************************************* -* CBC-MAC * -*************************************************/ +/* +* CBC-MAC +*/ class BOTAN_DLL CBC_MAC : public MessageAuthenticationCode { public: diff --git a/src/mac/cmac/cmac.cpp b/src/mac/cmac/cmac.cpp index bd3f174c1..84aa61e03 100644 --- a/src/mac/cmac/cmac.cpp +++ b/src/mac/cmac/cmac.cpp @@ -1,16 +1,18 @@ -/************************************************* -* CMAC Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* CMAC +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/cmac.h> #include <botan/xor_buf.h> namespace Botan { -/************************************************* -* Perform CMAC's multiplication in GF(2^n) * -*************************************************/ +/* +* Perform CMAC's multiplication in GF(2^n) +*/ SecureVector<byte> CMAC::poly_double(const MemoryRegion<byte>& in, byte polynomial) { @@ -32,9 +34,9 @@ SecureVector<byte> CMAC::poly_double(const MemoryRegion<byte>& in, return out; } -/************************************************* -* Update an CMAC Calculation * -*************************************************/ +/* +* Update an CMAC Calculation +*/ void CMAC::add_data(const byte input[], u32bit length) { buffer.copy(position, input, length); @@ -57,9 +59,9 @@ void CMAC::add_data(const byte input[], u32bit length) position += length; } -/************************************************* -* Finalize an CMAC Calculation * -*************************************************/ +/* +* Finalize an CMAC Calculation +*/ void CMAC::final_result(byte mac[]) { xor_buf(state, buffer, position); @@ -84,9 +86,9 @@ void CMAC::final_result(byte mac[]) position = 0; } -/************************************************* -* CMAC Key Schedule * -*************************************************/ +/* +* CMAC Key Schedule +*/ void CMAC::key_schedule(const byte key[], u32bit length) { clear(); @@ -96,9 +98,9 @@ void CMAC::key_schedule(const byte key[], u32bit length) P = poly_double(B, polynomial); } -/************************************************* -* Clear memory of sensitive data * -*************************************************/ +/* +* Clear memory of sensitive data +*/ void CMAC::clear() throw() { e->clear(); @@ -109,25 +111,25 @@ void CMAC::clear() throw() position = 0; } -/************************************************* -* Return the name of this type * -*************************************************/ +/* +* Return the name of this type +*/ std::string CMAC::name() const { return "CMAC(" + e->name() + ")"; } -/************************************************* -* Return a clone of this object * -*************************************************/ +/* +* Return a clone of this object +*/ MessageAuthenticationCode* CMAC::clone() const { return new CMAC(e->clone()); } -/************************************************* -* CMAC Constructor * -*************************************************/ +/* +* CMAC Constructor +*/ CMAC::CMAC(BlockCipher* e_in) : MessageAuthenticationCode(e_in->BLOCK_SIZE, e_in->MINIMUM_KEYLENGTH, @@ -149,9 +151,9 @@ CMAC::CMAC(BlockCipher* e_in) : position = 0; } -/************************************************* -* CMAC Destructor * -*************************************************/ +/* +* CMAC Destructor +*/ CMAC::~CMAC() { delete e; diff --git a/src/mac/cmac/cmac.h b/src/mac/cmac/cmac.h index 9f745ee22..5a6deb7b0 100644 --- a/src/mac/cmac/cmac.h +++ b/src/mac/cmac/cmac.h @@ -1,7 +1,9 @@ -/************************************************* -* CMAC Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* CMAC +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_CMAC_H__ #define BOTAN_CMAC_H__ @@ -11,9 +13,9 @@ namespace Botan { -/************************************************* -* CMAC * -*************************************************/ +/* +* CMAC +*/ class BOTAN_DLL CMAC : public MessageAuthenticationCode { public: diff --git a/src/mac/hmac/hmac.cpp b/src/mac/hmac/hmac.cpp index 15552b8ea..717e2640c 100644 --- a/src/mac/hmac/hmac.cpp +++ b/src/mac/hmac/hmac.cpp @@ -1,25 +1,27 @@ -/************************************************* -* HMAC Source File * -* (C) 1999-2007 Jack Lloyd * -* 2007 Yves Jerschow * -*************************************************/ +/* +* HMAC +* (C) 1999-2007 Jack Lloyd +* 2007 Yves Jerschow +* +* Distributed under the terms of the Botan license +*/ #include <botan/hmac.h> #include <botan/xor_buf.h> namespace Botan { -/************************************************* -* Update a HMAC Calculation * -*************************************************/ +/* +* Update a HMAC Calculation +*/ void HMAC::add_data(const byte input[], u32bit length) { hash->update(input, length); } -/************************************************* -* Finalize a HMAC Calculation * -*************************************************/ +/* +* Finalize a HMAC Calculation +*/ void HMAC::final_result(byte mac[]) { hash->final(mac); @@ -29,9 +31,9 @@ void HMAC::final_result(byte mac[]) hash->update(i_key); } -/************************************************* -* HMAC Key Schedule * -*************************************************/ +/* +* HMAC Key Schedule +*/ void HMAC::key_schedule(const byte key[], u32bit length) { hash->clear(); @@ -53,9 +55,9 @@ void HMAC::key_schedule(const byte key[], u32bit length) hash->update(i_key); } -/************************************************* -* Clear memory of sensitive data * -*************************************************/ +/* +* Clear memory of sensitive data +*/ void HMAC::clear() throw() { hash->clear(); @@ -63,25 +65,25 @@ void HMAC::clear() throw() o_key.clear(); } -/************************************************* -* Return the name of this type * -*************************************************/ +/* +* Return the name of this type +*/ std::string HMAC::name() const { return "HMAC(" + hash->name() + ")"; } -/************************************************* -* Return a clone of this object * -*************************************************/ +/* +* Return a clone of this object +*/ MessageAuthenticationCode* HMAC::clone() const { return new HMAC(hash->clone()); } -/************************************************* -* HMAC Constructor * -*************************************************/ +/* +* HMAC Constructor +*/ HMAC::HMAC(HashFunction* hash_in) : MessageAuthenticationCode(hash_in->OUTPUT_LENGTH, 1, 2*hash_in->HASH_BLOCK_SIZE), diff --git a/src/mac/hmac/hmac.h b/src/mac/hmac/hmac.h index c3081edfd..932af71fc 100644 --- a/src/mac/hmac/hmac.h +++ b/src/mac/hmac/hmac.h @@ -1,7 +1,9 @@ -/************************************************* -* HMAC Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* HMAC +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_HMAC_H__ #define BOTAN_HMAC_H__ @@ -11,9 +13,9 @@ namespace Botan { -/************************************************* -* HMAC * -*************************************************/ +/* +* HMAC +*/ class BOTAN_DLL HMAC : public MessageAuthenticationCode { public: diff --git a/src/mac/mac.cpp b/src/mac/mac.cpp index 63be1ea17..96df25503 100644 --- a/src/mac/mac.cpp +++ b/src/mac/mac.cpp @@ -1,6 +1,8 @@ /** Message Authentication Code base class (C) 1999-2008 Jack Lloyd +* +* Distributed under the terms of the Botan license */ #include <botan/mac.h> diff --git a/src/mac/mac.h b/src/mac/mac.h index ff5939f6e..3ec5fff5f 100644 --- a/src/mac/mac.h +++ b/src/mac/mac.h @@ -1,6 +1,8 @@ /** * Base class for message authentiction codes * (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license */ #ifndef BOTAN_MESSAGE_AUTH_CODE_BASE_H__ diff --git a/src/mac/ssl3mac/ssl3_mac.cpp b/src/mac/ssl3mac/ssl3_mac.cpp index 8bd22a779..c29296ced 100644 --- a/src/mac/ssl3mac/ssl3_mac.cpp +++ b/src/mac/ssl3mac/ssl3_mac.cpp @@ -1,23 +1,25 @@ -/************************************************* -* SSL3-MAC Source File * -* (C) 1999-2004 Jack Lloyd * -*************************************************/ +/* +* SSL3-MAC +* (C) 1999-2004 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/ssl3_mac.h> namespace Botan { -/************************************************* -* Update a SSL3-MAC Calculation * -*************************************************/ +/* +* Update a SSL3-MAC Calculation +*/ void SSL3_MAC::add_data(const byte input[], u32bit length) { hash->update(input, length); } -/************************************************* -* Finalize a SSL3-MAC Calculation * -*************************************************/ +/* +* Finalize a SSL3-MAC Calculation +*/ void SSL3_MAC::final_result(byte mac[]) { hash->final(mac); @@ -27,9 +29,9 @@ void SSL3_MAC::final_result(byte mac[]) hash->update(i_key); } -/************************************************* -* SSL3-MAC Key Schedule * -*************************************************/ +/* +* SSL3-MAC Key Schedule +*/ void SSL3_MAC::key_schedule(const byte key[], u32bit length) { hash->clear(); @@ -41,9 +43,9 @@ void SSL3_MAC::key_schedule(const byte key[], u32bit length) hash->update(i_key); } -/************************************************* -* Clear memory of sensitive data * -*************************************************/ +/* +* Clear memory of sensitive data +*/ void SSL3_MAC::clear() throw() { hash->clear(); @@ -51,25 +53,25 @@ void SSL3_MAC::clear() throw() o_key.clear(); } -/************************************************* -* Return the name of this type * -*************************************************/ +/* +* Return the name of this type +*/ std::string SSL3_MAC::name() const { return "SSL3-MAC(" + hash->name() + ")"; } -/************************************************* -* Return a clone of this object * -*************************************************/ +/* +* Return a clone of this object +*/ MessageAuthenticationCode* SSL3_MAC::clone() const { return new SSL3_MAC(hash->clone()); } -/************************************************* -* SSL3-MAC Constructor * -*************************************************/ +/* +* SSL3-MAC Constructor +*/ SSL3_MAC::SSL3_MAC(HashFunction* hash_in) : MessageAuthenticationCode(hash_in->OUTPUT_LENGTH, hash_in->OUTPUT_LENGTH), diff --git a/src/mac/ssl3mac/ssl3_mac.h b/src/mac/ssl3mac/ssl3_mac.h index fad9e74cd..dcaf7f404 100644 --- a/src/mac/ssl3mac/ssl3_mac.h +++ b/src/mac/ssl3mac/ssl3_mac.h @@ -1,7 +1,9 @@ -/************************************************* -* SSL3-MAC Header File * -* (C) 1999-2004 Jack Lloyd * -*************************************************/ +/* +* SSL3-MAC +* (C) 1999-2004 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_SSL3_MAC_H__ #define BOTAN_SSL3_MAC_H__ @@ -11,9 +13,9 @@ namespace Botan { -/************************************************* -* SSL3-MAC * -*************************************************/ +/* +* SSL3-MAC +*/ class BOTAN_DLL SSL3_MAC : public MessageAuthenticationCode { public: diff --git a/src/mac/x919_mac/x919_mac.cpp b/src/mac/x919_mac/x919_mac.cpp index 9db32c8a2..ef89cac9c 100644 --- a/src/mac/x919_mac/x919_mac.cpp +++ b/src/mac/x919_mac/x919_mac.cpp @@ -1,7 +1,9 @@ -/************************************************* -* ANSI X9.19 MAC Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* ANSI X9.19 MAC +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/x919_mac.h> #include <botan/xor_buf.h> @@ -9,9 +11,9 @@ namespace Botan { -/************************************************* -* Update an ANSI X9.19 MAC Calculation * -*************************************************/ +/* +* Update an ANSI X9.19 MAC Calculation +*/ void ANSI_X919_MAC::add_data(const byte input[], u32bit length) { u32bit xored = std::min(8 - position, length); @@ -35,9 +37,9 @@ void ANSI_X919_MAC::add_data(const byte input[], u32bit length) position = length; } -/************************************************* -* Finalize an ANSI X9.19 MAC Calculation * -*************************************************/ +/* +* Finalize an ANSI X9.19 MAC Calculation +*/ void ANSI_X919_MAC::final_result(byte mac[]) { if(position) @@ -48,9 +50,9 @@ void ANSI_X919_MAC::final_result(byte mac[]) position = 0; } -/************************************************* -* ANSI X9.19 MAC Key Schedule * -*************************************************/ +/* +* ANSI X9.19 MAC Key Schedule +*/ void ANSI_X919_MAC::key_schedule(const byte key[], u32bit length) { e->set_key(key, 8); @@ -58,9 +60,9 @@ void ANSI_X919_MAC::key_schedule(const byte key[], u32bit length) else d->set_key(key + 8, 8); } -/************************************************* -* Clear memory of sensitive data * -*************************************************/ +/* +* Clear memory of sensitive data +*/ void ANSI_X919_MAC::clear() throw() { e->clear(); @@ -79,9 +81,9 @@ MessageAuthenticationCode* ANSI_X919_MAC::clone() const return new ANSI_X919_MAC(e->clone()); } -/************************************************* -* ANSI X9.19 MAC Constructor * -*************************************************/ +/* +* ANSI X9.19 MAC Constructor +*/ ANSI_X919_MAC::ANSI_X919_MAC(BlockCipher* e_in) : MessageAuthenticationCode(e_in->BLOCK_SIZE, e_in->MINIMUM_KEYLENGTH, @@ -93,9 +95,9 @@ ANSI_X919_MAC::ANSI_X919_MAC(BlockCipher* e_in) : throw Invalid_Argument("ANSI X9.19 MAC only supports DES"); } -/************************************************* -* ANSI X9.19 MAC Destructor * -le*************************************************/ +/* +* ANSI X9.19 MAC Destructor +le*/ ANSI_X919_MAC::~ANSI_X919_MAC() { delete e; diff --git a/src/mac/x919_mac/x919_mac.h b/src/mac/x919_mac/x919_mac.h index a2a40e3ca..1c2a06bee 100644 --- a/src/mac/x919_mac/x919_mac.h +++ b/src/mac/x919_mac/x919_mac.h @@ -1,7 +1,9 @@ -/************************************************* -* ANSI X9.19 MAC Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* ANSI X9.19 MAC +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_ANSI_X919_MAC_H__ #define BOTAN_ANSI_X919_MAC_H__ diff --git a/src/math/bigint/big_code.cpp b/src/math/bigint/big_code.cpp index e7a5e4946..74701e532 100644 --- a/src/math/bigint/big_code.cpp +++ b/src/math/bigint/big_code.cpp @@ -1,7 +1,9 @@ -/************************************************* -* BigInt Encoding/Decoding Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* BigInt Encoding/Decoding +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/bigint.h> #include <botan/divide.h> @@ -10,9 +12,9 @@ namespace Botan { -/************************************************* -* Encode a BigInt * -*************************************************/ +/* +* Encode a BigInt +*/ void BigInt::encode(byte output[], const BigInt& n, Base base) { if(base == Binary) @@ -53,9 +55,9 @@ void BigInt::encode(byte output[], const BigInt& n, Base base) throw Invalid_Argument("Unknown BigInt encoding method"); } -/************************************************* -* Encode a BigInt * -*************************************************/ +/* +* Encode a BigInt +*/ SecureVector<byte> BigInt::encode(const BigInt& n, Base base) { SecureVector<byte> output(n.encoded_size(base)); @@ -67,9 +69,9 @@ SecureVector<byte> BigInt::encode(const BigInt& n, Base base) return output; } -/************************************************* -* Encode a BigInt, with leading 0s if needed * -*************************************************/ +/* +* Encode a BigInt, with leading 0s if needed +*/ SecureVector<byte> BigInt::encode_1363(const BigInt& n, u32bit bytes) { const u32bit n_bytes = n.bytes(); @@ -83,17 +85,17 @@ SecureVector<byte> BigInt::encode_1363(const BigInt& n, u32bit bytes) return output; } -/************************************************* -* Decode a BigInt * -*************************************************/ +/* +* Decode a BigInt +*/ BigInt BigInt::decode(const MemoryRegion<byte>& buf, Base base) { return BigInt::decode(buf, buf.size(), base); } -/************************************************* -* Decode a BigInt * -*************************************************/ +/* +* Decode a BigInt +*/ BigInt BigInt::decode(const byte buf[], u32bit length, Base base) { BigInt r; diff --git a/src/math/bigint/big_io.cpp b/src/math/bigint/big_io.cpp index 3c201e8b2..b50fcceff 100644 --- a/src/math/bigint/big_io.cpp +++ b/src/math/bigint/big_io.cpp @@ -1,16 +1,18 @@ -/************************************************* -* BigInt Input/Output Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* BigInt Input/Output +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/bigint.h> #include <iostream> namespace Botan { -/************************************************* -* Write the BigInt into a stream * -*************************************************/ +/* +* Write the BigInt into a stream +*/ std::ostream& operator<<(std::ostream& stream, const BigInt& n) { BigInt::Base base = BigInt::Decimal; @@ -37,9 +39,9 @@ std::ostream& operator<<(std::ostream& stream, const BigInt& n) return stream; } -/************************************************* -* Read the BigInt from a stream * -*************************************************/ +/* +* Read the BigInt from a stream +*/ std::istream& operator>>(std::istream& stream, BigInt& n) { std::string str; diff --git a/src/math/bigint/big_ops2.cpp b/src/math/bigint/big_ops2.cpp index ef083f394..488eca909 100644 --- a/src/math/bigint/big_ops2.cpp +++ b/src/math/bigint/big_ops2.cpp @@ -1,7 +1,9 @@ -/************************************************* -* BigInt Assignment Operators Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* BigInt Assignment Operators +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/bigint.h> #include <botan/mp_core.h> @@ -10,9 +12,9 @@ namespace Botan { -/************************************************* -* Addition Operator * -*************************************************/ +/* +* Addition Operator +*/ BigInt& BigInt::operator+=(const BigInt& y) { const u32bit x_sw = sig_words(), y_sw = y.sig_words(); @@ -45,9 +47,9 @@ BigInt& BigInt::operator+=(const BigInt& y) return (*this); } -/************************************************* -* Subtraction Operator * -*************************************************/ +/* +* Subtraction Operator +*/ BigInt& BigInt::operator-=(const BigInt& y) { const u32bit x_sw = sig_words(), y_sw = y.sig_words(); @@ -91,9 +93,9 @@ BigInt& BigInt::operator-=(const BigInt& y) return (*this); } -/************************************************* -* Multiplication Operator * -*************************************************/ +/* +* Multiplication Operator +*/ BigInt& BigInt::operator*=(const BigInt& y) { const u32bit x_sw = sig_words(), y_sw = y.sig_words(); @@ -129,9 +131,9 @@ BigInt& BigInt::operator*=(const BigInt& y) return (*this); } -/************************************************* -* Division Operator * -*************************************************/ +/* +* Division Operator +*/ BigInt& BigInt::operator/=(const BigInt& y) { if(y.sig_words() == 1 && power_of_2(y.word_at(0))) @@ -141,17 +143,17 @@ BigInt& BigInt::operator/=(const BigInt& y) return (*this); } -/************************************************* -* Modulo Operator * -*************************************************/ +/* +* Modulo Operator +*/ BigInt& BigInt::operator%=(const BigInt& mod) { return (*this = (*this) % mod); } -/************************************************* -* Modulo Operator * -*************************************************/ +/* +* Modulo Operator +*/ word BigInt::operator%=(word mod) { if(mod == 0) @@ -182,9 +184,9 @@ word BigInt::operator%=(word mod) return word_at(0); } -/************************************************* -* Left Shift Operator * -*************************************************/ +/* +* Left Shift Operator +*/ BigInt& BigInt::operator<<=(u32bit shift) { if(shift) @@ -200,9 +202,9 @@ BigInt& BigInt::operator<<=(u32bit shift) return (*this); } -/************************************************* -* Right Shift Operator * -*************************************************/ +/* +* Right Shift Operator +*/ BigInt& BigInt::operator>>=(u32bit shift) { if(shift) diff --git a/src/math/bigint/big_ops3.cpp b/src/math/bigint/big_ops3.cpp index ff24eab1c..ad8b7bbd0 100644 --- a/src/math/bigint/big_ops3.cpp +++ b/src/math/bigint/big_ops3.cpp @@ -1,7 +1,9 @@ -/************************************************* -* BigInt Binary Operators Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* BigInt Binary Operators +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/bigint.h> #include <botan/divide.h> @@ -11,9 +13,9 @@ namespace Botan { -/************************************************* -* Addition Operator * -*************************************************/ +/* +* Addition Operator +*/ BigInt operator+(const BigInt& x, const BigInt& y) { const u32bit x_sw = x.sig_words(), y_sw = y.sig_words(); @@ -40,9 +42,9 @@ BigInt operator+(const BigInt& x, const BigInt& y) return z; } -/************************************************* -* Subtraction Operator * -*************************************************/ +/* +* Subtraction Operator +*/ BigInt operator-(const BigInt& x, const BigInt& y) { const u32bit x_sw = x.sig_words(), y_sw = y.sig_words(); @@ -75,9 +77,9 @@ BigInt operator-(const BigInt& x, const BigInt& y) return z; } -/************************************************* -* Multiplication Operator * -*************************************************/ +/* +* Multiplication Operator +*/ BigInt operator*(const BigInt& x, const BigInt& y) { const u32bit x_sw = x.sig_words(), y_sw = y.sig_words(); @@ -101,9 +103,9 @@ BigInt operator*(const BigInt& x, const BigInt& y) return z; } -/************************************************* -* Division Operator * -*************************************************/ +/* +* Division Operator +*/ BigInt operator/(const BigInt& x, const BigInt& y) { BigInt q, r; @@ -111,9 +113,9 @@ BigInt operator/(const BigInt& x, const BigInt& y) return q; } -/************************************************* -* Modulo Operator * -*************************************************/ +/* +* Modulo Operator +*/ BigInt operator%(const BigInt& n, const BigInt& mod) { if(mod.is_zero()) @@ -128,9 +130,9 @@ BigInt operator%(const BigInt& n, const BigInt& mod) return r; } -/************************************************* -* Modulo Operator * -*************************************************/ +/* +* Modulo Operator +*/ word operator%(const BigInt& n, word mod) { if(mod == 0) @@ -148,9 +150,9 @@ word operator%(const BigInt& n, word mod) return remainder; } -/************************************************* -* Left Shift Operator * -*************************************************/ +/* +* Left Shift Operator +*/ BigInt operator<<(const BigInt& x, u32bit shift) { if(shift == 0) @@ -166,9 +168,9 @@ BigInt operator<<(const BigInt& x, u32bit shift) return y; } -/************************************************* -* Right Shift Operator * -*************************************************/ +/* +* Right Shift Operator +*/ BigInt operator>>(const BigInt& x, u32bit shift) { if(shift == 0) diff --git a/src/math/bigint/big_rand.cpp b/src/math/bigint/big_rand.cpp index 055873642..b641baee2 100644 --- a/src/math/bigint/big_rand.cpp +++ b/src/math/bigint/big_rand.cpp @@ -1,16 +1,18 @@ -/************************************************* -* BigInt Random Generation Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* BigInt Random Generation +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/bigint.h> #include <botan/parsing.h> namespace Botan { -/************************************************* -* Construct a BigInt of a specific form * -*************************************************/ +/* +* Construct a BigInt of a specific form +*/ BigInt::BigInt(NumberType type, u32bit bits) { set_sign(Positive); @@ -21,9 +23,9 @@ BigInt::BigInt(NumberType type, u32bit bits) throw Invalid_Argument("BigInt(NumberType): Unknown type"); } -/************************************************* -* Randomize this number * -*************************************************/ +/* +* Randomize this number +*/ void BigInt::randomize(RandomNumberGenerator& rng, u32bit bitsize) { @@ -42,9 +44,9 @@ void BigInt::randomize(RandomNumberGenerator& rng, } } -/************************************************* -* Generate a random integer within given range * -*************************************************/ +/* +* Generate a random integer within given range +*/ BigInt BigInt::random_integer(RandomNumberGenerator& rng, const BigInt& min, const BigInt& max) { diff --git a/src/math/bigint/bigint.cpp b/src/math/bigint/bigint.cpp index e3c7931e6..926bedc02 100644 --- a/src/math/bigint/bigint.cpp +++ b/src/math/bigint/bigint.cpp @@ -1,7 +1,9 @@ -/************************************************* -* BigInt Base Source File * -* (C) 1999-2008 Jack Lloyd * -*************************************************/ +/* +* BigInt Base +* (C) 1999-2008 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/bigint.h> #include <botan/mp_core.h> @@ -11,9 +13,9 @@ namespace Botan { -/************************************************* -* Construct a BigInt from a regular number * -*************************************************/ +/* +* Construct a BigInt from a regular number +*/ BigInt::BigInt(u64bit n) { set_sign(Positive); @@ -28,18 +30,18 @@ BigInt::BigInt(u64bit n) reg[j] = ((n >> (j*MP_WORD_BITS)) & MP_WORD_MASK); } -/************************************************* -* Construct a BigInt of the specified size * -*************************************************/ +/* +* Construct a BigInt of the specified size +*/ BigInt::BigInt(Sign s, u32bit size) { reg.create(round_up(size, 8)); signedness = s; } -/************************************************* -* Construct a BigInt from a "raw" BigInt * -*************************************************/ +/* +* Construct a BigInt from a "raw" BigInt +*/ BigInt::BigInt(const BigInt& b) { const u32bit b_words = b.sig_words(); @@ -57,9 +59,9 @@ BigInt::BigInt(const BigInt& b) } } -/************************************************* -* Construct a BigInt from a string * -*************************************************/ +/* +* Construct a BigInt from a string +*/ BigInt::BigInt(const std::string& str) { Base base = Decimal; @@ -80,53 +82,53 @@ BigInt::BigInt(const std::string& str) else set_sign(Positive); } -/************************************************* -* Construct a BigInt from an encoded BigInt * -*************************************************/ +/* +* Construct a BigInt from an encoded BigInt +*/ BigInt::BigInt(const byte input[], u32bit length, Base base) { set_sign(Positive); *this = decode(input, length, base); } -/************************************************* -* Construct a BigInt from an encoded BigInt * -*************************************************/ +/* +* Construct a BigInt from an encoded BigInt +*/ BigInt::BigInt(RandomNumberGenerator& rng, u32bit bits) { set_sign(Positive); randomize(rng, bits); } -/************************************************* -* Swap this BigInt with another * -*************************************************/ +/* +* Swap this BigInt with another +*/ void BigInt::swap(BigInt& other) { reg.swap(other.reg); std::swap(signedness, other.signedness); } -/************************************************* -* Grow the internal storage * -*************************************************/ +/* +* Grow the internal storage +*/ void BigInt::grow_reg(u32bit n) { reg.grow_to(round_up(size() + n, 8)); } -/************************************************* -* Grow the internal storage * -*************************************************/ +/* +* Grow the internal storage +*/ void BigInt::grow_to(u32bit n) { if(n > size()) reg.grow_to(round_up(n, 8)); } -/************************************************* -* Comparison Function * -*************************************************/ +/* +* Comparison Function +*/ s32bit BigInt::cmp(const BigInt& n, bool check_signs) const { if(check_signs) @@ -139,9 +141,9 @@ s32bit BigInt::cmp(const BigInt& n, bool check_signs) const return bigint_cmp(data(), sig_words(), n.data(), n.sig_words()); } -/************************************************* -* Convert this number to a u32bit, if possible * -*************************************************/ +/* +* Convert this number to a u32bit, if possible +*/ u32bit BigInt::to_u32bit() const { if(is_negative()) @@ -155,9 +157,9 @@ u32bit BigInt::to_u32bit() const return out; } -/************************************************* -* Return byte n of this number * -*************************************************/ +/* +* Return byte n of this number +*/ byte BigInt::byte_at(u32bit n) const { const u32bit WORD_BYTES = sizeof(word); @@ -168,17 +170,17 @@ byte BigInt::byte_at(u32bit n) const return get_byte(WORD_BYTES - byte_num - 1, reg[word_num]); } -/************************************************* -* Return bit n of this number * -*************************************************/ +/* +* Return bit n of this number +*/ bool BigInt::get_bit(u32bit n) const { return ((word_at(n / MP_WORD_BITS) >> (n % MP_WORD_BITS)) & 1); } -/************************************************* -* Return bits {offset...offset+length} * -*************************************************/ +/* +* Return bits {offset...offset+length} +*/ u32bit BigInt::get_substring(u32bit offset, u32bit length) const { if(length > 32) @@ -194,9 +196,9 @@ u32bit BigInt::get_substring(u32bit offset, u32bit length) const return static_cast<u32bit>((piece >> shift) & mask); } -/************************************************* -* Set bit number n * -*************************************************/ +/* +* Set bit number n +*/ void BigInt::set_bit(u32bit n) { const u32bit which = n / MP_WORD_BITS; @@ -205,9 +207,9 @@ void BigInt::set_bit(u32bit n) reg[which] |= mask; } -/************************************************* -* Clear bit number n * -*************************************************/ +/* +* Clear bit number n +*/ void BigInt::clear_bit(u32bit n) { const u32bit which = n / MP_WORD_BITS; @@ -216,9 +218,9 @@ void BigInt::clear_bit(u32bit n) reg[which] &= ~mask; } -/************************************************* -* Clear all but the lowest n bits * -*************************************************/ +/* +* Clear all but the lowest n bits +*/ void BigInt::mask_bits(u32bit n) { if(n == 0) { clear(); return; } @@ -234,17 +236,17 @@ void BigInt::mask_bits(u32bit n) reg[top_word] &= mask; } -/************************************************* -* Count how many bytes are being used * -*************************************************/ +/* +* Count how many bytes are being used +*/ u32bit BigInt::bytes() const { return (bits() + 7) / 8; } -/************************************************* -* Count how many bits are being used * -*************************************************/ +/* +* Count how many bits are being used +*/ u32bit BigInt::bits() const { if(sig_words() == 0) @@ -259,9 +261,9 @@ u32bit BigInt::bits() const return (full_words * MP_WORD_BITS + top_bits); } -/************************************************* -* Calcluate the size in a certain base * -*************************************************/ +/* +* Calcluate the size in a certain base +*/ u32bit BigInt::encoded_size(Base base) const { static const double LOG_2_BASE_10 = 0.30102999566; @@ -278,9 +280,9 @@ u32bit BigInt::encoded_size(Base base) const throw Invalid_Argument("Unknown base for BigInt encoding"); } -/************************************************* -* Set the sign * -*************************************************/ +/* +* Set the sign +*/ void BigInt::set_sign(Sign s) { if(is_zero()) @@ -289,17 +291,17 @@ void BigInt::set_sign(Sign s) signedness = s; } -/************************************************* -* Reverse the value of the sign flag * -*************************************************/ +/* +* Reverse the value of the sign flag +*/ void BigInt::flip_sign() { set_sign(reverse_sign()); } -/************************************************* -* Return the opposite value of the current sign * -*************************************************/ +/* +* Return the opposite value of the current sign +*/ BigInt::Sign BigInt::reverse_sign() const { if(sign() == Positive) @@ -307,9 +309,9 @@ BigInt::Sign BigInt::reverse_sign() const return Positive; } -/************************************************* -* Return the negation of this number * -*************************************************/ +/* +* Return the negation of this number +*/ BigInt BigInt::operator-() const { BigInt x = (*this); @@ -317,9 +319,9 @@ BigInt BigInt::operator-() const return x; } -/************************************************* -* Return the absolute value of this number * -*************************************************/ +/* +* Return the absolute value of this number +*/ BigInt BigInt::abs() const { BigInt x = (*this); @@ -327,9 +329,9 @@ BigInt BigInt::abs() const return x; } -/************************************************* -* Encode this number into bytes * -*************************************************/ +/* +* Encode this number into bytes +*/ void BigInt::binary_encode(byte output[]) const { const u32bit sig_bytes = bytes(); @@ -337,9 +339,9 @@ void BigInt::binary_encode(byte output[]) const output[sig_bytes-j-1] = byte_at(j); } -/************************************************* -* Set this number to the value in buf * -*************************************************/ +/* +* Set this number to the value in buf +*/ void BigInt::binary_decode(const byte buf[], u32bit length) { const u32bit WORD_BYTES = sizeof(word); @@ -356,9 +358,9 @@ void BigInt::binary_decode(const byte buf[], u32bit length) reg[length / WORD_BYTES] = (reg[length / WORD_BYTES] << 8) | buf[j]; } -/************************************************* -* Set this number to the value in buf * -*************************************************/ +/* +* Set this number to the value in buf +*/ void BigInt::binary_decode(const MemoryRegion<byte>& buf) { binary_decode(buf, buf.size()); diff --git a/src/math/bigint/bigint.h b/src/math/bigint/bigint.h index 4a29e5365..16a1bba96 100644 --- a/src/math/bigint/bigint.h +++ b/src/math/bigint/bigint.h @@ -1,8 +1,10 @@ -/************************************************* -* BigInt Header File * -* (C) 1999-2008 Jack Lloyd * -* 2007 FlexSecure * -*************************************************/ +/* +* BigInt +* (C) 1999-2008 Jack Lloyd +* 2007 FlexSecure +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_BIGINT_H__ #define BOTAN_BIGINT_H__ @@ -18,7 +20,7 @@ namespace Botan { * Big Integer representation. This class defines an integer type, * that can be very big. Additionally some helper functions are * defined to work more comfortably. - * + */ class BOTAN_DLL BigInt { @@ -45,7 +47,7 @@ class BOTAN_DLL BigInt { DivideByZero() : Exception("BigInt divide by zero") {} }; /************* - * operators * + * operators *************/ /** @@ -142,7 +144,7 @@ class BOTAN_DLL BigInt void clear() { get_reg().clear(); } /************* - * functions * + * functions ************/ /** @@ -487,9 +489,9 @@ class BOTAN_DLL BigInt Sign signedness; }; -/************************************************* -* Arithmetic Operators * -*************************************************/ +/* +* Arithmetic Operators +*/ BigInt BOTAN_DLL operator+(const BigInt&, const BigInt&); BigInt BOTAN_DLL operator-(const BigInt&, const BigInt&); BigInt BOTAN_DLL operator*(const BigInt&, const BigInt&); @@ -499,9 +501,9 @@ word BOTAN_DLL operator%(const BigInt&, word); BigInt BOTAN_DLL operator<<(const BigInt&, u32bit); BigInt BOTAN_DLL operator>>(const BigInt&, u32bit); -/************************************************* -* Comparison Operators * -*************************************************/ +/* +* Comparison Operators +*/ inline bool operator==(const BigInt& a, const BigInt& b) { return (a.cmp(b) == 0); } inline bool operator!=(const BigInt& a, const BigInt& b) @@ -515,9 +517,9 @@ inline bool operator<(const BigInt& a, const BigInt& b) inline bool operator>(const BigInt& a, const BigInt& b) { return (a.cmp(b) > 0); } -/************************************************* -* I/O Operators * -*************************************************/ +/* +* I/O Operators +*/ BOTAN_DLL std::ostream& operator<<(std::ostream&, const BigInt&); BOTAN_DLL std::istream& operator>>(std::istream&, BigInt&); diff --git a/src/math/bigint/divide.cpp b/src/math/bigint/divide.cpp index ba088ced4..6afaa0fee 100644 --- a/src/math/bigint/divide.cpp +++ b/src/math/bigint/divide.cpp @@ -1,7 +1,9 @@ -/************************************************* -* Division Algorithm Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* Division Algorithm +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/divide.h> #include <botan/mp_core.h> @@ -10,9 +12,9 @@ namespace Botan { namespace { -/************************************************* -* Handle signed operands, if necessary * -*************************************************/ +/* +* Handle signed operands, if necessary +*/ void sign_fixup(const BigInt& x, const BigInt& y, BigInt& q, BigInt& r) { if(x.sign() == BigInt::Negative) @@ -26,9 +28,9 @@ void sign_fixup(const BigInt& x, const BigInt& y, BigInt& q, BigInt& r) } -/************************************************* -* Solve x = q * y + r * -*************************************************/ +/* +* Solve x = q * y + r +*/ void divide(const BigInt& x, const BigInt& y_arg, BigInt& q, BigInt& r) { if(y_arg.is_zero()) diff --git a/src/math/bigint/divide.h b/src/math/bigint/divide.h index a50cbfb47..9445b137b 100644 --- a/src/math/bigint/divide.h +++ b/src/math/bigint/divide.h @@ -1,7 +1,9 @@ -/************************************************* -* Division Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* Division +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_DIVISON_ALGORITHM_H__ #define BOTAN_DIVISON_ALGORITHM_H__ diff --git a/src/math/bigint/monty_generic/mp_monty.cpp b/src/math/bigint/monty_generic/mp_monty.cpp index c162bfd4f..5409e2569 100644 --- a/src/math/bigint/monty_generic/mp_monty.cpp +++ b/src/math/bigint/monty_generic/mp_monty.cpp @@ -1,8 +1,10 @@ -/************************************************* -* Montgomery Reduction Source File * -* (C) 1999-2008 Jack Lloyd * -* 2006 Luca Piccarreta * -*************************************************/ +/* +* Montgomery Reduction +* (C) 1999-2008 Jack Lloyd +* 2006 Luca Piccarreta +* +* Distributed under the terms of the Botan license +*/ #include <botan/mp_core.h> #include <botan/mp_asm.h> @@ -12,9 +14,9 @@ namespace Botan { extern "C" { -/************************************************* -* Montgomery Reduction Algorithm * -*************************************************/ +/* +* Montgomery Reduction Algorithm +*/ void bigint_monty_redc(word z[], u32bit z_size, const word x[], u32bit x_size, word u) { diff --git a/src/math/bigint/mp_amd64/mp_asm.h b/src/math/bigint/mp_amd64/mp_asm.h index eca7bae6c..fa66d04f3 100644 --- a/src/math/bigint/mp_amd64/mp_asm.h +++ b/src/math/bigint/mp_amd64/mp_asm.h @@ -1,8 +1,10 @@ -/************************************************* -* Lowest Level MPI Algorithms Header File * -* (C) 1999-2008 Jack Lloyd * -* 2006 Luca Piccarreta * -*************************************************/ +/* +* Lowest Level MPI Algorithms +* (C) 1999-2008 Jack Lloyd +* 2006 Luca Piccarreta +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_MP_ASM_H__ #define BOTAN_MP_ASM_H__ @@ -17,14 +19,14 @@ namespace Botan { extern "C" { -/************************************************* -* Helper Macros for amd64 Assembly * -*************************************************/ +/* +* Helper Macros for amd64 Assembly +*/ #define ASM(x) x "\n\t" -/************************************************* -* Word Multiply * -*************************************************/ +/* +* Word Multiply +*/ inline word word_madd2(word a, word b, word* c) { asm( @@ -38,9 +40,9 @@ inline word word_madd2(word a, word b, word* c) return a; } -/************************************************* -* Word Multiply/Add * -*************************************************/ +/* +* Word Multiply/Add +*/ inline word word_madd3(word a, word b, word c, word* d) { asm( diff --git a/src/math/bigint/mp_amd64/mp_asmi.h b/src/math/bigint/mp_amd64/mp_asmi.h index bf3469526..8bccbaaf4 100644 --- a/src/math/bigint/mp_amd64/mp_asmi.h +++ b/src/math/bigint/mp_amd64/mp_asmi.h @@ -1,8 +1,10 @@ -/************************************************* -* Lowest Level MPI Algorithms Header File * -* (C) 1999-2007 Jack Lloyd * -* 2006 Luca Piccarreta * -*************************************************/ +/* +* Lowest Level MPI Algorithms +* (C) 1999-2007 Jack Lloyd +* 2006 Luca Piccarreta +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_MP_ASM_INTERNAL_H__ #define BOTAN_MP_ASM_INTERNAL_H__ @@ -13,9 +15,9 @@ namespace Botan { extern "C" { -/************************************************* -* Helper Macros for amd64 Assembly * -*************************************************/ +/* +* Helper Macros for amd64 Assembly +*/ #ifndef ASM #define ASM(x) x "\n\t" #endif @@ -63,9 +65,9 @@ extern "C" { ASM("sbbq %[carry],%[carry]") \ ASM("negq %[carry]") -/************************************************* -* Word Addition * -*************************************************/ +/* +* Word Addition +*/ inline word word_add(word x, word y, word* carry) { #if 0 @@ -84,9 +86,9 @@ inline word word_add(word x, word y, word* carry) #endif } -/************************************************* -* Eight Word Block Addition, Two Argument * -*************************************************/ +/* +* Eight Word Block Addition, Two Argument +*/ inline word word8_add2(word x[8], const word y[8], word carry) { asm( @@ -97,9 +99,9 @@ inline word word8_add2(word x[8], const word y[8], word carry) return carry; } -/************************************************* -* Eight Word Block Addition, Three Argument * -*************************************************/ +/* +* Eight Word Block Addition, Three Argument +*/ inline word word8_add3(word z[8], const word x[8], const word y[8], word carry) { asm( @@ -110,9 +112,9 @@ inline word word8_add3(word z[8], const word x[8], const word y[8], word carry) return carry; } -/************************************************* -* Word Subtraction * -*************************************************/ +/* +* Word Subtraction +*/ inline word word_sub(word x, word y, word* carry) { asm( @@ -123,9 +125,9 @@ inline word word_sub(word x, word y, word* carry) return x; } -/************************************************* -* Eight Word Block Subtraction, Two Argument * -*************************************************/ +/* +* Eight Word Block Subtraction, Two Argument +*/ inline word word8_sub2(word x[8], const word y[8], word carry) { asm( @@ -136,9 +138,9 @@ inline word word8_sub2(word x[8], const word y[8], word carry) return carry; } -/************************************************* -* Eight Word Block Subtraction, Three Argument * -*************************************************/ +/* +* Eight Word Block Subtraction, Three Argument +*/ inline word word8_sub3(word z[8], const word x[8], const word y[8], word carry) { asm( @@ -149,9 +151,9 @@ inline word word8_sub3(word z[8], const word x[8], const word y[8], word carry) return carry; } -/************************************************* -* Eight Word Block Linear Multiplication * -*************************************************/ +/* +* Eight Word Block Linear Multiplication +*/ inline word word8_linmul2(word x[8], word y, word carry) { asm( @@ -162,9 +164,9 @@ inline word word8_linmul2(word x[8], word y, word carry) return carry; } -/************************************************* -* Eight Word Block Linear Multiplication * -*************************************************/ +/* +* Eight Word Block Linear Multiplication +*/ inline word word8_linmul3(word z[8], const word x[8], word y, word carry) { asm( @@ -175,9 +177,9 @@ inline word word8_linmul3(word z[8], const word x[8], word y, word carry) return carry; } -/************************************************* -* Eight Word Block Multiply/Add * -*************************************************/ +/* +* Eight Word Block Multiply/Add +*/ inline word word8_madd3(word z[8], const word x[8], word y, word carry) { asm( @@ -188,9 +190,9 @@ inline word word8_madd3(word z[8], const word x[8], word y, word carry) return carry; } -/************************************************* -* Multiply-Add Accumulator * -*************************************************/ +/* +* Multiply-Add Accumulator +*/ inline void word3_muladd(word* w2, word* w1, word* w0, word x, word y) { asm( @@ -205,9 +207,9 @@ inline void word3_muladd(word* w2, word* w1, word* w0, word x, word y) : "cc"); } -/************************************************* -* Multiply-Add Accumulator * -*************************************************/ +/* +* Multiply-Add Accumulator +*/ inline void word3_muladd_2(word* w2, word* w1, word* w0, word x, word y) { asm( diff --git a/src/math/bigint/mp_asm.cpp b/src/math/bigint/mp_asm.cpp index e5d1fe0d6..ea9738d30 100644 --- a/src/math/bigint/mp_asm.cpp +++ b/src/math/bigint/mp_asm.cpp @@ -1,8 +1,10 @@ -/************************************************* -* Lowest Level MPI Algorithms Source File * -* (C) 1999-2008 Jack Lloyd * -* 2006 Luca Piccarreta * -*************************************************/ +/* +* Lowest Level MPI Algorithms +* (C) 1999-2008 Jack Lloyd +* 2006 Luca Piccarreta +* +* Distributed under the terms of the Botan license +*/ #include <botan/mp_asm.h> #include <botan/mp_asmi.h> @@ -13,9 +15,9 @@ namespace Botan { extern "C" { -/************************************************* -* Two Operand Addition, No Carry * -*************************************************/ +/* +* Two Operand Addition, No Carry +*/ word bigint_add2_nc(word x[], u32bit x_size, const word y[], u32bit y_size) { word carry = 0; @@ -38,9 +40,9 @@ word bigint_add2_nc(word x[], u32bit x_size, const word y[], u32bit y_size) return 1; } -/************************************************* -* Three Operand Addition, No Carry * -*************************************************/ +/* +* Three Operand Addition, No Carry +*/ word bigint_add3_nc(word z[], const word x[], u32bit x_size, const word y[], u32bit y_size) { @@ -68,18 +70,18 @@ word bigint_add3_nc(word z[], const word x[], u32bit x_size, return carry; } -/************************************************* -* Two Operand Addition * -*************************************************/ +/* +* Two Operand Addition +*/ void bigint_add2(word x[], u32bit x_size, const word y[], u32bit y_size) { if(bigint_add2_nc(x, x_size, y, y_size)) ++x[x_size]; } -/************************************************* -* Three Operand Addition * -*************************************************/ +/* +* Three Operand Addition +*/ void bigint_add3(word z[], const word x[], u32bit x_size, const word y[], u32bit y_size) { @@ -87,9 +89,9 @@ void bigint_add3(word z[], const word x[], u32bit x_size, ++z[(x_size > y_size ? x_size : y_size)]; } -/************************************************* -* Two Operand Subtraction * -*************************************************/ +/* +* Two Operand Subtraction +*/ void bigint_sub2(word x[], u32bit x_size, const word y[], u32bit y_size) { word carry = 0; @@ -111,9 +113,9 @@ void bigint_sub2(word x[], u32bit x_size, const word y[], u32bit y_size) } } -/************************************************* -* Three Operand Subtraction * -*************************************************/ +/* +* Three Operand Subtraction +*/ void bigint_sub3(word z[], const word x[], u32bit x_size, const word y[], u32bit y_size) { @@ -136,9 +138,9 @@ void bigint_sub3(word z[], const word x[], u32bit x_size, } } -/************************************************* -* Two Operand Linear Multiply * -*************************************************/ +/* +* Two Operand Linear Multiply +*/ void bigint_linmul2(word x[], u32bit x_size, word y) { const u32bit blocks = x_size - (x_size % 8); @@ -154,9 +156,9 @@ void bigint_linmul2(word x[], u32bit x_size, word y) x[x_size] = carry; } -/************************************************* -* Three Operand Linear Multiply * -*************************************************/ +/* +* Three Operand Linear Multiply +*/ void bigint_linmul3(word z[], const word x[], u32bit x_size, word y) { const u32bit blocks = x_size - (x_size % 8); diff --git a/src/math/bigint/mp_asm64/mp_asm.h b/src/math/bigint/mp_asm64/mp_asm.h index f751a50f8..d1583e236 100644 --- a/src/math/bigint/mp_asm64/mp_asm.h +++ b/src/math/bigint/mp_asm64/mp_asm.h @@ -1,7 +1,9 @@ -/************************************************* -* MPI Multiply-Add Core Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* MPI Multiply-Add Core +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_MP_MADD_H__ #define BOTAN_MP_MADD_H__ @@ -81,9 +83,9 @@ inline void bigint_2word_mul(word a, word b, word* z1, word* z0) #endif -/************************************************* -* Word Multiply/Add * -*************************************************/ +/* +* Word Multiply/Add +*/ inline word word_madd2(word a, word b, word* c) { word z0 = 0, z1 = 0; @@ -96,9 +98,9 @@ inline word word_madd2(word a, word b, word* c) return z1; } -/************************************************* -* Word Multiply/Add * -*************************************************/ +/* +* Word Multiply/Add +*/ inline word word_madd3(word a, word b, word c, word* d) { word z0 = 0, z1 = 0; diff --git a/src/math/bigint/mp_comba.cpp b/src/math/bigint/mp_comba.cpp index c7a9c964c..218038d8a 100644 --- a/src/math/bigint/mp_comba.cpp +++ b/src/math/bigint/mp_comba.cpp @@ -1,7 +1,9 @@ -/************************************************* -* Comba Multiplication and Squaring Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* Comba Multiplication and Squaring +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/mp_core.h> #include <botan/mp_asmi.h> @@ -10,9 +12,9 @@ namespace Botan { extern "C" { -/************************************************* -* Comba 4x4 Squaring * -*************************************************/ +/* +* Comba 4x4 Squaring +*/ void bigint_comba_sqr4(word z[8], const word x[4]) { word w2 = 0, w1 = 0, w0 = 0; @@ -43,9 +45,9 @@ void bigint_comba_sqr4(word z[8], const word x[4]) z[7] = w1; } -/************************************************* -* Comba 4x4 Multiplication * -*************************************************/ +/* +* Comba 4x4 Multiplication +*/ void bigint_comba_mul4(word z[8], const word x[4], const word y[4]) { word w2 = 0, w1 = 0, w0 = 0; @@ -82,9 +84,9 @@ void bigint_comba_mul4(word z[8], const word x[4], const word y[4]) z[7] = w1; } -/************************************************* -* Comba 6x6 Squaring * -*************************************************/ +/* +* Comba 6x6 Squaring +*/ void bigint_comba_sqr6(word z[12], const word x[6]) { word w2 = 0, w1 = 0, w0 = 0; @@ -134,9 +136,9 @@ void bigint_comba_sqr6(word z[12], const word x[6]) z[11] = w1; } -/************************************************* -* Comba 6x6 Multiplication * -*************************************************/ +/* +* Comba 6x6 Multiplication +*/ void bigint_comba_mul6(word z[12], const word x[6], const word y[6]) { word w2 = 0, w1 = 0, w0 = 0; @@ -201,9 +203,9 @@ void bigint_comba_mul6(word z[12], const word x[6], const word y[6]) z[11] = w1; } -/************************************************* -* Comba 8x8 Squaring * -*************************************************/ +/* +* Comba 8x8 Squaring +*/ void bigint_comba_sqr8(word z[16], const word x[8]) { word w2 = 0, w1 = 0, w0 = 0; @@ -276,9 +278,9 @@ void bigint_comba_sqr8(word z[16], const word x[8]) z[15] = w1; } -/************************************************* -* Comba 8x8 Multiplication * -*************************************************/ +/* +* Comba 8x8 Multiplication +*/ void bigint_comba_mul8(word z[16], const word x[8], const word y[8]) { word w2 = 0, w1 = 0, w0 = 0; @@ -379,9 +381,9 @@ void bigint_comba_mul8(word z[16], const word x[8], const word y[8]) z[15] = w1; } -/************************************************* -* Comba 16x16 Squaring * -*************************************************/ +/* +* Comba 16x16 Squaring +*/ void bigint_comba_sqr16(word z[32], const word x[16]) { word w2 = 0, w1 = 0, w0 = 0; @@ -586,9 +588,9 @@ void bigint_comba_sqr16(word z[32], const word x[16]) z[31] = w1; } -/************************************************* -* Comba 16x16 Multiplication * -*************************************************/ +/* +* Comba 16x16 Multiplication +*/ void bigint_comba_mul16(word z[32], const word x[16], const word y[16]) { word w2 = 0, w1 = 0, w0 = 0; diff --git a/src/math/bigint/mp_core.h b/src/math/bigint/mp_core.h index 92949cd83..ea27a77a7 100644 --- a/src/math/bigint/mp_core.h +++ b/src/math/bigint/mp_core.h @@ -1,7 +1,9 @@ -/************************************************* -* MPI Algorithms Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* MPI Algorithms +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_MP_CORE_H__ #define BOTAN_MP_CORE_H__ @@ -10,16 +12,16 @@ namespace Botan { -/************************************************* -* The size of the word type, in bits * -*************************************************/ +/* +* The size of the word type, in bits +*/ const u32bit MP_WORD_BITS = BOTAN_MP_WORD_BITS; extern "C" { -/************************************************* -* Addition/Subtraction Operations * -*************************************************/ +/* +* Addition/Subtraction Operations +*/ void bigint_add2(word[], u32bit, const word[], u32bit); void bigint_add3(word[], const word[], u32bit, const word[], u32bit); @@ -29,45 +31,45 @@ word bigint_add3_nc(word[], const word[], u32bit, const word[], u32bit); void bigint_sub2(word[], u32bit, const word[], u32bit); void bigint_sub3(word[], const word[], u32bit, const word[], u32bit); -/************************************************* -* Shift Operations * -*************************************************/ +/* +* Shift Operations +*/ void bigint_shl1(word[], u32bit, u32bit, u32bit); void bigint_shl2(word[], const word[], u32bit, u32bit, u32bit); void bigint_shr1(word[], u32bit, u32bit, u32bit); void bigint_shr2(word[], const word[], u32bit, u32bit, u32bit); -/************************************************* -* Simple O(N^2) Multiplication and Squaring * -*************************************************/ +/* +* Simple O(N^2) Multiplication and Squaring +*/ void bigint_simple_mul(word z[], const word x[], u32bit x_size, const word y[], u32bit y_size); void bigint_simple_sqr(word z[], const word x[], u32bit x_size); -/************************************************* -* Linear Multiply * -*************************************************/ +/* +* Linear Multiply +*/ void bigint_linmul2(word[], u32bit, word); void bigint_linmul3(word[], const word[], u32bit, word); void bigint_linmul_add(word[], u32bit, const word[], u32bit, word); -/************************************************* -* Montgomery Reduction * -*************************************************/ +/* +* Montgomery Reduction +*/ void bigint_monty_redc(word[], u32bit, const word[], u32bit, word); -/************************************************* -* Misc Utility Operations * -*************************************************/ +/* +* Misc Utility Operations +*/ u32bit bigint_divcore(word, word, word, word, word, word); s32bit bigint_cmp(const word[], u32bit, const word[], u32bit); word bigint_divop(word, word, word); word bigint_modop(word, word, word); void bigint_wordmul(word, word, word*, word*); -/************************************************* -* Comba Multiplication / Squaring * -*************************************************/ +/* +* Comba Multiplication / Squaring +*/ void bigint_comba_mul4(word[8], const word[4], const word[4]); void bigint_comba_mul6(word[12], const word[6], const word[6]); void bigint_comba_mul8(word[16], const word[8], const word[8]); @@ -81,9 +83,9 @@ void bigint_comba_sqr16(word[64], const word[32]); } -/************************************************* -* High Level Multiplication/Squaring Interfaces * -*************************************************/ +/* +* High Level Multiplication/Squaring Interfaces +*/ void bigint_mul(word[], u32bit, word[], const word[], u32bit, u32bit, const word[], u32bit, u32bit); diff --git a/src/math/bigint/mp_generic/mp_asm.h b/src/math/bigint/mp_generic/mp_asm.h index e62a57110..7c18343ef 100644 --- a/src/math/bigint/mp_generic/mp_asm.h +++ b/src/math/bigint/mp_generic/mp_asm.h @@ -1,8 +1,10 @@ -/************************************************* -* Lowest Level MPI Algorithms Header File * -* (C) 1999-2008 Jack Lloyd * -* 2006 Luca Piccarreta * -*************************************************/ +/* +* Lowest Level MPI Algorithms +* (C) 1999-2008 Jack Lloyd +* 2006 Luca Piccarreta +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_MP_ASM_H__ #define BOTAN_MP_ASM_H__ @@ -25,9 +27,9 @@ namespace Botan { extern "C" { -/************************************************* -* Word Multiply/Add * -*************************************************/ +/* +* Word Multiply/Add +*/ inline word word_madd2(word a, word b, word* c) { dword z = (dword)a * b + *c; @@ -35,9 +37,9 @@ inline word word_madd2(word a, word b, word* c) return (word)z; } -/************************************************* -* Word Multiply/Add * -*************************************************/ +/* +* Word Multiply/Add +*/ inline word word_madd3(word a, word b, word c, word* d) { dword z = (dword)a * b + c + *d; diff --git a/src/math/bigint/mp_generic/mp_asmi.h b/src/math/bigint/mp_generic/mp_asmi.h index d15295154..21c4db248 100644 --- a/src/math/bigint/mp_generic/mp_asmi.h +++ b/src/math/bigint/mp_generic/mp_asmi.h @@ -1,8 +1,10 @@ -/************************************************* -* Lowest Level MPI Algorithms Header File * -* (C) 1999-2008 Jack Lloyd * -* 2006 Luca Piccarreta * -*************************************************/ +/* +* Lowest Level MPI Algorithms +* (C) 1999-2008 Jack Lloyd +* 2006 Luca Piccarreta +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_MP_ASM_INTERNAL_H__ #define BOTAN_MP_ASM_INTERNAL_H__ @@ -13,9 +15,9 @@ namespace Botan { extern "C" { -/************************************************* -* Word Addition * -*************************************************/ +/* +* Word Addition +*/ inline word word_add(word x, word y, word* carry) { word z = x + y; @@ -25,9 +27,9 @@ inline word word_add(word x, word y, word* carry) return z; } -/************************************************* -* Eight Word Block Addition, Two Argument * -*************************************************/ +/* +* Eight Word Block Addition, Two Argument +*/ inline word word8_add2(word x[8], const word y[8], word carry) { x[0] = word_add(x[0], y[0], &carry); @@ -41,9 +43,9 @@ inline word word8_add2(word x[8], const word y[8], word carry) return carry; } -/************************************************* -* Eight Word Block Addition, Three Argument * -*************************************************/ +/* +* Eight Word Block Addition, Three Argument +*/ inline word word8_add3(word z[8], const word x[8], const word y[8], word carry) { @@ -58,9 +60,9 @@ inline word word8_add3(word z[8], const word x[8], return carry; } -/************************************************* -* Word Subtraction * -*************************************************/ +/* +* Word Subtraction +*/ inline word word_sub(word x, word y, word* carry) { word t0 = x - y; @@ -70,9 +72,9 @@ inline word word_sub(word x, word y, word* carry) return z; } -/************************************************* -* Eight Word Block Subtraction, Two Argument * -*************************************************/ +/* +* Eight Word Block Subtraction, Two Argument +*/ inline word word8_sub2(word x[4], const word y[4], word carry) { x[0] = word_sub(x[0], y[0], &carry); @@ -86,9 +88,9 @@ inline word word8_sub2(word x[4], const word y[4], word carry) return carry; } -/************************************************* -* Eight Word Block Subtraction, Three Argument * -*************************************************/ +/* +* Eight Word Block Subtraction, Three Argument +*/ inline word word8_sub3(word z[8], const word x[8], const word y[8], word carry) { @@ -103,9 +105,9 @@ inline word word8_sub3(word z[8], const word x[8], return carry; } -/************************************************* -* Eight Word Block Linear Multiplication * -*************************************************/ +/* +* Eight Word Block Linear Multiplication +*/ inline word word8_linmul2(word x[4], word y, word carry) { x[0] = word_madd2(x[0], y, &carry); @@ -119,9 +121,9 @@ inline word word8_linmul2(word x[4], word y, word carry) return carry; } -/************************************************* -* Eight Word Block Linear Multiplication * -*************************************************/ +/* +* Eight Word Block Linear Multiplication +*/ inline word word8_linmul3(word z[8], const word x[8], word y, word carry) { z[0] = word_madd2(x[0], y, &carry); @@ -135,9 +137,9 @@ inline word word8_linmul3(word z[8], const word x[8], word y, word carry) return carry; } -/************************************************* -* Eight Word Block Multiply/Add * -*************************************************/ +/* +* Eight Word Block Multiply/Add +*/ inline word word8_madd3(word z[8], const word x[8], word y, word carry) { z[0] = word_madd3(x[0], y, z[0], &carry); @@ -151,9 +153,9 @@ inline word word8_madd3(word z[8], const word x[8], word y, word carry) return carry; } -/************************************************* -* Multiply-Add Accumulator * -*************************************************/ +/* +* Multiply-Add Accumulator +*/ inline void word3_muladd(word* w2, word* w1, word* w0, word a, word b) { word carry = *w0; @@ -162,9 +164,9 @@ inline void word3_muladd(word* w2, word* w1, word* w0, word a, word b) *w2 += (*w1 < carry) ? 1 : 0; } -/************************************************* -* Multiply-Add Accumulator * -*************************************************/ +/* +* Multiply-Add Accumulator +*/ inline void word3_muladd_2(word* w2, word* w1, word* w0, word a, word b) { word carry = 0; diff --git a/src/math/bigint/mp_ia32/mp_asm.h b/src/math/bigint/mp_ia32/mp_asm.h index b45140321..4d3afc992 100644 --- a/src/math/bigint/mp_ia32/mp_asm.h +++ b/src/math/bigint/mp_ia32/mp_asm.h @@ -1,8 +1,10 @@ -/************************************************* -* Lowest Level MPI Algorithms Header File * -* (C) 1999-2008 Jack Lloyd * -* 2006 Luca Piccarreta * -*************************************************/ +/* +* Lowest Level MPI Algorithms +* (C) 1999-2008 Jack Lloyd +* 2006 Luca Piccarreta +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_MP_ASM_H__ #define BOTAN_MP_ASM_H__ @@ -17,14 +19,14 @@ namespace Botan { extern "C" { -/************************************************* -* Helper Macros for x86 Assembly * -*************************************************/ +/* +* Helper Macros for x86 Assembly +*/ #define ASM(x) x "\n\t" -/************************************************* -* Word Multiply * -*************************************************/ +/* +* Word Multiply +*/ inline word word_madd2(word a, word b, word* c) { asm( @@ -38,9 +40,9 @@ inline word word_madd2(word a, word b, word* c) return a; } -/************************************************* -* Word Multiply/Add * -*************************************************/ +/* +* Word Multiply/Add +*/ inline word word_madd3(word a, word b, word c, word* d) { asm( diff --git a/src/math/bigint/mp_ia32/mp_asmi.h b/src/math/bigint/mp_ia32/mp_asmi.h index 20079974e..28b99abcc 100644 --- a/src/math/bigint/mp_ia32/mp_asmi.h +++ b/src/math/bigint/mp_ia32/mp_asmi.h @@ -1,8 +1,10 @@ -/************************************************* -* Lowest Level MPI Algorithms Header File * -* (C) 1999-2007 Jack Lloyd * -* 2006 Luca Piccarreta * -*************************************************/ +/* +* Lowest Level MPI Algorithms +* (C) 1999-2007 Jack Lloyd +* 2006 Luca Piccarreta +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_MP_ASM_INTERNAL_H__ #define BOTAN_MP_ASM_INTERNAL_H__ @@ -13,9 +15,9 @@ namespace Botan { extern "C" { -/************************************************* -* Helper Macros for x86 Assembly * -*************************************************/ +/* +* Helper Macros for x86 Assembly +*/ #ifndef ASM #define ASM(x) x "\n\t" #endif @@ -63,9 +65,9 @@ extern "C" { ASM("sbbl %[carry],%[carry]") \ ASM("negl %[carry]") -/************************************************* -* Word Addition * -*************************************************/ +/* +* Word Addition +*/ inline word word_add(word x, word y, word* carry) { #if 0 @@ -84,9 +86,9 @@ inline word word_add(word x, word y, word* carry) #endif } -/************************************************* -* Eight Word Block Addition, Two Argument * -*************************************************/ +/* +* Eight Word Block Addition, Two Argument +*/ inline word word8_add2(word x[8], const word y[8], word carry) { asm( @@ -97,9 +99,9 @@ inline word word8_add2(word x[8], const word y[8], word carry) return carry; } -/************************************************* -* Eight Word Block Addition, Three Argument * -*************************************************/ +/* +* Eight Word Block Addition, Three Argument +*/ inline word word8_add3(word z[8], const word x[8], const word y[8], word carry) { asm( @@ -110,9 +112,9 @@ inline word word8_add3(word z[8], const word x[8], const word y[8], word carry) return carry; } -/************************************************* -* Word Subtraction * -*************************************************/ +/* +* Word Subtraction +*/ inline word word_sub(word x, word y, word* carry) { asm( @@ -123,9 +125,9 @@ inline word word_sub(word x, word y, word* carry) return x; } -/************************************************* -* Eight Word Block Subtraction, Two Argument * -*************************************************/ +/* +* Eight Word Block Subtraction, Two Argument +*/ inline word word8_sub2(word x[8], const word y[8], word carry) { asm( @@ -136,9 +138,9 @@ inline word word8_sub2(word x[8], const word y[8], word carry) return carry; } -/************************************************* -* Eight Word Block Subtraction, Three Argument * -*************************************************/ +/* +* Eight Word Block Subtraction, Three Argument +*/ inline word word8_sub3(word z[8], const word x[8], const word y[8], word carry) { asm( @@ -149,9 +151,9 @@ inline word word8_sub3(word z[8], const word x[8], const word y[8], word carry) return carry; } -/************************************************* -* Eight Word Block Linear Multiplication * -*************************************************/ +/* +* Eight Word Block Linear Multiplication +*/ inline word word8_linmul2(word x[8], word y, word carry) { asm( @@ -162,9 +164,9 @@ inline word word8_linmul2(word x[8], word y, word carry) return carry; } -/************************************************* -* Eight Word Block Linear Multiplication * -*************************************************/ +/* +* Eight Word Block Linear Multiplication +*/ inline word word8_linmul3(word z[8], const word x[8], word y, word carry) { asm( @@ -175,9 +177,9 @@ inline word word8_linmul3(word z[8], const word x[8], word y, word carry) return carry; } -/************************************************* -* Eight Word Block Multiply/Add * -*************************************************/ +/* +* Eight Word Block Multiply/Add +*/ inline word word8_madd3(word z[8], const word x[8], word y, word carry) { asm( @@ -188,9 +190,9 @@ inline word word8_madd3(word z[8], const word x[8], word y, word carry) return carry; } -/************************************************* -* Multiply-Add Accumulator * -*************************************************/ +/* +* Multiply-Add Accumulator +*/ inline void word3_muladd(word* w2, word* w1, word* w0, word x, word y) { asm( @@ -205,9 +207,9 @@ inline void word3_muladd(word* w2, word* w1, word* w0, word x, word y) : "cc"); } -/************************************************* -* Multiply-Add Accumulator * -*************************************************/ +/* +* Multiply-Add Accumulator +*/ inline void word3_muladd_2(word* w2, word* w1, word* w0, word x, word y) { asm( diff --git a/src/math/bigint/mp_ia32_msvc/mp_asmi.h b/src/math/bigint/mp_ia32_msvc/mp_asmi.h index 1aaea6ce0..33ce6eb3d 100644 --- a/src/math/bigint/mp_ia32_msvc/mp_asmi.h +++ b/src/math/bigint/mp_ia32_msvc/mp_asmi.h @@ -1,8 +1,10 @@ -/************************************************* -* Lowest Level MPI Algorithms Header File * -* (C) 1999-2006 Jack Lloyd * -* 2006 Luca Piccarreta * -*************************************************/ +/* +* Lowest Level MPI Algorithms +* (C) 1999-2006 Jack Lloyd +* 2006 Luca Piccarreta +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_MP_ASM_INTERNAL_H__ #define BOTAN_MP_ASM_INTERNAL_H__ @@ -13,9 +15,9 @@ namespace Botan { extern "C" { -/************************************************* -* Word Addition * -*************************************************/ +/* +* Word Addition +*/ inline word word_add(word x, word y, word* carry) { word z = x + y; @@ -25,9 +27,9 @@ inline word word_add(word x, word y, word* carry) return z; } -/************************************************* -* Eight Word Block Addition, Two Argument * -*************************************************/ +/* +* Eight Word Block Addition, Two Argument +*/ inline word word8_add2(word x[8], const word y[8], word carry) { __asm { @@ -56,9 +58,9 @@ inline word word8_add2(word x[8], const word y[8], word carry) } } -/************************************************* -* Eight Word Block Addition, Three Argument * -*************************************************/ +/* +* Eight Word Block Addition, Three Argument +*/ inline word word8_add3(word z[8], const word x[8], const word y[8], word carry) { __asm { @@ -104,9 +106,9 @@ inline word word8_add3(word z[8], const word x[8], const word y[8], word carry) } } -/************************************************* -* Word Subtraction * -*************************************************/ +/* +* Word Subtraction +*/ inline word word_sub(word x, word y, word* carry) { word t0 = x - y; @@ -116,9 +118,9 @@ inline word word_sub(word x, word y, word* carry) return z; } -/************************************************* -* Eight Word Block Subtraction, Two Argument * -*************************************************/ +/* +* Eight Word Block Subtraction, Two Argument +*/ inline word word8_sub2(word x[8], const word y[8], word carry) { _asm { @@ -155,9 +157,9 @@ inline word word8_sub2(word x[8], const word y[8], word carry) } } -/************************************************* -* Eight Word Block Subtraction, Three Argument * -*************************************************/ +/* +* Eight Word Block Subtraction, Three Argument +*/ inline word word8_sub3(word z[8], const word x[8], const word y[8], word carry) { @@ -196,9 +198,9 @@ inline word word8_sub3(word z[8], const word x[8], } } -/************************************************* -* Eight Word Block Linear Multiplication * -*************************************************/ +/* +* Eight Word Block Linear Multiplication +*/ inline word word8_linmul2(word x[8], word y, word carry) { __asm @@ -263,9 +265,9 @@ inline word word8_linmul2(word x[8], word y, word carry) } } -/************************************************* -* Eight Word Block Linear Multiplication * -*************************************************/ +/* +* Eight Word Block Linear Multiplication +*/ inline word word8_muladd(word z[8], const word x[8], word y, word carry) { @@ -472,9 +474,9 @@ inline word word8_linmul3(word z[4], const word x[4], word y, word carry) } } -/************************************************* -* Eight Word Block Multiply/Add * -*************************************************/ +/* +* Eight Word Block Multiply/Add +*/ inline word word8_madd3(word z[8], const word x[8], word y, word carry) { z[0] = word_madd3(x[0], y, z[0], &carry); @@ -488,9 +490,9 @@ inline word word8_madd3(word z[8], const word x[8], word y, word carry) return carry; } -/************************************************* -* Multiply-Add Accumulator * -*************************************************/ +/* +* Multiply-Add Accumulator +*/ inline void word3_muladd(word* w2, word* w1, word* w0, word a, word b) { word carry = *w0; @@ -499,9 +501,9 @@ inline void word3_muladd(word* w2, word* w1, word* w0, word a, word b) *w2 += (*w1 < carry) ? 1 : 0; } -/************************************************* -* Multiply-Add Accumulator * -*************************************************/ +/* +* Multiply-Add Accumulator +*/ inline void word3_muladd_2(word* w2, word* w1, word* w0, word a, word b) { word carry = 0; diff --git a/src/math/bigint/mp_karat.cpp b/src/math/bigint/mp_karat.cpp index 15b0551fd..f30d418cc 100644 --- a/src/math/bigint/mp_karat.cpp +++ b/src/math/bigint/mp_karat.cpp @@ -1,7 +1,9 @@ -/************************************************* -* Karatsuba Multiplication/Squaring Source File * -* (C) 1999-2008 Jack Lloyd * -*************************************************/ +/* +* Karatsuba Multiplication/Squaring +* (C) 1999-2008 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/mp_core.h> #include <botan/mem_ops.h> @@ -11,9 +13,9 @@ namespace Botan { namespace { -/************************************************* -* Karatsuba Multiplication Operation * -*************************************************/ +/* +* Karatsuba Multiplication Operation +*/ void karatsuba_mul(word z[], const word x[], const word y[], u32bit N, word workspace[]) { @@ -91,9 +93,9 @@ void karatsuba_mul(word z[], const word x[], const word y[], u32bit N, } } -/************************************************* -* Karatsuba Squaring Operation * -*************************************************/ +/* +* Karatsuba Squaring Operation +*/ void karatsuba_sqr(word z[], const word x[], u32bit N, word workspace[]) { if(N == 6) @@ -162,9 +164,9 @@ void karatsuba_sqr(word z[], const word x[], u32bit N, word workspace[]) } } -/************************************************* -* Pick a good size for the Karatsuba multiply * -*************************************************/ +/* +* Pick a good size for the Karatsuba multiply +*/ u32bit karatsuba_size(u32bit z_size, u32bit x_size, u32bit x_sw, u32bit y_size, u32bit y_sw) @@ -206,9 +208,9 @@ u32bit karatsuba_size(u32bit z_size, return 0; } -/************************************************* -* Pick a good size for the Karatsuba squaring * -*************************************************/ +/* +* Pick a good size for the Karatsuba squaring +*/ u32bit karatsuba_size(u32bit z_size, u32bit x_size, u32bit x_sw) { if(x_sw == x_size) @@ -236,9 +238,9 @@ u32bit karatsuba_size(u32bit z_size, u32bit x_size, u32bit x_sw) } -/************************************************* -* Multiplication Algorithm Dispatcher * -*************************************************/ +/* +* Multiplication Algorithm Dispatcher +*/ void bigint_mul(word z[], u32bit z_size, word workspace[], const word x[], u32bit x_size, u32bit x_sw, const word y[], u32bit y_size, u32bit y_sw) @@ -287,9 +289,9 @@ void bigint_mul(word z[], u32bit z_size, word workspace[], } } -/************************************************* -* Squaring Algorithm Dispatcher * -*************************************************/ +/* +* Squaring Algorithm Dispatcher +*/ void bigint_sqr(word z[], u32bit z_size, word workspace[], const word x[], u32bit x_size, u32bit x_sw) { diff --git a/src/math/bigint/mp_misc.cpp b/src/math/bigint/mp_misc.cpp index db9c8cda0..6b7fc651b 100644 --- a/src/math/bigint/mp_misc.cpp +++ b/src/math/bigint/mp_misc.cpp @@ -1,7 +1,9 @@ -/************************************************* -* MP Misc Functions Source File * -* (C) 1999-2008 Jack Lloyd * -*************************************************/ +/* +* MP Misc Functions +* (C) 1999-2008 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/mp_core.h> #include <botan/mp_asm.h> @@ -10,9 +12,9 @@ namespace Botan { extern "C" { -/************************************************* -* Core Division Operation * -*************************************************/ +/* +* Core Division Operation +*/ u32bit bigint_divcore(word q, word y1, word y2, word x1, word x2, word x3) { @@ -29,9 +31,9 @@ u32bit bigint_divcore(word q, word y1, word y2, return 0; } -/************************************************* -* Compare two MP integers * -*************************************************/ +/* +* Compare two MP integers +*/ s32bit bigint_cmp(const word x[], u32bit x_size, const word y[], u32bit y_size) { @@ -51,9 +53,9 @@ s32bit bigint_cmp(const word x[], u32bit x_size, return 0; } -/************************************************* -* Do a 2-word/1-word Division * -*************************************************/ +/* +* Do a 2-word/1-word Division +*/ word bigint_divop(word n1, word n0, word d) { word high = n1 % d, quotient = 0; @@ -76,9 +78,9 @@ word bigint_divop(word n1, word n0, word d) return quotient; } -/************************************************* -* Do a 2-word/1-word Modulo * -*************************************************/ +/* +* Do a 2-word/1-word Modulo +*/ word bigint_modop(word n1, word n0, word d) { word z = bigint_divop(n1, n0, d); diff --git a/src/math/bigint/mp_shift.cpp b/src/math/bigint/mp_shift.cpp index 033774e46..a7de79c77 100644 --- a/src/math/bigint/mp_shift.cpp +++ b/src/math/bigint/mp_shift.cpp @@ -1,7 +1,9 @@ -/************************************************* -* MP Shift Algorithms Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* MP Shift Algorithms +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/mp_core.h> #include <botan/mem_ops.h> @@ -10,9 +12,9 @@ namespace Botan { extern "C" { -/************************************************* -* Single Operand Left Shift * -*************************************************/ +/* +* Single Operand Left Shift +*/ void bigint_shl1(word x[], u32bit x_size, u32bit word_shift, u32bit bit_shift) { if(word_shift) @@ -34,9 +36,9 @@ void bigint_shl1(word x[], u32bit x_size, u32bit word_shift, u32bit bit_shift) } } -/************************************************* -* Single Operand Right Shift * -*************************************************/ +/* +* Single Operand Right Shift +*/ void bigint_shr1(word x[], u32bit x_size, u32bit word_shift, u32bit bit_shift) { if(x_size < word_shift) @@ -89,9 +91,9 @@ void bigint_shr1(word x[], u32bit x_size, u32bit word_shift, u32bit bit_shift) } } -/************************************************* -* Two Operand Left Shift * -*************************************************/ +/* +* Two Operand Left Shift +*/ void bigint_shl2(word y[], const word x[], u32bit x_size, u32bit word_shift, u32bit bit_shift) { @@ -109,9 +111,9 @@ void bigint_shl2(word y[], const word x[], u32bit x_size, } } -/************************************************* -* Two Operand Right Shift * -*************************************************/ +/* +* Two Operand Right Shift +*/ void bigint_shr2(word y[], const word x[], u32bit x_size, u32bit word_shift, u32bit bit_shift) { diff --git a/src/math/bigint/mp_types.h b/src/math/bigint/mp_types.h index 81b6d7395..1648713ed 100644 --- a/src/math/bigint/mp_types.h +++ b/src/math/bigint/mp_types.h @@ -1,7 +1,9 @@ -/************************************************* -* Low Level MPI Types Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* Low Level MPI Types +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_MPI_TYPES_H__ #define BOTAN_MPI_TYPES_H__ diff --git a/src/math/bigint/mulop_amd64/mp_mulop.cpp b/src/math/bigint/mulop_amd64/mp_mulop.cpp index d1aa51489..cbd723e28 100644 --- a/src/math/bigint/mulop_amd64/mp_mulop.cpp +++ b/src/math/bigint/mulop_amd64/mp_mulop.cpp @@ -1,7 +1,9 @@ -/************************************************* -* Simple O(N^2) Multiplication and Squaring * -* (C) 1999-2008 Jack Lloyd * -*************************************************/ +/* +* Simple O(N^2) Multiplication and Squaring +* (C) 1999-2008 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/mp_asm.h> #include <botan/mp_asmi.h> @@ -12,9 +14,9 @@ namespace Botan { extern "C" { -/************************************************* -* Simple O(N^2) Multiplication * -*************************************************/ +/* +* Simple O(N^2) Multiplication +*/ void bigint_simple_mul(word z[], const word x[], u32bit x_size, const word y[], u32bit y_size) { @@ -38,14 +40,14 @@ void bigint_simple_mul(word z[], const word x[], u32bit x_size, inline word word_sqr(word x, -/************************************************* +/* * Simple O(N^2) Squaring This is exactly the same algorithm as bigint_simple_mul, however because C/C++ compilers suck at alias analysis it is good to have the version where the compiler knows that x == y -*************************************************/ +*/ void bigint_simple_sqr(word z[], const word x[], u32bit x_size) { clear_mem(z, 2*x_size); diff --git a/src/math/bigint/mulop_generic/mp_mulop.cpp b/src/math/bigint/mulop_generic/mp_mulop.cpp index daa394fe6..4647d00d5 100644 --- a/src/math/bigint/mulop_generic/mp_mulop.cpp +++ b/src/math/bigint/mulop_generic/mp_mulop.cpp @@ -1,7 +1,9 @@ -/************************************************* -* Simple O(N^2) Multiplication and Squaring * -* (C) 1999-2008 Jack Lloyd * -*************************************************/ +/* +* Simple O(N^2) Multiplication and Squaring +* (C) 1999-2008 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/mp_asm.h> #include <botan/mp_asmi.h> @@ -12,9 +14,9 @@ namespace Botan { extern "C" { -/************************************************* -* Simple O(N^2) Multiplication * -*************************************************/ +/* +* Simple O(N^2) Multiplication +*/ void bigint_simple_mul(word z[], const word x[], u32bit x_size, const word y[], u32bit y_size) { @@ -38,7 +40,7 @@ void bigint_simple_mul(word z[], const word x[], u32bit x_size, } } -/************************************************* +/* * Simple O(N^2) Squaring This is exactly the same algorithm as bigint_simple_mul, @@ -48,7 +50,7 @@ that x == y There is an O(n^1.5) squaring algorithm specified in Handbook of Applied Cryptography, chapter 14 -*************************************************/ +*/ void bigint_simple_sqr(word z[], const word x[], u32bit x_size) { const u32bit x_size_8 = x_size - (x_size % 8); diff --git a/src/math/gfpmath/curve_gfp.cpp b/src/math/gfpmath/curve_gfp.cpp index 4b32e7095..37555ea06 100644 --- a/src/math/gfpmath/curve_gfp.cpp +++ b/src/math/gfpmath/curve_gfp.cpp @@ -1,11 +1,11 @@ -/****************************************************** -* Elliptic curves over GF(p) * -* * -* (C) 2007 Martin Doering * -* Christoph Ludwig * -* Falko Strenzke * -* 2008 Jack Lloyd * -******************************************************/ +/****** +* Elliptic curves over GF(p) +* +* (C) 2007 Martin Doering +* Christoph Ludwig +* Falko Strenzke +* 2008 Jack Lloyd +******/ #include <botan/curve_gfp.h> #include <botan/bigint.h> diff --git a/src/math/gfpmath/curve_gfp.h b/src/math/gfpmath/curve_gfp.h index 4d8f9e1b8..90d64b45d 100644 --- a/src/math/gfpmath/curve_gfp.h +++ b/src/math/gfpmath/curve_gfp.h @@ -1,13 +1,13 @@ -/****************************************************** - * Elliptic curves over GF(p) (header file) * - * * - * (C) 2007 Martin Doering * - * [email protected] * - * Christoph Ludwig * - * [email protected] * - * Falko Strenzke * - * [email protected] * - ******************************************************/ +/****** + * Elliptic curves over GF(p) (header file) + * + * (C) 2007 Martin Doering + * Christoph Ludwig + * Falko Strenzke + ******/ #ifndef BOTAN_GFP_CURVE_H__ #define BOTAN_GFP_CURVE_H__ @@ -20,6 +20,8 @@ namespace Botan { /** * This class represents an elliptic curve over GF(p) +* +* Distributed under the terms of the Botan license */ class BOTAN_DLL CurveGFp { diff --git a/src/math/gfpmath/gfp_element.cpp b/src/math/gfpmath/gfp_element.cpp index f5ef28a00..183d7d4ab 100644 --- a/src/math/gfpmath/gfp_element.cpp +++ b/src/math/gfpmath/gfp_element.cpp @@ -1,13 +1,13 @@ -/****************************************************** - * Arithmetic for prime fields GF(p) (source file) * - * * - * (C) 2007 Martin Doering * - * [email protected] * - * Christoph Ludwig * - * [email protected] * - * Falko Strenzke * - * [email protected] * - ******************************************************/ +/****** + * Arithmetic for prime fields GF(p) (source file) + * + * (C) 2007 Martin Doering + * Christoph Ludwig + * Falko Strenzke + ******/ #include <botan/gfp_element.h> #include <botan/numthry.h> @@ -127,6 +127,8 @@ void montg_mult(BigInt& result, BigInt& a_bar, BigInt& b_bar, const BigInt& m, c /** *calculates R=b^n (here b=2) with R>m (and R beeing as small as possible) for an odd modulus m. * no check for oddity is performed! +* +* Distributed under the terms of the Botan license */ BigInt montgm_calc_r_oddmod(const BigInt& prime) { diff --git a/src/math/gfpmath/gfp_element.h b/src/math/gfpmath/gfp_element.h index 6535d7e3e..0a1b4910c 100644 --- a/src/math/gfpmath/gfp_element.h +++ b/src/math/gfpmath/gfp_element.h @@ -1,13 +1,13 @@ -/****************************************************** - * Arithmetic for prime fields GF(p) (header file) * - * * - * (C) 2007 Martin Doering * - * [email protected] * - * Christoph Ludwig * - * [email protected] * - * Falko Strenzke * - * [email protected] * - ******************************************************/ +/****** + * Arithmetic for prime fields GF(p) (header file) + * + * (C) 2007 Martin Doering + * Christoph Ludwig + * Falko Strenzke + ******/ #ifndef BOTAN_GFP_ELEMENT_H__ #define BOTAN_GFP_ELEMENT_H__ @@ -92,7 +92,7 @@ class BOTAN_DLL GFpElement * Assignment operator. * makes *this a totally independent object * (gives *this independent modulus specific values). - * + * @param other The element to assign to our object */ const GFpElement& operator=(const GFpElement& other); diff --git a/src/math/gfpmath/gfp_modulus.h b/src/math/gfpmath/gfp_modulus.h index 55e0ff424..b5c085775 100644 --- a/src/math/gfpmath/gfp_modulus.h +++ b/src/math/gfpmath/gfp_modulus.h @@ -1,14 +1,14 @@ -/****************************************************** - * Modulus and related data for a specific * - * implementation of GF(p) (header file) * - * * - * (C) 2008 Martin Döring * - * [email protected] * - * Christoph Ludwig * - * [email protected] * - * Falko Strenzke * - * [email protected] * - ******************************************************/ +/****** + * Modulus and related data for a specific + * implementation of GF(p) (header file) + * + * (C) 2008 Martin Döring + * Christoph Ludwig + * Falko Strenzke + ******/ #ifndef BOTAN_GFP_MODULUS_H__ #define BOTAN_GFP_MODULUS_H__ @@ -22,6 +22,8 @@ class BOTAN_DLL GFpElement; /** * This class represents a GFpElement modulus including the modulus related * values necessary for the montgomery multiplication. +* +* Distributed under the terms of the Botan license */ class BOTAN_DLL GFpModulus { diff --git a/src/math/gfpmath/point_gfp.cpp b/src/math/gfpmath/point_gfp.cpp index 5312eeaee..9139c3ef9 100644 --- a/src/math/gfpmath/point_gfp.cpp +++ b/src/math/gfpmath/point_gfp.cpp @@ -1,12 +1,12 @@ -/****************************************************** -* Arithmetic for point groups of elliptic curves * -* over GF(p) (source file) * -* * -* (C) 2007 Martin Doering * -* Christoph Ludwig * -* Falko Strenzke * -* 2008 Jack Lloyd * -******************************************************/ +/****** +* Arithmetic for point groups of elliptic curves +* over GF(p) (source file) +* +* (C) 2007 Martin Doering +* Christoph Ludwig +* Falko Strenzke +* 2008 Jack Lloyd +******/ #include <botan/point_gfp.h> #include <botan/numthry.h> @@ -688,6 +688,8 @@ void PointGFp::turn_on_sp_red_mul() const * returns a point equivalent to *this but were * Z has value one, i.e. x and y correspond to * their values in affine coordinates +* +* Distributed under the terms of the Botan license */ PointGFp const PointGFp::get_z_to_one() const { diff --git a/src/math/gfpmath/point_gfp.h b/src/math/gfpmath/point_gfp.h index 687777075..771605efc 100644 --- a/src/math/gfpmath/point_gfp.h +++ b/src/math/gfpmath/point_gfp.h @@ -1,11 +1,13 @@ -/************************************************* -* Arithmetic over GF(p) * -* * -* (C) 2007 Martin Doering * -* Christoph Ludwig * -* Falko Strenzke * -* (C) 2008 Jack Lloyd * -*************************************************/ +/* +* Arithmetic over GF(p) +* +* (C) 2007 Martin Doering +* Christoph Ludwig +* Falko Strenzke +* (C) 2008 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_POINT_GFP_H__ #define BOTAN_POINT_GFP_H__ diff --git a/src/math/numbertheory/blinding.cpp b/src/math/numbertheory/blinding.cpp index 740904d10..c6a3fd1bd 100644 --- a/src/math/numbertheory/blinding.cpp +++ b/src/math/numbertheory/blinding.cpp @@ -1,16 +1,18 @@ -/************************************************* -* Blinder Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* Blinder +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/blinding.h> #include <botan/numthry.h> namespace Botan { -/************************************************* -* Blinder Constructor * -*************************************************/ +/* +* Blinder Constructor +*/ Blinder::Blinder(const BigInt& e, const BigInt& d, const BigInt& n) { if(e < 1 || d < 1 || n < 1) @@ -21,9 +23,9 @@ Blinder::Blinder(const BigInt& e, const BigInt& d, const BigInt& n) this->d = d; } -/************************************************* -* Blind a number * -*************************************************/ +/* +* Blind a number +*/ BigInt Blinder::blind(const BigInt& i) const { if(!reducer.initialized()) @@ -34,9 +36,9 @@ BigInt Blinder::blind(const BigInt& i) const return reducer.multiply(i, e); } -/************************************************* -* Unblind a number * -*************************************************/ +/* +* Unblind a number +*/ BigInt Blinder::unblind(const BigInt& i) const { if(!reducer.initialized()) diff --git a/src/math/numbertheory/blinding.h b/src/math/numbertheory/blinding.h index 958686fb1..5f7f9e6b7 100644 --- a/src/math/numbertheory/blinding.h +++ b/src/math/numbertheory/blinding.h @@ -1,7 +1,9 @@ -/************************************************* -* Blinder Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* Blinder +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_BLINDER_H__ #define BOTAN_BLINDER_H__ @@ -11,9 +13,9 @@ namespace Botan { -/************************************************* -* Blinding Function Object * -*************************************************/ +/* +* Blinding Function Object +*/ class BOTAN_DLL Blinder { public: diff --git a/src/math/numbertheory/def_powm.h b/src/math/numbertheory/def_powm.h index c91ff002c..472c865c3 100644 --- a/src/math/numbertheory/def_powm.h +++ b/src/math/numbertheory/def_powm.h @@ -1,7 +1,9 @@ -/************************************************* -* Modular Exponentiation Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* Modular Exponentiation +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_DEFAULT_MODEXP_H__ #define BOTAN_DEFAULT_MODEXP_H__ @@ -12,9 +14,9 @@ namespace Botan { -/************************************************* -* Fixed Window Exponentiator * -*************************************************/ +/* +* Fixed Window Exponentiator +*/ class BOTAN_DLL Fixed_Window_Exponentiator : public Modular_Exponentiator { public: @@ -34,9 +36,9 @@ class BOTAN_DLL Fixed_Window_Exponentiator : public Modular_Exponentiator Power_Mod::Usage_Hints hints; }; -/************************************************* -* Montgomery Exponentiator * -*************************************************/ +/* +* Montgomery Exponentiator +*/ class BOTAN_DLL Montgomery_Exponentiator : public Modular_Exponentiator { public: diff --git a/src/math/numbertheory/dsa_gen.cpp b/src/math/numbertheory/dsa_gen.cpp index 1e44b7148..83646e50e 100644 --- a/src/math/numbertheory/dsa_gen.cpp +++ b/src/math/numbertheory/dsa_gen.cpp @@ -1,7 +1,9 @@ -/************************************************* -* DSA Parameter Generation Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* DSA Parameter Generation +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/numthry.h> #include <botan/algo_factory.h> @@ -14,9 +16,9 @@ namespace Botan { namespace { -/************************************************* -* Check if this size is allowed by FIPS 186-3 * -*************************************************/ +/* +* Check if this size is allowed by FIPS 186-3 +*/ bool fips186_3_valid_size(u32bit pbits, u32bit qbits) { if(qbits == 160) @@ -33,9 +35,9 @@ bool fips186_3_valid_size(u32bit pbits, u32bit qbits) } -/************************************************* -* Attempt DSA prime generation with given seed * -*************************************************/ +/* +* Attempt DSA prime generation with given seed +*/ bool generate_dsa_primes(RandomNumberGenerator& rng, Algorithm_Factory& af, BigInt& p, BigInt& q, @@ -111,9 +113,9 @@ bool generate_dsa_primes(RandomNumberGenerator& rng, return false; } -/************************************************* -* Generate DSA Primes * -*************************************************/ +/* +* Generate DSA Primes +*/ SecureVector<byte> generate_dsa_primes(RandomNumberGenerator& rng, Algorithm_Factory& af, BigInt& p, BigInt& q, diff --git a/src/math/numbertheory/jacobi.cpp b/src/math/numbertheory/jacobi.cpp index 57c78508a..2ad05ff71 100644 --- a/src/math/numbertheory/jacobi.cpp +++ b/src/math/numbertheory/jacobi.cpp @@ -1,15 +1,17 @@ -/************************************************* -* Jacobi Function Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* Jacobi Function +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/numthry.h> namespace Botan { -/************************************************* -* Calculate the Jacobi symbol * -*************************************************/ +/* +* Calculate the Jacobi symbol +*/ s32bit jacobi(const BigInt& a, const BigInt& n) { if(a.is_negative()) diff --git a/src/math/numbertheory/make_prm.cpp b/src/math/numbertheory/make_prm.cpp index 30ac9a623..226f0c38f 100644 --- a/src/math/numbertheory/make_prm.cpp +++ b/src/math/numbertheory/make_prm.cpp @@ -1,7 +1,9 @@ -/************************************************* -* Prime Generation Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* Prime Generation +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/numthry.h> #include <botan/parsing.h> @@ -9,9 +11,9 @@ namespace Botan { -/************************************************* -* Generate a random prime * -*************************************************/ +/* +* Generate a random prime +*/ BigInt random_prime(RandomNumberGenerator& rng, u32bit bits, const BigInt& coprime, u32bit equiv, u32bit modulo) @@ -76,9 +78,9 @@ BigInt random_prime(RandomNumberGenerator& rng, } } -/************************************************* -* Generate a random safe prime * -*************************************************/ +/* +* Generate a random safe prime +*/ BigInt random_safe_prime(RandomNumberGenerator& rng, u32bit bits) { if(bits <= 64) diff --git a/src/math/numbertheory/mp_numth.cpp b/src/math/numbertheory/mp_numth.cpp index b024d2e2d..45a398440 100644 --- a/src/math/numbertheory/mp_numth.cpp +++ b/src/math/numbertheory/mp_numth.cpp @@ -1,7 +1,9 @@ -/************************************************* -* Fused and Important MP Algorithms Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* Fused and Important MP Algorithms +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/numthry.h> #include <botan/mp_core.h> @@ -10,9 +12,9 @@ namespace Botan { -/************************************************* -* Square a BigInt * -*************************************************/ +/* +* Square a BigInt +*/ BigInt square(const BigInt& x) { const u32bit x_sw = x.sig_words(); @@ -25,9 +27,9 @@ BigInt square(const BigInt& x) return z; } -/************************************************* -* Multiply-Add Operation * -*************************************************/ +/* +* Multiply-Add Operation +*/ BigInt mul_add(const BigInt& a, const BigInt& b, const BigInt& c) { if(c.is_negative() || c.is_zero()) @@ -52,9 +54,9 @@ BigInt mul_add(const BigInt& a, const BigInt& b, const BigInt& c) return r; } -/************************************************* -* Subtract-Multiply Operation * -*************************************************/ +/* +* Subtract-Multiply Operation +*/ BigInt sub_mul(const BigInt& a, const BigInt& b, const BigInt& c) { if(a.is_negative() || b.is_negative()) diff --git a/src/math/numbertheory/numthry.cpp b/src/math/numbertheory/numthry.cpp index ffd523e82..d634ca88c 100644 --- a/src/math/numbertheory/numthry.cpp +++ b/src/math/numbertheory/numthry.cpp @@ -1,7 +1,9 @@ -/************************************************* -* Number Theory Source File * -* (C) 1999-2008 Jack Lloyd * -*************************************************/ +/* +* Number Theory +* (C) 1999-2008 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/numthry.h> #include <botan/bit_ops.h> @@ -11,9 +13,9 @@ namespace Botan { namespace { -/************************************************* -* Miller-Rabin Iterations * -*************************************************/ +/* +* Miller-Rabin Iterations +*/ u32bit miller_rabin_test_iterations(u32bit bits, bool verify) { struct mapping { u32bit bits; u32bit verify_iter; u32bit check_iter; }; @@ -69,9 +71,9 @@ u32bit miller_rabin_test_iterations(u32bit bits, bool verify) } -/************************************************* -* Return the number of 0 bits at the end of n * -*************************************************/ +/* +* Return the number of 0 bits at the end of n +*/ u32bit low_zero_bits(const BigInt& n) { if(n.is_negative() || n.is_zero()) return 0; @@ -97,9 +99,9 @@ u32bit low_zero_bits(const BigInt& n) return low_zero; } -/************************************************* -* Calculate the GCD * -*************************************************/ +/* +* Calculate the GCD +*/ BigInt gcd(const BigInt& a, const BigInt& b) { if(a.is_zero() || b.is_zero()) return 0; @@ -124,17 +126,17 @@ BigInt gcd(const BigInt& a, const BigInt& b) return (y << shift); } -/************************************************* -* Calculate the LCM * -*************************************************/ +/* +* Calculate the LCM +*/ BigInt lcm(const BigInt& a, const BigInt& b) { return ((a * b) / gcd(a, b)); } -/************************************************* -* Find the Modular Inverse * -*************************************************/ +/* +* Find the Modular Inverse +*/ BigInt inverse_mod(const BigInt& n, const BigInt& mod) { if(mod.is_zero()) @@ -181,9 +183,9 @@ BigInt inverse_mod(const BigInt& n, const BigInt& mod) return D; } -/************************************************* -* Modular Exponentiation * -*************************************************/ +/* +* Modular Exponentiation +*/ BigInt power_mod(const BigInt& base, const BigInt& exp, const BigInt& mod) { Power_Mod pow_mod(mod); @@ -192,9 +194,9 @@ BigInt power_mod(const BigInt& base, const BigInt& exp, const BigInt& mod) return pow_mod.execute(); } -/************************************************* -* Do simple tests of primality * -*************************************************/ +/* +* Do simple tests of primality +*/ s32bit simple_primality_tests(const BigInt& n) { const s32bit NOT_PRIME = -1, UNKNOWN = 0, PRIME = 1; @@ -223,33 +225,33 @@ s32bit simple_primality_tests(const BigInt& n) return UNKNOWN; } -/************************************************* -* Fast check of primality * -*************************************************/ +/* +* Fast check of primality +*/ bool check_prime(const BigInt& n, RandomNumberGenerator& rng) { return run_primality_tests(rng, n, 0); } -/************************************************* -* Test for primality * -*************************************************/ +/* +* Test for primality +*/ bool is_prime(const BigInt& n, RandomNumberGenerator& rng) { return run_primality_tests(rng, n, 1); } -/************************************************* -* Verify primality * -*************************************************/ +/* +* Verify primality +*/ bool verify_prime(const BigInt& n, RandomNumberGenerator& rng) { return run_primality_tests(rng, n, 2); } -/************************************************* -* Verify primality * -*************************************************/ +/* +* Verify primality +*/ bool run_primality_tests(RandomNumberGenerator& rng, const BigInt& n, u32bit level) { @@ -258,9 +260,9 @@ bool run_primality_tests(RandomNumberGenerator& rng, return passes_mr_tests(rng, n, level); } -/************************************************* -* Test for primaility using Miller-Rabin * -*************************************************/ +/* +* Test for primaility using Miller-Rabin +*/ bool passes_mr_tests(RandomNumberGenerator& rng, const BigInt& n, u32bit level) { @@ -295,9 +297,9 @@ bool passes_mr_tests(RandomNumberGenerator& rng, return true; } -/************************************************* -* Miller-Rabin Test * -*************************************************/ +/* +* Miller-Rabin Test +*/ bool MillerRabin_Test::passes_test(const BigInt& a) { if(a < 2 || a >= n_minus_1) @@ -319,9 +321,9 @@ bool MillerRabin_Test::passes_test(const BigInt& a) return false; } -/************************************************* -* Miller-Rabin Constructor * -*************************************************/ +/* +* Miller-Rabin Constructor +*/ MillerRabin_Test::MillerRabin_Test(const BigInt& num) { if(num.is_even() || num < 3) diff --git a/src/math/numbertheory/numthry.h b/src/math/numbertheory/numthry.h index 78910d063..e4c043799 100644 --- a/src/math/numbertheory/numthry.h +++ b/src/math/numbertheory/numthry.h @@ -1,7 +1,9 @@ -/************************************************* -* Number Theory Functions Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* Number Theory Functions +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_NUMBER_THEORY_H__ #define BOTAN_NUMBER_THEORY_H__ @@ -13,15 +15,15 @@ namespace Botan { -/************************************************* -* Fused Arithmetic Operations * -*************************************************/ +/* +* Fused Arithmetic Operations +*/ BigInt BOTAN_DLL mul_add(const BigInt&, const BigInt&, const BigInt&); BigInt BOTAN_DLL sub_mul(const BigInt&, const BigInt&, const BigInt&); -/************************************************* -* Number Theory Functions * -*************************************************/ +/* +* Number Theory Functions +*/ inline BigInt abs(const BigInt& n) { return n.abs(); } void BOTAN_DLL divide(const BigInt&, const BigInt&, BigInt&, BigInt&); @@ -35,20 +37,20 @@ s32bit BOTAN_DLL jacobi(const BigInt&, const BigInt&); BigInt BOTAN_DLL power_mod(const BigInt&, const BigInt&, const BigInt&); -/************************************************* -* Compute the square root of x modulo a prime * -* using the Shanks-Tonnelli algorithm * -*************************************************/ +/* +* Compute the square root of x modulo a prime +* using the Shanks-Tonnelli algorithm +*/ BigInt ressol(const BigInt& x, const BigInt& p); -/************************************************* -* Utility Functions * -*************************************************/ +/* +* Utility Functions +*/ u32bit BOTAN_DLL low_zero_bits(const BigInt&); -/************************************************* -* Primality Testing * -*************************************************/ +/* +* Primality Testing +*/ bool BOTAN_DLL check_prime(const BigInt&, RandomNumberGenerator&); bool BOTAN_DLL is_prime(const BigInt&, RandomNumberGenerator&); bool BOTAN_DLL verify_prime(const BigInt&, RandomNumberGenerator&); @@ -61,9 +63,9 @@ bool BOTAN_DLL passes_mr_tests(RandomNumberGenerator&, bool BOTAN_DLL run_primality_tests(RandomNumberGenerator&, const BigInt&, u32bit = 1); -/************************************************* -* Random Number Generation * -*************************************************/ +/* +* Random Number Generation +*/ BigInt BOTAN_DLL random_prime(RandomNumberGenerator&, u32bit bits, const BigInt& coprime = 1, u32bit equiv = 1, u32bit equiv_mod = 2); @@ -71,9 +73,9 @@ BigInt BOTAN_DLL random_prime(RandomNumberGenerator&, BigInt BOTAN_DLL random_safe_prime(RandomNumberGenerator&, u32bit); -/************************************************* -* DSA Parameter Generation * -*************************************************/ +/* +* DSA Parameter Generation +*/ class Algorithm_Factory; SecureVector<byte> BOTAN_DLL @@ -89,18 +91,18 @@ generate_dsa_primes(RandomNumberGenerator& rng, u32bit p_bits, u32bit q_bits, const MemoryRegion<byte>& seed); -/************************************************* -* Prime Numbers * -*************************************************/ +/* +* Prime Numbers +*/ const u32bit PRIME_TABLE_SIZE = 6541; const u32bit PRIME_PRODUCTS_TABLE_SIZE = 256; extern const u16bit BOTAN_DLL PRIMES[]; extern const u64bit PRIME_PRODUCTS[]; -/************************************************* -* Miller-Rabin Primality Tester * -*************************************************/ +/* +* Miller-Rabin Primality Tester +*/ class BOTAN_DLL MillerRabin_Test { public: diff --git a/src/math/numbertheory/pow_mod.cpp b/src/math/numbertheory/pow_mod.cpp index 17ca7b796..4801a945c 100644 --- a/src/math/numbertheory/pow_mod.cpp +++ b/src/math/numbertheory/pow_mod.cpp @@ -1,25 +1,27 @@ -/************************************************* -* Modular Exponentiation Proxy Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* Modular Exponentiation Proxy +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/pow_mod.h> #include <botan/engine.h> namespace Botan { -/************************************************* -* Power_Mod Constructor * -*************************************************/ +/* +* Power_Mod Constructor +*/ Power_Mod::Power_Mod(const BigInt& n, Usage_Hints hints) { core = 0; set_modulus(n, hints); } -/************************************************* -* Power_Mod Copy Constructor * -*************************************************/ +/* +* Power_Mod Copy Constructor +*/ Power_Mod::Power_Mod(const Power_Mod& other) { core = 0; @@ -27,9 +29,9 @@ Power_Mod::Power_Mod(const Power_Mod& other) core = other.core->copy(); } -/************************************************* -* Power_Mod Assignment Operator * -*************************************************/ +/* +* Power_Mod Assignment Operator +*/ Power_Mod& Power_Mod::operator=(const Power_Mod& other) { delete core; @@ -39,26 +41,26 @@ Power_Mod& Power_Mod::operator=(const Power_Mod& other) return (*this); } -/************************************************* -* Power_Mod Destructor * -*************************************************/ +/* +* Power_Mod Destructor +*/ Power_Mod::~Power_Mod() { delete core; } -/************************************************* -* Set the modulus * -*************************************************/ +/* +* Set the modulus +*/ void Power_Mod::set_modulus(const BigInt& n, Usage_Hints hints) const { delete core; core = ((n == 0) ? 0 : Engine_Core::mod_exp(n, hints)); } -/************************************************* -* Set the base * -*************************************************/ +/* +* Set the base +*/ void Power_Mod::set_base(const BigInt& b) const { if(b.is_zero() || b.is_negative()) @@ -69,9 +71,9 @@ void Power_Mod::set_base(const BigInt& b) const core->set_base(b); } -/************************************************* -* Set the exponent * -*************************************************/ +/* +* Set the exponent +*/ void Power_Mod::set_exponent(const BigInt& e) const { if(e.is_negative()) @@ -82,9 +84,9 @@ void Power_Mod::set_exponent(const BigInt& e) const core->set_exponent(e); } -/************************************************* -* Compute the result * -*************************************************/ +/* +* Compute the result +*/ BigInt Power_Mod::execute() const { if(!core) @@ -94,9 +96,9 @@ BigInt Power_Mod::execute() const namespace { -/************************************************* -* Choose potentially useful hints * -*************************************************/ +/* +* Choose potentially useful hints +*/ Power_Mod::Usage_Hints choose_base_hints(const BigInt& b, const BigInt& n) { if(b == 2) @@ -114,9 +116,9 @@ Power_Mod::Usage_Hints choose_base_hints(const BigInt& b, const BigInt& n) return Power_Mod::NO_HINTS; } -/************************************************* -* Choose potentially useful hints * -*************************************************/ +/* +* Choose potentially useful hints +*/ Power_Mod::Usage_Hints choose_exp_hints(const BigInt& e, const BigInt& n) { const u32bit e_bits = e.bits(); @@ -131,9 +133,9 @@ Power_Mod::Usage_Hints choose_exp_hints(const BigInt& e, const BigInt& n) } -/************************************************* -* Fixed_Exponent_Power_Mod Constructor * -*************************************************/ +/* +* Fixed_Exponent_Power_Mod Constructor +*/ Fixed_Exponent_Power_Mod::Fixed_Exponent_Power_Mod(const BigInt& e, const BigInt& n, Usage_Hints hints) : @@ -142,9 +144,9 @@ Fixed_Exponent_Power_Mod::Fixed_Exponent_Power_Mod(const BigInt& e, set_exponent(e); } -/************************************************* -* Fixed_Base_Power_Mod Constructor * -*************************************************/ +/* +* Fixed_Base_Power_Mod Constructor +*/ Fixed_Base_Power_Mod::Fixed_Base_Power_Mod(const BigInt& b, const BigInt& n, Usage_Hints hints) : Power_Mod(n, Usage_Hints(hints | BASE_IS_FIXED | choose_base_hints(b, n))) diff --git a/src/math/numbertheory/pow_mod.h b/src/math/numbertheory/pow_mod.h index 37e0871da..6952dcd1b 100644 --- a/src/math/numbertheory/pow_mod.h +++ b/src/math/numbertheory/pow_mod.h @@ -1,7 +1,9 @@ -/************************************************* -* Modular Exponentiator Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* Modular Exponentiator +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_POWER_MOD_H__ #define BOTAN_POWER_MOD_H__ @@ -10,9 +12,9 @@ namespace Botan { -/************************************************* -* Modular Exponentiator Interface * -*************************************************/ +/* +* Modular Exponentiator Interface +*/ class BOTAN_DLL Modular_Exponentiator { public: @@ -23,9 +25,9 @@ class BOTAN_DLL Modular_Exponentiator virtual ~Modular_Exponentiator() {} }; -/************************************************* -* Modular Exponentiator Proxy * -*************************************************/ +/* +* Modular Exponentiator Proxy +*/ class BOTAN_DLL Power_Mod { public: @@ -58,9 +60,9 @@ class BOTAN_DLL Power_Mod Usage_Hints hints; }; -/************************************************* -* Fixed Exponent Modular Exponentiator Proxy * -*************************************************/ +/* +* Fixed Exponent Modular Exponentiator Proxy +*/ class BOTAN_DLL Fixed_Exponent_Power_Mod : public Power_Mod { public: @@ -72,9 +74,9 @@ class BOTAN_DLL Fixed_Exponent_Power_Mod : public Power_Mod Usage_Hints = NO_HINTS); }; -/************************************************* -* Fixed Base Modular Exponentiator Proxy * -*************************************************/ +/* +* Fixed Base Modular Exponentiator Proxy +*/ class BOTAN_DLL Fixed_Base_Power_Mod : public Power_Mod { public: diff --git a/src/math/numbertheory/powm_fw.cpp b/src/math/numbertheory/powm_fw.cpp index c29b9f311..b764ee7aa 100644 --- a/src/math/numbertheory/powm_fw.cpp +++ b/src/math/numbertheory/powm_fw.cpp @@ -1,7 +1,9 @@ -/************************************************* -* Fixed Window Exponentiation Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* Fixed Window Exponentiation +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/def_powm.h> #include <botan/numthry.h> @@ -11,9 +13,9 @@ namespace Botan { namespace { -/************************************************* -* Try to choose a good window size * -*************************************************/ +/* +* Try to choose a good window size +*/ u32bit choose_window_bits(u32bit exp_bits, u32bit, Power_Mod::Usage_Hints hints) { @@ -47,17 +49,17 @@ u32bit choose_window_bits(u32bit exp_bits, u32bit, } -/************************************************* -* Set the exponent * -*************************************************/ +/* +* Set the exponent +*/ void Fixed_Window_Exponentiator::set_exponent(const BigInt& e) { exp = e; } -/************************************************* -* Set the base * -*************************************************/ +/* +* Set the base +*/ void Fixed_Window_Exponentiator::set_base(const BigInt& base) { window_bits = choose_window_bits(exp.bits(), base.bits(), hints); @@ -68,9 +70,9 @@ void Fixed_Window_Exponentiator::set_base(const BigInt& base) g[j] = reducer.multiply(g[j-1], g[0]); } -/************************************************* -* Compute the result * -*************************************************/ +/* +* Compute the result +*/ BigInt Fixed_Window_Exponentiator::execute() const { const u32bit exp_nibbles = (exp.bits() + window_bits - 1) / window_bits; @@ -88,9 +90,9 @@ BigInt Fixed_Window_Exponentiator::execute() const return x; } -/************************************************* -* Fixed_Window_Exponentiator Constructor * -*************************************************/ +/* +* Fixed_Window_Exponentiator Constructor +*/ Fixed_Window_Exponentiator::Fixed_Window_Exponentiator(const BigInt& n, Power_Mod::Usage_Hints hints) { diff --git a/src/math/numbertheory/powm_mnt.cpp b/src/math/numbertheory/powm_mnt.cpp index 6091d467a..e6d8cc3f0 100644 --- a/src/math/numbertheory/powm_mnt.cpp +++ b/src/math/numbertheory/powm_mnt.cpp @@ -1,7 +1,9 @@ -/************************************************* -* Montgomery Exponentiation Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* Montgomery Exponentiation +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/def_powm.h> #include <botan/numthry.h> @@ -11,9 +13,9 @@ namespace Botan { namespace { -/************************************************* -* Try to choose a good window size * -*************************************************/ +/* +* Try to choose a good window size +*/ u32bit choose_window_bits(u32bit exp_bits, u32bit, Power_Mod::Usage_Hints hints) { @@ -43,9 +45,9 @@ u32bit choose_window_bits(u32bit exp_bits, u32bit, return window_bits; } -/************************************************* -* Montgomery Reduction * -*************************************************/ +/* +* Montgomery Reduction +*/ inline void montgomery_reduce(BigInt& out, MemoryRegion<word>& z_buf, const BigInt& x_bn, u32bit x_size, word u) { @@ -60,18 +62,18 @@ inline void montgomery_reduce(BigInt& out, MemoryRegion<word>& z_buf, } -/************************************************* -* Set the exponent * -*************************************************/ +/* +* Set the exponent +*/ void Montgomery_Exponentiator::set_exponent(const BigInt& exp) { this->exp = exp; exp_bits = exp.bits(); } -/************************************************* -* Set the base * -*************************************************/ +/* +* Set the base +*/ void Montgomery_Exponentiator::set_base(const BigInt& base) { window_bits = choose_window_bits(exp.bits(), base.bits(), hints); @@ -105,9 +107,9 @@ void Montgomery_Exponentiator::set_base(const BigInt& base) } } -/************************************************* -* Compute the result * -*************************************************/ +/* +* Compute the result +*/ BigInt Montgomery_Exponentiator::execute() const { const u32bit exp_nibbles = (exp_bits + window_bits - 1) / window_bits; @@ -148,9 +150,9 @@ BigInt Montgomery_Exponentiator::execute() const return x; } -/************************************************* -* Montgomery_Exponentiator Constructor * -*************************************************/ +/* +* Montgomery_Exponentiator Constructor +*/ Montgomery_Exponentiator::Montgomery_Exponentiator(const BigInt& mod, Power_Mod::Usage_Hints hints) { diff --git a/src/math/numbertheory/primes.cpp b/src/math/numbertheory/primes.cpp index d005167e5..26ff098a5 100644 --- a/src/math/numbertheory/primes.cpp +++ b/src/math/numbertheory/primes.cpp @@ -1,7 +1,9 @@ -/************************************************* -* Small Primes Table * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* Small Primes Table +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/numthry.h> diff --git a/src/math/numbertheory/reducer.cpp b/src/math/numbertheory/reducer.cpp index 47c5c20fc..fbd675ea6 100644 --- a/src/math/numbertheory/reducer.cpp +++ b/src/math/numbertheory/reducer.cpp @@ -1,7 +1,9 @@ -/************************************************* -* Modular Reducer Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* Modular Reducer +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/reducer.h> #include <botan/numthry.h> @@ -9,9 +11,9 @@ namespace Botan { -/************************************************* -* Modular_Reducer Constructor * -*************************************************/ +/* +* Modular_Reducer Constructor +*/ Modular_Reducer::Modular_Reducer(const BigInt& mod) { if(mod <= 0) @@ -27,9 +29,9 @@ Modular_Reducer::Modular_Reducer(const BigInt& mod) mu_words = mu.sig_words(); } -/************************************************* -* Barrett Reduction * -*************************************************/ +/* +* Barrett Reduction +*/ BigInt Modular_Reducer::reduce(const BigInt& x) const { if(mod_words == 0) @@ -76,17 +78,17 @@ BigInt Modular_Reducer::reduce(const BigInt& x) const return t1; } -/************************************************* -* Multiply, followed by a reduction * -*************************************************/ +/* +* Multiply, followed by a reduction +*/ BigInt Modular_Reducer::multiply(const BigInt& x, const BigInt& y) const { return reduce(x * y); } -/************************************************* -* Square, followed by a reduction * -*************************************************/ +/* +* Square, followed by a reduction +*/ BigInt Modular_Reducer::square(const BigInt& x) const { return reduce(Botan::square(x)); diff --git a/src/math/numbertheory/reducer.h b/src/math/numbertheory/reducer.h index 48008e73b..d234e0735 100644 --- a/src/math/numbertheory/reducer.h +++ b/src/math/numbertheory/reducer.h @@ -1,7 +1,9 @@ -/************************************************* -* Modular Reducer Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* Modular Reducer +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_MODARITH_H__ #define BOTAN_MODARITH_H__ @@ -10,9 +12,9 @@ namespace Botan { -/************************************************* -* Modular Reducer * -*************************************************/ +/* +* Modular Reducer +*/ class BOTAN_DLL Modular_Reducer { public: diff --git a/src/math/numbertheory/ressol.cpp b/src/math/numbertheory/ressol.cpp index 0cd2b988a..6a078726d 100644 --- a/src/math/numbertheory/ressol.cpp +++ b/src/math/numbertheory/ressol.cpp @@ -1,8 +1,10 @@ -/************************************************* -* Shanks-Tonnelli (RESSOL) Source File * -* (C) 2007-2008 Falko Strenzke, FlexSecure GmbH * -* (C) 2008 Jack Lloyd * -*************************************************/ +/* +* Shanks-Tonnelli (RESSOL) +* (C) 2007-2008 Falko Strenzke, FlexSecure GmbH +* (C) 2008 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/numthry.h> #include <botan/reducer.h> @@ -11,9 +13,9 @@ namespace Botan { -/************************************************* -* Shanks-Tonnelli algorithm * -*************************************************/ +/* +* Shanks-Tonnelli algorithm +*/ BigInt ressol(const BigInt& a, const BigInt& p) { if(a < 0) diff --git a/src/modes/cbc/cbc.cpp b/src/modes/cbc/cbc.cpp index 2bb2320e6..f26d4d6cf 100644 --- a/src/modes/cbc/cbc.cpp +++ b/src/modes/cbc/cbc.cpp @@ -1,7 +1,9 @@ -/************************************************* -* CBC Mode Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* CBC Mode +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/cbc.h> #include <botan/xor_buf.h> @@ -9,9 +11,9 @@ namespace Botan { -/************************************************* -* CBC Encryption Constructor * -*************************************************/ +/* +* CBC Encryption Constructor +*/ CBC_Encryption::CBC_Encryption(BlockCipher* ciph, BlockCipherModePaddingMethod* pad) : BlockCipherMode(ciph, "CBC", ciph->BLOCK_SIZE), @@ -21,9 +23,9 @@ CBC_Encryption::CBC_Encryption(BlockCipher* ciph, throw Invalid_Block_Size(name(), padder->name()); } -/************************************************* -* CBC Encryption Constructor * -*************************************************/ +/* +* CBC Encryption Constructor +*/ CBC_Encryption::CBC_Encryption(BlockCipher* ciph, BlockCipherModePaddingMethod* pad, const SymmetricKey& key, @@ -37,9 +39,9 @@ CBC_Encryption::CBC_Encryption(BlockCipher* ciph, set_iv(iv); } -/************************************************* -* Encrypt in CBC mode * -*************************************************/ +/* +* Encrypt in CBC mode +*/ void CBC_Encryption::write(const byte input[], u32bit length) { while(length) @@ -58,9 +60,9 @@ void CBC_Encryption::write(const byte input[], u32bit length) } } -/************************************************* -* Finish encrypting in CBC mode * -*************************************************/ +/* +* Finish encrypting in CBC mode +*/ void CBC_Encryption::end_msg() { SecureVector<byte> padding(BLOCK_SIZE); @@ -70,17 +72,17 @@ void CBC_Encryption::end_msg() throw Exception(name() + ": Did not pad to full blocksize"); } -/************************************************* -* Return a CBC mode name * -*************************************************/ +/* +* Return a CBC mode name +*/ std::string CBC_Encryption::name() const { return (cipher->name() + "/" + mode_name + "/" + padder->name()); } -/************************************************* -* CBC Decryption Constructor * -*************************************************/ +/* +* CBC Decryption Constructor +*/ CBC_Decryption::CBC_Decryption(BlockCipher* ciph, BlockCipherModePaddingMethod* pad) : BlockCipherMode(ciph, "CBC", ciph->BLOCK_SIZE), @@ -91,9 +93,9 @@ CBC_Decryption::CBC_Decryption(BlockCipher* ciph, temp.create(BLOCK_SIZE); } -/************************************************* -* CBC Decryption Constructor * -*************************************************/ +/* +* CBC Decryption Constructor +*/ CBC_Decryption::CBC_Decryption(BlockCipher* ciph, BlockCipherModePaddingMethod* pad, const SymmetricKey& key, @@ -108,9 +110,9 @@ CBC_Decryption::CBC_Decryption(BlockCipher* ciph, set_iv(iv); } -/************************************************* -* Decrypt in CBC mode * -*************************************************/ +/* +* Decrypt in CBC mode +*/ void CBC_Decryption::write(const byte input[], u32bit length) { while(length) @@ -131,9 +133,9 @@ void CBC_Decryption::write(const byte input[], u32bit length) } } -/************************************************* -* Finish decrypting in CBC mode * -*************************************************/ +/* +* Finish decrypting in CBC mode +*/ void CBC_Decryption::end_msg() { if(position != BLOCK_SIZE) @@ -145,9 +147,9 @@ void CBC_Decryption::end_msg() position = 0; } -/************************************************* -* Return a CBC mode name * -*************************************************/ +/* +* Return a CBC mode name +*/ std::string CBC_Decryption::name() const { return (cipher->name() + "/" + mode_name + "/" + padder->name()); diff --git a/src/modes/cbc/cbc.h b/src/modes/cbc/cbc.h index e7b250e33..a926ac180 100644 --- a/src/modes/cbc/cbc.h +++ b/src/modes/cbc/cbc.h @@ -1,7 +1,9 @@ -/************************************************* -* CBC Mode Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* CBC Mode +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_CBC_H__ #define BOTAN_CBC_H__ @@ -11,9 +13,9 @@ namespace Botan { -/************************************************* -* CBC Encryption * -*************************************************/ +/* +* CBC Encryption +*/ class BOTAN_DLL CBC_Encryption : public BlockCipherMode { public: @@ -29,9 +31,9 @@ class BOTAN_DLL CBC_Encryption : public BlockCipherMode const BlockCipherModePaddingMethod* padder; }; -/************************************************* -* CBC Decryption * -*************************************************/ +/* +* CBC Decryption +*/ class BOTAN_DLL CBC_Decryption : public BlockCipherMode { public: diff --git a/src/modes/cfb/cfb.cpp b/src/modes/cfb/cfb.cpp index f5eb4cecf..a126bd995 100644 --- a/src/modes/cfb/cfb.cpp +++ b/src/modes/cfb/cfb.cpp @@ -1,7 +1,9 @@ -/************************************************* -* CFB Mode Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* CFB Mode +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/cfb.h> #include <botan/parsing.h> @@ -12,9 +14,9 @@ namespace Botan { namespace { -/************************************************* -* Check the feedback size * -*************************************************/ +/* +* Check the feedback size +*/ void check_feedback(u32bit BLOCK_SIZE, u32bit FEEDBACK_SIZE, u32bit bits, const std::string& name) { @@ -25,9 +27,9 @@ void check_feedback(u32bit BLOCK_SIZE, u32bit FEEDBACK_SIZE, u32bit bits, } -/************************************************* -* CFB Encryption Constructor * -*************************************************/ +/* +* CFB Encryption Constructor +*/ CFB_Encryption::CFB_Encryption(BlockCipher* ciph, u32bit fback_bits) : BlockCipherMode(ciph, "CFB", ciph->BLOCK_SIZE, 1), @@ -36,9 +38,9 @@ CFB_Encryption::CFB_Encryption(BlockCipher* ciph, check_feedback(BLOCK_SIZE, FEEDBACK_SIZE, fback_bits, name()); } -/************************************************* -* CFB Encryption Constructor * -*************************************************/ +/* +* CFB Encryption Constructor +*/ CFB_Encryption::CFB_Encryption(BlockCipher* ciph, const SymmetricKey& key, const InitializationVector& iv, @@ -51,9 +53,9 @@ CFB_Encryption::CFB_Encryption(BlockCipher* ciph, set_iv(iv); } -/************************************************* -* Encrypt data in CFB mode * -*************************************************/ +/* +* Encrypt data in CFB mode +*/ void CFB_Encryption::write(const byte input[], u32bit length) { while(length) @@ -69,9 +71,9 @@ void CFB_Encryption::write(const byte input[], u32bit length) } } -/************************************************* -* Do the feedback * -*************************************************/ +/* +* Do the feedback +*/ void CFB_Encryption::feedback() { for(u32bit j = 0; j != BLOCK_SIZE - FEEDBACK_SIZE; ++j) @@ -81,9 +83,9 @@ void CFB_Encryption::feedback() position = 0; } -/************************************************* -* CFB Decryption Constructor * -*************************************************/ +/* +* CFB Decryption Constructor +*/ CFB_Decryption::CFB_Decryption(BlockCipher* ciph, u32bit fback_bits) : BlockCipherMode(ciph, "CFB", ciph->BLOCK_SIZE, 1), @@ -92,9 +94,9 @@ CFB_Decryption::CFB_Decryption(BlockCipher* ciph, check_feedback(BLOCK_SIZE, FEEDBACK_SIZE, fback_bits, name()); } -/************************************************* -* CFB Decryption Constructor * -*************************************************/ +/* +* CFB Decryption Constructor +*/ CFB_Decryption::CFB_Decryption(BlockCipher* ciph, const SymmetricKey& key, const InitializationVector& iv, @@ -107,9 +109,9 @@ CFB_Decryption::CFB_Decryption(BlockCipher* ciph, set_iv(iv); } -/************************************************* -* Decrypt data in CFB mode * -*************************************************/ +/* +* Decrypt data in CFB mode +*/ void CFB_Decryption::write(const byte input[], u32bit length) { while(length) @@ -126,9 +128,9 @@ void CFB_Decryption::write(const byte input[], u32bit length) } } -/************************************************* -* Do the feedback * -*************************************************/ +/* +* Do the feedback +*/ void CFB_Decryption::feedback() { for(u32bit j = 0; j != BLOCK_SIZE - FEEDBACK_SIZE; ++j) diff --git a/src/modes/cfb/cfb.h b/src/modes/cfb/cfb.h index dad7ece13..7810c00e4 100644 --- a/src/modes/cfb/cfb.h +++ b/src/modes/cfb/cfb.h @@ -1,7 +1,9 @@ -/************************************************* -* CFB Mode Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* CFB Mode +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_CFB_H__ #define BOTAN_CFB_H__ @@ -10,9 +12,9 @@ namespace Botan { -/************************************************* -* CFB Encryption * -*************************************************/ +/* +* CFB Encryption +*/ class BOTAN_DLL CFB_Encryption : public BlockCipherMode { public: @@ -25,9 +27,9 @@ class BOTAN_DLL CFB_Encryption : public BlockCipherMode const u32bit FEEDBACK_SIZE; }; -/************************************************* -* CFB Decryption * -*************************************************/ +/* +* CFB Decryption +*/ class BOTAN_DLL CFB_Decryption : public BlockCipherMode { public: diff --git a/src/modes/ctr/ctr.cpp b/src/modes/ctr/ctr.cpp index a17343df1..9eb42ec5a 100644 --- a/src/modes/ctr/ctr.cpp +++ b/src/modes/ctr/ctr.cpp @@ -1,7 +1,9 @@ -/************************************************* -* CTR Mode Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* CTR Mode +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/ctr.h> #include <botan/xor_buf.h> @@ -9,17 +11,17 @@ namespace Botan { -/************************************************* -* CTR-BE Constructor * -*************************************************/ +/* +* CTR-BE Constructor +*/ CTR_BE::CTR_BE(BlockCipher* ciph) : BlockCipherMode(ciph, "CTR-BE", ciph->BLOCK_SIZE, 1) { } -/************************************************* -* CTR-BE Constructor * -*************************************************/ +/* +* CTR-BE Constructor +*/ CTR_BE::CTR_BE(BlockCipher* ciph, const SymmetricKey& key, const InitializationVector& iv) : BlockCipherMode(ciph, "CTR-BE", ciph->BLOCK_SIZE, 1) @@ -28,9 +30,9 @@ CTR_BE::CTR_BE(BlockCipher* ciph, const SymmetricKey& key, set_iv(iv); } -/************************************************* -* CTR-BE Encryption/Decryption * -*************************************************/ +/* +* CTR-BE Encryption/Decryption +*/ void CTR_BE::write(const byte input[], u32bit length) { u32bit copied = std::min(BLOCK_SIZE - position, length); @@ -58,9 +60,9 @@ void CTR_BE::write(const byte input[], u32bit length) position += length; } -/************************************************* -* Increment the counter and update the buffer * -*************************************************/ +/* +* Increment the counter and update the buffer +*/ void CTR_BE::increment_counter() { for(s32bit j = BLOCK_SIZE - 1; j >= 0; --j) diff --git a/src/modes/ctr/ctr.h b/src/modes/ctr/ctr.h index 9fececddd..aa0db5761 100644 --- a/src/modes/ctr/ctr.h +++ b/src/modes/ctr/ctr.h @@ -1,7 +1,9 @@ -/************************************************* -* CTR Mode Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* CTR Mode +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_COUNTER_MODE_H__ #define BOTAN_COUNTER_MODE_H__ @@ -11,9 +13,9 @@ namespace Botan { -/************************************************* -* CTR-BE Mode * -*************************************************/ +/* +* CTR-BE Mode +*/ class BOTAN_DLL CTR_BE : public BlockCipherMode { public: diff --git a/src/modes/cts/cts.cpp b/src/modes/cts/cts.cpp index 120cf8386..99f042f61 100644 --- a/src/modes/cts/cts.cpp +++ b/src/modes/cts/cts.cpp @@ -1,7 +1,9 @@ -/************************************************* -* CTS Mode Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* CTS Mode +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/cts.h> #include <botan/xor_buf.h> @@ -9,9 +11,9 @@ namespace Botan { -/************************************************* -* Encrypt a block * -*************************************************/ +/* +* Encrypt a block +*/ void CTS_Encryption::encrypt(const byte block[]) { xor_buf(state, block, BLOCK_SIZE); @@ -19,9 +21,9 @@ void CTS_Encryption::encrypt(const byte block[]) send(state, BLOCK_SIZE); } -/************************************************* -* Encrypt in CTS mode * -*************************************************/ +/* +* Encrypt in CTS mode +*/ void CTS_Encryption::write(const byte input[], u32bit length) { u32bit copied = std::min(BUFFER_SIZE - position, length); @@ -53,9 +55,9 @@ void CTS_Encryption::write(const byte input[], u32bit length) position += length; } -/************************************************* -* Finish encrypting in CTS mode * -*************************************************/ +/* +* Finish encrypting in CTS mode +*/ void CTS_Encryption::end_msg() { if(position < BLOCK_SIZE + 1) @@ -68,9 +70,9 @@ void CTS_Encryption::end_msg() send(cn, position - BLOCK_SIZE); } -/************************************************* -* Decrypt a block * -*************************************************/ +/* +* Decrypt a block +*/ void CTS_Decryption::decrypt(const byte block[]) { cipher->decrypt(block, temp); @@ -79,9 +81,9 @@ void CTS_Decryption::decrypt(const byte block[]) state.copy(block, BLOCK_SIZE); } -/************************************************* -* Decrypt in CTS mode * -*************************************************/ +/* +* Decrypt in CTS mode +*/ void CTS_Decryption::write(const byte input[], u32bit length) { u32bit copied = std::min(BUFFER_SIZE - position, length); @@ -113,9 +115,9 @@ void CTS_Decryption::write(const byte input[], u32bit length) position += length; } -/************************************************* -* Finish decrypting in CTS mode * -*************************************************/ +/* +* Finish decrypting in CTS mode +*/ void CTS_Decryption::end_msg() { cipher->decrypt(buffer, temp); diff --git a/src/modes/cts/cts.h b/src/modes/cts/cts.h index 57582d8de..9b17203f3 100644 --- a/src/modes/cts/cts.h +++ b/src/modes/cts/cts.h @@ -1,7 +1,9 @@ -/************************************************* -* CTS Mode Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* CTS Mode +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_CTS_H__ #define BOTAN_CTS_H__ @@ -11,9 +13,9 @@ namespace Botan { -/************************************************* -* CTS Encryption * -*************************************************/ +/* +* CTS Encryption +*/ class BOTAN_DLL CTS_Encryption : public BlockCipherMode { public: @@ -31,9 +33,9 @@ class BOTAN_DLL CTS_Encryption : public BlockCipherMode void encrypt(const byte[]); }; -/************************************************* -* CTS Decryption * -*************************************************/ +/* +* CTS Decryption +*/ class BOTAN_DLL CTS_Decryption : public BlockCipherMode { public: diff --git a/src/modes/eax/eax.cpp b/src/modes/eax/eax.cpp index c31a823cf..67465a776 100644 --- a/src/modes/eax/eax.cpp +++ b/src/modes/eax/eax.cpp @@ -1,7 +1,9 @@ -/************************************************* -* EAX Mode Encryption Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* EAX Mode Encryption +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/eax.h> #include <botan/cmac.h> @@ -13,9 +15,9 @@ namespace Botan { namespace { -/************************************************* -* EAX MAC-based PRF * -*************************************************/ +/* +* EAX MAC-based PRF +*/ SecureVector<byte> eax_prf(byte tag, u32bit BLOCK_SIZE, MessageAuthenticationCode* mac, const byte in[], u32bit length) @@ -29,9 +31,9 @@ SecureVector<byte> eax_prf(byte tag, u32bit BLOCK_SIZE, } -/************************************************* -* EAX_Base Constructor * -*************************************************/ +/* +* EAX_Base Constructor +*/ EAX_Base::EAX_Base(BlockCipher* ciph, u32bit tag_size) : TAG_SIZE(tag_size ? tag_size / 8 : ciph->BLOCK_SIZE), @@ -48,9 +50,9 @@ EAX_Base::EAX_Base(BlockCipher* ciph, position = 0; } -/************************************************* -* Check if a keylength is valid for EAX * -*************************************************/ +/* +* Check if a keylength is valid for EAX +*/ bool EAX_Base::valid_keylength(u32bit n) const { if(!cipher->valid_keylength(n)) @@ -60,9 +62,9 @@ bool EAX_Base::valid_keylength(u32bit n) const return true; } -/************************************************* -* Set the EAX key * -*************************************************/ +/* +* Set the EAX key +*/ void EAX_Base::set_key(const SymmetricKey& key) { cipher->set_key(key); @@ -70,9 +72,9 @@ void EAX_Base::set_key(const SymmetricKey& key) header_mac = eax_prf(1, BLOCK_SIZE, mac, 0, 0); } -/************************************************* -* Do setup at the start of each message * -*************************************************/ +/* +* Do setup at the start of each message +*/ void EAX_Base::start_msg() { for(u32bit j = 0; j != BLOCK_SIZE - 1; ++j) @@ -80,9 +82,9 @@ void EAX_Base::start_msg() mac->update(2); } -/************************************************* -* Set the EAX nonce * -*************************************************/ +/* +* Set the EAX nonce +*/ void EAX_Base::set_iv(const InitializationVector& iv) { nonce_mac = eax_prf(0, BLOCK_SIZE, mac, iv.begin(), iv.length()); @@ -90,25 +92,25 @@ void EAX_Base::set_iv(const InitializationVector& iv) cipher->encrypt(state, buffer); } -/************************************************* -* Set the EAX header * -*************************************************/ +/* +* Set the EAX header +*/ void EAX_Base::set_header(const byte header[], u32bit length) { header_mac = eax_prf(1, BLOCK_SIZE, mac, header, length); } -/************************************************* -* Return the name of this cipher mode * -*************************************************/ +/* +* Return the name of this cipher mode +*/ std::string EAX_Base::name() const { return (cipher->name() + "/EAX"); } -/************************************************* -* Increment the counter and update the buffer * -*************************************************/ +/* +* Increment the counter and update the buffer +*/ void EAX_Base::increment_counter() { for(s32bit j = BLOCK_SIZE - 1; j >= 0; --j) @@ -118,9 +120,9 @@ void EAX_Base::increment_counter() position = 0; } -/************************************************* -* Encrypt in EAX mode * -*************************************************/ +/* +* Encrypt in EAX mode +*/ void EAX_Encryption::write(const byte input[], u32bit length) { u32bit copied = std::min(BLOCK_SIZE - position, length); @@ -151,9 +153,9 @@ void EAX_Encryption::write(const byte input[], u32bit length) position += length; } -/************************************************* -* Finish encrypting in EAX mode * -*************************************************/ +/* +* Finish encrypting in EAX mode +*/ void EAX_Encryption::end_msg() { SecureVector<byte> data_mac = mac->final(); diff --git a/src/modes/eax/eax.h b/src/modes/eax/eax.h index 67507f776..1bb2e510d 100644 --- a/src/modes/eax/eax.h +++ b/src/modes/eax/eax.h @@ -1,7 +1,9 @@ -/************************************************* -* EAX Mode Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* EAX Mode +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_EAX_H__ #define BOTAN_EAX_H__ @@ -12,9 +14,9 @@ namespace Botan { -/************************************************* -* EAX Base Class * -*************************************************/ +/* +* EAX Base Class +*/ class BOTAN_DLL EAX_Base : public Keyed_Filter { public: @@ -38,9 +40,9 @@ class BOTAN_DLL EAX_Base : public Keyed_Filter u32bit position; }; -/************************************************* -* EAX Encryption * -*************************************************/ +/* +* EAX Encryption +*/ class BOTAN_DLL EAX_Encryption : public EAX_Base { public: @@ -59,9 +61,9 @@ class BOTAN_DLL EAX_Encryption : public EAX_Base void end_msg(); }; -/************************************************* -* EAX Decryption * -*************************************************/ +/* +* EAX Decryption +*/ class BOTAN_DLL EAX_Decryption : public EAX_Base { public: diff --git a/src/modes/eax/eax_dec.cpp b/src/modes/eax/eax_dec.cpp index 1b4a05b3c..b7e5795f7 100644 --- a/src/modes/eax/eax_dec.cpp +++ b/src/modes/eax/eax_dec.cpp @@ -1,7 +1,9 @@ -/************************************************* -* EAX Mode Encryption Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* EAX Mode Encryption +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/eax.h> #include <botan/xor_buf.h> @@ -10,9 +12,9 @@ namespace Botan { -/************************************************* -* EAX_Decryption Constructor * -*************************************************/ +/* +* EAX_Decryption Constructor +*/ EAX_Decryption::EAX_Decryption(BlockCipher* ciph, u32bit tag_size) : EAX_Base(ciph, tag_size) @@ -21,9 +23,9 @@ EAX_Decryption::EAX_Decryption(BlockCipher* ciph, queue_start = queue_end = 0; } -/************************************************* -* EAX_Decryption Constructor * -*************************************************/ +/* +* EAX_Decryption Constructor +*/ EAX_Decryption::EAX_Decryption(BlockCipher* ciph, const SymmetricKey& key, const InitializationVector& iv, @@ -36,9 +38,9 @@ EAX_Decryption::EAX_Decryption(BlockCipher* ciph, queue_start = queue_end = 0; } -/************************************************* -* Decrypt in EAX mode * -*************************************************/ +/* +* Decrypt in EAX mode +*/ void EAX_Decryption::write(const byte input[], u32bit length) { while(length) @@ -70,9 +72,9 @@ void EAX_Decryption::write(const byte input[], u32bit length) } } -/************************************************* -* Decrypt in EAX mode * -*************************************************/ +/* +* Decrypt in EAX mode +*/ void EAX_Decryption::do_write(const byte input[], u32bit length) { mac->update(input, length); @@ -102,9 +104,9 @@ void EAX_Decryption::do_write(const byte input[], u32bit length) position += length; } -/************************************************* -* Finish decrypting in EAX mode * -*************************************************/ +/* +* Finish decrypting in EAX mode +*/ void EAX_Decryption::end_msg() { if((queue_end - queue_start) != TAG_SIZE) diff --git a/src/modes/ecb/ecb.cpp b/src/modes/ecb/ecb.cpp index b76e86ad9..8da0a4802 100644 --- a/src/modes/ecb/ecb.cpp +++ b/src/modes/ecb/ecb.cpp @@ -1,15 +1,17 @@ -/************************************************* -* ECB Mode Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* ECB Mode +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/ecb.h> namespace Botan { -/************************************************* -* Verify the IV is not set * -*************************************************/ +/* +* Verify the IV is not set +*/ bool ECB::valid_iv_size(u32bit iv_size) const { if(iv_size == 0) @@ -17,17 +19,17 @@ bool ECB::valid_iv_size(u32bit iv_size) const return false; } -/************************************************* -* Return an ECB mode name * -*************************************************/ +/* +* Return an ECB mode name +*/ std::string ECB::name() const { return (cipher->name() + "/" + mode_name + "/" + padder->name()); } -/************************************************* -* Encrypt in ECB mode * -*************************************************/ +/* +* Encrypt in ECB mode +*/ void ECB_Encryption::write(const byte input[], u32bit length) { buffer.copy(position, input, length); @@ -50,9 +52,9 @@ void ECB_Encryption::write(const byte input[], u32bit length) position += length; } -/************************************************* -* Finish encrypting in ECB mode * -*************************************************/ +/* +* Finish encrypting in ECB mode +*/ void ECB_Encryption::end_msg() { SecureVector<byte> padding(BLOCK_SIZE); @@ -62,9 +64,9 @@ void ECB_Encryption::end_msg() throw Encoding_Error(name() + ": Did not pad to full blocksize"); } -/************************************************* -* Decrypt in ECB mode * -*************************************************/ +/* +* Decrypt in ECB mode +*/ void ECB_Decryption::write(const byte input[], u32bit length) { buffer.copy(position, input, length); @@ -87,9 +89,9 @@ void ECB_Decryption::write(const byte input[], u32bit length) position += length; } -/************************************************* -* Finish decrypting in ECB mode * -*************************************************/ +/* +* Finish decrypting in ECB mode +*/ void ECB_Decryption::end_msg() { if(position != BLOCK_SIZE) diff --git a/src/modes/ecb/ecb.h b/src/modes/ecb/ecb.h index 81fee28d2..5230f9b14 100644 --- a/src/modes/ecb/ecb.h +++ b/src/modes/ecb/ecb.h @@ -1,7 +1,9 @@ -/************************************************* -* ECB Mode Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* ECB Mode +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_ECB_H__ #define BOTAN_ECB_H__ @@ -12,9 +14,9 @@ namespace Botan { -/************************************************* -* ECB * -*************************************************/ +/* +* ECB +*/ class BOTAN_DLL ECB : public BlockCipherMode { protected: @@ -28,9 +30,9 @@ class BOTAN_DLL ECB : public BlockCipherMode bool valid_iv_size(u32bit) const; }; -/************************************************* -* ECB Encryption * -*************************************************/ +/* +* ECB Encryption +*/ class BOTAN_DLL ECB_Encryption : public ECB { public: @@ -47,9 +49,9 @@ class BOTAN_DLL ECB_Encryption : public ECB void end_msg(); }; -/************************************************* -* ECB Decryption * -*************************************************/ +/* +* ECB Decryption +*/ class BOTAN_DLL ECB_Decryption : public ECB { public: diff --git a/src/modes/mode_pad/mode_pad.cpp b/src/modes/mode_pad/mode_pad.cpp index 3944837cc..b8badd7a7 100644 --- a/src/modes/mode_pad/mode_pad.cpp +++ b/src/modes/mode_pad/mode_pad.cpp @@ -1,7 +1,9 @@ -/************************************************* -* CBC Padding Methods Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* CBC Padding Methods +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/mode_pad.h> #include <botan/exceptn.h> @@ -9,26 +11,26 @@ namespace Botan { -/************************************************* -* Default amount of padding * -*************************************************/ +/* +* Default amount of padding +*/ u32bit BlockCipherModePaddingMethod::pad_bytes(u32bit bs, u32bit pos) const { return (bs - pos); } -/************************************************* -* Pad with PKCS #7 Method * -*************************************************/ +/* +* Pad with PKCS #7 Method +*/ void PKCS7_Padding::pad(byte block[], u32bit size, u32bit position) const { for(u32bit j = 0; j != size; ++j) block[j] = (size-position); } -/************************************************* -* Unpad with PKCS #7 Method * -*************************************************/ +/* +* Unpad with PKCS #7 Method +*/ u32bit PKCS7_Padding::unpad(const byte block[], u32bit size) const { u32bit position = block[size-1]; @@ -40,9 +42,9 @@ u32bit PKCS7_Padding::unpad(const byte block[], u32bit size) const return (size-position); } -/************************************************* -* Query if the size is valid for this method * -*************************************************/ +/* +* Query if the size is valid for this method +*/ bool PKCS7_Padding::valid_blocksize(u32bit size) const { if(size > 0 && size < 256) @@ -51,9 +53,9 @@ bool PKCS7_Padding::valid_blocksize(u32bit size) const return false; } -/************************************************* -* Pad with ANSI X9.23 Method * -*************************************************/ +/* +* Pad with ANSI X9.23 Method +*/ void ANSI_X923_Padding::pad(byte block[], u32bit size, u32bit position) const { for(u32bit j = 0; j != size-position; ++j) @@ -61,9 +63,9 @@ void ANSI_X923_Padding::pad(byte block[], u32bit size, u32bit position) const block[size-position-1] = (size-position); } -/************************************************* -* Unpad with ANSI X9.23 Method * -*************************************************/ +/* +* Unpad with ANSI X9.23 Method +*/ u32bit ANSI_X923_Padding::unpad(const byte block[], u32bit size) const { u32bit position = block[size-1]; @@ -75,9 +77,9 @@ u32bit ANSI_X923_Padding::unpad(const byte block[], u32bit size) const return (size-position); } -/************************************************* -* Query if the size is valid for this method * -*************************************************/ +/* +* Query if the size is valid for this method +*/ bool ANSI_X923_Padding::valid_blocksize(u32bit size) const { if(size > 0 && size < 256) @@ -86,9 +88,9 @@ bool ANSI_X923_Padding::valid_blocksize(u32bit size) const return false; } -/************************************************* -* Pad with One and Zeros Method * -*************************************************/ +/* +* Pad with One and Zeros Method +*/ void OneAndZeros_Padding::pad(byte block[], u32bit size, u32bit) const { block[0] = 0x80; @@ -96,9 +98,9 @@ void OneAndZeros_Padding::pad(byte block[], u32bit size, u32bit) const block[j] = 0x00; } -/************************************************* -* Unpad with One and Zeros Method * -*************************************************/ +/* +* Unpad with One and Zeros Method +*/ u32bit OneAndZeros_Padding::unpad(const byte block[], u32bit size) const { while(size) @@ -114,9 +116,9 @@ u32bit OneAndZeros_Padding::unpad(const byte block[], u32bit size) const return (size-1); } -/************************************************* -* Query if the size is valid for this method * -*************************************************/ +/* +* Query if the size is valid for this method +*/ bool OneAndZeros_Padding::valid_blocksize(u32bit size) const { if(size) return true; diff --git a/src/modes/mode_pad/mode_pad.h b/src/modes/mode_pad/mode_pad.h index 5c31a4f1e..a486d3c1f 100644 --- a/src/modes/mode_pad/mode_pad.h +++ b/src/modes/mode_pad/mode_pad.h @@ -1,6 +1,8 @@ /** -* CBC Padding Methods Header File +* CBC Padding Methods * (C) 1999-2008 Jack Lloyd +* +* Distributed under the terms of the Botan license */ #ifndef BOTAN_CBC_PADDING_H__ diff --git a/src/modes/modebase.cpp b/src/modes/modebase.cpp index bf3de2572..8293acc54 100644 --- a/src/modes/modebase.cpp +++ b/src/modes/modebase.cpp @@ -1,15 +1,17 @@ -/************************************************* -* Block Cipher Mode Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* Block Cipher Mode +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/modebase.h> namespace Botan { -/************************************************* -* Block Cipher Mode Constructor * -*************************************************/ +/* +* Block Cipher Mode Constructor +*/ BlockCipherMode::BlockCipherMode(BlockCipher* cipher_ptr, const std::string& cipher_mode_name, u32bit iv_size, u32bit iv_meth, @@ -23,17 +25,17 @@ BlockCipherMode::BlockCipherMode(BlockCipher* cipher_ptr, position = 0; } -/************************************************* -* Return the name of this type * -*************************************************/ +/* +* Return the name of this type +*/ std::string BlockCipherMode::name() const { return (cipher->name() + "/" + mode_name); } -/************************************************* -* Set the IV * -*************************************************/ +/* +* Set the IV +*/ void BlockCipherMode::set_iv(const InitializationVector& new_iv) { if(new_iv.length() != state.size()) diff --git a/src/modes/modebase.h b/src/modes/modebase.h index 9793c23d2..173fde58c 100644 --- a/src/modes/modebase.h +++ b/src/modes/modebase.h @@ -1,7 +1,9 @@ -/************************************************* -* Block Cipher Mode Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* Block Cipher Mode +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_MODEBASE_H__ #define BOTAN_MODEBASE_H__ diff --git a/src/modes/ofb/ofb.cpp b/src/modes/ofb/ofb.cpp index 6f88a9bfd..cb40fdeaa 100644 --- a/src/modes/ofb/ofb.cpp +++ b/src/modes/ofb/ofb.cpp @@ -1,7 +1,9 @@ -/************************************************* -* OFB Mode Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* OFB Mode +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/ofb.h> #include <botan/xor_buf.h> @@ -9,17 +11,17 @@ namespace Botan { -/************************************************* -* OFB Constructor * -*************************************************/ +/* +* OFB Constructor +*/ OFB::OFB(BlockCipher* ciph) : BlockCipherMode(ciph, "OFB", ciph->BLOCK_SIZE, 2) { } -/************************************************* -* OFB Constructor * -*************************************************/ +/* +* OFB Constructor +*/ OFB::OFB(BlockCipher* ciph, const SymmetricKey& key, const InitializationVector& iv) : BlockCipherMode(ciph, "OFB", ciph->BLOCK_SIZE, 2) @@ -28,9 +30,9 @@ OFB::OFB(BlockCipher* ciph, const SymmetricKey& key, set_iv(iv); } -/************************************************* -* OFB Encryption/Decryption * -*************************************************/ +/* +* OFB Encryption/Decryption +*/ void OFB::write(const byte input[], u32bit length) { u32bit copied = std::min(BLOCK_SIZE - position, length); diff --git a/src/modes/ofb/ofb.h b/src/modes/ofb/ofb.h index 53ec695bf..a3aadc137 100644 --- a/src/modes/ofb/ofb.h +++ b/src/modes/ofb/ofb.h @@ -1,7 +1,9 @@ -/************************************************* -* OFB Mode Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* OFB Mode +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_OUTPUT_FEEDBACK_MODE_H__ #define BOTAN_OUTPUT_FEEDBACK_MODE_H__ @@ -11,9 +13,9 @@ namespace Botan { -/************************************************* -* OFB Mode * -*************************************************/ +/* +* OFB Mode +*/ class BOTAN_DLL OFB : public BlockCipherMode { public: diff --git a/src/mutex/noop_mutex/mux_noop.cpp b/src/mutex/noop_mutex/mux_noop.cpp index eb3a12702..5c45084fe 100644 --- a/src/mutex/noop_mutex/mux_noop.cpp +++ b/src/mutex/noop_mutex/mux_noop.cpp @@ -1,15 +1,17 @@ -/************************************************* -* No-Op Mutex Factory Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* No-Op Mutex Factory +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/mux_noop.h> namespace Botan { -/************************************************* -* No-Op Mutex Factory * -*************************************************/ +/* +* No-Op Mutex Factory +*/ Mutex* Noop_Mutex_Factory::make() { class Noop_Mutex : public Mutex diff --git a/src/mutex/noop_mutex/mux_noop.h b/src/mutex/noop_mutex/mux_noop.h index a5b802cc0..94201cb7c 100644 --- a/src/mutex/noop_mutex/mux_noop.h +++ b/src/mutex/noop_mutex/mux_noop.h @@ -1,7 +1,9 @@ -/************************************************* -* No-Op Mutex Factory Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* No-Op Mutex Factory +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_NOOP_MUTEX_FACTORY_H__ #define BOTAN_NOOP_MUTEX_FACTORY_H__ @@ -10,9 +12,9 @@ namespace Botan { -/************************************************* -* No-Op Mutex Factory * -*************************************************/ +/* +* No-Op Mutex Factory +*/ class BOTAN_DLL Noop_Mutex_Factory : public Mutex_Factory { public: diff --git a/src/mutex/pthreads/mux_pthr.cpp b/src/mutex/pthreads/mux_pthr.cpp index d003fa298..9f1d9816e 100644 --- a/src/mutex/pthreads/mux_pthr.cpp +++ b/src/mutex/pthreads/mux_pthr.cpp @@ -1,7 +1,9 @@ -/************************************************* -* Pthread Mutex Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* Pthread Mutex +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/mux_pthr.h> #include <botan/exceptn.h> @@ -14,9 +16,9 @@ namespace Botan { -/************************************************* -* Pthread Mutex Factory * -*************************************************/ +/* +* Pthread Mutex Factory +*/ Mutex* Pthread_Mutex_Factory::make() { diff --git a/src/mutex/pthreads/mux_pthr.h b/src/mutex/pthreads/mux_pthr.h index 79eed0c97..118853947 100644 --- a/src/mutex/pthreads/mux_pthr.h +++ b/src/mutex/pthreads/mux_pthr.h @@ -1,7 +1,9 @@ -/************************************************* -* Pthread Mutex Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* Pthread Mutex +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_MUTEX_PTHREAD_H__ #define BOTAN_MUTEX_PTHREAD_H__ @@ -10,9 +12,9 @@ namespace Botan { -/************************************************* -* Pthread Mutex Factory * -*************************************************/ +/* +* Pthread Mutex Factory +*/ class BOTAN_DLL Pthread_Mutex_Factory : public Mutex_Factory { public: diff --git a/src/mutex/qt_mutex/mux_qt.cpp b/src/mutex/qt_mutex/mux_qt.cpp index 421b771c7..0f670c8b4 100644 --- a/src/mutex/qt_mutex/mux_qt.cpp +++ b/src/mutex/qt_mutex/mux_qt.cpp @@ -1,8 +1,10 @@ -/************************************************* -* Qt Thread Mutex Source File * -* (C) 2004-2007 Justin Karneges * -* 2004-2007 Jack Lloyd * -*************************************************/ +/* +* Qt Thread Mutex +* (C) 2004-2007 Justin Karneges +* 2004-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/mux_qt.h> #include <qmutex.h> @@ -13,9 +15,9 @@ namespace Botan { -/************************************************* -* Qt Mutex Factory * -*************************************************/ +/* +* Qt Mutex Factory +*/ Mutex* Qt_Mutex_Factory::make() { class Qt_Mutex : public Mutex diff --git a/src/mutex/qt_mutex/mux_qt.h b/src/mutex/qt_mutex/mux_qt.h index bf230e1ff..5aed77f4b 100644 --- a/src/mutex/qt_mutex/mux_qt.h +++ b/src/mutex/qt_mutex/mux_qt.h @@ -1,8 +1,10 @@ -/************************************************* -* Qt Mutex Header File * -* (C) 2004-2007 Justin Karneges * -* 2004-2007 Jack Lloyd * -*************************************************/ +/* +* Qt Mutex +* (C) 2004-2007 Justin Karneges +* 2004-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_MUTEX_QT_H__ #define BOTAN_MUTEX_QT_H__ @@ -11,9 +13,9 @@ namespace Botan { -/************************************************* -* Qt Mutex * -*************************************************/ +/* +* Qt Mutex +*/ class BOTAN_DLL Qt_Mutex_Factory : public Mutex_Factory { public: diff --git a/src/mutex/win32_crit_section/mux_win32.cpp b/src/mutex/win32_crit_section/mux_win32.cpp index 622a707fa..2a967892b 100644 --- a/src/mutex/win32_crit_section/mux_win32.cpp +++ b/src/mutex/win32_crit_section/mux_win32.cpp @@ -1,17 +1,19 @@ -/************************************************* -* Win32 Mutex Source File * -* (C) 2006 Luca Piccarreta * -* 2006-2007 Jack Lloyd * -*************************************************/ +/* +* Win32 Mutex +* (C) 2006 Luca Piccarreta +* 2006-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/mux_win32.h> #include <windows.h> namespace Botan { -/************************************************* -* Win32 Mutex Factory * -*************************************************/ +/* +* Win32 Mutex Factory +*/ Mutex* Win32_Mutex_Factory::make() { class Win32_Mutex : public Mutex diff --git a/src/mutex/win32_crit_section/mux_win32.h b/src/mutex/win32_crit_section/mux_win32.h index 9073b0d3c..a91850e71 100644 --- a/src/mutex/win32_crit_section/mux_win32.h +++ b/src/mutex/win32_crit_section/mux_win32.h @@ -1,8 +1,10 @@ -/************************************************* -* Win32 Mutex Header File * -* (C) 2006 Luca Piccarreta * -* 2006-2007 Jack Lloyd * -*************************************************/ +/* +* Win32 Mutex +* (C) 2006 Luca Piccarreta +* 2006-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_MUTEX_WIN32_H__ #define BOTAN_MUTEX_WIN32_H__ @@ -11,9 +13,9 @@ namespace Botan { -/************************************************* -* Win32 Mutex Factory * -*************************************************/ +/* +* Win32 Mutex Factory +*/ class BOTAN_DLL Win32_Mutex_Factory : public Mutex_Factory { public: diff --git a/src/pbe/get_pbe.cpp b/src/pbe/get_pbe.cpp index 961da4afc..3217101ef 100644 --- a/src/pbe/get_pbe.cpp +++ b/src/pbe/get_pbe.cpp @@ -1,7 +1,9 @@ -/************************************************* -* PBE Retrieval Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* PBE Retrieval +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/get_pbe.h> #include <botan/oids.h> @@ -19,9 +21,9 @@ namespace Botan { -/************************************************* -* Get an encryption PBE, set new parameters * -*************************************************/ +/* +* Get an encryption PBE, set new parameters +*/ PBE* get_pbe(const std::string& algo_spec) { SCAN_Name request(algo_spec); @@ -69,9 +71,9 @@ PBE* get_pbe(const std::string& algo_spec) throw Algorithm_Not_Found(algo_spec); } -/************************************************* -* Get a decryption PBE, decode parameters * -*************************************************/ +/* +* Get a decryption PBE, decode parameters +*/ PBE* get_pbe(const OID& pbe_oid, DataSource& params) { SCAN_Name request(OIDS::lookup(pbe_oid)); diff --git a/src/pbe/get_pbe.h b/src/pbe/get_pbe.h index b73a79c80..04eda6696 100644 --- a/src/pbe/get_pbe.h +++ b/src/pbe/get_pbe.h @@ -1,7 +1,9 @@ -/************************************************* -* PBE Lookup Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* PBE Lookup +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_LOOKUP_PBE_H__ #define BOTAN_LOOKUP_PBE_H__ diff --git a/src/pbe/pbes1/pbes1.cpp b/src/pbe/pbes1/pbes1.cpp index c663865cf..21bd330ff 100644 --- a/src/pbe/pbes1/pbes1.cpp +++ b/src/pbe/pbes1/pbes1.cpp @@ -1,7 +1,9 @@ -/************************************************* -* PKCS #5 PBES1 Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* PKCS #5 PBES1 +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/pbes1.h> #include <botan/pbkdf1.h> @@ -12,9 +14,9 @@ namespace Botan { -/************************************************* -* Encrypt some bytes using PBES1 * -*************************************************/ +/* +* Encrypt some bytes using PBES1 +*/ void PBE_PKCS5v15::write(const byte input[], u32bit length) { while(length) @@ -26,9 +28,9 @@ void PBE_PKCS5v15::write(const byte input[], u32bit length) } } -/************************************************* -* Start encrypting with PBES1 * -*************************************************/ +/* +* Start encrypting with PBES1 +*/ void PBE_PKCS5v15::start_msg() { if(direction == ENCRYPTION) @@ -45,9 +47,9 @@ void PBE_PKCS5v15::start_msg() pipe.set_default_msg(pipe.default_msg() + 1); } -/************************************************* -* Finish encrypting with PBES1 * -*************************************************/ +/* +* Finish encrypting with PBES1 +*/ void PBE_PKCS5v15::end_msg() { pipe.end_msg(); @@ -55,9 +57,9 @@ void PBE_PKCS5v15::end_msg() pipe.reset(); } -/************************************************* -* Flush the pipe * -*************************************************/ +/* +* Flush the pipe +*/ void PBE_PKCS5v15::flush_pipe(bool safe_to_skip) { if(safe_to_skip && pipe.remaining() < 64) @@ -71,9 +73,9 @@ void PBE_PKCS5v15::flush_pipe(bool safe_to_skip) } } -/************************************************* -* Set the passphrase to use * -*************************************************/ +/* +* Set the passphrase to use +*/ void PBE_PKCS5v15::set_key(const std::string& passphrase) { PKCS5_PBKDF1 pbkdf(hash_function->clone()); @@ -86,9 +88,9 @@ void PBE_PKCS5v15::set_key(const std::string& passphrase) iv.set(key_and_iv.begin() + 8, 8); } -/************************************************* -* Create a new set of PBES1 parameters * -*************************************************/ +/* +* Create a new set of PBES1 parameters +*/ void PBE_PKCS5v15::new_params(RandomNumberGenerator& rng) { iterations = 2048; @@ -96,9 +98,9 @@ void PBE_PKCS5v15::new_params(RandomNumberGenerator& rng) rng.randomize(salt, salt.size()); } -/************************************************* -* Encode PKCS#5 PBES1 parameters * -*************************************************/ +/* +* Encode PKCS#5 PBES1 parameters +*/ MemoryVector<byte> PBE_PKCS5v15::encode_params() const { return DER_Encoder() @@ -109,9 +111,9 @@ MemoryVector<byte> PBE_PKCS5v15::encode_params() const .get_contents(); } -/************************************************* -* Decode PKCS#5 PBES1 parameters * -*************************************************/ +/* +* Decode PKCS#5 PBES1 parameters +*/ void PBE_PKCS5v15::decode_params(DataSource& source) { BER_Decoder(source) @@ -125,9 +127,9 @@ void PBE_PKCS5v15::decode_params(DataSource& source) throw Decoding_Error("PBES1: Encoded salt is not 8 octets"); } -/************************************************* -* Return an OID for this PBES1 type * -*************************************************/ +/* +* Return an OID for this PBES1 type +*/ OID PBE_PKCS5v15::get_oid() const { const OID base_pbes1_oid("1.2.840.113549.1.5"); @@ -151,9 +153,9 @@ OID PBE_PKCS5v15::get_oid() const throw Internal_Error("PBE-PKCS5 v1.5: get_oid() has run out of options"); } -/************************************************* -* PKCS#5 v1.5 PBE Constructor * -*************************************************/ +/* +* PKCS#5 v1.5 PBE Constructor +*/ PBE_PKCS5v15::PBE_PKCS5v15(BlockCipher* cipher, HashFunction* hash, Cipher_Dir dir) : diff --git a/src/pbe/pbes1/pbes1.h b/src/pbe/pbes1/pbes1.h index 2c96a8d1e..2e1855dc2 100644 --- a/src/pbe/pbes1/pbes1.h +++ b/src/pbe/pbes1/pbes1.h @@ -1,7 +1,9 @@ -/************************************************* -* PKCS #5 v1.5 PBE Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* PKCS #5 v1.5 PBE +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_PBE_PKCS_V15_H__ #define BOTAN_PBE_PKCS_V15_H__ @@ -13,9 +15,9 @@ namespace Botan { -/************************************************* -* PKCS#5 v1.5 PBE * -*************************************************/ +/* +* PKCS#5 v1.5 PBE +*/ class BOTAN_DLL PBE_PKCS5v15 : public PBE { public: diff --git a/src/pbe/pbes2/pbes2.cpp b/src/pbe/pbes2/pbes2.cpp index e4d11eda5..b7e2589d0 100644 --- a/src/pbe/pbes2/pbes2.cpp +++ b/src/pbe/pbes2/pbes2.cpp @@ -1,6 +1,8 @@ /** -* PKCS #5 PBES2 Source File +* PKCS #5 PBES2 * (C) 1999-2008 Jack Lloyd +* +* Distributed under the terms of the Botan license */ #include <botan/pbes2.h> diff --git a/src/pbe/pbes2/pbes2.h b/src/pbe/pbes2/pbes2.h index a07fcca68..fc460a228 100644 --- a/src/pbe/pbes2/pbes2.h +++ b/src/pbe/pbes2/pbes2.h @@ -1,7 +1,9 @@ -/************************************************* -* PKCS #5 v2.0 PBE Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* PKCS #5 v2.0 PBE +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_PBE_PKCS_v20_H__ #define BOTAN_PBE_PKCS_v20_H__ @@ -13,9 +15,9 @@ namespace Botan { -/************************************************* -* PKCS#5 v2.0 PBE * -*************************************************/ +/* +* PKCS#5 v2.0 PBE +*/ class BOTAN_DLL PBE_PKCS5v20 : public PBE { public: diff --git a/src/pk_pad/eme.cpp b/src/pk_pad/eme.cpp index ca618889b..74bba5ac1 100644 --- a/src/pk_pad/eme.cpp +++ b/src/pk_pad/eme.cpp @@ -1,15 +1,17 @@ -/************************************************* -* EME Base Class Source File * -* (C) 1999-2008 Jack Lloyd * -*************************************************/ +/* +* EME Base Class +* (C) 1999-2008 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/eme.h> namespace Botan { -/************************************************* -* Encode a message * -*************************************************/ +/* +* Encode a message +*/ SecureVector<byte> EME::encode(const byte msg[], u32bit msg_len, u32bit key_bits, RandomNumberGenerator& rng) const @@ -17,9 +19,9 @@ SecureVector<byte> EME::encode(const byte msg[], u32bit msg_len, return pad(msg, msg_len, key_bits, rng); } -/************************************************* -* Encode a message * -*************************************************/ +/* +* Encode a message +*/ SecureVector<byte> EME::encode(const MemoryRegion<byte>& msg, u32bit key_bits, RandomNumberGenerator& rng) const @@ -27,18 +29,18 @@ SecureVector<byte> EME::encode(const MemoryRegion<byte>& msg, return pad(msg, msg.size(), key_bits, rng); } -/************************************************* -* Decode a message * -*************************************************/ +/* +* Decode a message +*/ SecureVector<byte> EME::decode(const byte msg[], u32bit msg_len, u32bit key_bits) const { return unpad(msg, msg_len, key_bits); } -/************************************************* -* Decode a message * -*************************************************/ +/* +* Decode a message +*/ SecureVector<byte> EME::decode(const MemoryRegion<byte>& msg, u32bit key_bits) const { diff --git a/src/pk_pad/eme.h b/src/pk_pad/eme.h index fd759bd10..321c1d01e 100644 --- a/src/pk_pad/eme.h +++ b/src/pk_pad/eme.h @@ -1,7 +1,9 @@ -/************************************************* -* EME Classes Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* EME Classes +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_PUBKEY_EME_ENCRYPTION_PAD_H__ #define BOTAN_PUBKEY_EME_ENCRYPTION_PAD_H__ @@ -11,9 +13,9 @@ namespace Botan { -/************************************************* -* Encoding Method for Encryption * -*************************************************/ +/* +* Encoding Method for Encryption +*/ class BOTAN_DLL EME { public: diff --git a/src/pk_pad/eme1/eme1.cpp b/src/pk_pad/eme1/eme1.cpp index e5db17df6..13f68f8e4 100644 --- a/src/pk_pad/eme1/eme1.cpp +++ b/src/pk_pad/eme1/eme1.cpp @@ -1,7 +1,9 @@ -/************************************************* -* EME1 Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* EME1 +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/eme1.h> #include <botan/mgf1.h> @@ -9,9 +11,9 @@ namespace Botan { -/************************************************* -* EME1 Pad Operation * -*************************************************/ +/* +* EME1 Pad Operation +*/ SecureVector<byte> EME1::pad(const byte in[], u32bit in_length, u32bit key_length, RandomNumberGenerator& rng) const @@ -36,9 +38,9 @@ SecureVector<byte> EME1::pad(const byte in[], u32bit in_length, return out; } -/************************************************* -* EME1 Unpad Operation * -*************************************************/ +/* +* EME1 Unpad Operation +*/ SecureVector<byte> EME1::unpad(const byte in[], u32bit in_length, u32bit key_length) const { @@ -77,9 +79,9 @@ SecureVector<byte> EME1::unpad(const byte in[], u32bit in_length, throw Decoding_Error("Invalid EME1 encoding"); } -/************************************************* -* Return the max input size for a given key size * -*************************************************/ +/* +* Return the max input size for a given key size +*/ u32bit EME1::maximum_input_size(u32bit keybits) const { if(keybits / 8 > 2*HASH_LENGTH + 1) @@ -88,9 +90,9 @@ u32bit EME1::maximum_input_size(u32bit keybits) const return 0; } -/************************************************* -* EME1 Constructor * -*************************************************/ +/* +* EME1 Constructor +*/ EME1::EME1(HashFunction* hash, const std::string& P) : HASH_LENGTH(hash->OUTPUT_LENGTH) { diff --git a/src/pk_pad/eme1/eme1.h b/src/pk_pad/eme1/eme1.h index a0676b7df..4df5c5f1c 100644 --- a/src/pk_pad/eme1/eme1.h +++ b/src/pk_pad/eme1/eme1.h @@ -1,7 +1,9 @@ -/************************************************* -* EME1 Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* EME1 +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_EME1_H__ #define BOTAN_EME1_H__ @@ -12,9 +14,9 @@ namespace Botan { -/************************************************* -* EME1 * -*************************************************/ +/* +* EME1 +*/ class BOTAN_DLL EME1 : public EME { public: diff --git a/src/pk_pad/eme_pkcs/eme_pkcs.cpp b/src/pk_pad/eme_pkcs/eme_pkcs.cpp index 494f238b4..c2f9c91d2 100644 --- a/src/pk_pad/eme_pkcs/eme_pkcs.cpp +++ b/src/pk_pad/eme_pkcs/eme_pkcs.cpp @@ -1,15 +1,17 @@ -/************************************************* -* PKCS1 EME Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* PKCS1 EME +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/eme_pkcs.h> namespace Botan { -/************************************************* -* PKCS1 Pad Operation * -*************************************************/ +/* +* PKCS1 Pad Operation +*/ SecureVector<byte> EME_PKCS1v15::pad(const byte in[], u32bit inlen, u32bit olen, RandomNumberGenerator& rng) const @@ -32,9 +34,9 @@ SecureVector<byte> EME_PKCS1v15::pad(const byte in[], u32bit inlen, return out; } -/************************************************* -* PKCS1 Unpad Operation * -*************************************************/ +/* +* PKCS1 Unpad Operation +*/ SecureVector<byte> EME_PKCS1v15::unpad(const byte in[], u32bit inlen, u32bit key_len) const { @@ -54,9 +56,9 @@ SecureVector<byte> EME_PKCS1v15::unpad(const byte in[], u32bit inlen, return SecureVector<byte>(in + seperator + 1, inlen - seperator - 1); } -/************************************************* -* Return the max input size for a given key size * -*************************************************/ +/* +* Return the max input size for a given key size +*/ u32bit EME_PKCS1v15::maximum_input_size(u32bit keybits) const { if(keybits / 8 > 10) diff --git a/src/pk_pad/eme_pkcs/eme_pkcs.h b/src/pk_pad/eme_pkcs/eme_pkcs.h index 76817826d..1aeedf5d7 100644 --- a/src/pk_pad/eme_pkcs/eme_pkcs.h +++ b/src/pk_pad/eme_pkcs/eme_pkcs.h @@ -1,7 +1,9 @@ -/************************************************* -* EME PKCS#1 v1.5 Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* EME PKCS#1 v1.5 +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_EME_PKCS1_H__ #define BOTAN_EME_PKCS1_H__ @@ -10,9 +12,9 @@ namespace Botan { -/************************************************* -* EME_PKCS1v15 * -*************************************************/ +/* +* EME_PKCS1v15 +*/ class BOTAN_DLL EME_PKCS1v15 : public EME { public: diff --git a/src/pk_pad/emsa.h b/src/pk_pad/emsa.h index 2f2b160bd..e2491e40f 100644 --- a/src/pk_pad/emsa.h +++ b/src/pk_pad/emsa.h @@ -1,7 +1,9 @@ -/************************************************* -* EMSA Classes Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* EMSA Classes +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_PUBKEY_EMSA_H__ #define BOTAN_PUBKEY_EMSA_H__ @@ -11,9 +13,9 @@ namespace Botan { -/************************************************* -* Encoding Method for Signatures, Appendix * -*************************************************/ +/* +* Encoding Method for Signatures, Appendix +*/ class BOTAN_DLL EMSA { public: diff --git a/src/pk_pad/emsa1/emsa1.cpp b/src/pk_pad/emsa1/emsa1.cpp index 12e9cca01..26d709c28 100644 --- a/src/pk_pad/emsa1/emsa1.cpp +++ b/src/pk_pad/emsa1/emsa1.cpp @@ -1,7 +1,9 @@ -/************************************************* -* EMSA1 Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* EMSA1 +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/emsa1.h> @@ -38,25 +40,25 @@ SecureVector<byte> emsa1_encoding(const MemoryRegion<byte>& msg, } -/************************************************* -* EMSA1 Update Operation * -*************************************************/ +/* +* EMSA1 Update Operation +*/ void EMSA1::update(const byte input[], u32bit length) { hash->update(input, length); } -/************************************************* -* Return the raw (unencoded) data * -*************************************************/ +/* +* Return the raw (unencoded) data +*/ SecureVector<byte> EMSA1::raw_data() { return hash->final(); } -/************************************************* -* EMSA1 Encode Operation * -*************************************************/ +/* +* EMSA1 Encode Operation +*/ SecureVector<byte> EMSA1::encoding_of(const MemoryRegion<byte>& msg, u32bit output_bits, RandomNumberGenerator&) @@ -66,9 +68,9 @@ SecureVector<byte> EMSA1::encoding_of(const MemoryRegion<byte>& msg, return emsa1_encoding(msg, output_bits); } -/************************************************* -* EMSA1 Decode/Verify Operation * -*************************************************/ +/* +* EMSA1 Decode/Verify Operation +*/ bool EMSA1::verify(const MemoryRegion<byte>& coded, const MemoryRegion<byte>& raw, u32bit key_bits) throw() { diff --git a/src/pk_pad/emsa1/emsa1.h b/src/pk_pad/emsa1/emsa1.h index 64255e748..a5dac07e2 100644 --- a/src/pk_pad/emsa1/emsa1.h +++ b/src/pk_pad/emsa1/emsa1.h @@ -1,7 +1,9 @@ -/************************************************* -* EMSA1 Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* EMSA1 +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_EMSA1_H__ #define BOTAN_EMSA1_H__ @@ -11,9 +13,9 @@ namespace Botan { -/************************************************* -* EMSA1 * -*************************************************/ +/* +* EMSA1 +*/ class BOTAN_DLL EMSA1 : public EMSA { public: diff --git a/src/pk_pad/emsa1_bsi/emsa1_bsi.cpp b/src/pk_pad/emsa1_bsi/emsa1_bsi.cpp index cc7868a1d..212091e22 100644 --- a/src/pk_pad/emsa1_bsi/emsa1_bsi.cpp +++ b/src/pk_pad/emsa1_bsi/emsa1_bsi.cpp @@ -1,16 +1,18 @@ -/************************************************* -* EMSA1 BSI Source File * -* (C) 1999-2008 Jack Lloyd * -* 2008 Falko Strenzke, FlexSecure GmbH * -*************************************************/ +/* +* EMSA1 BSI +* (C) 1999-2008 Jack Lloyd +* 2008 Falko Strenzke, FlexSecure GmbH +* +* Distributed under the terms of the Botan license +*/ #include <botan/emsa1_bsi.h> namespace Botan { -/************************************************* -* EMSA1 BSI Encode Operation * -*************************************************/ +/* +* EMSA1 BSI Encode Operation +*/ SecureVector<byte> EMSA1_BSI::encoding_of(const MemoryRegion<byte>& msg, u32bit output_bits, RandomNumberGenerator&) diff --git a/src/pk_pad/emsa1_bsi/emsa1_bsi.h b/src/pk_pad/emsa1_bsi/emsa1_bsi.h index 0c0745bb0..ec86d40e2 100644 --- a/src/pk_pad/emsa1_bsi/emsa1_bsi.h +++ b/src/pk_pad/emsa1_bsi/emsa1_bsi.h @@ -1,8 +1,10 @@ -/************************************************* -* EMSA1 BSI Variant Header File * -* (C) 1999-2008 Jack Lloyd * -* 2007 FlexSecure GmbH * -*************************************************/ +/* +* EMSA1 BSI Variant +* (C) 1999-2008 Jack Lloyd +* 2007 FlexSecure GmbH +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_EMSA1_BSI_H__ #define BOTAN_EMSA1_BSI_H__ diff --git a/src/pk_pad/emsa2/emsa2.cpp b/src/pk_pad/emsa2/emsa2.cpp index 5ecbf005c..168f9209e 100644 --- a/src/pk_pad/emsa2/emsa2.cpp +++ b/src/pk_pad/emsa2/emsa2.cpp @@ -1,7 +1,9 @@ -/************************************************* -* EMSA2 Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* EMSA2 +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/emsa2.h> #include <botan/hash_id.h> @@ -10,9 +12,9 @@ namespace Botan { namespace { -/************************************************* -* EMSA2 Encode Operation * -*************************************************/ +/* +* EMSA2 Encode Operation +*/ SecureVector<byte> emsa2_encoding(const MemoryRegion<byte>& msg, u32bit output_bits, const MemoryRegion<byte>& empty_hash, @@ -46,25 +48,25 @@ SecureVector<byte> emsa2_encoding(const MemoryRegion<byte>& msg, } -/************************************************* -* EMSA2 Update Operation * -*************************************************/ +/* +* EMSA2 Update Operation +*/ void EMSA2::update(const byte input[], u32bit length) { hash->update(input, length); } -/************************************************* -* Return the raw (unencoded) data * -*************************************************/ +/* +* Return the raw (unencoded) data +*/ SecureVector<byte> EMSA2::raw_data() { return hash->final(); } -/************************************************* -* EMSA2 Encode Operation * -*************************************************/ +/* +* EMSA2 Encode Operation +*/ SecureVector<byte> EMSA2::encoding_of(const MemoryRegion<byte>& msg, u32bit output_bits, RandomNumberGenerator&) @@ -72,9 +74,9 @@ SecureVector<byte> EMSA2::encoding_of(const MemoryRegion<byte>& msg, return emsa2_encoding(msg, output_bits, empty_hash, hash_id); } -/************************************************* -* EMSA2 Verify Operation * -*************************************************/ +/* +* EMSA2 Verify Operation +*/ bool EMSA2::verify(const MemoryRegion<byte>& coded, const MemoryRegion<byte>& raw, u32bit key_bits) throw() @@ -90,9 +92,9 @@ bool EMSA2::verify(const MemoryRegion<byte>& coded, } } -/************************************************* -* EMSA2 Constructor * -*************************************************/ +/* +* EMSA2 Constructor +*/ EMSA2::EMSA2(HashFunction* hash_in) : hash(hash_in) { empty_hash = hash->final(); diff --git a/src/pk_pad/emsa2/emsa2.h b/src/pk_pad/emsa2/emsa2.h index 367dd86ab..76888d1f6 100644 --- a/src/pk_pad/emsa2/emsa2.h +++ b/src/pk_pad/emsa2/emsa2.h @@ -1,7 +1,9 @@ -/************************************************* -* EMSA2 Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* EMSA2 +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_EMSA2_H__ #define BOTAN_EMSA2_H__ @@ -11,9 +13,9 @@ namespace Botan { -/************************************************* -* EMSA2 * -*************************************************/ +/* +* EMSA2 +*/ class BOTAN_DLL EMSA2 : public EMSA { public: diff --git a/src/pk_pad/emsa3/emsa3.cpp b/src/pk_pad/emsa3/emsa3.cpp index 62fdc408d..4d50abd84 100644 --- a/src/pk_pad/emsa3/emsa3.cpp +++ b/src/pk_pad/emsa3/emsa3.cpp @@ -1,6 +1,8 @@ /* * EMSA3 and EMSA3_Raw * (C) 1999-2008 Jack Lloyd +* +* Distributed under the terms of the Botan license */ #include <botan/emsa3.h> diff --git a/src/pk_pad/emsa3/emsa3.h b/src/pk_pad/emsa3/emsa3.h index 443447ca3..301f2142a 100644 --- a/src/pk_pad/emsa3/emsa3.h +++ b/src/pk_pad/emsa3/emsa3.h @@ -1,6 +1,8 @@ /* * EMSA3 and EMSA3_Raw * (C) 1999-2008 Jack Lloyd +* +* Distributed under the terms of the Botan license */ #ifndef BOTAN_EMSA3_H__ diff --git a/src/pk_pad/emsa4/emsa4.cpp b/src/pk_pad/emsa4/emsa4.cpp index 038489e15..cff9a1537 100644 --- a/src/pk_pad/emsa4/emsa4.cpp +++ b/src/pk_pad/emsa4/emsa4.cpp @@ -1,7 +1,9 @@ -/************************************************* -* EMSA4 Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* EMSA4 +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/emsa4.h> #include <botan/mgf1.h> @@ -9,25 +11,25 @@ namespace Botan { -/************************************************* -* EMSA4 Update Operation * -*************************************************/ +/* +* EMSA4 Update Operation +*/ void EMSA4::update(const byte input[], u32bit length) { hash->update(input, length); } -/************************************************* -* Return the raw (unencoded) data * -*************************************************/ +/* +* Return the raw (unencoded) data +*/ SecureVector<byte> EMSA4::raw_data() { return hash->final(); } -/************************************************* -* EMSA4 Encode Operation * -*************************************************/ +/* +* EMSA4 Encode Operation +*/ SecureVector<byte> EMSA4::encoding_of(const MemoryRegion<byte>& msg, u32bit output_bits, RandomNumberGenerator& rng) @@ -62,9 +64,9 @@ SecureVector<byte> EMSA4::encoding_of(const MemoryRegion<byte>& msg, return EM; } -/************************************************* -* EMSA4 Decode/Verify Operation * -*************************************************/ +/* +* EMSA4 Decode/Verify Operation +*/ bool EMSA4::verify(const MemoryRegion<byte>& const_coded, const MemoryRegion<byte>& raw, u32bit key_bits) throw() { @@ -120,18 +122,18 @@ bool EMSA4::verify(const MemoryRegion<byte>& const_coded, return (H == H2); } -/************************************************* -* EMSA4 Constructor * -*************************************************/ +/* +* EMSA4 Constructor +*/ EMSA4::EMSA4(HashFunction* h) : SALT_SIZE(h->OUTPUT_LENGTH), hash(h) { mgf = new MGF1(hash->clone()); } -/************************************************* -* EMSA4 Constructor * -*************************************************/ +/* +* EMSA4 Constructor +*/ EMSA4::EMSA4(HashFunction* h, u32bit salt_size) : SALT_SIZE(salt_size), hash(h) { diff --git a/src/pk_pad/emsa4/emsa4.h b/src/pk_pad/emsa4/emsa4.h index 190725926..b716178a9 100644 --- a/src/pk_pad/emsa4/emsa4.h +++ b/src/pk_pad/emsa4/emsa4.h @@ -1,7 +1,9 @@ -/************************************************* -* EMSA4 Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* EMSA4 +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_EMSA4_H__ #define BOTAN_EMSA4_H__ @@ -12,9 +14,9 @@ namespace Botan { -/************************************************* -* EMSA4 * -*************************************************/ +/* +* EMSA4 +*/ class BOTAN_DLL EMSA4 : public EMSA { public: diff --git a/src/pk_pad/emsa_raw/emsa_raw.cpp b/src/pk_pad/emsa_raw/emsa_raw.cpp index c10bb4890..d5973ee55 100644 --- a/src/pk_pad/emsa_raw/emsa_raw.cpp +++ b/src/pk_pad/emsa_raw/emsa_raw.cpp @@ -1,23 +1,25 @@ -/************************************************* -* EMSA-Raw Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* EMSA-Raw +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/emsa_raw.h> namespace Botan { -/************************************************* -* EMSA-Raw Encode Operation * -*************************************************/ +/* +* EMSA-Raw Encode Operation +*/ void EMSA_Raw::update(const byte input[], u32bit length) { message.append(input, length); } -/************************************************* -* Return the raw (unencoded) data * -*************************************************/ +/* +* Return the raw (unencoded) data +*/ SecureVector<byte> EMSA_Raw::raw_data() { SecureVector<byte> buf = message; @@ -25,9 +27,9 @@ SecureVector<byte> EMSA_Raw::raw_data() return buf; } -/************************************************* -* EMSA-Raw Encode Operation * -*************************************************/ +/* +* EMSA-Raw Encode Operation +*/ SecureVector<byte> EMSA_Raw::encoding_of(const MemoryRegion<byte>& msg, u32bit, RandomNumberGenerator&) @@ -35,9 +37,9 @@ SecureVector<byte> EMSA_Raw::encoding_of(const MemoryRegion<byte>& msg, return msg; } -/************************************************* -* EMSA-Raw Verify Operation * -*************************************************/ +/* +* EMSA-Raw Verify Operation +*/ bool EMSA_Raw::verify(const MemoryRegion<byte>& coded, const MemoryRegion<byte>& raw, u32bit) throw() diff --git a/src/pk_pad/emsa_raw/emsa_raw.h b/src/pk_pad/emsa_raw/emsa_raw.h index df719bf27..1b0ad516e 100644 --- a/src/pk_pad/emsa_raw/emsa_raw.h +++ b/src/pk_pad/emsa_raw/emsa_raw.h @@ -1,7 +1,9 @@ -/************************************************* -* EMSA-Raw Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* EMSA-Raw +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_EMSA_RAW_H__ #define BOTAN_EMSA_RAW_H__ @@ -10,9 +12,9 @@ namespace Botan { -/************************************************* -* EMSA-Raw * -*************************************************/ +/* +* EMSA-Raw +*/ class BOTAN_DLL EMSA_Raw : public EMSA { private: diff --git a/src/pk_pad/hash_id/hash_id.cpp b/src/pk_pad/hash_id/hash_id.cpp index cfaeebf92..c83ad87ac 100644 --- a/src/pk_pad/hash_id/hash_id.cpp +++ b/src/pk_pad/hash_id/hash_id.cpp @@ -1,6 +1,8 @@ /* -* Hash Function Identification Source File +* Hash Function Identification * (C) 1999-2008 Jack Lloyd +* +* Distributed under the terms of the Botan license */ #include <botan/hash_id.h> diff --git a/src/pk_pad/hash_id/hash_id.h b/src/pk_pad/hash_id/hash_id.h index 157c45552..847d9106c 100644 --- a/src/pk_pad/hash_id/hash_id.h +++ b/src/pk_pad/hash_id/hash_id.h @@ -1,7 +1,9 @@ -/************************************************* -* Hash Function Identification Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* Hash Function Identification +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_HASHID_H__ #define BOTAN_HASHID_H__ @@ -11,9 +13,9 @@ namespace Botan { -/************************************************* -* Return the values of various defined HashIDs * -*************************************************/ +/* +* Return the values of various defined HashIDs +*/ BOTAN_DLL MemoryVector<byte> pkcs_hash_id(const std::string&); BOTAN_DLL byte ieee1363_hash_id(const std::string&); 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 diff --git a/src/rng/auto_rng/auto_rng.cpp b/src/rng/auto_rng/auto_rng.cpp index 620cc1f61..578047afc 100644 --- a/src/rng/auto_rng/auto_rng.cpp +++ b/src/rng/auto_rng/auto_rng.cpp @@ -1,7 +1,9 @@ -/************************************************* -* Auto Seeded RNG Source File * -* (C) 2008 Jack Lloyd * -*************************************************/ +/* +* Auto Seeded RNG +* (C) 2008 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/auto_rng.h> #include <botan/parsing.h> diff --git a/src/rng/auto_rng/auto_rng.h b/src/rng/auto_rng/auto_rng.h index 5536f2b8e..021c724fb 100644 --- a/src/rng/auto_rng/auto_rng.h +++ b/src/rng/auto_rng/auto_rng.h @@ -1,7 +1,9 @@ -/************************************************* -* Auto Seeded RNG Header File * -* (C) 2008 Jack Lloyd * -*************************************************/ +/* +* Auto Seeded RNG +* (C) 2008 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_AUTO_SEEDING_RNG_H__ #define BOTAN_AUTO_SEEDING_RNG_H__ diff --git a/src/rng/hmac_rng/hmac_rng.cpp b/src/rng/hmac_rng/hmac_rng.cpp index 458118e11..2f152bf4d 100644 --- a/src/rng/hmac_rng/hmac_rng.cpp +++ b/src/rng/hmac_rng/hmac_rng.cpp @@ -1,6 +1,8 @@ /* * HMAC_RNG * (C) 2008-2009 Jack Lloyd +* +* Distributed under the terms of the Botan license */ #include <botan/hmac_rng.h> diff --git a/src/rng/hmac_rng/hmac_rng.h b/src/rng/hmac_rng/hmac_rng.h index 16adddd60..318e2a931 100644 --- a/src/rng/hmac_rng/hmac_rng.h +++ b/src/rng/hmac_rng/hmac_rng.h @@ -1,6 +1,8 @@ /* * HMAC RNG * (C) 2008 Jack Lloyd +* +* Distributed under the terms of the Botan license */ #ifndef BOTAN_HMAC_RNG_H__ diff --git a/src/rng/randpool/randpool.cpp b/src/rng/randpool/randpool.cpp index af36c335f..f9e05c246 100644 --- a/src/rng/randpool/randpool.cpp +++ b/src/rng/randpool/randpool.cpp @@ -1,6 +1,8 @@ /* -* Randpool Source File +* Randpool * (C) 1999-2009 Jack Lloyd +* +* Distributed under the terms of the Botan license */ #include <botan/randpool.h> diff --git a/src/rng/randpool/randpool.h b/src/rng/randpool/randpool.h index f44527609..b6a3adda4 100644 --- a/src/rng/randpool/randpool.h +++ b/src/rng/randpool/randpool.h @@ -1,6 +1,8 @@ /* -* Randpool Header File +* Randpool * (C) 1999-2008 Jack Lloyd +* +* Distributed under the terms of the Botan license */ #ifndef BOTAN_RANDPOOL_H__ diff --git a/src/rng/rng.cpp b/src/rng/rng.cpp index fe3c4e10c..aa9b73ff3 100644 --- a/src/rng/rng.cpp +++ b/src/rng/rng.cpp @@ -1,7 +1,9 @@ -/************************************************* -* Random Number Generator Base Source File * -* (C) 1999-2008 Jack Lloyd * -*************************************************/ +/* +* Random Number Generator Base +* (C) 1999-2008 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/rng.h> @@ -11,9 +13,9 @@ namespace Botan { -/************************************************* -* Get a single random byte * -*************************************************/ +/* +* Get a single random byte +*/ byte RandomNumberGenerator::next_byte() { byte out; @@ -21,9 +23,9 @@ byte RandomNumberGenerator::next_byte() return out; } -/************************************************* -* Create and seed a new RNG object * -*************************************************/ +/* +* Create and seed a new RNG object +*/ RandomNumberGenerator* RandomNumberGenerator::make_rng() { #if defined(BOTAN_HAS_AUTO_SEEDING_RNG) diff --git a/src/rng/rng.h b/src/rng/rng.h index 7fc6ee439..41904dbef 100644 --- a/src/rng/rng.h +++ b/src/rng/rng.h @@ -1,6 +1,8 @@ /* -* RandomNumberGenerator Header File +* RandomNumberGenerator * (C) 1999-2009 Jack Lloyd +* +* Distributed under the terms of the Botan license */ #ifndef BOTAN_RANDOM_NUMBER_GENERATOR_H__ @@ -80,9 +82,9 @@ class BOTAN_DLL RandomNumberGenerator { return (*this); } }; -/************************************************* -* Null Random Number Generator * -*************************************************/ +/* +* Null Random Number Generator +*/ class BOTAN_DLL Null_RNG : public RandomNumberGenerator { public: diff --git a/src/rng/x931_rng/x931_rng.cpp b/src/rng/x931_rng/x931_rng.cpp index e77f04ae4..e239bce84 100644 --- a/src/rng/x931_rng/x931_rng.cpp +++ b/src/rng/x931_rng/x931_rng.cpp @@ -1,6 +1,8 @@ /* -* ANSI X9.31 RNG Source File +* ANSI X9.31 RNG * (C) 1999-2009 Jack Lloyd +* +* Distributed under the terms of the Botan license */ #include <botan/x931_rng.h> diff --git a/src/rng/x931_rng/x931_rng.h b/src/rng/x931_rng/x931_rng.h index b1cef8df3..44e9b4428 100644 --- a/src/rng/x931_rng/x931_rng.h +++ b/src/rng/x931_rng/x931_rng.h @@ -1,6 +1,8 @@ /* -* ANSI X9.31 RNG Header File +* ANSI X9.31 RNG * (C) 1999-2009 Jack Lloyd +* +* Distributed under the terms of the Botan license */ #ifndef BOTAN_ANSI_X931_RNG_H__ diff --git a/src/s2k/pbkdf1/pbkdf1.cpp b/src/s2k/pbkdf1/pbkdf1.cpp index 00d1ea9ab..04e3aa453 100644 --- a/src/s2k/pbkdf1/pbkdf1.cpp +++ b/src/s2k/pbkdf1/pbkdf1.cpp @@ -1,15 +1,17 @@ -/************************************************* -* PBKDF1 Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* PBKDF1 +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/pbkdf1.h> namespace Botan { -/************************************************* -* Return a PKCS#5 PBKDF1 derived key * -*************************************************/ +/* +* Return a PKCS#5 PBKDF1 derived key +*/ OctetString PKCS5_PBKDF1::derive(u32bit key_len, const std::string& passphrase, const byte salt[], u32bit salt_size, @@ -34,17 +36,17 @@ OctetString PKCS5_PBKDF1::derive(u32bit key_len, return OctetString(key, std::min(key_len, key.size())); } -/************************************************* -* Clone this type * -*************************************************/ +/* +* Clone this type +*/ S2K* PKCS5_PBKDF1::clone() const { return new PKCS5_PBKDF1(hash->clone()); } -/************************************************* -* Return the name of this type * -*************************************************/ +/* +* Return the name of this type +*/ std::string PKCS5_PBKDF1::name() const { return "PBKDF1(" + hash->name() + ")"; diff --git a/src/s2k/pbkdf1/pbkdf1.h b/src/s2k/pbkdf1/pbkdf1.h index ccc0a61fe..4e5cafdb0 100644 --- a/src/s2k/pbkdf1/pbkdf1.h +++ b/src/s2k/pbkdf1/pbkdf1.h @@ -1,7 +1,9 @@ -/************************************************* -* PBKDF1 Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* PBKDF1 +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_PBKDF1_H__ #define BOTAN_PBKDF1_H__ diff --git a/src/s2k/pbkdf2/pbkdf2.cpp b/src/s2k/pbkdf2/pbkdf2.cpp index baa227526..1de27c9ac 100644 --- a/src/s2k/pbkdf2/pbkdf2.cpp +++ b/src/s2k/pbkdf2/pbkdf2.cpp @@ -1,7 +1,9 @@ -/************************************************* -* PBKDF2 Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* PBKDF2 +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/pbkdf2.h> #include <botan/loadstor.h> @@ -9,9 +11,9 @@ namespace Botan { -/************************************************* -* Return a PKCS#5 PBKDF2 derived key * -*************************************************/ +/* +* Return a PKCS#5 PBKDF2 derived key +*/ OctetString PKCS5_PBKDF2::derive(u32bit key_len, const std::string& passphrase, const byte salt[], u32bit salt_size, @@ -57,9 +59,9 @@ OctetString PKCS5_PBKDF2::derive(u32bit key_len, return key; } -/************************************************* -* Return the name of this type * -*************************************************/ +/* +* Return the name of this type +*/ std::string PKCS5_PBKDF2::name() const { return "PBKDF2(" + mac->name() + ")"; @@ -70,9 +72,9 @@ S2K* PKCS5_PBKDF2::clone() const return new PKCS5_PBKDF2(mac->clone()); } -/************************************************* -* PKCS5_PBKDF2 Constructor * -*************************************************/ +/* +* PKCS5_PBKDF2 Constructor +*/ PKCS5_PBKDF2::PKCS5_PBKDF2(MessageAuthenticationCode* m) : mac(m) {} PKCS5_PBKDF2::~PKCS5_PBKDF2() { delete mac; } diff --git a/src/s2k/pbkdf2/pbkdf2.h b/src/s2k/pbkdf2/pbkdf2.h index f9969c0b0..7510338bb 100644 --- a/src/s2k/pbkdf2/pbkdf2.h +++ b/src/s2k/pbkdf2/pbkdf2.h @@ -1,7 +1,9 @@ -/************************************************* -* PBKDF2 Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* PBKDF2 +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_PBKDF2_H__ #define BOTAN_PBKDF2_H__ diff --git a/src/s2k/pgps2k/pgp_s2k.cpp b/src/s2k/pgps2k/pgp_s2k.cpp index b96fdf83b..86394d84d 100644 --- a/src/s2k/pgps2k/pgp_s2k.cpp +++ b/src/s2k/pgps2k/pgp_s2k.cpp @@ -1,7 +1,9 @@ -/************************************************* -* OpenPGP S2K Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* OpenPGP S2K +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/pgp_s2k.h> #include <algorithm> @@ -9,9 +11,9 @@ namespace Botan { -/************************************************* -* Derive a key using the OpenPGP S2K algorithm * -*************************************************/ +/* +* Derive a key using the OpenPGP S2K algorithm +*/ OctetString OpenPGP_S2K::derive(u32bit key_len, const std::string& passphrase, const byte salt_buf[], u32bit salt_size, u32bit iterations) const @@ -53,17 +55,17 @@ OctetString OpenPGP_S2K::derive(u32bit key_len, const std::string& passphrase, return key; } -/************************************************* -* Return the name of this type * -*************************************************/ +/* +* Return the name of this type +*/ std::string OpenPGP_S2K::name() const { return "OpenPGP-S2K(" + hash->name() + ")"; } -/************************************************* -* Return a clone of this object * -*************************************************/ +/* +* Return a clone of this object +*/ S2K* OpenPGP_S2K::clone() const { return new OpenPGP_S2K(hash->clone()); diff --git a/src/s2k/pgps2k/pgp_s2k.h b/src/s2k/pgps2k/pgp_s2k.h index 412ff4281..00e95f7fa 100644 --- a/src/s2k/pgps2k/pgp_s2k.h +++ b/src/s2k/pgps2k/pgp_s2k.h @@ -1,7 +1,9 @@ -/************************************************* -* OpenPGP S2K Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* OpenPGP S2K +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_OPENPGP_S2K_H__ #define BOTAN_OPENPGP_S2K_H__ @@ -11,9 +13,9 @@ namespace Botan { -/************************************************* -* OpenPGP S2K * -*************************************************/ +/* +* OpenPGP S2K +*/ class BOTAN_DLL OpenPGP_S2K : public S2K { public: diff --git a/src/s2k/s2k.cpp b/src/s2k/s2k.cpp index 9c67aef10..b8a8ef719 100644 --- a/src/s2k/s2k.cpp +++ b/src/s2k/s2k.cpp @@ -1,48 +1,50 @@ -/************************************************* -* S2K Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* S2K +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/s2k.h> namespace Botan { -/************************************************* -* Derive a key from a passphrase * -*************************************************/ +/* +* Derive a key from a passphrase +*/ OctetString S2K::derive_key(u32bit key_len, const std::string& passphrase) const { return derive(key_len, passphrase, salt, salt.size(), iterations()); } -/************************************************* -* Set the number of iterations * -*************************************************/ +/* +* Set the number of iterations +*/ void S2K::set_iterations(u32bit i) { iter = i; } -/************************************************* -* Change the salt * -*************************************************/ +/* +* Change the salt +*/ void S2K::change_salt(const byte new_salt[], u32bit length) { salt.set(new_salt, length); } -/************************************************* -* Change the salt * -*************************************************/ +/* +* Change the salt +*/ void S2K::change_salt(const MemoryRegion<byte>& new_salt) { change_salt(new_salt.begin(), new_salt.size()); } -/************************************************* -* Create a new random salt * -*************************************************/ +/* +* Create a new random salt +*/ void S2K::new_random_salt(RandomNumberGenerator& rng, u32bit length) { diff --git a/src/s2k/s2k.h b/src/s2k/s2k.h index d345d77de..7af92519b 100644 --- a/src/s2k/s2k.h +++ b/src/s2k/s2k.h @@ -1,7 +1,9 @@ -/************************************************* -* S2K Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* S2K +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_S2K_H__ #define BOTAN_S2K_H__ @@ -11,9 +13,9 @@ namespace Botan { -/************************************************* -* S2K Interface * -*************************************************/ +/* +* S2K Interface +*/ class BOTAN_DLL S2K { public: diff --git a/src/selftest/selftest.cpp b/src/selftest/selftest.cpp index 4222dc3c9..ea032b04e 100644 --- a/src/selftest/selftest.cpp +++ b/src/selftest/selftest.cpp @@ -1,7 +1,9 @@ -/************************************************* -* Startup Self Tests Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* Startup Self Tests +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/selftest.h> #include <botan/filters.h> @@ -16,9 +18,9 @@ namespace Botan { namespace { -/************************************************* -* Perform a Known Answer Test * -*************************************************/ +/* +* Perform a Known Answer Test +*/ void do_kat(const std::string& in, const std::string& out, const std::string& algo_name, Filter* filter) { @@ -32,9 +34,9 @@ void do_kat(const std::string& in, const std::string& out, } } -/************************************************* -* Perform a KAT for a cipher * -*************************************************/ +/* +* Perform a KAT for a cipher +*/ void cipher_kat(const BlockCipher* proto, const std::string& key_str, const std::string& iv_str, @@ -73,9 +75,9 @@ void cipher_kat(const BlockCipher* proto, } -/************************************************* -* Perform Self Tests * -*************************************************/ +/* +* Perform Self Tests +*/ bool passes_self_tests(Algorithm_Factory& af) { try diff --git a/src/selftest/selftest.h b/src/selftest/selftest.h index 673ece225..9e36d2298 100644 --- a/src/selftest/selftest.h +++ b/src/selftest/selftest.h @@ -1,7 +1,9 @@ -/************************************************* -* Startup Self Test Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* Startup Self Test +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_SELF_TESTS_H__ #define BOTAN_SELF_TESTS_H__ @@ -10,9 +12,9 @@ namespace Botan { -/************************************************* -* Self Tests * -*************************************************/ +/* +* Self Tests +*/ BOTAN_DLL bool passes_self_tests(Algorithm_Factory& af); } diff --git a/src/stream/arc4/arc4.cpp b/src/stream/arc4/arc4.cpp index f422582cc..0f78f7362 100644 --- a/src/stream/arc4/arc4.cpp +++ b/src/stream/arc4/arc4.cpp @@ -1,7 +1,9 @@ -/************************************************* -* ARC4 Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* ARC4 +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/arc4.h> #include <botan/xor_buf.h> @@ -9,9 +11,9 @@ namespace Botan { -/************************************************* -* Combine cipher stream with message * -*************************************************/ +/* +* Combine cipher stream with message +*/ void ARC4::cipher(const byte in[], byte out[], u32bit length) { while(length >= buffer.size() - position) @@ -26,9 +28,9 @@ void ARC4::cipher(const byte in[], byte out[], u32bit length) position += length; } -/************************************************* -* Generate cipher stream * -*************************************************/ +/* +* Generate cipher stream +*/ void ARC4::generate() { u32bit SX, SY; @@ -54,9 +56,9 @@ void ARC4::generate() position = 0; } -/************************************************* -* ARC4 Key Schedule * -*************************************************/ +/* +* ARC4 Key Schedule +*/ void ARC4::key_schedule(const byte key[], u32bit length) { clear(); @@ -72,9 +74,9 @@ void ARC4::key_schedule(const byte key[], u32bit length) position += (SKIP % buffer.size()); } -/************************************************* -* Return the name of this type * -*************************************************/ +/* +* Return the name of this type +*/ std::string ARC4::name() const { if(SKIP == 0) return "ARC4"; @@ -82,9 +84,9 @@ std::string ARC4::name() const else return "RC4_skip(" + to_string(SKIP) + ")"; } -/************************************************* -* Clear memory of sensitive data * -*************************************************/ +/* +* Clear memory of sensitive data +*/ void ARC4::clear() throw() { state.clear(); @@ -92,9 +94,9 @@ void ARC4::clear() throw() position = X = Y = 0; } -/************************************************* -* ARC4 Constructor * -*************************************************/ +/* +* ARC4 Constructor +*/ ARC4::ARC4(u32bit s) : StreamCipher(1, 256), SKIP(s) { clear(); diff --git a/src/stream/arc4/arc4.h b/src/stream/arc4/arc4.h index d399e2144..aa2cea7fe 100644 --- a/src/stream/arc4/arc4.h +++ b/src/stream/arc4/arc4.h @@ -1,7 +1,9 @@ -/************************************************* -* ARC4 Header File * -* (C) 1999-2008 Jack Lloyd * -*************************************************/ +/* +* ARC4 +* (C) 1999-2008 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_ARC4_H__ #define BOTAN_ARC4_H__ @@ -11,9 +13,9 @@ namespace Botan { -/************************************************* -* ARC4 * -*************************************************/ +/* +* ARC4 +*/ class BOTAN_DLL ARC4 : public StreamCipher { public: diff --git a/src/stream/salsa20/salsa20.cpp b/src/stream/salsa20/salsa20.cpp index e6a190fc3..75137798c 100644 --- a/src/stream/salsa20/salsa20.cpp +++ b/src/stream/salsa20/salsa20.cpp @@ -1,7 +1,9 @@ -/************************************************* -* Salsa20 Source File * -* (C) 1999-2008 Jack Lloyd * -*************************************************/ +/* +* Salsa20 +* (C) 1999-2008 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/salsa20.h> #include <botan/mem_ops.h> @@ -13,9 +15,9 @@ namespace Botan { namespace { -/************************************************* -* Generate Salsa20 cipher stream * -*************************************************/ +/* +* Generate Salsa20 cipher stream +*/ void salsa20(byte output[64], const u32bit input[16]) { u32bit x00 = input[0]; @@ -92,9 +94,9 @@ void salsa20(byte output[64], const u32bit input[16]) } -/************************************************* -* Combine cipher stream with message * -*************************************************/ +/* +* Combine cipher stream with message +*/ void Salsa20::cipher(const byte in[], byte out[], u32bit length) { while(length >= buffer.size() - position) @@ -117,9 +119,9 @@ void Salsa20::cipher(const byte in[], byte out[], u32bit length) position += length; } -/************************************************* -* Salsa20 Key Schedule * -*************************************************/ +/* +* Salsa20 Key Schedule +*/ void Salsa20::key_schedule(const byte key[], u32bit length) { static const u32bit TAU[] = @@ -165,9 +167,9 @@ void Salsa20::key_schedule(const byte key[], u32bit length) resync(ZERO, sizeof(ZERO)); } -/************************************************* -* Return the name of this type * -*************************************************/ +/* +* Return the name of this type +*/ void Salsa20::resync(const byte iv[], u32bit length) { if(length != IV_LENGTH) @@ -186,17 +188,17 @@ void Salsa20::resync(const byte iv[], u32bit length) position = 0; } -/************************************************* -* Return the name of this type * -*************************************************/ +/* +* Return the name of this type +*/ std::string Salsa20::name() const { return "Salsa20"; } -/************************************************* -* Clear memory of sensitive data * -*************************************************/ +/* +* Clear memory of sensitive data +*/ void Salsa20::clear() throw() { state.clear(); @@ -204,9 +206,9 @@ void Salsa20::clear() throw() position = 0; } -/************************************************* -* Salsa20 Constructor * -*************************************************/ +/* +* Salsa20 Constructor +*/ Salsa20::Salsa20() : StreamCipher(16, 32, 16, 8) { clear(); diff --git a/src/stream/salsa20/salsa20.h b/src/stream/salsa20/salsa20.h index d40b84cfc..3dbfddb50 100644 --- a/src/stream/salsa20/salsa20.h +++ b/src/stream/salsa20/salsa20.h @@ -1,7 +1,9 @@ -/************************************************* -* Salsa20 Header File * -* (C) 1999-2008 Jack Lloyd * -*************************************************/ +/* +* Salsa20 +* (C) 1999-2008 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_SALSA20_H__ #define BOTAN_SALSA20_H__ @@ -10,9 +12,9 @@ namespace Botan { -/************************************************* -* Salsa20 * -*************************************************/ +/* +* Salsa20 +*/ class BOTAN_DLL Salsa20 : public StreamCipher { public: diff --git a/src/stream/stream_cipher.cpp b/src/stream/stream_cipher.cpp index 04bb54484..68bb5d4f0 100644 --- a/src/stream/stream_cipher.cpp +++ b/src/stream/stream_cipher.cpp @@ -1,15 +1,17 @@ /** * Stream Cipher Default Implementation for IV and Seek * (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license */ #include <botan/stream_cipher.h> namespace Botan { -/************************************************* -* Default StreamCipher Resync Operation * -*************************************************/ +/* +* Default StreamCipher Resync Operation +*/ void StreamCipher::resync(const byte[], u32bit length) { if(length) @@ -17,9 +19,9 @@ void StreamCipher::resync(const byte[], u32bit length) " does not support resyncronization"); } -/************************************************* -* Default StreamCipher Seek Operation * -*************************************************/ +/* +* Default StreamCipher Seek Operation +*/ void StreamCipher::seek(u32bit) { throw Exception("The stream cipher " + name() + " does not support seek()"); diff --git a/src/stream/stream_cipher.h b/src/stream/stream_cipher.h index 9934fd987..8ea359131 100644 --- a/src/stream/stream_cipher.h +++ b/src/stream/stream_cipher.h @@ -1,6 +1,8 @@ /** * Stream Cipher * (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license */ #ifndef BOTAN_STREAM_CIPHER_H__ @@ -10,9 +12,9 @@ namespace Botan { -/************************************************* -* Stream Cipher * -*************************************************/ +/* +* Stream Cipher +*/ class BOTAN_DLL StreamCipher : public SymmetricAlgorithm { public: diff --git a/src/stream/turing/tur_tab.cpp b/src/stream/turing/tur_tab.cpp index 8162a999e..a2edd5a5e 100644 --- a/src/stream/turing/tur_tab.cpp +++ b/src/stream/turing/tur_tab.cpp @@ -1,7 +1,9 @@ -/************************************************* -* Tables for Turing * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* Tables for Turing +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/turing.h> diff --git a/src/stream/turing/turing.cpp b/src/stream/turing/turing.cpp index bdf320364..b988568c3 100644 --- a/src/stream/turing/turing.cpp +++ b/src/stream/turing/turing.cpp @@ -1,7 +1,9 @@ -/************************************************* -* Turing Source File * -* (C) 1999-2008 Jack Lloyd * -*************************************************/ +/* +* Turing +* (C) 1999-2008 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/turing.h> #include <botan/loadstor.h> @@ -11,9 +13,9 @@ namespace Botan { namespace { -/************************************************* -* Perform an N-way PHT * -*************************************************/ +/* +* Perform an N-way PHT +*/ inline void PHT(MemoryRegion<u32bit>& buf) { u32bit sum = 0; @@ -27,9 +29,9 @@ inline void PHT(MemoryRegion<u32bit>& buf) } -/************************************************* -* Combine cipher stream with message * -*************************************************/ +/* +* Combine cipher stream with message +*/ void Turing::cipher(const byte in[], byte out[], u32bit length) { while(length >= buffer.size() - position) @@ -44,9 +46,9 @@ void Turing::cipher(const byte in[], byte out[], u32bit length) position += length; } -/************************************************* -* Generate cipher stream * -*************************************************/ +/* +* Generate cipher stream +*/ void Turing::generate() { // Table for Turing's polynomial multiplication @@ -200,9 +202,9 @@ void Turing::generate() position = 0; } -/************************************************* -* Turing's byte mixing step * -*************************************************/ +/* +* Turing's byte mixing step +*/ u32bit Turing::fixedS(u32bit W) { for(u32bit j = 0; j != 4; ++j) @@ -215,9 +217,9 @@ u32bit Turing::fixedS(u32bit W) return W; } -/************************************************* -* Generate the expanded Turing Sbox tables * -*************************************************/ +/* +* Generate the expanded Turing Sbox tables +*/ void Turing::gen_sbox(MemoryRegion<u32bit>& S, u32bit which, const MemoryRegion<u32bit>& K) { @@ -234,9 +236,9 @@ void Turing::gen_sbox(MemoryRegion<u32bit>& S, u32bit which, } } -/************************************************* -* Turing Key Schedule * -*************************************************/ +/* +* Turing Key Schedule +*/ void Turing::key_schedule(const byte key[], u32bit length) { K.create(length / 4); @@ -256,9 +258,9 @@ void Turing::key_schedule(const byte key[], u32bit length) resync(0, 0); } -/************************************************* -* Resynchronization * -*************************************************/ +/* +* Resynchronization +*/ void Turing::resync(const byte iv[], u32bit length) { if(length % 4 != 0 || length > 16) @@ -288,9 +290,9 @@ void Turing::resync(const byte iv[], u32bit length) generate(); } -/************************************************* -* Clear memory of sensitive data * -*************************************************/ +/* +* Clear memory of sensitive data +*/ void Turing::clear() throw() { S0.clear(); diff --git a/src/stream/turing/turing.h b/src/stream/turing/turing.h index 018196fd3..d48c1d8a8 100644 --- a/src/stream/turing/turing.h +++ b/src/stream/turing/turing.h @@ -1,7 +1,9 @@ -/************************************************* -* Turing Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* Turing +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_TURING_H__ #define BOTAN_TURING_H__ @@ -10,9 +12,9 @@ namespace Botan { -/************************************************* -* Turing * -*************************************************/ +/* +* Turing +*/ class BOTAN_DLL Turing : public StreamCipher { public: diff --git a/src/stream/wid_wake/wid_wake.cpp b/src/stream/wid_wake/wid_wake.cpp index c14652c54..1dc0fd7f9 100644 --- a/src/stream/wid_wake/wid_wake.cpp +++ b/src/stream/wid_wake/wid_wake.cpp @@ -1,7 +1,9 @@ -/************************************************* -* WiderWake Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* WiderWake +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/wid_wake.h> #include <botan/loadstor.h> @@ -9,9 +11,9 @@ namespace Botan { -/************************************************* -* Combine cipher stream with message * -*************************************************/ +/* +* Combine cipher stream with message +*/ void WiderWake_41_BE::cipher(const byte in[], byte out[], u32bit length) { while(length >= buffer.size() - position) @@ -26,9 +28,9 @@ void WiderWake_41_BE::cipher(const byte in[], byte out[], u32bit length) position += length; } -/************************************************* -* Generate cipher stream * -*************************************************/ +/* +* Generate cipher stream +*/ void WiderWake_41_BE::generate(u32bit length) { u32bit R0 = state[0], R1 = state[1], @@ -67,9 +69,9 @@ void WiderWake_41_BE::generate(u32bit length) position = 0; } -/************************************************* -* WiderWake Key Schedule * -*************************************************/ +/* +* WiderWake Key Schedule +*/ void WiderWake_41_BE::key_schedule(const byte key[], u32bit) { for(u32bit j = 0; j != 4; ++j) @@ -112,9 +114,9 @@ void WiderWake_41_BE::key_schedule(const byte key[], u32bit) resync(iv, 8); } -/************************************************* -* Resynchronization * -*************************************************/ +/* +* Resynchronization +*/ void WiderWake_41_BE::resync(const byte iv[], u32bit length) { if(length != 8) @@ -130,9 +132,9 @@ void WiderWake_41_BE::resync(const byte iv[], u32bit length) generate(buffer.size()); } -/************************************************* -* Clear memory of sensitive data * -*************************************************/ +/* +* Clear memory of sensitive data +*/ void WiderWake_41_BE::clear() throw() { position = 0; diff --git a/src/stream/wid_wake/wid_wake.h b/src/stream/wid_wake/wid_wake.h index d73eee2d5..4720afdb2 100644 --- a/src/stream/wid_wake/wid_wake.h +++ b/src/stream/wid_wake/wid_wake.h @@ -1,7 +1,9 @@ -/************************************************* -* WiderWake Header File * -* (C) 1999-2008 Jack Lloyd * -*************************************************/ +/* +* WiderWake +* (C) 1999-2008 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_WIDER_WAKE_H__ #define BOTAN_WIDER_WAKE_H__ @@ -10,9 +12,9 @@ namespace Botan { -/************************************************* -* WiderWake4+1-BE * -*************************************************/ +/* +* WiderWake4+1-BE +*/ class BOTAN_DLL WiderWake_41_BE : public StreamCipher { public: diff --git a/src/sym_algo/sym_algo.h b/src/sym_algo/sym_algo.h index d71163ead..1c8b816fd 100644 --- a/src/sym_algo/sym_algo.h +++ b/src/sym_algo/sym_algo.h @@ -1,6 +1,8 @@ /** * Symmetric Algorithm Base Class * (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license */ #ifndef BOTAN_SYMMETRIC_ALGORITHM_H__ diff --git a/src/sym_algo/symkey.cpp b/src/sym_algo/symkey.cpp index 7cc1bce64..32dfe68d5 100644 --- a/src/sym_algo/symkey.cpp +++ b/src/sym_algo/symkey.cpp @@ -1,7 +1,9 @@ -/************************************************* -* OctetString Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* OctetString +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/symkey.h> #include <botan/xor_buf.h> @@ -12,9 +14,9 @@ namespace Botan { -/************************************************* -* Create an OctetString from RNG output * -*************************************************/ +/* +* Create an OctetString from RNG output +*/ OctetString::OctetString(RandomNumberGenerator& rng, u32bit length) { @@ -22,9 +24,9 @@ OctetString::OctetString(RandomNumberGenerator& rng, rng.randomize(bits, length); } -/************************************************* -* Create an OctetString from a hex string * -*************************************************/ +/* +* Create an OctetString from a hex string +*/ void OctetString::change(const std::string& hex_string) { SecureVector<byte> hex; @@ -39,18 +41,18 @@ void OctetString::change(const std::string& hex_string) bits[j] = Hex_Decoder::decode(hex.begin() + 2*j); } -/************************************************* -* Create an OctetString from a byte string * -*************************************************/ +/* +* Create an OctetString from a byte string +*/ void OctetString::change(const byte in[], u32bit n) { bits.create(n); bits.copy(in, n); } -/************************************************* -* Set the parity of each key byte to odd * -*************************************************/ +/* +* Set the parity of each key byte to odd +*/ void OctetString::set_odd_parity() { const byte ODD_PARITY[256] = { @@ -81,9 +83,9 @@ void OctetString::set_odd_parity() bits[j] = ODD_PARITY[bits[j]]; } -/************************************************* -* Hex encode an OctetString * -*************************************************/ +/* +* Hex encode an OctetString +*/ std::string OctetString::as_string() const { Pipe pipe(new Hex_Encoder); @@ -91,9 +93,9 @@ std::string OctetString::as_string() const return pipe.read_all_as_string(); } -/************************************************* -* XOR Operation for OctetStrings * -*************************************************/ +/* +* XOR Operation for OctetStrings +*/ OctetString& OctetString::operator^=(const OctetString& k) { if(&k == this) { bits.clear(); return (*this); } @@ -101,33 +103,33 @@ OctetString& OctetString::operator^=(const OctetString& k) return (*this); } -/************************************************* -* Equality Operation for OctetStrings * -*************************************************/ +/* +* Equality Operation for OctetStrings +*/ bool operator==(const OctetString& s1, const OctetString& s2) { return (s1.bits_of() == s2.bits_of()); } -/************************************************* -* Unequality Operation for OctetStrings * -*************************************************/ +/* +* Unequality Operation for OctetStrings +*/ bool operator!=(const OctetString& s1, const OctetString& s2) { return !(s1 == s2); } -/************************************************* -* Append Operation for OctetStrings * -*************************************************/ +/* +* Append Operation for OctetStrings +*/ OctetString operator+(const OctetString& k1, const OctetString& k2) { return OctetString(SecureVector<byte>(k1.bits_of(), k2.bits_of())); } -/************************************************* -* XOR Operation for OctetStrings * -*************************************************/ +/* +* XOR Operation for OctetStrings +*/ OctetString operator^(const OctetString& k1, const OctetString& k2) { SecureVector<byte> ret(std::max(k1.length(), k2.length())); diff --git a/src/sym_algo/symkey.h b/src/sym_algo/symkey.h index f3211eb0f..5504297a4 100644 --- a/src/sym_algo/symkey.h +++ b/src/sym_algo/symkey.h @@ -1,7 +1,9 @@ -/************************************************* -* OctetString Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* OctetString +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_SYMKEY_H__ #define BOTAN_SYMKEY_H__ @@ -11,9 +13,9 @@ namespace Botan { -/************************************************* -* Octet String * -*************************************************/ +/* +* Octet String +*/ class BOTAN_DLL OctetString { public: @@ -41,17 +43,17 @@ class BOTAN_DLL OctetString SecureVector<byte> bits; }; -/************************************************* -* Operations on Octet Strings * -*************************************************/ +/* +* Operations on Octet Strings +*/ BOTAN_DLL bool operator==(const OctetString&, const OctetString&); BOTAN_DLL bool operator!=(const OctetString&, const OctetString&); BOTAN_DLL OctetString operator+(const OctetString&, const OctetString&); BOTAN_DLL OctetString operator^(const OctetString&, const OctetString&); -/************************************************* -* Alternate Names * -*************************************************/ +/* +* Alternate Names +*/ typedef OctetString SymmetricKey; typedef OctetString InitializationVector; diff --git a/src/timer/cpu_counter/tm_hard.cpp b/src/timer/cpu_counter/tm_hard.cpp index 2f7516930..9e31aee39 100644 --- a/src/timer/cpu_counter/tm_hard.cpp +++ b/src/timer/cpu_counter/tm_hard.cpp @@ -1,15 +1,17 @@ -/************************************************* -* Hardware Timer Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* Hardware Timer +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/tm_hard.h> namespace Botan { -/************************************************* -* Get the timestamp * -*************************************************/ +/* +* Get the timestamp +*/ u64bit Hardware_Timer::clock() const { u64bit rtc = 0; diff --git a/src/timer/cpu_counter/tm_hard.h b/src/timer/cpu_counter/tm_hard.h index 03f508575..2e338eca8 100644 --- a/src/timer/cpu_counter/tm_hard.h +++ b/src/timer/cpu_counter/tm_hard.h @@ -1,7 +1,9 @@ -/************************************************* -* Hardware Timer Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* Hardware Timer +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_TIMER_HARDWARE_H__ #define BOTAN_TIMER_HARDWARE_H__ @@ -10,9 +12,9 @@ namespace Botan { -/************************************************* -* Hardware Timer * -*************************************************/ +/* +* Hardware Timer +*/ class BOTAN_DLL Hardware_Timer : public Timer { public: diff --git a/src/timer/gettimeofday/tm_unix.cpp b/src/timer/gettimeofday/tm_unix.cpp index 654297753..e32df7166 100644 --- a/src/timer/gettimeofday/tm_unix.cpp +++ b/src/timer/gettimeofday/tm_unix.cpp @@ -1,7 +1,9 @@ -/************************************************* -* Unix Timer Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* Unix Timer +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/tm_unix.h> #include <botan/util.h> @@ -9,9 +11,9 @@ namespace Botan { -/************************************************* -* Get the timestamp * -*************************************************/ +/* +* Get the timestamp +*/ u64bit Unix_Timer::clock() const { struct ::timeval tv; diff --git a/src/timer/gettimeofday/tm_unix.h b/src/timer/gettimeofday/tm_unix.h index 21afb3ee8..c304dbb5c 100644 --- a/src/timer/gettimeofday/tm_unix.h +++ b/src/timer/gettimeofday/tm_unix.h @@ -1,7 +1,9 @@ -/************************************************* -* Unix Timer Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* Unix Timer +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_TIMER_UNIX_H__ #define BOTAN_TIMER_UNIX_H__ @@ -10,9 +12,9 @@ namespace Botan { -/************************************************* -* Unix Timer * -*************************************************/ +/* +* Unix Timer +*/ class BOTAN_DLL Unix_Timer : public Timer { public: diff --git a/src/timer/posix_rt/tm_posix.cpp b/src/timer/posix_rt/tm_posix.cpp index 601b2b43d..d356384ab 100644 --- a/src/timer/posix_rt/tm_posix.cpp +++ b/src/timer/posix_rt/tm_posix.cpp @@ -1,7 +1,9 @@ -/************************************************* -* POSIX Timer Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* POSIX Timer +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/tm_posix.h> #include <botan/util.h> @@ -18,9 +20,9 @@ namespace Botan { -/************************************************* -* Get the timestamp * -*************************************************/ +/* +* Get the timestamp +*/ u64bit POSIX_Timer::clock() const { struct ::timespec tv; diff --git a/src/timer/posix_rt/tm_posix.h b/src/timer/posix_rt/tm_posix.h index 077636a0a..8bedccfa2 100644 --- a/src/timer/posix_rt/tm_posix.h +++ b/src/timer/posix_rt/tm_posix.h @@ -1,7 +1,9 @@ -/************************************************* -* POSIX Timer Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* POSIX Timer +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_TIMER_POSIX_H__ #define BOTAN_TIMER_POSIX_H__ @@ -10,9 +12,9 @@ namespace Botan { -/************************************************* -* POSIX Timer * -*************************************************/ +/* +* POSIX Timer +*/ class BOTAN_DLL POSIX_Timer : public Timer { public: diff --git a/src/timer/timer.cpp b/src/timer/timer.cpp index a801761cf..035c217f9 100644 --- a/src/timer/timer.cpp +++ b/src/timer/timer.cpp @@ -1,6 +1,8 @@ /** -* Timestamp Functions Source File +* Timestamp Functions * (C) 1999-2009 Jack Lloyd +* +* Distributed under the terms of the Botan license */ #include <botan/timer.h> diff --git a/src/timer/timer.h b/src/timer/timer.h index 0e0dcc62e..b6e8ef448 100644 --- a/src/timer/timer.h +++ b/src/timer/timer.h @@ -1,6 +1,8 @@ /** -* Timestamp Functions Header File +* Timestamp Functions * (C) 1999-2009 Jack Lloyd +* +* Distributed under the terms of the Botan license */ #ifndef BOTAN_TIMERS_H__ diff --git a/src/timer/win32_query_perf_ctr/tm_win32.cpp b/src/timer/win32_query_perf_ctr/tm_win32.cpp index 58f7b0f55..6b878e6e2 100644 --- a/src/timer/win32_query_perf_ctr/tm_win32.cpp +++ b/src/timer/win32_query_perf_ctr/tm_win32.cpp @@ -1,16 +1,18 @@ -/************************************************* -* Win32 Timer Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* Win32 Timer +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/tm_win32.h> #include <windows.h> namespace Botan { -/************************************************* -* Get the timestamp * -*************************************************/ +/* +* Get the timestamp +*/ u64bit Win32_Timer::clock() const { LARGE_INTEGER tv; diff --git a/src/timer/win32_query_perf_ctr/tm_win32.h b/src/timer/win32_query_perf_ctr/tm_win32.h index d458d0a3f..5bcb720ab 100644 --- a/src/timer/win32_query_perf_ctr/tm_win32.h +++ b/src/timer/win32_query_perf_ctr/tm_win32.h @@ -1,7 +1,9 @@ -/************************************************* -* Win32 Timer Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* Win32 Timer +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_TIMER_WIN32_H__ #define BOTAN_TIMER_WIN32_H__ @@ -10,9 +12,9 @@ namespace Botan { -/************************************************* -* Win32 Timer * -*************************************************/ +/* +* Win32 Timer +*/ class BOTAN_DLL Win32_Timer : public Timer { public: diff --git a/src/utils/asm_amd64/asm_macr.h b/src/utils/asm_amd64/asm_macr.h index 6f819591f..287fa3e88 100644 --- a/src/utils/asm_amd64/asm_macr.h +++ b/src/utils/asm_amd64/asm_macr.h @@ -1,14 +1,16 @@ -/************************************************* -* Assembly Macros Header File * -* (C) 1999-2008 Jack Lloyd * -*************************************************/ +/* +* Assembly Macros +* (C) 1999-2008 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_AMD64_ASM_MACROS_H__ #define BOTAN_AMD64_ASM_MACROS_H__ -/************************************************* -* General/Global Macros * -*************************************************/ +/* +* General/Global Macros +*/ #define ALIGN .p2align 4,,15 #define START_LISTING(FILENAME) \ @@ -20,9 +22,9 @@ .section .note.GNU-stack,"",%progbits #endif -/************************************************* -* Function Definitions * -*************************************************/ +/* +* Function Definitions +*/ #define START_FUNCTION(func_name) \ ALIGN; \ .global func_name; \ @@ -32,9 +34,9 @@ func_name: #define END_FUNCTION(func_name) \ ret -/************************************************* -* Conditional Jumps * -*************************************************/ +/* +* Conditional Jumps +*/ #define JUMP_IF_ZERO(REG, LABEL) \ cmp IMM(0), REG; \ jz LABEL @@ -43,9 +45,9 @@ func_name: cmp IMM(NUM), REG; \ jl LABEL -/************************************************* -* Register Names * -*************************************************/ +/* +* Register Names +*/ #define R0 %rax #define R1 %rbx #define R2 %rcx @@ -90,17 +92,17 @@ func_name: #define TEMP_8 ARG_1 #define TEMP_9 R0 -/************************************************* -* Memory Access Operations * -*************************************************/ +/* +* Memory Access Operations +*/ #define ARRAY8(REG, NUM) 8*(NUM)(REG) #define ARRAY4(REG, NUM) 4*(NUM)(REG) #define ASSIGN(TO, FROM) mov FROM, TO -/************************************************* -* ALU Operations * -*************************************************/ +/* +* ALU Operations +*/ #define IMM(VAL) $VAL #define ADD(TO, FROM) add FROM, TO diff --git a/src/utils/asm_ia32/asm_macr.h b/src/utils/asm_ia32/asm_macr.h index 58f9be19a..2ea69512b 100644 --- a/src/utils/asm_ia32/asm_macr.h +++ b/src/utils/asm_ia32/asm_macr.h @@ -1,14 +1,16 @@ -/************************************************* -* Assembly Macros Header File * -* (C) 1999-2008 Jack Lloyd * -*************************************************/ +/* +* Assembly Macros +* (C) 1999-2008 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_IA32_ASM_MACROS_H__ #define BOTAN_IA32_ASM_MACROS_H__ -/************************************************* -* General/Global Macros * -*************************************************/ +/* +* General/Global Macros +*/ #define ALIGN .p2align 4,,15 #define START_LISTING(FILENAME) \ @@ -20,9 +22,9 @@ .section .note.GNU-stack,"",%progbits #endif -/************************************************* -* Function Definitions * -*************************************************/ +/* +* Function Definitions +*/ #define START_FUNCTION(func_name) \ ALIGN; \ .global func_name; \ @@ -32,9 +34,9 @@ func_name: #define END_FUNCTION(func_name) \ ret -/************************************************* -* Loop Control * -*************************************************/ +/* +* Loop Control +*/ #define START_LOOP(LABEL) \ ALIGN; \ LABEL##_LOOP: @@ -47,9 +49,9 @@ func_name: cmpl IMM(NUM), REG; \ jge LABEL##_LOOP -/************************************************* - Conditional Jumps * -*************************************************/ +/* + Conditional Jumps +*/ #define JUMP_IF_ZERO(REG, LABEL) \ cmpl IMM(0), REG; \ jz LABEL @@ -58,9 +60,9 @@ func_name: cmpl IMM(NUM), REG; \ jl LABEL -/************************************************* -* Register Names * -*************************************************/ +/* +* Register Names +*/ #define EAX %eax #define EBX %ebx #define ECX %ecx @@ -70,9 +72,9 @@ func_name: #define ESI %esi #define ESP %esp -/************************************************* -* Memory Access Operations * -*************************************************/ +/* +* Memory Access Operations +*/ #define ARRAY1(REG, NUM) (NUM)(REG) #define ARRAY4(REG, NUM) 4*(NUM)(REG) #define ARRAY4_INDIRECT(BASE, OFFSET, NUM) 4*(NUM)(BASE,OFFSET,4) @@ -96,9 +98,9 @@ func_name: POP(EDI) ; \ POP(EBP) -/************************************************* -* ALU Operations * -*************************************************/ +/* +* ALU Operations +*/ #define IMM(VAL) $VAL #define ADD(TO, FROM) addl FROM, TO diff --git a/src/utils/bit_ops.h b/src/utils/bit_ops.h index c876e6f14..c02ec536f 100644 --- a/src/utils/bit_ops.h +++ b/src/utils/bit_ops.h @@ -1,7 +1,9 @@ -/************************************************* -* Bit/Word Operations Header File * -* (C) 1999-2008 Jack Lloyd * -*************************************************/ +/* +* Bit/Word Operations +* (C) 1999-2008 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_BIT_OPS_H__ #define BOTAN_BIT_OPS_H__ @@ -10,20 +12,20 @@ namespace Botan { -/************************************************* -* Return true iff arg is 2**n for some n > 0 * -* T should be an unsigned integer type * -*************************************************/ +/* +* Return true iff arg is 2**n for some n > 0 +* T should be an unsigned integer type +*/ template<typename T> inline bool power_of_2(T arg) { return ((arg != 0 && arg != 1) && ((arg & (arg-1)) == 0)); } -/************************************************* +/* * Return the index of the highest set bit * T is an unsigned integer type -*************************************************/ +*/ template<typename T> inline u32bit high_bit(T n) { @@ -33,9 +35,9 @@ inline u32bit high_bit(T n) return 0; } -/************************************************* -* Return the index of the lowest set bit * -*************************************************/ +/* +* Return the index of the lowest set bit +*/ template<typename T> inline u32bit low_bit(T n) { @@ -45,9 +47,9 @@ inline u32bit low_bit(T n) return 0; } -/************************************************* -* Return the number of significant bytes in n * -*************************************************/ +/* +* Return the number of significant bytes in n +*/ template<typename T> inline u32bit significant_bytes(T n) { @@ -57,9 +59,9 @@ inline u32bit significant_bytes(T n) return 0; } -/************************************************* -* Return the Hamming weight of n * -*************************************************/ +/* +* Return the Hamming weight of n +*/ template<typename T> inline u32bit hamming_weight(T n) { @@ -72,9 +74,9 @@ inline u32bit hamming_weight(T n) return weight; } -/************************************************* -* Count the trailing zero bits in n * -*************************************************/ +/* +* Count the trailing zero bits in n +*/ template<typename T> inline u32bit ctz(T n) { diff --git a/src/utils/bswap.h b/src/utils/bswap.h index c1f03c9fd..af51e4e47 100644 --- a/src/utils/bswap.h +++ b/src/utils/bswap.h @@ -1,8 +1,10 @@ -/************************************************* -* Byte Swapping Operations Header File * -* (C) 1999-2008 Jack Lloyd * -* (C) 2007 Yves Jerschow * -*************************************************/ +/* +* Byte Swapping Operations +* (C) 1999-2008 Jack Lloyd +* (C) 2007 Yves Jerschow +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_BYTE_SWAP_H__ #define BOTAN_BYTE_SWAP_H__ @@ -12,9 +14,9 @@ namespace Botan { -/************************************************* -* Byte Swapping Functions * -*************************************************/ +/* +* Byte Swapping Functions +*/ inline u16bit reverse_bytes(u16bit input) { return rotate_left(input, 8); diff --git a/src/utils/buf_comp.h b/src/utils/buf_comp.h index c05324b8f..3f1e90bad 100644 --- a/src/utils/buf_comp.h +++ b/src/utils/buf_comp.h @@ -1,6 +1,8 @@ /** * BufferedComputation * (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license */ #ifndef BOTAN_BUFFERED_COMPUTATION_H__ diff --git a/src/utils/charset.cpp b/src/utils/charset.cpp index 73c520be1..53125cad1 100644 --- a/src/utils/charset.cpp +++ b/src/utils/charset.cpp @@ -1,7 +1,9 @@ -/************************************************* -* Character Set Handling Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* Character Set Handling +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/charset.h> #include <botan/parsing.h> @@ -14,9 +16,9 @@ namespace Charset { namespace { -/************************************************* -* Convert from UCS-2 to ISO 8859-1 * -*************************************************/ +/* +* Convert from UCS-2 to ISO 8859-1 +*/ std::string ucs2_to_latin1(const std::string& ucs2) { if(ucs2.size() % 2 == 1) @@ -38,9 +40,9 @@ std::string ucs2_to_latin1(const std::string& ucs2) return latin1; } -/************************************************* -* Convert from UTF-8 to ISO 8859-1 * -*************************************************/ +/* +* Convert from UTF-8 to ISO 8859-1 +*/ std::string utf8_to_latin1(const std::string& utf8) { std::string iso8859; @@ -72,9 +74,9 @@ std::string utf8_to_latin1(const std::string& utf8) return iso8859; } -/************************************************* -* Convert from ISO 8859-1 to UTF-8 * -*************************************************/ +/* +* Convert from ISO 8859-1 to UTF-8 +*/ std::string latin1_to_utf8(const std::string& iso8859) { std::string utf8; @@ -95,9 +97,9 @@ std::string latin1_to_utf8(const std::string& iso8859) } -/************************************************* -* Perform character set transcoding * -*************************************************/ +/* +* Perform character set transcoding +*/ std::string transcode(const std::string& str, Character_Set to, Character_Set from) { @@ -120,9 +122,9 @@ std::string transcode(const std::string& str, to_string(from) + " to " + to_string(to)); } -/************************************************* -* Check if a character represents a digit * -*************************************************/ +/* +* Check if a character represents a digit +*/ bool is_digit(char c) { if(c == '0' || c == '1' || c == '2' || c == '3' || c == '4' || @@ -131,9 +133,9 @@ bool is_digit(char c) return false; } -/************************************************* -* Check if a character represents whitespace * -*************************************************/ +/* +* Check if a character represents whitespace +*/ bool is_space(char c) { if(c == ' ' || c == '\t' || c == '\n' || c == '\r') @@ -141,9 +143,9 @@ bool is_space(char c) return false; } -/************************************************* -* Convert a character to a digit * -*************************************************/ +/* +* Convert a character to a digit +*/ byte char2digit(char c) { switch(c) @@ -163,9 +165,9 @@ byte char2digit(char c) throw Invalid_Argument("char2digit: Input is not a digit character"); } -/************************************************* -* Convert a digit to a character * -*************************************************/ +/* +* Convert a digit to a character +*/ char digit2char(byte b) { switch(b) @@ -185,9 +187,9 @@ char digit2char(byte b) throw Invalid_Argument("digit2char: Input is not a digit"); } -/************************************************* -* Case-insensitive character comparison * -*************************************************/ +/* +* Case-insensitive character comparison +*/ bool caseless_cmp(char a, char b) { return (std::tolower(static_cast<unsigned char>(a)) == diff --git a/src/utils/charset.h b/src/utils/charset.h index 25827c8a7..eebb1997d 100644 --- a/src/utils/charset.h +++ b/src/utils/charset.h @@ -1,7 +1,9 @@ -/************************************************* -* Character Set Handling Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* Character Set Handling +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_CHARSET_H__ #define BOTAN_CHARSET_H__ @@ -23,9 +25,9 @@ enum Character_Set { namespace Charset { -/************************************************* -* Character Set Handling * -*************************************************/ +/* +* Character Set Handling +*/ std::string transcode(const std::string&, Character_Set, Character_Set); bool is_digit(char); diff --git a/src/utils/data_src.cpp b/src/utils/data_src.cpp index de5544885..4164a6dd3 100644 --- a/src/utils/data_src.cpp +++ b/src/utils/data_src.cpp @@ -1,8 +1,10 @@ -/************************************************* -* DataSource Source File * -* (C) 1999-2007 Jack Lloyd * -* 2005 Matthew Gregan * -*************************************************/ +/* +* DataSource +* (C) 1999-2007 Jack Lloyd +* 2005 Matthew Gregan +* +* Distributed under the terms of the Botan license +*/ #include <botan/data_src.h> #include <botan/exceptn.h> @@ -12,25 +14,25 @@ namespace Botan { -/************************************************* -* Read a single byte from the DataSource * -*************************************************/ +/* +* Read a single byte from the DataSource +*/ u32bit DataSource::read_byte(byte& out) { return read(&out, 1); } -/************************************************* -* Peek a single byte from the DataSource * -*************************************************/ +/* +* Peek a single byte from the DataSource +*/ u32bit DataSource::peek_byte(byte& out) const { return peek(&out, 1, 0); } -/************************************************* -* Discard the next N bytes of the data * -*************************************************/ +/* +* Discard the next N bytes of the data +*/ u32bit DataSource::discard_next(u32bit n) { u32bit discarded = 0; @@ -40,9 +42,9 @@ u32bit DataSource::discard_next(u32bit n) return discarded; } -/************************************************* -* Read from a memory buffer * -*************************************************/ +/* +* Read from a memory buffer +*/ u32bit DataSource_Memory::read(byte out[], u32bit length) { u32bit got = std::min(source.size() - offset, length); @@ -51,9 +53,9 @@ u32bit DataSource_Memory::read(byte out[], u32bit length) return got; } -/************************************************* -* Peek into a memory buffer * -*************************************************/ +/* +* Peek into a memory buffer +*/ u32bit DataSource_Memory::peek(byte out[], u32bit length, u32bit peek_offset) const { @@ -65,44 +67,44 @@ u32bit DataSource_Memory::peek(byte out[], u32bit length, return got; } -/************************************************* -* Check if the memory buffer is empty * -*************************************************/ +/* +* Check if the memory buffer is empty +*/ bool DataSource_Memory::end_of_data() const { return (offset == source.size()); } -/************************************************* -* DataSource_Memory Constructor * -*************************************************/ +/* +* DataSource_Memory Constructor +*/ DataSource_Memory::DataSource_Memory(const byte in[], u32bit length) { source.set(in, length); offset = 0; } -/************************************************* -* DataSource_Memory Constructor * -*************************************************/ +/* +* DataSource_Memory Constructor +*/ DataSource_Memory::DataSource_Memory(const MemoryRegion<byte>& in) { source = in; offset = 0; } -/************************************************* -* DataSource_Memory Constructor * -*************************************************/ +/* +* DataSource_Memory Constructor +*/ DataSource_Memory::DataSource_Memory(const std::string& in) { source.set(reinterpret_cast<const byte*>(in.data()), in.length()); offset = 0; } -/************************************************* -* Read from a stream * -*************************************************/ +/* +* Read from a stream +*/ u32bit DataSource_Stream::read(byte out[], u32bit length) { source->read(reinterpret_cast<char*>(out), length); @@ -114,9 +116,9 @@ u32bit DataSource_Stream::read(byte out[], u32bit length) return got; } -/************************************************* -* Peek into a stream * -*************************************************/ +/* +* Peek into a stream +*/ u32bit DataSource_Stream::peek(byte out[], u32bit length, u32bit offset) const { if(end_of_data()) @@ -148,25 +150,25 @@ u32bit DataSource_Stream::peek(byte out[], u32bit length, u32bit offset) const return got; } -/************************************************* -* Check if the stream is empty or in error * -*************************************************/ +/* +* Check if the stream is empty or in error +*/ bool DataSource_Stream::end_of_data() const { return (!source->good()); } -/************************************************* -* Return a human-readable ID for this stream * -*************************************************/ +/* +* Return a human-readable ID for this stream +*/ std::string DataSource_Stream::id() const { return identifier; } -/************************************************* -* DataSource_Stream Constructor * -*************************************************/ +/* +* DataSource_Stream Constructor +*/ DataSource_Stream::DataSource_Stream(const std::string& path, bool use_binary) : identifier(path), owner(true) @@ -182,9 +184,9 @@ DataSource_Stream::DataSource_Stream(const std::string& path, total_read = 0; } -/************************************************* -* DataSource_Stream Constructor * -*************************************************/ +/* +* DataSource_Stream Constructor +*/ DataSource_Stream::DataSource_Stream(std::istream& in, const std::string& name) : identifier(name), owner(false) @@ -193,9 +195,9 @@ DataSource_Stream::DataSource_Stream(std::istream& in, total_read = 0; } -/************************************************* -* DataSource_Stream Destructor * -*************************************************/ +/* +* DataSource_Stream Destructor +*/ DataSource_Stream::~DataSource_Stream() { if(owner) diff --git a/src/utils/data_src.h b/src/utils/data_src.h index 25bdce00f..e16217e0f 100644 --- a/src/utils/data_src.h +++ b/src/utils/data_src.h @@ -1,7 +1,9 @@ -/************************************************* -* DataSource Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* DataSource +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_DATA_SRC_H__ #define BOTAN_DATA_SRC_H__ diff --git a/src/utils/datastor.cpp b/src/utils/datastor.cpp index a2fda1a88..129dad9bf 100644 --- a/src/utils/datastor.cpp +++ b/src/utils/datastor.cpp @@ -1,7 +1,9 @@ -/************************************************* -* Data Store Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* Data Store +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/datastor.h> #include <botan/exceptn.h> @@ -11,9 +13,9 @@ namespace Botan { -/************************************************* -* Default Matcher transform operation (identity) * -*************************************************/ +/* +* Default Matcher transform operation (identity) +*/ std::pair<std::string, std::string> Data_Store::Matcher::transform(const std::string& key, const std::string& value) const @@ -21,25 +23,25 @@ Data_Store::Matcher::transform(const std::string& key, return std::make_pair(key, value); } -/************************************************* -* Data_Store Equality Comparison * -*************************************************/ +/* +* Data_Store Equality Comparison +*/ bool Data_Store::operator==(const Data_Store& other) const { return (contents == other.contents); } -/************************************************* -* Check if this key has at least one value * -*************************************************/ +/* +* Check if this key has at least one value +*/ bool Data_Store::has_value(const std::string& key) const { return (contents.lower_bound(key) != contents.end()); } -/************************************************* -* Search based on an arbitrary predicate * -*************************************************/ +/* +* Search based on an arbitrary predicate +*/ std::multimap<std::string, std::string> Data_Store::search_with(const Matcher& matcher) const { @@ -58,9 +60,9 @@ Data_Store::search_with(const Matcher& matcher) const return out; } -/************************************************* -* Search based on key equality * -*************************************************/ +/* +* Search based on key equality +*/ std::vector<std::string> Data_Store::get(const std::string& looking_for) const { typedef std::multimap<std::string, std::string>::const_iterator iter; @@ -73,9 +75,9 @@ std::vector<std::string> Data_Store::get(const std::string& looking_for) const return out; } -/************************************************* -* Get a single atom * -*************************************************/ +/* +* Get a single atom +*/ std::string Data_Store::get1(const std::string& key) const { std::vector<std::string> vals = get(key); @@ -88,9 +90,9 @@ std::string Data_Store::get1(const std::string& key) const return vals[0]; } -/************************************************* -* Get a single MemoryVector atom * -*************************************************/ +/* +* Get a single MemoryVector atom +*/ MemoryVector<byte> Data_Store::get1_memvec(const std::string& key) const { @@ -111,9 +113,9 @@ Data_Store::get1_memvec(const std::string& key) const return pipe.read_all(); } -/************************************************* -* Get a single u32bit atom * -*************************************************/ +/* +* Get a single u32bit atom +*/ u32bit Data_Store::get1_u32bit(const std::string& key, u32bit default_val) const { @@ -128,25 +130,25 @@ u32bit Data_Store::get1_u32bit(const std::string& key, return to_u32bit(vals[0]); } -/************************************************* -* Insert a single key and value * -*************************************************/ +/* +* Insert a single key and value +*/ void Data_Store::add(const std::string& key, const std::string& val) { multimap_insert(contents, key, val); } -/************************************************* -* Insert a single key and value * -*************************************************/ +/* +* Insert a single key and value +*/ void Data_Store::add(const std::string& key, u32bit val) { add(key, to_string(val)); } -/************************************************* -* Insert a single key and value * -*************************************************/ +/* +* Insert a single key and value +*/ void Data_Store::add(const std::string& key, const MemoryRegion<byte>& val) { Pipe pipe(new Hex_Encoder); @@ -154,9 +156,9 @@ void Data_Store::add(const std::string& key, const MemoryRegion<byte>& val) add(key, pipe.read_all_as_string()); } -/************************************************* -* Insert a mapping of key/value pairs * -*************************************************/ +/* +* Insert a mapping of key/value pairs +*/ void Data_Store::add(const std::multimap<std::string, std::string>& in) { std::multimap<std::string, std::string>::const_iterator i = in.begin(); diff --git a/src/utils/datastor.h b/src/utils/datastor.h index bb61688fc..7ee626fda 100644 --- a/src/utils/datastor.h +++ b/src/utils/datastor.h @@ -1,7 +1,9 @@ -/************************************************* -* Data Store Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* Data Store +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_DATA_STORE_H__ #define BOTAN_DATA_STORE_H__ diff --git a/src/utils/exceptn.cpp b/src/utils/exceptn.cpp index 29357afa5..753d63424 100644 --- a/src/utils/exceptn.cpp +++ b/src/utils/exceptn.cpp @@ -1,57 +1,59 @@ -/************************************************* -* Exceptions Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* Exceptions +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/exceptn.h> #include <botan/parsing.h> namespace Botan { -/************************************************* -* Constructor for Invalid_Key_Length * -*************************************************/ +/* +* Constructor for Invalid_Key_Length +*/ Invalid_Key_Length::Invalid_Key_Length(const std::string& name, u32bit length) { set_msg(name + " cannot accept a key of length " + to_string(length)); } -/************************************************* -* Constructor for Invalid_Block_Size * -*************************************************/ +/* +* Constructor for Invalid_Block_Size +*/ Invalid_Block_Size::Invalid_Block_Size(const std::string& mode, const std::string& pad) { set_msg("Padding method " + pad + " cannot be used with " + mode); } -/************************************************* -* Constructor for Invalid_IV_Length * -*************************************************/ +/* +* Constructor for Invalid_IV_Length +*/ Invalid_IV_Length::Invalid_IV_Length(const std::string& mode, u32bit bad_len) { set_msg("IV length " + to_string(bad_len) + " is invalid for " + mode); } -/************************************************* -* Constructor for Algorithm_Not_Found * -*************************************************/ +/* +* Constructor for Algorithm_Not_Found +*/ Algorithm_Not_Found::Algorithm_Not_Found(const std::string& name) { set_msg("Could not find any algorithm named \"" + name + "\""); } -/************************************************* -* Constructor for Invalid_Algorithm_Name * -*************************************************/ +/* +* Constructor for Invalid_Algorithm_Name +*/ Invalid_Algorithm_Name::Invalid_Algorithm_Name(const std::string& name) { set_msg("Invalid algorithm name: " + name); } -/************************************************* -* Constructor for Config_Error * -*************************************************/ +/* +* Constructor for Config_Error +*/ Config_Error::Config_Error(const std::string& err, u32bit line) { set_msg("Config error at line " + to_string(line) + ": " + err); diff --git a/src/utils/exceptn.h b/src/utils/exceptn.h index 3bfec2fd2..a55d842bc 100644 --- a/src/utils/exceptn.h +++ b/src/utils/exceptn.h @@ -1,7 +1,9 @@ -/************************************************* -* Exceptions Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* Exceptions +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_EXCEPTION_H__ #define BOTAN_EXCEPTION_H__ @@ -12,9 +14,9 @@ namespace Botan { -/************************************************* -* Exception Base Class * -*************************************************/ +/* +* Exception Base Class +*/ class BOTAN_DLL Exception : public std::exception { public: @@ -27,135 +29,135 @@ class BOTAN_DLL Exception : public std::exception std::string msg; }; -/************************************************* -* Invalid_Argument Exception * -*************************************************/ +/* +* Invalid_Argument Exception +*/ struct BOTAN_DLL Invalid_Argument : public Exception { Invalid_Argument(const std::string& err = "") : Exception(err) {} }; -/************************************************* -* Invalid_Key_Length Exception * -*************************************************/ +/* +* Invalid_Key_Length Exception +*/ struct BOTAN_DLL Invalid_Key_Length : public Invalid_Argument { Invalid_Key_Length(const std::string&, u32bit); }; -/************************************************* -* Invalid_Block_Size Exception * -*************************************************/ +/* +* Invalid_Block_Size Exception +*/ struct BOTAN_DLL Invalid_Block_Size : public Invalid_Argument { Invalid_Block_Size(const std::string&, const std::string&); }; -/************************************************* -* Invalid_IV_Length Exception * -*************************************************/ +/* +* Invalid_IV_Length Exception +*/ struct BOTAN_DLL Invalid_IV_Length : public Invalid_Argument { Invalid_IV_Length(const std::string&, u32bit); }; -/************************************************* -* Invalid_State Exception * -*************************************************/ +/* +* Invalid_State Exception +*/ struct BOTAN_DLL Invalid_State : public Exception { Invalid_State(const std::string& err) : Exception(err) {} }; -/************************************************* -* PRNG_Unseeded Exception * -*************************************************/ +/* +* PRNG_Unseeded Exception +*/ struct BOTAN_DLL PRNG_Unseeded : public Invalid_State { PRNG_Unseeded(const std::string& algo) : Invalid_State("PRNG not seeded: " + algo) {} }; -/************************************************* -* Policy_Violation Exception * -*************************************************/ +/* +* Policy_Violation Exception +*/ struct BOTAN_DLL Policy_Violation : public Invalid_State { Policy_Violation(const std::string& err) : Invalid_State("Policy violation: " + err) {} }; -/************************************************* -* Lookup_Error Exception * -*************************************************/ +/* +* Lookup_Error Exception +*/ struct BOTAN_DLL Lookup_Error : public Exception { Lookup_Error(const std::string& err) : Exception(err) {} }; -/************************************************* -* Algorithm_Not_Found Exception * -*************************************************/ +/* +* Algorithm_Not_Found Exception +*/ struct BOTAN_DLL Algorithm_Not_Found : public Exception { Algorithm_Not_Found(const std::string&); }; -/************************************************* -* Format_Error Exception * -*************************************************/ +/* +* Format_Error Exception +*/ struct BOTAN_DLL Format_Error : public Exception { Format_Error(const std::string& err = "") : Exception(err) {} }; -/************************************************* -* Invalid_Algorithm_Name Exception * -*************************************************/ +/* +* Invalid_Algorithm_Name Exception +*/ struct BOTAN_DLL Invalid_Algorithm_Name : public Format_Error { Invalid_Algorithm_Name(const std::string&); }; -/************************************************* -* Encoding_Error Exception * -*************************************************/ +/* +* Encoding_Error Exception +*/ struct BOTAN_DLL Encoding_Error : public Format_Error { Encoding_Error(const std::string& name) : Format_Error("Encoding error: " + name) {} }; -/************************************************* -* Decoding_Error Exception * -*************************************************/ +/* +* Decoding_Error Exception +*/ struct BOTAN_DLL Decoding_Error : public Format_Error { Decoding_Error(const std::string& name) : Format_Error("Decoding error: " + name) {} }; -/************************************************* -* Invalid_OID Exception * -*************************************************/ +/* +* Invalid_OID Exception +*/ struct BOTAN_DLL Invalid_OID : public Decoding_Error { Invalid_OID(const std::string& oid) : Decoding_Error("Invalid ASN.1 OID: " + oid) {} }; -/************************************************* -* Stream_IO_Error Exception * -*************************************************/ +/* +* Stream_IO_Error Exception +*/ struct BOTAN_DLL Stream_IO_Error : public Exception { Stream_IO_Error(const std::string& err) : Exception("I/O error: " + err) {} }; -/************************************************* -* Configuration Error Exception * -*************************************************/ +/* +* Configuration Error Exception +*/ struct BOTAN_DLL Config_Error : public Format_Error { Config_Error(const std::string& err) : @@ -163,27 +165,27 @@ struct BOTAN_DLL Config_Error : public Format_Error Config_Error(const std::string&, u32bit); }; -/************************************************* -* Integrity Failure Exception * -*************************************************/ +/* +* Integrity Failure Exception +*/ struct BOTAN_DLL Integrity_Failure : public Exception { Integrity_Failure(const std::string& err) : Exception("Integrity failure: " + err) {} }; -/************************************************* -* Internal_Error Exception * -*************************************************/ +/* +* Internal_Error Exception +*/ struct BOTAN_DLL Internal_Error : public Exception { Internal_Error(const std::string& err) : Exception("Internal error: " + err) {} }; -/************************************************* -* Self Test Failure Exception * -*************************************************/ +/* +* Self Test Failure Exception +*/ struct BOTAN_DLL Self_Test_Failure : public Internal_Error { Self_Test_Failure(const std::string& err) : diff --git a/src/utils/loadstor.h b/src/utils/loadstor.h index 0bcafe411..77ed1554e 100644 --- a/src/utils/loadstor.h +++ b/src/utils/loadstor.h @@ -1,8 +1,10 @@ -/************************************************* -* Load/Store Operators Header File * -* (C) 1999-2007 Jack Lloyd * -* 2007 Yves Jerschow * -*************************************************/ +/* +* Load/Store Operators +* (C) 1999-2007 Jack Lloyd +* 2007 Yves Jerschow +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_LOAD_STORE_H__ #define BOTAN_LOAD_STORE_H__ @@ -35,17 +37,17 @@ namespace Botan { -/************************************************* -* Byte Extraction Function * -*************************************************/ +/* +* Byte Extraction Function +*/ template<typename T> inline byte get_byte(u32bit byte_num, T input) { return (input >> ((sizeof(T)-1-(byte_num&(sizeof(T)-1))) << 3)); } -/************************************************* -* Byte to Word Conversions * -*************************************************/ +/* +* Byte to Word Conversions +*/ inline u16bit make_u16bit(byte i0, byte i1) { return ((static_cast<u16bit>(i0) << 8) | i1); @@ -72,9 +74,9 @@ inline u64bit make_u64bit(byte i0, byte i1, byte i2, byte i3, (static_cast<u64bit>(i7))); } -/************************************************* -* Endian-Specific Word Loading Operations * -*************************************************/ +/* +* Endian-Specific Word Loading Operations +*/ template<typename T> inline T load_be(const byte in[], u32bit off) { @@ -163,9 +165,9 @@ inline u64bit load_le<u64bit>(const byte in[], u32bit off) #endif } -/************************************************* -* Endian-Specific Word Storing Operations * -*************************************************/ +/* +* Endian-Specific Word Storing Operations +*/ inline void store_be(u16bit in, byte out[2]) { #if BOTAN_TARGET_UNALIGNED_LOADSTOR_OK diff --git a/src/utils/mem_ops.h b/src/utils/mem_ops.h index e72269e6a..f6557c744 100644 --- a/src/utils/mem_ops.h +++ b/src/utils/mem_ops.h @@ -1,6 +1,8 @@ /* -* Memory Operations Header File +* Memory Operations * (C) 1999-2009 Jack Lloyd +* +* Distributed under the terms of the Botan license */ #ifndef BOTAN_MEMORY_OPS_H__ diff --git a/src/utils/mlock.cpp b/src/utils/mlock.cpp index 12947709d..9bb062da5 100644 --- a/src/utils/mlock.cpp +++ b/src/utils/mlock.cpp @@ -1,7 +1,9 @@ -/************************************************* -* Memory Locking Functions Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* Memory Locking Functions +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/util.h> @@ -14,9 +16,9 @@ namespace Botan { -/************************************************* -* Lock an area of memory into RAM * -*************************************************/ +/* +* Lock an area of memory into RAM +*/ bool lock_mem(void* ptr, u32bit bytes) { #if defined(BOTAN_TARGET_OS_HAS_POSIX_MLOCK) @@ -28,9 +30,9 @@ bool lock_mem(void* ptr, u32bit bytes) #endif } -/************************************************* -* Unlock a previously locked region of memory * -*************************************************/ +/* +* Unlock a previously locked region of memory +*/ void unlock_mem(void* ptr, u32bit bytes) { #if defined(BOTAN_TARGET_OS_HAS_POSIX_MLOCK) diff --git a/src/utils/mutex.h b/src/utils/mutex.h index e30b48eb0..a04ff83c9 100644 --- a/src/utils/mutex.h +++ b/src/utils/mutex.h @@ -1,7 +1,9 @@ -/************************************************* -* Mutex Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* Mutex +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_MUTEX_H__ #define BOTAN_MUTEX_H__ @@ -10,9 +12,9 @@ namespace Botan { -/************************************************* -* Mutex Base Class * -*************************************************/ +/* +* Mutex Base Class +*/ class BOTAN_DLL Mutex { public: @@ -21,9 +23,9 @@ class BOTAN_DLL Mutex virtual ~Mutex() {} }; -/************************************************* -* Mutex Factory * -*************************************************/ +/* +* Mutex Factory +*/ class BOTAN_DLL Mutex_Factory { public: @@ -31,9 +33,9 @@ class BOTAN_DLL Mutex_Factory virtual ~Mutex_Factory() {} }; -/************************************************* -* Mutex Holding Class * -*************************************************/ +/* +* Mutex Holding Class +*/ class BOTAN_DLL Mutex_Holder { public: diff --git a/src/utils/parsing.cpp b/src/utils/parsing.cpp index 550cd3586..bdb9e79dc 100644 --- a/src/utils/parsing.cpp +++ b/src/utils/parsing.cpp @@ -1,7 +1,9 @@ -/************************************************* -* Parser Functions Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* Parser Functions +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/parsing.h> #include <botan/exceptn.h> @@ -10,9 +12,9 @@ namespace Botan { -/************************************************* -* Convert a string into an integer * -*************************************************/ +/* +* Convert a string into an integer +*/ u32bit to_u32bit(const std::string& number) { u32bit n = 0; @@ -31,9 +33,9 @@ u32bit to_u32bit(const std::string& number) return n; } -/************************************************* -* Convert an integer into a string * -*************************************************/ +/* +* Convert an integer into a string +*/ std::string to_string(u64bit n, u32bit min_len) { std::string lenstr; @@ -54,9 +56,9 @@ std::string to_string(u64bit n, u32bit min_len) return lenstr; } -/************************************************* -* Convert a string into a time duration * -*************************************************/ +/* +* Convert a string into a time duration +*/ u32bit timespec_to_u32bit(const std::string& timespec) { if(timespec == "") @@ -85,9 +87,9 @@ u32bit timespec_to_u32bit(const std::string& timespec) return scale * to_u32bit(value); } -/************************************************* -* Parse a SCAN-style algorithm name * -*************************************************/ +/* +* Parse a SCAN-style algorithm name +*/ std::vector<std::string> parse_algorithm_name(const std::string& namex) { if(namex.find('(') == std::string::npos && @@ -141,9 +143,9 @@ std::vector<std::string> parse_algorithm_name(const std::string& namex) return elems; } -/************************************************* -* Split the string on slashes * -*************************************************/ +/* +* Split the string on slashes +*/ std::vector<std::string> split_on(const std::string& str, char delim) { std::vector<std::string> elems; @@ -169,9 +171,9 @@ std::vector<std::string> split_on(const std::string& str, char delim) return elems; } -/************************************************* -* Parse an ASN.1 OID string * -*************************************************/ +/* +* Parse an ASN.1 OID string +*/ std::vector<u32bit> parse_asn1_oid(const std::string& oid) { std::string substring; @@ -202,9 +204,9 @@ std::vector<u32bit> parse_asn1_oid(const std::string& oid) return oid_elems; } -/************************************************* -* X.500 String Comparison * -*************************************************/ +/* +* X.500 String Comparison +*/ bool x500_name_cmp(const std::string& name1, const std::string& name2) { std::string::const_iterator p1 = name1.begin(); @@ -241,9 +243,9 @@ bool x500_name_cmp(const std::string& name1, const std::string& name2) return true; } -/************************************************* -* Convert a decimal-dotted string to binary IP * -*************************************************/ +/* +* Convert a decimal-dotted string to binary IP +*/ u32bit string_to_ipv4(const std::string& str) { std::vector<std::string> parts = split_on(str, '.'); @@ -266,9 +268,9 @@ u32bit string_to_ipv4(const std::string& str) return ip; } -/************************************************* -* Convert an IP address to decimal-dotted string * -*************************************************/ +/* +* Convert an IP address to decimal-dotted string +*/ std::string ipv4_to_string(u32bit ip) { std::string str; diff --git a/src/utils/parsing.h b/src/utils/parsing.h index aedfd1cbc..2c29d5b4d 100644 --- a/src/utils/parsing.h +++ b/src/utils/parsing.h @@ -1,7 +1,9 @@ -/************************************************* -* Parser Functions Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* Parser Functions +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_PARSER_H__ #define BOTAN_PARSER_H__ @@ -12,25 +14,25 @@ namespace Botan { -/************************************************* -* String Parsing Functions * -*************************************************/ +/* +* String Parsing Functions +*/ BOTAN_DLL std::vector<std::string> parse_algorithm_name(const std::string&); BOTAN_DLL std::vector<std::string> split_on(const std::string&, char); BOTAN_DLL std::vector<u32bit> parse_asn1_oid(const std::string&); BOTAN_DLL bool x500_name_cmp(const std::string&, const std::string&); -/************************************************* -* String/Integer Conversions * -*************************************************/ +/* +* String/Integer Conversions +*/ BOTAN_DLL std::string to_string(u64bit, u32bit = 0); BOTAN_DLL u32bit to_u32bit(const std::string&); BOTAN_DLL u32bit timespec_to_u32bit(const std::string& timespec); -/************************************************* -* String/Network Address Conversions * -*************************************************/ +/* +* String/Network Address Conversions +*/ BOTAN_DLL u32bit string_to_ipv4(const std::string&); BOTAN_DLL std::string ipv4_to_string(u32bit); diff --git a/src/utils/rotate.h b/src/utils/rotate.h index d90e207b5..c8f8d4a1a 100644 --- a/src/utils/rotate.h +++ b/src/utils/rotate.h @@ -1,7 +1,9 @@ -/************************************************* -* Word Rotation Operations Header File * -* (C) 1999-2008 Jack Lloyd * -*************************************************/ +/* +* Word Rotation Operations +* (C) 1999-2008 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_WORD_ROTATE_H__ #define BOTAN_WORD_ROTATE_H__ @@ -10,9 +12,9 @@ namespace Botan { -/************************************************* -* Word Rotation Functions * -*************************************************/ +/* +* Word Rotation Functions +*/ template<typename T> inline T rotate_left(T input, u32bit rot) { return static_cast<T>((input << rot) | (input >> (8*sizeof(T)-rot)));; diff --git a/src/utils/scan_name.cpp b/src/utils/scan_name.cpp index c0e931e14..b867a0462 100644 --- a/src/utils/scan_name.cpp +++ b/src/utils/scan_name.cpp @@ -1,6 +1,8 @@ /** SCAN Name Abstraction (C) 2008 Jack Lloyd +* +* Distributed under the terms of the Botan license */ #include <botan/scan_name.h> diff --git a/src/utils/scan_name.h b/src/utils/scan_name.h index 4e391c37d..5607599dc 100644 --- a/src/utils/scan_name.h +++ b/src/utils/scan_name.h @@ -1,6 +1,8 @@ /** SCAN Name Abstraction (C) 2008 Jack Lloyd +* +* Distributed under the terms of the Botan license */ #ifndef BOTAN_SCAN_NAME_H__ diff --git a/src/utils/secmem.h b/src/utils/secmem.h index 8e353a68b..34dec0e9d 100644 --- a/src/utils/secmem.h +++ b/src/utils/secmem.h @@ -1,7 +1,9 @@ -/************************************************* -* Secure Memory Buffers Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* Secure Memory Buffers +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_SECURE_MEMORY_BUFFERS_H__ #define BOTAN_SECURE_MEMORY_BUFFERS_H__ @@ -226,9 +228,9 @@ class MemoryRegion Allocator* alloc; }; -/************************************************* -* Create a new buffer * -*************************************************/ +/* +* Create a new buffer +*/ template<typename T> void MemoryRegion<T>::create(u32bit n) { @@ -238,9 +240,9 @@ void MemoryRegion<T>::create(u32bit n) allocated = used = n; } -/************************************************* -* Increase the size of the buffer * -*************************************************/ +/* +* Increase the size of the buffer +*/ template<typename T> void MemoryRegion<T>::grow_to(u32bit n) { @@ -260,9 +262,9 @@ void MemoryRegion<T>::grow_to(u32bit n) } } -/************************************************* -* Compare this buffer with another one * -*************************************************/ +/* +* Compare this buffer with another one +*/ template<typename T> bool MemoryRegion<T>::operator<(const MemoryRegion<T>& in) const { @@ -278,9 +280,9 @@ bool MemoryRegion<T>::operator<(const MemoryRegion<T>& in) const return false; } -/************************************************* -* Swap this buffer with another one * -*************************************************/ +/* +* Swap this buffer with another one +*/ template<typename T> void MemoryRegion<T>::swap(MemoryRegion<T>& x) { @@ -309,7 +311,7 @@ class MemoryVector : public MemoryRegion<T> /** * Create a buffer of the specified length. * @param n the length of the buffer to create. - * + */ MemoryVector(u32bit n = 0) { MemoryRegion<T>::init(false, n); } @@ -361,7 +363,7 @@ class SecureVector : public MemoryRegion<T> /** * Create a buffer of the specified length. * @param n the length of the buffer to create. - * + */ SecureVector(u32bit n = 0) { MemoryRegion<T>::init(true, n); } diff --git a/src/utils/stl_util.h b/src/utils/stl_util.h index 95a19581f..18c8b149b 100644 --- a/src/utils/stl_util.h +++ b/src/utils/stl_util.h @@ -1,7 +1,9 @@ -/************************************************* -* STL Utility Functions Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* STL Utility Functions +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_STL_UTIL_H__ #define BOTAN_STL_UTIL_H__ @@ -10,9 +12,9 @@ namespace Botan { -/************************************************* -* Copy-on-Predicate Algorithm * -*************************************************/ +/* +* Copy-on-Predicate Algorithm +*/ template<typename InputIterator, typename OutputIterator, typename Predicate> OutputIterator copy_if(InputIterator current, InputIterator end, OutputIterator dest, Predicate copy_p) @@ -26,9 +28,9 @@ OutputIterator copy_if(InputIterator current, InputIterator end, return dest; } -/************************************************* -* Searching through a std::map * -*************************************************/ +/* +* Searching through a std::map +*/ template<typename K, typename V> inline V search_map(const std::map<K, V>& mapping, const K& key, @@ -50,9 +52,9 @@ inline R search_map(const std::map<K, V>& mapping, const K& key, return found_result; } -/************************************************* -* Function adaptor for delete operation * -*************************************************/ +/* +* Function adaptor for delete operation +*/ template<class T> class del_fun : public std::unary_function<T, void> { @@ -60,18 +62,18 @@ class del_fun : public std::unary_function<T, void> void operator()(T* ptr) { delete ptr; } }; -/************************************************* -* Delete the second half of a pair of objects * -*************************************************/ +/* +* Delete the second half of a pair of objects +*/ template<typename Pair> void delete2nd(Pair& pair) { delete pair.second; } -/************************************************* -* Insert a key/value pair into a multimap * -*************************************************/ +/* +* Insert a key/value pair into a multimap +*/ template<typename K, typename V> void multimap_insert(std::multimap<K, V>& multimap, const K& key, const V& value) diff --git a/src/utils/types.h b/src/utils/types.h index 6c435952a..304628d02 100644 --- a/src/utils/types.h +++ b/src/utils/types.h @@ -1,7 +1,9 @@ -/************************************************* -* Low Level Types Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* Low Level Types +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_TYPES_H__ #define BOTAN_TYPES_H__ diff --git a/src/utils/ui.cpp b/src/utils/ui.cpp index fb81ae23c..e6c3430ff 100644 --- a/src/utils/ui.cpp +++ b/src/utils/ui.cpp @@ -1,15 +1,17 @@ -/************************************************* -* User Interface Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* User Interface +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/ui.h> namespace Botan { -/************************************************* -* Get a passphrase from the user * -*************************************************/ +/* +* Get a passphrase from the user +*/ std::string User_Interface::get_passphrase(const std::string&, const std::string&, UI_Result& action) const @@ -22,9 +24,9 @@ std::string User_Interface::get_passphrase(const std::string&, return preset_passphrase; } -/************************************************* -* User_Interface Constructor * -*************************************************/ +/* +* User_Interface Constructor +*/ User_Interface::User_Interface(const std::string& preset) : preset_passphrase(preset) { diff --git a/src/utils/ui.h b/src/utils/ui.h index f66ac3e56..fe62c60fc 100644 --- a/src/utils/ui.h +++ b/src/utils/ui.h @@ -1,7 +1,9 @@ -/************************************************* -* User Interface Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* User Interface +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_UI_H__ #define BOTAN_UI_H__ @@ -11,9 +13,9 @@ namespace Botan { -/************************************************* -* User Interface * -*************************************************/ +/* +* User Interface +*/ class BOTAN_DLL User_Interface { public: diff --git a/src/utils/util.cpp b/src/utils/util.cpp index f8b98fcb8..e6e281bd1 100644 --- a/src/utils/util.cpp +++ b/src/utils/util.cpp @@ -1,7 +1,9 @@ -/************************************************* -* Utility Functions Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* Utility Functions +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/util.h> #include <botan/bit_ops.h> @@ -10,9 +12,9 @@ namespace Botan { -/************************************************* -* Round up n to multiple of align_to * -*************************************************/ +/* +* Round up n to multiple of align_to +*/ u32bit round_up(u32bit n, u32bit align_to) { if(n % align_to || n == 0) @@ -20,17 +22,17 @@ u32bit round_up(u32bit n, u32bit align_to) return n; } -/************************************************* -* Round down n to multiple of align_to * -*************************************************/ +/* +* Round down n to multiple of align_to +*/ u32bit round_down(u32bit n, u32bit align_to) { return (n - (n % align_to)); } -/************************************************* +/* * Choose the exponent size for a DL group -*************************************************/ +*/ u32bit dl_work_factor(u32bit bits) { #if 0 diff --git a/src/utils/util.h b/src/utils/util.h index d0e2e110a..ac7867390 100644 --- a/src/utils/util.h +++ b/src/utils/util.h @@ -1,7 +1,9 @@ -/************************************************* -* Utility Functions Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* Utility Functions +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_UTIL_H__ #define BOTAN_UTIL_H__ @@ -10,26 +12,26 @@ namespace Botan { -/************************************************* -* Time Access Functions * -*************************************************/ +/* +* Time Access Functions +*/ BOTAN_DLL u64bit system_time(); -/************************************************* -* Memory Locking Functions * -*************************************************/ +/* +* Memory Locking Functions +*/ BOTAN_DLL bool lock_mem(void*, u32bit); BOTAN_DLL void unlock_mem(void*, u32bit); -/************************************************* -* Misc Utility Functions * -*************************************************/ +/* +* Misc Utility Functions +*/ BOTAN_DLL u32bit round_up(u32bit, u32bit); BOTAN_DLL u32bit round_down(u32bit, u32bit); -/************************************************* -* Work Factor Estimates * -*************************************************/ +/* +* Work Factor Estimates +*/ BOTAN_DLL u32bit dl_work_factor(u32bit); } diff --git a/src/utils/version.cpp b/src/utils/version.cpp index 3deed3149..d540864b2 100644 --- a/src/utils/version.cpp +++ b/src/utils/version.cpp @@ -1,7 +1,9 @@ -/************************************************* -* Version Information Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* Version Information +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/version.h> #include <botan/parsing.h> @@ -14,9 +16,9 @@ namespace Botan { version they are running against. */ -/************************************************* -* Return the version as a string * -*************************************************/ +/* +* Return the version as a string +*/ std::string version_string() { return to_string(version_major()) + "." + @@ -24,9 +26,9 @@ std::string version_string() to_string(version_patch()); } -/************************************************* -* Return parts of the version as integers * -*************************************************/ +/* +* Return parts of the version as integers +*/ u32bit version_major() { return BOTAN_VERSION_MAJOR; } u32bit version_minor() { return BOTAN_VERSION_MINOR; } u32bit version_patch() { return BOTAN_VERSION_PATCH; } diff --git a/src/utils/version.h b/src/utils/version.h index 2fc28544c..3cc44e806 100644 --- a/src/utils/version.h +++ b/src/utils/version.h @@ -1,7 +1,9 @@ -/************************************************* -* Version Information Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* Version Information +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #ifndef BOTAN_VERSION_H__ #define BOTAN_VERSION_H__ @@ -11,9 +13,9 @@ namespace Botan { -/************************************************* -* Get information describing the version * -*************************************************/ +/* +* Get information describing the version +*/ /** * Get the version string identifying the version of Botan. @@ -39,9 +41,9 @@ BOTAN_DLL u32bit version_minor(); */ BOTAN_DLL u32bit version_patch(); -/************************************************* -* Macros for compile-time version checks * -*************************************************/ +/* +* Macros for compile-time version checks +*/ #define BOTAN_VERSION_CODE_FOR(a,b,c) ((a << 16) | (b << 8) | (c)) /** diff --git a/src/utils/xor_buf.h b/src/utils/xor_buf.h index 2bf6ced59..39781f017 100644 --- a/src/utils/xor_buf.h +++ b/src/utils/xor_buf.h @@ -1,6 +1,8 @@ /** * XOR operations * (C) 1999-2008 Jack Lloyd +* +* Distributed under the terms of the Botan license */ #ifndef BOTAN_XOR_BUF_H__ |