Skip to content

Commit 04e57f9

Browse files
committed
RFC 8032: Avoid unnecessary doublings in precomputation
1 parent 7951b67 commit 04e57f9

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

crypto/src/math/ec/rfc8032/Ed25519.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -670,9 +670,12 @@ public static void Precompute()
670670

671671
ds[t] = PointCopy(p);
672672

673-
for (int s = 1; s < PrecompSpacing; ++s)
673+
if (b + t != PrecompBlocks + PrecompTeeth - 2)
674674
{
675-
PointDouble(p);
675+
for (int s = 1; s < PrecompSpacing; ++s)
676+
{
677+
PointDouble(p);
678+
}
676679
}
677680
}
678681

crypto/src/math/ec/rfc8032/Ed448.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -622,9 +622,12 @@ public static void Precompute()
622622

623623
ds[t] = PointCopy(p);
624624

625-
for (int s = 1; s < PrecompSpacing; ++s)
625+
if (b + t != PrecompBlocks + PrecompTeeth - 2)
626626
{
627-
PointDouble(p);
627+
for (int s = 1; s < PrecompSpacing; ++s)
628+
{
629+
PointDouble(p);
630+
}
628631
}
629632
}
630633

0 commit comments

Comments
 (0)