~ubuntu-branches/ubuntu/jaunty/freeradius/jaunty-updates

« back to all changes in this revision

Viewing changes to src/modules/rlm_otp/cardops/cryptocard.h

  • Committer: Bazaar Package Importer
  • Author(s): Paul Hampson
  • Date: 2006-01-15 13:34:13 UTC
  • mto: (3.1.3 dapper)
  • mto: This revision was merged to the branch mainline in revision 4.
  • Revision ID: james.westby@ubuntu.com-20060115133413-zo1dslttvdoalqym
Tags: upstream-1.1.0
ImportĀ upstreamĀ versionĀ 1.1.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * cryptocard.h
 
3
 * $Id: cryptocard.h,v 1.37.2.1 2005/12/08 01:30:54 fcusack Exp $
 
4
 *
 
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.
 
9
 *
 
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.
 
14
 *
 
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
 
18
 *
 
19
 * Copyright 2005 TRI-D Systems, Inc.
 
20
 */
 
21
 
 
22
#ifndef CRYPTOCARD_H
 
23
#define CRYPTOCARD_H
 
24
 
 
25
#include "../otp.h"
 
26
#include "../otp_cardops.h"
 
27
 
 
28
/* card modes */
 
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)
 
41
 
 
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],
 
53
                               const char *);
 
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,
 
57
                                    const char *);
 
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],
 
62
                                       size_t);
 
63
 
 
64
#ifdef __GNUC__
 
65
__attribute__ ((constructor))
 
66
#endif
 
67
void cryptocard_init(void);
 
68
 
 
69
#endif /* CRYPTOCARD_H */