diff options
author | Sergey Yershov <syershov@maps.me> | 2016-11-16 17:23:55 +0300 |
---|---|---|
committer | Sergey Yershov <syershov@maps.me> | 2016-11-17 13:27:23 +0300 |
commit | d9e4a1b1a28fc888ca0b1a333c6a1b49a52fb6ce (patch) | |
tree | 31a563d73b7562082b4f26e2b2ed05e70ccc0a18 /platform | |
parent | 19600faf61beb3a36b02ccb458eaffa0a39edb17 (diff) |
Remove dependencies on tomcrypt
Diffstat (limited to 'platform')
-rw-r--r-- | platform/platform.cpp | 14 | ||||
-rw-r--r-- | platform/platform.hpp | 3 | ||||
-rw-r--r-- | platform/platform_mac.mm | 13 | ||||
-rw-r--r-- | platform/platform_tests/platform_tests.pro | 4 |
4 files changed, 5 insertions, 29 deletions
diff --git a/platform/platform.cpp b/platform/platform.cpp index 2e70593165..be5ba1e6a4 100644 --- a/platform/platform.cpp +++ b/platform/platform.cpp @@ -4,7 +4,6 @@ #include "coding/base64.hpp" #include "coding/file_name_utils.hpp" #include "coding/internal/file_data.hpp" -#include "coding/sha2.hpp" #include "coding/writer.hpp" #include "base/logging.hpp" @@ -117,19 +116,6 @@ string Platform::ReadPathForFile(string const & file, string searchScope) const "Have been looking in:\n", possiblePaths)); } -string Platform::HashUniqueID(string const & s) -{ - // generate sha2 hash for UUID - string const hash = sha2::digest256(s, false); - // xor it - size_t const offset = hash.size() / 4; - string xoredHash; - for (size_t i = 0; i < offset; ++i) - xoredHash.push_back(hash[i] ^ hash[i + offset] ^ hash[i + offset * 2] ^ hash[i + offset * 3]); - // and use base64 encoding - return base64_for_user_ids::encode(xoredHash); -} - string Platform::ResourcesMetaServerUrl() const { return RESOURCES_METASERVER_URL; diff --git a/platform/platform.hpp b/platform/platform.hpp index 73323df51b..b5c1085428 100644 --- a/platform/platform.hpp +++ b/platform/platform.hpp @@ -82,9 +82,6 @@ protected: /// Uses m_writeableDir [w], m_resourcesDir [r], m_settingsDir [s]. string ReadPathForFile(string const & file, string searchScope = string()) const; - /// Hash some unique string into uniform format. - static string HashUniqueID(string const & s); - /// Returns last system call error as EError. static EError ErrnoToError(); diff --git a/platform/platform_mac.mm b/platform/platform_mac.mm index 4041d0fa90..02af7a74fc 100644 --- a/platform/platform_mac.mm +++ b/platform/platform_mac.mm @@ -4,6 +4,8 @@ #include "std/target_os.hpp" +#import "3party/Alohalytics/src/alohalytics_objc.h" + #include <IOKit/IOKitLib.h> #include <Foundation/NSBundle.h> #include <Foundation/NSPathUtilities.h> @@ -78,16 +80,7 @@ Platform::Platform() LOG(LDEBUG, ("Settings Directory:", m_settingsDir)); } -string Platform::UniqueClientId() const -{ - io_registry_entry_t ioRegistryRoot = IORegistryEntryFromPath(kIOMasterPortDefault, "IOService:/"); - CFStringRef uuidCf = (CFStringRef) IORegistryEntryCreateCFProperty(ioRegistryRoot, CFSTR(kIOPlatformUUIDKey), kCFAllocatorDefault, 0); - IOObjectRelease(ioRegistryRoot); - char uidBuf[513]; - CFStringGetCString(uuidCf, uidBuf, ARRAY_SIZE(uidBuf) - 1, kCFStringEncodingUTF8); - CFRelease(uuidCf); - return HashUniqueID(uidBuf); -} +string Platform::UniqueClientId() const { return [Alohalytics installationId].UTF8String; } static void PerformImpl(void * obj) { diff --git a/platform/platform_tests/platform_tests.pro b/platform/platform_tests/platform_tests.pro index af6ffa5709..5aa3be9948 100644 --- a/platform/platform_tests/platform_tests.pro +++ b/platform/platform_tests/platform_tests.pro @@ -4,7 +4,7 @@ CONFIG -= app_bundle TEMPLATE = app ROOT_DIR = ../.. -DEPENDENCIES = platform_tests_support platform coding base minizip tomcrypt jansson +DEPENDENCIES = platform_tests_support platform coding base minizip jansson stats_client include($$ROOT_DIR/common.pri) @@ -16,7 +16,7 @@ QT *= core macx-* { QT *= gui widgets # needed for QApplication with event loop, to test async events (downloader, etc.) - LIBS *= "-framework IOKit" "-framework QuartzCore" + LIBS *= "-framework IOKit" "-framework QuartzCore" "-framework Cocoa" "-framework SystemConfiguration" } win32*|linux* { QT *= network |