An implementation of the Auto Entropy Collection Provider (ACP). More...
#include "common.h"
Go to the source code of this file.
Macros | |
#define | QSC_ACP_SEED_MAX 10240000ULL |
The maximum number of bytes that can be generated in a single call to qsc_acp_generate. | |
Functions | |
QSC_EXPORT_API bool | qsc_acp_generate (uint8_t *output, size_t length) |
Generate cryptographically secure random bytes. | |
QSC_EXPORT_API uint16_t | qsc_acp_uint16 (void) |
Generate a cryptographically secure random 16-bit unsigned integer. | |
QSC_EXPORT_API uint32_t | qsc_acp_uint32 (void) |
Generate a cryptographically secure random 32-bit unsigned integer. | |
QSC_EXPORT_API uint64_t | qsc_acp_uint64 (void) |
Generate a cryptographically secure random 64-bit unsigned integer. | |
An implementation of the Auto Entropy Collection Provider (ACP).
The Auto Entropy Collection Provider (ACP) is a comprehensive entropy gathering module designed to supply cryptographically secure random data. It aggregates entropy from multiple sources including system timers, system statistics, and hardware-based randomness via the RDRAND instruction. In addition, it leverages platform-specific providers such as Microsoft CryptGenRandom on Windows and /dev/urandom on POSIX systems when hardware-based sources are unavailable or insufficient. The collected entropy is processed using the cSHAKE-512 algorithm to derive a primary key that is then used to generate pseudorandom output.
The ACP implementation employs a layered approach to entropy collection:
#define QSC_ACP_SEED_MAX 10240000ULL |
The maximum number of bytes that can be generated in a single call to qsc_acp_generate.
This constant limits the output size to ensure that the internal entropy aggregation and key derivation process remains within safe operational parameters.
QSC_EXPORT_API bool qsc_acp_generate | ( | uint8_t * | output, |
size_t | length ) |
Generate cryptographically secure random bytes.
Aggregates entropy from multiple system sources including system statistics, hardware randomness (via RDRAND), and the system's cryptographic service provider. The collected entropy is then processed using the cSHAKE-512 algorithm to produce pseudorandom output.
output | [uint8_t*] Pointer to the output buffer that will receive the random bytes. |
length | [size_t] The number of random bytes to generate. Must not exceed QSC_ACP_SEED_MAX. |
QSC_EXPORT_API uint16_t qsc_acp_uint16 | ( | void | ) |
Generate a cryptographically secure random 16-bit unsigned integer.
This function generates a 16-bit unsigned integer by calling qsc_acp_generate to obtain the necessary random bytes and assembling them in big-endian order.
QSC_EXPORT_API uint32_t qsc_acp_uint32 | ( | void | ) |
Generate a cryptographically secure random 32-bit unsigned integer.
This function generates a 32-bit unsigned integer by calling qsc_acp_generate to obtain the necessary random bytes and assembling them in big-endian order.
QSC_EXPORT_API uint64_t qsc_acp_uint64 | ( | void | ) |
Generate a cryptographically secure random 64-bit unsigned integer.
This function generates a 64-bit unsigned integer by calling qsc_acp_generate to obtain the necessary random bytes and assembling them in big-endian order.