diff options
Diffstat (limited to 'cipher.h')
-rw-r--r-- | cipher.h | 29 |
1 files changed, 13 insertions, 16 deletions
@@ -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 | |||
62 | typedef struct Cipher Cipher; | 65 | typedef struct Cipher Cipher; |
63 | typedef struct CipherContext CipherContext; | 66 | typedef struct CipherContext CipherContext; |
64 | 67 | ||
68 | struct Cipher; | ||
65 | struct CipherContext { | 69 | struct 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 | }; |
96 | struct 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 | ||
107 | u_int cipher_mask_ssh1(int); | 103 | u_int cipher_mask_ssh1(int); |
108 | Cipher *cipher_by_name(const char *); | 104 | Cipher *cipher_by_name(const char *); |
@@ -111,9 +107,10 @@ int cipher_number(const char *); | |||
111 | char *cipher_name(int); | 107 | char *cipher_name(int); |
112 | int ciphers_valid(const char *); | 108 | int ciphers_valid(const char *); |
113 | void cipher_init(CipherContext *, Cipher *, const u_char *, u_int, | 109 | void cipher_init(CipherContext *, Cipher *, const u_char *, u_int, |
114 | const u_char *, u_int); | 110 | const u_char *, u_int, int); |
115 | void cipher_encrypt(CipherContext *, u_char *, const u_char *, u_int); | 111 | void cipher_crypt(CipherContext *, u_char *, const u_char *, u_int); |
116 | void cipher_decrypt(CipherContext *, u_char *, const u_char *, u_int); | 112 | void cipher_cleanup(CipherContext *); |
117 | void cipher_set_key_string(CipherContext *, Cipher *, const char *); | 113 | void cipher_set_key_string(CipherContext *, Cipher *, const char *, int); |
118 | 114 | u_int cipher_blocksize(Cipher *); | |
115 | u_int cipher_keylen(Cipher *); | ||
119 | #endif /* CIPHER_H */ | 116 | #endif /* CIPHER_H */ |