Annotation of embedaddon/libpdel/ppp/ppp_auth_chap.h, revision 1.1
1.1 ! misho 1:
! 2: /*
! 3: * Copyright (c) 2001-2002 Packet Design, LLC.
! 4: * All rights reserved.
! 5: *
! 6: * Subject to the following obligations and disclaimer of warranty,
! 7: * use and redistribution of this software, in source or object code
! 8: * forms, with or without modifications are expressly permitted by
! 9: * Packet Design; provided, however, that:
! 10: *
! 11: * (i) Any and all reproductions of the source or object code
! 12: * must include the copyright notice above and the following
! 13: * disclaimer of warranties; and
! 14: * (ii) No rights are granted, in any manner or form, to use
! 15: * Packet Design trademarks, including the mark "PACKET DESIGN"
! 16: * on advertising, endorsements, or otherwise except as such
! 17: * appears in the above copyright notice or in the software.
! 18: *
! 19: * THIS SOFTWARE IS BEING PROVIDED BY PACKET DESIGN "AS IS", AND
! 20: * TO THE MAXIMUM EXTENT PERMITTED BY LAW, PACKET DESIGN MAKES NO
! 21: * REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING
! 22: * THIS SOFTWARE, INCLUDING WITHOUT LIMITATION, ANY AND ALL IMPLIED
! 23: * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE,
! 24: * OR NON-INFRINGEMENT. PACKET DESIGN DOES NOT WARRANT, GUARANTEE,
! 25: * OR MAKE ANY REPRESENTATIONS REGARDING THE USE OF, OR THE RESULTS
! 26: * OF THE USE OF THIS SOFTWARE IN TERMS OF ITS CORRECTNESS, ACCURACY,
! 27: * RELIABILITY OR OTHERWISE. IN NO EVENT SHALL PACKET DESIGN BE
! 28: * LIABLE FOR ANY DAMAGES RESULTING FROM OR ARISING OUT OF ANY USE
! 29: * OF THIS SOFTWARE, INCLUDING WITHOUT LIMITATION, ANY DIRECT,
! 30: * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, PUNITIVE, OR CONSEQUENTIAL
! 31: * DAMAGES, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, LOSS OF
! 32: * USE, DATA OR PROFITS, HOWEVER CAUSED AND UNDER ANY THEORY OF
! 33: * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
! 34: * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
! 35: * THE USE OF THIS SOFTWARE, EVEN IF PACKET DESIGN IS ADVISED OF
! 36: * THE POSSIBILITY OF SUCH DAMAGE.
! 37: *
! 38: * Author: Archie Cobbs <archie@freebsd.org>
! 39: */
! 40:
! 41: #ifndef _PDEL_PPP_PPP_AUTH_CHAP_H_
! 42: #define _PDEL_PPP_PPP_AUTH_CHAP_H_
! 43:
! 44: struct ppp_log;
! 45: struct ppp_auth_cred_chap;
! 46:
! 47: /*
! 48: * CHAP function to set ID in credentials structure
! 49: */
! 50: typedef void ppp_auth_chap_set_id_t(struct ppp_auth_cred_chap *cred,
! 51: u_char id);
! 52:
! 53: /*
! 54: * CHAP hash function
! 55: *
! 56: * Should put the hash value into "cred", using the id and challenge
! 57: * value in "cred" and the supplied secret.
! 58: *
! 59: * This function is for client code's use.
! 60: */
! 61: typedef void ppp_auth_chap_hash_t(struct ppp_auth_cred_chap *cred,
! 62: const void *secret, size_t slen);
! 63:
! 64: /*
! 65: * CHAP compare function
! 66: *
! 67: * Should compare the two hash values and return 1 if they
! 68: * agree, otherwise zero.
! 69: *
! 70: * This function is for client code's use.
! 71: */
! 72: typedef int ppp_auth_chap_equal_t(struct ppp_auth_cred_chap *cred1,
! 73: struct ppp_auth_cred_chap *cred2);
! 74:
! 75: /*
! 76: * CHAP final function
! 77: *
! 78: * Handle any final action such as Microsoft ACK overloading in MS-CHAPv2.
! 79: * This is called after recieving an ACK when we are authenticating
! 80: * to the peer.
! 81: */
! 82: typedef int ppp_auth_chap_final_t(struct ppp_auth_cred_chap *cred,
! 83: struct ppp_log *log, int valid, const u_char *payload,
! 84: size_t len, const u_char *authresp);
! 85:
! 86: /* CHAP type methods */
! 87: struct ppp_auth_chap_type {
! 88: ppp_auth_chap_set_id_t *set_id; /* set 'id' in cred */
! 89: ppp_auth_chap_hash_t *hash; /* hash method */
! 90: ppp_auth_chap_equal_t *equal; /* compare method */
! 91: ppp_auth_chap_final_t *final; /* final method */
! 92: u_char cfixed; /* fixed challenge length */
! 93: u_int clen; /* challenge length */
! 94: u_int roff; /* response offset */
! 95: u_int rlen; /* response length */
! 96: };
! 97:
! 98: __BEGIN_DECLS
! 99:
! 100: /* Supported CHAP types */
! 101: extern const struct ppp_auth_chap_type ppp_auth_chap_md5;
! 102: extern const struct ppp_auth_chap_type ppp_auth_chap_msv1;
! 103: extern const struct ppp_auth_chap_type ppp_auth_chap_msv2;
! 104:
! 105: __END_DECLS
! 106:
! 107: #ifdef _PDEL_PPP_PRIVATE_H_
! 108:
! 109: /* MS-CHAP errors */
! 110: struct mschap_err {
! 111: int err;
! 112: const char *msg;
! 113: };
! 114:
! 115: __BEGIN_DECLS
! 116:
! 117: /* Auth type methods for CHAP */
! 118: extern ppp_authtype_start_t ppp_auth_chap_start;
! 119: extern ppp_authtype_cancel_t ppp_auth_chap_cancel;
! 120: extern ppp_authtype_input_t ppp_auth_chap_input;
! 121:
! 122: extern const struct mschap_err ppp_mschap_errs[];
! 123:
! 124: __END_DECLS
! 125:
! 126: #endif /* _PDEL_PPP_PRIVATE_H_ */
! 127:
! 128: #endif /* _PDEL_PPP_PPP_AUTH_CHAP_H_ */
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>