diff options
author | Iru Cai <mytbk920423@gmail.com> | 2016-11-05 14:54:10 +0800 |
---|---|---|
committer | Iru Cai <mytbk920423@gmail.com> | 2016-11-08 15:16:40 +0800 |
commit | 0a817b9fcb8e7a1bf5c4a910eb0de1a549b5ba9f (patch) | |
tree | f765c09f54e47f0d1e34afb5d09885579e946c76 /src/protocol/internal/ssh_cipher.h | |
parent | 92c88c20fe34add9876e9d4e89813ea285f1bbac (diff) | |
download | fqterm-0a817b9fcb8e7a1bf5c4a910eb0de1a549b5ba9f.tar.xz |
Implement ssh_cipher_t for symmetric ciphers in SSH
* remove FQTermSSHCipher and FQTermSSH3DES, use ssh_cipher_t instead
* implement EVP ciphers and 3DES-SSH1
Diffstat (limited to 'src/protocol/internal/ssh_cipher.h')
-rw-r--r-- | src/protocol/internal/ssh_cipher.h | 46 |
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 |