Merge remote-tracking branch 'upstream-public/pr/1526' into mbedtls-2.7-proposed

Fixes #1299, fixes #1475 for the 2.7 branch