On Mon, Jun 06, 2016 at 02:13:49PM -0400, John Ferlan wrote: > Will make it easier to add new key lengths > > Signed-off-by: John Ferlan <jferlan@xxxxxxxxxx> > --- > src/util/vircrypto.c | 50 +++++++++++++++++++++++++++----------------------- > 1 file changed, 27 insertions(+), 23 deletions(-) > > diff --git a/src/util/vircrypto.c b/src/util/vircrypto.c > index 27a3d1d..f50ac6a 100644 > --- a/src/util/vircrypto.c > +++ b/src/util/vircrypto.c > @@ -229,36 +229,40 @@ virCryptoEncryptData(virCryptoCipher algorithm, > uint8_t **ciphertext, > size_t *ciphertextlen) > { > + /* > + * Encrypt the data buffer using an encryption key and > + * initialization vector via the gnutls_cipher_encrypt API > + * for the specific cipher algorithm. > + */ > +# define DO_CRYPT(ekl, ivl, alg, nam) \ > + do { \ > + if (enckeylen != ekl) { \ > + virReportError(VIR_ERR_INVALID_ARG, \ > + _("'%s' encryption invalid keylen=%d"), \ > + nam, ekl); \ > + return -1; \ > + } \ > + if (ivlen != ivl) { \ > + virReportError(VIR_ERR_INVALID_ARG, \ > + _("'%s' initialization vector invalid len=%d"), \ > + nam, ivl); \ > + return -1; \ > + } \ If these values depend on the VIR_CRYPTO_CIPHER, we should not need to pass them around. Jan -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list