Lines Matching refs:auth

99 static bool generateKeymasterKey(Keymaster& keymaster, const KeyAuthentication& auth,  in generateKeymasterKey()  argument
107 if (auth.token.empty()) { in generateKeymasterKey()
112 if (auth.token.size() != sizeof(hw_auth_token_t)) { in generateKeymasterKey()
114 << auth.token.size() << " bytes"; in generateKeymasterKey()
117 const hw_auth_token_t* at = reinterpret_cast<const hw_auth_token_t*>(auth.token.data()); in generateKeymasterKey()
125 static keymaster::AuthorizationSetBuilder beginParams(const KeyAuthentication& auth, in beginParams() argument
132 if (!auth.token.empty()) { in beginParams()
134 addStringParam(&paramBuilder, keymaster::TAG_AUTH_TOKEN, auth.token); in beginParams()
140 const KeyAuthentication& auth, const std::string& appId, in encryptWithKeymasterKey() argument
142 auto params = beginParams(auth, appId).build(); in encryptWithKeymasterKey()
165 const KeyAuthentication& auth, const std::string& appId, in decryptWithKeymasterKey() argument
169 auto params = addStringParam(beginParams(auth, appId), keymaster::TAG_NONCE, nonce).build(); in decryptWithKeymasterKey()
237 static bool generateAppId(const KeyAuthentication& auth, const std::string& stretching, in generateAppId() argument
241 if (!stretchSecret(stretching, auth.secret, salt, &stretched)) return false; in generateAppId()
246 bool storeKey(const std::string& dir, const KeyAuthentication& auth, const std::string& key) { in storeKey() argument
259 std::string stretching = auth.secret.empty() ? kStretch_nopassword : getStretching(); in storeKey()
270 if (!generateAppId(auth, stretching, salt, secdiscardable, &appId)) return false; in storeKey()
274 if (!generateKeymasterKey(keymaster, auth, appId, &kmKey)) return false; in storeKey()
277 if (!encryptWithKeymasterKey(keymaster, kmKey, auth, appId, key, &encryptedKey)) return false; in storeKey()
282 bool retrieveKey(const std::string& dir, const KeyAuthentication& auth, std::string* key) { in retrieveKey() argument
298 if (!generateAppId(auth, stretching, salt, secdiscardable, &appId)) return false; in retrieveKey()
305 return decryptWithKeymasterKey(keymaster, kmKey, auth, appId, encryptedMessage, key); in retrieveKey()