diff --git a/wolfssl/internal.h b/wolfssl/internal.h index 5354a9bb2..379be02cb 100644 --- a/wolfssl/internal.h +++ b/wolfssl/internal.h @@ -1555,10 +1555,12 @@ WOLFSSL_LOCAL int SetCipherList(WOLFSSL_CTX*, Suites*, const char* list); typedef unsigned int (*wc_psk_server_callback)(WOLFSSL*, const char*, unsigned char*, unsigned int); #endif /* PSK_TYPES_DEFINED */ -#ifdef WOLFSSL_DTLS +#if defined(WOLFSSL_DTLS) && defined(WOLFSSL_SESSION_EXPORT) && \ + !defined(WOLFSSL_DTLS_EXPORT_TYPES) typedef int (*wc_dtls_export)(WOLFSSL* ssl, unsigned char* exportBuffer, unsigned int sz, void* userCtx); -#endif +#define WOLFSSL_DTLS_EXPORT_TYPES +#endif /* WOLFSSL_DTLS_EXPORT_TYPES */ /* wolfSSL Cipher type just points back to SSL */ @@ -2330,8 +2332,8 @@ struct WOLFSSL_CTX { CallbackIOSend CBIOSend; #ifdef WOLFSSL_DTLS CallbackGenCookie CBIOCookie; /* gen cookie callback */ - wc_dtls_export dtls_export; /* export function for DTLS session */ #ifdef WOLFSSL_SESSION_EXPORT + wc_dtls_export dtls_export; /* export function for DTLS session */ CallbackGetPeer CBGetPeer; CallbackSetPeer CBSetPeer; #endif @@ -3425,7 +3427,9 @@ struct WOLFSSL { DtlsMsg* dtls_rx_msg_list; void* IOCB_CookieCtx; /* gen cookie ctx */ word32 dtls_expected_rx; +#ifdef WOLFSSL_SESSION_EXPORT wc_dtls_export dtls_export; /* export function for session */ +#endif #ifdef WOLFSSL_SCTP word16 dtlsMtuSz; #endif /* WOLFSSL_SCTP */ diff --git a/wolfssl/ssl.h b/wolfssl/ssl.h index 261e04aab..161ece3e5 100644 --- a/wolfssl/ssl.h +++ b/wolfssl/ssl.h @@ -443,8 +443,13 @@ WOLFSSL_API WOLFSSL_METHOD *wolfTLSv1_2_client_method(void); #ifdef WOLFSSL_SESSION_EXPORT #ifdef WOLFSSL_DTLS + +#ifndef WOLFSSL_DTLS_EXPORT_TYPES typedef int (*wc_dtls_export)(WOLFSSL* ssl, unsigned char* exportBuffer, unsigned int sz, void* userCtx); +#define WOLFSSL_DTLS_EXPORT_TYPES +#endif /* WOLFSSL_DTLS_EXPORT_TYPES */ + WOLFSSL_API int wolfSSL_dtls_import(WOLFSSL* ssl, unsigned char* buf, unsigned int sz); WOLFSSL_API int wolfSSL_CTX_dtls_set_export(WOLFSSL_CTX* ctx,