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