| 1 | #ifndef AWS_COMMON_DEVICE_RANDOM_H |
| 2 | #define AWS_COMMON_DEVICE_RANDOM_H |
| 3 | /* |
| 4 | * Copyright 2010-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved. |
| 5 | * |
| 6 | * Licensed under the Apache License, Version 2.0 (the "License"). |
| 7 | * You may not use this file except in compliance with the License. |
| 8 | * A copy of the License is located at |
| 9 | * |
| 10 | * http://aws.amazon.com/apache2.0 |
| 11 | * |
| 12 | * or in the "license" file accompanying this file. This file is distributed |
| 13 | * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either |
| 14 | * express or implied. See the License for the specific language governing |
| 15 | * permissions and limitations under the License. |
| 16 | */ |
| 17 | #include <aws/common/common.h> |
| 18 | |
| 19 | struct aws_byte_buf; |
| 20 | |
| 21 | AWS_EXTERN_C_BEGIN |
| 22 | |
| 23 | /** |
| 24 | * Get an unpredictably random 64bit number, suitable for cryptographic use. |
| 25 | */ |
| 26 | AWS_COMMON_API int aws_device_random_u64(uint64_t *output); |
| 27 | |
| 28 | /** |
| 29 | * Get an unpredictably random 32bit number, suitable for cryptographic use. |
| 30 | */ |
| 31 | AWS_COMMON_API int aws_device_random_u32(uint32_t *output); |
| 32 | |
| 33 | /** |
| 34 | * Get an unpredictably random 16bit number, suitable for cryptographic use. |
| 35 | */ |
| 36 | AWS_COMMON_API int aws_device_random_u16(uint16_t *output); |
| 37 | |
| 38 | /** |
| 39 | * Get an unpredictably random 8bit number, suitable for cryptographic use. |
| 40 | */ |
| 41 | AWS_COMMON_API int aws_device_random_u8(uint8_t *output); |
| 42 | |
| 43 | /** |
| 44 | * Fill a buffer with unpredictably random bytes, suitable for cryptographic use. |
| 45 | */ |
| 46 | AWS_COMMON_API int aws_device_random_buffer(struct aws_byte_buf *output); |
| 47 | |
| 48 | AWS_EXTERN_C_END |
| 49 | |
| 50 | #endif /* AWS_COMMON_DEVICE_RANDOM_H */ |
| 51 | |