summaryrefslogtreecommitdiff
path: root/aria.h
diff options
context:
space:
mode:
authorJeffrey Walton <noloader@gmail.com>2017-04-13 04:28:02 -0400
committerJeffrey Walton <noloader@gmail.com>2017-04-13 04:28:02 -0400
commit35f95fb739877791355622d5e730ad5f30145807 (patch)
tree50874fcbfe70fa91a7d7e238a26baec6909c87b3 /aria.h
parent59767be52e2537bf8460f211f57b4739c9b02dcb (diff)
downloadcryptopp-git-35f95fb739877791355622d5e730ad5f30145807.tar.gz
Fix unaligned pointer crash on Win32 due to _mm_load_si128
The SSSE3 intrinsics were performing aligned loads using _mm_load_si128 using user supplied pointers. The pointers are only a byte pointer, so its alignment can drop to 1 or 2. Switching to _mm_loadu_si128 will sidestep potential problems. The crash surfaced under Win32 testing. Switch to memcpy's when performing bulk assignment x[0]=y[0] ... x[3]=y[3]. I believe Yun used the pattern to promote vectorization. Some compilers appear to be braindead and issue integer move's one word at a time. Non-braindead compiler will still take the optimization when advantageous, and slower compilers will benefit from the bulk move. We also cherry picked vectorization opportunities, like in ARIA_GSRK_NEON. Remove keyBits variable. We now use UncheckedSetKey's keylen throughout. Also fix a typo in CRYPTOPP_BOOL_SSSE3_INTRINSICS_AVAILABLE. __SSSE3__ was listed twice.
Diffstat (limited to 'aria.h')
-rw-r--r--aria.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/aria.h b/aria.h
index 434998ae..1102509e 100644
--- a/aria.h
+++ b/aria.h
@@ -48,9 +48,9 @@ public:
void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const;
private:
- // Reference implementation allocates a table for 17 sub-keys
+ // Reference implementation allocates a table of 17 sub-keys.
FixedSizeAlignedSecBlock<byte, 16*17> m_rk; // round keys
- FixedSizeAlignedSecBlock<word32, 4*6> m_w; // w0, w1, w2, w3 and t
+ FixedSizeAlignedSecBlock<word32, 4*7> m_w; // w0, w1, w2, w3, t and u
unsigned int m_rounds;
};