diff options
author | Dr. Stephen Henson <steve@openssl.org> | 2011-08-27 12:30:47 +0000 |
---|---|---|
committer | Dr. Stephen Henson <steve@openssl.org> | 2011-08-27 12:30:47 +0000 |
commit | 2abaa9caafa0a7c2b380c614d343a1b52d74e5d1 (patch) | |
tree | deacf28f1b84bdc413c88e6fdd1d69a0718b12c7 /crypto/dsa | |
parent | f55f5f775e69f853e8753aff94ee621ba14af40c (diff) |
Add support for DSA2 PQG generation of g parameter.
Diffstat (limited to 'crypto/dsa')
-rw-r--r-- | crypto/dsa/dsa_gen.c | 29 |
1 files changed, 17 insertions, 12 deletions
diff --git a/crypto/dsa/dsa_gen.c b/crypto/dsa/dsa_gen.c index 2a92d069cf..e88b3fcf7c 100644 --- a/crypto/dsa/dsa_gen.c +++ b/crypto/dsa/dsa_gen.c @@ -494,22 +494,26 @@ int dsa_builtin_paramgen2(DSA *ret, size_t L, size_t N, } mdsize = M_EVP_MD_size(evpmd); + /* If unverificable g generation only don't need seed */ + if (!ret->p || !ret->q || idx >= 0) + { + if (seed_len == 0) + seed_len = mdsize; - if (seed_len == 0) - seed_len = mdsize; + seed = OPENSSL_malloc(seed_len); - seed = OPENSSL_malloc(seed_len); + if (seed_out) + seed_tmp = seed_out; + else + seed_tmp = OPENSSL_malloc(seed_len); - if (seed_out) - seed_tmp = seed_out; - else - seed_tmp = OPENSSL_malloc(seed_len); + if (!seed || !seed_tmp) + goto err; - if (!seed || !seed_tmp) - goto err; + if (seed_in) + memcpy(seed, seed_in, seed_len); - if (seed_in) - memcpy(seed, seed_in, seed_len); + } if ((ctx=BN_CTX_new()) == NULL) goto err; @@ -530,7 +534,8 @@ int dsa_builtin_paramgen2(DSA *ret, size_t L, size_t N, { p = ret->p; q = ret->q; - memcpy(seed_tmp, seed, seed_len); + if (idx >= 0) + memcpy(seed_tmp, seed, seed_len); goto g_only; } else |