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