Skip to content
This repository was archived by the owner on Dec 25, 2023. It is now read-only.

Commit 9c3534a

Browse files
authored
Enforced range check for integration (#23)
* Enforced range check for integration
1 parent 4db9260 commit 9c3534a

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
lines changed

host/src/dl_kernel_interfaces.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ DynamicIF::DynamicIF(const std::string& libName) : m_lib_name_(libName) {
1616
std::cout << "dlopen error: " << dlerror() << std::endl;
1717
exit(-1);
1818
} else {
19-
std::cout << "Successfull Opened : " << m_lib_name_ << std::endl;
19+
std::cout << "Successfully opened library: " << m_lib_name_
20+
<< std::endl;
2021
}
2122
}
2223
DynamicIF::~DynamicIF() {

host/src/fpga_int.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -442,9 +442,7 @@ static void fpga_KeySwitch(uint64_t* result, const uint64_t* t_target_iter_ptr,
442442
fence |= (rns_modulus_size != obj_KeySwitch->rns_modulus_size_);
443443
fence |=
444444
(key_component_count != obj_KeySwitch->key_component_count_);
445-
fence |= (moduli != obj_KeySwitch->moduli_);
446445
fence |= (k_switch_keys != obj_KeySwitch->k_switch_keys_);
447-
fence |= (modswitch_factors != obj_KeySwitch->modswitch_factors_);
448446
}
449447
}
450448

host/src/keyswitch.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@ void KeySwitch(uint64_t* result, const uint64_t* t_target_iter_ptr, uint64_t n,
2828
FPGA_ASSERT(rns_modulus_size > 0, "requires rns_modulus_size > 0");
2929
FPGA_ASSERT(key_component_count == 2, "requires key_component_count = 2");
3030
FPGA_ASSERT(moduli, "requires moduli != nullptr");
31+
for (uint64_t i = 0; i < decomp_modulus_size; ++i) {
32+
FPGA_ASSERT((moduli[i] >= (1UL << 16)) && (moduli[i] <= (1UL << 52)),
33+
"requires each modulus to be in the range of [2^16, 2^52]");
34+
}
3135
FPGA_ASSERT(k_switch_keys, "requires k_switch_keys != nullptr");
3236
FPGA_ASSERT(modswitch_factors, "requires modswitch_factors != nullptr");
3337

0 commit comments

Comments
 (0)