Lines Matching refs:res

65 	TEE_Result res = TEE_SUCCESS;  in hash_sha256()  local
68 res = crypto_hash_alloc_ctx(&ctx, TEE_ALG_SHA256); in hash_sha256()
69 if (res != TEE_SUCCESS) in hash_sha256()
70 return res; in hash_sha256()
71 res = crypto_hash_init(ctx); in hash_sha256()
72 if (res != TEE_SUCCESS) in hash_sha256()
74 res = crypto_hash_update(ctx, msg, msg_len); in hash_sha256()
75 if (res != TEE_SUCCESS) in hash_sha256()
77 res = crypto_hash_final(ctx, hash, TEE_SHA256_HASH_SIZE); in hash_sha256()
81 return res; in hash_sha256()
111 TEE_Result res = TEE_SUCCESS; in generate_key() local
121 res = crypto_acipher_alloc_ecc_keypair(key, TEE_TYPE_ECDSA_KEYPAIR, in generate_key()
123 if (res != TEE_SUCCESS) in generate_key()
128 res = crypto_bignum_bin2bn(private_key, KEY_SIZE, key->d); in generate_key()
129 if (res != TEE_SUCCESS) in generate_key()
136 res = TEE_ERROR_OUT_OF_MEMORY; in generate_key()
139 res = crypto_acipher_alloc_ecc_public_key(pubkey, in generate_key()
142 if (res != TEE_SUCCESS) in generate_key()
147 res = crypto_bignum_bin2bn(public_key_x, KEY_SIZE, pubkey->x); in generate_key()
148 if (res != TEE_SUCCESS) in generate_key()
151 res = crypto_bignum_bin2bn(public_key_y, KEY_SIZE, pubkey->y); in generate_key()
152 if (res != TEE_SUCCESS) in generate_key()
162 return res; in generate_key()
168 TEE_Result res = TEE_SUCCESS; in sign_ecdsa_sha256() local
172 res = generate_key(); in sign_ecdsa_sha256()
173 if (res != TEE_SUCCESS) in sign_ecdsa_sha256()
174 return res; in sign_ecdsa_sha256()
177 res = hash_sha256(msg, msg_len, hash_msg); in sign_ecdsa_sha256()
178 if (res != TEE_SUCCESS) in sign_ecdsa_sha256()
182 res = crypto_acipher_ecc_sign(TEE_ALG_ECDSA_SHA256, key, hash_msg, in sign_ecdsa_sha256()
184 if (res != TEE_SUCCESS) in sign_ecdsa_sha256()
188 res = crypto_acipher_ecc_verify(TEE_ALG_ECDSA_SHA256, pubkey, hash_msg, in sign_ecdsa_sha256()
190 if (res == TEE_SUCCESS) in sign_ecdsa_sha256()
201 return res; in sign_ecdsa_sha256()