Skip to content

Commit 382417e

Browse files
modules: libSRTP glue added to the modules folder.
gule files added so Zephyr RTOS can use libSRTP. Signed-off-by: Sayed Naser Moravej <seyednasermoravej@gmail.com>
1 parent 0879157 commit 382417e

File tree

3 files changed

+130
-0
lines changed

3 files changed

+130
-0
lines changed

modules/libsrtp/CMakeLists.txt

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# Copyright (c) 2025 Sayed Naser Moravej <seyednasermoravej@gmail.com>
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
if(CONFIG_LIBSRTP)
5+
6+
zephyr_include_directories(
7+
${ZEPHYR_LIBSRTP_MODULE_DIR}/include
8+
${ZEPHYR_LIBSRTP_MODULE_DIR}/crypto/include
9+
${CMAKE_CURRENT_SOURCE_DIR}
10+
${ZEPHYR_LIBSRTP_MODULE_DIR}/test
11+
)
12+
13+
zephyr_library_named(libsrtp)
14+
15+
zephyr_library_compile_definitions(MBEDTLS)
16+
17+
zephyr_library_sources(
18+
${ZEPHYR_LIBSRTP_MODULE_DIR}/srtp/srtp.c
19+
${ZEPHYR_LIBSRTP_MODULE_DIR}/crypto/cipher/cipher.c
20+
${ZEPHYR_LIBSRTP_MODULE_DIR}/crypto/cipher/cipher_test_cases.c
21+
${ZEPHYR_LIBSRTP_MODULE_DIR}/crypto/cipher/null_cipher.c
22+
${ZEPHYR_LIBSRTP_MODULE_DIR}/crypto/math/datatypes.c
23+
${ZEPHYR_LIBSRTP_MODULE_DIR}/crypto/kernel/alloc.c
24+
${ZEPHYR_LIBSRTP_MODULE_DIR}/crypto/kernel/key.c
25+
${ZEPHYR_LIBSRTP_MODULE_DIR}/crypto/kernel/err.c
26+
${ZEPHYR_LIBSRTP_MODULE_DIR}/crypto/kernel/crypto_kernel.c
27+
${ZEPHYR_LIBSRTP_MODULE_DIR}/crypto/replay/rdb.c
28+
${ZEPHYR_LIBSRTP_MODULE_DIR}/crypto/replay/rdbx.c
29+
${ZEPHYR_LIBSRTP_MODULE_DIR}/crypto/hash/auth.c
30+
${ZEPHYR_LIBSRTP_MODULE_DIR}/crypto/hash/auth_test_cases.c
31+
${ZEPHYR_LIBSRTP_MODULE_DIR}/test/rtp.c
32+
${ZEPHYR_LIBSRTP_MODULE_DIR}/crypto/hash/null_auth.c
33+
${ZEPHYR_LIBSRTP_MODULE_DIR}/test/util.c
34+
${ZEPHYR_LIBSRTP_MODULE_DIR}/crypto/hash/hmac_mbedtls.c
35+
${ZEPHYR_LIBSRTP_MODULE_DIR}/crypto/cipher/aes_icm_mbedtls.c
36+
${ZEPHYR_LIBSRTP_MODULE_DIR}/crypto/cipher/aes_gcm_mbedtls.c
37+
)
38+
39+
zephyr_library_compile_definitions(libsrtp HAVE_CONFIG_H)
40+
41+
zephyr_library_link_libraries(mbedTLS)
42+
43+
endif()

modules/libsrtp/Kconfig

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Copyright (c) 2025 Sayed Naser Moravej <seyednasermoravej@gmail.com>
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
config LIBSRTP
5+
bool "libsrtp support"
6+
depends on MBEDTLS
7+
select MBEDTLS_CIPHER_AES_ENABLED
8+
select MBEDTLS_CIPHER_CAMELLIA_ENABLED
9+
select MBEDTLS_CIPHER_DES_ENABLED
10+
select MBEDTLS_CIPHER_CHACHA20_ENABLED
11+
select MBEDTLS_CIPHER_CCM_ENABLED
12+
select MBEDTLS_CIPHER_GCM_ENABLED
13+
select MBEDTLS_CIPHER_MODE_XTS_ENABLED
14+
select MBEDTLS_CIPHER_MODE_CBC_ENABLED
15+
select MBEDTLS_CIPHER_MODE_CTR_ENABLED
16+
17+
help
18+
Enable libsrtp library integration as a Zephyr module.

modules/libsrtp/config.h

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
/*
2+
* Copyright 2025 Sayed Naser Moravej <seyednasermoravej@gmail.com>
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
#include <stdbool.h>
8+
9+
#define PACKAGE_VERSION "1.0.0"
10+
11+
#define PACKAGE_STRING "Zephyr 1.0.0"
12+
13+
#define ENABLE_DEBUG_LOGGING 1
14+
15+
#define CPU_CISC 1
16+
17+
#define HAVE_ARPA_INET_H 1
18+
19+
#define HAVE_INTTYPES_H 1
20+
21+
#define HAVE_NETINET_IN_H 1
22+
23+
#define HAVE_STDINT_H 1
24+
25+
#define HAVE_STDLIB_H 1
26+
27+
#define HAVE_SYS_SOCKET_H 1
28+
29+
#define HAVE_SYS_TYPES_H 1
30+
31+
#define HAVE_UNISTD_H 1
32+
33+
#define HAVE_INET_ATON 1
34+
35+
#define HAVE_USLEEP 1
36+
37+
#define HAVE_UINT8_T 1
38+
39+
#define HAVE_UINT16_T 1
40+
41+
#define HAVE_UINT32_T 1
42+
43+
#define HAVE_UINT64_T 1
44+
45+
#define HAVE_INT32_T 1
46+
47+
#define SIZEOF_UNSIGNED_LONG 4
48+
49+
#define SIZEOF_UNSIGNED_LONG_LONG 8
50+
51+
#define _SYS_SOCKET_H 1
52+
53+
#include <zephyr/net/socket.h>
54+
55+
#define MBEDTLS_AES_C
56+
57+
#define MBEDTLS_CIPHER_C
58+
59+
#define MBEDTLS_GCM_C
60+
61+
#define MBEDTLS_CTR_DRBG_C
62+
63+
#define MBEDTLS_MD_C
64+
65+
#define MBEDTLS_HMAC_DRBG_C
66+
67+
#define MBEDTLS 1
68+
69+
#define HAVE_INLINE 1

0 commit comments

Comments
 (0)