Debian Codegraph @

crt/aws-c-common/source/device_random.c

raw symbols SCIP
1 /**
2 * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3 * SPDX-License-Identifier: Apache-2.0.
4 */
5 #include <aws/common/device_random.h>
6
7 #include <aws/common/byte_buf.h>
8
9 #ifdef _MSC_VER
10 /* disables warning non const declared initializers for Microsoft compilers */
11 # pragma warning(disable : 4204)
12 # pragma warning(disable : 4706)
13 #endif
14
15 int aws_device_random_u64(uint64_t *output) {
16 struct aws_byte_buf buf = aws_byte_buf_from_empty_array((uint8_t *)output, sizeof(uint64_t));
17
18 return aws_device_random_buffer(&buf);
19 }
20
21 int aws_device_random_u32(uint32_t *output) {
22 struct aws_byte_buf buf = aws_byte_buf_from_empty_array((uint8_t *)output, sizeof(uint32_t));
23
24 return aws_device_random_buffer(&buf);
25 }
26
27 int aws_device_random_u16(uint16_t *output) {
28 struct aws_byte_buf buf = aws_byte_buf_from_empty_array((uint8_t *)output, sizeof(uint16_t));
29
30 return aws_device_random_buffer(&buf);
31 }
32
33 int aws_device_random_u8(uint8_t *output) {
34 struct aws_byte_buf buf = aws_byte_buf_from_empty_array((uint8_t *)output, sizeof(uint8_t));
35
36 return aws_device_random_buffer(&buf);
37 }