Subversion Repositories Kolibri OS

Rev

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_SHA256            = 1     ; diffie-hellman-group-exchange-sha256
  50.  
  51. SSHLIB_HOSTKEY_DSS              = 1     ; ssh-dss
  52. SSHLIB_HOSTKEY_RSA              = 2     ; ssh-rsa
  53. SSHLIB_HOSTKEY_RSA_SHA2_256     = 3     ; rsa-sha2-256
  54. SSHLIB_HOSTKEY_RSA_SHA2_512     = 4     ; rsa-sha2-512
  55.  
  56. SSHLIB_CRYPT_AES128_CTR         = 1     ; aes128-ctr
  57. SSHLIB_CRYPT_AES128_CBC         = 2     ; aes128-cbc
  58. SSHLIB_CRYPT_AES192_CTR         = 3     ; aes192-cbc
  59. SSHLIB_CRYPT_AES192_CBC         = 4     ; aes192-ctr
  60. SSHLIB_CRYPT_AES256_CTR         = 5     ; aes256-ctr
  61. SSHLIB_CRYPT_AES256_CBC         = 6     ; aes256-cbc
  62. SSHLIB_CRYPT_CHACHA20_POLY1305  = 7     ; chacha20-poly1305@openssh.com
  63.  
  64. SSHLIB_HMAC_SHA2_256            = 1     ; hmac-sha2-256
  65. SSHLIB_HMAC_SHA2_512            = 2     ; hmac-sha2-512
  66. SSHLIB_HMAC_SHA2_256_ETM        = 3     ; hmac-sha2-256-etm@openssh.com
  67. SSHLIB_HMAC_SHA2_512_ETM        = 4     ; hmac-sha2-512-etm@openssh.com
  68.  
  69. SSHLIB_COMPR_ZLIB               = 1     ; zlib
  70.  
  71. ; Hostkey
  72.  
  73. SSHLIB_HOSTKEY_PROBLEM_UNKNOWN  = 0
  74. SSHLIB_HOSTKEY_PROBLEM_MISMATCH = 1
  75.  
  76. SSHLIB_HOSTKEY_REFUSE           = -1
  77. SSHLIB_HOSTKEY_ACCEPT           = 0
  78. SSHLIB_HOSTKEY_ONCE             = 1
  79.  
  80. ; SSH network packet header
  81.  
  82. struct  ssh_packet_header
  83.  
  84.         packet_length   dd ?    ; The length of the packet in bytes, not including 'mac' or the
  85.                                 ; 'packet_length' field itself.
  86.         padding_length  db ?    ; Length of 'random padding' (bytes).
  87.  
  88.         message_code    db ?    ; First byte of payload
  89.  
  90. ends
  91.  
  92. ; SSH connection structure
  93.  
  94. struct  sshlib_connection
  95.  
  96.         status                  dd ?
  97.         socketnum               dd ?
  98.  
  99.         rx_proc                 dd ?
  100.         tx_proc                 dd ?
  101.  
  102.         rx_mac_ctx              rb LIBCRASH_CTX_LEN
  103.         tx_mac_ctx              rb LIBCRASH_CTX_LEN
  104.  
  105.         rx_crypt_ctx            rb LIBCRASH_CTX_LEN
  106.         tx_crypt_ctx            rb LIBCRASH_CTX_LEN
  107.  
  108.         rx_crypt_proc           dd ?
  109.         tx_crypt_proc           dd ?
  110.  
  111.         rx_crypt_blocksize      dd ?
  112.         tx_crypt_blocksize      dd ?
  113.  
  114.         tx_pad_size             dd ?    ; = Max(8, tx_crypt_blocksize)
  115.                                 dd ?
  116.  
  117.         rx_mac_proc             dd ?
  118.         tx_mac_proc             dd ?
  119.  
  120.         rx_mac_length           dd ?
  121.         tx_mac_length           dd ?
  122.  
  123.                                 rd 3    ; align
  124.         rx_mac_seqnr            dd ?    ; DO NOT MOVE (specific place for HMAC)
  125.         rx_buffer               ssh_packet_header
  126.                                 rb BUFFERSIZE-sizeof.ssh_packet_header
  127.  
  128.         tx_mac_seqnr            dd ?    ; DO NOT MOVE (specific place for HMAC)
  129.         tx_buffer               ssh_packet_header
  130.                                 rb PACKETSIZE-sizeof.ssh_packet_header
  131.  
  132.         part_ex_hash_ctx        rb LIBCRASH_CTX_LEN
  133.         session_id              rb SHA2_256_LEN
  134.  
  135.         algo_kex                dd ?
  136.         algo_hostkey            dd ?
  137.         algo_crypt_rx           dd ?
  138.         algo_crypt_tx           dd ?
  139.         algo_mac_rx             dd ?
  140.         algo_mac_tx             dd ?
  141.         algo_compr_rx           dd ?
  142.         algo_compr_tx           dd ?
  143.  
  144.         hostname_sz             rb MAX_HOSTNAME_LENGTH
  145.  
  146.         rx_enc_key              rb 2*256/8
  147.         tx_enc_key              rb 2*256/8
  148.         rx_int_key              rb 2*256/8
  149.         tx_int_key              rb 2*256/8
  150.         rx_iv                   rb 2*256/8
  151.         tx_iv                   rb 2*256/8
  152.  
  153. ends
  154.  
  155. ; SSH channel structure
  156.  
  157. struct  sshlib_channel
  158.  
  159.         id                      dd ?    ; Channel ID (big endian)
  160.         status                  dd ?    ; Channel status
  161.         rcv_wnd                 dd ?    ; Receive window
  162.         snd_wnd                 dd ?    ; Send window
  163.  
  164. ;        rcv_callb               dd ?    ; TODO
  165.  
  166. ends
  167.