25#ifndef I_SHA2_PASSWORD_COMMON_INCLUDED
26#define I_SHA2_PASSWORD_COMMON_INCLUDED
28#include <openssl/evp.h>
29#include "openssl/ossl_typ.h"
78 void scrub()
override;
139 const unsigned char *
rnd,
unsigned int rnd_length,
Interface for cryptographic digest generation.
Definition: i_sha2_password_common.h:57
virtual bool retrieve_digest(unsigned char *digest, unsigned int length)=0
virtual ~Generate_digest()=default
virtual bool update_digest(const void *src, unsigned int length)=0
Scramble generator Responsible for generating scramble of following format: XOR(SHA2(m_src),...
Definition: i_sha2_password_common.h:102
Generate_digest * m_digest_generator
Digest generator class.
Definition: i_sha2_password_common.h:119
std::string m_rnd
random string
Definition: i_sha2_password_common.h:115
~Generate_scramble()
Generate_scramble destructor.
Definition: sha2_password_common.cc:184
std::string m_src
plaintext source string
Definition: i_sha2_password_common.h:113
bool scramble(unsigned char *scramble, unsigned int scramble_length)
Scramble generation.
Definition: sha2_password_common.cc:206
Digest_info m_digest_type
Type of digest.
Definition: i_sha2_password_common.h:117
unsigned int m_digest_length
length of the digest
Definition: i_sha2_password_common.h:121
Generate_scramble(const std::string source, const std::string rnd, Digest_info digest_type=Digest_info::SHA256_DIGEST)
Generate_scramble constructor.
Definition: sha2_password_common.cc:165
SHA256 digest generator.
Definition: i_sha2_password_common.h:71
bool update_digest(const void *src, unsigned int length) override
Update digest with plaintext.
Definition: sha2_password_common.cc:72
void deinit()
Release allocated memory for digest context.
Definition: sha2_password_common.cc:152
void scrub() override
Cleanup and reinit.
Definition: sha2_password_common.cc:118
SHA256_digest()
SHA256 digest generator constructor.
Definition: sha2_password_common.cc:53
unsigned char m_digest[CACHING_SHA2_DIGEST_LENGTH]
Digest output buffer.
Definition: i_sha2_password_common.h:87
bool m_ok
Status.
Definition: i_sha2_password_common.h:91
bool retrieve_digest(unsigned char *digest, unsigned int length) override
Retrieve generated digest.
Definition: sha2_password_common.cc:96
bool all_ok()
Definition: i_sha2_password_common.h:79
~SHA256_digest() override
Release acquired memory.
Definition: sha2_password_common.cc:59
void init()
Initialize digest context.
Definition: sha2_password_common.cc:130
EVP_MD_CTX * md_context
Digest context.
Definition: i_sha2_password_common.h:89
Scramble validator Expects scramble to be: XOR(SHA2(m_src), SHA2(SHA2(SHA2(m_src)),...
Definition: i_sha2_password_common.h:136
~Validate_scramble()
Validate_scramble destructor.
Definition: sha2_password_common.cc:298
const unsigned char * m_rnd
random string
Definition: i_sha2_password_common.h:152
Generate_digest * m_digest_generator
Digest generator class.
Definition: i_sha2_password_common.h:158
const unsigned char * m_known
SHA2(SHA2(plaintext_password))
Definition: i_sha2_password_common.h:150
bool validate()
Validate the scramble.
Definition: sha2_password_common.cc:317
unsigned int m_digest_length
length of the digest
Definition: i_sha2_password_common.h:160
unsigned int m_rnd_length
random string length
Definition: i_sha2_password_common.h:154
Digest_info m_digest_type
Type of digest.
Definition: i_sha2_password_common.h:156
Validate_scramble(const unsigned char *scramble, const unsigned char *known, const unsigned char *rnd, unsigned int rnd_length, Digest_info digest_type=Digest_info::SHA256_DIGEST)
Validate scramble constructor.
Definition: sha2_password_common.cc:275
const unsigned char * m_scramble
scramble to be validated
Definition: i_sha2_password_common.h:148
static int rnd(int max_value)
Definition: hp_test2.cc:551
bool length(const dd::Spatial_reference_system *srs, const Geometry *g1, double *length, bool *null) noexcept
Computes the length of linestrings and multilinestrings.
Definition: length.cc:76
Definition: i_sha2_password.h:45
const unsigned int CACHING_SHA2_DIGEST_LENGTH
Definition: i_sha2_password_common.h:45
Digest_info
Supported digest information.
Definition: i_sha2_password_common.h:51
void scramble(char *to, const char *message, const char *password)
Produce an obscure octet sequence from password and random string, received from the server.
Definition: mysql_native_authentication_client.cc:214
repeated Source source
Definition: replication_asynchronous_connection_failover.proto:42