aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib
diff options
context:
space:
mode:
authorJack Lloyd <[email protected]>2022-01-27 18:02:23 -0500
committerJack Lloyd <[email protected]>2022-01-27 18:02:23 -0500
commit05543ea58f85abfdea72f4617c753b9466f8e202 (patch)
treebe1061790dc933010a8148aae774b131ee8279a7 /src/lib
parentd98e3b68fdf8f01a9a8b7cc6c62a72a17ed4800d (diff)
parent92cbbb41a3c605931b8ca668d4908afbe0b7b517 (diff)
Merge GH #2889 Fix some Clang and C++20 warnings
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/block/aria/aria.cpp2
-rw-r--r--src/lib/ffi/ffi.h4
-rw-r--r--src/lib/kdf/kdf2/kdf2.h2
-rw-r--r--src/lib/misc/zfec/zfec.h2
-rw-r--r--src/lib/prov/pkcs11/p11_object.cpp6
-rw-r--r--src/lib/prov/pkcs11/p11_object.h2
-rw-r--r--src/lib/pubkey/mce/gf2m_rootfind_dcmp.cpp5
-rw-r--r--src/lib/pubkey/mce/polyn_gf2m.cpp10
-rw-r--r--src/lib/pubkey/mce/polyn_gf2m.h2
-rw-r--r--src/lib/pubkey/xmss/xmss_common_ops.h4
-rw-r--r--src/lib/stream/ctr/ctr.h2
-rw-r--r--src/lib/utils/loadstor.h3
-rw-r--r--src/lib/utils/mem_ops.cpp2
-rw-r--r--src/lib/utils/mem_ops.h2
14 files changed, 24 insertions, 24 deletions
diff --git a/src/lib/block/aria/aria.cpp b/src/lib/block/aria/aria.cpp
index 764dcf03c..5326cf1a9 100644
--- a/src/lib/block/aria/aria.cpp
+++ b/src/lib/block/aria/aria.cpp
@@ -218,7 +218,7 @@ void transform(const uint8_t in[], uint8_t out[], size_t blocks,
volatile uint32_t Z = 0x9C1DADCF;
for(size_t i = 0; i < 256; i += cache_line_size)
{
- Z |= make_uint32(S1[i], S2[i], X1[i], X2[i]);
+ Z = Z | make_uint32(S1[i], S2[i], X1[i], X2[i]);
}
const size_t ROUNDS = (KS.size() / 4) - 1;
diff --git a/src/lib/ffi/ffi.h b/src/lib/ffi/ffi.h
index a49437440..4dbc218c6 100644
--- a/src/lib/ffi/ffi.h
+++ b/src/lib/ffi/ffi.h
@@ -213,11 +213,11 @@ BOTAN_PUBLIC_API(2,0) int botan_rng_init(botan_rng_t* rng, const char* rng_type)
/**
* Initialize a custom random number generator from a set of callback functions
-* @param rng rng object
+* @param rng_out rng object to create
* @param rng_name name of the rng
* @param context An application-specific context passed to the callback functions
* @param get_cb Callback for getting random bytes from the rng, return 0 for success
-* @param add_entry_cb Callback for adding entropy to the rng, return 0 for success, may be NULL
+* @param add_entropy_cb Callback for adding entropy to the rng, return 0 for success, may be NULL
* @param destroy_cb Callback called when rng is destroyed, may be NULL
*/
BOTAN_PUBLIC_API(3,0) int botan_rng_init_custom(botan_rng_t* rng_out, const char* rng_name, void* context,
diff --git a/src/lib/kdf/kdf2/kdf2.h b/src/lib/kdf/kdf2/kdf2.h
index 3d9925cbf..f9087838e 100644
--- a/src/lib/kdf/kdf2/kdf2.h
+++ b/src/lib/kdf/kdf2/kdf2.h
@@ -29,7 +29,7 @@ class KDF2 final : public KDF
const uint8_t label[], size_t label_len) const override;
/**
- * @param h hash function to use
+ * @param hash the hash function to use
*/
explicit KDF2(std::unique_ptr<HashFunction> hash) :
m_hash(std::move(hash))
diff --git a/src/lib/misc/zfec/zfec.h b/src/lib/misc/zfec/zfec.h
index 9b22447bc..09ccb55c7 100644
--- a/src/lib/misc/zfec/zfec.h
+++ b/src/lib/misc/zfec/zfec.h
@@ -37,7 +37,7 @@ class BOTAN_PUBLIC_API(3,0) ZFEC
* @param K the number of shares needed for recovery
* @param N the number of shares generated
*/
- ZFEC(size_t K, size_t n);
+ ZFEC(size_t K, size_t N);
size_t recovery_threshold() const { return m_K; }
size_t generated_shares() const { return m_N; }
diff --git a/src/lib/prov/pkcs11/p11_object.cpp b/src/lib/prov/pkcs11/p11_object.cpp
index e708d7555..9676dc050 100644
--- a/src/lib/prov/pkcs11/p11_object.cpp
+++ b/src/lib/prov/pkcs11/p11_object.cpp
@@ -29,13 +29,13 @@ void AttributeContainer::add_class(ObjectClass object_class)
void AttributeContainer::add_string(AttributeType attribute, const std::string& value)
{
m_strings.push_back(value);
- add_attribute(attribute, reinterpret_cast<const uint8_t*>(m_strings.back().data()), static_cast<uint32_t>(value.size()));
+ add_attribute(attribute, reinterpret_cast<const uint8_t*>(m_strings.back().data()), static_cast<Ulong>(value.size()));
}
void AttributeContainer::add_binary(AttributeType attribute, const uint8_t* value, size_t length)
{
m_vectors.push_back(secure_vector<uint8_t>(value, value + length));
- add_attribute(attribute, reinterpret_cast< const uint8_t* >(m_vectors.back().data()), static_cast<uint32_t>(length));
+ add_attribute(attribute, reinterpret_cast< const uint8_t* >(m_vectors.back().data()), static_cast<Ulong>(length));
}
void AttributeContainer::add_bool(AttributeType attribute, bool value)
@@ -44,7 +44,7 @@ void AttributeContainer::add_bool(AttributeType attribute, bool value)
add_attribute(attribute, reinterpret_cast< uint8_t* >(&m_numerics.back()), sizeof(Bbool));
}
-void AttributeContainer::add_attribute(AttributeType attribute, const uint8_t* value, uint32_t size)
+void AttributeContainer::add_attribute(AttributeType attribute, const uint8_t* value, Ulong size)
{
bool exists = false;
// check if the attribute has been added already
diff --git a/src/lib/prov/pkcs11/p11_object.h b/src/lib/prov/pkcs11/p11_object.h
index a0da1b5ca..b4a42ac6a 100644
--- a/src/lib/prov/pkcs11/p11_object.h
+++ b/src/lib/prov/pkcs11/p11_object.h
@@ -114,7 +114,7 @@ class BOTAN_PUBLIC_API(2,0) AttributeContainer
protected:
/// Add an attribute with the given value and size to the attribute collection `m_attributes`
- void add_attribute(AttributeType attribute, const uint8_t* value, uint32_t size);
+ void add_attribute(AttributeType attribute, const uint8_t* value, Ulong size);
private:
std::vector<Attribute> m_attributes;
diff --git a/src/lib/pubkey/mce/gf2m_rootfind_dcmp.cpp b/src/lib/pubkey/mce/gf2m_rootfind_dcmp.cpp
index 409393562..3ebc10b0c 100644
--- a/src/lib/pubkey/mce/gf2m_rootfind_dcmp.cpp
+++ b/src/lib/pubkey/mce/gf2m_rootfind_dcmp.cpp
@@ -23,10 +23,11 @@ void patch_root_array(gf2m res_root_arr[],
volatile gf2m cond_mask = (root_pos == res_root_arr_len);
cond_mask = expand_mask_16bit(cond_mask);
cond_mask = ~cond_mask; /* now cond = 1 if not enough roots */
- patch_elem &= cond_mask;
+ patch_elem = patch_elem & cond_mask;
for(size_t i = 0; i < res_root_arr_len; i++)
{
- gf2m masked_patch_elem = (patch_elem++) & cond_mask;
+ patch_elem = patch_elem + 1;
+ gf2m masked_patch_elem = patch_elem & cond_mask;
res_root_arr[i] ^= masked_patch_elem++;
}
}
diff --git a/src/lib/pubkey/mce/polyn_gf2m.cpp b/src/lib/pubkey/mce/polyn_gf2m.cpp
index 53b21d530..75381b36b 100644
--- a/src/lib/pubkey/mce/polyn_gf2m.cpp
+++ b/src/lib/pubkey/mce/polyn_gf2m.cpp
@@ -426,7 +426,7 @@ size_t polyn_gf2m::degppf(const polyn_gf2m& g)
return result;
}
-void polyn_gf2m::patchup_deg_secure( uint32_t trgt_deg, volatile gf2m patch_elem)
+void polyn_gf2m::patchup_deg_secure( uint32_t trgt_deg, gf2m patch_elem)
{
uint32_t i;
if(this->coeff.size() < trgt_deg)
@@ -526,11 +526,11 @@ std::pair<polyn_gf2m, polyn_gf2m> polyn_gf2m::eea_with_coefficients( const polyn
/* t odd */
cond1 = r0.get_degree() < break_deg;
cond2 = u0.get_degree() < break_deg - 1;
- cond1 &= cond2;
+ cond1 = cond1 & cond2;
}
/* expand cond1 to a full mask */
gf2m mask = generate_gf2m_mask(cond1);
- fake_elem &= mask;
+ fake_elem = fake_elem & mask;
r0.patchup_deg_secure(trgt_deg, fake_elem);
}
if(break_deg == 1) /* syndrome inversion */
@@ -711,8 +711,8 @@ std::vector<polyn_gf2m> polyn_gf2m::sqrt_mod_init(const polyn_gf2m & g)
for(i = 1; i < nb_polyn_sqrt_mat; i++)
{
result[i] = result[i - 1];
- result[i].poly_shiftmod(g),
- result[i].get_degree();
+ result[i].poly_shiftmod(g);
+ result[i].get_degree();
}
return result;
diff --git a/src/lib/pubkey/mce/polyn_gf2m.h b/src/lib/pubkey/mce/polyn_gf2m.h
index f3827ee39..5c8b3e75c 100644
--- a/src/lib/pubkey/mce/polyn_gf2m.h
+++ b/src/lib/pubkey/mce/polyn_gf2m.h
@@ -129,7 +129,7 @@ class polyn_gf2m
const polyn_gf2m & g,
int break_deg);
- void patchup_deg_secure( uint32_t trgt_deg, volatile gf2m patch_elem);
+ void patchup_deg_secure( uint32_t trgt_deg, gf2m patch_elem);
private:
diff --git a/src/lib/pubkey/xmss/xmss_common_ops.h b/src/lib/pubkey/xmss/xmss_common_ops.h
index 9a3223df4..cbf65414b 100644
--- a/src/lib/pubkey/xmss/xmss_common_ops.h
+++ b/src/lib/pubkey/xmss/xmss_common_ops.h
@@ -41,7 +41,7 @@ class XMSS_Common_Ops
* @param[in] seed The seed for G.
* @param[in] hash Instance of XMSS_Hash, that may only by the thread
* executing generate_public_key.
- * @param[in] params
+ * @param[in] params parameters
**/
static void randomize_tree_hash(
secure_vector<uint8_t>& result,
@@ -67,7 +67,7 @@ class XMSS_Common_Ops
* @param[in] seed The seed generated during the public key generation.
* @param[in] hash Instance of XMSS_Hash, that may only be used by the
* thread executing create_l_tree.
- * @param[in] params
+ * @param[in] params parameters
**/
static void create_l_tree(secure_vector<uint8_t>& result,
wots_keysig_t pk,
diff --git a/src/lib/stream/ctr/ctr.h b/src/lib/stream/ctr/ctr.h
index f27fce2d4..1721dfb8c 100644
--- a/src/lib/stream/ctr/ctr.h
+++ b/src/lib/stream/ctr/ctr.h
@@ -38,7 +38,7 @@ class CTR_BE final : public StreamCipher
/**
* @param cipher the block cipher to use
*/
- explicit CTR_BE(std::unique_ptr<BlockCipher>);
+ explicit CTR_BE(std::unique_ptr<BlockCipher> cipher);
CTR_BE(std::unique_ptr<BlockCipher> cipher, size_t ctr_size);
diff --git a/src/lib/utils/loadstor.h b/src/lib/utils/loadstor.h
index 5824c1218..809a71992 100644
--- a/src/lib/utils/loadstor.h
+++ b/src/lib/utils/loadstor.h
@@ -45,9 +45,8 @@ template<typename T> inline constexpr uint8_t get_byte_var(size_t byte_num, T in
/**
* Byte extraction
-* @param byte_num which byte to extract, 0 == highest byte
* @param input the value to extract from
-* @return byte byte_num of input
+* @return byte byte number B of input
*/
template<size_t B, typename T> inline constexpr uint8_t get_byte(T input)
{
diff --git a/src/lib/utils/mem_ops.cpp b/src/lib/utils/mem_ops.cpp
index 21f44fb26..416497086 100644
--- a/src/lib/utils/mem_ops.cpp
+++ b/src/lib/utils/mem_ops.cpp
@@ -69,7 +69,7 @@ uint8_t ct_compare_u8(const uint8_t x[],
volatile uint8_t difference = 0;
for(size_t i = 0; i != len; ++i)
- difference |= (x[i] ^ y[i]);
+ difference = difference | (x[i] ^ y[i]);
return CT::Mask<uint8_t>::is_zero(difference).value();
}
diff --git a/src/lib/utils/mem_ops.h b/src/lib/utils/mem_ops.h
index b99ec4bf0..7530d5f88 100644
--- a/src/lib/utils/mem_ops.h
+++ b/src/lib/utils/mem_ops.h
@@ -212,7 +212,7 @@ template<typename T> inline bool same_mem(const T* p1, const T* p2, size_t n)
volatile T difference = 0;
for(size_t i = 0; i != n; ++i)
- difference |= (p1[i] ^ p2[i]);
+ difference = difference | (p1[i] ^ p2[i]);
return difference == 0;
}