Build cert_ write.c on esp32 using idf.py build command

I want to generate certificate in esp32 itself using cert_write.c file in mbedtls/program/x509. I am getting an error saying mbedtls/mbedtls_config.h not found.
Am I missing out any steps.