123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205 |
- #ifndef OCRYPTO_SRTP_H
- #define OCRYPTO_SRTP_H
- #include <stddef.h>
- #include <stdint.h>
- #include "ocrypto_aes_key.h"
- #ifdef __cplusplus
- extern "C" {
- #endif
- #define ocrypto_srtp_AuthKeySize (20)
- #define ocrypto_srtp_SaltSize (14)
- #define ocrypto_srtp_MaxKeySize (ocrypto_aes256_KEY_BYTES)
- typedef struct {
-
- uint32_t keySize;
-
- uint32_t tagSize;
-
- uint8_t encrKey[ocrypto_srtp_MaxKeySize];
-
- uint8_t authKey[ocrypto_srtp_AuthKeySize];
-
- uint8_t saltKey[ocrypto_srtp_SaltSize];
- } ocrypto_srtp_context;
- void ocrypto_srtp_setupContext(
- ocrypto_srtp_context *srtpContext,
- ocrypto_srtp_context *srtcpContext,
- const uint8_t *key,
- uint32_t keySize,
- const uint8_t *salt,
- uint32_t tagSize,
- uint32_t ssrc);
- void ocrypto_srtp_encrypt(
- const ocrypto_srtp_context *srtpContext,
- uint8_t *packet,
- const uint8_t *dataBytes,
- size_t numHeaderBytes,
- size_t numDataBytes,
- uint32_t index);
- void ocrypto_srtp_decrypt(
- const ocrypto_srtp_context *srtpContext,
- uint8_t *data,
- const uint8_t *packetBytes,
- size_t numPacketBytes,
- uint32_t index);
- void ocrypto_srtp_authenticate(
- const ocrypto_srtp_context *context,
- uint8_t *tag,
- const uint8_t *bytes,
- size_t numBytes,
- uint32_t index);
- int ocrypto_srtp_verifyAuthentication(
- const ocrypto_srtp_context *context,
- const uint8_t *tag,
- const uint8_t *bytes,
- size_t numBytes,
- uint32_t index);
- #ifdef __cplusplus
- }
- #endif
- #endif
|