181cb6ddcSMark Murray /*- 281cb6ddcSMark Murray * Copyright (c) 1991, 1993 381cb6ddcSMark Murray * The Regents of the University of California. All rights reserved. 481cb6ddcSMark Murray * 581cb6ddcSMark Murray * Redistribution and use in source and binary forms, with or without 681cb6ddcSMark Murray * modification, are permitted provided that the following conditions 781cb6ddcSMark Murray * are met: 881cb6ddcSMark Murray * 1. Redistributions of source code must retain the above copyright 981cb6ddcSMark Murray * notice, this list of conditions and the following disclaimer. 1081cb6ddcSMark Murray * 2. Redistributions in binary form must reproduce the above copyright 1181cb6ddcSMark Murray * notice, this list of conditions and the following disclaimer in the 1281cb6ddcSMark Murray * documentation and/or other materials provided with the distribution. 1381cb6ddcSMark Murray * 3. All advertising materials mentioning features or use of this software 1481cb6ddcSMark Murray * must display the following acknowledgement: 1581cb6ddcSMark Murray * This product includes software developed by the University of 1681cb6ddcSMark Murray * California, Berkeley and its contributors. 1781cb6ddcSMark Murray * 4. Neither the name of the University nor the names of its contributors 1881cb6ddcSMark Murray * may be used to endorse or promote products derived from this software 1981cb6ddcSMark Murray * without specific prior written permission. 2081cb6ddcSMark Murray * 2181cb6ddcSMark Murray * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 2281cb6ddcSMark Murray * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 2381cb6ddcSMark Murray * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 2481cb6ddcSMark Murray * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 2581cb6ddcSMark Murray * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 2681cb6ddcSMark Murray * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 2781cb6ddcSMark Murray * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 2881cb6ddcSMark Murray * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 2981cb6ddcSMark Murray * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 3081cb6ddcSMark Murray * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 3181cb6ddcSMark Murray * SUCH DAMAGE. 3281cb6ddcSMark Murray * 3381cb6ddcSMark Murray * @(#)encrypt.h 8.1 (Berkeley) 6/4/93 34bf4f84d4SMark Murray * $FreeBSD$ 3581cb6ddcSMark Murray */ 3681cb6ddcSMark Murray 3781cb6ddcSMark Murray /* 3881cb6ddcSMark Murray * Copyright (C) 1990 by the Massachusetts Institute of Technology 3981cb6ddcSMark Murray * 4081cb6ddcSMark Murray * Export of this software from the United States of America is assumed 4181cb6ddcSMark Murray * to require a specific license from the United States Government. 4281cb6ddcSMark Murray * It is the responsibility of any person or organization contemplating 4381cb6ddcSMark Murray * export to obtain such a license before exporting. 4481cb6ddcSMark Murray * 4581cb6ddcSMark Murray * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and 4681cb6ddcSMark Murray * distribute this software and its documentation for any purpose and 4781cb6ddcSMark Murray * without fee is hereby granted, provided that the above copyright 4881cb6ddcSMark Murray * notice appear in all copies and that both that copyright notice and 4981cb6ddcSMark Murray * this permission notice appear in supporting documentation, and that 5081cb6ddcSMark Murray * the name of M.I.T. not be used in advertising or publicity pertaining 5181cb6ddcSMark Murray * to distribution of the software without specific, written prior 5281cb6ddcSMark Murray * permission. M.I.T. makes no representations about the suitability of 5381cb6ddcSMark Murray * this software for any purpose. It is provided "as is" without express 5481cb6ddcSMark Murray * or implied warranty. 5581cb6ddcSMark Murray */ 5681cb6ddcSMark Murray 5781cb6ddcSMark Murray #ifdef ENCRYPTION 5881cb6ddcSMark Murray # ifndef __ENCRYPTION__ 5981cb6ddcSMark Murray # define __ENCRYPTION__ 6081cb6ddcSMark Murray 6181cb6ddcSMark Murray #define DIR_DECRYPT 1 6281cb6ddcSMark Murray #define DIR_ENCRYPT 2 6381cb6ddcSMark Murray 64bf4f84d4SMark Murray #include <openssl/des.h> 6581cb6ddcSMark Murray typedef unsigned char Block[8]; 6681cb6ddcSMark Murray typedef unsigned char *BlockT; 670f8c8396SNick Sayer #if 0 6804c426ccSMark Murray typedef struct { Block __; } Schedule[16]; 690f8c8396SNick Sayer #else 70*b285c5dfSJung-uk Kim #define Schedule DES_key_schedule 710f8c8396SNick Sayer #endif 7281cb6ddcSMark Murray 7381cb6ddcSMark Murray #define VALIDKEY(key) ( key[0] | key[1] | key[2] | key[3] | \ 7481cb6ddcSMark Murray key[4] | key[5] | key[6] | key[7]) 7581cb6ddcSMark Murray 7681cb6ddcSMark Murray #define SAMEKEY(k1, k2) (!bcmp((void *)k1, (void *)k2, sizeof(Block))) 7781cb6ddcSMark Murray 7881cb6ddcSMark Murray typedef struct { 7981cb6ddcSMark Murray short type; 8081cb6ddcSMark Murray int length; 8181cb6ddcSMark Murray unsigned char *data; 8281cb6ddcSMark Murray } Session_Key; 8381cb6ddcSMark Murray 8481cb6ddcSMark Murray typedef struct { 858fa113e5SMark Murray const char *name; 8681cb6ddcSMark Murray int type; 878fa113e5SMark Murray void (*output)(unsigned char *, int); 888fa113e5SMark Murray int (*input)(int); 898fa113e5SMark Murray void (*init)(int); 908fa113e5SMark Murray int (*start)(int, int); 918fa113e5SMark Murray int (*is)(unsigned char *, int); 928fa113e5SMark Murray int (*reply)(unsigned char *, int); 938fa113e5SMark Murray void (*session)(Session_Key *, int); 948fa113e5SMark Murray int (*keyid)(int, unsigned char *, int *); 958fa113e5SMark Murray void (*printsub)(unsigned char *, int, unsigned char *, int); 9681cb6ddcSMark Murray } Encryptions; 9781cb6ddcSMark Murray 9881cb6ddcSMark Murray #define SK_DES 1 /* Matched Kerberos v5 KEYTYPE_DES */ 9981cb6ddcSMark Murray 10081cb6ddcSMark Murray #include "enc-proto.h" 10181cb6ddcSMark Murray 10281cb6ddcSMark Murray extern int encrypt_debug_mode; 1038fa113e5SMark Murray extern int (*decrypt_input)(int); 1048fa113e5SMark Murray extern void (*encrypt_output)(unsigned char *, int); 10581cb6ddcSMark Murray # endif /* __ENCRYPTION__ */ 10681cb6ddcSMark Murray #endif /* ENCRYPTION */ 107