[oe] [meta-oe][PATCH 05/10] libp11: fix compile error if OPENSSL_NO_EC defined

kai.kang at windriver.com kai.kang at windriver.com
Wed Jul 5 08:11:28 UTC 2017


From: Kai Kang <kai.kang at windriver.com>

Function compute_key_fn src/p11_ec.c uses types EC_POINT and EC_KEY which are
defined in ec.h. If OPENSSL_NO_EC is defined, no header file ec.h exists and
causes compile errors.

../../git/src/p11_ec.c:45:8: error: unknown type name 'EC_POINT'
const EC_POINT *, const EC_KEY *,
    ^~~~~~~~
../../git/src/p11_ec.c:45:26: error: unknown type name 'EC_KEY'
const EC_POINT *, const EC_KEY *,
                      ^~~~~~

So check OPENSSL_NO_EC earlier in src/p11_ec.c to fix the error.

Signed-off-by: Kai Kang <kai.kang at windriver.com>
---
 ...-src-p11_ec.c-check-OPENSSL_NO_EC-earlier.patch | 46 ++++++++++++++++++++++
 meta-oe/recipes-support/libp11/libp11_0.4.0.bb     |  4 +-
 2 files changed, 49 insertions(+), 1 deletion(-)
 create mode 100644 meta-oe/recipes-support/libp11/libp11/0001-src-p11_ec.c-check-OPENSSL_NO_EC-earlier.patch

diff --git a/meta-oe/recipes-support/libp11/libp11/0001-src-p11_ec.c-check-OPENSSL_NO_EC-earlier.patch b/meta-oe/recipes-support/libp11/libp11/0001-src-p11_ec.c-check-OPENSSL_NO_EC-earlier.patch
new file mode 100644
index 0000000..180a91f
--- /dev/null
+++ b/meta-oe/recipes-support/libp11/libp11/0001-src-p11_ec.c-check-OPENSSL_NO_EC-earlier.patch
@@ -0,0 +1,46 @@
+Upstream-Status: Submitted [https://github.com/OpenSC/libp11]
+
+src/p11_ec.c: check OPENSSL_NO_EC earlier
+
+Function compute_key_fn uses types EC_POINT and EC_KEY which are defined
+in ec.h. If OPENSSL_NO_EC is defined, no header file ec.h exists and
+causes compile errors.
+
+../../git/src/p11_ec.c:45:8: error: unknown type name 'EC_POINT'
+const EC_POINT *, const EC_KEY *,
+    ^~~~~~~~
+../../git/src/p11_ec.c:45:26: error: unknown type name 'EC_KEY'
+const EC_POINT *, const EC_KEY *,
+		      ^~~~~~
+So check OPENSSL_NO_EC earlier in src/p11_ec.c.
+
+Signed-off-by: Kai Kang <kai.kang at windriver.com>
+---
+ src/p11_ec.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/src/p11_ec.c b/src/p11_ec.c
+index 6b49775..fdf1f59 100644
+--- a/src/p11_ec.c
++++ b/src/p11_ec.c
+@@ -37,6 +37,8 @@
+ #include <openssl/ecdh.h>
+ #endif
+ 
++#ifndef OPENSSL_NO_EC
++
+ #if OPENSSL_VERSION_NUMBER >= 0x10100004L
+ typedef int (*compute_key_fn)(unsigned char **, size_t *,
+ 	const EC_POINT *, const EC_KEY *);
+@@ -49,8 +51,6 @@ static compute_key_fn ossl_ecdh_compute_key;
+ 
+ static int ec_ex_index = 0;
+ 
+-#ifndef OPENSSL_NO_EC
+-
+ /********** Manage EC ex_data */
+ 
+ /* NOTE: ECDH also uses ECDSA ex_data and *not* ECDH ex_data */
+-- 
+2.10.1
+
diff --git a/meta-oe/recipes-support/libp11/libp11_0.4.0.bb b/meta-oe/recipes-support/libp11/libp11_0.4.0.bb
index d88006c..2961e0a 100644
--- a/meta-oe/recipes-support/libp11/libp11_0.4.0.bb
+++ b/meta-oe/recipes-support/libp11/libp11_0.4.0.bb
@@ -8,7 +8,9 @@ LICENSE = "LGPLv2+"
 LIC_FILES_CHKSUM = "file://COPYING;md5=fad9b3332be894bab9bc501572864b29"
 DEPENDS = "libtool openssl"
 
-SRC_URI = "git://github.com/OpenSC/libp11.git"
+SRC_URI = "git://github.com/OpenSC/libp11.git \
+           file://0001-src-p11_ec.c-check-OPENSSL_NO_EC-earlier.patch \
+           "
 SRCREV = "22de793340ab73cafc92f8238afb51a06d8411c3"
 
 S = "${WORKDIR}/git"
-- 
2.10.1




More information about the Openembedded-devel mailing list