diff options
Diffstat (limited to 'src/lib/libcrypto/evp/evp_enc.c')
-rw-r--r-- | src/lib/libcrypto/evp/evp_enc.c | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/src/lib/libcrypto/evp/evp_enc.c b/src/lib/libcrypto/evp/evp_enc.c index df818e3a62..f9b8deddf5 100644 --- a/src/lib/libcrypto/evp/evp_enc.c +++ b/src/lib/libcrypto/evp/evp_enc.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: evp_enc.c,v 1.50 2023/03/01 11:16:06 tb Exp $ */ | 1 | /* $OpenBSD: evp_enc.c,v 1.51 2023/07/07 13:54:45 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 | * |
@@ -82,6 +82,7 @@ EVP_CipherInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher, | |||
82 | EVP_CIPHER_CTX_init(ctx); | 82 | EVP_CIPHER_CTX_init(ctx); |
83 | return EVP_CipherInit_ex(ctx, cipher, NULL, key, iv, enc); | 83 | return EVP_CipherInit_ex(ctx, cipher, NULL, key, iv, enc); |
84 | } | 84 | } |
85 | LCRYPTO_ALIAS(EVP_CipherInit); | ||
85 | 86 | ||
86 | int | 87 | int |
87 | EVP_CipherInit_ex(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher, ENGINE *impl, | 88 | EVP_CipherInit_ex(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher, ENGINE *impl, |
@@ -230,6 +231,7 @@ skip_to_init: | |||
230 | ctx->block_mask = ctx->cipher->block_size - 1; | 231 | ctx->block_mask = ctx->cipher->block_size - 1; |
231 | return 1; | 232 | return 1; |
232 | } | 233 | } |
234 | LCRYPTO_ALIAS(EVP_CipherInit_ex); | ||
233 | 235 | ||
234 | int | 236 | int |
235 | EVP_CipherUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl, | 237 | EVP_CipherUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl, |
@@ -240,6 +242,7 @@ EVP_CipherUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl, | |||
240 | else | 242 | else |
241 | return EVP_DecryptUpdate(ctx, out, outl, in, inl); | 243 | return EVP_DecryptUpdate(ctx, out, outl, in, inl); |
242 | } | 244 | } |
245 | LCRYPTO_ALIAS(EVP_CipherUpdate); | ||
243 | 246 | ||
244 | int | 247 | int |
245 | EVP_CipherFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl) | 248 | EVP_CipherFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl) |
@@ -249,6 +252,7 @@ EVP_CipherFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl) | |||
249 | else | 252 | else |
250 | return EVP_DecryptFinal_ex(ctx, out, outl); | 253 | return EVP_DecryptFinal_ex(ctx, out, outl); |
251 | } | 254 | } |
255 | LCRYPTO_ALIAS(EVP_CipherFinal_ex); | ||
252 | 256 | ||
253 | __warn_references(EVP_CipherFinal, | 257 | __warn_references(EVP_CipherFinal, |
254 | "EVP_CipherFinal is often misused, please use EVP_CipherFinal_ex and EVP_CIPHER_CTX_cleanup"); | 258 | "EVP_CipherFinal is often misused, please use EVP_CipherFinal_ex and EVP_CIPHER_CTX_cleanup"); |
@@ -263,6 +267,7 @@ EVP_CipherFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl) | |||
263 | ret = EVP_DecryptFinal_ex(ctx, out, outl); | 267 | ret = EVP_DecryptFinal_ex(ctx, out, outl); |
264 | return ret; | 268 | return ret; |
265 | } | 269 | } |
270 | LCRYPTO_ALIAS(EVP_CipherFinal); | ||
266 | 271 | ||
267 | int | 272 | int |
268 | EVP_EncryptInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher, | 273 | EVP_EncryptInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher, |
@@ -270,6 +275,7 @@ EVP_EncryptInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher, | |||
270 | { | 275 | { |
271 | return EVP_CipherInit(ctx, cipher, key, iv, 1); | 276 | return EVP_CipherInit(ctx, cipher, key, iv, 1); |
272 | } | 277 | } |
278 | LCRYPTO_ALIAS(EVP_EncryptInit); | ||
273 | 279 | ||
274 | int | 280 | int |
275 | EVP_EncryptInit_ex(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher, ENGINE *impl, | 281 | EVP_EncryptInit_ex(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher, ENGINE *impl, |
@@ -277,6 +283,7 @@ EVP_EncryptInit_ex(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher, ENGINE *impl, | |||
277 | { | 283 | { |
278 | return EVP_CipherInit_ex(ctx, cipher, impl, key, iv, 1); | 284 | return EVP_CipherInit_ex(ctx, cipher, impl, key, iv, 1); |
279 | } | 285 | } |
286 | LCRYPTO_ALIAS(EVP_EncryptInit_ex); | ||
280 | 287 | ||
281 | int | 288 | int |
282 | EVP_DecryptInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher, | 289 | EVP_DecryptInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher, |
@@ -284,6 +291,7 @@ EVP_DecryptInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher, | |||
284 | { | 291 | { |
285 | return EVP_CipherInit(ctx, cipher, key, iv, 0); | 292 | return EVP_CipherInit(ctx, cipher, key, iv, 0); |
286 | } | 293 | } |
294 | LCRYPTO_ALIAS(EVP_DecryptInit); | ||
287 | 295 | ||
288 | int | 296 | int |
289 | EVP_DecryptInit_ex(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher, ENGINE *impl, | 297 | EVP_DecryptInit_ex(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher, ENGINE *impl, |
@@ -291,6 +299,7 @@ EVP_DecryptInit_ex(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher, ENGINE *impl, | |||
291 | { | 299 | { |
292 | return EVP_CipherInit_ex(ctx, cipher, impl, key, iv, 0); | 300 | return EVP_CipherInit_ex(ctx, cipher, impl, key, iv, 0); |
293 | } | 301 | } |
302 | LCRYPTO_ALIAS(EVP_DecryptInit_ex); | ||
294 | 303 | ||
295 | int | 304 | int |
296 | EVP_EncryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl, | 305 | EVP_EncryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl, |
@@ -373,6 +382,7 @@ EVP_EncryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl, | |||
373 | ctx->buf_len = i; | 382 | ctx->buf_len = i; |
374 | return 1; | 383 | return 1; |
375 | } | 384 | } |
385 | LCRYPTO_ALIAS(EVP_EncryptUpdate); | ||
376 | 386 | ||
377 | __warn_references(EVP_EncryptFinal, | 387 | __warn_references(EVP_EncryptFinal, |
378 | "EVP_EncryptFinal is often misused, please use EVP_EncryptFinal_ex and EVP_CIPHER_CTX_cleanup"); | 388 | "EVP_EncryptFinal is often misused, please use EVP_EncryptFinal_ex and EVP_CIPHER_CTX_cleanup"); |
@@ -385,6 +395,7 @@ EVP_EncryptFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl) | |||
385 | ret = EVP_EncryptFinal_ex(ctx, out, outl); | 395 | ret = EVP_EncryptFinal_ex(ctx, out, outl); |
386 | return ret; | 396 | return ret; |
387 | } | 397 | } |
398 | LCRYPTO_ALIAS(EVP_EncryptFinal); | ||
388 | 399 | ||
389 | int | 400 | int |
390 | EVP_EncryptFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl) | 401 | EVP_EncryptFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl) |
@@ -431,6 +442,7 @@ EVP_EncryptFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl) | |||
431 | 442 | ||
432 | return ret; | 443 | return ret; |
433 | } | 444 | } |
445 | LCRYPTO_ALIAS(EVP_EncryptFinal_ex); | ||
434 | 446 | ||
435 | int | 447 | int |
436 | EVP_DecryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl, | 448 | EVP_DecryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl, |
@@ -501,6 +513,7 @@ EVP_DecryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl, | |||
501 | 513 | ||
502 | return 1; | 514 | return 1; |
503 | } | 515 | } |
516 | LCRYPTO_ALIAS(EVP_DecryptUpdate); | ||
504 | 517 | ||
505 | __warn_references(EVP_DecryptFinal, | 518 | __warn_references(EVP_DecryptFinal, |
506 | "EVP_DecryptFinal is often misused, please use EVP_DecryptFinal_ex and EVP_CIPHER_CTX_cleanup"); | 519 | "EVP_DecryptFinal is often misused, please use EVP_DecryptFinal_ex and EVP_CIPHER_CTX_cleanup"); |
@@ -513,6 +526,7 @@ EVP_DecryptFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl) | |||
513 | ret = EVP_DecryptFinal_ex(ctx, out, outl); | 526 | ret = EVP_DecryptFinal_ex(ctx, out, outl); |
514 | return ret; | 527 | return ret; |
515 | } | 528 | } |
529 | LCRYPTO_ALIAS(EVP_DecryptFinal); | ||
516 | 530 | ||
517 | int | 531 | int |
518 | EVP_DecryptFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl) | 532 | EVP_DecryptFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl) |
@@ -567,12 +581,14 @@ EVP_DecryptFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl) | |||
567 | *outl = 0; | 581 | *outl = 0; |
568 | return (1); | 582 | return (1); |
569 | } | 583 | } |
584 | LCRYPTO_ALIAS(EVP_DecryptFinal_ex); | ||
570 | 585 | ||
571 | EVP_CIPHER_CTX * | 586 | EVP_CIPHER_CTX * |
572 | EVP_CIPHER_CTX_new(void) | 587 | EVP_CIPHER_CTX_new(void) |
573 | { | 588 | { |
574 | return calloc(1, sizeof(EVP_CIPHER_CTX)); | 589 | return calloc(1, sizeof(EVP_CIPHER_CTX)); |
575 | } | 590 | } |
591 | LCRYPTO_ALIAS(EVP_CIPHER_CTX_new); | ||
576 | 592 | ||
577 | void | 593 | void |
578 | EVP_CIPHER_CTX_free(EVP_CIPHER_CTX *ctx) | 594 | EVP_CIPHER_CTX_free(EVP_CIPHER_CTX *ctx) |
@@ -584,18 +600,21 @@ EVP_CIPHER_CTX_free(EVP_CIPHER_CTX *ctx) | |||
584 | 600 | ||
585 | free(ctx); | 601 | free(ctx); |
586 | } | 602 | } |
603 | LCRYPTO_ALIAS(EVP_CIPHER_CTX_free); | ||
587 | 604 | ||
588 | void | 605 | void |
589 | EVP_CIPHER_CTX_init(EVP_CIPHER_CTX *ctx) | 606 | EVP_CIPHER_CTX_init(EVP_CIPHER_CTX *ctx) |
590 | { | 607 | { |
591 | memset(ctx, 0, sizeof(EVP_CIPHER_CTX)); | 608 | memset(ctx, 0, sizeof(EVP_CIPHER_CTX)); |
592 | } | 609 | } |
610 | LCRYPTO_ALIAS(EVP_CIPHER_CTX_init); | ||
593 | 611 | ||
594 | int | 612 | int |
595 | EVP_CIPHER_CTX_reset(EVP_CIPHER_CTX *a) | 613 | EVP_CIPHER_CTX_reset(EVP_CIPHER_CTX *a) |
596 | { | 614 | { |
597 | return EVP_CIPHER_CTX_cleanup(a); | 615 | return EVP_CIPHER_CTX_cleanup(a); |
598 | } | 616 | } |
617 | LCRYPTO_ALIAS(EVP_CIPHER_CTX_reset); | ||
599 | 618 | ||
600 | int | 619 | int |
601 | EVP_CIPHER_CTX_cleanup(EVP_CIPHER_CTX *c) | 620 | EVP_CIPHER_CTX_cleanup(EVP_CIPHER_CTX *c) |
@@ -619,6 +638,7 @@ EVP_CIPHER_CTX_cleanup(EVP_CIPHER_CTX *c) | |||
619 | 638 | ||
620 | return 1; | 639 | return 1; |
621 | } | 640 | } |
641 | LCRYPTO_ALIAS(EVP_CIPHER_CTX_cleanup); | ||
622 | 642 | ||
623 | int | 643 | int |
624 | EVP_CIPHER_CTX_set_key_length(EVP_CIPHER_CTX *c, int keylen) | 644 | EVP_CIPHER_CTX_set_key_length(EVP_CIPHER_CTX *c, int keylen) |
@@ -635,6 +655,7 @@ EVP_CIPHER_CTX_set_key_length(EVP_CIPHER_CTX *c, int keylen) | |||
635 | EVPerror(EVP_R_INVALID_KEY_LENGTH); | 655 | EVPerror(EVP_R_INVALID_KEY_LENGTH); |
636 | return 0; | 656 | return 0; |
637 | } | 657 | } |
658 | LCRYPTO_ALIAS(EVP_CIPHER_CTX_set_key_length); | ||
638 | 659 | ||
639 | int | 660 | int |
640 | EVP_CIPHER_CTX_set_padding(EVP_CIPHER_CTX *ctx, int pad) | 661 | EVP_CIPHER_CTX_set_padding(EVP_CIPHER_CTX *ctx, int pad) |
@@ -645,6 +666,7 @@ EVP_CIPHER_CTX_set_padding(EVP_CIPHER_CTX *ctx, int pad) | |||
645 | ctx->flags |= EVP_CIPH_NO_PADDING; | 666 | ctx->flags |= EVP_CIPH_NO_PADDING; |
646 | return 1; | 667 | return 1; |
647 | } | 668 | } |
669 | LCRYPTO_ALIAS(EVP_CIPHER_CTX_set_padding); | ||
648 | 670 | ||
649 | int | 671 | int |
650 | EVP_CIPHER_CTX_ctrl(EVP_CIPHER_CTX *ctx, int type, int arg, void *ptr) | 672 | EVP_CIPHER_CTX_ctrl(EVP_CIPHER_CTX *ctx, int type, int arg, void *ptr) |
@@ -668,6 +690,7 @@ EVP_CIPHER_CTX_ctrl(EVP_CIPHER_CTX *ctx, int type, int arg, void *ptr) | |||
668 | } | 690 | } |
669 | return ret; | 691 | return ret; |
670 | } | 692 | } |
693 | LCRYPTO_ALIAS(EVP_CIPHER_CTX_ctrl); | ||
671 | 694 | ||
672 | int | 695 | int |
673 | EVP_CIPHER_CTX_rand_key(EVP_CIPHER_CTX *ctx, unsigned char *key) | 696 | EVP_CIPHER_CTX_rand_key(EVP_CIPHER_CTX *ctx, unsigned char *key) |
@@ -677,6 +700,7 @@ EVP_CIPHER_CTX_rand_key(EVP_CIPHER_CTX *ctx, unsigned char *key) | |||
677 | arc4random_buf(key, ctx->key_len); | 700 | arc4random_buf(key, ctx->key_len); |
678 | return 1; | 701 | return 1; |
679 | } | 702 | } |
703 | LCRYPTO_ALIAS(EVP_CIPHER_CTX_rand_key); | ||
680 | 704 | ||
681 | int | 705 | int |
682 | EVP_CIPHER_CTX_copy(EVP_CIPHER_CTX *out, const EVP_CIPHER_CTX *in) | 706 | EVP_CIPHER_CTX_copy(EVP_CIPHER_CTX *out, const EVP_CIPHER_CTX *in) |
@@ -723,3 +747,4 @@ EVP_CIPHER_CTX_copy(EVP_CIPHER_CTX *out, const EVP_CIPHER_CTX *in) | |||
723 | 747 | ||
724 | return 1; | 748 | return 1; |
725 | } | 749 | } |
750 | LCRYPTO_ALIAS(EVP_CIPHER_CTX_copy); | ||