]> git.pld-linux.org Git - packages/openjdk9.git/blame - system-pcsclite.patch
adapterized
[packages/openjdk9.git] / system-pcsclite.patch
CommitLineData
991454fa
JK
1diff -durN -x '*.orig' jdk8u-jdk8u66-b02.orig/common/autoconf/libraries.m4 jdk8u-jdk8u66-b02/common/autoconf/libraries.m4
2--- jdk8u-jdk8u66-b02.orig/common/autoconf/libraries.m4 2015-09-18 13:18:24.000000000 +0200
3+++ jdk8u-jdk8u66-b02/common/autoconf/libraries.m4 2015-09-18 13:19:49.000000000 +0200
4@@ -747,6 +747,53 @@
5
6 ###############################################################################
7 #
8+ # Check for the pcsclite library
9+ #
10+
11+ AC_ARG_WITH(libpcsclite, [AS_HELP_STRING([--with-libpcsclite],
12+ [use libpcsclite from build system or OpenJDK source (system, bundled) @<:@bundled@:>@])])
13+
14+ AC_CHECK_LIB(pcsclite, SCardConnect,
15+ [ LIBPCSCLITE_FOUND=yes ],
16+ [ LIBPCSCLITE_FOUND=no ])
17+
18+ AC_MSG_CHECKING([for which libpcsclite to use])
19+
20+ DEFAULT_LIBPCSCLITE=bundled
21+
22+ if test "x${LIBPCSCLITE_FOUND}" != "xyes"; then
23+ #
24+ # If we don't find any system...set default to bundled
25+ #
26+ DEFAULT_LIBPCSCLITE=bundled
27+ fi
28+
29+ #
30+ # If user didn't specify, use DEFAULT_PCSC
31+ #
32+ if test "x${with_libpcsclite}" = "x"; then
33+ with_libpcsclite=${DEFAULT_LIBPCSCLITE}
34+ fi
35+
36+ if test "x${with_libpcsclite}" = "xbundled"; then
37+ USE_EXTERNAL_LIBPCSCLITE=false
38+ AC_MSG_RESULT([bundled])
39+ elif test "x${with_libpcsclite}" = "xsystem"; then
40+ if test "x${LIBPCSCLITE_FOUND}" = "xyes"; then
41+ USE_EXTERNAL_LIBPCSCLITE=true
42+ AC_MSG_RESULT([system])
43+ else
44+ AC_MSG_RESULT([system not found])
45+ AC_MSG_ERROR([--with-libpcsclite=system specified, but no libpcsclite found!])
46+ fi
47+ else
48+ AC_MSG_ERROR([Invalid value for --with-libpcsclite: ${with_libpcsclite}, use 'system' or 'bundled'])
49+ fi
50+
51+ AC_SUBST(USE_EXTERNAL_LIBPCSCLITE)
52+
53+ ###############################################################################
54+ #
55 # Check for the zlib library
56 #
57
58diff -durN -x '*.orig' jdk8u-jdk8u66-b02.orig/common/autoconf/spec.gmk.in jdk8u-jdk8u66-b02/common/autoconf/spec.gmk.in
59--- jdk8u-jdk8u66-b02.orig/common/autoconf/spec.gmk.in 2015-09-18 13:16:52.000000000 +0200
60+++ jdk8u-jdk8u66-b02/common/autoconf/spec.gmk.in 2015-09-18 13:19:49.000000000 +0200
61@@ -565,6 +565,7 @@
62 USE_EXTERNAL_LIBJPEG:=@USE_EXTERNAL_LIBJPEG@
63 USE_EXTERNAL_LIBPNG:=@USE_EXTERNAL_LIBPNG@
64 USE_EXTERNAL_LIBGIF:=@USE_EXTERNAL_LIBGIF@
65+USE_EXTERNAL_LIBPCSCLITE:=@USE_EXTERNAL_LIBPCSCLITE@
66 USE_EXTERNAL_LIBZ:=@USE_EXTERNAL_LIBZ@
67 LIBZIP_CAN_USE_MMAP:=@LIBZIP_CAN_USE_MMAP@
68 MSVCR_DLL:=@MSVCR_DLL@
69diff -durN -x '*.orig' jdk8u-jdk8u66-b02.orig/jdk/make/lib/SecurityLibraries.gmk jdk8u-jdk8u66-b02/jdk/make/lib/SecurityLibraries.gmk
70--- jdk8u-jdk8u66-b02.orig/jdk/make/lib/SecurityLibraries.gmk 2015-07-23 16:17:35.000000000 +0200
71+++ jdk8u-jdk8u66-b02/jdk/make/lib/SecurityLibraries.gmk 2015-09-18 13:19:49.000000000 +0200
72@@ -75,11 +75,11 @@
73 CFLAGS := $(CFLAGS_JDKLIB) \
74 -I$(JDK_TOPDIR)/src/share/native/sun/security/smartcardio \
75 -I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/security/smartcardio \
76- -I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/security/smartcardio/MUSCLE, \
77+ -I/usr/include/PCSC -DUSE_SYSTEM_LIBPCSCLITE, \
78 MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libj2pcsc/mapfile-vers, \
79 LDFLAGS := $(LDFLAGS_JDKLIB) \
80 $(call SET_SHARED_LIBRARY_ORIGIN), \
81- LDFLAGS_SUFFIX_posix := $(LIBDL), \
82+ LDFLAGS_SUFFIX_posix := -lpcsclite $(LIBDL), \
83 LDFLAGS_SUFFIX_windows := winscard.lib, \
84 LDFLAGS_SUFFIX_solaris := -lc, \
85 VERSIONINFO_RESOURCE := $(JDK_TOPDIR)/src/windows/resource/version.rc, \
86diff -durN -x '*.orig' jdk8u-jdk8u66-b02.orig/jdk/src/solaris/native/sun/security/smartcardio/pcsc_md.c jdk8u-jdk8u66-b02/jdk/src/solaris/native/sun/security/smartcardio/pcsc_md.c
87--- jdk8u-jdk8u66-b02.orig/jdk/src/solaris/native/sun/security/smartcardio/pcsc_md.c 2015-07-23 16:17:35.000000000 +0200
88+++ jdk8u-jdk8u66-b02/jdk/src/solaris/native/sun/security/smartcardio/pcsc_md.c 2015-09-18 13:19:49.000000000 +0200
89@@ -36,6 +36,7 @@
90
91 #include "pcsc_md.h"
92
93+#ifndef USE_SYSTEM_LIBPCSCLITE
94 void *hModule;
95 FPTR_SCardEstablishContext scardEstablishContext;
96 FPTR_SCardConnect scardConnect;
97@@ -47,6 +48,7 @@
98 FPTR_SCardBeginTransaction scardBeginTransaction;
99 FPTR_SCardEndTransaction scardEndTransaction;
100 FPTR_SCardControl scardControl;
101+#endif
102
103 /*
104 * Throws a Java Exception by name
105@@ -75,7 +77,9 @@
106 throwByName(env, "java/io/IOException", msg);
107 }
108
109+#ifndef USE_SYSTEM_LIBPCSCLITE
110 void *findFunction(JNIEnv *env, void *hModule, char *functionName) {
111+ return NULL;
112 void *fAddress = dlsym(hModule, functionName);
113 if (fAddress == NULL) {
114 char errorMessage[256];
115@@ -85,9 +89,11 @@
116 }
117 return fAddress;
118 }
119+#endif
120
121 JNIEXPORT void JNICALL Java_sun_security_smartcardio_PlatformPCSC_initialize
122 (JNIEnv *env, jclass thisClass, jstring jLibName) {
123+#ifndef USE_SYSTEM_LIBPCSCLITE
124 const char *libName = (*env)->GetStringUTFChars(env, jLibName, NULL);
125 if (libName == NULL) {
126 throwNullPointerException(env, "PCSC library name is null");
127@@ -141,4 +147,5 @@
128 #else
129 scardControl = (FPTR_SCardControl) findFunction(env, hModule, "SCardControl132");
130 #endif // __APPLE__
131+#endif
132 }
133diff -durN -x '*.orig' jdk8u-jdk8u66-b02.orig/jdk/src/solaris/native/sun/security/smartcardio/pcsc_md.h jdk8u-jdk8u66-b02/jdk/src/solaris/native/sun/security/smartcardio/pcsc_md.h
134--- jdk8u-jdk8u66-b02.orig/jdk/src/solaris/native/sun/security/smartcardio/pcsc_md.h 2015-07-23 16:17:35.000000000 +0200
135+++ jdk8u-jdk8u66-b02/jdk/src/solaris/native/sun/security/smartcardio/pcsc_md.h 2015-09-18 13:19:49.000000000 +0200
136@@ -23,6 +23,8 @@
137 * questions.
138 */
139
140+#ifndef USE_SYSTEM_LIBPCSCLITE
141+
142 typedef LONG (*FPTR_SCardEstablishContext)(ULONG dwScope,
143 const void *pvReserved1,
144 const void *pvReserved2,
145@@ -110,3 +112,41 @@
146 extern FPTR_SCardBeginTransaction scardBeginTransaction;
147 extern FPTR_SCardEndTransaction scardEndTransaction;
148 extern FPTR_SCardControl scardControl;
149+
150+#else
151+
152+#define CALL_SCardEstablishContext(dwScope, pvReserved1, pvReserved2, phContext) \
153+ (SCardEstablishContext(dwScope, pvReserved1, pvReserved2, phContext))
154+
155+#define CALL_SCardConnect(hContext, szReader, dwSharedMode, dwPreferredProtocols, phCard, pdwActiveProtocols) \
156+ (SCardConnect(hContext, szReader, dwSharedMode, dwPreferredProtocols, phCard, pdwActiveProtocols))
157+
158+#define CALL_SCardDisconnect(hCard, dwDisposition) \
159+ (SCardDisconnect(hCard, dwDisposition))
160+
161+#define CALL_SCardStatus(hCard, mszReaderNames, pcchReaderLen, pdwState, pdwProtocol, pbAtr, pcbAtrLen) \
162+ (SCardStatus(hCard, mszReaderNames, pcchReaderLen, pdwState, pdwProtocol, pbAtr, pcbAtrLen))
163+
164+#define CALL_SCardGetStatusChange(hContext, dwTimeout, rgReaderStates, cReaders) \
165+ (SCardGetStatusChange(hContext, dwTimeout, rgReaderStates, cReaders))
166+
167+#define CALL_SCardTransmit(hCard, pioSendPci, pbSendBuffer, cbSendLength, \
168+ pioRecvPci, pbRecvBuffer, pcbRecvLength) \
169+ (SCardTransmit(hCard, pioSendPci, pbSendBuffer, cbSendLength, \
170+ pioRecvPci, pbRecvBuffer, pcbRecvLength))
171+
172+#define CALL_SCardListReaders(hContext, mszGroups, mszReaders, pcchReaders) \
173+ (SCardListReaders(hContext, mszGroups, mszReaders, pcchReaders))
174+
175+#define CALL_SCardBeginTransaction(hCard) \
176+ (SCardBeginTransaction(hCard))
177+
178+#define CALL_SCardEndTransaction(hCard, dwDisposition) \
179+ (SCardEndTransaction(hCard, dwDisposition))
180+
181+#define CALL_SCardControl(hCard, dwControlCode, pbSendBuffer, cbSendLength, \
182+ pbRecvBuffer, pcbRecvLength, lpBytesReturned) \
183+ (SCardControl(hCard, dwControlCode, pbSendBuffer, cbSendLength, \
184+ pbRecvBuffer, pcbRecvLength, lpBytesReturned))
185+
186+#endif
This page took 0.093237 seconds and 4 git commands to generate.