提交 8c716869 编写于 作者: D Dr. Stephen Henson

Seed PRNG with DSA and ECDSA digests for additional protection against

possible PRNG state duplication.
上级 b5ca7df5
...@@ -60,6 +60,7 @@ ...@@ -60,6 +60,7 @@
#include "cryptlib.h" #include "cryptlib.h"
#include <openssl/dsa.h> #include <openssl/dsa.h>
#include <openssl/rand.h>
DSA_SIG * DSA_do_sign(const unsigned char *dgst, int dlen, DSA *dsa) DSA_SIG * DSA_do_sign(const unsigned char *dgst, int dlen, DSA *dsa)
{ {
...@@ -70,6 +71,7 @@ int DSA_sign(int type, const unsigned char *dgst, int dlen, unsigned char *sig, ...@@ -70,6 +71,7 @@ int DSA_sign(int type, const unsigned char *dgst, int dlen, unsigned char *sig,
unsigned int *siglen, DSA *dsa) unsigned int *siglen, DSA *dsa)
{ {
DSA_SIG *s; DSA_SIG *s;
RAND_seed(dgst, dlen);
s=DSA_do_sign(dgst,dlen,dsa); s=DSA_do_sign(dgst,dlen,dsa);
if (s == NULL) if (s == NULL)
{ {
......
...@@ -57,6 +57,7 @@ ...@@ -57,6 +57,7 @@
#ifndef OPENSSL_NO_ENGINE #ifndef OPENSSL_NO_ENGINE
#include <openssl/engine.h> #include <openssl/engine.h>
#endif #endif
#include <openssl/rand.h>
ECDSA_SIG *ECDSA_do_sign(const unsigned char *dgst, int dlen, EC_KEY *eckey) ECDSA_SIG *ECDSA_do_sign(const unsigned char *dgst, int dlen, EC_KEY *eckey)
{ {
...@@ -83,6 +84,7 @@ int ECDSA_sign_ex(int type, const unsigned char *dgst, int dlen, unsigned char ...@@ -83,6 +84,7 @@ int ECDSA_sign_ex(int type, const unsigned char *dgst, int dlen, unsigned char
EC_KEY *eckey) EC_KEY *eckey)
{ {
ECDSA_SIG *s; ECDSA_SIG *s;
RAND_seed(dgst, dlen);
s = ECDSA_do_sign_ex(dgst, dlen, kinv, r, eckey); s = ECDSA_do_sign_ex(dgst, dlen, kinv, r, eckey);
if (s == NULL) if (s == NULL)
{ {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册