1*ce3ee7a7Skre /* $NetBSD: encrypt.h,v 1.10 2024/10/29 13:10:06 kre Exp $ */ 20667d122Schristos 361f28255Scgd /*- 450c0885eScgd * Copyright (c) 1991, 1993 550c0885eScgd * The Regents of the University of California. All rights reserved. 661f28255Scgd * 761f28255Scgd * Redistribution and use in source and binary forms, with or without 861f28255Scgd * modification, are permitted provided that the following conditions 961f28255Scgd * are met: 1061f28255Scgd * 1. Redistributions of source code must retain the above copyright 1161f28255Scgd * notice, this list of conditions and the following disclaimer. 1261f28255Scgd * 2. Redistributions in binary form must reproduce the above copyright 1361f28255Scgd * notice, this list of conditions and the following disclaimer in the 1461f28255Scgd * documentation and/or other materials provided with the distribution. 15eb7c1594Sagc * 3. Neither the name of the University nor the names of its contributors 1661f28255Scgd * may be used to endorse or promote products derived from this software 1761f28255Scgd * without specific prior written permission. 1861f28255Scgd * 1961f28255Scgd * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 2061f28255Scgd * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 2161f28255Scgd * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 2261f28255Scgd * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 2361f28255Scgd * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 2461f28255Scgd * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 2561f28255Scgd * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 2661f28255Scgd * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 2761f28255Scgd * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 2861f28255Scgd * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 2961f28255Scgd * SUCH DAMAGE. 3061f28255Scgd * 3150c0885eScgd * from: @(#)encrypt.h 8.1 (Berkeley) 6/4/93 3261f28255Scgd */ 3361f28255Scgd 3461f28255Scgd /* 3561f28255Scgd * Copyright (C) 1990 by the Massachusetts Institute of Technology 3661f28255Scgd * 3761f28255Scgd * Export of this software from the United States of America is assumed 3861f28255Scgd * to require a specific license from the United States Government. 3961f28255Scgd * It is the responsibility of any person or organization contemplating 4061f28255Scgd * export to obtain such a license before exporting. 4161f28255Scgd * 4261f28255Scgd * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and 4361f28255Scgd * distribute this software and its documentation for any purpose and 4461f28255Scgd * without fee is hereby granted, provided that the above copyright 4561f28255Scgd * notice appear in all copies and that both that copyright notice and 4661f28255Scgd * this permission notice appear in supporting documentation, and that 4761f28255Scgd * the name of M.I.T. not be used in advertising or publicity pertaining 4861f28255Scgd * to distribution of the software without specific, written prior 4961f28255Scgd * permission. M.I.T. makes no representations about the suitability of 5061f28255Scgd * this software for any purpose. It is provided "as is" without express 5161f28255Scgd * or implied warranty. 5261f28255Scgd */ 5361f28255Scgd 545c099b14Sthorpej #ifdef ENCRYPTION 555c099b14Sthorpej #include <sys/cdefs.h> 565c099b14Sthorpej 575c099b14Sthorpej # ifndef __ENCRYPTION__ 585c099b14Sthorpej # define __ENCRYPTION__ 595c099b14Sthorpej 605c099b14Sthorpej #define DIR_DECRYPT 1 615c099b14Sthorpej #define DIR_ENCRYPT 2 625c099b14Sthorpej 635c099b14Sthorpej #define Block des_cblock 645c099b14Sthorpej typedef unsigned char *BlockT; 655c099b14Sthorpej #define Schedule des_key_schedule 665c099b14Sthorpej 675c099b14Sthorpej #define VALIDKEY(key) ( key[0] | key[1] | key[2] | key[3] | \ 685c099b14Sthorpej key[4] | key[5] | key[6] | key[7]) 695c099b14Sthorpej 705c099b14Sthorpej #define SAMEKEY(k1, k2) (!bcmp((void *)k1, (void *)k2, sizeof(Block))) 715c099b14Sthorpej 725c099b14Sthorpej typedef struct { 735c099b14Sthorpej short type; 745c099b14Sthorpej int length; 755c099b14Sthorpej unsigned char *data; 765c099b14Sthorpej } Session_Key; 775c099b14Sthorpej 785c099b14Sthorpej 795c099b14Sthorpej typedef struct { 806a6c8f61Schristos const char *name; 815c099b14Sthorpej int type; 824fcf8685Sperry void (*output)(unsigned char *, int); 834fcf8685Sperry int (*input)(int); 844fcf8685Sperry void (*init)(int); 854fcf8685Sperry int (*start)(int, int); 864fcf8685Sperry int (*is)(unsigned char *, int); 874fcf8685Sperry int (*reply)(unsigned char *, int); 884fcf8685Sperry void (*session)(Session_Key *, int); 894fcf8685Sperry int (*keyid)(int, unsigned char *, int *); 904fcf8685Sperry void (*printsub)(unsigned char *, int, unsigned char *, int); 915c099b14Sthorpej } Encryptions; 925c099b14Sthorpej 935c099b14Sthorpej #define SK_DES 1 /* Matched Kerberos v5 KEYTYPE_DES */ 945c099b14Sthorpej 955c099b14Sthorpej #include "enc-proto.h" 965c099b14Sthorpej 974fcf8685Sperry extern int (*decrypt_input)(int); 984fcf8685Sperry extern void (*encrypt_output)(unsigned char *, int); 995c099b14Sthorpej # endif /* __ENCRYPTION__ */ 1005c099b14Sthorpej #endif /* ENCRYPTION */ 101