| 376 |
} |
} |
| 377 |
#endif |
#endif |
| 378 |
|
|
| 379 |
|
/* T=1 Protocol Management for a TPDU reader */ |
| 380 |
|
if ((SCARD_PROTOCOL_T1 == ccid_descriptor->cardProtocol) |
| 381 |
|
&& (CCID_CLASS_TPDU == (ccid_descriptor->dwFeatures & CCID_CLASS_EXCHANGE_MASK))) |
| 382 |
|
{ |
| 383 |
|
ct_buf_t sbuf; |
| 384 |
|
unsigned char sdata[T1_BUFFER_SIZE]; |
| 385 |
|
|
| 386 |
|
/* Initialize send buffer with the APDU */ |
| 387 |
|
ct_buf_set(&sbuf, |
| 388 |
|
(void *)(TxBuffer + offsetof(PIN_MODIFY_STRUCTURE, abData)), |
| 389 |
|
TxLength - offsetof(PIN_MODIFY_STRUCTURE, abData)); |
| 390 |
|
|
| 391 |
|
/* Create T=1 block */ |
| 392 |
|
ret = t1_build(&((get_ccid_slot(reader_index))->t1), |
| 393 |
|
sdata, 0, T1_I_BLOCK, &sbuf, NULL); |
| 394 |
|
|
| 395 |
|
/* Increment the sequence numbers */ |
| 396 |
|
get_ccid_slot(reader_index)->t1.ns ^= 1; |
| 397 |
|
get_ccid_slot(reader_index)->t1.nr ^= 1; |
| 398 |
|
|
| 399 |
|
/* Copy the generated T=1 block prologue into the teoprologue |
| 400 |
|
* of the CCID command */ |
| 401 |
|
memcpy(TxBuffer + offsetof(PIN_MODIFY_STRUCTURE, bTeoPrologue), |
| 402 |
|
sdata, 3); |
| 403 |
|
} |
| 404 |
|
|
| 405 |
/* Build a CCID block from a PC/SC V2.1.2 Part 10 block */ |
/* Build a CCID block from a PC/SC V2.1.2 Part 10 block */ |
| 406 |
|
|
| 407 |
/* Do adjustments as needed - CCID spec is not exact with some |
/* Do adjustments as needed - CCID spec is not exact with some |
| 461 |
|
|
| 462 |
ret = CCID_Receive(reader_index, RxLength, RxBuffer); |
ret = CCID_Receive(reader_index, RxLength, RxBuffer); |
| 463 |
|
|
| 464 |
|
/* T=1 Protocol Management for a TPDU reader */ |
| 465 |
|
if ((SCARD_PROTOCOL_T1 == ccid_descriptor->cardProtocol) |
| 466 |
|
&& (CCID_CLASS_TPDU == (ccid_descriptor->dwFeatures & CCID_CLASS_EXCHANGE_MASK))) |
| 467 |
|
{ |
| 468 |
|
/* get only the T=1 data */ |
| 469 |
|
/* FIXME: manage T=1 error blocks */ |
| 470 |
|
memmove(RxBuffer, RxBuffer+3, *RxLength -4); |
| 471 |
|
*RxLength -= 4; /* remove NAD, PCB, LEN and CRC */ |
| 472 |
|
} |
| 473 |
|
|
| 474 |
ccid_descriptor -> readTimeout = old_read_timeout; |
ccid_descriptor -> readTimeout = old_read_timeout; |
| 475 |
return ret; |
return ret; |
| 476 |
} /* SecurePINModify */ |
} /* SecurePINModify */ |