aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xconfigure.py19
-rw-r--r--src/build-data/arch/m68k.txt3
-rw-r--r--src/build-data/arch/ppc32.txt1
-rw-r--r--src/build-data/arch/s390.txt1
-rw-r--r--src/build-data/arch/s390x.txt1
-rw-r--r--src/build-data/arch/x86_32.txt1
-rw-r--r--src/build-data/arch/x86_64.txt1
-rw-r--r--src/lib/utils/loadstor.h51
8 files changed, 22 insertions, 56 deletions
diff --git a/configure.py b/configure.py
index 22d246f06..53001b856 100755
--- a/configure.py
+++ b/configure.py
@@ -341,15 +341,6 @@ def process_command_line(args): # pylint: disable=too-many-locals
target_group.add_option('--with-endian', metavar='ORDER', default=None,
help='override byte order guess')
- target_group.add_option('--with-unaligned-mem',
- dest='unaligned_mem', action='store_true',
- default=None,
- help='use unaligned memory accesses')
-
- target_group.add_option('--without-unaligned-mem',
- dest='unaligned_mem', action='store_false',
- help=optparse.SUPPRESS_HELP)
-
target_group.add_option('--with-os-features', action='append', metavar='FEAT',
help='specify OS features to use')
target_group.add_option('--without-os-features', action='append', metavar='FEAT',
@@ -1006,7 +997,6 @@ class ArchInfo(InfoObject):
{
'endian': None,
'family': None,
- 'unaligned': 'no',
'wordsize': 32
})
@@ -1014,7 +1004,6 @@ class ArchInfo(InfoObject):
self.endian = lex.endian
self.family = lex.family
self.isa_extensions = lex.isa_extensions
- self.unaligned_ok = (1 if lex.unaligned == 'ok' else 0)
self.submodels = lex.submodels
self.submodel_aliases = force_to_dict(lex.submodel_aliases)
self.wordsize = int(lex.wordsize)
@@ -1061,12 +1050,6 @@ class ArchInfo(InfoObject):
macros.append('TARGET_CPU_IS_%s_ENDIAN' % (endian.upper()))
logging.info('Assuming CPU is %s endian' % (endian))
- unaligned_ok = options.unaligned_mem
- if unaligned_ok is None:
- unaligned_ok = self.unaligned_ok
- if unaligned_ok:
- logging.info('Assuming unaligned memory access works')
-
if self.family is not None:
macros.append('TARGET_CPU_IS_%s_FAMILY' % (self.family.upper()))
@@ -1075,8 +1058,6 @@ class ArchInfo(InfoObject):
if self.wordsize == 64:
macros.append('TARGET_CPU_HAS_NATIVE_64BIT')
- macros.append('TARGET_UNALIGNED_MEMORY_ACCESS_OK %d' % (unaligned_ok))
-
if options.with_valgrind:
macros.append('HAS_VALGRIND')
diff --git a/src/build-data/arch/m68k.txt b/src/build-data/arch/m68k.txt
index 691c45b92..26dac5331 100644
--- a/src/build-data/arch/m68k.txt
+++ b/src/build-data/arch/m68k.txt
@@ -1,8 +1,5 @@
endian big
-# Except for Coldfire
-#unaligned ok
-
<aliases>
680x0
68k
diff --git a/src/build-data/arch/ppc32.txt b/src/build-data/arch/ppc32.txt
index 2f4ca6723..7d0ce5e24 100644
--- a/src/build-data/arch/ppc32.txt
+++ b/src/build-data/arch/ppc32.txt
@@ -1,5 +1,4 @@
endian big
-unaligned ok
family ppc
diff --git a/src/build-data/arch/s390.txt b/src/build-data/arch/s390.txt
index 6e9f99f12..a5c35637f 100644
--- a/src/build-data/arch/s390.txt
+++ b/src/build-data/arch/s390.txt
@@ -1,5 +1,4 @@
endian big
-unaligned ok
<submodels>
s390
diff --git a/src/build-data/arch/s390x.txt b/src/build-data/arch/s390x.txt
index 0fec592b4..6ed2ec079 100644
--- a/src/build-data/arch/s390x.txt
+++ b/src/build-data/arch/s390x.txt
@@ -1,5 +1,4 @@
endian big
-unaligned ok
wordsize 64
<submodels>
diff --git a/src/build-data/arch/x86_32.txt b/src/build-data/arch/x86_32.txt
index beaf60a41..20401e034 100644
--- a/src/build-data/arch/x86_32.txt
+++ b/src/build-data/arch/x86_32.txt
@@ -1,5 +1,4 @@
endian little
-unaligned ok
family x86
diff --git a/src/build-data/arch/x86_64.txt b/src/build-data/arch/x86_64.txt
index b162d0ab4..49f8a6a55 100644
--- a/src/build-data/arch/x86_64.txt
+++ b/src/build-data/arch/x86_64.txt
@@ -1,5 +1,4 @@
endian little
-unaligned ok
wordsize 64
family x86
diff --git a/src/lib/utils/loadstor.h b/src/lib/utils/loadstor.h
index ca75969fa..70ad20591 100644
--- a/src/lib/utils/loadstor.h
+++ b/src/lib/utils/loadstor.h
@@ -1,6 +1,6 @@
/*
* Load/Store Operators
-* (C) 1999-2007,2015 Jack Lloyd
+* (C) 1999-2007,2015,2017 Jack Lloyd
* 2007 Yves Jerschow
*
* Botan is released under the Simplified BSD License (see license.txt)
@@ -14,25 +14,17 @@
#include <botan/mem_ops.h>
#include <vector>
-#if BOTAN_TARGET_UNALIGNED_MEMORY_ACCESS_OK
-
#if defined(BOTAN_TARGET_CPU_IS_BIG_ENDIAN)
-
-#define BOTAN_ENDIAN_N2B(x) (x)
-#define BOTAN_ENDIAN_B2N(x) (x)
-
-#define BOTAN_ENDIAN_N2L(x) reverse_bytes(x)
-#define BOTAN_ENDIAN_L2N(x) reverse_bytes(x)
+ #define BOTAN_ENDIAN_N2L(x) reverse_bytes(x)
+ #define BOTAN_ENDIAN_L2N(x) reverse_bytes(x)
+ #define BOTAN_ENDIAN_N2B(x) (x)
+ #define BOTAN_ENDIAN_B2N(x) (x)
#elif defined(BOTAN_TARGET_CPU_IS_LITTLE_ENDIAN)
-
-#define BOTAN_ENDIAN_N2L(x) (x)
-#define BOTAN_ENDIAN_L2N(x) (x)
-
-#define BOTAN_ENDIAN_N2B(x) reverse_bytes(x)
-#define BOTAN_ENDIAN_B2N(x) reverse_bytes(x)
-
-#endif
+ #define BOTAN_ENDIAN_N2L(x) (x)
+ #define BOTAN_ENDIAN_L2N(x) (x)
+ #define BOTAN_ENDIAN_N2B(x) reverse_bytes(x)
+ #define BOTAN_ENDIAN_B2N(x) reverse_bytes(x)
#endif
@@ -146,7 +138,7 @@ inline uint16_t load_be<uint16_t>(const uint8_t in[], size_t off)
{
in += off * sizeof(uint16_t);
-#if BOTAN_TARGET_UNALIGNED_MEMORY_ACCESS_OK
+#if defined(BOTAN_ENDIAN_N2B)
uint16_t x;
std::memcpy(&x, in, sizeof(x));
return BOTAN_ENDIAN_N2B(x);
@@ -166,7 +158,7 @@ inline uint16_t load_le<uint16_t>(const uint8_t in[], size_t off)
{
in += off * sizeof(uint16_t);
-#if BOTAN_TARGET_UNALIGNED_MEMORY_ACCESS_OK
+#if defined(BOTAN_ENDIAN_N2L)
uint16_t x;
std::memcpy(&x, in, sizeof(x));
return BOTAN_ENDIAN_N2L(x);
@@ -185,7 +177,7 @@ template<>
inline uint32_t load_be<uint32_t>(const uint8_t in[], size_t off)
{
in += off * sizeof(uint32_t);
-#if BOTAN_TARGET_UNALIGNED_MEMORY_ACCESS_OK
+#if defined(BOTAN_ENDIAN_N2B)
uint32_t x;
std::memcpy(&x, in, sizeof(x));
return BOTAN_ENDIAN_N2B(x);
@@ -204,7 +196,7 @@ template<>
inline uint32_t load_le<uint32_t>(const uint8_t in[], size_t off)
{
in += off * sizeof(uint32_t);
-#if BOTAN_TARGET_UNALIGNED_MEMORY_ACCESS_OK
+#if defined(BOTAN_ENDIAN_N2L)
uint32_t x;
std::memcpy(&x, in, sizeof(x));
return BOTAN_ENDIAN_N2L(x);
@@ -223,7 +215,7 @@ template<>
inline uint64_t load_be<uint64_t>(const uint8_t in[], size_t off)
{
in += off * sizeof(uint64_t);
-#if BOTAN_TARGET_UNALIGNED_MEMORY_ACCESS_OK
+#if defined(BOTAN_ENDIAN_N2B)
uint64_t x;
std::memcpy(&x, in, sizeof(x));
return BOTAN_ENDIAN_N2B(x);
@@ -243,7 +235,7 @@ template<>
inline uint64_t load_le<uint64_t>(const uint8_t in[], size_t off)
{
in += off * sizeof(uint64_t);
-#if BOTAN_TARGET_UNALIGNED_MEMORY_ACCESS_OK
+#if defined(BOTAN_ENDIAN_N2L)
uint64_t x;
std::memcpy(&x, in, sizeof(x));
return BOTAN_ENDIAN_N2L(x);
@@ -416,6 +408,7 @@ inline void load_be(T out[],
{
#if defined(BOTAN_TARGET_CPU_IS_BIG_ENDIAN)
std::memcpy(out, in, sizeof(T)*count);
+
#elif defined(BOTAN_TARGET_CPU_IS_LITTLE_ENDIAN)
std::memcpy(out, in, sizeof(T)*count);
const size_t blocks = count - (count % 4);
@@ -440,7 +433,7 @@ inline void load_be(T out[],
*/
inline void store_be(uint16_t in, uint8_t out[2])
{
-#if BOTAN_TARGET_UNALIGNED_MEMORY_ACCESS_OK
+#if defined(BOTAN_ENDIAN_N2B)
uint16_t o = BOTAN_ENDIAN_N2B(in);
std::memcpy(out, &o, sizeof(o));
#else
@@ -456,7 +449,7 @@ inline void store_be(uint16_t in, uint8_t out[2])
*/
inline void store_le(uint16_t in, uint8_t out[2])
{
-#if BOTAN_TARGET_UNALIGNED_MEMORY_ACCESS_OK
+#if defined(BOTAN_ENDIAN_N2L)
uint16_t o = BOTAN_ENDIAN_N2L(in);
std::memcpy(out, &o, sizeof(o));
#else
@@ -472,7 +465,7 @@ inline void store_le(uint16_t in, uint8_t out[2])
*/
inline void store_be(uint32_t in, uint8_t out[4])
{
-#if BOTAN_TARGET_UNALIGNED_MEMORY_ACCESS_OK
+#if defined(BOTAN_ENDIAN_B2N)
uint32_t o = BOTAN_ENDIAN_B2N(in);
std::memcpy(out, &o, sizeof(o));
#else
@@ -490,7 +483,7 @@ inline void store_be(uint32_t in, uint8_t out[4])
*/
inline void store_le(uint32_t in, uint8_t out[4])
{
-#if BOTAN_TARGET_UNALIGNED_MEMORY_ACCESS_OK
+#if defined(BOTAN_ENDIAN_L2N)
uint32_t o = BOTAN_ENDIAN_L2N(in);
std::memcpy(out, &o, sizeof(o));
#else
@@ -508,7 +501,7 @@ inline void store_le(uint32_t in, uint8_t out[4])
*/
inline void store_be(uint64_t in, uint8_t out[8])
{
-#if BOTAN_TARGET_UNALIGNED_MEMORY_ACCESS_OK
+#if defined(BOTAN_ENDIAN_B2N)
uint64_t o = BOTAN_ENDIAN_B2N(in);
std::memcpy(out, &o, sizeof(o));
#else
@@ -530,7 +523,7 @@ inline void store_be(uint64_t in, uint8_t out[8])
*/
inline void store_le(uint64_t in, uint8_t out[8])
{
-#if BOTAN_TARGET_UNALIGNED_MEMORY_ACCESS_OK
+#if defined(BOTAN_ENDIAN_L2N)
uint64_t o = BOTAN_ENDIAN_L2N(in);
std::memcpy(out, &o, sizeof(o));
#else