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

Starting support for curl 8.5.0 #21

Merged
merged 2 commits into from
May 3, 2024
Merged

Starting support for curl 8.5.0 #21

merged 2 commits into from
May 3, 2024

Conversation

cpu
Copy link
Member

@cpu cpu commented May 2, 2024

My local build of curl 8.5.0 (the version I believe is shipped on Ubuntu 24.04) requires two additional libssl symbols:

  • SSL_get_peer_signature_type_nid - This is implemented in this branch.
  • SSL_CTX_set_cert_store - we had already implemented SSL_CTX_get_cert_store, making this fairly straight-forward to impl.

With the above, curl 8.5.0 now runs without missing symbol errors, but I'm seeing UnknownIssuer errors that make me suspect there's still work to do. I believe these will be fixed by resolving #17

Error output so far:
$> LD_LIBRARY_PATH=./target/release/ ldd $(which curl) | grep libssl
	libssl.so.3 => ./target/release/libssl.so.3 (0x00007ffff7a00000)
	
$> LD_LIBRARY_PATH=./target/release/ curl --version
curl 8.5.0 (x86_64-pc-linux-gnu) libcurl/8.5.0 OpenSSL/3.0.13 zlib/1.3 brotli/1.1.0 zstd/1.5.5 libidn2/2.3.4 libssh2/1.11.0 nghttp2/1.57.0
Release-Date: 2023-12-06
Protocols: dict file ftp ftps gopher gophers http https imap imaps mqtt pop3 pop3s rtsp scp sftp smb smbs smtp smtps telnet tftp
Features: alt-svc AsynchDNS brotli GSS-API HSTS HTTP2 HTTPS-proxy IDN IPv6 Kerberos Largefile libz NTLM SPNEGO SSL threadsafe TLS-SRP UnixSockets zstd

$> LD_LIBRARY_PATH=./target/release/ curl https://example.com
[2024-05-02T19:03:58Z ERROR ssl::error] raising Error { lib: Ssl, reason: Unsupported, string: Some("_SSL_CTX_set_post_handshake_auth") }
[2024-05-02T19:03:58Z ERROR ssl::error] raising Error { lib: User, reason: OperationFailed, string: Some("invalid peer certificate: UnknownIssuer") }
[2024-05-02T19:03:58Z ERROR ssl::error] raising Error { lib: User, reason: OperationFailed, string: Some("invalid peer certificate: UnknownIssuer") }
[2024-05-02T19:03:58Z ERROR ssl::error] raising Error { lib: User, reason: OperationFailed, string: Some("invalid peer certificate: UnknownIssuer") }
[2024-05-02T19:03:58Z ERROR ssl::error] raising Error { lib: User, reason: OperationFailed, string: Some("invalid peer certificate: UnknownIssuer") }
[2024-05-02T19:03:58Z ERROR ssl::error] raising Error { lib: User, reason: OperationFailed, string: Some("invalid peer certificate: UnknownIssuer") }
[2024-05-02T19:03:58Z ERROR ssl::error] raising Error { lib: User, reason: OperationFailed, string: Some("invalid peer certificate: UnknownIssuer") }
curl: (35) OpenSSL/3.0.13: error:400C0107:lib(128)::operation fail

@cpu cpu self-assigned this May 2, 2024
@cpu
Copy link
Member Author

cpu commented May 2, 2024

With the above, curl 8.5.0 now runs without missing symbol errors, but I'm seeing UnknownIssuer errors that make me suspect there's still work to do (so i've opened this as a draft for now):

I suspect this is related to #17

@cpu cpu force-pushed the cpu-curl-8.5.0 branch from 65f3a1e to 92142aa Compare May 2, 2024 19:08
@cpu cpu marked this pull request as ready for review May 2, 2024 19:08
rustls-libssl/src/lib.rs Outdated Show resolved Hide resolved
@cpu cpu force-pushed the cpu-curl-8.5.0 branch from 92142aa to a7a0c72 Compare May 2, 2024 19:13
@cpu cpu changed the title WIP: curl 8.5.0 Starting support for curl 8.5.0 May 2, 2024
@ctz
Copy link
Member

ctz commented May 2, 2024

  • SSL_get_peer_signature_type_nid - I've stubbed this out for now. I'm a little fuzzy on the upstream mapping here. The NIDs are unique to OpenSSL (defined in obj_mac.h). I think the main catch is figuring out how to map from a rustls connection's SupportedCipherSuite to the public key type in use for an associated signature algorithm.

i think for this we'd want the verifiers (client and server) to remember which SignatureScheme they checked (in verify_tls12_signature and co). Then this call should be a straight mapping to the NIDs.

@cpu
Copy link
Member Author

cpu commented May 2, 2024

i think for this we'd want the verifiers (client and server) to remember which SignatureScheme they checked (in verify_tls12_signature and co). Then this call should be a straight mapping to the NIDs.

I took a crack at this (in a separate branch for now since it's a little messy): a79305d

I'm not 100% confident I have the public_key_alg_id -> NID mapping correct, and I had to drag down some private helpers from Rustls 😓 WDYT? On the right track?

@cpu cpu marked this pull request as draft May 3, 2024 13:58
@cpu cpu force-pushed the cpu-curl-8.5.0 branch from a7a0c72 to 914f477 Compare May 3, 2024 15:23
@cpu
Copy link
Member Author

cpu commented May 3, 2024

Reworked based on the feedback from my WIP attempt. This branch now implements SSL_get_peer_signature_type_nid instead of stubbing it. Using the SignatureScheme from the DigitallySignedStruct worked much better than the approach I used initially.

@cpu cpu marked this pull request as ready for review May 3, 2024 15:27
Copy link
Member

@ctz ctz left a comment

Choose a reason for hiding this comment

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

👍🏽

rustls-libssl/src/constants.rs Show resolved Hide resolved
@cpu cpu merged commit 05b5d65 into rustls:main May 3, 2024
11 checks passed
@cpu cpu deleted the cpu-curl-8.5.0 branch May 3, 2024 15:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants