From: Tadeusz Struk <tadeusz.struk@intel.com>
To: Markus Stockhausen <stockhausen@collogia.de>
Cc: "linux-crypto@vger.kernel.org" <linux-crypto@vger.kernel.org>
Subject: Re: AW: Best way to align key in AES context
Date: Fri, 13 Feb 2015 06:47:11 -0800 [thread overview]
Message-ID: <54DE0E6F.7090509@intel.com> (raw)
In-Reply-To: <12EF8D94C6F8734FB2FF37B9FBEDD1735F9DD877@EXCHANGE.collogia.de>
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);
next prev parent reply other threads:[~2015-02-13 14:50 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <12EF8D94C6F8734FB2FF37B9FBEDD1735F9DD863@EXCHANGE.collogia.de>
2015-02-11 10:28 ` AW: Best way to align key in AES context Markus Stockhausen
2015-02-13 14:47 ` Tadeusz Struk [this message]
2015-02-13 16:49 ` AW: " Markus Stockhausen
2015-02-14 0:59 ` Tadeusz Struk
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=54DE0E6F.7090509@intel.com \
--to=tadeusz.struk@intel.com \
--cc=linux-crypto@vger.kernel.org \
--cc=stockhausen@collogia.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.