Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH v4] package/opensc: new package
@ 2022-01-14  7:08 José Pekkarinen
  2022-02-28 10:18 ` José Pekkarinen
  2022-07-24 12:45 ` Thomas Petazzoni via buildroot
  0 siblings, 2 replies; 3+ messages in thread
From: José Pekkarinen @ 2022-01-14  7:08 UTC (permalink / raw)
  To: buildroot; +Cc: José Pekkarinen

The patch will add package opensc. sourcery-arm
toolchain triggers strict aliasing rules that upstream
finds no easy way to fix. It is disabled for now until
a proper solution is found upstream.

Signed-off-by: José Pekkarinen <jose.pekkarinen@unikie.com>
---
[ v1 -> v2 ] Fix hash file, and patches messages.
[ v2 -> v3 ]
- Remove strict aliasing patch
- Add approved patch for maybe uninitialized errors
- Disable sourcery-arm toolchain
[ v3 -> v4 ]
- Enable libressl
- Added cascade dependencies
- disabled strict building

 DEVELOPERS                                    |  1 +
 package/Config.in                             |  1 +
 .../0001-Fix-maybe-uninitialized-errors.patch | 83 +++++++++++++++++++
 package/opensc/Config.in                      | 17 ++++
 package/opensc/opensc.hash                    |  5 ++
 package/opensc/opensc.mk                      | 15 ++++
 6 files changed, 122 insertions(+)
 create mode 100644 package/opensc/0001-Fix-maybe-uninitialized-errors.patch
 create mode 100644 package/opensc/Config.in
 create mode 100644 package/opensc/opensc.hash
 create mode 100644 package/opensc/opensc.mk

diff --git a/DEVELOPERS b/DEVELOPERS
index 55f37dfe62..45e7192e65 100644
--- a/DEVELOPERS
+++ b/DEVELOPERS
@@ -1515,6 +1515,7 @@ F:	support/testing/tests/package/test_zfs.py
 N:	José Pekkarinen <jose.pekkarinen@unikie.com>
 F:	package/alfred/
 F:	package/bmx7/
+F:	package/opensc/
 F:	package/python-aexpect/
 F:	package/softhsm2/
 F:	support/testing/tests/package/sample_python_aexpect.py
diff --git a/package/Config.in b/package/Config.in
index a1924f96df..b40909ef89 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -1643,6 +1643,7 @@ menu "Hardware handling"
 	source "package/mtdev/Config.in"
 	source "package/ne10/Config.in"
 	source "package/neardal/Config.in"
+	source "package/opensc/Config.in"
 	source "package/owfs/Config.in"
 	source "package/pcsc-lite/Config.in"
 	source "package/rpi-rgb-led-matrix/Config.in"
diff --git a/package/opensc/0001-Fix-maybe-uninitialized-errors.patch b/package/opensc/0001-Fix-maybe-uninitialized-errors.patch
new file mode 100644
index 0000000000..01b7a39818
--- /dev/null
+++ b/package/opensc/0001-Fix-maybe-uninitialized-errors.patch
@@ -0,0 +1,83 @@
+From bcb39d6f4d2dee6beb035cb2f3618174ec1cb2b0 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Jos=C3=A9=20Pekkarinen?= <jose.pekkarinen@unikie.com>
+Date: Fri, 10 Dec 2021 13:54:26 +0200
+Subject: [PATCH] Fix maybe uninitialized errors
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+PR: https://github.com/OpenSC/OpenSC/pull/2466
+
+Signed-off-by: José Pekkarinen <jose.pekkarinen@unikie.com>
+---
+ src/libopensc/pkcs15-coolkey.c  | 12 ++++++------
+ src/pkcs15init/pkcs15-asepcos.c |  2 +-
+ src/tools/opensc-explorer.c     |  2 +-
+ 3 files changed, 8 insertions(+), 8 deletions(-)
+
+diff --git a/src/libopensc/pkcs15-coolkey.c b/src/libopensc/pkcs15-coolkey.c
+index 586475dd..15684cef 100644
+--- a/src/libopensc/pkcs15-coolkey.c
++++ b/src/libopensc/pkcs15-coolkey.c
+@@ -147,9 +147,9 @@ coolkey_find_matching_cert(sc_card_t *card, sc_cardctl_coolkey_object_t *in_obj,
+ static int
+ coolkey_get_attribute_ulong(sc_card_t *card, sc_cardctl_coolkey_object_t *obj, CK_ATTRIBUTE_TYPE type, CK_ULONG *value)
+ {
+-	const u8 *val;
+-	size_t val_len;
+-	u8 data_type;
++	const u8 *val = NULL;
++	size_t val_len = 0;
++	u8 data_type = 0;
+ 	int r;
+ 
+ 	r  = coolkey_get_attribute(card, obj, type, &val, &val_len, &data_type);
+@@ -168,8 +168,8 @@ static int
+ coolkey_get_attribute_boolean(sc_card_t *card, sc_cardctl_coolkey_object_t *obj, CK_ATTRIBUTE_TYPE attr_type)
+ {
+ 	int r;
+-	const u8 *val;
+-	size_t val_len;
++	const u8 *val = NULL;
++	size_t val_len = 0;
+ 
+ 	r = coolkey_get_attribute(card, obj, attr_type, &val, &val_len, NULL);
+ 	if (r < 0) {
+@@ -186,7 +186,7 @@ static int
+ coolkey_get_attribute_bytes(sc_card_t *card, sc_cardctl_coolkey_object_t *obj, CK_ATTRIBUTE_TYPE type, u8 *data, size_t *data_len, size_t max_data_len)
+ {
+ 	const u8 *val;
+-	size_t val_len;
++	size_t val_len = 0;
+ 	int r;
+ 
+ 	r = coolkey_get_attribute(card, obj, type, &val, &val_len, NULL);
+diff --git a/src/pkcs15init/pkcs15-asepcos.c b/src/pkcs15init/pkcs15-asepcos.c
+index d7122012..bc0efb5c 100644
+--- a/src/pkcs15init/pkcs15-asepcos.c
++++ b/src/pkcs15init/pkcs15-asepcos.c
+@@ -221,7 +221,7 @@ static int asepcos_do_store_pin(sc_profile_t *profile, sc_card_t *card,
+ {
+ 	sc_file_t *nfile = NULL;
+ 	u8  buf[64], sbuf[64], *p = buf, *q = sbuf;
+-	int r, akn;
++	int r, akn = 0;
+ 
+ 	if (auth_info->auth_type != SC_PKCS15_PIN_AUTH_TYPE_PIN)
+ 		return SC_ERROR_OBJECT_NOT_VALID;
+diff --git a/src/tools/opensc-explorer.c b/src/tools/opensc-explorer.c
+index 9ec4daa1..04efdf8f 100644
+--- a/src/tools/opensc-explorer.c
++++ b/src/tools/opensc-explorer.c
+@@ -2472,7 +2472,7 @@ int main(int argc, char *argv[])
+ 		char *line;
+ 		int cargc;
+ 		char *cargv[260];
+-		int multiple;
++		int multiple = 0;
+ 		struct command *cmd;
+ 		char prompt[3*SC_MAX_PATH_STRING_SIZE];
+ 
+-- 
+2.25.1
+
diff --git a/package/opensc/Config.in b/package/opensc/Config.in
new file mode 100644
index 0000000000..1b1ba0d38e
--- /dev/null
+++ b/package/opensc/Config.in
@@ -0,0 +1,17 @@
+config BR2_PACKAGE_OPENSC
+	bool "opensc"
+	depends on !BR2_STATIC_LIBS
+	depends on BR2_TOOLCHAIN_HAS_THREADS
+	depends on BR2_USE_MMU # fork()
+	select BR2_PACKAGE_PCSC_LITE
+	select BR2_PACKAGE_OPENSSL
+	help
+	  OpenSC provides a set of libraries and utilities to work
+	  with smart cards.
+
+	  https://github.com/OpenSC/OpenSC/wiki
+
+comment "opensc needs a toolchain with dynamic library support distinct from sourcery-arm"
+	depends on BR2_STATIC_LIBS
+	depends on BR2_TOOLCHAIN_HAS_THREADS
+	depends on BR2_USE_MMU
diff --git a/package/opensc/opensc.hash b/package/opensc/opensc.hash
new file mode 100644
index 0000000000..517cfe503a
--- /dev/null
+++ b/package/opensc/opensc.hash
@@ -0,0 +1,5 @@
+# Computed locally from https://https://github.com/OpenSC/OpenSC/releases/
+sha256  8d4e5347195ebea332be585df61dcc470331c26969e4b0447c851fb0844c7186  opensc-0.22.0.tar.gz
+
+# Computed locally
+sha256  376b54d4c5f4aa99421823fa4da93e3ab73096fce2400e89858632aa7da24a14  COPYING
diff --git a/package/opensc/opensc.mk b/package/opensc/opensc.mk
new file mode 100644
index 0000000000..c948bc2c79
--- /dev/null
+++ b/package/opensc/opensc.mk
@@ -0,0 +1,15 @@
+################################################################################
+#
+# opensc
+#
+################################################################################
+
+OPENSC_VERSION = 0.22.0
+OPENSC_SITE = https://github.com/OpenSC/OpenSC/releases/download/$(OPENSC_VERSION)
+OPENSC_LICENSE = LGPL-2.1+
+OPENSC_LICENSE_FILES = COPYING
+OPENSC_DEPENDENCIES = openssl pcsc-lite
+OPENSC_INSTALL_STAGING = YES
+OPENSC_CONF_OPTS="--disable-strict"
+
+$(eval $(autotools-package))
-- 
2.25.1

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-07-24 12:45 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-01-14  7:08 [Buildroot] [PATCH v4] package/opensc: new package José Pekkarinen
2022-02-28 10:18 ` José Pekkarinen
2022-07-24 12:45 ` Thomas Petazzoni via buildroot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox