vendor/libsodium/src/libsodium/crypto_pwhash/argon2/argon2.c in rbnacl-libsodium-1.0.15.1 vs vendor/libsodium/src/libsodium/crypto_pwhash/argon2/argon2.c in rbnacl-libsodium-1.0.16
- old
+ new
@@ -27,10 +27,11 @@
argon2_ctx(argon2_context *context, argon2_type type)
{
/* 1. Validate all inputs */
int result = validate_inputs(context);
uint32_t memory_blocks, segment_length;
+ uint32_t pass;
argon2_instance_t instance;
if (ARGON2_OK != result) {
return result;
}
@@ -51,10 +52,11 @@
/* Ensure that all segments have equal length */
memory_blocks = segment_length * (context->lanes * ARGON2_SYNC_POINTS);
instance.region = NULL;
instance.passes = context->t_cost;
+ instance.current_pass = ~ 0U;
instance.memory_blocks = memory_blocks;
instance.segment_length = segment_length;
instance.lane_length = segment_length * ARGON2_SYNC_POINTS;
instance.lanes = context->lanes;
instance.threads = context->threads;
@@ -68,10 +70,12 @@
if (ARGON2_OK != result) {
return result;
}
/* 4. Filling memory */
- fill_memory_blocks(&instance);
+ for (pass = 0; pass < instance.passes; pass++) {
+ fill_memory_blocks(&instance, pass);
+ }
/* 5. Finalization */
finalize(context, &instance);
return ARGON2_OK;