Skip to contentSkip to conversation

package/opensc: new package

PATCH Superseded Yair Ben-Avraham 2 participants 3 messages Oct 15, 2020 – Oct 18, 2020

v3 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 package/opensc: new package

Open source smart card tools and middleware.
OpenSC provides a set of libraries and utilities to work with smart cards. Its main focus is on cards that support cryptographic operations, and facilitate their use in security applications such as authentication, mail encryption and digital signatures. OpenSC implements the standard APIs to smart cards, e.g. PKCS#11 API, Windows? Smart Card Minidriver and macOS CryptoTokenKit.

---
 package/Config.in          |  1 +
 package/opensc/Config.in   | 23 +++++++++++++++++++++++
 package/opensc/opensc.hash |  3 +++
 package/opensc/opensc.mk   | 14 ++++++++++++++
 4 files changed, 41 insertions(+)
 create mode 100644 package/opensc/Config.in
 create mode 100644 package/opensc/opensc.hash
 create mode 100644 package/opensc/opensc.mk
package/Config.in +1 -0
index 09a332e3b9..1a697352c9 100644
@@ -1353,6 +1353,7 @@ menu "Crypto"
 	source "package/libuecc/Config.in"
 	source "package/mbedtls/Config.in"
 	source "package/nettle/Config.in"
+	source "package/opensc/Config.in"
 	source "package/openssl/Config.in"
 	source "package/pkcs11-helper/Config.in"
 	source "package/rhash/Config.in"
package/opensc/Config.in new file +23 -0
new file mode 100644
index 0000000000..973c50caec
@@ -0,0 +1,23 @@
+config BR2_PACKAGE_OPENSC
+	bool "opensc"
+	depends on BR2_TOOLCHAIN_HAS_THREADS # pcsc-lite, libusb
+	depends on BR2_USE_MMU # pcsc-lite
+	depends on BR2_USE_WCHAR # wprintf
+	depends on !BR2_STATIC_LIBS # pcsc-lite
+	select BR2_PACKAGE_LIBUSB
+	select BR2_PACKAGE_PCSC_LITE
+	help
+	  Open source smart card tools and middleware.
+	  OpenSC provides a set of libraries and utilities to work with smart
+	  cards. Its main focus is on cards that support cryptographic
+	  operations, and facilitate their use in security applications such as
+	  authentication, mail encryption and digital signatures. OpenSC
+	  implements the standard APIs to smart cards, e.g. PKCS#11 API,
+	  Windows? Smart Card Minidriver and macOS CryptoTokenKit.
+
+	  https://github.com/OpenSC/OpenSC
+
+comment "opensc needs a toolchain w/ wchar threads, dynamic library"
+	depends on BR2_USE_MMU
+	depends on !BR2_TOOLCHAIN_HAS_THREADS || !BR2_USE_WCHAR \
+		|| BR2_STATIC_LIBS
package/opensc/opensc.hash new file +3 -0
new file mode 100644
index 0000000000..aceb51e2de
@@ -0,0 +1,3 @@
+# Locally computed:
+sha256  bbf4b4f4a44463645c90a525e820a8059b2f742a53b7b944f941de3c97ba4863  opensc-0.20.0.tar.gz
+sha256  a190dc9c8043755d90f8b0a75fa66b9e42d4af4c980bf5ddc633f0124db3cee7  COPYING
package/opensc/opensc.mk new file +14 -0
new file mode 100644
index 0000000000..8bd6fceece
@@ -0,0 +1,14 @@
+################################################################################
+#
+# opensc
+#
+################################################################################
+
+OPENSC_VERSION = 0.20.0
+OPENSC_SITE = https://github.com/OpenSC/OpenSC/releases/download/$(OPENSC_VERSION)
+OPENSC_LICENSE = LGPL-2.1+
+OPENSC_LICENSE_FILES = COPYING
+OPENSC_INSTALL_STAGING = YES
+OPENSC_DEPENDENCIES = libusb pcsc-lite
+
+$(eval $(autotools-package))

--
2.20.1

#1 lore raw

PATCH v3 1/1 package/opensc: new package

Hello,

Quoted 8 lines · On Thu, 15 Oct 2020 15:01:36 +0000 Yair Ben-Avraham via buildroot…

Open source smart card tools and middleware.
OpenSC provides a set of libraries and utilities to work with smart cards. Its main focus is on cards that support cryptographic operations, and facilitate their use in security applications such as authentication, mail encryption and digital signatures. OpenSC implements the standard APIs to smart cards, e.g. PKCS#11 API, Windows? Smart Card Minidriver and macOS CryptoTokenKit.

I was about to apply, but unfortunately the build fails with the following defconfig:

BR2_arm=y
BR2_TOOLCHAIN_EXTERNAL=y
BR2_TOOLCHAIN_EXTERNAL_CUSTOM=y
BR2_TOOLCHAIN_EXTERNAL_DOWNLOAD=y BR2_TOOLCHAIN_EXTERNAL_URL="http://autobuild.buildroot.org/toolchains/tarballs/br-arm-full-2020.02.tar.bz2" BR2_TOOLCHAIN_EXTERNAL_GCC_5=y
BR2_TOOLCHAIN_EXTERNAL_HEADERS_4_14=y
BR2_TOOLCHAIN_EXTERNAL_LOCALE=y
# BR2_TOOLCHAIN_EXTERNAL_HAS_THREADS_DEBUG is not set
BR2_TOOLCHAIN_EXTERNAL_CXX=y
BR2_INIT_NONE=y
BR2_SYSTEM_BIN_SH_NONE=y
# BR2_PACKAGE_BUSYBOX is not set
BR2_PACKAGE_OPENSC=y
# BR2_TARGET_ROOTFS_TAR is not set

The failure is:

pkcs15-asepcos.c: In function ?asepcos_do_store_pin.isra.3?:
pkcs15-asepcos.c:307:33: error: ?akn? may be used uninitialized in this function [-Werror=maybe-uninitialized]

  auth_info->attrs.pin.reference = akn;
                                 ^

cc1: all warnings being treated as errors

Since you're going to send a new iteration for this, could you also make sure to update the DEVELOPERS file in the same patch to add yourself as a maintainer for this package ?

Thanks a lot!

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
#2 lore raw

PATCH v3 1/1 package/opensc: new package

Fixed in v4 for this patch.

In general, can you publish/refer to a minimal defconfigs for testing?

Thanks,
Yair

??????? Original Message ???????

Quoted 66 lines · Thomas Petazzoni

Hello,

Quoted 7 lines · On Thu, 15 Oct 2020 15:01:36 +0000 Yair Ben-Avraham via buildroot buildroot at…

Open source smart card tools and middleware.
OpenSC provides a set of libraries and utilities to work with smart cards. Its main focus is on cards that support cryptographic operations, and facilitate their use in security applications such as authentication, mail encryption and digital signatures. OpenSC implements the standard APIs to smart cards, e.g. PKCS#11 API, Windows? Smart Card Minidriver and macOS CryptoTokenKit.
Signed-off-by: Yair Ben-Avraham yairba at protonmail.com

I was about to apply, but unfortunately the build fails with the following defconfig:

BR2_arm=y
BR2_TOOLCHAIN_EXTERNAL=y
BR2_TOOLCHAIN_EXTERNAL_CUSTOM=y
BR2_TOOLCHAIN_EXTERNAL_DOWNLOAD=y BR2_TOOLCHAIN_EXTERNAL_URL="http://autobuild.buildroot.org/toolchains/tarballs/br-arm-full-2020.02.tar.bz2" BR2_TOOLCHAIN_EXTERNAL_GCC_5=y
BR2_TOOLCHAIN_EXTERNAL_HEADERS_4_14=y
BR2_TOOLCHAIN_EXTERNAL_LOCALE=y

BR2_TOOLCHAIN_EXTERNAL_HAS_THREADS_DEBUG is not set

====================================================

BR2_TOOLCHAIN_EXTERNAL_CXX=y
BR2_INIT_NONE=y
BR2_SYSTEM_BIN_SH_NONE=y

BR2_PACKAGE_BUSYBOX is not set

===============================

BR2_PACKAGE_OPENSC=y

BR2_TARGET_ROOTFS_TAR is not set

=================================

The failure is:

pkcs15-asepcos.c: In function ?asepcos_do_store_pin.isra.3?:
pkcs15-asepcos.c:307:33: error: ?akn? may be used uninitialized in this function [-Werror=maybe-uninitialized] auth_info->attrs.pin.reference = akn;

                                 ^

cc1: all warnings being treated as errors

Since you're going to send a new iteration for this, could you also make sure to update the DEVELOPERS file in the same patch to add yourself as a maintainer for this package ?

Thanks a lot!

Thomas

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com