X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=blobdiff_plain;f=crypt_common.c;h=71aabf53f944eea64d4214fccff354787b7e6f9b;hp=705c7249903e2f4e998043e2a483029c43596809;hb=7df87a748fae6a9f20d337d79ec83978856f0c48;hpb=01a7db579a518a1a03b940a5a42411e49123ac1b diff --git a/crypt_common.c b/crypt_common.c index 705c7249..71aabf53 100644 --- a/crypt_common.c +++ b/crypt_common.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2005-2012 Andre Noll + * Copyright (C) 2005-2014 Andre Noll * * Licensed under the GPL v2. For licencing details see COPYING. */ @@ -321,41 +321,3 @@ int hash_compare(unsigned char *h1, unsigned char *h2) } return 0; } - -int sc_recv_buffer(struct stream_cipher_context *scc, char *buf, size_t size) -{ - int n; - - assert(size); - n = sc_recv_bin_buffer(scc, buf, size - 1); - if (n >= 0) - buf[n] = '\0'; - else - *buf = '\0'; - return n; -} - -int sc_send_buffer(struct stream_cipher_context *scc, char *buf) -{ - size_t len = strlen(buf); - int ret = sc_send_bin_buffer(scc, buf, len); - - if (ret < 0 || ret == len) - return ret; - return -E_SHORT_WRITE; -} - -__printf_2_3 int sc_send_va_buffer(struct stream_cipher_context *scc, - const char *fmt, ...) -{ - char *msg; - int ret; - va_list ap; - - va_start(ap, fmt); - ret = xvasprintf(&msg, fmt, ap); - va_end(ap); - ret = sc_send_bin_buffer(scc, msg, ret); - free(msg); - return ret; -}