summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@redhat.com>2017-11-08 11:45:25 +0100
committerNikos Mavrogiannopoulos <nmav@gnutls.org>2017-11-19 15:44:46 +0000
commit38f554a0e5113f2870fdd21395a1401d9acbc5ad (patch)
tree6d5f4c689c730bdba5bc3c6ff0be648204e75cd2
parent14d51f92b62dbd5647c80dbc1a69283e2cbd35f9 (diff)
downloadgnutls-38f554a0e5113f2870fdd21395a1401d9acbc5ad.tar.gz
session state: combined srp and dh prime bits variables
They were being used for the same purpose, and SRP as well as DH, do not overlap to require two different variables. Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
-rw-r--r--lib/auth/srp_kx.c4
-rw-r--r--lib/gnutls_int.h12
-rw-r--r--lib/srp.c2
3 files changed, 9 insertions, 9 deletions
diff --git a/lib/auth/srp_kx.c b/lib/auth/srp_kx.c
index 896afe4e62..33f8d04432 100644
--- a/lib/auth/srp_kx.c
+++ b/lib/auth/srp_kx.c
@@ -720,8 +720,8 @@ group_check_g_n(gnutls_session_t session, bigint_t g, bigint_t n)
bigint_t q = NULL, two = NULL, w = NULL;
int ret;
- if (_gnutls_mpi_get_nbits(n) < (session->internals.srp_prime_bits
- ? session->internals.srp_prime_bits
+ if (_gnutls_mpi_get_nbits(n) < (session->internals.dh_prime_bits
+ ? session->internals.dh_prime_bits
: 2048)) {
gnutls_assert();
return GNUTLS_E_RECEIVED_ILLEGAL_PARAMETER;
diff --git a/lib/gnutls_int.h b/lib/gnutls_int.h
index af919ec3ed..64aa159efc 100644
--- a/lib/gnutls_int.h
+++ b/lib/gnutls_int.h
@@ -945,8 +945,13 @@ typedef struct {
bool allow_key_usage_violation;
bool allow_wrong_pms;
bool dumbfw;
- unsigned int dh_prime_bits; /* old (deprecated) variable */
+ /* old (deprecated) variable. This is used for both srp_prime_bits
+ * and dh_prime_bits as they don't overlap */
+ /* For SRP: minimum bits to allow for SRP
+ * use gnutls_srp_set_prime_bits() to adjust it.
+ */
+ uint16_t dh_prime_bits; /* srp_prime_bits */
/* resumed session */
bool resumed; /* RESUME_TRUE or FALSE - if we are resuming a session */
@@ -1075,11 +1080,6 @@ typedef struct {
*/
int errnum;
- /* minimum bits to allow for SRP
- * use gnutls_srp_set_prime_bits() to adjust it.
- */
- uint16_t srp_prime_bits;
-
/* A handshake process has been completed */
bool initial_negotiation_completed;
diff --git a/lib/srp.c b/lib/srp.c
index eb4b8361d9..c3eb8e6847 100644
--- a/lib/srp.c
+++ b/lib/srp.c
@@ -800,7 +800,7 @@ gnutls_srp_verifier(const char *username, const char *password,
**/
void gnutls_srp_set_prime_bits(gnutls_session_t session, unsigned int bits)
{
- session->internals.srp_prime_bits = bits;
+ session->internals.dh_prime_bits = bits;
}
/**