diff options
author | Nikos Mavrogiannopoulos <nmav@gnutls.org> | 2003-08-12 12:00:53 +0000 |
---|---|---|
committer | Nikos Mavrogiannopoulos <nmav@gnutls.org> | 2003-08-12 12:00:53 +0000 |
commit | 8e8f0f4acb8f53da6edd6138d72b38d1da3bfcab (patch) | |
tree | 5f5edfce2c9a492608d814c4d90a23695a7c6d5e /lib/rsa_compat.c | |
parent | 337c73cd284f2bfa0015694f6e3da0301e3722b4 (diff) | |
download | gnutls-8e8f0f4acb8f53da6edd6138d72b38d1da3bfcab.tar.gz |
more fixes by Arne.
Diffstat (limited to 'lib/rsa_compat.c')
-rw-r--r-- | lib/rsa_compat.c | 34 |
1 files changed, 14 insertions, 20 deletions
diff --git a/lib/rsa_compat.c b/lib/rsa_compat.c index 5539d5e6c8..67e4d10141 100644 --- a/lib/rsa_compat.c +++ b/lib/rsa_compat.c @@ -46,13 +46,13 @@ static int check_bits(int bits) return 0; } -#define FREE_PRIVATE_PARAMS for (i=0;i<RSA_PRIVATE_PARAMS;i++) \ - _gnutls_mpi_release(&rsa_params->params[i]) +#define FREE_PRIVATE_PARAMS for (i=0;i<RSA_PRIVATE_PARAMS;i++) \ + _gnutls_mpi_release(&rsa_params->params[i]); /*- * gnutls_rsa_params_set - This function will replace the old RSA parameters - * @rsa_params: Is a structure will hold the parameters + * @rsa_params: Is a structure which will hold the parameters * @m: holds the modulus * @e: holds the public exponent * @d: holds the private exponent @@ -75,58 +75,52 @@ int gnutls_rsa_params_set(gnutls_rsa_params rsa_params, gnutls_datum d, gnutls_datum p, gnutls_datum q, gnutls_datum u, int bits) { - int i = 0; - size_t siz = 0; + int i; + size_t siz; if (check_bits(bits) < 0) { gnutls_assert(); return GNUTLS_E_INVALID_REQUEST; } - for (i=0;i<RSA_PRIVATE_PARAMS;i++) { - _gnutls_mpi_release(&rsa_params->params[i]); - } + FREE_PRIVATE_PARAMS siz = m.size; if (_gnutls_mpi_scan(&rsa_params->params[0], m.data, &siz)) { gnutls_assert(); - FREE_PRIVATE_PARAMS; + failed: + FREE_PRIVATE_PARAMS return GNUTLS_E_MPI_SCAN_FAILED; } siz = e.size; if (_gnutls_mpi_scan(&rsa_params->params[1], e.data, &siz)) { gnutls_assert(); - FREE_PRIVATE_PARAMS; - return GNUTLS_E_MPI_SCAN_FAILED; + goto failed; } siz = d.size; if (_gnutls_mpi_scan(&rsa_params->params[2], d.data, &siz)) { gnutls_assert(); - FREE_PRIVATE_PARAMS; - return GNUTLS_E_MPI_SCAN_FAILED; + goto failed; } siz = p.size; if (_gnutls_mpi_scan(&rsa_params->params[3], p.data, &siz)) { gnutls_assert(); - FREE_PRIVATE_PARAMS; - return GNUTLS_E_MPI_SCAN_FAILED; + goto failed; } siz = q.size; if (_gnutls_mpi_scan(&rsa_params->params[4], q.data, &siz)) { gnutls_assert(); - FREE_PRIVATE_PARAMS; - return GNUTLS_E_MPI_SCAN_FAILED; + goto failed; } siz = u.size; if (_gnutls_mpi_scan(&rsa_params->params[5], u.data, &siz)) { gnutls_assert(); - FREE_PRIVATE_PARAMS; - return GNUTLS_E_MPI_SCAN_FAILED; + goto failed; } return 0; @@ -155,7 +149,7 @@ int gnutls_rsa_params_set(gnutls_rsa_params rsa_params, * generated RSA parameters. * * Note that the bits value should be 512. - * Also note that the generation of new RSA parameters is only usefull + * Also note that the generation of new RSA parameters is only useful * to servers. Clients use the parameters sent by the server, thus it's * no use calling this in client side. * |