Skip to content

Commit

Permalink
Code corrections
Browse files Browse the repository at this point in the history
  • Loading branch information
dsuponitskiy-duality committed Oct 30, 2024
1 parent 651ee76 commit 093b3d6
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/core/include/utils/memory.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ void MoveAppend(std::vector<X>& dst, std::vector<X>& src) {
}
}

void secure_memset(void* mem, uint8_t c, size_t len);
void secure_memset(volatile void* mem, uint8_t c, size_t len);

} // namespace lbcrypto

Expand Down
8 changes: 4 additions & 4 deletions src/core/lib/utils/memory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@

namespace lbcrypto {

void secure_memset(void* mem, uint8_t c, size_t len) {
volatile uint8_t* volatile ptr = (volatile uint8_t* volatile)mem;
for(size_t i = 0; i< len; ++i)
*(ptr+i) = c;
void secure_memset(volatile void* mem, uint8_t c, size_t len) {
volatile uint8_t* ptr = (volatile uint8_t*)mem;
for (size_t i = 0; i < len; ++i)
*(ptr + i) = c;
}

} // namespace lbcrypto
3 changes: 3 additions & 0 deletions src/core/lib/utils/prng/blake2engine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,9 @@ static void Blake2SeedGenerator(Blake2Engine::blake2_seed_array_t& seed) {
catch (std::exception& e) {
}
}
if (!rdGenPassed)
OPENFHE_THROW("std::random_device failed");

for (uint32_t i = 0; i < Blake2Engine::MAX_SEED_GENS; ++i)
seed[i] += rdseed[i];

Expand Down

0 comments on commit 093b3d6

Please sign in to comment.