Skip to content

Commit

Permalink
[fix] added missing munlock for ir when H0_k is not mlocked
Browse files Browse the repository at this point in the history
  • Loading branch information
stef committed Feb 27, 2023
1 parent 764e56a commit d9cd6a3
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/sphinx.c
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,10 @@ int sphinx_finish(const uint8_t *pwd, const size_t p_len, const uint8_t bfac[cry

// resp^(1/bfac) = h(pwd)^secret == H0^k
unsigned char H0_k[crypto_core_ristretto255_BYTES];
if(-1==sodium_mlock(H0_k,sizeof H0_k)) return -1;
if(-1==sodium_mlock(H0_k,sizeof H0_k)) {
sodium_munlock(ir, sizeof ir);
return -1;
}
if (crypto_scalarmult_ristretto255(H0_k, ir, resp) != 0) {
sodium_munlock(ir, sizeof ir);
sodium_munlock(H0_k,sizeof H0_k);
Expand Down

0 comments on commit d9cd6a3

Please sign in to comment.