Added test for a zeroized SecBlock
parent
f9d2082e97
commit
5849767735
29
validat1.cpp
29
validat1.cpp
|
|
@ -307,6 +307,35 @@ bool TestSecBlock()
|
|||
|
||||
bool result = true, temp = true;
|
||||
|
||||
//********** Zeroized block **********//
|
||||
|
||||
// NULL ptr with a size means to create a new SecBloc with all elements zero'd
|
||||
SecByteBlock z1(NULL, 256);
|
||||
temp = true;
|
||||
|
||||
for (size_t i = 0; i < z1.size(); i++)
|
||||
temp &= (z1[i] == 0);
|
||||
|
||||
result &= temp;
|
||||
if (!temp)
|
||||
cout << "FAILED:";
|
||||
else
|
||||
cout << "passed:";
|
||||
cout << " Zeroized byte array" << endl;
|
||||
|
||||
SecBlock<word32> z2(NULL, 256);
|
||||
temp = true;
|
||||
|
||||
for (size_t i = 0; i < z2.size(); i++)
|
||||
temp &= (z2[i] == 0);
|
||||
|
||||
result &= temp;
|
||||
if (!temp)
|
||||
cout << "FAILED:";
|
||||
else
|
||||
cout << "passed:";
|
||||
cout << " Zeroized word32 array" << endl;
|
||||
|
||||
//********** Assign **********//
|
||||
|
||||
try
|
||||
|
|
|
|||
Loading…
Reference in New Issue