You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
chromium/chromium-84-fix-decltype.patch

66 lines
2.7 KiB

4 years ago
From df413313083a9dabdc573545aaf70343aa0830ca Mon Sep 17 00:00:00 2001
From: Stephan Hartmann <stha09@googlemail.com>
Date: Wed, 27 May 2020 17:03:03 +0000
Subject: [PATCH] GCC: fix decltype to get a valid function pointer
The decltype(<func>) passed as template parameter to
CBBFunctionToVector does not return a function pointer
and GCC complains like this:
../../device/fido/virtual_fido_device.cc:104:68: error:
'int(struct cbb_st*, const struct evp_pkey_st*)' is not a valid type
for a template non-type parameter
104 | EVP_marshal_private_key>(pkey_.get());
| ^
Fix this by passing decltype(&<func>).
Bug: 819294
Change-Id: I8114c3d75c9865779d58c0b6a6c48e6affd3175b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2217414
Reviewed-by: Adam Langley <agl@chromium.org>
Commit-Queue: Adam Langley <agl@chromium.org>
Cr-Commit-Position: refs/heads/master@{#772283}
---
diff --git a/device/fido/virtual_fido_device.cc b/device/fido/virtual_fido_device.cc
index 0256c6a..72423d3 100644
--- a/device/fido/virtual_fido_device.cc
+++ b/device/fido/virtual_fido_device.cc
@@ -51,7 +51,7 @@
// CBBFunctionToVector converts a BoringSSL function that writes to a CBB to one
// that returns a std::vector. Invoke for a function, f, with:
-// CBBFunctionToVector<decltype(f), f>(args, to, f);
+// CBBFunctionToVector<decltype(&f), f>(args, to, f);
template <typename F, F function, typename... Args>
std::vector<uint8_t> CBBFunctionToVector(Args&&... args) {
uint8_t* der = nullptr;
@@ -102,7 +102,7 @@
}
std::vector<uint8_t> GetPKCS8PrivateKey() const override {
- return CBBFunctionToVector<decltype(EVP_marshal_private_key),
+ return CBBFunctionToVector<decltype(&EVP_marshal_private_key),
EVP_marshal_private_key>(pkey_.get());
}
@@ -122,7 +122,7 @@
std::vector<uint8_t> GetX962PublicKey() const override {
const EC_KEY* ec_key = EVP_PKEY_get0_EC_KEY(pkey_.get());
- return CBBFunctionToVector<decltype(EC_POINT_point2cbb),
+ return CBBFunctionToVector<decltype(&EC_POINT_point2cbb),
EC_POINT_point2cbb>(
EC_KEY_get0_group(ec_key), EC_KEY_get0_public_key(ec_key),
POINT_CONVERSION_UNCOMPRESSED, /*ctx=*/nullptr);
@@ -172,7 +172,7 @@
cbor::Writer::Write(cbor::Value(std::move(map))));
std::vector<uint8_t> der_bytes(
- CBBFunctionToVector<decltype(EVP_marshal_public_key),
+ CBBFunctionToVector<decltype(&EVP_marshal_public_key),
EVP_marshal_public_key>(pkey_.get()));
return std::make_unique<PublicKey>(