Fixed a name conflict on Linux.
This commit is contained in:
parent
15a091cc49
commit
b820b75f5d
@ -195,7 +195,8 @@ static int encrypt(const char* const passphrase, const CHR* const input_path, co
|
|||||||
|
|
||||||
crc_actual = crc64_finish(crc_actual);
|
crc_actual = crc64_finish(crc_actual);
|
||||||
FPRINTF(stderr, T("\b\b\b\b\b\b%5.1f%%\n\n"), 100.0);
|
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)
|
if (fwrite(&crc_actual, sizeof(uint64_t), 1U, file_out) < 1U)
|
||||||
{
|
{
|
||||||
FPUTS(T("I/O error: Failed to write CRC checksum!\n\n"), stderr);
|
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);
|
crc_actual = crc64_finish(crc_actual);
|
||||||
FPRINTF(stderr, T("\b\b\b\b\b\b%5.1f%%\n\n"), 100.0);
|
FPRINTF(stderr, T("\b\b\b\b\b\b%5.1f%%\n\n"), 100.0);
|
||||||
|
fflush(stderr);
|
||||||
|
|
||||||
uint64_t crc_expected;
|
uint64_t crc_expected;
|
||||||
if (fread(&crc_expected, sizeof(uint64_t), 1U, file_in) < 1U)
|
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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -27,7 +27,7 @@ typedef struct
|
|||||||
{
|
{
|
||||||
uint64_t a, b;
|
uint64_t a, b;
|
||||||
}
|
}
|
||||||
key_t;
|
key_data_t;
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
@ -83,7 +83,7 @@ static FORCE_INLINE uint64_t keygen_loop(uint64_t value, const uint16_t pepper,
|
|||||||
return value;
|
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->a = keygen_loop(salt, pepper & 0x7FFF, passwd, passwd_len);
|
||||||
key->b = keygen_loop(salt, pepper | 0x8000, 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)
|
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);
|
generate_key(&key, salt, pepper, passwd, passwd_len);
|
||||||
random_init(state, key.a, key.b);
|
random_init(state, key.a, key.b);
|
||||||
for (size_t i = 0U; i < (salt % 97U) + 13U; ++i)
|
for (size_t i = 0U; i < (salt % 97U) + 13U; ++i)
|
||||||
{
|
{
|
||||||
random_next(state);
|
random_next(state);
|
||||||
}
|
}
|
||||||
mcrypt_bzero(&key, sizeof(key_t));
|
mcrypt_bzero(&key, sizeof(key_data_t));
|
||||||
}
|
}
|
||||||
|
|
||||||
// ==========================================================================
|
// ==========================================================================
|
||||||
|
Loading…
Reference in New Issue
Block a user