projects
/
oweals
/
openssl.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Update DTLS code to match CBC decoding in TLS.
[oweals/openssl.git]
/
crypto
/
dsa
/
dsa_key.c
diff --git
a/crypto/dsa/dsa_key.c
b/crypto/dsa/dsa_key.c
index ef87c3e6372e6cf1eb631498c428bedc86e25243..5e3912423014caf37ed9912f1c55886920bd8ca5 100644
(file)
--- a/
crypto/dsa/dsa_key.c
+++ b/
crypto/dsa/dsa_key.c
@@
-56,15
+56,26
@@
* [including the GNU Public Licence.]
*/
* [including the GNU Public Licence.]
*/
-#ifndef OPENSSL_NO_SHA
#include <stdio.h>
#include <time.h>
#include "cryptlib.h"
#include <stdio.h>
#include <time.h>
#include "cryptlib.h"
+#ifndef OPENSSL_NO_SHA
#include <openssl/bn.h>
#include <openssl/dsa.h>
#include <openssl/rand.h>
#include <openssl/bn.h>
#include <openssl/dsa.h>
#include <openssl/rand.h>
+#ifndef OPENSSL_FIPS
+
+static int dsa_builtin_keygen(DSA *dsa);
+
int DSA_generate_key(DSA *dsa)
int DSA_generate_key(DSA *dsa)
+ {
+ if(dsa->meth->dsa_keygen)
+ return dsa->meth->dsa_keygen(dsa);
+ return dsa_builtin_keygen(dsa);
+ }
+
+static int dsa_builtin_keygen(DSA *dsa)
{
int ok=0;
BN_CTX *ctx=NULL;
{
int ok=0;
BN_CTX *ctx=NULL;
@@
-89,8
+100,22
@@
int DSA_generate_key(DSA *dsa)
}
else
pub_key=dsa->pub_key;
}
else
pub_key=dsa->pub_key;
+
+ {
+ BIGNUM local_prk;
+ BIGNUM *prk;
+
+ if ((dsa->flags & DSA_FLAG_NO_EXP_CONSTTIME) == 0)
+ {
+ BN_init(&local_prk);
+ prk = &local_prk;
+ BN_with_flags(prk, priv_key, BN_FLG_CONSTTIME);
+ }
+ else
+ prk = priv_key;
- if (!BN_mod_exp(pub_key,dsa->g,priv_key,dsa->p,ctx)) goto err;
+ if (!BN_mod_exp(pub_key,dsa->g,prk,dsa->p,ctx)) goto err;
+ }
dsa->priv_key=priv_key;
dsa->pub_key=pub_key;
dsa->priv_key=priv_key;
dsa->pub_key=pub_key;
@@
-103,3
+128,5
@@
err:
return(ok);
}
#endif
return(ok);
}
#endif
+
+#endif