diff options
author | Taehee Yoo <ap420073@gmail.com> | 2023-01-01 09:12:50 +0000 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2023-01-06 17:15:47 +0800 |
commit | d8e6eb21f7af62608dcd5cdede8dd2d7ce9a60c1 (patch) | |
tree | 5178ee87b8ab07c2bdb70ba8b89a717544c07d31 /crypto | |
parent | 762f8d3c539f52283c6040cdc790614c271abd69 (diff) | |
download | linux-crypto-d8e6eb21f7af62608dcd5cdede8dd2d7ce9a60c1.tar.gz linux-crypto-d8e6eb21f7af62608dcd5cdede8dd2d7ce9a60c1.zip |
crypto: x86/aria - do not use magic number offsets of aria_ctx
aria-avx assembly code accesses members of aria_ctx with magic number
offset. If the shape of struct aria_ctx is changed carelessly,
aria-avx will not work.
So, we need to ensure accessing members of aria_ctx with correct
offset values, not with magic numbers.
It adds ARIA_CTX_enc_key, ARIA_CTX_dec_key, and ARIA_CTX_rounds in the
asm-offsets.c So, correct offset definitions will be generated.
aria-avx assembly code can access members of aria_ctx safely with
these definitions.
Signed-off-by: Taehee Yoo <ap420073@gmail.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'crypto')
-rw-r--r-- | crypto/aria_generic.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/crypto/aria_generic.c b/crypto/aria_generic.c index 4cc29b82..d96dfc4f 100644 --- a/crypto/aria_generic.c +++ b/crypto/aria_generic.c @@ -178,6 +178,10 @@ int aria_set_key(struct crypto_tfm *tfm, const u8 *in_key, unsigned int key_len) if (key_len != 16 && key_len != 24 && key_len != 32) return -EINVAL; + BUILD_BUG_ON(sizeof(ctx->enc_key) != 272); + BUILD_BUG_ON(sizeof(ctx->dec_key) != 272); + BUILD_BUG_ON(sizeof(int) != sizeof(ctx->rounds)); + ctx->key_length = key_len; ctx->rounds = (key_len + 32) / 4; |