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

Unified Diff: ipc/brokerable_attachment.cc

Issue 1188923003: Stub in more IPC attachment brokering functionality. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Change the wireformat to use int32_t for HANDLE. Created 5 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 side-by-side diff with in-line comments
Download patch
Index: ipc/brokerable_attachment.cc
diff --git a/ipc/brokerable_attachment.cc b/ipc/brokerable_attachment.cc
index be5d51b2069451e25eb1ff987fb48bfd32e9b166..54c905b661e60e69fce1e4ada9988bfd8c24dd55 100644
--- a/ipc/brokerable_attachment.cc
+++ b/ipc/brokerable_attachment.cc
@@ -4,9 +4,21 @@
#include "ipc/brokerable_attachment.h"
+#include "crypto/random.h"
+
namespace IPC {
-BrokerableAttachment::BrokerableAttachment() {
+namespace {
+
+BrokerableAttachment::AttachmentId GetRandomId() {
+ BrokerableAttachment::AttachmentId id;
+ crypto::RandBytes(id.nonce, BrokerableAttachment::kNonceSize);
agl 2015/06/24 00:59:56 What are the security requirements around this? Yo
erikchen 2015/06/24 01:06:02 The nonce used to be 4 uint32_ts, now it's 16 uint
agl 2015/06/24 01:28:57 Ok. Please comment: // In order to prevent mutual
erikchen 2015/06/24 17:50:25 Done.
+ return id;
+}
+
+} // namespace
+
+BrokerableAttachment::BrokerableAttachment() : id_(GetRandomId()) {
}
BrokerableAttachment::~BrokerableAttachment() {
@@ -16,4 +28,8 @@ BrokerableAttachment::AttachmentId BrokerableAttachment::GetIdentifier() const {
return id_;
}
+BrokerableAttachment::Type BrokerableAttachment::GetType() const {
+ return TYPE_BROKERABLE_ATTACHMENT;
+}
+
} // namespace IPC
« crypto/BUILD.gn ('K') | « ipc/brokerable_attachment.h ('k') | ipc/handle_attachment_win.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698