1189251Ssam/*
2189251Ssam * CHAP-MD5 (RFC 1994)
3214734Srpaulo * Copyright (c) 2007-2009, Jouni Malinen <j@w1.fi>
4189251Ssam *
5252726Srpaulo * This software may be distributed under the terms of the BSD license.
6252726Srpaulo * See README for more details.
7189251Ssam */
8189251Ssam
9189251Ssam#include "includes.h"
10189251Ssam
11189251Ssam#include "common.h"
12214734Srpaulo#include "crypto/crypto.h"
13189251Ssam#include "chap.h"
14189251Ssam
15214734Srpauloint chap_md5(u8 id, const u8 *secret, size_t secret_len, const u8 *challenge,
16189251Ssam	      size_t challenge_len, u8 *response)
17189251Ssam{
18189251Ssam	const u8 *addr[3];
19189251Ssam	size_t len[3];
20189251Ssam
21189251Ssam	addr[0] = &id;
22189251Ssam	len[0] = 1;
23189251Ssam	addr[1] = secret;
24189251Ssam	len[1] = secret_len;
25189251Ssam	addr[2] = challenge;
26189251Ssam	len[2] = challenge_len;
27214734Srpaulo	return md5_vector(3, addr, len, response);
28189251Ssam}
29