shithub: riscv

Download patch

ref: de80075fc6bdc6dc785a67db2deaa59df020cfa6
parent: 02ffb19904f03cad21dd10a774705b9152d89010
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Mon Apr 3 21:59:17 EDT 2017

tlshand: fix mpint to bytes conversion, reorganize send/recv buffer, check for overflow in msgSend()

when converting mpint to bytes, always pad it to the size of
the modulus (RSA,DHE,ECDHE). mptobytes() now takes a byte len
parameter which the caller usually calculates from the group
modulus using mpsignif(). this bug sometimes caused "bad record mac"
after the handshake.

use a shared buffer, given that msgSend()/msgRecv() don't overlap
we can use the first half for sending, and the top half for
receiving, shifting down as neccesary. the space beween sendp and
recvp is free.

explicitely check for overflow in msgSend().