Android-cuttlefish cvd tool
adb_auth.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2012 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#ifndef __ADB_AUTH_H
18#define __ADB_AUTH_H
19
20#include "adb.h"
21
22#include <deque>
23#include <memory>
24
25#include <openssl/rsa.h>
26
27/* AUTH packets first argument */
28/* Request */
29#define ADB_AUTH_TOKEN 1
30/* Response */
31#define ADB_AUTH_SIGNATURE 2
32#define ADB_AUTH_RSAPUBLICKEY 3
33
34#if ADB_HOST
35
36void adb_auth_init();
37
38int adb_auth_keygen(const char* filename);
39int adb_auth_pubkey(const char* filename);
40std::string adb_auth_get_userkey();
41bssl::UniquePtr<EVP_PKEY> adb_auth_get_user_privkey();
42std::deque<std::shared_ptr<RSA>> adb_auth_get_private_keys();
43
44void send_auth_response(const char* token, size_t token_size, atransport* t);
45
46int adb_tls_set_certificate(SSL* ssl);
48
49// Return the location where the host stores its keys
50std::string adb_auth_get_userkey_path();
51
52#else // !ADB_HOST
53
54extern bool auth_required;
55extern bool socket_access_allowed;
56
59
61bool adbd_auth_verify(const char* token, size_t token_size, const std::string& sig,
62 std::string* auth_key);
65
67
69int adbd_tls_verify_cert(X509_STORE_CTX* ctx, std::string* auth_key);
70bssl::UniquePtr<STACK_OF(X509_NAME)> adbd_tls_client_ca_list();
71
72#endif // ADB_HOST
73
74#endif // __ADB_AUTH_H
void adbd_auth_tls_handshake(atransport *t)
bool socket_access_allowed
void adbd_cloexec_auth_socket()
void adbd_auth_verified(atransport *t)
bssl::UniquePtr< STACK_OF(X509_NAME)> adbd_tls_client_ca_list()
bool adbd_auth_verify(const char *token, size_t token_size, const std::string &sig, std::string *auth_key)
int adbd_tls_verify_cert(X509_STORE_CTX *ctx, std::string *auth_key)
void adbd_auth_confirm_key(atransport *t)
void adbd_notify_framework_connected_key(atransport *t)
void send_auth_request(atransport *t)
bool auth_required
void adbd_auth_init()
std::string adb_auth_get_userkey()
Definition: auth.cpp:313
int adb_tls_set_certificate(SSL *ssl)
Definition: auth.cpp:514
void send_auth_response(const char *token, size_t token_size, atransport *t)
Definition: auth.cpp:460
int adb_auth_keygen(const char *filename)
Definition: auth.cpp:327
std::deque< std::shared_ptr< RSA > > adb_auth_get_private_keys()
Definition: auth.cpp:245
bssl::UniquePtr< EVP_PKEY > adb_auth_get_user_privkey()
Definition: auth.cpp:291
int adb_auth_pubkey(const char *filename)
Definition: auth.cpp:331
void adb_auth_init()
Definition: auth.cpp:417
void adb_auth_tls_handshake(atransport *t)
Definition: auth.cpp:487
std::string adb_auth_get_userkey_path()
Definition: auth.cpp:205
Definition: transport.h:261