summaryrefslogtreecommitdiff
path: root/src/protocol/internal/ssh_cipher.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/protocol/internal/ssh_cipher.h')
-rw-r--r--src/protocol/internal/ssh_cipher.h46
1 files changed, 46 insertions, 0 deletions
diff --git a/src/protocol/internal/ssh_cipher.h b/src/protocol/internal/ssh_cipher.h
new file mode 100644
index 0000000..ec51062
--- /dev/null
+++ b/src/protocol/internal/ssh_cipher.h
@@ -0,0 +1,46 @@
+#ifndef SSH_CIPHER_H
+#define SSH_CIPHER_H
+
+#include <stdlib.h>
+#include <stdint.h>
+#include <openssl/evp.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+ typedef struct ssh_cipher_t SSH_CIPHER;
+ typedef int (*crypt_t)(SSH_CIPHER*, const uint8_t*, uint8_t*, size_t);
+ typedef int (*init_t)(SSH_CIPHER*);
+ typedef void (*cleanup_t)(SSH_CIPHER*);
+
+ struct ssh_cipher_t
+ {
+ /*
+ * priv is used for things like EVP_CIPHER_CTX and EVP_CIPHER
+ *
+ * We use only one crypt function for encrypt or decrypt.
+ *
+ * Before using the crypto function, IV and key must
+ * be set and then init function must be called
+ */
+ unsigned char *IV;
+ unsigned char *key;
+ void *priv;
+ crypt_t crypt;
+ init_t init;
+ cleanup_t cleanup;
+ size_t blkSize;
+ size_t keySize;
+ size_t IVSize;
+ };
+
+ typedef const EVP_CIPHER*(*SSH_EVP)(void);
+ SSH_CIPHER* new_ssh_cipher_evp(SSH_EVP, size_t key, size_t iv, size_t blk, int enc);
+ SSH_CIPHER* new_3des_ssh1(int);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif