diff options
author | 2015-03-27 11:26:06 -0400 | |
---|---|---|
committer | 2015-03-27 11:26:06 -0400 | |
commit | 0b941d68e7ceba9302d57eb8083e8244602a09ce (patch) | |
tree | f74a786d667b2b1c70bb39e9a1bfb5c8f58bd5d5 /src/c/openssl.c | |
parent | bef4dd04f19c2001561e9e889116f5a2f8905bc0 (diff) | |
parent | 8e114ff992a3e730f2eb42095267969eebf75c36 (diff) |
Merge.
Diffstat (limited to 'src/c/openssl.c')
-rw-r--r-- | src/c/openssl.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/c/openssl.c b/src/c/openssl.c index 6a998e29..1d820a34 100644 --- a/src/c/openssl.c +++ b/src/c/openssl.c @@ -9,6 +9,7 @@ #include <string.h> #include <openssl/sha.h> +#include <openssl/rand.h> #define PASSSIZE 4 @@ -19,10 +20,11 @@ static int password[PASSSIZE]; char *uw_sig_file = NULL; static void random_password() { - int i; - - for (i = 0; i < PASSSIZE; ++i) - password[i] = rand(); + if (!RAND_bytes((unsigned char *)password, sizeof password)) { + fprintf(stderr, "Error generating random password\n"); + perror("RAND_bytes"); + exit(1); + } } void uw_init_crypto() { |