From c135325340b9f60bca34fe59b4bc77913da68f5a Mon Sep 17 00:00:00 2001 From: miod <> Date: Mon, 4 Aug 2014 04:16:11 +0000 Subject: In chacha_init(), allow for a NULL iv. Reported by znz on github. ok guenther@ jsing@ --- src/lib/libcrypto/evp/e_chacha.c | 5 +++-- src/lib/libssl/src/crypto/evp/e_chacha.c | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) (limited to 'src/lib') 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 @@ -/* $OpenBSD: e_chacha.c,v 1.4 2014/07/10 22:45:57 jsing Exp $ */ +/* $OpenBSD: e_chacha.c,v 1.5 2014/08/04 04:16:11 miod Exp $ */ /* * Copyright (c) 2014 Joel Sing * @@ -53,7 +53,8 @@ chacha_init(EVP_CIPHER_CTX *ctx, const unsigned char *key, { ChaCha_set_key((ChaCha_ctx *)ctx->cipher_data, key, EVP_CIPHER_CTX_key_length(ctx) * 8); - ChaCha_set_iv((ChaCha_ctx *)ctx->cipher_data, iv, NULL); + if (iv != NULL) + ChaCha_set_iv((ChaCha_ctx *)ctx->cipher_data, iv, NULL); return 1; } 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 @@ -/* $OpenBSD: e_chacha.c,v 1.4 2014/07/10 22:45:57 jsing Exp $ */ +/* $OpenBSD: e_chacha.c,v 1.5 2014/08/04 04:16:11 miod Exp $ */ /* * Copyright (c) 2014 Joel Sing * @@ -53,7 +53,8 @@ chacha_init(EVP_CIPHER_CTX *ctx, const unsigned char *key, { ChaCha_set_key((ChaCha_ctx *)ctx->cipher_data, key, EVP_CIPHER_CTX_key_length(ctx) * 8); - ChaCha_set_iv((ChaCha_ctx *)ctx->cipher_data, iv, NULL); + if (iv != NULL) + ChaCha_set_iv((ChaCha_ctx *)ctx->cipher_data, iv, NULL); return 1; } -- cgit v1.2.3-55-g6feb