Subversion Repositories Kolibri OS

Rev

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

  1. ;    ssh.asm - SSH client for KolibriOS
  2. ;
  3. ;    Copyright (C) 2015-2024 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. format binary as ""
  19.  
  20. __DEBUG__               = 1
  21. __DEBUG_LEVEL__         = 2             ; 1: Everything, including sensitive information, 2: Debugging, 3: Errors only
  22.  
  23. BUFFERSIZE              = 64*1024       ; Must be at least 32K according rfc4253#section-6.1
  24. PACKETSIZE              = 32*1024       ; Must be at least 32K according rfc4253#section-6.1
  25. MAX_BITS                = 8192
  26.  
  27. DH_PRIVATE_KEY_SIZE     = 256
  28. MAX_INPUT_LENGTH        = 255
  29. MAX_USERNAME_LENGTH     = 256
  30. MAX_PASSWORD_LENGTH     = 256
  31. MAX_HOSTNAME_LENGTH     = 4096
  32. MAX_PUBLIC_KEY_SIZE     = 4096
  33.  
  34. use32
  35.  
  36.         db      'MENUET01'      ; signature
  37.         dd      1               ; header version
  38.         dd      start           ; entry point
  39.         dd      i_end           ; initialized size
  40.         dd      mem+65536       ; required memory
  41.         dd      mem+65536       ; stack pointer
  42.         dd      params          ; parameters
  43.         dd      0               ; path
  44.  
  45. include '../../macros.inc'
  46. ;include '../../struct.inc'
  47. purge mov,add,sub
  48. include '../../proc32.inc'
  49. include '../../dll.inc'
  50. include '../../debug-fdo.inc'
  51. include '../../network.inc'
  52. include '../../develop/libraries/libcrash/libcrash.inc'
  53.  
  54. ; macros for network byte order
  55. macro dd_n op {
  56.    dd 0 or (((op) and 0FF000000h) shr 24) or \
  57.            (((op) and 000FF0000h) shr  8) or \
  58.            (((op) and 00000FF00h) shl  8) or \
  59.            (((op) and 0000000FFh) shl 24)
  60. }
  61.  
  62. macro dw_n op {
  63.    dw 0 or (((op) and 0FF00h) shr 8) or \
  64.            (((op) and 000FFh) shl 8)
  65. }
  66.  
  67. macro str string {
  68.     local .start, .stop
  69.  
  70.     dd_n (.stop-.start)
  71.  
  72.     .start db string
  73.     .stop:
  74. }
  75.  
  76. proc dump_hex _ptr, _length
  77. if __DEBUG_LEVEL__ <= 1
  78.         pushad
  79.  
  80.         mov     esi, [_ptr]
  81.         mov     ecx, [_length]
  82.   .next_dword:
  83.         lodsd
  84.         bswap   eax
  85.         DEBUGF  1,'%x', eax
  86.         loop    .next_dword
  87.         DEBUGF  1,'\n'
  88.  
  89.         popad
  90. end if
  91.         ret
  92. endp
  93.  
  94. macro DEBUGM l, s, m {
  95. if __DEBUG__
  96.         DEBUGF  l, s
  97.   if l >=__DEBUG_LEVEL__
  98.         stdcall mpint_print, m
  99.   end if
  100. end if
  101. }
  102.  
  103. include 'mpint.inc'
  104. include 'seed.inc'
  105. include 'random.inc'
  106.  
  107. include 'sshlib.inc'
  108.  
  109. include 'sshlib_mcodes.inc'
  110. include 'sshlib_transport.inc'
  111. include 'sshlib_transport_hmac.inc'
  112. include 'sshlib_transport_polychacha.inc'
  113. include 'sshlib_connection.inc'
  114. include 'sshlib_dh_gex.inc'
  115. include 'sshlib_host.inc'
  116. include 'sshlib_channel.inc'
  117. include 'sshlib_userauth.inc'
  118.  
  119. include 'encodings.inc'         ; Unfortunately, we dont have UTF-8 capable console yet :(
  120.  
  121. start:
  122.         mcall   68, 11          ; Init heap
  123.  
  124.         DEBUGF  2, "SSH: Loading libraries\n"
  125.         stdcall dll.Load, @IMPORT
  126.         test    eax, eax
  127.         jnz     main.fail
  128.  
  129.         DEBUGF  2, "SSH: Init PRNG\n"
  130.         call    create_seed
  131.         call    init_random
  132.  
  133.         DEBUGF  2, "SSH: Init Console\n"
  134.         invoke  con_start, 1
  135.         invoke  con_init, 80, 25, 80, 250, title
  136.  
  137.         cmp     byte[params], 0
  138.         jne     main.connect
  139.  
  140. main:
  141.         invoke  con_cls
  142. ; Welcome user
  143.         invoke  con_write_asciiz, str1a
  144.   .prompt:
  145.         invoke  con_write_asciiz, str1b
  146. ; Reset window title
  147.         invoke  con_set_title, title
  148. ; Write prompt
  149.         invoke  con_write_asciiz, str2
  150. ; read string
  151.         mov     esi, params
  152.         invoke  con_gets, esi, MAX_HOSTNAME_LENGTH
  153. ; check for exit
  154.         test    eax, eax
  155.         jz      .done
  156.         cmp     byte[esi], 10
  157.         jz      .done
  158.  
  159.   .connect:
  160.         stdcall sshlib_connect, ssh_con, params
  161.         cmp     eax, 0
  162.         jg      .prompt
  163.         jl      .error
  164.  
  165.   .login:
  166.         mcall   68, 12, (MAX_USERNAME_LENGTH + MAX_PASSWORD_LENGTH)
  167.         test    eax, eax
  168.         jz      .done   ; ERR_NOMEM
  169.         mov     esi, eax
  170.         lea     edi, [eax + MAX_USERNAME_LENGTH]
  171.  
  172. ; Get username
  173.         invoke  con_write_asciiz, str12
  174.         invoke  con_gets, esi, MAX_USERNAME_LENGTH
  175.         test    eax, eax
  176. ;;        jz      .con_closed_must_clear
  177.  
  178. ; Get password
  179.         invoke  con_write_asciiz, str13a
  180.         invoke  con_gets, edi, MAX_PASSWORD_LENGTH
  181.         test    eax, eax
  182. ;;        jz      .con_closed_must_clear
  183.         invoke  con_write_asciiz, str13b
  184.  
  185. ; Authenticate
  186.         stdcall sshlib_userauth_password, ssh_con, esi, edi
  187. ; Clear and free username and password
  188.   .clear:
  189.         push    eax
  190.         mov     edx, edi
  191.         xor     eax, eax
  192.         mov     ecx, (MAX_USERNAME_LENGTH + MAX_PASSWORD_LENGTH)/4
  193.         rep     stosd
  194.         mcall   68, 13, edx
  195.         pop     eax
  196.  
  197.         cmp     eax, 0
  198.         jg      .login          ; Authentication failed
  199.         jl      .error          ; An error occured
  200.  
  201. ; Open a channel
  202.         stdcall sshlib_chan_open, ssh_con
  203.         cmp     eax, 0
  204.         jg      .prompt         ; Authentication failed
  205.         jl      .error          ; An error occured
  206.  
  207. ; Start console input handler thread without deactivating the current window
  208. ; Get active window ID
  209.         mcall   18, 7
  210.         push    eax
  211. ; Create thread
  212.         mcall   51, 1, con_in_thread, mem + 2048
  213. ; Activate window with given ID
  214.         pop     ecx
  215.         mcall   18, 3
  216.  
  217.   .loop:
  218.         invoke  con_get_flags
  219.         test    eax, 0x200                      ; console window closed?
  220.         jnz     .con_closed
  221.  
  222.         stdcall sshlib_msg_handler, ssh_con, 0
  223.         cmp     eax, 0
  224.         jle     .check_err
  225.  
  226.         cmp     [ssh_con.rx_buffer.message_code], SSH_MSG_CHANNEL_DATA
  227.         jne     .dump
  228.  
  229.         mov     eax, dword[ssh_con.rx_buffer.message_code+5]
  230.         bswap   eax
  231.         DEBUGF  1, 'SSH: got %u bytes of data !\n', eax
  232.  
  233.         lea     esi, [ssh_con.rx_buffer.message_code+5+4]
  234.         lea     edx, [esi+eax]
  235.         lea     edi, [ssh_con.rx_buffer]
  236.   @@:
  237.         call    get_byte_utf8
  238.         stosb
  239.         cmp     esi, edx
  240.         jb      @r
  241.         xor     al, al
  242.         stosb
  243.  
  244.         lea     esi, [ssh_con.rx_buffer]
  245.         DEBUGF  3, 'SSH msg: %s\n', esi
  246.  
  247.         invoke  con_write_asciiz, esi
  248.         jmp     .loop
  249.  
  250.   .dump:
  251.         DEBUGF  3, "SSH: Unsupported message: "
  252.         lea     esi, [ssh_con.rx_buffer.message_code]
  253.         mov     ecx, eax
  254.         pusha
  255.   @@:
  256.         lodsb
  257.         DEBUGF  3, "%x ", eax:2
  258.         dec     ecx
  259.         jnz     @r
  260.         popa
  261.         DEBUGF  3, "\n"
  262.         jmp     .loop
  263.  
  264.   .check_err:
  265.         jz      .err_conn_closed
  266.         cmp     ebx, EWOULDBLOCK
  267.         je      .loop
  268.         jmp     .err_sock
  269.  
  270.   .con_closed:
  271.         ; Send close message on the active channel
  272.         stdcall sshlib_send_packet, ssh_con, ssh_msg_channel_close, ssh_msg_channel_close.length, 0
  273.         jmp     .done
  274.  
  275.   .error:
  276.  
  277. ; TODO: proper cleanup after error
  278.  
  279.         cmp     eax, SSHLIB_ERR_NOMEM
  280.         je      .done
  281.         cmp     eax, SSHLIB_ERR_SOCKET
  282.         je      .err_sock
  283.         cmp     eax, SSHLIB_ERR_PROTOCOL
  284.         je      .err_proto
  285.         cmp     eax, SSHLIB_ERR_HOSTNAME
  286.         je      .err_hostname
  287.         cmp     eax, SSHLIB_ERR_HKEY_VERIFY_FAIL
  288.         je      .err_hostkey_fail
  289.         cmp     eax, SSHLIB_ERR_HKEY_SIGNATURE
  290.         je      .err_hostkey_signature
  291.         cmp     eax, SSHLIB_ERR_HKEY_PUBLIC_KEY
  292.         je      .err_hostkey
  293.  
  294.         jmp     .done
  295.  
  296.  
  297.   .err_proto:
  298. ;        lea     eax, [ssh_con.rx_buffer]
  299. ;        int3
  300.         invoke  con_write_asciiz, str7
  301.         jmp     .prompt
  302.  
  303.   .err_sock:
  304.         invoke  con_write_asciiz, str6
  305.  
  306.         mov     eax, str14
  307.         cmp     ebx, ETIMEDOUT
  308.         je      .err_sock_detail
  309.         mov     eax, str15
  310.         cmp     ebx, ECONNREFUSED
  311.         je      .err_sock_detail
  312.         mov     eax, str16
  313.         cmp     ebx, ECONNRESET
  314.         je      .err_sock_detail
  315.         mov     eax, str17
  316.   .err_sock_detail:
  317.         invoke  con_write_asciiz, eax
  318.         jmp     .prompt
  319.  
  320.   .err_hostname:
  321.         invoke  con_write_asciiz, str10
  322.         jmp     .prompt
  323.  
  324.   .err_conn_closed:
  325.         invoke  con_write_asciiz, str11
  326.         jmp     .prompt
  327.  
  328.   .err_hostkey:
  329.         invoke  con_write_asciiz, str19
  330.         jmp     .prompt
  331.  
  332.   .err_hostkey_signature:
  333.         invoke  con_write_asciiz, str20
  334.         jmp     .prompt
  335.  
  336.   .err_hostkey_fail:
  337.         invoke  con_write_asciiz, str21
  338.         jmp     .prompt
  339.  
  340.   .done:
  341.         invoke  con_exit, 1
  342.   .exit:
  343.         DEBUGF  3, "SSH: Exiting\n"
  344.         mcall   close, [ssh_con.socketnum]
  345.   .fail:
  346.         mcall   -1
  347.  
  348.  
  349. proc sshlib_callback_connecting, con_ptr, connstring_sz
  350.  
  351.         invoke  con_write_asciiz, str3
  352.         mov     eax, [con_ptr]
  353.         lea     eax, [eax+sshlib_connection.hostname_sz]
  354.         invoke  con_write_asciiz, eax
  355.         invoke  con_write_asciiz, str8
  356.         invoke  con_write_asciiz, [connstring_sz]
  357.         invoke  con_write_asciiz, str9
  358.  
  359.         ret
  360. endp
  361.  
  362.  
  363. proc sshlib_callback_hostkey_problem, con_ptr, problem_type, hostkey_sz
  364.  
  365.         cmp     [problem_type], SSHLIB_HOSTKEY_PROBLEM_UNKNOWN
  366.         je      .unknown
  367.         cmp     [problem_type], SSHLIB_HOSTKEY_PROBLEM_MISMATCH
  368.         je      .mismatch
  369.  
  370.         mov     eax, -1
  371.         ret
  372.  
  373.   .unknown:
  374.         invoke  con_write_asciiz, str22
  375.         jmp     .ask
  376.  
  377.   .mismatch:
  378.         invoke  con_write_asciiz, str23
  379. ;        jmp     .ask
  380.   .ask:
  381.         invoke  con_write_asciiz, str24a
  382.         invoke  con_write_asciiz, [hostkey_sz]
  383.         invoke  con_write_asciiz, str24b
  384.   .getansw:
  385.         invoke  con_getch2
  386.         or      al, 0x20        ; convert to lowercase
  387.         cmp     al, 'a'
  388.         je      .accept
  389.         cmp     al, 'c'
  390.         je      .once
  391.         cmp     al, 'x'
  392.         je      .refuse
  393.         jmp     .getansw
  394.  
  395.   .accept:
  396.         mov     eax, SSHLIB_HOSTKEY_ACCEPT
  397.         ret
  398.   .once:
  399.         mov     eax, SSHLIB_HOSTKEY_ONCE
  400.         ret
  401.   .refuse:
  402.         mov     eax, SSHLIB_HOSTKEY_REFUSE
  403.         ret
  404.  
  405. endp
  406.  
  407.  
  408.  
  409. align 16
  410. con_in_thread:
  411.  
  412.   .loop:
  413. ; TODO: check if channel is still open somehow
  414.  
  415.         invoke  con_get_input, keyb_input, MAX_INPUT_LENGTH
  416.         test    eax, eax
  417.         jz      .no_input
  418.  
  419.         mov     ecx, eax
  420.         mov     esi, keyb_input
  421.         mov     edi, ssh_msg_channel_data.data
  422.         call    recode_to_utf8
  423.  
  424.         lea     eax, [edi - ssh_msg_channel_data.data]
  425.         lea     ecx, [edi - ssh_msg_channel_data]
  426.         bswap   eax
  427.         mov     [ssh_msg_channel_data.len], eax
  428.         stdcall sshlib_send_packet, ssh_con, ssh_msg_channel_data, ecx, 0
  429.         cmp     eax, 0
  430.         jle     .exit
  431.  
  432.   .no_input:
  433.         invoke  con_get_flags
  434.         test    eax, 0x200                      ; con window closed?
  435.         jz      .loop
  436.  
  437.   .exit:
  438.         mcall   -1
  439.  
  440.  
  441. ; data
  442. title   db 'Secure Shell',0
  443. str1a   db 'SSHv2 client for KolibriOS',10,0
  444. str1b   db 10,'Please enter URL of SSH server (hostname:port)',10,0
  445. str2    db '> ',0
  446. str3    db 'Connecting to ',0
  447. str4    db 10,0
  448. str6    db 10, 27, '[2J',27,'[mA network error has occured.',10,0
  449. str7    db 10, 27, '[2J',27,'[mAn SSH protocol error has occured.',10,0
  450. str8    db ' (',0
  451. str9    db ')',10,0
  452. str10   db 'Host does not exist.',10,10,0
  453. str11   db 10, 27, '[2J',27,'[mThe remote host closed the connection.',10,0
  454. str12   db 'Login as: ',0
  455. str13a  db 'Password: ', 27, '[?25l', 27, '[30;40m', 0
  456. str13b  db 10, 27, '[?25h', 27, '[0m', 27, '[2J', 0
  457. str14   db 'The connection timed out',10,0
  458. str15   db 'The connection was refused',10,0
  459. str16   db 'The connection was reset',10,0
  460. str17   db 'No details available',10,0
  461. ;str18   db 'User authentication failed',10,0;;;;
  462. str19   db "The remote host's public key is invalid.", 10, 0
  463. str20   db "The remote host's signature is invalid.", 10, 0
  464. str21   db "The remote host failed to verify it's own public key.", 10, 0
  465. str22   db "The host key for the server was not found in the cache.", 10
  466.         db "There is no guarantee to the servers identity !",10, 0
  467.  
  468. str23   db "The host key provided by the host does not match the cached one.", 10
  469.         db "This may indicate that the remote server has been compromised!", 10, 0
  470.  
  471. str24a  db 10, "The remote host key is: ", 10, 0
  472. str24b  db 10, 10, "If you trust this host, press A to accept and store the (new) key.", 10
  473.         db "Press C to connect to the host but don't store the (new) key.", 10
  474.         db "Press X to abort.", 10, 0
  475.  
  476.  
  477. ssh_ident_ha:
  478.         dd_n (ssh_msg_ident.length-2)
  479. ssh_msg_ident:
  480.         db "SSH-2.0-KolibriOS_SSH_0.10",13,10
  481.   .length = $ - ssh_msg_ident
  482.  
  483.  
  484. ssh_msg_kex:
  485.         db SSH_MSG_KEXINIT
  486.   .cookie:
  487.         rd 4
  488.   .kex_algorithms:
  489.         str "diffie-hellman-group-exchange-sha256" ; diffie-hellman-group-exchange-sha1
  490.   .server_host_key_algorithms:
  491.         str "rsa-sha2-512,rsa-sha2-256,ssh-rsa"                    ;,ssh-dss
  492.   .encryption_algorithms_client_to_server:
  493.         str "chacha20-poly1305@openssh.com"                 ;aes256-ctr,aes256-cbc,aes256-cbc,rijndael-cbc@lysator.liu.se,aes192-ctr,aes192-cbc,aes128-ctr,aes128-cbc,blowfish-ctr,blowfish-cbc,3des-ctr,3des-cbc,arcfour256,arcfour128"
  494.   .encryption_algorithms_server_to_client:
  495.         str "chacha20-poly1305@openssh.com"                 ;aes256-ctr,aes256-cbc,aes256-cbc,rijndael-cbc@lysator.liu.se,aes192-ctr,aes192-cbc,aes128-ctr,aes128-cbc,blowfish-ctr,blowfish-cbc,3des-ctr,3des-cbc,arcfour256,arcfour128"
  496.   .mac_algorithms_client_to_server:
  497.         str "hmac-sha2-256"              ;,hmac-sha1,hmac-sha1-96,hmac-md5"
  498.   .mac_algorithms_server_to_client:
  499.         str "hmac-sha2-256"              ;,hmac-sha1,hmac-sha1-96,hmac-md5"
  500.   .compression_algorithms_client_to_server:
  501.         str "none"                       ;,zlib"
  502.   .compression_algorithms_server_to_client:
  503.         str "none"                       ;,zlib"
  504.   .languages_client_to_server:
  505.         str ""
  506.   .languages_server_to_client:
  507.         str ""
  508.   .first_kex_packet_follows:
  509.         db 0
  510.   .reserved:
  511.         dd_n 0
  512.   .length = $ - ssh_msg_kex
  513.  
  514.  
  515. ssh_msg_gex_req:
  516.         db SSH_MSG_KEX_DH_GEX_REQUEST
  517.         dd_n 4096/4                      ; DH GEX min
  518.         dd_n 4096/2                      ; DH GEX number of bits
  519.         dd_n 4096                        ; DH GEX Max
  520.   .length = $ - ssh_msg_gex_req
  521.  
  522.  
  523. ssh_msg_new_keys:
  524.         db SSH_MSG_NEWKEYS
  525.   .length = $ - ssh_msg_new_keys
  526.  
  527.  
  528. ssh_msg_request_service:
  529.         db SSH_MSG_SERVICE_REQUEST
  530.         str "ssh-userauth"              ; Service name
  531.   .length = $ - ssh_msg_request_service
  532.  
  533.  
  534. ssh_msg_channel_open:
  535.         db SSH_MSG_CHANNEL_OPEN
  536.         str "session"
  537.         dd_n 0                          ; Sender channel
  538.         dd_n BUFFERSIZE                 ; Initial window size
  539.         dd_n PACKETSIZE                 ; maximum packet size
  540.   .length = $ - ssh_msg_channel_open
  541.  
  542.  
  543. ssh_msg_channel_close:
  544.         db SSH_MSG_CHANNEL_CLOSE
  545.         dd_n 0                          ; Sender channel
  546.   .length = $ - ssh_msg_channel_close
  547.  
  548.  
  549. ssh_msg_channel_request:
  550.         db SSH_MSG_CHANNEL_REQUEST
  551.         dd_n 0                          ; Recipient channel
  552.         str "pty-req"
  553.         db 1                            ; Bool: want reply
  554.         str "xterm"
  555.         dd_n 80                         ; terminal width (rows)
  556.         dd_n 25                         ; terminal height (rows)
  557.         dd_n 80*8                       ; terminal width (pixels)
  558.         dd_n 25*16                      ; terminal height (pixels)
  559.  
  560.         dd_n 0                          ; list of supported opcodes
  561.   .length = $ - ssh_msg_channel_request
  562.  
  563.  
  564. ssh_msg_shell_request:
  565.         db SSH_MSG_CHANNEL_REQUEST
  566.         dd_n 0                          ; Recipient channel
  567.         str "shell"
  568.         db 1                            ; Bool: want reply
  569.   .length = $ - ssh_msg_shell_request
  570.  
  571.  
  572. ssh_msg_channel_data:
  573.         db SSH_MSG_CHANNEL_DATA
  574.         dd_n 0                          ; Sender channel
  575.   .len  dd ?
  576.   .data rb 4*MAX_INPUT_LENGTH + 1
  577.  
  578.  
  579. ssh_msg_channel_window_adjust:
  580.         db SSH_MSG_CHANNEL_WINDOW_ADJUST
  581.         dd_n 0                          ; Sender channel
  582.   .wnd  dd ?
  583.   .length = $ - ssh_msg_channel_window_adjust
  584.  
  585.  
  586. include_debug_strings
  587.  
  588. align 4
  589. @IMPORT:
  590.  
  591. library network, 'network.obj', \
  592.         console, 'console.obj', \
  593.         libcrash, 'libcrash.obj', \
  594.         libini, 'libini.obj'
  595.  
  596. import  network, \
  597.         getaddrinfo, 'getaddrinfo', \
  598.         freeaddrinfo, 'freeaddrinfo', \
  599.         inet_ntoa, 'inet_ntoa'
  600.  
  601. import  console, \
  602.         con_start, 'START', \
  603.         con_init, 'con_init', \
  604.         con_write_asciiz, 'con_write_asciiz', \
  605.         con_exit, 'con_exit', \
  606.         con_gets, 'con_gets', \
  607.         con_cls, 'con_cls', \
  608.         con_getch2, 'con_getch2', \
  609.         con_get_flags, 'con_get_flags', \
  610.         con_set_title, 'con_set_title', \
  611.         con_get_input, 'con_get_input'
  612.  
  613. import  libcrash, \
  614.         sha2_512_init, 'sha2_512_init', \
  615.         sha2_512_update, 'sha2_512_update', \
  616.         sha2_512_finish, 'sha2_512_finish',\
  617.         sha2_256_init, 'sha2_256_init', \
  618.         sha2_256_update, 'sha2_256_update', \
  619.         sha2_256_finish, 'sha2_256_finish',\
  620.         sha1_init, 'sha1_init', \
  621.         sha1_update, 'sha1_update', \
  622.         sha1_finish, 'sha1_finish', \
  623.         chacha20_init, 'chacha20_init' , \
  624.         chacha20_update, 'chacha20_update', \
  625.         chacha20_oneshot, 'chacha20_oneshot', \
  626.         poly1305_init, 'poly1305_init', \
  627.         poly1305_update, 'poly1305_update', \
  628.         poly1305_finish, 'poly1305_finish', \
  629.         poly1305_oneshot, 'poly1305_oneshot', \
  630.         aes256ctr.init, "aes256ctr_init", \
  631.         aes256ctr.update, "aes256ctr_update", \
  632.         aes256ctr.finish, "aes256ctr_finish", \
  633.         aes256ctr.oneshot, "aes256ctr_oneshot", \
  634.         hmac_sha2_256.init_, "hmac_sha2_256_init", \
  635.         hmac_sha2_256.update_, "hmac_sha2_256_update", \
  636.         hmac_sha2_256.finish_, "hmac_sha2_256_finish", \
  637.         hmac_sha2_256.oneshot, "hmac_sha2_256_oneshot"
  638.  
  639. import  libini, \
  640.         ini_get_str, 'ini_get_str', \
  641.         ini_set_str, 'ini_set_str'
  642.  
  643. IncludeIGlobals
  644.  
  645. i_end:
  646.  
  647. IncludeUGlobals
  648.  
  649. align 16
  650. params          rb MAX_HOSTNAME_LENGTH
  651.  
  652. align 16
  653. ssh_con         sshlib_connection
  654.  
  655. align 16
  656. ssh_chan        sshlib_channel
  657.  
  658. keyb_input      rb MAX_INPUT_LENGTH
  659.  
  660. mem:
  661.