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 Jul 14, 2024
1 parent 9bc1e43 commit 7fffb5a
Show file tree
Hide file tree
Showing 7 changed files with 129 additions and 526 deletions.
18 changes: 2 additions & 16 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,21 +62,10 @@ jobs:
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
- name: Install OpenSSL and disable firewall
- name: Disable firewall
if: matrix.os == 'macos-latest'
run: |
brew install openssl
echo "AIOQUIC_SKIP_TESTS=chacha20" >> $GITHUB_ENV
echo "CFLAGS=-I$(brew --prefix openssl)/include" >> $GITHUB_ENV
echo "LDFLAGS=-L$(brew --prefix openssl)/lib" >> $GITHUB_ENV
sudo /usr/libexec/ApplicationFirewall/socketfilterfw --setglobalstate off
- 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 @@ -138,10 +127,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 7fffb5a

Please sign in to comment.