Archive for August, 2007

Protocol Encryption (MSE) has landed!

Wednesday, August 29th, 2007

Big news today, not just for Niagara, but for the whole Mac Bittorrent community - Protocol Encryption has been added to Niagara!

I’ve just committed  revision 133, which adds a new protocolencryption.c function library to libniagara, as well as slight modification to the handshake code in peer.c to accommodate the slightly different process. I’ve also extended the stream socket class to incorporate inline RC4 encryption and decryption.

All the crypto functions are from OpenSSL, so the added functionality adds no bloat to Niagara (OpenSSL is installed by default on OS X).

Of course, the big question is “When can I play with it?” The code in SVN isn’t quite ready for primetime yet. Revision 133 establishes a full encrypted connection with compatible clients, but I haven’t quite figured out the finer points of then carrying on with the higher level Bittorrent protocol. The fallback code also isn’t as robust as I’d like. However, given that it took me 4 days to get this far, a release with MSE fully functional should be out the door by this weekend.

You’re welcome to take a look at the changes over at the SVN browser, but please note that unlike the rest of libniagara, the protocol encryption library is licenced under the GPL, rather than the LGPL.

Stay tuned!

Sick of throttling? I am.

Monday, August 27th, 2007

 The code below should give you an idea of what I’m doing about it.

#pragma mark Diffie-Hellman exchange

int mse_generate_public_key(btContext *ctx)
{
int checkcode;
BIGNUM *prime = NULL, *generator = NULL;
BN_hex2bn(′, safe_prime);
BN_hex2bn(&generator, safe_generator);

ctx->dh_key_struct = DH_new();
ctx->dh_key_struct->p = prime;
ctx->dh_key_struct->g = generator;
DH_check(ctx->dh_key_struct,&checkcode);
if (checkcode == 0 && DH_generate_key(ctx->dh_key_struct) == 1)
{
#ifdef MSE_DEBUG
fprintf(stderr, “Generated public/private key pair, length = %i bytes (%i bit)\n”,
BN_num_bytes(ctx->dh_key_struct->priv_key),
BN_num_bytes(ctx->dh_key_struct->priv_key)*8);
#endif
return 0;
}
return -1;
}

Hopefully landing in SVN in the next day or so, and I’ll be getting a release out this week.

New allocation code in SVN

Tuesday, August 14th, 2007

I’ve just committed revision 128 to Niagara’s SVN, which reincorporates my updated block segmenting and allocation code. I’m happy to write a detailed comparison if anyone’s interested, but basically the old code stored a bitset for completed pieces (subsets of a block) and the index of the next request. This worked fine with a single peer per block system, but I noticed poor performance on torrents with large chunks (>1mb). (more…)

0.1 Alpha 2 Released!

Monday, August 13th, 2007

I noticed a few issues with some of the more experimental block allocation code I’d written, so for the moment I’ve reverted to the older stable code. I’ve also put in a few minor visual improvements.

Grab it at SourceForge or let Sparkle take care of the update for you.

0.1 Alpha 1 Released!

Sunday, August 12th, 2007

I’ve decided that few enough show-stopping bugs are left in the code currently that I can push a release out, and hopefully garner a bit more exposure (and perhaps even a new developer or two…).

The main new features in this release are:

  • Peer Exchange (PEX) for public torrents (uTorrent protocol)
  • Massively improved interface with a lot more information
  • Sparkle and Growl support
  • Performance and memory use improvements
  • Lots and lots of bugfixes

 Take it for a spin and see what you think. Feel free to post feedback here, or on the niagara-devel list.

I’ve decided to switch from the 0.0.x versioning to a 0.x alpha as I feel that most of the 0.1 functionality I want is in place, and I’d really like some help and feedback on getting the basics stable before tackling some of the advanced features I’m planning a bit further down the track.