summaryrefslogtreecommitdiff
path: root/src/crypt.c
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@gnutls.org>2002-08-28 14:08:32 +0000
committerNikos Mavrogiannopoulos <nmav@gnutls.org>2002-08-28 14:08:32 +0000
commit7d5104e60f8b854577b81bb392b037f65e58b9b1 (patch)
tree0033047448a78a693d0b84dc9fd0f0741d5e771e /src/crypt.c
parentc75750a9866b32e34ae744aa47918ef704c35806 (diff)
downloadgnutls-7d5104e60f8b854577b81bb392b037f65e58b9b1.tar.gz
Added support for the new SRP draft by D. Taylor. This includes the
removal of the blowfish crypt hash option, and the change of SRP cipher suite numbers.
Diffstat (limited to 'src/crypt.c')
-rw-r--r--src/crypt.c32
1 files changed, 8 insertions, 24 deletions
diff --git a/src/crypt.c b/src/crypt.c
index 8b1a76d295..9c8d31e91e 100644
--- a/src/crypt.c
+++ b/src/crypt.c
@@ -39,7 +39,7 @@
* are in the library, which is not good.
*/
-int crypt_int(char *username, char *passwd, int crypt, int salt,
+int crypt_int(char *username, char *passwd, int salt,
char *tpasswd_conf, char *tpasswd, int uindex);
static int read_conf_values(MPI * g, MPI * n, char *str, int str_size);
static int _verify_passwd_int(char* username, char* passwd, char* salt, MPI g, MPI n);
@@ -72,7 +72,7 @@ int generate_create_conf(char *tpasswd_conf, int bits)
static int _verify_passwd_int(char* username, char* passwd, char* salt, MPI g, MPI n) {
if (salt==NULL) return -1;
- if (gnutls_crypt_vrfy
+ if (_gnutls_srp_crypt_vrfy
(username, passwd, salt, g, n) == 0) {
fprintf(stderr, "Password verified\n");
return 0;
@@ -225,7 +225,7 @@ int main(int argc, char **argv)
{
gaainfo info;
char *passwd;
- int crypt, salt;
+ int salt;
struct passwd *pwd;
if (gaa(argc, argv, &info) != -1) {
@@ -255,23 +255,7 @@ int main(int argc, char **argv)
info.username = pwd->pw_name;
}
- if (info.crypt == NULL) {
- crypt = SRPSHA1_CRYPT;
- salt = 16;
- } else {
- if (strcasecmp(info.crypt, "bcrypt") == 0) {
- crypt = BLOWFISH_CRYPT;
- if (salt == 0)
- salt = 6; /* cost is 6 */
- } else if (strcasecmp(info.crypt, "srpsha") == 0) {
- crypt = SRPSHA1_CRYPT;
- if (salt == 0)
- salt = 10; /* 10 bytes salt */
- } else {
- fprintf(stderr, "Unknown algorithm\n");
- return -1;
- }
- }
+ salt = 16;
passwd = getpass("Enter password: ");
@@ -282,12 +266,12 @@ int main(int argc, char **argv)
}
- return crypt_int(info.username, passwd, crypt, salt,
+ return crypt_int(info.username, passwd, salt,
info.passwd_conf, info.passwd, info.index);
}
-int crypt_int(char *username, char *passwd, int crypt, int salt,
+int crypt_int(char *username, char *passwd, int salt,
char *tpasswd_conf, char *tpasswd, int uindex)
{
FILE *fd;
@@ -322,9 +306,9 @@ int crypt_int(char *username, char *passwd, int crypt, int salt,
return -1;
}
- cr = gnutls_crypt(username, passwd, crypt, salt, g, n);
+ cr = _gnutls_srp_crypt(username, passwd, salt, g, n);
if (cr == NULL) {
- fprintf(stderr, "Cannot gnutls_crypt()...\n");
+ fprintf(stderr, "Cannot _gnutls_srp_crypt()...\n");
return -1;
} else {
/* delete previous entry */