summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@gnutls.org>2013-04-27 15:08:55 +0300
committerNikos Mavrogiannopoulos <nmav@gnutls.org>2013-04-27 15:11:32 +0300
commit91664e764b274961ff06e558cb996ec6457c4049 (patch)
tree65b75eaef0544b0b8aeb7d6c2fb67463e3ccc1c4
parente413ded1aab8c4e8ce1a47400a3e5d8363f63702 (diff)
downloadgnutls-91664e764b274961ff06e558cb996ec6457c4049.tar.gz
initialize the digest after output on padlock.
-rw-r--r--lib/accelerated/x86/sha-padlock.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/accelerated/x86/sha-padlock.c b/lib/accelerated/x86/sha-padlock.c
index 91a1a8fab1..1ba5a08f2e 100644
--- a/lib/accelerated/x86/sha-padlock.c
+++ b/lib/accelerated/x86/sha-padlock.c
@@ -36,6 +36,7 @@
typedef void (*update_func) (void *, unsigned, const uint8_t *);
typedef void (*digest_func) (void *, unsigned, uint8_t *);
typedef void (*set_key_func) (void *, unsigned, const uint8_t *);
+typedef void (*init_func) (void *);
struct padlock_hash_ctx
{
@@ -52,6 +53,7 @@ struct padlock_hash_ctx
size_t length;
update_func update;
digest_func digest;
+ init_func init;
};
static int
@@ -232,6 +234,7 @@ static int _ctx_init(gnutls_digest_algorithm_t algo, struct padlock_hash_ctx *ct
sha1_init (&ctx->ctx.sha1);
ctx->update = (update_func) padlock_sha1_update;
ctx->digest = (digest_func) padlock_sha1_digest;
+ ctx->init = (init_func)sha1_init;
ctx->ctx_ptr = &ctx->ctx.sha1;
ctx->length = SHA1_DIGEST_SIZE;
break;
@@ -239,6 +242,7 @@ static int _ctx_init(gnutls_digest_algorithm_t algo, struct padlock_hash_ctx *ct
sha224_init (&ctx->ctx.sha224);
ctx->update = (update_func) padlock_sha256_update;
ctx->digest = (digest_func) padlock_sha256_digest;
+ ctx->init = (init_func)sha224_init;
ctx->ctx_ptr = &ctx->ctx.sha224;
ctx->length = SHA224_DIGEST_SIZE;
break;
@@ -246,6 +250,7 @@ static int _ctx_init(gnutls_digest_algorithm_t algo, struct padlock_hash_ctx *ct
sha256_init (&ctx->ctx.sha256);
ctx->update = (update_func) padlock_sha256_update;
ctx->digest = (digest_func) padlock_sha256_digest;
+ ctx->init = (init_func)sha256_init;
ctx->ctx_ptr = &ctx->ctx.sha256;
ctx->length = SHA256_DIGEST_SIZE;
break;
@@ -253,6 +258,7 @@ static int _ctx_init(gnutls_digest_algorithm_t algo, struct padlock_hash_ctx *ct
sha384_init (&ctx->ctx.sha384);
ctx->update = (update_func) padlock_sha512_update;
ctx->digest = (digest_func) padlock_sha512_digest;
+ ctx->init = (init_func)sha384_init;
ctx->ctx_ptr = &ctx->ctx.sha384;
ctx->length = SHA384_DIGEST_SIZE;
break;
@@ -260,6 +266,7 @@ static int _ctx_init(gnutls_digest_algorithm_t algo, struct padlock_hash_ctx *ct
sha512_init (&ctx->ctx.sha512);
ctx->update = (update_func) padlock_sha512_update;
ctx->digest = (digest_func) padlock_sha512_digest;
+ ctx->init = (init_func)sha512_init;
ctx->ctx_ptr = &ctx->ctx.sha512;
ctx->length = SHA512_DIGEST_SIZE;
break;
@@ -309,6 +316,8 @@ wrap_padlock_hash_output (void *src_ctx, void *digest, size_t digestsize)
ctx->digest (ctx->ctx_ptr, digestsize, digest);
+ ctx->init( ctx->ctx_ptr);
+
return 0;
}