summaryrefslogtreecommitdiff
path: root/cipher.h
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2002-02-19 15:21:23 +1100
committerDamien Miller <djm@mindrot.org>2002-02-19 15:21:23 +1100
commit963f6b25e28ff55290ae45f540b7f7148a3622a9 (patch)
tree48d1a96683326594903955672277fe008bf622e4 /cipher.h
parent19a59451050446bb8656d1b72a8787e97cd1c99b (diff)
- markus@cvs.openbsd.org 2002/02/14 23:41:01
[authfile.c cipher.c cipher.h kex.c kex.h packet.c] hide some more implementation details of cipher.[ch] and prepares for move to EVP, ok deraadt@
Diffstat (limited to 'cipher.h')
-rw-r--r--cipher.h29
1 files changed, 13 insertions, 16 deletions
diff --git a/cipher.h b/cipher.h
index 4533f5e4c..0c412b47f 100644
--- a/cipher.h
+++ b/cipher.h
@@ -32,7 +32,7 @@
32 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 */ 33 */
34 34
35/* RCSID("$OpenBSD: cipher.h,v 1.29 2001/08/23 11:31:59 markus Exp $"); */ 35/* RCSID("$OpenBSD: cipher.h,v 1.30 2002/02/14 23:41:01 markus Exp $"); */
36 36
37#ifndef CIPHER_H 37#ifndef CIPHER_H
38#define CIPHER_H 38#define CIPHER_H
@@ -59,9 +59,13 @@
59#define SSH_CIPHER_RESERVED 7 59#define SSH_CIPHER_RESERVED 7
60#define SSH_CIPHER_MAX 31 60#define SSH_CIPHER_MAX 31
61 61
62#define CIPHER_ENCRYPT 1
63#define CIPHER_DECRYPT 0
64
62typedef struct Cipher Cipher; 65typedef struct Cipher Cipher;
63typedef struct CipherContext CipherContext; 66typedef struct CipherContext CipherContext;
64 67
68struct Cipher;
65struct CipherContext { 69struct CipherContext {
66 union { 70 union {
67 struct { 71 struct {
@@ -91,18 +95,10 @@ struct CipherContext {
91 } rijndael; 95 } rijndael;
92 RC4_KEY rc4; 96 RC4_KEY rc4;
93 } u; 97 } u;
98 int plaintext;
99 int encrypt;
94 Cipher *cipher; 100 Cipher *cipher;
95}; 101};
96struct Cipher {
97 char *name;
98 int number; /* for ssh1 only */
99 u_int block_size;
100 u_int key_len;
101 void (*setkey)(CipherContext *, const u_char *, u_int);
102 void (*setiv)(CipherContext *, const u_char *, u_int);
103 void (*encrypt)(CipherContext *, u_char *, const u_char *, u_int);
104 void (*decrypt)(CipherContext *, u_char *, const u_char *, u_int);
105};
106 102
107u_int cipher_mask_ssh1(int); 103u_int cipher_mask_ssh1(int);
108Cipher *cipher_by_name(const char *); 104Cipher *cipher_by_name(const char *);
@@ -111,9 +107,10 @@ int cipher_number(const char *);
111char *cipher_name(int); 107char *cipher_name(int);
112int ciphers_valid(const char *); 108int ciphers_valid(const char *);
113void cipher_init(CipherContext *, Cipher *, const u_char *, u_int, 109void cipher_init(CipherContext *, Cipher *, const u_char *, u_int,
114 const u_char *, u_int); 110 const u_char *, u_int, int);
115void cipher_encrypt(CipherContext *, u_char *, const u_char *, u_int); 111void cipher_crypt(CipherContext *, u_char *, const u_char *, u_int);
116void cipher_decrypt(CipherContext *, u_char *, const u_char *, u_int); 112void cipher_cleanup(CipherContext *);
117void cipher_set_key_string(CipherContext *, Cipher *, const char *); 113void cipher_set_key_string(CipherContext *, Cipher *, const char *, int);
118 114u_int cipher_blocksize(Cipher *);
115u_int cipher_keylen(Cipher *);
119#endif /* CIPHER_H */ 116#endif /* CIPHER_H */