diff options
author | Matt Johnston <matt@ucc.asn.au> | 2008-09-29 13:53:31 +0000 |
---|---|---|
committer | Matt Johnston <matt@ucc.asn.au> | 2008-09-29 13:53:31 +0000 |
commit | 511f6555c98634d8d962f65e8d5ff3ba690e0bf9 (patch) | |
tree | 83dc9f384e04071da685d43688e54dc1bb5d874e /algo.h | |
parent | 049fcf1ac572e1a13dc1281c26bbf3512c533fb7 (diff) |
- Add Counter Mode support
--HG--
extra : convert_revision : 5225162bdf32d70b58b6d3ae375a290326c59f3a
Diffstat (limited to 'algo.h')
-rw-r--r-- | algo.h | 22 |
1 files changed, 19 insertions, 3 deletions
@@ -29,13 +29,18 @@ #include "includes.h" #include "buffer.h" +#define DROPBEAR_MODE_UNUSED 0 +#define DROPBEAR_MODE_CBC 1 +#define DROPBEAR_MODE_CTR 2 + struct Algo_Type { unsigned char *name; /* identifying name */ char val; /* a value for this cipher, or -1 for invalid */ - void *data; /* algorithm specific data */ - unsigned usable : 1; /* whether we can use this algorithm */ - + const void *data; /* algorithm specific data */ + char usable; /* whether we can use this algorithm */ + const void *mode; /* the mode, currently only used for ciphers, + points to a 'struct dropbear_cipher_mode' */ }; typedef struct Algo_Type algo_type; @@ -48,6 +53,7 @@ extern algo_type sshhashes[]; extern algo_type sshcompress[]; extern const struct dropbear_cipher dropbear_nocipher; +extern const struct dropbear_cipher_mode dropbear_mode_none; extern const struct dropbear_hash dropbear_nohash; struct dropbear_cipher { @@ -56,6 +62,16 @@ struct dropbear_cipher { unsigned char blocksize; }; +struct dropbear_cipher_mode { + int (*start)(int cipher, const unsigned char *IV, + const unsigned char *key, + int keylen, int num_rounds, void *cipher_state); + int (*encrypt)(const unsigned char *pt, unsigned char *ct, + unsigned long len, void *cipher_state); + int (*decrypt)(const unsigned char *ct, unsigned char *pt, + unsigned long len, void *cipher_state); +}; + struct dropbear_hash { const struct ltc_hash_descriptor *hashdesc; unsigned long keysize; |