From b663a887f4513b013d92122a4ec48eabb57388aa Mon Sep 17 00:00:00 2001 From: kettenis Date: Wed, 24 Jan 2018 23:03:37 +0000 Subject: [PATCH] Make the NEON codepaths conditional on __STRICT_ALIGNMENT not being defined as they rely on unaligned access. ok joel@ --- lib/libcrypto/modes/asm/ghash-armv4.pl | 2 +- lib/libcrypto/modes/gcm128.c | 4 ++-- lib/libcrypto/sha/asm/sha512-armv4.pl | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/libcrypto/modes/asm/ghash-armv4.pl b/lib/libcrypto/modes/asm/ghash-armv4.pl index 4f8372d8974..2d57806b466 100644 --- a/lib/libcrypto/modes/asm/ghash-armv4.pl +++ b/lib/libcrypto/modes/asm/ghash-armv4.pl @@ -319,7 +319,7 @@ sub Dhi() { shift=~m|q([1]?[0-9])|?"d".($1*2+1):""; } sub Q() { shift=~m|d([1-3]?[02468])|?"q".($1/2):""; } $code.=<<___; -#if __ARM_ARCH__>=7 +#if __ARM_ARCH__>=7 && !defined(__STRICT_ALIGNMENT) .fpu neon .global gcm_gmult_neon diff --git a/lib/libcrypto/modes/gcm128.c b/lib/libcrypto/modes/gcm128.c index 42291519bcf..74362e6adc1 100644 --- a/lib/libcrypto/modes/gcm128.c +++ b/lib/libcrypto/modes/gcm128.c @@ -1,4 +1,4 @@ -/* $OpenBSD: gcm128.c,v 1.21 2017/12/09 07:16:51 deraadt Exp $ */ +/* $OpenBSD: gcm128.c,v 1.22 2018/01/24 23:03:37 kettenis Exp $ */ /* ==================================================================== * Copyright (c) 2010 The OpenSSL Project. All rights reserved. * @@ -661,7 +661,7 @@ void gcm_ghash_4bit_x86(u64 Xi[2],const u128 Htable[16],const u8 *inp,size_t len # endif # elif defined(__arm__) || defined(__arm) # include "arm_arch.h" -# if __ARM_ARCH__>=7 +# if __ARM_ARCH__>=7 && !defined(__STRICT_ALIGNMENT) # define GHASH_ASM_ARM # define GCM_FUNCREF_4BIT void gcm_gmult_neon(u64 Xi[2],const u128 Htable[16]); diff --git a/lib/libcrypto/sha/asm/sha512-armv4.pl b/lib/libcrypto/sha/asm/sha512-armv4.pl index 28ae155f4b4..a247a00c2b1 100644 --- a/lib/libcrypto/sha/asm/sha512-armv4.pl +++ b/lib/libcrypto/sha/asm/sha512-armv4.pl @@ -229,7 +229,7 @@ WORD64(0x5fcb6fab,0x3ad6faec, 0x6c44198c,0x4a475817) sha512_block_data_order: sub r3,pc,#8 @ sha512_block_data_order add $len,$inp,$len,lsl#7 @ len to point at the end of inp -#if __ARM_ARCH__>=7 +#if __ARM_ARCH__>=7 && !defined(__STRICT_ALIGNMENT) ldr r12,.LOPENSSL_armcap ldr r12,[r3,r12] @ OPENSSL_armcap_P tst r12,#1 @@ -533,7 +533,7 @@ ___ } $code.=<<___; -#if __ARM_ARCH__>=7 +#if __ARM_ARCH__>=7 && !defined(__STRICT_ALIGNMENT) .fpu neon .align 4 -- 2.20.1