From: dmitry dulesov Date: Thu, 30 Jan 2020 00:50:54 +0000 (+0300) Subject: gosthash2012: Simplify `pad' X-Git-Tag: v3.0.0~221 X-Git-Url: http://www.wagner.pp.ru/gitweb/?p=openssl-gost%2Fengine.git;a=commitdiff_plain;h=11777554bd63b16bb13aa3b7358d8e7809f17523 gosthash2012: Simplify `pad' `pad' does not need this complicated memory movements using stack buffer. Committed-by: Vitaly Chikunov --- diff --git a/gosthash2012.c b/gosthash2012.c index 0233d0a..201fe31 100644 --- a/gosthash2012.c +++ b/gosthash2012.c @@ -48,13 +48,9 @@ void init_gost2012_hash_ctx(gost2012_hash_ctx * CTX, static INLINE void pad(gost2012_hash_ctx * CTX) { - unsigned char buf[64]; + memset(&(CTX->buffer[CTX->bufsize]), 0, sizeof(CTX->buffer) - CTX->bufsize); + CTX->buffer[CTX->bufsize] = 1; - memset(&buf, 0x00, sizeof buf); - memcpy(&buf, CTX->buffer, CTX->bufsize); - - buf[CTX->bufsize] = 0x01; - memcpy(CTX->buffer, &buf, sizeof buf); } static INLINE void add512(const union uint512_u *x,