Lines Matching full:if
30 bool buffer_two_blocks; /* True if two blocks need to be buffered */
50 if (!operation) in TEE_AllocateOperation()
53 if (algorithm == TEE_ALG_AES_XTS || algorithm == TEE_ALG_SM2_KEP || in TEE_AllocateOperation()
60 if (maxKeySize < 512) in TEE_AllocateOperation()
62 if (maxKeySize > 1024) in TEE_AllocateOperation()
64 if (maxKeySize % 64 != 0) in TEE_AllocateOperation()
69 if (maxKeySize != 2048) in TEE_AllocateOperation()
74 if (maxKeySize != 2048 && maxKeySize != 3072) in TEE_AllocateOperation()
81 if (maxKeySize != 192) in TEE_AllocateOperation()
88 if (maxKeySize != 224) in TEE_AllocateOperation()
97 if (maxKeySize != 256) in TEE_AllocateOperation()
103 if (maxKeySize != 512) in TEE_AllocateOperation()
110 if (maxKeySize != 384) in TEE_AllocateOperation()
117 if (maxKeySize != 521) in TEE_AllocateOperation()
122 if (maxKeySize > 521) in TEE_AllocateOperation()
128 if (maxKeySize != 256) in TEE_AllocateOperation()
152 if (TEE_ALG_GET_MAIN_ALG(algorithm) == TEE_MAIN_ALGO_AES) in TEE_AllocateOperation()
154 else if (TEE_ALG_GET_MAIN_ALG(algorithm) == TEE_MAIN_ALGO_SM4) in TEE_AllocateOperation()
161 if (mode == TEE_MODE_ENCRYPT) in TEE_AllocateOperation()
163 else if (mode == TEE_MODE_DECRYPT) in TEE_AllocateOperation()
169 #if defined(CFG_CRYPTO_RSASSA_NA1) in TEE_AllocateOperation()
199 if (mode == TEE_MODE_SIGN) { in TEE_AllocateOperation()
202 } else if (mode == TEE_MODE_VERIFY) { in TEE_AllocateOperation()
217 if (mode == TEE_MODE_ENCRYPT) { in TEE_AllocateOperation()
219 } else if (mode == TEE_MODE_DECRYPT) { in TEE_AllocateOperation()
228 if (mode == TEE_MODE_ENCRYPT) { in TEE_AllocateOperation()
230 } else if (mode == TEE_MODE_DECRYPT) { in TEE_AllocateOperation()
259 if (mode != TEE_MODE_DERIVE) in TEE_AllocateOperation()
278 if (mode != TEE_MODE_DIGEST) in TEE_AllocateOperation()
304 if (mode != TEE_MODE_MAC) in TEE_AllocateOperation()
314 if (!op) in TEE_AllocateOperation()
320 if (algorithm == TEE_ALG_RSASSA_PKCS1_V1_5) in TEE_AllocateOperation()
330 * Needed to buffer the digest if TEE_DigestExtract() doesn't in TEE_AllocateOperation()
333 if (op->info.operationClass == TEE_OPERATION_DIGEST) in TEE_AllocateOperation()
336 if (block_size > 1) { in TEE_AllocateOperation()
339 if (buffer_two_blocks) in TEE_AllocateOperation()
344 if (op->buffer == NULL) { in TEE_AllocateOperation()
352 if (TEE_ALG_GET_CLASS(algorithm) != TEE_OPERATION_DIGEST) { in TEE_AllocateOperation()
358 * If two keys are expected the max key size is the sum of in TEE_AllocateOperation()
361 if (op->info.handleState & TEE_HANDLE_FLAG_EXPECT_TWO_KEYS) in TEE_AllocateOperation()
365 if (res != TEE_SUCCESS) in TEE_AllocateOperation()
368 if (op->info.handleState & TEE_HANDLE_FLAG_EXPECT_TWO_KEYS) { in TEE_AllocateOperation()
371 if (res != TEE_SUCCESS) in TEE_AllocateOperation()
378 if (res != TEE_SUCCESS) in TEE_AllocateOperation()
386 if (TEE_ALG_GET_CLASS(algorithm) == TEE_OPERATION_DIGEST) { in TEE_AllocateOperation()
388 if (res != TEE_SUCCESS) in TEE_AllocateOperation()
399 if (res != TEE_SUCCESS) { in TEE_AllocateOperation()
400 if (res != TEE_ERROR_OUT_OF_MEMORY && in TEE_AllocateOperation()
403 if (op) { in TEE_AllocateOperation()
404 if (op->state) { in TEE_AllocateOperation()
422 if (operation == TEE_HANDLE_NULL) in TEE_FreeOperation()
431 if (res != TEE_SUCCESS) in TEE_FreeOperation()
440 if (operation == TEE_HANDLE_NULL) in __GP11_TEE_FreeOperation()
448 if (operation == TEE_HANDLE_NULL) in TEE_GetOperationInfo()
454 if (operationInfo->handleState & TEE_HANDLE_FLAG_EXPECT_TWO_KEYS) { in TEE_GetOperationInfo()
469 if (op == TEE_HANDLE_NULL) { in TEE_GetOperationInfoMultiple()
476 if (*size < sizeof(*op_info)) { in TEE_GetOperationInfoMultiple()
488 if (op->info.mode == TEE_MODE_DIGEST) { in TEE_GetOperationInfoMultiple()
490 } else if (!two_keys) { in TEE_GetOperationInfoMultiple()
491 if (max_key_count < 1) { in TEE_GetOperationInfoMultiple()
498 if (res) in TEE_GetOperationInfoMultiple()
506 if (max_key_count < 2) { in TEE_GetOperationInfoMultiple()
513 if (res) in TEE_GetOperationInfoMultiple()
522 if (res) in TEE_GetOperationInfoMultiple()
541 if (res != TEE_SUCCESS && in TEE_GetOperationInfoMultiple()
567 if (op->info.operationClass == TEE_OPERATION_DIGEST) { in reset_operation_state()
570 if (res != TEE_SUCCESS) in reset_operation_state()
580 if (operation == TEE_HANDLE_NULL) in TEE_ResetOperation()
583 if (!(operation->info.handleState & TEE_HANDLE_FLAG_KEY_SET)) in TEE_ResetOperation()
596 if (operation == TEE_HANDLE_NULL) { in TEE_SetOperationKey()
601 if (key == TEE_HANDLE_NULL) { in TEE_SetOperationKey()
605 if (operation->operationState != TEE_OPERATION_STATE_INITIAL) in TEE_SetOperationKey()
611 if (operation->info.operationClass == TEE_OPERATION_DIGEST) { in TEE_SetOperationKey()
617 if ((operation->info.handleState & TEE_HANDLE_FLAG_EXPECT_TWO_KEYS) != in TEE_SetOperationKey()
625 if (res != TEE_SUCCESS) in TEE_SetOperationKey()
629 if ((key_info.objectUsage & operation->info.requiredKeyUsage) != in TEE_SetOperationKey()
635 if (operation->info.maxKeySize < key_info.objectSize) { in TEE_SetOperationKey()
646 if (res != TEE_SUCCESS) in TEE_SetOperationKey()
653 if (operation->operationState != TEE_OPERATION_STATE_INITIAL) in TEE_SetOperationKey()
657 if (res != TEE_SUCCESS && in TEE_SetOperationKey()
668 if (operation == TEE_HANDLE_NULL || in __GP11_TEE_SetOperationKey()
684 if (operation == TEE_HANDLE_NULL) { in set_operation_key2()
693 if (!key1 && !key2) { in set_operation_key2()
698 if (operation->operationState != TEE_OPERATION_STATE_INITIAL) in set_operation_key2()
701 } else if (!key1 || !key2) { in set_operation_key2()
708 if (operation->info.operationClass == TEE_OPERATION_DIGEST) { in set_operation_key2()
714 if ((operation->info.handleState & TEE_HANDLE_FLAG_EXPECT_TWO_KEYS) == in set_operation_key2()
722 if (res != TEE_SUCCESS) in set_operation_key2()
726 if ((key_info1.objectUsage & operation->info. in set_operation_key2()
734 if (res != TEE_SUCCESS) { in set_operation_key2()
735 if (res == TEE_ERROR_CORRUPT_OBJECT) in set_operation_key2()
741 if ((key_info2.objectUsage & operation->info. in set_operation_key2()
751 if (key_info1.objectSize != key_info2.objectSize) { in set_operation_key2()
757 if (operation->info.maxKeySize < key_info1.objectSize) { in set_operation_key2()
773 if (res != TEE_SUCCESS) in set_operation_key2()
776 if (res != TEE_SUCCESS) { in set_operation_key2()
777 if (res == TEE_ERROR_CORRUPT_OBJECT) in set_operation_key2()
786 if (operation->operationState != TEE_OPERATION_STATE_INITIAL) in set_operation_key2()
789 if (res != TEE_SUCCESS && in set_operation_key2()
802 if (operation != TEE_HANDLE_NULL && key1 && key1 == key2) in TEE_SetOperationKey2()
812 if (operation == TEE_HANDLE_NULL || in __GP11_TEE_SetOperationKey2()
823 if (dst_op == TEE_HANDLE_NULL || src_op == TEE_HANDLE_NULL) in TEE_CopyOperation()
825 if (dst_op->info.algorithm != src_op->info.algorithm) in TEE_CopyOperation()
827 if (dst_op->info.mode != src_op->info.mode) in TEE_CopyOperation()
829 if (src_op->info.operationClass != TEE_OPERATION_DIGEST) { in TEE_CopyOperation()
833 if (src_op->info.handleState & TEE_HANDLE_FLAG_KEY_SET) { in TEE_CopyOperation()
838 if ((src_op->info.handleState & in TEE_CopyOperation()
850 if (dst_op->buffer_two_blocks != src_op->buffer_two_blocks || in TEE_CopyOperation()
854 if (dst_op->buffer != NULL) { in TEE_CopyOperation()
857 if (src_op->buffer == NULL) in TEE_CopyOperation()
860 if (src_op->buffer_two_blocks) in TEE_CopyOperation()
864 } else if (src_op->buffer != NULL) { in TEE_CopyOperation()
869 if (res != TEE_SUCCESS) in TEE_CopyOperation()
885 if (res != TEE_SUCCESS) in init_hash_operation()
896 if (operation == TEE_HANDLE_NULL || in TEE_DigestUpdate()
903 if (res != TEE_SUCCESS) in TEE_DigestUpdate()
920 if ((operation == TEE_HANDLE_NULL) || in TEE_DigestDoFinal()
926 if (operation->operationState == TEE_OPERATION_STATE_EXTRACTING && in TEE_DigestDoFinal()
933 if (operation->operationState == TEE_OPERATION_STATE_EXTRACTING && in TEE_DigestDoFinal()
948 if (res) in TEE_DigestDoFinal()
958 if (res != TEE_SUCCESS && in TEE_DigestDoFinal()
986 if (operation == TEE_HANDLE_NULL || in TEE_DigestExtract()
991 if (!operation->buffer) { in TEE_DigestExtract()
997 if (res) in TEE_DigestExtract()
1004 if (operation->operationState != TEE_OPERATION_STATE_EXTRACTING) { in TEE_DigestExtract()
1008 if (res) in TEE_DigestExtract()
1010 if (hl != operation->block_size) in TEE_DigestExtract()
1032 if (operation == TEE_HANDLE_NULL) in TEE_CipherInit()
1035 if (operation->info.operationClass != TEE_OPERATION_CIPHER) in TEE_CipherInit()
1038 if (!(operation->info.handleState & TEE_HANDLE_FLAG_KEY_SET) || in TEE_CipherInit()
1042 if (operation->operationState != TEE_OPERATION_STATE_INITIAL) in TEE_CipherInit()
1045 if (IV && IVLen) { in TEE_CipherInit()
1046 if (operation->info.algorithm == TEE_ALG_AES_ECB_NOPAD || in TEE_CipherInit()
1056 if (res != TEE_SUCCESS) in TEE_CipherInit()
1087 if (!src) { in tee_buffer_update()
1088 if (slen) in tee_buffer_update()
1093 if (op->buffer_two_blocks) { in tee_buffer_update()
1101 if (op->buffer_offs > 0) { in tee_buffer_update()
1103 if (op->buffer_offs < op->block_size) in tee_buffer_update()
1111 if ((op->buffer_offs % op->block_size) != 0) in tee_buffer_update()
1115 /* If we can feed from buffer */ in tee_buffer_update()
1116 if ((op->buffer_offs > 0) && in tee_buffer_update()
1122 * If we're buffering only a single block, process it in tee_buffer_update()
1125 if (!op->buffer_two_blocks) in tee_buffer_update()
1129 if (res != TEE_SUCCESS) in tee_buffer_update()
1135 if (op->buffer_offs > 0) { in tee_buffer_update()
1146 if (slen >= (buffer_size + buffer_left)) { in tee_buffer_update()
1148 if (op->buffer_two_blocks) in tee_buffer_update()
1155 if (res != TEE_SUCCESS) in tee_buffer_update()
1180 if (operation == TEE_HANDLE_NULL || (!srcData && srcLen)) { in TEE_CipherUpdate()
1186 if (operation->info.operationClass != TEE_OPERATION_CIPHER) { in TEE_CipherUpdate()
1191 if ((operation->info.handleState & TEE_HANDLE_FLAG_INITIALIZED) == 0) { in TEE_CipherUpdate()
1196 if (operation->operationState != TEE_OPERATION_STATE_ACTIVE) { in TEE_CipherUpdate()
1201 if (!srcData && !srcLen) { in TEE_CipherUpdate()
1208 if (operation->block_size > 1) { in TEE_CipherUpdate()
1214 if (operation->buffer_two_blocks) { in TEE_CipherUpdate()
1215 if (operation->buffer_offs + srcLen > in TEE_CipherUpdate()
1229 if (*destLen < req_dlen) { in TEE_CipherUpdate()
1236 if (operation->block_size > 1) { in TEE_CipherUpdate()
1240 if (srcLen > 0) { in TEE_CipherUpdate()
1251 if (res != TEE_SUCCESS && in TEE_CipherUpdate()
1282 if (operation == TEE_HANDLE_NULL || (!srcData && srcLen)) { in TEE_CipherDoFinal()
1286 if (destLen) in TEE_CipherDoFinal()
1289 if (operation->info.operationClass != TEE_OPERATION_CIPHER) { in TEE_CipherDoFinal()
1294 if ((operation->info.handleState & TEE_HANDLE_FLAG_INITIALIZED) == 0) { in TEE_CipherDoFinal()
1299 if (operation->operationState != TEE_OPERATION_STATE_ACTIVE) { in TEE_CipherDoFinal()
1308 if (operation->info.algorithm == TEE_ALG_AES_ECB_NOPAD || in TEE_CipherDoFinal()
1316 if (((operation->buffer_offs + srcLen) % operation->block_size) in TEE_CipherDoFinal()
1328 if (operation->block_size > 1) { in TEE_CipherDoFinal()
1333 if (destLen) in TEE_CipherDoFinal()
1335 if (tmp_dlen < req_dlen) { in TEE_CipherDoFinal()
1336 if (destLen) in TEE_CipherDoFinal()
1342 if (operation->block_size > 1) { in TEE_CipherDoFinal()
1343 if (srcLen) { in TEE_CipherDoFinal()
1347 if (res != TEE_SUCCESS) in TEE_CipherDoFinal()
1362 if (res != TEE_SUCCESS) in TEE_CipherDoFinal()
1366 if (destLen) in TEE_CipherDoFinal()
1374 if (res != TEE_SUCCESS && in TEE_CipherDoFinal()
1388 if (destLen) { in __GP11_TEE_CipherDoFinal()
1393 if (destLen) in __GP11_TEE_CipherDoFinal()
1402 if (operation == TEE_HANDLE_NULL) in TEE_MACInit()
1405 if (operation->info.operationClass != TEE_OPERATION_MAC) in TEE_MACInit()
1408 if (!(operation->info.handleState & TEE_HANDLE_FLAG_KEY_SET) || in TEE_MACInit()
1412 if (operation->operationState != TEE_OPERATION_STATE_INITIAL) in TEE_MACInit()
1431 if (operation == TEE_HANDLE_NULL || (chunk == NULL && chunkSize != 0)) in TEE_MACUpdate()
1434 if (operation->info.operationClass != TEE_OPERATION_MAC) in TEE_MACUpdate()
1437 if ((operation->info.handleState & TEE_HANDLE_FLAG_INITIALIZED) == 0) in TEE_MACUpdate()
1440 if (operation->operationState != TEE_OPERATION_STATE_ACTIVE) in TEE_MACUpdate()
1444 if (res != TEE_SUCCESS) in TEE_MACUpdate()
1461 if (operation == TEE_HANDLE_NULL || (!message && messageLen)) { in TEE_MACComputeFinal()
1467 if (operation->info.operationClass != TEE_OPERATION_MAC) { in TEE_MACComputeFinal()
1472 if ((operation->info.handleState & TEE_HANDLE_FLAG_INITIALIZED) == 0) { in TEE_MACComputeFinal()
1477 if (operation->operationState != TEE_OPERATION_STATE_ACTIVE) { in TEE_MACComputeFinal()
1485 if (res != TEE_SUCCESS) in TEE_MACComputeFinal()
1493 if (res != TEE_SUCCESS && in TEE_MACComputeFinal()
1522 if (operation->info.operationClass != TEE_OPERATION_MAC) { in TEE_MACCompareFinal()
1527 if ((operation->info.handleState & TEE_HANDLE_FLAG_INITIALIZED) == 0) { in TEE_MACCompareFinal()
1532 if (operation->operationState != TEE_OPERATION_STATE_ACTIVE) { in TEE_MACCompareFinal()
1539 if (res != TEE_SUCCESS) in TEE_MACCompareFinal()
1542 if (computed_mac_size != macLen) { in TEE_MACCompareFinal()
1547 if (consttime_memcmp(mac, computed_mac, computed_mac_size) != 0) { in TEE_MACCompareFinal()
1555 if (res != TEE_SUCCESS && in TEE_MACCompareFinal()
1577 if (operation == TEE_HANDLE_NULL || nonce == NULL) { in TEE_AEInit()
1582 if (operation->info.operationClass != TEE_OPERATION_AE) { in TEE_AEInit()
1587 if (operation->operationState != TEE_OPERATION_STATE_INITIAL) { in TEE_AEInit()
1598 if (operation->info.algorithm == TEE_ALG_AES_GCM) { in TEE_AEInit()
1602 if (tagLen < 96 || tagLen > 128 || (tagLen % 8 != 0)) { in TEE_AEInit()
1610 if (res != TEE_SUCCESS) in TEE_AEInit()
1618 if (res != TEE_SUCCESS && in TEE_AEInit()
1638 if (operation == TEE_HANDLE_NULL || (!AADdata && AADdataLen)) in TEE_AEUpdateAAD()
1641 if (operation->info.operationClass != TEE_OPERATION_AE) in TEE_AEUpdateAAD()
1644 if (operation->operationState != TEE_OPERATION_STATE_INITIAL) in TEE_AEUpdateAAD()
1647 if ((operation->info.handleState & TEE_HANDLE_FLAG_INITIALIZED) == 0) in TEE_AEUpdateAAD()
1651 if (res != TEE_SUCCESS) in TEE_AEUpdateAAD()
1660 if (operation == TEE_HANDLE_NULL || in __GP11_TEE_AEUpdateAAD()
1664 if (operation->info.operationClass != TEE_OPERATION_AE) in __GP11_TEE_AEUpdateAAD()
1667 if ((operation->info.handleState & TEE_HANDLE_FLAG_INITIALIZED) == 0) in __GP11_TEE_AEUpdateAAD()
1674 if (res != TEE_SUCCESS) in __GP11_TEE_AEUpdateAAD()
1686 if (!src && !slen) { in ae_update_helper()
1696 if (operation->block_size > 1) { in ae_update_helper()
1704 if (dl < req_dlen) { in ae_update_helper()
1709 if (operation->block_size > 1) { in ae_update_helper()
1713 if (slen > 0) { in ae_update_helper()
1722 if (!res) in ae_update_helper()
1733 if (operation == TEE_HANDLE_NULL || (!srcData && srcLen)) { in TEE_AEUpdate()
1739 if (operation->info.operationClass != TEE_OPERATION_AE) { in TEE_AEUpdate()
1744 if ((operation->info.handleState & TEE_HANDLE_FLAG_INITIALIZED) == 0) { in TEE_AEUpdate()
1750 if (res != TEE_ERROR_SHORT_BUFFER && srcLen) in TEE_AEUpdate()
1754 if (res != TEE_SUCCESS && in TEE_AEUpdate()
1768 if (operation == TEE_HANDLE_NULL || (!srcData && srcLen)) { in __GP11_TEE_AEUpdate()
1774 if (operation->info.operationClass != TEE_OPERATION_AE) { in __GP11_TEE_AEUpdate()
1779 if ((operation->info.handleState & TEE_HANDLE_FLAG_INITIALIZED) == 0) { in __GP11_TEE_AEUpdate()
1788 if (res != TEE_SUCCESS) in __GP11_TEE_AEUpdate()
1794 if (res != TEE_SUCCESS && in __GP11_TEE_AEUpdate()
1813 if (operation == TEE_HANDLE_NULL || (!srcData && srcLen)) { in TEE_AEEncryptFinal()
1820 if (operation->info.operationClass != TEE_OPERATION_AE) { in TEE_AEEncryptFinal()
1825 if ((operation->info.handleState & TEE_HANDLE_FLAG_INITIALIZED) == 0) { in TEE_AEEncryptFinal()
1835 * Need to check this before update_payload since sync would be lost if in TEE_AEEncryptFinal()
1841 if (*destLen < req_dlen) { in TEE_AEEncryptFinal()
1846 if (*tagLen < operation->info.digestLength) { in TEE_AEEncryptFinal()
1851 if (res == TEE_ERROR_SHORT_BUFFER) in TEE_AEEncryptFinal()
1856 if (operation->block_size > 1) { in TEE_AEEncryptFinal()
1859 if (res != TEE_SUCCESS) in TEE_AEEncryptFinal()
1876 if (res != TEE_SUCCESS) in TEE_AEEncryptFinal()
1887 if (res != TEE_SUCCESS && in TEE_AEEncryptFinal()
1925 if (operation == TEE_HANDLE_NULL || (!srcData && srcLen)) { in TEE_AEDecryptFinal()
1931 if (operation->info.operationClass != TEE_OPERATION_AE) { in TEE_AEDecryptFinal()
1936 if ((operation->info.handleState & TEE_HANDLE_FLAG_INITIALIZED) == 0) { in TEE_AEDecryptFinal()
1947 if (*destLen < req_dlen) { in TEE_AEDecryptFinal()
1954 if (operation->block_size > 1) { in TEE_AEDecryptFinal()
1957 if (res != TEE_SUCCESS) in TEE_AEDecryptFinal()
1973 if (res != TEE_SUCCESS) in TEE_AEDecryptFinal()
1977 if (tagLen != operation->info.digestLength) in TEE_AEDecryptFinal()
1988 if (res != TEE_SUCCESS && in TEE_AEDecryptFinal()
2024 if (operation == TEE_HANDLE_NULL || (!srcData && srcLen)) in TEE_AsymmetricEncrypt()
2030 if (!operation->key1) in TEE_AsymmetricEncrypt()
2032 if (operation->info.operationClass != TEE_OPERATION_ASYMMETRIC_CIPHER) in TEE_AsymmetricEncrypt()
2034 if (operation->info.mode != TEE_MODE_ENCRYPT) in TEE_AsymmetricEncrypt()
2043 if (res != TEE_SUCCESS && in TEE_AsymmetricEncrypt()
2063 if (operation == TEE_HANDLE_NULL || (!srcData && srcLen)) in __GP11_TEE_AsymmetricEncrypt()
2069 if (!operation->key1) in __GP11_TEE_AsymmetricEncrypt()
2071 if (operation->info.operationClass != TEE_OPERATION_ASYMMETRIC_CIPHER) in __GP11_TEE_AsymmetricEncrypt()
2073 if (operation->info.mode != TEE_MODE_ENCRYPT) in __GP11_TEE_AsymmetricEncrypt()
2082 if (res != TEE_SUCCESS && in __GP11_TEE_AsymmetricEncrypt()
2100 if (operation == TEE_HANDLE_NULL || (!srcData && srcLen)) in TEE_AsymmetricDecrypt()
2106 if (!operation->key1) in TEE_AsymmetricDecrypt()
2108 if (operation->info.operationClass != TEE_OPERATION_ASYMMETRIC_CIPHER) in TEE_AsymmetricDecrypt()
2110 if (operation->info.mode != TEE_MODE_DECRYPT) in TEE_AsymmetricDecrypt()
2119 if (res != TEE_SUCCESS && in TEE_AsymmetricDecrypt()
2139 if (operation == TEE_HANDLE_NULL || (!srcData && srcLen)) in __GP11_TEE_AsymmetricDecrypt()
2145 if (!operation->key1) in __GP11_TEE_AsymmetricDecrypt()
2147 if (operation->info.operationClass != TEE_OPERATION_ASYMMETRIC_CIPHER) in __GP11_TEE_AsymmetricDecrypt()
2149 if (operation->info.mode != TEE_MODE_DECRYPT) in __GP11_TEE_AsymmetricDecrypt()
2158 if (res != TEE_SUCCESS && in __GP11_TEE_AsymmetricDecrypt()
2176 if (operation == TEE_HANDLE_NULL || (!digest && digestLen)) in TEE_AsymmetricSignDigest()
2182 if (!operation->key1) in TEE_AsymmetricSignDigest()
2184 if (operation->info.operationClass != in TEE_AsymmetricSignDigest()
2187 if (operation->info.mode != TEE_MODE_SIGN) in TEE_AsymmetricSignDigest()
2196 if (res != TEE_SUCCESS && res != TEE_ERROR_SHORT_BUFFER) in TEE_AsymmetricSignDigest()
2213 if (operation == TEE_HANDLE_NULL || (!digest && digestLen)) in __GP11_TEE_AsymmetricSignDigest()
2219 if (!operation->key1) in __GP11_TEE_AsymmetricSignDigest()
2221 if (operation->info.operationClass != in __GP11_TEE_AsymmetricSignDigest()
2224 if (operation->info.mode != TEE_MODE_SIGN) in __GP11_TEE_AsymmetricSignDigest()
2233 if (res != TEE_SUCCESS && res != TEE_ERROR_SHORT_BUFFER) in __GP11_TEE_AsymmetricSignDigest()
2249 if (operation == TEE_HANDLE_NULL || in TEE_AsymmetricVerifyDigest()
2256 if (!operation->key1) in TEE_AsymmetricVerifyDigest()
2258 if (operation->info.operationClass != in TEE_AsymmetricVerifyDigest()
2261 if (operation->info.mode != TEE_MODE_VERIFY) in TEE_AsymmetricVerifyDigest()
2268 if (res != TEE_SUCCESS && res != TEE_ERROR_SIGNATURE_INVALID) in TEE_AsymmetricVerifyDigest()
2285 if (operation == TEE_HANDLE_NULL || (!digest && digestLen) || in __GP11_TEE_AsymmetricVerifyDigest()
2291 if (!operation->key1) in __GP11_TEE_AsymmetricVerifyDigest()
2293 if (operation->info.operationClass != in __GP11_TEE_AsymmetricVerifyDigest()
2296 if (operation->info.mode != TEE_MODE_VERIFY) in __GP11_TEE_AsymmetricVerifyDigest()
2303 if (res != TEE_SUCCESS && res != TEE_ERROR_SIGNATURE_INVALID) in __GP11_TEE_AsymmetricVerifyDigest()
2319 if (operation == TEE_HANDLE_NULL || derivedKey == 0) in TEE_DeriveKey()
2324 if (TEE_ALG_GET_CLASS(operation->info.algorithm) != in TEE_DeriveKey()
2328 if (operation->info.operationClass != TEE_OPERATION_KEY_DERIVATION) in TEE_DeriveKey()
2330 if (!operation->key1) in TEE_DeriveKey()
2332 if (operation->info.mode != TEE_MODE_DERIVE) in TEE_DeriveKey()
2334 if ((operation->info.handleState & TEE_HANDLE_FLAG_KEY_SET) == 0) in TEE_DeriveKey()
2338 if (res != TEE_SUCCESS) in TEE_DeriveKey()
2341 if (key_info.obj_type != TEE_TYPE_GENERIC_SECRET) in TEE_DeriveKey()
2343 if ((key_info.handle_flags & TEE_HANDLE_FLAG_INITIALIZED) != 0) in TEE_DeriveKey()
2349 if (res != TEE_SUCCESS) in TEE_DeriveKey()
2361 if (operation == TEE_HANDLE_NULL || derivedKey == 0) in __GP11_TEE_DeriveKey()
2366 if (TEE_ALG_GET_CLASS(operation->info.algorithm) != in __GP11_TEE_DeriveKey()
2370 if (operation->info.operationClass != TEE_OPERATION_KEY_DERIVATION) in __GP11_TEE_DeriveKey()
2372 if (!operation->key1) in __GP11_TEE_DeriveKey()
2374 if (operation->info.mode != TEE_MODE_DERIVE) in __GP11_TEE_DeriveKey()
2376 if ((operation->info.handleState & TEE_HANDLE_FLAG_KEY_SET) == 0) in __GP11_TEE_DeriveKey()
2380 if (res != TEE_SUCCESS) in __GP11_TEE_DeriveKey()
2383 if (key_info.obj_type != TEE_TYPE_GENERIC_SECRET) in __GP11_TEE_DeriveKey()
2385 if ((key_info.handle_flags & TEE_HANDLE_FLAG_INITIALIZED) != 0) in __GP11_TEE_DeriveKey()
2391 if (res != TEE_SUCCESS) in __GP11_TEE_DeriveKey()
2402 if (res != TEE_SUCCESS) in TEE_GenerateRandom()
2426 if (IS_ENABLED(CFG_CRYPTO_AES)) { in TEE_IsAlgorithmSupported()
2427 if (IS_ENABLED(CFG_CRYPTO_ECB)) { in TEE_IsAlgorithmSupported()
2428 if (alg == TEE_ALG_AES_ECB_NOPAD) in TEE_IsAlgorithmSupported()
2431 if (IS_ENABLED(CFG_CRYPTO_CBC)) { in TEE_IsAlgorithmSupported()
2432 if (alg == TEE_ALG_AES_CBC_NOPAD) in TEE_IsAlgorithmSupported()
2435 if (IS_ENABLED(CFG_CRYPTO_CTR)) { in TEE_IsAlgorithmSupported()
2436 if (alg == TEE_ALG_AES_CTR) in TEE_IsAlgorithmSupported()
2439 if (IS_ENABLED(CFG_CRYPTO_CTS)) { in TEE_IsAlgorithmSupported()
2440 if (alg == TEE_ALG_AES_CTS) in TEE_IsAlgorithmSupported()
2443 if (IS_ENABLED(CFG_CRYPTO_XTS)) { in TEE_IsAlgorithmSupported()
2444 if (alg == TEE_ALG_AES_XTS) in TEE_IsAlgorithmSupported()
2447 if (IS_ENABLED(CFG_CRYPTO_CBC_MAC)) { in TEE_IsAlgorithmSupported()
2448 if (alg == TEE_ALG_AES_CBC_MAC_NOPAD || in TEE_IsAlgorithmSupported()
2452 if (IS_ENABLED(CFG_CRYPTO_CMAC)) { in TEE_IsAlgorithmSupported()
2453 if (alg == TEE_ALG_AES_CMAC) in TEE_IsAlgorithmSupported()
2456 if (IS_ENABLED(CFG_CRYPTO_CCM)) { in TEE_IsAlgorithmSupported()
2457 if (alg == TEE_ALG_AES_CCM) in TEE_IsAlgorithmSupported()
2460 if (IS_ENABLED(CFG_CRYPTO_GCM)) { in TEE_IsAlgorithmSupported()
2461 if (alg == TEE_ALG_AES_GCM) in TEE_IsAlgorithmSupported()
2465 if (IS_ENABLED(CFG_CRYPTO_DES)) { in TEE_IsAlgorithmSupported()
2466 if (IS_ENABLED(CFG_CRYPTO_ECB)) { in TEE_IsAlgorithmSupported()
2467 if (alg == TEE_ALG_DES_ECB_NOPAD || in TEE_IsAlgorithmSupported()
2471 if (IS_ENABLED(CFG_CRYPTO_CBC)) { in TEE_IsAlgorithmSupported()
2472 if (alg == TEE_ALG_DES_CBC_NOPAD || in TEE_IsAlgorithmSupported()
2476 if (IS_ENABLED(CFG_CRYPTO_CBC_MAC)) { in TEE_IsAlgorithmSupported()
2477 if (alg == TEE_ALG_DES_CBC_MAC_NOPAD || in TEE_IsAlgorithmSupported()
2484 if (IS_ENABLED(CFG_CRYPTO_MD5)) { in TEE_IsAlgorithmSupported()
2485 if (alg == TEE_ALG_MD5) in TEE_IsAlgorithmSupported()
2488 if (IS_ENABLED(CFG_CRYPTO_SHA1)) { in TEE_IsAlgorithmSupported()
2489 if (alg == TEE_ALG_SHA1) in TEE_IsAlgorithmSupported()
2492 if (IS_ENABLED(CFG_CRYPTO_SHA224)) { in TEE_IsAlgorithmSupported()
2493 if (alg == TEE_ALG_SHA224) in TEE_IsAlgorithmSupported()
2496 if (IS_ENABLED(CFG_CRYPTO_SHA256)) { in TEE_IsAlgorithmSupported()
2497 if (alg == TEE_ALG_SHA256) in TEE_IsAlgorithmSupported()
2500 if (IS_ENABLED(CFG_CRYPTO_SHA384)) { in TEE_IsAlgorithmSupported()
2501 if (alg == TEE_ALG_SHA384) in TEE_IsAlgorithmSupported()
2504 if (IS_ENABLED(CFG_CRYPTO_SHA512)) { in TEE_IsAlgorithmSupported()
2505 if (alg == TEE_ALG_SHA512) in TEE_IsAlgorithmSupported()
2508 if (IS_ENABLED(CFG_CRYPTO_SHA3_224)) { in TEE_IsAlgorithmSupported()
2509 if (alg == TEE_ALG_SHA3_224) in TEE_IsAlgorithmSupported()
2512 if (IS_ENABLED(CFG_CRYPTO_SHA3_256)) { in TEE_IsAlgorithmSupported()
2513 if (alg == TEE_ALG_SHA3_256) in TEE_IsAlgorithmSupported()
2516 if (IS_ENABLED(CFG_CRYPTO_SHA3_384)) { in TEE_IsAlgorithmSupported()
2517 if (alg == TEE_ALG_SHA3_384) in TEE_IsAlgorithmSupported()
2520 if (IS_ENABLED(CFG_CRYPTO_SHA3_512)) { in TEE_IsAlgorithmSupported()
2521 if (alg == TEE_ALG_SHA3_512) in TEE_IsAlgorithmSupported()
2524 if (IS_ENABLED(CFG_CRYPTO_MD5) && IS_ENABLED(CFG_CRYPTO_SHA1)) { in TEE_IsAlgorithmSupported()
2525 if (alg == TEE_ALG_MD5SHA1) in TEE_IsAlgorithmSupported()
2528 if (IS_ENABLED(CFG_CRYPTO_HMAC)) { in TEE_IsAlgorithmSupported()
2529 if (IS_ENABLED(CFG_CRYPTO_MD5)) { in TEE_IsAlgorithmSupported()
2530 if (alg == TEE_ALG_HMAC_MD5) in TEE_IsAlgorithmSupported()
2533 if (IS_ENABLED(CFG_CRYPTO_SHA1)) { in TEE_IsAlgorithmSupported()
2534 if (alg == TEE_ALG_HMAC_SHA1) in TEE_IsAlgorithmSupported()
2537 if (IS_ENABLED(CFG_CRYPTO_SHA224)) { in TEE_IsAlgorithmSupported()
2538 if (alg == TEE_ALG_HMAC_SHA224) in TEE_IsAlgorithmSupported()
2541 if (IS_ENABLED(CFG_CRYPTO_SHA256)) { in TEE_IsAlgorithmSupported()
2542 if (alg == TEE_ALG_HMAC_SHA256) in TEE_IsAlgorithmSupported()
2545 if (IS_ENABLED(CFG_CRYPTO_SHA384)) { in TEE_IsAlgorithmSupported()
2546 if (alg == TEE_ALG_HMAC_SHA384) in TEE_IsAlgorithmSupported()
2549 if (IS_ENABLED(CFG_CRYPTO_SHA512)) { in TEE_IsAlgorithmSupported()
2550 if (alg == TEE_ALG_HMAC_SHA512) in TEE_IsAlgorithmSupported()
2553 if (IS_ENABLED(CFG_CRYPTO_SHA3_224)) { in TEE_IsAlgorithmSupported()
2554 if (alg == TEE_ALG_HMAC_SHA3_224) in TEE_IsAlgorithmSupported()
2557 if (IS_ENABLED(CFG_CRYPTO_SHA3_256)) { in TEE_IsAlgorithmSupported()
2558 if (alg == TEE_ALG_HMAC_SHA3_256) in TEE_IsAlgorithmSupported()
2561 if (IS_ENABLED(CFG_CRYPTO_SHA3_384)) { in TEE_IsAlgorithmSupported()
2562 if (alg == TEE_ALG_HMAC_SHA3_384) in TEE_IsAlgorithmSupported()
2565 if (IS_ENABLED(CFG_CRYPTO_SHA3_512)) { in TEE_IsAlgorithmSupported()
2566 if (alg == TEE_ALG_HMAC_SHA3_512) in TEE_IsAlgorithmSupported()
2569 if (IS_ENABLED(CFG_CRYPTO_SM3)) { in TEE_IsAlgorithmSupported()
2570 if (alg == TEE_ALG_HMAC_SM3) in TEE_IsAlgorithmSupported()
2574 if (IS_ENABLED(CFG_CRYPTO_SM3)) { in TEE_IsAlgorithmSupported()
2575 if (alg == TEE_ALG_SM3) in TEE_IsAlgorithmSupported()
2578 if (IS_ENABLED(CFG_CRYPTO_SM4)) { in TEE_IsAlgorithmSupported()
2579 if (IS_ENABLED(CFG_CRYPTO_ECB)) { in TEE_IsAlgorithmSupported()
2580 if (alg == TEE_ALG_SM4_ECB_NOPAD) in TEE_IsAlgorithmSupported()
2583 if (IS_ENABLED(CFG_CRYPTO_CBC)) { in TEE_IsAlgorithmSupported()
2584 if (alg == TEE_ALG_SM4_CBC_NOPAD) in TEE_IsAlgorithmSupported()
2587 if (IS_ENABLED(CFG_CRYPTO_CTR)) { in TEE_IsAlgorithmSupported()
2588 if (alg == TEE_ALG_SM4_CTR) in TEE_IsAlgorithmSupported()
2591 if (IS_ENABLED(CFG_CRYPTO_XTS)) { in TEE_IsAlgorithmSupported()
2592 if (alg == TEE_ALG_SM4_XTS) in TEE_IsAlgorithmSupported()
2596 if (IS_ENABLED(CFG_CRYPTO_RSA)) { in TEE_IsAlgorithmSupported()
2597 if (IS_ENABLED(CFG_CRYPTO_MD5)) { in TEE_IsAlgorithmSupported()
2598 if (alg == TEE_ALG_RSASSA_PKCS1_V1_5_MD5 || in TEE_IsAlgorithmSupported()
2603 if (IS_ENABLED(CFG_CRYPTO_SHA1)) { in TEE_IsAlgorithmSupported()
2604 if (alg == TEE_ALG_RSASSA_PKCS1_V1_5_SHA1 || in TEE_IsAlgorithmSupported()
2609 if (IS_ENABLED(CFG_CRYPTO_MD5) && IS_ENABLED(CFG_CRYPTO_SHA1)) { in TEE_IsAlgorithmSupported()
2610 if (alg == TEE_ALG_RSASSA_PKCS1_V1_5_MD5SHA1) in TEE_IsAlgorithmSupported()
2613 if (IS_ENABLED(CFG_CRYPTO_SHA224)) { in TEE_IsAlgorithmSupported()
2614 if (alg == TEE_ALG_RSASSA_PKCS1_V1_5_SHA224 || in TEE_IsAlgorithmSupported()
2619 if (IS_ENABLED(CFG_CRYPTO_SHA256)) { in TEE_IsAlgorithmSupported()
2620 if (alg == TEE_ALG_RSASSA_PKCS1_V1_5_SHA256 || in TEE_IsAlgorithmSupported()
2625 if (IS_ENABLED(CFG_CRYPTO_SHA384)) { in TEE_IsAlgorithmSupported()
2626 if (alg == TEE_ALG_RSASSA_PKCS1_V1_5_SHA384 || in TEE_IsAlgorithmSupported()
2631 if (IS_ENABLED(CFG_CRYPTO_SHA512)) { in TEE_IsAlgorithmSupported()
2632 if (alg == TEE_ALG_RSASSA_PKCS1_V1_5_SHA512 || in TEE_IsAlgorithmSupported()
2637 if (IS_ENABLED(CFG_CRYPTO_RSASSA_NA1)) { in TEE_IsAlgorithmSupported()
2638 if (alg == TEE_ALG_RSASSA_PKCS1_V1_5) in TEE_IsAlgorithmSupported()
2641 if (alg == TEE_ALG_RSA_NOPAD) in TEE_IsAlgorithmSupported()
2644 if (IS_ENABLED(CFG_CRYPTO_DSA)) { in TEE_IsAlgorithmSupported()
2645 if (IS_ENABLED(CFG_CRYPTO_SHA1)) { in TEE_IsAlgorithmSupported()
2646 if (alg == TEE_ALG_DSA_SHA1) in TEE_IsAlgorithmSupported()
2649 if (IS_ENABLED(CFG_CRYPTO_SHA224)) { in TEE_IsAlgorithmSupported()
2650 if (alg == TEE_ALG_DSA_SHA224) in TEE_IsAlgorithmSupported()
2653 if (IS_ENABLED(CFG_CRYPTO_SHA256)) { in TEE_IsAlgorithmSupported()
2654 if (alg == TEE_ALG_DSA_SHA256) in TEE_IsAlgorithmSupported()
2658 if (IS_ENABLED(CFG_CRYPTO_DH)) { in TEE_IsAlgorithmSupported()
2659 if (alg == TEE_ALG_DH_DERIVE_SHARED_SECRET) in TEE_IsAlgorithmSupported()
2662 if (IS_ENABLED(CFG_CRYPTO_ECC)) { in TEE_IsAlgorithmSupported()
2663 if ((alg == __OPTEE_ALG_ECDH_P192 || in TEE_IsAlgorithmSupported()
2669 if ((alg == __OPTEE_ALG_ECDH_P224 || in TEE_IsAlgorithmSupported()
2675 if ((alg == __OPTEE_ALG_ECDH_P256 || in TEE_IsAlgorithmSupported()
2681 if ((alg == __OPTEE_ALG_ECDH_P384 || in TEE_IsAlgorithmSupported()
2687 if ((alg == __OPTEE_ALG_ECDH_P521 || in TEE_IsAlgorithmSupported()
2694 if (IS_ENABLED(CFG_CRYPTO_SM2_DSA)) { in TEE_IsAlgorithmSupported()
2695 if (alg == TEE_ALG_SM2_DSA_SM3 && element == TEE_ECC_CURVE_SM2) in TEE_IsAlgorithmSupported()
2698 if (IS_ENABLED(CFG_CRYPTO_SM2_KEP)) { in TEE_IsAlgorithmSupported()
2699 if (alg == TEE_ALG_SM2_KEP && element == TEE_ECC_CURVE_SM2) in TEE_IsAlgorithmSupported()
2702 if (IS_ENABLED(CFG_CRYPTO_SM2_PKE)) { in TEE_IsAlgorithmSupported()
2703 if (alg == TEE_ALG_SM2_PKE && element == TEE_ECC_CURVE_SM2) in TEE_IsAlgorithmSupported()
2706 if (IS_ENABLED(CFG_CRYPTO_X25519)) { in TEE_IsAlgorithmSupported()
2707 if (alg == TEE_ALG_X25519 && element == TEE_ECC_CURVE_25519) in TEE_IsAlgorithmSupported()
2710 if (IS_ENABLED(CFG_CRYPTO_ED25519)) { in TEE_IsAlgorithmSupported()
2711 if (alg == TEE_ALG_ED25519 && element == TEE_ECC_CURVE_25519) in TEE_IsAlgorithmSupported()
2717 if (element == TEE_CRYPTO_ELEMENT_NONE) in TEE_IsAlgorithmSupported()