Repository navigation
Description
When signing, some applications may want to avoid the performance cost of dealing with the PRNG, and/or we may want to make the signing operation simpler by minimizing operations, and/or we may want to make the correctness of the signing operation easier to verify or even prove. In particular, an application switching from RSA PKCS#1 1.5 signatures to RSA-PSS signatures may want to minimize the additional performance overhead of PSS by minimizing the cost of randomizing the salt.
We can get deterministic PSS signatures by using a zero-length salt. So, one option would be to add a feature that lets the signer choose a zero-length salt instead of random digest-output-length salt, which will be the default.
However, some protocols, notably the current TLS 1.3 draft, require a digest-output-length salt. To support those cases, we should consider adding a mechanism for generating deterministic digest-output-length salts.
In the realm of "deterministic" are multiple possibilities:
- Zero-length salt: Mentioned above. The main issue is likely to be interoperability with any applications that enforce TLS 1.3 draft or other requirements about the salt length being equal to the digest length.
- Fixed salt: The salt would always be all zeros, which would be cryptographically almost exactly the same as zero-length salt.
- Nonced salt: The salt would be roughly a nonce, e.g. a counter. (This is mentioned as a possibility in RFC 3447.)
- Statically-secret-keyed salt: The salts is a function of some secret key, e.g. an AES key operated in counter mode, or the message digest encrypted with a ChaCha20 key. Whether the key is fixed per RSA private key, or varies per session, or whatever, is another variable.
- Functional salt: The salt is purely a function of some public per-signature data. MGF1 is roughly this, so I'm not sure what advantage this would have over other alternatives.
- Separately-randomized salt: A user-space DRBG is seeded from the system random source and then used for salts. The granularity of how such a DRBG is managed is a parameter, and/or if/how/when it is reseeded, would be open questions.
- Probably many more possibilities.
It may seem strange that we have so much flexibility to generate RSA-PSS signatures. In fact, it isn't completely obvious that all options are equally secure.
Adam Langley mentioned (in a conversation in the BoringSSL code review tool) that some (hypothetical? it wasn't clear) applications may depend on being able to sign the same data twice with differing resultant signatures. His example was e.g. if you encrypt some data in such a way that the ciphertext is randomized, and then a cleartext RSA-PSS signature of the plaintext, somebody would be able to see that two encrypted values have the same plaintext because the signatures are equal, even though they were encrypted in a way where the encryption doesn't leak that fact. Personally, I am skeptical that this is a use case that we should support, especially for RSA, where people are almost universally using PKCS#1 1.5 signatures, which are 100% deterministic.
As far as mathematical arguments go, there are quite a few arguments (of as-yet-undetermined accuracy or quality) in favor of the argument that the randomization of the salts does not offer any significant security benefit, at least within the threat model where signature schemes are typically evaluated:
- Optimal Security Proofs for Full Domain Hash, Revisited: "However, since PSS (with random salt of arbitrary length) is at least as secure as FDH, we obtain as a corollary from Section 3 a tight security proof from lossiness to the security of PSS, with random salt of arbitrary (possibly zero) length."
- Efficiency Improvements for Signature Schemes
with Tight Security Reductions: "We show a variant of PSS which avoids the random salt altogether yet has an equally-tight security reduction." - Another Look at “Provable Security”, section "A Variant of PSS".
- Another Look at “Provable Security” II: Section "The implausible magic of one bit"
- http://www5.rz.rub.de:8032/mam/foc/content/publ/rsa-fdh_fullversion.pdf
- https://eprint.iacr.org/2015/517.pdf - Section 4.2
- http://crypto.stackexchange.com/questions/1217/rsa-pss-salt-size.
However, there are also some counter-arguments in favor of randomized RSA-PSS salt:
- How Risky is the Random Oracle Model?: “While RSA-KW has a much better security reduction than RSA-FDH, there are essentially the same attacks on both RSA-KW and RSA-FDH as soon as there are defects in the full-domain hash. On the other hand, RSA-PSS with a large salt seems more robust than all other paddings, especially if one uses h(r||m) instead of h(m||r). This differs from the conclusion of [38], where it was argued that RSA-FDH was the best method known to sign with RSA.”
More support of randomized signatures: Making RSA-PSS Provably Secure Against Non-Random Faults, which also cites other work on the benefits of PSS-style randomization regarding fault attacks. However, it isn't clear that PSS benefits us much regarding fault attacks given that we already verify the result of the modular exponentiation x = nd (mod n) by verifying xe (mod n). (ring actually always use the CRT for the private-key exponentiation, but that doesn't matter much here).
@DemiMarie suggested in the general RSA-PSS signing issue:
One thought might be to do what deterministic DSA and ECDSA implementations
(which leak the private key if the ephemeral key is not.
random) do and generate the salt from the private key and message. We know
that the private key has enough entropy, so we just need to assume a PDF
that is good.
Something similar was also suggested by somebody else.
See also:
- The IETF TLS WG mailing list thread I started on the issue: [TLS] TLS 1.3: Deterministic RSA-PSS and ECDSA.
- The prototype patch for fixed-zero-filled RSA-PSS salts for BoringSSL, which will probably get rejected: Make RSA-PSS signing deterministic.
We should try to find more positive results regarding the security of full-domain-hash (FDH) signatures and/or more positive results for minimally-randomized signatures (e.g. the K-W signature scheme that "The implausible magic of one bit" above refers to).
Activity
briansmith commentedon Aug 12, 2016
Note that because we always use RSA blinding, we're always invoking the random number generator for RSA PKCS#1 1.5 and RSA-PSS signature generation. It seems unlikely we'll change that any time soon, so in some sense we're not going to get a huge benefit in terms of analysis or code elimination by avoiding the PRNG for PSS salt. Still, I think minimizing the cost and complexity of RSA-PSS is a good goal that's worth working towards.
briansmith commentedon Aug 12, 2016
See also Is Extended Random A Malicious NSA Plot?. Note that RSA-PSS predates draft-rescorla-tls-opaque-prf-input by several years.
briansmith commentedon Aug 16, 2016
Somewhat related: https://eprint.iacr.org/2016/567.pdf
briansmith commentedon Aug 16, 2016
Somewhat related: https://eprint.iacr.org/2016/191.pdf - Makes the good point that we need to consider multi-user security, not just single-user security.
briansmith commentedon Aug 16, 2016
S. Galbraith, J. Malone-Lee, and N. P. Smart. Public key signatures in the multi-user setting. Information
Processing Letters, 83(5):263–266, 2002. 6
burdges commentedon Aug 21, 2016
Isn't the$+ r (y -y')$ defense proposed by the non-random faults paper cheap, assuming you're already verifying the modular exponentiation anyways? And thank you for bringing that paper to my attention. :)
burdges commentedon Aug 22, 2016
I forget if I mentioned this previously but RSA blind signatures need a FDH rather than a randomized scheme, like PSS. I simply chose to key the FDH that Taler pulls from GNUNet's src/util/crypto_rsa.c off the signer's RSA public key, thus preventing a forger from seeing an FDH for the same plaintext signed by different denomination signing keys.
Isn't a deterministic PSS kinda just a hash? If so, one should probably adopt FDH over PSS if one wants deterministic signing, right? I think Rogaway's original description of PSS zeros a high bit or something, so a deterministic PSS is not an FDH. I doubt that high bit matters against forger adversaries, but I found a weak deanonymization attack against RSA blind signatures whose hash lacks the high bit.
Also, Remark 2 on page 8 of "Making RSA-PSS Provably Secure Against Non-Random Faults" recommends roughly rho = log2(p*q)/2 + 200 bits, but argues that much smaller rho should be safe. I'm now wondering if simply taking rho = 512 bits as a constant might be the safest thing, as an adversary could maybe launch a fault attack against rho itself.
I just started a discussion on the gcrypt-devel mailing list too, btw.
briansmith commentedon Aug 22, 2016
Interesting. I can't get your patch from the mailing list archive. Can you email it to me?: [email protected]. Thanks!
burdges commentedon Aug 24, 2016
I found the article A New RSA-CRT Algorithm Resistant to Powerful Fault Attacks by two Certicom guys, which provides the same sort of fault protections with an interesting randomized CRT algorithm. It seemingly gives stronger protections against timing attacks, etc., even if fault attacks prove not to be realistic.
This is probably more the sort of thing one should be doing. It appears the random numbers injected should be quite small, making this scheme fairly fast. This particular paper however only really focuses on fault attacks. It would be good to see the same scheme evaluated for timing attack protections though, as folks understandably care way more about timing than about fault attacks.
burdges commentedon Sep 1, 2016
Appears Rowhammer just got better :
http://arstechnica.com/security/2016/08/new-attack-steals-private-crypto-keys-by-corrupting-data-in-computer-memory/
DemiMarie commentedon Sep 2, 2016
Yikes. Sounds like affected DRAM needs to be recalled and replaced. Or
deduplication disabled.
On Sep 1, 2016 6:52 PM, "Jeff Burdges" [email protected] wrote:
briansmith commentedon Sep 2, 2016
If there is concern that the protections against fault attacks like rowhammer in ring aren't sufficient, let's discuss that in another issue.
briansmith commentedon Nov 22, 2016
https://www.iacr.org/archive/eurocrypt2008/49650070/49650070.pdf
briansmith commentedon Nov 22, 2016
Another approach, although the specific technique seems impractical: http://markus-jakobsson.com/papers/jakobsson-dasc06.pdf
briansmith commentedon Dec 3, 2018
See https://eprint.iacr.org/2018/855, which gives some evidence that a deterministic PSS is probably A-OK since PKCS#1 1.5 seems better than originally thought. See also https://www.schneier.com/blog/archives/2018/09/evidence_for_th.html: "I don't think the protocol is "provably secure," meaning that it cannot have any vulnerabilities. What this paper demonstrates is that there are no vulnerabilities under the model of the proof. And, more importantly, that PKCS #1 v1.5 is as secure as any of its successors like RSA-PSS and RSA Full-Domain."
burdges commentedon Dec 3, 2018
Interesting, but what benefits do deterministic RSA signatures bring?
Afaik, deterministic RSA signatures are desirable for either blind signatures and as verifiable random functions (VRFs). I doubt either application benefits from compatibility with legacy padding:
If you want a VRF then you're likely doing some consensus protocol, but consensus protocols would never be tied to any legacy crypto. Instead, you'll choose between either some faster elliptic curves scheme, like NSEC5, VEd25519, etc. or else BLS for extreme aggregation.
In blind signatures, the blinding factor must be produced by a full domain hash. If you take a 2047 bit blinding factor on a 2048 bit RSA key, then you miss one roughly one third of the blinding factors, and you can be deanonymized. You might still use PKCS#1 v1.5 for the signature itself, but blind signatures normally require verifier logic that prevents double spending, which costs dramatically more than anything else. I therefore think the scheme designer should normally choose the same full domain hash for the signature itself because they control the verifiers and extra costs is negligible. There are situations without double spending protection, like maybe the signing keys have very short lifespans, or maybe signer is selling forged certificates.