X-Git-Url: https://git.saurik.com/apple/security.git/blobdiff_plain/5c19dc3ae3bd8e40a9c028b0deddd50ff337692c..02b2aca600d4a0fe6fb259262bd6808ef889acde:/OSX/libsecurity_apple_csp/lib/YarrowConnection.cpp diff --git a/OSX/libsecurity_apple_csp/lib/YarrowConnection.cpp b/OSX/libsecurity_apple_csp/lib/YarrowConnection.cpp index e6a8da60..b83a4cfd 100644 --- a/OSX/libsecurity_apple_csp/lib/YarrowConnection.cpp +++ b/OSX/libsecurity_apple_csp/lib/YarrowConnection.cpp @@ -21,28 +21,16 @@ */ #include "YarrowConnection.h" #include -#include #include - -/* instantiated by C++ runtime at library load/init time */ -class YarrowConnection : public DevRandomGenerator { -public: - YarrowConnection() : DevRandomGenerator(getuid() == 0), writable(getuid() == 0) { } - const bool writable; -}; - -/* the single global thing */ -static ModuleNexus yarrowConnection; - +#include /* and the exported functions */ void cspGetRandomBytes(void *buf, unsigned len) { - yarrowConnection().random(buf, len); + MacOSError::check(SecRandomCopyBytes(kSecRandomDefault, len, buf)); } +/* Unused, since SecRandomCopyBytes returns from a suitable CSPRNG seeded elsewhere */ void cspAddEntropy(const void *buf, unsigned len) { - if (yarrowConnection().writable) - yarrowConnection().addEntropy(buf, len); }