Fix bad mac on repeated deliveries

`MessageCounterError` is the expected result of repeated deliveries.
Error handling in decryptWithSessionList should immediately return such
an error if it occurs. Previous to this change, a Bad MAC error to be
returned instead of a MessageCounterError, if the message in question
was encrypted for a closed session.
This commit is contained in:
lilia 2017-03-27 17:01:55 -07:00
parent 3c0d6dc24b
commit b01ac22eb9
2 changed files with 8 additions and 0 deletions

View File

@ -36176,6 +36176,10 @@ SessionCipher.prototype = {
return this.doDecryptWhisperMessage(buffer, session).then(function(plaintext) {
return { plaintext: plaintext, session: session };
}).catch(function(e) {
if (e.name === 'MessageCounterError') {
return Promise.reject(e);
}
errors.push(e);
return this.decryptWithSessionList(buffer, sessionList, errors);
}.bind(this));

View File

@ -124,6 +124,10 @@ SessionCipher.prototype = {
return this.doDecryptWhisperMessage(buffer, session).then(function(plaintext) {
return { plaintext: plaintext, session: session };
}).catch(function(e) {
if (e.name === 'MessageCounterError') {
return Promise.reject(e);
}
errors.push(e);
return this.decryptWithSessionList(buffer, sessionList, errors);
}.bind(this));