projects
/
tinc
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
7b94926
)
Fix warnings for functions marked __attribute((warn_unused_result)).
author
Guus Sliepen
<guus@tinc-vpn.org>
Fri, 10 May 2013 18:30:47 +0000
(20:30 +0200)
committer
Guus Sliepen
<guus@tinc-vpn.org>
Fri, 10 May 2013 18:30:47 +0000
(20:30 +0200)
src/net_packet.c
patch
|
blob
|
history
src/openssl/prf.c
patch
|
blob
|
history
src/protocol_auth.c
patch
|
blob
|
history
src/protocol_key.c
patch
|
blob
|
history
src/sptps.c
patch
|
blob
|
history
diff --git
a/src/net_packet.c
b/src/net_packet.c
index
c255261
..
9024f26
100644
(file)
--- a/
src/net_packet.c
+++ b/
src/net_packet.c
@@
-669,7
+669,11
@@
static void send_udppacket(node_t *n, vpn_packet_t *origpkt) {
/* Add the message authentication code */
if(digest_active(n->outdigest)) {
/* Add the message authentication code */
if(digest_active(n->outdigest)) {
- digest_create(n->outdigest, &inpkt->seqno, inpkt->len, (char *)&inpkt->seqno + inpkt->len);
+ if(!digest_create(n->outdigest, &inpkt->seqno, inpkt->len, (char *)&inpkt->seqno + inpkt->len)) {
+ logger(DEBUG_TRAFFIC, LOG_ERR, "Error while encrypting packet to %s (%s)", n->name, n->hostname);
+ goto end;
+ }
+
inpkt->len += digest_length(n->outdigest);
}
inpkt->len += digest_length(n->outdigest);
}
diff --git
a/src/openssl/prf.c
b/src/openssl/prf.c
index
943bd62
..
4f5a52b
100644
(file)
--- a/
src/openssl/prf.c
+++ b/
src/openssl/prf.c
@@
-54,10
+54,16
@@
static bool prf_xor(int nid, const char *secret, size_t secretlen, char *seed, s
while(outlen > 0) {
/* Inner HMAC */
while(outlen > 0) {
/* Inner HMAC */
- digest_create(digest, data, len + seedlen, data);
+ if(!digest_create(digest, data, len + seedlen, data)) {
+ digest_close(digest);
+ return false;
+ }
/* Outer HMAC */
/* Outer HMAC */
- digest_create(digest, data, len + seedlen, hash);
+ if(!digest_create(digest, data, len + seedlen, hash)) {
+ digest_close(digest);
+ return false;
+ }
/* XOR the results of the outer HMAC into the out buffer */
for(int i = 0; i < len && i < outlen; i++)
/* XOR the results of the outer HMAC into the out buffer */
for(int i = 0; i < len && i < outlen; i++)
diff --git
a/src/protocol_auth.c
b/src/protocol_auth.c
index
7940ab8
..
a4e3b24
100644
(file)
--- a/
src/protocol_auth.c
+++ b/
src/protocol_auth.c
@@
-273,7
+273,8
@@
bool send_metakey(connection_t *c) {
key[0] &= 0x7F;
key[0] &= 0x7F;
- cipher_set_key_from_rsa(c->outcipher, key, len, true);
+ if(!cipher_set_key_from_rsa(c->outcipher, key, len, true))
+ return false;
if(debug_level >= DEBUG_SCARY_THINGS) {
bin2hex(key, hexkey, len);
if(debug_level >= DEBUG_SCARY_THINGS) {
bin2hex(key, hexkey, len);
@@
-403,11
+404,10
@@
bool challenge_h(connection_t *c, const char *request) {
return false;
}
return false;
}
- c->allow_request = CHAL_REPLY;
-
/* Calculate the hash from the challenge we received */
/* Calculate the hash from the challenge we received */
- digest_create(c->indigest, buffer, len, digest);
+ if(!digest_create(c->indigest, buffer, len, digest))
+ return false;
/* Convert the hash to a hexadecimal formatted string */
/* Convert the hash to a hexadecimal formatted string */
@@
-415,6
+415,8
@@
bool challenge_h(connection_t *c, const char *request) {
/* Send the reply */
/* Send the reply */
+ c->allow_request = CHAL_REPLY;
+
return send_request(c, "%d %s", CHAL_REPLY, buffer);
}
return send_request(c, "%d %s", CHAL_REPLY, buffer);
}
diff --git
a/src/protocol_key.c
b/src/protocol_key.c
index
7f6e165
..
af103c6
100644
(file)
--- a/
src/protocol_key.c
+++ b/
src/protocol_key.c
@@
-273,8
+273,10
@@
bool send_ans_key(node_t *to) {
abort();
randomize(key, keylen);
abort();
randomize(key, keylen);
- cipher_set_key(to->incipher, key, false);
- digest_set_key(to->indigest, key, keylen);
+ if(!cipher_set_key(to->incipher, key, false))
+ abort();
+ if(!digest_set_key(to->indigest, key, keylen))
+ abort();
bin2hex(key, key, keylen);
bin2hex(key, key, keylen);
@@
-418,8
+420,10
@@
bool ans_key_h(connection_t *c, const char *request) {
/* Update our copy of the origin's packet key */
/* Update our copy of the origin's packet key */
- cipher_set_key(from->outcipher, key, true);
- digest_set_key(from->outdigest, key, keylen);
+ if(!cipher_set_key(from->outcipher, key, true))
+ return false;
+ if(!digest_set_key(from->outdigest, key, keylen))
+ return false;
from->status.validkey = true;
from->sent_seqno = 0;
from->status.validkey = true;
from->sent_seqno = 0;
diff --git
a/src/sptps.c
b/src/sptps.c
index
1699b97
..
5d0d456
100644
(file)
--- a/
src/sptps.c
+++ b/
src/sptps.c
@@
-98,7
+98,9
@@
static bool send_record_priv_datagram(sptps_t *s, uint8_t type, const char *data
if(s->outstate) {
// If first handshake has finished, encrypt and HMAC
if(s->outstate) {
// If first handshake has finished, encrypt and HMAC
- cipher_set_counter(s->outcipher, &seqno, sizeof seqno);
+ if(!cipher_set_counter(s->outcipher, &seqno, sizeof seqno))
+ return false;
+
if(!cipher_counter_xor(s->outcipher, buffer + 6, len + 1UL, buffer + 6))
return false;
if(!cipher_counter_xor(s->outcipher, buffer + 6, len + 1UL, buffer + 6))
return false;
@@
-490,7
+492,8
@@
static bool sptps_receive_data_datagram(sptps_t *s, const char *data, size_t len
// Decrypt.
memcpy(&seqno, buffer + 2, 4);
// Decrypt.
memcpy(&seqno, buffer + 2, 4);
- cipher_set_counter(s->incipher, &seqno, sizeof seqno);
+ if(!cipher_set_counter(s->incipher, &seqno, sizeof seqno))
+ return false;
if(!cipher_counter_xor(s->incipher, buffer + 6, len - 4, buffer + 6))
return false;
if(!cipher_counter_xor(s->incipher, buffer + 6, len - 4, buffer + 6))
return false;