diff options
Diffstat (limited to 'src/utils')
32 files changed, 564 insertions, 500 deletions
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__ |