Lines Matching refs:rc

113     auto rc = keystore->getSecurityLevel(securitylevel, &sec_level);  in GetSecurityLevelInterface()  local
114 if (rc.isOk()) return sec_level; in GetSecurityLevelInterface()
115 std::cerr << "Unable to get security level interface from Keystore: " << rc.getDescription(); in GetSecurityLevelInterface()
234 auto rc = keystore->getKeyEntry(keyDescriptor(name), &keyEntryResponse); in loadOrCreateAndVerifyEncryptionKey() local
235 if (!rc.isOk()) { in loadOrCreateAndVerifyEncryptionKey()
236 auto error = unwrapError(rc); in loadOrCreateAndVerifyEncryptionKey()
240 std::cerr << "Failed to get key entry: " << rc.getDescription() << std::endl; in loadOrCreateAndVerifyEncryptionKey()
255 rc = sec_level->generateKey(keyDescriptor(name), {} /* attestationKey */, in loadOrCreateAndVerifyEncryptionKey()
258 if (!rc.isOk()) { in loadOrCreateAndVerifyEncryptionKey()
259 std::cerr << "Failed to generate key: " << rc.getDescription() << std::endl; in loadOrCreateAndVerifyEncryptionKey()
260 return unwrapError(rc); in loadOrCreateAndVerifyEncryptionKey()
263 rc = keystore->getKeyEntry(keyDescriptor(name), &keyEntryResponse); in loadOrCreateAndVerifyEncryptionKey()
264 if (!rc.isOk()) { in loadOrCreateAndVerifyEncryptionKey()
265 std::cerr << "Failed to get key entry (second try): " << rc.getDescription() in loadOrCreateAndVerifyEncryptionKey()
267 return unwrapError(rc); in loadOrCreateAndVerifyEncryptionKey()
287 auto rc = keystore->getKeyEntry(keyDescriptor(name), &keyEntryResponse); in loadOrCreateAndVerifyAuthenticationKey() local
288 if (!rc.isOk()) { in loadOrCreateAndVerifyAuthenticationKey()
289 auto error = unwrapError(rc); in loadOrCreateAndVerifyAuthenticationKey()
293 std::cerr << "Failed to get HMAC key entry: " << rc.getDescription() << std::endl; in loadOrCreateAndVerifyAuthenticationKey()
308 rc = sec_level->generateKey(keyDescriptor(name), {} /* attestationKey */, in loadOrCreateAndVerifyAuthenticationKey()
311 if (!rc.isOk()) { in loadOrCreateAndVerifyAuthenticationKey()
312 std::cerr << "Failed to generate HMAC key: " << rc.getDescription() << std::endl; in loadOrCreateAndVerifyAuthenticationKey()
313 return unwrapError(rc); in loadOrCreateAndVerifyAuthenticationKey()
316 rc = keystore->getKeyEntry(keyDescriptor(name), &keyEntryResponse); in loadOrCreateAndVerifyAuthenticationKey()
317 if (!rc.isOk()) { in loadOrCreateAndVerifyAuthenticationKey()
318 std::cerr << "Failed to get HMAC key entry (second try): " << rc.getDescription() in loadOrCreateAndVerifyAuthenticationKey()
320 return unwrapError(rc); in loadOrCreateAndVerifyAuthenticationKey()
361 auto rc = encryption_key.iSecurityLevel->createOperation( in encryptWithAuthentication() local
364 if (!rc.isOk()) { in encryptWithAuthentication()
365 std::cerr << "Failed to begin encryption operation: " << rc.getDescription() << std::endl; in encryptWithAuthentication()
366 return unwrapError(rc); in encryptWithAuthentication()
371 rc = encOperationResponse.iOperation->finish(data, {}, &optCiphertext); in encryptWithAuthentication()
372 if (!rc.isOk()) { in encryptWithAuthentication()
373 std::cerr << "Failed to finish encryption operation: " << rc.getDescription() << std::endl; in encryptWithAuthentication()
374 return unwrapError(rc); in encryptWithAuthentication()
406 rc = authentication_key.iSecurityLevel->createOperation( in encryptWithAuthentication()
409 if (!rc.isOk()) { in encryptWithAuthentication()
410 std::cerr << "Failed to begin signing operation: " << rc.getDescription() << std::endl; in encryptWithAuthentication()
411 return unwrapError(rc); in encryptWithAuthentication()
416 rc = signOperationResponse.iOperation->finish(toBeSigned, {}, &optMac); in encryptWithAuthentication()
417 if (!rc.isOk()) { in encryptWithAuthentication()
418 std::cerr << "Failed to finish encryption operation: " << rc.getDescription() << std::endl; in encryptWithAuthentication()
419 return unwrapError(rc); in encryptWithAuthentication()
480 auto rc = authentication_key.iSecurityLevel->createOperation( in decryptWithAuthentication() local
483 if (!rc.isOk()) { in decryptWithAuthentication()
484 std::cerr << "Failed to begin verify operation: " << rc.getDescription() << std::endl; in decryptWithAuthentication()
485 return unwrapError(rc); in decryptWithAuthentication()
498 rc = signOperationResponse.iOperation->finish(toBeVerified, signature, &optOut); in decryptWithAuthentication()
499 if (!rc.isOk()) { in decryptWithAuthentication()
500 std::cerr << "Decrypt: HMAC verification failed: " << rc.getDescription() << std::endl; in decryptWithAuthentication()
501 return unwrapError(rc); in decryptWithAuthentication()
513 rc = encryption_key.iSecurityLevel->createOperation(encryption_key.metadata.key, in decryptWithAuthentication()
516 if (!rc.isOk()) { in decryptWithAuthentication()
517 std::cerr << "Failed to begin encryption operation: " << rc.getDescription() << std::endl; in decryptWithAuthentication()
518 return unwrapError(rc); in decryptWithAuthentication()
526 rc = encOperationResponse.iOperation->finish(cyphertext, {}, &optPlaintext); in decryptWithAuthentication()
527 if (!rc.isOk()) { in decryptWithAuthentication()
528 std::cerr << "Failed to finish encryption operation: " << rc.getDescription() << std::endl; in decryptWithAuthentication()
529 return unwrapError(rc); in decryptWithAuthentication()
555 auto rc = sec_level->generateKey(keyDescriptor, {} /* attestationKey */, parameters, in TestKey() local
558 if (!rc.isOk()) { in TestKey()
559 LOG(ERROR) << "Failed to generate key: " << rc.getDescription(); in TestKey()
564 rc = keystore->deleteKey(keyDescriptor); in TestKey()
565 if (!rc.isOk()) { in TestKey()
566 LOG(ERROR) << "Failed to delete key: " << rc.getDescription(); in TestKey()
768 auto rc = in GenerateKey() local
772 if (!rc.isOk()) { in GenerateKey()
773 std::cerr << "GenerateKey failed: " << rc.getDescription() << std::endl; in GenerateKey()
774 return unwrapError(rc); in GenerateKey()
786 auto rc = keystore->getKeyEntry(keyDescriptor(name), &keyEntryResponse); in GetCharacteristics() local
787 if (!rc.isOk()) { in GetCharacteristics()
788 std::cerr << "Failed to get key entry: " << rc.getDescription() << std::endl; in GetCharacteristics()
789 return unwrapError(rc); in GetCharacteristics()
802 auto rc = keystore->getKeyEntry(keyDescriptor(name), &keyEntryResponse); in ExportKey() local
803 if (!rc.isOk()) { in ExportKey()
804 std::cerr << "Failed to get key entry: " << rc.getDescription() << std::endl; in ExportKey()
805 return unwrapError(rc); in ExportKey()
820 auto rc = keystore->deleteKey(keyDescriptor(name)); in DeleteKey() local
821 if (!rc.isOk()) { in DeleteKey()
822 std::cerr << "Failed to delete key: " << rc.getDescription(); in DeleteKey()
823 return unwrapError(rc); in DeleteKey()
834 auto rc = keystore->getKeyEntry(keyDescriptor(name), &keyEntryResponse); in DoesKeyExist() local
835 if (!rc.isOk()) { in DoesKeyExist()
836 auto responseCode = unwrapError(rc); in DoesKeyExist()
840 std::cerr << "Failed to get key entry: " << rc.getDescription() << std::endl; in DoesKeyExist()
841 return unwrapError(rc); in DoesKeyExist()
851 auto rc = keystore->listEntries(ks2::Domain::APP, -1 /* nspace ignored */, &key_list); in List() local
852 if (!rc.isOk()) { in List()
853 std::cerr << "ListKeys failed: " << rc.getDescription() << std::endl; in List()
854 return unwrapError(rc); in List()
876 auto rc = keystore->getKeyEntry(keyDescriptor(name), &keyEntryResponse); in SignAndVerify() local
877 if (!rc.isOk()) { in SignAndVerify()
878 std::cerr << "Failed to get key entry: " << rc.getDescription() << std::endl; in SignAndVerify()
879 return unwrapError(rc); in SignAndVerify()
884 rc = keyEntryResponse.iSecurityLevel->createOperation(keyEntryResponse.metadata.key, in SignAndVerify()
887 if (!rc.isOk()) { in SignAndVerify()
888 std::cerr << "Failed to create operation: " << rc.getDescription() << std::endl; in SignAndVerify()
889 return unwrapError(rc); in SignAndVerify()
895 rc = operationResponse.iOperation->finish(data_to_sign, {}, &output_data); in SignAndVerify()
896 if (!rc.isOk()) { in SignAndVerify()
897 std::cerr << "Failed to finalize operation: " << rc.getDescription() << std::endl; in SignAndVerify()
898 return unwrapError(rc); in SignAndVerify()
1029 auto rc = apcService->presentPrompt(listener, promptText, extraData, locale, uiOptionsAsFlags); in Confirmation() local
1031 if (!rc.isOk()) { in Confirmation()
1032 std::cerr << "Presenting confirmation prompt failed: " << rc.getDescription() << std::endl; in Confirmation()
1044 rc = apcService->cancelPrompt(listener); in Confirmation()
1045 if (!rc.isOk()) { in Confirmation()
1046 std::cerr << "Canceling confirmation prompt failed: " << rc.getDescription() in Confirmation()