diff --git a/crypto.cpp b/crypto.cpp index 3c74a44..e1f3653 100644 --- a/crypto.cpp +++ b/crypto.cpp @@ -27,7 +27,7 @@ #include #include #include -#include +#include void load_keys (const char* filepath, keys_t* keys) { @@ -71,7 +71,7 @@ void aes_ctr_state::process (const AES_KEY* key, const uint8_t* in, uint8_t* out // first 12 bytes - nonce // last 4 bytes - block number (sequentially increasing with each block) uint8_t ctr[16]; - uint32_t blockno = htole32(byte_counter / 16); + uint32_t blockno = htonl(byte_counter / 16); memcpy(ctr, nonce, 12); memcpy(ctr + 12, &blockno, 4); AES_encrypt(ctr, otp, key);