Skip to content
This repository has been archived by the owner on Sep 20, 2023. It is now read-only.

Commit

Permalink
Fix skein256/skein512 issue where an empty bytestring trigger state c…
Browse files Browse the repository at this point in the history
…hange

If an empty bytestring is use to call update, it could trigger the
processing of the buf, that could be holding the data for finalize
(the last block). That would give bad calculations.
  • Loading branch information
vincenthz committed Mar 27, 2014
1 parent 0f9a9c0 commit 0999082
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions cbits/skein256.c
Expand Up @@ -124,6 +124,9 @@ void skein256_update(struct skein256_ctx *ctx, uint8_t *data, uint32_t len)
{
uint32_t to_fill;

if (!len)
return;

to_fill = 32 - ctx->bufindex;

if (ctx->bufindex == 32) {
Expand Down
3 changes: 3 additions & 0 deletions cbits/skein512.c
Expand Up @@ -142,6 +142,9 @@ void skein512_update(struct skein512_ctx *ctx, uint8_t *data, uint32_t len)
{
uint32_t to_fill;

if (!len)
return;

to_fill = 64 - ctx->bufindex;

if (ctx->bufindex == 64) {
Expand Down

0 comments on commit 0999082

Please sign in to comment.