Skip to content

Commit

Permalink
[MacCatalyst] Make AppleCryptoNative_SslSetEnabledCipherSuites check …
Browse files Browse the repository at this point in the history
…for 32 bit & 16 bit SSLCipherSuite (#57623)

According to CipherSuites.h, SSLCipherSuite is a 16 bit value on iOS/tvOS x64 & arm64, but on MacCatalyst that is only true on arm64. x64 is defined as 32 bit.

/* 16-bit value on iOS */
typedef uint16_t SSLCipherSuite;
/* 32-bit value elsewhere */
typedef uint32_t SSLCipherSuite;

Fixes #53120
  • Loading branch information
steveisok committed Aug 26, 2021
1 parent aa52611 commit 3010642
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -596,19 +596,19 @@ int32_t AppleCryptoNative_SslSetEnabledCipherSuites(SSLContextRef sslContext, co
// Max numCipherSuites is 2^16 (all possible cipher suites)
assert(numCipherSuites < (1 << 16));

#if !defined(TARGET_MACCATALYST) && !defined(TARGET_IOS) && !defined(TARGET_TVOS)
#if !defined(TARGET_ARM64) && !defined(TARGET_IOS) && !defined(TARGET_TVOS)
if (sizeof(SSLCipherSuite) == sizeof(uint32_t))
{
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
// macOS
// macOS & MacCatalyst x64
return SSLSetEnabledCiphers(sslContext, (const SSLCipherSuite *)cipherSuites, (size_t)numCipherSuites);
#pragma clang diagnostic pop
}
else
#endif
{
// MacCatalyst, iOS, tvOS, watchOS
// MacCatalyst arm64, iOS, tvOS, watchOS
SSLCipherSuite* cipherSuites16 = (SSLCipherSuite*)calloc((size_t)numCipherSuites, sizeof(SSLCipherSuite));

if (cipherSuites16 == NULL)
Expand Down

0 comments on commit 3010642

Please sign in to comment.