The half predicate of RSA #
Boneh and Shoup's Exercise 12.21 ("Baby Bleichenbacher attack", [BS23], pp. 519–520)
considers, for a residue x modulo n, the predicate P_x(r) that is 1 when x · r mod n,
treated as an integer in [0, n), exceeds n / 2. Part (a) asks to learn x from about
log₂ n values of P_x; part (b) asks to recover the e-th root of c from an oracle that says
whether the e-th root of its input exceeds n / 2.
Here the predicate is written decide (N < 2 * y), which is y > N / 2 over the reals. For odd
N and y < N, it equals the parity of 2 * y % N, so P_x(2 ^ k) is the parity of
2 ^ (k + 1) * x % N. These are the bits from which lsbRecover recovers x
(lsbRecover_map_decide_lt_two_mul, part (a)). For part (b), halfToLSBPredictor H asks a half
oracle H about y * ((N + 1) / 2) ^ e % N, the RSA image of half the preimage of y. For odd
N, half of w exceeds N / 2 exactly when w is odd, so halfToLSBPredictor H predicts the
least significant bit and lsbInverter inverts RSA with it. By
lsbInverter_halfToLSBPredictor, the inverter on y = w ^ e % N calls H at
2 ^ (k * e) * y % N, the RSA images of 2 ^ k * w % N, for k < N.size, and returns
lsbRecover of the answers: part (a) at the points r = 2 ^ k.
Part (a) needs an odd modulus: for the modulus 6 = 2 * 3, P_0 and P_3 agree at every point.
The inverter of part (b) needs one because halving needs 2 to be invertible modulo N.
The efficiency certificate is relative, as for isPPT_lsbInverter: the inverter is PPT whenever
H is. Under RSAOneWay and eventually odd moduli no always-correct H is PPT
(RSAOneWay.not_frequently_alwaysCorrect_halfPredictor), so the certificate does not count the
work of an oracle that holds the secret key. The inverter is not stated as an oracle program with
a query bound.
Main definitions #
Cslib.Crypto.halfToLSBPredictor: a half predictor precomposed with halving, as a least-significant-bit predictor.
Main results #
Cslib.Crypto.lsbRecover_map_decide_lt_two_mul: part (a), for oddN ≤ 2 ^ m, the half predicate at2 ^ 0, …, 2 ^ (m - 1)determinesx < NthroughlsbRecover.Cslib.Crypto.lsbInverter_halfToLSBPredictor: for oddN, the inverter built fromHcallsHat2 ^ (k * e) * y % N,k < N.size, in order, and returnslsbRecoverof the answers.Cslib.Crypto.eval_halfToLSBPredictor: a half predictor that is correct on every RSA image modulo an oddNgives a correct least-significant-bit predictor.Cslib.Crypto.succProbability_rsaInversionGame_halfToLSBPredictor: part (b), the inverterlsbInverter (halfToLSBPredictor H)wins the RSA inversion experiment with probability1.Cslib.Crypto.isPPT_halfToLSBPredictor:halfToLSBPredictor His PPT wheneverHis.Cslib.Crypto.RSAOneWay.not_frequently_alwaysCorrect_halfPredictor: underRSAOneWayon eventually odd moduli, no PPT half predictor is always correct on infinitely many parameters.
References #
- D. Boneh, V. Shoup, A Graduate Course in Applied Cryptography, Version 0.6, Exercise 12.21 (pp. 519–520).
Exercise 12.21(a) ([BS23], p. 519): for odd N with N ≤ 2 ^ m and x < N,
the values of the half predicate P_x(r) = [x * r % N > N / 2] at r = 2 ^ 0, …, 2 ^ (m - 1)
determine x, which lsbRecover computes from them.
A half predictor as a least-significant-bit predictor: on y, ask the half predictor H
about y * ((N + 1) / 2) ^ e % N, which is the RSA image of half the preimage of y modulo
odd N.
Where the inverter asks the half oracle. For odd N, lsbInverter (halfToLSBPredictor H)
on y calls H at the residues 2 ^ (k * e) * y % N for k = 0, …, N.size - 1, in this order,
and returns lsbRecover N N.size of the answers, reduced modulo N. When y = w ^ e % N, these
residues are the RSA images of 2 ^ k * w % N (two_pow_mul_rsaEval).
If H says correctly, on every RSA image modulo an odd N, whether the preimage exceeds
N / 2, then halfToLSBPredictor H predicts the least significant bit of the preimage
correctly.
Exercise 12.21(b) ([BS23], pp. 519–520): if the moduli of gen n are odd and
H says correctly, on every RSA image, whether the e-th root exceeds N / 2, then the inverter
lsbInverter (halfToLSBPredictor H) recovers the e-th root with probability 1. It asks H
about the RSA images of 2 ^ k * x % N for k < N.size, part (a)'s points
(lsbInverter_halfToLSBPredictor). The pointwise form, every challenge inverted, is
eval_lsbInverter applied to eval_halfToLSBPredictor.
halfToLSBPredictor H is PPT whenever H is: the halving step
y ↦ y * ((N + 1) / 2) ^ e % N is computable in polynomial time.
Under RSAOneWay gen and eventually odd moduli, no uniform strict-PPT predictor says with
certainty, on every RSA image modulo N, whether the preimage exceeds N / 2, for infinitely many
security parameters. This is the hardness reading of isPPT_halfToLSBPredictor: no
polynomial-time algorithm computes the half predicate of the RSA preimage exactly from the public
key. It is not part (b), whose oracle may hold the secret key.