signalapp / libsignal

Home to the Signal Protocol as well as other cryptographic primitives which make Signal possible.
GNU Affero General Public License v3.0
3.55k stars 415 forks source link

protocol: Deserialize archived sessions lazily instead of eagerly #351

Closed jrose-signal closed 3 years ago

jrose-signal commented 3 years ago

The only operation that touches archived sessions is decryption, and even then only in two cases: when checking to see if an incoming PreKey message matches an existing session, and after decrypting on the current session fails. Neither of those are unlikely, but they happen an order of magnitude less than normal decryptions (not to mention encryptions), so it's worth making the fast path faster.

jrose-signal commented 3 years ago

Needs a dedicated benchmark; all our current benchmarks don't deal with archived sessions.