Bug 1518728 - pass key length to libprio public key export function and use long long for output r=hsivonen
authorRobert Helmer <rhelmer@mozilla.com>
Fri, 11 Jan 2019 08:25:42 +0000
changeset 511161 e56cc5e7b57a5d18ab72207f7f246a9b8c610c1c
parent 511160 cee164c51ba7d1d2d4c4395184fbc70eb45ba675
child 511162 c93c9bc7d63a0d096818cbd52274460dfaee58c5
child 511190 2d1497d9bb0402cb5873759ff4e038352dda2d6e
push id10547
push userffxbld-merge
push dateMon, 21 Jan 2019 13:03:58 +0000
treeherdermozilla-beta@24ec1916bffe [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewershsivonen
bugs1518728
milestone66.0a1
first release with
nightly linux32
e56cc5e7b57a / 66.0a1 / 20190116093310 / files
nightly linux64
e56cc5e7b57a / 66.0a1 / 20190116093310 / files
nightly mac
e56cc5e7b57a / 66.0a1 / 20190116093310 / files
nightly win32
e56cc5e7b57a / 66.0a1 / 20190116093310 / files
nightly win64
e56cc5e7b57a / 66.0a1 / 20190116093310 / files
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
releases
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1518728 - pass key length to libprio public key export function and use long long for output r=hsivonen Depends on D16266 Differential Revision: https://phabricator.services.mozilla.com/D16267
dom/prio/test/gtest/TestPrioEncoder.cpp
--- a/dom/prio/test/gtest/TestPrioEncoder.cpp
+++ b/dom/prio/test/gtest/TestPrioEncoder.cpp
@@ -108,17 +108,17 @@ TEST(PrioEncoder, VerifyFull) {
   // Number of different boolean data fields we collect.
   const int ndata = 3;
 
   unsigned char batchIDStr[32];
   memset(batchIDStr, 0, sizeof batchIDStr);
   snprintf((char*)batchIDStr, sizeof batchIDStr, "%d", rand());
 
   bool dataItems[ndata];
-  unsigned long output[ndata];
+  unsigned long long output[ndata];
 
   // The client's data submission is an arbitrary boolean vector.
   for (int i = 0; i < ndata; i++) {
     // Arbitrary data
     dataItems[i] = rand() % 2;
   }
 
   // Initialize NSS random number generator.
@@ -128,22 +128,23 @@ TEST(PrioEncoder, VerifyFull) {
   // Generate keypairs for servers
   prioRv = Keypair_new(&skA, &pkA);
   ASSERT_TRUE(prioRv == SECSuccess);
 
   prioRv = Keypair_new(&skB, &pkB);
   ASSERT_TRUE(prioRv == SECSuccess);
 
   // Export public keys to hex and print to stdout
-  unsigned char pkHexA[CURVE25519_KEY_LEN_HEX + 1];
-  unsigned char pkHexB[CURVE25519_KEY_LEN_HEX + 1];
-  prioRv = PublicKey_export_hex(pkA, pkHexA);
+  const int keyLength = CURVE25519_KEY_LEN_HEX + 1;
+  unsigned char pkHexA[keyLength];
+  unsigned char pkHexB[keyLength];
+  prioRv = PublicKey_export_hex(pkA, pkHexA, keyLength);
   ASSERT_TRUE(prioRv == SECSuccess);
 
-  prioRv = PublicKey_export_hex(pkB, pkHexB);
+  prioRv = PublicKey_export_hex(pkB, pkHexB, keyLength);
   ASSERT_TRUE(prioRv == SECSuccess);
 
   // Use the default configuration parameters.
   cfg = PrioConfig_new(ndata, pkA, pkB, batchIDStr, strlen((char*)batchIDStr));
   ASSERT_TRUE(cfg != nullptr);
 
   PrioPRGSeed serverSecret;
   prioRv = PrioPRGSeed_randomize(&serverSecret);