summaryrefslogtreecommitdiff
path: root/cipher-chachapoly.c
diff options
context:
space:
mode:
Diffstat (limited to 'cipher-chachapoly.c')
-rw-r--r--cipher-chachapoly.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/cipher-chachapoly.c b/cipher-chachapoly.c
index 91b0830fd..251b94ec8 100644
--- a/cipher-chachapoly.c
+++ b/cipher-chachapoly.c
@@ -14,7 +14,7 @@
14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 */ 15 */
16 16
17/* $OpenBSD: cipher-chachapoly.c,v 1.3 2013/12/15 21:42:35 djm Exp $ */ 17/* $OpenBSD: cipher-chachapoly.c,v 1.4 2014/01/31 16:39:19 tedu Exp $ */
18 18
19#include "includes.h" 19#include "includes.h"
20 20
@@ -58,7 +58,7 @@ chachapoly_crypt(struct chachapoly_ctx *ctx, u_int seqnr, u_char *dest,
58 * Run ChaCha20 once to generate the Poly1305 key. The IV is the 58 * Run ChaCha20 once to generate the Poly1305 key. The IV is the
59 * packet sequence number. 59 * packet sequence number.
60 */ 60 */
61 bzero(poly_key, sizeof(poly_key)); 61 memset(poly_key, 0, sizeof(poly_key));
62 put_u64(seqbuf, seqnr); 62 put_u64(seqbuf, seqnr);
63 chacha_ivsetup(&ctx->main_ctx, seqbuf, NULL); 63 chacha_ivsetup(&ctx->main_ctx, seqbuf, NULL);
64 chacha_encrypt_bytes(&ctx->main_ctx, 64 chacha_encrypt_bytes(&ctx->main_ctx,
@@ -90,9 +90,9 @@ chachapoly_crypt(struct chachapoly_ctx *ctx, u_int seqnr, u_char *dest,
90 r = 0; 90 r = 0;
91 91
92 out: 92 out:
93 bzero(expected_tag, sizeof(expected_tag)); 93 explicit_bzero(expected_tag, sizeof(expected_tag));
94 bzero(seqbuf, sizeof(seqbuf)); 94 explicit_bzero(seqbuf, sizeof(seqbuf));
95 bzero(poly_key, sizeof(poly_key)); 95 explicit_bzero(poly_key, sizeof(poly_key));
96 return r; 96 return r;
97} 97}
98 98