changeset 13671:08c46bf8a620

8218780: Update MUSCLE PCSC-Lite header files Summary: Update the PCSC-lite header files to 1.8.24 release Reviewed-by: andrew
author sgehwolf
date Wed, 04 Sep 2019 06:03:48 +0100
parents 345ef0469dd6
children 2f26ef228073
files src/share/native/sun/security/smartcardio/pcsc.c src/solaris/native/sun/security/smartcardio/MUSCLE/COPYING src/solaris/native/sun/security/smartcardio/MUSCLE/pcsclite.h src/solaris/native/sun/security/smartcardio/MUSCLE/winscard.h src/solaris/native/sun/security/smartcardio/MUSCLE/wintypes.h src/solaris/native/sun/security/smartcardio/pcsc_md.h
diffstat 6 files changed, 486 insertions(+), 433 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/native/sun/security/smartcardio/pcsc.c	Wed May 22 21:33:58 2019 +0300
+++ b/src/share/native/sun/security/smartcardio/pcsc.c	Wed Sep 04 06:03:48 2019 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -179,7 +179,7 @@
 {
     SCARDCONTEXT context = (SCARDCONTEXT)jContext;
     LONG rv;
-    LPTSTR mszReaders = NULL;
+    LPSTR mszReaders = NULL;
     DWORD size = 0;
     jobjectArray result;
 
@@ -216,7 +216,7 @@
 {
     SCARDCONTEXT context = (SCARDCONTEXT)jContext;
     LONG rv;
-    LPCTSTR readerName;
+    LPCSTR readerName;
     SCARDHANDLE card = 0;
     DWORD proto = 0;
 
--- a/src/solaris/native/sun/security/smartcardio/MUSCLE/COPYING	Wed May 22 21:33:58 2019 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,28 +0,0 @@
-Copyright (c) 1999-2003 David Corcoran <corcoran@linuxnet.com>
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions
-are met:
-
-1. Redistributions of source code must retain the above copyright
-   notice, this list of conditions and the following disclaimer.
-2. Redistributions in binary form must reproduce the above copyright
-   notice, this list of conditions and the following disclaimer in the
-   documentation and/or other materials provided with the distribution.
-3. The name of the author may not be used to endorse or promote products
-   derived from this software without specific prior written permission.
-
-Changes to this license can be made only by the copyright author with 
-explicit written consent.
-
-THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
--- a/src/solaris/native/sun/security/smartcardio/MUSCLE/pcsclite.h	Wed May 22 21:33:58 2019 +0300
+++ b/src/solaris/native/sun/security/smartcardio/MUSCLE/pcsclite.h	Wed Sep 04 06:03:48 2019 +0100
@@ -1,374 +1,306 @@
 /*
- * This keeps a list of defines for pcsc-lite.
- *
- * MUSCLE SmartCard Development ( http://www.linuxnet.com )
+ * MUSCLE SmartCard Development ( https://pcsclite.apdu.fr/ )
  *
  * Copyright (C) 1999-2004
- *  David Corcoran <corcoran@linuxnet.com>
+ *  David Corcoran <corcoran@musclecard.com>
+ * Copyright (C) 2002-2011
  *  Ludovic Rousseau <ludovic.rousseau@free.fr>
+ * Copyright (C) 2005
+ *  Martin Paljak <martin@paljak.pri.ee>
  *
- * $Id: pcsclite.h.in,v 1.47 2004/08/24 21:46:57 rousseau Exp $
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+
+1. Redistributions of source code must retain the above copyright
+   notice, this list of conditions and the following disclaimer.
+2. Redistributions in binary form must reproduce the above copyright
+   notice, this list of conditions and the following disclaimer in the
+   documentation and/or other materials provided with the distribution.
+3. The name of the author may not be used to endorse or promote products
+   derived from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/**
+ * @file
+ * @brief This keeps a list of defines for pcsc-lite.
+ *
+ * Error codes from http://msdn.microsoft.com/en-us/library/aa924526.aspx
  */
 
 #ifndef __pcsclite_h__
 #define __pcsclite_h__
 
-#ifndef __sun_jdk
 #include <wintypes.h>
-#else
-#include <sys/types.h>
-#include <inttypes.h>
-#ifdef BYTE
-#error BYTE is already defined
-#else
-  typedef unsigned char BYTE;
-#endif /* End BYTE */
-
-        typedef unsigned char UCHAR;
-        typedef unsigned char *PUCHAR;
-        typedef unsigned short USHORT;
-        typedef unsigned long ULONG;
-        typedef void *LPVOID;
-        typedef short BOOL;
-        typedef unsigned long *PULONG;
-        typedef const void *LPCVOID;
-        typedef unsigned long DWORD;
-        typedef unsigned long *PDWORD;
-        typedef unsigned short WORD;
-        typedef long LONG;
-        typedef long RESPONSECODE;
-        typedef const char *LPCTSTR;
-        typedef const BYTE *LPCBYTE;
-        typedef BYTE *LPBYTE;
-        typedef DWORD *LPDWORD;
-        typedef char *LPTSTR;
-
-#endif
 
 #ifdef __cplusplus
 extern "C"
 {
 #endif
 
-#ifdef WIN32
-#include <winscard.h>
-#else
-typedef long SCARDCONTEXT;
+typedef LONG SCARDCONTEXT; /**< \p hContext returned by SCardEstablishContext() */
 typedef SCARDCONTEXT *PSCARDCONTEXT;
 typedef SCARDCONTEXT *LPSCARDCONTEXT;
-typedef long SCARDHANDLE;
+typedef LONG SCARDHANDLE; /**< \p hCard returned by SCardConnect() */
 typedef SCARDHANDLE *PSCARDHANDLE;
 typedef SCARDHANDLE *LPSCARDHANDLE;
 
-#define MAX_ATR_SIZE                    33      /* Maximum ATR size */
+#define MAX_ATR_SIZE                  33      /**< Maximum ATR size */
 
-#ifndef __APPLE__
+/* Set structure elements aligment on bytes
+ * http://gcc.gnu.org/onlinedocs/gcc/Structure_002dPacking-Pragmas.html */
+#ifdef __APPLE__
+#pragma pack(1)
+#endif
 
 typedef struct
 {
-        const char *szReader;
-        void *pvUserData;
-        unsigned long dwCurrentState;
-        unsigned long dwEventState;
-        unsigned long cbAtr;
-        unsigned char rgbAtr[MAX_ATR_SIZE];
+      const char *szReader;
+      void *pvUserData;
+      DWORD dwCurrentState;
+      DWORD dwEventState;
+      DWORD cbAtr;
+      unsigned char rgbAtr[MAX_ATR_SIZE];
 }
-SCARD_READERSTATE_A;
+SCARD_READERSTATE, *LPSCARD_READERSTATE;
 
-typedef struct _SCARD_IO_REQUEST
+/** Protocol Control Information (PCI) */
+typedef struct
 {
-        unsigned long dwProtocol;       /* Protocol identifier */
-        unsigned long cbPciLength;      /* Protocol Control Inf Length */
+      unsigned long dwProtocol;      /**< Protocol identifier */
+      unsigned long cbPciLength;      /**< Protocol Control Inf Length */
 }
 SCARD_IO_REQUEST, *PSCARD_IO_REQUEST, *LPSCARD_IO_REQUEST;
 
-#else // __APPLE__
-
-#pragma pack(1)
-typedef struct
-{
-        const char *szReader;
-        void *pvUserData;
-        uint32_t dwCurrentState;
-        uint32_t dwEventState;
-        uint32_t cbAtr;
-        unsigned char rgbAtr[MAX_ATR_SIZE];
-}
-SCARD_READERSTATE_A;
-
-typedef struct _SCARD_IO_REQUEST
-{
-        uint32_t dwProtocol;            /* Protocol identifier */
-        uint32_t cbPciLength;           /* Protocol Control Inf Length */
-}
-SCARD_IO_REQUEST, *PSCARD_IO_REQUEST, *LPSCARD_IO_REQUEST;
-#pragma pack()
-
-#endif // __APPLE__
-
-typedef SCARD_READERSTATE_A SCARD_READERSTATE, *PSCARD_READERSTATE_A,
-        *LPSCARD_READERSTATE_A;
-
 typedef const SCARD_IO_REQUEST *LPCSCARD_IO_REQUEST;
 
-extern SCARD_IO_REQUEST g_rgSCardT0Pci, g_rgSCardT1Pci,
-        g_rgSCardRawPci;
+extern const SCARD_IO_REQUEST g_rgSCardT0Pci, g_rgSCardT1Pci, g_rgSCardRawPci;
 
-#define SCARD_PCI_T0    (&g_rgSCardT0Pci)
-#define SCARD_PCI_T1    (&g_rgSCardT1Pci)
-#define SCARD_PCI_RAW   (&g_rgSCardRawPci)
-
-#define SCARD_S_SUCCESS                 0x00000000
-#define SCARD_E_CANCELLED               0x80100002
-#define SCARD_E_CANT_DISPOSE            0x8010000E
-#define SCARD_E_INSUFFICIENT_BUFFER     0x80100008
-#define SCARD_E_INVALID_ATR             0x80100015
-#define SCARD_E_INVALID_HANDLE          0x80100003
-#define SCARD_E_INVALID_PARAMETER       0x80100004
-#define SCARD_E_INVALID_TARGET          0x80100005
-#define SCARD_E_INVALID_VALUE           0x80100011
-#define SCARD_E_NO_MEMORY               0x80100006
-#define SCARD_F_COMM_ERROR              0x80100013
-#define SCARD_F_INTERNAL_ERROR          0x80100001
-#define SCARD_F_UNKNOWN_ERROR           0x80100014
-#define SCARD_F_WAITED_TOO_LONG         0x80100007
-#define SCARD_E_UNKNOWN_READER          0x80100009
-#define SCARD_E_TIMEOUT                 0x8010000A
-#define SCARD_E_SHARING_VIOLATION       0x8010000B
-#define SCARD_E_NO_SMARTCARD            0x8010000C
-#define SCARD_E_UNKNOWN_CARD            0x8010000D
-#define SCARD_E_PROTO_MISMATCH          0x8010000F
-#define SCARD_E_NOT_READY               0x80100010
-#define SCARD_E_SYSTEM_CANCELLED        0x80100012
-#define SCARD_E_NOT_TRANSACTED          0x80100016
-#define SCARD_E_READER_UNAVAILABLE      0x80100017
-
-#define SCARD_W_UNSUPPORTED_CARD        0x80100065
-#define SCARD_W_UNRESPONSIVE_CARD       0x80100066
-#define SCARD_W_UNPOWERED_CARD          0x80100067
-#define SCARD_W_RESET_CARD              0x80100068
-#define SCARD_W_REMOVED_CARD            0x80100069
-
-#define SCARD_E_PCI_TOO_SMALL           0x80100019
-#define SCARD_E_READER_UNSUPPORTED      0x8010001A
-#define SCARD_E_DUPLICATE_READER        0x8010001B
-#define SCARD_E_CARD_UNSUPPORTED        0x8010001C
-#define SCARD_E_NO_SERVICE              0x8010001D
-#define SCARD_E_SERVICE_STOPPED         0x8010001E
-
-#define SCARD_SCOPE_USER                0x0000  /* Scope in user space */
-#define SCARD_SCOPE_TERMINAL            0x0001  /* Scope in terminal */
-#define SCARD_SCOPE_SYSTEM              0x0002  /* Scope in system */
-
-#define SCARD_PROTOCOL_UNSET            0x0000  /* protocol not set */
-#define SCARD_PROTOCOL_T0               0x0001  /* T=0 active protocol. */
-#define SCARD_PROTOCOL_T1               0x0002  /* T=1 active protocol. */
-#define SCARD_PROTOCOL_RAW              0x0004  /* Raw active protocol. */
-#define SCARD_PROTOCOL_T15              0x0008  /* T=15 protocol. */
-
-#define SCARD_PROTOCOL_ANY              (SCARD_PROTOCOL_T0|SCARD_PROTOCOL_T1)   /* IFD determines prot. */
-
-#define SCARD_SHARE_EXCLUSIVE           0x0001  /* Exclusive mode only */
-#define SCARD_SHARE_SHARED              0x0002  /* Shared mode only */
-#define SCARD_SHARE_DIRECT              0x0003  /* Raw mode only */
-
-#define SCARD_LEAVE_CARD                0x0000  /* Do nothing on close */
-#define SCARD_RESET_CARD                0x0001  /* Reset on close */
-#define SCARD_UNPOWER_CARD              0x0002  /* Power down on close */
-#define SCARD_EJECT_CARD                0x0003  /* Eject on close */
-
-#define SCARD_UNKNOWN                   0x0001  /* Unknown state */
-#define SCARD_ABSENT                    0x0002  /* Card is absent */
-#define SCARD_PRESENT                   0x0004  /* Card is present */
-#define SCARD_SWALLOWED                 0x0008  /* Card not powered */
-#define SCARD_POWERED                   0x0010  /* Card is powered */
-#define SCARD_NEGOTIABLE                0x0020  /* Ready for PTS */
-#define SCARD_SPECIFIC                  0x0040  /* PTS has been set */
-
-#define SCARD_STATE_UNAWARE             0x0000  /* App wants status */
-#define SCARD_STATE_IGNORE              0x0001  /* Ignore this reader */
-#define SCARD_STATE_CHANGED             0x0002  /* State has changed */
-#define SCARD_STATE_UNKNOWN             0x0004  /* Reader unknown */
-#define SCARD_STATE_UNAVAILABLE         0x0008  /* Status unavailable */
-#define SCARD_STATE_EMPTY               0x0010  /* Card removed */
-#define SCARD_STATE_PRESENT             0x0020  /* Card inserted */
-#define SCARD_STATE_ATRMATCH            0x0040  /* ATR matches card */
-#define SCARD_STATE_EXCLUSIVE           0x0080  /* Exclusive Mode */
-#define SCARD_STATE_INUSE               0x0100  /* Shared Mode */
-#define SCARD_STATE_MUTE                0x0200  /* Unresponsive card */
-#define SCARD_STATE_UNPOWERED           0x0400  /* Unpowered card */
-
-/*
- * Tags for requesting card and reader attributes
- */
-
-#define SCARD_ATTR_VALUE(Class, Tag) ((((ULONG)(Class)) << 16) | ((ULONG)(Tag)))
-
-#define SCARD_CLASS_VENDOR_INFO     1   /* Vendor information definitions */
-#define SCARD_CLASS_COMMUNICATIONS  2   /* Communication definitions */
-#define SCARD_CLASS_PROTOCOL        3   /* Protocol definitions */
-#define SCARD_CLASS_POWER_MGMT      4   /* Power Management definitions */
-#define SCARD_CLASS_SECURITY        5   /* Security Assurance definitions */
-#define SCARD_CLASS_MECHANICAL      6   /* Mechanical characteristic definitions */
-#define SCARD_CLASS_VENDOR_DEFINED  7   /* Vendor specific definitions */
-#define SCARD_CLASS_IFD_PROTOCOL    8   /* Interface Device Protocol options */
-#define SCARD_CLASS_ICC_STATE       9   /* ICC State specific definitions */
-#define SCARD_CLASS_SYSTEM     0x7fff   /* System-specific definitions */
-
-#define SCARD_ATTR_VENDOR_NAME SCARD_ATTR_VALUE(SCARD_CLASS_VENDOR_INFO, 0x0100)
-#define SCARD_ATTR_VENDOR_IFD_TYPE SCARD_ATTR_VALUE(SCARD_CLASS_VENDOR_INFO, 0x0101)
-#define SCARD_ATTR_VENDOR_IFD_VERSION SCARD_ATTR_VALUE(SCARD_CLASS_VENDOR_INFO, 0x0102)
-#define SCARD_ATTR_VENDOR_IFD_SERIAL_NO SCARD_ATTR_VALUE(SCARD_CLASS_VENDOR_INFO, 0x0103)
-#define SCARD_ATTR_CHANNEL_ID SCARD_ATTR_VALUE(SCARD_CLASS_COMMUNICATIONS, 0x0110)
-#define SCARD_ATTR_ASYNC_PROTOCOL_TYPES SCARD_ATTR_VALUE(SCARD_CLASS_PROTOCOL, 0x0120)
-#define SCARD_ATTR_DEFAULT_CLK SCARD_ATTR_VALUE(SCARD_CLASS_PROTOCOL, 0x0121)
-#define SCARD_ATTR_MAX_CLK SCARD_ATTR_VALUE(SCARD_CLASS_PROTOCOL, 0x0122)
-#define SCARD_ATTR_DEFAULT_DATA_RATE SCARD_ATTR_VALUE(SCARD_CLASS_PROTOCOL, 0x0123)
-#define SCARD_ATTR_MAX_DATA_RATE SCARD_ATTR_VALUE(SCARD_CLASS_PROTOCOL, 0x0124)
-#define SCARD_ATTR_MAX_IFSD SCARD_ATTR_VALUE(SCARD_CLASS_PROTOCOL, 0x0125)
-#define SCARD_ATTR_SYNC_PROTOCOL_TYPES SCARD_ATTR_VALUE(SCARD_CLASS_PROTOCOL, 0x0126)
-#define SCARD_ATTR_POWER_MGMT_SUPPORT SCARD_ATTR_VALUE(SCARD_CLASS_POWER_MGMT, 0x0131)
-#define SCARD_ATTR_USER_TO_CARD_AUTH_DEVICE SCARD_ATTR_VALUE(SCARD_CLASS_SECURITY, 0x0140)
-#define SCARD_ATTR_USER_AUTH_INPUT_DEVICE SCARD_ATTR_VALUE(SCARD_CLASS_SECURITY, 0x0142)
-#define SCARD_ATTR_CHARACTERISTICS SCARD_ATTR_VALUE(SCARD_CLASS_MECHANICAL, 0x0150)
-
-#define SCARD_ATTR_CURRENT_PROTOCOL_TYPE SCARD_ATTR_VALUE(SCARD_CLASS_IFD_PROTOCOL, 0x0201)
-#define SCARD_ATTR_CURRENT_CLK SCARD_ATTR_VALUE(SCARD_CLASS_IFD_PROTOCOL, 0x0202)
-#define SCARD_ATTR_CURRENT_F SCARD_ATTR_VALUE(SCARD_CLASS_IFD_PROTOCOL, 0x0203)
-#define SCARD_ATTR_CURRENT_D SCARD_ATTR_VALUE(SCARD_CLASS_IFD_PROTOCOL, 0x0204)
-#define SCARD_ATTR_CURRENT_N SCARD_ATTR_VALUE(SCARD_CLASS_IFD_PROTOCOL, 0x0205)
-#define SCARD_ATTR_CURRENT_W SCARD_ATTR_VALUE(SCARD_CLASS_IFD_PROTOCOL, 0x0206)
-#define SCARD_ATTR_CURRENT_IFSC SCARD_ATTR_VALUE(SCARD_CLASS_IFD_PROTOCOL, 0x0207)
-#define SCARD_ATTR_CURRENT_IFSD SCARD_ATTR_VALUE(SCARD_CLASS_IFD_PROTOCOL, 0x0208)
-#define SCARD_ATTR_CURRENT_BWT SCARD_ATTR_VALUE(SCARD_CLASS_IFD_PROTOCOL, 0x0209)
-#define SCARD_ATTR_CURRENT_CWT SCARD_ATTR_VALUE(SCARD_CLASS_IFD_PROTOCOL, 0x020a)
-#define SCARD_ATTR_CURRENT_EBC_ENCODING SCARD_ATTR_VALUE(SCARD_CLASS_IFD_PROTOCOL, 0x020b)
-#define SCARD_ATTR_EXTENDED_BWT SCARD_ATTR_VALUE(SCARD_CLASS_IFD_PROTOCOL, 0x020c)
-
-#define SCARD_ATTR_ICC_PRESENCE SCARD_ATTR_VALUE(SCARD_CLASS_ICC_STATE, 0x0300)
-#define SCARD_ATTR_ICC_INTERFACE_STATUS SCARD_ATTR_VALUE(SCARD_CLASS_ICC_STATE, 0x0301)
-#define SCARD_ATTR_CURRENT_IO_STATE SCARD_ATTR_VALUE(SCARD_CLASS_ICC_STATE, 0x0302)
-#define SCARD_ATTR_ATR_STRING SCARD_ATTR_VALUE(SCARD_CLASS_ICC_STATE, 0x0303)
-#define SCARD_ATTR_ICC_TYPE_PER_ATR SCARD_ATTR_VALUE(SCARD_CLASS_ICC_STATE, 0x0304)
-
-#define SCARD_ATTR_ESC_RESET SCARD_ATTR_VALUE(SCARD_CLASS_VENDOR_DEFINED, 0xA000)
-#define SCARD_ATTR_ESC_CANCEL SCARD_ATTR_VALUE(SCARD_CLASS_VENDOR_DEFINED, 0xA003)
-#define SCARD_ATTR_ESC_AUTHREQUEST SCARD_ATTR_VALUE(SCARD_CLASS_VENDOR_DEFINED, 0xA005)
-#define SCARD_ATTR_MAXINPUT SCARD_ATTR_VALUE(SCARD_CLASS_VENDOR_DEFINED, 0xA007)
-
-#define SCARD_ATTR_DEVICE_UNIT SCARD_ATTR_VALUE(SCARD_CLASS_SYSTEM, 0x0001)
-#define SCARD_ATTR_DEVICE_IN_USE SCARD_ATTR_VALUE(SCARD_CLASS_SYSTEM, 0x0002)
-#define SCARD_ATTR_DEVICE_FRIENDLY_NAME_A SCARD_ATTR_VALUE(SCARD_CLASS_SYSTEM, 0x0003)
-#define SCARD_ATTR_DEVICE_SYSTEM_NAME_A SCARD_ATTR_VALUE(SCARD_CLASS_SYSTEM, 0x0004)
-#define SCARD_ATTR_DEVICE_FRIENDLY_NAME_W SCARD_ATTR_VALUE(SCARD_CLASS_SYSTEM, 0x0005)
-#define SCARD_ATTR_DEVICE_SYSTEM_NAME_W SCARD_ATTR_VALUE(SCARD_CLASS_SYSTEM, 0x0006)
-#define SCARD_ATTR_SUPRESS_T1_IFS_REQUEST SCARD_ATTR_VALUE(SCARD_CLASS_SYSTEM, 0x0007)
-
-#ifdef UNICODE
-#define SCARD_ATTR_DEVICE_FRIENDLY_NAME SCARD_ATTR_DEVICE_FRIENDLY_NAME_W
-#define SCARD_ATTR_DEVICE_SYSTEM_NAME SCARD_ATTR_DEVICE_SYSTEM_NAME_W
-#else
-#define SCARD_ATTR_DEVICE_FRIENDLY_NAME SCARD_ATTR_DEVICE_FRIENDLY_NAME_A
-#define SCARD_ATTR_DEVICE_SYSTEM_NAME SCARD_ATTR_DEVICE_SYSTEM_NAME_A
+/* restore default structure elements alignment */
+#ifdef __APPLE__
+#pragma pack()
 #endif
 
+#define SCARD_PCI_T0      (&g_rgSCardT0Pci) /**< protocol control information (PCI) for T=0 */
+#define SCARD_PCI_T1      (&g_rgSCardT1Pci) /**< protocol control information (PCI) for T=1 */
+#define SCARD_PCI_RAW      (&g_rgSCardRawPci) /**< protocol control information (PCI) for RAW protocol */
+
+/**
+ * @defgroup ErrorCodes ErrorCodes
+ * @brief Error code documentation
+ *
+ * The error codes descriptions are from
+ * http://msdn.microsoft.com/en-us/library/aa924526.aspx
+ */
+/** @ingroup ErrorCodes */
+#define SCARD_S_SUCCESS                  ((LONG)0x00000000) /**< No error was encountered. */
+/** @ingroup ErrorCodes */
+#define SCARD_F_INTERNAL_ERROR            ((LONG)0x80100001) /**< An internal consistency check failed. */
+/** @ingroup ErrorCodes */
+#define SCARD_E_CANCELLED            ((LONG)0x80100002) /**< The action was cancelled by an SCardCancel request. */
+/** @ingroup ErrorCodes */
+#define SCARD_E_INVALID_HANDLE            ((LONG)0x80100003) /**< The supplied handle was invalid. */
+/** @ingroup ErrorCodes */
+#define SCARD_E_INVALID_PARAMETER      ((LONG)0x80100004) /**< One or more of the supplied parameters could not be properly interpreted. */
+/** @ingroup ErrorCodes */
+#define SCARD_E_INVALID_TARGET            ((LONG)0x80100005) /**< Registry startup information is missing or invalid. */
+/** @ingroup ErrorCodes */
+#define SCARD_E_NO_MEMORY            ((LONG)0x80100006) /**< Not enough memory available to complete this command. */
+/** @ingroup ErrorCodes */
+#define SCARD_F_WAITED_TOO_LONG            ((LONG)0x80100007) /**< An internal consistency timer has expired. */
+/** @ingroup ErrorCodes */
+#define SCARD_E_INSUFFICIENT_BUFFER      ((LONG)0x80100008) /**< The data buffer to receive returned data is too small for the returned data. */
+/** @ingroup ErrorCodes */
+#define SCARD_E_UNKNOWN_READER            ((LONG)0x80100009) /**< The specified reader name is not recognized. */
+/** @ingroup ErrorCodes */
+#define SCARD_E_TIMEOUT                  ((LONG)0x8010000A) /**< The user-specified timeout value has expired. */
+/** @ingroup ErrorCodes */
+#define SCARD_E_SHARING_VIOLATION      ((LONG)0x8010000B) /**< The smart card cannot be accessed because of other connections outstanding. */
+/** @ingroup ErrorCodes */
+#define SCARD_E_NO_SMARTCARD            ((LONG)0x8010000C) /**< The operation requires a Smart Card, but no Smart Card is currently in the device. */
+/** @ingroup ErrorCodes */
+#define SCARD_E_UNKNOWN_CARD            ((LONG)0x8010000D) /**< The specified smart card name is not recognized. */
+/** @ingroup ErrorCodes */
+#define SCARD_E_CANT_DISPOSE            ((LONG)0x8010000E) /**< The system could not dispose of the media in the requested manner. */
+/** @ingroup ErrorCodes */
+#define SCARD_E_PROTO_MISMATCH            ((LONG)0x8010000F) /**< The requested protocols are incompatible with the protocol currently in use with the smart card. */
+/** @ingroup ErrorCodes */
+#define SCARD_E_NOT_READY            ((LONG)0x80100010) /**< The reader or smart card is not ready to accept commands. */
+/** @ingroup ErrorCodes */
+#define SCARD_E_INVALID_VALUE            ((LONG)0x80100011) /**< One or more of the supplied parameters values could not be properly interpreted. */
+/** @ingroup ErrorCodes */
+#define SCARD_E_SYSTEM_CANCELLED      ((LONG)0x80100012) /**< The action was cancelled by the system, presumably to log off or shut down. */
+/** @ingroup ErrorCodes */
+#define SCARD_F_COMM_ERROR            ((LONG)0x80100013) /**< An internal communications error has been detected. */
+/** @ingroup ErrorCodes */
+#define SCARD_F_UNKNOWN_ERROR            ((LONG)0x80100014) /**< An internal error has been detected, but the source is unknown. */
+/** @ingroup ErrorCodes */
+#define SCARD_E_INVALID_ATR            ((LONG)0x80100015) /**< An ATR obtained from the registry is not a valid ATR string. */
+/** @ingroup ErrorCodes */
+#define SCARD_E_NOT_TRANSACTED            ((LONG)0x80100016) /**< An attempt was made to end a non-existent transaction. */
+/** @ingroup ErrorCodes */
+#define SCARD_E_READER_UNAVAILABLE      ((LONG)0x80100017) /**< The specified reader is not currently available for use. */
+/** @ingroup ErrorCodes */
+#define SCARD_P_SHUTDOWN            ((LONG)0x80100018) /**< The operation has been aborted to allow the server application to exit. */
+/** @ingroup ErrorCodes */
+#define SCARD_E_PCI_TOO_SMALL            ((LONG)0x80100019) /**< The PCI Receive buffer was too small. */
+/** @ingroup ErrorCodes */
+#define SCARD_E_READER_UNSUPPORTED      ((LONG)0x8010001A) /**< The reader driver does not meet minimal requirements for support. */
+/** @ingroup ErrorCodes */
+#define SCARD_E_DUPLICATE_READER      ((LONG)0x8010001B) /**< The reader driver did not produce a unique reader name. */
+/** @ingroup ErrorCodes */
+#define SCARD_E_CARD_UNSUPPORTED      ((LONG)0x8010001C) /**< The smart card does not meet minimal requirements for support. */
+/** @ingroup ErrorCodes */
+#define SCARD_E_NO_SERVICE            ((LONG)0x8010001D) /**< The Smart card resource manager is not running. */
+/** @ingroup ErrorCodes */
+#define SCARD_E_SERVICE_STOPPED            ((LONG)0x8010001E) /**< The Smart card resource manager has shut down. */
+/** @ingroup ErrorCodes */
+#define SCARD_E_UNEXPECTED            ((LONG)0x8010001F) /**< An unexpected card error has occurred. */
+/** @ingroup ErrorCodes */
+#define SCARD_E_UNSUPPORTED_FEATURE      ((LONG)0x8010001F) /**< This smart card does not support the requested feature. */
+/** @ingroup ErrorCodes */
+#define SCARD_E_ICC_INSTALLATION      ((LONG)0x80100020) /**< No primary provider can be found for the smart card. */
+/** @ingroup ErrorCodes */
+#define SCARD_E_ICC_CREATEORDER            ((LONG)0x80100021) /**< The requested order of object creation is not supported. */
+/** @ingroup ErrorCodes */
+/* #define SCARD_E_UNSUPPORTED_FEATURE      ((LONG)0x80100022) / **< This smart card does not support the requested feature. */
+/** @ingroup ErrorCodes */
+#define SCARD_E_DIR_NOT_FOUND            ((LONG)0x80100023) /**< The identified directory does not exist in the smart card. */
+/** @ingroup ErrorCodes */
+#define SCARD_E_FILE_NOT_FOUND            ((LONG)0x80100024) /**< The identified file does not exist in the smart card. */
+/** @ingroup ErrorCodes */
+#define SCARD_E_NO_DIR                  ((LONG)0x80100025) /**< The supplied path does not represent a smart card directory. */
+/** @ingroup ErrorCodes */
+#define SCARD_E_NO_FILE                  ((LONG)0x80100026) /**< The supplied path does not represent a smart card file. */
+/** @ingroup ErrorCodes */
+#define SCARD_E_NO_ACCESS            ((LONG)0x80100027) /**< Access is denied to this file. */
+/** @ingroup ErrorCodes */
+#define SCARD_E_WRITE_TOO_MANY            ((LONG)0x80100028) /**< The smart card does not have enough memory to store the information. */
+/** @ingroup ErrorCodes */
+#define SCARD_E_BAD_SEEK            ((LONG)0x80100029) /**< There was an error trying to set the smart card file object pointer. */
+/** @ingroup ErrorCodes */
+#define SCARD_E_INVALID_CHV            ((LONG)0x8010002A) /**< The supplied PIN is incorrect. */
+/** @ingroup ErrorCodes */
+#define SCARD_E_UNKNOWN_RES_MNG            ((LONG)0x8010002B) /**< An unrecognized error code was returned from a layered component. */
+/** @ingroup ErrorCodes */
+#define SCARD_E_NO_SUCH_CERTIFICATE      ((LONG)0x8010002C) /**< The requested certificate does not exist. */
+/** @ingroup ErrorCodes */
+#define SCARD_E_CERTIFICATE_UNAVAILABLE      ((LONG)0x8010002D) /**< The requested certificate could not be obtained. */
+/** @ingroup ErrorCodes */
+#define SCARD_E_NO_READERS_AVAILABLE    ((LONG)0x8010002E) /**< Cannot find a smart card reader. */
+/** @ingroup ErrorCodes */
+#define SCARD_E_COMM_DATA_LOST            ((LONG)0x8010002F) /**< A communications error with the smart card has been detected. Retry the operation. */
+/** @ingroup ErrorCodes */
+#define SCARD_E_NO_KEY_CONTAINER      ((LONG)0x80100030) /**< The requested key container does not exist on the smart card. */
+/** @ingroup ErrorCodes */
+#define SCARD_E_SERVER_TOO_BUSY            ((LONG)0x80100031) /**< The Smart Card Resource Manager is too busy to complete this operation. */
+
+/** @ingroup ErrorCodes */
+#define SCARD_W_UNSUPPORTED_CARD      ((LONG)0x80100065) /**< The reader cannot communicate with the card, due to ATR string configuration conflicts. */
+/** @ingroup ErrorCodes */
+#define SCARD_W_UNRESPONSIVE_CARD      ((LONG)0x80100066) /**< The smart card is not responding to a reset. */
+/** @ingroup ErrorCodes */
+#define SCARD_W_UNPOWERED_CARD            ((LONG)0x80100067) /**< Power has been removed from the smart card, so that further communication is not possible. */
+/** @ingroup ErrorCodes */
+#define SCARD_W_RESET_CARD            ((LONG)0x80100068) /**< The smart card has been reset, so any shared state information is invalid. */
+/** @ingroup ErrorCodes */
+#define SCARD_W_REMOVED_CARD            ((LONG)0x80100069) /**< The smart card has been removed, so further communication is not possible. */
+
+/** @ingroup ErrorCodes */
+#define SCARD_W_SECURITY_VIOLATION      ((LONG)0x8010006A) /**< Access was denied because of a security violation. */
+/** @ingroup ErrorCodes */
+#define SCARD_W_WRONG_CHV            ((LONG)0x8010006B) /**< The card cannot be accessed because the wrong PIN was presented. */
+/** @ingroup ErrorCodes */
+#define SCARD_W_CHV_BLOCKED            ((LONG)0x8010006C) /**< The card cannot be accessed because the maximum number of PIN entry attempts has been reached. */
+/** @ingroup ErrorCodes */
+#define SCARD_W_EOF                  ((LONG)0x8010006D) /**< The end of the smart card file has been reached. */
+/** @ingroup ErrorCodes */
+#define SCARD_W_CANCELLED_BY_USER      ((LONG)0x8010006E) /**< The user pressed "Cancel" on a Smart Card Selection Dialog. */
+/** @ingroup ErrorCodes */
+#define SCARD_W_CARD_NOT_AUTHENTICATED      ((LONG)0x8010006F) /**< No PIN was presented to the smart card. */
+
+#define SCARD_AUTOALLOCATE (DWORD)(-1)      /**< see SCardFreeMemory() */
+#define SCARD_SCOPE_USER            0x0000      /**< Scope in user space */
+#define SCARD_SCOPE_TERMINAL            0x0001      /**< Scope in terminal */
+#define SCARD_SCOPE_SYSTEM            0x0002      /**< Scope in system */
+#define SCARD_SCOPE_GLOBAL            0x0003      /**< Scope is global */
+
+#define SCARD_PROTOCOL_UNDEFINED      0x0000      /**< protocol not set */
+#define SCARD_PROTOCOL_UNSET SCARD_PROTOCOL_UNDEFINED      /* backward compat */
+#define SCARD_PROTOCOL_T0            0x0001      /**< T=0 active protocol. */
+#define SCARD_PROTOCOL_T1            0x0002      /**< T=1 active protocol. */
+#define SCARD_PROTOCOL_RAW            0x0004      /**< Raw active protocol. */
+#define SCARD_PROTOCOL_T15            0x0008      /**< T=15 protocol. */
+
+#define SCARD_PROTOCOL_ANY            (SCARD_PROTOCOL_T0|SCARD_PROTOCOL_T1)      /**< IFD determines prot. */
+
+#define SCARD_SHARE_EXCLUSIVE            0x0001      /**< Exclusive mode only */
+#define SCARD_SHARE_SHARED            0x0002      /**< Shared mode only */
+#define SCARD_SHARE_DIRECT            0x0003      /**< Raw mode only */
+
+#define SCARD_LEAVE_CARD            0x0000      /**< Do nothing on close */
+#define SCARD_RESET_CARD            0x0001      /**< Reset on close */
+#define SCARD_UNPOWER_CARD            0x0002      /**< Power down on close */
+#define SCARD_EJECT_CARD            0x0003      /**< Eject on close */
+
+#define SCARD_UNKNOWN                  0x0001      /**< Unknown state */
+#define SCARD_ABSENT                  0x0002      /**< Card is absent */
+#define SCARD_PRESENT                  0x0004      /**< Card is present */
+#define SCARD_SWALLOWED                  0x0008      /**< Card not powered */
+#define SCARD_POWERED                  0x0010      /**< Card is powered */
+#define SCARD_NEGOTIABLE            0x0020      /**< Ready for PTS */
+#define SCARD_SPECIFIC                  0x0040      /**< PTS has been set */
+
+#define SCARD_STATE_UNAWARE            0x0000      /**< App wants status */
+#define SCARD_STATE_IGNORE            0x0001      /**< Ignore this reader */
+#define SCARD_STATE_CHANGED            0x0002      /**< State has changed */
+#define SCARD_STATE_UNKNOWN            0x0004      /**< Reader unknown */
+#define SCARD_STATE_UNAVAILABLE            0x0008      /**< Status unavailable */
+#define SCARD_STATE_EMPTY            0x0010      /**< Card removed */
+#define SCARD_STATE_PRESENT            0x0020      /**< Card inserted */
+#define SCARD_STATE_ATRMATCH            0x0040      /**< ATR matches card */
+#define SCARD_STATE_EXCLUSIVE            0x0080      /**< Exclusive Mode */
+#define SCARD_STATE_INUSE            0x0100      /**< Shared Mode */
+#define SCARD_STATE_MUTE            0x0200      /**< Unresponsive card */
+#define SCARD_STATE_UNPOWERED            0x0400      /**< Unpowered card */
+
+#ifndef INFINITE
+#define INFINITE                  0xFFFFFFFF      /**< Infinite timeout */
 #endif
 
-/* PC/SC Lite specific extensions */
-#define SCARD_W_INSERTED_CARD           0x8010006A
-#define SCARD_E_UNSUPPORTED_FEATURE     0x8010001F
+#define PCSCLITE_VERSION_NUMBER            "1.8.24"      /**< Current version */
+/** Maximum readers context (a slot is count as a reader) */
+#define PCSCLITE_MAX_READERS_CONTEXTS                  16
 
-#define SCARD_SCOPE_GLOBAL              0x0003  /* Scope is global */
-
-#define SCARD_RESET                     0x0001  /* Card was reset */
-#define SCARD_INSERTED                  0x0002  /* Card was inserted */
-#define SCARD_REMOVED                   0x0004  /* Card was removed */
-
-#define BLOCK_STATUS_RESUME             0x00FF  /* Normal resume */
-#define BLOCK_STATUS_BLOCKING           0x00FA  /* Function is blocking */
-
-#define PCSCLITE_CONFIG_DIR             "/etc"
-
-#ifndef USE_IPCDIR
-#define PCSCLITE_IPC_DIR                "/var/run"
-#else
-#define PCSCLITE_IPC_DIR                USE_IPCDIR
-#endif
-
-#define PCSCLITE_READER_CONFIG          PCSCLITE_CONFIG_DIR "/reader.conf"
-#define PCSCLITE_PUBSHM_FILE            PCSCLITE_IPC_DIR "/pcscd.pub"
-#define PCSCLITE_CSOCK_NAME             PCSCLITE_IPC_DIR "/pcscd.comm"
-
-#define PCSCLITE_SVC_IDENTITY           0x01030000      /* Service ID */
-
-#ifndef INFINITE
-#define INFINITE                        0xFFFFFFFF      /* Infinite timeout */
-#endif
-#define PCSCLITE_INFINITE_TIMEOUT       4320000         /* 50 day infinite t/o */
-
-#define PCSCLITE_VERSION_NUMBER         "1.2.9-beta7"   /* Current version */
-#define PCSCLITE_CLIENT_ATTEMPTS        120             /* Attempts to reach sv */
-#define PCSCLITE_MCLIENT_ATTEMPTS       20              /* Attempts to reach sv */
-#define PCSCLITE_STATUS_POLL_RATE       400000          /* Status polling rate */
-#define PCSCLITE_MSG_KEY_LEN            16              /* App ID key length */
-#define PCSCLITE_RW_ATTEMPTS            100             /* Attempts to rd/wrt */
-
-/* Maximum applications */
-#define PCSCLITE_MAX_APPLICATIONS                       16
-/* Maximum contexts by application */
-#define PCSCLITE_MAX_APPLICATION_CONTEXTS               16
-/* Maximum of applications contexts that pcscd can accept */
-#define PCSCLITE_MAX_APPLICATIONS_CONTEXTS \
-        PCSCLITE_MAX_APPLICATIONS * PCSCLITE_MAX_APPLICATION_CONTEXTS
-/* Maximum channels on a reader context */
-#define PCSCLITE_MAX_READER_CONTEXT_CHANNELS            16
-/* Maximum channels on an application context */
-#define PCSCLITE_MAX_APPLICATION_CONTEXT_CHANNELS       16
-/* Maximum readers context (a slot is count as a reader) */
-#define PCSCLITE_MAX_READERS_CONTEXTS                   16
-
-/* PCSCLITE_MAX_READERS is deprecated
- * use PCSCLITE_MAX_READERS_CONTEXTS instead */
-/* extern int PCSCLITE_MAX_READERS __attribute__ ((deprecated)); */
-
-#define PCSCLITE_MAX_THREADS            16      /* Stat change threads */
-#define PCSCLITE_STATUS_WAIT            200000  /* Status Change Sleep */
-#define PCSCLITE_TRANSACTION_TIMEOUT    40      /* Transaction timeout */
-#define MAX_READERNAME                  52
-#define MAX_LIBNAME                     100
-#define MAX_DEVICENAME          255
+#define MAX_READERNAME                  128
 
 #ifndef SCARD_ATR_LENGTH
-#define SCARD_ATR_LENGTH                MAX_ATR_SIZE    /* Maximum ATR size */
+#define SCARD_ATR_LENGTH            MAX_ATR_SIZE      /**< Maximum ATR size */
 #endif
 
 /*
- * Enhanced messaging has been added to accommodate newer devices which have
- * more advanced capabilities, such as dedicated secure co-processors which
- * can stream and encrypt data over USB. In order to used enhanced messaging
- * you must define PCSCLITE_ENHANCED_MESSAGING in the framework(library),
- * the daemon, and your application
- */
-#undef PCSCLITE_ENHANCED_MESSAGING
-#ifndef PCSCLITE_ENHANCED_MESSAGING
-#define PCSCLITE_MAX_MESSAGE_SIZE       2048    /* Transport msg len */
-#define MAX_BUFFER_SIZE                 264     /* Maximum Tx/Rx Buffer */
-#define PCSCLITE_SERVER_ATTEMPTS        5       /* Attempts to reach cl */
-#else
-/*
  * The message and buffer sizes must be multiples of 16.
  * The max message size must be at least large enough
- * to accommodate the transmit_struct
+ * to accomodate the transmit_struct
  */
-#define PCSCLITE_MAX_MESSAGE_SIZE       (1<<17) /* enhanced (128K) msg len */
-#define MAX_BUFFER_SIZE                 (1<<15) /* enhanced (32K) Tx/Rx Buffer */
-#define PCSCLITE_SERVER_ATTEMPTS        200     /* To allow larger data reads/writes */
-#endif
+#define MAX_BUFFER_SIZE                  264      /**< Maximum Tx/Rx Buffer for short APDU */
+#define MAX_BUFFER_SIZE_EXTENDED      (4 + 3 + (1<<16) + 3 + 2)      /**< enhanced (64K + APDU + Lc + Le + SW) Tx/Rx Buffer */
 
 /*
  * Gets a stringified error response
  */
-char *pcsc_stringify_error(long);
+const char *pcsc_stringify_error(const LONG);
 
 #ifdef __cplusplus
 }
--- a/src/solaris/native/sun/security/smartcardio/MUSCLE/winscard.h	Wed May 22 21:33:58 2019 +0300
+++ b/src/solaris/native/sun/security/smartcardio/MUSCLE/winscard.h	Wed Sep 04 06:03:48 2019 +0100
@@ -1,13 +1,38 @@
 /*
- * This handles smartcard reader communications.
- *
- * MUSCLE SmartCard Development ( http://www.linuxnet.com )
+ * MUSCLE SmartCard Development ( https://pcsclite.apdu.fr/ )
  *
  * Copyright (C) 1999-2003
- *  David Corcoran <corcoran@linuxnet.com>
+ *  David Corcoran <corcoran@musclecard.com>
+ * Copyright (C) 2002-2009
  *  Ludovic Rousseau <ludovic.rousseau@free.fr>
  *
- * $Id: winscard.h,v 1.13 2004/08/06 12:12:19 rousseau Exp $
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+
+1. Redistributions of source code must retain the above copyright
+   notice, this list of conditions and the following disclaimer.
+2. Redistributions in binary form must reproduce the above copyright
+   notice, this list of conditions and the following disclaimer in the
+   documentation and/or other materials provided with the distribution.
+3. The name of the author may not be used to endorse or promote products
+   derived from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/**
+ * @file
+ * @brief This handles smart card reader communications.
  */
 
 #ifndef __winscard_h__
@@ -20,71 +45,79 @@
 {
 #endif
 
-        LONG SCardEstablishContext(DWORD dwScope,
-                LPCVOID pvReserved1, LPCVOID pvReserved2, LPSCARDCONTEXT phContext);
+#ifndef PCSC_API
+#define PCSC_API
+#endif
 
-        LONG SCardReleaseContext(SCARDCONTEXT hContext);
+      PCSC_API LONG SCardEstablishContext(DWORD dwScope,
+            /*@null@*/ LPCVOID pvReserved1, /*@null@*/ LPCVOID pvReserved2,
+            /*@out@*/ LPSCARDCONTEXT phContext);
 
-        LONG SCardSetTimeout(SCARDCONTEXT hContext, DWORD dwTimeout);
+      PCSC_API LONG SCardReleaseContext(SCARDCONTEXT hContext);
 
-        LONG SCardConnect(SCARDCONTEXT hContext,
-                LPCTSTR szReader,
-                DWORD dwShareMode,
-                DWORD dwPreferredProtocols,
-                LPSCARDHANDLE phCard, LPDWORD pdwActiveProtocol);
+      PCSC_API LONG SCardIsValidContext(SCARDCONTEXT hContext);
 
-        LONG SCardReconnect(SCARDHANDLE hCard,
-                DWORD dwShareMode,
-                DWORD dwPreferredProtocols,
-                DWORD dwInitialization, LPDWORD pdwActiveProtocol);
+      PCSC_API LONG SCardConnect(SCARDCONTEXT hContext,
+            LPCSTR szReader,
+            DWORD dwShareMode,
+            DWORD dwPreferredProtocols,
+            /*@out@*/ LPSCARDHANDLE phCard, /*@out@*/ LPDWORD pdwActiveProtocol);
 
-        LONG SCardDisconnect(SCARDHANDLE hCard, DWORD dwDisposition);
+      PCSC_API LONG SCardReconnect(SCARDHANDLE hCard,
+            DWORD dwShareMode,
+            DWORD dwPreferredProtocols,
+            DWORD dwInitialization, /*@out@*/ LPDWORD pdwActiveProtocol);
 
-        LONG SCardBeginTransaction(SCARDHANDLE hCard);
+      PCSC_API LONG SCardDisconnect(SCARDHANDLE hCard, DWORD dwDisposition);
 
-        LONG SCardEndTransaction(SCARDHANDLE hCard, DWORD dwDisposition);
+      PCSC_API LONG SCardBeginTransaction(SCARDHANDLE hCard);
 
-        LONG SCardCancelTransaction(SCARDHANDLE hCard);
+      PCSC_API LONG SCardEndTransaction(SCARDHANDLE hCard, DWORD dwDisposition);
 
-        LONG SCardStatus(SCARDHANDLE hCard,
-                LPTSTR mszReaderNames, LPDWORD pcchReaderLen,
-                LPDWORD pdwState,
-                LPDWORD pdwProtocol,
-                LPBYTE pbAtr, LPDWORD pcbAtrLen);
+      PCSC_API LONG SCardStatus(SCARDHANDLE hCard,
+            /*@null@*/ /*@out@*/ LPSTR mszReaderName,
+            /*@null@*/ /*@out@*/ LPDWORD pcchReaderLen,
+            /*@null@*/ /*@out@*/ LPDWORD pdwState,
+            /*@null@*/ /*@out@*/ LPDWORD pdwProtocol,
+            /*@null@*/ /*@out@*/ LPBYTE pbAtr,
+            /*@null@*/ /*@out@*/ LPDWORD pcbAtrLen);
 
-        LONG SCardGetStatusChange(SCARDCONTEXT hContext,
-                DWORD dwTimeout,
-                LPSCARD_READERSTATE_A rgReaderStates, DWORD cReaders);
+      PCSC_API LONG SCardGetStatusChange(SCARDCONTEXT hContext,
+            DWORD dwTimeout,
+            SCARD_READERSTATE *rgReaderStates, DWORD cReaders);
 
-        LONG SCardControl(SCARDHANDLE hCard, DWORD dwControlCode,
-                LPCVOID pbSendBuffer, DWORD cbSendLength,
-                LPVOID pbRecvBuffer, DWORD cbRecvLength, LPDWORD lpBytesReturned);
+      PCSC_API LONG SCardControl(SCARDHANDLE hCard, DWORD dwControlCode,
+            LPCVOID pbSendBuffer, DWORD cbSendLength,
+            /*@out@*/ LPVOID pbRecvBuffer, DWORD cbRecvLength,
+            LPDWORD lpBytesReturned);
 
-        LONG SCardTransmit(SCARDHANDLE hCard,
-                LPCSCARD_IO_REQUEST pioSendPci,
-                LPCBYTE pbSendBuffer, DWORD cbSendLength,
-                LPSCARD_IO_REQUEST pioRecvPci,
-                LPBYTE pbRecvBuffer, LPDWORD pcbRecvLength);
+      PCSC_API LONG SCardTransmit(SCARDHANDLE hCard,
+            const SCARD_IO_REQUEST *pioSendPci,
+            LPCBYTE pbSendBuffer, DWORD cbSendLength,
+            /*@out@*/ SCARD_IO_REQUEST *pioRecvPci,
+            /*@out@*/ LPBYTE pbRecvBuffer, LPDWORD pcbRecvLength);
 
-        LONG SCardListReaderGroups(SCARDCONTEXT hContext,
-                LPTSTR mszGroups, LPDWORD pcchGroups);
+      PCSC_API LONG SCardListReaderGroups(SCARDCONTEXT hContext,
+            /*@out@*/ LPSTR mszGroups, LPDWORD pcchGroups);
 
-        LONG SCardListReaders(SCARDCONTEXT hContext,
-                LPCTSTR mszGroups,
-                LPTSTR mszReaders, LPDWORD pcchReaders);
+      PCSC_API LONG SCardListReaders(SCARDCONTEXT hContext,
+            /*@null@*/ /*@out@*/ LPCSTR mszGroups,
+            /*@null@*/ /*@out@*/ LPSTR mszReaders,
+            /*@out@*/ LPDWORD pcchReaders);
 
-        LONG SCardCancel(SCARDCONTEXT hContext);
+      PCSC_API LONG SCardFreeMemory(SCARDCONTEXT hContext, LPCVOID pvMem);
 
-        LONG SCardGetAttrib(SCARDHANDLE hCard, DWORD dwAttrId, LPBYTE pbAttr,
-                        LPDWORD pcbAttrLen);
+      PCSC_API LONG SCardCancel(SCARDCONTEXT hContext);
 
-        LONG SCardSetAttrib(SCARDHANDLE hCard, DWORD dwAttrId, LPCBYTE pbAttr,
-                        DWORD cbAttrLen);
+      PCSC_API LONG SCardGetAttrib(SCARDHANDLE hCard, DWORD dwAttrId,
+            /*@out@*/ LPBYTE pbAttr, LPDWORD pcbAttrLen);
 
-        void SCardUnload(void);
+      PCSC_API LONG SCardSetAttrib(SCARDHANDLE hCard, DWORD dwAttrId,
+            LPCBYTE pbAttr, DWORD cbAttrLen);
 
 #ifdef __cplusplus
 }
 #endif
 
 #endif
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/solaris/native/sun/security/smartcardio/MUSCLE/wintypes.h	Wed Sep 04 06:03:48 2019 +0100
@@ -0,0 +1,115 @@
+/*
+ * MUSCLE SmartCard Development ( https://pcsclite.apdu.fr/ )
+ *
+ * Copyright (C) 1999
+ *  David Corcoran <corcoran@musclecard.com>
+ * Copyright (C) 2002-2011
+ *  Ludovic Rousseau <ludovic.rousseau@free.fr>
+ *
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+
+1. Redistributions of source code must retain the above copyright
+   notice, this list of conditions and the following disclaimer.
+2. Redistributions in binary form must reproduce the above copyright
+   notice, this list of conditions and the following disclaimer in the
+   documentation and/or other materials provided with the distribution.
+3. The name of the author may not be used to endorse or promote products
+   derived from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/**
+ * @file
+ * @brief This keeps a list of Windows(R) types.
+ */
+
+#ifndef __wintypes_h__
+#define __wintypes_h__
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+#ifdef __APPLE__
+
+#include <stdint.h>
+
+#ifndef BYTE
+    typedef uint8_t BYTE;
+#endif
+    typedef uint8_t UCHAR;
+    typedef UCHAR *PUCHAR;
+    typedef uint16_t USHORT;
+
+#ifndef __COREFOUNDATION_CFPLUGINCOM__
+    typedef uint32_t ULONG;
+    typedef void *LPVOID;
+    typedef int16_t BOOL;
+#endif
+
+    typedef ULONG *PULONG;
+    typedef const void *LPCVOID;
+    typedef uint32_t DWORD;
+    typedef DWORD *PDWORD;
+    typedef uint16_t WORD;
+    typedef int32_t LONG;
+    typedef const char *LPCSTR;
+    typedef const BYTE *LPCBYTE;
+    typedef BYTE *LPBYTE;
+    typedef DWORD *LPDWORD;
+    typedef char *LPSTR;
+
+#else
+
+#ifndef BYTE
+    typedef unsigned char BYTE;
+#endif
+    typedef unsigned char UCHAR;
+    typedef UCHAR *PUCHAR;
+    typedef unsigned short USHORT;
+
+#ifndef __COREFOUNDATION_CFPLUGINCOM__
+    typedef unsigned long ULONG;
+    typedef void *LPVOID;
+#endif
+
+    typedef const void *LPCVOID;
+    typedef unsigned long DWORD;
+    typedef DWORD *PDWORD;
+    typedef long LONG;
+    typedef const char *LPCSTR;
+    typedef const BYTE *LPCBYTE;
+    typedef BYTE *LPBYTE;
+    typedef DWORD *LPDWORD;
+    typedef char *LPSTR;
+
+    /* these types were deprecated but still used by old drivers and
+     * applications. So just declare and use them. */
+    typedef LPSTR LPTSTR;
+    typedef LPCSTR LPCTSTR;
+
+    /* types unused by pcsc-lite */
+    typedef short BOOL;
+    typedef unsigned short WORD;
+    typedef ULONG *PULONG;
+
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
--- a/src/solaris/native/sun/security/smartcardio/pcsc_md.h	Wed May 22 21:33:58 2019 +0300
+++ b/src/solaris/native/sun/security/smartcardio/pcsc_md.h	Wed Sep 04 06:03:48 2019 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,48 +23,49 @@
  * questions.
  */
 
-typedef LONG (*FPTR_SCardEstablishContext)(ULONG dwScope,
-                const void *pvReserved1,
-                const void *pvReserved2,
-                LONG *phContext);
+typedef LONG (*FPTR_SCardEstablishContext)(DWORD dwScope,
+                LPCVOID pvReserved1,
+                LPCVOID pvReserved2,
+                LPSCARDCONTEXT phContext);
 
-typedef LONG (*FPTR_SCardConnect)(LONG hContext,
-                const char *szReader,
-                ULONG dwShareMode,
-                ULONG dwPreferredProtocols,
-                LONG *phCard, ULONG *pdwActiveProtocol);
+typedef LONG (*FPTR_SCardConnect)(SCARDCONTEXT hContext,
+                LPCSTR szReader,
+                DWORD dwShareMode,
+                DWORD dwPreferredProtocols,
+                LPSCARDHANDLE phCard, LPDWORD pdwActiveProtocol);
 
-typedef LONG (*FPTR_SCardDisconnect)(LONG hCard, ULONG dwDisposition);
+typedef LONG (*FPTR_SCardDisconnect)(SCARDHANDLE hCard, DWORD dwDisposition);
 
-typedef LONG (*FPTR_SCardStatus)(LONG hCard,
-                char *mszReaderNames,
-                ULONG *pcchReaderLen,
-                ULONG *pdwState,
-                ULONG *pdwProtocol,
-                unsigned char *pbAtr, ULONG *pcbAtrLen);
+typedef LONG (*FPTR_SCardStatus)(SCARDHANDLE hCard,
+                LPSTR mszReaderNames,
+                LPDWORD pcchReaderLen,
+                LPDWORD pdwState,
+                LPDWORD pdwProtocol,
+                LPBYTE pbAtr, LPDWORD pcbAtrLen);
 
-typedef LONG (*FPTR_SCardGetStatusChange)(LONG hContext,
-                ULONG dwTimeout,
-                LPSCARD_READERSTATE_A rgReaderStates, ULONG cReaders);
+typedef LONG (*FPTR_SCardGetStatusChange)(SCARDCONTEXT hContext,
+                DWORD dwTimeout,
+                SCARD_READERSTATE *rgReaderStates, DWORD cReaders);
 
-typedef LONG (*FPTR_SCardTransmit)(LONG hCard,
-                LPCSCARD_IO_REQUEST pioSendPci,
-                const unsigned char *pbSendBuffer,
-                ULONG cbSendLength,
-                LPSCARD_IO_REQUEST pioRecvPci,
-                unsigned char *pbRecvBuffer, ULONG *pcbRecvLength);
+typedef LONG (*FPTR_SCardTransmit)(SCARDHANDLE hCard,
+                const SCARD_IO_REQUEST *pioSendPci,
+                LPCBYTE pbSendBuffer,
+                DWORD cbSendLength,
+                SCARD_IO_REQUEST *pioRecvPci,
+                LPBYTE pbRecvBuffer, LPDWORD pcbRecvLength);
 
-typedef LONG (*FPTR_SCardListReaders)(LONG hContext,
-                const char *mszGroups,
-                char *mszReaders, ULONG *pcchReaders);
+typedef LONG (*FPTR_SCardListReaders)(SCARDCONTEXT hContext,
+                LPCSTR mszGroups,
+                LPSTR mszReaders, LPDWORD pcchReaders);
 
-typedef LONG (*FPTR_SCardBeginTransaction)(LONG hCard);
+typedef LONG (*FPTR_SCardBeginTransaction)(SCARDHANDLE hCard);
 
-typedef LONG (*FPTR_SCardEndTransaction)(LONG hCard, ULONG dwDisposition);
+typedef LONG (*FPTR_SCardEndTransaction)(SCARDHANDLE hCard,
+                DWORD dwDisposition);
 
-typedef LONG (*FPTR_SCardControl)(LONG hCard, ULONG dwControlCode,
-    const void* pbSendBuffer, ULONG cbSendLength, const void* pbRecvBuffer,
-    ULONG pcbRecvLength, ULONG *lpBytesReturned);
+typedef LONG (*FPTR_SCardControl)(SCARDHANDLE hCard, DWORD dwControlCode,
+                LPCVOID pbSendBuffer, DWORD cbSendLength, LPVOID pbRecvBuffer,
+                DWORD pcbRecvLength, LPDWORD lpBytesReturned);
 
 #define CALL_SCardEstablishContext(dwScope, pvReserved1, pvReserved2, phContext) \
     ((scardEstablishContext)(dwScope, pvReserved1, pvReserved2, phContext))