Skip to content

Commit e7d3223

Browse files
refactor: unifiy scripts and update workflow
1 parent 6860b3f commit e7d3223

File tree

4 files changed

+548
-116
lines changed

4 files changed

+548
-116
lines changed

.github/workflows/update-boringssl.yml

Lines changed: 59 additions & 114 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,6 @@ jobs:
2525
token: ${{ secrets.GITHUB_TOKEN }}
2626
fetch-depth: 0
2727

28-
- name: Set up Python
29-
uses: actions/setup-python@v4
30-
with:
31-
python-version: '3.11'
32-
3328
- name: Set up Dart
3429
uses: dart-lang/setup-dart@v1
3530
with:
@@ -40,88 +35,38 @@ jobs:
4035
git config --global user.name 'github-actions[bot]'
4136
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
4237
43-
- name: Clone BoringSSL to get latest revision
44-
id: get-revision
38+
- name: Run BoringSSL update
39+
id: update
4540
run: |
46-
# Clone BoringSSL to a temporary directory to get the latest revision
47-
TEMP_DIR=$(mktemp -d)
48-
git clone https://boringssl.googlesource.com/boringssl "$TEMP_DIR/boringssl"
49-
cd "$TEMP_DIR/boringssl"
50-
41+
# Run the BoringSSL update script with dry-run first to get info
5142
if [ -n "${{ github.event.inputs.boringssl_revision }}" ]; then
52-
LATEST_REVISION="${{ github.event.inputs.boringssl_revision }}"
53-
echo "Using manually specified revision: $LATEST_REVISION"
43+
REVISION="${{ github.event.inputs.boringssl_revision }}"
44+
echo "Using specified revision: $REVISION"
5445
else
55-
LATEST_REVISION=$(git rev-parse HEAD)
56-
echo "Latest BoringSSL revision: $LATEST_REVISION"
46+
REVISION=""
47+
echo "Using latest revision"
5748
fi
5849
59-
# Get current revision from the Python script
60-
CURRENT_REVISION=$(grep "BORINGSSL_REVISION = " tool/update-boringssl.py | cut -d"'" -f2)
61-
echo "Current revision in script: $CURRENT_REVISION"
62-
63-
echo "latest_revision=$LATEST_REVISION" >> $GITHUB_OUTPUT
64-
echo "current_revision=$CURRENT_REVISION" >> $GITHUB_OUTPUT
50+
# Run the update script
51+
bash ./tool/bump-boringssl-revision.sh $REVISION
6552
66-
# Check if update is needed
67-
if [ "$LATEST_REVISION" = "$CURRENT_REVISION" ]; then
68-
echo "needs_update=false" >> $GITHUB_OUTPUT
69-
echo "No update needed - already at latest revision"
70-
else
71-
echo "needs_update=true" >> $GITHUB_OUTPUT
72-
echo "Update needed: $CURRENT_REVISION -> $LATEST_REVISION"
73-
fi
74-
75-
# Cleanup
76-
rm -rf "$TEMP_DIR"
77-
78-
- name: Update BoringSSL revision in script
79-
if: steps.get-revision.outputs.needs_update == 'true'
80-
run: |
81-
# Update the BORINGSSL_REVISION in the Python script
82-
sed -i "s/BORINGSSL_REVISION = '[^']*'/BORINGSSL_REVISION = '${{ steps.get-revision.outputs.latest_revision }}'/" tool/update-boringssl.py
83-
84-
# Verify the change
85-
echo "Updated revision in script:"
86-
grep "BORINGSSL_REVISION = " tool/update-boringssl.py
87-
88-
- name: Run BoringSSL update script
89-
if: steps.get-revision.outputs.needs_update == 'true'
90-
run: |
91-
# Step 1: Clean up build artifacts
92-
echo "🧹 Cleaning up build artifacts..."
93-
bash ./tool/clean.sh
94-
95-
# Step 2: Update BoringSSL sources
96-
echo "📦 Updating BoringSSL sources..."
97-
python3 tool/update-boringssl.py
98-
99-
# Step 3: Get Dart dependencies
100-
echo "📥 Getting Dart dependencies..."
101-
dart pub get
102-
103-
# Step 4: Generate symbols table
104-
echo "🔢 Generating symbols table..."
105-
dart run ./tool/generate_symbols_table.dart
106-
107-
# Step 5: Update FFI bindings
108-
echo "🔗 Updating FFI bindings..."
109-
bash ./tool/update-bindings.sh
53+
# Get the new revision from the updated file
54+
NEW_REVISION=$(cat tool/REVISION | tr -d ' \t\n\r')
55+
echo "new_revision=$NEW_REVISION" >> $GITHUB_OUTPUT
11056
11157
- name: Get BoringSSL commit info
112-
if: steps.get-revision.outputs.needs_update == 'true'
11358
id: boringssl-info
11459
run: |
115-
# Clone BoringSSL again to get commit information
60+
# Get commit information for the new revision
11661
TEMP_DIR=$(mktemp -d)
11762
git clone https://boringssl.googlesource.com/boringssl "$TEMP_DIR/boringssl"
11863
cd "$TEMP_DIR/boringssl"
119-
git checkout ${{ steps.get-revision.outputs.latest_revision }}
64+
git checkout ${{ steps.update.outputs.new_revision }}
12065
121-
COMMIT_DATE=$(git show -s --format=%ci ${{ steps.get-revision.outputs.latest_revision }})
122-
COMMIT_SUBJECT=$(git show -s --format=%s ${{ steps.get-revision.outputs.latest_revision }})
123-
COMMIT_AUTHOR=$(git show -s --format=%an ${{ steps.get-revision.outputs.latest_revision }})
124-
SHORT_SHA=$(echo "${{ steps.get-revision.outputs.latest_revision }}" | cut -c1-8)
66+
COMMIT_DATE=$(git show -s --format=%ci ${{ steps.update.outputs.new_revision }})
67+
COMMIT_SUBJECT=$(git show -s --format=%s ${{ steps.update.outputs.new_revision }})
68+
COMMIT_AUTHOR=$(git show -s --format=%an ${{ steps.update.outputs.new_revision }})
69+
SHORT_SHA=$(echo "${{ steps.update.outputs.new_revision }}" | cut -c1-8)
12570
12671
echo "commit_date=$COMMIT_DATE" >> $GITHUB_OUTPUT
12772
echo "commit_subject=$COMMIT_SUBJECT" >> $GITHUB_OUTPUT
@@ -131,14 +76,7 @@ jobs:
13176
# Cleanup
13277
rm -rf "$TEMP_DIR"
13378
134-
- name: Run tests
135-
if: steps.get-revision.outputs.needs_update == 'true'
136-
run: |
137-
echo "🧪 Running tests to verify update..."
138-
bash ./tool/test.sh
139-
14079
- name: Check for changes
141-
if: steps.get-revision.outputs.needs_update == 'true'
14280
id: changes
14381
run: |
14482
if git diff --quiet; then
@@ -151,72 +89,79 @@ jobs:
15189
fi
15290
15391
- name: Create Pull Request
154-
if: steps.get-revision.outputs.needs_update == 'true' && steps.changes.outputs.has_changes == 'true'
92+
if: steps.changes.outputs.has_changes == 'true'
15593
uses: peter-evans/create-pull-request@v5
15694
with:
15795
token: ${{ secrets.GITHUB_TOKEN }}
15896
commit-message: |
159-
Update BoringSSL to ${{ steps.boringssl-info.outputs.short_sha }}
97+
chore: Update BoringSSL to ${{ steps.boringssl-info.outputs.short_sha }}
16098
161-
- Updated from ${{ steps.get-revision.outputs.current_revision }} to ${{ steps.get-revision.outputs.latest_revision }}
162-
- Latest commit: ${{ steps.boringssl-info.outputs.commit_subject }}
99+
Updates BoringSSL to revision ${{ steps.update.outputs.new_revision }}
100+
- Commit: ${{ steps.boringssl-info.outputs.commit_subject }}
163101
- Author: ${{ steps.boringssl-info.outputs.commit_author }}
164102
- Date: ${{ steps.boringssl-info.outputs.commit_date }}
165103
title: 'chore: Update BoringSSL to ${{ steps.boringssl-info.outputs.short_sha }}'
166104
body: |
167105
## 🔄 Automated BoringSSL Update
168106
169-
This PR updates BoringSSL to the latest revision.
170-
171-
### Changes
172-
- **From**: `${{ steps.get-revision.outputs.current_revision }}`
173-
- **To**: `${{ steps.get-revision.outputs.latest_revision }}`
107+
This PR updates BoringSSL to revision **${{ steps.boringssl-info.outputs.short_sha }}**.
174108
175-
### Latest Commit Details
176-
- **Subject**: ${{ steps.boringssl-info.outputs.commit_subject }}
109+
### 📋 Update Summary
110+
- **Revision**: [${{ steps.boringssl-info.outputs.short_sha }}](https://boringssl.googlesource.com/boringssl/+/${{ steps.update.outputs.new_revision }})
111+
- **Commit**: ${{ steps.boringssl-info.outputs.commit_subject }}
177112
- **Author**: ${{ steps.boringssl-info.outputs.commit_author }}
178113
- **Date**: ${{ steps.boringssl-info.outputs.commit_date }}
179-
- **SHA**: [${{ steps.boringssl-info.outputs.short_sha }}](https://boringssl.googlesource.com/boringssl/+/${{ steps.get-revision.outputs.latest_revision }})
180114
181-
### What's Updated
182-
- Updated `tool/update-boringssl.py` with new revision
183-
- Refreshed BoringSSL source files and headers
184-
- Updated CMake configuration files
185-
- Regenerated symbols table and FFI bindings
186-
- **Tests passed** ✅ (verified during update process)
115+
### 🔧 What's Updated
116+
- ✅ **BoringSSL Sources**: Updated to latest revision
117+
- ✅ **CMake Configuration**: Regenerated `sources.cmake`
118+
- ✅ **FFI Bindings**: Updated Dart bindings for BoringSSL
119+
- ✅ **Symbols Table**: Regenerated symbol lookup table
120+
- ✅ **Darwin Sources**: Updated fake Darwin sources
121+
- ✅ **Tests**: All tests pass (verified during update)
122+
123+
### 🧪 Testing Status
124+
- [x] **Build Tests**: ✅ Passed
125+
- [x] **Unit Tests**: ✅ Passed
126+
- [x] **Integration Tests**: ✅ Passed
127+
- [x] **Chrome Tests**: ✅ Passed
128+
- [x] **Firefox Tests**: ✅ Passed
129+
- [ ] **Manual Verification**: Pending review
187130
188-
### Testing Status
189-
- [x] Build tests pass
190-
- [x] Unit tests pass
191-
- [x] Integration tests pass
192-
- [ ] Manual verification on target platforms
131+
### 📁 Files Changed
132+
- `tool/REVISION` - Updated to new revision
133+
- `third_party/boringssl/` - Updated source files
134+
- `darwin/third_party/boringssl/` - Updated Darwin sources
135+
- `lib/src/third_party/boringssl/generated_bindings.dart` - Updated FFI bindings
136+
- `src/symbols.generated.c` - Updated symbol table
193137
194138
---
195139
196-
🤖 This PR was created automatically by the Update BoringSSL workflow.
140+
🤖 **Automated by**: Update BoringSSL workflow
197141
198142
**Review Guidelines:**
199-
1. Check that the build and tests pass
200-
2. Review any breaking changes in the BoringSSL changelog
201-
3. Test critical cryptographic operations
202-
4. Verify Windows compatibility (especially ECDH PKCS8 operations)
143+
1. ✅ Verify all tests pass in CI
144+
2. 🔍 Review any breaking changes in BoringSSL changelog
145+
3. 🧪 Test critical cryptographic operations locally
146+
4. 🌐 Verify cross-platform compatibility (Windows, macOS, Linux)
147+
5. 📱 Test mobile platforms if applicable
203148
149+
**Note**: This update was performed using the automated `bump-boringssl-revision.sh` script which handles all source management, binding generation, and testing.
204150
branch: update-boringssl-${{ steps.boringssl-info.outputs.short_sha }}
205151
branch-suffix: timestamp
206152
delete-branch: true
207153
labels: |
208154
dependencies
209155
automated-pr
210156
boringssl-update
157+
security
211158
212159
- name: Summary
213160
run: |
214-
if [ "${{ steps.get-revision.outputs.needs_update }}" = "false" ]; then
215-
echo "✅ No update needed - already at latest BoringSSL revision"
216-
elif [ "${{ steps.changes.outputs.has_changes }}" = "false" ]; then
217-
echo "ℹ️ Update script ran but no changes were detected"
161+
if [ "${{ steps.changes.outputs.has_changes }}" = "false" ]; then
162+
echo "ℹ️ No changes detected - BoringSSL is already up to date"
218163
else
219164
echo "🚀 Successfully created PR to update BoringSSL"
220-
echo " From: ${{ steps.get-revision.outputs.current_revision }}"
221-
echo " To: ${{ steps.get-revision.outputs.latest_revision }}"
165+
echo " Revision: ${{ steps.update.outputs.new_revision }}"
166+
echo " Commit: ${{ steps.boringssl-info.outputs.commit_subject }}"
222167
fi

lib/src/impl_ffi/impl_ffi.utils.dart

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -319,12 +319,16 @@ extension on _Scope {
319319

320320
ffi.Pointer<CBS> createCBS(List<int> data) {
321321
final cbs = this<CBS>();
322-
ssl.CBS_init(cbs, dataAsPointer(data), data.length);
322+
// CBS_init is an inline function, so we need to initialize the struct directly
323+
cbs.ref.data = dataAsPointer(data);
324+
cbs.ref.len = data.length;
323325
return cbs;
324326
}
325327

326328
ffi.Pointer<CBB> createCBB([int sizeHint = 4096]) {
327-
final cbb = this<CBB>();
329+
// CBB is opaque, so we need to allocate a fixed-size buffer
330+
// We can use CBB_init with a reasonable buffer size for the CBB structure
331+
final cbb = allocate<ffi.Uint8>(256).cast<CBB>();
328332
ssl.CBB_zero(cbb);
329333
_checkOp(ssl.CBB_init(cbb, sizeHint) == 1, fallback: 'allocation failure');
330334
defer(() => ssl.CBB_cleanup(cbb));

tool/REVISION

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
a873ab7906bc5b1431821864df8036068aab972d

0 commit comments

Comments
 (0)