From: marex@denx.de (Marek Vasut)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] arm64: SHA-224/SHA-256 using ARMv8 Crypto Extensions
Date: Mon, 24 Mar 2014 21:36:20 +0100 [thread overview]
Message-ID: <201403242136.20547.marex@denx.de> (raw)
In-Reply-To: <1395326886-5866-1-git-send-email-ard.biesheuvel@linaro.org>
On Thursday, March 20, 2014 at 03:48:06 PM, Ard Biesheuvel wrote:
> This patch adds support for the SHA-224 and SHA-256 hash algorithms using
> the NEON based SHA-256 instructions that were introduced in ARM v8.
>
> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> ---
[...]
> + * Copyright (c) Alan Smithee.
Email contact is missing here.
[...]
> +static int sha224_init(struct shash_desc *desc)
> +{
> + struct sha256_state *sctx = shash_desc_ctx(desc);
> +
> + *sctx = (struct sha256_state){
This cast is interesting, I don't quite understand it. Can you please explain
that to me ?
> + .state = {
> + SHA224_H0, SHA224_H1, SHA224_H2, SHA224_H3,
> + SHA224_H4, SHA224_H5, SHA224_H6, SHA224_H7,
> + }
> + };
> + return 0;
> +}
[...]
> +static int sha224_final(struct shash_desc *desc, u8 *out)
> +{
> + struct sha256_state *sctx = shash_desc_ctx(desc);
> + __be32 *dst = (__be32 *)out;
> + int i;
> +
> + sha2_final(desc);
> +
> + for (i = 0; i < SHA224_DIGEST_SIZE / sizeof(*dst); i++)
> + dst[i] = cpu_to_be32(sctx->state[i]);
Won't this cause unaligned access if *dst is not aligned to 32 bytes ?
Try the crypto tests with this patch to see if this explodes please.
diff --git a/crypto/testmgr.c b/crypto/testmgr.c
index 7795550..b9b7144 100644
--- a/crypto/testmgr.c
+++ b/crypto/testmgr.c
@@ -191,7 +191,8 @@ static int __test_hash(struct crypto_ahash *tfm, struct
hash_testvec *template,
const char *algo = crypto_tfm_alg_driver_name(crypto_ahash_tfm(tfm));
unsigned int i, j, k, temp;
struct scatterlist sg[8];
- char result[64];
+ char _result[68];
+ char *result = _result + 1;
struct ahash_request *req;
struct tcrypt_result tresult;
void *hash_buff;
[...]
next prev parent reply other threads:[~2014-03-24 20:36 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-20 14:48 [PATCH] arm64: SHA-224/SHA-256 using ARMv8 Crypto Extensions Ard Biesheuvel
2014-03-24 20:36 ` Marek Vasut [this message]
2014-03-27 13:23 ` Ard Biesheuvel
2014-03-28 5:15 ` Marek Vasut
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=201403242136.20547.marex@denx.de \
--to=marex@denx.de \
--cc=linux-arm-kernel@lists.infradead.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).