summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorLutz Jänicke <jaenicke@openssl.org>2001-07-03 10:32:30 +0000
committerLutz Jänicke <jaenicke@openssl.org>2001-07-03 10:32:30 +0000
commit93074b2509141fa9730532b94eb499e4a9bc1523 (patch)
tree5345e9174e758d5f090de26f313799e080c0917c /apps
parent1498ad74bbdff13b33cf57346f028c14b22beb0a (diff)
When only the key is given to "enc", the IV is undefined
(found by Andy Brown <logic@warthog.com>).
Diffstat (limited to 'apps')
-rw-r--r--apps/enc.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/apps/enc.c b/apps/enc.c
index 2101b4cc64..ef0e872ffe 100644
--- a/apps/enc.c
+++ b/apps/enc.c
@@ -515,6 +515,14 @@ bad:
BIO_printf(bio_err,"invalid hex iv value\n");
goto end;
}
+ if ((hiv == NULL) && (str == NULL))
+ {
+ /* No IV was explicitly set and no IV was generated
+ * during EVP_BytesToKey. Hence the IV is undefined,
+ * making correct decryption impossible. */
+ BIO_printf(bio_err, "iv undefined\n");
+ goto end;
+ }
if ((hkey != NULL) && !set_hex(hkey,key,24))
{
BIO_printf(bio_err,"invalid hex key value\n");