Security: Provide generated java sources.

Enable generation of java sources for AIDL interfaces. This allows
enabling the @SensitiveData annotation without causing circular build
dependencies.

Also mark doc comments as @hide to prevent the interface from being
included in the SDK.

Bug: 174857732
Test: N/A
Change-Id: If00e4dfc24bf776f87c7e2b2e3f42350aa4d4379
This commit is contained in:
Janis Danisevskis 2021-03-17 10:55:10 -07:00
parent 134b2af917
commit 65aa12e1f2
66 changed files with 104 additions and 11 deletions

View file

@ -19,7 +19,8 @@ aidl_interface {
stability: "vintf",
backend: {
java: {
sdk_version: "module_current",
platform_apis: true,
srcs_available: true,
},
ndk: {
vndk: {

View file

@ -32,6 +32,7 @@
// later when a module using the interface is updated, e.g., Mainline modules.
package android.hardware.security.keymint;
/* @hide */
@Backing(type="int") @VintfStability
enum Algorithm {
RSA = 1,

View file

@ -32,6 +32,7 @@
// later when a module using the interface is updated, e.g., Mainline modules.
package android.hardware.security.keymint;
/* @hide */
@RustDerive(Clone=true, Eq=true, Hash=true, Ord=true, PartialEq=true, PartialOrd=true) @VintfStability
parcelable AttestationKey {
byte[] keyBlob;

View file

@ -32,6 +32,7 @@
// later when a module using the interface is updated, e.g., Mainline modules.
package android.hardware.security.keymint;
/* @hide */
@VintfStability
parcelable BeginResult {
long challenge;

View file

@ -32,6 +32,7 @@
// later when a module using the interface is updated, e.g., Mainline modules.
package android.hardware.security.keymint;
/* @hide */
@Backing(type="int") @VintfStability
enum BlockMode {
ECB = 1,

View file

@ -32,6 +32,7 @@
// later when a module using the interface is updated, e.g., Mainline modules.
package android.hardware.security.keymint;
/* @hide */
@VintfStability
parcelable Certificate {
byte[] encodedCertificate;

View file

@ -32,6 +32,7 @@
// later when a module using the interface is updated, e.g., Mainline modules.
package android.hardware.security.keymint;
/* @hide */
@Backing(type="int") @VintfStability
enum Digest {
NONE = 0,

View file

@ -32,6 +32,7 @@
// later when a module using the interface is updated, e.g., Mainline modules.
package android.hardware.security.keymint;
/* @hide */
@Backing(type="int") @VintfStability
enum EcCurve {
P_224 = 0,

View file

@ -32,6 +32,7 @@
// later when a module using the interface is updated, e.g., Mainline modules.
package android.hardware.security.keymint;
/* @hide */
@Backing(type="int") @VintfStability
enum ErrorCode {
OK = 0,

View file

@ -32,6 +32,7 @@
// later when a module using the interface is updated, e.g., Mainline modules.
package android.hardware.security.keymint;
/* @hide */
@RustDerive(Clone=true, Eq=true, Hash=true, Ord=true, PartialEq=true, PartialOrd=true) @VintfStability
parcelable HardwareAuthToken {
long challenge;

View file

@ -32,6 +32,7 @@
// later when a module using the interface is updated, e.g., Mainline modules.
package android.hardware.security.keymint;
/* @hide */
@Backing(type="int") @VintfStability
enum HardwareAuthenticatorType {
NONE = 0,

View file

@ -32,6 +32,7 @@
// later when a module using the interface is updated, e.g., Mainline modules.
package android.hardware.security.keymint;
/* @hide */
@VintfStability
interface IKeyMintDevice {
android.hardware.security.keymint.KeyMintHardwareInfo getHardwareInfo();

View file

@ -32,6 +32,7 @@
// later when a module using the interface is updated, e.g., Mainline modules.
package android.hardware.security.keymint;
/* @hide */
@VintfStability
interface IKeyMintOperation {
void updateAad(in byte[] input, in @nullable android.hardware.security.keymint.HardwareAuthToken authToken, in @nullable android.hardware.security.secureclock.TimeStampToken timeStampToken);

View file

@ -32,6 +32,7 @@
// later when a module using the interface is updated, e.g., Mainline modules.
package android.hardware.security.keymint;
/* @hide */
@VintfStability
interface IRemotelyProvisionedComponent {
byte[] generateEcdsaP256KeyPair(in boolean testMode, out android.hardware.security.keymint.MacedPublicKey macedPublicKey);

View file

@ -32,6 +32,7 @@
// later when a module using the interface is updated, e.g., Mainline modules.
package android.hardware.security.keymint;
/* @hide */
@VintfStability
parcelable KeyCharacteristics {
android.hardware.security.keymint.SecurityLevel securityLevel = android.hardware.security.keymint.SecurityLevel.SOFTWARE;

View file

@ -32,6 +32,7 @@
// later when a module using the interface is updated, e.g., Mainline modules.
package android.hardware.security.keymint;
/* @hide */
@VintfStability
parcelable KeyCreationResult {
byte[] keyBlob;

View file

@ -32,6 +32,7 @@
// later when a module using the interface is updated, e.g., Mainline modules.
package android.hardware.security.keymint;
/* @hide */
@Backing(type="int") @VintfStability
enum KeyFormat {
X509 = 0,

View file

@ -32,6 +32,7 @@
// later when a module using the interface is updated, e.g., Mainline modules.
package android.hardware.security.keymint;
/* @hide */
@RustDerive(Clone=true, Eq=true, Hash=true, Ord=true, PartialEq=true, PartialOrd=true) @VintfStability
parcelable KeyMintHardwareInfo {
int versionNumber;

View file

@ -32,6 +32,7 @@
// later when a module using the interface is updated, e.g., Mainline modules.
package android.hardware.security.keymint;
/* @hide */
@Backing(type="int") @VintfStability
enum KeyOrigin {
GENERATED = 0,

View file

@ -32,6 +32,7 @@
// later when a module using the interface is updated, e.g., Mainline modules.
package android.hardware.security.keymint;
/* @hide */
@RustDerive(Clone=true, Eq=true, Hash=true, Ord=true, PartialEq=true, PartialOrd=true) @VintfStability
parcelable KeyParameter {
android.hardware.security.keymint.Tag tag = android.hardware.security.keymint.Tag.INVALID;

View file

@ -32,6 +32,7 @@
// later when a module using the interface is updated, e.g., Mainline modules.
package android.hardware.security.keymint;
/* @hide */
@RustDerive(Clone=true, Eq=true, Hash=true, Ord=true, PartialEq=true, PartialOrd=true) @VintfStability
union KeyParameterValue {
int invalid;

View file

@ -32,6 +32,7 @@
// later when a module using the interface is updated, e.g., Mainline modules.
package android.hardware.security.keymint;
/* @hide */
@Backing(type="int") @VintfStability
enum KeyPurpose {
ENCRYPT = 0,

View file

@ -32,6 +32,7 @@
// later when a module using the interface is updated, e.g., Mainline modules.
package android.hardware.security.keymint;
/* @hide */
@VintfStability
parcelable MacedPublicKey {
byte[] macedKey;

View file

@ -32,6 +32,7 @@
// later when a module using the interface is updated, e.g., Mainline modules.
package android.hardware.security.keymint;
/* @hide */
@Backing(type="int") @VintfStability
enum PaddingMode {
NONE = 1,

View file

@ -32,6 +32,7 @@
// later when a module using the interface is updated, e.g., Mainline modules.
package android.hardware.security.keymint;
/* @hide */
@VintfStability
parcelable ProtectedData {
byte[] protectedData;

View file

@ -32,6 +32,7 @@
// later when a module using the interface is updated, e.g., Mainline modules.
package android.hardware.security.keymint;
/* @hide */
@Backing(type="int") @VintfStability
enum SecurityLevel {
SOFTWARE = 0,

View file

@ -32,6 +32,7 @@
// later when a module using the interface is updated, e.g., Mainline modules.
package android.hardware.security.keymint;
/* @hide */
@Backing(type="int") @VintfStability
enum Tag {
INVALID = 0,

View file

@ -32,6 +32,7 @@
// later when a module using the interface is updated, e.g., Mainline modules.
package android.hardware.security.keymint;
/* @hide */
@Backing(type="int") @VintfStability
enum TagType {
INVALID = 0,

View file

@ -18,6 +18,7 @@ package android.hardware.security.keymint;
/**
* Algorithms provided by IKeyMintDevice implementations.
* @hide
*/
@VintfStability
@Backing(type="int")

View file

@ -22,6 +22,7 @@ import android.hardware.security.keymint.KeyParameter;
* Contains a key blob with Tag::ATTEST_KEY that can be used to sign an attestation certificate,
* and the DER-encoded X.501 Subject Name that will be placed in the Issuer field of the attestation
* certificate.
* @hide
*/
@VintfStability
@RustDerive(Clone=true, Eq=true, PartialEq=true, Ord=true, PartialOrd=true, Hash=true)

View file

@ -21,6 +21,7 @@ import android.hardware.security.keymint.KeyParameter;
/**
* This is all the results returned by the IKeyMintDevice begin() function.
* @hide
*/
@VintfStability
parcelable BeginResult {

View file

@ -18,6 +18,7 @@ package android.hardware.security.keymint;
/**
* Symmetric block cipher modes provided by IKeyMintDevice implementations.
* @hide
*/
@VintfStability
@Backing(type="int")

View file

@ -18,6 +18,7 @@ package android.hardware.security.keymint;
/**
* This encodes an IKeyMintDevice certificate, generated for a KeyMint asymmetric public key.
* @hide
*/
@VintfStability
parcelable Certificate {

View file

@ -18,6 +18,7 @@ package android.hardware.security.keymint;
/**
* Digests provided by keyMint implementations.
* @hide
*/
@VintfStability
@Backing(type="int")

View file

@ -18,6 +18,7 @@ package android.hardware.security.keymint;
/**
* Supported EC curves, used in ECDSA
* @hide
*/
@VintfStability
@Backing(type="int")

View file

@ -19,6 +19,7 @@ package android.hardware.security.keymint;
/**
* KeyMint error codes. Aidl will return these error codes as service specific
* errors in EX_SERVICE_SPECIFIC.
* @hide
*/
@VintfStability
@Backing(type="int")

View file

@ -27,6 +27,7 @@ import android.hardware.security.secureclock.Timestamp;
* passed to begin(), update(), and finish() to prove that authentication occurred. See those
* methods for more details. It is up to the caller to determine which of the generated auth tokens
* is appropriate for a given key operation.
* @hide
*/
@VintfStability
@RustDerive(Clone=true, Eq=true, PartialEq=true, Ord=true, PartialOrd=true, Hash=true)

View file

@ -20,6 +20,7 @@ package android.hardware.security.keymint;
* Hardware authentication type, used by HardwareAuthTokens to specify the mechanism used to
* authentiate the user, and in KeyCharacteristics to specify the allowable mechanisms for
* authenticating to activate a key.
* @hide
*/
@VintfStability
@Backing(type="int")

View file

@ -211,6 +211,7 @@ import android.hardware.security.secureclock.TimeStampToken;
* hardwareEnforced authorization list. Tag::OS_VERSION, Tag::OS_PATCHLEVEL,
* Tag::VENDOR_PATCHLEVEL, and Tag::BOOT_PATCHLEVEL must be cryptographically bound to every
* IKeyMintDevice key, as described in the Key Access Control section above.
* @hide
*/
@VintfStability
interface IKeyMintDevice {

View file

@ -20,6 +20,7 @@ import android.hardware.security.keymint.HardwareAuthToken;
import android.hardware.security.keymint.KeyParameter;
import android.hardware.security.secureclock.TimeStampToken;
/** @hide */
@VintfStability
interface IKeyMintOperation {
/**

View file

@ -109,6 +109,7 @@ import android.hardware.security.keymint.ProtectedData;
* The IRemotelyProvisionedComponent supports a test mode, allowing the generation of test key pairs
* and test CertificateRequests. Test keys/requests are annotated as such, and the BCC used for test
* CertificateRequests must contain freshly-generated keys, not the real BCC key pairs.
* @hide
*/
@VintfStability
interface IRemotelyProvisionedComponent {

View file

@ -28,6 +28,7 @@ import android.hardware.security.keymint.SecurityLevel;
* enforced. Note that enforcement at a given security level means that the semantics of the tag
* and value are fully enforced. See the definition of individual tags for specifications of what
* must be enforced.
* @hide
*/
@VintfStability
parcelable KeyCharacteristics {

View file

@ -22,6 +22,7 @@ import android.hardware.security.keymint.KeyCharacteristics;
/**
* This structure is returned when a new key is created with generateKey(), importKey() or
* importWrappedKey().
* @hide
*/
@VintfStability
parcelable KeyCreationResult {

View file

@ -18,6 +18,7 @@ package android.hardware.security.keymint;
/**
* Formats for key import and export.
* @hide
*/
@VintfStability
@Backing(type="int")

View file

@ -20,6 +20,7 @@ import android.hardware.security.keymint.SecurityLevel;
/**
* KeyMintHardwareInfo is the hardware information returned by calling KeyMint getHardwareInfo()
* @hide
*/
@VintfStability
@RustDerive(Clone=true, Eq=true, PartialEq=true, Ord=true, PartialOrd=true, Hash=true)

View file

@ -21,6 +21,7 @@ package android.hardware.security.keymint;
* either the hardware-enforced or software-enforced list for a key, indicating whether the key is
* hardware or software-based. Specifically, a key with GENERATED in the hardware-enforced list
* must be guaranteed never to have existed outide the secure hardware.
* @hide
*/
@VintfStability
@Backing(type="int")

View file

@ -22,6 +22,7 @@ import android.hardware.security.keymint.Tag;
/**
* Identifies the key authorization parameters to be used with keyMint. This is usually
* provided as an array of KeyParameters to IKeyMintDevice or Operation.
* @hide
*/
@VintfStability
@RustDerive(Clone=true, Eq=true, PartialEq=true, Ord=true, PartialOrd=true, Hash=true)

View file

@ -26,10 +26,10 @@ import android.hardware.security.keymint.KeyPurpose;
import android.hardware.security.keymint.PaddingMode;
import android.hardware.security.keymint.SecurityLevel;
/** @hide */
@VintfStability
@RustDerive(Clone=true, Eq=true, PartialEq=true, Ord=true, PartialOrd=true, Hash=true)
union KeyParameterValue {
/* Represents an invalid value type. */
int invalid;
@ -45,7 +45,7 @@ union KeyParameterValue {
SecurityLevel securityLevel;
/* Other types */
boolean boolValue; // Always true, if present.
boolean boolValue; // Always true, if present.
int integer;
long longInteger;
long dateTime;

View file

@ -18,6 +18,7 @@ package android.hardware.security.keymint;
/**
* Possible purposes of a key (or pair).
* @hide
*/
@VintfStability
@Backing(type="int")

View file

@ -19,6 +19,7 @@ package android.hardware.security.keymint;
/**
* MacedPublicKey contains a CBOR-encoded public key, MACed by an IRemotelyProvisionedComponent, to
* prove that the key pair was generated by that component.
* @hide
*/
@VintfStability
parcelable MacedPublicKey {

View file

@ -23,6 +23,7 @@ package android.hardware.security.keymint;
* padding modes for both symmetric and asymmetric algorithms. Note that implementations should not
* provide all possible combinations of algorithm and padding, only the
* cryptographically-appropriate pairs.
* @hide
*/
@VintfStability
@Backing(type="int")

View file

@ -19,6 +19,7 @@ package android.hardware.security.keymint;
/**
* ProtectedData contains the encrypted BCC and the ephemeral MAC key used to
* authenticate the keysToSign (see keysToSignMac output argument).
* @hide
*/
@VintfStability
parcelable ProtectedData {

View file

@ -27,6 +27,7 @@ package android.hardware.security.keymint;
* certificates. This specifies the security level of the weakest environment involved in
* enforcing that particular tag, i.e. the sort of security environment an attacker would have
* to subvert in order to break the enforcement of that tag.
* @hide
*/
@VintfStability
@Backing(type="int")

View file

@ -25,6 +25,7 @@ import android.hardware.security.keymint.TagType;
/**
* Tag specifies various kinds of tags that can be set in KeyParameter to identify what kind of
* data are stored in KeyParameter.
* @hide
*/
@VintfStability
@Backing(type="int")

View file

@ -18,6 +18,7 @@ package android.hardware.security.keymint;
/**
* TagType classifies Tags in Tag.aidl into various groups of data.
* @hide
*/
@VintfStability
@Backing(type="int")

View file

@ -16,7 +16,8 @@ aidl_interface {
stability: "vintf",
backend: {
java: {
sdk_version: "module_current",
platform_apis: true,
srcs_available: true,
},
ndk: {
vndk: {

View file

@ -11,7 +11,8 @@
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* limitations under the License.
*////////////////////////////////////////////////////////////////////////////////
*/
///////////////////////////////////////////////////////////////////////////////
// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
///////////////////////////////////////////////////////////////////////////////
@ -30,6 +31,7 @@
// later when a module using the interface is updated, e.g., Mainline modules.
package android.hardware.security.secureclock;
/* @hide */
@VintfStability
interface ISecureClock {
android.hardware.security.secureclock.TimeStampToken generateTimeStamp(in long challenge);

View file

@ -12,7 +12,8 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*////////////////////////////////////////////////////////////////////////////////
*/
///////////////////////////////////////////////////////////////////////////////
// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
///////////////////////////////////////////////////////////////////////////////
@ -31,6 +32,7 @@
// later when a module using the interface is updated, e.g., Mainline modules.
package android.hardware.security.secureclock;
/* @hide */
@RustDerive(Clone=true, Eq=true, Hash=true, Ord=true, PartialEq=true, PartialOrd=true) @VintfStability
parcelable TimeStampToken {
long challenge;

View file

@ -12,7 +12,8 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*////////////////////////////////////////////////////////////////////////////////
*/
///////////////////////////////////////////////////////////////////////////////
// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
///////////////////////////////////////////////////////////////////////////////
@ -31,6 +32,7 @@
// later when a module using the interface is updated, e.g., Mainline modules.
package android.hardware.security.secureclock;
/* @hide */
@RustDerive(Clone=true, Eq=true, Hash=true, Ord=true, PartialEq=true, PartialOrd=true) @VintfStability
parcelable Timestamp {
long milliSeconds;

View file

@ -25,8 +25,8 @@ import android.hardware.security.secureclock.TimeStampToken;
* secret. The shared secret must be available to secure clock service by implementing
* ISharedSecret aidl. Note: ISecureClock depends on the shared secret, without which the secure
* time stamp token cannot be generated.
* @hide
*/
@VintfStability
interface ISecureClock {
/**

View file

@ -20,8 +20,8 @@ import android.hardware.security.secureclock.Timestamp;
/**
* TimeStampToken instances are used for secure environments that requires secure time information.
* @hide
*/
@VintfStability
@RustDerive(Clone=true, Eq=true, PartialEq=true, Ord=true, PartialOrd=true, Hash=true)
parcelable TimeStampToken {

View file

@ -21,6 +21,7 @@ package android.hardware.security.secureclock;
* and a secure environment's notion of "current time" must not repeat until the Android device
* reboots, or until at least 50 million years have elapsed (note that this requirement is satisfied
* by setting the clock to zero during each boot, and then counting time accurately).
* @hide
*/
@VintfStability
@RustDerive(Clone=true, Eq=true, PartialEq=true, Ord=true, PartialOrd=true, Hash=true)

View file

@ -1,3 +1,17 @@
/*
* Copyright (C) 2020 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* limitations under the License.
*/
///////////////////////////////////////////////////////////////////////////////
// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
///////////////////////////////////////////////////////////////////////////////
@ -17,6 +31,7 @@
// later when a module using the interface is updated, e.g., Mainline modules.
package android.hardware.security.sharedsecret;
/* @hide */
@VintfStability
interface ISharedSecret {
android.hardware.security.sharedsecret.SharedSecretParameters getSharedSecretParameters();

View file

@ -1,3 +1,18 @@
/*
* Copyright (C) 2020 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
///////////////////////////////////////////////////////////////////////////////
// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
///////////////////////////////////////////////////////////////////////////////
@ -17,6 +32,7 @@
// later when a module using the interface is updated, e.g., Mainline modules.
package android.hardware.security.sharedsecret;
/* @hide */
@VintfStability
parcelable SharedSecretParameters {
byte[] seed;

View file

@ -35,8 +35,8 @@ import android.hardware.security.sharedsecret.SharedSecretParameters;
* Step 3: The system collects sharing check hash values from each service and evaluates them. If
* they are all equal, then the shared secret generation is considered to be successful else it is
* considered to have failed.
* @hide
*/
@VintfStability
interface ISharedSecret {
/**

View file

@ -21,8 +21,8 @@ package android.hardware.security.sharedsecret;
* HMAC key between multiple keymint services. These parameters are returned in by
* getSharedSecretParameters() and send to computeShareSecret(). See the named methods in
* ISharedSecret for details of usage.
* @hide
*/
@VintfStability
parcelable SharedSecretParameters {
/**