summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/dsa/dsa_key.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libcrypto/dsa/dsa_key.c')
-rw-r--r--src/lib/libcrypto/dsa/dsa_key.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/lib/libcrypto/dsa/dsa_key.c b/src/lib/libcrypto/dsa/dsa_key.c
index 980b6dc2d3..c4aa86bc6d 100644
--- a/src/lib/libcrypto/dsa/dsa_key.c
+++ b/src/lib/libcrypto/dsa/dsa_key.c
@@ -56,17 +56,25 @@
56 * [including the GNU Public Licence.] 56 * [including the GNU Public Licence.]
57 */ 57 */
58 58
59#ifndef OPENSSL_NO_SHA
60#include <stdio.h> 59#include <stdio.h>
61#include <time.h> 60#include <time.h>
62#include "cryptlib.h" 61#include "cryptlib.h"
62#ifndef OPENSSL_NO_SHA
63#include <openssl/bn.h> 63#include <openssl/bn.h>
64#include <openssl/dsa.h> 64#include <openssl/dsa.h>
65#include <openssl/rand.h> 65#include <openssl/rand.h>
66 66
67#ifndef OPENSSL_FIPS 67static int dsa_builtin_keygen(DSA *dsa);
68
68int DSA_generate_key(DSA *dsa) 69int DSA_generate_key(DSA *dsa)
69 { 70 {
71 if(dsa->meth->dsa_keygen)
72 return dsa->meth->dsa_keygen(dsa);
73 return dsa_builtin_keygen(dsa);
74 }
75
76static int dsa_builtin_keygen(DSA *dsa)
77 {
70 int ok=0; 78 int ok=0;
71 BN_CTX *ctx=NULL; 79 BN_CTX *ctx=NULL;
72 BIGNUM *pub_key=NULL,*priv_key=NULL; 80 BIGNUM *pub_key=NULL,*priv_key=NULL;
@@ -99,7 +107,7 @@ int DSA_generate_key(DSA *dsa)
99 { 107 {
100 BN_init(&local_prk); 108 BN_init(&local_prk);
101 prk = &local_prk; 109 prk = &local_prk;
102 BN_with_flags(prk, priv_key, BN_FLG_EXP_CONSTTIME); 110 BN_with_flags(prk, priv_key, BN_FLG_CONSTTIME);
103 } 111 }
104 else 112 else
105 prk = priv_key; 113 prk = priv_key;
@@ -118,4 +126,3 @@ err:
118 return(ok); 126 return(ok);
119 } 127 }
120#endif 128#endif
121#endif