The ASN.1 DER decoder was shown to perform too many memory allocations which made performance unbearably slow. Bug # 149816 has more details.
Created attachment 94121 [details] quickder.c - implementation of new quick DER decoder Updated after Wan-Teh's review This still needs to be reviewed for functional correctness by someone knowledgeable of ASN.1 and our templates, in particular MatchItemType and DecodeItem .
Checked in the new decoder to the NSS 3.6 tip . Checking in manifest.mn; /cvsroot/mozilla/security/nss/lib/util/manifest.mn,v <-- manifest.mn new revision: 1.8; previous revision: 1.7 done RCS file: /cvsroot/mozilla/security/nss/lib/util/quickder.c,v done Checking in quickder.c; /cvsroot/mozilla/security/nss/lib/util/quickder.c,v <-- quickder.c initial revision: 1.1 done RCS file: /cvsroot/mozilla/security/nss/lib/util/quickder.h,v done Checking in quickder.h; /cvsroot/mozilla/security/nss/lib/util/quickder.h,v <-- quickder.h initial revision: 1.1 done Checking in secasn1t.h; /cvsroot/mozilla/security/nss/lib/util/secasn1t.h,v <-- secasn1t.h new revision: 1.6; previous revision: 1.5 done Checking in secerr.h; /cvsroot/mozilla/security/nss/lib/util/secerr.h,v <-- secerr.h new revision: 1.5; previous revision: 1.4 done Checking in nss.def; /cvsroot/mozilla/security/nss/lib/nss/nss.def,v <-- nss.def new revision: 1.75; previous revision: 1.74 done
Created attachment 94295 [details] quickder.c - new decoder as initially checked in 1) fixed handling of handling of SEC_ASN1_CHOICE, thanks to Terry 2) fixed handling of implicit tagging 3) optimized the two allocations for the array and items in DecodeGroup into a single one 4) add type checking for SEC_ASN1_INLINE | SEC_ASN1_OPTIONAL as well as SEC_ASN1_POINTER | SEC_ASN1_OPTIONAL 5) add type checking for SEC_ASN1_CHOICE even when not decoding, in particular if the parent is SEC_ASN1_OPTIONAL (see 4), so that choices can be optional and/or skipped
Attachment #94121 - Attachment is obsolete: true
It might be a good idea to just declare SEC_QuickDERDecodeItem in the existing secasn1.h header and do away with the quickder.h header.
Assignee: wtc → jpierre
Many thanks to Terry for the extensive code review. I have incorporated the feedback into the source tree. Closing this bug.
Status: NEW → RESOLVED
Last Resolved: 16 years ago
Depends on: 83247
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.