ia64/xen-unstable

changeset 17927:fbccdd7e2a86

blktap: link against libgcrypt rather than libcrypto

tapdisk, part of blktap, links against libcrypto. tapdisk includes
GPLv2 (tapaio.c) and other licensed code (block-qcow.c). The license
of OpenSSL is considered incompatible with the GPL by many
people. This patch changes them to link against libgcrypt, which is
LGPL.

Signed-off-by: Bastian Blank <waldi@debian.org>
author Keir Fraser <keir.fraser@citrix.com>
date Mon Jun 30 10:00:53 2008 +0100 (2008-06-30)
parents 0b4dbd9a9896
children c5875621d79a
files tools/blktap/drivers/Makefile tools/blktap/drivers/block-qcow.c
line diff
     1.1 --- a/tools/blktap/drivers/Makefile	Mon Jun 30 09:59:39 2008 +0100
     1.2 +++ b/tools/blktap/drivers/Makefile	Mon Jun 30 10:00:53 2008 +0100
     1.3 @@ -18,7 +18,7 @@ CFLAGS   += -Wp,-MD,.$(@F).d
     1.4  DEPS      = .*.d
     1.5  
     1.6  LDFLAGS_blktapctrl := $(LDFLAGS_libxenctrl) $(LDFLAGS_libxenstore) -L../lib -lblktap
     1.7 -LDFLAGS_img := $(LIBAIO_DIR)/libaio.a -lcrypto -lpthread -lz
     1.8 +LDFLAGS_img := $(LIBAIO_DIR)/libaio.a -lgcrypt -lpthread -lz
     1.9  
    1.10  BLK-OBJS-y  := block-aio.o
    1.11  BLK-OBJS-y  += block-sync.o
     2.1 --- a/tools/blktap/drivers/block-qcow.c	Mon Jun 30 09:59:39 2008 +0100
     2.2 +++ b/tools/blktap/drivers/block-qcow.c	Mon Jun 30 10:00:53 2008 +0100
     2.3 @@ -33,7 +33,7 @@
     2.4  #include <zlib.h>
     2.5  #include <inttypes.h>
     2.6  #include <libaio.h>
     2.7 -#include <openssl/md5.h>
     2.8 +#include <gcrypt.h>
     2.9  #include "bswap.h"
    2.10  #include "aes.h"
    2.11  #include "tapdisk.h"
    2.12 @@ -149,31 +149,22 @@ static int decompress_cluster(struct tdq
    2.13  static uint32_t gen_cksum(char *ptr, int len)
    2.14  {
    2.15  	int i;
    2.16 -	unsigned char *md;
    2.17 -	uint32_t ret;
    2.18 +	uint32_t md[4];
    2.19  
    2.20 -	md = malloc(MD5_DIGEST_LENGTH);
    2.21 -
    2.22 -	if(!md) return 0;
    2.23 -	
    2.24  	/* Convert L1 table to big endian */
    2.25  	for(i = 0; i < len / sizeof(uint64_t); i++) {
    2.26  		cpu_to_be64s(&((uint64_t*) ptr)[i]);
    2.27  	}
    2.28  
    2.29  	/* Generate checksum */
    2.30 -	if (MD5((unsigned char *)ptr, len, md) != md)
    2.31 -		ret = 0;
    2.32 -	else
    2.33 -		memcpy(&ret, md, sizeof(uint32_t));
    2.34 +	gcry_md_hash_buffer(GCRY_MD_MD5, md, ptr, len);
    2.35  
    2.36  	/* Convert L1 table back to native endianess */
    2.37  	for(i = 0; i < len / sizeof(uint64_t); i++) {
    2.38  		be64_to_cpus(&((uint64_t*) ptr)[i]);
    2.39  	}
    2.40  
    2.41 -	free(md);
    2.42 -	return ret;
    2.43 +	return md[0];
    2.44  }
    2.45  
    2.46  static int get_filesize(char *filename, uint64_t *size, struct stat *st)