[git commit] tls: P256: pad struct sp_point to 64 bits (on 64-bit arches)
Denys Vlasenko
vda.linux at googlemail.com
Sun Nov 28 01:56:02 UTC 2021
commit: https://git.busybox.net/busybox/commit/?id=1b93c7c4ecc47318905b6e6f801732b7dd31e0ee
branch: https://git.busybox.net/busybox/commit/?id=refs/heads/master
function old new delta
curve_P256_compute_pubkey_and_premaster 198 190 -8
Signed-off-by: Denys Vlasenko <vda.linux at googlemail.com>
---
networking/tls_sp_c32.c | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)
diff --git a/networking/tls_sp_c32.c b/networking/tls_sp_c32.c
index 4c8f08d4e..37e1cfa1c 100644
--- a/networking/tls_sp_c32.c
+++ b/networking/tls_sp_c32.c
@@ -49,14 +49,19 @@ typedef int32_t signed_sp_digit;
*/
typedef struct sp_point {
- sp_digit x[8];
+ sp_digit x[8]
+#if ULONG_MAX > 0xffffffff
+ /* Make sp_point[] arrays to not be 64-bit misaligned */
+ ALIGNED(8)
+#endif
+ ;
sp_digit y[8];
sp_digit z[8];
int infinity;
} sp_point;
/* The modulus (prime) of the curve P256. */
-static const sp_digit p256_mod[8] = {
+static const sp_digit p256_mod[8] ALIGNED(8) = {
0xffffffff,0xffffffff,0xffffffff,0x00000000,
0x00000000,0x00000000,0x00000001,0xffffffff,
};
@@ -903,7 +908,7 @@ static void sp_512to256_mont_reduce_8(sp_digit* r, sp_digit* a/*, const sp_digit
* a First number to multiply in Montogmery form.
* b Second number to multiply in Montogmery form.
* m Modulus (prime).
- * mp Montogmery mulitplier.
+ * mp Montogmery multiplier.
*/
static void sp_256_mont_mul_8(sp_digit* r, const sp_digit* a, const sp_digit* b
/*, const sp_digit* m, sp_digit mp*/)
@@ -920,7 +925,7 @@ static void sp_256_mont_mul_8(sp_digit* r, const sp_digit* a, const sp_digit* b
* r Result of squaring.
* a Number to square in Montogmery form.
* m Modulus (prime).
- * mp Montogmery mulitplier.
+ * mp Montogmery multiplier.
*/
static void sp_256_mont_sqr_8(sp_digit* r, const sp_digit* a
/*, const sp_digit* m, sp_digit mp*/)
@@ -1145,7 +1150,6 @@ static NOINLINE void sp_256_proj_point_add_8(sp_point* r, sp_point* p, sp_point*
return;
}
-
if (p->infinity || q->infinity) {
*r = p->infinity ? *q : *p; /* struct copy */
return;
More information about the busybox-cvs
mailing list