]>
git.ipfire.org Git - thirdparty/pdns.git/blob - pdns/randomhelper.cc
8d8b2db57b8d1ea8d980cd38e4d8567861f687cc
10 #include "dns_random.hh"
12 void seedRandom(const string
& source
)
14 L
<<Logger::Warning
<<"Reading random entropy from '"<<source
<<"'"<<endl
;
16 int fd
=open(source
.c_str(), O_RDONLY
);
18 L
<<Logger::Error
<<"Unable to open source of random '"<<source
<<"': "<<stringerror()<<endl
;
24 while(pos
!=sizeof(seed
)) {
25 ret
= read(fd
, seed
+pos
, sizeof(seed
)-pos
);
27 L
<<Logger::Error
<<"Unable to read random seed from "<<source
<<": "<<stringerror()<<endl
;
32 L
<<Logger::Error
<<"Unable to read random seed from "<<source
<<": end of file"<<endl
;
39 dns_random_init(seed
);