From bec678f312d282cd467a4d13dbf29c37ea111ce7 Mon Sep 17 00:00:00 2001 From: Iru Cai Date: Sat, 28 Apr 2018 21:49:30 +0800 Subject: add name field to ssh_cipher_t --- src/protocol/internal/all_ciphers.c | 8 ++++++-- src/protocol/internal/ssh_cipher.h | 1 + 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 -#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; -- cgit v1.2.3