HomePhabricator
Diffusion Comm 6b660b669592

Enhance error check in CryptoModule decrypt. Add encrypted message hash to…

Description

Enhance error check in CryptoModule decrypt. Add encrypted message hash to error message.

Summary:
This differential addresses crypto sync follow ups described there: https://linear.app/comm/issue/ENG-4886/nse-error-during-notif-decryption-bad-message-mac#comment-7b6b9979. In particular:

  1. EncryptedData is passed by reference.
  2. Error checking for olm_max_decrypt_plaintext_length is implemented.
  3. Hash of encrypted message is calculated before decryption. In the case of failure, hash of the message is appended to error message.
  4. Notifications Service Extension adds notifications id to error message notification. NOTE: it is NOT id of an entry in notifications table in MariaDB. It is the iosID field of delivery column of an entry in notifications table.

Test Plan:

  1. Build iOS app,
  2. Apply this patch to the keyserver code to send each encrypted notification twice: https://gist.github.com/marcinwasowicz/5011d3c1d5418e1a3af06f6be182e739.
  3. Send notification to iOS device.
  4. Ensure that the second notification contains the hash and id of the notification received,

Reviewers: kamil, tomek, varun

Reviewed By: kamil

Subscribers: ashoat

Differential Revision: https://phab.comm.dev/D9178

Details

Provenance
marcinAuthored on Sep 13 2023, 6:49 AM
Reviewer
kamil
Differential Revision
D9178: Enhance error check in CryptoModule decrypt. Add encrypted message hash to error message.
Parents
rCOMM2904579fc7a0: [lib] Add uuid dependency
Branches
Unknown
Tags
Unknown