Rotate incremental MAC proto field.
This commit is contained in:
parent
af063b2e9e
commit
8e05fe3b0c
3 changed files with 6 additions and 6 deletions
|
@ -27,7 +27,7 @@ public final class AttachmentPointerUtil {
|
||||||
pointer.width != null ? pointer.width : 0,
|
pointer.width != null ? pointer.width : 0,
|
||||||
pointer.height != null ? pointer.height : 0,
|
pointer.height != null ? pointer.height : 0,
|
||||||
pointer.digest != null ? Optional.of(pointer.digest.toByteArray()) : Optional.empty(),
|
pointer.digest != null ? Optional.of(pointer.digest.toByteArray()) : Optional.empty(),
|
||||||
pointer.incrementalDigest != null ? Optional.of(pointer.incrementalDigest.toByteArray()) : Optional.empty(),
|
pointer.incrementalMac != null ? Optional.of(pointer.incrementalMac.toByteArray()) : Optional.empty(),
|
||||||
pointer.incrementalMacChunkSize != null ? pointer.incrementalMacChunkSize : 0,
|
pointer.incrementalMacChunkSize != null ? pointer.incrementalMacChunkSize : 0,
|
||||||
pointer.fileName != null ? Optional.of(pointer.fileName) : Optional.empty(),
|
pointer.fileName != null ? Optional.of(pointer.fileName) : Optional.empty(),
|
||||||
((pointer.flags != null ? pointer.flags : 0) & FlagUtil.toBinaryFlag(AttachmentPointer.Flags.VOICE_MESSAGE.getValue())) != 0,
|
((pointer.flags != null ? pointer.flags : 0) & FlagUtil.toBinaryFlag(AttachmentPointer.Flags.VOICE_MESSAGE.getValue())) != 0,
|
||||||
|
@ -49,7 +49,7 @@ public final class AttachmentPointerUtil {
|
||||||
.uploadTimestamp(attachment.getUploadTimestamp());
|
.uploadTimestamp(attachment.getUploadTimestamp());
|
||||||
|
|
||||||
if (attachment.getIncrementalDigest().isPresent()) {
|
if (attachment.getIncrementalDigest().isPresent()) {
|
||||||
builder.incrementalDigest(ByteString.of(attachment.getIncrementalDigest().get()));
|
builder.incrementalMac(ByteString.of(attachment.getIncrementalDigest().get()));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (attachment.getIncrementalMacChunkSize() > 0) {
|
if (attachment.getIncrementalMacChunkSize() > 0) {
|
||||||
|
|
|
@ -41,7 +41,7 @@ class DigestingRequestBody(
|
||||||
override fun writeTo(sink: BufferedSink) {
|
override fun writeTo(sink: BufferedSink) {
|
||||||
val digestStream = ByteArrayOutputStream()
|
val digestStream = ByteArrayOutputStream()
|
||||||
val inner = SkippingOutputStream(contentStart, sink.outputStream())
|
val inner = SkippingOutputStream(contentStart, sink.outputStream())
|
||||||
val isIncremental = outputStreamFactory is AttachmentCipherOutputStreamFactory && INCREMENTAL_MAC_SENDING_ENABLED
|
val isIncremental = outputStreamFactory is AttachmentCipherOutputStreamFactory
|
||||||
val sizeChoice: ChunkSizeChoice = ChunkSizeChoice.inferChunkSize(contentLength.toInt())
|
val sizeChoice: ChunkSizeChoice = ChunkSizeChoice.inferChunkSize(contentLength.toInt())
|
||||||
val outputStream: DigestingOutputStream = if (isIncremental) {
|
val outputStream: DigestingOutputStream = if (isIncremental) {
|
||||||
(outputStreamFactory as AttachmentCipherOutputStreamFactory).createIncrementalFor(inner, contentLength, sizeChoice, digestStream)
|
(outputStreamFactory as AttachmentCipherOutputStreamFactory).createIncrementalFor(inner, contentLength, sizeChoice, digestStream)
|
||||||
|
@ -95,6 +95,5 @@ class DigestingRequestBody(
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
const val TAG = "DigestingRequestBody"
|
const val TAG = "DigestingRequestBody"
|
||||||
const val INCREMENTAL_MAC_SENDING_ENABLED = false
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -675,7 +675,8 @@ message AttachmentPointer {
|
||||||
optional uint32 size = 4;
|
optional uint32 size = 4;
|
||||||
optional bytes thumbnail = 5;
|
optional bytes thumbnail = 5;
|
||||||
optional bytes digest = 6;
|
optional bytes digest = 6;
|
||||||
optional bytes incrementalDigest = 16;
|
reserved 16;
|
||||||
|
optional bytes incrementalMac = 18;
|
||||||
optional uint32 incrementalMacChunkSize = 17;
|
optional uint32 incrementalMacChunkSize = 17;
|
||||||
optional string fileName = 7;
|
optional string fileName = 7;
|
||||||
optional uint32 flags = 8;
|
optional uint32 flags = 8;
|
||||||
|
@ -685,7 +686,7 @@ message AttachmentPointer {
|
||||||
optional string blurHash = 12;
|
optional string blurHash = 12;
|
||||||
optional uint64 uploadTimestamp = 13;
|
optional uint64 uploadTimestamp = 13;
|
||||||
optional uint32 cdnNumber = 14;
|
optional uint32 cdnNumber = 14;
|
||||||
// Next ID: 18
|
// Next ID: 19
|
||||||
}
|
}
|
||||||
|
|
||||||
message GroupContext {
|
message GroupContext {
|
||||||
|
|
Loading…
Add table
Reference in a new issue