From b8ba592567a477514e70afa9b8a953ed96101f69 Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: Nov 19 2015 15:30:30 +0000 Subject: import opensc-0.14.0-1.el7 --- diff --git a/.gitignore b/.gitignore index c28b7a1..d03eea6 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1 @@ -SOURCES/opensc-0.13.0.tar.gz +SOURCES/opensc-0.14.0.tar.gz diff --git a/.opensc.metadata b/.opensc.metadata index da47019..e385c35 100644 --- a/.opensc.metadata +++ b/.opensc.metadata @@ -1 +1 @@ -9285ccbed7b49f63e488c8fb1b3e102994a28218 SOURCES/opensc-0.13.0.tar.gz +4a898e351b0a6d2a5d81576daa7ebed45baf9138 SOURCES/opensc-0.14.0.tar.gz diff --git a/SOURCES/0001-When-setting-pointers-to-a-template-ensure-they-do-n.patch b/SOURCES/0001-When-setting-pointers-to-a-template-ensure-they-do-n.patch deleted file mode 100644 index e9f7700..0000000 --- a/SOURCES/0001-When-setting-pointers-to-a-template-ensure-they-do-n.patch +++ /dev/null @@ -1,72 +0,0 @@ -diff -ur opensc-0.13.0.orig/src/tools/pkcs11-tool.c opensc-0.13.0/src/tools/pkcs11-tool.c ---- opensc-0.13.0.orig/src/tools/pkcs11-tool.c 2012-12-04 15:43:40.000000000 +0100 -+++ opensc-0.13.0/src/tools/pkcs11-tool.c 2014-02-25 11:57:48.550718249 +0100 -@@ -1778,6 +1778,9 @@ - CK_RV rv; - int need_to_parse_certdata = 0; - unsigned char *oid_buf = NULL; -+ CK_OBJECT_CLASS clazz; -+ CK_CERTIFICATE_TYPE cert_type; -+ CK_KEY_TYPE type; - #ifdef ENABLE_OPENSSL - struct x509cert_info cert; - struct rsakey_info rsa; -@@ -1858,8 +1861,8 @@ - } - - if (opt_object_class == CKO_CERTIFICATE) { -- CK_OBJECT_CLASS clazz = CKO_CERTIFICATE; -- CK_CERTIFICATE_TYPE cert_type = CKC_X_509; -+ clazz = CKO_CERTIFICATE; -+ cert_type = CKC_X_509; - - FILL_ATTR(cert_templ[0], CKA_TOKEN, &_true, sizeof(_true)); - FILL_ATTR(cert_templ[1], CKA_VALUE, contents, contents_len); -@@ -1892,7 +1895,7 @@ - } - else - if (opt_object_class == CKO_PRIVATE_KEY) { -- CK_OBJECT_CLASS clazz = CKO_PRIVATE_KEY; -+ clazz = CKO_PRIVATE_KEY; - - n_privkey_attr = 0; - FILL_ATTR(privkey_templ[n_privkey_attr], CKA_CLASS, &clazz, sizeof(clazz)); -@@ -1918,7 +1921,7 @@ - n_privkey_attr++; - } - if (evp_key->type == EVP_PKEY_RSA) { -- CK_KEY_TYPE type = CKK_RSA; -+ type = CKK_RSA; - FILL_ATTR(privkey_templ[n_privkey_attr], CKA_KEY_TYPE, &type, sizeof(type)); - n_privkey_attr++; - FILL_ATTR(privkey_templ[n_privkey_attr], CKA_MODULUS, rsa.modulus, rsa.modulus_len); -@@ -1940,7 +1943,7 @@ - } - #if OPENSSL_VERSION_NUMBER >= 0x10000000L && !defined(OPENSSL_NO_EC) - else if (evp_key->type == NID_id_GostR3410_2001) { -- CK_KEY_TYPE type = CKK_GOSTR3410; -+ type = CKK_GOSTR3410; - - FILL_ATTR(privkey_templ[n_privkey_attr], CKA_KEY_TYPE, &type, sizeof(type)); - n_privkey_attr++; -@@ -1958,8 +1961,8 @@ - } - else - if (opt_object_class == CKO_PUBLIC_KEY) { -- CK_OBJECT_CLASS clazz = CKO_PUBLIC_KEY; -- CK_KEY_TYPE type = CKK_RSA; -+ clazz = CKO_PUBLIC_KEY; -+ type = CKK_RSA; - - FILL_ATTR(pubkey_templ[0], CKA_CLASS, &clazz, sizeof(clazz)); - FILL_ATTR(pubkey_templ[1], CKA_KEY_TYPE, &type, sizeof(type)); -@@ -1998,7 +2001,7 @@ - } - else - if (opt_object_class == CKO_DATA) { -- CK_OBJECT_CLASS clazz = CKO_DATA; -+ clazz = CKO_DATA; - FILL_ATTR(data_templ[0], CKA_CLASS, &clazz, sizeof(clazz)); - FILL_ATTR(data_templ[1], CKA_TOKEN, &_true, sizeof(_true)); - FILL_ATTR(data_templ[2], CKA_VALUE, &contents, contents_len); -Only in opensc-0.13.0/src/tools: pkcs11-tool.c.orig diff --git a/SOURCES/0001-pkcs15-regression-in-e35febe-compute-cert-length.patch b/SOURCES/0001-pkcs15-regression-in-e35febe-compute-cert-length.patch deleted file mode 100644 index f00bce0..0000000 --- a/SOURCES/0001-pkcs15-regression-in-e35febe-compute-cert-length.patch +++ /dev/null @@ -1,114 +0,0 @@ -From cc5a171ddcc8e49b2252135daac9ad3aa6d66ae7 Mon Sep 17 00:00:00 2001 -From: Viktor Tarasov -Date: Tue, 25 Dec 2012 20:05:45 +0100 -Subject: [PATCH] pkcs15: regression in e35febe: compute cert length - -parse_x509_cert() reviewed. -Now certificate's DER data are allocated and the DER data length is determined in one place. - -https://github.com/OpenSC/OpenSC/pull/114 -https://github.com/OpenSC/OpenSC/commit/e35febe ---- - src/libopensc/pkcs15-cert.c | 37 +++++++++++++++++++------------------ - 1 file changed, 19 insertions(+), 18 deletions(-) - -diff --git a/src/libopensc/pkcs15-cert.c b/src/libopensc/pkcs15-cert.c -index 86bea25..9b08aac 100644 ---- a/src/libopensc/pkcs15-cert.c -+++ b/src/libopensc/pkcs15-cert.c -@@ -34,13 +34,13 @@ - #include "pkcs15.h" - - static int --parse_x509_cert(sc_context_t *ctx, const u8 *buf, size_t buflen, struct sc_pkcs15_cert *cert) -+parse_x509_cert(sc_context_t *ctx, struct sc_pkcs15_der *der, struct sc_pkcs15_cert *cert) - { - int r; - struct sc_algorithm_id sig_alg; -- struct sc_pkcs15_pubkey * pubkey = NULL; -- u8 *serial = NULL; -- size_t serial_len = 0; -+ struct sc_pkcs15_pubkey *pubkey = NULL; -+ unsigned char *serial = NULL, *buf = der->value; -+ size_t serial_len = 0, data_len = 0, buflen = der->len; - struct sc_asn1_entry asn1_version[] = { - { "version", SC_ASN1_INTEGER, SC_ASN1_TAG_INTEGER, 0, &cert->version, NULL }, - { NULL, 0, 0, 0, NULL, NULL } -@@ -87,30 +87,32 @@ parse_x509_cert(sc_context_t *ctx, const u8 *buf, size_t buflen, struct sc_pkcs1 - if (obj == NULL) - LOG_TEST_RET(ctx, SC_ERROR_INVALID_ASN1_OBJECT, "X.509 certificate not found"); - -- cert->data.len = objlen + (obj - buf); -+ data_len = objlen + (obj - buf); -+ cert->data.value = malloc(data_len); -+ if (!cert->data.value) -+ LOG_FUNC_RETURN(ctx, SC_ERROR_OUT_OF_MEMORY); -+ memcpy(cert->data.value, buf, data_len); -+ cert->data.len = data_len; -+ - r = sc_asn1_decode(ctx, asn1_cert, obj, objlen, NULL, NULL); - LOG_TEST_RET(ctx, r, "ASN.1 parsing of certificate failed"); - - cert->version++; - -- if (pubkey) { -- cert->key = pubkey; -- pubkey = NULL; -- } -- else { -+ if (!pubkey) - LOG_TEST_RET(ctx, SC_ERROR_INVALID_ASN1_OBJECT, "Unable to decode subjectPublicKeyInfo from cert"); -- } -+ cert->key = pubkey; -+ - sc_asn1_clear_algorithm_id(&sig_alg); -- if (r < 0) -- return r; - - if (serial && serial_len) { - sc_format_asn1_entry(asn1_serial_number + 0, serial, &serial_len, 1); - r = sc_asn1_encode(ctx, asn1_serial_number, &cert->serial, &cert->serial_len); - free(serial); -+ LOG_TEST_RET(ctx, r, "ASN.1 encoding of serial failed"); - } - -- return r; -+ return SC_SUCCESS; - } - - -@@ -125,7 +127,7 @@ sc_pkcs15_pubkey_from_cert(struct sc_context *ctx, - if (cert == NULL) - return SC_ERROR_OUT_OF_MEMORY; - -- rv = parse_x509_cert(ctx, cert_blob->value, cert_blob->len, cert); -+ rv = parse_x509_cert(ctx, cert_blob, cert); - - *out = cert->key; - cert->key = NULL; -@@ -158,20 +160,19 @@ sc_pkcs15_read_certificate(struct sc_pkcs15_card *p15card, const struct sc_pkcs1 - return SC_ERROR_OBJECT_NOT_FOUND; - } - -- - cert = malloc(sizeof(struct sc_pkcs15_cert)); - if (cert == NULL) { - free(der.value); - return SC_ERROR_OUT_OF_MEMORY; - } - memset(cert, 0, sizeof(struct sc_pkcs15_cert)); -- if (parse_x509_cert(p15card->card->ctx, der.value, der.len, cert)) { -+ if (parse_x509_cert(p15card->card->ctx, &der, cert)) { - free(der.value); - sc_pkcs15_free_certificate(cert); - return SC_ERROR_INVALID_ASN1_OBJECT; - } -+ free(der.value); - -- cert->data = der; - *cert_out = cert; - return SC_SUCCESS; - } --- -1.8.1 - diff --git a/SPECS/opensc.spec b/SPECS/opensc.spec index 867cbba..0c97bb5 100644 --- a/SPECS/opensc.spec +++ b/SPECS/opensc.spec @@ -1,24 +1,21 @@ Name: opensc -Version: 0.13.0 -Release: 9%{?dist} +Version: 0.14.0 +Release: 1%{?dist} Summary: Smart card library and applications Group: System Environment/Libraries License: LGPLv2+ -URL: https://www.opensc-project.org/ +URL: https://github.com/OpenSC/OpenSC/wiki Source0: http://downloads.sourceforge.net/project/opensc/OpenSC/opensc-%{version}/%{name}-%{version}.tar.gz Source1: opensc.module -# Upstream patch for fixing pkcs15 cert length calculation -Patch0: 0001-pkcs15-regression-in-e35febe-compute-cert-length.patch -Patch1: 0001-When-setting-pointers-to-a-template-ensure-they-do-n.patch - BuildRequires: pcsc-lite-devel BuildRequires: readline-devel BuildRequires: openssl-devel BuildRequires: /usr/bin/xsltproc BuildRequires: docbook-style-xsl Requires: pcsc-lite-libs%{?_isa} +Requires: pcsc-lite Obsoletes: mozilla-opensc-signer < 0.12.0 Obsoletes: opensc-devel < 0.12.0 @@ -34,8 +31,6 @@ every software/card that does so, too. %prep %setup -q -%patch0 -p1 -b .cert_length -%patch1 -p1 -b .scope_fix sed -i -e 's/opensc.conf/opensc-%{_arch}.conf/g' src/libopensc/Makefile.in sed -i -e 's|"/lib /usr/lib\b|"/%{_lib} %{_libdir}|' configure # lib64 rpaths @@ -49,6 +44,7 @@ sed -i -e 's|/usr/local/towitoko/lib/|/usr/lib/ctapi/|' etc/opensc.conf.in %configure --disable-static \ --disable-assert \ --enable-pcsc \ + --enable-sm \ --with-pcsc-provider=libpcsclite.so.1 make %{?_smp_mflags} V=1 @@ -57,7 +53,7 @@ make %{?_smp_mflags} V=1 make install DESTDIR=$RPM_BUILD_ROOT rm -f $RPM_BUILD_ROOT%{_sysconfdir}/opensc.conf install -Dpm 644 etc/opensc.conf $RPM_BUILD_ROOT%{_sysconfdir}/opensc-%{_arch}.conf -install -Dpm 644 %{SOURCE1} $RPM_BUILD_ROOT%{_datadir}/p11-kit/opensc.module +install -Dpm 644 %{SOURCE1} $RPM_BUILD_ROOT%{_datadir}/p11-kit/modules/opensc.module # use NEWS file timestamp as reference for configuration file touch -r NEWS $RPM_BUILD_ROOT%{_sysconfdir}/opensc-%{_arch}.conf @@ -69,6 +65,7 @@ rm -rf $RPM_BUILD_ROOT%{_datadir}/doc/opensc # public headers and pkgconfig files. # Remove the symlink as nothing is supposed to link against libopensc. rm -f $RPM_BUILD_ROOT%{_libdir}/libopensc.so +rm -f $RPM_BUILD_ROOT%{_libdir}/libsmm-local.so %post -p /sbin/ldconfig @@ -80,7 +77,7 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/libopensc.so %defattr(-,root,root,-) %doc COPYING NEWS README* %config(noreplace) %{_sysconfdir}/opensc-%{_arch}.conf -%{_datadir}/p11-kit/opensc.module +%{_datadir}/p11-kit/modules/opensc.module %{_bindir}/cardos-tool %{_bindir}/cryptoflex-tool %{_bindir}/eidenv @@ -95,12 +92,15 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/libopensc.so %{_bindir}/pkcs15-init %{_bindir}/pkcs15-tool %{_bindir}/sc-hsm-tool +%{_bindir}/dnie-tool %{_bindir}/westcos-tool %{_libdir}/lib*.so.* %{_libdir}/opensc-pkcs11.so %{_libdir}/pkcs11-spy.so +%{_libdir}/onepin-opensc-pkcs11.so %dir %{_libdir}/pkcs11 %{_libdir}/pkcs11/opensc-pkcs11.so +%{_libdir}/pkcs11/onepin-opensc-pkcs11.so %{_libdir}/pkcs11/pkcs11-spy.so %{_datadir}/opensc/ %{_mandir}/man1/cardos-tool.1* @@ -122,6 +122,9 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/libopensc.so %changelog +* Thu Apr 23 2015 Nikos Mavrogiannopoulos 0.14.0-1 +- Updated to opensc 0.14.0 + * Fri Mar 14 2014 Nikos Mavrogiannopoulos 0.13.0-9 - Configuration file includes arch to allow it operate under multilib