Hi Everyone,
We are catching a crash under 32-bit Solaris since splitting sources into
base+simd. After investigation it appears our aligned allocator is _not_
providing aligned allocations. This makes sense since we are favoring
base+simd. Here's the culprit from secblock.h
(https://github.com/weidai11/cryptopp/blob/master/secblock.h#L172):
template <class T, bool T_Align16 = false>
class AllocatorWithCleanup : public AllocatorBase<T>
{
...
#if CRYPTOPP_BOOL_ALIGN16
if (T_Align16 && size*sizeof(T) >= 16)
return (pointer)AlignedAllocate(size*sizeof(T));
#endif
}
CRYPTOPP_BOOL_ALIGN16 is 0 because we are base, not simd. And a class file
like aria.h does not get -mssse3, so it will never witness
CRYPTOPP_BOOL_ALIGN16 set to 1. However, aria-simd.cpp assumes 16-byte
aligned.
We did not experience the crash under GCC because its heap allocations are
16-byte aligned by default. Ditto for Apple and BSDs. We side stepped it by
dumb luck. However, Sun's default alignment is 8.
To combat this split view of aligned allocations I want to enable
CRYPTOPP_BOOL_ALIGN16 for all i386 and x86_64 builds since its nearly
certain some SSE will be used.
There is a downside. If you have a 1995 era 486 or early Pentium then you
may see wasted space. But you are already suffering so a little more should
not hurt too much. Think of it as taking one for the team. (You can also
manually disable it).
Are there any objections to enabling CRYPTOPP_BOOL_ALIGN16 for all i386 and
amd64 builds?
Jeff
--
--
You received this message because you are subscribed to the "Crypto++ Users"
Google Group.
To unsubscribe, send an email to [email protected].
More information about Crypto++ and this group is available at
http://www.cryptopp.com.
---
You received this message because you are subscribed to the Google Groups
"Crypto++ Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.