changeset 3:f230c550e261

Correct check for errors from RAND_bytes()
author Guido Berhoerster <guido+sencrypt@berhoerster.name>
date Thu, 10 Apr 2014 00:05:56 +0200
parents b1d7f4dd26fa
children abb770754967
files sencrypt.c
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/sencrypt.c	Thu Jan 30 00:00:16 2014 +0100
+++ b/sencrypt.c	Thu Apr 10 00:05:56 2014 +0200
@@ -632,8 +632,8 @@
 
 	if (cmd == CMD_SENCRYPT) {
 		/* generate random salt and IV */
-		if ((RAND_bytes(salt, sizeof (salt)) == 0) ||
-		    (RAND_bytes(iv, EVP_CIPHER_iv_length(cipher)) == 0)) {
+		if ((RAND_bytes(salt, sizeof (salt)) != 1) ||
+		    (RAND_bytes(iv, EVP_CIPHER_iv_length(cipher)) != 1)) {
 			/* not enough entropy or unknown error */
 			warnx("failed to generate random data");
 			status = EXIT_FAILURE;