]> git.codecow.com Git - Monocypher.git/commitdiff
Just changing the types on those two resolved everything, and tests
authorSethArchambault <seth@doercreator.com>
Sat, 21 Oct 2023 23:59:11 +0000 (19:59 -0400)
committerLoup Vaillant <github-is-valid@loup-vaillant.fr>
Sun, 22 Oct 2023 22:16:00 +0000 (00:16 +0200)
pass!

--- a/src/monocypher.c
+++ b/src/monocypher.c
-u64 lane         =
+u32 lane         =
...
-u64  ref       = (window_start + z) % lane_size;
+u32  ref       = (window_start + z) % lane_size;
-u32  index     = (u32)(lane * lane_size) + (u32)ref;
+u32  index     = lane * lane_size + ref;

src/monocypher.c

index 1f4b2e6f150dc8240b4e278561f4e173b07ca16e..0accae75a38e1d7a2f9653d3559093939c039512 100644 (file)
@@ -863,7 +863,7 @@ void crypto_argon2(u8 *hash, u32 hash_size, void *work_area,
                                        u32 next_slice   = ((slice + 1) % 4) * segment_size;
                                        u32 window_start = pass == 0 ? 0     : next_slice;
                                        u32 nb_segments  = pass == 0 ? slice : 3;
-                                       u64 lane         =
+                                       u32 lane         =
                                                pass == 0 && slice == 0
                                                ? segment
                                                : (index_seed >> 32) % config.nb_lanes;
@@ -877,8 +877,8 @@ void crypto_argon2(u8 *hash, u32 hash_size, void *work_area,
                                        u64  x         = (j1 * j1)         >> 32;
                                        u64  y         = (window_size * x) >> 32;
                                        u64  z         = (window_size - 1) - y;
-                                       u64  ref       = (window_start + z) % lane_size;
-                                       u32  index     = (u32)(lane * lane_size) + (u32)ref;
+                                       u32  ref       = (window_start + z) % lane_size;
+                                       u32  index     = lane * lane_size + ref;
                                        blk *reference = blocks + index;
 
                                        // Shuffle the previous & reference block