Message Digests

T_memcpy (newStateInfo.data, bsfStateInfo.data, newStateInfo.len); } while (0);

if (status != 0)

RSA_PrintError ("DigestDataSavedState", status); else {

/* update stateInfo so the caller can have an updated algorithm object */ T_memset (stateInfo->data, 0, stateInfo->len);

T_free (stateInfo->data); stateInfo->data = newStateInfo.data; stateInfo->len = newStateInfo.len;

}

B_DestroyAlgorithmObject (&digestObj);

return status;

}/* end DigestDataSavedState */

This routine can be called until all of the data blocks have been digested. We can then restore the algorithm object and call B_DigestFinal() to obtain the message digest. Note that following a call to B_*Final, the algorithm object is restored to the state it was in following the previous B_*Init call.

The mdigsv.c program shows that digesting a file using all three methods produce the same result.

1 6 0

R S A B S A F E C r y p t o - C D e v e l o p e r ’s G u i d e

Page 182
Image 182
RSA Security 5.2.2 manual Message Digests