aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2021-04-27 12:24:21 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2021-04-27 12:24:21 +0200
commit48a18d15dfbfa41d137802e811a3abdfef012ac8 (patch)
treeece61a12f4164691da297a15b61bb56960f9b870
parent39a3ef51b54272dea4018002080a104c21c6bb97 (diff)
downloadbusybox-w32-48a18d15dfbfa41d137802e811a3abdfef012ac8.tar.gz
busybox-w32-48a18d15dfbfa41d137802e811a3abdfef012ac8.tar.bz2
busybox-w32-48a18d15dfbfa41d137802e811a3abdfef012ac8.zip
tls: shrink p256_base more
function old new delta static.p256_base_bin - 64 +64 sp_256_point_from_bin2x32 - 62 +62 static.base_y 40 - -40 static.base_x 40 - -40 curve_P256_compute_pubkey_and_premaster 291 194 -97 ------------------------------------------------------------------------------ (add/remove: 2/2 grow/shrink: 0/1 up/down: 126/-177) Total: -51 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--networking/tls_sp_c32.c17
1 files changed, 7 insertions, 10 deletions
diff --git a/networking/tls_sp_c32.c b/networking/tls_sp_c32.c
index 64c53b006..f9c66b186 100644
--- a/networking/tls_sp_c32.c
+++ b/networking/tls_sp_c32.c
@@ -790,19 +790,16 @@ static void sp_256_ecc_mulmod_base_10(sp_point* r, sp_digit* k /*, int map*/)
790 * don't have "static const sp_point p256_base = {...}", 790 * don't have "static const sp_point p256_base = {...}",
791 * it would have more zeros than data. 791 * it would have more zeros than data.
792 */ 792 */
793 static const sp_digit base_x[] = { 793 static const uint8_t p256_base_bin[] = {
794 0x098c296,0x04e5176,0x33a0f4a,0x204b7ac,0x277037d,0x0e9103c,0x3ce6e56,0x1091fe2,0x1f2e12c,0x01ac5f4 794 /* x (big-endian) */
795 }; 795 0x6b,0x17,0xd1,0xf2,0xe1,0x2c,0x42,0x47,0xf8,0xbc,0xe6,0xe5,0x63,0xa4,0x40,0xf2,0x77,0x03,0x7d,0x81,0x2d,0xeb,0x33,0xa0,0xf4,0xa1,0x39,0x45,0xd8,0x98,0xc2,0x96,
796 static const sp_digit base_y[] = { 796 /* y */
797 0x3bf51f5,0x1901a0d,0x1ececbb,0x15dacc5,0x22bce33,0x303e785,0x27eb4a7,0x1fe6e3b,0x2e2fe1a,0x013f8d0 797 0x4f,0xe3,0x42,0xe2,0xfe,0x1a,0x7f,0x9b,0x8e,0xe7,0xeb,0x4a,0x7c,0x0f,0x9e,0x16,0x2b,0xce,0x33,0x57,0x6b,0x31,0x5e,0xce,0xcb,0xb6,0x40,0x68,0x37,0xbf,0x51,0xf5,
798 /* z will be set to 0, infinity flag to "false" */
798 }; 799 };
799 sp_point p256_base; 800 sp_point p256_base;
800 801
801 memset(&p256_base, 0, sizeof(p256_base)); 802 sp_256_point_from_bin2x32(&p256_base, p256_base_bin);
802 memcpy(p256_base.x, base_x, sizeof(base_x));
803 memcpy(p256_base.y, base_y, sizeof(base_y));
804 p256_base.z[0] = 1;
805 /*p256_base.infinity = 0;*/
806 803
807 sp_256_ecc_mulmod_10(r, &p256_base, k /*, map*/); 804 sp_256_ecc_mulmod_10(r, &p256_base, k /*, map*/);
808} 805}