From 98280f09c4925b9f63088def3ec17ac4299941c8 Mon Sep 17 00:00:00 2001 From: Maxim Sharabayko Date: Fri, 6 Jan 2023 16:41:22 +0100 Subject: [PATCH 1/2] [API] Fixed #if ENABLE_AEAD_API_PREVIEW --- srtcore/srt.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/srtcore/srt.h b/srtcore/srt.h index bc21d0202..d5a5eb196 100644 --- a/srtcore/srt.h +++ b/srtcore/srt.h @@ -556,7 +556,7 @@ enum SRT_REJECT_REASON SRT_REJ_FILTER, // incompatible packet filter SRT_REJ_GROUP, // incompatible group SRT_REJ_TIMEOUT, // connection timeout -#if ENABLE_AEAD_API_PREVIEW +#ifdef ENABLE_AEAD_API_PREVIEW SRT_REJ_CRYPTO, // conflicting cryptographic configurations #endif @@ -645,7 +645,7 @@ enum SRT_KM_STATE SRT_KM_S_SECURED = 2, // Stream encrypted, keying Material exchanged, decrypting ok. SRT_KM_S_NOSECRET = 3, // Stream encrypted and no secret to decrypt Keying Material SRT_KM_S_BADSECRET = 4 // Stream encrypted and wrong secret is used, cannot decrypt Keying Material -#if ENABLE_AEAD_API_PREVIEW +#ifdef ENABLE_AEAD_API_PREVIEW ,SRT_KM_S_BADCRYPTOMODE = 5 // Stream encrypted but wrong ccryptographic mode is used, cannot decrypt. Since v1.6.0. #endif }; From 8e656cc7e5c394390f332f5f52753255279a2d32 Mon Sep 17 00:00:00 2001 From: Maxim Sharabayko Date: Fri, 6 Jan 2023 17:24:25 +0100 Subject: [PATCH 2/2] Fixed two more occurances --- srtcore/core.cpp | 2 +- srtcore/crypto.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/srtcore/core.cpp b/srtcore/core.cpp index d86126bf0..92c53e988 100644 --- a/srtcore/core.cpp +++ b/srtcore/core.cpp @@ -2624,7 +2624,7 @@ bool srt::CUDT::interpretSrtHandshake(const CHandShake& hs, } if (*pw_len == 1) { -#if ENABLE_AEAD_API_PREVIEW +#ifdef ENABLE_AEAD_API_PREVIEW if (m_pCryptoControl->m_RcvKmState == SRT_KM_S_BADCRYPTOMODE) { // Cryptographic modes mismatch. Not acceptable at all. diff --git a/srtcore/crypto.cpp b/srtcore/crypto.cpp index c353f69de..152f53eb7 100644 --- a/srtcore/crypto.cpp +++ b/srtcore/crypto.cpp @@ -247,7 +247,7 @@ int srt::CCryptoControl::processSrtMsg_KMREQ( LOGC(cnlog.Warn, log << "KMREQ/rcv: (snd) Rx process failure - BADSECRET"); break; case HAICRYPT_ERROR_CIPHER: -#if ENABLE_AEAD_API_PREVIEW +#ifdef ENABLE_AEAD_API_PREVIEW m_RcvKmState = m_SndKmState = SRT_KM_S_BADCRYPTOMODE; #else m_RcvKmState = m_SndKmState = SRT_KM_S_BADSECRET; // Use "bad secret" as a fallback. @@ -403,7 +403,7 @@ int srt::CCryptoControl::processSrtMsg_KMRSP(const uint32_t* srtdata, size_t len m_SndKmState = SRT_KM_S_UNSECURED; retstatus = 0; break; -#if ENABLE_AEAD_API_PREVIEW +#ifdef ENABLE_AEAD_API_PREVIEW case SRT_KM_S_BADCRYPTOMODE: // The peer expects to use a different cryptographic mode (e.g. AES-GCM, not AES-CTR). m_RcvKmState = SRT_KM_S_BADCRYPTOMODE;