From 4b68940b1ed46c54a5a0bdf6bb9d4599bc64e6f4 Mon Sep 17 00:00:00 2001
From: Chen Qi <Qi.Chen@windriver.com>
Date: Wed, 24 Dec 2014 10:12:40 +0800
Subject: [PATCH] Change to calling bswap_* instead of htobe* and be*toh

We can't use htobe* and be*toh functions because they are not
available on older versions of glibc, For example, shipped on Centos 5.5.

Change to directly calling bswap_* as defined in+byteswap.h.

Upstream-Status: Inappropriate

Signed-off-by: Ting Liu <b28495@freescale.com>
Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
---
 libkmod/libkmod-signature.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libkmod/libkmod-signature.c b/libkmod/libkmod-signature.c
index 2b976a5..ffe58c2 100644
--- a/libkmod/libkmod-signature.c
+++ b/libkmod/libkmod-signature.c
@@ -19,6 +19,7 @@
  */
 
 #include <endian.h>
+#include <byteswap.h>
 #include <inttypes.h>
 #include <stdio.h>
 #include <stdlib.h>
@@ -124,7 +125,7 @@ bool kmod_module_signature_info(const struct kmod_file *file, struct kmod_signat
 			modsig->hash >= PKEY_HASH__LAST ||
 			modsig->id_type >= PKEY_ID_TYPE__LAST)
 		return false;
-	sig_len = be32toh(get_unaligned(&modsig->sig_len));
+	sig_len = bswap_32(get_unaligned(&modsig->sig_len));
 	if (size < (off_t)(modsig->signer_len + modsig->key_id_len + sig_len))
 		return false;
 
-- 
1.9.1

