Mbedtls_x509_crt_verify function never exits

I have to update the firmware on an NXP QN9090 MCU such that it performs client certificate verification against a CA certificate, but the program never goes past the mbedtls_x509_crt_verify function call when the 2 certificates are valid (the function never exits from its execution and returns no value). In case one of the certificates is invalid, the function works fine and returns a value corresponding to using invalid certificates.
The function call that I use is the following:

int status = mbedtls_x509_crt_verify(&clientCertificate, &CACertificate, NULL, NULL, &flags, NULL, NULL);

I mention that the 2 certificates are parsed successfully.