[automerger skipped] Merge "Fix accidental implicit fallthroughs" into oc-mr1-dev am: f5d56edc27 -s ours am: 57badc4ae2 -s ours am: 5c33d5b916 -s ours am: 49fff87ce0 -s ours am: 0a298ae489 -s ours
am skip reason: Change-Id I818e18a995760f17b85b4c72ee577e531fa2a601 with SHA-1 fbeb4fc139 is in history

Change-Id: I9e7504da63b3361d2034791610cb489be2f6e32c
diff --git a/modules/audio_remote_submix/Android.bp b/modules/audio_remote_submix/Android.bp
index c7d018c..9523438 100644
--- a/modules/audio_remote_submix/Android.bp
+++ b/modules/audio_remote_submix/Android.bp
@@ -17,16 +17,13 @@
     relative_install_path: "hw",
     vendor: true,
     srcs: ["audio_hw.cpp"],
-    include_dirs: [
-        "system/media/audio_utils/include",
-    ],
     shared_libs: [
         "liblog",
         "libcutils",
-        "libutils",
+        "libmedia_helper",
         "libnbaio_mono",
+        "libutils",
     ],
-    static_libs: ["libmedia_helper"],
 
     cflags: ["-Wno-unused-parameter"],
 
diff --git a/modules/audio_remote_submix/audio_hw.cpp b/modules/audio_remote_submix/audio_hw.cpp
index 833c12b..dda0d0e 100644
--- a/modules/audio_remote_submix/audio_hw.cpp
+++ b/modules/audio_remote_submix/audio_hw.cpp
@@ -472,7 +472,7 @@
         rsxadev->routes[route_idx].rsxSource.clear();
     }
     memset(rsxadev->routes[route_idx].address, 0, AUDIO_DEVICE_MAX_ADDRESS_LEN);
-#ifdef ENABLE_RESAMPLING
+#if ENABLE_RESAMPLING
     memset(rsxadev->routes[route_idx].resampler_buffer, 0,
             sizeof(int16_t) * DEFAULT_PIPE_SIZE_IN_FRAMES);
 #endif
@@ -499,7 +499,9 @@
         }
         ALOGV("submix_audio_device_destroy_pipe_l(): input ref_count %d", in->ref_count);
 #else
-        rsxadev->input = NULL;
+        route_idx = in->route_handle;
+        ALOG_ASSERT(rsxadev->routes[route_idx].input == in);
+        rsxadev->routes[route_idx].input = NULL;
         shut_down = true;
 #endif // ENABLE_LEGACY_INPUT_OPEN
         if (shut_down) {
@@ -960,7 +962,7 @@
 {
     (void)stream;
     (void)timestamp;
-    return -EINVAL;
+    return -ENOSYS;
 }
 
 /** audio_stream_in implementation **/
@@ -1552,6 +1554,9 @@
         }
         const size_t frame_size_in_bytes = audio_channel_count_from_in_mask(config->channel_mask) *
                 audio_bytes_per_sample(config->format);
+        if (max_buffer_period_size_frames == 0) {
+            max_buffer_period_size_frames = DEFAULT_PIPE_SIZE_IN_FRAMES;
+        }
         const size_t buffer_size = max_buffer_period_size_frames * frame_size_in_bytes;
         SUBMIX_ALOGV("adev_get_input_buffer_size() returns %zu bytes, %zu frames",
                  buffer_size, max_buffer_period_size_frames);
@@ -1623,7 +1628,9 @@
     if (!in) {
         in = (struct submix_stream_in *)calloc(1, sizeof(struct submix_stream_in));
         if (!in) return -ENOMEM;
+#if ENABLE_LEGACY_INPUT_OPEN
         in->ref_count = 1;
+#endif
 
         // Initialize the function pointer tables (v-tables).
         in->stream.common.get_sample_rate = in_get_sample_rate;
@@ -1714,10 +1721,16 @@
     int n = snprintf(msg, sizeof(msg), "\nReroute submix audio module:\n");
     write(fd, &msg, n);
     for (int i=0 ; i < MAX_ROUTES ; i++) {
+#if ENABLE_RESAMPLING
         n = snprintf(msg, sizeof(msg), " route[%d] rate in=%d out=%d, addr=[%s]\n", i,
                 rsxadev->routes[i].config.input_sample_rate,
                 rsxadev->routes[i].config.output_sample_rate,
                 rsxadev->routes[i].address);
+#else
+        n = snprintf(msg, sizeof(msg), " route[%d], rate=%d addr=[%s]\n", i,
+                rsxadev->routes[i].config.common.sample_rate,
+                rsxadev->routes[i].address);
+#endif
         write(fd, &msg, n);
     }
     return 0;
diff --git a/modules/gralloc/framebuffer.cpp b/modules/gralloc/framebuffer.cpp
index c171711..b2ec3e4 100644
--- a/modules/gralloc/framebuffer.cpp
+++ b/modules/gralloc/framebuffer.cpp
@@ -117,7 +117,7 @@
 
 /*****************************************************************************/
 
-int mapFrameBufferLocked(struct private_module_t* module)
+int mapFrameBufferLocked(struct private_module_t* module, int format)
 {
     // already initialized...
     if (module->framebuffer) {
@@ -161,6 +161,20 @@
      */
     info.yres_virtual = info.yres * NUM_BUFFERS;
 
+    switch (format) {
+    case HAL_PIXEL_FORMAT_RGBA_8888:
+        info.bits_per_pixel = 32;
+        info.red.offset = 0;
+        info.red.length = 8;
+        info.green.offset = 8;
+        info.green.length = 8;
+        info.blue.offset = 16;
+        info.blue.length = 8;
+        break;
+    default:
+        ALOGW("unknown format: %d", format);
+        break;
+    }
 
     uint32_t flags = PAGE_FLIP;
 #if USE_PAN_DISPLAY
@@ -280,7 +294,8 @@
 static int mapFrameBuffer(struct private_module_t* module)
 {
     pthread_mutex_lock(&module->lock);
-    int err = mapFrameBufferLocked(module);
+    // Request RGBA8888 because the platform assumes support for RGBA8888.
+    int err = mapFrameBufferLocked(module, HAL_PIXEL_FORMAT_RGBA_8888);
     pthread_mutex_unlock(&module->lock);
     return err;
 }
diff --git a/modules/gralloc/gr.h b/modules/gralloc/gr.h
index ac7e967..14fe6a0 100644
--- a/modules/gralloc/gr.h
+++ b/modules/gralloc/gr.h
@@ -36,7 +36,7 @@
     return (x + (PAGE_SIZE-1)) & ~(PAGE_SIZE-1);
 }
 
-int mapFrameBufferLocked(struct private_module_t* module);
+int mapFrameBufferLocked(struct private_module_t* module, int format);
 int terminateBuffer(gralloc_module_t const* module, private_handle_t* hnd);
 int mapBuffer(gralloc_module_t const* module, private_handle_t* hnd);
 
diff --git a/modules/gralloc/gralloc.cpp b/modules/gralloc/gralloc.cpp
index 07bbfba..87bda97 100644
--- a/modules/gralloc/gralloc.cpp
+++ b/modules/gralloc/gralloc.cpp
@@ -101,7 +101,7 @@
 /*****************************************************************************/
 
 static int gralloc_alloc_framebuffer_locked(alloc_device_t* dev,
-        size_t size, int usage, buffer_handle_t* pHandle)
+        size_t size, int format, int usage, buffer_handle_t* pHandle)
 {
     private_module_t* m = reinterpret_cast<private_module_t*>(
             dev->common.module);
@@ -110,7 +110,7 @@
     if (m->framebuffer == NULL) {
         // initialize the framebuffer, the framebuffer is mapped once
         // and forever.
-        int err = mapFrameBufferLocked(m);
+        int err = mapFrameBufferLocked(m, format);
         if (err < 0) {
             return err;
         }
@@ -154,12 +154,12 @@
 }
 
 static int gralloc_alloc_framebuffer(alloc_device_t* dev,
-        size_t size, int usage, buffer_handle_t* pHandle)
+        size_t size, int format, int usage, buffer_handle_t* pHandle)
 {
     private_module_t* m = reinterpret_cast<private_module_t*>(
             dev->common.module);
     pthread_mutex_lock(&m->lock);
-    int err = gralloc_alloc_framebuffer_locked(dev, size, usage, pHandle);
+    int err = gralloc_alloc_framebuffer_locked(dev, size, format, usage, pHandle);
     pthread_mutex_unlock(&m->lock);
     return err;
 }
@@ -236,7 +236,7 @@
 
     int err;
     if (usage & GRALLOC_USAGE_HW_FB) {
-        err = gralloc_alloc_framebuffer(dev, size, usage, pHandle);
+        err = gralloc_alloc_framebuffer(dev, size, format, usage, pHandle);
     } else {
         err = gralloc_alloc_buffer(dev, size, usage, pHandle);
     }
diff --git a/modules/input/evdev/InputDevice.cpp b/modules/input/evdev/InputDevice.cpp
index 3b72f1f..a1bce64 100644
--- a/modules/input/evdev/InputDevice.cpp
+++ b/modules/input/evdev/InputDevice.cpp
@@ -37,8 +37,6 @@
 #include "MouseInputMapper.h"
 #include "SwitchInputMapper.h"
 
-#define MSC_ANDROID_TIME_SEC  0x6
-#define MSC_ANDROID_TIME_USEC 0x7
 
 namespace android {
 
@@ -240,25 +238,6 @@
             event.value);
 #endif
 
-    if (event.type == EV_MSC) {
-        if (event.code == MSC_ANDROID_TIME_SEC) {
-            mOverrideSec = event.value;
-        } else if (event.code == MSC_ANDROID_TIME_USEC) {
-            mOverrideUsec = event.value;
-        }
-        return;
-    }
-
-    if (mOverrideSec || mOverrideUsec) {
-        event.when = s2ns(mOverrideSec) + us2ns(mOverrideUsec);
-        ALOGV("applied override time %d.%06d", mOverrideSec, mOverrideUsec);
-
-        if (event.type == EV_SYN && event.code == SYN_REPORT) {
-            mOverrideSec = 0;
-            mOverrideUsec = 0;
-        }
-    }
-
     // Bug 7291243: Add a guard in case the kernel generates timestamps
     // that appear to be far into the future because they were generated
     // using the wrong clock source.
diff --git a/modules/input/evdev/InputDevice.h b/modules/input/evdev/InputDevice.h
index 6892778..a1e9e98 100644
--- a/modules/input/evdev/InputDevice.h
+++ b/modules/input/evdev/InputDevice.h
@@ -72,9 +72,6 @@
     InputDeviceHandle* mDeviceHandle = nullptr;
     std::vector<std::unique_ptr<InputMapper>> mMappers;
     uint32_t mClasses = 0;
-
-    int32_t mOverrideSec = 0;
-    int32_t mOverrideUsec = 0;
 };
 
 /* Input device classes. */
diff --git a/modules/sensors/OWNERS b/modules/sensors/OWNERS
index 81099e8..90c2330 100644
--- a/modules/sensors/OWNERS
+++ b/modules/sensors/OWNERS
@@ -1,3 +1,3 @@
 arthuri@google.com
 bduddie@google.com
-bstack@google.com
+stange@google.com
diff --git a/modules/sensors/dynamic_sensor/Android.bp b/modules/sensors/dynamic_sensor/Android.bp
index 489cdf4..214d97c 100644
--- a/modules/sensors/dynamic_sensor/Android.bp
+++ b/modules/sensors/dynamic_sensor/Android.bp
@@ -22,8 +22,6 @@
         "-Wall",
         "-Werror",
         "-Wextra",
-        // Allow implicit fallthroughs in HidRawSensor.cpp until they are fixed.
-        "-Wno-error=implicit-fallthrough",
     ],
     export_include_dirs: ["."],
 
diff --git a/modules/sensors/dynamic_sensor/DynamicSensorManager.cpp b/modules/sensors/dynamic_sensor/DynamicSensorManager.cpp
index b634052..37b4313 100644
--- a/modules/sensors/dynamic_sensor/DynamicSensorManager.cpp
+++ b/modules/sensors/dynamic_sensor/DynamicSensorManager.cpp
@@ -111,8 +111,8 @@
     if (handle == mHandleRange.first) {
         // submit a flush complete here
         static const sensors_event_t event = {
-            .type = SENSOR_TYPE_META_DATA,
             .sensor = mHandleRange.first,
+            .type = SENSOR_TYPE_META_DATA,
             .timestamp = TIMESTAMP_AUTO_FILL,  // timestamp will be filled at dispatcher
         };
         submitEvent(nullptr, event);
diff --git a/modules/sensors/dynamic_sensor/HidRawSensor.cpp b/modules/sensors/dynamic_sensor/HidRawSensor.cpp
index 4668412..f3c8a27 100644
--- a/modules/sensors/dynamic_sensor/HidRawSensor.cpp
+++ b/modules/sensors/dynamic_sensor/HidRawSensor.cpp
@@ -177,13 +177,13 @@
                 }
 
                 ReportTranslateRecord record = {
-                    .minValue = digest.minRaw,
+                    .type = TYPE_FLOAT,
                     .maxValue = digest.maxRaw,
+                    .minValue = digest.minRaw,
                     .byteOffset = digest.bitOffset / 8,
                     .byteSize = digest.bitSize / 8,
                     .a = digest.a,
                     .b = digest.b,
-                    .type = TYPE_FLOAT
                 };
                 // keep track of range and resolution
                 range = std::max(std::max(std::abs((digest.maxRaw + digest.b) * digest.a),
@@ -250,12 +250,12 @@
     }
 
     ReportTranslateRecord record = {
-        .minValue = quat.minRaw,
+        .type = TYPE_FLOAT,
         .maxValue = quat.maxRaw,
+        .minValue = quat.minRaw,
         .byteOffset = quat.bitOffset / 8,
         .byteSize = quat.bitSize / 8,
         .b = quat.b,
-        .type = TYPE_FLOAT,
     };
 
     // Android X Y Z maps to HID X -Z Y
@@ -351,10 +351,10 @@
     mFeatureInfo.reportModeFlag = SENSOR_FLAG_CONTINUOUS_MODE;
 
     ReportTranslateRecord record = {
-        .minValue = reportX.minRaw,
+        .type = TYPE_FLOAT,
         .maxValue = reportX.maxRaw,
+        .minValue = reportX.minRaw,
         .byteSize = reportX.bitSize / 8,
-        .type = TYPE_FLOAT
     };
 
     // Reorder and swap axis
diff --git a/modules/sensors/dynamic_sensor/HidUtils/HidParser.cpp b/modules/sensors/dynamic_sensor/HidUtils/HidParser.cpp
index 5efaf65..264f13c 100644
--- a/modules/sensors/dynamic_sensor/HidUtils/HidParser.cpp
+++ b/modules/sensors/dynamic_sensor/HidUtils/HidParser.cpp
@@ -231,9 +231,9 @@
 
             // template
             ReportPacket packet = {
+                .bitSize = 0,
                 .type = type,
                 .id = id,
-                .bitSize = 0
             };
 
             for (const auto &r : reports) {
@@ -252,10 +252,10 @@
                     .maxRaw = logical.second,
                     .a = scale,
                     .b = offset,
+                    .unit = r.getUnit(),
                     .bitOffset = packet.bitSize,
                     .bitSize = r.getSize(),
                     .count = r.getCount(),
-                    .unit = r.getUnit(),
                 };
                 packet.reports.push_back(digest);
                 packet.bitSize += digest.bitSize * digest.count;
diff --git a/tests/input/evdev/InputDevice_test.cpp b/tests/input/evdev/InputDevice_test.cpp
index bd57491..8f8a94b 100644
--- a/tests/input/evdev/InputDevice_test.cpp
+++ b/tests/input/evdev/InputDevice_test.cpp
@@ -31,8 +31,6 @@
 // # of milliseconds to allow for timing measurements
 #define TIMING_TOLERANCE_MS 25
 
-#define MSC_ANDROID_TIME_SEC  0x6
-#define MSC_ANDROID_TIME_USEC 0x7
 
 using ::testing::_;
 using ::testing::NiceMock;
@@ -66,35 +64,6 @@
     NiceMock<MockInputDeviceDefinition> mDeviceDef;
 };
 
-TEST_F(EvdevDeviceTest, testOverrideTime) {
-    auto node = std::make_shared<MockInputDeviceNode>();
-    auto device = std::make_unique<EvdevDevice>(&mHost, node);
-    ASSERT_TRUE(device != nullptr);
-
-    // Send two timestamp override events before an input event.
-    nsecs_t when = 2ULL;
-    InputEvent msc1 = { when, EV_MSC, MSC_ANDROID_TIME_SEC, 1 };
-    InputEvent msc2 = { when, EV_MSC, MSC_ANDROID_TIME_USEC, 900000 };
-
-    // Send a key down and syn. Should get the overridden timestamp.
-    InputEvent keyDown = { when, EV_KEY, KEY_HOME, 1 };
-    InputEvent syn = { when, EV_SYN, SYN_REPORT, 0 };
-
-    // Send a key up, which should be at the reported timestamp.
-    InputEvent keyUp = { when, EV_KEY, KEY_HOME, 0 };
-
-    device->processInput(msc1, when);
-    device->processInput(msc2, when);
-    device->processInput(keyDown, when);
-    device->processInput(syn, when);
-    device->processInput(keyUp, when);
-
-    nsecs_t expectedWhen = s2ns(1) + us2ns(900000);
-    EXPECT_EQ(expectedWhen, keyDown.when);
-    EXPECT_EQ(expectedWhen, syn.when);
-    EXPECT_EQ(when, keyUp.when);
-}
-
 TEST_F(EvdevDeviceTest, testWrongClockCorrection) {
     auto node = std::make_shared<MockInputDeviceNode>();
     auto device = std::make_unique<EvdevDevice>(&mHost, node);
diff --git a/tests/keymaster/keymaster_test.cpp b/tests/keymaster/keymaster_test.cpp
index e6b41c7..562c8ed 100644
--- a/tests/keymaster/keymaster_test.cpp
+++ b/tests/keymaster/keymaster_test.cpp
@@ -29,6 +29,7 @@
 
 #include <openssl/bn.h>
 #include <openssl/evp.h>
+#include <openssl/pkcs8.h>
 #include <openssl/x509.h>
 
 #define LOG_TAG "keymaster_test"
@@ -158,41 +159,6 @@
     size_t mDataSize;
 };
 
-struct BIGNUM_Delete {
-    void operator()(BIGNUM* p) const {
-        BN_free(p);
-    }
-};
-typedef std::unique_ptr<BIGNUM, BIGNUM_Delete> Unique_BIGNUM;
-
-struct EVP_PKEY_Delete {
-    void operator()(EVP_PKEY* p) const {
-        EVP_PKEY_free(p);
-    }
-};
-typedef std::unique_ptr<EVP_PKEY, EVP_PKEY_Delete> Unique_EVP_PKEY;
-
-struct PKCS8_PRIV_KEY_INFO_Delete {
-    void operator()(PKCS8_PRIV_KEY_INFO* p) const {
-        PKCS8_PRIV_KEY_INFO_free(p);
-    }
-};
-typedef std::unique_ptr<PKCS8_PRIV_KEY_INFO, PKCS8_PRIV_KEY_INFO_Delete> Unique_PKCS8_PRIV_KEY_INFO;
-
-struct RSA_Delete {
-    void operator()(RSA* p) const {
-        RSA_free(p);
-    }
-};
-typedef std::unique_ptr<RSA, RSA_Delete> Unique_RSA;
-
-struct EC_KEY_Delete {
-    void operator()(EC_KEY* p) const {
-        EC_KEY_free(p);
-    }
-};
-typedef std::unique_ptr<EC_KEY, EC_KEY_Delete> Unique_EC_KEY;
-
 
 /*
  * DER-encoded PKCS#8 format RSA key. Generated using:
@@ -417,13 +383,13 @@
             << "X509 data should be allocated";
 
     const unsigned char *tmp = static_cast<const unsigned char*>(x509_blob.get());
-    Unique_EVP_PKEY actual(d2i_PUBKEY((EVP_PKEY**) NULL, &tmp,
+    bssl::UniquePtr<EVP_PKEY> actual(d2i_PUBKEY(NULL, &tmp,
             static_cast<long>(x509_blob.length())));
 
     ASSERT_EQ(EVP_PKEY_RSA, EVP_PKEY_type(actual.get()->type))
             << "Generated key type should be of type RSA";
 
-    Unique_RSA rsa(EVP_PKEY_get1_RSA(actual.get()));
+    bssl::UniquePtr<RSA> rsa(EVP_PKEY_get1_RSA(actual.get()));
     ASSERT_FALSE(rsa.get() == NULL)
             << "Should be able to extract RSA key from EVP_PKEY";
 
@@ -464,13 +430,13 @@
             << "X509 data should be allocated";
 
     const unsigned char *tmp = static_cast<const unsigned char*>(x509_blob.get());
-    Unique_EVP_PKEY actual(d2i_PUBKEY((EVP_PKEY**) NULL, &tmp,
+    bssl::UniquePtr<EVP_PKEY> actual(d2i_PUBKEY(NULL, &tmp,
             static_cast<long>(x509_blob.length())));
 
     ASSERT_EQ(EVP_PKEY_EC, EVP_PKEY_type(actual.get()->type))
             << "Generated key type should be of type EC";
 
-    Unique_EC_KEY ecKey(EVP_PKEY_get1_EC_KEY(actual.get()));
+    bssl::UniquePtr<EC_KEY> ecKey(EVP_PKEY_get1_EC_KEY(actual.get()));
     ASSERT_FALSE(ecKey.get() == NULL)
             << "Should be able to extract EC key from EVP_PKEY";
 
@@ -531,18 +497,18 @@
     UniqueBlob x509_blob(x509_data, x509_data_length);
 
     const unsigned char *tmp = static_cast<const unsigned char*>(x509_blob.get());
-    Unique_EVP_PKEY actual(d2i_PUBKEY((EVP_PKEY**) NULL, &tmp,
+    bssl::UniquePtr<EVP_PKEY> actual(d2i_PUBKEY(NULL, &tmp,
             static_cast<long>(x509_blob.length())));
 
     ASSERT_EQ(EVP_PKEY_type(actual.get()->type), EVP_PKEY_RSA)
             << "Generated key type should be of type RSA";
 
     const unsigned char *expectedTmp = static_cast<const unsigned char*>(TEST_RSA_KEY_1);
-    Unique_PKCS8_PRIV_KEY_INFO expectedPkcs8(
-            d2i_PKCS8_PRIV_KEY_INFO((PKCS8_PRIV_KEY_INFO**) NULL, &expectedTmp,
+    bssl::UniquePtr<PKCS8_PRIV_KEY_INFO> expectedPkcs8(
+            d2i_PKCS8_PRIV_KEY_INFO(NULL, &expectedTmp,
                     sizeof(TEST_RSA_KEY_1)));
 
-    Unique_EVP_PKEY expected(EVP_PKCS82PKEY(expectedPkcs8.get()));
+    bssl::UniquePtr<EVP_PKEY> expected(EVP_PKCS82PKEY(expectedPkcs8.get()));
 
     ASSERT_EQ(1, EVP_PKEY_cmp(expected.get(), actual.get()))
             << "Expected and actual keys should match";
@@ -567,18 +533,18 @@
     UniqueBlob x509_blob(x509_data, x509_data_length);
 
     const unsigned char *tmp = static_cast<const unsigned char*>(x509_blob.get());
-    Unique_EVP_PKEY actual(d2i_PUBKEY((EVP_PKEY**) NULL, &tmp,
+    bssl::UniquePtr<EVP_PKEY> actual(d2i_PUBKEY(NULL, &tmp,
             static_cast<long>(x509_blob.length())));
 
     ASSERT_EQ(EVP_PKEY_type(actual.get()->type), EVP_PKEY_EC)
             << "Generated key type should be of type EC";
 
     const unsigned char *expectedTmp = static_cast<const unsigned char*>(TEST_EC_KEY_1);
-    Unique_PKCS8_PRIV_KEY_INFO expectedPkcs8(
-            d2i_PKCS8_PRIV_KEY_INFO((PKCS8_PRIV_KEY_INFO**) NULL, &expectedTmp,
+    bssl::UniquePtr<PKCS8_PRIV_KEY_INFO> expectedPkcs8(
+            d2i_PKCS8_PRIV_KEY_INFO(NULL, &expectedTmp,
                     sizeof(TEST_EC_KEY_1)));
 
-    Unique_EVP_PKEY expected(EVP_PKCS82PKEY(expectedPkcs8.get()));
+    bssl::UniquePtr<EVP_PKEY> expected(EVP_PKCS82PKEY(expectedPkcs8.get()));
 
     ASSERT_EQ(1, EVP_PKEY_cmp(expected.get(), actual.get()))
             << "Expected and actual keys should match";
@@ -925,10 +891,10 @@
     UniqueBlob x509_blob(x509_data, x509_data_length);
 
     const unsigned char *tmp = static_cast<const unsigned char*>(x509_blob.get());
-    Unique_EVP_PKEY expected(d2i_PUBKEY((EVP_PKEY**) NULL, &tmp,
+    bssl::UniquePtr<EVP_PKEY> expected(d2i_PUBKEY(NULL, &tmp,
             static_cast<long>(x509_blob.length())));
 
-    Unique_EC_KEY ecKey(EVP_PKEY_get1_EC_KEY(expected.get()));
+    bssl::UniquePtr<EC_KEY> ecKey(EVP_PKEY_get1_EC_KEY(expected.get()));
 
     ASSERT_EQ(1, ECDSA_verify(0, testData.get(), testData.length(), sig_blob.get(), sig_blob.length(), ecKey.get()))
             << "Signature should verify";