]> git.codecow.com Git - Monocypher.git/commitdiff
Corrected possible misalignment in the tests
authorLoup Vaillant <loup@loup-vaillant.fr>
Thu, 22 Mar 2018 20:47:13 +0000 (21:47 +0100)
committerLoup Vaillant <loup@loup-vaillant.fr>
Thu, 22 Mar 2018 20:47:13 +0000 (21:47 +0100)
Argon2i must have its work area aligned for uint64_t.  I don't recall
any guarantee of alignment when allocating an array of uint8_t on the
stack.  So we allocate on the heap instead.

tests/test.c

index 7669e0d0f9b8acff50829e097e84588d83b03352..aa9214751856f3314ff6e30df7fbaccd840cadcb 100644 (file)
@@ -571,7 +571,7 @@ static int p_argon2i_overlap()
 {
     int status = 0;
     FOR (i, 0, 128) {
-        RANDOM_INPUT(work_area, 1024 * 8);
+        u8 *work_area = (u8*)alloc(1024 * 8);  p_random(work_area, 1024 * 8);
         u32 pass_offset = rand64() % 128;
         u32 salt_offset = rand64() % 128;
         u32 key_offset  = rand64() % 128;