1 /* ****************************************************************************
2 
3  * eID Middleware Project.
4  * Copyright (C) 2008-2010 FedICT.
5  *
6  * This is free software; you can redistribute it and/or modify it
7  * under the terms of the GNU Lesser General Public License version
8  * 3.0 as published by the Free Software Foundation.
9  *
10  * This software is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this software; if not, see
17  * http://www.gnu.org/licenses/.
18 
19 **************************************************************************** */
20 #ifndef __GLOBMDRV__H__
21 #define __GLOBMDRV__H__
22 
23 #include <windows.h>
24 #include "bcrypt.h"
25 #include <cardmod.h>
26 #include <stdio.h>
27 
28 //#include "Log.h"
29 //#include "util.h"
30 #include "stdafx.h"
31 
32 #define CLEANUP(i)                        {dwReturn=(i);goto cleanup;}
33 
34 #define MINIDRIVER_VERSION                "1.0.A"
35 
36 #define ROLE_DIGSIG                       ROLE_USER
37 #define ROLE_NONREP                       3
38 
39 #define SIGN_TYPE_NONREP		            1
40 #define SIGN_TYPE_DIGSIG		            2
41 
42 #define FILE_OBJECT_DIRECTORY_TYPE        1
43 #define FILE_OBJECT_FILE_TYPE             2
44 
45 #define MAX_CONTAINERS                    5
46 
47 #define BEID_RSA_CARD	1
48 #define BEID_ECC_CARD	2
49 /*
50 typedef enum
51 {
52 	beidRSACard = 1,
53 	beidECCCard = 2
54 }BEIDCARD_TYPE;
55 */
56 typedef struct _CARD_ATR
57 {
58    BYTE     pbAtr[32];
59    DWORD    cbAtr;
60    BYTE		bBEIDCardType;
61 } CARD_ATR, *PCARD_ATR;
62 
63 typedef struct _VIRTUAL_FILE_OBJECT
64 {
65    BYTE                          szDirectoryName [8 + 1];
66    BYTE                          szFileName      [8 + 1];
67    BYTE                          bObjectType;
68    BYTE                          bAccessCondition;
69    LPVOID                        pObjectData;
70    DWORD                         ObjectDataSize;
71 
72    struct _VIRTUAL_FILE_OBJECT   *pNext;
73 } VIRTUAL_FILE_OBJECT, *PVIRTUAL_FILE_OBJECT;
74 
75 
76 typedef struct _VFO_CONTAINER_INFO
77 {
78    PIN_ID         dwPinId;
79    CONTAINER_INFO ContainerInfo;
80 } VFO_CONTAINER_INFO, *PVFO_CONTAINER_INFO;
81 
82 /************************************************************************************************************************/
83 
84 typedef struct _VENDOR_SPECIFIC
85 {
86 	BYTE bSerialNumberSet;
87 	BYTE szSerialNumber[16];
88 	BYTE bBEIDCardType;
89 } VENDOR_SPECIFIC;
90 
91 /************************************************************************************************************************/
92 
93 #define BEID_READ_BINARY_MAX_LEN    128
94 
95 #define CERT_AUTH                   1
96 #define CERT_NONREP                 2
97 #define CERT_CA                     3
98 #define CERT_ROOTCA                 4
99 
100 #define HASH_ALGO_NONE              0
101 #define HASH_ALGO_MD2               1
102 #define HASH_ALGO_MD4               2
103 #define HASH_ALGO_MD5               3
104 #define HASH_ALGO_SHA1              4
105 #define HASH_ALGO_SHA_256           5
106 #define HASH_ALGO_SHA_384           6
107 #define HASH_ALGO_SHA_512           7
108 
109 /************************************************************************************************************************/
110 
111 #endif
112