diff options
author | jsing <> | 2022-09-04 15:56:51 +0000 |
---|---|---|
committer | jsing <> | 2022-09-04 15:56:51 +0000 |
commit | fd3446a28a8545095183ef47018492fb4a658b93 (patch) | |
tree | aca97e42deae0acbda958df836eebb2ef11b66e0 | |
parent | 0dba8d0b642d3c82e3cd754e1bf070bf7605f174 (diff) | |
download | openbsd-fd3446a28a8545095183ef47018492fb4a658b93.tar.gz openbsd-fd3446a28a8545095183ef47018492fb4a658b93.tar.bz2 openbsd-fd3446a28a8545095183ef47018492fb4a658b93.zip |
Remove dead code.
No change in generated assembly.
-rw-r--r-- | src/lib/libcrypto/evp/e_camellia.c | 41 | ||||
-rw-r--r-- | src/lib/libcrypto/evp/e_sm4.c | 7 |
2 files changed, 12 insertions, 36 deletions
diff --git a/src/lib/libcrypto/evp/e_camellia.c b/src/lib/libcrypto/evp/e_camellia.c index 2d7ab73627..bd43180d01 100644 --- a/src/lib/libcrypto/evp/e_camellia.c +++ b/src/lib/libcrypto/evp/e_camellia.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: e_camellia.c,v 1.12 2022/09/04 13:17:18 jsing Exp $ */ | 1 | /* $OpenBSD: e_camellia.c,v 1.13 2022/09/04 15:54:42 jsing Exp $ */ |
2 | /* ==================================================================== | 2 | /* ==================================================================== |
3 | * Copyright (c) 2006 The OpenSSL Project. All rights reserved. | 3 | * Copyright (c) 2006 The OpenSSL Project. All rights reserved. |
4 | * | 4 | * |
@@ -109,14 +109,11 @@ camellia_128_cfb128_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, const unsign | |||
109 | { | 109 | { |
110 | size_t chunk = EVP_MAXCHUNK; | 110 | size_t chunk = EVP_MAXCHUNK; |
111 | 111 | ||
112 | if (128 == 1) | ||
113 | chunk >>= 3; | ||
114 | |||
115 | if (inl < chunk) | 112 | if (inl < chunk) |
116 | chunk = inl; | 113 | chunk = inl; |
117 | 114 | ||
118 | while (inl && inl >= chunk) { | 115 | while (inl && inl >= chunk) { |
119 | Camellia_cfb128_encrypt(in, out, (long)((128 == 1) && !(ctx->flags & EVP_CIPH_FLAG_LENGTH_BITS) ? inl * 8 : inl), &((EVP_CAMELLIA_KEY *)ctx->cipher_data)->ks, ctx->iv, &ctx->num, ctx->encrypt); | 116 | Camellia_cfb128_encrypt(in, out, (long)inl, &((EVP_CAMELLIA_KEY *)ctx->cipher_data)->ks, ctx->iv, &ctx->num, ctx->encrypt); |
120 | inl -= chunk; | 117 | inl -= chunk; |
121 | in += chunk; | 118 | in += chunk; |
122 | out += chunk; | 119 | out += chunk; |
@@ -270,14 +267,11 @@ camellia_192_cfb128_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, const unsign | |||
270 | { | 267 | { |
271 | size_t chunk = EVP_MAXCHUNK; | 268 | size_t chunk = EVP_MAXCHUNK; |
272 | 269 | ||
273 | if (128 == 1) | ||
274 | chunk >>= 3; | ||
275 | |||
276 | if (inl < chunk) | 270 | if (inl < chunk) |
277 | chunk = inl; | 271 | chunk = inl; |
278 | 272 | ||
279 | while (inl && inl >= chunk) { | 273 | while (inl && inl >= chunk) { |
280 | Camellia_cfb128_encrypt(in, out, (long)((128 == 1) && !(ctx->flags & EVP_CIPH_FLAG_LENGTH_BITS) ? inl * 8 : inl), &((EVP_CAMELLIA_KEY *)ctx->cipher_data)->ks, ctx->iv, &ctx->num, ctx->encrypt); | 274 | Camellia_cfb128_encrypt(in, out, (long)inl, &((EVP_CAMELLIA_KEY *)ctx->cipher_data)->ks, ctx->iv, &ctx->num, ctx->encrypt); |
281 | inl -= chunk; | 275 | inl -= chunk; |
282 | in += chunk; | 276 | in += chunk; |
283 | out += chunk; | 277 | out += chunk; |
@@ -431,14 +425,11 @@ camellia_256_cfb128_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, const unsign | |||
431 | { | 425 | { |
432 | size_t chunk = EVP_MAXCHUNK; | 426 | size_t chunk = EVP_MAXCHUNK; |
433 | 427 | ||
434 | if (128 == 1) | ||
435 | chunk >>= 3; | ||
436 | |||
437 | if (inl < chunk) | 428 | if (inl < chunk) |
438 | chunk = inl; | 429 | chunk = inl; |
439 | 430 | ||
440 | while (inl && inl >= chunk) { | 431 | while (inl && inl >= chunk) { |
441 | Camellia_cfb128_encrypt(in, out, (long)((128 == 1) && !(ctx->flags & EVP_CIPH_FLAG_LENGTH_BITS) ? inl * 8 : inl), &((EVP_CAMELLIA_KEY *)ctx->cipher_data)->ks, ctx->iv, &ctx->num, ctx->encrypt); | 432 | Camellia_cfb128_encrypt(in, out, (long)inl, &((EVP_CAMELLIA_KEY *)ctx->cipher_data)->ks, ctx->iv, &ctx->num, ctx->encrypt); |
442 | inl -= chunk; | 433 | inl -= chunk; |
443 | in += chunk; | 434 | in += chunk; |
444 | out += chunk; | 435 | out += chunk; |
@@ -576,8 +567,7 @@ camellia_128_cfb1_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, const unsigned | |||
576 | { | 567 | { |
577 | size_t chunk = EVP_MAXCHUNK; | 568 | size_t chunk = EVP_MAXCHUNK; |
578 | 569 | ||
579 | if (1 == 1) | 570 | chunk >>= 3; |
580 | chunk >>= 3; | ||
581 | 571 | ||
582 | if (inl < chunk) | 572 | if (inl < chunk) |
583 | chunk = inl; | 573 | chunk = inl; |
@@ -621,8 +611,7 @@ camellia_192_cfb1_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, const unsigned | |||
621 | { | 611 | { |
622 | size_t chunk = EVP_MAXCHUNK; | 612 | size_t chunk = EVP_MAXCHUNK; |
623 | 613 | ||
624 | if (1 == 1) | 614 | chunk >>= 3; |
625 | chunk >>= 3; | ||
626 | 615 | ||
627 | if (inl < chunk) | 616 | if (inl < chunk) |
628 | chunk = inl; | 617 | chunk = inl; |
@@ -666,8 +655,7 @@ camellia_256_cfb1_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, const unsigned | |||
666 | { | 655 | { |
667 | size_t chunk = EVP_MAXCHUNK; | 656 | size_t chunk = EVP_MAXCHUNK; |
668 | 657 | ||
669 | if (1 == 1) | 658 | chunk >>= 3; |
670 | chunk >>= 3; | ||
671 | 659 | ||
672 | if (inl < chunk) | 660 | if (inl < chunk) |
673 | chunk = inl; | 661 | chunk = inl; |
@@ -712,14 +700,11 @@ camellia_128_cfb8_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, const unsigned | |||
712 | { | 700 | { |
713 | size_t chunk = EVP_MAXCHUNK; | 701 | size_t chunk = EVP_MAXCHUNK; |
714 | 702 | ||
715 | if (8 == 1) | ||
716 | chunk >>= 3; | ||
717 | |||
718 | if (inl < chunk) | 703 | if (inl < chunk) |
719 | chunk = inl; | 704 | chunk = inl; |
720 | 705 | ||
721 | while (inl && inl >= chunk) { | 706 | while (inl && inl >= chunk) { |
722 | Camellia_cfb8_encrypt(in, out, (long)((8 == 1) && !(ctx->flags & EVP_CIPH_FLAG_LENGTH_BITS) ? inl * 8 : inl), &((EVP_CAMELLIA_KEY *)ctx->cipher_data)->ks, ctx->iv, &ctx->num, ctx->encrypt); | 707 | Camellia_cfb8_encrypt(in, out, (long)inl, &((EVP_CAMELLIA_KEY *)ctx->cipher_data)->ks, ctx->iv, &ctx->num, ctx->encrypt); |
723 | inl -= chunk; | 708 | inl -= chunk; |
724 | in += chunk; | 709 | in += chunk; |
725 | out += chunk; | 710 | out += chunk; |
@@ -757,14 +742,11 @@ camellia_192_cfb8_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, const unsigned | |||
757 | { | 742 | { |
758 | size_t chunk = EVP_MAXCHUNK; | 743 | size_t chunk = EVP_MAXCHUNK; |
759 | 744 | ||
760 | if (8 == 1) | ||
761 | chunk >>= 3; | ||
762 | |||
763 | if (inl < chunk) | 745 | if (inl < chunk) |
764 | chunk = inl; | 746 | chunk = inl; |
765 | 747 | ||
766 | while (inl && inl >= chunk) { | 748 | while (inl && inl >= chunk) { |
767 | Camellia_cfb8_encrypt(in, out, (long)((8 == 1) && !(ctx->flags & EVP_CIPH_FLAG_LENGTH_BITS) ? inl * 8 : inl), &((EVP_CAMELLIA_KEY *)ctx->cipher_data)->ks, ctx->iv, &ctx->num, ctx->encrypt); | 749 | Camellia_cfb8_encrypt(in, out, (long)inl, &((EVP_CAMELLIA_KEY *)ctx->cipher_data)->ks, ctx->iv, &ctx->num, ctx->encrypt); |
768 | inl -= chunk; | 750 | inl -= chunk; |
769 | in += chunk; | 751 | in += chunk; |
770 | out += chunk; | 752 | out += chunk; |
@@ -802,14 +784,11 @@ camellia_256_cfb8_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, const unsigned | |||
802 | { | 784 | { |
803 | size_t chunk = EVP_MAXCHUNK; | 785 | size_t chunk = EVP_MAXCHUNK; |
804 | 786 | ||
805 | if (8 == 1) | ||
806 | chunk >>= 3; | ||
807 | |||
808 | if (inl < chunk) | 787 | if (inl < chunk) |
809 | chunk = inl; | 788 | chunk = inl; |
810 | 789 | ||
811 | while (inl && inl >= chunk) { | 790 | while (inl && inl >= chunk) { |
812 | Camellia_cfb8_encrypt(in, out, (long)((8 == 1) && !(ctx->flags & EVP_CIPH_FLAG_LENGTH_BITS) ? inl * 8 : inl), &((EVP_CAMELLIA_KEY *)ctx->cipher_data)->ks, ctx->iv, &ctx->num, ctx->encrypt); | 791 | Camellia_cfb8_encrypt(in, out, (long)inl, &((EVP_CAMELLIA_KEY *)ctx->cipher_data)->ks, ctx->iv, &ctx->num, ctx->encrypt); |
813 | inl -= chunk; | 792 | inl -= chunk; |
814 | in += chunk; | 793 | in += chunk; |
815 | out += chunk; | 794 | out += chunk; |
diff --git a/src/lib/libcrypto/evp/e_sm4.c b/src/lib/libcrypto/evp/e_sm4.c index fd9a9d04f7..c4bbe567c5 100644 --- a/src/lib/libcrypto/evp/e_sm4.c +++ b/src/lib/libcrypto/evp/e_sm4.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: e_sm4.c,v 1.3 2022/09/04 13:17:18 jsing Exp $ */ | 1 | /* $OpenBSD: e_sm4.c,v 1.4 2022/09/04 15:56:51 jsing Exp $ */ |
2 | /* | 2 | /* |
3 | * Copyright (c) 2017, 2019 Ribose Inc | 3 | * Copyright (c) 2017, 2019 Ribose Inc |
4 | * | 4 | * |
@@ -95,14 +95,11 @@ sm4_cfb128_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, const unsigned char * | |||
95 | { | 95 | { |
96 | size_t chunk = EVP_MAXCHUNK; | 96 | size_t chunk = EVP_MAXCHUNK; |
97 | 97 | ||
98 | if (128 == 1) | ||
99 | chunk >>= 3; | ||
100 | |||
101 | if (inl < chunk) | 98 | if (inl < chunk) |
102 | chunk = inl; | 99 | chunk = inl; |
103 | 100 | ||
104 | while (inl && inl >= chunk) { | 101 | while (inl && inl >= chunk) { |
105 | sm4_cfb128_encrypt(in, out, (long)((128 == 1) && !(ctx->flags & EVP_CIPH_FLAG_LENGTH_BITS) ? inl * 8 : inl), &((EVP_SM4_KEY *)ctx->cipher_data)->ks, ctx->iv, &ctx->num, ctx->encrypt); | 102 | sm4_cfb128_encrypt(in, out, (long)inl, &((EVP_SM4_KEY *)ctx->cipher_data)->ks, ctx->iv, &ctx->num, ctx->encrypt); |
106 | inl -= chunk; | 103 | inl -= chunk; |
107 | in += chunk; | 104 | in += chunk; |
108 | out += chunk; | 105 | out += chunk; |