X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=blobdiff_plain;f=gcrypt.c;h=115529cb6b7f67ecdf60754c3c23f461aea4a6bf;hp=1e997fb45c0bd6a753a79bfcff1db5ede4546782;hb=38aeac398e716ff7ae6919acbdf498ed09ab0bc1;hpb=98c13e11d5efd8e49fe3c31386f3abf6979902d6 diff --git a/gcrypt.c b/gcrypt.c index 1e997fb4..115529cb 100644 --- a/gcrypt.c +++ b/gcrypt.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2011-2012 Andre Noll + * Copyright (C) 2011-2013 Andre Noll * * Licensed under the GPL v2. For licencing details see COPYING. */ @@ -695,7 +695,6 @@ int get_asymmetric_key(const char *key_file, int private, key->num_bytes = ret; key->sexp = sexp; *result = key; - ret = key->num_bytes; unmap: ret2 = para_munmap(map, map_size); if (ret >= 0 && ret2 < 0) @@ -970,3 +969,15 @@ int sc_recv_bin_buffer(struct stream_cipher_context *scc, char *buf, assert(gret == 0); return ret; } + +void sc_crypt(struct stream_cipher *sc, struct iovec *src, struct iovec *dst) +{ + gcry_cipher_hd_t handle = sc->handle; + gcry_error_t gret; + + /* perform in-place encryption */ + *dst = *src; + gret = gcry_cipher_encrypt(handle, src->iov_base, src->iov_len, + NULL, 0); + assert(gret == 0); +}