1 /* LibTomCrypt, modular cryptographic library -- Tom St Denis */
2 /* SPDX-License-Identifier: Unlicense */
3 #include "tomcrypt_private.h"
4
5 /**
6 @file dsa_make_key.c
7 DSA implementation, generate a DSA key
8 */
9
10 #ifdef LTC_MDSA
11
12 /**
13 Old-style creation of a DSA key
14 @param prng An active PRNG state
15 @param wprng The index of the PRNG desired
16 @param group_size Size of the multiplicative group (octets)
17 @param modulus_size Size of the modulus (octets)
18 @param key [out] Where to store the created key
19 @return CRYPT_OK if successful.
20 */
dsa_make_key(prng_state * prng,int wprng,int group_size,int modulus_size,dsa_key * key)21 int dsa_make_key(prng_state *prng, int wprng, int group_size, int modulus_size, dsa_key *key)
22 {
23 int err;
24
25 if ((err = dsa_generate_pqg(prng, wprng, group_size, modulus_size, key)) != CRYPT_OK) { return err; }
26 if ((err = dsa_generate_key(prng, wprng, key)) != CRYPT_OK) { return err; }
27
28 return CRYPT_OK;
29 }
30
31 #endif
32