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