# util/vircrypto.h
virCryptoEncryptData;
-virCryptoGenerateRandom;
virCryptoHashBuf;
virCryptoHashString;
virCryptoHaveCipher;
#include "viratomic.h"
#include "virprocess.h"
#include "vircrypto.h"
+#include "virrandom.h"
#include "virsystemd.h"
#include "secret_util.h"
#include "logging/log_manager.h"
return -1;
priv->masterKeyLen = QEMU_DOMAIN_MASTER_KEY_LEN;
- if (virCryptoGenerateRandom(priv->masterKey, priv->masterKeyLen) < 0) {
+ if (virRandomBytes(priv->masterKey, priv->masterKeyLen) < 0) {
VIR_DISPOSE_N(priv->masterKey, priv->masterKeyLen);
return -1;
}
goto cleanup;
/* Create a random initialization vector */
- if (virCryptoGenerateRandom(raw_iv, ivlen) < 0)
+ if (virRandomBytes(raw_iv, ivlen) < 0)
goto cleanup;
/* Encode the IV and save that since qemu will need it */
return -1;
}
#endif
-
-/* virCryptoGenerateRandom:
- * @buf: Pointer to location to store bytes
- * @buflen: Number of bytes to store
- *
- * Generate a random stream of @buflen length and store it into @buf.
- *
- * Since the gnutls_rnd could be missing, provide an alternate less
- * secure mechanism to at least have something.
- *
- * Returns 0 on success or -1 on failure (with error reported)
- */
-int
-virCryptoGenerateRandom(unsigned char *buf,
- size_t buflen)
-{
- return virRandomBytes(buf, buflen);
-}
ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(6)
ATTRIBUTE_NONNULL(8) ATTRIBUTE_NONNULL(9) ATTRIBUTE_RETURN_CHECK;
-int virCryptoGenerateRandom(unsigned char *buf,
- size_t buflen) ATTRIBUTE_NOINLINE;
-
#endif /* __VIR_CRYPTO_H__ */
/* nada */
}
-int
-virCryptoGenerateRandom(unsigned char *buf,
- size_t buflen)
-{
- return virRandomBytes(buf, buflen);
-}
-
int
virNetDevOpenvswitchGetVhostuserIfname(const char *path ATTRIBUTE_UNUSED,
char **ifname)