<div dir="ltr"><div><div><div><div><div><div>Hi Matt,<br><br></div>Thanks for the prompt response.<br><br></div>Yes, mp_exptmod() call in kexdh_comb_key() is taking around 60 seconds.<br><br></div>Adding &quot;#define MP_LOW_MEM 1&quot; to options.h then &quot;make clean&quot; and rebuild does not help the situation. I am not sure about data cache type. How to check it?<br><br></div>Please share your inputs on this.<br><br></div>Thanks<br></div>Pratik<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Sun, Sep 28, 2014 at 7:21 PM, Matt Johnston <span dir="ltr">&lt;<a href="mailto:matt@ucc.asn.au" target="_blank">matt@ucc.asn.au</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Pratik,<br>
<br>
Yes, mp_exptmod() the problematic part. Without performing<br>
the &quot;verify&quot; SSH won&#39;t have any security against network<br>
attacks - certainly not advisable.<br>
<br>
There&#39;s also a mp_exptmod() call in kexdh_comb_key()  which<br>
creates the session key - is that call slow too?<br>
<br>
Does adding &quot;#define MP_LOW_MEM 1&quot; to options.h then &quot;make<br>
clean&quot; and rebuild help the situation? Do you know what kind<br>
of data cache the device has?<br>
<br>
Cheers,<br>
Matt<br>
<div class="HOEnZb"><div class="h5"><br>
<br>
On Fri, Sep 26, 2014 at 12:50:26PM +0530, pratik singh wrote:<br>
&gt; Hi Matt,<br>
&gt;<br>
&gt; Thanks for the reply.<br>
&gt;<br>
&gt; Things are working fine when I commented function &quot;buf_dss_verify&quot;.<br>
&gt; Actually majoriy of the time taken was in mp_exptmod() routine with each<br>
&gt; call takes around 25 secs and because of this only openssh server is<br>
&gt; getting timeout.<br>
&gt; As per your suggestion one of the solution is to merge tofastmath library<br>
&gt; but just for one function merging whole library is a hectic work though.<br>
&gt; Based on experiments i have couple of questions:<br>
&gt; 1)  dropbear ssh client is working by commenting out the function<br>
&gt; &quot;buf_dss_verify&quot;. Is it ok for me to take this as workaround and continue<br>
&gt; or this can cause any serious problem further?<br>
&gt; 2) Is there any other solution to improve the speed of calculations in<br>
&gt; function &quot;mp_exptmod()&quot; only?<br>
&gt;<br>
&gt; Appreciate your response.<br>
&gt;<br>
&gt; Thanks<br>
&gt; Pratik<br>
&gt;<br>
&gt; On Wed, Sep 24, 2014 at 8:02 PM, Matt Johnston &lt;<a href="mailto:matt@ucc.asn.au">matt@ucc.asn.au</a>&gt; wrote:<br>
&gt;<br>
&gt; &gt; Hi Pratik,<br>
&gt; &gt;<br>
&gt; &gt; I&#39;m assuming that it is the session timeout that&#39;s causing<br>
&gt; &gt; the disconnection.  The log on the OpenSSH server should<br>
&gt; &gt; confirm that.<br>
&gt; &gt;<br>
&gt; &gt; I think the only real solution would be to improve the speed<br>
&gt; &gt; of libtommath on that device. Running a profiler to<br>
&gt; &gt; determine the slowest parts would be the first step. I don&#39;t<br>
&gt; &gt; know much about the device itself though it seems libtommath<br>
&gt; &gt; performs quite badly - OpenSSL is generally faster. Looking<br>
&gt; &gt; at the difference in its maths operations might help. It&#39;s<br>
&gt; &gt; non-trivial work though.<br>
&gt; &gt;<br>
&gt; &gt; Cheers,<br>
&gt; &gt; Matt<br>
&gt; &gt;<br>
&gt; &gt;<br>
&gt; &gt; On Wed, Sep 24, 2014 at 02:12:41PM +0530, pratik singh wrote:<br>
&gt; &gt; &gt; Hi,<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt; I am using Dropbear 0.48 with uClinux-dist. Currently dropbear server is<br>
&gt; &gt; &gt; working fine but while trying to run dbclient it throws write error. Some<br>
&gt; &gt; &gt; of the traces are:<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt; TRACE: leave process_packet<br>
&gt; &gt; &gt; TRACE: enter cli_sessionloop<br>
&gt; &gt; &gt; TRACE: enter send_msg_service_request: servicename=&#39;ssh-userauth&#39;<br>
&gt; &gt; &gt; TRACE: enter encrypt_packet()<br>
&gt; &gt; &gt; TRACE: encrypt_packet type is 5<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt; TRACE: enter writemac<br>
&gt; &gt; &gt; TRACE: leave writemac<br>
&gt; &gt; &gt; TRACE: enter enqueue<br>
&gt; &gt; &gt; TRACE: leave enqueue<br>
&gt; &gt; &gt; TRACE: leave encrypt_packet()<br>
&gt; &gt; &gt; TRACE: leave send_msg_service_request<br>
&gt; &gt; &gt; TRACE: leave cli_sessionloop: sent userauth service req<br>
&gt; &gt; &gt; TRACE: enter write_packet<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt; TRACE: enter cli_tty_cleanup<br>
&gt; &gt; &gt; TRACE: leave cli_tty_cleanup: not in raw mode<br>
&gt; &gt; &gt; TRACE: enter session_cleanup<br>
&gt; &gt; &gt; TRACE: enter chancleanup<br>
&gt; &gt; &gt; TRACE: leave chancleanup<br>
&gt; &gt; &gt; TRACE: leave session_cleanup<br>
&gt; &gt; &gt; dbclient: connection to <a href="http://pratik@10.10.10.1:22" target="_blank">pratik@10.10.10.1:22</a> exited: error writing<br>
&gt; &gt; &gt;<br>
&gt; &gt; --------------------------------------------------------------------------------------------------------------<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt; I have tried the following:<br>
&gt; &gt; &gt; 1) Run dbclient with -K option but still getting the same write error<br>
&gt; &gt; &gt; 2) Run dbclient with -y option but still getting the same write error<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt; On further debugging I have found that this write comes because server<br>
&gt; &gt; (in<br>
&gt; &gt; &gt; this case Openssh) is getting timeout.<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt; I am running microblaze processor at about 60mhz with hardware<br>
&gt; &gt; &gt; multiplier, divider enabled.<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt; From the wireshark capture i have seen that server is sending &quot;FIN&quot;<br>
&gt; &gt; &gt; packet. also server is sending the 2 ssh packets in one reply packet.<br>
&gt; &gt; &gt; Do not know the reason of this behavior.<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt; I am facing this problem for connection between dbclient &lt;----&gt; Openssh.<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt; Please help as m stuck to this problem since very long. Appreciate your<br>
&gt; &gt; reply.<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt; Attached the pcap file for your reference. apply<br>
&gt; &gt; &quot;ip.addr==10.216.114.137&quot;<br>
&gt; &gt; &gt; filter in pcap file. IP address is client having dbclient and other is<br>
&gt; &gt; &gt; server having openssh.<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt; --<br>
&gt; &gt; &gt; Thanks &amp; Regards<br>
&gt; &gt; &gt; Pratik Singh<br>
&gt; &gt;<br>
&gt; &gt;<br>
&gt; &gt;<br>
&gt;<br>
&gt;<br>
&gt; --<br>
&gt; Thanks &amp; Regards<br>
&gt; Pratik Singh<br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br>Thanks &amp; Regards<br>Pratik Singh<br>
</div>