Merge pull request #9636 from julek-wolfssl/zephyr-fixes-202601
Address Zephyr and C++ compatibility issues
This commit is contained in:
@@ -24,22 +24,30 @@
|
||||
#ifndef WOLFSSL_conf_H_
|
||||
#define WOLFSSL_conf_H_
|
||||
|
||||
#include <wolfssl/wolfcrypt/settings.h>
|
||||
#include <wolfssl/version.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <wolfssl/wolfcrypt/settings.h>
|
||||
#include <wolfssl/version.h>
|
||||
|
||||
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 <wolfssl/ssl.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct WOLFSSL_CONF {
|
||||
void *meth_data;
|
||||
WOLF_LHASH_OF(WOLFSSL_CONF_VALUE) *data;
|
||||
|
||||
@@ -270,6 +270,10 @@ typedef struct WOLFSSL_BY_DIR WOLFSSL_BY_DIR;
|
||||
/* redeclare guard */
|
||||
#define WOLFSSL_TYPES_DEFINED
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#include <wolfssl/wolfio.h>
|
||||
|
||||
/* The WOLFSSL_RSA type is required in all build configurations. */
|
||||
@@ -277,6 +281,10 @@ typedef struct WOLFSSL_BY_DIR WOLFSSL_BY_DIR;
|
||||
#include <wolfssl/openssl/rsa.h>
|
||||
#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);
|
||||
|
||||
@@ -2594,6 +2594,10 @@ extern void uITRON4_free(void *p) ;
|
||||
#endif /*(WOLFSSL_APACHE_MYNEWT)*/
|
||||
|
||||
#ifdef WOLFSSL_ZEPHYR
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#include <version.h>
|
||||
#if KERNEL_VERSION_NUMBER >= 0x30100
|
||||
#include <zephyr/kernel.h>
|
||||
@@ -2606,6 +2610,10 @@ extern void uITRON4_free(void *p) ;
|
||||
#endif
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define WOLFSSL_DH_CONST
|
||||
#define NO_WRITEV
|
||||
#define NO_STDLIB_ISASCII
|
||||
|
||||
@@ -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 <zephyr/fs/fs.h>
|
||||
|
||||
#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 <version.h>
|
||||
#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))
|
||||
|
||||
@@ -176,6 +176,10 @@
|
||||
#include <lwip-socket.h>
|
||||
#include <errno.h>
|
||||
#elif defined(WOLFSSL_ZEPHYR)
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#include <version.h>
|
||||
#if KERNEL_VERSION_NUMBER >= 0x30100
|
||||
#include <zephyr/net/socket.h>
|
||||
@@ -188,6 +192,10 @@
|
||||
#include <posix/sys/socket.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
#elif defined(MICROCHIP_PIC32)
|
||||
#include <sys/errno.h>
|
||||
#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
|
||||
|
||||
Reference in New Issue
Block a user