From 0879157d3a3408dac514326993b6c5039c37e566 Mon Sep 17 00:00:00 2001 From: Sayed Naser Moravej Date: Sat, 8 Nov 2025 17:07:21 +0330 Subject: [PATCH 1/4] west.yml: Update west to clone libSRTP protocol. add libsrtp to west.yml Signed-off-by: Sayed Naser Moravej --- west.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/west.yml b/west.yml index cafcb2a1b39ea..42dd6136bf375 100644 --- a/west.yml +++ b/west.yml @@ -301,6 +301,10 @@ manifest: - name: libsbc revision: 8e1beda02acb8972e29e6edbb423f7cafe16e445 path: modules/lib/libsbc + - name: libsrtp + url: https://github.com/seyednasermoravej/libsrtp.git + revision: dc70159412c6fc791da8f09a994a8bf0e95cb769 + path: modules/lib/libsrtp - name: littlefs path: modules/fs/littlefs groups: From 382417e456526ef8cf2cb946187a1c5f8809a712 Mon Sep 17 00:00:00 2001 From: Sayed Naser Moravej Date: Mon, 10 Nov 2025 21:59:31 +0330 Subject: [PATCH 2/4] modules: libSRTP glue added to the modules folder. gule files added so Zephyr RTOS can use libSRTP. Signed-off-by: Sayed Naser Moravej --- modules/libsrtp/CMakeLists.txt | 43 +++++++++++++++++++++ modules/libsrtp/Kconfig | 18 +++++++++ modules/libsrtp/config.h | 69 ++++++++++++++++++++++++++++++++++ 3 files changed, 130 insertions(+) create mode 100644 modules/libsrtp/CMakeLists.txt create mode 100644 modules/libsrtp/Kconfig create mode 100644 modules/libsrtp/config.h diff --git a/modules/libsrtp/CMakeLists.txt b/modules/libsrtp/CMakeLists.txt new file mode 100644 index 0000000000000..d346504779c66 --- /dev/null +++ b/modules/libsrtp/CMakeLists.txt @@ -0,0 +1,43 @@ +# Copyright (c) 2025 Sayed Naser Moravej +# SPDX-License-Identifier: Apache-2.0 + +if(CONFIG_LIBSRTP) + +zephyr_include_directories( + ${ZEPHYR_LIBSRTP_MODULE_DIR}/include + ${ZEPHYR_LIBSRTP_MODULE_DIR}/crypto/include + ${CMAKE_CURRENT_SOURCE_DIR} + ${ZEPHYR_LIBSRTP_MODULE_DIR}/test +) + +zephyr_library_named(libsrtp) + +zephyr_library_compile_definitions(MBEDTLS) + +zephyr_library_sources( + ${ZEPHYR_LIBSRTP_MODULE_DIR}/srtp/srtp.c + ${ZEPHYR_LIBSRTP_MODULE_DIR}/crypto/cipher/cipher.c + ${ZEPHYR_LIBSRTP_MODULE_DIR}/crypto/cipher/cipher_test_cases.c + ${ZEPHYR_LIBSRTP_MODULE_DIR}/crypto/cipher/null_cipher.c + ${ZEPHYR_LIBSRTP_MODULE_DIR}/crypto/math/datatypes.c + ${ZEPHYR_LIBSRTP_MODULE_DIR}/crypto/kernel/alloc.c + ${ZEPHYR_LIBSRTP_MODULE_DIR}/crypto/kernel/key.c + ${ZEPHYR_LIBSRTP_MODULE_DIR}/crypto/kernel/err.c + ${ZEPHYR_LIBSRTP_MODULE_DIR}/crypto/kernel/crypto_kernel.c + ${ZEPHYR_LIBSRTP_MODULE_DIR}/crypto/replay/rdb.c + ${ZEPHYR_LIBSRTP_MODULE_DIR}/crypto/replay/rdbx.c + ${ZEPHYR_LIBSRTP_MODULE_DIR}/crypto/hash/auth.c + ${ZEPHYR_LIBSRTP_MODULE_DIR}/crypto/hash/auth_test_cases.c + ${ZEPHYR_LIBSRTP_MODULE_DIR}/test/rtp.c + ${ZEPHYR_LIBSRTP_MODULE_DIR}/crypto/hash/null_auth.c + ${ZEPHYR_LIBSRTP_MODULE_DIR}/test/util.c + ${ZEPHYR_LIBSRTP_MODULE_DIR}/crypto/hash/hmac_mbedtls.c + ${ZEPHYR_LIBSRTP_MODULE_DIR}/crypto/cipher/aes_icm_mbedtls.c + ${ZEPHYR_LIBSRTP_MODULE_DIR}/crypto/cipher/aes_gcm_mbedtls.c +) + +zephyr_library_compile_definitions(libsrtp HAVE_CONFIG_H) + +zephyr_library_link_libraries(mbedTLS) + +endif() diff --git a/modules/libsrtp/Kconfig b/modules/libsrtp/Kconfig new file mode 100644 index 0000000000000..b70f00afedfa0 --- /dev/null +++ b/modules/libsrtp/Kconfig @@ -0,0 +1,18 @@ +# Copyright (c) 2025 Sayed Naser Moravej +# SPDX-License-Identifier: Apache-2.0 + +config LIBSRTP + bool "libsrtp support" + depends on MBEDTLS + select MBEDTLS_CIPHER_AES_ENABLED + select MBEDTLS_CIPHER_CAMELLIA_ENABLED + select MBEDTLS_CIPHER_DES_ENABLED + select MBEDTLS_CIPHER_CHACHA20_ENABLED + select MBEDTLS_CIPHER_CCM_ENABLED + select MBEDTLS_CIPHER_GCM_ENABLED + select MBEDTLS_CIPHER_MODE_XTS_ENABLED + select MBEDTLS_CIPHER_MODE_CBC_ENABLED + select MBEDTLS_CIPHER_MODE_CTR_ENABLED + + help + Enable libsrtp library integration as a Zephyr module. diff --git a/modules/libsrtp/config.h b/modules/libsrtp/config.h new file mode 100644 index 0000000000000..8aed98b76277d --- /dev/null +++ b/modules/libsrtp/config.h @@ -0,0 +1,69 @@ +/* + * Copyright 2025 Sayed Naser Moravej + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include + +#define PACKAGE_VERSION "1.0.0" + +#define PACKAGE_STRING "Zephyr 1.0.0" + +#define ENABLE_DEBUG_LOGGING 1 + +#define CPU_CISC 1 + +#define HAVE_ARPA_INET_H 1 + +#define HAVE_INTTYPES_H 1 + +#define HAVE_NETINET_IN_H 1 + +#define HAVE_STDINT_H 1 + +#define HAVE_STDLIB_H 1 + +#define HAVE_SYS_SOCKET_H 1 + +#define HAVE_SYS_TYPES_H 1 + +#define HAVE_UNISTD_H 1 + +#define HAVE_INET_ATON 1 + +#define HAVE_USLEEP 1 + +#define HAVE_UINT8_T 1 + +#define HAVE_UINT16_T 1 + +#define HAVE_UINT32_T 1 + +#define HAVE_UINT64_T 1 + +#define HAVE_INT32_T 1 + +#define SIZEOF_UNSIGNED_LONG 4 + +#define SIZEOF_UNSIGNED_LONG_LONG 8 + +#define _SYS_SOCKET_H 1 + +#include + +#define MBEDTLS_AES_C + +#define MBEDTLS_CIPHER_C + +#define MBEDTLS_GCM_C + +#define MBEDTLS_CTR_DRBG_C + +#define MBEDTLS_MD_C + +#define MBEDTLS_HMAC_DRBG_C + +#define MBEDTLS 1 + +#define HAVE_INLINE 1 From 5abd38b34a0d2c3d0c4ee0ae0bb9bd19a503313f Mon Sep 17 00:00:00 2001 From: Sayed Naser Moravej Date: Mon, 10 Nov 2025 22:04:19 +0330 Subject: [PATCH 3/4] samples: modules: libsrtp: rtpw: An RTPW example is added. An RTPW is added to test the libSRTP module a hardware with a network connectivity should be connected to a PC and run the example as described in the README.rst file. Signed-off-by: Sayed Naser Moravej --- samples/modules/libsrtp/libsrtp.rst | 5 + samples/modules/libsrtp/rtpw/CMakeLists.txt | 4 + samples/modules/libsrtp/rtpw/Kconfig | 44 +++++ samples/modules/libsrtp/rtpw/README.rst | 106 ++++++++++++ samples/modules/libsrtp/rtpw/prj.conf | 52 ++++++ samples/modules/libsrtp/rtpw/sample.yaml | 10 ++ samples/modules/libsrtp/rtpw/src/main.c | 169 ++++++++++++++++++++ 7 files changed, 390 insertions(+) create mode 100644 samples/modules/libsrtp/libsrtp.rst create mode 100644 samples/modules/libsrtp/rtpw/CMakeLists.txt create mode 100644 samples/modules/libsrtp/rtpw/Kconfig create mode 100644 samples/modules/libsrtp/rtpw/README.rst create mode 100644 samples/modules/libsrtp/rtpw/prj.conf create mode 100644 samples/modules/libsrtp/rtpw/sample.yaml create mode 100644 samples/modules/libsrtp/rtpw/src/main.c diff --git a/samples/modules/libsrtp/libsrtp.rst b/samples/modules/libsrtp/libsrtp.rst new file mode 100644 index 0000000000000..812b296ceae05 --- /dev/null +++ b/samples/modules/libsrtp/libsrtp.rst @@ -0,0 +1,5 @@ +.. zephyr:code-sample-category:: libsrtp + :name: libSRTP + :show-listing: + + These samples demonstrate how to use (S)RTP protocol in Zephyr. diff --git a/samples/modules/libsrtp/rtpw/CMakeLists.txt b/samples/modules/libsrtp/rtpw/CMakeLists.txt new file mode 100644 index 0000000000000..adfaa5fc80fd7 --- /dev/null +++ b/samples/modules/libsrtp/rtpw/CMakeLists.txt @@ -0,0 +1,4 @@ +cmake_minimum_required(VERSION 3.20.0) +find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) +project(rtpw) +target_sources(app PRIVATE src/main.c) diff --git a/samples/modules/libsrtp/rtpw/Kconfig b/samples/modules/libsrtp/rtpw/Kconfig new file mode 100644 index 0000000000000..ae51afda9159f --- /dev/null +++ b/samples/modules/libsrtp/rtpw/Kconfig @@ -0,0 +1,44 @@ +# Copyright (c) 2025 Sayed Naser Moravej +# SPDX-License-Identifier: Apache-2.0 + +mainmenu "RTPW Sample Application" + +config NET_SAMPLE_SRTP_KEY + string "SRTP master key for RTPW example." + default "c1eec3717da76195bb878578790af71c4ee9f859e197a414a78d5abc7451" + help + This key in hexadecimal which is used by the application. You can override it in prj.conf + or via menuconfig / guiconfig. + +choice + prompt "Program mode" + default NET_SAMPLE_SENDER + help + Select whether this application runs as sender or receiver. + +config NET_SAMPLE_SENDER + bool "Sender mode" + help + Build the application as an RTP sender. + +config NET_SAMPLE_RECEIVER + bool "Receiver mode" + help + Build the application as an RTP receiver. + +endchoice + +config NET_CONFIG_PEER_IPV4_ADDR + string + default "10.42.0.1" if NET_SAMPLE_SENDER + default "0.0.0.0" if NET_SAMPLE_RECEIVER + help + Peer IPv4 address used by the RTPW example. + +config NET_SAMPLE_SRTP_SERVER_PORT + int "SRTP port" + default 9999 + help + SRTP port that the application sends or receives over that port. + +source "Kconfig.zephyr" diff --git a/samples/modules/libsrtp/rtpw/README.rst b/samples/modules/libsrtp/rtpw/README.rst new file mode 100644 index 0000000000000..47cfcce65056d --- /dev/null +++ b/samples/modules/libsrtp/rtpw/README.rst @@ -0,0 +1,106 @@ +.. zephyr:code-sample:: rtpw + :name: SRTP client and server + + Send and receive data using (S)RTP protocol. + +Overveiw +******** + +A simple demo of using (S)RTP protocol to send and receive data over network. The sample could be sender or receiver. + +To test (S)RTP via a Linux machine, you should build the libsrtp. + +To test the sender while PC is receiver, the peer IP address should be set in Kconfig file. Next open a terminal and enter command: + +.. code-block:: shell + + ~/libsrtp/test$ ./rtpw -r -k c1eec3717da76195bb878578790af71c4ee9f859e197a414a78d5abc7451 -e 128 -a 0.0.0.0 9999 + +You should see in PC side: + +.. code-block:: console + + Using libsrtp3 3.0.0-pre [0x3000000] + security services: confidentiality message authentication + set master key/salt to c1eec3717da76195bb878578790af71c/4ee9f859e197a414a78d5abc7451 + word: SRTP test0. + word: SRTP test1. + word: SRTP test2. + word: SRTP test3. + +You should see in device side: + +.. code-block:: console + + *** Booting Zephyr OS build v4.2.0-5032-g84d1da7ea2a6 *** + [00:00:00.060,000] net_config: Initializing network + [00:00:00.068,000] net_config: Waiting interface 1 (0x341b0380) to be up... + [00:00:01.651,000] phy_mii: PHY (0) Link speed 100 Mb, full duplex + [00:00:01.660,000] net_config: Interface 1 (0x341b0380) coming up + [00:00:01.670,000] net_config: IPv4 address: 10.42.0.2 + [00:00:01.678,000] rtpw_sample: Using Zephyr 1.0.0 [0x1000000] + [00:00:01.770,000] rtpw_sample: peer IPv4 address: 10.42.0.1. + [00:00:01.779,000] rtpw_sample: my IPv4 address: 10.42.0.2. + [00:00:01.788,000] rtpw_sample: sending word: SRTP test0. + [00:00:02.297,000] rtpw_sample: sending word: SRTP test1. + [00:00:02.806,000] rtpw_sample: sending word: SRTP test2. + [00:00:03.315,000] rtpw_sample: sending word: SRTP test3. + +To test (S)RTP via a Linux machine, you should build the libsrtp. +To test the receiver while PC is sender, the peer IP address should be set in Kconfig file. Next open a terminal and enter command: + +.. code-block:: shell + + ~/libsrtp/test$ ./rtpw -s -k c1eec3717da76195bb878578790af71c4ee9f859e197a414a78d5abc7451 -e 128 -a 9999 + +for example: + +.. code-block:: shell + + ~/libsrtp/test$ ./rtpw -s -k c1eec3717da76195bb878578790af71c4ee9f859e197a414a78d5abc7451 -e 128 -a 10.42.0.2 9999 + +You should see in PC side: + +.. code-block:: console + + Using libsrtp3 3.0.0-pre [0x3000000] + security services: confidentiality message authentication + set master key/salt to c1eec3717da76195bb878578790af71c/4ee9f859e197a414a78d5abc7451 + sending word: abducing + sending word: acidheads + sending word: acidness + sending word: actons + +You should see in device side: + +.. code-block:: console + + *** Booting Zephyr OS build v4.2.0-5032-g84d1da7ea2a6 *** + [00:00:00.060,000] net_config: Initializing network + [00:00:00.068,000] net_config: Waiting interface 1 (0x341b04c0) to be up... + [00:00:01.651,000] phy_mii: PHY (0) Link speed 100 Mb, full duplex + [00:00:01.660,000] net_config: Interface 1 (0x341b04c0) coming up + [00:00:01.670,000] net_config: IPv4 address: 10.42.0.2 + [00:00:01.678,000] rtpw_sample: Using Zephyr 1.0.0 [0x1000000] + [00:00:01.770,000] rtpw_sample: peer IPv4 address: 0.0.0.0. + [00:00:01.779,000] rtpw_sample: my IPv4 address: 10.42.0.2. + [00:00:18.010,000] rtpw_sample: receiving word: abducing + [00:00:18.510,000] rtpw_sample: receiving word: acidheads + [00:00:19.010,000] rtpw_sample: receiving word: acidness + [00:00:19.510,000] rtpw_sample: receiving word: actons + +Configuration +************* + +The sender/receiver type and the SRTP key can be changed via Kconfig file. + +Building and Running +******************** + +This application can be built as follows: + +.. zephyr-app-commands:: + :zephyr-app: samples/modules/libsrtp/rtpw + :host-os: unix + :board: frdm_mcxn947/mcxn947/cpu0 + :goals: build diff --git a/samples/modules/libsrtp/rtpw/prj.conf b/samples/modules/libsrtp/rtpw/prj.conf new file mode 100644 index 0000000000000..d280ee554d588 --- /dev/null +++ b/samples/modules/libsrtp/rtpw/prj.conf @@ -0,0 +1,52 @@ +#network +CONFIG_NETWORKING=y +CONFIG_NET_IPV4=y +CONFIG_NET_IPV6=n +CONFIG_NET_DHCPV4=n +CONFIG_NET_ARP=y +CONFIG_NET_CONFIG_SETTINGS=y +CONFIG_NET_CONFIG_MY_IPV4_ADDR="10.42.0.2" +CONFIG_NET_CONFIG_MY_IPV4_NETMASK="255.255.255.0" +CONFIG_NET_L2_ETHERNET=y +CONFIG_NET_UDP=y +CONFIG_NET_MGMT_EVENT_INFO=y +CONFIG_NET_MGMT=y +CONFIG_NET_MGMT_EVENT_STACK_SIZE=2048 +CONFIG_NET_MGMT_EVENT=y +CONFIG_SLIP_STATISTICS=n +CONFIG_NET_SOCKETS=y + +CONFIG_ENTROPY_GENERATOR=y +CONFIG_TEST_RANDOM_GENERATOR=y +CONFIG_NET_LOG=y +CONFIG_NET_SHELL=y +CONFIG_POSIX_API=y + +# Logging +CONFIG_LOG=y +CONFIG_LOG_DEFAULT_LEVEL=3 + +# Console +CONFIG_SERIAL=y +CONFIG_CONSOLE=y +CONFIG_UART_CONSOLE=y + +# Crypto (mbedTLS) +CONFIG_MBEDTLS=y +CONFIG_MBEDTLS_BUILTIN=y +CONFIG_MBEDTLS_ENABLE_HEAP=y +CONFIG_MBEDTLS_HEAP_SIZE=60000 +CONFIG_MBEDTLS_MD=y +CONFIG_HEAP_MEM_POOL_SIZE=65536 +CONFIG_MBEDTLS_SHA1=y + +# LibSRTP +CONFIG_LIBSRTP=y + +CONFIG_MAIN_STACK_SIZE=4096 +CONFIG_IDLE_STACK_SIZE=2048 +CONFIG_LOG_MODE_IMMEDIATE=y +CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=8192 +CONFIG_NET_MGMT_EVENT_STACK_SIZE=8192 +CONFIG_NET_RX_STACK_SIZE=4096 +CONFIG_NET_TX_STACK_SIZE=2048 diff --git a/samples/modules/libsrtp/rtpw/sample.yaml b/samples/modules/libsrtp/rtpw/sample.yaml new file mode 100644 index 0000000000000..05f098e548228 --- /dev/null +++ b/samples/modules/libsrtp/rtpw/sample.yaml @@ -0,0 +1,10 @@ +sample: + name: sender and receiver (S)RTP protocol +tests: + samples.modules.libsrtp.rtpw: + depends_on: netif + tags: + - net + build_only: true + platform_type: + - mcu diff --git a/samples/modules/libsrtp/rtpw/src/main.c b/samples/modules/libsrtp/rtpw/src/main.c new file mode 100644 index 0000000000000..4562ef51538ee --- /dev/null +++ b/samples/modules/libsrtp/rtpw/src/main.c @@ -0,0 +1,169 @@ +/* + * Copyright 2025 Sayed Naser Moravej + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include +#include +#include + +#include +#include "srtp.h" +#include "rtp.h" +#include "util.h" + +#define MAX_WORD_LEN 128 +#define MAX_KEY_LEN 96 + +LOG_MODULE_REGISTER(rtpw_sample, LOG_LEVEL_INF); + +int main(void) +{ + char word[MAX_WORD_LEN]; + int sock, ret; + struct in_addr rcvr_addr; + struct sockaddr_in name; + char key[MAX_KEY_LEN]; + srtp_policy_t policy; + srtp_err_status_t status; + uint32_t ssrc = 0xdeadbeefu; /* ssrc value hardcoded for now */ + + memset(&policy, 0x0, sizeof(srtp_policy_t)); + + LOG_INF("Using %s [0x%x]\n", srtp_get_version_string(), srtp_get_version()); + + /* initialize srtp library */ + status = srtp_init(); + if (status) { + LOG_ERR("srtp initialization failed with error code %d.", status); + return 0; + } + + /* set address */ + LOG_INF("peer IPv4 address: %s.", CONFIG_NET_CONFIG_PEER_IPV4_ADDR); + LOG_INF("my IPv4 address: %s.", CONFIG_NET_CONFIG_MY_IPV4_ADDR); + + if (inet_pton(AF_INET, CONFIG_NET_CONFIG_PEER_IPV4_ADDR, &rcvr_addr) != 1) { + LOG_ERR("Invalid IPv4 address: %s.", CONFIG_NET_CONFIG_PEER_IPV4_ADDR); + return 0; + } + + /* open socket */ + sock = socket(PF_INET, SOCK_DGRAM, IPPROTO_UDP); + if (sock < 0) { + LOG_ERR("couldn't open socket."); + return 0; + } + + memset(&name, 0, sizeof(struct sockaddr_in)); + name.sin_addr = rcvr_addr; + name.sin_family = PF_INET; + name.sin_port = htons(CONFIG_NET_SAMPLE_SRTP_SERVER_PORT); + + /* set up the srtp policy and master key + * create policy structure, using the default mechanisms. + */ + srtp_crypto_policy_set_rtp_default(&policy.rtp); + srtp_crypto_policy_set_rtcp_default(&policy.rtcp); + policy.ssrc.type = ssrc_specific; + policy.ssrc.value = ssrc; + policy.key = (uint8_t *)key; + policy.next = NULL; + policy.window_size = 128; + policy.allow_repeat_tx = 0; + policy.rtp.sec_serv = sec_serv_conf_and_auth; + policy.rtcp.sec_serv = sec_serv_none; /* we don't do RTCP anyway */ + size_t key_len = hex2bin(CONFIG_NET_SAMPLE_SRTP_KEY, + strlen(CONFIG_NET_SAMPLE_SRTP_KEY), key, sizeof(key)); + + /* check that hex string is the right length */ + if (key_len != policy.rtp.cipher_key_len) { + LOG_ERR("wrong number of digits in key (should be %d digits, found %d).", + 2 * policy.rtp.cipher_key_len, 2 * key_len); + return 0; + } + +#ifdef CONFIG_NET_SAMPLE_SENDER + /* initialize sender's rtp and srtp contexts */ + rtp_sender_t snd; + + snd = rtp_sender_alloc(); + if (snd == NULL) { + LOG_ERR("malloc() failed."); + return 0; + } + rtp_sender_init(snd, sock, name, ssrc); + status = rtp_sender_init_srtp(snd, &policy); + if (status) { + LOG_ERR("srtp_create() failed with code %d.", status); + return 0; + } + + size_t word_len; + /* Up-count the buffer, then send them off */ + for (int i = 0; i < 1000; i++) { + snprintf(word, sizeof(word), "SRTP test%d.", i); + word_len = strlen(word) + 1; /* plus one for null */ + + if (word_len > MAX_WORD_LEN) { + LOG_ERR("word %s too large to send.", word); + } else { + rtp_sendto(snd, word, word_len); + LOG_INF("sending word: %s", word); + } + k_msleep(500); + } + + rtp_sender_deinit_srtp(snd); + rtp_sender_dealloc(snd); + +#elif defined(CONFIG_NET_SAMPLE_RECEIVER) + rtp_receiver_t rcvr; + + if (bind(sock, (struct sockaddr *)&name, sizeof(name)) < 0) { + close(sock); + LOG_ERR("socket bind error."); + return 0; + } + + rcvr = rtp_receiver_alloc(); + if (rcvr == NULL) { + LOG_ERR("malloc() failed."); + return 0; + } + rtp_receiver_init(rcvr, sock, name, ssrc); + status = rtp_receiver_init_srtp(rcvr, &policy); + if (status) { + LOG_ERR("srtp_create() failed with code %d.", status); + return 0; + } + + /* get next word and loop */ + size_t word_len; + + while (true) { + len = MAX_WORD_LEN; + if (rtp_recvfrom(rcvr, word, &word_len) > -1) { + LOG_INF("receiving word: %s", word); + } + } + + rtp_receiver_deinit_srtp(rcvr); + rtp_receiver_dealloc(rcvr); +#else +#error "Either SENDER or RECEIVER should be defined." +#endif + ret = close(sock); + if (ret < 0) { + LOG_ERR("Failed to close socket"); + } + + status = srtp_shutdown(); + if (status) { + LOG_ERR("srtp shutdown failed with error code %d.", status); + return 0; + } + return 0; +} From 746c7ba55e208a1aeb2fe3693696b1a3c7f464f9 Mon Sep 17 00:00:00 2001 From: Sayed Naser Moravej Date: Mon, 10 Nov 2025 22:08:15 +0330 Subject: [PATCH 4/4] MAINTAINERS: libsrtp: add @josuah as maintainer Introduce the first integration of the libSRTP library, providing support for the Secure Real-time Transport Protocol (SRTP). Co-authored-by: Josuah Demangeon Signed-off-by: Sayed Naser Moravej --- MAINTAINERS.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/MAINTAINERS.yml b/MAINTAINERS.yml index d14a2e1973cfe..62a8371235e94 100644 --- a/MAINTAINERS.yml +++ b/MAINTAINERS.yml @@ -5853,6 +5853,16 @@ West: labels: - "area: Audio" +"West project: libsrtp": + status: maintained + maintainers: + - josuah + files: + - modules/libsrtp/ + - samples/modules/libsrtp/ + labels: + - "area: Networking" + "West project: littlefs": status: odd fixes files: