aboutsummaryrefslogtreecommitdiff
path: root/src/megolm.c
diff options
context:
space:
mode:
authorRichard van der Hoff <richard@matrix.org>2016-05-25 15:44:39 +0100
committerRichard van der Hoff <richard@matrix.org>2016-05-25 15:44:39 +0100
commitfae8dacab5233c46f09e7d869afadaead2842609 (patch)
treea36121e294d49c4e7cf85fa5dc33eaff7e41110f /src/megolm.c
parent19a7fb5df5ec3445201ce5fbe475a08faf6319fc (diff)
Add a comment explaining Mark's latest fix
Diffstat (limited to 'src/megolm.c')
-rw-r--r--src/megolm.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/megolm.c b/src/megolm.c
index affd3cb..3395449 100644
--- a/src/megolm.c
+++ b/src/megolm.c
@@ -116,6 +116,11 @@ void megolm_advance_to(Megolm *megolm, uint32_t advance_to) {
((advance_to >> shift) - (megolm->counter >> shift)) & 0xff;
if (steps == 0) {
+ /* deal with the edge case where megolm->counter is slightly larger
+ * than advance_to. This should only happen for R(0), and implies
+ * that advance_to has wrapped around and we need to advance R(0)
+ * 256 times.
+ */
if (advance_to < megolm->counter) {
steps = 0x100;
} else {