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

Side by Side Diff: src/trusted/service_runtime/name_service/default_name_service.c

Issue 7108031: this patch adds the manifest proxy server to sel_ldr and the manifest (Closed) Base URL: svn://svn.chromium.org/native_client/trunk/src/native_client/
Patch Set: '' Created 9 years, 6 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2011 The Native Client Authors. All rights reserved. 2 * Copyright (c) 2011 The Native Client Authors. All rights reserved.
3 * Use of this source code is governed by a BSD-style license that can be 3 * Use of this source code is governed by a BSD-style license that can be
4 * found in the LICENSE file. 4 * found in the LICENSE file.
5 */ 5 */
6 6
7 #include "native_client/src/trusted/service_runtime/name_service/default_name_se rvice.h" 7 #include "native_client/src/trusted/service_runtime/name_service/default_name_se rvice.h"
8 8
9 #include "native_client/src/shared/platform/nacl_log.h"
noelallen_use_chromium 2011/06/14 02:25:45 include order?
bsy 2011/06/14 20:30:03 Done.
9 #include "native_client/src/trusted/service_runtime/include/sys/fcntl.h" 10 #include "native_client/src/trusted/service_runtime/include/sys/fcntl.h"
10 #include "native_client/src/trusted/desc/nacl_desc_rng.h" 11 #include "native_client/src/trusted/desc/nacl_desc_rng.h"
11 12
13 #include "native_client/src/trusted/manifest_name_service_proxy/manifest_proxy.h "
14 #include "native_client/src/trusted/service_runtime/sel_ldr_thread_interface.h"
15
12 int NaClDefaultNameServiceInit(struct NaClNameService *ns) { 16 int NaClDefaultNameServiceInit(struct NaClNameService *ns) {
13 /* 17 /*
14 * Create an CSPRNG and enter it into the name server. 18 * Create an CSPRNG and enter it into the name server.
15 */ 19 */
16 struct NaClDescRng *rng = NULL; 20 struct NaClDescRng *rng = NULL;
noelallen_use_chromium 2011/06/14 02:25:45 Did you mean to dbl space here?
bsy 2011/06/14 20:30:03 i use emacs tab to line up identifiers -- this is
17 21
18 rng = (struct NaClDescRng *) malloc(sizeof *rng); 22 rng = (struct NaClDescRng *) malloc(sizeof *rng);
19 if (NULL == rng) { 23 if (NULL == rng) {
20 goto malloc_failed; 24 goto malloc_failed;
21 } 25 }
22 if (!NaClDescRngCtor(rng)) { 26 if (!NaClDescRngCtor(rng)) {
23 goto rng_ctor_failed; 27 goto rng_ctor_failed;
24 } 28 }
25 29
26 /* 30 /*
27 * It may appear desirable to insert a factory for rng, so there can 31 * It may appear desirable to insert a factory for rng, so there can
28 * be per-thread secure rng access. However, note that the only way 32 * be per-thread secure rng access. However, note that the only way
29 * we "transfer" a RNG is to create a new (but indistinguishable) 33 * we "transfer" a RNG is to create a new (but indistinguishable)
30 * RNG at the recipient, so each lookup results in a new generator 34 * RNG at the recipient, so each lookup results in a new generator
31 * anyway. 35 * anyway.
32 */ 36 */
33 (*NACL_VTBL(NaClNameService, ns)-> 37 (*NACL_VTBL(NaClNameService, ns)->
34 CreateDescEntry)(ns, 38 CreateDescEntry)(ns,
35 "SecureRandom", NACL_ABI_O_RDWR, 39 "SecureRandom", NACL_ABI_O_RDWR,
36 (struct NaClDesc *) rng); 40 (struct NaClDesc *) rng);
37 NaClDescUnref((struct NaClDesc *) rng); 41 rng = NULL;
noelallen_use_chromium 2011/06/14 02:25:45 You immediately return, this is a NOP.
bsy 2011/06/14 20:30:03 i know. the compiler will also know. i do simila
38 42
39 return 1; 43 return 1;
40 44
41 rng_ctor_failed: 45 rng_ctor_failed:
42 free(rng); 46 free(rng);
43 malloc_failed: 47 malloc_failed:
44 return 0; 48 return 0;
45 } 49 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698