mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-22 02:27:36 +03:00
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 <behlendorf1@llnl.gov> Signed-off-by: Attila Fülöp <attila@fueloep.org> Closes #11102
This commit is contained in:
committed by
Brian Behlendorf
parent
2c37e1416b
commit
c6b0680d9b
@@ -1051,6 +1051,16 @@ out:
|
||||
bzero(aes_ctx.ac_keysched, aes_ctx.ac_keysched_len);
|
||||
kmem_free(aes_ctx.ac_keysched, aes_ctx.ac_keysched_len);
|
||||
}
|
||||
#ifdef CAN_USE_GCM_ASM
|
||||
if (aes_ctx.ac_flags & (GCM_MODE|GMAC_MODE) &&
|
||||
((gcm_ctx_t *)&aes_ctx)->gcm_Htable != NULL) {
|
||||
|
||||
gcm_ctx_t *ctx = (gcm_ctx_t *)&aes_ctx;
|
||||
|
||||
bzero(ctx->gcm_Htable, ctx->gcm_htab_len);
|
||||
kmem_free(ctx->gcm_Htable, ctx->gcm_htab_len);
|
||||
}
|
||||
#endif
|
||||
|
||||
return (ret);
|
||||
}
|
||||
@@ -1209,6 +1219,14 @@ out:
|
||||
vmem_free(((gcm_ctx_t *)&aes_ctx)->gcm_pt_buf,
|
||||
((gcm_ctx_t *)&aes_ctx)->gcm_pt_buf_len);
|
||||
}
|
||||
#ifdef CAN_USE_GCM_ASM
|
||||
if (((gcm_ctx_t *)&aes_ctx)->gcm_Htable != NULL) {
|
||||
gcm_ctx_t *ctx = (gcm_ctx_t *)&aes_ctx;
|
||||
|
||||
bzero(ctx->gcm_Htable, ctx->gcm_htab_len);
|
||||
kmem_free(ctx->gcm_Htable, ctx->gcm_htab_len);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
return (ret);
|
||||
|
||||
Reference in New Issue
Block a user