/src/openssl41/providers/implementations/digests/sha3_prov.inc
Line | Count | Source |
1 | | /* |
2 | | * Copyright 2025 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 | | |
11 | | |
12 | | /* Machine generated by util/perl/OpenSSL/paramnames.pm */ |
13 | | #include <string.h> |
14 | | #include <openssl/params.h> |
15 | | #include <openssl/e_os2.h> |
16 | | #include "internal/common.h" |
17 | | #include "prov/proverr.h" |
18 | | |
19 | | /* Machine generated */ |
20 | | #ifndef shake_get_ctx_params_list |
21 | | static ossl_unused const OSSL_PARAM shake_get_ctx_params_list[] = { |
22 | | OSSL_PARAM_size_t(OSSL_DIGEST_PARAM_XOFLEN, NULL), |
23 | | OSSL_PARAM_size_t(OSSL_DIGEST_PARAM_SIZE, NULL), |
24 | | OSSL_PARAM_END |
25 | | }; |
26 | | #endif |
27 | | |
28 | | #ifndef shake_get_ctx_params_st |
29 | | struct shake_get_ctx_params_st { |
30 | | OSSL_PARAM *size; |
31 | | OSSL_PARAM *xoflen; |
32 | | }; |
33 | | #endif |
34 | | |
35 | | #ifndef shake_get_ctx_params_decoder |
36 | | static ossl_unused int shake_get_ctx_params_decoder |
37 | | (const OSSL_PARAM *p, struct shake_get_ctx_params_st *r) |
38 | 182 | { |
39 | 182 | const char *s; |
40 | | |
41 | 182 | memset(r, 0, sizeof(*r)); |
42 | 182 | if (p != NULL) |
43 | 364 | for (; (s = p->key) != NULL; p++) |
44 | 182 | switch(s[0]) { |
45 | 0 | default: |
46 | 0 | break; |
47 | 182 | case 's': |
48 | 182 | if (ossl_likely(strcmp("ize", s + 1) == 0)) { |
49 | | /* OSSL_DIGEST_PARAM_SIZE */ |
50 | 182 | if (ossl_unlikely(r->size != NULL)) { |
51 | 0 | ERR_raise_data(ERR_LIB_PROV, PROV_R_REPEATED_PARAMETER, |
52 | 0 | "param %s is repeated", s); |
53 | 0 | return 0; |
54 | 0 | } |
55 | 182 | r->size = (OSSL_PARAM *)p; |
56 | 182 | } |
57 | 182 | break; |
58 | 182 | case 'x': |
59 | 0 | if (ossl_likely(strcmp("oflen", s + 1) == 0)) { |
60 | | /* OSSL_DIGEST_PARAM_XOFLEN */ |
61 | 0 | if (ossl_unlikely(r->xoflen != NULL)) { |
62 | 0 | ERR_raise_data(ERR_LIB_PROV, PROV_R_REPEATED_PARAMETER, |
63 | 0 | "param %s is repeated", s); |
64 | 0 | return 0; |
65 | 0 | } |
66 | 0 | r->xoflen = (OSSL_PARAM *)p; |
67 | 0 | } |
68 | 182 | } |
69 | 182 | return 1; |
70 | 182 | } |
71 | | #endif |
72 | | /* End of machine generated */ |
73 | | |
74 | | /* Machine generated */ |
75 | | #ifndef shake_set_ctx_params_list |
76 | | static ossl_unused const OSSL_PARAM shake_set_ctx_params_list[] = { |
77 | | OSSL_PARAM_size_t(OSSL_DIGEST_PARAM_XOFLEN, NULL), |
78 | | OSSL_PARAM_size_t(OSSL_DIGEST_PARAM_SIZE, NULL), |
79 | | OSSL_PARAM_END |
80 | | }; |
81 | | #endif |
82 | | |
83 | | #ifndef shake_set_ctx_params_st |
84 | | struct shake_set_ctx_params_st { |
85 | | OSSL_PARAM *xoflen; |
86 | | }; |
87 | | #endif |
88 | | |
89 | | #ifndef shake_set_ctx_params_decoder |
90 | | static ossl_unused int shake_set_ctx_params_decoder |
91 | | (const OSSL_PARAM *p, struct shake_set_ctx_params_st *r) |
92 | 294M | { |
93 | 294M | const char *s; |
94 | | |
95 | 294M | memset(r, 0, sizeof(*r)); |
96 | 294M | if (p != NULL) |
97 | 293M | for (; (s = p->key) != NULL; p++) |
98 | 146M | switch(s[0]) { |
99 | 0 | default: |
100 | 0 | break; |
101 | 4 | case 's': |
102 | 4 | if (ossl_likely(strcmp("ize", s + 1) == 0)) { |
103 | | /* OSSL_DIGEST_PARAM_SIZE */ |
104 | 4 | if (ossl_unlikely(r->xoflen != NULL)) { |
105 | 4 | ERR_raise_data(ERR_LIB_PROV, PROV_R_REPEATED_PARAMETER, |
106 | 4 | "param %s is repeated", s); |
107 | 4 | return 0; |
108 | 4 | } |
109 | 0 | r->xoflen = (OSSL_PARAM *)p; |
110 | 0 | } |
111 | 0 | break; |
112 | 146M | case 'x': |
113 | 146M | if (ossl_likely(strcmp("oflen", s + 1) == 0)) { |
114 | | /* OSSL_DIGEST_PARAM_XOFLEN */ |
115 | 146M | if (ossl_unlikely(r->xoflen != NULL)) { |
116 | 0 | ERR_raise_data(ERR_LIB_PROV, PROV_R_REPEATED_PARAMETER, |
117 | 0 | "param %s is repeated", s); |
118 | 0 | return 0; |
119 | 0 | } |
120 | 146M | r->xoflen = (OSSL_PARAM *)p; |
121 | 146M | } |
122 | 146M | } |
123 | 294M | return 1; |
124 | 294M | } |
125 | | #endif |
126 | | /* End of machine generated */ |