components/ccid/patches/02-commands.c.patch
author Stephen Gaul Jr <steve.gaul@oracle.com>
Fri, 03 Jun 2016 09:30:42 -0700
changeset 6133 73641150a4de
permissions -rw-r--r--
PSARC/2016/217 Smartcard Reintroduction PSARC/2016/218 USB CCID PSARC/2016/221 PC/SC Lite smartcard middleware 22017759 Add pcsclite v1.8.14 to Userland consolidation 22017751 Add libccid v1.4.20 to Userland consolidation
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
6133
73641150a4de PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff changeset
     1
In-house patch created for CCID data frame error handling issue seen on Solaris.
73641150a4de PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff changeset
     2
73641150a4de PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff changeset
     3
The data the CCID frame says to contain will only be evaluated to see if we 
73641150a4de PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff changeset
     4
have less data, if so then report it as an error condition. 
73641150a4de PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff changeset
     5
73641150a4de PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff changeset
     6
--- ccid-1.4.20/src/commands.c	2016-05-17 10:28:40.587856908 -0400
73641150a4de PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff changeset
     7
+++ ccid-1.4.20/src/commands.c	2016-05-17 10:04:27.530080977 -0400
73641150a4de PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff changeset
     8
@@ -1493,6 +1493,8 @@
73641150a4de PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff changeset
     9
 	length = sizeof(cmd);
73641150a4de PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff changeset
    10
 	ret = ReadPort(reader_index, &length, cmd);
73641150a4de PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff changeset
    11
 
73641150a4de PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff changeset
    12
+        DEBUG_CRITICAL2("LENGTH 1 is: %d ", length);
73641150a4de PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff changeset
    13
+
73641150a4de PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff changeset
    14
 	/* restore the original value of read timeout */
73641150a4de PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff changeset
    15
 	ccid_descriptor -> readTimeout = old_timeout;
73641150a4de PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff changeset
    16
 	CHECK_STATUS(ret)
73641150a4de PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff changeset
    17
@@ -1543,12 +1545,21 @@
73641150a4de PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff changeset
    18
 		DEBUG_COMM2("New timeout: %d ms", ccid_descriptor -> readTimeout);
73641150a4de PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff changeset
    19
 		goto time_request;
73641150a4de PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff changeset
    20
 	}
73641150a4de PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff changeset
    21
-
73641150a4de PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff changeset
    22
-	/* we have read less (or more) data than the CCID frame says to contain */
73641150a4de PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff changeset
    23
-	if (length-10 != dw2i(cmd, 1))
73641150a4de PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff changeset
    24
+        /****************************************************************************
73641150a4de PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff changeset
    25
+	  * we have read less (or more) data than the CCID frame says to contain       
73641150a4de PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff changeset
    26
+         * XXX - Change from original FOSS if test logic of "!=" due to line 1493     
73641150a4de PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff changeset
    27
+         *       'length' getting assigned a value of 65636 and 'cmd' appears to be     
73641150a4de PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff changeset
    28
+         *       evaluated and returned from 'sizeof' as an unsigned int, therefore         
73641150a4de PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff changeset
    29
+         *       (65536 -10) will never equal the data the CCID frame says to contain 
73641150a4de PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff changeset
    30
+         *       so, only evaluate to see if we have less data as an error condition. 
73641150a4de PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff changeset
    31
+         ****************************************************************************/
73641150a4de PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff changeset
    32
+       if (length-10 < dw2i(cmd, 1))
73641150a4de PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff changeset
    33
 	{
73641150a4de PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff changeset
    34
 		DEBUG_CRITICAL3("Can't read all data (%d out of %d expected)",
73641150a4de PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff changeset
    35
 			length-10, dw2i(cmd, 1));
73641150a4de PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff changeset
    36
+
73641150a4de PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff changeset
    37
+                DEBUG_CRITICAL2("LENGTH 2 is: %d ", length);
73641150a4de PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff changeset
    38
+
73641150a4de PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff changeset
    39
 		return_value = IFD_COMMUNICATION_ERROR;
73641150a4de PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff changeset
    40
 	}
73641150a4de PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff changeset
    41