linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Andy Polyakov <appro@fy.chalmers.se>
To: openssl-dev@openssl.org
Cc: linuxppc-embedded@ozlabs.org
Subject: Re: PPC bn_div_words routine rewrite
Date: Tue, 05 Jul 2005 23:22:43 +0200	[thread overview]
Message-ID: <42CAFA23.7080700@fy.chalmers.se> (raw)
In-Reply-To: <4dd15d18050705132178b5fd92@mail.gmail.com>

> Let's take first call to BN_div_word for example from BN_bn2dec, the
> parameter being passed to BN_div_word is (a=35, w=1000000000) (decimal
> numbers).  It then calls the bn_div_words with (h=0, l=35,
> d=1000000000)  if you examine the code in linux_ppc32.s it will exit
> early on because h is 0.  the routine returns a divide by 0,  which is
> undefined according to the manual.  In the case of ppc8xx the result
> is 0x80000000.

And on the PPC machine I have access to it returns 0. This is 
explanation why I never experienced any SEGV, but a sparse decimal 
output. And it does explain why BN_is_zero condition never met on your 
system and you hit sbrk(0) limit and suffer the penalty. However! Note 
that updated routine, 
http://cvs.openssl.org/getfile/openssl/crypto/bn/asm/ppc.pl?v=1.4 never 
issues divide by 0 [it traps instead, but the condition is never met now 
when called from BN_div_words] and it does return correct answer to me. 
Can you really confirm that updated subroutine doesn't work for you? And 
if so, how does problem manifest? Still SEGV? At same point?

It should pointed out that bug in ppc.pl is encountered only in 0.9.7 
context, as 0.9.8 avoids it by normalizing divisor [and adjusting 
dividend accordingly]. BTW, I can confirm that 0.9.7 produces correct 
decimal ASCII with your routine [but no luck with make test_bn], but in 
0.9.8 context decimal printout comes out truncated [not sparse with some 
significant digits there and there, but truncated] if your routine is 
pasted in. A.

  reply	other threads:[~2005-07-05 21:22 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <19EE6EC66973A5408FBE4CB7772F6F0A02C8770E@ltnmail.xyplex.com>
     [not found] ` <4dd15d1805070508312427a0ba@mail.gmail.com>
2005-07-05 15:45   ` Fwd: PPC bn_div_words routine rewrite David Ho
2005-07-05 16:36     ` David Ho
2005-07-05 17:01       ` David Ho
2005-07-05 20:21         ` David Ho
2005-07-05 21:22           ` Andy Polyakov [this message]
2005-07-05 21:25           ` David Ho
2005-07-05 21:49             ` Andy Polyakov
     [not found] <4dd15d1805063003587276af7e@mail.gmail.com>
2005-06-30 22:22 ` David Ho
2005-07-01 17:36   ` Andy Polyakov
2005-07-04 14:35     ` David Ho
2005-07-05 15:00       ` Andy Polyakov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=42CAFA23.7080700@fy.chalmers.se \
    --to=appro@fy.chalmers.se \
    --cc=linuxppc-embedded@ozlabs.org \
    --cc=openssl-dev@openssl.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).