mirror of
https://gitlab.com/cryptsetup/cryptsetup.git
synced 2025-12-11 10:50:01 +01:00
Upstream fixes to bundled Argon2 code.
Wait for already running threads if a thread creation failed. Use explicit_bzero() on recent glibc versions. (Without fixed logic, we have already macro definition through automake.) Fixes #444.
This commit is contained in:
@@ -125,7 +125,7 @@ void NOT_OPTIMIZED secure_wipe_memory(void *v, size_t n) {
|
|||||||
SecureZeroMemory(v, n);
|
SecureZeroMemory(v, n);
|
||||||
#elif defined memset_s
|
#elif defined memset_s
|
||||||
memset_s(v, n, 0, n);
|
memset_s(v, n, 0, n);
|
||||||
#elif defined(__OpenBSD__)
|
#elif defined(HAVE_EXPLICIT_BZERO)
|
||||||
explicit_bzero(v, n);
|
explicit_bzero(v, n);
|
||||||
#else
|
#else
|
||||||
static void *(*const volatile memset_sec)(void *, int, size_t) = &memset;
|
static void *(*const volatile memset_sec)(void *, int, size_t) = &memset;
|
||||||
@@ -299,7 +299,7 @@ static int fill_memory_blocks_mt(argon2_instance_t *instance) {
|
|||||||
|
|
||||||
for (r = 0; r < instance->passes; ++r) {
|
for (r = 0; r < instance->passes; ++r) {
|
||||||
for (s = 0; s < ARGON2_SYNC_POINTS; ++s) {
|
for (s = 0; s < ARGON2_SYNC_POINTS; ++s) {
|
||||||
uint32_t l;
|
uint32_t l, ll;
|
||||||
|
|
||||||
/* 2. Calling threads */
|
/* 2. Calling threads */
|
||||||
for (l = 0; l < instance->lanes; ++l) {
|
for (l = 0; l < instance->lanes; ++l) {
|
||||||
@@ -324,6 +324,9 @@ static int fill_memory_blocks_mt(argon2_instance_t *instance) {
|
|||||||
sizeof(argon2_position_t));
|
sizeof(argon2_position_t));
|
||||||
if (argon2_thread_create(&thread[l], &fill_segment_thr,
|
if (argon2_thread_create(&thread[l], &fill_segment_thr,
|
||||||
(void *)&thr_data[l])) {
|
(void *)&thr_data[l])) {
|
||||||
|
/* Wait for already running threads */
|
||||||
|
for (ll = 0; ll < l; ++ll)
|
||||||
|
argon2_thread_join(thread[ll]);
|
||||||
rc = ARGON2_THREAD_FAIL;
|
rc = ARGON2_THREAD_FAIL;
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user