-
Notifications
You must be signed in to change notification settings - Fork 85
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #599 from onflow/cf/cherry-pick-crypto
Cherry pick crypto changes
- Loading branch information
Showing
13 changed files
with
127 additions
and
43 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# This script can be imported by Makefiles in order to set the `CRYPTO_FLAG` automatically. | ||
# The `CRYPTO_FLAG` is a Go command flag that should be used when the machine's CPU executing | ||
# the command may not support ADX instructions. | ||
# For new machines that support ADX instructions, the `CRYPTO_FLAG` flag is not needed (or set | ||
# to an empty string). | ||
|
||
# First detect ADX support: | ||
# `ADX_SUPPORT` is 1 if ADX instructions are supported on the current machine and 0 otherwise. | ||
ifeq ($(shell uname -s),Linux) | ||
# detect ADX support on the CURRENT linux machine. | ||
ADX_SUPPORT := $(shell if ([ -f "/proc/cpuinfo" ] && grep -q -e '^flags.*\badx\b' /proc/cpuinfo); then echo 1; else echo 0; fi) | ||
else | ||
# on non-linux machines, set the flag to 1 by default | ||
ADX_SUPPORT := 1 | ||
endif | ||
|
||
# Then, set `CRYPTO_FLAG` | ||
# the crypto package uses BLST source files underneath which may use ADX instructions. | ||
ifeq ($(ADX_SUPPORT), 1) | ||
# if ADX instructions are supported on the current machine, default is to use a fast ADX implementation | ||
CRYPTO_FLAG := "" | ||
else | ||
# if ADX instructions aren't supported, this CGO flags uses a slower non-ADX implementation | ||
CRYPTO_FLAG := "-O -D__BLST_PORTABLE__" | ||
endif |
This file contains 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
This file contains 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
Oops, something went wrong.