aboutsummaryrefslogtreecommitdiff
path: root/curve25519_32.c
diff options
context:
space:
mode:
authorGravatar Jason Gross <jgross@mit.edu>2019-01-30 19:13:27 -0500
committerGravatar Jason Gross <jasongross9@gmail.com>2019-02-02 18:22:15 -0500
commit496271f86e9dc6df1b23a189d6b8fd2a82db33aa (patch)
tree1b531bac09c49efb594642ea85d398f7893f8494 /curve25519_32.c
parentcd1d339aa57c09abc716ef30a5a153ac5aadb563 (diff)
Add autogenerated docstrings to synthesized code
We now stringify the correctness conditions to generate docstrings for the synthesized code. Closes #512 Time commitment: about 6 hours
Diffstat (limited to 'curve25519_32.c')
-rw-r--r--curve25519_32.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/curve25519_32.c b/curve25519_32.c
index 83453d82b..ccb1085fb 100644
--- a/curve25519_32.c
+++ b/curve25519_32.c
@@ -15,6 +15,9 @@ typedef signed char fiat_25519_int1;
/*
+ * The function fiat_25519_addcarryx_u26 is an add with carry.
+ * out1 = (arg1 + arg2 + arg3) mod 2^26
+ * ∧ out2 = ⌊(arg1 + arg2 + arg3) / 2^26⌋
* Input Bounds:
* arg1: [0x0 ~> 0x1]
* arg2: [0x0 ~> 0x3ffffff]
@@ -32,6 +35,9 @@ static void fiat_25519_addcarryx_u26(uint32_t* out1, fiat_25519_uint1* out2, fia
}
/*
+ * The function fiat_25519_subborrowx_u26 is a sub with borrow.
+ * out1 = (-arg1 + arg2 + -arg3) mod 2^26
+ * ∧ out2 = -⌊(-arg1 + arg2 + -arg3) / 2^26⌋
* Input Bounds:
* arg1: [0x0 ~> 0x1]
* arg2: [0x0 ~> 0x3ffffff]
@@ -49,6 +55,9 @@ static void fiat_25519_subborrowx_u26(uint32_t* out1, fiat_25519_uint1* out2, fi
}
/*
+ * The function fiat_25519_addcarryx_u25 is an add with carry.
+ * out1 = (arg1 + arg2 + arg3) mod 2^25
+ * ∧ out2 = ⌊(arg1 + arg2 + arg3) / 2^25⌋
* Input Bounds:
* arg1: [0x0 ~> 0x1]
* arg2: [0x0 ~> 0x1ffffff]
@@ -66,6 +75,9 @@ static void fiat_25519_addcarryx_u25(uint32_t* out1, fiat_25519_uint1* out2, fia
}
/*
+ * The function fiat_25519_subborrowx_u25 is a sub with borrow.
+ * out1 = (-arg1 + arg2 + -arg3) mod 2^25
+ * ∧ out2 = -⌊(-arg1 + arg2 + -arg3) / 2^25⌋
* Input Bounds:
* arg1: [0x0 ~> 0x1]
* arg2: [0x0 ~> 0x1ffffff]
@@ -83,6 +95,8 @@ static void fiat_25519_subborrowx_u25(uint32_t* out1, fiat_25519_uint1* out2, fi
}
/*
+ * The function fiat_25519_cmovznz_u32 is a single-word conditional move.
+ * out1 = (if arg1 = 0 then arg2 else arg3)
* Input Bounds:
* arg1: [0x0 ~> 0x1]
* arg2: [0x0 ~> 0xffffffff]
@@ -98,6 +112,8 @@ static void fiat_25519_cmovznz_u32(uint32_t* out1, fiat_25519_uint1 arg1, uint32
}
/*
+ * The function fiat_25519_carry_mul does stuff.
+ * eval out1 mod m = (eval arg1 * eval arg2) mod m
* Input Bounds:
* arg1: [[0x0 ~> 0xd333332], [0x0 ~> 0x6999999], [0x0 ~> 0xd333332], [0x0 ~> 0x6999999], [0x0 ~> 0xd333332], [0x0 ~> 0x6999999], [0x0 ~> 0xd333332], [0x0 ~> 0x6999999], [0x0 ~> 0xd333332], [0x0 ~> 0x6999999]]
* arg2: [[0x0 ~> 0xd333332], [0x0 ~> 0x6999999], [0x0 ~> 0xd333332], [0x0 ~> 0x6999999], [0x0 ~> 0xd333332], [0x0 ~> 0x6999999], [0x0 ~> 0xd333332], [0x0 ~> 0x6999999], [0x0 ~> 0xd333332], [0x0 ~> 0x6999999]]
@@ -265,6 +281,8 @@ static void fiat_25519_carry_mul(uint32_t out1[10], const uint32_t arg1[10], con
}
/*
+ * The function fiat_25519_carry_square does stuff.
+ * eval out1 mod m = (eval arg1 * eval arg1) mod m
* Input Bounds:
* arg1: [[0x0 ~> 0xd333332], [0x0 ~> 0x6999999], [0x0 ~> 0xd333332], [0x0 ~> 0x6999999], [0x0 ~> 0xd333332], [0x0 ~> 0x6999999], [0x0 ~> 0xd333332], [0x0 ~> 0x6999999], [0x0 ~> 0xd333332], [0x0 ~> 0x6999999]]
* Output Bounds:
@@ -404,6 +422,8 @@ static void fiat_25519_carry_square(uint32_t out1[10], const uint32_t arg1[10])
}
/*
+ * The function fiat_25519_carry_scmul_121666 does stuff.
+ * eval out1 mod m = (121666 * eval arg1) mod m
* Input Bounds:
* arg1: [[0x0 ~> 0xd333332], [0x0 ~> 0x6999999], [0x0 ~> 0xd333332], [0x0 ~> 0x6999999], [0x0 ~> 0xd333332], [0x0 ~> 0x6999999], [0x0 ~> 0xd333332], [0x0 ~> 0x6999999], [0x0 ~> 0xd333332], [0x0 ~> 0x6999999]]
* Output Bounds:
@@ -470,6 +490,8 @@ static void fiat_25519_carry_scmul_121666(uint32_t out1[10], const uint32_t arg1
}
/*
+ * The function fiat_25519_carry does stuff.
+ * eval out1 mod m = eval arg1 mod m
* Input Bounds:
* arg1: [[0x0 ~> 0xd333332], [0x0 ~> 0x6999999], [0x0 ~> 0xd333332], [0x0 ~> 0x6999999], [0x0 ~> 0xd333332], [0x0 ~> 0x6999999], [0x0 ~> 0xd333332], [0x0 ~> 0x6999999], [0x0 ~> 0xd333332], [0x0 ~> 0x6999999]]
* Output Bounds:
@@ -511,6 +533,8 @@ static void fiat_25519_carry(uint32_t out1[10], const uint32_t arg1[10]) {
}
/*
+ * The function fiat_25519_add does stuff.
+ * eval out1 mod m = (eval arg1 + eval arg2) mod m
* Input Bounds:
* arg1: [[0x0 ~> 0x4666666], [0x0 ~> 0x2333333], [0x0 ~> 0x4666666], [0x0 ~> 0x2333333], [0x0 ~> 0x4666666], [0x0 ~> 0x2333333], [0x0 ~> 0x4666666], [0x0 ~> 0x2333333], [0x0 ~> 0x4666666], [0x0 ~> 0x2333333]]
* arg2: [[0x0 ~> 0x4666666], [0x0 ~> 0x2333333], [0x0 ~> 0x4666666], [0x0 ~> 0x2333333], [0x0 ~> 0x4666666], [0x0 ~> 0x2333333], [0x0 ~> 0x4666666], [0x0 ~> 0x2333333], [0x0 ~> 0x4666666], [0x0 ~> 0x2333333]]
@@ -541,6 +565,8 @@ static void fiat_25519_add(uint32_t out1[10], const uint32_t arg1[10], const uin
}
/*
+ * The function fiat_25519_sub does stuff.
+ * eval out1 mod m = (eval arg1 - eval arg2) mod m
* Input Bounds:
* arg1: [[0x0 ~> 0x4666666], [0x0 ~> 0x2333333], [0x0 ~> 0x4666666], [0x0 ~> 0x2333333], [0x0 ~> 0x4666666], [0x0 ~> 0x2333333], [0x0 ~> 0x4666666], [0x0 ~> 0x2333333], [0x0 ~> 0x4666666], [0x0 ~> 0x2333333]]
* arg2: [[0x0 ~> 0x4666666], [0x0 ~> 0x2333333], [0x0 ~> 0x4666666], [0x0 ~> 0x2333333], [0x0 ~> 0x4666666], [0x0 ~> 0x2333333], [0x0 ~> 0x4666666], [0x0 ~> 0x2333333], [0x0 ~> 0x4666666], [0x0 ~> 0x2333333]]
@@ -571,6 +597,8 @@ static void fiat_25519_sub(uint32_t out1[10], const uint32_t arg1[10], const uin
}
/*
+ * The function fiat_25519_opp does stuff.
+ * eval out1 mod m = -eval arg1 mod m
* Input Bounds:
* arg1: [[0x0 ~> 0x4666666], [0x0 ~> 0x2333333], [0x0 ~> 0x4666666], [0x0 ~> 0x2333333], [0x0 ~> 0x4666666], [0x0 ~> 0x2333333], [0x0 ~> 0x4666666], [0x0 ~> 0x2333333], [0x0 ~> 0x4666666], [0x0 ~> 0x2333333]]
* Output Bounds:
@@ -600,6 +628,8 @@ static void fiat_25519_opp(uint32_t out1[10], const uint32_t arg1[10]) {
}
/*
+ * The function fiat_25519_selectznz is a multi-limb conditional select.
+ * eval out1 = (if arg1 = 0 then eval arg2 else eval arg3)
* Input Bounds:
* arg1: [0x0 ~> 0x1]
* arg2: [[0x0 ~> 0xffffffff], [0x0 ~> 0xffffffff], [0x0 ~> 0xffffffff], [0x0 ~> 0xffffffff], [0x0 ~> 0xffffffff], [0x0 ~> 0xffffffff], [0x0 ~> 0xffffffff], [0x0 ~> 0xffffffff], [0x0 ~> 0xffffffff], [0x0 ~> 0xffffffff]]
@@ -641,6 +671,8 @@ static void fiat_25519_selectznz(uint32_t out1[10], fiat_25519_uint1 arg1, const
}
/*
+ * The function fiat_25519_to_bytes does stuff.
+ * out1 = map (λ x, ⌊(eval arg1 mod m) mod 2^(8 * (x + 1)) / 2^(8 * x)⌋) [0..31]
* Input Bounds:
* arg1: [[0x0 ~> 0x4666666], [0x0 ~> 0x2333333], [0x0 ~> 0x4666666], [0x0 ~> 0x2333333], [0x0 ~> 0x4666666], [0x0 ~> 0x2333333], [0x0 ~> 0x4666666], [0x0 ~> 0x2333333], [0x0 ~> 0x4666666], [0x0 ~> 0x2333333]]
* Output Bounds:
@@ -821,6 +853,8 @@ static void fiat_25519_to_bytes(uint8_t out1[32], const uint32_t arg1[10]) {
}
/*
+ * The function fiat_25519_from_bytes does stuff.
+ * 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 ~> 0x7f]]
* Output Bounds: