aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJack Lloyd <[email protected]>2018-05-27 13:17:00 -0400
committerJack Lloyd <[email protected]>2018-05-27 13:17:00 -0400
commit4f5e266ad895bbcf6adf970c06f3999324f1b2ec (patch)
treee91d3eb573b0755772616b0e9c51003f79138a8f
parentf256e603ab93e2587fe0e38bcf06c437fcd41abf (diff)
parent5c29254742fb62373c4d74a106d8c460cbbcb52c (diff)
Merge GH #1585 XMSS optimizations
-rw-r--r--src/lib/pubkey/xmss/xmss_wots_publickey.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/lib/pubkey/xmss/xmss_wots_publickey.cpp b/src/lib/pubkey/xmss/xmss_wots_publickey.cpp
index c944d6b10..68a8c5ad3 100644
--- a/src/lib/pubkey/xmss/xmss_wots_publickey.cpp
+++ b/src/lib/pubkey/xmss/xmss_wots_publickey.cpp
@@ -20,6 +20,8 @@ XMSS_WOTS_PublicKey::chain(secure_vector<uint8_t>& result,
const secure_vector<uint8_t>& seed,
XMSS_Hash& hash)
{
+ secure_vector<uint8_t> prf_output(hash.output_length());
+
for(size_t i = start_idx;
i < (start_idx + steps) && i < m_wots_params.wots_parameter();
i++)
@@ -28,13 +30,15 @@ XMSS_WOTS_PublicKey::chain(secure_vector<uint8_t>& result,
//Calculate tmp XOR bitmask
adrs.set_key_mask_mode(XMSS_Address::Key_Mask::Mask_Mode);
- xor_buf(result, hash.prf(seed, adrs.bytes()), result.size());
+ hash.prf(prf_output, seed, adrs.bytes());
+ xor_buf(result, prf_output, result.size());
// Calculate key
adrs.set_key_mask_mode(XMSS_Address::Key_Mask::Key_Mode);
//Calculate f(key, tmp XOR bitmask)
- hash.f(result, hash.prf(seed, adrs.bytes()), result);
+ hash.prf(prf_output, seed, adrs.bytes());
+ hash.f(result, prf_output, result);
}
}