Lines Matching refs:res

33 	TEE_Result res = TEE_ERROR_GENERIC;  in sm2_kep_compute_Z()  local
49 res = crypto_hash_alloc_ctx(&ctx, TEE_ALG_SM3); in sm2_kep_compute_Z()
50 if (res) in sm2_kep_compute_Z()
53 res = crypto_hash_init(ctx); in sm2_kep_compute_Z()
54 if (res) in sm2_kep_compute_Z()
57 res = crypto_hash_update(ctx, ENTLEN, sizeof(ENTLEN)); in sm2_kep_compute_Z()
58 if (res) in sm2_kep_compute_Z()
61 res = crypto_hash_update(ctx, id, idlen); in sm2_kep_compute_Z()
62 if (res) in sm2_kep_compute_Z()
67 res = TEE_ERROR_GENERIC; 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()
76 res = TEE_ERROR_GENERIC; in sm2_kep_compute_Z()
79 res = crypto_hash_update(ctx, buf, sizeof(buf)); in sm2_kep_compute_Z()
80 if (res) in sm2_kep_compute_Z()
85 res = TEE_ERROR_GENERIC; in sm2_kep_compute_Z()
88 res = crypto_hash_update(ctx, buf, sizeof(buf)); in sm2_kep_compute_Z()
89 if (res) in sm2_kep_compute_Z()
94 res = TEE_ERROR_GENERIC; in sm2_kep_compute_Z()
97 res = crypto_hash_update(ctx, buf, sizeof(buf)); in sm2_kep_compute_Z()
98 if (res) in sm2_kep_compute_Z()
103 res = TEE_ERROR_GENERIC; in sm2_kep_compute_Z()
106 res = crypto_hash_update(ctx, buf, sizeof(buf)); in sm2_kep_compute_Z()
107 if (res) in sm2_kep_compute_Z()
112 res = TEE_ERROR_GENERIC; in sm2_kep_compute_Z()
115 res = crypto_hash_update(ctx, buf, sizeof(buf)); in sm2_kep_compute_Z()
116 if (res) in sm2_kep_compute_Z()
119 res = crypto_hash_final(ctx, Z, TEE_SM3_HASH_SIZE); in sm2_kep_compute_Z()
122 return res; in sm2_kep_compute_Z()
140 TEE_Result res = TEE_ERROR_GENERIC; in sm2_kep_compute_S() local
148 res = crypto_hash_alloc_ctx(&ctx, TEE_ALG_SM3); in sm2_kep_compute_S()
149 if (res) in sm2_kep_compute_S()
154 res = crypto_hash_init(ctx); in sm2_kep_compute_S()
155 if (res) in sm2_kep_compute_S()
161 res = TEE_ERROR_GENERIC; in sm2_kep_compute_S()
164 res = crypto_hash_update(ctx, buf, sizeof(buf)); in sm2_kep_compute_S()
165 if (res) in sm2_kep_compute_S()
169 res = crypto_hash_update(ctx, ZAZB, ZAZB_len); in sm2_kep_compute_S()
170 if (res) in sm2_kep_compute_S()
177 res = TEE_ERROR_GENERIC; in sm2_kep_compute_S()
180 res = crypto_hash_update(ctx, buf, sizeof(buf)); in sm2_kep_compute_S()
181 if (res) in sm2_kep_compute_S()
188 res = TEE_ERROR_GENERIC; in sm2_kep_compute_S()
191 res = crypto_hash_update(ctx, buf, sizeof(buf)); in sm2_kep_compute_S()
192 if (res) in sm2_kep_compute_S()
199 res = TEE_ERROR_GENERIC; in sm2_kep_compute_S()
202 res = crypto_hash_update(ctx, buf, sizeof(buf)); in sm2_kep_compute_S()
203 if (res) in sm2_kep_compute_S()
210 res = TEE_ERROR_GENERIC; in sm2_kep_compute_S()
213 res = crypto_hash_update(ctx, buf, sizeof(buf)); in sm2_kep_compute_S()
214 if (res) in sm2_kep_compute_S()
217 res = crypto_hash_final(ctx, hash, sizeof(hash)); in sm2_kep_compute_S()
218 if (res) in sm2_kep_compute_S()
223 res = crypto_hash_init(ctx); in sm2_kep_compute_S()
224 if (res) in sm2_kep_compute_S()
228 res = crypto_hash_update(ctx, &flag, sizeof(flag)); in sm2_kep_compute_S()
229 if (res) in sm2_kep_compute_S()
235 res = TEE_ERROR_GENERIC; in sm2_kep_compute_S()
238 res = crypto_hash_update(ctx, buf, sizeof(buf)); in sm2_kep_compute_S()
239 if (res) in sm2_kep_compute_S()
243 res = crypto_hash_update(ctx, hash, sizeof(hash)); in sm2_kep_compute_S()
244 if (res) in sm2_kep_compute_S()
247 res = crypto_hash_final(ctx, S, TEE_SM3_HASH_SIZE); in sm2_kep_compute_S()
251 return res; in sm2_kep_compute_S()
290 TEE_Result res = TEE_ERROR_BAD_STATE; in crypto_acipher_sm2_kep_derive() local
430 res = sm2_kep_compute_Z(&grp, xUyUZAZB + 2 * SM2_INT_SIZE_BYTES, in crypto_acipher_sm2_kep_derive()
433 if (res) in crypto_acipher_sm2_kep_derive()
437 res = sm2_kep_compute_Z(&grp, xUyUZAZB + 2 * SM2_INT_SIZE_BYTES + in crypto_acipher_sm2_kep_derive()
441 if (res) in crypto_acipher_sm2_kep_derive()
444 res = sm2_kdf(xUyUZAZB, sizeof(xUyUZAZB), p->out, p->out_len); in crypto_acipher_sm2_kep_derive()
445 if (res) in crypto_acipher_sm2_kep_derive()
455 res = TEE_ERROR_BAD_PARAMETERS; in crypto_acipher_sm2_kep_derive()
458 res = sm2_kep_compute_S(S1, sizeof(S1), flag, &U, in crypto_acipher_sm2_kep_derive()
462 if (res) in crypto_acipher_sm2_kep_derive()
467 res = TEE_ERROR_BAD_STATE; in crypto_acipher_sm2_kep_derive()
478 res = TEE_ERROR_BAD_PARAMETERS; in crypto_acipher_sm2_kep_derive()
482 res = sm2_kep_compute_S(p->conf_out, TEE_SM3_HASH_SIZE, flag, in crypto_acipher_sm2_kep_derive()
498 return res; in crypto_acipher_sm2_kep_derive()