Accepting request 38302 from security:chipcard

Copy from security:chipcard/opensc based on submit request 38302 from user coolo

OBS-URL: https://build.opensuse.org/request/show/38302
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/opensc?expand=0&rev=19
This commit is contained in:
OBS User autobuild 2010-04-23 17:28:32 +00:00 committed by Git OBS Bridge
parent d03b09f572
commit 7ee4407f4d
6 changed files with 182 additions and 8 deletions

3
opensc-0.11.13.tar.bz2 Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:8ef1bc9dd5f6c8df6814bfd1a53bd5ac135716a610a1dac957c9d5a35de19071
size 1128054

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:3006ef41fb8903629f5a501eb14e4f3d67f82583d93aa6e75ebde75272291d94
size 1083436

View File

@ -0,0 +1,27 @@
Index: opensc-0.11.13/src/libopensc/card-belpic.c
===================================================================
--- opensc-0.11.13.orig/src/libopensc/card-belpic.c 2010-02-16 10:03:28.000000000 +0100
+++ opensc-0.11.13/src/libopensc/card-belpic.c 2010-04-13 16:29:22.000000000 +0200
@@ -1338,7 +1338,7 @@ static int belpic_pin_cmd_usage(sc_card_
data->pin1.encoding = data->pin2.encoding = BELPIC_PIN_ENCODING;
data->pin1.pad_char = data->pin2.pad_char = BELPIC_PAD_CHAR;
data->pin1.min_length = data->pin2.min_length = BELPIC_MIN_USER_PIN_LEN;
- data->pin1.max_length = data->pin1.max_length = BELPIC_MAX_USER_PIN_LEN;
+ data->pin1.max_length = data->pin2.max_length = BELPIC_MAX_USER_PIN_LEN;
data->apdu = NULL;
return iso_ops->pin_cmd(card, data, tries_left);
Index: opensc-0.11.13/src/libopensc/log.h
===================================================================
--- opensc-0.11.13.orig/src/libopensc/log.h 2010-02-16 10:03:28.000000000 +0100
+++ opensc-0.11.13/src/libopensc/log.h 2010-04-13 16:30:36.000000000 +0200
@@ -74,8 +74,8 @@ void sc_hex_dump(struct sc_context *ctx,
int _ret = (r); \
if (_ret < 0) { \
sc_do_log(ctx, SC_LOG_TYPE_ERROR, __FILE__, __LINE__, __FUNCTION__, "%s: %s\n", (text), sc_strerror(_ret)); \
- return _ret; \
} \
+ return _ret; \
} while(0)
#define sc_perror(ctx, errno, str) { \

118
opensc-libassuan-2.patch Normal file
View File

@ -0,0 +1,118 @@
---
m4/gpg-error.m4 | 65 ++++++++++++++++++++++++++++++++++++++++++++++++++++
m4/libassuan.m4 | 2 -
src/signer/dialog.c | 35 +++++++++++++++++-----------
3 files changed, 88 insertions(+), 14 deletions(-)
Index: opensc-0.11.13/m4/libassuan.m4
===================================================================
--- opensc-0.11.13.orig/m4/libassuan.m4 2009-12-13 10:14:26.000000000 +0100
+++ opensc-0.11.13/m4/libassuan.m4 2010-04-13 12:26:56.000000000 +0200
@@ -26,7 +26,7 @@ AC_DEFUN([_AM_PATH_LIBASSUAN_COMMON],
fi
AC_PATH_PROG(LIBASSUAN_CONFIG, libassuan-config, no)
- tmp=ifelse([$1], ,1:0.9.2,$1)
+ tmp=ifelse([$1], ,2:2.0.0,$1)
if echo "$tmp" | grep ':' >/dev/null 2>/dev/null ; then
req_libassuan_api=`echo "$tmp" | sed 's/\(.*\):\(.*\)/\1/'`
min_libassuan_version=`echo "$tmp" | sed 's/\(.*\):\(.*\)/\2/'`
Index: opensc-0.11.13/src/signer/dialog.c
===================================================================
--- opensc-0.11.13.orig/src/signer/dialog.c 2010-02-16 10:03:25.000000000 +0100
+++ opensc-0.11.13/src/signer/dialog.c 2010-04-13 16:03:10.000000000 +0200
@@ -15,31 +15,31 @@ struct entry_parm_s {
char *buffer;
};
-static AssuanError
+static gpg_error_t
getpin_cb (void *opaque, const void *buffer, size_t length)
{
struct entry_parm_s *parm = (struct entry_parm_s *) opaque;
/* we expect the pin to fit on one line */
if (parm->lines || length >= parm->size)
- return ASSUAN_Too_Much_Data;
+ return gpg_error(GPG_ERR_ASS_TOO_MUCH_DATA);
/* fixme: we should make sure that the assuan buffer is allocated in
secure memory or read the response byte by byte */
memcpy(parm->buffer, buffer, length);
parm->buffer[length] = 0;
parm->lines++;
- return (AssuanError) 0;
+ return gpg_error(GPG_ERR_NO_ERROR);
}
int ask_and_verify_pin_code(struct sc_pkcs15_card *p15card,
struct sc_pkcs15_object *pin)
{
- int r;
+ gpg_error_t r;
size_t len;
const char *argv[3];
const char *pgmname = PIN_ENTRY;
- ASSUAN_CONTEXT ctx;
+ assuan_context_t ctx = NULL;
char buf[500];
char errtext[100];
struct entry_parm_s parm;
@@ -48,16 +48,26 @@ int ask_and_verify_pin_code(struct sc_pk
argv[0] = pgmname;
argv[1] = NULL;
- r = assuan_pipe_connect(&ctx, pgmname, (char **) argv, NULL);
+ assuan_set_gpg_err_source (GPG_ERR_SOURCE_DEFAULT);
+
+ r = assuan_new(&ctx);
+ if (r) {
+ printf("Can't initialize assuan context: %s\n)",
+ gpg_strerror(r));
+ goto err;
+ }
+
+ r = assuan_pipe_connect(ctx, pgmname, (const char **) argv, \
+ NULL, NULL, NULL, 0);
if (r) {
printf("Can't connect to the PIN entry module: %s\n",
- assuan_strerror((AssuanError) r));
+ gpg_strerror(r));
goto err;
}
sprintf(buf, "SETDESC Enter PIN [%s] for digital signing ", pin->label);
r = assuan_transact(ctx, buf, NULL, NULL, NULL, NULL, NULL, NULL);
if (r) {
- printf("SETDESC: %s\n", assuan_strerror((AssuanError) r));
+ printf("SETDESC: %s\n", gpg_strerror(r));
goto err;
}
errtext[0] = 0;
@@ -71,12 +81,12 @@ int ask_and_verify_pin_code(struct sc_pk
parm.size = sizeof(buf);
parm.buffer = buf;
r = assuan_transact(ctx, "GETPIN", getpin_cb, &parm, NULL, NULL, NULL, NULL);
- if (r == ASSUAN_Canceled) {
- assuan_disconnect(ctx);
+ if (gpg_err_code(r) == GPG_ERR_ASS_CANCELED) {
+ assuan_release(ctx);
return -2;
}
if (r) {
- printf("GETPIN: %s\n", assuan_strerror((AssuanError) r));
+ printf("GETPIN: %s\n", gpg_strerror(r));
goto err;
}
len = strlen(buf);
@@ -104,9 +114,9 @@ int ask_and_verify_pin_code(struct sc_pk
break;
}
- assuan_disconnect(ctx);
+ assuan_release(ctx);
return 0;
err:
- assuan_disconnect(ctx);
+ assuan_release(ctx);
return -1;
}

View File

@ -1,3 +1,17 @@
-------------------------------------------------------------------
Tue Apr 13 14:35:32 UTC 2010 - puzel@novell.com
- update to version 0.11.13
* Modify Rutoken S binary interfaces by Aktiv Co.
* Muscle driver fixed (acl reading issue)
* Many small fixes (e.g. mem leaks)
* Compiling with openssl 1.0.0-beta fixed
* Document integer problem in OpenSC and implement workaround
* Improve entersafe profile to support private data objects
- Require pinentry
- add opensc-libassuan-2.patch
- add opensc-fix-gcc-warnings.patch
-------------------------------------------------------------------
Fri Jan 1 20:07:35 CET 2010 - jengelh@medozas.de

View File

@ -1,5 +1,5 @@
#
# spec file for package opensc (Version 0.11.9)
# spec file for package opensc (Version 0.11.13)
#
# Copyright (c) 2010 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
@ -19,19 +19,29 @@
Name: opensc
BuildRequires: libassuan-devel libusb-devel openct-devel openssl-devel pcsc-lite-devel pkg-config readline-devel xorg-x11-devel
BuildRequires: libassuan-devel >= 2.0.0
BuildRequires: libusb-devel
BuildRequires: openct-devel
BuildRequires: openssl-devel
BuildRequires: pcsc-lite-devel
BuildRequires: pkg-config
BuildRequires: readline-devel
BuildRequires: xorg-x11-devel
BuildRequires: libgpg-error-devel
# bug437293
%ifarch ppc64
Obsoletes: opensc-64bit
%endif
#
Url: http://www.opensc-project.org/opensc/
Version: 0.11.9
Release: 2
Version: 0.11.13
Release: 1
Group: Productivity/Security
Summary: OpenSC Smart Card Library
License: LGPLv2.1+
Requires: libopensc2 = %{version} pcsc-lite
Requires: libopensc2 = %{version}
Requires: pcsc-lite
Requires: pinentry
BuildRoot: %{_tmppath}/%{name}-%{version}-build
Source: %{name}-%{version}.tar.bz2
Source1: %{name}-ADVISORIES
@ -39,6 +49,8 @@ Source1: %{name}-ADVISORIES
Source2: %{name}-rpmlintrc
# and also skip-check-libtool-deps (and add these dependencies to the devel package)
Source3: baselibs.conf
Patch0: opensc-libassuan-2.patch
Patch1: opensc-fix-gcc-warnings.patch
%description
OpenSC provides a set of libraries and utilities to access smart cards.
@ -117,6 +129,8 @@ Authors:
%prep
%setup -q
%patch0 -p1
%patch1 -p1
tr -d '\r' <doc/nonpersistent/wiki.out/trac.css >doc/nonpersistent/wiki.out/trac.css~
touch -r doc/nonpersistent/wiki.out/trac.css doc/nonpersistent/wiki.out/trac.css~
mv doc/nonpersistent/wiki.out/trac.css~ doc/nonpersistent/wiki.out/trac.css
@ -133,6 +147,7 @@ autoreconf -f -i
--enable-pcsc\
--enable-openct\
--enable-nsplugin\
--with-pinentry=/usr/bin/pinentry\
--with-plugindir=%{_libdir}/browser-plugins
make %{?jobs:-j%jobs}