aboutsummaryrefslogtreecommitdiff
path: root/include/libssh/crypto.h
diff options
context:
space:
mode:
authorAris Adamantiadis <aris@0xbadc0de.be>2015-09-25 00:05:10 +0200
committerAris Adamantiadis <aris@0xbadc0de.be>2015-09-25 00:05:10 +0200
commite83b4e8129811f8075c6ab4b3ee700fd0c92ffa7 (patch)
treeb8b1fa82ce689f9774b365467dddf2f13d946cdb /include/libssh/crypto.h
parent392e09e3de50ff95089e547c0ef10984d8adbc67 (diff)
downloadlibssh-e83b4e8129811f8075c6ab4b3ee700fd0c92ffa7.tar.gz
libssh-e83b4e8129811f8075c6ab4b3ee700fd0c92ffa7.tar.xz
libssh-e83b4e8129811f8075c6ab4b3ee700fd0c92ffa7.zip
libcrypto: clean up EVP functions
Diffstat (limited to 'include/libssh/crypto.h')
-rw-r--r--include/libssh/crypto.h23
1 files changed, 20 insertions, 3 deletions
diff --git a/include/libssh/crypto.h b/include/libssh/crypto.h
index 61a2b27b..2e866467 100644
--- a/include/libssh/crypto.h
+++ b/include/libssh/crypto.h
@@ -59,6 +59,20 @@ enum ssh_key_exchange_e {
SSH_KEX_CURVE25519_SHA256_LIBSSH_ORG
};
+enum ssh_cipher_e {
+ SSH_CIPHER_NONE=0,
+ SSH_BLOWFISH_CBC,
+ SSH_3DES_CBC,
+ SSH_3DES_CBC_SSH1,
+ SSH_DES_CBC_SSH1,
+ SSH_AES128_CBC,
+ SSH_AES192_CBC,
+ SSH_AES256_CBC,
+ SSH_AES128_CTR,
+ SSH_AES192_CTR,
+ SSH_AES256_CTR
+};
+
struct ssh_crypto_struct {
bignum e,f,x,k,y;
#ifdef HAVE_ECDH
@@ -104,12 +118,14 @@ struct ssh_crypto_struct {
struct ssh_cipher_struct {
const char *name; /* ssh name of the algorithm */
unsigned int blocksize; /* blocksize of the algo */
- unsigned int keylen; /* length of the key structure */
+ enum ssh_cipher_e ciphertype;
#ifdef HAVE_LIBGCRYPT
+ size_t keylen; /* length of the key structure */
gcry_cipher_hd_t *key;
#elif defined HAVE_LIBCRYPTO
- void *key; /* a key buffer allocated for the algo */
- void *IV;
+ struct ssh_3des_key_schedule *des3_key;
+ const EVP_CIPHER *cipher;
+ EVP_CIPHER_CTX ctx;
#endif
unsigned int keysize; /* bytes of key used. != keylen */
/* sets the new key for immediate use */
@@ -119,6 +135,7 @@ struct ssh_cipher_struct {
unsigned long len);
void (*decrypt)(struct ssh_cipher_struct *cipher, void *in, void *out,
unsigned long len);
+ void (*cleanup)(struct ssh_cipher_struct *cipher);
};
/* vim: set ts=2 sw=2 et cindent: */