MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / cbm_secure_random

Function cbm_secure_random

src/foundation/secure_random.c:20–34  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

18#include <bcrypt.h>
19
20bool cbm_secure_random(void *buffer, size_t length) {
21 if (!buffer && length != 0) {
22 return false;
23 }
24 uint8_t *cursor = buffer;
25 while (length > 0) {
26 ULONG chunk = length > UINT32_MAX ? UINT32_MAX : (ULONG)length;
27 if (BCryptGenRandom(NULL, cursor, chunk, BCRYPT_USE_SYSTEM_PREFERRED_RNG) < 0) {
28 return false;
29 }
30 cursor += chunk;
31 length -= chunk;
32 }
33 return true;
34}
35
36#else
37

Callers 8

tpt_root_nameFunction · 0.85
gf_private_directoryFunction · 0.85
cbm_mkdtempFunction · 0.85
cbm_mkstempFunction · 0.85
win_generation_nonceFunction · 0.85
host_state_prepareFunction · 0.85
stage_create_attemptFunction · 0.85

Calls 3

openFunction · 0.70
readFunction · 0.70
closeFunction · 0.50

Tested by 2

tpt_root_nameFunction · 0.68
gf_private_directoryFunction · 0.68