Closed Bug 1827534 Opened 2 years ago Closed 2 years ago

Reduce nssckbi size a little more

Categories

(Core :: Security: PSM, task)

task

Tracking

()

RESOLVED FIXED
114 Branch
Tracking Status
firefox114 --- fixed

People

(Reporter: glandium, Assigned: glandium)

References

Details

Attachments

(2 files)

The changes in bug 1794045 prevented me to build with rustc 1.63 downstream (I know, I know...), so I took a quick look at what it was doing and it turns out we can reduce the size of libnssckbi even more than what bug 1794045 did at the expense of a little runtime computation. On my build, by PoC saves 23KB (that's on top of the 20KB saved by bug 1794045)

(In reply to Mike Hommey [:glandium] from comment #0)

On my build, by PoC saves 23KB (that's on top of the 20KB saved by bug 1794045)

Make that 24.6KB (I saved a little more).

This change does the following:

  • Replace slices for serial and subject with offsets. This trades space
    for a pointer, a length and a relocation (which on 64-bits Linux is an
    extra 24 bytes), with runtime computation based on two offsets, that
    are small enough that they fit in 8-bits integers (and the rust
    compiler will not ignore overflows for the literals that come from
    build.rs so even if newer values overflow, that won't go unnoticed).
  • "Inline" sha1 and md5 in Root as fixed-sized arrays instead of slices.
    That removes an indirection and saves the size of a fat pointer + the
    corresponding relocations.
  • Make BUILTINS an array rather than a slice, which also saves a
    relocation.

Overall this saves 24.6KB on my local Linux x64 build.

Attachment #9328245 - Attachment description: Bug 1827534 - Avoid builtins-static's build script errors to show more than a compile error. → Bug 1827534 - Avoid builtins-static's build script errors showing more than a compile error.
Pushed by mh@glandium.org: https://hg.mozilla.org/integration/autoland/rev/862f76333f30 Avoid builtins-static's build script errors showing more than a compile error. r=jschanck https://hg.mozilla.org/integration/autoland/rev/bf6d5a53da95 Reduce nssckbi size a little more. r=jschanck
Status: NEW → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 114 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: