QSC Post Quantum Cryptographic Library 1.0.0.6c (A6)
A post quantum secure library written in Ansi C
 
Loading...
Searching...
No Matches
rdp.h File Reference

RDRAND Entropy Provider (RDP). More...

#include "common.h"

Go to the source code of this file.

Macros

#define QSC_RDP_SEED_MAX   1024000ULL
 The maximum seed size that can be extracted from a single generate call.
 

Functions

QSC_EXPORT_API bool qsc_rdp_generate (uint8_t *output, size_t length)
 Generate an array of random bytes using the RDRAND entropy provider.
 
QSC_EXPORT_API uint16_t qsc_rdp_uint16 (void)
 Generate a random 16-bit unsigned integer using the RDRAND entropy provider.
 
QSC_EXPORT_API uint32_t qsc_rdp_uint32 (void)
 Generate a random 32-bit unsigned integer using the RDRAND entropy provider.
 
QSC_EXPORT_API uint64_t qsc_rdp_uint64 (void)
 Generate a random 64-bit unsigned integer using the RDRAND entropy provider.
 

Detailed Description

RDRAND Entropy Provider (RDP).

This module provides access to the Intel RDRAND entropy provider, which extracts hardware-generated random numbers from a CPU with RDRAND support. While RDP is suitable as an entropy source, it is recommended to be combined with other entropy providers to seed a MAC or DRBG function for higher quality random output.

The ACP entropy provider is the recommended alternative in this library for ensuring strong cryptographic randomness.

// Example usage:
uint8_t entropy[64];
if (qsc_rdp_generate(entropy, sizeof(entropy))) {
// Use the entropy for seeding a DRBG or MAC function
}
QSC_EXPORT_API bool qsc_rdp_generate(uint8_t *output, size_t length)
Generate an array of random bytes using the RDRAND entropy provider.
Definition rdp.c:18

Reference Links:

Function Documentation

◆ qsc_rdp_generate()

QSC_EXPORT_API bool qsc_rdp_generate ( uint8_t * output,
size_t length )

Generate an array of random bytes using the RDRAND entropy provider.

Parameters
output[uint8_t*] Pointer to the output byte array.
length[size_t] The number of bytes to generate.
Returns
[bool] Returns true if the entropy generation was successful, false otherwise.

◆ qsc_rdp_uint16()

QSC_EXPORT_API uint16_t qsc_rdp_uint16 ( void )

Generate a random 16-bit unsigned integer using the RDRAND entropy provider.

Returns
[uint16_t] Returns a random 16-bit unsigned integer.

◆ qsc_rdp_uint32()

QSC_EXPORT_API uint32_t qsc_rdp_uint32 ( void )

Generate a random 32-bit unsigned integer using the RDRAND entropy provider.

Returns
[uint32_t] Returns a random 32-bit unsigned integer.

◆ qsc_rdp_uint64()

QSC_EXPORT_API uint64_t qsc_rdp_uint64 ( void )

Generate a random 64-bit unsigned integer using the RDRAND entropy provider.

Returns
[uint64_t] Returns a random 64-bit unsigned integer.