Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

scripts: take openssl-fips module version as argument #40

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,4 @@ branch you would like to check out in the git submodule like so:

```
$ ./scripts/setup-initial-patch.sh dev.boringcrypto.go1.x
```
```
8 changes: 7 additions & 1 deletion scripts/create-secondary-patch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

set -ex

if test $# -ne 0; then
OPENSSL_FIPS_VERSION="${1}"
fi

: ${OPENSSL_FIPS_VERSION=362f460220104417e99fc8d59f0f9a6ba4514bd1}

# Apply some manual substitutions with sed. These changes will likely introduce
# merge conflicts if this was a patch, so we do them here instead and generate a patch
# after.
Expand Down Expand Up @@ -32,8 +38,8 @@ rm src/crypto/internal/boring/*.*
rm src/crypto/boring/boring_test.go

# Add new openssl backend to module and vendor it.
echo "require github.com/golang-fips/openssl-fips v0.0.0-20220505153334-362f46022010" >> src/go.mod
cd src
go get -d "github.com/golang-fips/openssl-fips@${OPENSSL_FIPS_VERSION}"
go mod tidy
go mod vendor

Expand Down
7 changes: 5 additions & 2 deletions scripts/setup-initial-patch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
set -ex

ROOT=$(pwd)
BRANCH="${1}"
shift
ARGS="$@"

# Function to clean things up if any portion of the script fails.
function cleanup() {
Expand All @@ -14,14 +17,14 @@ function cleanup() {
}
trap cleanup EXIT

./scripts/setup-go-submodule.sh "${1}"
"${ROOT}"/scripts/setup-go-submodule.sh ${BRANCH}

# Enter the submodule directory.
cd ./go
ORIGINAL_GIT_SHA=$(git rev-parse HEAD)

"${ROOT}"/scripts/apply-initial-patch.sh
"${ROOT}"/scripts/create-secondary-patch.sh
"${ROOT}"/scripts/create-secondary-patch.sh ${ARGS}

# Clean things up again after we've generated the patch.
git reset --hard ${ORIGINAL_GIT_SHA}