Coverage Report

Created: 2021-02-21 07:20

/src/botan/build/include/botan/internal/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
namespace Botan {
14
15
/**
16
* Streebog (GOST R 34.11-2012)
17
* RFC 6986
18
*/
19
class Streebog : public HashFunction
20
   {
21
   public:
22
0
      size_t output_length() const override { return m_output_bits / 8; }
23
24
0
      HashFunction* clone() const override { return new Streebog(m_output_bits); }
25
      void clear() override;
26
      std::string name() const override;
27
0
      size_t hash_block_size() const override { return 64; }
28
29
      std::unique_ptr<HashFunction> copy_state() const override;
30
31
      explicit Streebog(size_t output_bits);
32
   protected:
33
      void add_data(const uint8_t input[], size_t length) override;
34
      void final_result(uint8_t out[]) override;
35
36
      void compress(const uint8_t input[], bool lastblock = false);
37
38
      void compress_64(const uint64_t input[], bool lastblock = false);
39
40
   private:
41
      const size_t m_output_bits;
42
      uint64_t m_count;
43
      size_t m_position;
44
      secure_vector<uint8_t> m_buffer;
45
      secure_vector<uint64_t> m_h;
46
      secure_vector<uint64_t> m_S;
47
   };
48
49
50
/**
51
* Streebog-256
52
*/
53
class Streebog_256 final : public Streebog
54
   {
55
   public:
56
0
      Streebog_256() : Streebog(256) {}
57
   };
58
59
/**
60
* Streebog-512
61
*/
62
class Streebog_512 final : public Streebog
63
   {
64
   public:
65
0
      Streebog_512() : Streebog(512) {}
66
   };
67
68
}
69
70
#endif