diff options
author | Nikos Mavrogiannopoulos <nmav@gnutls.org> | 2001-05-13 10:05:15 +0000 |
---|---|---|
committer | Nikos Mavrogiannopoulos <nmav@gnutls.org> | 2001-05-13 10:05:15 +0000 |
commit | ca8216a4c11f23541e04ec8b701cd125ec8ff2a6 (patch) | |
tree | d1c408c36ab1b065cb6f793e044394ac89c5e343 /lib/crypt.c | |
parent | f9fa0b94d5901f336c5ec5d76893c675d859033c (diff) | |
download | gnutls-ca8216a4c11f23541e04ec8b701cd125ec8ff2a6.tar.gz |
Added compatibility with Tom Wu's libsrp's password files.
Diffstat (limited to 'lib/crypt.c')
-rw-r--r-- | lib/crypt.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/lib/crypt.c b/lib/crypt.c index c14b0c54c9..e6e9776d12 100644 --- a/lib/crypt.c +++ b/lib/crypt.c @@ -24,34 +24,34 @@ #include "crypt_srpsha1.h" #include "gnutls_random.h" -char * gnutls_crypt(const char* username, const char *passwd, crypt_algo algo, int salt) { +char * gnutls_crypt(const char* username, const char *passwd, crypt_algo algo, int salt, MPI g, MPI n) { switch(algo) { case BLOWFISH_CRYPT: /* bcrypt */ /* salt in bcrypt is actually the cost */ - return crypt_bcrypt_wrapper(passwd, salt); + return crypt_bcrypt_wrapper(passwd, salt, g, n); case SRPSHA1_CRYPT: /* bcrypt */ /* salt in bcrypt is the salt size */ - return crypt_srpsha1_wrapper(username, passwd, salt); + return crypt_srpsha1_wrapper(username, passwd, salt, g, n); } return NULL; } -int gnutls_crypt_vrfy(const char* username, const char *passwd, char* salt) { +int gnutls_crypt_vrfy(const char* username, const char *passwd, char* salt, MPI g, MPI n) { char* cr; - + switch(salt[0]) { case '$': switch(salt[1]) { case '2': - cr = crypt_bcrypt(passwd, salt); - if (strncmp(cr, salt, strlen(cr))==0) return 0; - break; - case '4': - cr = crypt_srpsha1(username, passwd, salt); + cr = crypt_bcrypt(passwd, salt, g, n); if (strncmp(cr, salt, strlen(cr))==0) return 0; break; } + default: + cr = crypt_srpsha1(username, passwd, salt, g, n); + if (strncmp(cr, salt, strlen(cr))==0) return 0; + break; } return 1; } |