Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TLS refactor #227

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open

TLS refactor #227

wants to merge 6 commits into from

Conversation

Zadamsa
Copy link
Contributor

@Zadamsa Zadamsa commented Nov 4, 2024

No description provided.

}
bool TLSParser::parse_tls_header() const noexcept
{
const auto* tls_header = (const TLSHeader*) m_packet_data;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nepouzivej to C-style pretypovani

Comment on lines 105 to 144
if ( sizeof(TLSHeader) + sizeof(TLSHandshake) > m_packet_length ||
!(handshake->type == TLS_HANDSHAKE_CLIENT_HELLO || handshake->type == TLS_HANDSHAKE_SERVER_HELLO) ||
handshake->version.major != 3 ||
handshake->version.minor < 1 ||
handshake->version.minor > 3) {
return false;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tady ty podminky mi prijdou celkem extrem.

Co to treba rozdelit do neceho takove:

if (hasHandshakeType(...) {
...
}

if (hasRequiredVersion()) {
...
}

Comment on lines 118 to 119
const auto session_id_section_offset
= sizeof(TLSHeader) + sizeof(TLSHandshake) + TLS_RANDOM_BYTES_LENGTH;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

takoveto vypocty mohou byt constexpr

std::vector<uint16_t> m_elliptic_curve_point_formats;
std::vector<std::pair<const char*, uint16_t>> m_alpns;
std::vector<uint16_t> m_supported_versions;
std::vector<std::pair<const char*, uint16_t>> m_serverNames;
Copy link
Contributor

@SiskaPavel SiskaPavel Nov 8, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tady muzes pouzit std::vector<std::string_view> misto std::vector<std::pair<const char*, uint16_t>>

@Zadamsa Zadamsa force-pushed the tls-refactor branch 5 times, most recently from 123d004 to dd4966c Compare November 23, 2024 17:33
if (tls_header->type != TLS_HANDSHAKE){
return false;
}
if (tls_header->version.major != 3 || tls_header->version.minor > 3){
Copy link
Contributor

@SiskaPavel SiskaPavel Nov 25, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sice se to formatovani zde automaticky nekontroluje, ale i presto zde plati coding style.
Jde hlavne o mezery za podminkami. V celem tomto MR je to hodne random.

Comment on lines 487 to 494
// compute end of quic_transport_parameters
/*if (sizeof(uint16_t) > extension_length){
return;
}*/
/*const uint16_t quic_transport_parameters_length = ntohs(*reinterpret_cast<const uint16_t*>(extension_payload));
if (sizeof(quic_transport_parameters_length) + quic_transport_parameters_length > extension_length) {
return;
}*/
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

proc je tady tento kod?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Smazáno

@Zadamsa Zadamsa force-pushed the tls-refactor branch 2 times, most recently from 93692d4 to 388d807 Compare December 2, 2024 00:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants