Re: [libvirt] [PATCH] util: compilation fix if build without GNUTLS library

2016-05-22 Thread Cole Robinson
On 05/22/2016 10:23 AM, John Ferlan wrote:
> 
> 
> On 05/21/2016 10:22 AM, Mikhail Feoktistov wrote:
>> ---
>>  src/util/vircrypto.c | 13 +++--
>>  1 file changed, 7 insertions(+), 6 deletions(-)
>>
> 
> Ugh... Sorry about this - forgot about the unused attributes 
> 
> I should have just gone with the entire function w/ the
> HAVE_GNUTLS_CIPHER_ENCRYPT macro instead of the intermixed
> ATTRIBUTE_UNUSED as those would have a tendency for someone to come
> along and try to patch again pointing out they are used without
> realizing it was the gnutls macro that needed to be broader...
> 
> I'll send something short with 2 patches that will do that. I started
> working on the next task and realized I needed a slight adjustment anyway...

FWIW there's an old BiteSizedTask about this type of issue wrt to GNUTLS:

http://wiki.libvirt.org/page/BiteSizedTasks#Abstract_away_most_usage_of_WITH_GNUTLS

So I guess this has come up before

- Cole


--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [PATCH] util: compilation fix if build without GNUTLS library

2016-05-22 Thread John Ferlan


On 05/21/2016 10:22 AM, Mikhail Feoktistov wrote:
> ---
>  src/util/vircrypto.c | 13 +++--
>  1 file changed, 7 insertions(+), 6 deletions(-)
> 

Ugh... Sorry about this - forgot about the unused attributes 

I should have just gone with the entire function w/ the
HAVE_GNUTLS_CIPHER_ENCRYPT macro instead of the intermixed
ATTRIBUTE_UNUSED as those would have a tendency for someone to come
along and try to patch again pointing out they are used without
realizing it was the gnutls macro that needed to be broader...

I'll send something short with 2 patches that will do that. I started
working on the next task and realized I needed a slight adjustment anyway...

John
> diff --git a/src/util/vircrypto.c b/src/util/vircrypto.c
> index 5183d49..4f288f0 100644
> --- a/src/util/vircrypto.c
> +++ b/src/util/vircrypto.c
> @@ -24,6 +24,7 @@
>  #include "virlog.h"
>  #include "virerror.h"
>  #include "viralloc.h"
> +#include "virrandom.h"
>  
>  #include "md5.h"
>  #include "sha256.h"
> @@ -220,14 +221,14 @@ virCryptoEncryptDataAESgnutls(gnutls_cipher_algorithm_t 
> gnutls_enc_alg,
>   */
>  int
>  virCryptoEncryptData(virCryptoCipher algorithm,
> - uint8_t *enckey,
> + uint8_t *enckey ATTRIBUTE_UNUSED,
>   size_t enckeylen,
> - uint8_t *iv,
> + uint8_t *iv ATTRIBUTE_UNUSED,
>   size_t ivlen,
> - uint8_t *data,
> - size_t datalen,
> - uint8_t **ciphertext,
> - size_t *ciphertextlen)
> + uint8_t *data ATTRIBUTE_UNUSED,
> + size_t datalen ATTRIBUTE_UNUSED,
> + uint8_t **ciphertext ATTRIBUTE_UNUSED,
> + size_t *ciphertextlen ATTRIBUTE_UNUSED)
>  {
>  switch (algorithm) {
>  case VIR_CRYPTO_CIPHER_AES256CBC:
> 

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [PATCH] util: compilation fix if build without GNUTLS library

2016-05-22 Thread Roman Bogorodskiy
  Mikhail Feoktistov wrote:

> ---
>  src/util/vircrypto.c | 13 +++--
>  1 file changed, 7 insertions(+), 6 deletions(-)
> 
> diff --git a/src/util/vircrypto.c b/src/util/vircrypto.c
> index 5183d49..4f288f0 100644
> --- a/src/util/vircrypto.c
> +++ b/src/util/vircrypto.c
> @@ -24,6 +24,7 @@
>  #include "virlog.h"
>  #include "virerror.h"
>  #include "viralloc.h"
> +#include "virrandom.h"
>  
>  #include "md5.h"
>  #include "sha256.h"
> @@ -220,14 +221,14 @@ virCryptoEncryptDataAESgnutls(gnutls_cipher_algorithm_t 
> gnutls_enc_alg,
>   */
>  int
>  virCryptoEncryptData(virCryptoCipher algorithm,
> - uint8_t *enckey,
> + uint8_t *enckey ATTRIBUTE_UNUSED,
>   size_t enckeylen,
> - uint8_t *iv,
> + uint8_t *iv ATTRIBUTE_UNUSED,
>   size_t ivlen,
> - uint8_t *data,
> - size_t datalen,
> - uint8_t **ciphertext,
> - size_t *ciphertextlen)
> + uint8_t *data ATTRIBUTE_UNUSED,
> + size_t datalen ATTRIBUTE_UNUSED,
> + uint8_t **ciphertext ATTRIBUTE_UNUSED,
> + size_t *ciphertextlen ATTRIBUTE_UNUSED)
>  {
>  switch (algorithm) {
>  case VIR_CRYPTO_CIPHER_AES256CBC:

ACK; I've shortened commit message title a little and pushed to fix
build.

However, I'm wondering if there should be a better fix in long term to
avoid ATTRIBUTE_UNUSED for attributes that possibly could be used, e.g.
either using something like

#ifndef HAVE_GNUTLS_CIPHER_ENCRYPT
# define GNUTLS_ATTRIBUTE ATTRIBUTE_UNUSED
#else
# define GNUTLS_ATTRIBUTE

or just adding a stub for virCryptoEncryptData() as the actual
implementation does not *seem* to do anything useful without gnutls
anyway.

Roman Bogorodskiy


signature.asc
Description: PGP signature
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

[libvirt] [PATCH] util: compilation fix if build without GNUTLS library

2016-05-21 Thread Mikhail Feoktistov
---
 src/util/vircrypto.c | 13 +++--
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/src/util/vircrypto.c b/src/util/vircrypto.c
index 5183d49..4f288f0 100644
--- a/src/util/vircrypto.c
+++ b/src/util/vircrypto.c
@@ -24,6 +24,7 @@
 #include "virlog.h"
 #include "virerror.h"
 #include "viralloc.h"
+#include "virrandom.h"
 
 #include "md5.h"
 #include "sha256.h"
@@ -220,14 +221,14 @@ virCryptoEncryptDataAESgnutls(gnutls_cipher_algorithm_t 
gnutls_enc_alg,
  */
 int
 virCryptoEncryptData(virCryptoCipher algorithm,
- uint8_t *enckey,
+ uint8_t *enckey ATTRIBUTE_UNUSED,
  size_t enckeylen,
- uint8_t *iv,
+ uint8_t *iv ATTRIBUTE_UNUSED,
  size_t ivlen,
- uint8_t *data,
- size_t datalen,
- uint8_t **ciphertext,
- size_t *ciphertextlen)
+ uint8_t *data ATTRIBUTE_UNUSED,
+ size_t datalen ATTRIBUTE_UNUSED,
+ uint8_t **ciphertext ATTRIBUTE_UNUSED,
+ size_t *ciphertextlen ATTRIBUTE_UNUSED)
 {
 switch (algorithm) {
 case VIR_CRYPTO_CIPHER_AES256CBC:
-- 
1.8.3.1

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list