2 * SPDX-License-Identifier: BSD-2-Clause
4 * Copyright (c) 2023 Beckhoff Automation GmbH & Co. KG
5 * Author: Corvin Köhne <corvink@FreeBSD.org>
13 #include <malloc_np.h>
18 #include "tpm_device.h"
26 tpm_passthru_init(void **sc, nvlist_t *nvl)
28 struct tpm_passthru *tpm;
31 tpm = calloc(1, sizeof(struct tpm_passthru));
33 warnx("%s: failed to allocate tpm passthru", __func__);
37 path = get_config_value_node(nvl, "path");
38 tpm->fd = open(path, O_RDWR);
40 warnx("%s: unable to open tpm device \"%s\"", __func__, path);
50 tpm_passthru_deinit(void *sc)
52 struct tpm_passthru *tpm;
64 static const struct tpm_emul tpm_emul_passthru = {
66 .init = tpm_passthru_init,
67 .deinit = tpm_passthru_deinit,
69 TPM_EMUL_SET(tpm_emul_passthru);