Skip to content

Commit

Permalink
Make use of crc32c to compute dcsctp checksum
Browse files Browse the repository at this point in the history
https://bugs.webkit.org/show_bug.cgi?id=246213
rdar://100872064

Reviewed by Geoff Garen.

We were using the internal crc32 routine but crc32c should be used for SCTP,
as per https://www.rfc-editor.org/rfc/rfc4960#section-6.8.
We therefore now use usrsctp crc32c routine.

Manually tested.

* Source/ThirdParty/libwebrtc/Source/webrtc/net/dcsctp/packet/crc32c.cc:

Canonical link: https://commits.webkit.org/255285@main
  • Loading branch information
youennf committed Oct 7, 2022
1 parent 9aac1c9 commit 1838474
Showing 1 changed file with 2 additions and 2 deletions.
Expand Up @@ -14,7 +14,7 @@
#if !defined(WEBRTC_WEBKIT_BUILD)
#include "third_party/crc32c/src/include/crc32c/crc32c.h"
#else
#include "rtc_base/crc32.h"
#include "third_party/usrsctp/usrsctplib/usrsctplib/usrsctp.h"
#endif

namespace dcsctp {
Expand All @@ -23,7 +23,7 @@ uint32_t GenerateCrc32C(rtc::ArrayView<const uint8_t> data) {
#if !defined(WEBRTC_WEBKIT_BUILD)
uint32_t crc32c = crc32c_value(data.data(), data.size());
#else
uint32_t crc32c = rtc::ComputeCrc32(data.data(), data.size());
uint32_t crc32c = usrsctp_crc32c(const_cast<uint8_t*>(data.data()), data.size());
#endif

// Byte swapping for little endian byte order:
Expand Down

0 comments on commit 1838474

Please sign in to comment.