Lines Matching refs:mres

37 	int mres = 0;  in sm2_kep_compute_Z()  local
65 mres = mbedtls_mpi_write_binary(&grp->A, buf, SM2_INT_SIZE_BYTES); in sm2_kep_compute_Z()
66 if (mres) { in sm2_kep_compute_Z()
74 mres = mbedtls_mpi_write_binary(&grp->B, buf, SM2_INT_SIZE_BYTES); in sm2_kep_compute_Z()
75 if (mres) { in sm2_kep_compute_Z()
83 mres = mbedtls_mpi_write_binary(&grp->G.X, buf, SM2_INT_SIZE_BYTES); in sm2_kep_compute_Z()
84 if (mres) { in sm2_kep_compute_Z()
92 mres = mbedtls_mpi_write_binary(&grp->G.Y, buf, SM2_INT_SIZE_BYTES); in sm2_kep_compute_Z()
93 if (mres) { in sm2_kep_compute_Z()
101 mres = mbedtls_mpi_write_binary(key->x, buf, SM2_INT_SIZE_BYTES); in sm2_kep_compute_Z()
102 if (mres) { in sm2_kep_compute_Z()
110 mres = mbedtls_mpi_write_binary(key->y, buf, SM2_INT_SIZE_BYTES); in sm2_kep_compute_Z()
111 if (mres) { in sm2_kep_compute_Z()
143 int mres = 0; in sm2_kep_compute_S() local
159 mres = mbedtls_mpi_write_binary(&UV->X, buf, SM2_INT_SIZE_BYTES); in sm2_kep_compute_S()
160 if (mres) { in sm2_kep_compute_S()
174 mres = mbedtls_mpi_write_binary(initiator_eph_key->x, buf, in sm2_kep_compute_S()
176 if (mres) { in sm2_kep_compute_S()
185 mres = mbedtls_mpi_write_binary(initiator_eph_key->y, buf, in sm2_kep_compute_S()
187 if (mres) { in sm2_kep_compute_S()
196 mres = mbedtls_mpi_write_binary(responder_eph_key->x, buf, in sm2_kep_compute_S()
198 if (mres) { in sm2_kep_compute_S()
207 mres = mbedtls_mpi_write_binary(responder_eph_key->y, buf, in sm2_kep_compute_S()
209 if (mres) { in sm2_kep_compute_S()
233 mres = mbedtls_mpi_write_binary(&UV->Y, buf, SM2_INT_SIZE_BYTES); in sm2_kep_compute_S()
234 if (mres) { in sm2_kep_compute_S()
302 int mres = 0; in crypto_acipher_sm2_kep_derive() local
328 mres = mbedtls_ecp_group_load(&grp, MBEDTLS_ECP_DP_SM2); in crypto_acipher_sm2_kep_derive()
329 if (mres) in crypto_acipher_sm2_kep_derive()
338 mres = mbedtls_mpi_write_binary((mbedtls_mpi *)my_eph_key->x, tmp, in crypto_acipher_sm2_kep_derive()
340 if (mres) in crypto_acipher_sm2_kep_derive()
343 mres = mbedtls_mpi_read_binary(&x1bar, tmp + SM2_INT_SIZE_BYTES / 2, in crypto_acipher_sm2_kep_derive()
345 if (mres) in crypto_acipher_sm2_kep_derive()
350 mres = mbedtls_mpi_mul_mpi(&tA, &x1bar, (mbedtls_mpi *)my_eph_key->d); in crypto_acipher_sm2_kep_derive()
351 if (mres) in crypto_acipher_sm2_kep_derive()
353 mres = mbedtls_mpi_mod_mpi(&tA, &tA, &grp.N); in crypto_acipher_sm2_kep_derive()
354 if (mres) in crypto_acipher_sm2_kep_derive()
356 mres = mbedtls_mpi_add_mpi(&tA, &tA, (mbedtls_mpi *)my_key->d); in crypto_acipher_sm2_kep_derive()
357 if (mres) in crypto_acipher_sm2_kep_derive()
359 mres = mbedtls_mpi_mod_mpi(&tA, &tA, &grp.N); in crypto_acipher_sm2_kep_derive()
360 if (mres) in crypto_acipher_sm2_kep_derive()
368 mres = mbedtls_ecp_check_pubkey(&grp, &RB); in crypto_acipher_sm2_kep_derive()
369 if (mres) in crypto_acipher_sm2_kep_derive()
374 mres = mbedtls_mpi_write_binary((mbedtls_mpi *)peer_eph_key->x, tmp, in crypto_acipher_sm2_kep_derive()
376 if (mres) in crypto_acipher_sm2_kep_derive()
379 mres = mbedtls_mpi_read_binary(&x2bar, tmp + SM2_INT_SIZE_BYTES / 2, in crypto_acipher_sm2_kep_derive()
381 if (mres) in crypto_acipher_sm2_kep_derive()
386 mres = mbedtls_mpi_copy(&PB.X, (mbedtls_mpi *)peer_key->x); in crypto_acipher_sm2_kep_derive()
387 if (mres) in crypto_acipher_sm2_kep_derive()
389 mres = mbedtls_mpi_copy(&PB.Y, (mbedtls_mpi *)peer_key->y); in crypto_acipher_sm2_kep_derive()
390 if (mres) in crypto_acipher_sm2_kep_derive()
392 mres = mbedtls_mpi_lset(&PB.Z, 1); in crypto_acipher_sm2_kep_derive()
393 if (mres) in crypto_acipher_sm2_kep_derive()
395 mres = mbedtls_mpi_lset(&one, 1); in crypto_acipher_sm2_kep_derive()
396 if (mres) in crypto_acipher_sm2_kep_derive()
399 mres = mbedtls_ecp_muladd(&grp, &U, &one, &PB, &x2bar, &RB); in crypto_acipher_sm2_kep_derive()
400 if (mres) in crypto_acipher_sm2_kep_derive()
404 mres = mbedtls_ecp_mul(&grp, &U, &tA, &U, mbd_rand, NULL); in crypto_acipher_sm2_kep_derive()
405 if (mres) in crypto_acipher_sm2_kep_derive()
412 mres = mbedtls_ecp_is_zero(&U); in crypto_acipher_sm2_kep_derive()
413 if (mres) in crypto_acipher_sm2_kep_derive()
419 mres = mbedtls_mpi_write_binary(&U.X, xUyUZAZB, SM2_INT_SIZE_BYTES); in crypto_acipher_sm2_kep_derive()
420 if (mres) in crypto_acipher_sm2_kep_derive()
424 mres = mbedtls_mpi_write_binary(&U.Y, xUyUZAZB + SM2_INT_SIZE_BYTES, in crypto_acipher_sm2_kep_derive()
426 if (mres) in crypto_acipher_sm2_kep_derive()