[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] blktap: link against libgcrypt rather than libcrypto



# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1214816453 -3600
# Node ID fbccdd7e2a86c71e59c0d0680c50474da3140a6b
# Parent  0b4dbd9a9896980c8a298b0e289f75b8d8d93e1a
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@xxxxxxxxxx>
---
 tools/blktap/drivers/Makefile     |    2 +-
 tools/blktap/drivers/block-qcow.c |   19 +++++--------------
 2 files changed, 6 insertions(+), 15 deletions(-)

diff -r 0b4dbd9a9896 -r fbccdd7e2a86 tools/blktap/drivers/Makefile
--- a/tools/blktap/drivers/Makefile     Mon Jun 30 09:59:39 2008 +0100
+++ b/tools/blktap/drivers/Makefile     Mon Jun 30 10:00:53 2008 +0100
@@ -18,7 +18,7 @@ DEPS      = .*.d
 DEPS      = .*.d
 
 LDFLAGS_blktapctrl := $(LDFLAGS_libxenctrl) $(LDFLAGS_libxenstore) -L../lib 
-lblktap
-LDFLAGS_img := $(LIBAIO_DIR)/libaio.a -lcrypto -lpthread -lz
+LDFLAGS_img := $(LIBAIO_DIR)/libaio.a -lgcrypt -lpthread -lz
 
 BLK-OBJS-y  := block-aio.o
 BLK-OBJS-y  += block-sync.o
diff -r 0b4dbd9a9896 -r fbccdd7e2a86 tools/blktap/drivers/block-qcow.c
--- a/tools/blktap/drivers/block-qcow.c Mon Jun 30 09:59:39 2008 +0100
+++ b/tools/blktap/drivers/block-qcow.c Mon Jun 30 10:00:53 2008 +0100
@@ -33,7 +33,7 @@
 #include <zlib.h>
 #include <inttypes.h>
 #include <libaio.h>
-#include <openssl/md5.h>
+#include <gcrypt.h>
 #include "bswap.h"
 #include "aes.h"
 #include "tapdisk.h"
@@ -149,31 +149,22 @@ static uint32_t gen_cksum(char *ptr, int
 static uint32_t gen_cksum(char *ptr, int len)
 {
        int i;
-       unsigned char *md;
-       uint32_t ret;
-
-       md = malloc(MD5_DIGEST_LENGTH);
-
-       if(!md) return 0;
-       
+       uint32_t md[4];
+
        /* Convert L1 table to big endian */
        for(i = 0; i < len / sizeof(uint64_t); i++) {
                cpu_to_be64s(&((uint64_t*) ptr)[i]);
        }
 
        /* Generate checksum */
-       if (MD5((unsigned char *)ptr, len, md) != md)
-               ret = 0;
-       else
-               memcpy(&ret, md, sizeof(uint32_t));
+       gcry_md_hash_buffer(GCRY_MD_MD5, md, ptr, len);
 
        /* Convert L1 table back to native endianess */
        for(i = 0; i < len / sizeof(uint64_t); i++) {
                be64_to_cpus(&((uint64_t*) ptr)[i]);
        }
 
-       free(md);
-       return ret;
+       return md[0];
 }
 
 static int get_filesize(char *filename, uint64_t *size, struct stat *st)

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.