aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2021-04-26 14:40:21 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2021-04-26 14:40:21 +0200
commit166363f47d74a73a0a3ad1ebbb5aae00752ab8f7 (patch)
tree3b76caae1123c4157eeb20f3bdcb09a6b793e909
parent074b33bf16b8dc047a94d615c24f40d2ba9ead46 (diff)
downloadbusybox-w32-166363f47d74a73a0a3ad1ebbb5aae00752ab8f7.tar.gz
busybox-w32-166363f47d74a73a0a3ad1ebbb5aae00752ab8f7.tar.bz2
busybox-w32-166363f47d74a73a0a3ad1ebbb5aae00752ab8f7.zip
tls: get rid of address obfuscation trick in P256
function old new delta addr_mask 8 - -8 sp_256_ecc_mulmod_10 1363 1330 -33 ------------------------------------------------------------------------------ (add/remove: 0/1 grow/shrink: 0/1 up/down: 0/-41) Total: -41 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--networking/tls_sp_c32.c12
1 files changed, 2 insertions, 10 deletions
diff --git a/networking/tls_sp_c32.c b/networking/tls_sp_c32.c
index b4e14deac..87d44d5e0 100644
--- a/networking/tls_sp_c32.c
+++ b/networking/tls_sp_c32.c
@@ -72,9 +72,6 @@ static const sp_digit p256_mod[10] = {
72 72
73#define p256_mp_mod ((sp_digit)0x000001) 73#define p256_mp_mod ((sp_digit)0x000001)
74 74
75/* Mask for address to obfuscate which of the two address will be used. */
76static const size_t addr_mask[2] = { 0, (size_t)-1 };
77
78/* The base point of curve P256. */ 75/* The base point of curve P256. */
79static const sp_point p256_base = { 76static const sp_point p256_base = {
80 /* X ordinate */ 77 /* X ordinate */
@@ -831,14 +828,9 @@ static void sp_256_ecc_mulmod_10(sp_point* r, const sp_point* g, const sp_digit*
831 n <<= 1; 828 n <<= 1;
832 829
833 sp_256_proj_point_add_10(t[y^1], t[0], t[1], tmp); 830 sp_256_proj_point_add_10(t[y^1], t[0], t[1], tmp);
834///FIXME type (or rewrite - get rid of t[] array) 831 memcpy(t[2], t[y], sizeof(sp_point));
835 memcpy(t[2], (void*)(((size_t)t[0] & addr_mask[y^1]) +
836 ((size_t)t[1] & addr_mask[y])),
837 sizeof(sp_point));
838 sp_256_proj_point_dbl_10(t[2], t[2], tmp); 832 sp_256_proj_point_dbl_10(t[2], t[2], tmp);
839 memcpy((void*)(((size_t)t[0] & addr_mask[y^1]) + 833 memcpy(t[y], t[2], sizeof(sp_point));
840 ((size_t)t[1] & addr_mask[y])), t[2],
841 sizeof(sp_point));
842 } 834 }
843 835
844 if (map) 836 if (map)