Hi
   While dealing on RSAKeyGen I accidentally discovered a set of numbers for 
which BN_mod_exp is giving a wrong result. I want to know whether I am wrong 
or even if my code is right, is there some limitation to BN_mod_exp?
I am interested to calculate (x^y)mod z by using BN_mod_exp(r,x,y,z) where 
the result is stored in r. I used openssl-0.9.6 downloaded from the openssl 
site two days back.
I will give here the values of x,y,z and r in hex. Could anybody please 
throw some light on the seemingly wrong result?
x = 3
y = 2DC6C0
z =

01000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000035691B3FEC50B2AC41174CE60E220E2A33D4791F07BD4039644FE27C02617E1F50A252B6E0F4731BCD0811FB88E5C392338251EA4A63ECAA08CCC6447BC1446D0B8020D98AEE85A4BFEA2353A0268464FD68F0C4224FB011C2F3067C97E2B6C0F91D0F242D1BBACAD3C598481804420C546A0816F4CE5575F7F9B472BDD81FB1949


r = 
B6CF90E2BCC8E683FA61CEF3ABE0D2C0D226CF0F1DF29BFDDED2F17F81B60D9F939B502C078C8B995E6C231D0045D94606093963E3383911E3ED3460BBD109042AB0289CC37AA989F05B90280BBE56245AD452260EAF78D5EB22954A5681977FE06B86CA0A19730D5ABBC11F44DB7F154B74CDDACA4C7BA4AA6160A4F3E9CBB42423D36821827B13367C41759359BD37596FEF1F54AFB898D97FA124D0645E5B9FBF5F53A1207C9DA43E238AB57B7ECBF47A1A5CD5F411E8CFFBFAE0DABFE4E7290F2CD492E7C657605A6500DAE4AB6FB8E66B908D724F14EA090DC790C6C1AAF7A289844FC3642F466E42B62F1F1BCAE3A8C234A28CC76EAFB182C5DF3F93D2


And when I used  a large integer calculator and gmp library as well, I found 
that both gmp and the calculator were giving the same reult but of course 
different from ssl .ssl's output is in the varaible r ,given above.
gmp and the calculator gave the below number:

          0176B344F2A78C0000

Now,I went to the ssl BIGNUM code and  found that for odd modulus, it 
executes montogomery and for even it uses BN_mod_exp_simple. If you use 
simple for all cases it gives slow but correct result but montogomery seems 
to fail in case of some odd modulus like in the present case.
Any idea please?
bye

Thanks
Biswa


_________________________________________________________________
Join the world�s largest e-mail service with MSN Hotmail. 
http://www.hotmail.com

______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    [EMAIL PROTECTED]
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to