aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--botan_version.py2
-rw-r--r--checks/validate.dat2
-rw-r--r--src/algo_base/algo_base.h7
-rw-r--r--src/filters/bzip2/bzip2.cpp2
-rw-r--r--src/filters/zlib/zlib.cpp2
-rw-r--r--src/hash/par_hash/par_hash.cpp40
-rw-r--r--src/rng/hmac_rng/hmac_rng.cpp4
-rw-r--r--src/utils/parsing.cpp17
-rw-r--r--src/utils/parsing.h9
-rw-r--r--src/utils/stl_util.h4
10 files changed, 57 insertions, 32 deletions
diff --git a/botan_version.py b/botan_version.py
index a03dd9da7..bc8268364 100644
--- a/botan_version.py
+++ b/botan_version.py
@@ -1,6 +1,6 @@
release_major = 1
-release_minor = 10
+release_minor = 99
release_patch = 0
release_so_abi_rev = 0
diff --git a/checks/validate.dat b/checks/validate.dat
index 6f264ea74..78b4ab3de 100644
--- a/checks/validate.dat
+++ b/checks/validate.dat
@@ -67665,6 +67665,8 @@ DC37E008CF9EE69BF11F00ED9ABA26901DD7C28CDEC066CC6AF42E40F82F3A1E\
[Parallel(MD5,SHA-1)]
:D41D8CD98F00B204E9800998ECF8427EDA39A3EE5E6B4B0D3255BFEF95601890AFD80709
+61:0CC175B9C0F1B6A831C399E26977266186F7E437FAA5A7FCE15D1DDCB9EAEAEA377667B8
+
[Parallel(SHA-160,Tiger(24,3))]
:DA39A3EE5E6B4B0D3255BFEF95601890AFD807093293AC630\
C13F0245F92BBB1766E16167A4E58492DDE73F3
diff --git a/src/algo_base/algo_base.h b/src/algo_base/algo_base.h
index 813216a36..f757a9a83 100644
--- a/src/algo_base/algo_base.h
+++ b/src/algo_base/algo_base.h
@@ -19,7 +19,6 @@ namespace Botan {
class BOTAN_DLL Algorithm
{
public:
-
/**
* Zeroize internal state
*/
@@ -31,10 +30,10 @@ class BOTAN_DLL Algorithm
virtual std::string name() const = 0;
Algorithm() {}
+ Algorithm(const Algorithm&) = delete;
+ Algorithm& operator=(const Algorithm&) = delete;
+
virtual ~Algorithm() {}
- private:
- Algorithm(const Algorithm&) {}
- Algorithm& operator=(const Algorithm&) { return (*this); }
};
}
diff --git a/src/filters/bzip2/bzip2.cpp b/src/filters/bzip2/bzip2.cpp
index a291c1173..18a53558c 100644
--- a/src/filters/bzip2/bzip2.cpp
+++ b/src/filters/bzip2/bzip2.cpp
@@ -48,7 +48,7 @@ void* bzip_malloc(void* info_ptr, int n, int size)
void bzip_free(void* info_ptr, void* ptr)
{
Bzip_Alloc_Info* info = static_cast<Bzip_Alloc_Info*>(info_ptr);
- std::map<void*, size_t>::const_iterator i = info->current_allocs.find(ptr);
+ auto i = info->current_allocs.find(ptr);
if(i == info->current_allocs.end())
throw Invalid_Argument("bzip_free: Got pointer not allocated by us");
info->alloc->deallocate(ptr, i->second);
diff --git a/src/filters/zlib/zlib.cpp b/src/filters/zlib/zlib.cpp
index 0f88b5558..28d08df52 100644
--- a/src/filters/zlib/zlib.cpp
+++ b/src/filters/zlib/zlib.cpp
@@ -47,7 +47,7 @@ void* zlib_malloc(void* info_ptr, unsigned int n, unsigned int size)
void zlib_free(void* info_ptr, void* ptr)
{
Zlib_Alloc_Info* info = static_cast<Zlib_Alloc_Info*>(info_ptr);
- std::map<void*, size_t>::const_iterator i = info->current_allocs.find(ptr);
+ auto i = info->current_allocs.find(ptr);
if(i == info->current_allocs.end())
throw Invalid_Argument("zlib_free: Got pointer not allocated by us");
info->alloc->deallocate(ptr, i->second);
diff --git a/src/hash/par_hash/par_hash.cpp b/src/hash/par_hash/par_hash.cpp
index a95ba36b9..df47780ef 100644
--- a/src/hash/par_hash/par_hash.cpp
+++ b/src/hash/par_hash/par_hash.cpp
@@ -6,6 +6,7 @@
*/
#include <botan/par_hash.h>
+#include <botan/parsing.h>
namespace Botan {
@@ -14,8 +15,8 @@ namespace Botan {
*/
void Parallel::add_data(const byte input[], size_t length)
{
- for(auto hash = hashes.begin(); hash != hashes.end(); ++hash)
- (*hash)->update(input, length);
+ for(auto hash : hashes)
+ hash->update(input, length);
}
/*
@@ -25,10 +26,10 @@ void Parallel::final_result(byte out[])
{
u32bit offset = 0;
- for(auto hash = hashes.begin(); hash != hashes.end(); ++hash)
+ for(auto hash : hashes)
{
- (*hash)->final(out + offset);
- offset += (*hash)->output_length();
+ hash->final(out + offset);
+ offset += hash->output_length();
}
}
@@ -38,8 +39,9 @@ void Parallel::final_result(byte out[])
size_t Parallel::output_length() const
{
size_t sum = 0;
- for(size_t i = 0; i != hashes.size(); ++i)
- sum += hashes[i]->output_length();
+
+ for(auto hash : hashes)
+ sum += hash->output_length();
return sum;
}
@@ -48,16 +50,12 @@ size_t Parallel::output_length() const
*/
std::string Parallel::name() const
{
- std::string hash_names;
+ std::vector<std::string> names;
- for(auto hash = hashes.begin(); hash != hashes.end(); ++hash)
- {
- if(hash != hashes.begin())
- hash_names += ',';
- hash_names += (*hash)->name();
- }
+ for(auto hash : hashes)
+ names.push_back(hash->name());
- return "Parallel(" + hash_names + ")";
+ return "Parallel(" + string_join(names, ',') + ")";
}
/*
@@ -67,8 +65,8 @@ HashFunction* Parallel::clone() const
{
std::vector<HashFunction*> hash_copies;
- for(auto hash = hashes.begin(); hash != hashes.end(); ++hash)
- hash_copies.push_back((*hash)->clone());
+ for(auto hash : hashes)
+ hash_copies.push_back(hash->clone());
return new Parallel(hash_copies);
}
@@ -78,8 +76,8 @@ HashFunction* Parallel::clone() const
*/
void Parallel::clear()
{
- for(auto hash = hashes.begin(); hash != hashes.end(); ++hash)
- (*hash)->clear();
+ for(auto hash : hashes)
+ hash->clear();
}
/*
@@ -95,8 +93,8 @@ Parallel::Parallel(const std::vector<HashFunction*>& hash_in) :
*/
Parallel::~Parallel()
{
- for(auto hash = hashes.begin(); hash != hashes.end(); ++hash)
- delete (*hash);
+ for(auto hash : hashes)
+ delete hash;
}
}
diff --git a/src/rng/hmac_rng/hmac_rng.cpp b/src/rng/hmac_rng/hmac_rng.cpp
index 4f6a90565..6911a3af5 100644
--- a/src/rng/hmac_rng/hmac_rng.cpp
+++ b/src/rng/hmac_rng/hmac_rng.cpp
@@ -215,8 +215,8 @@ HMAC_RNG::~HMAC_RNG()
delete extractor;
delete prf;
- for(auto i = entropy_sources.begin(); i != entropy_sources.end(); ++i)
- delete *i;
+ for(auto src : entropy_sources)
+ delete src;
counter = 0;
}
diff --git a/src/utils/parsing.cpp b/src/utils/parsing.cpp
index ff0718bb0..f4f65dcb2 100644
--- a/src/utils/parsing.cpp
+++ b/src/utils/parsing.cpp
@@ -128,6 +128,23 @@ std::vector<std::string> split_on(const std::string& str, char delim)
}
/*
+* Join a string
+*/
+std::string string_join(const std::vector<std::string>& strs, char delim)
+ {
+ std::string out = "";
+
+ for(size_t i = 0; i != strs.size(); ++i)
+ {
+ if(i != 0)
+ out += delim;
+ out += strs[i];
+ }
+
+ return out;
+ }
+
+/*
* Parse an ASN.1 OID string
*/
std::vector<u32bit> parse_asn1_oid(const std::string& oid)
diff --git a/src/utils/parsing.h b/src/utils/parsing.h
index 98dcd82b5..2d53551bf 100644
--- a/src/utils/parsing.h
+++ b/src/utils/parsing.h
@@ -32,6 +32,15 @@ BOTAN_DLL std::vector<std::string> split_on(
const std::string& str, char delim);
/**
+* Join a string
+* @param strs strings to join
+* @param delim the delimitor
+* @return string joined by delim
+*/
+BOTAN_DLL std::string string_join(const std::vector<std::string>& strs,
+ char delim);
+
+/**
* Parse an ASN.1 OID
* @param oid the OID in string form
* @return OID components
diff --git a/src/utils/stl_util.h b/src/utils/stl_util.h
index 0eb078244..6e85839a5 100644
--- a/src/utils/stl_util.h
+++ b/src/utils/stl_util.h
@@ -24,7 +24,7 @@ inline V search_map(const std::map<K, V>& mapping,
const K& key,
const V& null_result = V())
{
- typename std::map<K, V>::const_iterator i = mapping.find(key);
+ auto i = mapping.find(key);
if(i == mapping.end())
return null_result;
return i->second;
@@ -34,7 +34,7 @@ template<typename K, typename V, typename R>
inline R search_map(const std::map<K, V>& mapping, const K& key,
const R& null_result, const R& found_result)
{
- typename std::map<K, V>::const_iterator i = mapping.find(key);
+ auto i = mapping.find(key);
if(i == mapping.end())
return null_result;
return found_result;