157416Smarkm/*- 257416Smarkm * Copyright (c) 1991, 1993 357416Smarkm * The Regents of the University of California. All rights reserved. 457416Smarkm * 557416Smarkm * Redistribution and use in source and binary forms, with or without 657416Smarkm * modification, are permitted provided that the following conditions 757416Smarkm * are met: 857416Smarkm * 1. Redistributions of source code must retain the above copyright 957416Smarkm * notice, this list of conditions and the following disclaimer. 1057416Smarkm * 2. Redistributions in binary form must reproduce the above copyright 1157416Smarkm * notice, this list of conditions and the following disclaimer in the 1257416Smarkm * documentation and/or other materials provided with the distribution. 1357416Smarkm * 3. All advertising materials mentioning features or use of this software 1457416Smarkm * must display the following acknowledgement: 1557416Smarkm * This product includes software developed by the University of 1657416Smarkm * California, Berkeley and its contributors. 1757416Smarkm * 4. Neither the name of the University nor the names of its contributors 1857416Smarkm * may be used to endorse or promote products derived from this software 1957416Smarkm * without specific prior written permission. 2057416Smarkm * 2157416Smarkm * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 2257416Smarkm * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 2357416Smarkm * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 2457416Smarkm * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 2557416Smarkm * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 2657416Smarkm * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 2757416Smarkm * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 2857416Smarkm * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 2957416Smarkm * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 3057416Smarkm * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 3157416Smarkm * SUCH DAMAGE. 3257416Smarkm * 3357416Smarkm * @(#)encrypt.h 8.1 (Berkeley) 6/4/93 3457416Smarkm * 3557416Smarkm * @(#)encrypt.h 5.2 (Berkeley) 3/22/91 3657416Smarkm */ 3757416Smarkm 3857416Smarkm/* 3957416Smarkm * Copyright (C) 1990 by the Massachusetts Institute of Technology 4057416Smarkm * 4157416Smarkm * Export of this software from the United States of America is assumed 4257416Smarkm * to require a specific license from the United States Government. 4357416Smarkm * It is the responsibility of any person or organization contemplating 4457416Smarkm * export to obtain such a license before exporting. 4557416Smarkm * 4657416Smarkm * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and 4757416Smarkm * distribute this software and its documentation for any purpose and 4857416Smarkm * without fee is hereby granted, provided that the above copyright 4957416Smarkm * notice appear in all copies and that both that copyright notice and 5057416Smarkm * this permission notice appear in supporting documentation, and that 5157416Smarkm * the name of M.I.T. not be used in advertising or publicity pertaining 5257416Smarkm * to distribution of the software without specific, written prior 5357416Smarkm * permission. M.I.T. makes no representations about the suitability of 5457416Smarkm * this software for any purpose. It is provided "as is" without express 5557416Smarkm * or implied warranty. 5657416Smarkm */ 5757416Smarkm 58233294Sstas/* $Id$ */ 5957416Smarkm 6057416Smarkm#ifndef __ENCRYPT__ 6157416Smarkm#define __ENCRYPT__ 6257416Smarkm 6357416Smarkm#define DIR_DECRYPT 1 6457416Smarkm#define DIR_ENCRYPT 2 6557416Smarkm 6657416Smarkm#define VALIDKEY(key) ( key[0] | key[1] | key[2] | key[3] | \ 6757416Smarkm key[4] | key[5] | key[6] | key[7]) 6857416Smarkm 6957416Smarkm#define SAMEKEY(k1, k2) (!memcmp(k1, k2, sizeof(des_cblock))) 7057416Smarkm 7157416Smarkmtypedef struct { 7257416Smarkm short type; 7357416Smarkm int length; 7457416Smarkm unsigned char *data; 7557416Smarkm} Session_Key; 7657416Smarkm 7757416Smarkmtypedef struct { 7857416Smarkm char *name; 7957416Smarkm int type; 8057416Smarkm void (*output) (unsigned char *, int); 8157416Smarkm int (*input) (int); 8257416Smarkm void (*init) (int); 8357416Smarkm int (*start) (int, int); 8457416Smarkm int (*is) (unsigned char *, int); 8557416Smarkm int (*reply) (unsigned char *, int); 8657416Smarkm void (*session) (Session_Key *, int); 8757416Smarkm int (*keyid) (int, unsigned char *, int *); 88233294Sstas void (*printsub) (unsigned char *, size_t, unsigned char *, size_t); 8957416Smarkm} Encryptions; 9057416Smarkm 9157416Smarkm#define SK_DES 1 /* Matched Kerberos v5 KEYTYPE_DES */ 9257416Smarkm 93103423Snectar#include "crypto-headers.h" 9490926Snectar#ifdef HAVE_OPENSSL 9578527Sassar#define des_new_random_key des_random_key 9678527Sassar#endif 9778527Sassar 9857416Smarkm#include "enc-proto.h" 9957416Smarkm 10057416Smarkmextern int encrypt_debug_mode; 10157416Smarkmextern int (*decrypt_input) (int); 10257416Smarkmextern void (*encrypt_output) (unsigned char *, int); 10357416Smarkm#endif 104