Rev 9070 | Rev 9106 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 9070 | Rev 9071 | ||
---|---|---|---|
Line 49... | Line 49... | ||
49 | include 'ssh_transport.inc' |
49 | include 'ssh_transport.inc' |
Line 50... | Line 50... | ||
50 | 50 | ||
Line 51... | Line 51... | ||
51 | include 'dh_gex.inc' |
51 | include 'dh_gex.inc' |
- | 52 | ||
52 | 53 | include 'mpint.inc' |
|
Line 53... | Line 54... | ||
53 | include 'mpint.inc' |
54 | include 'seed.inc' |
54 | include 'random.inc' |
55 | include 'random.inc' |
55 | 56 | ||
Line 116... | Line 117... | ||
116 | rx_crypt_ctx_ptr dd ? |
117 | rx_crypt_ctx_ptr dd ? |
117 | tx_crypt_ctx_ptr dd ? |
118 | tx_crypt_ctx_ptr dd ? |
118 | rx_crypt_blocksize dd ? |
119 | rx_crypt_blocksize dd ? |
119 | tx_crypt_blocksize dd ? |
120 | tx_crypt_blocksize dd ? |
Line -... | Line 121... | ||
- | 121 | ||
- | 122 | ; Padding |
|
120 | 123 | ||
121 | rx_padsize dd ? ; = Max(8, rx_crypt_blocksize) |
124 | ; rx_padsize dd ? ; = Max(8, rx_crypt_blocksize) |
- | 125 | tx_pad_size dd ? ; = Max(8, tx_crypt_blocksize) |
|
Line 122... | Line 126... | ||
122 | tx_padsize dd ? ; = Max(8, tx_crypt_blocksize) |
126 | tx_pad_proc dd ? |
Line 123... | Line 127... | ||
123 | 127 | ||
124 | ; Message authentication |
128 | ; Message authentication |
Line 187... | Line 191... | ||
187 | stdcall dll.Load, @IMPORT |
191 | stdcall dll.Load, @IMPORT |
188 | test eax, eax |
192 | test eax, eax |
189 | jnz exit |
193 | jnz exit |
Line 190... | Line 194... | ||
190 | 194 | ||
- | 195 | DEBUGF 2, "SSH: Init PRNG\n" |
|
191 | DEBUGF 2, "SSH: Init PRNG\n" |
196 | call create_seed |
Line 192... | Line 197... | ||
192 | call init_random |
197 | call init_random |
193 | 198 | ||
194 | DEBUGF 2, "SSH: Init Console\n" |
199 | DEBUGF 2, "SSH: Init Console\n" |
Line 333... | Line 338... | ||
333 | mov [con.tx_crypt_proc], 0 |
338 | mov [con.tx_crypt_proc], 0 |
334 | mov [con.rx_mac_proc], 0 |
339 | mov [con.rx_mac_proc], 0 |
335 | mov [con.tx_mac_proc], 0 |
340 | mov [con.tx_mac_proc], 0 |
336 | mov [con.rx_mac_length], 0 |
341 | mov [con.rx_mac_length], 0 |
337 | mov [con.tx_mac_length], 0 |
342 | mov [con.tx_mac_length], 0 |
338 | mov [con.rx_padsize], 8 ; minimum padsize |
343 | ; mov [con.rx_padsize], 8 ; minimum padsize |
339 | mov [con.tx_padsize], 8 |
344 | mov [con.tx_pad_size], 8 |
- | 345 | mov [con.tx_pad_proc], padding_zero |
|
Line 340... | Line 346... | ||
340 | 346 | ||
341 | DEBUGF 2, "Sending KEX init\n" |
347 | DEBUGF 2, "Sending KEX init\n" |
342 | mov edi, ssh_kex.cookie |
348 | mov edi, ssh_kex.cookie |
343 | call MBRandom |
349 | call MBRandom |
Line 434... | Line 440... | ||
434 | 440 | ||
435 | stdcall dh_gex |
441 | stdcall dh_gex |
436 | test eax, eax |
442 | test eax, eax |
Line 437... | Line 443... | ||
437 | jnz exit |
443 | jnz exit |
Line 438... | Line 444... | ||
438 | 444 | ||
Line 439... | Line 445... | ||
439 | ; Set keys |
445 | ; Set keys and initialize transport subroutines |
440 | 446 | ||
Line 441... | Line 447... | ||
441 | DEBUGF 2, "SSH: Setting encryption keys\n" |
447 | DEBUGF 2, "SSH: Setting encryption keys\n" |
442 | 448 | ||
443 | stdcall aes256_ctr_init, con.rx_iv |
449 | stdcall aes256_ctr_init, con.rx_iv |
444 | mov [con.rx_crypt_ctx_ptr], eax |
450 | mov [con.rx_crypt_ctx_ptr], eax |
Line 445... | Line 451... | ||
445 | 451 | ||
446 | stdcall aes256_set_encrypt_key, eax, con.rx_enc_key |
452 | stdcall aes256_set_encrypt_key, eax, con.rx_enc_key |
Line 447... | Line 453... | ||
447 | mov [con.rx_crypt_proc], aes256_ctr_crypt |
453 | mov [con.rx_crypt_proc], aes256_ctr_crypt |
448 | mov [con.rx_crypt_blocksize], AES256_BLOCKSIZE |
454 | mov [con.rx_crypt_blocksize], AES256_BLOCKSIZE |
449 | mov [con.rx_padsize], AES256_BLOCKSIZE |
455 | ; mov [con.rx_pad_size], AES256_BLOCKSIZE |
- | 456 | ||
450 | 457 | stdcall aes256_ctr_init, con.tx_iv |
|
- | 458 | mov [con.tx_crypt_ctx_ptr], eax |
|
Line 451... | Line 459... | ||
451 | stdcall aes256_ctr_init, con.tx_iv |
459 | |
452 | mov [con.tx_crypt_ctx_ptr], eax |
460 | stdcall aes256_set_encrypt_key, eax, con.tx_enc_key |
453 | 461 | mov [con.tx_crypt_proc], aes256_ctr_crypt |
|
Line 454... | Line 462... | ||
454 | stdcall aes256_set_encrypt_key, eax, con.tx_enc_key |
462 | mov [con.tx_crypt_blocksize], AES256_BLOCKSIZE |
455 | mov [con.tx_crypt_proc], aes256_ctr_crypt |
463 | |
456 | mov [con.tx_crypt_blocksize], AES256_BLOCKSIZE |
464 | mov [con.tx_pad_size], AES256_BLOCKSIZE |
Line -... | Line 465... | ||
- | 465 | mov [con.tx_pad_proc], MBRandom |
|
- | 466 | ||
- | 467 | stdcall hmac_sha256_setkey, con.rx_mac_ctx, con.rx_int_key, SHA256_HASH_SIZE |
|
- | 468 | mov [con.rx_mac_proc], hmac_sha256 |
|
457 | mov [con.tx_padsize], AES256_BLOCKSIZE |
469 | mov [con.rx_mac_length], SHA256_HASH_SIZE |
Line 458... | Line 470... | ||
458 | 470 | ||
Line 459... | Line 471... | ||
459 | stdcall hmac_sha256_setkey, con.rx_mac_ctx, con.rx_int_key, SHA256_HASH_SIZE |
471 | stdcall hmac_sha256_setkey, con.tx_mac_ctx, con.tx_int_key, SHA256_HASH_SIZE |
Line 776... | Line 788... | ||
776 | str14 db 10, 27, '[?25h', 27, '[0m', 0 |
788 | str14 db 10, 27, '[?25h', 27, '[0m', 0 |
Line 777... | Line 789... | ||
777 | 789 | ||
778 | ssh_ident_ha: |
790 | ssh_ident_ha: |
779 | dd_n (ssh_ident.length-2) |
791 | dd_n (ssh_ident.length-2) |
780 | ssh_ident: |
792 | ssh_ident: |
781 | db "SSH-2.0-KolibriOS_SSH_0.03",13,10 |
793 | db "SSH-2.0-KolibriOS_SSH_0.04",13,10 |
Line 782... | Line 794... | ||
782 | .length = $ - ssh_ident |
794 | .length = $ - ssh_ident |
783 | 795 | ||
784 | ssh_kex: |
796 | ssh_kex: |