Line data Source code
1 : /*
2 : This file is part of TALER
3 : Copyright (C) 2020, 2021 Taler Systems SA
4 :
5 : TALER is free software; you can redistribute it and/or modify it under the
6 : terms of the GNU General Public License as published by the Free Software
7 : Foundation; either version 3, or (at your option) any later version.
8 :
9 : TALER is distributed in the hope that it will be useful, but WITHOUT ANY
10 : WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
11 : A PARTICULAR PURPOSE. See the GNU General Public License for more details.
12 :
13 : You should have received a copy of the GNU General Public License along with
14 : TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
15 : */
16 : /**
17 : * @file util/crypto_helper_common.c
18 : * @brief Common functions for the exchange security modules
19 : * @author Florian Dold <dold@taler.net>
20 : */
21 : #include "taler/platform.h"
22 : #include "taler/taler_util.h"
23 : #include "taler/taler_signatures.h"
24 : #include "crypto_helper_common.h"
25 :
26 :
27 : enum GNUNET_GenericReturnValue
28 3860 : TALER_crypto_helper_send_all (int sock,
29 : const void *buf,
30 : size_t buf_size)
31 : {
32 3860 : size_t off = 0;
33 :
34 7720 : while (off < buf_size)
35 : {
36 : ssize_t ret;
37 :
38 3860 : ret = send (sock,
39 : buf + off,
40 : buf_size - off,
41 : 0);
42 3860 : if (ret < 0)
43 : {
44 0 : if (EINTR == errno)
45 0 : continue;
46 0 : return GNUNET_SYSERR;
47 : }
48 3860 : GNUNET_assert (ret > 0);
49 3860 : off += ret;
50 : }
51 3860 : return GNUNET_OK;
52 : }
|