mbedtls: add ifdefs to fix legacy compatibility