-
Notifications
You must be signed in to change notification settings - Fork 146
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Generate all functions for all bedrock2 files
Note that we need to set `-Wno-error=tautological-compare`. It's unfortunate that the rewriter can't yet deal with non-linear patterns to optimize away self-comparisons, though it's possible we could be more clever in the initial rewrite rules to avoid this case?
- Loading branch information
1 parent
fd4738d
commit ad5026f
Showing
16 changed files
with
27,904 additions
and
46 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -162,12 +162,8 @@ WORD_BY_WORD_MONTGOMERY := src/ExtractionOCaml/word_by_word_montgomery | |
BEDROCK2_UNSATURATED_SOLINAS := src/ExtractionOCaml/bedrock2_unsaturated_solinas | ||
BEDROCK2_WORD_BY_WORD_MONTGOMERY := src/ExtractionOCaml/bedrock2_word_by_word_montgomery | ||
|
||
# XXX TODO FIXME: support these functions in bedrock2 | ||
BEDROCK2_UNSUPPORTED_SOLINAS_FUNCTIONS := selectznz to_bytes | ||
BEDROCK2_UNSUPPORTED_WORD_BY_WORD_MONTGOMERY_FUNCTIONS := mul square add sub opp from_montgomery selectznz | ||
|
||
BEDROCK2_ARGS := --no-wide-int --widen-carry --widen-bytes --split-multiret | ||
BEDROCK2_EXTRA_CFLAGS := -Wno-error=unused-but-set-variable | ||
BEDROCK2_ARGS := --no-wide-int --widen-carry --widen-bytes --split-multiret --no-select | ||
BEDROCK2_EXTRA_CFLAGS := -Wno-error=unused-but-set-variable -Wno-error=tautological-compare | ||
|
||
GO_EXTRA_ARGS_ALL := --cmovznz-by-mul --widen-carry --widen-bytes | ||
GO_EXTRA_ARGS_64 := --no-wide-int $(GO_EXTRA_ARGS_ALL) | ||
|
@@ -497,14 +493,14 @@ $(WORD_BY_WORD_MONTGOMERY_BEDROCK2_FILES): $(BEDROCK2_WORD_BY_WORD_MONTGOMERY) # | |
$(BEDROCK2_DIR)curve25519_64.c : $(BEDROCK2_DIR)curve25519_%.c : | ||
$(SHOW)'SYNTHESIZE > $@' | ||
$(HIDE)rm -f $@.ok | ||
$(HIDE)($(TIMER) $(BEDROCK2_UNSATURATED_SOLINAS) --lang=bedrock2 $(BEDROCK2_ARGS) '25519' '5' '2^255 - 19' '$*' $(filter-out $(BEDROCK2_UNSUPPORTED_SOLINAS_FUNCTIONS),$(FUNCTIONS_FOR_25519)) && touch $@.ok) > $@.tmp | ||
$(HIDE)($(TIMER) $(BEDROCK2_UNSATURATED_SOLINAS) --lang=bedrock2 $(BEDROCK2_ARGS) '25519' '5' '2^255 - 19' '$*' $(FUNCTIONS_FOR_25519) && touch $@.ok) > $@.tmp | ||
$(HIDE)(rm $@.ok && mv $@.tmp $@) || ( RV=$$?; cat $@.tmp; exit $$RV ) | ||
|
||
# 2^255 - 19 | ||
$(BEDROCK2_DIR)curve25519_32.c : $(BEDROCK2_DIR)curve25519_%.c : | ||
$(SHOW)'SYNTHESIZE > $@' | ||
$(HIDE)rm -f $@.ok | ||
$(HIDE)($(TIMER) $(BEDROCK2_UNSATURATED_SOLINAS) --lang=bedrock2 $(BEDROCK2_ARGS) '25519' '10' '2^255 - 19' '$*' $(filter-out $(BEDROCK2_UNSUPPORTED_SOLINAS_FUNCTIONS),$(FUNCTIONS_FOR_25519)) && touch $@.ok) > $@.tmp | ||
$(HIDE)($(TIMER) $(BEDROCK2_UNSATURATED_SOLINAS) --lang=bedrock2 $(BEDROCK2_ARGS) '25519' '10' '2^255 - 19' '$*' $(FUNCTIONS_FOR_25519) && touch $@.ok) > $@.tmp | ||
$(HIDE)(rm $@.ok && mv $@.tmp $@) || ( RV=$$?; cat $@.tmp; exit $$RV ) | ||
|
||
# 2^130 - 5 | ||
|
@@ -525,56 +521,56 @@ $(BEDROCK2_DIR)poly1305_32.c : $(BEDROCK2_DIR)poly1305_%.c : | |
$(BEDROCK2_DIR)p521_64.c : $(BEDROCK2_DIR)p521_%.c : | ||
$(SHOW)'SYNTHESIZE > $@' | ||
$(HIDE)rm -f $@.ok | ||
$(HIDE)($(TIMER) $(BEDROCK2_UNSATURATED_SOLINAS) --lang=bedrock2 $(BEDROCK2_ARGS) 'p521' '9' '2^521 - 1' '$*' $(filter-out $(BEDROCK2_UNSUPPORTED_SOLINAS_FUNCTIONS),$(UNSATURATED_SOLINAS_FUNCTIONS)) && touch $@.ok) > $@.tmp | ||
$(HIDE)($(TIMER) $(BEDROCK2_UNSATURATED_SOLINAS) --lang=bedrock2 $(BEDROCK2_ARGS) 'p521' '9' '2^521 - 1' '$*' $(UNSATURATED_SOLINAS_FUNCTIONS) && touch $@.ok) > $@.tmp | ||
$(HIDE)(rm $@.ok && mv $@.tmp $@) || ( RV=$$?; cat $@.tmp; exit $$RV ) | ||
|
||
## 2^224 - 2^96 + 1 ## does not bounds check | ||
#$(BEDROCK2_DIR)p224_solinas_64.c : $(BEDROCK2_DIR)p224_solinas_%.c : | ||
# $(SHOW)'SYNTHESIZE > $@' | ||
# $(HIDE)rm -f [email protected] | ||
# $(HIDE)($(TIMER) $(BEDROCK2_UNSATURATED_SOLINAS) --lang=bedrock2 $(BEDROCK2_ARGS) 'p224' '4' '2^224 - 2^96 + 1' '$*' $(filter-out $(BEDROCK2_UNSUPPORTED_SOLINAS_FUNCTIONS),$(UNSATURATED_SOLINAS_FUNCTIONS)) && touch [email protected]) > [email protected] | ||
# $(HIDE)($(TIMER) $(BEDROCK2_UNSATURATED_SOLINAS) --lang=bedrock2 $(BEDROCK2_ARGS) 'p224' '4' '2^224 - 2^96 + 1' '$*' $(UNSATURATED_SOLINAS_FUNCTIONS) && touch [email protected]) > [email protected] | ||
# $(HIDE)(rm [email protected] && mv [email protected] $@) || ( RV=$$?; cat [email protected]; exit $$RV ) | ||
|
||
# 2^448 - 2^224 - 1 | ||
$(BEDROCK2_DIR)p448_solinas_64.c : $(BEDROCK2_DIR)p448_solinas_%.c : | ||
$(SHOW)'SYNTHESIZE > $@' | ||
$(HIDE)rm -f $@.ok | ||
$(HIDE)($(TIMER) $(BEDROCK2_UNSATURATED_SOLINAS) --lang=bedrock2 $(BEDROCK2_ARGS) 'p448' '8' '2^448 - 2^224 - 1' '$*' $(filter-out $(BEDROCK2_UNSUPPORTED_SOLINAS_FUNCTIONS),$(UNSATURATED_SOLINAS_FUNCTIONS)) && touch $@.ok) > $@.tmp | ||
$(HIDE)($(TIMER) $(BEDROCK2_UNSATURATED_SOLINAS) --lang=bedrock2 $(BEDROCK2_ARGS) 'p448' '8' '2^448 - 2^224 - 1' '$*' $(UNSATURATED_SOLINAS_FUNCTIONS) && touch $@.ok) > $@.tmp | ||
$(HIDE)(rm $@.ok && mv $@.tmp $@) || ( RV=$$?; cat $@.tmp; exit $$RV ) | ||
|
||
# 2^256 - 2^224 + 2^192 + 2^96 - 1 | ||
$(BEDROCK2_DIR)p256_64.c $(BEDROCK2_DIR)p256_32.c : $(BEDROCK2_DIR)p256_%.c : | ||
$(SHOW)'SYNTHESIZE > $@' | ||
$(HIDE)rm -f $@.ok | ||
$(HIDE)($(TIMER) $(BEDROCK2_WORD_BY_WORD_MONTGOMERY) --lang=bedrock2 $(BEDROCK2_ARGS) 'p256' '2^256 - 2^224 + 2^192 + 2^96 - 1' '$*' $(filter-out $(BEDROCK2_UNSUPPORTED_WORD_BY_WORD_MONTGOMERY_FUNCTIONS),$(WORD_BY_WORD_MONTGOMERY_FUNCTIONS)) && touch $@.ok) > $@.tmp | ||
$(HIDE)($(TIMER) $(BEDROCK2_WORD_BY_WORD_MONTGOMERY) --lang=bedrock2 $(BEDROCK2_ARGS) 'p256' '2^256 - 2^224 + 2^192 + 2^96 - 1' '$*' $(WORD_BY_WORD_MONTGOMERY_FUNCTIONS) && touch $@.ok) > $@.tmp | ||
$(HIDE)(rm $@.ok && mv $@.tmp $@) || ( RV=$$?; cat $@.tmp; exit $$RV ) | ||
|
||
# 2^256 - 2^32 - 977 | ||
$(BEDROCK2_DIR)secp256k1_64.c $(BEDROCK2_DIR)secp256k1_32.c : $(BEDROCK2_DIR)secp256k1_%.c : | ||
$(SHOW)'SYNTHESIZE > $@' | ||
$(HIDE)rm -f $@.ok | ||
$(HIDE)($(TIMER) $(BEDROCK2_WORD_BY_WORD_MONTGOMERY) --lang=bedrock2 $(BEDROCK2_ARGS) 'secp256k1' '2^256 - 2^32 - 977' '$*' $(filter-out $(BEDROCK2_UNSUPPORTED_WORD_BY_WORD_MONTGOMERY_FUNCTIONS),$(WORD_BY_WORD_MONTGOMERY_FUNCTIONS)) && touch $@.ok) > $@.tmp | ||
$(HIDE)($(TIMER) $(BEDROCK2_WORD_BY_WORD_MONTGOMERY) --lang=bedrock2 $(BEDROCK2_ARGS) 'secp256k1' '2^256 - 2^32 - 977' '$*' $(WORD_BY_WORD_MONTGOMERY_FUNCTIONS) && touch $@.ok) > $@.tmp | ||
$(HIDE)(rm $@.ok && mv $@.tmp $@) || ( RV=$$?; cat $@.tmp; exit $$RV ) | ||
|
||
# 2^384 - 2^128 - 2^96 + 2^32 - 1 | ||
$(BEDROCK2_DIR)p384_64.c $(BEDROCK2_DIR)p384_32.c : $(BEDROCK2_DIR)p384_%.c : | ||
$(SHOW)'SYNTHESIZE > $@' | ||
$(HIDE)rm -f $@.ok | ||
$(HIDE)($(TIMER) $(BEDROCK2_WORD_BY_WORD_MONTGOMERY) --lang=bedrock2 $(BEDROCK2_ARGS) 'p384' '2^384 - 2^128 - 2^96 + 2^32 - 1' '$*' $(filter-out $(BEDROCK2_UNSUPPORTED_WORD_BY_WORD_MONTGOMERY_FUNCTIONS),$(WORD_BY_WORD_MONTGOMERY_FUNCTIONS)) && touch $@.ok) > $@.tmp | ||
$(HIDE)($(TIMER) $(BEDROCK2_WORD_BY_WORD_MONTGOMERY) --lang=bedrock2 $(BEDROCK2_ARGS) 'p384' '2^384 - 2^128 - 2^96 + 2^32 - 1' '$*' $(WORD_BY_WORD_MONTGOMERY_FUNCTIONS) && touch $@.ok) > $@.tmp | ||
$(HIDE)(rm $@.ok && mv $@.tmp $@) || ( RV=$$?; cat $@.tmp; exit $$RV ) | ||
|
||
# 2^224 - 2^96 + 1 | ||
$(BEDROCK2_DIR)p224_64.c $(BEDROCK2_DIR)p224_32.c : $(BEDROCK2_DIR)p224_%.c : | ||
$(SHOW)'SYNTHESIZE > $@' | ||
$(HIDE)rm -f $@.ok | ||
$(HIDE)($(TIMER) $(BEDROCK2_WORD_BY_WORD_MONTGOMERY) --lang=bedrock2 $(BEDROCK2_ARGS) 'p224' '2^224 - 2^96 + 1' '$*' $(filter-out $(BEDROCK2_UNSUPPORTED_WORD_BY_WORD_MONTGOMERY_FUNCTIONS),$(WORD_BY_WORD_MONTGOMERY_FUNCTIONS)) && touch $@.ok) > $@.tmp | ||
$(HIDE)($(TIMER) $(BEDROCK2_WORD_BY_WORD_MONTGOMERY) --lang=bedrock2 $(BEDROCK2_ARGS) 'p224' '2^224 - 2^96 + 1' '$*' $(WORD_BY_WORD_MONTGOMERY_FUNCTIONS) && touch $@.ok) > $@.tmp | ||
$(HIDE)(rm $@.ok && mv $@.tmp $@) || ( RV=$$?; cat $@.tmp; exit $$RV ) | ||
|
||
# 2^216 * 3^137 - 1 | ||
$(BEDROCK2_DIR)p434_64.c $(BEDROCK2_DIR)p434_32.c : $(BEDROCK2_DIR)p434_%.c : | ||
$(SHOW)'SYNTHESIZE > $@' | ||
$(HIDE)rm -f $@.ok | ||
$(HIDE)($(TIMER) $(BEDROCK2_WORD_BY_WORD_MONTGOMERY) --lang=bedrock2 $(BEDROCK2_ARGS) 'p434' '2^216 * 3^137 - 1' '$*' $(filter-out $(BEDROCK2_UNSUPPORTED_WORD_BY_WORD_MONTGOMERY_FUNCTIONS),$(WORD_BY_WORD_MONTGOMERY_FUNCTIONS)) && touch $@.ok) > $@.tmp | ||
$(HIDE)($(TIMER) $(BEDROCK2_WORD_BY_WORD_MONTGOMERY) --lang=bedrock2 $(BEDROCK2_ARGS) 'p434' '2^216 * 3^137 - 1' '$*' $(WORD_BY_WORD_MONTGOMERY_FUNCTIONS) && touch $@.ok) > $@.tmp | ||
$(HIDE)(rm $@.ok && mv $@.tmp $@) || ( RV=$$?; cat $@.tmp; exit $$RV ) | ||
|
||
test-bedrock2-files: $(ALL_BEDROCK2_FILES) | ||
|
Oops, something went wrong.