br-ext: embed opensc for pkcs11-tool
Embed opensc package for pkcs11-tool to play with the PKCS11 TA.
Examples of using pkcs11-tool with PKCS11 TA:
# Get tokens/slots info
pkcs11-tool --show-info
pkcs11-tool --list-token-slots
pkcs11-tool --list-mechanisms
# Initialize token and user PIN
pkcs11-tool --init-token --label test-token --so-pin 1234567890
pkcs11-tool --label test-token --login --so-pin 1234567890 \
--init-pin --pin ABCDEFGHIJ
# Generate a 2048bit RSA key
pkcs11-tool --token-label test-token --pin ABCDEFGHIJ \
--keypairgen --key-type RSA:2048 --id 123 --label rsa-test-key
# List token object
pkcs11-tool --token-label test-token --list-objects
Co-developed-by: Gábor Székely <szvgabor@gmail.com>
Signed-off-by: Gábor Székely <szvgabor@gmail.com>
Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org>
Acked-by: Jens Wiklander <jens.wiklander@linaro.org>
diff --git a/br-ext/Config.in b/br-ext/Config.in
index fb62051..276e971 100644
--- a/br-ext/Config.in
+++ b/br-ext/Config.in
@@ -3,3 +3,4 @@
source "$BR2_EXTERNAL_OPTEE_PATH/package/optee_test_ext/Config.in"
source "$BR2_EXTERNAL_OPTEE_PATH/package/optee_examples_ext/Config.in"
source "$BR2_EXTERNAL_OPTEE_PATH/package/optee_benchmark_ext/Config.in"
+source "$BR2_EXTERNAL_OPTEE_PATH/package/opensc/Config.in"
diff --git a/br-ext/package/opensc/Config.in b/br-ext/package/opensc/Config.in
new file mode 100644
index 0000000..e7b9df1
--- /dev/null
+++ b/br-ext/package/opensc/Config.in
@@ -0,0 +1,5 @@
+config BR2_PACKAGE_OPENSC
+ bool "opensc"
+ select BR2_PACKAGE_PCSC_LITE
+ help
+ Installs opensc
diff --git a/br-ext/package/opensc/opensc.mk b/br-ext/package/opensc/opensc.mk
new file mode 100644
index 0000000..3ea04eb
--- /dev/null
+++ b/br-ext/package/opensc/opensc.mk
@@ -0,0 +1,28 @@
+################################################################################
+#
+# OpenSC
+#
+################################################################################
+
+OPENSC_VERSION = 0.21.0
+OPENSC_SOURCE = OpenSC-$(OPENSC_VERSION).tar.gz
+OPENSC_SITE = $(call github,OpenSC,OpenSC,$(OPENSC_VERSION))
+#OPENSC_SITE_METHOD = git
+
+OPENSC_INSTALL_STAGING = NO
+OPENSC_INSTALL_TARGET = YES
+
+OPENSC_AUTORECONF = YES
+OPENSC_AUTORECONF_OPTS = --verbose --install --force
+OPENSC_DEPENDENCIES = pcsc-lite
+
+# Default rely on OP-TEE PKCS11 TA as PKCS11 provider
+OPENSC_CONF_OPTS = --with-pkcs11-provider=/usr/lib/libckteec.so
+
+# We don't really need OpenSSL...
+ifeq ($(BR2_PACKAGE_OPENSSL),y)
+OPENSC_DEPENDENCIES = openssl
+OPENSC_CONF_OPTS += --with-crypto-backend=openssl
+endif
+
+$(eval $(autotools-package))
diff --git a/common.mk b/common.mk
index 28bbbd8..63a233b 100644
--- a/common.mk
+++ b/common.mk
@@ -278,6 +278,9 @@
BR2_PACKAGE_STRACE ?= y
BR2_TARGET_GENERIC_GETTY_PORT ?= $(if $(CFG_NW_CONSOLE_UART),ttyAMA$(CFG_NW_CONSOLE_UART),ttyAMA0)
+# Embed opensc for pkcs11-tool
+BR2_PACKAGE_OPENSC ?= y
+
# All BR2_* variables from the makefile or the environment are appended to
# ../out-br/extra.conf. All values are quoted "..." except y and n.
double-quote = "#" # This really sets the variable to " and avoids upsetting vim's syntax highlighting