Lines Matching refs:res

111 	TEE_Result res = TEE_SUCCESS;  in sm2_ltc_pke_decrypt()  local
136 res = ecc_populate_ltc_private_key(&ltc_key, key, TEE_ALG_SM2_PKE, in sm2_ltc_pke_decrypt()
138 if (res) in sm2_ltc_pke_decrypt()
145 res = TEE_ERROR_OUT_OF_MEMORY; in sm2_ltc_pke_decrypt()
149 res = sm2_bytes_to_point(C1, &ltc_key.dp, src, src_len, &C1_len); in sm2_ltc_pke_decrypt()
150 if (res) in sm2_ltc_pke_decrypt()
158 res = TEE_ERROR_OUT_OF_MEMORY; in sm2_ltc_pke_decrypt()
164 res = TEE_ERROR_OUT_OF_MEMORY; in sm2_ltc_pke_decrypt()
170 res = TEE_ERROR_BAD_STATE; in sm2_ltc_pke_decrypt()
177 res = TEE_ERROR_BAD_STATE; in sm2_ltc_pke_decrypt()
188 res = TEE_ERROR_BAD_STATE; in sm2_ltc_pke_decrypt()
196 res = TEE_ERROR_OUT_OF_MEMORY; in sm2_ltc_pke_decrypt()
203 res = TEE_ERROR_BAD_STATE; in sm2_ltc_pke_decrypt()
209 res = TEE_ERROR_BAD_STATE; in sm2_ltc_pke_decrypt()
221 res = TEE_ERROR_BAD_PARAMETERS; in sm2_ltc_pke_decrypt()
229 res = TEE_ERROR_OUT_OF_MEMORY; in sm2_ltc_pke_decrypt()
233 res = sm2_kdf(x2y2, sizeof(x2y2), t, C2_len); in sm2_ltc_pke_decrypt()
234 if (res) in sm2_ltc_pke_decrypt()
238 res = TEE_ERROR_CIPHERTEXT_INVALID; in sm2_ltc_pke_decrypt()
251 res = TEE_ERROR_OUT_OF_MEMORY; in sm2_ltc_pke_decrypt()
260 res = crypto_hash_alloc_ctx(&ctx, TEE_ALG_SM3); in sm2_ltc_pke_decrypt()
261 if (res) in sm2_ltc_pke_decrypt()
263 res = crypto_hash_init(ctx); in sm2_ltc_pke_decrypt()
264 if (res) in sm2_ltc_pke_decrypt()
266 res = crypto_hash_update(ctx, x2y2, SM2_INT_SIZE_BYTES); in sm2_ltc_pke_decrypt()
267 if (res) in sm2_ltc_pke_decrypt()
269 res = crypto_hash_update(ctx, dst, out_len); in sm2_ltc_pke_decrypt()
270 if (res) in sm2_ltc_pke_decrypt()
273 res = crypto_hash_update(ctx, eom, C2_len - out_len); in sm2_ltc_pke_decrypt()
274 if (res) in sm2_ltc_pke_decrypt()
277 res = crypto_hash_update(ctx, x2y2 + SM2_INT_SIZE_BYTES, in sm2_ltc_pke_decrypt()
279 if (res) in sm2_ltc_pke_decrypt()
281 res = crypto_hash_final(ctx, u, sizeof(u)); in sm2_ltc_pke_decrypt()
282 if (res) in sm2_ltc_pke_decrypt()
286 res = TEE_ERROR_CIPHERTEXT_INVALID; in sm2_ltc_pke_decrypt()
298 return res; in sm2_ltc_pke_decrypt()
334 TEE_Result res = TEE_SUCCESS; in sm2_ltc_pke_encrypt() local
353 res = ecc_populate_ltc_public_key(&ltc_key, key, TEE_ALG_SM2_PKE, NULL); in sm2_ltc_pke_encrypt()
354 if (res) in sm2_ltc_pke_encrypt()
362 res = TEE_ERROR_BAD_STATE; in sm2_ltc_pke_encrypt()
370 res = TEE_ERROR_OUT_OF_MEMORY; in sm2_ltc_pke_encrypt()
377 res = TEE_ERROR_BAD_STATE; in sm2_ltc_pke_encrypt()
386 res = TEE_ERROR_OUT_OF_MEMORY; in sm2_ltc_pke_encrypt()
392 res = TEE_ERROR_BAD_STATE; in sm2_ltc_pke_encrypt()
399 res = TEE_ERROR_BAD_STATE; in sm2_ltc_pke_encrypt()
410 res = TEE_ERROR_BAD_STATE; in sm2_ltc_pke_encrypt()
414 res = TEE_ERROR_BAD_STATE; in sm2_ltc_pke_encrypt()
422 res = TEE_ERROR_OUT_OF_MEMORY; in sm2_ltc_pke_encrypt()
429 res = TEE_ERROR_BAD_STATE; in sm2_ltc_pke_encrypt()
435 res = TEE_ERROR_BAD_STATE; in sm2_ltc_pke_encrypt()
447 res = TEE_ERROR_OUT_OF_MEMORY; in sm2_ltc_pke_encrypt()
451 res = sm2_kdf(x2y2, sizeof(x2y2), t, src_len); in sm2_ltc_pke_encrypt()
452 if (res) in sm2_ltc_pke_encrypt()
456 res = TEE_ERROR_CIPHERTEXT_INVALID; in sm2_ltc_pke_encrypt()
469 res = sm2_point_to_bytes(dst, &C1_len, C1); in sm2_ltc_pke_encrypt()
470 if (res) in sm2_ltc_pke_encrypt()
475 res = TEE_ERROR_SHORT_BUFFER; in sm2_ltc_pke_encrypt()
484 res = crypto_hash_alloc_ctx(&ctx, TEE_ALG_SM3); in sm2_ltc_pke_encrypt()
485 if (res) in sm2_ltc_pke_encrypt()
487 res = crypto_hash_init(ctx); in sm2_ltc_pke_encrypt()
488 if (res) in sm2_ltc_pke_encrypt()
490 res = crypto_hash_update(ctx, x2y2, SM2_INT_SIZE_BYTES); in sm2_ltc_pke_encrypt()
491 if (res) in sm2_ltc_pke_encrypt()
493 res = crypto_hash_update(ctx, src, src_len); in sm2_ltc_pke_encrypt()
494 if (res) in sm2_ltc_pke_encrypt()
496 res = crypto_hash_update(ctx, x2y2 + SM2_INT_SIZE_BYTES, in sm2_ltc_pke_encrypt()
498 if (res) in sm2_ltc_pke_encrypt()
500 res = crypto_hash_final(ctx, dst + C1_len + src_len, TEE_SM3_HASH_SIZE); in sm2_ltc_pke_encrypt()
501 if (res) in sm2_ltc_pke_encrypt()
513 return res; in sm2_ltc_pke_encrypt()