Add dynamic buffer allocation and size checking
Add dynamic buffer allocation and size checking

Signed-off-by: Piotr Nowicki <1182d26662c9ee5913dced3e5502fc382c8caf19@arm.com>

ARMmbed/mbedtls,Mbed-TLS/mbedtls,Mbed-TLS/mbedtls,Mbed-TLS/mbedtls,NXPmicro/mbedtls,ARMmbed/mbedtls,Mbed-TLS/mbedtls,NXPmicro/mbedtls,NXPmicro/mbedtls,NXPmicro/mbedtls,ARMmbed/mbedtls,ARMmbed/mbedtls