From bbe68505981c448c7b81e1ad98fc038ef19d0c17 Mon Sep 17 00:00:00 2001 From: Egor Tensin Date: Mon, 17 Oct 2016 07:11:34 +0300 Subject: fix compiler warnings --- cxx/CMakeLists.txt | 3 ++- include/aes/workarounds.h | 2 ++ src/box_aes.c | 15 ++++++++++++++- src/padding.c | 1 + utils/CMakeLists.txt | 12 ++++++------ utils/decrypt_block.cpp | 2 -- utils/encrypt_block.cpp | 2 -- 7 files changed, 25 insertions(+), 12 deletions(-) diff --git a/cxx/CMakeLists.txt b/cxx/CMakeLists.txt index 9dddb5c..d54caae 100644 --- a/cxx/CMakeLists.txt +++ b/cxx/CMakeLists.txt @@ -1,7 +1,8 @@ find_package(Boost REQUIRED) add_library(libaesxx INTERFACE) -target_include_directories(libaesxx INTERFACE include/ ${Boost_INCLUDE_DIRS}) +target_include_directories(libaesxx INTERFACE include/) +target_include_directories(libaesxx SYSTEM INTERFACE ${Boost_INCLUDE_DIRS}) target_link_libraries(libaesxx INTERFACE libaes) if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX) diff --git a/include/aes/workarounds.h b/include/aes/workarounds.h index 45fece2..914bd21 100644 --- a/include/aes/workarounds.h +++ b/include/aes/workarounds.h @@ -12,3 +12,5 @@ #else #warning "couldn't determine alignment attribute" #endif + +#define AES_UNUSED_PARAMETER(...) (void) (__VA_ARGS__) diff --git a/src/box_aes.c b/src/box_aes.c index ddf6f02..4d08d10 100644 --- a/src/box_aes.c +++ b/src/box_aes.c @@ -16,6 +16,7 @@ static AES_StatusCode aes_box_derive_params_aes128( AES_BoxDecryptionRoundKeys* decryption_keys, AES_ErrorDetails* err_details) { + AES_UNUSED_PARAMETER(err_details); aes_AES128_expand_key_( box_key->aes128_key.key, &encryption_keys->aes128_encryption_keys); @@ -31,6 +32,7 @@ static AES_StatusCode aes_box_derive_params_aes192( AES_BoxDecryptionRoundKeys* decryption_keys, AES_ErrorDetails* err_details) { + AES_UNUSED_PARAMETER(err_details); aes_AES192_expand_key_( box_key->aes192_key.lo, box_key->aes192_key.hi, @@ -47,6 +49,7 @@ static AES_StatusCode aes_box_derive_params_aes256( AES_BoxDecryptionRoundKeys* decryption_keys, AES_ErrorDetails* err_details) { + AES_UNUSED_PARAMETER(err_details); aes_AES256_expand_key_( box_key->aes256_key.lo, box_key->aes256_key.hi, @@ -158,7 +161,7 @@ static AES_StatusCode aes_box_xor_block_aes( const AES_BoxBlock* src, AES_ErrorDetails* err_details) { - + AES_UNUSED_PARAMETER(err_details); dest->aes_block = aes_AES_xor_blocks(dest->aes_block, src->aes_block); return AES_SUCCESS; } @@ -167,6 +170,7 @@ static AES_StatusCode aes_box_inc_block_aes( AES_BoxBlock* ctr, AES_ErrorDetails* err_details) { + AES_UNUSED_PARAMETER(err_details); ctr->aes_block = aes_AES_inc_block(ctr->aes_block); return AES_SUCCESS; } @@ -175,6 +179,7 @@ static AES_StatusCode aes_box_get_block_size_aes( size_t* block_size, AES_ErrorDetails* err_details) { + AES_UNUSED_PARAMETER(err_details); *block_size = 16; return AES_SUCCESS; } @@ -184,6 +189,7 @@ static AES_StatusCode aes_box_store_block_aes( const AES_BoxBlock* src, AES_ErrorDetails* err_details) { + AES_UNUSED_PARAMETER(err_details); aes_store_block128(dest, src->aes_block); return AES_SUCCESS; } @@ -193,6 +199,7 @@ static AES_StatusCode aes_box_load_block_aes( const void* src, AES_ErrorDetails* err_details) { + AES_UNUSED_PARAMETER(err_details); dest->aes_block = aes_load_block128(src); return AES_SUCCESS; } @@ -203,6 +210,7 @@ static AES_StatusCode aes_box_encrypt_block_aes128( AES_BoxBlock* output, AES_ErrorDetails* err_details) { + AES_UNUSED_PARAMETER(err_details); output->aes_block = aes_AES128_encrypt_block_( input->aes_block, ¶ms->aes128_encryption_keys); @@ -215,6 +223,7 @@ static AES_StatusCode aes_box_decrypt_block_aes128( AES_BoxBlock* output, AES_ErrorDetails* err_details) { + AES_UNUSED_PARAMETER(err_details); output->aes_block = aes_AES128_decrypt_block_( input->aes_block, ¶ms->aes128_decryption_keys); @@ -227,6 +236,7 @@ static AES_StatusCode aes_box_encrypt_block_aes192( AES_BoxBlock* output, AES_ErrorDetails* err_details) { + AES_UNUSED_PARAMETER(err_details); output->aes_block = aes_AES192_encrypt_block_( input->aes_block, ¶ms->aes192_encryption_keys); @@ -239,6 +249,7 @@ static AES_StatusCode aes_box_decrypt_block_aes192( AES_BoxBlock* output, AES_ErrorDetails* err_details) { + AES_UNUSED_PARAMETER(err_details); output->aes_block = aes_AES192_decrypt_block_( input->aes_block, ¶ms->aes192_decryption_keys); @@ -251,6 +262,7 @@ static AES_StatusCode aes_box_encrypt_block_aes256( AES_BoxBlock* output, AES_ErrorDetails* err_details) { + AES_UNUSED_PARAMETER(err_details); output->aes_block = aes_AES256_encrypt_block_( input->aes_block, ¶ms->aes256_encryption_keys); @@ -263,6 +275,7 @@ static AES_StatusCode aes_box_decrypt_block_aes256( AES_BoxBlock* output, AES_ErrorDetails* err_details) { + AES_UNUSED_PARAMETER(err_details); output->aes_block = aes_AES256_decrypt_block_( input->aes_block, ¶ms->aes256_decryption_keys); diff --git a/src/padding.c b/src/padding.c index 4923f82..da453cd 100644 --- a/src/padding.c +++ b/src/padding.c @@ -59,6 +59,7 @@ static AES_StatusCode aes_fill_with_padding_pkcs7( size_t padding_size, AES_ErrorDetails* err_details) { + AES_UNUSED_PARAMETER(err_details); memset(dest, padding_size, padding_size); return AES_SUCCESS; } diff --git a/utils/CMakeLists.txt b/utils/CMakeLists.txt index 177f888..5db82b3 100644 --- a/utils/CMakeLists.txt +++ b/utils/CMakeLists.txt @@ -1,31 +1,31 @@ find_package(Boost REQUIRED COMPONENTS filesystem program_options system) add_executable(util_encrypt_block encrypt_block.cpp block_cmd_parser.hpp block_dumper.hpp block_input.hpp data_parsers.hpp) -target_include_directories(util_encrypt_block PRIVATE ${Boost_INCLUDE_DIRS}) +target_include_directories(util_encrypt_block SYSTEM PRIVATE ${Boost_INCLUDE_DIRS}) target_link_libraries(util_encrypt_block PRIVATE libaesxx ${Boost_LIBRARIES}) set_target_properties(util_encrypt_block PROPERTIES OUTPUT_NAME encrypt_block) add_executable(util_decrypt_block decrypt_block.cpp block_cmd_parser.hpp block_dumper.hpp block_input.hpp data_parsers.hpp) -target_include_directories(util_decrypt_block PRIVATE ${Boost_INCLUDE_DIRS}) +target_include_directories(util_decrypt_block SYSTEM PRIVATE ${Boost_INCLUDE_DIRS}) target_link_libraries(util_decrypt_block PRIVATE libaesxx ${Boost_LIBRARIES}) set_target_properties(util_decrypt_block PROPERTIES OUTPUT_NAME decrypt_block) add_executable(util_encrypt_file encrypt_file.cpp file_cmd_parser.hpp data_parsers.hpp) -target_include_directories(util_encrypt_file PRIVATE ${Boost_INCLUDE_DIRS}) +target_include_directories(util_encrypt_file SYSTEM PRIVATE ${Boost_INCLUDE_DIRS}) target_link_libraries(util_encrypt_file PRIVATE libaesxx ${Boost_LIBRARIES}) set_target_properties(util_encrypt_file PROPERTIES OUTPUT_NAME encrypt_file) add_executable(util_decrypt_file decrypt_file.cpp file_cmd_parser.hpp data_parsers.hpp) -target_include_directories(util_decrypt_file PRIVATE ${Boost_INCLUDE_DIRS}) +target_include_directories(util_decrypt_file SYSTEM PRIVATE ${Boost_INCLUDE_DIRS}) target_link_libraries(util_decrypt_file PRIVATE libaesxx ${Boost_LIBRARIES}) set_target_properties(util_decrypt_file PROPERTIES OUTPUT_NAME decrypt_file) add_executable(util_encrypt_bmp encrypt_bmp.cpp file_cmd_parser.hpp data_parsers.hpp) -target_include_directories(util_encrypt_bmp PRIVATE ${Boost_INCLUDE_DIRS}) +target_include_directories(util_encrypt_bmp SYSTEM PRIVATE ${Boost_INCLUDE_DIRS}) target_link_libraries(util_encrypt_bmp PRIVATE libaesxx ${Boost_LIBRARIES}) set_target_properties(util_encrypt_bmp PROPERTIES OUTPUT_NAME encrypt_bmp) add_executable(util_decrypt_bmp decrypt_bmp.cpp file_cmd_parser.hpp data_parsers.hpp) -target_include_directories(util_decrypt_bmp PRIVATE ${Boost_INCLUDE_DIRS}) +target_include_directories(util_decrypt_bmp SYSTEM PRIVATE ${Boost_INCLUDE_DIRS}) target_link_libraries(util_decrypt_bmp PRIVATE libaesxx ${Boost_LIBRARIES}) set_target_properties(util_decrypt_bmp PROPERTIES OUTPUT_NAME decrypt_bmp) diff --git a/utils/decrypt_block.cpp b/utils/decrypt_block.cpp index 6961a9c..8c388c1 100644 --- a/utils/decrypt_block.cpp +++ b/utils/decrypt_block.cpp @@ -195,8 +195,6 @@ int main(int argc, char** argv) settings.verbose()); } } - - return 0; } catch (const boost::program_options::error& e) { diff --git a/utils/encrypt_block.cpp b/utils/encrypt_block.cpp index 9fa998f..b51d59c 100644 --- a/utils/encrypt_block.cpp +++ b/utils/encrypt_block.cpp @@ -195,8 +195,6 @@ int main(int argc, char** argv) settings.verbose()); } } - - return 0; } catch (const boost::program_options::error& e) { -- cgit v1.2.3