summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/protocol/internal/fqterm_ssh2_kex.cpp21
1 files changed, 14 insertions, 7 deletions
diff --git a/src/protocol/internal/fqterm_ssh2_kex.cpp b/src/protocol/internal/fqterm_ssh2_kex.cpp
index 53026e9..8c6f240 100644
--- a/src/protocol/internal/fqterm_ssh2_kex.cpp
+++ b/src/protocol/internal/fqterm_ssh2_kex.cpp
@@ -29,6 +29,7 @@
#include "fqterm_ssh2_kex.h"
#include "fqterm_ssh_md5.h"
#include "fqterm_trace.h"
+#include "ssh_pubkey_crypto.h"
namespace FQTerm {
@@ -259,7 +260,7 @@ bool FQTermSSH2Kex::verifyKey() {
static RSA *CreateRSAContext(unsigned char *host_key, int len) {
FQTermSSHBuffer buffer(len);
-
+
buffer.putRawData((char *)host_key, len);
int algo_len = -1;
@@ -275,12 +276,18 @@ static RSA *CreateRSAContext(unsigned char *host_key, int len) {
RSA *rsa = RSA_new();
- rsa->e = BN_new();
- BN_bin2bn(e, e_len, rsa->e);
-
- rsa->n = BN_new();
- BN_bin2bn(n, n_len, rsa->n);
-
+ BIGNUM *rsa_e = BN_new();
+ BIGNUM *rsa_n = BN_new();
+
+ BN_bin2bn(e, e_len, rsa_e);
+ BN_bin2bn(n, n_len, rsa_n);
+
+#ifdef HAVE_OPAQUE_STRUCTS
+ RSA_set0_key(rsa, rsa_n, rsa_e, NULL);
+#else
+ rsa->n = rsa_n;
+ rsa->e = rsa_e;
+#endif
delete[] algo;
delete[] e;
delete[] n;