Changeset 950
- Timestamp:
- 05/25/07 11:52:54 (5 years ago)
- Location:
- trunk/src/ifd
- Files:
-
- 18 edited
-
ifd-acr30u.c (modified) (1 diff)
-
ifd-cardman.c (modified) (2 diffs)
-
ifd-etoken64.c (modified) (1 diff)
-
ifd-gempc.c (modified) (4 diffs)
-
ifd-kaan.c (modified) (11 diffs)
-
ifd-pertosmart1030.c (modified) (1 diff)
-
ifd-smartboard.c (modified) (2 diffs)
-
ifd-smph.c (modified) (1 diff)
-
ifd-towitoko.c (modified) (8 diffs)
-
ifd-wbeiuu.c (modified) (3 diffs)
-
proto-gbp.c (modified) (4 diffs)
-
proto-sync.c (modified) (1 diff)
-
proto-t0.c (modified) (3 diffs)
-
proto-t1.c (modified) (5 diffs)
-
reader.c (modified) (4 diffs)
-
ria.c (modified) (2 diffs)
-
serial.c (modified) (2 diffs)
-
usb-descriptors.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/ifd/ifd-acr30u.c
r927 r950 523 523 * Set the card's baud rate etc 524 524 */ 525 int acr_set_card_parameters(ifd_device_t * dev, unsigned int baudrate)525 static int acr_set_card_parameters(ifd_device_t * dev, unsigned int baudrate) 526 526 { 527 527 return 0; -
trunk/src/ifd/ifd-cardman.c
r927 r950 332 332 * Set the card's baud rate etc 333 333 */ 334 int cm_set_card_parameters(ifd_device_t * dev, unsigned int baudrate)334 static int cm_set_card_parameters(ifd_device_t * dev, unsigned int baudrate) 335 335 { 336 336 return ifd_usb_control(dev, 0x42, 0x30, baudrate << 8, 2, NULL, 0, -1); … … 341 341 * Interrupt URBs. 342 342 */ 343 int cm_usb_int(ifd_device_t * dev, int requesttype, int request, int value,344 int idx, const void *sbuf, size_t slen, void *rbuf,343 static int cm_usb_int(ifd_device_t * dev, int requesttype, int request, 344 int value, int idx, const void *sbuf, size_t slen, void *rbuf, 345 345 size_t rlen, complete_fn_t complete, long timeout) 346 346 { -
trunk/src/ifd/ifd-etoken64.c
r891 r950 100 100 if (ifd_usb_control(dev, 0x40, 0x08, 0, 0, NULL, 0, -1) < 0 101 101 || ifd_usb_control(dev, 0xc0, 0x88, 0, 0, buffer, 02, -1) != 02 102 || ifd_usb_control(dev, 0x40, 0x03, 0, 0, 0, 0, -1) < 0102 || ifd_usb_control(dev, 0x40, 0x03, 0, 0, NULL, 0, -1) < 0 103 103 || ifd_usb_control(dev, 0xc0, 0x83, 0, 0, buffer, 1, -1) != 1 104 104 || buffer[0] != 0) -
trunk/src/ifd/ifd-gempc.c
r683 r950 343 343 * Set Reader mode 344 344 */ 345 int gpc_set_mode(ifd_reader_t * reader, int mode)345 static int gpc_set_mode(ifd_reader_t * reader, int mode) 346 346 { 347 347 unsigned char cmd[] = { 0x01, 0x00, 0x00 }; … … 662 662 * Get the OS version 663 663 */ 664 int gpc_get_os_version(ifd_reader_t * reader, char *buf, size_t len)664 static int gpc_get_os_version(ifd_reader_t * reader, char *buf, size_t len) 665 665 { 666 666 static unsigned char cmd[] = { 0x22, 0x05, 0x3F, 0xE0, 0x10 }; … … 674 674 * Helper functions 675 675 */ 676 int __gpc_command(ifd_reader_t * reader, const void *cmd, size_t cmd_len,677 void *res, size_t res_len, int *gpc_status)676 static int __gpc_command(ifd_reader_t * reader, const void *cmd, 677 size_t cmd_len, void *res, size_t res_len, int *gpc_status) 678 678 { 679 679 gpc_status_t *st = (gpc_status_t *) reader->driver_data; … … 720 720 } 721 721 722 int gpc_command(ifd_reader_t * reader, const void *cmd, size_t cmd_len,722 static int gpc_command(ifd_reader_t * reader, const void *cmd, size_t cmd_len, 723 723 void *res, size_t res_len) 724 724 { -
trunk/src/ifd/ifd-kaan.c
r929 r950 209 209 * Reset the card reader 210 210 */ 211 int kaan_reset_ct(ifd_reader_t * reader)211 static int kaan_reset_ct(ifd_reader_t * reader) 212 212 { 213 213 unsigned char cmd1[] = { 0x20, 0x10, 0x00, 0x00 }; … … 397 397 * Send the Freeze command to the reader 398 398 */ 399 int kaan_freeze(ifd_reader_t * reader)399 static int kaan_freeze(ifd_reader_t * reader) 400 400 { 401 401 unsigned char freeze[16] = { 0x80, 0x70, 0x00, 0x00, 0x00, 0x30, 00 }; … … 803 803 * Read from config/status file 804 804 */ 805 int kaan_get_tlv_from_file(ifd_reader_t * reader, unsigned int df_id,805 static int kaan_get_tlv_from_file(ifd_reader_t * reader, unsigned int df_id, 806 806 unsigned int ef_id, unsigned char tag, 807 807 unsigned char *data, size_t len) … … 831 831 * Stuff to interface with the Kaan's internal file system 832 832 */ 833 int kaan_select_file(ifd_reader_t * reader, unsigned char nad, unsigned int fid,834 size_t * sizep)833 static int kaan_select_file(ifd_reader_t * reader, unsigned char nad, 834 unsigned int fid, size_t * sizep) 835 835 { 836 836 unsigned char cmd[] = { 0x00, 0xa4, 0x00, 0x00, 2, 0x00, 0x00 }; … … 855 855 } 856 856 857 int kaan_select_app(ifd_reader_t * reader, int nad, const void *aid, size_t len) 857 static int kaan_select_app(ifd_reader_t * reader, int nad, const void *aid, 858 size_t len) 858 859 { 859 860 unsigned char cmd[32] = { 0x00, 0xa4, 0x04, 0x00 }; … … 873 874 } 874 875 875 int kaan_read_binary(ifd_reader_t * reader, unsigned char nad,876 static int kaan_read_binary(ifd_reader_t * reader, unsigned char nad, 876 877 unsigned int offset, unsigned char *data, size_t len) 877 878 { … … 923 924 } 924 925 925 int kaan_update_binary(ifd_reader_t * reader, unsigned char nad,926 static int kaan_update_binary(ifd_reader_t * reader, unsigned char nad, 926 927 unsigned int offset, const unsigned char *data, 927 928 size_t len) … … 961 962 * APDU exchange with terminal 962 963 */ 963 int __kaan_apdu_xcv(ifd_reader_t * reader, const unsigned char *sbuf,964 static int __kaan_apdu_xcv(ifd_reader_t * reader, const unsigned char *sbuf, 964 965 size_t slen, unsigned char *rbuf, size_t rlen, 965 966 time_t timeout, int activity) … … 1004 1005 * Check status word returned by Kaan 1005 1006 */ 1006 int kaan_check_sw(const char *msg, const unsigned char *buf, int rc)1007 static int kaan_check_sw(const char *msg, const unsigned char *buf, int rc) 1007 1008 { 1008 1009 unsigned short sw; … … 1019 1020 } 1020 1021 1021 int kaan_get_sw(const unsigned char *buf, unsigned int n, unsigned short *sw) 1022 static int kaan_get_sw(const unsigned char *buf, unsigned int n, 1023 unsigned short *sw) 1022 1024 { 1023 1025 if (n < 2) { … … 1052 1054 * A value of 255 means a big endian two byte length value follows. 1053 1055 */ 1054 int kaan_get_tlv(unsigned char *buf, size_t len, unsigned char tag,1056 static int kaan_get_tlv(unsigned char *buf, size_t len, unsigned char tag, 1055 1057 unsigned char **res) 1056 1058 { -
trunk/src/ifd/ifd-pertosmart1030.c
r821 r950 537 537 } 538 538 539 unsigned char ps_checksum(unsigned char iv,539 static unsigned char ps_checksum(unsigned char iv, 540 540 const unsigned char *buf, size_t len) 541 541 { -
trunk/src/ifd/ifd-smartboard.c
r667 r950 109 109 * Reset the card reader 110 110 */ 111 int smartboard_reset_ct(ifd_reader_t * reader)111 static int smartboard_reset_ct(ifd_reader_t * reader) 112 112 { 113 113 unsigned char buffer[128], code; … … 336 336 } 337 337 338 int smartboard_command(ifd_reader_t * reader, unsigned char cmd,338 static int smartboard_command(ifd_reader_t * reader, unsigned char cmd, 339 339 const unsigned char *arg, size_t arg_len, 340 340 unsigned char *code, void *res, size_t res_len) -
trunk/src/ifd/ifd-smph.c
r803 r950 22 22 #define PHS_CONV_INDIRECT 1 23 23 #define TIMEOUT 1000 24 25 extern int errno;26 24 27 25 /* table for indirect to direct byte mode conversion */ -
trunk/src/ifd/ifd-towitoko.c
r775 r950 14 14 static int twt_command(ifd_reader_t *, const void *, size_t, void *, size_t); 15 15 static int twt_recv_checksum(const unsigned char *, size_t); 16 static unsigned int twt_send_checksum(unsigned char *, size_t);16 static size_t twt_send_checksum(unsigned char *, size_t); 17 17 18 18 enum { … … 208 208 } 209 209 210 int twt_try_reset(ifd_reader_t * reader, const void *cmd, size_t cmd_len,210 static int twt_try_reset(ifd_reader_t * reader, const void *cmd, size_t cmd_len, 211 211 void *atr, size_t atr_len) 212 212 { … … 463 463 } 464 464 465 int twt_sync_read(ifd_reader_t * reader, int slot, int proto,465 static int twt_sync_read(ifd_reader_t * reader, int slot, int proto, 466 466 unsigned short addr, unsigned char *buffer, size_t len) 467 467 { … … 583 583 } 584 584 585 int twt_sync_write(ifd_reader_t * reader, int slot, int proto,585 static int twt_sync_write(ifd_reader_t * reader, int slot, int proto, 586 586 unsigned short addr, const unsigned char *buffer, size_t len) 587 587 { … … 597 597 * Turn LED on/off 598 598 */ 599 int twt_led(ifd_reader_t * reader, int what)599 static int twt_led(ifd_reader_t * reader, int what) 600 600 { 601 601 unsigned char cmd[] = { 0x6F, 0x00, 0x6A, 0x0F }; … … 608 608 * Helper functions 609 609 */ 610 int twt_command(ifd_reader_t * reader, const void *cmd, size_t cmd_len,610 static int twt_command(ifd_reader_t * reader, const void *cmd, size_t cmd_len, 611 611 void *res, size_t res_len) 612 612 { … … 657 657 } 658 658 659 int twt_recv_checksum(const unsigned char *data, size_t len)659 static int twt_recv_checksum(const unsigned char *data, size_t len) 660 660 { 661 661 if (len == 0) … … 665 665 } 666 666 667 unsigned int twt_send_checksum(unsigned char *data, size_t len)667 static size_t twt_send_checksum(unsigned char *data, size_t len) 668 668 { 669 669 data[len] = twt_checksum(0x00, data, len); -
trunk/src/ifd/ifd-wbeiuu.c
r934 r950 27 27 } wbeiuu_status_t; 28 28 29 wbeiuu_status_t wbeiuu_status;29 static wbeiuu_status_t wbeiuu_status; 30 30 31 31 // PENDING: … … 68 68 uint16_t B, uint8_t F) 69 69 { 70 const int BUFSIZE = 8; 70 #define BUFSIZE 8 71 71 int status; 72 72 uint8_t buf[BUFSIZE]; … … 88 88 89 89 return status; 90 #undef BUFSIZE 90 91 } 91 92 -
trunk/src/ifd/proto-gbp.c
r774 r950 341 341 } 342 342 343 unsigned int gbp_build(gbp_state_t * gp, unsigned char *block,343 static unsigned int gbp_build(gbp_state_t * gp, unsigned char *block, 344 344 unsigned char pcb, ct_buf_t * bp) 345 345 { … … 388 388 * Build/verify checksum 389 389 */ 390 unsigned int gbp_compute_checksum(gbp_state_t * gp, unsigned char *data,390 static unsigned int gbp_compute_checksum(gbp_state_t * gp, unsigned char *data, 391 391 size_t len) 392 392 { … … 395 395 } 396 396 397 int gbp_verify_checksum(gbp_state_t * gp, unsigned char *rbuf, size_t len)397 static int gbp_verify_checksum(gbp_state_t * gp, unsigned char *rbuf, size_t len) 398 398 { 399 399 unsigned char csum; … … 406 406 * Send/receive block 407 407 */ 408 int gbp_xcv(gbp_state_t * gp, unsigned char *block, size_t slen, size_t rmax)408 static int gbp_xcv(gbp_state_t * gp, unsigned char *block, size_t slen, size_t rmax) 409 409 { 410 410 ifd_protocol_t *prot = &gp->base; -
trunk/src/ifd/proto-sync.c
r774 r950 105 105 106 106 if (ifd_deactivate(reader) < 0 || ifd_activate(reader) < 0) 107 return 0;107 return NULL; 108 108 109 109 if (!(p = ifd_protocol_new(proto, reader, slot))) 110 return 0;110 return NULL; 111 111 112 112 if (ifd_protocol_read_memory(p, slot, 0, &byte, 1) != 1) -
trunk/src/ifd/proto-t0.c
r663 r950 290 290 } 291 291 292 int t0_send(ifd_protocol_t * prot, ct_buf_t * bp, int count)292 static int t0_send(ifd_protocol_t * prot, ct_buf_t * bp, int count) 293 293 { 294 294 int n, avail; … … 305 305 } 306 306 307 int t0_recv(ifd_protocol_t * prot, ct_buf_t * bp, int count, long timeout)307 static int t0_recv(ifd_protocol_t * prot, ct_buf_t * bp, int count, long timeout) 308 308 { 309 309 int n; … … 317 317 } 318 318 319 int t0_resynch(t0_state_t * t0)319 static int t0_resynch(t0_state_t * t0) 320 320 { 321 321 return -1; -
trunk/src/ifd/proto-t1.c
r826 r950 90 90 } 91 91 92 void t1_set_checksum(t1_state_t * t1, int csum)92 static void t1_set_checksum(t1_state_t * t1, int csum) 93 93 { 94 94 switch (csum) { … … 440 440 } 441 441 442 unsigned int 443 t1_build(t1_state_t * t1, unsigned char *block, 442 static unsigned int t1_build(t1_state_t * t1, unsigned char *block, 444 443 unsigned char dad, unsigned char pcb, ct_buf_t * bp, size_t * lenp) 445 444 { … … 494 493 * Build/verify checksum 495 494 */ 496 unsigned int t1_compute_checksum(t1_state_t * t1, unsigned char *data,495 static unsigned int t1_compute_checksum(t1_state_t * t1, unsigned char *data, 497 496 size_t len) 498 497 { … … 500 499 } 501 500 502 int t1_verify_checksum(t1_state_t * t1, unsigned char *rbuf, size_t len)501 static int t1_verify_checksum(t1_state_t * t1, unsigned char *rbuf, size_t len) 503 502 { 504 503 unsigned char csum[2]; … … 521 520 * Send/receive block 522 521 */ 523 int t1_xcv(t1_state_t * t1, unsigned char *block, size_t slen, size_t rmax)522 static int t1_xcv(t1_state_t * t1, unsigned char *block, size_t slen, size_t rmax) 524 523 { 525 524 ifd_protocol_t *prot = &t1->base; -
trunk/src/ifd/reader.c
r949 r950 10 10 #include <signal.h> 11 11 #include <time.h> 12 #include <openct/driver.h>13 12 14 13 static int ifd_recv_atr(ifd_device_t *, ct_buf_t *, unsigned int, int); … … 80 79 } 81 80 81 #if 0 82 82 /* 83 83 * Set the serial speed at which we communicate with the … … 95 95 return rc; 96 96 } 97 #endif 97 98 98 99 /* … … 340 341 } 341 342 342 int ifd_recv_atr(ifd_device_t * dev, ct_buf_t * bp, unsigned int count,343 static int ifd_recv_atr(ifd_device_t * dev, ct_buf_t * bp, unsigned int count, 343 344 int revert_bits) 344 345 { -
trunk/src/ifd/ria.c
r851 r950 100 100 } 101 101 102 int ria_recv(ria_client_t * clnt, unsigned char expect, uint32_t xid,102 static int ria_recv(ria_client_t * clnt, unsigned char expect, uint32_t xid, 103 103 void *res_buf, size_t res_len, long timeout) 104 104 { … … 186 186 } 187 187 188 int ria_claim_device(ria_client_t * clnt, const char *name, ria_device_t * info)188 static int ria_claim_device(ria_client_t * clnt, const char *name, ria_device_t * info) 189 189 { 190 190 return ria_command(clnt, RIA_MGR_CLAIM, name, strlen(name), -
trunk/src/ifd/serial.c
r893 r950 480 480 }; 481 481 482 unsigned int speed_to_termios(unsigned int speed)482 static unsigned int speed_to_termios(unsigned int speed) 483 483 { 484 484 unsigned int n; … … 492 492 } 493 493 494 unsigned int termios_to_speed(unsigned int bits)494 static unsigned int termios_to_speed(unsigned int bits) 495 495 { 496 496 unsigned int n; -
trunk/src/ifd/usb-descriptors.c
r942 r950 248 248 } 249 249 250 int ifd_usb_parse_configuration(struct ifd_usb_config_descriptor *config,250 static int ifd_usb_parse_configuration(struct ifd_usb_config_descriptor *config, 251 251 unsigned char *buffer) 252 252 {
Note: See TracChangeset
for help on using the changeset viewer.
