lkml.org 
[lkml]   [2023]   [May]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v6 10/12] crypto: x86/aes - Prepare for a new AES implementation
On Thu, May 11, 2023 at 12:05:17PM -0700, Chang S. Bae wrote:
> +
> +struct aes_xts_ctx {
> + struct crypto_aes_ctx tweak_ctx AES_ALIGN_ATTR;
> + struct crypto_aes_ctx crypt_ctx AES_ALIGN_ATTR;
> +};
> +
> +static inline struct crypto_aes_ctx *aes_ctx(void *raw_ctx)
> +{
> + unsigned long addr = (unsigned long)raw_ctx;
> + unsigned long align = AES_ALIGN;
> +
> + if (align <= crypto_tfm_ctx_alignment())
> + align = 1;
> +
> + return (struct crypto_aes_ctx *)ALIGN(addr, align);
> +}

It seems you took my suggestion to fix the definition of struct aes_xts_ctx, but
you didn't make the corresponding change to the runtime alignment code. There
should be a helper function aes_xts_ctx() that is used like:

struct aes_xts_ctx *ctx = aes_xts_ctx(tfm);

It would do the runtime alignment. Then, aes_ctx() should be removed.

- Eric

\
 
 \ /
  Last update: 2023-05-11 23:40    [W:0.114 / U:0.892 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site