.salt_size = 16
};
crypto_argon2_extras extras = {0}; /* Extra parameters unused */
-void *work_area = malloc(nb_blocks * 1024); /* Work area */
+
+/* Allocate work area.
+ * Note the conversion to size_t.
+ * Without it we cannot allocate more than 4GiB.
+ */
+void *work_area = malloc((size_t)nb_blocks * 1024);
if (work_area == NULL) {
/* Handle malloc() failure */
/* Wipe secrets if they are no longer needed */
vector key = next_input(reader);
vector ad = next_input(reader);
vector out = next_output(reader);
- void *work_area = alloc(config.nb_blocks * 1024);
+ void *work_area = alloc((size_t)config.nb_blocks * 1024);
crypto_argon2_inputs inputs;
inputs.pass = pass.buf;