How do I make use of SSLSetALPNProtocols?

316 Views Asked by At

I'm working on a TLS library for the vapor project and am supporting both Apple's (Transport-)Security and OpenSSL for use in an HTTP/2 client and server.

On this line of code I'm trying to call SSLSetALPNProtocols. Regardless of my approach, I'm met with an ld linker error on that line of code.

Undefined symbols for architecture x86_64:
  "_SSLSetALPNProtocols", referenced from:
      __T08AppleSSL9SSLOptionV4alpnACSaySSG9protocols_tFZySo10SSLContextCKcfU_ in Options.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

There's no documentation available to highlight a possible obvious mistake since the page is empty.

So, how do I get this code to compile with ALPN support?

2

There are 2 best solutions below

2
JoannisO On BEST ANSWER

As of the latest macOS and Xcode beta with Swift 4.1 I've got this up and running.

1
ePirat On

Currently that's impossible. Apple forgot to export the SSLSetALPNProtocols and SSLCopyALPNProtocols function.

I already filed rdar://34790589 (duplicate of rdar://33907676)