diff options
Diffstat (limited to 'src/lib/libcrypto/evp')
-rw-r--r-- | src/lib/libcrypto/evp/e_gost2814789.c | 312 | ||||
-rw-r--r-- | src/lib/libcrypto/evp/m_gost2814789.c | 113 | ||||
-rw-r--r-- | src/lib/libcrypto/evp/m_gostr341194.c | 100 | ||||
-rw-r--r-- | src/lib/libcrypto/evp/p_lib.c | 10 | ||||
-rw-r--r-- | src/lib/libcrypto/evp/pmeth_lib.c | 6 |
5 files changed, 2 insertions, 539 deletions
diff --git a/src/lib/libcrypto/evp/e_gost2814789.c b/src/lib/libcrypto/evp/e_gost2814789.c deleted file mode 100644 index 48619d109d..0000000000 --- a/src/lib/libcrypto/evp/e_gost2814789.c +++ /dev/null | |||
@@ -1,312 +0,0 @@ | |||
1 | /* $OpenBSD: e_gost2814789.c,v 1.14 2024/01/04 17:38:36 tb Exp $ */ | ||
2 | /* | ||
3 | * Copyright (c) 2014 Dmitry Eremin-Solenikov <dbaryshkov@gmail.com> | ||
4 | * Copyright (c) 2005-2006 Cryptocom LTD | ||
5 | * | ||
6 | * Redistribution and use in source and binary forms, with or without | ||
7 | * modification, are permitted provided that the following conditions | ||
8 | * are met: | ||
9 | * | ||
10 | * 1. Redistributions of source code must retain the above copyright | ||
11 | * notice, this list of conditions and the following disclaimer. | ||
12 | * | ||
13 | * 2. Redistributions in binary form must reproduce the above copyright | ||
14 | * notice, this list of conditions and the following disclaimer in | ||
15 | * the documentation and/or other materials provided with the | ||
16 | * distribution. | ||
17 | * | ||
18 | * 3. All advertising materials mentioning features or use of this | ||
19 | * software must display the following acknowledgment: | ||
20 | * "This product includes software developed by the OpenSSL Project | ||
21 | * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" | ||
22 | * | ||
23 | * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to | ||
24 | * endorse or promote products derived from this software without | ||
25 | * prior written permission. For written permission, please contact | ||
26 | * openssl-core@openssl.org. | ||
27 | * | ||
28 | * 5. Products derived from this software may not be called "OpenSSL" | ||
29 | * nor may "OpenSSL" appear in their names without prior written | ||
30 | * permission of the OpenSSL Project. | ||
31 | * | ||
32 | * 6. Redistributions of any form whatsoever must retain the following | ||
33 | * acknowledgment: | ||
34 | * "This product includes software developed by the OpenSSL Project | ||
35 | * for use in the OpenSSL Toolkit (http://www.openssl.org/)" | ||
36 | * | ||
37 | * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY | ||
38 | * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
39 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
40 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR | ||
41 | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
42 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
43 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
44 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
45 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
46 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
47 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | ||
48 | * OF THE POSSIBILITY OF SUCH DAMAGE. | ||
49 | * ==================================================================== | ||
50 | */ | ||
51 | |||
52 | #include <string.h> | ||
53 | |||
54 | #include <openssl/opensslconf.h> | ||
55 | |||
56 | #ifndef OPENSSL_NO_GOST | ||
57 | #include <openssl/evp.h> | ||
58 | #include <openssl/err.h> | ||
59 | #include <openssl/gost.h> | ||
60 | |||
61 | #include "evp_local.h" | ||
62 | |||
63 | typedef struct { | ||
64 | GOST2814789_KEY ks; | ||
65 | int param_nid; | ||
66 | } EVP_GOST2814789_CTX; | ||
67 | |||
68 | static int | ||
69 | gost2814789_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, | ||
70 | const unsigned char *iv, int enc) | ||
71 | { | ||
72 | EVP_GOST2814789_CTX *c = ctx->cipher_data; | ||
73 | |||
74 | return Gost2814789_set_key(&c->ks, key, ctx->key_len * 8); | ||
75 | } | ||
76 | |||
77 | static int | ||
78 | gost2814789_ctl(EVP_CIPHER_CTX *ctx, int type, int arg, void *ptr) | ||
79 | { | ||
80 | EVP_GOST2814789_CTX *c = ctx->cipher_data; | ||
81 | |||
82 | switch (type) { | ||
83 | case EVP_CTRL_PBE_PRF_NID: | ||
84 | if (ptr != NULL) { | ||
85 | *((int *)ptr) = NID_id_HMACGostR3411_94; | ||
86 | return 1; | ||
87 | } else { | ||
88 | return 0; | ||
89 | } | ||
90 | case EVP_CTRL_INIT: | ||
91 | /* Default value to have any s-box set at all */ | ||
92 | c->param_nid = NID_id_Gost28147_89_CryptoPro_A_ParamSet; | ||
93 | return Gost2814789_set_sbox(&c->ks, c->param_nid); | ||
94 | case EVP_CTRL_GOST_SET_SBOX: | ||
95 | return Gost2814789_set_sbox(&c->ks, arg); | ||
96 | default: | ||
97 | return -1; | ||
98 | } | ||
99 | } | ||
100 | |||
101 | int | ||
102 | gost2814789_set_asn1_params(EVP_CIPHER_CTX *ctx, ASN1_TYPE *params) | ||
103 | { | ||
104 | int len = 0; | ||
105 | unsigned char *buf = NULL; | ||
106 | unsigned char *p = NULL; | ||
107 | EVP_GOST2814789_CTX *c = ctx->cipher_data; | ||
108 | ASN1_OCTET_STRING *os = NULL; | ||
109 | GOST_CIPHER_PARAMS *gcp = GOST_CIPHER_PARAMS_new(); | ||
110 | |||
111 | if (gcp == NULL) { | ||
112 | GOSTerror(ERR_R_MALLOC_FAILURE); | ||
113 | return 0; | ||
114 | } | ||
115 | if (ASN1_OCTET_STRING_set(gcp->iv, ctx->iv, ctx->cipher->iv_len) == 0) { | ||
116 | GOST_CIPHER_PARAMS_free(gcp); | ||
117 | GOSTerror(ERR_R_ASN1_LIB); | ||
118 | return 0; | ||
119 | } | ||
120 | ASN1_OBJECT_free(gcp->enc_param_set); | ||
121 | gcp->enc_param_set = OBJ_nid2obj(c->param_nid); | ||
122 | |||
123 | len = i2d_GOST_CIPHER_PARAMS(gcp, NULL); | ||
124 | p = buf = malloc(len); | ||
125 | if (buf == NULL) { | ||
126 | GOST_CIPHER_PARAMS_free(gcp); | ||
127 | GOSTerror(ERR_R_MALLOC_FAILURE); | ||
128 | return 0; | ||
129 | } | ||
130 | i2d_GOST_CIPHER_PARAMS(gcp, &p); | ||
131 | GOST_CIPHER_PARAMS_free(gcp); | ||
132 | |||
133 | os = ASN1_OCTET_STRING_new(); | ||
134 | if (os == NULL) { | ||
135 | free(buf); | ||
136 | GOSTerror(ERR_R_MALLOC_FAILURE); | ||
137 | return 0; | ||
138 | } | ||
139 | if (ASN1_OCTET_STRING_set(os, buf, len) == 0) { | ||
140 | ASN1_OCTET_STRING_free(os); | ||
141 | free(buf); | ||
142 | GOSTerror(ERR_R_ASN1_LIB); | ||
143 | return 0; | ||
144 | } | ||
145 | free(buf); | ||
146 | |||
147 | ASN1_TYPE_set(params, V_ASN1_SEQUENCE, os); | ||
148 | return 1; | ||
149 | } | ||
150 | |||
151 | int | ||
152 | gost2814789_get_asn1_params(EVP_CIPHER_CTX *ctx, ASN1_TYPE *params) | ||
153 | { | ||
154 | int ret = -1; | ||
155 | int len; | ||
156 | GOST_CIPHER_PARAMS *gcp = NULL; | ||
157 | EVP_GOST2814789_CTX *c = ctx->cipher_data; | ||
158 | unsigned char *p; | ||
159 | |||
160 | if (ASN1_TYPE_get(params) != V_ASN1_SEQUENCE) | ||
161 | return ret; | ||
162 | |||
163 | p = params->value.sequence->data; | ||
164 | |||
165 | gcp = d2i_GOST_CIPHER_PARAMS(NULL, (const unsigned char **)&p, | ||
166 | params->value.sequence->length); | ||
167 | |||
168 | len = gcp->iv->length; | ||
169 | if (len != ctx->cipher->iv_len) { | ||
170 | GOST_CIPHER_PARAMS_free(gcp); | ||
171 | GOSTerror(GOST_R_INVALID_IV_LENGTH); | ||
172 | return -1; | ||
173 | } | ||
174 | |||
175 | if (!Gost2814789_set_sbox(&c->ks, OBJ_obj2nid(gcp->enc_param_set))) { | ||
176 | GOST_CIPHER_PARAMS_free(gcp); | ||
177 | return -1; | ||
178 | } | ||
179 | c->param_nid = OBJ_obj2nid(gcp->enc_param_set); | ||
180 | |||
181 | memcpy(ctx->oiv, gcp->iv->data, len); | ||
182 | memcpy(ctx->iv, gcp->iv->data, len); | ||
183 | |||
184 | GOST_CIPHER_PARAMS_free(gcp); | ||
185 | |||
186 | return 1; | ||
187 | } | ||
188 | |||
189 | static int | ||
190 | gost2814789_ecb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, const unsigned char *in, size_t inl) | ||
191 | { | ||
192 | size_t i, bl; | ||
193 | |||
194 | bl = ctx->cipher->block_size; | ||
195 | |||
196 | if (inl < bl) | ||
197 | return 1; | ||
198 | |||
199 | inl -= bl; | ||
200 | |||
201 | for (i = 0; i <= inl; i += bl) | ||
202 | Gost2814789_ecb_encrypt(in + i, out + i, &((EVP_GOST2814789_CTX *)ctx->cipher_data)->ks, ctx->encrypt); | ||
203 | |||
204 | return 1; | ||
205 | } | ||
206 | |||
207 | static int | ||
208 | gost2814789_cfb64_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, const unsigned char *in, size_t inl) | ||
209 | { | ||
210 | size_t chunk = EVP_MAXCHUNK; | ||
211 | |||
212 | if (inl < chunk) | ||
213 | chunk = inl; | ||
214 | |||
215 | while (inl && inl >= chunk) { | ||
216 | Gost2814789_cfb64_encrypt(in, out, chunk, &((EVP_GOST2814789_CTX *)ctx->cipher_data)->ks, ctx->iv, &ctx->num, ctx->encrypt); | ||
217 | inl -= chunk; | ||
218 | in += chunk; | ||
219 | out += chunk; | ||
220 | if (inl < chunk) | ||
221 | chunk = inl; | ||
222 | } | ||
223 | |||
224 | return 1; | ||
225 | } | ||
226 | |||
227 | static int | ||
228 | gost2814789_cnt_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, | ||
229 | const unsigned char *in, size_t inl) | ||
230 | { | ||
231 | EVP_GOST2814789_CTX *c = ctx->cipher_data; | ||
232 | |||
233 | while (inl >= EVP_MAXCHUNK) { | ||
234 | Gost2814789_cnt_encrypt(in, out, EVP_MAXCHUNK, &c->ks, | ||
235 | ctx->iv, ctx->buf, &ctx->num); | ||
236 | inl -= EVP_MAXCHUNK; | ||
237 | in += EVP_MAXCHUNK; | ||
238 | out += EVP_MAXCHUNK; | ||
239 | } | ||
240 | |||
241 | if (inl) | ||
242 | Gost2814789_cnt_encrypt(in, out, inl, &c->ks, ctx->iv, ctx->buf, | ||
243 | &ctx->num); | ||
244 | return 1; | ||
245 | } | ||
246 | |||
247 | /* gost89 is CFB-64 */ | ||
248 | #define NID_gost89_cfb64 NID_id_Gost28147_89 | ||
249 | |||
250 | static const EVP_CIPHER gost2814789_ecb = { | ||
251 | .nid = NID_gost89_ecb, | ||
252 | .block_size = 8, | ||
253 | .key_len = 32, | ||
254 | .iv_len = 0, | ||
255 | .flags = EVP_CIPH_NO_PADDING | EVP_CIPH_CTRL_INIT | EVP_CIPH_ECB_MODE, | ||
256 | .init = gost2814789_init_key, | ||
257 | .do_cipher = gost2814789_ecb_cipher, | ||
258 | .cleanup = NULL, | ||
259 | .ctx_size = sizeof(EVP_GOST2814789_CTX), | ||
260 | .set_asn1_parameters = gost2814789_set_asn1_params, | ||
261 | .get_asn1_parameters = gost2814789_get_asn1_params, | ||
262 | .ctrl = gost2814789_ctl, | ||
263 | }; | ||
264 | |||
265 | const EVP_CIPHER * | ||
266 | EVP_gost2814789_ecb(void) | ||
267 | { | ||
268 | return &gost2814789_ecb; | ||
269 | } | ||
270 | |||
271 | static const EVP_CIPHER gost2814789_cfb64 = { | ||
272 | .nid = NID_gost89_cfb64, | ||
273 | .block_size = 1, | ||
274 | .key_len = 32, | ||
275 | .iv_len = 8, | ||
276 | .flags = EVP_CIPH_NO_PADDING | EVP_CIPH_CTRL_INIT | EVP_CIPH_CFB_MODE, | ||
277 | .init = gost2814789_init_key, | ||
278 | .do_cipher = gost2814789_cfb64_cipher, | ||
279 | .cleanup = NULL, | ||
280 | .ctx_size = sizeof(EVP_GOST2814789_CTX), | ||
281 | .set_asn1_parameters = gost2814789_set_asn1_params, | ||
282 | .get_asn1_parameters = gost2814789_get_asn1_params, | ||
283 | .ctrl = gost2814789_ctl, | ||
284 | }; | ||
285 | |||
286 | const EVP_CIPHER * | ||
287 | EVP_gost2814789_cfb64(void) | ||
288 | { | ||
289 | return &gost2814789_cfb64; | ||
290 | } | ||
291 | |||
292 | static const EVP_CIPHER gost2814789_cnt = { | ||
293 | .nid = NID_gost89_cnt, | ||
294 | .block_size = 1, | ||
295 | .key_len = 32, | ||
296 | .iv_len = 8, | ||
297 | .flags = EVP_CIPH_NO_PADDING | EVP_CIPH_CTRL_INIT | EVP_CIPH_OFB_MODE, | ||
298 | .init = gost2814789_init_key, | ||
299 | .do_cipher = gost2814789_cnt_cipher, | ||
300 | .cleanup = NULL, | ||
301 | .ctx_size = sizeof(EVP_GOST2814789_CTX), | ||
302 | .set_asn1_parameters = gost2814789_set_asn1_params, | ||
303 | .get_asn1_parameters = gost2814789_get_asn1_params, | ||
304 | .ctrl = gost2814789_ctl, | ||
305 | }; | ||
306 | |||
307 | const EVP_CIPHER * | ||
308 | EVP_gost2814789_cnt(void) | ||
309 | { | ||
310 | return &gost2814789_cnt; | ||
311 | } | ||
312 | #endif | ||
diff --git a/src/lib/libcrypto/evp/m_gost2814789.c b/src/lib/libcrypto/evp/m_gost2814789.c deleted file mode 100644 index 9b8a09e5a4..0000000000 --- a/src/lib/libcrypto/evp/m_gost2814789.c +++ /dev/null | |||
@@ -1,113 +0,0 @@ | |||
1 | /* $OpenBSD: m_gost2814789.c,v 1.6 2023/07/07 19:37:53 beck Exp $ */ | ||
2 | /* | ||
3 | * Copyright (c) 2014 Dmitry Eremin-Solenikov <dbaryshkov@gmail.com> | ||
4 | * Copyright (c) 2005-2006 Cryptocom LTD | ||
5 | * | ||
6 | * Redistribution and use in source and binary forms, with or without | ||
7 | * modification, are permitted provided that the following conditions | ||
8 | * are met: | ||
9 | * | ||
10 | * 1. Redistributions of source code must retain the above copyright | ||
11 | * notice, this list of conditions and the following disclaimer. | ||
12 | * | ||
13 | * 2. Redistributions in binary form must reproduce the above copyright | ||
14 | * notice, this list of conditions and the following disclaimer in | ||
15 | * the documentation and/or other materials provided with the | ||
16 | * distribution. | ||
17 | * | ||
18 | * 3. All advertising materials mentioning features or use of this | ||
19 | * software must display the following acknowledgment: | ||
20 | * "This product includes software developed by the OpenSSL Project | ||
21 | * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" | ||
22 | * | ||
23 | * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to | ||
24 | * endorse or promote products derived from this software without | ||
25 | * prior written permission. For written permission, please contact | ||
26 | * openssl-core@openssl.org. | ||
27 | * | ||
28 | * 5. Products derived from this software may not be called "OpenSSL" | ||
29 | * nor may "OpenSSL" appear in their names without prior written | ||
30 | * permission of the OpenSSL Project. | ||
31 | * | ||
32 | * 6. Redistributions of any form whatsoever must retain the following | ||
33 | * acknowledgment: | ||
34 | * "This product includes software developed by the OpenSSL Project | ||
35 | * for use in the OpenSSL Toolkit (http://www.openssl.org/)" | ||
36 | * | ||
37 | * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY | ||
38 | * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
39 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
40 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR | ||
41 | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
42 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
43 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
44 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
45 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
46 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
47 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | ||
48 | * OF THE POSSIBILITY OF SUCH DAMAGE. | ||
49 | * ==================================================================== | ||
50 | */ | ||
51 | |||
52 | #include <openssl/opensslconf.h> | ||
53 | |||
54 | #ifndef OPENSSL_NO_GOST | ||
55 | |||
56 | #include <openssl/evp.h> | ||
57 | #include <openssl/gost.h> | ||
58 | #include <openssl/objects.h> | ||
59 | |||
60 | #include "evp_local.h" | ||
61 | |||
62 | static int | ||
63 | gost2814789_init(EVP_MD_CTX *ctx) | ||
64 | { | ||
65 | return GOST2814789IMIT_Init(ctx->md_data, | ||
66 | NID_id_Gost28147_89_CryptoPro_A_ParamSet); | ||
67 | } | ||
68 | |||
69 | static int | ||
70 | gost2814789_update(EVP_MD_CTX *ctx, const void *data, size_t count) | ||
71 | { | ||
72 | return GOST2814789IMIT_Update(ctx->md_data, data, count); | ||
73 | } | ||
74 | |||
75 | static int | ||
76 | gost2814789_final(EVP_MD_CTX *ctx, unsigned char *md) | ||
77 | { | ||
78 | return GOST2814789IMIT_Final(md, ctx->md_data); | ||
79 | } | ||
80 | |||
81 | static int | ||
82 | gost2814789_md_ctrl(EVP_MD_CTX *ctx, int cmd, int p1, void *p2) | ||
83 | { | ||
84 | GOST2814789IMIT_CTX *gctx = ctx->md_data; | ||
85 | |||
86 | switch (cmd) { | ||
87 | case EVP_MD_CTRL_SET_KEY: | ||
88 | return Gost2814789_set_key(&gctx->cipher, p2, p1); | ||
89 | case EVP_MD_CTRL_GOST_SET_SBOX: | ||
90 | return Gost2814789_set_sbox(&gctx->cipher, p1); | ||
91 | } | ||
92 | return -2; | ||
93 | } | ||
94 | |||
95 | static const EVP_MD gost2814789imit_md = { | ||
96 | .type = NID_id_Gost28147_89_MAC, | ||
97 | .pkey_type = NID_undef, | ||
98 | .md_size = GOST2814789IMIT_LENGTH, | ||
99 | .flags = 0, | ||
100 | .init = gost2814789_init, | ||
101 | .update = gost2814789_update, | ||
102 | .final = gost2814789_final, | ||
103 | .block_size = GOST2814789IMIT_CBLOCK, | ||
104 | .ctx_size = sizeof(EVP_MD *) + sizeof(GOST2814789IMIT_CTX), | ||
105 | .md_ctrl = gost2814789_md_ctrl, | ||
106 | }; | ||
107 | |||
108 | const EVP_MD * | ||
109 | EVP_gost2814789imit(void) | ||
110 | { | ||
111 | return (&gost2814789imit_md); | ||
112 | } | ||
113 | #endif | ||
diff --git a/src/lib/libcrypto/evp/m_gostr341194.c b/src/lib/libcrypto/evp/m_gostr341194.c deleted file mode 100644 index 723349a0d8..0000000000 --- a/src/lib/libcrypto/evp/m_gostr341194.c +++ /dev/null | |||
@@ -1,100 +0,0 @@ | |||
1 | /* $OpenBSD: m_gostr341194.c,v 1.7 2023/07/07 19:37:53 beck Exp $ */ | ||
2 | /* | ||
3 | * Copyright (c) 2014 Dmitry Eremin-Solenikov <dbaryshkov@gmail.com> | ||
4 | * Copyright (c) 2005-2006 Cryptocom LTD | ||
5 | * | ||
6 | * Redistribution and use in source and binary forms, with or without | ||
7 | * modification, are permitted provided that the following conditions | ||
8 | * are met: | ||
9 | * | ||
10 | * 1. Redistributions of source code must retain the above copyright | ||
11 | * notice, this list of conditions and the following disclaimer. | ||
12 | * | ||
13 | * 2. Redistributions in binary form must reproduce the above copyright | ||
14 | * notice, this list of conditions and the following disclaimer in | ||
15 | * the documentation and/or other materials provided with the | ||
16 | * distribution. | ||
17 | * | ||
18 | * 3. All advertising materials mentioning features or use of this | ||
19 | * software must display the following acknowledgment: | ||
20 | * "This product includes software developed by the OpenSSL Project | ||
21 | * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" | ||
22 | * | ||
23 | * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to | ||
24 | * endorse or promote products derived from this software without | ||
25 | * prior written permission. For written permission, please contact | ||
26 | * openssl-core@openssl.org. | ||
27 | * | ||
28 | * 5. Products derived from this software may not be called "OpenSSL" | ||
29 | * nor may "OpenSSL" appear in their names without prior written | ||
30 | * permission of the OpenSSL Project. | ||
31 | * | ||
32 | * 6. Redistributions of any form whatsoever must retain the following | ||
33 | * acknowledgment: | ||
34 | * "This product includes software developed by the OpenSSL Project | ||
35 | * for use in the OpenSSL Toolkit (http://www.openssl.org/)" | ||
36 | * | ||
37 | * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY | ||
38 | * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
39 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
40 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR | ||
41 | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
42 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
43 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
44 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
45 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
46 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
47 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | ||
48 | * OF THE POSSIBILITY OF SUCH DAMAGE. | ||
49 | * ==================================================================== | ||
50 | */ | ||
51 | |||
52 | #include <stdio.h> | ||
53 | |||
54 | #include <openssl/opensslconf.h> | ||
55 | |||
56 | #ifndef OPENSSL_NO_GOST | ||
57 | |||
58 | #include <openssl/evp.h> | ||
59 | #include <openssl/gost.h> | ||
60 | #include <openssl/objects.h> | ||
61 | |||
62 | #include "evp_local.h" | ||
63 | |||
64 | static int | ||
65 | gostr341194_init(EVP_MD_CTX *ctx) | ||
66 | { | ||
67 | return GOSTR341194_Init(ctx->md_data, | ||
68 | NID_id_GostR3411_94_CryptoProParamSet); | ||
69 | } | ||
70 | |||
71 | static int | ||
72 | gostr341194_update(EVP_MD_CTX *ctx, const void *data, size_t count) | ||
73 | { | ||
74 | return GOSTR341194_Update(ctx->md_data, data, count); | ||
75 | } | ||
76 | |||
77 | static int | ||
78 | gostr341194_final(EVP_MD_CTX *ctx, unsigned char *md) | ||
79 | { | ||
80 | return GOSTR341194_Final(md, ctx->md_data); | ||
81 | } | ||
82 | |||
83 | static const EVP_MD gostr341194_md = { | ||
84 | .type = NID_id_GostR3411_94, | ||
85 | .pkey_type = NID_undef, | ||
86 | .md_size = GOSTR341194_LENGTH, | ||
87 | .flags = 0, | ||
88 | .init = gostr341194_init, | ||
89 | .update = gostr341194_update, | ||
90 | .final = gostr341194_final, | ||
91 | .block_size = GOSTR341194_CBLOCK, | ||
92 | .ctx_size = sizeof(EVP_MD *) + sizeof(GOSTR341194_CTX), | ||
93 | }; | ||
94 | |||
95 | const EVP_MD * | ||
96 | EVP_gostr341194(void) | ||
97 | { | ||
98 | return (&gostr341194_md); | ||
99 | } | ||
100 | #endif | ||
diff --git a/src/lib/libcrypto/evp/p_lib.c b/src/lib/libcrypto/evp/p_lib.c index 558c89d427..8bf820560c 100644 --- a/src/lib/libcrypto/evp/p_lib.c +++ b/src/lib/libcrypto/evp/p_lib.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: p_lib.c,v 1.58 2024/01/05 21:22:01 tb Exp $ */ | 1 | /* $OpenBSD: p_lib.c,v 1.59 2024/03/02 11:17:27 tb Exp $ */ |
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
3 | * All rights reserved. | 3 | * All rights reserved. |
4 | * | 4 | * |
@@ -140,10 +140,6 @@ extern const EVP_PKEY_ASN1_METHOD dsa3_asn1_meth; | |||
140 | extern const EVP_PKEY_ASN1_METHOD dsa4_asn1_meth; | 140 | extern const EVP_PKEY_ASN1_METHOD dsa4_asn1_meth; |
141 | extern const EVP_PKEY_ASN1_METHOD eckey_asn1_meth; | 141 | extern const EVP_PKEY_ASN1_METHOD eckey_asn1_meth; |
142 | extern const EVP_PKEY_ASN1_METHOD ed25519_asn1_meth; | 142 | extern const EVP_PKEY_ASN1_METHOD ed25519_asn1_meth; |
143 | extern const EVP_PKEY_ASN1_METHOD gostimit_asn1_meth; | ||
144 | extern const EVP_PKEY_ASN1_METHOD gostr01_asn1_meth; | ||
145 | extern const EVP_PKEY_ASN1_METHOD gostr12_256_asn1_meth; | ||
146 | extern const EVP_PKEY_ASN1_METHOD gostr12_512_asn1_meth; | ||
147 | extern const EVP_PKEY_ASN1_METHOD hmac_asn1_meth; | 143 | extern const EVP_PKEY_ASN1_METHOD hmac_asn1_meth; |
148 | extern const EVP_PKEY_ASN1_METHOD rsa_asn1_meth; | 144 | extern const EVP_PKEY_ASN1_METHOD rsa_asn1_meth; |
149 | extern const EVP_PKEY_ASN1_METHOD rsa2_asn1_meth; | 145 | extern const EVP_PKEY_ASN1_METHOD rsa2_asn1_meth; |
@@ -160,10 +156,6 @@ static const EVP_PKEY_ASN1_METHOD *asn1_methods[] = { | |||
160 | &dsa4_asn1_meth, | 156 | &dsa4_asn1_meth, |
161 | &eckey_asn1_meth, | 157 | &eckey_asn1_meth, |
162 | &ed25519_asn1_meth, | 158 | &ed25519_asn1_meth, |
163 | &gostimit_asn1_meth, | ||
164 | &gostr01_asn1_meth, | ||
165 | &gostr12_256_asn1_meth, | ||
166 | &gostr12_512_asn1_meth, | ||
167 | &hmac_asn1_meth, | 159 | &hmac_asn1_meth, |
168 | &rsa_asn1_meth, | 160 | &rsa_asn1_meth, |
169 | &rsa2_asn1_meth, | 161 | &rsa2_asn1_meth, |
diff --git a/src/lib/libcrypto/evp/pmeth_lib.c b/src/lib/libcrypto/evp/pmeth_lib.c index a0d57594d8..a2a9ad9c7b 100644 --- a/src/lib/libcrypto/evp/pmeth_lib.c +++ b/src/lib/libcrypto/evp/pmeth_lib.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: pmeth_lib.c,v 1.38 2024/03/02 10:04:40 tb Exp $ */ | 1 | /* $OpenBSD: pmeth_lib.c,v 1.39 2024/03/02 11:17:27 tb Exp $ */ |
2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
3 | * project 2006. | 3 | * project 2006. |
4 | */ | 4 | */ |
@@ -76,8 +76,6 @@ extern const EVP_PKEY_METHOD dh_pkey_meth; | |||
76 | extern const EVP_PKEY_METHOD dsa_pkey_meth; | 76 | extern const EVP_PKEY_METHOD dsa_pkey_meth; |
77 | extern const EVP_PKEY_METHOD ec_pkey_meth; | 77 | extern const EVP_PKEY_METHOD ec_pkey_meth; |
78 | extern const EVP_PKEY_METHOD ed25519_pkey_meth; | 78 | extern const EVP_PKEY_METHOD ed25519_pkey_meth; |
79 | extern const EVP_PKEY_METHOD gostimit_pkey_meth; | ||
80 | extern const EVP_PKEY_METHOD gostr01_pkey_meth; | ||
81 | extern const EVP_PKEY_METHOD hkdf_pkey_meth; | 79 | extern const EVP_PKEY_METHOD hkdf_pkey_meth; |
82 | extern const EVP_PKEY_METHOD hmac_pkey_meth; | 80 | extern const EVP_PKEY_METHOD hmac_pkey_meth; |
83 | extern const EVP_PKEY_METHOD rsa_pkey_meth; | 81 | extern const EVP_PKEY_METHOD rsa_pkey_meth; |
@@ -90,8 +88,6 @@ static const EVP_PKEY_METHOD *pkey_methods[] = { | |||
90 | &dsa_pkey_meth, | 88 | &dsa_pkey_meth, |
91 | &ec_pkey_meth, | 89 | &ec_pkey_meth, |
92 | &ed25519_pkey_meth, | 90 | &ed25519_pkey_meth, |
93 | &gostimit_pkey_meth, | ||
94 | &gostr01_pkey_meth, | ||
95 | &hkdf_pkey_meth, | 91 | &hkdf_pkey_meth, |
96 | &hmac_pkey_meth, | 92 | &hmac_pkey_meth, |
97 | &rsa_pkey_meth, | 93 | &rsa_pkey_meth, |