On Thu, Feb 04, 2016 at 04:26:42PM -0700, Eric Blake wrote: > On 01/20/2016 10:38 AM, Daniel P. Berrange wrote: > > The LUKS format specifies an anti-forensic split algorithm which > > is used to artificially expand the size of the key material on > > disk. This is an implementation of that algorithm. > > > > Signed-off-by: Daniel P. Berrange <berra...@redhat.com> > > --- > > crypto/Makefile.objs | 1 + > > crypto/afsplit.c | 162 ++++++++++++++++++++++++++++++++++++++++ > > include/crypto/afsplit.h | 135 +++++++++++++++++++++++++++++++++ > > tests/.gitignore | 1 + > > tests/Makefile | 2 + > > tests/test-crypto-afsplit.c | 176 > > ++++++++++++++++++++++++++++++++++++++++++++ > > 6 files changed, 477 insertions(+) > > create mode 100644 crypto/afsplit.c > > create mode 100644 include/crypto/afsplit.h > > create mode 100644 tests/test-crypto-afsplit.c > > > > + * @errp: pointer to a NULL-initialized error object > > + * > > + * Join the data in @in, which is @blocklen * @stripes > > + * bytes in size, to form the original small piece o > > + * data @out, which is @blocklen bytes in size. > > + * > > + * Returns: 0 on success, -1 on error; > > + */ > > +int qcrypto_afsplit_decode(QCryptoHashAlgorithm hash, > > + size_t blocklen, > > + uint32_t stripes, > > + const uint8_t *in, > > + uint8_t *out, > > + Error **errp); > > Markus may have an opinion on whether these functions could return void > and just use the errp pointer to report errors; but I'm fine with how > you've done it.
I have a preference to be non-void, as it avoids constantly having to use a 'Error local_err' and error_propagate to check for failure, so results in smaller & simpler code. Regards, Daniel -- |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|