Small refactor to clarify auth token ownership.
The Operation interface confused me. It looked like it was holding a
pointer to an auth token from the AuthTokenTable. In fact it made a
copy, but that wasn't clear from the interface. Ths CL changes
Operation::setOperationAuthtoken to take the token by value, making
clear that it copies (unless std::move is used).
Test: runtest --path cts/tests/tests/keystore/src/android/keystore/cts
Change-Id: I1d1b6983f421f5be9f56c60aaf56dda8fc4aa207
diff --git a/keystore/key_store_service.cpp b/keystore/key_store_service.cpp
index b309ad6..0a8648f 100644
--- a/keystore/key_store_service.cpp
+++ b/keystore/key_store_service.cpp
@@ -1342,7 +1342,7 @@
result->token = operationToken;
if (authToken) {
- mOperationMap.setOperationAuthToken(operationToken, authToken);
+ mOperationMap.setOperationAuthToken(operationToken, *authToken);
}
// Return the authentication lookup result. If this is a per operation
// auth'd key then the resultCode will be ::OP_AUTH_NEEDED and the
@@ -1956,7 +1956,7 @@
return result;
}
if (authToken) {
- mOperationMap.setOperationAuthToken(token, authToken);
+ mOperationMap.setOperationAuthToken(token, *authToken);
}
}
addAuthTokenToParams(params, authToken);