diff options
author | Nikos Mavrogiannopoulos <nmav@gnutls.org> | 2004-03-13 09:14:35 +0000 |
---|---|---|
committer | Nikos Mavrogiannopoulos <nmav@gnutls.org> | 2004-03-13 09:14:35 +0000 |
commit | 5e78e8f167091a9699247469232e9f67faf2d8a0 (patch) | |
tree | bf70a622469f811054a912a4c5af167b8dd467cf /lib/gnutls_dh_primes.c | |
parent | 35bd405689b5c849b5f34c976ff7d1090b6a07f4 (diff) | |
download | gnutls-5e78e8f167091a9699247469232e9f67faf2d8a0.tar.gz |
* Added functions gnutls_rsa_params_cpy(), gnutls_dh_params_cpy()
and gnutls_x509_privkey_cpy().
Diffstat (limited to 'lib/gnutls_dh_primes.c')
-rw-r--r-- | lib/gnutls_dh_primes.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/lib/gnutls_dh_primes.c b/lib/gnutls_dh_primes.c index 785b0b1fdc..b91a1cae0d 100644 --- a/lib/gnutls_dh_primes.c +++ b/lib/gnutls_dh_primes.c @@ -205,6 +205,30 @@ void gnutls_dh_params_deinit(gnutls_dh_params dh_params) } /** + * gnutls_dh_params_cpy - This function will copy a DH parameters structure + * @dst: Is the destination structure, which should be initialized. + * @src: Is the source structure + * + * This function will copy the DH parameters structure from source + * to destination. + * + **/ +int gnutls_dh_params_cpy(gnutls_dh_params dst, gnutls_dh_params src) +{ + if (src == NULL) + return GNUTLS_E_INVALID_REQUEST; + + dst->params[0] = _gnutls_mpi_copy(src->params[0]); + dst->params[1] = _gnutls_mpi_copy(src->params[1]); + + if (dst->params[0]==NULL || dst->params[1] == NULL) + return GNUTLS_E_MEMORY_ERROR; + + return 0; +} + + +/** * gnutls_dh_params_generate2 - This function will generate new DH parameters * @params: Is the structure that the DH parameters will be stored * @bits: is the prime's number of bits |