Skip to content

Commit 40eecf2

Browse files
committed
comments in the code for PAlgebrea::cM and its use in bootstrapping
1 parent e5bb5ec commit 40eecf2

File tree

2 files changed

+55
-11
lines changed

2 files changed

+55
-11
lines changed

src/PAlgebra.h

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -72,11 +72,23 @@ class PAlgebra {
7272
NTL::ZZX PhimX; // Holds the integer polynomial Phi_m(X)
7373

7474
double cM; // the "ring constant" c_m for Z[X]/Phi_m(X)
75-
// NOTE: here's to hoping: for "random enough" x we hope to get
76-
// |x|_powerful < |x|_canonical * sqrt(someConstant/phi(m))
77-
// we cM = sqrt(phi(m)/3) * sqrt(someConstant/phi(m)), where the
78-
// sqrt(phi(m)/3) term comes from context.noiseBoundForUniform())
79-
75+
// NOTE: cM is related to the ratio between the l_infinity norm of
76+
// a "random" ring element in different bases. For example, think of
77+
// choosing the power-basis coefficients of x uniformly at random in
78+
// [+-a/2] (for some parameter a), then the powerful basis norm of x
79+
// should be bounded whp by cM*a.
80+
//
81+
// More precisely, for an element x whose coefficients are chosen
82+
// uniformly in [+-a/2] (in either the powerful or the power basis)
83+
// we have a high-probability bound |x|_canonical < A*a for some
84+
// A = O(sqrt(phi(m)). Also for "random enough" x we have some bound
85+
// |x|_powerful < |x|_canonical * B
86+
// where we "hope" that B = O(1/sqrt(phi(m)). The cM value is
87+
// supposed to be cM=A*B.
88+
//
89+
// The value cM is only used for bootstrapping, see more comments
90+
// for the method RecryptData::setAE in recryption.cpp. Also see
91+
// Appendix A of https://ia.cr/2014/873 (updated version from 2019)
8092

8193
std::vector<long> T; // The representatives for the quotient group Zm* /(p)
8294
std::vector<long> Tidx; // i=Tidx[t] is the index i s.t. T[i]=t.

src/recryption.cpp

Lines changed: 38 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -220,14 +220,46 @@ RecryptData::~RecryptData()
220220
}
221221

222222

223-
224223
/**
225-
* Fix the "ring constant" cM, a target norm tau for the secret key,
226-
* and plaintext space mod p^r. We want to find e,e' that minimize
227-
* e-e', subject to the constraint
224+
* Summary of Appendix A from https://ia.cr/2014/873 (version from 2019):
225+
* Assume that we already chosen a, e, e' and t (which induces the
226+
* secret-key size tau).
227+
*
228+
* Going into the recryption procedure after "raw mod-switching", we
229+
* have a ciphertext (c0,c1) where the ci's are "random modulo q" in
230+
* their powerful basis. Denoting x = c0+c1*s (without mod-q reduction),
231+
* then |x|< |c0|+|c1*s|< q + B*||c1*s||, where |X| is powerful-basis
232+
* norm, ||X|| is canonical embedding norm, and B is some bound on the
233+
* ratio between the two.
234+
*
235+
* Let tau be our bound on the secret key canonical-mebedding norm,
236+
* and we think of c1 as having random coefficients in [+-q/2] (say in
237+
* the powerful basis). Then ||c1|| < A*q whp (for some other bound A),
238+
* and therefore ||c1*s||< A*q*tau. Hence we get |x| < q*(1+B*A*tau).
239+
* The quantity A*B for this ring is recorded as cM in the PAlgebra,
240+
* so we have |x|/q < 1 + cM*tau < (1+tau)*cM.
228241
*
242+
* We also assume that the "noise term" after mod-q reduction is bounded
243+
* by |[x]_q| < 2*p^r*(1+tau)*cM (this expression is twice the added
244+
* noise term from mod-switching).
245+
*
246+
* After makeDivisible relative to e' and a (with a divisible by p^r),
247+
* and b = p^e'/2 -a, we have a ciphertext (c0',c1') s.t.
248+
* x' = c0'+c1'*s = x+p^r(u0+u1*s)+(v0+v1*s),
249+
* where |u0|,|u1|<a and |v0|,|v1|<b. It follows from the above that
250+
*
251+
* |x'|/q < (2+b)(1+tau)*cM, and
252+
* |[x']_q|< p^r(2+a)(1+tau)*cM
253+
*
254+
* To be able to use the Lemma 5.1 from https://ia.cr/2014/873, we
255+
* need to have |x'|/q + |[x']_q| <= (q-1)/2 = p^e/2. Using the bounds
256+
* from above, a sufficient condition for this is
257+
*
229258
* (1) (p^{e'}/2 + 2(p^r+1))(tau+1)*cM <= (q-1)/2 = p^e/2
230259
*
260+
* (This is Equation (9) in Appendix A of https://ia.cr/2014/873,
261+
* but note that the a here is a*p^r there.)
262+
*
231263
* Note that as we let e,e' tend to infinity the constraint above
232264
* degenerates to (tau+1)*cM < p^{e-e'}, so the smallest value
233265
* of e-e' that we can hope for is
@@ -242,10 +274,10 @@ RecryptData::~RecryptData()
242274
*
243275
* Once e,e' are set, it splits p^{e'}/2=a+b with a,b about equal and
244276
* a divisible by p^r. Then it computes and returns the largest Hamming
245-
* weight for the key (that implies the norm tau') for which constraint
277+
* weight for the key (that implies the norm tau) for which constraint
246278
* (1) still holds.
247279
*
248-
* NOTE: setAE returns the Hamming weight, *not* the norm tau'. The norm
280+
* NOTE: setAE returns the Hamming weight, *not* the norm tau. The norm
249281
* can be computed from the weight using sampleHWtBoundedEffectiveBound.
250282
**/
251283
long RecryptData::setAE(long& a, long& e, long& ePrime,

0 commit comments

Comments
 (0)