/src/openssl31/providers/implementations/digests/sha3_prov.c
Line | Count | Source (jump to first uncovered line) |
1 | | /* |
2 | | * Copyright 2019-2023 The OpenSSL Project Authors. All Rights Reserved. |
3 | | * |
4 | | * Licensed under the Apache License 2.0 (the "License"). You may not use |
5 | | * this file except in compliance with the License. You can obtain a copy |
6 | | * in the file LICENSE in the source distribution or at |
7 | | * https://www.openssl.org/source/license.html |
8 | | */ |
9 | | |
10 | | #include <string.h> |
11 | | #include <openssl/core_names.h> |
12 | | #include <openssl/crypto.h> |
13 | | #include <openssl/evp.h> |
14 | | #include <openssl/params.h> |
15 | | #include <openssl/err.h> |
16 | | #include <openssl/proverr.h> |
17 | | #include "internal/sha3.h" |
18 | | #include "prov/digestcommon.h" |
19 | | #include "prov/implementations.h" |
20 | | |
21 | | #define SHA3_FLAGS PROV_DIGEST_FLAG_ALGID_ABSENT |
22 | | #define SHAKE_FLAGS PROV_DIGEST_FLAG_XOF |
23 | | #define KMAC_FLAGS PROV_DIGEST_FLAG_XOF |
24 | | |
25 | | /* |
26 | | * Forward declaration of any unique methods implemented here. This is not strictly |
27 | | * necessary for the compiler, but provides an assurance that the signatures |
28 | | * of the functions in the dispatch table are correct. |
29 | | */ |
30 | | static OSSL_FUNC_digest_init_fn keccak_init; |
31 | | static OSSL_FUNC_digest_init_fn keccak_init_params; |
32 | | static OSSL_FUNC_digest_update_fn keccak_update; |
33 | | static OSSL_FUNC_digest_final_fn keccak_final; |
34 | | static OSSL_FUNC_digest_freectx_fn keccak_freectx; |
35 | | static OSSL_FUNC_digest_dupctx_fn keccak_dupctx; |
36 | | static OSSL_FUNC_digest_set_ctx_params_fn shake_set_ctx_params; |
37 | | static OSSL_FUNC_digest_settable_ctx_params_fn shake_settable_ctx_params; |
38 | | static sha3_absorb_fn generic_sha3_absorb; |
39 | | static sha3_final_fn generic_sha3_final; |
40 | | |
41 | | #if defined(OPENSSL_CPUID_OBJ) && defined(__s390__) && defined(KECCAK1600_ASM) |
42 | | /* |
43 | | * IBM S390X support |
44 | | */ |
45 | | # include "s390x_arch.h" |
46 | | # define S390_SHA3 1 |
47 | | # define S390_SHA3_CAPABLE(name) \ |
48 | | ((OPENSSL_s390xcap_P.kimd[0] & S390X_CAPBIT(S390X_##name)) && \ |
49 | | (OPENSSL_s390xcap_P.klmd[0] & S390X_CAPBIT(S390X_##name))) |
50 | | |
51 | | #endif |
52 | | |
53 | | static int keccak_init(void *vctx, ossl_unused const OSSL_PARAM params[]) |
54 | 161M | { |
55 | 161M | if (!ossl_prov_is_running()) |
56 | 0 | return 0; |
57 | | /* The newctx() handles most of the ctx fixed setup. */ |
58 | 161M | ossl_sha3_reset((KECCAK1600_CTX *)vctx); |
59 | 161M | return 1; |
60 | 161M | } |
61 | | |
62 | | static int keccak_init_params(void *vctx, const OSSL_PARAM params[]) |
63 | 161M | { |
64 | 161M | return keccak_init(vctx, NULL) |
65 | 161M | && shake_set_ctx_params(vctx, params); |
66 | 161M | } |
67 | | |
68 | | static int keccak_update(void *vctx, const unsigned char *inp, size_t len) |
69 | 494M | { |
70 | 494M | KECCAK1600_CTX *ctx = vctx; |
71 | 494M | const size_t bsz = ctx->block_size; |
72 | 494M | size_t num, rem; |
73 | | |
74 | 494M | if (len == 0) |
75 | 0 | return 1; |
76 | | |
77 | | /* Is there anything in the buffer already ? */ |
78 | 494M | if ((num = ctx->bufsz) != 0) { |
79 | | /* Calculate how much space is left in the buffer */ |
80 | 333M | rem = bsz - num; |
81 | | /* If the new input does not fill the buffer then just add it */ |
82 | 333M | if (len < rem) { |
83 | 333M | memcpy(ctx->buf + num, inp, len); |
84 | 333M | ctx->bufsz += len; |
85 | 333M | return 1; |
86 | 333M | } |
87 | | /* otherwise fill up the buffer and absorb the buffer */ |
88 | 180k | memcpy(ctx->buf + num, inp, rem); |
89 | | /* Update the input pointer */ |
90 | 180k | inp += rem; |
91 | 180k | len -= rem; |
92 | 180k | ctx->meth.absorb(ctx, ctx->buf, bsz); |
93 | 180k | ctx->bufsz = 0; |
94 | 180k | } |
95 | | /* Absorb the input - rem = leftover part of the input < blocksize) */ |
96 | 161M | rem = ctx->meth.absorb(ctx, inp, len); |
97 | | /* Copy the leftover bit of the input into the buffer */ |
98 | 161M | if (rem) { |
99 | 161M | memcpy(ctx->buf, inp + len - rem, rem); |
100 | 161M | ctx->bufsz = rem; |
101 | 161M | } |
102 | 161M | return 1; |
103 | 494M | } |
104 | | |
105 | | static int keccak_final(void *vctx, unsigned char *out, size_t *outl, |
106 | | size_t outsz) |
107 | 221k | { |
108 | 221k | int ret = 1; |
109 | 221k | KECCAK1600_CTX *ctx = vctx; |
110 | | |
111 | 221k | if (!ossl_prov_is_running()) |
112 | 0 | return 0; |
113 | 221k | if (outsz > 0) |
114 | 221k | ret = ctx->meth.final(out, ctx); |
115 | | |
116 | 221k | *outl = ctx->md_size; |
117 | 221k | return ret; |
118 | 221k | } |
119 | | |
120 | | /*- |
121 | | * Generic software version of the absorb() and final(). |
122 | | */ |
123 | | static size_t generic_sha3_absorb(void *vctx, const void *inp, size_t len) |
124 | 221k | { |
125 | 221k | KECCAK1600_CTX *ctx = vctx; |
126 | | |
127 | 221k | return SHA3_absorb(ctx->A, inp, len, ctx->block_size); |
128 | 221k | } |
129 | | |
130 | | static int generic_sha3_final(unsigned char *md, void *vctx) |
131 | 161M | { |
132 | 161M | return ossl_sha3_final(md, (KECCAK1600_CTX *)vctx); |
133 | 161M | } |
134 | | |
135 | | static PROV_SHA3_METHOD sha3_generic_md = |
136 | | { |
137 | | generic_sha3_absorb, |
138 | | generic_sha3_final |
139 | | }; |
140 | | |
141 | | #if defined(S390_SHA3) |
142 | | |
143 | | static sha3_absorb_fn s390x_sha3_absorb; |
144 | | static sha3_final_fn s390x_sha3_final; |
145 | | static sha3_final_fn s390x_shake_final; |
146 | | |
147 | | /*- |
148 | | * The platform specific parts of the absorb() and final() for S390X. |
149 | | */ |
150 | | static size_t s390x_sha3_absorb(void *vctx, const void *inp, size_t len) |
151 | | { |
152 | | KECCAK1600_CTX *ctx = vctx; |
153 | | size_t rem = len % ctx->block_size; |
154 | | |
155 | | s390x_kimd(inp, len - rem, ctx->pad, ctx->A); |
156 | | return rem; |
157 | | } |
158 | | |
159 | | static int s390x_sha3_final(unsigned char *md, void *vctx) |
160 | | { |
161 | | KECCAK1600_CTX *ctx = vctx; |
162 | | |
163 | | if (!ossl_prov_is_running()) |
164 | | return 0; |
165 | | s390x_klmd(ctx->buf, ctx->bufsz, NULL, 0, ctx->pad, ctx->A); |
166 | | memcpy(md, ctx->A, ctx->md_size); |
167 | | return 1; |
168 | | } |
169 | | |
170 | | static int s390x_shake_final(unsigned char *md, void *vctx) |
171 | | { |
172 | | KECCAK1600_CTX *ctx = vctx; |
173 | | |
174 | | if (!ossl_prov_is_running()) |
175 | | return 0; |
176 | | s390x_klmd(ctx->buf, ctx->bufsz, md, ctx->md_size, ctx->pad, ctx->A); |
177 | | return 1; |
178 | | } |
179 | | |
180 | | static int s390x_keccakc_final(unsigned char *md, void *vctx, int padding) |
181 | | { |
182 | | KECCAK1600_CTX *ctx = vctx; |
183 | | size_t bsz = ctx->block_size; |
184 | | size_t num = ctx->bufsz; |
185 | | size_t needed = ctx->md_size; |
186 | | static const unsigned char empty[KECCAK1600_WIDTH / 8] = {0}; |
187 | | |
188 | | if (!ossl_prov_is_running()) |
189 | | return 0; |
190 | | if (ctx->md_size == 0) |
191 | | return 1; |
192 | | memset(ctx->buf + num, 0, bsz - num); |
193 | | ctx->buf[num] = padding; |
194 | | ctx->buf[bsz - 1] |= 0x80; |
195 | | s390x_kimd(ctx->buf, bsz, ctx->pad, ctx->A); |
196 | | while (needed > bsz) { |
197 | | memcpy(md, ctx->A, bsz); |
198 | | needed -= bsz; |
199 | | md += bsz; |
200 | | s390x_kimd(empty, bsz, ctx->pad, ctx->A); |
201 | | } |
202 | | memcpy(md, ctx->A, needed); |
203 | | |
204 | | return 1; |
205 | | } |
206 | | |
207 | | static int s390x_kmac_final(unsigned char *md, void *vctx) |
208 | | { |
209 | | return s390x_keccakc_final(md, vctx, 0x04); |
210 | | } |
211 | | |
212 | | static PROV_SHA3_METHOD sha3_s390x_md = |
213 | | { |
214 | | s390x_sha3_absorb, |
215 | | s390x_sha3_final |
216 | | }; |
217 | | |
218 | | static PROV_SHA3_METHOD shake_s390x_md = |
219 | | { |
220 | | s390x_sha3_absorb, |
221 | | s390x_shake_final |
222 | | }; |
223 | | |
224 | | static PROV_SHA3_METHOD kmac_s390x_md = |
225 | | { |
226 | | s390x_sha3_absorb, |
227 | | s390x_kmac_final |
228 | | }; |
229 | | |
230 | | # define SHA3_SET_MD(uname, typ) \ |
231 | | if (S390_SHA3_CAPABLE(uname)) { \ |
232 | | ctx->pad = S390X_##uname; \ |
233 | | ctx->meth = typ##_s390x_md; \ |
234 | | } else { \ |
235 | | ctx->meth = sha3_generic_md; \ |
236 | | } |
237 | | # define KMAC_SET_MD(bitlen) \ |
238 | | if (S390_SHA3_CAPABLE(SHAKE_##bitlen)) { \ |
239 | | ctx->pad = S390X_SHAKE_##bitlen; \ |
240 | | ctx->meth = kmac_s390x_md; \ |
241 | | } else { \ |
242 | | ctx->meth = sha3_generic_md; \ |
243 | | } |
244 | | #else |
245 | 203k | # define SHA3_SET_MD(uname, typ) ctx->meth = sha3_generic_md; |
246 | 88 | # define KMAC_SET_MD(bitlen) ctx->meth = sha3_generic_md; |
247 | | #endif /* S390_SHA3 */ |
248 | | |
249 | | #define SHA3_newctx(typ, uname, name, bitlen, pad) \ |
250 | | static OSSL_FUNC_digest_newctx_fn name##_newctx; \ |
251 | 203k | static void *name##_newctx(void *provctx) \ |
252 | 203k | { \ |
253 | 203k | KECCAK1600_CTX *ctx = ossl_prov_is_running() ? OPENSSL_zalloc(sizeof(*ctx)) \ |
254 | 203k | : NULL; \ |
255 | 203k | \ |
256 | 203k | if (ctx == NULL) \ |
257 | 203k | return NULL; \ |
258 | 203k | ossl_sha3_init(ctx, pad, bitlen); \ |
259 | 203k | SHA3_SET_MD(uname, typ) \ |
260 | 203k | return ctx; \ |
261 | 203k | } sha3_prov.c:sha3_224_newctx Line | Count | Source | 251 | 51.2k | static void *name##_newctx(void *provctx) \ | 252 | 51.2k | { \ | 253 | 51.2k | KECCAK1600_CTX *ctx = ossl_prov_is_running() ? OPENSSL_zalloc(sizeof(*ctx)) \ | 254 | 51.2k | : NULL; \ | 255 | 51.2k | \ | 256 | 51.2k | if (ctx == NULL) \ | 257 | 51.2k | return NULL; \ | 258 | 51.2k | ossl_sha3_init(ctx, pad, bitlen); \ | 259 | 51.2k | SHA3_SET_MD(uname, typ) \ | 260 | 51.2k | return ctx; \ | 261 | 51.2k | } |
sha3_prov.c:sha3_256_newctx Line | Count | Source | 251 | 47.1k | static void *name##_newctx(void *provctx) \ | 252 | 47.1k | { \ | 253 | 47.1k | KECCAK1600_CTX *ctx = ossl_prov_is_running() ? OPENSSL_zalloc(sizeof(*ctx)) \ | 254 | 47.1k | : NULL; \ | 255 | 47.1k | \ | 256 | 47.1k | if (ctx == NULL) \ | 257 | 47.1k | return NULL; \ | 258 | 47.1k | ossl_sha3_init(ctx, pad, bitlen); \ | 259 | 47.1k | SHA3_SET_MD(uname, typ) \ | 260 | 47.1k | return ctx; \ | 261 | 47.1k | } |
sha3_prov.c:sha3_384_newctx Line | Count | Source | 251 | 8.97k | static void *name##_newctx(void *provctx) \ | 252 | 8.97k | { \ | 253 | 8.97k | KECCAK1600_CTX *ctx = ossl_prov_is_running() ? OPENSSL_zalloc(sizeof(*ctx)) \ | 254 | 8.97k | : NULL; \ | 255 | 8.97k | \ | 256 | 8.97k | if (ctx == NULL) \ | 257 | 8.97k | return NULL; \ | 258 | 8.97k | ossl_sha3_init(ctx, pad, bitlen); \ | 259 | 8.97k | SHA3_SET_MD(uname, typ) \ | 260 | 8.97k | return ctx; \ | 261 | 8.97k | } |
sha3_prov.c:sha3_512_newctx Line | Count | Source | 251 | 23.5k | static void *name##_newctx(void *provctx) \ | 252 | 23.5k | { \ | 253 | 23.5k | KECCAK1600_CTX *ctx = ossl_prov_is_running() ? OPENSSL_zalloc(sizeof(*ctx)) \ | 254 | 23.5k | : NULL; \ | 255 | 23.5k | \ | 256 | 23.5k | if (ctx == NULL) \ | 257 | 23.5k | return NULL; \ | 258 | 23.5k | ossl_sha3_init(ctx, pad, bitlen); \ | 259 | 23.5k | SHA3_SET_MD(uname, typ) \ | 260 | 23.5k | return ctx; \ | 261 | 23.5k | } |
sha3_prov.c:shake_128_newctx Line | Count | Source | 251 | 43.7k | static void *name##_newctx(void *provctx) \ | 252 | 43.7k | { \ | 253 | 43.7k | KECCAK1600_CTX *ctx = ossl_prov_is_running() ? OPENSSL_zalloc(sizeof(*ctx)) \ | 254 | 43.7k | : NULL; \ | 255 | 43.7k | \ | 256 | 43.7k | if (ctx == NULL) \ | 257 | 43.7k | return NULL; \ | 258 | 43.7k | ossl_sha3_init(ctx, pad, bitlen); \ | 259 | 43.7k | SHA3_SET_MD(uname, typ) \ | 260 | 43.7k | return ctx; \ | 261 | 43.7k | } |
sha3_prov.c:shake_256_newctx Line | Count | Source | 251 | 29.1k | static void *name##_newctx(void *provctx) \ | 252 | 29.1k | { \ | 253 | 29.1k | KECCAK1600_CTX *ctx = ossl_prov_is_running() ? OPENSSL_zalloc(sizeof(*ctx)) \ | 254 | 29.1k | : NULL; \ | 255 | 29.1k | \ | 256 | 29.1k | if (ctx == NULL) \ | 257 | 29.1k | return NULL; \ | 258 | 29.1k | ossl_sha3_init(ctx, pad, bitlen); \ | 259 | 29.1k | SHA3_SET_MD(uname, typ) \ | 260 | 29.1k | return ctx; \ | 261 | 29.1k | } |
|
262 | | |
263 | | #define KMAC_newctx(uname, bitlen, pad) \ |
264 | | static OSSL_FUNC_digest_newctx_fn uname##_newctx; \ |
265 | 88 | static void *uname##_newctx(void *provctx) \ |
266 | 88 | { \ |
267 | 88 | KECCAK1600_CTX *ctx = ossl_prov_is_running() ? OPENSSL_zalloc(sizeof(*ctx)) \ |
268 | 88 | : NULL; \ |
269 | 88 | \ |
270 | 88 | if (ctx == NULL) \ |
271 | 88 | return NULL; \ |
272 | 88 | ossl_keccak_kmac_init(ctx, pad, bitlen); \ |
273 | 88 | KMAC_SET_MD(bitlen) \ |
274 | 88 | return ctx; \ |
275 | 88 | } sha3_prov.c:keccak_kmac_128_newctx Line | Count | Source | 265 | 17 | static void *uname##_newctx(void *provctx) \ | 266 | 17 | { \ | 267 | 17 | KECCAK1600_CTX *ctx = ossl_prov_is_running() ? OPENSSL_zalloc(sizeof(*ctx)) \ | 268 | 17 | : NULL; \ | 269 | 17 | \ | 270 | 17 | if (ctx == NULL) \ | 271 | 17 | return NULL; \ | 272 | 17 | ossl_keccak_kmac_init(ctx, pad, bitlen); \ | 273 | 17 | KMAC_SET_MD(bitlen) \ | 274 | 17 | return ctx; \ | 275 | 17 | } |
sha3_prov.c:keccak_kmac_256_newctx Line | Count | Source | 265 | 71 | static void *uname##_newctx(void *provctx) \ | 266 | 71 | { \ | 267 | 71 | KECCAK1600_CTX *ctx = ossl_prov_is_running() ? OPENSSL_zalloc(sizeof(*ctx)) \ | 268 | 71 | : NULL; \ | 269 | 71 | \ | 270 | 71 | if (ctx == NULL) \ | 271 | 71 | return NULL; \ | 272 | 71 | ossl_keccak_kmac_init(ctx, pad, bitlen); \ | 273 | 71 | KMAC_SET_MD(bitlen) \ | 274 | 71 | return ctx; \ | 275 | 71 | } |
|
276 | | |
277 | | #define PROV_FUNC_SHA3_DIGEST_COMMON(name, bitlen, blksize, dgstsize, flags) \ |
278 | | PROV_FUNC_DIGEST_GET_PARAM(name, blksize, dgstsize, flags) \ |
279 | | const OSSL_DISPATCH ossl_##name##_functions[] = { \ |
280 | | { OSSL_FUNC_DIGEST_NEWCTX, (void (*)(void))name##_newctx }, \ |
281 | | { OSSL_FUNC_DIGEST_UPDATE, (void (*)(void))keccak_update }, \ |
282 | | { OSSL_FUNC_DIGEST_FINAL, (void (*)(void))keccak_final }, \ |
283 | | { OSSL_FUNC_DIGEST_FREECTX, (void (*)(void))keccak_freectx }, \ |
284 | | { OSSL_FUNC_DIGEST_DUPCTX, (void (*)(void))keccak_dupctx }, \ |
285 | | PROV_DISPATCH_FUNC_DIGEST_GET_PARAMS(name) |
286 | | |
287 | | #define PROV_FUNC_SHA3_DIGEST(name, bitlen, blksize, dgstsize, flags) \ |
288 | | PROV_FUNC_SHA3_DIGEST_COMMON(name, bitlen, blksize, dgstsize, flags), \ |
289 | | { OSSL_FUNC_DIGEST_INIT, (void (*)(void))keccak_init }, \ |
290 | | PROV_DISPATCH_FUNC_DIGEST_CONSTRUCT_END |
291 | | |
292 | | #define PROV_FUNC_SHAKE_DIGEST(name, bitlen, blksize, dgstsize, flags) \ |
293 | | PROV_FUNC_SHA3_DIGEST_COMMON(name, bitlen, blksize, dgstsize, flags), \ |
294 | | { OSSL_FUNC_DIGEST_INIT, (void (*)(void))keccak_init_params }, \ |
295 | | { OSSL_FUNC_DIGEST_SET_CTX_PARAMS, (void (*)(void))shake_set_ctx_params }, \ |
296 | | { OSSL_FUNC_DIGEST_SETTABLE_CTX_PARAMS, \ |
297 | | (void (*)(void))shake_settable_ctx_params }, \ |
298 | | PROV_DISPATCH_FUNC_DIGEST_CONSTRUCT_END |
299 | | |
300 | | static void keccak_freectx(void *vctx) |
301 | 243k | { |
302 | 243k | KECCAK1600_CTX *ctx = (KECCAK1600_CTX *)vctx; |
303 | | |
304 | 243k | OPENSSL_clear_free(ctx, sizeof(*ctx)); |
305 | 243k | } |
306 | | |
307 | | static void *keccak_dupctx(void *ctx) |
308 | 301 | { |
309 | 301 | KECCAK1600_CTX *in = (KECCAK1600_CTX *)ctx; |
310 | 301 | KECCAK1600_CTX *ret = ossl_prov_is_running() ? OPENSSL_malloc(sizeof(*ret)) |
311 | 301 | : NULL; |
312 | | |
313 | 301 | if (ret != NULL) |
314 | 301 | *ret = *in; |
315 | 301 | return ret; |
316 | 301 | } |
317 | | |
318 | | static const OSSL_PARAM known_shake_settable_ctx_params[] = { |
319 | | {OSSL_DIGEST_PARAM_XOFLEN, OSSL_PARAM_UNSIGNED_INTEGER, NULL, 0, 0}, |
320 | | OSSL_PARAM_END |
321 | | }; |
322 | | static const OSSL_PARAM *shake_settable_ctx_params(ossl_unused void *ctx, |
323 | | ossl_unused void *provctx) |
324 | 3 | { |
325 | 3 | return known_shake_settable_ctx_params; |
326 | 3 | } |
327 | | |
328 | | static int shake_set_ctx_params(void *vctx, const OSSL_PARAM params[]) |
329 | 96.0k | { |
330 | 96.0k | const OSSL_PARAM *p; |
331 | 96.0k | KECCAK1600_CTX *ctx = (KECCAK1600_CTX *)vctx; |
332 | | |
333 | 96.0k | if (ctx == NULL) |
334 | 0 | return 0; |
335 | 96.0k | if (params == NULL) |
336 | 96.0k | return 1; |
337 | | |
338 | 78 | p = OSSL_PARAM_locate_const(params, OSSL_DIGEST_PARAM_XOFLEN); |
339 | 78 | if (p != NULL && !OSSL_PARAM_get_size_t(p, &ctx->md_size)) { |
340 | 0 | ERR_raise(ERR_LIB_PROV, PROV_R_FAILED_TO_GET_PARAMETER); |
341 | 0 | return 0; |
342 | 0 | } |
343 | 78 | return 1; |
344 | 78 | } |
345 | | |
346 | | #define IMPLEMENT_SHA3_functions(bitlen) \ |
347 | | SHA3_newctx(sha3, SHA3_##bitlen, sha3_##bitlen, bitlen, '\x06') \ |
348 | | PROV_FUNC_SHA3_DIGEST(sha3_##bitlen, bitlen, \ |
349 | | SHA3_BLOCKSIZE(bitlen), SHA3_MDSIZE(bitlen), \ |
350 | | SHA3_FLAGS) |
351 | | |
352 | | #define IMPLEMENT_SHAKE_functions(bitlen) \ |
353 | | SHA3_newctx(shake, SHAKE_##bitlen, shake_##bitlen, bitlen, '\x1f') \ |
354 | | PROV_FUNC_SHAKE_DIGEST(shake_##bitlen, bitlen, \ |
355 | | SHA3_BLOCKSIZE(bitlen), SHA3_MDSIZE(bitlen), \ |
356 | | SHAKE_FLAGS) |
357 | | #define IMPLEMENT_KMAC_functions(bitlen) \ |
358 | | KMAC_newctx(keccak_kmac_##bitlen, bitlen, '\x04') \ |
359 | | PROV_FUNC_SHAKE_DIGEST(keccak_kmac_##bitlen, bitlen, \ |
360 | | SHA3_BLOCKSIZE(bitlen), KMAC_MDSIZE(bitlen), \ |
361 | | KMAC_FLAGS) |
362 | | |
363 | | /* ossl_sha3_224_functions */ |
364 | | IMPLEMENT_SHA3_functions(224) |
365 | | /* ossl_sha3_256_functions */ |
366 | | IMPLEMENT_SHA3_functions(256) |
367 | | /* ossl_sha3_384_functions */ |
368 | | IMPLEMENT_SHA3_functions(384) |
369 | | /* ossl_sha3_512_functions */ |
370 | | IMPLEMENT_SHA3_functions(512) |
371 | | /* ossl_shake_128_functions */ |
372 | | IMPLEMENT_SHAKE_functions(128) |
373 | | /* ossl_shake_256_functions */ |
374 | | IMPLEMENT_SHAKE_functions(256) |
375 | | /* ossl_keccak_kmac_128_functions */ |
376 | | IMPLEMENT_KMAC_functions(128) |
377 | | /* ossl_keccak_kmac_256_functions */ |
378 | | IMPLEMENT_KMAC_functions(256) |