From 8723cc87982825754f314b0c18910319a3ced716 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Tue, 9 Oct 2018 14:42:49 -0400 Subject: [PATCH 1/4] telemetry_session: Use a std::array in GenerateTelemetryId() We don't need to potentially heap-allocate a std::string instance here, given the data is known ahead of time. We can just place it within an array and pass this to the mbedtls functions. --- src/core/telemetry_session.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/core/telemetry_session.cpp b/src/core/telemetry_session.cpp index f29fff1e7..68edb24f5 100644 --- a/src/core/telemetry_session.cpp +++ b/src/core/telemetry_session.cpp @@ -2,6 +2,8 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. +#include + #include "common/assert.h" #include "common/common_types.h" #include "common/file_util.h" @@ -28,11 +30,11 @@ static u64 GenerateTelemetryId() { mbedtls_entropy_context entropy; mbedtls_entropy_init(&entropy); mbedtls_ctr_drbg_context ctr_drbg; - std::string personalization = "yuzu Telemetry ID"; + constexpr std::array personalization{{"yuzu Telemetry ID"}}; mbedtls_ctr_drbg_init(&ctr_drbg); ASSERT(mbedtls_ctr_drbg_seed(&ctr_drbg, mbedtls_entropy_func, &entropy, - reinterpret_cast(personalization.c_str()), + reinterpret_cast(personalization.data()), personalization.size()) == 0); ASSERT(mbedtls_ctr_drbg_random(&ctr_drbg, reinterpret_cast(&telemetry_id), sizeof(u64)) == 0); From 1964f4bbb39d1286d98893881db17f1d7d146145 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Tue, 9 Oct 2018 14:45:22 -0400 Subject: [PATCH 2/4] telemetry_session: Remove unimplemented FinalizeAsyncJob prototype This isn't implemented anywhere, so it can just be removed. --- src/core/telemetry_session.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/core/telemetry_session.h b/src/core/telemetry_session.h index cec271df0..266db434c 100644 --- a/src/core/telemetry_session.h +++ b/src/core/telemetry_session.h @@ -30,8 +30,6 @@ public: field_collection.AddField(type, name, std::move(value)); } - static void FinalizeAsyncJob(); - private: Telemetry::FieldCollection field_collection; ///< Tracks all added fields for the session std::unique_ptr backend; ///< Backend interface that logs fields From 8aa4889e76c401ab41e7fd733f77376dbcdb4def Mon Sep 17 00:00:00 2001 From: Lioncash Date: Tue, 9 Oct 2018 14:47:24 -0400 Subject: [PATCH 3/4] telemetry_session: Add missing includes Prevents potential compilation issues in the future by including missing headers for certain functions and types. --- src/core/telemetry_session.cpp | 6 ++++-- src/core/telemetry_session.h | 1 + 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/core/telemetry_session.cpp b/src/core/telemetry_session.cpp index 68edb24f5..7b04792b5 100644 --- a/src/core/telemetry_session.cpp +++ b/src/core/telemetry_session.cpp @@ -4,12 +4,14 @@ #include +#include +#include + #include "common/assert.h" #include "common/common_types.h" #include "common/file_util.h" +#include "common/logging/log.h" -#include -#include #include "core/core.h" #include "core/file_sys/control_metadata.h" #include "core/file_sys/patch_manager.h" diff --git a/src/core/telemetry_session.h b/src/core/telemetry_session.h index 266db434c..3438acd29 100644 --- a/src/core/telemetry_session.h +++ b/src/core/telemetry_session.h @@ -5,6 +5,7 @@ #pragma once #include +#include #include "common/telemetry.h" namespace Core { From e3b4d31f4ec689b1e4b16db124fb64dfc122ca07 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Tue, 9 Oct 2018 14:49:15 -0400 Subject: [PATCH 4/4] telemetry_session: Remove doxygen comment for a non-existent parameter There's no "func" parameter, so this can just be removed. --- src/core/telemetry_session.h | 1 - 1 file changed, 1 deletion(-) diff --git a/src/core/telemetry_session.h b/src/core/telemetry_session.h index 3438acd29..2a4845797 100644 --- a/src/core/telemetry_session.h +++ b/src/core/telemetry_session.h @@ -52,7 +52,6 @@ u64 RegenerateTelemetryId(); * Verifies the username and token. * @param username yuzu username to use for authentication. * @param token yuzu token to use for authentication. - * @param func A function that gets exectued when the verification is finished * @returns Future with bool indicating whether the verification succeeded */ bool VerifyLogin(const std::string& username, const std::string& token);