Commit e7f2bdb2 authored by Kathleen Brade's avatar Kathleen Brade Committed by Georg Koppen
Browse files

Bug 13379: Sign our MAR files.

Configure with --enable-signmar (build the signmar tool).
Configure with --enable-verify-mar (when updating, require a valid signature
  on the MAR file before it is applied).
Use the Tor Browser version instead of the Firefox version inside the
  MAR file info block (necessary to prevent downgrade attacks).
Use NSS on all platforms for checking MAR signatures (instead of using
  OS-native APIs, which Mozilla does on Mac OS and Windows). So that the
  NSS and NSPR libraries the updater depends on can be found at runtime, we
  add the firefox directory to the shared library search path on all platforms.
parent 557dba1e
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -13,6 +13,8 @@ ac_add_options --enable-official-branding
ac_add_options --enable-default-toolkit=cairo-gtk3

ac_add_options --enable-tor-browser-update
ac_add_options --enable-signmar
ac_add_options --enable-verify-mar

ac_add_options --disable-strip
ac_add_options --disable-install-strip
+2 −0
Original line number Diff line number Diff line
@@ -29,6 +29,8 @@ ac_add_options --enable-official-branding
ac_add_options --enable-default-toolkit=cairo-gtk3

ac_add_options --enable-tor-browser-update
ac_add_options --enable-signmar
ac_add_options --enable-verify-mar

ac_add_options --disable-strip
ac_add_options --disable-install-strip
+2 −0
Original line number Diff line number Diff line
@@ -43,6 +43,8 @@ ac_add_options --disable-debug

ac_add_options --enable-tor-browser-data-outside-app-dir
ac_add_options --enable-tor-browser-update
ac_add_options --enable-signmar
ac_add_options --enable-verify-mar

ac_add_options --disable-crashreporter
ac_add_options --disable-maintenance-service
+2 −0
Original line number Diff line number Diff line
@@ -15,6 +15,8 @@ ac_add_options --enable-strip
ac_add_options --enable-official-branding

ac_add_options --enable-tor-browser-update
ac_add_options --enable-signmar
ac_add_options --enable-verify-mar

# Let's make sure no preference is enabling either Adobe's or Google's CDM.
ac_add_options --disable-eme
+13 −5
Original line number Diff line number Diff line
@@ -32,7 +32,11 @@ int mar_repackage_and_sign(const char *NSSConfigDir,
                           const char * dest);

static void print_version() {
#ifdef TOR_BROWSER_UPDATE
  printf("Version: %s\n", TOR_BROWSER_VERSION);
#else
  printf("Version: %s\n", MOZ_APP_VERSION);
#endif
  printf("Default Channel ID: %s\n", MAR_CHANNEL_ID);
}

@@ -62,7 +66,7 @@ static void print_usage() {
         "signed_input_archive.mar base_64_encoded_signature_file "
         "changed_signed_output.mar\n");
  printf("(i) is the index of the certificate to extract\n");
#if defined(XP_MACOSX) || (defined(XP_WIN) && !defined(MAR_NSS))
#if (defined(XP_MACOSX) || defined(XP_WIN)) && !defined(MAR_NSS)
  printf("Verify a MAR file:\n");
  printf("  mar [-C workingDir] -D DERFilePath -v signed_archive.mar\n");
  printf("At most %d signature certificate DER files are specified by "
@@ -117,7 +121,11 @@ int main(int argc, char **argv) {
  char *NSSConfigDir = NULL;
  const char *certNames[MAX_SIGNATURES];
  char *MARChannelID = MAR_CHANNEL_ID;
#ifdef TOR_BROWSER_UPDATE
  char *productVersion = TOR_BROWSER_VERSION;
#else
  char *productVersion = MOZ_APP_VERSION;
#endif
  uint32_t k;
  int rv = -1;
  uint32_t certCount = 0;
@@ -139,8 +147,8 @@ int main(int argc, char **argv) {
#if defined(XP_WIN) && !defined(MAR_NSS) && !defined(NO_SIGN_VERIFY)
  memset((void*)certBuffers, 0, sizeof(certBuffers));
#endif
#if !defined(NO_SIGN_VERIFY) && ((!defined(MAR_NSS) && defined(XP_WIN)) || \
                                 defined(XP_MACOSX))
#if !defined(NO_SIGN_VERIFY) && (!defined(MAR_NSS) && (defined(XP_WIN) || \
                                 defined(XP_MACOSX)))
  memset(DERFilePaths, 0, sizeof(DERFilePaths));
  memset(fileSizes, 0, sizeof(fileSizes));
#endif
@@ -172,8 +180,8 @@ int main(int argc, char **argv) {
      argv += 2;
      argc -= 2;
    }
#if !defined(NO_SIGN_VERIFY) && ((!defined(MAR_NSS) && defined(XP_WIN)) || \
                                 defined(XP_MACOSX))
#if !defined(NO_SIGN_VERIFY) && (!defined(MAR_NSS) && (defined(XP_WIN) || \
                                 defined(XP_MACOSX)))
    /* -D DERFilePath, also matches -D[index] DERFilePath
       We allow an index for verifying to be symmetric
       with the import and export command line arguments. */
Loading