Skip to content

Commit

Permalink
Update Keccak state flag in SHA3 functions
Browse files Browse the repository at this point in the history
  • Loading branch information
manastasova committed Jan 3, 2025
1 parent 7edb6c7 commit 7386c1b
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions crypto/fipsmodule/sha/sha3.c
Original file line number Diff line number Diff line change
Expand Up @@ -234,11 +234,17 @@ int SHA3_Final(uint8_t *md, KECCAK1600_CTX *ctx) {
return 1;
}

if (ctx->state == KECCAK1600_STATE_SQUEEZE ||
ctx->state == KECCAK1600_STATE_FINAL) {
return 0;
}

if (FIPS202_Finalize(md, ctx) == 0) {
return 0;
}

Keccak1600_Squeeze(ctx->A, md, ctx->md_size, ctx->block_size, ctx->state);
ctx->state = KECCAK1600_STATE_FINAL;

FIPS_service_indicator_update_state();
return 1;
Expand Down

0 comments on commit 7386c1b

Please sign in to comment.