poly1305: Properly copy the whole context on dup
Also reset the updated flag when Poly1305_Init is called.
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/18143)
diff --git a/providers/implementations/macs/poly1305_prov.c b/providers/implementations/macs/poly1305_prov.c
index ad67216..28789d2 100644
--- a/providers/implementations/macs/poly1305_prov.c
+++ b/providers/implementations/macs/poly1305_prov.c
@@ -65,11 +65,11 @@
if (!ossl_prov_is_running())
return NULL;
- dst = poly1305_new(src->provctx);
+ dst = OPENSSL_malloc(sizeof(*dst));
if (dst == NULL)
return NULL;
- dst->poly1305 = src->poly1305;
+ *dst = *src;
return dst;
}
@@ -86,6 +86,7 @@
return 0;
}
Poly1305_Init(&ctx->poly1305, key);
+ ctx->updated = 0;
return 1;
}