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