diff options
author | Matthias Gierlings <[email protected]> | 2016-11-24 14:57:18 +0100 |
---|---|---|
committer | Matthias Gierlings <[email protected]> | 2016-11-25 13:35:08 +0100 |
commit | 035081b44b68f9a91261e5086291c97842f88e51 (patch) | |
tree | 8d3cab3cb1913e0865241f03f830cbcd78b49c6c /src/lib/pubkey/xmss/xmss_parameters.cpp | |
parent | 54da2ad8474401d8d3bdd97d62cb96b3244cdaac (diff) |
Adds SHAKE support for XMSS
- Enables code for shake support
- Creating SHAKE hash function by name now allows to select output size
of 256 Bit for SHAKE128 and 512 Bit for SHAKE256.
- Adds *self-generated*, unverified test vectors for XMSS/SHAKE.
Diffstat (limited to 'src/lib/pubkey/xmss/xmss_parameters.cpp')
-rw-r--r-- | src/lib/pubkey/xmss/xmss_parameters.cpp | 141 |
1 files changed, 67 insertions, 74 deletions
diff --git a/src/lib/pubkey/xmss/xmss_parameters.cpp b/src/lib/pubkey/xmss/xmss_parameters.cpp index 5a106320b..a51496eff 100644 --- a/src/lib/pubkey/xmss/xmss_parameters.cpp +++ b/src/lib/pubkey/xmss/xmss_parameters.cpp @@ -24,13 +24,13 @@ const std::map<std::string, XMSS_Parameters::xmss_algorithm_t> { "XMSS_SHA2-256_W16_H20", XMSS_SHA2_256_W16_H20 }, { "XMSS_SHA2-512_W16_H10", XMSS_SHA2_512_W16_H10 }, { "XMSS_SHA2-512_W16_H16", XMSS_SHA2_512_W16_H16 }, - { "XMSS_SHA2-512_W16_H20", XMSS_SHA2_512_W16_H20 } -// { "XMSS_SHAKE128_W16_H10", xmss_algorithm_t::XMSS_SHAKE128_W16_H10 }, -// { "XMSS_SHAKE128_W16_H16", xmss_algorithm_t::XMSS_SHAKE128_W16_H16 }, -// { "XMSS_SHAKE128_W16_H20", xmss_algorithm_t::XMSS_SHAKE128_W16_H20 }, -// { "XMSS_SHAKE256_W16_H10", xmss_algorithm_t::XMSS_SHAKE256_W16_H10 }, -// { "XMSS_SHAKE256_W16_H16", xmss_algorithm_t::XMSS_SHAKE256_W16_H16 }, -// { "XMSS_SHAKE256_W16_H20", xmss_algorithm_t::XMSS_SHAKE256_W16_H20 } + { "XMSS_SHA2-512_W16_H20", XMSS_SHA2_512_W16_H20 }, + { "XMSS_SHAKE128_W16_H10", XMSS_SHAKE128_W16_H10 }, + { "XMSS_SHAKE128_W16_H16", XMSS_SHAKE128_W16_H16 }, + { "XMSS_SHAKE128_W16_H20", XMSS_SHAKE128_W16_H20 }, + { "XMSS_SHAKE256_W16_H10", XMSS_SHAKE256_W16_H10 }, + { "XMSS_SHAKE256_W16_H16", XMSS_SHAKE256_W16_H16 }, + { "XMSS_SHAKE256_W16_H20", XMSS_SHAKE256_W16_H20 } }; XMSS_Parameters::XMSS_Parameters(const std::string& algo_name) @@ -102,73 +102,66 @@ XMSS_Parameters::XMSS_Parameters(xmss_algorithm_t oid) m_strength = 512; m_wots_oid = XMSS_WOTS_Parameters::ots_algorithm_t::WOTSP_SHA2_512_W16; break; -// FIXME: Uncomment once SHAKE128/256 implementation is available in Botan. -// case XMSS_SHAKE128_W16_H10: -// m_element_size = 32; -// m_w = 16; -// m_len = 67; -// m_tree_height = 10; -// m_name = "XMSS_SHAKE128_W16_H10"; -// m_hash_name = ""; -// m_strength = 256; -// m_wots_oid = XMSS_WOTS_Parameters::ots_algorithm_t::WOTSP_SHAKE128_W16; -// BOTAN_ASSERT(false, "XMSS_SHAKE128_W16_H10 not implemented."); -// break; -// case XMSS_SHAKE128_W16_H16: -// m_element_size = 32; -// m_w = 16; -// m_len = 67; -// m_tree_height = 16; -// m_name = "XMSS_SHAKE128_W16_H16"; -// m_hash_name = ""; -// m_strength = 256; -// m_wots_oid = XMSS_WOTS_Parameters::ots_algorithm_t::WOTSP_SHAKE128_W16; -// BOTAN_ASSERT(false, "XMSS_SHAKE128_W16_H16 not implemented."); -// break; -// case XMSS_SHAKE128_W16_H20: -// m_element_size = 32; -// m_w = 16; -// m_len = 67; -// m_tree_height = 20; -// m_name = "XMSS_SHAKE128_W16_H20"; -// m_hash_name = ""; -// m_strength = 256; -// m_wots_oid = XMSS_WOTS_Parameters::ots_algorithm_t::WOTSP_SHAKE128_W16; -// BOTAN_ASSERT(false, "XMSS_SHAKE128_W16_H20 not implemented."); -// break; -// case XMSS_SHAKE256_W16_H10: -// m_element_size = 64; -// m_w = 16; -// m_len = 131; -// m_tree_height = 10; -// m_name = "XMSS_SHAKE256_W16_H10"; -// m_hash_name = ""; -// m_strength = 512; -// m_wots_oid = XMSS_WOTS_Parameters::ots_algorithm_t::WOTSP_SHAKE256_W16; -// BOTAN_ASSERT(false, "XMSS_SHAKE256_W16_H10 not implemented."); -// break; -// case XMSS_SHAKE256_W16_H16: -// m_element_size = 64; -// m_w = 16; -// m_len = 131; -// m_tree_height = 16; -// m_name = "XMSS_SHAKE256_W16_H16"; -// m_hash_name = ""; -// m_strength = 512; -// m_wots_oid = XMSS_WOTS_Parameters::ots_algorithm_t::WOTSP_SHAKE256_W16; -// BOTAN_ASSERT(false, "XMSS_SHAKE256_W16_H16 not implemented."); -// break; -// case XMSS_SHAKE256_W16_H20: -// m_element_size = 64; -// m_w = 16; -// m_len = 131; -// m_tree_height = 20; -// m_name = "XMSS_SHAKE256_W16_H20"; -// m_hash_name = ""; -// m_strength = 512; -// m_wots_oid = XMSS_WOTS_Parameters::ots_algorithm_t::WOTSP_SHAKE256_W16; -// BOTAN_ASSERT(false, "XMSS_SHAKE256_W16_H20 not implemented."); -// break; + case XMSS_SHAKE128_W16_H10: + m_element_size = 32; + m_w = 16; + m_len = 67; + m_tree_height = 10; + m_name = "XMSS_SHAKE128_W16_H10"; + m_hash_name = "SHAKE-128(256)"; + m_strength = 256; + m_wots_oid = XMSS_WOTS_Parameters::ots_algorithm_t::WOTSP_SHAKE128_W16; + break; + case XMSS_SHAKE128_W16_H16: + m_element_size = 32; + m_w = 16; + m_len = 67; + m_tree_height = 16; + m_name = "XMSS_SHAKE128_W16_H16"; + m_hash_name = "SHAKE-128(256)"; + m_strength = 256; + m_wots_oid = XMSS_WOTS_Parameters::ots_algorithm_t::WOTSP_SHAKE128_W16; + break; + case XMSS_SHAKE128_W16_H20: + m_element_size = 32; + m_w = 16; + m_len = 67; + m_tree_height = 20; + m_name = "XMSS_SHAKE128_W16_H20"; + m_hash_name = "SHAKE-128(256)"; + m_strength = 256; + m_wots_oid = XMSS_WOTS_Parameters::ots_algorithm_t::WOTSP_SHAKE128_W16; + break; + case XMSS_SHAKE256_W16_H10: + m_element_size = 64; + m_w = 16; + m_len = 131; + m_tree_height = 10; + m_name = "XMSS_SHAKE256_W16_H10"; + m_hash_name = "SHAKE-256(512)"; + m_strength = 512; + m_wots_oid = XMSS_WOTS_Parameters::ots_algorithm_t::WOTSP_SHAKE256_W16; + break; + case XMSS_SHAKE256_W16_H16: + m_element_size = 64; + m_w = 16; + m_len = 131; + m_tree_height = 16; + m_name = "XMSS_SHAKE256_W16_H16"; + m_hash_name = "SHAKE-256(512)"; + m_strength = 512; + m_wots_oid = XMSS_WOTS_Parameters::ots_algorithm_t::WOTSP_SHAKE256_W16; + break; + case XMSS_SHAKE256_W16_H20: + m_element_size = 64; + m_w = 16; + m_len = 131; + m_tree_height = 20; + m_name = "XMSS_SHAKE256_W16_H20"; + m_hash_name = "SHAKE-256(512)"; + m_strength = 512; + m_wots_oid = XMSS_WOTS_Parameters::ots_algorithm_t::WOTSP_SHAKE256_W16; + break; default: throw Unsupported_Argument( "Algorithm id does not match any XMSS algorithm id."); |