summaryrefslogtreecommitdiff
path: root/libextra
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@gnutls.org>2002-12-01 20:15:27 +0000
committerNikos Mavrogiannopoulos <nmav@gnutls.org>2002-12-01 20:15:27 +0000
commit3b021f80721304448214a523d743dac979ecb0be (patch)
tree178d314256f38a894bce70542dbfe48974578c89 /libextra
parent904a4f2957f7bc2d3bc20186bc9db9fc760045d4 (diff)
downloadgnutls-3b021f80721304448214a523d743dac979ecb0be.tar.gz
removed all files related to srpsha1 encoding. The are not needed any more.
Diffstat (limited to 'libextra')
-rw-r--r--libextra/Makefile.am6
-rw-r--r--libextra/crypt.c45
-rw-r--r--libextra/crypt.h4
-rw-r--r--libextra/crypt_srpsha1.c180
-rw-r--r--libextra/crypt_srpsha1.h3
5 files changed, 3 insertions, 235 deletions
diff --git a/libextra/Makefile.am b/libextra/Makefile.am
index 6caf8869f4..6f5099bd65 100644
--- a/libextra/Makefile.am
+++ b/libextra/Makefile.am
@@ -4,8 +4,8 @@ bin_SCRIPTS = libgnutls-extra-config
m4datadir = $(datadir)/aclocal
m4data_DATA = libgnutls-extra.m4
-EXTRA_DIST = ext_srp.h crypt_srpsha1.h gnutls_srp.h \
- auth_srp.h auth_srp_passwd.h crypt.h gnutls_openpgp.h \
+EXTRA_DIST = ext_srp.h gnutls_srp.h \
+ auth_srp.h auth_srp_passwd.h gnutls_openpgp.h \
gnutls-extra-api.tex gnutls_extra.h libgnutls-extra-config.in \
libgnutls-extra.m4 lzoconf.h minilzo.h
@@ -13,7 +13,7 @@ EXTRA_DIST = ext_srp.h crypt_srpsha1.h gnutls_srp.h \
lib_LTLIBRARIES = libgnutls-extra.la
-COBJECTS_EXTRA = crypt.c crypt_srpsha1.c ext_srp.c \
+COBJECTS_EXTRA = ext_srp.c \
gnutls_srp.c auth_srp.c auth_srp_passwd.c auth_srp_sb64.c \
gnutls_openpgp.c gnutls_extra.c gnutls_openssl.c minilzo.c \
auth_srp_rsa.c
diff --git a/libextra/crypt.c b/libextra/crypt.c
deleted file mode 100644
index 48b834c07d..0000000000
--- a/libextra/crypt.c
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Copyright (C) 2000,2001 Nikos Mavroyanopoulos
- *
- * This file is part of GNUTLS.
- *
- * GNUTLS-EXTRA is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * GNUTLS-EXTRA is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
- */
-
-#include "gnutls_int.h"
-
-#ifdef ENABLE_SRP
-
-#include "crypt_srpsha1.h"
-#include "gnutls_random.h"
-#include <crypt.h>
-
-char * _gnutls_srp_crypt(const char* username, const char *passwd, int salt, GNUTLS_MPI g, GNUTLS_MPI n) {
-
- return _gnutls_crypt_srpsha1_wrapper(username, passwd, salt, g, n);
-}
-
-int _gnutls_srp_crypt_vrfy(const char* username, const char *passwd, char* salt, GNUTLS_MPI g, GNUTLS_MPI n)
-{
- char* cr;
-
- cr = _gnutls_crypt_srpsha1(username, passwd, salt, g, n);
- if (cr==NULL) return 1;
- if (strncmp(cr, salt, strlen(cr))==0) return 0;
-
- return 1;
-}
-
-#endif
diff --git a/libextra/crypt.h b/libextra/crypt.h
deleted file mode 100644
index bca949ca0e..0000000000
--- a/libextra/crypt.h
+++ /dev/null
@@ -1,4 +0,0 @@
-/* crypt functions */
-
-char * _gnutls_srp_crypt(const char* username, const char *passwd, int salt, MPI g, MPI n);
-int _gnutls_srp_crypt_vrfy(const char* username, const char *passwd, char* salt, MPI g, MPI n);
diff --git a/libextra/crypt_srpsha1.c b/libextra/crypt_srpsha1.c
deleted file mode 100644
index 884afd82e3..0000000000
--- a/libextra/crypt_srpsha1.c
+++ /dev/null
@@ -1,180 +0,0 @@
-/*
- * Copyright (C) 2001,2002 Nikos Mavroyanopoulos
- *
- * This file is part of GNUTLS.
- *
- * GNUTLS-EXTRA is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * GNUTLS-EXTRA is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
- */
-
-#include "gnutls_int.h"
-
-#ifdef ENABLE_SRP
-
-#include "gnutls_random.h"
-#include "gnutls_hash_int.h"
-#include "auth_srp_passwd.h"
-#include "gnutls_srp.h"
-#include <gnutls_errors.h>
-#include <crypt_srpsha1.h>
-
-/*
- * x = SHA(<salt> | SHA(<username> | ":" | <raw password>))
- */
-
-static const char magic[] = "";
-
-/* This function does the actual srpsha1 encoding.
- */
-char *_gnutls_crypt_srpsha1(const char *username, const char *passwd,
- const char *salt, GNUTLS_MPI g, GNUTLS_MPI n)
-{
- unsigned char *sp, *spe, r1[MAX_HASH_SIZE];
- uint salt_size, passwd_len;
- unsigned char *local_salt, *v;
- GNUTLS_HASH_HANDLE h1;
- int vsize, hash_len = _gnutls_hash_get_algo_len(GNUTLS_MAC_SHA);
- opaque *tmp;
- uint8 *rtext, *csalt;
- int tmpsize, rsalt_size;
- size_t len;
-
- salt_size = strlen(salt);
- passwd_len = strlen(passwd); /* we do not want the null */
-
- h1 = _gnutls_hash_init(GNUTLS_MAC_SHA);
- _gnutls_hash(h1, (char *) username, strlen(username));
- _gnutls_hash(h1, ":", 1);
- _gnutls_hash(h1, (char *) passwd, passwd_len);
- _gnutls_hash_deinit(h1, r1);
-
-
- local_salt = gnutls_malloc(salt_size + 1);
- if (local_salt==NULL) {
- gnutls_assert();
- return NULL;
- }
- strcpy((char *) local_salt, salt); /* Flawfinder: ignore */
-
- sp = index( local_salt, ':'); /* move to salt - after verifier */
- if (sp==NULL) {
- gnutls_assert();
- gnutls_free( local_salt);
- return NULL;
- }
- sp++;
-
- spe = rindex(sp, ':');
- if (spe==NULL) { /* parse error */
- len = strlen(sp);
- } else
- len = (ptrdiff_t)spe - (ptrdiff_t)sp;
-
- rsalt_size = _gnutls_sbase64_decode(sp, len, &csalt);
- if (rsalt_size < 0) {
- gnutls_assert();
- gnutls_free(local_salt);
- return NULL;
- }
-
- h1 = _gnutls_hash_init(GNUTLS_MAC_SHA);
- if (h1==NULL) {
- gnutls_assert();
- gnutls_free(local_salt);
- return NULL;
- }
- _gnutls_hash(h1, csalt, rsalt_size);
- gnutls_free(csalt);
-
- _gnutls_hash(h1, r1, hash_len);
-
- _gnutls_hash_deinit(h1, r1);
-
- /* v = g^x mod n */
- vsize = _gnutls_srp_gx(r1, hash_len, &v, g, n, gnutls_malloc);
-
- if (vsize == -1 || v == NULL) {
- gnutls_assert();
- gnutls_free(local_salt);
- return NULL;
- }
-
- if (_gnutls_sbase64_encode(v, vsize, &rtext) < 0) {
- gnutls_free(v);
- gnutls_free(local_salt);
- gnutls_assert();
- return NULL;
- }
- gnutls_free(v);
-
- tmpsize = strlen(sp) + strlen(rtext) + strlen(magic) + 1 + 1;
- tmp =
- gnutls_malloc( tmpsize);
- if (tmp==NULL) {
- gnutls_assert();
- gnutls_free(local_salt);
- return NULL;
- }
- sprintf(tmp, "%s%s:%s", magic, rtext, sp); /* Flawfinder: ignore */
-
- gnutls_free(rtext);
- gnutls_free(local_salt);
-
- return tmp;
-}
-
-char *_gnutls_crypt_srpsha1_wrapper(const char *username, const char *pass_new,
- int salt_size, GNUTLS_MPI g, GNUTLS_MPI n)
-{
- unsigned char *result;
- char *tcp;
- opaque *rand;
- char *e = NULL;
- int result_size;
-
- if (salt_size > 50 || salt_size <= 0)
- return NULL; /* wow that's pretty long salt */
-
- rand = gnutls_alloca(salt_size);
- if (rand==NULL || _gnutls_get_random(rand, salt_size, GNUTLS_WEAK_RANDOM) < 0) {
- gnutls_assert();
- return NULL;
- }
-
- result_size = _gnutls_sbase64_encode(rand, salt_size, &result);
- if (result_size < 0) {
- gnutls_afree(rand);
- gnutls_assert();
- return NULL;
- }
-
- tcp = gnutls_calloc(1, 1+ result_size + 1);
- if (tcp==NULL) {
- gnutls_assert();
- gnutls_afree(rand);
- return NULL;
- }
- sprintf(tcp, ":%s", result); /* Flawfinder: ignore */
-
- gnutls_free(result);
- gnutls_afree(rand);
- /* no longer need cleartext */
-
- e = _gnutls_crypt_srpsha1(username, pass_new, (const char *) tcp, g, n);
- gnutls_free(tcp);
-
- return e;
-}
-
-#endif
diff --git a/libextra/crypt_srpsha1.h b/libextra/crypt_srpsha1.h
deleted file mode 100644
index c348b2b734..0000000000
--- a/libextra/crypt_srpsha1.h
+++ /dev/null
@@ -1,3 +0,0 @@
-char *_gnutls_crypt_srpsha1_wrapper(const char* username, const char *pass_new, int salt, MPI g, MPI n);
-char *_gnutls_crypt_srpsha1(const char *username, const char *passwd,
- const char *salt, GNUTLS_MPI g, GNUTLS_MPI n);