Sick of throttling? I am.

 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.

Leave a Reply

You must be logged in to post a comment.