diff options
author | Khem Raj <raj.khem@gmail.com> | 2019-11-20 13:25:04 -0800 |
---|---|---|
committer | Khem Raj <raj.khem@gmail.com> | 2019-11-20 22:17:28 -0800 |
commit | 63a724ce4033bab0e84a4ee29a369f0f11c37374 (patch) | |
tree | 8342e510c6ee3941a8c735366fa2c2eab994837a /meta-oe/recipes-crypto/libkcapi | |
parent | f4e6224b340fba198639bdd4585a81efdf15303e (diff) | |
download | meta-openembedded-63a724ce4033bab0e84a4ee29a369f0f11c37374.tar.gz |
libkcapi: Update patch to upstream submitted one
Use builtin_bswap32 with clang if available
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Diffstat (limited to 'meta-oe/recipes-crypto/libkcapi')
3 files changed, 53 insertions, 11 deletions
diff --git a/meta-oe/recipes-crypto/libkcapi/libkcapi/0001-Use-__builtin_bswap32-on-Clang-if-supported.patch b/meta-oe/recipes-crypto/libkcapi/libkcapi/0001-Use-__builtin_bswap32-on-Clang-if-supported.patch new file mode 100644 index 000000000..e713665ab --- /dev/null +++ b/meta-oe/recipes-crypto/libkcapi/libkcapi/0001-Use-__builtin_bswap32-on-Clang-if-supported.patch | |||
@@ -0,0 +1,39 @@ | |||
1 | From 7b5dd67fee58f9f54c8a676abe2131776c0a3c52 Mon Sep 17 00:00:00 2001 | ||
2 | From: Khem Raj <raj.khem@gmail.com> | ||
3 | Date: Wed, 20 Nov 2019 13:41:39 -0800 | ||
4 | Subject: [PATCH] Use __builtin_bswap32 on Clang if supported | ||
5 | |||
6 | clang pretends to be gcc 4.2.1 so GCC_VERSION macro will decide that | ||
7 | __builtin_bswap32 is not supported on clang, whereas in reality it might | ||
8 | so its better to add a check for enquiring clang if it supports | ||
9 | __builtin_bswap32 or not | ||
10 | |||
11 | Upstream-Status: Submitted [https://github.com/smuellerDD/libkcapi/pull/83] | ||
12 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
13 | --- | ||
14 | lib/kcapi-kdf.c | 6 +++++- | ||
15 | 1 file changed, 5 insertions(+), 1 deletion(-) | ||
16 | |||
17 | diff --git a/lib/kcapi-kdf.c b/lib/kcapi-kdf.c | ||
18 | index 9e53a0b..f32fbe9 100644 | ||
19 | --- a/lib/kcapi-kdf.c | ||
20 | +++ b/lib/kcapi-kdf.c | ||
21 | @@ -54,10 +54,14 @@ | ||
22 | #include "kcapi.h" | ||
23 | #include "internal.h" | ||
24 | |||
25 | +#ifndef __has_builtin | ||
26 | +# define __has_builtin(x) 0 | ||
27 | +#endif | ||
28 | + | ||
29 | #define GCC_VERSION (__GNUC__ * 10000 \ | ||
30 | + __GNUC_MINOR__ * 100 \ | ||
31 | + __GNUC_PATCHLEVEL__) | ||
32 | -#if GCC_VERSION >= 40400 | ||
33 | +#if GCC_VERSION >= 40400 || (defined(__clang__) && __has_builtin(__builtin_bswap32)) | ||
34 | # define __HAVE_BUILTIN_BSWAP32__ | ||
35 | #endif | ||
36 | |||
37 | -- | ||
38 | 2.24.0 | ||
39 | |||
diff --git a/meta-oe/recipes-crypto/libkcapi/libkcapi/0001-kcapi-kdf-Move-code-to-fix.patch b/meta-oe/recipes-crypto/libkcapi/libkcapi/0001-kcapi-kdf-Move-code-to-fix.patch index 3dd7ea7f9..7ed9caf09 100644 --- a/meta-oe/recipes-crypto/libkcapi/libkcapi/0001-kcapi-kdf-Move-code-to-fix.patch +++ b/meta-oe/recipes-crypto/libkcapi/libkcapi/0001-kcapi-kdf-Move-code-to-fix.patch | |||
@@ -1,4 +1,4 @@ | |||
1 | From 00c1654e368f728b213c4e3782045d54098edb25 Mon Sep 17 00:00:00 2001 | 1 | From 8f961521add49278b48c9721fc53e05ee3543b74 Mon Sep 17 00:00:00 2001 |
2 | From: Khem Raj <raj.khem@gmail.com> | 2 | From: Khem Raj <raj.khem@gmail.com> |
3 | Date: Sat, 16 Nov 2019 23:03:51 -0800 | 3 | Date: Sat, 16 Nov 2019 23:03:51 -0800 |
4 | Subject: [PATCH] kcapi-kdf: Move code to fix | 4 | Subject: [PATCH] kcapi-kdf: Move code to fix |
@@ -6,13 +6,14 @@ Subject: [PATCH] kcapi-kdf: Move code to fix | |||
6 | Fixes clang build | 6 | Fixes clang build |
7 | unused function '_bswap32' [-Werror,-Wunused-function] | 7 | unused function '_bswap32' [-Werror,-Wunused-function] |
8 | 8 | ||
9 | Upstream-Status: Submitted [https://github.com/smuellerDD/libkcapi/pull/83] | ||
9 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | 10 | Signed-off-by: Khem Raj <raj.khem@gmail.com> |
10 | --- | 11 | --- |
11 | lib/kcapi-kdf.c | 36 ++++++++++++++++-------------------- | 12 | lib/kcapi-kdf.c | 37 +++++++++++++++++-------------------- |
12 | 1 file changed, 16 insertions(+), 20 deletions(-) | 13 | 1 file changed, 17 insertions(+), 20 deletions(-) |
13 | 14 | ||
14 | diff --git a/lib/kcapi-kdf.c b/lib/kcapi-kdf.c | 15 | diff --git a/lib/kcapi-kdf.c b/lib/kcapi-kdf.c |
15 | index ea39846..8e4a636 100644 | 16 | index ea39846..9e53a0b 100644 |
16 | --- a/lib/kcapi-kdf.c | 17 | --- a/lib/kcapi-kdf.c |
17 | +++ b/lib/kcapi-kdf.c | 18 | +++ b/lib/kcapi-kdf.c |
18 | @@ -54,6 +54,20 @@ | 19 | @@ -54,6 +54,20 @@ |
@@ -26,17 +27,17 @@ index ea39846..8e4a636 100644 | |||
26 | +# define __HAVE_BUILTIN_BSWAP32__ | 27 | +# define __HAVE_BUILTIN_BSWAP32__ |
27 | +#endif | 28 | +#endif |
28 | + | 29 | + |
29 | +#ifdef __HAVE_BUILTIN_BSWAP32__ | ||
30 | +# define be_bswap32(x) (uint32_t)__builtin_bswap32((uint32_t)(x)) | ||
31 | +/* Endian dependent byte swap operations. */ | 30 | +/* Endian dependent byte swap operations. */ |
32 | +#elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ | 31 | +#if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ |
33 | +# define be_bswap32(x) ((uint32_t)(x)) | 32 | +# define be_bswap32(x) ((uint32_t)(x)) |
34 | +#elif __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ | 33 | +#elif __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ |
35 | + | 34 | +# ifdef __HAVE_BUILTIN_BSWAP32__ |
35 | +# define be_bswap32(x) (uint32_t)__builtin_bswap32((uint32_t)(x)) | ||
36 | +# else | ||
36 | static inline uint32_t rol32(uint32_t x, int n) | 37 | static inline uint32_t rol32(uint32_t x, int n) |
37 | { | 38 | { |
38 | return ( (x << (n&(32-1))) | (x >> ((32-n)&(32-1))) ); | 39 | return ( (x << (n&(32-1))) | (x >> ((32-n)&(32-1))) ); |
39 | @@ -68,27 +82,9 @@ static inline uint32_t _bswap32(uint32_t x) | 40 | @@ -68,27 +82,10 @@ static inline uint32_t _bswap32(uint32_t x) |
40 | { | 41 | { |
41 | return ((rol32(x, 8) & 0x00ff00ffL) | (ror32(x, 8) & 0xff00ff00L)); | 42 | return ((rol32(x, 8) & 0x00ff00ffL) | (ror32(x, 8) & 0xff00ff00L)); |
42 | } | 43 | } |
@@ -59,10 +60,11 @@ index ea39846..8e4a636 100644 | |||
59 | -# define be_bswap32(x) ((uint32_t)(x)) | 60 | -# define be_bswap32(x) ((uint32_t)(x)) |
60 | -#elif __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ | 61 | -#elif __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ |
61 | -# define be_bswap32(x) _swap32(x) | 62 | -# define be_bswap32(x) _swap32(x) |
62 | +# define be_bswap32(x) _bswap32(x) | 63 | +# define be_bswap32(x) _bswap32(x) |
64 | +# endif | ||
63 | #else | 65 | #else |
64 | -#error "Endianess not defined" | 66 | -#error "Endianess not defined" |
65 | +# error "Neither builtin_bswap32 nor endianess defined" | 67 | +# error "endianess not defined" |
66 | #endif | 68 | #endif |
67 | 69 | ||
68 | DSO_PUBLIC | 70 | DSO_PUBLIC |
diff --git a/meta-oe/recipes-crypto/libkcapi/libkcapi_git.bb b/meta-oe/recipes-crypto/libkcapi/libkcapi_git.bb index aa438e585..4e217a351 100644 --- a/meta-oe/recipes-crypto/libkcapi/libkcapi_git.bb +++ b/meta-oe/recipes-crypto/libkcapi/libkcapi_git.bb | |||
@@ -11,6 +11,7 @@ PV = "1.1.5" | |||
11 | SRC_URI = " \ | 11 | SRC_URI = " \ |
12 | git://github.com/smuellerDD/libkcapi.git \ | 12 | git://github.com/smuellerDD/libkcapi.git \ |
13 | file://0001-kcapi-kdf-Move-code-to-fix.patch \ | 13 | file://0001-kcapi-kdf-Move-code-to-fix.patch \ |
14 | file://0001-Use-__builtin_bswap32-on-Clang-if-supported.patch \ | ||
14 | " | 15 | " |
15 | 16 | ||
16 | inherit autotools | 17 | inherit autotools |