Recently I tried building vtools on a windows system running cygwin. I found that there was one function it barfed on, SWAP_BE64
. I did some digging, and I found the code was taken from busybox. I dug around a bit there, and I found where the thing is defined, so I copied that definition into my copy of the program, and it worked.
Keep in mind, this function seems to depend on the endianness of the machine, so in the busybox code there are a bunch of #IFDEF
s surrounding this definition. If you are using a big-endian machine then you would want to apply a different definition for this function.
This is a patch using sha hashing. There seems to be some movement leaning towards using the Keccak hash for vpatches (see this discussion and that following it), so I might have to get a Keccak hasher and regrind this later.
File vdiff_sha_define_swap.vpatch
:
diff -uNr vdiff_a/vtools/manifest vdiff_b/vtools/manifest
--- vdiff_a/vtools/manifest cece6cf281356c63d1f0a935d8f772345b51f63bc77ada2b70646b395036a22a88962e06661dee77977e1d434290adec5d76e540597bbd2213a36cb5890a8cf8
+++ vdiff_b/vtools/manifest 2e651c3ae3f563a3ee7f6a0cfbd3f18e76bf57f81615643e6df3c60f6d6a2d868a5ff9809de76184ee9779091d621ef088d5f695c2c7d9d5b0fd040d7173ab8f
@@ -6,3 +6,5 @@
Fixes C99 compatibity for __attribute__((noreturn)), vdiff support for "No newline at end of file" directive.
2018-04-07 phf
Fixes for xalloc's use of static inline courtesy of spyked.
+2018-06-28 PeterL
+Added definition for SWAP_BE64 in sha.c (valid for littleendian system).
\ No newline at end of file
diff -uNr vdiff_a/vtools/src/sha.c vdiff_b/vtools/src/sha.c
--- vdiff_a/vtools/src/sha.c 8ef7baea0ae21e44b34318a0202e3a7c4ca1fe4df6c1a8a29d8a5eeee930926968ea9bd062c514460208bf89e2fa4ec958950c3776b47513cd5979961e4182c6
+++ vdiff_b/vtools/src/sha.c 3eac373f23f903ef55354750cf8921a705aefa2cb61a1e8acc0fc091fc357b434fd0598822f90beaa1d1c4ecf4ede4d2184eb12764f806d304fc70575967a4a5
@@ -3,6 +3,9 @@
#include
#include
+/* SWAP_BEnn means "convert CPU<->big_endian by swapping bytes" */
+# define SWAP_BE64(x) __bswap64(x)
+
/* \url{https://git.busybox.net/busybox/tree/libbb/hash_md5_sha.c} */
static inline uint64_t rotr64(uint64_t x, unsigned n) {
And here is the signature for the file, vdiff_sha_define_swap.vpatch.PeterL.sig
:
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1
iQIcBAABAgAGBQJbRsWTAAoJELTi4Nystj0ltSUP/A9V+5pjBVYr6qOZLOYCOF6c
/pU4YvdVW9sMc6EZ/p0Vdq6bWGr/RIhkgMiPsHhnxsdHS6xSpEFGWOMj+mzOBjRd
7sJl3GEZ14kKbweP+Z/Uwky/yYG5MAKORLBGb24HF+aBdShq3GqQFcd2B9Rb/F3g
YgIwLY4gVBsFFgjTBR47/9rXJAgpJKb3S/dPQ3sdWoLXb1ZO4ayZfzcjeCmEpuyq
DbjSbPiiHvfoTSJ4/N8UdNSAccV1UKofnpnnhQ4A43mEQ3T00Q7tnI7NzW3wLD3K
3PPEQOduAffdrPbliigVLQhDOzHiIyuQhENVI7N8IQwUxvjF6RJ3A+YWHeMAvLf9
yTOf7DSIUWMee4YX02ZhPvclomrG9+PRJUkDsk7LqwoNxVEo5ZeXlPFIE4zBYQZg
F+my5bNl4OqJzJT/0voMMza6oDNXIigX/kSqJuCEuQ+dMX0XgbiejX94GmAWO+qB
DuyQuYCdslH8dVmEd1UBKQKL/6or6HFxTOSDDUUdfcRBbrWLFdToyaWMxIz3Ea5z
m8hcDi+olE5yTKz6DAvy0SDrOwlOk0cCXoeo1XuiVVwfdzRiYPFKWkWFqFleZghm
FIZif8TuRJl6LunzV2L9P2RZn2sNuN59cuwC0e7+7XW1XroP1VPmLNP+/yaeK/gR
kdTB76aB/ebzaUXqV+U4
=rxQr
-----END PGP SIGNATURE-----
-
No comments:
Post a Comment