1 | /*- |
---|
2 | * Copyright (c) 2012-2013 Universitetet i Oslo |
---|
3 | * All rights reserved. |
---|
4 | * |
---|
5 | * Redistribution and use in source and binary forms, with or without |
---|
6 | * modification, are permitted provided that the following conditions |
---|
7 | * are met: |
---|
8 | * 1. Redistributions of source code must retain the above copyright |
---|
9 | * notice, this list of conditions and the following disclaimer. |
---|
10 | * 2. Redistributions in binary form must reproduce the above copyright |
---|
11 | * notice, this list of conditions and the following disclaimer in the |
---|
12 | * documentation and/or other materials provided with the distribution. |
---|
13 | * 3. The name of the author may not be used to endorse or promote |
---|
14 | * products derived from this software without specific prior written |
---|
15 | * permission. |
---|
16 | * |
---|
17 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND |
---|
18 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
---|
19 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
---|
20 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE |
---|
21 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
---|
22 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
---|
23 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
---|
24 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
---|
25 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
---|
26 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
---|
27 | * SUCH DAMAGE. |
---|
28 | * |
---|
29 | * $Id: oath_constants.h 679 2013-03-18 21:38:58Z des $ |
---|
30 | */ |
---|
31 | |
---|
32 | #ifndef OATH_CONSTANTS_H_INCLUDED |
---|
33 | #define OATH_CONSTANTS_H_INCLUDED |
---|
34 | |
---|
35 | /* |
---|
36 | * OATH modes |
---|
37 | */ |
---|
38 | enum oath_mode { |
---|
39 | om_undef, /* not set / default */ |
---|
40 | om_hotp, /* RFC 4226 HOTP */ |
---|
41 | om_totp, /* RFC 6238 TOTP */ |
---|
42 | om_max |
---|
43 | }; |
---|
44 | |
---|
45 | /* |
---|
46 | * Hash functions |
---|
47 | */ |
---|
48 | enum oath_hash { |
---|
49 | oh_undef, /* not set / default */ |
---|
50 | oh_md5, /* RFC 1321 MD5 */ |
---|
51 | oh_sha1, /* FIPS 180 SHA-1 */ |
---|
52 | oh_sha256, /* FIPS 180 SHA-256 */ |
---|
53 | oh_sha512, /* FIPS 180 SHA-512 */ |
---|
54 | oh_max |
---|
55 | }; |
---|
56 | |
---|
57 | /* |
---|
58 | * Default time step for TOTP: 30 seconds. |
---|
59 | */ |
---|
60 | #define OATH_DEF_TIMESTEP 30 |
---|
61 | |
---|
62 | /* |
---|
63 | * Maximum time step for TOTP: 10 minutes, which RFC 6238 cites as an |
---|
64 | * example of an unreasonably large time step. |
---|
65 | */ |
---|
66 | #define OATH_MAX_TIMESTEP 600 |
---|
67 | |
---|
68 | /* |
---|
69 | * Maximum key length in bytes. HMAC has a 64-byte block size; if the key |
---|
70 | * K is longer than that, HMAC derives a new key K' = H(K). |
---|
71 | */ |
---|
72 | #define OATH_MAX_KEYLEN 64 |
---|
73 | |
---|
74 | /* |
---|
75 | * Maximum label length in characters, including terminating NUL. |
---|
76 | */ |
---|
77 | #define OATH_MAX_LABELLEN 64 |
---|
78 | |
---|
79 | /* |
---|
80 | * Label to use for dummy keys |
---|
81 | */ |
---|
82 | #define OATH_DUMMY_LABEL "oath-dummy-key" |
---|
83 | |
---|
84 | #endif |
---|