mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-06-30 19:12:48 -05:00
Merge the ssh1_cipher type into ssh2_cipher.
The aim of this reorganisation is to make it easier to test all the ciphers in PuTTY in a uniform way. It was inconvenient that there were two separate vtable systems for the ciphers used in SSH-1 and SSH-2 with different functionality. Now there's only one type, called ssh_cipher. But really it's the old ssh2_cipher, just renamed: I haven't made any changes to the API on the SSH-2 side. Instead, I've removed ssh1_cipher completely, and adapted the SSH-1 BPP to use the SSH-2 style API. (The relevant differences are that ssh1_cipher encapsulated both the sending and receiving directions in one object - so now ssh1bpp has to make a separate cipher instance per direction - and that ssh1_cipher automatically initialised the IV to all zeroes, which ssh1bpp now has to do by hand.) The previous ssh1_cipher vtable for single-DES has been removed completely, because when converted into the new API it became identical to the SSH-2 single-DES vtable; so now there's just one vtable for DES-CBC which works in both protocols. The other two SSH-1 ciphers each had to stay separate, because 3DES is completely different between SSH-1 and SSH-2 (three layers of CBC structure versus one), and Blowfish varies in endianness and key length between the two. (Actually, while I'm here, I've only just noticed that the SSH-1 Blowfish cipher mis-describes itself in log messages as Blowfish-128. In fact it passes the whole of the input key buffer, which has length SSH1_SESSION_KEY_LENGTH == 32 bytes == 256 bits. So it's actually Blowfish-256, and has been all along!)
This commit is contained in:
30
testcrypt.h
30
testcrypt.h
@ -121,11 +121,11 @@ FUNC1(val_string, ssh_hash_final, consumed_val_hash)
|
||||
FUNC2(void, ssh_hash_update, val_hash, val_string_ptrlen)
|
||||
|
||||
/*
|
||||
* The ssh2_mac abstraction. Note the optional ssh2_cipher parameter
|
||||
* The ssh2_mac abstraction. Note the optional ssh_cipher parameter
|
||||
* to ssh2_mac_new. Also, again, I've invented an ssh2_mac_update so
|
||||
* you can put data into the MAC.
|
||||
*/
|
||||
FUNC2(val_mac, ssh2_mac_new, macalg, opt_val_ssh2cipher)
|
||||
FUNC2(val_mac, ssh2_mac_new, macalg, opt_val_cipher)
|
||||
FUNC2(void, ssh2_mac_setkey, val_mac, val_string_ptrlen)
|
||||
FUNC1(void, ssh2_mac_start, val_mac)
|
||||
FUNC2(void, ssh2_mac_update, val_mac, val_string_ptrlen)
|
||||
@ -150,25 +150,17 @@ FUNC1(val_string_asciz, ssh_key_cache_str, val_key)
|
||||
FUNC2(uint, ssh_key_public_bits, keyalg, val_string_ptrlen)
|
||||
|
||||
/*
|
||||
* The ssh1_cipher abstraction. The in-place encrypt and decrypt
|
||||
* functions are wrapped to replace them with a pair that take one
|
||||
* The ssh_cipher abstraction. The in-place encrypt and decrypt
|
||||
* functions are wrapped to replace them with versions that take one
|
||||
* string and return a separate string.
|
||||
*/
|
||||
FUNC1(val_ssh1cipher, ssh1_cipher_new, ssh1_cipheralg)
|
||||
FUNC2(void, ssh1_cipher_sesskey, val_ssh1cipher, val_string_ptrlen)
|
||||
FUNC2(val_string, ssh1_cipher_encrypt, val_ssh1cipher, val_string_ptrlen)
|
||||
FUNC2(val_string, ssh1_cipher_decrypt, val_ssh1cipher, val_string_ptrlen)
|
||||
|
||||
/*
|
||||
* The ssh2_cipher abstraction, with similar modifications.
|
||||
*/
|
||||
FUNC1(opt_val_ssh2cipher, ssh2_cipher_new, ssh2_cipheralg)
|
||||
FUNC2(void, ssh2_cipher_setiv, val_ssh2cipher, val_string_ptrlen)
|
||||
FUNC2(void, ssh2_cipher_setkey, val_ssh2cipher, val_string_ptrlen)
|
||||
FUNC2(val_string, ssh2_cipher_encrypt, val_ssh2cipher, val_string_ptrlen)
|
||||
FUNC2(val_string, ssh2_cipher_decrypt, val_ssh2cipher, val_string_ptrlen)
|
||||
FUNC3(val_string, ssh2_cipher_encrypt_length, val_ssh2cipher, val_string_ptrlen, uint)
|
||||
FUNC3(val_string, ssh2_cipher_decrypt_length, val_ssh2cipher, val_string_ptrlen, uint)
|
||||
FUNC1(opt_val_cipher, ssh_cipher_new, cipheralg)
|
||||
FUNC2(void, ssh_cipher_setiv, val_cipher, val_string_ptrlen)
|
||||
FUNC2(void, ssh_cipher_setkey, val_cipher, val_string_ptrlen)
|
||||
FUNC2(val_string, ssh_cipher_encrypt, val_cipher, val_string_ptrlen)
|
||||
FUNC2(val_string, ssh_cipher_decrypt, val_cipher, val_string_ptrlen)
|
||||
FUNC3(val_string, ssh_cipher_encrypt_length, val_cipher, val_string_ptrlen, uint)
|
||||
FUNC3(val_string, ssh_cipher_decrypt_length, val_cipher, val_string_ptrlen, uint)
|
||||
|
||||
/*
|
||||
* Integer Diffie-Hellman.
|
||||
|
Reference in New Issue
Block a user