mirror of
https://github.com/AGWA/git-crypt.git
synced 2025-12-22 23:26:11 -08:00
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.
This commit is contained in:
@@ -27,7 +27,7 @@
|
|||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include <endian.h>
|
#include <arpa/inet.h>
|
||||||
|
|
||||||
void load_keys (const char* filepath, keys_t* keys)
|
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
|
// first 12 bytes - nonce
|
||||||
// last 4 bytes - block number (sequentially increasing with each block)
|
// last 4 bytes - block number (sequentially increasing with each block)
|
||||||
uint8_t ctr[16];
|
uint8_t ctr[16];
|
||||||
uint32_t blockno = htole32(byte_counter / 16);
|
uint32_t blockno = htonl(byte_counter / 16);
|
||||||
memcpy(ctr, nonce, 12);
|
memcpy(ctr, nonce, 12);
|
||||||
memcpy(ctr + 12, &blockno, 4);
|
memcpy(ctr + 12, &blockno, 4);
|
||||||
AES_encrypt(ctr, otp, key);
|
AES_encrypt(ctr, otp, key);
|
||||||
|
|||||||
Reference in New Issue
Block a user