Bob Bradley wrote:
I'm seeing DH_generate_key generate a public key that is 1 byte less than
expected (127 instead of 128 bytes for a 1024-bit key), but only
sporadically (about every 200-300 tries). I've written the following test
case that always fails for me in less than 300 iterations. I've only
included error checking for the part that I'm seeing fail (for brevity in
this test case, but I verified at each step that nothing else seems to be
failing). The Parameter P data comes from the p1024.c file that comes with
OpenSSL. DH_generate_key always returns 1 (success), but BN_num_bytes says
the pub_key is 127 in some cases.

Am I doing something wrong? Or could this be a problem in DH_generate_key?

no and no


I searched the archives and saw that somebody else ran into a similar issue, but I didn't see any responses:

<http://groups-beta.google.com/group/mailing.openssl.users/msg/acbbaf762919a
141>

Any feedback would be appreciated.

the dh public key is the result of g**k mod p (k is the private key) operation and hence may have less than BN_num_bytes(p) bytes (approx. every 256 key should have <= 127 bytes).

Nils
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    openssl-users@openssl.org
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to