Greetings.. I'm using OpenSSL's Diffie-Hellman implementation, I'm using a 1024 bits P prime, sometimes when i try to obtain the size of a public key with the following code I obtain 127 bytes of lenght instead, when exchanging the public key between the service and the client the shared secret key is not the same, Is this a known bug or is it my mistake?.
DH *dh; dh = DH_new(); dh->p = BN_bin2bn(dh1024_p, sizeof(dh1024_p), NULL); dh->g = BN_bin2bn(dh1024_g, sizeof(dh1024_g), NULL); dh->flags &= ~DH_FLAG_NO_EXP_CONSTTIME; DH_generate_key(a); int size = BN_num_bytes(a->pub_key); Sometimes BN_num_bytes returns 127. Thanks in advance. Regards.Greetings..
I'm using OpenSSL's Diffie-Hellman implementation, I'm using a 1024 bits P prime, sometimes when i try to obtain the size of a public key with the following code I obtain 127 bytes of lenght instead, when exchanging the public key between the service and the client the shared secret key is not the same, Is this a known bug or is it my mistake?.
DH *dh;
dh = DH_new();
dh->p = BN_bin2bn(dh1024_p, sizeof(dh1024_p), NULL);
dh->g = BN_bin2bn(dh1024_g, sizeof(dh1024_g), NULL);
dh->flags &= ~DH_FLAG_NO_EXP_CONSTTIME;
DH_generate_key(a);
int size = BN_num_bytes(a->pub_key);
Sometimes BN_num_bytes returns 127.
Thanks in advance.
Regards.