diff options
Diffstat (limited to 'src/lib/libcrypto/evp/evp_digest.c')
-rw-r--r-- | src/lib/libcrypto/evp/evp_digest.c | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/src/lib/libcrypto/evp/evp_digest.c b/src/lib/libcrypto/evp/evp_digest.c index d360760295..3eb6c258bf 100644 --- a/src/lib/libcrypto/evp/evp_digest.c +++ b/src/lib/libcrypto/evp/evp_digest.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: evp_digest.c,v 1.12 2024/03/02 09:59:56 tb Exp $ */ | 1 | /* $OpenBSD: evp_digest.c,v 1.13 2024/04/09 13:52:41 beck 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 | * |
@@ -126,6 +126,7 @@ EVP_DigestInit(EVP_MD_CTX *ctx, const EVP_MD *type) | |||
126 | EVP_MD_CTX_legacy_clear(ctx); | 126 | EVP_MD_CTX_legacy_clear(ctx); |
127 | return EVP_DigestInit_ex(ctx, type, NULL); | 127 | return EVP_DigestInit_ex(ctx, type, NULL); |
128 | } | 128 | } |
129 | LCRYPTO_ALIAS(EVP_DigestInit); | ||
129 | 130 | ||
130 | int | 131 | int |
131 | EVP_DigestInit_ex(EVP_MD_CTX *ctx, const EVP_MD *type, ENGINE *impl) | 132 | EVP_DigestInit_ex(EVP_MD_CTX *ctx, const EVP_MD *type, ENGINE *impl) |
@@ -161,12 +162,14 @@ EVP_DigestInit_ex(EVP_MD_CTX *ctx, const EVP_MD *type, ENGINE *impl) | |||
161 | return 1; | 162 | return 1; |
162 | return ctx->digest->init(ctx); | 163 | return ctx->digest->init(ctx); |
163 | } | 164 | } |
165 | LCRYPTO_ALIAS(EVP_DigestInit_ex); | ||
164 | 166 | ||
165 | int | 167 | int |
166 | EVP_DigestUpdate(EVP_MD_CTX *ctx, const void *data, size_t count) | 168 | EVP_DigestUpdate(EVP_MD_CTX *ctx, const void *data, size_t count) |
167 | { | 169 | { |
168 | return ctx->update(ctx, data, count); | 170 | return ctx->update(ctx, data, count); |
169 | } | 171 | } |
172 | LCRYPTO_ALIAS(EVP_DigestUpdate); | ||
170 | 173 | ||
171 | /* The caller can assume that this removes any secret data from the context */ | 174 | /* The caller can assume that this removes any secret data from the context */ |
172 | int | 175 | int |
@@ -178,6 +181,7 @@ EVP_DigestFinal(EVP_MD_CTX *ctx, unsigned char *md, unsigned int *size) | |||
178 | EVP_MD_CTX_cleanup(ctx); | 181 | EVP_MD_CTX_cleanup(ctx); |
179 | return ret; | 182 | return ret; |
180 | } | 183 | } |
184 | LCRYPTO_ALIAS(EVP_DigestFinal); | ||
181 | 185 | ||
182 | /* The caller can assume that this removes any secret data from the context */ | 186 | /* The caller can assume that this removes any secret data from the context */ |
183 | int | 187 | int |
@@ -199,6 +203,7 @@ EVP_DigestFinal_ex(EVP_MD_CTX *ctx, unsigned char *md, unsigned int *size) | |||
199 | memset(ctx->md_data, 0, ctx->digest->ctx_size); | 203 | memset(ctx->md_data, 0, ctx->digest->ctx_size); |
200 | return ret; | 204 | return ret; |
201 | } | 205 | } |
206 | LCRYPTO_ALIAS(EVP_DigestFinal_ex); | ||
202 | 207 | ||
203 | int | 208 | int |
204 | EVP_Digest(const void *data, size_t count, | 209 | EVP_Digest(const void *data, size_t count, |
@@ -216,12 +221,14 @@ EVP_Digest(const void *data, size_t count, | |||
216 | 221 | ||
217 | return ret; | 222 | return ret; |
218 | } | 223 | } |
224 | LCRYPTO_ALIAS(EVP_Digest); | ||
219 | 225 | ||
220 | EVP_MD_CTX * | 226 | EVP_MD_CTX * |
221 | EVP_MD_CTX_new(void) | 227 | EVP_MD_CTX_new(void) |
222 | { | 228 | { |
223 | return calloc(1, sizeof(EVP_MD_CTX)); | 229 | return calloc(1, sizeof(EVP_MD_CTX)); |
224 | } | 230 | } |
231 | LCRYPTO_ALIAS(EVP_MD_CTX_new); | ||
225 | 232 | ||
226 | void | 233 | void |
227 | EVP_MD_CTX_free(EVP_MD_CTX *ctx) | 234 | EVP_MD_CTX_free(EVP_MD_CTX *ctx) |
@@ -233,18 +240,21 @@ EVP_MD_CTX_free(EVP_MD_CTX *ctx) | |||
233 | 240 | ||
234 | free(ctx); | 241 | free(ctx); |
235 | } | 242 | } |
243 | LCRYPTO_ALIAS(EVP_MD_CTX_free); | ||
236 | 244 | ||
237 | EVP_MD_CTX * | 245 | EVP_MD_CTX * |
238 | EVP_MD_CTX_create(void) | 246 | EVP_MD_CTX_create(void) |
239 | { | 247 | { |
240 | return EVP_MD_CTX_new(); | 248 | return EVP_MD_CTX_new(); |
241 | } | 249 | } |
250 | LCRYPTO_ALIAS(EVP_MD_CTX_create); | ||
242 | 251 | ||
243 | void | 252 | void |
244 | EVP_MD_CTX_destroy(EVP_MD_CTX *ctx) | 253 | EVP_MD_CTX_destroy(EVP_MD_CTX *ctx) |
245 | { | 254 | { |
246 | EVP_MD_CTX_free(ctx); | 255 | EVP_MD_CTX_free(ctx); |
247 | } | 256 | } |
257 | LCRYPTO_ALIAS(EVP_MD_CTX_destroy); | ||
248 | 258 | ||
249 | void | 259 | void |
250 | EVP_MD_CTX_legacy_clear(EVP_MD_CTX *ctx) | 260 | EVP_MD_CTX_legacy_clear(EVP_MD_CTX *ctx) |
@@ -263,6 +273,7 @@ EVP_MD_CTX_reset(EVP_MD_CTX *ctx) | |||
263 | { | 273 | { |
264 | return EVP_MD_CTX_cleanup(ctx); | 274 | return EVP_MD_CTX_cleanup(ctx); |
265 | } | 275 | } |
276 | LCRYPTO_ALIAS(EVP_MD_CTX_reset); | ||
266 | 277 | ||
267 | int | 278 | int |
268 | EVP_MD_CTX_cleanup(EVP_MD_CTX *ctx) | 279 | EVP_MD_CTX_cleanup(EVP_MD_CTX *ctx) |
@@ -290,6 +301,7 @@ EVP_MD_CTX_cleanup(EVP_MD_CTX *ctx) | |||
290 | 301 | ||
291 | return 1; | 302 | return 1; |
292 | } | 303 | } |
304 | LCRYPTO_ALIAS(EVP_MD_CTX_cleanup); | ||
293 | 305 | ||
294 | int | 306 | int |
295 | EVP_MD_CTX_copy(EVP_MD_CTX *out, const EVP_MD_CTX *in) | 307 | EVP_MD_CTX_copy(EVP_MD_CTX *out, const EVP_MD_CTX *in) |
@@ -297,6 +309,7 @@ EVP_MD_CTX_copy(EVP_MD_CTX *out, const EVP_MD_CTX *in) | |||
297 | EVP_MD_CTX_legacy_clear(out); | 309 | EVP_MD_CTX_legacy_clear(out); |
298 | return EVP_MD_CTX_copy_ex(out, in); | 310 | return EVP_MD_CTX_copy_ex(out, in); |
299 | } | 311 | } |
312 | LCRYPTO_ALIAS(EVP_MD_CTX_copy); | ||
300 | 313 | ||
301 | int | 314 | int |
302 | EVP_MD_CTX_copy_ex(EVP_MD_CTX *out, const EVP_MD_CTX *in) | 315 | EVP_MD_CTX_copy_ex(EVP_MD_CTX *out, const EVP_MD_CTX *in) |
@@ -352,6 +365,7 @@ EVP_MD_CTX_copy_ex(EVP_MD_CTX *out, const EVP_MD_CTX *in) | |||
352 | 365 | ||
353 | return 1; | 366 | return 1; |
354 | } | 367 | } |
368 | LCRYPTO_ALIAS(EVP_MD_CTX_copy_ex); | ||
355 | 369 | ||
356 | int | 370 | int |
357 | EVP_MD_CTX_ctrl(EVP_MD_CTX *ctx, int type, int arg, void *ptr) | 371 | EVP_MD_CTX_ctrl(EVP_MD_CTX *ctx, int type, int arg, void *ptr) |
@@ -375,6 +389,7 @@ EVP_MD_CTX_ctrl(EVP_MD_CTX *ctx, int type, int arg, void *ptr) | |||
375 | } | 389 | } |
376 | return ret; | 390 | return ret; |
377 | } | 391 | } |
392 | LCRYPTO_ALIAS(EVP_MD_CTX_ctrl); | ||
378 | 393 | ||
379 | const EVP_MD * | 394 | const EVP_MD * |
380 | EVP_MD_CTX_md(const EVP_MD_CTX *ctx) | 395 | EVP_MD_CTX_md(const EVP_MD_CTX *ctx) |
@@ -383,36 +398,42 @@ EVP_MD_CTX_md(const EVP_MD_CTX *ctx) | |||
383 | return NULL; | 398 | return NULL; |
384 | return ctx->digest; | 399 | return ctx->digest; |
385 | } | 400 | } |
401 | LCRYPTO_ALIAS(EVP_MD_CTX_md); | ||
386 | 402 | ||
387 | void | 403 | void |
388 | EVP_MD_CTX_clear_flags(EVP_MD_CTX *ctx, int flags) | 404 | EVP_MD_CTX_clear_flags(EVP_MD_CTX *ctx, int flags) |
389 | { | 405 | { |
390 | ctx->flags &= ~flags; | 406 | ctx->flags &= ~flags; |
391 | } | 407 | } |
408 | LCRYPTO_ALIAS(EVP_MD_CTX_clear_flags); | ||
392 | 409 | ||
393 | void | 410 | void |
394 | EVP_MD_CTX_set_flags(EVP_MD_CTX *ctx, int flags) | 411 | EVP_MD_CTX_set_flags(EVP_MD_CTX *ctx, int flags) |
395 | { | 412 | { |
396 | ctx->flags |= flags; | 413 | ctx->flags |= flags; |
397 | } | 414 | } |
415 | LCRYPTO_ALIAS(EVP_MD_CTX_set_flags); | ||
398 | 416 | ||
399 | int | 417 | int |
400 | EVP_MD_CTX_test_flags(const EVP_MD_CTX *ctx, int flags) | 418 | EVP_MD_CTX_test_flags(const EVP_MD_CTX *ctx, int flags) |
401 | { | 419 | { |
402 | return (ctx->flags & flags); | 420 | return (ctx->flags & flags); |
403 | } | 421 | } |
422 | LCRYPTO_ALIAS(EVP_MD_CTX_test_flags); | ||
404 | 423 | ||
405 | void * | 424 | void * |
406 | EVP_MD_CTX_md_data(const EVP_MD_CTX *ctx) | 425 | EVP_MD_CTX_md_data(const EVP_MD_CTX *ctx) |
407 | { | 426 | { |
408 | return ctx->md_data; | 427 | return ctx->md_data; |
409 | } | 428 | } |
429 | LCRYPTO_ALIAS(EVP_MD_CTX_md_data); | ||
410 | 430 | ||
411 | EVP_PKEY_CTX * | 431 | EVP_PKEY_CTX * |
412 | EVP_MD_CTX_pkey_ctx(const EVP_MD_CTX *ctx) | 432 | EVP_MD_CTX_pkey_ctx(const EVP_MD_CTX *ctx) |
413 | { | 433 | { |
414 | return ctx->pctx; | 434 | return ctx->pctx; |
415 | } | 435 | } |
436 | LCRYPTO_ALIAS(EVP_MD_CTX_pkey_ctx); | ||
416 | 437 | ||
417 | void | 438 | void |
418 | EVP_MD_CTX_set_pkey_ctx(EVP_MD_CTX *ctx, EVP_PKEY_CTX *pctx) | 439 | EVP_MD_CTX_set_pkey_ctx(EVP_MD_CTX *ctx, EVP_PKEY_CTX *pctx) |
@@ -436,18 +457,21 @@ EVP_MD_CTX_set_pkey_ctx(EVP_MD_CTX *ctx, EVP_PKEY_CTX *pctx) | |||
436 | EVP_MD_CTX_set_flags(ctx, EVP_MD_CTX_FLAG_KEEP_PKEY_CTX); | 457 | EVP_MD_CTX_set_flags(ctx, EVP_MD_CTX_FLAG_KEEP_PKEY_CTX); |
437 | } | 458 | } |
438 | } | 459 | } |
460 | LCRYPTO_ALIAS(EVP_MD_CTX_set_pkey_ctx); | ||
439 | 461 | ||
440 | int | 462 | int |
441 | EVP_MD_type(const EVP_MD *md) | 463 | EVP_MD_type(const EVP_MD *md) |
442 | { | 464 | { |
443 | return md->type; | 465 | return md->type; |
444 | } | 466 | } |
467 | LCRYPTO_ALIAS(EVP_MD_type); | ||
445 | 468 | ||
446 | int | 469 | int |
447 | EVP_MD_pkey_type(const EVP_MD *md) | 470 | EVP_MD_pkey_type(const EVP_MD *md) |
448 | { | 471 | { |
449 | return md->pkey_type; | 472 | return md->pkey_type; |
450 | } | 473 | } |
474 | LCRYPTO_ALIAS(EVP_MD_pkey_type); | ||
451 | 475 | ||
452 | int | 476 | int |
453 | EVP_MD_size(const EVP_MD *md) | 477 | EVP_MD_size(const EVP_MD *md) |
@@ -458,15 +482,18 @@ EVP_MD_size(const EVP_MD *md) | |||
458 | } | 482 | } |
459 | return md->md_size; | 483 | return md->md_size; |
460 | } | 484 | } |
485 | LCRYPTO_ALIAS(EVP_MD_size); | ||
461 | 486 | ||
462 | unsigned long | 487 | unsigned long |
463 | EVP_MD_flags(const EVP_MD *md) | 488 | EVP_MD_flags(const EVP_MD *md) |
464 | { | 489 | { |
465 | return md->flags; | 490 | return md->flags; |
466 | } | 491 | } |
492 | LCRYPTO_ALIAS(EVP_MD_flags); | ||
467 | 493 | ||
468 | int | 494 | int |
469 | EVP_MD_block_size(const EVP_MD *md) | 495 | EVP_MD_block_size(const EVP_MD *md) |
470 | { | 496 | { |
471 | return md->block_size; | 497 | return md->block_size; |
472 | } | 498 | } |
499 | LCRYPTO_ALIAS(EVP_MD_block_size); | ||