diff options
author | Jussi Kivilinna <jussi.kivilinna@iki.fi> | 2013-12-17 15:35:38 +0200 |
---|---|---|
committer | Jussi Kivilinna <jussi.kivilinna@iki.fi> | 2013-12-17 15:48:32 +0200 |
commit | 6fd0dd2a5f1362f91e2861cd9d300341a43842a5 (patch) | |
tree | df605eb526e039be53a88b948167e301632fa049 /cipher/sha1.c | |
parent | 50b8c8342d023038a4b528af83153293dd2756ea (diff) | |
download | libgcrypt-6fd0dd2a5f1362f91e2861cd9d300341a43842a5.tar.gz |
SHA-1/SSSE3: Improve performance on large buffers
* cipher/sha1-ssse3-amd64.S (RNBLKS): New.
(_gcry_sha1_transform_amd64_ssse3): Handle multiple input blocks, with
software pipelining of next data block processing.
* cipher/sha1.c [USE_SSSE3] (_gcry_sha1_transform_amd64_ssse3): Add
'nblks'.
(transform) [USE_SSSE3]: Pass nblks to assembly function.
--
Patch gives small improvement for large buffer processing, on Intel i5-4570
speed goes from 4.80 c/B to 4.61 c/B.
Signed-off-by: Jussi Kivilinna <jussi.kivilinna@iki.fi>
Diffstat (limited to 'cipher/sha1.c')
-rw-r--r-- | cipher/sha1.c | 15 |
1 files changed, 4 insertions, 11 deletions
diff --git a/cipher/sha1.c b/cipher/sha1.c index 53f75381..8040e766 100644 --- a/cipher/sha1.c +++ b/cipher/sha1.c @@ -234,7 +234,8 @@ transform_blk (void *ctx, const unsigned char *data) #ifdef USE_SSSE3 unsigned int -_gcry_sha1_transform_amd64_ssse3 (void *state, const unsigned char *data); +_gcry_sha1_transform_amd64_ssse3 (void *state, const unsigned char *data, + size_t nblks); #endif @@ -246,16 +247,8 @@ transform (void *ctx, const unsigned char *data, size_t nblks) #ifdef USE_SSSE3 if (hd->use_ssse3) - { - do - { - burn = _gcry_sha1_transform_amd64_ssse3 (&hd->h0, data); - data += 64; - } - while (--nblks); - - return burn + 4 * sizeof(void*); - } + return _gcry_sha1_transform_amd64_ssse3 (&hd->h0, data, nblks) + + 4 * sizeof(void*); #endif do |