- Reference 1: Introduction to the BFV encryption schemeΒ [12]
- Reference 2: Somewhat Partially Fully Homomorphic EncryptionΒ [13]
Given two ciphertexts and , the goal of ciphertext-to-ciphertext multiplication is to derive a new ciphertext whose decryption is . Ciphertext-to-ciphertext multiplication is more complex than ciphertext-to-plaintext multiplication. It comprises four steps: (1) ModRaise; (2) polynomial multiplication; (3) relinearization; and (4) rescaling.
For better understanding, we will explain BFVβs ciphertext-to-ciphertext multiplication based on the alternate version of RLWE (TheoremΒ B-4.4 in Β§B-4.4), where the sign of the term is flipped in the encryption and decryption formulas.
We learned from SummaryΒ D-2.3 (in Β§D-2.3) that a BFV ciphertext whose ciphertext modulus is has the (decryption) relation: , where stands for modulo reduction by . ModRaise is a process of forcibly modifying the modulus of a ciphertext from , where . Suppose we modify the modulus of ciphertext from to , where (remember ). Then, the decryption of the mod-raised ciphertext will output . However, since each polynomial coefficient of and is less than and each polynomial coefficient of is either , the resulting polynomial of is guaranteed to have each coefficient strictly less than even without modulo reduction by β this is because , where is the maximum possible coefficient of and is the maximum possible coefficient of . And as mentioned before, we know the relation: . Therefore, the decryption of the mod-raised ciphertext is as follows:
# since
The first step of BFVβs ciphertext-to-ciphertext multiplication is to mod-raise the two input ciphertexts and from (where ) as follows:
After ModRaise, the decryption of these two ciphertexts would be the following:
Therefore, the mod-raised ciphertexts have the following form:
Our next goal is to derive a new ciphertext which encrypts .
First, we can derive the following relation:
Meanwhile, we also have the following relations:
Combining all these, we reach the following relation:
Notice that and are known values as ciphertext components, whereas is only known to the private key owner. Therefore, we can view as a decryption formula such that given the ciphertext components and the private key , one can derive . In other words, we can let be a new form of ciphertext which can be decrypted by into .
However, is not in the RLWE ciphertext format, because it has 3 components instead of 2. Having 3 ciphertext components is computationally inefficient, as its decryption involves a square root of (i.e., ). Over consequent ciphertext-to-ciphertext multiplications, this term will double its exponents as as well as the number of ciphertext components, which would exponentially increase the computational overhead of decryption. Therefore, we want to convert the intermediate ciphertext format into a regular BFV ciphertext format that has two polynomials as ciphertext components. This conversion process is called a relinearization process (which will be explained in the next subsection).
Relinearization is a process of converting the polynomial triplet into two RLWE ciphertexts and which hold the relation: .
In the formula , we can re-write as a synthetic RLWE ciphertext , which can be decrypted by into . Similarly, our next task is to derive a synthetic RLWE ciphertext whose decryption is (i.e., ).
A naive way of creating a ciphertext that encrypts is as follows: we encrypt into an RLWE ciphertext as such that (where the ciphertext modulus is and the plaintext scaling factor ). Then, we perform a ciphertext-to-plaintext multiplication (Β§C-3) with , treating as a plaintext polynomial in modulo . However, this approach does not work in practice, because computing generates a huge noise as follows:
, whose decryption is:
. In the above decrypted expression , the term is okay to be reduced modulo , because this term is originally allowed to be reduced modulo in the final decryption formula as well. However, the problematic term is the noise , because its coefficients can be any value in (since each coefficient of polynomial can be any value in ). Such a huge noise is not allowed for correct final decryption.
To avoid this noise issue, an improved solution is to express the RLWE ciphertext that encrypts as additions of multiple RLWE ciphertexts with small noises by using the gadget decomposition technique (Β§A-6.4). For this, we use an RLev ciphertext (Β§B-5) that encrypts . Suppose our gadget vector is . Remember that our goal is to find given known , unknown , and known . Then, we can derive as follows:
# by decomposing
# where each RLWE ciphertext is an encryption of as plaintext with the plaintext scaling factor
# inner product of Decomp and RLev treating them as vectors
If we decrypt the above, we get the following:
# the scaling factors of are all 1
# where each is a noise embedded in
# where each
# , where is the noise that couldβve been embedded in
Therefore, we get the following comprehensive relation:
# , ,
# ,
# ,
From the above, we extract the following relation:
We can re-write the above relation as follows:
To verbally interpret the above relation, decrypting the synthetically generated ciphertext and applying a reduction modulo to it gives us with a lot of noise terms. Meanwhile, as explained in the beginning of this subsection, our goal is to derive a ciphertext whose decryption is , also ensuring that the decrypted ciphertextβs noise is small enough to be fully eliminated by scaling down the plaintext by at the end. This goal is accomplished by the final rescaling step to be explained in the next subsection.
The rescaling step is equivalent to converting the ciphertext into , where . The decryption of this rescaled ciphertext (and finally scaling down by ) is . This is demonstrated below:
# decryption of ciphertext
# where stands for modulo reduction by
# since
# is a rounding error
# as we derived at the end of Β§D-2.7.3
# where stands for modulo reduction by
# where
# where , thus we substituted
# Now, let .
Thus, we will substitute
# where
In conclusion, the ciphertext successfully decrypts to if .
Noise Analysis: Among the terms of , letβs analyze the noise growth of the term after ciphertext-to-ciphertext multiplication. Each coefficient of is at most , because , where the maximum possible coefficient value of is . And the same is true for the coefficients of . Therefore, after scaling down by upon the final decryption stage, this termβs down-scaled noise gets bound by:
This implies that for correct decryption, has to be smaller than . In other words, has to be smaller than . We can do noise analysis for all other terms for in a similar manner. Importantly, upon decryption, the aggregation of all these noise termsβ down-scaled values has to be smaller than for correct decryption.
Modulus Switch v.s. Rescaling: Notice in the rescaling process, multiplying to and results in two effects: (1) converts into ; (2) switches the modulus of the mod-raised ciphertexts from . In fact, modulus switch and rescaling are closely equivalent to each other. Modulus switch is a process of changing a ciphertextβs modulus (e.g., ), while preserving the property that the decryption of both ciphertexts results in the same plaintext. On the other hand, rescaling refers to the process of changing the scaling factor of a plaintext within a ciphertext (e.g., ). Modulus switch inevitably changes the scaling factor of the plaintext within the target ciphertext, and rescaling also inevitably changes the modulus of the ciphertext that contains the plaintext (as shown in Β§D-2.7.4). Therefore, these two terms can be used interchangeably.
To put all things together, BFVβs ciphertext-to-ciphertext multiplication is summarized as follows:
SummaryΒ D-2.7.5 BFVβs Ciphertext-to-Ciphertext Multiplication
Suppose we have the following two RLWE ciphertexts:
, where
, where
Multiplication between these two ciphertexts is performed as follows:
Forcibly modify the modulus of the ciphertexts and to (where ) as follows:
Compute the following polynomial multiplications in modulo :
Compute the following:
.
Then, this property holds:
Update to .
This plaintext rescaling process can be also viewed as a modulus switch of the ciphertext from .
Note that after the ciphertext-to-ciphertext multiplication, the plaintext scaling factor , the ciphertext modulus , the plaintext , and the private key stay the same as before.
The Purpose of ModRaise: When we multiply polynomials at the second step of ciphertext-to-ciphertext multiplication (Β§D-2.7.2), the underlying plaintext within the ciphertext temporarily grows to , which exceeds the allowed maximum boundary for the plaintext (SummaryΒ D-2.3 in Β§D-2.3). After this point, applying modulo- reduction to the intermediate result will irrevocably corrupt the plaintext. To avoid the corruption of the plaintext when it grows to , we temporarily increase the ciphertext modulus from , which is sufficiently large to hold without wrapping around the boundary of the ciphertext modulus.
Swapping the Order of Relinearization and Rescaling: The order of relinearization and rescaling is interchangeable. Running rescaling before relinearization reduces the size of the ciphertext modulus, and therefore the subsequent relinearization can be executed faster.