Repository navigation
232 lines (217 loc) · 8.55 KB
/
Copy pathpython-app.yml
File metadata and controls
232 lines (217 loc) · 8.55 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
name: Python application
on:
push:
branches: [ '*' ]
pull_request:
branches: [ '*' ]
permissions:
contents: read
jobs:
build:
strategy:
fail-fast: false
matrix:
os: [ ubuntu-latest, ubuntu-24.04-arm ]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v7
- name: Set up Python 3.10
uses: actions/setup-python@v6
with:
python-version: "3.10"
- name: Install uv
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
with:
# Install a specific version of uv.
version: "0.11.26"
- name: Build the wheel
run: uv build --wheel
- name: Install the project
run: uv sync --dev
- name: Perform static checks
run: uv run ruff check
- name: Run tests using the locally built wheel
run: |
uv pip install --reinstall dist/*.whl
uv run --no-sync pytest tests
build-no-pqc:
# Regression coverage for issue #2659: a wolfSSL build without ML-KEM
# and ML-DSA must still import wolfcrypt.random successfully.
runs-on: ubuntu-latest
env:
USE_LOCAL_WOLFSSL: ${{ github.workspace }}/wolfssl-install
steps:
- uses: actions/checkout@v7
with:
submodules: recursive
- name: Set up Python 3.10
uses: actions/setup-python@v6
with:
python-version: "3.10"
- name: Install uv
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
with:
# Install a specific version of uv.
version: "0.11.26"
- name: Install build deps
run: |
sudo apt-get update
sudo apt-get install -y autoconf automake libtool
- name: Build wolfSSL without ML-KEM/ML-DSA
run: |
cd lib/wolfssl
./autogen.sh
./configure --enable-cryptonly --disable-shared \
--disable-mlkem --disable-mldsa \
--enable-aes --enable-aesgcm --enable-aessiv \
--enable-aesctr --enable-aesgcm-stream \
--enable-des3 --enable-chacha --enable-poly1305 \
--enable-sha --enable-sha384 --enable-sha512 --enable-sha3 \
--enable-hkdf --enable-rsa --enable-rsapss --enable-ecc \
--enable-ed25519 --enable-ed448 --enable-curve25519 \
--enable-keygen --enable-pwdbased --enable-pkcs7 \
--disable-md5 --disable-sha224 --disable-dh \
--disable-oldtls --disable-oldnames --disable-extended-master \
CFLAGS=-fPIC \
--prefix=$GITHUB_WORKSPACE/wolfssl-install
make
make install
- name: Install wolfcrypt-py against the local wolfSSL
run: |
uv venv
uv pip install pytest
uv pip install -e .
- name: Check absence of ML-KEM and ML-DSA support
run: |
uv run --no-sync python -c "from wolfcrypt._ffi import lib as _lib; assert _lib.ML_KEM_ENABLED == 0, 'ML-KEM should be disabled'"
uv run --no-sync python -c "from wolfcrypt._ffi import lib as _lib; assert _lib.ML_DSA_ENABLED == 0, 'ML-DSA should be disabled'"
- name: Import smoke (regression for INVALID_DEVID)
run: uv run --no-sync python -c "from wolfcrypt.random import Random; Random()"
- name: Run tests
run: uv run --no-sync pytest tests
build-cryptocb-smallstack:
# Crypto callback hash copies must keep wolfCrypt's native resource
# ownership; SMALL_STACK_CACHE allocates per-object buffers that a byte
# copy would share and free twice.
runs-on: ubuntu-latest
env:
USE_LOCAL_WOLFSSL: ${{ github.workspace }}/wolfssl-install
steps:
- uses: actions/checkout@v7
with:
submodules: recursive
- name: Set up Python 3.10
uses: actions/setup-python@v6
with:
python-version: "3.10"
- name: Install uv
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
with:
# Install a specific version of uv.
version: "0.11.26"
- name: Install build deps
run: |
sudo apt-get update
sudo apt-get install -y autoconf automake libtool
- name: Build wolfSSL with crypto callbacks and SMALL_STACK_CACHE
run: |
cd lib/wolfssl
./autogen.sh
./configure --enable-cryptonly --disable-shared \
--enable-cryptocb --enable-cryptocbutils=copy,free \
--enable-smallstack --enable-smallstackcache \
--enable-aes --enable-aesgcm --enable-aessiv \
--enable-aesctr --enable-aesgcm-stream \
--enable-des3 --enable-chacha --enable-poly1305 \
--enable-sha --enable-sha384 --enable-sha512 --enable-sha3 \
--enable-hkdf --enable-rsa --enable-rsapss --enable-ecc \
--enable-ed25519 --enable-ed448 --enable-curve25519 \
--enable-keygen --enable-pwdbased --enable-pkcs7 \
--disable-md5 --disable-sha224 --disable-dh \
--disable-oldtls --disable-oldnames --disable-extended-master \
CFLAGS=-fPIC \
--prefix=$GITHUB_WORKSPACE/wolfssl-install
make
make install
- name: Install wolfcrypt-py against the local wolfSSL
run: |
uv venv
uv pip install pytest
uv pip install -e .
- name: Check crypto callback support
run: |
uv run --no-sync python -c "from wolfcrypt._ffi import lib as _lib; assert _lib.CRYPTO_CB_COPY_ENABLED and _lib.CRYPTO_CB_FREE_ENABLED, 'copy and free callbacks should be enabled'"
- name: Run tests
env:
MALLOC_CHECK_: "3"
run: uv run --no-sync pytest tests
build-reduced:
# wolfSSL builds without optional features must build, import and pass.
strategy:
fail-fast: false
matrix:
include:
- name: no-asn
flags: --disable-asn --disable-rsa --disable-rsapss --disable-pkcs7
- name: no-rng-cryptocb
# wolfSSL needs the RNG for PKCS#7, AES-GCM streaming and key
# generation.
flags: >-
--disable-rng --disable-pkcs7 --disable-aesgcm-stream
--disable-keygen
--enable-cryptocb --enable-cryptocbutils=copy,free
- name: no-ecc-sign
# wolfSSL PKCS#7 needs ECC signing.
flags: --disable-pkcs7
cflags: -DNO_ECC_SIGN
- name: no-error-strings
flags: --disable-errorstrings
name: build-reduced (${{ matrix.name }})
runs-on: ubuntu-latest
env:
USE_LOCAL_WOLFSSL: ${{ github.workspace }}/wolfssl-install
steps:
- uses: actions/checkout@v7
with:
submodules: recursive
- name: Set up Python 3.10
uses: actions/setup-python@v6
with:
python-version: "3.10"
- name: Install uv
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
with:
# Install a specific version of uv.
version: "0.11.26"
- name: Install build deps
run: |
sudo apt-get update
sudo apt-get install -y autoconf automake libtool
- name: Build wolfSSL
run: |
cd lib/wolfssl
./autogen.sh
./configure --enable-cryptonly --disable-shared --disable-crypttests \
--enable-aes --enable-aesgcm --enable-aessiv \
--enable-aesctr --enable-aesgcm-stream \
--enable-des3 --enable-chacha --enable-poly1305 \
--enable-sha --enable-sha384 --enable-sha512 --enable-sha3 \
--enable-hkdf --enable-rsa --enable-rsapss --enable-ecc \
--enable-ed25519 --enable-ed448 --enable-curve25519 \
--enable-keygen --enable-pwdbased --enable-pkcs7 \
--disable-md5 --disable-sha224 --disable-dh \
--disable-oldtls --disable-oldnames --disable-extended-master \
${{ matrix.flags }} \
CFLAGS="-fPIC ${{ matrix.cflags }}" \
--prefix=$GITHUB_WORKSPACE/wolfssl-install
make
make install
- name: Install wolfcrypt-py against the local wolfSSL
run: |
uv venv
uv pip install pytest
uv pip install -e .
- name: Run tests
run: uv run --no-sync pytest tests