Merge "Keystore: Added missing error codes" am: 15821b60a7 am: 3b67462324 am: 060c58dd6c am: 113c14dac3

Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/2534342

Change-Id: Ic626426646a09985d7f559666925d647b068481c
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Eran Messeri
2023-05-08 20:46:16 +00:00
committed by Automerger Merge Worker
2 changed files with 41 additions and 1 deletions

View File

@@ -337,8 +337,22 @@ public final class KeymasterDefs {
ErrorCode.ROLLBACK_RESISTANCE_UNAVAILABLE; // -67; ErrorCode.ROLLBACK_RESISTANCE_UNAVAILABLE; // -67;
public static final int KM_ERROR_HARDWARE_TYPE_UNAVAILABLE = public static final int KM_ERROR_HARDWARE_TYPE_UNAVAILABLE =
ErrorCode.HARDWARE_TYPE_UNAVAILABLE; // -68; ErrorCode.HARDWARE_TYPE_UNAVAILABLE; // -68;
public static final int KM_ERROR_PROOF_OF_PRESENCE_REQUIRED =
ErrorCode.PROOF_OF_PRESENCE_REQUIRED; // -69;
public static final int KM_ERROR_CONCURRENT_PROOF_OF_PRESENCE_REQUESTED =
ErrorCode.CONCURRENT_PROOF_OF_PRESENCE_REQUESTED; // -70;
public static final int KM_ERROR_NO_USER_CONFIRMATION =
ErrorCode.NO_USER_CONFIRMATION; // -71;
public static final int KM_ERROR_DEVICE_LOCKED = public static final int KM_ERROR_DEVICE_LOCKED =
ErrorCode.DEVICE_LOCKED; // -72; ErrorCode.DEVICE_LOCKED; // -72;
public static final int KM_ERROR_EARLY_BOOT_ENDED =
ErrorCode.EARLY_BOOT_ENDED; // -73;
public static final int KM_ERROR_ATTESTATION_KEYS_NOT_PROVISIONED =
ErrorCode.ATTESTATION_KEYS_NOT_PROVISIONED; // -74;
public static final int KM_ERROR_ATTESTATION_IDS_NOT_PROVISIONED =
ErrorCode.ATTESTATION_IDS_NOT_PROVISIONED; // -75;
public static final int KM_ERROR_INVALID_OPERATION =
ErrorCode.INVALID_OPERATION; // -76;
public static final int KM_ERROR_STORAGE_KEY_UNSUPPORTED = public static final int KM_ERROR_STORAGE_KEY_UNSUPPORTED =
ErrorCode.STORAGE_KEY_UNSUPPORTED; // -77, ErrorCode.STORAGE_KEY_UNSUPPORTED; // -77,
public static final int KM_ERROR_INCOMPATIBLE_MGF_DIGEST = public static final int KM_ERROR_INCOMPATIBLE_MGF_DIGEST =
@@ -348,7 +362,13 @@ public final class KeymasterDefs {
public static final int KM_ERROR_MISSING_NOT_BEFORE = public static final int KM_ERROR_MISSING_NOT_BEFORE =
ErrorCode.MISSING_NOT_BEFORE; // -80; ErrorCode.MISSING_NOT_BEFORE; // -80;
public static final int KM_ERROR_MISSING_NOT_AFTER = public static final int KM_ERROR_MISSING_NOT_AFTER =
ErrorCode.MISSING_NOT_AFTER; // -80; ErrorCode.MISSING_NOT_AFTER; // -81;
public static final int KM_ERROR_MISSING_ISSUER_SUBJECT =
ErrorCode.MISSING_ISSUER_SUBJECT; // -82;
public static final int KM_ERROR_INVALID_ISSUER_SUBJECT =
ErrorCode.INVALID_ISSUER_SUBJECT; // -83;
public static final int KM_ERROR_BOOT_LEVEL_EXCEEDED =
ErrorCode.BOOT_LEVEL_EXCEEDED; // -84;
public static final int KM_ERROR_HARDWARE_NOT_YET_AVAILABLE = public static final int KM_ERROR_HARDWARE_NOT_YET_AVAILABLE =
ErrorCode.HARDWARE_NOT_YET_AVAILABLE; // -85 ErrorCode.HARDWARE_NOT_YET_AVAILABLE; // -85
public static final int KM_ERROR_UNIMPLEMENTED = public static final int KM_ERROR_UNIMPLEMENTED =

View File

@@ -614,9 +614,23 @@ public class KeyStoreException extends Exception {
KEYMINT_UNIMPLEMENTED_ERROR); KEYMINT_UNIMPLEMENTED_ERROR);
sErrorCodeToFailureInfo.put(KeymasterDefs.KM_ERROR_HARDWARE_TYPE_UNAVAILABLE, sErrorCodeToFailureInfo.put(KeymasterDefs.KM_ERROR_HARDWARE_TYPE_UNAVAILABLE,
KEYMINT_UNIMPLEMENTED_ERROR); KEYMINT_UNIMPLEMENTED_ERROR);
sErrorCodeToFailureInfo.put(KeymasterDefs.KM_ERROR_PROOF_OF_PRESENCE_REQUIRED,
KEYMINT_INCORRECT_USAGE_ERROR);
sErrorCodeToFailureInfo.put(KeymasterDefs.KM_ERROR_CONCURRENT_PROOF_OF_PRESENCE_REQUESTED,
KEYMINT_INCORRECT_USAGE_ERROR);
sErrorCodeToFailureInfo.put(KeymasterDefs.KM_ERROR_NO_USER_CONFIRMATION,
KEYMINT_INCORRECT_USAGE_ERROR);
sErrorCodeToFailureInfo.put(KeymasterDefs.KM_ERROR_DEVICE_LOCKED, sErrorCodeToFailureInfo.put(KeymasterDefs.KM_ERROR_DEVICE_LOCKED,
new PublicErrorInformation(IS_SYSTEM_ERROR | REQUIRES_USER_AUTHENTICATION, new PublicErrorInformation(IS_SYSTEM_ERROR | REQUIRES_USER_AUTHENTICATION,
ERROR_USER_AUTHENTICATION_REQUIRED)); ERROR_USER_AUTHENTICATION_REQUIRED));
sErrorCodeToFailureInfo.put(KeymasterDefs.KM_ERROR_EARLY_BOOT_ENDED,
GENERAL_KEYMINT_ERROR);
sErrorCodeToFailureInfo.put(KeymasterDefs.KM_ERROR_ATTESTATION_KEYS_NOT_PROVISIONED,
GENERAL_KEYMINT_ERROR);
sErrorCodeToFailureInfo.put(KeymasterDefs.KM_ERROR_ATTESTATION_IDS_NOT_PROVISIONED,
GENERAL_KEYMINT_ERROR);
sErrorCodeToFailureInfo.put(KeymasterDefs.KM_ERROR_INVALID_OPERATION,
GENERAL_KEYMINT_ERROR);
sErrorCodeToFailureInfo.put(KeymasterDefs.KM_ERROR_STORAGE_KEY_UNSUPPORTED, sErrorCodeToFailureInfo.put(KeymasterDefs.KM_ERROR_STORAGE_KEY_UNSUPPORTED,
KEYMINT_UNIMPLEMENTED_ERROR); KEYMINT_UNIMPLEMENTED_ERROR);
sErrorCodeToFailureInfo.put(KeymasterDefs.KM_ERROR_INCOMPATIBLE_MGF_DIGEST, sErrorCodeToFailureInfo.put(KeymasterDefs.KM_ERROR_INCOMPATIBLE_MGF_DIGEST,
@@ -627,6 +641,12 @@ public class KeyStoreException extends Exception {
KEYMINT_INCORRECT_USAGE_ERROR); KEYMINT_INCORRECT_USAGE_ERROR);
sErrorCodeToFailureInfo.put(KeymasterDefs.KM_ERROR_MISSING_NOT_AFTER, sErrorCodeToFailureInfo.put(KeymasterDefs.KM_ERROR_MISSING_NOT_AFTER,
KEYMINT_INCORRECT_USAGE_ERROR); KEYMINT_INCORRECT_USAGE_ERROR);
sErrorCodeToFailureInfo.put(KeymasterDefs.KM_ERROR_MISSING_ISSUER_SUBJECT,
KEYMINT_INCORRECT_USAGE_ERROR);
sErrorCodeToFailureInfo.put(KeymasterDefs.KM_ERROR_INVALID_ISSUER_SUBJECT,
KEYMINT_INCORRECT_USAGE_ERROR);
sErrorCodeToFailureInfo.put(KeymasterDefs.KM_ERROR_BOOT_LEVEL_EXCEEDED,
KEYMINT_INCORRECT_USAGE_ERROR);
// This should not be exposed to apps as it's handled by Keystore. // This should not be exposed to apps as it's handled by Keystore.
sErrorCodeToFailureInfo.put(KeymasterDefs.KM_ERROR_HARDWARE_NOT_YET_AVAILABLE, sErrorCodeToFailureInfo.put(KeymasterDefs.KM_ERROR_HARDWARE_NOT_YET_AVAILABLE,
GENERAL_KEYMINT_ERROR); GENERAL_KEYMINT_ERROR);