ssh1login.c 45 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152
  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. ssh_hash *h = ssh_hash_new(&ssh_md5);
  658. put_data(h, buffer, 32);
  659. put_data(h, s->session_id, 16);
  660. ssh_hash_final(h, buffer);
  661. }
  662. pkt = ssh_bpp_new_pktout(
  663. s->ppl.bpp, SSH1_CMSG_AUTH_RSA_RESPONSE);
  664. put_data(pkt, buffer, 16);
  665. pq_push(s->ppl.out_pq, pkt);
  666. mp_free(challenge);
  667. mp_free(response);
  668. }
  669. crMaybeWaitUntilV((pktin = ssh1_login_pop(s))
  670. != NULL);
  671. if (pktin->type == SSH1_SMSG_FAILURE) {
  672. if (flags & FLAG_VERBOSE)
  673. ppl_printf("Failed to authenticate with"
  674. " our public key.\r\n");
  675. continue; /* go and try something else */
  676. } else if (pktin->type != SSH1_SMSG_SUCCESS) {
  677. ssh_proto_error(s->ppl.ssh, "Received unexpected packet"
  678. " in response to RSA authentication, "
  679. "type %d (%s)", pktin->type,
  680. ssh1_pkt_type(pktin->type));
  681. return;
  682. }
  683. break; /* we're through! */
  684. }
  685. }
  686. /*
  687. * Otherwise, try various forms of password-like authentication.
  688. */
  689. s->cur_prompt = new_prompts(s->ppl.seat);
  690. if (conf_get_bool(s->conf, CONF_try_tis_auth) &&
  691. (s->supported_auths_mask & (1 << SSH1_AUTH_TIS)) &&
  692. !s->tis_auth_refused) {
  693. s->pwpkt_type = SSH1_CMSG_AUTH_TIS_RESPONSE;
  694. ppl_logevent("Requested TIS authentication");
  695. pkt = ssh_bpp_new_pktout(s->ppl.bpp, SSH1_CMSG_AUTH_TIS);
  696. pq_push(s->ppl.out_pq, pkt);
  697. crMaybeWaitUntilV((pktin = ssh1_login_pop(s)) != NULL);
  698. if (pktin->type == SSH1_SMSG_FAILURE) {
  699. ppl_logevent("TIS authentication declined");
  700. if (flags & FLAG_INTERACTIVE)
  701. ppl_printf("TIS authentication refused.\r\n");
  702. s->tis_auth_refused = true;
  703. continue;
  704. } else if (pktin->type == SSH1_SMSG_AUTH_TIS_CHALLENGE) {
  705. ptrlen challenge;
  706. char *instr_suf, *prompt;
  707. challenge = get_string(pktin);
  708. if (get_err(pktin)) {
  709. ssh_proto_error(s->ppl.ssh, "TIS challenge packet was "
  710. "badly formed");
  711. return;
  712. }
  713. ppl_logevent("Received TIS challenge");
  714. s->cur_prompt->to_server = true;
  715. s->cur_prompt->name = dupstr("SSH TIS authentication");
  716. /* Prompt heuristic comes from OpenSSH */
  717. if (!memchr(challenge.ptr, '\n', challenge.len)) {
  718. instr_suf = dupstr("");
  719. prompt = mkstr(challenge);
  720. } else {
  721. instr_suf = mkstr(challenge);
  722. prompt = dupstr("Response: ");
  723. }
  724. s->cur_prompt->instruction =
  725. dupprintf("Using TIS authentication.%s%s",
  726. (*instr_suf) ? "\n" : "",
  727. instr_suf);
  728. s->cur_prompt->instr_reqd = true;
  729. add_prompt(s->cur_prompt, prompt, false);
  730. sfree(instr_suf);
  731. } else {
  732. ssh_proto_error(s->ppl.ssh, "Received unexpected packet"
  733. " in response to TIS authentication, "
  734. "type %d (%s)", pktin->type,
  735. ssh1_pkt_type(pktin->type));
  736. return;
  737. }
  738. } else if (conf_get_bool(s->conf, CONF_try_tis_auth) &&
  739. (s->supported_auths_mask & (1 << SSH1_AUTH_CCARD)) &&
  740. !s->ccard_auth_refused) {
  741. s->pwpkt_type = SSH1_CMSG_AUTH_CCARD_RESPONSE;
  742. ppl_logevent("Requested CryptoCard authentication");
  743. pkt = ssh_bpp_new_pktout(s->ppl.bpp, SSH1_CMSG_AUTH_CCARD);
  744. pq_push(s->ppl.out_pq, pkt);
  745. crMaybeWaitUntilV((pktin = ssh1_login_pop(s)) != NULL);
  746. if (pktin->type == SSH1_SMSG_FAILURE) {
  747. ppl_logevent("CryptoCard authentication declined");
  748. ppl_printf("CryptoCard authentication refused.\r\n");
  749. s->ccard_auth_refused = true;
  750. continue;
  751. } else if (pktin->type == SSH1_SMSG_AUTH_CCARD_CHALLENGE) {
  752. ptrlen challenge;
  753. char *instr_suf, *prompt;
  754. challenge = get_string(pktin);
  755. if (get_err(pktin)) {
  756. ssh_proto_error(s->ppl.ssh, "CryptoCard challenge packet "
  757. "was badly formed");
  758. return;
  759. }
  760. ppl_logevent("Received CryptoCard challenge");
  761. s->cur_prompt->to_server = true;
  762. s->cur_prompt->name = dupstr("SSH CryptoCard authentication");
  763. s->cur_prompt->name_reqd = false;
  764. /* Prompt heuristic comes from OpenSSH */
  765. if (!memchr(challenge.ptr, '\n', challenge.len)) {
  766. instr_suf = dupstr("");
  767. prompt = mkstr(challenge);
  768. } else {
  769. instr_suf = mkstr(challenge);
  770. prompt = dupstr("Response: ");
  771. }
  772. s->cur_prompt->instruction =
  773. dupprintf("Using CryptoCard authentication.%s%s",
  774. (*instr_suf) ? "\n" : "",
  775. instr_suf);
  776. s->cur_prompt->instr_reqd = true;
  777. add_prompt(s->cur_prompt, prompt, false);
  778. sfree(instr_suf);
  779. } else {
  780. ssh_proto_error(s->ppl.ssh, "Received unexpected packet"
  781. " in response to TIS authentication, "
  782. "type %d (%s)", pktin->type,
  783. ssh1_pkt_type(pktin->type));
  784. return;
  785. }
  786. }
  787. if (s->pwpkt_type == SSH1_CMSG_AUTH_PASSWORD) {
  788. if ((s->supported_auths_mask & (1 << SSH1_AUTH_PASSWORD)) == 0) {
  789. ssh_sw_abort(s->ppl.ssh, "No supported authentication methods "
  790. "available");
  791. return;
  792. }
  793. s->cur_prompt->to_server = true;
  794. s->cur_prompt->name = dupstr("SSH password");
  795. add_prompt(s->cur_prompt, dupprintf("%s@%s's password: ",
  796. s->username, s->savedhost),
  797. false);
  798. }
  799. /*
  800. * Show password prompt, having first obtained it via a TIS
  801. * or CryptoCard exchange if we're doing TIS or CryptoCard
  802. * authentication.
  803. */
  804. s->userpass_ret = seat_get_userpass_input(
  805. s->ppl.seat, s->cur_prompt, NULL);
  806. while (1) {
  807. while (s->userpass_ret < 0 &&
  808. bufchain_size(s->ppl.user_input) > 0)
  809. s->userpass_ret = seat_get_userpass_input(
  810. s->ppl.seat, s->cur_prompt, s->ppl.user_input);
  811. if (s->userpass_ret >= 0)
  812. break;
  813. s->want_user_input = true;
  814. crReturnV;
  815. s->want_user_input = false;
  816. }
  817. if (!s->userpass_ret) {
  818. /*
  819. * Failed to get a password (for example
  820. * because one was supplied on the command line
  821. * which has already failed to work). Terminate.
  822. */
  823. ssh_user_close(s->ppl.ssh, "User aborted at password prompt");
  824. return;
  825. }
  826. if (s->pwpkt_type == SSH1_CMSG_AUTH_PASSWORD) {
  827. /*
  828. * Defence against traffic analysis: we send a
  829. * whole bunch of packets containing strings of
  830. * different lengths. One of these strings is the
  831. * password, in a SSH1_CMSG_AUTH_PASSWORD packet.
  832. * The others are all random data in
  833. * SSH1_MSG_IGNORE packets. This way a passive
  834. * listener can't tell which is the password, and
  835. * hence can't deduce the password length.
  836. *
  837. * Anybody with a password length greater than 16
  838. * bytes is going to have enough entropy in their
  839. * password that a listener won't find it _that_
  840. * much help to know how long it is. So what we'll
  841. * do is:
  842. *
  843. * - if password length < 16, we send 15 packets
  844. * containing string lengths 1 through 15
  845. *
  846. * - otherwise, we let N be the nearest multiple
  847. * of 8 below the password length, and send 8
  848. * packets containing string lengths N through
  849. * N+7. This won't obscure the order of
  850. * magnitude of the password length, but it will
  851. * introduce a bit of extra uncertainty.
  852. *
  853. * A few servers can't deal with SSH1_MSG_IGNORE, at
  854. * least in this context. For these servers, we need
  855. * an alternative defence. We make use of the fact
  856. * that the password is interpreted as a C string:
  857. * so we can append a NUL, then some random data.
  858. *
  859. * A few servers can deal with neither SSH1_MSG_IGNORE
  860. * here _nor_ a padded password string.
  861. * For these servers we are left with no defences
  862. * against password length sniffing.
  863. */
  864. if (!(s->ppl.remote_bugs & BUG_CHOKES_ON_SSH1_IGNORE) &&
  865. !(s->ppl.remote_bugs & BUG_NEEDS_SSH1_PLAIN_PASSWORD)) {
  866. /*
  867. * The server can deal with SSH1_MSG_IGNORE, so
  868. * we can use the primary defence.
  869. */
  870. int bottom, top, pwlen, i;
  871. pwlen = strlen(s->cur_prompt->prompts[0]->result);
  872. if (pwlen < 16) {
  873. bottom = 0; /* zero length passwords are OK! :-) */
  874. top = 15;
  875. } else {
  876. bottom = pwlen & ~7;
  877. top = bottom + 7;
  878. }
  879. assert(pwlen >= bottom && pwlen <= top);
  880. for (i = bottom; i <= top; i++) {
  881. if (i == pwlen) {
  882. pkt = ssh_bpp_new_pktout(s->ppl.bpp, s->pwpkt_type);
  883. put_stringz(pkt, s->cur_prompt->prompts[0]->result);
  884. pq_push(s->ppl.out_pq, pkt);
  885. } else {
  886. int j;
  887. strbuf *random_data = strbuf_new();
  888. for (j = 0; j < i; j++)
  889. put_byte(random_data, random_byte());
  890. pkt = ssh_bpp_new_pktout(s->ppl.bpp, SSH1_MSG_IGNORE);
  891. put_stringsb(pkt, random_data);
  892. pq_push(s->ppl.out_pq, pkt);
  893. }
  894. }
  895. ppl_logevent("Sending password with camouflage packets");
  896. }
  897. else if (!(s->ppl.remote_bugs & BUG_NEEDS_SSH1_PLAIN_PASSWORD)) {
  898. /*
  899. * The server can't deal with SSH1_MSG_IGNORE
  900. * but can deal with padded passwords, so we
  901. * can use the secondary defence.
  902. */
  903. strbuf *padded_pw = strbuf_new();
  904. ppl_logevent("Sending length-padded password");
  905. pkt = ssh_bpp_new_pktout(s->ppl.bpp, s->pwpkt_type);
  906. put_asciz(padded_pw, s->cur_prompt->prompts[0]->result);
  907. do {
  908. put_byte(padded_pw, random_byte());
  909. } while (padded_pw->len % 64 != 0);
  910. put_stringsb(pkt, padded_pw);
  911. pq_push(s->ppl.out_pq, pkt);
  912. } else {
  913. /*
  914. * The server is believed unable to cope with
  915. * any of our password camouflage methods.
  916. */
  917. ppl_logevent("Sending unpadded password");
  918. pkt = ssh_bpp_new_pktout(s->ppl.bpp, s->pwpkt_type);
  919. put_stringz(pkt, s->cur_prompt->prompts[0]->result);
  920. pq_push(s->ppl.out_pq, pkt);
  921. }
  922. } else {
  923. pkt = ssh_bpp_new_pktout(s->ppl.bpp, s->pwpkt_type);
  924. put_stringz(pkt, s->cur_prompt->prompts[0]->result);
  925. pq_push(s->ppl.out_pq, pkt);
  926. }
  927. ppl_logevent("Sent password");
  928. free_prompts(s->cur_prompt);
  929. s->cur_prompt = NULL;
  930. crMaybeWaitUntilV((pktin = ssh1_login_pop(s)) != NULL);
  931. if (pktin->type == SSH1_SMSG_FAILURE) {
  932. if (flags & FLAG_VERBOSE)
  933. ppl_printf("Access denied\r\n");
  934. ppl_logevent("Authentication refused");
  935. } else if (pktin->type != SSH1_SMSG_SUCCESS) {
  936. ssh_proto_error(s->ppl.ssh, "Received unexpected packet"
  937. " in response to password authentication, type %d "
  938. "(%s)", pktin->type, ssh1_pkt_type(pktin->type));
  939. return;
  940. }
  941. }
  942. ppl_logevent("Authentication successful");
  943. if (conf_get_bool(s->conf, CONF_compression)) {
  944. ppl_logevent("Requesting compression");
  945. pkt = ssh_bpp_new_pktout(s->ppl.bpp, SSH1_CMSG_REQUEST_COMPRESSION);
  946. put_uint32(pkt, 6); /* gzip compression level */
  947. pq_push(s->ppl.out_pq, pkt);
  948. crMaybeWaitUntilV((pktin = ssh1_login_pop(s)) != NULL);
  949. if (pktin->type == SSH1_SMSG_SUCCESS) {
  950. /*
  951. * We don't have to actually do anything here: the SSH-1
  952. * BPP will take care of automatically starting the
  953. * compression, by recognising our outgoing request packet
  954. * and the success response. (Horrible, but it's the
  955. * easiest way to avoid race conditions if other packets
  956. * cross in transit.)
  957. */
  958. } else if (pktin->type == SSH1_SMSG_FAILURE) {
  959. ppl_logevent("Server refused to enable compression");
  960. ppl_printf("Server refused to compress\r\n");
  961. } else {
  962. ssh_proto_error(s->ppl.ssh, "Received unexpected packet"
  963. " in response to compression request, type %d "
  964. "(%s)", pktin->type, ssh1_pkt_type(pktin->type));
  965. return;
  966. }
  967. }
  968. ssh1_connection_set_protoflags(
  969. s->successor_layer, s->local_protoflags, s->remote_protoflags);
  970. {
  971. PacketProtocolLayer *successor = s->successor_layer;
  972. s->successor_layer = NULL; /* avoid freeing it ourself */
  973. ssh_ppl_replace(&s->ppl, successor);
  974. return; /* we've just freed s, so avoid even touching s->crState */
  975. }
  976. crFinishV;
  977. }
  978. static void ssh1_login_dialog_callback(void *loginv, int ret)
  979. {
  980. struct ssh1_login_state *s = (struct ssh1_login_state *)loginv;
  981. s->dlgret = ret;
  982. ssh_ppl_process_queue(&s->ppl);
  983. }
  984. static void ssh1_login_agent_query(struct ssh1_login_state *s, strbuf *req)
  985. {
  986. void *response;
  987. int response_len;
  988. sfree(s->agent_response_to_free);
  989. s->agent_response_to_free = NULL;
  990. s->auth_agent_query = agent_query(req, &response, &response_len,
  991. ssh1_login_agent_callback, s);
  992. if (!s->auth_agent_query)
  993. ssh1_login_agent_callback(s, response, response_len);
  994. }
  995. static void ssh1_login_agent_callback(void *loginv, void *reply, int replylen)
  996. {
  997. struct ssh1_login_state *s = (struct ssh1_login_state *)loginv;
  998. s->auth_agent_query = NULL;
  999. s->agent_response_to_free = reply;
  1000. s->agent_response = make_ptrlen(reply, replylen);
  1001. queue_idempotent_callback(&s->ppl.ic_process_queue);
  1002. }
  1003. static void ssh1_login_special_cmd(PacketProtocolLayer *ppl,
  1004. SessionSpecialCode code, int arg)
  1005. {
  1006. struct ssh1_login_state *s =
  1007. container_of(ppl, struct ssh1_login_state, ppl);
  1008. PktOut *pktout;
  1009. if (code == SS_PING || code == SS_NOP) {
  1010. if (!(s->ppl.remote_bugs & BUG_CHOKES_ON_SSH1_IGNORE)) {
  1011. pktout = ssh_bpp_new_pktout(s->ppl.bpp, SSH1_MSG_IGNORE);
  1012. put_stringz(pktout, "");
  1013. pq_push(s->ppl.out_pq, pktout);
  1014. }
  1015. }
  1016. }
  1017. static bool ssh1_login_want_user_input(PacketProtocolLayer *ppl)
  1018. {
  1019. struct ssh1_login_state *s =
  1020. container_of(ppl, struct ssh1_login_state, ppl);
  1021. return s->want_user_input;
  1022. }
  1023. static void ssh1_login_got_user_input(PacketProtocolLayer *ppl)
  1024. {
  1025. struct ssh1_login_state *s =
  1026. container_of(ppl, struct ssh1_login_state, ppl);
  1027. if (s->want_user_input)
  1028. queue_idempotent_callback(&s->ppl.ic_process_queue);
  1029. }
  1030. static void ssh1_login_reconfigure(PacketProtocolLayer *ppl, Conf *conf)
  1031. {
  1032. struct ssh1_login_state *s =
  1033. container_of(ppl, struct ssh1_login_state, ppl);
  1034. ssh_ppl_reconfigure(s->successor_layer, conf);
  1035. }