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

Unified Diff: runtime/bin/crypto_linux.cc

Issue 11175030: Add sessions to HttpServer. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Review update. Created 8 years, 2 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: runtime/bin/crypto_linux.cc
diff --git a/runtime/bin/crypto_linux.cc b/runtime/bin/crypto_linux.cc
new file mode 100644
index 0000000000000000000000000000000000000000..08f6dacad9ae3c3391b465945760ad97f2a26d84
--- /dev/null
+++ b/runtime/bin/crypto_linux.cc
@@ -0,0 +1,18 @@
+// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+#include <errno.h>
+#include <fcntl.h>
+
+#include "bin/fdutils.h"
+#include "bin/crypto.h"
+
+
+bool Crypto::GetRandomBytes(intptr_t count, uint8_t* buffer) {
+ intptr_t fd = TEMP_FAILURE_RETRY(open("/dev/urandom", O_RDONLY));
+ if (fd < 0) return false;
+ intptr_t bytes_read = read(fd, buffer, count);
+ close(fd);
+ return bytes_read == count;
+}
« no previous file with comments | « runtime/bin/crypto.cc ('k') | runtime/bin/crypto_macos.cc » ('j') | runtime/bin/http_impl.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698