Coverage Report

Created: 2021-10-13 08:49

/src/botan/build/include/botan/internal/emsa_x931.h
Line
Count
Source (jump to first uncovered line)
1
/*
2
* X9.31 EMSA
3
* (C) 1999-2007 Jack Lloyd
4
*
5
* Botan is released under the Simplified BSD License (see license.txt)
6
*/
7
8
#ifndef BOTAN_EMSA_X931_H_
9
#define BOTAN_EMSA_X931_H_
10
11
#include <botan/internal/emsa.h>
12
#include <botan/hash.h>
13
14
namespace Botan {
15
16
/**
17
* EMSA from X9.31 (EMSA2 in IEEE 1363)
18
* Useful for Rabin-Williams, also sometimes used with RSA in
19
* odd protocols.
20
*/
21
class EMSA_X931 final : public EMSA
22
   {
23
   public:
24
      /**
25
      * @param hash the hash function to use
26
      */
27
      explicit EMSA_X931(std::unique_ptr<HashFunction> hash);
28
29
0
      std::unique_ptr<EMSA> new_object() override { return std::make_unique<EMSA_X931>(m_hash->new_object()); }
30
31
      std::string name() const override;
32
33
0
      bool requires_message_recovery() const override { return true; }
34
35
   private:
36
      void update(const uint8_t[], size_t) override;
37
      secure_vector<uint8_t> raw_data() override;
38
39
      secure_vector<uint8_t> encoding_of(const secure_vector<uint8_t>&, size_t,
40
                                     RandomNumberGenerator& rng) override;
41
42
      bool verify(const secure_vector<uint8_t>&, const secure_vector<uint8_t>&,
43
                  size_t) override;
44
45
      secure_vector<uint8_t> m_empty_hash;
46
      std::unique_ptr<HashFunction> m_hash;
47
      uint8_t m_hash_id;
48
   };
49
50
}
51
52
#endif