Double the max old ratchet list length

Attempt to mitigate Bad MAC errors due to repeated ciphertext from more
than 5 exchanges ago.
This commit is contained in:
lilia 2016-11-16 17:03:01 +01:00
parent 7bc356ac15
commit 8334fa5699
2 changed files with 6 additions and 4 deletions

View File

@ -35515,6 +35515,7 @@ Internal.ChainType = {
Internal.SessionRecord = function() {
'use strict';
var ARCHIVED_STATES_MAX_LENGTH = 40;
var OLD_RATCHETS_MAX_LENGTH = 10;
var SESSION_RECORD_VERSION = 'v1';
var StaticByteBufferProto = new dcodeIO.ByteBuffer().__proto__;
@ -35747,8 +35748,8 @@ Internal.SessionRecord = function() {
removeOldChains: function(session) {
// Sending ratchets are always removed when we step because we never need them again
// Receiving ratchets are added to the oldRatchetList, which we parse
// here and remove all but the last five.
while (session.oldRatchetList.length > 5) {
// here and remove all but the last ten.
while (session.oldRatchetList.length > OLD_RATCHETS_MAX_LENGTH) {
var index = 0;
var oldest = session.oldRatchetList[0];
for (var i = 0; i < session.oldRatchetList.length; i++) {

View File

@ -16,6 +16,7 @@ Internal.ChainType = {
Internal.SessionRecord = function() {
'use strict';
var ARCHIVED_STATES_MAX_LENGTH = 40;
var OLD_RATCHETS_MAX_LENGTH = 10;
var SESSION_RECORD_VERSION = 'v1';
var StaticByteBufferProto = new dcodeIO.ByteBuffer().__proto__;
@ -248,8 +249,8 @@ Internal.SessionRecord = function() {
removeOldChains: function(session) {
// Sending ratchets are always removed when we step because we never need them again
// Receiving ratchets are added to the oldRatchetList, which we parse
// here and remove all but the last five.
while (session.oldRatchetList.length > 5) {
// here and remove all but the last ten.
while (session.oldRatchetList.length > OLD_RATCHETS_MAX_LENGTH) {
var index = 0;
var oldest = session.oldRatchetList[0];
for (var i = 0; i < session.oldRatchetList.length; i++) {