Repository: RustPython/RustPython (language: rust)

Issue:
Bump openssl from 0.10.66 to 0.10.70
Bumps [openssl](https://github.com/sfackler/rust-openssl) from 0.10.66 to 0.10.70.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a href="https://github.com/sfackler/rust-openssl/releases">openssl's releases</a>.</em></p>
<blockquote>
<h2>openssl v0.10.70</h2>
<h2>What's Changed</h2>
<ul>
<li>Attempt to fix CI by pinning to the Ubuntu 22.04 image by <a href="https://github.com/alex"><code>@​alex</code></a> in <a href="https://redirect.github.com/sfackler/rust-openssl/pull/2357">sfackler/rust-openssl#2357</a></li>
<li>Remove EC_METHOD and EC_GROUP_new for LibreSSL 4.1 by <a href="https://github.com/botovq"><code>@​botovq</code></a> in <a href="https://redirect.github.com/sfackler/rust-openssl/pull/2356">sfackler/rust-openssl#2356</a></li>
<li>Test against 3.4.0 final release by <a href="https://github.com/alex"><code>@​alex</code></a> in <a href="https://redirect.github.com/sfackler/rust-openssl/pull/2359">sfackler/rust-openssl#2359</a></li>
<li>Expose <code>SslMethod::{dtls_client,dtls_server}</code> by <a href="https://github.com/alex"><code>@​alex</code></a> in <a href="https://redirect.github.com/sfackler/rust-openssl/pull/2358">sfackler/rust-openssl#2358</a></li>
<li>Fix lifetimes in ssl::select_next_proto by <a href="https://github.com/sfackler"><code>@​sfackler</code></a> in <a href="https://redirect.github.com/sfackler/rust-openssl/pull/2360">sfackler/rust-openssl#2360</a></li>
</ul>
<p><strong>Full Changelog</strong>: <a href="https://github.com/sfackler/rust-openssl/compare/openssl-v0.10.69...openssl-v0.10.70">https://github.com/sfackler/rust-openssl/compare/openssl-v0.10.69...openssl-v0.10.70</a></p>
<h2>openssl v0.10.69</h2>
<h2>What's Changed</h2>
<ul>
<li>build(deps): Update <code>openssl-macro</code> to version <code>0.1.1</code> by <a href="https://github.com/caspermeijn"><code>@​caspermeijn</code></a> in <a href="https://redirect.github.com/sfackler/rust-openssl/pull/2324">sfackler/rust-openssl#2324</a></li>
<li>Enable set_alpn_select_callback for BoringSSL by <a href="https://github.com/ViktoriiaKovalova"><code>@​ViktoriiaKovalova</code></a> in <a href="https://redirect.github.com/sfackler/rust-openssl/pull/2327">sfackler/rust-openssl#2327</a></li>
<li>Switch the test to use prime256v1 based key by <a href="https://github.com/dcermak"><code>@​dcermak</code></a> in <a href="https://redirect.github.com/sfackler/rust-openssl/pull/2330">sfackler/rust-openssl#2330</a></li>
<li>Expose EVP_DigestSqueeze from Hasher by <a href="https://github.com/initsecret"><code>@​initsecret</code></a> in <a href="https://redirect.github.com/sfackler/rust-openssl/pull/2275">sfackler/rust-openssl#2275</a></li>
<li>Expose SSL_CTX_load_verify_locations by <a href="https://github.com/sfackler"><code>@​sfackler</code></a> in <a href="https://redirect.github.com/sfackler/rust-openssl/pull/2353">sfackler/rust-openssl#2353</a></li>
</ul>
<h2>New Contributors</h2>
<ul>
<li><a href="https://github.com/caspermeijn"><code>@​caspermeijn</code></a> made their first contribution in <a href="https://redirect.github.com/sfackler/rust-openssl/pull/2324">sfackler/rust-openssl#2324</a></li>
<li><a href="https://github.com/ViktoriiaKovalova"><code>@​ViktoriiaKovalova</code></a> made their first contribution in <a href="https://redirect.github.com/sfackler/rust-openssl/pull/2327">sfackler/rust-openssl#2327</a></li>
</ul>
<p><strong>Full Changelog</strong>: <a href="https://github.com/sfackler/rust-openssl/compare/openssl-v0.10.68...openssl-v0.10.69">https://github.com/sfackler/rust-openssl/compare/openssl-v0.10.68...openssl-v0.10.69</a></p>
<h2>openssl-v0.10.68</h2>
<h2>What's Changed</h2>
<ul>
<li>fixes <a href="https://redirect.github.com/sfackler/rust-openssl/issues/2317">#2317</a> -- restore compatibility with our MSRV and release openssl 0.9.68 by <a href="https://github.com/alex"><code>@​alex</code></a> in <a href="https://redirect.github.com/sfackler/rust-openssl/pull/2318">sfackler/rust-openssl#2318</a></li>
</ul>
<p><strong>Full Changelog</strong>: <a href="https://github.com/sfackler/rust-openssl/compare/openssl-v0.10.67...openssl-v0.10.68">https://github.com/sfackler/rust-openssl/compare/openssl-v0.10.67...openssl-v0.10.68</a></p>
<h2>openssl-v0.10.67</h2>
<h2>What's Changed</h2>
<ul>
<li>Added a utility function to ensure we never have an issue with 0-length slices from pointers again by <a href="https://github.com/alex"><code>@​alex</code></a> in <a href="https://redirect.github.com/sfackler/rust-openssl/pull/2268">sfackler/rust-openssl#2268</a></li>
<li>Fix CI for the latest rustc by <a href="https://github.com/alex"><code>@​alex</code></a> in <a href="https://redirect.github.com/sfackler/rust-openssl/pull/2271">sfackler/rust-openssl#2271</a></li>
<li>Add binding for EVP_DigestSqueeze by <a href="https://github.com/initsecret"><code>@​initsecret</code></a> in <a href="https://redirect.github.com/sfackler/rust-openssl/pull/2270">sfackler/rust-openssl#2270</a></li>
<li>libressl 4.0: const correctness for X509_LOOKUP_METHOD by <a href="https://github.com/botovq"><code>@​botovq</code></a> in <a href="https://redirect.github.com/sfackler/rust-openssl/pull/2276">sfackler/rust-openssl#2276</a></li>
<li>Bump hex dev-dependency version by <a href="https://github.com/alex"><code>@​alex</code></a> in <a href="https://redirect.github.com/sfackler/rust-openssl/pull/2277">sfackler/rust-openssl#2277</a></li>
<li>Raise bindgen version by <a href="https://github.com/alex"><code>@​alex</code></a> in <a href="https://redirect.github.com/sfackler/rust-openssl/pull/2278">sfackler/rust-openssl#2278</a></li>
<li>Ensure Rsa::check_key doesn't leave errors on the stack by <a href="https://github.com/alex"><code>@​alex</code></a> in <a href="https://redirect.github.com/sfackler/rust-openssl/pull/2279">sfackler/rust-openssl#2279</a></li>
<li>Update some docs to use the corresponds macro by <a href="https://github.com/rushilmehra"><code>@​rushilmehra</code></a> in <a href="https://redirect.github.com/sfackler/rust-openssl/pull/2282">sfackler/rust-openssl#2282</a></li>
<li>Don't leave errors on the stack in <code>MdCtxRef::digest_verify_final</code> by <a href="https://github.com/alex"><code>@​alex</code></a> in <a href="https://redirect.github.com/sfackler/rust-openssl/pull/2283">sfackler/rust-openssl#2283</a></li>
<li>Adjustments for LibreSSL 4 by <a href="https://github.com/botovq"><code>@​botovq</code></a> in <a href="https://redirect.github.com/sfackler/rust-openssl/pull/2287">sfackler/rust-openssl#2287</a></li>
<li>Explicit rustfmt config by <a href="https://github.com/kornelski"><code>@​kornelski</code></a> in <a href="https://redirect.github.com/sfackler/rust-openssl/pull/2285">sfackler/rust-openssl#2285</a></li>
<li>add basic EVP_KDF bindings by <a href="https://github.com/reaperhulk"><code>@​reaperhulk</code></a> in <a href="https://redirect.github.com/sfackler/rust-openssl/pull/2289">sfackler/rust-openssl#2289</a></li>
<li>add ossl3 thread pool bindings by <a href="https://github.com/reaperhulk"><code>@​reaperhulk</code></a> in <a href="https://redirect.github.com/sfackler/rust-openssl/pull/2293">sfackler/rust-openssl#2293</a></li>
<li>add argon2id support for ossl 3.2+ by <a href="https://github.com/reaperhulk"><code>@​reaperhulk</code></a> in <a href="https://redirect.github.com/sfackler/rust-openssl/pull/2290">sfackler/rust-openssl#2290</a></li>
<li>fix 3.2.0 thread support and simplify by <a href="https://github.com/reaperhulk"><code>@​reaperhulk</code></a> in <a href="https://redirect.github.com/sfackler/rust-openssl/pull/2294">sfackler/rust-openssl#2294</a></li>
<li>add libctx arg to argon2id by <a href="https://github.com/reaperhulk"><code>@​reaperhulk</code></a> in <a href="https://redirect.github.com/sfackler/rust-openssl/pull/2295">sfackler/rust-openssl#2295</a></li>
</ul>
<!-- raw HTML omitted -->
</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a href="https://github.com/sfackler/rust-openssl/commit/a4d399b0f1a3694cb2d1728edf74d318a3cac890"><code>a4d399b</code></a> Release openssl v0.10.70</li>
<li><a href="https://github.com/sfackler/rust-openssl/commit/c9a33e286023f92b869c5f157b349be15985a799"><code>c9a33e2</code></a> Release openssl-sys v0.9.105</li>
<li><a href="https://github.com/sfackler/rust-openssl/commit/f014afb230de4d77bc79dea60e7e58c2f47b60f2"><code>f014afb</code></a> Merge pull request <a href="https://redirect.github.com/sfackler/rust-openssl/issues/2360">#2360</a> from sfackler/fix-alpn-lifetimes</li>
<li><a href="https://github.com/sfackler/rust-openssl/commit/8e6e30bbf7e7627845b801f83a3810d6ffc1f157"><code>8e6e30b</code></a> Fix lifetimes in ssl::select_next_proto</li>
<li><a href="https://github.com/sfackler/rust-openssl/commit/1aff2801ca1dd756a0566a4d4fa9a00967280114"><code>1aff280</code></a> Merge pull request <a href="https://redirect.github.com/sfackler/rust-openssl/issues/2358">#2358</a> from alex/expose-dlts</li>
<li><a href="https://github.com/sfackler/rust-openssl/commit/16ca5b278b99bb667321b4d88da230ee8f820e08"><code>16ca5b2</code></a> Merge pull request <a href="https://redirect.github.com/sfackler/rust-openssl/issues/2359">#2359</a> from sfackler/alex-patch-1</li>
<li><a href="https://github.com/sfackler/rust-openssl/commit/4c9fbb0c18e8a3ac1de9671d7828862b49c1cb87"><code>4c9fbb0</code></a> Test against 3.4.0 final release</li>
<li><a href="https://github.com/sfackler/rust-openssl/commit/5ecb31d3fd252c54dbae5e0b5b7ad495b26ac339"><code>5ecb31d</code></a> Update openssl/src/ssl/mod.rs</li>
<li><a href="https://github.com/sfackler/rust-openssl/commit/4830f5bb93dafeeeddf32bf41dda83e2560f3d49"><code>4830f5b</code></a> Expose <code>SslMethod::{dtls_client,dtls_server}</code></li>
<li><a href="https://github.com/sfackler/rust-openssl/commit/bab03c4093ef626c9564354ae7c2484f4f9ad6a9"><code>bab03c4</code></a> Merge pull request <a href="https://redirect.github.com/sfackler/rust-openssl/issues/2356">#2356</a> from botovq/rm-ec-method</li>
<li>Additional commits viewable in <a href="https://github.com/sfackler/rust-openssl/compare/openssl-v0.10.66...openssl-v0.10.70">compare view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=openssl&package-manager=cargo&previous-version=0.10.66&new-version=0.10.70)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
You can disable automated security fix PRs for this repo from the [Security Alerts page](https://github.com/RustPython/RustPython/network/alerts).

</details>


Discussion / hints:
Advisory: [https://github.com/sfackler/rust-openssl/security/advisories/GHSA-rpmj-rpgj-qmpm](https://github.com/sfackler/rust-openssl/security/advisories/GHSA-rpmj-rpgj-qmpm)

Fix patch:
diff --git a/Cargo.lock b/Cargo.lock
index 70395fb1d5..4285718fa7 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -1396,9 +1396,9 @@ checksum = "b410bbe7e14ab526a0e86877eb47c6996a2bd7746f027ba551028c925390e4e9"
 
 [[package]]
 name = "openssl"
-version = "0.10.66"
+version = "0.10.70"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9529f4786b70a3e8c61e11179af17ab6188ad8d0ded78c5529441ed39d4bd9c1"
+checksum = "61cfb4e166a8bb8c9b55c500bc2308550148ece889be90f609377e58140f42c6"
 dependencies = [
  "bitflags 2.6.0",
  "cfg-if",
@@ -1437,9 +1437,9 @@ dependencies = [
 
 [[package]]
 name = "openssl-sys"
-version = "0.9.103"
+version = "0.9.105"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7f9e8deee91df40a943c71b917e5874b951d32a802526c85721ce3b776c929d6"
+checksum = "8b22d5b84be05a8d6947c7cb71f7c849aa0f112acd4bf51c2a7c1c988ac0a9dc"
 dependencies = [
  "cc",
  "libc",
diff --git a/stdlib/src/ssl.rs b/stdlib/src/ssl.rs
index 03222ff4f5..3622b74d1a 100644
--- a/stdlib/src/ssl.rs
+++ b/stdlib/src/ssl.rs
@@ -612,7 +612,11 @@ mod _ssl {
                     Ok(pbuf.to_vec())
                 })?;
                 ctx.set_alpn_select_callback(move |_, client| {
-                    ssl::select_next_proto(&server, client).ok_or(ssl::AlpnError::NOACK)
+                    let proto =
+                        ssl::select_next_proto(&server, client).ok_or(ssl::AlpnError::NOACK)?;
+                    let pos = memchr::memmem::find(client, proto)
+                        .expect("selected alpn proto should be present in client protos");
+                    Ok(&client[pos..proto.len()])
                 });
                 Ok(())
             }


Test patch: