aboutsummaryrefslogtreecommitdiffstats
path: root/crypto/dsa/dsa_pmeth.c
diff options
context:
space:
mode:
authorDr. Stephen Henson <steve@openssl.org>2006-04-12 11:14:11 +0000
committerDr. Stephen Henson <steve@openssl.org>2006-04-12 11:14:11 +0000
commit75ef718820c44d8eb5efd98425c64b584ce2f5d5 (patch)
tree4029c8caabc08cd7b68ae404eb5aac9fbb58bf4e /crypto/dsa/dsa_pmeth.c
parentc927df3fa19a2afda7bbacefbb366f7382b5269b (diff)
downloadopenssl-75ef718820c44d8eb5efd98425c64b584ce2f5d5.tar.gz
Support for DSA keygen, fix for genpkey.
Diffstat (limited to 'crypto/dsa/dsa_pmeth.c')
-rw-r--r--crypto/dsa/dsa_pmeth.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/crypto/dsa/dsa_pmeth.c b/crypto/dsa/dsa_pmeth.c
index f91d03c208..364ba15a12 100644
--- a/crypto/dsa/dsa_pmeth.c
+++ b/crypto/dsa/dsa_pmeth.c
@@ -200,6 +200,24 @@ static int pkey_dsa_paramgen(EVP_PKEY_CTX *ctx, EVP_PKEY *pkey)
return ret;
}
+static int pkey_dsa_keygen(EVP_PKEY_CTX *ctx, EVP_PKEY *pkey)
+ {
+ DSA *dsa = NULL;
+ if (ctx->pkey == NULL)
+ {
+ DSAerr(DSA_F_PKEY_DSA_KEYGEN, DSA_R_NO_PARAMETERS_SET);
+ return 0;
+ }
+ dsa = DSA_new();
+ if (!dsa)
+ return 0;
+ EVP_PKEY_assign_DSA(pkey, dsa);
+ /* Note: if error return, pkey is freed by parent routine */
+ if (!EVP_PKEY_copy_parameters(pkey, ctx->pkey))
+ return 0;
+ return DSA_generate_key(pkey->pkey.dsa);
+ }
+
const EVP_PKEY_METHOD dsa_pkey_meth =
{
EVP_PKEY_DSA,
@@ -210,7 +228,8 @@ const EVP_PKEY_METHOD dsa_pkey_meth =
0,
pkey_dsa_paramgen,
- 0,0,
+ 0,
+ pkey_dsa_keygen,
0,
pkey_dsa_sign,