Disable same buffer for in and out on ARM A-32 (GH #683)
parent
7eb0535a98
commit
e580ed588a
|
|
@ -32,6 +32,9 @@
|
||||||
@ Profiler-assisted and platform-specific optimization resulted in 16%
|
@ Profiler-assisted and platform-specific optimization resulted in 16%
|
||||||
@ improvement on Cortex A8 core and ~21.5 cycles per byte.
|
@ improvement on Cortex A8 core and ~21.5 cycles per byte.
|
||||||
|
|
||||||
|
@ JW, JUL 2018: Begin defines from taken from arm_arch.h
|
||||||
|
@ The defines were included through the header.
|
||||||
|
|
||||||
# if !defined(__ARM_ARCH__)
|
# if !defined(__ARM_ARCH__)
|
||||||
# if defined(__CC_ARM)
|
# if defined(__CC_ARM)
|
||||||
# define __ARM_ARCH__ __TARGET_ARCH_ARM
|
# define __ARM_ARCH__ __TARGET_ARCH_ARM
|
||||||
|
|
@ -86,6 +89,8 @@
|
||||||
# endif
|
# endif
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
|
@ JW, JUL 2018: End defines from taken from arm_arch.h
|
||||||
|
@ Back to original Cryptogams code
|
||||||
|
|
||||||
.text
|
.text
|
||||||
#if defined(__thumb2__) && !defined(__APPLE__)
|
#if defined(__thumb2__) && !defined(__APPLE__)
|
||||||
|
|
|
||||||
|
|
@ -253,6 +253,10 @@ ANONYMOUS_NAMESPACE_END
|
||||||
unsigned int Rijndael::Base::OptimalDataAlignment() const
|
unsigned int Rijndael::Base::OptimalDataAlignment() const
|
||||||
{
|
{
|
||||||
// CFB mode performs an extra memcpy if buffer is not aligned.
|
// CFB mode performs an extra memcpy if buffer is not aligned.
|
||||||
|
#if (CRYPTOPP_AESNI_AVAILABLE)
|
||||||
|
if (HasAESNI())
|
||||||
|
return 1;
|
||||||
|
#endif
|
||||||
#if (CRYPTOPP_ARM_AES_AVAILABLE)
|
#if (CRYPTOPP_ARM_AES_AVAILABLE)
|
||||||
if (HasAES())
|
if (HasAES())
|
||||||
return 1;
|
return 1;
|
||||||
|
|
|
||||||
|
|
@ -195,6 +195,8 @@ void CFB_CipherTemplate<BASE>::ProcessData(byte *outString, const byte *inString
|
||||||
if (!length) {return;}
|
if (!length) {return;}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: Figure out what is happening on ARM A-32. x86, Aarch64 and PowerPC are OK.
|
||||||
|
#if !defined(__arm__)
|
||||||
if (policy.CanIterate() && length >= bytesPerIteration && IsAlignedOn(outString, alignment))
|
if (policy.CanIterate() && length >= bytesPerIteration && IsAlignedOn(outString, alignment))
|
||||||
{
|
{
|
||||||
const CipherDir cipherDir = GetCipherDir(*this);
|
const CipherDir cipherDir = GetCipherDir(*this);
|
||||||
|
|
@ -202,7 +204,9 @@ void CFB_CipherTemplate<BASE>::ProcessData(byte *outString, const byte *inString
|
||||||
policy.Iterate(outString, inString, cipherDir, length / bytesPerIteration);
|
policy.Iterate(outString, inString, cipherDir, length / bytesPerIteration);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// GCC and Clang does not like this on ARM.
|
// GCC and Clang does not like this on ARM. If we create
|
||||||
|
// an aligned temp input buffer, memcpy inString to it,
|
||||||
|
// and then use the temp input then things are [mostly] OK.
|
||||||
memcpy(outString, inString, length);
|
memcpy(outString, inString, length);
|
||||||
policy.Iterate(outString, outString, cipherDir, length / bytesPerIteration);
|
policy.Iterate(outString, outString, cipherDir, length / bytesPerIteration);
|
||||||
}
|
}
|
||||||
|
|
@ -210,6 +214,7 @@ void CFB_CipherTemplate<BASE>::ProcessData(byte *outString, const byte *inString
|
||||||
outString = PtrAdd(outString, length - length % bytesPerIteration);
|
outString = PtrAdd(outString, length - length % bytesPerIteration);
|
||||||
length %= bytesPerIteration;
|
length %= bytesPerIteration;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
while (length >= bytesPerIteration)
|
while (length >= bytesPerIteration)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue