source: trunk/third/ssh/des.h @ 12646

Revision 12646, 2.5 KB checked in by danw, 26 years ago (diff)
This commit was generated by cvs2svn to compensate for changes in r12645, which included commits to RCS files with non-trunk default branches.
Line 
1/*
2
3DES implementation; 1995 Tatu Ylonen <ylo@cs.hut.fi>
4
5This implementation is derived from libdes-3.06, which is copyright
6(c) 1993 Eric Young, and distributed under the GNU GPL or the ARTISTIC licence
7(at the user's option).  The original distribution can be found e.g. from
8ftp://ftp.dsi.unimi.it/pub/security/crypt/libdes/libdes-3.06.tar.gz.
9
10This implementation is distributed under the same terms.  See
11libdes-README, libdes-ARTISTIC, and libdes-COPYING for more
12information.
13
14*/
15
16/*
17 * $Id: des.h,v 1.1.1.2 1999-03-08 17:43:39 danw Exp $
18 * $Log: not supported by cvs2svn $
19 * Revision 1.1.1.1  1996/02/18  21:38:11  ylo
20 *      Imported ssh-1.2.13.
21 *
22 * Revision 1.2  1995/07/13  01:22:57  ylo
23 *      Added cvs log.
24 *
25 * $Endlog$
26 */
27
28#ifndef DES_H
29#define DES_H
30
31typedef struct
32{
33  word32 key_schedule[32];
34} DESContext;
35
36/* Sets the des key for the context.  Initializes the context.  The least
37   significant bit of each byte of the key is ignored as parity. */
38void des_set_key(unsigned char *key, DESContext *ks);
39
40/* Encrypts 32 bits in l,r, and stores the result in output[0] and output[1].
41   Performs encryption if encrypt is non-zero, and decryption if it is zero.
42   The key context must have been initialized previously with des_set_key. */
43void des_encrypt(word32 l, word32 r, word32 *output, DESContext *ks,
44                 int encrypt);
45
46/* Encrypts len bytes from src to dest in CBC modes.  Len must be a multiple
47   of 8.  iv will be modified at end to a value suitable for continuing
48   encryption. */
49void des_cbc_encrypt(DESContext *ks, unsigned char *iv, unsigned char *dest,
50                     const unsigned char *src, unsigned int len);
51
52/* Decrypts len bytes from src to dest in CBC modes.  Len must be a multiple
53   of 8.  iv will be modified at end to a value suitable for continuing
54   decryption. */
55void des_cbc_decrypt(DESContext *ks, unsigned char *iv, unsigned char *dest,
56                     const unsigned char *src, unsigned int len);
57
58/* Encrypts in CBC mode using triple-DES. */
59void des_3cbc_encrypt(DESContext *ks1, unsigned char *iv1,
60                      DESContext *ks2, unsigned char *iv2,
61                      DESContext *ks3, unsigned char *iv3,
62                      unsigned char *dest, const unsigned char *src,
63                      unsigned int len);
64
65/* Decrypts in CBC mode using triple-DES. */
66void des_3cbc_decrypt(DESContext *ks1, unsigned char *iv1,
67                      DESContext *ks2, unsigned char *iv2,
68                      DESContext *ks3, unsigned char *iv3,
69                      unsigned char *dest, const unsigned char *src,
70                      unsigned int len);
71
72#endif /* DES_H */
73
74
Note: See TracBrowser for help on using the repository browser.