Shouldn't the following code from openssl/zrtpDH by changed?
From this:
if (pkType == DH2K) {
tmpCtx->p = BN_dup(bnP2048);
RAND_bytes(random, 32);
tmpCtx->priv_key = BN_bin2bn(random, 32, NULL);
}
else if (pkType == DH3K) {
tmpCtx->p = BN_dup(bnP3072);
RAND_bytes(random, 64);
tmpCtx->priv_key = BN_bin2bn(random, 32, NULL);
}
To this:
if (pkType == DH2K) {
tmpCtx->p = BN_dup(bnP2048);
RAND_bytes(random, 32);
tmpCtx->priv_key = BN_bin2bn(random, 32, NULL);
}
else if (pkType == DH3K) {
tmpCtx->p = BN_dup(bnP3072);
RAND_bytes(random, 64);
tmpCtx->priv_key = BN_bin2bn(random, 64, NULL);
}
I am not actually sure so I am probably wrong but shouldn't big number for DH3K use all the random 64 bytes instead simply the first 32 bytes?