unsigned char cookie[8];
struct RSAKey servkey, hostkey;
struct MD5Context md5c;
+ unsigned long supported_ciphers_mask;
+ int cipher_type;
extern struct ssh_cipher ssh_3des;
+ extern struct ssh_cipher ssh_blowfish;
crBegin;
j = makekey(pktin.body+8+i, &hostkey, &keystr2);
+ supported_ciphers_mask = (pktin.body[12+i+j] << 24) |
+ (pktin.body[13+i+j] << 16) |
+ (pktin.body[14+i+j] << 8) |
+ (pktin.body[15+i+j]);
+
MD5Update(&md5c, keystr2, hostkey.bytes);
MD5Update(&md5c, keystr1, servkey.bytes);
MD5Update(&md5c, pktin.body, 8);
rsaencrypt(rsabuf, hostkey.bytes, &servkey);
}
+ cipher_type = cfg.cipher == CIPHER_BLOWFISH ? SSH_CIPHER_BLOWFISH :
+ SSH_CIPHER_3DES;
+ if ((supported_ciphers_mask & (1 << cipher_type)) == 0) {
+ c_write("Selected cipher not supported, falling back to 3DES\r\n", 53);
+ cipher_type = SSH_CIPHER_3DES;
+ }
+
s_wrpkt_start(3, len+15);
- pktout.body[0] = 3; /* SSH_CIPHER_3DES */
+ pktout.body[0] = cipher_type;
memcpy(pktout.body+1, cookie, 8);
pktout.body[9] = (len*8) >> 8;
pktout.body[10] = (len*8) & 0xFF;
free(rsabuf);
- cipher = &ssh_3des;
+ cipher = cipher_type == SSH_CIPHER_BLOWFISH ? &ssh_blowfish :
+ &ssh_3des;
cipher->sesskey(session_key);
do { crReturnV; } while (!ispkt);
#include <stdio.h>
#include <stdlib.h>
-#include "putty.h"
#include "ssh.h"
+#include "putty.h"
#include "win_res.h"
#define NPANELS 7
}
wpps (sesskey, "UserName", cfg.username);
wppi (sesskey, "NoPTY", cfg.nopty);
+ wpps (sesskey, "Cipher", cfg.cipher == CIPHER_BLOWFISH ? "blowfish" :
+ "3des");
wppi (sesskey, "RFCEnviron", cfg.rfc_environ);
wppi (sesskey, "BackspaceIsDelete", cfg.bksp_is_delete);
wppi (sesskey, "RXVTHomeEnd", cfg.rxvt_homeend);
}
free(p);
+ RegCloseKey(subkey1);
if (do_host) {
char prot[10];
}
gpps (sesskey, "UserName", "", cfg.username, sizeof(cfg.username));
gppi (sesskey, "NoPTY", 0, &cfg.nopty);
+ {
+ char cipher[10];
+ gpps (sesskey, "Cipher", "3des", cipher, 10);
+ if (!strcmp(cipher, "blowfish"))
+ cfg.cipher = CIPHER_BLOWFISH;
+ else
+ cfg.cipher = CIPHER_3DES;
+ }
gppi (sesskey, "RFCEnviron", 0, &cfg.rfc_environ);
gppi (sesskey, "BackspaceIsDelete", 1, &cfg.bksp_is_delete);
gppi (sesskey, "RXVTHomeEnd", 0, &cfg.rxvt_homeend);
SetDlgItemText (hwnd, IDC3_TTEDIT, cfg.termtype);
SetDlgItemText (hwnd, IDC3_LOGEDIT, cfg.username);
CheckDlgButton (hwnd, IDC3_NOPTY, cfg.nopty);
+ CheckRadioButton (hwnd, IDC3_CIPHER3DES, IDC3_CIPHERBLOWF,
+ cfg.cipher == CIPHER_BLOWFISH ? IDC3_CIPHERBLOWF :
+ IDC3_CIPHER3DES);
break;
case WM_COMMAND:
switch (LOWORD(wParam)) {
HIWORD(wParam) == BN_DOUBLECLICKED)
cfg.nopty = IsDlgButtonChecked (hwnd, IDC3_NOPTY);
break;
+ case IDC3_CIPHER3DES:
+ case IDC3_CIPHERBLOWF:
+ if (HIWORD(wParam) == BN_CLICKED ||
+ HIWORD(wParam) == BN_DOUBLECLICKED) {
+ if (IsDlgButtonChecked (hwnd, IDC3_CIPHER3DES))
+ cfg.cipher = CIPHER_3DES;
+ else if (IsDlgButtonChecked (hwnd, IDC3_CIPHERBLOWF))
+ cfg.cipher = CIPHER_BLOWFISH;
+ }
+ break;
}
break;
}