summaryrefslogtreecommitdiff
path: root/cipher-chachapoly.c
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2014-02-04 11:18:20 +1100
committerDamien Miller <djm@mindrot.org>2014-02-04 11:18:20 +1100
commit1d2c4564265ee827147af246a16f3777741411ed (patch)
treeaf83ab151453d013118cd1bd20fb8ba887665fed /cipher-chachapoly.c
parent3928de067c286683a95fbdbdb5fdb3c78a0e5efd (diff)
- tedu@cvs.openbsd.org 2014/01/31 16:39:19
[auth2-chall.c authfd.c authfile.c bufaux.c bufec.c canohost.c] [channels.c cipher-chachapoly.c clientloop.c configure.ac hostfile.c] [kexc25519.c krl.c monitor.c sandbox-systrace.c session.c] [sftp-client.c ssh-keygen.c ssh.c sshconnect2.c sshd.c sshlogin.c] [openbsd-compat/explicit_bzero.c openbsd-compat/openbsd-compat.h] replace most bzero with explicit_bzero, except a few that cna be memset ok djm dtucker
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