From 012e4d749affb072325cf970889a292b2213aa83 Mon Sep 17 00:00:00 2001 From: Iru Cai Date: Sat, 29 Oct 2016 17:07:12 +0800 Subject: Remove fqterm_ssh_{rsa,pubkey} --- src/protocol/CMakeLists.txt | 1 - src/protocol/fqterm_ssh_socket.cpp | 1 - src/protocol/internal/fqterm_ssh_pubkey.h | 37 ----------------- src/protocol/internal/fqterm_ssh_rsa.cpp | 67 ------------------------------- src/protocol/internal/fqterm_ssh_rsa.h | 41 ------------------- 5 files changed, 147 deletions(-) delete mode 100644 src/protocol/internal/fqterm_ssh_pubkey.h delete mode 100644 src/protocol/internal/fqterm_ssh_rsa.cpp delete mode 100644 src/protocol/internal/fqterm_ssh_rsa.h diff --git a/src/protocol/CMakeLists.txt b/src/protocol/CMakeLists.txt index 40f0dba..498d351 100644 --- a/src/protocol/CMakeLists.txt +++ b/src/protocol/CMakeLists.txt @@ -32,7 +32,6 @@ set(internal_SRCS internal/fqterm_ssh2_packet.h internal/fqterm_ssh_channel.h internal/fqterm_ssh_types.h - internal/fqterm_ssh_pubkey.h internal/crc32.cpp internal/fqterm_ssh_auth.cpp internal/fqterm_ssh_buffer.cpp diff --git a/src/protocol/fqterm_ssh_socket.cpp b/src/protocol/fqterm_ssh_socket.cpp index 8c24f88..71031f6 100644 --- a/src/protocol/fqterm_ssh_socket.cpp +++ b/src/protocol/fqterm_ssh_socket.cpp @@ -23,7 +23,6 @@ #include "fqterm_ssh1_packet.h" #include "fqterm_ssh2_packet.h" #include "fqterm_ssh_buffer.h" -#include "fqterm_ssh_rsa.h" #include "fqterm_ssh_kex.h" #include "fqterm_ssh2_kex.h" #include "fqterm_ssh_const.h" diff --git a/src/protocol/internal/fqterm_ssh_pubkey.h b/src/protocol/internal/fqterm_ssh_pubkey.h deleted file mode 100644 index 0de957c..0000000 --- a/src/protocol/internal/fqterm_ssh_pubkey.h +++ /dev/null @@ -1,37 +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_PUB_KEY_H -#define FQTERM_SSH_PUB_KEY_H - -#include - -namespace FQTerm { - -class FQTermSSHPubKey { -public: - FQTermSSHPubKey() {} - virtual ~FQTermSSHPubKey() {} - virtual void publicEncrypt(BIGNUM *, BIGNUM*) = 0; -}; - -} // namespace FQTerm - -#endif // FQTERM_SSH_PUB_KEY_H diff --git a/src/protocol/internal/fqterm_ssh_rsa.cpp b/src/protocol/internal/fqterm_ssh_rsa.cpp deleted file mode 100644 index dd36898..0000000 --- a/src/protocol/internal/fqterm_ssh_rsa.cpp +++ /dev/null @@ -1,67 +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 - -#include "fqterm_trace.h" -#include "fqterm_ssh_types.h" -#include "fqterm_ssh_rsa.h" - -namespace FQTerm { - -FQTermSSHRSA::FQTermSSHRSA() { - d_rsa = RSA_new(); - d_rsa->n = BN_new(); - d_rsa->e = BN_new(); -} - -FQTermSSHRSA::~FQTermSSHRSA() { - if (d_rsa != NULL) { - RSA_free(d_rsa); - } -} - -void FQTermSSHRSA::publicEncrypt(BIGNUM *out, BIGNUM *in) { - u_char *inbuf, *outbuf; - int len, ilen, olen; - - if (BN_num_bits(d_rsa->e) < 2 || !BN_is_odd(d_rsa->e)) { - FQ_VERIFY(false); // public_encrypt() exponent too small or not odd. - } - - olen = BN_num_bytes(d_rsa->n); - outbuf = new u_char[olen]; - - ilen = BN_num_bytes(in); - inbuf = new u_char[ilen]; - BN_bn2bin(in, inbuf); - - if ((len = RSA_public_encrypt(ilen, inbuf, outbuf, d_rsa, RSA_PKCS1_PADDING)) <= 0) { - //RSA_PKCS1_PADDING = 1 - FQ_VERIFY(false); // "rsa_public_encrypt() failed. - } - - BN_bin2bn(outbuf, len, out); - - delete [] outbuf; - delete [] inbuf; -} - -} // namespace FQTerm diff --git a/src/protocol/internal/fqterm_ssh_rsa.h b/src/protocol/internal/fqterm_ssh_rsa.h deleted file mode 100644 index bfe89ce..0000000 --- a/src/protocol/internal/fqterm_ssh_rsa.h +++ /dev/null @@ -1,41 +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_RSA_H -#define FQTERM_SSH_RSA_H - -#include - -#include "fqterm_ssh_pubkey.h" - -namespace FQTerm { - -class FQTermSSHRSA: public FQTermSSHPubKey { -public: - RSA *d_rsa; - FQTermSSHRSA(); - virtual ~FQTermSSHRSA(); - - virtual void publicEncrypt(BIGNUM *, BIGNUM*); -}; - -} // namespace FQTerm - -#endif // FQTERM_SSH_RSA_H -- cgit v1.2.3