summaryrefslogtreecommitdiff
path: root/lib/accelerated/x86/sha-x86-ssse3.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/accelerated/x86/sha-x86-ssse3.c')
-rw-r--r--lib/accelerated/x86/sha-x86-ssse3.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/lib/accelerated/x86/sha-x86-ssse3.c b/lib/accelerated/x86/sha-x86-ssse3.c
index 5dc9da6349..b6393488cf 100644
--- a/lib/accelerated/x86/sha-x86-ssse3.c
+++ b/lib/accelerated/x86/sha-x86-ssse3.c
@@ -311,6 +311,25 @@ static int wrap_x86_hash_init(gnutls_digest_algorithm_t algo, void **_ctx)
return 0;
}
+static void *
+wrap_x86_hash_copy(const void *_ctx)
+{
+ struct x86_hash_ctx *new_ctx;
+ const struct x86_hash_ctx *ctx=_ctx;
+ ptrdiff_t off = (uint8_t *)ctx->ctx_ptr - (uint8_t *)(&ctx->ctx);
+
+ new_ctx = gnutls_malloc(sizeof(struct x86_hash_ctx));
+ if (new_ctx == NULL) {
+ gnutls_assert();
+ return NULL;
+ }
+
+ memcpy(new_ctx, ctx, sizeof(*new_ctx));
+ new_ctx->ctx_ptr = (uint8_t *)&new_ctx->ctx + off;
+
+ return new_ctx;
+}
+
static int
wrap_x86_hash_output(void *src_ctx, void *digest, size_t digestsize)
{
@@ -360,6 +379,7 @@ const gnutls_crypto_digest_st _gnutls_sha_x86_ssse3 = {
.init = wrap_x86_hash_init,
.hash = wrap_x86_hash_update,
.output = wrap_x86_hash_output,
+ .copy = wrap_x86_hash_copy,
.deinit = wrap_x86_hash_deinit,
.fast = wrap_x86_hash_fast,
};