package/opensc: new package

Signed-off-by: José Pekkarinen <jose.pekkarinen@unikie.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
This commit is contained in:
José Pekkarinen 2022-01-14 09:08:52 +02:00 committed by Thomas Petazzoni
parent e2511d88e8
commit 8aaa7ecbce
6 changed files with 120 additions and 0 deletions

View File

@ -1558,6 +1558,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/python-alembic/
F: package/python-lark/

View File

@ -1644,6 +1644,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"

View File

@ -0,0 +1,82 @@
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
Signed-off-by: José Pekkarinen <jose.pekkarinen@unikie.com>
Upstream: https://github.com/OpenSC/OpenSC/commit/05ec8c7fe785a2b9aeaac1164adb349df42b7f80
---
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

16
package/opensc/Config.in Normal file
View File

@ -0,0 +1,16 @@
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, threads"
depends on BR2_USE_MMU
depends on BR2_STATIC_LIBS || !BR2_TOOLCHAIN_HAS_THREADS

View File

@ -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

15
package/opensc/opensc.mk Normal file
View File

@ -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))