qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Stefan Berger <stefanb@linux.vnet.ibm.com>
To: Kevin O'Connor <kevin@koconnor.net>
Cc: seabios@seabios.org, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH V1 6/8] Add measurement code to the BIOS
Date: Mon, 04 Apr 2011 12:38:31 -0400	[thread overview]
Message-ID: <4D99F407.5010506@linux.vnet.ibm.com> (raw)
In-Reply-To: <20110404045735.GD13528@morn.localdomain>

On 04/04/2011 12:57 AM, Kevin O'Connor wrote:
> On Wed, Mar 30, 2011 at 01:55:40PM -0400, Stefan Berger wrote:
>> This patch adds invocactions of functions that measure various parts of the
>> code and data through various parts of the BIOS code. It follows TCG
>> specifications on what needs to be measured. It also adds the implementation
>> of the called functions.
> [...]
>>   void VISIBLE32FLAT
>>   startBoot(void)
>>   {
>> +    tcpa_calling_int19h();
>> +    tcpa_add_event_separators();
> Why add two functions here, instead of just one function that does
> both actions?
I kept them separate since they're two different 'events', which would 
allow to put another call in between, if another event was to be 
measured - currently there is none. I'll combine the calls.
> [...]
>>       // Initialize tpm (after acpi tables were written)
>>       tcpa_acpi_init();
>>       tcpa_startup();
>> +    tcpa_measure_post((void *)0xE0000, (void *)0xFFFFF);
>> +    tcpa_smbios_measure();
> Same here.  Also, I'm not sure I understand why you're measuring
> 0xE0000-0xFFFFF - if the intent is to measure the code, then it's a
> bit more complicated as the init code has already been relocated by
> this point.
Basically, I wanted to start the measuring as early as possible, ideally 
measuring layers or functions sequentially, which turns out to be quite 
'tricky'. So this was the brute force compromise. I'll drop it and will 
start with the smbios measurement for now.
> [...]
>> +    tcpa_option_rom(FLATPTR_TO_SEG(rom), len);
> You're better off just defining tcpa_option_rom() to take a regular
> pointer.
Done.
> [...]
>> +    /* specs: 8.2.3 step 5 and 8.2.5.6, measure El Torito boot catalog */
>> +    /* measure 2048 bytes (one sector) */
>> +    tcpa_add_bootdevice(1, 0);
>> +    tcpa_ipl(IPL_EL_TORITO_2, GET_SEG(SS), (u32)buffer, 2048);
> Same here for tcpa_ipl().  GET_SEG() always returns 0 in 32bit mode
> and this code is only run in 32bit mode.
>
Done.
> [...]
>> +static struct smbios_entry_point *
>> +find_smbios_entry_point(void)
>> +{
> The smbios table is built in smbios.c:smbios_entry_point_init() -
> instead of scanning for the table, just record where the table is in a
> global variable.
Done.
> [...]
>> +u32
>> +tcpa_smbios_measure(void)
>> +{
>> +    u32 rc;
>> +    struct pcctes pcctes = {
>> +        .eventid = 1, /* 10.4.2.3.1 */
>> +        .eventdatasize = SHA1_BUFSIZE,
>> +    };
>> +    struct smbios_entry_point *sep = find_smbios_entry_point();
>> +
>> +    if (!has_working_tpm())
>> +        return 0;
> BTW - SeaBIOS uses C99, so it's fine to move "if (!has_working_tpm())"
> above the variable declarations.
>
I am moving all these checks above the var decls.

   Stefan
> -Kevin

  reply	other threads:[~2011-04-04 16:38 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-30 17:55 [Qemu-devel] [PATCH V1 0/8] Add TPM support to SeaBIOS Stefan Berger
2011-03-30 17:55 ` [Qemu-devel] [PATCH V1 1/8] Add an implementation for a TPM TIS driver Stefan Berger
2011-03-30 17:55 ` [Qemu-devel] [PATCH V1 2/8] Provide ACPI SSDT table for TPM device + S3 resume support Stefan Berger
2011-04-04  4:17   ` Kevin O'Connor
2011-04-04 14:52     ` Stefan Berger
2011-03-30 17:55 ` [Qemu-devel] [PATCH V1 3/8] Implementation of the TCG BIOS extensions Stefan Berger
2011-04-04  4:14   ` Kevin O'Connor
2011-04-04 14:49     ` Stefan Berger
2011-03-30 17:55 ` [Qemu-devel] [PATCH V1 4/8] Build the TCG BIOS extensions and TPM drivers Stefan Berger
2011-03-30 17:55 ` [Qemu-devel] [PATCH V1 5/8] Support for BIOS interrupt handler Stefan Berger
2011-04-04  4:30   ` Kevin O'Connor
2011-04-04 14:54     ` Stefan Berger
2011-03-30 17:55 ` [Qemu-devel] [PATCH V1 6/8] Add measurement code to the BIOS Stefan Berger
2011-04-04  4:57   ` Kevin O'Connor
2011-04-04 16:38     ` Stefan Berger [this message]
2011-03-30 17:55 ` [Qemu-devel] [PATCH V1 7/8] Add a menu for TPM control Stefan Berger
2011-03-30 17:55 ` [Qemu-devel] [PATCH V1 8/8] Optional tests for the TIS interface Stefan Berger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4D99F407.5010506@linux.vnet.ibm.com \
    --to=stefanb@linux.vnet.ibm.com \
    --cc=kevin@koconnor.net \
    --cc=qemu-devel@nongnu.org \
    --cc=seabios@seabios.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).