/src/botan/build/include/internal/botan/internal/xmss_verification_operation.h
Line | Count | Source (jump to first uncovered line) |
1 | | /* |
2 | | * XMSS Verification Operation |
3 | | * (C) 2016 Matthias Gierlings |
4 | | * |
5 | | * Botan is released under the Simplified BSD License (see license.txt) |
6 | | **/ |
7 | | |
8 | | #ifndef BOTAN_XMSS_VERIFICATION_OPERATION_H_ |
9 | | #define BOTAN_XMSS_VERIFICATION_OPERATION_H_ |
10 | | |
11 | | #include <botan/pk_ops.h> |
12 | | #include <botan/xmss.h> |
13 | | #include <botan/internal/xmss_signature.h> |
14 | | |
15 | | namespace Botan { |
16 | | |
17 | | /** |
18 | | * Provides signature verification capabilities for Extended Hash-Based |
19 | | * Signatures (XMSS). |
20 | | **/ |
21 | | class XMSS_Verification_Operation final : public virtual PK_Ops::Verification { |
22 | | public: |
23 | | XMSS_Verification_Operation(const XMSS_PublicKey& public_key); |
24 | | |
25 | | bool is_valid_signature(std::span<const uint8_t> sign) override; |
26 | | |
27 | | void update(std::span<const uint8_t> input) override; |
28 | | |
29 | 0 | std::string hash_function() const override { return m_hash.hash_function(); } |
30 | | |
31 | | private: |
32 | | /** |
33 | | * Algorithm 13: "XMSS_rootFromSig" |
34 | | * Computes a root node using an XMSS signature, a message and a seed. |
35 | | * |
36 | | * @param msg A message. |
37 | | * @param sig The XMSS signature for msg. |
38 | | * @param ards A XMSS tree address. |
39 | | * @param seed A seed. |
40 | | * |
41 | | * @return An n-byte string holding the value of the root of a tree |
42 | | * defined by the input parameters. |
43 | | **/ |
44 | | secure_vector<uint8_t> root_from_signature(const XMSS_Signature& sig, |
45 | | const secure_vector<uint8_t>& msg, |
46 | | XMSS_Address& ards, |
47 | | const secure_vector<uint8_t>& seed); |
48 | | |
49 | | /** |
50 | | * Algorithm 14: "XMSS_verify" |
51 | | * Verifies a XMSS signature using the corresponding XMSS public key. |
52 | | * |
53 | | * @param sig A XMSS signature. |
54 | | * @param msg The message signed with sig. |
55 | | * @param pub_key the public key |
56 | | * |
57 | | * @return true if signature sig is valid for msg, false otherwise. |
58 | | **/ |
59 | | bool verify(const XMSS_Signature& sig, const secure_vector<uint8_t>& msg, const XMSS_PublicKey& pub_key); |
60 | | |
61 | | const XMSS_PublicKey m_pub_key; |
62 | | XMSS_Hash m_hash; |
63 | | secure_vector<uint8_t> m_msg_buf; |
64 | | }; |
65 | | |
66 | | } // namespace Botan |
67 | | |
68 | | #endif |