diff options
author | Yves-Alexis Perez <corsac@debian.org> | 2013-01-02 14:18:20 +0100 |
---|---|---|
committer | Yves-Alexis Perez <corsac@debian.org> | 2013-01-02 14:18:20 +0100 |
commit | c1343b3278cdf99533b7902744d15969f9d6fdc1 (patch) | |
tree | d5ed3dc5677a59260ec41cd39bb284d3e94c91b3 /src/libradius/radius_socket.c | |
parent | b34738ed08c2227300d554b139e2495ca5da97d6 (diff) | |
download | vyos-strongswan-c1343b3278cdf99533b7902744d15969f9d6fdc1.tar.gz vyos-strongswan-c1343b3278cdf99533b7902744d15969f9d6fdc1.zip |
Imported Upstream version 5.0.1
Diffstat (limited to 'src/libradius/radius_socket.c')
-rw-r--r-- | src/libradius/radius_socket.c | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/src/libradius/radius_socket.c b/src/libradius/radius_socket.c index 048c8814e..ba7cb14b0 100644 --- a/src/libradius/radius_socket.c +++ b/src/libradius/radius_socket.c @@ -148,8 +148,11 @@ METHOD(radius_socket_t, request, radius_message_t*, /* set Message Identifier */ request->set_identifier(request, this->identifier++); /* sign the request */ - request->sign(request, NULL, this->secret, this->hasher, this->signer, - rng, rng != NULL); + if (!request->sign(request, NULL, this->secret, this->hasher, this->signer, + rng, rng != NULL)) + { + return NULL; + } if (!check_connection(this, fd, port)) { @@ -257,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); @@ -358,14 +364,14 @@ radius_socket_t *radius_socket_create(char *address, u_int16_t auth_port, .rng = lib->crypto->create_rng(lib->crypto, RNG_WEAK), ); - if (!this->hasher || !this->signer || !this->rng) + if (!this->hasher || !this->signer || !this->rng || + !this->signer->set_key(this->signer, secret)) { DBG1(DBG_CFG, "RADIUS initialization failed, HMAC/MD5/RNG required"); destroy(this); return NULL; } this->secret = secret; - this->signer->set_key(this->signer, secret); /* we use a random identifier, helps if we restart often */ this->identifier = random(); |