]> git.saurik.com Git - apple/security.git/blob - SecurityTests/regressions/ut/ut-01-devrandom.cpp
Security-57031.1.35.tar.gz
[apple/security.git] / SecurityTests / regressions / ut / ut-01-devrandom.cpp
1 #include <security_utilities/devrandom.h>
2
3 #include "testcpp.h"
4
5 int main(int argc, char *const *argv)
6 {
7 plan_tests(4);
8
9 DevRandomGenerator rnd;
10 char buf[8] = {};
11 no_throw(rnd.random(buf, sizeof(buf)), "read data from rnd.");
12 TODO: {
13 todo("writing to read only rnd succeeeds unexpectedly.");
14
15 does_throw(rnd.addEntropy(buf, sizeof(buf)),
16 "writing to rnd throws");
17 }
18
19
20 DevRandomGenerator rndw(true);
21 no_throw(rndw.random(buf, sizeof(buf)), "read data from rndw.");
22 no_throw(rndw.addEntropy(buf, sizeof(buf)), "write data to rndw.");
23 }