summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorjsing <>2023-04-15 19:27:54 +0000
committerjsing <>2023-04-15 19:27:54 +0000
commita866975c1f7d904a6cab7d3f16fe3af292d7cf1a (patch)
treec762576167c168ce48df760ae381df547556826f /src
parent0dee22a3582ea2bb10215653602f36c1bc62182b (diff)
downloadopenbsd-a866975c1f7d904a6cab7d3f16fe3af292d7cf1a.tar.gz
openbsd-a866975c1f7d904a6cab7d3f16fe3af292d7cf1a.tar.bz2
openbsd-a866975c1f7d904a6cab7d3f16fe3af292d7cf1a.zip
Use memset() to zero the context, instead of zeroing manually.
Diffstat (limited to 'src')
-rw-r--r--src/lib/libcrypto/sha/sha3.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/src/lib/libcrypto/sha/sha3.c b/src/lib/libcrypto/sha/sha3.c
index 7b70d90c87..d246d53ce4 100644
--- a/src/lib/libcrypto/sha/sha3.c
+++ b/src/lib/libcrypto/sha/sha3.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: sha3.c,v 1.10 2023/04/15 19:15:53 jsing Exp $ */ 1/* $OpenBSD: sha3.c,v 1.11 2023/04/15 19:27:54 jsing Exp $ */
2/* 2/*
3 * The MIT License (MIT) 3 * The MIT License (MIT)
4 * 4 *
@@ -24,6 +24,7 @@
24 */ 24 */
25 25
26#include <endian.h> 26#include <endian.h>
27#include <string.h>
27 28
28#include "sha3_internal.h" 29#include "sha3_internal.h"
29 30
@@ -120,13 +121,10 @@ sha3_keccakf(uint64_t st[25])
120int 121int
121sha3_init(sha3_ctx *c, int mdlen) 122sha3_init(sha3_ctx *c, int mdlen)
122{ 123{
123 int i; 124 memset(c, 0, sizeof(*c));
124 125
125 for (i = 0; i < 25; i++)
126 c->state.q[i] = 0;
127 c->mdlen = mdlen; 126 c->mdlen = mdlen;
128 c->rsiz = 200 - 2 * mdlen; 127 c->rsiz = 200 - 2 * mdlen;
129 c->pt = 0;
130 128
131 return 1; 129 return 1;
132} 130}