Files
serenity/Kernel/Net/NetworkTask.cpp
sdomi 2a0af461b2 Kernel/Net: Move internet_checksum to a more general file
Up until now, the internet_checksum function lived in IPv4.h. Due to
its use in IPv6, a better place for it nowadays would be in IP.h.

Due to how it gets used in IPv6 scenarios, it makes sense to extend it
to run over multiple smaller structs instead of one big continous chunk
of memory. This change converts internet_checksum into a class with
methods "add" and "finish", which process data and return the final
result, respectively.

This commit also fixes proper hash computation for payloads that have
an odd length. Furthermore, the function was refactored to use
a ReadonlyBytes object instead of separate data and size.

Co-Authored-By: Wanda <wanda@phinode.net>
2024-10-04 12:04:17 +02:00

31 KiB