diff options
author | jsing <> | 2023-04-15 18:32:55 +0000 |
---|---|---|
committer | jsing <> | 2023-04-15 18:32:55 +0000 |
commit | 9148c84b488f1ebcd570038939692a638d9bff32 (patch) | |
tree | e4a985904086f67fe4f940db06e7912963f018ad /src | |
parent | 4387d35c29e60535d5bd4dcf6c369db3fef82236 (diff) | |
download | openbsd-9148c84b488f1ebcd570038939692a638d9bff32.tar.gz openbsd-9148c84b488f1ebcd570038939692a638d9bff32.tar.bz2 openbsd-9148c84b488f1ebcd570038939692a638d9bff32.zip |
Rename SHA3 context struct field from 'st' to 'state'.
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/libcrypto/sha/sha3.c | 26 | ||||
-rw-r--r-- | src/lib/libcrypto/sha/sha3_internal.h | 4 |
2 files changed, 15 insertions, 15 deletions
diff --git a/src/lib/libcrypto/sha/sha3.c b/src/lib/libcrypto/sha/sha3.c index 51e7d9c315..23019fb4d4 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.8 2023/04/15 18:30:27 jsing Exp $ */ | 1 | /* $OpenBSD: sha3.c,v 1.9 2023/04/15 18:32:55 jsing Exp $ */ |
2 | /* | 2 | /* |
3 | * The MIT License (MIT) | 3 | * The MIT License (MIT) |
4 | * | 4 | * |
@@ -121,7 +121,7 @@ sha3_init(sha3_ctx *c, int mdlen) | |||
121 | int i; | 121 | int i; |
122 | 122 | ||
123 | for (i = 0; i < 25; i++) | 123 | for (i = 0; i < 25; i++) |
124 | c->st.q[i] = 0; | 124 | c->state.q[i] = 0; |
125 | c->mdlen = mdlen; | 125 | c->mdlen = mdlen; |
126 | c->rsiz = 200 - 2 * mdlen; | 126 | c->rsiz = 200 - 2 * mdlen; |
127 | c->pt = 0; | 127 | c->pt = 0; |
@@ -137,9 +137,9 @@ sha3_update(sha3_ctx *c, const void *data, size_t len) | |||
137 | 137 | ||
138 | j = c->pt; | 138 | j = c->pt; |
139 | for (i = 0; i < len; i++) { | 139 | for (i = 0; i < len; i++) { |
140 | c->st.b[j++] ^= ((const uint8_t *) data)[i]; | 140 | c->state.b[j++] ^= ((const uint8_t *) data)[i]; |
141 | if (j >= c->rsiz) { | 141 | if (j >= c->rsiz) { |
142 | sha3_keccakf(c->st.q); | 142 | sha3_keccakf(c->state.q); |
143 | j = 0; | 143 | j = 0; |
144 | } | 144 | } |
145 | } | 145 | } |
@@ -153,12 +153,12 @@ sha3_final(void *md, sha3_ctx *c) | |||
153 | { | 153 | { |
154 | int i; | 154 | int i; |
155 | 155 | ||
156 | c->st.b[c->pt] ^= 0x06; | 156 | c->state.b[c->pt] ^= 0x06; |
157 | c->st.b[c->rsiz - 1] ^= 0x80; | 157 | c->state.b[c->rsiz - 1] ^= 0x80; |
158 | sha3_keccakf(c->st.q); | 158 | sha3_keccakf(c->state.q); |
159 | 159 | ||
160 | for (i = 0; i < c->mdlen; i++) { | 160 | for (i = 0; i < c->mdlen; i++) { |
161 | ((uint8_t *) md)[i] = c->st.b[i]; | 161 | ((uint8_t *) md)[i] = c->state.b[i]; |
162 | } | 162 | } |
163 | 163 | ||
164 | return 1; | 164 | return 1; |
@@ -180,9 +180,9 @@ sha3(const void *in, size_t inlen, void *md, int mdlen) | |||
180 | void | 180 | void |
181 | shake_xof(sha3_ctx *c) | 181 | shake_xof(sha3_ctx *c) |
182 | { | 182 | { |
183 | c->st.b[c->pt] ^= 0x1F; | 183 | c->state.b[c->pt] ^= 0x1F; |
184 | c->st.b[c->rsiz - 1] ^= 0x80; | 184 | c->state.b[c->rsiz - 1] ^= 0x80; |
185 | sha3_keccakf(c->st.q); | 185 | sha3_keccakf(c->state.q); |
186 | c->pt = 0; | 186 | c->pt = 0; |
187 | } | 187 | } |
188 | 188 | ||
@@ -195,10 +195,10 @@ shake_out(sha3_ctx *c, void *out, size_t len) | |||
195 | j = c->pt; | 195 | j = c->pt; |
196 | for (i = 0; i < len; i++) { | 196 | for (i = 0; i < len; i++) { |
197 | if (j >= c->rsiz) { | 197 | if (j >= c->rsiz) { |
198 | sha3_keccakf(c->st.q); | 198 | sha3_keccakf(c->state.q); |
199 | j = 0; | 199 | j = 0; |
200 | } | 200 | } |
201 | ((uint8_t *) out)[i] = c->st.b[j++]; | 201 | ((uint8_t *) out)[i] = c->state.b[j++]; |
202 | } | 202 | } |
203 | c->pt = j; | 203 | c->pt = j; |
204 | } | 204 | } |
diff --git a/src/lib/libcrypto/sha/sha3_internal.h b/src/lib/libcrypto/sha/sha3_internal.h index 5156ad9d80..889f12c8e9 100644 --- a/src/lib/libcrypto/sha/sha3_internal.h +++ b/src/lib/libcrypto/sha/sha3_internal.h | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: sha3_internal.h,v 1.7 2023/04/15 18:30:27 jsing Exp $ */ | 1 | /* $OpenBSD: sha3_internal.h,v 1.8 2023/04/15 18:32:55 jsing Exp $ */ |
2 | /* | 2 | /* |
3 | * The MIT License (MIT) | 3 | * The MIT License (MIT) |
4 | * | 4 | * |
@@ -33,7 +33,7 @@ typedef struct { | |||
33 | union { | 33 | union { |
34 | uint8_t b[200]; /* State as 8 bit bytes. */ | 34 | uint8_t b[200]; /* State as 8 bit bytes. */ |
35 | uint64_t q[25]; /* State as 64 bit words. */ | 35 | uint64_t q[25]; /* State as 64 bit words. */ |
36 | } st; | 36 | } state; |
37 | int pt, rsiz, mdlen; | 37 | int pt, rsiz, mdlen; |
38 | } sha3_ctx; | 38 | } sha3_ctx; |
39 | 39 | ||