aboutsummaryrefslogtreecommitdiff
path: root/providers/implementations/macs
diff options
context:
space:
mode:
authorTomas Mraz <tomas@openssl.org>2022-04-21 17:09:14 +0200
committerTomas Mraz <tomas@openssl.org>2022-04-27 10:05:56 +0200
commit6893e691d8dafe8fb74585f6c23f1ca8d70f97a9 (patch)
treeaba3c6c42f15f448fc30b4b135e07a54b951b91d /providers/implementations/macs
parentb2015891c4edd99284a4b9ec97ee4ac61e57c310 (diff)
downloadopenssl-6893e691d8dafe8fb74585f6c23f1ca8d70f97a9.zip
openssl-6893e691d8dafe8fb74585f6c23f1ca8d70f97a9.tar.gz
openssl-6893e691d8dafe8fb74585f6c23f1ca8d70f97a9.tar.bz2
siphash: Properly set mac size in sipcopy
Also fully duplicate the context on dup Reviewed-by: Paul Dale <pauli@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/18142) (cherry picked from commit 905fec4f4d6bb8a978476cbce0f293ffc683b5fd)
Diffstat (limited to 'providers/implementations/macs')
-rw-r--r--providers/implementations/macs/siphash_prov.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/providers/implementations/macs/siphash_prov.c b/providers/implementations/macs/siphash_prov.c
index 2a291d7..35265e5 100644
--- a/providers/implementations/macs/siphash_prov.c
+++ b/providers/implementations/macs/siphash_prov.c
@@ -77,11 +77,11 @@ static void *siphash_dup(void *vsrc)
if (!ossl_prov_is_running())
return NULL;
- sdst = siphash_new(ssrc->provctx);
+ sdst = OPENSSL_malloc(sizeof(*sdst));
if (sdst == NULL)
return NULL;
- sdst->siphash = ssrc->siphash;
+ *sdst = *ssrc;
return sdst;
}
@@ -112,7 +112,8 @@ static int siphash_init(void *vmacctx, const unsigned char *key, size_t keylen,
if (!ossl_prov_is_running() || !siphash_set_params(ctx, params))
return 0;
- /* Without a key, there is not much to do here,
+ /*
+ * Without a key, there is not much to do here,
* The actual initialization happens through controls.
*/
if (key == NULL) {
@@ -202,7 +203,8 @@ static int siphash_set_params(void *vmacctx, const OSSL_PARAM *params)
if ((p = OSSL_PARAM_locate_const(params, OSSL_MAC_PARAM_SIZE)) != NULL) {
if (!OSSL_PARAM_get_size_t(p, &size)
- || !SipHash_set_hash_size(&ctx->siphash, size))
+ || !SipHash_set_hash_size(&ctx->siphash, size)
+ || !SipHash_set_hash_size(&ctx->sipcopy, size))
return 0;
}
if ((p = OSSL_PARAM_locate_const(params, OSSL_MAC_PARAM_C_ROUNDS)) != NULL