Closed Bug 198622 Opened 22 years ago Closed 22 years ago

redundant calls to memset in freebl

Categories

(NSS :: Libraries, enhancement, P3)

3.3.2
enhancement

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: bugz, Assigned: bugz)

Details

(Whiteboard: 3.3.5)

Attachments

(2 files)

The function alg_fips186_1_x3_1 zeroes a SHA1Context, then calls SHA1_Begin, which does the same thing. The first call should be removed.
Attachment #118039 - Flags: review?(nelsonb)
Comment on attachment 118039 [details] [diff] [review] remove redundant call to memset r=wtc.
Attachment #118039 - Flags: superreview?(nelsonb)
Attachment #118039 - Flags: review?(nelsonb)
Attachment #118039 - Flags: review+
Morphing this bug. There are apparently multiple locations where redundant memset calls are made in freebl. Might as well handle them all here. The next two are in MD5_NewContext and SHA1_NewContext. Both use PORT_ZAlloc. However, before the contexts can be used, MD5_Begin and SHA1_Begin must be called. Both of those functions use memset/memcpy/assignment to initialize all of the context's fields. So the ZAlloc in NewContext is redundant.
Summary: PRNG code duplicates calls to memset → redundant calls to memset in freebl
Note that in sha512.c, the NewContext functions do not use ZNew, so only sha_fast.c needed the change.
Attachment #118067 - Flags: review?(wtc)
Attachment #118039 - Flags: superreview?(nelsonb) → superreview+
Comment on attachment 118067 [details] [diff] [review] remove more redundant memsets r=wtc. Please change _Begin to SHA1_Begin and MD5_Begin when you check it in.
Attachment #118067 - Flags: review?(wtc) → review+
Comment on attachment 118067 [details] [diff] [review] remove more redundant memsets I've reviewed these changes. r=nbb. Ian, maybe you should ask Wan-Teh to superreview them.
Comment on attachment 118067 [details] [diff] [review] remove more redundant memsets I think wtc and I both marked this bug r= about the same time. sr=nelsonb
Attachment #118067 - Flags: superreview+
Thanks for the reviews. Checked in; marking fixed.
Status: NEW → RESOLVED
Closed: 22 years ago
Resolution: --- → FIXED
Priority: -- → P3
Target Milestone: --- → 3.8
Whiteboard: 3.3.5
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: