Ahh, looks like you forgot a few places to change, and the cast on big endian was truncating. I rewrote the patch, rebased the branch, and placed the final work here: https://git.zx2c4.com/WireGuard/commit/?id=66384869d3f6e5f7a53b621901c9c7163a78855c