4.4BSD snapshot (revision 8.1)
[unix-history] / usr / src / lib / libtelnet / encrypt.h
CommitLineData
059be884
DB
1/*-
2 * Copyright (c) 1991 The Regents of the University of California.
3 * All rights reserved.
4 *
5 * %sccs.include.redist.c%
6 *
e0badf3e 7 * @(#)encrypt.h 5.4 (Berkeley) %G%
059be884
DB
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
e0badf3e
DB
30#ifdef ENCRYPTION
31# ifndef __ENCRYPTION__
32# define __ENCRYPTION__
059be884
DB
33
34#define DIR_DECRYPT 1
35#define DIR_ENCRYPT 2
36
37typedef unsigned char Block[8];
38typedef unsigned char *BlockT;
39typedef 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
46typedef struct {
47 short type;
48 int length;
49 unsigned char *data;
50} Session_Key;
51
e0badf3e
DB
52# if !defined(P)
53# ifdef __STDC__
54# define P(x) x
55# else
56# define P(x) ()
57# endif
58# endif
059be884
DB
59
60typedef 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));
b7c8f459 70 int (*keyid) P((int, unsigned char *, int *));
059be884
DB
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
78extern int encrypt_debug_mode;
79extern int (*decrypt_input) P((int));
80extern void (*encrypt_output) P((unsigned char *, int));
e0badf3e
DB
81# endif /* __ENCRYPTION__ */
82#endif /* ENCRYPTION */