1/* 2 * Copyright (c) 2003 Apple Computer, Inc. All rights reserved. 3 * 4 * @APPLE_LICENSE_HEADER_START@ 5 * 6 * This file contains Original Code and/or Modifications of Original Code 7 * as defined in and that are subject to the Apple Public Source License 8 * Version 2.0 (the 'License'). You may not use this file except in 9 * compliance with the License. Please obtain a copy of the License at 10 * http://www.opensource.apple.com/apsl/ and read it before using this 11 * file. 12 * 13 * The Original Code and all software distributed under the License are 14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 18 * Please see the License for the specific language governing rights and 19 * limitations under the License. 20 * 21 * @APPLE_LICENSE_HEADER_END@ 22 */ 23/* 24 * chap_ms.h - Challenge Handshake Authentication Protocol definitions. 25 * 26 * Copyright (c) 1995 Eric Rosenquist. All rights reserved. 27 * 28 * Redistribution and use in source and binary forms, with or without 29 * modification, are permitted provided that the following conditions 30 * are met: 31 * 32 * 1. Redistributions of source code must retain the above copyright 33 * notice, this list of conditions and the following disclaimer. 34 * 35 * 2. Redistributions in binary form must reproduce the above copyright 36 * notice, this list of conditions and the following disclaimer in 37 * the documentation and/or other materials provided with the 38 * distribution. 39 * 40 * 3. The name(s) of the authors of this software must not be used to 41 * endorse or promote products derived from this software without 42 * prior written permission. 43 * 44 * THE AUTHORS OF THIS SOFTWARE DISCLAIM ALL WARRANTIES WITH REGARD TO 45 * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY 46 * AND FITNESS, IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY 47 * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 48 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN 49 * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING 50 * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 51 * 52 */ 53 54#ifndef __CHAPMS_INCLUDE__ 55 56/* 57 * Values for the code field. 58 */ 59#define MS_CHAP2_CHANGE_PASSWORD 7 60 61 62#define MD4_SIGNATURE_SIZE 16 /* 16 bytes in a MD4 message digest */ 63#define MAX_NT_PASSWORD 256 /* Max (Unicode) chars in an NT pass */ 64 65#define MS_CHAP_RESPONSE_LEN 49 /* Response length for MS-CHAP */ 66#define MS_CHAP2_RESPONSE_LEN 49 /* Response length for MS-CHAPv2 */ 67#define MS_AUTH_RESPONSE_LENGTH 40 /* MS-CHAPv2 authenticator response, */ 68 /* as ASCII */ 69#define MS_CHAP2_CHANGE_PASSWORD_LEN 582 /* Change Password length for MS-CHAPv2 */ 70 71/* E=eeeeeeeeee error codes for MS-CHAP failure messages. */ 72#define MS_CHAP_ERROR_RESTRICTED_LOGON_HOURS 646 73#define MS_CHAP_ERROR_ACCT_DISABLED 647 74#define MS_CHAP_ERROR_PASSWD_EXPIRED 648 75#define MS_CHAP_ERROR_NO_DIALIN_PERMISSION 649 76#define MS_CHAP_ERROR_AUTHENTICATION_FAILURE 691 77#define MS_CHAP_ERROR_CHANGING_PASSWORD 709 78 79/* 80 * Use MS_CHAP_RESPONSE_LEN, rather than sizeof(MS_ChapResponse), 81 * in case this struct gets padded. 82 */ 83typedef struct { 84 u_char LANManResp[24]; 85 u_char NTResp[24]; 86 u_char UseNT[1]; /* If 1, ignore the LANMan response field */ 87} MS_ChapResponse; 88 89/* 90 * Use MS_CHAP2_RESPONSE_LEN, rather than sizeof(MS_Chap2Response), 91 * in case this struct gets padded. 92 */ 93typedef struct { 94 u_char PeerChallenge[16]; 95 u_char Reserved[8]; /* Must be zero */ 96 u_char NTResp[24]; 97 u_char Flags[1]; /* Must be zero */ 98} MS_Chap2Response; 99 100#ifdef MPPE 101//#include <net/ppp-comp.h> /* MPPE_MAX_KEY_LEN */ 102#include <ppp_comp.h> 103extern u_char mppe_send_key[MPPE_MAX_KEY_LEN]; 104extern u_char mppe_recv_key[MPPE_MAX_KEY_LEN]; 105extern int mppe_keys_set; 106 107/* These values are the RADIUS attribute values--see RFC 2548. */ 108#define MPPE_ENC_POL_ENC_ALLOWED 1 109#define MPPE_ENC_POL_ENC_REQUIRED 2 110#define MPPE_ENC_TYPES_RC4_40 2 111#define MPPE_ENC_TYPES_RC4_128 4 112 113/* used by plugins (using above values) */ 114extern void set_mppe_enc_types(int, int); 115#endif 116 117/* Are we the authenticator or authenticatee? For MS-CHAPv2 key derivation. */ 118#define MS_CHAP2_AUTHENTICATEE 0 119#define MS_CHAP2_AUTHENTICATOR 1 120 121void ChapMS __P((u_char *, u_char *, int, MS_ChapResponse *)); 122void ChapMS2 __P((u_char *, u_char *, char *, u_char *, int, 123 MS_Chap2Response *, u_char[MS_AUTH_RESPONSE_LENGTH+1], int)); 124#ifdef MPPE 125void mppe_set_keys __P((u_char *, u_char[MD4_SIGNATURE_SIZE])); 126#endif 127 128void chapms_init(void); 129#ifdef __APPLE__ 130void chapms_reinit(void); 131#endif 132 133#define __CHAPMS_INCLUDE__ 134#endif /* __CHAPMS_INCLUDE__ */ 135