diff --git a/wolfssl/openssl/conf.h b/wolfssl/openssl/conf.h index d059c59752..1007b64a14 100644 --- a/wolfssl/openssl/conf.h +++ b/wolfssl/openssl/conf.h @@ -24,22 +24,30 @@ #ifndef WOLFSSL_conf_H_ #define WOLFSSL_conf_H_ +#include +#include + #ifdef __cplusplus extern "C" { #endif -#include -#include - typedef struct WOLFSSL_CONF_VALUE { char *section; char *name; char *value; } WOLFSSL_CONF_VALUE; +#ifdef __cplusplus +} /* extern "C" */ +#endif + /* ssl.h requires WOLFSSL_CONF_VALUE */ #include +#ifdef __cplusplus + extern "C" { +#endif + typedef struct WOLFSSL_CONF { void *meth_data; WOLF_LHASH_OF(WOLFSSL_CONF_VALUE) *data; diff --git a/wolfssl/ssl.h b/wolfssl/ssl.h index a1c7bedf45..ba8f56ca02 100644 --- a/wolfssl/ssl.h +++ b/wolfssl/ssl.h @@ -270,6 +270,10 @@ typedef struct WOLFSSL_BY_DIR WOLFSSL_BY_DIR; /* redeclare guard */ #define WOLFSSL_TYPES_DEFINED +#ifdef __cplusplus + } /* extern "C" */ +#endif + #include /* The WOLFSSL_RSA type is required in all build configurations. */ @@ -277,6 +281,10 @@ typedef struct WOLFSSL_BY_DIR WOLFSSL_BY_DIR; #include #endif +#ifdef __cplusplus + extern "C" { +#endif + #ifndef WC_RNG_TYPE_DEFINED /* guard on redeclaration */ typedef struct WC_RNG WC_RNG; #define WC_RNG_TYPE_DEFINED @@ -2158,12 +2166,6 @@ WOLFSSL_API int wolfSSL_BIO_set_mem_buf(WOLFSSL_BIO* bio, WOLFSSL_BUF_MEM* bufMe #endif WOLFSSL_API int wolfSSL_BIO_get_len(WOLFSSL_BIO *bio); -#ifdef WOLFSSL_HAVE_BIO_ADDR -WOLFSSL_API WOLFSSL_BIO_ADDR *wolfSSL_BIO_ADDR_new(void); -WOLFSSL_API void wolfSSL_BIO_ADDR_free(WOLFSSL_BIO_ADDR *addr); -WOLFSSL_API void wolfSSL_BIO_ADDR_clear(WOLFSSL_BIO_ADDR *addr); -#endif /* WOLFSSL_HAVE_BIO_ADDR */ - #endif /* !NO_BIO */ WOLFSSL_API void wolfSSL_RAND_screen(void); diff --git a/wolfssl/wolfcrypt/settings.h b/wolfssl/wolfcrypt/settings.h index bf3029791c..3b2ebf72ec 100644 --- a/wolfssl/wolfcrypt/settings.h +++ b/wolfssl/wolfcrypt/settings.h @@ -2594,6 +2594,10 @@ extern void uITRON4_free(void *p) ; #endif /*(WOLFSSL_APACHE_MYNEWT)*/ #ifdef WOLFSSL_ZEPHYR + #ifdef __cplusplus + } /* extern "C" */ + #endif + #include #if KERNEL_VERSION_NUMBER >= 0x30100 #include @@ -2606,6 +2610,10 @@ extern void uITRON4_free(void *p) ; #endif #include + #ifdef __cplusplus + extern "C" { + #endif + #define WOLFSSL_DH_CONST #define NO_WRITEV #define NO_STDLIB_ISASCII diff --git a/wolfssl/wolfcrypt/wc_port.h b/wolfssl/wolfcrypt/wc_port.h index 875511d72e..384edab030 100644 --- a/wolfssl/wolfcrypt/wc_port.h +++ b/wolfssl/wolfcrypt/wc_port.h @@ -283,8 +283,6 @@ #elif defined(WOLFSSL_APACHE_MYNEWT) /* do nothing */ #elif defined(WOLFSSL_ZEPHYR) - /* Zephyr SDK can use a cpp compiler which will cause - * problems with extern "C" linkage if not handled */ #ifdef __cplusplus } /* extern "C" */ #endif @@ -994,8 +992,16 @@ WOLFSSL_ABI WOLFSSL_API int wolfCrypt_Cleanup(void); #define XFGETS(b,s,f) -2 /* Not ported yet */ #elif defined(WOLFSSL_ZEPHYR) + #ifdef __cplusplus + } /* extern "C" */ + #endif + #include + #ifdef __cplusplus + extern "C" { + #endif + #define XFILE struct fs_file_t* /* These are our wrappers for opening and closing files to @@ -1481,6 +1487,10 @@ WOLFSSL_ABI WOLFSSL_API int wolfCrypt_Cleanup(void); #define USE_WOLF_TIME_T #elif defined(WOLFSSL_ZEPHYR) + #ifdef __cplusplus + } /* extern "C" */ + #endif + #include #ifndef _POSIX_C_SOURCE #if KERNEL_VERSION_NUMBER >= 0x30100 @@ -1500,6 +1510,10 @@ WOLFSSL_ABI WOLFSSL_API int wolfCrypt_Cleanup(void); #endif #endif + #ifdef __cplusplus + extern "C" { + #endif + time_t z_time(time_t *timer); #define XTIME(tl) z_time((tl)) diff --git a/wolfssl/wolfio.h b/wolfssl/wolfio.h index 2ddd830ef3..8430fdf444 100644 --- a/wolfssl/wolfio.h +++ b/wolfssl/wolfio.h @@ -176,6 +176,10 @@ #include #include #elif defined(WOLFSSL_ZEPHYR) + #ifdef __cplusplus + } /* extern "C" */ + #endif + #include #if KERNEL_VERSION_NUMBER >= 0x30100 #include @@ -188,6 +192,10 @@ #include #endif #endif + + #ifdef __cplusplus + extern "C" { + #endif #elif defined(MICROCHIP_PIC32) #include #elif defined(HAVE_NETX) @@ -533,7 +541,11 @@ typedef struct hostent HOSTENT; #endif /* HAVE_SOCKADDR */ - #if defined(HAVE_GETADDRINFO) + #if defined(WOLFSSL_ZEPHYR) + typedef struct zsock_addrinfo ADDRINFO; + #define getaddrinfo zsock_getaddrinfo + #define freeaddrinfo zsock_freeaddrinfo + #elif defined(HAVE_GETADDRINFO) typedef struct addrinfo ADDRINFO; #endif #endif /* WOLFSSL_NO_SOCK */ @@ -573,6 +585,10 @@ union WOLFSSL_BIO_ADDR { typedef union WOLFSSL_BIO_ADDR WOLFSSL_BIO_ADDR; +WOLFSSL_API WOLFSSL_BIO_ADDR *wolfSSL_BIO_ADDR_new(void); +WOLFSSL_API void wolfSSL_BIO_ADDR_free(WOLFSSL_BIO_ADDR *addr); +WOLFSSL_API void wolfSSL_BIO_ADDR_clear(WOLFSSL_BIO_ADDR *addr); + #if defined(WOLFSSL_DTLS) && defined(OPENSSL_EXTRA) WOLFSSL_API int wolfIO_SendTo(SOCKET_T sd, WOLFSSL_BIO_ADDR *addr, char *buf, int sz, int wrFlags); WOLFSSL_API int wolfIO_RecvFrom(SOCKET_T sd, WOLFSSL_BIO_ADDR *addr, char *buf, int sz, int rdFlags); @@ -994,6 +1010,8 @@ WOLFSSL_API void wolfSSL_SetIOWriteFlags(WOLFSSL* ssl, int flags); #endif #elif defined(FREESCALE_MQX) #define XINET_PTON(a,b,c,d) inet_pton((a),(b),(c),(d)) + #elif defined(WOLFSSL_ZEPHYR) + #define XINET_PTON(a,b,c) zsock_inet_pton((a),(b),(c)) #else #define XINET_PTON(a,b,c) inet_pton((a),(b),(c)) #endif