1
/* ccid-driver.c - USB ChipCardInterfaceDevices driver
2
* Copyright (C) 2003 Free Software Foundation, Inc.
4
* This file is part of GnuPG.
6
* GnuPG is free software; you can redistribute it and/or modify
7
* it under the terms of the GNU General Public License as published by
8
* the Free Software Foundation; either version 2 of the License, or
9
* (at your option) any later version.
11
* GnuPG is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
* GNU General Public License for more details.
16
* You should have received a copy of the GNU General Public License
17
* along with this program; if not, write to the Free Software
18
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
20
* ALTERNATIVELY, this file may be distributed under the terms of the
21
* following license, in which case the provisions of this license are
22
* required INSTEAD OF the GNU General Public License. If you wish to
23
* allow use of your version of this file only under the terms of the
24
* GNU General Public License, and not to allow others to use your
25
* version of this file under the terms of the following license,
26
* indicate your decision by deleting this paragraph and the license
29
* Redistribution and use in source and binary forms, with or without
30
* modification, are permitted provided that the following conditions
32
* 1. Redistributions of source code must retain the above copyright
33
* notice, and the entire permission notice in its entirety,
34
* including the disclaimer of warranties.
35
* 2. Redistributions in binary form must reproduce the above copyright
36
* notice, this list of conditions and the following disclaimer in the
37
* documentation and/or other materials provided with the distribution.
38
* 3. The name of the author may not be used to endorse or promote
39
* products derived from this software without specific prior
42
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
43
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
44
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
45
* DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
46
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
47
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
48
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
49
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
50
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
51
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
52
* OF THE POSSIBILITY OF SUCH DAMAGE.
54
* $Id: ccid-driver.h,v 1.1.2.9 2004/10/14 09:12:36 werner Exp $
60
/* The CID driver returns the same error codes as the statsu words
61
used by GnuPG's apdu.h. For ease of maintenance they should always
63
#define CCID_DRIVER_ERR_OUT_OF_CORE 0x10001
64
#define CCID_DRIVER_ERR_INV_VALUE 0x10002
65
#define CCID_DRIVER_ERR_INCOMPLETE_CARD_RESPONSE = 0x10003
66
#define CCID_DRIVER_ERR_NO_DRIVER 0x10004
67
#define CCID_DRIVER_ERR_NOT_SUPPORTED 0x10005
68
#define CCID_DRIVER_ERR_LOCKING_FAILED 0x10006
69
#define CCID_DRIVER_ERR_BUSY 0x10007
70
#define CCID_DRIVER_ERR_NO_CARD 0x10008
71
#define CCID_DRIVER_ERR_CARD_INACTIVE 0x10009
72
#define CCID_DRIVER_ERR_CARD_IO_ERROR 0x1000a
73
#define CCID_DRIVER_ERR_GENERAL_ERROR 0x1000b
74
#define CCID_DRIVER_ERR_NO_READER 0x1000c
75
#define CCID_DRIVER_ERR_ABORTED 0x1000d
78
typedef struct ccid_driver_s *ccid_driver_t;
80
int ccid_set_debug_level (int level);
81
char *ccid_get_reader_list (void);
82
int ccid_open_reader (ccid_driver_t *handle, const char *readerid);
83
int ccid_shutdown_reader (ccid_driver_t handle);
84
int ccid_close_reader (ccid_driver_t handle);
85
int ccid_get_atr (ccid_driver_t handle,
86
unsigned char *atr, size_t maxatrlen, size_t *atrlen);
87
int ccid_slot_status (ccid_driver_t handle, int *statusbits);
88
int ccid_transceive (ccid_driver_t handle,
89
const unsigned char *apdu, size_t apdulen,
90
unsigned char *resp, size_t maxresplen, size_t *nresp);
91
int ccid_transceive_secure (ccid_driver_t handle,
92
const unsigned char *apdu, size_t apdulen,
94
int pinlen_min, int pinlen_max, int pin_padlen,
95
unsigned char *resp, size_t maxresplen, size_t *nresp);
99
#endif /*CCID_DRIVER_H*/