Annotation of src/usr.bin/telnet/encrypt.h, Revision 1.1
1.1 ! deraadt 1: /*-
! 2: * Copyright (c) 1991, 1993
! 3: * The Regents of the University of California. All rights reserved.
! 4: *
! 5: * Redistribution and use in source and binary forms, with or without
! 6: * modification, are permitted provided that the following conditions
! 7: * are met:
! 8: * 1. Redistributions of source code must retain the above copyright
! 9: * notice, this list of conditions and the following disclaimer.
! 10: * 2. Redistributions in binary form must reproduce the above copyright
! 11: * notice, this list of conditions and the following disclaimer in the
! 12: * documentation and/or other materials provided with the distribution.
! 13: * 3. Neither the name of the University nor the names of its contributors
! 14: * may be used to endorse or promote products derived from this software
! 15: * without specific prior written permission.
! 16: *
! 17: * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
! 18: * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
! 19: * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
! 20: * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
! 21: * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
! 22: * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
! 23: * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
! 24: * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
! 25: * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
! 26: * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
! 27: * SUCH DAMAGE.
! 28: *
! 29: * from: @(#)encrypt.h 8.1 (Berkeley) 6/4/93
! 30: * $OpenBSD: encrypt.h,v 1.2 2003/06/02 19:38:25 millert Exp $
! 31: * $NetBSD: encrypt.h,v 1.4 1996/02/24 01:15:20 jtk Exp $
! 32: */
! 33:
! 34: /*
! 35: * This source code is no longer held under any constraint of USA
! 36: * `cryptographic laws' since it was exported legally. The cryptographic
! 37: * functions were removed from the code and a "Bones" distribution was
! 38: * made. A Commodity Jurisdiction Request #012-94 was filed with the
! 39: * USA State Department, who handed it to the Commerce department. The
! 40: * code was determined to fall under General License GTDA under ECCN 5D96G,
! 41: * and hence exportable. The cryptographic interfaces were re-added by Eric
! 42: * Young, and then KTH proceeded to maintain the code in the free world.
! 43: */
! 44:
! 45: /*
! 46: * Copyright (C) 1990 by the Massachusetts Institute of Technology
! 47: *
! 48: * Export of this software from the United States of America is assumed
! 49: * to require a specific license from the United States Government.
! 50: * It is the responsibility of any person or organization contemplating
! 51: * export to obtain such a license before exporting.
! 52: *
! 53: * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
! 54: * distribute this software and its documentation for any purpose and
! 55: * without fee is hereby granted, provided that the above copyright
! 56: * notice appear in all copies and that both that copyright notice and
! 57: * this permission notice appear in supporting documentation, and that
! 58: * the name of M.I.T. not be used in advertising or publicity pertaining
! 59: * to distribution of the software without specific, written prior
! 60: * permission. M.I.T. makes no representations about the suitability of
! 61: * this software for any purpose. It is provided "as is" without express
! 62: * or implied warranty.
! 63: */
! 64:
! 65: /* $KTH: encrypt.h,v 1.4 1997/01/24 23:10:56 assar Exp $ */
! 66:
! 67: #ifndef __ENCRYPT__
! 68: #define __ENCRYPT__
! 69:
! 70: #define DIR_DECRYPT 1
! 71: #define DIR_ENCRYPT 2
! 72:
! 73: #define VALIDKEY(key) ( key[0] | key[1] | key[2] | key[3] | \
! 74: key[4] | key[5] | key[6] | key[7])
! 75:
! 76: #define SAMEKEY(k1, k2) (!memcmp(k1, k2, sizeof(des_cblock)))
! 77:
! 78: typedef struct {
! 79: short type;
! 80: int length;
! 81: unsigned char *data;
! 82: } Session_Key;
! 83:
! 84: typedef struct {
! 85: char *name;
! 86: int type;
! 87: void (*output) (unsigned char *, int);
! 88: int (*input) (int);
! 89: void (*init) (int);
! 90: int (*start) (int, int);
! 91: int (*is) (unsigned char *, int);
! 92: int (*reply) (unsigned char *, int);
! 93: void (*session) (Session_Key *, int);
! 94: int (*keyid) (int, unsigned char *, int *);
! 95: void (*printsub) (unsigned char *, int, unsigned char *, int);
! 96: } Encryptions;
! 97:
! 98: #define SK_DES 1 /* Matched Kerberos v5 KEYTYPE_DES */
! 99:
! 100: #include "enc-proto.h"
! 101:
! 102: extern int encrypt_debug_mode;
! 103: extern int (*decrypt_input) (int);
! 104: extern void (*encrypt_output) (unsigned char *, int);
! 105: #endif