1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
/*
* internal.h: Internal definitions for libopensc
*
* Copyright (C) 2001, 2002 Juha Yrjölä <juha.yrjola@iki.fi>
* 2005 The OpenSC project
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
extern "C" _WIN32
;
/* Internal use only */
int ;
int ;
/* Add an ATR to the card driver's struct sc_atr_table */
int ;
int ;
/**
* Convert an unsigned long into 4 bytes in big endian order
* @param buf the byte array for the result, should be 4 bytes long
* @param x the value to be converted
* @return the buffer passed, containing the converted value
*/
u8 *;
/**
* Convert an unsigned long into 2 bytes in big endian order
* @param buf the byte array for the result, should be 2 bytes long
* @param x the value to be converted
* @return the buffer passed, containing the converted value
*/
u8 *;
/**
* Convert 4 bytes in big endian order into an unsigned long
* @param buf the byte array of 4 bytes
* @return the converted value
*/
unsigned long ;
/**
* Convert 2 bytes in big endian order into an unsigned short
* @param buf the byte array of 2 bytes
* @return the converted value
*/
unsigned short ;
/**
* Convert 2 bytes in little endian order into an unsigned short
* @param buf the byte array of 2 bytes
* @return the converted value
*/
unsigned short ;
/* Returns an scconf_block entry with matching ATR/ATRmask to the ATR specified,
* NULL otherwise. Additionally, if card driver is not specified, search through
* all card drivers user configured ATRs. */
scconf_block *;
/* Returns an index number if a match was found, -1 otherwise. table has to
* be null terminated. */
int ;
int ;
int ;
int ;
int ;
/********************************************************************/
/* pkcs1 padding/encoding functions */
/********************************************************************/
int ;
int ;
int ;
/**
* PKCS1 encodes the given data.
* @param ctx IN sc_context_t object
* @param flags IN the algorithm to use
* @param in IN input buffer
* @param inlen IN length of the input
* @param out OUT output buffer (in == out is allowed)
* @param outlen OUT length of the output buffer
* @param mod_bits IN length of the modulus in bits
* @return SC_SUCCESS on success and an error code otherwise
*/
int ;
/**
* Get the necessary padding and sec. env. flags.
* @param ctx IN sc_contex_t object
* @param iflags IN the desired algorithms flags
* @param caps IN the card / key capabilities
* @param pflags OUT the padding flags to use
* @param salg OUT the security env. algorithm flag to use
* @return SC_SUCCESS on success and an error code otherwise
*/
int ;
/********************************************************************/
/* mutex functions */
/********************************************************************/
/**
* Creates a new sc_mutex object. Note: unless sc_mutex_set_mutex_funcs()
* this function does nothing and always returns SC_SUCCESS.
* @param ctx sc_context_t object with the thread context
* @param mutex pointer for the newly created mutex object
* @return SC_SUCCESS on success and an error code otherwise
*/
int ;
/**
* Tries to acquire a lock for a sc_mutex object. Note: Unless
* sc_mutex_set_mutex_funcs() has been called before this
* function does nothing and always returns SUCCESS.
* @param ctx sc_context_t object with the thread context
* @param mutex mutex object to lock
* @return SC_SUCCESS on success and an error code otherwise
*/
int ;
/**
* Unlocks a sc_mutex object. Note: Unless sc_mutex_set_mutex_funcs()
* has been called before this function does nothing and always returns
* SC_SUCCESS.
* @param ctx sc_context_t object with the thread context
* @param mutex mutex object to unlock
* @return SC_SUCCESS on success and an error code otherwise
*/
int ;
/**
* Destroys a sc_mutex object. Note: Unless sc_mutex_set_mutex_funcs()
* has been called before this function does nothing and always returns
* SC_SUCCESS.
* @param ctx sc_context_t object with the thread context
* @param mutex mutex object to be destroyed
* @return SC_SUCCESS on success and an error code otherwise
*/
int ;
/**
* Returns a unique id for every thread.
* @param ctx sc_context_t object with the thread context
* @return unsigned long with the unique id or 0 if not supported
*/
unsigned long ;
/********************************************************************/
/* internal APDU handling functions */
/********************************************************************/
/**
* Returns the encoded APDU in newly created buffer.
* @param ctx sc_context_t object
* @param apdu sc_apdu_t object with the APDU to encode
* @param buf pointer to the newly allocated buffer
* @param len length of the encoded APDU
* @param proto protocol to be used
* @return SC_SUCCESS on success and an error code otherwise
*/
int ;
/**
* Sets the status bytes and return data in the APDU
* @param ctx sc_context_t object
* @param apdu the apdu to which the data should be written
* @param buf returned data
* @param len length of the returned data
* @return SC_SUCCESS on success and an error code otherwise
*/
int ;
/**
* Logs APDU
* @param ctx sc_context_t object
* @param buf buffer with the APDU data
* @param len length of the APDU
* @param is_outgoing != 0 if the data is send to the card
*/
extern struct sc_reader_driver *;
extern struct sc_reader_driver *;
extern struct sc_reader_driver *;
extern struct sc_reader_driver *;
}