gecko-dev/security/manager/tools
Nathan Froyd e1d8b92ec6 Bug 1255425 - part 2 - pack kSTSPreloadList into a more efficient format; r=keeler
Entries in kSTSPreloadList currently look like:

class nsSTSPreload
{
  public:
    const char *mHost;
    const bool mIncludeSubdomains;
};

This is inefficient for a couple of reasons:

* The structure has a bunch of wasted space: it takes 8 bytes on 32-bit
  platforms and 16 bytes on 64-bit platforms, even though it only uses 5
  and 9 bytes, respectively.

* The |const char*| requires additional space in the form of relocations
  (at least on Linux/Android), which doubles the space cost of
  individual entries.  (The space cost of the relocations is mitigated
  somewhat on Linux and Android because of elfhack, but there's still
  extra cost in the on-disk format and during the load of libxul to
  process those relocations.)

* The relocations the structure requires means that the data in it can't
  be shared between processes, which is important for e10s with multiple
  content processes.

We can make it more efficient by structuring it like so:

static const char kSTSPreloadHosts[] = {
  // One giant character array containing the hosts, in order:
  //   "example.com\0example.org\0example.test\0..."
  // Use an array rather than a literal string due to compiler limitations.
};

struct nsSTSPreload
{
  // An index into kSTSPreloadHosts for the hostname.
  uint32_t mHostIndex: 31;
  // We use the same datatype for both members so that MSVC will pack
  // the bitfields into a single uint32_t.
  uint32_t mIncludeSubdomains: 1;
};

nsSTSPreload now has no wasted space and is significantly smaller,
especially on 64-bit platforms (saves ~29K on 32-bit platforms and ~85K
on 64-bit platforms).  This organization does add a couple extra
operations to searching for preload list entries, depending on your
platform, but the space savings make it worth it.
2016-03-24 15:09:28 -04:00
..
.eslintrc.json Bug 1251011 - Enable ESLint "no-undef" rule for PSM. r=keeler r=mossop 2016-03-16 16:50:33 -07:00
dumpGoogleRoots.js Bug 1253108 - Enable ESLint "strict" rule for PSM. r=keeler 2016-03-19 03:07:13 -07:00
genHPKPStaticPins.js Bug 1255655 - Const-ify kPinset_* arrays. r=cykesiopka. 2016-03-11 13:54:41 +11:00
genRootCAHashes.js Bug 1253108 - Enable ESLint "strict" rule for PSM. r=keeler 2016-03-19 03:07:13 -07:00
getHSTSPreloadList.js Bug 1255425 - part 2 - pack kSTSPreloadList into a more efficient format; r=keeler 2016-03-24 15:09:28 -04:00
KnownRootHashes.json bug 1138716 - update PSM data structures that depend on root CA changes r=mmc 2015-03-23 10:36:55 -07:00
makeCNNICHashes.js Bug 1253108 - Enable ESLint "strict" rule for PSM. r=keeler 2016-03-19 03:07:13 -07:00
PreloadedHPKPins.json bug 1232766 - update the preloaded pinset for Google domains r=rbarnes 2015-12-28 12:30:14 -08:00