1 /* $NetBSD: auth.h,v 1.9 2015/05/16 23:31:32 roy Exp $ */
4 * dhcpcd - DHCP client daemon
5 * Copyright (c) 2006-2015 Roy Marples <roy@marples.name>
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
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
35 #ifdef HAVE_SYS_QUEUE_H
36 #include <sys/queue.h>
39 #define DHCPCD_AUTH_SEND (1 << 0)
40 #define DHCPCD_AUTH_REQUIRE (1 << 1)
41 #define DHCPCD_AUTH_RDM_COUNTER (1 << 2)
43 #define DHCPCD_AUTH_SENDREQUIRE (DHCPCD_AUTH_SEND | DHCPCD_AUTH_REQUIRE)
45 #define AUTH_PROTO_TOKEN 0
46 #define AUTH_PROTO_DELAYED 1
47 #define AUTH_PROTO_DELAYEDREALM 2
48 #define AUTH_PROTO_RECONFKEY 3
50 #define AUTH_ALG_HMAC_MD5 1
52 #define AUTH_RDM_MONOTONIC 0
55 TAILQ_ENTRY(token
) next
;
64 TAILQ_HEAD(token_head
, token
);
72 uint8_t last_replay_set
;
73 struct token_head tokens
;
82 void dhcp_auth_reset(struct authstate
*);
84 const struct token
* dhcp_auth_validate(struct authstate
*,
86 const uint8_t *, size_t, int, int,
87 const uint8_t *, size_t);
89 ssize_t
dhcp_auth_encode(struct auth
*, const struct token
*,
90 uint8_t *, size_t, int, int,