/src/openssl/providers/implementations/signature/slh_dsa_sig.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 slh_dsa_set_ctx_params_list |
19 | | static const OSSL_PARAM slh_dsa_set_ctx_params_list[] = { |
20 | | OSSL_PARAM_octet_string(OSSL_SIGNATURE_PARAM_CONTEXT_STRING, NULL, 0), |
21 | | OSSL_PARAM_octet_string(OSSL_SIGNATURE_PARAM_TEST_ENTROPY, NULL, 0), |
22 | | OSSL_PARAM_int(OSSL_SIGNATURE_PARAM_DETERMINISTIC, NULL), |
23 | | OSSL_PARAM_int(OSSL_SIGNATURE_PARAM_MESSAGE_ENCODING, NULL), |
24 | | OSSL_PARAM_END |
25 | | }; |
26 | | #endif |
27 | | |
28 | | #ifndef slh_dsa_set_ctx_params_st |
29 | | struct slh_dsa_set_ctx_params_st { |
30 | | OSSL_PARAM *context; |
31 | | OSSL_PARAM *det; |
32 | | OSSL_PARAM *entropy; |
33 | | OSSL_PARAM *msgenc; |
34 | | }; |
35 | | #endif |
36 | | |
37 | | #ifndef slh_dsa_set_ctx_params_decoder |
38 | | static int slh_dsa_set_ctx_params_decoder |
39 | | (const OSSL_PARAM *p, struct slh_dsa_set_ctx_params_st *r) |
40 | 1.51k | { |
41 | 1.51k | const char *s; |
42 | | |
43 | 1.51k | memset(r, 0, sizeof(*r)); |
44 | 1.51k | if (p != NULL) |
45 | 3.09k | for (; (s = p->key) != NULL; p++) |
46 | 1.58k | switch(s[0]) { |
47 | 0 | default: |
48 | 0 | break; |
49 | 392 | case 'c': |
50 | 392 | if (ossl_likely(strcmp("ontext-string", s + 1) == 0)) { |
51 | | /* OSSL_SIGNATURE_PARAM_CONTEXT_STRING */ |
52 | 392 | if (ossl_unlikely(r->context != NULL)) { |
53 | 0 | ERR_raise_data(ERR_LIB_PROV, PROV_R_REPEATED_PARAMETER, |
54 | 0 | "param %s is repeated", s); |
55 | 0 | return 0; |
56 | 0 | } |
57 | 392 | r->context = (OSSL_PARAM *)p; |
58 | 392 | } |
59 | 392 | break; |
60 | 723 | case 'd': |
61 | 723 | if (ossl_likely(strcmp("eterministic", s + 1) == 0)) { |
62 | | /* OSSL_SIGNATURE_PARAM_DETERMINISTIC */ |
63 | 723 | if (ossl_unlikely(r->det != NULL)) { |
64 | 0 | ERR_raise_data(ERR_LIB_PROV, PROV_R_REPEATED_PARAMETER, |
65 | 0 | "param %s is repeated", s); |
66 | 0 | return 0; |
67 | 0 | } |
68 | 723 | r->det = (OSSL_PARAM *)p; |
69 | 723 | } |
70 | 723 | break; |
71 | 723 | case 'm': |
72 | 469 | if (ossl_likely(strcmp("essage-encoding", s + 1) == 0)) { |
73 | | /* OSSL_SIGNATURE_PARAM_MESSAGE_ENCODING */ |
74 | 469 | if (ossl_unlikely(r->msgenc != NULL)) { |
75 | 0 | ERR_raise_data(ERR_LIB_PROV, PROV_R_REPEATED_PARAMETER, |
76 | 0 | "param %s is repeated", s); |
77 | 0 | return 0; |
78 | 0 | } |
79 | 469 | r->msgenc = (OSSL_PARAM *)p; |
80 | 469 | } |
81 | 469 | break; |
82 | 469 | case 't': |
83 | 0 | if (ossl_likely(strcmp("est-entropy", s + 1) == 0)) { |
84 | | /* OSSL_SIGNATURE_PARAM_TEST_ENTROPY */ |
85 | 0 | if (ossl_unlikely(r->entropy != NULL)) { |
86 | 0 | ERR_raise_data(ERR_LIB_PROV, PROV_R_REPEATED_PARAMETER, |
87 | 0 | "param %s is repeated", s); |
88 | 0 | return 0; |
89 | 0 | } |
90 | 0 | r->entropy = (OSSL_PARAM *)p; |
91 | 0 | } |
92 | 1.58k | } |
93 | 1.51k | return 1; |
94 | 1.51k | } |
95 | | #endif |
96 | | /* End of machine generated */ |
97 | | |
98 | | /* Machine generated by util/perl/OpenSSL/paramnames.pm */ |
99 | | #include <string.h> |
100 | | #include <openssl/params.h> |
101 | | #include "internal/common.h" |
102 | | #include "prov/proverr.h" |
103 | | |
104 | | #ifndef slh_dsa_get_ctx_params_list |
105 | | static const OSSL_PARAM slh_dsa_get_ctx_params_list[] = { |
106 | | OSSL_PARAM_octet_string(OSSL_SIGNATURE_PARAM_ALGORITHM_ID, NULL, 0), |
107 | | OSSL_PARAM_END |
108 | | }; |
109 | | #endif |
110 | | |
111 | | #ifndef slh_dsa_get_ctx_params_st |
112 | | struct slh_dsa_get_ctx_params_st { |
113 | | OSSL_PARAM *algid; |
114 | | }; |
115 | | #endif |
116 | | |
117 | | #ifndef slh_dsa_get_ctx_params_decoder |
118 | | static int slh_dsa_get_ctx_params_decoder |
119 | | (const OSSL_PARAM *p, struct slh_dsa_get_ctx_params_st *r) |
120 | 0 | { |
121 | 0 | const char *s; |
122 | |
|
123 | 0 | memset(r, 0, sizeof(*r)); |
124 | 0 | if (p != NULL) |
125 | 0 | for (; (s = p->key) != NULL; p++) |
126 | 0 | if (ossl_likely(strcmp("algorithm-id", s + 0) == 0)) { |
127 | | /* OSSL_SIGNATURE_PARAM_ALGORITHM_ID */ |
128 | 0 | if (ossl_unlikely(r->algid != NULL)) { |
129 | 0 | ERR_raise_data(ERR_LIB_PROV, PROV_R_REPEATED_PARAMETER, |
130 | 0 | "param %s is repeated", s); |
131 | 0 | return 0; |
132 | 0 | } |
133 | 0 | r->algid = (OSSL_PARAM *)p; |
134 | 0 | } |
135 | 0 | return 1; |
136 | 0 | } |
137 | | #endif |
138 | | /* End of machine generated */ |