aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJack Lloyd <[email protected]>2022-01-27 16:55:49 -0500
committerJack Lloyd <[email protected]>2022-01-27 16:55:49 -0500
commitdf2ddbe5e88fe008157fa83ccd26a45bec1b7b46 (patch)
treee285d5143ba8b621af32ac90dbf85fc747d15aca
parentf2c767cf1b1b1eba52787277bb5289f7e53a9a36 (diff)
Fix some Clang warnings
See GH #2886
-rw-r--r--src/build-data/cc/clang.txt2
-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/polyn_gf2m.cpp4
-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
10 files changed, 15 insertions, 16 deletions
diff --git a/src/build-data/cc/clang.txt b/src/build-data/cc/clang.txt
index e46534303..5d3316dfe 100644
--- a/src/build-data/cc/clang.txt
+++ b/src/build-data/cc/clang.txt
@@ -4,7 +4,7 @@ binary_name clang++
lang_flags "-std=c++17 -D_REENTRANT"
-warning_flags "-Wall -Wextra -Wpedantic -Wshadow -Wstrict-aliasing -Wstrict-overflow=5 -Wcast-align -Wmissing-declarations -Wpointer-arith -Wcast-qual -Wshorten-64-to-32"
+warning_flags "-Wall -Wextra -Wpedantic -Wshadow -Wstrict-aliasing -Wstrict-overflow=5 -Wcast-align -Wmissing-declarations -Wpointer-arith -Wcast-qual -Wshorten-64-to-32 -Wcomma"
werror_flags "-Werror -Wno-error=unused-parameter -Wno-error=unreachable-code -Wno-error=unused-lambda-capture"
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/polyn_gf2m.cpp b/src/lib/pubkey/mce/polyn_gf2m.cpp
index 53b21d530..eabe3ec16 100644
--- a/src/lib/pubkey/mce/polyn_gf2m.cpp
+++ b/src/lib/pubkey/mce/polyn_gf2m.cpp
@@ -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/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)
{