![]() |
MySQL 9.6.0
Source Code Documentation
|
#include <openssl/evp.h>#include "my_dbug.h"#include "my_ssl_algo_cache.h"#include "my_sys.h"#include "sql_common.h"Macros | |
| #define | MYSQL_NATIVE_PASSWORD_PLUGIN_NAME "mysql_native_password" |
| #define | SHA1_HASH_SIZE 20 /* Hash size in bytes */ |
Functions | |
| static void | my_crypt (char *to, const uchar *s1, const uchar *s2, uint len) |
| static void | compute_sha1_hash (uint8 *digest, const char *buf, size_t len) |
| Wrapper function to compute SHA1 message digest. More... | |
| static void | compute_sha1_hash_multi (uint8 *digest, const char *buf1, int len1, const char *buf2, int len2) |
| Wrapper function to compute SHA1 message digest for two messages in order to emulate sha1(msg1, msg2). More... | |
| void | compute_two_stage_sha1_hash (const char *password, size_t pass_len, uint8 *hash_stage1, uint8 *hash_stage2) |
| Compute two stage SHA1 hash of the password : More... | |
| void | scramble (char *to, const char *message, const char *password) |
| Produce an obscure octet sequence from password and random string, received from the server. More... | |
| static int | native_password_auth_client (MYSQL_PLUGIN_VIO *vio, MYSQL *mysql) |
| Client authentication plugin that does native MySQL authentication using a 20-byte (4.1+) scramble. More... | |
| mysql_declare_client_plugin (AUTHENTICATION) MYSQL_NATIVE_PASSWORD_PLUGIN_NAME | |
Variables | |
| MYSQL_CLIENT_PLUGIN_AUTHOR_ORACLE | |
| MySQL Native Authentication | Client |
| MySQL Native Authentication | GPL |
| MySQL Native Authentication | nullptr |
| MySQL Native Authentication | native_password_auth_client |
| MySQL Native Authentication | mysql_end_client_plugin |
| #define MYSQL_NATIVE_PASSWORD_PLUGIN_NAME "mysql_native_password" |
| #define SHA1_HASH_SIZE 20 /* Hash size in bytes */ |
|
static |
Wrapper function to compute SHA1 message digest.
| [out] | digest | Computed SHA1 digest |
| [in] | buf | Message to be computed |
| [in] | len | Length of the message |
|
static |
Wrapper function to compute SHA1 message digest for two messages in order to emulate sha1(msg1, msg2).
| [out] | digest | Computed SHA1 digest |
| [in] | buf1 | First message |
| [in] | len1 | Length of first message |
| [in] | buf2 | Second message |
| [in] | len2 | Length of second message |
|
inline |
Compute two stage SHA1 hash of the password :
hash_stage1=sha1("password") hash_stage2=sha1(hash_stage1)
| [in] | password | Password string. |
| [in] | pass_len | Length of the password. |
| [out] | hash_stage1 | sha1(password) |
| [out] | hash_stage2 | sha1(hash_stage1) |
| mysql_declare_client_plugin | ( | AUTHENTICATION | ) |
|
static |
Client authentication plugin that does native MySQL authentication using a 20-byte (4.1+) scramble.
| vio | the channel to operate on |
| mysql | the MYSQL structure to operate on |
| -1 | CR_OK : Success |
| 1 | CR_ERROR : error reading |
| 2012 | CR_SERVER_HANDSHAKE_ERR : malformed handshake data |
| void scramble | ( | char * | to, |
| const char * | message, | ||
| const char * | password | ||
| ) |
Produce an obscure octet sequence from password and random string, received from the server.
This sequence corresponds to the password, but password can not be easily restored from it. The sequence is then sent to the server for validation. Trailing zero is not stored in the buf as it is not needed. This function is used by client to create authenticated reply to the server's greeting.
| [out] | to | store scrambled string here. The buf must be at least SHA1_HASH_SIZE bytes long. |
| message | random message, must be exactly SCRAMBLE_LENGTH long and NULL-terminated. | |
| password | users' password, NULL-terminated |
| MySQL Native Authentication Client |
| MySQL Native Authentication GPL |
| MYSQL_CLIENT_PLUGIN_AUTHOR_ORACLE |
| MySQL Native Authentication mysql_end_client_plugin |
| MySQL Native Authentication native_password_auth_client |
| MySQL Native Authentication nullptr |