Extend EVP_PKEY_copy_parameters()
[openssl.git] / crypto / dsa / dsa_ameth.c
index d1d32c69598a4dae3d9df931c23b1cd335b3ecf7..92976bc3d522a34ea16f22273949c12c078909bd 100644 (file)
@@ -364,6 +364,12 @@ static int dsa_copy_parameters(EVP_PKEY *to, const EVP_PKEY *from)
 {
     BIGNUM *a;
 
+    if (to->pkey.dsa == NULL) {
+        to->pkey.dsa = DSA_new();
+        if (to->pkey.dsa == NULL)
+            return 0;
+    }
+
     if ((a = BN_dup(from->pkey.dsa->p)) == NULL)
         return 0;
     BN_free(to->pkey.dsa->p);