diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2021-04-27 18:48:43 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2021-04-27 18:48:43 +0200 |
commit | 81f9a0035b857206ac03afb729be3c8438f218b9 (patch) | |
tree | 29af16ee13c04501ffaa61a295e677bfd9408b03 | |
parent | 840ae696157ae271417953916de861e48a800e2b (diff) | |
download | busybox-w32-81f9a0035b857206ac03afb729be3c8438f218b9.tar.gz busybox-w32-81f9a0035b857206ac03afb729be3c8438f218b9.tar.bz2 busybox-w32-81f9a0035b857206ac03afb729be3c8438f218b9.zip |
tls: tweak sp_256_ecc_gen_k_10 for smaller code
function old new delta
curve_P256_compute_pubkey_and_premaster 194 191 -3
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r-- | networking/tls_sp_c32.c | 7 |
1 files changed, 0 insertions, 7 deletions
diff --git a/networking/tls_sp_c32.c b/networking/tls_sp_c32.c index 2b1ae1496..5a84852a5 100644 --- a/networking/tls_sp_c32.c +++ b/networking/tls_sp_c32.c | |||
@@ -859,13 +859,11 @@ static void sp_ecc_secret_gen_256(const sp_digit priv[10], const uint8_t *pub2x3 | |||
859 | /* Generates a scalar that is in the range 1..order-1. */ | 859 | /* Generates a scalar that is in the range 1..order-1. */ |
860 | #define SIMPLIFY 1 | 860 | #define SIMPLIFY 1 |
861 | /* Add 1 to a. (a = a + 1) */ | 861 | /* Add 1 to a. (a = a + 1) */ |
862 | #if !SIMPLIFY | ||
863 | static void sp_256_add_one_10(sp_digit* a) | 862 | static void sp_256_add_one_10(sp_digit* a) |
864 | { | 863 | { |
865 | a[0]++; | 864 | a[0]++; |
866 | sp_256_norm_10(a); | 865 | sp_256_norm_10(a); |
867 | } | 866 | } |
868 | #endif | ||
869 | static void sp_256_ecc_gen_k_10(sp_digit k[10]) | 867 | static void sp_256_ecc_gen_k_10(sp_digit k[10]) |
870 | { | 868 | { |
871 | #if !SIMPLIFY | 869 | #if !SIMPLIFY |
@@ -896,12 +894,7 @@ static void sp_256_ecc_gen_k_10(sp_digit k[10]) | |||
896 | break; | 894 | break; |
897 | #endif | 895 | #endif |
898 | } | 896 | } |
899 | #if !SIMPLIFY | ||
900 | sp_256_add_one_10(k); | 897 | sp_256_add_one_10(k); |
901 | #else | ||
902 | if (k[0] == 0) | ||
903 | k[0] = 1; | ||
904 | #endif | ||
905 | #undef SIMPLIFY | 898 | #undef SIMPLIFY |
906 | } | 899 | } |
907 | 900 | ||