aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/lib/x509/x509_crl.cpp2
-rw-r--r--src/tests/test_tss.cpp6
-rw-r--r--src/tests/tests.cpp16
-rw-r--r--src/tests/tests.h4
4 files changed, 24 insertions, 4 deletions
diff --git a/src/lib/x509/x509_crl.cpp b/src/lib/x509/x509_crl.cpp
index 47742c1da..1b5df1a08 100644
--- a/src/lib/x509/x509_crl.cpp
+++ b/src/lib/x509/x509_crl.cpp
@@ -239,7 +239,7 @@ const std::vector<uint8_t>& X509_CRL::authority_key_id() const
*/
uint32_t X509_CRL::crl_number() const
{
- return data().m_crl_number;
+ return static_cast<uint32_t>(data().m_crl_number);
}
/*
diff --git a/src/tests/test_tss.cpp b/src/tests/test_tss.cpp
index 139e2087d..a4aed6b47 100644
--- a/src/tests/test_tss.cpp
+++ b/src/tests/test_tss.cpp
@@ -57,7 +57,7 @@ class TSS_Recovery_Tests final : public Text_Based_Test
auto reconstructed_secret = Botan::RTSS_Share::reconstruct(shares);
result.test_eq("Reconstructed secret correctly from reduced shares", reconstructed_secret, input);
}
- catch(Botan::Decoding_Error& e)
+ catch(Botan::Decoding_Error&)
{
result.test_failure("Reconstruction failed with share count " + std::to_string(shares.size()));
}
@@ -104,8 +104,8 @@ class TSS_Generation_Tests final : public Text_Based_Test
const std::vector<uint8_t> input = vars.get_req_bin("Input");
const std::vector<uint8_t> id = vars.get_req_bin("Id");
const std::vector<uint8_t> rng_data = vars.get_req_bin("RNG");
- const size_t N = vars.get_req_sz("N");
- const size_t M = vars.get_req_sz("M");
+ const uint8_t N = vars.get_req_u8("N");
+ const uint8_t M = vars.get_req_u8("M");
const std::string hash = vars.get_req_str("Hash");
const std::vector<std::vector<uint8_t>> expected_shares = vars.get_req_bin_list("Shares");
diff --git a/src/tests/tests.cpp b/src/tests/tests.cpp
index 65808d1a5..c99edf795 100644
--- a/src/tests/tests.cpp
+++ b/src/tests/tests.cpp
@@ -729,6 +729,22 @@ size_t VarMap::get_req_sz(const std::string& key) const
return Botan::to_u32bit(i->second);
}
+uint8_t VarMap::get_req_u8(const std::string& key) const
+ {
+ const size_t s = this->get_req_sz(key);
+ if(s > 256)
+ {
+ throw Test_Error("Invalid " + key + " expected uint8_t got " + std::to_string(s));
+ }
+ return static_cast<uint8_t>(s);
+ }
+
+uint32_t VarMap::get_req_u32(const std::string& key) const
+ {
+ return static_cast<uint32_t>(get_req_sz(key));
+ }
+
+
size_t VarMap::get_opt_sz(const std::string& key, const size_t def_value) const
{
auto i = m_vars.find(key);
diff --git a/src/tests/tests.h b/src/tests/tests.h
index d21acf6f9..02e1380c5 100644
--- a/src/tests/tests.h
+++ b/src/tests/tests.h
@@ -542,6 +542,10 @@ class VarMap
const std::string& def_value) const;
size_t get_req_sz(const std::string& key) const;
+
+ uint8_t get_req_u8(const std::string& key) const;
+ uint32_t get_req_u32(const std::string& key) const;
+
size_t get_opt_sz(const std::string& key, const size_t def_value) const;
uint64_t get_opt_u64(const std::string& key, const uint64_t def_value) const;