diff options
author | Jason Gross <jgross@mit.edu> | 2019-02-01 18:50:00 -0500 |
---|---|---|
committer | Jason Gross <jasongross9@gmail.com> | 2019-02-02 18:22:15 -0500 |
commit | ce583d76bdb8f15148fc4222d8bdec096547682a (patch) | |
tree | ffb083673e6be283d7f67ad857bc2f30af892767 /p448_solinas_64.c | |
parent | 069e5cce23669707f11e59d9f68a31ad24990fe0 (diff) |
Use Preconditions: Postconditions:, rather than /\ and ->
Diffstat (limited to 'p448_solinas_64.c')
-rw-r--r-- | p448_solinas_64.c | 52 |
1 files changed, 38 insertions, 14 deletions
diff --git a/p448_solinas_64.c b/p448_solinas_64.c index 16dbbfe89..6e5c8066b 100644 --- a/p448_solinas_64.c +++ b/p448_solinas_64.c @@ -18,8 +18,10 @@ typedef unsigned __int128 fiat_p448_uint128; /* * The function fiat_p448_addcarryx_u56 is an addition with carry. - * out1 = (arg1 + arg2 + arg3) mod 2^56 - * ∧ out2 = ⌊(arg1 + arg2 + arg3) / 2^56⌋ + * Postconditions: + * out1 = (arg1 + arg2 + arg3) mod 2^56 + * out2 = ⌊(arg1 + arg2 + arg3) / 2^56⌋ + * * Input Bounds: * arg1: [0x0 ~> 0x1] * arg2: [0x0 ~> 0xffffffffffffff] @@ -38,8 +40,10 @@ static void fiat_p448_addcarryx_u56(uint64_t* out1, fiat_p448_uint1* out2, fiat_ /* * The function fiat_p448_subborrowx_u56 is a subtraction with borrow. - * out1 = (-arg1 + arg2 + -arg3) mod 2^56 - * ∧ out2 = -⌊(-arg1 + arg2 + -arg3) / 2^56⌋ + * Postconditions: + * out1 = (-arg1 + arg2 + -arg3) mod 2^56 + * out2 = -⌊(-arg1 + arg2 + -arg3) / 2^56⌋ + * * Input Bounds: * arg1: [0x0 ~> 0x1] * arg2: [0x0 ~> 0xffffffffffffff] @@ -58,7 +62,9 @@ static void fiat_p448_subborrowx_u56(uint64_t* out1, fiat_p448_uint1* out2, fiat /* * The function fiat_p448_cmovznz_u64 is a single-word conditional move. - * out1 = (if arg1 = 0 then arg2 else arg3) + * Postconditions: + * out1 = (if arg1 = 0 then arg2 else arg3) + * * Input Bounds: * arg1: [0x0 ~> 0x1] * arg2: [0x0 ~> 0xffffffffffffffff] @@ -75,7 +81,9 @@ static void fiat_p448_cmovznz_u64(uint64_t* out1, fiat_p448_uint1 arg1, uint64_t /* * The function fiat_p448_carry_mul multiplies two field elements and reduces the result. - * eval out1 mod m = (eval arg1 * eval arg2) mod m + * Postconditions: + * eval out1 mod m = (eval arg1 * eval arg2) mod m + * * Input Bounds: * arg1: [[0x0 ~> 0x34ccccccccccccb], [0x0 ~> 0x34ccccccccccccb], [0x0 ~> 0x34ccccccccccccb], [0x0 ~> 0x34ccccccccccccb], [0x0 ~> 0x34ccccccccccccb], [0x0 ~> 0x34ccccccccccccb], [0x0 ~> 0x34ccccccccccccb], [0x0 ~> 0x34ccccccccccccb]] * arg2: [[0x0 ~> 0x34ccccccccccccb], [0x0 ~> 0x34ccccccccccccb], [0x0 ~> 0x34ccccccccccccb], [0x0 ~> 0x34ccccccccccccb], [0x0 ~> 0x34ccccccccccccb], [0x0 ~> 0x34ccccccccccccb], [0x0 ~> 0x34ccccccccccccb], [0x0 ~> 0x34ccccccccccccb]] @@ -239,7 +247,9 @@ static void fiat_p448_carry_mul(uint64_t out1[8], const uint64_t arg1[8], const /* * The function fiat_p448_carry_square squares a field element and reduces the result. - * eval out1 mod m = (eval arg1 * eval arg1) mod m + * Postconditions: + * eval out1 mod m = (eval arg1 * eval arg1) mod m + * * Input Bounds: * arg1: [[0x0 ~> 0x34ccccccccccccb], [0x0 ~> 0x34ccccccccccccb], [0x0 ~> 0x34ccccccccccccb], [0x0 ~> 0x34ccccccccccccb], [0x0 ~> 0x34ccccccccccccb], [0x0 ~> 0x34ccccccccccccb], [0x0 ~> 0x34ccccccccccccb], [0x0 ~> 0x34ccccccccccccb]] * Output Bounds: @@ -381,7 +391,9 @@ static void fiat_p448_carry_square(uint64_t out1[8], const uint64_t arg1[8]) { /* * The function fiat_p448_carry reduces a field element. - * eval out1 mod m = eval arg1 mod m + * Postconditions: + * eval out1 mod m = eval arg1 mod m + * * Input Bounds: * arg1: [[0x0 ~> 0x34ccccccccccccb], [0x0 ~> 0x34ccccccccccccb], [0x0 ~> 0x34ccccccccccccb], [0x0 ~> 0x34ccccccccccccb], [0x0 ~> 0x34ccccccccccccb], [0x0 ~> 0x34ccccccccccccb], [0x0 ~> 0x34ccccccccccccb], [0x0 ~> 0x34ccccccccccccb]] * Output Bounds: @@ -422,7 +434,9 @@ static void fiat_p448_carry(uint64_t out1[8], const uint64_t arg1[8]) { /* * The function fiat_p448_add adds two field elements. - * eval out1 mod m = (eval arg1 + eval arg2) mod m + * Postconditions: + * eval out1 mod m = (eval arg1 + eval arg2) mod m + * * Input Bounds: * arg1: [[0x0 ~> 0x119999999999999], [0x0 ~> 0x119999999999999], [0x0 ~> 0x119999999999999], [0x0 ~> 0x119999999999999], [0x0 ~> 0x119999999999999], [0x0 ~> 0x119999999999999], [0x0 ~> 0x119999999999999], [0x0 ~> 0x119999999999999]] * arg2: [[0x0 ~> 0x119999999999999], [0x0 ~> 0x119999999999999], [0x0 ~> 0x119999999999999], [0x0 ~> 0x119999999999999], [0x0 ~> 0x119999999999999], [0x0 ~> 0x119999999999999], [0x0 ~> 0x119999999999999], [0x0 ~> 0x119999999999999]] @@ -450,7 +464,9 @@ static void fiat_p448_add(uint64_t out1[8], const uint64_t arg1[8], const uint64 /* * The function fiat_p448_sub subtracts two field elements. - * eval out1 mod m = (eval arg1 - eval arg2) mod m + * Postconditions: + * eval out1 mod m = (eval arg1 - eval arg2) mod m + * * Input Bounds: * arg1: [[0x0 ~> 0x119999999999999], [0x0 ~> 0x119999999999999], [0x0 ~> 0x119999999999999], [0x0 ~> 0x119999999999999], [0x0 ~> 0x119999999999999], [0x0 ~> 0x119999999999999], [0x0 ~> 0x119999999999999], [0x0 ~> 0x119999999999999]] * arg2: [[0x0 ~> 0x119999999999999], [0x0 ~> 0x119999999999999], [0x0 ~> 0x119999999999999], [0x0 ~> 0x119999999999999], [0x0 ~> 0x119999999999999], [0x0 ~> 0x119999999999999], [0x0 ~> 0x119999999999999], [0x0 ~> 0x119999999999999]] @@ -478,7 +494,9 @@ static void fiat_p448_sub(uint64_t out1[8], const uint64_t arg1[8], const uint64 /* * The function fiat_p448_opp negates a field element. - * eval out1 mod m = -eval arg1 mod m + * Postconditions: + * eval out1 mod m = -eval arg1 mod m + * * Input Bounds: * arg1: [[0x0 ~> 0x119999999999999], [0x0 ~> 0x119999999999999], [0x0 ~> 0x119999999999999], [0x0 ~> 0x119999999999999], [0x0 ~> 0x119999999999999], [0x0 ~> 0x119999999999999], [0x0 ~> 0x119999999999999], [0x0 ~> 0x119999999999999]] * Output Bounds: @@ -505,7 +523,9 @@ static void fiat_p448_opp(uint64_t out1[8], const uint64_t arg1[8]) { /* * The function fiat_p448_selectznz is a multi-limb conditional select. - * eval out1 = (if arg1 = 0 then eval arg2 else eval arg3) + * Postconditions: + * eval out1 = (if arg1 = 0 then eval arg2 else eval arg3) + * * Input Bounds: * arg1: [0x0 ~> 0x1] * arg2: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]] @@ -542,7 +562,9 @@ static void fiat_p448_selectznz(uint64_t out1[8], fiat_p448_uint1 arg1, const ui /* * The function fiat_p448_to_bytes serializes a field element to bytes in little-endian order. - * out1 = map (λ x, ⌊(eval arg1 mod m) mod 2^(8 * (x + 1)) / 2^(8 * x)⌋) [0..55] + * Postconditions: + * out1 = map (λ x, ⌊((eval arg1 mod m) mod 2^(8 * (x + 1))) / 2^(8 * x)⌋) [0..55] + * * Input Bounds: * arg1: [[0x0 ~> 0x119999999999999], [0x0 ~> 0x119999999999999], [0x0 ~> 0x119999999999999], [0x0 ~> 0x119999999999999], [0x0 ~> 0x119999999999999], [0x0 ~> 0x119999999999999], [0x0 ~> 0x119999999999999], [0x0 ~> 0x119999999999999]] * Output Bounds: @@ -762,7 +784,9 @@ static void fiat_p448_to_bytes(uint8_t out1[56], const uint64_t arg1[8]) { /* * The function fiat_p448_from_bytes deserializes a field element from bytes in little-endian order. - * eval out1 mod m = bytes_eval arg1 mod m + * Postconditions: + * eval out1 mod m = bytes_eval arg1 mod m + * * Input Bounds: * arg1: [[0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff]] * Output Bounds: |