diff options
author | miod <> | 2014-04-13 15:16:40 +0000 |
---|---|---|
committer | miod <> | 2014-04-13 15:16:40 +0000 |
commit | 52628ee3f51f011b463aaedb1a28aa0524b43cb3 (patch) | |
tree | 4bd2adeac981051908ec5756401424bbb4e57d6a /src/lib/libcrypto/rand/rand_lib.c | |
parent | 40c22d3625a3818690c889ed6216fedf2be522c9 (diff) | |
download | openbsd-52628ee3f51f011b463aaedb1a28aa0524b43cb3.tar.gz openbsd-52628ee3f51f011b463aaedb1a28aa0524b43cb3.tar.bz2 openbsd-52628ee3f51f011b463aaedb1a28aa0524b43cb3.zip |
Import OpenSSL 1.0.1g
Diffstat (limited to 'src/lib/libcrypto/rand/rand_lib.c')
-rw-r--r-- | src/lib/libcrypto/rand/rand_lib.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/src/lib/libcrypto/rand/rand_lib.c b/src/lib/libcrypto/rand/rand_lib.c index daf1dab973..5ac0e14caf 100644 --- a/src/lib/libcrypto/rand/rand_lib.c +++ b/src/lib/libcrypto/rand/rand_lib.c | |||
@@ -210,8 +210,11 @@ static size_t drbg_get_entropy(DRBG_CTX *ctx, unsigned char **pout, | |||
210 | 210 | ||
211 | static void drbg_free_entropy(DRBG_CTX *ctx, unsigned char *out, size_t olen) | 211 | static void drbg_free_entropy(DRBG_CTX *ctx, unsigned char *out, size_t olen) |
212 | { | 212 | { |
213 | OPENSSL_cleanse(out, olen); | 213 | if (out) |
214 | OPENSSL_free(out); | 214 | { |
215 | OPENSSL_cleanse(out, olen); | ||
216 | OPENSSL_free(out); | ||
217 | } | ||
215 | } | 218 | } |
216 | 219 | ||
217 | /* Set "additional input" when generating random data. This uses the | 220 | /* Set "additional input" when generating random data. This uses the |
@@ -266,6 +269,14 @@ int RAND_init_fips(void) | |||
266 | DRBG_CTX *dctx; | 269 | DRBG_CTX *dctx; |
267 | size_t plen; | 270 | size_t plen; |
268 | unsigned char pers[32], *p; | 271 | unsigned char pers[32], *p; |
272 | #ifndef OPENSSL_ALLOW_DUAL_EC_DRBG | ||
273 | if (fips_drbg_type >> 16) | ||
274 | { | ||
275 | RANDerr(RAND_F_RAND_INIT_FIPS, RAND_R_DUAL_EC_DRBG_DISABLED); | ||
276 | return 0; | ||
277 | } | ||
278 | #endif | ||
279 | |||
269 | dctx = FIPS_get_default_drbg(); | 280 | dctx = FIPS_get_default_drbg(); |
270 | if (FIPS_drbg_init(dctx, fips_drbg_type, fips_drbg_flags) <= 0) | 281 | if (FIPS_drbg_init(dctx, fips_drbg_type, fips_drbg_flags) <= 0) |
271 | { | 282 | { |