Merge "HWCrypto base AIDL definitions" into main

This commit is contained in:
Orlando Arbildo 2024-04-02 17:55:56 +00:00 committed by Gerrit Code Review
commit b4e55bd84d
39 changed files with 1519 additions and 0 deletions

View file

@ -0,0 +1,29 @@
package {
// See: http://go/android-license-faq
// A large-scale-change added 'default_applicable_licenses' to import
// all of the 'license_kinds' from "hardware_interfaces_license"
// to get the below license kinds:
// SPDX-license-identifier-Apache-2.0
default_applicable_licenses: ["hardware_interfaces_license"],
}
aidl_interface {
name: "android.hardware.security.see",
unstable: false,
host_supported: true,
srcs: [
"android/hardware/security/see/hwcrypto/*.aidl",
"android/hardware/security/see/hwcrypto/types/*.aidl",
],
backend: {
java: {
enabled: false,
},
cpp: {
enabled: false,
},
rust: {
enabled: true,
},
},
}

View file

@ -0,0 +1,45 @@
/*
* Copyright 2024 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. //
///////////////////////////////////////////////////////////////////////////////
// This file is a snapshot of an AIDL file. Do not edit it manually. There are
// two cases:
// 1). this is a frozen version file - do not edit this in any case.
// 2). this is a 'current' file. If you make a backwards compatible change to
// the interface (from the latest frozen version), the build system will
// prompt you to update this file with `m <name>-update-api`.
//
// You must not make a backward incompatible change to any AIDL file built
// with the aidl_interface module type with versions property set. The module
// type is used to build AIDL files in a way that they can be used across
// independently updatable components of the system. If a device is shipped
// with such a backward incompatible change, it has a high risk of breaking
// later when a module using the interface is updated, e.g., Mainline modules.
package android.hardware.security.see.hwcrypto;
union CryptoOperation {
android.hardware.security.see.hwcrypto.MemoryBufferParameter setMemoryBuffer;
android.hardware.security.see.hwcrypto.types.Void setOperationParameters;
android.hardware.security.see.hwcrypto.PatternParameters setPattern;
android.hardware.security.see.hwcrypto.types.OperationData copyData;
android.hardware.security.see.hwcrypto.types.OperationData aadInput;
android.hardware.security.see.hwcrypto.types.OperationData dataInput;
android.hardware.security.see.hwcrypto.types.OperationData dataOutput;
@nullable android.hardware.security.see.hwcrypto.types.Void finish;
@nullable android.hardware.security.see.hwcrypto.types.Void destroyContext;
}

View file

@ -0,0 +1,37 @@
/*
* Copyright 2024 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. //
///////////////////////////////////////////////////////////////////////////////
// This file is a snapshot of an AIDL file. Do not edit it manually. There are
// two cases:
// 1). this is a frozen version file - do not edit this in any case.
// 2). this is a 'current' file. If you make a backwards compatible change to
// the interface (from the latest frozen version), the build system will
// prompt you to update this file with `m <name>-update-api`.
//
// You must not make a backward incompatible change to any AIDL file built
// with the aidl_interface module type with versions property set. The module
// type is used to build AIDL files in a way that they can be used across
// independently updatable components of the system. If a device is shipped
// with such a backward incompatible change, it has a high risk of breaking
// later when a module using the interface is updated, e.g., Mainline modules.
package android.hardware.security.see.hwcrypto;
parcelable CryptoOperationErrorAdditionalInfo {
long failingCommandIndex;
}

View file

@ -0,0 +1,37 @@
/*
* Copyright 2024 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. //
///////////////////////////////////////////////////////////////////////////////
// This file is a snapshot of an AIDL file. Do not edit it manually. There are
// two cases:
// 1). this is a frozen version file - do not edit this in any case.
// 2). this is a 'current' file. If you make a backwards compatible change to
// the interface (from the latest frozen version), the build system will
// prompt you to update this file with `m <name>-update-api`.
//
// You must not make a backward incompatible change to any AIDL file built
// with the aidl_interface module type with versions property set. The module
// type is used to build AIDL files in a way that they can be used across
// independently updatable components of the system. If a device is shipped
// with such a backward incompatible change, it has a high risk of breaking
// later when a module using the interface is updated, e.g., Mainline modules.
package android.hardware.security.see.hwcrypto;
parcelable CryptoOperationResult {
@nullable android.hardware.security.see.hwcrypto.ICryptoOperationContext context;
}

View file

@ -0,0 +1,38 @@
/*
* Copyright 2024 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. //
///////////////////////////////////////////////////////////////////////////////
// This file is a snapshot of an AIDL file. Do not edit it manually. There are
// two cases:
// 1). this is a frozen version file - do not edit this in any case.
// 2). this is a 'current' file. If you make a backwards compatible change to
// the interface (from the latest frozen version), the build system will
// prompt you to update this file with `m <name>-update-api`.
//
// You must not make a backward incompatible change to any AIDL file built
// with the aidl_interface module type with versions property set. The module
// type is used to build AIDL files in a way that they can be used across
// independently updatable components of the system. If a device is shipped
// with such a backward incompatible change, it has a high risk of breaking
// later when a module using the interface is updated, e.g., Mainline modules.
package android.hardware.security.see.hwcrypto;
parcelable CryptoOperationSet {
@nullable android.hardware.security.see.hwcrypto.ICryptoOperationContext context;
android.hardware.security.see.hwcrypto.CryptoOperation[] operations;
}

View file

@ -0,0 +1,36 @@
/*
* Copyright 2024 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. //
///////////////////////////////////////////////////////////////////////////////
// This file is a snapshot of an AIDL file. Do not edit it manually. There are
// two cases:
// 1). this is a frozen version file - do not edit this in any case.
// 2). this is a 'current' file. If you make a backwards compatible change to
// the interface (from the latest frozen version), the build system will
// prompt you to update this file with `m <name>-update-api`.
//
// You must not make a backward incompatible change to any AIDL file built
// with the aidl_interface module type with versions property set. The module
// type is used to build AIDL files in a way that they can be used across
// independently updatable components of the system. If a device is shipped
// with such a backward incompatible change, it has a high risk of breaking
// later when a module using the interface is updated, e.g., Mainline modules.
package android.hardware.security.see.hwcrypto;
interface ICryptoOperationContext {
}

View file

@ -0,0 +1,37 @@
/*
* Copyright 2024 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. //
///////////////////////////////////////////////////////////////////////////////
// This file is a snapshot of an AIDL file. Do not edit it manually. There are
// two cases:
// 1). this is a frozen version file - do not edit this in any case.
// 2). this is a 'current' file. If you make a backwards compatible change to
// the interface (from the latest frozen version), the build system will
// prompt you to update this file with `m <name>-update-api`.
//
// You must not make a backward incompatible change to any AIDL file built
// with the aidl_interface module type with versions property set. The module
// type is used to build AIDL files in a way that they can be used across
// independently updatable components of the system. If a device is shipped
// with such a backward incompatible change, it has a high risk of breaking
// later when a module using the interface is updated, e.g., Mainline modules.
package android.hardware.security.see.hwcrypto;
interface IHwCryptoOperations {
android.hardware.security.see.hwcrypto.CryptoOperationResult[] processCommandList(inout android.hardware.security.see.hwcrypto.CryptoOperationSet[] operations, out android.hardware.security.see.hwcrypto.CryptoOperationErrorAdditionalInfo additionalErrorInfo);
}

View file

@ -0,0 +1,39 @@
/*
* Copyright 2024 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. //
///////////////////////////////////////////////////////////////////////////////
// This file is a snapshot of an AIDL file. Do not edit it manually. There are
// two cases:
// 1). this is a frozen version file - do not edit this in any case.
// 2). this is a 'current' file. If you make a backwards compatible change to
// the interface (from the latest frozen version), the build system will
// prompt you to update this file with `m <name>-update-api`.
//
// You must not make a backward incompatible change to any AIDL file built
// with the aidl_interface module type with versions property set. The module
// type is used to build AIDL files in a way that they can be used across
// independently updatable components of the system. If a device is shipped
// with such a backward incompatible change, it has a high risk of breaking
// later when a module using the interface is updated, e.g., Mainline modules.
package android.hardware.security.see.hwcrypto;
interface IOpaqueKey {
byte[] exportWrappedKey(in android.hardware.security.see.hwcrypto.IOpaqueKey wrappingKey);
android.hardware.security.see.hwcrypto.KeyPolicy getKeyPolicy();
byte[] getPublicKey();
}

View file

@ -0,0 +1,41 @@
/*
* Copyright 2024 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. //
///////////////////////////////////////////////////////////////////////////////
// This file is a snapshot of an AIDL file. Do not edit it manually. There are
// two cases:
// 1). this is a frozen version file - do not edit this in any case.
// 2). this is a 'current' file. If you make a backwards compatible change to
// the interface (from the latest frozen version), the build system will
// prompt you to update this file with `m <name>-update-api`.
//
// You must not make a backward incompatible change to any AIDL file built
// with the aidl_interface module type with versions property set. The module
// type is used to build AIDL files in a way that they can be used across
// independently updatable components of the system. If a device is shipped
// with such a backward incompatible change, it has a high risk of breaking
// later when a module using the interface is updated, e.g., Mainline modules.
package android.hardware.security.see.hwcrypto;
parcelable KeyPolicy {
android.hardware.security.see.hwcrypto.types.KeyUse usage;
android.hardware.security.see.hwcrypto.types.KeyLifetime keyLifetime = android.hardware.security.see.hwcrypto.types.KeyLifetime.EPHEMERAL;
android.hardware.security.see.hwcrypto.types.KeyPermissions[] keyPermissions;
boolean keyManagementKey;
android.hardware.security.see.hwcrypto.types.KeyType keyType = android.hardware.security.see.hwcrypto.types.KeyType.AES_256_GCM;
}

View file

@ -0,0 +1,42 @@
/*
* Copyright 2024 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. //
///////////////////////////////////////////////////////////////////////////////
// This file is a snapshot of an AIDL file. Do not edit it manually. There are
// two cases:
// 1). this is a frozen version file - do not edit this in any case.
// 2). this is a 'current' file. If you make a backwards compatible change to
// the interface (from the latest frozen version), the build system will
// prompt you to update this file with `m <name>-update-api`.
//
// You must not make a backward incompatible change to any AIDL file built
// with the aidl_interface module type with versions property set. The module
// type is used to build AIDL files in a way that they can be used across
// independently updatable components of the system. If a device is shipped
// with such a backward incompatible change, it has a high risk of breaking
// later when a module using the interface is updated, e.g., Mainline modules.
package android.hardware.security.see.hwcrypto;
parcelable MemoryBufferParameter {
android.hardware.security.see.hwcrypto.MemoryBufferParameter.MemoryBuffer bufferHandle;
int sizeBytes;
union MemoryBuffer {
ParcelFileDescriptor input;
ParcelFileDescriptor output;
}
}

View file

@ -0,0 +1,38 @@
/*
* Copyright 2024 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. //
///////////////////////////////////////////////////////////////////////////////
// This file is a snapshot of an AIDL file. Do not edit it manually. There are
// two cases:
// 1). this is a frozen version file - do not edit this in any case.
// 2). this is a 'current' file. If you make a backwards compatible change to
// the interface (from the latest frozen version), the build system will
// prompt you to update this file with `m <name>-update-api`.
//
// You must not make a backward incompatible change to any AIDL file built
// with the aidl_interface module type with versions property set. The module
// type is used to build AIDL files in a way that they can be used across
// independently updatable components of the system. If a device is shipped
// with such a backward incompatible change, it has a high risk of breaking
// later when a module using the interface is updated, e.g., Mainline modules.
package android.hardware.security.see.hwcrypto;
parcelable PatternParameters {
long numberBlocksProcess;
long numberBlocksCopy;
}

View file

@ -0,0 +1,44 @@
/*
* Copyright 2024 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. //
///////////////////////////////////////////////////////////////////////////////
// This file is a snapshot of an AIDL file. Do not edit it manually. There are
// two cases:
// 1). this is a frozen version file - do not edit this in any case.
// 2). this is a 'current' file. If you make a backwards compatible change to
// the interface (from the latest frozen version), the build system will
// prompt you to update this file with `m <name>-update-api`.
//
// You must not make a backward incompatible change to any AIDL file built
// with the aidl_interface module type with versions property set. The module
// type is used to build AIDL files in a way that they can be used across
// independently updatable components of the system. If a device is shipped
// with such a backward incompatible change, it has a high risk of breaking
// later when a module using the interface is updated, e.g., Mainline modules.
package android.hardware.security.see.hwcrypto.types;
parcelable HalErrorCode {
const int NO_ERROR = 0;
const int GENERIC_ERROR = (-1) /* -1 */;
const int BAD_STATE = (-2) /* -2 */;
const int UNSUPPORTED = (-3) /* -3 */;
const int SERIALIZATION_ERROR = (-4) /* -4 */;
const int ALLOCATION_ERROR = (-5) /* -5 */;
const int INVALID_KEY = (-6) /* -6 */;
const int BAD_PARAMETER = (-7) /* -7 */;
}

View file

@ -0,0 +1,40 @@
/*
* Copyright 2024 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. //
///////////////////////////////////////////////////////////////////////////////
// This file is a snapshot of an AIDL file. Do not edit it manually. There are
// two cases:
// 1). this is a frozen version file - do not edit this in any case.
// 2). this is a 'current' file. If you make a backwards compatible change to
// the interface (from the latest frozen version), the build system will
// prompt you to update this file with `m <name>-update-api`.
//
// You must not make a backward incompatible change to any AIDL file built
// with the aidl_interface module type with versions property set. The module
// type is used to build AIDL files in a way that they can be used across
// independently updatable components of the system. If a device is shipped
// with such a backward incompatible change, it has a high risk of breaking
// later when a module using the interface is updated, e.g., Mainline modules.
package android.hardware.security.see.hwcrypto.types;
@Backing(type="byte")
enum KeyLifetime {
EPHEMERAL,
HARDWARE,
PORTABLE,
}

View file

@ -0,0 +1,39 @@
/*
* Copyright 2024 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. //
///////////////////////////////////////////////////////////////////////////////
// This file is a snapshot of an AIDL file. Do not edit it manually. There are
// two cases:
// 1). this is a frozen version file - do not edit this in any case.
// 2). this is a 'current' file. If you make a backwards compatible change to
// the interface (from the latest frozen version), the build system will
// prompt you to update this file with `m <name>-update-api`.
//
// You must not make a backward incompatible change to any AIDL file built
// with the aidl_interface module type with versions property set. The module
// type is used to build AIDL files in a way that they can be used across
// independently updatable components of the system. If a device is shipped
// with such a backward incompatible change, it has a high risk of breaking
// later when a module using the interface is updated, e.g., Mainline modules.
package android.hardware.security.see.hwcrypto.types;
enum KeyPermissions {
ALLOW_EPHEMERAL_KEY_WRAPPING,
ALLOW_HARDWARE_KEY_WRAPPING,
ALLOW_PORTABLE_KEY_WRAPPING,
}

View file

@ -0,0 +1,55 @@
/*
* Copyright 2024 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. //
///////////////////////////////////////////////////////////////////////////////
// This file is a snapshot of an AIDL file. Do not edit it manually. There are
// two cases:
// 1). this is a frozen version file - do not edit this in any case.
// 2). this is a 'current' file. If you make a backwards compatible change to
// the interface (from the latest frozen version), the build system will
// prompt you to update this file with `m <name>-update-api`.
//
// You must not make a backward incompatible change to any AIDL file built
// with the aidl_interface module type with versions property set. The module
// type is used to build AIDL files in a way that they can be used across
// independently updatable components of the system. If a device is shipped
// with such a backward incompatible change, it has a high risk of breaking
// later when a module using the interface is updated, e.g., Mainline modules.
package android.hardware.security.see.hwcrypto.types;
enum KeyType {
AES_128_CBC_NO_PADDING,
AES_128_CBC_PKCS7_PADDING,
AES_128_CTR,
AES_128_GCM,
AES_128_CMAC,
AES_256_CBC_NO_PADDING,
AES_256_CBC_PKCS7_PADDING,
AES_256_CTR,
AES_256_GCM,
AES_256_CMAC,
HMAC_SHA256,
HMAC_SHA512,
RSA2048_PSS_SHA256,
RSA2048_PKCS1_5_SHA256,
ECC_NIST_P256_SIGN_NO_PADDING,
ECC_NIST_P256_SIGN_SHA256,
ECC_NIST_P521_SIGN_NO_PADDING,
ECC_NIST_P521_SIGN_SHA512,
ECC_ED25519_SIGN,
}

View file

@ -0,0 +1,43 @@
/*
* Copyright 2024 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. //
///////////////////////////////////////////////////////////////////////////////
// This file is a snapshot of an AIDL file. Do not edit it manually. There are
// two cases:
// 1). this is a frozen version file - do not edit this in any case.
// 2). this is a 'current' file. If you make a backwards compatible change to
// the interface (from the latest frozen version), the build system will
// prompt you to update this file with `m <name>-update-api`.
//
// You must not make a backward incompatible change to any AIDL file built
// with the aidl_interface module type with versions property set. The module
// type is used to build AIDL files in a way that they can be used across
// independently updatable components of the system. If a device is shipped
// with such a backward incompatible change, it has a high risk of breaking
// later when a module using the interface is updated, e.g., Mainline modules.
package android.hardware.security.see.hwcrypto.types;
@Backing(type="int")
enum KeyUse {
ENCRYPT = 1,
DECRYPT = 2,
ENCRYPT_DECRYPT = (ENCRYPT | DECRYPT) /* 3 */,
SIGN = 4,
DERIVE = 8,
WRAP = 16,
}

View file

@ -0,0 +1,38 @@
/*
* Copyright 2024 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. //
///////////////////////////////////////////////////////////////////////////////
// This file is a snapshot of an AIDL file. Do not edit it manually. There are
// two cases:
// 1). this is a frozen version file - do not edit this in any case.
// 2). this is a 'current' file. If you make a backwards compatible change to
// the interface (from the latest frozen version), the build system will
// prompt you to update this file with `m <name>-update-api`.
//
// You must not make a backward incompatible change to any AIDL file built
// with the aidl_interface module type with versions property set. The module
// type is used to build AIDL files in a way that they can be used across
// independently updatable components of the system. If a device is shipped
// with such a backward incompatible change, it has a high risk of breaking
// later when a module using the interface is updated, e.g., Mainline modules.
package android.hardware.security.see.hwcrypto.types;
parcelable MemoryBufferReference {
int startOffset;
int sizeBytes;
}

View file

@ -0,0 +1,38 @@
/*
* Copyright 2024 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. //
///////////////////////////////////////////////////////////////////////////////
// This file is a snapshot of an AIDL file. Do not edit it manually. There are
// two cases:
// 1). this is a frozen version file - do not edit this in any case.
// 2). this is a 'current' file. If you make a backwards compatible change to
// the interface (from the latest frozen version), the build system will
// prompt you to update this file with `m <name>-update-api`.
//
// You must not make a backward incompatible change to any AIDL file built
// with the aidl_interface module type with versions property set. The module
// type is used to build AIDL files in a way that they can be used across
// independently updatable components of the system. If a device is shipped
// with such a backward incompatible change, it has a high risk of breaking
// later when a module using the interface is updated, e.g., Mainline modules.
package android.hardware.security.see.hwcrypto.types;
union OperationData {
android.hardware.security.see.hwcrypto.types.MemoryBufferReference memoryBufferReference;
byte[] dataBuffer;
}

View file

@ -0,0 +1,38 @@
/*
* Copyright 2024 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. //
///////////////////////////////////////////////////////////////////////////////
// This file is a snapshot of an AIDL file. Do not edit it manually. There are
// two cases:
// 1). this is a frozen version file - do not edit this in any case.
// 2). this is a 'current' file. If you make a backwards compatible change to
// the interface (from the latest frozen version), the build system will
// prompt you to update this file with `m <name>-update-api`.
//
// You must not make a backward incompatible change to any AIDL file built
// with the aidl_interface module type with versions property set. The module
// type is used to build AIDL files in a way that they can be used across
// independently updatable components of the system. If a device is shipped
// with such a backward incompatible change, it has a high risk of breaking
// later when a module using the interface is updated, e.g., Mainline modules.
package android.hardware.security.see.hwcrypto.types;
enum OperationType {
READ,
WRITE,
}

View file

@ -0,0 +1,36 @@
/*
* Copyright 2024 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. //
///////////////////////////////////////////////////////////////////////////////
// This file is a snapshot of an AIDL file. Do not edit it manually. There are
// two cases:
// 1). this is a frozen version file - do not edit this in any case.
// 2). this is a 'current' file. If you make a backwards compatible change to
// the interface (from the latest frozen version), the build system will
// prompt you to update this file with `m <name>-update-api`.
//
// You must not make a backward incompatible change to any AIDL file built
// with the aidl_interface module type with versions property set. The module
// type is used to build AIDL files in a way that they can be used across
// independently updatable components of the system. If a device is shipped
// with such a backward incompatible change, it has a high risk of breaking
// later when a module using the interface is updated, e.g., Mainline modules.
package android.hardware.security.see.hwcrypto.types;
parcelable Void {
}

View file

@ -0,0 +1,87 @@
/*
* Copyright 2024 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.
*/
package android.hardware.security.see.hwcrypto;
import android.hardware.security.see.hwcrypto.MemoryBufferParameter;
import android.hardware.security.see.hwcrypto.PatternParameters;
import android.hardware.security.see.hwcrypto.types.OperationData;
import android.hardware.security.see.hwcrypto.types.Void;
/*
* Type that describes the different operations that can be performed along with its required
* parameters. It will be used to construct a vector of operation that are executed sequentially.
*/
union CryptoOperation {
/*
* Sets a memory buffer to operate on. References to positions of this memory buffer can be used
* when setting the parameters for <code>UpdateAad</code>, <code>UpdateData</code>,
* <code>Finish</code> and <code>CopyData</code>.
*/
MemoryBufferParameter setMemoryBuffer;
/*
* Sets the parameters for the current operation, for more info on specific parameters see
* <code>OperationParameters</code>.
*/
Void setOperationParameters;
/*
* Sets the pattern for a decrypt type operation. A pattern is used to describe that the Input
* data provided is not completely encrypted, but that it has some blocks encrypted followed by
* some blocks in the clear. Currently it shall only be supported for cbcs mode as defined on
* IEC 23001-7:2016.
*/
PatternParameters setPattern;
/*
* Copies data from input to output.
*/
OperationData copyData;
/*
* Adds additional authenticated data. This type is only valid after a
* <code>SetOperationParameters</code> of type <code>SymmetricAuthOperationParameters</code>.
*/
OperationData aadInput;
/*
* Adds data to the operation for processing. This type is only valid after a
* <code>SetOperationParameters</code> and it will trigger the operation, so output buffers
* need to be set first.
*/
OperationData dataInput;
/*
* Adds output buffers to store results form the operation. This type is only valid after a
* <code>SetOperationParameters</code> and it needs to be done before calling
* <code>DataInput</code>
*/
OperationData dataOutput;
/*
* Finalizes a cryptographic operation in flight. Because operations are initiated with a call
* to <code>SetOperationParameters</code>, a <code>finish</code> element is only valid after a
* <code>SetOperationParameters</code> element.
*/
@nullable Void finish;
/*
* Specifies that we do not want to continue using this context anymore. The result of this
* call is that all resources are freed after finishing operating on the set of commands and no
* context is returned to the caller.
*/
@nullable Void destroyContext;
}

View file

@ -0,0 +1,27 @@
/*
* Copyright 2024 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.
*/
package android.hardware.security.see.hwcrypto;
/*
* Type that provides more information about failures when processing a list of commands.
*/
parcelable CryptoOperationErrorAdditionalInfo {
/*
* Index indicating the first step of <code>CryptoOperationSet::operations</code> that failed
* when executing a set of commands. No more commands would have been executed after this.
*/
long failingCommandIndex;
}

View file

@ -0,0 +1,29 @@
/*
* Copyright 2024 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.
*/
package android.hardware.security.see.hwcrypto;
import android.hardware.security.see.hwcrypto.ICryptoOperationContext;
/*
* Type that describes the result of a set of crypto operations.
*/
parcelable CryptoOperationResult {
/*
* Token that can be passed on a CryptoOperationSet to issue more operations on the same context
* on future calls.
*/
@nullable ICryptoOperationContext context;
}

View file

@ -0,0 +1,35 @@
/*
* Copyright 2024 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.
*/
package android.hardware.security.see.hwcrypto;
import android.hardware.security.see.hwcrypto.CryptoOperation;
import android.hardware.security.see.hwcrypto.ICryptoOperationContext;
/*
* Type that describes a set of crypto operations to execute
*/
parcelable CryptoOperationSet {
/*
* Token to be used to issue the operations. If NULL, a new context will be created and
* returned.
*/
@nullable ICryptoOperationContext context;
/*
* Set of operations to execute.
*/
CryptoOperation[] operations;
}

View file

@ -0,0 +1,25 @@
/*
* Copyright 2024 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.
*/
package android.hardware.security.see.hwcrypto;
/*
* Token that can be used to execute more commands when passed as an input on a
* <code>CryptoOperationSet::context</code> parcelable. It represents an operation being executed
* and is valid until a <code>CryptoOperation::Finish</code> is issued using the token. The
* operation in progress context includes any memory buffer previously mapped by a
* <code>CryptoOperation::SetMemoryBuffer</code> call.
*/
interface ICryptoOperationContext {}

View file

@ -0,0 +1,44 @@
/*
* Copyright 2024 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.
*/
package android.hardware.security.see.hwcrypto;
import android.hardware.security.see.hwcrypto.CryptoOperationErrorAdditionalInfo;
import android.hardware.security.see.hwcrypto.CryptoOperationResult;
import android.hardware.security.see.hwcrypto.CryptoOperationSet;
/*
* Interface used that provides cryptographic services, including the generation and use of
* cryptographic keys. Interactions with this interface are done through a command-base API,
* which allow callers to execute a large set of operations on a single call.
*/
interface IHwCryptoOperations {
/*
* processCommandList() - Executes a list of cryptographic commands in order
*
* @operations:
* Parameter containing 1 or more set of commands to execute. Additionally, each set can
* also contain a context on which the commands will be executed.
* @additionalErrorInfo:
* Structure containing additional info when errors are encountered. Only valid if the
* function failed its execution.
* Return:
* CryptoOperationResult[] on success, which can contain a context to continue executing
* each of the provided operations sets, service specific error based on
* <code>HalErrorCode</code> otherwise.
*/
CryptoOperationResult[] processCommandList(inout CryptoOperationSet[] operations,
out CryptoOperationErrorAdditionalInfo additionalErrorInfo);
}

View file

@ -0,0 +1,55 @@
/*
* Copyright 2024 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.
*/
package android.hardware.security.see.hwcrypto;
import android.hardware.security.see.hwcrypto.KeyPolicy;
import android.hardware.security.see.hwcrypto.types.OperationType;
interface IOpaqueKey {
/*
* exportWrappedKey() - Exports this key as a wrapped (encrypted) blob.
*
* @wrapping_key:
* wrapping key. It needs to be an opaque key and its policy needs to indicate that it can
* be used for key wrapping.
*
* Return:
* Wrapped key blob as a byte array on success. Format of the blob is opaque to the service
* but has to match the command accepted by
* <code>IHwCryptoKeyGeneration::importWrappedKey</code>, service specific error based on
* <code>HalErrorCode</code> otherwise.
*/
byte[] exportWrappedKey(in IOpaqueKey wrappingKey);
/*
* getKeyPolicy() - Returns the key policy.
*
* Return:
* A <code>KeyPolicy</code> on success, service specific error based on
* <code>HalErrorCode</code> otherwise.
*/
KeyPolicy getKeyPolicy();
/*
* getPublicKey() - Returns the public key portion of this OpaqueKey. This operation is only
* valid for asymmetric keys
*
* Return:
* public key as a byte array on success, service specific error based on
* <code>HalErrorCode</code> otherwise. Format used for the returned public key is COSE.
*/
byte[] getPublicKey();
}

View file

@ -0,0 +1,53 @@
/*
* Copyright 2024 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.
*/
package android.hardware.security.see.hwcrypto;
import android.hardware.security.see.hwcrypto.types.KeyLifetime;
import android.hardware.security.see.hwcrypto.types.KeyPermissions;
import android.hardware.security.see.hwcrypto.types.KeyType;
import android.hardware.security.see.hwcrypto.types.KeyUse;
/*
* Parcelable that specified how a key can be used.
*/
parcelable KeyPolicy {
/*
* Enum specifying the operations the key can perform (encryption, decryption, etc.).
*/
KeyUse usage;
/*
* Enum that describes the key lifetime characteristics. See the docstring on
* <code>KeyLifetime</code> for more details.
*/
KeyLifetime keyLifetime = KeyLifetime.EPHEMERAL;
/*
* Additional permissions of the key (e.g. key types allowed to wrap the key, boot binding,
* etc.). See the docstring on <code>KeyPermissions</code> for more details.
*/
KeyPermissions[] keyPermissions;
/*
* Key can be used to wrap or derive other keys.
*/
boolean keyManagementKey;
/*
* Enum that specifies the key type.
*/
KeyType keyType = KeyType.AES_256_GCM;
}

View file

@ -0,0 +1,36 @@
/*
* Copyright 2024 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.
*/
package android.hardware.security.see.hwcrypto;
/*
* Parcelable representing a memory buffer.
*/
parcelable MemoryBufferParameter {
union MemoryBuffer {
ParcelFileDescriptor input;
ParcelFileDescriptor output;
}
/*
* Handle used to access this memory area.
*/
MemoryBuffer bufferHandle;
/*
* Total size of the memory buffer.
*/
int sizeBytes;
}

View file

@ -0,0 +1,35 @@
/*
* Copyright 2024 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.
*/
package android.hardware.security.see.hwcrypto;
/*
* Parcelable that specifies a pattern to process data.
*/
parcelable PatternParameters {
/*
* Number of blocks that will be processed. The size of the block matches the size of the
* cipher used (e.g. for AES this parameter indicates the number of 16 bytes blocks to be
* processed).
*/
long numberBlocksProcess;
/*
* Number of blocks that will be copied. The size of the block matches the size of the cipher
* used to process the encrypted areas (e.g. for AES this parameter indicates the number of 16
* bytes blocks to be copied).
*/
long numberBlocksCopy;
}

View file

@ -0,0 +1,45 @@
/*
* Copyright 2024 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.
*/
package android.hardware.security.see.hwcrypto.types;
/*
* Service error codes. Will be returned as service specific errors.
*/
parcelable HalErrorCode {
/* Success */
const int NO_ERROR = 0;
/* Generic error */
const int GENERIC_ERROR = -1;
/* Desired operation cannot be performed because of the server current state */
const int BAD_STATE = -2;
/* Operation or parameters are not supported by the server */
const int UNSUPPORTED = -3;
/* Error encountered when parsing parameters */
const int SERIALIZATION_ERROR = -4;
/* Server ran out of memory when performing operation */
const int ALLOCATION_ERROR = -5;
/* Provided key is not compatible with the operation */
const int INVALID_KEY = -6;
/* Bad parameter supplied for the desired operation */
const int BAD_PARAMETER = -7;
}

View file

@ -0,0 +1,41 @@
/*
* Copyright 2024 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.
*/
package android.hardware.security.see.hwcrypto.types;
/*
* Enum that gives more information about the lifetime characteristics of the key. They are
* represented as a bitmask to allow us to internally combine them on a single property to describe
* a set of allowed lifetimes.
*/
@Backing(type="byte")
enum KeyLifetime {
/*
* Hardware keys with limited validity (until key is erased or power cycle occurs).
*/
EPHEMERAL,
/*
* Key only lives or was derived from a key that only lives in hardware. This key cannot be
* retrieved in the clear.
*/
HARDWARE,
/*
* Key could have been at some point of its lifetime in the clear on a software component.
*/
PORTABLE,
}

View file

@ -0,0 +1,38 @@
/*
* Copyright 2024 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.
*/
package android.hardware.security.see.hwcrypto.types;
/*
* Additional characteristics and permissions of the key.
*/
enum KeyPermissions {
/*
* Key can be wrapped by an ephemeral key.
*/
ALLOW_EPHEMERAL_KEY_WRAPPING,
/*
* Key can be wrapped by a hardware key. Notice that ephemeral keys cannot be wrapped by
* hardware keys.
*/
ALLOW_HARDWARE_KEY_WRAPPING,
/*
* Key can be wrapped by a portable key. Notice that neither ephemeral keys nor hardware keys
* can be wrapped by portable keys.
*/
ALLOW_PORTABLE_KEY_WRAPPING,
}

View file

@ -0,0 +1,43 @@
/*
* Copyright 2024 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.
*/
package android.hardware.security.see.hwcrypto.types;
/*
* Enum describing all supported key types. Key types are strongly bound to the algorithm to
* prevent reusing the same key on different algorithms (e.g. using the same key for 2 different AES
* 128 Cipher modes).
*/
enum KeyType {
AES_128_CBC_NO_PADDING,
AES_128_CBC_PKCS7_PADDING,
AES_128_CTR,
AES_128_GCM,
AES_128_CMAC,
AES_256_CBC_NO_PADDING,
AES_256_CBC_PKCS7_PADDING,
AES_256_CTR,
AES_256_GCM,
AES_256_CMAC,
HMAC_SHA256,
HMAC_SHA512,
RSA2048_PSS_SHA256,
RSA2048_PKCS1_5_SHA256,
ECC_NIST_P256_SIGN_NO_PADDING,
ECC_NIST_P256_SIGN_SHA256,
ECC_NIST_P521_SIGN_NO_PADDING,
ECC_NIST_P521_SIGN_SHA512,
ECC_ED25519_SIGN,
}

View file

@ -0,0 +1,29 @@
/*
* Copyright 2024 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.
*/
package android.hardware.security.see.hwcrypto.types;
/*
* Enum describing the allowed operations that can be performed with the given key.
*/
@Backing(type="int")
enum KeyUse {
ENCRYPT = 1,
DECRYPT = 2,
ENCRYPT_DECRYPT = ENCRYPT | DECRYPT,
SIGN = 4,
DERIVE = 8,
WRAP = 16,
}

View file

@ -0,0 +1,32 @@
/*
* Copyright 2024 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.
*/
package android.hardware.security.see.hwcrypto.types;
/*
* Structure representing a section of a memory buffer.
*/
parcelable MemoryBufferReference {
/*
* Start of the memory buffer section measured from the start of the memory buffer set for this
* operation.
*/
int startOffset;
/*
* Total size of the memory buffer section.
*/
int sizeBytes;
}

View file

@ -0,0 +1,33 @@
/*
* Copyright 2024 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.
*/
package android.hardware.security.see.hwcrypto.types;
import android.hardware.security.see.hwcrypto.types.MemoryBufferReference;
/*
* Union holding buffers to be used by the cryptographic operation.
*/
union OperationData {
/*
* Reference (offset, size) to the active operations' MemoryBuffer.
*/
MemoryBufferReference memoryBufferReference;
/*
* Vector of data to use for the operation.
*/
byte[] dataBuffer;
}

View file

@ -0,0 +1,24 @@
/*
* Copyright 2024 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.
*/
package android.hardware.security.see.hwcrypto.types;
/*
* Enum describing the different types of operations allowed on a buffer.
*/
enum OperationType {
READ,
WRITE,
}

View file

@ -0,0 +1,18 @@
/*
* Copyright 2024 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.
*/
package android.hardware.security.see.hwcrypto.types;
parcelable Void {}