diff options
author | Jack Lloyd <[email protected]> | 2020-12-12 04:59:56 -0500 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2020-12-12 05:02:33 -0500 |
commit | 7b3708b8225bf2baee1c774d8f4b9b4d129cedbf (patch) | |
tree | 7a11998df3effc847141c45eaf7fbc5b8a3b285a /src/lib/codec | |
parent | ccacc46a0d09aa288da19797781472c0ae4c4461 (diff) |
Backport of #2541 increase alignment of lookup tables
Many differences here as some algos are in 2.x but not in 3, and the
small tables changes for ARIA/Camellia/DES/SEED were not backported.
Diffstat (limited to 'src/lib/codec')
-rw-r--r-- | src/lib/codec/base32/base32.cpp | 4 | ||||
-rw-r--r-- | src/lib/codec/base64/base64.cpp | 4 | ||||
-rw-r--r-- | src/lib/codec/hex/hex.cpp | 6 |
3 files changed, 7 insertions, 7 deletions
diff --git a/src/lib/codec/base32/base32.cpp b/src/lib/codec/base32/base32.cpp index fc9883c86..d9f9c1746 100644 --- a/src/lib/codec/base32/base32.cpp +++ b/src/lib/codec/base32/base32.cpp @@ -125,7 +125,7 @@ class Base32 final static const uint8_t m_base32_to_bin[256]; }; -const uint8_t Base32::m_bin_to_base32[32] = +alignas(64) const uint8_t Base32::m_bin_to_base32[32] = { 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', @@ -136,7 +136,7 @@ const uint8_t Base32::m_bin_to_base32[32] = * base32 Decoder Lookup Table * Warning: assumes ASCII encodings */ -const uint8_t Base32::m_base32_to_bin[256] = +alignas(64) const uint8_t Base32::m_base32_to_bin[256] = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x80, 0x80, 0xFF, 0xFF, 0x80, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, diff --git a/src/lib/codec/base64/base64.cpp b/src/lib/codec/base64/base64.cpp index b4f78bca0..e517964af 100644 --- a/src/lib/codec/base64/base64.cpp +++ b/src/lib/codec/base64/base64.cpp @@ -119,7 +119,7 @@ class Base64 final static const uint8_t m_base64_to_bin[256]; }; -const uint8_t Base64::m_bin_to_base64[64] = +alignas(64) const uint8_t Base64::m_bin_to_base64[64] = { 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', @@ -132,7 +132,7 @@ const uint8_t Base64::m_bin_to_base64[64] = * base64 Decoder Lookup Table * Warning: assumes ASCII encodings */ -const uint8_t Base64::m_base64_to_bin[256] = +alignas(64) const uint8_t Base64::m_base64_to_bin[256] = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x80, 0x80, 0xFF, 0xFF, 0x80, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, diff --git a/src/lib/codec/hex/hex.cpp b/src/lib/codec/hex/hex.cpp index 6bbd7c28e..2988677fd 100644 --- a/src/lib/codec/hex/hex.cpp +++ b/src/lib/codec/hex/hex.cpp @@ -16,11 +16,11 @@ void hex_encode(char output[], size_t input_length, bool uppercase) { - static const uint8_t BIN_TO_HEX_UPPER[16] = { + alignas(64) static const uint8_t BIN_TO_HEX_UPPER[16] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' }; - static const uint8_t BIN_TO_HEX_LOWER[16] = { + alignas(64) static const uint8_t BIN_TO_HEX_LOWER[16] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' }; @@ -61,7 +61,7 @@ size_t hex_decode(uint8_t output[], * Warning: this table assumes ASCII character encodings */ - static const uint8_t HEX_TO_BIN[256] = { + alignas(64) static const uint8_t HEX_TO_BIN[256] = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x80, 0x80, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, |