summaryrefslogtreecommitdiff
path: root/src/protocol/internal/ssh_diffie-hellman.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/protocol/internal/ssh_diffie-hellman.h')
-rw-r--r--src/protocol/internal/ssh_diffie-hellman.h20
1 files changed, 18 insertions, 2 deletions
diff --git a/src/protocol/internal/ssh_diffie-hellman.h b/src/protocol/internal/ssh_diffie-hellman.h
index 5468fdb..f132493 100644
--- a/src/protocol/internal/ssh_diffie-hellman.h
+++ b/src/protocol/internal/ssh_diffie-hellman.h
@@ -3,6 +3,15 @@
#include <openssl/bn.h>
#include <openssl/sha.h>
+#include <openssl/evp.h>
+
+#if OPENSSL_VERSION_NUMBER >= 0x10100000L
+#define ssh_md_ctx_new EVP_MD_CTX_new
+#define ssh_md_ctx_free EVP_MD_CTX_free
+#else
+#define ssh_md_ctx_new EVP_MD_CTX_create
+#define ssh_md_ctx_free EVP_MD_CTX_destroy
+#endif
#ifdef __cplusplus
extern "C" {
@@ -10,17 +19,24 @@ extern "C" {
typedef unsigned char* (*hash_t)(const unsigned char *, size_t, unsigned char *);
+ typedef struct
+ {
+ EVP_MD_CTX *mdctx;
+ const EVP_MD *md;
+ unsigned int hashlen;
+ } evp_md_t;
+
typedef struct ssh_diffie_hellman
{
BIGNUM *g; // generator
BIGNUM *p; // prime
- hash_t hash; // can be SHA1 or SHA256
- size_t hashlen;
+ evp_md_t digest;
} SSH_DH;
void ssh_dh_free(SSH_DH*);
SSH_DH *ssh_dh_group1_sha1(void);
SSH_DH *ssh_dh_group14_sha1(void);
+ void ssh_dh_hash(SSH_DH*, const unsigned char* data, unsigned char*, size_t len);
typedef SSH_DH*(*NEW_DH)(void);
extern const char all_dh_list[];