Re: [EDK DEV] NvRam Checksum in EFI

Subject: Re: [EDK DEV] NvRam Checksum in EFI

From: Randy Thelen <>


Date: 2009-07-06 19:11:16

sivaraman wrote:

> Is there any way to detect the NVRam checksum in EFI. I had tried by  
> collecting all EFI variables and perform a byte checksum it doesnt  
> given the Zero Checksum. I dont know whether that is the right way  
> or not. could you please answer

Chances are good that the checksum is created by summing the contents  
of the NVRAM memory region which includes more than the contents of  
the variables it contains.  This will include meta-data about the  
variables (e.g., the length of each variable and the offset to the  
next variable) in whatever format that data is encoded in (UINT32,  
UINT64, whatever).  Plus, most checksum systems maintain an additional  
field specifically to include the UINTxx which holds the value  
necessary to ensure the checksum result is 0.

At any rate, you as a client cannot recompute the checksum of the  
NVRAM by looking at the data which you can get from the NVRAM.  You'll  
need access (via the NVRAM protocol) to the NVRAM memory itself (and  
the algorithm used) to validate the NVRAM contents.

I don't know if the NVRAM provides such an interface.  If not, you  
could certainly add it.  But then your code would work with an NVRAM  
which provides this protocol (i.e., your own).

-- Randy


 [ URL]