181464Sbrian/*-
281464Sbrian * Copyright (c) 1997        Gabor Kincses <gabor@acm.org>
381464Sbrian *               1997 - 2001 Brian Somers <brian@Awfulhak.org>
481464Sbrian *          based on work by Eric Rosenquist
581464Sbrian *                           Strata Software Limited.
629841Sbrian * All rights reserved.
729841Sbrian *
881464Sbrian * Redistribution and use in source and binary forms, with or without
981464Sbrian * modification, are permitted provided that the following conditions
1081464Sbrian * are met:
1181464Sbrian * 1. Redistributions of source code must retain the above copyright
1281464Sbrian *    notice, this list of conditions and the following disclaimer.
1381464Sbrian * 2. Redistributions in binary form must reproduce the above copyright
1481464Sbrian *    notice, this list of conditions and the following disclaimer in the
1581464Sbrian *    documentation and/or other materials provided with the distribution.
1629841Sbrian *
1781464Sbrian * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
1881464Sbrian * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1981464Sbrian * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2081464Sbrian * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
2181464Sbrian * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2281464Sbrian * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2381464Sbrian * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2481464Sbrian * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2581464Sbrian * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2681464Sbrian * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2781464Sbrian * SUCH DAMAGE.
2829841Sbrian *
2950479Speter * $FreeBSD$
3029841Sbrian */
3129841Sbrian
3230715Sbrian/* Max # of (Unicode) chars in an NT password */
3330715Sbrian#define MAX_NT_PASSWORD	256
3429841Sbrian
3598243Sbrian/* Don't rely on sizeof(MS_ChapResponse) in case of struct padding */
3667910Sbrian#define MS_CHAP_RESPONSE_LEN    49
3767910Sbrian#define CHAP81_RESPONSE_LEN     49
3867910Sbrian#define CHAP81_NTRESPONSE_LEN   24
3967910Sbrian#define CHAP81_NTRESPONSE_OFF   24
4067910Sbrian#define CHAP81_HASH_LEN         16
4167910Sbrian#define CHAP81_AUTHRESPONSE_LEN	42
4267910Sbrian#define CHAP81_CHALLENGE_LEN    16
4329841Sbrian
4444106Sbrianextern void mschap_NT(char *, char *);
4544106Sbrianextern void mschap_LANMan(char *, char *, char *);
46134789Sbrianextern void GenerateNTResponse(char *, char *, char *, char *, int , char *);
4767910Sbrianextern void HashNtPasswordHash(char *, char *);
4867910Sbrianextern void NtPasswordHash(char *, int, char *);
49134789Sbrianextern void GenerateAuthenticatorResponse(char *, int, char *, char *, char *, char *, char *);
5067910Sbrianextern void GetAsymetricStartKey(char *, char *, int, int, int);
5167910Sbrianextern void GetMasterKey(char *, char *, char *);
5267910Sbrianextern void GetNewKeyFromSHA(char *, char *, long, char *);
53