projects
/
oweals
/
openssl.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Make update: delete duplicate error code.
[oweals/openssl.git]
/
crypto
/
rand
/
md_rand.c
diff --git
a/crypto/rand/md_rand.c
b/crypto/rand/md_rand.c
index 66b229c9b9cc5f73c461985577ce912d2edf39a7..0f8dd3e00faf3d8afcfc11944577ea579af08d67 100644
(file)
--- a/
crypto/rand/md_rand.c
+++ b/
crypto/rand/md_rand.c
@@
-126,6
+126,10
@@
#include <openssl/crypto.h>
#include <openssl/err.h>
#include <openssl/crypto.h>
#include <openssl/err.h>
+#ifdef OPENSSL_FIPS
+#include <openssl/fips.h>
+#endif
+
#ifdef BN_DEBUG
# define PREDICT
#ifdef BN_DEBUG
# define PREDICT
@@
-152,7
+156,7
@@
static unsigned long locking_thread = 0; /* valid iff crypto_lock_rand is set */
int rand_predictable=0;
#endif
int rand_predictable=0;
#endif
-const char
*RAND_version
="RAND" OPENSSL_VERSION_PTEXT;
+const char
RAND_version[]
="RAND" OPENSSL_VERSION_PTEXT;
static void ssleay_rand_cleanup(void);
static void ssleay_rand_seed(const void *buf, int num);
static void ssleay_rand_cleanup(void);
static void ssleay_rand_seed(const void *buf, int num);
@@
-315,7
+319,7
@@
static void ssleay_rand_add(const void *buf, int num, double add)
static void ssleay_rand_seed(const void *buf, int num)
{
static void ssleay_rand_seed(const void *buf, int num)
{
- ssleay_rand_add(buf, num, num);
+ ssleay_rand_add(buf, num,
(double)
num);
}
static int ssleay_rand_bytes(unsigned char *buf, int num)
}
static int ssleay_rand_bytes(unsigned char *buf, int num)
@@
-332,6
+336,14
@@
static int ssleay_rand_bytes(unsigned char *buf, int num)
#endif
int do_stir_pool = 0;
#endif
int do_stir_pool = 0;
+#ifdef OPENSSL_FIPS
+ if(FIPS_mode())
+ {
+ FIPSerr(FIPS_F_SSLEAY_RAND_BYTES,FIPS_R_NON_FIPS_METHOD);
+ return 0;
+ }
+#endif
+
#ifdef PREDICT
if (rand_predictable)
{
#ifdef PREDICT
if (rand_predictable)
{
@@
-520,7
+532,7
@@
static int ssleay_rand_pseudo_bytes(unsigned char *buf, int num)
err = ERR_peek_error();
if (ERR_GET_LIB(err) == ERR_LIB_RAND &&
ERR_GET_REASON(err) == RAND_R_PRNG_NOT_SEEDED)
err = ERR_peek_error();
if (ERR_GET_LIB(err) == ERR_LIB_RAND &&
ERR_GET_REASON(err) == RAND_R_PRNG_NOT_SEEDED)
-
(void)ERR_get
_error();
+
ERR_clear
_error();
}
return (ret);
}
}
return (ret);
}