projects/sencrypt

changeset 3:f230c550e261

Correct check for errors from RAND_bytes()
author Guido Berhoerster <guido+sencrypt@berhoerster.name>
date Thu Apr 10 00:05:56 2014 +0200 (2014-04-10)
parents b1d7f4dd26fa
children abb770754967
files sencrypt.c
line diff
     1.1 --- a/sencrypt.c	Thu Jan 30 00:00:16 2014 +0100
     1.2 +++ b/sencrypt.c	Thu Apr 10 00:05:56 2014 +0200
     1.3 @@ -632,8 +632,8 @@
     1.4  
     1.5  	if (cmd == CMD_SENCRYPT) {
     1.6  		/* generate random salt and IV */
     1.7 -		if ((RAND_bytes(salt, sizeof (salt)) == 0) ||
     1.8 -		    (RAND_bytes(iv, EVP_CIPHER_iv_length(cipher)) == 0)) {
     1.9 +		if ((RAND_bytes(salt, sizeof (salt)) != 1) ||
    1.10 +		    (RAND_bytes(iv, EVP_CIPHER_iv_length(cipher)) != 1)) {
    1.11  			/* not enough entropy or unknown error */
    1.12  			warnx("failed to generate random data");
    1.13  			status = EXIT_FAILURE;