Closed Bug 518457 Opened 16 years ago Closed 16 years ago

SECKEY_EncodeDERSubjectPublicKeyInfo and PK11_DEREncodePublicKey are duplicate

Categories

(NSS :: Libraries, defect)

3.12
defect
Not set
trivial

Tracking

(Not tracked)

RESOLVED FIXED
3.12.5

People

(Reporter: wtc, Assigned: wtc)

References

Details

Attachments

(2 files)

Attached patch Proposed patchSplinter Review
SECKEY_EncodeDERSubjectPublicKeyInfo and PK11_DEREncodePublicKey have the same function prototypes and implementations (except that PK11_DEREncodePublicKey has a leak, see bug 518446). We should implement one by calling the other to reduce duplicate code. Since lib/cryptohi appears to be at a higher layer than lib/pk11wrap, I decided to have SECKEY_EncodeDERSubjectPublicKeyInfo call PK11_DEREncodePublicKey.
Attachment #402456 - Flags: review?(rrelyea)
Comment on attachment 402456 [details] [diff] [review] Proposed patch r=nelson. The PK11 implementation is much cleaner, too.
Attachment #402456 - Flags: review+
Nelson, thanks for the code review. The two implementations are copies of each other because the comments and coding styles are exactly the same.
Attachment #402456 - Flags: review?(rrelyea) → review+
I checked in the patch on the NSS trunk (NSS 3.12.5). Checking in seckey.c; /cvsroot/mozilla/security/nss/lib/cryptohi/seckey.c,v <-- seckey.c new revision: 1.50; previous revision: 1.49 done
Status: NEW → RESOLVED
Closed: 16 years ago
Resolution: --- → FIXED
Target Milestone: --- → 3.12.5
Attached patch Do the oppositeSplinter Review
On closer inspection, I think it's better to let SECKEY_EncodeDERSubjectPublicKeyInfo have the real implementation because the symmetric function SECKEY_DecodeDERSubjectPublicKeyInfo exists. This allows us to contrast the Encode and Decode code. pk11akey.c already includes keyhi.h (via key.h), which includes keyhi.h, so it's fine for PK11_DEREncodePublicKey to call SECKEY_EncodeDERSubjectPublicKeyInfo. Checking in cryptohi/seckey.c; /cvsroot/mozilla/security/nss/lib/cryptohi/seckey.c,v <-- seckey.c new revision: 1.51; previous revision: 1.50 done Checking in pk11wrap/pk11akey.c; /cvsroot/mozilla/security/nss/lib/pk11wrap/pk11akey.c,v <-- pk11akey.c new revision: 1.29; previous revision: 1.28 done
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: