xref: /original-bsd/lib/libtelnet/encrypt.h (revision 08eb28af)
1 /*-
2  * Copyright (c) 1991 The Regents of the University of California.
3  * All rights reserved.
4  *
5  * %sccs.include.redist.c%
6  *
7  *	@(#)encrypt.h	5.2 (Berkeley) 03/22/91
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 #ifndef	__ENCRYPT__
31 #define	__ENCRYPT__
32 
33 #define	DIR_DECRYPT		1
34 #define	DIR_ENCRYPT		2
35 
36 typedef	unsigned char Block[8];
37 typedef unsigned char *BlockT;
38 typedef struct { Block _; } Schedule[16];
39 
40 #define	VALIDKEY(key)	( key[0] | key[1] | key[2] | key[3] | \
41 			  key[4] | key[5] | key[6] | key[7])
42 
43 #define	SAMEKEY(k1, k2)	(!bcmp((void *)k1, (void *)k2, sizeof(Block)))
44 
45 typedef	struct {
46 	short		type;
47 	int		length;
48 	unsigned char	*data;
49 } Session_Key;
50 
51 #if	!defined(P)
52 #ifdef	__STDC__
53 #define P(x)	x
54 #else
55 #define P(x)	()
56 #endif
57 #endif
58 
59 typedef struct {
60 	char	*name;
61 	int	type;
62 	void	(*output) P((unsigned char *, int));
63 	int	(*input) P((int));
64 	void	(*init) P((int));
65 	int	(*start) P((int, int));
66 	int	(*is) P((unsigned char *, int));
67 	int	(*reply) P((unsigned char *, int));
68 	void	(*session) P((Session_Key *, int));
69 	int	(*keyid) P((int, unsigned char *, int *));
70 	void	(*printsub) P((unsigned char *, int, unsigned char *, int));
71 } Encryptions;
72 
73 #define	SK_DES		1	/* Matched Kerberos v5 KEYTYPE_DES */
74 
75 #include "enc-proto.h"
76 
77 extern int encrypt_debug_mode;
78 extern int (*decrypt_input) P((int));
79 extern void (*encrypt_output) P((unsigned char *, int));
80 #endif
81