3
* $Id: cryptocard.h,v 1.37.2.1 2005/12/08 01:30:54 fcusack Exp $
5
* This program is free software; you can redistribute it and/or modify
6
* it under the terms of the GNU General Public License as published by
7
* the Free Software Foundation; either version 2 of the License, or
8
* (at your option) any later version.
10
* This program 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
13
* GNU General Public License for more details.
15
* You should have received a copy of the GNU General Public License
16
* along with this program; if not, write to the Free Software
17
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19
* Copyright 2005 TRI-D Systems, Inc.
26
#include "../otp_cardops.h"
29
#define CRYPTOCARD_H8_RC (OTP_CF_HD|OTP_CF_R8|OTP_CF_AM|OTP_CF_C8)
30
#define CRYPTOCARD_H7_RC (OTP_CF_HD|OTP_CF_R7|OTP_CF_AM|OTP_CF_C8)
31
#define CRYPTOCARD_D8_RC (OTP_CF_DD|OTP_CF_R8|OTP_CF_AM|OTP_CF_C8)
32
#define CRYPTOCARD_D7_RC (OTP_CF_DD|OTP_CF_R7|OTP_CF_AM|OTP_CF_C8)
33
#define CRYPTOCARD_H8_ES (OTP_CF_HD|OTP_CF_R8|OTP_CF_ES|OTP_CF_C8)
34
#define CRYPTOCARD_H7_ES (OTP_CF_HD|OTP_CF_R7|OTP_CF_ES|OTP_CF_C8)
35
#define CRYPTOCARD_D8_ES (OTP_CF_DD|OTP_CF_R8|OTP_CF_ES|OTP_CF_C8)
36
#define CRYPTOCARD_D7_ES (OTP_CF_DD|OTP_CF_R7|OTP_CF_ES|OTP_CF_C8)
37
#define CRYPTOCARD_H8_RS (CRYPTOCARD_H8_RC|CRYPTOCARD_H8_ES)
38
#define CRYPTOCARD_H7_RS (CRYPTOCARD_H7_RC|CRYPTOCARD_H7_ES)
39
#define CRYPTOCARD_D8_RS (CRYPTOCARD_D8_RC|CRYPTOCARD_D8_ES)
40
#define CRYPTOCARD_D7_RS (CRYPTOCARD_D7_RC|CRYPTOCARD_D7_ES)
42
static int cryptocard_name2fm(const char *, uint32_t *);
43
static int cryptocard_keystring2keyblock(const char *,
44
unsigned char [OTP_MAX_KEY_LEN]);
45
static int cryptocard_nullstate(const otp_option_t *, const otp_card_info_t *,
46
otp_user_state_t *, time_t, const char *);
47
static int cryptocard_challenge(const otp_card_info_t *, otp_user_state_t *,
48
unsigned char [OTP_MAX_CHALLENGE_LEN], time_t,
49
int, int, const char *);
50
static int cryptocard_response(otp_card_info_t *,
51
const unsigned char [OTP_MAX_CHALLENGE_LEN],
52
size_t, char [OTP_MAX_RESPONSE_LEN + 1],
54
static int cryptocard_updatecsd(otp_user_state_t *, time_t, int, int, int);
55
static int cryptocard_isconsecutive(const otp_card_info_t *,
56
const otp_user_state_t *, int,
58
static int cryptocard_maxtwin(const otp_card_info_t *,
59
const char [OTP_MAX_CSD_LEN + 1]);
60
static char *cryptocard_printchallenge(char [OTP_MAX_CHALLENGE_LEN * 2 + 1],
61
const unsigned char [OTP_MAX_CHALLENGE_LEN],
65
__attribute__ ((constructor))
67
void cryptocard_init(void);
69
#endif /* CRYPTOCARD_H */