aboutsummaryrefslogtreecommitdiff
path: root/src/CompleteEdwardsCurve
diff options
context:
space:
mode:
authorGravatar jadep <jade.philipoom@gmail.com>2016-04-14 21:26:17 -0400
committerGravatar jadep <jade.philipoom@gmail.com>2016-04-14 21:26:17 -0400
commitaddb070c83e0cd33e096f80781103db3ac883e5f (patch)
tree3ac52be6ce25f0626421c169e720daa06e7b4312 /src/CompleteEdwardsCurve
parente8f3cdec7613d26d4cd15bf2fb80e8576d4f2d62 (diff)
Retrieved updated version of Util/IterAssocOp and modified ExtendedCoordinates and Ed25519 to use it.
Diffstat (limited to 'src/CompleteEdwardsCurve')
-rw-r--r--src/CompleteEdwardsCurve/ExtendedCoordinates.v17
1 files changed, 12 insertions, 5 deletions
diff --git a/src/CompleteEdwardsCurve/ExtendedCoordinates.v b/src/CompleteEdwardsCurve/ExtendedCoordinates.v
index e918ac128..976fe59c1 100644
--- a/src/CompleteEdwardsCurve/ExtendedCoordinates.v
+++ b/src/CompleteEdwardsCurve/ExtendedCoordinates.v
@@ -219,11 +219,18 @@ Section ExtendedCoordinates.
unfold equiv, extendedPoint_eq; intros.
rewrite <-!unifiedAddM1_rep, twistedAddAssoc; auto.
Qed.
-
- Definition scalarMultM1 := iter_op unifiedAddM1 (mkExtendedPoint zero).
- Definition scalarMultM1_spec := iter_op_spec unifiedAddM1 unifiedAddM1_assoc (mkExtendedPoint zero) unifiedAddM1_0_l.
- Lemma scalarMultM1_rep : forall n P, unExtendedPoint (scalarMultM1 (N.of_nat n) P) = scalarMult n (unExtendedPoint P).
- intros; rewrite scalarMultM1_spec, Nat2N.id.
+
+ Lemma testbit_conversion_identity : forall x i, N.testbit_nat x i = N.testbit_nat ((fun a => a) x) i.
+ Proof.
+ trivial.
+ Qed.
+
+ Definition scalarMultM1 := iter_op unifiedAddM1 (mkExtendedPoint zero) N.testbit_nat.
+ Definition scalarMultM1_spec :=
+ iter_op_spec unifiedAddM1 unifiedAddM1_assoc (mkExtendedPoint zero) unifiedAddM1_0_l
+ N.testbit_nat (fun x => x) testbit_conversion_identity.
+ Lemma scalarMultM1_rep : forall n P, unExtendedPoint (scalarMultM1 (N.of_nat n) P (N.size_nat (N.of_nat n))) = scalarMult n (unExtendedPoint P).
+ intros; rewrite scalarMultM1_spec, Nat2N.id; auto.
induction n; [simpl; rewrite !unExtendedPoint_mkExtendedPoint; reflexivity|].
unfold scalarMult; fold scalarMult.
rewrite <-IHn, unifiedAddM1_rep; auto.