Skip to content

Padding implementation is not constant-time #626

@tarcieri

Description

@tarcieri

This is a followup to #19, which was originally about the modular exponentiation implementation not being constant-time, and also became our general tracking issue for the subsequent Marvin Attack.

We've gone to great lengths in crypto-bigint to produce the closest thing we can to a constant-time implementation of modular exponentiation, and while we still need to e.g. verify that's truly the case via static analysis tooling, based on the latest analysis from the Marvin Toolkit it seems like the remaining sidechannels in our implementation are probably no longer coming from crypto-bigint, but are instead in this crate's implementation of RSA padding modes.

PKCS#1 v1.5 in particular notably has a long history of sidechannels going back to Bleichenbacher's original 1998 attack, and attacks like Marvin can be seen as an evolution of that attack.

This I-D contains guidance for implementing RSA in constant-time, including things like handling depadding errors using strategies like implicit rejection:

https://datatracker.ietf.org/doc/draft-irtf-cfrg-rsa-guidance/

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions