From: Nikos Mavrogiannopoulos Date: Thu, 23 Jan 2014 14:40:58 +0000 (+0100) Subject: ensure that _gnutls_pk_params_copy makes a full duplicate. X-Git-Tag: gnutls_3_3_0pre0~291 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=108e3abe0977efef75aa3084fe8be0e7f03419b4;p=thirdparty%2Fgnutls.git ensure that _gnutls_pk_params_copy makes a full duplicate. --- diff --git a/lib/gnutls_pk.c b/lib/gnutls_pk.c index d08103e938..8e7a5702cb 100644 --- a/lib/gnutls_pk.c +++ b/lib/gnutls_pk.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001-2013 Free Software Foundation, Inc. + * Copyright (C) 2001-2014 Free Software Foundation, Inc. * * Author: Nikos Mavrogiannopoulos * @@ -174,6 +174,9 @@ int _gnutls_pk_params_copy(gnutls_pk_params_st * dst, return GNUTLS_E_INVALID_REQUEST; } + dst->flags = src->flags; + dst->algo = src->algo; + for (i = 0; i < src->params_nr; i++) { dst->params[i] = _gnutls_mpi_set(NULL, src->params[i]); if (dst->params[i] == NULL) { diff --git a/lib/gnutls_privkey.c b/lib/gnutls_privkey.c index 5f3b35c4d7..8a847cd64e 100644 --- a/lib/gnutls_privkey.c +++ b/lib/gnutls_privkey.c @@ -108,6 +108,8 @@ privkey_to_pubkey(gnutls_pk_algorithm_t pk, int ret; pub->algo = priv->algo; + pub->flags = priv->flags; + switch (pk) { case GNUTLS_PK_RSA: pub->params[0] = _gnutls_mpi_copy(priv->params[0]); @@ -143,7 +145,6 @@ privkey_to_pubkey(gnutls_pk_algorithm_t pk, pub->params[ECC_Y] = _gnutls_mpi_copy(priv->params[ECC_Y]); pub->params_nr = ECC_PUBLIC_PARAMS; - pub->flags = priv->flags; if (pub->params[ECC_X] == NULL || pub->params[ECC_Y] == NULL) {