summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormiod <>2014-08-04 04:16:11 +0000
committermiod <>2014-08-04 04:16:11 +0000
commitbba902541ea9e12e8f760f500c6051eed7602dc0 (patch)
tree69471b6f7766cd93e6258effc7690f5eaddcb32e /src
parent00a223b6abd274224749980510752ba56f9f92a3 (diff)
downloadopenbsd-bba902541ea9e12e8f760f500c6051eed7602dc0.tar.gz
openbsd-bba902541ea9e12e8f760f500c6051eed7602dc0.tar.bz2
openbsd-bba902541ea9e12e8f760f500c6051eed7602dc0.zip
In chacha_init(), allow for a NULL iv. Reported by znz on github.
ok guenther@ jsing@
Diffstat (limited to 'src')
-rw-r--r--src/lib/libcrypto/evp/e_chacha.c5
-rw-r--r--src/lib/libssl/src/crypto/evp/e_chacha.c5
2 files changed, 6 insertions, 4 deletions
diff --git a/src/lib/libcrypto/evp/e_chacha.c b/src/lib/libcrypto/evp/e_chacha.c
index 0a5ab98cdb..b63f586bba 100644
--- a/src/lib/libcrypto/evp/e_chacha.c
+++ b/src/lib/libcrypto/evp/e_chacha.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: e_chacha.c,v 1.4 2014/07/10 22:45:57 jsing Exp $ */ 1/* $OpenBSD: e_chacha.c,v 1.5 2014/08/04 04:16:11 miod Exp $ */
2/* 2/*
3 * Copyright (c) 2014 Joel Sing <jsing@openbsd.org> 3 * Copyright (c) 2014 Joel Sing <jsing@openbsd.org>
4 * 4 *
@@ -53,7 +53,8 @@ chacha_init(EVP_CIPHER_CTX *ctx, const unsigned char *key,
53{ 53{
54 ChaCha_set_key((ChaCha_ctx *)ctx->cipher_data, key, 54 ChaCha_set_key((ChaCha_ctx *)ctx->cipher_data, key,
55 EVP_CIPHER_CTX_key_length(ctx) * 8); 55 EVP_CIPHER_CTX_key_length(ctx) * 8);
56 ChaCha_set_iv((ChaCha_ctx *)ctx->cipher_data, iv, NULL); 56 if (iv != NULL)
57 ChaCha_set_iv((ChaCha_ctx *)ctx->cipher_data, iv, NULL);
57 return 1; 58 return 1;
58} 59}
59 60
diff --git a/src/lib/libssl/src/crypto/evp/e_chacha.c b/src/lib/libssl/src/crypto/evp/e_chacha.c
index 0a5ab98cdb..b63f586bba 100644
--- a/src/lib/libssl/src/crypto/evp/e_chacha.c
+++ b/src/lib/libssl/src/crypto/evp/e_chacha.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: e_chacha.c,v 1.4 2014/07/10 22:45:57 jsing Exp $ */ 1/* $OpenBSD: e_chacha.c,v 1.5 2014/08/04 04:16:11 miod Exp $ */
2/* 2/*
3 * Copyright (c) 2014 Joel Sing <jsing@openbsd.org> 3 * Copyright (c) 2014 Joel Sing <jsing@openbsd.org>
4 * 4 *
@@ -53,7 +53,8 @@ chacha_init(EVP_CIPHER_CTX *ctx, const unsigned char *key,
53{ 53{
54 ChaCha_set_key((ChaCha_ctx *)ctx->cipher_data, key, 54 ChaCha_set_key((ChaCha_ctx *)ctx->cipher_data, key,
55 EVP_CIPHER_CTX_key_length(ctx) * 8); 55 EVP_CIPHER_CTX_key_length(ctx) * 8);
56 ChaCha_set_iv((ChaCha_ctx *)ctx->cipher_data, iv, NULL); 56 if (iv != NULL)
57 ChaCha_set_iv((ChaCha_ctx *)ctx->cipher_data, iv, NULL);
57 return 1; 58 return 1;
58} 59}
59 60