/src/openssl41/providers/implementations/kem/rsa_kem.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 <openssl/e_os2.h> |
16 | | #include "internal/common.h" |
17 | | #include "prov/proverr.h" |
18 | | |
19 | | /* Machine generated */ |
20 | | #ifndef rsakem_get_ctx_params_list |
21 | | static ossl_unused const OSSL_PARAM rsakem_get_ctx_params_list[] = { |
22 | | # if defined(FIPS_MODULE) |
23 | | OSSL_PARAM_int(OSSL_KEM_PARAM_FIPS_APPROVED_INDICATOR, NULL), |
24 | | # endif |
25 | | OSSL_PARAM_END |
26 | | }; |
27 | | #endif |
28 | | |
29 | | #ifndef rsakem_get_ctx_params_st |
30 | | struct rsakem_get_ctx_params_st { |
31 | | # if defined(FIPS_MODULE) |
32 | | OSSL_PARAM *ind; |
33 | | # else |
34 | | int dummy; /* unused */ |
35 | | # endif |
36 | | }; |
37 | | #endif |
38 | | |
39 | | #ifndef rsakem_get_ctx_params_decoder |
40 | | static ossl_unused int rsakem_get_ctx_params_decoder |
41 | | (const OSSL_PARAM *p, struct rsakem_get_ctx_params_st *r) |
42 | 0 | { |
43 | 0 | const char *s; |
44 | |
|
45 | 0 | memset(r, 0, sizeof(*r)); |
46 | 0 | if (p != NULL) |
47 | 0 | for (; (s = p->key) != NULL; p++) |
48 | | # if defined(FIPS_MODULE) |
49 | | if (ossl_likely(strcmp("fips-indicator", s + 0) == 0)) { |
50 | | /* OSSL_KEM_PARAM_FIPS_APPROVED_INDICATOR */ |
51 | | if (ossl_unlikely(r->ind != NULL)) { |
52 | | ERR_raise_data(ERR_LIB_PROV, PROV_R_REPEATED_PARAMETER, |
53 | | "param %s is repeated", s); |
54 | | return 0; |
55 | | } |
56 | | r->ind = (OSSL_PARAM *)p; |
57 | | } |
58 | | # else |
59 | 0 | ; |
60 | 0 | # endif |
61 | 0 | return 1; |
62 | 0 | } |
63 | | #endif |
64 | | /* End of machine generated */ |
65 | | |
66 | | /* Machine generated */ |
67 | | #ifndef rsakem_set_ctx_params_list |
68 | | static ossl_unused const OSSL_PARAM rsakem_set_ctx_params_list[] = { |
69 | | OSSL_PARAM_utf8_string(OSSL_KEM_PARAM_OPERATION, NULL, 0), |
70 | | # if defined(FIPS_MODULE) |
71 | | OSSL_PARAM_int(OSSL_KEM_PARAM_FIPS_KEY_CHECK, NULL), |
72 | | # endif |
73 | | OSSL_PARAM_END |
74 | | }; |
75 | | #endif |
76 | | |
77 | | #ifndef rsakem_set_ctx_params_st |
78 | | struct rsakem_set_ctx_params_st { |
79 | | # if defined(FIPS_MODULE) |
80 | | OSSL_PARAM *ind_k; |
81 | | # endif |
82 | | OSSL_PARAM *op; |
83 | | }; |
84 | | #endif |
85 | | |
86 | | #ifndef rsakem_set_ctx_params_decoder |
87 | | static ossl_unused int rsakem_set_ctx_params_decoder |
88 | | (const OSSL_PARAM *p, struct rsakem_set_ctx_params_st *r) |
89 | 0 | { |
90 | 0 | const char *s; |
91 | |
|
92 | 0 | memset(r, 0, sizeof(*r)); |
93 | 0 | if (p != NULL) |
94 | 0 | for (; (s = p->key) != NULL; p++) |
95 | 0 | switch(s[0]) { |
96 | 0 | default: |
97 | 0 | break; |
98 | 0 | case 'k': |
99 | | # if defined(FIPS_MODULE) |
100 | | if (ossl_likely(strcmp("ey-check", s + 1) == 0)) { |
101 | | /* OSSL_KEM_PARAM_FIPS_KEY_CHECK */ |
102 | | if (ossl_unlikely(r->ind_k != NULL)) { |
103 | | ERR_raise_data(ERR_LIB_PROV, PROV_R_REPEATED_PARAMETER, |
104 | | "param %s is repeated", s); |
105 | | return 0; |
106 | | } |
107 | | r->ind_k = (OSSL_PARAM *)p; |
108 | | } |
109 | | # endif |
110 | 0 | break; |
111 | 0 | case 'o': |
112 | 0 | if (ossl_likely(strcmp("peration", s + 1) == 0)) { |
113 | | /* OSSL_KEM_PARAM_OPERATION */ |
114 | 0 | if (ossl_unlikely(r->op != NULL)) { |
115 | 0 | ERR_raise_data(ERR_LIB_PROV, PROV_R_REPEATED_PARAMETER, |
116 | 0 | "param %s is repeated", s); |
117 | 0 | return 0; |
118 | 0 | } |
119 | 0 | r->op = (OSSL_PARAM *)p; |
120 | 0 | } |
121 | 0 | } |
122 | 0 | return 1; |
123 | 0 | } |
124 | | #endif |
125 | | /* End of machine generated */ |