diff options
author | Nikos Mavrogiannopoulos <nmav@gnutls.org> | 2017-11-21 19:17:01 +0100 |
---|---|---|
committer | Nikos Mavrogiannopoulos <nmav@gnutls.org> | 2017-11-21 20:20:30 +0100 |
commit | 31d6be8cdc7613658b240619036ca7fa3709fc81 (patch) | |
tree | 6c9337aab759a5da0bce48aedba672123adf1e80 | |
parent | ee1c87584d9b36ae6ea2f5e4af511cc275b3f37a (diff) | |
download | gnutls-31d6be8cdc7613658b240619036ca7fa3709fc81.tar.gz |
srptool: --create-conf no longer includes 1024-bit parameters
In addition it includes the 8192-bit parameters, and
the default params used for a new user are the 2k ones.
Signed-off-by: Nikos Mavrogiannopoulos <nmav@gnutls.org>
-rw-r--r-- | src/srptool-args.def | 2 | ||||
-rw-r--r-- | src/srptool.c | 23 |
2 files changed, 15 insertions, 10 deletions
diff --git a/src/srptool-args.def b/src/srptool-args.def index c6fdd714d9..67e3a8c9d2 100644 --- a/src/srptool-args.def +++ b/src/srptool-args.def @@ -19,7 +19,7 @@ flag = { name = index; value = i; arg-type = number; - arg-default = 1; + arg-default = 3; descrip = "specify the index of the group parameters in tpasswd.conf to use"; doc = ""; }; diff --git a/src/srptool.c b/src/srptool.c index b48319301c..c411d47324 100644 --- a/src/srptool.c +++ b/src/srptool.c @@ -76,7 +76,7 @@ static int generate_create_conf(const char *tpasswd_conf) { FILE *fd; char line[5 * 1024]; - int index = 1; + int index = 1, srp_idx; gnutls_datum_t g, n; gnutls_datum_t str_g, str_n; @@ -89,26 +89,31 @@ static int generate_create_conf(const char *tpasswd_conf) for (index = 1; index <= 5; index++) { if (index == 1) { - n = gnutls_srp_1024_group_prime; - g = gnutls_srp_1024_group_generator; - } else if (index == 2) { + srp_idx = 2; n = gnutls_srp_1536_group_prime; g = gnutls_srp_1536_group_generator; - } else if (index == 3) { + } else if (index == 2) { + srp_idx = 3; n = gnutls_srp_2048_group_prime; g = gnutls_srp_2048_group_generator; - } else if (index == 4) { + } else if (index == 3) { + srp_idx = 4; n = gnutls_srp_3072_group_prime; g = gnutls_srp_3072_group_generator; - } else if (index == 5) { + } else if (index == 4) { + srp_idx = 5; n = gnutls_srp_4096_group_prime; g = gnutls_srp_4096_group_generator; + } else if (index == 5) { + srp_idx = 7; + n = gnutls_srp_8192_group_prime; + g = gnutls_srp_8192_group_generator; } else { fprintf(stderr, "Unknown index: %d\n", index); return -1; } - printf("\nGroup %d, of %d bits:\n", index, n.size * 8); + printf("\nGroup %d, of %d bits:\n", srp_idx, n.size * 8); print_num("Generator", &g); print_num("Prime", &n); @@ -124,7 +129,7 @@ static int generate_create_conf(const char *tpasswd_conf) return -1; } - sprintf(line, "%d:%s:%s\n", index, str_n.data, str_g.data); + sprintf(line, "%d:%s:%s\n", srp_idx, str_n.data, str_g.data); gnutls_free(str_n.data); gnutls_free(str_g.data); |