• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2012 The Chromium Authors
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 
8 #include <stddef.h>
9 
10 #include "base/containers/span.h"
11 #include "crypto/crypto_export.h"
12 
13 namespace crypto {
14 
15 // Fills the given buffer with |length| random bytes of cryptographically
16 // secure random numbers.
17 // |length| must be positive.
18 CRYPTO_EXPORT void RandBytes(void *bytes, size_t length);
19 
20 // Fills |bytes| with cryptographically-secure random bits.
21 CRYPTO_EXPORT void RandBytes(base::span<uint8_t> bytes);
22 }
23 
24 #endif  // CRYPTO_RANDOM_H_
25