[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#505277: openssh-client: dlopen support for link opensclib and for --with-opensc by default



Package: openssh-client
Version: 1:5.1p1-3
Severity: wishlist
Tags: patch

Hi
i'm luigi 
i need openssh with opensc support for my etoken on my debian (lenny)
i'm looking for it and
i've read this http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=500445

> please make it a patch that allows the 
> opensc library to be loaded via dlopen

then i've write a little patch (few changes to original code and all dlopen load code is in 
a new file)
it's my first debian patch ... so ... be patient please  ^_^ (where can i find doc for how 
to do a debian patch??)
if there is errors tell me, i can rewrite it

please note this 
1 opensc header files are needed
2 in the sc_init i've commented sc_close beaucause it's called every time after error (also 
when sc_init return!=0), it's correct??
3 i tried patch only on x86

-- System Information:
Debian Release: lenny/sid
  APT prefers testing
  APT policy: (500, 'testing')
Architecture: i386 (i686)

Kernel: Linux 2.6.26-1-686-bigmem (SMP w/1 CPU core)
Locale: LANG=it_IT.UTF-8, LC_CTYPE=it_IT.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages openssh-client depends on:
ii  adduser               3.110              add and remove users and groups
ii  debconf [debconf-2.0] 1.5.22             Debian configuration management sy
ii  dpkg                  1.14.22            Debian package management system
ii  libc6                 2.7-14             GNU C Library: Shared libraries
ii  libcomerr2            1.41.2-1           common error description library
ii  libedit2              2.11~20080614-1    BSD editline and history libraries
ii  libkrb53              1.6.dfsg.4~beta1-4 MIT Kerberos runtime libraries
ii  libncurses5           5.6+20080830-1     shared libraries for terminal hand
ii  libssl0.9.8           0.9.8g-13          SSL shared libraries
ii  passwd                1:4.1.1-5          change and administer password and
ii  zlib1g                1:1.2.3.3.dfsg-12  compression library - runtime

Versions of packages openssh-client recommends:
ii  openssh-blacklist             0.4.1      list of default blacklisted OpenSS
ii  openssh-blacklist-extra       0.4.1      list of non-default blacklisted Op
ii  xauth                         1:1.0.3-2  X authentication utility

Versions of packages openssh-client suggests:
pn  keychain                      <none>     (no description available)
pn  libpam-ssh                    <none>     (no description available)
pn  ssh-askpass                   <none>     (no description available)

-- no debconf information
diff -upN openssh-5.1p1/configure openssh-5.1p1_patched/configure
--- openssh-5.1p1/configure	2008-11-11 10:50:02.000000000 +0100
+++ openssh-5.1p1_patched/configure	2008-11-11 01:34:58.000000000 +0100
@@ -25213,7 +25213,7 @@ fi
 			LIBOPENSC_CFLAGS=`$OPENSC_CONFIG --cflags`
 			LIBOPENSC_LIBS=`$OPENSC_CONFIG --libs`
 			CPPFLAGS="$CPPFLAGS $LIBOPENSC_CFLAGS"
-			LIBS="$LIBS $LIBOPENSC_LIBS"
+			#LIBS="$LIBS $LIBOPENSC_LIBS"
 			cat >>confdefs.h <<\_ACEOF
 #define SMARTCARD 1
 _ACEOF
diff -upN openssh-5.1p1/configure.ac openssh-5.1p1_patched/configure.ac
--- openssh-5.1p1/configure.ac	2008-11-11 10:50:02.000000000 +0100
+++ openssh-5.1p1_patched/configure.ac	2008-11-11 01:36:24.000000000 +0100
@@ -3261,7 +3261,7 @@ AC_ARG_WITH(opensc,
 			LIBOPENSC_CFLAGS=`$OPENSC_CONFIG --cflags`
 			LIBOPENSC_LIBS=`$OPENSC_CONFIG --libs`
 			CPPFLAGS="$CPPFLAGS $LIBOPENSC_CFLAGS"
-			LIBS="$LIBS $LIBOPENSC_LIBS"
+			#LIBS="$LIBS $LIBOPENSC_LIBS"
 			AC_DEFINE(SMARTCARD)
 			AC_DEFINE(USE_OPENSC, 1,
 				[Define if you want smartcard support
Common subdirectories: openssh-5.1p1/contrib and openssh-5.1p1_patched/contrib
Common subdirectories: openssh-5.1p1/debian and openssh-5.1p1_patched/debian
diff -upN openssh-5.1p1/Makefile.in openssh-5.1p1_patched/Makefile.in
--- openssh-5.1p1/Makefile.in	2008-11-11 10:50:02.000000000 +0100
+++ openssh-5.1p1_patched/Makefile.in	2008-11-10 18:34:08.000000000 +0100
@@ -73,7 +73,7 @@ LIBSSH_OBJS=acss.o authfd.o authfile.o b
 	atomicio.o key.o dispatch.o kex.o mac.o uidswap.o uuencode.o misc.o \
 	monitor_fdpass.o rijndael.o ssh-dss.o ssh-rsa.o dh.o kexdh.o \
 	kexgex.o kexdhc.o kexgexc.o scard.o msg.o progressmeter.o dns.o \
-	entropy.o scard-opensc.o gss-genr.o umac.o kexgssc.o
+	entropy.o scard-dl-opensc.o scard-opensc.o gss-genr.o umac.o kexgssc.o
 
 SSHOBJS= ssh.o readconf.o clientloop.o sshtty.o \
 	sshconnect.o sshconnect1.o sshconnect2.o mux.o
Common subdirectories: openssh-5.1p1/openbsd-compat and openssh-5.1p1_patched/openbsd-compat
Common subdirectories: openssh-5.1p1/regress and openssh-5.1p1_patched/regress
Common subdirectories: openssh-5.1p1/scard and openssh-5.1p1_patched/scard
diff -upN openssh-5.1p1/scard-dl-opensc.c openssh-5.1p1_patched/scard-dl-opensc.c
--- openssh-5.1p1/scard-dl-opensc.c	1970-01-01 01:00:00.000000000 +0100
+++ openssh-5.1p1_patched/scard-dl-opensc.c	2008-11-11 10:43:24.000000000 +0100
@@ -0,0 +1,180 @@
+/***************************************************************************
+ *   Copyright (C) 2008 by Luigi Sportelli   *
+ *   gigiozzz@gmail.com   *
+ *                                                                         *
+ *   This program is free software; you can redistribute it and/or modify  *
+ *   it under the terms of the GNU General Public License as published by  *
+ *   the Free Software Foundation; either version 2 of the License, or     *
+ *   (at your option) any later version.                                   *
+ *                                                                         *
+ *   This program is distributed in the hope that it will be useful,       *
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
+ *   GNU General Public License for more details.                          *
+ *                                                                         *
+ *   You should have received a copy of the GNU General Public License     *
+ *   along with this program; if not, write to the                         *
+ *   Free Software Foundation, Inc.,                                       *
+ *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
+ ***************************************************************************/
+#include "includes.h"
+#if defined(SMARTCARD) && defined(USE_OPENSC)
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <dlfcn.h>
+#include <opensc/opensc.h>
+#include <opensc/pkcs15.h>
+
+#include "scard-dl-opensc.h"
+
+void *dl_sc_handle=NULL;
+
+int init_dl_opensc() {
+	char *error;
+
+
+	dl_sc_handle = dlopen ("/usr/lib/libopensc.so", RTLD_NOW);
+        if (!dl_sc_handle) {
+	    fputs (dlerror(), stderr);
+            return -1;
+        }
+
+	dl_sc_establish_context = dlsym(dl_sc_handle, "sc_establish_context");
+        if ((error = dlerror()) != NULL)  {
+            fputs(error, stderr);
+            return -1;
+        }
+
+	dl_sc_connect_card = dlsym(dl_sc_handle, "sc_connect_card");
+        if ((error = dlerror()) != NULL)  {
+            fputs(error, stderr);
+            return -1;
+        }
+
+	dl_sc_pkcs15_bind = dlsym(dl_sc_handle, "sc_pkcs15_bind");
+        if ((error = dlerror()) != NULL)  {
+            fputs(error, stderr);
+            return -1;
+        }
+
+	dl_sc_pkcs15_find_prkey_by_id_usage = dlsym(dl_sc_handle, "sc_pkcs15_find_prkey_by_id_usage");
+        if ((error = dlerror()) != NULL)  {
+            fputs(error, stderr);
+            return -1;
+        }
+	
+	dl_sc_pkcs15_find_pin_by_auth_id = dlsym(dl_sc_handle, "sc_pkcs15_find_pin_by_auth_id");
+        if ((error = dlerror()) != NULL)  {
+            fputs(error, stderr);
+            return -1;
+        }
+
+	dl_sc_strerror = dlsym(dl_sc_handle, "sc_strerror");
+        if ((error = dlerror()) != NULL)  {
+            fputs(error, stderr);
+            return -1;
+        }
+
+	dl_sc_lock = dlsym(dl_sc_handle, "sc_lock");
+        if ((error = dlerror()) != NULL)  {
+            fputs(error, stderr);
+            return -1;
+        }
+
+	dl_sc_unlock = dlsym(dl_sc_handle, "sc_unlock");
+        if ((error = dlerror()) != NULL)  {
+            fputs(error, stderr);
+            return -1;
+        }
+
+	dl_sc_pkcs15_verify_pin = dlsym(dl_sc_handle, "sc_pkcs15_verify_pin");
+        if ((error = dlerror()) != NULL)  {
+            fputs(error, stderr);
+            return -1;
+        }
+
+	dl_sc_pkcs15_decipher = dlsym(dl_sc_handle, "sc_pkcs15_decipher");
+        if ((error = dlerror()) != NULL)  {
+            fputs(error, stderr);
+            return -1;
+        }
+
+	dl_sc_pkcs15_compute_signature = dlsym(dl_sc_handle, "sc_pkcs15_compute_signature");
+        if ((error = dlerror()) != NULL)  {
+            fputs(error, stderr);
+            return -1;
+        }
+
+	dl_sc_pkcs15_read_certificate = dlsym(dl_sc_handle, "sc_pkcs15_read_certificate");
+        if ((error = dlerror()) != NULL)  {
+            fputs(error, stderr);
+            return -1;
+        }
+
+	dl_sc_pkcs15_free_certificate = dlsym(dl_sc_handle, "sc_pkcs15_free_certificate");
+        if ((error = dlerror()) != NULL)  {
+            fputs(error, stderr);
+            return -1;
+        }
+
+	dl_sc_pkcs15_hex_string_to_id = dlsym(dl_sc_handle, "sc_pkcs15_hex_string_to_id");
+        if ((error = dlerror()) != NULL)  {
+            fputs(error, stderr);
+            return -1;
+        }
+
+	dl_sc_pkcs15_find_cert_by_id = dlsym(dl_sc_handle, "sc_pkcs15_find_cert_by_id");
+        if ((error = dlerror()) != NULL)  {
+            fputs(error, stderr);
+            return -1;
+        }
+
+	dl_sc_pkcs15_get_objects = dlsym(dl_sc_handle, "sc_pkcs15_get_objects");
+        if ((error = dlerror()) != NULL)  {
+            fputs(error, stderr);
+            return -1;
+        }
+
+	dl_sc_pkcs15_find_prkey_by_id = dlsym(dl_sc_handle, "sc_pkcs15_find_prkey_by_id");
+        if ((error = dlerror()) != NULL)  {
+            fputs(error, stderr);
+            return -1;
+        }
+
+
+	dl_sc_pkcs15_unbind = dlsym(dl_sc_handle, "sc_pkcs15_unbind");
+        if ((error = dlerror()) != NULL)  {
+            fputs(error, stderr);
+            return -1;
+        }
+
+	dl_sc_disconnect_card = dlsym(dl_sc_handle, "sc_disconnect_card");
+        if ((error = dlerror()) != NULL)  {
+            fputs(error, stderr);
+            return -1;
+        }
+
+	dl_sc_release_context = dlsym(dl_sc_handle, "sc_release_context");
+        if ((error = dlerror()) != NULL)  {
+            fputs(error, stderr);
+            return -1;
+        }
+	
+	return 0;
+
+}
+
+int deinit_dl_opensc() {
+	int r;
+	if(dl_sc_handle!=NULL){
+		r=0;
+		while(r==0)
+		   r=dlclose(dl_sc_handle);
+		dl_sc_handle=NULL;
+		return 0;
+	}	
+	else return -1;
+}
+ 
+#endif /* SMARTCARD */
diff -upN openssh-5.1p1/scard-dl-opensc.h openssh-5.1p1_patched/scard-dl-opensc.h
--- openssh-5.1p1/scard-dl-opensc.h	1970-01-01 01:00:00.000000000 +0100
+++ openssh-5.1p1_patched/scard-dl-opensc.h	2008-11-11 02:44:53.000000000 +0100
@@ -0,0 +1,53 @@
+/***************************************************************************
+ *   Copyright (C) 2008 by Luigi Sportelli   *
+ *   gigiozzz@gmail.com   *
+ *                                                                         *
+ *   This program is free software; you can redistribute it and/or modify  *
+ *   it under the terms of the GNU General Public License as published by  *
+ *   the Free Software Foundation; either version 2 of the License, or     *
+ *   (at your option) any later version.                                   *
+ *                                                                         *
+ *   This program is distributed in the hope that it will be useful,       *
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
+ *   GNU General Public License for more details.                          *
+ *                                                                         *
+ *   You should have received a copy of the GNU General Public License     *
+ *   along with this program; if not, write to the                         *
+ *   Free Software Foundation, Inc.,                                       *
+ *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
+ ***************************************************************************/
+
+int (*dl_sc_establish_context)();
+int (*dl_sc_connect_card)();
+int (*dl_sc_pkcs15_bind)();
+
+const char* (*dl_sc_strerror)();
+
+int (*dl_sc_lock)();
+int (*dl_sc_unlock)();
+
+int (*dl_sc_pkcs15_verify_pin)();
+int (*dl_sc_pkcs15_find_pin_by_auth_id)();
+
+int (*dl_sc_pkcs15_decipher)();
+int (*dl_sc_pkcs15_compute_signature)();
+
+int (*dl_sc_pkcs15_read_certificate)();
+int (*dl_sc_pkcs15_find_cert_by_id)();
+void (*dl_sc_pkcs15_free_certificate)();
+
+int (*dl_sc_pkcs15_hex_string_to_id)();
+int (*dl_sc_pkcs15_get_objects)();
+int (*dl_sc_pkcs15_find_prkey_by_id)();
+int (*dl_sc_pkcs15_find_prkey_by_id_usage)();
+
+int (*dl_sc_pkcs15_unbind)();
+int (*dl_sc_disconnect_card)();
+int (*dl_sc_release_context)();
+
+
+
+
+int init_dl_opensc(void);	
+int deinit_dl_opensc(); 
diff -upN openssh-5.1p1/scard-opensc.c openssh-5.1p1_patched/scard-opensc.c
--- openssh-5.1p1/scard-opensc.c	2007-03-12 21:35:39.000000000 +0100
+++ openssh-5.1p1_patched/scard-opensc.c	2008-11-11 10:29:09.000000000 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002 Juha Yrj�  All rights reserved.
+ * Copyright (c) 2002 Juha Yrj�l�.  All rights reserved.
  * Copyright (c) 2001 Markus Friedl.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -42,6 +42,7 @@
 #include "xmalloc.h"
 #include "misc.h"
 #include "scard.h"
+#include "scard-dl-opensc.h"
 
 #if OPENSSL_VERSION_NUMBER < 0x00907000L && defined(CRYPTO_LOCK_ENGINE)
 #define USE_ENGINE
@@ -73,17 +74,18 @@ void
 sc_close(void)
 {
 	if (p15card) {
-		sc_pkcs15_unbind(p15card);
+		dl_sc_pkcs15_unbind(p15card);
 		p15card = NULL;
 	}
 	if (card) {
-		sc_disconnect_card(card, 0);
+		dl_sc_disconnect_card(card, 0);
 		card = NULL;
 	}
 	if (ctx) {
-		sc_release_context(ctx);
+		dl_sc_release_context(ctx);
 		ctx = NULL;
 	}
+	deinit_dl_opensc();
 }
 
 static int
@@ -91,24 +93,27 @@ sc_init(void)
 {
 	int r;
 
-	r = sc_establish_context(&ctx, "openssh");
+	r=init_dl_opensc();
 	if (r)
 		goto err;
+	r = dl_sc_establish_context(&ctx, "openssh");
+	if (r)
+		goto err;	
 	if (sc_reader_id >= ctx->reader_count) {
 		r = SC_ERROR_NO_READERS_FOUND;
 		error("Illegal reader number %d (max %d)", sc_reader_id,
 		    ctx->reader_count -1);
 		goto err;
 	}
-	r = sc_connect_card(ctx->reader[sc_reader_id], 0, &card);
+	r = dl_sc_connect_card(ctx->reader[sc_reader_id], 0, &card);
 	if (r)
 		goto err;
-	r = sc_pkcs15_bind(card, &p15card);
+	r = dl_sc_pkcs15_bind(card, &p15card);
 	if (r)
 		goto err;
 	return 0;
 err:
-	sc_close();
+	//sc_close();
 	return r;
 }
 
@@ -132,47 +137,47 @@ sc_prkey_op_init(RSA *rsa, struct sc_pkc
 		sc_close();
 		r = sc_init();
 		if (r) {
-			error("SmartCard init failed: %s", sc_strerror(r));
+			error("SmartCard init failed: %s", dl_sc_strerror(r));
 			goto err;
 		}
 	}
-	r = sc_pkcs15_find_prkey_by_id_usage(p15card, &priv->cert_id,
+	r = dl_sc_pkcs15_find_prkey_by_id_usage(p15card, &priv->cert_id,
 		usage, &key_obj);
 	if (r) {
 		error("Unable to find private key from SmartCard: %s",
-		      sc_strerror(r));
+		      dl_sc_strerror(r));
 		goto err;
 	}
 	key = key_obj->data;
-	r = sc_pkcs15_find_pin_by_auth_id(p15card, &key_obj->auth_id,
+	r = dl_sc_pkcs15_find_pin_by_auth_id(p15card, &key_obj->auth_id,
 					  &pin_obj);
 	if (r == SC_ERROR_OBJECT_NOT_FOUND) {
 		/* no pin required */
-		r = sc_lock(card);
+		r = dl_sc_lock(card);
 		if (r) {
-			error("Unable to lock smartcard: %s", sc_strerror(r));
+			error("Unable to lock smartcard: %s", dl_sc_strerror(r));
 			goto err;
 		}
 		*key_obj_out = key_obj;
 		return 0;
 	} else if (r) {
 		error("Unable to find PIN object from SmartCard: %s",
-		      sc_strerror(r));
+		      dl_sc_strerror(r));
 		goto err;
 	}
 	pin = pin_obj->data;
-	r = sc_lock(card);
+	r = dl_sc_lock(card);
 	if (r) {
-		error("Unable to lock smartcard: %s", sc_strerror(r));
+		error("Unable to lock smartcard: %s", dl_sc_strerror(r));
 		goto err;
 	}
 	if (sc_pin != NULL) {
-		r = sc_pkcs15_verify_pin(p15card, pin, sc_pin,
+		r = dl_sc_pkcs15_verify_pin(p15card, pin, sc_pin,
 					 strlen(sc_pin));
 		if (r) {
-			sc_unlock(card);
+			dl_sc_unlock(card);
 			error("PIN code verification failed: %s",
-			      sc_strerror(r));
+			      dl_sc_strerror(r));
 			goto err;
 		}
 	}
@@ -198,11 +203,11 @@ sc_private_decrypt(int flen, u_char *fro
 	r = sc_prkey_op_init(rsa, &key_obj, SC_USAGE_DECRYPT);
 	if (r)
 		return -1;
-	r = sc_pkcs15_decipher(p15card, key_obj, SC_ALGORITHM_RSA_PAD_PKCS1,
+	r = dl_sc_pkcs15_decipher(p15card, key_obj, SC_ALGORITHM_RSA_PAD_PKCS1,
 	    from, flen, to, flen);
-	sc_unlock(card);
+	dl_sc_unlock(card);
 	if (r < 0) {
-		error("sc_pkcs15_decipher() failed: %s", sc_strerror(r));
+		error("sc_pkcs15_decipher() failed: %s", dl_sc_strerror(r));
 		goto err;
 	}
 	return r;
@@ -236,12 +241,12 @@ sc_sign(int type, u_char *m, unsigned in
 	/* FIXME: length of sigret correct? */
 	/* FIXME: check 'type' and modify flags accordingly */
 	flags = SC_ALGORITHM_RSA_PAD_PKCS1 | SC_ALGORITHM_RSA_HASH_SHA1;
-	r = sc_pkcs15_compute_signature(p15card, key_obj, flags,
+	r = dl_sc_pkcs15_compute_signature(p15card, key_obj, flags,
 					m, m_len, sigret, RSA_size(rsa));
-	sc_unlock(card);
+	dl_sc_unlock(card);
 	if (r < 0) {
 		error("sc_pkcs15_compute_signature() failed: %s",
-		      sc_strerror(r));
+		      dl_sc_strerror(r));
 		goto err;
 	}
 	*siglen = r;
@@ -356,9 +361,9 @@ sc_read_pubkey(Key * k, const struct sc_
 	char *tmp;
 
 	debug("sc_read_pubkey() with cert id %02X", cinfo->id.value[0]);
-	r = sc_pkcs15_read_certificate(p15card, cinfo, &cert);
+	r = dl_sc_pkcs15_read_certificate(p15card, cinfo, &cert);
 	if (r) {
-		logit("Certificate read failed: %s", sc_strerror(r));
+		logit("Certificate read failed: %s", dl_sc_strerror(r));
 		goto err;
 	}
 	x509 = X509_new();
@@ -372,7 +377,7 @@ sc_read_pubkey(Key * k, const struct sc_
 		r = -1;
 		goto err;
 	}
-	sc_pkcs15_free_certificate(cert);
+	dl_sc_pkcs15_free_certificate(cert);
 	cert = NULL;
 	pubkey = X509_get_pubkey(x509);
 	X509_free(x509);
@@ -400,7 +405,7 @@ sc_read_pubkey(Key * k, const struct sc_
 	return 0;
 err:
 	if (cert)
-		sc_pkcs15_free_certificate(cert);
+		dl_sc_pkcs15_free_certificate(cert);
 	if (pubkey)
 		EVP_PKEY_free(pubkey);
 	if (x509)
@@ -427,7 +432,7 @@ sc_get_keys(const char *id, const char *
 	if ((p = strchr(buf, ':')) != NULL) {
 		*p = 0;
 		p++;
-		sc_pkcs15_hex_string_to_id(p, &cert_id);
+		dl_sc_pkcs15_hex_string_to_id(p, &cert_id);
 	}
 	r = sscanf(buf, "%d", &sc_reader_id);
 	xfree(buf);
@@ -437,17 +442,17 @@ sc_get_keys(const char *id, const char *
 		sc_close();
 		r = sc_init();
 		if (r) {
-			error("Smartcard init failed: %s", sc_strerror(r));
+			error("Smartcard init failed: %s", dl_sc_strerror(r));
 			goto err;
 		}
 	}
 	if (cert_id.len) {
-		r = sc_pkcs15_find_cert_by_id(p15card, &cert_id, &certs[0]);
+		r = dl_sc_pkcs15_find_cert_by_id(p15card, &cert_id, &certs[0]);
 		if (r < 0)
 			goto err;
 		key_count = 1;
 	} else {
-		r = sc_pkcs15_get_objects(p15card, SC_PKCS15_TYPE_CERT_X509,
+		r = dl_sc_pkcs15_get_objects(p15card, SC_PKCS15_TYPE_CERT_X509,
 					  certs, 32);
 		if (r == 0) {
 			logit("No certificates found on smartcard");
@@ -455,7 +460,7 @@ sc_get_keys(const char *id, const char *
 			goto err;
 		} else if (r < 0) {
 			error("Certificate enumeration failed: %s",
-			      sc_strerror(r));
+			      dl_sc_strerror(r));
 			goto err;
 		}
 		key_count = r;
@@ -466,7 +471,7 @@ sc_get_keys(const char *id, const char *
 	for (i = 0; i < key_count; i++) {
 		sc_pkcs15_object_t *tmp_obj = NULL;
 		cert_id = ((sc_pkcs15_cert_info_t *)(certs[i]->data))->id;
-		if (sc_pkcs15_find_prkey_by_id(p15card, &cert_id, &tmp_obj))
+		if (dl_sc_pkcs15_find_prkey_by_id(p15card, &cert_id, &tmp_obj))
 			/* skip the public key (certificate) if no
 			 * corresponding private key is present */
 			continue;
@@ -475,7 +480,7 @@ sc_get_keys(const char *id, const char *
 			break;
 		r = sc_read_pubkey(k, certs[i]);
 		if (r) {
-			error("sc_read_pubkey failed: %s", sc_strerror(r));
+			error("sc_read_pubkey failed: %s", dl_sc_strerror(r));
 			key_free(k);
 			continue;
 		}
@@ -516,10 +521,10 @@ sc_get_key_label(Key *key)
 		/* internal error => return default label */
 		return xstrdup("smartcard key");
 	}
-	r = sc_pkcs15_find_prkey_by_id(p15card, &priv->cert_id, &key_obj);
+	r = dl_sc_pkcs15_find_prkey_by_id(p15card, &priv->cert_id, &key_obj);
 	if (r) {
 		logit("Unable to find private key from SmartCard: %s",
-		      sc_strerror(r));
+		      dl_sc_strerror(r));
 		return xstrdup("smartcard key");
 	}
 	if (key_obj == NULL || key_obj->label == NULL)

Reply to: