From nobody Mon Dec 15 01:52:01 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 152605382729854.08982315349192; Fri, 11 May 2018 08:50:27 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 7FA423002EF8; Fri, 11 May 2018 15:50:25 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 505C01001F49; Fri, 11 May 2018 15:50:25 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 0D3851801246; Fri, 11 May 2018 15:50:25 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w4BFoMnF017737 for ; Fri, 11 May 2018 11:50:22 -0400 Received: by smtp.corp.redhat.com (Postfix) id 9727783B7A; Fri, 11 May 2018 15:50:22 +0000 (UTC) Received: from icr.brq.redhat.com (unknown [10.43.2.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3BA9D7D55C for ; Fri, 11 May 2018 15:50:22 +0000 (UTC) From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Date: Fri, 11 May 2018 17:50:14 +0200 Message-Id: In-Reply-To: References: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 4/5] esx: Use VIR_CRYPTO_HASH_SIZE_MD5 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.44]); Fri, 11 May 2018 15:50:26 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Do not rely on gnulib's MD5_DIGEST_SIZE from md5.h. Include vircrypto.h and use VIR_CRYPTO_HASH_SIZE_MD5. Signed-off-by: J=C3=A1n Tomko --- src/esx/esx_network_driver.c | 9 ++++----- src/esx/esx_storage_backend_iscsi.c | 27 +++++++++++++-------------- src/esx/esx_storage_backend_vmfs.c | 11 +++++------ 3 files changed, 22 insertions(+), 25 deletions(-) diff --git a/src/esx/esx_network_driver.c b/src/esx/esx_network_driver.c index 7386efb0f5..b4f7f006d0 100644 --- a/src/esx/esx_network_driver.c +++ b/src/esx/esx_network_driver.c @@ -23,7 +23,6 @@ =20 #include =20 -#include "md5.h" #include "internal.h" #include "viralloc.h" #include "viruuid.h" @@ -42,7 +41,7 @@ * The UUID of a network is the MD5 sum of its key. Therefore, verify that * UUID and MD5 sum match in size, because we rely on that. */ -verify(MD5_DIGEST_SIZE =3D=3D VIR_UUID_BUFLEN); +verify(VIR_CRYPTO_HASH_SIZE_MD5 =3D=3D VIR_UUID_BUFLEN); =20 =20 static int @@ -142,7 +141,7 @@ esxNetworkLookupByUUID(virConnectPtr conn, const unsign= ed char *uuid) esxPrivate *priv =3D conn->privateData; esxVI_HostVirtualSwitch *hostVirtualSwitchList =3D NULL; esxVI_HostVirtualSwitch *hostVirtualSwitch =3D NULL; - unsigned char md5[MD5_DIGEST_SIZE]; /* MD5_DIGEST_SIZE =3D VIR_UUID_BU= FLEN =3D 16 */ + unsigned char md5[VIR_CRYPTO_HASH_SIZE_MD5]; /* VIR_CRYPTO_HASH_SIZE_M= D5 =3D VIR_UUID_BUFLEN =3D 16 */ char uuid_string[VIR_UUID_STRING_BUFLEN] =3D ""; =20 if (esxVI_EnsureSession(priv->primary) < 0 || @@ -186,7 +185,7 @@ esxNetworkLookupByName(virConnectPtr conn, const char *= name) virNetworkPtr network =3D NULL; esxPrivate *priv =3D conn->privateData; esxVI_HostVirtualSwitch *hostVirtualSwitch =3D NULL; - unsigned char md5[MD5_DIGEST_SIZE]; /* MD5_DIGEST_SIZE =3D VIR_UUID_BU= FLEN =3D 16 */ + unsigned char md5[VIR_CRYPTO_HASH_SIZE_MD5]; /* VIR_CRYPTO_HASH_SIZE_M= D5 =3D VIR_UUID_BUFLEN =3D 16 */ =20 if (esxVI_EnsureSession(priv->primary) < 0 || esxVI_LookupHostVirtualSwitchByName(priv->primary, name, @@ -296,7 +295,7 @@ esxNetworkDefineXML(virConnectPtr conn, const char *xml) esxVI_HostPortGroupSpec *hostPortGroupSpec =3D NULL; size_t i; =20 - unsigned char md5[MD5_DIGEST_SIZE]; /* MD5_DIGEST_SIZE =3D VIR_UUID_BU= FLEN =3D 16 */ + unsigned char md5[VIR_CRYPTO_HASH_SIZE_MD5]; /* VIR_CRYPTO_HASH_SIZE_M= D5 =3D VIR_UUID_BUFLEN =3D 16 */ =20 if (esxVI_EnsureSession(priv->primary) < 0) return NULL; diff --git a/src/esx/esx_storage_backend_iscsi.c b/src/esx/esx_storage_back= end_iscsi.c index 42b52214d1..fd0ace6fcb 100644 --- a/src/esx/esx_storage_backend_iscsi.c +++ b/src/esx/esx_storage_backend_iscsi.c @@ -27,7 +27,6 @@ #include =20 #include "internal.h" -#include "md5.h" #include "viralloc.h" #include "viruuid.h" #include "storage_conf.h" @@ -46,7 +45,7 @@ * The UUID of a storage pool is the MD5 sum of its mount path. Therefore, * verify that UUID and MD5 sum match in size, because we rely on that. */ -verify(MD5_DIGEST_SIZE =3D=3D VIR_UUID_BUFLEN); +verify(VIR_CRYPTO_HASH_SIZE_MD5 =3D=3D VIR_UUID_BUFLEN); =20 =20 =20 @@ -157,8 +156,8 @@ esxStoragePoolLookupByName(virConnectPtr conn, { esxPrivate *priv =3D conn->privateData; esxVI_HostInternetScsiHbaStaticTarget *target =3D NULL; - /* MD5_DIGEST_SIZE =3D VIR_UUID_BUFLEN =3D 16 */ - unsigned char md5[MD5_DIGEST_SIZE]; + /* VIR_CRYPTO_HASH_SIZE_MD5 =3D VIR_UUID_BUFLEN =3D 16 */ + unsigned char md5[VIR_CRYPTO_HASH_SIZE_MD5]; virStoragePoolPtr pool =3D NULL; =20 /* @@ -202,8 +201,8 @@ esxStoragePoolLookupByUUID(virConnectPtr conn, esxPrivate *priv =3D conn->privateData; esxVI_HostInternetScsiHba *hostInternetScsiHba =3D NULL; esxVI_HostInternetScsiHbaStaticTarget *target; - /* MD5_DIGEST_SIZE =3D VIR_UUID_BUFLEN =3D 16 */ - unsigned char md5[MD5_DIGEST_SIZE]; + /* VIR_CRYPTO_HASH_SIZE_MD5 =3D VIR_UUID_BUFLEN =3D 16 */ + unsigned char md5[VIR_CRYPTO_HASH_SIZE_MD5]; =20 if (esxVI_LookupHostInternetScsiHba(priv->primary, &hostInternetScsiHba) < 0) { @@ -443,8 +442,8 @@ esxStorageVolLookupByName(virStoragePoolPtr pool, esxPrivate *priv =3D pool->conn->privateData; esxVI_ScsiLun *scsiLunList =3D NULL; esxVI_ScsiLun *scsiLun; - /* MD5_DIGEST_SIZE =3D VIR_UUID_BUFLEN =3D 16 */ - unsigned char md5[MD5_DIGEST_SIZE]; + /* VIR_CRYPTO_HASH_SIZE_MD5 =3D VIR_UUID_BUFLEN =3D 16 */ + unsigned char md5[VIR_CRYPTO_HASH_SIZE_MD5]; char uuid_string[VIR_UUID_STRING_BUFLEN] =3D ""; =20 if (esxVI_LookupScsiLunList(priv->primary, &scsiLunList) < 0) @@ -491,8 +490,8 @@ esxStorageVolLookupByPath(virConnectPtr conn, const cha= r *path) esxVI_ScsiLun *scsiLun; esxVI_HostScsiDisk *hostScsiDisk =3D NULL; char *poolName =3D NULL; - /* MD5_DIGEST_SIZE =3D VIR_UUID_BUFLEN =3D 16 */ - unsigned char md5[MD5_DIGEST_SIZE]; + /* VIR_CRYPTO_HASH_SIZE_MD5 =3D VIR_UUID_BUFLEN =3D 16 */ + unsigned char md5[VIR_CRYPTO_HASH_SIZE_MD5]; char uuid_string[VIR_UUID_STRING_BUFLEN] =3D ""; =20 if (esxVI_LookupScsiLunList(priv->primary, &scsiLunList) < 0) @@ -538,8 +537,8 @@ esxStorageVolLookupByKey(virConnectPtr conn, const char= *key) char *poolName =3D NULL; esxVI_ScsiLun *scsiLunList =3D NULL; esxVI_ScsiLun *scsiLun; - /* MD5_DIGEST_SIZE =3D VIR_UUID_BUFLEN =3D 16 */ - unsigned char md5[MD5_DIGEST_SIZE]; + /* VIR_CRYPTO_HASH_SIZE_MD5 =3D VIR_UUID_BUFLEN =3D 16 */ + unsigned char md5[VIR_CRYPTO_HASH_SIZE_MD5]; char uuid_string[VIR_UUID_STRING_BUFLEN] =3D ""; =20 /* key may be LUN device path */ @@ -671,8 +670,8 @@ esxStorageVolGetXMLDesc(virStorageVolPtr volume, esxVI_ScsiLun *scsiLun; esxVI_HostScsiDisk *hostScsiDisk =3D NULL; virStorageVolDef def; - /* MD5_DIGEST_SIZE =3D VIR_UUID_BUFLEN =3D 16 */ - unsigned char md5[MD5_DIGEST_SIZE]; + /* VIR_CRYPTO_HASH_SIZE_MD5 =3D VIR_UUID_BUFLEN =3D 16 */ + unsigned char md5[VIR_CRYPTO_HASH_SIZE_MD5]; char uuid_string[VIR_UUID_STRING_BUFLEN] =3D ""; =20 virCheckFlags(0, NULL); diff --git a/src/esx/esx_storage_backend_vmfs.c b/src/esx/esx_storage_backe= nd_vmfs.c index bf5093cf45..630a6aa8c9 100644 --- a/src/esx/esx_storage_backend_vmfs.c +++ b/src/esx/esx_storage_backend_vmfs.c @@ -29,7 +29,6 @@ #include =20 #include "internal.h" -#include "md5.h" #include "viralloc.h" #include "virfile.h" #include "virlog.h" @@ -52,7 +51,7 @@ VIR_LOG_INIT("esx.esx_storage_backend_vmfs"); * The UUID of a storage pool is the MD5 sum of its mount path. Therefore, * verify that UUID and MD5 sum match in size, because we rely on that. */ -verify(MD5_DIGEST_SIZE =3D=3D VIR_UUID_BUFLEN); +verify(VIR_CRYPTO_HASH_SIZE_MD5 =3D=3D VIR_UUID_BUFLEN); =20 =20 =20 @@ -205,8 +204,8 @@ esxStoragePoolLookupByName(virConnectPtr conn, esxPrivate *priv =3D conn->privateData; esxVI_ObjectContent *datastore =3D NULL; esxVI_DatastoreHostMount *hostMount =3D NULL; - /* MD5_DIGEST_SIZE =3D VIR_UUID_BUFLEN =3D 16 */ - unsigned char md5[MD5_DIGEST_SIZE]; + /* VIR_CRYPTO_HASH_SIZE_MD5 =3D VIR_UUID_BUFLEN =3D 16 */ + unsigned char md5[VIR_CRYPTO_HASH_SIZE_MD5]; virStoragePoolPtr pool =3D NULL; =20 if (esxVI_LookupDatastoreByName(priv->primary, name, NULL, &datastore, @@ -260,8 +259,8 @@ esxStoragePoolLookupByUUID(virConnectPtr conn, esxVI_ObjectContent *datastoreList =3D NULL; esxVI_ObjectContent *datastore =3D NULL; esxVI_DatastoreHostMount *hostMount =3D NULL; - /* MD5_DIGEST_SIZE =3D VIR_UUID_BUFLEN =3D 16 */ - unsigned char md5[MD5_DIGEST_SIZE]; + /* VIR_CRYPTO_HASH_SIZE_MD5 =3D VIR_UUID_BUFLEN =3D 16 */ + unsigned char md5[VIR_CRYPTO_HASH_SIZE_MD5]; char *name =3D NULL; virStoragePoolPtr pool =3D NULL; =20 --=20 2.16.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list