please disregard my last message. i realised that the problem is that the way i obtain the measurement file (using vim) is also being measured, which i didn't factor in.

sorry  - adrian

On Tue, Oct 14, 2008 at 3:58 PM, adrian golding <> wrote:
hi, i tried again to verify the measurements, this time in C:
i followed closely to the pseudo code provided in the ima INSTALL file:
    char fileName[50] = "ascii_runtime_measurements";
    unsigned char*    buf, event;

    memset(PCR, 0, SHA_DIGEST_LENGTH);
    while(fgets(event, 1024, fd_bin_measurements) != NULL) {

        buf = event + 3; // skip to the start of the hash
        for(j = 0; j < SHA_DIGEST_LENGTH; j++){
            strncpy(testText, buf + 2*j, 2);
            intResult = convertToInt(testText);  //change 2 bytes of char, take it as a hex number and change it to int
                                                                // intResult will be between 0 to 255.    
            memset(tempPointer + j, intResult, 1);   

        SHA1_Update(&c, PCR, SHA_DIGEST_LENGTH);
        SHA1_Update(&c, tempPointer, SHA_DIGEST_LENGTH);
        SHA1_Final(PCR, &c);

i assume using the ascii file is alright and i checked the convertToInt function and it converts correctly.
i also ran it several times since a new version of my program generates a new reading.

thank you- adrian

On Wed, Oct 8, 2008 at 10:58 AM, adrian golding <> wrote:
i am trying to write a simple python script to verify my measurements list with PCR10 but it doesn't match.  Anybody see the mistake?
thank you - adrian

previousPCRValue = "0000000000000000000000000000000000000000"

for line in obtainedFile.readlines():

    lineArray = str.split(line)
    # using ascii measurements file, lineArray[1] is the hash value
    # concatenation
    combineHex    = previousPCRValue + lineArray[1]
    # change to binary
    combineBinary     = binascii.unhexlify(combineHex)
    # hash it
    computedHash = hashlib.sha1(combineBinary)
    # change it to hex
    previousPCRValue = computedHash.hexdigest()