Lines Matching refs:op

43 	TEE_OperationHandle op = TEE_HANDLE_NULL;  in TEE_AllocateOperation()  local
313 op = TEE_Malloc(sizeof(*op), TEE_MALLOC_FILL_ZERO); in TEE_AllocateOperation()
314 if (!op) in TEE_AllocateOperation()
317 op->info.algorithm = algorithm; in TEE_AllocateOperation()
318 op->info.operationClass = TEE_ALG_GET_CLASS(algorithm); in TEE_AllocateOperation()
321 op->info.operationClass = TEE_OPERATION_ASYMMETRIC_SIGNATURE; in TEE_AllocateOperation()
323 op->info.mode = mode; in TEE_AllocateOperation()
324 op->info.digestLength = TEE_ALG_GET_DIGEST_SIZE(algorithm); in TEE_AllocateOperation()
325 op->info.maxKeySize = maxKeySize; in TEE_AllocateOperation()
326 op->info.requiredKeyUsage = req_key_usage; in TEE_AllocateOperation()
327 op->info.handleState = handle_state; in TEE_AllocateOperation()
333 if (op->info.operationClass == TEE_OPERATION_DIGEST) in TEE_AllocateOperation()
334 block_size = op->info.digestLength; in TEE_AllocateOperation()
342 op->buffer = TEE_Malloc(buffer_size, in TEE_AllocateOperation()
344 if (op->buffer == NULL) { in TEE_AllocateOperation()
349 op->block_size = block_size; in TEE_AllocateOperation()
350 op->buffer_two_blocks = buffer_two_blocks; in TEE_AllocateOperation()
361 if (op->info.handleState & TEE_HANDLE_FLAG_EXPECT_TWO_KEYS) in TEE_AllocateOperation()
364 res = TEE_AllocateTransientObject(key_type, mks, &op->key1); in TEE_AllocateOperation()
368 if (op->info.handleState & TEE_HANDLE_FLAG_EXPECT_TWO_KEYS) { in TEE_AllocateOperation()
370 &op->key2); in TEE_AllocateOperation()
376 res = _utee_cryp_state_alloc(algorithm, mode, (unsigned long)op->key1, in TEE_AllocateOperation()
377 (unsigned long)op->key2, &op->state); in TEE_AllocateOperation()
387 res = _utee_hash_init(op->state, NULL, 0); in TEE_AllocateOperation()
391 op->info.handleState |= TEE_HANDLE_FLAG_INITIALIZED; in TEE_AllocateOperation()
394 op->operationState = TEE_OPERATION_STATE_INITIAL; in TEE_AllocateOperation()
396 *operation = op; in TEE_AllocateOperation()
403 if (op) { in TEE_AllocateOperation()
404 if (op->state) { in TEE_AllocateOperation()
405 TEE_FreeOperation(op); in TEE_AllocateOperation()
407 TEE_Free(op->buffer); in TEE_AllocateOperation()
408 TEE_FreeTransientObject(op->key1); in TEE_AllocateOperation()
409 TEE_FreeTransientObject(op->key2); in TEE_AllocateOperation()
410 TEE_Free(op); in TEE_AllocateOperation()
460 TEE_Result TEE_GetOperationInfoMultiple(TEE_OperationHandle op, in TEE_GetOperationInfoMultiple() argument
469 if (op == TEE_HANDLE_NULL) { in TEE_GetOperationInfoMultiple()
486 two_keys = op->info.handleState & TEE_HANDLE_FLAG_EXPECT_TWO_KEYS; in TEE_GetOperationInfoMultiple()
488 if (op->info.mode == TEE_MODE_DIGEST) { in TEE_GetOperationInfoMultiple()
496 res = TEE_GetObjectInfo1(op->key1, &kinfo); in TEE_GetOperationInfoMultiple()
503 op->info.requiredKeyUsage; in TEE_GetOperationInfoMultiple()
511 res = TEE_GetObjectInfo1(op->key1, &kinfo); in TEE_GetOperationInfoMultiple()
518 op->info.requiredKeyUsage; in TEE_GetOperationInfoMultiple()
520 res = TEE_GetObjectInfo1(op->key2, &kinfo); in TEE_GetOperationInfoMultiple()
527 op->info.requiredKeyUsage; in TEE_GetOperationInfoMultiple()
532 op_info->algorithm = op->info.algorithm; in TEE_GetOperationInfoMultiple()
533 op_info->operationClass = op->info.operationClass; in TEE_GetOperationInfoMultiple()
534 op_info->mode = op->info.mode; in TEE_GetOperationInfoMultiple()
535 op_info->digestLength = op->info.digestLength; in TEE_GetOperationInfoMultiple()
536 op_info->maxKeySize = op->info.maxKeySize; in TEE_GetOperationInfoMultiple()
537 op_info->handleState = op->info.handleState; in TEE_GetOperationInfoMultiple()
538 op_info->operationState = op->operationState; in TEE_GetOperationInfoMultiple()
563 static void reset_operation_state(TEE_OperationHandle op) in reset_operation_state() argument
565 op->operationState = TEE_OPERATION_STATE_INITIAL; in reset_operation_state()
567 if (op->info.operationClass == TEE_OPERATION_DIGEST) { in reset_operation_state()
568 TEE_Result res = _utee_hash_init(op->state, NULL, 0); in reset_operation_state()
572 op->info.handleState |= TEE_HANDLE_FLAG_INITIALIZED; in reset_operation_state()
574 op->info.handleState &= ~TEE_HANDLE_FLAG_INITIALIZED; in reset_operation_state()
1079 TEE_OperationHandle op, in tee_buffer_update() argument
1102 if (op->buffer_two_blocks) { in tee_buffer_update()
1103 buffer_size = op->block_size * 2; in tee_buffer_update()
1106 buffer_size = op->block_size; in tee_buffer_update()
1110 if (op->buffer_offs > 0) { in tee_buffer_update()
1112 if (op->buffer_offs < op->block_size) in tee_buffer_update()
1113 l = MIN(slen, op->block_size - op->buffer_offs); in tee_buffer_update()
1115 l = MIN(slen, buffer_size - op->buffer_offs); in tee_buffer_update()
1116 memcpy(op->buffer + op->buffer_offs, src, l); in tee_buffer_update()
1117 op->buffer_offs += l; in tee_buffer_update()
1120 if ((op->buffer_offs % op->block_size) != 0) in tee_buffer_update()
1125 if ((op->buffer_offs > 0) && in tee_buffer_update()
1126 ((op->buffer_offs + slen) >= (buffer_size + buffer_left))) { in tee_buffer_update()
1127 l = ROUNDUP2(op->buffer_offs + slen - buffer_size, in tee_buffer_update()
1128 op->block_size); in tee_buffer_update()
1129 l = MIN(op->buffer_offs, l); in tee_buffer_update()
1134 if (!op->buffer_two_blocks) in tee_buffer_update()
1135 l = op->block_size; in tee_buffer_update()
1137 res = update_func(op->state, op->buffer, l, dst, &tmp_dlen); in tee_buffer_update()
1143 op->buffer_offs -= l; in tee_buffer_update()
1144 if (op->buffer_offs > 0) { in tee_buffer_update()
1148 memcpy(op->buffer, op->buffer + l, buffer_size - l); in tee_buffer_update()
1149 memcpy(op->buffer + op->buffer_offs, src, slen); in tee_buffer_update()
1150 op->buffer_offs += slen; in tee_buffer_update()
1157 if (op->buffer_two_blocks) in tee_buffer_update()
1158 l = ROUNDUP2(slen - buffer_size, op->block_size); in tee_buffer_update()
1160 l = ROUNDUP2(slen - buffer_size + 1, op->block_size); in tee_buffer_update()
1163 res = update_func(op->state, src, l, dst, &tmp_dlen); in tee_buffer_update()
1174 memcpy(op->buffer + op->buffer_offs, src, slen); in tee_buffer_update()
1175 op->buffer_offs += slen; in tee_buffer_update()