diff --git a/include/plusaes/plusaes.hpp b/include/plusaes/plusaes.hpp index 2c59a54..bda28c4 100644 --- a/include/plusaes/plusaes.hpp +++ b/include/plusaes/plusaes.hpp @@ -503,7 +503,7 @@ std::bitset inc32(const std::bitset X) { /** Algorithm 1 @private */ inline Block mul_blocks(const Block X, const Block Y) { - const bitset128 R = (std::bitset<8>("11100001") || std::bitset<120>()); + const bitset128 R = (std::bitset<8>(0xe1) || std::bitset<120>()); bitset128 X_bits = X.to_bits(); bitset128 Z; @@ -576,7 +576,7 @@ inline std::vector gctr(const detail::RoundKeys & rkeys, const Bl // CIPH Block eCB; - encrypt_state(rkeys, CB.data(), eCB.data()); + detail::encrypt_state(rkeys, CB.data(), eCB.data()); // Y int op_size = 0; @@ -612,7 +612,7 @@ inline void push_back_zero_bits(std::vector& bytes, const std::si inline Block calc_H(const RoundKeys & rkeys) { std::vector H_raw(gcm::kBlockByteSize); - encrypt_state(rkeys, &H_raw[0], &H_raw[0]); + detail::encrypt_state(rkeys, &H_raw[0], &H_raw[0]); return gcm::Block(H_raw); } @@ -807,7 +807,7 @@ inline bool check_padding(const unsigned long padding, const unsigned char data[ } for (unsigned long i = 0; i < padding; ++i) { - if (data[kStateSize - 1 - i] != padding) { + if ((unsigned long)data[kStateSize - 1 - i] != padding) { return false; } } @@ -980,7 +980,7 @@ inline Error encrypt_cbc( const unsigned long data_size, const unsigned char * key, const unsigned long key_size, - const unsigned char (* iv)[16], + const unsigned char iv[16], unsigned char * encrypted, const unsigned long encrypted_size, const bool pads @@ -1008,7 +1008,7 @@ inline Error encrypt_cbc( memcpy(s, data, data_size); } if (iv) { - detail::xor_data(s, *iv); + detail::xor_data(s, iv); } detail::encrypt_state(rkeys, s, encrypted);