MCPcopy Create free account
hub / github.com/LUX-Core/lux / TestSecBlock

Function TestSecBlock

src/cryptopp/validat0.cpp:281–1211  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

279
280#if defined(CRYPTOPP_DEBUG) && !defined(CRYPTOPP_IMPORTS)
281bool TestSecBlock()
282{
283 std::cout << "\nTesting SecBlock...\n\n";
284
285 bool pass1=true, pass2=true, pass3=true, pass4=true, pass5=true, pass6=true, pass7=true, temp=false;
286
287 //********** Zeroized block **********//
288
289 {
290 // NULL ptr with a size means to create a new SecBlock with all elements zero'd
291 SecByteBlock z1(NULL, 256);
292 temp = true;
293
294 for (size_t i = 0; i < z1.size(); i++)
295 temp &= (z1[i] == 0);
296
297 pass1 &= temp;
298 if (!temp)
299 std::cout << "FAILED:";
300 else
301 std::cout << "passed:";
302 std::cout << " Zeroized byte array" << std::endl;
303
304 SecBlock<word32> z2(NULL, 256);
305 temp = true;
306
307 for (size_t i = 0; i < z2.size(); i++)
308 temp &= (z2[i] == 0);
309
310 pass1 &= temp;
311 if (!temp)
312 std::cout << "FAILED:";
313 else
314 std::cout << "passed:";
315 std::cout << " Zeroized word32 array" << std::endl;
316
317 SecBlock<word64> z3(NULL, 256);
318 temp = true;
319
320 for (size_t i = 0; i < z3.size(); i++)
321 temp &= (z3[i] == 0);
322
323 pass1 &= temp;
324 if (!temp)
325 std::cout << "FAILED:";
326 else
327 std::cout << "passed:";
328 std::cout << " Zeroized word64 array" << std::endl;
329
330#if defined(CRYPTOPP_WORD128_AVAILABLE)
331 SecBlock<word128> z4(NULL, 256);
332 temp = true;
333
334 for (size_t i = 0; i < z4.size(); i++)
335 temp &= (z4[i] == 0);
336
337 pass1 &= temp;
338 if (!temp)

Callers 2

ValidateFunction · 0.85
ValidateAllFunction · 0.85

Calls 8

SizeInBytesMethod · 0.80
CleanGrowMethod · 0.80
CleanNewMethod · 0.80
sizeMethod · 0.45
AssignMethod · 0.45
operator==Method · 0.45
operator!=Method · 0.45
max_sizeMethod · 0.45

Tested by

no test coverage detected