Bug 792452 - Updater code updates for multi signature changes. r=bsmith
authorBrian R. Bondy <netzen@gmail.com>
Wed, 17 Oct 2012 09:39:43 -0400
changeset 110564 d01cfea41ba2716c18e6a2c3e65d1b72b590e7e3
parent 110563 ae0eca054da978be2c15a54c609724f7d1437b5c
child 110565 b417ab9ec14d88663af70785fac160f5a0539f94
push id93
push usernmatsakis@mozilla.com
push dateWed, 31 Oct 2012 21:26:57 +0000
reviewersbsmith
bugs792452
milestone19.0a1
Bug 792452 - Updater code updates for multi signature changes. r=bsmith
toolkit/mozapps/update/updater/archivereader.cpp
--- a/toolkit/mozapps/update/updater/archivereader.cpp
+++ b/toolkit/mozapps/update/updater/archivereader.cpp
@@ -39,17 +39,17 @@ static char *outbuf = NULL;
  * @param  name The name ID of the resource
  * @param  type The type ID of the resource
  * @param  data Out parameter which sets the pointer to a buffer containing
  *                  the needed data.
  * @param  size Out parameter which sets the size of the returned data buffer 
  * @return TRUE on success
 */
 BOOL
-LoadFileInResource(int name, int type, const char *&data, DWORD& size)
+LoadFileInResource(int name, int type, const uint8_t *&data, uint32_t& size)
 {
   HMODULE handle = GetModuleHandle(NULL);
   if (!handle) {
     return FALSE;
   }
 
   HRSRC resourceInfoBlockHandle = FindResource(handle, 
                                                MAKEINTRESOURCE(name),
@@ -61,40 +61,40 @@ LoadFileInResource(int name, int type, c
 
   HGLOBAL resourceHandle = LoadResource(handle, resourceInfoBlockHandle);
   if (!resourceHandle) {
     FreeLibrary(handle);
     return FALSE;
   }
 
   size = SizeofResource(handle, resourceInfoBlockHandle);
-  data = static_cast<const char*>(::LockResource(resourceHandle));
+  data = static_cast<const uint8_t*>(::LockResource(resourceHandle));
   FreeLibrary(handle);
   return TRUE;
 }
 
 /**
  * Performs a verification on the opened MAR file with the passed in
  * certificate name ID and type ID.
  *
  * @param  archive   The MAR file to verify the signature on
  * @param  name      The name ID of the resource
  * @param  type      THe type ID of the resource
  * @return OK on success, CERT_LOAD_ERROR or CERT_VERIFY_ERROR on failure.
 */
 int
 VerifyLoadedCert(MarFile *archive, int name, int type)
 {
-  DWORD size = 0;
-  const char *data = NULL;
+  uint32_t size = 0;
+  const uint8_t *data = NULL;
   if (!LoadFileInResource(name, type, data, size) || !data || !size) {
     return CERT_LOAD_ERROR;
   }
 
-  if (mar_verify_signatureW(archive, data, size)) {
+  if (mar_verify_signaturesW(archive, &data, &size, 1)) {
     return CERT_VERIFY_ERROR;
   }
 
   return OK;
 }
 #endif