1 /*
2  * Copyright 2020, 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 package android.system.keystore2;
18 
19 /** @hide */
20 @VintfStability
21 @Backing(type="int")
22 enum ResponseCode {
23     /* 1 Reserved - formerly NO_ERROR */
24     /**
25      * TODO Determine exact semantic of Locked and Uninitialized.
26      */
27     LOCKED = 2,
28     UNINITIALIZED = 3,
29     /**
30      * Any unexpected Error such as IO or communication errors.
31      * Implementations should log details to logcat.
32      */
33     SYSTEM_ERROR = 4,
34     /* 5 Reserved - formerly "protocol error" was never used */
35     /**
36      * Indicates that the caller does not have the permissions for the attempted request.
37      */
38     PERMISSION_DENIED = 6,
39     /**
40      * Indicates that the requested key does not exist.
41      */
42     KEY_NOT_FOUND = 7,
43     /**
44      * Indicates a data corruption in the Keystore 2.0 database.
45      */
46     VALUE_CORRUPTED = 8,
47     /*
48      * 9 Reserved - formerly "undefined action" was never used
49      * 10 Reserved - formerly WrongPassword
50      * 11 - 13 Reserved - formerly password retry count indicators: obsolete
51      *
52      * 14 Reserved - formerly SIGNATURE_INVALID: Keystore does not perform public key operations
53      *               any more
54      *
55      *
56      * 15 Reserved - Formerly OP_AUTH_NEEDED. This is now indicated by the optional
57      *               `OperationChallenge` returned by `IKeystoreSecurityLevel::create`.
58      *
59      * 16 Reserved
60      */
61     KEY_PERMANENTLY_INVALIDATED = 17,
62     /**
63      * May be returned by `IKeystoreSecurityLevel.create` if all Keymint operation slots
64      * are currently in use and none can be pruned.
65      */
66     BACKEND_BUSY = 18,
67     /**
68      * This is a logical error on the caller's side. They are trying to advance an
69      * operation, e.g., by calling `update`, that is currently processing an `update`
70      * or `finish` request.
71      */
72     OPERATION_BUSY = 19,
73     /**
74      * Indicates that an invalid argument was passed to an API call.
75      */
76     INVALID_ARGUMENT = 20,
77     /**
78      * Indicates that too much data was sent in a single transaction.
79      * The binder kernel mechanism cannot really diagnose this condition unambiguously.
80      * So in order to force benign clients into reasonable limits, we limit the maximum
81      * amount of data that we except in a single transaction to 32KiB.
82      */
83     TOO_MUCH_DATA = 21,
84 
85     /**
86      * Indicates that the attestation key pool does not have any signed attestation keys
87      * available. This can be thrown during attempts to generate a key.
88      */
89     OUT_OF_KEYS = 22,
90 }
91