/src/openssl/providers/implementations/asymciphers/sm2_enc.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 sm2_get_ctx_params_list  | 
14  |  | static const OSSL_PARAM sm2_get_ctx_params_list[] = { | 
15  |  |     OSSL_PARAM_utf8_string(OSSL_ASYM_CIPHER_PARAM_DIGEST, NULL, 0),  | 
16  |  |     OSSL_PARAM_END  | 
17  |  | };  | 
18  |  | #endif  | 
19  |  |  | 
20  |  | #ifndef sm2_get_ctx_params_st  | 
21  |  | struct sm2_get_ctx_params_st { | 
22  |  |     OSSL_PARAM *digest;  | 
23  |  | };  | 
24  |  | #endif  | 
25  |  |  | 
26  |  | #ifndef sm2_get_ctx_params_decoder  | 
27  |  | static int sm2_get_ctx_params_decoder  | 
28  |  |     (const OSSL_PARAM *p, struct sm2_get_ctx_params_st *r)  | 
29  | 0  | { | 
30  | 0  |     const char *s;  | 
31  |  | 
  | 
32  | 0  |     memset(r, 0, sizeof(*r));  | 
33  | 0  |     if (p != NULL)  | 
34  | 0  |         for (; (s = p->key) != NULL; p++)  | 
35  | 0  |             if (ossl_likely(strcmp("digest", s + 0) == 0)) { | 
36  |  |                 /* OSSL_ASYM_CIPHER_PARAM_DIGEST */  | 
37  | 0  |                 if (ossl_unlikely(r->digest != NULL)) { | 
38  | 0  |                     ERR_raise_data(ERR_LIB_PROV, PROV_R_REPEATED_PARAMETER,  | 
39  | 0  |                                    "param %s is repeated", s);  | 
40  | 0  |                     return 0;  | 
41  | 0  |                 }  | 
42  | 0  |                 r->digest = (OSSL_PARAM *)p;  | 
43  | 0  |             }  | 
44  | 0  |     return 1;  | 
45  | 0  | }  | 
46  |  | #endif  | 
47  |  | /* End of machine generated */  | 
48  |  |  | 
49  |  | /* Machine generated by util/perl/OpenSSL/paramnames.pm */  | 
50  |  | #ifndef sm2_set_ctx_params_list  | 
51  |  | static const OSSL_PARAM sm2_set_ctx_params_list[] = { | 
52  |  |     OSSL_PARAM_utf8_string(OSSL_ASYM_CIPHER_PARAM_DIGEST, NULL, 0),  | 
53  |  |     OSSL_PARAM_utf8_string(OSSL_ASYM_CIPHER_PARAM_PROPERTIES, NULL, 0),  | 
54  |  |     OSSL_PARAM_END  | 
55  |  | };  | 
56  |  | #endif  | 
57  |  |  | 
58  |  | #ifndef sm2_set_ctx_params_st  | 
59  |  | struct sm2_set_ctx_params_st { | 
60  |  |     OSSL_PARAM *digest;  | 
61  |  |     OSSL_PARAM *engine;  | 
62  |  |     OSSL_PARAM *propq;  | 
63  |  | };  | 
64  |  | #endif  | 
65  |  |  | 
66  |  | #ifndef sm2_set_ctx_params_decoder  | 
67  |  | static int sm2_set_ctx_params_decoder  | 
68  |  |     (const OSSL_PARAM *p, struct sm2_set_ctx_params_st *r)  | 
69  | 0  | { | 
70  | 0  |     const char *s;  | 
71  |  | 
  | 
72  | 0  |     memset(r, 0, sizeof(*r));  | 
73  | 0  |     if (p != NULL)  | 
74  | 0  |         for (; (s = p->key) != NULL; p++)  | 
75  | 0  |             switch(s[0]) { | 
76  | 0  |             default:  | 
77  | 0  |                 break;  | 
78  | 0  |             case 'd':  | 
79  | 0  |                 if (ossl_likely(strcmp("igest", s + 1) == 0)) { | 
80  |  |                     /* OSSL_ASYM_CIPHER_PARAM_DIGEST */  | 
81  | 0  |                     if (ossl_unlikely(r->digest != NULL)) { | 
82  | 0  |                         ERR_raise_data(ERR_LIB_PROV, PROV_R_REPEATED_PARAMETER,  | 
83  | 0  |                                        "param %s is repeated", s);  | 
84  | 0  |                         return 0;  | 
85  | 0  |                     }  | 
86  | 0  |                     r->digest = (OSSL_PARAM *)p;  | 
87  | 0  |                 }  | 
88  | 0  |                 break;  | 
89  | 0  |             case 'e':  | 
90  | 0  |                 if (ossl_likely(strcmp("ngine", s + 1) == 0)) { | 
91  |  |                     /* OSSL_ASYM_CIPHER_PARAM_ENGINE */  | 
92  | 0  |                     if (ossl_unlikely(r->engine != NULL)) { | 
93  | 0  |                         ERR_raise_data(ERR_LIB_PROV, PROV_R_REPEATED_PARAMETER,  | 
94  | 0  |                                        "param %s is repeated", s);  | 
95  | 0  |                         return 0;  | 
96  | 0  |                     }  | 
97  | 0  |                     r->engine = (OSSL_PARAM *)p;  | 
98  | 0  |                 }  | 
99  | 0  |                 break;  | 
100  | 0  |             case 'p':  | 
101  | 0  |                 if (ossl_likely(strcmp("roperties", s + 1) == 0)) { | 
102  |  |                     /* OSSL_ASYM_CIPHER_PARAM_PROPERTIES */  | 
103  | 0  |                     if (ossl_unlikely(r->propq != NULL)) { | 
104  | 0  |                         ERR_raise_data(ERR_LIB_PROV, PROV_R_REPEATED_PARAMETER,  | 
105  | 0  |                                        "param %s is repeated", s);  | 
106  | 0  |                         return 0;  | 
107  | 0  |                     }  | 
108  | 0  |                     r->propq = (OSSL_PARAM *)p;  | 
109  | 0  |                 }  | 
110  | 0  |             }  | 
111  | 0  |     return 1;  | 
112  | 0  | }  | 
113  |  | #endif  | 
114  |  | /* End of machine generated */  |