diff options
author | Jussi Kivilinna <jussi.kivilinna@iki.fi> | 2013-09-21 13:54:38 +0300 |
---|---|---|
committer | Jussi Kivilinna <jussi.kivilinna@iki.fi> | 2013-09-21 13:54:38 +0300 |
commit | 592c2ab3deeeccbb6d3b078ed7bf0e6627c8e1fb (patch) | |
tree | 067ff9ba60af04b9570da3f54c3ff6c992650a90 /cipher/gostr3411-94.c | |
parent | 902ea6052c11108bd19333c31b03e084bed1fb86 (diff) | |
download | libgcrypt-592c2ab3deeeccbb6d3b078ed7bf0e6627c8e1fb.tar.gz |
Use hash transform function return type for passing burn stack depth
* cipher/gostr4311-94.c (transform): Return stack burn depth.
* cipher/hash-common.c (_gcry_md_block_write): Use stack burn depth
returned by 'hd->bwrite'.
* cipher/hash-common.h (_gcry_md_block_write_t): Change return type to
'unsigned int'.
(gry_md_block_ctx_t): Remove 'stack_burn'.
* cipher/md4.c (transform): Return stack burn depth.
(md4_final): Use stack burn depth from transform.
* cipher/md5.c (transform): Return stack burn depth.
(md5_final): Use stack burn depth from transform.
* cipher/rmd160.c (transform): Return stack burn depth.
(rmd160_final): Use stack burn depth from transform.
* cipher/sha1.c (transform): Return stack burn depth.
(sha1_final): Use stack burn depth from transform.
* cipher/sha256.c (transform): Return stack burn depth.
(sha256_final): Use stack burn depth from transform.
* cipher/sha512.c (__transform, transform): Return stack burn depth.
(sha512_final): Use stack burn depth from transform.
* cipher/stribog.c (transform64): Return stack burn depth.
* cipher/tiger.c (transform): Return stack burn depth.
(tiger_final): Use stack burn depth from transform.
--
Transform function might want different depth of stack burn depending on
detected CPU features (like in SHA-512 on ARM with NEON). So return
stack burn depth from transform functions as a request or a hint to
calling function.
Signed-off-by: Jussi Kivilinna <jussi.kivilinna@iki.fi>
Diffstat (limited to 'cipher/gostr3411-94.c')
-rw-r--r-- | cipher/gostr3411-94.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/cipher/gostr3411-94.c b/cipher/gostr3411-94.c index 93bf5973..bfd52bd8 100644 --- a/cipher/gostr3411-94.c +++ b/cipher/gostr3411-94.c @@ -38,7 +38,7 @@ typedef struct { u32 len; } GOSTR3411_CONTEXT; -static void +static unsigned int transform (void *c, const unsigned char *data); static void @@ -53,8 +53,6 @@ gost3411_init (void *context) hd->bctx.nblocks = 0; hd->bctx.count = 0; hd->bctx.blocksize = 32; - /* FIXME: Fix this arbitrary value for the stack_burn size. -wk */ - hd->bctx.stack_burn = 200; hd->bctx.bwrite = transform; } @@ -203,7 +201,7 @@ do_hash_step (GOST28147_context *hd, unsigned char *h, unsigned char *m) } -static void +static unsigned int transform (void *ctx, const unsigned char *data) { GOSTR3411_CONTEXT *hd = ctx; @@ -212,6 +210,9 @@ transform (void *ctx, const unsigned char *data) memcpy (m, data, 32); do_hash_step (&hd->hd, hd->h, m); do_add (hd->sigma, m); + +/* FIXME: Fix this arbitrary value for the stack_burn size. -wk */ + return /* stack_burn */ 200; } /* |