Subversion Repositories Kolibri OS

Rev

Rev 9106 | Rev 9987 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

  1. ;    sshlib.inc - SSHlib constants
  2. ;
  3. ;    Copyright (C) 2016-2021 Jeffrey Amelynck
  4. ;
  5. ;    This program is free software: you can redistribute it and/or modify
  6. ;    it under the terms of the GNU General Public License as published by
  7. ;    the Free Software Foundation, either version 3 of the License, or
  8. ;    (at your option) any later version.
  9. ;
  10. ;    This program is distributed in the hope that it will be useful,
  11. ;    but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. ;    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  13. ;    GNU General Public License for more details.
  14. ;
  15. ;    You should have received a copy of the GNU General Public License
  16. ;    along with this program.  If not, see <http://www.gnu.org/licenses/>.
  17.  
  18.  
  19. ; Error codes
  20.  
  21. SSHLIB_ERR_NOMEM                =  -1
  22. SSHLIB_ERR_SOCKET               =  -2
  23. SSHLIB_ERR_PROTOCOL             =  -3
  24. SSHLIB_ERR_HOSTNAME             =  -4
  25. SSHLIB_ERR_DISCONNECTING        =  -5
  26. SSHLIB_ERR_MAC_VERIFY_FAIL      =  -6
  27. SSHLIB_ERR_HKEY_NO_ALGO         =  -7
  28. SSHLIB_ERR_HKEY_VERIFY_FAIL     =  -8
  29. SSHLIB_ERR_HKEY_SIGNATURE       =  -9
  30. SSHLIB_ERR_HKEY_PUBLIC_KEY      = -10
  31.  
  32. ; Channel status codes
  33.  
  34. SSHLIB_CHAN_STAT_CONNECTING     = 0
  35. SSHLIB_CHAN_STAT_CONNECTED      = 1
  36. SSHLIB_CHAN_STAT_EOF_RECEIVED   = 2
  37. SSHLIB_CHAN_STAT_CLOSING        = 3
  38. SSHLIB_CHAN_STAT_CLOSED         = 3
  39.  
  40. ; Connection status codes
  41.  
  42. SSHLIB_CON_STAT_INIT            = 0
  43. SSHLIB_CON_STAT_KEX_DONE        = 1
  44.  
  45. ; Algorithm identifier codes
  46.  
  47. SSHLIB_ALGO_NONE                = 0
  48.  
  49. SSHLIB_KEX_DH_SHA1              = 1
  50. SSHLIB_KEX_DH_SHA256            = 2
  51.  
  52. SSHLIB_HOSTKEY_DSS              = 1
  53. SSHLIB_HOSTKEY_RSA              = 2
  54. SSHLIB_HOSTKEY_RSA_SHA2_256     = 3
  55. SSHLIB_HOSTKEY_RSA_SHA2_512     = 4
  56.  
  57. SSHLIB_CRYPT_BLOWFISH_CTR       = 1
  58. SSHLIB_CRYPT_BLOWFISH_CBC       = 2
  59. SSHLIB_CRYPT_AES128_CTR         = 3
  60. SSHLIB_CRYPT_AES128_CBC         = 4
  61. SSHLIB_CRYPT_AES192_CTR         = 5
  62. SSHLIB_CRYPT_AES192_CBC         = 6
  63. SSHLIB_CRYPT_AES256_CTR         = 7
  64. SSHLIB_CRYPT_AES256_CBC         = 8
  65.  
  66. SSHLIB_HMAC_MD5                 = 1
  67. SSHLIB_HMAC_SHA1                = 2
  68. SSHLIB_HMAC_SHA1_96             = 3
  69. SSHLIB_HMAC_SHA2_256            = 4
  70.  
  71. SSHLIB_COMPR_NONE               = 1
  72. SSHLIB_COMPR_ZLIB               = 2
  73.  
  74. ; Hostkey
  75.  
  76. SSHLIB_HOSTKEY_PROBLEM_UNKNOWN  = 0
  77. SSHLIB_HOSTKEY_PROBLEM_MISMATCH = 1
  78.  
  79. SSHLIB_HOSTKEY_REFUSE           = -1
  80. SSHLIB_HOSTKEY_ACCEPT           = 0
  81. SSHLIB_HOSTKEY_ONCE             = 1
  82.  
  83. ; SSH network packet header
  84.  
  85. struct  ssh_packet_header
  86.  
  87.         packet_length   dd ?    ; The length of the packet in bytes, not including 'mac' or the
  88.                                 ; 'packet_length' field itself.
  89.         padding_length  db ?    ; Length of 'random padding' (bytes).
  90.  
  91.         message_code    db ?    ; First byte of payload
  92.  
  93. ends
  94.  
  95. ; SSH connection structure
  96.  
  97. struct  sshlib_connection
  98.  
  99.         status                  dd ?
  100.  
  101.         socketnum               dd ?
  102.  
  103.         rx_crypt_proc           dd ?
  104.         tx_crypt_proc           dd ?
  105.         rx_crypt_ctx_ptr        dd ?
  106.         tx_crypt_ctx_ptr        dd ?
  107.         rx_crypt_blocksize      dd ?
  108.         tx_crypt_blocksize      dd ?
  109.  
  110.         tx_pad_size             dd ?    ; = Max(8, tx_crypt_blocksize)
  111.         tx_pad_proc             dd ?
  112.  
  113.         rx_mac_proc             dd ?
  114.         tx_mac_proc             dd ?
  115.         rx_mac_ctx              hmac_sha256_context
  116.         tx_mac_ctx              hmac_sha256_context
  117.         rx_mac_length           dd ?
  118.         tx_mac_length           dd ?
  119.  
  120.         rx_mac_seqnr            dd ?    ; DO NOT MOVE
  121.         rx_buffer               ssh_packet_header
  122.                                 rb BUFFERSIZE-sizeof.ssh_packet_header
  123.  
  124.         tx_mac_seqnr            dd ?    ; DO NOT MOVE
  125.         tx_buffer               ssh_packet_header
  126.                                 rb PACKETSIZE-sizeof.ssh_packet_header
  127.  
  128.         part_ex_hash_ctx        rb LIBCRASH_CTX_LEN
  129.         session_id              rb SHA2_256_LEN
  130.  
  131.         algo_kex                dd ?
  132.         algo_hostkey            dd ?
  133.         algo_crypt_rx           dd ?
  134.         algo_crypt_tx           dd ?
  135.         algo_mac_rx             dd ?
  136.         algo_mac_tx             dd ?
  137.         algo_compr_rx           dd ?
  138.         algo_compr_tx           dd ?
  139.  
  140.         hostname_sz             rb MAX_HOSTNAME_LENGTH
  141.  
  142. ends
  143.  
  144. ; SSH channel structure
  145.  
  146. struct  sshlib_channel
  147.  
  148.         id                      dd ?    ; Channel ID (big endian)
  149.         status                  dd ?    ; Channel status
  150.         rcv_wnd                 dd ?    ; Receive window
  151.         snd_wnd                 dd ?    ; Send window
  152.  
  153. ;        rcv_callb               dd ?    ; TODO
  154.  
  155. ends
  156.