diff options
author | fearlessTobi <thm.frey@gmail.com> | 2018-09-17 17:16:01 +0200 |
---|---|---|
committer | fearlessTobi <thm.frey@gmail.com> | 2018-10-02 15:30:48 +0200 |
commit | b4ace6ec6f86079b3bd297f95dfe133240b53e15 (patch) | |
tree | efbbacb734024ad2b0be5980bf67f553976c2c11 /src/core | |
parent | Port web_service from Citra (diff) | |
download | yuzu-b4ace6ec6f86079b3bd297f95dfe133240b53e15.tar yuzu-b4ace6ec6f86079b3bd297f95dfe133240b53e15.tar.gz yuzu-b4ace6ec6f86079b3bd297f95dfe133240b53e15.tar.bz2 yuzu-b4ace6ec6f86079b3bd297f95dfe133240b53e15.tar.lz yuzu-b4ace6ec6f86079b3bd297f95dfe133240b53e15.tar.xz yuzu-b4ace6ec6f86079b3bd297f95dfe133240b53e15.tar.zst yuzu-b4ace6ec6f86079b3bd297f95dfe133240b53e15.zip |
Diffstat (limited to '')
-rw-r--r-- | src/core/telemetry_session.cpp | 11 | ||||
-rw-r--r-- | src/core/telemetry_session.h | 2 |
2 files changed, 7 insertions, 6 deletions
diff --git a/src/core/telemetry_session.cpp b/src/core/telemetry_session.cpp index 09c85297a..c02188adc 100644 --- a/src/core/telemetry_session.cpp +++ b/src/core/telemetry_session.cpp @@ -28,11 +28,12 @@ static u64 GenerateTelemetryId() { mbedtls_entropy_context entropy; mbedtls_entropy_init(&entropy); mbedtls_ctr_drbg_context ctr_drbg; - const char* personalization = "yuzu Telemetry ID"; + std::string personalization = "yuzu Telemetry ID"; mbedtls_ctr_drbg_init(&ctr_drbg); - mbedtls_ctr_drbg_seed(&ctr_drbg, mbedtls_entropy_func, &entropy, - (const unsigned char*)personalization, strlen(personalization)); + ASSERT(mbedtls_ctr_drbg_seed(&ctr_drbg, mbedtls_entropy_func, &entropy, + reinterpret_cast<const unsigned char*>(personalization.c_str()), + personalization.size()) == 0) ASSERT(mbedtls_ctr_drbg_random(&ctr_drbg, reinterpret_cast<unsigned char*>(&telemetry_id), sizeof(u64)) == 0); @@ -88,7 +89,7 @@ u64 RegenerateTelemetryId() { return new_telemetry_id; } -bool VerifyLogin(std::string username, std::string token) { +bool VerifyLogin(const std::string& username, const std::string& token) { #ifdef ENABLE_WEB_SERVICE return WebService::VerifyLogin(Settings::values.web_api_url, username, token); #else @@ -120,7 +121,7 @@ TelemetrySession::TelemetrySession() { u64 program_id{}; const Loader::ResultStatus res{System::GetInstance().GetAppLoader().ReadProgramId(program_id)}; if (res == Loader::ResultStatus::Success) { - std::string formatted_program_id{fmt::format("{:016X}", program_id)}; + const std::string formatted_program_id{fmt::format("{:016X}", program_id)}; AddField(Telemetry::FieldType::Session, "ProgramId", formatted_program_id); std::string name; diff --git a/src/core/telemetry_session.h b/src/core/telemetry_session.h index e6976ad45..cec271df0 100644 --- a/src/core/telemetry_session.h +++ b/src/core/telemetry_session.h @@ -56,6 +56,6 @@ u64 RegenerateTelemetryId(); * @param func A function that gets exectued when the verification is finished * @returns Future with bool indicating whether the verification succeeded */ -bool VerifyLogin(std::string username, std::string token); +bool VerifyLogin(const std::string& username, const std::string& token); } // namespace Core |