BN_add_word bug

2003-09-23 Thread Otto Moerbeek
CEST) From: Otto Moerbeek <[EMAIL PROTECTED]> To: [EMAIL PROTECTED], [EMAIL PROTECTED] Cc: [EMAIL PROTECTED], [EMAIL PROTECTED] Subject: BN_add_word bug Hi, I've been working with the big number lib from the open ssl crypto library, and I have found the following problem, which is demons

Re: BN_add_word bug

2003-09-24 Thread Nils Larsch
Otto Moerbeek wrote: Hi, Moin Otto, I've been working with the big number lib from the open ssl crypto library, and I have found the following problem, which is demonstrated by the program below (you may have to fix the includes if you test it on another platform than OpenBSD). Summary: It

Re: BN_add_word bug

2003-09-24 Thread Otto Moerbeek
On Wed, 24 Sep 2003, Nils Larsch wrote: > Otto Moerbeek wrote: > > Hi, > > Moin Otto, > > > > I've been working with the big number lib from the open ssl crypto > > library, and I have found the following problem, which is demonstrated by > > the program below (you may have to fix the inclu

Re: BN_add_word bug

2003-09-24 Thread Nils Larsch
Otto Moerbeek wrote: Hmmm, did not try your patch yet, but here's another interesting case that doesn't use BN_bn2dec(): int g(void) { BIGNUM *a, *b; a = BN_new(); BN_set_word(a, 0); b = BN_new(); BN_set_word(b, 0); BN_add_word(b, 0); ret

Re: BN_add_word bug

2003-09-24 Thread Otto Moerbeek
On Wed, 24 Sep 2003, Nils Larsch wrote: > BN_cmp has a similiar problem. BN_cmp does not check if the top value > is really correct (but it uses the top value nonetheless) i.e. leading > zeros matters for BN_cmp. I think the best solution to avoid this is > to let BN_add_word (BN_sub_word) immed

Re: BN_add_word bug

2003-09-25 Thread Nils Larsch
Otto Moerbeek wrote: OK, that would amount to the fixes below: - in BN_cmp, call bn_fix_top just before comparing the two tops. Not really necessary as the normal BN_* functions which change the value of the bignum should always ensure that the top value is correct (i.e. as small as possible)

Re: BN_add_word bug

2003-09-25 Thread Geoff Thorpe
On September 25, 2003 03:33 am, Nils Larsch wrote: > Otto Moerbeek wrote: > > > > OK, that would amount to the fixes below: > > > > - in BN_cmp, call bn_fix_top just before comparing the two tops. > > Not really necessary as the normal BN_* functions which change the > value of the bignum shou

Re: BN_add_word bug

2003-09-25 Thread Otto Moerbeek
On Thu, 25 Sep 2003, Geoff Thorpe wrote: > On September 25, 2003 03:33 am, Nils Larsch wrote: > > Otto Moerbeek wrote: > > > > > > > OK, that would amount to the fixes below: > > > > > > - in BN_cmp, call bn_fix_top just before comparing the two tops. > > > > Not really necessary as the nor

Re: BN_add_word bug

2003-09-25 Thread Geoff Thorpe
Hi there, On September 25, 2003 02:29 pm, Otto Moerbeek wrote: > On Thu, 25 Sep 2003, Geoff Thorpe wrote: > > I would go one step further and suggest that BN_cmp() and operations > > like it that should treat their inputs as "const" should not modify > > the BIGNUMs at all. Fixing BIGNUMs wherever

Re: BN_add_word bug

2003-09-30 Thread Nils Larsch
Hi Geoff, Geoff Thorpe wrote: I understand that, and if someone else is prepared to verify and assure themselves that the patch is acceptable, I won't object to them committing it. However, I don't *like* us committing more hacks when there are already too many, and your bug-report and pat