summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@gnutls.org>2003-10-01 14:13:01 +0000
committerNikos Mavrogiannopoulos <nmav@gnutls.org>2003-10-01 14:13:01 +0000
commit76ddf1c658833618343a94aff44034514ad2f01c (patch)
treed93a2e4c040b64610f7071d8d485be3893108a7e
parent33ceb2a2aa62c800db2869a677c9c27d189f4a24 (diff)
downloadgnutls-76ddf1c658833618343a94aff44034514ad2f01c.tar.gz
Corrected a bug in the SRP U calculation. Reported by
Casey Marshall <rsdio@metastatic.org>.
-rw-r--r--libextra/gnutls_srp.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/libextra/gnutls_srp.c b/libextra/gnutls_srp.c
index 9781201bc6..4f84c362b1 100644
--- a/libextra/gnutls_srp.c
+++ b/libextra/gnutls_srp.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2001 Nikos Mavroyanopoulos
+ * Copyright (C) 2001,2003 Nikos Mavroyanopoulos
*
* This file is part of GNUTLS.
*
@@ -137,7 +137,7 @@ GNUTLS_MPI _gnutls_calc_srp_u(GNUTLS_MPI A, GNUTLS_MPI B)
{
size_t b_size, a_size;
opaque *holder, hd[MAX_HASH_SIZE];
- size_t holder_size;
+ size_t holder_size, hash_size;
GNUTLS_HASH_HANDLE td;
int ret;
GNUTLS_MPI res;
@@ -161,10 +161,11 @@ GNUTLS_MPI _gnutls_calc_srp_u(GNUTLS_MPI A, GNUTLS_MPI B)
}
_gnutls_hash(td, holder, holder_size);
_gnutls_hash_deinit(td, hd);
-
- /* convert the first 4 bytes of hd to uint32
+
+ /* convert the bytes of hd to integer
*/
- ret = _gnutls_mpi_scan( &res, holder, &holder_size);
+ hash_size = 20; /* SHA */
+ ret = _gnutls_mpi_scan( &res, hd, &hash_size);
gnutls_afree(holder);
if (ret < 0) {