Coverage Report

Created: 2024-11-29 06:10

/src/botan/build/include/internal/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
#include <botan/internal/alignment_buffer.h>
14
15
namespace Botan {
16
17
/**
18
* Streebog (GOST R 34.11-2012)
19
* RFC 6986
20
*/
21
class Streebog final : public HashFunction {
22
   public:
23
585
      size_t output_length() const override { return m_output_bits / 8; }
24
25
0
      std::unique_ptr<HashFunction> new_object() const override { return std::make_unique<Streebog>(m_output_bits); }
26
27
      void clear() override;
28
      std::string name() const override;
29
30
0
      size_t hash_block_size() const override { return 64; }
31
32
      std::unique_ptr<HashFunction> copy_state() const override;
33
34
      explicit Streebog(size_t output_bits);
35
36
   protected:
37
      void add_data(std::span<const uint8_t> input) override;
38
      void final_result(std::span<uint8_t> out) override;
39
40
      void compress(const uint8_t input[], bool lastblock = false);
41
42
      void compress_64(const uint64_t input[], bool lastblock = false);
43
44
   private:
45
      const size_t m_output_bits;
46
      uint64_t m_count;
47
      AlignmentBuffer<uint8_t, 64> m_buffer;
48
      secure_vector<uint64_t> m_h;
49
      secure_vector<uint64_t> m_S;
50
};
51
52
}  // namespace Botan
53
54
#endif