dart-sdk/runtime/bin/crypto_fuchsia.cc
Adam Barth efa4b21c4f [fuchsia] Update zx_cprng_draw
This syscall can no longer fail to provide the requested number of
bytes, simplifying callers.

Change-Id: Id7f0af98a1ada087ad4f130ee9a1d34519eee521
Reviewed-on: https://dart-review.googlesource.com/62640
Reviewed-by: Zach Anderson <zra@google.com>
Commit-Queue: Adam Barth <abarth@google.com>
2018-06-27 17:13:27 +00:00

24 lines
557 B
C++

// Copyright (c) 2016, 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 "platform/globals.h"
#if defined(HOST_OS_FUCHSIA)
#include "bin/crypto.h"
#include <zircon/syscalls.h>
namespace dart {
namespace bin {
bool Crypto::GetRandomBytes(intptr_t count, uint8_t* buffer) {
zx_cprng_draw(buffer, count);
return true;
}
} // namespace bin
} // namespace dart
#endif // defined(HOST_OS_FUCHSIA)