summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIru Cai <mytbk920423@gmail.com>2018-04-28 21:49:30 +0800
committerIru Cai <mytbk920423@gmail.com>2018-04-30 15:20:28 +0800
commitbec678f312d282cd467a4d13dbf29c37ea111ce7 (patch)
tree4d756084016b02dce5852db2989eaa33e144bcf5
parent479c939a939023b8a967f6b36edacbac88c566c8 (diff)
downloadfqterm-bec678f312d282cd467a4d13dbf29c37ea111ce7.tar.xz
add name field to ssh_cipher_t
-rw-r--r--src/protocol/internal/all_ciphers.c8
-rw-r--r--src/protocol/internal/ssh_cipher.h1
2 files changed, 7 insertions, 2 deletions
diff --git a/src/protocol/internal/all_ciphers.c b/src/protocol/internal/all_ciphers.c
index 3a524ee..798d545 100644
--- a/src/protocol/internal/all_ciphers.c
+++ b/src/protocol/internal/all_ciphers.c
@@ -2,8 +2,12 @@
#include "ssh_cipher.h"
#include <openssl/evp.h>
-#define EVP_CIPHER_FUNC(name, evp, k, i, b) \
- static SSH_CIPHER* evp_##name(int e) { return new_ssh_cipher_evp(evp, k, i, b, e); }
+#define EVP_CIPHER_FUNC(NAME, evp, k, i, b) \
+ static SSH_CIPHER* evp_##NAME(int e) { \
+ SSH_CIPHER *c = new_ssh_cipher_evp(evp, k, i, b, e); \
+ c->name = #NAME; \
+ return c; \
+ }
EVP_CIPHER_FUNC(aes256_ctr, EVP_aes_256_ctr, 32, 16, 16)
EVP_CIPHER_FUNC(aes192_ctr, EVP_aes_192_ctr, 24, 16, 16)
diff --git a/src/protocol/internal/ssh_cipher.h b/src/protocol/internal/ssh_cipher.h
index 94b83ed..8b09057 100644
--- a/src/protocol/internal/ssh_cipher.h
+++ b/src/protocol/internal/ssh_cipher.h
@@ -24,6 +24,7 @@ extern "C" {
* Before using the crypto function, IV and key must
* be set and then init function must be called
*/
+ const char *name;
unsigned char *IV;
unsigned char *key;
void *priv;