| 499 | } |
| 500 | |
| 501 | bool NTCP2Establisher::ProcessSessionConfirmedMessagePart2 (uint8_t * m3p2Buf) |
| 502 | { |
| 503 | if (!KDF3Bob ()) // MixKey, n = 0 |
| 504 | { |
| 505 | LogPrint (eLogWarning, "NTCP2: SessionConfirmed Part2 KDF failed"); |
| 506 | return false; |
| 507 | } |
| 508 | if (Decrypt (m_SessionConfirmedBuffer + 48, m3p2Buf, m3p2Len - 16)) |
| 509 | // calculate new h again for KDF data |
| 510 | MixHash (m_SessionConfirmedBuffer + 48, m3p2Len); // h = SHA256(h || ciphertext) |
| 511 | else |
| 512 | { |
| 513 | LogPrint (eLogWarning, "NTCP2: SessionConfirmed Part2 AEAD verification failed "); |
| 514 | return false; |
| 515 | } |
| 516 | return true; |
| 517 | } |
| 518 | |
| 519 | NTCP2Session::NTCP2Session (NTCP2Server& server, std::shared_ptr<const i2p::data::RouterInfo> in_RemoteRouter, |
| 520 | std::shared_ptr<const i2p::data::RouterInfo::Address> addr): |
no test coverage detected