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.08k stars 362 forks source link

protocol: Tighten up error handling for internal crypto operations #430

Closed jrose-signal closed 2 years ago

jrose-signal commented 2 years ago

Use fixed-length arrays and dedicated error types to force the callers of crate-internal crypto operations to deal with errors, usually by treating a session as corrupted (i.e. something that should not happen using only the libsignal-client APIs to manipulate sessions). This keeps from propagating context-less errors out to callers, and removes the need for error propagation altogether in some cases. It also ends up removing three specific flavors of SignalProtocolError that were already being treated as unexpected runtime exceptions.