1 /*- 2 * Copyright (c) 1991, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * %sccs.include.redist.c% 6 * 7 * @(#)encrypt.h 8.1 (Berkeley) 06/04/93 8 */ 9 10 /* 11 * Copyright (C) 1990 by the Massachusetts Institute of Technology 12 * 13 * Export of this software from the United States of America is assumed 14 * to require a specific license from the United States Government. 15 * It is the responsibility of any person or organization contemplating 16 * export to obtain such a license before exporting. 17 * 18 * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and 19 * distribute this software and its documentation for any purpose and 20 * without fee is hereby granted, provided that the above copyright 21 * notice appear in all copies and that both that copyright notice and 22 * this permission notice appear in supporting documentation, and that 23 * the name of M.I.T. not be used in advertising or publicity pertaining 24 * to distribution of the software without specific, written prior 25 * permission. M.I.T. makes no representations about the suitability of 26 * this software for any purpose. It is provided "as is" without express 27 * or implied warranty. 28 */ 29 30 #ifdef ENCRYPTION 31 # ifndef __ENCRYPTION__ 32 # define __ENCRYPTION__ 33 34 #define DIR_DECRYPT 1 35 #define DIR_ENCRYPT 2 36 37 typedef unsigned char Block[8]; 38 typedef unsigned char *BlockT; 39 typedef struct { Block _; } Schedule[16]; 40 41 #define VALIDKEY(key) ( key[0] | key[1] | key[2] | key[3] | \ 42 key[4] | key[5] | key[6] | key[7]) 43 44 #define SAMEKEY(k1, k2) (!bcmp((void *)k1, (void *)k2, sizeof(Block))) 45 46 typedef struct { 47 short type; 48 int length; 49 unsigned char *data; 50 } Session_Key; 51 52 # if !defined(P) 53 # ifdef __STDC__ 54 # define P(x) x 55 # else 56 # define P(x) () 57 # endif 58 # endif 59 60 typedef struct { 61 char *name; 62 int type; 63 void (*output) P((unsigned char *, int)); 64 int (*input) P((int)); 65 void (*init) P((int)); 66 int (*start) P((int, int)); 67 int (*is) P((unsigned char *, int)); 68 int (*reply) P((unsigned char *, int)); 69 void (*session) P((Session_Key *, int)); 70 int (*keyid) P((int, unsigned char *, int *)); 71 void (*printsub) P((unsigned char *, int, unsigned char *, int)); 72 } Encryptions; 73 74 #define SK_DES 1 /* Matched Kerberos v5 KEYTYPE_DES */ 75 76 #include "enc-proto.h" 77 78 extern int encrypt_debug_mode; 79 extern int (*decrypt_input) P((int)); 80 extern void (*encrypt_output) P((unsigned char *, int)); 81 # endif /* __ENCRYPTION__ */ 82 #endif /* ENCRYPTION */ 83