[git commit] tls: tweak sp_256_ecc_gen_k_10 for smaller code

Denys Vlasenko vda.linux at googlemail.com
Tue Apr 27 16:48:43 UTC 2021


commit: https://git.busybox.net/busybox/commit/?id=81f9a0035b857206ac03afb729be3c8438f218b9
branch: https://git.busybox.net/busybox/commit/?id=refs/heads/master

function                                             old     new   delta
curve_P256_compute_pubkey_and_premaster              194     191      -3

Signed-off-by: Denys Vlasenko <vda.linux at googlemail.com>
---
 networking/tls_sp_c32.c | 7 -------
 1 file changed, 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
 /* Generates a scalar that is in the range 1..order-1. */
 #define SIMPLIFY 1
 /* Add 1 to a. (a = a + 1) */
-#if !SIMPLIFY
 static void sp_256_add_one_10(sp_digit* a)
 {
 	a[0]++;
 	sp_256_norm_10(a);
 }
-#endif
 static void sp_256_ecc_gen_k_10(sp_digit k[10])
 {
 #if !SIMPLIFY
@@ -896,12 +894,7 @@ static void sp_256_ecc_gen_k_10(sp_digit k[10])
 		break;
 #endif
 	}
-#if !SIMPLIFY
 	sp_256_add_one_10(k);
-#else
-	if (k[0] == 0)
-		k[0] = 1;
-#endif
 #undef SIMPLIFY
 }
 


More information about the busybox-cvs mailing list