From df413313083a9dabdc573545aaf70343aa0830ca Mon Sep 17 00:00:00 2001 From: Stephan Hartmann Date: Wed, 27 May 2020 17:03:03 +0000 Subject: [PATCH] GCC: fix decltype to get a valid function pointer The decltype() 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(&). Bug: 819294 Change-Id: I8114c3d75c9865779d58c0b6a6c48e6affd3175b Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2217414 Reviewed-by: Adam Langley Commit-Queue: Adam Langley 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(args, to, f); +// CBBFunctionToVector(args, to, f); template std::vector CBBFunctionToVector(Args&&... args) { uint8_t* der = nullptr; @@ -102,7 +102,7 @@ } std::vector GetPKCS8PrivateKey() const override { - return CBBFunctionToVector(pkey_.get()); } @@ -122,7 +122,7 @@ std::vector GetX962PublicKey() const override { const EC_KEY* ec_key = EVP_PKEY_get0_EC_KEY(pkey_.get()); - return CBBFunctionToVector( 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 der_bytes( - CBBFunctionToVector(pkey_.get())); return std::make_unique(