apple / swift-nio-ssl

TLS Support for SwiftNIO, based on BoringSSL.
https://swiftpackageindex.com/apple/swift-nio-ssl/main/documentation/niossl
Apache License 2.0
387 stars 139 forks source link

Add TLS-PSK Support #369

Closed agnosticdev closed 2 years ago

agnosticdev commented 2 years ago

Motivation:

Add TLS-PSK Support to address #230.

Modifications:

Modified SSLContext to take a passed in PSK callback to perform key and identity operations during the handshake.

Result:

TLS-PSK support for TLS 1.2. TLS 1.3 is not addressed due to API support in BoringSSL.

agnosticdev commented 2 years ago

@Lukasa for review. Thank you!

agnosticdev commented 2 years ago

Looks like I have some null-terminating string issues on for 5.7. I can look at how to address this.

agnosticdev commented 2 years ago

Note that the latest commit for 308299a is only a WIP partial. I will be addressing more bit by bit.

agnosticdev commented 2 years ago

Note that same as yesterday, 409e1c1 is only a partial WIP commit. There is still a long way to go on this and a lot for me to cleanup.

agnosticdev commented 2 years ago

Another WIP commit for e3c15ef. Before I addressed the rest of the feedback I wanted to double check my understanding of the PSKIdentityCallbackManager feedback.

agnosticdev commented 2 years ago

@Lukasa provided that all of the outstanding builds pass above, 516a89f should now address the rest of your feedback.

agnosticdev commented 2 years ago

I reverted a change I made because this caused a breakage. I am still in need of researching a technique for copying the output key using withUnsafeBytes. I will update when I've made progress on this.

agnosticdev commented 2 years ago

@Lukasa 23f6baa should have the latest changes in it and is ready for review again.

agnosticdev commented 2 years ago

Updating my branch with the latest changes on main.

agnosticdev commented 2 years ago

@Lukasa feedback addressed in 0101dcb and all other comments inline.

agnosticdev commented 2 years ago

Merging recent updates from main into this branch.

agnosticdev commented 2 years ago

@Lukasa updated based on latest feedback. Thanks for pointing out the TLSConfiguration equatable scenario.

agnosticdev commented 2 years ago

Thank you @Lukasa for all of the help here, it absolutely was a team effort!