Skip to content
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

Test for BIG/LITTLE ENDIAN in test-bio.c #176

Open
dogbert2 opened this issue Oct 23, 2015 · 0 comments
Open

Test for BIG/LITTLE ENDIAN in test-bio.c #176

dogbert2 opened this issue Oct 23, 2015 · 0 comments

Comments

@dogbert2
Copy link

Hello All,

In reviewing source code in tlsdate, sub-directory 'src,

file 'test-bio.c', I noticed a magic number being defined
w/out regard to endianess (LITTLE (std) vs. BIG), the patch
file below should address/correct this issue for this file:

--- test-bio.c.orig 2015-10-22 17:52:40.656191527 -0700
+++ test-bio.c 2015-10-22 18:09:30.105487341 -0700
@@ -14,6 +14,7 @@

#include <assert.h>
#include <string.h>
+#include <endian.h>

#include "src/test-bio.h"
#include "src/util.h"
@@ -21,7 +22,11 @@
int verbose;
int verbose_debug;

+#if __BYTE_ORDER == __BIG_ENDIAN
static const unsigned int kMagic = 0x5f8d3f15;
+#else /* __BYTE_ORDER == LITTLE_ENDIAN */
+static const unsigned int kMagic = 0x8d5f153f;
+#endif

struct test_ctx
{

Bill Parker (wp02855 at gmail dot com)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant