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

Unified Diff: src/trusted/nonnacl_util/sel_ldr_launcher_base.cc

Issue 10914138: Split secure command channel and untrusted application channel (Closed) Base URL: svn://svn.chromium.org/native_client/trunk/src/native_client
Patch Set: Created 8 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 side-by-side diff with in-line comments
Download patch
Index: src/trusted/nonnacl_util/sel_ldr_launcher_base.cc
diff --git a/src/trusted/nonnacl_util/sel_ldr_launcher_base.cc b/src/trusted/nonnacl_util/sel_ldr_launcher_base.cc
index 96cf4bee34828303ae216d5cc3157f59a4b7084f..ac3c94a39c2d0e033001214ec9218eb11910459a 100644
--- a/src/trusted/nonnacl_util/sel_ldr_launcher_base.cc
+++ b/src/trusted/nonnacl_util/sel_ldr_launcher_base.cc
@@ -92,6 +92,45 @@ bool SelLdrLauncherBase::SetupCommand(NaClSrpcChannel* command) {
return true;
}
+bool SelLdrLauncherBase::SetupUntrustedCommand(NaClSrpcChannel* command) {
+ NaClSrpcChannel secure_chan;
+ if (!SetupCommand(&secure_chan)) {
+ NaClLog(LOG_ERROR, "SelLdrLauncher::SetupCommand: "
+ "failed to setup trusted command channel\n");
+ return false;
+ }
+ NaClDesc* h;
+ NaClSrpcResultCodes rpc_result =
+ NaClSrpcInvokeBySignature(&secure_chan,
+ "command_setup::h",
+ &h);
+ if (NACL_SRPC_RESULT_OK != rpc_result) {
+ NaClLog(LOG_ERROR, "SelLdrLauncher::SetupCommand: "
+ "command setup failed\n");
+ return false;
+ }
+ // Make a nacl::DescWrapper* from the NaClDesc*
+ scoped_ptr<nacl::DescWrapper> conn_cap(WrapCleanup(h));
+ if (conn_cap == NULL) {
+ NaClLog(LOG_ERROR, "SelLdrLauncher::SetupCommand: "
+ "command conn desc wrap failed\n");
+ return false;
+ }
+ scoped_ptr<DescWrapper> command_desc(conn_cap->Connect());
+ if (command_desc == NULL) {
+ NaClLog(0, "SelLdrLauncher::SetupCommand: Connect failed\n");
+ return false;
+ }
+ // Start the SRPC client to communicate with the command channel.
+ // SRPC client takes an additional reference to command_desc.
+ if (!NaClSrpcClientCtor(command, command_desc->desc())) {
+ NaClLog(0, "SelLdrLauncher::SetupCommand: "
+ "NaClSrpcClientCtor failed\n");
+ return false;
+ }
+ return true;
+}
+
bool SelLdrLauncherBase::LoadModule(NaClSrpcChannel* command,
DescWrapper* nexe) {
// TODO(sehr): This argument to load_module is unused. Remove it.

Powered by Google App Engine
This is Rietveld 408576698