]> git.ipfire.org Git - thirdparty/gnutls.git/commitdiff
ensure that _gnutls_pk_params_copy makes a full duplicate.
authorNikos Mavrogiannopoulos <nmav@redhat.com>
Thu, 23 Jan 2014 14:40:58 +0000 (15:40 +0100)
committerNikos Mavrogiannopoulos <nmav@redhat.com>
Thu, 23 Jan 2014 14:40:58 +0000 (15:40 +0100)
lib/gnutls_pk.c
lib/gnutls_privkey.c

index d08103e9382778c385cd9cf612671a92010bf9bc..8e7a5702cbf5322d54d92800b328b85344a8bad1 100644 (file)
@@ -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) {
index 5f3b35c4d78dcb8a28520d9e2c91790c6f04c5c1..8a847cd64edfb8940cca5bac4ed85ae940520159 100644 (file)
@@ -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) {