diff options
author | Bodo Möller <bodo@openssl.org> | 2002-09-02 09:08:33 +0200 |
---|---|---|
committer | Bodo Möller <bodo@openssl.org> | 2002-09-02 09:08:33 +0200 |
commit | 65b1d31df53fecefbf53dedd8fc4f9f64a62a92b (patch) | |
tree | bffd3682c63f03629053759a61870a0e238ed46e /apps/ecparam.c | |
parent | Fix ASN1_STRING_to_UTF8: remove non sensical !*out test. (diff) | |
download | openssl-65b1d31df53fecefbf53dedd8fc4f9f64a62a92b.tar.xz openssl-65b1d31df53fecefbf53dedd8fc4f9f64a62a92b.zip |
change API for looking at the internal curve list
Submitted by: Nils Larsch
Diffstat (limited to 'apps/ecparam.c')
-rw-r--r-- | apps/ecparam.c | 31 |
1 files changed, 23 insertions, 8 deletions
diff --git a/apps/ecparam.c b/apps/ecparam.c index e0a56062d3..71ae9e7d9b 100644 --- a/apps/ecparam.c +++ b/apps/ecparam.c @@ -352,19 +352,33 @@ bad: if (list_curves) { - int counter=0; + EC_builtin_curve *curves = NULL; + size_t crv_len = 0; + size_t n = 0; + size_t len; - for (;;) + crv_len = EC_get_builtin_curves(NULL, 0); + + curves = OPENSSL_malloc(sizeof(EC_builtin_curve) * crv_len); + + if (curves == NULL) + goto end; + + if (!EC_get_builtin_curves(curves, crv_len)) + { + OPENSSL_free(curves); + goto end; + } + + + for (n = 0; n < crv_len; n++) { const char *comment; const char *sname; - int len, nid = ec_group_index2nid(counter++); - if (!nid) - break; - comment = EC_GROUP_get0_comment(nid); - sname = OBJ_nid2sn(nid); + comment = curves[n].comment; + sname = OBJ_nid2sn(curves[n].nid); if (comment == NULL) - comment = ""; + comment = "CURVE DESCRIPTION NOT AVAILABLE"; if (sname == NULL) sname = ""; @@ -375,6 +389,7 @@ bad: BIO_printf(out, "%s\n", comment); } + OPENSSL_free(curves); ret = 0; goto end; } |