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 "platform.h" 22 : #include "taler_util.h" 23 : #include "taler_signatures.h" 24 : 25 : 26 : enum GNUNET_GenericReturnValue 27 2743 : TALER_crypto_helper_send_all (int sock, 28 : const void *buf, 29 : size_t buf_size) 30 : { 31 2743 : size_t off = 0; 32 : 33 5486 : while (off < buf_size) 34 : { 35 : ssize_t ret; 36 : 37 2743 : ret = send (sock, 38 : buf + off, 39 : buf_size - off, 40 : 0); 41 2743 : if (ret < 0) 42 : { 43 0 : if (EINTR == errno) 44 0 : continue; 45 0 : return GNUNET_SYSERR; 46 : } 47 2743 : GNUNET_assert (ret > 0); 48 2743 : off += ret; 49 : } 50 2743 : return GNUNET_OK; 51 : }