Skip to content

harden generateOptions.sh script - #53

Merged
lealem47 merged 1 commit into
wolfSSL:masterfrom
sebastian-carpenter:build-changes
Aug 5, 2026
Merged

harden generateOptions.sh script#53
lealem47 merged 1 commit into
wolfSSL:masterfrom
sebastian-carpenter:build-changes

Conversation

@sebastian-carpenter

Copy link
Copy Markdown
Contributor

Update the default cgo -I.-L flags to /usr/local

Update generateOptions.sh script:

  • Cleanup properly on exit
  • Always update cgo -I,-L flags even if no prefix is given
  • Resolve relative paths to absolute paths (and absolute paths to Windows ones if necessary)
  • Error on paths which may cause problems in sed

Added more testing for generateOptions.sh

Updated README.md

@sebastian-carpenter sebastian-carpenter self-assigned this Aug 4, 2026
Copilot AI lite review requested due to automatic review settings August 4, 2026 20:54

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 #cgo include/library paths to /usr/local and 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.sh and 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.

Comment thread generateOptions.sh
@lealem47
lealem47 merged commit a64770b into wolfSSL:master Aug 5, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants