Lines Matching refs:ret
211 int ret; in rpmb_program_key() local
222 ret = rpmb_send(state->mmc_handle, &cmd, sizeof(cmd), &rescmd, in rpmb_program_key()
224 if (ret < 0) in rpmb_program_key()
225 return ret; in rpmb_program_key()
234 ret = rpmb_check_response("program key", RPMB_RESP_PROGRAM_KEY, &res, 1, in rpmb_program_key()
236 return ret; in rpmb_program_key()
241 int ret; in rpmb_read_counter() local
250 ret = rpmb_send(state->mmc_handle, NULL, 0, &cmd, sizeof(cmd), &res, in rpmb_read_counter()
252 if (ret < 0) in rpmb_read_counter()
253 return ret; in rpmb_read_counter()
255 ret = rpmb_mac(state->key, &res, 1, &mac); in rpmb_read_counter()
256 if (ret < 0) in rpmb_read_counter()
257 return ret; in rpmb_read_counter()
266 ret = rpmb_check_response("read counter", RPMB_RESP_GET_COUNTER, &res, 1, in rpmb_read_counter()
268 if (ret < 0) in rpmb_read_counter()
269 return ret; in rpmb_read_counter()
280 int ret = 0; in rpmb_read_counter_retry() local
282 ret = rpmb_read_counter(state, write_counter); in rpmb_read_counter_retry()
283 if (ret >= 0) { in rpmb_read_counter_retry()
284 return ret; in rpmb_read_counter_retry()
290 return ret; in rpmb_read_counter_retry()
300 int ret; in rpmb_read_data() local
321 ret = rpmb_send(state->mmc_handle, NULL, 0, &cmd, sizeof(cmd), res, in rpmb_read_data()
323 if (ret < 0) in rpmb_read_data()
324 return ret; in rpmb_read_data()
327 ret = rpmb_mac(state->key, res, count, mac); in rpmb_read_data()
328 if (ret < 0) in rpmb_read_data()
329 return ret; in rpmb_read_data()
348 ret = rpmb_check_response("read data", RPMB_RESP_DATA_READ, res, count, mac, in rpmb_read_data()
350 if (ret < 0) in rpmb_read_data()
351 return ret; in rpmb_read_data()
412 int ret; in check_write_counter() local
414 ret = rpmb_read_counter_retry(state, &new_write_counter); in check_write_counter()
415 if (ret == 0) { in check_write_counter()
425 fprintf(stderr, "%s: rpmb_read_counter failed: %d\n", __func__, ret); in check_write_counter()
438 int ret; in rpmb_write_data() local
458 ret = rpmb_mac(state->key, cmd, count, &cmd[count - 1].key_mac); in rpmb_write_data()
459 if (ret < 0) { in rpmb_write_data()
461 return ret; in rpmb_write_data()
464 ret = rpmb_send(state->mmc_handle, cmd, sizeof(cmd[0]) * count, &rescmd, in rpmb_write_data()
466 if (ret < 0) { in rpmb_write_data()
467 fprintf(stderr, "rpmb send failed: %d, result: %hu\n", ret, in rpmb_write_data()
472 ret = rpmb_mac(state->key, &res, 1, &mac); in rpmb_write_data()
473 if (ret < 0) { in rpmb_write_data()
488 ret = rpmb_check_response("write data", RPMB_RESP_DATA_WRITE, &res, 1, &mac, in rpmb_write_data()
490 if (ret < 0) { in rpmb_write_data()
491 fprintf(stderr, "rpmb_check_response_failed: %d, result: %hu\n", ret, in rpmb_write_data()
505 ret = -EUCLEAN; in rpmb_write_data()
590 return ret; in rpmb_write_data()
599 int ret; in rpmb_write() local
606 ret = rpmb_write_data(state, buf, addr, count, sync, sync_checkpoint); in rpmb_write()
607 if (ret < 0) in rpmb_write()
608 return ret; in rpmb_write()
629 ret = rpmb_verify(state, buf, addr, count); in rpmb_write()
630 if (ret < 0) { in rpmb_write()
633 ret, addr, count); in rpmb_write()
635 return ret; in rpmb_write()
656 int ret; in rpmb_set_key() local
657 ret = rpmb_read_counter_retry(state, &state->write_counter); in rpmb_set_key()
658 if (ret < 0) { in rpmb_set_key()