Properly handle mbedtls errors, ensure we don't ask more bytes than
allowed for each iteration.
(cherry picked from commit e0140601a5)
Properly handle mbedtls errors, ensure we don't ask more bytes than
allowed for each iteration.
(cherry picked from commit e0140601a5)