@@ -3018,9 +3018,15 @@ int wolfSSL_CTX_load_verify_locations_ex(WOLFSSL_CTX* ctx, const char* file,
30183018 }
30193019
30203020 if (file != NULL ) {
3021+ #ifdef WOLFSSL_PEM_TO_DER
30213022 /* Load the PEM formatted CA file */
30223023 ret = ProcessFile (ctx , file , WOLFSSL_FILETYPE_PEM , CA_TYPE , NULL , 0 ,
30233024 NULL , verify );
3025+ #else
3026+ /* Load the DER formatted CA file */
3027+ ret = ProcessFile (ctx , file , WOLFSSL_FILETYPE_ASN1 , CA_TYPE , NULL , 0 ,
3028+ NULL , verify );
3029+ #endif
30243030#ifndef NO_WOLFSSL_DIR
30253031 if (ret == 1 ) {
30263032 /* Include success in overall count. */
@@ -3029,7 +3035,11 @@ int wolfSSL_CTX_load_verify_locations_ex(WOLFSSL_CTX* ctx, const char* file,
30293035#endif
30303036#if defined(WOLFSSL_TRUST_PEER_CERT ) && defined(OPENSSL_COMPATIBLE_DEFAULTS )
30313037 /* Load CA as a trusted peer certificate. */
3038+ #ifdef WOLFSSL_PEM_TO_DER
30323039 ret = wolfSSL_CTX_trust_peer_cert (ctx , file , WOLFSSL_FILETYPE_PEM );
3040+ #else
3041+ ret = wolfSSL_CTX_trust_peer_cert (ctx , file , WOLFSSL_FILETYPE_ASN1 );
3042+ #endif
30333043 if (ret != 1 ) {
30343044 WOLFSSL_MSG ("wolfSSL_CTX_trust_peer_cert error" );
30353045 }
@@ -3592,8 +3602,13 @@ int wolfSSL_CTX_use_certificate_chain_file(WOLFSSL_CTX* ctx, const char* file)
35923602 /* process up to MAX_CHAIN_DEPTH plus subject cert */
35933603 WOLFSSL_ENTER ("wolfSSL_CTX_use_certificate_chain_file" );
35943604
3605+ #ifdef WOLFSSL_PEM_TO_DER
35953606 ret = ProcessFile (ctx , file , WOLFSSL_FILETYPE_PEM , CERT_TYPE , NULL , 1 , NULL ,
35963607 GET_VERIFY_SETTING_CTX (ctx ));
3608+ #else
3609+ ret = ProcessFile (ctx , file , WOLFSSL_FILETYPE_ASN1 , CERT_TYPE , NULL , 1 , NULL ,
3610+ GET_VERIFY_SETTING_CTX (ctx ));
3611+ #endif
35973612
35983613 /* Return 1 on success or 0 on failure. */
35993614 return WS_RC (ret );
@@ -3895,8 +3910,13 @@ int wolfSSL_use_certificate_chain_file(WOLFSSL* ssl, const char* file)
38953910 ret = BAD_FUNC_ARG ;
38963911 }
38973912 else {
3913+ #ifdef WOLFSSL_PEM_TO_DER
38983914 ret = ProcessFile (ssl -> ctx , file , WOLFSSL_FILETYPE_PEM , CERT_TYPE , ssl ,
38993915 1 , NULL , GET_VERIFY_SETTING_SSL (ssl ));
3916+ #else
3917+ ret = ProcessFile (ssl -> ctx , file , WOLFSSL_FILETYPE_ASN1 , CERT_TYPE , ssl ,
3918+ 1 , NULL , GET_VERIFY_SETTING_SSL (ssl ));
3919+ #endif
39003920 /* Return 1 on success or 0 on failure. */
39013921 ret = WS_RC (ret );
39023922 }
@@ -4483,8 +4503,13 @@ int wolfSSL_CTX_use_certificate_chain_buffer_format(WOLFSSL_CTX* ctx,
44834503int wolfSSL_CTX_use_certificate_chain_buffer (WOLFSSL_CTX * ctx ,
44844504 const unsigned char * in , long sz )
44854505{
4506+ #ifdef WOLFSSL_PEM_TO_DER
44864507 return wolfSSL_CTX_use_certificate_chain_buffer_format (ctx , in , sz ,
44874508 WOLFSSL_FILETYPE_PEM );
4509+ #else
4510+ return wolfSSL_CTX_use_certificate_chain_buffer_format (ctx , in , sz ,
4511+ WOLFSSL_FILETYPE_ASN1 );
4512+ #endif
44884513}
44894514
44904515/* Load a user certificate in a buffer into SSL.
@@ -4823,8 +4848,13 @@ int wolfSSL_use_certificate_chain_buffer_format(WOLFSSL* ssl,
48234848int wolfSSL_use_certificate_chain_buffer (WOLFSSL * ssl , const unsigned char * in ,
48244849 long sz )
48254850{
4851+ #ifdef WOLFSSL_PEM_TO_DER
48264852 return wolfSSL_use_certificate_chain_buffer_format (ssl , in , sz ,
48274853 WOLFSSL_FILETYPE_PEM );
4854+ #else
4855+ return wolfSSL_use_certificate_chain_buffer_format (ssl , in , sz ,
4856+ WOLFSSL_FILETYPE_ASN1 );
4857+ #endif
48284858}
48294859
48304860#if defined(OPENSSL_EXTRA ) || defined(HAVE_LIGHTY ) || \
0 commit comments