Botan 2.19.5 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 BOTAN_FUTURE_INTERNAL_HEADER(streebog.h)
14
15namespace 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 size_t output_length() const override { return m_output_bits / 8; }
25
26 HashFunction* clone() const override { return new Streebog(m_output_bits); }
27 void clear() override;
28 std::string name() const override;
29 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 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 Streebog_512() : Streebog(512) {}
68 };
69
70}
71
72#endif
Botan::HashFunction
Definition: hash.h:21
Botan::HashFunction::copy_state
virtual std::unique_ptr< HashFunction > copy_state() const =0
Botan::HashFunction::name
virtual std::string name() const =0
Botan::HashFunction::clear
virtual void clear()=0
Botan::Streebog_256
Definition: streebog.h:56
Botan::Streebog_256::Streebog_256
Streebog_256()
Definition: streebog.h:58
Botan::Streebog_512
Definition: streebog.h:65
Botan::Streebog_512::Streebog_512
Streebog_512()
Definition: streebog.h:67
Botan::Streebog
Definition: streebog.h:22
Botan::Streebog::output_length
size_t output_length() const override
Definition: streebog.h:24
Botan::Streebog::clone
HashFunction * clone() const override
Definition: streebog.h:26
Botan::Streebog::hash_block_size
size_t hash_block_size() const override
Definition: streebog.h:29
final
int(* final)(unsigned char *, CTX *)
Definition: commoncrypto_hash.cpp:29
BOTAN_PUBLIC_API
#define BOTAN_PUBLIC_API(maj, min)
Definition: compiler.h:31
BOTAN_FUTURE_INTERNAL_HEADER
#define BOTAN_FUTURE_INTERNAL_HEADER(hdr)
Definition: compiler.h:136
Botan
Definition: alg_id.cpp:13
Botan::secure_vector
std::vector< T, secure_allocator< T > > secure_vector
Definition: secmem.h:65