}
-/* QEMU 1.2 and later have a binary flag -enable-fips that must be
- * used for VNC auth to obey FIPS settings; but the flag only
- * exists on Linux, and with no way to probe for it via QMP. Our
- * solution: if FIPS mode is required, then unconditionally use
- * the flag, regardless of qemu version, for the following matrix:
- *
- * old QEMU new QEMU
- * FIPS enabled doesn't start VNC auth disabled
- * FIPS disabled/missing VNC auth enabled VNC auth enabled
- *
- * In QEMU 5.2.0, use of -enable-fips was deprecated. In scenarios
- * where FIPS is required, QEMU must be built against libgcrypt
- * which automatically enforces FIPS compliance.
- */
-bool
-qemuCheckFips(virDomainObj *vm)
-{
- qemuDomainObjPrivate *priv = vm->privateData;
-
- if (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_ENABLE_FIPS))
- return false;
-
- return priv->driver->hostFips;
-}
-
-
/**
* qemuDiskBusIsSD:
* @bus: disk bus
const char *migrateURI,
virDomainMomentObj *snapshot,
virNetDevVPortProfileOp vmop,
- bool enableFips,
size_t *nnicindexes,
int **nicindexes,
unsigned int flags)
if (qemuBuildPflashBlockdevCommandLine(cmd, priv) < 0)
return NULL;
- if (enableFips)
+ /* QEMU 1.2 and later have a binary flag -enable-fips that must be
+ * used for VNC auth to obey FIPS settings; but the flag only
+ * exists on Linux, and with no way to probe for it via QMP. Our
+ * solution: if FIPS mode is required, then unconditionally use the flag.
+ *
+ * In QEMU 5.2.0, use of -enable-fips was deprecated. In scenarios
+ * where FIPS is required, QEMU must be built against libgcrypt
+ * which automatically enforces FIPS compliance.
+ *
+ * Note this is the only use of driver->hostFips.
+ */
+ if (driver->hostFips &&
+ virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_ENABLE_FIPS))
virCommandAddArg(cmd, "-enable-fips");
if (qemuBuildMachineCommandLine(cmd, cfg, def, qemuCaps, priv) < 0)
if (!(cmd = qemuBuildCommandLine(vm,
incoming ? "defer" : NULL,
snapshot, vmop,
- qemuCheckFips(vm),
&nnicindexes, &nicindexes, 0)))
goto cleanup;
virCommand *
qemuProcessCreatePretendCmdBuild(virDomainObj *vm,
const char *migrateURI,
- bool enableFips,
unsigned int flags)
{
return qemuBuildCommandLine(vm,
migrateURI,
NULL,
VIR_NETDEV_VPORT_PROFILE_OP_NO_OP,
- enableFips,
NULL,
NULL,
flags);
unsigned int flags)
{
qemuDomainObjPrivate *priv = vm->privateData;
- bool enableFips;
size_t i;
drv->hostFips = flags & FLAG_FIPS_HOST;
- enableFips = drv->hostFips;
if (qemuProcessCreatePretendCmdPrepare(drv, vm, migrateURI,
VIR_QEMU_PROCESS_START_COLD) < 0)
}
}
- /* we can't use qemuCheckFips() directly as it queries host state */
- if (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_ENABLE_FIPS))
- enableFips = false;
-
- return qemuProcessCreatePretendCmdBuild(vm, migrateURI,
- enableFips, 0);
+ return qemuProcessCreatePretendCmdBuild(vm, migrateURI, 0);
}