diff --git a/src/Devices/OWSVerificationStateSyncMessage.m b/src/Devices/OWSVerificationStateSyncMessage.m index 94c40500a..04a9e1c78 100644 --- a/src/Devices/OWSVerificationStateSyncMessage.m +++ b/src/Devices/OWSVerificationStateSyncMessage.m @@ -66,6 +66,12 @@ NS_ASSUME_NONNULL_BEGIN verifiedBuilder.state = OWSVerificationStateToProtoState(self.verificationState); OWSAssert(self.paddingBytesLength != 0); + + // We add the same amount of padding in the VerificationStateSync message and it's coresponding NullMessage so that + // the sync message is indistinguishable from an outgoing Sent transcript corresponding to the NullMessage. We pad + // the NullMessage so as to obscure it's content. The sync message (like all sync messages) will be *additionally* + // padded by the superclass while being sent. The end result is we send a NullMessage of a non-distinct size, and a + // verification sync which is ~1-512 bytes larger then that. verifiedBuilder.nullMessage = [Cryptography generateRandomBytes:self.paddingBytesLength]; syncMessageBuilder.verifiedBuilder = verifiedBuilder; diff --git a/src/Messages/OWSOutgoingNullMessage.m b/src/Messages/OWSOutgoingNullMessage.m index 4aa81799d..6794fa291 100644 --- a/src/Messages/OWSOutgoingNullMessage.m +++ b/src/Messages/OWSOutgoingNullMessage.m @@ -43,6 +43,12 @@ NS_ASSUME_NONNULL_BEGIN NSUInteger contentLength = self.verificationStateSyncMessage.unpaddedVerifiedLength; OWSAssert(self.verificationStateSyncMessage.paddingBytesLength > 0); + + // We add the same amount of padding in the VerificationStateSync message and it's coresponding NullMessage so that + // the sync message is indistinguishable from an outgoing Sent transcript corresponding to the NullMessage. We pad + // the NullMessage so as to obscure it's content. The sync message (like all sync messages) will be *additionally* + // padded by the superclass while being sent. The end result is we send a NullMessage of a non-distinct size, and a + // verification sync which is ~1-512 bytes larger then that. contentLength += self.verificationStateSyncMessage.paddingBytesLength; OWSAssert(contentLength > 0)