aboutsummaryrefslogtreecommitdiffstats
path: root/src/codec/pem
diff options
context:
space:
mode:
authorlloyd <[email protected]>2010-10-12 15:45:16 +0000
committerlloyd <[email protected]>2010-10-12 15:45:16 +0000
commita263ae6b9cfb5e93e3f446bd736ab3f86ba3c681 (patch)
tree31076d3432d35ea24c235c2b8064d5c86d7665c0 /src/codec/pem
parent18a58396b7bb2925a33c57b17f1820b386b54c2d (diff)
s/u32bit/size_t/ in codec and benchmark
Diffstat (limited to 'src/codec/pem')
-rw-r--r--src/codec/pem/pem.cpp18
-rw-r--r--src/codec/pem/pem.h8
2 files changed, 13 insertions, 13 deletions
diff --git a/src/codec/pem/pem.cpp b/src/codec/pem/pem.cpp
index 1fe5910f3..005ec7310 100644
--- a/src/codec/pem/pem.cpp
+++ b/src/codec/pem/pem.cpp
@@ -16,8 +16,8 @@ namespace PEM_Code {
/*
* PEM encode BER/DER-encoded objects
*/
-std::string encode(const byte der[], u32bit length, const std::string& label,
- u32bit width)
+std::string encode(const byte der[], size_t length, const std::string& label,
+ size_t width)
{
const std::string PEM_HEADER = "-----BEGIN " + label + "-----\n";
const std::string PEM_TRAILER = "-----END " + label + "-----\n";
@@ -31,7 +31,7 @@ std::string encode(const byte der[], u32bit length, const std::string& label,
* PEM encode BER/DER-encoded objects
*/
std::string encode(const MemoryRegion<byte>& data, const std::string& label,
- u32bit width)
+ size_t width)
{
return encode(&data[0], data.size(), label, width);
}
@@ -55,11 +55,11 @@ SecureVector<byte> decode_check_label(DataSource& source,
*/
SecureVector<byte> decode(DataSource& source, std::string& label)
{
- const u32bit RANDOM_CHAR_LIMIT = 8;
+ const size_t RANDOM_CHAR_LIMIT = 8;
const std::string PEM_HEADER1 = "-----BEGIN ";
const std::string PEM_HEADER2 = "-----";
- u32bit position = 0;
+ size_t position = 0;
while(position != PEM_HEADER1.length())
{
@@ -114,19 +114,19 @@ SecureVector<byte> decode(DataSource& source, std::string& label)
* Search for a PEM signature
*/
bool matches(DataSource& source, const std::string& extra,
- u32bit search_range)
+ size_t search_range)
{
const std::string PEM_HEADER = "-----BEGIN " + extra;
SecureVector<byte> search_buf(search_range);
- u32bit got = source.peek(&search_buf[0], search_buf.size(), 0);
+ size_t got = source.peek(&search_buf[0], search_buf.size(), 0);
if(got < PEM_HEADER.length())
return false;
- u32bit index = 0;
+ size_t index = 0;
- for(u32bit j = 0; j != got; ++j)
+ for(size_t j = 0; j != got; ++j)
{
if(search_buf[j] == PEM_HEADER[index])
++index;
diff --git a/src/codec/pem/pem.h b/src/codec/pem/pem.h
index 9fe8acb87..d15bfe978 100644
--- a/src/codec/pem/pem.h
+++ b/src/codec/pem/pem.h
@@ -17,16 +17,16 @@ namespace PEM_Code {
/*
* PEM Encoding/Decoding
*/
-BOTAN_DLL std::string encode(const byte[], u32bit,
- const std::string&, u32bit = 64);
+BOTAN_DLL std::string encode(const byte[], size_t,
+ const std::string&, size_t = 64);
BOTAN_DLL std::string encode(const MemoryRegion<byte>&,
- const std::string&, u32bit = 64);
+ const std::string&, size_t = 64);
BOTAN_DLL SecureVector<byte> decode(DataSource&, std::string&);
BOTAN_DLL SecureVector<byte> decode_check_label(DataSource&,
const std::string&);
BOTAN_DLL bool matches(DataSource&, const std::string& = "",
- u32bit search_range = 4096);
+ size_t search_range = 4096);
}