Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions wolfssl/openssl/conf.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
14 changes: 8 additions & 6 deletions wolfssl/ssl.h
Original file line number Diff line number Diff line change
Expand Up @@ -270,13 +270,21 @@ 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. */
#if defined(OPENSSL_EXTRA) || defined(OPENSSL_EXTRA_X509_SMALL)
#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
Expand Down Expand Up @@ -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);
Expand Down
8 changes: 8 additions & 0 deletions wolfssl/wolfcrypt/settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand All @@ -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
Expand Down
18 changes: 16 additions & 2 deletions wolfssl/wolfcrypt/wc_port.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why remove this potentially helpful comment? Is there an updated description we could add?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed it because the same thing (de-applying extern "C") happens in multiple places. Alternatively, I could replicate the same comment in all the places this happens.

* problems with extern "C" linkage if not handled */
#ifdef __cplusplus
} /* extern "C" */
#endif
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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))
Expand Down
20 changes: 19 additions & 1 deletion wolfssl/wolfio.h
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand All @@ -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)
Expand Down Expand Up @@ -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 */
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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
Expand Down
Loading