diff options
Diffstat (limited to 'src/Specific/solinas32_2e448m2e224m1_16limbs')
15 files changed, 150 insertions, 0 deletions
diff --git a/src/Specific/solinas32_2e448m2e224m1_16limbs/CurveParameters.v b/src/Specific/solinas32_2e448m2e224m1_16limbs/CurveParameters.v new file mode 100644 index 000000000..7588e5dd1 --- /dev/null +++ b/src/Specific/solinas32_2e448m2e224m1_16limbs/CurveParameters.v @@ -0,0 +1,39 @@ +Require Import Crypto.Specific.Framework.RawCurveParameters. +Require Import Crypto.Util.LetIn. + +(*** +Modulus : 2^448 - 2^224 - 1 +Base: 28 +***) + +Definition curve : CurveParameters := + {| + sz := 16%nat; + base := 28; + bitwidth := 32; + s := 2^448; + c := [(1, 1); (2^224, 1)]; + carry_chains := Some [[7; 15]; [8; 0; 9; 1; 10; 2; 11; 3; 12; 4; 13; 5; 14; 6; 15; 7]; [8; 0]]%nat; + + a24 := None; + coef_div_modulus := Some 2%nat; + + goldilocks := Some true; + karatsuba := None; + montgomery := false; + freeze := Some true; + ladderstep := false; + + mul_code := None; + + square_code := None; + + upper_bound_of_exponent_loose := None; + upper_bound_of_exponent_tight := None; + allowable_bit_widths := None; + freeze_extra_allowable_bit_widths := None; + modinv_fuel := None + |}. + +Ltac extra_prove_mul_eq _ := idtac. +Ltac extra_prove_square_eq _ := idtac. diff --git a/src/Specific/solinas32_2e448m2e224m1_16limbs/Synthesis.v b/src/Specific/solinas32_2e448m2e224m1_16limbs/Synthesis.v new file mode 100644 index 000000000..5dfd986ec --- /dev/null +++ b/src/Specific/solinas32_2e448m2e224m1_16limbs/Synthesis.v @@ -0,0 +1,9 @@ +Require Import Crypto.Specific.Framework.SynthesisFramework. +Require Import Crypto.Specific.solinas32_2e448m2e224m1_16limbs.CurveParameters. + +Module P <: PrePackage. + Definition package : Tag.Context. + Proof. make_Synthesis_package curve extra_prove_mul_eq extra_prove_square_eq. Defined. +End P. + +Module Export S := PackageSynthesis P. diff --git a/src/Specific/solinas32_2e448m2e224m1_16limbs/compiler.sh b/src/Specific/solinas32_2e448m2e224m1_16limbs/compiler.sh new file mode 100755 index 000000000..cb052d76d --- /dev/null +++ b/src/Specific/solinas32_2e448m2e224m1_16limbs/compiler.sh @@ -0,0 +1,4 @@ +#!/bin/sh +set -eu + +clang -fbracket-depth=999999 -march=native -mtune=native -std=gnu11 -O3 -flto -fuse-ld=lld -fomit-frame-pointer -fwrapv -Wno-attributes -fno-strict-aliasing -Da24_hex='0x3039' -Da24_val='12345' -Da_minus_two_over_four_array='{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x39}' -Dbitwidth='32' -Dlimb_weight_gaps_array='{28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28}' -Dmodulus_array='{0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xfe,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff}' -Dmodulus_bytes_val='56' -Dmodulus_limbs='16' -Dq_mpz='(1_mpz<<448) - (1_mpz<<224) - 1' "$@" diff --git a/src/Specific/solinas32_2e448m2e224m1_16limbs/compilerxx.sh b/src/Specific/solinas32_2e448m2e224m1_16limbs/compilerxx.sh new file mode 100755 index 000000000..451401798 --- /dev/null +++ b/src/Specific/solinas32_2e448m2e224m1_16limbs/compilerxx.sh @@ -0,0 +1,4 @@ +#!/bin/sh +set -eu + +clang++ -fbracket-depth=999999 -march=native -mtune=native -std=gnu++11 -O3 -flto -fuse-ld=lld -fomit-frame-pointer -fwrapv -Wno-attributes -fno-strict-aliasing -Da24_hex='0x3039' -Da24_val='12345' -Da_minus_two_over_four_array='{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x39}' -Dbitwidth='32' -Dlimb_weight_gaps_array='{28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28}' -Dmodulus_array='{0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xfe,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff}' -Dmodulus_bytes_val='56' -Dmodulus_limbs='16' -Dq_mpz='(1_mpz<<448) - (1_mpz<<224) - 1' "$@" diff --git a/src/Specific/solinas32_2e448m2e224m1_16limbs/feadd.v b/src/Specific/solinas32_2e448m2e224m1_16limbs/feadd.v new file mode 100644 index 000000000..f122d3754 --- /dev/null +++ b/src/Specific/solinas32_2e448m2e224m1_16limbs/feadd.v @@ -0,0 +1,14 @@ +Require Import Crypto.Arithmetic.PrimeFieldTheorems. +Require Import Crypto.Specific.solinas32_2e448m2e224m1_16limbs.Synthesis. + +(* TODO : change this to field once field isomorphism happens *) +Definition add : + { add : feBW_tight -> feBW_tight -> feBW_loose + | forall a b, phiBW_loose (add a b) = F.add (phiBW_tight a) (phiBW_tight b) }. +Proof. + Set Ltac Profiling. + Time synthesize_add (). + Show Ltac Profile. +Time Defined. + +Print Assumptions add. diff --git a/src/Specific/solinas32_2e448m2e224m1_16limbs/feaddDisplay.v b/src/Specific/solinas32_2e448m2e224m1_16limbs/feaddDisplay.v new file mode 100644 index 000000000..43ca23445 --- /dev/null +++ b/src/Specific/solinas32_2e448m2e224m1_16limbs/feaddDisplay.v @@ -0,0 +1,4 @@ +Require Import Crypto.Specific.solinas32_2e448m2e224m1_16limbs.feadd. +Require Import Crypto.Specific.Framework.IntegrationTestDisplayCommon. + +Check display add. diff --git a/src/Specific/solinas32_2e448m2e224m1_16limbs/femul.v b/src/Specific/solinas32_2e448m2e224m1_16limbs/femul.v new file mode 100644 index 000000000..8f2843ccf --- /dev/null +++ b/src/Specific/solinas32_2e448m2e224m1_16limbs/femul.v @@ -0,0 +1,14 @@ +Require Import Crypto.Arithmetic.PrimeFieldTheorems. +Require Import Crypto.Specific.solinas32_2e448m2e224m1_16limbs.Synthesis. + +(* TODO : change this to field once field isomorphism happens *) +Definition mul : + { mul : feBW_loose -> feBW_loose -> feBW_tight + | forall a b, phiBW_tight (mul a b) = F.mul (phiBW_loose a) (phiBW_loose b) }. +Proof. + Set Ltac Profiling. + Time synthesize_mul (). + Show Ltac Profile. +Time Defined. + +Print Assumptions mul. diff --git a/src/Specific/solinas32_2e448m2e224m1_16limbs/femulDisplay.v b/src/Specific/solinas32_2e448m2e224m1_16limbs/femulDisplay.v new file mode 100644 index 000000000..d2f8196ec --- /dev/null +++ b/src/Specific/solinas32_2e448m2e224m1_16limbs/femulDisplay.v @@ -0,0 +1,4 @@ +Require Import Crypto.Specific.solinas32_2e448m2e224m1_16limbs.femul. +Require Import Crypto.Specific.Framework.IntegrationTestDisplayCommon. + +Check display mul. diff --git a/src/Specific/solinas32_2e448m2e224m1_16limbs/fesquare.v b/src/Specific/solinas32_2e448m2e224m1_16limbs/fesquare.v new file mode 100644 index 000000000..b2566b3f8 --- /dev/null +++ b/src/Specific/solinas32_2e448m2e224m1_16limbs/fesquare.v @@ -0,0 +1,14 @@ +Require Import Crypto.Arithmetic.PrimeFieldTheorems. +Require Import Crypto.Specific.solinas32_2e448m2e224m1_16limbs.Synthesis. + +(* TODO : change this to field once field isomorphism happens *) +Definition square : + { square : feBW_loose -> feBW_tight + | forall a, phiBW_tight (square a) = F.mul (phiBW_loose a) (phiBW_loose a) }. +Proof. + Set Ltac Profiling. + Time synthesize_square (). + Show Ltac Profile. +Time Defined. + +Print Assumptions square. diff --git a/src/Specific/solinas32_2e448m2e224m1_16limbs/fesquareDisplay.v b/src/Specific/solinas32_2e448m2e224m1_16limbs/fesquareDisplay.v new file mode 100644 index 000000000..044cffaeb --- /dev/null +++ b/src/Specific/solinas32_2e448m2e224m1_16limbs/fesquareDisplay.v @@ -0,0 +1,4 @@ +Require Import Crypto.Specific.solinas32_2e448m2e224m1_16limbs.fesquare. +Require Import Crypto.Specific.Framework.IntegrationTestDisplayCommon. + +Check display square. diff --git a/src/Specific/solinas32_2e448m2e224m1_16limbs/fesub.v b/src/Specific/solinas32_2e448m2e224m1_16limbs/fesub.v new file mode 100644 index 000000000..10e5b653c --- /dev/null +++ b/src/Specific/solinas32_2e448m2e224m1_16limbs/fesub.v @@ -0,0 +1,14 @@ +Require Import Crypto.Arithmetic.PrimeFieldTheorems. +Require Import Crypto.Specific.solinas32_2e448m2e224m1_16limbs.Synthesis. + +(* TODO : change this to field once field isomorphism happens *) +Definition sub : + { sub : feBW_tight -> feBW_tight -> feBW_loose + | forall a b, phiBW_loose (sub a b) = F.sub (phiBW_tight a) (phiBW_tight b) }. +Proof. + Set Ltac Profiling. + Time synthesize_sub (). + Show Ltac Profile. +Time Defined. + +Print Assumptions sub. diff --git a/src/Specific/solinas32_2e448m2e224m1_16limbs/fesubDisplay.v b/src/Specific/solinas32_2e448m2e224m1_16limbs/fesubDisplay.v new file mode 100644 index 000000000..e89f4ace2 --- /dev/null +++ b/src/Specific/solinas32_2e448m2e224m1_16limbs/fesubDisplay.v @@ -0,0 +1,4 @@ +Require Import Crypto.Specific.solinas32_2e448m2e224m1_16limbs.fesub. +Require Import Crypto.Specific.Framework.IntegrationTestDisplayCommon. + +Check display sub. diff --git a/src/Specific/solinas32_2e448m2e224m1_16limbs/freeze.v b/src/Specific/solinas32_2e448m2e224m1_16limbs/freeze.v new file mode 100644 index 000000000..2563bcf51 --- /dev/null +++ b/src/Specific/solinas32_2e448m2e224m1_16limbs/freeze.v @@ -0,0 +1,14 @@ +Require Import Crypto.Arithmetic.PrimeFieldTheorems. +Require Import Crypto.Specific.solinas32_2e448m2e224m1_16limbs.Synthesis. + +(* TODO : change this to field once field isomorphism happens *) +Definition freeze : + { freeze : feBW_tight -> feBW_limbwidths + | forall a, phiBW_limbwidths (freeze a) = phiBW_tight a }. +Proof. + Set Ltac Profiling. + Time synthesize_freeze (). + Show Ltac Profile. +Time Defined. + +Print Assumptions freeze. diff --git a/src/Specific/solinas32_2e448m2e224m1_16limbs/freezeDisplay.v b/src/Specific/solinas32_2e448m2e224m1_16limbs/freezeDisplay.v new file mode 100644 index 000000000..b9938e4c0 --- /dev/null +++ b/src/Specific/solinas32_2e448m2e224m1_16limbs/freezeDisplay.v @@ -0,0 +1,4 @@ +Require Import Crypto.Specific.solinas32_2e448m2e224m1_16limbs.freeze. +Require Import Crypto.Specific.Framework.IntegrationTestDisplayCommon. + +Check display freeze. diff --git a/src/Specific/solinas32_2e448m2e224m1_16limbs/py_interpreter.sh b/src/Specific/solinas32_2e448m2e224m1_16limbs/py_interpreter.sh new file mode 100755 index 000000000..cc74503cd --- /dev/null +++ b/src/Specific/solinas32_2e448m2e224m1_16limbs/py_interpreter.sh @@ -0,0 +1,4 @@ +#!/bin/sh +set -eu + +/usr/bin/env python3 "$@" -Dq='2**448 - 2**224 - 1' -Dmodulus_bytes='28' -Da24='121665' |