
Go to the source code of this file.
Defines | |
| #define | MD5_PASSWD_LEN 35 |
| #define | isMD5(passwd) |
Functions | |
| bool | pg_md5_hash (const void *buff, size_t len, char *hexsum) |
| bool | pg_md5_binary (const void *buff, size_t len, void *outbuf) |
| bool | pg_md5_encrypt (const char *passwd, const char *salt, size_t salt_len, char *buf) |
| #define isMD5 | ( | passwd | ) |
(strncmp(passwd, "md5", 3) == 0 && \
strlen(passwd) == MD5_PASSWD_LEN)
Definition at line 21 of file md5.h.
Referenced by AlterRole(), CreateRole(), md5_crypt_verify(), and RenameRole().
| #define MD5_PASSWD_LEN 35 |
Definition at line 19 of file md5.h.
Referenced by AlterRole(), check_password(), CreateRole(), md5_crypt_verify(), pg_password_sendauth(), and PQencryptPassword().
| bool pg_md5_binary | ( | const void * | buff, | |
| size_t | len, | |||
| void * | outbuf | |||
| ) |
Definition at line 302 of file md5.c.
References calculateDigestFromBuffer().
Referenced by CheckRADIUSAuth().
{
if (!calculateDigestFromBuffer(buff, len, outbuf))
return false;
return true;
}
| bool pg_md5_encrypt | ( | const char * | passwd, | |
| const char * | salt, | |||
| size_t | salt_len, | |||
| char * | buf | |||
| ) |
Definition at line 320 of file md5.c.
References free, malloc, and pg_md5_hash().
Referenced by AlterRole(), check_password(), CreateRole(), md5_crypt_verify(), pg_password_sendauth(), and PQencryptPassword().
{
size_t passwd_len = strlen(passwd);
/* +1 here is just to avoid risk of unportable malloc(0) */
char *crypt_buf = malloc(passwd_len + salt_len + 1);
bool ret;
if (!crypt_buf)
return false;
/*
* Place salt at the end because it may be known by users trying to crack
* the MD5 output.
*/
memcpy(crypt_buf, passwd, passwd_len);
memcpy(crypt_buf + passwd_len, salt, salt_len);
strcpy(buf, "md5");
ret = pg_md5_hash(crypt_buf, passwd_len + salt_len, buf + 3);
free(crypt_buf);
return ret;
}
| bool pg_md5_hash | ( | const void * | buff, | |
| size_t | len, | |||
| char * | hexsum | |||
| ) |
Definition at line 290 of file md5.c.
References bytesToHex(), and calculateDigestFromBuffer().
Referenced by md5_bytea(), md5_text(), and pg_md5_encrypt().
{
uint8 sum[16];
if (!calculateDigestFromBuffer(buff, len, sum))
return false;
bytesToHex(sum, hexsum);
return true;
}
1.7.1