diff options
author | Denys Vlasenko | 2021-11-28 02:56:02 +0100 |
---|---|---|
committer | Denys Vlasenko | 2021-11-28 02:56:02 +0100 |
commit | 1b93c7c4ecc47318905b6e6f801732b7dd31e0ee (patch) | |
tree | 8ead2f50376333e29fb0442bf68992ead55c39e6 | |
parent | 0b13ab66f43fc1a9437361cfcd33b485422eb0ae (diff) | |
download | busybox-1b93c7c4ecc47318905b6e6f801732b7dd31e0ee.zip busybox-1b93c7c4ecc47318905b6e6f801732b7dd31e0ee.tar.gz |
tls: P256: pad struct sp_point to 64 bits (on 64-bit arches)
function old new delta
curve_P256_compute_pubkey_and_premaster 198 190 -8
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r-- | networking/tls_sp_c32.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/networking/tls_sp_c32.c b/networking/tls_sp_c32.c index 4c8f08d..37e1cfa 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; |