/src/openssl41/providers/implementations/ciphers/cipher_cts.inc
Line | Count | Source |
1 | | /* |
2 | | * Copyright 2026 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 cipher_cts_get_ctx_params_list |
21 | | static ossl_unused const OSSL_PARAM cipher_cts_get_ctx_params_list[] = { |
22 | | OSSL_PARAM_size_t(OSSL_CIPHER_PARAM_KEYLEN, NULL), |
23 | | OSSL_PARAM_size_t(OSSL_CIPHER_PARAM_IVLEN, NULL), |
24 | | OSSL_PARAM_octet_string(OSSL_CIPHER_PARAM_IV, NULL, 0), |
25 | | OSSL_PARAM_octet_string(OSSL_CIPHER_PARAM_UPDATED_IV, NULL, 0), |
26 | | OSSL_PARAM_utf8_string(OSSL_CIPHER_PARAM_CTS_MODE, NULL, 0), |
27 | | OSSL_PARAM_END |
28 | | }; |
29 | | #endif |
30 | | |
31 | | #ifndef cipher_cts_get_ctx_params_st |
32 | | struct cipher_cts_get_ctx_params_st { |
33 | | OSSL_PARAM *common.iv; |
34 | | OSSL_PARAM *common.ivlen; |
35 | | OSSL_PARAM *common.keylen; |
36 | | OSSL_PARAM *common.updiv; |
37 | | OSSL_PARAM *mode; |
38 | | }; |
39 | | #endif |
40 | | |
41 | | #ifndef cipher_cts_get_ctx_params_decoder |
42 | | static ossl_unused int cipher_cts_get_ctx_params_decoder |
43 | | (const OSSL_PARAM *p, struct cipher_cts_get_ctx_params_st *r) |
44 | 18 | { |
45 | 18 | const char *s; |
46 | | |
47 | 18 | memset(r, 0, sizeof(*r)); |
48 | 18 | if (p != NULL) |
49 | 36 | for (; (s = p->key) != NULL; p++) |
50 | 18 | switch(s[0]) { |
51 | 0 | default: |
52 | 0 | break; |
53 | 0 | case 'c': |
54 | 0 | if (ossl_likely(strcmp("ts_mode", s + 1) == 0)) { |
55 | | /* OSSL_CIPHER_PARAM_CTS_MODE */ |
56 | 0 | if (ossl_unlikely(r->mode != 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->mode = (OSSL_PARAM *)p; |
62 | 0 | } |
63 | 0 | break; |
64 | 9 | case 'i': |
65 | 9 | switch(s[1]) { |
66 | 0 | default: |
67 | 0 | break; |
68 | 9 | case 'v': |
69 | 9 | switch(s[2]) { |
70 | 0 | default: |
71 | 0 | break; |
72 | 9 | case 'l': |
73 | 9 | if (ossl_likely(strcmp("en", s + 3) == 0)) { |
74 | | /* OSSL_CIPHER_PARAM_IVLEN */ |
75 | 9 | if (ossl_unlikely(r->common.ivlen != NULL)) { |
76 | 0 | ERR_raise_data(ERR_LIB_PROV, PROV_R_REPEATED_PARAMETER, |
77 | 0 | "param %s is repeated", s); |
78 | 0 | return 0; |
79 | 0 | } |
80 | 9 | r->common.ivlen = (OSSL_PARAM *)p; |
81 | 9 | } |
82 | 9 | break; |
83 | 9 | case '\0': |
84 | 0 | if (ossl_unlikely(r->common.iv != 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->common.iv = (OSSL_PARAM *)p; |
90 | 9 | } |
91 | 9 | } |
92 | 9 | break; |
93 | 9 | case 'k': |
94 | 9 | if (ossl_likely(strcmp("eylen", s + 1) == 0)) { |
95 | | /* OSSL_CIPHER_PARAM_KEYLEN */ |
96 | 9 | if (ossl_unlikely(r->common.keylen != NULL)) { |
97 | 0 | ERR_raise_data(ERR_LIB_PROV, PROV_R_REPEATED_PARAMETER, |
98 | 0 | "param %s is repeated", s); |
99 | 0 | return 0; |
100 | 0 | } |
101 | 9 | r->common.keylen = (OSSL_PARAM *)p; |
102 | 9 | } |
103 | 9 | break; |
104 | 9 | case 'u': |
105 | 0 | if (ossl_likely(strcmp("pdated-iv", s + 1) == 0)) { |
106 | | /* OSSL_CIPHER_PARAM_UPDATED_IV */ |
107 | 0 | if (ossl_unlikely(r->common.updiv != 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->common.updiv = (OSSL_PARAM *)p; |
113 | 0 | } |
114 | 18 | } |
115 | 18 | return 1; |
116 | 18 | } |
117 | | #endif |
118 | | /* End of machine generated */ |
119 | | |
120 | | /* Machine generated */ |
121 | | #ifndef cipher_cts_set_ctx_params_list |
122 | | static ossl_unused const OSSL_PARAM cipher_cts_set_ctx_params_list[] = { |
123 | | OSSL_PARAM_utf8_string(OSSL_CIPHER_PARAM_CTS_MODE, NULL, 0), |
124 | | OSSL_PARAM_END |
125 | | }; |
126 | | #endif |
127 | | |
128 | | #ifndef cipher_cts_set_ctx_params_st |
129 | | struct cipher_cts_set_ctx_params_st { |
130 | | OSSL_PARAM *mode; |
131 | | }; |
132 | | #endif |
133 | | |
134 | | #ifndef cipher_cts_set_ctx_params_decoder |
135 | | static ossl_unused int cipher_cts_set_ctx_params_decoder |
136 | | (const OSSL_PARAM *p, struct cipher_cts_set_ctx_params_st *r) |
137 | 18 | { |
138 | 18 | const char *s; |
139 | | |
140 | 18 | memset(r, 0, sizeof(*r)); |
141 | 18 | if (p != NULL) |
142 | 18 | for (; (s = p->key) != NULL; p++) |
143 | 9 | if (ossl_likely(strcmp("cts_mode", s + 0) == 0)) { |
144 | | /* OSSL_CIPHER_PARAM_CTS_MODE */ |
145 | 9 | if (ossl_unlikely(r->mode != NULL)) { |
146 | 0 | ERR_raise_data(ERR_LIB_PROV, PROV_R_REPEATED_PARAMETER, |
147 | 0 | "param %s is repeated", s); |
148 | 0 | return 0; |
149 | 0 | } |
150 | 9 | r->mode = (OSSL_PARAM *)p; |
151 | 9 | } |
152 | 18 | return 1; |
153 | 18 | } |
154 | | #endif |
155 | | /* End of machine generated */ |