summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIru Cai <mytbk920423@gmail.com>2016-10-29 15:00:30 +0800
committerIru Cai <mytbk920423@gmail.com>2016-10-29 16:50:46 +0800
commitedcc92b0b357d2ac3a5708e778a80c81fcc84a31 (patch)
tree86dd378c48e2f2d83521f40af115225b9cbe804b
parentc12356c8ed4a5f78f996a24addac8b73afacc398 (diff)
downloadfqterm-edcc92b0b357d2ac3a5708e778a80c81fcc84a31.tar.xz
fqterm_ssh2_kex.cpp: use RSA_set0_key for OpenSSL 1.1.0
-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;