aboutsummaryrefslogtreecommitdiff
path: root/ready_se/google/keymint/KM300/Applet/AndroidSEProviderLib/src/com/android/javacard/seprovider/KMOperation.java
diff options
context:
space:
mode:
Diffstat (limited to 'ready_se/google/keymint/KM300/Applet/AndroidSEProviderLib/src/com/android/javacard/seprovider/KMOperation.java')
-rw-r--r--ready_se/google/keymint/KM300/Applet/AndroidSEProviderLib/src/com/android/javacard/seprovider/KMOperation.java75
1 files changed, 75 insertions, 0 deletions
diff --git a/ready_se/google/keymint/KM300/Applet/AndroidSEProviderLib/src/com/android/javacard/seprovider/KMOperation.java b/ready_se/google/keymint/KM300/Applet/AndroidSEProviderLib/src/com/android/javacard/seprovider/KMOperation.java
new file mode 100644
index 0000000..12e691e
--- /dev/null
+++ b/ready_se/google/keymint/KM300/Applet/AndroidSEProviderLib/src/com/android/javacard/seprovider/KMOperation.java
@@ -0,0 +1,75 @@
+/*
+ * 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.
+ */
+package com.android.javacard.seprovider;
+
+/**
+ * KMOperation represents a persistent operation started by keymaster hal's beginOperation function.
+ * This operation is persistent i.e. it will be stored in non volatile memory of se card. It will be
+ * returned back to KMSEProvider for the reuse when the operation is finished.
+ */
+public interface KMOperation {
+
+ // Used for cipher operations
+ short update(
+ byte[] inputDataBuf,
+ short inputDataStart,
+ short inputDataLength,
+ byte[] outputDataBuf,
+ short outputDataStart);
+
+ // Used for signature operations
+ short update(byte[] inputDataBuf, short inputDataStart, short inputDataLength);
+
+ // Used for finishing cipher operations or ecdh keyAgreement.
+ short finish(
+ byte[] inputDataBuf,
+ short inputDataStart,
+ short inputDataLength,
+ byte[] outputDataBuf,
+ short outputDataStart);
+
+ // Used for finishing signing operations.
+ short sign(
+ byte[] inputDataBuf,
+ short inputDataStart,
+ short inputDataLength,
+ byte[] signBuf,
+ short signStart);
+
+ // Used for finishing verifying operations.
+ boolean verify(
+ byte[] inputDataBuf,
+ short inputDataStart,
+ short inputDataLength,
+ byte[] signBuf,
+ short signStart,
+ short signLength);
+
+ // Used for aborting the ongoing operations.
+ void abort();
+
+ // Used for AES GCM cipher operation.
+ void updateAAD(byte[] dataBuf, short dataStart, short dataLength);
+
+ // Used for getting output size before finishing a AES GCM cipher operation. For encryption this
+ // will
+ // include the auth tag which is appended at the end of the encrypted data. For decryption this
+ // will be
+ // size of the decrypted data only.
+ short getAESGCMOutputSize(short dataSize, short macLength);
+
+ KMKeyObject getKeyObject();
+}