Date:  18 Jan 2006 07:38:28 Hong Kong Time

superreview requested: [Bug 320589] Code cleanup in lib/freebl/ec.c : [Attachment 208786] Proposed patch v2


Wan-Teh Chang  has asked Nelson Bolyard
 for superreview:
Bug 320589: Code cleanup in lib/freebl/ec.c

Attachment 208786: Proposed patch v2

------- Additional Comments from Wan-Teh Chang 
Summary of this patch.

1. The local variable 'len' is split into two variable
'flen' and 'olen', for the length of the field size
and the length of the base point, respectively.

Recall that the coordinates of the points are elements
of the field, so the length of the field size should be
used with the coordinates of points and EC public keys
(which are points).

The length of the base point order should be used with
the EC private key, signature components r and s, and
to truncate the hash output.

2. Miscellaneous changes to report better error codes.

3. In ECDSA_VerifyDigest, y1, x2, and y2, and pointA
and pointB are not necessary.

4. In ECDSA_VerifyDigest, I only require that
signature->len be even.  I allow signature->len
to be shorter or longer than the expected length (2*len)
to allow adding extraneous leading zeros or omitting leading
zeros.	This flexibility in the signature's length
simplifies the FIPS algorithm test program.  Please
let me know if you object to this change.