diff options
author | miod <> | 2014-08-04 04:16:11 +0000 |
---|---|---|
committer | miod <> | 2014-08-04 04:16:11 +0000 |
commit | c135325340b9f60bca34fe59b4bc77913da68f5a (patch) | |
tree | 69471b6f7766cd93e6258effc7690f5eaddcb32e /src/lib | |
parent | 89d8c27f171da5b9f08ea9763b71cb5db986646c (diff) | |
download | openbsd-c135325340b9f60bca34fe59b4bc77913da68f5a.tar.gz openbsd-c135325340b9f60bca34fe59b4bc77913da68f5a.tar.bz2 openbsd-c135325340b9f60bca34fe59b4bc77913da68f5a.zip |
In chacha_init(), allow for a NULL iv. Reported by znz on github.
ok guenther@ jsing@
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/libcrypto/evp/e_chacha.c | 5 | ||||
-rw-r--r-- | src/lib/libssl/src/crypto/evp/e_chacha.c | 5 |
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 | ||