Mercurial > projects > sencrypt
diff sencrypt.c @ 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 | 73af139d1a94 |
children | abb770754967 |
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;