I have function to convert certificate from DER to x509 as follow. In below function I able to see in GDB "cert_der and cert_len" is currect But it crash on line as pointed below.
Why "d2i_X509" causing crash ? Any help ? RetCode convert_der_to_x509(uint8_t *cert_der, uint32_t cert_len) { const unsigned char *bptr = NULL; X509 *x509; bptr = (unsigned char *)cert_der; x509 = d2i_X509(NULL, &bptr, cert_len); /*CRASH on this line*/ if (x509 == NULL) { ERR_print_errors_fp(stderr); printf("DER to x509 converion failed"); return -1; } return 0; } Thanks, sanjay kumar