From b2164be7601f2e34c689e206cc1ed18807ce66c9 Mon Sep 17 00:00:00 2001 From: Andrew Ayer Date: Thu, 24 Jan 2013 21:57:49 -0800 Subject: [PATCH] Use arpa/inet.h functions instead of endian.h Even though arpa/inet.h is "networky" and this isn't a network application, arpa/inet.h is in POSIX whereas endian.h is non-standard. This should let git-crypt build on Mac OS X. --- crypto.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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);