blob: 2b0fcafbfecb2ecfa26c78b1c5cd10b37dcd7aab [file] [log] [blame]
[email protected]9b205782012-08-02 20:22:251// Copyright (c) 2012 The Chromium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef CRYPTO_RANDOM_H_
6#define CRYPTO_RANDOM_H_
7
[email protected]32c78712012-12-08 04:08:288#include <stddef.h>
[email protected]9b205782012-08-02 20:22:259
Adam Langley9605f6f2020-03-12 19:16:3310#include "base/containers/span.h"
[email protected]9b205782012-08-02 20:22:2511#include "crypto/crypto_export.h"
12
13namespace crypto {
14
15// Fills the given buffer with |length| random bytes of cryptographically
16// secure random numbers.
17// |length| must be positive.
18CRYPTO_EXPORT void RandBytes(void *bytes, size_t length);
19
Adam Langley9605f6f2020-03-12 19:16:3320// Fills |bytes| with cryptographically-secure random bits.
21CRYPTO_EXPORT void RandBytes(base::span<uint8_t> bytes);
[email protected]9b205782012-08-02 20:22:2522}
23
davidben6004dc52017-02-03 04:15:2924#endif // CRYPTO_RANDOM_H_