Botan 2.1.0 Crypto and TLS for C++11

- Main Page
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Member Functions | List of all members
Botan::Buffered_Computation Class Referenceabstract

`#include <buf_comp.h>`

Inheritance diagram for Botan::Buffered_Computation:

## Public Member Functions
void | final (uint8_t out[])
secure_vector< uint8_t > | final ()
template<typename Alloc >
void | final (std::vector< uint8_t, Alloc > &out)
std::vector< uint8_t > | final_stdvec ()
virtual size_t | output_length () const =0
secure_vector< uint8_t > | process (const uint8_t in[], size_t length)
secure_vector< uint8_t > | process (const secure_vector< uint8_t > &in)
secure_vector< uint8_t > | process (const std::vector< uint8_t > &in)
secure_vector< uint8_t > | process (const std::string &in)
void | update (const uint8_t in[], size_t length)
void | update (const secure_vector< uint8_t > &in)
void | update (const std::vector< uint8_t > &in)
void | update (const std::string &str)
void | update (uint8_t in)
template<typename T >
void | update_be (const T in)
virtual | ~Buffered_Computation ()

## Detailed Description

This class represents any kind of computation which uses an internal state, such as hash functions or MACs

Definition at line 21 of file buf_comp.h.

## Constructor & Destructor Documentation

virtual Botan::Buffered_Computation::~Buffered_Computation | ( |  | ) |
| inline virtual

Definition at line 166 of file buf_comp.h.

166 {}

## Member Function Documentation

void Botan::Buffered_Computation::final | ( | uint8_t | out[] | ) |
| inline

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 89 of file buf_comp.h.

Referenced by botan_hash_final(), botan_mac_final(), Botan::TLS::TLS_CBC_HMAC_AEAD_Encryption::finish(), Botan::TLS::TLS_CBC_HMAC_AEAD_Decryption::finish(), Botan::mgf1_mask(), and Botan::pbkdf2().

89 { final_result(out); }

secure_vector<uint8_t> Botan::Buffered_Computation::final | ( |  | ) |
| inline

Complete the computation and retrieve the final result.

Returns
  secure_vector holding the result

Definition at line 96 of file buf_comp.h.

97 {
98 secure_vector<uint8_t> output(output_length());
99 final_result(output.data());
100 return output;
101 }
Botan::Buffered_Computation::output_length
virtual size_t output_length() const =0
template<typename Alloc >

void Botan::Buffered_Computation::final | ( | std::vector< uint8_t, Alloc > & | out | ) |
| inline

Definition at line 111 of file buf_comp.h.

112 {
113 out.resize(output_length());
114 final_result(out.data());
115 }
Botan::Buffered_Computation::output_length
virtual size_t output_length() const =0

std::vector<uint8_t> Botan::Buffered_Computation::final_stdvec | ( |  | ) |
| inline

Definition at line 103 of file buf_comp.h.

104 {
105 std::vector<uint8_t> output(output_length());
106 final_result(output.data());
107 return output;
108 }
Botan::Buffered_Computation::output_length
virtual size_t output_length() const =0

virtual size_t Botan::Buffered_Computation::output_length | ( |  | ) | const
| pure virtual

Returns
  length of the output of this function in bytes

Implemented in Botan::SHA_512_256, Botan::SHAKE_256, Botan::SHA_256, Botan::SHA_512, Botan::Blake2b, Botan::Skein_512, Botan::Keccak_1600, Botan::SHA_3, Botan::SHAKE_128, Botan::Comb4P, Botan::Poly1305, Botan::GMAC, Botan::Parallel, Botan::HMAC, Botan::SipHash, Botan::CBC_MAC, Botan::ANSI_X919_MAC, Botan::GOST_34_11, Botan::SHA_224, Botan::CMAC, Botan::Adler32, Botan::CRC24, Botan::CRC32, Botan::MD4, Botan::MD5, Botan::RIPEMD_160, Botan::SHA_160, Botan::SHA_384, Botan::Tiger, and Botan::Whirlpool.

Referenced by botan_hash_output_length(), botan_mac_output_length(), Botan::pbkdf2(), and Botan::MDx_HashFunction::write_count().

secure_vector<uint8_t> Botan::Buffered_Computation::process | ( | const uint8_t | in[],
|  | size_t | length
| ) |  |
| inline

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 124 of file buf_comp.h.

Referenced by Botan::RTSS_Share::split().

125 {
126 add_data(in, length);
127 return final();
128 }

secure_vector<uint8_t> Botan::Buffered_Computation::process | ( | const secure_vector< uint8_t > & | in | ) |
| inline

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 136 of file buf_comp.h.

137 {
138 add_data(in.data(), in.size());
139 return final();
140 }

secure_vector<uint8_t> Botan::Buffered_Computation::process | ( | const std::vector< uint8_t > & | in | ) |
| inline

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 148 of file buf_comp.h.

149 {
150 add_data(in.data(), in.size());
151 return final();
152 }

secure_vector<uint8_t> Botan::Buffered_Computation::process | ( | const std::string & | in | ) |
| inline

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 160 of file buf_comp.h.

161 {
162 update(in);
163 return final();
164 }
Botan::Buffered_Computation::update
void update(const uint8_t in[], size_t length)
Definition: buf_comp.h:34

void Botan::Buffered_Computation::update | ( | const uint8_t | in[],
|  | size_t | length
| ) |  |
| inline

Add new input to process.

Parameters

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

Definition at line 34 of file buf_comp.h.

Referenced by botan_hash_update(), botan_mac_update(), Botan::TLS::TLS_CBC_HMAC_AEAD_Encryption::finish(), Botan::TLS::TLS_CBC_HMAC_AEAD_Decryption::finish(), Botan::mgf1_mask(), and Botan::pbkdf2().

34 { add_data(in, length); }

void Botan::Buffered_Computation::update | ( | const secure_vector< uint8_t > & | in | ) |
| inline

Add new input to process.

Parameters

  in | the input to process as a secure_vector

Definition at line 40 of file buf_comp.h.

41 {
42 add_data(in.data(), in.size());
43 }

void Botan::Buffered_Computation::update | ( | const std::vector< uint8_t > & | in | ) |
| inline

Add new input to process.

Parameters

  in | the input to process as a std::vector

Definition at line 49 of file buf_comp.h.

50 {
51 add_data(in.data(), in.size());
52 }

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

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 72 of file buf_comp.h.

73 {
74 add_data(reinterpret_cast<const uint8_t*>(str.data()), str.size());
75 }

void Botan::Buffered_Computation::update | ( | uint8_t | in | ) |
| inline

Process a single byte.

Parameters

  in | the byte to process

Definition at line 81 of file buf_comp.h.

81 { add_data(&in, 1); }
template<typename T >

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

Add an integer in big-endian order

Parameters

  in | the value

Definition at line 58 of file buf_comp.h.

References Botan::get_byte().

Referenced by Botan::mgf1_mask(), and Botan::pbkdf2().

59 {
60 for(size_t i = 0; i != sizeof(T); ++i)
61 {
62 uint8_t b = get_byte(i, in);
63 add_data(&b, 1);
64 }
65 }
Botan::get_byte
uint8_t get_byte(size_t byte_num, T input)
Definition: loadstor.h:47

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

- src/lib/base/buf_comp.h