Csilk 0.2.1
A lightweight, high-performance C HTTP web framework
Loading...
Searching...
No Matches
cipher.h File Reference

Pluggable cryptographic primitive driver interface. More...

#include <stddef.h>
#include <stdint.h>
Include dependency graph for cipher.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  csilk_cipher_driver_t
 Virtual function table implemented by each cipher backend. More...
 

Macros

#define CSILK_AES256_KEY_SIZE   32
 AES-256 key length in bytes (32 bytes = 256 bits).
 
#define CSILK_GCM_IV_SIZE   12
 GCM initialisation vector (nonce) length in bytes (96 bits).
 
#define CSILK_GCM_TAG_SIZE   16
 GCM authentication tag length in bytes (128 bits).
 
#define CSILK_RSA_KEY_BITS   2048
 RSA key size in bits for key generation.
 
#define CSILK_RSA_KEY_SIZE   256
 RSA ciphertext output size in bytes (256 bytes for RSA-2048).
 
#define CSILK_RSA_SIGNATURE_SIZE   256
 RSA signature output size in bytes (256 bytes for RSA-2048).
 

Detailed Description

Pluggable cryptographic primitive driver interface.

Defines the virtual function table (csilk_cipher_driver_t) that abstracts symmetric (AES-256-GCM), asymmetric (RSA-OAEP), signing (RSA-PSS), and key-generation operations. Implementations may use OpenSSL, BearSSL, or hardware-backed keystores.

The driver is set per-server via csilk_server_set_cipher_driver() and propagated to each request context. Built-in functions in internal.h (e.g., _csilk_symmetric_encrypt) dispatch through this driver when one is installed, falling back to the software implementation otherwise.

All functions return 0 on success and -1 on failure.

Macro Definition Documentation

◆ CSILK_AES256_KEY_SIZE

#define CSILK_AES256_KEY_SIZE   32

AES-256 key length in bytes (32 bytes = 256 bits).

◆ CSILK_GCM_IV_SIZE

#define CSILK_GCM_IV_SIZE   12

GCM initialisation vector (nonce) length in bytes (96 bits).

◆ CSILK_GCM_TAG_SIZE

#define CSILK_GCM_TAG_SIZE   16

GCM authentication tag length in bytes (128 bits).

◆ CSILK_RSA_KEY_BITS

#define CSILK_RSA_KEY_BITS   2048

RSA key size in bits for key generation.

◆ CSILK_RSA_KEY_SIZE

#define CSILK_RSA_KEY_SIZE   256

RSA ciphertext output size in bytes (256 bytes for RSA-2048).

◆ CSILK_RSA_SIGNATURE_SIZE

#define CSILK_RSA_SIGNATURE_SIZE   256

RSA signature output size in bytes (256 bytes for RSA-2048).