From: Andy Polyakov Date: Mon, 11 May 2015 09:20:52 +0000 (+0200) Subject: crypto/modes/modes_lcl.h: let STRICT_ALIGNMENT be on iOS. X-Git-Tag: OpenSSL-fips-2_0_10~7 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=0b45df73d2b4cd52a390f2345ff52fb6705f2eba;p=oweals%2Fopenssl.git crypto/modes/modes_lcl.h: let STRICT_ALIGNMENT be on iOS. While ARMv7 in general is capable of unaligned access, not all instructions actually are. And trouble is that compiler doesn't seem to differentiate those capable and incapable of unaligned access. As result exceptions could be observed in xts128.c and ccm128.c modules. Contemporary Linux kernels handle such exceptions by performing requested operation and resuming execution as is if it succeeded. While on iOS exception is fatal. Correct solution is to let STRICT_ALIGNMENT be on all ARM platforms, but doing so is in formal conflict with FIPS maintenance policy. Reviewed-by: Dr. Stephen Henson --- diff --git a/crypto/modes/modes_lcl.h b/crypto/modes/modes_lcl.h index 4dab6a67fe..01ad9f34b9 100644 --- a/crypto/modes/modes_lcl.h +++ b/crypto/modes/modes_lcl.h @@ -26,13 +26,16 @@ typedef unsigned int u32; typedef unsigned char u8; #define STRICT_ALIGNMENT 1 -#if defined(__i386) || defined(__i386__) || \ - defined(__x86_64) || defined(__x86_64__) || \ - defined(_M_IX86) || defined(_M_AMD64) || defined(_M_X64) || \ - defined(__s390__) || defined(__s390x__) || \ - ( (defined(__arm__) || defined(__arm)) && \ - (defined(__ARM_ARCH_7__) || defined(__ARM_ARCH_7A__) || \ - defined(__ARM_ARCH_7R__) || defined(__ARM_ARCH_7M__)) ) +#if defined(__i386) || defined(__i386__) || \ + defined(__x86_64) || defined(__x86_64__) || \ + defined(_M_IX86) || defined(_M_AMD64) || defined(_M_X64) || \ + defined(__s390__) || defined(__s390x__) || \ + ( \ + ( (defined(__arm__) || defined(__arm)) && \ + (defined(__ARM_ARCH_7__) || defined(__ARM_ARCH_7A__) || \ + defined(__ARM_ARCH_7R__) || defined(__ARM_ARCH_7M__)) ) && \ + !( defined(__arm__) && defined(__APPLE__) ) \ + ) # undef STRICT_ALIGNMENT #endif