diff --git a/src/pke/lib/scheme/gen-cryptocontext-params-validation.cpp b/src/pke/lib/scheme/gen-cryptocontext-params-validation.cpp index b7a26012..6ab9bb78 100644 --- a/src/pke/lib/scheme/gen-cryptocontext-params-validation.cpp +++ b/src/pke/lib/scheme/gen-cryptocontext-params-validation.cpp @@ -61,13 +61,6 @@ void validateParametersForCryptocontext(const Params& parameters) { } } else if (isBFVRNS(scheme)) { - if(BV == parameters.GetKeySwitchTechnique()) { - const uint32_t maxDigitSize = uint32_t(std::ceil(MAX_MODULUS_SIZE/2)); - if(maxDigitSize < parameters.GetDigitSize()) { - OPENFHE_THROW("digitSize should not be greater than " + std::to_string(maxDigitSize) + - " for keySwitchTechnique == BV"); - } - } if (0 == parameters.GetPlaintextModulus()) { OPENFHE_THROW("PlaintextModulus is not set. It should be set to a non-zero value"); } @@ -76,13 +69,6 @@ void validateParametersForCryptocontext(const Params& parameters) { } } else if (isBGVRNS(scheme)) { - if(BV == parameters.GetKeySwitchTechnique()) { - const uint32_t maxDigitSize = uint32_t(std::ceil(MAX_MODULUS_SIZE/2)); - if(maxDigitSize < parameters.GetDigitSize()) { - OPENFHE_THROW("digitSize should not be greater than " + std::to_string(maxDigitSize) + - " for keySwitchTechnique == BV"); - } - } if (0 == parameters.GetPlaintextModulus()) { OPENFHE_THROW("PlaintextModulus is not set. It should be set to a non-zero value"); } @@ -147,6 +133,13 @@ void validateParametersForCryptocontext(const Params& parameters) { "]. Ring dimension must be a power of 2."); OPENFHE_THROW(errorMsg); } + if (BV == parameters.GetKeySwitchTechnique()) { + const uint32_t maxDigitSize = uint32_t(std::ceil(MAX_MODULUS_SIZE / 2)); + if (maxDigitSize < parameters.GetDigitSize()) { + OPENFHE_THROW("digitSize should not be greater than " + std::to_string(maxDigitSize) + + " for keySwitchTechnique == BV"); + } + } //==================================================================================================================== constexpr usint maxMultiplicativeDepthValue = 1000; if (parameters.GetMultiplicativeDepth() > maxMultiplicativeDepthValue) {