diff options
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 |