blob: 10b1b4310bf669c62bdba1a6bf577b55cd419405 [file] [log] [blame]
Andres Morales2d08dce2015-04-03 16:40:15 -07001/*
2 * Copyright (C) 2015 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 IGATEKEEPER_SERVICE_H_
18#define IGATEKEEPER_SERVICE_H_
19
20#include <binder/IInterface.h>
21#include <binder/Parcel.h>
22
23namespace android {
24
25/*
26 * This must be kept manually in sync with frameworks/base's IGateKeeperService.aidl
27 */
28class IGateKeeperService : public IInterface {
29public:
30 enum {
31 ENROLL = IBinder::FIRST_CALL_TRANSACTION + 0,
32 VERIFY = IBinder::FIRST_CALL_TRANSACTION + 1,
Andres Moralesc828ae82015-04-10 21:03:07 -070033 VERIFY_CHALLENGE = IBinder::FIRST_CALL_TRANSACTION + 2,
Andres Morales2d08dce2015-04-03 16:40:15 -070034 };
35
36 // DECLARE_META_INTERFACE - C++ client interface not needed
37 static const android::String16 descriptor;
38 virtual const android::String16& getInterfaceDescriptor() const;
39 IGateKeeperService() {}
40 virtual ~IGateKeeperService() {}
41
42 /**
43 * Enrolls a password with the GateKeeper. Returns 0 on success, negative on failure.
44 */
45 virtual status_t enroll(uint32_t uid,
46 const uint8_t *current_password_handle, uint32_t current_password_handle_length,
47 const uint8_t *current_password, uint32_t current_password_length,
48 const uint8_t *desired_password, uint32_t desired_password_length,
49 uint8_t **enrolled_password_handle, uint32_t *enrolled_password_handle_length) = 0;
50
51 /**
52 * Verifies a password previously enrolled with the GateKeeper.
53 * Returns 0 on success, negative on failure.
54 */
Andres Moralesc828ae82015-04-10 21:03:07 -070055 virtual status_t verify(uint32_t uid, const uint8_t *enrolled_password_handle,
56 uint32_t enrolled_password_handle_length,
Andres Morales2d08dce2015-04-03 16:40:15 -070057 const uint8_t *provided_password, uint32_t provided_password_length) = 0;
Andres Moralesc828ae82015-04-10 21:03:07 -070058
59 /**
60 * Verifies a password previously enrolled with the GateKeeper.
61 * Returns 0 on success, negative on failure.
62 */
63 virtual status_t verifyChallenge(uint32_t uid, uint64_t challenge,
64 const uint8_t *enrolled_password_handle, uint32_t enrolled_password_handle_length,
65 const uint8_t *provided_password, uint32_t provided_password_length,
66 uint8_t **auth_token, uint32_t *auth_token_length) = 0;
Andres Morales2d08dce2015-04-03 16:40:15 -070067};
68
69// ----------------------------------------------------------------------------
70
71class BnGateKeeperService: public BnInterface<IGateKeeperService> {
72public:
73 virtual status_t onTransact(uint32_t code, const Parcel& data, Parcel* reply,
74 uint32_t flags = 0);
75};
76
77} // namespace android
78
79#endif
80