system/hardware/interfaces
Révision | 520212559613514b95313488b644b6570a634c35 (tree) |
---|---|
l'heure | 2017-11-19 17:38:52 |
Auteur | android-build-team Robot <android-build-team-robot@goog...> |
Commiter | android-build-team Robot |
Snap for 4459973 from 7ebf2fb767add88b679dde17ba730319037b755d to pi-release
Change-Id: Ibe50f3cf1c6115852d76a481d6e21d9b3017e356
@@ -5,7 +5,7 @@ | ||
5 | 5 | #include <hidl/MQDescriptor.h> |
6 | 6 | #include <hidl/Status.h> |
7 | 7 | |
8 | -#include <keystore/IKeystoreService.h> | |
8 | +#include <android/security/IKeystoreService.h> | |
9 | 9 | #include <binder/IServiceManager.h> |
10 | 10 | |
11 | 11 | namespace android { |
@@ -1,8 +1,9 @@ | ||
1 | 1 | #include <android-base/logging.h> |
2 | +#include <android/security/IKeystoreService.h> | |
2 | 3 | #include <binder/IServiceManager.h> |
3 | -#include <keystore/IKeystoreService.h> | |
4 | 4 | #include <private/android_filesystem_config.h> |
5 | 5 | |
6 | +#include <vector> | |
6 | 7 | #include "include/wifikeystorehal/keystore.h" |
7 | 8 | |
8 | 9 | namespace android { |
@@ -11,63 +12,61 @@ namespace wifi { | ||
11 | 12 | namespace keystore { |
12 | 13 | namespace V1_0 { |
13 | 14 | namespace implementation { |
15 | + | |
16 | +using security::IKeystoreService; | |
14 | 17 | // Methods from ::android::hardware::wifi::keystore::V1_0::IKeystore follow. |
15 | 18 | Return<void> Keystore::getBlob(const hidl_string& key, getBlob_cb _hidl_cb) { |
16 | - sp<IKeystoreService> service = interface_cast<IKeystoreService>( | |
17 | - defaultServiceManager()->getService( | |
18 | - String16("android.security.keystore"))); | |
19 | - if (service == nullptr) { | |
20 | - _hidl_cb(KeystoreStatusCode::ERROR_UNKNOWN, {}); | |
21 | - return Void(); | |
22 | - } | |
23 | - hidl_vec<uint8_t> value; | |
24 | - // Retrieve the blob as wifi user. | |
25 | - auto ret = service->get(String16(key.c_str()), AID_WIFI, &value); | |
26 | - if (!ret.isOk()) { | |
27 | - _hidl_cb(KeystoreStatusCode::ERROR_UNKNOWN, {}); | |
19 | + sp<IKeystoreService> service = interface_cast<IKeystoreService>( | |
20 | + defaultServiceManager()->getService(String16("android.security.keystore"))); | |
21 | + if (service == nullptr) { | |
22 | + _hidl_cb(KeystoreStatusCode::ERROR_UNKNOWN, {}); | |
23 | + return Void(); | |
24 | + } | |
25 | + ::std::vector<uint8_t> value; | |
26 | + // Retrieve the blob as wifi user. | |
27 | + auto ret = service->get(String16(key.c_str()), AID_WIFI, &value); | |
28 | + if (!ret.isOk()) { | |
29 | + _hidl_cb(KeystoreStatusCode::ERROR_UNKNOWN, {}); | |
30 | + return Void(); | |
31 | + } | |
32 | + _hidl_cb(KeystoreStatusCode::SUCCESS, (hidl_vec<uint8_t>)value); | |
28 | 33 | return Void(); |
29 | - } | |
30 | - _hidl_cb(KeystoreStatusCode::SUCCESS, value); | |
31 | - return Void(); | |
32 | 34 | } |
33 | 35 | |
34 | -Return<void> Keystore::getPublicKey( | |
35 | - const hidl_string& keyId, getPublicKey_cb _hidl_cb) { | |
36 | - sp<IKeystoreService> service = interface_cast<IKeystoreService>( | |
37 | - defaultServiceManager()->getService( | |
38 | - String16("android.security.keystore"))); | |
39 | - if (service == nullptr) { | |
40 | - _hidl_cb(KeystoreStatusCode::ERROR_UNKNOWN, {}); | |
41 | - return Void(); | |
42 | - } | |
43 | - hidl_vec<uint8_t> pubkey; | |
44 | - auto ret = service->get_pubkey(String16(keyId.c_str()), &pubkey); | |
45 | - if (!ret.isOk()) { | |
46 | - _hidl_cb(KeystoreStatusCode::ERROR_UNKNOWN, {}); | |
36 | +Return<void> Keystore::getPublicKey(const hidl_string& keyId, getPublicKey_cb _hidl_cb) { | |
37 | + sp<IKeystoreService> service = interface_cast<IKeystoreService>( | |
38 | + defaultServiceManager()->getService(String16("android.security.keystore"))); | |
39 | + if (service == nullptr) { | |
40 | + _hidl_cb(KeystoreStatusCode::ERROR_UNKNOWN, {}); | |
41 | + return Void(); | |
42 | + } | |
43 | + ::std::vector<uint8_t> pubkey; | |
44 | + auto ret = service->get_pubkey(String16(keyId.c_str()), &pubkey); | |
45 | + if (!ret.isOk()) { | |
46 | + _hidl_cb(KeystoreStatusCode::ERROR_UNKNOWN, {}); | |
47 | + return Void(); | |
48 | + } | |
49 | + _hidl_cb(KeystoreStatusCode::SUCCESS, (hidl_vec<uint8_t>)pubkey); | |
47 | 50 | return Void(); |
48 | - } | |
49 | - _hidl_cb(KeystoreStatusCode::SUCCESS, pubkey); | |
50 | - return Void(); | |
51 | 51 | } |
52 | 52 | |
53 | -Return<void> Keystore::sign( | |
54 | - const hidl_string& keyId, const hidl_vec<uint8_t>& dataToSign, | |
55 | - sign_cb _hidl_cb) { | |
56 | - sp<IKeystoreService> service = interface_cast<IKeystoreService>( | |
57 | - defaultServiceManager()->getService( | |
58 | - String16("android.security.keystore"))); | |
59 | - if (service == nullptr) { | |
60 | - _hidl_cb(KeystoreStatusCode::ERROR_UNKNOWN, {}); | |
61 | - return Void(); | |
62 | - } | |
63 | - hidl_vec<uint8_t> signedData; | |
64 | - auto ret = service->sign(String16(keyId.c_str()), dataToSign, &signedData); | |
65 | - if (!ret.isOk()) { | |
66 | - _hidl_cb(KeystoreStatusCode::ERROR_UNKNOWN, {}); | |
53 | +Return<void> Keystore::sign(const hidl_string& keyId, const hidl_vec<uint8_t>& dataToSign, | |
54 | + sign_cb _hidl_cb) { | |
55 | + sp<IKeystoreService> service = interface_cast<IKeystoreService>( | |
56 | + defaultServiceManager()->getService(String16("android.security.keystore"))); | |
57 | + if (service == nullptr) { | |
58 | + _hidl_cb(KeystoreStatusCode::ERROR_UNKNOWN, {}); | |
59 | + return Void(); | |
60 | + } | |
61 | + ::std::vector<uint8_t> signedData; | |
62 | + | |
63 | + auto ret = service->sign(String16(keyId.c_str()), dataToSign, &signedData); | |
64 | + if (!ret.isOk()) { | |
65 | + _hidl_cb(KeystoreStatusCode::ERROR_UNKNOWN, {}); | |
66 | + return Void(); | |
67 | + } | |
68 | + _hidl_cb(KeystoreStatusCode::SUCCESS, (hidl_vec<uint8_t>)signedData); | |
67 | 69 | return Void(); |
68 | - } | |
69 | - _hidl_cb(KeystoreStatusCode::SUCCESS, signedData); | |
70 | - return Void(); | |
71 | 70 | } |
72 | 71 | |
73 | 72 | IKeystore* HIDL_FETCH_IKeystore(const char* /* name */) { |