diff options
author | Attila Fülöp <[email protected]> | 2020-10-30 23:24:21 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2020-10-30 15:24:21 -0700 |
commit | e8beeaa1116cc771360a24c9c1f9e6f47ced0e28 (patch) | |
tree | 2abe313d9fa753ef2ade6a19781641841d3b0c86 /module/icp/algs/modes/modes.c | |
parent | d9655c5b3723abc21dc2915e8d6aecf22d842527 (diff) |
ICP: gcm: Allocate hash subkey table separately
While evaluating other assembler implementations it turns out that
the precomputed hash subkey tables vary in size, from 8*16 bytes
(avx2/avx512) up to 48*16 bytes (avx512-vaes), depending on the
implementation.
To be able to handle the size differences later, allocate
`gcm_Htable` dynamically rather then having a fixed size array, and
adapt consumers.
Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Attila Fülöp <[email protected]>
Closes #11102
Diffstat (limited to 'module/icp/algs/modes/modes.c')
-rw-r--r-- | module/icp/algs/modes/modes.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/module/icp/algs/modes/modes.c b/module/icp/algs/modes/modes.c index f07876a47..faae9722b 100644 --- a/module/icp/algs/modes/modes.c +++ b/module/icp/algs/modes/modes.c @@ -152,6 +152,14 @@ crypto_free_mode_ctx(void *ctx) vmem_free(((gcm_ctx_t *)ctx)->gcm_pt_buf, ((gcm_ctx_t *)ctx)->gcm_pt_buf_len); +#ifdef CAN_USE_GCM_ASM + if (((gcm_ctx_t *)ctx)->gcm_Htable != NULL) { + gcm_ctx_t *gcm_ctx = (gcm_ctx_t *)ctx; + bzero(gcm_ctx->gcm_Htable, gcm_ctx->gcm_htab_len); + kmem_free(gcm_ctx->gcm_Htable, gcm_ctx->gcm_htab_len); + } +#endif + kmem_free(ctx, sizeof (gcm_ctx_t)); } } |