Skip to content

Commit

Permalink
Remove gyrations around CRYPTOPP_NO_UNALIGNED_DATA_ACCESS
Browse files Browse the repository at this point in the history
CRYPTOPP_NO_UNALIGNED_DATA_ACCESS was required in Crypto++ 5.6 and earlier because unaligned data access was the norm. It caused problems at -O3 and on ARM NEON.
At Crypto++ 6.0 no unaligned data access became a first class citizen. Folks who want to allow it must now define CRYPTOPP_ALLOW_UNALIGNED_DATA_ACCESS
  • Loading branch information
noloader committed Jul 23, 2017
1 parent 00f9818 commit 5103f6d
Showing 1 changed file with 3 additions and 11 deletions.
14 changes: 3 additions & 11 deletions config.h
Expand Up @@ -54,11 +54,9 @@
# endif
#endif

// Define this to ensure C/C++ standard compliance and respect for GCC aliasing rules and other alignment fodder. If you
// experience a break with GCC at -O3, you should try this first. Guard it in case its set on the command line (and it differs).
#ifndef CRYPTOPP_NO_UNALIGNED_DATA_ACCESS
# define CRYPTOPP_NO_UNALIGNED_DATA_ACCESS
#endif
// Define this to allow unaligned data access. If you experience a break with
// GCC at -O3, you should immediately suspect unaligned data accesses.
// #define CRYPTOPP_ALLOW_UNALIGNED_DATA_ACCESS

// ***************** Less Important Settings ***************

Expand Down Expand Up @@ -580,12 +578,6 @@ NAMESPACE_END
#define CRYPTOPP_BOOL_ARM64 0
#endif

#if !defined(CRYPTOPP_NO_UNALIGNED_DATA_ACCESS) && !defined(CRYPTOPP_ALLOW_UNALIGNED_DATA_ACCESS)
#if (CRYPTOPP_BOOL_X64 || CRYPTOPP_BOOL_X86 || CRYPTOPP_BOOL_X32 || defined(__powerpc__) || (__ARM_FEATURE_UNALIGNED >= 1))
#define CRYPTOPP_ALLOW_UNALIGNED_DATA_ACCESS
#endif
#endif

// ***************** Initialization and Constructor priorities ********************

// CRYPTOPP_INIT_PRIORITY attempts to manage initialization of C++ static objects.
Expand Down

1 comment on commit 5103f6d

@noloader
Copy link
Collaborator Author

@noloader noloader commented on 5103f6d Jul 23, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We would have liked to address this back around FEB 2016 or JUN 2016 when we touched unaligned accesses. to support GCC, -O3 and ARM NEON. However, we needed to hold-off until until a release like 6.0.

Also see Search: Commits and CRYPTOPP_NO_UNALIGNED_DATA_ACCESS.

Please sign in to comment.