diff options
author | Matthias Schiffer <mschiffer@universe-factory.net> | 2013-01-21 19:07:56 +0100 |
---|---|---|
committer | Matthias Schiffer <mschiffer@universe-factory.net> | 2013-01-21 19:07:56 +0100 |
commit | 998300562e14f9d07293ec41e1aecca5930d5e6d (patch) | |
tree | b7d6fdaa365aaefa98c39483052bb94064660a28 /src/method_aes128_gcm.c | |
parent | 96c3ad683d87918fd0e6451d37934ba8b1d03867 (diff) | |
download | fastd-998300562e14f9d07293ec41e1aecca5930d5e6d.tar fastd-998300562e14f9d07293ec41e1aecca5930d5e6d.zip |
Add error message for OOM on buffer alloc
Diffstat (limited to 'src/method_aes128_gcm.c')
-rw-r--r-- | src/method_aes128_gcm.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/method_aes128_gcm.c b/src/method_aes128_gcm.c index dd93540..7dfabef 100644 --- a/src/method_aes128_gcm.c +++ b/src/method_aes128_gcm.c @@ -169,7 +169,7 @@ static bool method_encrypt(fastd_context_t *ctx, fastd_peer_t *peer, fastd_metho memset(in.data, 0, sizeof(fastd_block128_t)); size_t tail_len = alignto(in.len, sizeof(fastd_block128_t))-in.len; - *out = fastd_buffer_alloc(in.len, alignto(NONCEBYTES, 16), sizeof(fastd_block128_t)+tail_len); + *out = fastd_buffer_alloc(ctx, in.len, alignto(NONCEBYTES, 16), sizeof(fastd_block128_t)+tail_len); if (tail_len) memset(in.data+in.len, 0, tail_len); @@ -241,7 +241,7 @@ static bool method_decrypt(fastd_context_t *ctx, fastd_peer_t *peer, fastd_metho fastd_buffer_push_head(&in, NONCEBYTES); size_t tail_len = alignto(in.len, sizeof(fastd_block128_t))-in.len; - *out = fastd_buffer_alloc(in.len, 0, tail_len); + *out = fastd_buffer_alloc(ctx, in.len, 0, tail_len); int n_blocks = (in.len+sizeof(fastd_block128_t)-1)/sizeof(fastd_block128_t); @@ -282,7 +282,7 @@ static bool method_decrypt(fastd_context_t *ctx, fastd_peer_t *peer, fastd_metho else if (age == 0 || session->receive_reorder_seen & (1 << (age-1))) { pr_debug(ctx, "dropping duplicate packet from %P (age %u)", peer, (unsigned)age); fastd_buffer_free(*out); - *out = fastd_buffer_alloc(0, 0, 0); + *out = fastd_buffer_alloc(ctx, 0, 0, 0); } else { pr_debug(ctx, "accepting reordered packet from %P (age %u)", peer, (unsigned)age); |