author | sreynata <sreyas.natarajan@oracle.com> |
Mon, 17 Oct 2016 23:20:28 -0700 | |
changeset 7120 | b01185225eaa |
parent 6279 | b8986042dd84 |
permissions | -rw-r--r-- |
6279
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1 |
In-house patch created to clear any merge conflicts from source in archive |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
2 |
repo to build properly on Solaris. |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
3 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
4 |
--- CACKey-0.7.4/cackey.c 2016-05-19 14:16:48.230399914 -0400 |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
5 |
+++ CACKey-0.7.4/cackey.c 2015-07-16 12:20:20.000000000 -0400 |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
6 |
@@ -35,13 +35,10 @@ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
7 |
#ifdef HAVE_STDIO_H |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
8 |
# include <stdio.h> |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
9 |
#endif |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
10 |
-<<<<<<< HEAD |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
11 |
-======= |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
12 |
#define HAVE_ERRNO_H 1 |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
13 |
#ifdef HAVE_ERRNO_H |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
14 |
# include <errno.h> |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
15 |
#endif |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
16 |
->>>>>>> trunk |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
17 |
#ifdef HAVE_ZLIB_H |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
18 |
# ifdef HAVE_LIBZ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
19 |
# include <zlib.h> |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
20 |
@@ -51,12 +48,9 @@ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
21 |
# undef HAVE_LIBZ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
22 |
# endif |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
23 |
#endif |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
24 |
-<<<<<<< HEAD |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
25 |
-======= |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
26 |
#ifdef CACKEY_DEBUG_SEARCH_SPEEDTEST |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
27 |
# include <sys/time.h> |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
28 |
#endif |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
29 |
->>>>>>> trunk |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
30 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
31 |
#define CK_PTR * |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
32 |
#define CK_DEFINE_FUNCTION(returnType, name) returnType name |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
33 |
@@ -73,17 +67,6 @@ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
34 |
#include "sha1.h" |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
35 |
#include "md5.h" |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
36 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
37 |
-<<<<<<< HEAD |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
38 |
-/* |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
39 |
- * Include these source files in this translation unit so that we can bind to |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
40 |
- * functions and not include any symbols in the output shared object. |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
41 |
- */ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
42 |
-#include "asn1-x509.c" |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
43 |
-#include "sha1.c" |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
44 |
-#include "md5.c" |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
45 |
- |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
46 |
-======= |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
47 |
->>>>>>> trunk |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
48 |
#ifndef CACKEY_CRYPTOKI_VERSION_CODE |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
49 |
# define CACKEY_CRYPTOKI_VERSION_CODE 0x021e00 |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
50 |
#endif |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
51 |
@@ -102,10 +85,7 @@ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
52 |
#define GSCIS_INSTR_GET_CHALLENGE 0x84 |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
53 |
#define GSCIS_INSTR_INTERNAL_AUTH 0x88 |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
54 |
#define GSCIS_INSTR_VERIFY 0x20 |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
55 |
-<<<<<<< HEAD |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
56 |
-======= |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
57 |
#define GSCIS_INSTR_CHANGE_REFERENCE 0x24 |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
58 |
->>>>>>> trunk |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
59 |
#define GSCIS_INSTR_SIGN 0x2A |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
60 |
#define GSCIS_INSTR_GET_PROP 0x56 |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
61 |
#define GSCIS_INSTR_GET_ACR 0x4C |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
62 |
@@ -173,13 +153,10 @@ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
63 |
#define GSCIS_TAG_SECURITY_CODE 0x57 |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
64 |
#define GSCIS_TAG_CARDID_AID 0x58 |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
65 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
66 |
-<<<<<<< HEAD |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
67 |
-======= |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
68 |
/*** PIV Codes ***/ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
69 |
#define NISTSP800_73_3_INSTR_GET_DATA 0xCB |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
70 |
#define NISTSP800_73_3_INSTR_GENAUTH 0x87 |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
71 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
72 |
->>>>>>> trunk |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
73 |
/*** PKI Information - EF 7000 ***/ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
74 |
#define GSCIS_TAG_CERTIFICATE 0x70 |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
75 |
#define GSCIS_TAG_CERT_ISSUE_DATE 0x71 |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
76 |
@@ -187,8 +164,6 @@ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
77 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
78 |
/** Applet IDs **/ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
79 |
#define GSCIS_AID_CCC 0xA0, 0x00, 0x00, 0x01, 0x16, 0xDB, 0x00 |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
80 |
-<<<<<<< HEAD |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
81 |
-======= |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
82 |
#define NISTSP800_73_3_PIV_AID 0xA0, 0x00, 0x00, 0x03, 0x08, 0x00, 0x00, 0x10, 0x00, 0x01, 0x00 |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
83 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
84 |
/* PIV IDs */ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
85 |
@@ -207,7 +182,6 @@ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
86 |
#define NISTSP800_73_3_OID_SIGNATURE 0x5F, 0xC1, 0x0A |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
87 |
#define NISTSP800_73_3_OID_KEYMGT 0x5F, 0xC1, 0x0B |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
88 |
#define NISTSP800_73_3_OID_CARDAUTH 0x5F, 0xC1, 0x01 |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
89 |
->>>>>>> trunk |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
90 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
91 |
/* Maximum size of data portion of APDUs */ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
92 |
/** Do not set this above 250 **/ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
93 |
@@ -222,17 +196,6 @@ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
94 |
# ifdef HAVE_TIME_H |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
95 |
# include <time.h> |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
96 |
static time_t cackey_debug_start_time = 0; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
97 |
-<<<<<<< HEAD |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
98 |
-# define CACKEY_DEBUG_PRINTTIME { if (cackey_debug_start_time == 0) { cackey_debug_start_time = time(NULL); }; fprintf(cackey_debug_fd(), "[%lu]: ", (unsigned long) (time(NULL) - cackey_debug_start_time)); } |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
99 |
-# else |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
100 |
-# define CACKEY_DEBUG_PRINTTIME /**/ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
101 |
-# endif |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
102 |
- |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
103 |
-# define CACKEY_DEBUG_PRINTF(x...) { CACKEY_DEBUG_PRINTTIME; fprintf(cackey_debug_fd(), "%s():%i: ", __func__, __LINE__); fprintf(cackey_debug_fd(), x); fprintf(cackey_debug_fd(), "\n"); fflush(cackey_debug_fd()); } |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
104 |
-# define CACKEY_DEBUG_PRINTBUF(f, x, y) { unsigned char *TMPBUF; unsigned long idx; TMPBUF = (unsigned char *) (x); CACKEY_DEBUG_PRINTTIME; fprintf(cackey_debug_fd(), "%s():%i: %s (%s/%lu = {%02x", __func__, __LINE__, f, #x, (unsigned long) (y), TMPBUF[0]); for (idx = 1; idx < (y); idx++) { fprintf(cackey_debug_fd(), ", %02x", TMPBUF[idx]); }; fprintf(cackey_debug_fd(), "})\n"); fflush(cackey_debug_fd()); } |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
105 |
-# define CACKEY_DEBUG_PERROR(x) { fprintf(cackey_debug_fd(), "%s():%i: ", __func__, __LINE__); CACKEY_DEBUG_PRINTTIME; perror(x); fflush(cackey_debug_fd()); } |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
106 |
-# define free(x) { CACKEY_DEBUG_PRINTF("FREE(%p) (%s)", x, #x); free(x); } |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
107 |
-======= |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
108 |
static unsigned long CACKEY_DEBUG_GETTIME(void) { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
109 |
if (cackey_debug_start_time == 0) { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
110 |
cackey_debug_start_time = time(NULL); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
111 |
@@ -254,17 +217,16 @@ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
112 |
fflush(cackey_debug_fd()); \ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
113 |
} |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
114 |
# define CACKEY_DEBUG_PRINTBUF(f, x, y) { \ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
115 |
- static char buf_user[4096] = {0}, *buf_user_p, *buf_user_print; \ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
116 |
+ static char buf_user[4096] = {0}, *buf_user_p; \ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
117 |
unsigned long buf_user_size; \ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
118 |
unsigned char *TMPBUF; \ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
119 |
unsigned long idx; \ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
120 |
int snprintf_ret; \ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
121 |
TMPBUF = (unsigned char *) (x); \ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
122 |
buf_user[0] = 0; \ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
123 |
- buf_user[2] = 0; \ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
124 |
buf_user_p = buf_user; \ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
125 |
buf_user_size = sizeof(buf_user); \ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
126 |
- for (idx = 0; idx < (y); idx++) { \ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
127 |
+ for (idx = 1; idx < (y); idx++) { \ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
128 |
if (buf_user_size <= 0) { \ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
129 |
break; \ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
130 |
}; \ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
131 |
@@ -276,12 +238,10 @@ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
132 |
buf_user_size -= snprintf_ret; \ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
133 |
}; \ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
134 |
buf_user[sizeof(buf_user) - 1] = '\0'; \ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
135 |
- buf_user_print = buf_user + 2; \ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
136 |
- fprintf(cackey_debug_fd(), "[%lu]: %s():%i: %s (%s/%lu = {%s})\n", CACKEY_DEBUG_GETTIME(), __func__, __LINE__, f, #x, (unsigned long) (y), buf_user_print); \ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
137 |
+ fprintf(cackey_debug_fd(), "[%lu]: %s():%i: %s (%s/%lu = {%02x%s})\n", CACKEY_DEBUG_GETTIME(), __func__, __LINE__, f, #x, (unsigned long) (y), TMPBUF[0], buf_user); \ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
138 |
fflush(cackey_debug_fd()); \ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
139 |
} |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
140 |
# define free(x) { CACKEY_DEBUG_PRINTF("FREE(%p) (%s)", (void *) x, #x); free(x); } |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
141 |
->>>>>>> trunk |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
142 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
143 |
static FILE *cackey_debug_fd(void) { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
144 |
static FILE *fd = NULL; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
145 |
@@ -309,15 +269,12 @@ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
146 |
} |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
147 |
} |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
148 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
149 |
-<<<<<<< HEAD |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
150 |
-======= |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
151 |
#ifdef CACKEY_DEBUG_LOGFILE |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
152 |
if (logfile == NULL) { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
153 |
logfile = CACKEY_DEBUG_LOGFILE; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
154 |
} |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
155 |
#endif |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
156 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
157 |
->>>>>>> trunk |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
158 |
if (logfile != NULL) { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
159 |
CACKEY_DEBUG_PRINTF("Found log file: %s", logfile); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
160 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
161 |
@@ -331,11 +288,7 @@ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
162 |
if (fd == stderr) { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
163 |
CACKEY_DEBUG_PRINTF("Returning stderr"); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
164 |
} else { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
165 |
-<<<<<<< HEAD |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
166 |
- CACKEY_DEBUG_PRINTF("Returning %p", fd); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
167 |
-======= |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
168 |
CACKEY_DEBUG_PRINTF("Returning %p", (void *) fd); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
169 |
->>>>>>> trunk |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
170 |
} |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
171 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
172 |
return(fd); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
173 |
@@ -346,14 +299,7 @@ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
174 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
175 |
retval = malloc(size); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
176 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
177 |
-<<<<<<< HEAD |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
178 |
- CACKEY_DEBUG_PRINTTIME; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
179 |
- fprintf(cackey_debug_fd(), "%s():%i: ", func, line); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
180 |
- fprintf(cackey_debug_fd(), "MALLOC() = %p", retval); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
181 |
- fprintf(cackey_debug_fd(), "\n"); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
182 |
-======= |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
183 |
fprintf(cackey_debug_fd(), "[%lu]: %s():%i: MALLOC() = %p\n", CACKEY_DEBUG_GETTIME(), func, line, retval); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
184 |
->>>>>>> trunk |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
185 |
fflush(cackey_debug_fd()); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
186 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
187 |
return(retval); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
188 |
@@ -365,14 +311,7 @@ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
189 |
retval = realloc(ptr, size); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
190 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
191 |
if (retval != ptr) { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
192 |
-<<<<<<< HEAD |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
193 |
- CACKEY_DEBUG_PRINTTIME; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
194 |
- fprintf(cackey_debug_fd(), "%s():%i: ", func, line); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
195 |
- fprintf(cackey_debug_fd(), "REALLOC(%p) = %p", ptr, retval); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
196 |
- fprintf(cackey_debug_fd(), "\n"); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
197 |
-======= |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
198 |
fprintf(cackey_debug_fd(), "[%lu]: %s():%i: REALLOC(%p) = %p\n", CACKEY_DEBUG_GETTIME(), func, line, ptr, retval); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
199 |
->>>>>>> trunk |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
200 |
fflush(cackey_debug_fd()); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
201 |
} |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
202 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
203 |
@@ -388,14 +327,7 @@ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
204 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
205 |
retval = strdup(ptr); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
206 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
207 |
-<<<<<<< HEAD |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
208 |
- CACKEY_DEBUG_PRINTTIME; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
209 |
- fprintf(cackey_debug_fd(), "%s():%i: ", func, line); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
210 |
- fprintf(cackey_debug_fd(), "STRDUP_MALLOC() = %p", retval); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
211 |
- fprintf(cackey_debug_fd(), "\n"); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
212 |
-======= |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
213 |
fprintf(cackey_debug_fd(), "[%lu]: %s():%i: STRDUP_MALLOC() = %p\n", CACKEY_DEBUG_GETTIME(), func, line, retval); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
214 |
->>>>>>> trunk |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
215 |
fflush(cackey_debug_fd()); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
216 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
217 |
return(retval); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
218 |
@@ -777,10 +709,6 @@ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
219 |
#else |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
220 |
# define CACKEY_DEBUG_PRINTF(x...) /**/ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
221 |
# define CACKEY_DEBUG_PRINTBUF(f, x, y) /**/ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
222 |
-<<<<<<< HEAD |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
223 |
-# define CACKEY_DEBUG_PERROR(x) /**/ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
224 |
-======= |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
225 |
->>>>>>> trunk |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
226 |
# define CACKEY_DEBUG_FUNC_TAG_TO_STR(x) "DEBUG_DISABLED" |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
227 |
# define CACKEY_DEBUG_FUNC_SCARDERR_TO_STR(x) "DEBUG_DISABLED" |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
228 |
# define CACKEY_DEBUG_FUNC_OBJID_TO_STR(x) "DEBUG_DISABLED" |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
229 |
@@ -788,11 +716,6 @@ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
230 |
# define CACKEY_DEBUG_FUNC_ATTRIBUTE_TO_STR(x) "DEBUG_DISABLED" |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
231 |
#endif |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
232 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
233 |
-<<<<<<< HEAD |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
234 |
-struct cackey_pcsc_identity { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
235 |
- unsigned char applet[7]; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
236 |
- uint16_t file; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
237 |
-======= |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
238 |
/* |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
239 |
* Include these source files in this translation unit so that we can bind to |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
240 |
* functions and not include any symbols in the output shared object. |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
241 |
@@ -809,14 +732,11 @@ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
242 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
243 |
struct cackey_pcsc_identity { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
244 |
cackey_pcsc_id_type id_type; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
245 |
->>>>>>> trunk |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
246 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
247 |
size_t certificate_len; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
248 |
unsigned char *certificate; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
249 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
250 |
ssize_t keysize; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
251 |
-<<<<<<< HEAD |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
252 |
-======= |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
253 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
254 |
union { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
255 |
struct { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
256 |
@@ -829,7 +749,6 @@ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
257 |
char label[32]; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
258 |
} piv; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
259 |
} card; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
260 |
->>>>>>> trunk |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
261 |
}; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
262 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
263 |
struct cackey_identity { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
264 |
@@ -874,10 +793,7 @@ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
265 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
266 |
struct cackey_slot { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
267 |
int active; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
268 |
-<<<<<<< HEAD |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
269 |
-======= |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
270 |
int internal; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
271 |
->>>>>>> trunk |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
272 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
273 |
char *pcsc_reader; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
274 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
275 |
@@ -894,12 +810,9 @@ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
276 |
unsigned char *label; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
277 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
278 |
DWORD protocol; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
279 |
-<<<<<<< HEAD |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
280 |
-======= |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
281 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
282 |
unsigned int cached_certs_count; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
283 |
struct cackey_pcsc_identity *cached_certs; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
284 |
->>>>>>> trunk |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
285 |
}; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
286 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
287 |
typedef enum { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
288 |
@@ -931,12 +844,7 @@ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
289 |
CACKEY_PCSC_E_LOCKED = -3, |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
290 |
CACKEY_PCSC_E_NEEDLOGIN = -4, |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
291 |
CACKEY_PCSC_E_TOKENABSENT = -6, |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
292 |
-<<<<<<< HEAD |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
293 |
CACKEY_PCSC_E_RETRY = -7 |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
294 |
-======= |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
295 |
- CACKEY_PCSC_E_RETRY = -7, |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
296 |
- CACKEY_PCSC_E_NODATA = -8 |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
297 |
->>>>>>> trunk |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
298 |
} cackey_ret; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
299 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
300 |
struct cackey_tlv_cardurl { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
301 |
@@ -974,19 +882,11 @@ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
302 |
#include "cackey_builtin_certs.h" |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
303 |
}; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
304 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
305 |
-<<<<<<< HEAD |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
306 |
-======= |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
307 |
-#define CACKEY_MACRO_DEFAULT_XSTR(str) CACKEY_MACRO_DEFAULT_STR(str) |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
308 |
-#define CACKEY_MACRO_DEFAULT_STR(str) #str |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
309 |
- |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
310 |
/* Protected Authentication Path command */ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
311 |
+#define CACKEY_PIN_COMMAND_DEFAULT_XSTR(str) CACKEY_PIN_COMMAND_DEFAULT_STR(str) |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
312 |
+#define CACKEY_PIN_COMMAND_DEFAULT_STR(str) #str |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
313 |
static char *cackey_pin_command = NULL; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
314 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
315 |
-/* Reader Exclusion or Include-only */ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
316 |
-static char *cackey_readers_include_only = NULL; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
317 |
-static char *cackey_readers_exclude = NULL; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
318 |
- |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
319 |
->>>>>>> trunk |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
320 |
/* PCSC Global Handles */ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
321 |
static LPSCARDCONTEXT cackey_pcsc_handle = NULL; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
322 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
323 |
@@ -1046,14 +946,11 @@ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
324 |
CACKEY_DEBUG_PRINTF("Called."); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
325 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
326 |
for (idx = 0; idx < (sizeof(cackey_slots) / sizeof(cackey_slots[0])); idx++) { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
327 |
-<<<<<<< HEAD |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
328 |
-======= |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
329 |
if (cackey_slots[idx].internal) { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
330 |
/* Skip internal slots */ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
331 |
continue; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
332 |
} |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
333 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
334 |
->>>>>>> trunk |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
335 |
if (cackey_slots[idx].pcsc_card_connected) { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
336 |
CACKEY_DEBUG_PRINTF("SCardDisconnect(%lu) called", (unsigned long) idx); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
337 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
338 |
@@ -1226,15 +1123,11 @@ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
339 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
340 |
slot->slot_reset = 1; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
341 |
slot->pcsc_card_connected = 0; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
342 |
-<<<<<<< HEAD |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
343 |
- slot->token_flags = CKF_LOGIN_REQUIRED; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
344 |
-======= |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
345 |
if (cackey_pin_command == NULL) { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
346 |
slot->token_flags = CKF_LOGIN_REQUIRED; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
347 |
} else { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
348 |
slot->token_flags = 0; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
349 |
} |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
350 |
->>>>>>> trunk |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
351 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
352 |
CACKEY_DEBUG_PRINTF("Returning."); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
353 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
354 |
@@ -1243,11 +1136,7 @@ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
355 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
356 |
/* |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
357 |
* SYNPOSIS |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
358 |
-<<<<<<< HEAD |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
359 |
- * LONG cackey_reconnect_card(struct cackey_slot *slot, DWORD default_protocol, LPDWORD selected_protocol); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
360 |
-======= |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
361 |
* LONG cackey_reconnect_card(struct cackey_slot *slot, DWORD default_protocol); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
362 |
->>>>>>> trunk |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
363 |
* |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
364 |
* ARGUMENTS |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
365 |
* cackey_slot *slot |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
366 |
@@ -1256,12 +1145,6 @@ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
367 |
* DWORD default_protocol |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
368 |
* Protocol to attempt first |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
369 |
* |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
370 |
-<<<<<<< HEAD |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
371 |
- * LPDWORD selected_protocol |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
372 |
- * [OUT] Protocol selected |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
373 |
- * |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
374 |
-======= |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
375 |
->>>>>>> trunk |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
376 |
* RETURN VALUE |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
377 |
* The return value from SCardReconnect() |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
378 |
* |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
379 |
@@ -1274,23 +1157,6 @@ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
380 |
* that T=1. |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
381 |
* |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
382 |
*/ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
383 |
-<<<<<<< HEAD |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
384 |
-static LONG cackey_reconnect_card(struct cackey_slot *slot, DWORD default_protocol, LPDWORD selected_protocol) { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
385 |
- LONG scard_conn_ret; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
386 |
- |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
387 |
- scard_conn_ret = SCardReconnect(slot->pcsc_card, SCARD_SHARE_SHARED, default_protocol, SCARD_RESET_CARD, selected_protocol); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
388 |
- |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
389 |
- if (scard_conn_ret == SCARD_E_PROTO_MISMATCH) { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
390 |
- CACKEY_DEBUG_PRINTF("SCardReconnect() returned SCARD_E_PROTO_MISMATCH, trying with just T=0") |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
391 |
- scard_conn_ret = SCardReconnect(slot->pcsc_card, SCARD_SHARE_SHARED, SCARD_PROTOCOL_T0, SCARD_RESET_CARD, selected_protocol); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
392 |
- |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
393 |
- if (scard_conn_ret == SCARD_E_PROTO_MISMATCH) { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
394 |
- CACKEY_DEBUG_PRINTF("SCardReconnect() returned SCARD_E_PROTO_MISMATCH, trying with just T=1") |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
395 |
- scard_conn_ret = SCardReconnect(slot->pcsc_card, SCARD_SHARE_SHARED, SCARD_PROTOCOL_T1, SCARD_RESET_CARD, selected_protocol); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
396 |
- } |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
397 |
- } |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
398 |
- |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
399 |
-======= |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
400 |
static LONG cackey_reconnect_card(struct cackey_slot *slot, DWORD default_protocol) { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
401 |
DWORD selected_protocol; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
402 |
LONG scard_conn_ret; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
403 |
@@ -1313,7 +1179,6 @@ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
404 |
slot->protocol = selected_protocol; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
405 |
} |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
406 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
407 |
->>>>>>> trunk |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
408 |
return(scard_conn_ret); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
409 |
} |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
410 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
411 |
@@ -1355,11 +1220,7 @@ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
412 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
413 |
/* Connect to reader, if needed */ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
414 |
if (!slot->pcsc_card_connected) { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
415 |
-<<<<<<< HEAD |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
416 |
- CACKEY_DEBUG_PRINTF("SCardConnect(%s) called", slot->pcsc_reader); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
417 |
-======= |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
418 |
CACKEY_DEBUG_PRINTF("SCardConnect(%s) called for slot %p", slot->pcsc_reader, slot); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
419 |
->>>>>>> trunk |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
420 |
scard_conn_ret = SCardConnect(*cackey_pcsc_handle, slot->pcsc_reader, SCARD_SHARE_SHARED, SCARD_PROTOCOL_T0 | SCARD_PROTOCOL_T1, &slot->pcsc_card, &protocol); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
421 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
422 |
if (scard_conn_ret == SCARD_E_PROTO_MISMATCH) { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
423 |
@@ -1387,11 +1248,7 @@ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
424 |
} |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
425 |
} |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
426 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
427 |
-<<<<<<< HEAD |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
428 |
- scard_conn_ret = cackey_reconnect_card(slot, protocol, &protocol); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
429 |
-======= |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
430 |
scard_conn_ret = cackey_reconnect_card(slot, protocol); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
431 |
->>>>>>> trunk |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
432 |
} |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
433 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
434 |
if (scard_conn_ret != SCARD_S_SUCCESS) { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
435 |
@@ -1406,11 +1263,8 @@ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
436 |
slot->protocol = protocol; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
437 |
} |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
438 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
439 |
-<<<<<<< HEAD |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
440 |
-======= |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
441 |
CACKEY_DEBUG_PRINTF("Returning in success"); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
442 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
443 |
->>>>>>> trunk |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
444 |
return(CACKEY_PCSC_S_OK); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
445 |
} |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
446 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
447 |
@@ -1587,12 +1441,6 @@ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
448 |
* CACKEY_PCSC_E_GENERIC On error |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
449 |
* CACKEY_PCSC_E_TOKENABSENT If the sending failed because the token is |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
450 |
* absent |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
451 |
-<<<<<<< HEAD |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
452 |
-======= |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
453 |
- * CACKEY_PCSC_E_RETRY If something that looks retry'able went |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
454 |
- * wrong -- try the whole transaction over |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
455 |
- * again |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
456 |
->>>>>>> trunk |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
457 |
* |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
458 |
* NOTES |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
459 |
* This function will connect to the PC/SC Connection Manager via |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
460 |
@@ -1603,18 +1451,10 @@ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
461 |
* goes away. |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
462 |
* |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
463 |
*/ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
464 |
-<<<<<<< HEAD |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
465 |
-static cackey_ret cackey_send_apdu(struct cackey_slot *slot, unsigned char class, unsigned char instruction, unsigned char p1, unsigned char p2, unsigned char lc, unsigned char *data, unsigned char le, uint16_t *respcode, unsigned char *respdata, size_t *respdata_len) { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
466 |
- uint8_t major_rc, minor_rc; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
467 |
- size_t bytes_to_copy, tmp_respdata_len; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
468 |
- LPCSCARD_IO_REQUEST pioSendPci; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
469 |
- DWORD protocol; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
470 |
-======= |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
471 |
static cackey_ret cackey_send_apdu(struct cackey_slot *slot, unsigned char class, unsigned char instruction, unsigned char p1, unsigned char p2, unsigned int lc, unsigned char *data, unsigned int le, uint16_t *respcode, unsigned char *respdata, size_t *respdata_len) { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
472 |
uint8_t major_rc, minor_rc; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
473 |
size_t bytes_to_copy, tmp_respdata_len; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
474 |
LPCSCARD_IO_REQUEST pioSendPci; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
475 |
->>>>>>> trunk |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
476 |
DWORD xmit_len, recv_len; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
477 |
LONG scard_xmit_ret, scard_reconn_ret; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
478 |
BYTE xmit_buf[1024], recv_buf[1024]; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
479 |
@@ -1639,20 +1479,14 @@ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
480 |
/* Determine which protocol to send using */ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
481 |
switch (slot->protocol) { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
482 |
case SCARD_PROTOCOL_T0: |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
483 |
-<<<<<<< HEAD |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
484 |
-======= |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
485 |
CACKEY_DEBUG_PRINTF("Protocol to send datagram is T=0"); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
486 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
487 |
->>>>>>> trunk |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
488 |
pioSendPci = SCARD_PCI_T0; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
489 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
490 |
break; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
491 |
case SCARD_PROTOCOL_T1: |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
492 |
-<<<<<<< HEAD |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
493 |
-======= |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
494 |
CACKEY_DEBUG_PRINTF("Protocol to send datagram is T=1"); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
495 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
496 |
->>>>>>> trunk |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
497 |
pioSendPci = SCARD_PCI_T1; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
498 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
499 |
break; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
500 |
@@ -1669,9 +1503,6 @@ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
501 |
xmit_buf[xmit_len++] = p1; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
502 |
xmit_buf[xmit_len++] = p2; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
503 |
if (data) { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
504 |
-<<<<<<< HEAD |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
505 |
- xmit_buf[xmit_len++] = lc; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
506 |
-======= |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
507 |
if (lc > 255) { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
508 |
CACKEY_DEBUG_PRINTF("CAUTION! Using an Lc greater than 255 is untested. Lc = %u", lc); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
509 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
510 |
@@ -1681,16 +1512,12 @@ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
511 |
} else { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
512 |
xmit_buf[xmit_len++] = lc; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
513 |
} |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
514 |
->>>>>>> trunk |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
515 |
for (idx = 0; idx < lc; idx++) { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
516 |
xmit_buf[xmit_len++] = data[idx]; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
517 |
} |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
518 |
} |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
519 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
520 |
if (le != 0x00) { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
521 |
-<<<<<<< HEAD |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
522 |
- xmit_buf[xmit_len++] = le; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
523 |
-======= |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
524 |
if (le > 256) { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
525 |
CACKEY_DEBUG_PRINTF("CAUTION! Using an Le greater than 256 is untested. Le = %u", le); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
526 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
527 |
@@ -1702,17 +1529,12 @@ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
528 |
} else { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
529 |
xmit_buf[xmit_len++] = le; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
530 |
} |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
531 |
->>>>>>> trunk |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
532 |
} |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
533 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
534 |
/* Begin Smartcard Transaction */ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
535 |
cackey_begin_transaction(slot); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
536 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
537 |
-<<<<<<< HEAD |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
538 |
- if (class == GSCIS_CLASS_ISO7816 && instruction == GSCIS_INSTR_VERIFY && p1 == 0x00 && p2 == 0x00) { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
539 |
-======= |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
540 |
if (class == GSCIS_CLASS_ISO7816 && (instruction == GSCIS_INSTR_VERIFY || instruction == GSCIS_INSTR_CHANGE_REFERENCE) && p1 == 0x00) { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
541 |
->>>>>>> trunk |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
542 |
CACKEY_DEBUG_PRINTF("Sending APDU: <<censored>>"); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
543 |
} else { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
544 |
CACKEY_DEBUG_PRINTBUF("Sending APDU:", xmit_buf, xmit_len); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
545 |
@@ -1727,11 +1549,8 @@ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
546 |
/* Begin Smartcard Transaction */ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
547 |
cackey_end_transaction(slot); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
548 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
549 |
-<<<<<<< HEAD |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
550 |
-======= |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
551 |
cackey_reconnect_card(slot, slot->protocol); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
552 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
553 |
->>>>>>> trunk |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
554 |
return(CACKEY_PCSC_E_RETRY); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
555 |
} |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
556 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
557 |
@@ -1744,17 +1563,9 @@ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
558 |
if (scard_xmit_ret == SCARD_W_RESET_CARD) { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
559 |
CACKEY_DEBUG_PRINTF("Reset required, please hold..."); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
560 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
561 |
-<<<<<<< HEAD |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
562 |
- scard_reconn_ret = cackey_reconnect_card(slot, SCARD_PROTOCOL_T0 | SCARD_PROTOCOL_T1, &protocol); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
563 |
- |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
564 |
- if (scard_reconn_ret == SCARD_S_SUCCESS) { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
565 |
- /* Update protocol */ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
566 |
- slot->protocol = protocol; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
567 |
-======= |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
568 |
scard_reconn_ret = cackey_reconnect_card(slot, SCARD_PROTOCOL_T0 | SCARD_PROTOCOL_T1); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
569 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
570 |
if (scard_reconn_ret == SCARD_S_SUCCESS) { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
571 |
->>>>>>> trunk |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
572 |
switch (slot->protocol) { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
573 |
case SCARD_PROTOCOL_T0: |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
574 |
pioSendPci = SCARD_PCI_T0; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
575 |
@@ -1831,16 +1642,7 @@ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
576 |
/* End Smartcard Transaction */ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
577 |
cackey_end_transaction(slot); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
578 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
579 |
-<<<<<<< HEAD |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
580 |
return(CACKEY_PCSC_E_GENERIC); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
581 |
-======= |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
582 |
- /* Supply an invalid response code */ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
583 |
- if (respcode) { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
584 |
- *respcode = 0; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
585 |
- } |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
586 |
- |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
587 |
- return(CACKEY_PCSC_E_NODATA); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
588 |
->>>>>>> trunk |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
589 |
} |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
590 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
591 |
/* Determine result code */ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
592 |
@@ -1927,8 +1729,6 @@ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
593 |
return(CACKEY_PCSC_E_GENERIC); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
594 |
} |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
595 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
596 |
-<<<<<<< HEAD |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
597 |
-======= |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
598 |
static unsigned char *cackey_read_bertlv_tag(unsigned char *buffer, size_t *buffer_len_p, unsigned char tag, unsigned char *outbuffer, size_t *outbuffer_len_p) { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
599 |
unsigned char *buffer_p; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
600 |
size_t outbuffer_len, buffer_len; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
601 |
@@ -2106,7 +1906,6 @@ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
602 |
return(size); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
603 |
} |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
604 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
605 |
->>>>>>> trunk |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
606 |
/* |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
607 |
* SYNPOSIS |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
608 |
* ssize_t cackey_read_buffer(struct cackey_slot *slot, unsigned char *buffer, size_t count, unsigned char t_or_v, size_t initial_offset); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
609 |
@@ -2584,8 +2383,6 @@ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
610 |
return; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
611 |
} |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
612 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
613 |
-<<<<<<< HEAD |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
614 |
-======= |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
615 |
static struct cackey_pcsc_identity *cackey_copy_certs(struct cackey_pcsc_identity *dest, struct cackey_pcsc_identity *start, size_t count) { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
616 |
size_t idx; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
617 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
618 |
@@ -2622,7 +2419,6 @@ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
619 |
return(dest); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
620 |
} |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
621 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
622 |
->>>>>>> trunk |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
623 |
/* |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
624 |
* SYNPOSIS |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
625 |
* ... |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
626 |
@@ -2640,14 +2436,6 @@ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
627 |
static struct cackey_pcsc_identity *cackey_read_certs(struct cackey_slot *slot, struct cackey_pcsc_identity *certs, unsigned long *count) { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
628 |
struct cackey_pcsc_identity *curr_id; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
629 |
struct cackey_tlv_entity *ccc_tlv, *ccc_curr, *app_tlv, *app_curr; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
630 |
-<<<<<<< HEAD |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
631 |
- unsigned char ccc_aid[] = {GSCIS_AID_CCC}; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
632 |
- unsigned char curr_aid[7]; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
633 |
- unsigned long outidx = 0; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
634 |
- cackey_ret transaction_ret; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
635 |
- int certs_resizable; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
636 |
- int send_ret, select_ret; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
637 |
-======= |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
638 |
unsigned char ccc_aid[] = {GSCIS_AID_CCC}, piv_aid[] = {NISTSP800_73_3_PIV_AID}; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
639 |
unsigned char *piv_oid, piv_oid_pivauth[] = {NISTSP800_73_3_OID_PIVAUTH}, piv_oid_signature[] = {NISTSP800_73_3_OID_SIGNATURE}, piv_oid_keymgt[] = {NISTSP800_73_3_OID_KEYMGT}; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
640 |
unsigned char curr_aid[7]; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
641 |
@@ -2665,7 +2453,6 @@ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
642 |
int uncompress_ret; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
643 |
z_stream gzip_stream; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
644 |
#endif |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
645 |
->>>>>>> trunk |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
646 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
647 |
CACKEY_DEBUG_PRINTF("Called."); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
648 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
649 |
@@ -2683,8 +2470,6 @@ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
650 |
} |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
651 |
} |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
652 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
653 |
-<<<<<<< HEAD |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
654 |
-======= |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
655 |
if (!slot->slot_reset) { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
656 |
if (slot->cached_certs) { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
657 |
if (certs == NULL) { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
658 |
@@ -2708,7 +2493,6 @@ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
659 |
slot->cached_certs = NULL; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
660 |
} |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
661 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
662 |
->>>>>>> trunk |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
663 |
/* Begin a SmartCard transaction */ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
664 |
transaction_ret = cackey_begin_transaction(slot); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
665 |
if (transaction_ret != CACKEY_PCSC_S_OK) { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
666 |
@@ -2717,7 +2501,6 @@ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
667 |
return(NULL); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
668 |
} |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
669 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
670 |
-<<<<<<< HEAD |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
671 |
if (certs == NULL) { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
672 |
certs = malloc(sizeof(*certs) * 5); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
673 |
*count = 5; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
674 |
@@ -2729,68 +2512,6 @@ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
675 |
/* Select the CCC Applet */ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
676 |
send_ret = cackey_select_applet(slot, ccc_aid, sizeof(ccc_aid)); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
677 |
if (send_ret != CACKEY_PCSC_S_OK) { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
678 |
- CACKEY_DEBUG_PRINTF("Unable to select CCC Applet, returning in failure"); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
679 |
- |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
680 |
- /* Terminate SmartCard Transaction */ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
681 |
- cackey_end_transaction(slot); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
682 |
- |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
683 |
- return(NULL); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
684 |
- } |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
685 |
- |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
686 |
- /* Read all the applets from the CCC's TLV */ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
687 |
- ccc_tlv = cackey_read_tlv(slot); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
688 |
- |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
689 |
- /* Look for CARDURLs that coorespond to PKI applets */ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
690 |
- for (ccc_curr = ccc_tlv; ccc_curr; ccc_curr = ccc_curr->_next) { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
691 |
- CACKEY_DEBUG_PRINTF("Found tag: %s ... ", CACKEY_DEBUG_FUNC_TAG_TO_STR(ccc_curr->tag)); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
692 |
- |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
693 |
- if (ccc_curr->tag != GSCIS_TAG_CARDURL) { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
694 |
- CACKEY_DEBUG_PRINTF(" ... skipping it (we only care about CARDURLs)"); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
695 |
- |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
696 |
- continue; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
697 |
- } |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
698 |
- |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
699 |
- if ((ccc_curr->value_cardurl->apptype & CACKEY_TLV_APP_PKI) != CACKEY_TLV_APP_PKI) { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
700 |
- CACKEY_DEBUG_PRINTF(" ... skipping it (we only care about PKI applets, this applet supports: %s/%02x)", CACKEY_DEBUG_FUNC_APPTYPE_TO_STR(ccc_curr->value_cardurl->apptype), (unsigned int) ccc_curr->value_cardurl->apptype); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
701 |
- |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
702 |
- continue; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
703 |
- } |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
704 |
- |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
705 |
- CACKEY_DEBUG_PRINTBUF("RID:", ccc_curr->value_cardurl->rid, sizeof(ccc_curr->value_cardurl->rid)); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
706 |
- CACKEY_DEBUG_PRINTF("AppID = %s/%04lx", CACKEY_DEBUG_FUNC_OBJID_TO_STR(ccc_curr->value_cardurl->appid), (unsigned long) ccc_curr->value_cardurl->appid); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
707 |
- CACKEY_DEBUG_PRINTF("ObjectID = %s/%04lx", CACKEY_DEBUG_FUNC_OBJID_TO_STR(ccc_curr->value_cardurl->objectid), (unsigned long) ccc_curr->value_cardurl->objectid); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
708 |
- |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
709 |
- memcpy(curr_aid, ccc_curr->value_cardurl->rid, sizeof(ccc_curr->value_cardurl->rid)); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
710 |
- curr_aid[sizeof(curr_aid) - 2] = (ccc_curr->value_cardurl->appid >> 8) & 0xff; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
711 |
- curr_aid[sizeof(curr_aid) - 1] = ccc_curr->value_cardurl->appid & 0xff; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
712 |
- |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
713 |
- /* Select found applet ... */ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
714 |
- select_ret = cackey_select_applet(slot, curr_aid, sizeof(curr_aid)); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
715 |
- if (select_ret != CACKEY_PCSC_S_OK) { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
716 |
- CACKEY_DEBUG_PRINTF("Failed to select applet, skipping processing of this object"); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
717 |
- |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
718 |
- continue; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
719 |
- } |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
720 |
- |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
721 |
- /* ... and object (file) */ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
722 |
- select_ret = cackey_select_file(slot, ccc_curr->value_cardurl->objectid); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
723 |
- if (select_ret != CACKEY_PCSC_S_OK) { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
724 |
- CACKEY_DEBUG_PRINTF("Failed to select file, skipping processing of this object"); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
725 |
- |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
726 |
- continue; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
727 |
- } |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
728 |
- |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
729 |
- /* Process this file's TLV looking for certificates */ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
730 |
- app_tlv = cackey_read_tlv(slot); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
731 |
- |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
732 |
- for (app_curr = app_tlv; app_curr; app_curr = app_curr->_next) { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
733 |
- CACKEY_DEBUG_PRINTF("Found tag: %s", CACKEY_DEBUG_FUNC_TAG_TO_STR(app_curr->tag)); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
734 |
- if (app_curr->tag != GSCIS_TAG_CERTIFICATE) { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
735 |
- CACKEY_DEBUG_PRINTF(" ... skipping it (we only care about CERTIFICATEs)"); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
736 |
-======= |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
737 |
- /* Select the CCC Applet */ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
738 |
- send_ret = cackey_select_applet(slot, ccc_aid, sizeof(ccc_aid)); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
739 |
- if (send_ret != CACKEY_PCSC_S_OK) { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
740 |
/* Try PIV application */ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
741 |
send_ret = cackey_select_applet(slot, piv_aid, sizeof(piv_aid)); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
742 |
if (send_ret == CACKEY_PCSC_S_OK) { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
743 |
@@ -2803,22 +2524,10 @@ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
744 |
/* Terminate SmartCard Transaction */ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
745 |
cackey_end_transaction(slot); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
746 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
747 |
- if (certs == NULL) { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
748 |
- *count = 0; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
749 |
- } |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
750 |
- |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
751 |
return(NULL); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
752 |
} |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
753 |
} |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
754 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
755 |
- if (certs == NULL) { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
756 |
- certs = malloc(sizeof(*certs) * 5); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
757 |
- *count = 5; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
758 |
- certs_resizable = 1; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
759 |
- } else { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
760 |
- certs_resizable = 0; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
761 |
- } |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
762 |
- |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
763 |
if (piv) { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
764 |
for (idx = 0; idx < 3; idx++) { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
765 |
switch (idx) { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
766 |
@@ -2867,46 +2576,10 @@ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
767 |
curr_id->certificate = NULL; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
768 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
769 |
outidx--; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
770 |
->>>>>>> trunk |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
771 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
772 |
continue; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
773 |
} |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
774 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
775 |
-<<<<<<< HEAD |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
776 |
- curr_id = &certs[outidx]; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
777 |
- outidx++; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
778 |
- |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
779 |
- memcpy(curr_id->applet, curr_aid, sizeof(curr_id->applet)); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
780 |
- curr_id->file = ccc_curr->value_cardurl->objectid; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
781 |
- curr_id->keysize = -1; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
782 |
- |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
783 |
- CACKEY_DEBUG_PRINTF("Filling curr_id->applet (%p) with %lu bytes:", curr_id->applet, (unsigned long) sizeof(curr_id->applet)); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
784 |
- CACKEY_DEBUG_PRINTBUF("VAL:", curr_id->applet, sizeof(curr_id->applet)); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
785 |
- |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
786 |
- curr_id->certificate_len = app_curr->length; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
787 |
- |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
788 |
- curr_id->certificate = malloc(curr_id->certificate_len); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
789 |
- memcpy(curr_id->certificate, app_curr->value, curr_id->certificate_len); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
790 |
- |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
791 |
- if (outidx >= *count) { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
792 |
- if (certs_resizable) { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
793 |
- *count *= 2; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
794 |
- certs = realloc(certs, sizeof(*certs) * (*count)); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
795 |
- } else { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
796 |
- break; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
797 |
- } |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
798 |
- } |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
799 |
- } |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
800 |
- |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
801 |
- cackey_free_tlv(app_tlv); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
802 |
- |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
803 |
- if (outidx >= *count) { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
804 |
- break; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
805 |
- } |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
806 |
- } |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
807 |
- |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
808 |
- cackey_free_tlv(ccc_tlv); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
809 |
-======= |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
810 |
#ifdef HAVE_LIBZ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
811 |
if (curr_id->certificate_len > 4) { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
812 |
if (memcmp(curr_id->certificate, "\x1f\x8b\x08\x00", 4) == 0) { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
813 |
@@ -3048,21 +2721,13 @@ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
814 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
815 |
cackey_free_tlv(ccc_tlv); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
816 |
} |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
817 |
->>>>>>> trunk |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
818 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
819 |
*count = outidx; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
820 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
821 |
if (certs_resizable) { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
822 |
-<<<<<<< HEAD |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
823 |
- certs = realloc(certs, sizeof(*certs) * (*count)); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
824 |
- } |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
825 |
- |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
826 |
-======= |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
827 |
if (*count != 0) { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
828 |
certs = realloc(certs, sizeof(*certs) * (*count)); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
829 |
} else { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
830 |
- free(certs); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
831 |
- |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
832 |
certs = NULL; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
833 |
} |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
834 |
} |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
835 |
@@ -3070,7 +2735,6 @@ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
836 |
slot->cached_certs = cackey_copy_certs(NULL, certs, *count); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
837 |
slot->cached_certs_count = *count; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
838 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
839 |
->>>>>>> trunk |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
840 |
/* Terminate SmartCard Transaction */ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
841 |
cackey_end_transaction(slot); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
842 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
843 |
@@ -3092,24 +2756,15 @@ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
844 |
* |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
845 |
*/ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
846 |
static ssize_t cackey_signdecrypt(struct cackey_slot *slot, struct cackey_identity *identity, unsigned char *buf, size_t buflen, unsigned char *outbuf, size_t outbuflen, int padInput, int unpadOutput) { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
847 |
-<<<<<<< HEAD |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
848 |
- unsigned char *tmpbuf, *tmpbuf_s, *outbuf_s; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
849 |
- unsigned char bytes_to_send, p1; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
850 |
-======= |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
851 |
cackey_pcsc_id_type id_type; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
852 |
unsigned char dyn_auth_template[10], *dyn_auth_tmpbuf; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
853 |
unsigned char *tmpbuf, *tmpbuf_s, *outbuf_s, *outbuf_p; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
854 |
unsigned char bytes_to_send, p1, class; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
855 |
->>>>>>> trunk |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
856 |
unsigned char blocktype; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
857 |
cackey_ret send_ret; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
858 |
uint16_t respcode; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
859 |
ssize_t retval = 0, unpadoffset; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
860 |
-<<<<<<< HEAD |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
861 |
- size_t tmpbuflen, padlen, tmpoutbuflen; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
862 |
-======= |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
863 |
size_t tmpbuflen, padlen, tmpoutbuflen, outbuf_len; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
864 |
->>>>>>> trunk |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
865 |
int free_tmpbuf = 0; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
866 |
int le; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
867 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
868 |
@@ -3145,8 +2800,6 @@ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
869 |
return(-1); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
870 |
} |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
871 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
872 |
-<<<<<<< HEAD |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
873 |
-======= |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
874 |
id_type = identity->pcsc_identity->id_type; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
875 |
if (id_type == CACKEY_ID_TYPE_CERT_ONLY) { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
876 |
CACKEY_DEBUG_PRINTF("Error. identity->pcsc_identity is CACKEY_ID_TYPE_CERT_ONLY, which cannot be used for sign/decrypt"); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
877 |
@@ -3164,7 +2817,6 @@ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
878 |
return(-1); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
879 |
} |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
880 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
881 |
->>>>>>> trunk |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
882 |
/* Determine identity Key size */ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
883 |
if (identity->pcsc_identity->keysize < 0) { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
884 |
identity->pcsc_identity->keysize = x509_to_keysize(identity->pcsc_identity->certificate, identity->pcsc_identity->certificate_len); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
885 |
@@ -3174,11 +2826,7 @@ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
886 |
if (padInput) { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
887 |
if (identity->pcsc_identity->keysize > 0) { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
888 |
if (buflen != identity->pcsc_identity->keysize) { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
889 |
-<<<<<<< HEAD |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
890 |
if (buflen > (identity->pcsc_identity->keysize + 3)) { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
891 |
-======= |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
892 |
- if (buflen > (identity->pcsc_identity->keysize - 3)) { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
893 |
->>>>>>> trunk |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
894 |
CACKEY_DEBUG_PRINTF("Error. Message is too large to sign/decrypt"); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
895 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
896 |
return(-1); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
897 |
@@ -3190,11 +2838,6 @@ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
898 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
899 |
padlen = tmpbuflen - buflen - 3; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
900 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
901 |
-<<<<<<< HEAD |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
902 |
-======= |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
903 |
- CACKEY_DEBUG_PRINTF("Need to pad the buffer with %llu bytes (tmpbuflen = %llu, buflen = %llu)", (unsigned long long) padlen, (unsigned long long) tmpbuflen, (unsigned long long) buflen); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
904 |
- |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
905 |
->>>>>>> trunk |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
906 |
/* RSA PKCS#1 EMSA-PKCS1-v1_5 Padding */ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
907 |
tmpbuf[0] = 0x00; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
908 |
tmpbuf[1] = 0x01; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
909 |
@@ -3229,13 +2872,6 @@ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
910 |
cackey_begin_transaction(slot); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
911 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
912 |
/* Select correct applet */ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
913 |
-<<<<<<< HEAD |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
914 |
- CACKEY_DEBUG_PRINTF("Selecting applet found at %p ...", identity->pcsc_identity->applet); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
915 |
- cackey_select_applet(slot, identity->pcsc_identity->applet, sizeof(identity->pcsc_identity->applet)); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
916 |
- |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
917 |
- /* Select correct file */ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
918 |
- cackey_select_file(slot, identity->pcsc_identity->file); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
919 |
-======= |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
920 |
switch (id_type) { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
921 |
case CACKEY_ID_TYPE_CAC: |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
922 |
CACKEY_DEBUG_PRINTF("Selecting applet found at %p ...", identity->pcsc_identity->card.cac.applet); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
923 |
@@ -3272,29 +2908,10 @@ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
924 |
case CACKEY_ID_TYPE_CERT_ONLY: |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
925 |
break; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
926 |
} |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
927 |
->>>>>>> trunk |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
928 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
929 |
tmpbuf_s = tmpbuf; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
930 |
outbuf_s = outbuf; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
931 |
while (tmpbuflen) { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
932 |
-<<<<<<< HEAD |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
933 |
- if (tmpbuflen > 245) { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
934 |
- bytes_to_send = 245; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
935 |
- p1 = 0x80; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
936 |
- le = 0x00; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
937 |
- } else { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
938 |
- bytes_to_send = tmpbuflen; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
939 |
- p1 = 0x00; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
940 |
- le = 0x00; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
941 |
- } |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
942 |
- |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
943 |
- tmpoutbuflen = outbuflen; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
944 |
- |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
945 |
- send_ret = cackey_send_apdu(slot, GSCIS_CLASS_GLOBAL_PLATFORM, GSCIS_INSTR_SIGNDECRYPT, p1, 0x00, bytes_to_send, tmpbuf, le, &respcode, outbuf, &tmpoutbuflen); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
946 |
- if (send_ret != CACKEY_PCSC_S_OK) { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
947 |
- CACKEY_DEBUG_PRINTF("ADPU Sending Failed -- returning in error."); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
948 |
- |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
949 |
-======= |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
950 |
tmpoutbuflen = outbuflen; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
951 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
952 |
if (tmpbuflen > CACKEY_APDU_MTU) { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
953 |
@@ -3332,7 +2949,6 @@ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
954 |
} |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
955 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
956 |
if (send_ret != CACKEY_PCSC_S_OK) { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
957 |
->>>>>>> trunk |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
958 |
if (free_tmpbuf) { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
959 |
if (tmpbuf_s) { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
960 |
free(tmpbuf_s); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
961 |
@@ -3342,12 +2958,6 @@ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
962 |
/* End transaction */ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
963 |
cackey_end_transaction(slot); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
964 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
965 |
-<<<<<<< HEAD |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
966 |
- if (respcode == 0x6982) { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
967 |
- CACKEY_DEBUG_PRINTF("Security status not satisified. Returning NEEDLOGIN"); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
968 |
- |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
969 |
- cackey_mark_slot_reset(slot); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
970 |
-======= |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
971 |
if (send_ret == CACKEY_PCSC_E_RETRY) { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
972 |
CACKEY_DEBUG_PRINTF("ADPU Sending Failed -- retrying."); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
973 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
974 |
@@ -3365,7 +2975,6 @@ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
975 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
976 |
cackey_mark_slot_reset(slot); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
977 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
978 |
->>>>>>> trunk |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
979 |
slot->token_flags = CKF_LOGIN_REQUIRED; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
980 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
981 |
return(CACKEY_PCSC_E_NEEDLOGIN); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
982 |
@@ -3375,23 +2984,11 @@ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
983 |
CACKEY_DEBUG_PRINTF("Token absent. Returning TOKENABSENT"); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
984 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
985 |
cackey_mark_slot_reset(slot); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
986 |
-<<<<<<< HEAD |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
987 |
- slot->token_flags = CKF_LOGIN_REQUIRED; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
988 |
-======= |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
989 |
->>>>>>> trunk |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
990 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
991 |
return(CACKEY_PCSC_E_TOKENABSENT); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
992 |
} |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
993 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
994 |
-<<<<<<< HEAD |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
995 |
return(-1); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
996 |
-======= |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
997 |
- CACKEY_DEBUG_PRINTF("Something went wrong during signing, resetting the slot and hoping for the best."); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
998 |
- |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
999 |
- cackey_mark_slot_reset(slot); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1000 |
- |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1001 |
- return(CACKEY_PCSC_E_GENERIC); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1002 |
->>>>>>> trunk |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1003 |
} |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1004 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1005 |
tmpbuf += bytes_to_send; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1006 |
@@ -3423,8 +3020,6 @@ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1007 |
# endif |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1008 |
#endif |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1009 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1010 |
-<<<<<<< HEAD |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1011 |
-======= |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1012 |
/* We must remove the "7C" tag to get to the signature */ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1013 |
switch (id_type) { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1014 |
case CACKEY_ID_TYPE_PIV: |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1015 |
@@ -3454,7 +3049,6 @@ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1016 |
break; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1017 |
} |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1018 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1019 |
->>>>>>> trunk |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1020 |
/* Unpad reply */ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1021 |
if (unpadOutput) { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1022 |
if (retval < 3) { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1023 |
@@ -3549,90 +3143,20 @@ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1024 |
* ... |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1025 |
* |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1026 |
*/ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1027 |
-<<<<<<< HEAD |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1028 |
-static cackey_ret cackey_login(struct cackey_slot *slot, unsigned char *pin, unsigned long pin_len, int *tries_remaining_p) { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1029 |
- unsigned char cac_pin[8] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1030 |
- uint16_t response_code; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1031 |
- int tries_remaining; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1032 |
- int send_ret; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1033 |
- |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1034 |
- /* Indicate that we do not know about how many tries are remaining */ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1035 |
- if (tries_remaining_p) { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1036 |
- *tries_remaining_p = -1; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1037 |
- } |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1038 |
- |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1039 |
- /* Apparently, CAC PINs are *EXACTLY* 8 bytes long -- pad with 0xFF if too short */ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1040 |
- if (pin_len >= 8) { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1041 |
- memcpy(cac_pin, pin, 8); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1042 |
- } else { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1043 |
- memcpy(cac_pin, pin, pin_len); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1044 |
- } |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1045 |
- |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1046 |
- /* Issue PIN Verify */ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1047 |
- send_ret = cackey_send_apdu(slot, GSCIS_CLASS_ISO7816, GSCIS_INSTR_VERIFY, 0x00, 0x00, sizeof(cac_pin), cac_pin, 0x00, &response_code, NULL, NULL); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1048 |
- if (send_ret != CACKEY_PCSC_S_OK) { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1049 |
- if ((response_code & 0x63C0) == 0x63C0) { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1050 |
- tries_remaining = (response_code & 0xF); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1051 |
- |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1052 |
- CACKEY_DEBUG_PRINTF("PIN Verification failed, %i tries remaining", tries_remaining); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1053 |
- |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1054 |
- if (tries_remaining_p) { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1055 |
- *tries_remaining_p = tries_remaining; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1056 |
- } |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1057 |
- |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1058 |
- return(CACKEY_PCSC_E_BADPIN); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1059 |
- } |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1060 |
- |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1061 |
- if (response_code == 0x6983) { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1062 |
- CACKEY_DEBUG_PRINTF("PIN Verification failed, device is locked"); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1063 |
- |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1064 |
- return(CACKEY_PCSC_E_LOCKED); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1065 |
- } |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1066 |
- |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1067 |
- return(CACKEY_PCSC_E_GENERIC); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1068 |
- } |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1069 |
- |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1070 |
- CACKEY_DEBUG_PRINTF("PIN Verification succeeded"); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1071 |
- |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1072 |
- return(CACKEY_PCSC_S_OK); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1073 |
-} |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1074 |
- |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1075 |
-/* |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1076 |
- * SYNPOSIS |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1077 |
- * ... |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1078 |
- * |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1079 |
- * ARGUMENTS |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1080 |
- * ... |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1081 |
- * |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1082 |
- * RETURN VALUE |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1083 |
- * ... |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1084 |
- * |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1085 |
- * NOTES |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1086 |
- * ... |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1087 |
- * |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1088 |
- */ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1089 |
-static cackey_ret cackey_token_present(struct cackey_slot *slot) { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1090 |
- cackey_ret pcsc_connect_ret; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1091 |
- DWORD reader_len, state, protocol, atr_len; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1092 |
-======= |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1093 |
static cackey_ret cackey_token_present(struct cackey_slot *slot) { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1094 |
cackey_ret pcsc_connect_ret; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1095 |
DWORD reader_len = 0, state = 0, protocol = 0, atr_len; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1096 |
->>>>>>> trunk |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1097 |
BYTE atr[MAX_ATR_SIZE]; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1098 |
LONG status_ret, scard_reconn_ret; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1099 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1100 |
CACKEY_DEBUG_PRINTF("Called."); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1101 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1102 |
-<<<<<<< HEAD |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1103 |
-======= |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1104 |
if (slot->internal) { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1105 |
CACKEY_DEBUG_PRINTF("Returning token present (internal token)"); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1106 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1107 |
return(CACKEY_PCSC_S_TOKENPRESENT); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1108 |
} |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1109 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1110 |
->>>>>>> trunk |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1111 |
pcsc_connect_ret = cackey_connect_card(slot); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1112 |
if (pcsc_connect_ret != CACKEY_PCSC_S_OK) { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1113 |
CACKEY_DEBUG_PRINTF("Unable to connect to card, returning token absent"); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1114 |
@@ -3640,11 +3164,8 @@ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1115 |
return(CACKEY_PCSC_E_TOKENABSENT); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1116 |
} |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1117 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1118 |
-<<<<<<< HEAD |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1119 |
-======= |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1120 |
CACKEY_DEBUG_PRINTF("Calling SCardStatus() to determine card status"); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1121 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1122 |
->>>>>>> trunk |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1123 |
atr_len = sizeof(atr); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1124 |
status_ret = SCardStatus(slot->pcsc_card, NULL, &reader_len, &state, &protocol, atr, &atr_len); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1125 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1126 |
@@ -3659,11 +3180,8 @@ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1127 |
return(CACKEY_PCSC_E_TOKENABSENT); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1128 |
} |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1129 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1130 |
-<<<<<<< HEAD |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1131 |
-======= |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1132 |
CACKEY_DEBUG_PRINTF("Calling SCardStatus() again"); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1133 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1134 |
->>>>>>> trunk |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1135 |
atr_len = sizeof(atr); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1136 |
status_ret = SCardStatus(slot->pcsc_card, NULL, &reader_len, &state, &protocol, atr, &atr_len); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1137 |
} |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1138 |
@@ -3674,16 +3192,8 @@ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1139 |
if (status_ret == SCARD_W_RESET_CARD) { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1140 |
CACKEY_DEBUG_PRINTF("Reset required, please hold..."); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1141 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1142 |
-<<<<<<< HEAD |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1143 |
- scard_reconn_ret = cackey_reconnect_card(slot, SCARD_PROTOCOL_T0 | SCARD_PROTOCOL_T1, &protocol); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1144 |
- if (scard_reconn_ret == SCARD_S_SUCCESS) { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1145 |
- /* Update protocol */ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1146 |
- slot->protocol = protocol; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1147 |
- |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1148 |
-======= |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1149 |
scard_reconn_ret = cackey_reconnect_card(slot, SCARD_PROTOCOL_T0 | SCARD_PROTOCOL_T1); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1150 |
if (scard_reconn_ret == SCARD_S_SUCCESS) { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1151 |
->>>>>>> trunk |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1152 |
/* Re-establish transaction, if it was present */ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1153 |
if (slot->transaction_depth > 0) { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1154 |
slot->transaction_depth--; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1155 |
@@ -3735,11 +3245,6 @@ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1156 |
* ... |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1157 |
* |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1158 |
*/ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1159 |
-<<<<<<< HEAD |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1160 |
-static ssize_t cackey_pcsc_identity_to_label(struct cackey_pcsc_identity *identity, unsigned char *label_buf, unsigned long label_buf_len) { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1161 |
- unsigned long certificate_len; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1162 |
- char *label_asn1; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1163 |
-======= |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1164 |
static cackey_ret cackey_set_pin(struct cackey_slot *slot, unsigned char *old_pin, unsigned long old_pin_len, unsigned char *pin, unsigned long pin_len) { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1165 |
struct cackey_pcsc_identity *pcsc_identities; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1166 |
unsigned char cac_pin[8] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1167 |
@@ -3821,9 +3326,6 @@ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1168 |
CACKEY_DEBUG_PRINTF("PIN Change succeeded"); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1169 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1170 |
return(CACKEY_PCSC_S_OK); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1171 |
- |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1172 |
- /* Disable a warning, since this is only used in debug mode */ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1173 |
- tries_remaining = tries_remaining; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1174 |
} |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1175 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1176 |
/* |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1177 |
@@ -3912,9 +3414,9 @@ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1178 |
} |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1179 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1180 |
if (response_code == 0x6d00) { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1181 |
- if (retries > 0) { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1182 |
+ if (have_piv == 1 && retries > 0) { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1183 |
CACKEY_DEBUG_PRINTF("Got ISO 7816 Response \"6D 00\" in response to a VERIFY request."); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1184 |
- CACKEY_DEBUG_PRINTF("We did not expect this because it is not mentioned in NIST SP 800-73-3 Part 2 Section 3.2.1 or GSC-IS v2.1"); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1185 |
+ CACKEY_DEBUG_PRINTF("We did not expect this because it is not mentioned in NIST SP 800-73-3 Part 2 Section 3.2.1"); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1186 |
CACKEY_DEBUG_PRINTF("We are going to try to reset the card and select the applet again."); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1187 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1188 |
cackey_mark_slot_reset(slot); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1189 |
@@ -3965,7 +3467,6 @@ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1190 |
static ssize_t cackey_pcsc_identity_to_label(struct cackey_pcsc_identity *identity, unsigned char *label_buf, unsigned long label_buf_len) { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1191 |
unsigned long certificate_len; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1192 |
void *label_asn1; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1193 |
->>>>>>> trunk |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1194 |
void *certificate; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1195 |
int x509_read_ret; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1196 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1197 |
@@ -4241,15 +3742,6 @@ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1198 |
case CKA_LABEL: |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1199 |
CACKEY_DEBUG_PRINTF("Requesting attribute CKA_LABEL (0x%08lx) ...", (unsigned long) curr_attr_type); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1200 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1201 |
-<<<<<<< HEAD |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1202 |
- /* XXX: Determine name */ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1203 |
- ulValueLen = snprintf((char *) ucTmpBuf, sizeof(ucTmpBuf), "Identity #%lu", (unsigned long) identity_num); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1204 |
- pValue = ucTmpBuf; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1205 |
- |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1206 |
- if (ulValueLen >= sizeof(ucTmpBuf)) { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1207 |
- ulValueLen = 0; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1208 |
- pValue = NULL; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1209 |
-======= |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1210 |
if (identity->id_type == CACKEY_ID_TYPE_PIV) { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1211 |
pValue = identity->card.piv.label; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1212 |
ulValueLen = strlen(pValue); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1213 |
@@ -4261,7 +3753,6 @@ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1214 |
ulValueLen = 0; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1215 |
pValue = NULL; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1216 |
} |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1217 |
->>>>>>> trunk |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1218 |
} |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1219 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1220 |
CACKEY_DEBUG_PRINTF(" ... returning (%p/%lu)", pValue, (unsigned long) ulValueLen); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1221 |
@@ -4650,11 +4141,7 @@ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1222 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1223 |
*pulCount = numattrs; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1224 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1225 |
-<<<<<<< HEAD |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1226 |
- CACKEY_DEBUG_PRINTF("Returning %lu objects (%p).", numattrs, retval); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1227 |
-======= |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1228 |
CACKEY_DEBUG_PRINTF("Returning %lu objects (%p).", numattrs, (void *) retval); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1229 |
->>>>>>> trunk |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1230 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1231 |
return(retval); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1232 |
} |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1233 |
@@ -4688,8 +4175,6 @@ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1234 |
free(identities); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1235 |
} |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1236 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1237 |
-<<<<<<< HEAD |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1238 |
-======= |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1239 |
static unsigned long cackey_read_dod_identities(struct cackey_identity *identities, unsigned long num_dod_certs) { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1240 |
unsigned long cert_idx, id_idx = 0; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1241 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1242 |
@@ -4714,36 +4199,10 @@ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1243 |
return(id_idx); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1244 |
} |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1245 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1246 |
->>>>>>> trunk |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1247 |
static struct cackey_identity *cackey_read_identities(struct cackey_slot *slot, unsigned long *ids_found) { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1248 |
struct cackey_pcsc_identity *pcsc_identities; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1249 |
struct cackey_identity *identities; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1250 |
unsigned long num_ids, id_idx, curr_id_type; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1251 |
-<<<<<<< HEAD |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1252 |
- unsigned long num_certs, num_extra_certs, cert_idx; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1253 |
- int include_extra_certs = 1; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1254 |
- |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1255 |
- CACKEY_DEBUG_PRINTF("Called."); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1256 |
- |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1257 |
- if (getenv("CACKEY_NO_EXTRA_CERTS") != NULL) { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1258 |
- CACKEY_DEBUG_PRINTF("Asked not to include extra (DoD) certificates"); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1259 |
- |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1260 |
- include_extra_certs = 0; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1261 |
- } |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1262 |
- |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1263 |
- if (include_extra_certs) { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1264 |
- num_extra_certs = sizeof(extra_certs) / sizeof(extra_certs[0]); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1265 |
- |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1266 |
- CACKEY_DEBUG_PRINTF("Including %i DoD Certificates as objects on this token", num_extra_certs); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1267 |
- } else { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1268 |
- num_extra_certs = 0; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1269 |
- } |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1270 |
- |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1271 |
- if (ids_found == NULL) { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1272 |
- CACKEY_DEBUG_PRINTF("Error. ids_found is NULL"); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1273 |
- |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1274 |
- return(NULL); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1275 |
-======= |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1276 |
unsigned long num_certs, num_dod_certs, cert_idx; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1277 |
int include_extra_certs = 0, include_dod_certs; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1278 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1279 |
@@ -4801,21 +4260,16 @@ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1280 |
*ids_found = num_ids; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1281 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1282 |
return(identities); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1283 |
->>>>>>> trunk |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1284 |
} |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1285 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1286 |
pcsc_identities = cackey_read_certs(slot, NULL, &num_certs); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1287 |
if (pcsc_identities != NULL) { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1288 |
/* Convert number of Certs to number of objects */ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1289 |
num_ids = (CKO_PRIVATE_KEY - CKO_CERTIFICATE + 1) * num_certs; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1290 |
-<<<<<<< HEAD |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1291 |
- num_ids += num_extra_certs * 3; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1292 |
-======= |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1293 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1294 |
if (include_extra_certs) { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1295 |
num_ids += cackey_read_dod_identities(NULL, num_dod_certs); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1296 |
} |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1297 |
->>>>>>> trunk |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1298 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1299 |
identities = malloc(num_ids * sizeof(*identities)); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1300 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1301 |
@@ -4835,29 +4289,6 @@ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1302 |
} |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1303 |
} |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1304 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1305 |
-<<<<<<< HEAD |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1306 |
- cackey_free_certs(pcsc_identities, num_certs, 1); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1307 |
- |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1308 |
- /* Add DoD Certificates and Netscape Trust Objects */ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1309 |
- for (cert_idx = 0; cert_idx < num_extra_certs; cert_idx++) { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1310 |
- identities[id_idx].pcsc_identity = NULL; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1311 |
- identities[id_idx].attributes = cackey_get_attributes(CKO_CERTIFICATE, &extra_certs[cert_idx], 0xf000 | cert_idx, &identities[id_idx].attributes_count); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1312 |
- id_idx++; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1313 |
- |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1314 |
- identities[id_idx].pcsc_identity = NULL; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1315 |
- identities[id_idx].attributes = cackey_get_attributes(CKO_PUBLIC_KEY, &extra_certs[cert_idx], 0xf000 | cert_idx, &identities[id_idx].attributes_count); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1316 |
- id_idx++; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1317 |
- |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1318 |
- identities[id_idx].pcsc_identity = NULL; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1319 |
- identities[id_idx].attributes = cackey_get_attributes(CKO_NETSCAPE_TRUST, &extra_certs[cert_idx], 0xf000 | cert_idx, &identities[id_idx].attributes_count); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1320 |
- id_idx++; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1321 |
- } |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1322 |
- |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1323 |
- *ids_found = num_ids; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1324 |
- return(identities); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1325 |
- } |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1326 |
- |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1327 |
-======= |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1328 |
if (include_extra_certs) { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1329 |
CACKEY_DEBUG_PRINTF("Including US Government Certificates on hardware slot"); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1330 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1331 |
@@ -4872,17 +4303,10 @@ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1332 |
} |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1333 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1334 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1335 |
->>>>>>> trunk |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1336 |
*ids_found = 0; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1337 |
return(NULL); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1338 |
} |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1339 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1340 |
-<<<<<<< HEAD |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1341 |
-CK_DEFINE_FUNCTION(CK_RV, C_Initialize)(CK_VOID_PTR pInitArgs) { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1342 |
- CK_C_INITIALIZE_ARGS CK_PTR args; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1343 |
- uint32_t idx; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1344 |
- int mutex_init_ret; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1345 |
-======= |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1346 |
static cackey_ret cackey_get_pin(char *pinbuf) { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1347 |
FILE *pinfd; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1348 |
char *fgets_ret; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1349 |
@@ -4941,7 +4365,6 @@ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1350 |
uint32_t idx, highest_slot; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1351 |
int mutex_init_ret; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1352 |
int include_dod_certs; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1353 |
->>>>>>> trunk |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1354 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1355 |
CACKEY_DEBUG_PRINTF("Called."); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1356 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1357 |
@@ -4982,8 +4405,6 @@ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1358 |
cackey_slots[idx].slot_reset = 0; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1359 |
cackey_slots[idx].token_flags = 0; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1360 |
cackey_slots[idx].label = NULL; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1361 |
-<<<<<<< HEAD |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1362 |
-======= |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1363 |
cackey_slots[idx].internal = 0; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1364 |
} |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1365 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1366 |
@@ -5013,7 +4434,6 @@ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1367 |
cackey_slots[highest_slot].label = (unsigned char *) "US Government Certificates"; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1368 |
cackey_slots[highest_slot].pcsc_reader = "CACKey"; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1369 |
cackey_slots[highest_slot].token_flags = 0; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1370 |
->>>>>>> trunk |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1371 |
} |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1372 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1373 |
cackey_initialized = 1; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1374 |
@@ -5030,56 +4450,25 @@ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1375 |
cackey_biglock_init = 1; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1376 |
} |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1377 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1378 |
-<<<<<<< HEAD |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1379 |
-======= |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1380 |
/* Define a command to prompt user for a PIN */ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1381 |
#ifdef CACKEY_PIN_COMMAND_DEFAULT |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1382 |
- cackey_pin_command = strdup(CACKEY_MACRO_DEFAULT_XSTR(CACKEY_PIN_COMMAND_DEFAULT)); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1383 |
+ cackey_pin_command = CACKEY_PIN_COMMAND_DEFAULT_XSTR(CACKEY_PIN_COMMAND_DEFAULT); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1384 |
#endif |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1385 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1386 |
#ifdef CACKEY_PIN_COMMAND_XONLY_DEFAULT |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1387 |
if (getenv("DISPLAY") != NULL) { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1388 |
- cackey_pin_command = strdup(CACKEY_MACRO_DEFAULT_XSTR(CACKEY_PIN_COMMAND_XONLY_DEFAULT)); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1389 |
+ cackey_pin_command = CACKEY_PIN_COMMAND_DEFAULT_XSTR(CACKEY_PIN_COMMAND_XONLY_DEFAULT); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1390 |
} |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1391 |
#endif |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1392 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1393 |
if (getenv("CACKEY_PIN_COMMAND") != NULL) { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1394 |
- cackey_pin_command = strdup(getenv("CACKEY_PIN_COMMAND")); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1395 |
+ cackey_pin_command = getenv("CACKEY_PIN_COMMAND"); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1396 |
} |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1397 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1398 |
if (getenv("CACKEY_PIN_COMMAND_XONLY") != NULL && getenv("DISPLAY") != NULL) { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1399 |
- cackey_pin_command = strdup(getenv("CACKEY_PIN_COMMAND_XONLY")); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1400 |
+ cackey_pin_command = getenv("CACKEY_PIN_COMMAND_XONLY"); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1401 |
} |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1402 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1403 |
-#ifdef CACKEY_READERS_INCLUDE_ONLY_DEFAULT |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1404 |
- cackey_readers_include_only = strdup(CACKEY_MACRO_DEFAULT_XSTR(CACKEY_READERS_INCLUDE_ONLY_DEFAULT)); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1405 |
-#endif |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1406 |
- |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1407 |
-#ifdef CACKEY_READERS_EXCLUDE_DEFAULT |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1408 |
- cackey_readers_exclude = strdup(CACKEY_MACRO_DEFAULT_XSTR(CACKEY_READERS_EXCLUDE_DEFAULT)); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1409 |
-#endif |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1410 |
- |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1411 |
- if (getenv("CACKEY_READERS_INCLUDE_ONLY") != NULL) { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1412 |
- cackey_readers_include_only = strdup(getenv("CACKEY_READERS_INCLUDE_ONLY")); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1413 |
- |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1414 |
- if (cackey_readers_include_only[0] == '\0') { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1415 |
- free(cackey_readers_include_only); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1416 |
- |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1417 |
- cackey_readers_include_only = NULL; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1418 |
- } |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1419 |
- } |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1420 |
- |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1421 |
- if (getenv("CACKEY_READERS_EXCLUDE") != NULL) { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1422 |
- cackey_readers_exclude = strdup(getenv("CACKEY_READERS_EXCLUDE")); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1423 |
- |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1424 |
- if (cackey_readers_exclude[0] == '\0') { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1425 |
- free(cackey_readers_exclude); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1426 |
- |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1427 |
- cackey_readers_exclude = NULL; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1428 |
- } |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1429 |
- } |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1430 |
- |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1431 |
->>>>>>> trunk |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1432 |
CACKEY_DEBUG_PRINTF("Returning CKR_OK (%i)", CKR_OK); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1433 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1434 |
return(CKR_OK); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1435 |
@@ -5108,17 +4497,6 @@ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1436 |
} |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1437 |
} |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1438 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1439 |
-<<<<<<< HEAD |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1440 |
- cackey_slots_disconnect_all(); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1441 |
- |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1442 |
- for (idx = 0; idx < (sizeof(cackey_slots) / sizeof(cackey_slots[0])); idx++) { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1443 |
- if (cackey_slots[idx].pcsc_reader) { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1444 |
- free(cackey_slots[idx].pcsc_reader); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1445 |
- } |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1446 |
- } |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1447 |
- |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1448 |
- cackey_pcsc_disconnect(); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1449 |
-======= |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1450 |
cackey_slots_disconnect_all(); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1451 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1452 |
for (idx = 0; idx < (sizeof(cackey_slots) / sizeof(cackey_slots[0])); idx++) { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1453 |
@@ -5139,25 +4517,6 @@ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1454 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1455 |
cackey_pcsc_disconnect(); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1456 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1457 |
- if (cackey_pin_command != NULL) { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1458 |
- free(cackey_pin_command); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1459 |
- |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1460 |
- cackey_pin_command = NULL; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1461 |
- } |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1462 |
- |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1463 |
- if (cackey_readers_include_only != NULL) { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1464 |
- free(cackey_readers_include_only); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1465 |
- |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1466 |
- cackey_readers_include_only = NULL; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1467 |
- } |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1468 |
- |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1469 |
- if (cackey_readers_exclude != NULL) { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1470 |
- free(cackey_readers_exclude); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1471 |
- |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1472 |
- cackey_readers_exclude = NULL; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1473 |
- } |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1474 |
->>>>>>> trunk |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1475 |
- |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1476 |
cackey_initialized = 0; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1477 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1478 |
CACKEY_DEBUG_PRINTF("Returning CKR_OK (%i)", CKR_OK); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1479 |
@@ -5206,27 +4565,15 @@ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1480 |
* Process list of readers, and create mapping between reader name and slot ID |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1481 |
*/ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1482 |
CK_DEFINE_FUNCTION(CK_RV, C_GetSlotList)(CK_BBOOL tokenPresent, CK_SLOT_ID_PTR pSlotList, CK_ULONG_PTR pulCount) { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1483 |
-<<<<<<< HEAD |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1484 |
- int mutex_retval; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1485 |
- int pcsc_connect_ret; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1486 |
- CK_ULONG count, slot_count = 0, currslot; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1487 |
- char *pcsc_readers, *pcsc_readers_s, *pcsc_readers_e; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1488 |
- DWORD pcsc_readers_len; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1489 |
- LONG scard_listreaders_ret; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1490 |
- size_t curr_reader_len; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1491 |
-======= |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1492 |
static int first_call = 1; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1493 |
int mutex_retval; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1494 |
int pcsc_connect_ret; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1495 |
CK_ULONG count, slot_count = 0, currslot, slot_idx; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1496 |
char *pcsc_readers, *pcsc_readers_s, *pcsc_readers_e; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1497 |
- char *reader_check_pattern; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1498 |
DWORD pcsc_readers_len; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1499 |
LONG scard_listreaders_ret; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1500 |
size_t curr_reader_len; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1501 |
int slot_reset; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1502 |
- int include_reader; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1503 |
->>>>>>> trunk |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1504 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1505 |
CACKEY_DEBUG_PRINTF("Called."); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1506 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1507 |
@@ -5250,28 +4597,6 @@ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1508 |
} |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1509 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1510 |
/* Clear list of slots */ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1511 |
-<<<<<<< HEAD |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1512 |
- if (pSlotList) { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1513 |
- CACKEY_DEBUG_PRINTF("Purging all slot information."); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1514 |
- |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1515 |
- /* Only update the list of slots if we are actually being supply the slot information */ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1516 |
- cackey_slots_disconnect_all(); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1517 |
- |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1518 |
- for (currslot = 0; currslot < (sizeof(cackey_slots) / sizeof(cackey_slots[0])); currslot++) { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1519 |
- if (cackey_slots[currslot].pcsc_reader) { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1520 |
- free(cackey_slots[currslot].pcsc_reader); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1521 |
- |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1522 |
- cackey_slots[currslot].pcsc_reader = NULL; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1523 |
- } |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1524 |
- |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1525 |
- if (cackey_slots[currslot].label) { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1526 |
- free(cackey_slots[currslot].label); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1527 |
- |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1528 |
- cackey_slots[currslot].label = NULL; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1529 |
- } |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1530 |
- |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1531 |
- cackey_slots[currslot].active = 0; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1532 |
-======= |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1533 |
slot_reset = 0; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1534 |
if (pSlotList) { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1535 |
if (first_call) { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1536 |
@@ -5324,16 +4649,12 @@ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1537 |
} |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1538 |
} else { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1539 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1540 |
->>>>>>> trunk |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1541 |
} |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1542 |
} |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1543 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1544 |
/* Determine list of readers */ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1545 |
pcsc_connect_ret = cackey_pcsc_connect(); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1546 |
-<<<<<<< HEAD |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1547 |
-======= |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1548 |
/* XXX: CAN HANG HERE ! */ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1549 |
->>>>>>> trunk |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1550 |
if (pcsc_connect_ret != CACKEY_PCSC_S_OK) { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1551 |
CACKEY_DEBUG_PRINTF("Connection to PC/SC failed, assuming no slots"); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1552 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1553 |
@@ -5364,9 +4685,6 @@ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1554 |
/* Start with Slot ID 1, to avoid a bug in GDM on RHEL */ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1555 |
/* Bug 594911: https://bugzilla.redhat.com/show_bug.cgi?id=594911 */ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1556 |
currslot = 1; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1557 |
-<<<<<<< HEAD |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1558 |
- while (pcsc_readers < pcsc_readers_e) { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1559 |
-======= |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1560 |
slot_count = 0; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1561 |
while (pcsc_readers < pcsc_readers_e) { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1562 |
/* Find next available slot */ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1563 |
@@ -5376,7 +4694,6 @@ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1564 |
} |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1565 |
} |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1566 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1567 |
->>>>>>> trunk |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1568 |
curr_reader_len = strlen(pcsc_readers); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1569 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1570 |
if ((pcsc_readers + curr_reader_len) > pcsc_readers_e) { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1571 |
@@ -5393,55 +4710,8 @@ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1572 |
break; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1573 |
} |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1574 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1575 |
-<<<<<<< HEAD |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1576 |
- CACKEY_DEBUG_PRINTF("Found reader: %s", pcsc_readers); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1577 |
- |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1578 |
- /* Only update the list of slots if we are actually being asked supply the slot information */ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1579 |
- if (pSlotList) { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1580 |
- cackey_slots[currslot].active = 1; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1581 |
- cackey_slots[currslot].pcsc_reader = strdup(pcsc_readers); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1582 |
- cackey_slots[currslot].pcsc_card_connected = 0; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1583 |
- cackey_slots[currslot].transaction_depth = 0; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1584 |
- cackey_slots[currslot].transaction_need_hw_lock = 0; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1585 |
- cackey_slots[currslot].slot_reset = 1; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1586 |
- cackey_slots[currslot].token_flags = CKF_LOGIN_REQUIRED; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1587 |
- cackey_slots[currslot].label = NULL; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1588 |
- |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1589 |
- cackey_mark_slot_reset(&cackey_slots[currslot]); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1590 |
-======= |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1591 |
CACKEY_DEBUG_PRINTF("Found reader: %s (currslot = %lu)", pcsc_readers, (unsigned long) currslot); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1592 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1593 |
- if (cackey_readers_include_only != NULL) { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1594 |
- CACKEY_DEBUG_PRINTF("Asked to include only readers matching: %s", cackey_readers_include_only); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1595 |
- |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1596 |
- include_reader = 0; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1597 |
- reader_check_pattern = cackey_readers_include_only; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1598 |
- } else if (cackey_readers_exclude != NULL) { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1599 |
- CACKEY_DEBUG_PRINTF("Asked to exclude readers matching: %s", cackey_readers_exclude); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1600 |
- |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1601 |
- include_reader = 1; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1602 |
- reader_check_pattern = cackey_readers_exclude; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1603 |
- } else { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1604 |
- include_reader = 1; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1605 |
- reader_check_pattern = NULL; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1606 |
- } |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1607 |
- |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1608 |
- if (reader_check_pattern != NULL) { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1609 |
- if (strstr(pcsc_readers, reader_check_pattern) != NULL) { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1610 |
- CACKEY_DEBUG_PRINTF("This reader matched the pattern."); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1611 |
- |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1612 |
- include_reader = !include_reader; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1613 |
- } |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1614 |
- } |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1615 |
- |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1616 |
- if (include_reader != 1) { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1617 |
- CACKEY_DEBUG_PRINTF("Skipping this reader."); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1618 |
- |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1619 |
- pcsc_readers += curr_reader_len + 1; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1620 |
- |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1621 |
- continue; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1622 |
- } |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1623 |
- |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1624 |
/* Only update the list of slots if we are actually being asked supply the slot information */ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1625 |
if (pSlotList) { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1626 |
if (slot_reset) { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1627 |
@@ -5467,28 +4737,18 @@ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1628 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1629 |
slot_count++; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1630 |
} |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1631 |
->>>>>>> trunk |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1632 |
} |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1633 |
currslot++; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1634 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1635 |
pcsc_readers += curr_reader_len + 1; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1636 |
} |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1637 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1638 |
-<<<<<<< HEAD |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1639 |
- /* Start with Slot ID 1, to avoid a bug in GDM on RHEL */ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1640 |
- /* Bug 594911: https://bugzilla.redhat.com/show_bug.cgi?id=594911 */ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1641 |
- if (currslot > 1) { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1642 |
- /* Start with Slot ID 1, to avoid a bug in GDM on RHEL */ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1643 |
- /* Bug 594911: https://bugzilla.redhat.com/show_bug.cgi?id=594911 */ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1644 |
- slot_count = currslot - 1; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1645 |
-======= |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1646 |
for (currslot = 0; currslot < (sizeof(cackey_slots) / sizeof(cackey_slots[0])); currslot++) { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1647 |
if (cackey_slots[currslot].active) { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1648 |
CACKEY_DEBUG_PRINTF("Found active slot %lu, reader = %s", (unsigned long) currslot, cackey_slots[currslot].pcsc_reader); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1649 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1650 |
slot_count++; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1651 |
} |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1652 |
->>>>>>> trunk |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1653 |
} |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1654 |
} else { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1655 |
CACKEY_DEBUG_PRINTF("Second call to SCardListReaders failed, return %s/%li", CACKEY_DEBUG_FUNC_SCARDERR_TO_STR(scard_listreaders_ret), (long) scard_listreaders_ret); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1656 |
@@ -5519,15 +4779,6 @@ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1657 |
if (count < slot_count) { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1658 |
CACKEY_DEBUG_PRINTF("Error. User allocated %lu entries, but we have %lu entries.", count, slot_count); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1659 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1660 |
-<<<<<<< HEAD |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1661 |
- return(CKR_BUFFER_TOO_SMALL); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1662 |
- } |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1663 |
- |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1664 |
- for (currslot = 0; currslot < slot_count; currslot++) { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1665 |
- /* Start with Slot ID 1, to avoid a bug in GDM on RHEL */ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1666 |
- /* Bug 594911: https://bugzilla.redhat.com/show_bug.cgi?id=594911 */ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1667 |
- pSlotList[currslot] = currslot + 1; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1668 |
-======= |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1669 |
CACKEY_DEBUG_PRINTF("Returning CKR_BUFFER_TOO_SMALL"); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1670 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1671 |
return(CKR_BUFFER_TOO_SMALL); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1672 |
@@ -5561,7 +4812,6 @@ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1673 |
CACKEY_DEBUG_PRINTF("Error. Unlocking failed."); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1674 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1675 |
return(CKR_GENERAL_ERROR); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1676 |
->>>>>>> trunk |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1677 |
} |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1678 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1679 |
*pulCount = slot_count; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1680 |
@@ -5613,15 +4863,11 @@ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1681 |
return(CKR_SLOT_ID_INVALID); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1682 |
} |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1683 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1684 |
-<<<<<<< HEAD |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1685 |
- pInfo->flags = CKF_REMOVABLE_DEVICE | CKF_HW_SLOT; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1686 |
-======= |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1687 |
pInfo->flags = CKF_HW_SLOT; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1688 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1689 |
if (!cackey_slots[slotID].internal) { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1690 |
pInfo->flags |= CKF_REMOVABLE_DEVICE; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1691 |
} |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1692 |
->>>>>>> trunk |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1693 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1694 |
if (cackey_token_present(&cackey_slots[slotID]) == CACKEY_PCSC_S_TOKENPRESENT) { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1695 |
pInfo->flags |= CKF_TOKEN_PRESENT; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1696 |
@@ -5764,13 +5010,10 @@ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1697 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1698 |
pInfo->flags = CKF_WRITE_PROTECTED | CKF_USER_PIN_INITIALIZED | CKF_TOKEN_INITIALIZED | cackey_slots[slotID].token_flags; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1699 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1700 |
-<<<<<<< HEAD |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1701 |
-======= |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1702 |
if (cackey_pin_command != NULL) { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1703 |
pInfo->flags |= CKF_PROTECTED_AUTHENTICATION_PATH; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1704 |
} |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1705 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1706 |
->>>>>>> trunk |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1707 |
pInfo->ulMaxSessionCount = (sizeof(cackey_sessions) / sizeof(cackey_sessions[0])) - 1; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1708 |
pInfo->ulSessionCount = CK_UNAVAILABLE_INFORMATION; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1709 |
pInfo->ulMaxRwSessionCount = 0; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1710 |
@@ -5933,17 +5176,12 @@ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1711 |
return(CKR_TOKEN_WRITE_PROTECTED); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1712 |
} |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1713 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1714 |
-<<<<<<< HEAD |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1715 |
-/* We don't support this method. */ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1716 |
-CK_DEFINE_FUNCTION(CK_RV, C_SetPIN)(CK_SESSION_HANDLE hSession, CK_UTF8CHAR_PTR pOldPin, CK_ULONG ulOldPinLen, CK_UTF8CHAR_PTR pNewPin, CK_ULONG ulNewPinLen) { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1717 |
-======= |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1718 |
CK_DEFINE_FUNCTION(CK_RV, C_SetPIN)(CK_SESSION_HANDLE hSession, CK_UTF8CHAR_PTR pOldPin, CK_ULONG ulOldPinLen, CK_UTF8CHAR_PTR pNewPin, CK_ULONG ulNewPinLen) { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1719 |
char oldpinbuf[64], newpinbuf[64]; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1720 |
cackey_ret set_pin_ret, get_pin_ret; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1721 |
CK_SLOT_ID slotID; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1722 |
int mutex_retval; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1723 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1724 |
->>>>>>> trunk |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1725 |
CACKEY_DEBUG_PRINTF("Called."); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1726 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1727 |
if (!cackey_initialized) { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1728 |
@@ -5952,11 +5190,6 @@ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1729 |
return(CKR_CRYPTOKI_NOT_INITIALIZED); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1730 |
} |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1731 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1732 |
-<<<<<<< HEAD |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1733 |
- CACKEY_DEBUG_PRINTF("Returning CKR_FUNCTION_NOT_SUPPORTED (%i)", CKR_FUNCTION_NOT_SUPPORTED); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1734 |
- |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1735 |
- return(CKR_FUNCTION_NOT_SUPPORTED); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1736 |
-======= |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1737 |
mutex_retval = cackey_mutex_lock(cackey_biglock); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1738 |
if (mutex_retval != 0) { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1739 |
CACKEY_DEBUG_PRINTF("Error. Locking failed."); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1740 |
@@ -6091,7 +5324,6 @@ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1741 |
} |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1742 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1743 |
return(CKR_GENERAL_ERROR); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1744 |
->>>>>>> trunk |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1745 |
} |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1746 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1747 |
CK_DEFINE_FUNCTION(CK_RV, C_OpenSession)(CK_SLOT_ID slotID, CK_FLAGS flags, CK_VOID_PTR pApplication, CK_NOTIFY notify, CK_SESSION_HANDLE_PTR phSession) { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1748 |
@@ -6377,15 +5609,10 @@ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1749 |
return(CKR_FUNCTION_NOT_SUPPORTED); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1750 |
} |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1751 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1752 |
-<<<<<<< HEAD |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1753 |
-CK_DEFINE_FUNCTION(CK_RV, C_Login)(CK_SESSION_HANDLE hSession, CK_USER_TYPE userType, CK_UTF8CHAR_PTR pPin, CK_ULONG ulPinLen) { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1754 |
- CK_SLOT_ID slotID; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1755 |
-======= |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1756 |
CK_DEFINE_FUNCTION(CK_RV, _C_LoginMutexArg)(CK_SESSION_HANDLE hSession, CK_USER_TYPE userType, CK_UTF8CHAR_PTR pPin, CK_ULONG ulPinLen, int lock_mutex) { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1757 |
CK_SLOT_ID slotID; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1758 |
cackey_ret get_pin_ret; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1759 |
char pinbuf[64]; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1760 |
->>>>>>> trunk |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1761 |
int mutex_retval; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1762 |
int tries_remaining; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1763 |
int login_ret; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1764 |
@@ -6410,17 +5637,6 @@ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1765 |
return(CKR_USER_TYPE_INVALID); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1766 |
} |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1767 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1768 |
-<<<<<<< HEAD |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1769 |
- mutex_retval = cackey_mutex_lock(cackey_biglock); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1770 |
- if (mutex_retval != 0) { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1771 |
- CACKEY_DEBUG_PRINTF("Error. Locking failed."); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1772 |
- |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1773 |
- return(CKR_GENERAL_ERROR); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1774 |
- } |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1775 |
- |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1776 |
- if (!cackey_sessions[hSession].active) { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1777 |
- cackey_mutex_unlock(cackey_biglock); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1778 |
-======= |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1779 |
if (lock_mutex) { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1780 |
mutex_retval = cackey_mutex_lock(cackey_biglock); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1781 |
if (mutex_retval != 0) { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1782 |
@@ -6434,7 +5650,6 @@ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1783 |
if (lock_mutex) { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1784 |
cackey_mutex_unlock(cackey_biglock); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1785 |
} |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1786 |
->>>>>>> trunk |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1787 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1788 |
CACKEY_DEBUG_PRINTF("Error. Session not active."); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1789 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1790 |
@@ -6446,35 +5661,23 @@ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1791 |
if (slotID < 0 || slotID >= (sizeof(cackey_slots) / sizeof(cackey_slots[0]))) { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1792 |
CACKEY_DEBUG_PRINTF("Error. Invalid slot requested (%lu), outside of valid range", slotID); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1793 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1794 |
-<<<<<<< HEAD |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1795 |
-======= |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1796 |
if (lock_mutex) { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1797 |
cackey_mutex_unlock(cackey_biglock); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1798 |
} |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1799 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1800 |
->>>>>>> trunk |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1801 |
return(CKR_GENERAL_ERROR); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1802 |
} |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1803 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1804 |
if (cackey_slots[slotID].active == 0) { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1805 |
CACKEY_DEBUG_PRINTF("Error. Invalid slot requested (%lu), slot not currently active", slotID); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1806 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1807 |
-<<<<<<< HEAD |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1808 |
- cackey_mutex_unlock(cackey_biglock); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1809 |
-======= |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1810 |
if (lock_mutex) { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1811 |
cackey_mutex_unlock(cackey_biglock); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1812 |
} |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1813 |
->>>>>>> trunk |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1814 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1815 |
return(CKR_GENERAL_ERROR); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1816 |
} |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1817 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1818 |
-<<<<<<< HEAD |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1819 |
- login_ret = cackey_login(&cackey_slots[slotID], pPin, ulPinLen, &tries_remaining); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1820 |
- if (login_ret != CACKEY_PCSC_S_OK) { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1821 |
- cackey_mutex_unlock(cackey_biglock); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1822 |
-======= |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1823 |
if (cackey_pin_command != NULL) { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1824 |
if (pPin != NULL) { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1825 |
CACKEY_DEBUG_PRINTF("Protected authentication path in effect and PIN provided !?"); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1826 |
@@ -6501,18 +5704,14 @@ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1827 |
if (lock_mutex) { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1828 |
cackey_mutex_unlock(cackey_biglock); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1829 |
} |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1830 |
->>>>>>> trunk |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1831 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1832 |
if (login_ret == CACKEY_PCSC_E_LOCKED) { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1833 |
CACKEY_DEBUG_PRINTF("Error. Token is locked."); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1834 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1835 |
cackey_slots[slotID].token_flags |= CKF_USER_PIN_LOCKED; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1836 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1837 |
-<<<<<<< HEAD |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1838 |
-======= |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1839 |
CACKEY_DEBUG_PRINTF("Returning CKR_PIN_LOCKED (%i)", (int) CKR_PIN_LOCKED); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1840 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1841 |
->>>>>>> trunk |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1842 |
return(CKR_PIN_LOCKED); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1843 |
} else if (login_ret == CACKEY_PCSC_E_BADPIN) { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1844 |
CACKEY_DEBUG_PRINTF("Error. Invalid PIN."); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1845 |
@@ -6523,11 +5722,8 @@ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1846 |
cackey_slots[slotID].token_flags |= CKF_USER_PIN_FINAL_TRY; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1847 |
} |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1848 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1849 |
-<<<<<<< HEAD |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1850 |
-======= |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1851 |
CACKEY_DEBUG_PRINTF("Returning CKR_PIN_INCORRECT (%i)", (int) CKR_PIN_INCORRECT); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1852 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1853 |
->>>>>>> trunk |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1854 |
return(CKR_PIN_INCORRECT); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1855 |
} |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1856 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1857 |
@@ -6540,13 +5736,6 @@ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1858 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1859 |
cackey_sessions[hSession].state = CKS_RO_USER_FUNCTIONS; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1860 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1861 |
-<<<<<<< HEAD |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1862 |
- mutex_retval = cackey_mutex_unlock(cackey_biglock); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1863 |
- if (mutex_retval != 0) { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1864 |
- CACKEY_DEBUG_PRINTF("Error. Unlocking failed."); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1865 |
- |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1866 |
- return(CKR_GENERAL_ERROR); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1867 |
-======= |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1868 |
if (lock_mutex) { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1869 |
mutex_retval = cackey_mutex_unlock(cackey_biglock); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1870 |
if (mutex_retval != 0) { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1871 |
@@ -6554,7 +5743,6 @@ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1872 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1873 |
return(CKR_GENERAL_ERROR); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1874 |
} |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1875 |
->>>>>>> trunk |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1876 |
} |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1877 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1878 |
CACKEY_DEBUG_PRINTF("Returning CKR_OK (%i)", CKR_OK); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1879 |
@@ -6562,13 +5750,10 @@ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1880 |
return(CKR_OK); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1881 |
} |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1882 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1883 |
-<<<<<<< HEAD |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1884 |
-======= |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1885 |
CK_DEFINE_FUNCTION(CK_RV, C_Login)(CK_SESSION_HANDLE hSession, CK_USER_TYPE userType, CK_UTF8CHAR_PTR pPin, CK_ULONG ulPinLen) { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1886 |
return(_C_LoginMutexArg(hSession, userType, pPin, ulPinLen, 1)); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1887 |
} |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1888 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1889 |
->>>>>>> trunk |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1890 |
CK_DEFINE_FUNCTION(CK_RV, C_Logout)(CK_SESSION_HANDLE hSession) { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1891 |
CK_SLOT_ID slotID; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1892 |
int mutex_retval; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1893 |
@@ -6619,16 +5804,12 @@ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1894 |
} |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1895 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1896 |
cackey_sessions[hSession].state = CKS_RO_PUBLIC_SESSION; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1897 |
-<<<<<<< HEAD |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1898 |
- cackey_slots[slotID].token_flags = CKF_LOGIN_REQUIRED; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1899 |
-======= |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1900 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1901 |
if (cackey_pin_command == NULL) { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1902 |
cackey_slots[slotID].token_flags = CKF_LOGIN_REQUIRED; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1903 |
} else { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1904 |
cackey_slots[slotID].token_flags = 0; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1905 |
} |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1906 |
->>>>>>> trunk |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1907 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1908 |
mutex_retval = cackey_mutex_unlock(cackey_biglock); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1909 |
if (mutex_retval != 0) { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1910 |
@@ -7041,13 +6222,10 @@ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1911 |
CK_ULONG curr_id_idx, curr_out_id_idx, curr_attr_idx, sess_attr_idx; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1912 |
CK_ULONG matched_count, prev_matched_count; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1913 |
int mutex_retval; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1914 |
-<<<<<<< HEAD |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1915 |
-======= |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1916 |
#ifdef CACKEY_DEBUG_SEARCH_SPEEDTEST |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1917 |
struct timeval start, end; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1918 |
uint64_t start_int, end_int; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1919 |
#endif |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1920 |
->>>>>>> trunk |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1921 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1922 |
CACKEY_DEBUG_PRINTF("Called."); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1923 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1924 |
@@ -7113,13 +6291,10 @@ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1925 |
return(CKR_OPERATION_NOT_INITIALIZED); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1926 |
} |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1927 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1928 |
-<<<<<<< HEAD |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1929 |
-======= |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1930 |
#ifdef CACKEY_DEBUG_SEARCH_SPEEDTEST |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1931 |
gettimeofday(&start, NULL); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1932 |
#endif |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1933 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1934 |
->>>>>>> trunk |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1935 |
curr_out_id_idx = 0; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1936 |
for (curr_id_idx = cackey_sessions[hSession].search_curr_id; curr_id_idx < cackey_sessions[hSession].identities_count && ulMaxObjectCount; curr_id_idx++) { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1937 |
curr_id = &cackey_sessions[hSession].identities[curr_id_idx]; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1938 |
@@ -7165,8 +6340,6 @@ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1939 |
cackey_sessions[hSession].search_curr_id = curr_id_idx; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1940 |
*pulObjectCount = curr_out_id_idx; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1941 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1942 |
-<<<<<<< HEAD |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1943 |
-======= |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1944 |
#ifdef CACKEY_DEBUG_SEARCH_SPEEDTEST |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1945 |
gettimeofday(&end, NULL); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1946 |
start_int = (start.tv_sec * 1000000) + start.tv_usec; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1947 |
@@ -7174,7 +6347,6 @@ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1948 |
fprintf(stderr, "Search took %lu microseconds\n", (unsigned long) (end_int - start_int)); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1949 |
#endif |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1950 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1951 |
->>>>>>> trunk |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1952 |
mutex_retval = cackey_mutex_unlock(cackey_biglock); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1953 |
if (mutex_retval != 0) { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1954 |
CACKEY_DEBUG_PRINTF("Error. Unlocking failed."); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1955 |
@@ -7562,15 +6734,12 @@ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1956 |
/* Ask card to decrypt */ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1957 |
buflen = cackey_signdecrypt(&cackey_slots[slotID], cackey_sessions[hSession].decrypt_identity, pEncryptedPart, ulEncryptedPartLen, buf, sizeof(buf), 0, 1); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1958 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1959 |
-<<<<<<< HEAD |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1960 |
-======= |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1961 |
if (buflen == CACKEY_PCSC_E_NEEDLOGIN && cackey_pin_command != NULL) { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1962 |
if (_C_LoginMutexArg(hSession, CKU_USER, NULL, 0, 0) == CKR_OK) { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1963 |
buflen = cackey_signdecrypt(&cackey_slots[slotID], cackey_sessions[hSession].decrypt_identity, pEncryptedPart, ulEncryptedPartLen, buf, sizeof(buf), 0, 1); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1964 |
} |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1965 |
} |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1966 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1967 |
->>>>>>> trunk |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1968 |
if (buflen < 0) { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1969 |
/* Decryption failed. */ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1970 |
if (buflen == CACKEY_PCSC_E_NEEDLOGIN) { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1971 |
@@ -7578,11 +6747,8 @@ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1972 |
} else if (buflen == CACKEY_PCSC_E_TOKENABSENT) { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1973 |
retval = CKR_DEVICE_REMOVED; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1974 |
} else { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1975 |
-<<<<<<< HEAD |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1976 |
-======= |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1977 |
CACKEY_DEBUG_PRINTF("Failed to send APDU, error = %li", (long int) buflen); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1978 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1979 |
->>>>>>> trunk |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1980 |
retval = CKR_GENERAL_ERROR; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1981 |
} |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1982 |
} else if (((unsigned long) buflen) > *pulPartLen && pPart) { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1983 |
@@ -7822,11 +6988,7 @@ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1984 |
cackey_sessions[hSession].sign_bufused = 0; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1985 |
cackey_sessions[hSession].sign_buf = malloc(sizeof(*cackey_sessions[hSession].sign_buf) * cackey_sessions[hSession].sign_buflen); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1986 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1987 |
-<<<<<<< HEAD |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1988 |
- CACKEY_DEBUG_PRINTF("Session %lu sign_identity is %p (identity #%lu)", (unsigned long) hSession, &cackey_sessions[hSession].identities[hKey], (unsigned long) hKey); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1989 |
-======= |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1990 |
CACKEY_DEBUG_PRINTF("Session %lu sign_identity is %p (identity #%lu)", (unsigned long) hSession, (void *) &cackey_sessions[hSession].identities[hKey], (unsigned long) hKey); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1991 |
->>>>>>> trunk |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1992 |
cackey_sessions[hSession].sign_identity = &cackey_sessions[hSession].identities[hKey]; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1993 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1994 |
mutex_retval = cackey_mutex_unlock(cackey_biglock); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1995 |
@@ -7933,11 +7095,6 @@ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1996 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1997 |
CK_DEFINE_FUNCTION(CK_RV, C_SignUpdate)(CK_SESSION_HANDLE hSession, CK_BYTE_PTR pPart, CK_ULONG ulPartLen) { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1998 |
int mutex_retval; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
1999 |
-<<<<<<< HEAD |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
2000 |
-======= |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
2001 |
- int resizeRetry; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
2002 |
- int needResize; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
2003 |
->>>>>>> trunk |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
2004 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
2005 |
CACKEY_DEBUG_PRINTF("Called."); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
2006 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
2007 |
@@ -7998,47 +7155,12 @@ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
2008 |
switch (cackey_sessions[hSession].sign_mechanism) { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
2009 |
case CKM_RSA_PKCS: |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
2010 |
/* Accumulate directly */ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
2011 |
-<<<<<<< HEAD |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
2012 |
if ((cackey_sessions[hSession].sign_bufused + ulPartLen) > cackey_sessions[hSession].sign_buflen) { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
2013 |
-======= |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
2014 |
- for (resizeRetry = 0; resizeRetry < 11; resizeRetry++) { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
2015 |
- needResize = 0; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
2016 |
- if ((cackey_sessions[hSession].sign_bufused + ulPartLen) > cackey_sessions[hSession].sign_buflen) { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
2017 |
- needResize = 1; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
2018 |
- } |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
2019 |
- |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
2020 |
- if (!needResize) { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
2021 |
- break; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
2022 |
- } |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
2023 |
- |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
2024 |
- CACKEY_DEBUG_PRINTF("Resizing signing buffer (try #%i of 10 -- 11th is fatal)", resizeRetry); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
2025 |
- |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
2026 |
- if (resizeRetry == 10) { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
2027 |
- free(cackey_sessions[hSession].sign_buf); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
2028 |
- |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
2029 |
- cackey_sessions[hSession].sign_buflen = 0; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
2030 |
- cackey_sessions[hSession].sign_buf = NULL; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
2031 |
- |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
2032 |
- break; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
2033 |
- } |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
2034 |
- |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
2035 |
->>>>>>> trunk |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
2036 |
cackey_sessions[hSession].sign_buflen *= 2; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
2037 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
2038 |
cackey_sessions[hSession].sign_buf = realloc(cackey_sessions[hSession].sign_buf, sizeof(*cackey_sessions[hSession].sign_buf) * cackey_sessions[hSession].sign_buflen); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
2039 |
} |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
2040 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
2041 |
-<<<<<<< HEAD |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
2042 |
-======= |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
2043 |
- if (cackey_sessions[hSession].sign_buf == NULL) { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
2044 |
- cackey_mutex_unlock(cackey_biglock); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
2045 |
- |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
2046 |
- CACKEY_DEBUG_PRINTF("Error. Signing buffer is NULL."); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
2047 |
- |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
2048 |
- return(CKR_GENERAL_ERROR); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
2049 |
- } |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
2050 |
- |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
2051 |
->>>>>>> trunk |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
2052 |
memcpy(cackey_sessions[hSession].sign_buf + cackey_sessions[hSession].sign_bufused, pPart, ulPartLen); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
2053 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
2054 |
cackey_sessions[hSession].sign_bufused += ulPartLen; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
2055 |
@@ -8128,11 +7250,6 @@ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
2056 |
switch (cackey_sessions[hSession].sign_mechanism) { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
2057 |
case CKM_RSA_PKCS: |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
2058 |
/* Ask card to sign */ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
2059 |
-<<<<<<< HEAD |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
2060 |
- CACKEY_DEBUG_PRINTF("Asking to sign from identity %p in session %lu", cackey_sessions[hSession].sign_identity, (unsigned long) hSession); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
2061 |
- sigbuflen = cackey_signdecrypt(&cackey_slots[slotID], cackey_sessions[hSession].sign_identity, cackey_sessions[hSession].sign_buf, cackey_sessions[hSession].sign_bufused, sigbuf, sizeof(sigbuf), 1, 0); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
2062 |
- |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
2063 |
-======= |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
2064 |
CACKEY_DEBUG_PRINTF("Asking to sign from identity %p in session %lu", (void *) cackey_sessions[hSession].sign_identity, (unsigned long) hSession); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
2065 |
sigbuflen = cackey_signdecrypt(&cackey_slots[slotID], cackey_sessions[hSession].sign_identity, cackey_sessions[hSession].sign_buf, cackey_sessions[hSession].sign_bufused, sigbuf, sizeof(sigbuf), 1, 0); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
2066 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
2067 |
@@ -8142,7 +7259,6 @@ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
2068 |
} |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
2069 |
} |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
2070 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
2071 |
->>>>>>> trunk |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
2072 |
if (sigbuflen < 0) { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
2073 |
/* Signing failed. */ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
2074 |
if (sigbuflen == CACKEY_PCSC_E_NEEDLOGIN) { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
2075 |
@@ -8485,10 +7601,6 @@ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
2076 |
} |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
2077 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
2078 |
CK_DEFINE_FUNCTION(CK_RV, C_GetFunctionList)(CK_FUNCTION_LIST_PTR_PTR ppFunctionList) { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
2079 |
-<<<<<<< HEAD |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
2080 |
-======= |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
2081 |
- static CK_FUNCTION_LIST_PTR spFunctionList = NULL; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
2082 |
->>>>>>> trunk |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
2083 |
CK_FUNCTION_LIST_PTR pFunctionList; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
2084 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
2085 |
CACKEY_DEBUG_PRINTF("Called."); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
2086 |
@@ -8499,17 +7611,6 @@ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
2087 |
return(CKR_ARGUMENTS_BAD); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
2088 |
} |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
2089 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
2090 |
-<<<<<<< HEAD |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
2091 |
-======= |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
2092 |
- if (spFunctionList != NULL) { |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
2093 |
- *ppFunctionList = spFunctionList; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
2094 |
- |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
2095 |
- CACKEY_DEBUG_PRINTF("Returning CKR_OK (%i)", CKR_OK); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
2096 |
- |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
2097 |
- return(CKR_OK); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
2098 |
- } |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
2099 |
- |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
2100 |
->>>>>>> trunk |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
2101 |
pFunctionList = malloc(sizeof(*pFunctionList)); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
2102 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
2103 |
pFunctionList->version.major = ((CACKEY_CRYPTOKI_VERSION_CODE) >> 16) & 0xff; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
2104 |
@@ -8584,17 +7685,10 @@ |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
2105 |
pFunctionList->C_CancelFunction = C_CancelFunction; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
2106 |
pFunctionList->C_GetFunctionList = C_GetFunctionList; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
2107 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
2108 |
-<<<<<<< HEAD |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
2109 |
-======= |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
2110 |
- spFunctionList = pFunctionList; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
2111 |
->>>>>>> trunk |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
2112 |
*ppFunctionList = pFunctionList; |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
2113 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
2114 |
CACKEY_DEBUG_PRINTF("Returning CKR_OK (%i)", CKR_OK); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
2115 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
2116 |
return(CKR_OK); |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
2117 |
} |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
2118 |
-<<<<<<< HEAD |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
2119 |
|
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
2120 |
-======= |
b8986042dd84
PSARC/2016/217 Smartcard Reintroduction
Stephen Gaul Jr <steve.gaul@oracle.com>
parents:
diff
changeset
|
2121 |
->>>>>>> trunk |