[libvirt] [PATCH v3 07/14] util: Extend virtpm.c with tpm-emulator support

Stefan Berger stefanb at linux.vnet.ibm.com
Thu May 10 20:03:02 UTC 2018


On 05/10/2018 03:29 PM, John Ferlan wrote:
>
> On 05/09/2018 01:47 PM, Stefan Berger wrote:
>> On 05/08/2018 04:30 PM, John Ferlan wrote:
>>> On 05/04/2018 04:21 PM, Stefan Berger wrote:
>>>> Add functions for managing the storage of the external swtpm as well
>>>> as starting and stopping it. Also implement functions to use
>>>> swtpm_setup,
>>>> which simulates the manufacturing of a TPM which includes creation of
>>>> certificates for the device.
>>>>
>>>> Signed-off-by: Stefan Berger <stefanb at linux.vnet.ibm.com>
>>>> ---
>>>>    src/libvirt_private.syms |   5 +
>>>>    src/util/virtpm.c        | 536
>>>> ++++++++++++++++++++++++++++++++++++++++++++++-
>>>>    src/util/virtpm.h        |  33 ++-
>>>>    3 files changed, 572 insertions(+), 2 deletions(-)
>>>>> diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
>>>> index 33fe75b..eebfc72 100644
>>>> --- a/src/libvirt_private.syms
>>>> +++ b/src/libvirt_private.syms
>>>> @@ -2984,6 +2984,11 @@ virTimeStringThenRaw;
>>>>      # util/virtpm.h
>>>>    virTPMCreateCancelPath;
>>>> +virTPMDeleteEmulatorStorage;
>>>> +virTPMEmulatorBuildCommand;
>>>> +virTPMEmulatorInitPaths;
>>>> +virTPMEmulatorPrepareHost;
>>>> +virTPMEmulatorStop;
>>>>        # util/virtypedparam.h
>>>> diff --git a/src/util/virtpm.c b/src/util/virtpm.c
>>>> index d5c10da..76bbb21 100644
>>>> --- a/src/util/virtpm.c
>>>> +++ b/src/util/virtpm.c
>>>> @@ -1,7 +1,7 @@
>>>>    /*
>>>>     * virtpm.c: TPM support
>>>>     *
>>>> - * Copyright (C) 2013 IBM Corporation
>>>> + * Copyright (C) 2013,2018 IBM Corporation
>>>>     *
>>>>     * This library is free software; you can redistribute it and/or
>>>>     * modify it under the terms of the GNU Lesser General Public
>>>> @@ -22,16 +22,36 @@
>>>>      #include <config.h>
>>>>    +#include <sys/types.h>
>>>>    #include <sys/stat.h>
>>>> +#include <unistd.h>
>>>> +#include <fcntl.h>
>>>> +#include <cap-ng.h>
>>>>    +#include "conf/domain_conf.h"
>>> syntax-check would have told you unsafe cross-directory include - IOW
>>> including conf/* files into util/* files is not allowed.
>>>
>>> So I think you need to rethink where some of these functions will go. I
>>> think they are mostly all used by the qemu_extdevice.c changes in patch
>>> 9, so perhaps they need to get folded into them.  There at least you can
>>> grab the conf/domain_conf.h file.
>> Probably best to do that... rather than passing the fields of
>> virDomainTPMDef into the functions instead.
>> Currently the functions have the prefix virTPM. That will have to change
>> - to qemuTPM? So I'll merge these functions into qemu_extdevice.c? or
>> another new file qemu_tpm.c ?
>>
>>
> qemu_tpm.c seems good for those specific things

Will post v4 soon.

    Stefan




More information about the libvir-list mailing list