Ejemplo n.º 1
0
bool
GRecord::VerifyGRecordInFile(Path path, Error &error)
{
  // assumes FileName member is set
  // Load File into Buffer (assume name is already set)
  if (!LoadFileToBuffer(path, error))
    return false;

  // load Existing Digest "old"
  char old_g_record[DIGEST_LENGTH + 1];
  if (!ReadGRecordFromFile(path, old_g_record, ARRAY_SIZE(old_g_record), error))
    return false;

  // recalculate digest from buffer
  FinalizeBuffer();

  char new_g_record[DIGEST_LENGTH + 1];
  GetDigest(new_g_record);

  if (strcmp(old_g_record, new_g_record) != 0) {
    error.Set(grecord_domain, "Invalid G record");
    return false;
  }

  return true;
}
Ejemplo n.º 2
0
bool
GRecord::VerifyGRecordInFile(const TCHAR *path)
{
  // assumes FileName member is set
  // Load File into Buffer (assume name is already set)
  LoadFileToBuffer(path);

  // load Existing Digest "old"
  char old_g_record[DIGEST_LENGTH + 1];
  if (!ReadGRecordFromFile(path, old_g_record, ARRAY_SIZE(old_g_record)))
    return false;

  // recalculate digest from buffer
  FinalizeBuffer();

  char new_g_record[DIGEST_LENGTH + 1];
  GetDigest(new_g_record);

  return strcmp(old_g_record, new_g_record) == 0;
}
Ejemplo n.º 3
0
bool
GRecord::VerifyGRecordInFile()
{
  // assumes FileName member is set
  // Load File into Buffer (assume name is already set)
  LoadFileToBuffer();

  // load Existing Digest "old"
  char old_g_record[BUFF_LEN];
  if (!ReadGRecordFromFile(old_g_record, BUFF_LEN))
    return false;

  // recalculate digest from buffer
  FinalizeBuffer();

  char new_g_record[BUFF_LEN];
  GetDigest(new_g_record);

  return strcmp(old_g_record, new_g_record) == 0;
}