igrr / axtls-8266

axTLS port for ESP8266
Other
79 stars 33 forks source link

Optimize add_hmac_digest to prevent extra allocations #45

Closed igrr closed 7 years ago

igrr commented 7 years ago

add_hmac_digest used to allocate a temporary buffer with size which could be equal to the maximum fragment size. This was only necessary because hmac functions accepted a contiguous buffer as an input. This change adds variants of hmac functions which accept a vector of buffers as input (aka "gather" input), and uses these new functions to calculate digest in-place, without extra memory allocation.