ssh1login.c 45 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153
  1. /*
  2. * Packet protocol layer for the SSH-1 login phase (combining what
  3. * SSH-2 would think of as key exchange and user authentication).
  4. */
  5. #include <assert.h>
  6. #include "putty.h"
  7. #include "ssh.h"
  8. #include "mpint.h"
  9. #include "sshbpp.h"
  10. #include "sshppl.h"
  11. #include "sshcr.h"
  12. struct ssh1_login_state {
  13. int crState;
  14. PacketProtocolLayer *successor_layer;
  15. Conf *conf;
  16. char *savedhost;
  17. int savedport;
  18. bool try_agent_auth;
  19. int remote_protoflags;
  20. int local_protoflags;
  21. unsigned char session_key[32];
  22. char *username;
  23. agent_pending_query *auth_agent_query;
  24. int len;
  25. unsigned char *rsabuf;
  26. unsigned long supported_ciphers_mask, supported_auths_mask;
  27. bool tried_publickey, tried_agent;
  28. bool tis_auth_refused, ccard_auth_refused;
  29. unsigned char cookie[8];
  30. unsigned char session_id[16];
  31. int cipher_type;
  32. strbuf *publickey_blob;
  33. char *publickey_comment;
  34. bool privatekey_available, privatekey_encrypted;
  35. prompts_t *cur_prompt;
  36. int userpass_ret;
  37. char c;
  38. int pwpkt_type;
  39. void *agent_response_to_free;
  40. ptrlen agent_response;
  41. BinarySource asrc[1]; /* response from SSH agent */
  42. int keyi, nkeys;
  43. bool authed;
  44. RSAKey key;
  45. mp_int *challenge;
  46. ptrlen comment;
  47. int dlgret;
  48. Filename *keyfile;
  49. RSAKey servkey, hostkey;
  50. bool want_user_input;
  51. PacketProtocolLayer ppl;
  52. };
  53. static void ssh1_login_free(PacketProtocolLayer *);
  54. static void ssh1_login_process_queue(PacketProtocolLayer *);
  55. static void ssh1_login_dialog_callback(void *, int);
  56. static void ssh1_login_special_cmd(PacketProtocolLayer *ppl,
  57. SessionSpecialCode code, int arg);
  58. static bool ssh1_login_want_user_input(PacketProtocolLayer *ppl);
  59. static void ssh1_login_got_user_input(PacketProtocolLayer *ppl);
  60. static void ssh1_login_reconfigure(PacketProtocolLayer *ppl, Conf *conf);
  61. static const struct PacketProtocolLayerVtable ssh1_login_vtable = {
  62. ssh1_login_free,
  63. ssh1_login_process_queue,
  64. ssh1_common_get_specials,
  65. ssh1_login_special_cmd,
  66. ssh1_login_want_user_input,
  67. ssh1_login_got_user_input,
  68. ssh1_login_reconfigure,
  69. NULL /* no layer names in SSH-1 */,
  70. };
  71. static void ssh1_login_agent_query(struct ssh1_login_state *s, strbuf *req);
  72. static void ssh1_login_agent_callback(void *loginv, void *reply, int replylen);
  73. PacketProtocolLayer *ssh1_login_new(
  74. Conf *conf, const char *host, int port,
  75. PacketProtocolLayer *successor_layer)
  76. {
  77. struct ssh1_login_state *s = snew(struct ssh1_login_state);
  78. memset(s, 0, sizeof(*s));
  79. s->ppl.vt = &ssh1_login_vtable;
  80. s->conf = conf_copy(conf);
  81. s->savedhost = dupstr(host);
  82. s->savedport = port;
  83. s->successor_layer = successor_layer;
  84. return &s->ppl;
  85. }
  86. static void ssh1_login_free(PacketProtocolLayer *ppl)
  87. {
  88. struct ssh1_login_state *s =
  89. container_of(ppl, struct ssh1_login_state, ppl);
  90. if (s->successor_layer)
  91. ssh_ppl_free(s->successor_layer);
  92. conf_free(s->conf);
  93. sfree(s->savedhost);
  94. sfree(s->rsabuf);
  95. sfree(s->username);
  96. if (s->publickey_blob)
  97. strbuf_free(s->publickey_blob);
  98. sfree(s->publickey_comment);
  99. if (s->cur_prompt)
  100. free_prompts(s->cur_prompt);
  101. sfree(s->agent_response_to_free);
  102. if (s->auth_agent_query)
  103. agent_cancel_query(s->auth_agent_query);
  104. sfree(s);
  105. }
  106. static bool ssh1_login_filter_queue(struct ssh1_login_state *s)
  107. {
  108. return ssh1_common_filter_queue(&s->ppl);
  109. }
  110. static PktIn *ssh1_login_pop(struct ssh1_login_state *s)
  111. {
  112. if (ssh1_login_filter_queue(s))
  113. return NULL;
  114. return pq_pop(s->ppl.in_pq);
  115. }
  116. static void ssh1_login_process_queue(PacketProtocolLayer *ppl)
  117. {
  118. struct ssh1_login_state *s =
  119. container_of(ppl, struct ssh1_login_state, ppl);
  120. PktIn *pktin;
  121. PktOut *pkt;
  122. int i;
  123. /* Filter centrally handled messages off the front of the queue on
  124. * every entry to this coroutine, no matter where we're resuming
  125. * from, even if we're _not_ looping on pq_pop. That way we can
  126. * still proactively handle those messages even if we're waiting
  127. * for a user response. */
  128. if (ssh1_login_filter_queue(s))
  129. return;
  130. crBegin(s->crState);
  131. crMaybeWaitUntilV((pktin = ssh1_login_pop(s)) != NULL);
  132. if (pktin->type != SSH1_SMSG_PUBLIC_KEY) {
  133. ssh_proto_error(s->ppl.ssh, "Public key packet not received");
  134. return;
  135. }
  136. ppl_logevent("Received public keys");
  137. {
  138. ptrlen pl = get_data(pktin, 8);
  139. memcpy(s->cookie, pl.ptr, pl.len);
  140. }
  141. get_rsa_ssh1_pub(pktin, &s->servkey, RSA_SSH1_EXPONENT_FIRST);
  142. get_rsa_ssh1_pub(pktin, &s->hostkey, RSA_SSH1_EXPONENT_FIRST);
  143. s->hostkey.comment = NULL; /* avoid confusing rsa_ssh1_fingerprint */
  144. /*
  145. * Log the host key fingerprint.
  146. */
  147. if (!get_err(pktin)) {
  148. char *fingerprint = rsa_ssh1_fingerprint(&s->hostkey);
  149. ppl_logevent("Host key fingerprint is:");
  150. ppl_logevent(" %s", fingerprint);
  151. sfree(fingerprint);
  152. }
  153. s->remote_protoflags = get_uint32(pktin);
  154. s->supported_ciphers_mask = get_uint32(pktin);
  155. s->supported_auths_mask = get_uint32(pktin);
  156. if (get_err(pktin)) {
  157. ssh_proto_error(s->ppl.ssh, "Bad SSH-1 public key packet");
  158. return;
  159. }
  160. if ((s->ppl.remote_bugs & BUG_CHOKES_ON_RSA))
  161. s->supported_auths_mask &= ~(1 << SSH1_AUTH_RSA);
  162. s->local_protoflags =
  163. s->remote_protoflags & SSH1_PROTOFLAGS_SUPPORTED;
  164. s->local_protoflags |= SSH1_PROTOFLAG_SCREEN_NUMBER;
  165. ssh1_compute_session_id(s->session_id, s->cookie,
  166. &s->hostkey, &s->servkey);
  167. for (i = 0; i < 32; i++)
  168. s->session_key[i] = random_byte();
  169. /*
  170. * Verify that the `bits' and `bytes' parameters match.
  171. */
  172. if (s->hostkey.bits > s->hostkey.bytes * 8 ||
  173. s->servkey.bits > s->servkey.bytes * 8) {
  174. ssh_proto_error(s->ppl.ssh, "SSH-1 public keys were badly formatted");
  175. return;
  176. }
  177. s->len = (s->hostkey.bytes > s->servkey.bytes ?
  178. s->hostkey.bytes : s->servkey.bytes);
  179. s->rsabuf = snewn(s->len, unsigned char);
  180. /*
  181. * Verify the host key.
  182. */
  183. {
  184. /*
  185. * First format the key into a string.
  186. */
  187. char *fingerprint;
  188. char *keystr = rsastr_fmt(&s->hostkey);
  189. fingerprint = rsa_ssh1_fingerprint(&s->hostkey);
  190. /* First check against manually configured host keys. */
  191. s->dlgret = verify_ssh_manual_host_key(s->conf, fingerprint, NULL);
  192. if (s->dlgret == 0) { /* did not match */
  193. sfree(fingerprint);
  194. sfree(keystr);
  195. ssh_proto_error(s->ppl.ssh, "Host key did not appear in manually "
  196. "configured list");
  197. return;
  198. } else if (s->dlgret < 0) { /* none configured; use standard handling */
  199. s->dlgret = seat_verify_ssh_host_key(
  200. s->ppl.seat, s->savedhost, s->savedport,
  201. "rsa", keystr, fingerprint, ssh1_login_dialog_callback, s);
  202. sfree(fingerprint);
  203. sfree(keystr);
  204. #ifdef FUZZING
  205. s->dlgret = 1;
  206. #endif
  207. crMaybeWaitUntilV(s->dlgret >= 0);
  208. if (s->dlgret == 0) {
  209. ssh_user_close(s->ppl.ssh,
  210. "User aborted at host key verification");
  211. return;
  212. }
  213. } else {
  214. sfree(fingerprint);
  215. sfree(keystr);
  216. }
  217. }
  218. for (i = 0; i < 32; i++) {
  219. s->rsabuf[i] = s->session_key[i];
  220. if (i < 16)
  221. s->rsabuf[i] ^= s->session_id[i];
  222. }
  223. {
  224. RSAKey *smaller = (s->hostkey.bytes > s->servkey.bytes ?
  225. &s->servkey : &s->hostkey);
  226. RSAKey *larger = (s->hostkey.bytes > s->servkey.bytes ?
  227. &s->hostkey : &s->servkey);
  228. if (!rsa_ssh1_encrypt(s->rsabuf, 32, smaller) ||
  229. !rsa_ssh1_encrypt(s->rsabuf, smaller->bytes, larger)) {
  230. ssh_proto_error(s->ppl.ssh, "SSH-1 public key encryptions failed "
  231. "due to bad formatting");
  232. return;
  233. }
  234. }
  235. ppl_logevent("Encrypted session key");
  236. {
  237. bool cipher_chosen = false, warn = false;
  238. const char *cipher_string = NULL;
  239. int i;
  240. for (i = 0; !cipher_chosen && i < CIPHER_MAX; i++) {
  241. int next_cipher = conf_get_int_int(
  242. s->conf, CONF_ssh_cipherlist, i);
  243. if (next_cipher == CIPHER_WARN) {
  244. /* If/when we choose a cipher, warn about it */
  245. warn = true;
  246. } else if (next_cipher == CIPHER_AES) {
  247. /* XXX Probably don't need to mention this. */
  248. ppl_logevent("AES not supported in SSH-1, skipping");
  249. } else {
  250. switch (next_cipher) {
  251. case CIPHER_3DES: s->cipher_type = SSH_CIPHER_3DES;
  252. cipher_string = "3DES"; break;
  253. case CIPHER_BLOWFISH: s->cipher_type = SSH_CIPHER_BLOWFISH;
  254. cipher_string = "Blowfish"; break;
  255. case CIPHER_DES: s->cipher_type = SSH_CIPHER_DES;
  256. cipher_string = "single-DES"; break;
  257. }
  258. if (s->supported_ciphers_mask & (1 << s->cipher_type))
  259. cipher_chosen = true;
  260. }
  261. }
  262. if (!cipher_chosen) {
  263. if ((s->supported_ciphers_mask & (1 << SSH_CIPHER_3DES)) == 0) {
  264. ssh_proto_error(s->ppl.ssh, "Server violates SSH-1 protocol "
  265. "by not supporting 3DES encryption");
  266. } else {
  267. /* shouldn't happen */
  268. ssh_sw_abort(s->ppl.ssh, "No supported ciphers found");
  269. }
  270. return;
  271. }
  272. /* Warn about chosen cipher if necessary. */
  273. if (warn) {
  274. s->dlgret = seat_confirm_weak_crypto_primitive(
  275. s->ppl.seat, "cipher", cipher_string,
  276. ssh1_login_dialog_callback, s);
  277. crMaybeWaitUntilV(s->dlgret >= 0);
  278. if (s->dlgret == 0) {
  279. ssh_user_close(s->ppl.ssh, "User aborted at cipher warning");
  280. return;
  281. }
  282. }
  283. }
  284. switch (s->cipher_type) {
  285. case SSH_CIPHER_3DES:
  286. ppl_logevent("Using 3DES encryption");
  287. break;
  288. case SSH_CIPHER_DES:
  289. ppl_logevent("Using single-DES encryption");
  290. break;
  291. case SSH_CIPHER_BLOWFISH:
  292. ppl_logevent("Using Blowfish encryption");
  293. break;
  294. }
  295. pkt = ssh_bpp_new_pktout(s->ppl.bpp, SSH1_CMSG_SESSION_KEY);
  296. put_byte(pkt, s->cipher_type);
  297. put_data(pkt, s->cookie, 8);
  298. put_uint16(pkt, s->len * 8);
  299. put_data(pkt, s->rsabuf, s->len);
  300. put_uint32(pkt, s->local_protoflags);
  301. pq_push(s->ppl.out_pq, pkt);
  302. ppl_logevent("Trying to enable encryption...");
  303. sfree(s->rsabuf);
  304. s->rsabuf = NULL;
  305. /*
  306. * Force the BPP to synchronously marshal all packets up to and
  307. * including the SESSION_KEY into wire format, before we turn on
  308. * crypto.
  309. */
  310. ssh_bpp_handle_output(s->ppl.bpp);
  311. {
  312. const ssh_cipheralg *cipher =
  313. (s->cipher_type == SSH_CIPHER_BLOWFISH ? &ssh_blowfish_ssh1 :
  314. s->cipher_type == SSH_CIPHER_DES ? &ssh_des : &ssh_3des_ssh1);
  315. ssh1_bpp_new_cipher(s->ppl.bpp, cipher, s->session_key);
  316. }
  317. freersakey(&s->servkey);
  318. freersakey(&s->hostkey);
  319. crMaybeWaitUntilV((pktin = ssh1_login_pop(s)) != NULL);
  320. if (pktin->type != SSH1_SMSG_SUCCESS) {
  321. ssh_proto_error(s->ppl.ssh, "Encryption not successfully enabled");
  322. return;
  323. }
  324. ppl_logevent("Successfully started encryption");
  325. if ((s->username = get_remote_username(s->conf)) == NULL) {
  326. s->cur_prompt = new_prompts();
  327. s->cur_prompt->to_server = true;
  328. s->cur_prompt->name = dupstr("SSH login name");
  329. add_prompt(s->cur_prompt, dupstr("login as: "), true);
  330. s->userpass_ret = seat_get_userpass_input(
  331. s->ppl.seat, s->cur_prompt, NULL);
  332. while (1) {
  333. while (s->userpass_ret < 0 &&
  334. bufchain_size(s->ppl.user_input) > 0)
  335. s->userpass_ret = seat_get_userpass_input(
  336. s->ppl.seat, s->cur_prompt, s->ppl.user_input);
  337. if (s->userpass_ret >= 0)
  338. break;
  339. s->want_user_input = true;
  340. crReturnV;
  341. s->want_user_input = false;
  342. }
  343. if (!s->userpass_ret) {
  344. /*
  345. * Failed to get a username. Terminate.
  346. */
  347. ssh_user_close(s->ppl.ssh, "No username provided");
  348. return;
  349. }
  350. s->username = dupstr(s->cur_prompt->prompts[0]->result);
  351. free_prompts(s->cur_prompt);
  352. s->cur_prompt = NULL;
  353. }
  354. pkt = ssh_bpp_new_pktout(s->ppl.bpp, SSH1_CMSG_USER);
  355. put_stringz(pkt, s->username);
  356. pq_push(s->ppl.out_pq, pkt);
  357. ppl_logevent("Sent username \"%s\"", s->username);
  358. if ((flags & FLAG_VERBOSE) || (flags & FLAG_INTERACTIVE))
  359. ppl_printf("Sent username \"%s\"\r\n", s->username);
  360. crMaybeWaitUntilV((pktin = ssh1_login_pop(s)) != NULL);
  361. if (!(s->supported_auths_mask & (1 << SSH1_AUTH_RSA))) {
  362. /* We must not attempt PK auth. Pretend we've already tried it. */
  363. s->tried_publickey = s->tried_agent = true;
  364. } else {
  365. s->tried_publickey = s->tried_agent = false;
  366. }
  367. s->tis_auth_refused = s->ccard_auth_refused = false;
  368. /*
  369. * Load the public half of any configured keyfile for later use.
  370. */
  371. s->keyfile = conf_get_filename(s->conf, CONF_keyfile);
  372. if (!filename_is_null(s->keyfile)) {
  373. int keytype;
  374. ppl_logevent("Reading key file \"%s\"", filename_to_str(s->keyfile));
  375. keytype = key_type(s->keyfile);
  376. if (keytype == SSH_KEYTYPE_SSH1 ||
  377. keytype == SSH_KEYTYPE_SSH1_PUBLIC) {
  378. const char *error;
  379. s->publickey_blob = strbuf_new();
  380. if (rsa_ssh1_loadpub(s->keyfile,
  381. BinarySink_UPCAST(s->publickey_blob),
  382. &s->publickey_comment, &error)) {
  383. s->privatekey_available = (keytype == SSH_KEYTYPE_SSH1);
  384. if (!s->privatekey_available)
  385. ppl_logevent("Key file contains public key only");
  386. s->privatekey_encrypted = rsa_ssh1_encrypted(s->keyfile, NULL);
  387. } else {
  388. ppl_logevent("Unable to load key (%s)", error);
  389. ppl_printf("Unable to load key file \"%s\" (%s)\r\n",
  390. filename_to_str(s->keyfile), error);
  391. strbuf_free(s->publickey_blob);
  392. s->publickey_blob = NULL;
  393. }
  394. } else {
  395. ppl_logevent("Unable to use this key file (%s)",
  396. key_type_to_str(keytype));
  397. ppl_printf("Unable to use key file \"%s\" (%s)\r\n",
  398. filename_to_str(s->keyfile),
  399. key_type_to_str(keytype));
  400. }
  401. }
  402. /* Check whether we're configured to try Pageant, and also whether
  403. * it's available. */
  404. s->try_agent_auth = (conf_get_bool(s->conf, CONF_tryagent) &&
  405. agent_exists());
  406. while (pktin->type == SSH1_SMSG_FAILURE) {
  407. s->pwpkt_type = SSH1_CMSG_AUTH_PASSWORD;
  408. if (s->try_agent_auth && !s->tried_agent) {
  409. /*
  410. * Attempt RSA authentication using Pageant.
  411. */
  412. s->authed = false;
  413. s->tried_agent = true;
  414. ppl_logevent("Pageant is running. Requesting keys.");
  415. /* Request the keys held by the agent. */
  416. {
  417. strbuf *request = strbuf_new_for_agent_query();
  418. put_byte(request, SSH1_AGENTC_REQUEST_RSA_IDENTITIES);
  419. ssh1_login_agent_query(s, request);
  420. strbuf_free(request);
  421. crMaybeWaitUntilV(!s->auth_agent_query);
  422. }
  423. BinarySource_BARE_INIT(
  424. s->asrc, s->agent_response.ptr, s->agent_response.len);
  425. get_uint32(s->asrc); /* skip length field */
  426. if (get_byte(s->asrc) == SSH1_AGENT_RSA_IDENTITIES_ANSWER) {
  427. s->nkeys = toint(get_uint32(s->asrc));
  428. if (s->nkeys < 0) {
  429. ppl_logevent("Pageant reported negative key count %d",
  430. s->nkeys);
  431. s->nkeys = 0;
  432. }
  433. ppl_logevent("Pageant has %d SSH-1 keys", s->nkeys);
  434. for (s->keyi = 0; s->keyi < s->nkeys; s->keyi++) {
  435. size_t start, end;
  436. start = s->asrc->pos;
  437. get_rsa_ssh1_pub(s->asrc, &s->key,
  438. RSA_SSH1_EXPONENT_FIRST);
  439. end = s->asrc->pos;
  440. s->comment = get_string(s->asrc);
  441. if (get_err(s->asrc)) {
  442. ppl_logevent("Pageant key list packet was truncated");
  443. break;
  444. }
  445. if (s->publickey_blob) {
  446. ptrlen keystr = make_ptrlen(
  447. (const char *)s->asrc->data + start, end - start);
  448. if (keystr.len == s->publickey_blob->len &&
  449. !memcmp(keystr.ptr, s->publickey_blob->s,
  450. s->publickey_blob->len)) {
  451. ppl_logevent("Pageant key #%d matches "
  452. "configured key file", s->keyi);
  453. s->tried_publickey = true;
  454. } else
  455. /* Skip non-configured key */
  456. continue;
  457. }
  458. ppl_logevent("Trying Pageant key #%d", s->keyi);
  459. pkt = ssh_bpp_new_pktout(s->ppl.bpp, SSH1_CMSG_AUTH_RSA);
  460. put_mp_ssh1(pkt, s->key.modulus);
  461. pq_push(s->ppl.out_pq, pkt);
  462. crMaybeWaitUntilV((pktin = ssh1_login_pop(s))
  463. != NULL);
  464. if (pktin->type != SSH1_SMSG_AUTH_RSA_CHALLENGE) {
  465. ppl_logevent("Key refused");
  466. continue;
  467. }
  468. ppl_logevent("Received RSA challenge");
  469. s->challenge = get_mp_ssh1(pktin);
  470. if (get_err(pktin)) {
  471. mp_free(s->challenge);
  472. ssh_proto_error(s->ppl.ssh, "Server's RSA challenge "
  473. "was badly formatted");
  474. return;
  475. }
  476. {
  477. strbuf *agentreq;
  478. const char *ret;
  479. agentreq = strbuf_new_for_agent_query();
  480. put_byte(agentreq, SSH1_AGENTC_RSA_CHALLENGE);
  481. put_uint32(agentreq, mp_get_nbits(s->key.modulus));
  482. put_mp_ssh1(agentreq, s->key.exponent);
  483. put_mp_ssh1(agentreq, s->key.modulus);
  484. put_mp_ssh1(agentreq, s->challenge);
  485. put_data(agentreq, s->session_id, 16);
  486. put_uint32(agentreq, 1); /* response format */
  487. ssh1_login_agent_query(s, agentreq);
  488. strbuf_free(agentreq);
  489. crMaybeWaitUntilV(!s->auth_agent_query);
  490. ret = s->agent_response.ptr;
  491. if (ret) {
  492. if (s->agent_response.len >= 5+16 &&
  493. ret[4] == SSH1_AGENT_RSA_RESPONSE) {
  494. ppl_logevent("Sending Pageant's response");
  495. pkt = ssh_bpp_new_pktout(
  496. s->ppl.bpp, SSH1_CMSG_AUTH_RSA_RESPONSE);
  497. put_data(pkt, ret + 5, 16);
  498. pq_push(s->ppl.out_pq, pkt);
  499. sfree((char *)ret);
  500. crMaybeWaitUntilV(
  501. (pktin = ssh1_login_pop(s))
  502. != NULL);
  503. if (pktin->type == SSH1_SMSG_SUCCESS) {
  504. ppl_logevent("Pageant's response "
  505. "accepted");
  506. if (flags & FLAG_VERBOSE) {
  507. ppl_printf("Authenticated using RSA "
  508. "key \"%.*s\" from "
  509. "agent\r\n", PTRLEN_PRINTF(
  510. s->comment));
  511. }
  512. s->authed = true;
  513. } else
  514. ppl_logevent("Pageant's response not "
  515. "accepted");
  516. } else {
  517. ppl_logevent("Pageant failed to answer "
  518. "challenge");
  519. sfree((char *)ret);
  520. }
  521. } else {
  522. ppl_logevent("No reply received from Pageant");
  523. }
  524. }
  525. mp_free(s->key.exponent);
  526. mp_free(s->key.modulus);
  527. mp_free(s->challenge);
  528. if (s->authed)
  529. break;
  530. }
  531. sfree(s->agent_response_to_free);
  532. s->agent_response_to_free = NULL;
  533. if (s->publickey_blob && !s->tried_publickey)
  534. ppl_logevent("Configured key file not in Pageant");
  535. } else {
  536. ppl_logevent("Failed to get reply from Pageant");
  537. }
  538. if (s->authed)
  539. break;
  540. }
  541. if (s->publickey_blob && s->privatekey_available &&
  542. !s->tried_publickey) {
  543. /*
  544. * Try public key authentication with the specified
  545. * key file.
  546. */
  547. bool got_passphrase; /* need not be kept over crReturn */
  548. if (flags & FLAG_VERBOSE)
  549. ppl_printf("Trying public key authentication.\r\n");
  550. ppl_logevent("Trying public key \"%s\"",
  551. filename_to_str(s->keyfile));
  552. s->tried_publickey = true;
  553. got_passphrase = false;
  554. while (!got_passphrase) {
  555. /*
  556. * Get a passphrase, if necessary.
  557. */
  558. int retd;
  559. char *passphrase = NULL; /* only written after crReturn */
  560. const char *error;
  561. if (!s->privatekey_encrypted) {
  562. if (flags & FLAG_VERBOSE)
  563. ppl_printf("No passphrase required.\r\n");
  564. passphrase = NULL;
  565. } else {
  566. s->cur_prompt = new_prompts(s->ppl.seat);
  567. s->cur_prompt->to_server = false;
  568. s->cur_prompt->name = dupstr("SSH key passphrase");
  569. add_prompt(s->cur_prompt,
  570. dupprintf("Passphrase for key \"%s\": ",
  571. s->publickey_comment), false);
  572. s->userpass_ret = seat_get_userpass_input(
  573. s->ppl.seat, s->cur_prompt, NULL);
  574. while (1) {
  575. while (s->userpass_ret < 0 &&
  576. bufchain_size(s->ppl.user_input) > 0)
  577. s->userpass_ret = seat_get_userpass_input(
  578. s->ppl.seat, s->cur_prompt, s->ppl.user_input);
  579. if (s->userpass_ret >= 0)
  580. break;
  581. s->want_user_input = true;
  582. crReturnV;
  583. s->want_user_input = false;
  584. }
  585. if (!s->userpass_ret) {
  586. /* Failed to get a passphrase. Terminate. */
  587. ssh_user_close(s->ppl.ssh,
  588. "User aborted at passphrase prompt");
  589. return;
  590. }
  591. passphrase = dupstr(s->cur_prompt->prompts[0]->result);
  592. free_prompts(s->cur_prompt);
  593. s->cur_prompt = NULL;
  594. }
  595. /*
  596. * Try decrypting key with passphrase.
  597. */
  598. retd = rsa_ssh1_loadkey(
  599. s->keyfile, &s->key, passphrase, &error);
  600. if (passphrase) {
  601. smemclr(passphrase, strlen(passphrase));
  602. sfree(passphrase);
  603. }
  604. if (retd == 1) {
  605. /* Correct passphrase. */
  606. got_passphrase = true;
  607. } else if (retd == 0) {
  608. ppl_printf("Couldn't load private key from %s (%s).\r\n",
  609. filename_to_str(s->keyfile), error);
  610. got_passphrase = false;
  611. break; /* go and try something else */
  612. } else if (retd == -1) {
  613. ppl_printf("Wrong passphrase.\r\n");
  614. got_passphrase = false;
  615. /* and try again */
  616. } else {
  617. unreachable("unexpected return from rsa_ssh1_loadkey()");
  618. }
  619. }
  620. if (got_passphrase) {
  621. /*
  622. * Send a public key attempt.
  623. */
  624. pkt = ssh_bpp_new_pktout(s->ppl.bpp, SSH1_CMSG_AUTH_RSA);
  625. put_mp_ssh1(pkt, s->key.modulus);
  626. pq_push(s->ppl.out_pq, pkt);
  627. crMaybeWaitUntilV((pktin = ssh1_login_pop(s))
  628. != NULL);
  629. if (pktin->type == SSH1_SMSG_FAILURE) {
  630. ppl_printf("Server refused our public key.\r\n");
  631. continue; /* go and try something else */
  632. }
  633. if (pktin->type != SSH1_SMSG_AUTH_RSA_CHALLENGE) {
  634. ssh_proto_error(s->ppl.ssh, "Received unexpected packet"
  635. " in response to offer of public key, "
  636. "type %d (%s)", pktin->type,
  637. ssh1_pkt_type(pktin->type));
  638. return;
  639. }
  640. {
  641. int i;
  642. unsigned char buffer[32];
  643. mp_int *challenge, *response;
  644. challenge = get_mp_ssh1(pktin);
  645. if (get_err(pktin)) {
  646. mp_free(challenge);
  647. ssh_proto_error(s->ppl.ssh, "Server's RSA challenge "
  648. "was badly formatted");
  649. return;
  650. }
  651. response = rsa_ssh1_decrypt(challenge, &s->key);
  652. freersapriv(&s->key); /* burn the evidence */
  653. for (i = 0; i < 32; i++) {
  654. buffer[i] = mp_get_byte(response, 31 - i);
  655. }
  656. {
  657. struct MD5Context md5c;
  658. MD5Init(&md5c);
  659. put_data(&md5c, buffer, 32);
  660. put_data(&md5c, s->session_id, 16);
  661. MD5Final(buffer, &md5c);
  662. }
  663. pkt = ssh_bpp_new_pktout(
  664. s->ppl.bpp, SSH1_CMSG_AUTH_RSA_RESPONSE);
  665. put_data(pkt, buffer, 16);
  666. pq_push(s->ppl.out_pq, pkt);
  667. mp_free(challenge);
  668. mp_free(response);
  669. }
  670. crMaybeWaitUntilV((pktin = ssh1_login_pop(s))
  671. != NULL);
  672. if (pktin->type == SSH1_SMSG_FAILURE) {
  673. if (flags & FLAG_VERBOSE)
  674. ppl_printf("Failed to authenticate with"
  675. " our public key.\r\n");
  676. continue; /* go and try something else */
  677. } else if (pktin->type != SSH1_SMSG_SUCCESS) {
  678. ssh_proto_error(s->ppl.ssh, "Received unexpected packet"
  679. " in response to RSA authentication, "
  680. "type %d (%s)", pktin->type,
  681. ssh1_pkt_type(pktin->type));
  682. return;
  683. }
  684. break; /* we're through! */
  685. }
  686. }
  687. /*
  688. * Otherwise, try various forms of password-like authentication.
  689. */
  690. s->cur_prompt = new_prompts(s->ppl.seat);
  691. if (conf_get_bool(s->conf, CONF_try_tis_auth) &&
  692. (s->supported_auths_mask & (1 << SSH1_AUTH_TIS)) &&
  693. !s->tis_auth_refused) {
  694. s->pwpkt_type = SSH1_CMSG_AUTH_TIS_RESPONSE;
  695. ppl_logevent("Requested TIS authentication");
  696. pkt = ssh_bpp_new_pktout(s->ppl.bpp, SSH1_CMSG_AUTH_TIS);
  697. pq_push(s->ppl.out_pq, pkt);
  698. crMaybeWaitUntilV((pktin = ssh1_login_pop(s)) != NULL);
  699. if (pktin->type == SSH1_SMSG_FAILURE) {
  700. ppl_logevent("TIS authentication declined");
  701. if (flags & FLAG_INTERACTIVE)
  702. ppl_printf("TIS authentication refused.\r\n");
  703. s->tis_auth_refused = true;
  704. continue;
  705. } else if (pktin->type == SSH1_SMSG_AUTH_TIS_CHALLENGE) {
  706. ptrlen challenge;
  707. char *instr_suf, *prompt;
  708. challenge = get_string(pktin);
  709. if (get_err(pktin)) {
  710. ssh_proto_error(s->ppl.ssh, "TIS challenge packet was "
  711. "badly formed");
  712. return;
  713. }
  714. ppl_logevent("Received TIS challenge");
  715. s->cur_prompt->to_server = true;
  716. s->cur_prompt->name = dupstr("SSH TIS authentication");
  717. /* Prompt heuristic comes from OpenSSH */
  718. if (!memchr(challenge.ptr, '\n', challenge.len)) {
  719. instr_suf = dupstr("");
  720. prompt = mkstr(challenge);
  721. } else {
  722. instr_suf = mkstr(challenge);
  723. prompt = dupstr("Response: ");
  724. }
  725. s->cur_prompt->instruction =
  726. dupprintf("Using TIS authentication.%s%s",
  727. (*instr_suf) ? "\n" : "",
  728. instr_suf);
  729. s->cur_prompt->instr_reqd = true;
  730. add_prompt(s->cur_prompt, prompt, false);
  731. sfree(instr_suf);
  732. } else {
  733. ssh_proto_error(s->ppl.ssh, "Received unexpected packet"
  734. " in response to TIS authentication, "
  735. "type %d (%s)", pktin->type,
  736. ssh1_pkt_type(pktin->type));
  737. return;
  738. }
  739. } else if (conf_get_bool(s->conf, CONF_try_tis_auth) &&
  740. (s->supported_auths_mask & (1 << SSH1_AUTH_CCARD)) &&
  741. !s->ccard_auth_refused) {
  742. s->pwpkt_type = SSH1_CMSG_AUTH_CCARD_RESPONSE;
  743. ppl_logevent("Requested CryptoCard authentication");
  744. pkt = ssh_bpp_new_pktout(s->ppl.bpp, SSH1_CMSG_AUTH_CCARD);
  745. pq_push(s->ppl.out_pq, pkt);
  746. crMaybeWaitUntilV((pktin = ssh1_login_pop(s)) != NULL);
  747. if (pktin->type == SSH1_SMSG_FAILURE) {
  748. ppl_logevent("CryptoCard authentication declined");
  749. ppl_printf("CryptoCard authentication refused.\r\n");
  750. s->ccard_auth_refused = true;
  751. continue;
  752. } else if (pktin->type == SSH1_SMSG_AUTH_CCARD_CHALLENGE) {
  753. ptrlen challenge;
  754. char *instr_suf, *prompt;
  755. challenge = get_string(pktin);
  756. if (get_err(pktin)) {
  757. ssh_proto_error(s->ppl.ssh, "CryptoCard challenge packet "
  758. "was badly formed");
  759. return;
  760. }
  761. ppl_logevent("Received CryptoCard challenge");
  762. s->cur_prompt->to_server = true;
  763. s->cur_prompt->name = dupstr("SSH CryptoCard authentication");
  764. s->cur_prompt->name_reqd = false;
  765. /* Prompt heuristic comes from OpenSSH */
  766. if (!memchr(challenge.ptr, '\n', challenge.len)) {
  767. instr_suf = dupstr("");
  768. prompt = mkstr(challenge);
  769. } else {
  770. instr_suf = mkstr(challenge);
  771. prompt = dupstr("Response: ");
  772. }
  773. s->cur_prompt->instruction =
  774. dupprintf("Using CryptoCard authentication.%s%s",
  775. (*instr_suf) ? "\n" : "",
  776. instr_suf);
  777. s->cur_prompt->instr_reqd = true;
  778. add_prompt(s->cur_prompt, prompt, false);
  779. sfree(instr_suf);
  780. } else {
  781. ssh_proto_error(s->ppl.ssh, "Received unexpected packet"
  782. " in response to TIS authentication, "
  783. "type %d (%s)", pktin->type,
  784. ssh1_pkt_type(pktin->type));
  785. return;
  786. }
  787. }
  788. if (s->pwpkt_type == SSH1_CMSG_AUTH_PASSWORD) {
  789. if ((s->supported_auths_mask & (1 << SSH1_AUTH_PASSWORD)) == 0) {
  790. ssh_sw_abort(s->ppl.ssh, "No supported authentication methods "
  791. "available");
  792. return;
  793. }
  794. s->cur_prompt->to_server = true;
  795. s->cur_prompt->name = dupstr("SSH password");
  796. add_prompt(s->cur_prompt, dupprintf("%s@%s's password: ",
  797. s->username, s->savedhost),
  798. false);
  799. }
  800. /*
  801. * Show password prompt, having first obtained it via a TIS
  802. * or CryptoCard exchange if we're doing TIS or CryptoCard
  803. * authentication.
  804. */
  805. s->userpass_ret = seat_get_userpass_input(
  806. s->ppl.seat, s->cur_prompt, NULL);
  807. while (1) {
  808. while (s->userpass_ret < 0 &&
  809. bufchain_size(s->ppl.user_input) > 0)
  810. s->userpass_ret = seat_get_userpass_input(
  811. s->ppl.seat, s->cur_prompt, s->ppl.user_input);
  812. if (s->userpass_ret >= 0)
  813. break;
  814. s->want_user_input = true;
  815. crReturnV;
  816. s->want_user_input = false;
  817. }
  818. if (!s->userpass_ret) {
  819. /*
  820. * Failed to get a password (for example
  821. * because one was supplied on the command line
  822. * which has already failed to work). Terminate.
  823. */
  824. ssh_user_close(s->ppl.ssh, "User aborted at password prompt");
  825. return;
  826. }
  827. if (s->pwpkt_type == SSH1_CMSG_AUTH_PASSWORD) {
  828. /*
  829. * Defence against traffic analysis: we send a
  830. * whole bunch of packets containing strings of
  831. * different lengths. One of these strings is the
  832. * password, in a SSH1_CMSG_AUTH_PASSWORD packet.
  833. * The others are all random data in
  834. * SSH1_MSG_IGNORE packets. This way a passive
  835. * listener can't tell which is the password, and
  836. * hence can't deduce the password length.
  837. *
  838. * Anybody with a password length greater than 16
  839. * bytes is going to have enough entropy in their
  840. * password that a listener won't find it _that_
  841. * much help to know how long it is. So what we'll
  842. * do is:
  843. *
  844. * - if password length < 16, we send 15 packets
  845. * containing string lengths 1 through 15
  846. *
  847. * - otherwise, we let N be the nearest multiple
  848. * of 8 below the password length, and send 8
  849. * packets containing string lengths N through
  850. * N+7. This won't obscure the order of
  851. * magnitude of the password length, but it will
  852. * introduce a bit of extra uncertainty.
  853. *
  854. * A few servers can't deal with SSH1_MSG_IGNORE, at
  855. * least in this context. For these servers, we need
  856. * an alternative defence. We make use of the fact
  857. * that the password is interpreted as a C string:
  858. * so we can append a NUL, then some random data.
  859. *
  860. * A few servers can deal with neither SSH1_MSG_IGNORE
  861. * here _nor_ a padded password string.
  862. * For these servers we are left with no defences
  863. * against password length sniffing.
  864. */
  865. if (!(s->ppl.remote_bugs & BUG_CHOKES_ON_SSH1_IGNORE) &&
  866. !(s->ppl.remote_bugs & BUG_NEEDS_SSH1_PLAIN_PASSWORD)) {
  867. /*
  868. * The server can deal with SSH1_MSG_IGNORE, so
  869. * we can use the primary defence.
  870. */
  871. int bottom, top, pwlen, i;
  872. pwlen = strlen(s->cur_prompt->prompts[0]->result);
  873. if (pwlen < 16) {
  874. bottom = 0; /* zero length passwords are OK! :-) */
  875. top = 15;
  876. } else {
  877. bottom = pwlen & ~7;
  878. top = bottom + 7;
  879. }
  880. assert(pwlen >= bottom && pwlen <= top);
  881. for (i = bottom; i <= top; i++) {
  882. if (i == pwlen) {
  883. pkt = ssh_bpp_new_pktout(s->ppl.bpp, s->pwpkt_type);
  884. put_stringz(pkt, s->cur_prompt->prompts[0]->result);
  885. pq_push(s->ppl.out_pq, pkt);
  886. } else {
  887. int j;
  888. strbuf *random_data = strbuf_new();
  889. for (j = 0; j < i; j++)
  890. put_byte(random_data, random_byte());
  891. pkt = ssh_bpp_new_pktout(s->ppl.bpp, SSH1_MSG_IGNORE);
  892. put_stringsb(pkt, random_data);
  893. pq_push(s->ppl.out_pq, pkt);
  894. }
  895. }
  896. ppl_logevent("Sending password with camouflage packets");
  897. }
  898. else if (!(s->ppl.remote_bugs & BUG_NEEDS_SSH1_PLAIN_PASSWORD)) {
  899. /*
  900. * The server can't deal with SSH1_MSG_IGNORE
  901. * but can deal with padded passwords, so we
  902. * can use the secondary defence.
  903. */
  904. strbuf *padded_pw = strbuf_new();
  905. ppl_logevent("Sending length-padded password");
  906. pkt = ssh_bpp_new_pktout(s->ppl.bpp, s->pwpkt_type);
  907. put_asciz(padded_pw, s->cur_prompt->prompts[0]->result);
  908. do {
  909. put_byte(padded_pw, random_byte());
  910. } while (padded_pw->len % 64 != 0);
  911. put_stringsb(pkt, padded_pw);
  912. pq_push(s->ppl.out_pq, pkt);
  913. } else {
  914. /*
  915. * The server is believed unable to cope with
  916. * any of our password camouflage methods.
  917. */
  918. ppl_logevent("Sending unpadded password");
  919. pkt = ssh_bpp_new_pktout(s->ppl.bpp, s->pwpkt_type);
  920. put_stringz(pkt, s->cur_prompt->prompts[0]->result);
  921. pq_push(s->ppl.out_pq, pkt);
  922. }
  923. } else {
  924. pkt = ssh_bpp_new_pktout(s->ppl.bpp, s->pwpkt_type);
  925. put_stringz(pkt, s->cur_prompt->prompts[0]->result);
  926. pq_push(s->ppl.out_pq, pkt);
  927. }
  928. ppl_logevent("Sent password");
  929. free_prompts(s->cur_prompt);
  930. s->cur_prompt = NULL;
  931. crMaybeWaitUntilV((pktin = ssh1_login_pop(s)) != NULL);
  932. if (pktin->type == SSH1_SMSG_FAILURE) {
  933. if (flags & FLAG_VERBOSE)
  934. ppl_printf("Access denied\r\n");
  935. ppl_logevent("Authentication refused");
  936. } else if (pktin->type != SSH1_SMSG_SUCCESS) {
  937. ssh_proto_error(s->ppl.ssh, "Received unexpected packet"
  938. " in response to password authentication, type %d "
  939. "(%s)", pktin->type, ssh1_pkt_type(pktin->type));
  940. return;
  941. }
  942. }
  943. ppl_logevent("Authentication successful");
  944. if (conf_get_bool(s->conf, CONF_compression)) {
  945. ppl_logevent("Requesting compression");
  946. pkt = ssh_bpp_new_pktout(s->ppl.bpp, SSH1_CMSG_REQUEST_COMPRESSION);
  947. put_uint32(pkt, 6); /* gzip compression level */
  948. pq_push(s->ppl.out_pq, pkt);
  949. crMaybeWaitUntilV((pktin = ssh1_login_pop(s)) != NULL);
  950. if (pktin->type == SSH1_SMSG_SUCCESS) {
  951. /*
  952. * We don't have to actually do anything here: the SSH-1
  953. * BPP will take care of automatically starting the
  954. * compression, by recognising our outgoing request packet
  955. * and the success response. (Horrible, but it's the
  956. * easiest way to avoid race conditions if other packets
  957. * cross in transit.)
  958. */
  959. } else if (pktin->type == SSH1_SMSG_FAILURE) {
  960. ppl_logevent("Server refused to enable compression");
  961. ppl_printf("Server refused to compress\r\n");
  962. } else {
  963. ssh_proto_error(s->ppl.ssh, "Received unexpected packet"
  964. " in response to compression request, type %d "
  965. "(%s)", pktin->type, ssh1_pkt_type(pktin->type));
  966. return;
  967. }
  968. }
  969. ssh1_connection_set_protoflags(
  970. s->successor_layer, s->local_protoflags, s->remote_protoflags);
  971. {
  972. PacketProtocolLayer *successor = s->successor_layer;
  973. s->successor_layer = NULL; /* avoid freeing it ourself */
  974. ssh_ppl_replace(&s->ppl, successor);
  975. return; /* we've just freed s, so avoid even touching s->crState */
  976. }
  977. crFinishV;
  978. }
  979. static void ssh1_login_dialog_callback(void *loginv, int ret)
  980. {
  981. struct ssh1_login_state *s = (struct ssh1_login_state *)loginv;
  982. s->dlgret = ret;
  983. ssh_ppl_process_queue(&s->ppl);
  984. }
  985. static void ssh1_login_agent_query(struct ssh1_login_state *s, strbuf *req)
  986. {
  987. void *response;
  988. int response_len;
  989. sfree(s->agent_response_to_free);
  990. s->agent_response_to_free = NULL;
  991. s->auth_agent_query = agent_query(req, &response, &response_len,
  992. ssh1_login_agent_callback, s);
  993. if (!s->auth_agent_query)
  994. ssh1_login_agent_callback(s, response, response_len);
  995. }
  996. static void ssh1_login_agent_callback(void *loginv, void *reply, int replylen)
  997. {
  998. struct ssh1_login_state *s = (struct ssh1_login_state *)loginv;
  999. s->auth_agent_query = NULL;
  1000. s->agent_response_to_free = reply;
  1001. s->agent_response = make_ptrlen(reply, replylen);
  1002. queue_idempotent_callback(&s->ppl.ic_process_queue);
  1003. }
  1004. static void ssh1_login_special_cmd(PacketProtocolLayer *ppl,
  1005. SessionSpecialCode code, int arg)
  1006. {
  1007. struct ssh1_login_state *s =
  1008. container_of(ppl, struct ssh1_login_state, ppl);
  1009. PktOut *pktout;
  1010. if (code == SS_PING || code == SS_NOP) {
  1011. if (!(s->ppl.remote_bugs & BUG_CHOKES_ON_SSH1_IGNORE)) {
  1012. pktout = ssh_bpp_new_pktout(s->ppl.bpp, SSH1_MSG_IGNORE);
  1013. put_stringz(pktout, "");
  1014. pq_push(s->ppl.out_pq, pktout);
  1015. }
  1016. }
  1017. }
  1018. static bool ssh1_login_want_user_input(PacketProtocolLayer *ppl)
  1019. {
  1020. struct ssh1_login_state *s =
  1021. container_of(ppl, struct ssh1_login_state, ppl);
  1022. return s->want_user_input;
  1023. }
  1024. static void ssh1_login_got_user_input(PacketProtocolLayer *ppl)
  1025. {
  1026. struct ssh1_login_state *s =
  1027. container_of(ppl, struct ssh1_login_state, ppl);
  1028. if (s->want_user_input)
  1029. queue_idempotent_callback(&s->ppl.ic_process_queue);
  1030. }
  1031. static void ssh1_login_reconfigure(PacketProtocolLayer *ppl, Conf *conf)
  1032. {
  1033. struct ssh1_login_state *s =
  1034. container_of(ppl, struct ssh1_login_state, ppl);
  1035. ssh_ppl_reconfigure(s->successor_layer, conf);
  1036. }