/src/openssl/providers/implementations/kdfs/pkcs12kdf.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 pkcs12_set_ctx_params_list |
19 | | static const OSSL_PARAM pkcs12_set_ctx_params_list[] = { |
20 | | OSSL_PARAM_utf8_string(OSSL_KDF_PARAM_PROPERTIES, NULL, 0), |
21 | | OSSL_PARAM_utf8_string(OSSL_KDF_PARAM_DIGEST, NULL, 0), |
22 | | OSSL_PARAM_octet_string(OSSL_KDF_PARAM_PASSWORD, NULL, 0), |
23 | | OSSL_PARAM_octet_string(OSSL_KDF_PARAM_SALT, NULL, 0), |
24 | | OSSL_PARAM_uint64(OSSL_KDF_PARAM_ITER, NULL), |
25 | | OSSL_PARAM_int(OSSL_KDF_PARAM_PKCS12_ID, NULL), |
26 | | OSSL_PARAM_END |
27 | | }; |
28 | | #endif |
29 | | |
30 | | #ifndef pkcs12_set_ctx_params_st |
31 | | struct pkcs12_set_ctx_params_st { |
32 | | OSSL_PARAM *digest; |
33 | | OSSL_PARAM *iter; |
34 | | OSSL_PARAM *p12id; |
35 | | OSSL_PARAM *propq; |
36 | | OSSL_PARAM *pw; |
37 | | OSSL_PARAM *salt; |
38 | | }; |
39 | | #endif |
40 | | |
41 | | #ifndef pkcs12_set_ctx_params_decoder |
42 | | static int pkcs12_set_ctx_params_decoder |
43 | | (const OSSL_PARAM *p, struct pkcs12_set_ctx_params_st *r) |
44 | 0 | { |
45 | 0 | const char *s; |
46 | |
|
47 | 0 | memset(r, 0, sizeof(*r)); |
48 | 0 | if (p != NULL) |
49 | 0 | for (; (s = p->key) != NULL; p++) |
50 | 0 | switch(s[0]) { |
51 | 0 | default: |
52 | 0 | break; |
53 | 0 | case 'd': |
54 | 0 | if (ossl_likely(strcmp("igest", s + 1) == 0)) { |
55 | | /* OSSL_KDF_PARAM_DIGEST */ |
56 | 0 | if (ossl_unlikely(r->digest != NULL)) { |
57 | 0 | ERR_raise_data(ERR_LIB_PROV, PROV_R_REPEATED_PARAMETER, |
58 | 0 | "param %s is repeated", s); |
59 | 0 | return 0; |
60 | 0 | } |
61 | 0 | r->digest = (OSSL_PARAM *)p; |
62 | 0 | } |
63 | 0 | break; |
64 | 0 | case 'i': |
65 | 0 | switch(s[1]) { |
66 | 0 | default: |
67 | 0 | break; |
68 | 0 | case 'd': |
69 | 0 | switch(s[2]) { |
70 | 0 | default: |
71 | 0 | break; |
72 | 0 | case '\0': |
73 | 0 | if (ossl_unlikely(r->p12id != NULL)) { |
74 | 0 | ERR_raise_data(ERR_LIB_PROV, PROV_R_REPEATED_PARAMETER, |
75 | 0 | "param %s is repeated", s); |
76 | 0 | return 0; |
77 | 0 | } |
78 | 0 | r->p12id = (OSSL_PARAM *)p; |
79 | 0 | } |
80 | 0 | break; |
81 | 0 | case 't': |
82 | 0 | if (ossl_likely(strcmp("er", s + 2) == 0)) { |
83 | | /* OSSL_KDF_PARAM_ITER */ |
84 | 0 | if (ossl_unlikely(r->iter != NULL)) { |
85 | 0 | ERR_raise_data(ERR_LIB_PROV, PROV_R_REPEATED_PARAMETER, |
86 | 0 | "param %s is repeated", s); |
87 | 0 | return 0; |
88 | 0 | } |
89 | 0 | r->iter = (OSSL_PARAM *)p; |
90 | 0 | } |
91 | 0 | } |
92 | 0 | break; |
93 | 0 | case 'p': |
94 | 0 | switch(s[1]) { |
95 | 0 | default: |
96 | 0 | break; |
97 | 0 | case 'a': |
98 | 0 | if (ossl_likely(strcmp("ss", s + 2) == 0)) { |
99 | | /* OSSL_KDF_PARAM_PASSWORD */ |
100 | 0 | if (ossl_unlikely(r->pw != NULL)) { |
101 | 0 | ERR_raise_data(ERR_LIB_PROV, PROV_R_REPEATED_PARAMETER, |
102 | 0 | "param %s is repeated", s); |
103 | 0 | return 0; |
104 | 0 | } |
105 | 0 | r->pw = (OSSL_PARAM *)p; |
106 | 0 | } |
107 | 0 | break; |
108 | 0 | case 'r': |
109 | 0 | if (ossl_likely(strcmp("operties", s + 2) == 0)) { |
110 | | /* OSSL_KDF_PARAM_PROPERTIES */ |
111 | 0 | if (ossl_unlikely(r->propq != NULL)) { |
112 | 0 | ERR_raise_data(ERR_LIB_PROV, PROV_R_REPEATED_PARAMETER, |
113 | 0 | "param %s is repeated", s); |
114 | 0 | return 0; |
115 | 0 | } |
116 | 0 | r->propq = (OSSL_PARAM *)p; |
117 | 0 | } |
118 | 0 | } |
119 | 0 | break; |
120 | 0 | case 's': |
121 | 0 | if (ossl_likely(strcmp("alt", s + 1) == 0)) { |
122 | | /* OSSL_KDF_PARAM_SALT */ |
123 | 0 | if (ossl_unlikely(r->salt != NULL)) { |
124 | 0 | ERR_raise_data(ERR_LIB_PROV, PROV_R_REPEATED_PARAMETER, |
125 | 0 | "param %s is repeated", s); |
126 | 0 | return 0; |
127 | 0 | } |
128 | 0 | r->salt = (OSSL_PARAM *)p; |
129 | 0 | } |
130 | 0 | } |
131 | 0 | return 1; |
132 | 0 | } |
133 | | #endif |
134 | | /* End of machine generated */ |
135 | | |
136 | | /* Machine generated by util/perl/OpenSSL/paramnames.pm */ |
137 | | #include <string.h> |
138 | | #include <openssl/params.h> |
139 | | #include "internal/common.h" |
140 | | #include "prov/proverr.h" |
141 | | |
142 | | #ifndef pkcs12_get_ctx_params_list |
143 | | static const OSSL_PARAM pkcs12_get_ctx_params_list[] = { |
144 | | OSSL_PARAM_size_t(OSSL_KDF_PARAM_SIZE, NULL), |
145 | | OSSL_PARAM_END |
146 | | }; |
147 | | #endif |
148 | | |
149 | | #ifndef pkcs12_get_ctx_params_st |
150 | | struct pkcs12_get_ctx_params_st { |
151 | | OSSL_PARAM *size; |
152 | | }; |
153 | | #endif |
154 | | |
155 | | #ifndef pkcs12_get_ctx_params_decoder |
156 | | static int pkcs12_get_ctx_params_decoder |
157 | | (const OSSL_PARAM *p, struct pkcs12_get_ctx_params_st *r) |
158 | 0 | { |
159 | 0 | const char *s; |
160 | |
|
161 | 0 | memset(r, 0, sizeof(*r)); |
162 | 0 | if (p != NULL) |
163 | 0 | for (; (s = p->key) != NULL; p++) |
164 | 0 | if (ossl_likely(strcmp("size", s + 0) == 0)) { |
165 | | /* OSSL_KDF_PARAM_SIZE */ |
166 | 0 | if (ossl_unlikely(r->size != NULL)) { |
167 | 0 | ERR_raise_data(ERR_LIB_PROV, PROV_R_REPEATED_PARAMETER, |
168 | 0 | "param %s is repeated", s); |
169 | 0 | return 0; |
170 | 0 | } |
171 | 0 | r->size = (OSSL_PARAM *)p; |
172 | 0 | } |
173 | 0 | return 1; |
174 | 0 | } |
175 | | #endif |
176 | | /* End of machine generated */ |