Develop and Download Open Source Software

Browse Subversion Repository

Contents of /branches/ssh_chacha20poly1305/ttssh2/ttxssh/kex.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 9210 - (show annotations) (download) (as text)
Sat Apr 17 08:36:59 2021 UTC (2 years, 10 months ago) by nmaya
File MIME type: text/x-chdr
File size: 5708 byte(s)
ファイルを分割・コードを移動・関数名を整理・新しい OpenSSH からインポート

- OpenSSH からインポート
  cipher-3des1.c from OpenSSH-7.5p1
  ssherr.c from OpenSSH-8.5p1
  ssherr.h from OpenSSH-8.5p1
1 /*
2 * (C) 2011- TeraTerm Project
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 *
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 * 3. The name of the author may not be used to endorse or promote products
15 * derived from this software without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR
18 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20 * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT, INDIRECT,
21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */
28
29 #ifndef KEX_H
30 #define KEX_H
31
32 #include "ttxssh.h"
33
34 // �N���C�A���g�����T�[�o������������
35 enum kex_init_proposals {
36 PROPOSAL_KEX_ALGS,
37 PROPOSAL_SERVER_HOST_KEY_ALGS,
38 PROPOSAL_ENC_ALGS_CTOS,
39 PROPOSAL_ENC_ALGS_STOC,
40 PROPOSAL_MAC_ALGS_CTOS,
41 PROPOSAL_MAC_ALGS_STOC,
42 PROPOSAL_COMP_ALGS_CTOS,
43 PROPOSAL_COMP_ALGS_STOC,
44 PROPOSAL_LANG_CTOS,
45 PROPOSAL_LANG_STOC,
46 PROPOSAL_MAX
47 };
48
49 #define KEX_DEFAULT_KEX ""
50 #define KEX_DEFAULT_PK_ALG ""
51 #define KEX_DEFAULT_ENCRYPT ""
52 #define KEX_DEFAULT_MAC ""
53 #define KEX_DEFAULT_COMP ""
54 #define KEX_DEFAULT_LANG ""
55
56 extern char *myproposal[PROPOSAL_MAX];
57
58 typedef enum {
59 KEX_DH_NONE, /* disabled line */
60 KEX_DH_GRP1_SHA1,
61 KEX_DH_GRP14_SHA1,
62 KEX_DH_GEX_SHA1,
63 KEX_DH_GEX_SHA256,
64 KEX_ECDH_SHA2_256,
65 KEX_ECDH_SHA2_384,
66 KEX_ECDH_SHA2_521,
67 KEX_DH_GRP14_SHA256,
68 KEX_DH_GRP16_SHA512,
69 KEX_DH_GRP18_SHA512,
70 KEX_DH_UNKNOWN,
71 KEX_DH_MAX = KEX_DH_UNKNOWN,
72 } kex_algorithm;
73
74 char* get_kex_algorithm_name(kex_algorithm kextype);
75 const EVP_MD* get_kex_algorithm_EVP_MD(kex_algorithm kextype);
76
77 void normalize_kex_order(char *buf);
78 kex_algorithm choose_SSH2_kex_algorithm(char *server_proposal, char *my_proposal);
79 void SSH2_update_kex_myproposal(PTInstVar pvar);
80
81
82 // SSH_MSG_KEY_DH_GEX_REQUEST ���� min, n, max ��������������������/���� (RFC 4419)
83 #define GEX_GRP_LIMIT_MIN 1024
84 #define GEX_GRP_LIMIT_MAX 8192
85 // GexMinimalGroupSize �� 0 (�f�t�H���g(������)) ���������� min ���g���l
86 // RFC 8270 �� min �������l�� 2048 �������������������A������������ GEX_GRP_LIMIT_MIN
87 // �������������������������A�f�t�H���g���l�����X����
88 #define GEX_GRP_DEFAULT_MIN 2048
89
90 DH *dh_new_group1(void);
91 DH *dh_new_group14(void);
92 DH *dh_new_group15(void);
93 DH *dh_new_group16(void);
94 DH *dh_new_group17(void);
95 DH *dh_new_group18(void);
96 void dh_gen_key(PTInstVar pvar, DH *dh, int we_need /* bytes */ );
97 int dh_estimate(int bits);
98
99 unsigned char *kex_dh_hash(const EVP_MD *evp_md,
100 char *client_version_string,
101 char *server_version_string,
102 char *ckexinit, int ckexinitlen,
103 char *skexinit, int skexinitlen,
104 u_char *serverhostkeyblob, int sbloblen,
105 BIGNUM *client_dh_pub,
106 BIGNUM *server_dh_pub,
107 BIGNUM *shared_secret,
108 unsigned int *hashlen);
109 unsigned char *kex_dh_gex_hash(const EVP_MD *evp_md,
110 char *client_version_string,
111 char *server_version_string,
112 char *ckexinit, int ckexinitlen,
113 char *skexinit, int skexinitlen,
114 u_char *serverhostkeyblob, int sbloblen,
115 int kexgex_min,
116 int kexgex_bits,
117 int kexgex_max,
118 BIGNUM *kexgex_p,
119 BIGNUM *kexgex_g,
120 BIGNUM *client_dh_pub,
121 BIGNUM *server_dh_pub,
122 BIGNUM *shared_secret,
123 unsigned int *hashlen);
124 unsigned char *kex_ecdh_hash(const EVP_MD *evp_md,
125 const EC_GROUP *ec_group,
126 char *client_version_string,
127 char *server_version_string,
128 char *ckexinit, int ckexinitlen,
129 char *skexinit, int skexinitlen,
130 u_char *serverhostkeyblob, int sbloblen,
131 const EC_POINT *client_dh_pub,
132 const EC_POINT *server_dh_pub,
133 BIGNUM *shared_secret,
134 unsigned int *hashlen);
135
136 int dh_pub_is_valid(DH *dh, BIGNUM *dh_pub);
137 void kex_derive_keys(PTInstVar pvar, int need, u_char *hash, BIGNUM *shared_secret,
138 char *session_id, int session_id_len);
139
140 #endif /* KEX_H */

Back to OSDN">Back to OSDN
ViewVC Help
Powered by ViewVC 1.1.26