Skip to content

Commit

Permalink
Switch "crypto" implementation to Python
Browse files Browse the repository at this point in the history
This simplifies the build process and avoids needing to ship a vendor'd
OpenSSL.
  • Loading branch information
jlaine committed Jan 23, 2024
1 parent fac6cfc commit eb3a5f2
Show file tree
Hide file tree
Showing 7 changed files with 124 additions and 524 deletions.
15 changes: 1 addition & 14 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,16 +65,6 @@ jobs:
if: matrix.os == 'macos-latest'
run: |
sudo /usr/libexec/ApplicationFirewall/socketfilterfw --setglobalstate off
echo "AIOQUIC_SKIP_TESTS=chacha20" >> $GITHUB_ENV
echo "CFLAGS=-I/usr/local/opt/openssl/include" >> $GITHUB_ENV
echo "LDFLAGS=-L/usr/local/opt/openssl/lib" >> $GITHUB_ENV
- name: Install OpenSSL
if: matrix.os == 'windows-latest'
run: |
choco install openssl --no-progress
echo "INCLUDE=C:\Progra~1\OpenSSL\include" >> $GITHUB_ENV
echo "LIB=C:\Progra~1\OpenSSL\lib" >> $GITHUB_ENV
shell: bash
- name: Run tests
run: |
python -m pip install -U pip setuptools wheel
Expand Down Expand Up @@ -134,10 +124,7 @@ jobs:
- name: Build wheels
env:
CIBW_ARCHS: ${{ matrix.arch }}
CIBW_BEFORE_BUILD: python scripts/fetch-vendor.py /tmp/vendor
CIBW_BEFORE_BUILD_WINDOWS: python scripts\fetch-vendor.py C:\cibw\vendor
CIBW_ENVIRONMENT: AIOQUIC_SKIP_TESTS=ipv6,loss CFLAGS=-I/tmp/vendor/include LDFLAGS=-L/tmp/vendor/lib
CIBW_ENVIRONMENT_WINDOWS: AIOQUIC_SKIP_TESTS=ipv6,loss INCLUDE=C:\\cibw\\vendor\\include LIB=C:\\cibw\\vendor\\lib
CIBW_ENVIRONMENT: AIOQUIC_SKIP_TESTS=ipv6,loss
CIBW_SKIP: cp37-* pp37-* *-musllinux*
CIBW_TEST_COMMAND: python -m unittest discover -t {project} -s {project}/tests
# there are no wheels for cryptography on these platforms
Expand Down
3 changes: 0 additions & 3 deletions scripts/fetch-vendor.json

This file was deleted.

64 changes: 0 additions & 64 deletions scripts/fetch-vendor.py

This file was deleted.

10 changes: 0 additions & 10 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,8 @@

if sys.platform == "win32":
extra_compile_args = []
libraries = ["libcrypto", "advapi32", "crypt32", "gdi32", "user32", "ws2_32"]
else:
extra_compile_args = ["-std=c99"]
libraries = ["crypto"]


class bdist_wheel_abi3(bdist_wheel):
Expand All @@ -30,14 +28,6 @@ def get_tag(self):
define_macros=[("Py_LIMITED_API", "0x03080000")],
py_limited_api=True,
),
setuptools.Extension(
"aioquic._crypto",
extra_compile_args=extra_compile_args,
libraries=libraries,
sources=["src/aioquic/_crypto.c"],
define_macros=[("Py_LIMITED_API", "0x03080000")],
py_limited_api=True,
),
],
cmdclass={"bdist_wheel": bdist_wheel_abi3},
)
Loading

0 comments on commit eb3a5f2

Please sign in to comment.