From a8ebbafdf34fb33817cbb1c5bbafa1668befd65c Mon Sep 17 00:00:00 2001 From: Jack Lloyd Date: Fri, 6 Nov 2020 08:32:32 -0500 Subject: Fix some warnings picked up by new compiler flags --- src/lib/block/aes/aes_power8/aes_power8.cpp | 6 +++--- src/lib/block/aes/aes_vperm/aes_vperm.cpp | 6 +++--- src/lib/prov/openssl/openssl_rsa.cpp | 2 +- src/lib/utils/dyn_load/dyn_load.cpp | 4 ++-- src/lib/utils/ghash/ghash_cpu/ghash_cpu.cpp | 8 +++++--- 5 files changed, 14 insertions(+), 12 deletions(-) (limited to 'src/lib') diff --git a/src/lib/block/aes/aes_power8/aes_power8.cpp b/src/lib/block/aes/aes_power8/aes_power8.cpp index 18bc85933..8ab784a50 100644 --- a/src/lib/block/aes/aes_power8/aes_power8.cpp +++ b/src/lib/block/aes/aes_power8/aes_power8.cpp @@ -40,17 +40,17 @@ inline Altivec8x16 reverse_vec(Altivec8x16 src) inline Altivec64x2 load_key(const uint32_t key[]) { - return (Altivec64x2)reverse_vec((Altivec8x16)vec_vsx_ld(0, key));; + return reinterpret_cast(reverse_vec(reinterpret_cast(vec_vsx_ld(0, key)))); } inline Altivec64x2 load_block(const uint8_t src[]) { - return (Altivec64x2)reverse_vec(vec_vsx_ld(0, src)); + return reinterpret_cast(reverse_vec(vec_vsx_ld(0, src))); } inline void store_block(Altivec64x2 src, uint8_t dest[]) { - vec_vsx_st(reverse_vec((Altivec8x16)src), 0, dest); + vec_vsx_st(reverse_vec(reinterpret_cast(src)), 0, dest); } inline void store_blocks(Altivec64x2 B0, Altivec64x2 B1, diff --git a/src/lib/block/aes/aes_vperm/aes_vperm.cpp b/src/lib/block/aes/aes_vperm/aes_vperm.cpp index 4ae6bb223..3c71421b6 100644 --- a/src/lib/block/aes/aes_vperm/aes_vperm.cpp +++ b/src/lib/block/aes/aes_vperm/aes_vperm.cpp @@ -44,9 +44,9 @@ inline SIMD_4x32 BOTAN_FUNC_ISA(BOTAN_VPERM_ISA) shuffle(SIMD_4x32 a, SIMD_4x32 #elif defined(BOTAN_SIMD_USE_ALTIVEC) const auto zero = vec_splat_s8(0x00); - const auto mask = vec_cmplt((__vector signed char)b.raw(), zero); - const auto r = vec_perm((__vector signed char)a.raw(), (__vector signed char)a.raw(), (__vector unsigned char)b.raw()); - return SIMD_4x32((__vector unsigned int)vec_sel(r, zero, mask)); + const auto mask = vec_cmplt(reinterpret_cast<__vector signed char>(b.raw()), zero); + const auto r = vec_perm(reinterpret_cast<__vector signed char>(a.raw()), reinterpret_cast<__vector signed char>(a.raw()), reinterpret_cast<__vector unsigned char>(b.raw())); + return SIMD_4x32(reinterpret_cast<__vector unsigned int>(vec_sel(r, zero, mask))); #else #error "No shuffle implementation available" diff --git a/src/lib/prov/openssl/openssl_rsa.cpp b/src/lib/prov/openssl/openssl_rsa.cpp index 6744b35b2..8fbfa6b5d 100644 --- a/src/lib/prov/openssl/openssl_rsa.cpp +++ b/src/lib/prov/openssl/openssl_rsa.cpp @@ -59,7 +59,7 @@ class OpenSSL_RSA_Encryption_Operation final : public PK_Ops::Encryption size_t ciphertext_length(size_t) const override { return ::RSA_size(m_openssl_rsa.get()); } - size_t max_input_bits() const override { return m_bits; }; + size_t max_input_bits() const override { return m_bits; } secure_vector encrypt(const uint8_t msg[], size_t msg_len, RandomNumberGenerator&) override diff --git a/src/lib/utils/dyn_load/dyn_load.cpp b/src/lib/utils/dyn_load/dyn_load.cpp index b32fe4b3a..c9f455b3a 100644 --- a/src/lib/utils/dyn_load/dyn_load.cpp +++ b/src/lib/utils/dyn_load/dyn_load.cpp @@ -58,7 +58,7 @@ Dynamically_Loaded_Library::~Dynamically_Loaded_Library() #if defined(BOTAN_TARGET_OS_HAS_POSIX1) ::dlclose(m_lib); #elif defined(BOTAN_TARGET_OS_HAS_WIN32) - ::FreeLibrary((HMODULE)m_lib); + ::FreeLibrary(reinterpret_cast(m_lib)); #endif } @@ -69,7 +69,7 @@ void* Dynamically_Loaded_Library::resolve_symbol(const std::string& symbol) #if defined(BOTAN_TARGET_OS_HAS_POSIX1) addr = ::dlsym(m_lib, symbol.c_str()); #elif defined(BOTAN_TARGET_OS_HAS_WIN32) - addr = reinterpret_cast(::GetProcAddress((HMODULE)m_lib, symbol.c_str())); + addr = reinterpret_cast(::GetProcAddress(reinterpret_cast(m_lib), symbol.c_str())); #endif if(!addr) diff --git a/src/lib/utils/ghash/ghash_cpu/ghash_cpu.cpp b/src/lib/utils/ghash/ghash_cpu/ghash_cpu.cpp index b1feb98f0..8d9342b57 100644 --- a/src/lib/utils/ghash/ghash_cpu/ghash_cpu.cpp +++ b/src/lib/utils/ghash/ghash_cpu/ghash_cpu.cpp @@ -68,9 +68,11 @@ BOTAN_FORCE_INLINE SIMD_4x32 BOTAN_FUNC_ISA(BOTAN_CLMUL_ISA) clmul(const SIMD_4x i2 = mask_lo.andc(i2); } - return SIMD_4x32((__vector unsigned int)__builtin_crypto_vpmsumd( - (__vector unsigned long)i1.raw(), - (__vector unsigned long)i2.raw()) + return SIMD_4x32( + reinterpret_cast<__vector unsigned int>( + __builtin_crypto_vpmsumd( + reinterpret_cast<__vector unsigned long>(i1.raw()), + reinterpret_cast<__vector unsigned long>(i2.raw()))) ); #endif } -- cgit v1.2.3