Skip to content

Add dynamic shim for SSL_CTX_set_options and SSL_set_options#67030

Merged
bartonjs merged 5 commits into
dotnet:mainfrom
rzikm:66310-arm32-openssl3
Mar 25, 2022
Merged

Add dynamic shim for SSL_CTX_set_options and SSL_set_options#67030
bartonjs merged 5 commits into
dotnet:mainfrom
rzikm:66310-arm32-openssl3

Conversation

@rzikm

@rzikm rzikm commented Mar 23, 2022

Copy link
Copy Markdown
Member

This works around ABI breaking change made between OpenSSL 1.1 and 3.0 where argument type and return type was changed from unsigned long to uint64_t, which caused issues on arm32 architectures with OpenSSL 3.0 installed.

I tried to solve it in a way that does not require explicit knowledge of "I can't call SSL_set_options directly, I must use that dynamic shim", so if we are compiling with FEATURE_DISTRO_AGNOSTIC_SSL, SSL_CTX_set_options and SSL_set_options macros are redefined in pal_ssl.c to point to the dynamic shims.

Unfortunately, I didn't find a reasonable way to redefine these macros globally (see this GodBolt for my attempt). But I don't expect these functions to be ever called from other files.

Fixes #66310

This works around ABI breaking change made between OpenSSL 1.1 and 3.0 where argument type and return type was changed from unsigned long to uint64_t, which caused issues on arm32 architectures with OpenSSL 3.0 installed.
@ghost ghost assigned rzikm Mar 23, 2022
@ghost

ghost commented Mar 23, 2022

Copy link
Copy Markdown

Tagging subscribers to this area: @dotnet/ncl, @vcsjones
See info in area-owners.md if you want to be subscribed.

Issue Details

This works around ABI breaking change made between OpenSSL 1.1 and 3.0 where argument type and return type was changed from unsigned long to uint64_t, which caused issues on arm32 architectures with OpenSSL 3.0 installed.

Fixes #66310

Author: rzikm
Assignees: -
Labels:

area-System.Net.Security

Milestone: -

@rzikm

rzikm commented Mar 23, 2022

Copy link
Copy Markdown
Member Author

I compiled the changes locally and can confirm that they work on the arm32 machine with OpenSSL 3.0 used in the original repro

@rzikm rzikm changed the title Add dynamic shim for SSL_CTX_set_options Add dynamic shim for SSL_CTX_set_options and SSL_set_options Mar 23, 2022
Comment thread src/native/libs/System.Security.Cryptography.Native/pal_ssl.c Outdated
Comment thread src/native/libs/System.Security.Cryptography.Native/pal_ssl.c Outdated
rzikm and others added 3 commits March 24, 2022 13:04
@bartonjs bartonjs merged commit aea7c73 into dotnet:main Mar 25, 2022
@rzikm

rzikm commented Mar 25, 2022

Copy link
Copy Markdown
Member Author

/backport to release/6.0 release/5.0

@github-actions

Copy link
Copy Markdown
Contributor

Started backporting to release/6.0: https://github.com/dotnet/runtime/actions/runs/2040311583

@karelz karelz added this to the 7.0.0 milestone Apr 8, 2022
@ghost ghost locked as resolved and limited conversation to collaborators May 8, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

OpenSSL error with Ubuntu 22.04 on Arm32 architecture

4 participants