summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJussi Kivilinna <jussi.kivilinna@iki.fi>2014-05-21 08:30:30 +0300
committerJussi Kivilinna <jussi.kivilinna@iki.fi>2014-05-21 08:30:33 +0300
commitbeb901575f0d6cd6a0a27506ebea9a725754d0cc (patch)
treeb485c1abbed1d420d91c52a34d3de5370ea38f1d
parent994c758d8f5471c7e9c38c2834742cca2502d35f (diff)
downloadlibgcrypt-beb901575f0d6cd6a0a27506ebea9a725754d0cc.tar.gz
sha512: fix ARM/NEON implementation
* cipher/sha512-armv7-neon.S (_gcry_sha512_transform_armv7_neon): Byte-swap RW67q and RW1011q correctly in multi-block loop. * tests/basic.c (check_digests): Add large test vector for SHA512. -- Patch fixes bug introduced to multi-block processing by commit df629ba53a6, "Improve performance of SHA-512/ARM/NEON implementation". Patch also adds multi-block test vector for SHA-512. Signed-off-by: Jussi Kivilinna <jussi.kivilinna@iki.fi>
-rw-r--r--cipher/sha512-armv7-neon.S2
-rw-r--r--tests/basic.c13
2 files changed, 14 insertions, 1 deletions
diff --git a/cipher/sha512-armv7-neon.S b/cipher/sha512-armv7-neon.S
index bb2cbb4a..a9d12724 100644
--- a/cipher/sha512-armv7-neon.S
+++ b/cipher/sha512-armv7-neon.S
@@ -361,8 +361,8 @@ _gcry_sha512_transform_armv7_neon:
rounds2_64_79(RE, RF, RG, RH, RA, RB, RC, RD, RW12, RW13, vadd_rg_RT0, RE, vadd_rg_RT1, RE);
rounds2_64_79(RC, RD, RE, RF, RG, RH, RA, RB, RW14, RW15, vadd_rg_RT0, RC, vadd_rg_RT1, RC);
#ifdef __ARMEL__
- vrev64.8 RW67q, RW67q;
vrev64.8 RW89q, RW89q;
+ vrev64.8 RW1011q, RW1011q;
#endif
vld1.64 {RW12-RW15}, [%r1]!;
vadd_rg_RT0(RA);
diff --git a/tests/basic.c b/tests/basic.c
index 97409193..2be64322 100644
--- a/tests/basic.c
+++ b/tests/basic.c
@@ -4566,6 +4566,19 @@ check_digests (void)
"\x12\xE6\xFA\x4E\x89\xA9\x7E\xA2\x0A\x9E\xEE\xE6\x4B\x55\xD3\x9A"
"\x21\x92\x99\x2A\x27\x4F\xC1\xA8\x36\xBA\x3C\x23\xA3\xFE\xEB\xBD"
"\x45\x4D\x44\x23\x64\x3C\xE8\x0E\x2A\x9A\xC9\x4F\xA5\x4C\xA4\x9F" },
+ { GCRY_MD_SHA512,
+ "Libgcrypt is free software; you can redistribute it and/or modif"
+ "y it under the terms of the GNU Lesser general Public License as"
+ " published by the Free Software Foundation; either version 2.1 o"
+ "f the License, or (at your option) any later version.\nLibgcrypt"
+ " is distributed in the hope that it will be useful, but WITHOUT "
+ "ANY WARRANTY; without even the implied warranty of MERCHANTABILI"
+ "TY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser Gene"
+ "ral Public License for more details.",
+ "\x72\x8c\xde\xd8\xe4\xd7\xb6\xa5\x0f\xde\x6b\x4d\x33\xaf\x15\x19"
+ "\xdd\xec\x62\x0f\xf7\x1a\x1e\x10\x32\x05\x02\xa6\xb0\x1f\x70\x37"
+ "\xbc\xd7\x15\xed\x71\x6c\x78\x20\xc8\x54\x87\xd0\x66\x6a\x17\x83"
+ "\x05\x61\x92\xbe\xcc\x8f\x3b\xbf\x11\x72\x22\x69\x23\x5b\x48\x5c" },
{ GCRY_MD_RMD160, "",
"\x9c\x11\x85\xa5\xc5\xe9\xfc\x54\x61\x28"
"\x08\x97\x7e\xe8\xf5\x48\xb2\x25\x8d\x31" },