On 02/11/2015 02:28 AM, Markus Stockhausen wrote:
> I want to ensure that the key data in an AES ctx structure is 8 byte aligned
> to avoid aligment exceptions afterwards. Other fields don't need that
> restriction. At the moment I'm using the following (ugly) implementation.
>
> struct ppc_aes_ctx {
> u32 rounds;
> u32 *key_enc;
> u32 *key_dec;
> char data[AES_MAX_KEYLENGTH * 2 + 8];
> };
> ...
> char *ptr;
> ptr = ctx->data;
> ptr = PTR_ALIGN(ptr, 8);
> ctx->key_enc = (u32 *)(ptr);
> ctx->key_dec = (u32 *)(ptr + AES_MAX_KEYLENGTH);
>
> Can anyone show me the recommended way for doing that.
You can use gcc attributes.
struct ppc_aes_ctx {
u8 key_enc[AES_MAX_KEYLENGTH];
u8 key_dec[AES_MAX_KEYLENGTH];
u32 rounds;
} __aligned(8);
--
To unsubscribe from this list: send the line "unsubscribe linux-crypto" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html