Compy 0.2.0
A lightweight RTSP 1.0 server library for embedded systems
Loading...
Searching...
No Matches
crypto.h
Go to the documentation of this file.
1
13#pragma once
14
15#include <stddef.h>
16#include <stdint.h>
17
18#include <unistd.h>
19
23typedef void Compy_CryptoTlsCtx;
24
29
33typedef struct {
35 Compy_CryptoTlsCtx *(*ctx_new)(const char *cert_path, const char *key_path);
36
38 void (*ctx_free)(Compy_CryptoTlsCtx *ctx);
39
41 Compy_CryptoTlsConn *(*accept)(Compy_CryptoTlsCtx *ctx, int fd);
42
44 void (*conn_free)(Compy_CryptoTlsConn *conn);
45
47 ssize_t (*write)(Compy_CryptoTlsConn *conn, const void *data, size_t len);
48
51 ssize_t (*read)(Compy_CryptoTlsConn *conn, void *buf, size_t len);
52
54 int (*shutdown)(Compy_CryptoTlsConn *conn);
55
57 size_t (*pending)(Compy_CryptoTlsConn *conn);
58
69 int (*ctx_set_cipher_preference)(Compy_CryptoTlsCtx *ctx, int pref);
71
78typedef struct {
83 void (*aes128_ecb)(
84 const uint8_t key[16], const uint8_t in[16], uint8_t out[16]);
85
91 void (*aes128_ctr)(
92 const uint8_t key[16], const uint8_t iv[16], uint8_t *data, size_t len);
93
97 void (*hmac_sha1)(
98 const uint8_t *key, size_t key_len, const uint8_t *data,
99 size_t data_len, uint8_t out[20]);
100
105 int (*random_bytes)(uint8_t *buf, size_t len);
107
112
void Compy_CryptoTlsConn
Opaque TLS connection handle (backend-specific).
Definition crypto.h:28
const Compy_CryptoTlsOps compy_crypto_tls_ops
The TLS operations singleton, defined by the compiled backend.
Definition mbedtls.c:416
const Compy_CryptoSrtpOps compy_crypto_srtp_ops
The SRTP operations singleton, defined by the compiled backend.
Definition mbedtls.c:428
void Compy_CryptoTlsCtx
Opaque TLS context handle (backend-specific).
Definition crypto.h:23
SRTP cryptographic operations provided by the compiled backend.
Definition crypto.h:78
TLS operations provided by the compiled backend.
Definition crypto.h:33