1 | /*
|
---|
2 | protocol_t1.c
|
---|
3 | Handling of ISO 7816 T=1 protocol
|
---|
4 |
|
---|
5 | This file is part of the Unix driver for Towitoko smartcard readers
|
---|
6 | Copyright (C) 2000 Carlos Prados <cprados@yahoo.com>
|
---|
7 |
|
---|
8 | This version is modified by doz21 to work in a special manner ;)
|
---|
9 |
|
---|
10 | This library is free software; you can redistribute it and/or
|
---|
11 | modify it under the terms of the GNU Lesser General Public
|
---|
12 | License as published by the Free Software Foundation; either
|
---|
13 | version 2 of the License, or (at your option) any later version.
|
---|
14 |
|
---|
15 | This library is distributed in the hope that it will be useful,
|
---|
16 | but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
---|
18 | Lesser General Public License for more details.
|
---|
19 |
|
---|
20 | You should have received a copy of the GNU Lesser General Public
|
---|
21 | License along with this library; if not, write to the Free Software
|
---|
22 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
---|
23 | */
|
---|
24 |
|
---|
25 | #include "defines.h"
|
---|
26 | #include <stdio.h>
|
---|
27 | #include <stdlib.h>
|
---|
28 | #include <string.h>
|
---|
29 | #include "protocol_t1.h"
|
---|
30 | #include "t1_block.h"
|
---|
31 |
|
---|
32 | /*
|
---|
33 | * Not exported constants definition
|
---|
34 | */
|
---|
35 | #define PROTOCOL_T1_DEFAULT_IFSC 32
|
---|
36 | #define PROTOCOL_T1_DEFAULT_IFSD 32
|
---|
37 | #define PROTOCOL_T1_MAX_IFSC 251 /* Cannot send > 255 buffer */
|
---|
38 | #define PROTOCOL_T1_DEFAULT_CWI 13
|
---|
39 | #define PROTOCOL_T1_DEFAULT_BWI 4
|
---|
40 | #define PROTOCOL_T1_EDC_LRC 0
|
---|
41 | #define PROTOCOL_T1_EDC_CRC 1
|
---|
42 |
|
---|
43 | /*
|
---|
44 | * Not exported functions declaration
|
---|
45 | */
|
---|
46 |
|
---|
47 | static void
|
---|
48 | Protocol_T1_Clear (Protocol_T1 * t1);
|
---|
49 |
|
---|
50 | static int
|
---|
51 | Protocol_T1_SendBlock (Protocol_T1 * t1, T1_Block * block);
|
---|
52 |
|
---|
53 | static int
|
---|
54 | Protocol_T1_ReceiveBlock (Protocol_T1 * t1, T1_Block ** block);
|
---|
55 |
|
---|
56 | static int
|
---|
57 | Protocol_T1_UpdateBWT (Protocol_T1 * t1, unsigned short bwt);
|
---|
58 |
|
---|
59 | /*
|
---|
60 | * Exproted funtions definition
|
---|
61 | */
|
---|
62 |
|
---|
63 | Protocol_T1 *
|
---|
64 | Protocol_T1_New (void)
|
---|
65 | {
|
---|
66 | Protocol_T1 *t1;
|
---|
67 |
|
---|
68 | t1 = (Protocol_T1 *) malloc (sizeof (Protocol_T1));
|
---|
69 |
|
---|
70 | if (t1 != NULL)
|
---|
71 | Protocol_T1_Clear (t1);
|
---|
72 |
|
---|
73 | return t1;
|
---|
74 | }
|
---|
75 |
|
---|
76 | int
|
---|
77 | Protocol_T1_Init (Protocol_T1 * t1, ICC_Async * icc, int selected_protocol)
|
---|
78 | {
|
---|
79 | ICC_Async_Timings timings;
|
---|
80 | BYTE ta, tb, tc, cwi, bwi;
|
---|
81 | unsigned long baudrate;
|
---|
82 | double work_etu;
|
---|
83 | ATR *atr;
|
---|
84 | int i;
|
---|
85 |
|
---|
86 | /* Set ICC */
|
---|
87 | t1->icc = icc;
|
---|
88 |
|
---|
89 | /* Get ATR of the card */
|
---|
90 | atr = ICC_Async_GetAtr (t1->icc);
|
---|
91 |
|
---|
92 | /* Set IFSC */
|
---|
93 | if (ATR_GetInterfaceByte (atr, selected_protocol, ATR_INTERFACE_BYTE_TA, &ta) == ATR_NOT_FOUND)
|
---|
94 | t1->ifsc = PROTOCOL_T1_DEFAULT_IFSC;
|
---|
95 | else if ((ta != 0x00) && (ta != 0xFF))
|
---|
96 | t1->ifsc = ta;
|
---|
97 | else
|
---|
98 | t1->ifsc = PROTOCOL_T1_DEFAULT_IFSC;
|
---|
99 |
|
---|
100 | /* Towitoko does not allow IFSC > 251 */
|
---|
101 | t1->ifsc = MIN (t1->ifsc, PROTOCOL_T1_MAX_IFSC);
|
---|
102 |
|
---|
103 | /* Set IFSD */
|
---|
104 | t1->ifsd = PROTOCOL_T1_DEFAULT_IFSD;
|
---|
105 |
|
---|
106 | #ifndef PROTOCOL_T1_USE_DEFAULT_TIMINGS
|
---|
107 | /* Calculate CWI and BWI */
|
---|
108 | if (ATR_GetInterfaceByte (atr, selected_protocol, ATR_INTERFACE_BYTE_TB, &tb) == ATR_NOT_FOUND)
|
---|
109 | {
|
---|
110 | #endif
|
---|
111 | cwi = PROTOCOL_T1_DEFAULT_CWI;
|
---|
112 | bwi = PROTOCOL_T1_DEFAULT_BWI;
|
---|
113 | #ifndef PROTOCOL_T1_USE_DEFAULT_TIMINGS
|
---|
114 | }
|
---|
115 | else
|
---|
116 | {
|
---|
117 | cwi = tb & 0x0F;
|
---|
118 | bwi = (tb & 0xF0) >> 4;
|
---|
119 | }
|
---|
120 | #endif
|
---|
121 |
|
---|
122 | /* Work etu = (1000 / baudrate) milliseconds */
|
---|
123 | ICC_Async_GetBaudrate (t1->icc, &baudrate);
|
---|
124 | work_etu = 1000 / (double)baudrate;
|
---|
125 |
|
---|
126 | /* Set CWT = (2^CWI + 11) work etu */
|
---|
127 | t1->cwt = 1;
|
---|
128 |
|
---|
129 | for (i = 0; i < cwi ; i++)
|
---|
130 | t1->cwt *= 2;
|
---|
131 |
|
---|
132 | t1->cwt = (unsigned short) ((t1->cwt + 11) * work_etu);
|
---|
133 |
|
---|
134 | /* Set BWT = (2^BWI * 960 + 11) work etu */
|
---|
135 | t1->bwt = 1;
|
---|
136 | for (i = 0; i < bwi; i++)
|
---|
137 | t1->bwt *= 2;
|
---|
138 |
|
---|
139 | t1->bwt = (unsigned short) ((t1->bwt * 960 + 11) * work_etu);
|
---|
140 |
|
---|
141 | /* Set BGT = 22 * work etu */
|
---|
142 | t1->bgt = (unsigned short) (22 * work_etu);
|
---|
143 |
|
---|
144 | /* Set the error detection code type */
|
---|
145 | if (ATR_GetInterfaceByte (atr, selected_protocol, ATR_INTERFACE_BYTE_TC, &tc) == ATR_NOT_FOUND)
|
---|
146 | t1->edc = PROTOCOL_T1_EDC_LRC;
|
---|
147 | else
|
---|
148 | t1->edc = tc & 0x01;
|
---|
149 |
|
---|
150 | /* Set initial send sequence (NS) */
|
---|
151 | t1->ns = 1;
|
---|
152 |
|
---|
153 | /* Set timings */
|
---|
154 | ICC_Async_GetTimings (t1->icc, &timings);
|
---|
155 |
|
---|
156 | timings.block_timeout = t1->bwt;
|
---|
157 | timings.char_timeout = t1->cwt;
|
---|
158 | timings.block_delay = t1->bgt;
|
---|
159 |
|
---|
160 | ICC_Async_SetTimings (t1->icc, &timings);
|
---|
161 |
|
---|
162 | #ifdef DEBUG_PROTOCOL
|
---|
163 | printf ("Protocol: T=1: IFSC=%d, IFSD=%d, CWT=%d, BWT=%d, BGT=%d, EDC=%s\n",
|
---|
164 | t1->ifsc, t1->ifsd, t1->cwt, t1->bwt, t1->bgt,
|
---|
165 | (t1->edc == PROTOCOL_T1_EDC_LRC) ? "LRC" : "CRC");
|
---|
166 | #endif
|
---|
167 |
|
---|
168 | return PROTOCOL_T1_OK;
|
---|
169 | }
|
---|
170 |
|
---|
171 | int
|
---|
172 | Protocol_T1_Command (Protocol_T1 * t1, APDU_Cmd * cmd, APDU_Rsp ** rsp)
|
---|
173 | {
|
---|
174 | T1_Block *block;
|
---|
175 | BYTE *buffer, rsp_type, bytes, nr, wtx;
|
---|
176 | unsigned short counter;
|
---|
177 | int ret;
|
---|
178 | bool more;
|
---|
179 | if (APDU_Cmd_Ins(cmd) == T1_BLOCK_S_IFS_REQ)
|
---|
180 | {
|
---|
181 | BYTE inf = APDU_Cmd_P2(cmd);
|
---|
182 |
|
---|
183 | /* Create an IFS request S-Block */
|
---|
184 | block = T1_Block_NewSBlock (T1_BLOCK_S_IFS_REQ, 1, &inf);
|
---|
185 |
|
---|
186 | #ifdef DEBUG_PROTOCOL
|
---|
187 | printf ("Protocol: Sending block S(IFS request, %d)\n", inf);
|
---|
188 | #endif
|
---|
189 | /* Send IFSD request */
|
---|
190 | ret = Protocol_T1_SendBlock (t1, block);
|
---|
191 |
|
---|
192 | /* Delete block */
|
---|
193 | T1_Block_Delete (block);
|
---|
194 |
|
---|
195 | /* Receive a block */
|
---|
196 | ret = Protocol_T1_ReceiveBlock (t1, &block);
|
---|
197 |
|
---|
198 | if (ret == PROTOCOL_T1_OK)
|
---|
199 | {
|
---|
200 | rsp_type = T1_Block_GetType (block);
|
---|
201 |
|
---|
202 | /* Positive IFS Response S-Block received */
|
---|
203 | if (rsp_type == T1_BLOCK_S_IFS_RES)
|
---|
204 | {
|
---|
205 | /* Update IFSD value */
|
---|
206 | inf = (*T1_Block_GetInf (block));
|
---|
207 | t1->ifsd = inf;
|
---|
208 | #ifdef DEBUG_PROTOCOL
|
---|
209 | printf ("Protocol: Received block S(IFS response, %d)\n", inf);
|
---|
210 | #endif
|
---|
211 | }
|
---|
212 | }
|
---|
213 |
|
---|
214 | return ret;
|
---|
215 | }
|
---|
216 |
|
---|
217 | /* Calculate the number of bytes to send */
|
---|
218 | counter = 0;
|
---|
219 | bytes = MIN (APDU_Cmd_RawLen (cmd), t1->ifsc);
|
---|
220 |
|
---|
221 | /* See if chaining is needed */
|
---|
222 | more = (APDU_Cmd_RawLen (cmd) > t1->ifsc);
|
---|
223 |
|
---|
224 | /* Increment ns */
|
---|
225 | t1->ns = (t1->ns + 1) %2;
|
---|
226 |
|
---|
227 | /* Create an I-Block */
|
---|
228 | block = T1_Block_NewIBlock (bytes, APDU_Cmd_Raw (cmd), t1->ns, more);
|
---|
229 |
|
---|
230 | #ifdef DEBUG_PROTOCOL
|
---|
231 | printf ("Sending block I(%d,%d)\n", t1->ns, more);
|
---|
232 | #endif
|
---|
233 |
|
---|
234 | /* Send a block */
|
---|
235 | ret = Protocol_T1_SendBlock (t1, block);
|
---|
236 |
|
---|
237 | /* Delete I-block */
|
---|
238 | T1_Block_Delete (block);
|
---|
239 |
|
---|
240 | while ((ret == PROTOCOL_T1_OK) && more)
|
---|
241 | {
|
---|
242 | /* Receive a block */
|
---|
243 | ret = Protocol_T1_ReceiveBlock (t1, &block);
|
---|
244 |
|
---|
245 | if (ret == PROTOCOL_T1_OK)
|
---|
246 | {
|
---|
247 | rsp_type = T1_Block_GetType (block);
|
---|
248 |
|
---|
249 | /* Positive ACK R-Block received */
|
---|
250 | if (rsp_type == T1_BLOCK_R_OK)
|
---|
251 | {
|
---|
252 | #ifdef DEBUG_PROTOCOL
|
---|
253 | printf ("Protocol: Received block R(%d)\n", T1_Block_GetNR (block));
|
---|
254 | #endif
|
---|
255 | /* Delete block */
|
---|
256 | T1_Block_Delete (block);
|
---|
257 |
|
---|
258 | /* Increment ns */
|
---|
259 | t1->ns = (t1->ns + 1) % 2;
|
---|
260 |
|
---|
261 | /* Calculate the number of bytes to send */
|
---|
262 | counter += bytes;
|
---|
263 | bytes = MIN (APDU_Cmd_RawLen (cmd) - counter, t1->ifsc);
|
---|
264 |
|
---|
265 | /* See if chaining is needed */
|
---|
266 | more = (APDU_Cmd_RawLen (cmd) - counter > t1->ifsc);
|
---|
267 |
|
---|
268 | /* Create an I-Block */
|
---|
269 | block =
|
---|
270 | T1_Block_NewIBlock (bytes, APDU_Cmd_Raw (cmd) + counter,
|
---|
271 | t1->ns, more);
|
---|
272 | #ifdef DEBUG_PROTOCOL
|
---|
273 | printf ("Protocol: Sending block I(%d,%d)\n", t1->ns, more);
|
---|
274 | #endif
|
---|
275 | /* Send a block */
|
---|
276 | ret = Protocol_T1_SendBlock (t1, block);
|
---|
277 |
|
---|
278 | /* Delete I-block */
|
---|
279 | T1_Block_Delete (block);
|
---|
280 | }
|
---|
281 |
|
---|
282 | else
|
---|
283 | {
|
---|
284 | /* Delete block */
|
---|
285 | T1_Block_Delete (block);
|
---|
286 |
|
---|
287 | ret = PROTOCOL_T1_NOT_IMPLEMENTED;
|
---|
288 | }
|
---|
289 | }
|
---|
290 |
|
---|
291 | else
|
---|
292 | {
|
---|
293 | ret = PROTOCOL_T1_NOT_IMPLEMENTED;
|
---|
294 | }
|
---|
295 | }
|
---|
296 |
|
---|
297 | /* Reset counter */
|
---|
298 | buffer = NULL;
|
---|
299 | counter = 0;
|
---|
300 | more = TRUE;
|
---|
301 | wtx = 0;
|
---|
302 |
|
---|
303 | while ((ret == PROTOCOL_T1_OK) && more)
|
---|
304 | {
|
---|
305 | if (wtx > 1)
|
---|
306 | Protocol_T1_UpdateBWT (t1, wtx * (t1->bwt));
|
---|
307 |
|
---|
308 | /* Receive a block */
|
---|
309 | ret = Protocol_T1_ReceiveBlock (t1, &block);
|
---|
310 |
|
---|
311 | if (wtx > 1)
|
---|
312 | {
|
---|
313 | Protocol_T1_UpdateBWT (t1, t1->bwt);
|
---|
314 | wtx = 0;
|
---|
315 | }
|
---|
316 |
|
---|
317 | if (ret == PROTOCOL_T1_OK)
|
---|
318 | {
|
---|
319 | rsp_type = T1_Block_GetType (block);
|
---|
320 |
|
---|
321 | if (rsp_type == T1_BLOCK_I)
|
---|
322 | {
|
---|
323 | #ifdef DEBUG_PROTOCOL
|
---|
324 | printf ("Protocol: Received block I(%d,%d)\n",
|
---|
325 | T1_Block_GetNS(block), T1_Block_GetMore (block));
|
---|
326 | #endif
|
---|
327 | /* Calculate nr */
|
---|
328 | nr = (T1_Block_GetNS (block) + 1) % 2;
|
---|
329 |
|
---|
330 | /* Save inf field */
|
---|
331 | bytes = T1_Block_GetLen (block);
|
---|
332 | buffer = (BYTE *) realloc(buffer, counter + bytes);
|
---|
333 | memcpy (buffer + counter, T1_Block_GetInf (block), bytes);
|
---|
334 | counter += bytes;
|
---|
335 |
|
---|
336 | /* See if chaining is requested */
|
---|
337 | more = T1_Block_GetMore (block);
|
---|
338 |
|
---|
339 | /* Delete block */
|
---|
340 | T1_Block_Delete (block);
|
---|
341 |
|
---|
342 | if (more)
|
---|
343 | {
|
---|
344 | /* Create an R-Block */
|
---|
345 | block = T1_Block_NewRBlock (T1_BLOCK_R_OK, nr);
|
---|
346 | #ifdef DEBUG_PROTOCOL
|
---|
347 | printf ("Protocol: Sending block R(%d)\n", nr);
|
---|
348 | #endif
|
---|
349 | /* Send R-Block */
|
---|
350 | ret = Protocol_T1_SendBlock (t1, block);
|
---|
351 |
|
---|
352 | /* Delete I-block */
|
---|
353 | T1_Block_Delete (block);
|
---|
354 | }
|
---|
355 | }
|
---|
356 |
|
---|
357 | /* WTX Request S-Block received */
|
---|
358 | else if (rsp_type == T1_BLOCK_S_WTX_REQ)
|
---|
359 | {
|
---|
360 | /* Get wtx multiplier */
|
---|
361 | wtx = (*T1_Block_GetInf (block));
|
---|
362 | #ifdef DEBUG_PROTOCOL
|
---|
363 | printf ("Protocol: Received block S(WTX request, %d)\n", wtx);
|
---|
364 | #endif
|
---|
365 | /* Delete block */
|
---|
366 | T1_Block_Delete (block);
|
---|
367 |
|
---|
368 | /* Create an WTX response S-Block */
|
---|
369 | block = T1_Block_NewSBlock (T1_BLOCK_S_WTX_RES, 1, &wtx);
|
---|
370 | #ifdef DEBUG_PROTOCOL
|
---|
371 | printf ("Protocol: Sending block S(WTX response, %d)\n", wtx);
|
---|
372 | #endif
|
---|
373 | /* Send WTX response */
|
---|
374 | ret = Protocol_T1_SendBlock (t1, block);
|
---|
375 |
|
---|
376 | /* Delete block */
|
---|
377 | T1_Block_Delete (block);
|
---|
378 | }
|
---|
379 |
|
---|
380 | else
|
---|
381 | {
|
---|
382 | ret = PROTOCOL_T1_NOT_IMPLEMENTED;
|
---|
383 | }
|
---|
384 | }
|
---|
385 | }
|
---|
386 |
|
---|
387 | if (ret == PROTOCOL_T1_OK)
|
---|
388 | (*rsp) = APDU_Rsp_New (buffer, counter);
|
---|
389 |
|
---|
390 | if (buffer != NULL)
|
---|
391 | free (buffer);
|
---|
392 |
|
---|
393 | return ret;
|
---|
394 | }
|
---|
395 |
|
---|
396 | int
|
---|
397 | Protocol_T1_Close (Protocol_T1 * t1)
|
---|
398 | {
|
---|
399 | Protocol_T1_Clear (t1);
|
---|
400 |
|
---|
401 | return PROTOCOL_T1_OK;
|
---|
402 | }
|
---|
403 |
|
---|
404 | void
|
---|
405 | Protocol_T1_Delete (Protocol_T1 * t1)
|
---|
406 | {
|
---|
407 | free (t1);
|
---|
408 | }
|
---|
409 |
|
---|
410 | /*
|
---|
411 | * Not exported functions definition
|
---|
412 | */
|
---|
413 |
|
---|
414 | static int
|
---|
415 | Protocol_T1_SendBlock (Protocol_T1 * t1, T1_Block * block)
|
---|
416 | {
|
---|
417 | BYTE *buffer;
|
---|
418 | int length, ret;
|
---|
419 |
|
---|
420 | /* Setup transmission */
|
---|
421 | #ifndef NO_PAR_SWITCH
|
---|
422 | if (ICC_Async_BeginTransmission (t1->icc) != ICC_ASYNC_OK)
|
---|
423 | ret = PROTOCOL_T1_ICC_ERROR;
|
---|
424 |
|
---|
425 | else
|
---|
426 | #endif
|
---|
427 | {
|
---|
428 | /* Send T=1 block */
|
---|
429 | buffer = T1_Block_Raw (block);
|
---|
430 | length = T1_Block_RawLen (block);
|
---|
431 |
|
---|
432 | if (ICC_Async_Transmit (t1->icc, length, buffer) != ICC_ASYNC_OK)
|
---|
433 | {
|
---|
434 | #ifndef NO_PAR_SWITCH
|
---|
435 | ICC_Async_EndTransmission (t1->icc);
|
---|
436 | #endif
|
---|
437 | ret = PROTOCOL_T1_ICC_ERROR;
|
---|
438 | }
|
---|
439 |
|
---|
440 | else
|
---|
441 | ret = PROTOCOL_T1_OK;
|
---|
442 | }
|
---|
443 |
|
---|
444 | return ret;
|
---|
445 | }
|
---|
446 |
|
---|
447 | static int
|
---|
448 | Protocol_T1_ReceiveBlock (Protocol_T1 * t1, T1_Block ** block)
|
---|
449 | {
|
---|
450 | BYTE buffer[T1_BLOCK_MAX_SIZE];
|
---|
451 | int ret;
|
---|
452 |
|
---|
453 | /* Receive four mandatory bytes */
|
---|
454 | if (ICC_Async_Receive (t1->icc, 4, buffer) != ICC_ASYNC_OK)
|
---|
455 | {
|
---|
456 | ret = PROTOCOL_T1_ICC_ERROR;
|
---|
457 | (*block) = NULL;
|
---|
458 | }
|
---|
459 |
|
---|
460 | else
|
---|
461 | {
|
---|
462 | if (buffer[2] != 0x00)
|
---|
463 | {
|
---|
464 | /* Set timings to read the remaining block */
|
---|
465 | Protocol_T1_UpdateBWT (t1, t1->cwt);
|
---|
466 |
|
---|
467 | /* Receive remaining bytes */
|
---|
468 | if (ICC_Async_Receive (t1->icc, buffer[2], buffer + 4) !=
|
---|
469 | ICC_ASYNC_OK)
|
---|
470 | {
|
---|
471 | (*block) = NULL;
|
---|
472 | ret = PROTOCOL_T1_ICC_ERROR;
|
---|
473 | }
|
---|
474 |
|
---|
475 | else
|
---|
476 | {
|
---|
477 | (*block) = T1_Block_New (buffer, buffer[2] + 4);
|
---|
478 | ret = PROTOCOL_T1_OK;
|
---|
479 | }
|
---|
480 |
|
---|
481 | /* Restore timings */
|
---|
482 | Protocol_T1_UpdateBWT (t1, t1->bwt);
|
---|
483 | }
|
---|
484 | else
|
---|
485 | {
|
---|
486 | ret = PROTOCOL_T1_OK;
|
---|
487 | (*block) = T1_Block_New (buffer, 4);
|
---|
488 | }
|
---|
489 | }
|
---|
490 |
|
---|
491 | /* End of transmission */
|
---|
492 | #ifndef NO_PAR_SWITCH
|
---|
493 | if (ICC_Async_EndTransmission (t1->icc) != ICC_ASYNC_OK)
|
---|
494 | ret = PROTOCOL_T1_ICC_ERROR;
|
---|
495 | #endif
|
---|
496 |
|
---|
497 | return ret;
|
---|
498 | }
|
---|
499 |
|
---|
500 | static void
|
---|
501 | Protocol_T1_Clear (Protocol_T1 * t1)
|
---|
502 | {
|
---|
503 | t1->icc = NULL;
|
---|
504 | t1->ifsc = 0;
|
---|
505 | t1->ifsd = 0;
|
---|
506 | t1->bgt = 0;
|
---|
507 | t1->bwt = 0;
|
---|
508 | t1->cwt = 0;
|
---|
509 | t1->edc = 0;
|
---|
510 | t1->ns = 0;
|
---|
511 | }
|
---|
512 |
|
---|
513 | static int
|
---|
514 | Protocol_T1_UpdateBWT (Protocol_T1 * t1, unsigned short bwt)
|
---|
515 | {
|
---|
516 | ICC_Async_Timings timings;
|
---|
517 |
|
---|
518 | ICC_Async_GetTimings (t1->icc, &timings);
|
---|
519 |
|
---|
520 | timings.block_timeout = bwt;
|
---|
521 |
|
---|
522 | ICC_Async_SetTimings (t1->icc, &timings);
|
---|
523 |
|
---|
524 | return PROTOCOL_T1_OK;
|
---|
525 | }
|
---|