chap.c revision 189251
1189251Ssam/*
2189251Ssam * CHAP-MD5 (RFC 1994)
3189251Ssam * Copyright (c) 2007, Jouni Malinen <j@w1.fi>
4189251Ssam *
5189251Ssam * This program is free software; you can redistribute it and/or modify
6189251Ssam * it under the terms of the GNU General Public License version 2 as
7189251Ssam * published by the Free Software Foundation.
8189251Ssam *
9189251Ssam * Alternatively, this software may be distributed under the terms of BSD
10189251Ssam * license.
11189251Ssam *
12189251Ssam * See README and COPYING for more details.
13189251Ssam */
14189251Ssam
15189251Ssam#include "includes.h"
16189251Ssam
17189251Ssam#include "common.h"
18189251Ssam#include "md5.h"
19189251Ssam#include "crypto.h"
20189251Ssam#include "chap.h"
21189251Ssam
22189251Ssamvoid chap_md5(u8 id, const u8 *secret, size_t secret_len, const u8 *challenge,
23189251Ssam	      size_t challenge_len, u8 *response)
24189251Ssam{
25189251Ssam	const u8 *addr[3];
26189251Ssam	size_t len[3];
27189251Ssam
28189251Ssam	addr[0] = &id;
29189251Ssam	len[0] = 1;
30189251Ssam	addr[1] = secret;
31189251Ssam	len[1] = secret_len;
32189251Ssam	addr[2] = challenge;
33189251Ssam	len[2] = challenge_len;
34189251Ssam	md5_vector(3, addr, len, response);
35189251Ssam}
36