Develop and Download Open Source Software

Browse Subversion Repository

Diff of /branches/ssh_chacha20poly1305/ttssh2/ttxssh/ssh.h

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 4374 by doda, Tue Mar 8 01:00:58 2011 UTC revision 4378 by maya, Tue Mar 8 14:19:03 2011 UTC
# Line 91  typedef enum { Line 91  typedef enum {
91          SSH2_CIPHER_ARCFOUR, SSH2_CIPHER_ARCFOUR128, SSH2_CIPHER_ARCFOUR256,          SSH2_CIPHER_ARCFOUR, SSH2_CIPHER_ARCFOUR128, SSH2_CIPHER_ARCFOUR256,
92          SSH2_CIPHER_CAST128_CBC,          SSH2_CIPHER_CAST128_CBC,
93          SSH2_CIPHER_3DES_CTR, SSH2_CIPHER_BLOWFISH_CTR, SSH2_CIPHER_CAST128_CTR,          SSH2_CIPHER_3DES_CTR, SSH2_CIPHER_BLOWFISH_CTR, SSH2_CIPHER_CAST128_CTR,
94            SSH_CIPHER_MAX = SSH2_CIPHER_CAST128_CTR,
95  } SSHCipher;  } SSHCipher;
96    
 #define SSH_CIPHER_MAX SSH2_CIPHER_CAST128_CTR  
   
97  typedef enum {  typedef enum {
98          SSH_AUTH_NONE, SSH_AUTH_RHOSTS, SSH_AUTH_RSA, SSH_AUTH_PASSWORD,          SSH_AUTH_NONE, SSH_AUTH_RHOSTS, SSH_AUTH_RSA, SSH_AUTH_PASSWORD,
99          SSH_AUTH_RHOSTS_RSA, SSH_AUTH_TIS, SSH_AUTH_KERBEROS,          SSH_AUTH_RHOSTS_RSA, SSH_AUTH_TIS, SSH_AUTH_KERBEROS,
100          SSH_AUTH_PAGEANT = 16,          SSH_AUTH_PAGEANT = 16,
101            SSH_AUTH_MAX = SSH_AUTH_PAGEANT,
102  } SSHAuthMethod;  } SSHAuthMethod;
103    
 #define SSH_AUTH_MAX SSH_AUTH_PAGEANT  
   
104  typedef enum {  typedef enum {
105          SSH_GENERIC_AUTHENTICATION, SSH_TIS_AUTHENTICATION          SSH_GENERIC_AUTHENTICATION, SSH_TIS_AUTHENTICATION
106  } SSHAuthMode;  } SSHAuthMode;
# Line 197  enum channel_type { Line 195  enum channel_type {
195  #define SSH2_OPEN_UNKNOWN_CHANNEL_TYPE           3  #define SSH2_OPEN_UNKNOWN_CHANNEL_TYPE           3
196  #define SSH2_OPEN_RESOURCE_SHORTAGE              4  #define SSH2_OPEN_RESOURCE_SHORTAGE              4
197    
 enum ssh_keytype {  
         KEY_NONE,  
         KEY_RSA1,  
         KEY_RSA,  
         KEY_DSA,  
         KEY_ECDSA256,  
         KEY_ECDSA384,  
         KEY_ECDSA521,  
         KEY_UNSPEC,  
         KEY_MAX = KEY_UNSPEC,  
 };  
 #define isECDSAkey(type)        ((type) >= KEY_ECDSA256 && (type) <= KEY_ECDSA521)  
   
 typedef struct ssh2_host_key {  
         enum ssh_keytype type;  
         char *name;  
 } ssh2_host_key_t;  
   
 static ssh2_host_key_t ssh2_host_key[] = {  
         {KEY_NONE, "none"},  
         {KEY_RSA1, "ssh-rsa1"},  // for SSH1 only  
         {KEY_RSA, "ssh-rsa"},  
         {KEY_DSA, "ssh-dss"},  
         {KEY_ECDSA256, "ecdsa-sha2-nistp256"},  
         {KEY_ECDSA384, "ecdsa-sha2-nistp384"},  
         {KEY_ECDSA521, "ecdsa-sha2-nistp521"},  
         {KEY_UNSPEC, "ssh-unknown"},  
 };  
   
 #define KEX_DEFAULT_KEX     "ecdh-sha2-nistp256," \  
                             "ecdh-sha2-nistp384," \  
                             "ecdh-sha2-nistp521," \  
                             "diffie-hellman-group-exchange-sha256," \  
                             "diffie-hellman-group-exchange-sha1," \  
                             "diffie-hellman-group14-sha1," \  
                             "diffie-hellman-group1-sha1"  
 #define KEX_DEFAULT_PK_ALG  "ecdsa-sha2-nistp256," \  
                             "ecdsa-sha2-nistp384," \  
                             "ecdsa-sha2-nistp521," \  
                             "ssh-rsa,ssh-dss"  
 // use the setting of pvar.CipherOrder.  
 #define KEX_DEFAULT_ENCRYPT ""  
 #define KEX_DEFAULT_MAC     "hmac-sha1,hmac-md5"  
 // support of "Compression delayed" (2006.6.23 maya)  
 #define KEX_DEFAULT_COMP    "none,zlib@openssh.com,zlib"  
 #define KEX_DEFAULT_LANG    ""  
   
 /* Minimum modulus size (n) for RSA keys. */  
 #define SSH_RSA_MINIMUM_MODULUS_SIZE    768  
   
 #define SSH_KEYGEN_DEFAULT_BITS   2048  
 #define SSH_RSA_MINIMUM_KEY_SIZE   768  
 #define SSH_DSA_MINIMUM_KEY_SIZE  1024  
198    
199    // クライアントからサーバへの提案事項
200  enum kex_init_proposals {  enum kex_init_proposals {
201          PROPOSAL_KEX_ALGS,          PROPOSAL_KEX_ALGS,
202          PROPOSAL_SERVER_HOST_KEY_ALGS,          PROPOSAL_SERVER_HOST_KEY_ALGS,
# Line 265  enum kex_init_proposals { Line 211  enum kex_init_proposals {
211          PROPOSAL_MAX          PROPOSAL_MAX
212  };  };
213    
214    #define KEX_DEFAULT_KEX     ""
215    #define KEX_DEFAULT_PK_ALG  ""
216    #define KEX_DEFAULT_ENCRYPT ""
217    #define KEX_DEFAULT_MAC     ""
218    #define KEX_DEFAULT_COMP    ""
219    #define KEX_DEFAULT_LANG    ""
220    
 // クライアントからサーバへの提案事項  
 #ifdef SSH2_DEBUG  
 static char *myproposal[PROPOSAL_MAX] = {  
 //      KEX_DEFAULT_KEX,  
         "diffie-hellman-group14-sha1,diffie-hellman-group1-sha1,diffie-hellman-group-exchange-sha1,diffie-hellman-group-exchange-sha256",  
         KEX_DEFAULT_PK_ALG,  
 //      "ssh-dss,ssh-rsa",  
         KEX_DEFAULT_ENCRYPT,  
         KEX_DEFAULT_ENCRYPT,  
         "hmac-md5,hmac-sha1",  
         "hmac-md5,hmac-sha1",  
 //      "hmac-sha1",  
 //      "hmac-sha1",  
 //      KEX_DEFAULT_MAC,  
 //      KEX_DEFAULT_MAC,  
         KEX_DEFAULT_COMP,  
         KEX_DEFAULT_COMP,  
         KEX_DEFAULT_LANG,  
         KEX_DEFAULT_LANG,  
 };  
 #else  
221  static char *myproposal[PROPOSAL_MAX] = {  static char *myproposal[PROPOSAL_MAX] = {
222          KEX_DEFAULT_KEX,          KEX_DEFAULT_KEX,
223          KEX_DEFAULT_PK_ALG,          KEX_DEFAULT_PK_ALG,
# Line 299  static char *myproposal[PROPOSAL_MAX] = Line 230  static char *myproposal[PROPOSAL_MAX] =
230          KEX_DEFAULT_LANG,          KEX_DEFAULT_LANG,
231          KEX_DEFAULT_LANG,          KEX_DEFAULT_LANG,
232  };  };
233  #endif  
234    
235    typedef enum {
236            KEY_NONE,
237            KEY_RSA1,
238            KEY_RSA,
239            KEY_DSA,
240            KEY_ECDSA256,
241            KEY_ECDSA384,
242            KEY_ECDSA521,
243            KEY_UNSPEC,
244            KEY_MAX = KEY_UNSPEC,
245    } ssh_keytype;
246    #define isECDSAkey(type)        ((type) >= KEY_ECDSA256 && (type) <= KEY_ECDSA521)
247    
248    typedef struct ssh2_host_key {
249            ssh_keytype type;
250            char *name;
251    } ssh2_host_key_t;
252    
253    static ssh2_host_key_t ssh2_host_key[] = {
254            {KEY_RSA1,     "ssh-rsa1"},  // for SSH1 only
255            {KEY_RSA,      "ssh-rsa"},
256            {KEY_DSA,      "ssh-dss"},
257            {KEY_ECDSA256, "ecdsa-sha2-nistp256"},
258            {KEY_ECDSA384, "ecdsa-sha2-nistp384"},
259            {KEY_ECDSA521, "ecdsa-sha2-nistp521"},
260            {KEY_UNSPEC,   "ssh-unknown"},
261            {KEY_NONE,     NULL},
262    };
263    
264    /* Minimum modulus size (n) for RSA keys. */
265    #define SSH_RSA_MINIMUM_MODULUS_SIZE    768
266    
267    #define SSH_KEYGEN_DEFAULT_BITS   2048
268    #define SSH_RSA_MINIMUM_KEY_SIZE   768
269    #define SSH_DSA_MINIMUM_KEY_SIZE  1024
270    
271    
272  typedef struct ssh2_cipher {  typedef struct ssh2_cipher {
# Line 331  static ssh2_cipher_t ssh2_ciphers[] = { Line 298  static ssh2_cipher_t ssh2_ciphers[] = {
298  };  };
299    
300    
301  // 下記のインデックスは ssh2_kex_algorithms[] と合わせること。  typedef enum {
 enum kex_algorithm {  
302          KEX_DH_NONE,       /* disabled line */          KEX_DH_NONE,       /* disabled line */
303          KEX_DH_GRP1_SHA1,          KEX_DH_GRP1_SHA1,
304          KEX_DH_GRP14_SHA1,          KEX_DH_GRP14_SHA1,
# Line 343  enum kex_algorithm { Line 309  enum kex_algorithm {
309          KEX_ECDH_SHA2_521,          KEX_ECDH_SHA2_521,
310          KEX_DH_UNKNOWN,          KEX_DH_UNKNOWN,
311          KEX_DH_MAX = KEX_DH_UNKNOWN,          KEX_DH_MAX = KEX_DH_UNKNOWN,
312  };  } kex_algorithm;
313    
314  typedef struct ssh2_kex_algorithm {  typedef struct ssh2_kex_algorithm {
315          enum kex_algorithm kextype;          kex_algorithm kextype;
316          char *name;          char *name;
317          const EVP_MD *(*evp_md)(void);          const EVP_MD *(*evp_md)(void);
318  } ssh2_kex_algorithm_t;  } ssh2_kex_algorithm_t;
319    
320  static ssh2_kex_algorithm_t ssh2_kex_algorithms[] = {  static ssh2_kex_algorithm_t ssh2_kex_algorithms[] = {
         {KEX_DH_NONE      , "none",                                 NULL},  
321          {KEX_DH_GRP1_SHA1,  "diffie-hellman-group1-sha1",           EVP_sha1},          {KEX_DH_GRP1_SHA1,  "diffie-hellman-group1-sha1",           EVP_sha1},
322          {KEX_DH_GRP14_SHA1, "diffie-hellman-group14-sha1",          EVP_sha1},          {KEX_DH_GRP14_SHA1, "diffie-hellman-group14-sha1",          EVP_sha1},
323          {KEX_DH_GEX_SHA1,   "diffie-hellman-group-exchange-sha1",   EVP_sha1},          {KEX_DH_GEX_SHA1,   "diffie-hellman-group-exchange-sha1",   EVP_sha1},
# Line 360  static ssh2_kex_algorithm_t ssh2_kex_alg Line 325  static ssh2_kex_algorithm_t ssh2_kex_alg
325          {KEX_ECDH_SHA2_256, "ecdh-sha2-nistp256",                   EVP_sha256},          {KEX_ECDH_SHA2_256, "ecdh-sha2-nistp256",                   EVP_sha256},
326          {KEX_ECDH_SHA2_384, "ecdh-sha2-nistp384",                   EVP_sha384},          {KEX_ECDH_SHA2_384, "ecdh-sha2-nistp384",                   EVP_sha384},
327          {KEX_ECDH_SHA2_521, "ecdh-sha2-nistp521",                   EVP_sha512},          {KEX_ECDH_SHA2_521, "ecdh-sha2-nistp521",                   EVP_sha512},
328          {KEX_DH_UNKNOWN   , NULL                                  , NULL},          {KEX_DH_NONE      , NULL,                                   NULL},
329  };  };
330    
331    
332  // 下記のインデックスは ssh2_macs[] と合わせること。  typedef enum {
333  enum hmac_type {          HMAC_NONE,      /* disabled line */
         HMAC_NONE,  
334          HMAC_SHA1,          HMAC_SHA1,
335          HMAC_MD5,          HMAC_MD5,
336          HMAC_UNKNOWN,          HMAC_UNKNOWN,
337          HMAC_MAX = HMAC_UNKNOWN,          HMAC_MAX = HMAC_UNKNOWN,
338  };  } hmac_type;
339    
340  typedef struct ssh2_mac {  typedef struct ssh2_mac {
341          enum hmac_type type;          hmac_type type;
342          char *name;          char *name;
343          const EVP_MD *(*func)(void);          const EVP_MD *(*evp_md)(void);
344          int truncatebits;          int truncatebits;
345  } ssh2_mac_t;  } ssh2_mac_t;
346    
347  static ssh2_mac_t ssh2_macs[] = {  static ssh2_mac_t ssh2_macs[] = {
         {HMAC_NONE,    "none",      NULL,     0},  
348          {HMAC_SHA1,    "hmac-sha1", EVP_sha1, 0},          {HMAC_SHA1,    "hmac-sha1", EVP_sha1, 0},
349          {HMAC_MD5,     "hmac-md5",  EVP_md5,  0},          {HMAC_MD5,     "hmac-md5",  EVP_md5,  0},
350          {HMAC_UNKNOWN, NULL,        NULL,     0},          {HMAC_NONE,    NULL,        NULL,     0},
351  };  };
352    
353    
354  // 下記のインデックスは ssh_comps[] と合わせること。  typedef enum {
355  enum compression_type {          COMP_NONE,      /* disabled line */
356          COMP_NONE,          COMP_NOCOMP,
357          COMP_ZLIB,          COMP_ZLIB,
358          COMP_DELAYED,          COMP_DELAYED,
359          COMP_UNKNOWN,          COMP_UNKNOWN,
360          COMP_MAX = COMP_UNKNOWN,          COMP_MAX = COMP_UNKNOWN,
361  };  } compression_type;
362    
363  typedef struct ssh_comp {  typedef struct ssh2_comp {
364          enum compression_type type;          compression_type type;
365          char *name;          char *name;
366  } ssh_comp_t;  } ssh2_comp_t;
367    
368  static ssh_comp_t ssh_comps[] = {  static ssh2_comp_t ssh2_comps[] = {
369          {COMP_NONE,    "none"},          {COMP_NOCOMP,  "none"},
370          {COMP_ZLIB,    "zlib"},          {COMP_ZLIB,    "zlib"},
371          {COMP_DELAYED, "zlib@openssh.com"},          {COMP_DELAYED, "zlib@openssh.com"},
372          {COMP_UNKNOWN, NULL},          {COMP_NONE,    NULL},
373  };  };
374    
375    
# Line 450  enum kex_modes { Line 413  enum kex_modes {
413  // ホストキー(SSH1, SSH2含む)のデータ構造 (2006.3.21 yutaka)  // ホストキー(SSH1, SSH2含む)のデータ構造 (2006.3.21 yutaka)
414  typedef struct Key {  typedef struct Key {
415          // host key type          // host key type
416          enum ssh_keytype type;          ssh_keytype type;
417          // SSH2 RSA          // SSH2 RSA
418          RSA *rsa;          RSA *rsa;
419          // SSH2 DSA          // SSH2 DSA
# Line 608  BOOL do_SSH2_authrequest(PTInstVar pvar) Line 571  BOOL do_SSH2_authrequest(PTInstVar pvar)
571  void debug_print(int no, char *msg, int len);  void debug_print(int no, char *msg, int len);
572  int get_cipher_block_size(SSHCipher cipher);  int get_cipher_block_size(SSHCipher cipher);
573  int get_cipher_key_len(SSHCipher cipher);  int get_cipher_key_len(SSHCipher cipher);
574    char* get_kex_algorithm_name(kex_algorithm kextype);
575  const EVP_CIPHER* get_cipher_EVP_CIPHER(SSHCipher cipher);  const EVP_CIPHER* get_cipher_EVP_CIPHER(SSHCipher cipher);
576    const EVP_MD* get_kex_algorithm_EVP_MD(kex_algorithm kextype);
577    char* get_ssh2_mac_name(hmac_type type);
578    const EVP_MD* get_ssh2_mac_EVP_MD(hmac_type type);
579    int get_ssh2_mac_truncatebits(hmac_type type);
580    char* get_ssh2_comp_name(compression_type type);
581    char* get_ssh_keytype_name(ssh_keytype type);
582  int get_cipher_discard_len(SSHCipher cipher);  int get_cipher_discard_len(SSHCipher cipher);
583  void ssh_heartbeat_lock_initialize(void);  void ssh_heartbeat_lock_initialize(void);
584  void ssh_heartbeat_lock_finalize(void);  void ssh_heartbeat_lock_finalize(void);

Legend:
Removed from v.4374  
changed lines
  Added in v.4378

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