-
Notifications
You must be signed in to change notification settings - Fork 18
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
base: master
Are you sure you want to change the base?
TLS refactor #227
Conversation
process/tls_parser.cpp
Outdated
} | ||
bool TLSParser::parse_tls_header() const noexcept | ||
{ | ||
const auto* tls_header = (const TLSHeader*) m_packet_data; |
There was a problem hiding this comment.
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
process/tls_parser.cpp
Outdated
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; | ||
} |
There was a problem hiding this comment.
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()) {
...
}
process/tls_parser.cpp
Outdated
const auto session_id_section_offset | ||
= sizeof(TLSHeader) + sizeof(TLSHandshake) + TLS_RANDOM_BYTES_LENGTH; |
There was a problem hiding this comment.
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
process/tls_parser.hpp
Outdated
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; |
There was a problem hiding this comment.
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>>
123d004
to
dd4966c
Compare
process/tls_parser.cpp
Outdated
if (tls_header->type != TLS_HANDSHAKE){ | ||
return false; | ||
} | ||
if (tls_header->version.major != 3 || tls_header->version.minor > 3){ |
There was a problem hiding this comment.
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.
process/tls_parser.cpp
Outdated
// 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; | ||
}*/ |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Smazáno
93692d4
to
388d807
Compare
No description provided.