summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeffrey Walton <noloader@gmail.com>2018-01-21 14:19:00 -0500
committerJeffrey Walton <noloader@gmail.com>2018-01-21 14:19:00 -0500
commitc4e0942a68a3242ff9d9c4e9a0da26a06b57f201 (patch)
tree34c7417786620c619930e8b162bddc9af5f91702
parent5631da3697ea7a8c926df4d2a71dcc62d2effff7 (diff)
downloadcryptopp-git-c4e0942a68a3242ff9d9c4e9a0da26a06b57f201.tar.gz
Add CRYPTOPP_TABLE, remove CRYPTOPP_SECTION
-rw-r--r--ariatab.cpp12
-rw-r--r--config.h13
-rw-r--r--integer.cpp6
-rw-r--r--kalynatab.cpp10
-rw-r--r--sha.cpp13
-rw-r--r--whrlpool.cpp6
6 files changed, 28 insertions, 32 deletions
diff --git a/ariatab.cpp b/ariatab.cpp
index 567ba72b..6c8a1566 100644
--- a/ariatab.cpp
+++ b/ariatab.cpp
@@ -6,10 +6,8 @@
NAMESPACE_BEGIN(CryptoPP)
NAMESPACE_BEGIN(ARIATab)
-#define EXPORT_TABLE extern
-
CRYPTOPP_ALIGN_DATA(16)
-EXPORT_TABLE
+CRYPTOPP_TABLE
const word32 S1[256]={
0x00636363,0x007c7c7c,0x00777777,0x007b7b7b,0x00f2f2f2,0x006b6b6b,0x006f6f6f,0x00c5c5c5,
0x00303030,0x00010101,0x00676767,0x002b2b2b,0x00fefefe,0x00d7d7d7,0x00ababab,0x00767676,
@@ -46,7 +44,7 @@ const word32 S1[256]={
};
CRYPTOPP_ALIGN_DATA(16)
-EXPORT_TABLE
+CRYPTOPP_TABLE
const word32 S2[256]={
0xe200e2e2,0x4e004e4e,0x54005454,0xfc00fcfc,0x94009494,0xc200c2c2,0x4a004a4a,0xcc00cccc,
0x62006262,0x0d000d0d,0x6a006a6a,0x46004646,0x3c003c3c,0x4d004d4d,0x8b008b8b,0xd100d1d1,
@@ -83,7 +81,7 @@ const word32 S2[256]={
};
CRYPTOPP_ALIGN_DATA(16)
-EXPORT_TABLE
+CRYPTOPP_TABLE
const word32 X1[256]={
0x52520052,0x09090009,0x6a6a006a,0xd5d500d5,0x30300030,0x36360036,0xa5a500a5,0x38380038,
0xbfbf00bf,0x40400040,0xa3a300a3,0x9e9e009e,0x81810081,0xf3f300f3,0xd7d700d7,0xfbfb00fb,
@@ -120,7 +118,7 @@ const word32 X1[256]={
};
CRYPTOPP_ALIGN_DATA(16)
-EXPORT_TABLE
+CRYPTOPP_TABLE
const word32 X2[256]={
0x30303000,0x68686800,0x99999900,0x1b1b1b00,0x87878700,0xb9b9b900,0x21212100,0x78787800,
0x50505000,0x39393900,0xdbdbdb00,0xe1e1e100,0x72727200,0x09090900,0x62626200,0x3c3c3c00,
@@ -157,7 +155,7 @@ const word32 X2[256]={
};
CRYPTOPP_ALIGN_DATA(16)
-EXPORT_TABLE
+CRYPTOPP_TABLE
const word32 KRK[3][4] = {
{0x517cc1b7, 0x27220a94, 0xfe13abe8, 0xfa9a6ee0},
{0x6db14acc, 0x9e21c820, 0xff28b1d5, 0xef5de2b0},
diff --git a/config.h b/config.h
index 8de736df..d50f3ec5 100644
--- a/config.h
+++ b/config.h
@@ -340,15 +340,6 @@ NAMESPACE_END
#endif
#endif
-#ifndef CRYPTOPP_SECTION_ALIGN16
-#if defined(__GNUC__) && !defined(__APPLE__)
- // the alignment attribute doesn't seem to work without this section attribute when -fdata-sections is turned on
- #define CRYPTOPP_SECTION_ALIGN16 __attribute__((section ("CryptoPP_Align16")))
- #else
- #define CRYPTOPP_SECTION_ALIGN16
- #endif
-#endif
-
// The section attribute attempts to initialize CPU flags to avoid Valgrind findings above -O1
#if ((defined(__MACH__) && defined(__APPLE__)) && ((CRYPTOPP_LLVM_CLANG_VERSION >= 30600) || (CRYPTOPP_APPLE_CLANG_VERSION >= 70100) || (CRYPTOPP_GCC_VERSION >= 40300)))
#define CRYPTOPP_SECTION_INIT __attribute__((section ("__DATA,__data")))
@@ -891,10 +882,14 @@ NAMESPACE_END
#define CRYPTOPP_DLL
#endif
+// C++ makes const internal linkage
+#define CRYPTOPP_TABLE extern
#define CRYPTOPP_API __cdecl
#else // not CRYPTOPP_WIN32_AVAILABLE
+// C++ makes const internal linkage
+#define CRYPTOPP_TABLE extern
#define CRYPTOPP_DLL
#define CRYPTOPP_API
diff --git a/integer.cpp b/integer.cpp
index 16112575..833bb3cd 100644
--- a/integer.cpp
+++ b/integer.cpp
@@ -1437,7 +1437,11 @@ void Baseline_MultiplyTop16(word *R, const word *AA, const word *BB, word L)
#if CRYPTOPP_INTEGER_SSE2
-CRYPTOPP_ALIGN_DATA(16) static const word32 s_maskLow16[4] CRYPTOPP_SECTION_ALIGN16 = {0xffff,0xffff,0xffff,0xffff};
+CRYPTOPP_ALIGN_DATA(16)
+CRYPTOPP_TABLE
+const word32 s_maskLow16[4] = {
+ 0xffff,0xffff,0xffff,0xffff
+};
#undef Mul_Begin
#undef Mul_Acc
diff --git a/kalynatab.cpp b/kalynatab.cpp
index 3d747a71..646643a0 100644
--- a/kalynatab.cpp
+++ b/kalynatab.cpp
@@ -7,9 +7,7 @@
NAMESPACE_BEGIN(CryptoPP)
NAMESPACE_BEGIN(KalynaTab)
-#define EXPORT_TABLE extern
-
-EXPORT_TABLE
+CRYPTOPP_TABLE
const word64 T[8][256] =
{
{
@@ -542,7 +540,7 @@ const word64 T[8][256] =
}
};
-EXPORT_TABLE
+CRYPTOPP_TABLE
const word64 IT[8][256] =
{
{
@@ -1075,7 +1073,7 @@ const word64 IT[8][256] =
}
};
-EXPORT_TABLE
+CRYPTOPP_TABLE
const byte S[4][256] =
{
{
@@ -1152,7 +1150,7 @@ const byte S[4][256] =
}
};
-EXPORT_TABLE
+CRYPTOPP_TABLE
const byte IS[4][256] =
{
{
diff --git a/sha.cpp b/sha.cpp
index 06e1a640..f8c8979d 100644
--- a/sha.cpp
+++ b/sha.cpp
@@ -55,9 +55,6 @@
# undef CRYPTOPP_SSE2_ASM_AVAILABLE
#endif
-// C++ makes const internal linkage
-#define EXPORT_TABLE extern
-
NAMESPACE_BEGIN(CryptoPP)
#if CRYPTOPP_SHANI_AVAILABLE
@@ -229,8 +226,9 @@ size_t SHA1::HashMultipleBlocks(const word32 *input, size_t length)
// *************************************************************
-CRYPTOPP_ALIGN_DATA(16) EXPORT_TABLE
-const word32 SHA256_K[64] CRYPTOPP_SECTION_ALIGN16 = {
+CRYPTOPP_ALIGN_DATA(16)
+CRYPTOPP_TABLE
+const word32 SHA256_K[64] = {
0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5,
0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5,
@@ -665,7 +663,7 @@ ANONYMOUS_NAMESPACE_END
#ifndef CRYPTOPP_GENERATE_X64_MASM
#ifdef CRYPTOPP_X64_MASM_AVAILABLE
-EXPORT_TABLE "C" {
+extern "C" {
void CRYPTOPP_FASTCALL SHA256_HashMultipleBlocks_SSE2(word32 *state, const word32 *data, size_t len);
}
#endif
@@ -837,7 +835,8 @@ void SHA512::InitState(HashWordType *state)
// We add extern to export table to sha-simd.cpp, but it
// cleared http://github.com/weidai11/cryptopp/issues/502
CRYPTOPP_ALIGN_DATA(16)
-extern const word64 SHA512_K[80] CRYPTOPP_SECTION_ALIGN16 = {
+CRYPTOPP_TABLE
+const word64 SHA512_K[80] = {
W64LIT(0x428a2f98d728ae22), W64LIT(0x7137449123ef65cd),
W64LIT(0xb5c0fbcfec4d3b2f), W64LIT(0xe9b5dba58189dbbc),
W64LIT(0x3956c25bf348b538), W64LIT(0x59f111f1b605d019),
diff --git a/whrlpool.cpp b/whrlpool.cpp
index 9fb28bda..a510ba79 100644
--- a/whrlpool.cpp
+++ b/whrlpool.cpp
@@ -127,9 +127,11 @@ void Whirlpool::TruncatedFinal(byte *hash, size_t size)
*/
#if CRYPTOPP_SSE2_ASM_AVAILABLE
-CRYPTOPP_ALIGN_DATA(16) static const word64 Whirlpool_C[4*256+R] CRYPTOPP_SECTION_ALIGN16 = {
+CRYPTOPP_ALIGN_DATA(16)
+CRYPTOPP_TABLE
+const word64 Whirlpool_C[4*256+R] = {
#else
-static const word64 Whirlpool_C[4*256+R] = {
+const word64 Whirlpool_C[4*256+R] = {
#endif
W64LIT(0x18186018c07830d8), W64LIT(0x23238c2305af4626), W64LIT(0xc6c63fc67ef991b8), W64LIT(0xe8e887e8136fcdfb),
W64LIT(0x878726874ca113cb), W64LIT(0xb8b8dab8a9626d11), W64LIT(0x0101040108050209), W64LIT(0x4f4f214f426e9e0d),