summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar bunnei2018-10-09 16:56:56 -0400
committerGravatar GitHub2018-10-09 16:56:56 -0400
commit89939be9e6c455f851978eb27d3ecb201c0f32be (patch)
treebb00ae611ae39a09f03e154040613b92c35460c9 /src
parentMerge pull request #1462 from lioncash/move (diff)
parenttelemetry_session: Remove doxygen comment for a non-existent parameter (diff)
downloadyuzu-89939be9e6c455f851978eb27d3ecb201c0f32be.tar.gz
yuzu-89939be9e6c455f851978eb27d3ecb201c0f32be.tar.xz
yuzu-89939be9e6c455f851978eb27d3ecb201c0f32be.zip
Merge pull request #1465 from lioncash/telemetry
telemetry_session: Minor miscellaneous changes
Diffstat (limited to 'src')
-rw-r--r--src/core/telemetry_session.cpp12
-rw-r--r--src/core/telemetry_session.h4
2 files changed, 9 insertions, 7 deletions
diff --git a/src/core/telemetry_session.cpp b/src/core/telemetry_session.cpp
index f29fff1e7..7b04792b5 100644
--- a/src/core/telemetry_session.cpp
+++ b/src/core/telemetry_session.cpp
@@ -2,12 +2,16 @@
2// Licensed under GPLv2 or any later version 2// Licensed under GPLv2 or any later version
3// Refer to the license.txt file included. 3// Refer to the license.txt file included.
4 4
5#include <array>
6
7#include <mbedtls/ctr_drbg.h>
8#include <mbedtls/entropy.h>
9
5#include "common/assert.h" 10#include "common/assert.h"
6#include "common/common_types.h" 11#include "common/common_types.h"
7#include "common/file_util.h" 12#include "common/file_util.h"
13#include "common/logging/log.h"
8 14
9#include <mbedtls/ctr_drbg.h>
10#include <mbedtls/entropy.h>
11#include "core/core.h" 15#include "core/core.h"
12#include "core/file_sys/control_metadata.h" 16#include "core/file_sys/control_metadata.h"
13#include "core/file_sys/patch_manager.h" 17#include "core/file_sys/patch_manager.h"
@@ -28,11 +32,11 @@ static u64 GenerateTelemetryId() {
28 mbedtls_entropy_context entropy; 32 mbedtls_entropy_context entropy;
29 mbedtls_entropy_init(&entropy); 33 mbedtls_entropy_init(&entropy);
30 mbedtls_ctr_drbg_context ctr_drbg; 34 mbedtls_ctr_drbg_context ctr_drbg;
31 std::string personalization = "yuzu Telemetry ID"; 35 constexpr std::array<char, 18> personalization{{"yuzu Telemetry ID"}};
32 36
33 mbedtls_ctr_drbg_init(&ctr_drbg); 37 mbedtls_ctr_drbg_init(&ctr_drbg);
34 ASSERT(mbedtls_ctr_drbg_seed(&ctr_drbg, mbedtls_entropy_func, &entropy, 38 ASSERT(mbedtls_ctr_drbg_seed(&ctr_drbg, mbedtls_entropy_func, &entropy,
35 reinterpret_cast<const unsigned char*>(personalization.c_str()), 39 reinterpret_cast<const unsigned char*>(personalization.data()),
36 personalization.size()) == 0); 40 personalization.size()) == 0);
37 ASSERT(mbedtls_ctr_drbg_random(&ctr_drbg, reinterpret_cast<unsigned char*>(&telemetry_id), 41 ASSERT(mbedtls_ctr_drbg_random(&ctr_drbg, reinterpret_cast<unsigned char*>(&telemetry_id),
38 sizeof(u64)) == 0); 42 sizeof(u64)) == 0);
diff --git a/src/core/telemetry_session.h b/src/core/telemetry_session.h
index cec271df0..2a4845797 100644
--- a/src/core/telemetry_session.h
+++ b/src/core/telemetry_session.h
@@ -5,6 +5,7 @@
5#pragma once 5#pragma once
6 6
7#include <memory> 7#include <memory>
8#include <string>
8#include "common/telemetry.h" 9#include "common/telemetry.h"
9 10
10namespace Core { 11namespace Core {
@@ -30,8 +31,6 @@ public:
30 field_collection.AddField(type, name, std::move(value)); 31 field_collection.AddField(type, name, std::move(value));
31 } 32 }
32 33
33 static void FinalizeAsyncJob();
34
35private: 34private:
36 Telemetry::FieldCollection field_collection; ///< Tracks all added fields for the session 35 Telemetry::FieldCollection field_collection; ///< Tracks all added fields for the session
37 std::unique_ptr<Telemetry::VisitorInterface> backend; ///< Backend interface that logs fields 36 std::unique_ptr<Telemetry::VisitorInterface> backend; ///< Backend interface that logs fields
@@ -53,7 +52,6 @@ u64 RegenerateTelemetryId();
53 * Verifies the username and token. 52 * Verifies the username and token.
54 * @param username yuzu username to use for authentication. 53 * @param username yuzu username to use for authentication.
55 * @param token yuzu token to use for authentication. 54 * @param token yuzu token to use for authentication.
56 * @param func A function that gets exectued when the verification is finished
57 * @returns Future with bool indicating whether the verification succeeded 55 * @returns Future with bool indicating whether the verification succeeded
58 */ 56 */
59bool VerifyLogin(const std::string& username, const std::string& token); 57bool VerifyLogin(const std::string& username, const std::string& token);