harden generateOptions.sh script - #53
Merged
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR hardens generateOptions.sh so it more reliably regenerates options.go and repoints all #cgo directives to a consistent wolfSSL install location, while also updating defaults/docs and adding CI coverage to prevent drift.
Changes:
- Switch default
#cgoinclude/library paths to/usr/localand simplify CFLAGS to-I<prefix>/include. - Harden
generateOptions.sh(cleanup-on-exit, absolute-path resolution, Windows path conversion, prefix character validation) and always repoint cgo flags. - Add a GitHub Actions smoke test for
generateOptions.shand update README usage guidance accordingly.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
wolfx509/certgen_wolfcrypt.go |
Updates default cgo CFLAGS include path to /usr/local/include. |
wolftls/conn.go |
Updates default cgo CFLAGS include path to /usr/local/include. |
README.md |
Documents new default behavior, prefix restrictions, and failure semantics. |
generateOptions.sh |
Adds hardening/cleanup logic and rewrites cgo directives across the tree. |
examples/server/server-psk.go |
Aligns example’s cgo CFLAGS with /usr/local/include and new formatting. |
examples/client/client-psk.go |
Aligns example’s cgo CFLAGS with /usr/local/include and new formatting. |
aes.go |
Updates default CFLAGS and expands LDFLAGS to include -lm. |
.github/workflows/build.yml |
Adds CI smoke test to validate repointing + cleanup behavior. |
Suppressed comments (1)
generateOptions.sh:98
- To actually restore a pre-existing options.go on failure, the script needs to back it up before overwriting. Right now it deletes options.go and starts appending, so even with cleanup you can't recover the prior file contents.
rm -f options.go
echo "package wolfSSL" >> options.go
echo "" >> options.go
echo "// #cgo CFLAGS: -g -Wall -I$PREFIX/include" >> options.go
echo "// #cgo LDFLAGS: -L$PREFIX/lib -lwolfssl -lm" >> options.go
sed 's/^/\/\/ /' "$OPTIONS_H" >> options.go
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
lealem47
approved these changes
Aug 5, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Update the default cgo -I.-L flags to /usr/local
Update generateOptions.sh script:
Added more testing for generateOptions.sh
Updated README.md