summaryrefslogtreecommitdiff
path: root/src/protocol/internal
diff options
context:
space:
mode:
Diffstat (limited to 'src/protocol/internal')
-rw-r--r--src/protocol/internal/fqterm_ssh2_kex.cpp1
-rw-r--r--src/protocol/internal/fqterm_ssh_hash.h47
-rw-r--r--src/protocol/internal/fqterm_ssh_kex.cpp14
-rw-r--r--src/protocol/internal/fqterm_ssh_md5.cpp36
-rw-r--r--src/protocol/internal/fqterm_ssh_md5.h50
5 files changed, 7 insertions, 141 deletions
diff --git a/src/protocol/internal/fqterm_ssh2_kex.cpp b/src/protocol/internal/fqterm_ssh2_kex.cpp
index fe35452..906acca 100644
--- a/src/protocol/internal/fqterm_ssh2_kex.cpp
+++ b/src/protocol/internal/fqterm_ssh2_kex.cpp
@@ -27,7 +27,6 @@
#include <openssl/evp.h>
#include "fqterm_ssh2_kex.h"
-#include "fqterm_ssh_md5.h"
#include "fqterm_trace.h"
#include "ssh_pubkey_crypto.h"
#include "ssh_cipher.h"
diff --git a/src/protocol/internal/fqterm_ssh_hash.h b/src/protocol/internal/fqterm_ssh_hash.h
deleted file mode 100644
index b4679f4..0000000
--- a/src/protocol/internal/fqterm_ssh_hash.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/***************************************************************************
- * fqterm, a terminal emulator for both BBS and *nix. *
- * Copyright (C) 2008 fqterm development group. *
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. *
- * *
- * This program is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
- * GNU General Public License for more details. *
- * *
- * You should have received a copy of the GNU General Public License *
- * along with this program; if not, write to the *
- * Free Software Foundation, Inc., *
- * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. *
- ***************************************************************************/
-
-#ifndef FQTERM_SSH_HASH_H
-#define FQTERM_SSH_HASH_H
-
-#include "fqterm_ssh_types.h"
-
-namespace FQTerm {
-
-class FQTermSSHHash {
-protected:
- int d_digestLength;
- int digestLength()const {
- return d_digestLength;
- }
-
-public:
- FQTermSSHHash() {
- d_digestLength = 0;
- }
- virtual ~FQTermSSHHash() {}
-
- virtual void update(u_char *data, int len) = 0;
- virtual void final(u_char *data) = 0;
-};
-
-} // namespace FQTerm
-
-#endif //FQTERM_SSH_HASH_H
diff --git a/src/protocol/internal/fqterm_ssh_kex.cpp b/src/protocol/internal/fqterm_ssh_kex.cpp
index eb3b012..e2975d1 100644
--- a/src/protocol/internal/fqterm_ssh_kex.cpp
+++ b/src/protocol/internal/fqterm_ssh_kex.cpp
@@ -19,8 +19,8 @@
***************************************************************************/
#include "fqterm_ssh_kex.h"
-#include "fqterm_ssh_md5.h"
#include "fqterm_trace.h"
+#include <openssl/md5.h>
namespace FQTerm {
@@ -191,13 +191,13 @@ void FQTermSSH1Kex::makeSessionKey() {
void FQTermSSH1Kex::makeSessionId() {
u_char *p;
- FQTermSSHMD5 *md5;
+ MD5_CTX ctx;
int servlen, hostlen;
const BIGNUM *host_n;
const BIGNUM *server_n;
const BIGNUM *e, *d;
- md5 = new FQTermSSHMD5;
+ MD5_Init(&ctx);
ssh_pubkey_getrsa(server_key_, &server_n, &e, &d);
ssh_pubkey_getrsa(host_key_, &host_n, &e, &d);
servlen = BN_num_bytes(server_n);
@@ -208,10 +208,10 @@ void FQTermSSH1Kex::makeSessionId() {
BN_bn2bin(host_n, p);
BN_bn2bin(server_n, p+hostlen);
- md5->update(p, servlen + hostlen);
- md5->update(cookie_, 8);
- md5->final(session_id_);
- delete md5;
+ MD5_Update(&ctx, p, servlen+hostlen);
+ MD5_Update(&ctx, cookie_, 8);
+ MD5_Final(session_id_, &ctx);
+
delete [] p;
}
diff --git a/src/protocol/internal/fqterm_ssh_md5.cpp b/src/protocol/internal/fqterm_ssh_md5.cpp
deleted file mode 100644
index 10713e9..0000000
--- a/src/protocol/internal/fqterm_ssh_md5.cpp
+++ /dev/null
@@ -1,36 +0,0 @@
-/***************************************************************************
- * fqterm, a terminal emulator for both BBS and *nix. *
- * Copyright (C) 2008 fqterm development group. *
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. *
- * *
- * This program is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
- * GNU General Public License for more details. *
- * *
- * You should have received a copy of the GNU General Public License *
- * along with this program; if not, write to the *
- * Free Software Foundation, Inc., *
- * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. *
- ***************************************************************************/
-
-#include "fqterm_ssh_md5.h"
-
-namespace FQTerm {
-
-//==============================================================================
-//FQTermSSHMD5
-//==============================================================================
-void FQTermSSHMD5::final(u_char *digest) {
- MD5_Final(digest, &d_md5);
-}
-
-void FQTermSSHMD5::update(u_char *data, int len) {
- MD5_Update(&d_md5, data, len);
-}
-
-} // namespace FQTerm
diff --git a/src/protocol/internal/fqterm_ssh_md5.h b/src/protocol/internal/fqterm_ssh_md5.h
deleted file mode 100644
index abb8127..0000000
--- a/src/protocol/internal/fqterm_ssh_md5.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/***************************************************************************
- * fqterm, a terminal emulator for both BBS and *nix. *
- * Copyright (C) 2008 fqterm development group. *
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. *
- * *
- * This program is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
- * GNU General Public License for more details. *
- * *
- * You should have received a copy of the GNU General Public License *
- * along with this program; if not, write to the *
- * Free Software Foundation, Inc., *
- * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. *
- ***************************************************************************/
-
-#ifndef FQTERM_SSH_MD5_H
-#define FQTERM_SSH_MD5_H
-
-#include <stdio.h>
-
-#include <openssl/md5.h>
-
-#include "fqterm_ssh_types.h"
-#include "fqterm_ssh_hash.h"
-
-namespace FQTerm {
-
-class FQTermSSHMD5: public FQTermSSHHash {
-protected:
- MD5_CTX d_md5;
-public:
- FQTermSSHMD5()
- : FQTermSSHHash() {
- d_digestLength = 16;
- MD5_Init(&d_md5);
- }
- virtual ~FQTermSSHMD5() {}
-
- void update(u_char *data, int len);
- void final(u_char *digest);
-};
-
-} // namespace FQTerm
-
-#endif //FQTERM_SSH_MD5_H