#include "esx_vi.h"
#include "esx_vi_methods.h"
#include "esx_util.h"
+#include "vircrypto.h"
#include "virstring.h"
#define VIR_FROM_THIS VIR_FROM_ESX
for (hostVirtualSwitch = hostVirtualSwitchList; hostVirtualSwitch;
hostVirtualSwitch = hostVirtualSwitch->_next) {
- md5_buffer(hostVirtualSwitch->key, strlen(hostVirtualSwitch->key), md5);
+ if (virCryptoHashBuf(VIR_CRYPTO_HASH_MD5, hostVirtualSwitch->key, md5) < 0)
+ goto cleanup;
if (memcmp(uuid, md5, VIR_UUID_BUFLEN) == 0)
break;
* The MD5 sum of the key can be used as UUID, assuming MD5 is considered
* to be collision-free enough for this use case.
*/
- md5_buffer(hostVirtualSwitch->key, strlen(hostVirtualSwitch->key), md5);
+ if (virCryptoHashBuf(VIR_CRYPTO_HASH_MD5, hostVirtualSwitch->key, md5) < 0)
+ return NULL;
network = virGetNetwork(conn, hostVirtualSwitch->name, md5);
goto cleanup;
}
- md5_buffer(hostVirtualSwitch->key, strlen(hostVirtualSwitch->key), md5);
+ if (virCryptoHashBuf(VIR_CRYPTO_HASH_MD5, hostVirtualSwitch->key, md5) < 0)
+ goto cleanup;
network = virGetNetwork(conn, hostVirtualSwitch->name, md5);
goto cleanup;
}
- md5_buffer(hostVirtualSwitch->key, strlen(hostVirtualSwitch->key), def->uuid);
+ if (virCryptoHashBuf(VIR_CRYPTO_HASH_MD5, hostVirtualSwitch->key, def->uuid) < 0)
+ goto cleanup;
if (VIR_STRDUP(def->name, hostVirtualSwitch->name) < 0)
goto cleanup;
#include "esx_vi.h"
#include "esx_vi_methods.h"
#include "esx_util.h"
+#include "vircrypto.h"
#include "virstring.h"
#define VIR_FROM_THIS VIR_FROM_ESX
* but iScsiName (or widely known as IQN) is unique across the multiple
* hosts, using it to compute key
*/
- md5_buffer(target->iScsiName, strlen(target->iScsiName), md5);
+ if (virCryptoHashBuf(VIR_CRYPTO_HASH_MD5, target->iScsiName, md5) < 0)
+ goto cleanup;
pool = virGetStoragePool(conn, name, md5, &esxStorageBackendISCSI, NULL);
for (target = hostInternetScsiHba->configuredStaticTarget;
target; target = target->_next) {
- md5_buffer(target->iScsiName, strlen(target->iScsiName), md5);
+ if (virCryptoHashBuf(VIR_CRYPTO_HASH_MD5, target->iScsiName, md5) < 0)
+ goto cleanup;
if (memcmp(uuid, md5, VIR_UUID_BUFLEN) == 0)
break;
* compute MD5 hash to transform it to an acceptable
* libvirt format
*/
- md5_buffer(scsiLun->uuid, strlen(scsiLun->uuid), md5);
+ if (virCryptoHashBuf(VIR_CRYPTO_HASH_MD5, scsiLun->uuid, md5) < 0)
+ goto cleanup;
virUUIDFormat(md5, uuid_string);
/*
goto cleanup;
}
- md5_buffer(scsiLun->uuid, strlen(scsiLun->uuid), md5);
+ if (virCryptoHashBuf(VIR_CRYPTO_HASH_MD5, scsiLun->uuid, md5) < 0)
+ goto cleanup;
virUUIDFormat(md5, uuid_string);
volume = virGetStorageVol(conn, poolName, path, uuid_string,
memset(uuid_string, '\0', sizeof(uuid_string));
memset(md5, '\0', sizeof(md5));
- md5_buffer(scsiLun->uuid, strlen(scsiLun->uuid), md5);
+ if (virCryptoHashBuf(VIR_CRYPTO_HASH_MD5, scsiLun->uuid, md5) < 0)
+ goto cleanup;
virUUIDFormat(md5, uuid_string);
if (STREQ(key, uuid_string)) {
def.name = volume->name;
- md5_buffer(scsiLun->uuid, strlen(scsiLun->uuid), md5);
+ if (virCryptoHashBuf(VIR_CRYPTO_HASH_MD5, scsiLun->uuid, md5) < 0)
+ goto cleanup;
virUUIDFormat(md5, uuid_string);
#include "esx_vi.h"
#include "esx_vi_methods.h"
#include "esx_util.h"
+#include "vircrypto.h"
#include "virstring.h"
#define VIR_FROM_THIS VIR_FROM_ESX
goto cleanup;
}
- md5_buffer(hostMount->mountInfo->path,
- strlen(hostMount->mountInfo->path), md5);
+ if (virCryptoHashBuf(VIR_CRYPTO_HASH_MD5, hostMount->mountInfo->path, md5) < 0)
+ goto cleanup;
pool = virGetStoragePool(conn, name, md5, &esxStorageBackendVMFS, NULL);
goto cleanup;
}
- md5_buffer(hostMount->mountInfo->path,
- strlen(hostMount->mountInfo->path), md5);
+ if (virCryptoHashBuf(VIR_CRYPTO_HASH_MD5, hostMount->mountInfo->path, md5) < 0)
+ goto cleanup;
if (memcmp(uuid, md5, VIR_UUID_BUFLEN) == 0)
break;