Lines Matching refs:std
55 static std::mutex& g_keys_mutex = *new std::mutex;
56 static std::map<std::string, std::shared_ptr<RSA>>& g_keys =
57 *new std::map<std::string, std::shared_ptr<RSA>>;
58 static std::map<int, std::string>& g_monitored_paths = *new std::map<int, std::string>;
63 static bool generate_key(const std::string& file) { in generate_key()
71 std::string pubkey; in generate_key()
83 std::unique_ptr<FILE, decltype(&fclose)> f(nullptr, &fclose); in generate_key()
107 static std::string hash_key(RSA* key) { in hash_key()
112 return std::string(); in hash_key()
115 std::string result; in hash_key()
122 static std::shared_ptr<RSA> read_key_file(const std::string& file) { in read_key_file()
123 std::unique_ptr<FILE, decltype(&fclose)> fp(fopen(file.c_str(), "r"), fclose); in read_key_file()
137 return std::shared_ptr<RSA>(key, RSA_free); in read_key_file()
140 static bool load_key(const std::string& file) { in load_key()
141 std::shared_ptr<RSA> key = read_key_file(file); in load_key()
146 std::lock_guard<std::mutex> lock(g_keys_mutex); in load_key()
147 std::string fingerprint = hash_key(key.get()); in load_key()
150 g_keys[fingerprint] = std::move(key); in load_key()
157 static bool load_keys(const std::string& path, bool allow_dir = true) { in load_keys()
178 std::unique_ptr<DIR, decltype(&closedir)> dir(opendir(path.c_str()), closedir); in load_keys()
186 std::string name = dent->d_name; in load_keys()
203 LOG(ERROR) << "load_keys: unexpected type for '" << path << "': 0x" << std::hex << st.st_mode; in load_keys()
207 static std::string get_user_key_path() { in get_user_key_path()
212 std::string path = get_user_key_path(); in load_userkey()
230 static std::set<std::string> get_vendor_keys() { in get_vendor_keys()
233 return std::set<std::string>(); in get_vendor_keys()
236 std::set<std::string> result; in get_vendor_keys()
243 std::deque<std::shared_ptr<RSA>> adb_auth_get_private_keys() { in adb_auth_get_private_keys()
244 std::deque<std::shared_ptr<RSA>> result; in adb_auth_get_private_keys()
247 std::lock_guard<std::mutex> lock(g_keys_mutex); in adb_auth_get_private_keys()
260 static std::string adb_auth_sign(RSA* key, const char* token, size_t token_size) { in adb_auth_sign()
266 std::string result; in adb_auth_sign()
272 return std::string(); in adb_auth_sign()
281 static bool pubkey_from_privkey(std::string* out, const std::string& path) { in pubkey_from_privkey()
282 std::shared_ptr<RSA> privkey = read_key_file(path); in pubkey_from_privkey()
290 std::string path = get_user_key_path(); in adb_auth_get_user_privkey()
296 std::shared_ptr<RSA> rsa_privkey = read_key_file(path); in adb_auth_get_user_privkey()
311 std::string adb_auth_get_userkey() { in adb_auth_get_userkey()
312 std::string path = get_user_key_path(); in adb_auth_get_userkey()
318 std::string result; in adb_auth_get_userkey()
330 std::string pubkey; in adb_auth_pubkey()
368 std::string path = root_it->second; in adb_auth_inotify_update()
382 LOG(WARNING) << "unmonitored event for " << path << ": 0x" << std::hex in adb_auth_inotify_update()
391 static void adb_auth_inotify_init(const std::set<std::string>& paths) { in adb_auth_inotify_init()
400 for (const std::string& path : paths) { in adb_auth_inotify_init()
430 for (const std::string& path : key_paths) { in adb_auth_init()
438 std::string key = adb_auth_get_userkey(); in send_auth_publickey()
460 std::shared_ptr<RSA> key = t->NextKey(); in send_auth_response()
472 std::string result = adb_auth_sign(key.get(), token, token_size); in send_auth_response()
487 std::thread([t]() { in adb_auth_tls_handshake()
488 std::shared_ptr<RSA> key = t->Key(); in adb_auth_tls_handshake()
540 std::lock_guard<std::mutex> lock(g_keys_mutex); in adb_tls_set_certificate()