Last Comment Bug 345779 - Useless assignment statements in ec_GF2m_pt_mul_mont
: Useless assignment statements in ec_GF2m_pt_mul_mont
Status: RESOLVED FIXED
:
Product: NSS
Classification: Components
Component: Libraries (show other bugs)
: 3.11
: All All
: -- trivial (vote)
: 3.12
Assigned To: nobody
:
Mentors:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2006-07-24 14:49 PDT by Wan-Teh Chang
Modified: 2006-07-26 16:18 PDT (History)
1 user (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---


Attachments
Proposed patch (1.92 KB, patch)
2006-07-24 14:50 PDT, Wan-Teh Chang
douglas: review+
Details | Diff | Splinter Review

Description Wan-Teh Chang 2006-07-24 14:49:48 PDT
In lib/freebl/ec/ec2_mont.c, function ec_GF2m_pt_mul_mont has
two useless assignment statements.

In rev. 1.2 of the file, we have:

208     MP_CHECKOK(mp_copy(rx, &x2));   /* x2 = rx */
209     MP_CHECKOK(mp_copy(ry, &z2));   /* z2 = ry */
210 
211     MP_CHECKOK(mp_copy(px, &x1));   /* x1 = px */
212     MP_CHECKOK(mp_set_int(&z1, 1)); /* z1 = 1 */
213     MP_CHECKOK(group->meth->field_sqr(&x1, &z2, group->meth));  /* z2 =
214                                                                  * x1^2 =
215                                                                  * x2^2 */
216     MP_CHECKOK(group->meth->field_sqr(&z2, &x2, group->meth));

The value assigned to x2 in line 208 is never used.  It is
discarded in line 216.

The value assigned to z2 in line 209 is never used.  It is
discarded in line 213.

So the assignment statements in lines 208 and 209 can be removed.
Also, the comment in line 215 should say px^2 instead of x2^2.
Comment 1 Wan-Teh Chang 2006-07-24 14:50:19 PDT
Created attachment 230495 [details] [diff] [review]
Proposed patch
Comment 2 Wan-Teh Chang 2006-07-26 16:18:51 PDT
I checked in the proposed patch on the NSS trunk (NSS 3.12).

Checking in ec2_mont.c;
/cvsroot/mozilla/security/nss/lib/freebl/ecl/ec2_mont.c,v  <--  ec2_mont.c
new revision: 1.3; previous revision: 1.2
done

Note You need to log in before you can comment on or make changes to this bug.