/* $KAME: des.h,v 1.8 2001/09/10 04:03:57 itojun Exp $ */12/* lib/des/des.h */3/* Copyright (C) 1995-1996 Eric Young ([email protected])4* All rights reserved.5*6* This file is part of an SSL implementation written7* by Eric Young ([email protected]).8* The implementation was written so as to conform with Netscapes SSL9* specification. This library and applications are10* FREE FOR COMMERCIAL AND NON-COMMERCIAL USE11* as long as the following conditions are aheared to.12*13* Copyright remains Eric Young's, and as such any Copyright notices in14* the code are not to be removed. If this code is used in a product,15* Eric Young should be given attribution as the author of the parts used.16* This can be in the form of a textual message at program startup or17* in documentation (online or textual) provided with the package.18*19* Redistribution and use in source and binary forms, with or without20* modification, are permitted provided that the following conditions21* are met:22* 1. Redistributions of source code must retain the copyright23* notice, this list of conditions and the following disclaimer.24* 2. Redistributions in binary form must reproduce the above copyright25* notice, this list of conditions and the following disclaimer in the26* documentation and/or other materials provided with the distribution.27* 3. All advertising materials mentioning features or use of this software28* must display the following acknowledgement:29* This product includes software developed by Eric Young ([email protected])30*31* THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND32* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE33* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE34* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE35* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL36* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS37* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)38* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT39* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY40* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF41* SUCH DAMAGE.42*43* The licence and distribution terms for any publically available version or44* derivative of this code cannot be changed. i.e. this code cannot simply be45* copied and put under another distribution licence46* [including the GNU Public Licence.]47*/4849#ifndef HEADER_DES_H50#define HEADER_DES_H5152#ifdef __cplusplus53extern "C" {54#endif5556/* must be 32bit quantity */57#define DES_LONG uint32_t5859typedef unsigned char des_cblock[8];60typedef struct des_ks_struct61{62union {63des_cblock cblock;64/* make sure things are correct size on machines with65* 8 byte longs */66DES_LONG deslong[2];67} ks;68int weak_key;69} des_key_schedule[16];7071#define DES_KEY_SZ (sizeof(des_cblock))72#define DES_SCHEDULE_SZ (sizeof(des_key_schedule))7374#define DES_ENCRYPT 175#define DES_DECRYPT 07677#define DES_CBC_MODE 078#define DES_PCBC_MODE 17980extern int des_check_key; /* defaults to false */8182char *des_options(void);83void des_ecb_encrypt(unsigned char *, unsigned char *, des_key_schedule, int);8485void des_encrypt1(DES_LONG *, des_key_schedule, int);86void des_encrypt2(DES_LONG *, des_key_schedule, int);87void des_encrypt3(DES_LONG *, des_key_schedule, des_key_schedule,88des_key_schedule);89void des_decrypt3(DES_LONG *, des_key_schedule, des_key_schedule,90des_key_schedule);9192void des_ecb3_encrypt(unsigned char *, unsigned char *, des_key_schedule,93des_key_schedule, des_key_schedule, int);9495void des_set_odd_parity(unsigned char *);96void des_fixup_key_parity(unsigned char *);97int des_is_weak_key(const unsigned char *);98int des_set_key(const unsigned char *, des_key_schedule);99int des_key_sched(const unsigned char *, des_key_schedule);100int des_set_key_checked(const unsigned char *, des_key_schedule);101void des_set_key_unchecked(const unsigned char *, des_key_schedule);102int des_check_key_parity(const unsigned char *);103104#ifdef __cplusplus105}106#endif107108#endif109110111