<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=us-ascii">
<META content="MSHTML 6.00.2900.3354" name=GENERATOR></HEAD>
<BODY>
<DIV><FONT face="Courier New" size=2><SPAN class=937070315-12092008>Hi 
all,</SPAN></FONT></DIV>
<DIV><FONT face="Courier New" size=2><SPAN 
class=937070315-12092008></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face="Courier New" size=2><SPAN 
class=937070315-12092008>&nbsp;&nbsp;&nbsp;&nbsp; With dropbear 0.48.1 running 
on a MIPS Au1550 platform, </SPAN></FONT></DIV>
<DIV><FONT face="Courier New" size=2><SPAN 
class=937070315-12092008>&nbsp;&nbsp;&nbsp;&nbsp; RSA key generation 
occasionally takes a very long time (multiple minutes);</SPAN></FONT></DIV>
<DIV><FONT face="Courier New" size=2><SPAN 
class=937070315-12092008>&nbsp;&nbsp;&nbsp;&nbsp; the problem was traced to the 
loop shown below in gen_rsa_priv_key()</SPAN></FONT></DIV>
<DIV><FONT face="Courier New" size=2><SPAN 
class=937070315-12092008>&nbsp;&nbsp;&nbsp;&nbsp; which executes many times, 
until a value of the modulus, n,</SPAN></FONT></DIV>
<DIV><FONT face="Courier New" size=2><SPAN 
class=937070315-12092008>&nbsp;&nbsp;&nbsp;&nbsp; is finally computed that is a 
multiple-of-8-bits long.</SPAN></FONT></DIV>
<DIV><FONT face="Courier New" size=2></FONT>&nbsp;</DIV>
<DIV><BR><FONT face="Courier New" size=2>&nbsp;&nbsp;&nbsp;&nbsp; 
65&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /* PuTTY doesn't like it if 
the modulus isn't a multiple of 8 bits,<BR>&nbsp;&nbsp;&nbsp;&nbsp; 
66&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; * so we just generate 
them until we get one which is OK */<BR>&nbsp;&nbsp;&nbsp;&n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p;&nbsp;&nbsp;&nbsp;&nbsp; 
}<BR>&nbsp;&nbsp;&nbsp;&nbsp; 75&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
} while (mp_count_bits(key-&gt;n) % 8 != 0);<BR></FONT></DIV>
<DIV><SPAN class=937070315-12092008><FONT face="Courier New" 
size=2>&nbsp;&nbsp;&nbsp;<FONT face=Arial>&nbsp;&nbsp;&nbsp; I've found a post 
from Matt Johnston back in 2003 that indicates why this loop was 
addded:</FONT></FONT></SPAN></DIV>
<DIV><SPAN class=937070315-12092008><FONT face=Arial 
size=2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN 
class=937070315-12092008>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<FONT 
face=Arial size=2>&nbsp;&nbsp; <A 
href="http://lists.mindrot.org/pipermail/openssh-unix-dev/2003-July/018639.html">http://lists.mindrot.org/pipermail/openssh-unix-dev/2003-July/018639.html</A></FONT></SPAN></DIV>
<DIV><SPAN class=937070315-12092008><FONT face=Arial 
size=2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN 
class=937070315-12092008>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<FONT 
face=Arial size=2>&nbsp;&nbsp; However, using more recent versions of 
PuTTY&nbsp; (0.58 and 0.60), I&nbsp;don't see any problems</FONT></SPAN></DIV>
<DIV><SPAN class=937070315-12092008><FONT face=Arial 
size=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; with&nbsp;keys 
generated by dropbear </FONT></SPAN><SPAN class=937070315-12092008><FONT 
face=Arial size=2>where the modulus is not a multiple-of-8-bits 
long.</FONT></SPAN></DIV>
<DIV><SPAN class=937070315-12092008><FONT face=Arial 
size=2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=937070315-12092008><FONT face=Arial 
size=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; So, my question 
is: should the loop above be deprecated since it doesn't appear to be necessary 
any more?</FONT></SPAN></DIV>
<DIV><SPAN class=937070315-12092008><FONT face=Arial 
size=2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN 
class=937070315-12092008>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<FONT 
face=Arial size=2>&nbsp;&nbsp; Thanks,</FONT></SPAN></DIV>
<DIV><SPAN 
class=937070315-12092008>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-- 
Sajin</SPAN></DIV>
<DIV><SPAN 
class=937070315-12092008>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN></DIV></BODY></HTML>