nrfxlib API 0.1.0
Loading...
Searching...
No Matches
ocrypto_srtp.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2016 - 2024 Nordic Semiconductor ASA
3 * Copyright (c) since 2013 Oberon microsystems AG
4 *
5 * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
6 */
7
8
18#ifndef OCRYPTO_SRTP_H
19#define OCRYPTO_SRTP_H
20
21#include <stddef.h>
22#include <stdint.h>
23
24#include "ocrypto_aes_key.h"
25
26
27#ifdef __cplusplus
28extern "C" {
29#endif
30
31
35#define ocrypto_srtp_AUTH_KEY_SIZE (20)
36
40#define ocrypto_srtp_SALT_SIZE (14)
41
45#define ocrypto_srtp_MAX_KEY_SIZE (ocrypto_aes256_KEY_BYTES)
46
50typedef struct {
54 uint32_t key_size;
55
59 uint32_t tag_size;
60
64 uint8_t encr_key[ocrypto_srtp_MAX_KEY_SIZE];
65
70 uint8_t auth_key[ocrypto_srtp_AUTH_KEY_SIZE];
71
76 uint8_t salt_key[ocrypto_srtp_SALT_SIZE];
78
91 ocrypto_srtp_ctx *srtp_ctx,
92 ocrypto_srtp_ctx *srtcp_ctx,
93 const uint8_t *key,
94 uint32_t key_size,
95 const uint8_t *salt,
96 uint32_t tag_size,
97 uint32_t ssrc);
98
113 const ocrypto_srtp_ctx *srtp_ctx,
114 uint8_t *packet,
115 const uint8_t *data_bytes,
116 size_t num_header_bytes,
117 size_t num_data_bytes,
118 uint32_t index);
119
130 const ocrypto_srtp_ctx *srtp_ctx,
131 uint8_t *data,
132 const uint8_t *packet_bytes,
133 size_t num_packet_bytes,
134 uint32_t index);
135
146 const ocrypto_srtp_ctx *srtp_ctx,
147 uint8_t *tag,
148 const uint8_t *bytes,
149 size_t num_bytes,
150 uint32_t index);
151
165 const ocrypto_srtp_ctx *srtp_ctx,
166 const uint8_t *tag,
167 const uint8_t *bytes,
168 size_t num_bytes,
169 uint32_t index);
170
171#ifdef __cplusplus
172}
173#endif
174
175#endif
176
int ocrypto_srtp_verify_authentication(const ocrypto_srtp_ctx *srtp_ctx, const uint8_t *tag, const uint8_t *bytes, size_t num_bytes, uint32_t index)
#define ocrypto_srtp_MAX_KEY_SIZE
Definition: ocrypto_srtp.h:45
void ocrypto_srtp_authenticate(const ocrypto_srtp_ctx *srtp_ctx, uint8_t *tag, const uint8_t *bytes, size_t num_bytes, uint32_t index)
void ocrypto_srtp_decrypt(const ocrypto_srtp_ctx *srtp_ctx, uint8_t *data, const uint8_t *packet_bytes, size_t num_packet_bytes, uint32_t index)
#define ocrypto_srtp_AUTH_KEY_SIZE
Definition: ocrypto_srtp.h:35
#define ocrypto_srtp_SALT_SIZE
Definition: ocrypto_srtp.h:40
void ocrypto_srtp_setup_ctx(ocrypto_srtp_ctx *srtp_ctx, ocrypto_srtp_ctx *srtcp_ctx, const uint8_t *key, uint32_t key_size, const uint8_t *salt, uint32_t tag_size, uint32_t ssrc)
void ocrypto_srtp_encrypt(const ocrypto_srtp_ctx *srtp_ctx, uint8_t *packet, const uint8_t *data_bytes, size_t num_header_bytes, size_t num_data_bytes, uint32_t index)
uint32_t tag_size
Definition: ocrypto_srtp.h:59
uint32_t key_size
Definition: ocrypto_srtp.h:54
Definition: ocrypto_srtp.h:50