1
0
mirror of https://github.com/hashcat/hashcat.git synced 2025-01-09 07:11:03 +00:00

Fix travis-ci error caused by __builtin_bswapXX()

This commit is contained in:
jsteube 2017-01-21 18:03:47 +01:00
parent 8257883ec1
commit 53d467abf8
3 changed files with 15 additions and 2 deletions

View File

@ -11,6 +11,7 @@ u32 rotr32 (const u32 a, const u32 n);
u64 rotl64 (const u64 a, const u64 n);
u64 rotr64 (const u64 a, const u64 n);
u16 byte_swap_16 (const u16 n);
u32 byte_swap_32 (const u32 n);
u64 byte_swap_64 (const u64 n);

View File

@ -43,6 +43,18 @@ u64 rotr64 (const u64 a, const u64 n)
#endif
}
u16 byte_swap_16 (const u16 n)
{
#if defined (_MSC_VER)
return _byteswap_ushort (n);
#elif defined (__clang__) || defined (__GNUC__)
return __builtin_bswap16 (n);
#else
return (n & 0xff00) >> 8
| (n & 0x00ff) << 8;
#endif
}
u32 byte_swap_32 (const u32 n)
{
#if defined (_MSC_VER)

View File

@ -13168,8 +13168,8 @@ int luks_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSE
// verify the content
#define ntohs __builtin_bswap16
#define ntohl __builtin_bswap32
#define ntohs byte_swap_16
#define ntohl byte_swap_32
char luks_magic[6] = LUKS_MAGIC;