aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/pubkey/xmss/xmss_tools.h
diff options
context:
space:
mode:
authorMatthias Gierlings <[email protected]>2016-10-08 20:45:53 +0200
committerMatthias Gierlings <[email protected]>2016-11-12 20:58:31 +0100
commitd16fd1d9b35698852e7b7aed023dc5057d630098 (patch)
treedd56019fd9b7ba1ef8b1f886552ff928b6bb8f13 /src/lib/pubkey/xmss/xmss_tools.h
parent37c1a62525c74461693789f983a41c80697ff4a3 (diff)
Added Extended Hash-Based Signatures (XMSS)
[1] XMSS: Extended Hash-Based Signatures, draft-itrf-cfrg-xmss-hash-based-signatures-06 Release: July 2016. https://datatracker.ietf.org/doc/ draft-irtf-cfrg-xmss-hash-based-signatures/?include_text=1 Provides XMSS_PublicKey and XMSS_PrivateKey classes as well as implementations for the Botan interfaces PK_Ops::Signature and PK_Ops::Verification. XMSS has been integrated into the Botan test bench, signature generation and verification can be tested independently by invoking "botan-test xmss_sign" and "botan-test xmss_verify" - Some headers that are not required to be exposed to users of the library have to be declared as public in `info.txt`. Declaring those headers private will cause the amalgamation build to fail. The following headers have been declared public inside `info.txt`, even though they are only intended for internal use: * atomic.h * xmss_hash.h * xmss_index_registry.h * xmss_address.h * xmss_common_ops.h * xmss_tools.h * xmss_wots_parameters.h * xmss_wots_privatekey.h * xmss_wots_publickey.h - XMSS_Verification_Operation Requires the "randomness" parameter out of the XMSS signature. "Randomness" is part of the prefix that is hashed *before* the message. Since the signature is unknown till sign() is called, all message content has to be buffered. For large messages this can be inconvenient or impossible. **Possible solution**: Change PK_Ops::Verification interface to take the signature as constructor argument, and provide a setter method to be able to update reuse the instance on multiple signatures. Make sign a parameterless member call. This solution requires interface changes in botan. **Suggested workaround** for signing large messages is to not sign the message itself, but to precompute the message hash manually using Botan::HashFunctio and sign the message hash instead of the message itself. - Some of the available test vectors for the XMSS signature verification have been commented out in order to reduce testbench runtime.
Diffstat (limited to 'src/lib/pubkey/xmss/xmss_tools.h')
-rw-r--r--src/lib/pubkey/xmss/xmss_tools.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/lib/pubkey/xmss/xmss_tools.h b/src/lib/pubkey/xmss/xmss_tools.h
index 773953fae..ab60665c7 100644
--- a/src/lib/pubkey/xmss/xmss_tools.h
+++ b/src/lib/pubkey/xmss/xmss_tools.h
@@ -11,7 +11,10 @@
#include <stdint.h>
#include <iterator>
#include <type_traits>
+<<<<<<< HEAD
#include <botan/cpuid.h>
+=======
+>>>>>>> 959425d... Added Extended Hash-Based Signatures (XMSS)
#include <botan/types.h>
#include <botan/secmem.h>
@@ -64,13 +67,17 @@ void XMSS_Tools::concat(secure_vector<byte>& target, const T& src)
{
const byte* src_bytes = reinterpret_cast<const byte*>(&src);
if(CPUID::is_little_endian())
+ {
std::reverse_copy(src_bytes,
src_bytes + sizeof(src),
std::back_inserter(target));
+ }
else
+ {
std::copy(src_bytes,
src_bytes + sizeof(src),
std::back_inserter(target));
+ }
}
@@ -87,13 +94,17 @@ void XMSS_Tools::concat(secure_vector<byte>& target,
const byte* src_bytes = reinterpret_cast<const byte*>(&src);
if(CPUID::is_little_endian())
+ {
std::reverse_copy(src_bytes,
src_bytes + c,
std::back_inserter(target));
+ }
else
+ {
std::copy(src_bytes + sizeof(src) - c,
src_bytes + sizeof(src),
std::back_inserter(target));
+ }
}
}