Skip to content

Commit

Permalink
Bug with blake2b_nativeInOut() when out and in overlap
Browse files Browse the repository at this point in the history
`out` was filled with BLAKE2b's IV. Thus overwriting the input.
  • Loading branch information
Sc00bz authored Mar 11, 2024
1 parent bbac9c8 commit be1e52e
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion blake2b.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,17 @@ void blake2b_nativeIn(void *out, size_t outSize, const uint64_t *in, size_t inSi
*/
void blake2b_nativeInOut(uint64_t out[8], const uint64_t *in, size_t inSize)
{
blake2b_native(out, 0x01010040, in, inSize);
uint64_t hash[8];

blake2b_native(hash, 0x01010040, in, inSize);

for (size_t i = 0; i < 8; i++)
{
out[i] hash[i];

This comment has been minimized.

Copy link
@forty

forty Mar 11, 2024

@Sc00bz missing equal sign?

This comment has been minimized.

Copy link
@Sc00bz

Sc00bz Mar 12, 2024

Author Owner

Yes

}

// Clear
secureClearMemory(hash, sizeof(hash));
}

#endif

0 comments on commit be1e52e

Please sign in to comment.