Permalink
Browse files

Fix skein256/skein512 issue where an empty bytestring trigger state c…

…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...
1 parent 0f9a9c0 commit 09990821f7f5701edfd5bac6e7825f102fd08ae3 @vincenthz committed Mar 27, 2014
Showing with 6 additions and 0 deletions.
  1. +3 −0 cbits/skein256.c
  2. +3 −0 cbits/skein512.c
View
@@ -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) {
View
@@ -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) {

0 comments on commit 0999082

Please sign in to comment.