Coverage Report

Created: 2020-03-26 13:53

/src/botan/build/include/botan/streebog.h
Line
Count
Source (jump to first uncovered line)
1
/*
2
* Streebog
3
* (C) 2017 Ribose Inc.
4
*
5
* Botan is released under the Simplified BSD License (see license.txt)
6
*/
7
8
#ifndef BOTAN_STREEBOG_H_
9
#define BOTAN_STREEBOG_H_
10
11
#include <botan/hash.h>
12
13
BOTAN_FUTURE_INTERNAL_HEADER(streebog.h)
14
15
namespace Botan {
16
17
/**
18
* Streebog (GOST R 34.11-2012)
19
* RFC 6986
20
*/
21
class BOTAN_PUBLIC_API(2,2) Streebog : public HashFunction
22
   {
23
   public:
24
0
      size_t output_length() const override { return m_output_bits / 8; }
25
26
0
      HashFunction* clone() const override { return new Streebog(m_output_bits); }
27
      void clear() override;
28
      std::string name() const override;
29
0
      size_t hash_block_size() const override { return 64; }
30
31
      std::unique_ptr<HashFunction> copy_state() const override;
32
33
      explicit Streebog(size_t output_bits);
34
   protected:
35
      void add_data(const uint8_t input[], size_t length) override;
36
      void final_result(uint8_t out[]) override;
37
38
      void compress(const uint8_t input[], bool lastblock = false);
39
40
      void compress_64(const uint64_t input[], bool lastblock = false);
41
42
   private:
43
      const size_t m_output_bits;
44
      uint64_t m_count;
45
      size_t m_position;
46
      secure_vector<uint8_t> m_buffer;
47
      secure_vector<uint64_t> m_h;
48
      secure_vector<uint64_t> m_S;
49
   };
50
51
52
/**
53
* Streebog-256
54
*/
55
class BOTAN_PUBLIC_API(2,2) Streebog_256 final : public Streebog
56
   {
57
   public:
58
0
      Streebog_256() : Streebog(256) {}
59
   };
60
61
/**
62
* Streebog-512
63
*/
64
class BOTAN_PUBLIC_API(2,2) Streebog_512 final : public Streebog
65
   {
66
   public:
67
0
      Streebog_512() : Streebog(512) {}
68
   };
69
70
}
71
72
#endif