Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(131)

Unified Diff: src/shared/platform/linux/nacl_secure_random.c

Issue 669056: Support running NaCl in Chromium's Linux SUID sandbox (Closed)
Patch Set: Created 10 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« src/shared/imc/nacl_imc_unistd.cc ('K') | « src/shared/imc/nacl_imc_unistd.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/shared/platform/linux/nacl_secure_random.c
diff --git a/src/shared/platform/linux/nacl_secure_random.c b/src/shared/platform/linux/nacl_secure_random.c
index bdc075b5098d94ff5fab01c161789342a94ed20a..ad0db8ab41203005cbc1dced16128ddf822e5825 100644
--- a/src/shared/platform/linux/nacl_secure_random.c
+++ b/src/shared/platform/linux/nacl_secure_random.c
@@ -124,6 +124,19 @@ static uint8_t NaClSecureRngGenByte(struct NaClSecureRngIf *vself) {
static int rng_d = -1; /* open descriptor for /dev/urandom */
+# ifdef CHROMIUM_BUILD
+
+# include "base/rand_util_c.h"
+
+void NaClSecureRngModuleInit(void) {
+ rng_d = GetUrandomFD();
+}
+
+void NaClSecureRngModuleFini(void) {
+}
+
+# else
+
void NaClSecureRngModuleInit(void) {
rng_d = open(NACL_SECURE_RANDOM_SYSTEM_RANDOM_SOURCE, O_RDONLY, 0);
if (-1 == rng_d) {
@@ -136,6 +149,8 @@ void NaClSecureRngModuleFini(void) {
(void) close(rng_d);
}
+# endif /* CHROMIUM_BUILD */
+
int NaClSecureRngCtor(struct NaClSecureRng *self) {
self->base.vtbl = &kNaClSecureRngVtbl;
self->nvalid = 0;
« src/shared/imc/nacl_imc_unistd.cc ('K') | « src/shared/imc/nacl_imc_unistd.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698