Fixed a name conflict on Linux.

This commit is contained in:
LoRd_MuldeR 2020-10-16 18:07:45 +02:00
parent 15a091cc49
commit b820b75f5d
Signed by: mulder
GPG Key ID: 2B5913365F57E03F
2 changed files with 10 additions and 6 deletions

View File

@ -195,7 +195,8 @@ static int encrypt(const char* const passphrase, const CHR* const input_path, co
crc_actual = crc64_finish(crc_actual);
FPRINTF(stderr, T("\b\b\b\b\b\b%5.1f%%\n\n"), 100.0);
fflush(stderr);
if (fwrite(&crc_actual, sizeof(uint64_t), 1U, file_out) < 1U)
{
FPUTS(T("I/O error: Failed to write CRC checksum!\n\n"), stderr);
@ -326,6 +327,7 @@ static int decrypt(const char* const passphrase, const CHR* const input_path, co
crc_actual = crc64_finish(crc_actual);
FPRINTF(stderr, T("\b\b\b\b\b\b%5.1f%%\n\n"), 100.0);
fflush(stderr);
uint64_t crc_expected;
if (fread(&crc_expected, sizeof(uint64_t), 1U, file_in) < 1U)
@ -470,7 +472,9 @@ static int self_test(void)
}
}
FPRINTF(stderr, T("\b\b\b\b\b%2u/%2u\n\nCompleted successfully.\n\n"), (unsigned int)total, (unsigned int)total);
FPRINTF(stderr, T("\b\b\b\b\b\b%2u/%2u\n\nCompleted successfully.\n\n"), (unsigned int)total, (unsigned int)total);
fflush(stderr);
return 0;
}

View File

@ -27,7 +27,7 @@ typedef struct
{
uint64_t a, b;
}
key_t;
key_data_t;
typedef struct
{
@ -83,7 +83,7 @@ static FORCE_INLINE uint64_t keygen_loop(uint64_t value, const uint16_t pepper,
return value;
}
static void generate_key(key_t *const key, const uint64_t salt, const uint16_t pepper, const uint8_t* const passwd, const size_t passwd_len)
static void generate_key(key_data_t *const key, const uint64_t salt, const uint16_t pepper, const uint8_t* const passwd, const size_t passwd_len)
{
key->a = keygen_loop(salt, pepper & 0x7FFF, passwd, passwd_len);
key->b = keygen_loop(salt, pepper | 0x8000, passwd, passwd_len);
@ -118,14 +118,14 @@ static uint32_t random_next(rand_state_t *const state)
static void random_seed(rand_state_t* const state, const uint64_t salt, const uint16_t pepper, const uint8_t *const passwd, const size_t passwd_len)
{
key_t key;
key_data_t key;
generate_key(&key, salt, pepper, passwd, passwd_len);
random_init(state, key.a, key.b);
for (size_t i = 0U; i < (salt % 97U) + 13U; ++i)
{
random_next(state);
}
mcrypt_bzero(&key, sizeof(key_t));
mcrypt_bzero(&key, sizeof(key_data_t));
}
// ==========================================================================