Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 1 | Subject: Change to calling bswap_* instead of htobe* and be*toh |
| 2 | |
| 3 | We can't use htobe* and be*toh functions because they are not |
| 4 | available on older versions of glibc, For example, shipped on Centos 5.5. |
| 5 | |
| 6 | Change to directly calling bswap_* as defined in+byteswap.h. |
| 7 | |
| 8 | Upstream-Status: Inappropriate |
| 9 | |
| 10 | Signed-off-by: Ting Liu <b28495@freescale.com> |
| 11 | Signed-off-by: Chen Qi <Qi.Chen@windriver.com> |
| 12 | --- |
| 13 | libkmod/libkmod-signature.c | 3 ++- |
| 14 | 1 file changed, 2 insertions(+), 1 deletion(-) |
| 15 | |
| 16 | diff --git a/libkmod/libkmod-signature.c b/libkmod/libkmod-signature.c |
| 17 | index 6fc06fc..912185a 100644 |
| 18 | --- a/libkmod/libkmod-signature.c |
| 19 | +++ b/libkmod/libkmod-signature.c |
| 20 | @@ -18,6 +18,7 @@ |
| 21 | */ |
| 22 | |
| 23 | #include <endian.h> |
| 24 | +#include <byteswap.h> |
| 25 | #include <inttypes.h> |
| 26 | #include <stdio.h> |
| 27 | #include <stdlib.h> |
| 28 | @@ -127,7 +128,7 @@ bool kmod_module_signature_info(const struct kmod_file *file, struct kmod_signat |
| 29 | modsig->hash >= PKEY_HASH__LAST || |
| 30 | modsig->id_type >= PKEY_ID_TYPE__LAST) |
| 31 | return false; |
| 32 | - sig_len = be32toh(get_unaligned(&modsig->sig_len)); |
| 33 | + sig_len = bswap_32(get_unaligned(&modsig->sig_len)); |
| 34 | if (sig_len == 0 || |
| 35 | size < (int64_t)(modsig->signer_len + modsig->key_id_len + sig_len)) |
| 36 | return false; |
| 37 | -- |
| 38 | 1.9.1 |
| 39 | |