aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJack Lloyd <[email protected]>2018-03-01 17:11:47 -0500
committerJack Lloyd <[email protected]>2018-03-01 17:11:47 -0500
commitfb44fe4f9ac094a7f223ef337796c3c4a2ed933f (patch)
treecebeb970abd6d26f6916e0070f3c45371554a650
parenta5a9ca8d296d0b31de4c03b7dff2b401e6a6ec45 (diff)
Use BOTAN_DEFAULT_BUFFER_SIZE instead of DEFAULT_BUFFERSIZE
-rw-r--r--src/lib/asn1/ber_dec.cpp2
-rw-r--r--src/lib/filters/algo_filt.cpp8
-rw-r--r--src/lib/filters/fd_unix/fd_unix.cpp4
-rw-r--r--src/lib/filters/pipe_io.cpp4
-rw-r--r--src/lib/filters/pipe_rw.cpp4
-rw-r--r--src/lib/filters/secqueue.cpp2
-rw-r--r--src/lib/utils/types.h5
7 files changed, 12 insertions, 17 deletions
diff --git a/src/lib/asn1/ber_dec.cpp b/src/lib/asn1/ber_dec.cpp
index ca0056937..28443f2d8 100644
--- a/src/lib/asn1/ber_dec.cpp
+++ b/src/lib/asn1/ber_dec.cpp
@@ -109,7 +109,7 @@ size_t decode_length(DataSource* ber, size_t& field_size, size_t allow_indef)
*/
size_t find_eoc(DataSource* ber, size_t allow_indef)
{
- secure_vector<uint8_t> buffer(DEFAULT_BUFFERSIZE), data;
+ secure_vector<uint8_t> buffer(BOTAN_DEFAULT_BUFFER_SIZE), data;
while(true)
{
diff --git a/src/lib/filters/algo_filt.cpp b/src/lib/filters/algo_filt.cpp
index 099c413d3..721f3a471 100644
--- a/src/lib/filters/algo_filt.cpp
+++ b/src/lib/filters/algo_filt.cpp
@@ -13,26 +13,26 @@ namespace Botan {
#if defined(BOTAN_HAS_STREAM_CIPHER)
StreamCipher_Filter::StreamCipher_Filter(StreamCipher* cipher) :
- m_buffer(DEFAULT_BUFFERSIZE),
+ m_buffer(BOTAN_DEFAULT_BUFFER_SIZE),
m_cipher(cipher)
{
}
StreamCipher_Filter::StreamCipher_Filter(StreamCipher* cipher, const SymmetricKey& key) :
- m_buffer(DEFAULT_BUFFERSIZE),
+ m_buffer(BOTAN_DEFAULT_BUFFER_SIZE),
m_cipher(cipher)
{
m_cipher->set_key(key);
}
StreamCipher_Filter::StreamCipher_Filter(const std::string& sc_name) :
- m_buffer(DEFAULT_BUFFERSIZE),
+ m_buffer(BOTAN_DEFAULT_BUFFER_SIZE),
m_cipher(StreamCipher::create_or_throw(sc_name))
{
}
StreamCipher_Filter::StreamCipher_Filter(const std::string& sc_name, const SymmetricKey& key) :
- m_buffer(DEFAULT_BUFFERSIZE),
+ m_buffer(BOTAN_DEFAULT_BUFFER_SIZE),
m_cipher(StreamCipher::create_or_throw(sc_name))
{
m_cipher->set_key(key);
diff --git a/src/lib/filters/fd_unix/fd_unix.cpp b/src/lib/filters/fd_unix/fd_unix.cpp
index 5ce29e875..657dde3b4 100644
--- a/src/lib/filters/fd_unix/fd_unix.cpp
+++ b/src/lib/filters/fd_unix/fd_unix.cpp
@@ -16,7 +16,7 @@ namespace Botan {
*/
int operator<<(int fd, Pipe& pipe)
{
- secure_vector<uint8_t> buffer(DEFAULT_BUFFERSIZE);
+ secure_vector<uint8_t> buffer(BOTAN_DEFAULT_BUFFER_SIZE);
while(pipe.remaining())
{
size_t got = pipe.read(buffer.data(), buffer.size());
@@ -39,7 +39,7 @@ int operator<<(int fd, Pipe& pipe)
*/
int operator>>(int fd, Pipe& pipe)
{
- secure_vector<uint8_t> buffer(DEFAULT_BUFFERSIZE);
+ secure_vector<uint8_t> buffer(BOTAN_DEFAULT_BUFFER_SIZE);
while(true)
{
ssize_t ret = ::read(fd, buffer.data(), buffer.size());
diff --git a/src/lib/filters/pipe_io.cpp b/src/lib/filters/pipe_io.cpp
index f38a7d417..a909cba72 100644
--- a/src/lib/filters/pipe_io.cpp
+++ b/src/lib/filters/pipe_io.cpp
@@ -16,7 +16,7 @@ namespace Botan {
*/
std::ostream& operator<<(std::ostream& stream, Pipe& pipe)
{
- secure_vector<uint8_t> buffer(DEFAULT_BUFFERSIZE);
+ secure_vector<uint8_t> buffer(BOTAN_DEFAULT_BUFFER_SIZE);
while(stream.good() && pipe.remaining())
{
const size_t got = pipe.read(buffer.data(), buffer.size());
@@ -32,7 +32,7 @@ std::ostream& operator<<(std::ostream& stream, Pipe& pipe)
*/
std::istream& operator>>(std::istream& stream, Pipe& pipe)
{
- secure_vector<uint8_t> buffer(DEFAULT_BUFFERSIZE);
+ secure_vector<uint8_t> buffer(BOTAN_DEFAULT_BUFFER_SIZE);
while(stream.good())
{
stream.read(cast_uint8_ptr_to_char(buffer.data()), buffer.size());
diff --git a/src/lib/filters/pipe_rw.cpp b/src/lib/filters/pipe_rw.cpp
index 082a215da..dc7b97372 100644
--- a/src/lib/filters/pipe_rw.cpp
+++ b/src/lib/filters/pipe_rw.cpp
@@ -60,7 +60,7 @@ void Pipe::write(uint8_t input)
*/
void Pipe::write(DataSource& source)
{
- secure_vector<uint8_t> buffer(DEFAULT_BUFFERSIZE);
+ secure_vector<uint8_t> buffer(BOTAN_DEFAULT_BUFFER_SIZE);
while(!source.end_of_data())
{
size_t got = source.read(buffer.data(), buffer.size());
@@ -110,7 +110,7 @@ secure_vector<uint8_t> Pipe::read_all(message_id msg)
std::string Pipe::read_all_as_string(message_id msg)
{
msg = ((msg != DEFAULT_MESSAGE) ? msg : default_msg());
- secure_vector<uint8_t> buffer(DEFAULT_BUFFERSIZE);
+ secure_vector<uint8_t> buffer(BOTAN_DEFAULT_BUFFER_SIZE);
std::string str;
str.reserve(remaining(msg));
diff --git a/src/lib/filters/secqueue.cpp b/src/lib/filters/secqueue.cpp
index 4b1a263a8..1c8d28149 100644
--- a/src/lib/filters/secqueue.cpp
+++ b/src/lib/filters/secqueue.cpp
@@ -17,7 +17,7 @@ namespace Botan {
class SecureQueueNode final
{
public:
- SecureQueueNode() : m_buffer(DEFAULT_BUFFERSIZE)
+ SecureQueueNode() : m_buffer(BOTAN_DEFAULT_BUFFER_SIZE)
{ m_next = nullptr; m_start = m_end = 0; }
~SecureQueueNode() { m_next = nullptr; m_start = m_end = 0; }
diff --git a/src/lib/utils/types.h b/src/lib/utils/types.h
index 10650342b..51f0e3bc3 100644
--- a/src/lib/utils/types.h
+++ b/src/lib/utils/types.h
@@ -92,11 +92,6 @@ using u32bit = std::uint32_t;
using u64bit = std::uint64_t;
using s32bit = std::int32_t;
-/**
-* A default buffer size; typically a memory page
-*/
-static const size_t DEFAULT_BUFFERSIZE = BOTAN_DEFAULT_BUFFER_SIZE;
-
#if (BOTAN_MP_WORD_BITS == 8)
typedef uint8_t word;
#elif (BOTAN_MP_WORD_BITS == 16)