I don't understand the purpose of this line: memset (checkbuf, i, SECRET_SIZE); Wouldn't it be better to have memcpy (stbuf, SECRET, SECRET_SIZE); instead?
I added the latter call but kept the former, as the idea was to test that memset_explicit (b, i, s) sets each of b[0]...b[s - 1] to i even when i is nonzero.