X-Git-Url: https://git.saurik.com/apple/security.git/blobdiff_plain/80e2389990082500d76eb566d4946be3e786c3ef..d8f41ccd20de16f8ebe2ccc84d47bf1cb2b26bbb:/SecurityTests/regressions/ut/ut-01-devrandom.cpp diff --git a/SecurityTests/regressions/ut/ut-01-devrandom.cpp b/SecurityTests/regressions/ut/ut-01-devrandom.cpp new file mode 100755 index 00000000..55927d24 --- /dev/null +++ b/SecurityTests/regressions/ut/ut-01-devrandom.cpp @@ -0,0 +1,23 @@ +#include + +#include "testcpp.h" + +int main(int argc, char *const *argv) +{ + plan_tests(4); + + DevRandomGenerator rnd; + char buf[8] = {}; + no_throw(rnd.random(buf, sizeof(buf)), "read data from rnd."); + TODO: { + todo("writing to read only rnd succeeeds unexpectedly."); + + does_throw(rnd.addEntropy(buf, sizeof(buf)), + "writing to rnd throws"); + } + + + DevRandomGenerator rndw(true); + no_throw(rndw.random(buf, sizeof(buf)), "read data from rndw."); + no_throw(rndw.addEntropy(buf, sizeof(buf)), "write data to rndw."); +}