diff options
author | Mark Haines <mjark@negativecurvature.net> | 2016-09-13 16:45:54 +0100 |
---|---|---|
committer | Mark Haines <mjark@negativecurvature.net> | 2016-09-13 16:45:54 +0100 |
commit | 5926a8fd29ecb997e6c4609e2195e68274d1f9df (patch) | |
tree | 0792dfed9ade4caee9f359a5455e3c8c1c8d5618 /src/outbound_group_session.c | |
parent | d62e344db708672dee58238be330382b2c903b5b (diff) |
Comment on the encoding of the message counter.
Diffstat (limited to 'src/outbound_group_session.c')
-rw-r--r-- | src/outbound_group_session.c | 8 |
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; |