MySQL  8.0.22
Source Code Documentation
client_authentication.cc File Reference
#include "my_config.h"
#include <stdarg.h>
#include <string.h>
#include "my_dbug.h"
#include "my_inttypes.h"
#include <openssl/err.h>
#include <openssl/pem.h>
#include <openssl/rsa.h>
#include "crypt_genhash_impl.h"
#include "errmsg.h"
#include "m_ctype.h"
#include "mysql/client_authentication.h"
#include "mysql/psi/mysql_mutex.h"
#include "mysys_err.h"
#include "sql_common.h"
#include "sql_string.h"
#include "client_async_authentication.h"
#include "mysql/plugin.h"
#include "sha2.h"
#include "violite.h"

Macros

#define MAX_CIPHER_LENGTH   1024
 
#define SHA2_SCRAMBLE_LENGTH   SHA256_DIGEST_LENGTH
 

Functions

int sha256_password_init (char *, size_t, int, va_list)
 
int sha256_password_deinit (void)
 
static RSArsa_init (MYSQL *mysql)
 Reads and parse RSA public key data from a file. More...
 
int sha256_password_auth_client (MYSQL_PLUGIN_VIO *vio, MYSQL *mysql)
 Authenticate the client using the RSA or TLS and a SHA256 salted password. More...
 
net_async_status sha256_password_auth_client_nonblocking (MYSQL_PLUGIN_VIO *vio, MYSQL *mysql, int *result)
 Non blocking version of sha256_password_auth_client. More...
 
int caching_sha2_password_init (char *, size_t, int, va_list)
 
int caching_sha2_password_deinit (void)
 
static bool is_secure_transport (MYSQL *mysql)
 
int caching_sha2_password_auth_client (MYSQL_PLUGIN_VIO *vio, MYSQL *mysql)
 Authenticate the client using the RSA or TLS and a SHA2 salted password. More...
 
net_async_status caching_sha2_password_auth_client_nonblocking (MYSQL_PLUGIN_VIO *vio, MYSQL *mysql, int *result)
 non blocking version of caching_sha2_password_auth_client More...
 
void STDCALL mysql_reset_server_public_key (void)
 

Variables

mysql_mutex_t g_public_key_mutex
 
static RSAg_public_key = nullptr
 
static char request_public_key = '\2'
 
static char fast_auth_success = '\3'
 
static char perform_full_authentication = '\4'
 

Macro Definition Documentation

◆ MAX_CIPHER_LENGTH

#define MAX_CIPHER_LENGTH   1024

◆ SHA2_SCRAMBLE_LENGTH

#define SHA2_SCRAMBLE_LENGTH   SHA256_DIGEST_LENGTH

Function Documentation

◆ caching_sha2_password_auth_client()

int caching_sha2_password_auth_client ( MYSQL_PLUGIN_VIO vio,
MYSQL mysql 
)

Authenticate the client using the RSA or TLS and a SHA2 salted password.

Parameters
vioProvides plugin access to communication channel
mysqlClient connection handler
Returns
Error status
Return values
CR_ERRORAn error occurred.
CR_OKAuthentication succeeded.

◆ caching_sha2_password_auth_client_nonblocking()

net_async_status caching_sha2_password_auth_client_nonblocking ( MYSQL_PLUGIN_VIO vio,
MYSQL mysql,
int *  result 
)

non blocking version of caching_sha2_password_auth_client

◆ caching_sha2_password_deinit()

int caching_sha2_password_deinit ( void  )

◆ caching_sha2_password_init()

int caching_sha2_password_init ( char *  ,
size_t  ,
int  ,
va_list   
)

◆ is_secure_transport()

static bool is_secure_transport ( MYSQL mysql)
static

◆ mysql_reset_server_public_key()

void STDCALL mysql_reset_server_public_key ( void  )

◆ rsa_init()

static RSA* rsa_init ( MYSQL mysql)
static

Reads and parse RSA public key data from a file.

Parameters
mysqlconnection handle with file path data
Returns
Pointer to the RSA public key storage buffer

◆ sha256_password_auth_client()

int sha256_password_auth_client ( MYSQL_PLUGIN_VIO vio,
MYSQL mysql 
)

Authenticate the client using the RSA or TLS and a SHA256 salted password.

Parameters
vioProvides plugin access to communication channel
mysqlClient connection handler
Returns
Error status
Return values
CR_ERRORAn error occurred.
CR_OKAuthentication succeeded.

◆ sha256_password_auth_client_nonblocking()

net_async_status sha256_password_auth_client_nonblocking ( MYSQL_PLUGIN_VIO vio,
MYSQL mysql,
int *  result 
)

Non blocking version of sha256_password_auth_client.

◆ sha256_password_deinit()

int sha256_password_deinit ( void  )

◆ sha256_password_init()

int sha256_password_init ( char *  ,
size_t  ,
int  ,
va_list   
)

Variable Documentation

◆ fast_auth_success

char fast_auth_success = '\3'
static

◆ g_public_key

RSA* g_public_key = nullptr
static

◆ g_public_key_mutex

mysql_mutex_t g_public_key_mutex

◆ perform_full_authentication

char perform_full_authentication = '\4'
static

◆ request_public_key

char request_public_key = '\2'
static