/src/openssl/providers/implementations/encode_decode/encode_key2any.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 | | #ifndef key2any_set_ctx_params_list |
14 | | static const OSSL_PARAM key2any_set_ctx_params_list[] = { |
15 | | OSSL_PARAM_utf8_string(OSSL_ENCODER_PARAM_CIPHER, NULL, 0), |
16 | | OSSL_PARAM_utf8_string(OSSL_ENCODER_PARAM_PROPERTIES, NULL, 0), |
17 | | OSSL_PARAM_int(OSSL_ENCODER_PARAM_SAVE_PARAMETERS, NULL), |
18 | | OSSL_PARAM_END |
19 | | }; |
20 | | #endif |
21 | | |
22 | | #ifndef key2any_set_ctx_params_st |
23 | | struct key2any_set_ctx_params_st { |
24 | | OSSL_PARAM *cipher; |
25 | | OSSL_PARAM *propq; |
26 | | OSSL_PARAM *svprm; |
27 | | }; |
28 | | #endif |
29 | | |
30 | | #ifndef key2any_set_ctx_params_decoder |
31 | | static int key2any_set_ctx_params_decoder |
32 | | (const OSSL_PARAM *p, struct key2any_set_ctx_params_st *r) |
33 | 0 | { |
34 | 0 | const char *s; |
35 | |
|
36 | 0 | memset(r, 0, sizeof(*r)); |
37 | 0 | if (p != NULL) |
38 | 0 | for (; (s = p->key) != NULL; p++) |
39 | 0 | switch(s[0]) { |
40 | 0 | default: |
41 | 0 | break; |
42 | 0 | case 'c': |
43 | 0 | if (ossl_likely(strcmp("ipher", s + 1) == 0)) { |
44 | | /* OSSL_ENCODER_PARAM_CIPHER */ |
45 | 0 | if (ossl_unlikely(r->cipher != NULL)) { |
46 | 0 | ERR_raise_data(ERR_LIB_PROV, PROV_R_REPEATED_PARAMETER, |
47 | 0 | "param %s is repeated", s); |
48 | 0 | return 0; |
49 | 0 | } |
50 | 0 | r->cipher = (OSSL_PARAM *)p; |
51 | 0 | } |
52 | 0 | break; |
53 | 0 | case 'p': |
54 | 0 | if (ossl_likely(strcmp("roperties", s + 1) == 0)) { |
55 | | /* OSSL_ENCODER_PARAM_PROPERTIES */ |
56 | 0 | if (ossl_unlikely(r->propq != 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->propq = (OSSL_PARAM *)p; |
62 | 0 | } |
63 | 0 | break; |
64 | 0 | case 's': |
65 | 0 | if (ossl_likely(strcmp("ave-parameters", s + 1) == 0)) { |
66 | | /* OSSL_ENCODER_PARAM_SAVE_PARAMETERS */ |
67 | 0 | if (ossl_unlikely(r->svprm != NULL)) { |
68 | 0 | ERR_raise_data(ERR_LIB_PROV, PROV_R_REPEATED_PARAMETER, |
69 | 0 | "param %s is repeated", s); |
70 | 0 | return 0; |
71 | 0 | } |
72 | 0 | r->svprm = (OSSL_PARAM *)p; |
73 | 0 | } |
74 | 0 | } |
75 | 0 | return 1; |
76 | 0 | } |
77 | | #endif |
78 | | /* End of machine generated */ |