fix(operation): match AOSP error-path semantics for software operations
KeyDetector's OperationErrorPathChecker (flag 0x400000) probes three error-path behaviors that real keystore2 operations expose. Our SoftwareOperationBinder was missing all three, plus had no updateAad implementation which caused AbstractMethodError on Android 16 where the runtime Stub declares it abstract. SoftwareOperation changes: - Add finalized state tracking; post-abort calls now throw INVALID_OPERATION_HANDLE (-28) matching AOSP operation.rs - Add input length guard (0x8000) throwing TOO_MUCH_DATA (29) matching AOSP operation.rs MAX_RECEIVE_DATA - Add updateAad to CryptoPrimitive interface and SoftwareOperationBinder - Add KeystoreErrorCodes with runtime reflection + AOSP fallback values KeyMintSecurityLevelInterceptor changes: - Infer algorithm from stored key pair when operation params omit ALGORITHM tag, matching AOSP behavior where createOperation uses the key's stored algorithm rather than requiring it in op params Stub addition: - ServiceSpecificException compile stub (framework-internal class resolved at runtime on device) Tested on OnePlus Android 16 (SDK 36), KeyDetector passes all three probes: updateAad succeeds, TOO_MUCH_DATA returns code=21, INVALID_OPERATION_HANDLE returns after abort.
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
package android.os;
|
||||
|
||||
public class ServiceSpecificException extends RuntimeException {
|
||||
public final int errorCode;
|
||||
|
||||
public ServiceSpecificException(int errorCode) {
|
||||
this.errorCode = errorCode;
|
||||
}
|
||||
|
||||
public ServiceSpecificException(int errorCode, String message) {
|
||||
super(message);
|
||||
this.errorCode = errorCode;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user