aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/utils
diff options
context:
space:
mode:
authorJack Lloyd <[email protected]>2016-12-11 15:28:38 -0500
committerJack Lloyd <[email protected]>2016-12-18 16:48:24 -0500
commitf3cb3edb512bdcab498d825886c3366c341b3f78 (patch)
tree645c73ec295a5a34f25d99903b6d9fa9751e86d3 /src/lib/utils
parentc1dd21253c1f3188ff45d3ad47698efd08235ae8 (diff)
Convert to using standard uintN_t integer types
Renames a couple of functions for somewhat better name consistency, eg make_u32bit becomes make_uint32. The old typedefs remain for now since probably lots of application code uses them.
Diffstat (limited to 'src/lib/utils')
-rw-r--r--src/lib/utils/bit_ops.h2
-rw-r--r--src/lib/utils/bswap.h16
-rw-r--r--src/lib/utils/calendar.h14
-rw-r--r--src/lib/utils/charset.cpp16
-rw-r--r--src/lib/utils/charset.h4
-rw-r--r--src/lib/utils/cpuid.cpp36
-rw-r--r--src/lib/utils/cpuid.h2
-rw-r--r--src/lib/utils/ct_utils.h4
-rw-r--r--src/lib/utils/data_src.cpp20
-rw-r--r--src/lib/utils/data_src.h24
-rw-r--r--src/lib/utils/database.h6
-rw-r--r--src/lib/utils/datastor/datastor.cpp19
-rw-r--r--src/lib/utils/datastor/datastor.h10
-rw-r--r--src/lib/utils/donna128.h36
-rw-r--r--src/lib/utils/http_util/http_util.cpp14
-rw-r--r--src/lib/utils/http_util/http_util.h12
-rw-r--r--src/lib/utils/loadstor.h204
-rw-r--r--src/lib/utils/locking_allocator/locking_allocator.cpp4
-rw-r--r--src/lib/utils/locking_allocator/locking_allocator.h2
-rw-r--r--src/lib/utils/mem_ops.cpp2
-rw-r--r--src/lib/utils/mem_ops.h16
-rw-r--r--src/lib/utils/mul128.h22
-rw-r--r--src/lib/utils/os_utils.cpp4
-rw-r--r--src/lib/utils/parsing.cpp20
-rw-r--r--src/lib/utils/parsing.h10
-rw-r--r--src/lib/utils/simd/simd_32.h18
-rw-r--r--src/lib/utils/sqlite3/sqlite3.cpp8
-rw-r--r--src/lib/utils/sqlite3/sqlite3.h6
-rw-r--r--src/lib/utils/stl_util.h6
-rw-r--r--src/lib/utils/types.h5
-rw-r--r--src/lib/utils/version.cpp14
-rw-r--r--src/lib/utils/version.h14
32 files changed, 297 insertions, 293 deletions
diff --git a/src/lib/utils/bit_ops.h b/src/lib/utils/bit_ops.h
index 5e8821593..b7ee94125 100644
--- a/src/lib/utils/bit_ops.h
+++ b/src/lib/utils/bit_ops.h
@@ -79,7 +79,7 @@ inline size_t significant_bytes(T n)
template<typename T>
inline size_t hamming_weight(T n)
{
- const byte NIBBLE_WEIGHTS[] = {
+ const uint8_t NIBBLE_WEIGHTS[] = {
0, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 4 };
size_t weight = 0;
diff --git a/src/lib/utils/bswap.h b/src/lib/utils/bswap.h
index beb3f9555..b55445f59 100644
--- a/src/lib/utils/bswap.h
+++ b/src/lib/utils/bswap.h
@@ -21,7 +21,7 @@ namespace Botan {
/**
* Swap a 16 bit integer
*/
-inline u16bit reverse_bytes(u16bit val)
+inline uint16_t reverse_bytes(uint16_t val)
{
return rotate_left(val, 8);
}
@@ -29,7 +29,7 @@ inline u16bit reverse_bytes(u16bit val)
/**
* Swap a 32 bit integer
*/
-inline u32bit reverse_bytes(u32bit val)
+inline uint32_t reverse_bytes(uint32_t val)
{
#if BOTAN_GCC_VERSION >= 430 && !defined(BOTAN_TARGET_ARCH_IS_ARM32)
/*
@@ -77,7 +77,7 @@ inline u32bit reverse_bytes(u32bit val)
/**
* Swap a 64 bit integer
*/
-inline u64bit reverse_bytes(u64bit val)
+inline uint64_t reverse_bytes(uint64_t val)
{
#if BOTAN_GCC_VERSION >= 430
@@ -95,13 +95,13 @@ inline u64bit reverse_bytes(u64bit val)
* useful for 32-bit x86).
*/
- u32bit hi = static_cast<u32bit>(val >> 32);
- u32bit lo = static_cast<u32bit>(val);
+ uint32_t hi = static_cast<uint32_t>(val >> 32);
+ uint32_t lo = static_cast<uint32_t>(val);
hi = reverse_bytes(hi);
lo = reverse_bytes(lo);
- return (static_cast<u64bit>(lo) << 32) | hi;
+ return (static_cast<uint64_t>(lo) << 32) | hi;
#endif
}
@@ -120,10 +120,10 @@ inline void bswap_4(T x[4])
#if defined(BOTAN_TARGET_CPU_HAS_SSE2) && !defined(BOTAN_NO_SSE_INTRINSICS)
/**
-* Swap 4 u32bits in an array using SSE2 shuffle instructions
+* Swap 4 uint32_ts in an array using SSE2 shuffle instructions
*/
template<>
-inline void bswap_4(u32bit x[4])
+inline void bswap_4(uint32_t x[4])
{
__m128i T = _mm_loadu_si128(reinterpret_cast<const __m128i*>(x));
diff --git a/src/lib/utils/calendar.h b/src/lib/utils/calendar.h
index a0b91f913..91da9edc0 100644
--- a/src/lib/utils/calendar.h
+++ b/src/lib/utils/calendar.h
@@ -21,24 +21,24 @@ namespace Botan {
struct BOTAN_DLL calendar_point
{
/** The year */
- u32bit year;
+ uint32_t year;
/** The month, 1 through 12 for Jan to Dec */
- u32bit month;
+ uint32_t month;
/** The day of the month, 1 through 31 (or 28 or 30 based on month */
- u32bit day;
+ uint32_t day;
/** Hour in 24-hour form, 0 to 23 */
- u32bit hour;
+ uint32_t hour;
/** Minutes in the hour, 0 to 60 */
- u32bit minutes;
+ uint32_t minutes;
/** Seconds in the minute, 0 to 60, but might be slightly
larger to deal with leap seconds on some systems
*/
- u32bit seconds;
+ uint32_t seconds;
/**
* Initialize a calendar_point
@@ -49,7 +49,7 @@ struct BOTAN_DLL calendar_point
* @param min the minute
* @param sec the second
*/
- calendar_point(u32bit y, u32bit mon, u32bit d, u32bit h, u32bit min, u32bit sec) :
+ calendar_point(uint32_t y, uint32_t mon, uint32_t d, uint32_t h, uint32_t min, uint32_t sec) :
year(y), month(mon), day(d), hour(h), minutes(min), seconds(sec) {}
/**
diff --git a/src/lib/utils/charset.cpp b/src/lib/utils/charset.cpp
index cb106d6e9..72db6c792 100644
--- a/src/lib/utils/charset.cpp
+++ b/src/lib/utils/charset.cpp
@@ -28,8 +28,8 @@ std::string ucs2_to_latin1(const std::string& ucs2)
for(size_t i = 0; i != ucs2.size(); i += 2)
{
- const byte c1 = ucs2[i];
- const byte c2 = ucs2[i+1];
+ const uint8_t c1 = ucs2[i];
+ const uint8_t c2 = ucs2[i+1];
if(c1 != 0)
throw Decoding_Error("UCS-2 has non-Latin1 characters");
@@ -50,7 +50,7 @@ std::string utf8_to_latin1(const std::string& utf8)
size_t position = 0;
while(position != utf8.size())
{
- const byte c1 = static_cast<byte>(utf8[position++]);
+ const uint8_t c1 = static_cast<uint8_t>(utf8[position++]);
if(c1 <= 0x7F)
iso8859 += static_cast<char>(c1);
@@ -59,8 +59,8 @@ std::string utf8_to_latin1(const std::string& utf8)
if(position == utf8.size())
throw Decoding_Error("UTF-8: sequence truncated");
- const byte c2 = static_cast<byte>(utf8[position++]);
- const byte iso_char = ((c1 & 0x07) << 6) | (c2 & 0x3F);
+ const uint8_t c2 = static_cast<uint8_t>(utf8[position++]);
+ const uint8_t iso_char = ((c1 & 0x07) << 6) | (c2 & 0x3F);
if(iso_char <= 0x7F)
throw Decoding_Error("UTF-8: sequence longer than needed");
@@ -82,7 +82,7 @@ std::string latin1_to_utf8(const std::string& iso8859)
std::string utf8;
for(size_t i = 0; i != iso8859.size(); ++i)
{
- const byte c = static_cast<byte>(iso8859[i]);
+ const uint8_t c = static_cast<uint8_t>(iso8859[i]);
if(c <= 0x7F)
utf8 += static_cast<char>(c);
@@ -146,7 +146,7 @@ bool is_space(char c)
/*
* Convert a character to a digit
*/
-byte char2digit(char c)
+uint8_t char2digit(char c)
{
switch(c)
{
@@ -168,7 +168,7 @@ byte char2digit(char c)
/*
* Convert a digit to a character
*/
-char digit2char(byte b)
+char digit2char(uint8_t b)
{
switch(b)
{
diff --git a/src/lib/utils/charset.h b/src/lib/utils/charset.h
index b708c886a..5ab28661a 100644
--- a/src/lib/utils/charset.h
+++ b/src/lib/utils/charset.h
@@ -36,8 +36,8 @@ bool BOTAN_DLL is_digit(char c);
bool BOTAN_DLL is_space(char c);
bool BOTAN_DLL caseless_cmp(char x, char y);
-byte BOTAN_DLL char2digit(char c);
-char BOTAN_DLL digit2char(byte b);
+uint8_t BOTAN_DLL char2digit(char c);
+char BOTAN_DLL digit2char(uint8_t b);
}
diff --git a/src/lib/utils/cpuid.cpp b/src/lib/utils/cpuid.cpp
index cb25ed09d..428ca2715 100644
--- a/src/lib/utils/cpuid.cpp
+++ b/src/lib/utils/cpuid.cpp
@@ -74,7 +74,7 @@
namespace Botan {
-u64bit CPUID::g_processor_flags[2] = { 0, 0 };
+uint64_t CPUID::g_processor_flags[2] = { 0, 0 };
size_t CPUID::g_cache_line_size = BOTAN_TARGET_CPU_DEFAULT_CACHE_LINE_SIZE;
bool CPUID::g_initialized = false;
bool CPUID::g_little_endian = false;
@@ -119,20 +119,20 @@ bool altivec_check_pvr_emul()
PearPC and Linux sources, mostly.
*/
- const u16bit PVR_G4_7400 = 0x000C;
- const u16bit PVR_G5_970 = 0x0039;
- const u16bit PVR_G5_970FX = 0x003C;
- const u16bit PVR_G5_970MP = 0x0044;
- const u16bit PVR_G5_970GX = 0x0045;
- const u16bit PVR_POWER6 = 0x003E;
- const u16bit PVR_POWER7 = 0x003F;
- const u16bit PVR_POWER8 = 0x004B;
- const u16bit PVR_CELL_PPU = 0x0070;
+ const uint16_t PVR_G4_7400 = 0x000C;
+ const uint16_t PVR_G5_970 = 0x0039;
+ const uint16_t PVR_G5_970FX = 0x003C;
+ const uint16_t PVR_G5_970MP = 0x0044;
+ const uint16_t PVR_G5_970GX = 0x0045;
+ const uint16_t PVR_POWER6 = 0x003E;
+ const uint16_t PVR_POWER7 = 0x003F;
+ const uint16_t PVR_POWER8 = 0x004B;
+ const uint16_t PVR_CELL_PPU = 0x0070;
// Motorola produced G4s with PVR 0x800[0123C] (at least)
- const u16bit PVR_G4_74xx_24 = 0x800;
+ const uint16_t PVR_G4_74xx_24 = 0x800;
- u32bit pvr = 0;
+ uint32_t pvr = 0;
asm volatile("mfspr %0, 287" : "=r" (pvr));
@@ -213,13 +213,13 @@ void CPUID::initialize()
#endif
#if defined(BOTAN_TARGET_CPU_IS_X86_FAMILY)
- const u32bit INTEL_CPUID[3] = { 0x756E6547, 0x6C65746E, 0x49656E69 };
- const u32bit AMD_CPUID[3] = { 0x68747541, 0x444D4163, 0x69746E65 };
+ const uint32_t INTEL_CPUID[3] = { 0x756E6547, 0x6C65746E, 0x49656E69 };
+ const uint32_t AMD_CPUID[3] = { 0x68747541, 0x444D4163, 0x69746E65 };
- u32bit cpuid[4] = { 0 };
+ uint32_t cpuid[4] = { 0 };
X86_CPUID(0, cpuid);
- const u32bit max_supported_sublevel = cpuid[0];
+ const uint32_t max_supported_sublevel = cpuid[0];
if(max_supported_sublevel == 0)
return;
@@ -229,7 +229,7 @@ void CPUID::initialize()
X86_CPUID(1, cpuid);
- g_processor_flags[0] = (static_cast<u64bit>(cpuid[2]) << 32) | cpuid[3];
+ g_processor_flags[0] = (static_cast<uint64_t>(cpuid[2]) << 32) | cpuid[3];
if(is_intel)
g_cache_line_size = 8 * get_byte(2, cpuid[1]);
@@ -238,7 +238,7 @@ void CPUID::initialize()
{
clear_mem(cpuid, 4);
X86_CPUID_SUBLEVEL(7, 0, cpuid);
- g_processor_flags[1] = (static_cast<u64bit>(cpuid[2]) << 32) | cpuid[1];
+ g_processor_flags[1] = (static_cast<uint64_t>(cpuid[2]) << 32) | cpuid[1];
}
if(is_amd)
diff --git a/src/lib/utils/cpuid.h b/src/lib/utils/cpuid.h
index aa7bae963..634305aa1 100644
--- a/src/lib/utils/cpuid.h
+++ b/src/lib/utils/cpuid.h
@@ -195,7 +195,7 @@ class BOTAN_DLL CPUID
static bool g_initialized;
static bool g_little_endian;
static size_t g_cache_line_size;
- static u64bit g_processor_flags[2];
+ static uint64_t g_processor_flags[2];
};
}
diff --git a/src/lib/utils/ct_utils.h b/src/lib/utils/ct_utils.h
index 1f095ba88..68bd01c94 100644
--- a/src/lib/utils/ct_utils.h
+++ b/src/lib/utils/ct_utils.h
@@ -195,10 +195,10 @@ inline secure_vector<uint8_t> strip_leading_zeros(const uint8_t in[], size_t len
leading_zeros += CT::select<uint8_t>(only_zeros, 1, 0);
}
- return secure_vector<byte>(in + leading_zeros, in + length);
+ return secure_vector<uint8_t>(in + leading_zeros, in + length);
}
-inline secure_vector<byte> strip_leading_zeros(const secure_vector<uint8_t>& in)
+inline secure_vector<uint8_t> strip_leading_zeros(const secure_vector<uint8_t>& in)
{
return strip_leading_zeros(in.data(), in.size());
}
diff --git a/src/lib/utils/data_src.cpp b/src/lib/utils/data_src.cpp
index 7da94d7c0..169f8e186 100644
--- a/src/lib/utils/data_src.cpp
+++ b/src/lib/utils/data_src.cpp
@@ -19,7 +19,7 @@ namespace Botan {
/*
* Read a single byte from the DataSource
*/
-size_t DataSource::read_byte(byte& out)
+size_t DataSource::read_byte(uint8_t& out)
{
return read(&out, 1);
}
@@ -27,7 +27,7 @@ size_t DataSource::read_byte(byte& out)
/*
* Peek a single byte from the DataSource
*/
-size_t DataSource::peek_byte(byte& out) const
+size_t DataSource::peek_byte(uint8_t& out) const
{
return peek(&out, 1, 0);
}
@@ -37,7 +37,7 @@ size_t DataSource::peek_byte(byte& out) const
*/
size_t DataSource::discard_next(size_t n)
{
- byte buf[64] = { 0 };
+ uint8_t buf[64] = { 0 };
size_t discarded = 0;
while(n)
@@ -56,7 +56,7 @@ size_t DataSource::discard_next(size_t n)
/*
* Read from a memory buffer
*/
-size_t DataSource_Memory::read(byte out[], size_t length)
+size_t DataSource_Memory::read(uint8_t out[], size_t length)
{
size_t got = std::min<size_t>(m_source.size() - m_offset, length);
copy_mem(out, m_source.data() + m_offset, got);
@@ -72,7 +72,7 @@ bool DataSource_Memory::check_available(size_t n)
/*
* Peek into a memory buffer
*/
-size_t DataSource_Memory::peek(byte out[], size_t length,
+size_t DataSource_Memory::peek(uint8_t out[], size_t length,
size_t peek_offset) const
{
const size_t bytes_left = m_source.size() - m_offset;
@@ -95,8 +95,8 @@ bool DataSource_Memory::end_of_data() const
* DataSource_Memory Constructor
*/
DataSource_Memory::DataSource_Memory(const std::string& in) :
- m_source(reinterpret_cast<const byte*>(in.data()),
- reinterpret_cast<const byte*>(in.data()) + in.length()),
+ m_source(reinterpret_cast<const uint8_t*>(in.data()),
+ reinterpret_cast<const uint8_t*>(in.data()) + in.length()),
m_offset(0)
{
}
@@ -106,7 +106,7 @@ DataSource_Memory::DataSource_Memory(const std::string& in) :
/*
* Read from a stream
*/
-size_t DataSource_Stream::read(byte out[], size_t length)
+size_t DataSource_Stream::read(uint8_t out[], size_t length)
{
m_source.read(reinterpret_cast<char*>(out), length);
if(m_source.bad())
@@ -129,7 +129,7 @@ bool DataSource_Stream::check_available(size_t n)
/*
* Peek into a stream
*/
-size_t DataSource_Stream::peek(byte out[], size_t length, size_t offset) const
+size_t DataSource_Stream::peek(uint8_t out[], size_t length, size_t offset) const
{
if(end_of_data())
throw Invalid_State("DataSource_Stream: Cannot peek when out of data");
@@ -138,7 +138,7 @@ size_t DataSource_Stream::peek(byte out[], size_t length, size_t offset) const
if(offset)
{
- secure_vector<byte> buf(offset);
+ secure_vector<uint8_t> buf(offset);
m_source.read(reinterpret_cast<char*>(buf.data()), buf.size());
if(m_source.bad())
throw Stream_IO_Error("DataSource_Stream::peek: Source failure");
diff --git a/src/lib/utils/data_src.h b/src/lib/utils/data_src.h
index 299a42ab5..ea28b7602 100644
--- a/src/lib/utils/data_src.h
+++ b/src/lib/utils/data_src.h
@@ -30,7 +30,7 @@ class BOTAN_DLL DataSource
* @return length in bytes that was actually read and put
* into out
*/
- virtual size_t read(byte out[], size_t length) BOTAN_WARN_UNUSED_RESULT = 0;
+ virtual size_t read(uint8_t out[], size_t length) BOTAN_WARN_UNUSED_RESULT = 0;
virtual bool check_available(size_t n) = 0;
@@ -45,7 +45,7 @@ class BOTAN_DLL DataSource
* @return length in bytes that was actually read and put
* into out
*/
- virtual size_t peek(byte out[], size_t length, size_t peek_offset) const BOTAN_WARN_UNUSED_RESULT = 0;
+ virtual size_t peek(uint8_t out[], size_t length, size_t peek_offset) const BOTAN_WARN_UNUSED_RESULT = 0;
/**
* Test whether the source still has data that can be read.
@@ -64,7 +64,7 @@ class BOTAN_DLL DataSource
* @return length in bytes that was actually read and put
* into out
*/
- size_t read_byte(byte& out);
+ size_t read_byte(uint8_t& out);
/**
* Peek at one byte.
@@ -72,7 +72,7 @@ class BOTAN_DLL DataSource
* @return length in bytes that was actually read and put
* into out
*/
- size_t peek_byte(byte& out) const;
+ size_t peek_byte(uint8_t& out) const;
/**
* Discard the next N bytes of the data
@@ -98,8 +98,8 @@ class BOTAN_DLL DataSource
class BOTAN_DLL DataSource_Memory : public DataSource
{
public:
- size_t read(byte[], size_t) override;
- size_t peek(byte[], size_t, size_t) const override;
+ size_t read(uint8_t[], size_t) override;
+ size_t peek(uint8_t[], size_t, size_t) const override;
bool check_available(size_t n) override;
bool end_of_data() const override;
@@ -114,26 +114,26 @@ class BOTAN_DLL DataSource_Memory : public DataSource
* @param in the byte array to read from
* @param length the length of the byte array
*/
- DataSource_Memory(const byte in[], size_t length) :
+ DataSource_Memory(const uint8_t in[], size_t length) :
m_source(in, in + length), m_offset(0) {}
/**
* Construct a memory source that reads from a secure_vector
* @param in the MemoryRegion to read from
*/
- explicit DataSource_Memory(const secure_vector<byte>& in) :
+ explicit DataSource_Memory(const secure_vector<uint8_t>& in) :
m_source(in), m_offset(0) {}
/**
* Construct a memory source that reads from a std::vector
* @param in the MemoryRegion to read from
*/
- explicit DataSource_Memory(const std::vector<byte>& in) :
+ explicit DataSource_Memory(const std::vector<uint8_t>& in) :
m_source(in.begin(), in.end()), m_offset(0) {}
size_t get_bytes_read() const override { return m_offset; }
private:
- secure_vector<byte> m_source;
+ secure_vector<uint8_t> m_source;
size_t m_offset;
};
@@ -145,8 +145,8 @@ class BOTAN_DLL DataSource_Memory : public DataSource
class BOTAN_DLL DataSource_Stream : public DataSource
{
public:
- size_t read(byte[], size_t) override;
- size_t peek(byte[], size_t, size_t) const override;
+ size_t read(uint8_t[], size_t) override;
+ size_t peek(uint8_t[], size_t, size_t) const override;
bool check_available(size_t n) override;
bool end_of_data() const override;
std::string id() const override;
diff --git a/src/lib/utils/database.h b/src/lib/utils/database.h
index 0cd45dac0..6a1fa6b02 100644
--- a/src/lib/utils/database.h
+++ b/src/lib/utils/database.h
@@ -36,12 +36,12 @@ class BOTAN_DLL SQL_Database
virtual void bind(int column, std::chrono::system_clock::time_point time) = 0;
- virtual void bind(int column, const std::vector<byte>& blob) = 0;
+ virtual void bind(int column, const std::vector<uint8_t>& blob) = 0;
- virtual void bind(int column, const byte* data, size_t len) = 0;
+ virtual void bind(int column, const uint8_t* data, size_t len) = 0;
/* Get output */
- virtual std::pair<const byte*, size_t> get_blob(int column) = 0;
+ virtual std::pair<const uint8_t*, size_t> get_blob(int column) = 0;
virtual size_t get_size_t(int column) = 0;
diff --git a/src/lib/utils/datastor/datastor.cpp b/src/lib/utils/datastor/datastor.cpp
index 6f1b71082..ae6b1e45c 100644
--- a/src/lib/utils/datastor/datastor.cpp
+++ b/src/lib/utils/datastor/datastor.cpp
@@ -88,13 +88,13 @@ std::string Data_Store::get1(const std::string& key,
/*
* Get a single std::vector atom
*/
-std::vector<byte>
+std::vector<uint8_t>
Data_Store::get1_memvec(const std::string& key) const
{
std::vector<std::string> vals = get(key);
if(vals.empty())
- return std::vector<byte>();
+ return std::vector<uint8_t>();
if(vals.size() > 1)
throw Invalid_State("Data_Store::get1_memvec: Multiple values for " +
@@ -104,18 +104,17 @@ Data_Store::get1_memvec(const std::string& key) const
}
/*
-* Get a single u32bit atom
+* Get a single uint32_t atom
*/
-u32bit Data_Store::get1_u32bit(const std::string& key,
- u32bit default_val) const
+uint32_t Data_Store::get1_uint32(const std::string& key,
+ uint32_t default_val) const
{
std::vector<std::string> vals = get(key);
if(vals.empty())
return default_val;
else if(vals.size() > 1)
- throw Invalid_State("Data_Store::get1_u32bit: Multiple values for " +
- key);
+ throw Invalid_State("Data_Store::get1_uint32: Multiple values for " + key);
return to_u32bit(vals[0]);
}
@@ -131,7 +130,7 @@ void Data_Store::add(const std::string& key, const std::string& val)
/*
* Insert a single key and value
*/
-void Data_Store::add(const std::string& key, u32bit val)
+void Data_Store::add(const std::string& key, uint32_t val)
{
add(key, std::to_string(val));
}
@@ -139,12 +138,12 @@ void Data_Store::add(const std::string& key, u32bit val)
/*
* Insert a single key and value
*/
-void Data_Store::add(const std::string& key, const secure_vector<byte>& val)
+void Data_Store::add(const std::string& key, const secure_vector<uint8_t>& val)
{
add(key, hex_encode(val.data(), val.size()));
}
-void Data_Store::add(const std::string& key, const std::vector<byte>& val)
+void Data_Store::add(const std::string& key, const std::vector<uint8_t>& val)
{
add(key, hex_encode(val.data(), val.size()));
}
diff --git a/src/lib/utils/datastor/datastor.h b/src/lib/utils/datastor/datastor.h
index 3b25e1fe4..ee9ef219a 100644
--- a/src/lib/utils/datastor/datastor.h
+++ b/src/lib/utils/datastor/datastor.h
@@ -38,16 +38,16 @@ class BOTAN_DLL Data_Store
std::string get1(const std::string& key,
const std::string& default_value) const;
- std::vector<byte> get1_memvec(const std::string&) const;
- u32bit get1_u32bit(const std::string&, u32bit = 0) const;
+ std::vector<uint8_t> get1_memvec(const std::string&) const;
+ uint32_t get1_uint32(const std::string&, uint32_t = 0) const;
bool has_value(const std::string&) const;
void add(const std::multimap<std::string, std::string>&);
void add(const std::string&, const std::string&);
- void add(const std::string&, u32bit);
- void add(const std::string&, const secure_vector<byte>&);
- void add(const std::string&, const std::vector<byte>&);
+ void add(const std::string&, uint32_t);
+ void add(const std::string&, const secure_vector<uint8_t>&);
+ void add(const std::string&, const std::vector<uint8_t>&);
private:
std::multimap<std::string, std::string> m_contents;
};
diff --git a/src/lib/utils/donna128.h b/src/lib/utils/donna128.h
index 2a2d1e339..3e11f71c2 100644
--- a/src/lib/utils/donna128.h
+++ b/src/lib/utils/donna128.h
@@ -15,7 +15,7 @@ namespace Botan {
class donna128
{
public:
- donna128(u64bit ll = 0, u64bit hh = 0) { l = ll; h = hh; }
+ donna128(uint64_t ll = 0, uint64_t hh = 0) { l = ll; h = hh; }
donna128(const donna128&) = default;
donna128& operator=(const donna128&) = default;
@@ -25,7 +25,7 @@ class donna128
donna128 z = x;
if(shift > 0)
{
- const u64bit carry = z.h << (64 - shift);
+ const uint64_t carry = z.h << (64 - shift);
z.h = (z.h >> shift);
z.l = (z.l >> shift) | carry;
}
@@ -37,19 +37,19 @@ class donna128
donna128 z = x;
if(shift > 0)
{
- const u64bit carry = z.l >> (64 - shift);
+ const uint64_t carry = z.l >> (64 - shift);
z.l = (z.l << shift);
z.h = (z.h << shift) | carry;
}
return z;
}
- friend u64bit operator&(const donna128& x, u64bit mask)
+ friend uint64_t operator&(const donna128& x, uint64_t mask)
{
return x.l & mask;
}
- u64bit operator&=(u64bit mask)
+ uint64_t operator&=(uint64_t mask)
{
h = 0;
l &= mask;
@@ -64,24 +64,24 @@ class donna128
return *this;
}
- donna128& operator+=(u64bit x)
+ donna128& operator+=(uint64_t x)
{
l += x;
h += (l < x);
return *this;
}
- u64bit lo() const { return l; }
- u64bit hi() const { return h; }
+ uint64_t lo() const { return l; }
+ uint64_t hi() const { return h; }
private:
- u64bit h = 0, l = 0;
+ uint64_t h = 0, l = 0;
};
-inline donna128 operator*(const donna128& x, u64bit y)
+inline donna128 operator*(const donna128& x, uint64_t y)
{
BOTAN_ASSERT(x.hi() == 0, "High 64 bits of donna128 set to zero during multiply");
- u64bit lo = 0, hi = 0;
+ uint64_t lo = 0, hi = 0;
mul64x64_128(x.lo(), y, &lo, &hi);
return donna128(lo, hi);
}
@@ -93,7 +93,7 @@ inline donna128 operator+(const donna128& x, const donna128& y)
return z;
}
-inline donna128 operator+(const donna128& x, u64bit y)
+inline donna128 operator+(const donna128& x, uint64_t y)
{
donna128 z = x;
z += y;
@@ -105,12 +105,12 @@ inline donna128 operator|(const donna128& x, const donna128& y)
return donna128(x.lo() | y.lo(), x.hi() | y.hi());
}
-inline u64bit carry_shift(const donna128& a, size_t shift)
+inline uint64_t carry_shift(const donna128& a, size_t shift)
{
return (a >> shift).lo();
}
-inline u64bit combine_lower(const donna128& a, size_t s1,
+inline uint64_t combine_lower(const donna128& a, size_t s1,
const donna128& b, size_t s2)
{
donna128 z = (a >> s1) | (b << s2);
@@ -118,15 +118,15 @@ inline u64bit combine_lower(const donna128& a, size_t s1,
}
#if defined(BOTAN_TARGET_HAS_NATIVE_UINT128)
-inline u64bit carry_shift(const uint128_t a, size_t shift)
+inline uint64_t carry_shift(const uint128_t a, size_t shift)
{
- return static_cast<u64bit>(a >> shift);
+ return static_cast<uint64_t>(a >> shift);
}
-inline u64bit combine_lower(const uint128_t a, size_t s1,
+inline uint64_t combine_lower(const uint128_t a, size_t s1,
const uint128_t b, size_t s2)
{
- return static_cast<u64bit>((a >> s1) | (b << s2));
+ return static_cast<uint64_t>((a >> s1) | (b << s2));
}
#endif
diff --git a/src/lib/utils/http_util/http_util.cpp b/src/lib/utils/http_util/http_util.cpp
index c699b786f..f714c1bca 100644
--- a/src/lib/utils/http_util/http_util.cpp
+++ b/src/lib/utils/http_util/http_util.cpp
@@ -146,7 +146,7 @@ std::string url_encode(const std::string& in)
else if(c == '-' || c == '_' || c == '.' || c == '~')
out << c;
else
- out << '%' << hex_encode(reinterpret_cast<byte*>(&c), 1);
+ out << '%' << hex_encode(reinterpret_cast<uint8_t*>(&c), 1);
}
return out.str();
@@ -166,7 +166,7 @@ Response http_sync(http_exch_fn http_transact,
const std::string& verb,
const std::string& url,
const std::string& content_type,
- const std::vector<byte>& body,
+ const std::vector<uint8_t>& body,
size_t allowable_redirects)
{
if(url.empty())
@@ -251,8 +251,8 @@ Response http_sync(http_exch_fn http_transact,
return GET_sync(headers["Location"], allowable_redirects - 1);
}
- std::vector<byte> resp_body;
- std::vector<byte> buf(4096);
+ std::vector<uint8_t> resp_body;
+ std::vector<uint8_t> buf(4096);
while(io.good())
{
io.read(reinterpret_cast<char*>(buf.data()), buf.size());
@@ -274,7 +274,7 @@ Response http_sync(http_exch_fn http_transact,
Response http_sync(const std::string& verb,
const std::string& url,
const std::string& content_type,
- const std::vector<byte>& body,
+ const std::vector<uint8_t>& body,
size_t allowable_redirects)
{
return http_sync(
@@ -288,12 +288,12 @@ Response http_sync(const std::string& verb,
Response GET_sync(const std::string& url, size_t allowable_redirects)
{
- return http_sync("GET", url, "", std::vector<byte>(), allowable_redirects);
+ return http_sync("GET", url, "", std::vector<uint8_t>(), allowable_redirects);
}
Response POST_sync(const std::string& url,
const std::string& content_type,
- const std::vector<byte>& body,
+ const std::vector<uint8_t>& body,
size_t allowable_redirects)
{
return http_sync("POST", url, content_type, body, allowable_redirects);
diff --git a/src/lib/utils/http_util/http_util.h b/src/lib/utils/http_util/http_util.h
index 1b4da3d2c..c1cef4542 100644
--- a/src/lib/utils/http_util/http_util.h
+++ b/src/lib/utils/http_util/http_util.h
@@ -25,7 +25,7 @@ struct Response
Response() : m_status_code(0), m_status_message("Uninitialized") {}
Response(unsigned int status_code, const std::string& status_message,
- const std::vector<byte>& body,
+ const std::vector<uint8_t>& body,
const std::map<std::string, std::string>& headers) :
m_status_code(status_code),
m_status_message(status_message),
@@ -34,7 +34,7 @@ struct Response
unsigned int status_code() const { return m_status_code; }
- const std::vector<byte>& body() const { return m_body; }
+ const std::vector<uint8_t>& body() const { return m_body; }
const std::map<std::string, std::string>& headers() const { return m_headers; }
@@ -49,7 +49,7 @@ struct Response
private:
unsigned int m_status_code;
std::string m_status_message;
- std::vector<byte> m_body;
+ std::vector<uint8_t> m_body;
std::map<std::string, std::string> m_headers;
};
@@ -71,13 +71,13 @@ BOTAN_DLL Response http_sync(http_exch_fn fn,
const std::string& verb,
const std::string& url,
const std::string& content_type,
- const std::vector<byte>& body,
+ const std::vector<uint8_t>& body,
size_t allowable_redirects);
BOTAN_DLL Response http_sync(const std::string& verb,
const std::string& url,
const std::string& content_type,
- const std::vector<byte>& body,
+ const std::vector<uint8_t>& body,
size_t allowable_redirects);
BOTAN_DLL Response GET_sync(const std::string& url,
@@ -85,7 +85,7 @@ BOTAN_DLL Response GET_sync(const std::string& url,
BOTAN_DLL Response POST_sync(const std::string& url,
const std::string& content_type,
- const std::vector<byte>& body,
+ const std::vector<uint8_t>& body,
size_t allowable_redirects = 1);
BOTAN_DLL std::string url_encode(const std::string& url);
diff --git a/src/lib/utils/loadstor.h b/src/lib/utils/loadstor.h
index 15ff6a708..c8368fbea 100644
--- a/src/lib/utils/loadstor.h
+++ b/src/lib/utils/loadstor.h
@@ -44,42 +44,42 @@ namespace Botan {
* @param input the value to extract from
* @return byte byte_num of input
*/
-template<typename T> inline byte get_byte(size_t byte_num, T input)
+template<typename T> inline uint8_t get_byte(size_t byte_num, T input)
{
- return static_cast<byte>(
+ return static_cast<uint8_t>(
input >> (((~byte_num)&(sizeof(T)-1)) << 3)
);
}
/**
-* Make a u16bit from two bytes
+* Make a uint16_t from two bytes
* @param i0 the first byte
* @param i1 the second byte
* @return i0 || i1
*/
-inline u16bit make_u16bit(byte i0, byte i1)
+inline uint16_t make_uint16(uint8_t i0, uint8_t i1)
{
- return ((static_cast<u16bit>(i0) << 8) | i1);
+ return ((static_cast<uint16_t>(i0) << 8) | i1);
}
/**
-* Make a u32bit from four bytes
+* Make a uint32_t from four bytes
* @param i0 the first byte
* @param i1 the second byte
* @param i2 the third byte
* @param i3 the fourth byte
* @return i0 || i1 || i2 || i3
*/
-inline u32bit make_u32bit(byte i0, byte i1, byte i2, byte i3)
+inline uint32_t make_uint32(uint8_t i0, uint8_t i1, uint8_t i2, uint8_t i3)
{
- return ((static_cast<u32bit>(i0) << 24) |
- (static_cast<u32bit>(i1) << 16) |
- (static_cast<u32bit>(i2) << 8) |
- (static_cast<u32bit>(i3)));
+ return ((static_cast<uint32_t>(i0) << 24) |
+ (static_cast<uint32_t>(i1) << 16) |
+ (static_cast<uint32_t>(i2) << 8) |
+ (static_cast<uint32_t>(i3)));
}
/**
-* Make a u32bit from eight bytes
+* Make a uint32_t from eight bytes
* @param i0 the first byte
* @param i1 the second byte
* @param i2 the third byte
@@ -90,17 +90,17 @@ inline u32bit make_u32bit(byte i0, byte i1, byte i2, byte i3)
* @param i7 the eighth byte
* @return i0 || i1 || i2 || i3 || i4 || i5 || i6 || i7
*/
-inline u64bit make_u64bit(byte i0, byte i1, byte i2, byte i3,
- byte i4, byte i5, byte i6, byte i7)
+inline uint64_t make_uint64(uint8_t i0, uint8_t i1, uint8_t i2, uint8_t i3,
+ uint8_t i4, uint8_t i5, uint8_t i6, uint8_t i7)
{
- return ((static_cast<u64bit>(i0) << 56) |
- (static_cast<u64bit>(i1) << 48) |
- (static_cast<u64bit>(i2) << 40) |
- (static_cast<u64bit>(i3) << 32) |
- (static_cast<u64bit>(i4) << 24) |
- (static_cast<u64bit>(i5) << 16) |
- (static_cast<u64bit>(i6) << 8) |
- (static_cast<u64bit>(i7)));
+ return ((static_cast<uint64_t>(i0) << 56) |
+ (static_cast<uint64_t>(i1) << 48) |
+ (static_cast<uint64_t>(i2) << 40) |
+ (static_cast<uint64_t>(i3) << 32) |
+ (static_cast<uint64_t>(i4) << 24) |
+ (static_cast<uint64_t>(i5) << 16) |
+ (static_cast<uint64_t>(i6) << 8) |
+ (static_cast<uint64_t>(i7)));
}
/**
@@ -110,7 +110,7 @@ inline u64bit make_u64bit(byte i0, byte i1, byte i2, byte i3,
* @return off'th T of in, as a big-endian value
*/
template<typename T>
-inline T load_be(const byte in[], size_t off)
+inline T load_be(const uint8_t in[], size_t off)
{
in += off * sizeof(T);
T out = 0;
@@ -126,7 +126,7 @@ inline T load_be(const byte in[], size_t off)
* @return off'th T of in, as a litte-endian value
*/
template<typename T>
-inline T load_le(const byte in[], size_t off)
+inline T load_le(const uint8_t in[], size_t off)
{
in += off * sizeof(T);
T out = 0;
@@ -136,119 +136,119 @@ inline T load_le(const byte in[], size_t off)
}
/**
-* Load a big-endian u16bit
+* Load a big-endian uint16_t
* @param in a pointer to some bytes
* @param off an offset into the array
-* @return off'th u16bit of in, as a big-endian value
+* @return off'th uint16_t of in, as a big-endian value
*/
template<>
-inline u16bit load_be<u16bit>(const byte in[], size_t off)
+inline uint16_t load_be<uint16_t>(const uint8_t in[], size_t off)
{
- in += off * sizeof(u16bit);
+ in += off * sizeof(uint16_t);
#if BOTAN_TARGET_UNALIGNED_MEMORY_ACCESS_OK
- u16bit x;
+ uint16_t x;
std::memcpy(&x, in, sizeof(x));
return BOTAN_ENDIAN_N2B(x);
#else
- return make_u16bit(in[0], in[1]);
+ return make_uint16(in[0], in[1]);
#endif
}
/**
-* Load a little-endian u16bit
+* Load a little-endian uint16_t
* @param in a pointer to some bytes
* @param off an offset into the array
-* @return off'th u16bit of in, as a little-endian value
+* @return off'th uint16_t of in, as a little-endian value
*/
template<>
-inline u16bit load_le<u16bit>(const byte in[], size_t off)
+inline uint16_t load_le<uint16_t>(const uint8_t in[], size_t off)
{
- in += off * sizeof(u16bit);
+ in += off * sizeof(uint16_t);
#if BOTAN_TARGET_UNALIGNED_MEMORY_ACCESS_OK
- u16bit x;
+ uint16_t x;
std::memcpy(&x, in, sizeof(x));
return BOTAN_ENDIAN_N2L(x);
#else
- return make_u16bit(in[1], in[0]);
+ return make_uint16(in[1], in[0]);
#endif
}
/**
-* Load a big-endian u32bit
+* Load a big-endian uint32_t
* @param in a pointer to some bytes
* @param off an offset into the array
-* @return off'th u32bit of in, as a big-endian value
+* @return off'th uint32_t of in, as a big-endian value
*/
template<>
-inline u32bit load_be<u32bit>(const byte in[], size_t off)
+inline uint32_t load_be<uint32_t>(const uint8_t in[], size_t off)
{
- in += off * sizeof(u32bit);
+ in += off * sizeof(uint32_t);
#if BOTAN_TARGET_UNALIGNED_MEMORY_ACCESS_OK
- u32bit x;
+ uint32_t x;
std::memcpy(&x, in, sizeof(x));
return BOTAN_ENDIAN_N2B(x);
#else
- return make_u32bit(in[0], in[1], in[2], in[3]);
+ return make_uint32(in[0], in[1], in[2], in[3]);
#endif
}
/**
-* Load a little-endian u32bit
+* Load a little-endian uint32_t
* @param in a pointer to some bytes
* @param off an offset into the array
-* @return off'th u32bit of in, as a little-endian value
+* @return off'th uint32_t of in, as a little-endian value
*/
template<>
-inline u32bit load_le<u32bit>(const byte in[], size_t off)
+inline uint32_t load_le<uint32_t>(const uint8_t in[], size_t off)
{
- in += off * sizeof(u32bit);
+ in += off * sizeof(uint32_t);
#if BOTAN_TARGET_UNALIGNED_MEMORY_ACCESS_OK
- u32bit x;
+ uint32_t x;
std::memcpy(&x, in, sizeof(x));
return BOTAN_ENDIAN_N2L(x);
#else
- return make_u32bit(in[3], in[2], in[1], in[0]);
+ return make_uint32(in[3], in[2], in[1], in[0]);
#endif
}
/**
-* Load a big-endian u64bit
+* Load a big-endian uint64_t
* @param in a pointer to some bytes
* @param off an offset into the array
-* @return off'th u64bit of in, as a big-endian value
+* @return off'th uint64_t of in, as a big-endian value
*/
template<>
-inline u64bit load_be<u64bit>(const byte in[], size_t off)
+inline uint64_t load_be<uint64_t>(const uint8_t in[], size_t off)
{
- in += off * sizeof(u64bit);
+ in += off * sizeof(uint64_t);
#if BOTAN_TARGET_UNALIGNED_MEMORY_ACCESS_OK
- u64bit x;
+ uint64_t x;
std::memcpy(&x, in, sizeof(x));
return BOTAN_ENDIAN_N2B(x);
#else
- return make_u64bit(in[0], in[1], in[2], in[3],
+ return make_uint64(in[0], in[1], in[2], in[3],
in[4], in[5], in[6], in[7]);
#endif
}
/**
-* Load a little-endian u64bit
+* Load a little-endian uint64_t
* @param in a pointer to some bytes
* @param off an offset into the array
-* @return off'th u64bit of in, as a little-endian value
+* @return off'th uint64_t of in, as a little-endian value
*/
template<>
-inline u64bit load_le<u64bit>(const byte in[], size_t off)
+inline uint64_t load_le<uint64_t>(const uint8_t in[], size_t off)
{
- in += off * sizeof(u64bit);
+ in += off * sizeof(uint64_t);
#if BOTAN_TARGET_UNALIGNED_MEMORY_ACCESS_OK
- u64bit x;
+ uint64_t x;
std::memcpy(&x, in, sizeof(x));
return BOTAN_ENDIAN_N2L(x);
#else
- return make_u64bit(in[7], in[6], in[5], in[4],
+ return make_uint64(in[7], in[6], in[5], in[4],
in[3], in[2], in[1], in[0]);
#endif
}
@@ -260,7 +260,7 @@ inline u64bit load_le<u64bit>(const byte in[], size_t off)
* @param x1 where the second word will be written
*/
template<typename T>
-inline void load_le(const byte in[], T& x0, T& x1)
+inline void load_le(const uint8_t in[], T& x0, T& x1)
{
x0 = load_le<T>(in, 0);
x1 = load_le<T>(in, 1);
@@ -275,7 +275,7 @@ inline void load_le(const byte in[], T& x0, T& x1)
* @param x3 where the fourth word will be written
*/
template<typename T>
-inline void load_le(const byte in[],
+inline void load_le(const uint8_t in[],
T& x0, T& x1, T& x2, T& x3)
{
x0 = load_le<T>(in, 0);
@@ -297,7 +297,7 @@ inline void load_le(const byte in[],
* @param x7 where the eighth word will be written
*/
template<typename T>
-inline void load_le(const byte in[],
+inline void load_le(const uint8_t in[],
T& x0, T& x1, T& x2, T& x3,
T& x4, T& x5, T& x6, T& x7)
{
@@ -319,7 +319,7 @@ inline void load_le(const byte in[],
*/
template<typename T>
inline void load_le(T out[],
- const byte in[],
+ const uint8_t in[],
size_t count)
{
if(count > 0)
@@ -350,7 +350,7 @@ inline void load_le(T out[],
* @param x1 where the second word will be written
*/
template<typename T>
-inline void load_be(const byte in[], T& x0, T& x1)
+inline void load_be(const uint8_t in[], T& x0, T& x1)
{
x0 = load_be<T>(in, 0);
x1 = load_be<T>(in, 1);
@@ -365,7 +365,7 @@ inline void load_be(const byte in[], T& x0, T& x1)
* @param x3 where the fourth word will be written
*/
template<typename T>
-inline void load_be(const byte in[],
+inline void load_be(const uint8_t in[],
T& x0, T& x1, T& x2, T& x3)
{
x0 = load_be<T>(in, 0);
@@ -387,7 +387,7 @@ inline void load_be(const byte in[],
* @param x7 where the eighth word will be written
*/
template<typename T>
-inline void load_be(const byte in[],
+inline void load_be(const uint8_t in[],
T& x0, T& x1, T& x2, T& x3,
T& x4, T& x5, T& x6, T& x7)
{
@@ -409,7 +409,7 @@ inline void load_be(const byte in[],
*/
template<typename T>
inline void load_be(T out[],
- const byte in[],
+ const uint8_t in[],
size_t count)
{
if(count > 0)
@@ -434,14 +434,14 @@ inline void load_be(T out[],
}
/**
-* Store a big-endian u16bit
-* @param in the input u16bit
+* Store a big-endian uint16_t
+* @param in the input uint16_t
* @param out the byte array to write to
*/
-inline void store_be(u16bit in, byte out[2])
+inline void store_be(uint16_t in, uint8_t out[2])
{
#if BOTAN_TARGET_UNALIGNED_MEMORY_ACCESS_OK
- u16bit o = BOTAN_ENDIAN_N2B(in);
+ uint16_t o = BOTAN_ENDIAN_N2B(in);
std::memcpy(out, &o, sizeof(o));
#else
out[0] = get_byte(0, in);
@@ -450,14 +450,14 @@ inline void store_be(u16bit in, byte out[2])
}
/**
-* Store a little-endian u16bit
-* @param in the input u16bit
+* Store a little-endian uint16_t
+* @param in the input uint16_t
* @param out the byte array to write to
*/
-inline void store_le(u16bit in, byte out[2])
+inline void store_le(uint16_t in, uint8_t out[2])
{
#if BOTAN_TARGET_UNALIGNED_MEMORY_ACCESS_OK
- u16bit o = BOTAN_ENDIAN_N2L(in);
+ uint16_t o = BOTAN_ENDIAN_N2L(in);
std::memcpy(out, &o, sizeof(o));
#else
out[0] = get_byte(1, in);
@@ -466,14 +466,14 @@ inline void store_le(u16bit in, byte out[2])
}
/**
-* Store a big-endian u32bit
-* @param in the input u32bit
+* Store a big-endian uint32_t
+* @param in the input uint32_t
* @param out the byte array to write to
*/
-inline void store_be(u32bit in, byte out[4])
+inline void store_be(uint32_t in, uint8_t out[4])
{
#if BOTAN_TARGET_UNALIGNED_MEMORY_ACCESS_OK
- u32bit o = BOTAN_ENDIAN_B2N(in);
+ uint32_t o = BOTAN_ENDIAN_B2N(in);
std::memcpy(out, &o, sizeof(o));
#else
out[0] = get_byte(0, in);
@@ -484,14 +484,14 @@ inline void store_be(u32bit in, byte out[4])
}
/**
-* Store a little-endian u32bit
-* @param in the input u32bit
+* Store a little-endian uint32_t
+* @param in the input uint32_t
* @param out the byte array to write to
*/
-inline void store_le(u32bit in, byte out[4])
+inline void store_le(uint32_t in, uint8_t out[4])
{
#if BOTAN_TARGET_UNALIGNED_MEMORY_ACCESS_OK
- u32bit o = BOTAN_ENDIAN_L2N(in);
+ uint32_t o = BOTAN_ENDIAN_L2N(in);
std::memcpy(out, &o, sizeof(o));
#else
out[0] = get_byte(3, in);
@@ -502,14 +502,14 @@ inline void store_le(u32bit in, byte out[4])
}
/**
-* Store a big-endian u64bit
-* @param in the input u64bit
+* Store a big-endian uint64_t
+* @param in the input uint64_t
* @param out the byte array to write to
*/
-inline void store_be(u64bit in, byte out[8])
+inline void store_be(uint64_t in, uint8_t out[8])
{
#if BOTAN_TARGET_UNALIGNED_MEMORY_ACCESS_OK
- u64bit o = BOTAN_ENDIAN_B2N(in);
+ uint64_t o = BOTAN_ENDIAN_B2N(in);
std::memcpy(out, &o, sizeof(o));
#else
out[0] = get_byte(0, in);
@@ -524,14 +524,14 @@ inline void store_be(u64bit in, byte out[8])
}
/**
-* Store a little-endian u64bit
-* @param in the input u64bit
+* Store a little-endian uint64_t
+* @param in the input uint64_t
* @param out the byte array to write to
*/
-inline void store_le(u64bit in, byte out[8])
+inline void store_le(uint64_t in, uint8_t out[8])
{
#if BOTAN_TARGET_UNALIGNED_MEMORY_ACCESS_OK
- u64bit o = BOTAN_ENDIAN_L2N(in);
+ uint64_t o = BOTAN_ENDIAN_L2N(in);
std::memcpy(out, &o, sizeof(o));
#else
out[0] = get_byte(7, in);
@@ -552,7 +552,7 @@ inline void store_le(u64bit in, byte out[8])
* @param x1 the second word
*/
template<typename T>
-inline void store_le(byte out[], T x0, T x1)
+inline void store_le(uint8_t out[], T x0, T x1)
{
store_le(x0, out + (0 * sizeof(T)));
store_le(x1, out + (1 * sizeof(T)));
@@ -565,7 +565,7 @@ inline void store_le(byte out[], T x0, T x1)
* @param x1 the second word
*/
template<typename T>
-inline void store_be(byte out[], T x0, T x1)
+inline void store_be(uint8_t out[], T x0, T x1)
{
store_be(x0, out + (0 * sizeof(T)));
store_be(x1, out + (1 * sizeof(T)));
@@ -580,7 +580,7 @@ inline void store_be(byte out[], T x0, T x1)
* @param x3 the fourth word
*/
template<typename T>
-inline void store_le(byte out[], T x0, T x1, T x2, T x3)
+inline void store_le(uint8_t out[], T x0, T x1, T x2, T x3)
{
store_le(x0, out + (0 * sizeof(T)));
store_le(x1, out + (1 * sizeof(T)));
@@ -597,7 +597,7 @@ inline void store_le(byte out[], T x0, T x1, T x2, T x3)
* @param x3 the fourth word
*/
template<typename T>
-inline void store_be(byte out[], T x0, T x1, T x2, T x3)
+inline void store_be(uint8_t out[], T x0, T x1, T x2, T x3)
{
store_be(x0, out + (0 * sizeof(T)));
store_be(x1, out + (1 * sizeof(T)));
@@ -618,7 +618,7 @@ inline void store_be(byte out[], T x0, T x1, T x2, T x3)
* @param x7 the eighth word
*/
template<typename T>
-inline void store_le(byte out[], T x0, T x1, T x2, T x3,
+inline void store_le(uint8_t out[], T x0, T x1, T x2, T x3,
T x4, T x5, T x6, T x7)
{
store_le(x0, out + (0 * sizeof(T)));
@@ -644,7 +644,7 @@ inline void store_le(byte out[], T x0, T x1, T x2, T x3,
* @param x7 the eighth word
*/
template<typename T>
-inline void store_be(byte out[], T x0, T x1, T x2, T x3,
+inline void store_be(uint8_t out[], T x0, T x1, T x2, T x3,
T x4, T x5, T x6, T x7)
{
store_be(x0, out + (0 * sizeof(T)));
@@ -658,7 +658,7 @@ inline void store_be(byte out[], T x0, T x1, T x2, T x3,
}
template<typename T>
-void copy_out_be(byte out[], size_t out_bytes, const T in[])
+void copy_out_be(uint8_t out[], size_t out_bytes, const T in[])
{
while(out_bytes >= sizeof(T))
{
@@ -673,13 +673,13 @@ void copy_out_be(byte out[], size_t out_bytes, const T in[])
}
template<typename T, typename Alloc>
-void copy_out_vec_be(byte out[], size_t out_bytes, const std::vector<T, Alloc>& in)
+void copy_out_vec_be(uint8_t out[], size_t out_bytes, const std::vector<T, Alloc>& in)
{
copy_out_be(out, out_bytes, in.data());
}
template<typename T>
-void copy_out_le(byte out[], size_t out_bytes, const T in[])
+void copy_out_le(uint8_t out[], size_t out_bytes, const T in[])
{
while(out_bytes >= sizeof(T))
{
@@ -694,7 +694,7 @@ void copy_out_le(byte out[], size_t out_bytes, const T in[])
}
template<typename T, typename Alloc>
-void copy_out_vec_le(byte out[], size_t out_bytes, const std::vector<T, Alloc>& in)
+void copy_out_vec_le(uint8_t out[], size_t out_bytes, const std::vector<T, Alloc>& in)
{
copy_out_le(out, out_bytes, in.data());
}
diff --git a/src/lib/utils/locking_allocator/locking_allocator.cpp b/src/lib/utils/locking_allocator/locking_allocator.cpp
index 5c87e006d..ce8270d68 100644
--- a/src/lib/utils/locking_allocator/locking_allocator.cpp
+++ b/src/lib/utils/locking_allocator/locking_allocator.cpp
@@ -144,7 +144,7 @@ bool mlock_allocator::deallocate(void* p, size_t num_elems, size_t elem_size)
lock_guard_type<mutex_type> lock(m_mutex);
- const size_t start = static_cast<byte*>(p) - m_pool;
+ const size_t start = static_cast<uint8_t*>(p) - m_pool;
auto comp = [](std::pair<size_t, size_t> x, std::pair<size_t, size_t> y){ return x.first < y.first; };
@@ -198,7 +198,7 @@ mlock_allocator::mlock_allocator()
if(mem_to_lock)
{
- m_pool = static_cast<byte*>(OS::allocate_locked_pages(mem_to_lock));
+ m_pool = static_cast<uint8_t*>(OS::allocate_locked_pages(mem_to_lock));
if(m_pool != nullptr)
{
diff --git a/src/lib/utils/locking_allocator/locking_allocator.h b/src/lib/utils/locking_allocator/locking_allocator.h
index 5c19852c0..806f9fa86 100644
--- a/src/lib/utils/locking_allocator/locking_allocator.h
+++ b/src/lib/utils/locking_allocator/locking_allocator.h
@@ -34,7 +34,7 @@ class BOTAN_DLL mlock_allocator
mutex_type m_mutex;
std::vector<std::pair<size_t, size_t>> m_freelist;
- byte* m_pool = nullptr;
+ uint8_t* m_pool = nullptr;
size_t m_poolsize = 0;
};
diff --git a/src/lib/utils/mem_ops.cpp b/src/lib/utils/mem_ops.cpp
index a0cd3124f..c81d4fac2 100644
--- a/src/lib/utils/mem_ops.cpp
+++ b/src/lib/utils/mem_ops.cpp
@@ -29,7 +29,7 @@ void secure_scrub_memory(void* ptr, size_t n)
static void* (*const volatile memset_ptr)(void*, int, size_t) = std::memset;
(memset_ptr)(ptr, 0, n);
#else
- volatile byte* p = reinterpret_cast<volatile byte*>(ptr);
+ volatile uint8_t* p = reinterpret_cast<volatile uint8_t*>(ptr);
for(size_t i = 0; i != n; ++i)
p[i] = 0;
diff --git a/src/lib/utils/mem_ops.h b/src/lib/utils/mem_ops.h
index b4cf7f76c..13c987526 100644
--- a/src/lib/utils/mem_ops.h
+++ b/src/lib/utils/mem_ops.h
@@ -80,7 +80,7 @@ template<typename T> inline void copy_mem(T* out, const T* in, size_t n)
* @param val the value to set each byte to
*/
template<typename T>
-inline void set_mem(T* ptr, size_t n, byte val)
+inline void set_mem(T* ptr, size_t n, uint8_t val)
{
if(n > 0)
{
@@ -139,25 +139,25 @@ template<typename T> void xor_buf(T out[],
}
template<typename Alloc, typename Alloc2>
-void xor_buf(std::vector<byte, Alloc>& out,
- const std::vector<byte, Alloc2>& in,
+void xor_buf(std::vector<uint8_t, Alloc>& out,
+ const std::vector<uint8_t, Alloc2>& in,
size_t n)
{
xor_buf(out.data(), in.data(), n);
}
template<typename Alloc>
-void xor_buf(std::vector<byte, Alloc>& out,
- const byte* in,
+void xor_buf(std::vector<uint8_t, Alloc>& out,
+ const uint8_t* in,
size_t n)
{
xor_buf(out.data(), in, n);
}
template<typename Alloc, typename Alloc2>
-void xor_buf(std::vector<byte, Alloc>& out,
- const byte* in,
- const std::vector<byte, Alloc2>& in2,
+void xor_buf(std::vector<uint8_t, Alloc>& out,
+ const uint8_t* in,
+ const std::vector<uint8_t, Alloc2>& in2,
size_t n)
{
xor_buf(out.data(), in, in2.data(), n);
diff --git a/src/lib/utils/mul128.h b/src/lib/utils/mul128.h
index fe533c720..d5c89e0dd 100644
--- a/src/lib/utils/mul128.h
+++ b/src/lib/utils/mul128.h
@@ -80,7 +80,7 @@ namespace Botan {
/**
* Perform a 64x64->128 bit multiplication
*/
-inline void mul64x64_128(u64bit a, u64bit b, u64bit* lo, u64bit* hi)
+inline void mul64x64_128(uint64_t a, uint64_t b, uint64_t* lo, uint64_t* hi)
{
#if defined(BOTAN_FAST_64X64_MUL)
BOTAN_FAST_64X64_MUL(a, b, lo, hi);
@@ -92,17 +92,17 @@ inline void mul64x64_128(u64bit a, u64bit b, u64bit* lo, u64bit* hi)
* 64-bit registers/ALU, but no 64x64->128 multiply) or 32-bit CPUs.
*/
const size_t HWORD_BITS = 32;
- const u32bit HWORD_MASK = 0xFFFFFFFF;
+ const uint32_t HWORD_MASK = 0xFFFFFFFF;
- const u32bit a_hi = (a >> HWORD_BITS);
- const u32bit a_lo = (a & HWORD_MASK);
- const u32bit b_hi = (b >> HWORD_BITS);
- const u32bit b_lo = (b & HWORD_MASK);
+ const uint32_t a_hi = (a >> HWORD_BITS);
+ const uint32_t a_lo = (a & HWORD_MASK);
+ const uint32_t b_hi = (b >> HWORD_BITS);
+ const uint32_t b_lo = (b & HWORD_MASK);
- u64bit x0 = static_cast<u64bit>(a_hi) * b_hi;
- u64bit x1 = static_cast<u64bit>(a_lo) * b_hi;
- u64bit x2 = static_cast<u64bit>(a_hi) * b_lo;
- u64bit x3 = static_cast<u64bit>(a_lo) * b_lo;
+ uint64_t x0 = static_cast<uint64_t>(a_hi) * b_hi;
+ uint64_t x1 = static_cast<uint64_t>(a_lo) * b_hi;
+ uint64_t x2 = static_cast<uint64_t>(a_hi) * b_lo;
+ uint64_t x3 = static_cast<uint64_t>(a_lo) * b_lo;
// this cannot overflow as (2^32-1)^2 + 2^32-1 < 2^64-1
x2 += x3 >> HWORD_BITS;
@@ -111,7 +111,7 @@ inline void mul64x64_128(u64bit a, u64bit b, u64bit* lo, u64bit* hi)
x2 += x1;
// propagate the carry if any
- x0 += static_cast<u64bit>(static_cast<bool>(x2 < x1)) << HWORD_BITS;
+ x0 += static_cast<uint64_t>(static_cast<bool>(x2 < x1)) << HWORD_BITS;
*hi = x0 + (x2 >> HWORD_BITS);
*lo = ((x2 & HWORD_MASK) << HWORD_BITS) + (x3 & HWORD_MASK);
diff --git a/src/lib/utils/os_utils.cpp b/src/lib/utils/os_utils.cpp
index d072b2c2b..46ce2a056 100644
--- a/src/lib/utils/os_utils.cpp
+++ b/src/lib/utils/os_utils.cpp
@@ -53,13 +53,13 @@ uint64_t get_processor_timestamp()
{
uint32_t rtc_low = 0, rtc_high = 0;
asm volatile("rdtsc" : "=d" (rtc_high), "=a" (rtc_low));
- return (static_cast<u64bit>(rtc_high) << 32) | rtc_low;
+ return (static_cast<uint64_t>(rtc_high) << 32) | rtc_low;
}
#elif defined(BOTAN_USE_GCC_INLINE_ASM) && defined(BOTAN_TARGET_CPU_IS_PPC_FAMILY)
uint32_t rtc_low = 0, rtc_high = 0;
asm volatile("mftbu %0; mftb %1" : "=r" (rtc_high), "=r" (rtc_low));
- return (static_cast<u64bit>(rtc_high) << 32) | rtc_low;
+ return (static_cast<uint64_t>(rtc_high) << 32) | rtc_low;
#elif defined(BOTAN_USE_GCC_INLINE_ASM) && defined(BOTAN_TARGET_ARCH_IS_ALPHA)
uint64_t rtc = 0;
diff --git a/src/lib/utils/parsing.cpp b/src/lib/utils/parsing.cpp
index e5c8562b5..8fd2ccc52 100644
--- a/src/lib/utils/parsing.cpp
+++ b/src/lib/utils/parsing.cpp
@@ -15,7 +15,7 @@
namespace Botan {
-u32bit to_u32bit(const std::string& str)
+uint32_t to_u32bit(const std::string& str)
{
try
{
@@ -32,7 +32,7 @@ u32bit to_u32bit(const std::string& str)
const auto integerValue = std::stoul(str);
// integerValue might be uint64
- if (integerValue > std::numeric_limits<u32bit>::max())
+ if (integerValue > std::numeric_limits<uint32_t>::max())
{
throw Invalid_Argument("Integer value exceeds 32 bit range: " + std::to_string(integerValue));
}
@@ -51,7 +51,7 @@ u32bit to_u32bit(const std::string& str)
/*
* Convert a string into a time duration
*/
-u32bit timespec_to_u32bit(const std::string& timespec)
+uint32_t timespec_to_u32bit(const std::string& timespec)
{
if(timespec.empty())
return 0;
@@ -59,7 +59,7 @@ u32bit timespec_to_u32bit(const std::string& timespec)
const char suffix = timespec[timespec.size()-1];
std::string value = timespec.substr(0, timespec.size()-1);
- u32bit scale = 1;
+ uint32_t scale = 1;
if(Charset::is_digit(suffix))
value += suffix;
@@ -186,10 +186,10 @@ std::string string_join(const std::vector<std::string>& strs, char delim)
/*
* Parse an ASN.1 OID string
*/
-std::vector<u32bit> parse_asn1_oid(const std::string& oid)
+std::vector<uint32_t> parse_asn1_oid(const std::string& oid)
{
std::string substring;
- std::vector<u32bit> oid_elems;
+ std::vector<uint32_t> oid_elems;
for(auto i = oid.begin(); i != oid.end(); ++i)
{
@@ -258,18 +258,18 @@ bool x500_name_cmp(const std::string& name1, const std::string& name2)
/*
* Convert a decimal-dotted string to binary IP
*/
-u32bit string_to_ipv4(const std::string& str)
+uint32_t string_to_ipv4(const std::string& str)
{
std::vector<std::string> parts = split_on(str, '.');
if(parts.size() != 4)
throw Decoding_Error("Invalid IP string " + str);
- u32bit ip = 0;
+ uint32_t ip = 0;
for(auto part = parts.begin(); part != parts.end(); ++part)
{
- u32bit octet = to_u32bit(*part);
+ uint32_t octet = to_u32bit(*part);
if(octet > 255)
throw Decoding_Error("Invalid IP string " + str);
@@ -283,7 +283,7 @@ u32bit string_to_ipv4(const std::string& str)
/*
* Convert an IP address to decimal-dotted string
*/
-std::string ipv4_to_string(u32bit ip)
+std::string ipv4_to_string(uint32_t ip)
{
std::string str;
diff --git a/src/lib/utils/parsing.h b/src/lib/utils/parsing.h
index c609e821d..71f349126 100644
--- a/src/lib/utils/parsing.h
+++ b/src/lib/utils/parsing.h
@@ -86,7 +86,7 @@ BOTAN_DLL std::string string_join(const std::vector<std::string>& strs,
* @param oid the OID in string form
* @return OID components
*/
-BOTAN_DLL std::vector<u32bit> parse_asn1_oid(const std::string& oid);
+BOTAN_DLL std::vector<uint32_t> parse_asn1_oid(const std::string& oid);
/**
* Compare two names using the X.509 comparison algorithm
@@ -102,28 +102,28 @@ BOTAN_DLL bool x500_name_cmp(const std::string& name1,
* @param str the string to convert
* @return number value of the string
*/
-BOTAN_DLL u32bit to_u32bit(const std::string& str);
+BOTAN_DLL uint32_t to_u32bit(const std::string& str);
/**
* Convert a time specification to a number
* @param timespec the time specification
* @return number of seconds represented by timespec
*/
-BOTAN_DLL u32bit timespec_to_u32bit(const std::string& timespec);
+BOTAN_DLL uint32_t timespec_to_u32bit(const std::string& timespec);
/**
* Convert a string representation of an IPv4 address to a number
* @param ip_str the string representation
* @return integer IPv4 address
*/
-BOTAN_DLL u32bit string_to_ipv4(const std::string& ip_str);
+BOTAN_DLL uint32_t string_to_ipv4(const std::string& ip_str);
/**
* Convert an IPv4 address to a string
* @param ip_addr the IPv4 address to convert
* @return string representation of the IPv4 address
*/
-BOTAN_DLL std::string ipv4_to_string(u32bit ip_addr);
+BOTAN_DLL std::string ipv4_to_string(uint32_t ip_addr);
std::map<std::string, std::string> BOTAN_DLL read_cfg(std::istream& is);
diff --git a/src/lib/utils/simd/simd_32.h b/src/lib/utils/simd/simd_32.h
index c29c55c7a..591e0e9c9 100644
--- a/src/lib/utils/simd/simd_32.h
+++ b/src/lib/utils/simd/simd_32.h
@@ -46,7 +46,7 @@ class SIMD_4x32
#endif
}
- explicit SIMD_4x32(const u32bit B[4])
+ explicit SIMD_4x32(const uint32_t B[4])
{
#if defined(BOTAN_SIMD_USE_SSE2)
m_reg = _mm_loadu_si128(reinterpret_cast<const __m128i*>(B));
@@ -60,7 +60,7 @@ class SIMD_4x32
#endif
}
- SIMD_4x32(u32bit B0, u32bit B1, u32bit B2, u32bit B3)
+ SIMD_4x32(uint32_t B0, uint32_t B1, uint32_t B2, uint32_t B3)
{
#if defined(BOTAN_SIMD_USE_SSE2)
m_reg = _mm_set_epi32(B0, B1, B2, B3);
@@ -74,7 +74,7 @@ class SIMD_4x32
#endif
}
- explicit SIMD_4x32(u32bit B)
+ explicit SIMD_4x32(uint32_t B)
{
#if defined(BOTAN_SIMD_USE_SSE2)
m_reg = _mm_set1_epi32(B);
@@ -93,7 +93,7 @@ class SIMD_4x32
#if defined(BOTAN_SIMD_USE_SSE2)
return SIMD_4x32(_mm_loadu_si128(reinterpret_cast<const __m128i*>(in)));
#elif defined(BOTAN_SIMD_USE_ALTIVEC)
- const u32bit* in_32 = static_cast<const u32bit*>(in);
+ const uint32_t* in_32 = static_cast<const uint32_t*>(in);
__vector unsigned int R0 = vec_ld(0, in_32);
__vector unsigned int R1 = vec_ld(12, in_32);
@@ -119,7 +119,7 @@ class SIMD_4x32
#if defined(BOTAN_SIMD_USE_SSE2)
return load_le(in).bswap();
#elif defined(BOTAN_SIMD_USE_ALTIVEC)
- const u32bit* in_32 = static_cast<const u32bit*>(in);
+ const uint32_t* in_32 = static_cast<const uint32_t*>(in);
__vector unsigned int R0 = vec_ld(0, in_32);
__vector unsigned int R1 = vec_ld(12, in_32);
@@ -146,7 +146,7 @@ class SIMD_4x32
#if defined(BOTAN_SIMD_USE_SSE2)
_mm_storeu_si128(reinterpret_cast<__m128i*>(out), m_reg);
#elif defined(BOTAN_SIMD_USE_ALTIVEC)
- __vector unsigned char perm = vec_lvsl(0, static_cast<u32bit*>(nullptr));
+ __vector unsigned char perm = vec_lvsl(0, static_cast<uint32_t*>(nullptr));
#if defined(BOTAN_TARGET_CPU_IS_BIG_ENDIAN)
perm = vec_xor(perm, vec_splat_u8(3)); // bswap vector
@@ -154,7 +154,7 @@ class SIMD_4x32
union {
__vector unsigned int V;
- u32bit R[4];
+ uint32_t R[4];
} vec;
vec.V = vec_perm(m_reg, m_reg, perm);
@@ -174,7 +174,7 @@ class SIMD_4x32
union {
__vector unsigned int V;
- u32bit R[4];
+ uint32_t R[4];
} vec;
vec.V = m_reg;
@@ -415,7 +415,7 @@ class SIMD_4x32
#elif defined(BOTAN_SIMD_USE_ALTIVEC)
- __vector unsigned char perm = vec_lvsl(0, static_cast<u32bit*>(nullptr));
+ __vector unsigned char perm = vec_lvsl(0, static_cast<uint32_t*>(nullptr));
perm = vec_xor(perm, vec_splat_u8(3));
diff --git a/src/lib/utils/sqlite3/sqlite3.cpp b/src/lib/utils/sqlite3/sqlite3.cpp
index 251cbcdf5..09a964a46 100644
--- a/src/lib/utils/sqlite3/sqlite3.cpp
+++ b/src/lib/utils/sqlite3/sqlite3.cpp
@@ -92,21 +92,21 @@ void Sqlite3_Database::Sqlite3_Statement::bind(int column, std::chrono::system_c
bind(column, timeval);
}
-void Sqlite3_Database::Sqlite3_Statement::bind(int column, const std::vector<byte>& val)
+void Sqlite3_Database::Sqlite3_Statement::bind(int column, const std::vector<uint8_t>& val)
{
int rc = ::sqlite3_bind_blob(m_stmt, column, val.data(), val.size(), SQLITE_TRANSIENT);
if(rc != SQLITE_OK)
throw SQL_DB_Error("sqlite3_bind_text failed, code " + std::to_string(rc));
}
-void Sqlite3_Database::Sqlite3_Statement::bind(int column, const byte* p, size_t len)
+void Sqlite3_Database::Sqlite3_Statement::bind(int column, const uint8_t* p, size_t len)
{
int rc = ::sqlite3_bind_blob(m_stmt, column, p, len, SQLITE_TRANSIENT);
if(rc != SQLITE_OK)
throw SQL_DB_Error("sqlite3_bind_text failed, code " + std::to_string(rc));
}
-std::pair<const byte*, size_t> Sqlite3_Database::Sqlite3_Statement::get_blob(int column)
+std::pair<const uint8_t*, size_t> Sqlite3_Database::Sqlite3_Statement::get_blob(int column)
{
BOTAN_ASSERT(::sqlite3_column_type(m_stmt, 0) == SQLITE_BLOB,
"Return value is a blob");
@@ -116,7 +116,7 @@ std::pair<const byte*, size_t> Sqlite3_Database::Sqlite3_Statement::get_blob(int
BOTAN_ASSERT(session_blob_size >= 0, "Blob size is non-negative");
- return std::make_pair(static_cast<const byte*>(session_blob),
+ return std::make_pair(static_cast<const uint8_t*>(session_blob),
static_cast<size_t>(session_blob_size));
}
diff --git a/src/lib/utils/sqlite3/sqlite3.h b/src/lib/utils/sqlite3/sqlite3.h
index 659e1c487..5f262d8e6 100644
--- a/src/lib/utils/sqlite3/sqlite3.h
+++ b/src/lib/utils/sqlite3/sqlite3.h
@@ -34,10 +34,10 @@ class BOTAN_DLL Sqlite3_Database : public SQL_Database
void bind(int column, const std::string& val) override;
void bind(int column, size_t val) override;
void bind(int column, std::chrono::system_clock::time_point time) override;
- void bind(int column, const std::vector<byte>& val) override;
- void bind(int column, const byte* data, size_t len) override;
+ void bind(int column, const std::vector<uint8_t>& val) override;
+ void bind(int column, const uint8_t* data, size_t len) override;
- std::pair<const byte*, size_t> get_blob(int column) override;
+ std::pair<const uint8_t*, size_t> get_blob(int column) override;
size_t get_size_t(int column) override;
size_t spin() override;
diff --git a/src/lib/utils/stl_util.h b/src/lib/utils/stl_util.h
index 12b749c3c..c05f934c8 100644
--- a/src/lib/utils/stl_util.h
+++ b/src/lib/utils/stl_util.h
@@ -17,12 +17,12 @@
namespace Botan {
-inline std::vector<byte> to_byte_vector(const std::string& s)
+inline std::vector<uint8_t> to_byte_vector(const std::string& s)
{
- return std::vector<byte>(s.cbegin(), s.cend());
+ return std::vector<uint8_t>(s.cbegin(), s.cend());
}
-inline std::string to_string(const secure_vector<byte> &bytes)
+inline std::string to_string(const secure_vector<uint8_t> &bytes)
{
return std::string(bytes.cbegin(), bytes.cend());
}
diff --git a/src/lib/utils/types.h b/src/lib/utils/types.h
index f5754983d..459d8447f 100644
--- a/src/lib/utils/types.h
+++ b/src/lib/utils/types.h
@@ -28,6 +28,11 @@ using std::int32_t;
using std::int64_t;
using std::size_t;
+/*
+* These typedefs are no longer used within the library headers
+* or code. They are kept only for compatability with software
+* written against older versions.
+*/
using byte = std::uint8_t;
using u16bit = std::uint16_t;
using u32bit = std::uint32_t;
diff --git a/src/lib/utils/version.cpp b/src/lib/utils/version.cpp
index 308bf76ab..166e75678 100644
--- a/src/lib/utils/version.cpp
+++ b/src/lib/utils/version.cpp
@@ -52,18 +52,18 @@ const char* version_cstr()
#undef QUOTE
}
-u32bit version_datestamp() { return BOTAN_VERSION_DATESTAMP; }
+uint32_t version_datestamp() { return BOTAN_VERSION_DATESTAMP; }
/*
* 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; }
+uint32_t version_major() { return BOTAN_VERSION_MAJOR; }
+uint32_t version_minor() { return BOTAN_VERSION_MINOR; }
+uint32_t version_patch() { return BOTAN_VERSION_PATCH; }
-std::string runtime_version_check(u32bit major,
- u32bit minor,
- u32bit patch)
+std::string runtime_version_check(uint32_t major,
+ uint32_t minor,
+ uint32_t patch)
{
std::ostringstream oss;
diff --git a/src/lib/utils/version.h b/src/lib/utils/version.h
index 6e9e231bc..834b719af 100644
--- a/src/lib/utils/version.h
+++ b/src/lib/utils/version.h
@@ -34,25 +34,25 @@ BOTAN_DLL const char* version_cstr();
*
* @return release date, or zero if unreleased
*/
-BOTAN_DLL u32bit version_datestamp();
+BOTAN_DLL uint32_t version_datestamp();
/**
* Get the major version number.
* @return major version number
*/
-BOTAN_DLL u32bit version_major();
+BOTAN_DLL uint32_t version_major();
/**
* Get the minor version number.
* @return minor version number
*/
-BOTAN_DLL u32bit version_minor();
+BOTAN_DLL uint32_t version_minor();
/**
* Get the patch number.
* @return patch number
*/
-BOTAN_DLL u32bit version_patch();
+BOTAN_DLL uint32_t version_patch();
/**
* Usable for checking that the DLL version loaded at runtime exactly
@@ -61,9 +61,9 @@ BOTAN_DLL u32bit version_patch();
* appropriate message. Added with 1.11.26.
*/
BOTAN_DLL std::string
-runtime_version_check(u32bit major,
- u32bit minor,
- u32bit patch);
+runtime_version_check(uint32_t major,
+ uint32_t minor,
+ uint32_t patch);
/*
* Macros for compile-time version checks