Implement quick DER decoder

RESOLVED FIXED in 3.6

Status

P1
normal
RESOLVED FIXED
16 years ago
16 years ago

People

(Reporter: julien.pierre, Assigned: julien.pierre)

Tracking

Dependency tree / graph

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(3 attachments, 1 obsolete attachment)

(Assignee)

Description

16 years ago
The ASN.1 DER decoder was shown to perform too many memory allocations which
made performance unbearably slow. Bug # 149816 has more details.
(Assignee)

Updated

16 years ago
Priority: -- → P1
Target Milestone: --- → 3.6
(Assignee)

Comment 1

16 years ago
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 .
(Assignee)

Comment 2

16 years ago
Created attachment 94122 [details]
quickder.h - declaration of quick DER decoder
(Assignee)

Comment 3

16 years ago
Created attachment 94123 [details] [diff] [review]
patches for manifest.mn and secasn1t.h
(Assignee)

Updated

16 years ago
Blocks: 149816
(Assignee)

Comment 4

16 years ago
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
(Assignee)

Comment 5

16 years ago
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

Comment 6

16 years ago
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
(Assignee)

Comment 7

16 years ago
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.