diff options
author | lloyd <lloyd@randombit.net> | 2009-03-30 18:27:18 +0000 |
---|---|---|
committer | lloyd <lloyd@randombit.net> | 2009-03-30 18:27:18 +0000 |
commit | 96d6eb6f29c55e16a37cf11899547886f735b065 (patch) | |
tree | 9f13901e9b44c98d58b2589c9b09c6a7443eb7cd /src/codec | |
parent | 3cc3dd72c5f87b76852a55c1f2d1821dba967d8c (diff) |
Thomas Moschny passed along a request from the Fedora packagers which came
up during the Fedora submission review, that each source file include some
text about the license. One handy Perl script later and each file now has
the line
Distributed under the terms of the Botan license
after the copyright notices.
While I was in there modifying every file anyway, I also stripped out the
remainder of the block comments (lots of astericks before and after the
text); this is stylistic thing I picked up when I was first learning C++
but in retrospect it is not a good style as the structure makes it harder
to modify comments (with the result that comments become fewer, shorter and
are less likely to be updated, which are not good things).
Diffstat (limited to 'src/codec')
-rw-r--r-- | src/codec/base64/b64_char.cpp | 22 | ||||
-rw-r--r-- | src/codec/base64/base64.cpp | 88 | ||||
-rw-r--r-- | src/codec/base64/base64.h | 10 | ||||
-rw-r--r-- | src/codec/bzip2/bzip2.cpp | 104 | ||||
-rw-r--r-- | src/codec/bzip2/bzip2.h | 24 | ||||
-rw-r--r-- | src/codec/hex/hex.cpp | 88 | ||||
-rw-r--r-- | src/codec/hex/hex.h | 10 | ||||
-rw-r--r-- | src/codec/hex/hex_char.cpp | 22 | ||||
-rw-r--r-- | src/codec/openpgp/openpgp.cpp | 34 | ||||
-rw-r--r-- | src/codec/openpgp/openpgp.h | 16 | ||||
-rw-r--r-- | src/codec/pem/pem.cpp | 40 | ||||
-rw-r--r-- | src/codec/pem/pem.h | 16 | ||||
-rw-r--r-- | src/codec/zlib/zlib.cpp | 104 | ||||
-rw-r--r-- | src/codec/zlib/zlib.h | 24 |
14 files changed, 315 insertions, 287 deletions
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: |