Lines Matching refs:res

36 	TEE_Result res;  in TEE_AllocateOperation()  local
297 res = TEE_ERROR_OUT_OF_MEMORY; in TEE_AllocateOperation()
316 res = TEE_AllocateTransientObject(key_type, mks, &op->key1); in TEE_AllocateOperation()
317 if (res != TEE_SUCCESS) in TEE_AllocateOperation()
321 res = TEE_AllocateTransientObject(key_type, mks, in TEE_AllocateOperation()
323 if (res != TEE_SUCCESS) in TEE_AllocateOperation()
328 res = _utee_cryp_state_alloc(algorithm, mode, (unsigned long)op->key1, in TEE_AllocateOperation()
330 if (res != TEE_SUCCESS) in TEE_AllocateOperation()
339 res = _utee_hash_init(op->state, NULL, 0); in TEE_AllocateOperation()
340 if (res != TEE_SUCCESS) in TEE_AllocateOperation()
351 if (res != TEE_SUCCESS) { in TEE_AllocateOperation()
352 if (res != TEE_ERROR_OUT_OF_MEMORY && in TEE_AllocateOperation()
353 res != TEE_ERROR_NOT_SUPPORTED) in TEE_AllocateOperation()
354 TEE_Panic(res); in TEE_AllocateOperation()
367 return res; in TEE_AllocateOperation()
372 TEE_Result res; in TEE_FreeOperation() local
382 res = _utee_cryp_state_free(operation->state); in TEE_FreeOperation()
383 if (res != TEE_SUCCESS) in TEE_FreeOperation()
384 TEE_Panic(res); in TEE_FreeOperation()
409 TEE_Result res = TEE_SUCCESS; in TEE_GetOperationInfoMultiple() local
415 res = TEE_ERROR_BAD_PARAMETERS; in TEE_GetOperationInfoMultiple()
422 res = TEE_ERROR_BAD_PARAMETERS; in TEE_GetOperationInfoMultiple()
437 res = TEE_ERROR_SHORT_BUFFER; in TEE_GetOperationInfoMultiple()
441 res = TEE_GetObjectInfo1(op->key1, &kinfo); in TEE_GetOperationInfoMultiple()
443 if (res) in TEE_GetOperationInfoMultiple()
452 res = TEE_ERROR_SHORT_BUFFER; in TEE_GetOperationInfoMultiple()
456 res = TEE_GetObjectInfo1(op->key1, &kinfo); in TEE_GetOperationInfoMultiple()
458 if (res) in TEE_GetOperationInfoMultiple()
465 res = TEE_GetObjectInfo1(op->key2, &kinfo); in TEE_GetOperationInfoMultiple()
467 if (res) in TEE_GetOperationInfoMultiple()
486 if (res != TEE_SUCCESS && in TEE_GetOperationInfoMultiple()
487 res != TEE_ERROR_SHORT_BUFFER) in TEE_GetOperationInfoMultiple()
488 TEE_Panic(res); in TEE_GetOperationInfoMultiple()
490 return res; in TEE_GetOperationInfoMultiple()
495 TEE_Result res; in TEE_ResetOperation() local
506 res = _utee_hash_init(operation->state, NULL, 0); in TEE_ResetOperation()
507 if (res != TEE_SUCCESS) in TEE_ResetOperation()
508 TEE_Panic(res); in TEE_ResetOperation()
518 TEE_Result res; in TEE_SetOperationKey() local
523 res = TEE_ERROR_BAD_PARAMETERS; in TEE_SetOperationKey()
528 res = TEE_ERROR_BAD_PARAMETERS; in TEE_SetOperationKey()
541 res = TEE_ERROR_BAD_PARAMETERS; in TEE_SetOperationKey()
548 res = TEE_ERROR_BAD_PARAMETERS; in TEE_SetOperationKey()
552 res = TEE_GetObjectInfo1(key, &key_info); in TEE_SetOperationKey()
554 if (res != TEE_SUCCESS) in TEE_SetOperationKey()
560 res = TEE_ERROR_BAD_PARAMETERS; in TEE_SetOperationKey()
565 res = TEE_ERROR_BAD_PARAMETERS; in TEE_SetOperationKey()
574 res = TEE_CopyObjectAttributes1(operation->key1, key); in TEE_SetOperationKey()
575 if (res != TEE_SUCCESS) in TEE_SetOperationKey()
583 if (res != TEE_SUCCESS && in TEE_SetOperationKey()
584 res != TEE_ERROR_CORRUPT_OBJECT && in TEE_SetOperationKey()
585 res != TEE_ERROR_STORAGE_NOT_AVAILABLE) in TEE_SetOperationKey()
586 TEE_Panic(res); in TEE_SetOperationKey()
588 return res; in TEE_SetOperationKey()
594 TEE_Result res; in TEE_SetOperationKey2() local
600 res = TEE_ERROR_BAD_PARAMETERS; in TEE_SetOperationKey2()
605 res = TEE_ERROR_BAD_PARAMETERS; in TEE_SetOperationKey2()
621 res = TEE_ERROR_BAD_PARAMETERS; in TEE_SetOperationKey2()
627 res = TEE_ERROR_BAD_PARAMETERS; in TEE_SetOperationKey2()
634 res = TEE_ERROR_BAD_PARAMETERS; in TEE_SetOperationKey2()
638 res = TEE_GetObjectInfo1(key1, &key_info1); in TEE_SetOperationKey2()
640 if (res != TEE_SUCCESS) in TEE_SetOperationKey2()
646 res = TEE_ERROR_BAD_PARAMETERS; in TEE_SetOperationKey2()
650 res = TEE_GetObjectInfo1(key2, &key_info2); in TEE_SetOperationKey2()
652 if (res != TEE_SUCCESS) { in TEE_SetOperationKey2()
653 if (res == TEE_ERROR_CORRUPT_OBJECT) in TEE_SetOperationKey2()
654 res = TEE_ERROR_CORRUPT_OBJECT_2; in TEE_SetOperationKey2()
661 res = TEE_ERROR_BAD_PARAMETERS; in TEE_SetOperationKey2()
670 res = TEE_ERROR_BAD_PARAMETERS; in TEE_SetOperationKey2()
676 res = TEE_ERROR_BAD_PARAMETERS; in TEE_SetOperationKey2()
690 res = TEE_CopyObjectAttributes1(operation->key1, key1); in TEE_SetOperationKey2()
691 if (res != TEE_SUCCESS) in TEE_SetOperationKey2()
693 res = TEE_CopyObjectAttributes1(operation->key2, key2); in TEE_SetOperationKey2()
694 if (res != TEE_SUCCESS) { in TEE_SetOperationKey2()
695 if (res == TEE_ERROR_CORRUPT_OBJECT) in TEE_SetOperationKey2()
696 res = TEE_ERROR_CORRUPT_OBJECT_2; in TEE_SetOperationKey2()
705 if (res != TEE_SUCCESS && in TEE_SetOperationKey2()
706 res != TEE_ERROR_CORRUPT_OBJECT && in TEE_SetOperationKey2()
707 res != TEE_ERROR_CORRUPT_OBJECT_2 && in TEE_SetOperationKey2()
708 res != TEE_ERROR_STORAGE_NOT_AVAILABLE && in TEE_SetOperationKey2()
709 res != TEE_ERROR_STORAGE_NOT_AVAILABLE_2) in TEE_SetOperationKey2()
710 TEE_Panic(res); in TEE_SetOperationKey2()
712 return res; in TEE_SetOperationKey2()
717 TEE_Result res; in TEE_CopyOperation() local
760 res = _utee_cryp_state_copy(dst_op->state, src_op->state); in TEE_CopyOperation()
761 if (res != TEE_SUCCESS) in TEE_CopyOperation()
762 TEE_Panic(res); in TEE_CopyOperation()
770 TEE_Result res; in init_hash_operation() local
776 res = _utee_hash_init(operation->state, IV, IVLen); in init_hash_operation()
777 if (res != TEE_SUCCESS) in init_hash_operation()
778 TEE_Panic(res); in init_hash_operation()
786 TEE_Result res = TEE_ERROR_GENERIC; in TEE_DigestUpdate() local
794 res = _utee_hash_update(operation->state, chunk, chunkSize); in TEE_DigestUpdate()
795 if (res != TEE_SUCCESS) in TEE_DigestUpdate()
796 TEE_Panic(res); in TEE_DigestUpdate()
802 TEE_Result res; in TEE_DigestDoFinal() local
808 res = TEE_ERROR_BAD_PARAMETERS; in TEE_DigestDoFinal()
814 res = _utee_hash_final(operation->state, chunk, chunkLen, hash, &hl); in TEE_DigestDoFinal()
816 if (res != TEE_SUCCESS) in TEE_DigestDoFinal()
825 if (res != TEE_SUCCESS && in TEE_DigestDoFinal()
826 res != TEE_ERROR_SHORT_BUFFER) in TEE_DigestDoFinal()
827 TEE_Panic(res); in TEE_DigestDoFinal()
829 return res; in TEE_DigestDoFinal()
837 TEE_Result res; in TEE_CipherInit() local
862 res = _utee_cipher_init(operation->state, IV, IVLen); in TEE_CipherInit()
863 if (res != TEE_SUCCESS) in TEE_CipherInit()
864 TEE_Panic(res); in TEE_CipherInit()
877 TEE_Result res; in tee_buffer_update() local
923 res = update_func(op->state, op->buffer, l, dst, &tmp_dlen); in tee_buffer_update()
924 if (res != TEE_SUCCESS) in tee_buffer_update()
925 TEE_Panic(res); in tee_buffer_update()
949 res = update_func(op->state, src, l, dst, &tmp_dlen); in tee_buffer_update()
950 if (res != TEE_SUCCESS) in tee_buffer_update()
951 TEE_Panic(res); in tee_buffer_update()
971 TEE_Result res; in TEE_CipherUpdate() local
976 res = TEE_ERROR_BAD_PARAMETERS; in TEE_CipherUpdate()
982 res = TEE_ERROR_BAD_PARAMETERS; in TEE_CipherUpdate()
987 res = TEE_ERROR_BAD_PARAMETERS; in TEE_CipherUpdate()
992 res = TEE_ERROR_BAD_PARAMETERS; in TEE_CipherUpdate()
998 res = TEE_SUCCESS; in TEE_CipherUpdate()
1022 res = TEE_ERROR_SHORT_BUFFER; in TEE_CipherUpdate()
1028 res = tee_buffer_update(operation, _utee_cipher_update, srcData, in TEE_CipherUpdate()
1032 res = _utee_cipher_update(operation->state, srcData, in TEE_CipherUpdate()
1035 res = TEE_SUCCESS; in TEE_CipherUpdate()
1042 if (res != TEE_SUCCESS && in TEE_CipherUpdate()
1043 res != TEE_ERROR_SHORT_BUFFER) in TEE_CipherUpdate()
1044 TEE_Panic(res); in TEE_CipherUpdate()
1046 return res; in TEE_CipherUpdate()
1053 TEE_Result res = TEE_SUCCESS; in TEE_CipherDoFinal() local
1060 res = TEE_ERROR_BAD_PARAMETERS; in TEE_CipherDoFinal()
1067 res = TEE_ERROR_BAD_PARAMETERS; in TEE_CipherDoFinal()
1072 res = TEE_ERROR_BAD_PARAMETERS; in TEE_CipherDoFinal()
1077 res = TEE_ERROR_BAD_PARAMETERS; in TEE_CipherDoFinal()
1095 res = TEE_ERROR_BAD_PARAMETERS; in TEE_CipherDoFinal()
1115 res = TEE_ERROR_SHORT_BUFFER; in TEE_CipherDoFinal()
1121 res = tee_buffer_update(operation, _utee_cipher_update, in TEE_CipherDoFinal()
1124 if (res != TEE_SUCCESS) in TEE_CipherDoFinal()
1132 res = _utee_cipher_final(operation->state, operation->buffer, in TEE_CipherDoFinal()
1136 res = _utee_cipher_final(operation->state, srcData, srcLen, dst, in TEE_CipherDoFinal()
1139 if (res != TEE_SUCCESS) in TEE_CipherDoFinal()
1151 if (res != TEE_SUCCESS && in TEE_CipherDoFinal()
1152 res != TEE_ERROR_SHORT_BUFFER) in TEE_CipherDoFinal()
1153 TEE_Panic(res); in TEE_CipherDoFinal()
1155 return res; in TEE_CipherDoFinal()
1183 TEE_Result res; in TEE_MACUpdate() local
1197 res = _utee_hash_update(operation->state, chunk, chunkSize); in TEE_MACUpdate()
1198 if (res != TEE_SUCCESS) in TEE_MACUpdate()
1199 TEE_Panic(res); in TEE_MACUpdate()
1206 TEE_Result res; in TEE_MACComputeFinal() local
1210 res = TEE_ERROR_BAD_PARAMETERS; in TEE_MACComputeFinal()
1216 res = TEE_ERROR_BAD_PARAMETERS; in TEE_MACComputeFinal()
1221 res = TEE_ERROR_BAD_PARAMETERS; in TEE_MACComputeFinal()
1226 res = TEE_ERROR_BAD_PARAMETERS; in TEE_MACComputeFinal()
1231 res = _utee_hash_final(operation->state, message, messageLen, mac, &ml); in TEE_MACComputeFinal()
1233 if (res != TEE_SUCCESS) in TEE_MACComputeFinal()
1241 if (res != TEE_SUCCESS && in TEE_MACComputeFinal()
1242 res != TEE_ERROR_SHORT_BUFFER) in TEE_MACComputeFinal()
1243 TEE_Panic(res); in TEE_MACComputeFinal()
1245 return res; in TEE_MACComputeFinal()
1252 TEE_Result res; in TEE_MACCompareFinal() local
1257 res = TEE_ERROR_BAD_PARAMETERS; in TEE_MACCompareFinal()
1262 res = TEE_ERROR_BAD_PARAMETERS; in TEE_MACCompareFinal()
1267 res = TEE_ERROR_BAD_PARAMETERS; in TEE_MACCompareFinal()
1271 res = TEE_MACComputeFinal(operation, message, messageLen, computed_mac, in TEE_MACCompareFinal()
1273 if (res != TEE_SUCCESS) in TEE_MACCompareFinal()
1277 res = TEE_ERROR_MAC_INVALID; in TEE_MACCompareFinal()
1282 res = TEE_ERROR_MAC_INVALID; in TEE_MACCompareFinal()
1289 if (res != TEE_SUCCESS && in TEE_MACCompareFinal()
1290 res != TEE_ERROR_MAC_INVALID) in TEE_MACCompareFinal()
1291 TEE_Panic(res); in TEE_MACCompareFinal()
1293 return res; in TEE_MACCompareFinal()
1302 TEE_Result res; in TEE_AEInit() local
1305 res = TEE_ERROR_BAD_PARAMETERS; in TEE_AEInit()
1310 res = TEE_ERROR_BAD_PARAMETERS; in TEE_AEInit()
1315 res = TEE_ERROR_BAD_PARAMETERS; in TEE_AEInit()
1330 res = TEE_ERROR_NOT_SUPPORTED; in TEE_AEInit()
1335 res = _utee_authenc_init(operation->state, nonce, nonceLen, tagLen / 8, in TEE_AEInit()
1337 if (res != TEE_SUCCESS) in TEE_AEInit()
1345 if (res != TEE_SUCCESS && in TEE_AEInit()
1346 res != TEE_ERROR_NOT_SUPPORTED) in TEE_AEInit()
1347 TEE_Panic(res); in TEE_AEInit()
1349 return res; in TEE_AEInit()
1355 TEE_Result res; in TEE_AEUpdateAAD() local
1367 res = _utee_authenc_update_aad(operation->state, AADdata, AADdataLen); in TEE_AEUpdateAAD()
1371 if (res != TEE_SUCCESS) in TEE_AEUpdateAAD()
1372 TEE_Panic(res); in TEE_AEUpdateAAD()
1378 TEE_Result res = TEE_SUCCESS; in TEE_AEUpdate() local
1383 res = TEE_ERROR_BAD_PARAMETERS; in TEE_AEUpdate()
1389 res = TEE_ERROR_BAD_PARAMETERS; in TEE_AEUpdate()
1394 res = TEE_ERROR_BAD_PARAMETERS; in TEE_AEUpdate()
1400 res = TEE_SUCCESS; in TEE_AEUpdate()
1419 res = TEE_ERROR_SHORT_BUFFER; in TEE_AEUpdate()
1424 res = tee_buffer_update(operation, _utee_authenc_update_payload, in TEE_AEUpdate()
1428 res = _utee_authenc_update_payload(operation->state, in TEE_AEUpdate()
1433 res = TEE_SUCCESS; in TEE_AEUpdate()
1436 if (res != TEE_SUCCESS) in TEE_AEUpdate()
1444 if (res != TEE_SUCCESS && in TEE_AEUpdate()
1445 res != TEE_ERROR_SHORT_BUFFER) in TEE_AEUpdate()
1446 TEE_Panic(res); in TEE_AEUpdate()
1448 return res; in TEE_AEUpdate()
1456 TEE_Result res; in TEE_AEEncryptFinal() local
1464 res = TEE_ERROR_BAD_PARAMETERS; in TEE_AEEncryptFinal()
1471 res = TEE_ERROR_BAD_PARAMETERS; in TEE_AEEncryptFinal()
1476 res = TEE_ERROR_BAD_PARAMETERS; in TEE_AEEncryptFinal()
1488 res = TEE_ERROR_GENERIC; in TEE_AEEncryptFinal()
1493 res = TEE_ERROR_SHORT_BUFFER; in TEE_AEEncryptFinal()
1498 res = TEE_ERROR_SHORT_BUFFER; in TEE_AEEncryptFinal()
1501 if (res == TEE_ERROR_SHORT_BUFFER) in TEE_AEEncryptFinal()
1507 res = tee_buffer_update(operation, _utee_authenc_update_payload, in TEE_AEEncryptFinal()
1509 if (res != TEE_SUCCESS) in TEE_AEEncryptFinal()
1516 res = _utee_authenc_enc_final(operation->state, in TEE_AEEncryptFinal()
1521 res = _utee_authenc_enc_final(operation->state, srcData, in TEE_AEEncryptFinal()
1526 if (res != TEE_SUCCESS) in TEE_AEEncryptFinal()
1537 if (res != TEE_SUCCESS && in TEE_AEEncryptFinal()
1538 res != TEE_ERROR_SHORT_BUFFER) in TEE_AEEncryptFinal()
1539 TEE_Panic(res); in TEE_AEEncryptFinal()
1541 return res; in TEE_AEEncryptFinal()
1549 TEE_Result res; in TEE_AEDecryptFinal() local
1556 res = TEE_ERROR_BAD_PARAMETERS; in TEE_AEDecryptFinal()
1562 res = TEE_ERROR_BAD_PARAMETERS; in TEE_AEDecryptFinal()
1567 res = TEE_ERROR_BAD_PARAMETERS; in TEE_AEDecryptFinal()
1579 res = TEE_ERROR_SHORT_BUFFER; in TEE_AEDecryptFinal()
1585 res = tee_buffer_update(operation, _utee_authenc_update_payload, in TEE_AEDecryptFinal()
1587 if (res != TEE_SUCCESS) in TEE_AEDecryptFinal()
1594 res = _utee_authenc_dec_final(operation->state, in TEE_AEDecryptFinal()
1599 res = _utee_authenc_dec_final(operation->state, srcData, in TEE_AEDecryptFinal()
1603 if (res != TEE_SUCCESS) in TEE_AEDecryptFinal()
1608 res = TEE_ERROR_MAC_INVALID; in TEE_AEDecryptFinal()
1618 if (res != TEE_SUCCESS && in TEE_AEDecryptFinal()
1619 res != TEE_ERROR_SHORT_BUFFER && in TEE_AEDecryptFinal()
1620 res != TEE_ERROR_MAC_INVALID) in TEE_AEDecryptFinal()
1621 TEE_Panic(res); in TEE_AEDecryptFinal()
1623 return res; in TEE_AEDecryptFinal()
1634 TEE_Result res = TEE_SUCCESS; in TEE_AsymmetricEncrypt() local
1653 res = _utee_asymm_operate(operation->state, ua, paramCount, srcData, in TEE_AsymmetricEncrypt()
1657 if (res != TEE_SUCCESS && in TEE_AsymmetricEncrypt()
1658 res != TEE_ERROR_SHORT_BUFFER && in TEE_AsymmetricEncrypt()
1659 res != TEE_ERROR_BAD_PARAMETERS) in TEE_AsymmetricEncrypt()
1660 TEE_Panic(res); in TEE_AsymmetricEncrypt()
1662 return res; in TEE_AsymmetricEncrypt()
1671 TEE_Result res = TEE_SUCCESS; in TEE_AsymmetricDecrypt() local
1690 res = _utee_asymm_operate(operation->state, ua, paramCount, srcData, in TEE_AsymmetricDecrypt()
1694 if (res != TEE_SUCCESS && in TEE_AsymmetricDecrypt()
1695 res != TEE_ERROR_SHORT_BUFFER && in TEE_AsymmetricDecrypt()
1696 res != TEE_ERROR_BAD_PARAMETERS) in TEE_AsymmetricDecrypt()
1697 TEE_Panic(res); in TEE_AsymmetricDecrypt()
1699 return res; in TEE_AsymmetricDecrypt()
1708 TEE_Result res = TEE_SUCCESS; in TEE_AsymmetricSignDigest() local
1728 res = _utee_asymm_operate(operation->state, ua, paramCount, digest, in TEE_AsymmetricSignDigest()
1732 if (res != TEE_SUCCESS && res != TEE_ERROR_SHORT_BUFFER) in TEE_AsymmetricSignDigest()
1733 TEE_Panic(res); in TEE_AsymmetricSignDigest()
1735 return res; in TEE_AsymmetricSignDigest()
1745 TEE_Result res; in TEE_AsymmetricVerifyDigest() local
1764 res = _utee_asymm_verify(operation->state, ua, paramCount, digest, in TEE_AsymmetricVerifyDigest()
1767 if (res != TEE_SUCCESS && res != TEE_ERROR_SIGNATURE_INVALID) in TEE_AsymmetricVerifyDigest()
1768 TEE_Panic(res); in TEE_AsymmetricVerifyDigest()
1770 return res; in TEE_AsymmetricVerifyDigest()
1779 TEE_Result res; in TEE_DeriveKey() local
1801 res = _utee_cryp_obj_get_info((unsigned long)derivedKey, &key_info); in TEE_DeriveKey()
1802 if (res != TEE_SUCCESS) in TEE_DeriveKey()
1803 TEE_Panic(res); in TEE_DeriveKey()
1811 res = _utee_cryp_derive_key(operation->state, ua, paramCount, in TEE_DeriveKey()
1813 if (res != TEE_SUCCESS) in TEE_DeriveKey()
1814 TEE_Panic(res); in TEE_DeriveKey()
1821 TEE_Result res; in TEE_GenerateRandom() local
1823 res = _utee_cryp_random_number_generate(randomBuffer, randomBufferLen); in TEE_GenerateRandom()
1824 if (res != TEE_SUCCESS) in TEE_GenerateRandom()
1825 TEE_Panic(res); in TEE_GenerateRandom()