lkml.org 
[lkml]   [2018]   [Sep]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH net-next v5 12/20] zinc: BLAKE2s generic C implementation and selftest
Hey Eric,

On Wed, Sep 19, 2018 at 2:41 AM Eric Biggers <ebiggers@kernel.org> wrote:
> This buffer is 4 times too long.

Nice catch.

> Or how about something much simpler:
>
> static inline void blake2s_final(struct blake2s_state *state, u8 *out,
> const size_t outlen)
> {
> #ifdef DEBUG
> BUG_ON(!out || !outlen || outlen > BLAKE2S_OUTBYTES);
> #endif
> __blake2s_final(state);
>
> cpu_to_le32_array(state->h, ARRAY_SIZE(state->h));
> memcpy(out, state->h, outlen);
>
> memzero_explicit(state, sizeof(*state));
> }

Oh, that's excellent, thanks. Much better than prior. I'll do exactly that.

Jason

\
 
 \ /
  Last update: 2018-09-19 02:46    [W:0.087 / U:0.476 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site