Add a return value to hasher_t.allocate_hash()

This commit is contained in:
Martin Willi
2012-07-16 14:55:06 +02:00
parent e185612dd8
commit 87dd205b61
40 changed files with 269 additions and 149 deletions
+6 -2
View File
@@ -321,8 +321,12 @@ static bool parse_public_key(private_pgp_cert_t *this, chunk_t packet)
DBG1(DBG_ASN, "no SHA-1 hasher available");
return FALSE;
}
hasher->allocate_hash(hasher, pubkey_packet_header, NULL);
hasher->allocate_hash(hasher, pubkey_packet, &this->fingerprint);
if (!hasher->allocate_hash(hasher, pubkey_packet_header, NULL) ||
!hasher->allocate_hash(hasher, pubkey_packet, &this->fingerprint))
{
hasher->destroy(hasher);
return FALSE;
}
hasher->destroy(hasher);
DBG2(DBG_ASN, "L2 - v4 fingerprint %#B", &this->fingerprint);
}
+6 -2
View File
@@ -44,8 +44,12 @@ static bool build_v3_fingerprint(chunk_t *encoding, va_list args)
{
e = chunk_skip(e, 1);
}
hasher->allocate_hash(hasher, n, NULL);
hasher->allocate_hash(hasher, e, encoding);
if (!hasher->allocate_hash(hasher, n, NULL) ||
!hasher->allocate_hash(hasher, e, encoding))
{
hasher->destroy(hasher);
return FALSE;
}
hasher->destroy(hasher);
return TRUE;
}