Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PlayStation compatibility #7072

Merged
merged 1 commit into from
Feb 28, 2024
Merged
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
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 @@ -576,7 +582,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 @@ -2081,7 +2087,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)
dgarske marked this conversation as resolved.
Show resolved Hide resolved
#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 @@ -907,8 +907,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 @@ -923,7 +927,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 @@ -732,7 +732,9 @@ WOLFSSL_ABI WOLFSSL_API int wolfCrypt_Cleanup(void);
#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 @@ -163,11 +163,15 @@
#include <sys/socket.h>
#include <arpa/inet.h>
#include <netinet/in.h>
#include <netdb.h>
#ifdef HAVE_NETDB_H
#include <netdb.h>
Copy link
Contributor

Choose a reason for hiding this comment

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

Note: This change broke the wolfTPM test, because it (wolfTPM) was not setting HAVE_NETDB_H. Fixed in wolfTPM.

#endif
#ifdef __PPU
#include <netex/errno.h>
#else
#include <sys/ioctl.h>
#ifdef HAVE_SYS_IOCTL_H
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@dgarske @douzzer
Apparently, this check is removed in the current master.
Could you add it back please in src/wolfio.c:85 ?
I can open a PR, but it might take forever to get legal approval.
Thanks!

Copy link
Contributor

Choose a reason for hiding this comment

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

Hi @farazrbx , I don't recall that getting changed back, but we will take a look. Thanks, David Garske, wolfSSL

Copy link
Contributor Author

Choose a reason for hiding this comment

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

#include <sys/ioctl.h>
#endif
#endif
#endif
#endif
Expand Down