diff options
| author | miod <> | 2014-04-13 15:25:35 +0000 |
|---|---|---|
| committer | miod <> | 2014-04-13 15:25:35 +0000 |
| commit | d2b3c9742a7df4ab87384039c99682d1944f66d7 (patch) | |
| tree | 74f4ff344980894c7c9ceeab9b81176ac7572566 /src/lib/libcrypto/rand/rand_lib.c | |
| parent | dbf195d7fd4efbe4ee578f1dc5c72e7f3deadf18 (diff) | |
| download | openbsd-d2b3c9742a7df4ab87384039c99682d1944f66d7.tar.gz openbsd-d2b3c9742a7df4ab87384039c99682d1944f66d7.tar.bz2 openbsd-d2b3c9742a7df4ab87384039c99682d1944f66d7.zip | |
Merge conflicts; remove MacOS, Netware, OS/2, VMS and Windows build machinery.
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 | { |
