Skip to content

Commit 6f19db3

Browse files
authored
Merge branch 'develop' into bug-fix
2 parents 8974d08 + 15d19f0 commit 6f19db3

File tree

3 files changed

+37
-4
lines changed

3 files changed

+37
-4
lines changed

src/source/Crypto/Tls_mbedtls.c

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,37 @@
44
#define LOG_CLASS "TLS_mbedtls"
55
#include "../Include_i.h"
66

7+
// Read and parse CA certificate
8+
PRIVATE_API STATUS readAndParseCACertificate(PTlsSession pTlsSession)
9+
{
10+
ENTERS();
11+
STATUS retStatus = STATUS_SUCCESS;
12+
UINT64 cert_len = 0;
13+
PBYTE cert_buf = NULL;
14+
CHAR errBuf[128];
15+
16+
CHK(pTlsSession != NULL, STATUS_NULL_ARG);
17+
18+
CHK_STATUS(readFile(KVS_CA_CERT_PATH, FALSE, NULL, &cert_len));
19+
CHK(cert_len > 0, STATUS_INVALID_CERT_PATH_LENGTH);
20+
cert_buf = (PBYTE) MEMCALLOC(1, cert_len + 1);
21+
CHK(cert_buf != NULL, STATUS_NOT_ENOUGH_MEMORY);
22+
CHK_STATUS(readFile(KVS_CA_CERT_PATH, FALSE, cert_buf, &cert_len));
23+
int ret = mbedtls_x509_crt_parse(&pTlsSession->cacert, cert_buf, (SIZE_T) (cert_len + 1));
24+
if (ret != 0) {
25+
mbedtls_strerror(ret, errBuf, SIZEOF(errBuf));
26+
DLOGE("mbedtls_x509_crt_parse failed: %s", errBuf);
27+
}
28+
CHK(ret == 0, STATUS_INVALID_CA_CERT_PATH);
29+
30+
CleanUp:
31+
CHK_LOG_ERR(retStatus);
32+
SAFE_MEMFREE(cert_buf);
33+
34+
LEAVES();
35+
return retStatus;
36+
}
37+
738
STATUS createTlsSession(PTlsSessionCallbacks pCallbacks, PTlsSession* ppTlsSession)
839
{
940
ENTERS();
@@ -26,9 +57,11 @@ STATUS createTlsSession(PTlsSessionCallbacks pCallbacks, PTlsSession* ppTlsSessi
2657
mbedtls_ssl_config_init(&pTlsSession->sslCtxConfig);
2758
mbedtls_ssl_init(&pTlsSession->sslCtx);
2859
CHK(mbedtls_ctr_drbg_seed(&pTlsSession->ctrDrbg, mbedtls_entropy_func, &pTlsSession->entropy, NULL, 0) == 0, STATUS_CREATE_SSL_FAILED);
29-
CHK(mbedtls_x509_crt_parse_file(&pTlsSession->cacert, KVS_CA_CERT_PATH) == 0, STATUS_INVALID_CA_CERT_PATH);
60+
61+
CHK_STATUS(readAndParseCACertificate(pTlsSession));
3062

3163
CleanUp:
64+
3265
if (STATUS_FAILED(retStatus) && pTlsSession != NULL) {
3366
freeTlsSession(&pTlsSession);
3467
}

src/source/PeerConnection/SessionDescription.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ STATUS setPayloadTypesFromOffer(PHashTable codecTable, PHashTable rtxTable, PSes
206206
// When there's no match, the last fmtp will be chosen. This will allow us to not break existing customers who might be using
207207
// flexible decoders which can infer the video profile from the SPS header.
208208
if (fmtpScore >= bestFmtpScore) {
209-
DLOGV("Found H264 payload type %" PRId64 " with score %lu: %s", parsedPayloadType, fmtpScore, fmtp);
209+
DLOGV("Found H264 payload type %" PRId64 " with score %lu: %s", parsedPayloadType, fmtpScore, fmtp ? fmtp : "NULL");
210210
CHK_STATUS(
211211
hashTableUpsert(codecTable, RTC_CODEC_H264_PROFILE_42E01F_LEVEL_ASYMMETRY_ALLOWED_PACKETIZATION_MODE, parsedPayloadType));
212212
bestFmtpScore = fmtpScore;

src/source/Sctp/Sctp.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -210,11 +210,11 @@ STATUS sctpSessionWriteMessage(PSctpSession pSctpSession, UINT32 streamId, BOOL
210210
// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
211211
// \ /
212212
// | Label |
213-
// / \
213+
// / /
214214
// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
215215
// \ /
216216
// | Protocol |
217-
// / \
217+
// / /
218218
// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
219219
STATUS sctpSessionWriteDcep(PSctpSession pSctpSession, UINT32 streamId, PCHAR pChannelName, UINT32 pChannelNameLen,
220220
PRtcDataChannelInit pRtcDataChannelInit)

0 commit comments

Comments
 (0)