/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 final : public HashFunction { |
20 | | public: |
21 | 0 | size_t output_length() const override { return m_output_bits / 8; } |
22 | | |
23 | 0 | std::unique_ptr<HashFunction> new_object() const override { return std::make_unique<Streebog>(m_output_bits); } |
24 | | |
25 | | void clear() override; |
26 | | std::string name() const override; |
27 | | |
28 | 0 | size_t hash_block_size() const override { return 64; } |
29 | | |
30 | | std::unique_ptr<HashFunction> copy_state() const override; |
31 | | |
32 | | explicit Streebog(size_t output_bits); |
33 | | |
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 | | } // namespace Botan |
52 | | |
53 | | #endif |