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

Fix Xcode warnings #218

Merged
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
17 changes: 14 additions & 3 deletions scripts/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,12 @@ build_ios() {
echo "#elif defined(__APPLE__) && defined (__arm64__)" >> ${OPENSSLCONF_PATH}
cat ${TMP_BUILD_DIR}/${OPENSSL_VERSION}-iPhoneOS-arm64/include/openssl/opensslconf.h >> ${OPENSSLCONF_PATH}
echo "#endif" >> ${OPENSSLCONF_PATH}

# fix RC4_INT redefinition
find "${SCRIPT_DIR}/../iphoneos/include/openssl" -type f -name "*.h" -exec sed -i "" -e "s/\#define RC4_INT unsigned int/\#undef RC4_INT\n#define RC4_INT unsigned int/g" {} \;
find "${SCRIPT_DIR}/../iphoneos/include/openssl" -type f -name "*.h" -exec sed -i "" -e "s/\#define RC4_INT unsigned char/\#undef RC4_INT\n#define RC4_INT unsigned char/g" {} \;
find "${SCRIPT_DIR}/../iphonesimulator/include/openssl" -type f -name "*.h" -exec sed -i "" -e "s/\#define RC4_INT unsigned int/\#undef RC4_INT\n#define RC4_INT unsigned int/g" {} \;
find "${SCRIPT_DIR}/../iphonesimulator/include/openssl" -type f -name "*.h" -exec sed -i "" -e "s/\#define RC4_INT unsigned char/\#undef RC4_INT\n#define RC4_INT unsigned char/g" {} \;

rm -rf ${TMP_BUILD_DIR}
}
Expand Down Expand Up @@ -213,6 +219,10 @@ build_macos() {
echo "#elif defined(__APPLE__) && defined (__arm64__)" >> ${OPENSSLCONF_PATH}
cat ${TMP_BUILD_DIR}/${OPENSSL_VERSION}-MacOSX-arm64/include/openssl/opensslconf.h >> ${OPENSSLCONF_PATH}
echo "#endif" >> ${OPENSSLCONF_PATH}

# fix RC4_INT redefinition
find "${SCRIPT_DIR}/../macosx/include/openssl" -type f -name "*.h" -exec sed -i "" -e "s/\#define RC4_INT unsigned int/\#undef RC4_INT\n#define RC4_INT unsigned int/g" {} \;
find "${SCRIPT_DIR}/../macosx/include/openssl" -type f -name "*.h" -exec sed -i "" -e "s/\#define RC4_INT unsigned char/\#undef RC4_INT\n#define RC4_INT unsigned char/g" {} \;

rm -rf ${TMP_BUILD_DIR}
}
Expand All @@ -235,16 +245,17 @@ build_catalyst() {
# fix inttypes.h
find "${SCRIPT_DIR}/../macosx_catalyst/include/openssl" -type f -name "*.h" -exec sed -i "" -e "s/include <inttypes\.h>/include <sys\/types\.h>/g" {} \;

# fix RC4_INT redefinition
# find "${SCRIPT_DIR}/../macosx/include/openssl" -type f -name "*.h" -exec sed -i "" -e "s/\#define RC4_INT unsigned char/\#if \!defined(RC4_INT)\n#define RC4_INT unsigned char\n\#endif\n/g" {} \;

local OPENSSLCONF_PATH="${SCRIPT_DIR}/../macosx_catalyst/include/openssl/opensslconf.h"
echo "#if defined(__APPLE__) && defined (__x86_64__)" >> ${OPENSSLCONF_PATH}
cat ${TMP_BUILD_DIR}/${OPENSSL_VERSION}-MacOSX_Catalyst-x86_64/include/openssl/opensslconf.h >> ${OPENSSLCONF_PATH}
echo "#elif defined(__APPLE__) && defined (__arm64__)" >> ${OPENSSLCONF_PATH}
cat ${TMP_BUILD_DIR}/${OPENSSL_VERSION}-MacOSX_Catalyst-arm64/include/openssl/opensslconf.h >> ${OPENSSLCONF_PATH}
echo "#endif" >> ${OPENSSLCONF_PATH}

# fix RC4_INT redefinition
find "${SCRIPT_DIR}/../macosx_catalyst/include/openssl" -type f -name "*.h" -exec sed -i "" -e "s/\#define RC4_INT unsigned int/\#undef RC4_INT\n#define RC4_INT unsigned int/g" {} \;
find "${SCRIPT_DIR}/../macosx_catalyst/include/openssl" -type f -name "*.h" -exec sed -i "" -e "s/\#define RC4_INT unsigned char/\#undef RC4_INT\n#define RC4_INT unsigned char/g" {} \;

rm -rf ${TMP_BUILD_DIR}
}

Expand Down
10 changes: 5 additions & 5 deletions shim/shim.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,28 +9,28 @@
#include <openssl/cms.h>

#undef SSL_library_init
static inline void SSL_library_init() {
static inline void SSL_library_init(void) {
OPENSSL_init_ssl(0, NULL);
}

#undef SSL_load_error_strings
static inline void SSL_load_error_strings() {
static inline void SSL_load_error_strings(void) {
OPENSSL_init_ssl(OPENSSL_INIT_LOAD_SSL_STRINGS \
| OPENSSL_INIT_LOAD_CRYPTO_STRINGS, NULL);
}

#undef OpenSSL_add_all_ciphers
static inline void OpenSSL_add_all_ciphers() {
static inline void OpenSSL_add_all_ciphers(void) {
OPENSSL_init_crypto(OPENSSL_INIT_ADD_ALL_CIPHERS, NULL);
}

#undef OpenSSL_add_all_digests
static inline void OpenSSL_add_all_digests() {
static inline void OpenSSL_add_all_digests(void) {
OPENSSL_init_crypto(OPENSSL_INIT_ADD_ALL_DIGESTS, NULL);
}

#undef OpenSSL_add_all_algorithms
static inline void OpenSSL_add_all_algorithms() {
static inline void OpenSSL_add_all_algorithms(void) {
#ifdef OPENSSL_LOAD_CONF
OPENSSL_add_all_algorithms_conf();
#else
Expand Down