The Computational and Decisional Diffie–Hellman assumptions #
Over a PrimeOrderGroupFamily, the Computational Diffie–Hellman (CDH) game ([BS23],
Attack Game 10.5) draws public group parameters d from a setup law and runs the fixed-group
experiment Cslib.Crypto.cdhExperiment in F.Carrier d: the adversary receives a • g and b • g
(the textbook g^a and g^b) and wins when it outputs (a * b) • g. The Decisional
Diffie–Hellman (DDH) games ([BS23], Attack Game 10.6) likewise run
Cslib.Crypto.ddhRealExperiment and Cslib.Crypto.ddhRandomExperiment.
Adversaries receive and return group elements. Their efficiency is stated on encodings:
CDHAdversary.IsPPT and DDHDistinguisher.IsPPT ask for one uniform strict PPT machine that reads
encCDHInput or encDDHInput (the unary security parameter, group parameters and encoded
elements) and writes the encoding of the adversary's output. encCDHInput_apply and
encDDHInput_apply give the word layouts.
A distinguisher outputs a bit, so DDH is the same assumption as its word-level form over
distinguishers that read the encoded tuple (ddh_iff_encoded). A CDH adversary must output a group
element, whereas a word-level adversary may output any word. CDH, and hence the conclusion of
DDH.cdh, is therefore the textbook assumption, which is weaker than the word-level CDH assumption;
CslibFrontier.Crypto.Computational.DiffieHellman.Decodable restores the word-level form and
equivalence CDH ↔ WordCDH for DecodablePrimeOrderGroupFamily (#4783).
We prove the implications DDH ⇒ CDH ⇒ DiscreteLog between the assumptions from the fixed-group
bounds Cslib.Crypto.dlAdvantage_le_cdhAdvantage_dlToCDH and
Cslib.Crypto.probability_ddhRandomExperiment_cdhToDDH_le. We also prove the random
self-reducibility of DDH ([BS23], Section 10.11, Exercises 10.8–10.10, pp. 425–426): the
distributional rerandomisation lemma (ddhRerandomizeLaw_real, ddhRerandomizeLaw_random), its
efficient form ddhSelfReduceDistinguisher, average-case DDH from worst-case DDH with instances
that may depend on the distinguisher (ddh_of_worstCase), and a Chernoff-amplified decider
ddhAmplifiedDecider that turns a distinguisher with inverse-polynomial advantage into one that
decides every triple except with negligible error. The Diffie–Hellman assumptions are hypotheses,
not theorems.
Main definitions #
Cslib.Crypto.PrimeOrderGroupFamily.CDHInput,Cslib.Crypto.PrimeOrderGroupFamily.DDHInput: the inputs of CDH adversaries and DDH distinguishers.Cslib.Crypto.PrimeOrderGroupFamily.encCDHInput,Cslib.Crypto.PrimeOrderGroupFamily.encDDHInput: their encodings, with layouts given by the generatedencCDHInput_applyandencDDHInput_apply.Cslib.Crypto.PrimeOrderGroupFamily.CDHAdversary,Cslib.Crypto.PrimeOrderGroupFamily.CDHAdversary.IsPPT,Cslib.Crypto.PrimeOrderGroupFamily.cdhGame,Cslib.Crypto.PrimeOrderGroupFamily.CDH: the Computational Diffie–Hellman game and assumption.Cslib.Crypto.PrimeOrderGroupFamily.dlToCDHAdversary: the reduction from discrete logarithm to CDH.Cslib.Crypto.PrimeOrderGroupFamily.DDHDistinguisher,Cslib.Crypto.PrimeOrderGroupFamily.DDHDistinguisher.IsPPT,Cslib.Crypto.PrimeOrderGroupFamily.ddhRealGame,Cslib.Crypto.PrimeOrderGroupFamily.ddhRandomGame,Cslib.Crypto.PrimeOrderGroupFamily.DDH: the real and random Decisional Diffie–Hellman games and assumption.Cslib.Crypto.PrimeOrderGroupFamily.cdhToDDHDistinguisher: the reduction from CDH to DDH.Cslib.Crypto.PrimeOrderGroupFamily.ddhRerandomize,Cslib.Crypto.PrimeOrderGroupFamily.ddhRerandomizeLaw: DDH triple rerandomisation ([BS23], Exercises 10.8–10.9, pp. 425–426).Cslib.Crypto.PrimeOrderGroupFamily.sampleExp: approximate uniform exponent sampling moduloF.order dviaProbComp.sampleModNatwith statistical distance at most1 / 2 ^ n.Cslib.Crypto.PrimeOrderGroupFamily.ddhSelfReduceDistinguisher: the efficient DDH random self-reduction.Cslib.Crypto.PrimeOrderGroupFamily.ddhRerandomizeGame,Cslib.Crypto.PrimeOrderGroupFamily.ddhWorstCaseGame: rerandomised and worst-case DDH games on fixed triple families.Cslib.Crypto.PrimeOrderGroupFamily.ddhAmplifiedDecider: the Chernoff-amplified worst-case DDH decider ([BS23], Exercise 10.10, p. 426).
Main results #
Cslib.Crypto.PrimeOrderGroupFamily.ddh_iff_encoded:DDHis the word-level DDH assumption.Cslib.Crypto.PrimeOrderGroupFamily.succProbability_discreteLogGame_le_cdhGame,Cslib.Crypto.PrimeOrderGroupFamily.CDH.discreteLog:CDHimpliesDiscreteLog.Cslib.Crypto.PrimeOrderGroupFamily.succProbability_cdhGame_le_advantage_ddh_add,Cslib.Crypto.PrimeOrderGroupFamily.DDH.cdh,Cslib.Crypto.PrimeOrderGroupFamily.DDH.discreteLog:DDHimpliesCDHandDiscreteLogwhen1 / qis negligible.Cslib.Crypto.PrimeOrderGroupFamily.ddhRerandomizeLaw_real,Cslib.Crypto.PrimeOrderGroupFamily.ddhRerandomizeLaw_random: the distributional rerandomisation lemma for DDH tuples ([BS23], Exercises 10.8–10.9, pp. 425–426).Cslib.Crypto.PrimeOrderGroupFamily.isPPT_ddhSelfReduceDistinguisher,Cslib.Crypto.PrimeOrderGroupFamily.advantage_ddhRerandomizeLaw_ddhSelfReduceDistinguisher_le: the self-reduction is PPT and loses at most3 / 2 ^ nagainst exact rerandomisation.Cslib.Crypto.PrimeOrderGroupFamily.DDH.ddhRerandomizeGame: underDDH, rerandomised real and non-DDH triple families are indistinguishable.Cslib.Crypto.PrimeOrderGroupFamily.advantage_ddhRealGame_le_ddhWorstCaseGame,Cslib.Crypto.PrimeOrderGroupFamily.ddh_of_worstCase: worst-case DDH impliesDDHwith loss6 / 2 ^ n, where the hard instances may depend on the distinguisher.Cslib.Crypto.PrimeOrderGroupFamily.isPPT_ddhAmplifiedDecider,Cslib.Crypto.PrimeOrderGroupFamily.ddhAmplifiedDecider_error_le_pow,Cslib.Crypto.PrimeOrderGroupFamily.negligible_ddhAmplifiedDecider_error: the amplified decider is PPT and errs on every triple with probability at most(1 / 2) ^ n.
References #
- D. Boneh, V. Shoup, A Graduate Course in Applied Cryptography, Version 0.6, Section 10.5 (Attack Games 10.5–10.6, pp. 409–410) and Section 10.11 (Exercises 10.7–10.10, pp. 425–426).
Adversary inputs and their encodings #
The input of a CDH adversary: the security parameter, public group parameters d and two
elements of F.Carrier d, which are a • g and b • g in the experiment.
- secParam : ℕ
The security parameter, given to machines in unary.
- groupParameters : F.Desc
Public parameters selecting the group, its prime order and generator within the family. For Schnorr groups these contain the modulus
p, subgroup orderqand generatorg. - leftPublic : F.Carrier self.groupParameters
The first public element,
a • gin the experiment. - rightPublic : F.Carrier self.groupParameters
The second public element,
b • gin the experiment.
The input of a DDH distinguisher: a CDH input and a candidate shared element, which is
(a * b) • g in the real experiment and an independent c • g in the random one.
- groupParameters : F.Desc
The encoding of a CDH input: the unary security parameter, the group parameters and the words
F.encode d u, F.encode d v of the public elements, each framed except the last
(encCDHInput_apply).
The encoding of a DDH input: the fields of its CDH input followed by the word of the candidate
shared element, each framed except the last (encDDHInput_apply).
The encoded identity of computed group parameters, computed as 0 • g.
The encoded sum of computed elements.
The encoded multiple of a computed element by a computed natural number.
The encoded negation of a computed element, computed as (q - 1) • x for the group order
q.
The encoded difference of computed elements.
The encoding of a computed choice between computed elements.
Computational Diffie–Hellman (CDH) #
A CDH adversary over the family: given the security parameter, public group parameters d
and two elements of F.Carrier d, it outputs an element of F.Carrier d. CDHAdversary.IsPPT
states its efficiency on encodings.
A CDH adversary is PPT when one uniform strict PPT machine reads encCDHInput and writes the
encoding of the adversary's output element.
The Computational Diffie–Hellman experiment ([BS23], Attack Game 10.5): choose
group parameters d using the arbitrary setup law, then run Cslib.Crypto.cdhExperiment in the
group F.Carrier d. No efficient sampler for setup is required.
The Computational Diffie–Hellman assumption for a family and a setup law: every PPT CDH
adversary wins cdhGame with negligible probability. It is [BS23], Attack Game 10.5 and
Definition 10.7 (pp. 409–410), read asymptotically as in Section 10.5.2 (pp. 413–414). The group
parameters are drawn from setup, which need not be efficiently samplable, whereas the source
draws them with an efficient system parameterization algorithm (Definition 10.9, p. 413); the
assumption is the source's only for setup laws that an efficient algorithm samples, as for
DiscreteLog.
The fixed-group discrete-logarithm adversary run by a word-level one: encode the instance,
run the word-level adversary and read its output as a binary exponent, as discreteLogGame
does.
discreteLogGame averages Cslib.Crypto.dlExperiment of discreteLogAdversary over the
setup law.
Turn a word-level discrete-logarithm adversary into a CDH adversary: run
Cslib.Crypto.dlToCDH on its discreteLogAdversary.
Whenever the discrete-logarithm adversary recovers α, dlToCDHAdversary outputs the
Diffie–Hellman shared element.
The discrete-logarithm-to-CDH reduction is uniform strict PPT when the discrete-logarithm adversary is.
CDH implies the discrete-logarithm assumption.
Decisional Diffie–Hellman (DDH) #
A DDH distinguisher over the family: given the security parameter, public group parameters
d and three elements of F.Carrier d, it outputs a bit. DDHDistinguisher.IsPPT states its
efficiency on encodings.
A DDH distinguisher is PPT when one uniform strict PPT machine reads encDDHInput and writes
the distinguisher's output bit.
The real DDH game ([BS23], Attack Game 10.6, Experiment 0): choose group parameters
d using the arbitrary setup law, then run Cslib.Crypto.ddhRealExperiment in F.Carrier d.
The random DDH game ([BS23], Attack Game 10.6, Experiment 1): choose group
parameters d using the arbitrary setup law, then run Cslib.Crypto.ddhRandomExperiment in
F.Carrier d.
The Decisional Diffie–Hellman assumption for a family and a setup law: every PPT DDH
distinguisher has negligible advantage between ddhRealGame and ddhRandomGame. It is
[BS23], Attack Game 10.6 and Definition 10.8 (pp. 410–411), read asymptotically as in
Section 10.5.2 (pp. 413–414). The group parameters are drawn from setup, which need not be
efficiently samplable, whereas the source draws them with an efficient system parameterization
algorithm (Definition 10.9, p. 413); the assumption is the source's only for setup laws that an
efficient algorithm samples, as for DiscreteLog.
A PPT DDH distinguisher run on computed inputs is uniform strict PPT.
DDH is the word-level DDH assumption. Quantifying over distinguishers that read the
encoded tuple (1ⁿ, d, encode u, encode v, encode w) as words, each with one uniform strict PPT
machine on its flat layout, gives the same assumption as quantifying over typed distinguishers.
A typed distinguisher's machine reads exactly that layout; conversely, a word distinguisher is
typed by encoding its elements, and a typed one is a word distinguisher on that layout run on the
encoded elements (IsPPTOn.exists_bool_factor), since its output is a single bit.
Turn a CDH adversary into a DDH distinguisher by running Cslib.Crypto.cdhToDDH in each
group.
In the real DDH game, cdhToDDHDistinguisher runs the CDH game.
In the random DDH game, cdhToDDHDistinguisher accepts with probability at most 1 / m
whenever every supported group order is at least m > 0.
Quantitative reduction from CDH to DDH: when every supported group at parameter n has
order at least m > 0, any CDH adversary's success probability is at most the DDH distinguishing
advantage of cdhToDDHDistinguisher plus 1 / m.
The CDH-to-DDH reduction is uniform strict PPT when the CDH adversary is.
DDH implies CDH when every supported group at parameter n has order at least m n > 0
and 1 / m n is negligible. The conclusion is the textbook CDH assumption against adversaries that
output group elements, which is weaker than the word-level CDH assumption in general; see
DecodablePrimeOrderGroupFamily.DDH.wordCDH in
CslibFrontier.Crypto.Computational.DiffieHellman.Decodable for decodable families.
DDH implies the discrete-logarithm assumption when every supported group at parameter n
has order at least m n > 0 and 1 / m n is negligible.
Random self-reducibility of DDH #
Algebraic action of ddhRerandomize on multiples of the generator: a tuple error
γ - α * β is scaled by r and added to the new Diffie–Hellman product
(r * α + s₁) * (β + s₂).
The re-randomized triple distribution obtained by drawing r, s₁, s₂ : ZMod (F.order d)
independently and uniformly.
The real DDH tuple distribution on F.Carrier d.
The random DDH tuple distribution on F.Carrier d: the triple that
Cslib.Crypto.ddhRandomExperiment gives its distinguisher.
Random self-reducibility of DDH (real case): re-randomizing any fixed real DDH tuple
(α • g, β • g, (α * β) • g) yields the exact uniform real DDH tuple distribution.
Random self-reducibility of DDH (random case): re-randomizing any fixed non-DDH tuple
(α • g, β • g, γ • g) with γ ≠ α * β yields the exact uniform random DDH tuple distribution.
Approximately uniform exponents #
Sample one approximate uniform exponent modulo F.order d using n + |encNat (F.order d)|
fair coins via ProbComp.sampleModNat, within statistical distance 1 / 2 ^ n of exact uniform on
ZMod (F.order d).
sampleExp is uniform strict PPT whenever n and d are computable in polynomial time.
Replacing one sampleExp n d draw by an exact uniform draw on ZMod (F.order d)
changes Game.advantage by at most 1 / 2 ^ n.
Distribution of a single modular exponent sampled via ProbComp.sampleModNat at parameter n
and group parameters d, projected to ZMod (F.order d) (original).
Each modular exponent sampled by ProbComp.sampleModNat ((F.order d).size + n) (F.order d)
is within statistical distance 1 / 2 ^ n of PMF.uniformOfFintype (ZMod (F.order d))
(original).
Efficient DDH random self-reduction #
The DDH random self-reduction ([BS23], Exercises 10.8–10.9, pp. 425–426): draw three
approximately uniform exponents with sampleExp, re-randomize the input triple with
ddhRerandomize, and run distinguisher on the result.
ddhSelfReduceDistinguisher is uniform strict PPT whenever distinguisher is.
Sampling loss of the DDH self-reduction: on any fixed triple, replacing the three exact
uniform exponents of ddhRerandomizeLaw by the sampleExp draws of
ddhSelfReduceDistinguisher changes the acceptance law by at most 3 / 2 ^ n.
Running a distinguisher on the uniform real DDH tuple is the real DDH experiment.
Running a distinguisher on the uniform random DDH tuple is the random DDH experiment.
On any fixed real DDH triple, ddhSelfReduceDistinguisher accepts within 3 / 2 ^ n of the
real DDH experiment.
On any fixed non-DDH triple, ddhSelfReduceDistinguisher accepts within 3 / 2 ^ n of the
random DDH experiment.
Worst-case DDH #
The DDH re-randomization game ([BS23], Exercises 10.8–10.9, pp. 425–426): draw
group parameters d, re-randomize the fixed triple (u d, v d, w d) with exact uniform exponents,
and run distinguisher on the result.
The worst-case DDH game: draw group parameters d and run distinguisher on the fixed triple
(u d, v d, w d).
Re-randomizing any family of real DDH triples (α d • g, β d • g, (α d * β d) • g) gives the
average-case ddhRealGame ([BS23], Exercises 10.8–10.9, pp. 425–426).
Re-randomizing any family of non-DDH triples (α d • g, β d • g, γ d • g) with
γ d ≠ α d * β d on the support of setup n gives the average-case ddhRandomGame
([BS23], Exercises 10.8–10.9, pp. 425–426).
DDH re-randomization advantage identity ([BS23], Exercises 10.8–10.9, pp. 425–426): re-randomizing a real triple family and a non-DDH triple family leaves exactly the average-case DDH advantage.
DDH re-randomization indistinguishability ([BS23], Exercises 10.8–10.9,
pp. 425–426): under DDH, no PPT distinguisher tells the re-randomization of a real triple family
from that of a non-DDH triple family.
Sampling loss of the worst-case reduction: replacing the exact uniform exponents of
ddhRerandomizeGame by ddhSelfReduceDistinguisher on the fixed triple changes the game by at
most 3 / 2 ^ n.
Quantitative worst-case-to-average-case DDH reduction: the average-case DDH advantage of
distinguisher is at most the worst-case advantage of ddhSelfReduceDistinguisher distinguisher
between a real triple family and a non-DDH triple family, plus 6 / 2 ^ n.
Average-case DDH from worst-case DDH: if for every PPT distinguisher there are a real
triple family (α d • g, β d • g, (α d * β d) • g) and a non-DDH triple family
(α' d • g, β' d • g, γ' d • g), with γ' d ≠ α' d * β' d on the support of setup n for all
sufficiently large n, between which it has negligible advantage, then DDH holds. The families
may depend on the distinguisher: the premise says that for every distinguisher there are families,
so fixed families that work for every PPT distinguisher (Game.Indistinguishable of the two
ddhWorstCaseGames) also satisfy it. This formulation and ddhWorstCaseGame are this library's.
Chernoff-amplified worst-case DDH decider ([BS23], Section 10.11, Exercise 10.10,
p. 426): given a DDH distinguisher and an inverse-advantage bound invEps, run
N = (n + 3) * (7 * invEps n) ^ 2 independent trials of ddhSelfReduceDistinguisher on the input
triple, on the reference DDH triple (0, 0, 0) and on the reference non-DDH triple (0, 0, g),
and accept iff the input count cIn is at least as close to the real count as to the random one.
ddhAmplifiedDecider is uniform strict PPT whenever distinguisher is and invEps is
computable in polynomial time in unary ([BS23], Exercise 10.10, p. 426).
Quantitative worst-case DDH decision bound ([BS23], Section 10.11, Exercise 10.10,
p. 426): if distinguisher n has DDH advantage at least 1 / invEps n in the group d and the
sampling loss satisfies 3 / 2 ^ n ≤ 1 / (12 * invEps n), then on every triple
(α • g, β • g, γ • g) the decider answers differently from decide (γ = α * β) with probability
at most (1 / 2) ^ n.
Directional correctness of ddhAmplifiedDecider ([BS23], Section 10.11,
Exercise 10.10, p. 426): under the hypotheses of ddhAmplifiedDecider_error_le_pow, on every
triple (α • g, β • g, γ • g) the decider outputs decide (γ = α * β) with probability at least
1 - (1 / 2) ^ n.
Worst-case DDH decider with negligible error ([BS23], Exercise 10.10, p. 426):
if invEps is computable in polynomial time in unary and distinguisher eventually has DDH
advantage at least 1 / invEps n in the group d n, then on every sequence of triples
(α n • g, β n • g, γ n • g) in d n, ddhAmplifiedDecider decides whether γ n = α n * β n
with negligible error.