I have a protocol which needs to secure outgoing packets like so:

FROM:
[n bytes protocol data]

TO:
[j bytes padded/encrypted data][16 bytes IV][12 bytes HMAC]

What is the most clean/efficient way of using evbuffers for this
purpose? I currently do the following in an outgoing filter callback
function:

unsigned char buf[1024];
len = evbuffer_remove(src, buf, ...);
len = crypto_encrypt(...);
...
crypto_hmac(...);
len += 12;
evbuffer_add(dst, buf, len);

The crypto_encrypt function overwrites the data in buf with the
encrypted data and IV.

Is this really the best way to use evbuffers, or are there features in
libevent that help me with this which I am not aware of? I am using SVN
revision 1457.

-- 
Alex

Attachment: signature.asc
Description: PGP signature

_______________________________________________
Libevent-users mailing list
Libevent-users@monkey.org
http://lists.monkey.org:8080/listinfo/libevent-users

Reply via email to