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án Tomko <jtomko(a)redhat.com>
---
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 @@
#include <config.h>
-#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 == VIR_UUID_BUFLEN);
+verify(VIR_CRYPTO_HASH_SIZE_MD5 == VIR_UUID_BUFLEN);
static int
@@ -142,7 +141,7 @@ esxNetworkLookupByUUID(virConnectPtr conn, const unsigned char *uuid)
esxPrivate *priv = conn->privateData;
esxVI_HostVirtualSwitch *hostVirtualSwitchList = NULL;
esxVI_HostVirtualSwitch *hostVirtualSwitch = NULL;
- unsigned char md5[MD5_DIGEST_SIZE]; /* MD5_DIGEST_SIZE = VIR_UUID_BUFLEN = 16 */
+ unsigned char md5[VIR_CRYPTO_HASH_SIZE_MD5]; /* VIR_CRYPTO_HASH_SIZE_MD5 =
VIR_UUID_BUFLEN = 16 */
char uuid_string[VIR_UUID_STRING_BUFLEN] = "";
if (esxVI_EnsureSession(priv->primary) < 0 ||
@@ -186,7 +185,7 @@ esxNetworkLookupByName(virConnectPtr conn, const char *name)
virNetworkPtr network = NULL;
esxPrivate *priv = conn->privateData;
esxVI_HostVirtualSwitch *hostVirtualSwitch = NULL;
- unsigned char md5[MD5_DIGEST_SIZE]; /* MD5_DIGEST_SIZE = VIR_UUID_BUFLEN = 16 */
+ unsigned char md5[VIR_CRYPTO_HASH_SIZE_MD5]; /* VIR_CRYPTO_HASH_SIZE_MD5 =
VIR_UUID_BUFLEN = 16 */
if (esxVI_EnsureSession(priv->primary) < 0 ||
esxVI_LookupHostVirtualSwitchByName(priv->primary, name,
@@ -296,7 +295,7 @@ esxNetworkDefineXML(virConnectPtr conn, const char *xml)
esxVI_HostPortGroupSpec *hostPortGroupSpec = NULL;
size_t i;
- unsigned char md5[MD5_DIGEST_SIZE]; /* MD5_DIGEST_SIZE = VIR_UUID_BUFLEN = 16 */
+ unsigned char md5[VIR_CRYPTO_HASH_SIZE_MD5]; /* VIR_CRYPTO_HASH_SIZE_MD5 =
VIR_UUID_BUFLEN = 16 */
if (esxVI_EnsureSession(priv->primary) < 0)
return NULL;
diff --git a/src/esx/esx_storage_backend_iscsi.c b/src/esx/esx_storage_backend_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 <unistd.h>
#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 == VIR_UUID_BUFLEN);
+verify(VIR_CRYPTO_HASH_SIZE_MD5 == VIR_UUID_BUFLEN);
@@ -157,8 +156,8 @@ esxStoragePoolLookupByName(virConnectPtr conn,
{
esxPrivate *priv = conn->privateData;
esxVI_HostInternetScsiHbaStaticTarget *target = NULL;
- /* MD5_DIGEST_SIZE = VIR_UUID_BUFLEN = 16 */
- unsigned char md5[MD5_DIGEST_SIZE];
+ /* VIR_CRYPTO_HASH_SIZE_MD5 = VIR_UUID_BUFLEN = 16 */
+ unsigned char md5[VIR_CRYPTO_HASH_SIZE_MD5];
virStoragePoolPtr pool = NULL;
/*
@@ -202,8 +201,8 @@ esxStoragePoolLookupByUUID(virConnectPtr conn,
esxPrivate *priv = conn->privateData;
esxVI_HostInternetScsiHba *hostInternetScsiHba = NULL;
esxVI_HostInternetScsiHbaStaticTarget *target;
- /* MD5_DIGEST_SIZE = VIR_UUID_BUFLEN = 16 */
- unsigned char md5[MD5_DIGEST_SIZE];
+ /* VIR_CRYPTO_HASH_SIZE_MD5 = VIR_UUID_BUFLEN = 16 */
+ unsigned char md5[VIR_CRYPTO_HASH_SIZE_MD5];
if (esxVI_LookupHostInternetScsiHba(priv->primary,
&hostInternetScsiHba) < 0) {
@@ -443,8 +442,8 @@ esxStorageVolLookupByName(virStoragePoolPtr pool,
esxPrivate *priv = pool->conn->privateData;
esxVI_ScsiLun *scsiLunList = NULL;
esxVI_ScsiLun *scsiLun;
- /* MD5_DIGEST_SIZE = VIR_UUID_BUFLEN = 16 */
- unsigned char md5[MD5_DIGEST_SIZE];
+ /* VIR_CRYPTO_HASH_SIZE_MD5 = VIR_UUID_BUFLEN = 16 */
+ unsigned char md5[VIR_CRYPTO_HASH_SIZE_MD5];
char uuid_string[VIR_UUID_STRING_BUFLEN] = "";
if (esxVI_LookupScsiLunList(priv->primary, &scsiLunList) < 0)
@@ -491,8 +490,8 @@ esxStorageVolLookupByPath(virConnectPtr conn, const char *path)
esxVI_ScsiLun *scsiLun;
esxVI_HostScsiDisk *hostScsiDisk = NULL;
char *poolName = NULL;
- /* MD5_DIGEST_SIZE = VIR_UUID_BUFLEN = 16 */
- unsigned char md5[MD5_DIGEST_SIZE];
+ /* VIR_CRYPTO_HASH_SIZE_MD5 = VIR_UUID_BUFLEN = 16 */
+ unsigned char md5[VIR_CRYPTO_HASH_SIZE_MD5];
char uuid_string[VIR_UUID_STRING_BUFLEN] = "";
if (esxVI_LookupScsiLunList(priv->primary, &scsiLunList) < 0)
@@ -538,8 +537,8 @@ esxStorageVolLookupByKey(virConnectPtr conn, const char *key)
char *poolName = NULL;
esxVI_ScsiLun *scsiLunList = NULL;
esxVI_ScsiLun *scsiLun;
- /* MD5_DIGEST_SIZE = VIR_UUID_BUFLEN = 16 */
- unsigned char md5[MD5_DIGEST_SIZE];
+ /* VIR_CRYPTO_HASH_SIZE_MD5 = VIR_UUID_BUFLEN = 16 */
+ unsigned char md5[VIR_CRYPTO_HASH_SIZE_MD5];
char uuid_string[VIR_UUID_STRING_BUFLEN] = "";
/* key may be LUN device path */
@@ -671,8 +670,8 @@ esxStorageVolGetXMLDesc(virStorageVolPtr volume,
esxVI_ScsiLun *scsiLun;
esxVI_HostScsiDisk *hostScsiDisk = NULL;
virStorageVolDef def;
- /* MD5_DIGEST_SIZE = VIR_UUID_BUFLEN = 16 */
- unsigned char md5[MD5_DIGEST_SIZE];
+ /* VIR_CRYPTO_HASH_SIZE_MD5 = VIR_UUID_BUFLEN = 16 */
+ unsigned char md5[VIR_CRYPTO_HASH_SIZE_MD5];
char uuid_string[VIR_UUID_STRING_BUFLEN] = "";
virCheckFlags(0, NULL);
diff --git a/src/esx/esx_storage_backend_vmfs.c b/src/esx/esx_storage_backend_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 <unistd.h>
#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 == VIR_UUID_BUFLEN);
+verify(VIR_CRYPTO_HASH_SIZE_MD5 == VIR_UUID_BUFLEN);
@@ -205,8 +204,8 @@ esxStoragePoolLookupByName(virConnectPtr conn,
esxPrivate *priv = conn->privateData;
esxVI_ObjectContent *datastore = NULL;
esxVI_DatastoreHostMount *hostMount = NULL;
- /* MD5_DIGEST_SIZE = VIR_UUID_BUFLEN = 16 */
- unsigned char md5[MD5_DIGEST_SIZE];
+ /* VIR_CRYPTO_HASH_SIZE_MD5 = VIR_UUID_BUFLEN = 16 */
+ unsigned char md5[VIR_CRYPTO_HASH_SIZE_MD5];
virStoragePoolPtr pool = NULL;
if (esxVI_LookupDatastoreByName(priv->primary, name, NULL, &datastore,
@@ -260,8 +259,8 @@ esxStoragePoolLookupByUUID(virConnectPtr conn,
esxVI_ObjectContent *datastoreList = NULL;
esxVI_ObjectContent *datastore = NULL;
esxVI_DatastoreHostMount *hostMount = NULL;
- /* MD5_DIGEST_SIZE = VIR_UUID_BUFLEN = 16 */
- unsigned char md5[MD5_DIGEST_SIZE];
+ /* VIR_CRYPTO_HASH_SIZE_MD5 = VIR_UUID_BUFLEN = 16 */
+ unsigned char md5[VIR_CRYPTO_HASH_SIZE_MD5];
char *name = NULL;
virStoragePoolPtr pool = NULL;
--
2.16.1