Skip to content

Commit

Permalink
[API] Fixed #ifdef ENABLE_AEAD_API_PREVIEW (#2603).
Browse files Browse the repository at this point in the history
  • Loading branch information
maxsharabayko authored Jan 9, 2023
1 parent b3a21e1 commit 41c4b1f
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion srtcore/core.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
4 changes: 2 additions & 2 deletions srtcore/crypto.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions srtcore/srt.h
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
};
Expand Down

0 comments on commit 41c4b1f

Please sign in to comment.