summaryrefslogtreecommitdiffstats
path: root/ipc/brokerable_attachment_win.cc
diff options
context:
space:
mode:
authorerikchen <erikchen@chromium.org>2015-09-15 10:26:27 -0700
committerCommit bot <commit-bot@chromium.org>2015-09-15 17:27:03 +0000
commita5085cda2c9f25c34eec39759f67d79e3bfe7d2e (patch)
treed71b91954ca2c8a41a1266a1288743815c7a5060 /ipc/brokerable_attachment_win.cc
parentfb5df8b36077de6504a0929dd39a164681e4bfba (diff)
downloadchromium_src-a5085cda2c9f25c34eec39759f67d79e3bfe7d2e.zip
chromium_src-a5085cda2c9f25c34eec39759f67d79e3bfe7d2e.tar.gz
chromium_src-a5085cda2c9f25c34eec39759f67d79e3bfe7d2e.tar.bz2
ipc: Move //crypto dependency into a Windows-only file.
//ipc only depends on //crypto on Windows. GN checks #includes against dependencies, but isn't able to evaluate preprocessor conditionals. This causes problems. In https://codereview.chromium.org/1321253011/, the dependency was moved into several other files, but this also changed the public interface of BrokerableAttachment::AttachmentId in an undesirable manner. Instead, this CL makes the new file brokerable_attachment_win.cc to include the the crypto dependency. BUG= Review URL: https://codereview.chromium.org/1345633002 Cr-Commit-Position: refs/heads/master@{#348923}
Diffstat (limited to 'ipc/brokerable_attachment_win.cc')
-rw-r--r--ipc/brokerable_attachment_win.cc18
1 files changed, 18 insertions, 0 deletions
diff --git a/ipc/brokerable_attachment_win.cc b/ipc/brokerable_attachment_win.cc
new file mode 100644
index 0000000..6b567e6
--- /dev/null
+++ b/ipc/brokerable_attachment_win.cc
@@ -0,0 +1,18 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "ipc/brokerable_attachment.h"
+
+#include "crypto/random.h"
+
+namespace IPC {
+
+BrokerableAttachment::AttachmentId::AttachmentId() {
+ // In order to prevent mutually untrusted processes from stealing resources
+ // from one another, the nonce must be secret. This generates a 128-bit,
+ // cryptographicaly-strong random number.
+ crypto::RandBytes(nonce, BrokerableAttachment::kNonceSize);
+}
+
+} // namespace IPC