Skip to content

Commit

Permalink
PlayStation compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
farazrbx committed Feb 27, 2024
1 parent 5c421d0 commit 51d6828
Show file tree
Hide file tree
Showing 8 changed files with 44 additions and 17 deletions.
16 changes: 11 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -130,9 +130,15 @@ if(HAVE___UINT128_T)
list(APPEND WOLFSSL_DEFINITIONS "-DHAVE___UINT128_T")
endif()

include(TestBigEndian)

test_big_endian(WORDS_BIGENDIAN)
if(CMAKE_VERSION VERSION_LESS "3.20")
# TestBigEndian was deprecated in 3.20
include(TestBigEndian)
test_big_endian(IS_BIG_ENDIAN)
set(CMAKE_C_BYTE_ORDER "LITTLE_ENDIAN")
if(IS_BIG_ENDIAN)
set(CMAKE_C_BYTE_ORDER "BIG_ENDIAN")
endif()
endif()

# Thread local storage
include(CheckCSourceCompiles)
Expand Down Expand Up @@ -574,7 +580,7 @@ if(WOLFSSL_LEAN_PSK OR (WOLFSSL_LEAN_TLS AND NOT WOLFSSL_TLS13))
override_cache(WOLFSSL_AESGCM "no")
endif()

if(WOLFSSL_AESGCM AND NOT WORDS_BIGENDIAN)
if(WOLFSSL_AESGCM AND CMAKE_C_BYTE_ORDER STREQUAL "LITTLE_ENDIAN")
override_cache(WOLFSSL_AESGCM "4bit")
endif()

Expand Down Expand Up @@ -2082,7 +2088,7 @@ endif()
# Suppress some warnings about separate compilation, inlining
add_definitions("-DWOLFSSL_IGNORE_FILE_WARN")
# Generate user options header
message("Generating user options header...")
message(STATUS "Generating user options header...")
if (${CMAKE_DISABLE_SOURCE_CHANGES})
set(WOLFSSL_BUILD_OUT_OF_TREE_DEFAULT "${CMAKE_DISABLE_SOURCE_CHANGES}")
else()
Expand Down
6 changes: 6 additions & 0 deletions cmake/config.in
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
/* Define to 1 if you have the <arpa/inet.h> header file. */
#cmakedefine HAVE_ARPA_INET_H @HAVE_ARPA_INET_H@

/* Define to 1 if you have the <sys/ioctl.h> header file. */
#cmakedefine HAVE_SYS_IOCTL_H @HAVE_SYS_IOCTL_H@

/* Define to 1 if you have the <netdb.h> header file. */
#cmakedefine HAVE_NETDB_H @HAVE_NETDB_H@

/* Define to 1 if you have the <sys/socket.h> header file. */
#cmakedefine HAVE_SYS_SOCKET_H @HAVE_SYS_SOCKET_H@

Expand Down
7 changes: 1 addition & 6 deletions wolfssl/openssl/crypto.h
Original file line number Diff line number Diff line change
Expand Up @@ -96,13 +96,8 @@ WOLFSSL_API int wolfSSL_OPENSSL_init_crypto(word64 opts, const OPENSSL_INIT_SETT
#define SSLeay_version wolfSSLeay_version
#define SSLeay wolfSSLeay
#define OpenSSL_version_num wolfSSL_OpenSSL_version_num
#define SSLEAY_VERSION_NUMBER OPENSSL_VERSION_NUMBER

#if defined(WOLFSSL_QT) || defined(WOLFSSL_HITCH)
#define SSLEAY_VERSION 0x10001000L
#else
#define SSLEAY_VERSION 0x0090600fL
#endif
#define SSLEAY_VERSION_NUMBER SSLEAY_VERSION
#define CRYPTO_lock wc_LockMutex_ex

/* this function was used to set the default malloc, free, and realloc */
Expand Down
4 changes: 4 additions & 0 deletions wolfssl/openssl/opensslv.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@
#define OPENSSL_VERSION_TEXT "wolfSSL " LIBWOLFSSL_VERSION_STRING
#define OPENSSL_VERSION 0

#ifndef OPENSSL_IS_WOLFSSL
#define OPENSSL_IS_WOLFSSL
#endif

#endif /* OPENSSL_EXTRA || OPENSSL_EXTRA_X509_SMALL */

#endif /* header */
2 changes: 2 additions & 0 deletions wolfssl/quic.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@

#ifdef WOLFSSL_QUIC

#include <stdint.h>

/* QUIC operates on three encryption levels which determine
* which keys/algos are used for de-/encryption. These are
* kept separately for incoming and outgoing data and.
Expand Down
14 changes: 11 additions & 3 deletions wolfssl/wolfcrypt/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -882,8 +882,12 @@ typedef struct w64wrapper {

#if !defined(NO_FILESYSTEM) && !defined(NO_STDIO_FILESYSTEM)
#ifndef XGETENV
#include <stdlib.h>
#define XGETENV getenv
#ifdef NO_GETENV
#define XGETENV(x) (NULL)
#else
#include <stdlib.h>
#define XGETENV getenv
#endif
#endif
#endif /* !NO_FILESYSTEM && !NO_STDIO_FILESYSTEM */

Expand All @@ -898,7 +902,11 @@ typedef struct w64wrapper {
#endif
#if defined(OPENSSL_ALL) || defined(OPENSSL_EXTRA) || defined(OPENSSL_EXTRA_X509_SMALL)
#define XISALNUM(c) isalnum((c))
#define XISASCII(c) isascii((c))
#ifdef NO_STDLIB_ISASCII
#define XISASCII(c) (((c) >= 0 && (c) <= 127) ? 1 : 0)
#else
#define XISASCII(c) isascii((c))
#endif
#define XISSPACE(c) isspace((c))
#endif
/* needed by wolfSSL_check_domain_name() */
Expand Down
4 changes: 3 additions & 1 deletion wolfssl/wolfcrypt/wc_port.h
Original file line number Diff line number Diff line change
Expand Up @@ -724,7 +724,9 @@ WOLFSSL_ABI WOLFSSL_API int wolfCrypt_Cleanup(void);
#define XS_ISREG(s) (s & M2MB_S_IFREG)
#define SEPARATOR_CHAR ':'
#else
#include <dirent.h>
#ifndef NO_WOLFSSL_DIR
#include <dirent.h>
#endif
#include <unistd.h>
#include <sys/stat.h>
#define XWRITE write
Expand Down
8 changes: 6 additions & 2 deletions wolfssl/wolfio.h
Original file line number Diff line number Diff line change
Expand Up @@ -161,11 +161,15 @@
#include <sys/socket.h>
#include <arpa/inet.h>
#include <netinet/in.h>
#include <netdb.h>
#ifdef HAVE_NETDB_H
#include <netdb.h>
#endif
#ifdef __PPU
#include <netex/errno.h>
#else
#include <sys/ioctl.h>
#ifdef HAVE_SYS_IOCTL_H
#include <sys/ioctl.h>
#endif
#endif
#endif
#endif
Expand Down

0 comments on commit 51d6828

Please sign in to comment.