Skip to content

Commit ee0d0fe

Browse files
committed
esp_libsrtp: Add wrapper for libsrtp
1 parent bf673bc commit ee0d0fe

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+21570
-0
lines changed

.github/workflows/upload_component.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,6 @@ jobs:
2222
esp_new_jpeg;
2323
esp_audio_effects;
2424
esp_video_codec;
25+
esp_libsrtp;
2526
namespace: "espressif"
2627
api_token: ${{ secrets.IDF_COMPONENT_API_TOKEN }}

esp_libsrtp/CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Changelog
2+
3+
## v1.0.0
4+
5+
### Features
6+
7+
- Sync with `libsrtp` v3.0.0, commit tag: `7d20c51`
8+
- Return directly when do `srtp_cipher_type_test` to skip cipher test
9+
- Return directly when do `srtp_auth_type_test` to skip auth test
10+
- Remove unused code and doc to decrease code size

esp_libsrtp/CMakeLists.txt

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
cmake_minimum_required(VERSION 3.5)
2+
3+
set(SOURCES_C
4+
libsrtp/srtp/srtp.c
5+
)
6+
7+
set(CIPHERS_SOURCES_C
8+
libsrtp/crypto/cipher/cipher.c
9+
libsrtp/crypto/cipher/null_cipher.c
10+
)
11+
12+
list(APPEND CIPHERS_SOURCES_C
13+
libsrtp/crypto/cipher/aes.c
14+
libsrtp/crypto/cipher/aes_icm.c
15+
libsrtp/crypto/cipher/cipher_test_cases.c
16+
)
17+
18+
set(HASHES_SOURCES_C
19+
libsrtp/crypto/hash/auth.c
20+
libsrtp/crypto/hash/null_auth.c
21+
)
22+
23+
list(APPEND HASHES_SOURCES_C
24+
libsrtp/crypto/hash/hmac.c
25+
libsrtp/crypto/hash/sha1.c
26+
libsrtp/crypto/hash/auth_test_cases.c
27+
)
28+
29+
set(KERNEL_SOURCES_C
30+
libsrtp/crypto/kernel/alloc.c
31+
libsrtp/crypto/kernel/crypto_kernel.c
32+
libsrtp/crypto/kernel/err.c
33+
libsrtp/crypto/kernel/key.c
34+
)
35+
36+
set(MATH_SOURCES_C
37+
libsrtp/crypto/math/datatypes.c
38+
)
39+
40+
set(REPLAY_SOURCES_C
41+
libsrtp/crypto/replay/rdb.c
42+
libsrtp/crypto/replay/rdbx.c
43+
)
44+
45+
set(SRTP_SRCS
46+
${SOURCES_C}
47+
${CIPHERS_SOURCES_C}
48+
${HASHES_SOURCES_C}
49+
${KERNEL_SOURCES_C}
50+
${MATH_SOURCES_C}
51+
${REPLAY_SOURCES_C}
52+
)
53+
54+
set(SRTP_INCLUDE_DIRS
55+
esp-port
56+
libsrtp/include
57+
libsrtp/crypto/include
58+
)
59+
60+
idf_component_register(SRCS ${SRTP_SRCS} INCLUDE_DIRS ${SRTP_INCLUDE_DIRS})
61+
target_compile_definitions(${COMPONENT_LIB} PUBLIC "-DHAVE_CONFIG_H")

esp_libsrtp/LICENSE

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
/*
2+
*
3+
* Copyright (c) 2001-2017 Cisco Systems, Inc.
4+
* All rights reserved.
5+
*
6+
* Redistribution and use in source and binary forms, with or without
7+
* modification, are permitted provided that the following conditions
8+
* are met:
9+
*
10+
* Redistributions of source code must retain the above copyright
11+
* notice, this list of conditions and the following disclaimer.
12+
*
13+
* Redistributions in binary form must reproduce the above
14+
* copyright notice, this list of conditions and the following
15+
* disclaimer in the documentation and/or other materials provided
16+
* with the distribution.
17+
*
18+
* Neither the name of the Cisco Systems, Inc. nor the names of its
19+
* contributors may be used to endorse or promote products derived
20+
* from this software without specific prior written permission.
21+
*
22+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23+
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24+
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
25+
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
26+
* COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
27+
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
28+
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
29+
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30+
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
31+
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
32+
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
33+
* OF THE POSSIBILITY OF SUCH DAMAGE.
34+
*
35+
*/

esp_libsrtp/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
## esp-libsrtp
2+
3+
`esp-libsrtp` is a wrapper for **SRTP (Secure Real-time Transport Protocol)** realization [libSRTP](https://github.com/cisco/libsrtp) version v3.0.0. This library is designed to work on **ESP32 series platforms**, providing secure encryption and authentication for real-time media streams.

esp_libsrtp/esp-port/config.h

Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
/* clang-format off */
2+
3+
#include <stdbool.h>
4+
5+
/* Define to the full name and version of this package. */
6+
#define PACKAGE_VERSION "3.0.0"
7+
8+
/* Define to the version of this package. */
9+
#define PACKAGE_STRING "esp_port 3.0.0"
10+
11+
/* Define to enabled debug logging for all modules. */
12+
/* #undef ENABLE_DEBUG_LOGGING */
13+
14+
/* Logging statements will be written to this file. */
15+
/* #undef ERR_REPORTING_FILE */
16+
17+
/* Define to redirect logging to stdout. */
18+
/* #undef ERR_REPORTING_STDOUT */
19+
20+
/* Define this to use OpenSSL crypto. */
21+
/* #undef OPENSSL */
22+
23+
/* Define this to use AES-GCM. */
24+
/* #undef GCM */
25+
26+
/* Define if building for a CISC machine (e.g. Intel). */
27+
#define CPU_CISC 1
28+
29+
/* Define if building for a RISC machine (assume slow byte access). */
30+
/* #undef CPU_RISC */
31+
32+
/* Define to use X86 inlined assembly code */
33+
/* #undef HAVE_X86 */
34+
35+
/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most
36+
significant byte first (like Motorola and SPARC, unlike Intel). */
37+
/* #undef WORDS_BIGENDIAN */
38+
39+
/* Define to 1 if you have the <arpa/inet.h> header file. */
40+
#define HAVE_ARPA_INET_H 1
41+
42+
/* Define to 1 if you have the <byteswap.h> header file. */
43+
/* #undef HAVE_BYTESWAP_H */
44+
45+
/* Define to 1 if you have the <inttypes.h> header file. */
46+
#define HAVE_INTTYPES_H 1
47+
48+
/* Define to 1 if you have the <machine/types.h> header file. */
49+
#define HAVE_MACHINE_TYPES_H 1
50+
51+
/* Define to 1 if you have the <netinet/in.h> header file. */
52+
#define HAVE_NETINET_IN_H 1
53+
54+
/* Define to 1 if you have the <stdint.h> header file. */
55+
#define HAVE_STDINT_H 1
56+
57+
/* Define to 1 if you have the <stdlib.h> header file. */
58+
#define HAVE_STDLIB_H 1
59+
60+
/* Define to 1 if you have the <sys/int_types.h> header file. */
61+
/* #undef HAVE_SYS_INT_TYPES_H */
62+
63+
/* Define to 1 if you have the <sys/socket.h> header file. */
64+
#define HAVE_SYS_SOCKET_H 1
65+
66+
/* Define to 1 if you have the <sys/types.h> header file. */
67+
#define HAVE_SYS_TYPES_H 1
68+
69+
/* Define to 1 if you have the <unistd.h> header file. */
70+
#define HAVE_UNISTD_H 1
71+
72+
/* Define to 1 if you have the <windows.h> header file. */
73+
/* #undef HAVE_WINDOWS_H */
74+
75+
/* Define to 1 if you have the <winsock2.h> header file. */
76+
/* #undef HAVE_WINSOCK2_H */
77+
78+
/* Define to 1 if you have the `inet_aton' function. */
79+
#define HAVE_INET_ATON 1
80+
81+
/* Define to 1 if you have the `sigaction' function. */
82+
/* #undef HAVE_SIGACTION */
83+
84+
/* Define to 1 if you have the `usleep' function. */
85+
#define HAVE_USLEEP 1
86+
87+
/* Define to 1 if the system has the type `uint8_t'. */
88+
#define HAVE_UINT8_T 1
89+
90+
/* Define to 1 if the system has the type `uint16_t'. */
91+
#define HAVE_UINT16_T 1
92+
93+
/* Define to 1 if the system has the type `uint32_t'. */
94+
#define HAVE_UINT32_T 1
95+
96+
/* Define to 1 if the system has the type `uint64_t'. */
97+
#define HAVE_UINT64_T 1
98+
99+
/* Define to 1 if the system has the type `int32_t'. */
100+
#define HAVE_INT32_T 1
101+
102+
/* The size of `unsigned long', as computed by sizeof. */
103+
#define SIZEOF_UNSIGNED_LONG 4
104+
105+
/* The size of `unsigned long long', as computed by sizeof. */
106+
#define SIZEOF_UNSIGNED_LONG_LONG 8
107+
108+
/* Define inline to what is supported by compiler */
109+
#define HAVE_INLINE 1
110+
/* #undef HAVE___INLINE */
111+
#ifndef HAVE_INLINE
112+
#ifdef HAVE___INLINE
113+
#define inline __inline
114+
#else
115+
#define inline
116+
#endif
117+
#endif

esp_libsrtp/idf_component.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
description: Espressif wrapper for libSRTP
2+
issues: https://github.com/espressif/esp-adf/issues
3+
repository: https://github.com/espressif/esp-adf-libs.git
4+
url: https://github.com/espressif/esp-adf-libs/tree/master/esp_libsrtp
5+
version: 1.0.0
6+
tags:
7+
- srtp

esp_libsrtp/libsrtp/LICENSE

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
/*
2+
*
3+
* Copyright (c) 2001-2017 Cisco Systems, Inc.
4+
* All rights reserved.
5+
*
6+
* Redistribution and use in source and binary forms, with or without
7+
* modification, are permitted provided that the following conditions
8+
* are met:
9+
*
10+
* Redistributions of source code must retain the above copyright
11+
* notice, this list of conditions and the following disclaimer.
12+
*
13+
* Redistributions in binary form must reproduce the above
14+
* copyright notice, this list of conditions and the following
15+
* disclaimer in the documentation and/or other materials provided
16+
* with the distribution.
17+
*
18+
* Neither the name of the Cisco Systems, Inc. nor the names of its
19+
* contributors may be used to endorse or promote products derived
20+
* from this software without specific prior written permission.
21+
*
22+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23+
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24+
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
25+
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
26+
* COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
27+
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
28+
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
29+
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30+
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
31+
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
32+
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
33+
* OF THE POSSIBILITY OF SUCH DAMAGE.
34+
*
35+
*/

0 commit comments

Comments
 (0)