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
+8 -5
View File
@@ -332,8 +332,11 @@ METHOD(radius_message_t, sign, bool,
/* build Response-Authenticator */
msg = chunk_create((u_char*)this->msg, ntohs(this->msg->length));
hasher->get_hash(hasher, msg, NULL);
hasher->get_hash(hasher, secret, this->msg->authenticator);
if (!hasher->get_hash(hasher, msg, NULL) ||
!hasher->get_hash(hasher, secret, this->msg->authenticator))
{
return FALSE;
}
}
return TRUE;
}
@@ -364,9 +367,9 @@ METHOD(radius_message_t, verify, bool,
}
/* verify Response-Authenticator */
hasher->get_hash(hasher, msg, NULL);
hasher->get_hash(hasher, secret, buf);
if (!memeq(buf, res_auth, HASH_SIZE_MD5))
if (!hasher->get_hash(hasher, msg, NULL) ||
!hasher->get_hash(hasher, secret, buf) ||
!memeq(buf, res_auth, HASH_SIZE_MD5))
{
DBG1(DBG_CFG, "RADIUS Response-Authenticator verification failed");
return FALSE;
+5 -2
View File
@@ -260,8 +260,11 @@ static chunk_t decrypt_mppe_key(private_radius_socket_t *this, u_int16_t salt,
while (c < C.ptr + C.len)
{
/* b(i) = MD5(S + c(i-1)) */
this->hasher->get_hash(this->hasher, this->secret, NULL);
this->hasher->get_hash(this->hasher, seed, p);
if (!this->hasher->get_hash(this->hasher, this->secret, NULL) ||
!this->hasher->get_hash(this->hasher, seed, p))
{
return chunk_empty;
}
/* p(i) = b(i) xor c(1) */
memxor(p, c, HASH_SIZE_MD5);