Botan 3.13.0
Crypto and TLS for C&
streebog.h
Go to the documentation of this file.
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
15namespace Botan {
16
17/**
18* Streebog (GOST R 34.11-2012)
19* RFC 6986
20*/
21class Streebog final : public HashFunction {
22 public:
23 size_t output_length() const override { return m_output_bits / 8; }
24
25 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 std::string provider() const override;
30
31 size_t hash_block_size() const override { return 64; }
32
33 std::unique_ptr<HashFunction> copy_state() const override;
34
35 explicit Streebog(size_t output_bits);
36
37 protected:
38 void add_data(std::span<const uint8_t> input) override;
39 void final_result(std::span<uint8_t> out) override;
40
41 void compress(const uint8_t input[], bool lastblock = false);
42
43 void compress_64(const uint64_t input[], bool lastblock = false);
44
45 private:
46#if defined(BOTAN_HAS_STREEBOG_AVX512_GFNI)
47 static void compress_64_avx512_gfni(uint64_t h[8], const uint64_t M[8], uint64_t N);
48#endif
49
50 const size_t m_output_bits;
51 uint64_t m_count;
55};
56
57} // namespace Botan
58
59#endif
Alignment buffer helper.
void final(uint8_t out[])
Definition buf_comp.h:97
void compress(const uint8_t input[], bool lastblock=false)
Definition streebog.cpp:153
void add_data(std::span< const uint8_t > input) override
Definition streebog.cpp:110
std::string provider() const override
Definition streebog.cpp:85
size_t output_length() const override
Definition streebog.h:23
std::unique_ptr< HashFunction > new_object() const override
Definition streebog.h:25
void compress_64(const uint64_t input[], bool lastblock=false)
Definition streebog.cpp:179
std::unique_ptr< HashFunction > copy_state() const override
Definition streebog.cpp:69
void final_result(std::span< uint8_t > out) override
Definition streebog.cpp:131
Streebog(size_t output_bits)
Definition streebog.cpp:73
void clear() override
Definition streebog.cpp:98
std::string name() const override
Definition streebog.cpp:81
size_t hash_block_size() const override
Definition streebog.h:31
std::vector< T, secure_allocator< T > > secure_vector
Definition secmem.h:128