aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/passhash
diff options
context:
space:
mode:
authorJack Lloyd <[email protected]>2020-12-11 11:26:57 -0500
committerJack Lloyd <[email protected]>2020-12-11 12:03:37 -0500
commit884a22fa2ade86bb12e503d6ef37784de7fe6f36 (patch)
tree5ad38f4218e416352a6d5cd28c100b15cc3c929f /src/lib/passhash
parent9bcc30f212bc502e51bcc386e0bd9ed65adf36a7 (diff)
Incrase the alignment of all lookup tables
We had done this in an ad-hoc way in the past for eg the AES tables but given how easy C++'s alignas is to use we should apply it universally. Use 256 byte alignment for larger tables since that heads of any possible issues that arise from machines with large cache lines.
Diffstat (limited to 'src/lib/passhash')
-rw-r--r--src/lib/passhash/bcrypt/bcrypt.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/lib/passhash/bcrypt/bcrypt.cpp b/src/lib/passhash/bcrypt/bcrypt.cpp
index 0b53fe42c..d5bd40015 100644
--- a/src/lib/passhash/bcrypt/bcrypt.cpp
+++ b/src/lib/passhash/bcrypt/bcrypt.cpp
@@ -18,7 +18,7 @@ namespace {
std::string bcrypt_base64_encode(const uint8_t input[], size_t length)
{
// Bcrypt uses a non-standard base64 alphabet
- const uint8_t OPENBSD_BASE64_SUB[256] = {
+ alignas(256) const uint8_t OPENBSD_BASE64_SUB[256] = {
0x00, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
@@ -56,7 +56,7 @@ std::string bcrypt_base64_encode(const uint8_t input[], size_t length)
std::vector<uint8_t> bcrypt_base64_decode(std::string input)
{
- const uint8_t OPENBSD_BASE64_SUB[256] = {
+ alignas(256) const uint8_t OPENBSD_BASE64_SUB[256] = {
0x00, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,