Csilk 0.2.1
A lightweight, high-performance C HTTP web framework
Loading...
Searching...
No Matches
csilk_crypto_driver_t Struct Reference

Pluggable cryptographic primitive driver. More...

#include <csilk.h>

Data Fields

void(* sha256 )(const uint8_t *data, size_t len, uint8_t out[32])
 Compute the SHA-256 hash of a buffer.
 
void(* hmac_sha256 )(const uint8_t *key, size_t key_len, const uint8_t *data, size_t data_len, uint8_t out[32])
 Compute HMAC-SHA256 (RFC 2104).
 
void(* generate_uuid )(char buf[37])
 Generate a random version-4 UUID string. Uses /dev/urandom or driver-specific entropy source.
 

Detailed Description

Pluggable cryptographic primitive driver.

Allows users to replace the default software implementations of SHA256, HMAC-SHA256, and UUID generation (e.g., with hardware-accelerated or FIPS-compliant versions). All function pointers must be non-NULL. Set via csilk_server_set_crypto_driver and propagated to all request contexts. Functions are called synchronously on the event-loop thread.

Allows users to replace the default software implementations of SHA256, HMAC-SHA256, and UUID generation (e.g., with hardware-accelerated or FIPS-compliant versions). All function pointers must be non-NULL.

Field Documentation

◆ generate_uuid

void(* csilk_crypto_driver_t::generate_uuid)(char buf[37])

Generate a random version-4 UUID string. Uses /dev/urandom or driver-specific entropy source.

Generate a random version-4 UUID string.

Parameters
[out]bufOutput buffer of at least 37 bytes. Populated with a NUL-terminated UUID string (e.g., "f81d4fae-7dec-11d0-a765-00a0c91e6bf6").
[out]bufOutput buffer of at least 37 bytes. Populated with a NUL-terminated UUID string.

◆ hmac_sha256

void(* csilk_crypto_driver_t::hmac_sha256)(const uint8_t *key, size_t key_len, const uint8_t *data, size_t data_len, uint8_t out[32])

Compute HMAC-SHA256 (RFC 2104).

Compute HMAC-SHA256.

Parameters
keyHMAC key.
key_lenKey length.
dataInput data.
data_lenInput length.
[out]out32-byte HMAC output.

◆ sha256

void(* csilk_crypto_driver_t::sha256)(const uint8_t *data, size_t len, uint8_t out[32])

Compute the SHA-256 hash of a buffer.

Parameters
dataInput data.
lenInput length.
[out]out32-byte hash output.

The documentation for this struct was generated from the following files: