summaryrefslogtreecommitdiffstats
path: root/crypto
diff options
context:
space:
mode:
authorTom Cosgrove <tom.cosgrove@arm.com>2023-09-01 08:41:11 +0100
committerPauli <pauli@openssl.org>2023-09-04 08:44:21 +1000
commit12d08fe3a50f28fe80ff591e05d7f8253148afb4 (patch)
tree67a4ba063a353d5ea8bc4d903d36566c631bbaff /crypto
parent5318c012885a5382eadbf95aa9c1d35664bca819 (diff)
Move ALIGN32 and ALIGN64 into common.h, and fix for clang-cl.exe
clang-cl.exe defines __clang__ and _MSC_VER but not __GNUC__, so a clang- specific guard is needed to get the correct ALIGNxx versions. Fixes #21914 Change-Id: Icdc047b182ad1ba61c7b1b06a1e951eda1a0c33d Reviewed-by: Hugo Landau <hlandau@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Paul Dale <pauli@openssl.org> (Merged from https://github.com/openssl/openssl/pull/21921)
Diffstat (limited to 'crypto')
-rw-r--r--crypto/bn/rsaz_exp.c11
-rw-r--r--crypto/ec/ecp_nistz256.c8
-rw-r--r--crypto/ec/ecp_sm2p256.c12
3 files changed, 3 insertions, 28 deletions
diff --git a/crypto/bn/rsaz_exp.c b/crypto/bn/rsaz_exp.c
index e44eae43be..844140720c 100644
--- a/crypto/bn/rsaz_exp.c
+++ b/crypto/bn/rsaz_exp.c
@@ -13,6 +13,7 @@
*/
#include <openssl/opensslconf.h>
+#include "internal/common.h"
#include "rsaz_exp.h"
#ifndef RSAZ_ENABLED
@@ -31,16 +32,8 @@ void rsaz_1024_scatter5_avx2(void *tbl, const void *val, int i);
void rsaz_1024_gather5_avx2(void *val, const void *tbl, int i);
void rsaz_1024_red2norm_avx2(void *norm, const void *red);
-#if defined(__GNUC__)
-# define ALIGN64 __attribute__((aligned(64)))
-#elif defined(_MSC_VER)
-# define ALIGN64 __declspec(align(64))
-#elif defined(__SUNPRO_C)
-# define ALIGN64
+#if defined(__SUNPRO_C)
# pragma align 64(one,two80)
-#else
-/* not fatal, might hurt performance a little */
-# define ALIGN64
#endif
ALIGN64 static const BN_ULONG one[40] = {
diff --git a/crypto/ec/ecp_nistz256.c b/crypto/ec/ecp_nistz256.c
index 44d9054a17..8addb1e40c 100644
--- a/crypto/ec/ecp_nistz256.c
+++ b/crypto/ec/ecp_nistz256.c
@@ -37,14 +37,6 @@
# define TOBN(hi,lo) ((BN_ULONG)hi<<32|lo)
#endif
-#if defined(__GNUC__)
-# define ALIGN32 __attribute((aligned(32)))
-#elif defined(_MSC_VER)
-# define ALIGN32 __declspec(align(32))
-#else
-# define ALIGN32
-#endif
-
#define ALIGNPTR(p,N) ((unsigned char *)p+N-(size_t)p%N)
#define P256_LIMBS (256/BN_BITS2)
diff --git a/crypto/ec/ecp_sm2p256.c b/crypto/ec/ecp_sm2p256.c
index 49fab47187..6ec4245529 100644
--- a/crypto/ec/ecp_sm2p256.c
+++ b/crypto/ec/ecp_sm2p256.c
@@ -18,19 +18,9 @@
#include <openssl/err.h>
#include "crypto/bn.h"
#include "ec_local.h"
+#include "internal/common.h"
#include "internal/constant_time.h"
-#if defined(__GNUC__)
-# define ALIGN32 __attribute((aligned(32)))
-# define ALIGN64 __attribute((aligned(64)))
-#elif defined(_MSC_VER)
-# define ALIGN32 __declspec(align(32))
-# define ALIGN64 __declspec(align(64))
-#else
-# define ALIGN32
-# define ALIGN64
-#endif
-
#define P256_LIMBS (256 / BN_BITS2)
#if !defined(OPENSSL_NO_SM2_PRECOMP)