| 5204 | } |
| 5205 | |
| 5206 | void srt::CUDT::checkUpdateCryptoKeyLen(const char *loghdr SRT_ATR_UNUSED, int32_t typefield) |
| 5207 | { |
| 5208 | int enc_flags = SrtHSRequest::SRT_HSTYPE_ENCFLAGS::unwrap(typefield); |
| 5209 | |
| 5210 | // potentially 0-7 values are possible. |
| 5211 | // When 0, don't change anything - it should rely on the value 0. |
| 5212 | // When 1, 5, 6, 7, this is kinda internal error - ignore. |
| 5213 | if (enc_flags >= 2 && enc_flags <= 4) // 2 = 128, 3 = 192, 4 = 256 |
| 5214 | { |
| 5215 | int rcv_pbkeylen = SrtHSRequest::SRT_PBKEYLEN_BITS::wrap(enc_flags); |
| 5216 | if (m_config.iSndCryptoKeyLen == 0) |
| 5217 | { |
| 5218 | m_config.iSndCryptoKeyLen = rcv_pbkeylen; |
| 5219 | HLOGC(cnlog.Debug, |
| 5220 | log << CONID() << loghdr |
| 5221 | << ": PBKEYLEN adopted from advertised value: " << m_config.iSndCryptoKeyLen); |
| 5222 | } |
| 5223 | else if (m_config.iSndCryptoKeyLen != rcv_pbkeylen) |
| 5224 | { |
| 5225 | // Conflict. Use SRTO_SENDER flag to check if this side should accept |
| 5226 | // the enforcement, otherwise simply let it win. |
| 5227 | if (!m_config.bDataSender) |
| 5228 | { |
| 5229 | LOGC(cnlog.Warn, |
| 5230 | log << CONID() << loghdr << ": PBKEYLEN conflict - OVERRIDDEN " << m_config.iSndCryptoKeyLen |
| 5231 | << " by " << rcv_pbkeylen << " from PEER (as AGENT is not SRTO_SENDER)"); |
| 5232 | m_config.iSndCryptoKeyLen = rcv_pbkeylen; |
| 5233 | } |
| 5234 | else |
| 5235 | { |
| 5236 | LOGC(cnlog.Warn, |
| 5237 | log << CONID() << loghdr << ": PBKEYLEN conflict - keep " << m_config.iSndCryptoKeyLen |
| 5238 | << "; peer-advertised PBKEYLEN " << rcv_pbkeylen << " rejected because Agent is SRTO_SENDER"); |
| 5239 | } |
| 5240 | } |
| 5241 | } |
| 5242 | else if (enc_flags != 0) |
| 5243 | { |
| 5244 | LOGC(cnlog.Error, log << CONID() << loghdr << ": IPE: enc_flags outside allowed 2, 3, 4: " << enc_flags); |
| 5245 | } |
| 5246 | else |
| 5247 | { |
| 5248 | HLOGC(cnlog.Debug, log << CONID() << loghdr << ": No encryption flags found in type field: " << typefield); |
| 5249 | } |
| 5250 | } |
| 5251 | |
| 5252 | // Rendezvous |
| 5253 | void srt::CUDT::rendezvousSwitchState(UDTRequestType& w_rsptype, bool& w_needs_extension, bool& w_needs_hsrsp) |
nothing calls this directly
no outgoing calls
no test coverage detected