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

Side by Side Diff: runtime/bin/crypto_win.cc

Issue 11175030: Add sessions to HttpServer. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file.
4
5 #define _CRT_RAND_S
6 #include "bin/crypto.h"
7
8
9 bool Crypto::GetRandomBytes(intptr_t count, uint8_t* buffer) {
10 uint32_t num;
11 intptr_t read = 0;
12 while (read < count) {
13 if (rand_s(&num) != 0) {
14 return false;
15 }
16 for (int i = 0; i < 4 && read < count; i++) {
17 buffer[read] = num >> (i * 8);
18 read++;
19 }
20 }
21 return true;
22 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698