Skip to content

Commit f0face7

Browse files
committed
Switch "crypto" implementation to Python
This simplifies the build process and avoids needing to ship a vendor'd OpenSSL.
1 parent 352bcf8 commit f0face7

File tree

7 files changed

+130
-534
lines changed

7 files changed

+130
-534
lines changed

.github/workflows/tests.yml

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -62,21 +62,10 @@ jobs:
6262
- uses: actions/setup-python@v5
6363
with:
6464
python-version: ${{ matrix.python }}
65-
- name: Install OpenSSL and disable firewall
65+
- name: Disable firewall
6666
if: matrix.os == 'macos-latest'
6767
run: |
68-
brew install openssl
69-
echo "AIOQUIC_SKIP_TESTS=chacha20" >> $GITHUB_ENV
70-
echo "CFLAGS=-I$(brew --prefix openssl)/include" >> $GITHUB_ENV
71-
echo "LDFLAGS=-L$(brew --prefix openssl)/lib" >> $GITHUB_ENV
7268
sudo /usr/libexec/ApplicationFirewall/socketfilterfw --setglobalstate off
73-
- name: Install OpenSSL
74-
if: matrix.os == 'windows-latest'
75-
run: |
76-
# OpenSSL is pre-installed on windows-2025 runners.
77-
echo "INCLUDE=C:\Progra~1\OpenSSL\include" >> $GITHUB_ENV
78-
echo "LIB=C:\Progra~1\OpenSSL\\lib\\VC\\x64\\MD" >> $GITHUB_ENV
79-
shell: bash
8069
- name: Run tests
8170
run: |
8271
python -m pip install -U pip setuptools wheel
@@ -135,12 +124,8 @@ jobs:
135124
- name: Build wheels
136125
env:
137126
CIBW_ARCHS: ${{ matrix.arch }}
138-
CIBW_BEFORE_BUILD: python scripts/fetch-vendor.py /tmp/vendor
139-
CIBW_BEFORE_BUILD_WINDOWS: python scripts\fetch-vendor.py C:\cibw\vendor
140-
CIBW_ENVIRONMENT: AIOQUIC_SKIP_TESTS=ipv6,loss CFLAGS=-I/tmp/vendor/include LDFLAGS=-L/tmp/vendor/lib
141-
CIBW_ENVIRONMENT_WINDOWS: AIOQUIC_SKIP_TESTS=ipv6,loss INCLUDE=C:\\cibw\\vendor\\include LIB=C:\\cibw\\vendor\\lib
142-
# The limited API is not available on free-threaded builds.
143-
CIBW_SKIP: 'cp3??t-* pp*'
127+
CIBW_ENVIRONMENT: AIOQUIC_SKIP_TESTS=ipv6,loss
128+
CIBW_SKIP: 'pp*'
144129
CIBW_TEST_COMMAND: python -m unittest discover -t {project} -s {project}/tests
145130
# There are no binary wheels for cryptography on 32-bit platforms.
146131
CIBW_TEST_SKIP: "*-{manylinux_i686,musllinux_i686,win32}"

scripts/fetch-vendor.json

Lines changed: 0 additions & 3 deletions
This file was deleted.

scripts/fetch-vendor.py

Lines changed: 0 additions & 67 deletions
This file was deleted.

setup.py

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,8 @@
55

66
if sys.platform == "win32":
77
extra_compile_args = []
8-
libraries = ["libcrypto", "advapi32", "crypt32", "gdi32", "user32", "ws2_32"]
98
else:
109
extra_compile_args = ["-std=c99"]
11-
libraries = ["crypto"]
1210

1311

1412
class bdist_wheel_abi3(bdist_wheel):
@@ -30,14 +28,6 @@ def get_tag(self):
3028
define_macros=[("Py_LIMITED_API", "0x03080000")],
3129
py_limited_api=True,
3230
),
33-
setuptools.Extension(
34-
"aioquic._crypto",
35-
extra_compile_args=extra_compile_args,
36-
libraries=libraries,
37-
sources=["src/aioquic/_crypto.c"],
38-
define_macros=[("Py_LIMITED_API", "0x03080000")],
39-
py_limited_api=True,
40-
),
4131
],
4232
cmdclass={"bdist_wheel": bdist_wheel_abi3},
4333
)

0 commit comments

Comments
 (0)