summaryrefslogtreecommitdiff
path: root/sql/password.c
diff options
context:
space:
mode:
authorSergei Golubchik <sergii@pisem.net>2013-12-09 12:38:02 +0100
committerSergei Golubchik <sergii@pisem.net>2013-12-09 12:38:02 +0100
commitbec1d903d944acd5c28c3f4f2d22b84ddae63ea2 (patch)
tree8a903859333de1648f789a2985fd62e856ebfa05 /sql/password.c
parent6ae5f0efea392e3fdb285afc1bafdae16888b96a (diff)
downloadmariadb-git-bec1d903d944acd5c28c3f4f2d22b84ddae63ea2.tar.gz
Do the partial merge of WL#5602 correctly:
Remove unused code (that should not have been merged) Add protocol extension (that should have been merged) Fix bugs (see pack.c)
Diffstat (limited to 'sql/password.c')
-rw-r--r--sql/password.c55
1 files changed, 15 insertions, 40 deletions
diff --git a/sql/password.c b/sql/password.c
index 954daf2d8d1..22e0060abd2 100644
--- a/sql/password.c
+++ b/sql/password.c
@@ -67,7 +67,6 @@
#include <mysql.h>
#include <my_rnd.h>
#include <sha1.h>
-#include <crypt_genhash_impl.h>
/************ MySQL 3.23-4.0 authentication routines: untouched ***********/
@@ -280,14 +279,13 @@ void make_password_from_salt_323(char *to, const ulong *salt)
**************** MySQL 4.1.1 authentication routines *************
*/
-/*
- Generate string of printable random characters of requested length
- SYNOPSIS
- create_random_string()
- to OUT buffer for generation; must be at least length+1 bytes
- long; result string is always null-terminated
- length IN how many random characters to put in buffer
- rand_st INOUT structure used for number generation
+/**
+ Generate string of printable random characters of requested length.
+
+ @param to[out] Buffer for generation; must be at least length+1 bytes
+ long; result string is always null-terminated
+ length[in] How many random characters to put in buffer
+ rand_st Structure used for number generation
*/
void create_random_string(char *to, uint length,
@@ -374,23 +372,6 @@ my_crypt(char *to, const uchar *s1, const uchar *s2, uint len)
}
-#if defined(HAVE_OPENSSL)
-void my_make_scrambled_password(char *to, const char *password,
- size_t pass_len)
-{
-
- char salt[CRYPT_SALT_LENGTH + 1];
-
- generate_user_salt(salt, CRYPT_SALT_LENGTH + 1);
- my_crypt_genhash(to,
- CRYPT_MAX_PASSWORD_SIZE,
- password,
- pass_len,
- salt,
- 0);
-
-}
-#endif
/**
Compute two stage SHA1 hash of the password :
@@ -422,14 +403,14 @@ void compute_two_stage_sha1_hash(const char *password, size_t pass_len,
The result of this function is used as return value from PASSWORD() and
is stored in the database.
SYNOPSIS
- my_make_scrambled_password_sha1()
+ my_make_scrambled_password()
buf OUT buffer of size 2*SHA1_HASH_SIZE + 2 to store hex string
password IN password string
pass_len IN length of password string
*/
-void my_make_scrambled_password_sha1(char *to, const char *password,
- size_t pass_len)
+void my_make_scrambled_password(char *to, const char *password,
+ size_t pass_len)
{
uint8 hash_stage2[SHA1_HASH_SIZE];
@@ -455,7 +436,7 @@ void my_make_scrambled_password_sha1(char *to, const char *password,
void make_scrambled_password(char *to, const char *password)
{
- my_make_scrambled_password_sha1(to, password, strlen(password));
+ my_make_scrambled_password(to, password, strlen(password));
}
@@ -500,7 +481,7 @@ scramble(char *to, const char *message, const char *password)
null-terminated, reply and hash_stage2 must be at least SHA1_HASH_SIZE
long (if not, something fishy is going on).
SYNOPSIS
- check_scramble_sha1()
+ check_scramble()
scramble clients' reply, presumably produced by scramble()
message original random string, previously sent to client
(presumably second argument of scramble()), must be
@@ -514,8 +495,8 @@ scramble(char *to, const char *message, const char *password)
*/
my_bool
-check_scramble_sha1(const uchar *scramble_arg, const char *message,
- const uint8 *hash_stage2)
+check_scramble(const uchar *scramble_arg, const char *message,
+ const uint8 *hash_stage2)
{
uint8 buf[SHA1_HASH_SIZE];
uint8 hash_stage2_reassured[SHA1_HASH_SIZE];
@@ -532,13 +513,6 @@ check_scramble_sha1(const uchar *scramble_arg, const char *message,
return test(memcmp(hash_stage2, hash_stage2_reassured, SHA1_HASH_SIZE));
}
-my_bool
-check_scramble(const uchar *scramble_arg, const char *message,
- const uint8 *hash_stage2)
-{
- return check_scramble_sha1(scramble_arg, message, hash_stage2);
-}
-
/*
Convert scrambled password from asciiz hex string to binary form.
@@ -567,3 +541,4 @@ void make_password_from_salt(char *to, const uint8 *hash_stage2)
*to++= PVERSION41_CHAR;
octet2hex(to, (const char*) hash_stage2, SHA1_HASH_SIZE);
}
+