From 229d3c467d20bb776edbbb29517df84f09e1e46f Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Mon, 3 Apr 2017 21:53:29 +0200 Subject: tls: avoid using int16 in pstm code function old new delta pstm_div 1472 1522 +50 psRsaEncryptPub 403 413 +10 pstm_2expt 91 96 +5 pstm_clear 68 72 +4 pstm_init 39 42 +3 pstm_unsigned_bin_size 36 37 +1 pstm_montgomery_reduce 398 399 +1 pstm_init_size 45 46 +1 pstm_zero 39 38 -1 pstm_set 35 34 -1 pstm_read_unsigned_bin 112 109 -3 pstm_mulmod 123 120 -3 pstm_mod 116 113 -3 pstm_cmp 57 54 -3 pstm_sub 107 102 -5 pstm_to_unsigned_bin 157 151 -6 pstm_clamp 63 57 -6 pstm_add 116 108 -8 pstm_grow 81 72 -9 pstm_count_bits 57 48 -9 pstm_init_copy 84 72 -12 pstm_cmp_mag 93 78 -15 pstm_sqr_comba 567 551 -16 pstm_montgomery_calc_normalization 158 140 -18 pstm_copy 115 92 -23 pstm_lshd 133 109 -24 pstm_mul_comba 525 500 -25 pstm_mul_d 251 224 -27 s_pstm_sub 256 228 -28 s_pstm_add 370 337 -33 pstm_div_2d 444 409 -35 pstm_mul_2 195 156 -39 pstm_rshd 154 104 -50 pstm_mul_2d 247 186 -61 pstm_exptmod 1524 1463 -61 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 8/27 up/down: 75/-524) Total: -449 bytes Signed-off-by: Denys Vlasenko --- networking/tls.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'networking/tls.c') diff --git a/networking/tls.c b/networking/tls.c index bbf2b158f..590c04ad9 100644 --- a/networking/tls.c +++ b/networking/tls.c @@ -475,7 +475,7 @@ static void prf_hmac_sha256(/*tls_state_t *tls,*/ uint8_t a[TLS_MAX_MAC_SIZE]; uint8_t *out_p = outbuf; unsigned label_size = strlen(label); - unsigned MAC_size = SHA256_OUTSIZE;///tls->MAC_size; + unsigned MAC_size = SHA256_OUTSIZE; /* In P_hash() calculation, "seed" is "label + seed": */ #define SEED label, label_size, seed, seed_size @@ -486,7 +486,7 @@ static void prf_hmac_sha256(/*tls_state_t *tls,*/ hmac_sha256(/*tls,*/ a, SECRET, SEED, NULL); //TODO: convert hmac to precomputed - for(;;) { + for (;;) { /* HMAC_hash(secret, A(1) + seed) */ if (outbuf_size <= MAC_size) { /* Last, possibly incomplete, block */ -- cgit v1.2.3