vmapple/aes: refuse to start without a crypto library

Every data command goes through qcrypto. In a QEMU built without gnutls,
nettle or libgcrypt the cipher backend is a stub that refuses them all:
cmd_data() fails, the command never leaves the FIFO, and the flag
command queued behind it never raises its interrupt. macOS waits for it
a few seconds into the kernel (about five seconds after QEMU starts),
with every vCPU idle in WFI and the root disk stopped at 598 reads
(rd_bytes 2437632). Fail at realize with an error that names the fix.

Signed-off-by: awaiiro <332003006+awaiiro@users.noreply.github.com>
This commit is contained in:
awaiiro 2026-10-15 23:11:24 +00:00
commit 53bd9108cf

View file

@ -18,6 +18,7 @@
#include "hw/core/sysbus.h"
#include "hw/vmapple/vmapple.h"
#include "migration/vmstate.h"
#include "qapi/error.h"
#include "qemu/cutils.h"
#include "qemu/log.h"
#include "qemu/module.h"
@ -564,10 +565,28 @@ static void aes_init(Object *obj)
s->as = &address_space_memory;
}
static void aes_realize(DeviceState *dev, Error **errp)
{
/*
* Every data command goes through qcrypto. Built without gnutls, nettle
* or libgcrypt, the cipher is a stub that refuses all of them: the first
* command then never completes and macOS stops a few seconds into the
* kernel with every CPU idle. Refuse to start instead.
*/
if (!qcrypto_cipher_supports(QCRYPTO_CIPHER_ALGO_AES_256,
QCRYPTO_CIPHER_MODE_CBC)) {
error_setg(errp, "%s: this QEMU was built without a crypto library; "
"rebuild it with gnutls, nettle or libgcrypt",
TYPE_APPLE_AES);
}
}
static void aes_class_init(ObjectClass *klass, const void *data)
{
DeviceClass *dc = DEVICE_CLASS(klass);
ResettableClass *rc = RESETTABLE_CLASS(klass);
dc->realize = aes_realize;
rc->phases.hold = aes_reset;
}