]>
git.saurik.com Git - apple/security.git/blob - SecurityTests/regressions/ut/ut-01-devrandom.cpp
   1 #include <security_utilities/devrandom.h> 
   5 int main(int argc
, char *const *argv
) 
   9         DevRandomGenerator rnd
; 
  11         no_throw(rnd
.random(buf
, sizeof(buf
)), "read data from rnd."); 
  13                 todo("writing to read only rnd succeeeds unexpectedly."); 
  15                 does_throw(rnd
.addEntropy(buf
, sizeof(buf
)), 
  16                         "writing to rnd throws"); 
  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.");