summaryrefslogtreecommitdiffhomepage
path: root/algo.h
diff options
context:
space:
mode:
authorMatt Johnston <matt@ucc.asn.au>2008-09-29 13:53:31 +0000
committerMatt Johnston <matt@ucc.asn.au>2008-09-29 13:53:31 +0000
commit511f6555c98634d8d962f65e8d5ff3ba690e0bf9 (patch)
tree83dc9f384e04071da685d43688e54dc1bb5d874e /algo.h
parent049fcf1ac572e1a13dc1281c26bbf3512c533fb7 (diff)
- Add Counter Mode support
--HG-- extra : convert_revision : 5225162bdf32d70b58b6d3ae375a290326c59f3a
Diffstat (limited to 'algo.h')
-rw-r--r--algo.h22
1 files changed, 19 insertions, 3 deletions
diff --git a/algo.h b/algo.h
index 5ed01cc..c83cfff 100644
--- a/algo.h
+++ b/algo.h
@@ -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;