opensc-0.17.0-1
This commit is contained in:
parent
a3bc83d330
commit
8a29988675
1
.gitignore
vendored
1
.gitignore
vendored
@ -3,3 +3,4 @@
|
||||
/opensc-0.15.0.tar.gz
|
||||
/opensc-0.16.0.tar.gz
|
||||
/opensc-0.16.0-git0362439.tar.gz
|
||||
/opensc-0.17.0.tar.gz
|
||||
|
59
opensc-coolkey.patch
Normal file
59
opensc-coolkey.patch
Normal file
@ -0,0 +1,59 @@
|
||||
diff --git a/src/libopensc/pkcs15-coolkey.c b/src/libopensc/pkcs15-coolkey.c
|
||||
index 5064a0f..d93875a 100644
|
||||
--- a/src/libopensc/pkcs15-coolkey.c
|
||||
+++ b/src/libopensc/pkcs15-coolkey.c
|
||||
@@ -484,7 +484,7 @@ static int sc_pkcs15emu_coolkey_init(sc_pkcs15_card_t *p15card)
|
||||
sc_card_t *card = p15card->card;
|
||||
sc_serial_number_t serial;
|
||||
int count;
|
||||
-
|
||||
+ struct sc_pkcs15_object *obj;
|
||||
|
||||
SC_FUNC_CALLED(card->ctx, SC_LOG_DEBUG_VERBOSE);
|
||||
|
||||
@@ -558,6 +558,8 @@ static int sc_pkcs15emu_coolkey_init(sc_pkcs15_card_t *p15card)
|
||||
|
||||
|
||||
memset(&obj_obj, 0, sizeof(obj_obj));
|
||||
+ /* coolkey applets have label only on the certificates,
|
||||
+ * but we should copy it also to the keys maching the same ID */
|
||||
coolkey_get_attribute_bytes(card, &coolkey_obj, CKA_LABEL, (u8 *)obj_obj.label, &len, sizeof(obj_obj.label));
|
||||
coolkey_get_flags(card, &coolkey_obj, &obj_obj.flags);
|
||||
if (obj_obj.flags & SC_PKCS15_CO_FLAG_PRIVATE) {
|
||||
@@ -677,6 +679,36 @@ fail:
|
||||
}
|
||||
r = (card->ops->card_ctl)(card, SC_CARDCTL_COOLKEY_FINAL_GET_OBJECTS, &count);
|
||||
|
||||
+ /* Iterate over all the objects again and fill missing labels */
|
||||
+ for (obj = p15card->obj_list; obj != NULL; obj = obj->next) {
|
||||
+ struct sc_pkcs15_id *id = NULL;
|
||||
+ struct sc_pkcs15_object *cert_object;
|
||||
+
|
||||
+ sc_log(card->ctx, "Object with label %s", obj->label);
|
||||
+ if (obj->label[0] != '\0')
|
||||
+ /* label already filled -- do not overwrite */
|
||||
+ continue;
|
||||
+
|
||||
+ switch (obj->type & SC_PKCS15_TYPE_CLASS_MASK) {
|
||||
+ case SC_PKCS15_TYPE_PUBKEY:
|
||||
+ id = &((struct sc_pkcs15_pubkey_info *)obj->data)->id;
|
||||
+ break;
|
||||
+ case SC_PKCS15_TYPE_PRKEY:
|
||||
+ id = &((struct sc_pkcs15_prkey_info *)obj->data)->id;
|
||||
+ break;
|
||||
+ default:
|
||||
+ /* We do not care about other objects */
|
||||
+ continue;
|
||||
+ }
|
||||
+ sc_log(card->ctx, "Object ID is %s", id->value);
|
||||
+ r = sc_pkcs15_find_cert_by_id(p15card, id, &cert_object);
|
||||
+ if (r != 0)
|
||||
+ continue;
|
||||
+
|
||||
+ sc_log(card->ctx, "Found cert with with label %s", cert_object->label);
|
||||
+ memcpy(obj->label, cert_object->label, SC_PKCS15_MAX_LABEL_SIZE);
|
||||
+ }
|
||||
+
|
||||
LOG_FUNC_RETURN(card->ctx, SC_SUCCESS);
|
||||
}
|
||||
|
23
opensc.spec
23
opensc.spec
@ -1,21 +1,18 @@
|
||||
%global commit0 0362439563a11d254aeda63b9e9ddb44ea289308
|
||||
%global shortcommit0 %(c=%{commit0}; echo ${c:0:7})
|
||||
|
||||
%define opensc_module "OpenSC PKCS #11 Module"
|
||||
%define nssdb %{_sysconfdir}/pki/nssdb
|
||||
|
||||
Name: opensc
|
||||
Version: 0.16.0
|
||||
Release: 5.20161016git%{shortcommit0}%{?dist}
|
||||
Version: 0.17.0
|
||||
Release: 1%{?dist}
|
||||
Summary: Smart card library and applications
|
||||
|
||||
Group: System Environment/Libraries
|
||||
License: LGPLv2+
|
||||
URL: https://github.com/OpenSC/OpenSC/wiki
|
||||
Source0: https://github.com/OpenSC/OpenSC/archive/%{commit0}.tar.gz#/%{name}-%{version}-git%{shortcommit0}.tar.gz
|
||||
Source0: https://github.com/OpenSC/OpenSC/releases/download/%{version}/%{name}-%{version}.tar.gz
|
||||
Source1: opensc.module
|
||||
Source2: pkcs11-switch.sh
|
||||
Patch0: opensc-prkey-fixup.patch
|
||||
Patch0: opensc-coolkey.patch
|
||||
|
||||
BuildRequires: pcsc-lite-devel
|
||||
BuildRequires: readline-devel
|
||||
@ -40,9 +37,8 @@ every software/card that does so, too.
|
||||
|
||||
|
||||
%prep
|
||||
%setup -q -n OpenSC-%{commit0}
|
||||
|
||||
%patch0 -p1 -b .prkey-fixes
|
||||
%setup -q
|
||||
%patch0 -p1
|
||||
|
||||
cp -p src/pkcs15init/README ./README.pkcs15init
|
||||
cp -p src/scconf/README.scconf .
|
||||
@ -84,6 +80,10 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/libsmm-local.so
|
||||
rm -rf %{buildroot}%{_sysconfdir}/bash_completion.d/
|
||||
%endif
|
||||
|
||||
# the npa-tool builds to nothing since we do not have OpenPACE library
|
||||
rm -rf %{buildroot}%{_bindir}/npa-tool
|
||||
rm -rf %{buildroot}%{_mandir}/man1/npa-tool.1*
|
||||
|
||||
%post
|
||||
/sbin/ldconfig
|
||||
isThere=`modutil -rawlist -dbdir %{nssdb} | grep %{opensc_module} || echo NO`
|
||||
@ -158,6 +158,9 @@ fi
|
||||
|
||||
|
||||
%changelog
|
||||
* Wed Jul 19 2017 Jakub Jelen <jjelen@redhat.com> - 0.17.0-1
|
||||
- New upstream release including support for Coolkey and CAC cards
|
||||
|
||||
* Tue Feb 28 2017 Jakub Jelen <jjelen@redhat.com> - 0.16.0-5.20161016git0362439
|
||||
- Add PKCS#11 library to the NSS DB (#1421692)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user