diff -Nurwd openssh-5.1p1.orig/debian/control openssh-5.1p1/debian/control
--- openssh-5.1p1.orig/debian/control	2009-10-06 10:40:59.000000000 +0200
+++ openssh-5.1p1/debian/control	2009-10-06 10:41:45.000000000 +0200
@@ -2,7 +2,7 @@
 Section: net
 Priority: standard
 Maintainer: Debian OpenSSH Maintainers <debian-ssh@lists.debian.org>
-Build-Depends: libwrap0-dev | libwrap-dev, zlib1g-dev (>= 1:1.2.3-1), libssl-dev (>= 0.9.8-1), libpam0g-dev | libpam-dev, libgtk2.0-dev, libedit-dev, debhelper (>= 7.0.1), sharutils, libselinux1-dev [alpha amd64 arm armeb armel hppa i386 ia64 lpia m68k mips mipsel powerpc ppc64 s390 sh4 sparc], libkrb5-dev | heimdal-dev
+Build-Depends: libwrap0-dev | libwrap-dev, zlib1g-dev (>= 1:1.2.3-1), libssl-dev (>= 0.9.8-1), libpam0g-dev | libpam-dev, libgtk2.0-dev, libedit-dev, debhelper (>= 7.0.1), sharutils, libselinux1-dev [alpha amd64 arm armeb armel hppa i386 ia64 lpia m68k mips mipsel powerpc ppc64 s390 sh4 sparc], libkrb5-dev | heimdal-dev, libopensc2-dev
 Standards-Version: 3.7.3
 Uploaders: Colin Watson <cjwatson@debian.org>, Matthew Vernon <matthew@debian.org>
 
@@ -122,3 +122,14 @@
  This package provides the sshd server for use in debian-installer.
  Since it is expected to be used in specialized situations (e.g. S/390
  installs with no console), it does not provide any configuration.
+
+Package: libssh-dev
+Priority: optional
+Section: libdevel
+Architecture: any
+Depends: ${shlibs:Depends}, ${misc:Depends}
+Description: Secure shell library
+ Static library containing routines for openssh.  Currently the only
+ header file included are authfd.h, key.h and buffer.h which are used
+ by applications that communicate with ssh-agent.
+
diff -Nurwd openssh-5.1p1.orig/debian/libssh-dev.dirs openssh-5.1p1/debian/libssh-dev.dirs
--- openssh-5.1p1.orig/debian/libssh-dev.dirs	1970-01-01 01:00:00.000000000 +0100
+++ openssh-5.1p1/debian/libssh-dev.dirs	2009-10-06 10:41:09.000000000 +0200
@@ -0,0 +1,2 @@
+usr/include/ssh
+usr/lib
diff -Nurwd openssh-5.1p1.orig/debian/libssh-dev.links openssh-5.1p1/debian/libssh-dev.links
--- openssh-5.1p1.orig/debian/libssh-dev.links	1970-01-01 01:00:00.000000000 +0100
+++ openssh-5.1p1/debian/libssh-dev.links	2009-10-06 10:41:09.000000000 +0200
@@ -0,0 +1 @@
+usr/share/doc/openssh-client usr/share/doc/libssh-dev
diff -Nurwd openssh-5.1p1.orig/debian/rules openssh-5.1p1/debian/rules
--- openssh-5.1p1.orig/debian/rules	2009-10-06 10:40:59.000000000 +0200
+++ openssh-5.1p1/debian/rules	2009-10-06 10:41:09.000000000 +0200
@@ -72,6 +72,7 @@
 confflags += --with-4in6
 confflags += --with-privsep-path=/var/run/sshd
 confflags += --without-rand-helper
+confflags += --with-opensc=/usr
 
 # The Hurd needs libcrypt for res_query et al.
 ifeq ($(DEB_HOST_ARCH_OS),hurd)
@@ -212,6 +213,7 @@
 binary-arch: binary-openssh-client binary-openssh-server
 binary-arch: binary-ssh-askpass-gnome
 binary-arch: binary-openssh-client-udeb binary-openssh-server-udeb
+binary-arch: binary-libssh-dev
 
 binary-openssh-client: DH_OPTIONS=-popenssh-client
 binary-openssh-client: build install
@@ -335,6 +337,21 @@
 	dh_md5sums
 	dh_builddeb
 
+binary-libssh-dev: DH_OPTIONS=-plibssh-dev
+binary-libssh-dev: build install
+	dh_testdir
+	dh_testroot
+	dh_link
+	cp build-deb/libssh.a build-deb/openbsd-compat/libopenbsd-compat.a debian/libssh-dev/usr/lib
+	cp key.h buffer.h authfd.h debian/libssh-dev/usr/include/ssh
+	dh_compress
+	dh_fixperms
+	dh_installdeb
+	dh_shlibdeps
+	dh_gencontrol
+	dh_md5sums
+	dh_builddeb
+
 binary: binary-indep binary-arch
 
 debian/faq.html:
@@ -346,4 +363,4 @@
 .PHONY: build-deb build-udeb
 .PHONY: binary-openssh-client binary-openssh-server binary-ssh
 .PHONY: binary-ssh-krb5 binary-ssh-askpass-gnome
-.PHONY: binary-openssh-client-udeb binary-openssh-server-udeb
+.PHONY: binary-openssh-client-udeb binary-openssh-server-udeb binary-libssh-dev
