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 |