summaryrefslogtreecommitdiff
path: root/sql/password.c
diff options
context:
space:
mode:
authorunknown <konstantin@mysql.com>2006-01-11 17:31:52 +0300
committerunknown <konstantin@mysql.com>2006-01-11 17:31:52 +0300
commit31ff9e9a1077d24287a36a3ff1e9e946e11a6a38 (patch)
treed9a36b082f480a17e4af43c766e9b1fc4bab9330 /sql/password.c
parent29818203eb54980c4ceeca4681592617882505df (diff)
downloadmariadb-git-31ff9e9a1077d24287a36a3ff1e9e946e11a6a38.tar.gz
A fix for Bug#13944 "libmysqlclient exporting sha1_result function":
rename sha1_* to mysql_sha1_* include/sha1.h: rename sha1_* to mysql_sha1_* mysys/sha1.c: rename sha1_* to mysql_sha1_* sql/item_strfunc.cc: rename sha1_* to mysql_sha1_* sql/password.c: rename sha1_* to mysql_sha1_*
Diffstat (limited to 'sql/password.c')
-rw-r--r--sql/password.c46
1 files changed, 23 insertions, 23 deletions
diff --git a/sql/password.c b/sql/password.c
index 04b3a46bd48..94b9dc440be 100644
--- a/sql/password.c
+++ b/sql/password.c
@@ -392,15 +392,15 @@ make_scrambled_password(char *to, const char *password)
SHA1_CONTEXT sha1_context;
uint8 hash_stage2[SHA1_HASH_SIZE];
- sha1_reset(&sha1_context);
+ mysql_sha1_reset(&sha1_context);
/* stage 1: hash password */
- sha1_input(&sha1_context, (uint8 *) password, strlen(password));
- sha1_result(&sha1_context, (uint8 *) to);
+ mysql_sha1_input(&sha1_context, (uint8 *) password, strlen(password));
+ mysql_sha1_result(&sha1_context, (uint8 *) to);
/* stage 2: hash stage1 output */
- sha1_reset(&sha1_context);
- sha1_input(&sha1_context, (uint8 *) to, SHA1_HASH_SIZE);
+ mysql_sha1_reset(&sha1_context);
+ mysql_sha1_input(&sha1_context, (uint8 *) to, SHA1_HASH_SIZE);
/* separate buffer is used to pass 'to' in octet2hex */
- sha1_result(&sha1_context, hash_stage2);
+ mysql_sha1_result(&sha1_context, hash_stage2);
/* convert hash_stage2 to hex string */
*to++= PVERSION41_CHAR;
octet2hex(to, hash_stage2, SHA1_HASH_SIZE);
@@ -431,20 +431,20 @@ scramble(char *to, const char *message, const char *password)
uint8 hash_stage1[SHA1_HASH_SIZE];
uint8 hash_stage2[SHA1_HASH_SIZE];
- sha1_reset(&sha1_context);
+ mysql_sha1_reset(&sha1_context);
/* stage 1: hash password */
- sha1_input(&sha1_context, (uint8 *) password, strlen(password));
- sha1_result(&sha1_context, hash_stage1);
+ mysql_sha1_input(&sha1_context, (uint8 *) password, strlen(password));
+ mysql_sha1_result(&sha1_context, hash_stage1);
/* stage 2: hash stage 1; note that hash_stage2 is stored in the database */
- sha1_reset(&sha1_context);
- sha1_input(&sha1_context, hash_stage1, SHA1_HASH_SIZE);
- sha1_result(&sha1_context, hash_stage2);
+ mysql_sha1_reset(&sha1_context);
+ mysql_sha1_input(&sha1_context, hash_stage1, SHA1_HASH_SIZE);
+ mysql_sha1_result(&sha1_context, hash_stage2);
/* create crypt string as sha1(message, hash_stage2) */;
- sha1_reset(&sha1_context);
- sha1_input(&sha1_context, (const uint8 *) message, SCRAMBLE_LENGTH);
- sha1_input(&sha1_context, hash_stage2, SHA1_HASH_SIZE);
+ mysql_sha1_reset(&sha1_context);
+ mysql_sha1_input(&sha1_context, (const uint8 *) message, SCRAMBLE_LENGTH);
+ mysql_sha1_input(&sha1_context, hash_stage2, SHA1_HASH_SIZE);
/* xor allows 'from' and 'to' overlap: lets take advantage of it */
- sha1_result(&sha1_context, (uint8 *) to);
+ mysql_sha1_result(&sha1_context, (uint8 *) to);
my_crypt(to, (const uchar *) to, hash_stage1, SCRAMBLE_LENGTH);
}
@@ -477,17 +477,17 @@ check_scramble(const char *scramble, const char *message,
uint8 buf[SHA1_HASH_SIZE];
uint8 hash_stage2_reassured[SHA1_HASH_SIZE];
- sha1_reset(&sha1_context);
+ mysql_sha1_reset(&sha1_context);
/* create key to encrypt scramble */
- sha1_input(&sha1_context, (const uint8 *) message, SCRAMBLE_LENGTH);
- sha1_input(&sha1_context, hash_stage2, SHA1_HASH_SIZE);
- sha1_result(&sha1_context, buf);
+ mysql_sha1_input(&sha1_context, (const uint8 *) message, SCRAMBLE_LENGTH);
+ mysql_sha1_input(&sha1_context, hash_stage2, SHA1_HASH_SIZE);
+ mysql_sha1_result(&sha1_context, buf);
/* encrypt scramble */
my_crypt((char *) buf, buf, (const uchar *) scramble, SCRAMBLE_LENGTH);
/* now buf supposedly contains hash_stage1: so we can get hash_stage2 */
- sha1_reset(&sha1_context);
- sha1_input(&sha1_context, buf, SHA1_HASH_SIZE);
- sha1_result(&sha1_context, hash_stage2_reassured);
+ mysql_sha1_reset(&sha1_context);
+ mysql_sha1_input(&sha1_context, buf, SHA1_HASH_SIZE);
+ mysql_sha1_result(&sha1_context, hash_stage2_reassured);
return memcmp(hash_stage2, hash_stage2_reassured, SHA1_HASH_SIZE);
}