Add a return value to hasher_t.get_hash()

This commit is contained in:
Martin Willi
2012-07-16 14:55:06 +02:00
parent ce73fc19db
commit 8bd6a30af1
23 changed files with 174 additions and 89 deletions
@@ -70,7 +70,11 @@ static bool get_cert_hash(private_coupling_validator_t *this,
{
return FALSE;
}
this->hasher->get_hash(this->hasher, encoding, buf);
if (!this->hasher->get_hash(this->hasher, encoding, buf))
{
free(encoding.ptr);
return FALSE;
}
free(encoding.ptr);
chunk_to_hex(chunk_create(buf, this->hasher->get_hash_size(this->hasher)),
hex, FALSE);
+6 -2
View File
@@ -231,8 +231,12 @@ static chunk_t encrypt_mppe_key(private_tnc_pdp_t *this, u_int8_t type,
while (c < data.ptr + data.len)
{
/* b(i) = MD5(S + c(i-1)) */
this->hasher->get_hash(this->hasher, this->secret, NULL);
this->hasher->get_hash(this->hasher, seed, b);
if (!this->hasher->get_hash(this->hasher, this->secret, NULL) ||
!this->hasher->get_hash(this->hasher, seed, b))
{
free(data.ptr);
return chunk_empty;
}
/* c(i) = b(i) xor p(1) */
memxor(c, b, HASH_SIZE_MD5);