Lines Matching refs:res

28 	TEE_Result res = TEE_ERROR_GENERIC;  in sm2_kep_compute_Z()  local
43 res = crypto_hash_alloc_ctx(&ctx, TEE_ALG_SM3); in sm2_kep_compute_Z()
44 if (res) in sm2_kep_compute_Z()
47 res = crypto_hash_init(ctx); in sm2_kep_compute_Z()
48 if (res) in sm2_kep_compute_Z()
51 res = crypto_hash_update(ctx, ENTLEN, sizeof(ENTLEN)); in sm2_kep_compute_Z()
52 if (res) in sm2_kep_compute_Z()
55 res = crypto_hash_update(ctx, id, idlen); in sm2_kep_compute_Z()
56 if (res) in sm2_kep_compute_Z()
60 res = crypto_hash_update(ctx, buf, sizeof(buf)); in sm2_kep_compute_Z()
61 if (res) in sm2_kep_compute_Z()
65 res = crypto_hash_update(ctx, buf, sizeof(buf)); in sm2_kep_compute_Z()
66 if (res) in sm2_kep_compute_Z()
70 res = crypto_hash_update(ctx, buf, sizeof(buf)); in sm2_kep_compute_Z()
71 if (res) in sm2_kep_compute_Z()
75 res = crypto_hash_update(ctx, buf, sizeof(buf)); in sm2_kep_compute_Z()
76 if (res) in sm2_kep_compute_Z()
80 res = crypto_hash_update(ctx, buf, sizeof(buf)); in sm2_kep_compute_Z()
81 if (res) in sm2_kep_compute_Z()
85 res = crypto_hash_update(ctx, buf, sizeof(buf)); in sm2_kep_compute_Z()
86 if (res) in sm2_kep_compute_Z()
89 res = crypto_hash_final(ctx, Z, TEE_SM3_HASH_SIZE); in sm2_kep_compute_Z()
92 return res; in sm2_kep_compute_Z()
109 TEE_Result res = TEE_ERROR_GENERIC; in sm2_kep_compute_S() local
116 res = crypto_hash_alloc_ctx(&ctx, TEE_ALG_SM3); in sm2_kep_compute_S()
117 if (res) in sm2_kep_compute_S()
122 res = crypto_hash_init(ctx); in sm2_kep_compute_S()
123 if (res) in sm2_kep_compute_S()
128 res = crypto_hash_update(ctx, buf, sizeof(buf)); in sm2_kep_compute_S()
129 if (res) in sm2_kep_compute_S()
133 res = crypto_hash_update(ctx, ZAZB, ZAZB_len); in sm2_kep_compute_S()
134 if (res) in sm2_kep_compute_S()
140 res = crypto_hash_update(ctx, buf, sizeof(buf)); in sm2_kep_compute_S()
141 if (res) in sm2_kep_compute_S()
147 res = crypto_hash_update(ctx, buf, sizeof(buf)); in sm2_kep_compute_S()
148 if (res) in sm2_kep_compute_S()
154 res = crypto_hash_update(ctx, buf, sizeof(buf)); in sm2_kep_compute_S()
155 if (res) in sm2_kep_compute_S()
161 res = crypto_hash_update(ctx, buf, sizeof(buf)); in sm2_kep_compute_S()
162 if (res) in sm2_kep_compute_S()
165 res = crypto_hash_final(ctx, hash, sizeof(hash)); in sm2_kep_compute_S()
166 if (res) in sm2_kep_compute_S()
171 res = crypto_hash_init(ctx); in sm2_kep_compute_S()
172 if (res) in sm2_kep_compute_S()
176 res = crypto_hash_update(ctx, &flag, sizeof(flag)); in sm2_kep_compute_S()
177 if (res) in sm2_kep_compute_S()
182 res = crypto_hash_update(ctx, buf, sizeof(buf)); in sm2_kep_compute_S()
183 if (res) in sm2_kep_compute_S()
187 res = crypto_hash_update(ctx, hash, sizeof(hash)); in sm2_kep_compute_S()
188 if (res) in sm2_kep_compute_S()
191 res = crypto_hash_final(ctx, S, TEE_SM3_HASH_SIZE); in sm2_kep_compute_S()
195 return res; in sm2_kep_compute_S()
219 TEE_Result res = TEE_ERROR_BAD_STATE; in sm2_kep_derive() local
238 res = TEE_ERROR_OUT_OF_MEMORY; in sm2_kep_derive()
244 res = TEE_ERROR_OUT_OF_MEMORY; in sm2_kep_derive()
337 res = sm2_kep_compute_Z(xUyUZAZB + 2 * SM2_INT_SIZE_BYTES, in sm2_kep_derive()
340 if (res) in sm2_kep_derive()
344 res = sm2_kep_compute_Z(xUyUZAZB + 2 * SM2_INT_SIZE_BYTES + in sm2_kep_derive()
348 if (res) in sm2_kep_derive()
351 res = sm2_kdf(xUyUZAZB, sizeof(xUyUZAZB), p->out, p->out_len); in sm2_kep_derive()
352 if (res) in sm2_kep_derive()
362 res = TEE_ERROR_BAD_PARAMETERS; in sm2_kep_derive()
365 res = sm2_kep_compute_S(S1, sizeof(S1), flag, U, in sm2_kep_derive()
369 if (res) in sm2_kep_derive()
374 res = TEE_ERROR_BAD_STATE; in sm2_kep_derive()
385 res = TEE_ERROR_BAD_PARAMETERS; in sm2_kep_derive()
389 res = sm2_kep_compute_S(p->conf_out, TEE_SM3_HASH_SIZE, flag, U, in sm2_kep_derive()
393 if (res) in sm2_kep_derive()
400 return res; in sm2_kep_derive()
409 TEE_Result res = TEE_SUCCESS; in crypto_acipher_sm2_kep_derive() local
415 res = ecc_populate_ltc_private_key(&ltc_my_key, my_key, in crypto_acipher_sm2_kep_derive()
417 if (res) in crypto_acipher_sm2_kep_derive()
420 res = ecc_populate_ltc_private_key(&ltc_my_eph_key, my_eph_key, in crypto_acipher_sm2_kep_derive()
422 if (res) in crypto_acipher_sm2_kep_derive()
425 res = ecc_populate_ltc_public_key(&ltc_peer_key, peer_key, in crypto_acipher_sm2_kep_derive()
427 if (res) in crypto_acipher_sm2_kep_derive()
430 res = ecc_populate_ltc_public_key(&ltc_peer_eph_key, peer_eph_key, in crypto_acipher_sm2_kep_derive()
432 if (res) in crypto_acipher_sm2_kep_derive()
435 res = sm2_kep_derive(&ltc_my_key, &ltc_my_eph_key, &ltc_peer_key, in crypto_acipher_sm2_kep_derive()
442 return res; in crypto_acipher_sm2_kep_derive()