summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/dsa/dsa_gen.c
diff options
context:
space:
mode:
authorjsing <>2014-10-22 13:02:04 +0000
committerjsing <>2014-10-22 13:02:04 +0000
commita2960bc2e14b4c5f7d8f78d2a69ebb537ca4afa8 (patch)
tree32d920c77e1ecf12be5fad632b9ae71343194a7c /src/lib/libcrypto/dsa/dsa_gen.c
parent5a6d7fd5a10b0ad084948463b25822d91091b325 (diff)
downloadopenbsd-a2960bc2e14b4c5f7d8f78d2a69ebb537ca4afa8.tar.gz
openbsd-a2960bc2e14b4c5f7d8f78d2a69ebb537ca4afa8.tar.bz2
openbsd-a2960bc2e14b4c5f7d8f78d2a69ebb537ca4afa8.zip
Use arc4random_buf() instead of RAND_bytes() or RAND_pseudo_bytes().
arc4random_buf() is guaranteed to always succeed - it is worth noting that a number of the replaced function calls were already missing return value checks. ok deraadt@
Diffstat (limited to 'src/lib/libcrypto/dsa/dsa_gen.c')
-rw-r--r--src/lib/libcrypto/dsa/dsa_gen.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/lib/libcrypto/dsa/dsa_gen.c b/src/lib/libcrypto/dsa/dsa_gen.c
index a3d07b901a..296a544c31 100644
--- a/src/lib/libcrypto/dsa/dsa_gen.c
+++ b/src/lib/libcrypto/dsa/dsa_gen.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: dsa_gen.c,v 1.16 2014/07/12 16:03:37 miod Exp $ */ 1/* $OpenBSD: dsa_gen.c,v 1.17 2014/10/22 13:02:04 jsing Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -61,11 +61,11 @@
61#ifndef OPENSSL_NO_SHA 61#ifndef OPENSSL_NO_SHA
62 62
63#include <stdio.h> 63#include <stdio.h>
64#include <stdlib.h>
64#include <string.h> 65#include <string.h>
65 66
66#include <openssl/bn.h> 67#include <openssl/bn.h>
67#include <openssl/evp.h> 68#include <openssl/evp.h>
68#include <openssl/rand.h>
69#include <openssl/sha.h> 69#include <openssl/sha.h>
70 70
71#include "dsa_locl.h" 71#include "dsa_locl.h"
@@ -169,7 +169,7 @@ dsa_builtin_paramgen(DSA *ret, size_t bits, size_t qbits, const EVP_MD *evpmd,
169 goto err; 169 goto err;
170 170
171 if (!seed_len) { 171 if (!seed_len) {
172 RAND_pseudo_bytes(seed, qsize); 172 arc4random_buf(seed, qsize);
173 seed_is_random = 1; 173 seed_is_random = 1;
174 } else { 174 } else {
175 seed_is_random = 0; 175 seed_is_random = 0;