mirror of
https://github.com/wolfSSL/wolfssl.git
synced 2025-07-31 11:17:29 +02:00
Peer review fixes. Improve profile not found handling or errors. Improve inline function.
This commit is contained in:
@ -501,7 +501,7 @@ int IsDtlsNotSctpMode(WOLFSSL* ssl)
|
|||||||
/* Secure Real-time Transport Protocol */
|
/* Secure Real-time Transport Protocol */
|
||||||
/* If SRTP is not enabled returns the state of the dtls option.
|
/* If SRTP is not enabled returns the state of the dtls option.
|
||||||
* If SRTP is enabled returns dtls && !dtlsSrtpProfiles. */
|
* If SRTP is enabled returns dtls && !dtlsSrtpProfiles. */
|
||||||
int IsDtlsNotSrtpMode(WOLFSSL* ssl)
|
static WC_INLINE int IsDtlsNotSrtpMode(WOLFSSL* ssl)
|
||||||
{
|
{
|
||||||
#ifdef WOLFSSL_SRTP
|
#ifdef WOLFSSL_SRTP
|
||||||
return ssl->options.dtls && !ssl->dtlsSrtpProfiles;
|
return ssl->options.dtls && !ssl->dtlsSrtpProfiles;
|
||||||
|
11
src/tls.c
11
src/tls.c
@ -5430,7 +5430,10 @@ static int TLSX_UseSRTP_Parse(WOLFSSL* ssl, const byte* input, word16 length,
|
|||||||
/* total length, not include itself */
|
/* total length, not include itself */
|
||||||
ato16(input, &profile_len);
|
ato16(input, &profile_len);
|
||||||
offset += OPAQUE16_LEN;
|
offset += OPAQUE16_LEN;
|
||||||
|
|
||||||
/* parse remainder one profile at a time, looking for match in CTX */
|
/* parse remainder one profile at a time, looking for match in CTX */
|
||||||
|
ret = 0;
|
||||||
|
ssl->dtlsSrtpId = 0;
|
||||||
for (i=offset; i<length; i+=OPAQUE16_LEN) {
|
for (i=offset; i<length; i+=OPAQUE16_LEN) {
|
||||||
ato16(input+i, &profile_value);
|
ato16(input+i, &profile_value);
|
||||||
/* find first match */
|
/* find first match */
|
||||||
@ -5456,13 +5459,15 @@ static int TLSX_UseSRTP_Parse(WOLFSSL* ssl, const byte* input, word16 length,
|
|||||||
(void)profile_len;
|
(void)profile_len;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ret != 0) {
|
if (ret == 0 && ssl->dtlsSrtpId == 0) {
|
||||||
WOLFSSL_MSG("SRP Profile not found!");
|
WOLFSSL_MSG("SRP Profile not found!");
|
||||||
ssl->dtlsSrtpId = 0;
|
|
||||||
TLSX_UseSRTP_Free(srtp, ssl->heap);
|
|
||||||
/* not fatal, so return 0 */
|
/* not fatal, so return 0 */
|
||||||
ret = 0;
|
ret = 0;
|
||||||
}
|
}
|
||||||
|
else if (ret != 0) {
|
||||||
|
ssl->dtlsSrtpId = 0;
|
||||||
|
TLSX_UseSRTP_Free(srtp, ssl->heap);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -4949,7 +4949,6 @@ WOLFSSL_LOCAL int GrowInputBuffer(WOLFSSL* ssl, int size, int usedLength);
|
|||||||
#endif
|
#endif
|
||||||
WOLFSSL_LOCAL int IsSCR(WOLFSSL* ssl);
|
WOLFSSL_LOCAL int IsSCR(WOLFSSL* ssl);
|
||||||
WOLFSSL_LOCAL int IsDtlsNotSctpMode(WOLFSSL* ssl);
|
WOLFSSL_LOCAL int IsDtlsNotSctpMode(WOLFSSL* ssl);
|
||||||
WOLFSSL_LOCAL int IsDtlsNotSrtpMode(WOLFSSL* ssl);
|
|
||||||
|
|
||||||
WOLFSSL_LOCAL void WriteSEQ(WOLFSSL* ssl, int verifyOrder, byte* out);
|
WOLFSSL_LOCAL void WriteSEQ(WOLFSSL* ssl, int verifyOrder, byte* out);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user