23#ifndef SQL_COMMON_CLIENT_ASYNC_AUTHENTICATION_H
24#define SQL_COMMON_CLIENT_ASYNC_AUTHENTICATION_H
26#define MAX_CIPHER_LENGTH 1024
28#include <openssl/ossl_typ.h>
29#include <openssl/pem.h>
30#include <openssl/rsa.h>
46 const unsigned char *
pkt,
102#if OPENSSL_VERSION_NUMBER >= 0x30000000L
client_auth_caching_sha2_password_plugin_status
Definition: client_async_authentication.h:86
@ CACHING_SHA2_REQUEST_PUBLIC_KEY
Definition: client_async_authentication.h:90
@ CACHING_SHA2_READ_PUBLIC_KEY
Definition: client_async_authentication.h:91
@ CACHING_SHA2_SEND_PLAIN_PASSWORD
Definition: client_async_authentication.h:93
@ CACHING_SHA2_SEND_ENCRYPTED_PASSWORD
Definition: client_async_authentication.h:92
@ CACHING_SHA2_READING_PASSWORD
Definition: client_async_authentication.h:87
@ CACHING_SHA2_CHALLENGE_RESPONSE
Definition: client_async_authentication.h:89
@ CACHING_SHA2_WRITING_RESPONSE
Definition: client_async_authentication.h:88
mysql_state_machine_status
Definition: client_async_authentication.h:65
@ STATE_MACHINE_FAILED
Definition: client_async_authentication.h:66
@ STATE_MACHINE_CONTINUE
Definition: client_async_authentication.h:67
@ STATE_MACHINE_DONE
Definition: client_async_authentication.h:69
@ STATE_MACHINE_WOULD_BLOCK
Definition: client_async_authentication.h:68
client_auth_native_password_plugin_status
Definition: client_async_authentication.h:73
@ NATIVE_READING_PASSWORD
Definition: client_async_authentication.h:74
@ NATIVE_WRITING_RESPONSE
Definition: client_async_authentication.h:75
client_auth_sha256_password_plugin_status
Definition: client_async_authentication.h:78
@ SHA256_REQUEST_PUBLIC_KEY
Definition: client_async_authentication.h:80
@ SHA256_SEND_ENCRYPTED_PASSWORD
Definition: client_async_authentication.h:82
@ SHA256_READING_PASSWORD
Definition: client_async_authentication.h:79
@ SHA256_READ_PUBLIC_KEY
Definition: client_async_authentication.h:81
@ SHA256_SEND_PLAIN_PASSWORD
Definition: client_async_authentication.h:83
#define MAX_CIPHER_LENGTH
Definition: client_async_authentication.h:26
mysql_state_machine_status(* csm_function)(mysql_async_connect *)
Definition: client_async_authentication.h:147
ssl_exchange_state
Definition: client_async_authentication.h:152
@ SSL_REQUEST
Definition: client_async_authentication.h:153
@ SSL_CONNECT
Definition: client_async_authentication.h:154
@ SSL_COMPLETE
Definition: client_async_authentication.h:155
@ SSL_NONE
Definition: client_async_authentication.h:156
mysql_state_machine_status(* authsm_function)(mysql_async_auth *)
Definition: client_async_authentication.h:98
static char buf[MAX_BUF]
Definition: conf_to_src.cc:73
Some integer typedefs for easier portability.
unsigned char uchar
Definition: my_inttypes.h:52
Declarations for asynchronous client communication.
Common definition between mysql server & client.
#define SCRAMBLE_LENGTH
Length of random string sent by server on handshake; this is also length of obfuscated password,...
Definition: mysql_com.h:128
#define NAME_LEN
Definition: mysql_com.h:67
#define USERNAME_LENGTH
Definition: mysql_com.h:69
struct result result
Definition: result.h:34
This file defines constants and data structures that are the same for both client- and server-side au...
net_async_status
Definition: plugin_auth_common.h:137
struct rsa_st RSA
Definition: sql_authentication.h:103
Definition: client_async_authentication.h:39
auth_plugin_t * plugin
what plugin we're under
Definition: client_async_authentication.h:51
struct MCPVIO_EXT::@35 cached_server_reply
uchar * pkt
pointer into NET::buff
Definition: client_async_authentication.h:54
int packets_read
Definition: client_async_authentication.h:59
void(* info)(MYSQL_PLUGIN_VIO *vio, MYSQL_PLUGIN_VIO_INFO *info)
Definition: client_async_authentication.h:42
net_async_status(* write_packet_nonblocking)(struct MYSQL_PLUGIN_VIO *vio, const unsigned char *pkt, int pkt_len, int *result)
Definition: client_async_authentication.h:45
bool pkt_received
a flag indicating that pkt, pkt_len contain valid packet to be reused
Definition: client_async_authentication.h:57
const char * db
Definition: client_async_authentication.h:52
net_async_status(* read_packet_nonblocking)(struct MYSQL_PLUGIN_VIO *vio, unsigned char **buf, int *result)
Definition: client_async_authentication.h:43
uint pkt_len
Definition: client_async_authentication.h:55
MYSQL * mysql
Definition: client_async_authentication.h:50
int(* read_packet)(MYSQL_PLUGIN_VIO *vio, uchar **buf)
Definition: client_async_authentication.h:40
int(* write_packet)(MYSQL_PLUGIN_VIO *vio, const uchar *pkt, int pkt_len)
Definition: client_async_authentication.h:41
int last_read_packet_len
the length of the last read packet
Definition: client_async_authentication.h:61
int mysql_change_user
if it's mysql_change_user()
Definition: client_async_authentication.h:60
int packets_written
counters for send/received packets
Definition: client_async_authentication.h:59
Definition: plugin_auth_common.h:121
Provides plugin access to communication channel.
Definition: plugin_auth_common.h:147
Definition: client_plugin.h:123
Definition: client_async_authentication.h:111
bool non_blocking
Definition: client_async_authentication.h:113
const char * data_plugin
set to mysql_async_connect::scramble_plugin
Definition: client_async_authentication.h:118
sha2_async_auth sha2_auth
Definition: client_async_authentication.h:135
auth_plugin_t * auth_plugin
Definition: client_async_authentication.h:122
char * change_user_buff
Definition: client_async_authentication.h:127
int client_auth_plugin_state
Used by caching_sha256_password plugin.
Definition: client_async_authentication.h:131
MCPVIO_EXT mpvio
Definition: client_async_authentication.h:123
const char * auth_plugin_name
Definition: client_async_authentication.h:121
uint current_factor_index
Definition: client_async_authentication.h:133
MYSQL * mysql
Definition: client_async_authentication.h:112
char * data
Definition: client_async_authentication.h:115
authsm_function state_function
Definition: client_async_authentication.h:132
uint data_len
Definition: client_async_authentication.h:116
ulong pkt_length
Definition: client_async_authentication.h:124
int change_user_buff_len
Definition: client_async_authentication.h:128
const char * db
Definition: client_async_authentication.h:119
int res
Definition: client_async_authentication.h:125
Definition: client_async_authentication.h:164
const char * scramble_plugin
The server sends the default plugin name in Protocol::HandshakeV10.
Definition: client_async_authentication.h:182
char * scramble_data
Definition: client_async_authentication.h:180
char buff[NAME_LEN+USERNAME_LENGTH+100]
Definition: client_async_authentication.h:178
SSL * ssl
Definition: client_async_authentication.h:193
int scramble_data_len
Definition: client_async_authentication.h:179
csm_function state_function
Definition: client_async_authentication.h:195
ssl_exchange_state ssl_state
Definition: client_async_authentication.h:192
char ** current_init_command
Definition: client_async_authentication.h:190
MYSQL * mysql
Definition: client_async_authentication.h:166
char * host_info
Definition: client_async_authentication.h:177
ulong client_flag
Definition: client_async_authentication.h:173
uint port
Definition: client_async_authentication.h:171
struct mysql_async_auth * auth_context
Definition: client_async_authentication.h:187
bool scramble_buffer_allocated
Definition: client_async_authentication.h:184
bool non_blocking
Definition: client_async_authentication.h:174
ulong pkt_length
Definition: client_async_authentication.h:176
const char * user
Definition: client_async_authentication.h:168
bool saved_reconnect
Definition: client_async_authentication.h:189
const char * db
Definition: client_async_authentication.h:170
const char * passwd
Definition: client_async_authentication.h:169
const char * unix_socket
Definition: client_async_authentication.h:172
char * scramble_buffer
Definition: client_async_authentication.h:183
const char * host
Definition: client_async_authentication.h:167
Definition: client_async_authentication.h:100
int cipher_length
Definition: client_async_authentication.h:108
unsigned char encrypted_password[MAX_CIPHER_LENGTH]
Definition: client_async_authentication.h:101
unsigned char scramble_pkt[SCRAMBLE_LENGTH]
Definition: client_async_authentication.h:107
RSA * public_key
Definition: client_async_authentication.h:105