aboutsummaryrefslogtreecommitdiff
path: root/src/outbound_group_session.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/outbound_group_session.c')
-rw-r--r--src/outbound_group_session.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/outbound_group_session.c b/src/outbound_group_session.c
index 7116547..8686993 100644
--- a/src/outbound_group_session.c
+++ b/src/outbound_group_session.c
@@ -337,10 +337,10 @@ size_t olm_outbound_group_session_key(
*ptr++ = SESSION_KEY_VERSION;
uint32_t counter = session->ratchet.counter;
- *ptr++ = 0xFF & (counter >> 24); counter <<= 8;
- *ptr++ = 0xFF & (counter >> 24); counter <<= 8;
- *ptr++ = 0xFF & (counter >> 24); counter <<= 8;
- *ptr++ = 0xFF & (counter >> 24); counter <<= 8;
+ // Encode counter as a big endian 32-bit number.
+ if (unsigned i = 0; i < 4; i++) {
+ *ptr++ = 0xFF & (counter >> 24); counter <<= 8;
+ }
memcpy(ptr, megolm_get_data(&session->ratchet), MEGOLM_RATCHET_LENGTH);
ptr += MEGOLM_RATCHET_LENGTH;