Add gdb script to test mbedtls_zeroize()
The gdb script loads the programs/test/zeroize program and feeds it as imput its own source code. Then sets a breakpoint just before the last program's return code and checks that every element in memory was zeroized. Otherwise it signals a failure and terminates. The test was added to all.sh.
This commit is contained in:
parent
5ab74a1401
commit
ddebc49f28
2 changed files with 26 additions and 1 deletions
25
tests/scripts/test_zeroize.gdb
Normal file
25
tests/scripts/test_zeroize.gdb
Normal file
|
@ -0,0 +1,25 @@
|
|||
set confirm off
|
||||
file ./programs/test/zeroize
|
||||
break zeroize.c:90
|
||||
|
||||
set args ./programs/test/zeroize.c
|
||||
run
|
||||
|
||||
set $i = 0
|
||||
set $len = sizeof(buf)
|
||||
set $buf = buf
|
||||
|
||||
if exit_code != 0
|
||||
echo The program did not terminate correctly\n
|
||||
quit 1
|
||||
end
|
||||
|
||||
while $i < $len
|
||||
if $buf[$i++] != 0
|
||||
echo The buffer at was not zeroized\n
|
||||
quit 1
|
||||
end
|
||||
end
|
||||
|
||||
echo The buffer was correctly zeroized\n
|
||||
quit 0
|
Loading…
Add table
Add a link
Reference in a new issue