Skip to content

Commit c55b114

Browse files
committed
Merge branch 'bugfix/add_esp_peer_v1.2.4' into 'main'
Add esp_peer v1.2.4 See merge request adf/esp-webrtc-solution!42
2 parents 0ad48d5 + 01c6bce commit c55b114

File tree

7 files changed

+27
-3
lines changed

7 files changed

+27
-3
lines changed

components/esp_peer/CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
# Changelog
22

3+
## v1.2.4
4+
5+
### Bug Fixes
6+
7+
- Fixed some turn server can not connect
8+
- Improve connectivity stability use relay server
9+
- Fixed `mbedtls_ssl_write` fail due to entropy freed
10+
- Fixed crash when keep alive checking during disconnect
11+
- Added DTLS key print for wireshark analysis
12+
313
## v1.2.3
414

515
### Features

components/esp_peer/idf_component.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
description: Espressif PeerConnection Library
2-
version: 1.2.3
2+
version: 1.2.4
33
url: "https://github.com/espressif/esp-webrtc-solution/tree/main/components/esp_peer"
44
documentation: "https://github.com/espressif/esp-webrtc-solution/tree/main/components/esp_peer/README.md"
55
issues: "https://github.com/espressif/esp-webrtc-solution/issues"
11 KB
Binary file not shown.
17.5 KB
Binary file not shown.
11 KB
Binary file not shown.
11 KB
Binary file not shown.

components/esp_peer/src/dtls_srtp.c

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535

3636
#define DTLS_SIGN_ONCE
3737
#define DTLS_MTU_SIZE 1500
38+
// #define DUMP_DTLS_KEY
3839

3940
#define BREAK_ON_FAIL(ret) \
4041
if (ret != 0) { \
@@ -55,6 +56,7 @@ static bool already_signed = false;
5556
static mbedtls_ctr_drbg_context signed_ctr_drbg;
5657
static mbedtls_x509_crt signed_cert;
5758
static mbedtls_pk_context signed_pkey;
59+
static mbedtls_entropy_context signed_entropy;
5860
#endif
5961

6062
static void dtls_srtp_x509_digest(const mbedtls_x509_crt *crt, char *buf)
@@ -158,6 +160,7 @@ static int dtls_srtp_try_gen_cert(dtls_srtp_t *dtls_srtp)
158160
dtls_srtp->ctr_drbg = signed_ctr_drbg;
159161
dtls_srtp->cert = signed_cert;
160162
dtls_srtp->pkey = signed_pkey;
163+
dtls_srtp->entropy = signed_entropy;
161164
return 0;
162165
}
163166
#endif
@@ -174,6 +177,7 @@ static int dtls_srtp_try_gen_cert(dtls_srtp_t *dtls_srtp)
174177
signed_ctr_drbg = dtls_srtp->ctr_drbg;
175178
signed_cert = dtls_srtp->cert;
176179
signed_pkey = dtls_srtp->pkey;
180+
signed_entropy = dtls_srtp->entropy;
177181
#endif
178182
return 0;
179183
}
@@ -269,8 +273,9 @@ void dtls_srtp_deinit(dtls_srtp_t *dtls_srtp)
269273
}
270274
mbedtls_ssl_free(&dtls_srtp->ssl);
271275
mbedtls_ssl_config_free(&dtls_srtp->conf);
272-
mbedtls_entropy_free(&dtls_srtp->entropy);
276+
273277
if (already_signed == false) {
278+
mbedtls_entropy_free(&dtls_srtp->entropy);
274279
mbedtls_x509_crt_free(&dtls_srtp->cert);
275280
mbedtls_pk_free(&dtls_srtp->pkey);
276281
mbedtls_ctr_drbg_free(&dtls_srtp->ctr_drbg);
@@ -307,7 +312,16 @@ static void dtls_srtp_key_derivation(void *context, mbedtls_ssl_key_export_type
307312

308313
memcpy(randbytes, client_random, 32);
309314
memcpy(randbytes + 32, server_random, 32);
310-
315+
// Debug key for wireshark
316+
#ifdef DUMP_DTLS_KEY
317+
printf("CLIENT_RANDOM ");
318+
for (int i = 0; i < 32; i++)
319+
printf("%02x", client_random[i]);
320+
printf(" ");
321+
for (int i = 0; i < secret_len; i++)
322+
printf("%02x", secret[i]);
323+
printf("\n\n");
324+
#endif
311325
// Export keying material
312326
if ((ret = mbedtls_ssl_tls_prf(tls_prf_type, secret, secret_len, dtls_srtp_label, randbytes, sizeof(randbytes),
313327
key_material, sizeof(key_material)))

0 commit comments

Comments
 (0)