# # # patch "keys.cc" # from [02b3c0f70fb1f2a2123351590d5b3c42e9240fa9] # to [ec4af127472843e3211cf3aa1857ff7fb4f5eec7] # # patch "ssh_agent.cc" # from [c0537cbd7e329b501c58612ce5a38d6758aecca8] # to [076be79143413545723375da8e3d833a0fad88df] # ============================================================ --- keys.cc 02b3c0f70fb1f2a2123351590d5b3c42e9240fa9 +++ keys.cc ec4af127472843e3211cf3aa1857ff7fb4f5eec7 @@ -253,7 +253,7 @@ get_private_key(lua_hooks & lua, // don't use the cached bad one next time force = true; continue; - } + } } } if (pkcs8_key) @@ -383,10 +383,13 @@ make_signature(app_state & app, || app.opts.ssh_sign == "check" || app.opts.ssh_sign == "only") { + /* vector ssh_keys = app.agent.get_keys(); if (ssh_keys.size() <= 0) L(FL("make_signature: no rsa keys received from ssh-agent")); else { + */ + if (app.agent.connected()) { //grab the monotone public key as an RSA_PublicKey app.keys.get_key_pair(id, key); rsa_pub_key pub; @@ -401,7 +404,7 @@ make_signature(app_state & app, if (!pub_key) throw informative_failure("Failed to get monotone RSA public key"); - + /* //if monotone key matches ssh-agent key, sign with ssh-agent for (vector::const_iterator si = ssh_keys.begin(); si != ssh_keys.end(); ++si) { @@ -409,10 +412,13 @@ make_signature(app_state & app, && (*pub_key).get_n() == (*si).get_n()) { L(FL("make_signature: ssh key matches monotone key, signing with" " ssh-agent")); - app.agent.sign_data(*si, tosign, sig_string); + */ + app.agent.sign_data(*pub_key, tosign, sig_string); + /* break; } } + */ } if (sig_string.length() <= 0) L(FL("make_signature: monotone and ssh-agent keys do not match, will" ============================================================ --- ssh_agent.cc c0537cbd7e329b501c58612ce5a38d6758aecca8 +++ ssh_agent.cc 076be79143413545723375da8e3d833a0fad88df @@ -33,7 +33,7 @@ using std::vector; * The packet to ask for the keys that ssh-agent has is in this format: * u32 = 1 * command = 11 - * + * * The response packet: * u32 = length * data @@ -310,7 +310,7 @@ ssh_agent::get_keys() } else L(FL("ssh_agent: ignoring key of type '%s'") % type); - + //if (type == "ssh-dss") // { // L(FL("ssh_agent: DSA (ignoring)")); @@ -390,9 +390,16 @@ ssh_agent::sign_data(RSA_PublicKey const fetch_packet(packet_in); u32 packet_in_loc = 0; + /* E(packet_in.at(0) == 14, (F("ssh_agent: sign_data: packet_in type (%u) != 14") % (u32)packet_in.at(0))); + */ + if (packet_in.at(0) != 14) { + L(FL("ssh_agent: sign_data: packet_in type (%u) != 14") + % (u32)packet_in.at(0)); + return; + } packet_in_loc += 1; u32 full_sig_len;