Skip to content

Commit

Permalink
Merge pull request #2 from redpwn/universal-macos
Browse files Browse the repository at this point in the history
  • Loading branch information
ginkoid committed Jul 12, 2021
2 parents d67e98f + 6a89c66 commit bf2007f
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
16 changes: 15 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,24 @@ jobs:
lib_tmp=$(mktemp -d)
cp /usr/local/opt/gmp/lib/libgmp.a "$lib_tmp"
go build -v -ldflags "-w -s -extldflags -L$lib_tmp" -o redpwnpow-darwin-amd64 ./cmd/redpwnpow
oci_tmp=$(mktemp -d)
ghcr_token=$(curl -f 'https://ghcr.io/token?scope=repository:homebrew/core/gmp:pull' | jq -r .token)
curl -fLH "authorization: Bearer $ghcr_token" https://ghcr.io/v2/homebrew/core/gmp/blobs/sha256:ff4ad8d068ba4c14d146abb454991b6c4f246796ec2538593dc5f04ca7593eec | tar xzC "$oci_tmp" --strip-components=2
lib_tmp=$(mktemp -d)
cp "$oci_tmp/lib/libgmp.a" "$lib_tmp"
export SDK_NAME=macosx
export SDK_PATH=$(xcrun --show-sdk-path --sdk $SDK_NAME)
export CC="$(xcrun -sdk $SDK_PATH --find clang) -arch arm64 -isysroot $SDK_PATH"
export CFLAGS="-isysroot $SDK_PATH -arch arm64 -I$SDK_PATH/usr/include"
export LD_LIBRARY_PATH="$SDK_PATH/usr/lib"
export CGO_LDFLAGS="-isysroot $SDK_PATH -arch arm64 -L$lib_tmp"
export CGO_CFLAGS="-isysroot $SDK_PATH -arch arm64 -I/usr/local/include"
CGO_ENABLED=1 GOARCH=arm64 go build -v -ldflags '-w -s' -o redpwnpow-darwin-arm64 ./cmd/redpwnpow
lipo -create -output redpwnpow-darwin redpwnpow-darwin-amd64 redpwnpow-darwin-arm64
- uses: actions/upload-artifact@v2
with:
name: darwin
path: redpwnpow-darwin-*
path: redpwnpow-darwin
windows:
runs-on: windows-2019
steps:
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ redpwnpow challenge
## kCTF

redpwnpow can be used as a drop-in replacement for [kCTF](https://google.github.io/kctf/)'s proof of work solver.
redpwnpow is approximately **10x** faster than kCTF's [Python solver](https://github.com/google/kctf/blob/v1.0/docker-images/challenge/pow.py).
redpwnpow is approximately **10x faster** than kCTF's [Python solver](https://github.com/google/kctf/blob/v1.0/docker-images/challenge/pow.py).

## Go module

Expand Down
2 changes: 1 addition & 1 deletion cmd/redpwnpow/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ run() {
arm*) release=linux-armv6l;;
*) echo unknown linux architecture >&2; exit 1
esac;;
darwin*) release=darwin-amd64;;
darwin*) release=darwin;;
msys*|mingw*|cygwin*) release=windows-amd64.exe;;
*) echo unknown operating system >&2; exit 1
esac
Expand Down

0 comments on commit bf2007f

Please sign in to comment.