add missing initialisation of stack memory to BAFHHostStr(); fix comments for BAFHror()
This commit is contained in:
parent
babd9c4cf0
commit
643cd0b7e9
12
mirhash.h
12
mirhash.h
@ -1,6 +1,6 @@
|
||||
/*-
|
||||
* Copyright © 2011, 2014
|
||||
* Thorsten Glaser <tg@mirbsd.org>
|
||||
* Copyright © 2011, 2014, 2015
|
||||
* Thorsten “mirabilos” Glaser <tg@mirbsd.org>
|
||||
*
|
||||
* Provided that these terms and disclaimer and all copyright notices
|
||||
* are retained or reproduced in an accompanying document, permission
|
||||
@ -44,7 +44,7 @@
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
__RCSID("$MirOS: src/bin/mksh/mirhash.h,v 1.3 2014/10/02 19:34:06 tg Exp $");
|
||||
__RCSID("$MirOS: src/bin/mksh/mirhash.h,v 1.4 2015/05/30 22:14:06 tg Exp $");
|
||||
|
||||
/*-
|
||||
* BAFH itself is defined by the following primitives:
|
||||
@ -61,7 +61,8 @@ __RCSID("$MirOS: src/bin/mksh/mirhash.h,v 1.3 2014/10/02 19:34:06 tg Exp $");
|
||||
* the context is (still) zero, adding a NUL byte is not ignored.
|
||||
*
|
||||
* • BAFHror(eax,cl) evaluates to the unsigned 32-bit integer “eax”,
|
||||
* rotated right by “cl” ∈ [0;31]; no casting, be careful!
|
||||
* rotated right by “cl” ∈ [0; 31] (no casting, be careful!) where
|
||||
* “eax” must be uint32_t and “cl” an in-range integer.
|
||||
*
|
||||
* • BAFHFinish(ctx) avalanches the context around so every sub-byte
|
||||
* depends on all input octets; afterwards, the context variable’s
|
||||
@ -88,7 +89,7 @@ __RCSID("$MirOS: src/bin/mksh/mirhash.h,v 1.3 2014/10/02 19:34:06 tg Exp $");
|
||||
* • BAFHHostStr(ctx,buf) does the same for C strings.
|
||||
*
|
||||
* All macros may use ctx multiple times in their expansion, but all
|
||||
* other arguments are always evaluated at most once.
|
||||
* other arguments are always evaluated at most once except BAFHror.
|
||||
*
|
||||
* To stay portable, never use the BAFHHost*() macros (these are for
|
||||
* host-local entropy shuffling), and encode numbers using ULEB128.
|
||||
@ -206,6 +207,7 @@ __RCSID("$MirOS: src/bin/mksh/mirhash.h,v 1.3 2014/10/02 19:34:06 tg Exp $");
|
||||
} BAFHHost_v; \
|
||||
\
|
||||
BAFHUpdate_s = (const void *)(s); \
|
||||
BAFHHost_v.as_u32 = 0; \
|
||||
if ((BAFHHost_v.as_u8[0] = *BAFHUpdate_s) != 0) \
|
||||
++BAFHUpdate_s; \
|
||||
if ((BAFHHost_v.as_u8[1] = *BAFHUpdate_s) != 0) \
|
||||
|
Loading…
Reference in New Issue
Block a user