[ENet-discuss] added encryption to enet

LoneSock lonesock at gmail.com
Mon Oct 3 17:00:19 PDT 2005


Hi, All.

I've modified enet to implement encryption. I use the Block TEA algorithm
(supposedly decent, in the public domain, and very simple to implement). See
this link I found via Google for more info:
http://www-users.cs.york.ac.uk/~matthew/TEA/TEA.html

There is no support for anything fancy like sending passwords, etc. Both
sides must have the 128-bit key. Right now it has the following features:

- encryption is flagged per packet (using the new ENET_PACKET_FLAG_ENCRYPTED
enum)
so you can send unencrypted packets (no overhead) as well as encrypted)

- the password is set per peer (each peer has a new part: "enet_uint32
TEAKey[4]; /**< 128-bit key for the BlockTEA */")
so you could have different passwords for each peer connecting to a server

- encryption only happens once, just before sending (so broadcasting has no
more overhead than for a single packet encrypt)

- I had to modify packet.c, so I went ahead and added:
"int enet_packet_append (ENetPacket * packet, const void * addData, size_t
addMsgLength)"
which adds data to the packet internally while resizing it for you.
Encryption has to happen on a 4-byte block,
so I modified the packet structure to have a message length, as well as the
actual (internally rounded up to a multiple of 4)
buffer size. Most (all?) of the changes should be transparent to the user,
at least that was the design goal.

Does anyone see any problems with the chosen architecture (I know, I should
have asked _before_ implementing this [8^)? I'd like some volunteers to help
me test this (it might be foolish to add it to the CVS as is). I can host
the modded version on my site until it's accepted, if that is OK with Lee
Salzman (I have no desire to make this a fork, and I don't want to push Lee,
either).

thanks for any comments,
Jonathan


--
Piranha are people too.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.puremagic.com/pipermail/enet-discuss/attachments/20051003/9c57919c/attachment.htm


More information about the ENet-discuss mailing list