aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/modes/aead
diff options
context:
space:
mode:
authorJack Lloyd <[email protected]>2018-12-23 14:21:48 -0500
committerJack Lloyd <[email protected]>2018-12-23 14:21:48 -0500
commitf10db2ae3d361132202e8e31376374d0d280482a (patch)
tree9997453e4d28a1a9e4495c44a97f3ac934dc470d /src/lib/modes/aead
parent935506524f7bcf52d10662a08a4e3e1376cd180a (diff)
Make significant_words const time also
Only used in one place, where const time doesn't matter, but can't hurt. Remove low_bit, can be replaced by ctz.
Diffstat (limited to 'src/lib/modes/aead')
-rw-r--r--src/lib/modes/aead/ocb/ocb.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/lib/modes/aead/ocb/ocb.cpp b/src/lib/modes/aead/ocb/ocb.cpp
index 866527800..b25abbe6a 100644
--- a/src/lib/modes/aead/ocb/ocb.cpp
+++ b/src/lib/modes/aead/ocb/ocb.cpp
@@ -69,7 +69,7 @@ class L_computer final
// ntz(4*i+2) == 1
// ntz(4*i+3) == 0
block_index += 4;
- const size_t ntz4 = ctz<uint32_t>(static_cast<uint32_t>(block_index));
+ const size_t ntz4 = var_ctz32(static_cast<uint32_t>(block_index));
xor_buf(offsets, m_offset.data(), L0.data(), m_BS);
offsets += m_BS;
@@ -91,7 +91,7 @@ class L_computer final
for(size_t i = 0; i != blocks; ++i)
{ // could be done in parallel
- const size_t ntz = ctz<uint32_t>(static_cast<uint32_t>(block_index + i + 1));
+ const size_t ntz = var_ctz32(static_cast<uint32_t>(block_index + i + 1));
xor_buf(m_offset.data(), get(ntz).data(), m_BS);
copy_mem(offsets, m_offset.data(), m_BS);
offsets += m_BS;
@@ -136,7 +136,7 @@ secure_vector<uint8_t> ocb_hash(const L_computer& L,
for(size_t i = 0; i != ad_blocks; ++i)
{
// this loop could run in parallel
- offset ^= L.get(ctz<uint32_t>(static_cast<uint32_t>(i+1)));
+ offset ^= L.get(var_ctz32(static_cast<uint32_t>(i+1)));
buf = offset;
xor_buf(buf.data(), &ad[BS*i], BS);
cipher.encrypt(buf);