mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-11-22 07:28:10 +00:00
Groestl hash: more cleanups
This commit is contained in:
parent
f15605bd45
commit
c861ad8bbc
11
groestl.c
11
groestl.c
@ -1019,21 +1019,18 @@ groestl_big_close(sph_groestl_big_context *sc,
|
||||
groestl_big_init(sc, (unsigned)out_len << 3);
|
||||
}
|
||||
|
||||
/* see sph_groestl.h */
|
||||
void
|
||||
groestl512_Init(void *cc)
|
||||
{
|
||||
groestl_big_init((sph_groestl_big_context *)cc, 512);
|
||||
}
|
||||
|
||||
/* see sph_groestl.h */
|
||||
void
|
||||
groestl512_Update(void *cc, const void *data, size_t len)
|
||||
{
|
||||
groestl_big_core((sph_groestl_big_context *)cc, data, len);
|
||||
}
|
||||
|
||||
/* see sph_groestl.h */
|
||||
void
|
||||
groestl512_Final(void *cc, void *dst)
|
||||
{
|
||||
@ -1046,15 +1043,7 @@ groestl512_DoubleTrunc(void *cc, void *dst)
|
||||
char buf[64];
|
||||
|
||||
groestl512_Final(cc, buf);
|
||||
groestl512_Init(cc);
|
||||
groestl512_Update(cc, buf, sizeof(buf));
|
||||
groestl512_Final(cc, buf);
|
||||
memcpy(dst, buf, 32);
|
||||
}
|
||||
|
||||
/* see sph_groestl.h */
|
||||
void
|
||||
sph_groestl512_addbits_and_close(void *cc, unsigned ub, unsigned n, void *dst)
|
||||
{
|
||||
groestl_big_close((sph_groestl_big_context *)cc, ub, n, dst, 64);
|
||||
}
|
||||
|
18
groestl.h
18
groestl.h
@ -89,23 +89,7 @@ void groestl512_Update(void *cc, const void *data, size_t len);
|
||||
*/
|
||||
void groestl512_Final(void *cc, void *dst);
|
||||
|
||||
|
||||
/* Calculate double Groestl-512 hash and truncate it to 256-bits. */
|
||||
void groestl512_DoubleTrunc(void *cc, void *dst);
|
||||
|
||||
/**
|
||||
* Add a few additional bits (0 to 7) to the current computation, then
|
||||
* terminate it and output the result in the provided buffer, which must
|
||||
* be wide enough to accomodate the result (64 bytes). If bit number i
|
||||
* in <code>ub</code> has value 2^i, then the extra bits are those
|
||||
* numbered 7 downto 8-n (this is the big-endian convention at the byte
|
||||
* level). The context is automatically reinitialized.
|
||||
*
|
||||
* @param cc the Groestl-512 context
|
||||
* @param ub the extra bits
|
||||
* @param n the number of extra bits (0 to 7)
|
||||
* @param dst the destination buffer
|
||||
*/
|
||||
void sph_groestl512_addbits_and_close(
|
||||
void *cc, unsigned ub, unsigned n, void *dst);
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user