Botan: Botan::GOST_34_11 Class Reference

Botan 1.10.16

Public Member Functions | List of all members
Botan::GOST_34_11 Class Reference

`#include <gost_3411.h>`

Inheritance diagram for Botan::GOST_34_11:

## Public Member Functions
void | clear ()
HashFunction * | clone () const
void | final (byte out[])
SecureVector< byte > | final ()
| GOST_34_11 ()
size_t | hash_block_size () const
std::string | name () const
size_t | output_length () const
SecureVector< byte > | process (const byte in[], size_t length)
SecureVector< byte > | process (const MemoryRegion< byte > &in)
SecureVector< byte > | process (const std::string &in)
void | update (const byte in[], size_t length)
void | update (const MemoryRegion< byte > &in)
void | update (const std::string &str)
void | update (byte in)
template<typename T >
void | update_be (const T in)

## Detailed Description

GOST 34.11

Definition at line 19 of file gost_3411.h.

## Constructor & Destructor Documentation

## ◆ GOST_34_11()

Botan::GOST_34_11::GOST_34_11 | ( |  | ) |

GOST 34.11 Constructor

Definition at line 18 of file gost_3411.cpp.

18 :
19 cipher(GOST_28147_89_Params("R3411_CryptoPro")),
20 buffer(32),
21 sum(32),
22 hash(32)
23 {
24 count = 0;
25 position = 0;
26 }

## Member Function Documentation

## ◆ clear()

void Botan::GOST_34_11::clear | ( |  | ) |
| virtual

Zeroize internal state

Implements Botan::Algorithm.

Definition at line 28 of file gost_3411.cpp.

References Botan::GOST_28147_89::clear(), Botan::MemoryRegion< T >::copy(), hash_block_size(), and Botan::zeroise().

29 {
30 cipher.clear();
31 zeroise(sum);
32 zeroise(hash);
33 count = 0;
34 position = 0;
35 }
Botan::GOST_28147_89::clear
void clear()
Definition: gost_28147.h:58
Botan::zeroise
void zeroise(MemoryRegion< T > &vec)
Definition: secmem.h:415

## ◆ clone()

HashFunction* Botan::GOST_34_11::clone | ( |  | ) | const
| inlinevirtual

Get a new object representing the same algorithm as *this

Implements Botan::HashFunction.

Definition at line 25 of file gost_3411.h.

25 { return new GOST_34_11; }
Botan::GOST_34_11::GOST_34_11
GOST_34_11()
Definition: gost_3411.cpp:18

## ◆ final() [1/2]

void Botan::Buffered_Computation::final | ( | byte | out[] | ) |
| inlineinherited

Complete the computation and retrieve the final result.

Parameters

  out | The byte array to be filled with the result. Must be of length output_length()

Definition at line 80 of file buf_comp.h.

Referenced by Botan::Comb4P::clear(), Botan::LubyRackoff::decrypt_n(), Botan::Lion::decrypt_n(), Botan::X942_PRF::derive(), Botan::KDF1::derive(), Botan::KDF2::derive(), Botan::PKCS5_PBKDF2::derive_key(), Botan::OpenPGP_S2K::derive_key(), Botan::PKCS5_PBKDF1::derive_key(), Botan::EAX_Decryption::EAX_Decryption(), Botan::EMSA2::EMSA2(), Botan::LubyRackoff::encrypt_n(), Botan::Lion::encrypt_n(), Botan::Hash_Filter::end_msg(), Botan::MAC_Filter::end_msg(), Botan::HandshakeHash::final(), Botan::HandshakeHash::final_ssl3(), Botan::Record_Writer::flush(), Botan::Record_Reader::get_record(), Botan::MGF1::mask(), Botan::EAX_Base::name(), Botan::Randpool::randomize(), Botan::EMSA3::raw_data(), Botan::Randpool::reseed(), Botan::HMAC_RNG::reseed(), Botan::DLIES_Decryptor::~DLIES_Decryptor(), and Botan::DLIES_Encryptor::~DLIES_Encryptor().

80 { final_result(out); }

## ◆ final() [2/2]

SecureVector<byte> Botan::Buffered_Computation::final | ( |  | ) |
| inlineinherited

Complete the computation and retrieve the final result.

Returns
  SecureVector holding the result

Definition at line 87 of file buf_comp.h.

88 {
89 SecureVector<byte> output(output_length());
90 final_result(&output[0]);
91 return output;
92 }
Botan::Buffered_Computation::output_length
virtual size_t output_length() const =0

## ◆ hash_block_size()

size_t Botan::GOST_34_11::hash_block_size | ( |  | ) | const
| inlinevirtual

The hash block size as defined for this algorithm

Reimplemented from Botan::HashFunction.

Definition at line 24 of file gost_3411.h.

Referenced by clear().

24 { return 32; }

## ◆ name()

std::string Botan::GOST_34_11::name | ( |  | ) | const
| inlinevirtual

Returns
  name of this algorithm

Implements Botan::Algorithm.

Definition at line 22 of file gost_3411.h.

22 { return "GOST-R-34.11-94" ; }

## ◆ output_length()

size_t Botan::GOST_34_11::output_length | ( |  | ) | const
| inlinevirtual

Returns
  length of the output of this function in bytes

Implements Botan::Buffered_Computation.

Definition at line 23 of file gost_3411.h.

23 { return 32; }

## ◆ process() [1/3]

SecureVector<byte> Botan::Buffered_Computation::process | ( | const byte | in[],
|  | size_t | length
| ) |  |
| inlineinherited

Update and finalize computation. Does the same as calling update() and final() consecutively.

Parameters

  in | the input to process as a byte array
  length | the length of the byte array

Returns
  the result of the call to final()

Definition at line 101 of file buf_comp.h.

Referenced by Botan::Randpool::add_entropy(), Botan::EME1::EME1(), and Botan::Cert_Extension::Subject_Key_ID::Subject_Key_ID().

102 {
103 add_data(in, length);
104 return final();
105 }

## ◆ process() [2/3]

SecureVector<byte> Botan::Buffered_Computation::process | ( | const MemoryRegion< byte > & | in | ) |
| inlineinherited

Update and finalize computation. Does the same as calling update() and final() consecutively.

Parameters

  in | the input to process

Returns
  the result of the call to final()

Definition at line 113 of file buf_comp.h.

References Botan::MemoryRegion< T >::size().

114 {
115 add_data(&in[0], in.size());
116 return final();
117 }
Botan::MemoryRegion::size
size_t size() const
Definition: secmem.h:29

## ◆ process() [3/3]

SecureVector<byte> Botan::Buffered_Computation::process | ( | const std::string & | in | ) |
| inlineinherited

Update and finalize computation. Does the same as calling update() and final() consecutively.

Parameters

  in | the input to process as a string

Returns
  the result of the call to final()

Definition at line 125 of file buf_comp.h.

126 {
127 update(in);
128 return final();
129 }
Botan::Buffered_Computation::update
void update(const byte in[], size_t length)
Definition: buf_comp.h:33

## ◆ update() [1/4]

void Botan::Buffered_Computation::update | ( | const byte | in[],
|  | size_t | length
| ) |  |
| inlineinherited

Add new input to process.

Parameters

  in | the input to process as a byte array
  length | of param in in bytes

Definition at line 33 of file buf_comp.h.

Referenced by Botan::HMAC_RNG::add_entropy(), Botan::Comb4P::clear(), Botan::LubyRackoff::decrypt_n(), Botan::Lion::decrypt_n(), Botan::X942_PRF::derive(), Botan::KDF1::derive(), Botan::KDF2::derive(), Botan::PKCS5_PBKDF2::derive_key(), Botan::OpenPGP_S2K::derive_key(), Botan::PKCS5_PBKDF1::derive_key(), Botan::EAX_Decryption::EAX_Decryption(), Botan::LubyRackoff::encrypt_n(), Botan::Lion::encrypt_n(), Botan::HandshakeHash::final(), Botan::HandshakeHash::final_ssl3(), Botan::Record_Writer::flush(), Botan::Record_Reader::get_record(), Botan::MGF1::mask(), Botan::EAX_Base::name(), Botan::Randpool::randomize(), Botan::HMAC_RNG::reseed(), Botan::EAX_Base::start_msg(), Botan::EMSA3::update(), Botan::DLIES_Decryptor::~DLIES_Decryptor(), and Botan::DLIES_Encryptor::~DLIES_Encryptor().

33 { add_data(in, length); }

## ◆ update() [2/4]

void Botan::Buffered_Computation::update | ( | const MemoryRegion< byte > & | in | ) |
| inlineinherited

Add new input to process.

Parameters

  in | the input to process as a MemoryRegion

Definition at line 39 of file buf_comp.h.

References Botan::MemoryRegion< T >::size().

40 {
41 add_data(&in[0], in.size());
42 }
Botan::MemoryRegion::size
size_t size() const
Definition: secmem.h:29

## ◆ update() [3/4]

void Botan::Buffered_Computation::update | ( | const std::string & | str | ) |
| inlineinherited

Add new input to process.

Parameters

  str | the input to process as a std::string. Will be interpreted as a byte array based on the strings encoding.

Definition at line 63 of file buf_comp.h.

64 {
65 add_data(reinterpret_cast<const byte*>(str.data()), str.size());
66 }

## ◆ update() [4/4]

void Botan::Buffered_Computation::update | ( | byte | in | ) |
| inlineinherited

Process a single byte.

Parameters

  in | the byte to process

Definition at line 72 of file buf_comp.h.

72 { add_data(&in, 1); }

## ◆ update_be()

template<typename T >

void Botan::Buffered_Computation::update_be | ( | const T | in | ) |
| inlineinherited

Add an integer in big-endian order

Parameters

  in | the value

Definition at line 48 of file buf_comp.h.

References Botan::get_byte().

Referenced by Botan::KDF2::derive(), Botan::PKCS5_PBKDF2::derive_key(), Botan::Record_Writer::flush(), Botan::Record_Reader::get_record(), and Botan::MGF1::mask().

49 {
50 for(size_t i = 0; i != sizeof(T); ++i)
51 {
52 byte b = get_byte(i, in);
53 add_data(&b, 1);
54 }
55 }
Botan::get_byte
byte get_byte(size_t byte_num, T input)
Definition: get_byte.h:21
Botan::byte
unsigned char byte
Definition: types.h:22

The documentation for this class was generated from the following files:

- src/hash/gost_3411/gost_3411.h
- src/hash/gost_3411/gost_3411.cpp