1 // SPDX-License-Identifier: BSD-2-Clause
2 /* LibTomCrypt, modular cryptographic library -- Tom St Denis
3  *
4  * LibTomCrypt is a library that provides various cryptographic
5  * algorithms in a highly modular and flexible manner.
6  *
7  * The library is free for all purposes without any express
8  * guarantee it works.
9  */
10 #include "tomcrypt_private.h"
11 
12 /**
13    @file dsa_make_key.c
14    DSA implementation, generate a DSA key
15 */
16 
17 #ifdef LTC_MDSA
18 
19 /**
20   Old-style creation of a DSA key
21   @param prng          An active PRNG state
22   @param wprng         The index of the PRNG desired
23   @param group_size    Size of the multiplicative group (octets)
24   @param modulus_size  Size of the modulus (octets)
25   @param key           [out] Where to store the created key
26   @return CRYPT_OK if successful.
27 */
dsa_make_key(prng_state * prng,int wprng,int group_size,int modulus_size,dsa_key * key)28 int dsa_make_key(prng_state *prng, int wprng, int group_size, int modulus_size, dsa_key *key)
29 {
30   int err;
31 
32   if ((err = dsa_generate_pqg(prng, wprng, group_size, modulus_size, key)) != CRYPT_OK) { return err; }
33   if ((err = dsa_generate_key(prng, wprng, key)) != CRYPT_OK) { return err; }
34 
35   return CRYPT_OK;
36 }
37 
38 #endif
39 
40 /* ref:         $Format:%D$ */
41 /* git commit:  $Format:%H$ */
42 /* commit time: $Format:%ai$ */
43