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

Side by Side 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ipc/brokerable_attachment.h" 5 #include "ipc/brokerable_attachment.h"
6 6
7 #include "crypto/random.h"
8
7 namespace IPC { 9 namespace IPC {
8 10
9 BrokerableAttachment::BrokerableAttachment() { 11 namespace {
12
13 BrokerableAttachment::AttachmentId GetRandomId() {
14 BrokerableAttachment::AttachmentId id;
15 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.
16 return id;
17 }
18
19 } // namespace
20
21 BrokerableAttachment::BrokerableAttachment() : id_(GetRandomId()) {
10 } 22 }
11 23
12 BrokerableAttachment::~BrokerableAttachment() { 24 BrokerableAttachment::~BrokerableAttachment() {
13 } 25 }
14 26
15 BrokerableAttachment::AttachmentId BrokerableAttachment::GetIdentifier() const { 27 BrokerableAttachment::AttachmentId BrokerableAttachment::GetIdentifier() const {
16 return id_; 28 return id_;
17 } 29 }
18 30
31 BrokerableAttachment::Type BrokerableAttachment::GetType() const {
32 return TYPE_BROKERABLE_ATTACHMENT;
33 }
34
19 } // namespace IPC 35 } // namespace IPC
OLDNEW
« 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