summaryrefslogtreecommitdiff
path: root/networking
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2021-11-27 18:42:27 +0100
committerDenys Vlasenko <vda.linux@googlemail.com>2021-11-27 18:42:27 +0100
commit9c671fe3dd2e46a28c02d266130f56a1a6296791 (patch)
tree8e58609444aa1e436ee58f18b3a529b8e7f2313f /networking
parentdcfd8d3d1013ba989fa511f44bb0553a88c1ef10 (diff)
downloadbusybox-9c671fe3dd2e46a28c02d266130f56a1a6296791.tar.gz
tls: P256: do not open-code copying of struct variables
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'networking')
-rw-r--r--networking/tls_sp_c32.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/networking/tls_sp_c32.c b/networking/tls_sp_c32.c
index b3f7888f5..3291b553c 100644
--- a/networking/tls_sp_c32.c
+++ b/networking/tls_sp_c32.c
@@ -865,6 +865,8 @@ static int sp_256_mul_add_8(sp_digit* r /*, const sp_digit* a, sp_digit b*/)
}
/* Reduce the number back to 256 bits using Montgomery reduction.
+ * Note: the result is NOT guaranteed to be less than p256_mod!
+ * (it is only guaranteed to fit into 256 bits).
*
* a Double-wide number to reduce in place.
* m The single precision number representing the modulus.
@@ -1276,7 +1278,7 @@ static void sp_256_ecc_mulmod_8(sp_point* r, const sp_point* g, const sp_digit*
if (map)
sp_256_map_8(r, &t[0]);
else
- memcpy(r, &t[0], sizeof(sp_point));
+ *r = t[0]; /* struct copy */
memset(t, 0, sizeof(t)); //paranoia
}