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

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

Issue 550523002: Remove the old "SecureRandom" service, formerly used by get_random_bytes() (Closed) Base URL: svn://svn.chromium.org/native_client/trunk/src/native_client
Patch Set: Created 6 years, 3 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
(Empty)
1 /*
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
4 * found in the LICENSE file.
5 */
6
7 #include "native_client/src/trusted/service_runtime/name_service/default_name_se rvice.h"
8
9 #include "native_client/src/shared/platform/nacl_log.h"
10 #include "native_client/src/trusted/desc/nacl_desc_rng.h"
11 #include "native_client/src/trusted/manifest_name_service_proxy/manifest_proxy.h "
12 #include "native_client/src/trusted/service_runtime/include/sys/fcntl.h"
13 #include "native_client/src/trusted/service_runtime/sel_ldr_thread_interface.h"
14
15 int NaClDefaultNameServiceInit(struct NaClNameService *ns) {
16 /*
17 * Create an CSPRNG and enter it into the name server.
18 */
19 struct NaClDescRng *rng = NULL;
20
21 rng = (struct NaClDescRng *) malloc(sizeof *rng);
22 if (NULL == rng) {
23 goto malloc_failed;
24 }
25 if (!NaClDescRngCtor(rng)) {
26 goto rng_ctor_failed;
27 }
28
29 /*
30 * It may appear desirable to insert a factory for rng, so there can
31 * be per-thread secure rng access. However, note that the only way
32 * we "transfer" a RNG is to create a new (but indistinguishable)
33 * RNG at the recipient, so each lookup results in a new generator
34 * anyway.
35 */
36 (*NACL_VTBL(NaClNameService, ns)->
37 CreateDescEntry)(ns,
38 "SecureRandom", NACL_ABI_O_RDWR,
39 (struct NaClDesc *) rng);
40 rng = NULL;
41
42 return 1;
43
44 rng_ctor_failed:
45 free(rng);
46 malloc_failed:
47 return 0;
48 }
OLDNEW
« no previous file with comments | « src/trusted/service_runtime/name_service/default_name_service.h ('k') | src/trusted/service_runtime/sel_ldr.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698