Handle KM_ERROR_CALLER_NONCE_PROHIBITED.

This converts KM_ERROR_CALLER_NONCE_PROHIBITED into
InvalidAlgorithmParameterSpec, as expected by the contract of JCA
Cipher.

Bug: 18088752
Change-Id: I6a01e2d7118c478b27a0d7a5a14a127de8913755
This commit is contained in:
Alex Klyubin
2015-04-30 13:57:44 -07:00
parent 033dc46bb9
commit 6358b881f2
2 changed files with 4 additions and 0 deletions

View File

@@ -238,6 +238,8 @@ public final class KeymasterDefs {
sErrorCodeToString.put(KM_ERROR_UNSUPPORTED_EC_FIELD, "Unsupported EC field");
sErrorCodeToString.put(KM_ERROR_MISSING_NONCE, "Required IV missing");
sErrorCodeToString.put(KM_ERROR_INVALID_NONCE, "Invalid IV");
sErrorCodeToString.put(KM_ERROR_CALLER_NONCE_PROHIBITED,
"Caller-provided IV not permitted");
sErrorCodeToString.put(KM_ERROR_UNIMPLEMENTED, "Not implemented");
sErrorCodeToString.put(KM_ERROR_UNKNOWN_ERROR, "Unknown error");
}

View File

@@ -74,6 +74,8 @@ abstract class KeyStoreCryptoOperationUtils {
switch (beginOpResultCode) {
case KeymasterDefs.KM_ERROR_INVALID_NONCE:
return new InvalidAlgorithmParameterException("Invalid IV");
case KeymasterDefs.KM_ERROR_CALLER_NONCE_PROHIBITED:
return new InvalidAlgorithmParameterException("Caller-provided IV not permitted");
}
// General cases