aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDennis Brentjes <d.brentjes@gmail.com>2016-12-12 11:29:03 +0100
committerDennis Brentjes <d.brentjes@gmail.com>2016-12-15 09:45:30 +0100
commit7568c9073143edfb3bc6c0bf4263be704cb96cb5 (patch)
treeb6c24648caaa813920c28d4b483fc320bf1567ed
parent8eef4dde28da8db00f32d4a7acd95ddbb728d138 (diff)
downloadcmix-7568c9073143edfb3bc6c0bf4263be704cb96cb5.tar.gz
cmix-7568c9073143edfb3bc6c0bf4263be704cb96cb5.tar.bz2
cmix-7568c9073143edfb3bc6c0bf4263be704cb96cb5.zip
Introduces and fixes warnings in the C libraries.
-rw-r--r--CMakeLists.txt4
-rw-r--r--libcmix-crypto/curve25519/null/CMakeLists.txt4
-rw-r--r--libcmix-crypto/curve25519/sodium/libsodium_curve25519.c12
-rw-r--r--libcmix-crypto/elgamal/gcrypt/gcrypt_elgamal.c6
-rw-r--r--libcmix-crypto/elgamal/null/CMakeLists.txt4
-rw-r--r--libcmix-protobuf/CMakeLists.txt8
-rw-r--r--libcmix/cmix.h2
-rw-r--r--node/node_node.cpp11
m---------wubwubcmake0
9 files changed, 43 insertions, 8 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index f90a00e..bfad59e 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -44,7 +44,11 @@ if(use_lto)
endif(use_lto)
set(CMAKE_CXX_STANDARD 11)
+set(CMAKE_CXX_STANDARD_REQUIRED ON)
+set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_C_STANDARD 99)
+set(CMAKE_C_STANDARD_REQUIRED ON)
+set(CMAKE_C_EXTENSIONS OFF)
add_subdirectory(libcmix-crypto)
add_subdirectory(libcmix)
diff --git a/libcmix-crypto/curve25519/null/CMakeLists.txt b/libcmix-crypto/curve25519/null/CMakeLists.txt
index 25c0d3b..eb13fdf 100644
--- a/libcmix-crypto/curve25519/null/CMakeLists.txt
+++ b/libcmix-crypto/curve25519/null/CMakeLists.txt
@@ -6,6 +6,10 @@ add_library(${target_name} SHARED
null_curve25519.c
)
+target_compile_options(${target_name}
+ PRIVATE -Wno-unused-parameter
+)
+
target_link_libraries(${target_name}
PRIVATE curve25519-interface
)
diff --git a/libcmix-crypto/curve25519/sodium/libsodium_curve25519.c b/libcmix-crypto/curve25519/sodium/libsodium_curve25519.c
index b4ae963..1bad378 100644
--- a/libcmix-crypto/curve25519/sodium/libsodium_curve25519.c
+++ b/libcmix-crypto/curve25519/sodium/libsodium_curve25519.c
@@ -40,14 +40,22 @@ void sodium_curve25519_shared_key_deleter(struct SharedKey* s) {
}
void sodium_curve25519_key_to_array(unsigned char** buffer, size_t* len, void* key) {
-
+ (void)buffer;
+ (void)len;
+ (void)key;
}
void sodium_curve25519_add_public_share(char** buffer, size_t* out_len, char const* share, size_t in_len, void* pubkey) {
-
+ (void) buffer;
+ (void) out_len;
+ (void) share;
+ (void) in_len;
+ (void) pubkey;
}
GroupElement sodium_curve25519_derive_shared_key(struct KeyPair pair, unsigned char const* other_pub, size_t pub_len, unsigned char const* value, size_t value_len, void* priv_value, bool swap_pub_order) {
+ (void) pub_len;
+ (void) value_len;
unsigned char* shared = (unsigned char*) sodium_malloc(crypto_generichash_BYTES);
crypto_generichash_state h;
diff --git a/libcmix-crypto/elgamal/gcrypt/gcrypt_elgamal.c b/libcmix-crypto/elgamal/gcrypt/gcrypt_elgamal.c
index 28c61c3..ec993a6 100644
--- a/libcmix-crypto/elgamal/gcrypt/gcrypt_elgamal.c
+++ b/libcmix-crypto/elgamal/gcrypt/gcrypt_elgamal.c
@@ -132,6 +132,7 @@ void gcrypt_elgamal_free_buffer(void* buffer) {
}
void* gcrypt_elgamal_array_to_element(char const* buffer, size_t len, bool secure) {
+ (void) secure;
size_t error_pos;
gcry_error_t error;
@@ -163,6 +164,7 @@ size_t gcrypt_elgamal_get_pub_key_hash_length() {
}
void* gcrypt_elgamal_get_group_element(bool secure) {
+ (void) secure;
size_t parse_error_offset;
gcry_error_t error;
@@ -240,6 +242,10 @@ void gcrypt_elgamal_add_public_share(GroupElement* el, char const* share, size_t
}
GroupElement gcrypt_elgamal_derive_shared_key(struct KeyPair keypair, unsigned char const* other_pub, size_t pub_len, unsigned char const* value, size_t value_len, void* priv_value, bool swap) {
+ (void) keypair;
+ (void) other_pub;
+ (void) pub_len;
+ (void) swap;
gcry_error_t error;
size_t parse_error_pos;
diff --git a/libcmix-crypto/elgamal/null/CMakeLists.txt b/libcmix-crypto/elgamal/null/CMakeLists.txt
index 40e5e8d..a866428 100644
--- a/libcmix-crypto/elgamal/null/CMakeLists.txt
+++ b/libcmix-crypto/elgamal/null/CMakeLists.txt
@@ -6,6 +6,10 @@ add_library(${target_name} SHARED
null_elgamal.c
)
+target_compile_options(${target_name}
+ PRIVATE -Wno-unused-parameter
+)
+
target_link_libraries(${target_name}
PRIVATE elgamal-interface
)
diff --git a/libcmix-protobuf/CMakeLists.txt b/libcmix-protobuf/CMakeLists.txt
index 29dbb32..725cbf3 100644
--- a/libcmix-protobuf/CMakeLists.txt
+++ b/libcmix-protobuf/CMakeLists.txt
@@ -16,4 +16,12 @@ target_include_directories(cmix-protobuf
PUBLIC ${CMAKE_CURRENT_BINARY_DIR}
)
+target_compile_definitions(cmix-protobuf
+ PUBLIC PROTOBUF_INLINE_NOT_IN_HEADERS=0
+)
+
+target_compile_options(cmix-protobuf
+ PRIVATE -Wno-unused-parameter
+)
+
target_link_libraries(cmix-protobuf ${Protobuf_LIBRARIES}) \ No newline at end of file
diff --git a/libcmix/cmix.h b/libcmix/cmix.h
index c9e9273..06fd939 100644
--- a/libcmix/cmix.h
+++ b/libcmix/cmix.h
@@ -14,7 +14,7 @@ extern "C" {
#ifndef NDEBUG
/*!
- * Forward delcleration for the debug function.
+ * Forward decleration for the debug function.
*/
struct CMixContext;
diff --git a/node/node_node.cpp b/node/node_node.cpp
index 27104b5..a0e04fa 100644
--- a/node/node_node.cpp
+++ b/node/node_node.cpp
@@ -14,7 +14,7 @@ void fill_precomputation_pre_message(CMixContext& ctx, cmix_proto::PrePre& prepr
std::stringstream ss;
ss << "permutation:";
- for(auto i = 0; i < ctx.nr_participants; ++i) {
+ for(auto i = 0u; i < ctx.nr_participants; ++i) {
ss << " " << ctx.permutation[i];
}
BOOST_LOG_TRIVIAL(trace) << ss.str();
@@ -25,7 +25,7 @@ void fill_precomputation_pre_message(CMixContext& ctx, cmix_proto::PrePre& prepr
std::vector<char const*> rsv(ms.size(), nullptr);
std::vector<char const*> msv(ms.size(), nullptr);
- for(size_t i = 0; i < ms.size(); ++i) {
+ for(auto i = 0; i < ms.size(); ++i) {
std::string* r = prepre.add_r_er();
r->resize(len);
r_ers[i] = &(*r)[0];
@@ -56,7 +56,8 @@ void fill_precomputation_mix_message(CMixContext const& ctx, cmix_proto::PreMix&
std::vector<char*> m_epirs(ms.size(), nullptr);
std::vector<char const*> rsv(ms.size(), nullptr);
std::vector<char const*> msv(ms.size(), nullptr);
- for(size_t i = 0; i < ms.size(); ++i) {
+
+ for(auto i = 0; i < ms.size(); ++i) {
std::string* r = premix.add_r_epirs();
r->resize(el_len);
r_epirs[i] = &(*r)[0];
@@ -86,10 +87,10 @@ void fill_precomputation_post_message(CMixContext& ctx, cmix_proto::PrePost& pre
std::vector<char*> m_epirs(ms.size(), nullptr);
std::vector<char const*> rsv(ms.size(), nullptr);
std::vector<char const*> msv(ms.size(), nullptr);
- for(size_t i = 0; i < ms.size(); ++i) {
+ for(auto i = 0; i < ms.size(); ++i) {
std::string* r = prepost.add_r_epirs();
r->resize(len);
- r_epirs[i] = &(*r)[0];
+ r_epirs[size_t(i)] = &(*r)[0];
std::string* m = prepost.add_m_epirs();
m->resize(len);
diff --git a/wubwubcmake b/wubwubcmake
-Subproject 056ae6f54cb420e2d033338ab011fd9b1cfe04e
+Subproject dedc4ddbe0ba54677a5595b014cbf8480c6e653