Subversion Repositories Kolibri OS

Rev

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

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