diff options
| author | Jung-uk Kim <jkim@FreeBSD.org> | 2015-06-11 17:56:16 +0000 |
|---|---|---|
| committer | Jung-uk Kim <jkim@FreeBSD.org> | 2015-06-11 17:56:16 +0000 |
| commit | a9745f9a849725cad34f84351bed202839aade59 (patch) | |
| tree | 686ec4279139441a2f9d947dceec492e54ff569c /apps/enc.c | |
| parent | 3d2030852da420b820a661e7b19bb757487e2599 (diff) | |
Diffstat (limited to 'apps/enc.c')
| -rw-r--r-- | apps/enc.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/apps/enc.c b/apps/enc.c index 5c2cf7a4acf3..7b7c70b132d7 100644 --- a/apps/enc.c +++ b/apps/enc.c @@ -548,9 +548,14 @@ int MAIN(int argc, char **argv) else OPENSSL_cleanse(str, strlen(str)); } - if ((hiv != NULL) && !set_hex(hiv, iv, sizeof iv)) { - BIO_printf(bio_err, "invalid hex iv value\n"); - goto end; + if (hiv != NULL) { + int siz = EVP_CIPHER_iv_length(cipher); + if (siz == 0) { + BIO_printf(bio_err, "warning: iv not use by this cipher\n"); + } else if (!set_hex(hiv, iv, sizeof iv)) { + BIO_printf(bio_err, "invalid hex iv value\n"); + goto end; + } } if ((hiv == NULL) && (str == NULL) && EVP_CIPHER_iv_length(cipher) != 0) { @@ -562,7 +567,7 @@ int MAIN(int argc, char **argv) BIO_printf(bio_err, "iv undefined\n"); goto end; } - if ((hkey != NULL) && !set_hex(hkey, key, sizeof key)) { + if ((hkey != NULL) && !set_hex(hkey, key, EVP_CIPHER_key_length(cipher))) { BIO_printf(bio_err, "invalid hex key value\n"); goto end; } |
